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) --- bpmn/MSOCockpit/pom.xml | 60 - .../MSOCockpit/src/main/assembly/cockpit-build.xml | 89 - .../main/resources/WEB-INF/applicationContext.xml | 108 - .../WEB-INF/jboss-deployment-structure.xml | 34 - bpmn/MSOCockpit/src/main/resources/WEB-INF/web.xml | 173 - bpmn/MSOCommonBPMN/pom.xml | 303 +- .../org/onap/so/bpmn/common/scripts/AaiUtil.groovy | 643 ++ .../scripts/AbstractServiceTaskProcessor.groovy | 768 +++ .../common/scripts/AllottedResourceUtils.groovy | 343 + .../onap/so/bpmn/common/scripts/AppCClient.groovy | 159 + .../so/bpmn/common/scripts/CatalogDbUtils.groovy | 1311 ++++ .../bpmn/common/scripts/CompleteMsoProcess.groovy | 311 + .../common/scripts/ConfirmVolumeGroupName.groovy | 152 + .../common/scripts/ConfirmVolumeGroupTenant.groovy | 193 + .../bpmn/common/scripts/CreateAAIVfModule.groovy | 612 ++ .../scripts/CreateAAIVfModuleVolumeGroup.groovy | 327 + .../bpmn/common/scripts/CustomE2EGetService.groovy | 440 ++ .../bpmn/common/scripts/CustomE2EPutService.groovy | 283 + .../so/bpmn/common/scripts/DecomposeService.groovy | 170 + .../bpmn/common/scripts/DeleteAAIVfModule.groovy | 335 + .../so/bpmn/common/scripts/ExceptionUtil.groovy | 422 ++ .../so/bpmn/common/scripts/FalloutHandler.groovy | 378 ++ .../common/scripts/GenerateVfModuleName.groovy | 173 + .../bpmn/common/scripts/GenericGetService.groovy | 470 ++ .../so/bpmn/common/scripts/GenericGetVnf.groovy | 275 + .../scripts/GenericNotificationService.groovy | 47 + .../bpmn/common/scripts/GenericPutService.groovy | 282 + .../so/bpmn/common/scripts/GenericUtils.groovy | 40 + .../so/bpmn/common/scripts/ManualHandling.groovy | 343 + .../onap/so/bpmn/common/scripts/MsoUtils.groovy | 999 +++ .../so/bpmn/common/scripts/NetworkUtils.groovy | 1581 +++++ .../onap/so/bpmn/common/scripts/OofHoming.groovy | 348 + .../onap/so/bpmn/common/scripts/OofUtils.groovy | 484 ++ .../common/scripts/PrepareUpdateAAIVfModule.groovy | 366 ++ .../so/bpmn/common/scripts/RainyDayHandler.groovy | 190 + .../common/scripts/ReceiveWorkflowMessage.groovy | 133 + .../onap/so/bpmn/common/scripts/SDNCAdapter.groovy | 327 + .../bpmn/common/scripts/SDNCAdapterRestV1.groovy | 381 ++ .../bpmn/common/scripts/SDNCAdapterRestV2.groovy | 286 + .../so/bpmn/common/scripts/SDNCAdapterUtils.groovy | 1024 +++ .../common/scripts/ServiceTaskProcessor.groovy | 33 + .../so/bpmn/common/scripts/SniroHomingV1.groovy | 260 + .../onap/so/bpmn/common/scripts/SniroUtils.groovy | 353 + .../common/scripts/TrinityExceptionUtil.groovy | 382 ++ .../bpmn/common/scripts/UpdateAAIGenericVnf.groovy | 345 + .../bpmn/common/scripts/UpdateAAIVfModule.groovy | 369 ++ .../onap/so/bpmn/common/scripts/VfModule.groovy | 93 + .../so/bpmn/common/scripts/VfModuleBase.groovy | 1285 ++++ .../onap/so/bpmn/common/scripts/VidUtils.groovy | 553 ++ .../so/bpmn/common/scripts/VnfAdapterRestV1.groovy | 419 ++ .../so/bpmn/common/scripts/VnfAdapterUtils.groovy | 90 + .../mso/bpmn/common/scripts/AaiUtil.groovy | 667 -- .../scripts/AbstractServiceTaskProcessor.groovy | 787 --- .../common/scripts/AllottedResourceUtils.groovy | 333 - .../mso/bpmn/common/scripts/AppCClient.groovy | 140 - .../mso/bpmn/common/scripts/CatalogDbUtils.groovy | 1251 ---- .../bpmn/common/scripts/CompleteMsoProcess.groovy | 314 - .../common/scripts/ConfirmVolumeGroupName.groovy | 159 - .../common/scripts/ConfirmVolumeGroupTenant.groovy | 193 - .../bpmn/common/scripts/CreateAAIVfModule.groovy | 635 -- .../scripts/CreateAAIVfModuleVolumeGroup.groovy | 334 - .../bpmn/common/scripts/CustomE2EGetService.groovy | 443 -- .../bpmn/common/scripts/CustomE2EPutService.groovy | 281 - .../bpmn/common/scripts/DecomposeService.groovy | 178 - .../bpmn/common/scripts/DeleteAAIVfModule.groovy | 350 - .../mso/bpmn/common/scripts/ExceptionUtil.groovy | 398 -- .../mso/bpmn/common/scripts/FalloutHandler.groovy | 380 -- .../common/scripts/GenerateVfModuleName.groovy | 170 - .../common/scripts/GenericDeleteService.groovy | 309 - .../bpmn/common/scripts/GenericDeleteVnf.groovy | 277 - .../bpmn/common/scripts/GenericGetService.groovy | 471 -- .../mso/bpmn/common/scripts/GenericGetVnf.groovy | 273 - .../scripts/GenericNotificationService.groovy | 21 - .../bpmn/common/scripts/GenericPutService.groovy | 276 - .../mso/bpmn/common/scripts/GenericPutVnf.groovy | 172 - .../mso/bpmn/common/scripts/GenericUtils.groovy | 20 - .../mso/bpmn/common/scripts/ManualHandling.groovy | 345 - .../mso/bpmn/common/scripts/MsoUtils.groovy | 1016 --- .../mso/bpmn/common/scripts/NetworkUtils.groovy | 1573 ----- .../mso/bpmn/common/scripts/OofHoming.groovy | 339 - .../mso/bpmn/common/scripts/OofUtils.groovy | 463 -- .../common/scripts/PrepareUpdateAAIVfModule.groovy | 375 -- .../mso/bpmn/common/scripts/RainyDayHandler.groovy | 198 - .../common/scripts/ReceiveWorkflowMessage.groovy | 109 - .../mso/bpmn/common/scripts/SDNCAdapter.groovy | 335 - .../bpmn/common/scripts/SDNCAdapterRestV1.groovy | 343 - .../bpmn/common/scripts/SDNCAdapterRestV2.groovy | 254 - .../bpmn/common/scripts/SDNCAdapterUtils.groovy | 1043 --- .../mso/bpmn/common/scripts/SNIROUtils.groovy | 334 - .../common/scripts/ServiceTaskProcessor.groovy | 33 - .../mso/bpmn/common/scripts/SniroHoming.groovy | 274 - .../common/scripts/TrinityExceptionUtil.groovy | 382 -- .../bpmn/common/scripts/UpdateAAIGenericVnf.groovy | 347 - .../bpmn/common/scripts/UpdateAAIVfModule.groovy | 382 -- .../mso/bpmn/common/scripts/VfModule.groovy | 87 - .../mso/bpmn/common/scripts/VfModuleBase.groovy | 1285 ---- .../mso/bpmn/common/scripts/VidUtils.groovy | 548 -- .../bpmn/common/scripts/VnfAdapterRestV1.groovy | 413 -- .../mso/bpmn/common/scripts/VnfAdapterUtils.groovy | 86 - .../onap/so/bpmn/appc/payload/PayloadClient.java | 103 + .../appc/payload/beans/ConfigModifyAction.java | 59 + .../beans/ConfigurationParametersConfigModify.java | 58 + .../beans/ConfigurationParametersHealthCheck.java | 45 + .../beans/ConfigurationParametersQuiesce.java | 59 + .../ConfigurationParametersResumeTraffic.java | 45 + .../beans/ConfigurationParametersUpgrade.java | 71 + .../bpmn/appc/payload/beans/HealthCheckAction.java | 58 + .../appc/payload/beans/QuiesceTrafficAction.java | 45 + .../beans/RequestParametersConfigModify.java | 46 + .../beans/RequestParametersHealthCheck.java | 47 + .../appc/payload/beans/ResumeTrafficAction.java | 45 + .../so/bpmn/appc/payload/beans/SnapshotAction.java | 59 + .../bpmn/appc/payload/beans/StartStopAction.java | 45 + .../so/bpmn/appc/payload/beans/UpgradeAction.java | 45 + .../onap/so/bpmn/common/ActionPreProcessor.java | 45 + .../so/bpmn/common/BuildingBlockExecution.java | 37 + .../DefaultToShortClassNameBeanNameGenerator.java | 33 + .../onap/so/bpmn/common/DelegateExecutionImpl.java | 118 + .../org/onap/so/bpmn/common/InjectExecution.java | 34 + .../org/onap/so/bpmn/common/InjectionHelper.java | 60 + .../onap/so/bpmn/common/SpringContextHelper.java | 41 + .../MalformedBuildingBlockInputException.java | 47 + .../MissingBuildingBlockInputException.java | 47 + .../RequiredExecutionVariableExeception.java | 38 + .../so/bpmn/common/recipe/BpmnIntegerParam.java | 48 + .../org/onap/so/bpmn/common/recipe/BpmnParam.java | 54 + .../onap/so/bpmn/common/recipe/BpmnRestClient.java | 205 + .../onap/so/bpmn/common/recipe/ResourceInput.java | 295 + .../bpmn/common/recipe/ResourceRecipeRequest.java | 159 + .../common/resource/ResourceRequestBuilder.java | 225 + .../onap/so/bpmn/common/util/CryptoHandler.java | 68 + .../onap/so/bpmn/common/util/ICryptoHandler.java | 27 + .../workflow/context/WorkflowCallbackResponse.java | 52 + .../common/workflow/context/WorkflowContext.java | 98 + .../workflow/context/WorkflowContextHolder.java | 140 + .../common/workflow/context/WorkflowResponse.java | 78 + .../so/bpmn/servicedecomposition/Metadata.java | 40 + .../so/bpmn/servicedecomposition/ShallowCopy.java | 48 + .../bbobjects/AllottedResource.java | 129 + .../bbobjects/CloudRegion.java | 104 + .../servicedecomposition/bbobjects/Collection.java | 97 + .../bbobjects/Configuration.java | 230 + .../bbobjects/CtagAssignment.java | 65 + .../servicedecomposition/bbobjects/Customer.java | 99 + .../bbobjects/Entitlement.java | 70 + .../bpmn/servicedecomposition/bbobjects/Evc.java | 164 + .../bbobjects/ForwarderEvc.java | 103 + .../servicedecomposition/bbobjects/GenericVnf.java | 510 ++ .../servicedecomposition/bbobjects/HostRoute.java | 84 + .../bbobjects/InstanceGroup.java | 104 + .../bbobjects/L3InterfaceIpv4AddressList.java | 108 + .../bbobjects/L3InterfaceIpv6AddressList.java | 123 + .../servicedecomposition/bbobjects/L3Network.java | 269 + .../servicedecomposition/bbobjects/LInterface.java | 191 + .../bbobjects/LagInterface.java | 123 + .../bbobjects/LineOfBusiness.java | 63 + .../servicedecomposition/bbobjects/Metadatum.java | 66 + .../bbobjects/NetworkPolicy.java | 91 + .../bbobjects/OwningEntity.java | 68 + .../servicedecomposition/bbobjects/PServer.java | 83 + .../bbobjects/PhysicalLink.java | 149 + .../servicedecomposition/bbobjects/Platform.java | 63 + .../bpmn/servicedecomposition/bbobjects/Pnf.java | 116 + .../servicedecomposition/bbobjects/Project.java | 63 + .../bbobjects/RouteTableReference.java | 74 + .../bbobjects/RouteTarget.java | 84 + .../bbobjects/SegmentationAssignment.java | 60 + .../bbobjects/ServiceInstance.java | 206 + .../bbobjects/ServiceProxy.java | 108 + .../bbobjects/ServiceSubscription.java | 76 + .../servicedecomposition/bbobjects/SriovVf.java | 156 + .../servicedecomposition/bbobjects/Subnet.java | 173 + .../servicedecomposition/bbobjects/VfModule.java | 137 + .../bpmn/servicedecomposition/bbobjects/Vlan.java | 162 + .../bbobjects/VolumeGroup.java | 121 + .../servicedecomposition/bbobjects/VpnBinding.java | 141 + .../bbobjects/VpnBondingLink.java | 166 + .../entities/BuildingBlock.java | 66 + .../entities/ExecuteBuildingBlock.java | 103 + .../entities/GeneralBuildingBlock.java | 93 + .../servicedecomposition/entities/ResourceKey.java | 34 + .../entities/WorkflowResourceIds.java | 103 + .../InvalidBuildingBlockInputException.java | 47 + .../generalobjects/License.java | 56 + .../generalobjects/OrchestrationContext.java | 44 + .../generalobjects/RequestContext.java | 115 + .../generalobjects/RequestParameters.java | 112 + .../homingobjects/Candidate.java | 71 + .../homingobjects/CandidateType.java | 44 + .../homingobjects/SolutionCandidates.java | 66 + .../homingobjects/SolutionInfo.java | 99 + .../modelinfo/ModelInfoAllottedResource.java | 146 + .../modelinfo/ModelInfoCollection.java | 91 + .../modelinfo/ModelInfoConfiguration.java | 56 + .../modelinfo/ModelInfoGenericVnf.java | 145 + .../modelinfo/ModelInfoInstanceGroup.java | 83 + .../modelinfo/ModelInfoMetadata.java | 83 + .../modelinfo/ModelInfoNetwork.java | 169 + .../modelinfo/ModelInfoServiceInstance.java | 81 + .../modelinfo/ModelInfoServiceProxy.java | 32 + .../modelinfo/ModelInfoVfModule.java | 136 + .../modelinfo/ModelInfoVolumeGroup.java | 30 + .../servicedecomposition/tasks/AssignFlows.java | 44 + .../servicedecomposition/tasks/BBInputSetup.java | 1586 +++++ .../tasks/BBInputSetupMapperLayer.java | 464 ++ .../tasks/BBInputSetupUtils.java | 409 ++ .../tasks/ExecuteBuildingBlockRainyDay.java | 116 + .../tasks/ExtractPojosForBB.java | 137 + .../client/appc/ApplicationControllerAction.java | 182 + .../client/appc/ApplicationControllerCallback.java | 40 + .../client/appc/ApplicationControllerClient.java | 206 + .../client/appc/ApplicationControllerClientV2.java | 154 + .../appc/ApplicationControllerConfiguration.java | 85 + .../appc/ApplicationControllerOrchestrator.java | 53 + ...ApplicationControllerOrchestratorException.java | 36 + .../client/appc/ApplicationControllerSupport.java | 215 + .../so/client/avpn/dmaap/beans/AVPNDmaapBean.java | 40 + .../avpn/dmaap/beans/AsyncRequestStatus.java | 119 + .../avpn/dmaap/beans/InstanceReferences.java | 39 + .../so/client/avpn/dmaap/beans/RequestStatus.java | 79 + .../so/client/db/request/RequestsDbClient.java | 86 + .../DefaultDmaapPropertiesImpl.java | 40 + .../dmaapproperties/DmaapPropertiesClient.java | 115 + .../client/dmaapproperties/DmaapPropertiesMap.java | 48 + .../dmaapproperties/GlobalDmaapPublisher.java | 64 + .../exception/BBObjectNotFoundException.java | 45 + .../so/client/exception/BadResponseException.java | 32 + .../onap/so/client/exception/ExceptionBuilder.java | 90 + .../onap/so/client/exception/MapperException.java | 32 + .../OrchestrationStatusValidationException.java | 29 + .../client/restproperties/AAIPropertiesImpl.java | 63 + .../restproperties/AaiPropertiesConfiguration.java | 42 + .../restproperties/PolicyRestPropertiesImpl.java | 65 + .../restproperties/UrnPropertiesReaderWrapper.java | 30 + .../mso/bpmn/appc/payload/PayloadClient.java | 109 - .../appc/payload/beans/ConfigModifyAction.java | 59 - .../beans/ConfigurationParametersConfigModify.java | 58 - .../beans/ConfigurationParametersHealthCheck.java | 45 - .../beans/ConfigurationParametersQuiesce.java | 59 - .../ConfigurationParametersResumeTraffic.java | 45 - .../beans/ConfigurationParametersUpgrade.java | 71 - .../bpmn/appc/payload/beans/HealthCheckAction.java | 59 - .../appc/payload/beans/QuiesceTrafficAction.java | 46 - .../beans/RequestParametersConfigModify.java | 46 - .../beans/RequestParametersHealthCheck.java | 47 - .../appc/payload/beans/ResumeTrafficAction.java | 45 - .../bpmn/appc/payload/beans/SnapshotAction.java | 59 - .../bpmn/appc/payload/beans/StartStopAction.java | 55 - .../mso/bpmn/appc/payload/beans/UpgradeAction.java | 45 - .../bpmn/common/adapter/sdnc/CallbackHeader.java | 139 - .../bpmn/common/adapter/sdnc/ObjectFactory.java | 91 - .../bpmn/common/adapter/sdnc/RequestHeader.java | 223 - .../adapter/sdnc/SDNCAdapterCallbackRequest.java | 130 - .../common/adapter/sdnc/SDNCAdapterRequest.java | 111 - .../common/adapter/sdnc/SDNCAdapterResponse.java | 51 - .../adapter/sdnc/SDNCCallbackAdapterPortType.java | 53 - .../mso/bpmn/common/adapter/sdnc/package-info.java | 22 - .../common/adapter/vnf/CreateVnfNotification.java | 462 -- .../common/adapter/vnf/DeleteVnfNotification.java | 198 - .../common/adapter/vnf/MsoExceptionCategory.java | 61 - .../mso/bpmn/common/adapter/vnf/MsoRequest.java | 112 - .../mso/bpmn/common/adapter/vnf/ObjectFactory.java | 208 - .../common/adapter/vnf/QueryVnfNotification.java | 488 -- .../adapter/vnf/RollbackVnfNotification.java | 175 - .../common/adapter/vnf/UpdateVnfNotification.java | 412 -- .../bpmn/common/adapter/vnf/VnfAdapterNotify.java | 177 - .../adapter/vnf/VnfAdapterNotify_Service.java | 108 - .../mso/bpmn/common/adapter/vnf/VnfRollback.java | 210 - .../mso/bpmn/common/adapter/vnf/VnfStatus.java | 61 - .../mso/bpmn/common/adapter/vnf/package-info.java | 22 - .../mso/bpmn/common/recipe/BpmnIntegerParam.java | 48 - .../mso/bpmn/common/recipe/BpmnParam.java | 54 - .../mso/bpmn/common/recipe/BpmnRestClient.java | 224 - .../mso/bpmn/common/recipe/ResourceInput.java | 295 - .../bpmn/common/recipe/ResourceRecipeRequest.java | 159 - .../common/resource/ResourceRequestBuilder.java | 227 - .../mso/bpmn/common/util/CryptoHandler.java | 68 - .../mso/bpmn/common/util/CryptoUtils.java | 98 - .../mso/bpmn/common/util/ICryptoHandler.java | 27 - .../workflow/service/AbstractCallbackService.java | 421 -- .../service/ProcessEngineAwareService.java | 64 - .../service/SDNCAdapterCallbackServiceImpl.java | 83 - .../service/VnfAdapterNotifyServiceImpl.java | 249 - .../service/WorkflowAsyncCommonResource.java | 33 - .../workflow/service/WorkflowAsyncResource.java | 289 - .../workflow/service/WorkflowCallbackResponse.java | 52 - .../common/workflow/service/WorkflowContext.java | 96 - .../workflow/service/WorkflowContextHolder.java | 188 - .../workflow/service/WorkflowMessageResource.java | 108 - .../common/workflow/service/WorkflowResource.java | 615 -- .../service/WorkflowResourceApplication.java | 46 - .../common/workflow/service/WorkflowResponse.java | 97 - .../adapter/network/NetworkAdapterClient.java | 45 - .../adapter/network/NetworkAdapterClientImpl.java | 97 - .../network/NetworkAdapterRestProperties.java | 56 - .../adapter/requests/db/MsoRequestsDbAdapter.java | 35 - .../requests/db/MsoRequestsDbAdapterClient.java | 300 - .../db/entities/MsoRequestsDbException.java | 62 - .../db/entities/MsoRequestsDbExceptionBean.java | 48 - .../requests/db/entities/RequestStatusType.java | 69 - .../requests/db/entities/ResponseStatus.java | 33 - .../adapter/requests/db/entities/Status.java | 40 - .../requests/db/entities/UpdateInfraRequest.java | 138 - .../mso/client/adapter/vnf/AdapterRestClient.java | 69 - .../client/adapter/vnf/AdapterRestProperties.java | 29 - .../mso/client/adapter/vnf/VnfAdapterClient.java | 48 - .../client/adapter/vnf/VnfAdapterClientImpl.java | 106 - .../adapter/vnf/VnfAdapterRestProperties.java | 56 - .../client/appc/ApplicationControllerAction.java | 178 - .../client/appc/ApplicationControllerCallback.java | 40 - .../client/appc/ApplicationControllerClient.java | 212 - .../appc/ApplicationControllerOrchestrator.java | 50 - ...ApplicationControllerOrchestratorException.java | 36 - .../client/appc/ApplicationControllerSupport.java | 215 - .../dmaaproperties/DefaultDmaapPropertiesImpl.java | 39 - .../mso/client/orchestration/AAIOrchestrator.java | 114 - .../mso/client/orchestration/SDNCOrchestrator.java | 61 - .../client/restproperties/AAIPropertiesImpl.java | 64 - .../restproperties/PolicyRestPropertiesImpl.java | 64 - .../mso/client/sdnc/beans/SDNCRequest.java | 95 - .../mso/client/sdnc/beans/SDNCSvcAction.java | 46 - .../mso/client/sdnc/beans/SDNCSvcOperation.java | 43 - .../mso/client/sdnc/mapper/SDNCRequestMapper.java | 46 - .../ServiceTopologyOperationRequestMapper.java | 98 - .../mso/client/sdnc/sync/CallbackHeader.java | 154 - .../openecomp/mso/client/sdnc/sync/Constants.java | 48 - .../mso/client/sdnc/sync/ObjectFactory.java | 77 - .../mso/client/sdnc/sync/RequestHeader.java | 219 - .../mso/client/sdnc/sync/RequestTunables.java | 222 - .../sdnc/sync/SDNCAdapterCallbackRequest.java | 136 - .../mso/client/sdnc/sync/SDNCAdapterPortType.java | 57 - .../client/sdnc/sync/SDNCAdapterPortTypeImpl.java | 108 - .../mso/client/sdnc/sync/SDNCAdapterRequest.java | 128 - .../mso/client/sdnc/sync/SDNCAdapterResponse.java | 53 - .../sdnc/sync/SDNCCallbackAdapterPortType.java | 45 - .../sdnc/sync/SDNCCallbackAdapterService.java | 126 - .../mso/client/sdnc/sync/SDNCRequestIdUtil.java | 39 - .../mso/client/sdnc/sync/SDNCResponse.java | 73 - .../mso/client/sdnc/sync/SDNCSyncRpcClient.java | 317 - .../org/openecomp/mso/client/sdnc/sync/Utils.java | 195 - .../src/main/resources/META-INF/persistence.xml | 74 +- .../src/main/resources/META-INF/processes.xml | 1 - .../services/org.onap.so.client.RestProperties | 2 + .../org.onap.so.client.dmaap.DmaapProperties | 1 + .../org.openecomp.mso.client.RestProperties | 2 - .../org.openecomp.mso.client.dmaap.DmaapProperties | 1 - bpmn/MSOCommonBPMN/src/main/resources/logback.xml | 159 - .../subprocess/BuildingBlock/AppCClient.bpmn | 6 +- .../subprocess/BuildingBlock/DecomposeService.bpmn | 284 +- .../resources/subprocess/BuildingBlock/Homing.bpmn | 350 +- .../subprocess/BuildingBlock/HomingV2.bpmn | 194 + .../subprocess/BuildingBlock/ManualHandling.bpmn | 18 +- .../subprocess/BuildingBlock/Orchestration.bpmn | 56 + .../subprocess/BuildingBlock/RainyDayHandler.bpmn | 6 +- .../resources/subprocess/CompleteMsoProcess.bpmn | 20 +- .../subprocess/ConfirmVolumeGroupName.bpmn | 12 +- .../subprocess/ConfirmVolumeGroupTenant.bpmn | 370 +- .../resources/subprocess/CreateAAIVfModule.bpmn | 1036 +-- .../subprocess/CreateAAIVfModuleVolumeGroup.bpmn | 12 +- .../resources/subprocess/CustomE2EGetService.bpmn | 12 +- .../resources/subprocess/CustomE2EPutService.bpmn | 18 +- .../resources/subprocess/DeleteAAIVfModule.bpmn | 940 +-- .../main/resources/subprocess/FalloutHandler.bpmn | 22 +- .../resources/subprocess/GenerateVfModuleName.bpmn | 6 +- .../resources/subprocess/GenericDeleteService.bpmn | 304 - .../resources/subprocess/GenericDeleteVnf.bpmn | 251 - .../resources/subprocess/GenericGetService.bpmn | 12 +- .../main/resources/subprocess/GenericGetVnf.bpmn | 406 +- .../resources/subprocess/GenericPutService.bpmn | 402 +- .../main/resources/subprocess/GenericPutVnf.bpmn | 135 - .../subprocess/PrepareUpdateAAIVfModule.bpmn | 16 +- .../subprocess/ReceiveWorkflowMessage.bpmn | 6 +- .../resources/subprocess/SDNCAdapterRestV1.bpmn | 166 +- .../resources/subprocess/SDNCAdapterRestV2.bpmn | 192 +- .../main/resources/subprocess/SDNCAdapterV1.bpmn | 194 +- .../resources/subprocess/UpdateAAIGenericVnf.bpmn | 12 +- .../resources/subprocess/UpdateAAIVfModule.bpmn | 12 +- .../resources/subprocess/VnfAdapterRestV1.bpmn | 882 +-- .../src/main/resources/urn.properties | 30 - .../src/main/resources/wsdl/VnfAdapterNotify.wsdl | 22 +- bpmn/MSOCommonBPMN/src/main/resources/xjb/AAI.xjb | 14 - .../src/main/resources/xsd/MSOWorkflowSchemaV1.xsd | 129 - .../src/main/resources/xsd/ManualTasks.xsd | 49 - .../resources/xsd/MsoServiceRequestTypesV1.xsd | 99 - .../src/main/resources/xsd/aai_schema_v10.xsd | 6547 ------------------ .../src/main/resources/xsd/aai_schema_v11.xsd | 6934 -------------------- bpmn/MSOCommonBPMN/src/main/resources/xsd/test.xsd | 68 - .../onap/so/bpmn/common/scripts/AaiUtilTest.groovy | 471 ++ .../AbstractServiceTaskProcessorTest.groovy | 182 + .../bpmn/common/scripts/CatalogDbUtilsTest.groovy | 98 + .../common/scripts/CompleteMsoProcessTest.groovy | 170 + .../scripts/ConfirmVolumeGroupNameTest.groovy | 130 + .../scripts/ConfirmVolumeGroupTenantTest.groovy | 125 + .../common/scripts/CustomE2EGetServiceTest.groovy | 104 + .../common/scripts/CustomE2EPutServiceTest.groovy | 72 + .../common/scripts/DeleteAAIVfModuleTest.groovy | 218 + .../bpmn/common/scripts/ExceptionUtilTest.groovy | 98 + .../bpmn/common/scripts/FalloutHandlerTest.groovy | 312 + .../common/scripts/GenerateVfModuleNameTest.groovy | 125 + .../common/scripts/GenericGetServiceTest.groovy | 124 + .../bpmn/common/scripts/GenericGetVnfTest.groovy | 180 + .../common/scripts/GenericPutServiceTest.groovy | 235 + .../so/bpmn/common/scripts/MsoGroovyTest.groovy | 72 + .../so/bpmn/common/scripts/MsoUtilsTest.groovy | 291 + .../so/bpmn/common/scripts/NetworkUtilsTest.groovy | 101 + .../scripts/PrepareUpdateAAIVfModuleTest.groovy | 171 + .../common/scripts/SDNCAdapterRestV1Test.groovy | 151 + .../common/scripts/SDNCAdapterRestV2Test.groovy | 151 + .../so/bpmn/common/scripts/SDNCAdapterTest.groovy | 951 +++ .../common/scripts/SDNCAdapterUtilsTest.groovy | 191 + .../bpmn/common/scripts/SniroHomingV1Test.groovy | 196 + .../common/scripts/TrinityExceptionUtilTest.groovy | 201 + .../common/scripts/UpdateAAIGenericVnfTest.groovy | 172 + .../common/scripts/UpdateAAIVfModuleTest.groovy | 175 + .../so/bpmn/common/scripts/VidUtilsTest.groovy | 969 +++ .../common/scripts/VnfAdapterRestV1Test.groovy | 118 + .../IgnoreNamedElementsDifferenceListener.groovy | 51 + .../bpmn/common/scripts/utils/XmlComparator.groovy | 41 + .../mso/bpmn/common/scripts/AaiUtilTest.groovy | 385 -- .../common/scripts/CompleteMsoProcessTest.groovy | 170 - .../bpmn/common/scripts/ExceptionUtilTest.groovy | 66 - .../bpmn/common/scripts/FalloutHandlerTest.groovy | 312 - .../common/scripts/GenericPutServiceTest.groovy | 214 - .../mso/bpmn/common/scripts/MsoGroovyTest.groovy | 72 - .../mso/bpmn/common/scripts/MsoUtilsTest.groovy | 233 - .../bpmn/common/scripts/NetworkUtilsTest.groovy | 97 - .../mso/bpmn/common/scripts/SDNCAdapterTest.groovy | 948 --- .../common/scripts/SDNCAdapterUtilsTest.groovy | 213 - .../common/scripts/TrinityExceptionUtilTest.groovy | 201 - .../mso/bpmn/common/scripts/VidUtilsTest.groovy | 972 --- .../common/scripts/VnfAdapterRestV1Test.groovy | 44 - .../java/org/onap/so/AllBaseTaskTestSuite.java | 33 + .../test/java/org/onap/so/AllGroovyTestSuites.java | 32 + .../src/test/java/org/onap/so/AllTestSuites.java | 32 + .../src/test/java/org/onap/so/BaseTest.java | 163 + .../src/test/java/org/onap/so/BaseUnitTest.java | 25 + .../org/onap/so/BuildingBlockTestDataSetup.java | 668 ++ .../java/org/onap/so/EmbeddedMariaDbConfig.java | 64 + .../test/java/org/onap/so/SerializableChecker.java | 181 + .../src/test/java/org/onap/so/TestApplication.java | 49 + .../java/org/onap/so/TestApplicationConfig.java | 96 + .../so/bpmn/appc/payload/PayloadClientTest.java | 81 + .../java/org/onap/so/bpmn/common/BeansTest.java | 74 + ...faultToShortClassNameBeanNameGeneratorTest.java | 65 + .../so/bpmn/common/DelegateExecutionImplTest.java | 146 + .../onap/so/bpmn/common/MSOCommonApplication.java | 115 + .../so/bpmn/common/MockAAIDeleteGenericVnf.java | 39 + .../onap/so/bpmn/common/MockAAIDeleteVfModule.java | 53 + .../so/bpmn/common/MockAAIGenericVnfSearch.java | 340 + .../onap/so/bpmn/common/MockLoggerDelegate.java | 35 + .../org/onap/so/bpmn/common/SPIPropertiesTest.java | 69 + .../so/bpmn/common/WorkflowContextHolderTest.java | 68 + .../so/bpmn/common/WorkflowTestTransformer.java | 41 + .../onap/so/bpmn/common/recipe/BpmnParamTest.java | 41 + .../so/bpmn/common/recipe/ResourceInputTest.java | 66 + .../common/recipe/ResourceRecipeRequestTest.java | 52 + .../resource/ResourceRequestBuilderTest.java | 42 + .../so/bpmn/common/util/CryptoHandlerTest.java | 55 + .../test/java/org/onap/so/bpmn/mock/FileUtil.java | 81 + .../java/org/onap/so/bpmn/mock/MockResource.java | 207 + .../onap/so/bpmn/mock/MockResourceApplication.java | 55 + .../so/bpmn/mock/SDNCAdapterAsyncTransformer.java | 153 + .../so/bpmn/mock/SDNCAdapterMockTransformer.java | 142 + .../SDNCAdapterNetworkTopologyMockTransformer.java | 136 + .../org/onap/so/bpmn/mock/StubResponseAAI.java | 1110 ++++ .../org/onap/so/bpmn/mock/StubResponseAPPC.java | 65 + .../onap/so/bpmn/mock/StubResponseDatabase.java | 118 + .../so/bpmn/mock/StubResponseNetworkAdapter.java | 115 + .../org/onap/so/bpmn/mock/StubResponseOof.java | 66 + .../org/onap/so/bpmn/mock/StubResponsePolicy.java | 125 + .../onap/so/bpmn/mock/StubResponseSDNCAdapter.java | 149 + .../org/onap/so/bpmn/mock/StubResponseSNIRO.java | 67 + .../onap/so/bpmn/mock/StubResponseVNFAdapter.java | 206 + .../so/bpmn/mock/VnfAdapterAsyncTransformer.java | 164 + .../bpmn/mock/VnfAdapterCreateMockTransformer.java | 148 + .../bpmn/mock/VnfAdapterDeleteMockTransformer.java | 145 + .../bpmn/mock/VnfAdapterQueryMockTransformer.java | 161 + .../mock/VnfAdapterRollbackMockTransformer.java | 145 + .../bpmn/mock/VnfAdapterUpdateMockTransformer.java | 146 + .../servicedecomposition/BBDecompPojoTest.java | 55 + .../so/bpmn/servicedecomposition/BBPojoTest.java | 65 + .../ExtractPojosForBBTest.java | 221 + .../servicedecomposition/SerializationTest.java | 130 + .../InvalidBuildingBlockInputExceptionTest.java | 67 + .../tasks/BBInputSetupMapperLayerTest.java | 630 ++ .../tasks/BBInputSetupTest.java | 2433 +++++++ .../tasks/BBInputSetupUtilsTest.java | 774 +++ .../tasks/ExecuteBuildlingBlockRainyDayTest.java | 147 + .../so/client/ResponseExceptionMapperImplTest.java | 116 + .../appc/ApplicationControllerActionTest.java | 463 ++ .../appc/ApplicationControllerClientV2Test.java | 131 + .../appc/ApplicationControllerSupportTest.java | 85 + .../avpn/dmaap/beans/AVPNDmaapBeansTest.java | 66 + .../dmaapproperties/DmaapPropertiesClientTest.java | 82 + .../dmaapproperties/GlobalDmaapPublisherTest.java | 41 + .../so/client/exception/ExceptionBuilderTest.java | 76 + .../restproperties/AAIPropertiesImplTest.java | 50 + .../PolicyRestPropertiesImplTest.java | 52 + .../restproperties/RestPropertiesPojoTest.java | 47 + .../so/client/restproperties/ThreadedReadTest.java | 104 + .../mso/bpmn/appc/payload/PayloadClientTest.java | 81 - .../openecomp/mso/bpmn/common/AppCClientTest.java | 119 - .../org/openecomp/mso/bpmn/common/BPMNUtil.java | 248 - .../org/openecomp/mso/bpmn/common/BeansTest.java | 75 - .../mso/bpmn/common/CompleteMsoProcessTest.java | 217 - .../bpmn/common/ConfirmVolumeGroupNameTest.java | 133 - .../bpmn/common/ConfirmVolumeGroupTenantTest.java | 91 - .../mso/bpmn/common/CreateAAIVfModuleTest.java | 277 - .../common/CreateAAIVfModuleVolumeGroupTest.java | 136 - .../mso/bpmn/common/DecomposeServiceTest.java | 94 - .../mso/bpmn/common/DeleteAAIVfModuleTest.java | 643 -- .../mso/bpmn/common/FalloutHandlerTest.java | 235 - .../mso/bpmn/common/GenerateVfModuleNameTest.java | 78 - .../mso/bpmn/common/GenericDeleteServiceTest.java | 279 - .../mso/bpmn/common/GenericDeleteVnfTest.java | 221 - .../mso/bpmn/common/GenericGetServiceTest.java | 560 -- .../mso/bpmn/common/GenericGetVnfTest.java | 191 - .../mso/bpmn/common/GenericPutVnfTest.java | 182 - .../mso/bpmn/common/ManualHandlingTest.java | 124 - .../openecomp/mso/bpmn/common/OofHomingTest.java | 781 --- .../bpmn/common/PrepareUpdateAAIVfModuleTest.java | 212 - .../mso/bpmn/common/RainyDayHandlerTest.java | 85 - .../bpmn/common/ReceiveWorkflowMessageTest.java | 143 - .../mso/bpmn/common/SDNCAdapterCallbackRule.java | 84 - .../mso/bpmn/common/SDNCAdapterRestV2Test.java | 152 - .../mso/bpmn/common/SDNCAdapterV1Test.java | 475 -- .../mso/bpmn/common/SPIPropertiesTest.java | 69 - .../openecomp/mso/bpmn/common/SniroHomingTest.java | 548 -- .../mso/bpmn/common/UpdateAAIGenericVnfTest.java | 175 - .../mso/bpmn/common/UpdateAAIVfModuleTest.java | 141 - .../mso/bpmn/common/VnfAdapterRestV1Test.java | 390 -- .../mso/bpmn/common/WorkflowAsyncResourceTest.java | 96 - .../mso/bpmn/common/WorkflowContextHolderTest.java | 97 - .../openecomp/mso/bpmn/common/WorkflowTest.java | 2094 ------ .../mso/bpmn/common/WorkflowTestTransformer.java | 41 - .../adapter/vnf/CreateVnfNotificationTest.java | 61 - .../adapter/vnf/DeleteVnfNotificationTest.java | 43 - .../bpmn/common/adapter/vnf/MsoRequestTest.java | 37 - .../bpmn/common/adapter/vnf/ObjectFactoryTest.java | 58 - .../adapter/vnf/QueryVnfNotificationTest.java | 60 - .../adapter/vnf/RollbackVnfNotificationTest.java | 43 - .../adapter/vnf/UpdateVnfNotificationTest.java | 59 - .../bpmn/common/adapter/vnf/VnfRollbackTest.java | 48 - .../mso/bpmn/common/recipe/BpmnParamTest.java | 41 - .../mso/bpmn/common/recipe/BpmnRestClientTest.java | 33 - .../mso/bpmn/common/recipe/ResourceInputTest.java | 65 - .../common/recipe/ResourceRecipeRequestTest.java | 51 - .../resource/ResourceRequestBuilderTest.java | 42 - .../mso/bpmn/common/util/CryptoHandlerTest.java | 42 - .../java/org/openecomp/mso/bpmn/mock/FileUtil.java | 75 - .../org/openecomp/mso/bpmn/mock/MockResource.java | 205 - .../mso/bpmn/mock/MockResourceApplication.java | 50 - .../mso/bpmn/mock/SDNCAdapterAsyncTransformer.java | 157 - .../mso/bpmn/mock/SDNCAdapterMockTransformer.java | 140 - .../SDNCAdapterNetworkTopologyMockTransformer.java | 132 - .../openecomp/mso/bpmn/mock/StubResponseAAI.java | 1093 --- .../openecomp/mso/bpmn/mock/StubResponseAPPC.java | 65 - .../mso/bpmn/mock/StubResponseDatabase.java | 110 - .../mso/bpmn/mock/StubResponseNetworkAdapter.java | 113 - .../openecomp/mso/bpmn/mock/StubResponseOof.java | 67 - .../mso/bpmn/mock/StubResponsePolicy.java | 123 - .../mso/bpmn/mock/StubResponseSDNCAdapter.java | 146 - .../openecomp/mso/bpmn/mock/StubResponseSNIRO.java | 69 - .../mso/bpmn/mock/StubResponseVNFAdapter.java | 204 - .../mso/bpmn/mock/VnfAdapterAsyncTransformer.java | 163 - .../bpmn/mock/VnfAdapterCreateMockTransformer.java | 148 - .../bpmn/mock/VnfAdapterDeleteMockTransformer.java | 143 - .../bpmn/mock/VnfAdapterQueryMockTransformer.java | 161 - .../mock/VnfAdapterRollbackMockTransformer.java | 144 - .../bpmn/mock/VnfAdapterUpdateMockTransformer.java | 149 - .../client/ResponseExceptionMapperImplTest.java | 111 - .../adapter/network/NetworkAdapterClientTest.java | 146 - .../requests/db/RequestsDbAdapterClientTest.java | 50 - .../entities/MsoRequestsDbExceptionBeanTest.java | 33 - .../db/entities/MsoRequestsDbExceptionTest.java | 37 - .../db/entities/UpdateInfraRequestTest.java | 64 - .../client/adapter/vnf/VnfAdapterClientTest.java | 156 - .../appc/ApplicationControllerClientTest.java | 113 - .../ApplicationControllerOrchestratorTest.java | 73 - .../appc/ApplicationControllerSupportTest.java | 84 - .../policy/CommonObjectMapperProviderTest.java | 44 - .../mso/client/sdnc/beans/SDNCRequestTest.java | 53 - .../mso/client/sdnc/sync/CallbackHeaderTest.java | 42 - .../mso/client/sdnc/sync/ObjectFactoryTest.java | 39 - .../mso/client/sdnc/sync/RequestHeaderTest.java | 45 - .../mso/client/sdnc/sync/RequestTunablesTest.java | 58 - .../sdnc/sync/SDNCAdapterCallbackRequestTest.java | 41 - .../client/sdnc/sync/SDNCAdapterRequestTest.java | 39 - .../mso/client/sdnc/sync/SDNCResponseTest.java | 43 - .../openecomp/mso/client/sndc/SDNCOrchTest.java | 82 - .../sdncCreateNetworkTopologySim500Response.xml | 4 +- ...CreateNetworkTopologySimResponse_noExtraTag.xml | 4 +- .../SniroHoming/SniroManagerRequest3AR.json | 6 + .../__files/BuildingBlocks/catalogResp.json | 47 - .../__files/BuildingBlocks/oofCallback2AR1Vnf | 113 - .../__files/BuildingBlocks/oofCallback2AR1Vnf2Net | 119 - .../__files/BuildingBlocks/oofCallbackInfraVnf | 50 - .../BuildingBlocks/oofCallbackNoSolutionFound | 18 - .../BuildingBlocks/oofCallbackPolicyException | 9 - .../BuildingBlocks/oofCallbackServiceException | 12 - .../__files/BuildingBlocks/oofCatalogResp.json | 47 - .../resources/__files/BuildingBlocks/oofRequest | 99 - .../__files/BuildingBlocks/oofRequest_infravnf | 56 - .../__files/BuildingBlocks/sniroCallback2AR1Vnf | 110 - .../BuildingBlocks/sniroCallback2AR1Vnf2Net | 170 - .../__files/BuildingBlocks/sniroCallbackInfraVnf | 50 - .../BuildingBlocks/sniroCallbackNoSolutionFound | 15 - .../BuildingBlocks/sniroCallbackPolicyException | 9 - .../BuildingBlocks/sniroCallbackServiceException | 12 - .../__files/BuildingBlocks/sniroRequest_infravnf | 65 - .../__files/CRTGVNF_queryAAIResponseVolume.xml | 42 +- .../CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml | 42 +- .../Archive/drop_mariadb_engine_7.5.6.sql | 148 +- .../Archive/mariadb_engine_7.5_patch_7.5.6.sql | 442 +- .../Cleanup/create_mariadb_camunda7.5.6_ee.sql | 19 - .../__files/Client/CatalogServiceExpected.json | 17 + .../__files/Client/InfraActiveRequestExpected.json | 46 + .../sdncCreateNetworkTopologySimResponse.xml | 4 +- ..._genericQueryByInstanceName_AAIResponse_200.xml | 24 +- .../__files/Database/DBUpdateResponse.xml | 2 +- .../sdncDeleteNetworkTopologySimResponse.xml | 4 +- ...alogDBService_getServiceInstanceNOAAIInput.json | 17 + .../CatalogServiceExpected.json | 17 + .../ExecuteBuildingBlock/CatalogServiceInput.json | 17 + .../ExecuteBuildingBlock/CollectionExpected.json | 6 + .../ExecuteBuildingBlock/CollectionInput.json | 4 + .../ExecuteBuildingBlock/CollectionResource.json | 11 + .../CollectionResourceCustomization.json | 9 + .../ConfigurationExpected.json | 27 + .../ExecuteBuildingBlock/ConfigurationInput.json | 32 + .../__files/ExecuteBuildingBlock/Customer.json | 6 + .../__files/ExecuteBuildingBlock/Customer_AAI.json | 16 + .../ExecuteBuildingBlockSimple.json | 7 + .../GeneralBuildingBlockExpected.json | 99 + .../ExecuteBuildingBlock/GenericVnfExpected.json | 72 + .../HighLevelObjectsExpected.json | 23 + .../HighLevelObjectsInput.json | 19 + ...hLevelObjects_getServiceInstanceNOAAIInput.json | 19 + .../InfraActiveRequestExpected.json | 46 + .../ExecuteBuildingBlock/InstanceGroup.json | 11 + .../InstanceGroupExpected.json | 8 + .../ExecuteBuildingBlock/InstanceGroupInput.json | 12 + .../ExecuteBuildingBlock/LineOfBusiness.json | 3 + .../LineOfBusinessExpected.json | 3 + .../ExecuteBuildingBlock/ModelInfoCollection.json | 8 + .../ModelInfoGenericVnfExpected.json | 21 + .../ModelInfoInstanceGroup.json | 10 + .../ModelInfoNetworkExpected.json | 18 + .../ModelInfoServiceInstance.json | 12 + .../ModelInfoVfModuleExpected.json | 14 + .../ExecuteBuildingBlock/NetworkPolicy.json | 6 + .../NetworkResourceCustomizationInput.json | 25 + .../__files/ExecuteBuildingBlock/OwningEntity.json | 4 + .../__files/ExecuteBuildingBlock/Platform.json | 3 + .../ExecuteBuildingBlock/PlatformExpected.json | 3 + .../__files/ExecuteBuildingBlock/Project.json | 3 + .../RequestContextExpected.json | 12 + .../RequestDetailsExpected.json | 14 + .../ExecuteBuildingBlock/RequestDetailsInput.json | 18 + .../RequestDetailsInput_mapReqContext.json | 13 + .../RequestDetailsInput_serviceMacro.json | 151 + ...equestDetailsInput_withRelatedInstanceList.json | 19 + ...estDetailsInput_withoutRelatedInstanceList.json | 17 + .../RequestDetails_CreateVnf.json | 60 + .../RequestLineOfBusinessInput.json | 3 + .../ExecuteBuildingBlock/RequestPlatformInput.json | 3 + .../RouteTableReferenceExpected.json | 5 + .../RouteTableReferenceInput.json | 6 + .../ExecuteBuildingBlock/SerializationTest.json | 86 + .../ServiceInstanceAAIInput.json | 32 + .../ServiceInstanceAAIPlatformAndLOBInput.json | 72 + .../ServiceInstance_aaiPlatformAndLOBToSI.json | 72 + .../ServiceInstance_aaiServiceInstanceToSI.json | 27 + .../ServiceInstance_catalogServiceToSI.json | 34 + ...ceInstance_getServiceInstanceNOAAIExpected.json | 32 + .../ServiceInstance_highLevelObjectsToSI.json | 35 + .../ExecuteBuildingBlock/ServiceMacroNetworks.json | 109 + .../ServiceMacroNoCloudConfig.json | 105 + .../ServiceMacroVfModules.json | 113 + .../ExecuteBuildingBlock/ServiceMacroVnfs.json | 113 + .../ServiceSubscriptionExpected.json | 5 + .../ServiceSubscription_AAI.json | 7 + .../VfModuleCustomizationInput.json | 24 + .../VnfResourceCustomizationInput.json | 25 + .../VnfcInstanceGroupCustomization.json | 8 + .../__files/ExecuteBuildingBlock/VolumeGroup.json | 9 + .../ExecuteBuildingBlock/VolumeGroup_AAI.json | 11 + .../ExecuteBuildingBlock/aaiGenericVnfInput.json | 104 + .../ExecuteBuildingBlock/aaiL3NetworkInput.json | 50 + .../ExecuteBuildingBlock/aaiVolumeGroupInput.json | 11 + .../ExecuteBuildingBlock/l3NetworkExpected.json | 36 + .../__files/GENDSI_getServiceInstanceResponse.xml | 68 +- .../GenericFlows/getGenericVnfByNameResponse.xml | 44 +- .../__files/GenericFlows/getGenericVnfResponse.xml | 178 +- .../getGenericVnfResponse_hasRelationships.xml | 178 +- .../__files/GenericFlows/getSIUrlById.xml | 10 +- .../__files/GenericFlows/getSIUrlByName.xml | 10 +- .../__files/GenericFlows/getServiceInstance.xml | 58 +- .../GenericFlows/getServiceSubscription.xml | 66 +- .../__files/GenericFlows/getVceByNameResponse.xml | 192 +- .../__files/GenericFlows/getVceResponse.xml | 187 +- .../SDNCAdapterRestV1/sdnc_request.json | 21 + .../SDNCAdapterV1/sdncadapterworkflowrequest.xml | 6 +- .../sdncadaptercallbackrequest.xml | 698 +- .../__files/SDNCAdapterRestV2Request.json | 40 +- .../Schemas/CreateServiceInstanceV3Schema.json | 16 + .../resources/__files/SetupServiceDecompJson.json | 36 + .../__files/StandardSDNCSynchResponse.xml | 2 +- .../UpdateNetworkV2/updateNetworkResponse_500.xml | 8 +- .../updateNetworkResponse_Success.xml | 2 +- .../updateNetwork_queryInstance_Success.xml | 6 +- ...ueryNetworkId_AAIResponse_NoPayload_Success.xml | 146 +- ...k_queryNetworkTableRef1_AAIResponse_Success.xml | 38 +- ...k_queryNetworkTableRef2_AAIResponse_Success.xml | 38 +- .../sdncUpdateNetworkTopologySim500Response.xml | 4 +- .../sdncUpdateNetworkTopologySimResponse.xml | 4 +- .../AddNetworkPolicy_AAIResponse_Success.xml | 40 +- .../VfModularity/DoUpdateVfModuleRequest.xml | 2 +- .../resources/__files/VfModularity/GenericVnf.xml | 76 +- .../QueryNetworkPolicy_AAIResponse_Success.xml | 40 +- .../VfModularity/SDNCTopologyQueryCallback.xml | 630 +- .../SDNCTopologyQueryCallbackVfModule.xml | 282 +- .../VfModularity/StandardSDNCSynchResponse.xml | 2 +- .../VfModularity/UpdateAAIVfModuleRequest.xml | 18 +- .../__files/VfModularity/UpdateVfModuleRequest.xml | 2 +- .../__files/VfModularity/VfModule-lukewarm.xml | 18 +- .../__files/VfModularity/VfModule-new.xml | 16 +- .../__files/VfModularity/VfModule-supercool.xml | 52 +- .../resources/__files/VfModularity/VolumeGroup.xml | 48 +- .../resources/__files/aai-volume-group-id-info.xml | 56 +- .../__files/aai/resources/e2e-complex.json | 78 +- .../resources/service-instance-pathed-query.json | 2 +- .../DoCreateServiceInstance_request.json | 162 + .../getCatalogServiceResourcesDataWithConfig.json | 362 +- .../test/resources/__files/invalidErrorMessage.txt | 1 + .../resources/__files/invalidErrorMessageFlag.txt | 1 + .../src/test/resources/__files/requestDetails.json | 37 + .../src/test/resources/__files/schema.json | 16 + .../resources/__files/sdncCallbackSoapWrapper.xml | 4 +- .../vnfAdapterMocks/vnfCreateSimResponse.xml | 4 +- .../vnfAdapterMocks/vnfDeleteSimResponse.xml | 4 +- .../vnfAdapterMocks/vnfQuerySimResponse.xml | 4 +- .../vnfAdapterMocks/vnfRollbackSimResponse.xml | 4 +- .../__files/vnfAdapterMocks/vnfadapter_request.xml | 41 + .../src/test/resources/application-test.yaml | 223 + .../src/test/resources/camunda.cfg.xml | 46 - .../src/test/resources/logback-test.xml | 30 + .../src/test/resources/logging.properties | 2 - .../src/test/resources/mso.bpmn.properties | 3 - .../src/test/resources/mso.bpmn.urn.properties | 139 - .../src/test/resources/mso.properties | 42 - .../src/test/resources/mso.sdnc.properties | 152 - .../avpn/dmaap/avpnDmaapAsyncRequestStatus.json | 21 + .../ruby/create-ticket/create-ticket-request.json | 15 + .../custom-lport-mirror-post-check-request.json | 26 + .../custom-lport-mirror-pre-check-request.json | 26 + .../custom-port-mirror-post-check-request.json | 22 + .../custom-port-mirror-pre-check-request.json | 22 + .../org/onap/so/client/sdno/output-failure.json | 25 + .../org/onap/so/client/sdno/output-success.json | 22 + .../org/onap/so/client/sdno/response.json | 17 + .../ruby/create-ticket/create-ticket-request.json | 15 - .../custom-lport-mirror-post-check-request.json | 26 - .../custom-lport-mirror-pre-check-request.json | 26 - .../custom-port-mirror-post-check-request.json | 22 - .../custom-port-mirror-pre-check-request.json | 22 - .../openecomp/mso/client/sdno/output-failure.json | 25 - .../openecomp/mso/client/sdno/output-success.json | 22 - .../org/openecomp/mso/client/sdno/response.json | 17 - .../resources/response/clientServiceResponse.json | 105 + .../response/infraActiveRequestsResponse.json | 46 + bpmn/MSOCommonBPMN/src/test/resources/schema.sql | 1188 ++++ .../test/resources/sdncCallbackErrorResponse.xml | 2 +- .../src/test/resources/sdncDeleteResponse.xml | 422 +- .../test/resources/sdnc_adapter_data_request.xml | 64 +- .../src/test/resources/sdnc_adapter_request.xml | 10 +- .../test/resources/sdncadaptercallbackrequest.xml | 684 +- .../sdncadaptercallbackrequest_404CallBack.xml | 24 +- ...sdncadaptercallbackrequest_with_aic_version.xml | 345 + .../resources/sdncadapterworkflowrequest-act.xml | 6 +- .../test/resources/sdncadapterworkflowrequest.xml | 6 +- .../src/test/resources/testAsyncResource.bpmn | 2 +- .../resources/vnfAdapter/vnfUpdateSimResponse.xml | 4 +- bpmn/MSOCoreBPMN/pom.xml | 249 +- .../java/org/onap/so/bpmn/core/BPMNLogger.java | 35 + .../so/bpmn/core/BadInjectedFieldException.java | 52 + .../main/java/org/onap/so/bpmn/core/BaseTask.java | 454 ++ .../bpmn/core/MissingInjectedFieldException.java | 39 + .../org/onap/so/bpmn/core/ResponseBuilder.java | 297 + .../java/org/onap/so/bpmn/core/RollbackData.java | 98 + .../org/onap/so/bpmn/core/UrnPropertiesReader.java | 89 + .../org/onap/so/bpmn/core/WorkflowException.java | 94 + .../onap/so/bpmn/core/domain/AllottedResource.java | 122 + .../org/onap/so/bpmn/core/domain/CloudFlavor.java | 57 + .../so/bpmn/core/domain/CompareModelsResult.java | 53 + .../onap/so/bpmn/core/domain/ConfigResource.java | 45 + .../onap/so/bpmn/core/domain/Configuration.java | 88 + .../org/onap/so/bpmn/core/domain/Customer.java | 52 + .../onap/so/bpmn/core/domain/HomingSolution.java | 155 + .../onap/so/bpmn/core/domain/InventoryType.java | 37 + .../org/onap/so/bpmn/core/domain/JsonWrapper.java | 134 + .../java/org/onap/so/bpmn/core/domain/License.java | 118 + .../org/onap/so/bpmn/core/domain/ModelInfo.java | 97 + .../onap/so/bpmn/core/domain/ModuleResource.java | 94 + .../onap/so/bpmn/core/domain/NetworkResource.java | 78 + .../org/onap/so/bpmn/core/domain/OwningEntity.java | 53 + .../java/org/onap/so/bpmn/core/domain/Project.java | 47 + .../java/org/onap/so/bpmn/core/domain/Request.java | 96 + .../org/onap/so/bpmn/core/domain/Resource.java | 134 + .../so/bpmn/core/domain/ResourceDecomposition.java | 86 + .../onap/so/bpmn/core/domain/ResourceInstance.java | 65 + .../so/bpmn/core/domain/ResourceModelInfo.java | 58 + .../org/onap/so/bpmn/core/domain/ResourceType.java | 26 + .../org/onap/so/bpmn/core/domain/RollbackData.java | 47 + .../so/bpmn/core/domain/ServiceDecomposition.java | 544 ++ .../onap/so/bpmn/core/domain/ServiceInstance.java | 116 + .../org/onap/so/bpmn/core/domain/Subscriber.java | 69 + .../java/org/onap/so/bpmn/core/domain/Vnf.java | 139 + .../org/onap/so/bpmn/core/domain/VnfResource.java | 176 + .../bpmn/core/internal/VariableNameExtractor.java | 67 + .../onap/so/bpmn/core/json/DecomposeJsonUtil.java | 143 + .../bpmn/core/json/JsonDecomposingException.java | 30 + .../java/org/onap/so/bpmn/core/json/JsonUtils.java | 1087 +++ .../java/org/onap/so/bpmn/core/xml/XmlTool.java | 254 + .../org/openecomp/mso/bpmn/core/BPMNLogger.java | 33 - .../mso/bpmn/core/BadInjectedFieldException.java | 52 - .../java/org/openecomp/mso/bpmn/core/BaseTask.java | 454 -- .../mso/bpmn/core/HealthCheckHandler.java | 285 - .../bpmn/core/MissingInjectedFieldException.java | 39 - .../mso/bpmn/core/PropertyConfiguration.java | 443 -- .../mso/bpmn/core/PropertyConfigurationSetup.java | 320 - .../openecomp/mso/bpmn/core/ResponseBuilder.java | 297 - .../org/openecomp/mso/bpmn/core/RollbackData.java | 98 - .../openecomp/mso/bpmn/core/WorkflowException.java | 77 - .../mso/bpmn/core/domain/AllottedResource.java | 129 - .../mso/bpmn/core/domain/CloudFlavor.java | 55 - .../mso/bpmn/core/domain/CompareModelsResult.java | 53 - .../mso/bpmn/core/domain/ConfigResource.java | 60 - .../mso/bpmn/core/domain/Configuration.java | 88 - .../openecomp/mso/bpmn/core/domain/Customer.java | 52 - .../mso/bpmn/core/domain/HomingSolution.java | 155 - .../mso/bpmn/core/domain/InventoryType.java | 37 - .../mso/bpmn/core/domain/JsonWrapper.java | 139 - .../openecomp/mso/bpmn/core/domain/License.java | 120 - .../openecomp/mso/bpmn/core/domain/ModelInfo.java | 97 - .../mso/bpmn/core/domain/ModuleResource.java | 94 - .../mso/bpmn/core/domain/NetworkResource.java | 78 - .../mso/bpmn/core/domain/OwningEntity.java | 53 - .../openecomp/mso/bpmn/core/domain/Project.java | 47 - .../openecomp/mso/bpmn/core/domain/Request.java | 69 - .../openecomp/mso/bpmn/core/domain/Resource.java | 134 - .../bpmn/core/domain/ResourceDecomposition.java | 86 - .../mso/bpmn/core/domain/ResourceInstance.java | 65 - .../mso/bpmn/core/domain/ResourceModelInfo.java | 58 - .../mso/bpmn/core/domain/ResourceType.java | 26 - .../mso/bpmn/core/domain/ServiceDecomposition.java | 524 -- .../mso/bpmn/core/domain/ServiceInstance.java | 109 - .../openecomp/mso/bpmn/core/domain/Subscriber.java | 69 - .../mso/bpmn/core/domain/TunnelConnect.java | 77 - .../mso/bpmn/core/domain/VnfResource.java | 167 - .../bpmn/core/internal/VariableNameExtractor.java | 67 - .../mso/bpmn/core/json/DecomposeJsonUtil.java | 138 - .../bpmn/core/json/JsonDecomposingException.java | 30 - .../openecomp/mso/bpmn/core/json/JsonUtils.java | 1027 --- .../openecomp/mso/bpmn/core/json/JsonWrapper.java | 131 - .../core/mybatis/CustomMyBatisSessionFactory.java | 102 - .../mso/bpmn/core/mybatis/URNMapping.java | 122 - .../core/plugins/LoggingAndURNMappingPlugin.java | 454 -- .../bpmn/core/plugins/WorkflowExceptionPlugin.java | 170 - .../org/openecomp/mso/bpmn/core/xml/XmlTool.java | 374 -- .../main/resources/customMyBatisConfiguration.xml | 32 - bpmn/MSOCoreBPMN/src/main/resources/urnMapping.xml | 44 - .../bpmn/core/BadInjectedFiledExceptionTest.java | 46 + .../java/org/onap/so/bpmn/core/BaseTaskTest.java | 247 + .../test/java/org/onap/so/bpmn/core/BeansTest.java | 91 + .../core/MissingInjectedFiledExceptionTest.java | 39 + .../org/onap/so/bpmn/core/ResponseBuilderTest.java | 110 + .../org/onap/so/bpmn/core/RollbackDataTest.java | 92 + .../onap/so/bpmn/core/UrnPropertiesReaderTest.java | 63 + .../onap/so/bpmn/core/WorkflowExceptionTest.java | 47 + .../so/bpmn/core/domain/AllottedResourceTest.java | 54 + .../bpmn/core/domain/CompareModelsResultTest.java | 83 + .../so/bpmn/core/domain/ConfigResourceTest.java | 39 + .../so/bpmn/core/domain/ConfigurationTest.java | 47 + .../org/onap/so/bpmn/core/domain/CustomerTest.java | 38 + .../onap/so/bpmn/core/domain/DomainPojoTest.java | 56 + .../so/bpmn/core/domain/HomingSolutionTest.java | 58 + .../org/onap/so/bpmn/core/domain/LicenseTest.java | 89 + .../onap/so/bpmn/core/domain/ModelInfoTest.java | 47 + .../so/bpmn/core/domain/ModuleResourceTest.java | 48 + .../so/bpmn/core/domain/NetworkResourceTest.java | 42 + .../onap/so/bpmn/core/domain/OwningEntityTest.java | 39 + .../org/onap/so/bpmn/core/domain/ProjectTest.java | 36 + .../org/onap/so/bpmn/core/domain/RequestTest.java | 44 + .../core/domain/ResourceDecompositionTest.java | 50 + .../org/onap/so/bpmn/core/domain/ResourceTest.java | 68 + .../bpmn/core/domain/ServiceDecompositionTest.java | 125 + .../so/bpmn/core/domain/ServiceInstanceTest.java | 61 + .../onap/so/bpmn/core/domain/SubscriberTest.java | 41 + .../onap/so/bpmn/core/domain/VnfResourceTest.java | 55 + .../core/internal/VariableNameExtractorTest.java | 89 + .../so/bpmn/core/json/DecomposeJsonUtilTest.java | 170 + .../core/json/JsonDecomposingExceptionTest.java | 38 + .../org/onap/so/bpmn/core/json/JsonUtils2Test.java | 329 + .../org/onap/so/bpmn/core/json/JsonUtilsTest.java | 233 + .../onap/so/bpmn/core/utils/CamundaDBSetup.java | 73 + .../org/onap/so/bpmn/core/xml/XmlToolTest.java | 82 + .../mso/bpmn/core/HealthCheckHandlerTest.java | 38 - .../org/openecomp/mso/bpmn/core/JsonUtilsTest.java | 356 - .../mso/bpmn/core/PropertyConfigurationTest.java | 106 - .../openecomp/mso/bpmn/core/RollbackDataTest.java | 85 - .../org/openecomp/mso/bpmn/core/TestBaseTask.java | 271 - .../mso/bpmn/core/domain/AllottedResourceTest.java | 57 - .../bpmn/core/domain/CompareModelsResultTest.java | 83 - .../mso/bpmn/core/domain/ConfigResourceTest.java | 39 - .../mso/bpmn/core/domain/ConfigurationTest.java | 47 - .../mso/bpmn/core/domain/CustomerTest.java | 38 - .../mso/bpmn/core/domain/HomingSolutionTest.java | 58 - .../mso/bpmn/core/domain/LicenseTest.java | 89 - .../mso/bpmn/core/domain/ModelInfoTest.java | 47 - .../mso/bpmn/core/domain/ModuleResourceTest.java | 48 - .../mso/bpmn/core/domain/NetworkResourceTest.java | 42 - .../mso/bpmn/core/domain/OwningEntityTest.java | 39 - .../mso/bpmn/core/domain/ProjectTest.java | 36 - .../mso/bpmn/core/domain/RequestTest.java | 44 - .../core/domain/ResourceDecompositionTest.java | 50 - .../mso/bpmn/core/domain/ResourceTest.java | 68 - .../bpmn/core/domain/ServiceDecompositionTest.java | 83 - .../mso/bpmn/core/domain/ServiceInstanceTest.java | 61 - .../mso/bpmn/core/domain/SubscriberTest.java | 41 - .../mso/bpmn/core/domain/TunnelConnectTest.java | 44 - .../mso/bpmn/core/domain/VnfResourceTest.java | 55 - .../core/internal/VariableNameExtractorTest.java | 86 - .../mso/bpmn/core/json/JsonUtilsTest.java | 65 - .../mso/bpmn/core/utils/CamundaDBSetup.java | 114 - .../src/test/resources/BaseTaskTest.bpmn | 156 +- .../src/test/resources/application-dev.yaml | 5 + .../MSOCoreBPMN/src/test/resources/camunda.cfg.xml | 47 - .../resources/json-examples/AllottedResource.json | 6 + .../resources/json-examples/ConfigResource.json | 6 + .../resources/json-examples/NetworkResource.json | 6 + .../test/resources/json-examples/SNIROExample.json | 2 +- .../json-examples/ServiceDecomposition.json | 22 + .../ServiceDecompositionExpected.json | 51 + .../test/resources/json-examples/VnfResource.json | 12 + .../src/test/resources/logback-test.xml | 4 +- .../src/test/resources/mso.bpmn.properties | 22 - .../src/test/resources/mso.bpmn.urn.properties | 21 - bpmn/MSOCoreBPMN/src/test/resources/request.json | 2 +- .../WebContent/META-INF/MANIFEST.MF | 3 - bpmn/MSOInfrastructureBPMN/pom.xml | 396 -- .../scripts/ActivateSDNCNetworkResource.groovy | 62 - .../CompareModelofE2EServiceInstance.groovy | 278 - .../scripts/CreateActivateSDNCResource.groovy | 425 -- .../scripts/CreateCustomE2EServiceInstance.groovy | 344 - .../CreateGenericALaCarteServiceInstance.groovy | 359 - .../scripts/CreateNetworkInstance.groovy | 457 -- .../scripts/CreateSDNCNetworkResource.groovy | 341 - .../scripts/CreateVFCNSResource.groovy | 335 - .../scripts/CreateVfModuleInfra.groovy | 639 -- .../scripts/CreateVfModuleVolumeInfraV1.groovy | 363 - .../infrastructure/scripts/CreateVnfInfra.groovy | 551 -- .../scripts/DeleteCustomE2EServiceInstance.groovy | 394 -- .../DeleteGenericALaCarteServiceInstance.groovy | 374 -- .../scripts/DeleteNetworkInstance.groovy | 421 -- .../scripts/DeleteSDNCNetworkResource.groovy | 320 - .../scripts/DeleteVFCNSResource.groovy | 87 - .../scripts/DeleteVfModuleInfra.groovy | 375 -- .../scripts/DeleteVfModuleVolumeInfraV1.groovy | 549 -- .../infrastructure/scripts/DeleteVnfInfra.groovy | 217 - .../scripts/DoCompareModelVersions.groovy | 254 - .../DoCompareModelofE2EServiceInstance.groovy | 260 - .../scripts/DoCreateE2EServiceInstance.groovy | 479 -- .../DoCreateE2EServiceInstanceRollback.groovy | 238 - .../scripts/DoCreateNetworkInstance.groovy | 1703 ----- .../scripts/DoCreateNetworkInstanceRollback.groovy | 387 -- .../scripts/DoCreateResources.groovy | 270 - .../scripts/DoCreateServiceInstance.groovy | 798 --- .../scripts/DoCreateServiceInstanceRollback.groovy | 237 - .../DoCreateServiceInstanceRollbackV2.groovy | 51 - .../scripts/DoCreateServiceInstanceV2.groovy | 101 - .../infrastructure/scripts/DoCreateVfModule.groovy | 2148 ------ .../scripts/DoCreateVfModuleRollback.groovy | 676 -- .../scripts/DoCreateVfModuleVolumeRollback.groovy | 238 - .../scripts/DoCreateVfModuleVolumeV2.groovy | 609 -- .../bpmn/infrastructure/scripts/DoCreateVnf.groovy | 643 -- .../scripts/DoCreateVnfAndModules.groovy | 411 -- .../scripts/DoCreateVnfAndModulesRollback.groovy | 366 -- .../DoCustomDeleteE2EServiceInstance.groovy | 661 -- .../DoCustomDeleteE2EServiceInstanceV2.groovy | 1169 ---- .../scripts/DoDeleteE2EServiceInstance.groovy | 486 -- .../scripts/DoDeleteNetworkInstance.groovy | 1076 --- .../scripts/DoDeleteNetworkInstanceRollback.groovy | 335 - .../scripts/DoDeleteResources.groovy | 325 - .../scripts/DoDeleteResourcesV1.groovy | 393 -- .../scripts/DoDeleteServiceInstance.groovy | 478 -- .../DoDeleteVFCNetworkServiceInstance.groovy | 291 - .../infrastructure/scripts/DoDeleteVfModule.groovy | 708 -- .../scripts/DoDeleteVfModuleFromVnf.groovy | 596 -- .../scripts/DoDeleteVfModuleVolumeV2.groovy | 358 - .../bpmn/infrastructure/scripts/DoDeleteVnf.groovy | 136 - .../scripts/DoDeleteVnfAndModules.groovy | 539 -- .../scripts/DoScaleE2EServiceInstance.groovy | 138 - .../DoScaleVFCNetworkServiceInstance.groovy | 328 - .../scripts/DoUpdateE2EServiceInstance.groovy | 465 -- .../DoUpdateE2EServiceInstanceRollback.groovy | 368 -- .../scripts/DoUpdateNetworkInstance.groovy | 1403 ---- .../scripts/DoUpdateNetworkInstanceRollback.groovy | 304 - .../infrastructure/scripts/DoUpdateVfModule.groovy | 1038 --- .../scripts/DoUpdateVnfAndModules.groovy | 416 -- .../scripts/HealchCheckActivate.groovy | 54 - .../infrastructure/scripts/ReplaceVnfInfra.groovy | 626 -- .../bpmn/infrastructure/scripts/RollbackVnf.groovy | 151 - .../scripts/ScaleCustomE2EServiceInstance.groovy | 302 - .../scripts/UpdateCustomE2EServiceInstance.groovy | 575 -- .../scripts/UpdateNetworkInstance.groovy | 455 -- .../infrastructure/scripts/UpdateVfModule.groovy | 331 - .../scripts/UpdateVfModuleInfra.groovy | 510 -- .../scripts/UpdateVfModuleInfraV2.groovy | 470 -- .../scripts/UpdateVfModuleVolume.groovy | 443 -- .../scripts/UpdateVfModuleVolumeInfraV1.groovy | 563 -- .../infrastructure/scripts/UpdateVnfInfra.groovy | 501 -- .../bpmn/infrastructure/scripts/VnfCmBase.groovy | 812 --- .../infrastructure/scripts/VnfConfigUpdate.groovy | 507 -- .../infrastructure/scripts/VnfInPlaceUpdate.groovy | 626 -- .../vcpe/scripts/CreateVcpeResCustService.groovy | 815 --- .../vcpe/scripts/DeleteVcpeResCustService.groovy | 466 -- .../scripts/DoCreateAllottedResourceBRG.groovy | 678 -- .../DoCreateAllottedResourceBRGRollback.groovy | 276 - .../scripts/DoCreateAllottedResourceTXC.groovy | 674 -- .../DoCreateAllottedResourceTXCRollback.groovy | 276 - .../scripts/DoDeleteAllottedResourceBRG.groovy | 372 -- .../scripts/DoDeleteAllottedResourceTXC.groovy | 372 -- .../AAITasks/AAICreateOwningEntity.java | 50 - .../infrastructure/AAITasks/AAICreateProject.java | 50 - .../AAITasks/AAICreateServiceInstance.java | 50 - .../RollbackAAIServiceInstance.java | 56 - .../DoCreateServiceInstance/RollbackError.java | 38 - .../SetupServiceDecomp.java | 112 - .../MSOInfrastructureApplication.java | 58 - .../SDNCTasks/SDNCCreateServiceInstance.java | 49 - .../infrastructure/aai/AAICreateResources.java | 98 - .../aai/AAIDeleteServiceInstance.java | 49 - .../infrastructure/aai/AAIServiceInstance.java | 94 - .../infrastructure/pnf/aai/AaiConnectionImpl.java | 45 - .../pnf/delegate/CancelDmaapSubscription.java | 42 - .../delegate/CheckAaiForCorrelationIdDelegate.java | 76 - .../delegate/CreateAaiEntryWithPnfIdDelegate.java | 55 - .../pnf/delegate/ExecutionVariableNames.java | 33 - .../pnf/delegate/InformDmaapClient.java | 45 - .../pnf/delegate/PnfCheckInputs.java | 57 - .../bpmn/infrastructure/pnf/dmaap/DmaapClient.java | 28 - .../pnf/dmaap/JsonUtilForCorrelationId.java | 71 - .../pnf/dmaap/PnfEventReadyDmaapClient.java | 170 - .../pnf/implementation/AaiConnection.java | 32 - .../pnf/implementation/AaiResponse.java | 48 - .../CheckAaiForCorrelationIdImplementation.java | 50 - .../infrastructure/properties/BPMNProperties.java | 57 - .../vfcmodel/LocationConstraint.java | 73 - .../vfcmodel/NSResourceInputParameter.java | 118 - .../infrastructure/vfcmodel/NsOperationKey.java | 141 - .../bpmn/infrastructure/vfcmodel/NsParameters.java | 70 - .../infrastructure/vfcmodel/NsScaleParameters.java | 78 - .../vfcmodel/ScaleNsByStepsData.java | 91 - .../bpmn/infrastructure/vfcmodel/ScaleNsData.java | 34 - .../infrastructure/vfcmodel/ScaleResource.java | 55 - .../bpmn/infrastructure/vfcmodel/VimLocation.java | 52 - .../workflow/service/ServicePluginFactory.java | 443 -- .../service/WorkflowResourceApplication.java | 53 - .../serviceTask/AbstractSdncOperationTask.java | 370 -- .../SdncNetworkTopologyOperationTask.java | 100 - .../SdncServiceTopologyOperationTask.java | 99 - .../SdncUnderlayVpnOperationClient.java | 118 - .../serviceTask/SdncUnderlayVpnPreprocessTask.java | 48 - .../serviceTask/client/GenericResourceApi.java | 48 - .../workflow/serviceTask/client/HeaderUtil.java | 45 - .../client/builder/AbstractBuilder.java | 245 - .../builder/NetworkRpcInputEntityBuilder.java | 91 - .../builder/ServiceRpcInputEntityBuilder.java | 80 - .../client/entity/NetworkInformationEntity.java | 58 - .../entity/NetworkInputPaarametersEntity.java | 38 - .../client/entity/NetworkRequestInputEntity.java | 80 - .../entity/NetworkResponseInformationEntity.java | 47 - .../NetworkTopologyOperationInputEntity.java | 80 - .../NetworkTopologyOperationOutputEntity.java | 91 - .../client/entity/OnapModelInformationEntity.java | 80 - .../serviceTask/client/entity/ParamEntity.java | 47 - .../client/entity/RequestInformationEntity.java | 91 - .../RpcNetworkTopologyOperationInputEntity.java | 36 - .../RpcNetworkTopologyOperationOutputEntity.java | 36 - .../RpcServiceTopologyOperationInputEntity.java | 36 - .../RpcServiceTopologyOperationOutputEntity.java | 36 - .../client/entity/SdncRequestHeaderEntity.java | 59 - .../client/entity/ServiceInformationEntity.java | 91 - .../entity/ServiceInputParametersEntity.java | 38 - .../client/entity/ServiceRequestInputEntity.java | 48 - .../entity/ServiceResponseInformationEntity.java | 47 - .../ServiceTopologyOperationInputEntity.java | 69 - .../ServiceTopologyOperationOutputEntity.java | 80 - .../src/main/resources/META-INF/persistence.xml | 37 - .../src/main/resources/META-INF/processes.xml | 81 - .../src/main/resources/dmaap.properties | 8 - .../src/main/resources/logback.xml | 159 - .../process/CompareModelofE2EServiceInstance.bpmn | 335 - .../process/CreateActivateSDNCResource.bpmn | 393 -- .../process/CreateAndActivatePnfResource.bpmn | 325 - .../CreateCustom3rdONAPServiceInstance.bpmn | 389 -- .../process/CreateCustomE2EServiceInstance.bpmn | 391 -- .../CreateGenericALaCarteServiceInstance.bpmn | 452 -- .../resources/process/CreateNetworkInstance.bpmn | 340 - .../process/CreateSDNCNetworkResource.bpmn | 287 - .../resources/process/CreateVFCNSResource.bpmn | 277 - .../process/CreateVcpeResCustService.bpmn | 1538 ----- .../process/CreateVcpeResCustServiceV2.bpmn | 1443 ---- .../resources/process/CreateVfModuleInfra.bpmn | 699 -- .../process/CreateVfModuleVolumeInfraV1.bpmn | 514 -- .../src/main/resources/process/CreateVnfInfra.bpmn | 340 - .../DeleteCustom3rdONAPServiceInstance.bpmn | 381 -- .../process/DeleteCustomE2EServiceInstance.bpmn | 381 -- .../DeleteGenericALaCarteServiceInstance.bpmn | 331 - .../resources/process/DeleteNetworkInstance.bpmn | 371 -- .../process/DeleteSDNCNetworkResource.bpmn | 258 - .../resources/process/DeleteVFCNSResource.bpmn | 166 - .../process/DeleteVcpeResCustService.bpmn | 812 --- .../resources/process/DeleteVfModuleInfra.bpmn | 331 - .../process/DeleteVfModuleVolumeInfraV1.bpmn | 568 -- .../src/main/resources/process/DeleteVnfInfra.bpmn | 353 - .../main/resources/process/ReplaceVnfInfra.bpmn | 1813 ----- .../process/ScaleCustomE2EServiceInstance.bpmn | 379 -- .../src/main/resources/process/TestHelloWorld.bpmn | 52 - .../process/UpdateCustomE2EServiceInstance.bpmn | 693 -- .../resources/process/UpdateNetworkInstance.bpmn | 373 -- .../resources/process/UpdateVfModuleInfra.bpmn | 297 - .../resources/process/UpdateVfModuleInfraV2.bpmn | 412 -- .../process/UpdateVfModuleVolumeInfraV1.bpmn | 517 -- .../src/main/resources/process/UpdateVnfInfra.bpmn | 1685 ----- .../main/resources/process/VnfConfigUpdate.bpmn | 1636 ----- .../main/resources/process/VnfInPlaceUpdate.bpmn | 2301 ------- .../subprocess/ActivateSDNCNetworkResource.bpmn | 162 - .../subprocess/CreateServiceInstanceV3.bpmn | 146 - .../CreateServiceInstanceV3Rollback.bpmn | 97 - .../subprocess/DeActivateNetworkResource.bpmn | 258 - .../subprocess/DoCompareModelVersions.bpmn | 330 - .../DoCompareModelofE2EServiceInstance.bpmn | 227 - .../subprocess/DoCreateAllottedResourceBRG.bpmn | 755 --- .../DoCreateAllottedResourceBRGRollback.bpmn | 575 -- .../subprocess/DoCreateAllottedResourceTXC.bpmn | 755 --- .../DoCreateAllottedResourceTXCRollback.bpmn | 575 -- .../subprocess/DoCreateE2ENetworkInstance.bpmn | 136 - .../subprocess/DoCreateE2EServiceInstance.bpmn | 544 -- .../DoCreateE2EServiceInstanceRollback.bpmn | 379 -- .../subprocess/DoCreateE2EServiceInstanceV2.bpmn | 1051 --- .../subprocess/DoCreateNetworkInstance.bpmn | 1362 ---- .../DoCreateNetworkInstanceRollback.bpmn | 517 -- .../resources/subprocess/DoCreateResources.bpmn | 370 -- .../subprocess/DoCreateServiceInstance.bpmn | 515 -- .../DoCreateServiceInstanceRollback.bpmn | 373 -- .../DoCreateServiceInstanceRollbackV2.bpmn | 103 - .../subprocess/DoCreateServiceInstanceV2.bpmn | 197 - .../resources/subprocess/DoCreateVfModule.bpmn | 1701 ----- .../subprocess/DoCreateVfModuleRollback.bpmn | 978 --- .../subprocess/DoCreateVfModuleVolumeRollback.bpmn | 247 - .../subprocess/DoCreateVfModuleVolumeV2.bpmn | 362 - .../src/main/resources/subprocess/DoCreateVnf.bpmn | 658 -- .../subprocess/DoCreateVnfAndModules.bpmn | 491 -- .../subprocess/DoCreateVnfAndModulesRollback.bpmn | 541 -- .../DoCustomDeleteE2EServiceInstance.bpmn | 497 -- .../DoCustomDeleteE2EServiceInstanceV2.bpmn | 956 --- .../subprocess/DoDeleteAllottedResourceBRG.bpmn | 422 -- .../subprocess/DoDeleteAllottedResourceTXC.bpmn | 422 -- .../subprocess/DoDeleteE2EServiceInstance.bpmn | 405 -- .../subprocess/DoDeleteNetworkInstance.bpmn | 933 --- .../DoDeleteNetworkInstanceRollback.bpmn | 546 -- .../resources/subprocess/DoDeleteResources.bpmn | 486 -- .../resources/subprocess/DoDeleteResourcesV1.bpmn | 455 -- .../subprocess/DoDeleteServiceInstance.bpmn | 398 -- .../DoDeleteVFCNetworkServiceInstance.bpmn | 275 - .../resources/subprocess/DoDeleteVfModule.bpmn | 433 -- .../subprocess/DoDeleteVfModuleFromVnf.bpmn | 396 -- .../subprocess/DoDeleteVfModuleVolumeV2.bpmn | 208 - .../src/main/resources/subprocess/DoDeleteVnf.bpmn | 308 - .../subprocess/DoDeleteVnfAndModules.bpmn | 490 -- .../subprocess/DoScaleE2EServiceInstance.bpmn | 187 - .../subprocess/DoScaleVFCServiceInstance.bpmn | 89 - .../subprocess/DoUnderlayVpnOperation.bpmn | 293 - .../subprocess/DoUpdateE2EServiceInstance.bpmn | 648 -- .../DoUpdateE2EServiceInstanceRollback.bpmn | 799 --- .../subprocess/DoUpdateNetworkInstance.bpmn | 828 --- .../DoUpdateNetworkInstanceRollback.bpmn | 373 -- .../resources/subprocess/DoUpdateVfModule.bpmn | 671 -- .../subprocess/DoUpdateVnfAndModules.bpmn | 275 - .../src/main/resources/subprocess/RollbackVnf.bpmn | 346 - .../subprocess/SetRefactorServiceDecomp.bpmn | 68 - .../src/main/resources/urn.properties | 29 - .../src/main/webapp/WEB-INF/applicationContext.xml | 43 - .../webapp/WEB-INF/jboss-deployment-structure.xml | 38 - .../src/main/webapp/WEB-INF/jboss-web.xml | 26 - .../src/main/webapp/WEB-INF/web.xml | 89 - ...CreateGenericAlaCarteServiceInstanceTest.groovy | 215 - .../scripts/CreateNetworkInstanceTest.groovy | 360 - .../scripts/CreateVfModuleVolumeInfraV1Test.groovy | 212 - .../DeleteCustomE2EServiceInstanceTest.groovy | 161 - ...DeleteGenericAlaCarteServiceInstanceTest.groovy | 105 - .../scripts/DeleteNetworkInstanceTest.groovy | 397 -- .../scripts/DeleteVfModuleVolumeInfraV1Test.groovy | 170 - .../DoCreateNetworkInstanceRollbackTest.groovy | 349 - .../scripts/DoCreateNetworkInstanceTest.groovy | 4305 ------------ .../scripts/DoCreateVfModuleVolumeV2Test.groovy | 93 - .../DoCustomDeleteE2EServiceInstanceTest.groovy | 148 - .../DoDeleteNetworkInstanceRollbackTest.groovy | 323 - .../scripts/DoDeleteNetworkInstanceTest.groovy | 1929 ------ .../scripts/DoScaleE2EServiceInstanceTest.groovy | 110 - .../DoUpdateNetworkInstanceRollbackTest.groovy | 315 - .../scripts/DoUpdateNetworkInstanceTest.groovy | 2743 -------- .../ScaleCustomE2EServiceInstanceTest.groovy | 175 - .../scripts/UpdateNetworkInstanceTest.groovy | 368 -- .../scripts/UpdateVfModuleVolumeInfraV1Test.groovy | 93 - .../scripts/CreateVcpeResCustServiceTest.groovy | 1269 ---- .../scripts/DeleteVcpeResCustServiceTest.groovy | 773 --- .../DoCreateAllottedResourceBRGRollbackTest.groovy | 652 -- .../scripts/DoCreateAllottedResourceBRGTest.groovy | 996 --- .../DoCreateAllottedResourceTXCRollbackTest.groovy | 652 -- .../scripts/DoCreateAllottedResourceTXCTest.groovy | 950 --- .../scripts/DoDeleteAllottedResourceBRGTest.groovy | 603 -- .../scripts/DoDeleteAllottedResourceTXCTest.groovy | 603 -- .../mso/bpmn/vcpe/scripts/GroovyTestBase.groovy | 127 - .../mso/bpmn/vcpe/scripts/MapGetter.groovy | 48 - .../mso/bpmn/vcpe/scripts/MapSetter.groovy | 49 - .../AAITasks/AAICreateOwningEntityTest.java | 35 - .../mso/bpmn/infrastructure/BeansTest.java | 72 - .../CreateGenericALaCarteServiceInstanceTest.java | 137 - .../infrastructure/CreateNetworkInstanceTest.java | 665 -- .../infrastructure/CreateVfModuleInfraTest.java | 367 -- .../CreateVfModuleVolumeInfraV1Test.java | 368 -- .../bpmn/infrastructure/CreateVnfInfraTest.java | 225 - .../DeleteGenericALaCarteServiceInstanceTest.java | 111 - .../infrastructure/DeleteNetworkInstanceTest.java | 341 - .../infrastructure/DeleteVfModuleInfraTest.java | 605 -- .../DeleteVfModuleVolumeInfraV1Test.java | 166 - .../bpmn/infrastructure/DeleteVnfInfraTest.java | 200 - .../infrastructure/DoCreateSIRollbackTest.java | 199 - .../DoCreateServiceInstanceTest.java | 130 - .../DoCreateServiceInstanceV2Test.java | 109 - .../DoCreateServiceInstanceV3Test.java | 70 - .../DoCreateVfModuleRollbackTest.java | 161 - .../bpmn/infrastructure/DoCreateVfModuleTest.java | 477 -- .../DoCreateVfModuleVolumeV2Test.java | 240 - .../DoCreateVnfAndModulesRollbackTest.java | 425 -- .../infrastructure/DoCreateVnfAndModulesTest.java | 374 -- .../mso/bpmn/infrastructure/DoCreateVnfTest.java | 131 - .../DoDeleteServiceInstanceTest.java | 108 - .../DoDeleteVfModuleFromVnfTest.java | 177 - .../bpmn/infrastructure/DoDeleteVfModuleTest.java | 631 -- .../DoDeleteVfModuleVolumeV2Test.java | 198 - .../infrastructure/DoDeleteVnfAndModulesTest.java | 352 - .../mso/bpmn/infrastructure/DoDeleteVnfTest.java | 140 - .../bpmn/infrastructure/DoUpdateVfModuleTest.java | 257 - .../infrastructure/DoUpdateVnfAndModulesTest.java | 226 - .../bpmn/infrastructure/ReplaceVnfInfraTest.java | 264 - .../mso/bpmn/infrastructure/RollbackVnfTest.java | 134 - .../infrastructure/SetupServiceDecompTest.java | 65 - .../bpmn/infrastructure/StubResponseAAITest.java | 168 - .../infrastructure/UpdateNetworkInstanceTest.java | 489 -- .../infrastructure/UpdateVfModuleInfraTest.java | 145 - .../infrastructure/UpdateVfModuleInfraV2Test.java | 119 - .../UpdateVfModuleVolumeInfraV1Test.java | 143 - .../bpmn/infrastructure/UpdateVnfInfraTest.java | 173 - .../bpmn/infrastructure/VnfConfigUpdateTest.java | 146 - .../bpmn/infrastructure/VnfInPlaceUpdateTest.java | 159 - .../infrastructure/aai/AAIServiceInstanceTest.java | 114 - .../pnf/delegate/AaiConnectionTestImpl.java | 73 - .../delegate/AaiConnectionThrowingException.java | 39 - .../pnf/delegate/CancelDmaapSubscriptionTest.java | 57 - .../CheckAaiForCorrelationIdDelegateTest.java | 132 - .../CreateAaiEntryWithPnfIdDelegateTest.java | 50 - .../pnf/delegate/DmaapClientTestImpl.java | 59 - .../pnf/delegate/InformDmaapClientTest.java | 94 - .../pnf/delegate/PnfCheckInputsTest.java | 84 - .../bpmn/CreateAndActivatePnfResourceTest.java | 146 - .../pnf/dmaap/JsonUtilForCorrelationIdTest.java | 76 - .../pnf/dmaap/PnfEventReadyDmaapClientTest.java | 208 - .../service/WorkflowResourceApplicationTest.java | 38 - .../serviceTask/client/HeaderUtilTest.java | 34 - .../client/builder/AbstractBuilderTest.java | 358 - .../openecomp/mso/bpmn/vcpe/AbstractTestBase.java | 41 - .../bpmn/vcpe/CreateVcpeResCustServiceTest.java | 382 -- .../bpmn/vcpe/DeleteVcpeResCustServiceTest.java | 297 - .../DoCreateAllottedResourceBRGRollbackTest.java | 345 - .../bpmn/vcpe/DoCreateAllottedResourceBRGTest.java | 296 - .../DoCreateAllottedResourceTXCRollbackTest.java | 345 - .../bpmn/vcpe/DoCreateAllottedResourceTXCTest.java | 302 - .../bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java | 162 - .../bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java | 162 - .../stubprocess/DoCreateAllottedResourceBRG.bpmn | 54 - .../DoCreateAllottedResourceBRGRollback.bpmn | 55 - .../stubprocess/DoCreateAllottedResourceTXC.bpmn | 38 - .../DoCreateServiceInstanceRollback.bpmn | 53 - .../VCPE/stubprocess/DoCreateVnfAndModules.bpmn | 53 - .../stubprocess/DoCreateVnfAndModulesRollback.bpmn | 53 - .../VCPE/stubprocess/DoDeleteVnfAndModules.bpmn | 37 - .../test/resources/VCPE/stubprocess/Homing.bpmn | 35 - .../AAI/AAI_defaultCloudRegionByCloudRegionId.json | 12 - .../resources/__files/AAI/AAI_genericVnfGet.json | 9 - .../__files/AAI/AAI_genericVnfsByVnfId.json | 435 -- .../resources/__files/AAI/AAI_pserverByVnfId.json | 72 - .../src/test/resources/__files/AAI/mockObject.json | 10 - .../test/resources/__files/APPC/appc_error.json | 21 - .../__files/BuildingBlocks/sniroCallback2AR1Vnf | 107 - .../BuildingBlocks/sniroCallback2AR1Vnf2Net | 165 - .../BuildingBlocks/sniroCallbackNoSolutionFound | 15 - .../BuildingBlocks/sniroCallbackPolicyException | 9 - .../BuildingBlocks/sniroCallbackServiceException | 12 - .../cloudRegion25_AAIResponse_Success.xml | 20 - .../cloudRegion30_AAIResponse_Success.xml | 20 - .../CreateNetworkV2/createNetworkResponse_400.xml | 6 - .../CreateNetworkV2/createNetworkResponse_500.xml | 80 - .../createNetworkResponse_Success.xml | 24 - .../createNetwork_queryInstance_Success.xml | 4 - ...reateNetwork_queryName2_AAIResponse_Success.xml | 62 - ...Network_queryNameActive_AAIResponse_Success.xml | 74 - .../createNetwork_queryName_AAIResponse_404.xml | 19 - ...createNetwork_queryName_AAIResponse_Success.xml | 62 - ...reateNetwork_queryNetworkId_AAIResponse_404.xml | 19 - ...ueryNetworkId_AAIResponse_NoPayload_Success.xml | 73 - ...eNetwork_queryNetworkId_AAIResponse_Success.xml | 110 - ...work_queryNetworkPolicy_AAIResponse_Success.xml | 21 - ...k_queryNetworkTableRef1_AAIResponse_Success.xml | 20 - ...k_queryNetworkTableRef2_AAIResponse_Success.xml | 20 - ...ork_queryVpnBindingList_AAIResponse_Success.xml | 57 - ...Network_queryVpnBinding_AAIResponse_Success.xml | 46 - ...eNetwork_updateContrail_AAIResponse_Success.xml | 11 - ...sdncCreateNetworkTopologyRsrcAssignResponse.xml | 17 - .../sdncCreateNetworkTopologySimResponse.xml | 19 - .../DoCreateServiceInstanceInput.json | 42 - .../SetupServiceDecompJson.json | 33 - ...e_createServiceInstance_AAIResponse_Success.xml | 11 - ...e_queryGlobalCustomerId_AAIResponse_Success.xml | 62 - .../CreateVfModuleCallbackException.xml | 7 - .../CreateVfModuleVolumeCallbackResponse.xml | 53 - .../CreateVfModuleVolumeRequest.xml | 24 - .../CreateVfModuleVolumeInfraV1/GenericVnf.xml | 38 - .../RollbackVfModuleVolumeCallbackResponse.xml | 5 - .../createVfModuleVolume_VID_request.json | 72 - ...createVfModuleVolume_VID_request_noreqparm.json | 45 - ...Volume_createVolumeName_AAIResponse_Success.xml | 49 - ...Volume_deleteVolumeName_AAIResponse_Success.xml | 24 - ...oduleVolume_queryVolumeName_AAIResponse_404.xml | 31 - ...eVolume_queryVolumeName_AAIResponse_Success.xml | 50 - ...Volume_updateVolumeName_AAIResponse_Success.xml | 24 - .../CreateVfModuleVolumeInfraV1/getSIUrlById.xml | 6 - ...ryVolumeId_AAIResponse_HasVfModRelationship.xml | 62 - .../__files/CreateVfModule_VID_request.json | 72 - .../CreateVfModule_VID_request_noPreloads.json | 79 - .../CreateVfModule_VID_request_userParam.json | 77 - .../test/resources/__files/DBUpdateResponse.xml | 4 - .../test/resources/__files/Database/DBAdapter.xml | 1 - .../__files/Database/DBUpdateResponse.xml | 4 - .../DeleteGenericVNFV1/sdncAdapterResponse.xml | 7 - .../cloudRegion25_AAIResponse_Success.xml | 20 - .../cloudRegion30_AAIResponse_Success.xml | 20 - .../deleteAAIResponse_Failure500_RESTFault.xml | 19 - .../deleteNetworkAAIResponse_Success.xml | 61 - ...NetworkAAIResponse_withRelationship_Success.xml | 73 - .../sdncDeleteNetworkTopologySimResponse.xml | 19 - ...DeleteNetworkTopologySimResponse_noExtraTag.xml | 17 - .../__files/DeleteVfModuleCallbackResponse.xml | 21 - .../DeleteVfModuleVolumeCallbackResponse.xml | 5 - .../deleteVfModuleVolume_VID_request_st.json | 17 - .../queryVolumeId_AAIResponse_Success.xml | 42 - .../DoCreateVfModuleRollback/GenericVnf.xml | 26 - .../GenericVnfVfModule.xml | 26 - .../CreateVfModuleVolumeCallbackResponse.xml | 53 - .../CreateVfModuleVolumeNoRollbackRequest.xml | 24 - .../CreateVfModuleVolumeRequest.xml | 24 - .../DoCreateVfModuleVolumeV1/GenericVnf.xml | 38 - .../RollbackVfModuleVolumeCallbackResponse.xml | 5 - .../createVfModuleVolume_VID_request.json | 104 - ...Volume_createVolumeName_AAIResponse_Success.xml | 49 - ...Volume_deleteVolumeName_AAIResponse_Success.xml | 24 - ...eVolume_queryVolumeName_AAIResponse_Success.xml | 49 - ...Volume_updateVolumeName_AAIResponse_Success.xml | 24 - .../__files/DoCreateVfModule_getVnfResponse.xml | 26 - .../__files/GenericFlows/MsoCompletionRequest.xml | 11 - .../__files/GenericFlows/SDNCDeleteResponse.xml | 212 - .../__files/GenericFlows/aaiGetResponse.xml | 33 - .../__files/GenericFlows/getARUrlById.xml | 6 - .../GenericFlows/getGenericVnfByNameResponse.xml | 23 - .../__files/GenericFlows/getGenericVnfResponse.xml | 90 - .../getGenericVnfResponse_hasRelationships.xml | 90 - .../resources/__files/GenericFlows/getNotFound.xml | 2 - .../__files/GenericFlows/getParentSIUrlById.xml | 6 - .../GenericFlows/getParentServiceInstance.xml | 30 - .../__files/GenericFlows/getSINoRelations.xml | 6 - .../__files/GenericFlows/getSIUrlById.xml | 6 - .../__files/GenericFlows/getSIUrlByIdVipr.xml | 7 - .../__files/GenericFlows/getServiceInstance.xml | 30 - .../InfrastructureFlows/ConfigVnf_VID_request.json | 40 - .../InfrastructureFlows/CreateVnfInfraRequest.json | 46 - .../DeleteCustomE2EService.json | 5 - .../DeleteVnfInfraRequestCascadeDelete.json | 39 - .../DoCreateServiceInstance_request.json | 186 - .../DoScaleE2EServiceInstance.json | 38 - .../ReplaceVnf_VID_request.json | 50 - .../UpdateVfModule_VID_request.json | 62 - .../InfrastructureFlows/UpdateVnf_VID_request.json | 58 - .../VnfInPlaceUpdate_VID_request.json | 17 - .../__files/Policy/policyAbortResponse.json | 1 - .../__files/Policy/policySkipResponse.json | 1 - .../UpdateNetworkV2/updateNetworkResponse_400.xml | 6 - .../UpdateNetworkV2/updateNetworkResponse_500.xml | 80 - .../updateNetworkResponse_Success.xml | 24 - .../updateNetwork_queryInstance_Success.xml | 4 - ...ueryNetworkId_AAIResponse_NoPayload_Success.xml | 73 - ...eNetwork_queryNetworkId_AAIResponse_Success.xml | 95 - ...work_queryNetworkPolicy_AAIResponse_Success.xml | 21 - ...k_queryNetworkTableRef1_AAIResponse_Success.xml | 20 - ...k_queryNetworkTableRef2_AAIResponse_Success.xml | 20 - ...ork_queryVpnBindingList_AAIResponse_Success.xml | 57 - ...Network_queryVpnBinding_AAIResponse_Success.xml | 46 - ...eNetwork_updateContrail_AAIResponse_Success.xml | 11 - .../queryVolumeId_AAIResponse_Success.xml | 44 - .../updateVfModuleVolume_VID_request.json | 64 - .../updateVfModuleVolume_VID_request_2.json | 64 - .../vf_module_aai_response.xml | 29 - .../SDNCTopologyQueryBRGCallback.xml | 37 - .../SDNCTopologyQueryTXCCallback.xml | 24 - .../VCPE/CreateVcpeResCustService/arGetById.xml | 31 - .../getCatalogServiceResourcesData.json | 127 - .../getCatalogServiceResourcesNoData.json | 11 - .../VCPE/CreateVcpeResCustService/getCustomer.xml | 7 - .../VCPE/CreateVcpeResCustService/request.json | 54 - .../CreateVcpeResCustService/requestNoSIName.json | 53 - .../requestNoSINameNoRollback.json | 53 - .../VCPE/DeleteVcpeResCustService/arGetBRGById.xml | 31 - .../VCPE/DeleteVcpeResCustService/arGetTXCById.xml | 31 - .../DeleteVcpeResCustService/getBRGArUrlById.xml | 6 - .../VCPE/DeleteVcpeResCustService/getSI.xml | 35 - .../DeleteVcpeResCustService/getSIAfterDelArs.xml | 8 - .../DeleteVcpeResCustService/getTXCArUrlById.xml | 6 - .../VCPE/DeleteVcpeResCustService/request.json | 40 - .../DeleteVcpeResCustService/serviceToDelete.xml | 36 - .../SDNCTopologyQueryCallback.xml | 37 - .../VCPE/DoCreateAllottedResourceBRG/getAR.xml | 8 - .../VCPE/DoCreateAllottedResourceBRG/getArBrg.xml | 31 - .../VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml | 31 - .../DoCreateAllottedResourceBRG/getSIandAR.xml | 38 - .../arGetById.xml | 31 - .../sdncActivateRollbackReq.xml | 51 - .../sdncAssignRollbackReq.xml | 51 - .../sdncCreateRollbackReq.xml | 51 - .../SDNCTopologyQueryCallback.xml | 24 - .../VCPE/DoCreateAllottedResourceTXC/getAR.xml | 8 - .../VCPE/DoCreateAllottedResourceTXC/getArTxc.xml | 31 - .../VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml | 31 - .../DoCreateAllottedResourceTXC/getSIandAR.xml | 38 - .../arGetById.xml | 31 - .../sdncActivateRollbackReq.xml | 51 - .../sdncAssignRollbackReq.xml | 51 - .../sdncCreateRollbackReq.xml | 51 - .../VCPE/DoDeleteAllottedResourceBRG/arGetById.xml | 31 - .../VCPE/DoDeleteAllottedResourceTXC/arGetById.xml | 31 - .../VIPR/getCatalogServiceResourcesData.json | 94 - ...alogServiceResourcesDataForReplaceVnfInfra.json | 98 - ...talogServiceResourcesDataForUpdateVnfInfra.json | 110 - .../resources/__files/VIPR/getCatalogVnfData.json | 44 - .../VIPR/getCatalogVnfNoTwoPhasedForVfModule.json | 44 - .../VIPR/getCatalogVnfYesTwoPhasedForVfModule.json | 44 - .../__files/VIPR/serviceDecompositionATMFW.json | 110 - .../AddNetworkPolicy_AAIResponse_Success.xml | 21 - .../__files/VfModularity/DBUpdateResponse.xml | 4 - .../VfModularity/DoUpdateVfModuleRequest.xml | 29 - .../GenerateVfModuleName_AAIResponse_Success.xml | 51 - .../resources/__files/VfModularity/GenericVnf.xml | 38 - .../QueryNetworkPolicy_AAIResponse_Success.xml | 21 - .../VfModularity/SDNCSITopologyAssignCallback.xml | 11 - .../VfModularity/SDNCTopologyActivateCallback.xml | 13 - .../VfModularity/SDNCTopologyAssignCallback.xml | 16 - .../SDNCTopologyChangeAssignCallback.xml | 13 - .../VfModularity/SDNCTopologyCreateCallback.xml | 16 - .../SDNCTopologyDeactivateCallback.xml | 13 - .../SDNCTopologyDeactivateCallbackNotFound.xml | 8 - .../VfModularity/SDNCTopologyDeleteCallback.xml | 16 - .../VfModularity/SDNCTopologyQueryCallback.xml | 315 - .../SDNCTopologyQueryCallbackVfModule.xml | 141 - .../SDNCTopologyQueryCallbackVfModuleNoVnf.xml | 82 - .../VfModularity/SDNCTopologyQueryCallbackVnf.xml | 82 - .../VfModularity/SDNCTopologyUnassignCallback.xml | 16 - .../VfModularity/StandardSDNCSynchResponse.xml | 5 - .../VfModularity/VNFAdapterRestCreateCallback.xml | 55 - .../VfModularity/VNFAdapterRestUpdateCallback.xml | 16 - .../VNFAdapterRestVolumeGroupCallback.xml | 15 - .../__files/VfModularity/VfModule-lukewarm.xml | 10 - .../VfModule-new-PendingActivation.xml | 9 - .../__files/VfModularity/VfModule-new.xml | 9 - .../__files/VfModularity/VfModule-supercool.xml | 27 - .../resources/__files/VfModularity/VolumeGroup.xml | 25 - .../__files/deleteNetworkResponse_Success.xml | 3 - .../resources/applicationContext_forPnfTesting.xml | 70 - .../src/test/resources/camunda.cfg.xml | 46 - .../src/test/resources/log4j.properties | 8 - .../src/test/resources/logging.properties | 2 - .../src/test/resources/mso.bpmn.properties | 3 - .../src/test/resources/mso.bpmn.urn.properties | 130 - bpmn/MSORESTClient/pom.xml | 2 +- .../main/java/org/onap/so/rest/APIResponse.java | 145 + .../java/org/onap/so/rest/HostNameVerifier.java | 49 + .../src/main/java/org/onap/so/rest/HttpHeader.java | 65 + .../src/main/java/org/onap/so/rest/RESTClient.java | 623 ++ .../src/main/java/org/onap/so/rest/RESTConfig.java | 131 + .../main/java/org/onap/so/rest/RESTException.java | 85 + .../java/org/openecomp/mso/rest/APIResponse.java | 145 - .../org/openecomp/mso/rest/HostNameVerifier.java | 49 - .../java/org/openecomp/mso/rest/HttpHeader.java | 65 - .../java/org/openecomp/mso/rest/RESTClient.java | 614 -- .../java/org/openecomp/mso/rest/RESTConfig.java | 131 - .../java/org/openecomp/mso/rest/RESTException.java | 85 - .../java/org/onap/so/rest/APIResponseTest.java | 57 + .../test/java/org/onap/so/rest/HttpHeaderTest.java | 40 + .../test/java/org/onap/so/rest/RESTClientTest.java | 195 + .../test/java/org/onap/so/rest/RESTConfigTest.java | 42 + .../java/org/onap/so/rest/RESTExceptionTest.java | 40 + .../org/openecomp/mso/rest/APIResponseTest.java | 57 - .../org/openecomp/mso/rest/HttpHeaderTest.java | 34 - .../org/openecomp/mso/rest/RESTClientTest.java | 50 - .../org/openecomp/mso/rest/RESTConfigTest.java | 42 - .../org/openecomp/mso/rest/RESTExceptionTest.java | 37 - bpmn/MSOURN-plugin/build.properties | 7 - bpmn/MSOURN-plugin/build.xml | 60 - bpmn/MSOURN-plugin/pom.xml | 65 - .../camunda/bpmn/plugin/urnmap/URNMapPlugin.java | 53 - .../urnmap/db/MyBatisExtendedSessionFactory.java | 89 - .../urnmap/db/MyBatisQueryCommandExecutor.java | 44 - .../camunda/bpmn/plugin/urnmap/db/URNData.java | 47 - .../camunda/bpmn/plugin/urnmap/db/URNService.java | 48 - .../urnmap/resources/ProcessInstanceResource.java | 95 - .../urnmap/resources/URNMapPluginRootResource.java | 42 - .../bpmn/plugin/urnmap/resources/URNResource.java | 206 - ...rg.camunda.bpm.cockpit.plugin.spi.CockpitPlugin | 1 - bpmn/MSOURN-plugin/src/main/resources/mappings.xml | 32 - .../camunda/bpm/plugin/urnmap/queries/urnMap.xml | 64 - .../plugin-webapp/urnMap-plugin/app/dashboard.html | 63 - .../plugin-webapp/urnMap-plugin/app/plugin.js | 132 - .../resources/plugin-webapp/urnMap-plugin/info.txt | 1 - .../__files/dhv/DHVChangeSpeed/getPInterface.json | 19 + .../__files/dhv/DHVChangeSpeed/getPInterfaces.json | 42 + bpmn/mso-infrastructure-bpmn/pom.xml | 207 + .../scripts/ActivateSDNCNetworkResource.groovy | 62 + .../scripts/CreateActivateSDNCResource.groovy | 425 ++ .../bpmn/common/adapter/sdnc/CallbackHeader.java | 139 + .../so/bpmn/common/adapter/sdnc/ObjectFactory.java | 91 + .../so/bpmn/common/adapter/sdnc/RequestHeader.java | 223 + .../adapter/sdnc/SDNCAdapterCallbackRequest.java | 130 + .../common/adapter/sdnc/SDNCAdapterRequest.java | 111 + .../common/adapter/sdnc/SDNCAdapterResponse.java | 51 + .../adapter/sdnc/SDNCCallbackAdapterPortType.java | 53 + .../so/bpmn/common/adapter/sdnc/package-info.java | 22 + .../common/adapter/vnf/CreateVnfNotification.java | 462 ++ .../common/adapter/vnf/DeleteVnfNotification.java | 198 + .../common/adapter/vnf/MsoExceptionCategory.java | 61 + .../so/bpmn/common/adapter/vnf/MsoRequest.java | 112 + .../so/bpmn/common/adapter/vnf/ObjectFactory.java | 208 + .../common/adapter/vnf/QueryVnfNotification.java | 488 ++ .../adapter/vnf/RollbackVnfNotification.java | 175 + .../common/adapter/vnf/UpdateVnfNotification.java | 412 ++ .../bpmn/common/adapter/vnf/VnfAdapterNotify.java | 177 + .../adapter/vnf/VnfAdapterNotify_Service.java | 108 + .../so/bpmn/common/adapter/vnf/VnfRollback.java | 210 + .../onap/so/bpmn/common/adapter/vnf/VnfStatus.java | 61 + .../so/bpmn/common/adapter/vnf/package-info.java | 22 + .../workflow/service/CallbackHandlerService.java | 425 ++ .../service/ProcessEngineAwareService.java | 68 + .../service/SDNCAdapterCallbackServiceImpl.java | 91 + .../service/VnfAdapterNotifyServiceImpl.java | 255 + .../service/WorkflowAsyncCommonResource.java | 33 + .../workflow/service/WorkflowAsyncResource.java | 244 + .../workflow/service/WorkflowMessageResource.java | 124 + .../common/workflow/service/WorkflowProcessor.java | 155 + .../common/workflow/service/WorkflowResource.java | 630 ++ .../core/plugins/LoggingAndURNMappingPlugin.java | 353 + .../bpmn/core/plugins/WorkflowExceptionPlugin.java | 172 + .../so/bpmn/infrastructure/CXFConfiguration.java | 122 + .../MSOInfrastructureApplication.java | 117 + .../bpmn/infrastructure/WebSecurityConfigImpl.java | 52 + .../pnf/delegate/PnfCheckInputs.java | 57 + .../workflow/service/ServicePluginFactory.java | 422 ++ .../src/main/resources/META-INF/processes.xml | 31 + .../src/main/resources/application-local.yml | 275 + .../src/main/resources/application.yaml | 30 + .../process/CreateActivateSDNCResource.bpmn | 393 ++ .../CreateCustom3rdONAPServiceInstance.bpmn | 389 ++ .../DeleteCustom3rdONAPServiceInstance.bpmn | 381 ++ .../subprocess/ActivateSDNCNetworkResource.bpmn | 162 + .../subprocess/DeActivateNetworkResource.bpmn | 258 + .../src/test/java/RequestHeaderTest.java | 46 + .../test/java/SDNCAdapterCallbackRequestTest.java | 45 + .../src/test/java/SDNCAdapterRequestTest.java | 41 + .../test/java/org/onap/so/BaseIntegrationTest.java | 54 + .../onap/so/bpmn/InfraEmbeddedMariaDbConfig.java | 72 + .../org/onap/so/bpmn/IntegrationTestSuite.java | 32 + .../java/org/onap/so/bpmn/common/BPMNUtil.java | 357 + .../onap/so/bpmn/common/CompleteMsoProcessIT.java | 183 + .../so/bpmn/common/ConfirmVolumeGroupNameIT.java | 116 + .../so/bpmn/common/ConfirmVolumeGroupTenantIT.java | 88 + .../onap/so/bpmn/common/CreateAAIVfModuleIT.java | 267 + .../common/CreateAAIVfModuleVolumeGroupIT.java | 132 + .../onap/so/bpmn/common/DecomposeServiceIT.java | 95 + .../onap/so/bpmn/common/DeleteAAIVfModuleIT.java | 288 + .../org/onap/so/bpmn/common/FalloutHandlerIT.java | 224 + .../so/bpmn/common/GenerateVfModuleNameIT.java | 78 + .../onap/so/bpmn/common/GenericGetServiceIT.java | 560 ++ .../org/onap/so/bpmn/common/GenericGetVnfIT.java | 190 + .../org/onap/so/bpmn/common/ManualHandlingIT.java | 96 + .../so/bpmn/common/MockAAIDeleteGenericVnf.java | 39 + .../onap/so/bpmn/common/MockAAIDeleteVfModule.java | 53 + .../so/bpmn/common/MockAAIGenericVnfSearch.java | 340 + .../onap/so/bpmn/common/MockLoggerDelegate.java | 35 + .../java/org/onap/so/bpmn/common/OofHomingIT.java | 761 +++ .../org/onap/so/bpmn/common/OofHomingTestIT.java | 771 +++ .../so/bpmn/common/PrepareUpdateAAIVfModuleIT.java | 208 + .../org/onap/so/bpmn/common/RainyDayHandlerIT.java | 69 + .../so/bpmn/common/ReceiveWorkflowMessageTest.java | 145 + .../so/bpmn/common/SDNCAdapterCallbackRule.java | 84 + .../onap/so/bpmn/common/SDNCAdapterRestV2IT.java | 120 + .../org/onap/so/bpmn/common/SPIPropertiesTest.java | 69 + .../org/onap/so/bpmn/common/SniroHomingV1IT.java | 549 ++ .../onap/so/bpmn/common/UpdateAAIGenericVnfIT.java | 174 + .../onap/so/bpmn/common/UpdateAAIVfModuleIT.java | 142 + .../onap/so/bpmn/common/VnfAdapterRestV1IT.java | 386 ++ .../so/bpmn/common/WorkflowAsyncResourceTest.java | 84 + .../so/bpmn/common/WorkflowContextHolderTest.java | 69 + .../java/org/onap/so/bpmn/common/WorkflowTest.java | 2215 +++++++ .../so/bpmn/common/WorkflowTestTransformer.java | 41 + .../onap/so/bpmn/infrastructure/FlakyTests.java | 25 + .../pnf/delegate/AaiConnectionTestImpl.java | 73 + .../delegate/AaiConnectionThrowingException.java | 39 + .../pnf/delegate/CancelDmaapSubscriptionTest.java | 57 + .../CheckAaiForCorrelationIdDelegateTest.java | 132 + .../CreateAaiEntryWithPnfIdDelegateTest.java | 50 + .../pnf/delegate/DmaapClientTestImpl.java | 59 + .../pnf/delegate/InformDmaapClientTest.java | 94 + .../pnf/delegate/PnfCheckInputsTest.java | 84 + .../bpmn/CreateAndActivatePnfResourceTest.java | 150 + .../pnf/dmaap/PnfEventReadyDmaapClientTest.java | 197 + .../org/onap/so/bpmn/vcpe/AbstractTestBase.java | 47 + .../so/bpmn/vcpe/CreateVcpeResCustServiceIT.java | 381 ++ .../so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java | 291 + .../bpmn/vcpe/DoCreateAllottedResourceBRGIT.java | 266 + .../DoCreateAllottedResourceBRGRollbackIT.java | 323 + .../bpmn/vcpe/DoCreateAllottedResourceTXCIT.java | 276 + .../DoCreateAllottedResourceTXCRollbackIT.java | 323 + .../bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java | 145 + .../bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java | 140 + .../VCPE/CreateVcpeResCustService/GenericVnf.xml | 16 + .../oofCallbackInfraVnf.json | 50 + .../CreateVcpeResCustService/requestRollback.json | 60 + .../src/test/resources/application-test.yaml | 208 + bpmn/pom.xml | 185 +- bpmn/so-bpmn-building-blocks/pom.xml | 224 + .../src/main/resources/META-INF/processes.xml | 31 + .../services/org.onap.so.client.RestProperties | 2 + .../org.onap.so.client.dmaap.DmaapProperties | 2 + .../BuildingBlock/AAICheckVnfInMaintBB.bpmn | 50 + .../BuildingBlock/AAISetVnfInMaintBB.bpmn | 50 + .../BuildingBlock/AAIUnsetVnfInMaintBB.bpmn | 50 + .../BuildingBlock/ActivateNetworkBB.bpmn | 71 + .../BuildingBlock/ActivateNetworkCollectionBB.bpmn | 52 + .../BuildingBlock/ActivateServiceInstanceBB.bpmn | 65 + .../BuildingBlock/ActivateVfModuleBB.bpmn | 66 + .../subprocess/BuildingBlock/ActivateVnfBB.bpmn | 65 + .../BuildingBlock/ActivateVolumeGroupBB.bpmn | 52 + .../BuildingBlock/AssignNetwork1802BB.bpmn | 92 + .../subprocess/BuildingBlock/AssignNetworkBB.bpmn | 208 + .../BuildingBlock/AssignServiceInstanceBB.bpmn | 126 + .../subprocess/BuildingBlock/AssignVfModuleBB.bpmn | 95 + .../subprocess/BuildingBlock/AssignVnfBB.bpmn | 177 + .../BuildingBlock/AssignVolumeGroupBB.bpmn | 52 + .../ChangeModelServiceInstanceBB.bpmn | 68 + .../BuildingBlock/ChangeModelVfModuleBB.bpmn | 66 + .../subprocess/BuildingBlock/ChangeModelVnfBB.bpmn | 68 + .../subprocess/BuildingBlock/CreateCustomerBB.bpmn | 53 + .../subprocess/BuildingBlock/CreateNetworkBB.bpmn | 198 + .../BuildingBlock/CreateNetworkCollectionBB.bpmn | 112 + .../subprocess/BuildingBlock/CreateVfModuleBB.bpmn | 115 + .../BuildingBlock/CreateVolumeGroupBB.bpmn | 102 + .../BuildingBlock/DeactivateNetworkBB.bpmn | 72 + .../BuildingBlock/DeactivateServiceInstanceBB.bpmn | 66 + .../BuildingBlock/DeactivateVfModuleBB.bpmn | 70 + .../subprocess/BuildingBlock/DeactivateVnfBB.bpmn | 65 + .../BuildingBlock/DeactivateVolumeGroupBB.bpmn | 52 + .../subprocess/BuildingBlock/DeleteNetworkBB.bpmn | 75 + .../BuildingBlock/DeleteNetworkCollectionBB.bpmn | 67 + .../subprocess/BuildingBlock/DeleteVfModuleBB.bpmn | 85 + .../BuildingBlock/DeleteVolumeGroupBB.bpmn | 67 + .../BuildingBlock/ExecuteBuildingBlock.bpmn | 310 + .../BuildingBlock/SDNOVnfHealthCheckBB.bpmn | 51 + .../BuildingBlock/UnassignNetwork1802BB.bpmn | 95 + .../BuildingBlock/UnassignNetworkBB.bpmn | 110 + .../BuildingBlock/UnassignServiceInstanceBB.bpmn | 67 + .../BuildingBlock/UnassignVfModuleBB.bpmn | 65 + .../subprocess/BuildingBlock/UnassignVnfBB.bpmn | 80 + .../BuildingBlock/UnassignVolumeGroupBB.bpmn | 52 + .../subprocess/BuildingBlock/UpdateNetworkBB.bpmn | 232 + .../subprocess/BuildingBlock/VnfAdapter.bpmn | 122 + .../subprocess/BuildingBlock/WorkflowActionBB.bpmn | 550 ++ .../java/org/onap/so/AllBaseTaskTestSuite.java | 33 + .../src/test/java/org/onap/so/AllTestSuites.java | 32 + .../src/test/java/org/onap/so/BaseTest.java | 209 + .../src/test/java/org/onap/so/BaseUnitTest.java | 25 + .../org/onap/so/BuildingBlockTestDataSetup.java | 665 ++ .../java/org/onap/so/EmbeddedMariaDbConfig.java | 64 + .../java/org/onap/so/IntegrationTestSuite.java | 32 + .../test/java/org/onap/so/SerializableChecker.java | 181 + .../src/test/java/org/onap/so/TestApplication.java | 55 + .../test/java/org/onap/so/bpmn/BaseBPMNTest.java | 245 + .../so/bpmn/buildingblock/SniroHomingV2BBTest.java | 74 + .../so/bpmn/buildingblock/SniroHomingV2Test.java | 498 ++ .../so/bpmn/common/AAICheckVnfInMaintBBTest.java | 59 + .../so/bpmn/common/AAISetVnfInMaintBBTest.java | 59 + .../so/bpmn/common/AAIUnsetVnfInMaintBBTest.java | 59 + .../onap/so/bpmn/common/SDNOHealthCheckBBTest.java | 59 + .../bpmn/process/WorkflowActionBBTest.java | 143 + .../bpmn/subprocess/ActivateNetworkBBTest.java | 52 + .../ActivateNetworkCollectionBBTest.java | 52 + .../subprocess/ActivateServiceInstanceBBTest.java | 41 + .../bpmn/subprocess/ActivateVfModuleBBTest.java | 56 + .../bpmn/subprocess/ActivateVnfBBTest.java | 41 + .../bpmn/subprocess/ActivateVolumeGroupBBTest.java | 52 + .../bpmn/subprocess/AssignNetwork1802BBTest.java | 57 + .../bpmn/subprocess/AssignNetworkBBTest.java | 56 + .../subprocess/AssignServiceInstanceBBTest.java | 42 + .../bpmn/subprocess/AssignVfModuleBBTest.java | 57 + .../bpmn/subprocess/AssignVnfBBTest.java | 58 + .../bpmn/subprocess/AssignVolumeGroupBBTest.java | 52 + .../ChangeModelServiceInstanceBBTest.java | 53 + .../bpmn/subprocess/ChangeModelVfModuleBBTest.java | 54 + .../bpmn/subprocess/ChangeModelVnfBBTest.java | 53 + .../bpmn/subprocess/CreateCustomerBBTest.java | 53 + .../bpmn/subprocess/CreateNetworkBBTest.java | 54 + .../subprocess/CreateNetworkCollectionBBTest.java | 52 + .../bpmn/subprocess/CreateVfModuleBBTest.java | 94 + .../bpmn/subprocess/CreateVolumeGroupBBTest.java | 55 + .../bpmn/subprocess/DeactivateNetworkBBTest.java | 52 + .../DeactivateServiceInstanceBBTest.java | 44 + .../bpmn/subprocess/DeactivateVfModuleBBTest.java | 56 + .../bpmn/subprocess/DeactivateVnfBBTest.java | 66 + .../subprocess/DeactivateVolumeGroupBBTest.java | 52 + .../bpmn/subprocess/DeleteNetworkBBTest.java | 52 + .../subprocess/DeleteNetworkCollectionBBTest.java | 53 + .../bpmn/subprocess/DeleteVfModuleBBTest.java | 55 + .../bpmn/subprocess/DeleteVolumeGroupBBTest.java | 52 + .../bpmn/subprocess/ExecuteBuildingBlockTest.java | 113 + .../bpmn/subprocess/UnassignNetwork1802BBTest.java | 53 + .../bpmn/subprocess/UnassignNetworkBBTest.java | 53 + .../subprocess/UnassignServiceInstanceBBTest.java | 44 + .../bpmn/subprocess/UnassignVfModuleBBTest.java | 66 + .../bpmn/subprocess/UnassignVnfBBTest.java | 77 + .../bpmn/subprocess/UnassignVolumeGroupBBTest.java | 53 + .../bpmn/subprocess/UpdateNetworkBBTest.java | 58 + .../bpmn/subprocess/VnfAdapterTest.java | 51 + .../src/test/resources/application-test.yaml | 220 + .../src/test/resources/logback-test.xml | 30 + bpmn/so-bpmn-infrastructure-common/.gitignore | 1 + .../.maven-dockerignore | 1 + bpmn/so-bpmn-infrastructure-common/pom.xml | 269 + .../infrastructure/aai/AAICreateResources.java | 90 + .../aai/AAIDeleteServiceInstance.java | 49 + .../so/bpmn/infrastructure/aai/AAIResource.java | 40 + .../infrastructure/aai/AAIServiceInstance.java | 94 + .../aai/groovyflows/AAICreateResources.java | 123 + .../aai/groovyflows/AAIDeleteServiceInstance.java | 49 + .../aai/groovyflows/AAIServiceInstance.java | 94 + .../generation/AAIObjectInstanceNameGenerator.java | 40 + .../infrastructure/pnf/aai/AaiConnectionImpl.java | 44 + .../pnf/delegate/CancelDmaapSubscription.java | 42 + .../delegate/CheckAaiForCorrelationIdDelegate.java | 76 + .../delegate/CreateAaiEntryWithPnfIdDelegate.java | 55 + .../pnf/delegate/ExecutionVariableNames.java | 33 + .../pnf/delegate/InformDmaapClient.java | 45 + .../bpmn/infrastructure/pnf/dmaap/DmaapClient.java | 28 + .../pnf/dmaap/JsonUtilForCorrelationId.java | 71 + .../pnf/dmaap/PnfEventReadyDmaapClient.java | 178 + .../pnf/implementation/AaiConnection.java | 32 + .../pnf/implementation/AaiResponse.java | 48 + .../CheckAaiForCorrelationIdImplementation.java | 50 + .../infrastructure/properties/BPMNProperties.java | 46 + .../vfcmodel/LocationConstraint.java | 73 + .../vfcmodel/NSResourceInputParameter.java | 116 + .../infrastructure/vfcmodel/NsOperationKey.java | 141 + .../bpmn/infrastructure/vfcmodel/NsParameters.java | 70 + .../infrastructure/vfcmodel/NsScaleParameters.java | 78 + .../vfcmodel/ScaleNsByStepsData.java | 91 + .../bpmn/infrastructure/vfcmodel/ScaleNsData.java | 34 + .../infrastructure/vfcmodel/ScaleResource.java | 55 + .../bpmn/infrastructure/vfcmodel/VimLocation.java | 52 + .../serviceTask/AbstractSdncOperationTask.java | 350 + .../SdncNetworkTopologyOperationTask.java | 102 + .../SdncServiceTopologyOperationTask.java | 101 + .../SdncUnderlayVpnOperationClient.java | 116 + .../serviceTask/SdncUnderlayVpnPreprocessTask.java | 51 + .../serviceTask/client/GenericResourceApi.java | 48 + .../workflow/serviceTask/client/HeaderUtil.java | 45 + .../client/builder/AbstractBuilder.java | 239 + .../builder/NetworkRpcInputEntityBuilder.java | 90 + .../builder/ServiceRpcInputEntityBuilder.java | 73 + .../client/entity/NetworkInformationEntity.java | 58 + .../entity/NetworkInputParametersEntity.java | 38 + .../client/entity/NetworkRequestInputEntity.java | 80 + .../entity/NetworkResponseInformationEntity.java | 47 + .../NetworkTopologyOperationInputEntity.java | 80 + .../NetworkTopologyOperationOutputEntity.java | 91 + .../client/entity/OnapModelInformationEntity.java | 80 + .../serviceTask/client/entity/ParamEntity.java | 47 + .../client/entity/RequestInformationEntity.java | 91 + .../RpcNetworkTopologyOperationInputEntity.java | 36 + .../RpcNetworkTopologyOperationOutputEntity.java | 36 + .../RpcServiceTopologyOperationInputEntity.java | 36 + .../RpcServiceTopologyOperationOutputEntity.java | 36 + .../client/entity/SdncRequestHeaderEntity.java | 59 + .../client/entity/ServiceInformationEntity.java | 91 + .../entity/ServiceInputParametersEntity.java | 38 + .../client/entity/ServiceRequestInputEntity.java | 48 + .../entity/ServiceResponseInformationEntity.java | 47 + .../ServiceTopologyOperationInputEntity.java | 69 + .../ServiceTopologyOperationOutputEntity.java | 80 + .../src/main/resources/dmaap.properties | 8 + .../java/org/onap/so/bpmn/AllBPMNTestSuites.java | 32 + .../org/onap/so/bpmn/AllTasksTestsTestSuite.java | 32 + .../java/org/onap/so/bpmn/AllTestsTestSuite.java | 35 + .../org/onap/so/bpmn/infrastructure/BeansTest.java | 72 + .../bpmn/infrastructure/WebSecurityConfigImpl.java | 52 + .../infrastructure/aai/AAICreateResourcesTest.java | 197 + .../aai/AAIDeleteServiceInstanceTest.java | 84 + .../infrastructure/aai/AAIServiceInstanceTest.java | 114 + .../AAIObjectInstanceNameGeneratorTest.java | 58 + .../pnf/dmaap/JsonUtilForCorrelationIdTest.java | 77 + .../infrastructure/vfcmodel/VfcModelPojoTest.java | 45 + .../serviceTask/client/HeaderUtilTest.java | 34 + .../client/builder/AbstractBuilderTest.java | 570 ++ .../builder/NetworkRpcInputEntityBuilderTest.java | 323 + .../builder/ServiceRpcInputEntityBuilderTest.java | 323 + .../client/entity/ClientEntityPojoTest.java | 76 + .../src/test/resources/CreateSiSample.json | 72 + .../stubprocess/DoCreateAllottedResourceBRG.bpmn | 54 + .../DoCreateAllottedResourceBRGRollback.bpmn | 55 + .../stubprocess/DoCreateAllottedResourceTXC.bpmn | 38 + .../DoCreateServiceInstanceRollback.bpmn | 53 + .../VCPE/stubprocess/DoCreateVnfAndModules.bpmn | 53 + .../stubprocess/DoCreateVnfAndModulesRollback.bpmn | 53 + .../VCPE/stubprocess/DoDeleteVnfAndModules.bpmn | 37 + .../test/resources/VCPE/stubprocess/Homing.bpmn | 35 + .../AAI/AAI_defaultCloudRegionByCloudRegionId.json | 12 + .../resources/__files/AAI/AAI_genericVnfGet.json | 9 + .../__files/AAI/AAI_genericVnfsByVnfId.json | 434 ++ .../resources/__files/AAI/AAI_pserverByVnfId.json | 72 + .../__files/AAI/AAI_vfModuleByVfModuleId.json | 27 + .../src/test/resources/__files/AAI/mockObject.json | 10 + .../test/resources/__files/APPC/appc_error.json | 21 + .../Network/createNetworkRequest.xml | 75 + .../Network/createNetworkResponse.xml | 31 + .../BuildingBlocks/Network/defaultNetwork.json | 10 + .../BuildingBlocks/Network/l3NetworkBbObject.json | 226 + .../Network/payloadUpdateCreated.json | 216 + .../Network/queryAAICloudRegion.json | 596 ++ .../Network/queryAAICloudRegion25.json | 596 ++ .../Network/queryAAICloudRegionError.json | 596 ++ .../Network/queryAAINetworkTestResponse.json | 141 + .../BuildingBlocks/Network/queryAAIResponse.json | 166 + .../Network/queryAAIResponseEmptyUri.json | 53 + .../Network/queryAAIVpnBindingTestResponse.json | 891 +++ .../BuildingBlocks/Network/queryIdAAIResponse.xml | 145 + .../unassignNetworkBB_queryAAIResponse_.json | 162 + .../Network/updateContrailAAIPayloadRequest.xml | 149 + .../__files/BuildingBlocks/sniroCallback2AR1Vnf | 107 + .../BuildingBlocks/sniroCallback2AR1Vnf2Net | 165 + .../BuildingBlocks/sniroCallbackNoSolutionFound | 15 + .../BuildingBlocks/sniroCallbackPolicyException | 9 + .../BuildingBlocks/sniroCallbackServiceException | 12 + .../cloudRegion25_AAIResponse_Success.xml | 20 + .../cloudRegion30_AAIResponse_Success.xml | 20 + .../CreateNetworkV2/createNetworkResponse_400.xml | 6 + .../CreateNetworkV2/createNetworkResponse_500.xml | 80 + .../createNetworkResponse_Success.xml | 24 + .../createNetwork_queryInstance_Success.xml | 4 + ...reateNetwork_queryName2_AAIResponse_Success.xml | 62 + ...Network_queryNameActive_AAIResponse_Success.xml | 74 + .../createNetwork_queryName_AAIResponse_404.xml | 19 + ...createNetwork_queryName_AAIResponse_Success.xml | 62 + ...reateNetwork_queryNetworkId_AAIResponse_404.xml | 19 + ...ueryNetworkId_AAIResponse_NoPayload_Success.xml | 73 + ...eNetwork_queryNetworkId_AAIResponse_Success.xml | 110 + ...work_queryNetworkPolicy_AAIResponse_Success.xml | 21 + ...k_queryNetworkTableRef1_AAIResponse_Success.xml | 20 + ...k_queryNetworkTableRef2_AAIResponse_Success.xml | 20 + ...ork_queryVpnBindingList_AAIResponse_Success.xml | 57 + ...Network_queryVpnBinding_AAIResponse_Success.xml | 46 + ...eNetwork_updateContrail_AAIResponse_Success.xml | 11 + ...sdncCreateNetworkTopologyRsrcAssignResponse.xml | 15 + .../sdncCreateNetworkTopologySimResponse.xml | 17 + .../DoCreateServiceInstanceInput.json | 42 + .../SetupServiceDecompJson.json | 36 + ...e_createServiceInstance_AAIResponse_Success.xml | 11 + ...e_queryGlobalCustomerId_AAIResponse_Success.xml | 62 + .../CreateVfModuleCallbackException.xml | 7 + .../CreateVfModuleVolumeCallbackResponse.xml | 53 + .../CreateVfModuleVolumeRequest.xml | 24 + .../CreateVfModuleVolumeInfraV1/GenericVnf.xml | 38 + .../RollbackVfModuleVolumeCallbackResponse.xml | 5 + .../createVfModuleVolume_VID_request.json | 71 + ...createVfModuleVolume_VID_request_noreqparm.json | 45 + ...Volume_createVolumeName_AAIResponse_Success.xml | 49 + ...Volume_deleteVolumeName_AAIResponse_Success.xml | 24 + ...oduleVolume_queryVolumeName_AAIResponse_404.xml | 31 + ...eVolume_queryVolumeName_AAIResponse_Success.xml | 50 + ...Volume_updateVolumeName_AAIResponse_Success.xml | 24 + .../CreateVfModuleVolumeInfraV1/getSIUrlById.xml | 6 + ...ryVolumeId_AAIResponse_HasVfModRelationship.xml | 62 + .../__files/CreateVfModule_VID_request.json | 77 + .../CreateVfModule_VID_request_noPreloads.json | 79 + .../CreateVfModule_VID_request_userParam.json | 77 + .../test/resources/__files/DBUpdateResponse.xml | 4 + .../test/resources/__files/Database/DBAdapter.xml | 1 + .../__files/Database/DBUpdateResponse.xml | 4 + .../DeleteGenericVNFV1/sdncAdapterResponse.xml | 7 + .../cloudRegion25_AAIResponse_Success.xml | 20 + .../cloudRegion30_AAIResponse_Success.xml | 20 + .../deleteAAIResponse_Failure500_RESTFault.xml | 19 + .../deleteNetworkAAIResponse_Success.xml | 61 + ...NetworkAAIResponse_withRelationship_Success.xml | 73 + .../sdncDeleteNetworkTopologySimResponse.xml | 17 + ...DeleteNetworkTopologySimResponse_noExtraTag.xml | 17 + .../__files/DeleteVfModuleCallbackResponse.xml | 21 + .../DeleteVfModuleVolumeCallbackResponse.xml | 5 + .../deleteVfModuleVolume_VID_request_st.json | 17 + .../queryVolumeId_AAIResponse_Success.xml | 42 + .../__files/DeleteVfModule_VID_request.json | 50 + .../DoCreateVfModule/DoCreateVfModuleRequest.xml | 31 + .../cloudRegion_AAIResponse_Success.xml | 20 + .../__files/DoCreateVfModule/createVnfARequest.xml | 169 + .../DoCreateVfModule/getGenericVnfResponse.xml | 28 + .../__files/DoCreateVfModule/sdncGetResponse.xml | 195 + .../DoCreateVfModuleRollback/GenericVnf.xml | 26 + .../GenericVnfVfModule.xml | 26 + .../deactivateSDNCRequest.xml | 36 + .../sdncAdapterWorkflowRequest.xml | 37 + .../vnfAdapterRestV1Request.xml | 14 + .../CreateVfModuleVolumeCallbackResponse.xml | 53 + .../CreateVfModuleVolumeNoRollbackRequest.xml | 24 + .../CreateVfModuleVolumeRequest.xml | 24 + .../DoCreateVfModuleVolumeV1/GenericVnf.xml | 38 + .../RollbackVfModuleVolumeCallbackResponse.xml | 5 + .../createVfModuleVolume_VID_request.json | 104 + ...Volume_createVolumeName_AAIResponse_Success.xml | 49 + ...Volume_deleteVolumeName_AAIResponse_Success.xml | 24 + ...eVolume_queryVolumeName_AAIResponse_Success.xml | 49 + ...Volume_updateVolumeName_AAIResponse_Success.xml | 24 + .../cloudRegion_AAIResponse_Success.xml | 20 + .../vnfAdapterDeleteRequest.xml | 13 + .../__files/DoCreateVfModule_getVnfResponse.xml | 26 + .../DoDeleteVfModule/getGenericVnfResponse.xml | 28 + .../sdncAdapterWorkflowRequest.xml | 36 + .../cloudRegion_AAIResponse_Success.xml | 20 + .../DoUpdateVfModule/getGenericVnfResponse.xml | 28 + .../DoUpdateVfModule/sdncActivateRequest.xml | 36 + .../DoUpdateVfModule/sdncChangeAssignRequest.xml | 36 + .../__files/DoUpdateVfModule/sdncGetResponse.xml | 195 + .../DoUpdateVfModule/sdncTopologyRequest.xml | 11 + .../DoUpdateVfModule/vnfAdapterRestRequest.xml | 170 + .../__files/GenericFlows/MsoCompletionRequest.xml | 11 + .../__files/GenericFlows/SDNCDeleteResponse.xml | 212 + .../__files/GenericFlows/aaiGetResponse.xml | 33 + .../__files/GenericFlows/getARUrlById.xml | 6 + .../GenericFlows/getGenericVnfByNameResponse.xml | 23 + .../__files/GenericFlows/getGenericVnfResponse.xml | 90 + .../getGenericVnfResponse_hasRelationships.xml | 90 + .../resources/__files/GenericFlows/getNotFound.xml | 2 + .../__files/GenericFlows/getParentSIUrlById.xml | 6 + .../GenericFlows/getParentServiceInstance.xml | 30 + .../__files/GenericFlows/getSINoRelations.xml | 6 + .../__files/GenericFlows/getSIUrlById.xml | 6 + .../__files/GenericFlows/getSIUrlByIdVipr.xml | 7 + .../__files/GenericFlows/getServiceInstance.xml | 30 + .../InfrastructureFlows/ConfigVnf_VID_request.json | 39 + .../InfrastructureFlows/CreateVnfInfraRequest.json | 46 + .../DeleteCustomE2EService.json | 21 + .../DeleteVnfInfraRequestCascadeDelete.json | 39 + .../DoCreateServiceInstance_request.json | 186 + .../DoScaleE2EServiceInstance.json | 38 + .../ReplaceVnf_VID_request.json | 49 + .../UpdateVfModule_VID_request.json | 62 + .../InfrastructureFlows/UpdateVnf_VID_request.json | 56 + .../VnfInPlaceUpdate_VID_request.json | 16 + .../__files/Macro/CreateNetworkCollection.json | 70 + .../__files/Macro/ServiceMacroAssign.json | 125 + .../__files/Policy/policyAbortResponse.json | 1 + .../__files/Policy/policySkipResponse.json | 1 + .../__files/Schemas/ActivateServiceInstance.json | 7 + .../__files/Schemas/ActivateVnfSchema.json | 13 + .../Schemas/AssignServiceInstanceSchema.json | 16 + .../resources/__files/Schemas/AssignVnfSchema.json | 13 + .../sdncUpdateNetworkTopologySimResponse.xml | 17 + .../UpdateNetworkV2/updateNetworkResponse_400.xml | 6 + .../UpdateNetworkV2/updateNetworkResponse_500.xml | 80 + .../updateNetworkResponse_Success.xml | 24 + .../updateNetwork_queryInstance_Success.xml | 4 + ...ueryNetworkId_AAIResponse_NoPayload_Success.xml | 73 + ...eNetwork_queryNetworkId_AAIResponse_Success.xml | 95 + ...work_queryNetworkPolicy_AAIResponse_Success.xml | 21 + ...k_queryNetworkTableRef1_AAIResponse_Success.xml | 20 + ...k_queryNetworkTableRef2_AAIResponse_Success.xml | 20 + ...ork_queryVpnBindingList_AAIResponse_Success.xml | 57 + ...Network_queryVpnBinding_AAIResponse_Success.xml | 46 + ...eNetwork_updateContrail_AAIResponse_Success.xml | 11 + .../queryVolumeId_AAIResponse_Success.xml | 44 + .../updateVfModuleVolume_VID_request.json | 64 + .../updateVfModuleVolume_VID_request_2.json | 64 + .../updateVolumeGroupRequest.xml | 38 + .../vf_module_aai_response.xml | 29 + .../SDNCTopologyQueryBRGCallback.xml | 37 + .../SDNCTopologyQueryTXCCallback.xml | 24 + .../VCPE/CreateVcpeResCustService/arGetById.xml | 31 + .../getCatalogServiceResourcesData.json | 127 + .../getCatalogServiceResourcesNoData.json | 11 + .../VCPE/CreateVcpeResCustService/getCustomer.xml | 7 + .../VCPE/CreateVcpeResCustService/request.json | 40 + .../CreateVcpeResCustService/requestNoSIName.json | 61 + .../requestNoSINameNoRollback.json | 39 + .../VCPE/DeleteVcpeResCustService/arGetBRGById.xml | 31 + .../VCPE/DeleteVcpeResCustService/arGetTXCById.xml | 31 + .../DeleteVcpeResCustService/getBRGArUrlById.xml | 6 + .../VCPE/DeleteVcpeResCustService/getSI.xml | 35 + .../DeleteVcpeResCustService/getSIAfterDelArs.xml | 8 + .../DeleteVcpeResCustService/getTXCArUrlById.xml | 6 + .../VCPE/DeleteVcpeResCustService/request.json | 40 + .../DeleteVcpeResCustService/serviceToDelete.xml | 36 + .../SDNCTopologyQueryCallback.xml | 37 + .../VCPE/DoCreateAllottedResourceBRG/getAR.xml | 8 + .../VCPE/DoCreateAllottedResourceBRG/getArBrg.xml | 31 + .../VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml | 31 + .../DoCreateAllottedResourceBRG/getSIandAR.xml | 38 + .../arGetById.xml | 31 + .../sdncActivateRollbackReq.xml | 51 + .../sdncAssignRollbackReq.xml | 51 + .../sdncCreateRollbackReq.xml | 51 + .../SDNCTopologyQueryCallback.xml | 24 + .../VCPE/DoCreateAllottedResourceTXC/getAR.xml | 8 + .../VCPE/DoCreateAllottedResourceTXC/getArTxc.xml | 31 + .../VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml | 31 + .../DoCreateAllottedResourceTXC/getSIandAR.xml | 38 + .../arGetById.xml | 31 + .../sdncActivateRollbackReq.xml | 51 + .../sdncAssignRollbackReq.xml | 51 + .../sdncCreateRollbackReq.xml | 51 + .../VCPE/DoDeleteAllottedResourceBRG/arGetById.xml | 31 + .../VCPE/DoDeleteAllottedResourceTXC/arGetById.xml | 31 + .../VIPR/getCatalogServiceResourcesData.json | 94 + ...alogServiceResourcesDataForReplaceVnfInfra.json | 98 + ...talogServiceResourcesDataForUpdateVnfInfra.json | 110 + .../resources/__files/VIPR/getCatalogVnfData.json | 44 + .../VIPR/getCatalogVnfNoTwoPhasedForVfModule.json | 44 + .../VIPR/getCatalogVnfYesTwoPhasedForVfModule.json | 44 + .../__files/VIPR/serviceDecompositionATMFW.json | 110 + .../AddNetworkPolicy_AAIResponse_Success.xml | 21 + .../CreateVfModuleVolumeCallbackResponse.xml | 53 + .../__files/VfModularity/DBUpdateResponse.xml | 4 + .../VfModularity/DoUpdateVfModuleRequest.xml | 29 + .../GenerateVfModuleName_AAIResponse_Success.xml | 51 + .../resources/__files/VfModularity/GenericVnf.xml | 38 + .../QueryNetworkPolicy_AAIResponse_Success.xml | 21 + .../VfModularity/SDNCSITopologyAssignCallback.xml | 11 + .../VfModularity/SDNCTopologyActivateCallback.xml | 13 + .../VfModularity/SDNCTopologyAssignCallback.xml | 16 + .../SDNCTopologyChangeAssignCallback.xml | 13 + .../VfModularity/SDNCTopologyCreateCallback.xml | 16 + .../SDNCTopologyDeactivateCallback.xml | 13 + .../SDNCTopologyDeactivateCallbackNotFound.xml | 8 + .../VfModularity/SDNCTopologyDeleteCallback.xml | 16 + .../VfModularity/SDNCTopologyQueryCallback.xml | 315 + .../SDNCTopologyQueryCallbackVfModule.xml | 141 + .../SDNCTopologyQueryCallbackVfModuleNoVnf.xml | 81 + .../VfModularity/SDNCTopologyQueryCallbackVnf.xml | 82 + .../VfModularity/SDNCTopologyUnassignCallback.xml | 16 + .../VfModularity/StandardSDNCSynchResponse.xml | 5 + .../VfModularity/VNFAdapterRestCreateCallback.xml | 55 + .../VfModularity/VNFAdapterRestDeleteRequest.xml | 15 + .../VfModularity/VNFAdapterRestDeleteResponse.xml | 56 + .../VfModularity/VNFAdapterRestUpdateCallback.xml | 16 + .../VNFAdapterRestVolumeGroupCallback.xml | 15 + .../__files/VfModularity/VfModule-lukewarm.xml | 10 + .../VfModule-new-PendingActivation.xml | 9 + .../__files/VfModularity/VfModule-new.xml | 9 + .../__files/VfModularity/VfModule-supercool.xml | 27 + .../resources/__files/VfModularity/VolumeGroup.xml | 25 + .../__files/deleteNetworkResponse_Success.xml | 3 + .../src/test/resources/__files/requestDetails.json | 37 + .../src/test/resources/__files/schema.json | 16 + .../src/test/resources/application-test.yml | 334 + .../resources/applicationContext_forPnfTesting.xml | 70 + .../test/resources/catalogDBClientProps.properties | 1 + .../src/test/resources/logback-test.xml | 44 + .../resources/requestsDBClientProps.properties | 1 + .../test/resources/stubprocess/GenericStub.bpmn | 35 + bpmn/so-bpmn-infrastructure-flows/pom.xml | 286 + .../CompareModelofE2EServiceInstance.groovy | 256 + .../scripts/CreateCustomE2EServiceInstance.groovy | 331 + .../CreateGenericALaCarteServiceInstance.groovy | 357 + .../scripts/CreateNetworkInstance.groovy | 455 ++ .../scripts/CreateSDNCNetworkResource.groovy | 327 + .../scripts/CreateVFCNSResource.groovy | 326 + .../scripts/CreateVfModuleInfra.groovy | 620 ++ .../scripts/CreateVfModuleVolumeInfraV1.groovy | 356 + .../infrastructure/scripts/CreateVnfInfra.groovy | 542 ++ .../scripts/DeleteCustomE2EServiceInstance.groovy | 386 ++ .../DeleteGenericALaCarteServiceInstance.groovy | 362 + .../scripts/DeleteNetworkInstance.groovy | 420 ++ .../scripts/DeleteSDNCNetworkResource.groovy | 308 + .../scripts/DeleteVFCNSResource.groovy | 87 + .../scripts/DeleteVfModuleInfra.groovy | 367 ++ .../scripts/DeleteVfModuleVolumeInfraV1.groovy | 545 ++ .../infrastructure/scripts/DeleteVnfInfra.groovy | 207 + .../scripts/DoCompareModelVersions.groovy | 258 + .../DoCompareModelofE2EServiceInstance.groovy | 260 + .../scripts/DoCreateE2EServiceInstance.groovy | 451 ++ .../DoCreateE2EServiceInstanceRollback.groovy | 268 + .../scripts/DoCreateNetworkInstance.groovy | 1680 +++++ .../scripts/DoCreateNetworkInstanceRollback.groovy | 393 ++ .../scripts/DoCreateResources.groovy | 279 + .../scripts/DoCreateServiceInstance.groovy | 795 +++ .../scripts/DoCreateServiceInstanceRollback.groovy | 242 + .../DoCreateServiceInstanceRollbackV2.groovy | 72 + .../scripts/DoCreateServiceInstanceV2.groovy | 104 + .../DoCreateVFCNetworkServiceInstance.groovy | 282 + .../infrastructure/scripts/DoCreateVfModule.groovy | 2133 ++++++ .../scripts/DoCreateVfModuleRollback.groovy | 666 ++ .../scripts/DoCreateVfModuleVolumeRollback.groovy | 242 + .../scripts/DoCreateVfModuleVolumeV2.groovy | 616 ++ .../bpmn/infrastructure/scripts/DoCreateVnf.groovy | 618 ++ .../scripts/DoCreateVnfAndModules.groovy | 467 ++ .../scripts/DoCreateVnfAndModulesRollback.groovy | 360 + .../DoCustomDeleteE2EServiceInstance.groovy | 640 ++ .../DoCustomDeleteE2EServiceInstanceV2.groovy | 1132 ++++ .../scripts/DoDeleteE2EServiceInstance.groovy | 439 ++ .../scripts/DoDeleteNetworkInstance.groovy | 1077 +++ .../scripts/DoDeleteNetworkInstanceRollback.groovy | 338 + .../scripts/DoDeleteResources.groovy | 317 + .../scripts/DoDeleteResourcesV1.groovy | 400 ++ .../scripts/DoDeleteServiceInstance.groovy | 472 ++ .../DoDeleteVFCNetworkServiceInstance.groovy | 285 + .../infrastructure/scripts/DoDeleteVfModule.groovy | 711 ++ .../scripts/DoDeleteVfModuleFromVnf.groovy | 609 ++ .../scripts/DoDeleteVfModuleVolumeV2.groovy | 355 + .../bpmn/infrastructure/scripts/DoDeleteVnf.groovy | 161 + .../scripts/DoDeleteVnfAndModules.groovy | 538 ++ .../scripts/DoScaleE2EServiceInstance.groovy | 142 + .../DoScaleVFCNetworkServiceInstance.groovy | 332 + .../scripts/DoUpdateE2EServiceInstance.groovy | 451 ++ .../DoUpdateE2EServiceInstanceRollback.groovy | 345 + .../scripts/DoUpdateNetworkInstance.groovy | 1408 ++++ .../scripts/DoUpdateNetworkInstanceRollback.groovy | 310 + .../infrastructure/scripts/DoUpdateVfModule.groovy | 1040 +++ .../scripts/DoUpdateVnfAndModules.groovy | 414 ++ .../scripts/HealchCheckActivate.groovy | 59 + .../infrastructure/scripts/ReplaceVnfInfra.groovy | 611 ++ .../bpmn/infrastructure/scripts/RollbackVnf.groovy | 148 + .../scripts/ScaleCustomE2EServiceInstance.groovy | 296 + .../scripts/UpdateCustomE2EServiceInstance.groovy | 570 ++ .../scripts/UpdateNetworkInstance.groovy | 403 ++ .../infrastructure/scripts/UpdateVfModule.groovy | 326 + .../scripts/UpdateVfModuleInfra.groovy | 504 ++ .../scripts/UpdateVfModuleInfraV2.groovy | 468 ++ .../scripts/UpdateVfModuleVolume.groovy | 445 ++ .../scripts/UpdateVfModuleVolumeInfraV1.groovy | 561 ++ .../infrastructure/scripts/UpdateVnfInfra.groovy | 481 ++ .../bpmn/infrastructure/scripts/VnfCmBase.groovy | 835 +++ .../infrastructure/scripts/VnfConfigUpdate.groovy | 483 ++ .../infrastructure/scripts/VnfInPlaceUpdate.groovy | 599 ++ .../vcpe/scripts/CreateVcpeResCustService.groovy | 814 +++ .../vcpe/scripts/DeleteVcpeResCustService.groovy | 461 ++ .../scripts/DoCreateAllottedResourceBRG.groovy | 678 ++ .../DoCreateAllottedResourceBRGRollback.groovy | 279 + .../scripts/DoCreateAllottedResourceTXC.groovy | 674 ++ .../DoCreateAllottedResourceTXCRollback.groovy | 278 + .../scripts/DoDeleteAllottedResourceBRG.groovy | 368 ++ .../scripts/DoDeleteAllottedResourceTXC.groovy | 369 ++ .../src/main/resources/META-INF/processes.xml | 37 + .../process/CompareModelofE2EServiceInstance.bpmn | 335 + .../process/CreateAndActivatePnfResource.bpmn | 325 + .../process/CreateCustomE2EServiceInstance.bpmn | 391 ++ .../CreateGenericALaCarteServiceInstance.bpmn | 452 ++ .../resources/process/CreateNetworkInstance.bpmn | 340 + .../process/CreateSDNCNetworkResource.bpmn | 287 + .../resources/process/CreateVFCNSResource.bpmn | 277 + .../process/CreateVcpeResCustService.bpmn | 1539 +++++ .../process/CreateVcpeResCustServiceV2.bpmn | 1443 ++++ .../resources/process/CreateVfModuleInfra.bpmn | 700 ++ .../process/CreateVfModuleVolumeInfraV1.bpmn | 514 ++ .../src/main/resources/process/CreateVnfInfra.bpmn | 340 + .../process/DeleteCustomE2EServiceInstance.bpmn | 381 ++ .../DeleteGenericALaCarteServiceInstance.bpmn | 331 + .../resources/process/DeleteNetworkInstance.bpmn | 372 ++ .../process/DeleteSDNCNetworkResource.bpmn | 258 + .../resources/process/DeleteVFCNSResource.bpmn | 166 + .../process/DeleteVcpeResCustService.bpmn | 812 +++ .../resources/process/DeleteVfModuleInfra.bpmn | 331 + .../process/DeleteVfModuleVolumeInfraV1.bpmn | 568 ++ .../src/main/resources/process/DeleteVnfInfra.bpmn | 353 + .../main/resources/process/ReplaceVnfInfra.bpmn | 1815 +++++ .../process/ScaleCustomE2EServiceInstance.bpmn | 379 ++ .../process/UpdateCustomE2EServiceInstance.bpmn | 693 ++ .../resources/process/UpdateNetworkInstance.bpmn | 322 + .../resources/process/UpdateVfModuleInfra.bpmn | 297 + .../resources/process/UpdateVfModuleInfraV2.bpmn | 412 ++ .../process/UpdateVfModuleVolumeInfraV1.bpmn | 517 ++ .../src/main/resources/process/UpdateVnfInfra.bpmn | 1685 +++++ .../main/resources/process/VnfConfigUpdate.bpmn | 1636 +++++ .../main/resources/process/VnfInPlaceUpdate.bpmn | 2302 +++++++ .../subprocess/DoCompareModelVersions.bpmn | 330 + .../DoCompareModelofE2EServiceInstance.bpmn | 227 + .../subprocess/DoCreateAllottedResourceBRG.bpmn | 755 +++ .../DoCreateAllottedResourceBRGRollback.bpmn | 575 ++ .../subprocess/DoCreateAllottedResourceTXC.bpmn | 755 +++ .../DoCreateAllottedResourceTXCRollback.bpmn | 575 ++ .../subprocess/DoCreateE2ENetworkInstance.bpmn | 136 + .../subprocess/DoCreateE2EServiceInstance.bpmn | 544 ++ .../DoCreateE2EServiceInstanceRollback.bpmn | 373 ++ .../subprocess/DoCreateE2EServiceInstanceV2.bpmn | 1051 +++ .../subprocess/DoCreateNetworkInstance.bpmn | 1363 ++++ .../DoCreateNetworkInstanceRollback.bpmn | 517 ++ .../resources/subprocess/DoCreateResources.bpmn | 370 ++ .../subprocess/DoCreateServiceInstance.bpmn | 515 ++ .../DoCreateServiceInstanceRollback.bpmn | 373 ++ .../DoCreateServiceInstanceRollbackV2.bpmn | 103 + .../subprocess/DoCreateServiceInstanceV2.bpmn | 197 + .../DoCreateVFCNetworkServiceInstance.bpmn | 261 + .../resources/subprocess/DoCreateVfModule.bpmn | 1701 +++++ .../subprocess/DoCreateVfModuleRollback.bpmn | 978 +++ .../subprocess/DoCreateVfModuleVolumeRollback.bpmn | 247 + .../subprocess/DoCreateVfModuleVolumeV2.bpmn | 362 + .../src/main/resources/subprocess/DoCreateVnf.bpmn | 635 ++ .../subprocess/DoCreateVnfAndModules.bpmn | 527 ++ .../subprocess/DoCreateVnfAndModulesRollback.bpmn | 541 ++ .../DoCustomDeleteE2EServiceInstance.bpmn | 470 ++ .../DoCustomDeleteE2EServiceInstanceV2.bpmn | 928 +++ .../subprocess/DoDeleteAllottedResourceBRG.bpmn | 422 ++ .../subprocess/DoDeleteAllottedResourceTXC.bpmn | 422 ++ .../subprocess/DoDeleteE2EServiceInstance.bpmn | 378 ++ .../subprocess/DoDeleteNetworkInstance.bpmn | 933 +++ .../DoDeleteNetworkInstanceRollback.bpmn | 547 ++ .../resources/subprocess/DoDeleteResources.bpmn | 486 ++ .../resources/subprocess/DoDeleteResourcesV1.bpmn | 455 ++ .../subprocess/DoDeleteServiceInstance.bpmn | 373 ++ .../DoDeleteVFCNetworkServiceInstance.bpmn | 275 + .../resources/subprocess/DoDeleteVfModule.bpmn | 433 ++ .../subprocess/DoDeleteVfModuleFromVnf.bpmn | 396 ++ .../subprocess/DoDeleteVfModuleVolumeV2.bpmn | 208 + .../src/main/resources/subprocess/DoDeleteVnf.bpmn | 303 + .../subprocess/DoDeleteVnfAndModules.bpmn | 490 ++ .../subprocess/DoScaleE2EServiceInstance.bpmn | 187 + .../subprocess/DoScaleVFCServiceInstance.bpmn | 89 + .../subprocess/DoUnderlayVpnOperation.bpmn | 293 + .../subprocess/DoUpdateE2EServiceInstance.bpmn | 648 ++ .../DoUpdateE2EServiceInstanceRollback.bpmn | 799 +++ .../subprocess/DoUpdateNetworkInstance.bpmn | 829 +++ .../DoUpdateNetworkInstanceRollback.bpmn | 374 ++ .../resources/subprocess/DoUpdateVfModule.bpmn | 671 ++ .../subprocess/DoUpdateVnfAndModules.bpmn | 275 + .../src/main/resources/subprocess/RollbackVnf.bpmn | 346 + .../subprocess/SetRefactorServiceDecomp.bpmn | 68 + .../CreateCustomE2EServiceInstanceTest.groovy | 84 + ...CreateGenericAlaCarteServiceInstanceTest.groovy | 235 + .../scripts/CreateNetworkInstanceTest.groovy | 379 ++ .../scripts/CreateVfModuleInfraTest.groovy | 96 + .../scripts/CreateVfModuleVolumeInfraV1Test.groovy | 208 + .../DeleteCustomE2EServiceInstanceTest.groovy | 148 + ...DeleteGenericAlaCarteServiceInstanceTest.groovy | 125 + .../scripts/DeleteNetworkInstanceTest.groovy | 418 ++ .../scripts/DeleteVfModuleVolumeInfraV1Test.groovy | 167 + .../scripts/DoCreateE2EServiceInstanceTest.groovy | 103 + .../DoCreateNetworkInstanceRollbackTest.groovy | 369 ++ .../scripts/DoCreateNetworkInstanceTest.groovy | 4324 ++++++++++++ .../scripts/DoCreateServiceInstanceTest.groovy | 135 + .../DoCreateVFCNetworkServiceInstanceTest.groovy | 106 + .../scripts/DoCreateVfModuleRollbackTest.groovy | 202 + .../scripts/DoCreateVfModuleTest.groovy | 229 + .../scripts/DoCreateVfModuleVolumeV2Test.groovy | 135 + .../infrastructure/scripts/DoCreateVnfTest.groovy | 106 + .../DoCustomDeleteE2EServiceInstanceTest.groovy | 169 + .../DoDeleteNetworkInstanceRollbackTest.groovy | 343 + .../scripts/DoDeleteNetworkInstanceTest.groovy | 1948 ++++++ .../scripts/DoDeleteServiceInstanceTest.groovy | 127 + .../scripts/DoDeleteVfModuleFromVnfTest.groovy | 172 + .../scripts/DoDeleteVfModuleTest.groovy | 163 + .../scripts/DoDeleteVfModuleVolumeV2Test.groovy | 152 + .../scripts/DoDeleteVnfAndModulesTest.groovy | 162 + .../scripts/DoScaleE2EServiceInstanceTest.groovy | 110 + .../DoUpdateNetworkInstanceRollbackTest.groovy | 332 + .../scripts/DoUpdateNetworkInstanceTest.groovy | 2762 ++++++++ .../scripts/DoUpdateVfModuleTest.groovy | 309 + .../scripts/DoUpdateVnfAndModulesTest.groovy | 126 + .../ScaleCustomE2EServiceInstanceTest.groovy | 195 + .../scripts/UpdateNetworkInstanceTest.groovy | 358 + .../scripts/UpdateVfModuleVolumeInfraV1Test.groovy | 134 + .../scripts/CreateVcpeResCustServiceTest.groovy | 1269 ++++ .../scripts/DeleteVcpeResCustServiceTest.groovy | 773 +++ .../DoCreateAllottedResourceBRGRollbackTest.groovy | 654 ++ .../scripts/DoCreateAllottedResourceBRGTest.groovy | 999 +++ .../DoCreateAllottedResourceTXCRollbackTest.groovy | 654 ++ .../scripts/DoCreateAllottedResourceTXCTest.groovy | 957 +++ .../scripts/DoDeleteAllottedResourceBRGTest.groovy | 606 ++ .../scripts/DoDeleteAllottedResourceTXCTest.groovy | 607 ++ .../so/bpmn/vcpe/scripts/GroovyTestBase.groovy | 124 + .../org/onap/so/bpmn/vcpe/scripts/MapGetter.groovy | 49 + .../org/onap/so/bpmn/vcpe/scripts/MapSetter.groovy | 50 + .../src/test/resources/CreateSiSample.json | 72 + .../stubprocess/DoCreateAllottedResourceBRG.bpmn | 54 + .../DoCreateAllottedResourceBRGRollback.bpmn | 55 + .../stubprocess/DoCreateAllottedResourceTXC.bpmn | 38 + .../DoCreateServiceInstanceRollback.bpmn | 53 + .../VCPE/stubprocess/DoCreateVnfAndModules.bpmn | 53 + .../stubprocess/DoCreateVnfAndModulesRollback.bpmn | 53 + .../VCPE/stubprocess/DoDeleteVnfAndModules.bpmn | 37 + .../test/resources/VCPE/stubprocess/Homing.bpmn | 35 + .../AAI/AAI_defaultCloudRegionByCloudRegionId.json | 12 + .../resources/__files/AAI/AAI_genericVnfGet.json | 9 + .../__files/AAI/AAI_genericVnfsByVnfId.json | 434 ++ .../resources/__files/AAI/AAI_pserverByVnfId.json | 72 + .../__files/AAI/AAI_vfModuleByVfModuleId.json | 27 + .../src/test/resources/__files/AAI/mockObject.json | 10 + .../test/resources/__files/APPC/appc_error.json | 21 + .../Network/createNetworkRequest.xml | 75 + .../Network/createNetworkResponse.xml | 31 + .../BuildingBlocks/Network/defaultNetwork.json | 10 + .../BuildingBlocks/Network/l3NetworkBbObject.json | 226 + .../Network/payloadUpdateCreated.json | 216 + .../Network/queryAAICloudRegion.json | 596 ++ .../Network/queryAAICloudRegion25.json | 596 ++ .../Network/queryAAICloudRegionError.json | 596 ++ .../Network/queryAAINetworkTestResponse.json | 141 + .../BuildingBlocks/Network/queryAAIResponse.json | 166 + .../Network/queryAAIResponseEmptyUri.json | 53 + .../Network/queryAAIVpnBindingTestResponse.json | 891 +++ .../BuildingBlocks/Network/queryIdAAIResponse.xml | 145 + .../unassignNetworkBB_queryAAIResponse_.json | 162 + .../Network/updateContrailAAIPayloadRequest.xml | 149 + .../__files/BuildingBlocks/sniroCallback2AR1Vnf | 107 + .../BuildingBlocks/sniroCallback2AR1Vnf2Net | 165 + .../BuildingBlocks/sniroCallbackNoSolutionFound | 15 + .../BuildingBlocks/sniroCallbackPolicyException | 9 + .../BuildingBlocks/sniroCallbackServiceException | 12 + .../cloudRegion25_AAIResponse_Success.xml | 20 + .../cloudRegion30_AAIResponse_Success.xml | 20 + .../CreateNetworkV2/createNetworkResponse_400.xml | 6 + .../CreateNetworkV2/createNetworkResponse_500.xml | 80 + .../createNetworkResponse_Success.xml | 24 + .../createNetwork_queryInstance_Success.xml | 4 + ...reateNetwork_queryName2_AAIResponse_Success.xml | 62 + ...Network_queryNameActive_AAIResponse_Success.xml | 74 + .../createNetwork_queryName_AAIResponse_404.xml | 19 + ...createNetwork_queryName_AAIResponse_Success.xml | 62 + ...reateNetwork_queryNetworkId_AAIResponse_404.xml | 19 + ...ueryNetworkId_AAIResponse_NoPayload_Success.xml | 73 + ...eNetwork_queryNetworkId_AAIResponse_Success.xml | 110 + ...work_queryNetworkPolicy_AAIResponse_Success.xml | 21 + ...k_queryNetworkTableRef1_AAIResponse_Success.xml | 20 + ...k_queryNetworkTableRef2_AAIResponse_Success.xml | 20 + ...ork_queryVpnBindingList_AAIResponse_Success.xml | 57 + ...Network_queryVpnBinding_AAIResponse_Success.xml | 46 + ...eNetwork_updateContrail_AAIResponse_Success.xml | 11 + ...sdncCreateNetworkTopologyRsrcAssignResponse.xml | 15 + .../sdncCreateNetworkTopologySimResponse.xml | 17 + .../DoCreateServiceInstanceInput.json | 42 + .../SetupServiceDecompJson.json | 36 + ...e_createServiceInstance_AAIResponse_Success.xml | 11 + ...e_queryGlobalCustomerId_AAIResponse_Success.xml | 62 + .../CreateVfModuleCallbackException.xml | 7 + .../CreateVfModuleVolumeCallbackResponse.xml | 53 + .../CreateVfModuleVolumeRequest.xml | 24 + .../CreateVfModuleVolumeInfraV1/GenericVnf.xml | 38 + .../RollbackVfModuleVolumeCallbackResponse.xml | 5 + .../createVfModuleVolume_VID_request.json | 71 + ...createVfModuleVolume_VID_request_noreqparm.json | 45 + ...Volume_createVolumeName_AAIResponse_Success.xml | 49 + ...Volume_deleteVolumeName_AAIResponse_Success.xml | 24 + ...oduleVolume_queryVolumeName_AAIResponse_404.xml | 31 + ...eVolume_queryVolumeName_AAIResponse_Success.xml | 50 + ...Volume_updateVolumeName_AAIResponse_Success.xml | 24 + .../CreateVfModuleVolumeInfraV1/getSIUrlById.xml | 6 + ...ryVolumeId_AAIResponse_HasVfModRelationship.xml | 62 + .../__files/CreateVfModule_VID_request.json | 77 + .../CreateVfModule_VID_request_noPreloads.json | 79 + .../CreateVfModule_VID_request_userParam.json | 77 + .../test/resources/__files/DBUpdateResponse.xml | 4 + .../test/resources/__files/Database/DBAdapter.xml | 1 + .../__files/Database/DBUpdateResponse.xml | 4 + .../DeleteGenericVNFV1/sdncAdapterResponse.xml | 7 + .../cloudRegion25_AAIResponse_Success.xml | 20 + .../cloudRegion30_AAIResponse_Success.xml | 20 + .../deleteAAIResponse_Failure500_RESTFault.xml | 19 + .../deleteNetworkAAIResponse_Success.xml | 61 + ...NetworkAAIResponse_withRelationship_Success.xml | 73 + .../sdncDeleteNetworkTopologySimResponse.xml | 17 + ...DeleteNetworkTopologySimResponse_noExtraTag.xml | 17 + .../__files/DeleteVfModuleCallbackResponse.xml | 21 + .../DeleteVfModuleVolumeCallbackResponse.xml | 5 + .../deleteVfModuleVolume_VID_request_st.json | 17 + .../queryVolumeId_AAIResponse_Success.xml | 42 + .../__files/DeleteVfModule_VID_request.json | 50 + .../DoCreateVfModule/DoCreateVfModuleRequest.xml | 31 + .../cloudRegion_AAIResponse_Success.xml | 20 + .../__files/DoCreateVfModule/createVnfARequest.xml | 169 + .../DoCreateVfModule/getGenericVnfResponse.xml | 28 + .../__files/DoCreateVfModule/sdncGetResponse.xml | 195 + .../DoCreateVfModuleRollback/GenericVnf.xml | 26 + .../GenericVnfVfModule.xml | 26 + .../deactivateSDNCRequest.xml | 36 + .../sdncAdapterWorkflowRequest.xml | 37 + .../vnfAdapterRestV1Request.xml | 14 + .../CreateVfModuleVolumeCallbackResponse.xml | 53 + .../CreateVfModuleVolumeNoRollbackRequest.xml | 24 + .../CreateVfModuleVolumeRequest.xml | 24 + .../DoCreateVfModuleVolumeV1/GenericVnf.xml | 38 + .../RollbackVfModuleVolumeCallbackResponse.xml | 5 + .../createVfModuleVolume_VID_request.json | 104 + ...Volume_createVolumeName_AAIResponse_Success.xml | 49 + ...Volume_deleteVolumeName_AAIResponse_Success.xml | 24 + ...eVolume_queryVolumeName_AAIResponse_Success.xml | 49 + ...Volume_updateVolumeName_AAIResponse_Success.xml | 24 + .../cloudRegion_AAIResponse_Success.xml | 20 + .../vnfAdapterDeleteRequest.xml | 13 + .../__files/DoCreateVfModule_getVnfResponse.xml | 26 + .../DoDeleteVfModule/getGenericVnfResponse.xml | 28 + .../sdncAdapterWorkflowRequest.xml | 36 + .../cloudRegion_AAIResponse_Success.xml | 20 + .../DoUpdateVfModule/getGenericVnfResponse.xml | 28 + .../DoUpdateVfModule/sdncActivateRequest.xml | 36 + .../DoUpdateVfModule/sdncChangeAssignRequest.xml | 36 + .../__files/DoUpdateVfModule/sdncGetResponse.xml | 195 + .../DoUpdateVfModule/sdncTopologyRequest.xml | 11 + .../DoUpdateVfModule/vnfAdapterRestRequest.xml | 170 + .../__files/GenericFlows/MsoCompletionRequest.xml | 11 + .../__files/GenericFlows/SDNCDeleteResponse.xml | 212 + .../__files/GenericFlows/aaiGetResponse.xml | 33 + .../__files/GenericFlows/getARUrlById.xml | 6 + .../GenericFlows/getGenericVnfByNameResponse.xml | 23 + .../__files/GenericFlows/getGenericVnfResponse.xml | 90 + .../getGenericVnfResponse_hasRelationships.xml | 90 + .../resources/__files/GenericFlows/getNotFound.xml | 2 + .../__files/GenericFlows/getParentSIUrlById.xml | 6 + .../GenericFlows/getParentServiceInstance.xml | 30 + .../__files/GenericFlows/getSINoRelations.xml | 6 + .../__files/GenericFlows/getSIUrlById.xml | 6 + .../__files/GenericFlows/getSIUrlByIdVipr.xml | 7 + .../__files/GenericFlows/getServiceInstance.xml | 30 + .../InfrastructureFlows/ConfigVnf_VID_request.json | 39 + .../InfrastructureFlows/CreateVnfInfraRequest.json | 46 + .../DeleteCustomE2EService.json | 21 + .../DeleteVnfInfraRequestCascadeDelete.json | 39 + .../DoCreateServiceInstance_request.json | 186 + .../DoScaleE2EServiceInstance.json | 38 + .../ReplaceVnf_VID_request.json | 49 + .../UpdateVfModule_VID_request.json | 62 + .../InfrastructureFlows/UpdateVnf_VID_request.json | 56 + .../VnfInPlaceUpdate_VID_request.json | 16 + .../__files/Macro/CreateNetworkCollection.json | 70 + .../__files/Macro/ServiceMacroAssign.json | 125 + .../__files/Policy/policyAbortResponse.json | 1 + .../__files/Policy/policySkipResponse.json | 1 + .../__files/Schemas/ActivateServiceInstance.json | 7 + .../__files/Schemas/ActivateVnfSchema.json | 13 + .../Schemas/AssignServiceInstanceSchema.json | 16 + .../resources/__files/Schemas/AssignVnfSchema.json | 13 + .../sdncUpdateNetworkTopologySimResponse.xml | 17 + .../UpdateNetworkV2/updateNetworkResponse_400.xml | 6 + .../UpdateNetworkV2/updateNetworkResponse_500.xml | 80 + .../updateNetworkResponse_Success.xml | 24 + .../updateNetwork_queryInstance_Success.xml | 4 + ...ueryNetworkId_AAIResponse_NoPayload_Success.xml | 73 + ...eNetwork_queryNetworkId_AAIResponse_Success.xml | 95 + ...work_queryNetworkPolicy_AAIResponse_Success.xml | 21 + ...k_queryNetworkTableRef1_AAIResponse_Success.xml | 20 + ...k_queryNetworkTableRef2_AAIResponse_Success.xml | 20 + ...ork_queryVpnBindingList_AAIResponse_Success.xml | 57 + ...Network_queryVpnBinding_AAIResponse_Success.xml | 46 + ...eNetwork_updateContrail_AAIResponse_Success.xml | 11 + .../queryVolumeId_AAIResponse_Success.xml | 44 + .../updateVfModuleVolume_VID_request.json | 64 + .../updateVfModuleVolume_VID_request_2.json | 64 + .../updateVolumeGroupRequest.xml | 38 + .../vf_module_aai_response.xml | 29 + .../SDNCTopologyQueryBRGCallback.xml | 37 + .../SDNCTopologyQueryTXCCallback.xml | 24 + .../VCPE/CreateVcpeResCustService/arGetById.xml | 31 + .../getCatalogServiceResourcesData.json | 127 + .../getCatalogServiceResourcesNoData.json | 11 + .../VCPE/CreateVcpeResCustService/getCustomer.xml | 7 + .../VCPE/CreateVcpeResCustService/request.json | 40 + .../CreateVcpeResCustService/requestNoSIName.json | 39 + .../requestNoSINameNoRollback.json | 39 + .../VCPE/DeleteVcpeResCustService/arGetBRGById.xml | 31 + .../VCPE/DeleteVcpeResCustService/arGetTXCById.xml | 31 + .../DeleteVcpeResCustService/getBRGArUrlById.xml | 6 + .../VCPE/DeleteVcpeResCustService/getSI.xml | 35 + .../DeleteVcpeResCustService/getSIAfterDelArs.xml | 8 + .../DeleteVcpeResCustService/getTXCArUrlById.xml | 6 + .../VCPE/DeleteVcpeResCustService/request.json | 40 + .../DeleteVcpeResCustService/serviceToDelete.xml | 36 + .../SDNCTopologyQueryCallback.xml | 37 + .../VCPE/DoCreateAllottedResourceBRG/getAR.xml | 8 + .../VCPE/DoCreateAllottedResourceBRG/getArBrg.xml | 31 + .../VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml | 31 + .../DoCreateAllottedResourceBRG/getSIandAR.xml | 38 + .../arGetById.xml | 31 + .../sdncActivateRollbackReq.xml | 51 + .../sdncAssignRollbackReq.xml | 51 + .../sdncCreateRollbackReq.xml | 51 + .../SDNCTopologyQueryCallback.xml | 24 + .../VCPE/DoCreateAllottedResourceTXC/getAR.xml | 8 + .../VCPE/DoCreateAllottedResourceTXC/getArTxc.xml | 31 + .../VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml | 31 + .../DoCreateAllottedResourceTXC/getSIandAR.xml | 38 + .../arGetById.xml | 31 + .../sdncActivateRollbackReq.xml | 51 + .../sdncAssignRollbackReq.xml | 51 + .../sdncCreateRollbackReq.xml | 51 + .../VCPE/DoDeleteAllottedResourceBRG/arGetById.xml | 31 + .../VCPE/DoDeleteAllottedResourceTXC/arGetById.xml | 31 + .../VIPR/getCatalogServiceResourcesData.json | 94 + ...alogServiceResourcesDataForReplaceVnfInfra.json | 98 + ...talogServiceResourcesDataForUpdateVnfInfra.json | 110 + .../resources/__files/VIPR/getCatalogVnfData.json | 44 + .../VIPR/getCatalogVnfNoTwoPhasedForVfModule.json | 44 + .../VIPR/getCatalogVnfYesTwoPhasedForVfModule.json | 44 + .../__files/VIPR/serviceDecompositionATMFW.json | 110 + .../AddNetworkPolicy_AAIResponse_Success.xml | 21 + .../CreateVfModuleVolumeCallbackResponse.xml | 53 + .../__files/VfModularity/DBUpdateResponse.xml | 4 + .../VfModularity/DoUpdateVfModuleRequest.xml | 29 + .../GenerateVfModuleName_AAIResponse_Success.xml | 51 + .../resources/__files/VfModularity/GenericVnf.xml | 38 + .../QueryNetworkPolicy_AAIResponse_Success.xml | 21 + .../VfModularity/SDNCSITopologyAssignCallback.xml | 11 + .../VfModularity/SDNCTopologyActivateCallback.xml | 13 + .../VfModularity/SDNCTopologyAssignCallback.xml | 16 + .../SDNCTopologyChangeAssignCallback.xml | 13 + .../VfModularity/SDNCTopologyCreateCallback.xml | 16 + .../SDNCTopologyDeactivateCallback.xml | 13 + .../SDNCTopologyDeactivateCallbackNotFound.xml | 8 + .../VfModularity/SDNCTopologyDeleteCallback.xml | 16 + .../VfModularity/SDNCTopologyQueryCallback.xml | 315 + .../SDNCTopologyQueryCallbackVfModule.xml | 141 + .../SDNCTopologyQueryCallbackVfModuleNoVnf.xml | 81 + .../VfModularity/SDNCTopologyQueryCallbackVnf.xml | 82 + .../VfModularity/SDNCTopologyUnassignCallback.xml | 16 + .../VfModularity/StandardSDNCSynchResponse.xml | 5 + .../VfModularity/VNFAdapterRestCreateCallback.xml | 55 + .../VfModularity/VNFAdapterRestDeleteRequest.xml | 15 + .../VfModularity/VNFAdapterRestDeleteResponse.xml | 56 + .../VfModularity/VNFAdapterRestUpdateCallback.xml | 16 + .../VNFAdapterRestVolumeGroupCallback.xml | 15 + .../__files/VfModularity/VfModule-lukewarm.xml | 10 + .../VfModule-new-PendingActivation.xml | 9 + .../__files/VfModularity/VfModule-new.xml | 9 + .../__files/VfModularity/VfModule-supercool.xml | 27 + .../resources/__files/VfModularity/VolumeGroup.xml | 25 + .../__files/deleteNetworkResponse_Success.xml | 3 + .../src/test/resources/__files/requestDetails.json | 37 + .../src/test/resources/__files/schema.json | 16 + .../src/test/resources/application-test.yml | 340 + .../resources/applicationContext_forPnfTesting.xml | 65 + .../test/resources/catalogDBClientProps.properties | 1 + .../src/test/resources/logback-test.xml | 44 + .../resources/requestsDBClientProps.properties | 1 + .../test/resources/stubprocess/GenericStub.bpmn | 35 + bpmn/so-bpmn-tasks/pom.xml | 49 + .../onap/so/bpmn/buildingblock/SniroHomingV2.java | 563 ++ .../infrastructure/aai/tasks/AAICommonTasks.java | 56 + .../infrastructure/aai/tasks/AAICreateTasks.java | 379 ++ .../infrastructure/aai/tasks/AAIDeleteTasks.java | 136 + .../infrastructure/aai/tasks/AAIFlagTasks.java | 74 + .../infrastructure/aai/tasks/AAIQueryTasks.java | 241 + .../infrastructure/aai/tasks/AAIUpdateTasks.java | 370 ++ .../network/tasks/NetworkAdapterCreateTasks.java | 95 + .../network/tasks/NetworkAdapterDeleteTasks.java | 69 + .../network/tasks/NetworkAdapterUpdateTasks.java | 64 + .../adapter/vnf/tasks/VnfAdapterCreateTasks.java | 107 + .../adapter/vnf/tasks/VnfAdapterDeleteTasks.java | 81 + .../adapter/vnf/tasks/VnfAdapterImpl.java | 126 + .../flowspecific/tasks/AssignNetwork.java | 93 + .../flowspecific/tasks/AssignNetworkBBUtils.java | 99 + .../flowspecific/tasks/AssignVnf.java | 70 + .../flowspecific/tasks/CreateNetwork.java | 68 + .../tasks/CreateNetworkCollection.java | 109 + .../flowspecific/tasks/NetworkBBUtils.java | 77 + .../flowspecific/tasks/SourceSystem.java | 26 + .../flowspecific/tasks/UnassignNetworkBB.java | 104 + .../flowspecific/tasks/UnassignVnf.java | 63 + .../sdnc/tasks/SDNCActivateTasks.java | 121 + .../infrastructure/sdnc/tasks/SDNCAssignTasks.java | 133 + .../sdnc/tasks/SDNCChangeAssignTasks.java | 110 + .../sdnc/tasks/SDNCDeactivateTasks.java | 154 + .../infrastructure/sdnc/tasks/SDNCDeleteTasks.java | 28 + .../infrastructure/sdnc/tasks/SDNCQueryTasks.java | 97 + .../sdnc/tasks/SDNCUnassignTasks.java | 143 + .../tasks/OrchestrationStatusValidator.java | 117 + .../infrastructure/workflow/tasks/Resource.java | 60 + .../workflow/tasks/WorkflowAction.java | 864 +++ .../workflow/tasks/WorkflowActionBBTasks.java | 261 + .../workflow/tasks/WorkflowType.java | 53 + .../so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java | 73 + .../onap/so/client/aai/mapper/AAIObjectMapper.java | 297 + .../adapter/network/NetworkAdapterClient.java | 47 + .../network/NetworkAdapterClientException.java | 35 + .../adapter/network/NetworkAdapterClientImpl.java | 122 + .../network/NetworkAdapterRestProperties.java | 53 + .../network/mapper/NetworkAdapterObjectMapper.java | 341 + .../so/client/adapter/vnf/VnfAdapterClient.java | 49 + .../adapter/vnf/VnfAdapterClientException.java | 34 + .../client/adapter/vnf/VnfAdapterClientImpl.java | 134 + .../adapter/vnf/VnfAdapterRestProperties.java | 54 + .../client/adapter/vnf/VnfVolumeAdapterClient.java | 48 + .../adapter/vnf/VnfVolumeAdapterClientImpl.java | 120 + .../vnf/VnfVolumeAdapterRestProperties.java | 57 + .../adapter/vnf/mapper/VnfAdapterObjectMapper.java | 167 + .../vnf/mapper/VnfAdapterObjectMapperUtils.java | 54 + .../vnf/mapper/VnfAdapterVfModuleObjectMapper.java | 730 +++ .../orchestration/AAICollectionResources.java | 58 + .../orchestration/AAIConfigurationResources.java | 170 + .../orchestration/AAIInstanceGroupResources.java | 65 + .../client/orchestration/AAINetworkResources.java | 157 + .../orchestration/AAIServiceInstanceResources.java | 150 + .../client/orchestration/AAIVfModuleResources.java | 81 + .../so/client/orchestration/AAIVnfResources.java | 113 + .../orchestration/AAIVolumeGroupResources.java | 77 + .../orchestration/AAIVpnBindingResources.java | 101 + .../orchestration/NetworkAdapterResources.java | 83 + .../orchestration/SDNCConfigurationResources.java | 130 + .../client/orchestration/SDNCNetworkResources.java | 111 + .../SDNCServiceInstanceResources.java | 124 + .../orchestration/SDNCVfModuleResources.java | 99 + .../so/client/orchestration/SDNCVnfResources.java | 105 + .../orchestration/SDNOHealthCheckResources.java | 53 + .../orchestration/VnfAdapterVfModuleResources.java | 55 + .../VnfAdapterVolumeGroupResources.java | 57 + .../java/org/onap/so/client/sdnc/BaseClient.java | 84 + .../java/org/onap/so/client/sdnc/SDNCClient.java | 92 + .../org/onap/so/client/sdnc/SdnCommonTasks.java | 138 + .../onap/so/client/sdnc/beans/SDNCProperties.java | 52 + .../onap/so/client/sdnc/beans/SDNCSvcAction.java | 55 + .../so/client/sdnc/beans/SDNCSvcOperation.java | 44 + .../onap/so/client/sdnc/endpoint/SDNCTopology.java | 44 + .../mapper/GCTopologyOperationRequestMapper.java | 86 + .../sdnc/mapper/GeneralTopologyObjectMapper.java | 172 + .../NetworkTopologyOperationRequestMapper.java | 100 + .../mapper/ServiceTopologyOperationMapper.java | 79 + .../VfModuleTopologyOperationRequestMapper.java | 164 + .../mapper/VnfTopologyOperationRequestMapper.java | 138 + .../java/org/onap/so/client/sniro/SniroClient.java | 115 + .../org/onap/so/client/sniro/SniroValidator.java | 138 + .../so/client/sniro/beans/ConductorProperties.java | 62 + .../so/client/sniro/beans/ManagerProperties.java | 59 + .../onap/so/client/sniro/beans/RequestInfo.java | 57 + .../org/onap/so/client/sniro/beans/Resource.java | 55 + .../client/sniro/beans/SniroConductorRequest.java | 65 + .../so/client/sniro/beans/SniroManagerRequest.java | 95 + .../src/test/java/org/onap/so/BaseTest.java | 44 + .../java/org/onap/so/EmbeddedMariaDbConfig.java | 64 + .../src/test/java/org/onap/so/FileUtil.java | 81 + .../src/test/java/org/onap/so/TestApplication.java | 54 + .../test/java/org/onap/so/bpmn/BaseTaskTest.java | 119 + .../so/bpmn/common/aai/tasks/AAIFlagTasksTest.java | 139 + .../onap/so/bpmn/common/data/TestDataSetup.java | 665 ++ .../aai/tasks/AAICreateTasksTest.java | 387 ++ .../aai/tasks/AAIUpdateTasksTest.java | 427 ++ .../tasks/NetworkAdapterCreateTasksTest.java | 97 + .../tasks/NetworkAdapterDeleteTasksTest.java | 82 + .../tasks/NetworkAdapterUpdateTasksTest.java | 101 + .../vnf/tasks/VnfAdapterCreateTasksTest.java | 157 + .../vnf/tasks/VnfAdapterDeleteTasksTest.java | 115 + .../adapter/vnf/tasks/VnfAdapterImplTest.java | 169 + .../tasks/AssignNetworkBBUtilsTest.java | 59 + .../flowspecific/tasks/AssignNetworkTest.java | 115 + .../flowspecific/tasks/AssignVnfTest.java | 110 + .../tasks/CreateNetworkCollectionTest.java | 95 + .../flowspecific/tasks/CreateNetworkTest.java | 84 + .../flowspecific/tasks/NetworkBBUtilsTest.java | 118 + .../flowspecific/tasks/UnassignNetworkBBTest.java | 92 + .../flowspecific/tasks/UnassignVnfTest.java | 67 + .../sdnc/tasks/SDNCActivateTaskTest.java | 116 + .../sdnc/tasks/SDNCAssignTasksTest.java | 144 + .../sdnc/tasks/SDNCChangeAssignTasksTest.java | 100 + .../sdnc/tasks/SDNCDeactivateTaskTest.java | 154 + .../sdnc/tasks/SDNCQueryTasksTest.java | 121 + .../sdnc/tasks/SDNCUnassignTasksTest.java | 202 + .../tasks/OrchestrationStatusValidatorTest.java | 182 + .../workflow/tasks/WorkflowActionBBTasksTest.java | 188 + .../workflow/tasks/WorkflowActionTest.java | 1494 +++++ .../bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java | 108 + .../so/client/aai/mapper/AAIObjectMapperTest.java | 623 ++ .../adapter/network/NetworkAdapterClientIT.java | 227 + .../mapper/NetworkAdapterObjectMapperTest.java | 301 + .../so/client/adapter/vnf/VnfAdapterClientIT.java | 224 + .../adapter/vnf/VnfVolumeAdapterClientIT.java | 214 + .../vnf/VnfVolumeAdapterRestPropertiesTest.java | 46 + .../vnf/mapper/VnfAdapterObjectMapperTest.java | 372 ++ ...AdapterVfModuleObjectMapperIntegrationTest.java | 449 ++ .../mapper/VnfAdapterVfModuleObjectMapperTest.java | 67 + .../orchestration/AAICollectionResourcesTest.java | 91 + .../AAIConfigurationResourcesTest.java | 180 + .../AAIInstanceGroupResourcesTest.java | 95 + .../orchestration/AAINetworkResourcesTest.java | 317 + .../AAIServiceInstanceResourcesTest.java | 181 + .../orchestration/AAIVfModuleResourcesTest.java | 127 + .../client/orchestration/AAIVnfResourcesTest.java | 161 + .../orchestration/AAIVolumeGroupResourcesTest.java | 132 + .../orchestration/AAIVpnBindingResourcesTest.java | 132 + .../orchestration/NetworkAdapterResourcesTest.java | 219 + .../SDNCConfigurationResourcesTest.java | 116 + .../orchestration/SDNCNetworkResourcesTest.java | 204 + .../SDNCServiceInstanceResourcesTest.java | 149 + .../orchestration/SDNCVfModuleResourcesTest.java | 126 + .../client/orchestration/SDNCVnfResourcesTest.java | 185 + .../SDNOHealthCheckResourcesTest.java | 67 + .../VnfAdapterVfModuleResourcesTest.java | 122 + .../VnfAdapterVolumeGroupResourcesTest.java | 122 + .../policy/CommonObjectMapperProviderTest.java | 46 + .../so/client/sdn/common/SdnCommonTasksTest.java | 83 + .../org/onap/so/client/sdnc/SDNCClientTest.java | 58 + .../GCTopologyOperationRequestMapperTest.java | 138 + .../mapper/GeneralTopologyObjectMapperTest.java | 225 + .../NetworkTopologyOperationRequestMapperTest.java | 198 + .../mapper/ServiceTopologyOperationMapperTest.java | 85 + ...VfModuleTopologyOperationRequestMapperTest.java | 221 + .../VnfTopologyOperationRequestMapperTest.java | 129 + .../onap/so/client/sniro/SniroClientTestIT.java | 175 + .../Network/createNetworkRequest.xml | 75 + .../Network/createNetworkResponse.xml | 31 + .../BuildingBlocks/Network/defaultNetwork.json | 10 + .../BuildingBlocks/Network/l3NetworkBbObject.json | 226 + .../Network/payloadUpdateCreated.json | 216 + .../Network/queryAAICloudRegion.json | 596 ++ .../Network/queryAAICloudRegion25.json | 596 ++ .../Network/queryAAICloudRegionError.json | 596 ++ .../Network/queryAAINetworkTestResponse.json | 141 + .../BuildingBlocks/Network/queryAAIResponse.json | 166 + .../Network/queryAAIResponseEmptyUri.json | 53 + .../Network/queryAAIVpnBindingTestResponse.json | 891 +++ .../BuildingBlocks/Network/queryIdAAIResponse.xml | 145 + .../unassignNetworkBB_queryAAIResponse_.json | 162 + .../Network/updateContrailAAIPayloadRequest.xml | 149 + .../BuildingBlocks/NetworkMapper/bbNetwork.json | 87 + .../NetworkMapper/createNetworkRequest.json | 42 + .../BuildingBlocks/NetworkMapper/generalBB.json | 153 + .../NetworkMapper/queryAAINetwork.json | 141 + .../SniroHoming/SniroManagerRequest1Vpn.json | 6 + .../SniroHoming/SniroManagerRequest3Vpn.json | 6 + .../aaiCtagAssingmentsMapped_to_aai.json | 7 + .../__files/BuildingBlocks/aaiL3NetworkMapped.json | 20 + .../BuildingBlocks/aaiL3NetworkMapped_to_aai.json | 118 + .../aaiQueryAAIResponse-Wrapper.json | 166 + .../aaiSegmentationAssignmentsMapped_to_aai.json | 11 + .../BuildingBlocks/aaiSubnetsMapped_to_aai.json | 71 + .../__files/BuildingBlocks/aaiVfModuleMap.json | 12 + .../__files/BuildingBlocks/catalogResp.json | 47 + .../genericResourceApiEcompModelInformation.json | 7 + ...ericResourceApiNetworkOperationInformation.json | 53 + ...piNetworkOperationInformationNoNetworkName.json | 52 + ...urceApiNetworkOperationInformationUnAssign.json | 53 + ...ourceApiVfModuleOperationInformationAssign.json | 69 + ...rceApiVfModuleOperationInformationUnassign.json | 30 + ...ricResourceApiVfModuleSdncVfModuleTopology.json | 241 + ...duleSdncVfModuleTopologyWithCloudResources.json | 243 + .../genericResourceApiVfModuleSdncVnfTopology.json | 68 + ...iVfModuleSdncVnfTopologySubnetDhcpDisabled.json | 68 + ...iVfModuleSdncVnfTopologySubnetMultipleDhcp.json | 88 + ...iVfModuleSdncVnfTopologyWithCloudResources.json | 69 + .../__files/BuildingBlocks/oofCallback2AR1Vnf.json | 113 + .../BuildingBlocks/oofCallback2AR1Vnf2Net.json | 119 + .../BuildingBlocks/oofCallbackInfraVnf.json | 50 + .../BuildingBlocks/oofCallbackNoSolutionFound.json | 18 + .../BuildingBlocks/oofCallbackPolicyException.json | 9 + .../oofCallbackServiceException.json | 12 + .../__files/BuildingBlocks/oofCatalogResp.json | 47 + .../resources/__files/BuildingBlocks/oofRequest | 99 + .../__files/BuildingBlocks/oofRequest_infravnf | 56 + .../BuildingBlocks/queryAAICloudRegion.json | 596 ++ .../BuildingBlocks/queryAaiNetworkPolicy.json | 67 + .../BuildingBlocks/queryAaiNetworkTableRefs.json | 55 + .../__files/BuildingBlocks/queryAaiVpnBinding.json | 106 + .../__files/BuildingBlocks/sniroCallback2AR1Vnf | 107 + .../BuildingBlocks/sniroCallback2AR1Vnf2Net | 165 + .../__files/BuildingBlocks/sniroCallbackInfraVnf | 50 + .../BuildingBlocks/sniroCallbackNoSolutionFound | 15 + .../BuildingBlocks/sniroCallbackPolicyException | 9 + .../BuildingBlocks/sniroCallbackServiceException | 12 + .../__files/BuildingBlocks/sniroRequest_infravnf | 65 + .../vnfAdapterCreateVfModuleRequest.json | 66 + ...nfAdapterCreateVfModuleRequestDhcpDisabled.json | 64 + ...nfAdapterCreateVfModuleRequestMultipleDhcp.json | 66 + ...terCreateVfModuleRequestWithCloudResources.json | 33 + .../vnfAdapterDeleteVfModuleRequest.json | 11 + .../__files/Macro/CreateNetworkCollection.json | 70 + .../Macro/ServiceMacroActivateDeleteUnassign.json | 38 + .../__files/Macro/ServiceMacroAssign.json | 125 + .../resources/__files/SDNCClientGetResponse.json | 27 + .../AddNetworkPolicy_AAIResponse_Success.xml | 21 + .../CreateAAIVfModuleVolumeGroupRequest.xml | 6 + .../VfModularity/DoUpdateVfModuleRequest.xml | 29 + .../resources/__files/VfModularity/GenericVnf.xml | 38 + .../PrepareUpdateAAIVfModuleRequest.xml | 5 + .../QueryNetworkPolicy_AAIResponse_Success.xml | 21 + .../VfModularity/SDNCTopologyActivateCallback.xml | 13 + .../VfModularity/SDNCTopologyAssignCallback.xml | 13 + .../SDNCTopologyChangeAssignCallback.xml | 13 + .../VfModularity/SDNCTopologyQueryCallback.xml | 315 + .../SDNCTopologyQueryCallbackVfModule.xml | 141 + .../VfModularity/StandardSDNCSynchResponse.xml | 5 + .../VfModularity/UpdateAAIGenericVnfRequest.xml | 5 + .../VfModularity/UpdateAAIVfModuleRequest.xml | 10 + .../__files/VfModularity/UpdateVfModuleRequest.xml | 35 + .../VfModularity/VNFAdapterRestCreateCallback.xml | 55 + .../VfModularity/VNFAdapterRestUpdateCallback.xml | 16 + .../VNFAdapterRestVolumeGroupCallback.xml | 15 + .../__files/VfModularity/VfModule-lukewarm.xml | 10 + .../__files/VfModularity/VfModule-new.xml | 9 + .../__files/VfModularity/VfModule-supercool.xml | 27 + .../resources/__files/VfModularity/VolumeGroup.xml | 25 + .../src/test/resources/application-test.yaml | 214 + bpmn/so-bpmn-tasks/src/test/resources/schema.sql | 1188 ++++ 2827 files changed, 283713 insertions(+), 221828 deletions(-) delete mode 100644 bpmn/MSOCockpit/pom.xml delete mode 100644 bpmn/MSOCockpit/src/main/assembly/cockpit-build.xml delete mode 100644 bpmn/MSOCockpit/src/main/resources/WEB-INF/applicationContext.xml delete mode 100644 bpmn/MSOCockpit/src/main/resources/WEB-INF/jboss-deployment-structure.xml delete mode 100644 bpmn/MSOCockpit/src/main/resources/WEB-INF/web.xml create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetService.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutService.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetService.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnf.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericUtils.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RainyDayHandler.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ServiceTaskProcessor.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModule.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AllottedResourceUtils.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AppCClient.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DecomposeService.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericNotificationService.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutService.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericUtils.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ManualHandling.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/RainyDayHandler.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ReceiveWorkflowMessage.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV1.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV2.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy delete mode 100755 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SniroHoming.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtil.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModule.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtils.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigModifyAction.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/HealthCheckAction.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/QuiesceTrafficAction.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigModify.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ResumeTrafficAction.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/SnapshotAction.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/StartStopAction.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/UpgradeAction.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/ActionPreProcessor.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGenerator.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectExecution.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/SpringContextHelper.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MalformedBuildingBlockInputException.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MissingBuildingBlockInputException.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/RequiredExecutionVariableExeception.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnIntegerParam.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnParam.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowCallbackResponse.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContext.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowResponse.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AllottedResource.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CloudRegion.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Collection.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Customer.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Entitlement.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Evc.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ForwarderEvc.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/HostRoute.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv4AddressList.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv6AddressList.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Metadatum.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/NetworkPolicy.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/OwningEntity.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Project.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTableReference.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTarget.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SegmentationAssignment.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceProxy.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SriovVf.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBinding.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputException.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoAllottedResource.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoMetadata.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoNetwork.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVfModule.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerCallback.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClientV2.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestrator.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestratorException.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBean.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AsyncRequestStatus.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/InstanceReferences.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/RequestStatus.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DefaultDmaapPropertiesImpl.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesMap.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BBObjectNotFoundException.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/OrchestrationStatusValidationException.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AaiPropertiesConfiguration.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/PolicyRestPropertiesImpl.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/UrnPropertiesReaderWrapper.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/PayloadClient.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigModifyAction.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/HealthCheckAction.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/QuiesceTrafficAction.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersConfigModify.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersHealthCheck.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ResumeTrafficAction.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/SnapshotAction.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/StartStopAction.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/UpgradeAction.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/CallbackHeader.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/package-info.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotification.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactory.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotification.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotification.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollback.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/package-info.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnIntegerParam.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnParam.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/ProcessEngineAwareService.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClient.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientImpl.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterRestProperties.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapter.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbException.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBean.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/RequestStatusType.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/ResponseStatus.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/Status.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequest.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestProperties.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClient.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientImpl.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterRestProperties.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerCallback.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestrator.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorException.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaaproperties/DefaultDmaapPropertiesImpl.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/AAIOrchestrator.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/SDNCOrchestrator.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/PolicyRestPropertiesImpl.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCRequest.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcAction.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcOperation.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/SDNCRequestMapper.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/ServiceTopologyOperationRequestMapper.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/CallbackHeader.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Constants.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/ObjectFactory.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestHeader.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestTunables.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequest.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortType.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortTypeImpl.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequest.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterResponse.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterPortType.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterService.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCRequestIdUtil.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCResponse.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCSyncRpcClient.java delete mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Utils.java create mode 100644 bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties create mode 100644 bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.dmaap.DmaapProperties delete mode 100644 bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties delete mode 100644 bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.openecomp.mso.client.dmaap.DmaapProperties delete mode 100644 bpmn/MSOCommonBPMN/src/main/resources/logback.xml create mode 100644 bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/HomingV2.bpmn create mode 100644 bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Orchestration.bpmn delete mode 100644 bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn delete mode 100644 bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn delete mode 100644 bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn delete mode 100644 bpmn/MSOCommonBPMN/src/main/resources/urn.properties delete mode 100644 bpmn/MSOCommonBPMN/src/main/resources/xjb/AAI.xjb delete mode 100644 bpmn/MSOCommonBPMN/src/main/resources/xsd/MSOWorkflowSchemaV1.xsd delete mode 100644 bpmn/MSOCommonBPMN/src/main/resources/xsd/ManualTasks.xsd delete mode 100644 bpmn/MSOCommonBPMN/src/main/resources/xsd/MsoServiceRequestTypesV1.xsd delete mode 100644 bpmn/MSOCommonBPMN/src/main/resources/xsd/aai_schema_v10.xsd delete mode 100644 bpmn/MSOCommonBPMN/src/main/resources/xsd/aai_schema_v11.xsd delete mode 100644 bpmn/MSOCommonBPMN/src/main/resources/xsd/test.xsd create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AaiUtilTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessorTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetServiceTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutServiceTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtilTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/FalloutHandlerTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleNameTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetServiceTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnfTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericPutServiceTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/NetworkUtilsTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1Test.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2Test.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtilTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VidUtilsTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/IgnoreNamedElementsDifferenceListener.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/XmlComparator.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcessTest.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutServiceTest.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoGroovyTest.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtilsTest.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtilsTest.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtilTest.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtilsTest.groovy delete mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1Test.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllBaseTaskTestSuite.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllGroovyTestSuites.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllTestSuites.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseUnitTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/SerializableChecker.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplicationConfig.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/BeansTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGeneratorTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DelegateExecutionImplTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/BpmnParamTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceInputTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequestTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/util/CryptoHandlerTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/FileUtil.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAPPC.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseDatabase.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseNetworkAdapter.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseOof.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponsePolicy.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSNIRO.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBDecompPojoTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBPojoTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/SerializationTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputExceptionTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerClientV2Test.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerSupportTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBeansTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/AAIPropertiesImplTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/PolicyRestPropertiesImplTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/RestPropertiesPojoTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/appc/payload/PayloadClientTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/AppCClientTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BeansTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DecomposeServiceTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenerateVfModuleNameTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ManualHandlingTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/RainyDayHandlerTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ReceiveWorkflowMessageTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterRestV2Test.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SPIPropertiesTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SniroHomingTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTestTransformer.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotificationTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotificationTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequestTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactoryTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotificationTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotificationTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotificationTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollbackTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/BpmnParamTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClientTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceInputTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequestTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilderTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/util/CryptoHandlerTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterAsyncTransformer.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAPPC.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseOof.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterAsyncTransformer.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/ResponseExceptionMapperImplTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/RequestsDbAdapterClientTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBeanTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequestTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerSupportTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/policy/CommonObjectMapperProviderTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/beans/SDNCRequestTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java delete mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sndc/SDNCOrchTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/catalogResp.json delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/Client/CatalogServiceExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/Client/InfraActiveRequestExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogDBService_getServiceInstanceNOAAIInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogServiceExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogServiceInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ConfigurationExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ConfigurationInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Customer.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Customer_AAI.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ExecuteBuildingBlockSimple.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjectsExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjectsInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjects_getServiceInstanceNOAAIInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InfraActiveRequestExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroup.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroupExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroupInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/LineOfBusiness.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/LineOfBusinessExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoGenericVnfExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoInstanceGroup.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoNetworkExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoVfModuleExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/NetworkPolicy.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/NetworkResourceCustomizationInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/OwningEntity.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Platform.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PlatformExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Project.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withRelatedInstanceList.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withoutRelatedInstanceList.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetails_CreateVnf.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestLineOfBusinessInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestPlatformInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RouteTableReferenceExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RouteTableReferenceInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/SerializationTest.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIPlatformAndLOBInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_aaiPlatformAndLOBToSI.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_aaiServiceInstanceToSI.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_catalogServiceToSI.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_getServiceInstanceNOAAIExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_highLevelObjectsToSI.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceSubscriptionExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceSubscription_AAI.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VfModuleCustomizationInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfResourceCustomizationInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfcInstanceGroupCustomization.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup_AAI.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiGenericVnfInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiVolumeGroupInput.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpected.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/Schemas/CreateServiceInstanceV3Schema.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/SetupServiceDecompJson.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/catalogDbFiles/DoCreateServiceInstance_request.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/invalidErrorMessage.txt create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/invalidErrorMessageFlag.txt create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/requestDetails.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/schema.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfadapter_request.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/camunda.cfg.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/logging.properties delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.properties delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/mso.properties delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/mso.sdnc.properties create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/avpn/dmaap/avpnDmaapAsyncRequestStatus.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/ruby/create-ticket/create-ticket-request.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/output-failure.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/output-success.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/response.json delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/ruby/create-ticket/create-ticket-request.json delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-post-check-request.json delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-pre-check-request.json delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-post-check-request.json delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-pre-check-request.json delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/output-failure.json delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/output-success.json delete mode 100644 bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/response.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/response/clientServiceResponse.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/response/infraActiveRequestsResponse.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/schema.sql create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_with_aic_version.xml create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BadInjectedFieldException.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/MissingInjectedFieldException.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/RollbackData.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CloudFlavor.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CompareModelsResult.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ConfigResource.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Configuration.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Customer.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/InventoryType.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/License.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ModelInfo.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ModuleResource.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/OwningEntity.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Project.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Request.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Resource.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceDecomposition.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceInstance.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceModelInfo.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Subscriber.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Vnf.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/internal/VariableNameExtractor.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/DecomposeJsonUtil.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonDecomposingException.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BPMNLogger.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BadInjectedFieldException.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BaseTask.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldException.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ResponseBuilder.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/RollbackData.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/WorkflowException.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/AllottedResource.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CloudFlavor.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResult.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ConfigResource.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Configuration.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Customer.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/InventoryType.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/License.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModelInfo.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModuleResource.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/NetworkResource.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/OwningEntity.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Project.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Request.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Resource.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceDecomposition.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceInstance.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceModelInfo.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceType.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceInstance.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Subscriber.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/TunnelConnect.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractor.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonDecomposingException.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/CustomMyBatisSessionFactory.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/URNMapping.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/WorkflowExceptionPlugin.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/resources/customMyBatisConfiguration.xml delete mode 100644 bpmn/MSOCoreBPMN/src/main/resources/urnMapping.xml create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BadInjectedFiledExceptionTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BeansTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/MissingInjectedFiledExceptionTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/ResponseBuilderTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/RollbackDataTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/UrnPropertiesReaderTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/WorkflowExceptionTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/AllottedResourceTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/CompareModelsResultTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ConfigResourceTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ConfigurationTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/CustomerTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/DomainPojoTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/HomingSolutionTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/LicenseTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ModelInfoTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ModuleResourceTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/NetworkResourceTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/OwningEntityTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ProjectTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/RequestTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ResourceDecompositionTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ResourceTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceInstanceTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/SubscriberTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/internal/VariableNameExtractorTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/DecomposeJsonUtilTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonDecomposingExceptionTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtils2Test.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/utils/CamundaDBSetup.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/xml/XmlToolTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/HealthCheckHandlerTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/AllottedResourceTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResultTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigResourceTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigurationTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CustomerTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/HomingSolutionTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/LicenseTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModelInfoTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModuleResourceTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/NetworkResourceTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/OwningEntityTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ProjectTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/RequestTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceDecompositionTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceDecompositionTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceInstanceTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/SubscriberTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/TunnelConnectTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/VnfResourceTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java create mode 100644 bpmn/MSOCoreBPMN/src/test/resources/application-dev.yaml delete mode 100644 bpmn/MSOCoreBPMN/src/test/resources/camunda.cfg.xml create mode 100644 bpmn/MSOCoreBPMN/src/test/resources/json-examples/AllottedResource.json create mode 100644 bpmn/MSOCoreBPMN/src/test/resources/json-examples/ConfigResource.json create mode 100644 bpmn/MSOCoreBPMN/src/test/resources/json-examples/NetworkResource.json create mode 100644 bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecomposition.json create mode 100644 bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecompositionExpected.json create mode 100644 bpmn/MSOCoreBPMN/src/test/resources/json-examples/VnfResource.json delete mode 100644 bpmn/MSOCoreBPMN/src/test/resources/mso.bpmn.properties delete mode 100644 bpmn/MSOCoreBPMN/src/test/resources/mso.bpmn.urn.properties delete mode 100644 bpmn/MSOInfrastructureBPMN/WebContent/META-INF/MANIFEST.MF delete mode 100644 bpmn/MSOInfrastructureBPMN/pom.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVnfInfra.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollbackV2.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceV2.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResources.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnf.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/HealchCheckActivate.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/RollbackVnf.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModule.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfCmBase.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateProject.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateServiceInstance.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackAAIServiceInstance.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackError.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/SetupServiceDecomp.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/SDNCTasks/SDNCCreateServiceInstance.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAICreateResources.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstance.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/DmaapClient.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiConnection.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/LocationConstraint.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsOperationKey.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsParameters.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsScaleParameters.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsData.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleResource.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/VimLocation.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/ServicePluginFactory.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplication.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputPaarametersEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/persistence.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/processes.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/dmaap.properties delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/logback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CompareModelofE2EServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateActivateSDNCResource.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustom3rdONAPServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateNetworkInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateSDNCNetworkResource.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVFCNSResource.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleVolumeInfraV1.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVnfInfra.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustom3rdONAPServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteGenericALaCarteServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteNetworkInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVFCNSResource.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleInfra.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVnfInfra.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/ReplaceVnfInfra.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/TestHelloWorld.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateNetworkInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleInfra.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleInfraV2.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVnfInfra.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/VnfConfigUpdate.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/VnfInPlaceUpdate.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/CreateServiceInstanceV3.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/CreateServiceInstanceV3Rollback.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DeActivateNetworkResource.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCompareModelVersions.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRGRollback.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXCRollback.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2ENetworkInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstanceRollback.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateNetworkInstanceRollback.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateResources.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollback.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollbackV2.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceV2.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModule.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnf.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModulesRollback.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteAllottedResourceBRG.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteAllottedResourceTXC.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteNetworkInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteNetworkInstanceRollback.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResources.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVFCNetworkServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModule.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVnf.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVnfAndModules.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUnderlayVpnOperation.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstanceRollback.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateNetworkInstance.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateNetworkInstanceRollback.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateVfModule.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateVnfAndModules.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/RollbackVnf.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/SetRefactorServiceDecomp.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/urn.properties delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/jboss-web.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/web.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericAlaCarteServiceInstanceTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstanceTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericAlaCarteServiceInstanceTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstanceTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollbackTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstanceTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/GroovyTestBase.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapGetter.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapSetter.groovy delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntityTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/BeansTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceV2Test.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceV3Test.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/RollbackVnfTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/SetupServiceDecompTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfConfigUpdateTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfInPlaceUpdateTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstanceTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplicationTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/Homing.bpmn delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_genericVnfGet.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_pserverByVnfId.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/mockObject.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/APPC/appc_error.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_400.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_500.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryInstance_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName2_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNameActive_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_404.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_404.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBindingList_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/DoCreateServiceInstanceInput.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/SetupServiceDecompJson.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_createServiceInstance_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeRequest.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/GenericVnf.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/getSIUrlById.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModule_VID_request.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModule_VID_request_noPreloads.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModule_VID_request_userParam.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DBUpdateResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Database/DBAdapter.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteAAIResponse_Failure500_RESTFault.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse_noExtraTag.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleCallbackResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnf.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnfVfModule.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/GenericVnf.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_VID_request.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModule_getVnfResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/MsoCompletionRequest.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/SDNCDeleteResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/aaiGetResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getARUrlById.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getNotFound.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getParentSIUrlById.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getParentServiceInstance.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getSINoRelations.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getSIUrlByIdVipr.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/ConfigVnf_VID_request.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/CreateVnfInfraRequest.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DeleteCustomE2EService.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DoCreateServiceInstance_request.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/ReplaceVnf_VID_request.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/UpdateVfModule_VID_request.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/UpdateVnf_VID_request.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Policy/policyAbortResponse.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Policy/policySkipResponse.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogServiceResourcesData.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogVnfData.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogVnfNoTwoPhasedForVfModule.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogVnfYesTwoPhasedForVfModule.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/serviceDecompositionATMFW.json delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/DBUpdateResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/GenerateVfModuleName_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCSITopologyAssignCallback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-new-PendingActivation.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/deleteNetworkResponse_Success.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/camunda.cfg.xml delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/log4j.properties delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/logging.properties delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.properties delete mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties create mode 100644 bpmn/MSORESTClient/src/main/java/org/onap/so/rest/APIResponse.java create mode 100644 bpmn/MSORESTClient/src/main/java/org/onap/so/rest/HostNameVerifier.java create mode 100644 bpmn/MSORESTClient/src/main/java/org/onap/so/rest/HttpHeader.java create mode 100644 bpmn/MSORESTClient/src/main/java/org/onap/so/rest/RESTClient.java create mode 100644 bpmn/MSORESTClient/src/main/java/org/onap/so/rest/RESTConfig.java create mode 100644 bpmn/MSORESTClient/src/main/java/org/onap/so/rest/RESTException.java delete mode 100644 bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java delete mode 100644 bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HostNameVerifier.java delete mode 100644 bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HttpHeader.java delete mode 100644 bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java delete mode 100644 bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTConfig.java delete mode 100644 bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTException.java create mode 100644 bpmn/MSORESTClient/src/test/java/org/onap/so/rest/APIResponseTest.java create mode 100644 bpmn/MSORESTClient/src/test/java/org/onap/so/rest/HttpHeaderTest.java create mode 100644 bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java create mode 100644 bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTConfigTest.java create mode 100644 bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTExceptionTest.java delete mode 100644 bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseTest.java delete mode 100644 bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderTest.java delete mode 100644 bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientTest.java delete mode 100644 bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigTest.java delete mode 100644 bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionTest.java delete mode 100644 bpmn/MSOURN-plugin/build.properties delete mode 100644 bpmn/MSOURN-plugin/build.xml delete mode 100644 bpmn/MSOURN-plugin/pom.xml delete mode 100644 bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPlugin.java delete mode 100644 bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java delete mode 100644 bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisQueryCommandExecutor.java delete mode 100644 bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNData.java delete mode 100644 bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNService.java delete mode 100644 bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResource.java delete mode 100644 bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResource.java delete mode 100644 bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java delete mode 100644 bpmn/MSOURN-plugin/src/main/resources/META-INF/services/org.camunda.bpm.cockpit.plugin.spi.CockpitPlugin delete mode 100644 bpmn/MSOURN-plugin/src/main/resources/mappings.xml delete mode 100644 bpmn/MSOURN-plugin/src/main/resources/org/openecomp/camunda/bpm/plugin/urnmap/queries/urnMap.xml delete mode 100644 bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/app/dashboard.html delete mode 100644 bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/app/plugin.js delete mode 100644 bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/info.txt create mode 100644 bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterface.json create mode 100644 bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterfaces.json create mode 100644 bpmn/mso-infrastructure-bpmn/pom.xml create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/package-info.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/resources/META-INF/processes.xml create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateActivateSDNCResource.bpmn create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateCustom3rdONAPServiceInstance.bpmn create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/resources/process/DeleteCustom3rdONAPServiceInstance.bpmn create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn create mode 100644 bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/DeActivateNetworkResource.bpmn create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetServiceIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetVnfIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/GenericVnf.xml create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/oofCallbackInfraVnf.json create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestRollback.json create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml create mode 100644 bpmn/so-bpmn-building-blocks/pom.xml create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/META-INF/processes.xml create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/META-INF/services/org.onap.so.client.RestProperties create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/META-INF/services/org.onap.so.client.dmaap.DmaapProperties create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAICheckVnfInMaintBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAISetVnfInMaintBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAIUnsetVnfInMaintBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkCollectionBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateServiceInstanceBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVnfBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVolumeGroupBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetwork1802BB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignServiceInstanceBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVolumeGroupBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelServiceInstanceBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVfModuleBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVnfBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateCustomerBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkCollectionBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateNetworkBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateServiceInstanceBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVfModuleBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVnfBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVolumeGroupBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkCollectionBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/SDNOVnfHealthCheckBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetwork1802BB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignServiceInstanceBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVfModuleBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVnfBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVolumeGroupBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/AllBaseTaskTestSuite.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/AllTestSuites.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseUnitTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/IntegrationTestSuite.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/SerializableChecker.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2BBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2Test.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkCollectionBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateServiceInstanceBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVnfBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVolumeGroupBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetwork1802BBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetworkBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignServiceInstanceBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVfModuleBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVolumeGroupBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelServiceInstanceBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVfModuleBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVnfBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateCustomerBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkCollectionBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateNetworkBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVfModuleBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVnfBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVolumeGroupBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkCollectionBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ExecuteBuildingBlockTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignServiceInstanceBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVfModuleBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVnfBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVolumeGroupBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java create mode 100644 bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml create mode 100644 bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/.gitignore create mode 100644 bpmn/so-bpmn-infrastructure-common/.maven-dockerignore create mode 100644 bpmn/so-bpmn-infrastructure-common/pom.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiResponse.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/LocationConstraint.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsScaleParameters.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleNsData.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleResource.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputParametersEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/resources/dmaap.properties create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllBPMNTestSuites.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTasksTestsTestSuite.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/BeansTest.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstanceTest.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGeneratorTest.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/vfcmodel/VfcModelPojoTest.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilderTest.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilderTest.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ClientEntityPojoTest.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/CreateSiSample.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/Homing.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_genericVnfGet.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_pserverByVnfId.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_vfModuleByVfModuleId.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/mockObject.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/APPC/appc_error.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_400.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_500.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryInstance_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName2_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNameActive_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_404.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_404.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBindingList_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/DoCreateServiceInstanceInput.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/SetupServiceDecompJson.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/createServiceInstance_createServiceInstance_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/GenericVnf.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/getSIUrlById.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModule_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModule_VID_request_noPreloads.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModule_VID_request_userParam.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DBUpdateResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Database/DBAdapter.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Database/DBUpdateResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteAAIResponse_Failure500_RESTFault.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse_noExtraTag.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleCallbackResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModule_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/DoCreateVfModuleRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/getGenericVnfResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnf.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnfVfModule.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/deactivateSDNCRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/sdncAdapterWorkflowRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/vnfAdapterRestV1Request.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/GenericVnf.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule_getVnfResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoDeleteVfModule/getGenericVnfResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoDeleteVfModule/sdncAdapterWorkflowRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/getGenericVnfResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncActivateRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncChangeAssignRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncTopologyRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/vnfAdapterRestRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/MsoCompletionRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/SDNCDeleteResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/aaiGetResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getARUrlById.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getNotFound.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getParentSIUrlById.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getParentServiceInstance.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getSINoRelations.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getSIUrlById.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getSIUrlByIdVipr.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getServiceInstance.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/ConfigVnf_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/CreateVnfInfraRequest.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/DeleteCustomE2EService.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/DoCreateServiceInstance_request.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/ReplaceVnf_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/UpdateVfModule_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/UpdateVnf_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/CreateNetworkCollection.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/ServiceMacroAssign.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Policy/policyAbortResponse.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Policy/policySkipResponse.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Schemas/ActivateServiceInstance.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Schemas/ActivateVnfSchema.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Schemas/AssignServiceInstanceSchema.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Schemas/AssignVnfSchema.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/sdncUpdateNetworkTopologySimResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVolumeGroupRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogServiceResourcesData.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogVnfData.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogVnfNoTwoPhasedForVfModule.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogVnfYesTwoPhasedForVfModule.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/serviceDecompositionATMFW.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/DBUpdateResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/GenerateVfModuleName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/GenericVnf.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCSITopologyAssignCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-new-PendingActivation.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-new.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-supercool.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VolumeGroup.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/deleteNetworkResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/requestDetails.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/schema.json create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/application-test.yml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/applicationContext_forPnfTesting.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/catalogDBClientProps.properties create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/logback-test.xml create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/requestsDBClientProps.properties create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/resources/stubprocess/GenericStub.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/pom.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollbackV2.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceV2.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResources.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/META-INF/processes.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CompareModelofE2EServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateNetworkInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVFCNSResource.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVfModuleInfra.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVfModuleVolumeInfraV1.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVnfInfra.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteGenericALaCarteServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteNetworkInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVFCNSResource.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVcpeResCustService.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleInfra.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVnfInfra.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ReplaceVnfInfra.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateNetworkInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleInfra.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleInfraV2.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVnfInfra.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/VnfConfigUpdate.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/VnfInPlaceUpdate.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCompareModelVersions.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceBRGRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceTXCRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2ENetworkInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstanceRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceRollbackV2.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceV2.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVFCNetworkServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModulesRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteAllottedResourceBRG.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteAllottedResourceTXC.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteNetworkInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteNetworkInstanceRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteResources.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVFCNetworkServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVnf.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVnfAndModules.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUnderlayVpnOperation.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstanceRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateNetworkInstance.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateNetworkInstanceRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVnfAndModules.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/RollbackVnf.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/SetRefactorServiceDecomp.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericAlaCarteServiceInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfraTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericAlaCarteServiceInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollbackTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstanceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapGetter.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapSetter.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/CreateSiSample.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/Homing.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_genericVnfGet.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_pserverByVnfId.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_vfModuleByVfModuleId.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/mockObject.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/APPC/appc_error.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_400.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_500.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryInstance_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName2_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNameActive_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_404.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_404.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBindingList_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/DoCreateServiceInstanceInput.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/SetupServiceDecompJson.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/createServiceInstance_createServiceInstance_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/GenericVnf.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/getSIUrlById.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModule_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModule_VID_request_noPreloads.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModule_VID_request_userParam.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DBUpdateResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Database/DBAdapter.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Database/DBUpdateResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/deleteAAIResponse_Failure500_RESTFault.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse_noExtraTag.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleCallbackResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModule_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/DoCreateVfModuleRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/getGenericVnfResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnf.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnfVfModule.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/deactivateSDNCRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/sdncAdapterWorkflowRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/vnfAdapterRestV1Request.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/GenericVnf.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule_getVnfResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoDeleteVfModule/getGenericVnfResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoDeleteVfModule/sdncAdapterWorkflowRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/getGenericVnfResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncActivateRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncChangeAssignRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncTopologyRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/vnfAdapterRestRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/MsoCompletionRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/SDNCDeleteResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/aaiGetResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getARUrlById.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getNotFound.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getParentSIUrlById.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getParentServiceInstance.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getSINoRelations.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getSIUrlById.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getSIUrlByIdVipr.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getServiceInstance.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/ConfigVnf_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/CreateVnfInfraRequest.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/DeleteCustomE2EService.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/DoCreateServiceInstance_request.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/ReplaceVnf_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/UpdateVfModule_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/UpdateVnf_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/CreateNetworkCollection.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/ServiceMacroAssign.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Policy/policyAbortResponse.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Policy/policySkipResponse.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Schemas/ActivateServiceInstance.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Schemas/ActivateVnfSchema.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Schemas/AssignServiceInstanceSchema.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Schemas/AssignVnfSchema.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/sdncUpdateNetworkTopologySimResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVolumeGroupRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogServiceResourcesData.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogVnfData.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogVnfNoTwoPhasedForVfModule.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogVnfYesTwoPhasedForVfModule.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/serviceDecompositionATMFW.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/DBUpdateResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/GenerateVfModuleName_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/GenericVnf.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCSITopologyAssignCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteRequest.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteResponse.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-new-PendingActivation.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-new.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-supercool.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VolumeGroup.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/deleteNetworkResponse_Success.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/requestDetails.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/schema.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/applicationContext_forPnfTesting.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/catalogDBClientProps.properties create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/logback-test.xml create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/requestsDBClientProps.properties create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/stubprocess/GenericStub.bpmn create mode 100644 bpmn/so-bpmn-tasks/pom.xml create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SourceSystem.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeleteTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientException.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterRestProperties.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClient.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientException.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterRestProperties.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClient.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestProperties.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperUtils.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNOHealthCheckResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/FileUtil.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtilsTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtilsTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestPropertiesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NetworkAdapterResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNOHealthCheckResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/policy/CommonObjectMapperProviderTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/bbNetwork.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/queryAAINetwork.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiCtagAssingmentsMapped_to_aai.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped_to_aai.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiQueryAAIResponse-Wrapper.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSegmentationAssignmentsMapped_to_aai.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSubnetsMapped_to_aai.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleMap.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/catalogResp.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAAICloudRegion.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPolicy.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkTableRefs.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiVpnBinding.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequest.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestDhcpDisabled.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestMultipleDhcp.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestWithCloudResources.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterDeleteVfModuleRequest.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientGetResponse.json create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/GenericVnf.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-new.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-supercool.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VolumeGroup.xml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml create mode 100644 bpmn/so-bpmn-tasks/src/test/resources/schema.sql (limited to 'bpmn') diff --git a/bpmn/MSOCockpit/pom.xml b/bpmn/MSOCockpit/pom.xml deleted file mode 100644 index 0ff03cf08f..0000000000 --- a/bpmn/MSOCockpit/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - org.onap.so - bpmn - 1.2.0-SNAPSHOT - - - 4.0.0 - MSOCockpit - pom - MSOCockpit - Builds the Camunda cockpit webapp for MSO - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - - - src/main/assembly/cockpit-build.xml - - false - - cockpit-build - package - - single - - - - - - - - - - - org.camunda.bpm.webapp - ${camunda.bpm.webapp.artifact} - ${camunda.version} - war - - - - org.onap.so - common - ${project.version} - - - org.onap.so - MSOCoreBPMN - ${project.version} - - - - diff --git a/bpmn/MSOCockpit/src/main/assembly/cockpit-build.xml b/bpmn/MSOCockpit/src/main/assembly/cockpit-build.xml deleted file mode 100644 index 3bc0ace298..0000000000 --- a/bpmn/MSOCockpit/src/main/assembly/cockpit-build.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - cockpit-build - - - war - - - false - - - - / - - org.camunda.bpm.webapp:${camunda.bpm.webapp.artifact} - - true - - - WEB-INF/applicationContext.xml - WEB-INF/web.xml - WEB-INF/jboss-deployment-structure.xml - - - runtime - false - - - - - - /WEB-INF/lib - - - - org.openecomp.mso:logger - ch.qos.logback:logback-core - ch.qos.logback:logback-classic - com.att.eelf:eelf-core - - - org.openecomp.mso:MSOCoreBPMN - - false - runtime - false - - - - - - - - src/main/resources/WEB-INF/applicationContext.xml - /WEB-INF - - - src/main/resources/WEB-INF/web.xml - /WEB-INF - - - src/main/resources/WEB-INF/jboss-deployment-structure.xml - /WEB-INF - - - diff --git a/bpmn/MSOCockpit/src/main/resources/WEB-INF/applicationContext.xml b/bpmn/MSOCockpit/src/main/resources/WEB-INF/applicationContext.xml deleted file mode 100644 index dff4c3d810..0000000000 --- a/bpmn/MSOCockpit/src/main/resources/WEB-INF/applicationContext.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOCockpit/src/main/resources/WEB-INF/jboss-deployment-structure.xml b/bpmn/MSOCockpit/src/main/resources/WEB-INF/jboss-deployment-structure.xml deleted file mode 100644 index d183019cb2..0000000000 --- a/bpmn/MSOCockpit/src/main/resources/WEB-INF/jboss-deployment-structure.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOCockpit/src/main/resources/WEB-INF/web.xml b/bpmn/MSOCockpit/src/main/resources/WEB-INF/web.xml deleted file mode 100644 index e9a9498508..0000000000 --- a/bpmn/MSOCockpit/src/main/resources/WEB-INF/web.xml +++ /dev/null @@ -1,173 +0,0 @@ - - - - - camunda bpm webapp - - - contextConfigLocation - /WEB-INF/applicationContext.xml - - - - - log.configuration - logback.bpmn.xml - - - - org.springframework.web.context.ContextLoaderListener - - - - - org.camunda.bpm.cockpit.impl.web.bootstrap.CockpitContainerBootstrap - - - - - org.camunda.bpm.admin.impl.web.bootstrap.AdminContainerBootstrap - - - - - org.camunda.bpm.tasklist.impl.web.bootstrap.TasklistContainerBootstrap - - - - - Authentication Filter - org.camunda.bpm.webapp.impl.security.auth.AuthenticationFilter - - - Authentication Filter - /* - REQUEST - - - - - SecurityFilter - org.camunda.bpm.webapp.impl.security.filter.SecurityFilter - - configFile - /WEB-INF/securityFilterRules.json - - - - SecurityFilter - /* - REQUEST - - - - - Engines Filter - org.camunda.bpm.webapp.impl.engine.ProcessEnginesFilter - - - Engines Filter - /app/* - REQUEST - - - - - CacheControlFilter - org.camunda.bpm.engine.rest.filter.CacheControlFilter - - - CacheControlFilter - /api/* - - - - - Cockpit Api - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - javax.ws.rs.Application - org.camunda.bpm.cockpit.impl.web.CockpitApplication - - - resteasy.servlet.mapping.prefix - /api/cockpit - - - - Cockpit Api - /api/cockpit/* - - - - - Admin Api - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - javax.ws.rs.Application - org.camunda.bpm.admin.impl.web.AdminApplication - - - resteasy.servlet.mapping.prefix - /api/admin - - - - Admin Api - /api/admin/* - - - - - Tasklist Api - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - javax.ws.rs.Application - org.camunda.bpm.tasklist.impl.web.TasklistApplication - - - resteasy.servlet.mapping.prefix - /api/tasklist - - - - Tasklist Api - /api/tasklist/* - - - - - Engine Api - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - javax.ws.rs.Application - org.camunda.bpm.webapp.impl.engine.EngineRestApplication - - - resteasy.servlet.mapping.prefix - /api/engine - - - - Engine Api - /api/engine/* - - diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 1d255c4eb4..a7ba9306c1 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -6,7 +6,7 @@ org.onap.so bpmn - 1.2.0-SNAPSHOT + 1.3.0-SNAPSHOT MSOCommonBPMN MSOCommonBPMN @@ -14,7 +14,7 @@ 7.8.0 - 4.3.2.RELEASE + 4.5.5 2.0.1 1.1.1 @@ -121,92 +121,32 @@ - org.codehaus.mojo - jaxb2-maven-plugin - 2.3 + org.apache.maven.plugins + maven-surefire-plugin - xjc + default-test - xjc + test + + + **/AllTestSuites.java + + - - - true - - -Xannotate - -Xcommons-lang - - - src/main/resources/xsd - - - src/main/resources/xjb - - ${project.build.directory}/generated-sources - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - 0.6.4 - - - org.jvnet.jaxb2_commons - jaxb2-commons-lang - 2.3 - - - com.sun.codemodel - codemodel - 2.6 - - - - - org.codehaus.mojo - jaxb2-maven-plugin - 2.3 - - xjc + groovy-tests - xjc + test + + + **/AllGroovyTestSuites.java + + - - true - - -Xannotate - -Xcommons-lang - - - src/main/resources/xsd - - - src/main/resources/xjb - - ${project.build.directory}/generated-sources - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - 0.6.4 - - - org.jvnet.jaxb2_commons - jaxb2-commons-lang - 2.3 - - - com.sun.codemodel - codemodel - 2.6 - - @@ -243,48 +183,43 @@ - - - + + + + org.camunda.bpm + camunda-bom + ${camunda.version} + import + pom + + + - - org.camunda.bpm - camunda-engine + commons-beanutils + commons-beanutils org.camunda.bpm - camunda-engine-cdi - - - - org.camunda.bpm.extension - camunda-bpm-assert - test + camunda-engine - org.camunda.spin - camunda-spin-dataformat-all + org.camunda.bpm.springboot + camunda-bpm-spring-boot-starter + 2.3.0-alpha2 - org.camunda.bpm - camunda-engine-plugin-spin + org.springframework.boot + spring-boot-starter-actuator - - org.camunda.bpm - camunda-engine-plugin-connect + org.springframework.boot + spring-boot-starter-web - - - org.webjars - bootstrap - 2.3.2 - @@ -301,33 +236,25 @@ org.codehaus.groovy groovy-all - - org.apache.commons - commons-lang3 - 3.4 - org.onap.so MSOCoreBPMN ${project.version} - org.onap.so - MSOCoreBPMN + mso-catalog-db ${project.version} - tests - test org.onap.so - common + mso-requests-db ${project.version} - javax.ws.rs - javax.ws.rs-api - 2.0 + org.onap.so + common + ${project.version} org.onap.so @@ -342,147 +269,103 @@ javax.servlet javax.servlet-api - 3.0.1 - - - - org.springframework - spring-test - 4.3.14.RELEASE - - - org.onap.sdc.sdc-tosca - sdc-tosca - 1.3.0 - - - org.camunda.bpm - camunda-engine-spring - - - org.springframework - spring-beans - 4.3.2.RELEASE - - - - org.aspectj - aspectjrt - 1.6.12 org.apache.httpcomponents - httpclient - ${httpclient.version} + httpclient commons-lang commons-lang 2.6 - - com.openpojo - openpojo - 0.8.6 - com.jayway.jsonpath json-path - 2.2.0 - - - org.springframework - spring-web - ${spring.version} - - - - - com.googlecode.libphonenumber - libphonenumber - 8.9.1 javax.ws.rs javax.ws.rs-api ${jax.ws.rs} + org.onap.appc.client client-lib 1.3.0 - org.onap.appc.client - client-kit - 1.3.0 + org.onap.appc.client + client-kit + 1.3.0 + org.aspectj aspectjrt - 1.6.12 + - com.att.nsa - saClientLibrary - - 1.3.0-oss + com.fasterxml.jackson.jaxrs + jackson-jaxrs-base - - org.camunda.bpm.workbench - camunda-workbench-dist-embeddable - 1.0.0-alpha8 - test + org.json + json - - org.json - json - 20160810 - - org.assertj - assertj-core - 3.9.0 - test + org.glassfish.jersey.core + jersey-client - pl.pragmatists - JUnitParams - 1.1.1 + org.glassfish.jersey.media + jersey-media-json-jackson - org.assertj - assertj-core - 3.9.0 + org.onap.sdc.sdc-tosca + sdc-tosca + 1.3.4-SNAPSHOT + + + + org.onap.sdc.jtosca + jtosca + + + + + org.onap.sdc.jtosca + jtosca + 1.3.4-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-test test + + uk.co.blackpepper.bowman + bowman-client + 0.3.0 + pl.pragmatists JUnitParams - 1.1.1 + 1.1.0 - org.assertj - assertj-core - 3.9.0 + ch.vorburger.mariaDB4j + mariaDB4j + 2.2.3 test - pl.pragmatists - JUnitParams - 1.1.1 + org.springframework.cloud + spring-cloud-contract-wiremock + 1.2.4.RELEASE + test - - org.jboss.resteasy - resteasy-jackson2-provider - 3.1.0.Final - diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy new file mode 100644 index 0000000000..0bd54ffe64 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -0,0 +1,643 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.rest.APIResponse; +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +class AaiUtil { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AaiUtil.class); + + + public MsoUtils utils = new MsoUtils() + public static final String AAI_NAMESPACE_STRING_KEY = 'mso.workflow.global.default.aai.namespace' + public static final String DEFAULT_VERSION_KEY = 'mso.workflow.global.default.aai.version' + + private String aaiNamespace = null; + + private AbstractServiceTaskProcessor taskProcessor + + public AaiUtil(AbstractServiceTaskProcessor taskProcessor) { + this.taskProcessor = taskProcessor + } + + public String getNetworkGenericVnfEndpoint(DelegateExecution execution) { + String endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + def uri = getNetworkGenericVnfUri(execution) + msoLogger.debug('AaiUtil.getNetworkGenericVnfEndpoint() - AAI endpoint: ' + endpoint + uri) + return endpoint + uri + } + + public String getNetworkGenericVnfUri(DelegateExecution execution) { + def uri = getUri(execution, 'generic-vnf') + msoLogger.debug('AaiUtil.getNetworkGenericVnfUri() - AAI URI: ' + uri) + return uri + } + + public String getNetworkVpnBindingUri(DelegateExecution execution) { + def uri = getUri(execution, 'vpn-binding') + msoLogger.debug('AaiUtil.getNetworkVpnBindingUri() - AAI URI: ' + uri) + return uri + } + + public String getNetworkPolicyUri(DelegateExecution execution) { + def uri = getUri(execution, 'network-policy') + msoLogger.debug('AaiUtil.getNetworkPolicyUri() - AAI URI: ' + uri) + return uri + } + + public String getNetworkTableReferencesUri(DelegateExecution execution) { + def uri = getUri(execution, 'route-table-reference') + msoLogger.debug('AaiUtil.getNetworkTableReferencesUri() - AAI URI: ' + uri) + return uri + } + + public String getNetworkVceUri(DelegateExecution execution) { + def uri = getUri(execution, 'vce') + msoLogger.debug('AaiUtil.getNetworkVceUri() - AAI URI: ' + uri) + return uri + } + + public String getNetworkL3NetworkUri(DelegateExecution execution) { + def uri = getUri(execution, 'l3-network') + msoLogger.debug('AaiUtil.getNetworkL3NetworkUri() - AAI URI: ' + uri) + return uri + } + + public String getBusinessCustomerUri(DelegateExecution execution) { + def uri = getUri(execution, 'customer') + msoLogger.debug('AaiUtil.getBusinessCustomerUri() - AAI URI: ' + uri) + return uri + } + + //public String getBusinessCustomerUriv7(DelegateExecution execution) { + // // //def uri = getUri(execution, BUSINESS_CUSTOMERV7) + // def uri = getUri(execution, 'Customer') + // msoLogger.debug('AaiUtil.getBusinessCustomerUriv7() - AAI URI: ' + uri) + // return uri + //} + + public String getCloudInfrastructureCloudRegionEndpoint(DelegateExecution execution) { + String endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + def uri = getCloudInfrastructureCloudRegionUri(execution) + msoLogger.debug('AaiUtil.getCloudInfrastructureCloudRegionEndpoint() - AAI endpoint: ' + endpoint + uri) + return endpoint + uri + } + + public String getCloudInfrastructureCloudRegionUri(DelegateExecution execution) { + def uri = getUri(execution, 'cloud-region') + msoLogger.debug('AaiUtil.getCloudInfrastructureCloudRegionUri() - AAI URI: ' + uri) + return uri + } + + public String getCloudInfrastructureTenantUri(DelegateExecution execution) { + def uri = getUri(execution, 'tenant') + msoLogger.debug('AaiUtil.getCloudInfrastructureTenantUri() - AAI URI: ' + uri) + return uri + } + + public String getSearchNodesQueryUri(DelegateExecution execution) { + def uri = getUri(execution, 'nodes-query') + msoLogger.debug('AaiUtil.getSearchNodesQueryUri() - AAI URI: ' + uri) + return uri + } + + public String getSearchNodesQueryEndpoint(DelegateExecution execution) { + String endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + def uri = getSearchNodesQueryUri(execution) + msoLogger.debug('AaiUtil.getSearchNodesQueryEndpoint() - AAI endpoint: ' + endpoint + uri) + return endpoint + uri + } + + public String getSearchGenericQueryUri(DelegateExecution execution) { + def uri = getUri(execution, 'generic-query') + msoLogger.debug('AaiUtil.getSearchGenericQueryUri() - AAI URI: ' + uri) + return uri + } + + public String getVersion(DelegateExecution execution, resourceName, processKey) { + def versionWithResourceKey = "mso.workflow.default.aai.${resourceName}.version" + def versionWithProcessKey = "mso.workflow.custom.${processKey}.aai.version" + + def version = UrnPropertiesReader.getVariable(versionWithProcessKey, execution) + if (version) { + msoLogger.debug("AaiUtil.getVersion() - using flow specific ${versionWithProcessKey}=${version}") + return version + } + + version = UrnPropertiesReader.getVariable(versionWithResourceKey, execution) + if (version) { + msoLogger.debug("AaiUtil.getVersion() - using resource specific ${versionWithResourceKey}=${version}") + return version + } + + version = UrnPropertiesReader.getVariable(DEFAULT_VERSION_KEY, execution) + if (version) { + msoLogger.debug("AaiUtil.getVersion() - using default version ${DEFAULT_VERSION_KEY}=${version}") + return version + } + + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, "Internal Error: One of the following should be defined in MSO URN properties file: ${versionWithResourceKey}, ${versionWithProcessKey}, ${DEFAULT_VERSION_KEY}") + } + + public String getUri(DelegateExecution execution, resourceName) { + + def processKey = taskProcessor.getMainProcessKey(execution) + + //set namespace + setNamespace(execution) + + // Check for flow+resource specific first + def key = "mso.workflow.${processKey}.aai.${resourceName}.uri" + def uri = UrnPropertiesReader.getVariable(key, execution) + if(uri) { + msoLogger.debug("AaiUtil.getUri() - using flow+resource specific key: ${key}=${uri}") + return uri + } + + // Check for versioned key + def version = getVersion(execution, resourceName, processKey) + key = "mso.workflow.default.aai.v${version}.${resourceName}.uri" + uri = UrnPropertiesReader.getVariable(key, execution) + + if(uri) { + msoLogger.debug("AaiUtil.getUri() - using versioned URI key: ${key}=${uri}") + return uri + } + + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + key + ' not defined in the MSO URN properties file') + } + + public String setNamespace(DelegateExecution execution) { + def key = AAI_NAMESPACE_STRING_KEY + aaiNamespace = UrnPropertiesReader.getVariable(key, execution) + if (aaiNamespace == null ) { + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + key + ' not defined in the MSO URN properties file') + } + } + + /** + * This method can be used for getting the building namespace out of uri. + * NOTE: A getUri() method needs to be invoked first. + * Alternative method is the getNamespaceFromUri(DelegateExecution execution, String uri) + * return namespace (plus version from uri) + * + * @param url + * + * @return namespace + */ + + public String getNamespaceFromUri(String uri) { + if (aaiNamespace == null) { + throw new Exception('Internal Error: AAI Namespace has not been set yet. A getUri() method needs to be invoked first.') + } + String namespace = aaiNamespace + if(uri!=null){ + String version = getVersionFromUri(uri) + return namespace + "v"+version + }else{ + return namespace + } + } + + /** + * This method can be used for building namespace with aai version out of uri. + * NOTE: 2 arguments: DelegateExecution execution & String uri + * @param execution + * @param url + * + * @return namespace + */ + public String getNamespaceFromUri(DelegateExecution execution, String uri) { + String namespace = UrnPropertiesReader.getVariable(AAI_NAMESPACE_STRING_KEY, execution) + if (namespace == null ) { + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + AAI_NAMESPACE_STRING_KEY + ' not defined in the MSO URN properties file') + } + if(uri!=null){ + String version = getVersionFromUri(uri) + return namespace + "v"+version + }else{ + return namespace + } + } + + /** + * This is used to extract the version from uri. + * + * @param uri + * + * @return version + */ + private String getVersionFromUri(String uri) { + def version = "" + def savedVersion = "" + for (int x=2; x<6; x++) { + version = uri.substring(uri.indexOf("v")+1, uri.indexOf("v")+x) + if (!Character.isDigit(version.charAt(version.size()-1))) { + break + } + savedVersion = version + } + return savedVersion + } + + + /** + * This reusable method can be used for making AAI Get Calls. The url should + * be passed as a parameter along with the execution. The method will + * return an APIResponse. + * + * @param execution + * @param url + * + * @return APIResponse + * + */ + public APIResponse executeAAIGetCall(DelegateExecution execution, String url){ + msoLogger.trace("STARTED Execute AAI Get Process ") + APIResponse apiResponse = null + try{ + String uuid = utils.getRequestID() + msoLogger.debug("Generated uuid is: " + uuid) + msoLogger.debug("URL to be used is: " + url) + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml"); + + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.get() + + msoLogger.trace("COMPLETED Execute AAI Get Process ") + }catch(Exception e){ + msoLogger.debug("Exception occured while executing AAI Get Call. Exception is: \n" + e) + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + return apiResponse + } + + + /** + * This reusable method can be used for making AAI httpPut Calls. The url should + * be passed as a parameter along with the execution and payload. The method will + * return an APIResponse. + * + * @param execution + * @param url + * @param payload + * + * @return APIResponse + * + */ + public APIResponse executeAAIPutCall(DelegateExecution execution, String url, String payload){ + msoLogger.trace("Started Execute AAI Put Process ") + APIResponse apiResponse = null + try{ + String uuid = utils.getRequestID() + msoLogger.debug("Generated uuid is: " + uuid) + msoLogger.debug("URL to be used is: " + url) + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml"); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.httpPut(payload) + + msoLogger.trace("Completed Execute AAI Put Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Put Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + return apiResponse + } + + /** + * This reusable method can be used for making AAI httpPatch Calls. The url should + * be passed as a parameter along with the execution and payload. The method will + * return an APIResponse. + * + * @param execution + * @param url + * @param payload + * + * @return APIResponse + * + */ + public APIResponse executeAAIPatchCall(DelegateExecution execution, String url, String payload){ + msoLogger.trace("Started Execute AAI Patch Process ") + APIResponse apiResponse = null + try{ + String uuid = utils.getRequestID() + msoLogger.debug("Generated uuid is: " + uuid) + + msoLogger.debug("URL to be used is: " + url) + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/merge-patch+json").addHeader("Accept","application/json"); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.httpPatch(payload) + + msoLogger.trace("Completed Execute AAI Patch Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Patch Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + return apiResponse + } + + + /** + * This reusable method can be used for making AAI Delete Calls. The url should + * be passed as a parameter along with the execution. The method will + * return an APIResponse. + * + * @param execution + * @param url + * + * @return APIResponse + * + */ + public APIResponse executeAAIDeleteCall(DelegateExecution execution, String url){ + msoLogger.trace("Started Execute AAI Delete Process ") + APIResponse apiResponse = null + try{ + String uuid = utils.getRequestID() + msoLogger.debug("Generated uuid is: " + uuid) + msoLogger.debug("URL to be used is: " + url) + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml"); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.delete() + + msoLogger.trace("Completed Execute AAI Delete Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Delete Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + return apiResponse + } + + /** + * This reusable method can be used for making AAI Delete Calls. The url should + * be passed as a parameter along with the execution. The method will + * return an APIResponse. + * + * @param execution + * @param url + * @param payload + * + * @return APIResponse + * + */ + public APIResponse executeAAIDeleteCall(DelegateExecution execution, String url, String payload, String authHeader){ + msoLogger.trace("Started Execute AAI Delete Process ") + APIResponse apiResponse = null + try{ + String uuid = utils.getRequestID() + msoLogger.debug("Generated uuid is: " + uuid) + + msoLogger.debug("URL to be used is: " + url) + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml").addAuthorizationHeader(authHeader); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.httpDelete(payload) + + msoLogger.trace("Completed Execute AAI Delete Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Delete Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + return apiResponse + } + + /** + * This reusable method can be used for making AAI Post Calls. The url + * and payload should be passed as a parameters along with the execution. + * The method will return an APIResponse. + * + * @param execution + * @param url + * @param payload + * + * @return APIResponse + * + */ + public APIResponse executeAAIPostCall(DelegateExecution execution, String url, String payload){ + msoLogger.trace("Started Execute AAI Post Process ") + APIResponse apiResponse = null + try{ + String uuid = utils.getRequestID() + msoLogger.debug("Generated uuid is: " + uuid) + msoLogger.debug("URL to be used is: " + url) + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml"); + + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.httpPost(payload) + + msoLogger.trace("Completed Execute AAI Post Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + return apiResponse + } + + /** + * This reusable method can be used for making AAI Post Calls. The url + * and payload should be passed as a parameters along with the execution. + * The method will return an APIResponse. + * + * @param execution + * @param url + * @param payload + * @param authenticationHeader - addAuthenticationHeader value + * @param headerName - name of header you want to add, i.e. addHeader(headerName, headerValue) + * @param headerValue - the header's value, i.e. addHeader(headerName, headerValue) + * + * @return APIResponse + * + */ + public APIResponse executeAAIPostCall(DelegateExecution execution, String url, String payload, String authenticationHeaderValue, String headerName, String headerValue){ + msoLogger.trace("Started Execute AAI Post Process ") + APIResponse apiResponse = null + try{ + msoLogger.debug("URL to be used is: " + url) + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addAuthorizationHeader(authenticationHeaderValue).addHeader(headerName, headerValue) + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.httpPost(payload) + + msoLogger.trace("Completed Execute AAI Post Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + return apiResponse + } + + + /* Utility to get the Cloud Region from AAI + * Returns String cloud region id, (ie, cloud-region-id) + * @param execution + * @param url - url for AAI get cloud region + * @param backend - "PO" - real region, or "SDNC" - v2.5 (fake region). + */ + + public String getAAICloudReqion(DelegateExecution execution, String url, String backend, inputCloudRegion){ + String regionId = "" + try{ + APIResponse apiResponse = executeAAIGetCall(execution, url) + String returnCode = apiResponse.getStatusCode() + String aaiResponseAsString = apiResponse.getResponseBodyAsString() + msoLogger.debug("Call AAI Cloud Region Return code: " + returnCode) + execution.setVariable(execution.getVariable("prefix")+"queryCloudRegionReturnCode", returnCode) + + if(returnCode == "200"){ + msoLogger.debug("Call AAI Cloud Region is Successful.") + + String regionVersion = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-version") + msoLogger.debug("Cloud Region Version from AAI for " + backend + " is: " + regionVersion) + if (backend == "PO") { + regionId = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-id") + } else { // backend not "PO" + if (regionVersion == "2.5" ) { + regionId = "AAIAIC25" + } else { + regionId = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-id") + } + } + if(regionId == null){ + throw new BpmnError("MSOWorkflowException") + } + msoLogger.debug("Cloud Region Id from AAI " + backend + " is: " + regionId) + }else if (returnCode == "404"){ // not 200 + if (backend == "PO") { + regionId = inputCloudRegion + }else{ // backend not "PO" + regionId = "AAIAIC25" + } + msoLogger.debug("Cloud Region value for code='404' of " + backend + " is: " + regionId) + }else{ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Call AAI Cloud Region is NOT Successful.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + throw new BpmnError("MSOWorkflowException") + } + }catch(Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while getting the Cloud Reqion.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage()); + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + return regionId + } + + /* returns xml Node with service-type of searchValue */ + def searchServiceType(xmlInput, searchValue){ + def fxml= new XmlSlurper().parseText(xmlInput) + def ret = fxml.'**'.find {it.'service-type' == searchValue} + return ret + } + + /* returns xml Node with service-instance-id of searchValue */ + def searchServiceInstanceId(xmlInput, searchValue){ + def ret = xmlInput.'**'.find {it.'service-instance-id' == searchValue} + return ret + } + + /** + * Get the lowest unused VF Module index from AAI response for a given module type. The criteria for + * determining module type is specified by "key" parameter (for example, "persona-model-id"), + * the value for filtering is specified in "value" parameter + * + * @param execution + * @param aaiVnfResponse + * @param key + * @param value + * + * @return moduleIndex + * + */ + public int getLowestUnusedVfModuleIndexFromAAIVnfResponse(DelegateExecution execution, String aaiVnfResponse, String key, String value) { + if (aaiVnfResponse != null) { + String vfModulesText = taskProcessor.utils.getNodeXml(aaiVnfResponse, "vf-modules") + if (vfModulesText == null || vfModulesText.isEmpty()) { + msoLogger.debug("There are no VF modules in this VNF yet") + return 0 + } + else { + def xmlVfModules= new XmlSlurper().parseText(vfModulesText) + def vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} + int vfModulesSize = 0 + if (vfModules != null) { + vfModulesSize = vfModules.size() + } + String matchingVfModules = "" + for (i in 0..vfModulesSize-1) { + def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i]) + def keyFromAAI = taskProcessor.utils.getNodeText(vfModuleXml, key) + if (keyFromAAI != null && keyFromAAI.equals(value)) { + matchingVfModules = matchingVfModules + taskProcessor.utils.removeXmlPreamble(vfModuleXml) + } + } + matchingVfModules = matchingVfModules + "" + msoLogger.debug("Matching VF Modules: " + matchingVfModules) + String lowestUnusedIndex = taskProcessor.utils.getLowestUnusedIndex(matchingVfModules) + return Integer.parseInt(lowestUnusedIndex) + } + } + else { + return 0 + } + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy new file mode 100644 index 0000000000..1e2a703e70 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy @@ -0,0 +1,768 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts; + +import groovy.json.JsonSlurper + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.camunda.bpm.engine.variable.VariableMap +import org.camunda.bpm.engine.variable.Variables +import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats +import org.camunda.bpm.engine.variable.impl.value.ObjectValueImpl +import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse +import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.springframework.web.util.UriUtils + +public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcessor { + public MsoUtils utils = new MsoUtils() + + + /** + * Logs a message at the ERROR level. + * @param message the message + */ + public void logError(String message) { + log('ERROR', message, null, "true") + } + + /** + * Logs a message at the ERROR level. + * @param message the message + * @param cause the cause (stracktrace will be included in the output) + */ + public void logError(String message, Throwable cause) { + log('ERROR', message, cause, "true") + } + + /** + * Logs a message at the WARN level. + * @param message the message + */ + public void logWarn(String message) { + log('WARN', message, null, "true") + } + + /** + * Logs a message at the WARN level. + * @param message the message + * @param cause the cause (stracktrace will be included in the output) + */ + public void logWarn(String message, Throwable cause) { + log('WARN', message, cause, "true") + } + + /** + * Logs a message at the DEBUG level. + * @param message the message + * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled + */ + public void logDebug(String message, String isDebugLogEnabled) { + log('DEBUG', message, null, isDebugLogEnabled) + } + + /** + * Logs a message at the DEBUG level. + * @param message the message + * @param cause the cause (stracktrace will be included in the output) + * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled + */ + public void logDebug(String message, Throwable cause, String isDebugLogEnabled) { + log('DEBUG', message, cause, isDebugLogEnabled) + } + + /** + * Logs a message at the specified level. + * @param level the level (DEBUG, INFO, WARN, ERROR) + * @param message the message + * @param isLevelEnabled a flag indicating if the level is enabled + * (used only at the DEBUG level) + */ + public void log(String level, String message, String isLevelEnabled) { + log(level, message, null, isLevelEnabled) + } + + /** + * Logs a message at the specified level. + * @param level the level (DEBUG, INFO, WARN, ERROR) + * @param message the message + * @param cause the cause (stracktrace will be included in the output) + * @param isLevelEnabled a flag indicating if the level is enabled + * (used only at the DEBUG level) + */ + public void log(String level, String message, Throwable cause, String isLevelEnabled) { + if (cause == null) { + utils.log(level, message, isLevelEnabled); + } else { + StringWriter stringWriter = new StringWriter(); + PrintWriter printWriter = new PrintWriter(stringWriter); + printWriter.println(message); + cause.printStackTrace(printWriter); + utils.log(level, stringWriter.toString(), isLevelEnabled); + printWriter.close(); + } + } + + /** + * Logs a WorkflowException at the ERROR level with the specified message. + * @param execution the execution + */ + public void logWorkflowException(DelegateExecution execution, String message) { + def workflowException = execution.getVariable("WorkflowException") + + if (workflowException == null) { + logError(message); + } else { + logError(message + ": " + workflowException) + } + } + + /** + * Saves the WorkflowException in the execution to the specified variable, + * clearing the WorkflowException variable so the workflow can continue + * processing (perhaps catching another WorkflowException). + * @param execution the execution + * @return the name of the destination variable + */ + public saveWorkflowException(DelegateExecution execution, String variable) { + if (variable == null) { + throw new NullPointerException(); + } + + execution.setVariable(variable, execution.getVariable("WorkflowException")) + execution.setVariable("WorkflowException", null) + } + + + /** + * Validates that the request exists and that the mso-request-id variable is set. + * Additional required variables may be checked by specifying their names. + * NOTE: services requiring mso-service-instance-id must specify it explicitly! + * If a problem is found, buildAndThrowWorkflowException builds a WorkflowException + * and throws an MSOWorkflowException. This method also sets up the log context for + * the workflow. + * + * @param execution the execution + * @return the validated request + */ + public String validateRequest(DelegateExecution execution, String... requiredVariables) { + ExceptionUtil exceptionUtil = new ExceptionUtil() + def method = getClass().getSimpleName() + '.validateRequest(' + + 'execution=' + execution.getId() + + ', requredVariables=' + requiredVariables + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + String processKey = getProcessKey(execution) + def prefix = execution.getVariable("prefix") + + if (prefix == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null") + } + + try { + def request = execution.getVariable(prefix + 'Request') + + if (request == null) { + request = execution.getVariable(processKey + 'Request') + + if (request == null) { + request = execution.getVariable('bpmnRequest') + } + + setVariable(execution, processKey + 'Request', null) + setVariable(execution, 'bpmnRequest', null) + setVariable(execution, prefix + 'Request', request) + } + + if (request == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null") + } + + // All requests must have a request ID. + // Some requests (e.g. SDN-MOBILITY) do not have a service instance ID. + + String requestId = null + String serviceInstanceId = null + + List allRequiredVariables = new ArrayList() + allRequiredVariables.add("mso-request-id") + + if (requiredVariables != null) { + for (String variable : requiredVariables) { + if (!allRequiredVariables.contains(variable)) { + allRequiredVariables.add(variable) + } + } + } + + for (String variable : allRequiredVariables) { + def value = execution.getVariable(variable) + if (value == null || ((value instanceof CharSequence) && value.length() == 0)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + + " request was received with no '" + variable + "' variable") + } + + if ("mso-request-id".equals(variable)) { + requestId = (String) value + } else if ("mso-service-instance-id".equals(variable)) { + serviceInstanceId = (String) value + } + } + + if (serviceInstanceId == null) { + serviceInstanceId = (String) execution.getVariable("mso-service-instance-id") + } + + utils.logContext(requestId, serviceInstanceId) + logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled) + logDebug('Exited ' + method, isDebugLogEnabled) + return request + } catch (BpmnError e) { + throw e + } catch (Exception e) { + logError('Caught exception in ' + method, e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") + } + } + + /** + * gets vars stored in a JSON object in prefix+Request and returns as a LazyMap + * setting log context here too + * @param execution the execution + * @return the inputVars + */ + public Map validateJSONReq(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.validateJSONReq(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + String processKey = getProcessKey(execution); + def prefix = execution.getVariable("prefix") + + def requestId =getVariable(execution, "mso-request-id") + def serviceInstanceId = getVariable(execution, "mso-service-instance-id") + if(requestId!=null && serviceInstanceId!=null){ + utils.logContext(requestId, serviceInstanceId) + } + + + def request = getVariable(execution, prefix + 'Request') + + if (request == null) { + request = getVariable(execution, processKey + 'Request') + + if (request == null) { + request = getVariable(execution, 'bpmnRequest') + } + execution.setVariable(prefix + 'Request', request) + } + + def jsonSlurper = new JsonSlurper() + def parsed = jsonSlurper.parseText(request) + + + logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled) + logDebug('Exited ' + method, isDebugLogEnabled) + return parsed + + } + + /** + * Sends a response to the workflow service that invoked the process. This method + * may only be used by top-level processes that were directly invoked by the + * asynchronous workflow service. + * @param execution the execution + * @param responseCode the response code + * @param content the message content + * @throws IllegalArgumentException if the response code is invalid + * by HTTP standards + * @throws UnsupportedOperationException if not invoked by an asynchronous, + * top-level process + * @throws IllegalStateException if a response has already been sent + */ + protected void sendWorkflowResponse(DelegateExecution execution, Object responseCode, String response) { + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + try { + String processKey = getProcessKey(execution); + + // isAsyncProcess is injected by the workflow service that started the flow + if (!String.valueOf(execution.getVariable("isAsyncProcess")).equals("true")) { + throw new UnsupportedOperationException(processKey + ": " + + "sendWorkflowResponse is valid only in asynchronous workflows"); + } + + if (String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true")) { + logDebug("Sync response has already been sent for " + processKey, isDebugLogEnabled) + }else{ + + logDebug("Building " + processKey + " response ", isDebugLogEnabled) + + int intResponseCode; + + try { + intResponseCode = Integer.parseInt(String.valueOf(responseCode)); + + if (intResponseCode < 100 || intResponseCode > 599) { + throw new NumberFormatException(String.valueOf(responseCode)); + } + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Process " + processKey + + " provided an invalid HTTP response code: " + responseCode); + } + + // Only 2XX responses are considered "Success" + String status = (intResponseCode >= 200 && intResponseCode <= 299) ? + "Success" : "Fail"; + + // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead + execution.setVariable(processKey + "ResponseCode", String.valueOf(intResponseCode)) + execution.setVariable(processKey + "Response", response); + execution.setVariable(processKey + "Status", status); + execution.setVariable("WorkflowResponse", response) + + logDebug("Sending response for " + processKey + + " ResponseCode=" + intResponseCode + + " Status=" + status + + " Response=\n" + response, + isDebugLogEnabled) + + // TODO: ensure that this flow was invoked asynchronously? + + WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse() + callbackResponse.setStatusCode(intResponseCode) + callbackResponse.setMessage(status) + callbackResponse.setResponse(response) + + // TODO: send this data with HTTP POST + + WorkflowContextHolder.getInstance().processCallback( + processKey, + execution.getProcessInstanceId(), + execution.getVariable("mso-request-id"), + callbackResponse) + + execution.setVariable(processKey + "WorkflowResponseSent", "true"); + } + + } catch (Exception ex) { + logError("Unable to send workflow response to client ....", ex) + } + } + + /** + * Returns true if a workflow response has already been sent. + * @param execution the execution + */ + protected boolean isWorkflowResponseSent(DelegateExecution execution) { + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + String processKey = getProcessKey(execution); + return String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true"); + } + + /** + * Returns the process definition key (i.e. the process name) of the + * current process. + * + * @param execution the execution + */ + public String getProcessKey(DelegateExecution execution) { + def testKey = execution.getVariable("testProcessKey") + if(testKey!=null){ + return testKey + } + return execution.getProcessEngineServices().getRepositoryService() + .getProcessDefinition(execution.getProcessDefinitionId()).getKey() + } + + /** + * Returns the process definition key (i.e. the process name) of the + * top-level process. + * @param execution the execution + */ + public String getMainProcessKey(DelegateExecution execution) { + DelegateExecution exec = execution + + while (true) { + DelegateExecution parent = exec.getSuperExecution() + + if (parent == null) { + parent = exec.getParent() + + if (parent == null) { + break + } + } + + exec = parent + } + + return execution.getProcessEngineServices().getRepositoryService() + .getProcessDefinition(exec.getProcessDefinitionId()).getKey() + } + + /** + * Gets the node for the named element from the given xml. If the element + * does not exist in the xml or is empty, a WorkflowException is created + * (and as a result, a MSOWorkflowException event is thrown). + * + * @param execution The flow's execution. + * @param xml Xml to search. + * @param elementName Name of element to search for. + * @return The element node, if found in the xml. + */ + protected String getRequiredNodeXml(DelegateExecution execution, String xml, String elementName) { + ExceptionUtil exceptionUtil = new ExceptionUtil() + def element = utils.getNodeXml(xml, elementName, false) + if (element.trim().isEmpty()) { + def msg = 'Required element \'' + elementName + '\' is missing or empty' + logError(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } else { + return element + } + } + + /** + * Gets the value of the named element from the given xml. If the element + * does not exist in the xml or is empty, a WorkflowException is created + * (and as a result, a MSOWorkflowException event is thrown). + * + * @param execution The flow's execution. + * @param xml Xml to search. + * @param elementName Name of element to whose value to get. + * @return The non-empty value of the element, if found in the xml. + */ + protected String getRequiredNodeText(DelegateExecution execution, String xml, String elementName) { + ExceptionUtil exceptionUtil = new ExceptionUtil() + def elementText = utils.getNodeText(xml, elementName) + if ((elementText == null) || (elementText.isEmpty())) { + def msg = 'Required element \'' + elementName + '\' is missing or empty' + logError(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } else { + return elementText + } + } + + /** + * Get the text for the specified element from the specified xml. If + * the element does not exist, return the specified default value. + * + * @param xml Xml from which to get the element's text + * @param elementName Name of element whose text to get + * @param defaultValue the default value + * @return the element's text or the default value if the element does not + * exist in the given xml + */ + protected String getNodeText(String xml, String elementName, String defaultValue) { + def nodeText = utils.getNodeText(xml, elementName) + return (nodeText == null) ? defaultValue : nodeText + } + + /** + * Get the text for the specified element from the specified xml. If + * the element does not exist, return an empty string. + * + * @param xml Xml from which to get the element's text. + * @param elementName Name of element whose text to get. + * @return the element's text or an empty string if the element does not + * exist in the given xml. + */ + protected String getNodeTextForce(String xml, String elementName) { + return getNodeText(xml, elementName, ''); + } + + /** + *Store the variable as typed with java serialization type + *@param execution + *@param name + *@param value + */ + public void setVariable(DelegateExecution execution, String name, Object value) { + VariableMap variables = Variables.createVariables() + variables.putValueTyped('payload', Variables.objectValue(value) + .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value + .create()) + execution.setVariable(name,variables) + } + + //TODO not sure how this will look in Cockpit + + /** + * Returns the variable map + *@param execution + *@param name + *@return + **/ + public String getVariable(DelegateExecution execution, String name) { + def myObj = execution.getVariable(name) + if(myObj instanceof VariableMap){ + VariableMap serializedObjectMap = (VariableMap) myObj + ObjectValueImpl payloadObj = serializedObjectMap.getValueTyped('payload') + return payloadObj.getValue() + }else{ + return myObj + } + } + + + /** + * Returns true if a value equals one of the provided set. Equality is + * determined by using the equals method if the value object and the + * object in the provided set have the same class. Otherwise, the objects + * are converted to strings and then compared. Nulls are permitted for + * the value as well as in the provided set + * Example: + *
+	 *     def statusCode = getStatusCode()
+	 *     isOneOf(statusCode, 200, 201, 204)
+	 * 
+ * @param value the value to test + * @param these a set of permissable values + * @return true if the value is in the provided set + */ + public boolean isOneOf(Object value, Object... these) { + for (Object thisOne : these) { + if (thisOne == null) { + if (value == null) { + return true + } + } else { + if (value != null) { + if (value.getClass() == thisOne.getClass()) { + if (value.equals(thisOne)) { + return true + } + } else { + if (String.valueOf(value).equals(String.valueOf(thisOne))) { + return true + } + } + } + } + } + return false + } + + /** + * Sets flows success indicator variable. + * + */ + public void setSuccessIndicator(DelegateExecution execution, boolean isSuccess) { + String prefix = execution.getVariable('prefix') + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + + logDebug('Entered SetSuccessIndicator Method', isDebugLogEnabled) + execution.setVariable(prefix+'SuccessIndicator', isSuccess) + logDebug('Outgoing SuccessIndicator is: ' + execution.getVariable(prefix+'SuccessIndicator') + '', isDebugLogEnabled) + } + + /** + * Sends a Error Sync Response + * + */ + public void sendSyncError(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + String requestId = execution.getVariable("mso-request-id") + logDebug('sendSyncError, requestId: ' + requestId, isDebugEnabled) + WorkflowException workflowExceptionObj = execution.getVariable("WorkflowException") + if (workflowExceptionObj != null) { + String errorMessage = workflowExceptionObj.getErrorMessage() + def errorCode = workflowExceptionObj.getErrorCode() + logDebug('sendSyncError, requestId: ' + requestId + ' | errorMessage: ' + errorMessage + ' | errorCode: ' + errorCode, isDebugEnabled) + sendWorkflowResponse(execution, errorCode, errorMessage) + } + } + + /** + * Executes a named groovy script method in the current object + */ + public void executeMethod(String methodName, Object... args) { + + if (args != null && args.size() > 0) { + + // First argument of method to call is always the execution object + DelegateExecution execution = (DelegateExecution) args[0] + + def classAndMethod = getClass().getSimpleName() + '.' + methodName + '(execution=' + execution.getId() + ')' + def isDebugEnabled = execution.getVariable('isDebugLogEnabled') + + logDebug('Entered ' + classAndMethod, isDebugEnabled) + logDebug('Received parameters: ' + args, isDebugEnabled) + + try{ + def methodToCall = this.metaClass.getMetaMethod(methodName, args) + logDebug('Method to call: ' + methodToCall, isDebugEnabled) + methodToCall?.invoke(this, args) + } + catch(BpmnError bpmnError) { + logDebug('Rethrowing BpmnError ' + bpmnError.getMessage(), isDebugEnabled) + throw bpmnError + } + catch(Exception e) { + e.printStackTrace() + logDebug('Unexpected error encountered - ' + e.getMessage(), isDebugEnabled) + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + finally { + logDebug('Exited ' + classAndMethod, isDebugEnabled) + } + } + } + + /** + *This method determines and adds the appropriate ending to come + *after a number (-st, -nd, -rd, or -th) + * + *@param int n + * + *@return String ending - number with suffix + */ + public static String labelMaker(Object n) { + Integer num + if(n instanceof String){ + num = Integer.parseInt(n) + }else{ + num = n + } + + String ending = ""; //the end to be added to the number + if(num != null){ + if ((num % 10 == 1) && (num != 11)) { + ending = num + "st"; + } else if ((num % 10 == 2) && (num != 12)) { + ending = num + "nd"; + } else if ((num % 10 == 3) && (num != 13)) { + ending = num + "rd"; + } else { + ending = num + "th"; + } + } + return ending + } + + /** + * Constructs a workflow message callback URL for the specified message type and correlator. + * This type of callback URL is used when a workflow wants an MSO adapter (like the SDNC + * adapter) to call it back. In other words, this is for callbacks internal to the MSO + * complex. Use createWorkflowMessageAdapterCallbackURL if the callback + * will come from outside the MSO complex. + * @param messageType the message type (e.g. SDNCAResponse or VNFAResponse) + * @param correlator the correlator value (e.g. a request ID) + */ + public String createCallbackURL(DelegateExecution execution, String messageType, String correlator) { + String endpoint = UrnPropertiesReader.getVariable("mso.workflow.message.endpoint", execution) + + if (endpoint == null || endpoint.isEmpty()) { + ExceptionUtil exceptionUtil = new ExceptionUtil() + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, + 'mso:workflow:message:endpoint URN mapping is not set') + } + + while (endpoint.endsWith('/')) { + endpoint = endpoint.substring(0, endpoint.length()-1) + } + + return endpoint + + '/' + UriUtils.encodePathSegment(messageType, 'UTF-8') + + '/' + UriUtils.encodePathSegment(correlator, 'UTF-8') + } + + /** + * + * Constructs a workflow message callback URL for the specified message type and correlator. + * This type of callback URL is used when a workflow wants a system outside the MSO complex + * to call it back through the Workflow Message Adapter. + * @param messageType the message type (e.g. SNIROResponse) + * @param correlator the correlator value (e.g. a request ID) + */ + public String createWorkflowMessageAdapterCallbackURL(DelegateExecution execution, String messageType, String correlator) { + String endpoint = UrnPropertiesReader.getVariable("mso.adapters.workflow.message.endpoint", execution) + + if (endpoint == null || endpoint.isEmpty()) { + ExceptionUtil exceptionUtil = new ExceptionUtil() + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, + 'mso:adapters:workflow:message:endpoint URN mapping is not set') + } + + while (endpoint.endsWith('/')) { + endpoint = endpoint.substring(0, endpoint.length()-1) + } + + return endpoint + + '/' + UriUtils.encodePathSegment(messageType, 'UTF-8') + + '/' + UriUtils.encodePathSegment(correlator, 'UTF-8') + } + + public void setRollbackEnabled(DelegateExecution execution, isDebugLogEnabled) { + + // Rollback settings + def prefix = execution.getVariable('prefix') + def disableRollback = execution.getVariable("disableRollback") + def defaultRollback = UrnPropertiesReader.getVariable("mso.rollback", execution).toBoolean() + + logDebug('disableRollback: ' + disableRollback, isDebugLogEnabled) + logDebug('defaultRollback: ' + defaultRollback, isDebugLogEnabled) + + def rollbackEnabled + + if(disableRollback == null || disableRollback == '' ) { + // get from default urn settings for mso_rollback + disableRollback = !defaultRollback + rollbackEnabled = defaultRollback + logDebug('disableRollback is null or empty!', isDebugLogEnabled) + } + else { + if(disableRollback == true) { + rollbackEnabled = false + } + else if(disableRollback == false){ + rollbackEnabled = true + } + else { + rollbackEnabled = defaultRollback + } + } + + execution.setVariable(prefix+"backoutOnFailure", rollbackEnabled) + logDebug('rollbackEnabled (aka backoutOnFailure): ' + rollbackEnabled, isDebugLogEnabled) + } + + public void setBasicDBAuthHeader(DelegateExecution execution, isDebugLogEnabled) { + try { + String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution) + utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled) + + def encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable("BasicAuthHeaderValueDB",encodedString) + } catch (IOException ex) { + String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled) + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy new file mode 100644 index 0000000000..b054c0f934 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy @@ -0,0 +1,343 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse; + + + +class AllottedResourceUtils { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AllottedResourceUtils.class); + + + private AbstractServiceTaskProcessor taskProcessor + ExceptionUtil exceptionUtil = new ExceptionUtil() + MsoUtils utils; + + public AllottedResourceUtils(AbstractServiceTaskProcessor taskProcessor) { + this.taskProcessor = taskProcessor + this.utils = taskProcessor.utils + } + + /*Used on Create - called from DoCreate + * Using Consuming ServiceInstanceId get related Allotted Resources Orchestration status from AAI + * 1) get related AR links for CSI 2) get AR from AR links + * return: null -> AR Not found + * return: " " -> AR found with empty orchStatus + * return: orchStatus - > AR found with this orchStatus + * setsVariable aaiARGetResponse + */ + public String getAROrchStatus (DelegateExecution execution) { + + msoLogger.trace("getAROrchStatus ") + String msg = "" + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String arType = execution.getVariable("allottedResourceType") + String arRole = execution.getVariable("allottedResourceRole") + String siXml = execution.getVariable("CSI_service") + String ar = null + String orchStatus = null + XmlParser xmlParser = new XmlParser() + msoLogger.debug("getAROrchStatus siXml:" + siXml) + try { + if (!isBlank(siXml)) { + def groovy.util.Node siNode = xmlParser.parseText(siXml) + def groovy.util.Node relationshipList = utils.getChildNode(siNode, 'relationship-list') + if (relationshipList != null) { + def groovy.util.NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') + for (groovy.util.Node relationship in relationships) { + def groovy.util.Node relatedTo = utils.getChildNode(relationship, 'related-to') + if ((relatedTo != null) && (relatedTo.text().equals('allotted-resource'))) { + msoLogger.debug("getARORchStatus AR found") + def groovy.util.Node relatedLink = utils.getChildNode(relationship, 'related-link') + if (relatedLink != null){ + ar = getARbyLink(execution, relatedLink.text(), arRole) + if (!isBlank(ar)) + { + orchStatus = execution.getVariable("aaiAROrchStatus") + break + } + } + } + } + } + } + }catch(Exception e){ + msoLogger.debug(" Error encountered in getAROrchStatus" + e.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in getAROrchStatus" + e.getMessage()) + } + msoLogger.trace(" Exit getAROrchStatus - OrchStatus:" + orchStatus) + return orchStatus + } + + // get Allotted Resource by AllottedResourceId + // used on Delete - called from doDeleteAR + // setsVariable aaiARGetResponse + public String getARbyId (DelegateExecution execution, String allottedResourceId) { + msoLogger.trace("getARbyId ") + String arLink = getARLinkbyId(execution, allottedResourceId) + String ar = null + if (!isBlank(arLink)) + { + ar = getARbyLink(execution, arLink, "") + } + msoLogger.trace(" Exit GetARbyId - AR:" + ar) + return ar; + } + + public String getPSIFmARLink(DelegateExecution execution, String arLink) + { + // Path: /aai/{version}/business/customers/customer/{cust}/service-subscriptions/service-subscription/{subs}/service-instances/service-instance/{psiid}/allotted-resources/allotted-resource/{arid} + msoLogger.trace(" getPSIFmARLink - path:" + arLink) + String[] split = arLink.split("/service-instance/") + String[] splitB = split[1].split("/allotted-resources/") + String siId = splitB[0] + msoLogger.trace(" Exit getARLinkbyId - parentServiceInstanceId:" + siId ) + return siId + } + + // get Allotted Resource Link by AllottedResourceId using Nodes Query + // used on Delete - called from getARbyId + public String getARLinkbyId (DelegateExecution execution, String allottedResourceId) { + msoLogger.trace("getARLinkbyId ") + String arLink = null + try { + AaiUtil aaiUriUtil = new AaiUtil(taskProcessor) + String aaiNQUri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) + String aaiEndpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + String aaiUrl = "${aaiNQUri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}" + + msoLogger.debug("getARLinkbyId url: \n" + aaiUrl) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, aaiUrl) + int responseCode = response.getStatusCode() + msoLogger.debug(" GET AR response code is: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + msoLogger.debug("GET AR:" + aaiResponse) + if(responseCode == 200 || responseCode == 202){ + msoLogger.debug("GET AR Received a Good Response Code") + if(utils.nodeExists(aaiResponse, "result-data")){ + msoLogger.debug("Query for AllottedResource Url Response Does Contain Data" ) + arLink = utils.getNodeText(aaiResponse, "resource-link") + }else{ + msoLogger.debug("GET AR Response Does NOT Contain Data" ) + } + }else if(responseCode == 404){ + msoLogger.debug("GET AR received a Not Found (404) Response") + } + else{ + msoLogger.debug(" GET AR received a Bad Response: \n" + aaiResponse) + buildAAIErrorResponse(execution, aaiResponse, "Error retrieving AR from AAI") + } + }catch(Exception e){ + msoLogger.debug(" Error encountered within GetAaiAR" + e.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in GetARbyId" + e.getMessage()) + } + msoLogger.trace(" Exit GetARLinkbyId - Link:" + arLink) + return arLink + } + + // get Allotted resource using Link + // used on Create called from getARORchStatus + // used on Delete called from getARbyId + // setsVariable aaiARPath - used for Patch in create + public String getARbyLink (DelegateExecution execution, String link, String role) { + msoLogger.trace("getARbyLink ") + String ar = null + String arUrl = null + try { + AaiUtil aaiUriUtil = new AaiUtil(taskProcessor) + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + String arEndpoint = "" + + if(!isBlank(link)) { + msoLogger.debug("Incoming AR Resource Link is: " + link) + String[] split = link.split("/aai/") + arEndpoint = "/aai/" + split[1] + } + + arUrl = "${aai_endpoint}" + arEndpoint + + msoLogger.debug("GET AR Aai Path is: \n" + arUrl) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, arUrl) + int responseCode = response.getStatusCode() + msoLogger.debug(" GET AR response code is: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + msoLogger.debug("GET AR:" + aaiResponse) + if(responseCode == 200 || responseCode == 202){ + msoLogger.debug("GET AR Received a Good Response Code") + if(utils.nodeExists(aaiResponse, "allotted-resource")){ + if (!isBlank(role)) + { + if (utils.nodeExists(aaiResponse, "role") && role.equals(utils.getNodeText(aaiResponse, "role"))) { + ar = aaiResponse + }else{ + msoLogger.debug("AAI AR does not match input role:" + role) + } + } + else + { + ar = aaiResponse + } + } + else + { + msoLogger.debug("GET AR Does NOT Contain Data" ) + } + }else if(responseCode == 404){ + msoLogger.debug("GET AR received a Not Found (404) Response") + } + else{ + msoLogger.debug(" GET AR received a Bad Response: \n" + aaiResponse) + buildAAIErrorResponse(execution, aaiResponse, "Error retrieving AR from AAI") + } + }catch(Exception e){ + msoLogger.debug(" Error encountered within GetAaiAR" + e.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in GetAaiAR" + e.getMessage()) + } + if (!isBlank(ar)) + { + execution.setVariable("aaiARGetResponse", ar) + execution.setVariable("aaiARPath", arUrl) + + String resourceVersion = null + if (utils.nodeExists(ar, "resource-version")) { + resourceVersion = utils.getNodeText(ar, "resource-version") + execution.setVariable("aaiARResourceVersion", resourceVersion) + } + + String orchStatus = null + if (utils.nodeExists(ar, "orchestration-status")) { + orchStatus= utils.getNodeText(ar, "orchestration-status") + } + else + { + orchStatus = " " + } + execution.setVariable("aaiAROrchStatus", orchStatus) + } + msoLogger.trace(" Exit GetARbyLink - AR:" + ar) + return ar + } + + public void updateAROrchStatus(DelegateExecution execution, String status, String aaiARPath){ + msoLogger.trace("updaAROrchStatus ") + try{ + + String updateReq = """ + { + "orchestration-status": "${status}" + } + """ + + msoLogger.debug('AAI AR URI: ' + aaiARPath) + + AaiUtil aaiUriUtil = new AaiUtil(taskProcessor) + APIResponse apiResponse = aaiUriUtil.executeAAIPatchCall(execution, aaiARPath, updateReq) + def aaiResponse = apiResponse.getResponseBodyAsString() + def responseCode = apiResponse.getStatusCode() + + msoLogger.debug("AAI Response Code: " + responseCode) + msoLogger.debug("AAI Response: " + aaiResponse) + if(responseCode == 200){ + msoLogger.debug("UpdateAR Good REST Response is: " + "\n" + aaiResponse) + }else{ + msoLogger.debug("UpdateAROrchStatus Bad REST Response!") + buildAAIErrorResponse(execution, aaiResponse, "Error updating AR OrchStatus in AAI") + } + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException ") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in updateAR.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage()); + exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error in updateAROrchStatus.' + e.getMessage()) + } + msoLogger.trace("Exit updateAROrchStatus ") + } + + //Sets Variable "wasDeleted" + public void deleteAR(DelegateExecution execution, String aaiARPath){ + msoLogger.trace(" deleteAR - aaiARPath:" + aaiARPath) + try { + AaiUtil aaiUriUtil = new AaiUtil(taskProcessor) + APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, aaiARPath) + int responseCode = response.getStatusCode() + execution.setVariable("deleteARResponseCode", responseCode) + + msoLogger.debug(" Delete AR response code:" + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("aaiARDeleteResponse", aaiResponse) + + msoLogger.debug("Delete AR Response:" + aaiResponse) + + //Process Response + if(responseCode == 204){ + msoLogger.debug(" Delete AR Received a Good Response") + execution.setVariable("wasDeleted", "true") + }else if(responseCode == 404){ + msoLogger.debug(" Delete AR Received a Not Found (404) Response") + }else if(responseCode == 412){ + msoLogger.debug("Delete AR Received a Resource Version Mismatch Error: \n" + aaiResponse) + exceptionUtil.buildAndThrowWorkflowException(execution, 412, "DeleteAR Received a resource-version Mismatch Error Response from AAI") + }else{ + msoLogger.debug("Delete AR Received a BAD REST Response: \n" + aaiResponse) + buildAAIErrorResponse(execution, aaiResponse, "Error deleting AR in AAI") + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug(" Error encountered in deleteAR!" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Delete AR") + } + msoLogger.trace("Exit deleteAR ") + } + + public void buildAAIErrorResponse(DelegateExecution execution, String response, String errorMessage){ + msoLogger.trace("BuildAAIErrorResponse") + + if((response != null) && (response.contains("Fault") || response.contains("RESTFault"))){ + WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(response, execution) + execution.setVariable("WorkflowException", workflowException) + }else{ + exceptionUtil.buildWorkflowException(execution, 500, errorMessage) + } + + msoLogger.trace("Exit BuildAAIErrorResponse Process") + throw new BpmnError("MSOWorkflowException") + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy new file mode 100644 index 0000000000..bb1de36eac --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy @@ -0,0 +1,159 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.onap.so.bpmn.core.UrnPropertiesReader + +import java.util.HashMap; +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.hibernate.event.internal.AbstractLockUpgradeEventListener +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.appc.ApplicationControllerOrchestrator +import org.onap.so.client.appc.ApplicationControllerOrchestratorException +import org.onap.appc.client.lcm.model.Action +import org.onap.appc.client.lcm.model.Status +import org.onap.so.bpmn.appc.payload.PayloadClient +import org.onap.so.client.appc.ApplicationControllerAction; +import groovy.transform.TypeChecked; +import java.util.UUID; +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +/** + * This groovy class supports the AppCClient.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - mso-request-Id + * @param - isDebugLogEnabled + * @param - requestId + * @param - vnfId + * @param - action + * @param - payload + * + * Outputs: + * @param - errorcode + * @param - errorText + * @param - responsePayload + * @param - healthCheckIndex + * @param - workstep + */ + +public class AppCClient extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AppCClient.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtils = new JsonUtils() + def prefix = "UPDVnfI_" + + public void preProcessRequest(DelegateExecution execution){ + + } + + public void runAppcCommand(DelegateExecution execution) { + msoLogger.trace("Start runCommand ") + def method = getClass().getSimpleName() + '.runAppcCommand(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + execution.setVariable("rollbackVnfStop", false) + execution.setVariable("rollbackVnfLock", false) + execution.setVariable("rollbackQuiesceTraffic", false) + String appcCode = "1002" + String responsePayload = "" + String appcMessage = "" + Action action = null + try { + action = (Action) execution.getVariable("action") + String vnfId = execution.getVariable('vnfId') + String msoRequestId = execution.getVariable('msoRequestId') + String vnfName = execution.getVariable('vnfName') + String aicIdentity = execution.getVariable('aicIdentity') + String vnfHostIpAddress = execution.getVariable('vnfHostIpAddress') + String vmIdList = execution.getVariable("vmIdList") + String vserverIdList = execution.getVariable("vserverIdList") + String identityUrl = execution.getVariable("identityUrl") + String controllerType = execution.getVariable("controllerType") + String vfModuleId = execution.getVariable("vfModuleId") + HashMap payloadInfo = new HashMap(); + payloadInfo.put("vnfName", vnfName) + payloadInfo.put("aicIdentity", aicIdentity) + payloadInfo.put("vnfHostIpAddress", vnfHostIpAddress) + payloadInfo.put("vmIdList", vmIdList) + payloadInfo.put("vserverIdList", vserverIdList) + payloadInfo.put("identityUrl", identityUrl) + payloadInfo.put("vfModuleId",vfModuleId) + Optional payload + msoLogger.debug("Running APP-C action: " + action.toString()) + msoLogger.debug("VNFID: " + vnfId) + execution.setVariable('msoRequestId', msoRequestId) + execution.setVariable("failedActivity", "APP-C") + execution.setVariable('workStep', action.toString()) + if(execution.getVariable("payload") != null){ + String pay = execution.getVariable("payload") + payload = Optional.of(pay) + } + if(action.equals(Action.HealthCheck)){ + String healthCheckIndex = execution.getVariable('healthCheckIndex') + execution.setVariable('workStep', action.toString() + healthCheckIndex) + execution.setVariable('healthCheckIndex', healthCheckIndex + 1) + } + ApplicationControllerAction client = new ApplicationControllerAction() + msoLogger.debug("Created Application Controller Action Object") + //PayloadInfo contains extra information that adds on to payload before making request to appc + client.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType) + msoLogger.debug("ran through the main method for Application Contoller") + appcCode = client.getErrorCode() + appcMessage = client.getErrorMessage() + } + catch (BpmnError e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + appcMessage = e.getMessage() + } + execution.setVariable("errorCode", appcCode) + if (appcCode == '0' && action != null) { + if (action.equals(Action.Lock)) { + execution.setVariable("rollbackVnfLock", true) + } + if (action.equals(Action.Unlock)) { + execution.setVariable("rollbackVnfLock", false) + } + if (action.equals(Action.Start)) { + execution.setVariable("rollbackVnfStop", true) + } + if (action.equals(Action.Stop)) { + execution.setVariable("rollbackVnfStop", false) + } + if (action.equals(Action.QuiesceTraffic)) { + execution.setVariable("rollbackQuiesceTraffic", true) + } + if (action.equals(Action.ResumeTraffic)) { + execution.setVariable("rollbackQuiesceTraffic", false) + } + } + execution.setVariable("errorText", appcMessage) + execution.setVariable("responsePayload", responsePayload) + msoLogger.debug("Error Message: " + appcMessage) + msoLogger.debug("ERROR CODE: " + execution.getVariable("errorCode")) + msoLogger.trace("End of runCommand ") + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy new file mode 100644 index 0000000000..9ce29dedb8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy @@ -0,0 +1,1311 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.json.JSONObject; +import org.json.JSONArray; +import org.json.XML +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.springframework.web.util.UriUtils; + +import org.onap.so.bpmn.core.json.JsonUtils + + +import groovy.json.JsonBuilder +import groovy.json.JsonSlurper +import groovy.util.slurpersupport.GPathResult +import groovy.xml.QName; + +import org.camunda.bpm.engine.delegate.DelegateExecution + +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.logger.MessageEnum + + + +/*** + * Utilities for accessing Catalog DB Adapter to retrieve Networks, VNF/VFModules, AllottedResources and complete ServiceResources information + * + */ + +class CatalogDbUtils { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CatalogDbUtils.class); + + + MsoUtils utils = new MsoUtils() + JsonUtils jsonUtils = new JsonUtils() + static private String defaultDbAdapterVersion = "v2" + + public JSONArray getAllNetworksByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + networksList = responseJson.getJSONArray("serviceNetworks") + } + else { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + networksList = responseJson.getJSONArray("serviceNetworks") + } + else { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + networksList = responseJson.getJSONArray("serviceNetworks") + } + else { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByNetworkModelCustomizationUuid(DelegateExecution execution, String networkModelCustomizationUuid) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByNetworkModelCustomizationUuid(DelegateExecution execution, String networkModelCustomizationUuid, String catalogUtilsVersion) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + networksList = responseJson.getJSONArray("serviceNetworks") + } + else { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByNetworkType(DelegateExecution execution, String networkType) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByNetworkType(DelegateExecution execution, String networkType, String catalogUtilsVersion) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + networksList = responseJson.getJSONArray("serviceNetworks") + } + else { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + + public JSONArray getAllVnfsByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) { + JSONArray vnfsList = null + String endPoint = "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllVnfsByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + vnfsList = responseJson.getJSONArray("serviceVnfs") + } + else { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllVnfsByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) { + JSONArray vnfsList = null + String endPoint ="/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllVnfsByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + vnfsList = responseJson.getJSONArray("serviceVnfs") + } + else { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + vnfsList = responseJson.getJSONArray("serviceVnfs") + } + else { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid) { + JSONArray vnfsList = null + String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + /** + * This method gets a all vnfs for a particular + * service from the catalog database using the + * service model's model name. + * + * @param catalogDbEndpoint + * @param serviceModelModelName + * @return vnfsList * + * + */ + public JSONArray getAllVnfsByServiceModelModelName(DelegateExecution execution, String serviceModelModelName) { + JSONArray vnfsList = null + String endPoint = "/serviceVnfs?serviceModelName=" + UriUtils.encode(serviceModelModelName, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", defaultDbAdapterVersion) + } + }catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + return vnfsList + } + + public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid, String catalogUtilsVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + vnfsList = responseJson.getJSONArray("serviceVnfs") + } + else { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + /** + * This method gets a single vf module from + * the catalog database using the vf module's + * model name. It returns that vf module as + * a JSONObject + * + * @param catalogDbEndpoint + * @param vfModuleModelName + * @return vfModule + */ + public JSONObject getVfModuleByVfModuleModelName(DelegateExecution execution, String vfModuleModelName) { + JSONObject vfModule = null + String endPoint = "/vfModules?vfModuleModelName=" + UriUtils.encode(vfModuleModelName, "UTF-8") + try{ + msoLogger.debug("Get VfModule By VfModule ModelName Endpoint is: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vfModule = parseVfModuleJson(catalogDbResponse, "vfModules", "v1") + } + } + catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vfModule + } + + /** + * This method gets a single vf module from + * the catalog database using the vf module's + * model name. It returns that vf module as + * a JSONObject + * + * @param catalogDbEndpoint + * @param vfModuleModelName + * @param catalogUtilsVersion + * @return vfModules + */ + public JSONObject getVfModuleByVfModuleModelName(DelegateExecution execution, String vfModuleModelName, String catalogUtilsVersion) { + JSONObject vfModule = null + String endPoint = "/vfModules?vfModuleModelName=" + UriUtils.encode(vfModuleModelName, "UTF-8") + try{ + msoLogger.debug("Get VfModule By VfModule ModelName Endpoint is: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vfModule = parseVfModuleJson(catalogDbResponse, "vfModules", "v1") + } + } + catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vfModule + } + + + public JSONArray getAllottedResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) { + JSONArray vnfsList = null + String endPoint = "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllottedResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) { + JSONArray vnfsList = null + String endPoint = "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + vnfsList = responseJson.getJSONArray("serviceAllottedResources") + } + else { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllottedResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) { + JSONArray vnfsList = null + String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllottedResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + vnfsList = responseJson.getJSONArray() + } + else { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getStackTrace()); + throw e + } + + return vnfsList + } + + public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + vnfsList = responseJson.getJSONArray("serviceAllottedResources") + } + else { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + + public JSONArray getAllottedResourcesByArModelCustomizationUuid(DelegateExecution execution, String arModelCustomizationUuid) { + JSONArray vnfsList = null + String endPoint = "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllottedResourcesByArModelCustomizationUuid(DelegateExecution execution, String arModelCustomizationUuid, String catalogUtilsVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + vnfsList = responseJson.getJSONArray("serviceAllottedResources") + } + else { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONObject getServiceResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) { + JSONObject resources = null + String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + + resources = parseServiceResourcesJson(catalogDbResponse, "v1") + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + throw e + } + + return resources + } + + public JSONObject getServiceResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) { + JSONObject resources = null + String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + resources = new JSONObject(catalogDbResponse) + } + else { + resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion) + } + } + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + throw e + } + + return resources + } + + public JSONObject getServiceResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) { + JSONObject resources = null + String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + + resources = parseServiceResourcesJson(catalogDbResponse, "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return resources + } + + public String getServiceResourcesByServiceModelInvariantUuidString(DelegateExecution execution, String serviceModelInvariantUuid) { + String resources = null + String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + + resources = catalogDbResponse + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return resources + } + + public JSONObject getServiceResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) { + JSONObject resources = null + String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + resources = new JSONObject(catalogDbResponse) + } + else { + resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return resources + } + + + public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) { + JSONObject resources = null + String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + //TODO this is wrong + resources = parseServiceResourcesJson(catalogDbResponse) + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return resources + } + + public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) { + JSONObject resources = null + String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + resources = new JSONObject(catalogDbResponse) + } + else { + resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return resources + } + + + + private JSONArray parseNetworksJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) { + JSONArray modelInfos = null + + msoLogger.debug("parseNetworksJson - catalogUtilsVersion is " + catalogUtilsVersion) + try { + // Create array of jsons + + JSONObject responseJson = new JSONObject(catalogDbResponse) + JSONArray networks = responseJson.getJSONArray(arrayName) + modelInfos = new JSONArray() + + for (int i = 0; i < networks.length(); i++) { + + JSONObject network = networks.getJSONObject(i) + JSONObject modelJson = new JSONObject() + JSONObject modelInfo = buildModelInfo("network", network, catalogUtilsVersion) + modelJson.put("modelInfo", modelInfo) + String networkType = jsonUtils.getJsonValueForKey(network, "networkType") + modelJson.put("networkType", networkType) + + switch (catalogUtilsVersion) { + case "v1": + break + default: + String toscaNodeType = jsonUtils.getJsonValueForKey(network, "toscaNodeType") + modelJson.put("toscaNodeType", toscaNodeType) + String networkTechnology = jsonUtils.getJsonValueForKey(network, "networkTechnology") + modelJson.put("networkTechnology", networkTechnology) + String networkRole = jsonUtils.getJsonValueForKey(network, "networkRole") + modelJson.put("networkRole", networkRole) + String networkScope = jsonUtils.getJsonValueForKey(network, "networkScope") + modelJson.put("networkScope", networkScope) + break + } + modelInfos.put(modelJson) + } + + String modelInfosString = modelInfos.toString() + msoLogger.debug("Returning networks JSON: " + modelInfosString) + + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + } + + return modelInfos + } + + private JSONArray parseVnfsJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) { + JSONArray modelInfos = null + + msoLogger.debug("parseVnfsJson - catalogUtilsVersion is " + catalogUtilsVersion) + + try { + // Create array of jsons + + JSONObject responseJson = new JSONObject(catalogDbResponse) + JSONArray vnfs = responseJson.getJSONArray(arrayName) + modelInfos = new JSONArray() + + for (int i = 0; i < vnfs.length(); i++) { + JSONObject vnf = vnfs.getJSONObject(i) + + msoLogger.debug(vnf.toString(2)) + JSONObject modelInfo = buildModelInfo("vnf", vnf, catalogUtilsVersion) + JSONObject modelJson = new JSONObject() + modelJson.put("modelInfo", modelInfo) + switch(catalogUtilsVersion) { + case "v1": + break + default: + String toscaNodeType = jsonUtils.getJsonValueForKey(vnf, "toscaNodeType") + modelJson.put("toscaNodeType", toscaNodeType) + String nfType = jsonUtils.getJsonValueForKey(vnf, "nfType") + modelJson.put("nfType", nfType) + String nfRole = jsonUtils.getJsonValueForKey(vnf, "nfRole") + modelJson.put("nfRole", nfRole) + String nfCode = jsonUtils.getJsonValueForKey(vnf, "nfCode") + modelJson.put("nfNamingCode", nfCode) + String nfFunction = jsonUtils.getJsonValueForKey(vnf, "nfFunction") + modelJson.put("nfFunction", nfFunction) + String multiStageDesign = jsonUtils.getJsonValueForKey(vnf, "multiStageDesign") + modelJson.put("multiStageDesign", multiStageDesign) + break + } + + JSONArray vfModules = null + try { + vfModules = vnf.getJSONArray("vfModules") + } catch (Exception e) + { + msoLogger.debug("Cannot find VF MODULE ARRAY: " + i + ", exception is " + e.message) + } + + if (vfModules != null) { + JSONArray vfModuleInfo = new JSONArray() + for (int j = 0; j < vfModules.length(); j++) { + JSONObject vfModule = vfModules.getJSONObject(j) + JSONObject vfModuleModelInfo = buildModelInfo("vfModule", vfModule, catalogUtilsVersion) + JSONObject vfModuleModelJson = new JSONObject() + vfModuleModelJson.put("modelInfo", vfModuleModelInfo) + String vfModuleType = jsonUtils.getJsonValueForKey(vfModule, "type") + vfModuleModelJson.put("vfModuleType", vfModuleType) + switch(catalogUtilsVersion) { + case "v1": + //TODO this does not work, isBase is not a integer. + Integer isBase = jsonUtils.getJsonIntValueForKey(vfModule, "isBase") + if (isBase.intValue() == 1) { + vfModuleModelJson.put("isBase", "true") + } + else { + vfModuleModelJson.put("isBase", "false") + } + break + default: + boolean isBase = jsonUtils.getJsonBooleanValueForKey(vfModule, "isBase") + vfModuleModelJson.put("isBase", isBase) + break + } + String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label") + vfModuleModelJson.put("vfModuleLabel", vfModuleLabel) + Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount") + vfModuleModelJson.put("initialCount", initialCount.intValue()) + vfModuleInfo.put(vfModuleModelJson) + } + modelJson.put("vfModules", vfModuleInfo) + } + modelInfos.put(modelJson) + } + + String modelInfosString = modelInfos.toString() + msoLogger.debug("Returning vnfs JSON: " + modelInfosString) + + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + } + + return modelInfos + } + + /** + * This method parses a Vf Module from the + * Vf Modules array + * + * @param catalogDbResponse + * @param arrayName + * @param catalogUtilsVersion + * @return vfModulelJson + */ + private JSONObject parseVfModuleJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) { + JSONObject vfModulelJson = new JSONObject() + msoLogger.debug("Started Parse Vf Module Json") + try { + JSONObject responseJson = new JSONObject(catalogDbResponse) + JSONArray vfModules = responseJson.getJSONArray(arrayName) + if(vfModules != null){ + JSONObject vfModuleInfo = new JSONObject() + for (int i = 0; i < vfModules.length(); i++) { + JSONObject vfModule = vfModules.getJSONObject(i) + JSONObject vfModuleModelInfo = buildModelInfo("vfModule", vfModule, catalogUtilsVersion) + vfModulelJson.put("modelInfo", vfModuleModelInfo) + String vfModuleType = jsonUtils.getJsonValueForKey(vfModule, "type") + vfModulelJson.put("vfModuleType", vfModuleType) + switch(catalogUtilsVersion) { + case "v1": + Integer isBase = jsonUtils.getJsonIntValueForKey(vfModule, "isBase") + if (isBase.intValue() == 1) { + vfModulelJson.put("isBase", "true") + } + else { + vfModulelJson.put("isBase", "false") + } + break + default: + boolean isBase = jsonUtils.getJsonBooleanValueForKey(vfModule, "isBase") + vfModulelJson.put("isBase", isBase) + break + } + String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label") + vfModulelJson.put("vfModuleLabel", vfModuleLabel) + Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount") + vfModulelJson.put("initialCount", initialCount.intValue()) + } + } + msoLogger.debug("Completed Parsing Vf Module: " + vfModulelJson.toString()) + }catch (Exception e){ + msoLogger.debug("Exception while parsing Vf Modules from Catalog DB Response: " + e.message) + } + + return vfModulelJson + } + + private JSONArray parseAllottedResourcesJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) { + JSONArray modelInfos = null + + msoLogger.debug("parseAllottedResourcesJson - catalogUtilsVersion is " + catalogUtilsVersion) + + try { + // Create array of jsons + + JSONObject responseJson = new JSONObject(catalogDbResponse) + JSONArray allottedResources = responseJson.getJSONArray(arrayName) + modelInfos = new JSONArray() + + for (int i = 0; i < allottedResources.length(); i++) { + JSONObject allottedResource = allottedResources.getJSONObject(i) + JSONObject modelInfo = buildModelInfo("allottedResource", allottedResource, catalogUtilsVersion) + JSONObject modelJson = new JSONObject() + modelJson.put("modelInfo", modelInfo) + switch(catalogUtilsVersion) { + case "v1": + break + default: + String toscaNodeType = jsonUtils.getJsonValueForKey(allottedResource, "toscaNodeType") + modelJson.put("toscaNodeType", toscaNodeType) + String nfType = jsonUtils.getJsonValueForKey(allottedResource, "nfType") + modelJson.put("nfType", nfType) + String nfRole = jsonUtils.getJsonValueForKey(allottedResource, "nfRole") + modelJson.put("nfRole", nfRole) + String nfCode = jsonUtils.getJsonValueForKey(allottedResource, "nfCode") + modelJson.put("nfNamingCode", nfCode) + String nfFunction = jsonUtils.getJsonValueForKey(allottedResource, "nfFunction") + modelJson.put("nfFunction", nfFunction) + String providingServiceModelName = jsonUtils.getJsonValueForKey(allottedResource, "providingServiceModelName") + modelJson.put("providingServiceModelName", providingServiceModelName) + String providingServiceModelUuid = jsonUtils.getJsonValueForKey(allottedResource, "providingServiceModelUuid") + modelJson.put("providingServiceModelUuid", providingServiceModelUuid) + break + } + + + modelInfos.put(modelJson) + } + + String modelInfosString = modelInfos.toString() + msoLogger.debug("Returning allottedResources JSON: " + modelInfosString) + + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + } + + return modelInfos + } + + //TODO this is wrong + private JSONObject parseServiceResourcesJson (String catalogDbResponse) { + JSONObject serviceResources = new JSONObject() + String catalogUtilsVersion = "v1" + + try { + // Create array of jsons + + JSONObject responseJson = new JSONObject(catalogDbResponse) + JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources") + JSONArray vnfsArray = parseVnfsJson(serviceResourcesRoot.toString(), "vnfResources", catalogUtilsVersion) + serviceResources.put("vnfs", vnfsArray) + JSONArray networksArray = parseNetworksJson(serviceResourcesRoot.toString(), "networkResourceCustomization", catalogUtilsVersion) + serviceResources.put("networks", networksArray) + JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "allottedResourceCustomization", catalogUtilsVersion) + serviceResources.put("allottedResources", allottedResourcesArray) + + String serviceResourcesString = serviceResources.toString() + msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesString) + + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + } + + return serviceResources + } + + private JSONObject parseServiceResourcesJson (String catalogDbResponse, String catalogUtilsVersion) { + JSONObject serviceResources = new JSONObject() + JSONObject serviceResourcesObject = new JSONObject() + String serviceResourcesString = "" + + try { + // Create array of jsons + + JSONObject responseJson = new JSONObject(catalogDbResponse) + JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources") + JSONObject modelInfo = buildModelInfo("", serviceResourcesRoot, catalogUtilsVersion) + serviceResources.put("modelInfo", modelInfo) + JSONArray vnfsArray = parseVnfsJson(serviceResourcesRoot.toString(), "serviceVnfs", catalogUtilsVersion) + serviceResources.put("serviceVnfs", vnfsArray) + JSONArray networksArray = parseNetworksJson(serviceResourcesRoot.toString(), "serviceNetworks", catalogUtilsVersion) + serviceResources.put("serviceNetworks", networksArray) + JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "serviceAllottedResources", catalogUtilsVersion) + serviceResources.put("serviceAllottedResources", allottedResourcesArray) + serviceResourcesObject.put("serviceResources", serviceResources) + + serviceResourcesString = serviceResourcesObject.toString() + msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesString) + + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + } + + return serviceResourcesObject + } + + private JSONObject buildModelInfo(String modelType, JSONObject modelFromDb, String catalogUtilsVersion) { + JSONObject modelInfo = null + try { + modelInfo = new JSONObject() + modelInfo.put("modelType", modelType) + String modelInvariantId = jsonUtils.getJsonValueForKey(modelFromDb, "modelInvariantUuid") + modelInfo.put("modelInvariantId", modelInvariantId) + if(modelType.equalsIgnoreCase("allottedResource") || modelType.equalsIgnoreCase("vnf")){ + String modelInstanceName = jsonUtils.getJsonValueForKey(modelFromDb, "modelInstanceName") + modelInfo.put("modelInstanceName", modelInstanceName) + } + if ((!"vfModule".equals(modelType) && !"vnf".equals(modelType)) || !catalogUtilsVersion.equals("v1")) { + String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "modelUuid") + modelInfo.put("modelVersionId", modelVersionId) + } + else { + String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "asdcUuid") + modelInfo.put("modelVersionId", modelVersionId) + } + String modelName = jsonUtils.getJsonValueForKey(modelFromDb, "modelName") + modelInfo.put("modelName", modelName) + String modelVersion = jsonUtils.getJsonValueForKey(modelFromDb, "modelVersion") + modelInfo.put("modelVersion", modelVersion) + if (!"vfModule".equals(modelType)) { + String modelCustomizationName = jsonUtils.getJsonValueForKey(modelFromDb, "modelCustomizationName") + modelInfo.put("modelCustomizationName", modelCustomizationName) + } + String modelCustomizationId = jsonUtils.getJsonValueForKey(modelFromDb, "modelCustomizationUuid") + switch (catalogUtilsVersion) { + case "v1": + modelInfo.put("modelCustomizationId", modelCustomizationId) + break + default: + modelInfo.put("modelCustomizationUuid", modelCustomizationId) + break + } + JSONObject modelJson = new JSONObject() + modelJson.put("modelInfo", modelInfo) + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception while parsing model information", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + } + return modelInfo + } + + private String getResponseFromCatalogDb (DelegateExecution execution, String endPoint) { + try { + + String catalogDbEndpoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint",execution) + String queryEndpoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + endPoint + RESTConfig config = new RESTConfig(queryEndpoint); + def responseData = '' + def bpmnRequestId = UUID.randomUUID().toString() + RESTClient client = new RESTClient(config). + addHeader('X-TransactionId', bpmnRequestId). + addHeader('X-FromAppId', 'BPMN'). + addHeader('Content-Type', 'application/json'). + addHeader('Accept','application/json'); + + String basicAuthCred = execution.getVariable("BasicAuthHeaderValueDB") + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + }else { + client.addAuthorizationHeader(getBasicDBAuthHeader(execution)) + } + msoLogger.debug('sending GET to Catalog DB endpoint: ' + endPoint) + APIResponse response = client.httpGet() + + responseData = response.getResponseBodyAsString() + if (responseData != null) { + msoLogger.debug("Received data from Catalog DB: " + responseData) + } + + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + if (response.getStatusCode() == 200) { + // parse response as needed + return responseData + } + else { + return null + } + } + catch (Exception e) { + msoLogger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message) + throw e + } + + } + + /** + * get resource recipe by resource model uuid and action + */ + public JSONObject getResourceRecipe(DelegateExecution execution, String resourceModelUuid, String action) { + String endPoint = "/resourceRecipe?resourceModelUuid=" + UriUtils.encode(resourceModelUuid, "UTF-8")+ "&action=" + UriUtils.encode(action, "UTF-8") + JSONObject responseJson = null + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + responseJson = new JSONObject(catalogDbResponse) + } + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + throw e + } + + return responseJson + } + + private String getBasicDBAuthHeader(DelegateExecution execution) { + + String encodedString = null + try { + String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution) + utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB) + + encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable("BasicAuthHeaderValueDB",encodedString) + } catch (IOException ex) { + String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() + utils.log("ERROR", dataErrorMessage) + } + return encodedString + } + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy new file mode 100644 index 0000000000..9c4c73fb7d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy @@ -0,0 +1,311 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +public class CompleteMsoProcess extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CompleteMsoProcess.class); + + String Prefix="CMSO_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + // Complete MSO Request processing + public initializeProcessVariables(DelegateExecution execution){ + + def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + try { + + /* Initialize all the process request variables in this block */ + execution.setVariable("prefix",Prefix) + execution.setVariable("CMSO_request_id","") + execution.setVariable("CMSO_notification-url","") + execution.setVariable("CMSO_mso-bpel-name","") + execution.setVariable("CMSO_request_action","") + execution.setVariable("CMSO_notification-url-Ok", false) + execution.setVariable("CMSO_request_id-Ok", false) + + //updateRequest Adapter process variables + execution.setVariable("CMSO_updateRequestResponse", "") + execution.setVariable("CMSO_updateRequestResponseCode", "") + execution.setVariable("CMSO_updateFinalNotifyAckStatusFailedPayload", "") + + //Set DB adapter variables here + execution.setVariable("CMSO_updateDBStatusToSuccessPayload", "") + execution.setVariable("CMSO_updateInfraRequestDBPayload", "") + execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", "") + + //Auth variables + execution.setVariable("BasicAuthHeaderValue","") + + //Response variables + execution.setVariable("CompletionHandlerResponse","") + execution.setVariable("CMSO_ErrorResponse", null) + execution.setVariable("CMSO_ResponseCode", "") + + setSuccessIndicator(execution, false) + + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + } + + } + + public void preProcessRequest (DelegateExecution execution) { + + initializeProcessVariables(execution) + def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' + // msoLogger.trace("Started CompleteMsoProcess preProcessRequest Method "); + msoLogger.trace('Entered ' + method) + + setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled')) + + try { + def xml = execution.getVariable("CompleteMsoProcessRequest") + + msoLogger.debug("CompleteMsoProcess Request: " + xml) + msoLogger.debug("Incoming Request is: "+ xml) + + //mso-bpel-name from the incoming request + def msoBpelName = utils.getNodeText(xml,"mso-bpel-name") + execution.setVariable("CMSO_mso-bpel-name",msoBpelName) + + //Check the incoming request type + //Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node) + if (utils.nodeExists(xml, "request-information")) { + execution.setVariable("CMSO_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS + } + + //Check for rehome indicator + def rehomeIndicator = utils.getNodeText(xml,"rehomeDone") + execution.setVariable("rehomeDone", rehomeIndicator) + + //Check notification-url for the incoming request type + //ACTIVE_REQUESTS may have notificationurl node + //INFRA_ACTIVE_REQUESTS notificationurl node does not exist + def notificationurl = "" + if (utils.nodeExists(xml, "notification-url")) { + notificationurl = utils.getNodeText(xml,"notification-url") + if(notificationurl != null && !notificationurl.isEmpty()) { + execution.setVariable("CMSO_notification-url-Ok", true) + execution.setVariable("CMSO_notification-url",notificationurl) + } + } + + //Check request_id for the incoming request type + //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not) + //For ACTIVE_REQUESTS payload request-id is NOT optional + def request_id = "" + if (utils.nodeExists(xml, "request-id")) { + execution.setVariable("CMSO_request_id",utils.getNodeText(xml,"request-id")) + } + + + // INFRA_ACTIVE_REQUESTS have "action" element ... mandatory + // ACTIVE_REQUEST have "request-action" ... mandatory + if (utils.nodeExists(xml, "request-action")) { + execution.setVariable("CMSO_request_action",utils.getNodeText(xml,"request-action")) + } else if (utils.nodeExists(xml, "action")) { + execution.setVariable("CMSO_request_action",utils.getNodeText(xml,"action")) + } + + //Check source for the incoming request type + //For INFRA_ACTIVE_REQUESTS payload source IS optional + //For ACTIVE_REQUESTS payload source is NOT optional + def source = "" + if (utils.nodeExists(xml, "source")) { + execution.setVariable("CMSO_source",utils.getNodeText(xml,"source")) + } + + msoLogger.trace("--> " + execution.getVariable("")) + msoLogger.trace("--> " + execution.getVariable("")) + + // set the DHV/Service Instantiation values if specified in the request + execution.setVariable("CMSO_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText(xml, "is-srv-inst-req")))) + msoLogger.trace("--> " + execution.getVariable("")) + execution.setVariable("CMSO_is_json_content", String.valueOf("JSON".equals(utils.getNodeText(xml, "resp-content-type")))) + msoLogger.trace("--> " + execution.getVariable("")) + execution.setVariable("CMSO_service_inst_id", utils.getNodeText(xml, "service-instance-id")) + msoLogger.trace("--> " + execution.getVariable("")) + execution.setVariable("CMSO_start_time", utils.getNodeText(xml, "start-time")) + msoLogger.trace("--> " + execution.getVariable("")) + // this variable is used by the camunda flow to set the Content-Type for the async response + if (execution.getVariable("CMSO_is_srv_inst_req").equals("true") && + execution.getVariable("CMSO_is_json_content").equals("true")) { + execution.setVariable("CMSO_content_type", "application/json") + } else { + execution.setVariable("CMSO_content_type", "text/xml") + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.debug("Exception Occured During PreProcessRequest: " + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + } + +// msoLogger.trace("Completed CompleteMsoProcess preProcessRequest Method "); + } + + public void setUpdateDBstatustoSuccessPayload (DelegateExecution execution){ + + def method = getClass().getSimpleName() + '.setUpdateDBstatustoSuccessPayload(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + + try { + + def xml = execution.getVariable("CompleteMsoProcessRequest") + + //Get statusMessage if exists + def statusMessage + if(utils.nodeExists(xml, "status-message")){ + statusMessage = utils.getNodeText(xml, "status-message") + }else{ + statusMessage = "Resource Completed Successfully" + } + + //Get instance Id if exist + String idXml = "" + if(utils.nodeExists(xml, "vnfId")){ + idXml = utils.getNodeXml(xml, "vnfId") + }else if(utils.nodeExists(xml, "networkId")){ + idXml = utils.getNodeXml(xml, "networkId") + }else if(utils.nodeExists(xml, "configurationId")){ + idXml = utils.getNodeXml(xml, "configurationId") + }else if(utils.nodeExists(xml, "serviceInstanceId")){ + idXml = utils.getNodeXml(xml, "serviceInstanceId") + }else if(utils.nodeExists(xml, "vfModuleId")){ + idXml = utils.getNodeXml(xml, "vfModuleId") + }else if(utils.nodeExists(xml, "volumeGroupId")){ + idXml = utils.getNodeXml(xml, "volumeGroupId") + }else{ + idXml = "" + } + idXml = utils.removeXmlPreamble(idXml) + msoLogger.debug("Incoming Instance Id Xml: " + idXml) + + String payload = """ + + + + + ${MsoUtils.xmlEscape(execution.getVariable("CMSO_request_id"))} + ${MsoUtils.xmlEscape(execution.getVariable("CMSO_mso-bpel-name"))} + ${MsoUtils.xmlEscape(statusMessage)} + COMPLETE + 100 + ${idXml} + + + """ + + execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", payload) + msoLogger.debug("Outgoing Update Mso Request Payload is: " + payload) + msoLogger.debug("setUpdateDBstatustoSuccessPayload: " + payload) + + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + } + msoLogger.trace('Exited ' + method) + } + + public void buildDataError (DelegateExecution execution, String message) { + + def method = getClass().getSimpleName() + '.buildDataError(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + try { + + def msoCompletionResponse = """ + + BPEL ${execution.getVariable("CMSO_mso-bpel-name")} FAILED + + """.trim() + + // Format Response + def xmlMsoCompletionResponse = utils.formatXml(msoCompletionResponse) + String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim() + msoLogger.debug("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString) + execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString) + msoLogger.debug("@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompletionHandlerResponse")) + + exceptionUtil.buildAndThrowWorkflowException(execution, 500, message) + + } catch (BpmnError e) { + msoLogger.debug("Rethrowing MSOWorkflowException") + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + } + + } + + public void postProcessResponse (DelegateExecution execution) { + + def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + // msoLogger.trace("Started CompleteMsoProcess PostProcessRequest Method "); + try { + + def msoCompletionResponse = """ + + BPEL ${execution.getVariable("CMSO_mso-bpel-name")} completed + + """.trim() + + // Format Response + def xmlMsoCompletionResponse = utils.formatXML(msoCompletionResponse) + String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim() + // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead + execution.setVariable("WorkflowResponse", buildMsoCompletionResponseAsString) + msoLogger.debug("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString) + execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString) + execution.setVariable("CMSO_ResponseCode", "200") + + setSuccessIndicator(execution, true) + + msoLogger.debug("@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompleteMsoProcessResponse")) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + } + // msoLogger.trace("Completed CompleteMsoProcess PostProcessRequest Method "); + + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy new file mode 100644 index 0000000000..8b786bc152 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy @@ -0,0 +1,152 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.rest.APIResponse +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ConfirmVolumeGroupName.class); + + def Prefix="CVGN_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + execution.setVariable("CVGN_volumeGroupId",null) + execution.setVariable("CVGN_volumeGroupName",null) + execution.setVariable("CVGN_aicCloudRegion", null) + execution.setVariable("CVGN_volumeGroupGetEndpoint",null) + + // ConfirmVolumeGroupName workflow response variable placeholders + execution.setVariable("CVGN_volumeGroupNameMatches", false) + execution.setVariable("CVGN_queryVolumeGroupResponseCode",null) + execution.setVariable("CVGN_queryVolumeGroupResponse","") + execution.setVariable("CVGN_ResponseCode",null) +// execution.setVariable("CVGN_ErrorResponse","") + execution.setVariable("RollbackData", null) + } + + // store the incoming data in the flow DelegateExecution + public void preProcessRequest(DelegateExecution execution) { + def volumeGroupId = execution.getVariable("ConfirmVolumeGroupName_volumeGroupId") + def volumeGroupName= execution.getVariable("ConfirmVolumeGroupName_volumeGroupName") + def aicCloudRegion = execution.getVariable("ConfirmVolumeGroupName_aicCloudRegion") + + initProcessVariables(execution) + execution.setVariable("CVGN_volumeGroupId", volumeGroupId) + execution.setVariable("CVGN_volumeGroupName", volumeGroupName) + execution.setVariable("CVGN_aicCloudRegion", aicCloudRegion) + + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getCloudInfrastructureCloudRegionUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + msoLogger.debug("AAI URI: " + aai_uri) + execution.setVariable("CVGN_volumeGroupGetEndpoint","${aai_uri}/${aicCloudRegion}/volume-groups/volume-group/" + + volumeGroupId) + } + + // send a GET request to AA&I to retrieve the Volume information based on volume-group-id + // expect a 200 response with the information in the response body or a 404 if the volume group id does not exist + public void queryAAIForVolumeGroupId(DelegateExecution execution) { + def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("CVGN_volumeGroupGetEndpoint") + + try { + msoLogger.debug("invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint) + msoLogger.debug("queryAAIForVolumeGroupId() endpoint-" + endPoint) + msoLogger.debug("ConfirmVolumeGroup sending GET call to AAI Endpoint: " + endPoint) + + AaiUtil aaiUtil = new AaiUtil(this) + APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) + def responseData = response.getResponseBodyAsString() + def responseStatusCode = response.getStatusCode() + execution.setVariable("CVGN_queryVolumeGroupResponseCode", responseStatusCode) + execution.setVariable("CVGN_queryVolumeGroupResponse", responseData) + + msoLogger.debug("Response code:" + responseStatusCode) + msoLogger.debug("Response:" + responseData) + msoLogger.debug("Response code:" + responseStatusCode) + msoLogger.debug("Response:" + System.lineSeparator()+responseData) + } catch (Exception ex) { + // ex.printStackTrace() + msoLogger.debug("Exception occurred while executing AAI GET:" + ex.getMessage()) + execution.setVariable("CVGN_queryVolumeGroupResponseCode", 500) + execution.setVariable("CVGN_queryVolumeGroupResponse", "AAI GET Failed:" + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "AAI GET Failed") + } + } + + // process the result from queryAAIVolumeGroupId() + + public void checkAAIQueryResult(DelegateExecution execution) { + def result = execution.getVariable("CVGN_queryVolumeGroupResponse") + + if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 404) { + msoLogger.debug('volumeGroupId does not exist in AAI') + } + else if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 200) { + msoLogger.debug("volumeGroupId exists in AAI") + } + def xml = execution.getVariable("CVGN_queryVolumeGroupResponse") + def actualVolumeGroupName = "" + if (utils.nodeExists(xml, "volume-group-name")) { + actualVolumeGroupName = utils.getNodeText(xml, "volume-group-name") + } + execution.setVariable("CVGN_volumeGroupNameMatches", false) + def volumeGroupName = execution.getVariable("CVGN_volumeGroupName") + + if (volumeGroupName.equals(actualVolumeGroupName)) { + msoLogger.debug('Volume Group Name Matches AAI records') + execution.setVariable("CVGN_volumeGroupNameMatches", true) + } + } + + + // generates a WorkflowException if the A&AI query returns a response code other than 200/404 + public void handleAAIQueryFailure(DelegateExecution execution) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CVGN_queryVolumeGroupResponseCode"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "ErrorResponse is:\n" + execution.getVariable("CVGN_queryVolumeGroupResponse")); + //String processKey = getProcessKey(execution); + //WorkflowException exception = new WorkflowException(processKey, 5000, + //execution.getVariable("CVGN_queryVolumeGroupResponse")) + //execution.setVariable("WorkflowException", exception) + } + + // generates a WorkflowException if the volume group name does not match AAI record for this volume group + public void handleVolumeGroupNameNoMatch(DelegateExecution execution) { + def errorNotAssociated = "Error occurred - volume group id " + execution.getVariable("CVGN_volumeGroupId") + + " is not associated with " + execution.getVariable("CVGN_volumeGroupName") + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, errorNotAssociated, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated) + //String processKey = getProcessKey(execution); + //WorkflowException exception = new WorkflowException(processKey, 1002, + // errorNotAssociated) + //execution.setVariable("WorkflowException", exception) + } + + // sends a successful WorkflowResponse + public void reportSuccess(DelegateExecution execution) { + msoLogger.debug("Sending 200 back to the caller") + def responseXML = "" + execution.setVariable("WorkflowResponse", responseXML) + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy new file mode 100644 index 0000000000..c0ed81c553 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy @@ -0,0 +1,193 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.onap.so.bpmn.core.UrnPropertiesReader + +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.rest.APIResponse +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +/** + * Vnf Module Subflow for confirming the volume group belongs + * to the tenant + * + * @param tenantId + * @param volumeGroupId + * + */ +class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ConfirmVolumeGroupTenant.class); + + String Prefix="CVGT_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void preProcessRequest(DelegateExecution execution){ + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED Confirm Volume Group Tenant Subflow ") + String processKey = getProcessKey(execution); + try{ + msoLogger.trace("Started QueryAAIForVolumeGroup Process ") + + String volumeGroupId = execution.getVariable("volumeGroupId") + String incomingGroupName = execution.getVariable("volumeGroupName") + String incomingTenantId = execution.getVariable("tenantId") + def aicCloudRegion = execution.getVariable("aicCloudRegion") + String aai = UrnPropertiesReader.getVariable("aai.endpoint", execution) + + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getCloudInfrastructureCloudRegionUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + String path = aai + "${aai_uri}/${aicCloudRegion}/volume-groups/volume-group/" + volumeGroupId + + APIResponse queryAAIForVolumeGroupResponse = aaiUriUtil.executeAAIGetCall(execution, path) + + def responseCode = queryAAIForVolumeGroupResponse.getStatusCode() + execution.setVariable("queryVolumeGroupResponseCode", responseCode) + String response = queryAAIForVolumeGroupResponse.getResponseBodyAsString() + + msoLogger.debug("ConfirmVolumeGroup Response: " + response) + msoLogger.debug("ConfirmVolumeGroup Response Code: " + responseCode) + + if(responseCode == 200 && response != null){ + execution.setVariable("queryAAIVolumeGroupResponse", response) + msoLogger.debug("QueryAAIForVolumeGroup Received a Good REST Response is: \n" + response) + + String volumeGroupTenantId = "" + InputSource source = new InputSource(new StringReader(response)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document createVCERequestXml = docBuilder.parse(source) + NodeList nodeList = createVCERequestXml.getElementsByTagNameNS("*", "relationship") + for (int x = 0; x < nodeList.getLength(); x++) { + Node node = nodeList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String e = eElement.getElementsByTagNameNS("*", "related-to").item(0).getTextContent() + if(e.equals("tenant")){ + NodeList relationDataList = eElement.getElementsByTagNameNS("*", "relationship-data") + for (int d = 0; d < relationDataList.getLength(); d++) { + Node dataNode = relationDataList.item(d) + if (dataNode.getNodeType() == Node.ELEMENT_NODE) { + Element dElement = (Element) dataNode + String key = dElement.getElementsByTagNameNS("*", "relationship-key").item(0).getTextContent() + if(key.equals("tenant.tenant-id")){ + volumeGroupTenantId = dElement.getElementsByTagNameNS("*", "relationship-value").item(0).getTextContent() + } + } + } + } + } + } + + //Determine if Tenant Ids match + if(incomingTenantId.equals(volumeGroupTenantId)){ + msoLogger.debug("Tenant Ids Match") + execution.setVariable("tenantIdsMatch", true) + }else{ + msoLogger.debug("Tenant Ids DO NOT Match") + execution.setVariable("tenantIdsMatch", false) + } + + //Determine if Volume Group Names match + String volumeGroupName = utils.getNodeText(response, "volume-group-name") + if(incomingGroupName == null || incomingGroupName.length() < 1){ + msoLogger.debug("Incoming Volume Group Name is NOT Provided.") + execution.setVariable("groupNamesMatch", true) + }else{ + msoLogger.debug("Incoming Volume Group Name is: " + incomingGroupName) + if(volumeGroupName.equals(incomingGroupName)){ + msoLogger.debug("Volume Group Names Match.") + execution.setVariable("groupNamesMatch", true) + }else{ + msoLogger.debug("Volume Group Names DO NOT Match.") + execution.setVariable("groupNamesMatch", false) + } + } + }else{ + msoLogger.debug("QueryAAIForVolumeGroup Bad REST Response!") + exceptionUtil.buildAndThrowWorkflowException(execution, 1, "Error Searching AAI for Volume Group. Received a Bad Response.") + } + + }catch(BpmnError b){ + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing queryAAIForVolumeGroup.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in preProcessRequest.") + } + msoLogger.trace("COMPLETED queryAAIForVolumeGroup Process ") + } + + public void assignVolumeHeatId(DelegateExecution execution){ + execution.setVariable("prefix", Prefix) + try{ + msoLogger.trace("Started assignVolumeHeatId Process ") + + String response = execution.getVariable("queryAAIVolumeGroupResponse") + String heatStackId = utils.getNodeText(response, "heat-stack-id") + execution.setVariable("volumeHeatStackId", heatStackId) + execution.setVariable("ConfirmVolumeGroupTenantResponse", heatStackId) + // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead + execution.setVariable("WorkflowResponse", heatStackId) + msoLogger.debug("Volume Heat Stack Id is: " + heatStackId) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing assignVolumeHeatId.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in assignVolumeHeatId.") + } + msoLogger.trace("COMPLETED assignVolumeHeatId Process ") + msoLogger.trace("COMPLETED Confirm Volume Group Tenant Subflow ") +} + + public void assignWorkflowException(DelegateExecution execution, String message){ + execution.setVariable("prefix", Prefix) + String processKey = getProcessKey(execution); + msoLogger.trace("STARTED Assign Workflow Exception ") + try{ + String volumeGroupId = execution.getVariable("volumeGroupId") + int errorCode = 1 + String errorMessage = "Volume Group " + volumeGroupId + " " + message + + exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage) + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing assignWorkflowException.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + } + msoLogger.trace("COMPLETED Assign Workflow Exception =") + } + + + +} + diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy new file mode 100644 index 0000000000..84dd70682d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy @@ -0,0 +1,612 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils + +public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateAAIVfModule.class); + + def Prefix="CAAIVfMod_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + execution.setVariable("CAAIVfMod_vnfId",null) + execution.setVariable("CAAIVfMod_vnfName",null) + execution.setVariable("CAAIVfMod_vnfType",null) + execution.setVariable("CAAIVfMod_serviceId",null) + execution.setVariable("CAAIVfMod_personaId",null) + execution.setVariable("CAAIVfMod_personaVer",null) + execution.setVariable("CAAIVfMod_modelCustomizationId",null) + execution.setVariable("CAAIVfMod_vnfPersonaId",null) + execution.setVariable("CAAIVfMod_vnfPersonaVer",null) + execution.setVariable("CAAIVfMod_isBaseVfModule", false) + execution.setVariable("CAAIVfMod_moduleName",null) + execution.setVariable("CAAIVfMod_moduleModelName",null) + execution.setVariable("CAAIVfMod_newGenericVnf",false) + execution.setVariable("CAAIVfMod_genericVnfGetEndpoint",null) + execution.setVariable("CAAIVfMod_genericVnfPutEndpoint",null) + execution.setVariable("CAAIVfMod_aaiNamespace",null) + execution.setVariable("CAAIVfMod_moduleExists",false) + execution.setVariable("CAAIVfMod_baseModuleConflict", false) + execution.setVariable("CAAIVfMod_vnfNameFromAAI", null) + + + // CreateAAIVfModule workflow response variable placeholders + execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode",null) + execution.setVariable("CAAIVfMod_queryGenericVnfResponse","") + execution.setVariable("CAAIVfMod_createGenericVnfResponseCode",null) + execution.setVariable("CAAIVfMod_createGenericVnfResponse","") + execution.setVariable("CAAIVfMod_createVfModuleResponseCode",null) + execution.setVariable("CAAIVfMod_createVfModuleResponse","") + execution.setVariable("CAAIVfMod_parseModuleResponse","") + execution.setVariable("CAAIVfMod_deleteGenericVnfResponseCode",null) + execution.setVariable("CAAIVfMod_deleteGenericVnfResponse","") + execution.setVariable("CAAIVfMod_deleteVfModuleResponseCode",null) + execution.setVariable("CAAIVfMod_deleteVfModuleResponse","") +// execution.setVariable("CAAIVfMod_ResponseCode",null) +// execution.setVariable("CAAIVfMod_ErrorResponse","") + execution.setVariable("CreateAAIVfModuleResponse","") + execution.setVariable("RollbackData", null) + + } + + // parse the incoming CREATE_VF_MODULE request and store the Generic VNF + // and VF Module data in the flow DelegateExecution + public void preProcessRequest(DelegateExecution execution) { + initProcessVariables(execution) + + def vnfId = execution.getVariable("vnfId") + if (vnfId == null || vnfId.isEmpty()) { + execution.setVariable("CAAIVfMod_newGenericVnf", true) + execution.setVariable("CAAIVfMod_vnfId","") + } + else { + execution.setVariable("CAAIVfMod_vnfId",vnfId) + } + + def vnfName = execution.getVariable("vnfName") + execution.setVariable("CAAIVfMod_vnfName", vnfName) + + String vnfType = execution.getVariable("vnfType") + if (vnfType != null && !vnfType.isEmpty()) { + execution.setVariable("CAAIVfMod_vnfType", vnfType) + } else { + execution.setVariable("CAAIVfMod_vnfType","") + } + + execution.setVariable("CAAIVfMod_serviceId", execution.getVariable("serviceId")) + + String personaModelId = execution.getVariable("personaModelId") + + if (personaModelId != null && !personaModelId.isEmpty()) { + execution.setVariable("CAAIVfMod_personaId",personaModelId) + } else { + execution.setVariable("CAAIVfMod_personaId","") + } + + String personaModelVersion = execution.getVariable("personaModelVersion") + + if (personaModelVersion != null && !personaModelVersion.isEmpty()) { + execution.setVariable("CAAIVfMod_personaVer", personaModelVersion) + } else { + execution.setVariable("CAAIVfMod_personaVer","") + } + + + String modelCustomizationId = execution.getVariable("modelCustomizationId") + + if (modelCustomizationId != null && !modelCustomizationId.isEmpty()) { + execution.setVariable("CAAIVfMod_modelCustomizationId",modelCustomizationId) + } else { + execution.setVariable("CAAIVfMod_modelCustomizationId","") + } + + String vnfPersonaModelId = execution.getVariable("vnfPersonaModelId") + + if (vnfPersonaModelId != null && !vnfPersonaModelId.isEmpty()) { + execution.setVariable("CAAIVfMod_vnfPersonaId",vnfPersonaModelId) + } else { + execution.setVariable("CAAIVfMod_vnfPersonaId","") + } + + String vnfPersonaModelVersion = execution.getVariable("vnfPersonaModelVersion") + + if (vnfPersonaModelVersion != null && !vnfPersonaModelVersion.isEmpty()) { + execution.setVariable("CAAIVfMod_vnfPersonaVer",vnfPersonaModelVersion) + } else { + execution.setVariable("CAAIVfMod_vnfPersonaVer","") + } + + //isBaseVfModule + Boolean isBaseVfModule = false + String isBaseVfModuleString = execution.getVariable("isBaseVfModule") + if (isBaseVfModuleString != null && isBaseVfModuleString.equals("true")) { + isBaseVfModule = true + } + execution.setVariable("CAAIVfMod_isBaseVfModule", isBaseVfModule) + + String isVidRequest = execution.getVariable("isVidRequest") + if (isVidRequest != null && "true".equals(isVidRequest)) { + msoLogger.debug("VID Request received") + } + + execution.setVariable("CAAIVfMod_moduleName",execution.getVariable("vfModuleName")) + execution.setVariable("CAAIVfMod_moduleModelName",execution.getVariable("vfModuleModelName")) + + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + String aaiNamespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) + msoLogger.debug('AAI namespace is: ' + aaiNamespace) + + execution.setVariable("CAAIVfMod_aaiNamespace","${aaiNamespace}") + + if (vnfId == null || vnfId.isEmpty()) { + // TBD - assert that the vnfName is not empty + execution.setVariable("CAAIVfMod_genericVnfGetEndpoint", + "${aai_uri}/?vnf-name=" + + UriUtils.encode(vnfName,"UTF-8") + "&depth=1") + } else { + execution.setVariable("CAAIVfMod_genericVnfGetEndpoint", + "${aai_uri}/" + UriUtils.encode(vnfId,"UTF-8") + "?depth=1") + } + + msoLogger.debug("CreateAAIVfModule VNF PUT Endpoint: ${aai_uri}/") + execution.setVariable("CAAIVfMod_genericVnfPutEndpoint","${aai_uri}/") + } + + // send a GET request to AA&I to retrieve the Generic VNF/VF Module information based on a Vnf Name + // expect a 200 response with the information in the response body or a 404 if the Generic VNF does not exist + public void queryAAIForGenericVnf(DelegateExecution execution) { + def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("CAAIVfMod_genericVnfGetEndpoint") + + try { + msoLogger.debug("queryAAIForGenericVnf() endpoint-" + endPoint) + msoLogger.debug("invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint) + msoLogger.debug("CreateAAIVfModule sending GET call to AAI Endpoint: " + endPoint) + + AaiUtil aaiUtil = new AaiUtil(this) + APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) + def responseData = response.getResponseBodyAsString() + def statusCode = response.getStatusCode() + execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode", statusCode) + execution.setVariable("CAAIVfMod_queryGenericVnfResponse", responseData) + + msoLogger.debug("CreateAAIVfModule Response Code: " + statusCode) + msoLogger.debug("CreateAAIVfModule Response data: " + responseData) + msoLogger.debug("Response code:" + statusCode) + msoLogger.debug("Response:" + System.lineSeparator()+responseData) + } catch (Exception ex) { + msoLogger.debug("Exception occurred while executing AAI GET:" + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in queryAAIForGenericVnf.") + + } + } + + // process the result from queryAAIForGenericVnf() + // note: this method is primarily for logging as the actual decision logic is embedded in the bpmn flow + public void processAAIGenericVnfQuery(DelegateExecution execution) { + def result = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") + + if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 && + execution.getVariable("CAAIVfMod_vnfId").isEmpty()) { + msoLogger.debug("New Generic VNF requested and it does not already exist") + } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200 && + !execution.getVariable("CAAIVfMod_vnfId").isEmpty()) { + msoLogger.debug("Adding module to existing Generic VNF") + } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200 && + execution.getVariable("CAAIVfMod_vnfId").isEmpty()) { + msoLogger.debug("Invalid request for new Generic VNF which already exists") + execution.setVariable("CAAIVfMod_queryGenericVnfResponse", + "Invalid request for new Generic VNF which already exists, Vnf Name=" + + execution.getVariable("CAAIVfMod_vnfName")) + } else { // execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 && + // !execution.getVariable("CAAIVfMod_vnfId").isEmpty()) + msoLogger.debug("Invalid request for Add-on Module requested for non-existant Generic VNF") + execution.setVariable("CAAIVfMod_createVfModuleResponse", + "Invalid request for Add-on Module requested for non-existant Generic VNF, VNF Id=" + + execution.getVariable("CAAIVfMod_vnfId")) + } + } + + // construct and send a PUT request to A&AI to create a new Generic VNF + // note: to get here, the vnf-id in the original CREATE_VF_MODULE request was absent or "" + public void createGenericVnf(DelegateExecution execution) { + // TBD - is this how we want to generate the Id for the new Generic VNF? + def newVnfId = UUID.randomUUID().toString() + def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + + execution.getVariable("CAAIVfMod_genericVnfPutEndpoint") + newVnfId + // update the flow execution with the new Vnf Id + execution.setVariable("CAAIVfMod_vnfId",newVnfId) + + // AaiUriUtil aaiUriUtil = new AaiUriUtil(this) + // def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + // msoLogger.debug('AAI URI is: ' + aai_uri) + // String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) + // msoLogger.debug('AAI namespace is: ' + namespace) + + + String payload = """ + ${MsoUtils.xmlEscape(newVnfId)} + ${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfName"))} + ${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfType"))} + ${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_serviceId"))} + Active + ${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfPersonaId"))} + ${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfPersonaVer"))} + """ as String + execution.setVariable("CAAIVfMod_createGenericVnfPayload", payload) + + try { + msoLogger.debug("createGenericVnf() endpoint-" + endPoint) + msoLogger.debug("invoking PUT call to AAI with payload:"+System.lineSeparator()+payload) + msoLogger.debug("Sending PUT call to AAI with Endpoint /n" + endPoint + " with payload /n" + payload) + + AaiUtil aaiUtil = new AaiUtil(this); + APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload); + def responseData = response.getResponseBodyAsString() + def responseStatusCode = response.getStatusCode() + execution.setVariable("CAAIVfMod_createGenericVnfResponseCode", responseStatusCode) + execution.setVariable("CAAIVfMod_createGenericVnfResponse", responseData) + + msoLogger.debug("Response Code: " + responseStatusCode) + msoLogger.debug("Response Data: " + responseData) + msoLogger.debug("Response code:" + responseStatusCode) + msoLogger.debug("Response:" + System.lineSeparator()+responseData) + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createGenericVnf.") + } + } + + // construct and send a PUT request to A&AI to create a Base or Add-on VF Module + public void createVfModule(DelegateExecution execution, Boolean isBaseModule) { + // TBD - is this how we want to generate the Id for the new (Base) VF Module? + + // Generate the new VF Module ID here if it has not been provided by the parent process + def newModuleId = execution.getVariable('newVfModuleId') + if (newModuleId == null || newModuleId.isEmpty()) { + newModuleId = UUID.randomUUID().toString() + } + def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("CAAIVfMod_genericVnfPutEndpoint") + // need to append the existing Vnf Id or the one generated in createGenericVnf() to the url + endPoint = endPoint + UriUtils.encode(execution.getVariable("CAAIVfMod_vnfId"), "UTF-8") + + "/vf-modules/vf-module/" + newModuleId; + int moduleIndex = 0 + if (!isBaseModule) { + def aaiVnfResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") + AaiUtil aaiUtil = new AaiUtil(this) + def personaModelId = execution.getVariable("CAAIVfMod_personaId") + + // Check if the response includes model-invariant-id or persona-model-id + // note: getRequiredNodeText() throws an exception if the field is missing + // need to retun a null for the subsequent "either/or" logic to work properly +// def modelInvariantId = getRequiredNodeText(execution, aaiVnfResponse,'model-invariant-id') + def modelInvariantId = getNodeText(aaiVnfResponse,'model-invariant-id', null) + def fieldToCheck = 'model-invariant-id' + if (!modelInvariantId) { + fieldToCheck = 'persona-model-id' + } + + moduleIndex = aaiUtil.getLowestUnusedVfModuleIndexFromAAIVnfResponse(execution, aaiVnfResponse, + fieldToCheck, personaModelId) + } + def moduleIndexString = String.valueOf(moduleIndex) + + // if we get to this point, we may be about to create the Vf Module, + // add rollback information about the Generic VNF for this base/add-on module + def rollbackData = execution.getVariable("RollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData(); + } + rollbackData.put("VFMODULE", "vnfId", execution.getVariable("CAAIVfMod_vnfId")) + rollbackData.put("VFMODULE", "vnfName", execution.getVariable("CAAIVfMod_vnfName")) + rollbackData.put("VFMODULE", "isBaseModule", isBaseModule.toString()) + execution.setVariable("RollbackData", rollbackData) + msoLogger.debug("RollbackData:" + rollbackData) + String payload = """ + ${MsoUtils.xmlEscape(newModuleId)} + ${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_moduleName"))} + ${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_personaId"))} + ${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_personaVer"))} + ${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_modelCustomizationId"))} + ${MsoUtils.xmlEscape(isBaseModule)} + PendingCreate + ${MsoUtils.xmlEscape(moduleIndex)} + """ as String + execution.setVariable("CAAIVfMod_createVfModulePayload", payload) + + try { + msoLogger.debug("createVfModule() endpoint-" + endPoint) + msoLogger.debug("invoking PUT call to AAI with payload:"+System.lineSeparator()+payload) + msoLogger.debug("CreateAAIVfModule sending PUT call to AAI with endpoint /n" + endPoint + " with payload /n " + payload) + + AaiUtil aaiUtil = new AaiUtil(this) + APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload) + def responseData = response.getResponseBodyAsString() + def statusCode = response.getStatusCode() + execution.setVariable("CAAIVfMod_createVfModuleResponseCode", statusCode) + execution.setVariable("CAAIVfMod_createVfModuleResponse", responseData) + + msoLogger.debug("Response code:" + statusCode) + msoLogger.debug("Response:" + System.lineSeparator()+responseData) + msoLogger.debug("Response Code: " + statusCode) + msoLogger.debug("Response data: " + responseData) + // the base or add-on VF Module was successfully created, + // add the module name to the rollback data and the response + if (isOneOf(statusCode, 200, 201)) { + rollbackData.put("VFMODULE", "vfModuleId", newModuleId) + rollbackData.put("VFMODULE", "vfModuleName", execution.getVariable("CAAIVfMod_moduleName")) + execution.setVariable("RollbackData", rollbackData) + msoLogger.debug("RollbackData:" + rollbackData) + + String responseOut = "" + + String isVidRequest = execution.getVariable("isVidRequest") + + if (isBaseModule && (isVidRequest == null || "false".equals(isVidRequest))) { + + responseOut = """ + ${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfId"))} + ${MsoUtils.xmlEscape(newModuleId)} + ${MsoUtils.xmlEscape(moduleIndexString)} + """ as String + } + else { + responseOut = """ + ${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfNameFromAAI"))} + ${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfId"))} + ${MsoUtils.xmlEscape(newModuleId)} + ${MsoUtils.xmlEscape(moduleIndexString)} + """ as String + } + + execution.setVariable("CreateAAIVfModuleResponse", responseOut) + msoLogger.debug("CreateAAIVfModuleResponse:" + System.lineSeparator()+responseOut) + msoLogger.debug("CreateAAIVfModule Response /n " + responseOut) + } + } catch (Exception ex) { + msoLogger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createVfModule.") + } + } + + // parses the output from the result from queryAAIForGenericVnf() to determine if the vf-module-name + // requested for an Add-on VF Module does not already exist for the specified Generic VNF + // also retrieves VNF name from AAI response for existing VNF + public void parseForAddOnModule(DelegateExecution execution) { + def xml = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") + def vnfNameFromAAI = utils.getNodeText(xml, "vnf-name") + execution.setVariable("CAAIVfMod_vnfNameFromAAI", vnfNameFromAAI) + msoLogger.debug("Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI) + def newModuleName = execution.getVariable("CAAIVfMod_moduleName") + msoLogger.debug("VF Module to be added: " + newModuleName) + def qryModuleNameList = utils.getMultNodes(xml, "vf-module-name") + execution.setVariable("CAAIVfMod_moduleExists", false) + if (qryModuleNameList != null) { + msoLogger.debug("Existing VF Module List: " + qryModuleNameList) + for (String qryModuleName : qryModuleNameList) { + if (newModuleName.equals(qryModuleName)) { + // a module with the requested name already exists - failure + msoLogger.debug("VF Module " + qryModuleName + " already exists for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + execution.setVariable("CAAIVfMod_moduleExists", true) + execution.setVariable("CAAIVfMod_parseModuleResponse", + "VF Module " + qryModuleName + " already exists for Generic VNF " + + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + break + } + } + } + if (execution.getVariable("CAAIVfMod_moduleExists") == false) { + msoLogger.debug("VF Module " + execution.getVariable("CAAIVfMod_moduleName") + " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + execution.setVariable("CAAIVfMod_parseModuleResponse", + "VF Module " + newModuleName + " does not exist for Generic VNF " + + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + } + } + + // parses the output from the result from queryAAIForGenericVnf() to determine if the vf-module-name + // requested for an Add-on VF Module does not already exist for the specified Generic VNF; + // also retrieves VNF name from AAI response for existing VNF + public void parseForBaseModule(DelegateExecution execution) { + def xml = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") + def vnfNameFromAAI = utils.getNodeText(xml, "vnf-name") + execution.setVariable("CAAIVfMod_vnfNameFromAAI", vnfNameFromAAI) + msoLogger.debug("Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI) + def newModuleName = execution.getVariable("CAAIVfMod_moduleName") + msoLogger.debug("VF Module to be added: " + newModuleName) + def qryModuleNameList = utils.getMultNodes(xml, "vf-module-name") + execution.setVariable("CAAIVfMod_moduleExists", false) + if (qryModuleNameList != null) { + msoLogger.debug("Existing VF Module List: " + qryModuleNameList) + for (String qryModuleName : qryModuleNameList) { + if (newModuleName.equals(qryModuleName)) { + // a module with the requested name already exists - failure + msoLogger.debug("VF Module " + qryModuleName + " already exists for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + execution.setVariable("CAAIVfMod_baseModuleConflict", true) + execution.setVariable("CAAIVfMod_parseModuleResponse", + "VF Module " + qryModuleName + " already exists for Generic VNF " + + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + break + } + } + } + def isBaseVfModuleList = utils.getMultNodes(xml, "is-base-vf-module") + if (isBaseVfModuleList != null && !execution.getVariable("CAAIVfMod_baseModuleConflict")) { + + for (String baseValue : isBaseVfModuleList) { + if (baseValue.equals("true")) { + // a base module already exists in this VNF - failure + msoLogger.debug("Base VF Module already exists for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + execution.setVariable("CAAIVfMod_baseModuleConflict", true) + execution.setVariable("CAAIVfMod_parseModuleResponse", + "Base VF Module already exists for Generic VNF " + + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + break + } + } + + } + if (execution.getVariable("CAAIVfMod_moduleExists") == false && execution.getVariable("CAAIVfMod_baseModuleConflict") == false) { + msoLogger.debug("VF Module " + execution.getVariable("CAAIVfMod_moduleName") + " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + execution.setVariable("CAAIVfMod_parseModuleResponse", + "VF Module " + newModuleName + " does not exist for Generic VNF " + + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + } + } + + // generates a WorkflowException when the A&AI query returns a response code other than 200 or 404 + public void handleAAIQueryFailure(DelegateExecution execution) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + int code = execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + exceptionUtil.buildAndThrowWorkflowException(execution, code, "Error occurred attempting to query AAI") + + } + + // generates a WorkflowException if + // - the A&AI Generic VNF PUT returns a response code other than 200 or 201 + // - the requested Generic VNF already exists but vnf-id == null + // - the requested Generic VNF does not exist but vnf-id != null + // - the A&AI VF Module PUT returns a response code other than 200 or 201 + // - the requested VF Module already exists for the Generic VNF + public void handleCreateVfModuleFailure(DelegateExecution execution) { + def errorCode + def errorResponse + if (execution.getVariable("CAAIVfMod_createGenericVnfResponseCode") != null && + !isOneOf(execution.getVariable("CAAIVfMod_createGenericVnfResponseCode"), 200, 201)) { + msoLogger.debug("Failure creating Generic VNF: " + execution.getVariable("CAAIVfMod_createGenericVnfResponse")) + errorResponse = execution.getVariable("CAAIVfMod_createGenericVnfResponse") + errorCode = 5000 + } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponse") != null && + execution.getVariable("CAAIVfMod_newGenericVnf") == true) { + // attempted to create a Generic VNF that already exists but vnf-id == null + msoLogger.debug(execution.getVariable("CAAIVfMod_queryGenericVnfResponse")) + errorResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") + errorCode = 1002 + } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 && + execution.getVariable("CAAIVfMod_newGenericVnf") == false) { + // attempted to create a Generic VNF where vnf-name does not exist but vnf-id != null + msoLogger.debug(execution.getVariable("CAAIVfMod_queryGenericVnfResponse")) + errorResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") + errorCode = 1002 + } else if (execution.getVariable("CAAIVfMod_createVfModuleResponseCode") != null) { + msoLogger.debug("Failed to add VF Module: " + execution.getVariable("CAAIVfMod_createVfModuleResponse")) + errorResponse = execution.getVariable("CAAIVfMod_createVfModuleResponse") + errorCode = 5000 + } else if (execution.getVariable("CAAIVfMod_moduleExists") == true) { + msoLogger.debug("Attempting to add VF Module that already exists: " + execution.getVariable("CAAIVfMod_parseModuleResponse")) + errorResponse = execution.getVariable("CAAIVfMod_parseModuleResponse") + errorCode = 1002 + } else if (execution.getVariable("CAAIVfMod_baseModuleConflict") == true) { + msoLogger.debug("Attempting to add Base VF Module to VNF that already has a Base VF Module: " + execution.getVariable("CAAIVfMod_parseModuleResponse")) + errorResponse = execution.getVariable("CAAIVfMod_parseModuleResponse") + errorCode = 1002 + } else { + // if the responses get populated corerctly, we should never get here + errorResponse = "Unknown error occurred during CreateAAIVfModule flow" + errorCode = 2000 + } + + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred during CreateAAIVfModule flow", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, errorResponse); + exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse) + msoLogger.debug("Workflow exception occurred in CreateAAIVfModule: " + errorResponse) + } + + /** + * Performs a rollback. + * TBD: This method requires additional testing once integrated with the + * main CreateVfModule flow. + * @param execution the execution + */ + public void rollback(DelegateExecution execution) { + def method = getClass().getSimpleName() + ".rollback(" + + "execution=" + execution.getId() + + ")" + msoLogger.debug("Entered " + method) + + try { + RollbackData rollbackData = (RollbackData) execution.getVariable("RollbackData") + msoLogger.debug("RollbackData:" + rollbackData) + + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + msoLogger.debug("CreateAAIVfModule rollback AAI URI: " + aai_uri) + + if (rollbackData != null) { + if (rollbackData.hasType("VFMODULE")) { + // use the DeleteAAIVfModule groovy methods for the rollback + def vnfId = rollbackData.get("VFMODULE", "vnfId") + def vfModuleId = rollbackData.get("VFMODULE", "vfModuleId") + def isBaseModule = rollbackData.get("VFMODULE", "isBaseModule") + execution.setVariable("DAAIVfMod_vnfId", vnfId) + execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId) + execution.setVariable("DAAIVfMod_genericVnfEndpoint", "${aai_uri}/" + vnfId) + execution.setVariable("DAAIVfMod_vfModuleEndpoint", "${aai_uri}/" + vnfId + + "/vf-modules/vf-module/" + vfModuleId) + DeleteAAIVfModule dvm = new DeleteAAIVfModule() + // query A&AI to get the needed information for the delete(s) + dvm.queryAAIForGenericVnf(execution) + dvm.parseForVfModule(execution) + + // roll back the base or add-on module + dvm.deleteVfModule(execution) + def responseCode = execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") + def response = execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") + + if (isOneOf(responseCode, 200, 204)) { + msoLogger.debug("Received " + responseCode + " to VF Module rollback request") +// execution.setVariable("RollbackResult", "SUCCESS") + } else { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Received " + responseCode + " to VF Module rollback request", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, rollbackData + System.lineSeparator() + "Response: " + response); + } + + // a new Generic VNF was created that needs to be rolled back + if (isBaseModule.equals("true")) { + dvm.deleteGenericVnf(execution) + responseCode = execution.getVariable("DAAIVfMod_deleteGenericVnfResponseCode") + response = execution.getVariable("DAAIVfMod_deleteGenericVnfResponse") + + if (isOneOf(responseCode, 200, 204)) { + msoLogger.debug("Received " + responseCode + " to Generic VNF rollback request") + execution.setVariable("RollbackResult", "SUCCESS") + } else { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Received " + responseCode + " to Generic VNF rollback request", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, rollbackData + System.lineSeparator() + "Response: " + response); + } + } else { + execution.setVariable("RollbackResult", "SUCCESS") + } + } + } + + msoLogger.debug("Exited " + method) + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in " + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy new file mode 100644 index 0000000000..ec691f299e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy @@ -0,0 +1,327 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.rest.APIResponse +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateAAIVfModuleVolumeGroup.class); + + private XmlParser xmlParser = new XmlParser() + ExceptionUtil exceptionUtil = new ExceptionUtil() + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'CAAIVfModVG_') + execution.setVariable('CAAIVfModVG_vnfId', null) + execution.setVariable('CAAIVfModVG_vfModuleId', null) + execution.setVariable('CAAIVfModVG_aicCloudRegion', null) + execution.setVariable('CAAIVfModVG_volumeGroupId', null) + execution.setVariable('CAAIVfModVG_getVfModuleResponseCode' ,null) + execution.setVariable('CAAIVfModVG_getVfModuleResponse', '') + execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', null) + execution.setVariable('CAAIVfModVG_updateVfModuleResponse', '') + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def xml = execution.getVariable('CreateAAIVfModuleVolumeGroupRequest') + msoLogger.debug('Received request xml:\n' + xml) + msoLogger.debug("CreateAAIVfModuleVolume Received Request XML: " + xml) + initProcessVariables(execution) + + def vnfId = getRequiredNodeText(execution, xml,'vnf-id') + execution.setVariable('CAAIVfModVG_vnfId', vnfId) + + def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id') + execution.setVariable('CAAIVfModVG_vfModuleId', vfModuleId) + + def aicCloudRegion = getRequiredNodeText(execution, xml,'aic-cloud-region') + execution.setVariable('CAAIVfModVG_aicCloudRegion', aicCloudRegion) + + def volumeGroupId = getRequiredNodeText(execution, xml,'volume-group-id') + execution.setVariable('CAAIVfModVG_volumeGroupId', volumeGroupId) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) + + } + } + + /** + * Using the received vnfId and vfModuleId, query AAI to get the corresponding VF Module. + * A 200 response is expected with the VF Module in the response body. + * + * @param execution The flow's execution instance. + */ + public void getVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.getVfModule(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('CAAIVfModVG_vnfId') + def vfModuleId = execution.getVariable('CAAIVfModVG_vfModuleId') + + // Construct endpoint + AaiUtil aaiUtil = new AaiUtil(this) + def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + aai_uri + '/' + URLEncoder.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + URLEncoder.encode(vfModuleId, "UTF-8") + + try { + msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') + msoLogger.debug("aaiResponse GET TO AAI Endpoint: " + endPoint) + APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) + def responseData = response.getResponseBodyAsString() + execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', response.getStatusCode()) + execution.setVariable('CAAIVfModVG_getVfModuleResponse', responseData) + + msoLogger.debug("CreateAAIVfModule Response Code: " + response.getStatusCode()) + msoLogger.debug("CreateAAIVfModule Response: " + response) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', 500) + execution.setVariable('CAAIVfModVG_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVfModule(): ' + e.getMessage()) + } + } + + /** + * Construct and send a PUT request to AAI to update the VF Module with the + * created Volume Group relationship. + * + * @param execution The flow's execution instance. + */ + public void updateVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.updateVfModule(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('CAAIVfModVG_vnfId') + def vfModuleId = execution.getVariable('CAAIVfModVG_vfModuleId') + def vfModule = execution.getVariable('CAAIVfModVG_getVfModuleResponse') + def origRequest = execution.getVariable('CreateAAIVfModuleVolumeGroupRequest') + def Node vfModuleNode = xmlParser.parseText(vfModule) + + // Confirm resource-version is in retrieved VF Module + if (utils.getChildNode(vfModuleNode, 'resource-version') == null) { + def msg = 'Can\'t update VF Module ' + vfModuleId + ' since \'resource-version\' is missing' + msoLogger.error( msg); + throw new Exception(msg) + } + + // Construct payload by creating a Volume Group relationhip and inserting it into the VF Module + def aicCloudRegion = execution.getVariable('CAAIVfModVG_aicCloudRegion') + def volumeGroupId = execution.getVariable('CAAIVfModVG_volumeGroupId') + def Node vgRelationshipNode = createVolumeGroupRelationshipNode(aicCloudRegion, volumeGroupId) + insertVolumeGroupRelationshipNode(vfModuleNode, vgRelationshipNode) + def payload = utils.nodeToString(vfModuleNode) + + // Construct endpoint + AaiUtil aaiUtil = new AaiUtil(this) + def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + aai_uri + '/' + URLEncoder.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + URLEncoder.encode(vfModuleId, "UTF-8") + + try { + msoLogger.debug("CreateAAIVfModuleVolume Sendind PUT to AAI Endpoint \n " + endPoint + " with payload \n " + payload) + msoLogger.debug('sending PUT to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload) + APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload) + def responseData = response.getResponseBodyAsString() + execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', response.getStatusCode()) + execution.setVariable('CAAIVfModVG_updateVfModuleResponse', responseData) + + msoLogger.debug("CreateAAIVfModule Response code: " + response.getStatusCode()) + msoLogger.debug("CreateAAIVfModule Response: " + responseData) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI PUT:' + ex.getMessage()) + execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', 500) + execution.setVariable('CAAIVfModVG_updateVfModuleResponse', 'AAI PUT Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage()) + } + } + + /** + * Construct a Volume Group relationship Node with the given AIC Cloud Region and + * Volume Group ID for insertion into a VF Module. + * + * @param aicCloudRegion Cloud Region ID to use in the Volume Group relationship + * @param volumeGroupId Volume Group ID to use in the Volume Group relationship + * @return a Node representing the new Volume Group relationship + */ + private Node createVolumeGroupRelationshipNode(String aicCloudRegion, String volumeGroupId) { + + def Node relatedTo = new Node(null, 'related-to', 'volume-group') + + def Node relationshipKeyCO = new Node(null, 'relationship-key', 'cloud-region.cloud-owner') + def Node relationshipValueCO = new Node(null, 'relationship-value', 'att-aic') + def Node relationshipDataCO = new Node(null, 'relationship-data') + relationshipDataCO.append(relationshipKeyCO) + relationshipDataCO.append(relationshipValueCO) + + def Node relationshipKeyCRI = new Node(null, 'relationship-key', 'cloud-region.cloud-region-id') + def Node relationshipValueCRI = new Node(null, 'relationship-value', aicCloudRegion) + def Node relationshipDataCRI = new Node(null, 'relationship-data') + relationshipDataCRI.append(relationshipKeyCRI) + relationshipDataCRI.append(relationshipValueCRI) + + def Node relationshipKeyVGI = new Node(null, 'relationship-key', 'volume-group.volume-group-id') + def Node relationshipValueVGI = new Node(null, 'relationship-value', volumeGroupId) + def Node relationshipDataVGI = new Node(null, 'relationship-data') + relationshipDataVGI.append(relationshipKeyVGI) + relationshipDataVGI.append(relationshipValueVGI) + + def Node volumeGroupRelationship = new Node(null, 'relationship') + volumeGroupRelationship.append(relatedTo) + volumeGroupRelationship.append(relationshipDataCO) + volumeGroupRelationship.append(relationshipDataCRI) + volumeGroupRelationship.append(relationshipDataVGI) + + return volumeGroupRelationship; + } + + /** + * Insert the given Volume Group relationship Node into the given VF Module. + * If the VF Module does NOT contain a relationship list: + * - Create a relationship list containing the Volume Group relationship and insert it into the VF Module + * If the VF Module contains a relationship list but not a Volume Group relationship: + * - Insert the the Volume Group relationship into the relationship lsit + * If the VF Module contains a relationship list and has a Volume Group relationship: + * - Replace the existing Volume Group relationship with the new one + * @param vfModuleNode + * @param volumeGroupRelationshipNode + */ + private void insertVolumeGroupRelationshipNode(Node vfModuleNode, Node volumeGroupRelationshipNode) { + def Node relationshipList = utils.getChildNode(vfModuleNode, 'relationship-list') + if (relationshipList == null) { + relationshipList = new Node(null, 'relationship-list') + relationshipList.append(volumeGroupRelationshipNode) + vfModuleNode.append(relationshipList) + } else { + def Node currVolumeGroupRelationshipNode = getCurrVolumeGroupRelationshipNode(relationshipList) + if (currVolumeGroupRelationshipNode == null) { + relationshipList.append(volumeGroupRelationshipNode) + } else { + currVolumeGroupRelationshipNode.replaceNode(volumeGroupRelationshipNode) + } + } + } + + /** + * Find and return the value of the Volume Group ID for the specified VF Module. If + * the value of the Volume Group ID cannot be found for any reason, 'null' is returned. + * + * @param vfModuleNode VF Module (as a Node) retrieved from AAI. + * @return the value of the Volume Group ID for the specified VF Module. If the + * value of the Volume Group ID cannot be found for any reason, 'null' is returned. + */ + private Node getCurrVolumeGroupRelationshipNode(Node relationshipList) { + def Node currVolumeGroupRelationshipNode = null + def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') + for (Node relationshipNode in relationships) { + def String relatedTo = utils.getChildNodeText(relationshipNode, 'related-to') + if ((relatedTo != null) && relatedTo.equals('volume-group')) { + currVolumeGroupRelationshipNode = relationshipNode + } + } + return currVolumeGroupRelationshipNode + } + + /** + * Generates a WorkflowException if the AAI query returns a response code other than 200. + * + * @param execution The flow's execution instance. + */ + public void handleAAIQueryFailure(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + msoLogger.error( 'Error occurred attempting to query AAI, Response Code ' + execution.getVariable('CAAIVfModVG_getVfModuleResponseCode')); + ExceptionUtil exceptionUtil = new ExceptionUtil() + exceptionUtil.buildWorkflowException(execution, 5000, execution.getVariable('CAAIVfModVG_getVfModuleResponse')) + + msoLogger.trace('Exited ' + method) + } + + /** + * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200. + * + * @param execution The flow's execution instance. + */ + public void handleUpdateVfModuleFailure(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + msoLogger.error('Error occurred attempting to update VF Module in AAI, Response Code ' + execution.getVariable('CAAIVfModVG_updateVfModuleResponseCode')); + ExceptionUtil exceptionUtil = new ExceptionUtil() + exceptionUtil.buildWorkflowException(execution, 5000, execution.getVariable('CAAIVfModVG_updateVfModuleResponse')) + + msoLogger.trace('Exited ' + method) + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetService.groovy new file mode 100644 index 0000000000..5aef1d6ea5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetService.groovy @@ -0,0 +1,440 @@ +/*- + * ============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.bpmn.common.scripts + +import static org.apache.commons.lang3.StringUtils.* + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + +/** + * This class supports the GenericGetService Sub Flow. + * This Generic sub flow can be used by any flow for accomplishing + * the goal of getting a Service-Instance or Service-Subscription (from AAI). + * The calling flow must set the GENGS_type variable as "service-instance" + * or "service-subscription". + * + * When using to Get a Service-Instance: + * If the global-customer-id and service-type are not provided + * this flow executes a query to get the service- Url using the + * Service Id or Name (whichever is provided). + * + * When using to Get a Service-Subscription: + * The global-customer-id and service-type must be + * provided. + * + * Upon successful completion of this sub flow the + * GENGS_SuccessIndicator will be true and the query response payload + * will be set to GENGS_service. An MSOWorkflowException will + * be thrown upon unsuccessful completion or if an error occurs + * at any time during this sub flow. Please map variables + * to the corresponding variable names below. + * + * Note - If this sub flow receives a Not Found (404) response + * from AAI at any time this will be considered an acceptable + * successful response however the GENGS_FoundIndicator + * will be set to false. This variable will allow the calling flow + * to distinguish between the two Success scenarios, + * "Success where service- is found" and + * "Success where service- is NOT found". + * + * + * Variable Mapping Below: + * + * In Mapping Variables: + * For Allotted-Resource: + * @param - GENGS_allottedResourceId + * @param - GENGS_type + * @param (Optional) - GENGS_serviceInstanceId + * @param (Optional) - GENGS_serviceType + * @param (Optional) - GENGS_globalCustomerId + * + * For Service-Instance: + * @param - GENGS_serviceInstanceId or @param - GENGS_serviceInstanceName + * @param - GENGS_type + * @param (Optional) - GENGS_serviceType + * @param (Optional) - GENGS_globalCustomerId + * + * For Service-Subscription: + * @param - GENGS_type + * @param - GENGS_serviceType + * @param - GENGS_globalCustomerId + * + * + * Out Mapping Variables: + * @param - GENGS_service + * @param - GENGS_FoundIndicator + * @param - WorkflowException + */ +class CustomE2EGetService extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CustomE2EGetService.class); + + String Prefix = "GENGS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + /** + * This method validates the incoming variables and + * determines the subsequent event based on which + * variables the calling flow provided. + * + * @param - execution + * + */ + public void preProcessRequest(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetService PreProcessRequest Process") + + execution.setVariable("GENGS_obtainObjectsUrl", false) + execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false) + execution.setVariable("GENGS_SuccessIndicator", false) + execution.setVariable("GENGS_FoundIndicator", false) + execution.setVariable("GENGS_resourceLink", null) + execution.setVariable("GENGS_siResourceLink", null) + + try{ + // Get Variables + String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") + String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") + String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") + String serviceType = execution.getVariable("GENGS_serviceType") + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + String type = execution.getVariable("GENGS_type") + + if(type != null){ + msoLogger.debug("Incoming GENGS_type is: " + type) + if(type.equalsIgnoreCase("allotted-resource")){ + if(isBlank(allottedResourceId)){ + msoLogger.debug("Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") + }else{ + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + if(isBlank(globalCustomerId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ + execution.setVariable("GENGS_obtainObjectsUrl", true) + }else{ + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + } + } + }else if(type.equalsIgnoreCase("service-instance")){ + if(isBlank(serviceInstanceId) && isBlank(serviceInstanceName)){ + msoLogger.debug("Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") + }else{ + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Instance Name is: " + serviceInstanceName) + if(isBlank(globalCustomerId) || isBlank(serviceType)){ + execution.setVariable("GENGS_obtainObjectsUrl", true) + if(isBlank(serviceInstanceId)){ + execution.setVariable("GENGS_obtainServiceInstanceUrlByName", true) + } + }else{ + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + } + } + }else if(type.equalsIgnoreCase("service-subscription")){ + if(isBlank(serviceType) || isBlank(globalCustomerId)){ + msoLogger.debug("Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") + }else{ + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENGS_type is null. Variable is Required.") + } + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug("Internal Error encountered within GenericGetService PreProcessRequest method!" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetService PreProcessRequest") + + } + msoLogger.trace("COMPLETED GenericGetService PreProcessRequest Process ") + } + + /** + * This method obtains the Url to the provided service instance + * using the Service Instance Id. + * + * @param - execution + */ + public void obtainServiceInstanceUrlById(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetService ObtainServiceInstanceUrlById Process") + try { + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + + String type = execution.getVariable("GENGS_type") + String path = "" + if(type.equalsIgnoreCase("service-instance")){ + String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") + msoLogger.debug(" Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId) + path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}" + msoLogger.debug("Service Instance Node Query Url is: " + path) + msoLogger.debug("Service Instance Node Query Url is: " + path) + }else if(type.equalsIgnoreCase("allotted-resource")){ + String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") + msoLogger.debug(" Querying Node for Service-Instance URL by using Allotted Resource Id: " + allottedResourceId) + path = "${aai_uri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}" + msoLogger.debug("Allotted Resource Node Query Url is: " + path) + msoLogger.debug("Allotted Resource Node Query Url is: " + path) + } + + //String url = "${aai_endpoint}${path}" host name needs to be removed from property + String url = "${path}" + execution.setVariable("GENGS_genericQueryPath", url) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) + int responseCode = response.getStatusCode() + execution.setVariable("GENGS_genericQueryResponseCode", responseCode) + msoLogger.debug(" GET Service Instance response code is: " + responseCode) + msoLogger.debug("GenericGetService AAI GET Response Code: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENGS_obtainSIUrlResponseBeforeUnescaping", aaiResponse) + msoLogger.debug("GenericGetService AAI Response before unescaping: " + aaiResponse) + execution.setVariable("GENGS_genericQueryResponse", aaiResponse) + msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) + msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) + + //Process Response + if(responseCode == 200){ + msoLogger.debug("Generic Query Received a Good Response Code") + execution.setVariable("GENGS_SuccessIndicator", true) + if(utils.nodeExists(aaiResponse, "result-data")){ + msoLogger.debug("Generic Query Response Does Contain Data" ) + execution.setVariable("GENGS_FoundIndicator", true) + String resourceLink = utils.getNodeText(aaiResponse, "resource-link") + execution.setVariable("GENGS_resourceLink", resourceLink) + execution.setVariable("GENGS_siResourceLink", resourceLink) + }else{ + msoLogger.debug("Generic Query Response Does NOT Contains Data" ) + execution.setVariable("WorkflowResponse", " ") //for junits + } + }else if(responseCode == 404){ + msoLogger.debug("Generic Query Received a Not Found (404) Response") + execution.setVariable("GENGS_SuccessIndicator", true) + execution.setVariable("WorkflowResponse", " ") //for junits + }else{ + msoLogger.debug("Generic Query Received a BAD REST Response: \n" + aaiResponse) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetService ObtainServiceInstanceUrlById method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlById") + } + msoLogger.trace("COMPLETED GenericGetService ObtainServiceInstanceUrlById Process") + } + + /** + * This method obtains the Url to the provided service instance + * using the Service Instance Name. + * + * @param - execution + */ + public void obtainServiceInstanceUrlByName(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetService ObtainServiceInstanceUrlByName Process") + try { + String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") + msoLogger.debug(" Querying Node for Service-Instance URL by using Service-Instance Name " + serviceInstanceName) + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-name:EQUALS:${serviceInstanceName}" + + //String url = "${aai_endpoint}${path}" host name needs to be removed from property + String url = "${path}" + execution.setVariable("GENGS_obtainSIUrlPath", url) + + msoLogger.debug("GenericGetService AAI Endpoint: " + aai_endpoint) + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) + int responseCode = response.getStatusCode() + execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode) + msoLogger.debug(" GET Service Instance response code is: " + responseCode) + msoLogger.debug("GenericGetService AAI Response Code: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse) + msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) + //Process Response + if(responseCode == 200){ + msoLogger.debug(" Query for Service Instance Url Received a Good Response Code") + execution.setVariable("GENGS_SuccessIndicator", true) + if(utils.nodeExists(aaiResponse, "result-data")){ + msoLogger.debug("Query for Service Instance Url Response Does Contain Data" ) + execution.setVariable("GENGS_FoundIndicator", true) + String resourceLink = utils.getNodeText(aaiResponse, "resource-link") + execution.setVariable("GENGS_resourceLink", resourceLink) + execution.setVariable("GENGS_siResourceLink", resourceLink) + }else{ + msoLogger.debug("Query for Service Instance Url Response Does NOT Contains Data" ) + execution.setVariable("WorkflowResponse", " ") //for junits + } + }else if(responseCode == 404){ + msoLogger.debug(" Query for Service Instance Received a Not Found (404) Response") + execution.setVariable("GENGS_SuccessIndicator", true) + execution.setVariable("WorkflowResponse", " ") //for junits + }else{ + msoLogger.debug("Query for Service Instance Received a BAD REST Response: \n" + aaiResponse) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetService ObtainServiceInstanceUrlByName method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlByName") + } + msoLogger.trace("COMPLETED GenericGetService ObtainServiceInstanceUrlByName Process") + } + + + /** + * This method executes a GET call to AAI to obtain the + * service-instance or service-subscription + * + * @param - execution + */ + public void getServiceObject(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetService GetServiceObject Process") + try { + String type = execution.getVariable("GENGS_type") + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + String serviceEndpoint = "" + + msoLogger.debug("GenericGetService getServiceObject AAI Endpoint: " + aai_endpoint) + if(type.equalsIgnoreCase("service-instance")){ + String siResourceLink = execution.getVariable("GENGS_resourceLink") + if(isBlank(siResourceLink)){ + String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") + msoLogger.debug(" Incoming GENGS_serviceInstanceId is: " + serviceInstanceId) + String serviceType = execution.getVariable("GENGS_serviceType") + msoLogger.debug(" Incoming GENGS_serviceType is: " + serviceType) + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + }else{ + msoLogger.debug("Incoming Service Instance Url is: " + siResourceLink) + String[] split = siResourceLink.split("/aai/") + serviceEndpoint = "/aai/" + split[1] + } + }else if(type.equalsIgnoreCase("allotted-resource")){ + String siResourceLink = execution.getVariable("GENGS_resourceLink") + if(isBlank(siResourceLink)){ + String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") + msoLogger.debug(" Incoming GENGS_allottedResourceId is: " + allottedResourceId) + String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") + msoLogger.debug(" Incoming GENGS_serviceInstanceId is: " + serviceInstanceId) + String serviceType = execution.getVariable("GENGS_serviceType") + msoLogger.debug(" Incoming GENGS_serviceType is: " + serviceType) + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + }else{ + msoLogger.debug("Incoming Allotted-Resource Url is: " + siResourceLink) + String[] split = siResourceLink.split("/aai/") + serviceEndpoint = "/aai/" + split[1] + } + }else if(type.equalsIgnoreCase("service-subscription")){ + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + String serviceType = execution.getVariable("GENGS_serviceType") + serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + } + + String serviceUrl = "${aai_endpoint}" + serviceEndpoint + + execution.setVariable("GENGS_getServiceUrl", serviceUrl) + msoLogger.debug("GET Service AAI Path is: \n" + serviceUrl) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceUrl) + int responseCode = response.getStatusCode() + execution.setVariable("GENGS_getServiceResponseCode", responseCode) + msoLogger.debug(" GET Service response code is: " + responseCode) + msoLogger.debug("GenericGetService AAI Response Code: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENGS_getServiceResponse", aaiResponse) + msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) + //Process Response + if(responseCode == 200 || responseCode == 202){ + msoLogger.debug("GET Service Received a Good Response Code") + if(utils.nodeExists(aaiResponse, "service-instance") || utils.nodeExists(aaiResponse, "service-subscription")){ + msoLogger.debug("GET Service Response Contains a service-instance" ) + execution.setVariable("GENGS_FoundIndicator", true) + execution.setVariable("GENGS_service", aaiResponse) + execution.setVariable("WorkflowResponse", aaiResponse) + + }else{ + msoLogger.debug("GET Service Response Does NOT Contain Data" ) + } + }else if(responseCode == 404){ + msoLogger.debug("GET Service Received a Not Found (404) Response") + execution.setVariable("WorkflowResponse", " ") //for junits + } + else{ + msoLogger.debug(" GET Service Received a Bad Response: \n" + aaiResponse) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug(" Error encountered within GenericGetService GetServiceObject method!" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GenericGetService") + } + msoLogger.trace("COMPLETED GenericGetService GetServiceObject Process") + } + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutService.groovy new file mode 100644 index 0000000000..43d540cc74 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutService.groovy @@ -0,0 +1,283 @@ +/*- + * ============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.bpmn.common.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.apache.commons.codec.binary.Base64 +import org.apache.commons.lang3.* + +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.rest.APIResponse; +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig + +import java.net.URLEncoder; +import org.springframework.web.util.UriUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +/** + * This class supports the GenericPutService Sub Flow. + * This Generic sub flow can be used by any flow for the + * goal of creating a Service Instance or Service-Subscription in AAI. Upon successful completion of + * this sub flow the GENPS_SuccessIndicator will be true. + * The calling flow must set the GENPS_type variable as "service-instance" + * or "service-subscription". + * A MSOWorkflowException will be thrown Upon unsuccessful + * completion or if an error occurs within this flow. + * Please map variables to the corresponding variable names + * below. + * + * + * Incoming Required Variables: + * @param - GENPS_requestId + * @param - GENPS_type - Required field. This will be required field populated as service-instance or service-subscription + * @param - GENPS_globalSubscriberId - Required field + * @param - GENPS_serviceType - Required Field + * @param - GENPS_payload - Required Field This will be the payload that needs to be sent. + * + * @param - GENPS_serviceInstanceId - Conditional Field. Required for service-instance. + * @param - GENPS_allottedResourceId - Conditional Field. Required for allotted-resource. + * @param - GENPS_tunnelXconnectId - Conditional Field. Required for tunnel-xconnect. + * + * @param - GENPS_serviceResourceVersion - Conditional Field. Needs to be provided only in case of update for both service-instance and service subscription. The calling flows + * should check if a service-instance or servic-subscription exists by calling the subflow GenericGetService. if it exists then resourceversion should be + * obtained from aai and sent as an input parameter. + * + * Outgoing Variables: + * @param - GENPS_SuccessIndicator + * @param - WorkflowException + * + * + */ + + +class CustomE2EPutService extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CustomE2EPutService.class); + + String Prefix = "GENPS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + + public void preProcessRequest(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericPutService PreProcessRequest Process") + + execution.setVariable("GENPS_SuccessIndicator", false) + + try{ + // Get Variables + String requestId = execution.getVariable("GENPS_requestId") + msoLogger.debug("Incoming GENPS_requestId is: " + requestId) + + String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + String serviceType = execution.getVariable("GENPS_serviceType") + String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") + String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") + String type = execution.getVariable("GENPS_type") + + if(type != null){ + msoLogger.debug("Incoming GENPS_type is: " + type) + if(type.equalsIgnoreCase("service-instance")){ + if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ + msoLogger.debug("Incoming Required Variable is missing or null!") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") + }else{ + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + } + }else if(type.equalsIgnoreCase("service-subscription")){ + if(isBlank(serviceType) || isBlank(globalSubscriberId)){ + msoLogger.debug("Incoming ServiceType or GlobalSubscriberId is null. These variables are required to create a service-subscription.") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") + }else{ + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + } + }else if(type.equalsIgnoreCase("allotted-resource")){ + if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId)){ + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + msoLogger.debug("Incoming Required Variable is missing or null!") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") + }else{ + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + } + }else if(type.equalsIgnoreCase("tunnel-xconnect")){ + if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId) || isBlank(tunnelXconnectId)){ + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + msoLogger.debug("Incoming Tunnel Xconnect Id is: " + tunnelXconnectId) + msoLogger.debug("Incoming Required Variable is missing or null!") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") + }else{ + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + msoLogger.debug("Incoming Tunnel Xconnect Id is: " + tunnelXconnectId) + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENPS_type is null. Variable is Required.") + } + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericPutService PreProcessRequest method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericPutService PreProcessRequest") + + } + msoLogger.trace("COMPLETED GenericPutService PreProcessRequest Process ") + + } + + + + /** + * This method executes a Put call to AAI for the provided + * service instance. + * + * @param - execution + * + */ + public void putServiceInstance(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericPutService PutServiceInstance method") + try { + String type = execution.getVariable("GENPS_type") + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + String namespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) + msoLogger.debug('AAI namespace is: ' + namespace) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + String serviceAaiPath = "" + String payload = execution.getVariable("GENPS_payload") + execution.setVariable("GENPS_payload", payload) + msoLogger.debug("Incoming GENPS_payload is: " + payload) + msoLogger.debug(payload) + + String serviceType = execution.getVariable("GENPS_serviceType") + msoLogger.debug(" Incoming GENPS_serviceType is: " + serviceType) + String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + + // This IF clause is if we need to create a new Service Instance + if(type.equalsIgnoreCase("service-instance")){ + + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + URLEncoder.encode(serviceInstanceId,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + + }else if(type.equalsIgnoreCase("service-subscription")){ + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + }else if(type.equalsIgnoreCase("allotted-resource")){ + + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) + String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") + msoLogger.debug(" Incoming GENPS_allottedResourceId is: " + allottedResourceId) + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + }else if(type.equalsIgnoreCase("tunnel-xconnect")){ + + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) + String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") + msoLogger.debug(" Incoming GENPS_allottedResourceId is: " + allottedResourceId) + String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") + msoLogger.debug(" Incoming GENPS_tunnelXconnectId is: " + tunnelXconnectId) + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + "/tunnel-xconnects/tunnel-xconnect/" + UriUtils.encode(tunnelXconnectId,"UTF-8") + } + + String resourceVersion = execution.getVariable("GENPS_serviceResourceVersion") + msoLogger.debug("Incoming Resource Version is: " + resourceVersion) + if(resourceVersion !=null){ + serviceAaiPath = serviceAaiPath +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8") + } + + execution.setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath) + msoLogger.debug("PUT Service Instance AAI Path is: " + "\n" + serviceAaiPath) + + APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) + int responseCode = response.getStatusCode() + execution.setVariable("GENPS_putServiceInstanceResponseCode", responseCode) + msoLogger.debug(" Put Service Instance response code is: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENPS_putServiceInstanceResponse", aaiResponse) + + + //Process Response + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + //200 OK 201 CREATED 202 ACCEPTED + { + msoLogger.debug("PUT Service Instance Received a Good Response") + execution.setVariable("GENPS_SuccessIndicator", true) + } + + else{ + msoLogger.debug("Put Generic Service Instance Received a Bad Response Code. Response Code is: " + responseCode) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericPutService PutServiceInstance method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Put Service Instance") + } + msoLogger.trace("COMPLETED GenericPutService PutServiceInstance Process") + } + + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy new file mode 100644 index 0000000000..739bc4b7ed --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy @@ -0,0 +1,170 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject; +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.json.DecomposeJsonUtil; +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger + +/** + * This groovy class supports the DecomposeService.bpmn process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDebugLogEnabled + * @param - serviceInstanceId + * @param - serviceModelInfo + * @param - requestParameters (may be null) + * + * Outputs: + * @param - rollbackData (null) + * @param - rolledBack (null) + * @param - WorkflowException + * @param - serviceDecomposition + * + */ +public class DecomposeService extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DecomposeService.class); + + + String Prefix="DDS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + CatalogDbUtils catalogDbUtils = new CatalogDbUtils() + JsonUtils jsonUtils = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + String msg = "" + msoLogger.trace("preProcessRequest of DecomposeService ") + setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled')) + + try { + execution.setVariable("prefix", Prefix) + // check for required input + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceModelInfo = execution.getVariable("serviceModelInfo") + String invariantId + if(jsonUtils.jsonElementExist(serviceModelInfo, "modelInvariantUuid")){ + invariantId = jsonUtils.getJsonValue(serviceModelInfo, "modelInvariantUuid") + }else if(jsonUtils.jsonElementExist(serviceModelInfo, "modelInvariantId")){ + invariantId = jsonUtils.getJsonValue(serviceModelInfo, "modelInvariantId") + } + execution.setVariable("DDS_serviceModelInvariantId", invariantId) + execution.setVariable("DDS_serviceModelUuid", jsonUtils.getJsonValue(serviceModelInfo, "modelUuid")) + execution.setVariable("DDS_modelVersion", jsonUtils.getJsonValue(serviceModelInfo, "modelVersion")) + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest of DecomposeService ") + } + + public void queryCatalogDb (DelegateExecution execution) { + String msg = "" + msoLogger.trace("queryCatalogDB of DecomposeService ") + + try { + + // check for input + String serviceModelInvariantId = execution.getVariable("DDS_serviceModelInvariantId") + String serviceModelUuid = execution.getVariable("DDS_serviceModelUuid") + String modelVersion = execution.getVariable("DDS_modelVersion") + + msoLogger.debug("serviceModelInvariantId: " + serviceModelInvariantId) + msoLogger.debug("modelVersion: " + modelVersion) + + JSONObject catalogDbResponse = null + if(serviceModelUuid != null && serviceModelUuid.length() > 0) + catalogDbResponse = catalogDbUtils.getServiceResourcesByServiceModelUuid(execution, serviceModelUuid, "v2") + else if (modelVersion != null && modelVersion.length() > 0) + catalogDbResponse = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(execution, serviceModelInvariantId, modelVersion, "v2") + else + catalogDbResponse = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuid(execution, serviceModelInvariantId, "v2") + + if (catalogDbResponse == null || catalogDbResponse.toString().equalsIgnoreCase("null")) { + msg = "No data found in Catalog DB" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + String catalogDbResponseString = catalogDbResponse.toString() + + execution.setVariable("DDS_catalogDbResponse", catalogDbResponseString) + msoLogger.debug("catalog DB response string: "+ catalogDbResponseString) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in queryCatalogDb " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit queryCatalogDb of DecomposeService ") + } + + + + public void actuallyDecomposeService (DelegateExecution execution) { + String msg = "" + msoLogger.trace("actuallyDecomposeService of DecomposeService ") + + try { + + // check for input + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceModelInvariantId = execution.getVariable("DDS_serviceModelInvariantId") + + msoLogger.debug("serviceModelInvariantId: " + serviceModelInvariantId) + + msoLogger.debug("getting service decomposition") + + String catalogDbResponse = execution.getVariable("DDS_catalogDbResponse") + ServiceDecomposition serviceDecomposition = DecomposeJsonUtil.jsonToServiceDecomposition(catalogDbResponse, serviceInstanceId) + + execution.setVariable("serviceDecomposition", serviceDecomposition) + execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString()) + + msoLogger.debug("service decomposition: "+ serviceDecomposition.toJsonString()) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in actuallyDecomposeService " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit actuallyDecomposeService of DecomposeService ") + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy new file mode 100644 index 0000000000..bb9846c112 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy @@ -0,0 +1,335 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.rest.APIResponse +import org.onap.so.rest.RESTClient; +import org.onap.so.rest.RESTConfig; +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteAAIVfModule.class); + + def Prefix="DAAIVfMod_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + private MsoUtils utils = new MsoUtils() + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + execution.setVariable("DAAIVfMod_vnfId",null) + execution.setVariable("DAAIVfMod_vnfName",null) + execution.setVariable("DAAIVfMod_genVnfRsrcVer",null) + execution.setVariable("DAAIVfMod_vfModuleId",null) + execution.setVariable("DAAIVfMod_vfModRsrcVer",null) + execution.setVariable("DAAIVfMod_genericVnfEndpoint",null) + execution.setVariable("DAAIVfMod_vfModuleEndpoint",null) + execution.setVariable("DAAIVfMod_moduleExists",false) + execution.setVariable("DAAIVfMod_isBaseModule", false) + execution.setVariable("DAAIVfMod_isLastModule", false) + + // DeleteAAIVfModule workflow response variable placeholders + execution.setVariable("DAAIVfMod_queryGenericVnfResponseCode",null) + execution.setVariable("DAAIVfMod_queryGenericVnfResponse","") + execution.setVariable("DAAIVfMod_parseModuleResponse","") + execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode",null) + execution.setVariable("DAAIVfMod_deleteGenericVnfResponse","") + execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode",null) + execution.setVariable("DAAIVfMod_deleteVfModuleResponse","") + + } + + // parse the incoming DELETE_VF_MODULE request and store the Generic Vnf + // and Vf Module Ids in the flow DelegateExecution + public void preProcessRequest(DelegateExecution execution) { + def xml = execution.getVariable("DeleteAAIVfModuleRequest") + msoLogger.debug("DeleteAAIVfModule Request: " + xml) + msoLogger.debug("input request xml:" + xml) + initProcessVariables(execution) + def vnfId = utils.getNodeText(xml,"vnf-id") + def vfModuleId = utils.getNodeText(xml,"vf-module-id") + execution.setVariable("DAAIVfMod_vnfId", vnfId) + execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId) + + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + execution.setVariable("DAAIVfMod_genericVnfEndpoint", "${aai_uri}/" + vnfId) + execution.setVariable("DAAIVfMod_vfModuleEndpoint", "${aai_uri}/" + vnfId + + "/vf-modules/vf-module/" + vfModuleId) + } + + // send a GET request to AA&I to retrieve the Generic Vnf/Vf Module information based on a Vnf Id + // expect a 200 response with the information in the response body or a 404 if the Generic Vnf does not exist + public void queryAAIForGenericVnf(DelegateExecution execution) { + def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId") + def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + "?depth=1" + msoLogger.debug("DeleteAAIVfModule endPoint: " + endPoint) + def aaiRequestId = utils.getRequestID() + + RESTConfig config = new RESTConfig(endPoint); + msoLogger.debug("queryAAIForGenericVnf() endpoint-" + endPoint) + def responseData = "" + try { + RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO"). + addHeader("Accept","application/xml"); + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + msoLogger.debug("invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint) + APIResponse response = client.httpGet() + msoLogger.debug("DeleteAAIVfModule - invoking httpGet to AAI") + + responseData = response.getResponseBodyAsString() + execution.setVariable("DAAIVfMod_queryGenericVnfResponseCode", response.getStatusCode()) + execution.setVariable("DAAIVfMod_queryGenericVnfResponse", responseData) + msoLogger.debug("AAI Response: " + responseData) + msoLogger.debug("Response code:" + response.getStatusCode()) + msoLogger.debug("Response:" + System.lineSeparator()+responseData) + } catch (Exception ex) { + msoLogger.debug("Exception occurred while executing AAI GET:" + ex.getMessage()) + execution.setVariable("DAAIVfMod_queryGenericVnfResponse", "AAI GET Failed:" + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during queryAAIForGenericVnf") + + } + } + + // construct and send a DELETE request to A&AI to delete a Generic Vnf + // note: to get here, all the modules associated with the Generic Vnf must already be deleted + public void deleteGenericVnf(DelegateExecution execution) { + def aaiRequestId = utils.getRequestID() + def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + + "/?resource-version=" + execution.getVariable("DAAIVfMod_genVnfRsrcVer") + msoLogger.debug("AAI endPoint: " + endPoint) + RESTConfig config = new RESTConfig(endPoint); + msoLogger.debug("deleteGenericVnf() endpoint-" + endPoint) + def responseData = "" + try { + RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO"). + addHeader("Accept","application/xml"); + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + APIResponse response = client.httpDelete() + + responseData = response.getResponseBodyAsString() + execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode", response.getStatusCode()) + execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", responseData) + msoLogger.debug("Response code:" + response.getStatusCode()) + msoLogger.debug("Response:" + System.lineSeparator()+responseData) + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug("Exception occurred while executing AAI DELETE:" + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteGenericVnf") + } + } + + // construct and send a DELETE request to A&AI to delete the Base or Add-on Vf Module + public void deleteVfModule(DelegateExecution execution) { + def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("DAAIVfMod_vfModuleEndpoint") + + "/?resource-version=" + execution.getVariable("DAAIVfMod_vfModRsrcVer") + def aaiRequestId = utils.getRequestID() + + RESTConfig config = new RESTConfig(endPoint); + msoLogger.debug("deleteVfModule() endpoint-" + endPoint) + def responseData = "" + try { + RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO"). + addHeader("Accept","application/xml"); + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + APIResponse response = client.httpDelete() + + msoLogger.debug("DeleteAAIVfModule - invoking httpDelete to AAI") + + responseData = response.getResponseBodyAsString() + execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode", response.getStatusCode()) + execution.setVariable("DAAIVfMod_deleteVfModuleResponse", responseData) + msoLogger.debug("DeleteAAIVfModule - AAI Response" + responseData) + msoLogger.debug("Response code:" + response.getStatusCode()) + msoLogger.debug("Response:" + System.lineSeparator()+responseData) + + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteVfModule") + } + } + + // parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module + // to be deleted exists for the specified Generic Vnf and if it is the Base Module, + // there are no Add-on Modules present + public void parseForVfModule(DelegateExecution execution) { + def xml = execution.getVariable("DAAIVfMod_queryGenericVnfResponse") + msoLogger.debug("DeleteAAIVfModule - queryGenericVnfResponse" + xml) + + def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId") + msoLogger.debug("Vf Module to be deleted: " + delModuleId) + List qryModuleIdList = utils.getMultNodes(xml, "vf-module-id") + List qryBaseModuleList = utils.getMultNodes(xml, "is-base-vf-module") + List qryResourceVerList = utils.getMultNodes(xml, "resource-version") + execution.setVariable("DAAIVfMod_moduleExists", false) + execution.setVariable("DAAIVfMod_isBaseModule", false) + execution.setVariable("DAAIVfMod_isLastModule", false) + // + def isBaseVfModule = "false" + // loop through the Vf Module Ids looking for a match + if (qryModuleIdList != null && !qryModuleIdList.empty) { + msoLogger.debug("Existing Vf Module Id List: " + qryModuleIdList) + msoLogger.debug("Existing Vf Module Resource Version List: " + qryResourceVerList) + def moduleCntr = 0 + // the Generic Vnf resource-version in the 1st entry in the query response + execution.setVariable("DAAIVfMod_genVnfRsrcVer", qryResourceVerList[moduleCntr]) + for (String qryModuleId : qryModuleIdList) { + if (delModuleId.equals(qryModuleId)) { + // a Vf Module with the requested Id exists + execution.setVariable("DAAIVfMod_moduleExists", true) + // find the corresponding value for the is-base-vf-module field + isBaseVfModule = qryBaseModuleList[moduleCntr] + // find the corresponding value for the resource-version field + // note: the Generic Vnf entry also has a resource-version field, so + // add 1 to the index to get the corresponding Vf Module value + execution.setVariable("DAAIVfMod_vfModRsrcVer", qryResourceVerList[moduleCntr+1]) + msoLogger.debug("Match found for Vf Module Id " + qryModuleId + " for Generic Vnf Id " + execution.getVariable("DAAIVfMod_vnfId") + ", Base Module is " + isBaseVfModule + ", Resource Version is " + execution.getVariable("vfModRsrcVer")) + break + } + moduleCntr++ + } + } + + // determine if the module to be deleted is a Base Module and/or the Last Module + if (execution.getVariable("DAAIVfMod_moduleExists") == true) { + if (isBaseVfModule.equals("true") && qryModuleIdList.size() != 1) { + execution.setVariable("DAAIVfMod_parseModuleResponse", + "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " + + execution.getVariable("DAAIVfMod_vnfId") + ": is Base Module, not Last Module") + execution.setVariable("DAAIVfMod_isBaseModule", true) + } else { + if (isBaseVfModule.equals("true") && qryModuleIdList.size() == 1) { + execution.setVariable("DAAIVfMod_parseModuleResponse", + "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " + + execution.getVariable("DAAIVfMod_vnfId") + ": is Base Module and Last Module") + execution.setVariable("DAAIVfMod_isBaseModule", true) + execution.setVariable("DAAIVfMod_isLastModule", true) + } else { + if (qryModuleIdList.size() == 1) { + execution.setVariable("DAAIVfMod_parseModuleResponse", + "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " + + execution.getVariable("DAAIVfMod_vnfId") + ": is Not Base Module, is Last Module") + execution.setVariable("DAAIVfMod_isLastModule", true) + } else { + execution.setVariable("DAAIVfMod_parseModuleResponse", + "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " + + execution.getVariable("DAAIVfMod_vnfId") + ": is Not Base Module and Not Last Module") + } + } + } + msoLogger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse")) + } else { // (execution.getVariable("DAAIVfMod_moduleExists") == false) + msoLogger.debug("Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " + execution.getVariable("DAAIVfMod_vnfId")) + execution.setVariable("DAAIVfMod_parseModuleResponse", + "Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " + + execution.getVariable("DAAIVfMod_vnfName")) + } + } + + // parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module + // to be deleted exists for the specified Generic Vnf and if it is the Base Module, + // there are no Add-on Modules present + public void parseForResourceVersion(DelegateExecution execution) { + def xml = execution.getVariable("DAAIVfMod_queryGenericVnfResponse") + msoLogger.debug("DeleteAAIVfModule - queryGenericVnfResponse" + xml) + String resourceVer = utils.getNodeText(xml, "resource-version") + execution.setVariable("DAAIVfMod_genVnfRsrcVer", resourceVer) + msoLogger.debug("Latest Generic VNF Resource Version: " + resourceVer) + } + + + // generates a WorkflowException if the A&AI query returns a response code other than 200 + public void handleAAIQueryFailure(DelegateExecution execution) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred attempting to query AAI, Response Code " + execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("DAAIVfMod_queryGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + def errorCode = 5000 + // set the errorCode to distinguish between a A&AI failure + // and the Generic Vnf Id not found + if (execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") == 404) { + errorCode = 1002 + } + exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, execution.getVariable("DAAIVfMod_queryGenericVnfResponse")) + } + + // generates a WorkflowException if + // - the A&AI Vf Module DELETE returns a response code other than 200 + // - the Vf Module is a Base Module that is not the last Vf Module + // - the Vf Module does not exist for the Generic Vnf + public void handleDeleteVfModuleFailure(DelegateExecution execution) { + def errorCode = 2000 + def errorResponse = "" + if (execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") != null && + execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") != 200) { + msoLogger.debug("AAI failure deleting a Vf Module: " + execution.getVariable("DAAIVfMod_deleteVfModuleResponse")) + errorResponse = execution.getVariable("DAAIVfMod_deleteVfModuleResponse") + msoLogger.debug("DeleteAAIVfModule - deleteVfModuleResponse" + errorResponse) + errorCode = 5000 + } else { + if (execution.getVariable("DAAIVfMod_isBaseModule", true) == true && + execution.getVariable("DAAIVfMod_isLastModule") == false) { + // attempt to delete a Base Module that is not the last Vf Module + msoLogger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse")) + errorResponse = execution.getVariable("DAAIVfMod_parseModuleResponse") + msoLogger.debug("DeleteAAIVfModule - parseModuleResponse" + errorResponse) + errorCode = 1002 + } else { + // attempt to delete a non-existant Vf Module + if (execution.getVariable("DAAIVfMod_moduleExists") == false) { + msoLogger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse")) + errorResponse = execution.getVariable("DAAIVfMod_parseModuleResponse") + msoLogger.debug("DeleteAAIVfModule - parseModuleResponse" + errorResponse) + errorCode = 1002 + } else { + // if the responses get populated corerctly, we should never get here + errorResponse = "Unknown error occurred during DeleteAAIVfModule flow" + } + } + } + + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred during DeleteAAIVfModule flow", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, errorResponse); + exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse) + + } + + // generates a WorkflowException if + // - the A&AI Generic Vnf DELETE returns a response code other than 200 + public void handleDeleteGenericVnfFailure(DelegateExecution execution) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "AAI error occurred deleting the Generic Vnf", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, execution.getVariable("DAAIVfMod_deleteGenericVnfResponse")); + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, execution.getVariable("DAAIVfMod_deleteGenericVnfResponse")) + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy new file mode 100644 index 0000000000..de5408fac5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy @@ -0,0 +1,422 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import static org.apache.commons.lang3.StringUtils.* + +import com.google.common.xml.XmlEscapers + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +/** + * @version 1.0 + */ +class ExceptionUtil extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExceptionUtil.class); + + + + /** + * This error handling method maps an AAI Exception response to a + * WorkflowException Object. It then sets the WorkflowException Object + * on the execution as "WorkflowException". + * + * This method formats the exception from AAI into the WorkflowException's + * errorMessage that CCD expects. + * + * @param execution the execution + * @param response the aai exception + */ + WorkflowException MapAAIExceptionToWorkflowException(String response, DelegateExecution execution) + { + def utils=new MsoUtils() + def prefix=execution.getVariable("prefix") + def errorMsg = execution.getVariable(prefix+"ErrorResponse") + msoLogger.trace("Begin MapAAIExceptionToWorkflowException ") + String text = null + def variables + String errorCode = '5000' + WorkflowException wfex + msoLogger.debug("response: " + response) + try{ + try { + //String msg = utils.getNodeXml(response, "Fault") + variables = utils.getMultNodes(response, "variable") + text = utils.getNodeText(response, "text") + } catch (Exception ex) { + //Ignore the exception - cases include non xml payload + msoLogger.debug("error mapping error, ignoring: " + ex) + } + + if(text != null) { + if(variables.size()>=4){ + text = text.replaceFirst("%1", variables[0]) + text = text.replaceFirst("%2", variables[1]) + text = text.replaceFirst("%3", variables[2]) + text = text.replaceFirst("%4", variables[3]) + } + String modifiedErrorMessage = 'Received error from A&AI (' + text +')' + msoLogger.debug("ModifiedErrorMessage " + modifiedErrorMessage) + // let $ModifiedErrorMessage := concat( 'Received error from A',$exceptionaai:ampersand,'AI (' ,functx:replace-multi($ErrorMessage,$from,$Variables ),')') + buildWorkflowException(execution, 5000, modifiedErrorMessage) + + wfex = execution.getVariable("WorkflowException") + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Fault", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, wfex.errorMessage); + return wfex + } else { + try { + errorCode = MapErrorCode(errorMsg) + String mappedErrorMessage = MapErrorMessage(errorMsg, errorCode) + + int errorCodeInt = Integer.parseInt(errorCode) + buildWorkflowException(execution, errorCodeInt, mappedErrorMessage) + + msoLogger.debug("mappedErrorMessage " + mappedErrorMessage) + wfex = execution.getVariable("WorkflowException") + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Fault", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, wfex.errorMessage); + return wfex + } catch(Exception ex) { + msoLogger.debug("error mapping error, return null: " + ex) + return null + + } + } + }catch(Exception e){ + msoLogger.debug("Exception occured during MapAAIExceptionToWorkflowException: " + e) + buildWorkflowException(execution, 5000, "Error mapping AAI Response to WorkflowException") + } + } + + /** + * This error handling method maps an AAI Exception response to a + * WorkflowException Object. It then sets the WorkflowException Object + * on the execution as "WorkflowException". + * + * This method takes the exact exception inside the tags from AAI Response + * and puts it into the WorkflowException's errorMessage. + * + * @param execution the execution + * @param response the aai exception + */ + WorkflowException MapAAIExceptionToWorkflowExceptionGeneric(DelegateExecution execution, String response, int resCode){ + def utils=new MsoUtils() + msoLogger.debug("Start MapAAIExceptionToWorkflowExceptionGeneric Process") + + WorkflowException wfex + try { + if(utils.nodeExists(response, "Fault")){ + String fault = utils.getNodeXml(response, "Fault") + fault = utils.removeXmlPreamble(fault) + fault = fault.replace("", "").replace("", "") + fault = fault.replaceAll("\\s+\\s+", "") // Removes extra white spaces + buildWorkflowException(execution, resCode, fault) + }else if(utils.nodeExists(response, "RESTFault")){ + String rFault = utils.getNodeXml(response, "RESTFault") + buildWorkflowException(execution, resCode, rFault) + }else{ + buildWorkflowException(execution, resCode, "Received a bad response from AAI") + } + } catch (Exception ex) { + msoLogger.debug("Exception Occured during MapAAIExceptionToWorkflowExceptionGeneric: " + ex) + buildWorkflowException(execution, resCode, "Internal Error - Occured in MapAAIExceptionToWorkflowExceptionGeneric") + + } + msoLogger.debug("Outgoing WorkflowException is: " + execution.getVariable("WorkflowException")) + msoLogger.debug("Completed MapAAIExceptionToWorkflowExceptionGeneric Process") + } + + /** + * This method takes a WorkflowException Object and builds + * WorkflowException Xml. This method should only be used + * for the purpose of sending a sync error response or for + * creating a FalloutHandler request. + * + *@param - WorkflowException Object + * + *@return - String WorkflowException Xml + * + * + */ + String buildErrorResponseXml(WorkflowException wfex) { + String xml + if(wfex != null){ + String mes = XmlEscapers.xmlContentEscaper().escape(wfex.getErrorMessage()) + int code = wfex.getErrorCode() + xml = + """ + ${MsoUtils.xmlEscape(mes)} + ${MsoUtils.xmlEscape(code)} + """ + + }else{ + xml = + """ + Internal Error + 2500 + """ + } + return xml + } + + /* + 5000 Received error from A&AI ($A&AI_ERROR) Asynchronous During orchestration of the recipe, A&AI returned an error. The error returned by A&AI is passed through in $A&AI_ERROR. + 5010 Could not communicate with A&AI Asynchronous During orchestration of the recipe, a connection with A&AI could not be established. + 5020 No response from A&AI Asynchronous During orchestration of the recipe, communication was established with A&AI, but no response was received within the configured timeout. + */ + /** + * + * Utility Method for MapAAIExceptionToWorkflowException + * + *@param - String ErrorMessage + * + *@return - String ErrorCode + * + */ + private String MapErrorCode(String errorMessage) + { + if(errorMessage==null){ + return '5000' + } + errorMessage = errorMessage.toLowerCase(); + if(errorMessage.contains('timed out') || errorMessage.contains('timeout')) + return '5020' + else if (errorMessage.contains('connection')) + return '5010' + else + return '5000' + } + + /** + * + * Utility Method for MapAAIExceptionToWorkflowException + * + *@param - String ErrorMessage + *@param - String ErrorCode + * + *@return - String ErrorMessage + * + */ + private String MapErrorMessage(String errorMessage, String errorCode) + { + if(errorMessage == null){ + errorMessage="" + } + if( errorCode.equals('5010')){ + return 'Could not communicate with A&AI' + }else if (errorCode.equals('5020')){ + return 'No response from A&AI' + }else{ + return 'Received error from A&AI (' +errorMessage +')' + } + } + + /** + * + * Utility Method for Mapping SDNC + * Adapter Response Codes + * + *@param - String sdncResponseCode + * + *@return - String code + * + */ + String MapSDNCResponseCodeToErrorCode(String sdncResponseCode) + { + if (sdncResponseCode == '500') { + return '5310' + } else if ( sdncResponseCode == '408') { + return '5320' + } else if ( sdncResponseCode == '60010') { + return '5350' + } else { + return '5300' + } + } + + /** + * This error handling method builds a WorkflowException Object. It sets it on + * the execution as "WorkflowException". + * + * @param execution the execution + * @param errorCode the error code + * @param errorMessage the error message + */ + public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { + MsoUtils utils = new MsoUtils() + String processKey = getProcessKey(execution); + msoLogger.debug("Building a WorkflowException for " + processKey) + + WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage); + execution.setVariable("WorkflowException", exception); + msoLogger.debug("Outgoing WorkflowException is " + exception) + } + + /** + * This error handling method builds a WorkflowException Object and throws a + * MSOWorkflowException. It throws a "MSOWorkflowException" BpmnError after + * setting the WorkflowException Object on the execution as "WorkflowException". + * + * @param execution the execution + * @param errorCode the error code + * @param errorMessage the error message + */ + public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { + String processKey = getProcessKey(execution); + msoLogger.debug("Building a WorkflowException for Subflow " + processKey) + + WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage); + execution.setVariable("WorkflowException", exception); + msoLogger.debug("Outgoing WorkflowException is " + exception) + msoLogger.debug("Throwing MSOWorkflowException") + throw new BpmnError("MSOWorkflowException") + } + + /** + * This method is executed after an MSOWorkflowException is caught by a + * subflow (during subflows "Error Handling Sub Process"). + * It ensures the WorkflowException variable is populated before ending the + * subflow and also logs the subflows outgoing WorkflowException Variable. + * + * @param - execution + * + */ + public void processSubflowsBPMNException(DelegateExecution execution){ + String processKey = getProcessKey(execution) + try{ + msoLogger.debug("Started ProcessSubflowsBPMNException Method") + if(execution.getVariable("WorkflowException") == null){ + buildWorkflowException(execution, 2500, "Internal Error - Occured During " + processKey) + } + + msoLogger.debug(processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException")) + }catch(Exception e){ + msoLogger.debug("Caught Exception during ProcessSubflowsBPMNException Method: " + e) + } + msoLogger.debug("Completed ProcessSubflowsBPMNException Method") + } + + /** + * This method is executed after an MSOWorkflowException is caught by a + * Mainflow. It builds and returns a FalloutHandler Request. It also + * verifies the WorkflowException variable is populated. + * + * @param - execution + * @param - requestInfo + * + * @return - falloutHandlerRequest + * + */ + public String processMainflowsBPMNException(DelegateExecution execution, String requestInfo){ + String processKey = getProcessKey(execution) + try{ + msoLogger.debug("Started ProcessMainflowBPMNException Method") + if(execution.getVariable("WorkflowException") == null || isBlank(requestInfo)){ + buildWorkflowException(execution, 2500, "Internal Error - WorkflowException Object and/or RequestInfo is null! " + processKey) + } + requestInfo = utils.removeXmlPreamble(requestInfo) + WorkflowException wfex = execution.getVariable("WorkflowException") + String errorMessage = XmlEscapers.xmlContentEscaper().escape(wfex.getErrorMessage()) + int errorCode = wfex.getErrorCode() + + String falloutHandlerRequest = + """ + ${requestInfo} + + ${MsoUtils.xmlEscape(errorMessage)} + ${MsoUtils.xmlEscape(errorCode)} + + """ + + msoLogger.debug(processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException")) + msoLogger.debug(processKey + " Outgoing FalloutHandler Request is: " + falloutHandlerRequest) + + return falloutHandlerRequest + + }catch(Exception e){ + msoLogger.debug("Caught Exception during ProcessMainflowBPMNException Method: " + e) + return null + } + msoLogger.debug("Completed ProcessMainflowBPMNException Method") + } + + /** + * + * This method is executed after an Java Exception is caught + * It sets the WorkflowException variable. The method can be used in either mainflow or subflows. + * + * @param - execution + * + */ + public void processJavaException(DelegateExecution execution){ + String processKey = getProcessKey(execution) + try{ + msoLogger.debug("Caught a Java Exception in " + processKey) + msoLogger.debug("Started processJavaException Method") + // if the BPMN flow java error handler sets "BPMN_javaExpMsg", append it to the WFE + String javaExpMsg = execution.getVariable("BPMN_javaExpMsg") + String wfeExpMsg = "Catch a Java Lang Exception in " + processKey + if (javaExpMsg != null && !javaExpMsg.empty) { + wfeExpMsg = wfeExpMsg + ": " + javaExpMsg + } + buildWorkflowException(execution, 2500, wfeExpMsg) + + }catch(BpmnError b){ + throw b + }catch(Exception e){ + msoLogger.debug("Caught Exception during processJavaException Method: " + e) + buildWorkflowException(execution, 2500, "Internal Error - During Process Java Exception") + } + msoLogger.debug("Completed processJavaException Method") + } + + + public void preProcessRequest(DelegateExecution execution) { + // TODO Auto-generated method stub + + } + + public String getErrorMessage(WorkflowException wfe, String processKey) { + if(wfe == null) { + return "Unexpected error encountered in " + processKey + } + else { + return wfe.getErrorMessage() + } + } + + public int getErrorCode(WorkflowException wfe) { + if(wfe == null) { + return 2500 + } + else { + return wfe.getErrorCode() + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy new file mode 100644 index 0000000000..9732693f38 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy @@ -0,0 +1,378 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.onap.so.bpmn.core.UrnPropertiesReader + +import java.text.SimpleDateFormat + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +public class FalloutHandler extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, FalloutHandler.class); + + String Prefix="FH_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public initializeProcessVariables(DelegateExecution execution){ + def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + + try { + execution.setVariable("prefix",Prefix) + + //These variables are form the input Message to the BPMN + execution.setVariable("FH_request_id","") + execution.setVariable("FH_request_action","") + execution.setVariable("FH_notification-url","") + execution.setVariable("FH_mso-bpel-name","") + execution.setVariable("FH_ErrorCode", "") + execution.setVariable("FH_ErrorMessage", "") + + execution.setVariable("FH_notification-url-Ok", false) + execution.setVariable("FH_request_id-Ok", false) + + //These variables are for Get Mso Aai Password Adapter + execution.setVariable("FH_deliveryStatus", true) + + //update Response Status to pending ...Adapter variables + execution.setVariable("FH_updateResponseStatusPayload", null) + execution.setVariable("FH_updateResponseStatusResponse", null) + + //update Request Gamma ...Adapter variables + execution.setVariable("FH_updateRequestGammaPayload", "") + execution.setVariable("FH_updateRequestGammaResponse", null) + execution.setVariable("FH_updateRequestGammaResponseCode", null) + + //update Request Infra ...Adapter variables + execution.setVariable("FH_updateRequestInfraPayload", "") + execution.setVariable("FH_updateRequestInfraResponse", null) + execution.setVariable("FH_updateRequestInfraResponseCode", null) + + //assign True to success variable + execution.setVariable("FH_success", true) + + //Set notify status to Failed variable + execution.setVariable("FH_NOTIFY_STATUS", "SUCCESS") + + //Set DB update variable + execution.setVariable("FH_updateRequestPayload", "") + execution.setVariable("FH_updateRequestResponse", null) + execution.setVariable("FH_updateRequestResponseCode", null) + + //Auth variables + execution.setVariable("BasicAuthHeaderValue","") + + //Parameter list + execution.setVariable("FH_parameterList", "") + + //Response variables + execution.setVariable("FalloutHandlerResponse","") + execution.setVariable("FH_ErrorResponse", null) + execution.setVariable("FH_ResponseCode", "") + + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + } + } + + public void preProcessRequest (DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + + // Initialize flow variables + initializeProcessVariables(execution) + setSuccessIndicator(execution, false) + + setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled')) + + try { + def xml = execution.getVariable("FalloutHandlerRequest") + msoLogger.debug(" XML --> " + xml) + msoLogger.debug("FalloutHandler request: " + xml) + + //Check the incoming request type + //Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node) + if (utils.nodeExists(xml, "request-information")) { + execution.setVariable("FH_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS + } + + //Check notification-url for the incoming request type + //ACTIVE_REQUESTS may have notificationurl node + //INFRA_ACTIVE_REQUESTS notificationurl node does not exist + def notificationurl = "" + if (utils.nodeExists(xml, "notification-url")) { + notificationurl = utils.getNodeText(xml,"notification-url") + if(notificationurl != null && !notificationurl.isEmpty()) { + msoLogger.debug("********** Incoming notification Url is: " + notificationurl); + execution.setVariable("FH_notification-url-Ok", true) + execution.setVariable("FH_notification-url",notificationurl) + } + } + + //Check request_id for the incoming request type + //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not) + //For ACTIVE_REQUESTS payload request-id is NOT optional + def request_id = "" + if (utils.nodeExists(xml, "request-id")) { + execution.setVariable("FH_request_id",utils.getNodeText(xml,"request-id")) + } + msoLogger.debug("FH_request_id: " + execution.getVariable("FH_request_id")) + + // INFRA_ACTIVE_REQUESTS have "action" element ... mandatory + // ACTIVE_REQUEST have "request-action" ... mandatory + if (utils.nodeExists(xml, "request-action")) { + execution.setVariable("FH_request_action",utils.getNodeText(xml,"request-action")) + } else if (utils.nodeExists(xml, "action")) { + execution.setVariable("FH_request_action",utils.getNodeText(xml,"action")) + } + + + //Check source for the incoming request type + //For INFRA_ACTIVE_REQUESTS payload source IS optional + //For ACTIVE_REQUESTS payload source is NOT optional + def source = "" + if (utils.nodeExists(xml, "source")) { + execution.setVariable("FH_source",utils.getNodeText(xml,"source")) + } + + //Check if ErrorCode node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above. + def errorCode = "" + if (utils.nodeExists(xml, "ErrorCode")) { + errorCode = utils.getNodeText(xml,"ErrorCode") + if(errorCode != null && !errorCode.isEmpty()) { + execution.setVariable("FH_ErrorCode", errorCode) + } + } + msoLogger.debug("FH_ErrorCode: " + errorCode) + + //Check if ErrorMessage node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above. + def errorMessage = "" + if (utils.nodeExists(xml, "ErrorMessage")) { + errorCode = utils.getNodeText(xml,"ErrorMessage") + if(errorCode != null && !errorCode.isEmpty()) { + errorCode = errorCode + execution.setVariable("FH_ErrorMessage", errorCode) + } + } + + //Check for Parameter List + if (utils.nodeExists(xml, "parameter-list")) { + def parameterList = utils.getNodeXml(xml, "parameter-list", false) + execution.setVariable("FH_parameterList", parameterList) + } + + msoLogger.trace("--> " + execution.getVariable("")) + msoLogger.debug("FH_request_id-OK --> " + execution.getVariable("FH_request_id-Ok")) + + // set the DHV/Service Instantiation values if specified in the request + execution.setVariable("FH_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText(xml, "is-srv-inst-req")))) + msoLogger.trace("--> " + execution.getVariable("")) + execution.setVariable("FH_is_json_content", String.valueOf("JSON".equals(utils.getNodeText(xml, "resp-content-type")))) + msoLogger.trace("--> " + execution.getVariable("")) + execution.setVariable("FH_service_inst_id", utils.getNodeText(xml, "service-instance-id")) + msoLogger.trace("--> " + execution.getVariable("")) + execution.setVariable("FH_start_time", utils.getNodeText(xml, "start-time")) + msoLogger.trace("--> " + execution.getVariable("")) + // this variable is used by the camunda flow to set the Content-Type for the async response + if (execution.getVariable("FH_is_srv_inst_req").equals("true") && + execution.getVariable("FH_is_json_content").equals("true")) { + execution.setVariable("FH_content_type", "application/json") + } else { + execution.setVariable("FH_content_type", "text/xml") + } + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + } + + msoLogger.debug("OUTOF --> Initialize Variables Fallout Handler #########"); + } + + public String updateRequestPayload (DelegateExecution execution){ + def method = getClass().getSimpleName() + '.updateRequestPayload(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + + try { + String payload = """ + + + + + ${MsoUtils.xmlEscape(execution.getVariable("FH_request_id"))} + BPEL + ${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorMessage"))} + ${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorCode"))} + FAILED + ${MsoUtils.xmlEscape(execution.getVariable("FH_NOTIFY_STATUS"))} + + + + """ + + msoLogger.debug("updateRequestPayload: " + payload) + execution.setVariable("FH_updateRequestPayload", payload) + return execution.getVariable("FH_updateRequestPayload") + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + } + } + + public String updateRequestInfraPayload (DelegateExecution execution){ + def method = getClass().getSimpleName() + '.updateRequestInfraPayload(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + + try { + String payload = """ + + + + + ${MsoUtils.xmlEscape(execution.getVariable("FH_request_id"))} + BPEL + ${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorMessage"))} + FAILED + 100 + + + + """ + + execution.setVariable("FH_updateRequestInfraPayload", payload) + msoLogger.debug("updateRequestInfraPayload: " + payload) + return execution.getVariable("FH_updateRequestInfraPayload") + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + } + } + + public String updateRequestGammaPayload (DelegateExecution execution){ + def method = getClass().getSimpleName() + '.updateRequestGammaPayload(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + + try { + String payload = """ + + + + + ${MsoUtils.xmlEscape(execution.getVariable("FH_request_id"))} + BPEL + ${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorMessage"))} + ${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorCode"))} + FAILED + + + + """ + + execution.setVariable("FH_updateRequestGammaPayload", payload) + msoLogger.debug("updateRequestGammaPayload: " + payload) + return execution.getVariable("FH_updateRequestGammaPayload") + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + } + } + + public String updateResponseStatusPayload (DelegateExecution execution){ + def method = getClass().getSimpleName() + '.updateResponseStatusPayload(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + + try { + String payload = """ + + + + + ${MsoUtils.xmlEscape(execution.getVariable("FH_request_id"))} + BPEL + SENDING_FINAL_NOTIFY + + + + """ + + execution.setVariable("FH_updateResponseStatusPayload", payload) + msoLogger.debug("updateResponseStatusPayload: " + payload) + return execution.getVariable("FH_updateResponseStatusPayload") + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + } + } + + public void buildDBWorkflowException(DelegateExecution execution, String responseCodeVariable) { + def method = getClass().getSimpleName() + '.buildDBWorkflowException(' + + 'execution=' + execution.getId() + + ', responseCodeVariable=' + responseCodeVariable + ')' + msoLogger.trace('Entered ' + method) + + try { + def responseCode = execution.getVariable(responseCodeVariable) + // If the HTTP response code was null, it means a connection fault occurred (a java exception) + def errorMessage = responseCode == null ? "Could not connect to DB Adapter" : "DB Adapter returned ${responseCode} response" + def errorCode = responseCode == null ? 7000 : 7020 + // exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage) + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + } + } + + /** + * Used to create a workflow response in success and failure cases. + */ + public void postProcessResponse (DelegateExecution execution) { + def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + + try { + Boolean success = (Boolean) execution.getVariable("FH_success") + String out = success ? "Fallout Handler Succeeded" : "Fallout Handler Failed"; + + def falloutHandlerResponse = """ + + ${MsoUtils.xmlEscape(out)} + + """ + + falloutHandlerResponse = utils.formatXml(falloutHandlerResponse) + msoLogger.debug("FalloutHandler Response: " + falloutHandlerResponse); + + execution.setVariable("FalloutHandlerResponse", falloutHandlerResponse) + execution.setVariable("WorkflowResponse", falloutHandlerResponse) + execution.setVariable("FH_ResponseCode", success ? "200" : "500") + setSuccessIndicator(execution, success) + + msoLogger.debug("FalloutHandlerResponse =\n" + falloutHandlerResponse) + } catch (Exception e) { + // Do NOT throw WorkflowException! + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + } + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy new file mode 100644 index 0000000000..5cdcd0d5bf --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy @@ -0,0 +1,173 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.onap.so.bpmn.core.UrnPropertiesReader + +import java.io.Serializable; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.springframework.web.util.UriUtils + +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.rest.APIResponse; +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +public class GenerateVfModuleName extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenerateVfModuleName.class); + + def Prefix="GVFMN_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + + + public void preProcessRequest(DelegateExecution execution) { + try { + def vnfId = execution.getVariable("vnfId") + msoLogger.debug("vnfId is " + vnfId) + def vnfName = execution.getVariable("vnfName") + msoLogger.debug("vnfName is " + vnfName) + def vfModuleLabel = execution.getVariable("vfModuleLabel") + msoLogger.debug("vfModuleLabel is " + vfModuleLabel) + def personaModelId = execution.getVariable("personaModelId") + msoLogger.debug("personaModelId is " + personaModelId) + execution.setVariable("GVFMN_vfModuleXml", "") + }catch(BpmnError b){ + throw b + }catch(Exception e){ + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in initVariables method!") + } + } + + + public void queryAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.queryAAI(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('vnfId') + def personaModelId = execution.getVariable('personaModelId') + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" + msoLogger.debug("AAI endPoint: " + endPoint) + + try { + RESTConfig config = new RESTConfig(endPoint); + def responseData = '' + def aaiRequestId = UUID.randomUUID().toString() + RESTClient client = new RESTClient(config). + addHeader('X-TransactionId', aaiRequestId). + addHeader('X-FromAppId', 'MSO'). + addHeader('Content-Type', 'application/xml'). + addHeader('Accept','application/xml'); + msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') + APIResponse response = client.httpGet() + msoLogger.debug("GenerateVfModuleName - invoking httpGet() to AAI") + + responseData = response.getResponseBodyAsString() + if (responseData != null) { + msoLogger.debug("Received generic VNF data: " + responseData) + + } + + msoLogger.debug("GenerateVfModuleName - queryAAIVfModule Response: " + responseData) + msoLogger.debug("GenerateVfModuleName - queryAAIVfModule ResponseCode: " + response.getStatusCode()) + + execution.setVariable('GVFMN_queryAAIVfModuleResponseCode', response.getStatusCode()) + execution.setVariable('GVFMN_queryAAIVfModuleResponse', responseData) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + if (response.getStatusCode() == 200) { + // Set the VfModuleXML + if (responseData != null) { + String vfModulesText = utils.getNodeXml(responseData, "vf-modules") + if (vfModulesText == null || vfModulesText.isEmpty()) { + msoLogger.debug("There are no VF modules in this VNF yet") + execution.setVariable("GVFMN_vfModuleXml", null) + } + else { + def xmlVfModules= new XmlSlurper().parseText(vfModulesText) + def vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} + int vfModulesSize = 0 + if (vfModules != null) { + vfModulesSize = vfModules.size() + } + String matchingVfModules = "" + for (i in 0..vfModulesSize-1) { + def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i]) + def personaModelIdFromAAI = utils.getNodeText(vfModuleXml, "model-invariant-id") + if (!personaModelIdFromAAI) { + // check old attribute name + personaModelIdFromAAI = utils.getNodeText(vfModuleXml, "persona-model-id") + } + if (personaModelIdFromAAI != null && personaModelIdFromAAI.equals(personaModelId)) { + matchingVfModules = matchingVfModules + utils.removeXmlPreamble(vfModuleXml) + } + } + matchingVfModules = matchingVfModules + "" + msoLogger.debug("Matching VF Modules: " + matchingVfModules) + execution.setVariable("GVFMN_vfModuleXml", matchingVfModules) + } + } + } + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAI(): ' + e.getMessage()) + } + + } + + public void generateName (DelegateExecution execution) { + def method = getClass().getSimpleName() + '.generateName() ' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + String vfModuleXml = execution.getVariable("GVFMN_vfModuleXml") + + String moduleIndex = utils.getLowestUnusedIndex(vfModuleXml) + msoLogger.debug("moduleIndex is: " + moduleIndex) + def vnfName = execution.getVariable("vnfName") + def vfModuleLabel = execution.getVariable("vfModuleLabel") + def vfModuleName = vnfName + "_" + vfModuleLabel + "_" + moduleIndex + msoLogger.debug("vfModuleName is: " + vfModuleName) + execution.setVariable("vfModuleName", vfModuleName) + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetService.groovy new file mode 100644 index 0000000000..857df16772 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetService.groovy @@ -0,0 +1,470 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.onap.so.bpmn.core.UrnPropertiesReader + +import org.apache.commons.lang3.StringEscapeUtils +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +import static org.apache.commons.lang3.StringUtils.isBlank + + + +/** + * This class supports the GenericGetService Sub Flow. + * This Generic sub flow can be used by any flow for accomplishing + * the goal of getting a Service-Instance or Service-Subscription (from AAI). + * The calling flow must set the GENGS_type variable as "service-instance" + * or "service-subscription". + * + * When using to Get a Service-Instance: + * If the global-customer-id and service-type are not provided + * this flow executes a query to get the service- Url using the + * Service Id or Name (whichever is provided). + * + * When using to Get a Service-Subscription: + * The global-customer-id and service-type must be + * provided. + * + * Upon successful completion of this sub flow the + * GENGS_SuccessIndicator will be true and the query response payload + * will be set to GENGS_service. An MSOWorkflowException will + * be thrown upon unsuccessful completion or if an error occurs + * at any time during this sub flow. Please map variables + * to the corresponding variable names below. + * + * Note - If this sub flow receives a Not Found (404) response + * from AAI at any time this will be considered an acceptable + * successful response however the GENGS_FoundIndicator + * will be set to false. This variable will allow the calling flow + * to distinguish between the two Success scenarios, + * "Success where service- is found" and + * "Success where service- is NOT found". + * + * + * Variable Mapping Below: + * + * In Mapping Variables: + * For Allotted-Resource: + * @param - GENGS_allottedResourceId + * @param - GENGS_type + * @param (Optional) - GENGS_serviceInstanceId + * @param (Optional) - GENGS_serviceType + * @param (Optional) - GENGS_globalCustomerId + * + * For Service-Instance: + * @param - GENGS_serviceInstanceId or @param - GENGS_serviceInstanceName + * @param - GENGS_type + * @param (Optional) - GENGS_serviceType + * @param (Optional) - GENGS_globalCustomerId + * + * For Service-Subscription: + * @param - GENGS_type + * @param - GENGS_serviceType + * @param - GENGS_globalCustomerId + * + * + * Out Mapping Variables: + * @param - GENGS_service + * @param - GENGS_FoundIndicator + * @param - WorkflowException + */ +class GenericGetService extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenericGetService.class); + + + String Prefix = "GENGS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + /** + * This method validates the incoming variables and + * determines the subsequent event based on which + * variables the calling flow provided. + * + * @param - execution + * + */ + public void preProcessRequest(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetService PreProcessRequest Process") + + execution.setVariable("GENGS_obtainObjectsUrl", false) + execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false) + execution.setVariable("GENGS_SuccessIndicator", false) + execution.setVariable("GENGS_FoundIndicator", false) + execution.setVariable("GENGS_resourceLink", null) + execution.setVariable("GENGS_siResourceLink", null) + + try{ + // Get Variables + String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") + String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") + String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") + String serviceType = execution.getVariable("GENGS_serviceType") + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + String type = execution.getVariable("GENGS_type") + + if(type != null){ + msoLogger.debug("Incoming GENGS_type is: " + type) + if(type.equalsIgnoreCase("allotted-resource")){ + if(isBlank(allottedResourceId)){ + msoLogger.debug("Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") + }else{ + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + if(isBlank(globalCustomerId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ + execution.setVariable("GENGS_obtainObjectsUrl", true) + }else{ + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + } + } + }else if(type.equalsIgnoreCase("service-instance")){ + if(isBlank(serviceInstanceId) && isBlank(serviceInstanceName)){ + msoLogger.debug("Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") + }else{ + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Instance Name is: " + serviceInstanceName) + if(isBlank(globalCustomerId) || isBlank(serviceType)){ + execution.setVariable("GENGS_obtainObjectsUrl", true) + if(isBlank(serviceInstanceId)){ + execution.setVariable("GENGS_obtainServiceInstanceUrlByName", true) + } + }else{ + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + } + } + }else if(type.equalsIgnoreCase("service-subscription")){ + if(isBlank(serviceType) || isBlank(globalCustomerId)){ + msoLogger.debug("Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") + }else{ + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENGS_type is null. Variable is Required.") + } + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug("Internal Error encountered within GenericGetService PreProcessRequest method!" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetService PreProcessRequest") + + } + msoLogger.trace("COMPLETED GenericGetService PreProcessRequest Process ") + } + + /** + * This method obtains the Url to the provided service instance + * using the Service Instance Id. + * + * @param - execution + */ + public void obtainServiceInstanceUrlById(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetService ObtainServiceInstanceUrlById Process") + try { + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + + String type = execution.getVariable("GENGS_type") + String path = "" + if(type.equalsIgnoreCase("service-instance")){ + String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") + msoLogger.debug(" Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId) + path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}" + msoLogger.debug("Service Instance Node Query Url is: " + path) + msoLogger.debug("Service Instance Node Query Url is: " + path) + }else if(type.equalsIgnoreCase("allotted-resource")){ + String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") + msoLogger.debug(" Querying Node for Service-Instance URL by using Allotted Resource Id: " + allottedResourceId) + path = "${aai_uri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}" + msoLogger.debug("Allotted Resource Node Query Url is: " + path) + msoLogger.debug("Allotted Resource Node Query Url is: " + path) + } + + //String url = "${aai_endpoint}${path}" host name needs to be removed from property + String url = "${path}" + execution.setVariable("GENGS_genericQueryPath", url) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) + int responseCode = response.getStatusCode() + execution.setVariable("GENGS_genericQueryResponseCode", responseCode) + msoLogger.debug(" GET Service Instance response code is: " + responseCode) + msoLogger.debug("GenericGetService AAI GET Response Code: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENGS_obtainSIUrlResponseBeforeUnescaping", aaiResponse) + msoLogger.debug("GenericGetService AAI Response before unescaping: " + aaiResponse) + execution.setVariable("GENGS_genericQueryResponse", aaiResponse) + msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) + msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) + + //Process Response + if(responseCode == 200){ + msoLogger.debug("Generic Query Received a Good Response Code") + execution.setVariable("GENGS_SuccessIndicator", true) + if(utils.nodeExists(aaiResponse, "result-data")){ + msoLogger.debug("Generic Query Response Does Contain Data" ) + execution.setVariable("GENGS_FoundIndicator", true) + String resourceLink = utils.getNodeText(aaiResponse, "resource-link") + execution.setVariable("GENGS_resourceLink", resourceLink) + execution.setVariable("GENGS_siResourceLink", resourceLink) + }else{ + msoLogger.debug("Generic Query Response Does NOT Contains Data" ) + execution.setVariable("WorkflowResponse", " ") //for junits + } + }else if(responseCode == 404){ + msoLogger.debug("Generic Query Received a Not Found (404) Response") + execution.setVariable("GENGS_SuccessIndicator", true) + execution.setVariable("WorkflowResponse", " ") //for junits + }else{ + msoLogger.debug("Generic Query Received a BAD REST Response: \n" + aaiResponse) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetService ObtainServiceInstanceUrlById method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlById") + } + msoLogger.trace("COMPLETED GenericGetService ObtainServiceInstanceUrlById Process") + } + + /** + * This method obtains the Url to the provided service instance + * using the Service Instance Name. + * + * @param - execution + */ + public void obtainServiceInstanceUrlByName(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetService ObtainServiceInstanceUrlByName Process") + try { + String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") + msoLogger.debug(" Querying Node for Service-Instance URL by using Service-Instance Name " + serviceInstanceName) + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-name:EQUALS:${serviceInstanceName}" + + //String url = "${aai_endpoint}${path}" host name needs to be removed from property + String url = "${path}" + execution.setVariable("GENGS_obtainSIUrlPath", url) + + msoLogger.debug("GenericGetService AAI Endpoint: " + aai_endpoint) + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) + int responseCode = response.getStatusCode() + execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode) + msoLogger.debug(" GET Service Instance response code is: " + responseCode) + msoLogger.debug("GenericGetService AAI Response Code: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse) + msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) + //Process Response + if(responseCode == 200){ + msoLogger.debug(" Query for Service Instance Url Received a Good Response Code") + execution.setVariable("GENGS_SuccessIndicator", true) + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + boolean nodeExists = isBlank(globalCustomerId) ? utils.nodeExists(aaiResponse, "result-data") : hasCustomerServiceInstance(aaiResponse, globalCustomerId) + if(nodeExists){ + msoLogger.debug("Query for Service Instance Url Response Does Contain Data" ) + execution.setVariable("GENGS_FoundIndicator", true) + String resourceLink = utils.getNodeText(aaiResponse, "resource-link") + execution.setVariable("GENGS_resourceLink", resourceLink) + execution.setVariable("GENGS_siResourceLink", resourceLink) + }else{ + msoLogger.debug("Query for Service Instance Url Response Does NOT Contains Data" ) + execution.setVariable("WorkflowResponse", " ") //for junits + } + }else if(responseCode == 404){ + msoLogger.debug(" Query for Service Instance Received a Not Found (404) Response") + execution.setVariable("GENGS_SuccessIndicator", true) + execution.setVariable("WorkflowResponse", " ") //for junits + }else{ + msoLogger.debug("Query for Service Instance Received a BAD REST Response: \n" + aaiResponse) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetService ObtainServiceInstanceUrlByName method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlByName") + } + msoLogger.trace("COMPLETED GenericGetService ObtainServiceInstanceUrlByName Process") + } + + + /** + * This method executes a GET call to AAI to obtain the + * service-instance or service-subscription + * + * @param - execution + */ + public void getServiceObject(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetService GetServiceObject Process") + try { + String type = execution.getVariable("GENGS_type") + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + String serviceEndpoint = "" + + msoLogger.debug("GenericGetService getServiceObject AAI Endpoint: " + aai_endpoint) + if(type.equalsIgnoreCase("service-instance")){ + String siResourceLink = execution.getVariable("GENGS_resourceLink") + if(isBlank(siResourceLink)){ + String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") + msoLogger.debug(" Incoming GENGS_serviceInstanceId is: " + serviceInstanceId) + String serviceType = execution.getVariable("GENGS_serviceType") + msoLogger.debug(" Incoming GENGS_serviceType is: " + serviceType) + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + }else{ + msoLogger.debug("Incoming Service Instance Url is: " + siResourceLink) + String[] split = siResourceLink.split("/aai/") + serviceEndpoint = "/aai/" + split[1] + } + }else if(type.equalsIgnoreCase("allotted-resource")){ + String siResourceLink = execution.getVariable("GENGS_resourceLink") + if(isBlank(siResourceLink)){ + String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") + msoLogger.debug(" Incoming GENGS_allottedResourceId is: " + allottedResourceId) + String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") + msoLogger.debug(" Incoming GENGS_serviceInstanceId is: " + serviceInstanceId) + String serviceType = execution.getVariable("GENGS_serviceType") + msoLogger.debug(" Incoming GENGS_serviceType is: " + serviceType) + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + }else{ + msoLogger.debug("Incoming Allotted-Resource Url is: " + siResourceLink) + String[] split = siResourceLink.split("/aai/") + serviceEndpoint = "/aai/" + split[1] + } + }else if(type.equalsIgnoreCase("service-subscription")){ + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + String serviceType = execution.getVariable("GENGS_serviceType") + serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + } + + String serviceUrl = "${aai_endpoint}" + serviceEndpoint + + execution.setVariable("GENGS_getServiceUrl", serviceUrl) + msoLogger.debug("GET Service AAI Path is: \n" + serviceUrl) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceUrl) + int responseCode = response.getStatusCode() + execution.setVariable("GENGS_getServiceResponseCode", responseCode) + msoLogger.debug(" GET Service response code is: " + responseCode) + msoLogger.debug("GenericGetService AAI Response Code: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENGS_getServiceResponse", aaiResponse) + msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) + //Process Response + if(responseCode == 200 || responseCode == 202){ + msoLogger.debug("GET Service Received a Good Response Code") + if(utils.nodeExists(aaiResponse, "service-instance") || utils.nodeExists(aaiResponse, "service-subscription")){ + msoLogger.debug("GET Service Response Contains a service-instance" ) + execution.setVariable("GENGS_FoundIndicator", true) + execution.setVariable("GENGS_service", aaiResponse) + execution.setVariable("WorkflowResponse", aaiResponse) + + }else{ + msoLogger.debug("GET Service Response Does NOT Contain Data" ) + } + }else if(responseCode == 404){ + msoLogger.debug("GET Service Received a Not Found (404) Response") + execution.setVariable("WorkflowResponse", " ") //for junits + } + else{ + msoLogger.debug(" GET Service Received a Bad Response: \n" + aaiResponse) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug(" Error encountered within GenericGetService GetServiceObject method!" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GenericGetService") + } + msoLogger.trace("COMPLETED GenericGetService GetServiceObject Process") + } + + /** + * An utility method which check whether a service(by name) is already present within a globalCustomerId or not. + * @param jsonResponse raw response received from AAI by searching ServiceInstance by Name. + * @param globalCustomerId + * @return {@code true} if globalCustomerId is found at 6th position within "resource-link", {@code false} in any other cases. + */ + public boolean hasCustomerServiceInstance(String aaiResponse, final String globalCustomerId) { + if (isBlank(aaiResponse)) { + return false + } + aaiResponse = utils.removeXmlNamespaces(aaiResponse) + ArrayList linksArray = utils.getMultNodeObjects(aaiResponse, "resource-link") + if (linksArray == null || linksArray.size() == 0) { + return false + } + for (String resourceLink : linksArray) { + int custStart = resourceLink.indexOf("customer/") + int custEnd = resourceLink.indexOf("/service-subscriptions/") + String receivedCustomerId = resourceLink.substring(custStart + 9, custEnd) + if (globalCustomerId.equals(receivedCustomerId)) { + return true + } + } + return false + } + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnf.groovy new file mode 100644 index 0000000000..01d8e9b8d5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnf.groovy @@ -0,0 +1,275 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.onap.so.bpmn.core.UrnPropertiesReader +import static org.onap.so.bpmn.common.scripts.GenericUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + + +/** + * TODO: Support getting vnf type = vpe + * + * This class supports the GenericGetVnf Sub Flow. + * This Generic sub flow can be used by any flow for accomplishing + * the goal of getting a Vnf Object (from AAI). The flow currently + * supports the querying of 2 types of Vnfs, generic-vnf and vce. The + * type must be provided by the calling flow and the type should + * be mapped to the variable GENGV_type. The type should either be + * "generic-vnf" or "vce". If the Vnf Id is not provided by the calling + * flow then this sub flow will execute the query to get the + * Vnf using the Vnf Name. Therefore, the calling flow must provide + * either the Vnf Id or Vnf Name. + * + * Upon successful completion of this sub flow the + * GENGV_SuccessIndicator will be true and the query response payload + * will be set to GENGV_vnf. An MSOWorkflowException will + * be thrown upon unsuccessful completion or if an error occurs + * at any time during this sub flow. Please map variables + * to the corresponding variable names below. + * + * Note - if this sub flow receives a Not Found (404) response + * from AAI at any time this will be considered an acceptable + * successful response however the GENGV_FoundIndicator + * set to false. This will allow the calling flow to distinguish + * between the two success scenarios, "Success where Vnf is found" + * and "Success where Vnf is NOT found". + * + * + * Variable Mapping Below + * + * In Mapping Variables: + * @param - GENGV_vnfId or @param - GENGV_vnfName + * @param - GENGV_type + * + * Out Mapping Variables: + * @param - GENGV_vnf + * @param - GENGV_SuccessIndicator + * @param - GENGV_FoundIndicator + * @param - WorkflowException + * + * + */ +class GenericGetVnf extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenericGetVnf.class); + + + String Prefix = "GENGV_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + /** + * This method validates the incoming variables and + * determines the subsequent event based on which + * variables the calling flow provided. + * + * @param - execution + */ + public void preProcessRequest(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetVnf PreProcessRequest Process") + + execution.setVariable("GENGV_getVnfByName", false) + execution.setVariable("GENGV_SuccessIndicator", false) + execution.setVariable("GENGV_FoundIndicator", false) + + try{ + // Get Variables + String vnfId = execution.getVariable("GENGV_vnfId") + msoLogger.debug("Incoming Vnf Id is: " + vnfId) + String vnfName = execution.getVariable("GENGV_vnfName") + msoLogger.debug("Incoming Vnf Name is: " + vnfName) + + if(isBlank(vnfId) && isBlank(vnfName)){ + msoLogger.debug("Incoming Vnf Name and Vnf Id are null. At least one is required!") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Vnf Name and Vnf Id are null. At least one is required.") + }else{ + if(isBlank(vnfId)){ + execution.setVariable("GENGV_getVnfByName", true) + } + } + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug(" Error encountered within GenericGetVnf PreProcessRequest method!" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetVnf PreProcessRequest") + + } + msoLogger.trace("COMPLETED GenericGetVnf PreProcessRequest Process ") + } + + /** + * This method executes a GET call to AAI to obtain the + * Vnf using the Vnf Name + * + * @param - execution + */ + public void getVnfByName(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetVnf GetVnfByName Process") + try { + String vnfName = execution.getVariable("GENGV_vnfName") + msoLogger.debug("Getting Vnf by Vnf Name: " + vnfName) + String type = execution.getVariable("GENGV_type") + msoLogger.debug("Type of Vnf Getting is: " + type) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + + //Determine Type of Vnf Querying For. + def aai_uri = "" + if(type.equals("generic-vnf")){ + aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + }else if(type.equals("vce")){ + aai_uri = aaiUriUtil.getNetworkVceUri(execution) + }else{ + msoLogger.debug("Invalid Incoming GENGV_type") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENGV_type") + } + + String getVnfPath = "${aai_endpoint}${aai_uri}?vnf-name=" + UriUtils.encode(vnfName, "UTF-8") + "&depth=1" + + execution.setVariable("GENGV_getVnfPath", getVnfPath) + msoLogger.debug("Get Vnf Url is: " + getVnfPath) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath) + int responseCode = response.getStatusCode() + execution.setVariable("GENGV_getVnfResponseCode", responseCode) + msoLogger.debug(" GET Vnf response code is: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENGV_getVnfResponse", aaiResponse) + + //Process Response + if(responseCode == 200){ + msoLogger.debug("GET Vnf Received a Good Response") + if(utils.nodeExists(aaiResponse, type)){ + msoLogger.debug("GET Vnf Response Contains a Vnf") + execution.setVariable("GENGV_FoundIndicator", true) + execution.setVariable("GENGV_vnf", aaiResponse) + execution.setVariable("WorkflowResponse", aaiResponse) + }else{ + msoLogger.debug("GET Vnf Response Does NOT Contain a Vnf") + } + + }else if(responseCode == 404){ + msoLogger.debug("GET Vnf Received a Not Found (404) Response") + }else{ + msoLogger.debug("GET Vnf Received a Bad Response: \n" + aaiResponse) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetVnf GetVnfByName method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfByName") + } + msoLogger.trace("COMPLETED GenericGetVnf GetVnfByName Process") + } + + /** + * This method executes a GET call to AAI to obtain the + * Vnf using the Vnf Id + * + * @param - execution + */ + public void getVnfById(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetVnf GetVnfById Process") + try { + String vnfId = execution.getVariable("GENGV_vnfId") + msoLogger.debug("Getting Vnf by Vnf Id: " + vnfId) + String type = execution.getVariable("GENGV_type") + msoLogger.debug("Type of Vnf Getting is: " + type) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + + //Determine Type of Vnf Querying For. + def aai_uri = "" + if(type.equals("generic-vnf")){ + aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + }else if(type.equals("vce")){ + aai_uri = aaiUriUtil.getNetworkVceUri(execution) + }else if(type.equals("vpe")){ + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "GenericGetVnf does not yet support getting type of vnf = vpe") + }else{ + msoLogger.debug("Invalid Incoming GENGV_type") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENGV_type") + } + msoLogger.debug("Using AAI Uri: " + aai_uri) + + String getVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" + msoLogger.debug("GET Vnf Endpoint is: " + getVnfPath) + + execution.setVariable("GENGV_getVnfPath", getVnfPath) + msoLogger.debug("Get Vnf Url is: " + getVnfPath) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath) + int responseCode = response.getStatusCode() + execution.setVariable("GENGV_getVnfResponseCode", responseCode) + msoLogger.debug(" GET Vnf response code is: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENGV_getVnfResponse", aaiResponse) + + //Process Response + if(responseCode == 200){ + msoLogger.debug("GET Vnf Received a Good Response") + if(utils.nodeExists(aaiResponse, type)){ + msoLogger.debug("GET Vnf Response Contains a Vnf") + execution.setVariable("GENGV_FoundIndicator", true) + execution.setVariable("GENGV_vnf", aaiResponse) + execution.setVariable("WorkflowResponse", aaiResponse) + }else{ + msoLogger.debug("GET Vnf Response Does NOT Contain a Vnf") + } + + }else if(responseCode == 404){ + msoLogger.debug("GET Vnf Received a Not Found (404) Response") + }else{ + msoLogger.debug("GET Vnf Received a BAD REST Response: \n" + aaiResponse) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetVnf GetVnfById method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfById") + } + msoLogger.trace("COMPLETED GenericGetVnf GetVnfById Process") + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.groovy new file mode 100644 index 0000000000..591e76e491 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.groovy @@ -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.bpmn.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import java.text.SimpleDateFormat +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +public class GenericNotificationService extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenericNotificationService.class); + + + + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void preProcessRequest (DelegateExecution execution) { + + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy new file mode 100644 index 0000000000..d41134be91 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy @@ -0,0 +1,282 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.onap.so.bpmn.core.UrnPropertiesReader + +import static org.apache.commons.lang3.StringUtils.*; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.apache.commons.codec.binary.Base64 +import org.apache.commons.lang3.* + +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.rest.APIResponse; +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig + +import java.net.URLEncoder; +import org.springframework.web.util.UriUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +/** + * This class supports the GenericPutService Sub Flow. + * This Generic sub flow can be used by any flow for the + * goal of creating a Service Instance or Service-Subscription in AAI. Upon successful completion of + * this sub flow the GENPS_SuccessIndicator will be true. + * The calling flow must set the GENPS_type variable as "service-instance" + * or "service-subscription". + * A MSOWorkflowException will be thrown Upon unsuccessful + * completion or if an error occurs within this flow. + * Please map variables to the corresponding variable names + * below. + * + * + * Incoming Required Variables: + * @param - GENPS_requestId + * @param - GENPS_type - Required field. This will be required field populated as service-instance or service-subscription + * @param - GENPS_globalSubscriberId - Required field + * @param - GENPS_serviceType - Required Field + * @param - GENPS_payload - Required Field This will be the payload that needs to be sent. + * + * @param - GENPS_serviceInstanceId - Conditional Field. Required for service-instance. + * @param - GENPS_allottedResourceId - Conditional Field. Required for allotted-resource. + * @param - GENPS_tunnelXconnectId - Conditional Field. Required for tunnel-xconnect. + * + * @param - GENPS_serviceResourceVersion - Conditional Field. Needs to be provided only in case of update for both service-instance and service subscription. The calling flows + * should check if a service-instance or servic-subscription exists by calling the subflow GenericGetService. if it exists then resourceversion should be + * obtained from aai and sent as an input parameter. + * + * Outgoing Variables: + * @param - GENPS_SuccessIndicator + * @param - WorkflowException + * + * + */ + + +class GenericPutService extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenericPutService.class); + + + String Prefix = "GENPS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + + public void preProcessRequest(DelegateExecution execution) { + execution.setVariable("isDebugLogEnabled","true") + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericPutService PreProcessRequest Process") + + execution.setVariable("GENPS_SuccessIndicator", false) + + try{ + // Get Variables + String requestId = execution.getVariable("GENPS_requestId") + msoLogger.debug("Incoming GENPS_requestId is: " + requestId) + + String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + String serviceType = execution.getVariable("GENPS_serviceType") + String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") + String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") + String type = execution.getVariable("GENPS_type") + + if(type != null){ + msoLogger.debug("Incoming GENPS_type is: " + type) + if(type.equalsIgnoreCase("service-instance")){ + if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ + msoLogger.debug("Incoming Required Variable is missing or null!") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") + }else{ + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + } + }else if(type.equalsIgnoreCase("service-subscription")){ + if(isBlank(serviceType) || isBlank(globalSubscriberId)){ + msoLogger.debug("Incoming ServiceType or GlobalSubscriberId is null. These variables are required to create a service-subscription.") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") + }else{ + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + } + }else if(type.equalsIgnoreCase("allotted-resource")){ + if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId)){ + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + msoLogger.debug("Incoming Required Variable is missing or null!") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") + }else{ + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + } + }else if(type.equalsIgnoreCase("tunnel-xconnect")){ + if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId) || isBlank(tunnelXconnectId)){ + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + msoLogger.debug("Incoming Tunnel Xconnect Id is: " + tunnelXconnectId) + msoLogger.debug("Incoming Required Variable is missing or null!") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") + }else{ + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + msoLogger.debug("Incoming Tunnel Xconnect Id is: " + tunnelXconnectId) + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENPS_type is null. Variable is Required.") + } + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericPutService PreProcessRequest method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericPutService PreProcessRequest") + + } + msoLogger.trace("COMPLETED GenericPutService PreProcessRequest Process ") + + } + + /** + * This method executes a Put call to AAI for the provided + * service instance. + * + * @param - execution + * + */ + public void putServiceInstance(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericPutService PutServiceInstance method") + try { + String type = execution.getVariable("GENPS_type") + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + String namespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) + msoLogger.debug('AAI namespace is: ' + namespace) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + String serviceAaiPath = "" + String payload = execution.getVariable("GENPS_payload") + execution.setVariable("GENPS_payload", payload) + msoLogger.debug("Incoming GENPS_payload is: " + payload) + msoLogger.debug(payload) + + String serviceType = execution.getVariable("GENPS_serviceType") + msoLogger.debug(" Incoming GENPS_serviceType is: " + serviceType) + + String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + + // This IF clause is if we need to create a new Service Instance + if(type.equalsIgnoreCase("service-instance")){ + + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + URLEncoder.encode(serviceInstanceId,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + + }else if(type.equalsIgnoreCase("service-subscription")){ + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + }else if(type.equalsIgnoreCase("allotted-resource")){ + + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) + String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") + msoLogger.debug(" Incoming GENPS_allottedResourceId is: " + allottedResourceId) + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + }else if(type.equalsIgnoreCase("tunnel-xconnect")){ + + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) + String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") + msoLogger.debug(" Incoming GENPS_allottedResourceId is: " + allottedResourceId) + String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") + msoLogger.debug(" Incoming GENPS_tunnelXconnectId is: " + tunnelXconnectId) + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + "/tunnel-xconnects/tunnel-xconnect/" + UriUtils.encode(tunnelXconnectId,"UTF-8") + } + + String resourceVersion = execution.getVariable("GENPS_serviceResourceVersion") + msoLogger.debug("Incoming Resource Version is: " + resourceVersion) + if(resourceVersion !=null){ + serviceAaiPath = serviceAaiPath +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8") + } + + execution.setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath) + msoLogger.debug("PUT Service Instance AAI Path is: " + "\n" + serviceAaiPath) + APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) + int responseCode = response.getStatusCode() + execution.setVariable("GENPS_putServiceInstanceResponseCode", responseCode) + msoLogger.debug(" Put Service Instance response code is: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENPS_putServiceInstanceResponse", aaiResponse) + + //Process Response + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + //200 OK 201 CREATED 202 ACCEPTED + { + msoLogger.debug("PUT Service Instance Received a Good Response") + execution.setVariable("GENPS_SuccessIndicator", true) + } + + else{ + msoLogger.debug("Put Generic Service Instance Received a Bad Response Code. Response Code is: " + responseCode) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericPutService PutServiceInstance method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Put Service Instance") + } + msoLogger.trace("COMPLETED GenericPutService PutServiceInstance Process") + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericUtils.groovy new file mode 100644 index 0000000000..cc261a2750 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericUtils.groovy @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.apache.commons.lang3.StringUtils; + +class GenericUtils extends StringUtils{ + + @Override + public static boolean isBlank(final CharSequence cs) { + int strLen; + if (cs == null || (strLen = cs.length()) == 0 || cs.equals("null")) { + return true; + } + for (int i = 0; i < strLen; i++) { + if (!Character.isWhitespace(cs.charAt(i))) { + return false; + } + } + return true; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy new file mode 100644 index 0000000000..820364b1f7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy @@ -0,0 +1,343 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import java.time.chrono.AbstractChronology +import java.util.List +import java.text.SimpleDateFormat +import java.util.Date + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.TaskService +import org.camunda.bpm.engine.task.Task +import org.camunda.bpm.engine.task.TaskQuery +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateTask +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.ruby.* +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + + + +/** + * This groovy class supports the ManualHandling.bpmn process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDebugLogEnabled + * @param - serviceType + * @param - vnfType + * @param - requestorId + * @param - currentActivity + * @param - workStep + * @param - failedActivity + * @param - errorCode + * @param - errorText + * @param - validResponses + * @param - vnfName + * + * Outputs: + * @param - WorkflowException + * @param - taskId + * + */ +public class ManualHandling extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ManualHandling.class); + + + String Prefix="MH_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtils = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + String msg = "" + msoLogger.trace("preProcessRequest of ManualHandling ") + + try { + execution.setVariable("prefix", Prefix) + setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled')) + // check for required input + String requestId = execution.getVariable("msoRequestId") + msoLogger.debug("msoRequestId is: " + requestId) + def serviceType = execution.getVariable("serviceType") + msoLogger.debug("serviceType is: " + serviceType) + def vnfType = execution.getVariable("vnfType") + msoLogger.debug("vnftype is: " + vnfType) + def currentActivity = execution.getVariable("currentActivity") + msoLogger.debug("currentActivity is: " + currentActivity) + def workStep = execution.getVariable("workStep") + msoLogger.debug("workStep is: " + workStep) + def failedActivity = execution.getVariable("failedActivity") + msoLogger.debug("failedActivity is: " + failedActivity) + def errorCode = execution.getVariable("errorCode") + msoLogger.debug("errorCode is: " + errorCode) + def errorText = execution.getVariable("errorText") + msoLogger.debug("errorText is: " + errorText) + def requestorId = execution.getVariable("requestorId") + msoLogger.debug("requestorId is: " + requestorId) + def validResponses = execution.getVariable("validResponses") + msoLogger.debug("validResponses is: " + validResponses) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest of RainyDayHandler ") + } + + public void createManualTask (DelegateExecution execution) { + String msg = "" + msoLogger.trace("createManualTask of ManualHandling ") + + try { + String taskId = UUID.randomUUID() + execution.setVariable('taskId', taskId) + String type = "fallout" + String nfRole = execution.getVariable("vnfType") + String subscriptionServiceType = execution.getVariable("serviceType") + String originalRequestId = execution.getVariable("msoRequestId") + String originalRequestorId = execution.getVariable("requestorId") + String errorSource = execution.getVariable("failedActivity") + String errorCode = execution.getVariable("errorCode") + String errorMessage = execution.getVariable("errorText") + String buildingBlockName = execution.getVariable("currentActivity") + String buildingBlockStep = execution.getVariable("workStep") + String validResponses = execution.getVariable("validResponses") + + msoLogger.debug("Before creating task") + + Map taskVariables = new HashMap() + taskVariables.put("type", type) + taskVariables.put("nfRole", nfRole) + taskVariables.put("subscriptionServiceType", subscriptionServiceType) + taskVariables.put("originalRequestId", originalRequestId) + taskVariables.put("originalRequestorId", originalRequestorId) + taskVariables.put("errorSource", errorSource) + taskVariables.put("errorCode", errorCode) + taskVariables.put("errorMessage", errorMessage) + taskVariables.put("buildingBlockName", buildingBlockName) + taskVariables.put("buildingBlockStep", buildingBlockStep) + taskVariables.put("validResponses", validResponses) + + TaskService taskService = execution.getProcessEngineServices().getTaskService() + Task manualTask = taskService.newTask(taskId) + taskService.saveTask(manualTask) + taskService.setVariables(taskId, taskVariables) + msoLogger.debug("successfully created task: "+ taskId) + } catch (BpmnError e) { + msoLogger.debug("BPMN exception: " + e.errorMessage) + throw e; + } catch (Exception ex){ + msg = "Exception in createManualTask " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit createManualTask of ManualHandling ") + } + + public void setTaskVariables (DelegateTask task) { + + DelegateExecution execution = task.getExecution() + + String msg = "" + msoLogger.trace("setTaskVariables of ManualHandling ") + String taskId = task.getId() + msoLogger.debug("taskId is: " + taskId) + + try { + execution.setVariable('taskId', taskId) + String type = "fallout" + String nfRole = execution.getVariable("vnfType") + String subscriptionServiceType = execution.getVariable("serviceType") + String originalRequestId = execution.getVariable("msoRequestId") + String originalRequestorId = execution.getVariable("requestorId") + String errorSource = execution.getVariable("failedActivity") + String errorCode = execution.getVariable("errorCode") + String errorMessage = execution.getVariable("errorText") + String buildingBlockName = execution.getVariable("currentActivity") + String buildingBlockStep = execution.getVariable("workStep") + String validResponses = execution.getVariable("validResponses") + + msoLogger.debug("Before creating task") + + Map taskVariables = new HashMap() + taskVariables.put("type", type) + taskVariables.put("nfRole", nfRole) + taskVariables.put("subscriptionServiceType", subscriptionServiceType) + taskVariables.put("originalRequestId", originalRequestId) + taskVariables.put("originalRequestorId", originalRequestorId) + taskVariables.put("errorSource", errorSource) + taskVariables.put("errorCode", errorCode) + taskVariables.put("errorMessage", errorMessage) + taskVariables.put("buildingBlockName", buildingBlockName) + taskVariables.put("buildingBlockStep", buildingBlockStep) + taskVariables.put("validResponses", validResponses) + TaskService taskService = execution.getProcessEngineServices().getTaskService() + + + taskService.setVariables(taskId, taskVariables) + msoLogger.debug("successfully created task: "+ taskId) + } catch (BpmnError e) { + msoLogger.debug("BPMN exception: " + e.errorMessage) + throw e; + } catch (Exception ex){ + msg = "Exception in createManualTask " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit createManualTask of ManualHandling ") + } + + public void completeTask (DelegateTask task) { + + DelegateExecution execution = task.getExecution() + + String msg = "" + msoLogger.trace("completeTask of ManualHandling ") + String taskId = task.getId() + msoLogger.debug("taskId is: " + taskId) + + try { + TaskService taskService = execution.getProcessEngineServices().getTaskService() + + Map taskVariables = taskService.getVariables(taskId) + String responseValue = taskVariables.get("responseValue") + + msoLogger.debug("Received responseValue on completion: "+ responseValue) + // Have to set the first letter of the response to upper case + String responseValueForRainyDay = responseValue.substring(0, 1).toUpperCase() + responseValue.substring(1) + msoLogger.debug("ResponseValue to RainyDayHandler: "+ responseValueForRainyDay) + execution.setVariable("responseValue", responseValueForRainyDay) + + } catch (BpmnError e) { + msoLogger.debug("BPMN exception: " + e.errorMessage) + throw e; + } catch (Exception ex){ + msg = "Exception in createManualTask " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit completeTask of ManualHandling ") + } + + public void prepareRequestsDBStatusUpdate (DelegateExecution execution, String requestStatus){ + + def method = getClass().getSimpleName() + '.prepareRequestsDBStatusUpdate(' +'execution=' + execution.getId() +')' + msoLogger.trace("prepareRequestsDBStatusUpdate of ManualHandling ") + try { + def requestId = execution.getVariable("msoRequestId") + String payload = """ + + + + + ${MsoUtils.xmlEscape(requestId)} + ManualHandling + ${MsoUtils.xmlEscape(requestStatus)} + + + + """ + + execution.setVariable("setUpdateDBstatusPayload", payload) + msoLogger.debug("Outgoing Update Mso Request Payload is: " + payload) + msoLogger.debug("setUpdateDBstatusPayload: " + payload) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + } + + msoLogger.trace("Exit prepareRequestsDBStatusUpdate of ManualHandling ") + } + + public void createAOTSTicket (DelegateExecution execution) { + String msg = "" + msoLogger.trace("createAOTSTicket of ManualHandling ") + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + // This method will not be throwing an exception, but rather log the error + + try { + execution.setVariable("prefix", Prefix) + setBasicDBAuthHeader(execution,isDebugLogEnabled) + // check for required input + String requestId = execution.getVariable("msoRequestId") + msoLogger.debug("requestId is: " + requestId) + def currentActivity = execution.getVariable("currentActivity") + msoLogger.debug("currentActivity is: " + currentActivity) + def workStep = execution.getVariable("workStep") + msoLogger.debug("workStep is: " + workStep) + def failedActivity = execution.getVariable("failedActivity") + msoLogger.debug("failedActivity is: " + failedActivity) + def errorCode = execution.getVariable("errorCode") + msoLogger.debug("errorCode is: " + errorCode) + def errorText = execution.getVariable("errorText") + msoLogger.debug("errorText is: " + errorText) + def vnfName = execution.getVariable("vnfName") + msoLogger.debug("vnfName is: " + vnfName) + + String rubyRequestId = UUID.randomUUID() + msoLogger.debug("rubyRequestId: " + rubyRequestId) + String sourceName = vnfName + msoLogger.debug("sourceName: " + sourceName) + String reason = "VID Workflow failed at " + failedActivity + " " + workStep + " call with error " + errorCode + msoLogger.debug("reason: " + reason) + String workflowId = requestId + msoLogger.debug("workflowId: " + workflowId) + String notification = "Request originated from VID | Workflow fallout on " + vnfName + " | Workflow step failure: " + workStep + " failed | VID workflow ID: " + workflowId + msoLogger.debug("notification: " + notification) + + msoLogger.debug("Creating AOTS Ticket request") + + RubyClient rubyClient = new RubyClient() + rubyClient.rubyCreateTicketCheckRequest(rubyRequestId, sourceName, reason, workflowId, notification) + + } catch (BpmnError e) { + msg = "BPMN error in createAOTSTicket " + ex.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + } catch (Exception ex){ + msg = "Exception in createAOTSTicket " + ex.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + } + msoLogger.trace("Exit createAOTSTicket of ManualHandling ") + } + + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy new file mode 100644 index 0000000000..f9ddd0d430 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy @@ -0,0 +1,999 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import java.text.SimpleDateFormat + +import org.apache.commons.codec.binary.Base64 +import org.apache.commons.lang3.StringEscapeUtils +import org.onap.so.bpmn.core.BPMNLogger +import org.onap.so.bpmn.core.xml.XmlTool +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.utils.CryptoUtils +import org.slf4j.MDC +import org.w3c.dom.Element + +import groovy.util.slurpersupport.NodeChild +import groovy.xml.XmlUtil + +class MsoUtils { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, MsoUtils.class); + + def initializeEndPoints(execution){ + // use this placeholder to initialize end points, if called independently, this need to be set + execution.setVariable("AAIEndPoint","http://localhost:28080/SoapUIMocks") + } + + /** + * Returns the unescaped contents of element + * + * @param xmlInput + * @param element + * @return + */ + def getNodeText(xmlInput,element){ + def rtn=null + if(xmlInput!=null){ + def xml= new XmlSlurper().parseText(xmlInput) + rtn= xml.'**'.find{node->node.name()==element} + if (rtn != null){ + rtn=rtn.text() + } + } + return rtn + } + def getMultNodes(xmlInput, element){ + def nodes=null + if(xmlInput!=null){ + def xml= new XmlSlurper().parseText(xmlInput) + nodes = xml.'**'.findAll{ node-> node.name() == element }*.text() + } + return nodes + } + /** + * Note: this uses XmlParser instead of XmlSlurper, thus it is not as + * efficient because it instantiates the whole DOM tree. + * @param xmlInput + * @param element + * @return a list of Nodes, or {@code null} if xmlInput is {@code null} + */ + def getMultNodeObjects(xmlInput, element){ + def nodes=null + if(xmlInput!=null){ + def xml= new XmlParser().parseText(xmlInput) + nodes = xml.'**'.findAll{ node-> node.name() == element } + } + return nodes + } + + def getNodeXml(xmlInput,element){ + return getNodeXml(xmlInput, element, true) + } + def getNodeXml(xmlInput,element,incPreamble){ + def fxml= new XmlSlurper().parseText(xmlInput) + NodeChild nodeToSerialize = fxml.'**'.find {it.name() == element} + if(nodeToSerialize==null){ + return "" + } + def nodeAsText = XmlUtil.serialize(nodeToSerialize) + if (!incPreamble) { + nodeAsText = removeXmlPreamble(nodeAsText) + } + + return unescapeNodeContents(nodeToSerialize, nodeAsText) + } + + def unescapeNodeContents(NodeChild node, String text) { + if (!node.childNodes().hasNext()) { + return StringEscapeUtils.unescapeXml(text) + } else { + return text + } + } + + def nodeExists(xmlInput,element){ + try { + def fxml= new XmlSlurper().parseText(xmlInput) + def nodeToSerialize = fxml.'**'.find {it.name() == element} + return nodeToSerialize!=null + } catch(Exception e) { + return false + } + } + + + /***** Utilities when using XmlParser *****/ + + /** + * Convert a Node into a String by deserializing it and formatting it. + * + * @param node Node to be converted. + * @return the Node as a String. + */ + def String nodeToString(Node node) { + def String nodeAsString = groovy.xml.XmlUtil.serialize(node) + nodeAsString = removeXmlPreamble(nodeAsString) + return formatXml(nodeAsString) + } + + /** + * Get the specified child Node of the specified parent. If there are + * multiple children of the same name, only the first one is returned. + * If there are no children with the specified name, 'null' is returned. + * + * @param parent Parent Node in which to find a child. + * @param childNodeName Name of the child Node to get. + * @return the (first) child Node with the specified name or 'null' + * if a child Node with the specified name does not exist. + */ + def Node getChildNode(Node parent, String childNodeName) { + def NodeList nodeList = getIdenticalChildren(parent, childNodeName) + if (nodeList.size() == 0) { + return null + } else { + return nodeList.get(0) + } + } + + /** + * Get the textual value of the specified child Node of the specified parent. + * If there are no children with the specified name, 'null' is returned. + * + * @param parent Parent Node in which to find a child. + * @param childNodeName Name of the child Node whose value to get. + * @return the textual value of child Node with the specified name or 'null' + * if a child Node with the specified name does not exist. + */ + def String getChildNodeText(Node parent, String childNodeName) { + def Node childNode = getChildNode(parent, childNodeName) + if (childNode == null) { + return null + } else { + return childNode.text() + } + } + + /** + * Get all of the child nodes from the specified parent that have the + * specified name. The returned NodeList could be empty. + * + * @param parent Parent Node in which to find children. + * @param childNodeName Name of the children to get. + * @return a NodeList of all the children from the parent with the specified + * name. The list could be empty. + */ + def NodeList getIdenticalChildren(Node parent, String childNodeName) { + return (NodeList) parent.get(childNodeName) + } + + /***** End of Utilities when using XmlParser *****/ + + + /** these are covered under the common function above**/ + def getSubscriberName(xmlInput,element){ + def rtn=null + if(xmlInput!=null){ + def xml= new XmlSlurper().parseText(xmlInput) + rtn= xml.'**'.find{node->node.name()==element}.text() + } + return rtn + } + def getTenantInformation(xmlInput,element){ + def xml= new XmlSlurper().parseText(xmlInput) + def nodeToSerialize = xml.'**'.find {it.name() == 'service-information'} + def nodeAsText = XmlUtil.serialize(nodeToSerialize) + return nodeAsText + } + def getServiceInstanceId(xmlInput,element){ + def xml= new XmlSlurper().parseText(xmlInput) + return ( xml.'**'.find{node->node.name()==element}.text() ) + } + //for aai tenant url + def searchResourceLink(xmlInput, resourceType){ + def fxml= new XmlSlurper().parseText(xmlInput) + def element = fxml.'**'.find {it.'resource-type' == resourceType} + return (element == null) ? null : element.'resource-link'.text() + } + + def searchMetaData(xmlInput, searchName, searchValue){ + def fxml= new XmlSlurper().parseText(xmlInput) + def ret = fxml.'**'.find {it.metaname.text() == searchName && it.metaval.text() == searchValue} + if(ret != null){ + return ret.parent().parent() + } + return ret + } + + def searchMetaDataNode(fxml, searchName, searchValue){ + def ret = fxml.'**'.find {it.metaname.text() == searchName && it.metaval.text() == searchValue} + if(ret != null){ + return ret.parent().parent() + } + return ret + } + + // for Trinity L3 add/delete bonding + def getPBGFList(isDebugLogEnabled, xmlInput){ + log("DEBUG", "getPBGFList: xmlInput " + xmlInput,isDebugLogEnabled) + ArrayList myNodes = new ArrayList() + if(nodeExists(xmlInput,"nbnc-response-information")){ + def respInfo=getNodeXml(xmlInput,"nbnc-response-information", false) + if(respInfo!=null){ + def fxml= new XmlSlurper().parseText(respInfo) + fxml.'virtual-datacenter-list'.each { vdc -> + //we only want to add two BGF per VDC, BGF1 and BGF2 + def routerList = vdc.'router-list'.first() + routerList.each{ myList -> + def physNodes = myList.'**'.findAll {it.'border-element-tangibility'.text() =~ /PHYSICAL/} + def nodeToAdd + physNodes.each{ + if(nodeToAdd==null){ + nodeToAdd = it + }else{ + def beid = nodeToAdd.'border-element-id'.text() + + " " + nodeToAdd.'border-element-type'.text() + + " and " + + it.'border-element-id'.text() + + " " + it.'border-element-type'.text() + def mytag = nodeToAdd.'border-element-id' + mytag[0].replaceBody(beid) + } + } + def mytag = nodeToAdd.'vlan-id' + def ind = mytag.text().indexOf('.') + if(ind >= 0){ + def vlan = mytag.text().substring(0,ind) + mytag[0].replaceBody(vlan) + } + myNodes.add(XmlUtil.serialize(nodeToAdd)) + } + + } + } + + return myNodes + }else{ + return null + } + } + + def getPBGFList(xmlInput){ + getPBGFList("false", xmlInput) + } + + def getMetaVal(node, name){ + try{ + return node.'**'.find {it.metaname.text() == name}.metaval.text() + }catch(Exception e){ + return null + } + } + def getRelationshipVal(node, name){ + try{ + return node.'**'.find {it.'relationship-key'.text() == name}.'relationship-value'.text() + }catch(Exception e){ + return null + } + } + + + def log(logmode,logtxt,isDebugLogEnabled="false"){ + if ("INFO"==logmode) { + msoLogger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN", MsoLogger.getServiceName()); + } else if ("WARN"==logmode) { + // to see the warning text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger warn() method + msoLogger.warn (MessageEnum.BPMN_GENERAL_WARNING, logtxt, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt); + } else if ("ERROR"==logmode) { + // to see the error text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger error() method + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt); + + } else { + BPMNLogger.debug(isDebugLogEnabled, logtxt); + } + } + + def logContext(requestId, serviceInstanceId){ + msoLogger.setLogContext(requestId, serviceInstanceId); + } + + def logMetrics(elapsedTime, logtxt){ + + msoLogger.recordMetricEvent (elapsedTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + logtxt, "BPMN", MsoLogger.getServiceName(), null); + } + + def logAudit(logtxt){ + long startTime = System.currentTimeMillis(); + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logtxt); + } + + // headers: header - name-value + def getHeaderNameValue(xmlInput, nameAttribute){ + def rtn=null + if(xmlInput!=null){ + def xml= new XmlSlurper().parseText(xmlInput) + rtn= xml.'**'.find {header->header.'@name'.text() == nameAttribute}.'@value' + } + return rtn + } + + /** + * Gets the children of the specified element. + */ + public String getChildNodes(xmlInput, element) { + def xml= new XmlSlurper().parseText(xmlInput) + def thisElement = xml.'**'.find {it.name() == element} + StringBuilder out = new StringBuilder() + if (thisElement != null) { + thisElement.children().each() { + String nodeAsText = removeXmlPreamble(XmlUtil.serialize(it)) + if (out.length() > 0) { + out.append(System.lineSeparator()) + } + out.append(nodeAsText) + } + } + return out.toString(); + } + + /** + * Encodes a value so it can be used inside an XML text element. + * + * Will double encode + * @param s the string to encode + * @return the encoded string + */ + public static String xmlEscape(Object value) { + return XmlTool.encode(value) + } + + /** + * Removes the preamble, if present, from an XML document. + * Also, for historical reasons, this also trims leading and trailing + * whitespace from the resulting document. TODO: remove the trimming + * and fix unit tests that depend on EXACT xml format. + * @param xml the XML document + * @return a possibly modified document + */ + public String removeXmlPreamble(def xml) { + if (xml == null) { + return null + } + + return XmlTool.removePreamble(xml).trim() + } + + /** + * Removes namespaces and namespace declarations from an XML document. + * @param xml the XML document + * @return a possibly modified document + */ + public String removeXmlNamespaces(def xml) { + return XmlTool.removeNamespaces(xml); + } + + /** + * Use formatXml instead. Note: this method inserts an XML preamble. + */ + @Deprecated + def formatXML(xmlInput) { + def parseXml = null + def formatXml = null + if (xmlInput !=null) { + parseXml = new XmlParser().parseText(xmlInput) + formatXml = XmlUtil.serialize(parseXml) + } + } + + /** + * Reformats an XML document. The result will not contain an XML preamble + * or a trailing newline. + * @param xml the XML document + * @return a reformatted document + */ + public String formatXml(def xml) { + return XmlTool.normalize(xml); + } + + // build single elements + def buildElements(xmlInput, elementList, parentName) { + String var = "" + def xmlBuild = "" + if (parentName != "") { + xmlBuild += "" + } + if (xmlInput != null) { + for (element in elementList) { + def xml= new XmlSlurper().parseText(xmlInput) + var = xml.'**'.find {it.name() == element} + if (var != null) { + xmlBuild += ""+var.toString()+"" + } + } + } + if (parentName != "") { + xmlBuild += "" + } + return xmlBuild + } + + // build the Unbounded elements + def buildElementsUnbounded(xmlInput, elementList, parentName) { + def varParents = "" + def var = "" + def xmlBuildUnbounded = "" + if (xmlInput != null) { + def xml= new XmlSlurper().parseText(xmlInput) + varParents = xml.'**'.findAll {it.name() == parentName} + //println " Unbounded ${parentName} - varParent.Size() - " + varParents.size() + for (i in 0..varParents.size()-1) { + if (parentName != "") { + xmlBuildUnbounded += "" + } + for (element in elementList) { + var = varParents[i].'*'.find {it.name() == element} + if (var != null) { + xmlBuildUnbounded += ""+var.toString()+"" + //println " i = " + i + ", element: " + element + " = " + var.toString() + } + } + if (parentName != "") { + xmlBuildUnbounded += "" + } + } + } + return xmlBuildUnbounded + } + + // Build l2-homing-information + def buildL2HomingInformation(xmlInput) { + def elementsL2HomingList = ["evc-name", "topology", "preferred-aic-clli","aic-version"] + def rebuildL2Home = '' + if (xmlInput != null) { + rebuildL2Home = buildElements(xmlInput, elementsL2HomingList, "l2-homing-information") + } + return rebuildL2Home + } + + // Build internet-evc-access-information + def buildInternetEvcAccessInformation(xmlInput) { + def elementsInternetEvcAccessInformationList = ["internet-evc-speed-value", "internet-evc-speed-units", "ip-version"] + def rebuildInternetEvcAccess = '' + if (xmlInput != null) { + rebuildInternetEvcAccess = buildElements(xmlInput, elementsInternetEvcAccessInformationList, "internet-evc-access-information") + } + return rebuildInternetEvcAccess + } + + // Build ucpe-vms-service-information + def buildUcpeVmsServiceInformation(xmlInput) { + def rebuildUcpeVmsServiceInformation = '' + if (xmlInput != null) { + def ucpeVmsServiceInformation = getNodeXml(xmlInput, "ucpe-vms-service-information").drop(38).trim() + rebuildUcpeVmsServiceInformation = "" + // transport-service-information + rebuildUcpeVmsServiceInformation += "" + def transportServiceInformation = getNodeXml(ucpeVmsServiceInformation, "transport-service-information").drop(38).trim() + def elementsTransportServiceInformationList = ["transport-service-type"] + rebuildUcpeVmsServiceInformation += buildElements(transportServiceInformation, elementsTransportServiceInformationList, "") + try { // optional + def accessCircuitInfoList = ["access-circuit-id", "dual-mode"] + rebuildUcpeVmsServiceInformation += buildElementsUnbounded(transportServiceInformation, accessCircuitInfoList, "access-circuit-info") + } catch (Exception e) { + log("ERROR", " Optional - Exception ACCESS-CIRCUIT-INFO - 'access-circuit-info' ") + } + rebuildUcpeVmsServiceInformation += "" + // ucpe-information + def elementsUcpeInformationList = ["ucpe-host-name", "ucpe-activation-code", "out-of-band-management-modem" ] + rebuildUcpeVmsServiceInformation += buildElements(ucpeVmsServiceInformation, elementsUcpeInformationList, "ucpe-information") + // vnf-list + rebuildUcpeVmsServiceInformation += "" + def vnfListList = ["vnf-instance-id", "vnf-sequence-number", "vnf-type", "vnf-vendor", "vnf-model", "vnf-id", "prov-status", "operational-state", "orchestration-status", "equipment-role" ] + rebuildUcpeVmsServiceInformation += buildElementsUnbounded(ucpeVmsServiceInformation, vnfListList, "vnf-information") + rebuildUcpeVmsServiceInformation += "" + rebuildUcpeVmsServiceInformation += "" + } + log("DEBUG", " rebuildUcpeVmsServiceInformation - " + rebuildUcpeVmsServiceInformation) + return rebuildUcpeVmsServiceInformation + } + + // Build internet-service-change-details + def buildInternetServiceChangeDetails(xmlInput) { + def rebuildInternetServiceChangeDetails = "" + if (xmlInput != null) { + try { // optional + def internetServiceChangeDetails = getNodeXml(xmlInput, "internet-service-change-details").drop(38).trim() + rebuildInternetServiceChangeDetails = "" + rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["internet-evc-speed-value"], "") + rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["internet-evc-speed-units"], "") + rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["v4-vr-lan-address"], "") + rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["v4-vr-lan-prefix-length"], "") + try { // optional + def tProvidedV4LanPublicPrefixesChangesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length"] + rebuildInternetServiceChangeDetails += buildElementsUnbounded(internetServiceChangeDetails, tProvidedV4LanPublicPrefixesChangesList, "t-provided-v4-lan-public-prefixes") + } catch (Exception e) { + log("ERROR"," Optional - Exception in INTERNET-SERVICE-CHANGE-DETAILS 't-provided-v4-lan-public-prefixes ") + } + try { // optional + def tProvidedV6LanPublicPrefixesChangesList = ["request-index", "v6-next-hop-address", "v6-lan-public-prefix", "v6-lan-public-prefix-length"] + rebuildInternetServiceChangeDetails += buildElementsUnbounded(internetServiceChangeDetails, tProvidedV6LanPublicPrefixesChangesList, "t-provided-v6-lan-public-prefixes") + } catch (Exception e) { + log("ERROR"," Optional - Exception INTERNET-SERVICE-CHANGE-DETAILS 't-provided-v6-lan-public-prefixes ") + } + rebuildInternetServiceChangeDetails += "" + } catch (Exception e) { + log("ERROR", " Optional - Exception INTERNET-SERVICE-CHANGE-DETAILS 'internet-service-change-details' ") + } + } + return rebuildInternetServiceChangeDetails + } + + // Build vr-lan + def buildVrLan(xmlInput) { + + def rebuildVrLan = '' + if (xmlInput != null) { + + rebuildVrLan = "" + def vrLan = getNodeXml(xmlInput, "vr-lan").drop(38).trim() + rebuildVrLan += buildElements(vrLan, ["routing-protocol"], "") + + // vr-lan-interface + def rebuildVrLanInterface = "" + def vrLanInterface = getNodeXml(vrLan, "vr-lan-interface").drop(38).trim() + rebuildVrLanInterface += buildVrLanInterfacePartial(vrLanInterface) + + // dhcp + def dhcp = getNodeXml(vrLan, "dhcp").drop(38).trim() + def rebuildDhcp = buildDhcp(dhcp) + rebuildVrLanInterface += rebuildDhcp + + // pat + def pat = getNodeXml(vrLan, "pat").drop(38).trim() + def rebuildPat = buildPat(pat) + rebuildVrLanInterface += rebuildPat + + // nat + def rebuildNat = "" + try { // optional + def nat = getNodeXml(vrLan, "nat").drop(38).trim() + rebuildNat = buildNat(nat) + } catch (Exception e) { + log("ERROR", " Optional - Exception 'nat' ") + } + rebuildVrLanInterface += rebuildNat + + // firewall-lite + def firewallLite = getNodeXml(vrLan, "firewall-lite").drop(38).trim() + def rebuildFirewallLite = buildFirewallLite(firewallLite) + rebuildVrLanInterface += rebuildFirewallLite + + // static-routes + def rebuildStaticRoutes = "" + try { // optional + def staticRoutes = getNodeXml(vrLan, "static-routes").drop(38).trim() + rebuildStaticRoutes = buildStaticRoutes(staticRoutes) + } catch (Exception e) { + log("ERROR", " Optional - Exception 'static-routes' ") + } + rebuildVrLanInterface += rebuildStaticRoutes + + rebuildVrLan += rebuildVrLanInterface + rebuildVrLan += "" + rebuildVrLan += "" + + } + log("DEBUG", " rebuildVrLan - " + rebuildVrLan) + return rebuildVrLan + } + + // Build vr-lan-interface + def buildVrLanInterfacePartial(xmlInput) { + def rebuildingVrLanInterface = '' + if (xmlInput != null) { + def vrLanInterfaceList = ["vr-designation", "v4-vr-lan-prefix", "v4-vr-lan-address", "v4-vr-lan-prefix-length", "v6-vr-lan-prefix", "v6-vr-lan-address", "v6-vr-lan-prefix-length", "v4-vce-loopback-address", "v6-vce-wan-address"] + rebuildingVrLanInterface += buildElements(xmlInput, vrLanInterfaceList, "") + rebuildingVrLanInterface += "" + try { // optional + def tProvidedV4LanPublicPrefixes = getNodeXml(xmlInput, "v4-public-lan-prefixes").drop(38).trim() + def tProvidedV4LanPublicPrefixesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length" ] + rebuildingVrLanInterface += buildElementsUnbounded(xmlInput, tProvidedV4LanPublicPrefixesList, "t-provided-v4-lan-public-prefixes") + } catch (Exception ex) { + log("ERROR", " Optional - Exception VR-LAN INTERFACE 'v4-public-lan-prefixes' ") + } + rebuildingVrLanInterface += "" + rebuildingVrLanInterface += "" + try { // optional + def tProvidedV6LanPublicPrefixes = getNodeXml(xmlInput, "v6-public-lan-prefixes").drop(38).trim() + def tProvidedV6LanPublicPrefixesList = ["request-index", "v6-next-hop-address", "v6-lan-public-prefix", "v6-lan-public-prefix-length" ] + rebuildingVrLanInterface += buildElementsUnbounded(xmlInput, tProvidedV6LanPublicPrefixesList, "t-provided-v6-lan-public-prefixes") + } catch (Exception e) { + log("ERROR", " Optional - Exception VR-LAN INTERFACE 'v6-public-lan-prefixes' ") + } + rebuildingVrLanInterface += "" + } + log("DEBUG", " rebuildingVrLanInterface - " + rebuildingVrLanInterface) + return rebuildingVrLanInterface + } + + // Build dhcp + def buildDhcp(xmlInput) { + def rebuildingDhcp = '' + if (xmlInput != null) { + def dhcpData = new XmlSlurper().parseText(xmlInput) + rebuildingDhcp = "" + def dhcpList1 = ["v4-dhcp-server-enabled", "v6-dhcp-server-enabled", "use-v4-default-pool", "v4-dhcp-default-pool-prefix", "v4-dhcp-default-pool-prefix-length"] + rebuildingDhcp += buildElements(xmlInput, dhcpList1, "") + try { // optional + def excludedV4DhcpAddressesFromDefaultPoolList = ["excluded-v4-address"] + rebuildingDhcp += buildElementsUnbounded(xmlInput, excludedV4DhcpAddressesFromDefaultPoolList, "excluded-v4-dhcp-addresses-from-default-pool") + } catch (Exception e) { + log("ERROR", " Optional - Exception DHCP 'excluded-v4-dhcp-addresses-from-default-pool' ") + } + try { // optional + def v4DhcpPools = dhcpData.'**'.findAll {it.name() == "v4-dhcp-pools"} + def v4DhcpPoolsSize = v4DhcpPools.size() + // println " v4DhcpPoolsSize = " + v4DhcpPools.size() + for (i in 0..v4DhcpPoolsSize-1) { + def v4DhcpPool = v4DhcpPools[i] + def v4DhcpPoolXml = XmlUtil.serialize(v4DhcpPool) + rebuildingDhcp += "" + def v4DhcpPoolsList1 = ["v4-dhcp-pool-prefix", "v4-dhcp-pool-prefix-length" ] + rebuildingDhcp += buildElements(v4DhcpPoolXml, v4DhcpPoolsList1, "") + try { // optional + def excludedV4AddressesList = ["excluded-v4-address"] + rebuildingDhcp += buildElementsUnbounded(v4DhcpPoolXml, excludedV4AddressesList, "excluded-v4-addresses") + } catch (Exception e) { + log("ERROR", " Optional - Exception DHCP 'excluded-v4-addresses' ") + } + def v4DhcpPoolsList2 = ["v4-dhcp-relay-gateway-address", "v4-dhcp-relay-next-hop-address"] + rebuildingDhcp += buildElements(v4DhcpPoolXml, v4DhcpPoolsList2, "") + rebuildingDhcp += "" + } + } catch (Exception e) { + log("ERROR"," Optional - Exception DHCP 'v4-dhcp-pools' ") + } + def dhcpList2 = ["use-v6-default-pool", "v6-dhcp-default-pool-prefix", "v6-dhcp-default-pool-prefix-length"] + rebuildingDhcp += buildElements(xmlInput, dhcpList2, "") + try { // optional + def excludedV6DhcpAddressesFromDdefaultPoolList = ["excluded-v6-address"] + rebuildingDhcp += buildElementsUnbounded(xmlInput, excludedV6DhcpAddressesFromDdefaultPoolList, "excluded-v6-dhcp-addresses-from-default-pool") + } catch (Exception e) { + log("ERROR", " Optional - Exception DHCP 'excluded-v6-dhcp-addresses-from-default-pool' ") + } + try { // optional + def v6DhcpPools = dhcpData.'**'.findAll {it.name() == "v6-dhcp-pools"} + def v6DhcpPoolsSize = v6DhcpPools.size() + //println " v6DhcpPoolsSize = " + v6DhcpPools.size() + for (i in 0..v6DhcpPoolsSize-1) { + def v6DhcpPool = v6DhcpPools[i] + def v6DhcpPoolXml = XmlUtil.serialize(v6DhcpPool) + rebuildingDhcp += "" + def v6DhcpPoolsList1 = ["v6-dhcp-pool-prefix", "v6-dhcp-pool-prefix-length"] + rebuildingDhcp += buildElements(v6DhcpPoolXml, v6DhcpPoolsList1, "") + try { // optional + def excludedV6AddressesList = ["excluded-v6-address"] + rebuildingDhcp += buildElementsUnbounded(v6DhcpPoolXml, excludedV6AddressesList, "excluded-v6-addresses") + } catch (Exception e) { + log("ERROR", " Optional - Exception DHCP 'excluded-v6-addresses' ") + } + def v6DhcpPoolsList2 = ["v6-dhcp-relay-gateway-address", "v6-dhcp-relay-next-hop-address"] + rebuildingDhcp += buildElements(v6DhcpPoolXml, v6DhcpPoolsList2, "") + rebuildingDhcp += "" + } + } catch (Exception e) { + log("ERROR", " Optional - Exception DHCP 'v6-dhcp-pools' ") + } + rebuildingDhcp += "" + } + log("DEBUG", " rebuildingDhcp - " + rebuildingDhcp) + return rebuildingDhcp + } + + // Build pat + def buildPat(xmlInput) { + def rebuildingPat = '' + if (xmlInput != null) { + rebuildingPat = "" + def patList = ["v4-pat-enabled", "use-v4-default-pool", "v4-pat-default-pool-prefix", "v4-pat-default-pool-prefix-length"] + rebuildingPat += buildElements(xmlInput, patList, "") + try { // optional + def v4PatPools = getNodeXml(xmlInput, "v4-pat-pools").drop(38).trim() + def v4PatPoolsList = ["v4-pat-pool-prefix", "v4-pat-pool-prefix-length", "v4-pat-pool-next-hop-address"] + rebuildingPat += buildElementsUnbounded(xmlInput, v4PatPoolsList, "v4-pat-pools") + } catch (Exception e) { + log("ERROR", " Optional - Exception 'v4-pat-pool-next-hop-address' ") + } + rebuildingPat += "" + } + log("DEBUG", " rebuildingPat - " + rebuildingPat) + return rebuildingPat + } + + // Build nat + def buildNat(xmlInput) { + def rebuildingNat = '' + if (xmlInput != null) { + rebuildingNat = "" + rebuildingNat += buildElements(xmlInput, ["v4-nat-enabled"], "") + try { // optional + def v4NatMappingEntries = getNodeXml(xmlInput, "v4-nat-mapping-entries").drop(38).trim() + def v4NatMappingEntriesList = ["v4-nat-internal", "v4-nat-next-hop-address", "v4-nat-external"] + rebuildingNat += buildElementsUnbounded(xmlInput, v4NatMappingEntriesList, "v4-nat-mapping-entries") + } catch (Exception e) { + log("ERROR", " Optional - Exception 'v4-nat-external' ") + } + rebuildingNat += "" + } + log("DEBUG", " rebuildingNat - " + rebuildingNat) + return rebuildingNat + } + + // Build firewall-lite + def buildFirewallLite(xmlInput) { + def rebuildingFirewallLite = '' + + if (xmlInput != null) { + + def firewallLiteData = new XmlSlurper().parseText(xmlInput) + rebuildingFirewallLite = "" + def firewallLiteList = ["stateful-firewall-lite-v4-enabled", "stateful-firewall-lite-v6-enabled"] + rebuildingFirewallLite += buildElements(xmlInput, firewallLiteList, "") + + try { // optional + def v4FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v4-firewall-packet-filters"} + def v4FirewallPacketFiltersSize = v4FirewallPacketFilters.size() + //println " v4FirewallPacketFiltersSize = " + v4FirewallPacketFilters.size() + for (i in 0..v4FirewallPacketFiltersSize-1) { + def v4FirewallPacketFilter = v4FirewallPacketFilters[i] + def v4FirewallPacketFilterXml = XmlUtil.serialize(v4FirewallPacketFilter) + rebuildingFirewallLite += "" + def v4FirewallPacketFiltersList = ["v4-firewall-prefix", "v4-firewall-prefix-length", "allow-icmp-ping"] + rebuildingFirewallLite += buildElements(v4FirewallPacketFilterXml, v4FirewallPacketFiltersList, "") + try { // optional + def udpPortsList = ["port-number"] + rebuildingFirewallLite += buildElementsUnbounded(v4FirewallPacketFilterXml, udpPortsList, "udp-ports") + } catch (Exception e) { + log("ERROR", " Optional - Exception FIREWALL-LITE v4 'udp-ports' ") + } + try { // optional + def tcpPortsList = ["port-number"] + rebuildingFirewallLite += buildElementsUnbounded(v4FirewallPacketFilterXml, tcpPortsList, "tcp-ports") + } catch (Exception e) { + log("ERROR", " Optional - Exception FIREWALL-LITE v4 'tcp-ports' ") + } + rebuildingFirewallLite += "" + } + } catch (Exception e) { + log("ERROR", " Optional - Exception FIREWALL-LITE 'v4-firewall-packet-filters' ") + } + + try { // optional + def v6FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v6-firewall-packet-filters"} + def v6FirewallPacketFiltersSize = v6FirewallPacketFilters.size() + //println " v6FirewallPacketFiltersSize = " + v6FirewallPacketFilters.size() + for (i in 0..v6FirewallPacketFiltersSize-1) { + def v6FirewallPacketFilter = v6FirewallPacketFilters[i] + def v6FirewallPacketFilterXml = XmlUtil.serialize(v6FirewallPacketFilter) + rebuildingFirewallLite += "" + def v6FirewallPacketFiltersList = ["v6-firewall-prefix", "v6-firewall-prefix-length", "allow-icmp-ping"] + rebuildingFirewallLite += buildElements(v6FirewallPacketFilterXml, v6FirewallPacketFiltersList, "") + try { // optional + def udpPortsList = ["port-number"] + rebuildingFirewallLite += buildElementsUnbounded(v6FirewallPacketFilterXml, udpPortsList, "udp-ports") + } catch (Exception e) { + log("ERROR", " Optional - Exception FIREWALL-LITE v6 'udp-ports' ") + } + try { // optional + def tcpPortsList = ["port-number"] + rebuildingFirewallLite += buildElementsUnbounded(v6FirewallPacketFilterXml, tcpPortsList, "tcp-ports") + } catch (Exception e) { + log("ERROR", " Optional - Exception FIREWALL-LITE v6 'tcp-ports' ") + } + rebuildingFirewallLite += "" + } + } catch (Exception e) { + log("ERROR", " Optional - Exception FIREWALL-LITE 'v6-firewall-packet-filters' ") + } + rebuildingFirewallLite+= "" + } + log("DEBUG", " rebuildingFirewallLite - " + rebuildingFirewallLite) + return rebuildingFirewallLite + } + + def buildStaticRoutes(xmlInput) { + def rebuildingStaticRoutes = '' + if (xmlInput != null) { + rebuildingStaticRoutes = "" + def v4StaticRouteslist = ["v4-static-route-prefix","v4-static-route-prefix-length", "v4-next-hop-address"] + rebuildingStaticRoutes += buildElementsUnbounded(xmlInput, v4StaticRouteslist, "v4-static-routes") + def v6StaticRouteslist = ["v6-static-route-prefix","v6-static-route-prefix-length", "v6-next-hop-address"] + rebuildingStaticRoutes += buildElementsUnbounded(xmlInput, v6StaticRouteslist, "v6-static-routes") + rebuildingStaticRoutes += "" + } + log("DEBUG", " rebuildingStaticRoutes - " + rebuildingStaticRoutes) + return rebuildingStaticRoutes + } + + public String generateCurrentTimeInUtc(){ + final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); + sdf.setTimeZone(TimeZone.getTimeZone("UTC")); + final String utcTime = sdf.format(new Date()); + return utcTime; + } + + public String generateCurrentTimeInGMT(){ + final SimpleDateFormat sdf = new SimpleDateFormat("E, d MMM yyyy h:m:s z"); + sdf.setTimeZone(TimeZone.getTimeZone("GMT")); + final String utcTime = sdf.format(new Date()); + return utcTime; + } + + + /** + * @param encryptedAuth: encrypted credentials from urn properties + * @param msoKey: key to use to decrypt from urn properties + * @return base 64 encoded basic auth credentials + */ + def getBasicAuth(encryptedAuth, msoKey){ + if ((encryptedAuth == null || encryptedAuth.isEmpty()) || (msoKey == null || msoKey.isEmpty())) + return null + try { + def auth = decrypt(encryptedAuth, msoKey) + byte[] encoded = Base64.encodeBase64(auth.getBytes()) + String encodedString = new String(encoded) + encodedString = "Basic " + encodedString + return encodedString + } catch (Exception ex) { + log("ERROR", "Unable to encode basic auth") + throw ex + } + } + + def encrypt(toEncrypt, msokey){ + try { + String result = CryptoUtils.encrypt(toEncrypt, msokey); + return result + } + catch (Exception e) { + log("ERROR", "Failed to encrypt credentials") + } + } + + def decrypt(toDecrypt, msokey){ + try { + String result = CryptoUtils.decrypt(toDecrypt, msokey); + return result + } + catch (Exception e) { + log("ERROR", "Failed to decrypt credentials") + throw e + } + } + + /** + * Return URL with qualified host name (if any) or urn mapping + * @param String url from urn mapping + * @return String url with qualified host name + */ + public String getQualifiedHostNameForCallback(String urnCallbackUrl) { + def callbackUrlToUse = urnCallbackUrl + try{ + //swap host name with qualified host name from the jboss properties + def qualifiedHostName = System.getProperty("jboss.qualified.host.name") + if(qualifiedHostName!=null){ + log("DEBUG", "qualifiedHostName:\n" + qualifiedHostName) + callbackUrlToUse = callbackUrlToUse.replaceAll("(http://)(.*)(:28080*)", {orig, first, torepl, last -> "${first}${qualifiedHostName}${last}"}) + } + }catch(Exception e){ + log("DEBUG", "unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: " + e.printStackTrace()) + } + return callbackUrlToUse + + } + + /** + * Retrieves text context of the element if the element exists, returns empty string otherwise + * @param com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl element to parse + * param String tagName tagName + * @return String text content of the element + */ + public String getElementText(Element element, String tagName) { + String text = "" + org.w3c.dom.NodeList nodeList = element.getElementsByTagNameNS("*", tagName) + if (nodeList != null && nodeList.length > 0) { + text = nodeList.item(0).getTextContent() + } + return text + } + + /** + * + * Find the lowest unused module-index value in a given xml + */ + public String getLowestUnusedIndex(String xml) { + if (xml == null || xml.isEmpty()) { + return "0" + } + def moduleIndexList = getMultNodes(xml, "module-index") + if (moduleIndexList == null || moduleIndexList.size() == 0) { + return "0" + } + def sortedModuleIndexList = moduleIndexList.sort { a, b -> a.compareTo b } + + for (i in 0..sortedModuleIndexList.size()-1) { + if (Integer.parseInt(sortedModuleIndexList[i]) != i) { + return i.toString() + } + } + return sortedModuleIndexList.size().toString() + } + /** + * This utility checks if there is transaction id already present in MDC. + * If found, it returns same else creates new, sets in MDC for future use before returning + * @return String RequestId in UUID format. + */ + public String getRequestID() + { + String requestId = MDC.get("RequestId") + if(requestId == null || requestId.isEmpty()) + { + requestId = java.util.UUID.randomUUID() + MDC.put("RequestId",requestId) + log("DEBUG","MsoUtils - Created new RequestId: " + requestId) + } + else + { + log("DEBUG","MsoUtils - Using existing RequestId: " + requestId) + } + + return requestId + } + + /** + * Remove all the empty nodes and attributes from the within the given node + * @param node + * @return true if all empty nodes and attributes were removed. + */ + public boolean cleanNode( Node node ) { + node.attributes().with { a -> + a.findAll { !it.value }.each { a.remove( it.key ) } + } + node.children().with { kids -> + kids.findAll { it instanceof Node ? !cleanNode( it ) : false } + .each { kids.remove( it ) } + } + node.attributes() || node.children() || node.text() + } + + /** + * + * @param xml + * @return String representation of xml after removing the empty nodes and attributes + */ + public String cleanNode(String xmlString) { + def xml = new XmlParser(false, false).parseText(xmlString) + cleanNode(xml) + return XmlUtil.serialize(xml) + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy new file mode 100644 index 0000000000..2e5499c158 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy @@ -0,0 +1,1581 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts; + +import org.apache.commons.lang3.* + +import groovy.xml.XmlUtil +import org.onap.so.bpmn.core.UrnPropertiesReader + +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory +import javax.xml.transform.Transformer +import javax.xml.transform.TransformerFactory +import javax.xml.transform.TransformerException +import javax.xml.transform.dom.DOMSource +import javax.xml.transform.stream.StreamResult + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.w3c.dom.Document +import org.w3c.dom.Element + +import org.w3c.dom.NamedNodeMap +import org.w3c.dom.Node +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource +import org.onap.so.logger.MsoLogger + +import org.onap.so.logger.MessageEnum + + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.NamedNodeMap +import org.w3c.dom.Node +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource + + +/** + * This groovy class supports the any Network processes that need the methods defined here. + */ +class NetworkUtils { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkUtils.class); + + + public MsoUtils utils = new MsoUtils() + private AbstractServiceTaskProcessor taskProcessor + + public NetworkUtils(AbstractServiceTaskProcessor taskProcessor) { + this.taskProcessor = taskProcessor + } + + /** + * This method returns the string for Network request + * V2 for Contrail 3.x will populate cloud-region data in same cloudSiteId filed + * Network adapter will handle it properly + * @param requestId either 'request-id' or 'mso-request-id' + * @param requestInput the request in the process + * @param queryIdResponse the response of REST AAI query by Id + * @param routeCollection the collection + * @param policyFqdns the policy + * @param tableCollection the collection + * @param cloudRegionId the cloud-region-region + * @return String request + */ + def CreateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyFqdns, tableCollection, cloudRegionId, backoutOnFailure, source) { + String createNetworkRequest = null + if(requestInput!=null && queryIdResponse!=null) { + String serviceInstanceId = "" + String sharedValue = "" + String externalValue = "" + + if (source == "VID") { + sharedValue = utils.getNodeText(queryIdResponse, "is-shared-network") != null ? utils.getNodeText(queryIdResponse, "is-shared-network") : "false" + externalValue = utils.getNodeText(queryIdResponse, "is-external-network") != null ? utils.getNodeText(queryIdResponse, "is-external-network") : "false" + serviceInstanceId = utils.getNodeText(requestInput, "service-instance-id") + + } else { // source = 'PORTAL' + sharedValue = getParameterValue(requestInput, "shared") + externalValue = getParameterValue(requestInput, "external") + serviceInstanceId = utils.getNodeText(requestInput, "service-instance-id") != null ? utils.getNodeText(requestInput, "service-instance-id") : "" + } + + String networkParams = "" + if (utils.nodeExists(requestInput, "network-params")) { + String netParams = utils.getNodeXml(requestInput, "network-params", false).replace("tag0:","").replace(":tag0","") + networkParams = buildParams(netParams) + } + + String failIfExists = "false" + // requestInput + String cloudRegion = cloudRegionId + String tenantId = utils.getNodeText(requestInput, "tenant-id") + + String networkType = "" + String modelCustomizationUuid = "" + if (utils.nodeExists(requestInput, "networkModelInfo")) { + String networkModelInfo = utils.getNodeXml(requestInput, "networkModelInfo", false).replace("tag0:","").replace(":tag0","") + networkType = utils.getNodeText(networkModelInfo, "modelName") + modelCustomizationUuid = utils.getNodeText(networkModelInfo, "modelCustomizationUuid") + } else { + networkType = utils.getNodeText(queryIdResponse, "network-type") + modelCustomizationUuid = utils.getNodeText(requestInput, "modelCustomizationId") + } + + // queryIdResponse + String networkName = utils.getNodeText(queryIdResponse, "network-name") + String networkId = utils.getNodeText(queryIdResponse, "network-id") + String networkTechnology = utils.getNodeText(queryIdResponse, "network-technology") + + // contrailNetwork - networkTechnology = 'Contrail' vs. 'AIC_SR_IOV') + String contrailNetwork = "" + if (networkTechnology.contains('Contrail') || networkTechnology.contains('contrail') || networkTechnology.contains('CONTRAIL')) { + contrailNetwork = """ + ${MsoUtils.xmlEscape(sharedValue)} + ${MsoUtils.xmlEscape(externalValue)} + ${routeCollection} + ${policyFqdns} + ${tableCollection} + """ + networkTechnology = "CONTRAIL" // replace + } + + // rebuild subnets + String subnets = "" + if (utils.nodeExists(queryIdResponse, "subnets")) { + def subnetsGroup = utils.getNodeXml(queryIdResponse, "subnets", false) + subnets = buildSubnets(subnetsGroup) + } + + String physicalNetworkName = "" + physicalNetworkName = utils.getNodeText(queryIdResponse, "physical-network-name") + + String vlansCollection = buildVlans(queryIdResponse) + + String notificationUrl = "" //TODO - is this coming from URN? What variable/value to use? + //String notificationUrl = execution.getVariable("URN_?????") //TODO - is this coming from URN? What variable/value to use? + + createNetworkRequest = """ + + ${MsoUtils.xmlEscape(cloudRegion)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(networkId)} + ${MsoUtils.xmlEscape(networkName)} + ${MsoUtils.xmlEscape(networkType)} + ${MsoUtils.xmlEscape(modelCustomizationUuid)} + ${MsoUtils.xmlEscape(networkTechnology)} + + ${MsoUtils.xmlEscape(physicalNetworkName)} + ${vlansCollection} + + ${contrailNetwork} + ${subnets} + true + ${MsoUtils.xmlEscape(backoutOnFailure)} + ${MsoUtils.xmlEscape(failIfExists)} + ${networkParams} + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + + ${MsoUtils.xmlEscape(messageId)} + ${MsoUtils.xmlEscape(notificationUrl)} + + """.trim() + } + return createNetworkRequest + + } + + /** + * This method returns the string for Network request + * V2 for Contrail 3.x will populate cloud-region data in same cloudSiteId filed + * Network adapter will handle it properly + * @param requestId either 'request-id' or 'mso-request-id' + * @param requestInput the request in the process + * @param queryIdResponse the response of REST AAI query by Id + * @param routeCollection the collection + * @param policyFqdns the policy + * @param cloudRegionId the cloud-region-region + * @return String request + */ + def UpdateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyFqdns, tableCollection, cloudRegionId, backoutOnFailure, source) { + String updateNetworkRequest = null + if(requestInput!=null && queryIdResponse!=null) { + String serviceInstanceId = "" + String sharedValue = "" + String externalValue = "" + + if (source == "VID") { + sharedValue = utils.getNodeText(queryIdResponse, "is-shared-network") != null ? utils.getNodeText(queryIdResponse, "is-shared-network") : "false" + externalValue = utils.getNodeText(queryIdResponse, "is-external-network") != null ? utils.getNodeText(queryIdResponse, "is-external-network") : "false" + serviceInstanceId = utils.getNodeText(requestInput, "service-instance-id") + + } else { // source = 'PORTAL' + sharedValue = getParameterValue(requestInput, "shared") + externalValue = getParameterValue(requestInput, "external") + serviceInstanceId = utils.getNodeText(requestInput, "service-instance-id") != null ? utils.getNodeText(requestInput, "service-instance-id") : "" + } + + String failIfExists = "false" + // requestInput + String cloudRegion = cloudRegionId + String tenantId = utils.getNodeText(requestInput, "tenant-id") + + // queryIdResponse + String networkName = utils.getNodeText(queryIdResponse, "network-name") + String networkId = utils.getNodeText(queryIdResponse, "network-id") + + String networkType = "" + String modelCustomizationUuid = "" + if (utils.nodeExists(requestInput, "networkModelInfo")) { + String networkModelInfo = utils.getNodeXml(requestInput, "networkModelInfo", false).replace("tag0:","").replace(":tag0","") + networkType = utils.getNodeText(networkModelInfo, "modelName") + modelCustomizationUuid = utils.getNodeText(networkModelInfo, "modelCustomizationUuid") + } else { + networkType = utils.getNodeText(queryIdResponse, "network-type") + modelCustomizationUuid = utils.getNodeText(requestInput, "modelCustomizationId") + } + + // rebuild subnets + String subnets = "" + if (utils.nodeExists(queryIdResponse, "subnets")) { + def subnetsGroup = utils.getNodeXml(queryIdResponse, "subnets", false) + subnets = buildSubnets(subnetsGroup) + } + + String networkParams = "" + if (utils.nodeExists(requestInput, "network-params")) { + String netParams = utils.getNodeXml(requestInput, "network-params", false).replace("tag0:","").replace(":tag0","") + networkParams = buildParams(netParams) + } + + String networkStackId = utils.getNodeText(queryIdResponse, "heat-stack-id") + if (networkStackId == 'null' || networkStackId == "" || networkStackId == null) { + networkStackId = "force_update" + } + + String physicalNetworkName = utils.getNodeText(queryIdResponse, "physical-network-name") + String vlansCollection = buildVlans(queryIdResponse) + + updateNetworkRequest = + """ + ${MsoUtils.xmlEscape(cloudRegion)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(networkId)} + ${MsoUtils.xmlEscape(networkStackId)} + ${MsoUtils.xmlEscape(networkName)} + ${MsoUtils.xmlEscape(networkType)} + ${MsoUtils.xmlEscape(modelCustomizationUuid)} + + CONTRAIL + + ${MsoUtils.xmlEscape(physicalNetworkName)} + ${vlansCollection} + + + ${MsoUtils.xmlEscape(sharedValue)} + ${MsoUtils.xmlEscape(externalValue)} + ${routeCollection} + ${policyFqdns} + ${tableCollection} + + ${subnets} + true + ${MsoUtils.xmlEscape(backoutOnFailure)} + ${MsoUtils.xmlEscape(failIfExists)} + ${networkParams} + + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + + ${MsoUtils.xmlEscape(messageId)} + + """.trim() + + } + return updateNetworkRequest + + } + + /** + * This method returns the string for Create Volume Request payload + * @param groupId the volume-group-id + * @param volumeName the volume-group-name + * @param vnfType the vnf-type + * @param tenantId the value of relationship-key 'tenant.tenant-id' + * @return String request payload + */ + def String CreateNetworkVolumeRequest(groupId, volumeName, vnfType, tenantId) { + + String requestPayload = + """ + ${MsoUtils.xmlEscape(groupId)} + ${MsoUtils.xmlEscape(volumeName)} + + ${MsoUtils.xmlEscape(vnfType)} + Pending + + + tenant + + tenant.tenant-id + ${MsoUtils.xmlEscape(tenantId)} + + + + """ + + return requestPayload + } + + def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, tenantId, cloudRegion, namespace, modelCustomizationId) { + + String requestPayload = + """ + ${MsoUtils.xmlEscape(groupId)} + ${MsoUtils.xmlEscape(volumeName)} + + ${MsoUtils.xmlEscape(vnfType)} + Pending + ${MsoUtils.xmlEscape(modelCustomizationId)} + + + tenant + + tenant.tenant-id + ${MsoUtils.xmlEscape(tenantId)} + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + ${MsoUtils.xmlEscape(cloudRegion)} + + + + """ + + return requestPayload + } + + def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, vnfId, tenantId, cloudRegion, namespace, modelCustomizationId) { + + String requestPayload = + """ + ${MsoUtils.xmlEscape(groupId)} + ${MsoUtils.xmlEscape(volumeName)} + + ${MsoUtils.xmlEscape(vnfType)} + Pending + ${MsoUtils.xmlEscape(modelCustomizationId)} + + + generic-vnf + + generic-vnf.vnf-id + ${MsoUtils.xmlEscape(vnfId)} + + + + tenant + + tenant.tenant-id + ${MsoUtils.xmlEscape(tenantId)} + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + ${MsoUtils.xmlEscape(cloudRegion)} + + + + """ + + return requestPayload + } + + + /** + * This method returns the string for Update Volume Request payload + * @param requeryAAIVolGrpNameResponse the response of query volume group name (in AAI) + * @param heatStackId the value of heat stack id + * @return String request payload + */ + def String updateCloudRegionVolumeRequest(requeryAAIVolGrpNameResponse, heatStackId, namespace, modelCustomizationId) { + String requestPayload = "" + if (requeryAAIVolGrpNameResponse != null) { + def groupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id") + def volumeName = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-name") + def vnfType = utils.getNodeText(requeryAAIVolGrpNameResponse, "vnf-type") + def resourceVersion = utils.getNodeText(requeryAAIVolGrpNameResponse, "resource-version") + def relationshipList = "" + if (utils.nodeExists(requeryAAIVolGrpNameResponse, "relationship")) { + relationshipList = rebuildRelationship(requeryAAIVolGrpNameResponse) + } + + requestPayload = + """ + ${MsoUtils.xmlEscape(groupId)} + ${MsoUtils.xmlEscape(volumeName)} + ${MsoUtils.xmlEscape(heatStackId)} + ${MsoUtils.xmlEscape(vnfType)} + Active + ${MsoUtils.xmlEscape(resourceVersion)} + ${MsoUtils.xmlEscape(modelCustomizationId)} + ${relationshipList} + """ + } + + return requestPayload + } + + + /** + * This method returns the string for Update Volume Request payload + * @param requeryAAIVolGrpNameResponse the response of query volume group name (in AAI) + * @param heatStackId the value of heat stack id + * @return String request payload + */ + def String UpdateNetworkVolumeRequest(requeryAAIVolGrpNameResponse, heatStackId) { + String requestPayload = "" + if (requeryAAIVolGrpNameResponse != null) { + def groupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id") + def volumeName = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-name") + def vnfType = utils.getNodeText(requeryAAIVolGrpNameResponse, "vnf-type") + def resourceVersion = utils.getNodeText(requeryAAIVolGrpNameResponse, "resource-version") + def relationshipList = "" + if (utils.nodeExists(requeryAAIVolGrpNameResponse, "relationship")) { + relationshipList = rebuildRelationship(requeryAAIVolGrpNameResponse) + } + + requestPayload = + """ + ${MsoUtils.xmlEscape(groupId)} + ${MsoUtils.xmlEscape(volumeName)} + ${MsoUtils.xmlEscape(heatStackId)} + ${MsoUtils.xmlEscape(vnfType)} + Active + ${MsoUtils.xmlEscape(resourceVersion)} + ${relationshipList} + """ + } + + return requestPayload + } + + /** + * This method returns the string for Create Contrail Network payload + * @param requeryIdAAIResponse the response from AAI query by id + * @param createNetworkResponse the response of create network + * @return String contrailNetworkCreatedUpdate + */ + def ContrailNetworkCreatedUpdate(requeryIdAAIResponse, createNetworkResponse, schemaVersion) { + + String contrailNetworkCreatedUpdate = "" + if(requeryIdAAIResponse!=null && createNetworkResponse!=null) { + + def l3Network = utils.getNodeXml(requeryIdAAIResponse, "l3-network", false).replace("tag0:","").replace(":tag0","") + def createNetworkContrailResponse = "" + if (utils.nodeExists(createNetworkResponse, 'createNetworkResponse')) { + createNetworkContrailResponse = utils.getNodeXml(createNetworkResponse, "createNetworkResponse", false).replace("tag0:","").replace(":tag0","") + } else { + createNetworkContrailResponse = utils.getNodeXml(createNetworkResponse, "updateNetworkContrailResponse", false).replace("tag0:","").replace(":tag0","") + } + + // rebuild network + def networkList = ["network-id", "network-name", "network-type", "network-role", "network-technology", "neutron-network-id", "is-bound-to-vpn", "service-id", "network-role-instance", "resource-version", "resource-model-uuid", "orchestration-status", "heat-stack-id", "mso-catalog-key", "contrail-network-fqdn", + "physical-network-name", "is-provider-network", "is-shared-network", "is-external-network"] + String rebuildNetworkElements = buildNetworkElements(l3Network, createNetworkContrailResponse, networkList) + + // rebuild 'subnets' + def rebuildSubnetList = "" + if (utils.nodeExists(requeryIdAAIResponse, 'subnet')) { + rebuildSubnetList = buildSubnets(requeryIdAAIResponse, createNetworkResponse) + } + + // rebuild 'segmentation-assignments' + def rebuildSegmentationAssignments = "" + if (utils.nodeExists(requeryIdAAIResponse, 'segmentation-assignments')) { + List elementList = ["segmentation-id", "resource-version"] + if (utils.nodeExists(requeryIdAAIResponse, 'segmentation-assignment')) { // new tag + rebuildSegmentationAssignments = buildXMLElements(requeryIdAAIResponse, "segmentation-assignments", "segmentation-assignment", elementList) + } else { + rebuildSegmentationAssignments = buildXMLElements(requeryIdAAIResponse, "", "segmentation-assignments", elementList) + } + } + + // rebuild 'ctag-assignments' / rebuildCtagAssignments + def rebuildCtagAssignmentsList = "" + if (utils.nodeExists(requeryIdAAIResponse, 'ctag-assignment')) { + rebuildCtagAssignmentsList = rebuildCtagAssignments(requeryIdAAIResponse) + } + + // rebuild 'relationship' + def relationshipList = "" + if (utils.nodeExists(requeryIdAAIResponse, 'relationship-list')) { + String rootRelationshipData = getFirstNodeXml(requeryIdAAIResponse, "relationship-list").drop(38).trim().replace("tag0:","").replace(":tag0","") + if (utils.nodeExists(rootRelationshipData, 'relationship')) { + relationshipList = rebuildRelationship(rootRelationshipData) + } + } + + //Check for optional contrail network fqdn within CreateNetworkResponse + String contrailNetworkFQDN + if(utils.nodeExists(createNetworkResponse, "contrail-network-fqdn")){ + contrailNetworkFQDN = utils.getNodeXml(createNetworkResponse, "contrail-network-fqdn") + contrailNetworkFQDN = utils.removeXmlNamespaces(contrailNetworkFQDN) + contrailNetworkFQDN = utils.removeXmlPreamble(contrailNetworkFQDN) + }else{ + contrailNetworkFQDN = "" + } + + contrailNetworkCreatedUpdate = + """ + ${rebuildNetworkElements} + ${rebuildSubnetList} + ${rebuildSegmentationAssignments} + ${rebuildCtagAssignmentsList} + ${relationshipList} + ${contrailNetworkFQDN} + """.trim() + + } + return contrailNetworkCreatedUpdate + } + + + + /** + * This method returns the value for the name paramName. + * Ex: + * 1 + * 0 + * + * + * @param xmlInput the XML document + * @param paramName the param name (ex: 'shared') + * @return a param value for 'shared' (ex: '1') + */ + def getParameterValue(xmlInput, paramName) { + def rtn="" + if(xmlInput!=null){ + def xml= new XmlSlurper().parseText(xmlInput) + rtn= xml.'**'.find {param->param.'@name'.text() == paramName} + } + if (rtn==null) { + return "" + } else { + return rtn + } + } + + /** + * This method returns the name of param if found/match with paramName. + * Ex: + * 1 + * 0 + * + * + * @param xmlInput the XML document + * @param paramName the param name (ex: 'shared', ) + * @return a param name for 'shared' (ex: 'shared' if found) + */ + def getParameterName(xmlInput, paramName) { + def rtn="" + if(xmlInput!=null){ + def xml= new XmlSlurper().parseText(xmlInput) + try { + rtn= xml.'**'.find {param->param.'@name' == paramName}.'@name' + } catch (Exception ex) { + rtn="" + } + } + if (rtn==null || rtn=="") { + return "" + } else { + return rtn + } + } + + /** + * This method returns the networkParams xml string. + * Ex: input: + * + * 1 + * 0 + * + * + * Sample result: + * + * 1 + * 0 + * + * + */ + + def buildParams(networkParams) { + def build = "" + def netParams = new XmlParser().parseText(networkParams) + try { + def paramsList = netParams.'**'.findAll {param->param.'@name'}.'@name' + if (paramsList.size() > 0) { + build += "" + for (i in 0..paramsList.size()-1) { + def name = netParams.'**'.find {param->param.'@name' == paramsList[i]}.'@name' + def value= netParams.'**'.find {param->param.'@name' == paramsList[i]}.text() + build += "<${name}>${MsoUtils.xmlEscape(value)}" + } + build += "" + } + + } catch (Exception ex) { + println ' buildParams error - ' + ex.getMessage() + build = "" + } + return build + } + + def getVlans(xmlInput) { + def rtn = "" + if (xmlInput!=null) { + def vlansList = getListWithElements(xmlInput, 'vlans') + def vlansListSize = vlansList.size() + if (vlansListSize > 0) { + for (i in 0..vlansListSize-1) { + rtn += ''+vlansList[i]+'' + } + } + } + return rtn + + + } + + /** + * This method returns the uri value for the vpn bindings. + * Return the a list of value of vpn binding in the string. + * Ex. + * + * + * vpn-binding + * https://aai-app-e2e.test.openecomp.com:8443/aai/v6/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + * + * vpn-binding.vpn-id + * 85f015d0-2e32-4c30-96d2-87a1a27f8017 + * + * + * + * vpn-binding + * https://aai-ext1.test.openecomp.com:8443/aai/v6/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ + * + * vpn-binding.vpn-id + * 24a4b507-853a-4a38-99aa-05fcc54be24d + * + * + * vpn-binding.vpn-name + * oam_protected_net_6_MTN5_msotest1 + * + * + * @param xmlInput the XML document + * @return a list of vpn binding values + * ex: ['aai/v6/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', 'aai/v6/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/'] + * + **/ + def getVnfBindingObject(xmlInput) { + //def rtn = null + List rtn = [] + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "vpn-binding") { + def relatedLink = utils.getNodeText(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length())) + } + } + } + } + } + return rtn + } + /** + * similar to VNF bindings method + * @param xmlInput the XML document + * @return a list of network policy values + * ex: ['aai/v$/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg', 'aai/v$/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg'] + * + **/ + def getNetworkPolicyObject(xmlInput) { + //def rtn = null + List rtn = [] + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "network-policy") { + def relatedLink = utils.getNodeText(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length())) + } + } + } + } + } + return rtn + } + + /** + * similar to network policymethod + * @param xmlInput the XML document + * @return a list of network policy values + * ex: ['aai/v$/network/route-table-references/route-table-reference/refFQDN1', 'aai/v$/network/route-table-references/route-table-reference/refFQDN2'] + * + **/ + def getNetworkTableRefObject(xmlInput) { + //def rtn = null + List rtn = [] + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "route-table-reference") { + def relatedLink = utils.getNodeText(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length())) + } + } + } + } + } + return rtn + } + + /** + * similar to network policymethod + * @param xmlInput the XML document + * @return a list of IDs for related VNF instances + * + **/ + def getRelatedVnfIdList(xmlInput) { + //def rtn = null + List rtn = [] + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "generic-vnf") { + def relatedLink = utils.getNodeText(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + if (relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length()).contains('/')) { + rtn.add(relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length()-1)) + } else { + rtn.add(relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length())) + } + } + } + } + } + } + return rtn + } + + /** + * similar to network policymethod + * @param xmlInput the XML document + * @return a list of IDs for related Network instances + * + **/ + def getRelatedNetworkIdList(xmlInput) { + //def rtn = null + List rtn = [] + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "l3-network") { + def relatedLink = utils.getNodeText(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + if (relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length()).contains('/')) { + rtn.add(relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length()-1)) + } else { + rtn.add(relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length())) + } + } + } + } + } + } + return rtn + } + + def isVfRelationshipExist(xmlInput) { + Boolean rtn = false + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "vf-module") { + rtn = true + } + } + } + } + return rtn + + } + + def getCloudRegion(xmlInput) { + String lcpCloudRegion = "" + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "cloud-region") { + def relatedLink = utils.getNodeText(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + lcpCloudRegion = relatedLink.substring(relatedLink.indexOf("/att-aic/")+9, relatedLink.length()) + if (lcpCloudRegion.contains('/')) { + lcpCloudRegion = relatedLink.substring(relatedLink.indexOf("/att-aic/")+9, relatedLink.length()-1) + } + } + } + } + } + } + return lcpCloudRegion + } + + def getTenantId(xmlInput) { + String tenantId = "" + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "tenant") { + def relatedLink = utils.getNodeText(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + tenantId = relatedLink.substring(relatedLink.indexOf("/tenant/")+8, relatedLink.length()) + if (tenantId.contains('/')) { + tenantId = relatedLink.substring(relatedLink.indexOf("/tenant/")+8, relatedLink.length()-1) + } + } + } + } + } + } + return tenantId + } + + def isInstanceValueMatch(linkResource, globalSubscriberId, serviceType) { + Boolean rtn = false + try { + String globalSubscriberIdLink = linkResource.substring(linkResource.indexOf("/customer/")+10, linkResource.indexOf("/service-subscriptions")) + String serviceTypeLink = linkResource.substring(linkResource.indexOf("/service-subscription/")+22, linkResource.indexOf("/service-instances")) + if (globalSubscriberIdLink == globalSubscriberId) { + rtn = true + } else { + if (serviceTypeLink == serviceType) { + rtn = true + } + } + + } catch (Exception ex) { + println 'Exception - ' + ex.getMessage() + return false + } + return rtn + } + + def getListWithElements(xmlInput, groupName) { + def rtn = "" + if (xmlInput != null) { + def relationshipData = new XmlSlurper().parseText(xmlInput) + rtn = relationshipData.'**'.findAll {it.name() == groupName} + } + return rtn + + } + + // build network single elements + def buildNetworkElements(l3Network, createNetworkContrailResponse, networkList) { + def replaceNetworkId = "" + def replaceNeutronNetworkId = "" + def replaceContrailNetworkFqdn = "" + if (l3Network != null && createNetworkContrailResponse != null) { + if (utils.nodeExists(l3Network, 'heat-stack-id')) { + replaceNetworkId = utils.getNodeText(l3Network, 'heat-stack-id') + } else { + if (utils.nodeExists(createNetworkContrailResponse, 'networkStackId')) { + replaceNetworkId = utils.getNodeText(createNetworkContrailResponse, 'networkStackId') + } + } + if (utils.nodeExists(l3Network, 'neutron-network-id')) { + replaceNeutronNetworkId = utils.getNodeText(l3Network, 'neutron-network-id') + } else { + if (utils.nodeExists(createNetworkContrailResponse, 'neutronNetworkId')) { + replaceNeutronNetworkId = utils.getNodeText(createNetworkContrailResponse, 'neutronNetworkId') + } + } + if (utils.nodeExists(l3Network, 'contrail-network-fqdn')) { + replaceContrailNetworkFqdn = utils.getNodeText(l3Network, 'contrail-network-fqdn') + } else { + if (utils.nodeExists(createNetworkContrailResponse, 'networkFqdn')) { + replaceContrailNetworkFqdn = utils.getNodeText(createNetworkContrailResponse, 'networkFqdn') + } + } + } + + String var = "" + def xmlNetwork = "" + if (l3Network != null) { + for (element in networkList) { + def xml= new XmlSlurper().parseText(l3Network) + var = xml.'**'.find {it.name() == element} + if (var == null) { + if (element=="orchestration-status") { + if (var.toString() == 'pending-create' || var.toString() == 'PendingCreate') { + xmlNetwork += "<"+element+">"+"Created"+"" + } else { //pending-update or PendingUpdate + xmlNetwork += "<"+element+">"+"Active"+"" + } + } + if (element=="heat-stack-id") { + if (replaceNetworkId != "") { + xmlNetwork += "<"+element+">"+replaceNetworkId+"" + } + } + if (element=="neutron-network-id") { + if (replaceNeutronNetworkId != "") { + xmlNetwork += "<"+element+">"+replaceNeutronNetworkId+"" + } + } + if (element=="contrail-network-fqdn") { + if (replaceContrailNetworkFqdn != "") { + xmlNetwork += "<"+element+">"+replaceContrailNetworkFqdn+"" + } + } + + } else { + if (element=="orchestration-status") { + if (element=="orchestration-status") { + if (var.toString() == 'pending-create' || var.toString() == 'PendingCreate') { + xmlNetwork += "<"+element+">"+"Created"+"" + } else { //pending-update or PendingUpdate + xmlNetwork += "<"+element+">"+"Active"+"" + } + } + } else { + xmlNetwork += "<"+element+">"+var.toString()+"" + } + } + } + } + return xmlNetwork + } + + def buildSubnets(requeryIdAAIResponse, createNetworkResponse) { + def rebuildingSubnets = "" + if (requeryIdAAIResponse != null && utils.nodeExists(requeryIdAAIResponse, 'subnets')) { + def subnetIdMapValue = "" + def subnetsGroup = utils.getNodeXml(requeryIdAAIResponse, "subnets", false) + def subnetsData = new XmlSlurper().parseText(subnetsGroup) + rebuildingSubnets += "" + try { + def subnets = subnetsData.'**'.findAll {it.name() == "subnet"} + def subnetsSize = subnets.size() + for (i in 0..subnetsSize-1) { + def subnet = subnets[i] + def subnetXml = XmlUtil.serialize(subnet) + def orchestrationStatus = utils.getNodeText(subnetXml, "orchestration-status") + if (orchestrationStatus == "PendingDelete" || orchestrationStatus == "pending-delete") { + // skip, do not include in processing, remove!!! + } else { + def subnetList = ["subnet-id", "neutron-subnet-id", "gateway-address", "network-start-address", "cidr-mask", "ip-version", "orchestration-status", "dhcp-enabled", "dhcp-start", "dhcp-end", "subnet-role", "resource-version", "subnet-name", "ip-assignment-direction", "host-routes"] + rebuildingSubnets += buildSubNetworkElements(subnetXml, createNetworkResponse, subnetList, "subnet") + } + } + if (utils.nodeExists(subnetsData, 'relationship')) { + rebuildingSubnets = rebuildRelationship(requeryIdAAIResponse) + } + + } catch (Exception ex) { + // error + } finally { + rebuildingSubnets += "" + } + } + return rebuildingSubnets + } + + def buildSubnets(queryIdResponse) { + def rebuildingSubnets = "" + def subnetsData = new XmlSlurper().parseText(queryIdResponse) + //rebuildingSubnets += "" + try { + def subnets = subnetsData.'**'.findAll {it.name() == "subnet"} + def subnetsSize = subnets.size() + for (i in 0..subnetsSize-1) { + def subnet = subnets[i] + def subnetXml = XmlUtil.serialize(subnet) + def orchestrationStatus = utils.getNodeText(subnetXml, "orchestration-status") + if (orchestrationStatus == "pending-delete" || orchestrationStatus == "PendingDelete") { + // skip, do not include in processing, remove!!! + } else { + def subnetList = ["dhcp-start", "dhcp-end", "network-start-address", "cidr-mask", "dhcp-enabled", "gateway-address", "ip-version", "subnet-id", "subnet-name", "ip-assignment-direction", "host-routes"] + rebuildingSubnets += buildSubNetworkElements(subnetXml, subnetList, "subnets") + //rebuildingSubnets += buildSubNetworkElements(subnetXml, subnetList, "") + } + } + } catch (Exception ex) { + // + } finally { + //rebuildingSubnets += "" + } + return rebuildingSubnets + } + + + // build subnet sub-network single elements + def buildSubNetworkElements(subnetXml, createNetworkResponse, elementList, parentName) { + String var = "" + def xmlBuild = "" + if (parentName != "") { + xmlBuild += "<"+parentName+">" + } + if (subnetXml != null) { + for (element in elementList) { + def xml= new XmlSlurper().parseText(subnetXml) + var = xml.'**'.find {it.name() == element} + if (var != null) { + if (element=="orchestration-status") { + if(var.toString() == 'pending-create' || var.toString() == 'PendingCreate') { + xmlBuild += "<"+element+">"+"Created"+"" + } else { // pending-update or PendingUpdate' + xmlBuild += "<"+element+">"+"Active"+"" + } + } else { // "subnet-id", "neutron-subnet-id" + if (element=="subnet-id") { + if (utils.nodeExists(createNetworkResponse, "subnetMap")) { + xmlBuild += "<"+element+">"+var.toString()+"" + String neutronSubnetId = extractNeutSubId(createNetworkResponse, var.toString()) + xmlBuild += ""+neutronSubnetId+"" + } + } else { + if (element=="neutron-subnet-id") { + // skip + } else { + if (element=="host-routes") { + if (subnetXml.contains("host-routes")) { + List elementRoute = ["host-route-id", "route-prefix", "next-hop", "next-hop-type", "resource-version"] + xmlBuild += buildXMLElements(subnetXml, "host-routes", "host-route", elementRoute) + } + } else { + xmlBuild += "<"+element+">"+var.toString()+"" + } + } + } + } + } + } + + } + if (parentName != "") { + xmlBuild += "" + } + return xmlBuild + } + + // build subnet sub-network single elements + def buildSubNetworkElements(subnetXml, elementList, parentName) { + def var = "" + def xmlBuild = "" + if (parentName != "") { + xmlBuild += "<"+parentName+">" + } + if (subnetXml != null) { + def networkStartAddress = "" + for (element in elementList) { + def xml= new XmlSlurper().parseText(subnetXml) + var = xml.'**'.find {it.name() == element} + if (element == "dhcp-start") { + xmlBuild += "" + if (var.toString() == 'null') { + xmlBuild += ""+""+"" + } else { + xmlBuild += ""+var.toString()+"" + } + } + if (element == "dhcp-end") { + if (var.toString() == 'null') { + xmlBuild += ""+""+"" + } else { + xmlBuild += ""+var.toString()+"" + } + xmlBuild += "" + } + if (element == "network-start-address" || element == "cidr-mask") { + if (element == "network-start-address") { + networkStartAddress = var.toString() + } + if (element == "cidr-mask") { + xmlBuild += ""+networkStartAddress+"/"+var.toString()+"" + } + } + if (element == "dhcp-enabled") { + xmlBuild += ""+var.toString()+"" + } + if (element == "gateway-address") { + xmlBuild += ""+var.toString()+"" + } + if (element == "ip-version") { + String ipVersion = getIpvVersion(var.toString()) + xmlBuild += ""+ipVersion+"" + } + if (element == "subnet-id") { + xmlBuild += ""+var.toString()+"" + } + if ((element == "subnet-name") && (var != null)) { + xmlBuild += ""+var.toString()+"" + } + if ((element == "ip-assignment-direction") && (var != null)) { + xmlBuild += ""+var.toString()+"" + } + if (element == "host-routes") { + def routes = "" + if (subnetXml.contains("host-routes")) { + routes = buildHostRoutes(subnetXml) + } + xmlBuild += routes + } + + } + } + if (parentName != "") { + xmlBuild += "" + } + return xmlBuild + } + + // rebuild host-routes + def buildHostRoutes(subnetXml) { + List routeElementList = ["host-route-id", "route-prefix", "next-hop", "next-hop-type", "resource-version"] + def hostRoutes = buildXMLElements(subnetXml, "host-routes", "host-route", routeElementList) + def buildHostRoutes = "" + def var = "" + if (hostRoutes!=null) { + def routesData = new XmlSlurper().parseText(hostRoutes) + def routes = routesData.'**'.findAll {it.name() == "host-route"} + def routesSize = routes.size() + for (i in 0..routesSize-1) { + buildHostRoutes += "" + def route = routes[i] + def routeXml = XmlUtil.serialize(route) + List elementList = ["route-prefix", "next-hop"] + for (element in elementList) { + def xml= new XmlSlurper().parseText(routeXml) + var = xml.'**'.find {it.name() == element} + if (element == "route-prefix") { + buildHostRoutes += ""+var.toString()+"" + } + if (element == "next-hop") { + buildHostRoutes += ""+var.toString()+"" + } + } + buildHostRoutes += "" + } + } + return buildHostRoutes + + } + + // rebuild ctag-assignments + def rebuildCtagAssignments(xmlInput) { + def rebuildingCtagAssignments = "" + if (xmlInput!=null) { + def ctagAssignmentsData = new XmlSlurper().parseText(xmlInput) + rebuildingCtagAssignments += "" + def ctagAssignments = ctagAssignmentsData.'**'.findAll {it.name() == "ctag-assignment"} + def ctagAssignmentsSize = ctagAssignments.size() + for (i in 0..ctagAssignmentsSize-1) { + def ctagAssignment = ctagAssignments[i] + def ctagAssignmentXml = XmlUtil.serialize(ctagAssignment) + rebuildingCtagAssignments += "" + List elementList = ["vlan-id-inner", "resource-version"] + rebuildingCtagAssignments += buildXMLElements(ctagAssignmentXml, "" , "", elementList) + if (utils.nodeExists(ctagAssignmentXml, 'relationship')) { + rebuildingCtagAssignments += rebuildRelationship(ctagAssignmentXml) + } + rebuildingCtagAssignments += "" + } + rebuildingCtagAssignments += "" + } + return rebuildingCtagAssignments + } + + // rebuild 'relationship-list' + def rebuildRelationship(xmlInput) { + def rebuildingSubnets = "" + if (xmlInput!=null) { + def subnetsData = new XmlSlurper().parseText(xmlInput) + rebuildingSubnets += "" + def relationships = subnetsData.'**'.findAll {it.name() == "relationship"} + def relationshipsSize = relationships.size() + for (i in 0..relationshipsSize-1) { + def relationship = relationships[i] + def relationshipXml = XmlUtil.serialize(relationship) + rebuildingSubnets += "" + def relationshipList = ["related-to", "related-link"] + rebuildingSubnets += buildSubNetworkElements(relationshipXml, "", relationshipList, "") + if (utils.nodeExists(relationshipXml, 'relationship-data')) { + def relationshipDataXmlData = new XmlSlurper().parseText(relationshipXml) + def relationshipsData = relationshipDataXmlData.'**'.findAll {it.name() == "relationship-data"} + def relationshipsDataSize = relationshipsData.size() + for (j in 0..relationshipsDataSize-1) { + def relationshipData = relationshipsData[j] + def relationshipDataXml = XmlUtil.serialize(relationshipData) + def relationshipDataList = ["relationship-key", "relationship-value"] + rebuildingSubnets += buildXMLElements(relationshipDataXml, "", "relationship-data", relationshipDataList) + } + } + if (utils.nodeExists(relationshipXml, 'related-to-property')) { + def relationshipDataXmlData = new XmlSlurper().parseText(relationshipXml) + def relationshipsData = relationshipDataXmlData.'**'.findAll {it.name() == "related-to-property"} + def relationshipsDataSize = relationshipsData.size() + for (j in 0..relationshipsDataSize-1) { + def relationshipData = relationshipsData[j] + def relationshipDataXml = XmlUtil.serialize(relationshipData) + def relationshipDataList = ["property-key", "property-value"] + rebuildingSubnets += buildXMLElements(relationshipDataXml, "", "related-to-property", relationshipDataList) + } + } + + rebuildingSubnets += "" + } + rebuildingSubnets += "" + } + return rebuildingSubnets + } + + def buildVlans(queryIdResponse) { + def rebuildingSubnets = "" + def subnetsData = new XmlSlurper().parseText(queryIdResponse) + + try { + def subnets = subnetsData.'**'.findAll {it.name() == "segmentation-assignments"} + def subnetsSize = subnets.size() + for (i in 0..subnetsSize-1) { + def subnet = subnets[i] + def subnetXml = XmlUtil.serialize(subnet) + + String vlan = utils.getNodeText(subnetXml, "segmentation-id") + if (i>0){ + rebuildingSubnets += "," + } + rebuildingSubnets += vlan + } + } catch (Exception ex) { + // + } finally { + //rebuildingSubnets += "" + rebuildingSubnets += "" + } + return rebuildingSubnets + } + + /* Utility code to rebuild xml/elements in a list: + * rebuild xml with 1) unbounded groups of elements; or + * 2) one group of elements; or + * 3) just one or more elements (in a list as argument) + * @param xmlInput the XML document + * @param parentName the parent name (ex: 'inputs') + * @param childrenName the chilrendName (ex: 'entry' as unbounded/occurs>1) + * @param elementList the element list of children (ex: 'key', 'value') + * @return a string of rebuild xml + * + * Ex 1: xmlInput: + * + * + * name + * Edward + * + * + * age + * 30 + * + * + * age + * 30 + * + * + * Usage: + * List elementList = ["key", "value"] + * String rebuild = buildXMLElements(xmlInput, "inputs", "entry", elementList) + * + * Ex 2: xmlInput // no parent tag + * + * fec8ec88-151a-45c9-ad60-8233e0fc8ff2 + * https://localhost:8443/adapters/rest/SDNCNotify + * assign + * + * Usage: + * List elementList = ["svc-request-id", "svc-notification-url", "svc-action"] + * String rebuild = buildXMLElements(xmlInput, "" , "sdnc-request-header", elementList) // no parent tag + * + * Ex 3: xmlInput // elements one after another (with no parent & children tag) + * myTestid + * myUser + * Usage: + * List elementList = ["test-id", "test-user"] + * String rebuild = buildXMLElements(xmlInput, "" , "", elementList) + * + */ + def buildXMLElements(xmlInput, parentName, childrenName, elementList) { + def varChildren = "" + def var = "" + def xmlBuildUnbounded = "" + if (parentName!="") {xmlBuildUnbounded += "<"+parentName+">" +'\n'} + if (xmlInput != null) { + def xml= new XmlSlurper().parseText(xmlInput) + if (childrenName!="") { + varChildren = xml.'**'.findAll {it.name() == childrenName} + for (i in 0..varChildren.size()-1) { + xmlBuildUnbounded += "<"+childrenName+">" +'\n' + for (element in elementList) { + var = varChildren[i].'*'.find {it.name() == element} + if (var != null) { + xmlBuildUnbounded += "<"+element+">"+var.toString()+"" +'\n' + } + } + xmlBuildUnbounded += "" +'\n' + } + } else { + for (element in elementList) { + var = xml.'*'.find {it.name() == element} + if (var != null) { + xmlBuildUnbounded += "<"+element+">"+var.toString()+"" +'\n' + } + } + } + + } + if (parentName!="") {xmlBuildUnbounded += "" +'\n'} + return xmlBuildUnbounded + } + + def getFirstNodeXml(xmlInput, element){ + def nodeAsText = "" + def nodeToSerialize = "" + if (xmlInput != null) { + def fxml= new XmlSlurper().parseText(xmlInput) + if (utils.nodeExists(xmlInput, "payload")) { + nodeToSerialize = fxml.'payload'.'l3-network'.'*'.find {it.name() == element} + if (nodeToSerialize!=null) { + nodeAsText = XmlUtil.serialize(nodeToSerialize) + } else { + nodeAsText = "" + } + + } else { + nodeToSerialize = fxml.'*'.find {it.name() == element} + if (nodeToSerialize!=null) { + nodeAsText = XmlUtil.serialize(nodeToSerialize) + } else { + nodeAsText = "" + } + + } + } + return nodeAsText + + } + +//TODO: This method still needs to be tested before using. + /** + * + * This method is similar to the gennetwork:ContrailNetworUpdateCompletedObject + * BPEL method. It extracts all of the required subnet information + * for each subnet listed with an orch status equal to the one provided + * and puts the corresponding infomation with the appropriate node for + * updating aai. The method sets the orch status for each subnet to active + * + * @param subnetsXml the entire subnets xml + * @param requestInput the request in the process + * @param queryIdResponse the response of REST AAI query by Id + * @param queryVpnBindingResponse the response of REST AAI query by vpn binding + * @param routeCollection the collection of vpnBinding's 'global-route-target' + * @return String request + */ + public String networkUpdateSubnetInfo(String subnetsXml, String networkResponseXml){ + + String subnets = "" + StringBuilder sb = new StringBuilder() + InputSource source = new InputSource(new StringReader(subnetsXml)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document xml = docBuilder.parse(source) + NodeList nodeList = xml.getElementsByTagNameNS("*", "subnet") + for (int x = 0; x < nodeList.getLength(); x++) { + Node node = nodeList.item(x) + String subnet = "" + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String subnetOrchStatus = eElement.getElementsByTagNameNS("*", "orchestration-status").item(0).getTextContent() + if(subnetOrchStatus.equals("pending-create")){ + + String subnetId = eElement.getElementsByTagNameNS("*", "subnet-id").item(0).getTextContent() + def netAddress = eElement.getElementsByTagNameNS("*", "network-start-address").item(0).getTextContent() + def mask = eElement.getElementsByTagNameNS("*", "cidr-mask").item(0).getTextContent() + def dhcpEnabledSubnet = eElement.getElementsByTagNameNS("*", "dhcp-enabled").item(0).getTextContent() + def gatewayAddress = eElement.getElementsByTagNameNS("*", "gateway-address").item(0).getTextContent() + def ipVersion = eElement.getElementsByTagNameNS("*", "ip-version").item(0).getTextContent() + def relationshipList = eElement.getElementsByTagNameNS("*", "relationship-list").item(0).getTextContent() //TODO: test this + String neutronSubnetId = extractNeutSubId(networkResponseXml, subnetId) + subnet = + """ + ${MsoUtils.xmlEscape(subnetId)} + ${MsoUtils.xmlEscape(neutronSubnetId)} + ${MsoUtils.xmlEscape(gatewayAddress)} + ${MsoUtils.xmlEscape(netAddress)} + ${MsoUtils.xmlEscape(mask)} + ${MsoUtils.xmlEscape(ipVersion)} + active + ${MsoUtils.xmlEscape(dhcpEnabledSubnet)} + ${relationshipList} + """ + + }else if(subnetOrchStatus.equals("pending-delete")){ + StringWriter writer = new StringWriter() + Transformer transformer = TransformerFactory.newInstance().newTransformer() + transformer.transform(new DOMSource(node), new StreamResult(writer)) + subnet = writer.toString() + + }else{ + subnet = "" + } + } + subnets = sb.append(subnet) + } + + subnets = utils.removeXmlPreamble(subnets) + + String subnetsList = + """ + ${subnets} + """ + + return subnetsList + } + + + /** + * + * This method extracts the "value" node text for the the given subnet Id. + * + * @param String inputSource - xml that contains the subnet id key and value + * @param String subnetId - for which you want the value of + + * @return String value - node text of node named value associated with the given subnet id + */ + public String extractNeutSubId(String inputSource, String subnetId){ + + String value = "" + InputSource source = new InputSource(new StringReader(inputSource)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document xml = docBuilder.parse(source) + NodeList nodeList = xml.getElementsByTagNameNS("*", "entry") + for (int x = 0; x < nodeList.getLength(); x++) { + Node node = nodeList.item(x) + String subnet = "" + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String key = eElement.getElementsByTagNameNS("*", "key").item(0).getTextContent() + if(key.equals(subnetId)){ + value = eElement.getElementsByTagNameNS("*", "value").item(0).getTextContent() + } + } + } + return value + } + + public boolean isRollbackEnabled (DelegateExecution execution, String payloadXml) { + + def rollbackEnabled = false + def rollbackValueSet = false + if (utils.nodeExists(payloadXml, "backout-on-failure")) { + String backoutValue = utils.getNodeText(payloadXml, "backout-on-failure") + if (backoutValue != null && !backoutValue.isEmpty()) { + if (backoutValue.equalsIgnoreCase("false")) { + rollbackEnabled = false + } + else { + rollbackEnabled = true + } + rollbackValueSet = true; + } + } + + if (!rollbackValueSet) { + + if (UrnPropertiesReader.getVariable("mso.rollback", execution) != null) { + rollbackEnabled = UrnPropertiesReader.getVariable("mso.rollback", execution).toBoolean() + } + } + return rollbackEnabled + } + + + /** + * This method extracts the version for the the given ip-version. + * + * @param String ipvVersion - IP protocols version (ex: ipv4 or ipv6 or 4 or 6) + * @return String version - digit version (ex: 4 or 6) + */ + + public String getIpvVersion (String ipvVersion) { + + String version = "" + try { + if (ipvVersion.isNumber()) { + version = ipvVersion + } else { + version = ipvVersion.substring(ipvVersion.indexOf("ipv")+3) + if (!version.isNumber()) { + version = ipvVersion + } + } + } catch (Exception ex) { + version = ipvVersion + } + return version + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy new file mode 100644 index 0000000000..c7fcc5c5d3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -0,0 +1,348 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.common.scripts +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution + +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.domain.CloudFlavor +import org.onap.so.bpmn.core.domain.InventoryType +import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.domain.ResourceType +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.Subscriber +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.JsonUtils +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.bpmn.common.scripts.AbstractServiceTaskProcessor + +import org.json.JSONArray +import org.json.JSONObject + +import static org.onap.so.bpmn.common.scripts.GenericUtils.* + +/** + * This class contains the scripts used + * by the OOF Homing Subflow building block. The + * subflow attempts to home the provided + * resources by calling OOF. + */ +class OofHoming extends AbstractServiceTaskProcessor { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OofHoming.class); + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + OofUtils oofUtils = new OofUtils(this) + + /** + * This method validates the incoming variables. + * The method then prepares the OOF request + * and posts it to OOF's rest api. + * + * @param execution + */ + public void callOof(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", "HOME_") + utils.log("DEBUG", "*** Started Homing Call OOF ***", isDebugEnabled) + try { + execution.setVariable("rollbackData", null) + execution.setVariable("rolledBack", false) + + String requestId = execution.getVariable("msoRequestId") + utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled) + String serviceInstanceId = execution.getVariable("serviceInstanceId") + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + String serviceInstanceName = execution.getVariable("serviceInstanceName") + utils.log("DEBUG", "Incoming Service Instance Name is: " + serviceInstanceName, isDebugEnabled) + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + utils.log("DEBUG", "Incoming Service Decomposition is: " + serviceDecomposition, isDebugEnabled) + String subscriberInfo = execution.getVariable("subscriberInfo") + utils.log("DEBUG", "Incoming Subscriber Information is: " + subscriberInfo, isDebugEnabled) + Map customerLocation = execution.getVariable("customerLocation") + utils.log("DEBUG", "Incoming Customer Location is: " + customerLocation.toString(), isDebugEnabled) + String cloudOwner = execution.getVariable("cloudOwner") + utils.log("DEBUG", "Incoming cloudOwner is: " + cloudOwner, isDebugEnabled) + String cloudRegionId = execution.getVariable("cloudRegionId") + utils.log("DEBUG", "Incoming cloudRegionId is: " + cloudRegionId, isDebugEnabled) + + if (isBlank(requestId) || + isBlank(serviceInstanceId) || + isBlank(serviceInstanceName) || + isBlank(serviceDecomposition.toString()) || + isBlank(customerLocation.toString())) { + exceptionUtil.buildAndThrowWorkflowException(execution, 4000, + "A required input variable is missing or null") + } else { + Subscriber subscriber = null + if (isBlank(subscriberInfo)) { + subscriber = new Subscriber("", "", "") + } else { + String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId") + String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName") + String subCommonSiteId = "" + if (jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")) { + subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId") + } + subscriber = new Subscriber(subId, subName, subCommonSiteId) + } + + //Authentication + def authHeader = "" + String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution) + String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution) + + + + + String basicAuthValue = utils.encrypt(basicAuth, msokey) + if (basicAuthValue != null) { + utils.log("DEBUG", "Obtained BasicAuth username and password for OOF Adapter: " + basicAuthValue, + isDebugEnabled) + try { + authHeader = utils.getBasicAuth(basicAuthValue, msokey) + execution.setVariable("BasicAuthHeaderValue", authHeader) + } catch (Exception ex) { + utils.log("DEBUG", "Unable to encode username and password string: " + ex, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " + + "encode username and password string") + } + } else { + utils.log("DEBUG", "Unable to obtain BasicAuth - BasicAuth value null", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " + + "value null") + } + + //Prepare Callback + String timeout = execution.getVariable("timeout") + if (isBlank(timeout)) { + timeout = UrnPropertiesReader.getVariable("mso.oof.timeout", execution); + if (isBlank(timeout)) { + timeout = "PT30M" + } + } + utils.log("DEBUG", "Async Callback Timeout will be: " + timeout, isDebugEnabled) + + execution.setVariable("timeout", timeout) + execution.setVariable("correlator", requestId) + execution.setVariable("messageType", "oofResponse") + + //Build Request & Call OOF + String oofRequest = oofUtils.buildRequest(execution, requestId, serviceDecomposition, + subscriber, customerLocation) + execution.setVariable("oofRequest", oofRequest) + utils.log("DEBUG", "OOF Request is: " + oofRequest, isDebugEnabled) + + String endpoint = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.endpoint", execution); + String host = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.host", execution); + String url = host + endpoint + utils.log("DEBUG", "Posting to OOF Url: " + url, isDebugEnabled) + + logDebug("URL to be used is: " + url, isDebugEnabled) + + RESTConfig config = new RESTConfig(url) + RESTClient client = new RESTClient(config).addAuthorizationHeader(authHeader). + addHeader("Content-Type", "application/json") + APIResponse response = client.httpPost(oofRequest) + + int responseCode = response.getStatusCode() + logDebug("OOF sync response code is: " + responseCode, isDebugEnabled) + String syncResponse = response.getResponseBodyAsString() + execution.setVariable("syncResponse", syncResponse) + logDebug("OOF sync response is: " + syncResponse, isDebugEnabled) + + if(responseCode != 202){ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.") + } + + utils.log("DEBUG", "*** Completed Homing Call OOF ***", isDebugEnabled) + } + } catch (BpmnError b) { + throw b + } catch (Exception e) { + msoLogger.error(e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "Internal Error - Occured in Homing callOof: " + e.getMessage()) + } + } + + /** + * This method processes the callback response + * and the contained homing solution. It sets + * homing solution assignment and license + * information to the corresponding resources + * + * @param execution + */ + public void processHomingSolution(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", "*** Started Homing Process Homing Solution ***", isDebugEnabled) + try { + String response = execution.getVariable("asyncCallbackResponse") + utils.log("DEBUG", "OOF Async Callback Response is: " + response, isDebugEnabled) + utils.logAudit("OOF Async Callback Response is: " + response) + + oofUtils.validateCallbackResponse(execution, response) + String placements = jsonUtil.getJsonValue(response, "solutions.placementSolutions") + utils.log("DEBUG", "****** Solution Placements: " + placements + " *****", isDebugEnabled) + + ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition") + utils.log("DEBUG", "Service Decomposition: " + decomposition, isDebugEnabled) + + List resourceList = decomposition.getServiceResources() + JSONArray arr = new JSONArray(placements) + for (int i = 0; i < arr.length(); i++) { + JSONArray arrSol = arr.getJSONArray(i) + for (int j = 0; j < arrSol.length(); j++) { + JSONObject placement = arrSol.getJSONObject(j) + utils.log("DEBUG", "****** Placement Solution is: " + placement + " *****", "true") + String jsonServiceResourceId = placement.getString("serviceResourceId") + String jsonResourceModuleName = placement.getString("resourceModuleName") + for (Resource resource : resourceList) { + String serviceResourceId = resource.getResourceId() + String resourceModuleName = "" + if (resource.getResourceType() == ResourceType.ALLOTTED_RESOURCE || + resource.getResourceType() == ResourceType.VNF) { + resourceModuleName = resource.getNfFunction() + } + if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId) || + resourceModuleName.equalsIgnoreCase(jsonResourceModuleName)) { + JSONObject solution = placement.getJSONObject("solution") + String solutionType = solution.getString("identifierType") + String inventoryType = "" + if (solutionType.equalsIgnoreCase("serviceInstanceId")) { + inventoryType = "service" + } else { + inventoryType = "cloud" + } + resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType)) + + // TODO Deal with Placement Solutions & Assignment Info here + JSONArray assignmentArr = placement.getJSONArray("assignmentInfo") + Integer arrayIndex = 0 + Integer flavorsIndex = null + Boolean foundFlavors = false + String flavors = null + Map flavorsMap = null + ArrayList flavorsArrayList = new ArrayList() + assignmentArr.each { element -> + JSONObject jsonObject = new JSONObject(element.toString()) + if (jsonUtil.getJsonRawValue(jsonObject.toString(), "key") == "flavors") { + flavors = jsonUtil.getJsonRawValue(jsonObject.toString(), "value") + foundFlavors = true + flavorsIndex = arrayIndex + } else { + arrayIndex += 1 + } + } + if (foundFlavors) { + assignmentArr.remove(flavorsIndex) + flavorsMap = jsonUtil.jsonStringToMap(execution, flavors.toString()) + flavorsMap.each { label, flavor -> + CloudFlavor cloudFlavor = new CloudFlavor(label, flavor) + flavorsArrayList.add(cloudFlavor) + } + } + Map assignmentMap = jsonUtil.entryArrayToMap(execution, + assignmentArr.toString(), "key", "value") + String cloudOwner = assignmentMap.get("cloudOwner") + String cloudRegionId = assignmentMap.get("locationId") + resource.getHomingSolution().setCloudOwner(cloudOwner) + resource.getHomingSolution().setCloudRegionId(cloudRegionId) + if (flavorsArrayList != null && flavorsArrayList.size != 0) { + resource.getHomingSolution().setFlavors(flavorsArrayList) + execution.setVariable(cloudRegionId + "_flavorList", flavorsArrayList) + utils.log("DEBUG", "***** _flavorList is: " + flavorsArrayList.toString() + + " *****", "true") + } + + if (inventoryType.equalsIgnoreCase("service")) { + resource.getHomingSolution().setRehome(assignmentMap.get("isRehome").toBoolean()) + VnfResource vnf = new VnfResource() + vnf.setVnfHostname(assignmentMap.get("vnfHostName")) + resource.getHomingSolution().setVnf(vnf) + resource.getHomingSolution().setServiceInstanceId(solution.getJSONArray("identifiers")[0].toString()) + } + } + } + } + if (JsonUtils.jsonElementExist(response, "solutions.licenseSolutions")) { + String licenseSolutions = jsonUtil.getJsonValue(response, "solutions.licenseSolutions") + JSONArray licenseArr = new JSONArray(licenseSolutions) + for (int l = 0; l < licenseArr.length(); l++) { + JSONObject license = licenseArr.getJSONObject(l) + String jsonServiceResourceId = license.getString("serviceResourceId") + for (Resource resource : resourceList) { + String serviceResourceId = resource.getResourceId() + if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) { + String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolUUID") + List entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList) + resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList) + + String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupUUID") + List licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList) + resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList) + } + } + } + } + } + execution.setVariable("serviceDecomposition", decomposition) + execution.setVariable("homingSolution", placements) //TODO - can be removed as output variable + + utils.log("DEBUG", "*** Completed Homing Process Homing Solution ***", isDebugEnabled) + } catch (BpmnError b) { + throw b + } catch (Exception e) { + msoLogger.error(e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in Homing ProcessHomingSolution") + } + } + + /** + * This method logs the start of DHVCreateService + * to make debugging easier. + * + * @param - execution + */ + public String logStart(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String requestId = execution.getVariable("testReqId") + if (isBlank(requestId)) { + requestId = execution.getVariable("msoRequestId") + } + execution.setVariable("DHVCS_requestId", requestId) + utils.log("DEBUG", "***** STARTED Homing Subflow for request: " + requestId + " *****", "true") + utils.log("DEBUG", "****** Homing Subflow Global Debug Enabled: " + isDebugEnabled + " *****", "true") + utils.logAudit("***** STARTED Homing Subflow for request: " + requestId + " *****") + } + + /** + * Auto-generated method stub + */ + public void preProcessRequest(DelegateExecution execution) {} + // Not Implemented Method +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy new file mode 100644 index 0000000000..7c5ffca4ab --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -0,0 +1,484 @@ +/*- + * ============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.bpmn.common.scripts + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.domain.HomingSolution +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.domain.AllottedResource +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInstance +import org.onap.so.bpmn.core.domain.Subscriber +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger + +import java.lang.reflect.Array + +import static org.onap.so.bpmn.common.scripts.GenericUtils.* + +class OofUtils { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OofUtils.class); + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + private AbstractServiceTaskProcessor utils + + public MsoUtils msoUtils = new MsoUtils() + + public OofUtils(AbstractServiceTaskProcessor taskProcessor) { + this.utils = taskProcessor + } + + /** + * This method builds the service-agnostic + * OOF json request to get a homing solution + * and license solution + * + * @param execution + * @param requestId + * @param decomposition - ServiceDecomposition object + * @param customerLocation - + * @param existingCandidates - + * @param excludedCandidates - + * @param requiredCandidates - + * + * @return request - OOF v1 payload - https://wiki.onap.org/pages/viewpage.action?pageId=25435066 + */ + String buildRequest(DelegateExecution execution, + String requestId, + ServiceDecomposition decomposition, + Subscriber subscriber = null, + Map customerLocation, + ArrayList existingCandidates = null, + ArrayList excludedCandidates = null, + ArrayList requiredCandidates = null) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", "Started Building OOF Request", isDebugEnabled) + def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(execution, "oofResponse", requestId) + def transactionId = requestId + //ServiceInstance Info + ServiceInstance serviceInstance = decomposition.getServiceInstance() + def serviceInstanceId = "" + def serviceInstanceName = "" + + serviceInstanceId = execution.getVariable("serviceInstanceId") + serviceInstanceName = execution.getVariable("serviceInstanceName") + + if (serviceInstanceId == null || serviceInstanceId == "null") { + utils.log("DEBUG", "Unable to obtain Service Instance Id", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " + + "obtain Service Instance Id, execution.getVariable(\"serviceInstanceName\") is null") + } + if (serviceInstanceName == null || serviceInstanceName == "null") { + utils.log("DEBUG", "Unable to obtain Service Instance Name", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " + + "obtain Service Instance Name, execution.getVariable(\"serviceInstanceName\") is null") + } + //Model Info + ModelInfo model = decomposition.getModelInfo() + String modelType = model.getModelType() + String modelInvariantId = model.getModelInvariantUuid() + String modelVersionId = model.getModelUuid() + String modelName = model.getModelName() + String modelVersion = model.getModelVersion() + //Subscriber Info + String subscriberId = "" + String subscriberName = "" + String commonSiteId = "" + if (subscriber != null){ + subscriberId = subscriber.getGlobalId() + subscriberName = subscriber.getName() + commonSiteId = subscriber.getCommonSiteId() + } + + //Determine RequestType + //TODO Figure out better way to determine this + String requestType = "create" + List resources = decomposition.getServiceResources() + for(Resource r:resources){ + HomingSolution currentSolution = (HomingSolution) r.getCurrentHomingSolution() + if(currentSolution != null){ + requestType = "speed changed" + } + } + + //Demands + String placementDemands = "" + StringBuilder sb = new StringBuilder() + List allottedResourceList = decomposition.getAllottedResources() + List vnfResourceList = decomposition.getVnfResources() + + if (allottedResourceList == null || allottedResourceList.isEmpty() ) { + utils.log("DEBUG", "Allotted Resources List is empty - will try to get service VNFs instead.", + isDebugEnabled) + allottedResourceList = decomposition.getVnfResources() + } + + if (allottedResourceList == null || allottedResourceList.isEmpty()) { + utils.log("DEBUG", "Resources List is Empty", isDebugEnabled) + } else { + for (AllottedResource resource : allottedResourceList) { + utils.log("DEBUG", "Allotted Resource: " + resource.toString(), + isDebugEnabled) + def serviceResourceId = resource.getResourceId() + def resourceModuleName = resource.getNfFunction() + utils.log("DEBUG", "resourceModuleName: " + resourceModuleName, + isDebugEnabled) + def resourceModelInvariantId = "no-resourceModelInvariantId" + def resourceModelVersionId = "no-resourceModelVersionId" + + List modelIdLst = execution.getVariable("homingModelIds") + utils.log("DEBUG", "Incoming modelIdLst is: " + modelIdLst.toString(), isDebugEnabled) + for (Map modelId : modelIdLst ) + if (resourceModuleName == modelId.resourceModuleName) { + resourceModelInvariantId = modelId.resourceModelInvariantId + resourceModelVersionId = modelId.resourceModelVersionId + } + + def resourceModelName = "" //Optional + def resourceModelVersion = "" //Optional + def resourceModelType = "" //Optional + def tenantId = "" //Optional + def requiredCandidatesJson = "" + + requiredCandidatesJson = createCandidateJson( + existingCandidates, + excludedCandidates, + requiredCandidates) + + String demand = + " {\n" + + " \"resourceModuleName\": \"${resourceModuleName}\",\n" + + " \"serviceResourceId\": \"${serviceResourceId}\",\n" + + " \"tenantId\": \"${tenantId}\",\n" + + " \"resourceModelInfo\": {\n" + + " \"modelInvariantId\": \"${resourceModelInvariantId}\",\n" + + " \"modelVersionId\": \"${resourceModelVersionId}\",\n" + + " \"modelName\": \"${resourceModelName}\",\n" + + " \"modelType\": \"${resourceModelType}\",\n" + + " \"modelVersion\": \"${resourceModelVersion}\",\n" + + " \"modelCustomizationName\": \"\"\n" + + " }" + requiredCandidatesJson + "\n" + + " }," + + placementDemands = sb.append(demand) + } + for (VnfResource vnfResource : vnfResourceList) { + utils.log("DEBUG", "VNF Resource: " + vnfResource.toString(), + isDebugEnabled) + ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo() + def serviceResourceId = vnfResource.getResourceId() + def resourceModuleName = vnfResource.getNfFunction() + utils.log("DEBUG", "resourceModuleName: " + resourceModuleName, + isDebugEnabled) + def resourceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid() + def resourceModelName = vnfResourceModelInfo.getModelName() + def resourceModelVersion = vnfResourceModelInfo.getModelVersion() + def resourceModelVersionId = vnfResourceModelInfo.getModelUuid() + def resourceModelType = vnfResourceModelInfo.getModelType() + def tenantId = "" //Optional + def requiredCandidatesJson = "" + + + String placementDemand = + " {\n" + + " \"resourceModuleName\": \"${resourceModuleName}\",\n" + + " \"serviceResourceId\": \"${serviceResourceId}\",\n" + + " \"tenantId\": \"${tenantId}\",\n" + + " \"resourceModelInfo\": {\n" + + " \"modelInvariantId\": \"${resourceModelInvariantId}\",\n" + + " \"modelVersionId\": \"${resourceModelVersionId}\",\n" + + " \"modelName\": \"${resourceModelName}\",\n" + + " \"modelType\": \"${resourceModelType}\",\n" + + " \"modelVersion\": \"${resourceModelVersion}\",\n" + + " \"modelCustomizationName\": \"\"\n" + + " }" + requiredCandidatesJson + "\n" + + " }," + + placementDemands = sb.append(placementDemand) + } + placementDemands = placementDemands.substring(0, placementDemands.length() - 1) + } + + /* Commenting Out Licensing as OOF doesn't support for Beijing + String licenseDemands = "" + sb = new StringBuilder() + if (vnfResourceList.isEmpty() || vnfResourceList == null) { + utils.log("DEBUG", "Vnf Resources List is Empty", isDebugEnabled) + } else { + for (VnfResource vnfResource : vnfResourceList) { + ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo() + def resourceInstanceType = vnfResource.getResourceType() + def serviceResourceId = vnfResource.getResourceId() + def resourceModuleName = vnfResource.getResourceType() + def resouceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid() + def resouceModelName = vnfResourceModelInfo.getModelName() + def resouceModelVersion = vnfResourceModelInfo.getModelVersion() + def resouceModelVersionId = vnfResourceModelInfo.getModelUuid() + def resouceModelType = vnfResourceModelInfo.getModelType() + + // TODO Add Existing Licenses to demand + //"existingLicenses": { + //"entitlementPoolUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", + // "43257b49-9602-4fe5-9337-094e52bc9435"], + //"licenseKeyGroupUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", + // "43257b49-9602-4fe5-9337-094e52bc9435"] + //} + + String licenseDemand = + "{\n" + + "\"resourceModuleName\": \"${resourceModuleName}\",\n" + + "\"serviceResourceId\": \"${serviceResourceId}\",\n" + + "\"resourceInstanceType\": \"${resourceInstanceType}\",\n" + + "\"resourceModelInfo\": {\n" + + " \"modelInvariantId\": \"${resouceModelInvariantId}\",\n" + + " \"modelVersionId\": \"${resouceModelVersionId}\",\n" + + " \"modelName\": \"${resouceModelName}\",\n" + + " \"modelType\": \"${resouceModelType}\",\n" + + " \"modelVersion\": \"${resouceModelVersion}\",\n" + + " \"modelCustomizationName\": \"\"\n" + + " }\n" + "}," + + licenseDemands = sb.append(licenseDemand) + } + licenseDemands = licenseDemands.substring(0, licenseDemands.length() - 1) + }*/ + + String request = + "{\n" + + " \"requestInfo\": {\n" + + " \"transactionId\": \"${transactionId}\",\n" + + " \"requestId\": \"${requestId}\",\n" + + " \"callbackUrl\": \"${callbackUrl}\",\n" + + " \"sourceId\": \"so\",\n" + + " \"requestType\": \"${requestType}\"," + + " \"numSolutions\": 1,\n" + + " \"optimizers\": [\"placement\"],\n" + + " \"timeout\": 600\n" + + " },\n" + + " \"placementInfo\": {\n" + + " \"requestParameters\": {\n" + + " \"customerLatitude\": \"${customerLocation.customerLatitude}\",\n" + + " \"customerLongitude\": \"${customerLocation.customerLongitude}\",\n" + + " \"customerName\": \"${customerLocation.customerName}\"\n" + + " }," + + " \"subscriberInfo\": { \n" + + " \"globalSubscriberId\": \"${subscriberId}\",\n" + + " \"subscriberName\": \"${subscriberName}\",\n" + + " \"subscriberCommonSiteId\": \"${commonSiteId}\"\n" + + " },\n" + + " \"placementDemands\": [\n" + + " ${placementDemands}\n" + + " ]\n" + + " },\n" + + " \"serviceInfo\": {\n" + + " \"serviceInstanceId\": \"${serviceInstanceId}\",\n" + + " \"serviceName\": \"${serviceInstanceName}\",\n" + + " \"modelInfo\": {\n" + + " \"modelType\": \"${modelType}\",\n" + + " \"modelInvariantId\": \"${modelInvariantId}\",\n" + + " \"modelVersionId\": \"${modelVersionId}\",\n" + + " \"modelName\": \"${modelName}\",\n" + + " \"modelVersion\": \"${modelVersion}\",\n" + + " \"modelCustomizationName\": \"\"\n" + + " }\n" + + " }\n" + + "}" + + + utils.log("DEBUG", "Completed Building OOF Request", isDebugEnabled) + return request + } + + /** + * This method validates the callback response + * from OOF. If the response contains an + * exception the method will build and throw + * a workflow exception. + * + * @param execution + * @param response - the async callback response from oof + */ + Void validateCallbackResponse(DelegateExecution execution, String response) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String placements = "" + if (isBlank(response)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "OOF Async Callback Response is Empty") + } else { + if (JsonUtils.jsonElementExist(response, "solutions.placementSolutions")) { + placements = jsonUtil.getJsonValue(response, "solutions.placementSolutions") + if (isBlank(placements) || placements.equalsIgnoreCase("[]")) { + String statusMessage = jsonUtil.getJsonValue(response, "statusMessage") + if (isBlank(statusMessage)) { + utils.log("DEBUG", "Error Occurred in Homing: OOF Async Callback Response does " + + "not contain placement solution.", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, + "OOF Async Callback Response does not contain placement solution.") + } else { + utils.log("DEBUG", "Error Occurred in Homing: " + statusMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, statusMessage) + } + } else { + return + } + } else if (response.contains("error") || response.contains("Error") ) { + String errorMessage = "" + if (response.contains("policyException")) { + String text = jsonUtil.getJsonValue(response, "requestError.policyException.text") + errorMessage = "OOF Async Callback Response contains a Request Error Policy Exception: " + text + } else if (response.contains("Unable to find any candidate for demand")) { + errorMessage = "OOF Async Callback Response contains error: Unable to find any candidate for " + + "demand *** Response: " + response.toString() + } else if (response.contains("serviceException")) { + String text = jsonUtil.getJsonValue(response, "requestError.serviceException.text") + errorMessage = "OOF Async Callback Response contains a Request Error Service Exception: " + text + } else { + errorMessage = "OOF Async Callback Response contains a Request Error. Unable to determine the Request Error Exception." + } + utils.log("DEBUG", "Error Occurred in Homing: " + errorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, errorMessage) + + } else { + utils.log("DEBUG", "Error Occurred in Homing: Received an Unknown Async Callback Response from OOF.", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Received an Unknown Async Callback Response from OOF.") + } + } + + } + + /** + * This method creates candidates json for placement Demands. + * + * @param execution + * @param existingCandidates - + * @param excludedCandidates - + * @param requiredCandidates - + * + * @return candidatesJson - a JSON string with candidates + */ + String createCandidateJson(ArrayList existingCandidates = null, + ArrayList excludedCandidates = null, + ArrayList requiredCandidates = null) { + def candidatesJson = "" + def type = "" + if (existingCandidates != null && existingCandidates != {}) { + sb = new StringBuilder() + sb.append(",\n" + + " \"existingCandidates\": [\n") + def existingCandidateJson = "" + existingCandidates.each { existingCandidate -> + type = existingCandidate.get('identifierType') + if (type == 'vimId') { + def cloudOwner = existingCandidate.get('cloudOwner') + def cloudRegionId = existingCandidate.get('identifiers') + existingCandidateJson = "{\n" + + " \"identifierType\": \"vimId\",\n" + + " \"cloudOwner\": \"${cloudOwner}\",\n" + + " \"identifiers\": [\"${cloudRegionId}\"]\n" + + " }," + sb.append(existingCandidateJson) + } + if (type == 'serviceInstanceId') { + def serviceInstanceId = existingCandidate.get('identifiers') + existingCandidateJson += "{\n" + + " \"identifierType\": \"serviceInstanceId\",\n" + + " \"identifiers\": [\"${serviceInstanceId}\"]\n" + + " }," + sb.append(existingCandidateJson) + } + } + if (existingCandidateJson != "") { + sb.setLength(sb.length() - 1) + candidatesJson = sb.append(",\n],") + } + } + if (excludedCandidates != null && excludedCandidates != {}) { + sb = new StringBuilder() + sb.append(",\n" + + " \"excludedCandidates\": [\n") + def excludedCandidateJson = "" + excludedCandidates.each { excludedCandidate -> + type = excludedCandidate.get('identifierType') + if (type == 'vimId') { + def cloudOwner = excludedCandidate.get('cloudOwner') + def cloudRegionId = excludedCandidate.get('identifiers') + excludedCandidateJson = "{\n" + + " \"identifierType\": \"vimId\",\n" + + " \"cloudOwner\": \"${cloudOwner}\",\n" + + " \"identifiers\": [\"${cloudRegionId}\"]\n" + + " }," + sb.append(excludedCandidateJson) + } + if (type == 'serviceInstanceId') { + def serviceInstanceId = excludedCandidate.get('identifiers') + excludedCandidateJson += "{\n" + + " \"identifierType\": \"serviceInstanceId\",\n" + + " \"identifiers\": [\"${serviceInstanceId}\"]\n" + + " }," + sb.append(excludedCandidateJson) + } + } + if (excludedCandidateJson != "") { + sb.setLength(sb.length() - 1) + candidatesJson = sb.append(",\n],") + } + } + if (requiredCandidates != null && requiredCandidates != {}) { + sb = new StringBuilder() + sb.append(",\n" + + " \"requiredCandidates\": [\n") + def requiredCandidatesJson = "" + requiredCandidates.each { requiredCandidate -> + type = requiredCandidate.get('identifierType') + if (type == 'vimId') { + def cloudOwner = requiredCandidate.get('cloudOwner') + def cloudRegionId = requiredCandidate.get('identifiers') + requiredCandidatesJson = "{\n" + + " \"identifierType\": \"vimId\",\n" + + " \"cloudOwner\": \"${cloudOwner}\",\n" + + " \"identifiers\": [\"${cloudRegionId}\"]\n" + + " }," + sb.append(requiredCandidatesJson) + } + if (type == 'serviceInstanceId') { + def serviceInstanceId = requiredCandidate.get('identifiers') + requiredCandidatesJson += "{\n" + + " \"identifierType\": \"serviceInstanceId\",\n" + + " \"identifiers\": [\"${serviceInstanceId}\"]\n" + + " }," + sb.append(requiredCandidatesJson) + } + } + if (requiredCandidatesJson != "") { + sb.setLength(sb.length() - 1) + candidatesJson = sb.append(",\n],") + } + } + if (candidatesJson != "") {candidatesJson = candidatesJson.substring(0, candidatesJson.length() - 1)} + return candidatesJson + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy new file mode 100644 index 0000000000..a6f8ff469d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy @@ -0,0 +1,366 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.rest.APIResponse +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.springframework.web.util.UriUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +public class PrepareUpdateAAIVfModule extends VfModuleBase { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, PrepareUpdateAAIVfModule.class); + + + ExceptionUtil exceptionUtil = new ExceptionUtil() + private MsoUtils utils = new MsoUtils() + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'PUAAIVfMod_') + execution.setVariable('PUAAIVfMod_vnfId', null) + execution.setVariable('PUAAIVfMod_vfModuleId', null) + execution.setVariable('PUAAIVfMod_vnfName', null) + execution.setVariable('PUAAIVfMod_orchestrationStatus', null) + execution.setVariable('PUAAIVfMod_vfModule', null) + execution.setVariable('PUAAIVfMod_vfModuleOK', false) + execution.setVariable('PUAAIVfMod_vfModuleValidationError', null) + execution.setVariable('PUAAIVfMod_getVnfResponseCode' ,null) + execution.setVariable('PUAAIVfMod_getVnfResponse', '') + execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', null) + execution.setVariable('PUAAIVfMod_updateVfModuleResponse', '') + execution.setVariable('PUAAIVfMod_outVfModule', null) + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def xml = execution.getVariable('PrepareUpdateAAIVfModuleRequest') + msoLogger.debug('Received request xml:\n' + xml) + msoLogger.debug("PrepareUpdateAAIVfModule Request : " + xml) + + initProcessVariables(execution) + + def vnfId = getRequiredNodeText(execution, xml,'vnf-id') + execution.setVariable('PUAAIVfMod_vnfId', vnfId) + + def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id') + execution.setVariable('PUAAIVfMod_vfModuleId', vfModuleId) + + def orchestrationStatus = getRequiredNodeText(execution, xml,'orchestration-status') + execution.setVariable('PUAAIVfMod_orchestrationStatus', orchestrationStatus) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) + } + } + + /** + * Using the received vnfId, query AAI to get the corresponding Generic VNF. + * A 200 response is expected with the Generic VNF in the response body. + * + * @param execution The flow's execution instance. + */ + public void getGenericVnf(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.getGenericVnf(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('PUAAIVfMod_vnfId') + + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" + + msoLogger.debug("PrepareUpdateAAIVfModule: AAI endPoint : " + endPoint) + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + try { + RESTConfig config = new RESTConfig(endPoint); + def responseData = '' + String aaiRequestId = utils.getRequestID() + RESTClient client = new RESTClient(config). + addHeader('X-TransactionId', aaiRequestId). + addHeader('X-FromAppId', 'MSO'). + addHeader('Content-Type', 'application/xml'). + addHeader('Accept','application/xml'); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') + APIResponse response = client.httpGet() + msoLogger.debug("PrepareUpdateAAIVfModule: - invoking httpGet to AAI") + + responseData = response.getResponseBodyAsString() + execution.setVariable('PUAAIVfMod_getVnfResponseCode', response.getStatusCode()) + execution.setVariable('PUAAIVfMod_getVnfResponse', responseData) + + msoLogger.debug("PrepareUpdateAAIVfModule: AAI Response : " + responseData) + msoLogger.debug("PrepareUpdateAAIVfModule: AAI ResponseCode : " + response.getStatusCode()) + + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + } catch (Exception ex) { + msoLogger.error(ex); + msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + execution.setVariable('PUAAIVfMod_getVnfResponseCode', 500) + execution.setVariable('PUAAIVfMod_getVnfResponse', 'AAI GET Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getGenericVnf(): ' + e.getMessage()) + } + } + + /** + * Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID + * exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module + * is the base VF Module and it's not the only VF Module for this Generic VNF, that we're not + * attempting to delete it. + * + * @param execution The flow's execution instance. + */ + public void validateVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.validateVfModule(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def genericVnf = execution.getVariable('PUAAIVfMod_getVnfResponse') + def vnfId = execution.getVariable('PUAAIVfMod_vnfId') + def vfModuleId = execution.getVariable('PUAAIVfMod_vfModuleId') + def vnfName = getNodeTextForce(genericVnf, 'vnf-name') + execution.setVariable('PUAAIVfMod_vnfName', vnfName) + def VfModule vfModule = findVfModule(genericVnf, vfModuleId) + if (vfModule == null) { + def String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\'' + execution.setVariable('PUAAIVfMod_vfModuleValidationError', msg) + execution.setVariable('PUAAIVfMod_vfModuleOK', false) + } else { + def orchestrationStatus = execution.getVariable('PUAAIVfMod_orchestrationStatus') + msoLogger.debug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.isBaseVfModule() +', isOnlyVfModule=' + vfModule.isOnlyVfModule() + ', new orchestration-status=' + orchestrationStatus) + if (vfModule.isBaseVfModule() && !vfModule.isOnlyVfModule() && orchestrationStatus.equals('pending-delete')) { + def String msg = 'Orchestration status for VF Module \'' + vfModuleId + + '\' cannot be set to \'pending-delete\' since it is the base VF Module and it\'s not the only VF Module in Generic VNF \'' + vnfId + '\'' + execution.setVariable('PUAAIVfMod_vfModuleValidationError', msg) + execution.setVariable('PUAAIVfMod_vfModuleOK', false) + } else { + execution.setVariable('PUAAIVfMod_vfModule', vfModule) + execution.setVariable('PUAAIVfMod_vfModuleOK', true) + } + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage()) + } + } + + /** + * Construct and send a PATCH request to AAI to update the VF Module. + * + * @param execution The flow's execution instance. + */ + public void updateVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.updateVfModule(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + // Construct payload + def VfModule vfModule = (VfModule) execution.getVariable('PUAAIVfMod_vfModule') + def Node newVfModuleNode = vfModule.getNode().clone() + def orchestrationStatus = execution.getVariable('PUAAIVfMod_orchestrationStatus') + def Node orchestrationStatusNode = utils.getChildNode(newVfModuleNode, 'orchestration-status') + if (orchestrationStatusNode == null) { + // Node doesn't exist, this should never happen, right? + new Node(newVfModuleNode, 'orchestration-status', orchestrationStatus) + } else { + // Node already exists, just give it a new value + orchestrationStatusNode.setValue(orchestrationStatus) + } + def VfModule newVfModule = new VfModule(newVfModuleNode, vfModule.isOnlyVfModule()) + //def payload = utils.nodeToString(newVfModuleNode) + + // Construct endpoint + def vnfId = execution.getVariable('PUAAIVfMod_vnfId') + def vfModuleId = execution.getVariable('PUAAIVfMod_vfModuleId') + + def payload = """{ + "vf-module-id": "${vfModuleId}", + "orchestration-status": "${orchestrationStatus}" + }""" + + msoLogger.debug("VfModule payload : " + payload) + + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "/vf-modules/vf-module/" + UriUtils.encode(vfModuleId, "UTF-8") + msoLogger.debug("PrepareUpdateAAIVfModule: AAI endPoint : " + endPoint) + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + try { + RESTConfig config = new RESTConfig(endPoint); + def responseData = '' + def aaiRequestId = utils.getRequestID() + RESTClient client = new RESTClient(config). + addHeader('X-TransactionId', aaiRequestId). + addHeader('X-FromAppId', 'MSO'). + addHeader('Content-Type', 'application/merge-patch+json'). + addHeader('Accept','application/json'); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + msoLogger.debug('sending PATCH to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload) + APIResponse response = client.httpPatch(payload) + msoLogger.debug("PrepareUpdateAAIVfModule: - invoking httpPatch to AAI") + + responseData = response.getResponseBodyAsString() + execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', response.getStatusCode()) + execution.setVariable('PUAAIVfMod_updateVfModuleResponse', responseData) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + msoLogger.debug("PrepareUpdateAAIVfModule: AAI Response : " + responseData) + msoLogger.debug("PrepareUpdateAAIVfModule: AAI ResponseCode : " + response.getStatusCode()) + + // Set the output for this flow. The updated VfModule is an output, the generic VNF name, and for + // backward compatibilty, the heat-stack-id is an output + execution.setVariable('PUAAIVfMod_outVfModule', newVfModule) + def vnfName = execution.getVariable('PUAAIVfMod_vnfName') + msoLogger.debug('Output PUAAIVfMod_vnfName set to ' + vnfName) + // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead + execution.setVariable('WorkflowResponse', newVfModule) + msoLogger.debug('Output PUAAIVfMod_outVfModule set for VF Module Id \'' + newVfModule.getElementText('vf-module-id') + '\'') + def heatStackId = newVfModule.getElementText('heat-stack-id') + execution.setVariable('PUAAIVfMod_heatStackId', heatStackId) + msoLogger.debug('Output PUAAIVfMod_heatStackId set to \'' + heatStackId + '\'') + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI PUT:' + ex.getMessage()) + execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 500) + execution.setVariable('PUAAIVfMod_updateVfModuleResponse', 'AAI PATCH Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage()) + } + } + + /** + * Generates a WorkflowException if the AAI query returns a response code other than 200. + * + * @param execution The flow's execution instance. + */ + public void handleVnfNotFound(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.handleVnfNotFound(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + msoLogger.error('Error occurred attempting to query AAI, Response Code ' + execution.getVariable('PUAAIVfMod_getVnfResponseCode')); + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, 5000, + execution.getVariable('PUAAIVfMod_getVnfResponse')) + execution.setVariable('WorkflowException', exception) + + msoLogger.trace('Exited ' + method) + } + + /** + * Generates a WorkflowException if the VF Module does not pass validation. + * + * @param execution The flow's execution instance. + */ + public void handleVfModuleValidationError(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.handleVfModuleValidationError(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + def String errorMsg = 'VF Module validation error: ' + execution.getVariable('PUAAIVfMod_vfModuleValidationError') + msoLogger.error(errorMsg); + msoLogger.debug("PrepareUpdateAAIVfModule: Error Message : " + errorMsg) + + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, 5000, errorMsg) + execution.setVariable('WorkflowException', exception) + + msoLogger.trace('Exited ' + method) + } + + /** + * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200. + * + * @param execution The flow's execution instance. + */ + public void handleUpdateVfModuleFailure(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + msoLogger.error('Error occurred attempting to update VF Module in AAI, Response Code ' + execution.getVariable('PUAAIVfMod_updateVfModuleResponseCode')); + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, 5000, + execution.getVariable('PUAAIVfMod_updateVfModuleResponse')) + execution.setVariable('WorkflowException', exception) + + msoLogger.trace('Exited ' + method) + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RainyDayHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RainyDayHandler.groovy new file mode 100644 index 0000000000..0d66b8f51b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RainyDayHandler.groovy @@ -0,0 +1,190 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.policy.PolicyClient +import org.onap.so.client.policy.PolicyClientImpl +import org.onap.so.client.policy.entities.DictionaryData +import org.onap.so.client.policy.entities.PolicyDecision +import org.onap.so.client.policy.entities.Treatments +import org.onap.so.logger.MsoLogger + + +/** + * This groovy class supports the RainyDayHandler.bpmn process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDebugLogEnabled + * @param - serviceType + * @param - vnfType + * @param - currentActivity + * @param - workStep + * @param - failedActivity + * @param - errorCode + * @param - errorText + * @param - vnfName + * + * Outputs: + * @param - WorkflowException + * @param - handlingCode + * + */ +public class RainyDayHandler extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, RainyDayHandler.class); + + + String Prefix="RDH_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtils = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + String msg = "" + msoLogger.trace("preProcessRequest of RainyDayHandler ") + + try { + execution.setVariable("prefix", Prefix) + // check for required input + String requestId = execution.getVariable("msoRequestId") + msoLogger.debug("msoRequestId is: " + requestId) + def serviceType = execution.getVariable("serviceType") + msoLogger.debug("serviceType is: " + serviceType) + def vnfType = execution.getVariable("vnfType") + msoLogger.debug("vnftype is: " + vnfType) + def currentActivity = execution.getVariable("currentActivity") + msoLogger.debug("currentActivity is: " + currentActivity) + def workStep = execution.getVariable("workStep") + msoLogger.debug("workStep is: " + workStep) + def failedActivity = execution.getVariable("failedActivity") + msoLogger.debug("failedActivity is: " + failedActivity) + def errorCode = execution.getVariable("errorCode") + msoLogger.debug("errorCode is: " + errorCode) + def errorText = execution.getVariable("errorText") + msoLogger.debug("errorText is: " + errorText) + String defaultPolicyDisposition = (String) UrnPropertiesReader.getVariable("policy.default.disposition",execution) + msoLogger.debug("defaultPolicyDisposition is: " + defaultPolicyDisposition) + execution.setVariable('defaultPolicyDisposition', defaultPolicyDisposition) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest of RainyDayHandler ") + } + + public void queryPolicy (DelegateExecution execution) { + String msg = "" + msoLogger.trace("queryPolicy of RainyDayHandler ") + + try { + + // check for input + String serviceType = execution.getVariable("serviceType") + String vnfType = execution.getVariable("vnfType") + + msoLogger.debug("serviceType: " + serviceType) + msoLogger.debug("vnfType: " + vnfType) + + def errorCode = execution.getVariable("errorCode") + def bbId = execution.getVariable("currentActivity") + def workStep = execution.getVariable("workStep") + + msoLogger.debug("Before querying policy") + + String decision = 'DENY' + String disposition = "Abort" + String defaultAllowedTreatments = "rollback, skip, manual, abort" + + String defaultPolicyDisposition = (String) execution.getVariable('defaultPolicyDisposition') + if (defaultPolicyDisposition != null && !defaultPolicyDisposition.isEmpty()) { + msoLogger.debug("Setting disposition to the configured default instead of querying Policy: " + defaultPolicyDisposition) + disposition = defaultPolicyDisposition + msoLogger.debug("Setting default allowed treatments: " + defaultAllowedTreatments) + execution.setVariable("validResponses", defaultAllowedTreatments) + } + else { + + PolicyDecision decisionObject = null + + try { + PolicyClient policyClient = new PolicyClientImpl() + msoLogger.debug("Created policy client") + decisionObject = policyClient.getDecision(serviceType, vnfType, bbId, workStep, errorCode) + msoLogger.debug("Obtained decision object") + DictionaryData dictClient = policyClient.getAllowedTreatments(bbId, workStep) + Treatments treatments = dictClient.getTreatments() + String validResponses = treatments.getString() + if (validResponses != null) { + validResponses = validResponses.toLowerCase() + } + msoLogger.debug("Obtained validResponses: " + validResponses) + execution.setVariable("validResponses", validResponses) + + } catch(Exception e) { + msg = "Exception in queryPolicy " + e.getMessage() + msoLogger.debug(msg) + } + + + if (decisionObject != null) { + decision = decisionObject.getDecision() + disposition = decisionObject.getDetails() + msoLogger.debug("Obtained disposition from policy engine: " + disposition) + } + else { + disposition = "Abort" + } + if (disposition == null) { + disposition = "Abort" + } + } + execution.setVariable("handlingCode", disposition) + + msoLogger.debug("Disposition: "+ disposition) + + } catch (BpmnError e) { + msoLogger.debug("BPMN exception: " + e.errorMessage) + throw e; + } catch (Exception ex){ + msg = "Exception in queryPolicy " + ex.getMessage() + msoLogger.debug(msg) + //exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit queryPolicy of RainyDayHandler ") + } + + + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy new file mode 100644 index 0000000000..717d0df1ba --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy @@ -0,0 +1,133 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts; + +import groovy.json.* + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + + +class ReceiveWorkflowMessage extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ReceiveWorkflowMessage.class); + + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + /** + * Process the incoming variables. + * + * @param execution The flow's execution instance. + */ +public void preProcessRequest (DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + def prefix="RCVWFMSG_" + execution.setVariable("prefix", prefix) + setSuccessIndicator(execution, false) + + try { + + // Confirm that timeout value has been provided in 'RCVWFMSG_timeout'. + def timeout = execution.getVariable('RCVWFMSG_timeout') + msoLogger.debug('Timeout value is \'' + timeout + '\'') + if ((timeout == null) || (timeout.isEmpty())) { + String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_timeout\'' + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + // Confirm that message type has been provided in 'RCVWFMSG_messageType' + def messageType = execution.getVariable('RCVWFMSG_messageType') + msoLogger.debug('Message type is \'' + messageType + '\'') + if ((messageType == null) || (messageType.isEmpty())) { + String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_messageType\'' + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + // Confirm that correlator value has been provided in 'RCVWFMSG_correlator' + def correlator = execution.getVariable('RCVWFMSG_correlator') + msoLogger.debug('Correlator value is \'' + correlator + '\'') + if ((correlator == null) || (correlator.isEmpty())) { + String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_correlator\'' + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + execution.setVariable(messageType + '_CORRELATOR', correlator) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e + } catch (Exception e) { + String msg = 'Caught exception in ' + method + ": " + e + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } + + /** + * Process a received message. + * + * @param execution The flow's execution instance. + */ + public void processReceivedMessage(DelegateExecution execution){ + def method = getClass().getSimpleName() + '.processReceivedMessage(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + String messageType = null; + String receivedMessage = null; + + try { + messageType = execution.getVariable('RCVWFMSG_messageType') + receivedMessage = execution.getVariable(messageType + '_MESSAGE') + msoLogger.debug(getProcessKey(execution) + ": received message:\n" + receivedMessage) + + // The received message is made available to the calling flow in WorkflowResponse + execution.setVariable("WorkflowResponse", receivedMessage) + + setSuccessIndicator(execution, true) + + msoLogger.trace('Exited ' + method) + } catch (Exception e) { + receivedMessage = receivedMessage == null || String.valueOf(receivedMessage).isEmpty() ? "NONE" : receivedMessage + String msg = "Error processing received workflow message: " + receivedMessage + msoLogger.debug(getProcessKey(execution) + ': ' + msg) + exceptionUtil.buildWorkflowException(execution, 7020, msg) + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy new file mode 100644 index 0000000000..852f8d75bd --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy @@ -0,0 +1,327 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts; +import org.onap.so.bpmn.core.UrnPropertiesReader; + +import java.text.SimpleDateFormat + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + + +// SDNC Adapter Request/Response processing + +public class SDNCAdapter extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapter.class); + + + def Prefix="SDNCA_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + // Script Task: Process SDNC Workflow Request + // Params: Workflow DelegateExecution + // Assume: Received SDNCAdapterWorkflowRequest is in variable 'sdncAdapterWorkflowRequest' + // Put created SDNCAdapterRequest in variable 'sdncAdapterRequest' + public void preProcessRequest (DelegateExecution execution) { + try{ + + msoLogger.trace("Begin PreProcess SDNCAdapterRequestScript ") + msoLogger.debug("Incoming sdncAdapterWorkflowRequest:\n" + execution.getVariable("sdncAdapterWorkflowRequest")) + + // Initialize some variables used throughout the flow + execution.setVariable("prefix", Prefix) + execution.setVariable("sdncAdapterResponse", "") + execution.setVariable("asynchronousResponseTimeout", false) + execution.setVariable("continueListening", false) + execution.setVariable("SDNCA_SuccessIndicator", false) + execution.setVariable("SDNCA_InterimNotify", false) + + // Authorization Info + String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) + + try { + def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable("BasicAuthHeaderValue",encodedString) + } catch (IOException ex) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Unable to encode username password string", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + } + + // TODO Use variables instead of passing xml request - Huh? + + // Get original RequestHeader + def sdncwfreq= execution.getVariable("sdncAdapterWorkflowRequest") + def requestHeader = utils.getNodeXml(sdncwfreq, "RequestHeader") + requestHeader = requestHeader.replace("\n", "") + + // Set Callback URL to use from URN Mapping or jBoss Property + def origCallbackUrl = utils.getNodeText(requestHeader, "CallbackUrl") + def callbackUrlToUse = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback", execution) + MsoUtils msoUtil = new MsoUtils() + def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host", execution) + if((useQualifiedHostName!=null) && (useQualifiedHostName.equals("true"))){ + callbackUrlToUse = msoUtil.getQualifiedHostNameForCallback(callbackUrlToUse) + } + msoLogger.debug("Callback URL to use:\n" + callbackUrlToUse) + requestHeader = requestHeader.replace(origCallbackUrl, callbackUrlToUse) + + // Get parameters from request header + def sdnca_svcInstanceId = utils.getNodeText(requestHeader, "SvcInstanceId") // optional + msoLogger.debug("SvcInstanceId: " + sdnca_svcInstanceId) + def sdnca_msoAction = utils.getNodeText(requestHeader, "MsoAction") // optional + msoLogger.debug("MsoAction: " + sdnca_msoAction) + def sdnca_svcAction = utils.getNodeText(requestHeader, "SvcAction") + msoLogger.debug("SvcAction: " + sdnca_svcAction) + def sdnca_svcOperation = utils.getNodeText(requestHeader, "SvcOperation") + msoLogger.debug("SvcOperation: " + sdnca_svcOperation) + def sdncRequestData = utils.getChildNodes(sdncwfreq, "SDNCRequestData") + sdncRequestData = sdncRequestData.replace("\n", "") + sdncRequestData = sdncRequestData.replaceAll('tag0:', '').replaceAll(':tag0', '') + msoLogger.debug("SDNCRequestData:\n" + sdncRequestData) + def sdnca_serviceType = "" + if (utils.nodeExists(sdncwfreq, "service-type")) { + sdnca_serviceType = utils.getNodeText(sdncwfreq, "service-type") + } + msoLogger.debug("service-type: " + sdnca_serviceType) + def serviceConfigActivate = false + def source = '' + if ((sdnca_svcAction == 'activate') && (sdnca_svcOperation == 'service-configuration-operation') && (sdnca_serviceType == 'uCPE-VMS')) { + serviceConfigActivate = true + if (utils.nodeExists(sdncwfreq, 'source')) { + source = utils.getNodeText(sdncwfreq, 'source') + } + } + execution.setVariable("serviceConfigActivate", serviceConfigActivate) + msoLogger.debug("serviceConfigActivate: " + serviceConfigActivate) + execution.setVariable("source", source) + msoLogger.debug("source: " + source) + + //calling process should pass a generated uuid if sending multiple sdnc requests + def requestId = utils.getNodeText(requestHeader, "RequestId") + execution.setVariable(Prefix + "requestId", requestId) + + // Prepare SDNC Request to the SDNC Adapter + String sdncAdapterRequest = """ + + + + + ${MsoUtils.xmlEscape(requestId)}""" + + if (sdnca_svcInstanceId != null) { + sdncAdapterRequest += """ + ${MsoUtils.xmlEscape(sdnca_svcInstanceId)}""" + execution.setVariable("serviceInstanceId", sdnca_svcInstanceId) + } + + sdncAdapterRequest += """ + ${MsoUtils.xmlEscape(sdnca_svcAction)} + ${MsoUtils.xmlEscape(sdnca_svcOperation)} + ${MsoUtils.xmlEscape(callbackUrlToUse)}""" + + if (sdnca_msoAction != null) { + sdncAdapterRequest += """ + ${MsoUtils.xmlEscape(sdnca_msoAction)}""" + } + + sdncAdapterRequest += """ + + + ${sdncRequestData} + """ + + msoLogger.debug("Outgoing SDNCAdapterRequest:\n" + sdncAdapterRequest) + execution.setVariable("sdncAdapterRequest", sdncAdapterRequest) + + msoLogger.debug(UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint", execution)) + }catch(Exception e){ + msoLogger.debug('Internal Error occured during PreProcess Method: ', e) + exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PreProcess Method') // TODO: what message and error code? + } + msoLogger.trace("End pre Process SDNCRequestScript ") + } + + public void postProcessResponse (DelegateExecution execution) { + + try{ + msoLogger.trace("Begin POSTProcess SDNCAdapter ") + msoLogger.trace("Incoming sdncAdapterCallbackRequest:\n" + execution.getVariable("sdncAdapterCallbackRequest")) + + // Check the sdnccallback request and get the responsecode + def sdnccallbackreq = execution.getVariable("sdncAdapterCallbackRequest") + def callbackRequestData = "" + def callbackHeader = "" + + if(sdnccallbackreq != null){ + callbackHeader = utils.getNodeXml(sdnccallbackreq, "CallbackHeader") + callbackRequestData = utils.getNodeXml(sdnccallbackreq, "RequestData") + + callbackHeader = callbackHeader.replace("\n", "") + + callbackRequestData = callbackRequestData.replace("\n", "") + + msoLogger.trace("EnhancedCallbackRequestData:\n" + callbackRequestData) + execution.setVariable("enhancedCallbackRequestData", callbackRequestData) + + String sdncAdapterWorkflowResponse =""" + + + ${callbackHeader} + ${callbackRequestData} + + """ + + + sdncAdapterWorkflowResponse = utils.formatXml(sdncAdapterWorkflowResponse) + execution.setVariable("sdncAdapterResponse", sdncAdapterWorkflowResponse) + // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead + execution.setVariable("WorkflowResponse", sdncAdapterWorkflowResponse) + + // Check final indicator to determine if we are to continue listening or not + def continueListening = false + if (utils.nodeExists(callbackRequestData, "ack-final-indicator")) { + if (utils.getNodeText(callbackRequestData, "ack-final-indicator") == 'N') { + continueListening = true + } + } + execution.setVariable("continueListening", continueListening) + msoLogger.debug("Continue Listening: " + continueListening) + execution.setVariable("asynchronousResponseTimeout", false) + }else{ + // Timed out waiting for asynchronous message, build error response + exceptionUtil.buildWorkflowException(execution, 500, "SDNC Callback Timeout Error") + execution.setVariable("asynchronousResponseTimeout", true) + msoLogger.debug("Timed out waiting for asynchronous message") + } + }catch(Exception e){ + msoLogger.debug('Internal Error occured during PostProcess Method: ' + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PostProcess Method') // TODO: what message and error code? + } + msoLogger.trace("End POSTProcess SDNCAdapter ") + } + + public void callbackResponsecheck(DelegateExecution execution){ + + def sdnccallbackreq=execution.getVariable("sdncAdapterCallbackRequest") + msoLogger.debug("sdncAdapterCallbackRequest :" + sdnccallbackreq) + if (sdnccallbackreq==null){ + execution.setVariable("callbackResponseReceived",false); + }else{ + execution.setVariable("callbackResponseReceived",true); + } + } + + public void resetCallbackRequest(DelegateExecution execution) { + + msoLogger.trace("Begin Reset Callback Info SDNCAdapter ") + + // Clear sdncAdapterCallbackRequest variable + execution.removeVariable("sdncAdapterCallbackRequest") + + // Determine and set SDNC Timeout Value + def enhancedCallbackRequestData = execution.getVariable("enhancedCallbackRequestData") + msoLogger.debug("sdncAdapter - enhancedCallbackRequestData :" + enhancedCallbackRequestData) + def interim = false + if (enhancedCallbackRequestData != null) { + if (utils.nodeExists(enhancedCallbackRequestData, "ack-final-indicator")) { + if (utils.getNodeText(enhancedCallbackRequestData, "ack-final-indicator") == 'N') { + interim = true + } + } + } + def timeoutValue = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution) + if(timeoutValue==null) + timeoutValue="PT5M" + def sdncAdapterWorkflowRequest = execution.getVariable("sdncAdapterWorkflowRequest") + if (interim && utils.nodeExists(sdncAdapterWorkflowRequest, "InterimSDNCTimeOutValueInHours")) { + timeoutValue = "PT" + utils.getNodeText(sdncAdapterWorkflowRequest, "InterimSDNCTimeOutValueInHours") + "H" + } else if (utils.nodeExists(sdncAdapterWorkflowRequest, "SDNCTimeOutValueInMinutes")) { + timeoutValue = "PT" + utils.getNodeText(sdncAdapterWorkflowRequest, "SDNCTimeOutValueInMinutes") + "M" + } + execution.setVariable("sdncTimeoutValue", timeoutValue) + msoLogger.debug("Setting SDNC Timeout Value to " + timeoutValue) + + msoLogger.trace("End Reset Callback Info SDNCAdapter ") + } + + + public void prepareDBMessage(DelegateExecution execution) { + + msoLogger.trace("Begin Prepare DB Message SDNCAdapter ") + + // Create DB Message + def dbRequestId = execution.getVariable("mso-request-id") + String dbUpdateInterimStageCompletion = """ + + + + ${MsoUtils.xmlEscape(dbRequestId)} + 1 + BPEL + + + + """ + + execution.setVariable("dbUpdateInterimStageCompletion", dbUpdateInterimStageCompletion) + msoLogger.debug("sdncAdapter - dbUpdateInterimStageCompletion :" + dbUpdateInterimStageCompletion) + msoLogger.debug("DB UpdateInterimStageCompletion:\n" + dbUpdateInterimStageCompletion) + msoLogger.trace("End Prepare DB Message SDNCAdapter ") + } + + public String generateCurrentTimeInUtc(){ + final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); + sdf.setTimeZone(TimeZone.getTimeZone("UTC")); + final String utcTime = sdf.format(new Date()); + return utcTime; + } + + public void toggleSuccessIndicator(DelegateExecution execution){ + execution.setVariable("SDNCA_SuccessIndicator", true) + msoLogger.debug("Setting SDNCA Success Indicator to True") + } + + public void assignError(DelegateExecution execution){ + msoLogger.trace("Started Assign Error ") + WorkflowException wf = execution.getVariable("WorkflowException") + if(wf == null){ + exceptionUtil.buildWorkflowException(execution, 5000, "SDNCAdapter Encountered an Internal Error") // TODO: Not sure what message and error code we want here..... + }else{ + execution.setVariable("WorkflowException", wf) + } + + msoLogger.debug("Outgoing WorkflowException is: " + execution.getVariable("WorkflowException")) + msoLogger.trace("End Assign Error ") + } + + public void setTimeout(DelegateExecution execution){ + msoLogger.trace("Started SetTimeout ") + msoLogger.debug("Timer expired, telling correlation service to stop listening") + execution.setVariable("asynchronousResponseTimeout", true) + + msoLogger.debug("Timed out branch sleeping for one second to give success branch a chance to complete if running") + Thread.sleep(1000) + msoLogger.trace("End SetTimeout ") + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy new file mode 100644 index 0000000000..f610ea4782 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy @@ -0,0 +1,381 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import java.text.SimpleDateFormat +import java.net.URLEncoder + +import org.apache.commons.codec.binary.Base64 +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution + +import groovy.json.* + +import org.json.JSONObject + +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.RollbackData +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.rest.APIResponse +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + + +class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterRestV1.class); + + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + /** + * Processes the incoming request. + */ + public void preProcessRequest (DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + def prefix="SDNCREST_" + execution.setVariable("prefix", prefix) + setSuccessIndicator(execution, false) + + try { + // Determine the request type and log the request + + String request = validateRequest(execution, "mso-request-id") + String requestType = jsonUtil.getJsonRootProperty(request) + execution.setVariable(prefix + 'requestType', requestType) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType) + + // Determine the SDNCAdapter endpoint + + String sdncAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.sdnc.rest.endpoint", execution) + + if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) { + String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined' + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + while (sdncAdapterEndpoint.endsWith('/')) { + sdncAdapterEndpoint = sdncAdapterEndpoint.substring(0, sdncAdapterEndpoint.length()-1) + } + + String sdncAdapterMethod = null + String sdncAdapterUrl = null + String sdncAdapterRequest = request + + if ('SDNCServiceRequest'.equals(requestType)) { + // Get the sdncRequestId from the request + + String sdncRequestId = jsonUtil.getJsonValue(request, requestType + ".sdncRequestId") + + if (sdncRequestId == null || sdncRequestId.isEmpty()) { + String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + execution.setVariable('SDNCAResponse_CORRELATOR', sdncRequestId) + msoLogger.debug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId) + + // Get the bpNotificationUrl from the request (just to make sure it's there) + + String bpNotificationUrl = jsonUtil.getJsonValue(request, requestType + ".bpNotificationUrl") + + if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) { + String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + sdncAdapterMethod = 'POST' + sdncAdapterUrl = sdncAdapterEndpoint + + RollbackData rollbackData = new RollbackData() + rollbackData.setRequestId(sdncRequestId) + rollbackData.getAdditionalData().put("service", jsonUtil.getJsonValue(request, requestType + ".sdncService")) + rollbackData.getAdditionalData().put("operation", jsonUtil.getJsonValue(request, requestType + ".sdncOperation")) + execution.setVariable("RollbackData", rollbackData) + + } else { + String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + execution.setVariable(prefix + 'sdncAdapterMethod', sdncAdapterMethod) + execution.setVariable(prefix + 'sdncAdapterUrl', sdncAdapterUrl) + execution.setVariable(prefix + 'sdncAdapterRequest', sdncAdapterRequest) + + // Get the Basic Auth credentials for the SDNCAdapter (yes... we ARE using the PO adapters credentials) + + String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) + + if (basicAuthValue == null || basicAuthValue.isEmpty()) { + msoLogger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + } else { + try { + def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) + } catch (IOException ex) { + msoLogger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + } + } + + // Set the timeout value, e.g. PT5M. It may be specified in the request as the + // bpTimeout value. If it's not in the request, use the URN mapping value. + + String timeout = jsonUtil.getJsonValue(request, requestType + ".bpTimeout") + + // in addition to null/empty, also need to verify that the timer value is a valid duration "P[n]T[n]H|M|S" + String timerRegex = "PT[0-9]+[HMS]"; + if (timeout == null || timeout.isEmpty() || !timeout.matches(timerRegex)) { + msoLogger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"') + timeout = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution) + } + + // the timeout could still be null at this point if the config parm is missing/undefined + // forced to log (so OPs can fix the config) and temporarily use a hard coded value of 10 seconds + if (timeout == null) { + msoLogger.warnSimple('preProcessRequest()', 'property "mso.adapters.sdnc.timeout" is missing/undefined. Using "PT10S"') + timeout = "PT10S" + } + + execution.setVariable(prefix + 'timeout', timeout) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout) + } catch (BpmnError e) { + throw e + } catch (Exception e) { + String msg = 'Caught exception in ' + method + ": " + e + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } + + /** + * Sends the request to the SDNC adapter. + */ + public void sendRequestToSDNCAdapter(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendRequestToSDNCAdapter(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + String prefix = execution.getVariable('prefix') + + try { + String sdncAdapterMethod = execution.getVariable(prefix + 'sdncAdapterMethod') + msoLogger.debug("SDNC Method is: " + sdncAdapterMethod) + String sdncAdapterUrl = execution.getVariable(prefix + 'sdncAdapterUrl') + msoLogger.debug("SDNC Url is: " + sdncAdapterUrl) + String sdncAdapterRequest = execution.getVariable(prefix + 'sdncAdapterRequest') + msoLogger.debug("SDNC Rest Request is: " + sdncAdapterRequest) + + RESTConfig config = new RESTConfig(sdncAdapterUrl) + RESTClient client = new RESTClient(config). + addHeader("Content-Type", "application/json") + .addHeader("mso-request-id",execution.getVariable("mso-request-id")) + .addHeader("mso-service-instance-id",execution.getVariable("mso-service-instance-id")) + .addAuthorizationHeader(execution.getVariable(prefix + "basicAuthHeaderValue")) + + APIResponse response + + if ("GET".equals(sdncAdapterMethod)) { + response = client.httpGet() + } else if ("PUT".equals(sdncAdapterMethod)) { + response = client.httpPut(sdncAdapterRequest) + } else if ("POST".equals(sdncAdapterMethod)) { + response = client.httpPost(sdncAdapterRequest) + } else if ("DELETE".equals(sdncAdapterMethod)) { + response = client.httpDelete(sdncAdapterRequest) + } else { + String msg = 'Unsupported HTTP method "' + sdncAdapterMethod + '" in ' + method + ": " + e + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + execution.setVariable(prefix + "sdncAdapterStatusCode", response.getStatusCode()) + execution.setVariable(prefix + "sdncAdapterResponse", response.getResponseBodyAsString()) + } catch (BpmnError e) { + throw e + } catch (Exception e) { + String msg = 'Caught exception in ' + method + ": " + e + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } + + /** + * Processes a callback. + */ + public void processCallback(DelegateExecution execution){ + def method = getClass().getSimpleName() + '.processCallback(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + String prefix = execution.getVariable('prefix') + String callback = execution.getVariable('SDNCAResponse_MESSAGE') + String requestId = execution.getVariable("mso-request-id"); + String serviceInstanceId = execution.getVariable("mso-service-instance-id") + utils.logContext(requestId, serviceInstanceId) + msoLogger.debug("Incoming SDNC Rest Callback is: " + callback) + + try { + int callbackNumber = 1 + while (execution.getVariable(prefix + 'callback' + callbackNumber) != null) { + ++callbackNumber + } + + execution.setVariable(prefix + 'callback' + callbackNumber, callback) + execution.removeVariable('SDNCAResponse_MESSAGE') + + String responseType = jsonUtil.getJsonRootProperty(callback) + + // Get the ackFinalIndicator and make sure it's either Y or N. Default to Y. + String ackFinalIndicator = jsonUtil.getJsonValue(callback, responseType + ".ackFinalIndicator") + + if (!'N'.equals(ackFinalIndicator)) { + ackFinalIndicator = 'Y' + } + + execution.setVariable(prefix + "ackFinalIndicator", ackFinalIndicator) + + if (responseType.endsWith('Error')) { + sdncAdapterBuildWorkflowException(execution, callback) + } + } catch (Exception e) { + callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback + String msg = "Received error from SDNCAdapter: " + callback + msoLogger.debug(getProcessKey(execution) + ': ' + msg) + exceptionUtil.buildWorkflowException(execution, 5300, msg) + } + } + + /** + * Tries to parse the response as XML to extract the information to create + * a WorkflowException. If the response cannot be parsed, a more generic + * WorkflowException is created. + */ + public void sdncAdapterBuildWorkflowException(DelegateExecution execution, String response) { + try { + String responseType = jsonUtil.getJsonRootProperty(response) + String responseCode = jsonUtil.getJsonValue(response, responseType + ".responseCode") + String responseMessage = jsonUtil.getJsonValue(response, responseType + ".responseMessage") + + String info = "" + + if (responseCode != null && !responseCode.isEmpty()) { + info += " responseCode='" + responseCode + "'" + } + + if (responseMessage != null && !responseMessage.isEmpty()) { + info += " responseMessage='" + responseMessage + "'" + } + + // Note: the mapping function handles a null or empty responseCode + int mappedResponseCode = Integer.parseInt(exceptionUtil.MapSDNCResponseCodeToErrorCode(responseCode)); + exceptionUtil.buildWorkflowException(execution, mappedResponseCode, "Received " + responseType + + " from SDNCAdapter:" + info) + } catch (Exception e) { + response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response + exceptionUtil.buildWorkflowException(execution, 5300, "Received error from SDNCAdapter: " + response) + } + } + + /** + * Gets the last callback request from the execution, or null if there was no callback. + */ + public String getLastCallback(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.getLastCallback(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + String prefix = execution.getVariable('prefix') + + try { + int callbackNumber = 1 + String callback = null + + while (true) { + String thisCallback = (String) execution.getVariable(prefix + 'callback' + callbackNumber) + + if (thisCallback == null) { + break + } + + callback = thisCallback + ++callbackNumber + } + + return callback + } catch (Exception e) { + String msg = 'Caught exception in ' + method + ": " + e + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } + + /** + * Sets the timeout value to wait for the next notification. + */ + public void setTimeoutValue(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.setTimeoutValue(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + String prefix = execution.getVariable('prefix') + + try { + def timeoutValue = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution) + + if (execution.getVariable(prefix + 'callback1') != null) { + // Waiting for subsequent notifications + } + } catch (Exception e) { + String msg = 'Caught exception in ' + method + ": " + e + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy new file mode 100644 index 0000000000..967b9fa93f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy @@ -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========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import java.text.SimpleDateFormat +import java.net.URLEncoder + +import org.apache.commons.codec.binary.Base64 +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution + +import groovy.json.* + +import org.json.JSONObject + +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.rest.APIResponse +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +/** + * This version of SDNCAdapterRest allows for interim notifications to be sent for + * any non-final response received from SDNC. + */ +class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterRestV2.class); + + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + /** + * Processes the incoming request. + */ + public void preProcessRequest (DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + def prefix="SDNCREST_" + execution.setVariable("prefix", prefix) + setSuccessIndicator(execution, false) + + try { + // Determine the request type and log the request + + String request = validateRequest(execution, "mso-request-id") + String requestType = jsonUtil.getJsonRootProperty(request) + execution.setVariable(prefix + 'requestType', requestType) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType) + msoLogger.debug('SDNCAdapterRestV2, request: ' + request) + + // Determine the SDNCAdapter endpoint + + String sdncAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.sdnc.rest.endpoint",execution) + + if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) { + String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined' + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + while (sdncAdapterEndpoint.endsWith('/')) { + sdncAdapterEndpoint = sdncAdapterEndpoint.substring(0, sdncAdapterEndpoint.length()-1) + } + + String sdncAdapterMethod = null + String sdncAdapterUrl = null + String sdncAdapterRequest = request + + if ('SDNCServiceRequest'.equals(requestType)) { + // Get the sdncRequestId from the request + + String sdncRequestId = jsonUtil.getJsonValue(request, requestType + ".sdncRequestId") + + if (sdncRequestId == null || sdncRequestId.isEmpty()) { + String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + execution.setVariable('SDNCAResponse_CORRELATOR', sdncRequestId) + msoLogger.debug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId) + + // Get the bpNotificationUrl from the request (just to make sure it's there) + + String bpNotificationUrl = jsonUtil.getJsonValue(request, requestType + ".bpNotificationUrl") + + if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) { + String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + sdncAdapterMethod = 'POST' + sdncAdapterUrl = sdncAdapterEndpoint + + } else { + String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + execution.setVariable(prefix + 'sdncAdapterMethod', sdncAdapterMethod) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterMethod = ' + sdncAdapterMethod) + execution.setVariable(prefix + 'sdncAdapterUrl', sdncAdapterUrl) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterUrl = ' + sdncAdapterUrl) + execution.setVariable(prefix + 'sdncAdapterRequest', sdncAdapterRequest) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterRequest = \n' + sdncAdapterRequest) + + // Get the Basic Auth credentials for the SDNCAdapter (yes... we ARE using the PO adapters credentials) + + String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution) + + if (basicAuthValue == null || basicAuthValue.isEmpty()) { + msoLogger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + } else { + try { + def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) + } catch (IOException ex) { + msoLogger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + } + } + + // Set the timeout value, e.g. PT5M. It may be specified in the request as the + // bpTimeout value. If it's not in the request, use the URN mapping value. + + String timeout = jsonUtil.getJsonValue(request, requestType + ".bpTimeout") + + // in addition to null/empty, also need to verify that the timer value is a valid duration "P[n]T[n]H|M|S" + String timerRegex = "PT[0-9]+[HMS]"; + if (timeout == null || timeout.isEmpty() || !timeout.matches(timerRegex)) { + msoLogger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"') + timeout = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution) + } + + // the timeout could still be null at this point if the config parm is missing/undefined + // forced to log (so OPs can fix the config) and temporarily use a hard coded value of 10 seconds + if (timeout == null) { + msoLogger.warnSimple('preProcessRequest()', 'property "mso.adapters.sdnc.timeout" is missing/undefined. Using "PT10S"') + timeout = "PT10S" + } + + execution.setVariable(prefix + 'timeout', timeout) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout) + } catch (BpmnError e) { + throw e + } catch (Exception e) { + String msg = 'Caught exception in ' + method + ": " + e + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } + + /** + * Processes a callback. Check for possible interim notification. + */ + public void processCallback(DelegateExecution execution){ + def method = getClass().getSimpleName() + '.processCallback(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + String prefix = execution.getVariable('prefix') + String callback = execution.getVariable('SDNCAResponse_MESSAGE') + msoLogger.debug("Incoming SDNC Rest Callback is: " + callback) + + try { + msoLogger.debug(getProcessKey(execution) + ": received callback:\n" + callback) + + int callbackNumber = 1 + while (execution.getVariable(prefix + 'callback' + callbackNumber) != null) { + ++callbackNumber + } + + execution.setVariable(prefix + 'callback' + callbackNumber, callback) + execution.removeVariable('SDNCAResponse_MESSAGE') + + String responseType = jsonUtil.getJsonRootProperty(callback) + + // Get the ackFinalIndicator and make sure it's either Y or N. Default to Y. + String ackFinalIndicator = jsonUtil.getJsonValue(callback, responseType + ".ackFinalIndicator") + + if (!'N'.equals(ackFinalIndicator)) { + ackFinalIndicator = 'Y' + } + + execution.setVariable(prefix + "ackFinalIndicator", ackFinalIndicator) + + if (responseType.endsWith('Error')) { + sdncAdapterBuildWorkflowException(execution, callback) + } + + // Check for possible interim notification + execution.setVariable(prefix + "interimNotification", null) + execution.setVariable(prefix + "doInterimNotification", false) + if ('N'.equals(ackFinalIndicator)) { + def interimNotification = execution.getVariable(prefix + "InterimNotification" + callbackNumber) + if (interimNotification != null) { + execution.setVariable(prefix + "interimNotification", interimNotification) + execution.setVariable(prefix + "doInterimNotification", true) + } + } + + } catch (Exception e) { + callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback + String msg = "Received error from SDNCAdapter: " + callback + msoLogger.debug(getProcessKey(execution) + ': ' + msg) + exceptionUtil.buildWorkflowException(execution, 5300, msg) + } + } + + /** + * Prepare to send an interim notification by extracting the variable/value definitions + * in the interimNotification JSON object and placing them in the execution. These + * variable/value definitions will be passed to the notification service. + */ + public void prepareInterimNotification(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepareInterimNotification(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + String prefix = execution.getVariable('prefix') + msoLogger.debug("Preparing Interim Notification") + + try { + def interimNotification = execution.getVariable(prefix + "interimNotification") + msoLogger.debug("Preparing Interim Notification:\n" + JsonUtils.prettyJson(interimNotification)) + + for (int i = 0; ; i++) { + def variable = JsonUtils.getJsonParamValue(interimNotification, 'variableList', 'variable', i) + + if (variable == null) { + break + } + + def String variableName = JsonUtils.getJsonValue(variable, "name") + if ((variableName != null) && !variableName.isEmpty()) { + def variableValue = JsonUtils.getJsonValue(variable, "value") + execution.setVariable(variableName, variableValue) + msoLogger.debug("Setting "+ variableName + "=" + variableValue) + } + } + + } catch (Exception e) { + String msg = "Error preparing interim notification" + msoLogger.debug(getProcessKey(execution) + ': ' + msg) + exceptionUtil.buildWorkflowException(execution, 5300, msg) + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy new file mode 100644 index 0000000000..ba450c1b12 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy @@ -0,0 +1,1024 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils; +import org.springframework.web.util.UriUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + + +/** + * @version 1.0 + * + */ +class SDNCAdapterUtils { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterUtils.class); + + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + private AbstractServiceTaskProcessor taskProcessor + + public SDNCAdapterUtils(AbstractServiceTaskProcessor taskProcessor) { + this.taskProcessor = taskProcessor + } + + String SDNCAdapterFeatureRequest(DelegateExecution execution, String requestName, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) { + def utils=new MsoUtils() + + def prefix = execution.getVariable('prefix') + def request = taskProcessor.getVariable(execution, requestName) + def requestInformation = utils.getNodeXml(request, 'request-information', false) + def serviceInformation = utils.getNodeXml(request, 'service-information', false) + def featureInformation = utils.getNodeXml(request, 'feature-information', false) + def featureParameters = utils.getNodeXml(request, 'feature-parameters', false) + + def requestId = execution.getVariable('testReqId') // for junits + if(requestId==null){ + requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + + def svcInstanceId = execution.getVariable("mso-service-instance-id") + + def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) + def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation) + def nnsFeatureInformation = utils.removeXmlNamespaces(featureInformation) + def nnsFeatureParameters = utils.removeXmlNamespaces(featureParameters) + + String sdncAdapterFeatureRequest = """ + + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(svcInstanceId)} + ${MsoUtils.xmlEscape(action)} + ${MsoUtils.xmlEscape(serviceOperation)} + ${MsoUtils.xmlEscape(callbackURL)} + + + ${nnsRequestInformation} + ${nnsServiceInformation} + ${nnsFeatureInformation} + ${nnsFeatureParameters} + + ${MsoUtils.xmlEscape(timeoutValueInMinutes)} + + """ + sdncAdapterFeatureRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterFeatureRequest)) + return sdncAdapterFeatureRequest + } + + String SDNCAdapterActivateVnfRequest(DelegateExecution execution, String action, String callbackURL, String serviceOperation, String msoAction, String timeoutValueInMinutes) { + def utils=new MsoUtils() + + def prefix = execution.getVariable('prefix') + def request = taskProcessor.getVariable(execution, prefix+'Request') + def requestInformation = utils.getNodeXml(request, 'request-information', false) + def serviceInformation = utils.getNodeXml(request, 'service-information', false) + def vnfInformationList = utils.getNodeXml(request, 'vnf-information-list', false) + + def requestId = execution.getVariable('testReqId') // for junits + if(requestId==null){ + requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + + def svcInstanceId = execution.getVariable("mso-service-instance-id") + + def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) + def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation) + def nnsVnfInformationList = utils.removeXmlNamespaces(vnfInformationList) + + String sdncAdapterActivateVnfRequest = """ + + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(svcInstanceId)} + ${MsoUtils.xmlEscape(action)} + ${MsoUtils.xmlEscape(serviceOperation)} + ${MsoUtils.xmlEscape(callbackURL)} + ${MsoUtils.xmlEscape(msoAction)} + + + ${nnsRequestInformation} + ${nnsServiceInformation} + ${nnsVnfInformationList} + + ${MsoUtils.xmlEscape(timeoutValueInMinutes)} + + """ + sdncAdapterActivateVnfRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterActivateVnfRequest)) + return sdncAdapterActivateVnfRequest + } + + String SDNCAdapterL3ToHigherLayerRequest(DelegateExecution execution, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) { + def utils=new MsoUtils() + + def prefix = execution.getVariable('prefix') + def request = taskProcessor.getVariable(execution, prefix+'Request') + + def requestInformation = """ + ${MsoUtils.xmlEscape(execution.getVariable("mso-request-id"))} + torepl + ${MsoUtils.xmlEscape(execution.getVariable(prefix+"source"))} + ${MsoUtils.xmlEscape(execution.getVariable(prefix+"notificationUrl"))} + """ + + // Change the value of the 'request-information'.'request-action' element + def xml = new XmlSlurper().parseText(requestInformation) + if("assign".equalsIgnoreCase(action)){ + xml.'request-action'.replaceBody('createTrinityBonding') + }else if("activate".equalsIgnoreCase(action)){ + xml.'request-action'.replaceBody('activateTrinityBonding') + }else if("delete".equalsIgnoreCase(action)){ + xml.'request-action'.replaceBody('deleteTrinityBonding') + } + requestInformation = utils.removeXmlPreamble(groovy.xml.XmlUtil.serialize(xml)) + def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) + + def requestId = execution.getVariable('testReqId') // for junits + if(requestId==null){ + requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + + def svcInstanceId = execution.getVariable("mso-service-instance-id") + + //Build Service Information + // Send serviceName from CANOPI to sdnc for service-type + def serviceInformation = """ + ${MsoUtils.xmlEscape(execution.getVariable(prefix+"serviceName"))} + ${MsoUtils.xmlEscape(svcInstanceId)} + ${MsoUtils.xmlEscape(execution.getVariable(prefix+"subscriberName"))} + ${MsoUtils.xmlEscape(execution.getVariable(prefix+"subscriberGlobalId"))} + """ + + //Build Additional Information - vpn or vni + // Send serviceType from CANOPI to SDNC for nbnc-request-information service-type + def service = execution.getVariable(prefix+"serviceType") + def customerId = execution.getVariable(prefix+"customerId") + def vpnId = execution.getVariable(prefix+"vpnId") + def vpnRt = execution.getVariable(prefix+"vpnRt") + def vpnService = execution.getVariable(prefix+"vpnService") + def vpnRegion = execution.getVariable(prefix+"vpnRegion") + def additionalInfo = "" + if("assign".equalsIgnoreCase(action)){ + additionalInfo = """ + ${MsoUtils.xmlEscape(vpnId)} + ${MsoUtils.xmlEscape(vpnRt)} + ${MsoUtils.xmlEscape(vpnService)} + ${MsoUtils.xmlEscape(vpnRegion)} + """ + }else if("activate".equalsIgnoreCase(action) || "delete".equalsIgnoreCase(action)){ + def vniId = execution.getVariable(prefix+'vniId') + additionalInfo = "${MsoUtils.xmlEscape(vniId)}" + } + + //Set Interface Status + def interfaceStatus = "DISABLE" + if("activate".equalsIgnoreCase(action)){ + interfaceStatus = "ENABLE" + } + + //Build SDNC Adapter Request + String sdncAdapterL3ToHLRequest = """ + + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(svcInstanceId)} + ${MsoUtils.xmlEscape(action)} + ${MsoUtils.xmlEscape(serviceOperation)} + ${MsoUtils.xmlEscape(callbackURL)} + + + ${nnsRequestInformation} + ${serviceInformation} + + ${MsoUtils.xmlEscape(service)} + ${MsoUtils.xmlEscape(customerId)} + ${MsoUtils.xmlEscape(interfaceStatus)} + ${additionalInfo} + + + ${MsoUtils.xmlEscape(timeoutValueInMinutes)} + + """ + sdncAdapterL3ToHLRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterL3ToHLRequest)) + + return sdncAdapterL3ToHLRequest + } + + + + private void SDNCAdapterActivateRequest(DelegateExecution execution, String resultVar, String svcAction, + String svcOperation, String additionalData) { + def utils=new MsoUtils() + + def prefix = execution.getVariable('prefix') + def request = taskProcessor.getVariable(execution, prefix+'Request') + def requestInformation = utils.getNodeXml(request, 'request-information', false) + def serviceInformation = utils.getNodeXml(request, 'service-information', false) + def serviceParameters = utils.getNodeXml(request, 'service-parameters', false) + + def requestId = execution.getVariable('testReqId') // for junits + if(requestId==null){ + requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + + def svcInstanceId = execution.getVariable("mso-service-instance-id") + def msoAction = 'gammainternet' + + def timeoutInMinutes = UrnPropertiesReader.getVariable('mso.sdnc.timeout.firewall.minutes',execution) + + def callbackUrl = (String)UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution) + if (callbackUrl == null || callbackUrl.trim() == "") { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code? + } + + def l2HomingInformation = utils.getNodeXml(serviceParameters, 'l2-homing-information', false) + def internetEvcAccessInformation = utils.getNodeXml(serviceParameters, 'internet-evc-access-information', false) + def vrLan = utils.getNodeXml(serviceParameters, 'vr-lan', false) + def upceVmsServiceInformation = utils.getNodeXml(serviceParameters, 'ucpe-vms-service-information', false) + + + def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) + def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation) + def nnsl2HomingInformation = utils.removeXmlNamespaces(l2HomingInformation) + def nnsInternetEvcAccessInformation = utils.removeXmlNamespaces(internetEvcAccessInformation) + def nnsVrLan = utils.removeXmlNamespaces(vrLan) + def nnsUpceVmsServiceInformation = utils.removeXmlNamespaces(upceVmsServiceInformation) + + if (additionalData == null) { + additionalData = "" + } + + boolean isAic3 = execution.getVariable("isAic3") + + if(isAic3) { + nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC3.0") + } + else { + nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC2.X") + } + + String content = """ + + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(svcInstanceId)} + ${MsoUtils.xmlEscape(svcAction)} + ${MsoUtils.xmlEscape(svcOperation)} + ${MsoUtils.xmlEscape(callbackUrl)} + ${MsoUtils.xmlEscape(msoAction)} + + + ${additionalData} + ${nnsRequestInformation} + ${nnsServiceInformation} + ${nnsl2HomingInformation} + ${nnsInternetEvcAccessInformation} + ${nnsVrLan} + ${nnsUpceVmsServiceInformation} + + ${MsoUtils.xmlEscape(timeoutInMinutes)} + + """ + + content = utils.removeXmlPreamble(utils.formatXML(content)) + execution.setVariable(resultVar, content) + } + + /** + * Builds an SDNC "reserve" request and stores it in the specified execution + * variable. + * @param execution the execution + * @param action the type of action: reserve, turnup, etc + * @param resultVar the execution variable in which the result will be stored + */ + public void sdncReservePrep(DelegateExecution execution, String action, String resultVar) { + sdncReservePrep(execution, action, resultVar, false) + } + + /** + * Builds an SDNC "reserve" request and stores it in the specified execution + * variable. + * @param execution the execution + * @param action the type of action: reserve, turnup, etc + * @param resultVar the execution variable in which the result will be stored + * @param isAic3 boolean to indicate whether request is for AIC3.0 + */ + public void sdncReservePrep(DelegateExecution execution, String action, String resultVar, boolean isAic3) { + sdncPrep(execution, resultVar, action , 'service-configuration-operation', null, isAic3, this.taskProcessor) + } + + /** + * Builds a basic SDNC request and stores it in the specified execution variable. + * @param execution the execution + * @param resultVar the execution variable in which the result will be stored + * @param svcAction the svcAction element value + * @param svcOperation the svcOperation element value + * @param additionalData additional XML content to be inserted into the + * RequestData element (may be null) + */ + public void sdncPrep(DelegateExecution execution, String resultVar, String svcAction, + String svcOperation, String additionalData, AbstractServiceTaskProcessor taskProcessor) { + sdncPrep(execution, resultVar, svcAction, svcOperation, additionalData, false, taskProcessor) + } + + /** + * Builds a basic SDNC request and stores it in the specified execution variable. + * @param execution the execution + * @param resultVar the execution variable in which the result will be stored + * @param svcAction the svcAction element value + * @param svcOperation the svcOperation element value + * @param additionalData additional XML content to be inserted into the RequestData element (may be null) + * @param isAic3 boolean to indicate whether request is for AIC3.0 + */ + public void sdncPrep(DelegateExecution execution, String resultVar, String svcAction, + String svcOperation, String additionalData, boolean isAic3, AbstractServiceTaskProcessor taskProcessor) { + def method = getClass().getSimpleName() + '.sdncPrep(' + + 'execution=' + execution.getId() + + ', resultVar=' + resultVar + + ', svcAction=' + svcAction + + ', svcOperation=' + svcOperation + + ', additionalData=' + (additionalData == null ? "no" : "yes") + + ')' + + msoLogger.trace('Entered ' + method) + MsoUtils utils = taskProcessor.utils + try { + def prefix = execution.getVariable('prefix') + def request = taskProcessor.getVariable(execution, prefix+'Request') + def requestInformation = utils.getNodeXml(request, 'request-information', false) + def serviceInformation = utils.getNodeXml(request, 'service-information', false) + def serviceParameters = utils.getChildNodes(request, 'service-parameters') + def requestAction = utils.getNodeText(request, 'request-action') + + def timeoutInMinutes = UrnPropertiesReader.getVariable('mso.sdnc.timeout.firewall.minutes',execution) + + def requestId = execution.getVariable('testReqId') // for junits + if(requestId==null){ + requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + + def svcInstanceId = execution.getVariable("mso-service-instance-id") + def msoAction = 'gammainternet' + + def callbackUrl = (String)UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution) + if (callbackUrl == null || callbackUrl.trim() == "") { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request") + } + + def l2HomingInformation = utils.getNodeXml(request, 'l2-homing-information', false) + def internetEvcAccessInformation = utils.getNodeXml(request, 'internet-evc-access-information', false) + def vrLan = utils.getNodeXml(request, 'vr-lan', false) + def upceVmsServiceInfo = utils.getNodeXml(request, 'ucpe-vms-service-information', false) + def vnfInformationList = utils.getNodeXml(request, 'vnf-information-list', false) + + def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) + def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation) + def nnsl2HomingInformation = utils.removeXmlNamespaces(l2HomingInformation) + def nnsInternetEvcAccessInformation = utils.removeXmlNamespaces(internetEvcAccessInformation) + def nnsVrLan = utils.removeXmlNamespaces(vrLan) + def nnsUpceVmsServiceInfo = utils.removeXmlNamespaces(upceVmsServiceInfo) + def nnsVnfInformationList = utils.removeXmlNamespaces(vrLan) + def nnsinternetSvcChangeDetails = "" + + if(requestAction!=null && requestAction.equals("ChangeLayer3ServiceProvRequest")){ + def internetSvcChangeDetails = utils.removeXmlNamespaces(serviceParameters) + nnsinternetSvcChangeDetails = """ + ${internetSvcChangeDetails} + """ + } + + if (additionalData == null) { + additionalData = "" + } + + if(isAic3) { + nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC3.0") + } + else { + nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC2.X") + } + + + String content = """ + + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(svcInstanceId)} + ${MsoUtils.xmlEscape(svcAction)} + ${MsoUtils.xmlEscape(svcOperation)} + ${MsoUtils.xmlEscape(callbackUrl)} + ${MsoUtils.xmlEscape(msoAction)} + + + ${additionalData} + ${nnsRequestInformation} + ${nnsServiceInformation} + ${nnsl2HomingInformation} + ${nnsInternetEvcAccessInformation} + ${nnsVrLan} + ${nnsUpceVmsServiceInfo} + ${nnsVnfInformationList} + ${nnsinternetSvcChangeDetails} + + + """ + + content = utils.removeXmlPreamble(utils.formatXML(content)) + execution.setVariable(resultVar, content) + msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error") + } + } + + public String updateHomingInfo(String homingInfo, String aicVersion) { + String newHomingInfo + if(homingInfo == null || homingInfo.trim().length() == 0) { + newHomingInfo = "" + aicVersion + "" + } + else { + newHomingInfo = homingInfo.substring(0, homingInfo.indexOf("")) + "" + aicVersion + "" + } + } + + /** + * Builds a topology SDNC request and return String request. + * As V2 will use 1607-style request, region instead of aic clli code + * @param execution, the execution + * @param requestXML, the incoming request for the flow + * @param serviceInstanceId, the serviceIntance (if available) + * @param callbackUrl, the call back url + * @param action, the action element value + * @param requestAction the svcOperation element value + * @param cloudRegionId the aai's cloud-region-id + * @param networkId the aai's network-id + * @param additionalData additional XML content to be inserted into the + * RequestData element (may be null) + */ + public String sdncTopologyRequestV2 (DelegateExecution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String queryAAIResponse, String additionalData) { + def utils=new MsoUtils() + + // SNDC is expecting request Id for header as unique each call. + String hdrRequestId = "" + String testHdrRequestId = execution.getVariable("testMessageId") // for test purposes. + if (testHdrRequestId == null) { + hdrRequestId = UUID.randomUUID() // generate unique + } else { + hdrRequestId = testHdrRequestId + } + + String requestId = "" + try { + requestId = execution.getVariable("mso-request-id") + } catch (Exception ex) { + requestId = utils.getNodeText(requestXML, "request-id") + } + + String aicCloudRegion = cloudRegionId + String tenantId = "" + if (utils.nodeExists(requestXML, "tenant-id")) { + tenantId = utils.getNodeText(requestXML, "tenant-id") + } + String networkType = "" + if (utils.nodeExists(requestXML, "network-type")) { + networkType = utils.getNodeText(requestXML, "network-type") + } + + // Replace/Use the value of network-type from aai query (vs input) during Delete Network flows. + if (queryAAIResponse != null) { + networkType = utils.getNodeText(queryAAIResponse, "network-type") + } + + String serviceId = "" + if (utils.nodeExists(requestXML, "service-id")) { + serviceId = utils.getNodeText(requestXML, "service-id") + } + String networkName = "" + // Replace/Use the value of network-name from aai query (vs input) if it was already set in AAI + if (queryAAIResponse != null) { + networkName = utils.getNodeText(queryAAIResponse, "network-name") + } + if (networkName.isEmpty() && utils.nodeExists(requestXML, "network-name")) { + networkName = utils.getNodeText(requestXML, "network-name") + } + String source = "" + if (utils.nodeExists(requestXML, "source")) { + source = utils.getNodeText(requestXML, "source") + } + + // get resourceLink from subflow execution variable + String serviceType = "" + String subscriberName = "" + String siRelatedLink = execution.getVariable("GENGSI_siResourceLink") + if (siRelatedLink != null) { + // get service type + int serviceStart = siRelatedLink.indexOf("service-subscription/") + int serviceEnd = siRelatedLink.indexOf("/service-instances/") + serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd) + serviceType = UriUtils.decode(serviceType,"UTF-8") + // get subscriber name + int subscriberNameStart = siRelatedLink.indexOf("customers/customer/") + int subscriberNameEnd = siRelatedLink.indexOf("/service-subscriptions/") + subscriberName = siRelatedLink.substring(subscriberNameStart + 19, subscriberNameEnd) + subscriberName = UriUtils.decode(subscriberName,"UTF-8") + } + + String content = + """ + + ${MsoUtils.xmlEscape(hdrRequestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(action)} + network-topology-operation + sdncCallback + + + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(requestAction)} + ${MsoUtils.xmlEscape(source)} + + + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(serviceType)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(subscriberName)} + + + ${MsoUtils.xmlEscape(networkId)} + ${MsoUtils.xmlEscape(networkType)} + ${MsoUtils.xmlEscape(networkName)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(aicCloudRegion)} + + + """.trim() + + return content + } + + /** + * Builds a topology SDNC request and return String request. + * As V2 will use 1607-style request, region instead of aic clli code + * @param execution, the execution + * @param requestXML, the incoming request for the flow + * @param serviceInstanceId, the serviceIntance (if available) + * @param callbackUrl, the call back url + * @param action, the action element value + * @param requestAction the svcOperation element value + * @param cloudRegionId the aai's cloud-region-id + * @param networkId the aai's network-id + * @param additionalData additional XML content to be inserted into the + * RequestData element (may be null) + */ + public String sdncTopologyRequestRsrc (DelegateExecution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String additionalData) { + def utils=new MsoUtils() + + // SNDC is expecting request Id for header as unique each call. + String hdrRequestId = "" + String testHdrRequestId = execution.getVariable("testMessageId") // for test purposes. + if (testHdrRequestId == null) { + hdrRequestId = UUID.randomUUID() // generate unique + } else { + hdrRequestId = testHdrRequestId + } + + String requestId = "" + String testRequestId = execution.getVariable("testMessageId") // for test purposes. + if (testRequestId == null) { + requestId = execution.getVariable("mso-request-id") + if (requestId == null) { + requestId = execution.getVariable("msoRequestId") + } + } else { + requestId = testRequestId + } + + String aicCloudRegion = cloudRegionId + String tenantId = "" + if (utils.nodeExists(requestXML, "tenant-id")) { + tenantId = utils.getNodeText(requestXML, "tenant-id") + } + String networkType = "" + if (utils.nodeExists(requestXML, "network-type")) { + networkType = utils.getNodeText(requestXML, "network-type") + } + + String subscriptionServiceType = "" + if (utils.nodeExists(requestXML, "subscription-service-type")) { + subscriptionServiceType = utils.getNodeText(requestXML, "subscription-service-type") + } + + String globalCustomerId = "" + if (utils.nodeExists(requestXML, "global-customer-id")) { + globalCustomerId = utils.getNodeText(requestXML, "global-customer-id") + } + + String serviceId = "" + if (utils.nodeExists(requestXML, "service-id")) { + serviceId = utils.getNodeText(requestXML, "service-id") + } + String networkName = "" + if (utils.nodeExists(requestXML, "network-name")) { + networkName = utils.getNodeText(requestXML, "network-name") + } + String source = "" + if (utils.nodeExists(requestXML, "source")) { + source = utils.getNodeText(requestXML, "source") + } + + // get resourceLink from subflow execution variable + String serviceType = "" + String subscriberName = "" + String siRelatedLink = execution.getVariable("GENGSI_siResourceLink") + if (siRelatedLink != null) { + // get service type + int serviceStart = siRelatedLink.indexOf("service-subscription/") + int serviceEnd = siRelatedLink.indexOf("/service-instances/") + serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd) + serviceType = UriUtils.decode(serviceType,"UTF-8") + // get subscriber name + int subscriberNameStart = siRelatedLink.indexOf("customers/customer/") + int subscriberNameEnd = siRelatedLink.indexOf("/service-subscriptions/") + subscriberName = siRelatedLink.substring(subscriberNameStart + 19, subscriberNameEnd) + subscriberName = UriUtils.decode(subscriberName,"UTF-8") + } + + // network-information from 'networkModelInfo' // verify the DB Catalog response + String networkModelInfo = utils.getNodeXml(requestXML, "networkModelInfo", false).replace("tag0:","").replace(":tag0","") + String modelInvariantUuid = utils.getNodeText(networkModelInfo, "modelInvariantUuid") !=null ? + utils.getNodeText(networkModelInfo, "modelInvariantUuid") : "" + String modelCustomizationUuid = utils.getNodeText(networkModelInfo, "modelCustomizationUuid") !=null ? + utils.getNodeText(networkModelInfo, "modelCustomizationUuid") : "" + String modelUuid = utils.getNodeText(networkModelInfo, "modelUuid") !=null ? + utils.getNodeText(networkModelInfo, "modelUuid") : "" + String modelVersion = utils.getNodeText(networkModelInfo, "modelVersion") !=null ? + utils.getNodeText(networkModelInfo, "modelVersion") : "" + String modelName = utils.getNodeText(networkModelInfo, "modelName") !=null ? + utils.getNodeText(networkModelInfo, "modelName") : "" + + // service-information from 'networkModelInfo' // verify the DB Catalog response + String serviceModelInfo = utils.getNodeXml(requestXML, "serviceModelInfo", false).replace("tag0:","").replace(":tag0","") + String serviceModelInvariantUuid = utils.getNodeText(serviceModelInfo, "modelInvariantUuid") !=null ? + utils.getNodeText(serviceModelInfo, "modelInvariantUuid") : "" + String serviceModelUuid = utils.getNodeText(serviceModelInfo, "modelUuid") !=null ? + utils.getNodeText(serviceModelInfo, "modelUuid") : "" + String serviceModelVersion = utils.getNodeText(serviceModelInfo, "modelVersion") !=null ? + utils.getNodeText(serviceModelInfo, "modelVersion") : "" + String serviceModelName = utils.getNodeText(serviceModelInfo, "modelName") !=null ? + utils.getNodeText(serviceModelInfo, "modelName") : "" + + + String content = + """ + + ${MsoUtils.xmlEscape(hdrRequestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(action)} + network-topology-operation + sdncCallback + generic-resource + + + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(requestAction)} + ${MsoUtils.xmlEscape(source)} + + + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(subscriptionServiceType)} + + ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} + ${MsoUtils.xmlEscape(serviceModelUuid)} + ${MsoUtils.xmlEscape(serviceModelVersion)} + ${MsoUtils.xmlEscape(serviceModelName)} + + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(globalCustomerId)} + ${MsoUtils.xmlEscape(subscriberName)} + + + ${MsoUtils.xmlEscape(networkId)} + ${MsoUtils.xmlEscape(networkType)} + + ${MsoUtils.xmlEscape(modelInvariantUuid)} + ${MsoUtils.xmlEscape(modelCustomizationUuid)} + ${MsoUtils.xmlEscape(modelUuid)} + ${MsoUtils.xmlEscape(modelVersion)} + ${MsoUtils.xmlEscape(modelName)} + + + + ${MsoUtils.xmlEscape(networkName)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(aicCloudRegion)} + + + + + """.trim() + + return content + } + + /** + * Validates a workflow response. + * @param execution the execution + * @param responseVar the execution variable in which the response is stored + * @param workflowException the WorkflowException Object returned from sdnc call + */ + public void validateSDNCResponse(DelegateExecution execution, String response, WorkflowException workflowException, boolean successIndicator){ + msoLogger.debug("SDNC Response is: " + response) + msoLogger.debug("SuccessIndicator is: " + successIndicator) + + try { + def prefix = execution.getVariable('prefix') + execution.setVariable(prefix+'sdncResponseSuccess', false) + msoLogger.debug("Response" + ' = ' + (response == null ? "" : System.lineSeparator()) + response) + + if (successIndicator){ + if (response == null || response.trim().equals("")) { + msoLogger.debug(response + ' is empty'); + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "SDNCAdapter Workflow Response is Empty") + }else{ + + // we need to peer into the request data for error + def String sdncAdapterWorkflowResponse = taskProcessor.utils.getNodeXml(response, 'response-data', false) + def String decodedXml = sdncAdapterWorkflowResponse.replace('', "") + decodedXml = taskProcessor.utils.getNodeXml(response, 'RequestData') + msoLogger.debug("decodedXml:\n" + decodedXml) + + int requestDataResponseCode = 200 + def String requestDataResponseMessage = '' + + try{ + if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) { + requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message") + } else if (taskProcessor.utils.nodeExists(sdncAdapterWorkflowResponse, "ResponseMessage")) { + requestDataResponseMessage = taskProcessor.utils.getNodeText(sdncAdapterWorkflowResponse, "ResponseMessage") + } + }catch(Exception e){ + msoLogger.debug('Error caught while decoding resposne ' + e.getMessage()) + } + + if(taskProcessor.utils.nodeExists(decodedXml, "response-code")) { + msoLogger.debug("response-code node Exist ") + String code = taskProcessor.utils.getNodeText(decodedXml, "response-code") + if(code.isEmpty() || code.equals("")){ + // if response-code is blank then Success + msoLogger.debug("response-code node is empty") + requestDataResponseCode = 0 + }else{ + requestDataResponseCode = code.toInteger() + msoLogger.debug("response-code is: " + requestDataResponseCode) + } + }else if(taskProcessor.utils.nodeExists(sdncAdapterWorkflowResponse, "ResponseCode")){ + msoLogger.debug("ResponseCode node Exist ") + String code = taskProcessor.utils.getNodeText(sdncAdapterWorkflowResponse, "ResponseCode") + if(code.isEmpty() || code.equals("")){ + // if ResponseCode blank then Success + msoLogger.debug("ResponseCode node is empty") + requestDataResponseCode = 0 + }else{ + requestDataResponseCode = code.toInteger() + msoLogger.debug("ResponseCode is: " + requestDataResponseCode) + } + }else{ + msoLogger.debug("A Response Code DOES NOT Exist.") + // if a response code does not exist then Success + requestDataResponseCode = 0 + } + try{ + + execution.setVariable(prefix+'sdncRequestDataResponseCode', requestDataResponseCode.toString()) + // if a response code is 0 or 2XX then Success + if ((requestDataResponseCode >= 200 && requestDataResponseCode <= 299) || requestDataResponseCode == 0) { + execution.setVariable(prefix+'sdncResponseSuccess', true) + msoLogger.debug("Setting sdncResponseSuccess to True ") + msoLogger.debug("Exited ValidateSDNCResponse Method") + }else{ + ExceptionUtil exceptionUtil = new ExceptionUtil() + String convertedCode = exceptionUtil.MapSDNCResponseCodeToErrorCode(requestDataResponseCode.toString()) + int convertedCodeInt = Integer.parseInt(convertedCode) + exceptionUtil.buildAndThrowWorkflowException(execution, convertedCodeInt, "Received error from SDN-C: " + requestDataResponseMessage) + } + + }catch(Exception e){ + //TODO proper handling of new, non numerical response codes in 1607 and new error handling for common API + requestDataResponseCode = 500 + } + + msoLogger.debug("SDNC callback response-code: " + requestDataResponseCode) + msoLogger.debug("SDNC callback response-message: " + requestDataResponseMessage) + } + + }else { + msoLogger.debug('SDNCAdapter Subflow did NOT complete Successfully. SuccessIndicator is False. ') + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + }else{ + //TODO : what error code and error message use here + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - SDNCAdapter Subflow did NOT complete successfully.") + } + } + + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.debug('END of Validate SDNC Response') + exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error- Unable to validate SDNC Response '); + } + } + + /** + * Validates a workflow response. + * @param execution the execution + * @param responseVar the execution variable in which the response is stored + * @param responseCodeVar the execution variable in which the response code is stored + * @param errorResponseVar the execution variable in which the error response is stored + */ + public void validateL3BondingSDNCResp(DelegateExecution execution, String response, WorkflowException workflowException, boolean success) { + def method = getClass().getSimpleName() + '.validateL3BondingSDNCResp(' + + 'execution=' + execution.getId() + + ', response=' + response + + ')' + msoLogger.trace('Entered ' + method) + def prefix = execution.getVariable('prefix') + TrinityExceptionUtil trinityExceptionUtil = new TrinityExceptionUtil() + + try { + execution.setVariable(prefix+'sdncResponseSuccess', false) + + msoLogger.debug("sdncAdapter Success Indicator is: " + success) + if (success) { + + // we need to look inside the request data for error + def String callbackRequestData = taskProcessor.utils.getNodeXml(response, 'RequestData', false) + def String decodedXml = callbackRequestData + msoLogger.debug("decodedXml:\n" + decodedXml) + + def requestDataResponseCode = '200' + def requestDataResponseMessage = '' + int intDataResponseCode = 200 + + if (taskProcessor.utils.nodeExists(decodedXml, "response-code")) { + + requestDataResponseCode = ((String) taskProcessor.utils.getNodeText(decodedXml, "response-code")) + if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) { + requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message") + } + }else if(taskProcessor.utils.nodeExists(decodedXml, "ResponseCode")){ + requestDataResponseCode = ((String) taskProcessor.utils.getNodeText(decodedXml, "ResponseCode")).toInteger() + }else if(taskProcessor.utils.nodeExists(response, "ResponseCode")){ + requestDataResponseCode = ((String) taskProcessor.utils.getNodeText(response, "ResponseCode")).toInteger() + requestDataResponseMessage = taskProcessor.utils.getNodeText(response, "ResponseMessage") + } + + msoLogger.debug("SDNC callback response-code: " + requestDataResponseCode) + msoLogger.debug("SDNC callback response-message: " + requestDataResponseMessage) + + // Get the AAI Status to determine if rollback is needed on ASSIGN + def aai_status = '' + if (taskProcessor.utils.nodeExists(decodedXml, "aai-status")) { + aai_status = ((String) taskProcessor.utils.getNodeText(decodedXml, "aai-status")) + msoLogger.debug("SDNC sent AAI STATUS code: " + aai_status) + } + if (aai_status != null && !aai_status.equals("")) { + execution.setVariable(prefix+"AaiStatus",aai_status) + msoLogger.debug("Set variable " + prefix + "AaiStatus: " + execution.getVariable(prefix+"AaiStatus")) + } + + // Get the result string to determine if rollback is needed on ASSIGN in Add Bonding flow only + def sdncResult = '' + if (taskProcessor.utils.nodeExists(decodedXml, "result")) { + sdncResult = ((String) taskProcessor.utils.getNodeText(decodedXml, "result")) + msoLogger.debug("SDNC sent result: " + sdncResult) + } + if (sdncResult != null && !sdncResult.equals("")) { + execution.setVariable(prefix+"SdncResult",sdncResult) + msoLogger.debug("Set variable " + prefix + "SdncResult: " + execution.getVariable(prefix+"SdncResult")) + } + + try{ + intDataResponseCode = Integer.parseInt(String.valueOf(requestDataResponseCode)) + }catch(Exception e){ + intDataResponseCode = 400 + } + + msoLogger.debug("intDataResponseCode " + intDataResponseCode ) + + // if response-code is not Success (200, 201, etc) we need to throw an exception + if ((intDataResponseCode < 200 || intDataResponseCode > 299) && intDataResponseCode != 0) { + execution.setVariable(prefix+'ResponseCode', intDataResponseCode) + execution.setVariable("L3HLAB_rollback", true) + def msg = trinityExceptionUtil.mapSDNCAdapterExceptionToErrorResponse(response, execution) + exceptionUtil.buildAndThrowWorkflowException(execution, intDataResponseCode, "Received error from SDN-C: " + msg) + + } + }else { + msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false '); + execution.setVariable("L3HLAB_rollback", true) + def msg = trinityExceptionUtil.intDataResponseCode(response, execution) + exceptionUtil.buildAndThrowWorkflowException(execution, intDataResponseCode, msg) + } + + if (response == null || response.trim().equals("")) { + msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'sdncAdapter workflow response is empty', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'sdncAdapter workflow response is empty');; + execution.setVariable("L3HLAB_rollback", true) + def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response " , execution) + exceptionUtil.buildAndThrowWorkflowException(execution, intResponseCode, msg) + } + + execution.setVariable(prefix+'sdncResponseSuccess', true) + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable(prefix+"ResponseCode",400) + execution.setVariable("L3HLAB_rollback", true) + def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response: " + e.getMessage(), execution) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, msg) + } + } + + public String modelInfoToEcompModelInformation(String jsonModelInfo) { + String modelInvariantUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelInvariantUuid") + String modelUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelUuid") + if (modelUuid == null) { + modelUuid = "" + } + String modelCustomizationUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelCustomizationUuid") + String modelCustomizationString = "" + if (modelCustomizationUuid != null) { + modelCustomizationString = "${MsoUtils.xmlEscape(modelCustomizationUuid)}" + } + String modelVersion = jsonUtil.getJsonValue(jsonModelInfo, "modelVersion") + if (modelVersion == null) { + modelVersion = "" + } + String modelName = jsonUtil.getJsonValue(jsonModelInfo, "modelName") + String ecompModelInformation = + """ + ${MsoUtils.xmlEscape(modelInvariantUuid)} + ${MsoUtils.xmlEscape(modelUuid)} + ${modelCustomizationString} + ${MsoUtils.xmlEscape(modelVersion)} + ${MsoUtils.xmlEscape(modelName)} + """ + + return ecompModelInformation + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ServiceTaskProcessor.groovy new file mode 100644 index 0000000000..4e2ed0970f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ServiceTaskProcessor.groovy @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts; + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.camunda.bpm.engine.delegate.DelegateExecution + + +/** + * @version 1.0 + * + */ +public interface ServiceTaskProcessor { + public void preProcessRequest(DelegateExecution execution); +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy new file mode 100644 index 0000000000..8d14ead6e0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy @@ -0,0 +1,260 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution + +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.domain.InventoryType +import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.Subscriber +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.rest.APIResponse +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor + +import org.json.JSONArray +import org.json.JSONObject + +import static org.onap.so.bpmn.common.scripts.GenericUtils.*; +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + +/** + * This class is contains the scripts used + * by the Homing Subflow building block. The + * subflow attempts to home the provided + * resources by calling sniro. + * + * @author cb645j + * + */ +class SniroHomingV1 extends AbstractServiceTaskProcessor{ + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroHomingV1.class); + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + SniroUtils sniroUtils = new SniroUtils(this) + + /** + * This method validates the incoming variables. + * The method then prepares the sniro request + * and posts it to sniro's rest api. + * + * @param execution + * + * @author cb645j + */ + public void callSniro(DelegateExecution execution){ + execution.setVariable("prefix","HOME_") + msoLogger.trace("Started Sniro Homing Call Sniro ") + try{ + execution.setVariable("rollbackData", null) + execution.setVariable("rolledBack", false) + + String requestId = execution.getVariable("msoRequestId") + msoLogger.debug("Incoming Request Id is: " + requestId) + String serviceInstanceId = execution.getVariable("serviceInstanceId") + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + msoLogger.debug("Incoming Service Decomposition is: " + serviceDecomposition) + String subscriberInfo = execution.getVariable("subscriberInfo") + msoLogger.debug("Incoming Subscriber Information is: " + subscriberInfo) + + if(isBlank(requestId) || isBlank(serviceInstanceId) || isBlank(serviceDecomposition.toString()) || isBlank(subscriberInfo)){ + exceptionUtil.buildAndThrowWorkflowException(execution, 4000, "A required input variable is missing or null") + }else{ + String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId") + String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName") + String subCommonSiteId = "" + if(jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")){ + subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId") + } + Subscriber subscriber = new Subscriber(subId, subName, subCommonSiteId) + + String cloudConfiguration = execution.getVariable("cloudConfiguration") // TODO Currently not being used + String homingParameters = execution.getVariable("homingParameters") // (aka. request parameters) Should be json format. TODO confirm its json format + + //Authentication + String authHeader = UrnPropertiesReader.getVariable("sniro.manager.headers.auth", execution) + execution.setVariable("BasicAuthHeaderValue", authHeader) + + //Prepare Callback + String timeout = execution.getVariable("timeout") + if(isBlank(timeout)){ + timeout = UrnPropertiesReader.getVariable("sniro.manager.timeout", execution) + if(isBlank(timeout)) { + timeout = "PT30M"; + } + } + msoLogger.debug("Async Callback Timeout will be: " + timeout) + + execution.setVariable("timeout", timeout); + execution.setVariable("correlator", requestId); + execution.setVariable("messageType", "SNIROResponse"); + + //Build Request & Call Sniro + String sniroRequest = sniroUtils.buildRequest(execution, requestId, serviceDecomposition, subscriber, homingParameters) + execution.setVariable("sniroRequest", sniroRequest) + msoLogger.debug("SNIRO Request is: " + sniroRequest) + + String endpoint = UrnPropertiesReader.getVariable("sniro.manager.uri.v1", execution) + String host = UrnPropertiesReader.getVariable("sniro.manager.host", execution) + String url = host + endpoint + msoLogger.debug("Sniro Url is: " + url) + + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addAuthorizationHeader(authHeader).addHeader("Content-Type", "application/json") + APIResponse response = client.httpPost(sniroRequest) + + int responseCode = response.getStatusCode() + msoLogger.debug("Sniro sync response code is: " + responseCode) + msoLogger.debug("Sniro sync response is: " + response.getResponseBodyAsString()) + + if(responseCode != 202){ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from Sniro.") + } + msoLogger.trace("Completed Sniro Homing Call Sniro") + } + }catch(BpmnError b){ + throw b + }catch(Exception e){ + msoLogger.debug("Error encountered within Homing CallSniro method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing CallSniro: " + e.getMessage()) + } + } + + /** + * This method processes the callback response + * and the contained homing solution. It sets + * homing solution assignment and license + * information to the corresponding resources + * + * @param execution + * + * @author cb645j + */ + public void processHomingSolution(DelegateExecution execution){ + msoLogger.trace("Started Sniro Homing Process Homing Solution") + try{ + String response = execution.getVariable("asyncCallbackResponse") + msoLogger.debug("Sniro Async Callback Response is: " + response) + + sniroUtils.validateCallbackResponse(execution, response) + + ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition") + List resourceList = decomposition.getServiceResources() + + if(JsonUtils.jsonElementExist(response, "solutionInfo.placementInfo")){ + String placements = jsonUtil.getJsonValue(response, "solutionInfo.placementInfo") + JSONArray arr = new JSONArray(placements) + for(int i = 0; i < arr.length(); i++){ + JSONObject placement = arr.getJSONObject(i) + String jsonServiceResourceId = placement.getString("serviceResourceId") + for(Resource resource:resourceList){ + String serviceResourceId = resource.getResourceId() + if(serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)){ + //match + String inventoryType = placement.getString("inventoryType") + resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType)) + resource.getHomingSolution().setCloudRegionId(placement.getString("cloudRegionId")) + resource.getHomingSolution().setRehome(placement.getBoolean("isRehome")) + JSONArray assignmentArr = placement.getJSONArray("assignmentInfo") + Map assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "variableName", "variableValue") + resource.getHomingSolution().setCloudOwner(assignmentMap.get("cloudOwner")) + resource.getHomingSolution().setAicClli(assignmentMap.get("aicClli")) + resource.getHomingSolution().setAicVersion(assignmentMap.get("aicVersion")) + if(inventoryType.equalsIgnoreCase("service")){ + VnfResource vnf = new VnfResource() + vnf.setVnfHostname(assignmentMap.get("vnfHostName")) + resource.getHomingSolution().setVnf(vnf) + resource.getHomingSolution().setServiceInstanceId(placement.getString("serviceInstanceId")) + } + } + } + } + } + + if(JsonUtils.jsonElementExist(response, "solutionInfo.licenseInfo")){ + String licenseInfo = jsonUtil.getJsonValue(response, "solutionInfo.licenseInfo") + JSONArray licenseArr = new JSONArray(licenseInfo) + for(int l = 0; l < licenseArr.length(); l++){ + JSONObject license = licenseArr.getJSONObject(l) + String jsonServiceResourceId = license.getString("serviceResourceId") + for(Resource resource:resourceList){ + String serviceResourceId = resource.getResourceId() + if(serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)){ + //match + String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolList") + List entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList) + resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList) + + String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupList") + List licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList) + resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList) + } + } + } + } + execution.setVariable("serviceDecomposition", decomposition) + + msoLogger.trace("Completed Sniro Homing Process Homing Solution") + }catch(BpmnError b){ + throw b + }catch(Exception e){ + msoLogger.debug("Error encountered within Homing ProcessHomingSolution method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Sniro Homing Process Solution") + } + } + + /** + * This method logs the start of DHVCreateService + * to make debugging easier. + * + * @param - execution + * @author cb645j + */ + public String logStart(DelegateExecution execution){ + String requestId = execution.getVariable("testReqId") + if(isBlank(requestId)){ + requestId = execution.getVariable("msoRequestId") + } + execution.setVariable("DHVCS_requestId", requestId) + msoLogger.trace("STARTED Homing Subflow for request: " + requestId + " ") + msoLogger.debug("****** Homing Subflow Global Debug Enabled: " + execution.getVariable("isDebugLogEnabled") + " *****") + msoLogger.trace("STARTED Homing Subflow for request: " + requestId + " ") + } + + + /** + * Auto-generated method stub + */ + public void preProcessRequest(DelegateExecution execution){} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy new file mode 100644 index 0000000000..fd4ab32215 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy @@ -0,0 +1,353 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.domain.* +import org.onap.so.bpmn.core.json.JsonUtils +import org.apache.commons.lang3.StringUtils + +import static org.onap.so.bpmn.common.scripts.GenericUtils.* + +import java.time.Duration + +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +class SniroUtils{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroUtils.class); + + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + private AbstractServiceTaskProcessor utils + + public MsoUtils msoUtils = new MsoUtils() + + public SniroUtils(AbstractServiceTaskProcessor taskProcessor) { + this.utils = taskProcessor + } + + /** + * This method builds the service-agnostic + * sniro json request to get a homing solution + * and license solution + * + * @param execution + * @param requestId + * @param decomposition - ServiceDecomposition object + * @param subscriber - Subscriber information + * @param homingParams - Homing/Request parameters + * + * @return request - sniro v2 payload + * + * @author cb645j + */ + public String buildRequest(DelegateExecution execution, String requestId, ServiceDecomposition decomposition, Subscriber subscriber, String homingParams){ + msoLogger.debug("Started Building Sniro Request") + def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(execution, "SNIROResponse", requestId) + def transactionId = requestId + //ServiceInstance Info + ServiceInstance serviceInstance = decomposition.getServiceInstance() + def serviceInstanceId + if(serviceInstance == null){ + msoLogger.debug("Unable to obtain Service Instance Id, ServiceInstance Object is null" ) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to obtain Service Instance Id, ServiceInstance Object is null") + }else{ + serviceInstanceId = serviceInstance.getInstanceId() + } + String type = decomposition.getServiceType() + String serviceType = "" + if(isNotBlank(type)){ + serviceType = """ "serviceType": "${type}", """ + } + //Model Info + ModelInfo model = decomposition.getModelInfo() + String modelType = model.getModelType() + String modelInvariantId = model.getModelInvariantUuid() + String modelVersionId = model.getModelUuid() + String modelName = model.getModelName() + String modelVersion = model.getModelVersion() + //Subscriber Info + String subscriberId = subscriber.getGlobalId() + String subscriberName = subscriber.getName() + String commonSiteId = subscriber.getCommonSiteId() + //OrderInfo + String orderInfo + if(!isBlank(homingParams)){ + orderInfo = homingParams.replaceAll("\"", "\\\\\"").replaceAll("\n", "").replaceAll("\r", "") + orderInfo = StringUtils.normalizeSpace(orderInfo) + } + + //Determine RequestType + //TODO Implement better way to determine this + String requestType = "initial" + List resources = decomposition.getServiceResources() + for(Resource r:resources){ + HomingSolution currentSolution = (HomingSolution) r.getCurrentHomingSolution() + if(currentSolution != null){ + requestType = "speed changed" + } + } + + String timeout = execution.getVariable("timeout") + Duration d = Duration.parse(timeout); + long timeoutSeconds = d.getSeconds(); + + //Demands + String placementDemands = "" + StringBuilder sb = new StringBuilder() + List resourceList = decomposition.getAllottedResources() + List vnfResourceList = decomposition.getVnfResources() + + //TODO should be service agnostic so this is just a temp solution to all vnfs to be sent in placement container for adiod + if(resourceList.isEmpty() || resourceList == null){ + search : { + for(VnfResource vnf : vnfResourceList){ + if(StringUtils.containsIgnoreCase(vnf.getNfRole(), "vce") || StringUtils.containsIgnoreCase(vnf.getNfRole(), "vpe")){ + resourceList = decomposition.getVnfResources() + break search + } + } + } + } + + if(resourceList.isEmpty() || resourceList == null){ + msoLogger.debug("Resources List is Empty") + }else{ + for(Resource resource:resourceList){ + ModelInfo resourceModelInfo = resource.getModelInfo() + ResourceInstance resourceInstance = resource.getResourceInstance() + def resourceInstanceType = resource.getResourceType() + def serviceResourceId = resource.getResourceId() //TODO - resourceId versus instanceId - should be what is put in AAI, whatever we put here will be what is in response, used to correlate + def resourceModuleName = resourceModelInfo.getModelInstanceName() + def resouceModelCustomizationId = resourceModelInfo.getModelCustomizationUuid() + def resouceModelInvariantId = resourceModelInfo.getModelInvariantUuid() + def resouceModelName = resourceModelInfo.getModelName() + def resouceModelVersion = resourceModelInfo.getModelVersion() + def resouceModelVersionId = resourceModelInfo.getModelUuid() + def resouceModelType = resourceModelInfo.getModelType() + def tenantId = "" //Optional + def tenantName = "" //Optional + + + String existingPlacement = "" + HomingSolution currentPlacement = resource.getCurrentHomingSolution() + if(currentPlacement != null){ + String homedServiceInstanceId = currentPlacement.getServiceInstanceId() + existingPlacement = + ""","existingPlacement": { + "serviceInstanceId": "${homedServiceInstanceId}" + }""" + } + + + String demand = + """{ + "resourceInstanceType": "${resourceInstanceType}", + "serviceResourceId": "${serviceResourceId}", + "resourceModuleName": "${resourceModuleName}", + "resourceModelInfo": { + "modelCustomizationId": "${resouceModelCustomizationId}", + "modelInvariantId": "${resouceModelInvariantId}", + "modelName": "${resouceModelName}", + "modelVersion": "${resouceModelVersion}", + "modelVersionId": "${resouceModelVersionId}", + "modelType": "${resouceModelType}" + }, + "tenantId": "${tenantId}", + "tenantName": "${tenantName}" + ${existingPlacement} + },""" + + placementDemands = sb.append(demand) + } + placementDemands = placementDemands.substring(0, placementDemands.length() - 1); + } + + String licenseDemands = "" + sb = new StringBuilder() + if(vnfResourceList.isEmpty() || vnfResourceList == null){ + msoLogger.debug("Vnf Resources List is Empty") + }else{ + for(VnfResource vnfResource:vnfResourceList){ + ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo() + ResourceInstance vnfResourceInstance = vnfResource.getResourceInstance() + def resourceInstanceType = vnfResource.getResourceType() + def serviceResourceId = vnfResource.getResourceId() + def resourceModuleName = vnfResourceModelInfo.getModelInstanceName() + def resouceModelCustomizationId = vnfResourceModelInfo.getModelCustomizationUuid() + def resouceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid() + def resouceModelName = vnfResourceModelInfo.getModelName() + def resouceModelVersion = vnfResourceModelInfo.getModelVersion() + def resouceModelVersionId = vnfResourceModelInfo.getModelUuid() + def resouceModelType = vnfResourceModelInfo.getModelType() + + String curentLicenseJson = "" + HomingSolution currentSol = vnfResource.getCurrentHomingSolution() + if(currentSol != null){ + JSONArray entitlementPoolList = currentSol.getLicense().getEntitlementPoolListAsString() + JSONArray licenseKeyGroupList = currentSol.getLicense().getLicenseKeyGroupListAsString() + curentLicenseJson = + """ ,"existingLicense": { + "entitlementPoolUUID": + ${entitlementPoolList}, + "licenseKeyGroupUUID": + ${licenseKeyGroupList} + + }""" + } + + String demand = + """{ + "resourceInstanceType": "${resourceInstanceType}", + "serviceResourceId": "${serviceResourceId}", + "resourceModuleName": "${resourceModuleName}", + "resourceModelInfo": { + "modelCustomizationId": "${resouceModelCustomizationId}", + "modelInvariantId": "${resouceModelInvariantId}", + "modelName": "${resouceModelName}", + "modelVersion": "${resouceModelVersion}", + "modelVersionId": "${resouceModelVersionId}", + "modelType": "${resouceModelType}" + } + ${curentLicenseJson} + },""" + + licenseDemands = sb.append(demand) + } + licenseDemands = licenseDemands.substring(0, licenseDemands.length() - 1); + } + + String request = + """{ + "requestInfo": { + "transactionId": "${transactionId}", + "requestId": "${requestId}", + "callbackUrl": "${callbackUrl}", + "sourceId": "mso", + "requestType": "${requestType}", + "optimizer": [ + "placement", + "license" + ], + "numSolutions": 1, + "timeout": ${timeoutSeconds} + }, + "placementInfo": { + ${serviceType} + "serviceModelInfo": { + "modelType": "${modelType}", + "modelInvariantId": "${modelInvariantId}", + "modelVersionId": "${modelVersionId}", + "modelName": "${modelName}", + "modelVersion": "${modelVersion}" + }, + "subscriberInfo": { + "globalSubscriberId": "${subscriberId}", + "subscriberName": "${subscriberName}", + "subscriberCommonSiteId": "${commonSiteId}" + }, + "demandInfo": { + "placementDemand": [ + ${placementDemands} + ], + "licenseDemand": [ + ${licenseDemands} + ] + }, + "policyId": [], + "serviceInstanceId": "${serviceInstanceId}", + "orderInfo": "{\\\"requestParameters\\\": ${orderInfo}}" + } + }""" + + msoLogger.debug("Completed Building Sniro Request") + return request + } + + /** + * This method validates the async callback response from Sniro. + * If the response contains an exception the method will build + * and throw a workflow exception. + * + * @param execution + * @param response - sniro async response + * + * @author cb645j + */ + //TODO needs updating per sniro changes + public void validateCallbackResponse(DelegateExecution execution, String response){ + try{ + String placements = "" + String licenses = "" + if(isBlank(response)){ + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Sniro Async Callback Response is Empty") + }else{ + if(JsonUtils.jsonElementExist(response, "solutionInfo")){ + if(JsonUtils.jsonElementExist(response, "solutionInfo.placementInfo")){ + placements = jsonUtil.getJsonValue(response, "solutionInfo.placementInfo") + } + if(JsonUtils.jsonElementExist(response, "solutionInfo.licenseInfo")){ + licenses = jsonUtil.getJsonValue(response, "solutionInfo.licenseInfo") + } + if((isBlank(placements) || placements.equalsIgnoreCase("[]")) && (isBlank(licenses) || licenses.equalsIgnoreCase("[]"))){ + msoLogger.debug("Sniro Async Response does not contain: licenses or placements") + exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Sniro Async Callback Response does not contain: licenses or placements") + }else{ + return + } + }else if(JsonUtils.jsonElementExist(response, "requestError") == true){ + String errorMessage = "" + if(response.contains("policyException")){ + String text = jsonUtil.getJsonValue(response, "requestError.policyException.text") + errorMessage = "Sniro Async Response contains a policy error: " + text + }else if(response.contains("serviceException")){ + String text = jsonUtil.getJsonValue(response, "requestError.serviceException.text") + errorMessage = "Sniro Async Response contains a service error: " + text + }else{ + errorMessage = "Sniro Async Response contains an error: not provided" + } + msoLogger.debug("Sniro Async Response contains an error: " + errorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, errorMessage) + + }else{ + msoLogger.debug("Sniro Async Response contains an error: not provided") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Sniro Async Response contains an error: not provided") + } + } + }catch(BpmnError b){ + throw b + }catch(Exception e){ + msoLogger.debug("Error encountered within Homing validateCallbackResponse method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Sniro Homing Validate Async Response") + } + } + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy new file mode 100644 index 0000000000..3cf1edb8ca --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy @@ -0,0 +1,382 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +class TrinityExceptionUtil { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, TrinityExceptionUtil.class); + + + + + public static enum Error { + SVC_GENERAL_SERVICE_ERROR("SVC0001","Internal Error"), + SVC_BAD_PARAMETER("SVC0002", "Invalid input value for message part %1"), + SVC_NO_SERVER_RESOURCES("SVC1000", "No server resources available to process the request"), + SVC_DETAILED_SERVICE_ERROR("SVC2000", "The following service error occurred: %1. Error code is %2."), + POL_GENERAL_POLICY_ERROR("POL0001", "A policy error occurred."), + POL_USER_NOT_PROVISIONED("POL1009", "User has not been provisioned for service"), + POL_USER_SUSPENDED("POL1010", "User has been suspended from service"), + POL_DETAILED_POLICY_ERROR("POL2000", "The following policy error occurred: %1. Error code is %2."), + POL_MSG_SIZE_EXCEEDS_LIMIT("POL9003", "Message content size exceeds the allowable limit") + + + private final String msgId + private final String msgTxt + + private Error(String msgId, String msgTxt) { + this.msgId = msgId + this.msgTxt = msgTxt + } + + public String getMsgId() { + return msgId + } + + public String getMsgTxt() { + return msgTxt + } + + } + + + + + String mapAdapterExecptionToCommonException(String response, DelegateExecution execution) + { + def utils=new MsoUtils() + def method = getClass().getSimpleName() + '.mapAdapterExecptionToCommonException(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + + def errorCode + + + try { + errorCode = MapCategoryToErrorCode(utils.getNodeText(response, "category")) + execution.setVariable(prefix+"err",errorCode) + String message = buildException(response, execution) + msoLogger.trace("End MapAdapterExecptionToWorkflowException ") + return message + }catch (Exception ex) { + //Ignore the exception - cases include non xml payload + msoLogger.debug("error mapping error, ignoring: " + ex) + msoLogger.trace("End MapAdapterExecptionToWorkflowException ") + return buildException(response, execution) + } + } + + /** + * @param response + * @param execution + * @return mapped exception + */ + String mapAOTSExecptionToCommonException(String response, DelegateExecution execution) + { + def utils=new MsoUtils() + + def prefix=execution.getVariable("prefix") + def method = getClass().getSimpleName() + '.mapAOTSExecptionToCommonException(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + + try { + def errorCode = utils.getNodeText(response,"code") + def descr = utils.getNodeText(response, "description") + def mappedErr = mapErrorCodetoError(errorCode, descr) + if(mappedErr == Error.SVC_DETAILED_SERVICE_ERROR || mappedError == Error.POL_DETAILED_POLICY_ERROR){ + ArrayList myVars = new ArrayList() + myVars.add(descr) + myVars.add(errorCode) + execution.setVariable(prefix+"errVariables", myVars) + } + execution.setVariable(prefix+"err",mappedErr) + def message = buildException("Received error from AOTS: " + descr, execution) + msoLogger.trace("End MapAOTSExecptionToCommonException ") + return message + }catch (Exception ex) { + //Ignore the exception - cases include non xml payload + msoLogger.debug("error mapping error, ignoring: " + ex) + msoLogger.trace("End MapAOTSExecptionToCommonException ") + return buildException(response, execution) + } + } + + String mapSDNCAdapterExceptionToErrorResponse(String sdncAdapterCallbackRequest, DelegateExecution execution) { + def utils=new MsoUtils() + def prefix=execution.getVariable("prefix") + def method = getClass().getSimpleName() + '.mapSDNCAdapterExceptionToErrorResponse(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + def sdncResponseCode + String responseCode = execution.getVariable(prefix+"ResponseCode") + msoLogger.debug('responseCode to map: ' + responseCode) + def errorMessage + + try { + + if(utils.nodeExists(sdncAdapterCallbackRequest, "RequestData")) { + def reqDataXml = utils.getNodeXml(sdncAdapterCallbackRequest, "RequestData") + errorMessage = utils.getNodeText(reqDataXml, "response-message") + sdncResponseCode = utils.getNodeText(reqDataXml, "response-code") + }else{ + errorMessage = utils.getNodeText(sdncAdapterCallbackRequest, "ResponseMessage") + sdncResponseCode = responseCode + } + def mappedErr = mapErrorCodetoError(responseCode, errorMessage) + errorMessage = errorMessage + def modifiedErrorMessage = "Received error from SDN-C: " + errorMessage + if(mappedErr == Error.SVC_DETAILED_SERVICE_ERROR || mappedErr == Error.POL_DETAILED_POLICY_ERROR){ + ArrayList myVars = new ArrayList() + myVars.add(errorMessage) + myVars.add(sdncResponseCode) + execution.setVariable(prefix+"errVariables", myVars) + } + execution.setVariable(prefix+"err",mappedErr) + def message = buildException(modifiedErrorMessage, execution) + + + msoLogger.trace("End MapSDNCAdapterException ") + return message + }catch (Exception ex) { + //Ignore the exception - cases include non xml payload + msoLogger.debug("error mapping sdnc error, ignoring: " + ex) + msoLogger.trace("End MapSDNCAdapterException ") + return null + } + + } + + /** + * @param response message from called component (ex: AAI) + * @param execution + * @return an error response conforming to the common + */ + String mapAAIExceptionTCommonException(String response, DelegateExecution execution) + { + def utils=new MsoUtils() + def prefix=execution.getVariable("prefix") + def method = getClass().getSimpleName() + '.mapAAIExceptionTCommonException(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + def variables + def message + String errorCode = 'SVC0001' + msoLogger.debug("response: " + response) + //they use the same format we do, pass their error along + //TODO add Received error from A&AI at beg of text + try { + message = utils.getNodeXml(response, "requestError") + message = utils.removeXmlNamespaces(message) + } catch (Exception ex) { + //Ignore the exception - cases include non xml payload + message = buildException("Received error from A&AI, unable to parse",execution) + msoLogger.debug("error mapping error, ignoring: " + ex) + } + + if(message != null) { + execution.setVariable(prefix+"ErrorResponse",message) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Fault", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, execution.getVariable(prefix+"ErrorResponse")); + return message + } else { + + return null + + } + } + + /** + * @param execution + * @return an error response conforming to the common API with default text msg + */ + String buildException(execution){ + return buildException(null, execution) + } + + /** + * @param response message from called component (ex: AAI) + * @param execution + * @return an error response conforming to the common + */ + String buildException(response, execution){ + def utils=new MsoUtils() + def method = getClass().getSimpleName() + '.buildException(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + def prefix=execution.getVariable("prefix") + def responseCode = String.valueOf(execution.getVariable(prefix+"ResponseCode")) + def variables + msoLogger.debug("response: " + response) + + try { + msoLogger.debug("formatting error message" ) + def msgVars = execution.getVariable(prefix+"errVariables") + def myErr = execution.getVariable(prefix+"err") + def messageTxt = execution.getVariable(prefix+"errTxt") + def messageId = null + + if(myErr == null){ + msoLogger.debug("mapping response code: " + responseCode) + myErr = mapErrorCodetoError(responseCode, response) + if(myErr == null){ + //not a service or policy error, just return error code + return "" + } + } + messageId = myErr.getMsgId() + + if(messageTxt == null){ + if(myErr!=null){ + messageTxt = myErr.getMsgTxt() + }else{ + messageTxt = response + } + } + + if(msgVars==null && (myErr == Error.SVC_DETAILED_SERVICE_ERROR || myErr == Error.POL_DETAILED_POLICY_ERROR)){ + msgVars = new ArrayList() + msgVars.add(response) + msgVars.add(responseCode) + } + + def msgVarsXML="" + StringBuffer msgVarsBuff = new StringBuffer() + if(msgVars!=null){ + for(String msgVar : msgVars){ + msgVarsBuff.append( + """ + ${MsoUtils.xmlEscape(msgVar)}""") + } + + } + def message = "" + if(messageId.startsWith("SVC")){ + message = """ + + ${MsoUtils.xmlEscape(messageId)} + ${MsoUtils.xmlEscape(messageTxt)}${msgVarsBuff} + +""" + }else{ + message =""" + + ${MsoUtils.xmlEscape(messageId)} + ${MsoUtils.xmlEscape(messageTxt)}${msgVarsBuff} + +""" + } + msoLogger.debug("message " + message) + execution.setVariable(prefix+"ErrorResponse",message) + execution.setVariable(prefix+"err", myErr) + execution.setVariable(prefix+"errTxt", messageTxt) + execution.setVariable(prefix+"errVariables", msgVars) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Fault", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, execution.getVariable(prefix+"ErrorResponse")); + return message + }catch(Exception ex) { + msoLogger.debug("error mapping error, return null: " + ex) + return null + } + + } + + String parseError(DelegateExecution execution){ + def utils=new MsoUtils() + def prefix=execution.getVariable("prefix") + def text = execution.getVariable(prefix+"errTxt") + def msgVars = execution.getVariable(prefix+"errVariables") + msoLogger.debug('parsing message: ' + text) + if(text == null){ + return 'failed' + } + if(msgVars!=null && !msgVars.isEmpty()){ + for(int i=0; i + ${MsoUtils.xmlEscape(networkRole)} + ${MsoUtils.xmlEscape(networkName)} + + """ + vnfNetworks = vnfNetworks + vnfNetwork + } + } + } catch (Exception e) { + msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'Exception transforming network params to vnfNetworks', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'Exception is: \n' + e); + } + return vnfNetworks + } + + /** + * Transform the parameter specifications from the incoming '*-params' root element to + * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater). + * Each element in '*-params' is used to create an 'entry' element. + * + * @param paramsNode A Node representing a '*-params' element. + * @return a String of 'entry' elements, one for each 'param' element. + */ + protected String transformParamsToEntries(String paramsRootXml) { + if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) { + return '' + } + def String entries = '' + try { + paramsRootXml = utils.removeXmlNamespaces(paramsRootXml) + def paramsNode = xmlParser.parseText(paramsRootXml) + def params = utils.getIdenticalChildren(paramsNode, 'param') + for (param in params) { + def key = (String) param.attribute('name') + if (key == null) { + key = '' + } + def value = (String) param.text() + String entry = """ + + ${MsoUtils.xmlEscape(key)} + ${MsoUtils.xmlEscape(value)} + + """ + entries = entries + entry + } + } catch (Exception e) { + msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'Exception transforming params to entries', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'Exception transforming params to entries', e); + } + return entries + } + + /** + * Transform the parameter specifications from the incoming '*-params' root element to + * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater). + * Each element in '*-params' is used to create an 'entry' element. + * + * @param paramsNode A Node representing a '*-params' element. + * @return a String of 'entry' elements, one for each 'param' element. + */ + protected String transformVolumeParamsToEntries(String paramsRootXml) { + if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) { + return '' + } + def String entries = '' + try { + paramsRootXml = utils.removeXmlNamespaces(paramsRootXml) + def paramsNode = xmlParser.parseText(paramsRootXml) + def params = utils.getIdenticalChildren(paramsNode, 'param') + for (param in params) { + def key = (String) param.attribute('name') + if (key == null) { + key = '' + } + if ( !(key in ['vnf_id', 'vnf_name', 'vf_module_id', 'vf_module_name'])) { + def value = (String) param.text() + String entry = """ + + ${MsoUtils.xmlEscape(key)} + ${MsoUtils.xmlEscape(value)} + + """ + entries = entries + entry + } + } + } catch (Exception e) { + msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'Exception transforming params to entries', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'Exception transforming params to entries', e); + } + return entries + } + + /** + * Extract the Tenant Id from the Volume Group information returned by AAI. + * + * @param volumeGroupXml Volume Group XML returned by AAI. + * @return the Tenant Id extracted from the Volume Group information. 'null' is returned if + * the Tenant Id is missing or could not otherwise be extracted. + */ + protected String getTenantIdFromVolumeGroup(String volumeGroupXml) { + def groovy.util.Node volumeGroupNode = xmlParser.parseText(volumeGroupXml) + def groovy.util.Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list') + if (relationshipList != null) { + def groovy.util.NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') + for (groovy.util.Node relationship in relationships) { + def groovy.util.Node relatedTo = utils.getChildNode(relationship, 'related-to') + if ((relatedTo != null) && (relatedTo.text().equals('tenant'))) { + def groovy.util.NodeList relationshipDataList = utils.getIdenticalChildren(relationship, 'relationship-data') + for (groovy.util.Node relationshipData in relationshipDataList) { + def groovy.util.Node relationshipKey = utils.getChildNode(relationshipData, 'relationship-key') + if ((relationshipKey != null) && (relationshipKey.text().equals('tenant.tenant-id'))) { + def groovy.util.Node relationshipValue = utils.getChildNode(relationshipData, 'relationship-value') + if (relationshipValue != null) { + return relationshipValue.text() + } + } + } + } + } + } + return null + } + + + /* + * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response + * and puts them into the format expected by VNF adapter. + * @param vnfParamsMap - map of VNF parameters passed in the request body + * @param sdncGetResponse - response string from SDNC GET topology request + * @param vnfId + * @param vnfName + * @param vfModuleId + * @param vfModuleName + * @param vfModuleIndex - can be null + * @return a String of key/value entries for vfModuleParams + */ + + + protected String buildVfModuleParams(Map vnfParamsMap, String sdncGetResponse, String vnfId, String vnfName, + String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) { + + //Get SDNC Response Data + + String data = utils.getNodeXml(sdncGetResponse, "response-data") + + String serviceData = utils.getNodeXml(data, "service-data") + serviceData = utils.removeXmlPreamble(serviceData) + serviceData = utils.removeXmlNamespaces(serviceData) + String vnfRequestInfo = utils.getNodeXml(serviceData, "vnf-request-information") + String oldVnfId = utils.getNodeXml(vnfRequestInfo, "vnf-id") + oldVnfId = utils.removeXmlPreamble(oldVnfId) + oldVnfId = utils.removeXmlNamespaces(oldVnfId) + serviceData = serviceData.replace(oldVnfId, "") + def vnfId1 = utils.getNodeText(serviceData, "vnf-id") + + Map paramsMap = new HashMap() + + if (vfModuleIndex != null) { + paramsMap.put("vf_module_index", "${vfModuleIndex}") + } + + // Add-on data + paramsMap.put("vnf_id", "${vnfId}") + paramsMap.put("vnf_name", "${vnfName}") + paramsMap.put("vf_module_id", "${vfModuleId}") + paramsMap.put("vf_module_name", "${vfModuleName}") + paramsMap.put("environment_context", "${environmentContext}") + paramsMap.put("workload_context", "${workloadContext}") + + InputSource source = new InputSource(new StringReader(data)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document responseXml = docBuilder.parse(source) + + + // Availability Zones Data + + NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones") + String aZonePosition = "0" + for (int z = 0; z < aZonesList.getLength(); z++) { + Node node = aZonesList.item(z) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String aZoneValue = utils.getElementText(eElement, "availability-zone") + aZonePosition = z.toString() + paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}") + } + } + + // Map of network-roles and network-tags from vm-networks + + NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks") + Map networkRoleMap = new HashMap() + for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){ + Node nodeNetworkKey = vmNetworksListGlobal.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String networkRole = utils.getElementText(eElementNetworkKey, "network-role") + String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkRoleValue.isEmpty()) { + networkRoleValue = networkRole + } + networkRoleMap.put(networkRole, networkRoleValue) + } + } + + // VNF Networks Data + + StringBuilder sbNet = new StringBuilder() + + NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks") + for (int x = 0; x < vnfNetworkList.getLength(); x++) { + Node node = vnfNetworkList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag") + String networkRole = utils.getElementText(eElement, "network-role") + if (vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRoleMap.get(networkRole) + if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRole + } + } + String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id") + String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name") + String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id") + String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id") + String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn") + paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}") + paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}") + paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}") + paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}") + paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}") + + NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list") + StringBuffer sriovFilterBuf = new StringBuffer() + String values = "" + for(int i = 0; i < sriovVlanFilterList.getLength(); i++){ + Node node1 = sriovVlanFilterList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + String value = utils.getElementText(eElement1, "sriov-vlan-filter") + if (i != sriovVlanFilterList.getLength() - 1) { + values = sriovFilterBuf.append(value + ",") + } + else { + values = sriovFilterBuf.append(value); + } + } + } + if (!values.isEmpty()) { + paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}") + } + } + } + + // VNF-VMS Data + + def key + def value + def networkKey + def networkValue + def floatingIPKey + def floatingIPKeyValue + def floatingIPV6Key + def floatingIPV6KeyValue + StringBuilder sb = new StringBuilder() + + NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms") + for (int x = 0; x < vmsList.getLength(); x++) { + Node node = vmsList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + key = utils.getElementText(eElement, "vm-type") + String values + String position = "0" + StringBuilder sb1 = new StringBuilder() + NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names") + NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks") + for(int i = 0; i < valueList.getLength(); i++){ + Node node1 = valueList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + value = utils.getElementText(eElement1, "vm-name") + if (i != valueList.getLength() - 1) { + values = sb1.append(value + ",") + } + else { + values = sb1.append(value); + } + position = i.toString() + paramsMap.put("${key}_name_${position}", "${value}") + } + } + for(int n = 0; n < vmNetworksList.getLength(); n++){ + String floatingIpKeyValueStr = "" + String floatingIpV6KeyValueStr = "" + Node nodeNetworkKey = vmNetworksList.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String ipAddressValues + String ipV6AddressValues + String networkPosition = "0" + StringBuilder sb2 = new StringBuilder() + StringBuilder sb3 = new StringBuilder() + StringBuilder sb4 = new StringBuilder() + networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkKey.isEmpty()) { + networkKey = utils.getElementText(eElementNetworkKey, "network-role") + } + floatingIPKey = key + '_' + networkKey + '_floating_ip' + floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip") + if(!floatingIPKeyValue.isEmpty()){ + paramsMap.put("$floatingIPKey", "$floatingIPKeyValue") + } + floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip' + floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6") + if(!floatingIPV6KeyValue.isEmpty()){ + paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue") + } + NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips") + for(int a = 0; a < networkIpsList.getLength(); a++){ + Node ipAddress = networkIpsList.item(a) + if (ipAddress.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpAddress = (Element) ipAddress + String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address") + if (a != networkIpsList.getLength() - 1) { + ipAddressValues = sb2.append(ipAddressValue + ",") + } + else { + ipAddressValues = sb2.append(ipAddressValue); + } + networkPosition = a.toString() + paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}") + } + } + + paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}") + + NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes") + String interfaceRoutePrefixValues = sb3.append("[") + + for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){ + Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a) + if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) { + Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix + String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr") + if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) { + interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") + } + if (a != interfaceRoutePrefixesList.getLength() - 1) { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",") + } + else { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}") + } + } + } + interfaceRoutePrefixValues = sb3.append("]") + if (interfaceRoutePrefixesList.getLength() > 0) { + paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}") + } + + NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6") + for(int a = 0; a < networkIpsV6List.getLength(); a++){ + Node ipV6Address = networkIpsV6List.item(a) + if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpV6Address = (Element) ipV6Address + String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6") + if (a != networkIpsV6List.getLength() - 1) { + ipV6AddressValues = sb4.append(ipV6AddressValue + ",") + } + else { + ipV6AddressValues = sb4.append(ipV6AddressValue); + } + networkPosition = a.toString() + paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}") + } + } + paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}") + } + } + paramsMap.put("${key}_names", "${values}") + } + } + //SDNC Response Params + String sdncResponseParams = "" + List sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"] + String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters") + if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ + // No SDNC params + }else{ + NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters") + for (int z = 0; z < paramsList.getLength(); z++) { + Node node = paramsList.item(z) + Element eElement = (Element) node + String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name") + if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { + String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value") + paramsMap.put("${vnfParameterName}", "${vnfParameterValue}") + } + } + } + + // Parameters received from the request should overwrite any parameters received from SDNC + if (vnfParamsMap != null) { + for (Map.Entry entry : vnfParamsMap.entrySet()) { + String vnfKey = entry.getKey() + String vnfValue = entry.getValue() + paramsMap.put("$vnfKey", "$vnfValue") + } + } + + StringBuilder sbParams = new StringBuilder() + def vfModuleParams = "" + for (Map.Entry entry : paramsMap.entrySet()) { + String paramsXml + String paramName = entry.getKey() + String paramValue = entry.getValue() + paramsXml = + """ + ${MsoUtils.xmlEscape(paramName)} + ${MsoUtils.xmlEscape(paramValue)} + + """ + + vfModuleParams = sbParams.append(paramsXml) + } + + return vfModuleParams + + } + + + /* + * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response + * for both VNF and VF Module + * and puts them into the format expected by VNF adapter. + * @param vnfParamsMap - map of VNF parameters passed in the request body + * @param vnfSdncGetResponse - response string from SDNC GET VNF topology request + * @param vfmoduleSdncGetResponse - response string from SDNC GET VF Module topology request + * @param vnfId + * @param vnfName + * @param vfModuleId + * @param vfModuleName + * @param vfModuleIndex - can be null + * @return a String of key/value entries for vfModuleParams + */ + + protected String buildVfModuleParamsFromCombinedTopologies(Map vnfParamsMap, String vnfSdncGetResponse, String vfmoduleSdncGetResponse, String vnfId, String vnfName, + String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) { + + // Set up initial parameters + + Map paramsMap = new HashMap() + + if (vfModuleIndex != null) { + paramsMap.put("vf_module_index", "${vfModuleIndex}") + } + + // Add-on data + paramsMap.put("vnf_id", "${vnfId}") + paramsMap.put("vnf_name", "${vnfName}") + paramsMap.put("vf_module_id", "${vfModuleId}") + paramsMap.put("vf_module_name", "${vfModuleName}") + paramsMap.put("environment_context","${environmentContext}") + paramsMap.put("workload_context", "${workloadContext}") + + //Get SDNC Response Data for VNF + + String vnfData = utils.getNodeXml(vnfSdncGetResponse, "response-data") + + String vnfTopology = utils.getNodeXml(vnfData, "vnf-topology") + vnfTopology = utils.removeXmlPreamble(vnfTopology) + vnfTopology = utils.removeXmlNamespaces(vnfTopology) + + InputSource sourceVnf = new InputSource(new StringReader(vnfData)); + DocumentBuilderFactory docFactoryVnf = DocumentBuilderFactory.newInstance(); + docFactoryVnf.setNamespaceAware(true) + DocumentBuilder docBuilderVnf = docFactoryVnf.newDocumentBuilder() + Document responseXmlVnf = docBuilderVnf.parse(sourceVnf) + + // Availability Zones Data + + NodeList aZonesList = responseXmlVnf.getElementsByTagNameNS("*", "availability-zones") + String aZonePosition = "0" + for (int z = 0; z < aZonesList.getLength(); z++) { + Node node = aZonesList.item(z) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String aZoneValue = utils.getElementText(eElement, "availability-zone") + aZonePosition = z.toString() + paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}") + } + } + + //Get SDNC Response Data for VF Module + + String vfModuleData = utils.getNodeXml(vfmoduleSdncGetResponse, "response-data") + + String vfModuleTopology = utils.getNodeXml(vfModuleData, "vf-module-topology") + vfModuleTopology = utils.removeXmlPreamble(vfModuleTopology) + vfModuleTopology = utils.removeXmlNamespaces(vfModuleTopology) + String vfModuleTopologyIdentifier = utils.getNodeXml(vfModuleTopology, "vf-module-topology-identifier") + + InputSource sourceVfModule = new InputSource(new StringReader(vfModuleData)); + DocumentBuilderFactory docFactoryVfModule = DocumentBuilderFactory.newInstance(); + docFactoryVfModule.setNamespaceAware(true) + DocumentBuilder docBuilderVfModule = docFactoryVfModule.newDocumentBuilder() + Document responseXmlVfModule = docBuilderVfModule.parse(sourceVfModule) + + // Map of network-roles and network-tags from vm-networks + + NodeList vmNetworksListGlobal = responseXmlVfModule.getElementsByTagNameNS("*", "vm-networks") + Map networkRoleMap = new HashMap() + for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){ + Node nodeNetworkKey = vmNetworksListGlobal.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String networkRole = utils.getElementText(eElementNetworkKey, "network-role") + String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkRoleValue.isEmpty()) { + networkRoleValue = networkRole + } + networkRoleMap.put(networkRole, networkRoleValue) + } + } + + // VNF Networks Data + + StringBuilder sbNet = new StringBuilder() + + NodeList vnfNetworkList = responseXmlVnf.getElementsByTagNameNS("*", "vnf-networks") + for (int x = 0; x < vnfNetworkList.getLength(); x++) { + Node node = vnfNetworkList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag") + String networkRole = utils.getElementText(eElement, "network-role") + if (vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRoleMap.get(networkRole) + if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRole + } + } + String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id") + String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name") + String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id") + String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id") + String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn") + paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}") + paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}") + paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}") + paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}") + paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}") + + NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list") + StringBuffer sriovFilterBuf = new StringBuffer() + String values = "" + for(int i = 0; i < sriovVlanFilterList.getLength(); i++){ + Node node1 = sriovVlanFilterList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + String value = utils.getElementText(eElement1, "sriov-vlan-filter") + if (i != sriovVlanFilterList.getLength() - 1) { + values = sriovFilterBuf.append(value + ",") + } + else { + values = sriovFilterBuf.append(value); + } + } + } + if (!values.isEmpty()) { + paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}") + } + } + } + + + + // VMS Data + + def key + def value + def networkKey + def networkValue + def floatingIPKey + def floatingIPKeyValue + def floatingIPV6Key + def floatingIPV6KeyValue + StringBuilder sb = new StringBuilder() + + NodeList vmsList = responseXmlVfModule.getElementsByTagNameNS("*","vm") + for (int x = 0; x < vmsList.getLength(); x++) { + Node node = vmsList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + key = utils.getElementText(eElement, "vm-type") + String values + String position = "0" + StringBuilder sb1 = new StringBuilder() + NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names") + NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks") + for(int i = 0; i < valueList.getLength(); i++){ + Node node1 = valueList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + value = utils.getElementText(eElement1, "vm-name") + if (i != valueList.getLength() - 1) { + values = sb1.append(value + ",") + } + else { + values = sb1.append(value); + } + position = i.toString() + paramsMap.put("${key}_name_${position}", "${value}") + } + } + for(int n = 0; n < vmNetworksList.getLength(); n++){ + String floatingIpKeyValueStr = "" + String floatingIpV6KeyValueStr = "" + Node nodeNetworkKey = vmNetworksList.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String ipAddressValues + String ipV6AddressValues + String networkPosition = "0" + StringBuilder sb2 = new StringBuilder() + StringBuilder sb3 = new StringBuilder() + StringBuilder sb4 = new StringBuilder() + networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkKey.isEmpty()) { + networkKey = utils.getElementText(eElementNetworkKey, "network-role") + } + floatingIPKey = key + '_' + networkKey + '_floating_ip' + floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip") + if(!floatingIPKeyValue.isEmpty()){ + paramsMap.put("$floatingIPKey", "$floatingIPKeyValue") + } + floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip' + floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6") + if(!floatingIPV6KeyValue.isEmpty()){ + paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue") + } + NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips") + for(int a = 0; a < networkIpsList.getLength(); a++){ + Node ipAddress = networkIpsList.item(a) + if (ipAddress.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpAddress = (Element) ipAddress + String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address") + if (a != networkIpsList.getLength() - 1) { + ipAddressValues = sb2.append(ipAddressValue + ",") + } + else { + ipAddressValues = sb2.append(ipAddressValue); + } + networkPosition = a.toString() + paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}") + } + } + + paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}") + + NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes") + String interfaceRoutePrefixValues = sb3.append("[") + + for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){ + Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a) + if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) { + Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix + String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr") + if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) { + interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") + } + if (a != interfaceRoutePrefixesList.getLength() - 1) { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",") + } + else { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}") + } + } + } + interfaceRoutePrefixValues = sb3.append("]") + if (interfaceRoutePrefixesList.getLength() > 0) { + paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}") + } + + NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6") + for(int a = 0; a < networkIpsV6List.getLength(); a++){ + Node ipV6Address = networkIpsV6List.item(a) + if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpV6Address = (Element) ipV6Address + String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6") + if (a != networkIpsV6List.getLength() - 1) { + ipV6AddressValues = sb4.append(ipV6AddressValue + ",") + } + else { + ipV6AddressValues = sb4.append(ipV6AddressValue); + } + networkPosition = a.toString() + paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}") + } + } + paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}") + } + } + paramsMap.put("${key}_names", "${values}") + } + } + //SDNC Response Params + List sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"] + + String vnfParamsChildNodes = utils.getChildNodes(vnfData, "param") + if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ + // No SDNC params for VNF + }else{ + NodeList paramsList = responseXmlVnf.getElementsByTagNameNS("*", "param") + for (int z = 0; z < paramsList.getLength(); z++) { + Node node = paramsList.item(z) + Element eElement = (Element) node + String vnfParameterName = utils.getElementText(eElement, "name") + if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { + String vnfParameterValue = utils.getElementText(eElement, "value") + paramsMap.put("${vnfParameterName}", "${vnfParameterValue}") + } + } + } + + String vfModuleParamsChildNodes = utils.getChildNodes(vfModuleData, "param") + if(vfModuleParamsChildNodes == null || vfModuleParamsChildNodes.length() < 1){ + // No SDNC params for VF Module + }else{ + NodeList paramsList = responseXmlVfModule.getElementsByTagNameNS("*", "param") + for (int z = 0; z < paramsList.getLength(); z++) { + Node node = paramsList.item(z) + Element eElement = (Element) node + String vnfParameterName = utils.getElementText(eElement, "name") + if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { + String vnfParameterValue = utils.getElementText(eElement, "value") + paramsMap.put("${vnfParameterName}", "${vnfParameterValue}") + } + } + } + + // Parameters received from the request should overwrite any parameters received from SDNC + if (vnfParamsMap != null) { + for (Map.Entry entry : vnfParamsMap.entrySet()) { + String vnfKey = entry.getKey() + String vnfValue = entry.getValue() + paramsMap.put("$vnfKey", "$vnfValue") + } + } + + StringBuilder sbParams = new StringBuilder() + def vfModuleParams = "" + for (Map.Entry entry : paramsMap.entrySet()) { + String paramsXml + String paramName = entry.getKey() + String paramValue = entry.getValue() + paramsXml = + """ + ${MsoUtils.xmlEscape(paramName)} + ${MsoUtils.xmlEscape(paramValue)} + + """ + + vfModuleParams = sbParams.append(paramsXml) + } + + return vfModuleParams + + } + + + /* + * VBNG specific method that parses VNF parameters passed in on the + * incoming requests and SDNC parameters returned from SDNC get response + * and puts them into the format expected by VNF adapter. + * @param vnfParamsMap - map of VNF parameters passed in the request body + * @param sdncGetResponse - response string from SDNC GET topology request + * @param vnfId + * @param vnfName + * @param vfModuleId + * @param vfModuleName + * @return a String of key/value entries for vfModuleParams + */ + + protected String buildVfModuleParamsVbng(String vnfParams, String sdncGetResponse, String vnfId, String vnfName, + String vfModuleId, String vfModuleName) { + + //Get SDNC Response Data + + String data = utils.getNodeXml(sdncGetResponse, "response-data") + + + + // Add-on data + String vnfInfo = + """ + vnf_id + ${MsoUtils.xmlEscape(vnfId)} + + + vnf_name + ${MsoUtils.xmlEscape(vnfName)} + + + vf_module_id + ${MsoUtils.xmlEscape(vfModuleId)} + + + vf_module_name + ${MsoUtils.xmlEscape(vfModuleName)} + """ + + msoLogger.debug("vnfInfo: " + vnfInfo) + InputSource source = new InputSource(new StringReader(data)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document responseXml = docBuilder.parse(source) + + + // Availability Zones Data + String aZones = "" + StringBuilder sbAZone = new StringBuilder() + NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones") + String aZonePosition = "0" + for (int z = 0; z < aZonesList.getLength(); z++) { + Node node = aZonesList.item(z) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String aZoneValue = utils.getElementText(eElement, "availability-zone") + aZonePosition = z.toString() + String aZoneXml = + """ + availability_zone_${MsoUtils.xmlEscape(aZonePosition)} + ${MsoUtils.xmlEscape(aZoneValue)} + """ + aZones = sbAZone.append(aZoneXml) + } + } + + // Map of network-roles and network-tags from vm-networks + + NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks") + Map networkRoleMap = new HashMap() + for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){ + Node nodeNetworkKey = vmNetworksListGlobal.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String networkRole = utils.getElementText(eElementNetworkKey, "network-role") + String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkRoleValue.isEmpty()) { + networkRoleValue = networkRole + } + networkRoleMap.put(networkRole, networkRoleValue) + } + } + + // VNF Networks Data + String vnfNetworkNetId = "" + String vnfNetworkNetName = "" + String vnfNetworkSubNetId = "" + String vnfNetworkV6SubNetId = "" + String vnfNetworkNetFqdn = "" + String vnfNetworksSriovVlanFilters = "" + StringBuilder sbNet = new StringBuilder() + StringBuilder sbNet2 = new StringBuilder() + StringBuilder sbNet3 = new StringBuilder() + StringBuilder sbNet4 = new StringBuilder() + StringBuilder sbNet5 = new StringBuilder() + StringBuilder sbNet6 = new StringBuilder() + NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks") + for (int x = 0; x < vnfNetworkList.getLength(); x++) { + Node node = vnfNetworkList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag") + String networkRole = utils.getElementText(eElement, "network-role") + if (vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRoleMap.get(networkRole) + if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRole + } + } + String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id") + String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name") + String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id") + String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id") + String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn") + String vnfNetworkNetIdXml = + """ + ${MsoUtils.xmlEscape(vnfNetworkKey)}_net_id + ${MsoUtils.xmlEscape(vnfNetworkNeutronIdValue)} + """ + vnfNetworkNetId = sbNet.append(vnfNetworkNetIdXml) + String vnfNetworkNetNameXml = + """ + ${MsoUtils.xmlEscape(vnfNetworkKey)}_net_name + ${MsoUtils.xmlEscape(vnfNetworkNetNameValue)} + """ + vnfNetworkNetName = sbNet2.append(vnfNetworkNetNameXml) + String vnfNetworkSubNetIdXml = + """ + ${MsoUtils.xmlEscape(vnfNetworkKey)}_subnet_id + ${MsoUtils.xmlEscape(vnfNetworkSubNetIdValue)} + """ + vnfNetworkSubNetId = sbNet3.append(vnfNetworkSubNetIdXml) + String vnfNetworkV6SubNetIdXml = + """ + ${MsoUtils.xmlEscape(vnfNetworkKey)}_v6_subnet_id + ${MsoUtils.xmlEscape(vnfNetworkV6SubNetIdValue)} + """ + vnfNetworkV6SubNetId = sbNet5.append(vnfNetworkV6SubNetIdXml) + String vnfNetworkNetFqdnXml = + """ + ${MsoUtils.xmlEscape(vnfNetworkKey)}_net_fqdn + ${MsoUtils.xmlEscape(vnfNetworkNetFqdnValue)} + """ + vnfNetworkNetFqdn = sbNet4.append(vnfNetworkNetFqdnXml) + + NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list") + StringBuffer sriovFilterBuf = new StringBuffer() + String values = "" + for(int i = 0; i < sriovVlanFilterList.getLength(); i++){ + Node node1 = sriovVlanFilterList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + String value = utils.getElementText(eElement1, "sriov-vlan-filter") + if (i != sriovVlanFilterList.getLength() - 1) { + values = sriovFilterBuf.append(value + ",") + } + else { + values = sriovFilterBuf.append(value); + } + } + } + if (!values.isEmpty()) { + String vnfNetworkSriovVlanFilterXml = + """ + ${MsoUtils.xmlEscape(vnfNetworkKey)}_ATT_VF_VLAN_FILTER + ${MsoUtils.xmlEscape(values)} + """ + vnfNetworksSriovVlanFilters = sbNet6.append(vnfNetworkSriovVlanFilterXml) + } + } + } + + // VNF-VMS Data + String vnfVMS = "" + String vnfVMSPositions = "" + String vmNetworks = "" + String vmNetworksPositions = "" + String vmNetworksPositionsV6 = "" + String interfaceRoutePrefixes = "" + def key + def value + def networkKey + def networkValue + def floatingIPKey + def floatingIPKeyValue + def floatingIPV6Key + def floatingIPV6KeyValue + StringBuilder sb = new StringBuilder() + StringBuilder sbPositions = new StringBuilder() + StringBuilder sbVmNetworks = new StringBuilder() + StringBuilder sbNetworksPositions = new StringBuilder() + StringBuilder sbInterfaceRoutePrefixes = new StringBuilder() + StringBuilder sbNetworksPositionsV6 = new StringBuilder() + + NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms") + for (int x = 0; x < vmsList.getLength(); x++) { + Node node = vmsList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + key = utils.getElementText(eElement, "vm-type") + String values + String position = "0" + StringBuilder sb1 = new StringBuilder() + NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names") + NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks") + for(int i = 0; i < valueList.getLength(); i++){ + Node node1 = valueList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + value = utils.getElementText(eElement1, "vm-name") + if (i != valueList.getLength() - 1) { + values = sb1.append(value + ",") + } + else { + values = sb1.append(value); + } + position = i.toString() + String vnfPositionXml = + """ + ${MsoUtils.xmlEscape(key)}_name_${MsoUtils.xmlEscape(position)} + ${MsoUtils.xmlEscape(value)} + """ + nfVMSPositions = sbPositions.append(vnfPositionXml) + } + } + for(int n = 0; n < vmNetworksList.getLength(); n++){ + String floatingIpKeyValueStr = "" + String floatingIpV6KeyValueStr = "" + Node nodeNetworkKey = vmNetworksList.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String ipAddressValues + String ipV6AddressValues + String networkPosition = "0" + StringBuilder sb2 = new StringBuilder() + StringBuilder sb3 = new StringBuilder() + StringBuilder sb4 = new StringBuilder() + networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkKey.isEmpty()) { + networkKey = utils.getElementText(eElementNetworkKey, "network-role") + } + floatingIPKey = key + '_' + networkKey + '_floating_ip' + floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip") + if(!floatingIPKeyValue.isEmpty()){ + floatingIpKeyValueStr = """ + $floatingIPKey + $floatingIPKeyValue + """ + } + floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip' + floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6") + if(!floatingIPV6KeyValue.isEmpty()){ + floatingIpV6KeyValueStr = """ + $floatingIPV6Key + $floatingIPV6KeyValue + """ + } + NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips") + for(int a = 0; a < networkIpsList.getLength(); a++){ + Node ipAddress = networkIpsList.item(a) + if (ipAddress.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpAddress = (Element) ipAddress + String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address") + if (a != networkIpsList.getLength() - 1) { + ipAddressValues = sb2.append(ipAddressValue + ",") + } + else { + ipAddressValues = sb2.append(ipAddressValue); + } + networkPosition = a.toString() + String vmNetworksPositionsXml = + """ + ${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_ip_${MsoUtils.xmlEscape(networkPosition)} + ${MsoUtils.xmlEscape(ipAddressValue)} + """ + vmNetworksPositions = sbNetworksPositions.append(vmNetworksPositionsXml) + } + } + vmNetworksPositions = sbNetworksPositions.append(floatingIpKeyValueStr).append(floatingIpV6KeyValueStr) + + String vmNetworksXml = + """ + ${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_ips + ${MsoUtils.xmlEscape(ipAddressValues)} + """ + vmNetworks = sbVmNetworks.append(vmNetworksXml) + + NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes") + String interfaceRoutePrefixValues = sb3.append("[") + + for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){ + Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a) + if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) { + Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix + String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr") + if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) { + interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") + } + if (a != interfaceRoutePrefixesList.getLength() - 1) { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",") + } + else { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}") + } + } + } + interfaceRoutePrefixValues = sb3.append("]") + if (interfaceRoutePrefixesList.getLength() > 0) { + String interfaceRoutePrefixesXml = + """ + ${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_route_prefixes + ${MsoUtils.xmlEscape(interfaceRoutePrefixValues)} + """ + interfaceRoutePrefixes = sbInterfaceRoutePrefixes.append(interfaceRoutePrefixesXml) + } + + NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6") + for(int a = 0; a < networkIpsV6List.getLength(); a++){ + Node ipV6Address = networkIpsV6List.item(a) + if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpV6Address = (Element) ipV6Address + String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6") + if (a != networkIpsV6List.getLength() - 1) { + ipV6AddressValues = sb4.append(ipV6AddressValue + ",") + } + else { + ipV6AddressValues = sb4.append(ipV6AddressValue); + } + networkPosition = a.toString() + String vmNetworksPositionsV6Xml = + """ + ${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_v6_ip_${MsoUtils.xmlEscape(networkPosition)} + ${MsoUtils.xmlEscape(ipV6AddressValue)} + """ + vmNetworksPositionsV6 = sbNetworksPositionsV6.append(vmNetworksPositionsV6Xml) + } + } + String vmNetworksV6Xml = + """ + ${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_v6_ips + ${MsoUtils.xmlEscape(ipV6AddressValues)} + """ + vmNetworks = sbVmNetworks.append(vmNetworksV6Xml) + } + } + String vnfXml = + """ + ${MsoUtils.xmlEscape(key)}_names + ${MsoUtils.xmlEscape(values)} + """ + vnfVMS = sb.append(vnfXml) + } + } + //SDNC Response Params + String sdncResponseParams = "" + List sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"] + String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters") + if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ + // No SDNC params + }else{ + NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters") + for (int z = 0; z < paramsList.getLength(); z++) { + Node node = paramsList.item(z) + Element eElement = (Element) node + String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name") + if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { + String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value") + String paraEntry = + """ + ${MsoUtils.xmlEscape(vnfParameterName)} + ${MsoUtils.xmlEscape(vnfParameterValue)} + """ + sdncResponseParams = sb.append(paraEntry) + } + } + } + + + def vfModuleParams = """ + ${vnfInfo} + ${aZones} + ${vnfNetworkNetId} + ${vnfNetworkNetName} + ${vnfNetworkSubNetId} + ${vnfNetworkV6SubNetId} + ${vnfNetworkNetFqdn} + ${vnfNetworksSriovVlanFilters} + ${vnfVMS} + ${vnfVMSPositions} + ${vmNetworks} + ${vmNetworksPositions} + ${vmNetworksPositionsV6} + ${interfaceRoutePrefixes} + ${vnfParams} + ${sdncResponseParams}""" + + return vfModuleParams + + } + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy new file mode 100644 index 0000000000..6e09837274 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy @@ -0,0 +1,553 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import groovy.json.JsonBuilder +import groovy.json.JsonSlurper + +import org.json.JSONObject +import org.json.XML +import org.onap.so.bpmn.core.xml.XmlTool +import org.onap.so.logger.MsoLogger +import org.onap.so.logger.MessageEnum + + +class VidUtils { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VidUtils.class); + + public MsoUtils utils = new MsoUtils() + private AbstractServiceTaskProcessor taskProcessor + + public VidUtils(AbstractServiceTaskProcessor taskProcessor) { + this.taskProcessor = taskProcessor + } + + /** + * Create a volume-request XML using a JSON string + * @param jsonReq - JSON request from VID + * @param action + * @return + */ + public String createXmlVolumeRequest(String jsonReq, String action, String serviceInstanceId) { + def jsonSlurper = new JsonSlurper() + try{ + Map reqMap = jsonSlurper.parseText(jsonReq) + return createXmlVolumeRequest(reqMap, action, serviceInstanceId) + } + catch(Exception e) { + throw e + } + } + + /** + * Create a volume-request XML using a map + * @param requestMap - map created from VID JSON + * @param action + * @param serviceInstanceId + * @return + */ + public String createXmlVolumeRequest(Map requestMap, String action, String serviceInstanceId) { + createXmlVolumeRequest(requestMap, action, serviceInstanceId, '') + } + + + /** + * Create a volume-request XML using a map + * @param requestMap + * @param action + * @param serviceInstanceId + * @param volumeGroupId + * @return + */ + public String createXmlVolumeRequest(Map requestMap, String action, String serviceInstanceId, String volumeGroupId) { + def vnfType = '' + def serviceName = '' + def modelCustomizationName = '' + def asdcServiceModelVersion = '' + + def suppressRollback = requestMap.requestDetails.requestInfo.suppressRollback + + def backoutOnFailure = "" + if(suppressRollback != null){ + if ( suppressRollback == true) { + backoutOnFailure = "false" + } else if ( suppressRollback == false) { + backoutOnFailure = "true" + } + } + + def volGrpName = requestMap.requestDetails.requestInfo?.instanceName ?: '' + def serviceId = requestMap.requestDetails.requestParameters?.serviceId ?: '' + def relatedInstanceList = requestMap.requestDetails.relatedInstanceList + relatedInstanceList.each { + if (it.relatedInstance.modelInfo?.modelType == 'service') { + serviceName = it.relatedInstance.modelInfo?.modelName + asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion + } + if (it.relatedInstance.modelInfo?.modelType == 'vnf') { + modelCustomizationName = it.relatedInstance.modelInfo?.modelInstanceName + } + } + + vnfType = serviceName + '/' + modelCustomizationName + + def userParams = requestMap.requestDetails?.requestParameters?.userParams + def userParamsNode = '' + if(userParams != null) { + userParamsNode = buildUserParams(userParams) + } + def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: '' + + def xmlReq = """ + + + ${MsoUtils.xmlEscape(action)} + ${MsoUtils.xmlEscape(requestMap.requestDetails.requestInfo.source)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + + + ${MsoUtils.xmlEscape(volumeGroupId)} + ${MsoUtils.xmlEscape(volGrpName)} + ${MsoUtils.xmlEscape(vnfType)} + ${MsoUtils.xmlEscape(requestMap.requestDetails.modelInfo.modelName)} + ${MsoUtils.xmlEscape(asdcServiceModelVersion)} + ${MsoUtils.xmlEscape(requestMap.requestDetails.cloudConfiguration.lcpCloudRegionId)} + ${MsoUtils.xmlEscape(requestMap.requestDetails.cloudConfiguration.tenantId)} + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(backoutOnFailure)} + ${MsoUtils.xmlEscape(modelCustomizationId)} + + + $userParamsNode + + + """ + // return a pretty-print of the volume-request xml without the preamble + return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") + } + + /** + * A common method that can be used to build volume-params node from a map. + * @param Map userParams + * @return + */ + public String buildUserParams(userParams) { + if (userParams == null) return "" + def xml = "" + def key = "" + def value = "" + userParams.each {it -> + key = it.name.replaceAll(/\B[A-Z]/) { '_' + it }.toLowerCase() + value = it.value + xml += "${MsoUtils.xmlEscape(value)}" + } + + return xml + } + + /** + * A common method that can be used to extract 'requestDetails' + * @param String json + * @return String json requestDetails + */ + @Deprecated + public getJsonRequestDetails(String jsonInput) { + String rtn = "" + if (jsonInput.isEmpty() || jsonInput == null) { + return rtn + } else { + def jsonMapObject = new JsonSlurper().parseText(jsonInput) + if (jsonMapObject instanceof Map) { + String jsonString = new JsonBuilder(jsonMapObject.requestDetails) + rtn = '{'+"requestDetails"+":"+jsonString+'}' + return rtn + } else { + return rtn + } + } + } + + /** + * A common method that can be used to extract 'requestDetails' in Xml + * @param String json + * @return String xml requestDetails + */ + @Deprecated + public getJsonRequestDetailstoXml(String jsonInput) { + String rtn = null + def jsonString = getJsonRequestDetails(jsonInput) + if (jsonString == null) { + return rtn + } else { + JSONObject jsonObj = new JSONObject(jsonString) + return XmlTool.normalize(XML.toString(jsonObj)) + } + } + + /** + * Create a network-request XML using a map + * @param execution + * @param xmlRequestDetails - requestDetails in xml + * @return + * Note: See latest version: createXmlNetworkRequestInstance() + */ + + public String createXmlNetworkRequestInfra(execution, def networkJsonIncoming) { + + def requestId = execution.getVariable("requestId") + def serviceInstanceId = execution.getVariable("serviceInstanceId") + def requestAction = execution.getVariable("requestAction") + def networkId = (execution.getVariable("networkId")) != null ? execution.getVariable("networkId") : "" + + def jsonSlurper = new JsonSlurper() + try { + Map reqMap = jsonSlurper.parseText(networkJsonIncoming) + def instanceName = reqMap.requestDetails.requestInfo.instanceName + def modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationId + if (modelCustomizationId == null) { + modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationUuid !=null ? + reqMap.requestDetails.modelInfo.modelCustomizationUuid : "" + } + def modelName = reqMap.requestDetails.modelInfo.modelName + def lcpCloudRegionId = reqMap.requestDetails.cloudConfiguration.lcpCloudRegionId + def tenantId = reqMap.requestDetails.cloudConfiguration.tenantId + def serviceId = reqMap.requestDetails.requestInfo.productFamilyId + def suppressRollback = reqMap.requestDetails.requestInfo.suppressRollback.toString() + def backoutOnFailure = "true" + if(suppressRollback != null){ + if (suppressRollback == true || suppressRollback == "true") { + backoutOnFailure = "false" + } else if (suppressRollback == false || suppressRollback == "false") { + backoutOnFailure = "true" + } + } + + //def userParams = reqMap.requestDetails.requestParameters.userParams + //def userParamsNode = buildUserParams(userParams) + def userParams = reqMap.requestDetails?.requestParameters?.userParams + def userParamsNode = '' + if(userParams != null) { + userParamsNode = buildUserParams(userParams) + } + + //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC) + def sdncVersion = execution.getVariable("sdncVersion") + + def xmlReq = """ + + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(requestAction)} + VID + ${MsoUtils.xmlEscape(serviceInstanceId)} + + + ${MsoUtils.xmlEscape(networkId)} + ${MsoUtils.xmlEscape(instanceName)} + ${MsoUtils.xmlEscape(modelName)} + ${MsoUtils.xmlEscape(modelCustomizationId)} + ${MsoUtils.xmlEscape(lcpCloudRegionId)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(backoutOnFailure)} + ${MsoUtils.xmlEscape(sdncVersion)} + + + ${userParamsNode} + + + """ + // return a pretty-print of the volume-request xml without the preamble + return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") + + } catch(Exception e) { + msoLogger.debug("Error in Vid Utils",e.getCause()) + e.printStackTrace(); + throw e + } + } + + /** + * Create a network-request XML using a map, + * @param execution + * @return + */ + public String createXmlNetworkRequestInstance(execution) { + + def networkModelUuid = "" + def networkModelName = "" + def networkModelVersion = "" + def networkModelCustomizationUuid = "" + def networkModelInvariantUuid = "" + + // verify the DB Catalog response JSON structure + def networkModelInfo = execution.getVariable("networkModelInfo") + def jsonSlurper = new JsonSlurper() + if (networkModelInfo != null) { + try { + Map modelMap = jsonSlurper.parseText(networkModelInfo) + if (modelMap != null) { + if (networkModelInfo.contains("modelUuid")) { + networkModelUuid = modelMap.modelUuid !=null ? modelMap.modelUuid : "" + } + if (networkModelInfo.contains("modelName")) { + networkModelName = modelMap.modelName !=null ? modelMap.modelName : "" + } + if (networkModelInfo.contains("modelVersion")) { + networkModelVersion = modelMap.modelVersion !=null ? modelMap.modelVersion : "" + } + if (networkModelInfo.contains("modelCustomizationUuid")) { + networkModelCustomizationUuid = modelMap.modelCustomizationUuid !=null ? modelMap.modelCustomizationUuid : "" + } + if (networkModelInfo.contains("modelInvariantUuid")) { + networkModelInvariantUuid = modelMap.modelInvariantUuid !=null ? modelMap.modelInvariantUuid : "" + } + } + } catch (Exception ex) { + throw ex + } + } + + def serviceModelUuid = "" + def serviceModelName = "" + def serviceModelVersion = "" + def serviceModelCustomizationUuid = "" + def serviceModelInvariantUuid = "" + + // verify the DB Catalog response JSON structure + def serviceModelInfo = execution.getVariable("serviceModelInfo") + def jsonServiceSlurper = new JsonSlurper() + if (serviceModelInfo != null) { + try { + Map modelMap = jsonServiceSlurper.parseText(serviceModelInfo) + if (modelMap != null) { + if (serviceModelInfo.contains("modelUuid")) { + serviceModelUuid = modelMap.modelUuid !=null ? modelMap.modelUuid : "" + } + if (serviceModelInfo.contains("modelName")) { + serviceModelName = modelMap.modelName !=null ? modelMap.modelName : "" + } + if (serviceModelInfo.contains("modelVersion")) { + serviceModelVersion = modelMap.modelVersion !=null ? modelMap.modelVersion : "" + } + if (serviceModelInfo.contains("modelCustomizationUuid")) { + serviceModelCustomizationUuid = modelMap.modelCustomizationUuid !=null ? modelMap.modelCustomizationUuid : "" + } + if (serviceModelInfo.contains("modelInvariantUuid")) { + serviceModelInvariantUuid = modelMap.modelInvariantUuid !=null ? modelMap.modelInvariantUuid : "" + } + } + } catch (Exception ex) { + throw ex + } + } + + + def subscriptionServiceType = execution.getVariable("subscriptionServiceType") != null ? execution.getVariable("subscriptionServiceType") : "" + def globalSubscriberId = execution.getVariable("globalSubscriberId") != null ? execution.getVariable("globalSubscriberId") : "" + def requestId = execution.getVariable("msoRequestId") + def serviceInstanceId = execution.getVariable("serviceInstanceId") != null ? execution.getVariable("serviceInstanceId") : "" + def networkId = (execution.getVariable("networkId")) != null ? execution.getVariable("networkId") : "" // optional + def networkName = execution.getVariable("networkName") != null ? execution.getVariable("networkName") : "" // optional + def aicCloudReqion = execution.getVariable("lcpCloudRegionId") != null ? execution.getVariable("lcpCloudRegionId") : "" + def tenantId = execution.getVariable("tenantId") != null ? execution.getVariable("tenantId") : "" + def serviceId = execution.getVariable("productFamilyId") != null ? execution.getVariable("productFamilyId") : "" + def failIfExist = execution.getVariable("failIfExists") != null ? execution.getVariable("failIfExists") : "" + def suppressRollback = execution.getVariable("disableRollback") + def backoutOnFailure = "true" + if(suppressRollback != null){ + if (suppressRollback == true || suppressRollback == "true") { + backoutOnFailure = "false" + } else if (suppressRollback == false || suppressRollback == "false") { + backoutOnFailure = "true" + } + } + + //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC) + def sdncVersion = execution.getVariable("sdncVersion") + + def source = "VID" + def action = execution.getVariable("action") + + def userParamsNode = "" + def userParams = execution.getVariable("networkInputParams") + if(userParams != null) { + userParamsNode = buildUserParams(userParams) + } + + def xmlReq = """ + + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(action)} + ${MsoUtils.xmlEscape(source)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + + + ${MsoUtils.xmlEscape(networkId)} + ${MsoUtils.xmlEscape(networkName)} + ${MsoUtils.xmlEscape(networkModelName)} + ${MsoUtils.xmlEscape(subscriptionServiceType)} + ${MsoUtils.xmlEscape(globalSubscriberId)} + ${MsoUtils.xmlEscape(aicCloudReqion)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(backoutOnFailure)} + ${MsoUtils.xmlEscape(failIfExist)} + + ${MsoUtils.xmlEscape(networkModelName)} + ${MsoUtils.xmlEscape(networkModelUuid)} + ${MsoUtils.xmlEscape(networkModelInvariantUuid)} + ${MsoUtils.xmlEscape(networkModelVersion)} + ${MsoUtils.xmlEscape(networkModelCustomizationUuid)} + + + ${MsoUtils.xmlEscape(serviceModelName)} + ${MsoUtils.xmlEscape(serviceModelUuid)} + ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} + ${MsoUtils.xmlEscape(serviceModelVersion)} + ${MsoUtils.xmlEscape(serviceModelCustomizationUuid)} + + + ${MsoUtils.xmlEscape(sdncVersion)} + + + ${userParamsNode} + + + """ + // return a pretty-print of the volume-request xml without the preamble + return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") + + } + + /** + * Create a vnf-request XML using a map + * @param requestMap - map created from VID JSON + * @param action + * @return + */ + public String createXmlVfModuleRequest(execution, Map requestMap, String action, String serviceInstanceId) { + + //def relatedInstanceList = requestMap.requestDetails.relatedInstanceList + + //relatedInstanceList.each { + // if (it.relatedInstance.modelInfo.modelType == 'vnf') { + // vnfType = it.relatedInstance.modelInfo.modelName + // vnfId = it.relatedInstance.modelInfo.modelInvariantId + // } + //} + + def vnfName = '' + def asdcServiceModelInfo = '' + + def relatedInstanceList = requestMap.requestDetails?.relatedInstanceList + + + if (relatedInstanceList != null) { + relatedInstanceList.each { + if (it.relatedInstance.modelInfo?.modelType == 'service') { + asdcServiceModelInfo = it.relatedInstance.modelInfo?.modelVersion + } + if (it.relatedInstance.modelInfo.modelType == 'vnf') { + vnfName = it.relatedInstance.instanceName ?: '' + } + } + } + + def vnfType = execution.getVariable('vnfType') + def vnfId = execution.getVariable('vnfId') + + def vfModuleId = execution.getVariable('vfModuleId') + def volumeGroupId = execution.getVariable('volumeGroupId') + def userParams = requestMap.requestDetails?.requestParameters?.userParams + + + def userParamsNode = '' + if(userParams != null) { + userParamsNode = buildUserParams(userParams) + } + + def isBaseVfModule = "false" + if (execution.getVariable('isBaseVfModule') == true) { + isBaseVfModule = "true" + } + + def requestId = execution.getVariable("mso-request-id") + def vfModuleName = requestMap.requestDetails?.requestInfo?.instanceName ?: '' + def vfModuleModelName = requestMap.requestDetails?.modelInfo?.modelName ?: '' + def suppressRollback = requestMap.requestDetails?.requestInfo?.suppressRollback + + def backoutOnFailure = "" + if(suppressRollback != null){ + if ( suppressRollback == true) { + backoutOnFailure = "false" + } else if ( suppressRollback == false) { + backoutOnFailure = "true" + } + } + + def serviceId = requestMap.requestDetails?.requestParameters?.serviceId ?: '' + def aicCloudRegion = requestMap.requestDetails?.cloudConfiguration?.lcpCloudRegionId ?: '' + def tenantId = requestMap.requestDetails?.cloudConfiguration?.tenantId ?: '' + def personaModelId = requestMap.requestDetails?.modelInfo?.modelInvariantUuid ?: '' + def personaModelVersion = requestMap.requestDetails?.modelInfo?.modelUuid ?: '' + def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: '' + + def xmlReq = """ + + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(action)} + VID + ${MsoUtils.xmlEscape(serviceInstanceId)} + + + + ${MsoUtils.xmlEscape(vnfName)} + ${MsoUtils.xmlEscape(vnfType)} + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(volumeGroupId)} + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(vfModuleName)} + ${MsoUtils.xmlEscape(vfModuleModelName)} + ${MsoUtils.xmlEscape(modelCustomizationId)} + ${MsoUtils.xmlEscape(isBaseVfModule)} + ${MsoUtils.xmlEscape(asdcServiceModelInfo)} + ${MsoUtils.xmlEscape(aicCloudRegion)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(backoutOnFailure)} + ${MsoUtils.xmlEscape(personaModelId)} + ${MsoUtils.xmlEscape(personaModelVersion)} + + + $userParamsNode + + + """ + + // return a pretty-print of the volume-request xml without the preamble + return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy new file mode 100644 index 0000000000..52f45c205c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy @@ -0,0 +1,419 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.rest.APIResponse +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterRestV1.class); + + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + // VNF Response Processing + public void preProcessRequest (DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + def prefix="VNFREST_" + execution.setVariable("prefix", prefix) + setSuccessIndicator(execution, false) + + try { + String request = validateRequest(execution, "mso-request-id") + + // Get the request type (the name of the root element) from the request + + Node root = new XmlParser().parseText(request) + String requestType = root.name() + execution.setVariable(prefix + 'requestType', requestType) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType) + + msoLogger.debug('VnfAdapterRestV1, request: ' + request) + // Get the messageId from the request + + String messageId = getChildText(root, 'messageId') + + if ('rollbackVolumeGroupRequest'.equals(requestType)) { + messageId = getMessageIdForVolumeGroupRollback(root) + } + + if (messageId == null || messageId.isEmpty()) { + String msg = getProcessKey(execution) + ': no messageId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + execution.setVariable('VNFAResponse_CORRELATOR', messageId) + msoLogger.debug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId) + + // Get the notificationUrl from the request + + String notificationUrl = getChildText(root, 'notificationUrl') + + if (notificationUrl == null || notificationUrl.isEmpty()) { + String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + execution.setVariable(prefix + 'notificationUrl', notificationUrl) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl) + + // Determine the VnfAdapter endpoint + + String vnfAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.vnf.rest.endpoint", execution) + + if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) { + String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined' + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + while (vnfAdapterEndpoint.endsWith('/')) { + vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, vnfAdapterEndpoint.length()-1) + } + + String vnfAdapterMethod = null + String vnfAdapterUrl = null + String vnfAdapterRequest = request + + if ('createVfModuleRequest'.equals(requestType)) { + String vnfId = getChildText(root, 'vnfId') + + if (vnfId == null || vnfId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vnfId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + vnfAdapterMethod = 'POST' + vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + '/vf-modules' + + } else if ('updateVfModuleRequest'.equals(requestType)) { + String vnfId = getChildText(root, 'vnfId') + + if (vnfId == null || vnfId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vnfId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + String vfModuleId = getChildText(root, 'vfModuleId') + + if (vfModuleId == null || vfModuleId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + vnfAdapterMethod = 'PUT' + vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + + '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + + } else if ('deleteVfModuleRequest'.equals(requestType)) { + String vnfId = getChildText(root, 'vnfId') + + if (vnfId == null || vnfId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vnfId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + String vfModuleId = getChildText(root, 'vfModuleId') + + if (vfModuleId == null || vfModuleId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + vnfAdapterMethod = 'DELETE' + vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + + '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + + } else if ('rollbackVfModuleRequest'.equals(requestType)) { + Node vfModuleRollbackNode = getChild(root, 'vfModuleRollback') + + if (vfModuleRollbackNode == null) { + String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + String vnfId = getChildText(vfModuleRollbackNode, 'vnfId') + + if (vnfId == null || vnfId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vnfId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId') + + if (vfModuleId == null || vfModuleId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + vnfAdapterMethod = 'DELETE' + vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + + '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + '/rollback' + + } else if ('createVolumeGroupRequest'.equals(requestType)) { + vnfAdapterMethod = 'POST' + if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { + vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) + } + vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups' + + } else if ('updateVolumeGroupRequest'.equals(requestType)) { + String volumeGroupId = getChildText(root, 'volumeGroupId') + + if (volumeGroupId == null || volumeGroupId.isEmpty()) { + String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + vnfAdapterMethod = 'PUT' + if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { + vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) + } + vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + + } else if ('deleteVolumeGroupRequest'.equals(requestType)) { + String volumeGroupId = getChildText(root, 'volumeGroupId') + + if (volumeGroupId == null || volumeGroupId.isEmpty()) { + String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + vnfAdapterMethod = 'DELETE' + if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { + vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) + } + vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + + } else if ('rollbackVolumeGroupRequest'.equals(requestType)) { + String volumeGroupId = getVolumeGroupIdFromRollbackRequest(root) + + if (volumeGroupId == null || volumeGroupId.isEmpty()) { + String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + vnfAdapterMethod = 'DELETE' + if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { + vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) + } + vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + '/rollback' + + } else { + String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod) + execution.setVariable(prefix + 'vnfAdapterUrl', vnfAdapterUrl) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl) + execution.setVariable(prefix + 'vnfAdapterRequest', vnfAdapterRequest) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest) + + // Get the Basic Auth credentials for the VnfAdapter + + String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) + + if (basicAuthValue == null || basicAuthValue.isEmpty()) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + } else { + try { + def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) + } catch (IOException ex) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + } + } + + } catch (BpmnError e) { + msoLogger.debug(" Rethrowing MSOWorkflowException") + throw e + } catch (Exception e) { + String msg = 'Caught exception in ' + method + ": " + e + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } + + public String getVolumeGroupIdFromRollbackRequest(Node root) { + return root.'volumeGroupRollback'.'volumeGroupId'.text() + } + + public String getMessageIdForVolumeGroupRollback(Node root) { + return root.'volumeGroupRollback'.'messageId'.text() + } + + /** + * This method is used instead of an HTTP Connector task because the + * connector does not allow DELETE with a body. + */ + public void sendRequestToVnfAdapter(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + String prefix = execution.getVariable('prefix') + + try { + String vnfAdapterMethod = execution.getVariable(prefix + 'vnfAdapterMethod') + String vnfAdapterUrl = execution.getVariable(prefix + 'vnfAdapterUrl') + String vnfAdapterRequest = execution.getVariable(prefix + 'vnfAdapterRequest') + + RESTConfig config = new RESTConfig(vnfAdapterUrl) + RESTClient client = new RESTClient(config). + addHeader("Content-Type", "application/xml"). + addAuthorizationHeader(execution.getVariable(prefix + "basicAuthHeaderValue")); + + APIResponse response; + + if ("GET".equals(vnfAdapterMethod)) { + response = client.httpGet() + } else if ("PUT".equals(vnfAdapterMethod)) { + response = client.httpPut(vnfAdapterRequest) + } else if ("POST".equals(vnfAdapterMethod)) { + response = client.httpPost(vnfAdapterRequest) + } else if ("DELETE".equals(vnfAdapterMethod)) { + response = client.httpDelete(vnfAdapterRequest) + } else { + String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatusCode()) + execution.setVariable(prefix + "vnfAdapterResponse", response.getResponseBodyAsString()) + } catch (BpmnError e) { + throw e + } catch (Exception e) { + String msg = 'Caught exception in ' + method + ": " + e + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } + + public void processCallback(DelegateExecution execution){ + def method = getClass().getSimpleName() + '.processCallback(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + String callback = execution.getVariable('VNFAResponse_MESSAGE') + + try { + msoLogger.debug(getProcessKey(execution) + ": received callback:\n" + callback) + + // The XML callback is available to the calling flow in any case, + // even if a WorkflowException is generated. + execution.setVariable(getProcessKey(execution) + 'Response', callback) + // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead. + execution.setVariable("WorkflowResponse", callback) + + Node root = new XmlParser().parseText(callback) + if (root.name().endsWith('Exception')) { + vnfAdapterWorkflowException(execution, callback) + } + } catch (Exception e) { + e.printStackTrace() + callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback + String msg = "Received error from VnfAdapter: " + callback + msoLogger.debug(getProcessKey(execution) + ': ' + msg) + exceptionUtil.buildWorkflowException(execution, 7020, msg) + } + } + + /** + * Tries to parse the response as XML to extract the information to create + * a WorkflowException. If the response cannot be parsed, a more generic + * WorkflowException is created. + */ + public void vnfAdapterWorkflowException(DelegateExecution execution, Object response) { + try { + Node root = new XmlParser().parseText(response) + String category = getChildText(root, "category") + category = category == null || category.isEmpty() ? "" : " category='" + category + "'" + String message = getChildText(root, "message") + message = message == null || message.isEmpty() ? "" : " message='" + message + "'" + String rolledBack = getChildText(root, "rolledBack") + rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'" + exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() + + " from VnfAdapter:" + category + message + rolledBack); + } catch (Exception e) { + response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response + exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response) + } + } + + /** + * Gets the named child of the specified node. + * @param node the node + * @param name the child name + * @return the child node, or null if no such child exists + */ + private Node getChild(Node node, String name) { + for (Node child : node.children()) { + if (child.name() == name) { + return child + } + } + return null + } + + /** + * Gets the text of the named child of the specified node. + * @param node the node + * @param name the child name + * @return the child node text, or null if no such child exists + */ + private String getChildText(Node node, String name) { + Node child = getChild(node, name) + return child == null ? null : child.text() + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy new file mode 100644 index 0000000000..8c979fca0b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy @@ -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.bpmn.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +class VnfAdapterUtils { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterUtils.class); + + + private AbstractServiceTaskProcessor taskProcessor + + public VnfAdapterUtils(AbstractServiceTaskProcessor taskProcessor) { + this.taskProcessor = taskProcessor + } + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void validateVnfResponse(DelegateExecution execution, String responseVar, String responseCodeVar, String errorResponseVar) { + def method = getClass().getSimpleName() + '.validateVnfResponse(' + + 'execution=' + execution.getId() + + ', responseVar=' + responseVar + + ', responseCodeVar=' + responseCodeVar + + ', errorResponseVar=' + errorResponseVar + + ')' + msoLogger.trace('Entered ' + method) + + try { + def prefix = execution.getVariable('prefix') + + def response = execution.getVariable(responseVar) + def responseCode = execution.getVariable(responseCodeVar) + def errorResponse = execution.getVariable(errorResponseVar) + + // The following if statement never appears to be true as any VNF Adapter error seems to be stored in 'errorResponse'. + // Also, the value is stored as a WorkflowException object, not a String. Added the else if to provide the proper + // functionality but leaving the original code in case it is hit under some circumstances. + if (response.contains("WorkflowException")) { + execution.setVariable(prefix + "ErrorResponse", response) + //execution.setVariable(prefix + "ResponseCode", responseCode) + msoLogger.debug(" Sub Vnf flow Error WorkflowException Response - " + "\n" + response) + throw new BpmnError("MSOWorkflowException") + } else if (errorResponse != null && errorResponse instanceof WorkflowException) { + // Not sure the variables with the associated prefix are still used + execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage()) + execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode()) + msoLogger.debug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + errorResponse.getErrorMessage()) + // this is the important part to ensure we hit the Fallout Handler + throw new BpmnError("MSOWorkflowException") + } else if (errorResponse != null && errorResponse instanceof WorkflowException) { + // Not sure the variables with the associated prefix are still used + execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage()) + execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode()) + msoLogger.debug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + errorResponse.getErrorMessage()) + // this is the important part to ensure we hit the Fallout Handler + throw new BpmnError("MSOWorkflowException") + } + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, 'Internal Error- Unable to validate VNF Response ' + e.getMessage()) + } + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy deleted file mode 100644 index 5a4b25dca9..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy +++ /dev/null @@ -1,667 +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.bpmn.common.scripts -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -class AaiUtil { - - public MsoUtils utils = new MsoUtils() - public static final String AAI_NAMESPACE_STRING_KEY = 'URN_mso_workflow_global_default_aai_namespace' - public static final String DEFAULT_VERSION_KEY = 'URN_mso_workflow_global_default_aai_version' - - private String aaiNamespace = null; - - private AbstractServiceTaskProcessor taskProcessor - - public AaiUtil(AbstractServiceTaskProcessor taskProcessor) { - this.taskProcessor = taskProcessor - } - - public String getNetworkGenericVnfEndpoint(DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - String endpoint = execution.getVariable("URN_aai_endpoint") - def uri = getNetworkGenericVnfUri(execution) - taskProcessor.logDebug('AaiUtil.getNetworkGenericVnfEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled) - return endpoint + uri - } - - public String getNetworkGenericVnfUri(DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - def uri = getUri(execution, 'generic_vnf') - taskProcessor.logDebug('AaiUtil.getNetworkGenericVnfUri() - AAI URI: ' + uri, isDebugLogEnabled) - return uri - } - - public String getNetworkVpnBindingUri(DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - def uri = getUri(execution, 'vpn_binding') - taskProcessor.logDebug('AaiUtil.getNetworkVpnBindingUri() - AAI URI: ' + uri, isDebugLogEnabled) - return uri - } - - public String getNetworkPolicyUri(DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - def uri = getUri(execution, 'network_policy') - taskProcessor.logDebug('AaiUtil.getNetworkPolicyUri() - AAI URI: ' + uri, isDebugLogEnabled) - return uri - } - - public String getNetworkTableReferencesUri(DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - def uri = getUri(execution, 'route_table_reference') - taskProcessor.logDebug('AaiUtil.getNetworkTableReferencesUri() - AAI URI: ' + uri, isDebugLogEnabled) - return uri - } - - public String getNetworkVceUri(DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - def uri = getUri(execution, 'vce') - taskProcessor.logDebug('AaiUtil.getNetworkVceUri() - AAI URI: ' + uri, isDebugLogEnabled) - return uri - } - - public String getNetworkL3NetworkUri(DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - def uri = getUri(execution, 'l3_network') - taskProcessor.logDebug('AaiUtil.getNetworkL3NetworkUri() - AAI URI: ' + uri, isDebugLogEnabled) - return uri - } - - public String getBusinessCustomerUri(DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - def uri = getUri(execution, 'customer') - taskProcessor.logDebug('AaiUtil.getBusinessCustomerUri() - AAI URI: ' + uri, isDebugLogEnabled) - return uri - } - - //public String getBusinessCustomerUriv7(DelegateExecution execution) { - // def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - // //def uri = getUri(execution, BUSINESS_CUSTOMERV7) - // def uri = getUri(execution, 'Customer') - // taskProcessor.logDebug('AaiUtil.getBusinessCustomerUriv7() - AAI URI: ' + uri, isDebugLogEnabled) - // return uri - //} - - public String getCloudInfrastructureCloudRegionEndpoint(DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - String endpoint = execution.getVariable("URN_aai_endpoint") - def uri = getCloudInfrastructureCloudRegionUri(execution) - taskProcessor.logDebug('AaiUtil.getCloudInfrastructureCloudRegionEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled) - return endpoint + uri - } - - public String getCloudInfrastructureCloudRegionUri(DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - def uri = getUri(execution, 'cloud_region') - taskProcessor.logDebug('AaiUtil.getCloudInfrastructureCloudRegionUri() - AAI URI: ' + uri, isDebugLogEnabled) - return uri - } - - public String getCloudInfrastructureTenantUri(DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - def uri = getUri(execution, 'tenant') - taskProcessor.logDebug('AaiUtil.getCloudInfrastructureTenantUri() - AAI URI: ' + uri, isDebugLogEnabled) - return uri - } - - public String getSearchNodesQueryUri(DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - def uri = getUri(execution, 'nodes_query') - taskProcessor.logDebug('AaiUtil.getSearchNodesQueryUri() - AAI URI: ' + uri, isDebugLogEnabled) - return uri - } - - public String getSearchNodesQueryEndpoint(DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - String endpoint = execution.getVariable("URN_aai_endpoint") - def uri = getSearchNodesQueryUri(execution) - taskProcessor.logDebug('AaiUtil.getSearchNodesQueryEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled) - return endpoint + uri - } - - public String getSearchGenericQueryUri(DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - def uri = getUri(execution, 'generic_query') - taskProcessor.logDebug('AaiUtil.getSearchGenericQueryUri() - AAI URI: ' + uri, isDebugLogEnabled) - return uri - } - - public String getVersion(DelegateExecution execution, resourceName, processKey) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - - resourceName = resourceName.replaceAll('-', '_') - - def versionWithResourceKey = "URN_mso_workflow_default_aai_${resourceName}_version" - def versionWithProcessKey = "URN_mso_workflow_custom_${processKey}_aai_version" - - def version = execution.getVariable(versionWithProcessKey) - if (version) { - taskProcessor.logDebug("AaiUtil.getVersion() - using flow specific ${versionWithProcessKey}=${version}", isDebugLogEnabled) - return version - } - - version = execution.getVariable(versionWithResourceKey) - if (version) { - taskProcessor.logDebug("AaiUtil.getVersion() - using resource specific ${versionWithResourceKey}=${version}", isDebugLogEnabled) - return version - } - - version = execution.getVariable(DEFAULT_VERSION_KEY) - if (version) { - taskProcessor.logDebug("AaiUtil.getVersion() - using default version ${DEFAULT_VERSION_KEY}=${version}", isDebugLogEnabled) - return version - } - - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, "Internal Error: One of the following should be defined in MSO URN properties file: ${versionWithResourceKey}, ${versionWithProcessKey}, ${DEFAULT_VERSION_KEY}") - } - - public String getUri(DelegateExecution execution, resourceName) { - - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - def processKey = taskProcessor.getMainProcessKey(execution) - resourceName = resourceName.replaceAll('-', '_') - - //set namespace - setNamespace(execution) - - // Check for flow+resource specific first - def key = "URN_mso_workflow_${processKey}_aai_${resourceName}_uri" - def uri = execution.getVariable(key) - if(uri) { - taskProcessor.logDebug("AaiUtil.getUri() - using flow+resource specific key: ${key}=${uri}", isDebugLogEnabled) - return uri - } - - // Check for versioned key - def version = getVersion(execution, resourceName, processKey) - key = "URN_mso_workflow_default_aai_v${version}_${resourceName}_uri" - uri = execution.getVariable(key) - - if(uri) { - taskProcessor.logDebug("AaiUtil.getUri() - using versioned URI key: ${key}=${uri}", isDebugLogEnabled) - return uri - } - - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + key + ' not defined in the MSO URN properties file') - } - - public String setNamespace(DelegateExecution execution) { - def key = AAI_NAMESPACE_STRING_KEY - aaiNamespace = execution.getVariable(key) - if (aaiNamespace == null ) { - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + key + ' not defined in the MSO URN properties file') - } - } - - /** - * This method can be used for getting the building namespace out of uri. - * NOTE: A getUri() method needs to be invoked first. - * Alternative method is the getNamespaceFromUri(DelegateExecution execution, String uri) - * return namespace (plus version from uri) - * - * @param url - * - * @return namespace - */ - - public String getNamespaceFromUri(String uri) { - if (aaiNamespace == null) { - throw new Exception('Internal Error: AAI Namespace has not been set yet. A getUri() method needs to be invoked first.') - } - String namespace = aaiNamespace - if(uri!=null){ - String version = getVersionFromUri(uri) - return namespace + "v"+version - }else{ - return namespace - } - } - - /** - * This method can be used for building namespace with aai version out of uri. - * NOTE: 2 arguments: DelegateExecution execution & String uri - * @param execution - * @param url - * - * @return namespace - */ - public String getNamespaceFromUri(DelegateExecution execution, String uri) { - String namespace = execution.getVariable(AAI_NAMESPACE_STRING_KEY) - if (namespace == null ) { - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + AAI_NAMESPACE_STRING_KEY + ' not defined in the MSO URN properties file') - } - if(uri!=null){ - String version = getVersionFromUri(uri) - return namespace + "v"+version - }else{ - return namespace - } - } - - /** - * This is used to extract the version from uri. - * - * @param uri - * - * @return version - */ - private String getVersionFromUri(String uri) { - def version = "" - def savedVersion = "" - for (int x=2; x<6; x++) { - version = uri.substring(uri.indexOf("v")+1, uri.indexOf("v")+x) - if (!Character.isDigit(version.charAt(version.size()-1))) { - break - } - savedVersion = version - } - return savedVersion - } - - - /** - * This reusable method can be used for making AAI Get Calls. The url should - * be passed as a parameter along with the execution. The method will - * return an APIResponse. - * - * @param execution - * @param url - * - * @return APIResponse - * - */ - public APIResponse executeAAIGetCall(DelegateExecution execution, String url){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - taskProcessor.logDebug(" ======== STARTED Execute AAI Get Process ======== ", isDebugEnabled) - APIResponse apiResponse = null - try{ - String uuid = utils.getRequestID() - taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled) - taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml"); - - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - apiResponse = client.get() - - taskProcessor.logDebug( "======== COMPLETED Execute AAI Get Process ======== ", isDebugEnabled) - }catch(Exception e){ - taskProcessor.logDebug("Exception occured while executing AAI Get Call. Exception is: \n" + e, isDebugEnabled) - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) - } - return apiResponse - } - - - /** - * This reusable method can be used for making AAI httpPut Calls. The url should - * be passed as a parameter along with the execution and payload. The method will - * return an APIResponse. - * - * @param execution - * @param url - * @param payload - * - * @return APIResponse - * - */ - public APIResponse executeAAIPutCall(DelegateExecution execution, String url, String payload){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - taskProcessor.logDebug( " ======== Started Execute AAI Put Process ======== ", isDebugEnabled) - APIResponse apiResponse = null - try{ - String uuid = utils.getRequestID() - taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled) - taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - apiResponse = client.httpPut(payload) - - taskProcessor.logDebug( "======== Completed Execute AAI Put Process ======== ", isDebugEnabled) - }catch(Exception e){ - taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Put Call. Exception is: \n" + e, isDebugEnabled) - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) - } - return apiResponse - } - - /** - * This reusable method can be used for making AAI httpPatch Calls. The url should - * be passed as a parameter along with the execution and payload. The method will - * return an APIResponse. - * - * @param execution - * @param url - * @param payload - * - * @return APIResponse - * - */ - public APIResponse executeAAIPatchCall(DelegateExecution execution, String url, String payload){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - taskProcessor.logDebug( " ======== Started Execute AAI Patch Process ======== ", isDebugEnabled) - APIResponse apiResponse = null - try{ - String uuid = utils.getRequestID() - taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled) - - taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/merge-patch+json").addHeader("Accept","application/json"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - apiResponse = client.httpPatch(payload) - - taskProcessor.logDebug( "======== Completed Execute AAI Patch Process ======== ", isDebugEnabled) - }catch(Exception e){ - taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Patch Call. Exception is: \n" + e, isDebugEnabled) - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) - } - return apiResponse - } - - - /** - * This reusable method can be used for making AAI Delete Calls. The url should - * be passed as a parameter along with the execution. The method will - * return an APIResponse. - * - * @param execution - * @param url - * - * @return APIResponse - * - */ - public APIResponse executeAAIDeleteCall(DelegateExecution execution, String url){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled) - APIResponse apiResponse = null - try{ - String uuid = utils.getRequestID() - taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled) - taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - apiResponse = client.delete() - - taskProcessor.logDebug( "======== Completed Execute AAI Delete Process ======== ", isDebugEnabled) - }catch(Exception e){ - taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Delete Call. Exception is: \n" + e, isDebugEnabled) - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) - } - return apiResponse - } - - /** - * This reusable method can be used for making AAI Delete Calls. The url should - * be passed as a parameter along with the execution. The method will - * return an APIResponse. - * - * @param execution - * @param url - * @param payload - * - * @return APIResponse - * - */ - public APIResponse executeAAIDeleteCall(DelegateExecution execution, String url, String payload, String authHeader){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled) - APIResponse apiResponse = null - try{ - String uuid = utils.getRequestID() - taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled) - - taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml").addAuthorizationHeader(authHeader); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - apiResponse = client.httpDelete(payload) - - taskProcessor.logDebug( "======== Completed Execute AAI Delete Process ======== ", isDebugEnabled) - }catch(Exception e){ - taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Delete Call. Exception is: \n" + e, isDebugEnabled) - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) - } - return apiResponse - } - - /** - * This reusable method can be used for making AAI Post Calls. The url - * and payload should be passed as a parameters along with the execution. - * The method will return an APIResponse. - * - * @param execution - * @param url - * @param payload - * - * @return APIResponse - * - */ - public APIResponse executeAAIPostCall(DelegateExecution execution, String url, String payload){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - taskProcessor.logDebug( " ======== Started Execute AAI Post Process ======== ", isDebugEnabled) - APIResponse apiResponse = null - try{ - String uuid = utils.getRequestID() - taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled) - taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml"); - - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - apiResponse = client.httpPost(payload) - - taskProcessor.logDebug( "======== Completed Execute AAI Post Process ======== ", isDebugEnabled) - }catch(Exception e){ - taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Post Call. Exception is: \n" + e, isDebugEnabled) - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) - } - return apiResponse - } - - /** - * This reusable method can be used for making AAI Post Calls. The url - * and payload should be passed as a parameters along with the execution. - * The method will return an APIResponse. - * - * @param execution - * @param url - * @param payload - * @param authenticationHeader - addAuthenticationHeader value - * @param headerName - name of header you want to add, i.e. addHeader(headerName, headerValue) - * @param headerValue - the header's value, i.e. addHeader(headerName, headerValue) - * - * @return APIResponse - * - */ - public APIResponse executeAAIPostCall(DelegateExecution execution, String url, String payload, String authenticationHeaderValue, String headerName, String headerValue){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - taskProcessor.logDebug( " ======== Started Execute AAI Post Process ======== ", isDebugEnabled) - APIResponse apiResponse = null - try{ - taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addAuthorizationHeader(authenticationHeaderValue).addHeader(headerName, headerValue) - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - apiResponse = client.httpPost(payload) - - taskProcessor.logDebug( "======== Completed Execute AAI Post Process ======== ", isDebugEnabled) - }catch(Exception e){ - taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Post Call. Exception is: \n" + e, isDebugEnabled) - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) - } - return apiResponse - } - - - /* Utility to get the Cloud Region from AAI - * Returns String cloud region id, (ie, cloud-region-id) - * @param execution - * @param url - url for AAI get cloud region - * @param backend - "PO" - real region, or "SDNC" - v2.5 (fake region). - */ - - public String getAAICloudReqion(DelegateExecution execution, String url, String backend, inputCloudRegion){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - String regionId = "" - try{ - APIResponse apiResponse = executeAAIGetCall(execution, url) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() - taskProcessor.utils.log("DEBUG", "Call AAI Cloud Region Return code: " + returnCode, isDebugEnabled) - execution.setVariable(execution.getVariable("prefix")+"queryCloudRegionReturnCode", returnCode) - - if(returnCode == "200"){ - taskProcessor.utils.log("DEBUG", "Call AAI Cloud Region is Successful.", isDebugEnabled) - - String regionVersion = taskProcessor.utils.getNodeText1(aaiResponseAsString, "cloud-region-version") - taskProcessor.utils.log("DEBUG", "Cloud Region Version from AAI for " + backend + " is: " + regionVersion, isDebugEnabled) - if (backend == "PO") { - regionId = taskProcessor.utils.getNodeText1(aaiResponseAsString, "cloud-region-id") - } else { // backend not "PO" - if (regionVersion == "2.5" ) { - regionId = "AAIAIC25" - } else { - regionId = taskProcessor.utils.getNodeText1(aaiResponseAsString, "cloud-region-id") - } - } - if(regionId == null){ - throw new BpmnError("MSOWorkflowException") - } - taskProcessor.utils.log("DEBUG", "Cloud Region Id from AAI " + backend + " is: " + regionId, isDebugEnabled) - }else if (returnCode == "404"){ // not 200 - if (backend == "PO") { - regionId = inputCloudRegion - }else{ // backend not "PO" - regionId = "AAIAIC25" - } - taskProcessor.utils.log("DEBUG", "Cloud Region value for code='404' of " + backend + " is: " + regionId, isDebugEnabled) - }else{ - taskProcessor.utils.log("ERROR", "Call AAI Cloud Region is NOT Successful.", isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - }catch(Exception e) { - taskProcessor.utils.log("ERROR", "Exception occured while getting the Cloud Reqion. Exception is: \n" + e, isDebugEnabled) - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) - } - return regionId - } - - /* returns xml Node with service-type of searchValue */ - def searchServiceType(xmlInput, searchValue){ - def fxml= new XmlSlurper().parseText(xmlInput) - def ret = fxml.'**'.find {it.'service-type' == searchValue} - return ret - } - - /* returns xml Node with service-instance-id of searchValue */ - def searchServiceInstanceId(xmlInput, searchValue){ - def ret = xmlInput.'**'.find {it.'service-instance-id' == searchValue} - return ret - } - - /** - * Get the lowest unused VF Module index from AAI response for a given module type. The criteria for - * determining module type is specified by "key" parameter (for example, "persona-model-id"), - * the value for filtering is specified in "value" parameter - * - * @param execution - * @param aaiVnfResponse - * @param key - * @param value - * - * @return moduleIndex - * - */ - public int getLowestUnusedVfModuleIndexFromAAIVnfResponse(DelegateExecution execution, String aaiVnfResponse, String key, String value) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - if (aaiVnfResponse != null) { - String vfModulesText = taskProcessor.utils.getNodeXml(aaiVnfResponse, "vf-modules") - if (vfModulesText == null || vfModulesText.isEmpty()) { - taskProcessor.utils.log("DEBUG", "There are no VF modules in this VNF yet", isDebugEnabled) - return 0 - } - else { - def xmlVfModules= new XmlSlurper().parseText(vfModulesText) - def vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} - int vfModulesSize = 0 - if (vfModules != null) { - vfModulesSize = vfModules.size() - } - String matchingVfModules = "" - for (i in 0..vfModulesSize-1) { - def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i]) - def keyFromAAI = taskProcessor.utils.getNodeText(vfModuleXml, key) - if (keyFromAAI != null && keyFromAAI.equals(value)) { - matchingVfModules = matchingVfModules + taskProcessor.utils.removeXmlPreamble(vfModuleXml) - } - } - matchingVfModules = matchingVfModules + "" - taskProcessor.utils.log("DEBUG", "Matching VF Modules: " + matchingVfModules, isDebugEnabled) - String lowestUnusedIndex = taskProcessor.utils.getLowestUnusedIndex(matchingVfModules) - return Integer.parseInt(lowestUnusedIndex) - } - } - else { - return 0 - } - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy deleted file mode 100644 index d3f3696fcf..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy +++ /dev/null @@ -1,787 +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.bpmn.common.scripts; - -import groovy.json.JsonSlurper - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.camunda.bpm.engine.variable.VariableMap -import org.camunda.bpm.engine.variable.Variables -import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats -import org.camunda.bpm.engine.variable.impl.value.ObjectValueImpl -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowCallbackResponse -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowContextHolder -import org.openecomp.mso.bpmn.core.WorkflowException -import org.springframework.web.util.UriUtils - -public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcessor { - public MsoUtils utils = new MsoUtils() - - - /** - * Logs a message at the ERROR level. - * @param message the message - */ - public void logError(String message) { - log('ERROR', message, null, "true") - } - - /** - * Logs a message at the ERROR level. - * @param message the message - * @param cause the cause (stracktrace will be included in the output) - */ - public void logError(String message, Throwable cause) { - log('ERROR', message, cause, "true") - } - - /** - * Logs a message at the WARN level. - * @param message the message - */ - public void logWarn(String message) { - log('WARN', message, null, "true") - } - - /** - * Logs a message at the WARN level. - * @param message the message - * @param cause the cause (stracktrace will be included in the output) - */ - public void logWarn(String message, Throwable cause) { - log('WARN', message, cause, "true") - } - - /** - * Logs a message at the DEBUG level. - * @param message the message - * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled - */ - public void logDebug(String message, String isDebugLogEnabled) { - log('DEBUG', message, null, isDebugLogEnabled) - } - - /** - * Logs a message at the DEBUG level. - * @param message the message - * @param cause the cause (stracktrace will be included in the output) - * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled - */ - public void logDebug(String message, Throwable cause, String isDebugLogEnabled) { - log('DEBUG', message, cause, isDebugLogEnabled) - } - - /** - * Logs a message at the specified level. - * @param level the level (DEBUG, INFO, WARN, ERROR) - * @param message the message - * @param isLevelEnabled a flag indicating if the level is enabled - * (used only at the DEBUG level) - */ - public void log(String level, String message, String isLevelEnabled) { - log(level, message, null, isLevelEnabled) - } - - /** - * Logs a message at the specified level. - * @param level the level (DEBUG, INFO, WARN, ERROR) - * @param message the message - * @param cause the cause (stracktrace will be included in the output) - * @param isLevelEnabled a flag indicating if the level is enabled - * (used only at the DEBUG level) - */ - public void log(String level, String message, Throwable cause, String isLevelEnabled) { - if (cause == null) { - utils.log(level, message, isLevelEnabled); - } else { - StringWriter stringWriter = new StringWriter(); - PrintWriter printWriter = new PrintWriter(stringWriter); - printWriter.println(message); - cause.printStackTrace(printWriter); - utils.log(level, stringWriter.toString(), isLevelEnabled); - printWriter.close(); - } - } - - /** - * Logs a WorkflowException at the ERROR level with the specified message. - * @param execution the execution - */ - public void logWorkflowException(DelegateExecution execution, String message) { - def workflowException = execution.getVariable("WorkflowException") - - if (workflowException == null) { - logError(message); - } else { - logError(message + ": " + workflowException) - } - } - - /** - * Saves the WorkflowException in the execution to the specified variable, - * clearing the WorkflowException variable so the workflow can continue - * processing (perhaps catching another WorkflowException). - * @param execution the execution - * @return the name of the destination variable - */ - public saveWorkflowException(DelegateExecution execution, String variable) { - if (variable == null) { - throw new NullPointerException(); - } - - execution.setVariable(variable, execution.getVariable("WorkflowException")) - execution.setVariable("WorkflowException", null) - } - - - /** - * Validates that the request exists and that the mso-request-id variable is set. - * Additional required variables may be checked by specifying their names. - * NOTE: services requiring mso-service-instance-id must specify it explicitly! - * If a problem is found, buildAndThrowWorkflowException builds a WorkflowException - * and throws an MSOWorkflowException. This method also sets up the log context for - * the workflow. - * - * @param execution the execution - * @return the validated request - */ - public String validateRequest(DelegateExecution execution, String... requiredVariables) { - ExceptionUtil exceptionUtil = new ExceptionUtil() - def method = getClass().getSimpleName() + '.validateRequest(' + - 'execution=' + execution.getId() + - ', requredVariables=' + requiredVariables + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String processKey = getProcessKey(execution) - def prefix = execution.getVariable("prefix") - - if (prefix == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null") - } - - try { - def request = execution.getVariable(prefix + 'Request') - - if (request == null) { - request = execution.getVariable(processKey + 'Request') - - if (request == null) { - request = execution.getVariable('bpmnRequest') - } - - setVariable(execution, processKey + 'Request', null) - setVariable(execution, 'bpmnRequest', null) - setVariable(execution, prefix + 'Request', request) - } - - if (request == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null") - } - - // All requests must have a request ID. - // Some requests (e.g. SDN-MOBILITY) do not have a service instance ID. - - String requestId = null - String serviceInstanceId = null - - List allRequiredVariables = new ArrayList() - allRequiredVariables.add("mso-request-id") - - if (requiredVariables != null) { - for (String variable : requiredVariables) { - if (!allRequiredVariables.contains(variable)) { - allRequiredVariables.add(variable) - } - } - } - - for (String variable : allRequiredVariables) { - def value = execution.getVariable(variable) - if (value == null || ((value instanceof CharSequence) && value.length() == 0)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + - " request was received with no '" + variable + "' variable") - } - - if ("mso-request-id".equals(variable)) { - requestId = (String) value - } else if ("mso-service-instance-id".equals(variable)) { - serviceInstanceId = (String) value - } - } - - if (serviceInstanceId == null) { - serviceInstanceId = (String) execution.getVariable("mso-service-instance-id") - } - - utils.logContext(requestId, serviceInstanceId) - logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled) - logDebug('Exited ' + method, isDebugLogEnabled) - return request - } catch (BpmnError e) { - throw e - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") - } - } - - /** - * gets vars stored in a JSON object in prefix+Request and returns as a LazyMap - * setting log context here too - * @param execution the execution - * @return the inputVars - */ - public Map validateJSONReq(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.validateJSONReq(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String processKey = getProcessKey(execution); - def prefix = execution.getVariable("prefix") - - def requestId =getVariable(execution, "mso-request-id") - def serviceInstanceId = getVariable(execution, "mso-service-instance-id") - if(requestId!=null && serviceInstanceId!=null){ - utils.logContext(requestId, serviceInstanceId) - } - - - def request = getVariable(execution, prefix + 'Request') - - if (request == null) { - request = getVariable(execution, processKey + 'Request') - - if (request == null) { - request = getVariable(execution, 'bpmnRequest') - } - execution.setVariable(prefix + 'Request', request) - } - - def jsonSlurper = new JsonSlurper() - def parsed = jsonSlurper.parseText(request) - - - logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled) - logDebug('Exited ' + method, isDebugLogEnabled) - return parsed - - } - - /** - * Sends a response to the workflow service that invoked the process. This method - * may only be used by top-level processes that were directly invoked by the - * asynchronous workflow service. - * @param execution the execution - * @param responseCode the response code - * @param content the message content - * @throws IllegalArgumentException if the response code is invalid - * by HTTP standards - * @throws UnsupportedOperationException if not invoked by an asynchronous, - * top-level process - * @throws IllegalStateException if a response has already been sent - */ - protected void sendWorkflowResponse(DelegateExecution execution, Object responseCode, String response) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - try { - String processKey = getProcessKey(execution); - - // isAsyncProcess is injected by the workflow service that started the flow - if (!String.valueOf(execution.getVariable("isAsyncProcess")).equals("true")) { - throw new UnsupportedOperationException(processKey + ": " + - "sendWorkflowResponse is valid only in asynchronous workflows"); - } - - if (String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true")) { - logDebug("Sync response has already been sent for " + processKey, isDebugLogEnabled) - }else{ - - logDebug("Building " + processKey + " response ", isDebugLogEnabled) - - int intResponseCode; - - try { - intResponseCode = Integer.parseInt(String.valueOf(responseCode)); - - if (intResponseCode < 100 || intResponseCode > 599) { - throw new NumberFormatException(String.valueOf(responseCode)); - } - } catch (NumberFormatException e) { - throw new IllegalArgumentException("Process " + processKey - + " provided an invalid HTTP response code: " + responseCode); - } - - // Only 2XX responses are considered "Success" - String status = (intResponseCode >= 200 && intResponseCode <= 299) ? - "Success" : "Fail"; - - // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead - execution.setVariable(processKey + "ResponseCode", String.valueOf(intResponseCode)) - execution.setVariable(processKey + "Response", response); - execution.setVariable(processKey + "Status", status); - execution.setVariable("WorkflowResponse", response) - - logDebug("Sending response for " + processKey - + " ResponseCode=" + intResponseCode - + " Status=" + status - + " Response=\n" + response, - isDebugLogEnabled) - - // TODO: ensure that this flow was invoked asynchronously? - - WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse() - callbackResponse.setStatusCode(intResponseCode) - callbackResponse.setMessage(status) - callbackResponse.setResponse(response) - - // TODO: send this data with HTTP POST - - WorkflowContextHolder.getInstance().processCallback( - processKey, - execution.getProcessInstanceId(), - execution.getVariable("mso-request-id"), - callbackResponse) - - execution.setVariable(processKey + "WorkflowResponseSent", "true"); - } - - } catch (Exception ex) { - logError("Unable to send workflow response to client ....", ex) - } - } - - /** - * Returns true if a workflow response has already been sent. - * @param execution the execution - */ - protected boolean isWorkflowResponseSent(DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - String processKey = getProcessKey(execution); - return String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true"); - } - - /** - * Returns the process definition key (i.e. the process name) of the - * current process. - * - * @param execution the execution - */ - public String getProcessKey(DelegateExecution execution) { - def testKey = execution.getVariable("testProcessKey") - if(testKey!=null){ - return testKey - } - return execution.getProcessEngineServices().getRepositoryService() - .getProcessDefinition(execution.getProcessDefinitionId()).getKey() - } - - /** - * Returns the process definition key (i.e. the process name) of the - * top-level process. - * @param execution the execution - */ - public String getMainProcessKey(DelegateExecution execution) { - DelegateExecution exec = execution - - while (true) { - DelegateExecution parent = exec.getSuperExecution() - - if (parent == null) { - parent = exec.getParent() - - if (parent == null) { - break - } - } - - exec = parent - } - - return execution.getProcessEngineServices().getRepositoryService() - .getProcessDefinition(exec.getProcessDefinitionId()).getKey() - } - - /** - * Gets the node for the named element from the given xml. If the element - * does not exist in the xml or is empty, a WorkflowException is created - * (and as a result, a MSOWorkflowException event is thrown). - * - * @param execution The flow's execution. - * @param xml Xml to search. - * @param elementName Name of element to search for. - * @return The element node, if found in the xml. - */ - protected String getRequiredNodeXml(DelegateExecution execution, String xml, String elementName) { - ExceptionUtil exceptionUtil = new ExceptionUtil() - def element = utils.getNodeXml(xml, elementName, false) - if (element.trim().isEmpty()) { - def msg = 'Required element \'' + elementName + '\' is missing or empty' - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } else { - return element - } - } - - /** - * Gets the value of the named element from the given xml. If the element - * does not exist in the xml or is empty, a WorkflowException is created - * (and as a result, a MSOWorkflowException event is thrown). - * - * @param execution The flow's execution. - * @param xml Xml to search. - * @param elementName Name of element to whose value to get. - * @return The non-empty value of the element, if found in the xml. - */ - protected String getRequiredNodeText(DelegateExecution execution, String xml, String elementName) { - ExceptionUtil exceptionUtil = new ExceptionUtil() - def elementText = utils.getNodeText1(xml, elementName) - if ((elementText == null) || (elementText.isEmpty())) { - def msg = 'Required element \'' + elementName + '\' is missing or empty' - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } else { - return elementText - } - } - - /** - * Get the text for the specified element from the specified xml. If - * the element does not exist, return the specified default value. - * - * @param xml Xml from which to get the element's text - * @param elementName Name of element whose text to get - * @param defaultValue the default value - * @return the element's text or the default value if the element does not - * exist in the given xml - */ - protected String getNodeText(String xml, String elementName, String defaultValue) { - def nodeText = utils.getNodeText1(xml, elementName) - return (nodeText == null) ? defaultValue : nodeText - } - - /** - * Get the text for the specified element from the specified xml. If - * the element does not exist, return an empty string. - * - * @param xml Xml from which to get the element's text. - * @param elementName Name of element whose text to get. - * @return the element's text or an empty string if the element does not - * exist in the given xml. - */ - protected String getNodeTextForce(String xml, String elementName) { - return getNodeText(xml, elementName, ''); - } - - /** - *Store the variable as typed with java serialization type - *@param execution - *@param name - *@param value - */ - public void setVariable(DelegateExecution execution, String name, Object value) { - VariableMap variables = Variables.createVariables() - variables.putValueTyped('payload', Variables.objectValue(value) - .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value - .create()) - execution.setVariable(name,variables) - } - - //TODO not sure how this will look in Cockpit - - /** - * Returns the variable map - *@param execution - *@param name - *@return - **/ - public String getVariable(DelegateExecution execution, String name) { - def myObj = execution.getVariable(name) - if(myObj instanceof VariableMap){ - VariableMap serializedObjectMap = (VariableMap) myObj - ObjectValueImpl payloadObj = serializedObjectMap.getValueTyped('payload') - return payloadObj.getValue() - }else{ - return myObj - } - } - - - /** - * Returns true if a value equals one of the provided set. Equality is - * determined by using the equals method if the value object and the - * object in the provided set have the same class. Otherwise, the objects - * are converted to strings and then compared. Nulls are permitted for - * the value as well as in the provided set - * Example: - *
-	 *     def statusCode = getStatusCode()
-	 *     isOneOf(statusCode, 200, 201, 204)
-	 * 
- * @param value the value to test - * @param these a set of permissable values - * @return true if the value is in the provided set - */ - public boolean isOneOf(Object value, Object... these) { - for (Object thisOne : these) { - if (thisOne == null) { - if (value == null) { - return true - } - } else { - if (value != null) { - if (value.getClass() == thisOne.getClass()) { - if (value.equals(thisOne)) { - return true - } - } else { - if (String.valueOf(value).equals(String.valueOf(thisOne))) { - return true - } - } - } - } - } - return false - } - - /** - * Sets flows success indicator variable. - * - */ - public void setSuccessIndicator(DelegateExecution execution, boolean isSuccess) { - String prefix = execution.getVariable('prefix') - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - - logDebug('Entered SetSuccessIndicator Method', isDebugLogEnabled) - execution.setVariable(prefix+'SuccessIndicator', isSuccess) - logDebug('Outgoing SuccessIndicator is: ' + execution.getVariable(prefix+'SuccessIndicator') + '', isDebugLogEnabled) - } - - /** - * Sends a Error Sync Response - * - */ - public void sendSyncError(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - String requestId = execution.getVariable("mso-request-id") - logDebug('sendSyncError, requestId: ' + requestId, isDebugEnabled) - WorkflowException workflowExceptionObj = execution.getVariable("WorkflowException") - if (workflowExceptionObj != null) { - String errorMessage = workflowExceptionObj.getErrorMessage() - def errorCode = workflowExceptionObj.getErrorCode() - logDebug('sendSyncError, requestId: ' + requestId + ' | errorMessage: ' + errorMessage + ' | errorCode: ' + errorCode, isDebugEnabled) - sendWorkflowResponse(execution, errorCode, errorMessage) - } - } - - /** - * Executes a named groovy script method in the current object - */ - public void executeMethod(String methodName, Object... args) { - - if (args != null && args.size() > 0) { - - // First argument of method to call is always the execution object - DelegateExecution execution = (DelegateExecution) args[0] - - def classAndMethod = getClass().getSimpleName() + '.' + methodName + '(execution=' + execution.getId() + ')' - def isDebugEnabled = execution.getVariable('isDebugLogEnabled') - - logDebug('Entered ' + classAndMethod, isDebugEnabled) - logDebug('Received parameters: ' + args, isDebugEnabled) - - try{ - def methodToCall = this.metaClass.getMetaMethod(methodName, args) - logDebug('Method to call: ' + methodToCall, isDebugEnabled) - methodToCall?.invoke(this, args) - } - catch(BpmnError bpmnError) { - logDebug('Rethrowing BpmnError ' + bpmnError.getMessage(), isDebugEnabled) - throw bpmnError - } - catch(Exception e) { - e.printStackTrace() - logDebug('Unexpected error encountered - ' + e.getMessage(), isDebugEnabled) - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) - } - finally { - logDebug('Exited ' + classAndMethod, isDebugEnabled) - } - } - } - - /** - *This method determines and adds the appropriate ending to come - *after a number (-st, -nd, -rd, or -th) - * - *@param int n - * - *@return String ending - number with suffix - */ - public static String labelMaker(Object n) { - Integer num - if(n instanceof String){ - num = Integer.parseInt(n) - }else{ - num = n - } - - String ending = ""; //the end to be added to the number - if(num != null){ - if ((num % 10 == 1) && (num != 11)) { - ending = num + "st"; - } else if ((num % 10 == 2) && (num != 12)) { - ending = num + "nd"; - } else if ((num % 10 == 3) && (num != 13)) { - ending = num + "rd"; - } else { - ending = num + "th"; - } - } - return ending - } - - /** - * - *This method gets and decodes SDNC Response's "RequestData". - * - *@param response - the sdnc response - * - *@return data - the response "RequestData" decoded - * - */ - public String getRequestDataDecoded(String response){ - String data = utils.getNodeText1(response, "RequestData") - if(data != null){ - data = data.replaceAll("<", "<") - data = data.replaceAll(">", ">") - } - - return data - } - - - /** - * Constructs a workflow message callback URL for the specified message type and correlator. - * This type of callback URL is used when a workflow wants an MSO adapter (like the SDNC - * adapter) to call it back. In other words, this is for callbacks internal to the MSO - * complex. Use createWorkflowMessageAdapterCallbackURL if the callback - * will come from outside the MSO complex. - * @param messageType the message type (e.g. SDNCAResponse or VNFAResponse) - * @param correlator the correlator value (e.g. a request ID) - */ - public String createCallbackURL(DelegateExecution execution, String messageType, String correlator) { - String endpoint = (String) execution.getVariable('URN_mso_workflow_message_endpoint') - - if (endpoint == null || endpoint.isEmpty()) { - ExceptionUtil exceptionUtil = new ExceptionUtil() - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, - 'mso:workflow:message:endpoint URN mapping is not set') - } - - while (endpoint.endsWith('/')) { - endpoint = endpoint.substring(0, endpoint.length()-1) - } - - return endpoint + - '/' + UriUtils.encodePathSegment(messageType, 'UTF-8') + - '/' + UriUtils.encodePathSegment(correlator, 'UTF-8') - } - - /** - * - * Constructs a workflow message callback URL for the specified message type and correlator. - * This type of callback URL is used when a workflow wants a system outside the MSO complex - * to call it back through the Workflow Message Adapter. - * @param messageType the message type (e.g. SNIROResponse) - * @param correlator the correlator value (e.g. a request ID) - */ - public String createWorkflowMessageAdapterCallbackURL(DelegateExecution execution, String messageType, String correlator) { - String endpoint = (String) execution.getVariable('URN_mso_adapters_workflow_message_endpoint') - - if (endpoint == null || endpoint.isEmpty()) { - ExceptionUtil exceptionUtil = new ExceptionUtil() - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, - 'mso:adapters:workflow:message:endpoint URN mapping is not set') - } - - while (endpoint.endsWith('/')) { - endpoint = endpoint.substring(0, endpoint.length()-1) - } - - return endpoint + - '/' + UriUtils.encodePathSegment(messageType, 'UTF-8') + - '/' + UriUtils.encodePathSegment(correlator, 'UTF-8') - } - - public void setRollbackEnabled(DelegateExecution execution, isDebugLogEnabled) { - - // Rollback settings - def prefix = execution.getVariable('prefix') - def disableRollback = execution.getVariable("disableRollback") - def defaultRollback = execution.getVariable("URN_mso_rollback").toBoolean() - - logDebug('disableRollback: ' + disableRollback, isDebugLogEnabled) - logDebug('defaultRollback: ' + defaultRollback, isDebugLogEnabled) - - def rollbackEnabled - - if(disableRollback == null || disableRollback == '' ) { - // get from default urn settings for mso_rollback - disableRollback = !defaultRollback - rollbackEnabled = defaultRollback - logDebug('disableRollback is null or empty!', isDebugLogEnabled) - } - else { - if(disableRollback == true) { - rollbackEnabled = false - } - else if(disableRollback == false){ - rollbackEnabled = true - } - else { - rollbackEnabled = defaultRollback - } - } - - execution.setVariable(prefix+"backoutOnFailure", rollbackEnabled) - logDebug('rollbackEnabled (aka backoutOnFailure): ' + rollbackEnabled, isDebugLogEnabled) - } - - public void setBasicDBAuthHeader(DelegateExecution execution, isDebugLogEnabled) { - try { - String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth") - utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled) - - def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey")) - execution.setVariable("BasicAuthHeaderValueDB",encodedString) - } catch (IOException ex) { - String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() - utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled) - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AllottedResourceUtils.groovy deleted file mode 100644 index fc099caa5f..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AllottedResourceUtils.groovy +++ /dev/null @@ -1,333 +0,0 @@ -package org.openecomp.mso.bpmn.common.scripts - -import org.apache.commons.lang3.StringEscapeUtils; -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; - - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution; - -import groovy.util.XmlParser -import groovy.util.Node -import static org.apache.commons.lang3.StringUtils.*; - -class AllottedResourceUtils { - - private AbstractServiceTaskProcessor taskProcessor - ExceptionUtil exceptionUtil = new ExceptionUtil() - MsoUtils utils; - - public AllottedResourceUtils(AbstractServiceTaskProcessor taskProcessor) { - this.taskProcessor = taskProcessor - this.utils = taskProcessor.utils - } - - /*Used on Create - called from DoCreate - * Using Consuming ServiceInstanceId get related Allotted Resources Orchestration status from AAI - * 1) get related AR links for CSI 2) get AR from AR links - * return: null -> AR Not found - * return: " " -> AR found with empty orchStatus - * return: orchStatus - > AR found with this orchStatus - * setsVariable aaiARGetResponse - */ - public String getAROrchStatus (DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** getAROrchStatus *****", isDebugEnabled) - String msg = "" - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String arType = execution.getVariable("allottedResourceType") - String arRole = execution.getVariable("allottedResourceRole") - String siXml = execution.getVariable("CSI_service") - String ar = null - String orchStatus = null - XmlParser xmlParser = new XmlParser() - utils.log("DEBUG","getAROrchStatus siXml:" + siXml, isDebugEnabled) - try { - if (!isBlank(siXml)) { - def groovy.util.Node siNode = xmlParser.parseText(siXml) - def groovy.util.Node relationshipList = utils.getChildNode(siNode, 'relationship-list') - if (relationshipList != null) { - def groovy.util.NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') - for (groovy.util.Node relationship in relationships) { - def groovy.util.Node relatedTo = utils.getChildNode(relationship, 'related-to') - if ((relatedTo != null) && (relatedTo.text().equals('allotted-resource'))) { - utils.log("DEBUG","getARORchStatus AR found", isDebugEnabled) - def groovy.util.Node relatedLink = utils.getChildNode(relationship, 'related-link') - if (relatedLink != null){ - ar = getARbyLink(execution, relatedLink.text(), arRole) - if (!isBlank(ar)) - { - orchStatus = execution.getVariable("aaiAROrchStatus") - break - } - } - } - } - } - } - }catch(Exception e){ - utils.log("DEBUG", " Error encountered in getAROrchStatus" + e.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in getAROrchStatus" + e.getMessage()) - } - utils.log("DEBUG"," *****Exit getAROrchStatus **** OrchStatus:" + orchStatus, isDebugEnabled) - return orchStatus - } - - // get Allotted Resource by AllottedResourceId - // used on Delete - called from doDeleteAR - // setsVariable aaiARGetResponse - public String getARbyId (DelegateExecution execution, String allottedResourceId) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ***** getARbyId ***** ", isDebugEnabled) - String arLink = getARLinkbyId(execution, allottedResourceId) - String ar = null - if (!isBlank(arLink)) - { - ar = getARbyLink(execution, arLink, "") - } - utils.log("DEBUG", " ***** Exit GetARbyId ***** AR:" + ar, isDebugEnabled) - return ar; - } - - public String getPSIFmARLink(DelegateExecution execution, String arLink) - { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - // Path: /aai/{version}/business/customers/customer/{cust}/service-subscriptions/service-subscription/{subs}/service-instances/service-instance/{psiid}/allotted-resources/allotted-resource/{arid} - utils.log("DEBUG", " ***** getPSIFmARLink ***** path:" + arLink, isDebugEnabled) - String[] split = arLink.split("/service-instance/") - String[] splitB = split[1].split("/allotted-resources/") - String siId = splitB[0] - utils.log("DEBUG", " ***** Exit getARLinkbyId ***** parentServiceInstanceId:" + siId , isDebugEnabled) - return siId - } - - // get Allotted Resource Link by AllottedResourceId using Nodes Query - // used on Delete - called from getARbyId - public String getARLinkbyId (DelegateExecution execution, String allottedResourceId) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ***** getARLinkbyId ***** ", isDebugEnabled) - String arLink = null - try { - AaiUtil aaiUriUtil = new AaiUtil(taskProcessor) - String aaiNQUri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) - String aaiEndpoint = execution.getVariable("URN_aai_endpoint") - String aaiUrl = "${aaiNQUri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}" - - utils.log("DEBUG", "getARLinkbyId url: \n" + aaiUrl, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, aaiUrl) - int responseCode = response.getStatusCode() - utils.log("DEBUG", " GET AR response code is: " + responseCode, isDebugEnabled) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - utils.log("DEBUG", "GET AR:" + aaiResponse, isDebugEnabled) - if(responseCode == 200 || responseCode == 202){ - utils.log("DEBUG", "GET AR Received a Good Response Code", isDebugEnabled) - if(utils.nodeExists(aaiResponse, "result-data")){ - utils.log("DEBUG", "Query for AllottedResource Url Response Does Contain Data" , isDebugEnabled) - arLink = utils.getNodeText1(aaiResponse, "resource-link") - }else{ - utils.log("DEBUG", "GET AR Response Does NOT Contain Data" , isDebugEnabled) - } - }else if(responseCode == 404){ - utils.log("DEBUG", "GET AR received a Not Found (404) Response", isDebugEnabled) - } - else{ - utils.log("DEBUG", " GET AR received a Bad Response: \n" + aaiResponse, isDebugEnabled) - buildAAIErrorResponse(execution, aaiResponse, "Error retrieving AR from AAI") - } - }catch(Exception e){ - utils.log("DEBUG", " Error encountered within GetAaiAR" + e.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in GetARbyId" + e.getMessage()) - } - utils.log("DEBUG", " ***** Exit GetARLinkbyId ***** Link:" + arLink, isDebugEnabled) - return arLink - } - - // get Allotted resource using Link - // used on Create called from getARORchStatus - // used on Delete called from getARbyId - // setsVariable aaiARPath - used for Patch in create - public String getARbyLink (DelegateExecution execution, String link, String role) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ***** getARbyLink ***** ", isDebugEnabled) - String ar = null - String arUrl = null - try { - AaiUtil aaiUriUtil = new AaiUtil(taskProcessor) - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String arEndpoint = "" - - if(!isBlank(link)) { - utils.log("DEBUG", "Incoming AR Resource Link is: " + link, isDebugEnabled) - String[] split = link.split("/aai/") - arEndpoint = "/aai/" + split[1] - } - - arUrl = "${aai_endpoint}" + arEndpoint - - utils.log("DEBUG", "GET AR Aai Path is: \n" + arUrl, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, arUrl) - int responseCode = response.getStatusCode() - utils.log("DEBUG", " GET AR response code is: " + responseCode, isDebugEnabled) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - utils.log("DEBUG", "GET AR:" + aaiResponse, isDebugEnabled) - if(responseCode == 200 || responseCode == 202){ - utils.log("DEBUG", "GET AR Received a Good Response Code", isDebugEnabled) - if(utils.nodeExists(aaiResponse, "allotted-resource")){ - if (!isBlank(role)) - { - if (utils.nodeExists(aaiResponse, "role") && role.equals(utils.getNodeText1(aaiResponse, "role"))) { - ar = aaiResponse - }else{ - utils.log("DEBUG", "AAI AR does not match input role:" + role, isDebugEnabled) - } - } - else - { - ar = aaiResponse - } - } - else - { - utils.log("DEBUG", "GET AR Does NOT Contain Data" , isDebugEnabled) - } - }else if(responseCode == 404){ - utils.log("DEBUG", "GET AR received a Not Found (404) Response", isDebugEnabled) - } - else{ - utils.log("DEBUG", " GET AR received a Bad Response: \n" + aaiResponse, isDebugEnabled) - buildAAIErrorResponse(execution, aaiResponse, "Error retrieving AR from AAI") - } - }catch(Exception e){ - utils.log("DEBUG", " Error encountered within GetAaiAR" + e.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in GetAaiAR" + e.getMessage()) - } - if (!isBlank(ar)) - { - execution.setVariable("aaiARGetResponse", ar) - execution.setVariable("aaiARPath", arUrl) - - String resourceVersion = null - if (utils.nodeExists(ar, "resource-version")) { - resourceVersion = utils.getNodeText1(ar, "resource-version") - execution.setVariable("aaiARResourceVersion", resourceVersion) - } - - String orchStatus = null - if (utils.nodeExists(ar, "orchestration-status")) { - orchStatus= utils.getNodeText1(ar, "orchestration-status") - } - else - { - orchStatus = " " - } - execution.setVariable("aaiAROrchStatus", orchStatus) - } - utils.log("DEBUG", " ***** Exit GetARbyLink ***** AR:" + ar, isDebugEnabled) - return ar - } - - public void updateAROrchStatus(DelegateExecution execution, String status, String aaiARPath){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** updaAROrchStatus *** ", isDebugEnabled) - try{ - - String updateReq = """ - { - "orchestration-status": "${status}" - } - """ - - utils.log("DEBUG", 'AAI AR URI: ' + aaiARPath, isDebugEnabled) - - AaiUtil aaiUriUtil = new AaiUtil(taskProcessor) - APIResponse apiResponse = aaiUriUtil.executeAAIPatchCall(execution, aaiARPath, updateReq) - def aaiResponse = StringEscapeUtils.unescapeXml(apiResponse.getResponseBodyAsString()) - def responseCode = apiResponse.getStatusCode() - - utils.logAudit("AAI Response Code: " + responseCode) - utils.logAudit("AAI Response: " + aaiResponse) - if(responseCode == 200){ - utils.log("DEBUG", "UpdateAR Good REST Response is: " + "\n" + aaiResponse, isDebugEnabled) - }else{ - utils.log("DEBUG", "UpdateAROrchStatus Bad REST Response!", isDebugEnabled) - buildAAIErrorResponse(execution, aaiResponse, "Error updating AR OrchStatus in AAI") - } - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException ", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("ERROR", "Exception in updateAR. Exception is:\n" + e.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error in updateAROrchStatus.' + e.getMessage()) - } - utils.log("DEBUG", " *** Exit updateAROrchStatus *** ", isDebugEnabled) - } - - //Sets Variable "wasDeleted" - public void deleteAR(DelegateExecution execution, String aaiARPath){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** deleteAR *** aaiARPath:" + aaiARPath, isDebugEnabled) - try { - AaiUtil aaiUriUtil = new AaiUtil(taskProcessor) - APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, aaiARPath) - int responseCode = response.getStatusCode() - execution.setVariable("deleteARResponseCode", responseCode) - - utils.log("DEBUG", " Delete AR response code:" + responseCode, isDebugEnabled) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable("aaiARDeleteResponse", aaiResponse) - - utils.log("DEBUG", "Delete AR Response:" + aaiResponse) - //Process Response - if(responseCode == 204){ - utils.log("DEBUG", " Delete AR Received a Good Response", isDebugEnabled) - execution.setVariable("wasDeleted", "true") - }else if(responseCode == 404){ - utils.log("DEBUG", " Delete AR Received a Not Found (404) Response", isDebugEnabled) - }else if(responseCode == 412){ - utils.log("DEBUG", "Delete AR Received a Resource Version Mismatch Error: \n" + aaiResponse, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 412, "DeleteAR Received a resource-version Mismatch Error Response from AAI") - }else{ - utils.log("DEBUG", "Delete AR Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled) - buildAAIErrorResponse(execution, aaiResponse, "Error deleting AR in AAI") - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", " Error encountered in deleteAR!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Delete AR") - } - utils.log("DEBUG", " *** Exit deleteAR *** ", isDebugEnabled) - } - - public void buildAAIErrorResponse(DelegateExecution execution, String response, String errorMessage){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** BuildAAIErrorResponse*** ", isDebugEnabled) - - if((response != null) && (response.contains("Fault") || response.contains("RESTFault"))){ - WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(response, execution) - execution.setVariable("WorkflowException", workflowException) - }else{ - exceptionUtil.buildWorkflowException(execution, 500, errorMessage) - } - - utils.log("DEBUG", " *** Exit BuildAAIErrorResponse Process*** ", isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AppCClient.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AppCClient.groovy deleted file mode 100644 index 535b65e187..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AppCClient.groovy +++ /dev/null @@ -1,140 +0,0 @@ -package org.openecomp.mso.bpmn.common.scripts - -import java.util.HashMap; -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.hibernate.event.internal.AbstractLockUpgradeEventListener -import org.openecomp.mso.bpmn.core.HealthCheckHandler -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.client.appc.ApplicationControllerOrchestrator -import org.openecomp.mso.client.appc.ApplicationControllerOrchestratorException -import org.onap.appc.client.lcm.model.Action -import org.onap.appc.client.lcm.model.Status -import org.openecomp.mso.bpmn.appc.payload.PayloadClient -import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs -import org.openecomp.mso.client.appc.ApplicationControllerAction; -import groovy.transform.TypeChecked; -import java.util.UUID; - -/** - * This groovy class supports the AppCClient.bpmn process. - * - * Inputs: - * @param - msoRequestId - * @param - mso-request-Id - * @param - isDebugLogEnabled - * @param - requestId - * @param - vnfId - * @param - action - * @param - payload - * @param - vnfName - * @param - controllerType - * - * Outputs: - * @param - errorcode - * @param - errorText - * @param - responsePayload - * @param - healthCheckIndex - * @param - workstep - * @param - rollbackVnfStop - * @param - rollbackVnfLock - * @param - rollbackQuiesceTraffic - */ - -public class AppCClient extends AbstractServiceTaskProcessor{ - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtils = new JsonUtils() - def prefix = "UPDVnfI_" - - public void preProcessRequest(DelegateExecution execution){ - - } - - public void runAppcCommand(DelegateExecution execution) { - String isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - utils.log("DEBUG", "***** Start runCommand *****", isDebugLogEnabled) - def method = getClass().getSimpleName() + '.runAppcCommand(' + - 'execution=' + execution.getId() + - ')' - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("rollbackVnfStop", false) - execution.setVariable("rollbackVnfLock", false) - execution.setVariable("rollbackQuiesceTraffic", false) - String appcCode = "1002" - String responsePayload = "" - String appcMessage = "" - Action action = null - try { - action = (Action) execution.getVariable("action") - String vnfId = execution.getVariable('vnfId') - String msoRequestId = execution.getVariable('msoRequestId') - String vnfName = execution.getVariable('vnfName') - String aicIdentity = execution.getVariable('aicIdentity') - String vnfHostIpAddress = execution.getVariable('vnfHostIpAddress') - String vmIdList = execution.getVariable("vmIdList") - String identityUrl = execution.getVariable("identityUrl") - String controllerType = execution.getVariable("controllerType") - String vfModuleId = execution.getVariable("vfModuleId") - HashMap payloadInfo = new HashMap(); - payloadInfo.put("vnfName", vnfName) - payloadInfo.put("aicIdentity", aicIdentity) - payloadInfo.put("vnfHostIpAddress", vnfHostIpAddress) - payloadInfo.put("vmIdList", vmIdList) - payloadInfo.put("identityUrl", identityUrl) - payloadInfo.put("vfModuleId",vfModuleId) - Optional payload - logDebug("Running APP-C action: " + action.toString(), isDebugLogEnabled) - utils.log("DEBUG", "VNFID: " + vnfId, isDebugLogEnabled) - execution.setVariable('msoRequestId', msoRequestId) - execution.setVariable("failedActivity", "APP-C") - execution.setVariable('workStep', action.toString()) - if(execution.getVariable("payload") != null){ - String pay = execution.getVariable("payload") - payload = Optional.of(pay) - } - if(action.equals(Action.HealthCheck)){ - String healthCheckIndex = execution.getVariable('healthCheckIndex') - execution.setVariable('workStep', action.toString() + healthCheckIndex) - execution.setVariable('healthCheckIndex', healthCheckIndex + 1) - } - ApplicationControllerAction client = new ApplicationControllerAction() - utils.log("DEBUG", "Created Application Controller Action Object", isDebugLogEnabled) - //PayloadInfo contains extra information that adds on to payload before making request to appc - client.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType) - utils.log("DEBUG", "ran through the main method for Application Contoller", isDebugLogEnabled) - appcCode = client.getErrorCode() - appcMessage = client.getErrorMessage() - } - catch (BpmnError e) { - logError('Caught exception in ' + method, e) - appcMessage = e.getMessage() - } - execution.setVariable("errorCode", appcCode) - if (appcCode == '0' && action != null) { - if (action.equals(Action.Lock)) { - execution.setVariable("rollbackVnfLock", true) - } - if (action.equals(Action.Unlock)) { - execution.setVariable("rollbackVnfLock", false) - } - if (action.equals(Action.Start)) { - execution.setVariable("rollbackVnfStop", true) - } - if (action.equals(Action.Stop)) { - execution.setVariable("rollbackVnfStop", false) - } - if (action.equals(Action.QuiesceTraffic)) { - execution.setVariable("rollbackQuiesceTraffic", true) - } - if (action.equals(Action.ResumeTraffic)) { - execution.setVariable("rollbackQuiesceTraffic", false) - } - } - execution.setVariable("errorText", appcMessage) - execution.setVariable("responsePayload", responsePayload) - utils.log("DEBUG", "Error Message: " + appcMessage, isDebugLogEnabled) - utils.log("DEBUG","ERROR CODE: " + execution.getVariable("errorCode"), isDebugLogEnabled) - utils.log("DEBUG", "***** End of runCommand *****", isDebugLogEnabled) - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy deleted file mode 100644 index 7fcf310210..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy +++ /dev/null @@ -1,1251 +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.bpmn.common.scripts - -import org.json.JSONObject; -import org.json.JSONArray; -import org.json.XML; -import org.springframework.web.util.UriUtils; - -import org.openecomp.mso.bpmn.core.json.JsonUtils - - -import groovy.json.JsonBuilder -import groovy.json.JsonSlurper -import groovy.util.slurpersupport.GPathResult -import groovy.xml.QName; - -import org.camunda.bpm.engine.delegate.DelegateExecution - -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - - -/*** - * Utilities for accessing Catalog DB Adapter to retrieve Networks, VNF/VFModules, AllottedResources and complete ServiceResources information - * - */ - -class CatalogDbUtils { - - MsoUtils utils = new MsoUtils() - JsonUtils jsonUtils = new JsonUtils() - MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - static private String defaultDbAdapterVersion = "v2" - - public JSONArray getAllNetworksByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return networksList - } - - public JSONArray getAllNetworksByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - networksList = responseJson.getJSONArray("serviceNetworks") - } - else { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return networksList - } - - public JSONArray getAllNetworksByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return networksList - } - - public JSONArray getAllNetworksByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - networksList = responseJson.getJSONArray("serviceNetworks") - } - else { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return networksList - } - - public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return networksList - } - - public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - networksList = responseJson.getJSONArray("serviceNetworks") - } - else { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return networksList - } - - public JSONArray getAllNetworksByNetworkModelCustomizationUuid(DelegateExecution execution, String networkModelCustomizationUuid) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return networksList - } - - public JSONArray getAllNetworksByNetworkModelCustomizationUuid(DelegateExecution execution, String networkModelCustomizationUuid, String catalogUtilsVersion) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - networksList = responseJson.getJSONArray("serviceNetworks") - } - else { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return networksList - } - - public JSONArray getAllNetworksByNetworkType(DelegateExecution execution, String networkType) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return networksList - } - - public JSONArray getAllNetworksByNetworkType(DelegateExecution execution, String networkType, String catalogUtilsVersion) { - JSONArray networksList = null - String endPoint = "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - networksList = responseJson.getJSONArray("serviceNetworks") - } - else { - networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return networksList - } - - - public JSONArray getAllVnfsByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) { - JSONArray vnfsList = null - String endPoint = "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1") - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vnfsList - } - - public JSONArray getAllVnfsByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - vnfsList = responseJson.getJSONArray("serviceVnfs") - } - else { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vnfsList - } - - public JSONArray getAllVnfsByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) { - JSONArray vnfsList = null - String endPoint ="/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1") - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vnfsList - } - - public JSONArray getAllVnfsByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - vnfsList = responseJson.getJSONArray("serviceVnfs") - } - else { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vnfsList - } - - public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1") - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vnfsList - } - - public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - vnfsList = responseJson.getJSONArray("serviceVnfs") - } - else { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vnfsList - } - - public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid) { - JSONArray vnfsList = null - String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1") - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vnfsList - } - - /** - * This method gets a all vnfs for a particular - * service from the catalog database using the - * service model's model name. - * - * @param catalogDbEndpoint - * @param serviceModelModelName - * @return vnfsList * - * - */ - public JSONArray getAllVnfsByServiceModelModelName(DelegateExecution execution, String serviceModelModelName) { - JSONArray vnfsList = null - String endPoint = "/serviceVnfs?serviceModelName=" + UriUtils.encode(serviceModelModelName, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", defaultDbAdapterVersion) - } - }catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - return vnfsList - } - - public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid, String catalogUtilsVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8") - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - vnfsList = responseJson.getJSONArray("serviceVnfs") - } - else { - vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vnfsList - } - - /** - * This method gets a single vf module from - * the catalog database using the vf module's - * model name. It returns that vf module as - * a JSONObject - * - * @param catalogDbEndpoint - * @param vfModuleModelName - * @return vfModule - */ - public JSONObject getVfModuleByVfModuleModelName(DelegateExecution execution, String vfModuleModelName) { - JSONObject vfModule = null - String endPoint = "/vfModules?vfModuleModelName=" + UriUtils.encode(vfModuleModelName, "UTF-8") - try{ - msoLogger.debug("Get VfModule By VfModule ModelName Endpoint is: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vfModule = parseVfModuleJson(catalogDbResponse, "vfModules", "v1") - } - } - catch(Exception e){ - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vfModule - } - - /** - * This method gets a single vf module from - * the catalog database using the vf module's - * model name. It returns that vf module as - * a JSONObject - * - * @param catalogDbEndpoint - * @param vfModuleModelName - * @param catalogUtilsVersion - * @return vfModules - */ - public JSONObject getVfModuleByVfModuleModelName(DelegateExecution execution, String vfModuleModelName, String catalogUtilsVersion) { - JSONObject vfModule = null - String endPoint = "/vfModules?vfModuleModelName=" + UriUtils.encode(vfModuleModelName, "UTF-8") - try{ - msoLogger.debug("Get VfModule By VfModule ModelName Endpoint is: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vfModule = parseVfModuleJson(catalogDbResponse, "vfModules", "v1") - } - } - catch(Exception e){ - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vfModule - } - - - public JSONArray getAllottedResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) { - JSONArray vnfsList = null - String endPoint = "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1") - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vnfsList - } - - public JSONArray getAllottedResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) { - JSONArray vnfsList = null - String endPoint = "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - vnfsList = responseJson.getJSONArray("serviceAllottedResources") - } - else { - vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vnfsList - } - - public JSONArray getAllottedResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) { - JSONArray vnfsList = null - String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1") - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vnfsList - } - - public JSONArray getAllottedResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - vnfsList = responseJson.getJSONArray() - } - else { - vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.getStackTrace()) - } - - return vnfsList - } - - public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1") - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vnfsList - } - - public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - vnfsList = responseJson.getJSONArray("serviceAllottedResources") - } - else { - vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vnfsList - } - - - public JSONArray getAllottedResourcesByArModelCustomizationUuid(DelegateExecution execution, String arModelCustomizationUuid) { - JSONArray vnfsList = null - String endPoint = "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1") - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vnfsList - } - - public JSONArray getAllottedResourcesByArModelCustomizationUuid(DelegateExecution execution, String arModelCustomizationUuid, String catalogUtilsVersion) { - JSONArray vnfsList = null - String endPoint = "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - JSONObject responseJson = new JSONObject(catalogDbResponse) - vnfsList = responseJson.getJSONArray("serviceAllottedResources") - } - else { - vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion) - } - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return vnfsList - } - - public JSONObject getServiceResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) { - JSONObject resources = null - String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - - resources = parseServiceResourcesJson(catalogDbResponse, "v1") - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return resources - } - - public JSONObject getServiceResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) { - JSONObject resources = null - String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - resources = new JSONObject(catalogDbResponse) - } - else { - resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion) - } - } - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return resources - } - - public JSONObject getServiceResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) { - JSONObject resources = null - String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - - resources = parseServiceResourcesJson(catalogDbResponse, "v1") - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return resources - } - - public String getServiceResourcesByServiceModelInvariantUuidString(DelegateExecution execution, String serviceModelInvariantUuid) { - String resources = null - String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - - resources = catalogDbResponse - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return resources - } - - public JSONObject getServiceResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) { - JSONObject resources = null - String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - resources = new JSONObject(catalogDbResponse) - } - else { - resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion) - } - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return resources - } - - - public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) { - JSONObject resources = null - String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - //TODO this is wrong - resources = parseServiceResourcesJson(catalogDbResponse) - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return resources - } - - public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) { - JSONObject resources = null - String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") - try { - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - if (!catalogUtilsVersion.equals("v1")) { - resources = new JSONObject(catalogDbResponse) - } - else { - resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion) - } - } - - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return resources - } - - - - private JSONArray parseNetworksJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) { - JSONArray modelInfos = null - - msoLogger.debug("parseNetworksJson - catalogUtilsVersion is " + catalogUtilsVersion) - try { - // Create array of jsons - - JSONObject responseJson = new JSONObject(catalogDbResponse) - JSONArray networks = responseJson.getJSONArray(arrayName) - modelInfos = new JSONArray() - - for (int i = 0; i < networks.length(); i++) { - - JSONObject network = networks.getJSONObject(i) - JSONObject modelJson = new JSONObject() - JSONObject modelInfo = buildModelInfo("network", network, catalogUtilsVersion) - modelJson.put("modelInfo", modelInfo) - String networkType = jsonUtils.getJsonValueForKey(network, "networkType") - modelJson.put("networkType", networkType) - - switch (catalogUtilsVersion) { - case "v1": - break - default: - String toscaNodeType = jsonUtils.getJsonValueForKey(network, "toscaNodeType") - modelJson.put("toscaNodeType", toscaNodeType) - String networkTechnology = jsonUtils.getJsonValueForKey(network, "networkTechnology") - modelJson.put("networkTechnology", networkTechnology) - String networkRole = jsonUtils.getJsonValueForKey(network, "networkRole") - modelJson.put("networkRole", networkRole) - String networkScope = jsonUtils.getJsonValueForKey(network, "networkScope") - modelJson.put("networkScope", networkScope) - break - } - modelInfos.put(modelJson) - } - - String modelInfosString = modelInfos.toString() - msoLogger.debug("Returning networks JSON: " + modelInfosString) - - } catch (Exception e) { - utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message) - } - - return modelInfos - } - - private JSONArray parseVnfsJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) { - JSONArray modelInfos = null - - msoLogger.debug("parseVnfsJson - catalogUtilsVersion is " + catalogUtilsVersion) - - try { - // Create array of jsons - - JSONObject responseJson = new JSONObject(catalogDbResponse) - JSONArray vnfs = responseJson.getJSONArray(arrayName) - modelInfos = new JSONArray() - - for (int i = 0; i < vnfs.length(); i++) { - JSONObject vnf = vnfs.getJSONObject(i) - - msoLogger.debug(vnf.toString(2)) - JSONObject modelInfo = buildModelInfo("vnf", vnf, catalogUtilsVersion) - JSONObject modelJson = new JSONObject() - modelJson.put("modelInfo", modelInfo) - switch(catalogUtilsVersion) { - case "v1": - break - default: - String toscaNodeType = jsonUtils.getJsonValueForKey(vnf, "toscaNodeType") - modelJson.put("toscaNodeType", toscaNodeType) - String nfType = jsonUtils.getJsonValueForKey(vnf, "nfType") - modelJson.put("nfType", nfType) - String nfRole = jsonUtils.getJsonValueForKey(vnf, "nfRole") - modelJson.put("nfRole", nfRole) - String nfCode = jsonUtils.getJsonValueForKey(vnf, "nfCode") - modelJson.put("nfNamingCode", nfCode) - String nfFunction = jsonUtils.getJsonValueForKey(vnf, "nfFunction") - modelJson.put("nfFunction", nfFunction) - String multiStageDesign = jsonUtils.getJsonValueForKey(vnf, "multiStageDesign") - modelJson.put("multiStageDesign", multiStageDesign) - break - } - - JSONArray vfModules = null - try { - vfModules = vnf.getJSONArray("vfModules") - } catch (Exception e) - { - msoLogger.debug("Cannot find VF MODULE ARRAY: " + i + ", exception is " + e.message) - } - - if (vfModules != null) { - JSONArray vfModuleInfo = new JSONArray() - for (int j = 0; j < vfModules.length(); j++) { - JSONObject vfModule = vfModules.getJSONObject(j) - JSONObject vfModuleModelInfo = buildModelInfo("vfModule", vfModule, catalogUtilsVersion) - JSONObject vfModuleModelJson = new JSONObject() - vfModuleModelJson.put("modelInfo", vfModuleModelInfo) - String vfModuleType = jsonUtils.getJsonValueForKey(vfModule, "type") - vfModuleModelJson.put("vfModuleType", vfModuleType) - switch(catalogUtilsVersion) { - case "v1": - //TODO this does not work, isBase is not a integer. - Integer isBase = jsonUtils.getJsonIntValueForKey(vfModule, "isBase") - if (isBase.intValue() == 1) { - vfModuleModelJson.put("isBase", "true") - } - else { - vfModuleModelJson.put("isBase", "false") - } - break - default: - boolean isBase = jsonUtils.getJsonBooleanValueForKey(vfModule, "isBase") - vfModuleModelJson.put("isBase", isBase) - break - } - String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label") - vfModuleModelJson.put("vfModuleLabel", vfModuleLabel) - Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount") - vfModuleModelJson.put("initialCount", initialCount.intValue()) - vfModuleInfo.put(vfModuleModelJson) - } - modelJson.put("vfModules", vfModuleInfo) - } - modelInfos.put(modelJson) - } - - String modelInfosString = modelInfos.toString() - msoLogger.debug("Returning vnfs JSON: " + modelInfosString) - - } catch (Exception e) { - utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message) - } - - return modelInfos - } - - /** - * This method parses a Vf Module from the - * Vf Modules array - * - * @param catalogDbResponse - * @param arrayName - * @param catalogUtilsVersion - * @return vfModulelJson - */ - private JSONObject parseVfModuleJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) { - JSONObject vfModulelJson = new JSONObject() - msoLogger.debug("Started Parse Vf Module Json") - try { - JSONObject responseJson = new JSONObject(catalogDbResponse) - JSONArray vfModules = responseJson.getJSONArray(arrayName) - if(vfModules != null){ - JSONObject vfModuleInfo = new JSONObject() - for (int i = 0; i < vfModules.length(); i++) { - JSONObject vfModule = vfModules.getJSONObject(i) - JSONObject vfModuleModelInfo = buildModelInfo("vfModule", vfModule, catalogUtilsVersion) - vfModulelJson.put("modelInfo", vfModuleModelInfo) - String vfModuleType = jsonUtils.getJsonValueForKey(vfModule, "type") - vfModulelJson.put("vfModuleType", vfModuleType) - switch(catalogUtilsVersion) { - case "v1": - Integer isBase = jsonUtils.getJsonIntValueForKey(vfModule, "isBase") - if (isBase.intValue() == 1) { - vfModulelJson.put("isBase", "true") - } - else { - vfModulelJson.put("isBase", "false") - } - break - default: - boolean isBase = jsonUtils.getJsonBooleanValueForKey(vfModule, "isBase") - vfModulelJson.put("isBase", isBase) - break - } - String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label") - vfModulelJson.put("vfModuleLabel", vfModuleLabel) - Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount") - vfModulelJson.put("initialCount", initialCount.intValue()) - } - } - msoLogger.debug("Completed Parsing Vf Module: " + vfModulelJson.toString()) - }catch (Exception e){ - utils.log("DEBUG", "Exception while parsing Vf Modules from Catalog DB Response: " + e.message) - } - - return vfModulelJson - } - - private JSONArray parseAllottedResourcesJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) { - JSONArray modelInfos = null - - msoLogger.debug("parseAllottedResourcesJson - catalogUtilsVersion is " + catalogUtilsVersion) - - try { - // Create array of jsons - - JSONObject responseJson = new JSONObject(catalogDbResponse) - JSONArray allottedResources = responseJson.getJSONArray(arrayName) - modelInfos = new JSONArray() - - for (int i = 0; i < allottedResources.length(); i++) { - JSONObject allottedResource = allottedResources.getJSONObject(i) - JSONObject modelInfo = buildModelInfo("allottedResource", allottedResource, catalogUtilsVersion) - JSONObject modelJson = new JSONObject() - modelJson.put("modelInfo", modelInfo) - switch(catalogUtilsVersion) { - case "v1": - break - default: - String toscaNodeType = jsonUtils.getJsonValueForKey(allottedResource, "toscaNodeType") - modelJson.put("toscaNodeType", toscaNodeType) - String nfType = jsonUtils.getJsonValueForKey(allottedResource, "nfType") - modelJson.put("nfType", nfType) - String nfRole = jsonUtils.getJsonValueForKey(allottedResource, "nfRole") - modelJson.put("nfRole", nfRole) - String nfCode = jsonUtils.getJsonValueForKey(allottedResource, "nfCode") - modelJson.put("nfNamingCode", nfCode) - String nfFunction = jsonUtils.getJsonValueForKey(allottedResource, "nfFunction") - modelJson.put("nfFunction", nfFunction) - String providingServiceModelName = jsonUtils.getJsonValueForKey(allottedResource, "providingServiceModelName") - modelJson.put("providingServiceModelName", providingServiceModelName) - String providingServiceModelUuid = jsonUtils.getJsonValueForKey(allottedResource, "providingServiceModelUuid") - modelJson.put("providingServiceModelUuid", providingServiceModelUuid) - break - } - - - modelInfos.put(modelJson) - } - - String modelInfosString = modelInfos.toString() - msoLogger.debug("Returning allottedResources JSON: " + modelInfosString) - - } catch (Exception e) { - utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message) - } - - return modelInfos - } - - //TODO this is wrong - private JSONObject parseServiceResourcesJson (String catalogDbResponse) { - JSONObject serviceResources = new JSONObject() - String catalogUtilsVersion = "v1" - - try { - // Create array of jsons - - JSONObject responseJson = new JSONObject(catalogDbResponse) - JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources") - JSONArray vnfsArray = parseVnfsJson(serviceResourcesRoot.toString(), "vnfResources", catalogUtilsVersion) - serviceResources.put("vnfs", vnfsArray) - JSONArray networksArray = parseNetworksJson(serviceResourcesRoot.toString(), "networkResourceCustomization", catalogUtilsVersion) - serviceResources.put("networks", networksArray) - JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "allottedResourceCustomization", catalogUtilsVersion) - serviceResources.put("allottedResources", allottedResourcesArray) - - String serviceResourcesString = serviceResources.toString() - msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesString) - - } catch (Exception e) { - utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message) - } - - return serviceResources - } - - private JSONObject parseServiceResourcesJson (String catalogDbResponse, String catalogUtilsVersion) { - JSONObject serviceResources = new JSONObject() - JSONObject serviceResourcesObject = new JSONObject() - String serviceResourcesString = "" - - try { - // Create array of jsons - - JSONObject responseJson = new JSONObject(catalogDbResponse) - JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources") - JSONObject modelInfo = buildModelInfo("", serviceResourcesRoot, catalogUtilsVersion) - serviceResources.put("modelInfo", modelInfo) - JSONArray vnfsArray = parseVnfsJson(serviceResourcesRoot.toString(), "serviceVnfs", catalogUtilsVersion) - serviceResources.put("serviceVnfs", vnfsArray) - JSONArray networksArray = parseNetworksJson(serviceResourcesRoot.toString(), "serviceNetworks", catalogUtilsVersion) - serviceResources.put("serviceNetworks", networksArray) - JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "serviceAllottedResources", catalogUtilsVersion) - serviceResources.put("serviceAllottedResources", allottedResourcesArray) - serviceResourcesObject.put("serviceResources", serviceResources) - - serviceResourcesString = serviceResourcesObject.toString() - msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesString) - - } catch (Exception e) { - utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message) - } - - return serviceResourcesObject - } - - private JSONObject buildModelInfo(String modelType, JSONObject modelFromDb, String catalogUtilsVersion) { - JSONObject modelInfo = null - try { - modelInfo = new JSONObject() - modelInfo.put("modelType", modelType) - String modelInvariantId = jsonUtils.getJsonValueForKey(modelFromDb, "modelInvariantUuid") - modelInfo.put("modelInvariantId", modelInvariantId) - if(modelType.equalsIgnoreCase("allottedResource") || modelType.equalsIgnoreCase("vnf")){ - String modelInstanceName = jsonUtils.getJsonValueForKey(modelFromDb, "modelInstanceName") - modelInfo.put("modelInstanceName", modelInstanceName) - } - if ((!"vfModule".equals(modelType) && !"vnf".equals(modelType)) || !catalogUtilsVersion.equals("v1")) { - String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "modelUuid") - modelInfo.put("modelVersionId", modelVersionId) - } - else { - String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "asdcUuid") - modelInfo.put("modelVersionId", modelVersionId) - } - String modelName = jsonUtils.getJsonValueForKey(modelFromDb, "modelName") - modelInfo.put("modelName", modelName) - String modelVersion = jsonUtils.getJsonValueForKey(modelFromDb, "modelVersion") - modelInfo.put("modelVersion", modelVersion) - if (!"vfModule".equals(modelType)) { - String modelCustomizationName = jsonUtils.getJsonValueForKey(modelFromDb, "modelCustomizationName") - modelInfo.put("modelCustomizationName", modelCustomizationName) - } - String modelCustomizationId = jsonUtils.getJsonValueForKey(modelFromDb, "modelCustomizationUuid") - switch (catalogUtilsVersion) { - case "v1": - modelInfo.put("modelCustomizationId", modelCustomizationId) - break - default: - modelInfo.put("modelCustomizationUuid", modelCustomizationId) - break - } - JSONObject modelJson = new JSONObject() - modelJson.put("modelInfo", modelInfo) - } - catch (Exception e) { - utils.log("ERROR", "Exception while parsing model information: " + e.message) - } - return modelInfo - } - - private String getResponseFromCatalogDb (DelegateExecution execution, String endPoint) { - try { - String catalogDbEndpoint = execution.getVariable("URN_mso_catalog_db_endpoint") - String queryEndpoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + endPoint - RESTConfig config = new RESTConfig(queryEndpoint); - def responseData = '' - def bpmnRequestId = UUID.randomUUID().toString() - RESTClient client = new RESTClient(config). - addHeader('X-TransactionId', bpmnRequestId). - addHeader('X-FromAppId', 'BPMN'). - addHeader('Content-Type', 'application/json'). - addHeader('Accept','application/json'); - - String basicAuthCred = execution.getVariable("BasicAuthHeaderValueDB") - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - msoLogger.debug('sending GET to Catalog DB endpoint: ' + endPoint) - APIResponse response = client.httpGet() - - responseData = response.getResponseBodyAsString() - if (responseData != null) { - msoLogger.debug("Received data from Catalog DB: " + responseData) - } - - msoLogger.debug('Response code:' + response.getStatusCode()) - msoLogger.debug('Response:' + System.lineSeparator() + responseData) - if (response.getStatusCode() == 200) { - // parse response as needed - return responseData - } - else { - return null - } - } - catch (Exception e) { - msoLogger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message) - return null - } - - } - - /** - * get resource recipe by resource model uuid and action - */ - public JSONObject getResourceRecipe(DelegateExecution execution, String resourceModelUuid, String action) { - String endPoint = "/resourceRecipe?resourceModelUuid=" + UriUtils.encode(resourceModelUuid, "UTF-8")+ "&action=" + UriUtils.encode(action, "UTF-8") - JSONObject responseJson = null - try { - msoLogger.debug("ENDPOINT: " + endPoint) - String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) - - if (catalogDbResponse != null) { - responseJson = new JSONObject(catalogDbResponse) - } - } - catch (Exception e) { - utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) - } - - return responseJson - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy deleted file mode 100644 index 57a04e5439..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy +++ /dev/null @@ -1,314 +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.bpmn.common.scripts - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution - - -public class CompleteMsoProcess extends AbstractServiceTaskProcessor { - - String Prefix="CMSO_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - // Complete MSO Request processing - public initializeProcessVariables(DelegateExecution execution){ - - def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - try { - - /* Initialize all the process request variables in this block */ - execution.setVariable("prefix",Prefix) - execution.setVariable("CMSO_request_id","") - execution.setVariable("CMSO_notification-url","") - execution.setVariable("CMSO_mso-bpel-name","") - execution.setVariable("CMSO_request_action","") - execution.setVariable("CMSO_notification-url-Ok", false) - execution.setVariable("CMSO_request_id-Ok", false) - - //updateRequest Adapter process variables - execution.setVariable("CMSO_updateRequestResponse", "") - execution.setVariable("CMSO_updateRequestResponseCode", "") - execution.setVariable("CMSO_updateFinalNotifyAckStatusFailedPayload", "") - - //Set DB adapter variables here - execution.setVariable("CMSO_updateDBStatusToSuccessPayload", "") - execution.setVariable("CMSO_updateInfraRequestDBPayload", "") - execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", "") - - //Auth variables - execution.setVariable("BasicAuthHeaderValue","") - - //Response variables - execution.setVariable("CompletionHandlerResponse","") - execution.setVariable("CMSO_ErrorResponse", null) - execution.setVariable("CMSO_ResponseCode", "") - - setSuccessIndicator(execution, false) - - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) - } - - } - - public void preProcessRequest (DelegateExecution execution) { - - initializeProcessVariables(execution) - def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') -// utils.log("DEBUG", "*** Started CompleteMsoProcess preProcessRequest Method ***", isDebugLogEnabled); - logDebug('Entered ' + method, isDebugLogEnabled) - - setBasicDBAuthHeader(execution, isDebugLogEnabled) - - try { - def xml = execution.getVariable("CompleteMsoProcessRequest") - - utils.logAudit("CompleteMsoProcess Request: " + xml) - utils.log("DEBUG", "Incoming Request is: "+ xml, isDebugLogEnabled) - - //mso-bpel-name from the incoming request - def msoBpelName = utils.getNodeText1(xml,"mso-bpel-name") - execution.setVariable("CMSO_mso-bpel-name",msoBpelName) - - //Check the incoming request type - //Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node) - if (utils.nodeExists(xml, "request-information")) { - execution.setVariable("CMSO_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS - } - - //Check for rehome indicator - def rehomeIndicator = utils.getNodeText1(xml,"rehomeDone") - execution.setVariable("rehomeDone", rehomeIndicator) - - //Check notification-url for the incoming request type - //ACTIVE_REQUESTS may have notificationurl node - //INFRA_ACTIVE_REQUESTS notificationurl node does not exist - def notificationurl = "" - if (utils.nodeExists(xml, "notification-url")) { - notificationurl = utils.getNodeText(xml,"notification-url") - if(notificationurl != null && !notificationurl.isEmpty()) { - execution.setVariable("CMSO_notification-url-Ok", true) - execution.setVariable("CMSO_notification-url",notificationurl) - } - } - - //Check request_id for the incoming request type - //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not) - //For ACTIVE_REQUESTS payload request-id is NOT optional - def request_id = "" - if (utils.nodeExists(xml, "request-id")) { - execution.setVariable("CMSO_request_id",utils.getNodeText(xml,"request-id")) - } - - - // INFRA_ACTIVE_REQUESTS have "action" element ... mandatory - // ACTIVE_REQUEST have "request-action" ... mandatory - if (utils.nodeExists(xml, "request-action")) { - execution.setVariable("CMSO_request_action",utils.getNodeText(xml,"request-action")) - } else if (utils.nodeExists(xml, "action")) { - execution.setVariable("CMSO_request_action",utils.getNodeText(xml,"action")) - } - - //Check source for the incoming request type - //For INFRA_ACTIVE_REQUESTS payload source IS optional - //For ACTIVE_REQUESTS payload source is NOT optional - def source = "" - if (utils.nodeExists(xml, "source")) { - execution.setVariable("CMSO_source",utils.getNodeText(xml,"source")) - } - - utils.log("DEBUG", "CMSO_notification-url-Ok --> " + execution.getVariable("CMSO_notification-url-Ok"), isDebugLogEnabled) - utils.log("DEBUG", "CMSO_request_id-Ok --> " + execution.getVariable("CMSO_request_id-Ok"), isDebugLogEnabled) - - // set the DHV/Service Instantiation values if specified in the request - execution.setVariable("CMSO_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText1(xml, "is-srv-inst-req")))) - utils.log("DEBUG", "CMSO_is_srv_inst_req --> " + execution.getVariable("CMSO_is_srv_inst_req"), isDebugLogEnabled) - execution.setVariable("CMSO_is_json_content", String.valueOf("JSON".equals(utils.getNodeText1(xml, "resp-content-type")))) - utils.log("DEBUG", "CMSO_is_json_content --> " + execution.getVariable("CMSO_is_json_content"), isDebugLogEnabled) - execution.setVariable("CMSO_service_inst_id", utils.getNodeText1(xml, "service-instance-id")) - utils.log("DEBUG", "CMSO_service_inst_id --> " + execution.getVariable("CMSO_service_inst_id"), isDebugLogEnabled) - execution.setVariable("CMSO_start_time", utils.getNodeText1(xml, "start-time")) - utils.log("DEBUG", "CMSO_start_time --> " + execution.getVariable("CMSO_start_time"), isDebugLogEnabled) - // this variable is used by the camunda flow to set the Content-Type for the async response - if (execution.getVariable("CMSO_is_srv_inst_req").equals("true") && - execution.getVariable("CMSO_is_json_content").equals("true")) { - execution.setVariable("CMSO_content_type", "application/json") - } else { - execution.setVariable("CMSO_content_type", "text/xml") - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - utils.log("DEBUG", "Exception Occured During PreProcessRequest: " + e, isDebugLogEnabled); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in " + method) - } - -// utils.log("DEBUG", "*** Completed CompleteMsoProcess preProcessRequest Method ***", isDebugLogEnabled); - } - - public void setUpdateDBstatustoSuccessPayload (DelegateExecution execution){ - - def method = getClass().getSimpleName() + '.setUpdateDBstatustoSuccessPayload(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - - def xml = execution.getVariable("CompleteMsoProcessRequest") - - //Get statusMessage if exists - def statusMessage - if(utils.nodeExists(xml, "status-message")){ - statusMessage = utils.getNodeText1(xml, "status-message") - }else{ - statusMessage = "Resource Completed Successfully" - } - - //Get instance Id if exist - String idXml = "" - if(utils.nodeExists(xml, "vnfId")){ - idXml = utils.getNodeXml(xml, "vnfId") - }else if(utils.nodeExists(xml, "networkId")){ - idXml = utils.getNodeXml(xml, "networkId") - }else if(utils.nodeExists(xml, "configurationId")){ - idXml = utils.getNodeXml(xml, "configurationId") - }else if(utils.nodeExists(xml, "serviceInstanceId")){ - idXml = utils.getNodeXml(xml, "serviceInstanceId") - }else if(utils.nodeExists(xml, "vfModuleId")){ - idXml = utils.getNodeXml(xml, "vfModuleId") - }else if(utils.nodeExists(xml, "volumeGroupId")){ - idXml = utils.getNodeXml(xml, "volumeGroupId") - }else{ - idXml = "" - } - idXml = utils.removeXmlPreamble(idXml) - utils.log("DEBUG", "Incoming Instance Id Xml: " + idXml, isDebugLogEnabled) - - String payload = """ - - - - - ${execution.getVariable("CMSO_request_id")} - ${execution.getVariable("CMSO_mso-bpel-name")} - ${statusMessage} - COMPLETE - 100 - ${idXml} - - - """ - - execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", payload) - utils.log("DEBUG", "Outgoing Update Mso Request Payload is: " + payload, isDebugLogEnabled) - utils.logAudit("setUpdateDBstatustoSuccessPayload: " + payload) - - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) - } - logDebug('Exited ' + method, isDebugLogEnabled) - } - - public void buildDataError (DelegateExecution execution, String message) { - - def method = getClass().getSimpleName() + '.buildDataError(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - try { - - def msoCompletionResponse = """ - - BPEL ${execution.getVariable("CMSO_mso-bpel-name")} FAILED - - """.trim() - - // Format Response - def xmlMsoCompletionResponse = utils.formatXml(msoCompletionResponse) - String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim() - utils.logAudit("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString) - execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString) - utils.log("DEBUG", "@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompletionHandlerResponse"), isDebugLogEnabled) - - exceptionUtil.buildAndThrowWorkflowException(execution, 500, message) - - } catch (BpmnError e) { - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugLogEnabled) - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) - } - - } - - public void postProcessResponse (DelegateExecution execution) { - - def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - // utils.log("DEBUG", "*** Started CompleteMsoProcess PostProcessRequest Method ***", isDebugLogEnabled); - try { - - def msoCompletionResponse = """ - - BPEL ${execution.getVariable("CMSO_mso-bpel-name")} completed - - """.trim() - - // Format Response - def xmlMsoCompletionResponse = utils.formatXML(msoCompletionResponse) - String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim() - // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead - execution.setVariable("WorkflowResponse", buildMsoCompletionResponseAsString) - utils.logAudit("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString) - execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString) - execution.setVariable("CMSO_ResponseCode", "200") - - setSuccessIndicator(execution, true) - - utils.log("DEBUG", "@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompleteMsoProcessResponse"), isDebugLogEnabled) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) - } - // utils.log("DEBUG", "*** Completed CompleteMsoProcess PostProcessRequest Method ***", isDebugLogEnabled); - - } - - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy deleted file mode 100644 index 615e25de71..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy +++ /dev/null @@ -1,159 +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.bpmn.common.scripts -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.rest.APIResponse - - -public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ - - def Prefix="CVGN_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable("prefix",Prefix) - execution.setVariable("CVGN_volumeGroupId",null) - execution.setVariable("CVGN_volumeGroupName",null) - execution.setVariable("CVGN_aicCloudRegion", null) - execution.setVariable("CVGN_volumeGroupGetEndpoint",null) - - // ConfirmVolumeGroupName workflow response variable placeholders - execution.setVariable("CVGN_volumeGroupNameMatches", false) - execution.setVariable("CVGN_queryVolumeGroupResponseCode",null) - execution.setVariable("CVGN_queryVolumeGroupResponse","") - execution.setVariable("CVGN_ResponseCode",null) -// execution.setVariable("CVGN_ErrorResponse","") - execution.setVariable("RollbackData", null) - } - - // store the incoming data in the flow DelegateExecution - public void preProcessRequest(DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - def volumeGroupId = execution.getVariable("ConfirmVolumeGroupName_volumeGroupId") - def volumeGroupName= execution.getVariable("ConfirmVolumeGroupName_volumeGroupName") - def aicCloudRegion = execution.getVariable("ConfirmVolumeGroupName_aicCloudRegion") - - initProcessVariables(execution) - execution.setVariable("CVGN_volumeGroupId", volumeGroupId) - execution.setVariable("CVGN_volumeGroupName", volumeGroupName) - execution.setVariable("CVGN_aicCloudRegion", aicCloudRegion) - - AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getCloudInfrastructureCloudRegionUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - utils.logAudit("AAI URI: " + aai_uri) - execution.setVariable("CVGN_volumeGroupGetEndpoint","${aai_uri}/${aicCloudRegion}/volume-groups/volume-group/" + - volumeGroupId) - } - - // send a GET request to AA&I to retrieve the Volume information based on volume-group-id - // expect a 200 response with the information in the response body or a 404 if the volume group id does not exist - public void queryAAIForVolumeGroupId(DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CVGN_volumeGroupGetEndpoint") - - try { - logDebug("invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint,isDebugLogEnabled) - utils.log("DEBUG","queryAAIForVolumeGroupId() endpoint-" + endPoint, isDebugLogEnabled) - utils.logAudit("ConfirmVolumeGroup sending GET call to AAI Endpoint: " + endPoint) - - AaiUtil aaiUtil = new AaiUtil(this) - APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) - def responseData = response.getResponseBodyAsString() - def responseStatusCode = response.getStatusCode() - execution.setVariable("CVGN_queryVolumeGroupResponseCode", responseStatusCode) - execution.setVariable("CVGN_queryVolumeGroupResponse", responseData) - - utils.logAudit("Response code:" + responseStatusCode) - utils.logAudit("Response:" + responseData) - logDebug("Response code:" + responseStatusCode, isDebugLogEnabled) - logDebug("Response:" + System.lineSeparator()+responseData,isDebugLogEnabled) - } catch (Exception ex) { - // ex.printStackTrace() - logDebug("Exception occurred while executing AAI GET:" + ex.getMessage(),isDebugLogEnabled) - execution.setVariable("CVGN_queryVolumeGroupResponseCode", 500) - execution.setVariable("CVGN_queryVolumeGroupResponse", "AAI GET Failed:" + ex.getMessage()) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "AAI GET Failed") - } - } - - // process the result from queryAAIVolumeGroupId() - - public void checkAAIQueryResult(DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - def result = execution.getVariable("CVGN_queryVolumeGroupResponse") - - if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 404) { - logDebug('volumeGroupId does not exist in AAI', isDebugLogEnabled) - } - else if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 200) { - logDebug("volumeGroupId exists in AAI", isDebugLogEnabled) - } - def xml = execution.getVariable("CVGN_queryVolumeGroupResponse") - def actualVolumeGroupName = "" - if (utils.nodeExists(xml, "volume-group-name")) { - actualVolumeGroupName = utils.getNodeText(xml, "volume-group-name") - } - execution.setVariable("CVGN_volumeGroupNameMatches", false) - def volumeGroupName = execution.getVariable("CVGN_volumeGroupName") - - if (volumeGroupName.equals(actualVolumeGroupName)) { - logDebug('Volume Group Name Matches AAI records', isDebugLogEnabled) - execution.setVariable("CVGN_volumeGroupNameMatches", true) - } - } - - - // generates a WorkflowException if the A&AI query returns a response code other than 200/404 - public void handleAAIQueryFailure(DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - - logError("Error occurred attempting to query AAI, Response Code " + - execution.getVariable("CVGN_queryVolumeGroupResponseCode") + ", Error Response " + - execution.getVariable("CVGN_queryVolumeGroupResponse")) - //String processKey = getProcessKey(execution); - //WorkflowException exception = new WorkflowException(processKey, 5000, - //execution.getVariable("CVGN_queryVolumeGroupResponse")) - //execution.setVariable("WorkflowException", exception) - } - - // generates a WorkflowException if the volume group name does not match AAI record for this volume group - public void handleVolumeGroupNameNoMatch(DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - - def errorNotAssociated = "Error occurred - volume group id " + execution.getVariable("CVGN_volumeGroupId") + - " is not associated with " + execution.getVariable("CVGN_volumeGroupName") - logError(errorNotAssociated) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated) - //String processKey = getProcessKey(execution); - //WorkflowException exception = new WorkflowException(processKey, 1002, - // errorNotAssociated) - //execution.setVariable("WorkflowException", exception) - } - - // sends a successful WorkflowResponse - public void reportSuccess(DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - logDebug("Sending 200 back to the caller", isDebugLogEnabled) - def responseXML = "" - execution.setVariable("WorkflowResponse", responseXML) - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy deleted file mode 100644 index ecb18043a7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy +++ /dev/null @@ -1,193 +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.bpmn.common.scripts - -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource - - -/** - * Vnf Module Subflow for confirming the volume group belongs - * to the tenant - * - * @param tenantId - * @param volumeGroupId - * - */ -class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ - - String Prefix="CVGT_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - public void preProcessRequest(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - utils.log("DEBUG", " ======== STARTED Confirm Volume Group Tenant Subflow ======== ", isDebugEnabled) - String processKey = getProcessKey(execution); - try{ - utils.log("DEBUG", " === Started QueryAAIForVolumeGroup Process === ", isDebugEnabled) - - String volumeGroupId = execution.getVariable("volumeGroupId") - String incomingGroupName = execution.getVariable("volumeGroupName") - String incomingTenantId = execution.getVariable("tenantId") - def aicCloudRegion = execution.getVariable("aicCloudRegion") - String aai = execution.getVariable("URN_aai_endpoint") - - AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getCloudInfrastructureCloudRegionUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) - - String path = aai + "${aai_uri}/${aicCloudRegion}/volume-groups/volume-group/" + volumeGroupId - - APIResponse queryAAIForVolumeGroupResponse = aaiUriUtil.executeAAIGetCall(execution, path) - - def responseCode = queryAAIForVolumeGroupResponse.getStatusCode() - execution.setVariable("queryVolumeGroupResponseCode", responseCode) - String response = queryAAIForVolumeGroupResponse.getResponseBodyAsString() - response = StringEscapeUtils.unescapeXml(response) - - utils.logAudit("ConfirmVolumeGroup Response: " + response) - utils.logAudit("ConfirmVolumeGroup Response Code: " + responseCode) - - if(responseCode == 200 && response != null){ - execution.setVariable("queryAAIVolumeGroupResponse", response) - utils.log("DEBUG", "QueryAAIForVolumeGroup Received a Good REST Response is: \n" + response, isDebugEnabled) - - String volumeGroupTenantId = "" - InputSource source = new InputSource(new StringReader(response)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docFactory.setNamespaceAware(true) - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document createVCERequestXml = docBuilder.parse(source) - NodeList nodeList = createVCERequestXml.getElementsByTagNameNS("*", "relationship") - for (int x = 0; x < nodeList.getLength(); x++) { - Node node = nodeList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String e = eElement.getElementsByTagNameNS("*", "related-to").item(0).getTextContent() - if(e.equals("tenant")){ - NodeList relationDataList = eElement.getElementsByTagNameNS("*", "relationship-data") - for (int d = 0; d < relationDataList.getLength(); d++) { - Node dataNode = relationDataList.item(d) - if (dataNode.getNodeType() == Node.ELEMENT_NODE) { - Element dElement = (Element) dataNode - String key = dElement.getElementsByTagNameNS("*", "relationship-key").item(0).getTextContent() - if(key.equals("tenant.tenant-id")){ - volumeGroupTenantId = dElement.getElementsByTagNameNS("*", "relationship-value").item(0).getTextContent() - } - } - } - } - } - } - - //Determine if Tenant Ids match - if(incomingTenantId.equals(volumeGroupTenantId)){ - utils.log("DEBUG", "Tenant Ids Match", isDebugEnabled) - execution.setVariable("tenantIdsMatch", true) - }else{ - utils.log("DEBUG", "Tenant Ids DO NOT Match", isDebugEnabled) - execution.setVariable("tenantIdsMatch", false) - } - - //Determine if Volume Group Names match - String volumeGroupName = utils.getNodeText1(response, "volume-group-name") - if(incomingGroupName == null || incomingGroupName.length() < 1){ - utils.log("DEBUG", "Incoming Volume Group Name is NOT Provided.", isDebugEnabled) - execution.setVariable("groupNamesMatch", true) - }else{ - utils.log("DEBUG", "Incoming Volume Group Name is: " + incomingGroupName, isDebugEnabled) - if(volumeGroupName.equals(incomingGroupName)){ - utils.log("DEBUG", "Volume Group Names Match.", isDebugEnabled) - execution.setVariable("groupNamesMatch", true) - }else{ - utils.log("DEBUG", "Volume Group Names DO NOT Match.", isDebugEnabled) - execution.setVariable("groupNamesMatch", false) - } - } - }else{ - utils.log("DEBUG", "QueryAAIForVolumeGroup Bad REST Response!", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1, "Error Searching AAI for Volume Group. Received a Bad Response.") - } - - }catch(BpmnError b){ - throw b - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing queryAAIForVolumeGroup. Exception is:\n" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in preProcessRequest.") - } - utils.log("DEBUG", "=== COMPLETED queryAAIForVolumeGroup Process === ", isDebugEnabled) - } - - public void assignVolumeHeatId(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - try{ - utils.log("DEBUG", " === Started assignVolumeHeatId Process === ", isDebugEnabled) - - String response = execution.getVariable("queryAAIVolumeGroupResponse") - String heatStackId = utils.getNodeText1(response, "heat-stack-id") - execution.setVariable("volumeHeatStackId", heatStackId) - execution.setVariable("ConfirmVolumeGroupTenantResponse", heatStackId) - // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead - execution.setVariable("WorkflowResponse", heatStackId) - utils.log("DEBUG", "Volume Heat Stack Id is: " + heatStackId, isDebugEnabled) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing assignVolumeHeatId. Exception is:\n" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in assignVolumeHeatId.") - } - utils.log("DEBUG", "=== COMPLETED assignVolumeHeatId Process === ", isDebugEnabled) - utils.log("DEBUG", "======== COMPLETED Confirm Volume Group Tenant Subflow ======== ", isDebugEnabled) -} - - public void assignWorkflowException(DelegateExecution execution, String message){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - String processKey = getProcessKey(execution); - utils.log("DEBUG", " === STARTED Assign Workflow Exception === ", isDebugEnabled) - try{ - String volumeGroupId = execution.getVariable("volumeGroupId") - int errorCode = 1 - String errorMessage = "Volume Group " + volumeGroupId + " " + message - - exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage) - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing assignWorkflowException. Exception is:\n" + e, isDebugEnabled) - } - utils.log("DEBUG", "=== COMPLETED Assign Workflow Exception ==== ", isDebugEnabled) - } - - - -} - diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy deleted file mode 100644 index 41036e7f43..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy +++ /dev/null @@ -1,635 +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.bpmn.common.scripts -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse -import org.springframework.web.util.UriUtils - - -public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ - - def Prefix="CAAIVfMod_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable("prefix",Prefix) - execution.setVariable("CAAIVfMod_vnfId",null) - execution.setVariable("CAAIVfMod_vnfName",null) - execution.setVariable("CAAIVfMod_vnfType",null) - execution.setVariable("CAAIVfMod_serviceId",null) - execution.setVariable("CAAIVfMod_personaId",null) - execution.setVariable("CAAIVfMod_personaVer",null) - execution.setVariable("CAAIVfMod_modelCustomizationId",null) - execution.setVariable("CAAIVfMod_vnfPersonaId",null) - execution.setVariable("CAAIVfMod_vnfPersonaVer",null) - execution.setVariable("CAAIVfMod_isBaseVfModule", false) - execution.setVariable("CAAIVfMod_moduleName",null) - execution.setVariable("CAAIVfMod_moduleModelName",null) - execution.setVariable("CAAIVfMod_newGenericVnf",false) - execution.setVariable("CAAIVfMod_genericVnfGetEndpoint",null) - execution.setVariable("CAAIVfMod_genericVnfPutEndpoint",null) - execution.setVariable("CAAIVfMod_aaiNamespace",null) - execution.setVariable("CAAIVfMod_moduleExists",false) - execution.setVariable("CAAIVfMod_baseModuleConflict", false) - execution.setVariable("CAAIVfMod_vnfNameFromAAI", null) - - - // CreateAAIVfModule workflow response variable placeholders - execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode",null) - execution.setVariable("CAAIVfMod_queryGenericVnfResponse","") - execution.setVariable("CAAIVfMod_createGenericVnfResponseCode",null) - execution.setVariable("CAAIVfMod_createGenericVnfResponse","") - execution.setVariable("CAAIVfMod_createVfModuleResponseCode",null) - execution.setVariable("CAAIVfMod_createVfModuleResponse","") - execution.setVariable("CAAIVfMod_parseModuleResponse","") - execution.setVariable("CAAIVfMod_deleteGenericVnfResponseCode",null) - execution.setVariable("CAAIVfMod_deleteGenericVnfResponse","") - execution.setVariable("CAAIVfMod_deleteVfModuleResponseCode",null) - execution.setVariable("CAAIVfMod_deleteVfModuleResponse","") -// execution.setVariable("CAAIVfMod_ResponseCode",null) -// execution.setVariable("CAAIVfMod_ErrorResponse","") - execution.setVariable("CreateAAIVfModuleResponse","") - execution.setVariable("RollbackData", null) - - } - - // parse the incoming CREATE_VF_MODULE request and store the Generic VNF - // and VF Module data in the flow DelegateExecution - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - initProcessVariables(execution) - - def vnfId = execution.getVariable("vnfId") - if (vnfId == null || vnfId.isEmpty()) { - execution.setVariable("CAAIVfMod_newGenericVnf", true) - execution.setVariable("CAAIVfMod_vnfId","") - } - else { - execution.setVariable("CAAIVfMod_vnfId",vnfId) - } - - def vnfName = execution.getVariable("vnfName") - execution.setVariable("CAAIVfMod_vnfName", vnfName) - - String vnfType = execution.getVariable("vnfType") - if (vnfType != null && !vnfType.isEmpty()) { - execution.setVariable("CAAIVfMod_vnfType", vnfType) - } else { - execution.setVariable("CAAIVfMod_vnfType","") - } - - execution.setVariable("CAAIVfMod_serviceId", execution.getVariable("serviceId")) - - String personaModelId = execution.getVariable("personaModelId") - - if (personaModelId != null && !personaModelId.isEmpty()) { - execution.setVariable("CAAIVfMod_personaId",personaModelId) - } else { - execution.setVariable("CAAIVfMod_personaId","") - } - - String personaModelVersion = execution.getVariable("personaModelVersion") - - if (personaModelVersion != null && !personaModelVersion.isEmpty()) { - execution.setVariable("CAAIVfMod_personaVer", personaModelVersion) - } else { - execution.setVariable("CAAIVfMod_personaVer","") - } - - - String modelCustomizationId = execution.getVariable("modelCustomizationId") - - if (modelCustomizationId != null && !modelCustomizationId.isEmpty()) { - execution.setVariable("CAAIVfMod_modelCustomizationId",modelCustomizationId) - } else { - execution.setVariable("CAAIVfMod_modelCustomizationId","") - } - - String vnfPersonaModelId = execution.getVariable("vnfPersonaModelId") - - if (vnfPersonaModelId != null && !vnfPersonaModelId.isEmpty()) { - execution.setVariable("CAAIVfMod_vnfPersonaId",vnfPersonaModelId) - } else { - execution.setVariable("CAAIVfMod_vnfPersonaId","") - } - - String vnfPersonaModelVersion = execution.getVariable("vnfPersonaModelVersion") - - if (vnfPersonaModelVersion != null && !vnfPersonaModelVersion.isEmpty()) { - execution.setVariable("CAAIVfMod_vnfPersonaVer",vnfPersonaModelVersion) - } else { - execution.setVariable("CAAIVfMod_vnfPersonaVer","") - } - - //isBaseVfModule - Boolean isBaseVfModule = false - String isBaseVfModuleString = execution.getVariable("isBaseVfModule") - if (isBaseVfModuleString != null && isBaseVfModuleString.equals("true")) { - isBaseVfModule = true - } - execution.setVariable("CAAIVfMod_isBaseVfModule", isBaseVfModule) - - String isVidRequest = execution.getVariable("isVidRequest") - if (isVidRequest != null && "true".equals(isVidRequest)) { - logDebug("VID Request received", isDebugEnabled) - } - - execution.setVariable("CAAIVfMod_moduleName",execution.getVariable("vfModuleName")) - execution.setVariable("CAAIVfMod_moduleModelName",execution.getVariable("vfModuleModelName")) - - AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) - String aaiNamespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) - logDebug('AAI namespace is: ' + aaiNamespace, isDebugEnabled) - - execution.setVariable("CAAIVfMod_aaiNamespace","${aaiNamespace}") - - if (vnfId == null || vnfId.isEmpty()) { - // TBD - assert that the vnfName is not empty - execution.setVariable("CAAIVfMod_genericVnfGetEndpoint", - "${aai_uri}/?vnf-name=" + - UriUtils.encode(vnfName,"UTF-8") + "&depth=1") - } else { - execution.setVariable("CAAIVfMod_genericVnfGetEndpoint", - "${aai_uri}/" + UriUtils.encode(vnfId,"UTF-8") + "?depth=1") - } - - utils.logAudit("CreateAAIVfModule VNF PUT Endpoint: ${aai_uri}/") - execution.setVariable("CAAIVfMod_genericVnfPutEndpoint","${aai_uri}/") - } - - // send a GET request to AA&I to retrieve the Generic VNF/VF Module information based on a Vnf Name - // expect a 200 response with the information in the response body or a 404 if the Generic VNF does not exist - public void queryAAIForGenericVnf(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CAAIVfMod_genericVnfGetEndpoint") - - try { - utils.log("DEBUG","queryAAIForGenericVnf() endpoint-" + endPoint, isDebugEnabled) - utils.log("DEBUG", "invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint,isDebugEnabled) - utils.logAudit("CreateAAIVfModule sending GET call to AAI Endpoint: " + endPoint) - - AaiUtil aaiUtil = new AaiUtil(this) - APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) - def responseData = response.getResponseBodyAsString() - def statusCode = response.getStatusCode() - execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode", statusCode) - execution.setVariable("CAAIVfMod_queryGenericVnfResponse", responseData) - - utils.logAudit("CreateAAIVfModule Response Code: " + statusCode) - utils.logAudit("CreateAAIVfModule Response data: " + responseData) - utils.log("DEBUG", "Response code:" + statusCode, isDebugEnabled) - utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled) - } catch (Exception ex) { - utils.log("DEBUG", "Exception occurred while executing AAI GET:" + ex.getMessage(),isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in queryAAIForGenericVnf.") - - } - } - - // process the result from queryAAIForGenericVnf() - // note: this method is primarily for logging as the actual decision logic is embedded in the bpmn flow - public void processAAIGenericVnfQuery(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def result = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") - - if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 && - execution.getVariable("CAAIVfMod_vnfId").isEmpty()) { - utils.log("DEBUG", "New Generic VNF requested and it does not already exist", isDebugEnabled) - } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200 && - !execution.getVariable("CAAIVfMod_vnfId").isEmpty()) { - utils.log("DEBUG", "Adding module to existing Generic VNF", isDebugEnabled) - } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200 && - execution.getVariable("CAAIVfMod_vnfId").isEmpty()) { - utils.log("DEBUG", "Invalid request for new Generic VNF which already exists", isDebugEnabled) - execution.setVariable("CAAIVfMod_queryGenericVnfResponse", - "Invalid request for new Generic VNF which already exists, Vnf Name=" + - execution.getVariable("CAAIVfMod_vnfName")) - } else { // execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 && - // !execution.getVariable("CAAIVfMod_vnfId").isEmpty()) - utils.log("DEBUG", "Invalid request for Add-on Module requested for non-existant Generic VNF", isDebugEnabled) - execution.setVariable("CAAIVfMod_createVfModuleResponse", - "Invalid request for Add-on Module requested for non-existant Generic VNF, VNF Id=" + - execution.getVariable("CAAIVfMod_vnfId")) - } - } - - // construct and send a PUT request to A&AI to create a new Generic VNF - // note: to get here, the vnf-id in the original CREATE_VF_MODULE request was absent or "" - public void createGenericVnf(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - // TBD - is this how we want to generate the Id for the new Generic VNF? - def newVnfId = UUID.randomUUID().toString() - def endPoint = execution.getVariable("URN_aai_endpoint") + - execution.getVariable("CAAIVfMod_genericVnfPutEndpoint") + newVnfId - // update the flow execution with the new Vnf Id - execution.setVariable("CAAIVfMod_vnfId",newVnfId) - - // AaiUriUtil aaiUriUtil = new AaiUriUtil(this) - // def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - // logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) - // String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) - // logDebug('AAI namespace is: ' + namespace, isDebugEnabled) - - - String payload = """ - ${newVnfId} - ${execution.getVariable("CAAIVfMod_vnfName")} - ${execution.getVariable("CAAIVfMod_vnfType")} - ${execution.getVariable("CAAIVfMod_serviceId")} - Active - ${execution.getVariable("CAAIVfMod_vnfPersonaId")} - ${execution.getVariable("CAAIVfMod_vnfPersonaVer")} - """ as String - execution.setVariable("CAAIVfMod_createGenericVnfPayload", payload) - - try { - utils.log("DEBUG","createGenericVnf() endpoint-" + endPoint, isDebugEnabled) - utils.log("DEBUG", "invoking PUT call to AAI with payload:"+System.lineSeparator()+payload,isDebugEnabled) - utils.logAudit("Sending PUT call to AAI with Endpoint /n" + endPoint + " with payload /n" + payload) - - AaiUtil aaiUtil = new AaiUtil(this); - APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload); - def responseData = response.getResponseBodyAsString() - def responseStatusCode = response.getStatusCode() - execution.setVariable("CAAIVfMod_createGenericVnfResponseCode", responseStatusCode) - execution.setVariable("CAAIVfMod_createGenericVnfResponse", responseData) - - utils.logAudit("Response Code: " + responseStatusCode) - utils.logAudit("Response Data: " + responseData) - utils.log("DEBUG", "Response code:" + responseStatusCode, isDebugEnabled) - utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled) - } catch (Exception ex) { - ex.printStackTrace() - utils.log("DEBUG", "Exception occurred while executing AAI PUT:" + ex.getMessage(),isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createGenericVnf.") - } - } - - // construct and send a PUT request to A&AI to create a Base or Add-on VF Module - public void createVfModule(DelegateExecution execution, Boolean isBaseModule) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - // TBD - is this how we want to generate the Id for the new (Base) VF Module? - - // Generate the new VF Module ID here if it has not been provided by the parent process - def newModuleId = execution.getVariable('newVfModuleId') - if (newModuleId == null || newModuleId.isEmpty()) { - newModuleId = UUID.randomUUID().toString() - } - def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CAAIVfMod_genericVnfPutEndpoint") - // need to append the existing Vnf Id or the one generated in createGenericVnf() to the url - endPoint = endPoint + UriUtils.encode(execution.getVariable("CAAIVfMod_vnfId"), "UTF-8") + - "/vf-modules/vf-module/" + newModuleId; - int moduleIndex = 0 - if (!isBaseModule) { - def aaiVnfResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") - AaiUtil aaiUtil = new AaiUtil(this) - def personaModelId = execution.getVariable("CAAIVfMod_personaId") - - // Check if the response includes model-invariant-id or persona-model-id - // note: getRequiredNodeText() throws an exception if the field is missing - // need to retun a null for the subsequent "either/or" logic to work properly -// def modelInvariantId = getRequiredNodeText(execution, aaiVnfResponse,'model-invariant-id') - def modelInvariantId = getNodeText(aaiVnfResponse,'model-invariant-id', null) - def fieldToCheck = 'model-invariant-id' - if (!modelInvariantId) { - fieldToCheck = 'persona-model-id' - } - - moduleIndex = aaiUtil.getLowestUnusedVfModuleIndexFromAAIVnfResponse(execution, aaiVnfResponse, - fieldToCheck, personaModelId) - } - def moduleIndexString = String.valueOf(moduleIndex) - - // if we get to this point, we may be about to create the Vf Module, - // add rollback information about the Generic VNF for this base/add-on module - def rollbackData = execution.getVariable("RollbackData") - if (rollbackData == null) { - rollbackData = new RollbackData(); - } - rollbackData.put("VFMODULE", "vnfId", execution.getVariable("CAAIVfMod_vnfId")) - rollbackData.put("VFMODULE", "vnfName", execution.getVariable("CAAIVfMod_vnfName")) - rollbackData.put("VFMODULE", "isBaseModule", isBaseModule.toString()) - execution.setVariable("RollbackData", rollbackData) - utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled) - String payload = """ - ${newModuleId} - ${execution.getVariable("CAAIVfMod_moduleName")} - ${execution.getVariable("CAAIVfMod_personaId")} - ${execution.getVariable("CAAIVfMod_personaVer")} - ${execution.getVariable("CAAIVfMod_modelCustomizationId")} - ${isBaseModule} - PendingCreate - ${moduleIndex} - """ as String - execution.setVariable("CAAIVfMod_createVfModulePayload", payload) - - try { - utils.log("DEBUG","createVfModule() endpoint-" + endPoint, isDebugEnabled) - utils.log("DEBUG", "invoking PUT call to AAI with payload:"+System.lineSeparator()+payload,isDebugEnabled) - utils.logAudit("CreateAAIVfModule sending PUT call to AAI with endpoint /n" + endPoint + " with payload /n " + payload) - - AaiUtil aaiUtil = new AaiUtil(this) - APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload) - def responseData = response.getResponseBodyAsString() - def statusCode = response.getStatusCode() - execution.setVariable("CAAIVfMod_createVfModuleResponseCode", statusCode) - execution.setVariable("CAAIVfMod_createVfModuleResponse", responseData) - - utils.log("DEBUG", "Response code:" + statusCode, isDebugEnabled) - utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled) - utils.logAudit("Response Code: " + statusCode) - utils.logAudit("Response data: " + responseData) - // the base or add-on VF Module was successfully created, - // add the module name to the rollback data and the response - if (isOneOf(statusCode, 200, 201)) { - rollbackData.put("VFMODULE", "vfModuleId", newModuleId) - rollbackData.put("VFMODULE", "vfModuleName", execution.getVariable("CAAIVfMod_moduleName")) - execution.setVariable("RollbackData", rollbackData) - utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled) - - String responseOut = "" - - String isVidRequest = execution.getVariable("isVidRequest") - - if (isBaseModule && (isVidRequest == null || "false".equals(isVidRequest))) { - - responseOut = """ - ${execution.getVariable("CAAIVfMod_vnfId")} - ${newModuleId} - ${moduleIndexString} - """ as String - } - else { - responseOut = """ - ${execution.getVariable("CAAIVfMod_vnfNameFromAAI")} - ${execution.getVariable("CAAIVfMod_vnfId")} - ${newModuleId} - ${moduleIndexString} - """ as String - } - - execution.setVariable("CreateAAIVfModuleResponse", responseOut) - utils.log("DEBUG", "CreateAAIVfModuleResponse:" + System.lineSeparator()+responseOut,isDebugEnabled) - utils.logAudit("CreateAAIVfModule Response /n " + responseOut) - } - } catch (Exception ex) { - utils.log("DEBUG", "Exception occurred while executing AAI PUT:" + ex.getMessage(),isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createVfModule.") - } - } - - // parses the output from the result from queryAAIForGenericVnf() to determine if the vf-module-name - // requested for an Add-on VF Module does not already exist for the specified Generic VNF - // also retrieves VNF name from AAI response for existing VNF - public void parseForAddOnModule(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def xml = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") - def vnfNameFromAAI = utils.getNodeText1(xml, "vnf-name") - execution.setVariable("CAAIVfMod_vnfNameFromAAI", vnfNameFromAAI) - utils.log("DEBUG", "Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI) - def newModuleName = execution.getVariable("CAAIVfMod_moduleName") - utils.log("DEBUG", "VF Module to be added: " + newModuleName, isDebugEnabled) - def qryModuleNameList = utils.getMultNodes(xml, "vf-module-name") - execution.setVariable("CAAIVfMod_moduleExists", false) - if (qryModuleNameList != null) { - utils.log("DEBUG", "Existing VF Module List: " + qryModuleNameList, isDebugEnabled) - for (String qryModuleName : qryModuleNameList) { - if (newModuleName.equals(qryModuleName)) { - // a module with the requested name already exists - failure - utils.log("DEBUG", "VF Module " + qryModuleName + " already exists for Generic VNF " + - execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled) - execution.setVariable("CAAIVfMod_moduleExists", true) - execution.setVariable("CAAIVfMod_parseModuleResponse", - "VF Module " + qryModuleName + " already exists for Generic VNF " + - execution.getVariable("CAAIVfMod_vnfNameFromAAI")) - break - } - } - } - if (execution.getVariable("CAAIVfMod_moduleExists") == false) { - utils.log("DEBUG", "VF Module " + execution.getVariable("CAAIVfMod_moduleName") + - " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled) - execution.setVariable("CAAIVfMod_parseModuleResponse", - "VF Module " + newModuleName + " does not exist for Generic VNF " + - execution.getVariable("CAAIVfMod_vnfNameFromAAI")) - } - } - - // parses the output from the result from queryAAIForGenericVnf() to determine if the vf-module-name - // requested for an Add-on VF Module does not already exist for the specified Generic VNF; - // also retrieves VNF name from AAI response for existing VNF - public void parseForBaseModule(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def xml = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") - def vnfNameFromAAI = utils.getNodeText1(xml, "vnf-name") - execution.setVariable("CAAIVfMod_vnfNameFromAAI", vnfNameFromAAI) - utils.log("DEBUG", "Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI) - def newModuleName = execution.getVariable("CAAIVfMod_moduleName") - utils.log("DEBUG", "VF Module to be added: " + newModuleName, isDebugEnabled) - def qryModuleNameList = utils.getMultNodes(xml, "vf-module-name") - execution.setVariable("CAAIVfMod_moduleExists", false) - if (qryModuleNameList != null) { - utils.log("DEBUG", "Existing VF Module List: " + qryModuleNameList, isDebugEnabled) - for (String qryModuleName : qryModuleNameList) { - if (newModuleName.equals(qryModuleName)) { - // a module with the requested name already exists - failure - utils.log("DEBUG", "VF Module " + qryModuleName + " already exists for Generic VNF " + - execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled) - execution.setVariable("CAAIVfMod_baseModuleConflict", true) - execution.setVariable("CAAIVfMod_parseModuleResponse", - "VF Module " + qryModuleName + " already exists for Generic VNF " + - execution.getVariable("CAAIVfMod_vnfNameFromAAI")) - break - } - } - } - def isBaseVfModuleList = utils.getMultNodes(xml, "is-base-vf-module") - if (isBaseVfModuleList != null && !execution.getVariable("CAAIVfMod_baseModuleConflict")) { - - for (String baseValue : isBaseVfModuleList) { - if (baseValue.equals("true")) { - // a base module already exists in this VNF - failure - utils.log("DEBUG", "Base VF Module already exists for Generic VNF " + - execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled) - execution.setVariable("CAAIVfMod_baseModuleConflict", true) - execution.setVariable("CAAIVfMod_parseModuleResponse", - "Base VF Module already exists for Generic VNF " + - execution.getVariable("CAAIVfMod_vnfNameFromAAI")) - break - } - } - - } - if (execution.getVariable("CAAIVfMod_moduleExists") == false && execution.getVariable("CAAIVfMod_baseModuleConflict") == false) { - utils.log("DEBUG", "VF Module " + execution.getVariable("CAAIVfMod_moduleName") + - " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled) - execution.setVariable("CAAIVfMod_parseModuleResponse", - "VF Module " + newModuleName + " does not exist for Generic VNF " + - execution.getVariable("CAAIVfMod_vnfNameFromAAI")) - } - } - - // generates a WorkflowException when the A&AI query returns a response code other than 200 or 404 - public void handleAAIQueryFailure(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - utils.log("ERROR", "Error occurred attempting to query AAI, Response Code " + - execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + - execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), isDebugEnabled) - int code = execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") - exceptionUtil.buildAndThrowWorkflowException(execution, code, "Error occurred attempting to query AAI") - - } - - // generates a WorkflowException if - // - the A&AI Generic VNF PUT returns a response code other than 200 or 201 - // - the requested Generic VNF already exists but vnf-id == null - // - the requested Generic VNF does not exist but vnf-id != null - // - the A&AI VF Module PUT returns a response code other than 200 or 201 - // - the requested VF Module already exists for the Generic VNF - public void handleCreateVfModuleFailure(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - def errorCode - def errorResponse - if (execution.getVariable("CAAIVfMod_createGenericVnfResponseCode") != null && - !isOneOf(execution.getVariable("CAAIVfMod_createGenericVnfResponseCode"), 200, 201)) { - utils.log("DEBUG", "Failure creating Generic VNF: " + - execution.getVariable("CAAIVfMod_createGenericVnfResponse"), isDebugEnabled) - errorResponse = execution.getVariable("CAAIVfMod_createGenericVnfResponse") - errorCode = 5000 - } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponse") != null && - execution.getVariable("CAAIVfMod_newGenericVnf") == true) { - // attempted to create a Generic VNF that already exists but vnf-id == null - utils.log("DEBUG", execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), isDebugEnabled) - errorResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") - errorCode = 1002 - } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 && - execution.getVariable("CAAIVfMod_newGenericVnf") == false) { - // attempted to create a Generic VNF where vnf-name does not exist but vnf-id != null - utils.log("DEBUG", execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), isDebugEnabled) - errorResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") - errorCode = 1002 - } else if (execution.getVariable("CAAIVfMod_createVfModuleResponseCode") != null) { - utils.log("DEBUG", "Failed to add VF Module: " + - execution.getVariable("CAAIVfMod_createVfModuleResponse"), isDebugEnabled) - errorResponse = execution.getVariable("CAAIVfMod_createVfModuleResponse") - errorCode = 5000 - } else if (execution.getVariable("CAAIVfMod_moduleExists") == true) { - utils.log("DEBUG", "Attempting to add VF Module that already exists: " + - execution.getVariable("CAAIVfMod_parseModuleResponse"), isDebugEnabled) - errorResponse = execution.getVariable("CAAIVfMod_parseModuleResponse") - errorCode = 1002 - } else if (execution.getVariable("CAAIVfMod_baseModuleConflict") == true) { - utils.log("DEBUG", "Attempting to add Base VF Module to VNF that already has a Base VF Module: " + - execution.getVariable("CAAIVfMod_parseModuleResponse"), isDebugEnabled) - errorResponse = execution.getVariable("CAAIVfMod_parseModuleResponse") - errorCode = 1002 - } else { - // if the responses get populated corerctly, we should never get here - errorResponse = "Unknown error occurred during CreateAAIVfModule flow" - errorCode = 2000 - } - - utils.log("ERROR", "Error occurred during CreateAAIVfModule flow: " + errorResponse, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse) - utils.logAudit("Workflow exception occurred in CreateAAIVfModule: " + errorResponse) - } - - /** - * Performs a rollback. - * TBD: This method requires additional testing once integrated with the - * main CreateVfModule flow. - * @param execution the execution - */ - public void rollback(DelegateExecution execution) { - def method = getClass().getSimpleName() + ".rollback(" + - "execution=" + execution.getId() + - ")" - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - logDebug("Entered " + method, isDebugLogEnabled) - - try { - RollbackData rollbackData = (RollbackData) execution.getVariable("RollbackData") - logDebug("RollbackData:" + rollbackData, isDebugLogEnabled) - - AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - utils.logAudit("CreateAAIVfModule rollback AAI URI: " + aai_uri) - - if (rollbackData != null) { - if (rollbackData.hasType("VFMODULE")) { - // use the DeleteAAIVfModule groovy methods for the rollback - def vnfId = rollbackData.get("VFMODULE", "vnfId") - def vfModuleId = rollbackData.get("VFMODULE", "vfModuleId") - def isBaseModule = rollbackData.get("VFMODULE", "isBaseModule") - execution.setVariable("DAAIVfMod_vnfId", vnfId) - execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId) - execution.setVariable("DAAIVfMod_genericVnfEndpoint", "${aai_uri}/" + vnfId) - execution.setVariable("DAAIVfMod_vfModuleEndpoint", "${aai_uri}/" + vnfId + - "/vf-modules/vf-module/" + vfModuleId) - DeleteAAIVfModule dvm = new DeleteAAIVfModule() - // query A&AI to get the needed information for the delete(s) - dvm.queryAAIForGenericVnf(execution) - dvm.parseForVfModule(execution) - - // roll back the base or add-on module - dvm.deleteVfModule(execution) - def responseCode = execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") - def response = execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") - - if (isOneOf(responseCode, 200, 204)) { - logDebug("Received " + responseCode + " to VF Module rollback request", isDebugLogEnabled) -// execution.setVariable("RollbackResult", "SUCCESS") - } else { - logError("Received " + responseCode + " to VF Module rollback request: " + rollbackData + - System.lineSeparator() + "Response: " + response) - } - - // a new Generic VNF was created that needs to be rolled back - if (isBaseModule.equals("true")) { - dvm.deleteGenericVnf(execution) - responseCode = execution.getVariable("DAAIVfMod_deleteGenericVnfResponseCode") - response = execution.getVariable("DAAIVfMod_deleteGenericVnfResponse") - - if (isOneOf(responseCode, 200, 204)) { - logDebug("Received " + responseCode + " to Generic VNF rollback request", isDebugLogEnabled) - execution.setVariable("RollbackResult", "SUCCESS") - } else { - logError("Received " + responseCode + " to Generic VNF rollback request: " + rollbackData + - System.lineSeparator() + "Response: " + response) - } - } else { - execution.setVariable("RollbackResult", "SUCCESS") - } - } - } - - logDebug("Exited " + method, isDebugLogEnabled) - } catch (Exception e) { - logError("Caught exception in " + method, e) - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy deleted file mode 100644 index 5edf391bb4..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy +++ /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.bpmn.common.scripts - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.rest.APIResponse - - -public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor { - - private XmlParser xmlParser = new XmlParser() - ExceptionUtil exceptionUtil = new ExceptionUtil() - - /** - * Initialize the flow's variables. - * - * @param execution The flow's execution instance. - */ - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable('prefix', 'CAAIVfModVG_') - execution.setVariable('CAAIVfModVG_vnfId', null) - execution.setVariable('CAAIVfModVG_vfModuleId', null) - execution.setVariable('CAAIVfModVG_aicCloudRegion', null) - execution.setVariable('CAAIVfModVG_volumeGroupId', null) - execution.setVariable('CAAIVfModVG_getVfModuleResponseCode' ,null) - execution.setVariable('CAAIVfModVG_getVfModuleResponse', '') - execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', null) - execution.setVariable('CAAIVfModVG_updateVfModuleResponse', '') - } - - /** - * Check for missing elements in the received request. - * - * @param execution The flow's execution instance. - */ - public void preProcessRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def xml = execution.getVariable('CreateAAIVfModuleVolumeGroupRequest') - logDebug('Received request xml:\n' + xml, isDebugLogEnabled) - utils.logAudit("CreateAAIVfModuleVolume Received Request XML: " + xml) - initProcessVariables(execution) - - def vnfId = getRequiredNodeText(execution, xml,'vnf-id') - execution.setVariable('CAAIVfModVG_vnfId', vnfId) - - def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id') - execution.setVariable('CAAIVfModVG_vfModuleId', vfModuleId) - - def aicCloudRegion = getRequiredNodeText(execution, xml,'aic-cloud-region') - execution.setVariable('CAAIVfModVG_aicCloudRegion', aicCloudRegion) - - def volumeGroupId = getRequiredNodeText(execution, xml,'volume-group-id') - execution.setVariable('CAAIVfModVG_volumeGroupId', volumeGroupId) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) - - } - } - - /** - * Using the received vnfId and vfModuleId, query AAI to get the corresponding VF Module. - * A 200 response is expected with the VF Module in the response body. - * - * @param execution The flow's execution instance. - */ - public void getVfModule(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.getVfModule(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def vnfId = execution.getVariable('CAAIVfModVG_vnfId') - def vfModuleId = execution.getVariable('CAAIVfModVG_vfModuleId') - - // Construct endpoint - AaiUtil aaiUtil = new AaiUtil(this) - def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + URLEncoder.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + URLEncoder.encode(vfModuleId, "UTF-8") - - try { - logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) - utils.logAudit("aaiResponse GET TO AAI Endpoint: " + endPoint) - APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) - def responseData = response.getResponseBodyAsString() - execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', response.getStatusCode()) - execution.setVariable('CAAIVfModVG_getVfModuleResponse', responseData) - - utils.logAudit("CreateAAIVfModule Response Code: " + response.getStatusCode()) - utils.logAudit("CreateAAIVfModule Response: " + response) - logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) - logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) - } catch (Exception ex) { - ex.printStackTrace() - logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled) - execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', 500) - execution.setVariable('CAAIVfModVG_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage()) - } - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVfModule(): ' + e.getMessage()) - } - } - - /** - * Construct and send a PUT request to AAI to update the VF Module with the - * created Volume Group relationship. - * - * @param execution The flow's execution instance. - */ - public void updateVfModule(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.updateVfModule(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def vnfId = execution.getVariable('CAAIVfModVG_vnfId') - def vfModuleId = execution.getVariable('CAAIVfModVG_vfModuleId') - def vfModule = execution.getVariable('CAAIVfModVG_getVfModuleResponse') - def origRequest = execution.getVariable('CreateAAIVfModuleVolumeGroupRequest') - def Node vfModuleNode = xmlParser.parseText(vfModule) - - // Confirm resource-version is in retrieved VF Module - if (utils.getChildNode(vfModuleNode, 'resource-version') == null) { - def msg = 'Can\'t update VF Module ' + vfModuleId + ' since \'resource-version\' is missing' - logError(msg) - throw new Exception(msg) - } - - // Construct payload by creating a Volume Group relationhip and inserting it into the VF Module - def aicCloudRegion = execution.getVariable('CAAIVfModVG_aicCloudRegion') - def volumeGroupId = execution.getVariable('CAAIVfModVG_volumeGroupId') - def Node vgRelationshipNode = createVolumeGroupRelationshipNode(aicCloudRegion, volumeGroupId) - insertVolumeGroupRelationshipNode(vfModuleNode, vgRelationshipNode) - def payload = utils.nodeToString(vfModuleNode) - - // Construct endpoint - AaiUtil aaiUtil = new AaiUtil(this) - def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + URLEncoder.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + URLEncoder.encode(vfModuleId, "UTF-8") - - try { - utils.logAudit("CreateAAIVfModuleVolume Sendind PUT to AAI Endpoint \n " + endPoint + " with payload \n " + payload) - logDebug('sending PUT to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled) - APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload) - def responseData = response.getResponseBodyAsString() - execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', response.getStatusCode()) - execution.setVariable('CAAIVfModVG_updateVfModuleResponse', responseData) - - utils.logAudit("CreateAAIVfModule Response code: " + response.getStatusCode()) - utils.logAudit("CreateAAIVfModule Response: " + responseData) - logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) - logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) - } catch (Exception ex) { - ex.printStackTrace() - logDebug('Exception occurred while executing AAI PUT:' + ex.getMessage(),isDebugLogEnabled) - execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', 500) - execution.setVariable('CAAIVfModVG_updateVfModuleResponse', 'AAI PUT Failed:' + ex.getMessage()) - } - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage()) - } - } - - /** - * Construct a Volume Group relationship Node with the given AIC Cloud Region and - * Volume Group ID for insertion into a VF Module. - * - * @param aicCloudRegion Cloud Region ID to use in the Volume Group relationship - * @param volumeGroupId Volume Group ID to use in the Volume Group relationship - * @return a Node representing the new Volume Group relationship - */ - private Node createVolumeGroupRelationshipNode(String aicCloudRegion, String volumeGroupId) { - - def Node relatedTo = new Node(null, 'related-to', 'volume-group') - - def Node relationshipKeyCO = new Node(null, 'relationship-key', 'cloud-region.cloud-owner') - def Node relationshipValueCO = new Node(null, 'relationship-value', 'att-aic') - def Node relationshipDataCO = new Node(null, 'relationship-data') - relationshipDataCO.append(relationshipKeyCO) - relationshipDataCO.append(relationshipValueCO) - - def Node relationshipKeyCRI = new Node(null, 'relationship-key', 'cloud-region.cloud-region-id') - def Node relationshipValueCRI = new Node(null, 'relationship-value', aicCloudRegion) - def Node relationshipDataCRI = new Node(null, 'relationship-data') - relationshipDataCRI.append(relationshipKeyCRI) - relationshipDataCRI.append(relationshipValueCRI) - - def Node relationshipKeyVGI = new Node(null, 'relationship-key', 'volume-group.volume-group-id') - def Node relationshipValueVGI = new Node(null, 'relationship-value', volumeGroupId) - def Node relationshipDataVGI = new Node(null, 'relationship-data') - relationshipDataVGI.append(relationshipKeyVGI) - relationshipDataVGI.append(relationshipValueVGI) - - def Node volumeGroupRelationship = new Node(null, 'relationship') - volumeGroupRelationship.append(relatedTo) - volumeGroupRelationship.append(relationshipDataCO) - volumeGroupRelationship.append(relationshipDataCRI) - volumeGroupRelationship.append(relationshipDataVGI) - - return volumeGroupRelationship; - } - - /** - * Insert the given Volume Group relationship Node into the given VF Module. - * If the VF Module does NOT contain a relationship list: - * - Create a relationship list containing the Volume Group relationship and insert it into the VF Module - * If the VF Module contains a relationship list but not a Volume Group relationship: - * - Insert the the Volume Group relationship into the relationship lsit - * If the VF Module contains a relationship list and has a Volume Group relationship: - * - Replace the existing Volume Group relationship with the new one - * @param vfModuleNode - * @param volumeGroupRelationshipNode - */ - private void insertVolumeGroupRelationshipNode(Node vfModuleNode, Node volumeGroupRelationshipNode) { - def Node relationshipList = utils.getChildNode(vfModuleNode, 'relationship-list') - if (relationshipList == null) { - relationshipList = new Node(null, 'relationship-list') - relationshipList.append(volumeGroupRelationshipNode) - vfModuleNode.append(relationshipList) - } else { - def Node currVolumeGroupRelationshipNode = getCurrVolumeGroupRelationshipNode(relationshipList) - if (currVolumeGroupRelationshipNode == null) { - relationshipList.append(volumeGroupRelationshipNode) - } else { - currVolumeGroupRelationshipNode.replaceNode(volumeGroupRelationshipNode) - } - } - } - - /** - * Find and return the value of the Volume Group ID for the specified VF Module. If - * the value of the Volume Group ID cannot be found for any reason, 'null' is returned. - * - * @param vfModuleNode VF Module (as a Node) retrieved from AAI. - * @return the value of the Volume Group ID for the specified VF Module. If the - * value of the Volume Group ID cannot be found for any reason, 'null' is returned. - */ - private Node getCurrVolumeGroupRelationshipNode(Node relationshipList) { - def Node currVolumeGroupRelationshipNode = null - def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') - for (Node relationshipNode in relationships) { - def String relatedTo = utils.getChildNodeText(relationshipNode, 'related-to') - if ((relatedTo != null) && relatedTo.equals('volume-group')) { - currVolumeGroupRelationshipNode = relationshipNode - } - } - return currVolumeGroupRelationshipNode - } - - /** - * Generates a WorkflowException if the AAI query returns a response code other than 200. - * - * @param execution The flow's execution instance. - */ - public void handleAAIQueryFailure(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - logError('Error occurred attempting to query AAI, Response Code ' + - execution.getVariable('CAAIVfModVG_getVfModuleResponseCode') + ', Error Response ' + - execution.getVariable('CAAIVfModVG_getVfModuleResponse')) - ExceptionUtil exceptionUtil = new ExceptionUtil() - exceptionUtil.buildWorkflowException(execution, 5000, execution.getVariable('CAAIVfModVG_getVfModuleResponse')) - - logDebug('Exited ' + method, isDebugLogEnabled) - } - - /** - * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200. - * - * @param execution The flow's execution instance. - */ - public void handleUpdateVfModuleFailure(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - logError('Error occurred attempting to update VF Module in AAI, Response Code ' + - execution.getVariable('CAAIVfModVG_updateVfModuleResponseCode') + ', Error Response ' + - execution.getVariable('CAAIVfModVG_updateVfModuleResponse')) - ExceptionUtil exceptionUtil = new ExceptionUtil() - exceptionUtil.buildWorkflowException(execution, 5000, execution.getVariable('CAAIVfModVG_updateVfModuleResponse')) - - logDebug('Exited ' + method, isDebugLogEnabled) - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy deleted file mode 100644 index 86b35853ba..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy +++ /dev/null @@ -1,443 +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.bpmn.common.scripts - -import static org.apache.commons.lang3.StringUtils.* - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.rest.APIResponse -import org.springframework.web.util.UriUtils - - -/** - * This class supports the GenericGetService Sub Flow. - * This Generic sub flow can be used by any flow for accomplishing - * the goal of getting a Service-Instance or Service-Subscription (from AAI). - * The calling flow must set the GENGS_type variable as "service-instance" - * or "service-subscription". - * - * When using to Get a Service-Instance: - * If the global-customer-id and service-type are not provided - * this flow executes a query to get the service- Url using the - * Service Id or Name (whichever is provided). - * - * When using to Get a Service-Subscription: - * The global-customer-id and service-type must be - * provided. - * - * Upon successful completion of this sub flow the - * GENGS_SuccessIndicator will be true and the query response payload - * will be set to GENGS_service. An MSOWorkflowException will - * be thrown upon unsuccessful completion or if an error occurs - * at any time during this sub flow. Please map variables - * to the corresponding variable names below. - * - * Note - If this sub flow receives a Not Found (404) response - * from AAI at any time this will be considered an acceptable - * successful response however the GENGS_FoundIndicator - * will be set to false. This variable will allow the calling flow - * to distinguish between the two Success scenarios, - * "Success where service- is found" and - * "Success where service- is NOT found". - * - * - * Variable Mapping Below: - * - * In Mapping Variables: - * For Allotted-Resource: - * @param - GENGS_allottedResourceId - * @param - GENGS_type - * @param (Optional) - GENGS_serviceInstanceId - * @param (Optional) - GENGS_serviceType - * @param (Optional) - GENGS_globalCustomerId - * - * For Service-Instance: - * @param - GENGS_serviceInstanceId or @param - GENGS_serviceInstanceName - * @param - GENGS_type - * @param (Optional) - GENGS_serviceType - * @param (Optional) - GENGS_globalCustomerId - * - * For Service-Subscription: - * @param - GENGS_type - * @param - GENGS_serviceType - * @param - GENGS_globalCustomerId - * - * - * Out Mapping Variables: - * @param - GENGS_service - * @param - GENGS_FoundIndicator - * @param - WorkflowException - */ -class CustomE2EGetService extends AbstractServiceTaskProcessor{ - - String Prefix = "GENGS_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - /** - * This method validates the incoming variables and - * determines the subsequent event based on which - * variables the calling flow provided. - * - * @param - execution - * - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericGetService PreProcessRequest Process*** ", isDebugEnabled) - - execution.setVariable("GENGS_obtainObjectsUrl", false) - execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false) - execution.setVariable("GENGS_SuccessIndicator", false) - execution.setVariable("GENGS_FoundIndicator", false) - execution.setVariable("GENGS_resourceLink", null) - execution.setVariable("GENGS_siResourceLink", null) - - try{ - // Get Variables - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") - String serviceType = execution.getVariable("GENGS_serviceType") - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - String type = execution.getVariable("GENGS_type") - - if(type != null){ - utils.log("DEBUG", "Incoming GENGS_type is: " + type, isDebugEnabled) - if(type.equalsIgnoreCase("allotted-resource")){ - if(isBlank(allottedResourceId)){ - utils.log("DEBUG", "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") - }else{ - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) - if(isBlank(globalCustomerId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ - execution.setVariable("GENGS_obtainObjectsUrl", true) - }else{ - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled) - } - } - }else if(type.equalsIgnoreCase("service-instance")){ - if(isBlank(serviceInstanceId) && isBlank(serviceInstanceName)){ - utils.log("DEBUG", "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") - }else{ - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Name is: " + serviceInstanceName, isDebugEnabled) - if(isBlank(globalCustomerId) || isBlank(serviceType)){ - execution.setVariable("GENGS_obtainObjectsUrl", true) - if(isBlank(serviceInstanceId)){ - execution.setVariable("GENGS_obtainServiceInstanceUrlByName", true) - } - }else{ - utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - } - } - }else if(type.equalsIgnoreCase("service-subscription")){ - if(isBlank(serviceType) || isBlank(globalCustomerId)){ - utils.log("DEBUG", "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") - }else{ - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled) - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENGS_type is null. Variable is Required.") - } - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", "Internal Error encountered within GenericGetService PreProcessRequest method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetService PreProcessRequest") - - } - utils.log("DEBUG", "*** COMPLETED GenericGetService PreProcessRequest Process ***", isDebugEnabled) - } - - /** - * This method obtains the Url to the provided service instance - * using the Service Instance Id. - * - * @param - execution - */ - public void obtainServiceInstanceUrlById(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlById Process*** ", isDebugEnabled) - try { - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - - String type = execution.getVariable("GENGS_type") - String path = "" - if(type.equalsIgnoreCase("service-instance")){ - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - utils.log("DEBUG", " Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId, isDebugEnabled) - path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}" - utils.logAudit("Service Instance Node Query Url is: " + path) - utils.log("DEBUG", "Service Instance Node Query Url is: " + path, isDebugEnabled) - }else if(type.equalsIgnoreCase("allotted-resource")){ - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - utils.log("DEBUG", " Querying Node for Service-Instance URL by using Allotted Resource Id: " + allottedResourceId, isDebugEnabled) - path = "${aai_uri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}" - utils.logAudit("Allotted Resource Node Query Url is: " + path) - utils.log("DEBUG", "Allotted Resource Node Query Url is: " + path, isDebugEnabled) - } - - //String url = "${aai_endpoint}${path}" host name needs to be removed from property - String url = "${path}" - execution.setVariable("GENGS_genericQueryPath", url) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_genericQueryResponseCode", responseCode) - utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled) - utils.logAudit("GenericGetService AAI GET Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENGS_obtainSIUrlResponseBeforeUnescaping", aaiResponse) - utils.log("DEBUG", "GenericGetService AAI Response before unescaping: " + aaiResponse, isDebugEnabled) - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable("GENGS_genericQueryResponse", aaiResponse) - utils.logAudit("GenericGetService AAI Response: " + aaiResponse) - utils.log("DEBUG", "GenericGetService AAI Response: " + aaiResponse, isDebugEnabled) - - //Process Response - if(responseCode == 200){ - utils.log("DEBUG", "Generic Query Received a Good Response Code", isDebugEnabled) - execution.setVariable("GENGS_SuccessIndicator", true) - if(utils.nodeExists(aaiResponse, "result-data")){ - utils.log("DEBUG", "Generic Query Response Does Contain Data" , isDebugEnabled) - execution.setVariable("GENGS_FoundIndicator", true) - String resourceLink = utils.getNodeText1(aaiResponse, "resource-link") - execution.setVariable("GENGS_resourceLink", resourceLink) - execution.setVariable("GENGS_siResourceLink", resourceLink) - }else{ - utils.log("DEBUG", "Generic Query Response Does NOT Contains Data" , isDebugEnabled) - execution.setVariable("WorkflowResponse", " ") //for junits - } - }else if(responseCode == 404){ - utils.log("DEBUG", "Generic Query Received a Not Found (404) Response", isDebugEnabled) - execution.setVariable("GENGS_SuccessIndicator", true) - execution.setVariable("WorkflowResponse", " ") //for junits - }else{ - utils.log("DEBUG", "Generic Query Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericGetService ObtainServiceInstanceUrlById method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlById") - } - utils.log("DEBUG", " *** COMPLETED GenericGetService ObtainServiceInstanceUrlById Process*** ", isDebugEnabled) - } - - /** - * This method obtains the Url to the provided service instance - * using the Service Instance Name. - * - * @param - execution - */ - public void obtainServiceInstanceUrlByName(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlByName Process*** ", isDebugEnabled) - try { - String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") - utils.log("DEBUG", " Querying Node for Service-Instance URL by using Service-Instance Name " + serviceInstanceName, isDebugEnabled) - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-name:EQUALS:${serviceInstanceName}" - - //String url = "${aai_endpoint}${path}" host name needs to be removed from property - String url = "${path}" - execution.setVariable("GENGS_obtainSIUrlPath", url) - - utils.logAudit("GenericGetService AAI Endpoint: " + aai_endpoint) - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode) - utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled) - utils.logAudit("GenericGetService AAI Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse) - utils.logAudit("GenericGetService AAI Response: " + aaiResponse) - //Process Response - if(responseCode == 200){ - utils.log("DEBUG", " Query for Service Instance Url Received a Good Response Code", isDebugEnabled) - execution.setVariable("GENGS_SuccessIndicator", true) - if(utils.nodeExists(aaiResponse, "result-data")){ - utils.log("DEBUG", "Query for Service Instance Url Response Does Contain Data" , isDebugEnabled) - execution.setVariable("GENGS_FoundIndicator", true) - String resourceLink = utils.getNodeText1(aaiResponse, "resource-link") - execution.setVariable("GENGS_resourceLink", resourceLink) - execution.setVariable("GENGS_siResourceLink", resourceLink) - }else{ - utils.log("DEBUG", "Query for Service Instance Url Response Does NOT Contains Data" , isDebugEnabled) - execution.setVariable("WorkflowResponse", " ") //for junits - } - }else if(responseCode == 404){ - utils.log("DEBUG", " Query for Service Instance Received a Not Found (404) Response", isDebugEnabled) - execution.setVariable("GENGS_SuccessIndicator", true) - execution.setVariable("WorkflowResponse", " ") //for junits - }else{ - utils.log("DEBUG", "Query for Service Instance Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericGetService ObtainServiceInstanceUrlByName method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlByName") - } - utils.log("DEBUG", " *** COMPLETED GenericGetService ObtainServiceInstanceUrlByName Process*** ", isDebugEnabled) - } - - - /** - * This method executes a GET call to AAI to obtain the - * service-instance or service-subscription - * - * @param - execution - */ - public void getServiceObject(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericGetService GetServiceObject Process*** ", isDebugEnabled) - try { - String type = execution.getVariable("GENGS_type") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String serviceEndpoint = "" - - utils.logAudit("GenericGetService getServiceObject AAI Endpoint: " + aai_endpoint) - if(type.equalsIgnoreCase("service-instance")){ - String siResourceLink = execution.getVariable("GENGS_resourceLink") - if(isBlank(siResourceLink)){ - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENGS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) - String serviceType = execution.getVariable("GENGS_serviceType") - utils.log("DEBUG", " Incoming GENGS_serviceType is: " + serviceType, isDebugEnabled) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled) - - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") - }else{ - utils.log("DEBUG", "Incoming Service Instance Url is: " + siResourceLink, isDebugEnabled) - String[] split = siResourceLink.split("/aai/") - serviceEndpoint = "/aai/" + split[1] - } - }else if(type.equalsIgnoreCase("allotted-resource")){ - String siResourceLink = execution.getVariable("GENGS_resourceLink") - if(isBlank(siResourceLink)){ - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - utils.log("DEBUG", " Incoming GENGS_allottedResourceId is: " + allottedResourceId, isDebugEnabled) - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENGS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) - String serviceType = execution.getVariable("GENGS_serviceType") - utils.log("DEBUG", " Incoming GENGS_serviceType is: " + serviceType, isDebugEnabled) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled) - - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") - }else{ - utils.log("DEBUG", "Incoming Allotted-Resource Url is: " + siResourceLink, isDebugEnabled) - String[] split = siResourceLink.split("/aai/") - serviceEndpoint = "/aai/" + split[1] - } - }else if(type.equalsIgnoreCase("service-subscription")){ - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - String serviceType = execution.getVariable("GENGS_serviceType") - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") - } - - String serviceUrl = "${aai_endpoint}" + serviceEndpoint - - execution.setVariable("GENGS_getServiceUrl", serviceUrl) - utils.log("DEBUG", "GET Service AAI Path is: \n" + serviceUrl, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceUrl) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_getServiceResponseCode", responseCode) - utils.log("DEBUG", " GET Service response code is: " + responseCode, isDebugEnabled) - utils.logAudit("GenericGetService AAI Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable("GENGS_getServiceResponse", aaiResponse) - utils.logAudit("GenericGetService AAI Response: " + aaiResponse) - //Process Response - if(responseCode == 200 || responseCode == 202){ - utils.log("DEBUG", "GET Service Received a Good Response Code", isDebugEnabled) - if(utils.nodeExists(aaiResponse, "service-instance") || utils.nodeExists(aaiResponse, "service-subscription")){ - utils.log("DEBUG", "GET Service Response Contains a service-instance" , isDebugEnabled) - execution.setVariable("GENGS_FoundIndicator", true) - execution.setVariable("GENGS_service", aaiResponse) - execution.setVariable("WorkflowResponse", aaiResponse) - - }else{ - utils.log("DEBUG", "GET Service Response Does NOT Contain Data" , isDebugEnabled) - } - }else if(responseCode == 404){ - utils.log("DEBUG", "GET Service Received a Not Found (404) Response", isDebugEnabled) - execution.setVariable("WorkflowResponse", " ") //for junits - } - else{ - utils.log("DEBUG", " GET Service Received a Bad Response: \n" + aaiResponse, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", " Error encountered within GenericGetService GetServiceObject method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GenericGetService") - } - utils.log("DEBUG", " *** COMPLETED GenericGetService GetServiceObject Process*** ", isDebugEnabled) - } - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy deleted file mode 100644 index 2c42ef03b3..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy +++ /dev/null @@ -1,281 +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.bpmn.common.scripts - -import static org.apache.commons.lang3.StringUtils.*; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.apache.commons.codec.binary.Base64 -import org.apache.commons.lang3.* - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.net.URLEncoder; -import org.springframework.web.util.UriUtils - -/** - * This class supports the GenericPutService Sub Flow. - * This Generic sub flow can be used by any flow for the - * goal of creating a Service Instance or Service-Subscription in AAI. Upon successful completion of - * this sub flow the GENPS_SuccessIndicator will be true. - * The calling flow must set the GENPS_type variable as "service-instance" - * or "service-subscription". - * A MSOWorkflowException will be thrown Upon unsuccessful - * completion or if an error occurs within this flow. - * Please map variables to the corresponding variable names - * below. - * - * - * Incoming Required Variables: - * @param - GENPS_requestId - * @param - GENPS_type - Required field. This will be required field populated as service-instance or service-subscription - * @param - GENPS_globalSubscriberId - Required field - * @param - GENPS_serviceType - Required Field - * @param - GENPS_payload - Required Field This will be the payload that needs to be sent. - * - * @param - GENPS_serviceInstanceId - Conditional Field. Required for service-instance. - * @param - GENPS_allottedResourceId - Conditional Field. Required for allotted-resource. - * @param - GENPS_tunnelXconnectId - Conditional Field. Required for tunnel-xconnect. - * - * @param - GENPS_serviceResourceVersion - Conditional Field. Needs to be provided only in case of update for both service-instance and service subscription. The calling flows - * should check if a service-instance or servic-subscription exists by calling the subflow GenericGetService. if it exists then resourceversion should be - * obtained from aai and sent as an input parameter. - * - * Outgoing Variables: - * @param - GENPS_SuccessIndicator - * @param - WorkflowException - * - * - */ - - -class CustomE2EPutService extends AbstractServiceTaskProcessor{ - - String Prefix = "GENPS_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericPutService PreProcessRequest Process*** ", isDebugEnabled) - - execution.setVariable("GENPS_SuccessIndicator", false) - - try{ - // Get Variables - String requestId = execution.getVariable("GENPS_requestId") - utils.log("DEBUG", "Incoming GENPS_requestId is: " + requestId, isDebugEnabled) - - String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") - String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - String serviceType = execution.getVariable("GENPS_serviceType") - String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") - String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") - String type = execution.getVariable("GENPS_type") - - if(type != null){ - utils.log("DEBUG", "Incoming GENPS_type is: " + type, isDebugEnabled) - if(type.equalsIgnoreCase("service-instance")){ - if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ - utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") - }else{ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - } - }else if(type.equalsIgnoreCase("service-subscription")){ - if(isBlank(serviceType) || isBlank(globalSubscriberId)){ - utils.log("DEBUG", "Incoming ServiceType or GlobalSubscriberId is null. These variables are required to create a service-subscription.", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") - }else{ - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - } - }else if(type.equalsIgnoreCase("allotted-resource")){ - if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId)){ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") - }else{ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) - } - }else if(type.equalsIgnoreCase("tunnel-xconnect")){ - if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId) || isBlank(tunnelXconnectId)){ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Tunnel Xconnect Id is: " + tunnelXconnectId, isDebugEnabled) - utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") - }else{ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Tunnel Xconnect Id is: " + tunnelXconnectId, isDebugEnabled) - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENPS_type is null. Variable is Required.") - } - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericPutService PreProcessRequest method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericPutService PreProcessRequest") - - } - utils.log("DEBUG", "*** COMPLETED GenericPutService PreProcessRequest Process ***", isDebugEnabled) - - } - - - - /** - * This method executes a Put call to AAI for the provided - * service instance. - * - * @param - execution - * - */ - public void putServiceInstance(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericPutService PutServiceInstance method*** ", isDebugEnabled) - try { - String type = execution.getVariable("GENPS_type") - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) - String namespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) - logDebug('AAI namespace is: ' + namespace, isDebugEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String serviceAaiPath = "" - String payload = execution.getVariable("GENPS_payload") - execution.setVariable("GENPS_payload", payload) - utils.log("DEBUG", "Incoming GENPS_payload is: " + payload, isDebugEnabled) - utils.logAudit(payload) - - String serviceType = execution.getVariable("GENPS_serviceType") - utils.log("DEBUG", " Incoming GENPS_serviceType is: " + serviceType, isDebugEnabled) - String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - - // This IF clause is if we need to create a new Service Instance - if(type.equalsIgnoreCase("service-instance")){ - - String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) - - // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + URLEncoder.encode(serviceInstanceId,"UTF-8") - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") - - }else if(type.equalsIgnoreCase("service-subscription")){ - - // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") - }else if(type.equalsIgnoreCase("allotted-resource")){ - - String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) - String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") - utils.log("DEBUG", " Incoming GENPS_allottedResourceId is: " + allottedResourceId, isDebugEnabled) - - // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") - }else if(type.equalsIgnoreCase("tunnel-xconnect")){ - - String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) - String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") - utils.log("DEBUG", " Incoming GENPS_allottedResourceId is: " + allottedResourceId, isDebugEnabled) - String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") - utils.log("DEBUG", " Incoming GENPS_tunnelXconnectId is: " + tunnelXconnectId, isDebugEnabled) - - // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + "/tunnel-xconnects/tunnel-xconnect/" + UriUtils.encode(tunnelXconnectId,"UTF-8") - } - - String resourceVersion = execution.getVariable("GENPS_serviceResourceVersion") - utils.log("DEBUG", "Incoming Resource Version is: " + resourceVersion, isDebugEnabled) - if(resourceVersion !=null){ - serviceAaiPath = serviceAaiPath +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8") - } - - execution.setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath) - utils.log("DEBUG", "PUT Service Instance AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) - int responseCode = response.getStatusCode() - execution.setVariable("GENPS_putServiceInstanceResponseCode", responseCode) - utils.log("DEBUG", " Put Service Instance response code is: " + responseCode, isDebugEnabled) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable("GENPS_putServiceInstanceResponse", aaiResponse) - - - //Process Response - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) - //200 OK 201 CREATED 202 ACCEPTED - { - utils.log("DEBUG", "PUT Service Instance Received a Good Response", isDebugEnabled) - execution.setVariable("GENPS_SuccessIndicator", true) - } - - else{ - utils.log("DEBUG", "Put Generic Service Instance Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericPutService PutServiceInstance method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Put Service Instance") - } - utils.log("DEBUG", " *** COMPLETED GenericPutService PutServiceInstance Process*** ", isDebugEnabled) - } - - - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DecomposeService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DecomposeService.groovy deleted file mode 100644 index 7a81ce519e..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DecomposeService.groovy +++ /dev/null @@ -1,178 +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.bpmn.common.scripts - -import org.openecomp.mso.bpmn.core.json.DecomposeJsonUtil; - -import static org.apache.commons.lang3.StringUtils.*; - - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.json.JsonUtils - -import com.att.ecomp.mso.bpmn.core.domain.* - -import groovy.json.* - -/** - * This groovy class supports the DecomposeService.bpmn process. - * - * @author - * - * Inputs: - * @param - msoRequestId - * @param - isDebugLogEnabled - * @param - serviceInstanceId - * @param - serviceModelInfo - * @param - requestParameters (may be null) - * - * Outputs: - * @param - rollbackData (null) - * @param - rolledBack (null) - * @param - WorkflowException - * @param - serviceDecomposition - * - */ -public class DecomposeService extends AbstractServiceTaskProcessor { - - String Prefix="DDS_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - CatalogDbUtils catalogDbUtils = new CatalogDbUtils() - JsonUtils jsonUtils = new JsonUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("DEBUG"," ***** preProcessRequest of DecomposeService *****", isDebugEnabled) - setBasicDBAuthHeader(execution, isDebugEnabled) - - try { - execution.setVariable("prefix", Prefix) - // check for required input - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceModelInfo = execution.getVariable("serviceModelInfo") - String invariantId - if(jsonUtils.jsonElementExist(serviceModelInfo, "modelInvariantUuid")){ - invariantId = jsonUtils.getJsonValue(serviceModelInfo, "modelInvariantUuid") - }else if(jsonUtils.jsonElementExist(serviceModelInfo, "modelInvariantId")){ - invariantId = jsonUtils.getJsonValue(serviceModelInfo, "modelInvariantId") - } - execution.setVariable("DDS_serviceModelInvariantId", invariantId) - execution.setVariable("DDS_serviceModelUuid", jsonUtils.getJsonValue(serviceModelInfo, "modelUuid")) - execution.setVariable("DDS_modelVersion", jsonUtils.getJsonValue(serviceModelInfo, "modelVersion")) - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest of DecomposeService *****", isDebugEnabled) - } - - public void queryCatalogDb (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("DEBUG"," ***** queryCatalogDB of DecomposeService *****", isDebugEnabled) - - try { - - // check for input - String serviceModelInvariantId = execution.getVariable("DDS_serviceModelInvariantId") - String serviceModelUuid = execution.getVariable("DDS_serviceModelUuid") - String modelVersion = execution.getVariable("DDS_modelVersion") - - utils.log("DEBUG", "serviceModelInvariantId: " + serviceModelInvariantId, isDebugEnabled) - utils.log("DEBUG", "modelVersion: " + modelVersion, isDebugEnabled) - - JSONObject catalogDbResponse = null - if(serviceModelUuid != null && serviceModelUuid.length() > 0) - catalogDbResponse = catalogDbUtils.getServiceResourcesByServiceModelUuid(execution, serviceModelUuid, "v2") - else if (modelVersion != null && modelVersion.length() > 0) - catalogDbResponse = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(execution, serviceModelInvariantId, modelVersion, "v2") - else - catalogDbResponse = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuid(execution, serviceModelInvariantId, "v2") - - if (catalogDbResponse == null || catalogDbResponse.toString().equalsIgnoreCase("null")) { - msg = "No data found in Catalog DB" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - - String catalogDbResponseString = catalogDbResponse.toString() - - execution.setVariable("DDS_catalogDbResponse", catalogDbResponseString) - utils.log("DEBUG", "catalog DB response string: "+ catalogDbResponseString, isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in queryCatalogDb " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit queryCatalogDb of DecomposeService *****", isDebugEnabled) - } - - - - public void actuallyDecomposeService (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("DEBUG"," ***** actuallyDecomposeService of DecomposeService *****", isDebugEnabled) - - try { - - // check for input - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceModelInvariantId = execution.getVariable("DDS_serviceModelInvariantId") - - utils.log("DEBUG", "serviceModelInvariantId: " + serviceModelInvariantId, isDebugEnabled) - - utils.log("DEBUG", "getting service decomposition", isDebugEnabled) - - String catalogDbResponse = execution.getVariable("DDS_catalogDbResponse") - ServiceDecomposition serviceDecomposition = DecomposeJsonUtil.jsonToServiceDecomposition(catalogDbResponse, serviceInstanceId) - - execution.setVariable("serviceDecomposition", serviceDecomposition) - execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString()) - - utils.log("DEBUG", "service decomposition: "+ serviceDecomposition.toJsonString(), isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in actuallyDecomposeService " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit actuallyDecomposeService of DecomposeService *****", isDebugEnabled) - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy deleted file mode 100644 index 54e3da54d2..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy +++ /dev/null @@ -1,350 +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.bpmn.common.scripts -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient; -import org.openecomp.mso.rest.RESTConfig; - - -public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ - - def Prefix="DAAIVfMod_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - private MsoUtils utils = new MsoUtils() - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable("prefix",Prefix) - execution.setVariable("DAAIVfMod_vnfId",null) - execution.setVariable("DAAIVfMod_vnfName",null) - execution.setVariable("DAAIVfMod_genVnfRsrcVer",null) - execution.setVariable("DAAIVfMod_vfModuleId",null) - execution.setVariable("DAAIVfMod_vfModRsrcVer",null) - execution.setVariable("DAAIVfMod_genericVnfEndpoint",null) - execution.setVariable("DAAIVfMod_vfModuleEndpoint",null) - execution.setVariable("DAAIVfMod_moduleExists",false) - execution.setVariable("DAAIVfMod_isBaseModule", false) - execution.setVariable("DAAIVfMod_isLastModule", false) - - // DeleteAAIVfModule workflow response variable placeholders - execution.setVariable("DAAIVfMod_queryGenericVnfResponseCode",null) - execution.setVariable("DAAIVfMod_queryGenericVnfResponse","") - execution.setVariable("DAAIVfMod_parseModuleResponse","") - execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode",null) - execution.setVariable("DAAIVfMod_deleteGenericVnfResponse","") - execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode",null) - execution.setVariable("DAAIVfMod_deleteVfModuleResponse","") - - } - - // parse the incoming DELETE_VF_MODULE request and store the Generic Vnf - // and Vf Module Ids in the flow DelegateExecution - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def xml = execution.getVariable("DeleteAAIVfModuleRequest") - utils.logAudit("DeleteAAIVfModule Request: " + xml) - utils.log("DEBUG", "input request xml:" + xml, isDebugEnabled) - initProcessVariables(execution) - def vnfId = utils.getNodeText(xml,"vnf-id") - def vfModuleId = utils.getNodeText(xml,"vf-module-id") - execution.setVariable("DAAIVfMod_vnfId", vnfId) - execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId) - - AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) - - execution.setVariable("DAAIVfMod_genericVnfEndpoint", "${aai_uri}/" + vnfId) - execution.setVariable("DAAIVfMod_vfModuleEndpoint", "${aai_uri}/" + vnfId + - "/vf-modules/vf-module/" + vfModuleId) - } - - // send a GET request to AA&I to retrieve the Generic Vnf/Vf Module information based on a Vnf Id - // expect a 200 response with the information in the response body or a 404 if the Generic Vnf does not exist - public void queryAAIForGenericVnf(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId") - def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + "?depth=1" - utils.logAudit("DeleteAAIVfModule endPoint: " + endPoint) - def aaiRequestId = utils.getRequestID() - - RESTConfig config = new RESTConfig(endPoint); - utils.log("DEBUG","queryAAIForGenericVnf() endpoint-" + endPoint, isDebugEnabled) - def responseData = "" - try { - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO"). - addHeader("Accept","application/xml"); - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - utils.log("DEBUG", "invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint,isDebugEnabled) - APIResponse response = client.httpGet() - utils.logAudit("DeleteAAIVfModule - invoking httpGet to AAI") - - responseData = response.getResponseBodyAsString() - execution.setVariable("DAAIVfMod_queryGenericVnfResponseCode", response.getStatusCode()) - execution.setVariable("DAAIVfMod_queryGenericVnfResponse", responseData) - utils.logAudit("AAI Response: " + responseData) - utils.log("DEBUG", "Response code:" + response.getStatusCode(), isDebugEnabled) - utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled) - } catch (Exception ex) { - utils.log("DEBUG", "Exception occurred while executing AAI GET:" + ex.getMessage(),isDebugEnabled) - execution.setVariable("DAAIVfMod_queryGenericVnfResponse", "AAI GET Failed:" + ex.getMessage()) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during queryAAIForGenericVnf") - - } - } - - // construct and send a DELETE request to A&AI to delete a Generic Vnf - // note: to get here, all the modules associated with the Generic Vnf must already be deleted - public void deleteGenericVnf(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def aaiRequestId = utils.getRequestID() - def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + - "/?resource-version=" + execution.getVariable("DAAIVfMod_genVnfRsrcVer") - utils.logAudit("AAI endPoint: " + endPoint) - RESTConfig config = new RESTConfig(endPoint); - utils.log("DEBUG","deleteGenericVnf() endpoint-" + endPoint, isDebugEnabled) - def responseData = "" - try { - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO"). - addHeader("Accept","application/xml"); - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.httpDelete() - - responseData = response.getResponseBodyAsString() - execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode", response.getStatusCode()) - execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", responseData) - utils.log("DEBUG", "Response code:" + response.getStatusCode(), isDebugEnabled) - utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled) - } catch (Exception ex) { - ex.printStackTrace() - utils.log("DEBUG", "Exception occurred while executing AAI DELETE:" + ex.getMessage(),isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteGenericVnf") - } - } - - // construct and send a DELETE request to A&AI to delete the Base or Add-on Vf Module - public void deleteVfModule(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_vfModuleEndpoint") + - "/?resource-version=" + execution.getVariable("DAAIVfMod_vfModRsrcVer") - def aaiRequestId = utils.getRequestID() - - RESTConfig config = new RESTConfig(endPoint); - utils.log("DEBUG","deleteVfModule() endpoint-" + endPoint, isDebugEnabled) - def responseData = "" - try { - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO"). - addHeader("Accept","application/xml"); - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.httpDelete() - - utils.logAudit("DeleteAAIVfModule - invoking httpDelete to AAI") - - responseData = response.getResponseBodyAsString() - execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode", response.getStatusCode()) - execution.setVariable("DAAIVfMod_deleteVfModuleResponse", responseData) - utils.logAudit("DeleteAAIVfModule - AAI Response" + responseData) - utils.log("DEBUG", "Response code:" + response.getStatusCode(), isDebugEnabled) - utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled) - - } catch (Exception ex) { - ex.printStackTrace() - utils.log("DEBUG", "Exception occurred while executing AAI PUT:" + ex.getMessage(),isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteVfModule") - } - } - - // parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module - // to be deleted exists for the specified Generic Vnf and if it is the Base Module, - // there are no Add-on Modules present - public void parseForVfModule(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def xml = execution.getVariable("DAAIVfMod_queryGenericVnfResponse") - utils.logAudit("DeleteAAIVfModule - queryGenericVnfResponse" + xml) - - def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId") - utils.log("DEBUG", "Vf Module to be deleted: " + delModuleId, isDebugEnabled) - List qryModuleIdList = utils.getMultNodes(xml, "vf-module-id") - List qryBaseModuleList = utils.getMultNodes(xml, "is-base-vf-module") - List qryResourceVerList = utils.getMultNodes(xml, "resource-version") - execution.setVariable("DAAIVfMod_moduleExists", false) - execution.setVariable("DAAIVfMod_isBaseModule", false) - execution.setVariable("DAAIVfMod_isLastModule", false) - // - def isBaseVfModule = "false" - // loop through the Vf Module Ids looking for a match - if (qryModuleIdList != null && !qryModuleIdList.empty) { - utils.log("DEBUG", "Existing Vf Module Id List: " + qryModuleIdList, isDebugEnabled) - utils.log("DEBUG", "Existing Vf Module Resource Version List: " + qryResourceVerList, isDebugEnabled) - def moduleCntr = 0 - // the Generic Vnf resource-version in the 1st entry in the query response - execution.setVariable("DAAIVfMod_genVnfRsrcVer", qryResourceVerList[moduleCntr]) - for (String qryModuleId : qryModuleIdList) { - if (delModuleId.equals(qryModuleId)) { - // a Vf Module with the requested Id exists - execution.setVariable("DAAIVfMod_moduleExists", true) - // find the corresponding value for the is-base-vf-module field - isBaseVfModule = qryBaseModuleList[moduleCntr] - // find the corresponding value for the resource-version field - // note: the Generic Vnf entry also has a resource-version field, so - // add 1 to the index to get the corresponding Vf Module value - execution.setVariable("DAAIVfMod_vfModRsrcVer", qryResourceVerList[moduleCntr+1]) - utils.log("DEBUG", "Match found for Vf Module Id " + qryModuleId + " for Generic Vnf Id " + - execution.getVariable("DAAIVfMod_vnfId") + ", Base Module is " + isBaseVfModule + - ", Resource Version is " + execution.getVariable("vfModRsrcVer"), isDebugEnabled) - break - } - moduleCntr++ - } - } - - // determine if the module to be deleted is a Base Module and/or the Last Module - if (execution.getVariable("DAAIVfMod_moduleExists") == true) { - if (isBaseVfModule.equals("true") && qryModuleIdList.size() != 1) { - execution.setVariable("DAAIVfMod_parseModuleResponse", - "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " + - execution.getVariable("DAAIVfMod_vnfId") + ": is Base Module, not Last Module") - execution.setVariable("DAAIVfMod_isBaseModule", true) - } else { - if (isBaseVfModule.equals("true") && qryModuleIdList.size() == 1) { - execution.setVariable("DAAIVfMod_parseModuleResponse", - "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " + - execution.getVariable("DAAIVfMod_vnfId") + ": is Base Module and Last Module") - execution.setVariable("DAAIVfMod_isBaseModule", true) - execution.setVariable("DAAIVfMod_isLastModule", true) - } else { - if (qryModuleIdList.size() == 1) { - execution.setVariable("DAAIVfMod_parseModuleResponse", - "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " + - execution.getVariable("DAAIVfMod_vnfId") + ": is Not Base Module, is Last Module") - execution.setVariable("DAAIVfMod_isLastModule", true) - } else { - execution.setVariable("DAAIVfMod_parseModuleResponse", - "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " + - execution.getVariable("DAAIVfMod_vnfId") + ": is Not Base Module and Not Last Module") - } - } - } - utils.log("DEBUG", execution.getVariable("DAAIVfMod_parseModuleResponse"), isDebugEnabled) - } else { // (execution.getVariable("DAAIVfMod_moduleExists") == false) - utils.log("DEBUG", "Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " + - execution.getVariable("DAAIVfMod_vnfId"), isDebugEnabled) - execution.setVariable("DAAIVfMod_parseModuleResponse", - "Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " + - execution.getVariable("DAAIVfMod_vnfName")) - } - } - - // parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module - // to be deleted exists for the specified Generic Vnf and if it is the Base Module, - // there are no Add-on Modules present - public void parseForResourceVersion(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def xml = execution.getVariable("DAAIVfMod_queryGenericVnfResponse") - utils.logAudit("DeleteAAIVfModule - queryGenericVnfResponse" + xml) - String resourceVer = utils.getNodeText1(xml, "resource-version") - execution.setVariable("DAAIVfMod_genVnfRsrcVer", resourceVer) - utils.log("DEBUG", "Latest Generic VNF Resource Version: " + resourceVer) - } - - - // generates a WorkflowException if the A&AI query returns a response code other than 200 - public void handleAAIQueryFailure(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - utils.log("ERROR", "Error occurred attempting to query AAI, Response Code " + - execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + - execution.getVariable("DAAIVfMod_queryGenericVnfResponse"), isDebugEnabled) - def errorCode = 5000 - // set the errorCode to distinguish between a A&AI failure - // and the Generic Vnf Id not found - if (execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") == 404) { - errorCode = 1002 - } - exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, execution.getVariable("DAAIVfMod_queryGenericVnfResponse")) - } - - // generates a WorkflowException if - // - the A&AI Vf Module DELETE returns a response code other than 200 - // - the Vf Module is a Base Module that is not the last Vf Module - // - the Vf Module does not exist for the Generic Vnf - public void handleDeleteVfModuleFailure(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - def errorCode = 2000 - def errorResponse = "" - if (execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") != null && - execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") != 200) { - utils.log("DEBUG", "AAI failure deleting a Vf Module: " + - execution.getVariable("DAAIVfMod_deleteVfModuleResponse"), isDebugEnabled) - errorResponse = execution.getVariable("DAAIVfMod_deleteVfModuleResponse") - utils.logAudit("DeleteAAIVfModule - deleteVfModuleResponse" + errorResponse) - errorCode = 5000 - } else { - if (execution.getVariable("DAAIVfMod_isBaseModule", true) == true && - execution.getVariable("DAAIVfMod_isLastModule") == false) { - // attempt to delete a Base Module that is not the last Vf Module - utils.log("DEBUG", execution.getVariable("DAAIVfMod_parseModuleResponse"), isDebugEnabled) - errorResponse = execution.getVariable("DAAIVfMod_parseModuleResponse") - utils.logAudit("DeleteAAIVfModule - parseModuleResponse" + errorResponse) - errorCode = 1002 - } else { - // attempt to delete a non-existant Vf Module - if (execution.getVariable("DAAIVfMod_moduleExists") == false) { - utils.log("DEBUG", execution.getVariable("DAAIVfMod_parseModuleResponse"), isDebugEnabled) - errorResponse = execution.getVariable("DAAIVfMod_parseModuleResponse") - utils.logAudit("DeleteAAIVfModule - parseModuleResponse" + errorResponse) - errorCode = 1002 - } else { - // if the responses get populated corerctly, we should never get here - errorResponse = "Unknown error occurred during DeleteAAIVfModule flow" - } - } - } - - utils.log("ERROR", "Error occurred during DeleteAAIVfModule flow: " + errorResponse, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse) - - } - - // generates a WorkflowException if - // - the A&AI Generic Vnf DELETE returns a response code other than 200 - public void handleDeleteGenericVnfFailure(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("ERROR", "AAI error occurred deleting the Generic Vnf: " - + execution.getVariable("DAAIVfMod_deleteGenericVnfResponse"), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, execution.getVariable("DAAIVfMod_deleteGenericVnfResponse")) - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy deleted file mode 100644 index b65ce74c70..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy +++ /dev/null @@ -1,398 +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.bpmn.common.scripts - -import static org.apache.commons.lang3.StringUtils.* - -import com.google.common.xml.XmlEscapers - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.core.WorkflowException - -/** - * @version 1.0 - */ -class ExceptionUtil extends AbstractServiceTaskProcessor { - - - /** - * This error handling method maps an AAI Exception response to a - * WorkflowException Object. It then sets the WorkflowException Object - * on the execution as "WorkflowException". - * - * This method formats the exception from AAI into the WorkflowException's - * errorMessage that CCD expects. - * - * @param execution the execution - * @param response the aai exception - */ - WorkflowException MapAAIExceptionToWorkflowException(String response, DelegateExecution execution) - { - def utils=new MsoUtils() - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def prefix=execution.getVariable("prefix") - def errorMsg = execution.getVariable(prefix+"ErrorResponse") - utils.log("DEBUG","=========== Begin MapAAIExceptionToWorkflowException ===========",isDebugEnabled) - String text = null - def variables - String errorCode = '5000' - WorkflowException wfex - utils.log("DEBUG","response: " + response, isDebugEnabled) - try{ - try { - //String msg = utils.getNodeXml(response, "Fault") - variables = utils.getMultNodes(response, "variable") - text = utils.getNodeText1(response, "text") - } catch (Exception ex) { - //Ignore the exception - cases include non xml payload - utils.log("DEBUG","error mapping error, ignoring: " + ex,isDebugEnabled) - } - - if(text != null) { - if(variables.size()>=4){ - text = text.replaceFirst("%1", variables[0]) - text = text.replaceFirst("%2", variables[1]) - text = text.replaceFirst("%3", variables[2]) - text = text.replaceFirst("%4", variables[3]) - } - String modifiedErrorMessage = 'Received error from A&AI (' + text +')' - utils.log("DEBUG", "ModifiedErrorMessage " + modifiedErrorMessage, isDebugEnabled) - // let $ModifiedErrorMessage := concat( 'Received error from A',$exceptionaai:ampersand,'AI (' ,functx:replace-multi($ErrorMessage,$from,$Variables ),')') - buildWorkflowException(execution, 5000, modifiedErrorMessage) - - wfex = execution.getVariable("WorkflowException") - utils.log("ERROR","Fault:"+ wfex) - return wfex - } else { - try { - errorCode = MapErrorCode(errorMsg) - String mappedErrorMessage = MapErrorMessage(errorMsg, errorCode) - - int errorCodeInt = Integer.parseInt(errorCode) - buildWorkflowException(execution, errorCodeInt, mappedErrorMessage) - - utils.log("DEBUG", "mappedErrorMessage " + mappedErrorMessage, isDebugEnabled) - wfex = execution.getVariable("WorkflowException") - utils.log("ERROR","Fault:"+ wfex, isDebugEnabled) - return wfex - } catch(Exception ex) { - utils.log("DEBUG","error mapping error, return null: " + ex, isDebugEnabled) - return null - - } - } - }catch(Exception e){ - utils.log("DEBUG", "Exception occured during MapAAIExceptionToWorkflowException: " + e, isDebugEnabled) - buildWorkflowException(execution, 5000, "Error mapping AAI Response to WorkflowException") - } - } - - /** - * This error handling method maps an AAI Exception response to a - * WorkflowException Object. It then sets the WorkflowException Object - * on the execution as "WorkflowException". - * - * This method takes the exact exception inside the tags from AAI Response - * and puts it into the WorkflowException's errorMessage. - * - * @param execution the execution - * @param response the aai exception - */ - WorkflowException MapAAIExceptionToWorkflowExceptionGeneric(DelegateExecution execution, String response, int resCode){ - def utils=new MsoUtils() - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", "Start MapAAIExceptionToWorkflowExceptionGeneric Process", isDebugLogEnabled) - - WorkflowException wfex - try { - if(utils.nodeExists(response, "Fault")){ - String fault = utils.getNodeXml(response, "Fault") - fault = utils.removeXmlPreamble(fault) - fault = fault.replace("", "").replace("", "") - fault = fault.replaceAll("\\s+\\s+", "") // Removes extra white spaces - buildWorkflowException(execution, resCode, fault) - }else if(utils.nodeExists(response, "RESTFault")){ - String rFault = utils.getNodeXml(response, "RESTFault") - buildWorkflowException(execution, resCode, rFault) - }else{ - buildWorkflowException(execution, resCode, "Received a bad response from AAI") - } - } catch (Exception ex) { - utils.log("DEBUG", "Exception Occured during MapAAIExceptionToWorkflowExceptionGeneric: " + ex, isDebugLogEnabled) - buildWorkflowException(execution, resCode, "Internal Error - Occured in MapAAIExceptionToWorkflowExceptionGeneric") - - } - utils.log("DEBUG", "Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugLogEnabled) - utils.log("DEBUG", "Completed MapAAIExceptionToWorkflowExceptionGeneric Process", isDebugLogEnabled) - } - - /** - * This method takes a WorkflowException Object and builds - * WorkflowException Xml. This method should only be used - * for the purpose of sending a sync error response or for - * creating a FalloutHandler request. - * - *@param - WorkflowException Object - * - *@return - String WorkflowException Xml - * - * - */ - String buildErrorResponseXml(WorkflowException wfex) { - String xml - if(wfex != null){ - String mes = XmlEscapers.xmlContentEscaper().escape(wfex.getErrorMessage()) - int code = wfex.getErrorCode() - xml = - """ - ${mes} - ${code} - """ - - }else{ - xml = - """ - Internal Error - 2500 - """ - } - return xml - } - - /* - 5000 Received error from A&AI ($A&AI_ERROR) Asynchronous During orchestration of the recipe, A&AI returned an error. The error returned by A&AI is passed through in $A&AI_ERROR. - 5010 Could not communicate with A&AI Asynchronous During orchestration of the recipe, a connection with A&AI could not be established. - 5020 No response from A&AI Asynchronous During orchestration of the recipe, communication was established with A&AI, but no response was received within the configured timeout. - */ - /** - * - * Utility Method for MapAAIExceptionToWorkflowException - * - *@param - String ErrorMessage - * - *@return - String ErrorCode - * - */ - private String MapErrorCode(String errorMessage) - { - if(errorMessage==null){ - return '5000' - } - errorMessage = errorMessage.toLowerCase(); - if(errorMessage.contains('timed out') || errorMessage.contains('timeout')) - return '5020' - else if (errorMessage.contains('connection')) - return '5010' - else - return '5000' - } - - /** - * - * Utility Method for MapAAIExceptionToWorkflowException - * - *@param - String ErrorMessage - *@param - String ErrorCode - * - *@return - String ErrorMessage - * - */ - private String MapErrorMessage(String errorMessage, String errorCode) - { - if(errorMessage == null){ - errorMessage="" - } - if( errorCode.equals('5010')){ - return 'Could not communicate with A&AI' - }else if (errorCode.equals('5020')){ - return 'No response from A&AI' - }else{ - return 'Received error from A&AI (' +errorMessage +')' - } - } - - /** - * - * Utility Method for Mapping SDNC - * Adapter Response Codes - * - *@param - String sdncResponseCode - * - *@return - String code - * - */ - String MapSDNCResponseCodeToErrorCode(String sdncResponseCode) - { - if (sdncResponseCode == '500') { - return '5310' - } else if ( sdncResponseCode == '408') { - return '5320' - } else if ( sdncResponseCode == '60010') { - return '5350' - } else { - return '5300' - } - } - - /** - * This error handling method builds a WorkflowException Object. It sets it on - * the execution as "WorkflowException". - * - * @param execution the execution - * @param errorCode the error code - * @param errorMessage the error message - */ - public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { - MsoUtils utils = new MsoUtils() - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - String processKey = getProcessKey(execution); - utils.log("DEBUG", "Building a WorkflowException for " + processKey, isDebugLogEnabled) - - WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage); - execution.setVariable("WorkflowException", exception); - utils.log("DEBUG", "Outgoing WorkflowException is " + exception, isDebugLogEnabled) - } - - /** - * This error handling method builds a WorkflowException Object and throws a - * MSOWorkflowException. It throws a "MSOWorkflowException" BpmnError after - * setting the WorkflowException Object on the execution as "WorkflowException". - * - * @param execution the execution - * @param errorCode the error code - * @param errorMessage the error message - */ - public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - String processKey = getProcessKey(execution); - utils.log("Building a WorkflowException for Subflow " + processKey, isDebugLogEnabled) - - WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage); - execution.setVariable("WorkflowException", exception); - utils.log("DEBUG", "Outgoing WorkflowException is " + exception, isDebugLogEnabled) - utils.log("DEBUG", "Throwing MSOWorkflowException", isDebugLogEnabled) - throw new BpmnError("MSOWorkflowException") - } - - /** - * This method is executed after an MSOWorkflowException is caught by a - * subflow (during subflows "Error Handling Sub Process"). - * It ensures the WorkflowException variable is populated before ending the - * subflow and also logs the subflows outgoing WorkflowException Variable. - * - * @param - execution - * - */ - public void processSubflowsBPMNException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - String processKey = getProcessKey(execution) - try{ - utils.log("DEBUG", "Started ProcessSubflowsBPMNException Method", isDebugEnabled) - if(execution.getVariable("WorkflowException") == null){ - buildWorkflowException(execution, 2500, "Internal Error - Occured During " + processKey) - } - - utils.log("DEBUG", processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugEnabled) - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during ProcessSubflowsBPMNException Method: " + e, isDebugEnabled) - } - utils.log("DEBUG", "Completed ProcessSubflowsBPMNException Method", isDebugEnabled) - } - - /** - * This method is executed after an MSOWorkflowException is caught by a - * Mainflow. It builds and returns a FalloutHandler Request. It also - * verifies the WorkflowException variable is populated. - * - * @param - execution - * @param - requestInfo - * - * @return - falloutHandlerRequest - * - */ - public String processMainflowsBPMNException(DelegateExecution execution, String requestInfo){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - String processKey = getProcessKey(execution) - try{ - utils.log("DEBUG", "Started ProcessMainflowBPMNException Method", isDebugEnabled) - if(execution.getVariable("WorkflowException") == null || isBlank(requestInfo)){ - buildWorkflowException(execution, 2500, "Internal Error - WorkflowException Object and/or RequestInfo is null! " + processKey) - } - requestInfo = utils.removeXmlPreamble(requestInfo) - WorkflowException wfex = execution.getVariable("WorkflowException") - String errorMessage = XmlEscapers.xmlContentEscaper().escape(wfex.getErrorMessage()) - int errorCode = wfex.getErrorCode() - - String falloutHandlerRequest = - """ - ${requestInfo} - - ${errorMessage} - ${errorCode} - - """ - - utils.log("DEBUG", processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugEnabled) - utils.log("DEBUG", processKey + " Outgoing FalloutHandler Request is: " + falloutHandlerRequest, isDebugEnabled) - return falloutHandlerRequest - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during ProcessMainflowBPMNException Method: " + e, isDebugEnabled) - return null - } - utils.log("DEBUG", "Completed ProcessMainflowBPMNException Method", isDebugEnabled) - } - - /** - * - * This method is executed after an Java Exception is caught - * It sets the WorkflowException variable. The method can be used in either mainflow or subflows. - * - * @param - execution - * - */ - public void processJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - String processKey = getProcessKey(execution) - try{ - utils.log("DEBUG", "Caught a Java Exception in " + processKey, isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - buildWorkflowException(execution, 2500, "Catch a Java Lang Exception in " + processKey) - - }catch(BpmnError b){ - throw b - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - buildWorkflowException(execution, 2500, "Internal Error - During Process Java Exception") - } - utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) - } - - - public void preProcessRequest(DelegateExecution execution) { - // TODO Auto-generated method stub - - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy deleted file mode 100644 index 0356397eaa..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy +++ /dev/null @@ -1,380 +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.bpmn.common.scripts - -import java.text.SimpleDateFormat - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.DelegateExecution - -public class FalloutHandler extends AbstractServiceTaskProcessor { - String Prefix="FH_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - public initializeProcessVariables(DelegateExecution execution){ - def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - execution.setVariable("prefix",Prefix) - - //These variables are form the input Message to the BPMN - execution.setVariable("FH_request_id","") - execution.setVariable("FH_request_action","") - execution.setVariable("FH_notification-url","") - execution.setVariable("FH_mso-bpel-name","") - execution.setVariable("FH_ErrorCode", "") - execution.setVariable("FH_ErrorMessage", "") - - execution.setVariable("FH_notification-url-Ok", false) - execution.setVariable("FH_request_id-Ok", false) - - //These variables are for Get Mso Aai Password Adapter - execution.setVariable("FH_deliveryStatus", true) - - //update Response Status to pending ...Adapter variables - execution.setVariable("FH_updateResponseStatusPayload", null) - execution.setVariable("FH_updateResponseStatusResponse", null) - - //update Request Gamma ...Adapter variables - execution.setVariable("FH_updateRequestGammaPayload", "") - execution.setVariable("FH_updateRequestGammaResponse", null) - execution.setVariable("FH_updateRequestGammaResponseCode", null) - - //update Request Infra ...Adapter variables - execution.setVariable("FH_updateRequestInfraPayload", "") - execution.setVariable("FH_updateRequestInfraResponse", null) - execution.setVariable("FH_updateRequestInfraResponseCode", null) - - //assign True to success variable - execution.setVariable("FH_success", true) - - //Set notify status to Failed variable - execution.setVariable("FH_NOTIFY_STATUS", "SUCCESS") - - //Set DB update variable - execution.setVariable("FH_updateRequestPayload", "") - execution.setVariable("FH_updateRequestResponse", null) - execution.setVariable("FH_updateRequestResponseCode", null) - - //Auth variables - execution.setVariable("BasicAuthHeaderValue","") - - //Parameter list - execution.setVariable("FH_parameterList", "") - - //Response variables - execution.setVariable("FalloutHandlerResponse","") - execution.setVariable("FH_ErrorResponse", null) - execution.setVariable("FH_ResponseCode", "") - - } catch (Exception e) { - logError('Caught exception in ' + method, e) - // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) - } - } - - public void preProcessRequest (DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - // Initialize flow variables - initializeProcessVariables(execution) - setSuccessIndicator(execution, false) - - setBasicDBAuthHeader(execution, isDebugLogEnabled) - - try { - def xml = execution.getVariable("FalloutHandlerRequest") - utils.log("DEBUG", " XML --> " + xml, isDebugLogEnabled) - utils.logAudit("FalloutHandler request: " + xml) - - //Check the incoming request type - //Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node) - if (utils.nodeExists(xml, "request-information")) { - execution.setVariable("FH_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS - } - - //Check notification-url for the incoming request type - //ACTIVE_REQUESTS may have notificationurl node - //INFRA_ACTIVE_REQUESTS notificationurl node does not exist - def notificationurl = "" - if (utils.nodeExists(xml, "notification-url")) { - notificationurl = utils.getNodeText(xml,"notification-url") - if(notificationurl != null && !notificationurl.isEmpty()) { - utils.log("DEBUG", "********** Incoming notification Url is: " + notificationurl,isDebugLogEnabled); - execution.setVariable("FH_notification-url-Ok", true) - execution.setVariable("FH_notification-url",notificationurl) - } - } - - //Check request_id for the incoming request type - //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not) - //For ACTIVE_REQUESTS payload request-id is NOT optional - def request_id = "" - if (utils.nodeExists(xml, "request-id")) { - execution.setVariable("FH_request_id",utils.getNodeText(xml,"request-id")) - } - utils.logAudit("FH_request_id: " + execution.getVariable("FH_request_id")) - - // INFRA_ACTIVE_REQUESTS have "action" element ... mandatory - // ACTIVE_REQUEST have "request-action" ... mandatory - if (utils.nodeExists(xml, "request-action")) { - execution.setVariable("FH_request_action",utils.getNodeText(xml,"request-action")) - } else if (utils.nodeExists(xml, "action")) { - execution.setVariable("FH_request_action",utils.getNodeText(xml,"action")) - } - - - //Check source for the incoming request type - //For INFRA_ACTIVE_REQUESTS payload source IS optional - //For ACTIVE_REQUESTS payload source is NOT optional - def source = "" - if (utils.nodeExists(xml, "source")) { - execution.setVariable("FH_source",utils.getNodeText(xml,"source")) - } - - //Check if ErrorCode node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above. - def errorCode = "" - if (utils.nodeExists(xml, "ErrorCode")) { - errorCode = utils.getNodeText(xml,"ErrorCode") - if(errorCode != null && !errorCode.isEmpty()) { - execution.setVariable("FH_ErrorCode", errorCode) - } - } - utils.logAudit("FH_ErrorCode: " + errorCode) - - //Check if ErrorMessage node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above. - def errorMessage = "" - if (utils.nodeExists(xml, "ErrorMessage")) { - errorCode = utils.getNodeText(xml,"ErrorMessage") - if(errorCode != null && !errorCode.isEmpty()) { - errorCode = errorCode.replace("&", "&").replace("<", "<").replace(">", ">") - execution.setVariable("FH_ErrorMessage", errorCode) - } - } - - //Check for Parameter List - if (utils.nodeExists(xml, "parameter-list")) { - def parameterList = utils.getNodeXml(xml, "parameter-list", false) - execution.setVariable("FH_parameterList", parameterList) - } - - utils.log("DEBUG","FH_notification-url-Ok --> " + execution.getVariable("FH_notification-url-Ok"),isDebugLogEnabled) - utils.log("DEBUG","FH_request_id-OK --> " + execution.getVariable("FH_request_id-Ok"),isDebugLogEnabled) - - // set the DHV/Service Instantiation values if specified in the request - execution.setVariable("FH_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText1(xml, "is-srv-inst-req")))) - utils.log("DEBUG", "FH_is_srv_inst_req --> " + execution.getVariable("FH_is_srv_inst_req"), isDebugLogEnabled) - execution.setVariable("FH_is_json_content", String.valueOf("JSON".equals(utils.getNodeText1(xml, "resp-content-type")))) - utils.log("DEBUG", "FH_is_json_content --> " + execution.getVariable("FH_is_json_content"), isDebugLogEnabled) - execution.setVariable("FH_service_inst_id", utils.getNodeText1(xml, "service-instance-id")) - utils.log("DEBUG", "FH_service_inst_id --> " + execution.getVariable("FH_service_inst_id"), isDebugLogEnabled) - execution.setVariable("FH_start_time", utils.getNodeText1(xml, "start-time")) - utils.log("DEBUG", "FH_start_time --> " + execution.getVariable("FH_start_time"), isDebugLogEnabled) - // this variable is used by the camunda flow to set the Content-Type for the async response - if (execution.getVariable("FH_is_srv_inst_req").equals("true") && - execution.getVariable("FH_is_json_content").equals("true")) { - execution.setVariable("FH_content_type", "application/json") - } else { - execution.setVariable("FH_content_type", "text/xml") - } - } catch (Exception e) { - logError('Caught exception in ' + method, e) - // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method) - } - - utils.log("DEBUG","OUTOF --> Initialize Variables Fallout Handler #########",isDebugLogEnabled); - } - - public String updateRequestPayload (DelegateExecution execution){ - def method = getClass().getSimpleName() + '.updateRequestPayload(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - String payload = """ - - - - - ${execution.getVariable("FH_request_id")} - BPEL - ${execution.getVariable("FH_ErrorMessage")} - ${execution.getVariable("FH_ErrorCode")} - FAILED - ${execution.getVariable("FH_NOTIFY_STATUS")} - - - - """ - - utils.logAudit("updateRequestPayload: " + payload) - execution.setVariable("FH_updateRequestPayload", payload) - return execution.getVariable("FH_updateRequestPayload") - } catch (Exception e) { - logError('Caught exception in ' + method, e) - // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) - } - } - - public String updateRequestInfraPayload (DelegateExecution execution){ - def method = getClass().getSimpleName() + '.updateRequestInfraPayload(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - String payload = """ - - - - - ${execution.getVariable("FH_request_id")} - BPEL - ${execution.getVariable("FH_ErrorMessage")} - FAILED - 100 - - - - """ - - execution.setVariable("FH_updateRequestInfraPayload", payload) - utils.logAudit("updateRequestInfraPayload: " + payload) - return execution.getVariable("FH_updateRequestInfraPayload") - } catch (Exception e) { - logError('Caught exception in ' + method, e) - // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) - } - } - - public String updateRequestGammaPayload (DelegateExecution execution){ - def method = getClass().getSimpleName() + '.updateRequestGammaPayload(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - String payload = """ - - - - - ${execution.getVariable("FH_request_id")} - BPEL - ${execution.getVariable("FH_ErrorMessage")} - ${execution.getVariable("FH_ErrorCode")} - FAILED - - - - """ - - execution.setVariable("FH_updateRequestGammaPayload", payload) - utils.logAudit("updateRequestGammaPayload: " + payload) - return execution.getVariable("FH_updateRequestGammaPayload") - } catch (Exception e) { - logError('Caught exception in ' + method, e) - // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) - } - } - - public String updateResponseStatusPayload (DelegateExecution execution){ - def method = getClass().getSimpleName() + '.updateResponseStatusPayload(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - String payload = """ - - - - - ${execution.getVariable("FH_request_id")} - BPEL - SENDING_FINAL_NOTIFY - - - - """ - - execution.setVariable("FH_updateResponseStatusPayload", payload) - utils.logAudit("updateResponseStatusPayload: " + payload) - return execution.getVariable("FH_updateResponseStatusPayload") - } catch (Exception e) { - logError('Caught exception in ' + method, e) - // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) - } - } - - public void buildDBWorkflowException(DelegateExecution execution, String responseCodeVariable) { - def method = getClass().getSimpleName() + '.buildDBWorkflowException(' + - 'execution=' + execution.getId() + - ', responseCodeVariable=' + responseCodeVariable + ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def responseCode = execution.getVariable(responseCodeVariable) - // If the HTTP response code was null, it means a connection fault occurred (a java exception) - def errorMessage = responseCode == null ? "Could not connect to DB Adapter" : "DB Adapter returned ${responseCode} response" - def errorCode = responseCode == null ? 7000 : 7020 - // exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage) - } catch (Exception e) { - logError('Caught exception in ' + method, e) - // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) - } - } - - /** - * Used to create a workflow response in success and failure cases. - */ - public void postProcessResponse (DelegateExecution execution) { - def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - Boolean success = (Boolean) execution.getVariable("FH_success") - String out = success ? "Fallout Handler Succeeded" : "Fallout Handler Failed"; - - def falloutHandlerResponse = """ - - ${out} - - """ - - falloutHandlerResponse = utils.formatXml(falloutHandlerResponse) - utils.logAudit("FalloutHandler Response: " + falloutHandlerResponse); - - execution.setVariable("FalloutHandlerResponse", falloutHandlerResponse) - execution.setVariable("WorkflowResponse", falloutHandlerResponse) - execution.setVariable("FH_ResponseCode", success ? "200" : "500") - setSuccessIndicator(execution, success) - - logDebug("FalloutHandlerResponse =\n" + falloutHandlerResponse, isDebugLogEnabled) - } catch (Exception e) { - // Do NOT throw WorkflowException! - logError('Caught exception in ' + method, e) - } - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy deleted file mode 100644 index 95c258f2a4..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy +++ /dev/null @@ -1,170 +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.bpmn.common.scripts -import java.io.Serializable; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.springframework.web.util.UriUtils - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -public class GenerateVfModuleName extends AbstractServiceTaskProcessor{ - - def Prefix="GVFMN_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - - - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - try { - def vnfId = execution.getVariable("vnfId") - utils.log("DEBUG", "vnfId is " + vnfId, isDebugEnabled) - def vnfName = execution.getVariable("vnfName") - utils.log("DEBUG", "vnfName is " + vnfName, isDebugEnabled) - def vfModuleLabel = execution.getVariable("vfModuleLabel") - utils.log("DEBUG", "vfModuleLabel is " + vfModuleLabel, isDebugEnabled) - def personaModelId = execution.getVariable("personaModelId") - utils.log("DEBUG", "personaModelId is " + personaModelId, isDebugEnabled) - execution.setVariable("GVFMN_vfModuleXml", "") - }catch(BpmnError b){ - throw b - }catch(Exception e){ - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in initVariables method!") - } - } - - - public void queryAAI(DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - def method = getClass().getSimpleName() + '.queryAAI(' + - 'execution=' + execution.getId() + - ')' - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def vnfId = execution.getVariable('vnfId') - def personaModelId = execution.getVariable('personaModelId') - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - - String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" - utils.logAudit("AAI endPoint: " + endPoint) - - try { - RESTConfig config = new RESTConfig(endPoint); - def responseData = '' - def aaiRequestId = UUID.randomUUID().toString() - RESTClient client = new RESTClient(config). - addHeader('X-TransactionId', aaiRequestId). - addHeader('X-FromAppId', 'MSO'). - addHeader('Content-Type', 'application/xml'). - addHeader('Accept','application/xml'); - logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) - APIResponse response = client.httpGet() - utils.logAudit("GenerateVfModuleName - invoking httpGet() to AAI") - - responseData = response.getResponseBodyAsString() - if (responseData != null) { - logDebug("Received generic VNF data: " + responseData, isDebugLogEnabled) - - } - - utils.logAudit("GenerateVfModuleName - queryAAIVfModule Response: " + responseData) - utils.logAudit("GenerateVfModuleName - queryAAIVfModule ResponseCode: " + response.getStatusCode()) - - execution.setVariable('GVFMN_queryAAIVfModuleResponseCode', response.getStatusCode()) - execution.setVariable('GVFMN_queryAAIVfModuleResponse', responseData) - logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) - logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) - if (response.getStatusCode() == 200) { - // Set the VfModuleXML - if (responseData != null) { - String vfModulesText = utils.getNodeXml(responseData, "vf-modules") - if (vfModulesText == null || vfModulesText.isEmpty()) { - logDebug("There are no VF modules in this VNF yet", isDebugLogEnabled) - execution.setVariable("GVFMN_vfModuleXml", null) - } - else { - def xmlVfModules= new XmlSlurper().parseText(vfModulesText) - def vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} - int vfModulesSize = 0 - if (vfModules != null) { - vfModulesSize = vfModules.size() - } - String matchingVfModules = "" - for (i in 0..vfModulesSize-1) { - def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i]) - def personaModelIdFromAAI = utils.getNodeText(vfModuleXml, "model-invariant-id") - if (!personaModelIdFromAAI) { - // check old attribute name - personaModelIdFromAAI = utils.getNodeText(vfModuleXml, "persona-model-id") - } - if (personaModelIdFromAAI != null && personaModelIdFromAAI.equals(personaModelId)) { - matchingVfModules = matchingVfModules + utils.removeXmlPreamble(vfModuleXml) - } - } - matchingVfModules = matchingVfModules + "" - logDebug("Matching VF Modules: " + matchingVfModules, isDebugLogEnabled) - execution.setVariable("GVFMN_vfModuleXml", matchingVfModules) - } - } - } - } catch (Exception ex) { - ex.printStackTrace() - logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) - } - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAI(): ' + e.getMessage()) - } - - } - - public void generateName (DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - def method = getClass().getSimpleName() + '.generateName() ' + - 'execution=' + execution.getId() + - ')' - logDebug('Entered ' + method, isDebugLogEnabled) - - String vfModuleXml = execution.getVariable("GVFMN_vfModuleXml") - - String moduleIndex = utils.getLowestUnusedIndex(vfModuleXml) - logDebug("moduleIndex is: " + moduleIndex, isDebugLogEnabled) - def vnfName = execution.getVariable("vnfName") - def vfModuleLabel = execution.getVariable("vfModuleLabel") - def vfModuleName = vnfName + "_" + vfModuleLabel + "_" + moduleIndex - logDebug("vfModuleName is: " + vfModuleName, isDebugLogEnabled) - execution.setVariable("vfModuleName", vfModuleName) - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy deleted file mode 100644 index 8d9defdb86..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy +++ /dev/null @@ -1,309 +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.bpmn.common.scripts - -import static org.apache.commons.lang3.StringUtils.* - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.rest.APIResponse -import org.springframework.web.util.UriUtils - - -/** - * This class supports the GenericDeleteService Sub Flow. - * This Generic sub flow can be used by any flow for the - * goal of deleting a Service-Instance or Service-Subscription. - * The calling flow must set the GENDS_type variable as "service-instance" - * or "service-subscription". - * - * If the resource-version is not provided by the calling flow - * then this sub flow will query the service-instance or - * service-subscription, prior to deleting it, in order to - * obtain this resource version. Upon successful completion of - * this sub flow the GENDS_SuccessIndicator will be true. A - * MSOWorkflowException will be thrown if an error occurs within this flow. - * - * Please map variables to the corresponding variable names - * below. - * - * Note - if this sub flow receives a Not Found (404) response - * from AAI at any time this will be considered an acceptable - * response. - * - * - * Variable Mapping Below - * - * In Mapping Variables: - * For Service-Instance: - * @param - GENDS_serviceInstanceId - * @param - GENDS_serviceType - * @param - GENDS_globalCustomerId - * @param - GENDS_type - * @param (Optional) - GENDS_resourceVersion - * - * For Service-Subscription: - * @param - GENDS_serviceType - * @param - GENDS_globalCustomerId - * @param - GENDS_type - * @param (Optional) - GENDS_resourceVersion - * - * - * Out Mapping Variables: - * @param - GENDS_FoundIndicator - * @param - WorkflowException - * - * - */ -class GenericDeleteService extends AbstractServiceTaskProcessor{ - - String Prefix = "GENDS_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - /** - * This method validates the incoming variables and - * determines if the resource version was provided - * - * @param - execution - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericDeleteService PreProcessRequest Process*** ", isDebugEnabled) - - execution.setVariable("GENDS_resourceVersionProvidedFlag", true) - execution.setVariable("GENDS_SuccessIndicator", false) - execution.setVariable("GENDS_FoundIndicator", false) - - try{ - // Get Variables - String globalCustomerId = execution.getVariable("GENDS_globalCustomerId") - String serviceInstanceId = execution.getVariable("GENDS_serviceInstanceId") - String serviceType = execution.getVariable("GENDS_serviceType") - String type = execution.getVariable("GENDS_type") - - if(type != null){ - utils.log("DEBUG", "Incoming GENDS_type is: " + type, isDebugEnabled) - if(isBlank(globalCustomerId) || isBlank(serviceType)){ - utils.log("DEBUG", "Incoming Required Variable is null!", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") - }else{ - utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - if(type.equalsIgnoreCase("service-instance")){ - if(isBlank(serviceInstanceId)){ - utils.log("DEBUG", "Incoming Required Variable is null!", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") - }else{ - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Preparing Delete Service-Instance Process", isDebugEnabled) - } - }else if(type.equalsIgnoreCase("service-subscription")){ - utils.log("DEBUG", "Preparing Delete Service-Subscription Process", isDebugEnabled) - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") - } - } - - String resourceVersion = execution.getVariable('GENDS_resourceVersion') - if(isBlank(resourceVersion)){ - utils.log("DEBUG", "Service Instance Resource Version is NOT Provided", isDebugEnabled) - execution.setVariable("GENDS_resourceVersionProvidedFlag", false) - }else{ - utils.log("DEBUG", "Incoming SI Resource Version is: " + resourceVersion, isDebugEnabled) - } - - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENDS_type is null. Variable is Required.") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericDeleteService PreProcessRequest method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericDeleteService PreProcessRequest") - - } - utils.log("DEBUG", "*** COMPLETED GenericDeleteService PreProcessRequest Process ***", isDebugEnabled) - } - - /** - * This method executes a GET call to AAI for the service instance - * or service-subscription so that the objects's resource-version - * can be obtained. - * - * @param - execution - */ - public void getServiceResourceVersion(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericDeleteService GetServiceResourceVersion Process*** ", isDebugEnabled) - try { - String serviceType = execution.getVariable("GENDS_serviceType") - utils.log("DEBUG", " Incoming GENDS_serviceType is: " + serviceType, isDebugEnabled) - String globalCustomerId = execution.getVariable("GENDS_globalCustomerId") - utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled) - String type = execution.getVariable("GENDS_type") - String serviceEndpoint = "" - - if(type.equalsIgnoreCase("service-instance")){ - String serviceInstanceId = execution.getVariable("GENDS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENDS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) - serviceEndpoint = UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") - - }else if(type.equalsIgnoreCase("service-subscription")){ - serviceEndpoint = UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") - } - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) - - String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + serviceEndpoint - - execution.setVariable("GENDS_serviceAaiPath", serviceAaiPath) - utils.log("DEBUG", "GET Service Instance AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled) - utils.logAudit("GenericDeleteService GET AAI Path: " + serviceAaiPath) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath) - int responseCode = response.getStatusCode() - execution.setVariable("GENDS_getServiceResponseCode", responseCode) - utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled) - utils.logAudit("GET Service Instance response code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - aaiResponse = aaiResponse.replaceAll("&", "&") - execution.setVariable("GENDS_getServiceResponse", aaiResponse) - - utils.logAudit("GET Service Instance response : " + aaiResponse) - //Process Response - if(responseCode == 200 || responseCode == 202){ - utils.log("DEBUG", "GET Service Received a Good Response: \n" + aaiResponse, isDebugEnabled) - execution.setVariable("GENDS_SuccessIndicator", true) - execution.setVariable("GENDS_FoundIndicator", true) - String resourceVersion = utils.getNodeText1(aaiResponse, "resource-version") - execution.setVariable("GENDS_resourceVersion", resourceVersion) - utils.log("DEBUG", type + " Resource Version is: " + resourceVersion, isDebugEnabled) - - }else if(responseCode == 404){ - utils.log("DEBUG", "GET Service Received a Not Found (404) Response", isDebugEnabled) - execution.setVariable("GENDS_SuccessIndicator", true) - execution.setVariable("WorkflowResponse", " ") // for junits - } - else{ - utils.log("DEBUG", " GET Service Received a Bad Response: \n" + aaiResponse, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", " Error encountered within GenericDeleteService GetServiceResourceVersion method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetServiceResourceVersion") - } - utils.log("DEBUG", " *** COMPLETED GenericDeleteService GetServiceResourceVersion Process*** ", isDebugEnabled) - } - - /** - * This method executes a DELETE call to AAI for the provided - * service-instance or service-subscription. - * - * @param - execution - */ - public void deleteServiceObject(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericDeleteService DeleteServiceObject Process*** ", isDebugEnabled) - try { - AaiUtil aaiUriUtil = new AaiUtil(this) - String type = execution.getVariable("GENDS_type") - String serviceAaiPath = execution.getVariable("GENDS_serviceAaiPath") - String serviceEndpoint = "" - - if(isEmpty(serviceAaiPath)){ - String serviceType = execution.getVariable("GENDS_serviceType") - utils.log("DEBUG", " Incoming GENDS_serviceType is: " + serviceType, isDebugEnabled) - String globalCustomerId = execution.getVariable("GENDS_globalCustomerId") - utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled) - if(type.equalsIgnoreCase("service-instance")){ - String serviceInstanceId = execution.getVariable("GENDS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENDS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) - serviceEndpoint = UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") - - }else if(type.equalsIgnoreCase("service-subscription")){ - serviceEndpoint = UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") - } - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) - - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + serviceEndpoint - } - - String resourceVersion = execution.getVariable("GENDS_resourceVersion") - utils.log("DEBUG", "Incoming Resource Version is: " + resourceVersion, isDebugEnabled) - if(resourceVersion !=null){ - serviceAaiPath = serviceAaiPath +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8") - } - - execution.setVariable("GENDS_deleteServiceAaiPath", serviceAaiPath) - utils.log("DEBUG", "DELETE Service AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled) - utils.logAudit("DELETE Service AAI Path: " + serviceAaiPath) - - APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, serviceAaiPath) - int responseCode = response.getStatusCode() - execution.setVariable("GENDS_deleteServiceResponseCode", responseCode) - utils.log("DEBUG", " DELETE Service response code is: " + responseCode, isDebugEnabled) - utils.logAudit("DELETE Service Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable("GENDS_deleteServiceResponse", aaiResponse) - utils.logAudit("DELETE Service Response: " + aaiResponse) - - //Process Response - if(responseCode == 200 || responseCode == 204){ - utils.log("DEBUG", " DELETE Service Received a Good Response", isDebugEnabled) - execution.setVariable("GENDS_FoundIndicator", true) - }else if(responseCode == 404){ - utils.log("DEBUG", " DELETE Service Received a Not Found (404) Response", isDebugEnabled) - execution.setVariable("GENDS_FoundIndicator", false) - }else{ - utils.log("DEBUG", "DELETE Service Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", " Error encountered within GenericDeleteService DeleteServiceObject method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Delete Service Object") - } - utils.log("DEBUG", " *** COMPLETED GenericDeleteService DeleteServiceObject Process*** ", isDebugEnabled) - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy deleted file mode 100644 index d6a49d9f51..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy +++ /dev/null @@ -1,277 +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.bpmn.common.scripts - -import static org.apache.commons.lang3.StringUtils.* - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.rest.APIResponse -import org.springframework.web.util.UriUtils - - -/** - * TODO: Support getting vnf type = vpe - * - * This class supports the GenericGetVnf Sub Flow. - * This Generic sub flow can be used by any flow for accomplishing - * the goal of getting a Vnf Object (from AAI). The flow currently - * supports the querying of 2 types of Vnfs, generic-vnf and vce. The - * type must be provided by the calling flow and the type should - * be mapped to the variable GENDV_type. The type should either be - * "generic-vnf" or "vce". If the Vnf Id is not provided by the calling - * flow then this sub flow will execute the query to get the - * Vnf using the Vnf Name. Therefore, the calling flow must provide - * either the Vnf Id or Vnf Name. - * - * Upon successful completion of this sub flow the - * GENDV_SuccessIndicator will be true and the query response payload - * will be set to GENDV_vnf. An MSOWorkflowException will - * be thrown upon unsuccessful completion or if an error occurs - * at any time during this sub flow. Please map variables - * to the corresponding variable names below. - * - * Note - if this sub flow receives a Not Found (404) response - * from AAI at any time this will be considered an acceptable - * successful response however the GENDV_FoundIndicator - * set to false. This will allow the calling flow to distinguish - * between the two success scenarios, "Success where Vnf is found" - * and "Success where Vnf is NOT found". - * - * - * Variable Mapping Below - * - * In Mapping Variables: - * @param - GENDV_vnfId - * @param - GENDV_type - * @param (Optional) - GENDV_resourceVersion - * - * - * Out Mapping Variables: - * @param - GENDV_SuccessIndicator - * @param - GENDV_FoundIndicator - * @param - WorkflowException - * - * - */ -class GenericDeleteVnf extends AbstractServiceTaskProcessor{ - - String Prefix = "GENDV_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - /** - * This method validates the incoming variables and - * determines if the resource version was provided - * - * @param - execution - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericDeleteVnf PreProcessRequest Process*** ", isDebugEnabled) - - execution.setVariable("GENDV_resourceVersionProvided", true) - execution.setVariable("GENDV_SuccessIndicator", false) - execution.setVariable("GENDV_FoundIndicator", false) - - try{ - // Get Variables - String vnfId = execution.getVariable("GENDV_vnfId") - String type = execution.getVariable("GENDV_type") - - if(isBlank(type) || isBlank(vnfId)){ - utils.log("ERROR", "Incoming Required Variable is null!", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") - }else{ - utils.log("DEBUG", "Incoming Vnf Id is: " + vnfId, isDebugEnabled) - - String resourceVersion = execution.getVariable("GENDV_resourceVersion") - if(isBlank(resourceVersion)){ - utils.log("DEBUG", "Vnf Resource Version is NOT Provided", isDebugEnabled) - execution.setVariable("GENDV_resourceVersionProvided", false) - }else{ - utils.log("DEBUG", "Incoming Vnf Resource Version is: " + resourceVersion, isDebugEnabled) - } - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericDeleteVnf PreProcessRequest method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericDeleteVnf PreProcessRequest") - - } - utils.log("DEBUG", "*** COMPLETED GenericDeleteVnf PreProcessRequest Process ***", isDebugEnabled) - } - - /** - * This method executes a GET call to AAI for the Vnf - * so that the Vnf's resource-version can be - * obtained. - * - * @param - execution - */ - public void getVnfResourceVersion(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericDeleteVnf GetVnfResourceVersion Process*** ", isDebugEnabled) - try { - String vnfId = execution.getVariable("GENDV_vnfId") - String type = execution.getVariable("GENDV_type") - utils.log("DEBUG", "Type of Vnf Getting is: " + type, isDebugEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - - //Determine Type of Vnf Querying For - def aai_uri = "" - if(type.equals("generic-vnf")){ - aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - }else if(type.equals("vce")){ - aai_uri = aaiUriUtil.getNetworkVceUri(execution) - }else{ - utils.log("DEBUG", "Invalid Incoming GENDV_type", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENDV_type") - } - - String getVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") - - execution.setVariable("GENDV_getVnfPath", getVnfPath) - utils.logAudit("Get Vnf Resource Version Url is: " + getVnfPath) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath) - int responseCode = response.getStatusCode() - execution.setVariable("GENDV_getVnfResponseCode", responseCode) - utils.log("DEBUG", " GET Vnf response code is: " + responseCode, isDebugEnabled) - - utils.logAudit("GenericDeleteVnf Get VNF Response Code: " + responseCode) - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable("GENDV_getVnfResponse", aaiResponse) - - utils.logAudit("GenericDeleteVnf Get VNF Response: " + aaiResponse) - //Process Response - if(responseCode == 200 || responseCode == 202){ - utils.log("DEBUG", "GET Vnf Received a Good Response: \n" + aaiResponse, isDebugEnabled) - execution.setVariable("GENDV_FoundIndicator", true) - if(utils.nodeExists(aaiResponse, "resource-version")){ - String resourceVersion = utils.getNodeText1(aaiResponse, "resource-version") - execution.setVariable("GENDV_resourceVersion", resourceVersion) - utils.log("DEBUG", "SI Resource Version is: " + resourceVersion, isDebugEnabled) - }else{ - utils.log("DEBUG", "GET Vnf for Resource Version Response Does NOT Contain a resource-version", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Unable to obtain Vnf resource-version. GET Vnf Response Does NOT Contain a resource-version") - } - - }else if(responseCode == 404){ - utils.log("DEBUG", "GET Vnf Received a Not Found (404) Response", isDebugEnabled) - execution.setVariable("GENDV_SuccessIndicator", true) - execution.setVariable("WorkflowResponse", " ") // for junits - } - else{ - utils.log("DEBUG", " GET Vnf Received a Bad Response: \n" + aaiResponse, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", " Error encountered within GenericDeleteVnf GetVnfResourceVersion method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfResourceVersion") - } - utils.log("DEBUG", " *** COMPLETED GenericDeleteVnf GetVnfResourceVersion Process*** ", isDebugEnabled) - } - - /** - * This method executes a DELETE call to AAI for the provided - * Vnf. - * - * @param - execution - */ - public void deleteVnf(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericDeleteVnf DeleteVnf Process*** ", isDebugEnabled) - try { - String vnfId = execution.getVariable("GENDV_vnfId") - String type = execution.getVariable("GENDV_type") - utils.log("DEBUG", "Type of Vnf Getting is: " + type, isDebugEnabled) - String resourceVersion = execution.getVariable("GENDV_resourceVersion") - utils.log("DEBUG", "Incoming Vnf Resource Version is: " + resourceVersion, isDebugEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - - //Determine Type of Vnf Querying For - def aai_uri = "" - if(type.equals("generic-vnf")){ - aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - }else if(type.equals("vce")){ - aai_uri = aaiUriUtil.getNetworkVceUri(execution) - }else{ - utils.log("DEBUG", "Invalid Incoming GENDV_type", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENDV_type") - } - - String deleteVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8") - - execution.setVariable("GENDV_deleteVnfPath", deleteVnfPath) - utils.logAudit("Delete Vnf Url is: " + deleteVnfPath) - - APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, deleteVnfPath) - int responseCode = response.getStatusCode() - execution.setVariable("GENDV_deleteVnfResponseCode", responseCode) - utils.log("DEBUG", " DELETE Vnf response code is: " + responseCode, isDebugEnabled) - - utils.logAudit("GenericDeleteVnf Delete VNF Response Code: " + responseCode) - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable("GENDV_deleteVnfResponse", aaiResponse) - - utils.logAudit("GenericDeleteVnf Delete VNF Response: " + aaiResponse) - //Process Response - if(responseCode == 204){ - utils.log("DEBUG", " DELETE Vnf Received a Good Response", isDebugEnabled) - execution.setVariable("GENDV_FoundIndicator", true) - }else if(responseCode == 404){ - utils.log("DEBUG", " DELETE Vnf Received a Not Found (404) Response", isDebugEnabled) - }else if(responseCode == 412){ - utils.log("DEBUG", "DELETE Vnf Received a Resource Version Mismatch Error: \n" + aaiResponse, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 412, "Delete Vnf Received a resource-version Mismatch Error Response from AAI") - }else{ - utils.log("DEBUG", "DELETE Vnf Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", " Error encountered within GenericDeleteVnf DeleteVnf method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Delete Vnf") - } - utils.log("DEBUG", " *** COMPLETED GenericDeleteVnf DeleteVnf Process*** ", isDebugEnabled) - } - - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy deleted file mode 100644 index 3b380a9164..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy +++ /dev/null @@ -1,471 +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.bpmn.common.scripts - -import org.apache.commons.lang3.StringEscapeUtils -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.rest.APIResponse -import org.springframework.web.util.UriUtils - -import static org.apache.commons.lang3.StringUtils.isBlank - - -/** - * This class supports the GenericGetService Sub Flow. - * This Generic sub flow can be used by any flow for accomplishing - * the goal of getting a Service-Instance or Service-Subscription (from AAI). - * The calling flow must set the GENGS_type variable as "service-instance" - * or "service-subscription". - * - * When using to Get a Service-Instance: - * If the global-customer-id and service-type are not provided - * this flow executes a query to get the service- Url using the - * Service Id or Name (whichever is provided). - * - * When using to Get a Service-Subscription: - * The global-customer-id and service-type must be - * provided. - * - * Upon successful completion of this sub flow the - * GENGS_SuccessIndicator will be true and the query response payload - * will be set to GENGS_service. An MSOWorkflowException will - * be thrown upon unsuccessful completion or if an error occurs - * at any time during this sub flow. Please map variables - * to the corresponding variable names below. - * - * Note - If this sub flow receives a Not Found (404) response - * from AAI at any time this will be considered an acceptable - * successful response however the GENGS_FoundIndicator - * will be set to false. This variable will allow the calling flow - * to distinguish between the two Success scenarios, - * "Success where service- is found" and - * "Success where service- is NOT found". - * - * - * Variable Mapping Below: - * - * In Mapping Variables: - * For Allotted-Resource: - * @param - GENGS_allottedResourceId - * @param - GENGS_type - * @param (Optional) - GENGS_serviceInstanceId - * @param (Optional) - GENGS_serviceType - * @param (Optional) - GENGS_globalCustomerId - * - * For Service-Instance: - * @param - GENGS_serviceInstanceId or @param - GENGS_serviceInstanceName - * @param - GENGS_type - * @param (Optional) - GENGS_serviceType - * @param (Optional) - GENGS_globalCustomerId - * - * For Service-Subscription: - * @param - GENGS_type - * @param - GENGS_serviceType - * @param - GENGS_globalCustomerId - * - * - * Out Mapping Variables: - * @param - GENGS_service - * @param - GENGS_FoundIndicator - * @param - WorkflowException - */ -class GenericGetService extends AbstractServiceTaskProcessor{ - - String Prefix = "GENGS_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - /** - * This method validates the incoming variables and - * determines the subsequent event based on which - * variables the calling flow provided. - * - * @param - execution - * - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericGetService PreProcessRequest Process*** ", isDebugEnabled) - - execution.setVariable("GENGS_obtainObjectsUrl", false) - execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false) - execution.setVariable("GENGS_SuccessIndicator", false) - execution.setVariable("GENGS_FoundIndicator", false) - execution.setVariable("GENGS_resourceLink", null) - execution.setVariable("GENGS_siResourceLink", null) - - try{ - // Get Variables - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") - String serviceType = execution.getVariable("GENGS_serviceType") - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - String type = execution.getVariable("GENGS_type") - - if(type != null){ - utils.log("DEBUG", "Incoming GENGS_type is: " + type, isDebugEnabled) - if(type.equalsIgnoreCase("allotted-resource")){ - if(isBlank(allottedResourceId)){ - utils.log("DEBUG", "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") - }else{ - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) - if(isBlank(globalCustomerId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ - execution.setVariable("GENGS_obtainObjectsUrl", true) - }else{ - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled) - } - } - }else if(type.equalsIgnoreCase("service-instance")){ - if(isBlank(serviceInstanceId) && isBlank(serviceInstanceName)){ - utils.log("DEBUG", "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") - }else{ - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Name is: " + serviceInstanceName, isDebugEnabled) - if(isBlank(globalCustomerId) || isBlank(serviceType)){ - execution.setVariable("GENGS_obtainObjectsUrl", true) - if(isBlank(serviceInstanceId)){ - execution.setVariable("GENGS_obtainServiceInstanceUrlByName", true) - } - }else{ - utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - } - } - }else if(type.equalsIgnoreCase("service-subscription")){ - if(isBlank(serviceType) || isBlank(globalCustomerId)){ - utils.log("DEBUG", "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") - }else{ - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled) - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENGS_type is null. Variable is Required.") - } - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", "Internal Error encountered within GenericGetService PreProcessRequest method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetService PreProcessRequest") - - } - utils.log("DEBUG", "*** COMPLETED GenericGetService PreProcessRequest Process ***", isDebugEnabled) - } - - /** - * This method obtains the Url to the provided service instance - * using the Service Instance Id. - * - * @param - execution - */ - public void obtainServiceInstanceUrlById(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlById Process*** ", isDebugEnabled) - try { - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - - String type = execution.getVariable("GENGS_type") - String path = "" - if(type.equalsIgnoreCase("service-instance")){ - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - utils.log("DEBUG", " Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId, isDebugEnabled) - path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}" - utils.logAudit("Service Instance Node Query Url is: " + path) - utils.log("DEBUG", "Service Instance Node Query Url is: " + path, isDebugEnabled) - }else if(type.equalsIgnoreCase("allotted-resource")){ - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - utils.log("DEBUG", " Querying Node for Service-Instance URL by using Allotted Resource Id: " + allottedResourceId, isDebugEnabled) - path = "${aai_uri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}" - utils.logAudit("Allotted Resource Node Query Url is: " + path) - utils.log("DEBUG", "Allotted Resource Node Query Url is: " + path, isDebugEnabled) - } - - //String url = "${aai_endpoint}${path}" host name needs to be removed from property - String url = "${path}" - execution.setVariable("GENGS_genericQueryPath", url) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_genericQueryResponseCode", responseCode) - utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled) - utils.logAudit("GenericGetService AAI GET Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENGS_obtainSIUrlResponseBeforeUnescaping", aaiResponse) - utils.log("DEBUG", "GenericGetService AAI Response before unescaping: " + aaiResponse, isDebugEnabled) - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable("GENGS_genericQueryResponse", aaiResponse) - utils.logAudit("GenericGetService AAI Response: " + aaiResponse) - utils.log("DEBUG", "GenericGetService AAI Response: " + aaiResponse, isDebugEnabled) - - //Process Response - if(responseCode == 200){ - utils.log("DEBUG", "Generic Query Received a Good Response Code", isDebugEnabled) - execution.setVariable("GENGS_SuccessIndicator", true) - if(utils.nodeExists(aaiResponse, "result-data")){ - utils.log("DEBUG", "Generic Query Response Does Contain Data" , isDebugEnabled) - execution.setVariable("GENGS_FoundIndicator", true) - String resourceLink = utils.getNodeText1(aaiResponse, "resource-link") - execution.setVariable("GENGS_resourceLink", resourceLink) - execution.setVariable("GENGS_siResourceLink", resourceLink) - }else{ - utils.log("DEBUG", "Generic Query Response Does NOT Contains Data" , isDebugEnabled) - execution.setVariable("WorkflowResponse", " ") //for junits - } - }else if(responseCode == 404){ - utils.log("DEBUG", "Generic Query Received a Not Found (404) Response", isDebugEnabled) - execution.setVariable("GENGS_SuccessIndicator", true) - execution.setVariable("WorkflowResponse", " ") //for junits - }else{ - utils.log("DEBUG", "Generic Query Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericGetService ObtainServiceInstanceUrlById method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlById") - } - utils.log("DEBUG", " *** COMPLETED GenericGetService ObtainServiceInstanceUrlById Process*** ", isDebugEnabled) - } - - /** - * This method obtains the Url to the provided service instance - * using the Service Instance Name. - * - * @param - execution - */ - public void obtainServiceInstanceUrlByName(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlByName Process*** ", isDebugEnabled) - try { - String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") - utils.log("DEBUG", " Querying Node for Service-Instance URL by using Service-Instance Name " + serviceInstanceName, isDebugEnabled) - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-name:EQUALS:${serviceInstanceName}" - - //String url = "${aai_endpoint}${path}" host name needs to be removed from property - String url = "${path}" - execution.setVariable("GENGS_obtainSIUrlPath", url) - - utils.logAudit("GenericGetService AAI Endpoint: " + aai_endpoint) - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode) - utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled) - utils.logAudit("GenericGetService AAI Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse) - utils.logAudit("GenericGetService AAI Response: " + aaiResponse) - //Process Response - if(responseCode == 200){ - utils.log("DEBUG", " Query for Service Instance Url Received a Good Response Code", isDebugEnabled) - execution.setVariable("GENGS_SuccessIndicator", true) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - boolean nodeExists = isBlank(globalCustomerId) ? utils.nodeExists(aaiResponse, "result-data") : hasCustomerServiceInstance(aaiResponse, globalCustomerId) - if(nodeExists){ - utils.log("DEBUG", "Query for Service Instance Url Response Does Contain Data" , isDebugEnabled) - execution.setVariable("GENGS_FoundIndicator", true) - String resourceLink = utils.getNodeText1(aaiResponse, "resource-link") - execution.setVariable("GENGS_resourceLink", resourceLink) - execution.setVariable("GENGS_siResourceLink", resourceLink) - }else{ - utils.log("DEBUG", "Query for Service Instance Url Response Does NOT Contains Data" , isDebugEnabled) - execution.setVariable("WorkflowResponse", " ") //for junits - } - }else if(responseCode == 404){ - utils.log("DEBUG", " Query for Service Instance Received a Not Found (404) Response", isDebugEnabled) - execution.setVariable("GENGS_SuccessIndicator", true) - execution.setVariable("WorkflowResponse", " ") //for junits - }else{ - utils.log("DEBUG", "Query for Service Instance Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericGetService ObtainServiceInstanceUrlByName method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlByName") - } - utils.log("DEBUG", " *** COMPLETED GenericGetService ObtainServiceInstanceUrlByName Process*** ", isDebugEnabled) - } - - - /** - * This method executes a GET call to AAI to obtain the - * service-instance or service-subscription - * - * @param - execution - */ - public void getServiceObject(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericGetService GetServiceObject Process*** ", isDebugEnabled) - try { - String type = execution.getVariable("GENGS_type") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String serviceEndpoint = "" - - utils.logAudit("GenericGetService getServiceObject AAI Endpoint: " + aai_endpoint) - if(type.equalsIgnoreCase("service-instance")){ - String siResourceLink = execution.getVariable("GENGS_resourceLink") - if(isBlank(siResourceLink)){ - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENGS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) - String serviceType = execution.getVariable("GENGS_serviceType") - utils.log("DEBUG", " Incoming GENGS_serviceType is: " + serviceType, isDebugEnabled) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled) - - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") - }else{ - utils.log("DEBUG", "Incoming Service Instance Url is: " + siResourceLink, isDebugEnabled) - String[] split = siResourceLink.split("/aai/") - serviceEndpoint = "/aai/" + split[1] - } - }else if(type.equalsIgnoreCase("allotted-resource")){ - String siResourceLink = execution.getVariable("GENGS_resourceLink") - if(isBlank(siResourceLink)){ - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - utils.log("DEBUG", " Incoming GENGS_allottedResourceId is: " + allottedResourceId, isDebugEnabled) - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENGS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) - String serviceType = execution.getVariable("GENGS_serviceType") - utils.log("DEBUG", " Incoming GENGS_serviceType is: " + serviceType, isDebugEnabled) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled) - - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") - }else{ - utils.log("DEBUG", "Incoming Allotted-Resource Url is: " + siResourceLink, isDebugEnabled) - String[] split = siResourceLink.split("/aai/") - serviceEndpoint = "/aai/" + split[1] - } - }else if(type.equalsIgnoreCase("service-subscription")){ - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - String serviceType = execution.getVariable("GENGS_serviceType") - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") - } - - String serviceUrl = "${aai_endpoint}" + serviceEndpoint - - execution.setVariable("GENGS_getServiceUrl", serviceUrl) - utils.log("DEBUG", "GET Service AAI Path is: \n" + serviceUrl, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceUrl) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_getServiceResponseCode", responseCode) - utils.log("DEBUG", " GET Service response code is: " + responseCode, isDebugEnabled) - utils.logAudit("GenericGetService AAI Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable("GENGS_getServiceResponse", aaiResponse) - utils.logAudit("GenericGetService AAI Response: " + aaiResponse) - aaiResponse = aaiResponse.replaceAll("&", "&") - //Process Response - if(responseCode == 200 || responseCode == 202){ - utils.log("DEBUG", "GET Service Received a Good Response Code", isDebugEnabled) - if(utils.nodeExists(aaiResponse, "service-instance") || utils.nodeExists(aaiResponse, "service-subscription")){ - utils.log("DEBUG", "GET Service Response Contains a service-instance" , isDebugEnabled) - execution.setVariable("GENGS_FoundIndicator", true) - execution.setVariable("GENGS_service", aaiResponse) - execution.setVariable("WorkflowResponse", aaiResponse) - - }else{ - utils.log("DEBUG", "GET Service Response Does NOT Contain Data" , isDebugEnabled) - } - }else if(responseCode == 404){ - utils.log("DEBUG", "GET Service Received a Not Found (404) Response", isDebugEnabled) - execution.setVariable("WorkflowResponse", " ") //for junits - } - else{ - utils.log("DEBUG", " GET Service Received a Bad Response: \n" + aaiResponse, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", " Error encountered within GenericGetService GetServiceObject method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GenericGetService") - } - utils.log("DEBUG", " *** COMPLETED GenericGetService GetServiceObject Process*** ", isDebugEnabled) - } - - /** - * An utility method which check whether a service(by name) is already present within a globalCustomerId or not. - * @param jsonResponse raw response received from AAI by searching ServiceInstance by Name. - * @param globalCustomerId - * @return {@code true} if globalCustomerId is found at 6th position within "resource-link", {@code false} in any other cases. - */ - public boolean hasCustomerServiceInstance(String aaiResponse, final String globalCustomerId) { - if (isBlank(aaiResponse)) { - return false - } - aaiResponse = utils.removeXmlNamespaces(aaiResponse) - ArrayList linksArray = utils.getMultNodeObjects(aaiResponse, "resource-link") - if (linksArray == null || linksArray.size() == 0) { - return false - } - for (String resourceLink : linksArray) { - int custStart = resourceLink.indexOf("customer/") - int custEnd = resourceLink.indexOf("/service-subscriptions/") - String receivedCustomerId = resourceLink.substring(custStart + 9, custEnd) - if (globalCustomerId.equals(receivedCustomerId)) { - return true - } - } - return false - } - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy deleted file mode 100644 index 1e181a6ee9..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy +++ /dev/null @@ -1,273 +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.bpmn.common.scripts - -import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.*; - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.rest.APIResponse -import org.springframework.web.util.UriUtils - - -/** - * TODO: Support getting vnf type = vpe - * - * This class supports the GenericGetVnf Sub Flow. - * This Generic sub flow can be used by any flow for accomplishing - * the goal of getting a Vnf Object (from AAI). The flow currently - * supports the querying of 2 types of Vnfs, generic-vnf and vce. The - * type must be provided by the calling flow and the type should - * be mapped to the variable GENGV_type. The type should either be - * "generic-vnf" or "vce". If the Vnf Id is not provided by the calling - * flow then this sub flow will execute the query to get the - * Vnf using the Vnf Name. Therefore, the calling flow must provide - * either the Vnf Id or Vnf Name. - * - * Upon successful completion of this sub flow the - * GENGV_SuccessIndicator will be true and the query response payload - * will be set to GENGV_vnf. An MSOWorkflowException will - * be thrown upon unsuccessful completion or if an error occurs - * at any time during this sub flow. Please map variables - * to the corresponding variable names below. - * - * Note - if this sub flow receives a Not Found (404) response - * from AAI at any time this will be considered an acceptable - * successful response however the GENGV_FoundIndicator - * set to false. This will allow the calling flow to distinguish - * between the two success scenarios, "Success where Vnf is found" - * and "Success where Vnf is NOT found". - * - * - * Variable Mapping Below - * - * In Mapping Variables: - * @param - GENGV_vnfId or @param - GENGV_vnfName - * @param - GENGV_type - * - * Out Mapping Variables: - * @param - GENGV_vnf - * @param - GENGV_SuccessIndicator - * @param - GENGV_FoundIndicator - * @param - WorkflowException - * - * - */ -class GenericGetVnf extends AbstractServiceTaskProcessor{ - - String Prefix = "GENGV_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - /** - * This method validates the incoming variables and - * determines the subsequent event based on which - * variables the calling flow provided. - * - * @param - execution - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericGetVnf PreProcessRequest Process*** ", isDebugEnabled) - - execution.setVariable("GENGV_getVnfByName", false) - execution.setVariable("GENGV_SuccessIndicator", false) - execution.setVariable("GENGV_FoundIndicator", false) - - try{ - // Get Variables - String vnfId = execution.getVariable("GENGV_vnfId") - utils.log("DEBUG", "Incoming Vnf Id is: " + vnfId, isDebugEnabled) - String vnfName = execution.getVariable("GENGV_vnfName") - utils.log("DEBUG", "Incoming Vnf Name is: " + vnfName, isDebugEnabled) - - if(isBlank(vnfId) && isBlank(vnfName)){ - utils.log("DEBUG", "Incoming Vnf Name and Vnf Id are null. At least one is required!", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Vnf Name and Vnf Id are null. At least one is required.") - }else{ - if(isBlank(vnfId)){ - execution.setVariable("GENGV_getVnfByName", true) - } - } - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", " Error encountered within GenericGetVnf PreProcessRequest method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetVnf PreProcessRequest") - - } - utils.log("DEBUG", "*** COMPLETED GenericGetVnf PreProcessRequest Process ***", isDebugEnabled) - } - - /** - * This method executes a GET call to AAI to obtain the - * Vnf using the Vnf Name - * - * @param - execution - */ - public void getVnfByName(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericGetVnf GetVnfByName Process*** ", isDebugEnabled) - try { - String vnfName = execution.getVariable("GENGV_vnfName") - utils.log("DEBUG", "Getting Vnf by Vnf Name: " + vnfName, isDebugEnabled) - String type = execution.getVariable("GENGV_type") - utils.log("DEBUG", "Type of Vnf Getting is: " + type, isDebugEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - - //Determine Type of Vnf Querying For. - def aai_uri = "" - if(type.equals("generic-vnf")){ - aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - }else if(type.equals("vce")){ - aai_uri = aaiUriUtil.getNetworkVceUri(execution) - }else{ - utils.log("DEBUG", "Invalid Incoming GENGV_type", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENGV_type") - } - - String getVnfPath = "${aai_endpoint}${aai_uri}?vnf-name=" + UriUtils.encode(vnfName, "UTF-8") + "&depth=1" - - execution.setVariable("GENGV_getVnfPath", getVnfPath) - utils.logAudit("Get Vnf Url is: " + getVnfPath) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath) - int responseCode = response.getStatusCode() - execution.setVariable("GENGV_getVnfResponseCode", responseCode) - utils.log("DEBUG", " GET Vnf response code is: " + responseCode, isDebugEnabled) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable("GENGV_getVnfResponse", aaiResponse) - - //Process Response - if(responseCode == 200){ - utils.log("DEBUG", "GET Vnf Received a Good Response", isDebugEnabled) - if(utils.nodeExists(aaiResponse, type)){ - utils.log("DEBUG", "GET Vnf Response Contains a Vnf", isDebugEnabled) - execution.setVariable("GENGV_FoundIndicator", true) - execution.setVariable("GENGV_vnf", aaiResponse) - execution.setVariable("WorkflowResponse", aaiResponse) - }else{ - utils.log("DEBUG", "GET Vnf Response Does NOT Contain a Vnf", isDebugEnabled) - } - - }else if(responseCode == 404){ - utils.log("DEBUG", "GET Vnf Received a Not Found (404) Response", isDebugEnabled) - }else{ - utils.log("DEBUG", "GET Vnf Received a Bad Response: \n" + aaiResponse, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericGetVnf GetVnfByName method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfByName") - } - utils.log("DEBUG", " *** COMPLETED GenericGetVnf GetVnfByName Process*** ", isDebugEnabled) - } - - /** - * This method executes a GET call to AAI to obtain the - * Vnf using the Vnf Id - * - * @param - execution - */ - public void getVnfById(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericGetVnf GetVnfById Process*** ", isDebugEnabled) - try { - String vnfId = execution.getVariable("GENGV_vnfId") - utils.log("DEBUG", "Getting Vnf by Vnf Id: " + vnfId, isDebugEnabled) - String type = execution.getVariable("GENGV_type") - utils.log("DEBUG", "Type of Vnf Getting is: " + type, isDebugEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - - //Determine Type of Vnf Querying For. - def aai_uri = "" - if(type.equals("generic-vnf")){ - aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - }else if(type.equals("vce")){ - aai_uri = aaiUriUtil.getNetworkVceUri(execution) - }else if(type.equals("vpe")){ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "GenericGetVnf does not yet support getting type of vnf = vpe") - }else{ - utils.log("DEBUG", "Invalid Incoming GENGV_type", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENGV_type") - } - utils.log("DEBUG", "Using AAI Uri: " + aai_uri, isDebugEnabled) - - String getVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" - utils.log("DEBUG", "GET Vnf Endpoint is: " + getVnfPath, isDebugEnabled) - - execution.setVariable("GENGV_getVnfPath", getVnfPath) - utils.logAudit("Get Vnf Url is: " + getVnfPath) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath) - int responseCode = response.getStatusCode() - execution.setVariable("GENGV_getVnfResponseCode", responseCode) - utils.log("DEBUG", " GET Vnf response code is: " + responseCode, isDebugEnabled) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable("GENGV_getVnfResponse", aaiResponse) - - //Process Response - if(responseCode == 200){ - utils.log("DEBUG", "GET Vnf Received a Good Response", isDebugEnabled) - if(utils.nodeExists(aaiResponse, type)){ - utils.log("DEBUG", "GET Vnf Response Contains a Vnf", isDebugEnabled) - execution.setVariable("GENGV_FoundIndicator", true) - execution.setVariable("GENGV_vnf", aaiResponse) - execution.setVariable("WorkflowResponse", aaiResponse) - }else{ - utils.log("DEBUG", "GET Vnf Response Does NOT Contain a Vnf", isDebugEnabled) - } - - }else if(responseCode == 404){ - utils.log("DEBUG", "GET Vnf Received a Not Found (404) Response", isDebugEnabled) - }else{ - utils.log("DEBUG", "GET Vnf Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericGetVnf GetVnfById method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfById") - } - utils.log("DEBUG", " *** COMPLETED GenericGetVnf GetVnfById Process*** ", isDebugEnabled) - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericNotificationService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericNotificationService.groovy deleted file mode 100644 index 7f3b41d6ec..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericNotificationService.groovy +++ /dev/null @@ -1,21 +0,0 @@ -package org.openecomp.mso.bpmn.common.scripts - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import java.text.SimpleDateFormat - -public class GenericNotificationService extends AbstractServiceTaskProcessor { - - - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - public void preProcessRequest (DelegateExecution execution) { - - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutService.groovy deleted file mode 100644 index d1b733aecb..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutService.groovy +++ /dev/null @@ -1,276 +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.bpmn.common.scripts - -import static org.apache.commons.lang3.StringUtils.*; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.apache.commons.codec.binary.Base64 -import org.apache.commons.lang3.* - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.net.URLEncoder; -import org.springframework.web.util.UriUtils - -/** - * This class supports the GenericPutService Sub Flow. - * This Generic sub flow can be used by any flow for the - * goal of creating a Service Instance or Service-Subscription in AAI. Upon successful completion of - * this sub flow the GENPS_SuccessIndicator will be true. - * The calling flow must set the GENPS_type variable as "service-instance" - * or "service-subscription". - * A MSOWorkflowException will be thrown Upon unsuccessful - * completion or if an error occurs within this flow. - * Please map variables to the corresponding variable names - * below. - * - * - * Incoming Required Variables: - * @param - GENPS_requestId - * @param - GENPS_type - Required field. This will be required field populated as service-instance or service-subscription - * @param - GENPS_globalSubscriberId - Required field - * @param - GENPS_serviceType - Required Field - * @param - GENPS_payload - Required Field This will be the payload that needs to be sent. - * - * @param - GENPS_serviceInstanceId - Conditional Field. Required for service-instance. - * @param - GENPS_allottedResourceId - Conditional Field. Required for allotted-resource. - * @param - GENPS_tunnelXconnectId - Conditional Field. Required for tunnel-xconnect. - * - * @param - GENPS_serviceResourceVersion - Conditional Field. Needs to be provided only in case of update for both service-instance and service subscription. The calling flows - * should check if a service-instance or servic-subscription exists by calling the subflow GenericGetService. if it exists then resourceversion should be - * obtained from aai and sent as an input parameter. - * - * Outgoing Variables: - * @param - GENPS_SuccessIndicator - * @param - WorkflowException - * - * - */ - - -class GenericPutService extends AbstractServiceTaskProcessor{ - - String Prefix = "GENPS_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - - public void preProcessRequest(DelegateExecution execution) { - execution.setVariable("isDebugLogEnabled","true") - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericPutService PreProcessRequest Process*** ", isDebugEnabled) - - execution.setVariable("GENPS_SuccessIndicator", false) - - try{ - // Get Variables - String requestId = execution.getVariable("GENPS_requestId") - utils.log("DEBUG", "Incoming GENPS_requestId is: " + requestId, isDebugEnabled) - - String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") - String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - String serviceType = execution.getVariable("GENPS_serviceType") - String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") - String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") - String type = execution.getVariable("GENPS_type") - - if(type != null){ - utils.log("DEBUG", "Incoming GENPS_type is: " + type, isDebugEnabled) - if(type.equalsIgnoreCase("service-instance")){ - if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ - utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") - }else{ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - } - }else if(type.equalsIgnoreCase("service-subscription")){ - if(isBlank(serviceType) || isBlank(globalSubscriberId)){ - utils.log("DEBUG", "Incoming ServiceType or GlobalSubscriberId is null. These variables are required to create a service-subscription.", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") - }else{ - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - } - }else if(type.equalsIgnoreCase("allotted-resource")){ - if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId)){ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") - }else{ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) - } - }else if(type.equalsIgnoreCase("tunnel-xconnect")){ - if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId) || isBlank(tunnelXconnectId)){ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Tunnel Xconnect Id is: " + tunnelXconnectId, isDebugEnabled) - utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") - }else{ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Tunnel Xconnect Id is: " + tunnelXconnectId, isDebugEnabled) - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENPS_type is null. Variable is Required.") - } - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericPutService PreProcessRequest method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericPutService PreProcessRequest") - - } - utils.log("DEBUG", "*** COMPLETED GenericPutService PreProcessRequest Process ***", isDebugEnabled) - - } - - /** - * This method executes a Put call to AAI for the provided - * service instance. - * - * @param - execution - * - */ - public void putServiceInstance(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericPutService PutServiceInstance method*** ", isDebugEnabled) - try { - String type = execution.getVariable("GENPS_type") - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) - String namespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) - logDebug('AAI namespace is: ' + namespace, isDebugEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String serviceAaiPath = "" - String payload = execution.getVariable("GENPS_payload") - execution.setVariable("GENPS_payload", payload) - utils.log("DEBUG", "Incoming GENPS_payload is: " + payload, isDebugEnabled) - utils.logAudit(payload) - - String serviceType = execution.getVariable("GENPS_serviceType") - utils.log("DEBUG", " Incoming GENPS_serviceType is: " + serviceType, isDebugEnabled) - - String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - - // This IF clause is if we need to create a new Service Instance - if(type.equalsIgnoreCase("service-instance")){ - - String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) - - // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + URLEncoder.encode(serviceInstanceId,"UTF-8") - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") - - }else if(type.equalsIgnoreCase("service-subscription")){ - - // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") - }else if(type.equalsIgnoreCase("allotted-resource")){ - - String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) - String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") - utils.log("DEBUG", " Incoming GENPS_allottedResourceId is: " + allottedResourceId, isDebugEnabled) - - // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") - }else if(type.equalsIgnoreCase("tunnel-xconnect")){ - - String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) - String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") - utils.log("DEBUG", " Incoming GENPS_allottedResourceId is: " + allottedResourceId, isDebugEnabled) - String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") - utils.log("DEBUG", " Incoming GENPS_tunnelXconnectId is: " + tunnelXconnectId, isDebugEnabled) - - // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + "/tunnel-xconnects/tunnel-xconnect/" + UriUtils.encode(tunnelXconnectId,"UTF-8") - } - - String resourceVersion = execution.getVariable("GENPS_serviceResourceVersion") - utils.log("DEBUG", "Incoming Resource Version is: " + resourceVersion, isDebugEnabled) - if(resourceVersion !=null){ - serviceAaiPath = serviceAaiPath +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8") - } - - execution.setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath) - utils.log("DEBUG", "PUT Service Instance AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled) - APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) - int responseCode = response.getStatusCode() - execution.setVariable("GENPS_putServiceInstanceResponseCode", responseCode) - utils.log("DEBUG", " Put Service Instance response code is: " + responseCode, isDebugEnabled) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable("GENPS_putServiceInstanceResponse", aaiResponse) - - //Process Response - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) - //200 OK 201 CREATED 202 ACCEPTED - { - utils.log("DEBUG", "PUT Service Instance Received a Good Response", isDebugEnabled) - execution.setVariable("GENPS_SuccessIndicator", true) - } - - else{ - utils.log("DEBUG", "Put Generic Service Instance Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericPutService PutServiceInstance method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Put Service Instance") - } - utils.log("DEBUG", " *** COMPLETED GenericPutService PutServiceInstance Process*** ", isDebugEnabled) - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy deleted file mode 100644 index e814950b94..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy +++ /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.bpmn.common.scripts - -import static org.apache.commons.lang3.StringUtils.* - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.rest.APIResponse -import org.springframework.web.util.UriUtils - -/** - * TODO: Support Putting vnf type = vpe and vce - * - * This class supports the GenericPutVnf Sub Flow. - * This Generic sub flow can be used by any flow for accomplishing - * the goal of Creating/Updating(PUT) a Vnf Object (in AAI). The flow - * supports the Creating/Updating of 3 types of Vnfs (generic-vnf, vce, and vpe). - * The "type" must be provided by the calling flow and this type should - * be mapped to the variable GENPV_type. The type should either be - * "generic-vnf", "vce", or "vpe". In addition, the Vnf Id and - * payload should be provided. - * - * Upon successful completion of this sub flow the - * GENPV_SuccessIndicator. An MSOWorkflowException will - * be thrown if an error occurs at any time during this - * sub flow. Please map input variables to the corresponding - * variable names below. - * - * - * Incoming Required Variables: - * @param - GENPV_vnfId - * @param - GENPV_vnfPayload - * @param - GENPV_type - * - * - * Outgoing Variables: - * @param - GENPV_SuccessIndicator - * @param - WorkflowException - */ -class GenericPutVnf extends AbstractServiceTaskProcessor{ - - String Prefix = "GENPV_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - /** - * This method validates the incoming variables and - * generates a Vnf Id if one is not provided. - * - * @param - execution - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericPutVnf PreProcessRequest Process*** ", isDebugEnabled) - - execution.setVariable("GENPV_SuccessIndicator", false) - execution.setVariable("GENPV_FoundIndicator", false) - - try{ - // Get Variables - String payload = execution.getVariable("GENPV_vnfPayload") - utils.log("DEBUG", "Incoming Vnf Payload is: " + payload, isDebugEnabled) - String type = execution.getVariable("GENPV_type") - utils.log("DEBUG", "Incoming Type of Vnf is: " + type, isDebugEnabled) - - if(isBlank(payload) || isBlank(type)){ - utils.log("ERROR", "Incoming Vnf Payload and/or Type is null. These Variables are required!", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Vnf Payload and/or Type is null. These Variables are required!") - }else{ - String vnfId = execution.getVariable("GENPV_vnfId") - if(isBlank(vnfId)){ - vnfId = UUID.randomUUID().toString() - utils.log("DEBUG", "Generated Vnf Id is: " + vnfId, isDebugEnabled) - execution.setVariable("GENPV_vnfId", vnfId) - }else{ - utils.log("DEBUG", "Incoming Vnf Id is: " + vnfId, isDebugEnabled) - } - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericPutVnf PreProcessRequest method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericPutVnf PreProcessRequest") - - } - utils.log("DEBUG", "*** COMPLETED GenericPutVnf PreProcessRequest Process ***", isDebugEnabled) - } - - /** - * This method executes a Put call to AAI to create - * or update a Vnf Object using the provided payload - * - * @param - execution - */ - public void putVnf(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericPutVnf PutVnf Process*** ", isDebugEnabled) - try { - String vnfId = execution.getVariable("GENPV_vnfId") - String payload = execution.getVariable("GENPV_vnfPayload") - String type = execution.getVariable("GENPV_type") - - AaiUtil aaiUtil = new AaiUtil(this) - def aai_uri = "" - if(type.equals("generic-vnf")){ - aai_uri = aaiUtil.getNetworkGenericVnfUri(execution) - }else if(type.equals("vce")){ - aai_uri = aaiUtil.getNetworkVceUri(execution) - }else if(type.equals("vpe")){ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "GenericPutVnf does not yet support getting type of vnf = vpe") - }else{ - utils.log("DEBUG", "Invalid Incoming GENGV_type", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENPV_type") - } - utils.log("DEBUG", "Using AAI Uri: " + aai_uri, isDebugEnabled) - - String path = "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") - utils.log("DEBUG", "PUT Vnf Endpoint is: " + path, isDebugEnabled) - - String putVnfAAIPath = execution.getVariable("URN_aai_endpoint") + path - execution.setVariable("GENPV_putVnfAAIPath", putVnfAAIPath) - utils.logAudit("PUT Vnf Url is: " + putVnfAAIPath) - - APIResponse apiResponse = aaiUtil.executeAAIPutCall(execution, putVnfAAIPath, payload) - int responseCode = apiResponse.getStatusCode() - execution.setVariable("GENPV_putVnfResponseCode", responseCode) - utils.logAudit("AAI Response Code: " + responseCode) - String aaiResponse = apiResponse.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable("GENPV_putVnfResponse", aaiResponse) - utils.logAudit("AAI Response: " + aaiResponse) - - if(responseCode == 200 || responseCode == 201){ - utils.log("DEBUG", "PUT Vnf Received a Good Response Code.", isDebugEnabled) - }else{ - utils.log("DEBUG", "PUT Vnf Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericPutVnf PutVnf method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During PutVnf") - } - utils.log("DEBUG", " *** COMPLETED GenericPutVnf PutVnf Process*** ", isDebugEnabled) - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericUtils.groovy deleted file mode 100644 index baebf794d5..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericUtils.groovy +++ /dev/null @@ -1,20 +0,0 @@ -package org.openecomp.mso.bpmn.common.scripts - -import org.apache.commons.lang3.StringUtils; - -class GenericUtils extends StringUtils{ - - @Override - public static boolean isBlank(final CharSequence cs) { - int strLen; - if (cs == null || (strLen = cs.length()) == 0 || cs.equals("null")) { - return true; - } - for (int i = 0; i < strLen; i++) { - if (!Character.isWhitespace(cs.charAt(i))) { - return false; - } - } - return true; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ManualHandling.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ManualHandling.groovy deleted file mode 100644 index e79071f1e9..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ManualHandling.groovy +++ /dev/null @@ -1,345 +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.bpmn.common.scripts; - -import static org.apache.commons.lang3.StringUtils.*; - -import java.time.chrono.AbstractChronology -import java.util.List -import java.text.SimpleDateFormat -import java.util.Date - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.TaskService -import org.camunda.bpm.engine.task.Task -import org.camunda.bpm.engine.task.TaskQuery -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateTask -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.client.ruby.* - - - -/** - * This groovy class supports the ManualHandling.bpmn process. - * - * @author - * - * Inputs: - * @param - msoRequestId - * @param - isDebugLogEnabled - * @param - serviceType - * @param - vnfType - * @param - requestorId - * @param - currentActivity - * @param - workStep - * @param - failedActivity - * @param - errorCode - * @param - errorText - * @param - validResponses - * @param - vnfName - * - * Outputs: - * @param - WorkflowException - * @param - taskId - * - */ -public class ManualHandling extends AbstractServiceTaskProcessor { - - String Prefix="MH_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - JsonUtils jsonUtils = new JsonUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("DEBUG"," ***** preProcessRequest of ManualHandling *****", isDebugLogEnabled) - - try { - execution.setVariable("prefix", Prefix) - setBasicDBAuthHeader(execution, isDebugLogEnabled) - // check for required input - String requestId = execution.getVariable("msoRequestId") - utils.log("DEBUG", "msoRequestId is: " + requestId, isDebugLogEnabled) - def serviceType = execution.getVariable("serviceType") - utils.log("DEBUG", "serviceType is: " + serviceType, isDebugLogEnabled) - def vnfType = execution.getVariable("vnfType") - utils.log("DEBUG", "vnftype is: " + vnfType, isDebugLogEnabled) - def currentActivity = execution.getVariable("currentActivity") - utils.log("DEBUG", "currentActivity is: " + currentActivity, isDebugLogEnabled) - def workStep = execution.getVariable("workStep") - utils.log("DEBUG", "workStep is: " + workStep, isDebugLogEnabled) - def failedActivity = execution.getVariable("failedActivity") - utils.log("DEBUG", "failedActivity is: " + failedActivity, isDebugLogEnabled) - def errorCode = execution.getVariable("errorCode") - utils.log("DEBUG", "errorCode is: " + errorCode, isDebugLogEnabled) - def errorText = execution.getVariable("errorText") - utils.log("DEBUG", "errorText is: " + errorText, isDebugLogEnabled) - def requestorId = execution.getVariable("requestorId") - utils.log("DEBUG", "requestorId is: " + requestorId, isDebugLogEnabled) - def validResponses = execution.getVariable("validResponses") - utils.log("DEBUG", "validResponses is: " + validResponses, isDebugLogEnabled) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest of RainyDayHandler *****", isDebugLogEnabled) - } - - public void createManualTask (DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("DEBUG"," ***** createManualTask of ManualHandling *****", isDebugLogEnabled) - - try { - String taskId = UUID.randomUUID() - execution.setVariable('taskId', taskId) - String type = "fallout" - String nfRole = execution.getVariable("vnfType") - String subscriptionServiceType = execution.getVariable("serviceType") - String originalRequestId = execution.getVariable("msoRequestId") - String originalRequestorId = execution.getVariable("requestorId") - String errorSource = execution.getVariable("failedActivity") - String errorCode = execution.getVariable("errorCode") - String errorMessage = execution.getVariable("errorText") - String buildingBlockName = execution.getVariable("currentActivity") - String buildingBlockStep = execution.getVariable("workStep") - String validResponses = execution.getVariable("validResponses") - - utils.log("DEBUG", "Before creating task", isDebugLogEnabled) - - Map taskVariables = new HashMap() - taskVariables.put("type", type) - taskVariables.put("nfRole", nfRole) - taskVariables.put("subscriptionServiceType", subscriptionServiceType) - taskVariables.put("originalRequestId", originalRequestId) - taskVariables.put("originalRequestorId", originalRequestorId) - taskVariables.put("errorSource", errorSource) - taskVariables.put("errorCode", errorCode) - taskVariables.put("errorMessage", errorMessage) - taskVariables.put("buildingBlockName", buildingBlockName) - taskVariables.put("buildingBlockStep", buildingBlockStep) - taskVariables.put("validResponses", validResponses) - - TaskService taskService = execution.getProcessEngineServices().getTaskService() - Task manualTask = taskService.newTask(taskId) - taskService.saveTask(manualTask) - taskService.setVariables(taskId, taskVariables) - utils.log("DEBUG", "successfully created task: "+ taskId, isDebugLogEnabled) - - } catch (BpmnError e) { - utils.log("DEBUG", "BPMN exception: " + e.errorMessage, isDebugLogEnabled) - throw e; - } catch (Exception ex){ - msg = "Exception in createManualTask " + ex.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit createManualTask of ManualHandling *****", isDebugLogEnabled) - } - - public void setTaskVariables (DelegateTask task) { - - DelegateExecution execution = task.getExecution() - - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("DEBUG"," ***** setTaskVariables of ManualHandling *****", isDebugLogEnabled) - String taskId = task.getId() - utils.log("DEBUG", "taskId is: " + taskId, isDebugLogEnabled) - - try { - execution.setVariable('taskId', taskId) - String type = "fallout" - String nfRole = execution.getVariable("vnfType") - String subscriptionServiceType = execution.getVariable("serviceType") - String originalRequestId = execution.getVariable("msoRequestId") - String originalRequestorId = execution.getVariable("requestorId") - String errorSource = execution.getVariable("failedActivity") - String errorCode = execution.getVariable("errorCode") - String errorMessage = execution.getVariable("errorText") - String buildingBlockName = execution.getVariable("currentActivity") - String buildingBlockStep = execution.getVariable("workStep") - String validResponses = execution.getVariable("validResponses") - - utils.log("DEBUG", "Before creating task", isDebugLogEnabled) - - Map taskVariables = new HashMap() - taskVariables.put("type", type) - taskVariables.put("nfRole", nfRole) - taskVariables.put("subscriptionServiceType", subscriptionServiceType) - taskVariables.put("originalRequestId", originalRequestId) - taskVariables.put("originalRequestorId", originalRequestorId) - taskVariables.put("errorSource", errorSource) - taskVariables.put("errorCode", errorCode) - taskVariables.put("errorMessage", errorMessage) - taskVariables.put("buildingBlockName", buildingBlockName) - taskVariables.put("buildingBlockStep", buildingBlockStep) - taskVariables.put("validResponses", validResponses) - TaskService taskService = execution.getProcessEngineServices().getTaskService() - - - taskService.setVariables(taskId, taskVariables) - utils.log("DEBUG", "successfully created task: "+ taskId, isDebugLogEnabled) - - } catch (BpmnError e) { - utils.log("DEBUG", "BPMN exception: " + e.errorMessage, isDebugLogEnabled) - throw e; - } catch (Exception ex){ - msg = "Exception in createManualTask " + ex.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit createManualTask of ManualHandling *****", isDebugLogEnabled) - } - - public void completeTask (DelegateTask task) { - - DelegateExecution execution = task.getExecution() - - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("DEBUG"," ***** completeTask of ManualHandling *****", isDebugLogEnabled) - String taskId = task.getId() - utils.log("DEBUG", "taskId is: " + taskId, isDebugLogEnabled) - - try { - TaskService taskService = execution.getProcessEngineServices().getTaskService() - - Map taskVariables = taskService.getVariables(taskId) - String responseValue = taskVariables.get("responseValue") - - utils.log("DEBUG", "Received responseValue on completion: "+ responseValue, isDebugLogEnabled) - // Have to set the first letter of the response to upper case - String responseValueForRainyDay = responseValue.substring(0, 1).toUpperCase() + responseValue.substring(1) - utils.log("DEBUG", "ResponseValue to RainyDayHandler: "+ responseValueForRainyDay, isDebugLogEnabled) - execution.setVariable("responseValue", responseValueForRainyDay) - - } catch (BpmnError e) { - utils.log("DEBUG", "BPMN exception: " + e.errorMessage, isDebugLogEnabled) - throw e; - } catch (Exception ex){ - msg = "Exception in createManualTask " + ex.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit completeTask of ManualHandling *****", isDebugLogEnabled) - } - - public void prepareRequestsDBStatusUpdate (DelegateExecution execution, String requestStatus){ - - def method = getClass().getSimpleName() + '.prepareRequestsDBStatusUpdate(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - utils.log("DEBUG"," ***** prepareRequestsDBStatusUpdate of ManualHandling *****", isDebugLogEnabled) - try { - def requestId = execution.getVariable("msoRequestId") - String payload = """ - - - - - ${requestId} - ManualHandling - ${requestStatus} - - - - """ - - execution.setVariable("setUpdateDBstatusPayload", payload) - utils.log("DEBUG", "Outgoing Update Mso Request Payload is: " + payload, isDebugLogEnabled) - utils.logAudit("setUpdateDBstatusPayload: " + payload) - - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) - } - - utils.log("DEBUG"," ***** Exit prepareRequestsDBStatusUpdate of ManualHandling *****", isDebugLogEnabled) - } - - public void createAOTSTicket (DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("DEBUG"," ***** createAOTSTicket of ManualHandling *****", isDebugLogEnabled) - - // This method will not be throwing an exception, but rather log the error - - try { - execution.setVariable("prefix", Prefix) - setBasicDBAuthHeader(execution, isDebugLogEnabled) - // check for required input - String requestId = execution.getVariable("msoRequestId") - utils.log("DEBUG", "requestId is: " + requestId, isDebugLogEnabled) - def currentActivity = execution.getVariable("currentActivity") - utils.log("DEBUG", "currentActivity is: " + currentActivity, isDebugLogEnabled) - def workStep = execution.getVariable("workStep") - utils.log("DEBUG", "workStep is: " + workStep, isDebugLogEnabled) - def failedActivity = execution.getVariable("failedActivity") - utils.log("DEBUG", "failedActivity is: " + failedActivity, isDebugLogEnabled) - def errorCode = execution.getVariable("errorCode") - utils.log("DEBUG", "errorCode is: " + errorCode, isDebugLogEnabled) - def errorText = execution.getVariable("errorText") - utils.log("DEBUG", "errorText is: " + errorText, isDebugLogEnabled) - def vnfName = execution.getVariable("vnfName") - utils.log("DEBUG", "vnfName is: " + vnfName, isDebugLogEnabled) - - String rubyRequestId = UUID.randomUUID() - utils.log("DEBUG", "rubyRequestId: " + rubyRequestId, isDebugLogEnabled) - String sourceName = vnfName - utils.log("DEBUG", "sourceName: " + sourceName, isDebugLogEnabled) - String reason = "VID Workflow failed at " + failedActivity + " " + workStep + " call with error " + errorCode - utils.log("DEBUG", "reason: " + reason, isDebugLogEnabled) - String workflowId = requestId - utils.log("DEBUG", "workflowId: " + workflowId, isDebugLogEnabled) - String notification = "Request originated from VID | Workflow fallout on " + vnfName + " | Workflow step failure: " + workStep + " failed | VID workflow ID: " + workflowId - utils.log("DEBUG", "notification: " + notification, isDebugLogEnabled) - - utils.log("DEBUG", "Creating AOTS Ticket request") - - RubyClient rubyClient = new RubyClient() - rubyClient.rubyCreateTicketCheckRequest(rubyRequestId, sourceName, reason, workflowId, notification) - - } catch (BpmnError e) { - msg = "BPMN error in createAOTSTicket " + ex.getMessage() - utils.log("ERROR", msg, isDebugLogEnabled) - } catch (Exception ex){ - msg = "Exception in createAOTSTicket " + ex.getMessage() - utils.log("ERROR", msg, isDebugLogEnabled) - } - utils.log("DEBUG"," ***** Exit createAOTSTicket of ManualHandling *****", isDebugLogEnabled) - } - - - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy deleted file mode 100644 index 719aeb837f..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy +++ /dev/null @@ -1,1016 +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.bpmn.common.scripts - -import groovy.xml.XmlUtil - -import java.text.SimpleDateFormat - -import org.apache.commons.codec.binary.Base64 -import org.openecomp.mso.bpmn.core.BPMNLogger -import org.openecomp.mso.bpmn.core.xml.XmlTool -import org.openecomp.mso.logger.MessageEnum -import org.openecomp.mso.logger.MsoLogger -import org.openecomp.mso.utils.CryptoUtils -import org.slf4j.MDC -import org.w3c.dom.Element - -class MsoUtils { - def initializeEndPoints(execution){ - // use this placeholder to initialize end points, if called independently, this need to be set - execution.setVariable("AAIEndPoint","http://localhost:28080/SoapUIMocks") - } - - /** - * Use getNodeText1 Instead! - */ - @Deprecated - def getNodeText(xmlInput,element){ - def rtn=null - if(xmlInput!=null){ - def xml= new XmlSlurper().parseText(xmlInput) - rtn= xml.'**'.find{node->node.name()==element}.text() - } - return rtn - } - def getMultNodes(xmlInput, element){ - def nodes=null - if(xmlInput!=null){ - def xml= new XmlSlurper().parseText(xmlInput) - nodes = xml.'**'.findAll{ node-> node.name() == element }*.text() - } - return nodes - } - /** - * Note: this uses XmlParser instead of XmlSlurper, thus it is not as - * efficient because it instantiates the whole DOM tree. - * @param xmlInput - * @param element - * @return a list of Nodes, or {@code null} if xmlInput is {@code null} - */ - def getMultNodeObjects(xmlInput, element){ - def nodes=null - if(xmlInput!=null){ - def xml= new XmlParser().parseText(xmlInput) - nodes = xml.'**'.findAll{ node-> node.name() == element } - } - return nodes - } - def getNodeText1(xmlInput,element){ - def rtn=null - if(xmlInput!=null){ - def xml= new XmlSlurper().parseText(xmlInput) - rtn= xml.'**'.find{node->node.name()==element} - if (rtn != null){ - rtn=rtn.text() - } - } - return rtn - } - def getNodeXml(xmlInput,element){ - return getNodeXml(xmlInput, element, true) - } - def getNodeXml(xmlInput,element,incPreamble){ - def fxml= new XmlSlurper().parseText(xmlInput) - def nodeToSerialize = fxml.'**'.find {it.name() == element} - if(nodeToSerialize==null){ - return "" - } - def nodeAsText = XmlUtil.serialize(nodeToSerialize) - if (!incPreamble) { - nodeAsText = removeXmlPreamble(nodeAsText) - } - return nodeAsText - } - def nodeExists(xmlInput,element){ - try { - def fxml= new XmlSlurper().parseText(xmlInput) - def nodeToSerialize = fxml.'**'.find {it.name() == element} - return nodeToSerialize!=null - } catch(Exception e) { - return false - } - } - - - /***** Utilities when using XmlParser *****/ - - /** - * Convert a Node into a String by deserializing it and formatting it. - * - * @param node Node to be converted. - * @return the Node as a String. - */ - def String nodeToString(Node node) { - def String nodeAsString = groovy.xml.XmlUtil.serialize(node) - nodeAsString = removeXmlPreamble(nodeAsString) - return formatXml(nodeAsString) - } - - /** - * Get the specified child Node of the specified parent. If there are - * multiple children of the same name, only the first one is returned. - * If there are no children with the specified name, 'null' is returned. - * - * @param parent Parent Node in which to find a child. - * @param childNodeName Name of the child Node to get. - * @return the (first) child Node with the specified name or 'null' - * if a child Node with the specified name does not exist. - */ - def Node getChildNode(Node parent, String childNodeName) { - def NodeList nodeList = getIdenticalChildren(parent, childNodeName) - if (nodeList.size() == 0) { - return null - } else { - return nodeList.get(0) - } - } - - /** - * Get the textual value of the specified child Node of the specified parent. - * If there are no children with the specified name, 'null' is returned. - * - * @param parent Parent Node in which to find a child. - * @param childNodeName Name of the child Node whose value to get. - * @return the textual value of child Node with the specified name or 'null' - * if a child Node with the specified name does not exist. - */ - def String getChildNodeText(Node parent, String childNodeName) { - def Node childNode = getChildNode(parent, childNodeName) - if (childNode == null) { - return null - } else { - return childNode.text() - } - } - - /** - * Get all of the child nodes from the specified parent that have the - * specified name. The returned NodeList could be empty. - * - * @param parent Parent Node in which to find children. - * @param childNodeName Name of the children to get. - * @return a NodeList of all the children from the parent with the specified - * name. The list could be empty. - */ - def NodeList getIdenticalChildren(Node parent, String childNodeName) { - return (NodeList) parent.get(childNodeName) - } - - /***** End of Utilities when using XmlParser *****/ - - - /** these are covered under the common function above**/ - def getSubscriberName(xmlInput,element){ - def rtn=null - if(xmlInput!=null){ - def xml= new XmlSlurper().parseText(xmlInput) - rtn= xml.'**'.find{node->node.name()==element}.text() - } - return rtn - } - def getTenantInformation(xmlInput,element){ - def xml= new XmlSlurper().parseText(xmlInput) - def nodeToSerialize = xml.'**'.find {it.name() == 'service-information'} - def nodeAsText = XmlUtil.serialize(nodeToSerialize) - return nodeAsText - } - def getServiceInstanceId(xmlInput,element){ - def xml= new XmlSlurper().parseText(xmlInput) - return ( xml.'**'.find{node->node.name()==element}.text() ) - } - //for aai tenant url - def searchResourceLink(xmlInput, resourceType){ - def fxml= new XmlSlurper().parseText(xmlInput) - def element = fxml.'**'.find {it.'resource-type' == resourceType} - return (element == null) ? null : element.'resource-link'.text() - } - - def searchMetaData(xmlInput, searchName, searchValue){ - def fxml= new XmlSlurper().parseText(xmlInput) - def ret = fxml.'**'.find {it.metaname.text() == searchName && it.metaval.text() == searchValue} - if(ret != null){ - return ret.parent().parent() - } - return ret - } - - def searchMetaDataNode(fxml, searchName, searchValue){ - def ret = fxml.'**'.find {it.metaname.text() == searchName && it.metaval.text() == searchValue} - if(ret != null){ - return ret.parent().parent() - } - return ret - } - - // for Trinity L3 add/delete bonding - def getPBGFList(isDebugLogEnabled, xmlInput){ - xmlInput = xmlInput.replaceAll("&", "&") - xmlInput = xmlInput.replaceAll("<", "<") - xmlInput = xmlInput.replaceAll(">", ">") - log("DEBUG", "getPBGFList: xmlInput " + xmlInput,isDebugLogEnabled) - ArrayList myNodes = new ArrayList() - if(nodeExists(xmlInput,"nbnc-response-information")){ - def respInfo=getNodeXml(xmlInput,"nbnc-response-information", false) - if(respInfo!=null){ - def fxml= new XmlSlurper().parseText(respInfo) - fxml.'virtual-datacenter-list'.each { vdc -> - //we only want to add two BGF per VDC, BGF1 and BGF2 - def routerList = vdc.'router-list'.first() - routerList.each{ myList -> - def physNodes = myList.'**'.findAll {it.'border-element-tangibility'.text() =~ /PHYSICAL/} - def nodeToAdd - physNodes.each{ - if(nodeToAdd==null){ - nodeToAdd = it - }else{ - def beid = nodeToAdd.'border-element-id'.text() + - " " + nodeToAdd.'border-element-type'.text() + - " and " + - it.'border-element-id'.text() + - " " + it.'border-element-type'.text() - def mytag = nodeToAdd.'border-element-id' - mytag[0].replaceBody(beid) - } - } - def mytag = nodeToAdd.'vlan-id' - def ind = mytag.text().indexOf('.') - if(ind >= 0){ - def vlan = mytag.text().substring(0,ind) - mytag[0].replaceBody(vlan) - } - myNodes.add(XmlUtil.serialize(nodeToAdd)) - } - - } - } - - return myNodes - }else{ - return null - } - } - - def getPBGFList(xmlInput){ - getPBGFList("false", xmlInput) - } - - def String decodeXML(xml) { - def String decodedXml = xml.replaceAll("&", "&") - decodedXml = decodedXml.replaceAll("<", "<") - decodedXml = decodedXml.replaceAll(">", ">") - } - - def getMetaVal(node, name){ - try{ - return node.'**'.find {it.metaname.text() == name}.metaval.text() - }catch(Exception e){ - return null - } - } - def getRelationshipVal(node, name){ - try{ - return node.'**'.find {it.'relationship-key'.text() == name}.'relationship-value'.text() - }catch(Exception e){ - return null - } - } - - - def log(logmode,logtxt,isDebugLogEnabled="false"){ - MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - if ("INFO"==logmode) { - msoLogger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN", MsoLogger.getServiceName()); - } else if ("WARN"==logmode) { - // to see the warning text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger warn() method - msoLogger.warn (MessageEnum.BPMN_GENERAL_WARNING, logtxt, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt); - } else if ("ERROR"==logmode) { - // to see the error text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger error() method - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt); - - } else { - BPMNLogger.debug(isDebugLogEnabled, logtxt); - } - } - - def logContext(requestId, serviceInstanceId){ - MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - msoLogger.setLogContext(requestId, serviceInstanceId); - } - - def logMetrics(elapsedTime, logtxt){ - MsoLogger metricsLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - metricsLogger.recordMetricEvent (elapsedTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - logtxt, "BPMN", MsoLogger.getServiceName(), null); - } - - def logAudit(logtxt){ - MsoLogger auditLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - long startTime = System.currentTimeMillis(); - - auditLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logtxt); - } - - // headers: header - name-value - def getHeaderNameValue(xmlInput, nameAttribute){ - def rtn=null - if(xmlInput!=null){ - def xml= new XmlSlurper().parseText(xmlInput) - rtn= xml.'**'.find {header->header.'@name'.text() == nameAttribute}.'@value' - } - return rtn - } - - /** - * Gets the children of the specified element. - */ - public String getChildNodes(xmlInput, element) { - def xml= new XmlSlurper().parseText(xmlInput) - def thisElement = xml.'**'.find {it.name() == element} - StringBuilder out = new StringBuilder() - if (thisElement != null) { - thisElement.children().each() { - String nodeAsText = removeXmlPreamble(XmlUtil.serialize(it)) - if (out.length() > 0) { - out.append(System.lineSeparator()) - } - out.append(nodeAsText) - } - } - return out.toString(); - } - - /** - * Encodes a value so it can be used inside an XML text element. - * @param s the string to encode - * @return the encoded string - */ - public String xmlEncode(Object value) { - return XmlTool.encode(value) - } - - /** - * Encodes a value so it can be used inside an XML attribute. - * @param s the string to encode - * @return the encoded string - */ - public String xmlEncodeAttr(Object value) { - return XmlTool.encodeAttr(value) - } - - /** - * Decodes XML entities in a string value - * @param value a value with embedded XML entities - * @return the decoded string - */ - public String xmlDecode(Object value) { - return XmlTool.decode(value) - } - - /** - * Removes the preamble, if present, from an XML document. - * Also, for historical reasons, this also trims leading and trailing - * whitespace from the resulting document. TODO: remove the trimming - * and fix unit tests that depend on EXACT xml format. - * @param xml the XML document - * @return a possibly modified document - */ - public String removeXmlPreamble(def xml) { - if (xml == null) { - return null - } - - return XmlTool.removePreamble(xml).trim() - } - - /** - * Removes namespaces and namespace declarations from an XML document. - * @param xml the XML document - * @return a possibly modified document - */ - public String removeXmlNamespaces(def xml) { - return XmlTool.removeNamespaces(xml); - } - - /** - * Use formatXml instead. Note: this method inserts an XML preamble. - */ - @Deprecated - def formatXML(xmlInput) { - def parseXml = null - def formatXml = null - if (xmlInput !=null) { - parseXml = new XmlParser().parseText(xmlInput) - formatXml = XmlUtil.serialize(parseXml) - } - } - - /** - * Reformats an XML document. The result will not contain an XML preamble - * or a trailing newline. - * @param xml the XML document - * @return a reformatted document - */ - public String formatXml(def xml) { - return XmlTool.normalize(xml); - } - - // build single elements - def buildElements(xmlInput, elementList, parentName) { - String var = "" - def xmlBuild = "" - if (parentName != "") { - xmlBuild += "" - } - if (xmlInput != null) { - for (element in elementList) { - def xml= new XmlSlurper().parseText(xmlInput) - var = xml.'**'.find {it.name() == element} - if (var != null) { - xmlBuild += ""+var.toString()+"" - } - } - } - if (parentName != "") { - xmlBuild += "" - } - return xmlBuild - } - - // build the Unbounded elements - def buildElementsUnbounded(xmlInput, elementList, parentName) { - def varParents = "" - def var = "" - def xmlBuildUnbounded = "" - if (xmlInput != null) { - def xml= new XmlSlurper().parseText(xmlInput) - varParents = xml.'**'.findAll {it.name() == parentName} - //println " Unbounded ${parentName} - varParent.Size() - " + varParents.size() - for (i in 0..varParents.size()-1) { - if (parentName != "") { - xmlBuildUnbounded += "" - } - for (element in elementList) { - var = varParents[i].'*'.find {it.name() == element} - if (var != null) { - xmlBuildUnbounded += ""+var.toString()+"" - //println " i = " + i + ", element: " + element + " = " + var.toString() - } - } - if (parentName != "") { - xmlBuildUnbounded += "" - } - } - } - return xmlBuildUnbounded - } - - // Build l2-homing-information - def buildL2HomingInformation(xmlInput) { - def elementsL2HomingList = ["evc-name", "topology", "preferred-aic-clli"] - def rebuildL2Home = '' - if (xmlInput != null) { - rebuildL2Home = buildElements(xmlInput, elementsL2HomingList, "l2-homing-information") - } - return rebuildL2Home - } - - // Build internet-evc-access-information - def buildInternetEvcAccessInformation(xmlInput) { - def elementsInternetEvcAccessInformationList = ["internet-evc-speed-value", "internet-evc-speed-units", "ip-version"] - def rebuildInternetEvcAccess = '' - if (xmlInput != null) { - rebuildInternetEvcAccess = buildElements(xmlInput, elementsInternetEvcAccessInformationList, "internet-evc-access-information") - } - return rebuildInternetEvcAccess - } - - // Build ucpe-vms-service-information - def buildUcpeVmsServiceInformation(xmlInput) { - def rebuildUcpeVmsServiceInformation = '' - if (xmlInput != null) { - def ucpeVmsServiceInformation = getNodeXml(xmlInput, "ucpe-vms-service-information").drop(38).trim() - rebuildUcpeVmsServiceInformation = "" - // transport-service-information - rebuildUcpeVmsServiceInformation += "" - def transportServiceInformation = getNodeXml(ucpeVmsServiceInformation, "transport-service-information").drop(38).trim() - def elementsTransportServiceInformationList = ["transport-service-type"] - rebuildUcpeVmsServiceInformation += buildElements(transportServiceInformation, elementsTransportServiceInformationList, "") - try { // optional - def accessCircuitInfoList = ["access-circuit-id", "dual-mode"] - rebuildUcpeVmsServiceInformation += buildElementsUnbounded(transportServiceInformation, accessCircuitInfoList, "access-circuit-info") - } catch (Exception e) { - log("ERROR", " Optional - Exception ACCESS-CIRCUIT-INFO - 'access-circuit-info' ") - } - rebuildUcpeVmsServiceInformation += "" - // ucpe-information - def elementsUcpeInformationList = ["ucpe-host-name", "ucpe-activation-code", "out-of-band-management-modem" ] - rebuildUcpeVmsServiceInformation += buildElements(ucpeVmsServiceInformation, elementsUcpeInformationList, "ucpe-information") - // vnf-list - rebuildUcpeVmsServiceInformation += "" - def vnfListList = ["vnf-instance-id", "vnf-sequence-number", "vnf-type", "vnf-vendor", "vnf-model", "vnf-id", "prov-status", "operational-state", "orchestration-status", "equipment-role" ] - rebuildUcpeVmsServiceInformation += buildElementsUnbounded(ucpeVmsServiceInformation, vnfListList, "vnf-information") - rebuildUcpeVmsServiceInformation += "" - rebuildUcpeVmsServiceInformation += "" - } - log("DEBUG", " rebuildUcpeVmsServiceInformation - " + rebuildUcpeVmsServiceInformation) - return rebuildUcpeVmsServiceInformation - } - - // Build internet-service-change-details - def buildInternetServiceChangeDetails(xmlInput) { - def rebuildInternetServiceChangeDetails = "" - if (xmlInput != null) { - try { // optional - def internetServiceChangeDetails = getNodeXml(xmlInput, "internet-service-change-details").drop(38).trim() - rebuildInternetServiceChangeDetails = "" - rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["internet-evc-speed-value"], "") - rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["internet-evc-speed-units"], "") - try { // optional - def tProvidedV4LanPublicPrefixesChangesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length"] - rebuildInternetServiceChangeDetails += buildElementsUnbounded(internetServiceChangeDetails, tProvidedV4LanPublicPrefixesChangesList, "t-provided-v4-lan-public-prefixes") - } catch (Exception e) { - log("ERROR"," Optional - Exception in INTERNET-SERVICE-CHANGE-DETAILS 't-provided-v4-lan-public-prefixes ") - } - try { // optional - def tProvidedV6LanPublicPrefixesChangesList = ["request-index", "v6-next-hop-address", "v6-lan-public-prefix", "v6-lan-public-prefix-length"] - rebuildInternetServiceChangeDetails += buildElementsUnbounded(internetServiceChangeDetails, tProvidedV6LanPublicPrefixesChangesList, "t-provided-v6-lan-public-prefixes") - } catch (Exception e) { - log("ERROR"," Optional - Exception INTERNET-SERVICE-CHANGE-DETAILS 't-provided-v6-lan-public-prefixes ") - } - rebuildInternetServiceChangeDetails += "" - } catch (Exception e) { - log("ERROR", " Optional - Exception INTERNET-SERVICE-CHANGE-DETAILS 'internet-service-change-details' ") - } - } - return rebuildInternetServiceChangeDetails - } - - // Build vr-lan - def buildVrLan(xmlInput) { - - def rebuildVrLan = '' - if (xmlInput != null) { - - rebuildVrLan = "" - def vrLan = getNodeXml(xmlInput, "vr-lan").drop(38).trim() - rebuildVrLan += buildElements(vrLan, ["routing-protocol"], "") - - // vr-lan-interface - def rebuildVrLanInterface = "" - def vrLanInterface = getNodeXml(vrLan, "vr-lan-interface").drop(38).trim() - rebuildVrLanInterface += buildVrLanInterfacePartial(vrLanInterface) - - // dhcp - def dhcp = getNodeXml(vrLan, "dhcp").drop(38).trim() - def rebuildDhcp = buildDhcp(dhcp) - rebuildVrLanInterface += rebuildDhcp - - // pat - def pat = getNodeXml(vrLan, "pat").drop(38).trim() - def rebuildPat = buildPat(pat) - rebuildVrLanInterface += rebuildPat - - // nat - def rebuildNat = "" - try { // optional - def nat = getNodeXml(vrLan, "nat").drop(38).trim() - rebuildNat = buildNat(nat) - } catch (Exception e) { - log("ERROR", " Optional - Exception 'nat' ") - } - rebuildVrLanInterface += rebuildNat - - // firewall-lite - def firewallLite = getNodeXml(vrLan, "firewall-lite").drop(38).trim() - def rebuildFirewallLite = buildFirewallLite(firewallLite) - rebuildVrLanInterface += rebuildFirewallLite - - // static-routes - def rebuildStaticRoutes = "" - try { // optional - def staticRoutes = getNodeXml(vrLan, "static-routes").drop(38).trim() - rebuildStaticRoutes = buildStaticRoutes(staticRoutes) - } catch (Exception e) { - log("ERROR", " Optional - Exception 'static-routes' ") - } - rebuildVrLanInterface += rebuildStaticRoutes - - rebuildVrLan += rebuildVrLanInterface - rebuildVrLan += "" - rebuildVrLan += "" - - } - log("DEBUG", " rebuildVrLan - " + rebuildVrLan) - return rebuildVrLan - } - - // Build vr-lan-interface - def buildVrLanInterfacePartial(xmlInput) { - def rebuildingVrLanInterface = '' - if (xmlInput != null) { - def vrLanInterfaceList = ["vr-designation", "v4-vr-lan-prefix", "v4-vr-lan-address", "v4-vr-lan-prefix-length", "v6-vr-lan-prefix", "v6-vr-lan-address", "v6-vr-lan-prefix-length", "v4-vce-loopback-address", "v6-vce-wan-address"] - rebuildingVrLanInterface += buildElements(xmlInput, vrLanInterfaceList, "") - rebuildingVrLanInterface += "" - try { // optional - def tProvidedV4LanPublicPrefixes = getNodeXml(xmlInput, "v4-public-lan-prefixes").drop(38).trim() - def tProvidedV4LanPublicPrefixesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length" ] - rebuildingVrLanInterface += buildElementsUnbounded(xmlInput, tProvidedV4LanPublicPrefixesList, "t-provided-v4-lan-public-prefixes") - } catch (Exception ex) { - log("ERROR", " Optional - Exception VR-LAN INTERFACE 'v4-public-lan-prefixes' ") - } - rebuildingVrLanInterface += "" - rebuildingVrLanInterface += "" - try { // optional - def tProvidedV6LanPublicPrefixes = getNodeXml(xmlInput, "v6-public-lan-prefixes").drop(38).trim() - def tProvidedV6LanPublicPrefixesList = ["request-index", "v6-next-hop-address", "v6-lan-public-prefix", "v6-lan-public-prefix-length" ] - rebuildingVrLanInterface += buildElementsUnbounded(xmlInput, tProvidedV6LanPublicPrefixesList, "t-provided-v6-lan-public-prefixes") - } catch (Exception e) { - log("ERROR", " Optional - Exception VR-LAN INTERFACE 'v6-public-lan-prefixes' ") - } - rebuildingVrLanInterface += "" - } - log("DEBUG", " rebuildingVrLanInterface - " + rebuildingVrLanInterface) - return rebuildingVrLanInterface - } - - // Build dhcp - def buildDhcp(xmlInput) { - def rebuildingDhcp = '' - if (xmlInput != null) { - def dhcpData = new XmlSlurper().parseText(xmlInput) - rebuildingDhcp = "" - def dhcpList1 = ["v4-dhcp-server-enabled", "v6-dhcp-server-enabled", "use-v4-default-pool", "v4-dhcp-default-pool-prefix", "v4-dhcp-default-pool-prefix-length"] - rebuildingDhcp += buildElements(xmlInput, dhcpList1, "") - try { // optional - def excludedV4DhcpAddressesFromDefaultPoolList = ["excluded-v4-address"] - rebuildingDhcp += buildElementsUnbounded(xmlInput, excludedV4DhcpAddressesFromDefaultPoolList, "excluded-v4-dhcp-addresses-from-default-pool") - } catch (Exception e) { - log("ERROR", " Optional - Exception DHCP 'excluded-v4-dhcp-addresses-from-default-pool' ") - } - try { // optional - def v4DhcpPools = dhcpData.'**'.findAll {it.name() == "v4-dhcp-pools"} - def v4DhcpPoolsSize = v4DhcpPools.size() - // println " v4DhcpPoolsSize = " + v4DhcpPools.size() - for (i in 0..v4DhcpPoolsSize-1) { - def v4DhcpPool = v4DhcpPools[i] - def v4DhcpPoolXml = XmlUtil.serialize(v4DhcpPool) - rebuildingDhcp += "" - def v4DhcpPoolsList1 = ["v4-dhcp-pool-prefix", "v4-dhcp-pool-prefix-length" ] - rebuildingDhcp += buildElements(v4DhcpPoolXml, v4DhcpPoolsList1, "") - try { // optional - def excludedV4AddressesList = ["excluded-v4-address"] - rebuildingDhcp += buildElementsUnbounded(v4DhcpPoolXml, excludedV4AddressesList, "excluded-v4-addresses") - } catch (Exception e) { - log("ERROR", " Optional - Exception DHCP 'excluded-v4-addresses' ") - } - def v4DhcpPoolsList2 = ["v4-dhcp-relay-gateway-address", "v4-dhcp-relay-next-hop-address"] - rebuildingDhcp += buildElements(v4DhcpPoolXml, v4DhcpPoolsList2, "") - rebuildingDhcp += "" - } - } catch (Exception e) { - log("ERROR"," Optional - Exception DHCP 'v4-dhcp-pools' ") - } - def dhcpList2 = ["use-v6-default-pool", "v6-dhcp-default-pool-prefix", "v6-dhcp-default-pool-prefix-length"] - rebuildingDhcp += buildElements(xmlInput, dhcpList2, "") - try { // optional - def excludedV6DhcpAddressesFromDdefaultPoolList = ["excluded-v6-address"] - rebuildingDhcp += buildElementsUnbounded(xmlInput, excludedV6DhcpAddressesFromDdefaultPoolList, "excluded-v6-dhcp-addresses-from-default-pool") - } catch (Exception e) { - log("ERROR", " Optional - Exception DHCP 'excluded-v6-dhcp-addresses-from-default-pool' ") - } - try { // optional - def v6DhcpPools = dhcpData.'**'.findAll {it.name() == "v6-dhcp-pools"} - def v6DhcpPoolsSize = v6DhcpPools.size() - //println " v6DhcpPoolsSize = " + v6DhcpPools.size() - for (i in 0..v6DhcpPoolsSize-1) { - def v6DhcpPool = v6DhcpPools[i] - def v6DhcpPoolXml = XmlUtil.serialize(v6DhcpPool) - rebuildingDhcp += "" - def v6DhcpPoolsList1 = ["v6-dhcp-pool-prefix", "v6-dhcp-pool-prefix-length"] - rebuildingDhcp += buildElements(v6DhcpPoolXml, v6DhcpPoolsList1, "") - try { // optional - def excludedV6AddressesList = ["excluded-v6-address"] - rebuildingDhcp += buildElementsUnbounded(v6DhcpPoolXml, excludedV6AddressesList, "excluded-v6-addresses") - } catch (Exception e) { - log("ERROR", " Optional - Exception DHCP 'excluded-v6-addresses' ") - } - def v6DhcpPoolsList2 = ["v6-dhcp-relay-gateway-address", "v6-dhcp-relay-next-hop-address"] - rebuildingDhcp += buildElements(v6DhcpPoolXml, v6DhcpPoolsList2, "") - rebuildingDhcp += "" - } - } catch (Exception e) { - log("ERROR", " Optional - Exception DHCP 'v6-dhcp-pools' ") - } - rebuildingDhcp += "" - } - log("DEBUG", " rebuildingDhcp - " + rebuildingDhcp) - return rebuildingDhcp - } - - // Build pat - def buildPat(xmlInput) { - def rebuildingPat = '' - if (xmlInput != null) { - rebuildingPat = "" - def patList = ["v4-pat-enabled", "use-v4-default-pool", "v4-pat-default-pool-prefix", "v4-pat-default-pool-prefix-length"] - rebuildingPat += buildElements(xmlInput, patList, "") - try { // optional - def v4PatPools = getNodeXml(xmlInput, "v4-pat-pools").drop(38).trim() - def v4PatPoolsList = ["v4-pat-pool-prefix", "v4-pat-pool-prefix-length", "v4-pat-pool-next-hop-address"] - rebuildingPat += buildElementsUnbounded(xmlInput, v4PatPoolsList, "v4-pat-pools") - } catch (Exception e) { - log("ERROR", " Optional - Exception 'v4-pat-pool-next-hop-address' ") - } - rebuildingPat += "" - } - log("DEBUG", " rebuildingPat - " + rebuildingPat) - return rebuildingPat - } - - // Build nat - def buildNat(xmlInput) { - def rebuildingNat = '' - if (xmlInput != null) { - rebuildingNat = "" - rebuildingNat += buildElements(xmlInput, ["v4-nat-enabled"], "") - try { // optional - def v4NatMappingEntries = getNodeXml(xmlInput, "v4-nat-mapping-entries").drop(38).trim() - def v4NatMappingEntriesList = ["v4-nat-internal", "v4-nat-next-hop-address", "v4-nat-external"] - rebuildingNat += buildElementsUnbounded(xmlInput, v4NatMappingEntriesList, "v4-nat-mapping-entries") - } catch (Exception e) { - log("ERROR", " Optional - Exception 'v4-nat-external' ") - } - rebuildingNat += "" - } - log("DEBUG", " rebuildingNat - " + rebuildingNat) - return rebuildingNat - } - - // Build firewall-lite - def buildFirewallLite(xmlInput) { - def rebuildingFirewallLite = '' - - if (xmlInput != null) { - - def firewallLiteData = new XmlSlurper().parseText(xmlInput) - rebuildingFirewallLite = "" - def firewallLiteList = ["stateful-firewall-lite-v4-enabled", "stateful-firewall-lite-v6-enabled"] - rebuildingFirewallLite += buildElements(xmlInput, firewallLiteList, "") - - try { // optional - def v4FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v4-firewall-packet-filters"} - def v4FirewallPacketFiltersSize = v4FirewallPacketFilters.size() - //println " v4FirewallPacketFiltersSize = " + v4FirewallPacketFilters.size() - for (i in 0..v4FirewallPacketFiltersSize-1) { - def v4FirewallPacketFilter = v4FirewallPacketFilters[i] - def v4FirewallPacketFilterXml = XmlUtil.serialize(v4FirewallPacketFilter) - rebuildingFirewallLite += "" - def v4FirewallPacketFiltersList = ["v4-firewall-prefix", "v4-firewall-prefix-length", "allow-icmp-ping"] - rebuildingFirewallLite += buildElements(v4FirewallPacketFilterXml, v4FirewallPacketFiltersList, "") - try { // optional - def udpPortsList = ["port-number"] - rebuildingFirewallLite += buildElementsUnbounded(v4FirewallPacketFilterXml, udpPortsList, "udp-ports") - } catch (Exception e) { - log("ERROR", " Optional - Exception FIREWALL-LITE v4 'udp-ports' ") - } - try { // optional - def tcpPortsList = ["port-number"] - rebuildingFirewallLite += buildElementsUnbounded(v4FirewallPacketFilterXml, tcpPortsList, "tcp-ports") - } catch (Exception e) { - log("ERROR", " Optional - Exception FIREWALL-LITE v4 'tcp-ports' ") - } - rebuildingFirewallLite += "" - } - } catch (Exception e) { - log("ERROR", " Optional - Exception FIREWALL-LITE 'v4-firewall-packet-filters' ") - } - - try { // optional - def v6FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v6-firewall-packet-filters"} - def v6FirewallPacketFiltersSize = v6FirewallPacketFilters.size() - //println " v6FirewallPacketFiltersSize = " + v6FirewallPacketFilters.size() - for (i in 0..v6FirewallPacketFiltersSize-1) { - def v6FirewallPacketFilter = v6FirewallPacketFilters[i] - def v6FirewallPacketFilterXml = XmlUtil.serialize(v6FirewallPacketFilter) - rebuildingFirewallLite += "" - def v6FirewallPacketFiltersList = ["v6-firewall-prefix", "v6-firewall-prefix-length", "allow-icmp-ping"] - rebuildingFirewallLite += buildElements(v6FirewallPacketFilterXml, v6FirewallPacketFiltersList, "") - try { // optional - def udpPortsList = ["port-number"] - rebuildingFirewallLite += buildElementsUnbounded(v6FirewallPacketFilterXml, udpPortsList, "udp-ports") - } catch (Exception e) { - log("ERROR", " Optional - Exception FIREWALL-LITE v6 'udp-ports' ") - } - try { // optional - def tcpPortsList = ["port-number"] - rebuildingFirewallLite += buildElementsUnbounded(v6FirewallPacketFilterXml, tcpPortsList, "tcp-ports") - } catch (Exception e) { - log("ERROR", " Optional - Exception FIREWALL-LITE v6 'tcp-ports' ") - } - rebuildingFirewallLite += "" - } - } catch (Exception e) { - log("ERROR", " Optional - Exception FIREWALL-LITE 'v6-firewall-packet-filters' ") - } - rebuildingFirewallLite+= "" - } - log("DEBUG", " rebuildingFirewallLite - " + rebuildingFirewallLite) - return rebuildingFirewallLite - } - - def buildStaticRoutes(xmlInput) { - def rebuildingStaticRoutes = '' - if (xmlInput != null) { - rebuildingStaticRoutes = "" - def v4StaticRouteslist = ["v4-static-route-prefix","v4-static-route-prefix-length", "v4-next-hop-address"] - rebuildingStaticRoutes += buildElementsUnbounded(xmlInput, v4StaticRouteslist, "v4-static-routes") - def v6StaticRouteslist = ["v6-static-route-prefix","v6-static-route-prefix-length", "v6-next-hop-address"] - rebuildingStaticRoutes += buildElementsUnbounded(xmlInput, v6StaticRouteslist, "v6-static-routes") - rebuildingStaticRoutes += "" - } - log("DEBUG", " rebuildingStaticRoutes - " + rebuildingStaticRoutes) - return rebuildingStaticRoutes - } - - public String generateCurrentTimeInUtc(){ - final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); - sdf.setTimeZone(TimeZone.getTimeZone("UTC")); - final String utcTime = sdf.format(new Date()); - return utcTime; - } - - public String generateCurrentTimeInGMT(){ - final SimpleDateFormat sdf = new SimpleDateFormat("E, d MMM yyyy h:m:s z"); - sdf.setTimeZone(TimeZone.getTimeZone("GMT")); - final String utcTime = sdf.format(new Date()); - return utcTime; - } - - - /** - * @param encryptedAuth: encrypted credentials from urn properties - * @param msoKey: key to use to decrypt from urn properties - * @return base 64 encoded basic auth credentials - */ - def getBasicAuth(encryptedAuth, msoKey){ - if ((encryptedAuth == null || encryptedAuth.isEmpty()) || (msoKey == null || msoKey.isEmpty())) - return null - try { - def auth = decrypt(encryptedAuth, msoKey) - byte[] encoded = Base64.encodeBase64(auth.getBytes()) - String encodedString = new String(encoded) - encodedString = "Basic " + encodedString - return encodedString - } catch (Exception ex) { - log("ERROR", "Unable to encode basic auth") - throw ex - } - } - - def encrypt(toEncrypt, msokey){ - try { - String result = CryptoUtils.encrypt(toEncrypt, msokey); - return result - } - catch (Exception e) { - log("ERROR", "Failed to encrypt credentials") - } - } - - def decrypt(toDecrypt, msokey){ - try { - String result = CryptoUtils.decrypt(toDecrypt, msokey); - return result - } - catch (Exception e) { - log("ERROR", "Failed to decrypt credentials") - throw e - } - } - - /** - * Return URL with qualified host name (if any) or urn mapping - * @param String url from urn mapping - * @return String url with qualified host name - */ - public String getQualifiedHostNameForCallback(String urnCallbackUrl) { - def callbackUrlToUse = urnCallbackUrl - try{ - //swap host name with qualified host name from the jboss properties - def qualifiedHostName = System.getProperty("jboss.qualified.host.name") - if(qualifiedHostName!=null){ - log("DEBUG", "qualifiedHostName:\n" + qualifiedHostName) - callbackUrlToUse = callbackUrlToUse.replaceAll("(http://)(.*)(:28080*)", {orig, first, torepl, last -> "${first}${qualifiedHostName}${last}"}) - } - }catch(Exception e){ - log("DEBUG", "unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: " + e.printStackTrace()) - } - return callbackUrlToUse - - } - - /** - * Retrieves text context of the element if the element exists, returns empty string otherwise - * @param com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl element to parse - * param String tagName tagName - * @return String text content of the element - */ - public String getElementText(Element element, String tagName) { - String text = "" - org.w3c.dom.NodeList nodeList = element.getElementsByTagNameNS("*", tagName) - if (nodeList != null && nodeList.length > 0) { - text = nodeList.item(0).getTextContent() - } - return text - } - - /** - * - * Find the lowest unused module-index value in a given xml - */ - public String getLowestUnusedIndex(String xml) { - if (xml == null || xml.isEmpty()) { - return "0" - } - def moduleIndexList = getMultNodes(xml, "module-index") - if (moduleIndexList == null || moduleIndexList.size() == 0) { - return "0" - } - def sortedModuleIndexList = moduleIndexList.sort { a, b -> a.compareTo b } - - for (i in 0..sortedModuleIndexList.size()-1) { - if (Integer.parseInt(sortedModuleIndexList[i]) != i) { - return i.toString() - } - } - return sortedModuleIndexList.size().toString() - } - /** - * This utility checks if there is transaction id already present in MDC. - * If found, it returns same else creates new, sets in MDC for future use before returning - * @return String RequestId in UUID format. - */ - public String getRequestID() - { - String requestId = MDC.get("RequestId") - if(requestId == null || requestId.isEmpty()) - { - requestId = java.util.UUID.randomUUID() - MDC.put("RequestId",requestId) - log("DEBUG","MsoUtils - Created new RequestId: " + requestId) - } - else - { - log("DEBUG","MsoUtils - Using existing RequestId: " + requestId) - } - - return requestId - } - - /** - * Remove all the empty nodes and attributes from the within the given node - * @param node - * @return true if all empty nodes and attributes were removed. - */ - public boolean cleanNode( Node node ) { - node.attributes().with { a -> - a.findAll { !it.value }.each { a.remove( it.key ) } - } - node.children().with { kids -> - kids.findAll { it instanceof Node ? !cleanNode( it ) : false } - .each { kids.remove( it ) } - } - node.attributes() || node.children() || node.text() - } - - /** - * - * @param xml - * @return String representation of xml after removing the empty nodes and attributes - */ - public String cleanNode(String xmlString) { - def xml = new XmlParser(false, false).parseText(xmlString) - cleanNode(xml) - return XmlUtil.serialize(xml) - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy deleted file mode 100644 index f6b36546aa..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy +++ /dev/null @@ -1,1573 +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.bpmn.common.scripts; - -import org.apache.commons.lang3.* - -import groovy.xml.XmlUtil - -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory -import javax.xml.transform.Transformer -import javax.xml.transform.TransformerFactory -import javax.xml.transform.TransformerException -import javax.xml.transform.dom.DOMSource -import javax.xml.transform.stream.StreamResult - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.w3c.dom.Document -import org.w3c.dom.Element - -import org.w3c.dom.NamedNodeMap -import org.w3c.dom.Node -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.NamedNodeMap -import org.w3c.dom.Node -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource - - -/** - * This groovy class supports the any Network processes that need the methods defined here. - */ -class NetworkUtils { - - public MsoUtils utils = new MsoUtils() - private AbstractServiceTaskProcessor taskProcessor - - public NetworkUtils(AbstractServiceTaskProcessor taskProcessor) { - this.taskProcessor = taskProcessor - } - - /** - * This method returns the string for Network request - * V2 for Contrail 3.x will populate cloud-region data in same cloudSiteId filed - * Network adapter will handle it properly - * @param requestId either 'request-id' or 'mso-request-id' - * @param requestInput the request in the process - * @param queryIdResponse the response of REST AAI query by Id - * @param routeCollection the collection - * @param policyFqdns the policy - * @param tableCollection the collection - * @param cloudRegionId the cloud-region-region - * @return String request - */ - def CreateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyFqdns, tableCollection, cloudRegionId, backoutOnFailure, source) { - String createNetworkRequest = null - if(requestInput!=null && queryIdResponse!=null) { - String serviceInstanceId = "" - String sharedValue = "" - String externalValue = "" - - if (source == "VID") { - sharedValue = utils.getNodeText1(queryIdResponse, "is-shared-network") != null ? utils.getNodeText1(queryIdResponse, "is-shared-network") : "false" - externalValue = utils.getNodeText1(queryIdResponse, "is-external-network") != null ? utils.getNodeText1(queryIdResponse, "is-external-network") : "false" - serviceInstanceId = utils.getNodeText1(requestInput, "service-instance-id") - - } else { // source = 'PORTAL' - sharedValue = getParameterValue(requestInput, "shared") - externalValue = getParameterValue(requestInput, "external") - serviceInstanceId = utils.getNodeText1(requestInput, "service-instance-id") != null ? utils.getNodeText1(requestInput, "service-instance-id") : "" - } - - String networkParams = "" - if (utils.nodeExists(requestInput, "network-params")) { - String netParams = utils.getNodeXml(requestInput, "network-params", false).replace("tag0:","").replace(":tag0","") - networkParams = buildParams(netParams) - } - - String failIfExists = "false" - // requestInput - String cloudRegion = cloudRegionId - String tenantId = utils.getNodeText1(requestInput, "tenant-id") - - String networkType = "" - String modelCustomizationUuid = "" - if (utils.nodeExists(requestInput, "networkModelInfo")) { - String networkModelInfo = utils.getNodeXml(requestInput, "networkModelInfo", false).replace("tag0:","").replace(":tag0","") - networkType = utils.getNodeText1(networkModelInfo, "modelName") - modelCustomizationUuid = utils.getNodeText1(networkModelInfo, "modelCustomizationUuid") - } else { - networkType = utils.getNodeText1(queryIdResponse, "network-type") - modelCustomizationUuid = utils.getNodeText1(requestInput, "modelCustomizationId") - } - - // queryIdResponse - String networkName = utils.getNodeText1(queryIdResponse, "network-name") - String networkId = utils.getNodeText1(queryIdResponse, "network-id") - String networkTechnology = utils.getNodeText1(queryIdResponse, "network-technology") - - // contrailNetwork - networkTechnology = 'Contrail' vs. 'AIC_SR_IOV') - String contrailNetwork = "" - if (networkTechnology.contains('Contrail') || networkTechnology.contains('contrail') || networkTechnology.contains('CONTRAIL')) { - contrailNetwork = """ - ${sharedValue} - ${externalValue} - ${routeCollection} - ${policyFqdns} - ${tableCollection} - """ - networkTechnology = "CONTRAIL" // replace - } - - // rebuild subnets - String subnets = "" - if (utils.nodeExists(queryIdResponse, "subnets")) { - def subnetsGroup = utils.getNodeXml(queryIdResponse, "subnets", false) - subnets = buildSubnets(subnetsGroup) - } - - String physicalNetworkName = "" - physicalNetworkName = utils.getNodeText1(queryIdResponse, "physical-network-name") - - String vlansCollection = buildVlans(queryIdResponse) - - String notificationUrl = "" //TODO - is this coming from URN? What variable/value to use? - //String notificationUrl = execution.getVariable("URN_?????") //TODO - is this coming from URN? What variable/value to use? - - createNetworkRequest = """ - - ${cloudRegion} - ${tenantId} - ${networkId} - ${networkName} - ${networkType} - ${modelCustomizationUuid} - ${networkTechnology} - - ${physicalNetworkName} - ${vlansCollection} - - ${contrailNetwork} - ${subnets} - true - ${backoutOnFailure} - ${failIfExists} - ${networkParams} - - ${requestId} - ${serviceInstanceId} - - ${messageId} - ${notificationUrl} - - """.trim() - } - return createNetworkRequest - - } - - /** - * This method returns the string for Network request - * V2 for Contrail 3.x will populate cloud-region data in same cloudSiteId filed - * Network adapter will handle it properly - * @param requestId either 'request-id' or 'mso-request-id' - * @param requestInput the request in the process - * @param queryIdResponse the response of REST AAI query by Id - * @param routeCollection the collection - * @param policyFqdns the policy - * @param cloudRegionId the cloud-region-region - * @return String request - */ - def UpdateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyFqdns, tableCollection, cloudRegionId, backoutOnFailure, source) { - String updateNetworkRequest = null - if(requestInput!=null && queryIdResponse!=null) { - String serviceInstanceId = "" - String sharedValue = "" - String externalValue = "" - - if (source == "VID") { - sharedValue = utils.getNodeText1(queryIdResponse, "is-shared-network") != null ? utils.getNodeText1(queryIdResponse, "is-shared-network") : "false" - externalValue = utils.getNodeText1(queryIdResponse, "is-external-network") != null ? utils.getNodeText1(queryIdResponse, "is-external-network") : "false" - serviceInstanceId = utils.getNodeText1(requestInput, "service-instance-id") - - } else { // source = 'PORTAL' - sharedValue = getParameterValue(requestInput, "shared") - externalValue = getParameterValue(requestInput, "external") - serviceInstanceId = utils.getNodeText1(requestInput, "service-instance-id") != null ? utils.getNodeText1(requestInput, "service-instance-id") : "" - } - - String failIfExists = "false" - // requestInput - String cloudRegion = cloudRegionId - String tenantId = utils.getNodeText1(requestInput, "tenant-id") - - // queryIdResponse - String networkName = utils.getNodeText1(queryIdResponse, "network-name") - String networkId = utils.getNodeText1(queryIdResponse, "network-id") - - String networkType = "" - String modelCustomizationUuid = "" - if (utils.nodeExists(requestInput, "networkModelInfo")) { - String networkModelInfo = utils.getNodeXml(requestInput, "networkModelInfo", false).replace("tag0:","").replace(":tag0","") - networkType = utils.getNodeText1(networkModelInfo, "modelName") - modelCustomizationUuid = utils.getNodeText1(networkModelInfo, "modelCustomizationUuid") - } else { - networkType = utils.getNodeText1(queryIdResponse, "network-type") - modelCustomizationUuid = utils.getNodeText1(requestInput, "modelCustomizationId") - } - - // rebuild subnets - String subnets = "" - if (utils.nodeExists(queryIdResponse, "subnets")) { - def subnetsGroup = utils.getNodeXml(queryIdResponse, "subnets", false) - subnets = buildSubnets(subnetsGroup) - } - - String networkParams = "" - if (utils.nodeExists(requestInput, "network-params")) { - String netParams = utils.getNodeXml(requestInput, "network-params", false).replace("tag0:","").replace(":tag0","") - networkParams = buildParams(netParams) - } - - String networkStackId = utils.getNodeText1(queryIdResponse, "heat-stack-id") - if (networkStackId == 'null' || networkStackId == "" || networkStackId == null) { - networkStackId = "force_update" - } - - String physicalNetworkName = utils.getNodeText1(queryIdResponse, "physical-network-name") - String vlansCollection = buildVlans(queryIdResponse) - - updateNetworkRequest = - """ - ${cloudRegion} - ${tenantId} - ${networkId} - ${networkStackId} - ${networkName} - ${networkType} - ${modelCustomizationUuid} - - CONTRAIL - - ${physicalNetworkName} - ${vlansCollection} - - - ${sharedValue} - ${externalValue} - ${routeCollection} - ${policyFqdns} - ${tableCollection} - - ${subnets} - true - ${backoutOnFailure} - ${failIfExists} - ${networkParams} - - - ${requestId} - ${serviceInstanceId} - - ${messageId} - - """.trim() - - } - return updateNetworkRequest - - } - - /** - * This method returns the string for Create Volume Request payload - * @param groupId the volume-group-id - * @param volumeName the volume-group-name - * @param vnfType the vnf-type - * @param tenantId the value of relationship-key 'tenant.tenant-id' - * @return String request payload - */ - def String CreateNetworkVolumeRequest(groupId, volumeName, vnfType, tenantId) { - - String requestPayload = - """ - ${groupId} - ${volumeName} - - ${vnfType} - Pending - - - tenant - - tenant.tenant-id - ${tenantId} - - - - """ - - return requestPayload - } - - def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, tenantId, cloudRegion, namespace, modelCustomizationId) { - - String requestPayload = - """ - ${groupId} - ${volumeName} - - ${vnfType} - Pending - ${modelCustomizationId} - - - tenant - - tenant.tenant-id - ${tenantId} - - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - ${cloudRegion} - - - - """ - - return requestPayload - } - - def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, vnfId, tenantId, cloudRegion, namespace, modelCustomizationId) { - - String requestPayload = - """ - ${groupId} - ${volumeName} - - ${vnfType} - Pending - ${modelCustomizationId} - - - generic-vnf - - generic-vnf.vnf-id - ${vnfId} - - - - tenant - - tenant.tenant-id - ${tenantId} - - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - ${cloudRegion} - - - - """ - - return requestPayload - } - - - /** - * This method returns the string for Update Volume Request payload - * @param requeryAAIVolGrpNameResponse the response of query volume group name (in AAI) - * @param heatStackId the value of heat stack id - * @return String request payload - */ - def String updateCloudRegionVolumeRequest(requeryAAIVolGrpNameResponse, heatStackId, namespace, modelCustomizationId) { - String requestPayload = "" - if (requeryAAIVolGrpNameResponse != null) { - def groupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id") - def volumeName = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-name") - def vnfType = utils.getNodeText(requeryAAIVolGrpNameResponse, "vnf-type") - def resourceVersion = utils.getNodeText(requeryAAIVolGrpNameResponse, "resource-version") - def relationshipList = "" - if (utils.nodeExists(requeryAAIVolGrpNameResponse, "relationship")) { - relationshipList = rebuildRelationship(requeryAAIVolGrpNameResponse) - } - - requestPayload = - """ - ${groupId} - ${volumeName} - ${heatStackId} - ${vnfType} - Active - ${resourceVersion} - ${modelCustomizationId} - ${relationshipList} - """ - } - - return requestPayload - } - - - /** - * This method returns the string for Update Volume Request payload - * @param requeryAAIVolGrpNameResponse the response of query volume group name (in AAI) - * @param heatStackId the value of heat stack id - * @return String request payload - */ - def String UpdateNetworkVolumeRequest(requeryAAIVolGrpNameResponse, heatStackId) { - String requestPayload = "" - if (requeryAAIVolGrpNameResponse != null) { - def groupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id") - def volumeName = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-name") - def vnfType = utils.getNodeText(requeryAAIVolGrpNameResponse, "vnf-type") - def resourceVersion = utils.getNodeText(requeryAAIVolGrpNameResponse, "resource-version") - def relationshipList = "" - if (utils.nodeExists(requeryAAIVolGrpNameResponse, "relationship")) { - relationshipList = rebuildRelationship(requeryAAIVolGrpNameResponse) - } - - requestPayload = - """ - ${groupId} - ${volumeName} - ${heatStackId} - ${vnfType} - Active - ${resourceVersion} - ${relationshipList} - """ - } - - return requestPayload - } - - /** - * This method returns the string for Create Contrail Network payload - * @param requeryIdAAIResponse the response from AAI query by id - * @param createNetworkResponse the response of create network - * @return String contrailNetworkCreatedUpdate - */ - def ContrailNetworkCreatedUpdate(requeryIdAAIResponse, createNetworkResponse, schemaVersion) { - - String contrailNetworkCreatedUpdate = "" - if(requeryIdAAIResponse!=null && createNetworkResponse!=null) { - - def l3Network = utils.getNodeXml(requeryIdAAIResponse, "l3-network", false).replace("tag0:","").replace(":tag0","") - def createNetworkContrailResponse = "" - if (utils.nodeExists(createNetworkResponse, 'createNetworkResponse')) { - createNetworkContrailResponse = utils.getNodeXml(createNetworkResponse, "createNetworkResponse", false).replace("tag0:","").replace(":tag0","") - } else { - createNetworkContrailResponse = utils.getNodeXml(createNetworkResponse, "updateNetworkContrailResponse", false).replace("tag0:","").replace(":tag0","") - } - - // rebuild network - def networkList = ["network-id", "network-name", "network-type", "network-role", "network-technology", "neutron-network-id", "is-bound-to-vpn", "service-id", "network-role-instance", "resource-version", "resource-model-uuid", "orchestration-status", "heat-stack-id", "mso-catalog-key", "contrail-network-fqdn", - "physical-network-name", "is-provider-network", "is-shared-network", "is-external-network"] - String rebuildNetworkElements = buildNetworkElements(l3Network, createNetworkContrailResponse, networkList) - - // rebuild 'subnets' - def rebuildSubnetList = "" - if (utils.nodeExists(requeryIdAAIResponse, 'subnet')) { - rebuildSubnetList = buildSubnets(requeryIdAAIResponse, createNetworkResponse) - } - - // rebuild 'segmentation-assignments' - def rebuildSegmentationAssignments = "" - if (utils.nodeExists(requeryIdAAIResponse, 'segmentation-assignments')) { - List elementList = ["segmentation-id", "resource-version"] - if (utils.nodeExists(requeryIdAAIResponse, 'segmentation-assignment')) { // new tag - rebuildSegmentationAssignments = buildXMLElements(requeryIdAAIResponse, "segmentation-assignments", "segmentation-assignment", elementList) - } else { - rebuildSegmentationAssignments = buildXMLElements(requeryIdAAIResponse, "", "segmentation-assignments", elementList) - } - } - - // rebuild 'ctag-assignments' / rebuildCtagAssignments - def rebuildCtagAssignmentsList = "" - if (utils.nodeExists(requeryIdAAIResponse, 'ctag-assignment')) { - rebuildCtagAssignmentsList = rebuildCtagAssignments(requeryIdAAIResponse) - } - - // rebuild 'relationship' - def relationshipList = "" - if (utils.nodeExists(requeryIdAAIResponse, 'relationship-list')) { - String rootRelationshipData = getFirstNodeXml(requeryIdAAIResponse, "relationship-list").drop(38).trim().replace("tag0:","").replace(":tag0","") - if (utils.nodeExists(rootRelationshipData, 'relationship')) { - relationshipList = rebuildRelationship(rootRelationshipData) - } - } - - //Check for optional contrail network fqdn within CreateNetworkResponse - String contrailNetworkFQDN - if(utils.nodeExists(createNetworkResponse, "contrail-network-fqdn")){ - contrailNetworkFQDN = utils.getNodeXml(createNetworkResponse, "contrail-network-fqdn") - contrailNetworkFQDN = utils.removeXmlNamespaces(contrailNetworkFQDN) - contrailNetworkFQDN = utils.removeXmlPreamble(contrailNetworkFQDN) - }else{ - contrailNetworkFQDN = "" - } - - contrailNetworkCreatedUpdate = - """ - ${rebuildNetworkElements} - ${rebuildSubnetList} - ${rebuildSegmentationAssignments} - ${rebuildCtagAssignmentsList} - ${relationshipList} - ${contrailNetworkFQDN} - """.trim() - - } - return contrailNetworkCreatedUpdate - } - - - - /** - * This method returns the value for the name paramName. - * Ex: - * 1 - * 0 - * - * - * @param xmlInput the XML document - * @param paramName the param name (ex: 'shared') - * @return a param value for 'shared' (ex: '1') - */ - def getParameterValue(xmlInput, paramName) { - def rtn="" - if(xmlInput!=null){ - def xml= new XmlSlurper().parseText(xmlInput) - rtn= xml.'**'.find {param->param.'@name'.text() == paramName} - } - if (rtn==null) { - return "" - } else { - return rtn - } - } - - /** - * This method returns the name of param if found/match with paramName. - * Ex: - * 1 - * 0 - * - * - * @param xmlInput the XML document - * @param paramName the param name (ex: 'shared', ) - * @return a param name for 'shared' (ex: 'shared' if found) - */ - def getParameterName(xmlInput, paramName) { - def rtn="" - if(xmlInput!=null){ - def xml= new XmlSlurper().parseText(xmlInput) - try { - rtn= xml.'**'.find {param->param.'@name' == paramName}.'@name' - } catch (Exception ex) { - rtn="" - } - } - if (rtn==null || rtn=="") { - return "" - } else { - return rtn - } - } - - /** - * This method returns the networkParams xml string. - * Ex: input: - * - * 1 - * 0 - * - * - * Sample result: - * - * 1 - * 0 - * - * - */ - - def buildParams(networkParams) { - def build = "" - def netParams = new XmlParser().parseText(networkParams) - try { - def paramsList = netParams.'**'.findAll {param->param.'@name'}.'@name' - if (paramsList.size() > 0) { - build += "" - for (i in 0..paramsList.size()-1) { - def name = netParams.'**'.find {param->param.'@name' == paramsList[i]}.'@name' - def value= netParams.'**'.find {param->param.'@name' == paramsList[i]}.text() - build += "<${name}>${value}" - } - build += "" - } - - } catch (Exception ex) { - println ' buildParams error - ' + ex.getMessage() - build = "" - } - return build - } - - def getVlans(xmlInput) { - def rtn = "" - if (xmlInput!=null) { - def vlansList = getListWithElements(xmlInput, 'vlans') - def vlansListSize = vlansList.size() - if (vlansListSize > 0) { - for (i in 0..vlansListSize-1) { - rtn += ''+vlansList[i]+'' - } - } - } - return rtn - - - } - - /** - * This method returns the uri value for the vpn bindings. - * Return the a list of value of vpn binding in the string. - * Ex. - * - * - * vpn-binding - * https://aai-app-e2e.test.openecomp.com:8443/aai/v6/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - * - * vpn-binding.vpn-id - * 85f015d0-2e32-4c30-96d2-87a1a27f8017 - * - * - * - * vpn-binding - * https://aai-ext1.test.openecomp.com:8443/aai/v6/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ - * - * vpn-binding.vpn-id - * 24a4b507-853a-4a38-99aa-05fcc54be24d - * - * - * vpn-binding.vpn-name - * oam_protected_net_6_MTN5_msotest1 - * - * - * @param xmlInput the XML document - * @return a list of vpn binding values - * ex: ['aai/v6/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', 'aai/v6/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/'] - * - **/ - def getVnfBindingObject(xmlInput) { - //def rtn = null - List rtn = [] - if (xmlInput!=null) { - def relationshipList = getListWithElements(xmlInput, 'relationship') - def relationshipListSize = relationshipList.size() - if (relationshipListSize > 0) { - for (i in 0..relationshipListSize-1) { - def relationshipXml = XmlUtil.serialize(relationshipList[i]) - if (utils.getNodeText(relationshipXml, 'related-to') == "vpn-binding") { - def relatedLink = utils.getNodeText(relationshipXml, 'related-link') - if (relatedLink != null || relatedLink != "") { - rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length())) - } - } - } - } - } - return rtn - } - /** - * similar to VNF bindings method - * @param xmlInput the XML document - * @return a list of network policy values - * ex: ['aai/v$/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg', 'aai/v$/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg'] - * - **/ - def getNetworkPolicyObject(xmlInput) { - //def rtn = null - List rtn = [] - if (xmlInput!=null) { - def relationshipList = getListWithElements(xmlInput, 'relationship') - def relationshipListSize = relationshipList.size() - if (relationshipListSize > 0) { - for (i in 0..relationshipListSize-1) { - def relationshipXml = XmlUtil.serialize(relationshipList[i]) - if (utils.getNodeText(relationshipXml, 'related-to') == "network-policy") { - def relatedLink = utils.getNodeText(relationshipXml, 'related-link') - if (relatedLink != null || relatedLink != "") { - rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length())) - } - } - } - } - } - return rtn - } - - /** - * similar to network policymethod - * @param xmlInput the XML document - * @return a list of network policy values - * ex: ['aai/v$/network/route-table-references/route-table-reference/refFQDN1', 'aai/v$/network/route-table-references/route-table-reference/refFQDN2'] - * - **/ - def getNetworkTableRefObject(xmlInput) { - //def rtn = null - List rtn = [] - if (xmlInput!=null) { - def relationshipList = getListWithElements(xmlInput, 'relationship') - def relationshipListSize = relationshipList.size() - if (relationshipListSize > 0) { - for (i in 0..relationshipListSize-1) { - def relationshipXml = XmlUtil.serialize(relationshipList[i]) - if (utils.getNodeText(relationshipXml, 'related-to') == "route-table-reference") { - def relatedLink = utils.getNodeText1(relationshipXml, 'related-link') - if (relatedLink != null || relatedLink != "") { - rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length())) - } - } - } - } - } - return rtn - } - - /** - * similar to network policymethod - * @param xmlInput the XML document - * @return a list of IDs for related VNF instances - * - **/ - def getRelatedVnfIdList(xmlInput) { - //def rtn = null - List rtn = [] - if (xmlInput!=null) { - def relationshipList = getListWithElements(xmlInput, 'relationship') - def relationshipListSize = relationshipList.size() - if (relationshipListSize > 0) { - for (i in 0..relationshipListSize-1) { - def relationshipXml = XmlUtil.serialize(relationshipList[i]) - if (utils.getNodeText(relationshipXml, 'related-to') == "generic-vnf") { - def relatedLink = utils.getNodeText1(relationshipXml, 'related-link') - if (relatedLink != null || relatedLink != "") { - if (relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length()).contains('/')) { - rtn.add(relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length()-1)) - } else { - rtn.add(relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length())) - } - } - } - } - } - } - return rtn - } - - /** - * similar to network policymethod - * @param xmlInput the XML document - * @return a list of IDs for related Network instances - * - **/ - def getRelatedNetworkIdList(xmlInput) { - //def rtn = null - List rtn = [] - if (xmlInput!=null) { - def relationshipList = getListWithElements(xmlInput, 'relationship') - def relationshipListSize = relationshipList.size() - if (relationshipListSize > 0) { - for (i in 0..relationshipListSize-1) { - def relationshipXml = XmlUtil.serialize(relationshipList[i]) - if (utils.getNodeText(relationshipXml, 'related-to') == "l3-network") { - def relatedLink = utils.getNodeText1(relationshipXml, 'related-link') - if (relatedLink != null || relatedLink != "") { - if (relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length()).contains('/')) { - rtn.add(relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length()-1)) - } else { - rtn.add(relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length())) - } - } - } - } - } - } - return rtn - } - - def isVfRelationshipExist(xmlInput) { - Boolean rtn = false - if (xmlInput!=null) { - def relationshipList = getListWithElements(xmlInput, 'relationship') - def relationshipListSize = relationshipList.size() - if (relationshipListSize > 0) { - for (i in 0..relationshipListSize-1) { - def relationshipXml = XmlUtil.serialize(relationshipList[i]) - if (utils.getNodeText(relationshipXml, 'related-to') == "vf-module") { - rtn = true - } - } - } - } - return rtn - - } - - def getCloudRegion(xmlInput) { - String lcpCloudRegion = "" - if (xmlInput!=null) { - def relationshipList = getListWithElements(xmlInput, 'relationship') - def relationshipListSize = relationshipList.size() - if (relationshipListSize > 0) { - for (i in 0..relationshipListSize-1) { - def relationshipXml = XmlUtil.serialize(relationshipList[i]) - if (utils.getNodeText(relationshipXml, 'related-to') == "cloud-region") { - def relatedLink = utils.getNodeText1(relationshipXml, 'related-link') - if (relatedLink != null || relatedLink != "") { - lcpCloudRegion = relatedLink.substring(relatedLink.indexOf("/att-aic/")+9, relatedLink.length()) - if (lcpCloudRegion.contains('/')) { - lcpCloudRegion = relatedLink.substring(relatedLink.indexOf("/att-aic/")+9, relatedLink.length()-1) - } - } - } - } - } - } - return lcpCloudRegion - } - - def getTenantId(xmlInput) { - String tenantId = "" - if (xmlInput!=null) { - def relationshipList = getListWithElements(xmlInput, 'relationship') - def relationshipListSize = relationshipList.size() - if (relationshipListSize > 0) { - for (i in 0..relationshipListSize-1) { - def relationshipXml = XmlUtil.serialize(relationshipList[i]) - if (utils.getNodeText(relationshipXml, 'related-to') == "tenant") { - def relatedLink = utils.getNodeText1(relationshipXml, 'related-link') - if (relatedLink != null || relatedLink != "") { - tenantId = relatedLink.substring(relatedLink.indexOf("/tenant/")+8, relatedLink.length()) - if (tenantId.contains('/')) { - tenantId = relatedLink.substring(relatedLink.indexOf("/tenant/")+8, relatedLink.length()-1) - } - } - } - } - } - } - return tenantId - } - - def isInstanceValueMatch(linkResource, globalSubscriberId, serviceType) { - Boolean rtn = false - try { - String globalSubscriberIdLink = linkResource.substring(linkResource.indexOf("/customer/")+10, linkResource.indexOf("/service-subscriptions")) - String serviceTypeLink = linkResource.substring(linkResource.indexOf("/service-subscription/")+22, linkResource.indexOf("/service-instances")) - if (globalSubscriberIdLink == globalSubscriberId) { - rtn = true - } else { - if (serviceTypeLink == serviceType) { - rtn = true - } - } - - } catch (Exception ex) { - println 'Exception - ' + ex.getMessage() - return false - } - return rtn - } - - def getListWithElements(xmlInput, groupName) { - def rtn = "" - if (xmlInput != null) { - def relationshipData = new XmlSlurper().parseText(xmlInput) - rtn = relationshipData.'**'.findAll {it.name() == groupName} - } - return rtn - - } - - // build network single elements - def buildNetworkElements(l3Network, createNetworkContrailResponse, networkList) { - def replaceNetworkId = "" - def replaceNeutronNetworkId = "" - def replaceContrailNetworkFqdn = "" - if (l3Network != null && createNetworkContrailResponse != null) { - if (utils.nodeExists(l3Network, 'heat-stack-id')) { - replaceNetworkId = utils.getNodeText(l3Network, 'heat-stack-id') - } else { - if (utils.nodeExists(createNetworkContrailResponse, 'networkStackId')) { - replaceNetworkId = utils.getNodeText(createNetworkContrailResponse, 'networkStackId') - } - } - if (utils.nodeExists(l3Network, 'neutron-network-id')) { - replaceNeutronNetworkId = utils.getNodeText(l3Network, 'neutron-network-id') - } else { - if (utils.nodeExists(createNetworkContrailResponse, 'neutronNetworkId')) { - replaceNeutronNetworkId = utils.getNodeText(createNetworkContrailResponse, 'neutronNetworkId') - } - } - if (utils.nodeExists(l3Network, 'contrail-network-fqdn')) { - replaceContrailNetworkFqdn = utils.getNodeText(l3Network, 'contrail-network-fqdn') - } else { - if (utils.nodeExists(createNetworkContrailResponse, 'networkFqdn')) { - replaceContrailNetworkFqdn = utils.getNodeText(createNetworkContrailResponse, 'networkFqdn') - } - } - } - - String var = "" - def xmlNetwork = "" - if (l3Network != null) { - for (element in networkList) { - def xml= new XmlSlurper().parseText(l3Network) - var = xml.'**'.find {it.name() == element} - if (var == null) { - if (element=="orchestration-status") { - if (var.toString() == 'pending-create' || var.toString() == 'PendingCreate') { - xmlNetwork += "<"+element+">"+"Created"+"" - } else { //pending-update or PendingUpdate - xmlNetwork += "<"+element+">"+"Active"+"" - } - } - if (element=="heat-stack-id") { - if (replaceNetworkId != "") { - xmlNetwork += "<"+element+">"+replaceNetworkId+"" - } - } - if (element=="neutron-network-id") { - if (replaceNeutronNetworkId != "") { - xmlNetwork += "<"+element+">"+replaceNeutronNetworkId+"" - } - } - if (element=="contrail-network-fqdn") { - if (replaceContrailNetworkFqdn != "") { - xmlNetwork += "<"+element+">"+replaceContrailNetworkFqdn+"" - } - } - - } else { - if (element=="orchestration-status") { - if (element=="orchestration-status") { - if (var.toString() == 'pending-create' || var.toString() == 'PendingCreate') { - xmlNetwork += "<"+element+">"+"Created"+"" - } else { //pending-update or PendingUpdate - xmlNetwork += "<"+element+">"+"Active"+"" - } - } - } else { - xmlNetwork += "<"+element+">"+var.toString()+"" - } - } - } - } - return xmlNetwork - } - - def buildSubnets(requeryIdAAIResponse, createNetworkResponse) { - def rebuildingSubnets = "" - if (requeryIdAAIResponse != null && utils.nodeExists(requeryIdAAIResponse, 'subnets')) { - def subnetIdMapValue = "" - def subnetsGroup = utils.getNodeXml(requeryIdAAIResponse, "subnets", false) - def subnetsData = new XmlSlurper().parseText(subnetsGroup) - rebuildingSubnets += "" - try { - def subnets = subnetsData.'**'.findAll {it.name() == "subnet"} - def subnetsSize = subnets.size() - for (i in 0..subnetsSize-1) { - def subnet = subnets[i] - def subnetXml = XmlUtil.serialize(subnet) - def orchestrationStatus = utils.getNodeText1(subnetXml, "orchestration-status") - if (orchestrationStatus == "PendingDelete" || orchestrationStatus == "pending-delete") { - // skip, do not include in processing, remove!!! - } else { - def subnetList = ["subnet-id", "neutron-subnet-id", "gateway-address", "network-start-address", "cidr-mask", "ip-version", "orchestration-status", "dhcp-enabled", "dhcp-start", "dhcp-end", "resource-version", "subnet-name", "ip-assignment-direction", "host-routes"] - rebuildingSubnets += buildSubNetworkElements(subnetXml, createNetworkResponse, subnetList, "subnet") - } - } - if (utils.nodeExists(subnetsData, 'relationship')) { - rebuildingSubnets = rebuildRelationship(requeryIdAAIResponse) - } - - } catch (Exception ex) { - // error - } finally { - rebuildingSubnets += "" - } - } - return rebuildingSubnets - } - - def buildSubnets(queryIdResponse) { - def rebuildingSubnets = "" - def subnetsData = new XmlSlurper().parseText(queryIdResponse) - //rebuildingSubnets += "" - try { - def subnets = subnetsData.'**'.findAll {it.name() == "subnet"} - def subnetsSize = subnets.size() - for (i in 0..subnetsSize-1) { - def subnet = subnets[i] - def subnetXml = XmlUtil.serialize(subnet) - def orchestrationStatus = utils.getNodeText1(subnetXml, "orchestration-status") - if (orchestrationStatus == "pending-delete" || orchestrationStatus == "PendingDelete") { - // skip, do not include in processing, remove!!! - } else { - def subnetList = ["dhcp-start", "dhcp-end", "network-start-address", "cidr-mask", "dhcp-enabled", "gateway-address", "ip-version", "subnet-id", "subnet-name", "ip-assignment-direction", "host-routes"] - rebuildingSubnets += buildSubNetworkElements(subnetXml, subnetList, "subnets") - //rebuildingSubnets += buildSubNetworkElements(subnetXml, subnetList, "") - } - } - } catch (Exception ex) { - // - } finally { - //rebuildingSubnets += "" - } - return rebuildingSubnets - } - - - // build subnet sub-network single elements - def buildSubNetworkElements(subnetXml, createNetworkResponse, elementList, parentName) { - String var = "" - def xmlBuild = "" - if (parentName != "") { - xmlBuild += "<"+parentName+">" - } - if (subnetXml != null) { - for (element in elementList) { - def xml= new XmlSlurper().parseText(subnetXml) - var = xml.'**'.find {it.name() == element} - if (var != null) { - if (element=="orchestration-status") { - if(var.toString() == 'pending-create' || var.toString() == 'PendingCreate') { - xmlBuild += "<"+element+">"+"Created"+"" - } else { // pending-update or PendingUpdate' - xmlBuild += "<"+element+">"+"Active"+"" - } - } else { // "subnet-id", "neutron-subnet-id" - if (element=="subnet-id") { - if (utils.nodeExists(createNetworkResponse, "subnetMap")) { - xmlBuild += "<"+element+">"+var.toString()+"" - String neutronSubnetId = extractNeutSubId(createNetworkResponse, var.toString()) - xmlBuild += ""+neutronSubnetId+"" - } - } else { - if (element=="neutron-subnet-id") { - // skip - } else { - if (element=="host-routes") { - if (subnetXml.contains("host-routes")) { - List elementRoute = ["host-route-id", "route-prefix", "next-hop", "next-hop-type", "resource-version"] - xmlBuild += buildXMLElements(subnetXml, "host-routes", "host-route", elementRoute) - } - } else { - xmlBuild += "<"+element+">"+var.toString()+"" - } - } - } - } - } - } - - } - if (parentName != "") { - xmlBuild += "" - } - return xmlBuild - } - - // build subnet sub-network single elements - def buildSubNetworkElements(subnetXml, elementList, parentName) { - def var = "" - def xmlBuild = "" - if (parentName != "") { - xmlBuild += "<"+parentName+">" - } - if (subnetXml != null) { - def networkStartAddress = "" - for (element in elementList) { - def xml= new XmlSlurper().parseText(subnetXml) - var = xml.'**'.find {it.name() == element} - if (element == "dhcp-start") { - xmlBuild += "" - if (var.toString() == 'null') { - xmlBuild += ""+""+"" - } else { - xmlBuild += ""+var.toString()+"" - } - } - if (element == "dhcp-end") { - if (var.toString() == 'null') { - xmlBuild += ""+""+"" - } else { - xmlBuild += ""+var.toString()+"" - } - xmlBuild += "" - } - if (element == "network-start-address" || element == "cidr-mask") { - if (element == "network-start-address") { - networkStartAddress = var.toString() - } - if (element == "cidr-mask") { - xmlBuild += ""+networkStartAddress+"/"+var.toString()+"" - } - } - if (element == "dhcp-enabled") { - xmlBuild += ""+var.toString()+"" - } - if (element == "gateway-address") { - xmlBuild += ""+var.toString()+"" - } - if (element == "ip-version") { - String ipVersion = getIpvVersion(var.toString()) - xmlBuild += ""+ipVersion+"" - } - if (element == "subnet-id") { - xmlBuild += ""+var.toString()+"" - } - if ((element == "subnet-name") && (var != null)) { - xmlBuild += ""+var.toString()+"" - } - if ((element == "ip-assignment-direction") && (var != null)) { - xmlBuild += ""+var.toString()+"" - } - if (element == "host-routes") { - def routes = "" - if (subnetXml.contains("host-routes")) { - routes = buildHostRoutes(subnetXml) - } - xmlBuild += routes - } - - } - } - if (parentName != "") { - xmlBuild += "" - } - return xmlBuild - } - - // rebuild host-routes - def buildHostRoutes(subnetXml) { - List routeElementList = ["host-route-id", "route-prefix", "next-hop", "next-hop-type", "resource-version"] - def hostRoutes = buildXMLElements(subnetXml, "host-routes", "host-route", routeElementList) - def buildHostRoutes = "" - def var = "" - if (hostRoutes!=null) { - def routesData = new XmlSlurper().parseText(hostRoutes) - def routes = routesData.'**'.findAll {it.name() == "host-route"} - def routesSize = routes.size() - for (i in 0..routesSize-1) { - buildHostRoutes += "" - def route = routes[i] - def routeXml = XmlUtil.serialize(route) - List elementList = ["route-prefix", "next-hop"] - for (element in elementList) { - def xml= new XmlSlurper().parseText(routeXml) - var = xml.'**'.find {it.name() == element} - if (element == "route-prefix") { - buildHostRoutes += ""+var.toString()+"" - } - if (element == "next-hop") { - buildHostRoutes += ""+var.toString()+"" - } - } - buildHostRoutes += "" - } - } - return buildHostRoutes - - } - - // rebuild ctag-assignments - def rebuildCtagAssignments(xmlInput) { - def rebuildingCtagAssignments = "" - if (xmlInput!=null) { - def ctagAssignmentsData = new XmlSlurper().parseText(xmlInput) - rebuildingCtagAssignments += "" - def ctagAssignments = ctagAssignmentsData.'**'.findAll {it.name() == "ctag-assignment"} - def ctagAssignmentsSize = ctagAssignments.size() - for (i in 0..ctagAssignmentsSize-1) { - def ctagAssignment = ctagAssignments[i] - def ctagAssignmentXml = XmlUtil.serialize(ctagAssignment) - rebuildingCtagAssignments += "" - List elementList = ["vlan-id-inner", "resource-version"] - rebuildingCtagAssignments += buildXMLElements(ctagAssignmentXml, "" , "", elementList) - if (utils.nodeExists(ctagAssignmentXml, 'relationship')) { - rebuildingCtagAssignments += rebuildRelationship(ctagAssignmentXml) - } - rebuildingCtagAssignments += "" - } - rebuildingCtagAssignments += "" - } - return rebuildingCtagAssignments - } - - // rebuild 'relationship-list' - def rebuildRelationship(xmlInput) { - def rebuildingSubnets = "" - if (xmlInput!=null) { - def subnetsData = new XmlSlurper().parseText(xmlInput) - rebuildingSubnets += "" - def relationships = subnetsData.'**'.findAll {it.name() == "relationship"} - def relationshipsSize = relationships.size() - for (i in 0..relationshipsSize-1) { - def relationship = relationships[i] - def relationshipXml = XmlUtil.serialize(relationship) - rebuildingSubnets += "" - def relationshipList = ["related-to", "related-link"] - rebuildingSubnets += buildSubNetworkElements(relationshipXml, "", relationshipList, "") - if (utils.nodeExists(relationshipXml, 'relationship-data')) { - def relationshipDataXmlData = new XmlSlurper().parseText(relationshipXml) - def relationshipsData = relationshipDataXmlData.'**'.findAll {it.name() == "relationship-data"} - def relationshipsDataSize = relationshipsData.size() - for (j in 0..relationshipsDataSize-1) { - def relationshipData = relationshipsData[j] - def relationshipDataXml = XmlUtil.serialize(relationshipData) - def relationshipDataList = ["relationship-key", "relationship-value"] - rebuildingSubnets += buildXMLElements(relationshipDataXml, "", "relationship-data", relationshipDataList) - } - } - if (utils.nodeExists(relationshipXml, 'related-to-property')) { - def relationshipDataXmlData = new XmlSlurper().parseText(relationshipXml) - def relationshipsData = relationshipDataXmlData.'**'.findAll {it.name() == "related-to-property"} - def relationshipsDataSize = relationshipsData.size() - for (j in 0..relationshipsDataSize-1) { - def relationshipData = relationshipsData[j] - def relationshipDataXml = XmlUtil.serialize(relationshipData) - def relationshipDataList = ["property-key", "property-value"] - rebuildingSubnets += buildXMLElements(relationshipDataXml, "", "related-to-property", relationshipDataList) - } - } - - rebuildingSubnets += "" - } - rebuildingSubnets += "" - } - return rebuildingSubnets - } - - def buildVlans(queryIdResponse) { - def rebuildingSubnets = "" - def subnetsData = new XmlSlurper().parseText(queryIdResponse) - - try { - def subnets = subnetsData.'**'.findAll {it.name() == "segmentation-assignments"} - def subnetsSize = subnets.size() - for (i in 0..subnetsSize-1) { - def subnet = subnets[i] - def subnetXml = XmlUtil.serialize(subnet) - - String vlan = utils.getNodeText1(subnetXml, "segmentation-id") - if (i>0){ - rebuildingSubnets += "," - } - rebuildingSubnets += vlan - } - } catch (Exception ex) { - // - } finally { - //rebuildingSubnets += "" - rebuildingSubnets += "" - } - return rebuildingSubnets - } - - /* Utility code to rebuild xml/elements in a list: - * rebuild xml with 1) unbounded groups of elements; or - * 2) one group of elements; or - * 3) just one or more elements (in a list as argument) - * @param xmlInput the XML document - * @param parentName the parent name (ex: 'inputs') - * @param childrenName the chilrendName (ex: 'entry' as unbounded/occurs>1) - * @param elementList the element list of children (ex: 'key', 'value') - * @return a string of rebuild xml - * - * Ex 1: xmlInput: - * - * - * name - * Edward - * - * - * age - * 30 - * - * - * age - * 30 - * - * - * Usage: - * List elementList = ["key", "value"] - * String rebuild = buildXMLElements(xmlInput, "inputs", "entry", elementList) - * - * Ex 2: xmlInput // no parent tag - * - * fec8ec88-151a-45c9-ad60-8233e0fc8ff2 - * https://msojra.mtsnj.aic.cip.openecomp.com:8443/adapters/rest/SDNCNotify - * assign - * - * Usage: - * List elementList = ["svc-request-id", "svc-notification-url", "svc-action"] - * String rebuild = buildXMLElements(xmlInput, "" , "sdnc-request-header", elementList) // no parent tag - * - * Ex 3: xmlInput // elements one after another (with no parent & children tag) - * myTestid - * myUser - * Usage: - * List elementList = ["test-id", "test-user"] - * String rebuild = buildXMLElements(xmlInput, "" , "", elementList) - * - */ - def buildXMLElements(xmlInput, parentName, childrenName, elementList) { - def varChildren = "" - def var = "" - def xmlBuildUnbounded = "" - if (parentName!="") {xmlBuildUnbounded += "<"+parentName+">" +'\n'} - if (xmlInput != null) { - def xml= new XmlSlurper().parseText(xmlInput) - if (childrenName!="") { - varChildren = xml.'**'.findAll {it.name() == childrenName} - for (i in 0..varChildren.size()-1) { - xmlBuildUnbounded += "<"+childrenName+">" +'\n' - for (element in elementList) { - var = varChildren[i].'*'.find {it.name() == element} - if (var != null) { - xmlBuildUnbounded += "<"+element+">"+var.toString()+"" +'\n' - } - } - xmlBuildUnbounded += "" +'\n' - } - } else { - for (element in elementList) { - var = xml.'*'.find {it.name() == element} - if (var != null) { - xmlBuildUnbounded += "<"+element+">"+var.toString()+"" +'\n' - } - } - } - - } - if (parentName!="") {xmlBuildUnbounded += "" +'\n'} - return xmlBuildUnbounded - } - - def getFirstNodeXml(xmlInput, element){ - def nodeAsText = "" - def nodeToSerialize = "" - if (xmlInput != null) { - def fxml= new XmlSlurper().parseText(xmlInput) - if (utils.nodeExists(xmlInput, "payload")) { - nodeToSerialize = fxml.'payload'.'l3-network'.'*'.find {it.name() == element} - if (nodeToSerialize!=null) { - nodeAsText = XmlUtil.serialize(nodeToSerialize) - } else { - nodeAsText = "" - } - - } else { - nodeToSerialize = fxml.'*'.find {it.name() == element} - if (nodeToSerialize!=null) { - nodeAsText = XmlUtil.serialize(nodeToSerialize) - } else { - nodeAsText = "" - } - - } - } - return nodeAsText - - } - -//TODO: This method still needs to be tested before using. - /** - * - * This method is similar to the gennetwork:ContrailNetworUpdateCompletedObject - * BPEL method. It extracts all of the required subnet information - * for each subnet listed with an orch status equal to the one provided - * and puts the corresponding infomation with the appropriate node for - * updating aai. The method sets the orch status for each subnet to active - * - * @param subnetsXml the entire subnets xml - * @param requestInput the request in the process - * @param queryIdResponse the response of REST AAI query by Id - * @param queryVpnBindingResponse the response of REST AAI query by vpn binding - * @param routeCollection the collection of vpnBinding's 'global-route-target' - * @return String request - */ - public String networkUpdateSubnetInfo(String subnetsXml, String networkResponseXml){ - - String subnets = "" - StringBuilder sb = new StringBuilder() - InputSource source = new InputSource(new StringReader(subnetsXml)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docFactory.setNamespaceAware(true) - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document xml = docBuilder.parse(source) - NodeList nodeList = xml.getElementsByTagNameNS("*", "subnet") - for (int x = 0; x < nodeList.getLength(); x++) { - Node node = nodeList.item(x) - String subnet = "" - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String subnetOrchStatus = eElement.getElementsByTagNameNS("*", "orchestration-status").item(0).getTextContent() - if(subnetOrchStatus.equals("pending-create")){ - - String subnetId = eElement.getElementsByTagNameNS("*", "subnet-id").item(0).getTextContent() - def netAddress = eElement.getElementsByTagNameNS("*", "network-start-address").item(0).getTextContent() - def mask = eElement.getElementsByTagNameNS("*", "cidr-mask").item(0).getTextContent() - def dhcpEnabledSubnet = eElement.getElementsByTagNameNS("*", "dhcp-enabled").item(0).getTextContent() - def gatewayAddress = eElement.getElementsByTagNameNS("*", "gateway-address").item(0).getTextContent() - def ipVersion = eElement.getElementsByTagNameNS("*", "ip-version").item(0).getTextContent() - def relationshipList = eElement.getElementsByTagNameNS("*", "relationship-list").item(0).getTextContent() //TODO: test this - String neutronSubnetId = extractNeutSubId(networkResponseXml, subnetId) - subnet = - """ - ${subnetId} - ${neutronSubnetId} - ${gatewayAddress} - ${netAddress} - ${mask} - ${ipVersion} - active - ${dhcpEnabledSubnet} - ${relationshipList} - """ - - }else if(subnetOrchStatus.equals("pending-delete")){ - StringWriter writer = new StringWriter() - Transformer transformer = TransformerFactory.newInstance().newTransformer() - transformer.transform(new DOMSource(node), new StreamResult(writer)) - subnet = writer.toString() - - }else{ - subnet = "" - } - } - subnets = sb.append(subnet) - } - - subnets = utils.removeXmlPreamble(subnets) - - String subnetsList = - """ - ${subnets} - """ - - return subnetsList - } - - - /** - * - * This method extracts the "value" node text for the the given subnet Id. - * - * @param String inputSource - xml that contains the subnet id key and value - * @param String subnetId - for which you want the value of - - * @return String value - node text of node named value associated with the given subnet id - */ - public String extractNeutSubId(String inputSource, String subnetId){ - - String value = "" - InputSource source = new InputSource(new StringReader(inputSource)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docFactory.setNamespaceAware(true) - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document xml = docBuilder.parse(source) - NodeList nodeList = xml.getElementsByTagNameNS("*", "entry") - for (int x = 0; x < nodeList.getLength(); x++) { - Node node = nodeList.item(x) - String subnet = "" - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String key = eElement.getElementsByTagNameNS("*", "key").item(0).getTextContent() - if(key.equals(subnetId)){ - value = eElement.getElementsByTagNameNS("*", "value").item(0).getTextContent() - } - } - } - return value - } - - public boolean isRollbackEnabled (DelegateExecution execution, String payloadXml) { - - def rollbackEnabled = false - def rollbackValueSet = false - if (utils.nodeExists(payloadXml, "backout-on-failure")) { - String backoutValue = utils.getNodeText1(payloadXml, "backout-on-failure") - if (backoutValue != null && !backoutValue.isEmpty()) { - if (backoutValue.equalsIgnoreCase("false")) { - rollbackEnabled = false - } - else { - rollbackEnabled = true - } - rollbackValueSet = true; - } - } - - if (!rollbackValueSet) { - if (execution.getVariable("URN_mso_rollback") != null) { - rollbackEnabled = execution.getVariable("URN_mso_rollback").toBoolean() - } - } - return rollbackEnabled - } - - - /** - * This method extracts the version for the the given ip-version. - * - * @param String ipvVersion - IP protocols version (ex: ipv4 or ipv6 or 4 or 6) - * @return String version - digit version (ex: 4 or 6) - */ - - public String getIpvVersion (String ipvVersion) { - - String version = "" - try { - if (ipvVersion.isNumber()) { - version = ipvVersion - } else { - version = ipvVersion.substring(ipvVersion.indexOf("ipv")+3) - if (!version.isNumber()) { - version = ipvVersion - } - } - } catch (Exception ex) { - version = ipvVersion - } - return version - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy deleted file mode 100644 index 1b5a2ecdcb..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy +++ /dev/null @@ -1,339 +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.bpmn.common.scripts - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution - -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.core.domain.CloudFlavor -import org.openecomp.mso.bpmn.core.domain.InventoryType -import org.openecomp.mso.bpmn.core.domain.Resource -import org.openecomp.mso.bpmn.core.domain.ResourceType -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.Subscriber -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor - -import org.json.JSONArray -import org.json.JSONObject - -import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.* - -/** - * This class contains the scripts used - * by the OOF Homing Subflow building block. The - * subflow attempts to home the provided - * resources by calling OOF. - */ -class OofHoming extends AbstractServiceTaskProcessor { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - OofUtils oofUtils = new OofUtils(this) - - /** - * This method validates the incoming variables. - * The method then prepares the OOF request - * and posts it to OOF's rest api. - * - * @param execution - */ - public void callOof(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", "HOME_") - utils.log("DEBUG", "*** Started Homing Call OOF ***", isDebugEnabled) - try { - execution.setVariable("rollbackData", null) - execution.setVariable("rolledBack", false) - - String requestId = execution.getVariable("msoRequestId") - utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled) - String serviceInstanceId = execution.getVariable("serviceInstanceId") - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - String serviceInstanceName = execution.getVariable("serviceInstanceName") - utils.log("DEBUG", "Incoming Service Instance Name is: " + serviceInstanceName, isDebugEnabled) - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - utils.log("DEBUG", "Incoming Service Decomposition is: " + serviceDecomposition, isDebugEnabled) - String subscriberInfo = execution.getVariable("subscriberInfo") - utils.log("DEBUG", "Incoming Subscriber Information is: " + subscriberInfo, isDebugEnabled) - Map customerLocation = execution.getVariable("customerLocation") - utils.log("DEBUG", "Incoming Customer Location is: " + customerLocation.toString(), isDebugEnabled) - String cloudOwner = execution.getVariable("cloudOwner") - utils.log("DEBUG", "Incoming cloudOwner is: " + cloudOwner, isDebugEnabled) - String cloudRegionId = execution.getVariable("cloudRegionId") - utils.log("DEBUG", "Incoming cloudRegionId is: " + cloudRegionId, isDebugEnabled) - - if (isBlank(requestId) || - isBlank(serviceInstanceId) || - isBlank(serviceInstanceName) || - isBlank(serviceDecomposition.toString()) || - isBlank(customerLocation.toString())) { - exceptionUtil.buildAndThrowWorkflowException(execution, 4000, - "A required input variable is missing or null") - } else { - Subscriber subscriber = null - if (isBlank(subscriberInfo)) { - subscriber = new Subscriber("", "", "") - } else { - String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId") - String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName") - String subCommonSiteId = "" - if (jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")) { - subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId") - } - subscriber = new Subscriber(subId, subName, subCommonSiteId) - } - - //Authentication - def authHeader = "" - String basicAuth = execution.getVariable("URN_mso_oof_auth") - String msokey = execution.getVariable("URN_mso_msoKey") - String basicAuthValue = utils.encrypt(basicAuth, msokey) - if (basicAuthValue != null) { - utils.log("DEBUG", "Obtained BasicAuth username and password for OOF Adapter: " + basicAuthValue, - isDebugEnabled) - try { - authHeader = utils.getBasicAuth(basicAuthValue, msokey) - execution.setVariable("BasicAuthHeaderValue", authHeader) - } catch (Exception ex) { - utils.log("DEBUG", "Unable to encode username and password string: " + ex, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " + - "encode username and password string") - } - } else { - utils.log("DEBUG", "Unable to obtain BasicAuth - BasicAuth value null", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " + - "value null") - } - - //Prepare Callback - String timeout = execution.getVariable("timeout") - if (isBlank(timeout)) { - timeout = execution.getVariable("URN_mso_oof_timeout"); - if (isBlank(timeout)) { - timeout = "PT30M" - } - } - utils.log("DEBUG", "Async Callback Timeout will be: " + timeout, isDebugEnabled) - - execution.setVariable("timeout", timeout) - execution.setVariable("correlator", requestId) - execution.setVariable("messageType", "oofResponse") - - //Build Request & Call OOF - String oofRequest = oofUtils.buildRequest(execution, requestId, serviceDecomposition, - subscriber, customerLocation) - execution.setVariable("oofRequest", oofRequest) - utils.log("DEBUG", "OOF Request is: " + oofRequest, isDebugEnabled) - - String endpoint = execution.getVariable("URN_mso_service_agnostic_oof_endpoint") - String host = execution.getVariable("URN_mso_service_agnostic_oof_host") - String url = host + endpoint - utils.log("DEBUG", "Posting to OOF Url: " + url, isDebugEnabled) - - logDebug("URL to be used is: " + url, isDebugEnabled) - - RESTConfig config = new RESTConfig(url) - RESTClient client = new RESTClient(config).addAuthorizationHeader(authHeader). - addHeader("Content-Type", "application/json") - APIResponse response = client.httpPost(oofRequest) - - int responseCode = response.getStatusCode() - execution.setVariable("syncResponseCode", responseCode) - logDebug("OOF sync response code is: " + responseCode, isDebugEnabled) - String syncResponse = response.getResponseBodyAsString() - execution.setVariable("syncResponse", syncResponse) - logDebug("OOF sync response is: " + syncResponse, isDebugEnabled) - - utils.log("DEBUG", "*** Completed Homing Call OOF ***", isDebugEnabled) - } - } catch (BpmnError b) { - throw b - } catch (Exception e) { - utils.log("DEBUG", "Error encountered within Homing callOof method: " + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, - "Internal Error - Occured in Homing callOof: " + e.getMessage()) - } - } - - /** - * This method processes the callback response - * and the contained homing solution. It sets - * homing solution assignment and license - * information to the corresponding resources - * - * @param execution - */ - public void processHomingSolution(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", "*** Started Homing Process Homing Solution ***", isDebugEnabled) - try { - String response = execution.getVariable("asyncCallbackResponse") - utils.log("DEBUG", "OOF Async Callback Response is: " + response, isDebugEnabled) - utils.logAudit("OOF Async Callback Response is: " + response) - - oofUtils.validateCallbackResponse(execution, response) - String placements = jsonUtil.getJsonValue(response, "solutions.placementSolutions") - utils.log("DEBUG", "****** Solution Placements: " + placements + " *****", isDebugEnabled) - - ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition") - utils.log("DEBUG", "Service Decomposition: " + decomposition, isDebugEnabled) - - List resourceList = decomposition.getServiceResources() - JSONArray arr = new JSONArray(placements) - for (int i = 0; i < arr.length(); i++) { - JSONArray arrSol = arr.getJSONArray(i) - for (int j = 0; j < arrSol.length(); j++) { - JSONObject placement = arrSol.getJSONObject(j) - utils.log("DEBUG", "****** JSONObject is: " + placement + " *****", "true") - String jsonServiceResourceId = placement.getString("serviceResourceId") - String jsonResourceModuleName = placement.getString("resourceModuleName") - for (Resource resource : resourceList) { - String serviceResourceId = resource.getResourceId() - String resourceModuleName = "" - if (resource.getResourceType() == ResourceType.ALLOTTED_RESOURCE || - resource.getResourceType() == ResourceType.VNF) { - resourceModuleName = resource.getNfFunction() - } - if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId) || - resourceModuleName.equalsIgnoreCase(jsonResourceModuleName)) { - JSONObject solution = placement.getJSONObject("solution") - String solutionType = solution.getString("identifierType") - String inventoryType = "" - if (solutionType.equalsIgnoreCase("serviceInstanceId")) { - inventoryType = "service" - } else { - inventoryType = "cloud" - } - resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType)) - - // TODO Deal with Placement Solutions & Assignment Info here - JSONArray assignmentArr = placement.getJSONArray("assignmentInfo") - Integer arrayIndex = 0 - Integer flavorsIndex = null - Boolean foundFlavors = false - String flavors = null - Map flavorsMap = null - ArrayList flavorsArrayList = new ArrayList() - assignmentArr.each { element -> - JSONObject jsonObject = new JSONObject(element.toString()) - if (jsonUtil.getJsonRawValue(jsonObject.toString(), "key") == "flavors") { - flavors = jsonUtil.getJsonRawValue(jsonObject.toString(), "value") - foundFlavors = true - flavorsIndex = arrayIndex - } else { - arrayIndex += 1 - } - } - if (foundFlavors) { - assignmentArr.remove(flavorsIndex) - flavorsMap = jsonUtil.jsonStringToMap(execution, flavors.toString()) - flavorsMap.each { label, flavor -> - CloudFlavor cloudFlavor = new CloudFlavor(label, flavor) - flavorsArrayList.add(cloudFlavor) - } - } - Map assignmentMap = jsonUtil.entryArrayToMap(execution, - assignmentArr.toString(), "key", "value") - String cloudOwner = assignmentMap.get("cloudOwner") - String cloudRegionId = assignmentMap.get("locationId") - resource.getHomingSolution().setCloudOwner(cloudOwner) - resource.getHomingSolution().setCloudRegionId(cloudRegionId) - if (flavorsArrayList != null && flavorsArrayList.size != 0) { - resource.getHomingSolution().setFlavors(flavorsArrayList) - execution.setVariable(cloudRegionId + "_flavorList", flavorsArrayList) - utils.log("DEBUG", "***** _flavorList is: " + flavorsArrayList.toString() + - " *****", "true") - } - - if (inventoryType.equalsIgnoreCase("service")) { - resource.getHomingSolution().setRehome(assignmentMap.get("isRehome").toBoolean()) - VnfResource vnf = new VnfResource() - vnf.setVnfHostname(assignmentMap.get("vnfHostName")) - resource.getHomingSolution().setVnf(vnf) - resource.getHomingSolution().setServiceInstanceId(solution.getJSONArray("identifiers")[0].toString()) - } - } - } - } - if (JsonUtils.jsonElementExist(response, "solutions.licenseSolutions")) { - String licenseSolutions = jsonUtil.getJsonValue(response, "solutions.licenseSolutions") - JSONArray licenseArr = new JSONArray(licenseSolutions) - for (int l = 0; l < licenseArr.length(); l++) { - JSONObject license = licenseArr.getJSONObject(l) - String jsonServiceResourceId = license.getString("serviceResourceId") - for (Resource resource : resourceList) { - String serviceResourceId = resource.getResourceId() - if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) { - String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolUUID") - List entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList) - resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList) - - String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupUUID") - List licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList) - resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList) - } - } - } - } - } - execution.setVariable("serviceDecomposition", decomposition) - execution.setVariable("homingSolution", placements) //TODO - can be removed as output variable - - utils.log("DEBUG", "*** Completed Homing Process Homing Solution ***", isDebugEnabled) - } catch (BpmnError b) { - throw b - } catch (Exception e) { - utils.log("DEBUG", "Error encountered within Homing ProcessHomingSolution method: " + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in Homing ProcessHomingSolution") - } - } - - /** - * This method logs the start of DHVCreateService - * to make debugging easier. - * - * @param - execution - */ - public String logStart(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - String requestId = execution.getVariable("testReqId") - if (isBlank(requestId)) { - requestId = execution.getVariable("msoRequestId") - } - execution.setVariable("DHVCS_requestId", requestId) - utils.log("DEBUG", "***** STARTED Homing Subflow for request: " + requestId + " *****", "true") - utils.log("DEBUG", "****** Homing Subflow Global Debug Enabled: " + isDebugEnabled + " *****", "true") - utils.logAudit("***** STARTED Homing Subflow for request: " + requestId + " *****") - } - - /** - * Auto-generated method stub - */ - public void preProcessRequest(DelegateExecution execution) {} - // Not Implemented Method -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy deleted file mode 100644 index b61739f32c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy +++ /dev/null @@ -1,463 +0,0 @@ -package org.openecomp.mso.bpmn.common.scripts - -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.core.domain.HomingSolution -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.Resource -import org.openecomp.mso.bpmn.core.domain.AllottedResource -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.ServiceInstance -import org.openecomp.mso.bpmn.core.domain.Subscriber -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.core.json.JsonUtils - -import java.lang.reflect.Array - -import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.* - -class OofUtils { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - private AbstractServiceTaskProcessor utils - - public MsoUtils msoUtils = new MsoUtils() - - public OofUtils(AbstractServiceTaskProcessor taskProcessor) { - this.utils = taskProcessor - } - - /** - * This method builds the service-agnostic - * OOF json request to get a homing solution - * and license solution - * - * @param execution - * @param requestId - * @param decomposition - ServiceDecomposition object - * @param customerLocation - - * @param existingCandidates - - * @param excludedCandidates - - * @param requiredCandidates - - * - * @return request - OOF v1 payload - https://wiki.onap.org/pages/viewpage.action?pageId=25435066 - */ - String buildRequest(DelegateExecution execution, - String requestId, - ServiceDecomposition decomposition, - Subscriber subscriber = null, - Map customerLocation, - ArrayList existingCandidates = null, - ArrayList excludedCandidates = null, - ArrayList requiredCandidates = null) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", "Started Building OOF Request", isDebugEnabled) - def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(execution, "oofResponse", requestId) - def transactionId = requestId - //ServiceInstance Info - ServiceInstance serviceInstance = decomposition.getServiceInstance() - def serviceInstanceId = "" - def serviceInstanceName = "" - - serviceInstanceId = execution.getVariable("serviceInstanceId") - serviceInstanceName = execution.getVariable("serviceInstanceName") - - if (serviceInstanceId == null || serviceInstanceId == "null") { - utils.log("DEBUG", "Unable to obtain Service Instance Id", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " + - "obtain Service Instance Id, execution.getVariable(\"serviceInstanceName\") is null") - } - if (serviceInstanceName == null || serviceInstanceName == "null") { - utils.log("DEBUG", "Unable to obtain Service Instance Name", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " + - "obtain Service Instance Name, execution.getVariable(\"serviceInstanceName\") is null") - } - //Model Info - ModelInfo model = decomposition.getModelInfo() - String modelType = model.getModelType() - String modelInvariantId = model.getModelInvariantUuid() - String modelVersionId = model.getModelUuid() - String modelName = model.getModelName() - String modelVersion = model.getModelVersion() - //Subscriber Info - String subscriberId = "" - String subscriberName = "" - String commonSiteId = "" - if (subscriber != null){ - subscriberId = subscriber.getGlobalId() - subscriberName = subscriber.getName() - commonSiteId = subscriber.getCommonSiteId() - } - - //Determine RequestType - //TODO Figure out better way to determine this - String requestType = "create" - List resources = decomposition.getServiceResources() - for(Resource r:resources){ - HomingSolution currentSolution = (HomingSolution) r.getCurrentHomingSolution() - if(currentSolution != null){ - requestType = "speed changed" - } - } - - //Demands - String placementDemands = "" - StringBuilder sb = new StringBuilder() - List allottedResourceList = decomposition.getServiceAllottedResources() - List vnfResourceList = decomposition.getServiceVnfs() - - if (allottedResourceList.isEmpty() || allottedResourceList == null) { - utils.log("DEBUG", "Allotted Resources List is empty - will try to get service VNFs instead.", - isDebugEnabled) - allottedResourceList = decomposition.getServiceVnfs() - } - - if (allottedResourceList.isEmpty() || allottedResourceList == null) { - utils.log("DEBUG", "Resources List is Empty", isDebugEnabled) - } else { - for (AllottedResource resource : allottedResourceList) { - utils.log("DEBUG", "Allotted Resource: " + resource.toString(), - isDebugEnabled) - def serviceResourceId = resource.getResourceId() - def resourceModuleName = resource.getNfFunction() - utils.log("DEBUG", "resourceModuleName: " + resourceModuleName, - isDebugEnabled) - def resourceModelInvariantId = "no-resourceModelInvariantId" - def resourceModelVersionId = "no-resourceModelVersionId" - - List modelIdLst = execution.getVariable("homingModelIds") - utils.log("DEBUG", "Incoming modelIdLst is: " + modelIdLst.toString(), isDebugEnabled) - for (Map modelId : modelIdLst ) - if (resourceModuleName == modelId.resourceModuleName) { - resourceModelInvariantId = modelId.resourceModelInvariantId - resourceModelVersionId = modelId.resourceModelVersionId - } - - def resourceModelName = "" //Optional - def resourceModelVersion = "" //Optional - def resourceModelType = "" //Optional - def tenantId = "" //Optional - def requiredCandidatesJson = "" - - requiredCandidatesJson = createCandidateJson( - existingCandidates, - excludedCandidates, - requiredCandidates) - - String demand = - " {\n" + - " \"resourceModuleName\": \"${resourceModuleName}\",\n" + - " \"serviceResourceId\": \"${serviceResourceId}\",\n" + - " \"tenantId\": \"${tenantId}\",\n" + - " \"resourceModelInfo\": {\n" + - " \"modelInvariantId\": \"${resourceModelInvariantId}\",\n" + - " \"modelVersionId\": \"${resourceModelVersionId}\",\n" + - " \"modelName\": \"${resourceModelName}\",\n" + - " \"modelType\": \"${resourceModelType}\",\n" + - " \"modelVersion\": \"${resourceModelVersion}\",\n" + - " \"modelCustomizationName\": \"\"\n" + - " }" + requiredCandidatesJson + "\n" + - " }," - - placementDemands = sb.append(demand) - } - for (VnfResource vnfResource : vnfResourceList) { - utils.log("DEBUG", "VNF Resource: " + vnfResource.toString(), - isDebugEnabled) - ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo() - def serviceResourceId = vnfResource.getResourceId() - def resourceModuleName = vnfResource.getNfFunction() - utils.log("DEBUG", "resourceModuleName: " + resourceModuleName, - isDebugEnabled) - def resourceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid() - def resourceModelName = vnfResourceModelInfo.getModelName() - def resourceModelVersion = vnfResourceModelInfo.getModelVersion() - def resourceModelVersionId = vnfResourceModelInfo.getModelUuid() - def resourceModelType = vnfResourceModelInfo.getModelType() - def tenantId = "" //Optional - def requiredCandidatesJson = "" - - - String placementDemand = - " {\n" + - " \"resourceModuleName\": \"${resourceModuleName}\",\n" + - " \"serviceResourceId\": \"${serviceResourceId}\",\n" + - " \"tenantId\": \"${tenantId}\",\n" + - " \"resourceModelInfo\": {\n" + - " \"modelInvariantId\": \"${resourceModelInvariantId}\",\n" + - " \"modelVersionId\": \"${resourceModelVersionId}\",\n" + - " \"modelName\": \"${resourceModelName}\",\n" + - " \"modelType\": \"${resourceModelType}\",\n" + - " \"modelVersion\": \"${resourceModelVersion}\",\n" + - " \"modelCustomizationName\": \"\"\n" + - " }" + requiredCandidatesJson + "\n" + - " }," - - placementDemands = sb.append(placementDemand) - } - placementDemands = placementDemands.substring(0, placementDemands.length() - 1) - } - - /* Commenting Out Licensing as OOF doesn't support for Beijing - String licenseDemands = "" - sb = new StringBuilder() - if (vnfResourceList.isEmpty() || vnfResourceList == null) { - utils.log("DEBUG", "Vnf Resources List is Empty", isDebugEnabled) - } else { - for (VnfResource vnfResource : vnfResourceList) { - ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo() - def resourceInstanceType = vnfResource.getResourceType() - def serviceResourceId = vnfResource.getResourceId() - def resourceModuleName = vnfResource.getResourceType() - def resouceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid() - def resouceModelName = vnfResourceModelInfo.getModelName() - def resouceModelVersion = vnfResourceModelInfo.getModelVersion() - def resouceModelVersionId = vnfResourceModelInfo.getModelUuid() - def resouceModelType = vnfResourceModelInfo.getModelType() - - // TODO Add Existing Licenses to demand - //"existingLicenses": { - //"entitlementPoolUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", - // "43257b49-9602-4fe5-9337-094e52bc9435"], - //"licenseKeyGroupUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", - // "43257b49-9602-4fe5-9337-094e52bc9435"] - //} - - String licenseDemand = - "{\n" + - "\"resourceModuleName\": \"${resourceModuleName}\",\n" + - "\"serviceResourceId\": \"${serviceResourceId}\",\n" + - "\"resourceInstanceType\": \"${resourceInstanceType}\",\n" + - "\"resourceModelInfo\": {\n" + - " \"modelInvariantId\": \"${resouceModelInvariantId}\",\n" + - " \"modelVersionId\": \"${resouceModelVersionId}\",\n" + - " \"modelName\": \"${resouceModelName}\",\n" + - " \"modelType\": \"${resouceModelType}\",\n" + - " \"modelVersion\": \"${resouceModelVersion}\",\n" + - " \"modelCustomizationName\": \"\"\n" + - " }\n" - "}," - - licenseDemands = sb.append(licenseDemand) - } - licenseDemands = licenseDemands.substring(0, licenseDemands.length() - 1) - }*/ - - String request = - "{\n" + - " \"requestInfo\": {\n" + - " \"transactionId\": \"${transactionId}\",\n" + - " \"requestId\": \"${requestId}\",\n" + - " \"callbackUrl\": \"${callbackUrl}\",\n" + - " \"sourceId\": \"so\",\n" + - " \"requestType\": \"${requestType}\"," + - " \"numSolutions\": 1,\n" + - " \"optimizers\": [\"placement\"],\n" + - " \"timeout\": 600\n" + - " },\n" + - " \"placementInfo\": {\n" + - " \"requestParameters\": {\n" + - " \"customerLatitude\": \"${customerLocation.customerLatitude}\",\n" + - " \"customerLongitude\": \"${customerLocation.customerLongitude}\",\n" + - " \"customerName\": \"${customerLocation.customerName}\"\n" + - " }," + - " \"subscriberInfo\": { \n" + - " \"globalSubscriberId\": \"${subscriberId}\",\n" + - " \"subscriberName\": \"${subscriberName}\",\n" + - " \"subscriberCommonSiteId\": \"${commonSiteId}\"\n" + - " },\n" + - " \"placementDemands\": [\n" + - " ${placementDemands}\n" + - " ]\n" + - " },\n" + - " \"serviceInfo\": {\n" + - " \"serviceInstanceId\": \"${serviceInstanceId}\",\n" + - " \"serviceName\": \"${serviceInstanceName}\",\n" + - " \"modelInfo\": {\n" + - " \"modelType\": \"${modelType}\",\n" + - " \"modelInvariantId\": \"${modelInvariantId}\",\n" + - " \"modelVersionId\": \"${modelVersionId}\",\n" + - " \"modelName\": \"${modelName}\",\n" + - " \"modelVersion\": \"${modelVersion}\",\n" + - " \"modelCustomizationName\": \"\"\n" + - " }\n" + - " }\n" + - "}" - - - utils.log("DEBUG", "Completed Building OOF Request", isDebugEnabled) - return request - } - - /** - * This method validates the callback response - * from OOF. If the response contains an - * exception the method will build and throw - * a workflow exception. - * - * @param execution - * @param response - the async callback response from oof - */ - Void validateCallbackResponse(DelegateExecution execution, String response) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - String placements = "" - if (isBlank(response)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "OOF Async Callback Response is Empty") - } else { - if (JsonUtils.jsonElementExist(response, "solutions.placementSolutions")) { - placements = jsonUtil.getJsonValue(response, "solutions.placementSolutions") - if (isBlank(placements) || placements.equalsIgnoreCase("[]")) { - String statusMessage = jsonUtil.getJsonValue(response, "statusMessage") - if (isBlank(statusMessage)) { - utils.log("DEBUG", "Error Occurred in Homing: OOF Async Callback Response does " + - "not contain placement solution.", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 400, - "OOF Async Callback Response does not contain placement solution.") - } else { - utils.log("DEBUG", "Error Occurred in Homing: " + statusMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 400, statusMessage) - } - } else { - return - } - } else if (response.contains("error") || response.contains("Error") ) { - String errorMessage = "" - if (response.contains("policyException")) { - String text = jsonUtil.getJsonValue(response, "requestError.policyException.text") - errorMessage = "OOF Async Callback Response contains a Request Error Policy Exception: " + text - } else if (response.contains("Unable to find any candidate for demand")) { - errorMessage = "OOF Async Callback Response contains error: Unable to find any candidate for " + - "demand *** Response: " + response.toString() - } else if (response.contains("serviceException")) { - String text = jsonUtil.getJsonValue(response, "requestError.serviceException.text") - errorMessage = "OOF Async Callback Response contains a Request Error Service Exception: " + text - } else { - errorMessage = "OOF Async Callback Response contains a Request Error. Unable to determine the Request Error Exception." - } - utils.log("DEBUG", "Error Occurred in Homing: " + errorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 400, errorMessage) - - } else { - utils.log("DEBUG", "Error Occurred in Homing: Received an Unknown Async Callback Response from OOF.", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Received an Unknown Async Callback Response from OOF.") - } - } - - } - - /** - * This method creates candidates json for placement Demands. - * - * @param execution - * @param existingCandidates - - * @param excludedCandidates - - * @param requiredCandidates - - * - * @return candidatesJson - a JSON string with candidates - */ - String createCandidateJson(ArrayList existingCandidates = null, - ArrayList excludedCandidates = null, - ArrayList requiredCandidates = null) { - def candidatesJson = "" - def type = "" - if (existingCandidates != null && existingCandidates != {}) { - sb = new StringBuilder() - sb.append(",\n" + - " \"existingCandidates\": [\n") - def existingCandidateJson = "" - existingCandidates.each { existingCandidate -> - type = existingCandidate.get('identifierType') - if (type == 'vimId') { - def cloudOwner = existingCandidate.get('cloudOwner') - def cloudRegionId = existingCandidate.get('identifiers') - existingCandidateJson = "{\n" + - " \"identifierType\": \"vimId\",\n" + - " \"cloudOwner\": \"${cloudOwner}\",\n" + - " \"identifiers\": [\"${cloudRegionId}\"]\n" + - " }," - sb.append(existingCandidateJson) - } - if (type == 'serviceInstanceId') { - def serviceInstanceId = existingCandidate.get('identifiers') - existingCandidateJson += "{\n" + - " \"identifierType\": \"serviceInstanceId\",\n" + - " \"identifiers\": [\"${serviceInstanceId}\"]\n" + - " }," - sb.append(existingCandidateJson) - } - } - if (existingCandidateJson != "") { - sb.setLength(sb.length() - 1) - candidatesJson = sb.append(",\n],") - } - } - if (excludedCandidates != null && excludedCandidates != {}) { - sb = new StringBuilder() - sb.append(",\n" + - " \"excludedCandidates\": [\n") - def excludedCandidateJson = "" - excludedCandidates.each { excludedCandidate -> - type = excludedCandidate.get('identifierType') - if (type == 'vimId') { - def cloudOwner = excludedCandidate.get('cloudOwner') - def cloudRegionId = excludedCandidate.get('identifiers') - excludedCandidateJson = "{\n" + - " \"identifierType\": \"vimId\",\n" + - " \"cloudOwner\": \"${cloudOwner}\",\n" + - " \"identifiers\": [\"${cloudRegionId}\"]\n" + - " }," - sb.append(excludedCandidateJson) - } - if (type == 'serviceInstanceId') { - def serviceInstanceId = excludedCandidate.get('identifiers') - excludedCandidateJson += "{\n" + - " \"identifierType\": \"serviceInstanceId\",\n" + - " \"identifiers\": [\"${serviceInstanceId}\"]\n" + - " }," - sb.append(excludedCandidateJson) - } - } - if (excludedCandidateJson != "") { - sb.setLength(sb.length() - 1) - candidatesJson = sb.append(",\n],") - } - } - if (requiredCandidates != null && requiredCandidates != {}) { - sb = new StringBuilder() - sb.append(",\n" + - " \"requiredCandidates\": [\n") - def requiredCandidatesJson = "" - requiredCandidates.each { requiredCandidate -> - type = requiredCandidate.get('identifierType') - if (type == 'vimId') { - def cloudOwner = requiredCandidate.get('cloudOwner') - def cloudRegionId = requiredCandidate.get('identifiers') - requiredCandidatesJson = "{\n" + - " \"identifierType\": \"vimId\",\n" + - " \"cloudOwner\": \"${cloudOwner}\",\n" + - " \"identifiers\": [\"${cloudRegionId}\"]\n" + - " }," - sb.append(requiredCandidatesJson) - } - if (type == 'serviceInstanceId') { - def serviceInstanceId = requiredCandidate.get('identifiers') - requiredCandidatesJson += "{\n" + - " \"identifierType\": \"serviceInstanceId\",\n" + - " \"identifiers\": [\"${serviceInstanceId}\"]\n" + - " }," - sb.append(requiredCandidatesJson) - } - } - if (requiredCandidatesJson != "") { - sb.setLength(sb.length() - 1) - candidatesJson = sb.append(",\n],") - } - } - if (candidatesJson != "") {candidatesJson = candidatesJson.substring(0, candidatesJson.length() - 1)} - return candidatesJson - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy deleted file mode 100644 index bbdaab15e9..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy +++ /dev/null @@ -1,375 +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.bpmn.common.scripts - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.springframework.web.util.UriUtils - -public class PrepareUpdateAAIVfModule extends VfModuleBase { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - private MsoUtils utils = new MsoUtils() - /** - * Initialize the flow's variables. - * - * @param execution The flow's execution instance. - */ - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable('prefix', 'PUAAIVfMod_') - execution.setVariable('PUAAIVfMod_vnfId', null) - execution.setVariable('PUAAIVfMod_vfModuleId', null) - execution.setVariable('PUAAIVfMod_vnfName', null) - execution.setVariable('PUAAIVfMod_orchestrationStatus', null) - execution.setVariable('PUAAIVfMod_vfModule', null) - execution.setVariable('PUAAIVfMod_vfModuleOK', false) - execution.setVariable('PUAAIVfMod_vfModuleValidationError', null) - execution.setVariable('PUAAIVfMod_getVnfResponseCode' ,null) - execution.setVariable('PUAAIVfMod_getVnfResponse', '') - execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', null) - execution.setVariable('PUAAIVfMod_updateVfModuleResponse', '') - execution.setVariable('PUAAIVfMod_outVfModule', null) - } - - /** - * Check for missing elements in the received request. - * - * @param execution The flow's execution instance. - */ - public void preProcessRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def xml = execution.getVariable('PrepareUpdateAAIVfModuleRequest') - logDebug('Received request xml:\n' + xml, isDebugLogEnabled) - utils.logAudit("PrepareUpdateAAIVfModule Request : " + xml) - - initProcessVariables(execution) - - def vnfId = getRequiredNodeText(execution, xml,'vnf-id') - execution.setVariable('PUAAIVfMod_vnfId', vnfId) - - def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id') - execution.setVariable('PUAAIVfMod_vfModuleId', vfModuleId) - - def orchestrationStatus = getRequiredNodeText(execution, xml,'orchestration-status') - execution.setVariable('PUAAIVfMod_orchestrationStatus', orchestrationStatus) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) - } - } - - /** - * Using the received vnfId, query AAI to get the corresponding Generic VNF. - * A 200 response is expected with the Generic VNF in the response body. - * - * @param execution The flow's execution instance. - */ - public void getGenericVnf(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.getGenericVnf(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def vnfId = execution.getVariable('PUAAIVfMod_vnfId') - - AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - - String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" - - utils.logAudit("PrepareUpdateAAIVfModule: AAI endPoint : " + endPoint) - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - try { - RESTConfig config = new RESTConfig(endPoint); - def responseData = '' - String aaiRequestId = utils.getRequestID() - RESTClient client = new RESTClient(config). - addHeader('X-TransactionId', aaiRequestId). - addHeader('X-FromAppId', 'MSO'). - addHeader('Content-Type', 'application/xml'). - addHeader('Accept','application/xml'); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) - APIResponse response = client.httpGet() - utils.logAudit("PrepareUpdateAAIVfModule: - invoking httpGet to AAI") - - responseData = response.getResponseBodyAsString() - execution.setVariable('PUAAIVfMod_getVnfResponseCode', response.getStatusCode()) - execution.setVariable('PUAAIVfMod_getVnfResponse', responseData) - - utils.logAudit("PrepareUpdateAAIVfModule: AAI Response : " + responseData) - utils.logAudit("PrepareUpdateAAIVfModule: AAI ResponseCode : " + response.getStatusCode()) - - logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) - logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) - } catch (Exception ex) { - ex.printStackTrace() - logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(), isDebugLogEnabled) - execution.setVariable('PUAAIVfMod_getVnfResponseCode', 500) - execution.setVariable('PUAAIVfMod_getVnfResponse', 'AAI GET Failed:' + ex.getMessage()) - } - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getGenericVnf(): ' + e.getMessage()) - } - } - - /** - * Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID - * exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module - * is the base VF Module and it's not the only VF Module for this Generic VNF, that we're not - * attempting to delete it. - * - * @param execution The flow's execution instance. - */ - public void validateVfModule(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.validateVfModule(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def genericVnf = execution.getVariable('PUAAIVfMod_getVnfResponse') - def vnfId = execution.getVariable('PUAAIVfMod_vnfId') - def vfModuleId = execution.getVariable('PUAAIVfMod_vfModuleId') - def vnfName = getNodeTextForce(genericVnf, 'vnf-name') - execution.setVariable('PUAAIVfMod_vnfName', vnfName) - def VfModule vfModule = findVfModule(genericVnf, vfModuleId) - if (vfModule == null) { - def String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\'' - execution.setVariable('PUAAIVfMod_vfModuleValidationError', msg) - execution.setVariable('PUAAIVfMod_vfModuleOK', false) - } else { - def orchestrationStatus = execution.getVariable('PUAAIVfMod_orchestrationStatus') - if (isDebugLogEnabled) { - logDebug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.isBaseVfModule() + - ', isOnlyVfModule=' + vfModule.isOnlyVfModule() + ', new orchestration-status=' + orchestrationStatus, - isDebugLogEnabled) - } - if (vfModule.isBaseVfModule() && !vfModule.isOnlyVfModule() && orchestrationStatus.equals('pending-delete')) { - def String msg = 'Orchestration status for VF Module \'' + vfModuleId + - '\' cannot be set to \'pending-delete\' since it is the base VF Module and it\'s not the only VF Module in Generic VNF \'' + vnfId + '\'' - execution.setVariable('PUAAIVfMod_vfModuleValidationError', msg) - execution.setVariable('PUAAIVfMod_vfModuleOK', false) - } else { - execution.setVariable('PUAAIVfMod_vfModule', vfModule) - execution.setVariable('PUAAIVfMod_vfModuleOK', true) - } - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage()) - } - } - - /** - * Construct and send a PATCH request to AAI to update the VF Module. - * - * @param execution The flow's execution instance. - */ - public void updateVfModule(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.updateVfModule(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - // Construct payload - def VfModule vfModule = (VfModule) execution.getVariable('PUAAIVfMod_vfModule') - def Node newVfModuleNode = vfModule.getNode().clone() - def orchestrationStatus = execution.getVariable('PUAAIVfMod_orchestrationStatus') - def Node orchestrationStatusNode = utils.getChildNode(newVfModuleNode, 'orchestration-status') - if (orchestrationStatusNode == null) { - // Node doesn't exist, this should never happen, right? - new Node(newVfModuleNode, 'orchestration-status', orchestrationStatus) - } else { - // Node already exists, just give it a new value - orchestrationStatusNode.setValue(orchestrationStatus) - } - def VfModule newVfModule = new VfModule(newVfModuleNode, vfModule.isOnlyVfModule()) - //def payload = utils.nodeToString(newVfModuleNode) - - // Construct endpoint - def vnfId = execution.getVariable('PUAAIVfMod_vnfId') - def vfModuleId = execution.getVariable('PUAAIVfMod_vfModuleId') - - def payload = """{ - "vf-module-id": "${vfModuleId}", - "orchestration-status": "${orchestrationStatus}" - }""" - - utils.logAudit("VfModule payload : " + payload) - - AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - - String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "/vf-modules/vf-module/" + UriUtils.encode(vfModuleId, "UTF-8") - utils.logAudit("PrepareUpdateAAIVfModule: AAI endPoint : " + endPoint) - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - try { - RESTConfig config = new RESTConfig(endPoint); - def responseData = '' - def aaiRequestId = utils.getRequestID() - RESTClient client = new RESTClient(config). - addHeader('X-TransactionId', aaiRequestId). - addHeader('X-FromAppId', 'MSO'). - addHeader('Content-Type', 'application/merge-patch+json'). - addHeader('Accept','application/json'); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - logDebug('sending PATCH to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled) - APIResponse response = client.httpPatch(payload) - utils.logAudit("PrepareUpdateAAIVfModule: - invoking httpPatch to AAI") - utils.logAudit("PrepareUpdateAAIVfModule: - invoking httpPatch to AAI") - - responseData = response.getResponseBodyAsString() - execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', response.getStatusCode()) - execution.setVariable('PUAAIVfMod_updateVfModuleResponse', responseData) - logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) - logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) - utils.logAudit("PrepareUpdateAAIVfModule: AAI Response : " + responseData) - utils.logAudit("PrepareUpdateAAIVfModule: AAI ResponseCode : " + response.getStatusCode()) - - // Set the output for this flow. The updated VfModule is an output, the generic VNF name, and for - // backward compatibilty, the heat-stack-id is an output - execution.setVariable('PUAAIVfMod_outVfModule', newVfModule) - def vnfName = execution.getVariable('PUAAIVfMod_vnfName') - logDebug('Output PUAAIVfMod_vnfName set to ' + vnfName, isDebugLogEnabled) - // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead - execution.setVariable('WorkflowResponse', newVfModule) - logDebug('Output PUAAIVfMod_outVfModule set for VF Module Id \'' + newVfModule.getElementText('vf-module-id') + '\'', isDebugLogEnabled) - def heatStackId = newVfModule.getElementText('heat-stack-id') - execution.setVariable('PUAAIVfMod_heatStackId', heatStackId) - logDebug('Output PUAAIVfMod_heatStackId set to \'' + heatStackId + '\'', isDebugLogEnabled) - } catch (Exception ex) { - ex.printStackTrace() - logDebug('Exception occurred while executing AAI PUT:' + ex.getMessage(), isDebugLogEnabled) - execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 500) - execution.setVariable('PUAAIVfMod_updateVfModuleResponse', 'AAI PATCH Failed:' + ex.getMessage()) - } - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage()) - } - } - - /** - * Generates a WorkflowException if the AAI query returns a response code other than 200. - * - * @param execution The flow's execution instance. - */ - public void handleVnfNotFound(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.handleVnfNotFound(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - logError('Error occurred attempting to query AAI, Response Code ' + - execution.getVariable('PUAAIVfMod_getVnfResponseCode') + ', Error Response ' + - execution.getVariable('PUAAIVfMod_getVnfResponse')) - String processKey = getProcessKey(execution); - WorkflowException exception = new WorkflowException(processKey, 5000, - execution.getVariable('PUAAIVfMod_getVnfResponse')) - execution.setVariable('WorkflowException', exception) - - logDebug('Exited ' + method, isDebugLogEnabled) - } - - /** - * Generates a WorkflowException if the VF Module does not pass validation. - * - * @param execution The flow's execution instance. - */ - public void handleVfModuleValidationError(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.handleVfModuleValidationError(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - def String errorMsg = 'VF Module validation error: ' + execution.getVariable('PUAAIVfMod_vfModuleValidationError') - logError(errorMsg) - utils.logAudit("PrepareUpdateAAIVfModule: Error Message : " + errorMsg) - - String processKey = getProcessKey(execution); - WorkflowException exception = new WorkflowException(processKey, 5000, errorMsg) - execution.setVariable('WorkflowException', exception) - - logDebug('Exited ' + method, isDebugLogEnabled) - } - - /** - * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200. - * - * @param execution The flow's execution instance. - */ - public void handleUpdateVfModuleFailure(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - logError('Error occurred attempting to update VF Module in AAI, Response Code ' + - execution.getVariable('PUAAIVfMod_updateVfModuleResponseCode') + ', Error Response ' + - execution.getVariable('PUAAIVfMod_updateVfModuleResponse')) - String processKey = getProcessKey(execution); - WorkflowException exception = new WorkflowException(processKey, 5000, - execution.getVariable('PUAAIVfMod_updateVfModuleResponse')) - execution.setVariable('WorkflowException', exception) - - logDebug('Exited ' + method, isDebugLogEnabled) - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/RainyDayHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/RainyDayHandler.groovy deleted file mode 100644 index 0f7de9a23e..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/RainyDayHandler.groovy +++ /dev/null @@ -1,198 +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.bpmn.common.scripts; - -import static org.apache.commons.lang3.StringUtils.*; - - - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.client.policy.PolicyClient -import org.openecomp.mso.client.policy.PolicyClientImpl -import org.openecomp.mso.client.policy.entities.DictionaryData -import org.openecomp.mso.client.policy.entities.PolicyDecision -import org.openecomp.mso.client.policy.entities.Treatments -import org.openecomp.mso.client.policy.PolicyRestClient - - -import com.att.ecomp.mso.bpmn.core.domain.* - -import groovy.json.* - -/** - * This groovy class supports the RainyDayHandler.bpmn process. - * - * @author - * - * Inputs: - * @param - msoRequestId - * @param - isDebugLogEnabled - * @param - serviceType - * @param - vnfType - * @param - currentActivity - * @param - workStep - * @param - failedActivity - * @param - errorCode - * @param - errorText - * @param - vnfName - * - * Outputs: - * @param - WorkflowException - * @param - handlingCode - * - */ -public class RainyDayHandler extends AbstractServiceTaskProcessor { - - String Prefix="RDH_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - JsonUtils jsonUtils = new JsonUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("DEBUG"," ***** preProcessRequest of RainyDayHandler *****", isDebugLogEnabled) - - try { - execution.setVariable("prefix", Prefix) - // check for required input - String requestId = execution.getVariable("msoRequestId") - utils.log("DEBUG", "msoRequestId is: " + requestId, isDebugLogEnabled) - def serviceType = execution.getVariable("serviceType") - utils.log("DEBUG", "serviceType is: " + serviceType, isDebugLogEnabled) - def vnfType = execution.getVariable("vnfType") - utils.log("DEBUG", "vnftype is: " + vnfType, isDebugLogEnabled) - def currentActivity = execution.getVariable("currentActivity") - utils.log("DEBUG", "currentActivity is: " + currentActivity, isDebugLogEnabled) - def workStep = execution.getVariable("workStep") - utils.log("DEBUG", "workStep is: " + workStep, isDebugLogEnabled) - def failedActivity = execution.getVariable("failedActivity") - utils.log("DEBUG", "failedActivity is: " + failedActivity, isDebugLogEnabled) - def errorCode = execution.getVariable("errorCode") - utils.log("DEBUG", "errorCode is: " + errorCode, isDebugLogEnabled) - def errorText = execution.getVariable("errorText") - utils.log("DEBUG", "errorText is: " + errorText, isDebugLogEnabled) - String defaultPolicyDisposition = (String) execution.getVariable('URN_policy_default_disposition') - utils.log("DEBUG", "defaultPolicyDisposition is: " + defaultPolicyDisposition, isDebugLogEnabled) - execution.setVariable('defaultPolicyDisposition', defaultPolicyDisposition) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest of RainyDayHandler *****", isDebugLogEnabled) - } - - public void queryPolicy (DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("DEBUG"," ***** queryPolicy of RainyDayHandler *****", isDebugLogEnabled) - - try { - - // check for input - String serviceType = execution.getVariable("serviceType") - String vnfType = execution.getVariable("vnfType") - - utils.log("DEBUG", "serviceType: " + serviceType, isDebugLogEnabled) - utils.log("DEBUG", "vnfType: " + vnfType, isDebugLogEnabled) - - def errorCode = execution.getVariable("errorCode") - def bbId = execution.getVariable("currentActivity") - def workStep = execution.getVariable("workStep") - - utils.log("DEBUG", "Before querying policy", isDebugLogEnabled) - - String decision = 'DENY' - String disposition = "Abort" - String defaultAllowedTreatments = "rollback, skip, manual, abort" - - String defaultPolicyDisposition = (String) execution.getVariable('defaultPolicyDisposition') - if (defaultPolicyDisposition != null) { - utils.log("DEBUG", "Setting disposition to the configured default instead of querying Policy: " + defaultPolicyDisposition, isDebugLogEnabled) - disposition = defaultPolicyDisposition - utils.log("DEBUG", "Setting default allowed treatments: " + defaultAllowedTreatments, isDebugLogEnabled) - execution.setVariable("validResponses", defaultAllowedTreatments) - } - else { - - PolicyDecision decisionObject = null - - try { - PolicyClient policyClient = new PolicyClientImpl() - utils.log("DEBUG", "Created policy client", isDebugLogEnabled) - decisionObject = policyClient.getDecision(serviceType, vnfType, bbId, workStep, errorCode) - utils.log("DEBUG", "Obtained decision object", isDebugLogEnabled) - DictionaryData dictClient = policyClient.getAllowedTreatments(bbId, workStep) - Treatments treatments = dictClient.getTreatments() - String validResponses = treatments.getString() - if (validResponses != null) { - validResponses = validResponses.toLowerCase() - } - utils.log("DEBUG", "Obtained validResponses: " + validResponses, isDebugLogEnabled) - execution.setVariable("validResponses", validResponses) - - } catch(Exception e) { - msg = "Exception in queryPolicy " + e.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - } - - - if (decisionObject != null) { - decision = decisionObject.getDecision() - disposition = decisionObject.getDetails() - utils.log("DEBUG", "Obtained disposition from policy engine: " + disposition, isDebugLogEnabled) - } - else { - disposition = "Abort" - } - if (disposition == null) { - disposition = "Abort" - } - } - execution.setVariable("handlingCode", disposition) - - utils.log("DEBUG", "Disposition: "+ disposition, isDebugLogEnabled) - - } catch (BpmnError e) { - utils.log("DEBUG", "BPMN exception: " + e.errorMessage, isDebugLogEnabled) - throw e; - } catch (Exception ex){ - msg = "Exception in queryPolicy " + ex.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - //exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit queryPolicy of RainyDayHandler *****", isDebugLogEnabled) - } - - - - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ReceiveWorkflowMessage.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ReceiveWorkflowMessage.groovy deleted file mode 100644 index 1e1afb4d5d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ReceiveWorkflowMessage.groovy +++ /dev/null @@ -1,109 +0,0 @@ -package org.openecomp.mso.bpmn.common.scripts; - -import groovy.json.* - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil - - -class ReceiveWorkflowMessage extends AbstractServiceTaskProcessor { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - /** - * Process the incoming variables. - * - * @param execution The flow's execution instance. - */ -public void preProcessRequest (DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - def prefix="RCVWFMSG_" - execution.setVariable("prefix", prefix) - setSuccessIndicator(execution, false) - - try { - - // Confirm that timeout value has been provided in 'RCVWFMSG_timeout'. - def timeout = execution.getVariable('RCVWFMSG_timeout') - logDebug('Timeout value is \'' + timeout + '\'', isDebugLogEnabled) - if ((timeout == null) || (timeout.isEmpty())) { - String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_timeout\'' - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - // Confirm that message type has been provided in 'RCVWFMSG_messageType' - def messageType = execution.getVariable('RCVWFMSG_messageType') - logDebug('Message type is \'' + messageType + '\'', isDebugLogEnabled) - if ((messageType == null) || (messageType.isEmpty())) { - String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_messageType\'' - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - // Confirm that correlator value has been provided in 'RCVWFMSG_correlator' - def correlator = execution.getVariable('RCVWFMSG_correlator') - logDebug('Correlator value is \'' + correlator + '\'', isDebugLogEnabled) - if ((correlator == null) || (correlator.isEmpty())) { - String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_correlator\'' - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - execution.setVariable(messageType + '_CORRELATOR', correlator) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e - } catch (Exception e) { - String msg = 'Caught exception in ' + method + ": " + e - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - } - - /** - * Process a received message. - * - * @param execution The flow's execution instance. - */ - public void processReceivedMessage(DelegateExecution execution){ - def method = getClass().getSimpleName() + '.processReceivedMessage(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String messageType = null; - String receivedMessage = null; - - try { - messageType = execution.getVariable('RCVWFMSG_messageType') - receivedMessage = execution.getVariable(messageType + '_MESSAGE') - logDebug(getProcessKey(execution) + ": received message:\n" + receivedMessage, isDebugLogEnabled) - - // The received message is made available to the calling flow in WorkflowResponse - execution.setVariable("WorkflowResponse", receivedMessage) - - setSuccessIndicator(execution, true) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (Exception e) { - receivedMessage = receivedMessage == null || String.valueOf(receivedMessage).isEmpty() ? "NONE" : receivedMessage - String msg = "Error processing received workflow message: " + receivedMessage - logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled) - exceptionUtil.buildWorkflowException(execution, 7020, msg) - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy deleted file mode 100644 index 44c9f3f829..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy +++ /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.bpmn.common.scripts; - -import java.text.SimpleDateFormat - -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.core.WorkflowException - - -// SDNC Adapter Request/Response processing - -public class SDNCAdapter extends AbstractServiceTaskProcessor { - - def Prefix="SDNCA_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - // Script Task: Process SDNC Workflow Request - // Params: Workflow DelegateExecution - // Assume: Received SDNCAdapterWorkflowRequest is in variable 'sdncAdapterWorkflowRequest' - // Put created SDNCAdapterRequest in variable 'sdncAdapterRequest' - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - try{ - - utils.log("DEBUG", "=========== Begin PreProcess SDNCAdapterRequestScript ===========", isDebugEnabled) - utils.log("DEBUG", "Incoming sdncAdapterWorkflowRequest:\n" + execution.getVariable("sdncAdapterWorkflowRequest"), isDebugEnabled) - - // Initialize some variables used throughout the flow - execution.setVariable("prefix", Prefix) - execution.setVariable("sdncAdapterResponse", "") - execution.setVariable("asynchronousResponseTimeout", false) - execution.setVariable("continueListening", false) - execution.setVariable("SDNCA_SuccessIndicator", false) - execution.setVariable("SDNCA_InterimNotify", false) - - // Authorization Info - String basicAuthValue = execution.getVariable("URN_mso_adapters_po_auth") - utils.log("DEBUG", "Obtained BasicAuth userid password for sdnc adapter:" + basicAuthValue, isDebugEnabled) - try { - def encodedString = utils.getBasicAuth(basicAuthValue, execution.getVariable("URN_mso_msoKey")) - execution.setVariable("BasicAuthHeaderValue",encodedString) - } catch (IOException ex) { - utils.log("ERROR", "Unable to encode username password string") - } - - // TODO Use variables instead of passing xml request - Huh? - - // Get original RequestHeader - def sdncwfreq= execution.getVariable("sdncAdapterWorkflowRequest") - def requestHeader = utils.getNodeXml(sdncwfreq, "RequestHeader") - requestHeader = requestHeader.replace("\n", "") - utils.log("DEBUG", "RequestHeader:\n" + requestHeader, isDebugEnabled) - - // Set Callback URL to use from URN Mapping or jBoss Property - def origCallbackUrl = utils.getNodeText(requestHeader, "CallbackUrl") - def callbackUrlToUse = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - MsoUtils msoUtil = new MsoUtils() - def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") - if((useQualifiedHostName!=null) && (useQualifiedHostName.equals("true"))){ - callbackUrlToUse = msoUtil.getQualifiedHostNameForCallback(callbackUrlToUse) - } - utils.log("DEBUG", "Callback URL to use:\n" + callbackUrlToUse, isDebugEnabled) - requestHeader = requestHeader.replace(origCallbackUrl, callbackUrlToUse) - - // Get parameters from request header - def sdnca_svcInstanceId = utils.getNodeText1(requestHeader, "SvcInstanceId") // optional - utils.log("DEBUG", "SvcInstanceId: " + sdnca_svcInstanceId, isDebugEnabled) - def sdnca_msoAction = utils.getNodeText1(requestHeader, "MsoAction") // optional - utils.log("DEBUG", "MsoAction: " + sdnca_msoAction, isDebugEnabled) - def sdnca_svcAction = utils.getNodeText(requestHeader, "SvcAction") - utils.log("DEBUG", "SvcAction: " + sdnca_svcAction, isDebugEnabled) - def sdnca_svcOperation = utils.getNodeText(requestHeader, "SvcOperation") - utils.log("DEBUG", "SvcOperation: " + sdnca_svcOperation, isDebugEnabled) - def sdncRequestData = utils.getChildNodes(sdncwfreq, "SDNCRequestData") - sdncRequestData = sdncRequestData.replace("\n", "") - sdncRequestData = sdncRequestData.replaceAll('tag0:', '').replaceAll(':tag0', '') - utils.log("DEBUG", "SDNCRequestData:\n" + sdncRequestData, isDebugEnabled) - def sdnca_serviceType = "" - if (utils.nodeExists(sdncwfreq, "service-type")) { - sdnca_serviceType = utils.getNodeText(sdncwfreq, "service-type") - } - utils.log("DEBUG", "service-type: " + sdnca_serviceType, isDebugEnabled) - def serviceConfigActivate = false - def source = '' - if ((sdnca_svcAction == 'activate') && (sdnca_svcOperation == 'service-configuration-operation') && (sdnca_serviceType == 'uCPE-VMS')) { - serviceConfigActivate = true - if (utils.nodeExists(sdncwfreq, 'source')) { - source = utils.getNodeText(sdncwfreq, 'source') - } - } - execution.setVariable("serviceConfigActivate", serviceConfigActivate) - utils.log("DEBUG", "serviceConfigActivate: " + serviceConfigActivate, isDebugEnabled) - execution.setVariable("source", source) - utils.log("DEBUG", "source: " + source, isDebugEnabled) - - //calling process should pass a generated uuid if sending multiple sdnc requests - def requestId = utils.getNodeText(requestHeader, "RequestId") - execution.setVariable(Prefix + "requestId", requestId) - - // Prepare SDNC Request to the SDNC Adapter - String sdncAdapterRequest = """ - - - - - ${requestId}""" - - if (sdnca_svcInstanceId != null) { - sdncAdapterRequest += """ - ${sdnca_svcInstanceId}""" - } - - sdncAdapterRequest += """ - ${sdnca_svcAction} - ${sdnca_svcOperation} - ${callbackUrlToUse}""" - - if (sdnca_msoAction != null) { - sdncAdapterRequest += """ - ${sdnca_msoAction}""" - } - - sdncAdapterRequest += """ - - ${sdncRequestData}""" - - utils.logAudit("Outgoing SDNCAdapterRequest:\n" + sdncAdapterRequest) - execution.setVariable("sdncAdapterRequest", sdncAdapterRequest) - - utils.log("DEBUG", execution.getVariable("sdncAdapterRequest"), isDebugEnabled) - utils.log("DEBUG", execution.getVariable("URN_mso_adapters_sdnc_endpoint"), isDebugEnabled) - }catch(Exception e){ - utils.log("DEBUG", 'Internal Error occured during PreProcess Method: ' + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PreProcess Method') // TODO: what message and error code? - } - utils.log("DEBUG","=========== End pre Process SDNCRequestScript ===========", isDebugEnabled) - } - - public void postProcessResponse (DelegateExecution execution) { - - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - try{ - utils.log("DEBUG","=========== Begin POSTProcess SDNCAdapter ===========", isDebugEnabled) - utils.log("DEBUG","Incoming sdncAdapterCallbackRequest:\n" + execution.getVariable("sdncAdapterCallbackRequest"), isDebugEnabled) - - // Check the sdnccallback request and get the responsecode - def sdnccallbackreq = execution.getVariable("sdncAdapterCallbackRequest") - def callbackRequestData = "" - def callbackHeader = "" - utils.logAudit("SDNCAdapterCallback Request :" + sdnccallbackreq) - - if(sdnccallbackreq != null){ - callbackHeader = utils.getNodeXml(sdnccallbackreq, "CallbackHeader") - callbackRequestData = utils.getNodeXml(sdnccallbackreq, "RequestData") - - callbackHeader = callbackHeader.replace("\n", "") - utils.log("DEBUG","SDNCCallbackHeader is:\n" + callbackHeader, isDebugEnabled) - - callbackRequestData = callbackRequestData.replace("\n", "") - utils.log("DEBUG","DECODED SDNCCallback RequestData is:\n" + callbackRequestData, isDebugEnabled) - - String sdncAdapterWorkflowResponse =""" - - - ${callbackHeader} - ${callbackRequestData} - - """ - - - utils.log("DEBUG","Outgoing sdncAdapterWorkflowResponse:\n" + sdncAdapterWorkflowResponse, isDebugEnabled) - sdncAdapterWorkflowResponse = utils.formatXml(sdncAdapterWorkflowResponse) - utils.logAudit("sdncAdapterWorkflowResponse :" + sdncAdapterWorkflowResponse) - execution.setVariable("sdncAdapterResponse", sdncAdapterWorkflowResponse) - // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead - execution.setVariable("WorkflowResponse", sdncAdapterWorkflowResponse) - - // Check final indicator to determine if we are to continue listening or not - def String enhancedCallbackRequestData = callbackRequestData.replaceAll("&", "&") - enhancedCallbackRequestData = enhancedCallbackRequestData.replaceAll("<", "<") - enhancedCallbackRequestData = enhancedCallbackRequestData.replaceAll(">", ">") - // replace the data with '&' (ex: subscriber-name= 'FOUR SEASONS HEATING & COOLING' - enhancedCallbackRequestData = enhancedCallbackRequestData.replace("&", "&") - utils.log("DEBUG","EnhancedCallbackRequestData:\n" + enhancedCallbackRequestData, isDebugEnabled) - execution.setVariable("enhancedCallbackRequestData", enhancedCallbackRequestData) - def continueListening = false - if (utils.nodeExists(enhancedCallbackRequestData, "ack-final-indicator")) { - if (utils.getNodeText(enhancedCallbackRequestData, "ack-final-indicator") == 'N') { - continueListening = true - } - } - execution.setVariable("continueListening", continueListening) - utils.log("DEBUG", "Continue Listening: " + continueListening, isDebugEnabled) - execution.setVariable("asynchronousResponseTimeout", false) - }else{ - // Timed out waiting for asynchronous message, build error response - exceptionUtil.buildWorkflowException(execution, 500, "SDNC Callback Timeout Error") - execution.setVariable("asynchronousResponseTimeout", true) - utils.log("DEBUG", "Timed out waiting for asynchronous message", isDebugEnabled) - } - }catch(Exception e){ - utils.log("DEBUG", 'Internal Error occured during PostProcess Method: ' + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PostProcess Method') // TODO: what message and error code? - } - utils.log("DEBUG","=========== End POSTProcess SDNCAdapter ===========", isDebugEnabled) - } - - public void callbackResponsecheck(DelegateExecution execution){ - - def sdnccallbackreq=execution.getVariable("sdncAdapterCallbackRequest") - utils.logAudit("sdncAdapterCallbackRequest :" + sdnccallbackreq) - if (sdnccallbackreq==null){ - execution.setVariable("callbackResponseReceived",false); - }else{ - execution.setVariable("callbackResponseReceived",true); - } - } - - public void resetCallbackRequest(DelegateExecution execution) { - - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - utils.log("DEBUG","=========== Begin Reset Callback Info SDNCAdapter ===========", isDebugEnabled) - - // Clear sdncAdapterCallbackRequest variable - execution.removeVariable("sdncAdapterCallbackRequest") - - // Determine and set SDNC Timeout Value - def enhancedCallbackRequestData = execution.getVariable("enhancedCallbackRequestData") - utils.logAudit("sdncAdapter - enhancedCallbackRequestData :" + enhancedCallbackRequestData) - def interim = false - if (enhancedCallbackRequestData != null) { - if (utils.nodeExists(enhancedCallbackRequestData, "ack-final-indicator")) { - if (utils.getNodeText(enhancedCallbackRequestData, "ack-final-indicator") == 'N') { - interim = true - } - } - } - def timeoutValue = execution.getVariable("URN_mso_sdnc_timeout") - def sdncAdapterWorkflowRequest = execution.getVariable("sdncAdapterWorkflowRequest") - if (interim && utils.nodeExists(sdncAdapterWorkflowRequest, "InterimSDNCTimeOutValueInHours")) { - timeoutValue = "PT" + utils.getNodeText(sdncAdapterWorkflowRequest, "InterimSDNCTimeOutValueInHours") + "H" - } else if (utils.nodeExists(sdncAdapterWorkflowRequest, "SDNCTimeOutValueInMinutes")) { - timeoutValue = "PT" + utils.getNodeText(sdncAdapterWorkflowRequest, "SDNCTimeOutValueInMinutes") + "M" - } - execution.setVariable("sdncTimeoutValue", timeoutValue) - utils.log("DEBUG", "Setting SDNC Timeout Value to " + timeoutValue, isDebugEnabled) - - utils.log("DEBUG","=========== End Reset Callback Info SDNCAdapter ===========", isDebugEnabled) - } - - - public void prepareDBMessage(DelegateExecution execution) { - - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - utils.log("DEBUG","=========== Begin Prepare DB Message SDNCAdapter ===========", isDebugEnabled) - - // Create DB Message - def dbRequestId = execution.getVariable("mso-request-id") - String dbUpdateInterimStageCompletion = """ - - - - ${dbRequestId} - 1 - BPEL - - - - """ - - execution.setVariable("dbUpdateInterimStageCompletion", dbUpdateInterimStageCompletion) - utils.logAudit("sdncAdapter - dbUpdateInterimStageCompletion :" + dbUpdateInterimStageCompletion) - utils.log("DEBUG","DB UpdateInterimStageCompletion:\n" + dbUpdateInterimStageCompletion, isDebugEnabled) - utils.log("DEBUG","=========== End Prepare DB Message SDNCAdapter ===========", isDebugEnabled) - } - - public String generateCurrentTimeInUtc(){ - final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); - sdf.setTimeZone(TimeZone.getTimeZone("UTC")); - final String utcTime = sdf.format(new Date()); - return utcTime; - } - - public void toggleSuccessIndicator(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("SDNCA_SuccessIndicator", true) - utils.log("DEBUG","Setting SDNCA Success Indicator to True", isDebugEnabled) - } - - public void assignError(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG","=========== Started Assign Error ===========", isDebugEnabled) - WorkflowException wf = execution.getVariable("WorkflowException") - if(wf == null){ - exceptionUtil.buildWorkflowException(execution, 5000, "SDNCAdapter Encountered an Internal Error") // TODO: Not sure what message and error code we want here..... - }else{ - execution.setVariable("WorkflowException", wf) - } - - utils.log("DEBUG","Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugEnabled) - utils.log("DEBUG","=========== End Assign Error ===========", isDebugEnabled) - } - - public void setTimeout(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG","=========== Started SetTimeout ===========", isDebugEnabled) - utils.log("DEBUG", "Timer expired, telling correlation service to stop listening", isDebugEnabled) - execution.setVariable("asynchronousResponseTimeout", true) - - utils.log("DEBUG", "Timed out branch sleeping for one second to give success branch a chance to complete if running", isDebugEnabled) - Thread.sleep(1000) - utils.log("DEBUG","=========== End SetTimeout ===========", isDebugEnabled) - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV1.groovy deleted file mode 100644 index 41fcb6d08d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV1.groovy +++ /dev/null @@ -1,343 +0,0 @@ -package org.openecomp.mso.bpmn.common.scripts - -import java.text.SimpleDateFormat -import java.net.URLEncoder - -import org.apache.commons.codec.binary.Base64 -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution - -import groovy.json.* - -import org.json.JSONObject - -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - - -class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - /** - * Processes the incoming request. - */ - public void preProcessRequest (DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - def prefix="SDNCREST_" - execution.setVariable("prefix", prefix) - setSuccessIndicator(execution, false) - - try { - // Determine the request type and log the request - - String request = validateRequest(execution, "mso-request-id") - String requestType = jsonUtil.getJsonRootProperty(request) - execution.setVariable(prefix + 'requestType', requestType) - logDebug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType, isDebugLogEnabled) - utils.logAudit('SDNCAdapterRestV1, request: ' + request) - - // Determine the SDNCAdapter endpoint - - String sdncAdapterEndpoint = execution.getVariable("URN_mso_adapters_sdnc_rest_endpoint") - - if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) { - String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined' - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - while (sdncAdapterEndpoint.endsWith('/')) { - sdncAdapterEndpoint = sdncAdapterEndpoint.substring(0, sdncAdapterEndpoint.length()-1) - } - - String sdncAdapterMethod = null - String sdncAdapterUrl = null - String sdncAdapterRequest = request - - if ('SDNCServiceRequest'.equals(requestType)) { - // Get the sdncRequestId from the request - - String sdncRequestId = jsonUtil.getJsonValue(request, requestType + ".sdncRequestId") - - if (sdncRequestId == null || sdncRequestId.isEmpty()) { - String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - execution.setVariable('SDNCAResponse_CORRELATOR', sdncRequestId) - logDebug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId, isDebugLogEnabled) - - // Get the bpNotificationUrl from the request (just to make sure it's there) - - String bpNotificationUrl = jsonUtil.getJsonValue(request, requestType + ".bpNotificationUrl") - - if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) { - String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - sdncAdapterMethod = 'POST' - sdncAdapterUrl = sdncAdapterEndpoint + '/services' - - } else { - String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - execution.setVariable(prefix + 'sdncAdapterMethod', sdncAdapterMethod) - logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterMethod = ' + sdncAdapterMethod, isDebugLogEnabled) - execution.setVariable(prefix + 'sdncAdapterUrl', sdncAdapterUrl) - logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterUrl = ' + sdncAdapterUrl, isDebugLogEnabled) - execution.setVariable(prefix + 'sdncAdapterRequest', sdncAdapterRequest) - logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterRequest = \n' + sdncAdapterRequest, isDebugLogEnabled) - - // Get the Basic Auth credentials for the SDNCAdapter (yes... we ARE using the PO adapters credentials) - - String basicAuthValue = execution.getVariable("URN_mso_adapters_po_auth") - - if (basicAuthValue == null || basicAuthValue.isEmpty()) { - logDebug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", isDebugLogEnabled) - logError(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") - } else { - logDebug(getProcessKey(execution) + ": Obtained BasicAuth credentials for SDNCAdapter:" + - basicAuthValue, isDebugLogEnabled) - try { - def encodedString = utils.getBasicAuth(basicAuthValue, execution.getVariable("URN_mso_msoKey")) - execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) - } catch (IOException ex) { - logDebug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", isDebugLogEnabled) - logError(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") - } - } - - // Set the timeout value, e.g. PT5M. It may be specified in the request as the - // bpTimeout value. If it's not in the request, use the URN mapping value. - - String timeout = jsonUtil.getJsonValue(request, requestType + ".bpTimeout") - - if (timeout == null || timeout.isEmpty()) { - timeout = execution.getVariable("URN_mso_sdnc_timeout") - } - - execution.setVariable(prefix + 'timeout', timeout) - logDebug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout, isDebugLogEnabled) - } catch (BpmnError e) { - throw e - } catch (Exception e) { - String msg = 'Caught exception in ' + method + ": " + e - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - } - - /** - * Sends the request to the SDNC adapter. - */ - public void sendRequestToSDNCAdapter(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sendRequestToSDNCAdapter(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String prefix = execution.getVariable('prefix') - - try { - String sdncAdapterMethod = execution.getVariable(prefix + 'sdncAdapterMethod') - String sdncAdapterUrl = execution.getVariable(prefix + 'sdncAdapterUrl') - String sdncAdapterRequest = execution.getVariable(prefix + 'sdncAdapterRequest') - utils.logAudit("Outgoing SDNC Rest Request is: " + sdncAdapterRequest) - - RESTConfig config = new RESTConfig(sdncAdapterUrl) - RESTClient client = new RESTClient(config). - addHeader("Content-Type", "application/json"). - addAuthorizationHeader(execution.getVariable(prefix + "basicAuthHeaderValue")) - - APIResponse response - - if ("GET".equals(sdncAdapterMethod)) { - response = client.httpGet() - } else if ("PUT".equals(sdncAdapterMethod)) { - response = client.httpPut(sdncAdapterRequest) - } else if ("POST".equals(sdncAdapterMethod)) { - response = client.httpPost(sdncAdapterRequest) - } else if ("DELETE".equals(sdncAdapterMethod)) { - response = client.httpDelete(sdncAdapterRequest) - } else { - String msg = 'Unsupported HTTP method "' + sdncAdapterMethod + '" in ' + method + ": " + e - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - execution.setVariable(prefix + "sdncAdapterStatusCode", response.getStatusCode()) - execution.setVariable(prefix + "sdncAdapterResponse", response.getResponseBodyAsString()) - } catch (BpmnError e) { - throw e - } catch (Exception e) { - String msg = 'Caught exception in ' + method + ": " + e - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - } - - /** - * Processes a callback. - */ - public void processCallback(DelegateExecution execution){ - def method = getClass().getSimpleName() + '.processCallback(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String prefix = execution.getVariable('prefix') - String callback = execution.getVariable('SDNCAResponse_MESSAGE') - utils.logAudit("Incoming SDNC Rest Callback is: " + callback) - - try { - logDebug(getProcessKey(execution) + ": received callback:\n" + callback, isDebugLogEnabled) - - int callbackNumber = 1 - while (execution.getVariable(prefix + 'callback' + callbackNumber) != null) { - ++callbackNumber - } - - execution.setVariable(prefix + 'callback' + callbackNumber, callback) - execution.removeVariable('SDNCAResponse_MESSAGE') - - String responseType = jsonUtil.getJsonRootProperty(callback) - - // Get the ackFinalIndicator and make sure it's either Y or N. Default to Y. - String ackFinalIndicator = jsonUtil.getJsonValue(callback, responseType + ".ackFinalIndicator") - - if (!'N'.equals(ackFinalIndicator)) { - ackFinalIndicator = 'Y' - } - - execution.setVariable(prefix + "ackFinalIndicator", ackFinalIndicator) - - if (responseType.endsWith('Error')) { - sdncAdapterBuildWorkflowException(execution, callback) - } - } catch (Exception e) { - callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback - String msg = "Received error from SDNCAdapter: " + callback - logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled) - exceptionUtil.buildWorkflowException(execution, 5300, msg) - } - } - - /** - * Tries to parse the response as XML to extract the information to create - * a WorkflowException. If the response cannot be parsed, a more generic - * WorkflowException is created. - */ - public void sdncAdapterBuildWorkflowException(DelegateExecution execution, String response) { - try { - String responseType = jsonUtil.getJsonRootProperty(response) - String responseCode = jsonUtil.getJsonValue(response, responseType + ".responseCode") - String responseMessage = jsonUtil.getJsonValue(response, responseType + ".responseMessage") - - String info = "" - - if (responseCode != null && !responseCode.isEmpty()) { - info += " responseCode='" + responseCode + "'" - } - - if (responseMessage != null && !responseMessage.isEmpty()) { - info += " responseMessage='" + responseMessage + "'" - } - - // Note: the mapping function handles a null or empty responseCode - int mappedResponseCode = Integer.parseInt(exceptionUtil.MapSDNCResponseCodeToErrorCode(responseCode)); - exceptionUtil.buildWorkflowException(execution, mappedResponseCode, "Received " + responseType + - " from SDNCAdapter:" + info) - } catch (Exception e) { - response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response - exceptionUtil.buildWorkflowException(execution, 5300, "Received error from SDNCAdapter: " + response) - } - } - - /** - * Gets the last callback request from the execution, or null if there was no callback. - */ - public String getLastCallback(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.getLastCallback(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String prefix = execution.getVariable('prefix') - - try { - int callbackNumber = 1 - String callback = null - - while (true) { - String thisCallback = (String) execution.getVariable(prefix + 'callback' + callbackNumber) - - if (thisCallback == null) { - break - } - - callback = thisCallback - ++callbackNumber - } - - return callback - } catch (Exception e) { - String msg = 'Caught exception in ' + method + ": " + e - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - } - - /** - * Sets the timeout value to wait for the next notification. - */ - public void setTimeoutValue(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.setTimeoutValue(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String prefix = execution.getVariable('prefix') - - try { - def timeoutValue = execution.getVariable("URN_mso_sdnc_timeout") - - if (execution.getVariable(prefix + 'callback1') != null) { - // Waiting for subsequent notifications - } - } catch (Exception e) { - String msg = 'Caught exception in ' + method + ": " + e - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV2.groovy deleted file mode 100644 index f4a7f055bd..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV2.groovy +++ /dev/null @@ -1,254 +0,0 @@ -package org.openecomp.mso.bpmn.common.scripts - -import java.text.SimpleDateFormat -import java.net.URLEncoder - -import org.apache.commons.codec.binary.Base64 -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution - -import groovy.json.* - -import org.json.JSONObject - -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -/** - * This version of SDNCAdapterRest allows for interim notifications to be sent for - * any non-final response received from SDNC. - */ -class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - /** - * Processes the incoming request. - */ - public void preProcessRequest (DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - def prefix="SDNCREST_" - execution.setVariable("prefix", prefix) - setSuccessIndicator(execution, false) - - try { - // Determine the request type and log the request - - String request = validateRequest(execution, "mso-request-id") - String requestType = jsonUtil.getJsonRootProperty(request) - execution.setVariable(prefix + 'requestType', requestType) - logDebug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType, isDebugLogEnabled) - utils.logAudit('SDNCAdapterRestV2, request: ' + request) - - // Determine the SDNCAdapter endpoint - - String sdncAdapterEndpoint = execution.getVariable("URN_mso_adapters_sdnc_rest_endpoint") - - if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) { - String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined' - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - while (sdncAdapterEndpoint.endsWith('/')) { - sdncAdapterEndpoint = sdncAdapterEndpoint.substring(0, sdncAdapterEndpoint.length()-1) - } - - String sdncAdapterMethod = null - String sdncAdapterUrl = null - String sdncAdapterRequest = request - - if ('SDNCServiceRequest'.equals(requestType)) { - // Get the sdncRequestId from the request - - String sdncRequestId = jsonUtil.getJsonValue(request, requestType + ".sdncRequestId") - - if (sdncRequestId == null || sdncRequestId.isEmpty()) { - String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - execution.setVariable('SDNCAResponse_CORRELATOR', sdncRequestId) - logDebug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId, isDebugLogEnabled) - - // Get the bpNotificationUrl from the request (just to make sure it's there) - - String bpNotificationUrl = jsonUtil.getJsonValue(request, requestType + ".bpNotificationUrl") - - if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) { - String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - sdncAdapterMethod = 'POST' - sdncAdapterUrl = sdncAdapterEndpoint + '/services' - - } else { - String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - execution.setVariable(prefix + 'sdncAdapterMethod', sdncAdapterMethod) - logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterMethod = ' + sdncAdapterMethod, isDebugLogEnabled) - execution.setVariable(prefix + 'sdncAdapterUrl', sdncAdapterUrl) - logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterUrl = ' + sdncAdapterUrl, isDebugLogEnabled) - execution.setVariable(prefix + 'sdncAdapterRequest', sdncAdapterRequest) - logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterRequest = \n' + sdncAdapterRequest, isDebugLogEnabled) - - // Get the Basic Auth credentials for the SDNCAdapter (yes... we ARE using the PO adapters credentials) - - String basicAuthValue = execution.getVariable("URN_mso_adapters_po_auth") - - if (basicAuthValue == null || basicAuthValue.isEmpty()) { - logDebug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", isDebugLogEnabled) - logError(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") - } else { - logDebug(getProcessKey(execution) + ": Obtained BasicAuth credentials for SDNCAdapter:" + - basicAuthValue, isDebugLogEnabled) - try { - def encodedString = utils.getBasicAuth(basicAuthValue, execution.getVariable("URN_mso_msoKey")) - execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) - } catch (IOException ex) { - logDebug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", isDebugLogEnabled) - logError(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") - } - } - - // Set the timeout value, e.g. PT5M. It may be specified in the request as the - // bpTimeout value. If it's not in the request, use the URN mapping value. - - String timeout = jsonUtil.getJsonValue(request, requestType + ".bpTimeout") - - if (timeout == null || timeout.isEmpty()) { - timeout = execution.getVariable("URN_mso_sdnc_timeout") - } - - execution.setVariable(prefix + 'timeout', timeout) - logDebug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout, isDebugLogEnabled) - } catch (BpmnError e) { - throw e - } catch (Exception e) { - String msg = 'Caught exception in ' + method + ": " + e - logDebug(msg, isDebugLogEnabled) - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - } - - /** - * Processes a callback. Check for possible interim notification. - */ - public void processCallback(DelegateExecution execution){ - def method = getClass().getSimpleName() + '.processCallback(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String prefix = execution.getVariable('prefix') - String callback = execution.getVariable('SDNCAResponse_MESSAGE') - utils.logAudit("Incoming SDNC Rest Callback is: " + callback) - - try { - logDebug(getProcessKey(execution) + ": received callback:\n" + callback, isDebugLogEnabled) - - int callbackNumber = 1 - while (execution.getVariable(prefix + 'callback' + callbackNumber) != null) { - ++callbackNumber - } - - execution.setVariable(prefix + 'callback' + callbackNumber, callback) - execution.removeVariable('SDNCAResponse_MESSAGE') - - String responseType = jsonUtil.getJsonRootProperty(callback) - - // Get the ackFinalIndicator and make sure it's either Y or N. Default to Y. - String ackFinalIndicator = jsonUtil.getJsonValue(callback, responseType + ".ackFinalIndicator") - - if (!'N'.equals(ackFinalIndicator)) { - ackFinalIndicator = 'Y' - } - - execution.setVariable(prefix + "ackFinalIndicator", ackFinalIndicator) - - if (responseType.endsWith('Error')) { - sdncAdapterBuildWorkflowException(execution, callback) - } - - // Check for possible interim notification - execution.setVariable(prefix + "interimNotification", null) - execution.setVariable(prefix + "doInterimNotification", false) - if ('N'.equals(ackFinalIndicator)) { - def interimNotification = execution.getVariable(prefix + "InterimNotification" + callbackNumber) - if (interimNotification != null) { - execution.setVariable(prefix + "interimNotification", interimNotification) - execution.setVariable(prefix + "doInterimNotification", true) - } - } - - } catch (Exception e) { - callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback - String msg = "Received error from SDNCAdapter: " + callback - logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled) - exceptionUtil.buildWorkflowException(execution, 5300, msg) - } - } - - /** - * Prepare to send an interim notification by extracting the variable/value definitions - * in the interimNotification JSON object and placing them in the execution. These - * variable/value definitions will be passed to the notification service. - */ - public void prepareInterimNotification(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepareInterimNotification(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String prefix = execution.getVariable('prefix') - utils.logAudit("Preparing Interim Notification") - - try { - def interimNotification = execution.getVariable(prefix + "interimNotification") - logDebug("Preparing Interim Notification:\n" + JsonUtils.prettyJson(interimNotification), isDebugLogEnabled) - - for (int i = 0; ; i++) { - def variable = JsonUtils.getJsonParamValue(interimNotification, 'variableList', 'variable', i) - - if (variable == null) { - break - } - - def String variableName = JsonUtils.getJsonValue(variable, "name") - if ((variableName != null) && !variableName.isEmpty()) { - def variableValue = JsonUtils.getJsonValue(variable, "value") - execution.setVariable(variableName, variableValue) - logDebug("Setting "+ variableName + "=" + variableValue, isDebugLogEnabled) - } - } - - } catch (Exception e) { - String msg = "Error preparing interim notification" - logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled) - exceptionUtil.buildWorkflowException(execution, 5300, msg) - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy deleted file mode 100644 index 7aa7b200f3..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy +++ /dev/null @@ -1,1043 +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.bpmn.common.scripts; - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution - -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.springframework.web.util.UriUtils - - -/** - * @version 1.0 - * - */ -class SDNCAdapterUtils { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - private AbstractServiceTaskProcessor taskProcessor - - public SDNCAdapterUtils(AbstractServiceTaskProcessor taskProcessor) { - this.taskProcessor = taskProcessor - } - - String SDNCAdapterFeatureRequest(DelegateExecution execution, String requestName, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) { - - def utils=new MsoUtils() - - def prefix = execution.getVariable('prefix') - def request = taskProcessor.getVariable(execution, requestName) - def requestInformation = utils.getNodeXml(request, 'request-information', false) - def serviceInformation = utils.getNodeXml(request, 'service-information', false) - def featureInformation = utils.getNodeXml(request, 'feature-information', false) - def featureParameters = utils.getNodeXml(request, 'feature-parameters', false) - - def requestId = execution.getVariable('testReqId') // for junits - if(requestId==null){ - requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() - } - - def svcInstanceId = execution.getVariable("mso-service-instance-id") - - def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) - def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation) - def nnsFeatureInformation = utils.removeXmlNamespaces(featureInformation) - def nnsFeatureParameters = utils.removeXmlNamespaces(featureParameters) - - String sdncAdapterFeatureRequest = """ - - - ${requestId} - ${svcInstanceId} - ${action} - ${serviceOperation} - ${callbackURL} - - - ${nnsRequestInformation} - ${nnsServiceInformation} - ${nnsFeatureInformation} - ${nnsFeatureParameters} - - ${timeoutValueInMinutes} - - """ - sdncAdapterFeatureRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterFeatureRequest)) - return sdncAdapterFeatureRequest - } - - String SDNCAdapterActivateVnfRequest(DelegateExecution execution, String action, String callbackURL, String serviceOperation, String msoAction, String timeoutValueInMinutes) { - - def utils=new MsoUtils() - - def prefix = execution.getVariable('prefix') - def request = taskProcessor.getVariable(execution, prefix+'Request') - def requestInformation = utils.getNodeXml(request, 'request-information', false) - def serviceInformation = utils.getNodeXml(request, 'service-information', false) - def vnfInformationList = utils.getNodeXml(request, 'vnf-information-list', false) - - def requestId = execution.getVariable('testReqId') // for junits - if(requestId==null){ - requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() - } - - def svcInstanceId = execution.getVariable("mso-service-instance-id") - - def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) - def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation) - def nnsVnfInformationList = utils.removeXmlNamespaces(vnfInformationList) - - String sdncAdapterActivateVnfRequest = """ - - - ${requestId} - ${svcInstanceId} - ${action} - ${serviceOperation} - ${callbackURL} - ${msoAction} - - - ${nnsRequestInformation} - ${nnsServiceInformation} - ${nnsVnfInformationList} - - ${timeoutValueInMinutes} - - """ - sdncAdapterActivateVnfRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterActivateVnfRequest)) - return sdncAdapterActivateVnfRequest - } - - String SDNCAdapterL3ToHigherLayerRequest(DelegateExecution execution, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) { - - def utils=new MsoUtils() - - def prefix = execution.getVariable('prefix') - def request = taskProcessor.getVariable(execution, prefix+'Request') - - def requestInformation = """ - ${execution.getVariable("mso-request-id")} - torepl - ${execution.getVariable(prefix+"source")} - ${execution.getVariable(prefix+"notificationUrl")} - """ - - // Change the value of the 'request-information'.'request-action' element - def xml = new XmlSlurper().parseText(requestInformation) - if("assign".equalsIgnoreCase(action)){ - xml.'request-action'.replaceBody('createTrinityBonding') - }else if("activate".equalsIgnoreCase(action)){ - xml.'request-action'.replaceBody('activateTrinityBonding') - }else if("delete".equalsIgnoreCase(action)){ - xml.'request-action'.replaceBody('deleteTrinityBonding') - } - requestInformation = utils.removeXmlPreamble(groovy.xml.XmlUtil.serialize(xml)) - def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) - - def requestId = execution.getVariable('testReqId') // for junits - if(requestId==null){ - requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() - } - - def svcInstanceId = execution.getVariable("mso-service-instance-id") - - //Build Service Information - // Send serviceName from CANOPI to sdnc for service-type - def serviceInformation = """ - ${execution.getVariable(prefix+"serviceName")} - ${svcInstanceId} - ${execution.getVariable(prefix+"subscriberName")} - ${execution.getVariable(prefix+"subscriberGlobalId")} - """ - - //Build Additional Information - vpn or vni - // Send serviceType from CANOPI to SDNC for nbnc-request-information service-type - def service = execution.getVariable(prefix+"serviceType") - def customerId = execution.getVariable(prefix+"customerId") - def vpnId = execution.getVariable(prefix+"vpnId") - def vpnRt = execution.getVariable(prefix+"vpnRt") - def vpnService = execution.getVariable(prefix+"vpnService") - def vpnRegion = execution.getVariable(prefix+"vpnRegion") - def additionalInfo = "" - if("assign".equalsIgnoreCase(action)){ - additionalInfo = """ - ${vpnId} - ${vpnRt} - ${vpnService} - ${vpnRegion} - """ - }else if("activate".equalsIgnoreCase(action) || "delete".equalsIgnoreCase(action)){ - def vniId = execution.getVariable(prefix+'vniId') - additionalInfo = "${vniId}" - } - - //Set Interface Status - def interfaceStatus = "DISABLE" - if("activate".equalsIgnoreCase(action)){ - interfaceStatus = "ENABLE" - } - - //Build SDNC Adapter Request - String sdncAdapterL3ToHLRequest = """ - - - ${requestId} - ${svcInstanceId} - ${action} - ${serviceOperation} - ${callbackURL} - - - ${nnsRequestInformation} - ${serviceInformation} - - ${service} - ${customerId} - ${interfaceStatus} - ${additionalInfo} - - - ${timeoutValueInMinutes} - - """ - sdncAdapterL3ToHLRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterL3ToHLRequest)) - - return sdncAdapterL3ToHLRequest - } - - - - private void SDNCAdapterActivateRequest(DelegateExecution execution, String resultVar, String svcAction, - - String svcOperation, String additionalData) { - def utils=new MsoUtils() - - def prefix = execution.getVariable('prefix') - def request = taskProcessor.getVariable(execution, prefix+'Request') - def requestInformation = utils.getNodeXml(request, 'request-information', false) - def serviceInformation = utils.getNodeXml(request, 'service-information', false) - def serviceParameters = utils.getNodeXml(request, 'service-parameters', false) - - def requestId = execution.getVariable('testReqId') // for junits - if(requestId==null){ - requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() - } - - def svcInstanceId = execution.getVariable("mso-service-instance-id") - def msoAction = 'gammainternet' - - def timeoutInMinutes = execution.getVariable('URN_mso_sdnc_timeout_firewall_minutes') - - def callbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (callbackUrl == null || callbackUrl.trim() == "") { - logError('mso:workflow:sdncadapter:callback URN is not set') - workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code? - } - - def l2HomingInformation = utils.getNodeXml(serviceParameters, 'l2-homing-information', false) - def internetEvcAccessInformation = utils.getNodeXml(serviceParameters, 'internet-evc-access-information', false) - def vrLan = utils.getNodeXml(serviceParameters, 'vr-lan', false) - def upceVmsServiceInformation = utils.getNodeXml(serviceParameters, 'ucpe-vms-service-information', false) - - - def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) - def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation) - def nnsl2HomingInformation = utils.removeXmlNamespaces(l2HomingInformation) - def nnsInternetEvcAccessInformation = utils.removeXmlNamespaces(internetEvcAccessInformation) - def nnsVrLan = utils.removeXmlNamespaces(vrLan) - def nnsUpceVmsServiceInformation = utils.removeXmlNamespaces(upceVmsServiceInformation) - - if (additionalData == null) { - additionalData = "" - } - - boolean isAic3 = execution.getVariable("isAic3") - - if(isAic3) { - nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC3.0") - } - else { - nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC2.X") - } - - String content = """ - - - ${requestId} - ${svcInstanceId} - ${svcAction} - ${svcOperation} - ${callbackUrl} - ${msoAction} - - - ${additionalData} - ${nnsRequestInformation} - ${nnsServiceInformation} - ${nnsl2HomingInformation} - ${nnsInternetEvcAccessInformation} - ${nnsVrLan} - ${nnsUpceVmsServiceInformation} - - ${timeoutInMinutes} - - """ - - content = utils.removeXmlPreamble(utils.formatXML(content)) - execution.setVariable(resultVar, content) - } - - /** - * Builds an SDNC "reserve" request and stores it in the specified execution - * variable. - * @param execution the execution - * @param action the type of action: reserve, turnup, etc - * @param resultVar the execution variable in which the result will be stored - */ - public void sdncReservePrep(DelegateExecution execution, String action, String resultVar) { - sdncReservePrep(execution, action, resultVar, false) - } - - /** - * Builds an SDNC "reserve" request and stores it in the specified execution - * variable. - * @param execution the execution - * @param action the type of action: reserve, turnup, etc - * @param resultVar the execution variable in which the result will be stored - * @param isAic3 boolean to indicate whether request is for AIC3.0 - */ - public void sdncReservePrep(DelegateExecution execution, String action, String resultVar, boolean isAic3) { - - sdncPrep(execution, resultVar, action , 'service-configuration-operation', null, isAic3, this.taskProcessor) - } - - /** - * Builds a basic SDNC request and stores it in the specified execution variable. - * @param execution the execution - * @param resultVar the execution variable in which the result will be stored - * @param svcAction the svcAction element value - * @param svcOperation the svcOperation element value - * @param additionalData additional XML content to be inserted into the - * RequestData element (may be null) - */ - public void sdncPrep(DelegateExecution execution, String resultVar, String svcAction, - String svcOperation, String additionalData, AbstractServiceTaskProcessor taskProcessor) { - sdncPrep(execution, resultVar, svcAction, svcOperation, additionalData, false, taskProcessor) - } - - /** - * Builds a basic SDNC request and stores it in the specified execution variable. - * @param execution the execution - * @param resultVar the execution variable in which the result will be stored - * @param svcAction the svcAction element value - * @param svcOperation the svcOperation element value - * @param additionalData additional XML content to be inserted into the RequestData element (may be null) - * @param isAic3 boolean to indicate whether request is for AIC3.0 - */ - public void sdncPrep(DelegateExecution execution, String resultVar, String svcAction, - - String svcOperation, String additionalData, boolean isAic3, AbstractServiceTaskProcessor taskProcessor) { - def method = getClass().getSimpleName() + '.sdncPrep(' + - 'execution=' + execution.getId() + - ', resultVar=' + resultVar + - ', svcAction=' + svcAction + - ', svcOperation=' + svcOperation + - ', additionalData=' + (additionalData == null ? "no" : "yes") + - ')' - - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - MsoUtils utils = taskProcessor.utils - try { - def prefix = execution.getVariable('prefix') - def request = taskProcessor.getVariable(execution, prefix+'Request') - def requestInformation = utils.getNodeXml(request, 'request-information', false) - def serviceInformation = utils.getNodeXml(request, 'service-information', false) - def serviceParameters = utils.getChildNodes(request, 'service-parameters') - def requestAction = utils.getNodeText1(request, 'request-action') - - def timeoutInMinutes = execution.getVariable('URN_mso_sdnc_timeout_firewall_minutes') - - def requestId = execution.getVariable('testReqId') // for junits - if(requestId==null){ - requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() - } - - def svcInstanceId = execution.getVariable("mso-service-instance-id") - def msoAction = 'gammainternet' - - def callbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (callbackUrl == null || callbackUrl.trim() == "") { - taskProcessor.logError('mso:workflow:sdncadapter:callback URN is not set') - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request") - } - - def l2HomingInformation = utils.getNodeXml(request, 'l2-homing-information', false) - def internetEvcAccessInformation = utils.getNodeXml(request, 'internet-evc-access-information', false) - def vrLan = utils.getNodeXml(request, 'vr-lan', false) - def upceVmsServiceInfo = utils.getNodeXml(request, 'ucpe-vms-service-information', false) - def vnfInformationList = utils.getNodeXml(request, 'vnf-information-list', false) - - def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) - def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation) - def nnsl2HomingInformation = utils.removeXmlNamespaces(l2HomingInformation) - def nnsInternetEvcAccessInformation = utils.removeXmlNamespaces(internetEvcAccessInformation) - def nnsVrLan = utils.removeXmlNamespaces(vrLan) - def nnsUpceVmsServiceInfo = utils.removeXmlNamespaces(upceVmsServiceInfo) - def nnsVnfInformationList = utils.removeXmlNamespaces(vrLan) - def nnsinternetSvcChangeDetails = "" - - if(requestAction!=null && requestAction.equals("ChangeLayer3ServiceProvRequest")){ - def internetSvcChangeDetails = utils.removeXmlNamespaces(serviceParameters) - nnsinternetSvcChangeDetails = """ - ${internetSvcChangeDetails} - """ - } - - if (additionalData == null) { - additionalData = "" - } - - if(isAic3) { - nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC3.0") - } - else { - nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC2.X") - } - - - String content = """ - - - ${requestId} - ${svcInstanceId} - ${svcAction} - ${svcOperation} - ${callbackUrl} - ${msoAction} - - - ${additionalData} - ${nnsRequestInformation} - ${nnsServiceInformation} - ${nnsl2HomingInformation} - ${nnsInternetEvcAccessInformation} - ${nnsVrLan} - ${nnsUpceVmsServiceInfo} - ${nnsVnfInformationList} - ${nnsinternetSvcChangeDetails} - - - """ - - content = utils.removeXmlPreamble(utils.formatXML(content)) - execution.setVariable(resultVar, content) - taskProcessor.logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - taskProcessor.logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error") - } - } - - public String updateHomingInfo(String homingInfo, String aicVersion) { - String newHomingInfo - if(homingInfo == null || homingInfo.trim().length() == 0) { - newHomingInfo = "" + aicVersion + "" - } - else { - newHomingInfo = homingInfo.substring(0, homingInfo.indexOf("")) + "" + aicVersion + "" - } - } - - /** - * Builds a topology SDNC request and return String request. - * As V2 will use 1607-style request, region instead of aic clli code - * @param execution, the execution - * @param requestXML, the incoming request for the flow - * @param serviceInstanceId, the serviceIntance (if available) - * @param callbackUrl, the call back url - * @param action, the action element value - * @param requestAction the svcOperation element value - * @param cloudRegionId the aai's cloud-region-id - * @param networkId the aai's network-id - * @param additionalData additional XML content to be inserted into the - * RequestData element (may be null) - */ - public String sdncTopologyRequestV2 (DelegateExecution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String queryAAIResponse, String additionalData) { - - def utils=new MsoUtils() - - // SNDC is expecting request Id for header as unique each call. - String hdrRequestId = "" - String testHdrRequestId = execution.getVariable("testMessageId") // for test purposes. - if (testHdrRequestId == null) { - hdrRequestId = UUID.randomUUID() // generate unique - } else { - hdrRequestId = testHdrRequestId - } - - String requestId = "" - try { - requestId = execution.getVariable("mso-request-id") - } catch (Exception ex) { - requestId = utils.getNodeText1(requestXML, "request-id") - } - - String aicCloudRegion = cloudRegionId - String tenantId = "" - if (utils.nodeExists(requestXML, "tenant-id")) { - tenantId = utils.getNodeText1(requestXML, "tenant-id") - } - String networkType = "" - if (utils.nodeExists(requestXML, "network-type")) { - networkType = utils.getNodeText1(requestXML, "network-type") - } - - // Replace/Use the value of network-type from aai query (vs input) during Delete Network flows. - if (queryAAIResponse != null) { - networkType = utils.getNodeText1(queryAAIResponse, "network-type") - } - - String serviceId = "" - if (utils.nodeExists(requestXML, "service-id")) { - serviceId = utils.getNodeText1(requestXML, "service-id") - } - String networkName = "" - if (utils.nodeExists(requestXML, "network-name")) { - networkName = utils.getNodeText1(requestXML, "network-name") - } - String source = "" - if (utils.nodeExists(requestXML, "source")) { - source = utils.getNodeText1(requestXML, "source") - } - - // get resourceLink from subflow execution variable - String serviceType = "" - String subscriberName = "" - String siRelatedLink = execution.getVariable("GENGSI_siResourceLink") - if (siRelatedLink != null) { - // get service type - int serviceStart = siRelatedLink.indexOf("service-subscription/") - int serviceEnd = siRelatedLink.indexOf("/service-instances/") - serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd) - serviceType = UriUtils.decode(serviceType,"UTF-8") - // get subscriber name - int subscriberNameStart = siRelatedLink.indexOf("customers/customer/") - int subscriberNameEnd = siRelatedLink.indexOf("/service-subscriptions/") - subscriberName = siRelatedLink.substring(subscriberNameStart + 19, subscriberNameEnd) - subscriberName = UriUtils.decode(subscriberName,"UTF-8") - } - - String content = - """ - - ${hdrRequestId} - ${serviceInstanceId} - ${action} - network-topology-operation - sdncCallback - - - - ${requestId} - ${requestAction} - ${source} - - - - - - ${serviceId} - ${serviceType} - ${serviceInstanceId} - ${subscriberName} - - - ${networkId} - ${networkType} - ${networkName} - ${tenantId} - ${aicCloudRegion} - - - """.trim() - - return content - } - - /** - * Builds a topology SDNC request and return String request. - * As V2 will use 1607-style request, region instead of aic clli code - * @param execution, the execution - * @param requestXML, the incoming request for the flow - * @param serviceInstanceId, the serviceIntance (if available) - * @param callbackUrl, the call back url - * @param action, the action element value - * @param requestAction the svcOperation element value - * @param cloudRegionId the aai's cloud-region-id - * @param networkId the aai's network-id - * @param additionalData additional XML content to be inserted into the - * RequestData element (may be null) - */ - public String sdncTopologyRequestRsrc (DelegateExecution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String additionalData) { - - def utils=new MsoUtils() - - // SNDC is expecting request Id for header as unique each call. - String hdrRequestId = "" - String testHdrRequestId = execution.getVariable("testMessageId") // for test purposes. - if (testHdrRequestId == null) { - hdrRequestId = UUID.randomUUID() // generate unique - } else { - hdrRequestId = testHdrRequestId - } - - String requestId = "" - String testRequestId = execution.getVariable("testMessageId") // for test purposes. - if (testRequestId == null) { - requestId = execution.getVariable("mso-request-id") - if (requestId == null) { - requestId = execution.getVariable("msoRequestId") - } - } else { - requestId = testRequestId - } - - String aicCloudRegion = cloudRegionId - String tenantId = "" - if (utils.nodeExists(requestXML, "tenant-id")) { - tenantId = utils.getNodeText1(requestXML, "tenant-id") - } - String networkType = "" - if (utils.nodeExists(requestXML, "network-type")) { - networkType = utils.getNodeText1(requestXML, "network-type") - } - - String subscriptionServiceType = "" - if (utils.nodeExists(requestXML, "subscription-service-type")) { - subscriptionServiceType = utils.getNodeText1(requestXML, "subscription-service-type") - } - - String globalCustomerId = "" - if (utils.nodeExists(requestXML, "global-customer-id")) { - globalCustomerId = utils.getNodeText1(requestXML, "global-customer-id") - } - - String serviceId = "" - if (utils.nodeExists(requestXML, "service-id")) { - serviceId = utils.getNodeText1(requestXML, "service-id") - } - String networkName = "" - if (utils.nodeExists(requestXML, "network-name")) { - networkName = utils.getNodeText1(requestXML, "network-name") - } - String source = "" - if (utils.nodeExists(requestXML, "source")) { - source = utils.getNodeText1(requestXML, "source") - } - - // get resourceLink from subflow execution variable - String serviceType = "" - String subscriberName = "" - String siRelatedLink = execution.getVariable("GENGSI_siResourceLink") - if (siRelatedLink != null) { - // get service type - int serviceStart = siRelatedLink.indexOf("service-subscription/") - int serviceEnd = siRelatedLink.indexOf("/service-instances/") - serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd) - serviceType = UriUtils.decode(serviceType,"UTF-8") - // get subscriber name - int subscriberNameStart = siRelatedLink.indexOf("customers/customer/") - int subscriberNameEnd = siRelatedLink.indexOf("/service-subscriptions/") - subscriberName = siRelatedLink.substring(subscriberNameStart + 19, subscriberNameEnd) - subscriberName = UriUtils.decode(subscriberName,"UTF-8") - } - - // network-information from 'networkModelInfo' // verify the DB Catalog response - String networkModelInfo = utils.getNodeXml(requestXML, "networkModelInfo", false).replace("tag0:","").replace(":tag0","") - String modelInvariantUuid = utils.getNodeText1(networkModelInfo, "modelInvariantUuid") !=null ? - utils.getNodeText1(networkModelInfo, "modelInvariantUuid") : "" - String modelCustomizationUuid = utils.getNodeText1(networkModelInfo, "modelCustomizationUuid") !=null ? - utils.getNodeText1(networkModelInfo, "modelCustomizationUuid") : "" - String modelUuid = utils.getNodeText1(networkModelInfo, "modelUuid") !=null ? - utils.getNodeText1(networkModelInfo, "modelUuid") : "" - String modelVersion = utils.getNodeText1(networkModelInfo, "modelVersion") !=null ? - utils.getNodeText1(networkModelInfo, "modelVersion") : "" - String modelName = utils.getNodeText1(networkModelInfo, "modelName") !=null ? - utils.getNodeText1(networkModelInfo, "modelName") : "" - - // service-information from 'networkModelInfo' // verify the DB Catalog response - String serviceModelInfo = utils.getNodeXml(requestXML, "serviceModelInfo", false).replace("tag0:","").replace(":tag0","") - String serviceModelInvariantUuid = utils.getNodeText1(serviceModelInfo, "modelInvariantUuid") !=null ? - utils.getNodeText1(serviceModelInfo, "modelInvariantUuid") : "" - String serviceModelUuid = utils.getNodeText1(serviceModelInfo, "modelUuid") !=null ? - utils.getNodeText1(serviceModelInfo, "modelUuid") : "" - String serviceModelVersion = utils.getNodeText1(serviceModelInfo, "modelVersion") !=null ? - utils.getNodeText1(serviceModelInfo, "modelVersion") : "" - String serviceModelName = utils.getNodeText1(serviceModelInfo, "modelName") !=null ? - utils.getNodeText1(serviceModelInfo, "modelName") : "" - - - String content = - """ - - ${hdrRequestId} - ${serviceInstanceId} - ${action} - network-topology-operation - sdncCallback - generic-resource - - - - ${requestId} - ${requestAction} - ${source} - - - - - - ${serviceId} - ${subscriptionServiceType} - - ${serviceModelInvariantUuid} - ${serviceModelUuid} - ${serviceModelVersion} - ${serviceModelName} - - ${serviceInstanceId} - ${globalCustomerId} - ${subscriberName} - - - ${networkId} - ${networkType} - - ${modelInvariantUuid} - ${modelCustomizationUuid} - ${modelUuid} - ${modelVersion} - ${modelName} - - - - ${networkName} - ${tenantId} - ${aicCloudRegion} - - - - - """.trim() - - return content - } - - /** - * Validates a workflow response. - * @param execution the execution - * @param responseVar the execution variable in which the response is stored - * @param workflowException the WorkflowException Object returned from sdnc call - */ - public void validateSDNCResponse(DelegateExecution execution, String response, WorkflowException workflowException, boolean successIndicator){ - - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.utils.log("DEBUG", "SDNC Response is: " + response, isDebugLogEnabled) - taskProcessor.utils.log("DEBUG", "SuccessIndicator is: " + successIndicator, isDebugLogEnabled) - - try { - def prefix = execution.getVariable('prefix') - execution.setVariable(prefix+'sdncResponseSuccess', false) - taskProcessor.utils.log("DEBUG", "Response" + ' = ' + (response == null ? "" : System.lineSeparator()) + response, isDebugLogEnabled) - - if (successIndicator){ - if (response == null || response.trim().equals("")) { - taskProcessor.utils.log("DEBUG", response + ' is empty'); - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "SDNCAdapter Workflow Response is Empty") - }else{ - - // we need to peer into the request data for error - def String sdncAdapterWorkflowResponse = taskProcessor.utils.getNodeXml(response, 'response-data', false) - def String decodedXml = decodeXML(sdncAdapterWorkflowResponse).replace('', "") - - // change '&' to "& (if present as data, ex: subscriber-name = 'FOUR SEASONS HEATING & COOLING_8310006378683' - decodedXml = decodedXml.replace("&", "&") - - taskProcessor.utils.log("DEBUG","decodedXml:\n" + decodedXml, isDebugLogEnabled) - - int requestDataResponseCode = 200 - def String requestDataResponseMessage = '' - - try{ - if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) { - requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message") - } else if (taskProcessor.utils.nodeExists(decodedXml, "ResponseMessage")) { - requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "ResponseMessage") - } - }catch(Exception e){ - taskProcessor.utils.log("DEBUG", 'Error caught while decoding resposne ' + e.getMessage(), isDebugLogEnabled) - } - - if(taskProcessor.utils.nodeExists(decodedXml, "response-code")) { - taskProcessor.utils.log("DEBUG","response-code node Exist ", isDebugLogEnabled) - String code = taskProcessor.utils.getNodeText1(decodedXml, "response-code") - if(code.isEmpty() || code.equals("")){ - // if response-code is blank then Success - taskProcessor.utils.log("DEBUG","response-code node is empty", isDebugLogEnabled) - requestDataResponseCode = 0 - }else{ - requestDataResponseCode = code.toInteger() - taskProcessor.utils.log("DEBUG","response-code is: " + requestDataResponseCode, isDebugLogEnabled) - } - }else if(taskProcessor.utils.nodeExists(decodedXml, "ResponseCode")){ - taskProcessor.utils.log("DEBUG","ResponseCode node Exist ", isDebugLogEnabled) - String code = taskProcessor.utils.getNodeText1(decodedXml, "ResponseCode") - if(code.isEmpty() || code.equals("")){ - // if ResponseCode blank then Success - taskProcessor.utils.log("DEBUG","ResponseCode node is empty", isDebugLogEnabled) - requestDataResponseCode = 0 - }else{ - requestDataResponseCode = code.toInteger() - taskProcessor.utils.log("DEBUG","ResponseCode is: " + requestDataResponseCode, isDebugLogEnabled) - } - }else{ - taskProcessor.utils.log("DEBUG","A Response Code DOES NOT Exist.", isDebugLogEnabled) - // if a response code does not exist then Success - requestDataResponseCode = 0 - } - try{ - - execution.setVariable(prefix+'sdncRequestDataResponseCode', requestDataResponseCode.toString()) - // if a response code is 0 or 2XX then Success - if ((requestDataResponseCode >= 200 && requestDataResponseCode <= 299) || requestDataResponseCode == 0) { - execution.setVariable(prefix+'sdncResponseSuccess', true) - taskProcessor.utils.log("DEBUG", "Setting sdncResponseSuccess to True ", isDebugLogEnabled) - taskProcessor.utils.log("DEBUG", "Exited ValidateSDNCResponse Method", isDebugLogEnabled) - }else{ - ExceptionUtil exceptionUtil = new ExceptionUtil() - String convertedCode = exceptionUtil.MapSDNCResponseCodeToErrorCode(requestDataResponseCode.toString()) - int convertedCodeInt = Integer.parseInt(convertedCode) - exceptionUtil.buildAndThrowWorkflowException(execution, convertedCodeInt, "Received error from SDN-C: " + requestDataResponseMessage) - } - - }catch(Exception e){ - //TODO proper handling of new, non numerical response codes in 1607 and new error handling for common API - requestDataResponseCode = 500 - } - - taskProcessor.utils.log("DEBUG", "SDNC callback response-code: " + requestDataResponseCode, isDebugLogEnabled) - taskProcessor.utils.log("DEBUG", "SDNC callback response-message: " + requestDataResponseMessage, isDebugLogEnabled) - } - - }else { - taskProcessor.utils.log("DEBUG", 'SDNCAdapter Subflow did NOT complete Successfully. SuccessIndicator is False. ') - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - }else{ - //TODO : what error code and error message use here - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - SDNCAdapter Subflow did NOT complete successfully.") - } - } - - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - taskProcessor.utils.log("DEBUG", 'END of Validate SDNC Response', isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error- Unable to validate SDNC Response '); - } - } - - /** - * Validates a workflow response. - * @param execution the execution - * @param responseVar the execution variable in which the response is stored - * @param responseCodeVar the execution variable in which the response code is stored - * @param errorResponseVar the execution variable in which the error response is stored - */ - public void validateL3BondingSDNCResp(DelegateExecution execution, String response, WorkflowException workflowException, boolean success) { - - def method = getClass().getSimpleName() + '.validateL3BondingSDNCResp(' + - 'execution=' + execution.getId() + - ', response=' + response + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - def prefix = execution.getVariable('prefix') - TrinityExceptionUtil trinityExceptionUtil = new TrinityExceptionUtil() - - try { - execution.setVariable(prefix+'sdncResponseSuccess', false) - - taskProcessor.utils.log("sdncAdapter Success Indicator is: " + success, isDebugLogEnabled) - if (success) { - - // we need to look inside the request data for error - def String callbackRequestData = taskProcessor.utils.getNodeXml(response, 'RequestData', false) - def String decodedXml = decodeXML(callbackRequestData) - taskProcessor.utils.log("DEBUG","decodedXml:\n" + decodedXml, isDebugLogEnabled) - - def requestDataResponseCode = '200' - def requestDataResponseMessage = '' - int intDataResponseCode = 200 - - if (taskProcessor.utils.nodeExists(decodedXml, "response-code")) { - - requestDataResponseCode = ((String) taskProcessor.utils.getNodeText(decodedXml, "response-code")) - if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) { - requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message") - } - }else if(taskProcessor.utils.nodeExists(decodedXml, "ResponseCode")){ - requestDataResponseCode = ((String) taskProcessor.utils.getNodeText1(decodedXml, "ResponseCode")).toInteger() - }else if(taskProcessor.utils.nodeExists(response, "ResponseCode")){ - requestDataResponseCode = ((String) taskProcessor.utils.getNodeText1(response, "ResponseCode")).toInteger() - requestDataResponseMessage = taskProcessor.utils.getNodeText(response, "ResponseMessage") - } - - taskProcessor.utils.log("DEBUG", "SDNC callback response-code: " + requestDataResponseCode, isDebugLogEnabled) - taskProcessor.utils.log("DEBUG", "SDNC callback response-message: " + requestDataResponseMessage, isDebugLogEnabled) - - // Get the AAI Status to determine if rollback is needed on ASSIGN - def aai_status = '' - if (taskProcessor.utils.nodeExists(decodedXml, "aai-status")) { - aai_status = ((String) taskProcessor.utils.getNodeText(decodedXml, "aai-status")) - taskProcessor.utils.log("DEBUG", "SDNC sent AAI STATUS code: " + aai_status, isDebugLogEnabled) - } - if (aai_status != null && !aai_status.equals("")) { - execution.setVariable(prefix+"AaiStatus",aai_status) - taskProcessor.utils.log("DEBUG", "Set variable " + prefix + "AaiStatus: " + execution.getVariable(prefix+"AaiStatus"), isDebugLogEnabled) - } - - // Get the result string to determine if rollback is needed on ASSIGN in Add Bonding flow only - def sdncResult = '' - if (taskProcessor.utils.nodeExists(decodedXml, "result")) { - sdncResult = ((String) taskProcessor.utils.getNodeText(decodedXml, "result")) - taskProcessor.utils.log("DEBUG", "SDNC sent result: " + sdncResult, isDebugLogEnabled) - } - if (sdncResult != null && !sdncResult.equals("")) { - execution.setVariable(prefix+"SdncResult",sdncResult) - taskProcessor.utils.log("DEBUG", "Set variable " + prefix + "SdncResult: " + execution.getVariable(prefix+"SdncResult"), isDebugLogEnabled) - } - - try{ - intDataResponseCode = Integer.parseInt(String.valueOf(requestDataResponseCode)) - }catch(Exception e){ - intDataResponseCode = 400 - } - - taskProcessor.utils.log("DEBUG", "intDataResponseCode " + intDataResponseCode , isDebugLogEnabled) - - // if response-code is not Success (200, 201, etc) we need to throw an exception - if ((intDataResponseCode < 200 || intDataResponseCode > 299) && intDataResponseCode != 0) { - execution.setVariable(prefix+'ResponseCode', intDataResponseCode) - execution.setVariable("L3HLAB_rollback", true) - def msg = trinityExceptionUtil.mapSDNCAdapterExceptionToErrorResponse(response, execution) - exceptionUtil.buildAndThrowWorkflowException(execution, intDataResponseCode, "Received error from SDN-C: " + msg) - - } - }else { - taskProcessor.logWarn('sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ') - execution.setVariable("L3HLAB_rollback", true) - def msg = trinityExceptionUtil.mapSDNCAdapterExceptionToErrorResponse(response, execution) - exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, msg) - } - - if (response == null || response.trim().equals("")) { - taskProcessor.logWarn('sdncAdapter workflow response is empty'); - execution.setVariable("L3HLAB_rollback", true) - def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response " , execution) - exceptionUtil.buildAndThrowWorkflowException(execution, intResponseCode, msg) - } - - execution.setVariable(prefix+'sdncResponseSuccess', true) - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - taskProcessor.logError('Caught exception in ' + method, e) - execution.setVariable(prefix+"ResponseCode",400) - execution.setVariable("L3HLAB_rollback", true) - def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response: " + e.getMessage(), execution) - exceptionUtil.buildAndThrowWorkflowException(execution, 400, msg) - } - } - - public String modelInfoToEcompModelInformation(String jsonModelInfo) { - String modelInvariantUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelInvariantUuid") - String modelUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelUuid") - if (modelUuid == null) { - modelUuid = "" - } - String modelCustomizationUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelCustomizationUuid") - String modelCustomizationString = "" - if (modelCustomizationUuid != null) { - modelCustomizationString = "${modelCustomizationUuid}" - } - String modelVersion = jsonUtil.getJsonValue(jsonModelInfo, "modelVersion") - if (modelVersion == null) { - modelVersion = "" - } - String modelName = jsonUtil.getJsonValue(jsonModelInfo, "modelName") - String ecompModelInformation = - """ - ${modelInvariantUuid} - ${modelUuid} - ${modelCustomizationString} - ${modelVersion} - ${modelName} - """ - - return ecompModelInformation - } - - /** - * Decode XML - replace & < and > with '&', '<' and '>' - * @param xml - the xml to be decoded - */ - private String decodeXML(String xml) { - def String decodedXml = xml.replaceAll("&", "&") - decodedXml = decodedXml.replaceAll("<", "<") - decodedXml = decodedXml.replaceAll(">", ">") - } - - - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy deleted file mode 100644 index 1233d0423b..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy +++ /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.bpmn.common.scripts - -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONArray -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.core.domain.* -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.apache.commons.lang3.StringUtils - -import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.* - -class SNIROUtils{ - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - private AbstractServiceTaskProcessor utils - - public MsoUtils msoUtils = new MsoUtils() - - public SNIROUtils(AbstractServiceTaskProcessor taskProcessor) { - this.utils = taskProcessor - } - - /** - * This method builds the service-agnostic - * sniro json request to get a homing solution - * and license solution - * - * @param execution - * @param requestId - * @param decomposition - ServiceDecomposition object - * @param subscriber - Subscriber information - * @param homingParams - Homing/Request parameters - * - * @return request - sniro v2 payload - * - * @author cb645j - */ - public String buildRequest(DelegateExecution execution, String requestId, ServiceDecomposition decomposition, Subscriber subscriber, String homingParams){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", "Started Building Sniro Request", isDebugEnabled) - def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(execution, "SNIROResponse", requestId) - def transactionId = requestId - //ServiceInstance Info - ServiceInstance serviceInstance = decomposition.getServiceInstance() - def serviceInstanceId - if(serviceInstance == null){ - utils.log("DEBUG", "Unable to obtain Service Instance Id, ServiceInstance Object is null" , isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to obtain Service Instance Id, ServiceInstance Object is null") - }else{ - serviceInstanceId = serviceInstance.getInstanceId() - } - //Model Info - ModelInfo model = decomposition.getModelInfo() - String modelType = model.getModelType() - String modelInvariantId = model.getModelInvariantUuid() - String modelVersionId = model.getModelUuid() - String modelName = model.getModelName() - String modelVersion = model.getModelVersion() - //Subscriber Info - String subscriberId = subscriber.getGlobalId() - String subscriberName = subscriber.getName() - String commonSiteId = subscriber.getCommonSiteId() - //OrderInfo - String orderInfo - if(!isBlank(homingParams)){ - orderInfo = homingParams.replaceAll("\"", "\\\\\"").replaceAll("\n", "").replaceAll("\r", "") - orderInfo = StringUtils.normalizeSpace(orderInfo) - } - - //Determine RequestType - //TODO Figure out better way to determine this - String requestType = "initial" - List resources = decomposition.getServiceResources() - for(Resource r:resources){ - HomingSolution currentSolution = (HomingSolution) r.getCurrentHomingSolution() - if(currentSolution != null){ - requestType = "speed changed" - } - } - - int timeoutSeconds = 1800 - String timeout = execution.getVariable("timeout") - if(isNotBlank(timeout)){ - String subT = timeout.substring(2, timeout.length() - 1) - int timeoutInt = Integer.parseInt(subT) - timeoutSeconds = timeoutInt * 60 - } - - //Demands - String placementDemands = "" - StringBuilder sb = new StringBuilder() - List resourceList = decomposition.getServiceAllottedResources() - List vnfResourceList = decomposition.getServiceVnfs() - - // TODO: We should include both alloted resources and service resources in the placementDeamnds- not one or the other. - if(resourceList.isEmpty() || resourceList == null){ - utils.log("DEBUG", "Allotted Resources List is empty - will try to get service VNFs instead.", isDebugEnabled) - resourceList = decomposition.getServiceVnfs() - } - - if(resourceList.isEmpty() || resourceList == null){ - utils.log("DEBUG", "Resources List is Empty", isDebugEnabled) - }else{ - for(Resource resource:resourceList){ - ModelInfo resourceModelInfo = resource.getModelInfo() - ResourceInstance resourceInstance = resource.getResourceInstance() - def resourceInstanceType = resource.getResourceType() - def serviceResourceId = resource.getResourceId() //TODO - resourceId versus instanceId - should be what is put in AAI, whatever we put here will be what is in response, used to correlate - def resourceModuleName = resourceModelInfo.getModelInstanceName() - def resouceModelCustomizationId = resourceModelInfo.getModelCustomizationUuid() - def resouceModelInvariantId = resourceModelInfo.getModelInvariantUuid() - def resouceModelName = resourceModelInfo.getModelName() - def resouceModelVersion = resourceModelInfo.getModelVersion() - def resouceModelVersionId = resourceModelInfo.getModelUuid() - def resouceModelType = resourceModelInfo.getModelType() - def tenantId = "" //Optional - def tenantName = "" //Optional - - - String existingPlacement = "" - HomingSolution currentPlacement = resource.getCurrentHomingSolution() - if(currentPlacement != null){ - String homedServiceInstanceId = currentPlacement.getServiceInstanceId() - existingPlacement = - ""","existingPlacement": { - "serviceInstanceId": "${homedServiceInstanceId}" - }""" - } - - - String demand = - """{ - "resourceInstanceType": "${resourceInstanceType}", - "serviceResourceId": "${serviceResourceId}", - "resourceModuleName": "${resourceModuleName}", - "resourceModelInfo": { - "modelCustomizationId": "${resouceModelCustomizationId}", - "modelInvariantId": "${resouceModelInvariantId}", - "modelName": "${resouceModelName}", - "modelVersion": "${resouceModelVersion}", - "modelVersionId": "${resouceModelVersionId}", - "modelType": "${resouceModelType}" - }, - "tenantId": "${tenantId}", - "tenantName": "${tenantName}" - ${existingPlacement} - },""" - - placementDemands = sb.append(demand) - } - placementDemands = placementDemands.substring(0, placementDemands.length() - 1); - } - - String licenseDemands = "" - sb = new StringBuilder() - if(vnfResourceList.isEmpty() || vnfResourceList == null){ - utils.log("DEBUG", "Vnf Resources List is Empty", isDebugEnabled) - }else{ - for(VnfResource vnfResource:vnfResourceList){ - ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo() - ResourceInstance vnfResourceInstance = vnfResource.getResourceInstance() - def resourceInstanceType = vnfResource.getResourceType() - def serviceResourceId = vnfResource.getResourceId() - def resourceModuleName = vnfResourceModelInfo.getModelInstanceName() - def resouceModelCustomizationId = vnfResourceModelInfo.getModelCustomizationUuid() - def resouceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid() - def resouceModelName = vnfResourceModelInfo.getModelName() - def resouceModelVersion = vnfResourceModelInfo.getModelVersion() - def resouceModelVersionId = vnfResourceModelInfo.getModelUuid() - def resouceModelType = vnfResourceModelInfo.getModelType() - - String curentLicenseJson = "" - HomingSolution currentSol = vnfResource.getCurrentHomingSolution() - if(currentSol != null){ - JSONArray entitlementPoolList = currentSol.getLicense().getEntitlementPoolListAsString() - JSONArray licenseKeyGroupList = currentSol.getLicense().getLicenseKeyGroupListAsString() - curentLicenseJson = - """ ,"existingLicense": [ - { - "entitlementPoolUUID": - ${entitlementPoolList}, - "licenseKeyGroupUUID": - ${licenseKeyGroupList} - - } - ]""" - } - - String demand = - """{ - "resourceInstanceType": "${resourceInstanceType}", - "serviceResourceId": "${serviceResourceId}", - "resourceModuleName": "${resourceModuleName}", - "resourceModelInfo": { - "modelCustomizationId": "${resouceModelCustomizationId}", - "modelInvariantId": "${resouceModelInvariantId}", - "modelName": "${resouceModelName}", - "modelVersion": "${resouceModelVersion}", - "modelVersionId": "${resouceModelVersionId}", - "modelType": "${resouceModelType}" - } - ${curentLicenseJson} - },""" - - licenseDemands = sb.append(demand) - } - licenseDemands = licenseDemands.substring(0, licenseDemands.length() - 1); - } - - String request = - """{ - "requestInfo": { - "transactionId": "${transactionId}", - "requestId": "${requestId}", - "callbackUrl": "${callbackUrl}", - "sourceId": "mso", - "requestType": "${requestType}", - "optimizer": [ - "placement", - "license" - ], - "numSolutions": 1, - "timeout": ${timeoutSeconds} - }, - "placementInfo": { - "serviceModelInfo": { - "modelType": "${modelType}", - "modelInvariantId": "${modelInvariantId}", - "modelVersionId": "${modelVersionId}", - "modelName": "${modelName}", - "modelVersion": "${modelVersion}" - }, - "subscriberInfo": { - "globalSubscriberId": "${subscriberId}", - "subscriberName": "${subscriberName}", - "subscriberCommonSiteId": "${commonSiteId}" - }, - "demandInfo": { - "placementDemand": [ - ${placementDemands} - ], - "licenseDemand": [ - ${licenseDemands} - ] - }, - "policyId": [], - "serviceInstanceId": "${serviceInstanceId}", - "orderInfo": "{\\\"requestParameters\\\": ${orderInfo}}" - } - }""" - - utils.log("DEBUG", "Completed Building Sniro Request", isDebugEnabled) - return request - } - - /** - * This method validates the callback response - * from Sniro. If the response contains an - * exception the method will build and throw - * a workflow exception. - * - * @param execution - * @param response - the async callback response from sniro - * - * @author cb645j - */ - public void validateCallbackResponse(DelegateExecution execution, String response){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - String placements = "" - if(isBlank(response)){ - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Sniro Async Callback Response is Empty") - }else{ - if(JsonUtils.jsonElementExist(response, "solutionInfo.placement")){ - placements = jsonUtil.getJsonValue(response, "solutionInfo.placement") - if(isBlank(placements) || placements.equalsIgnoreCase("[]")){ - String statusMessage = jsonUtil.getJsonValue(response, "statusMessage") - if(isBlank(statusMessage)){ - utils.log("DEBUG", "Error Occured in Homing: Sniro Async Callback Response does not contain placement solution.", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Sniro Async Callback Response does not contain placement solution.") - }else{ - utils.log("DEBUG", "Error Occured in Homing: " + statusMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 400, statusMessage) - } - }else{ - return - } - }else if(JsonUtils.jsonElementExist(response, "requestError") == true){ - String errorMessage = "" - if(response.contains("policyException")){ - String text = jsonUtil.getJsonValue(response, "requestError.policyException.text") - errorMessage = "Sniro Async Callback Response contains a Request Error Policy Exception: " + text - }else if(response.contains("serviceException")){ - String text = jsonUtil.getJsonValue(response, "requestError.serviceException.text") - errorMessage = "Sniro Async Callback Response contains a Request Error Service Exception: " + text - }else{ - errorMessage = "Sniro Async Callback Response contains a Request Error. Unable to determine the Request Error Exception." - } - utils.log("DEBUG", "Error Occured in Homing: " + errorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 400, errorMessage) - - }else{ - utils.log("DEBUG", "Error Occured in Homing: Received an Unknown Async Callback Response from Sniro.", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Received an Unknown Async Callback Response from Sniro.") - } - } - - } - - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy deleted file mode 100644 index 0b5d013fe0..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy +++ /dev/null @@ -1,33 +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.bpmn.common.scripts; - -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.camunda.bpm.engine.delegate.DelegateExecution - - -/** - * @version 1.0 - * - */ -public interface ServiceTaskProcessor { - public void preProcessRequest(DelegateExecution execution); -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SniroHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SniroHoming.groovy deleted file mode 100755 index 0fdd790137..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SniroHoming.groovy +++ /dev/null @@ -1,274 +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.bpmn.common.scripts - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution; - -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.core.domain.InventoryType -import org.openecomp.mso.bpmn.core.domain.Resource -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.Subscriber -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor - -import org.json.JSONArray -import org.json.JSONObject - -import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.*; - -/** - * This class is contains the scripts used - * by the Homing Subflow building block. The - * subflow attempts to home the provided - * resources by calling sniro. - * - * @author cb645j - * - */ -class SniroHoming extends AbstractServiceTaskProcessor { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - SNIROUtils sniroUtils = new SNIROUtils(this) - - /** - * This method validates the incoming variables. - * The method then prepares the sniro request - * and posts it to sniro's rest api. - * - * @param execution - * - * @author cb645j - */ - public void callSniro(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", "HOME_") - utils.log("DEBUG", "*** Started Homing Call Sniro ***", isDebugEnabled) - try { - execution.setVariable("rollbackData", null) - execution.setVariable("rolledBack", false) - - String requestId = execution.getVariable("msoRequestId") - utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled) - String serviceInstanceId = execution.getVariable("serviceInstanceId") - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - utils.log("DEBUG", "Incoming Service Decomposition is: " + serviceDecomposition, isDebugEnabled) - String subscriberInfo = execution.getVariable("subscriberInfo") - utils.log("DEBUG", "Incoming Subscriber Information is: " + subscriberInfo, isDebugEnabled) - - if (isBlank(requestId) || isBlank(serviceInstanceId) || isBlank(serviceDecomposition.toString()) || isBlank(subscriberInfo)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 4000, "A required input variable is missing or null") - } else { - String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId") - String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName") - String subCommonSiteId = "" - if (jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")) { - subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId") - } - Subscriber subscriber = new Subscriber(subId, subName, subCommonSiteId) - - String cloudConfiguration = execution.getVariable("cloudConfiguration") // TODO Currently not being used - String homingParameters = execution.getVariable("homingParameters") - // (aka. request parameters) Should be json format. TODO confirm its json format - - //Authentication - def authHeader = "" - String basicAuth = execution.getVariable("URN_mso_sniro_auth") - String msokey = execution.getVariable("URN_mso_msoKey") - String basicAuthValue = utils.encrypt(basicAuth, msokey) - if (basicAuthValue != null) { - utils.log("DEBUG", "Obtained BasicAuth username and password for SNIRO Adapter: " + basicAuthValue, isDebugEnabled) - try { - authHeader = utils.getBasicAuth(basicAuthValue, msokey) - execution.setVariable("BasicAuthHeaderValue", authHeader) - } catch (Exception ex) { - utils.log("DEBUG", "Unable to encode username and password string: " + ex, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to encode username and password string") - } - } else { - utils.log("DEBUG", "Unable to obtain BasicAuth - BasicAuth value null", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth value null") - } - - //Prepare Callback - String timeout = execution.getVariable("timeout") - if (isBlank(timeout)) { - timeout = execution.getVariable("URN_mso_sniro_timeout"); - if (isBlank(timeout)) { - timeout = "PT30M"; - } - } - utils.log("DEBUG", "Async Callback Timeout will be: " + timeout, isDebugEnabled) - - execution.setVariable("timeout", timeout); - execution.setVariable("correlator", requestId); - execution.setVariable("messageType", "SNIROResponse"); - - //Build Request & Call Sniro - String sniroRequest = sniroUtils.buildRequest(execution, requestId, serviceDecomposition, subscriber, homingParameters) - execution.setVariable("sniroRequest", sniroRequest) - utils.log("DEBUG", "SNIRO Request is: " + sniroRequest, isDebugEnabled) - - String endpoint = execution.getVariable("URN_mso_service_agnostic_sniro_endpoint") - String host = execution.getVariable("URN_mso_service_agnostic_sniro_host") - String url = host + endpoint - utils.log("DEBUG", "Posting to Sniro Url: " + url, isDebugEnabled) - - logDebug("URL to be used is: " + url, isDebugEnabled) - - RESTConfig config = new RESTConfig(url) - RESTClient client = new RESTClient(config).addAuthorizationHeader(authHeader).addHeader("Content-Type", "application/json") - APIResponse response = client.httpPost(sniroRequest) - - int responseCode = response.getStatusCode() - execution.setVariable("syncResponseCode", responseCode); - logDebug("SNIRO sync response code is: " + responseCode, isDebugEnabled) - String syncResponse = response.getResponseBodyAsString() - execution.setVariable("syncResponse", syncResponse); - logDebug("SNIRO sync response is: " + syncResponse, isDebugEnabled) - - utils.log("DEBUG", "*** Completed Homing Call Sniro ***", isDebugEnabled) - } - } catch (BpmnError b) { - throw b - } catch (Exception e) { - utils.log("DEBUG", "Error encountered within Homing CallSniro method: " + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing CallSniro: " + e.getMessage()) - } - } - - /** - * This method processes the callback response - * and the contained homing solution. It sets - * homing solution assignment and license - * information to the corresponding resources - * - * @param execution - * - * @author cb645j - */ - public void processHomingSolution(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", "*** Started Homing Process Homing Solution ***", isDebugEnabled) - try { - String response = execution.getVariable("asyncCallbackResponse") - utils.log("DEBUG", "Sniro Async Callback Response is: " + response, isDebugEnabled) - utils.logAudit("Sniro Async Callback Response is: " + response) - - sniroUtils.validateCallbackResponse(execution, response) - String placements = jsonUtil.getJsonValue(response, "solutionInfo.placement") - - ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition") - utils.log("DEBUG", "Service Decomposition: " + decomposition, isDebugEnabled) - - List resourceList = decomposition.getServiceResources() - JSONArray arr = new JSONArray(placements) - for (int i = 0; i < arr.length(); i++) { - JSONObject placement = arr.getJSONObject(i) - String jsonServiceResourceId = placement.getString("serviceResourceId") - for (Resource resource : resourceList) { - String serviceResourceId = resource.getResourceId() - if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) { - //match - String inventoryType = placement.getString("inventoryType") - resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType)) - resource.getHomingSolution().setCloudRegionId(placement.getString("cloudRegionId")) - resource.getHomingSolution().setRehome(placement.getBoolean("isRehome")) - JSONArray assignmentArr = placement.getJSONArray("assignmentInfo") - Map assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "variableName", "variableValue") - resource.getHomingSolution().setCloudOwner(assignmentMap.get("cloudOwner")) - resource.getHomingSolution().setAicClli(assignmentMap.get("aicClli")) - resource.getHomingSolution().setAicVersion(assignmentMap.get("aicVersion")) - if (inventoryType.equalsIgnoreCase("service")) { - VnfResource vnf = new VnfResource() - vnf.setVnfHostname(assignmentMap.get("vnfHostName")) - resource.getHomingSolution().setVnf(vnf) - resource.getHomingSolution().setServiceInstanceId(placement.getString("serviceInstanceId")) - } - } - } - } - if (JsonUtils.jsonElementExist(response, "solutionInfo.licenseInfo")) { - String licenseInfo = jsonUtil.getJsonValue(response, "solutionInfo.licenseInfo") - JSONArray licenseArr = new JSONArray(licenseInfo) - for (int l = 0; l < licenseArr.length(); l++) { - JSONObject license = licenseArr.getJSONObject(l) - String jsonServiceResourceId = license.getString("serviceResourceId") - for (Resource resource : resourceList) { - String serviceResourceId = resource.getResourceId() - if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) { - //match - String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolList") - List entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList) - resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList) - - String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupList") - List licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList) - resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList) - } - } - } - } - execution.setVariable("serviceDecomposition", decomposition) - execution.setVariable("homingSolution", placements) //TODO - can be removed as output variable - - utils.log("DEBUG", "*** Completed Homing Process Homing Solution ***", isDebugEnabled) - } catch (BpmnError b) { - throw b - } catch (Exception e) { - utils.log("DEBUG", "Error encountered within Homing ProcessHomingSolution method: " + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing ProcessHomingSolution") - } - } - - /** - * This method logs the start of DHVCreateService - * to make debugging easier. - * - * @param - execution - * @author cb645j - */ - public String logStart(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - String requestId = execution.getVariable("testReqId") - if (isBlank(requestId)) { - requestId = execution.getVariable("msoRequestId") - } - execution.setVariable("DHVCS_requestId", requestId) - utils.log("DEBUG", "***** STARTED Homing Subflow for request: " + requestId + " *****", "true") - utils.log("DEBUG", "****** Homing Subflow Global Debug Enabled: " + isDebugEnabled + " *****", "true") - utils.logAudit("***** STARTED Homing Subflow for request: " + requestId + " *****") - } - - /** - * Auto-generated method stub - */ - public void preProcessRequest(DelegateExecution execution) {} - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtil.groovy deleted file mode 100644 index e75b115b63..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtil.groovy +++ /dev/null @@ -1,382 +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.bpmn.common.scripts - -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* - -class TrinityExceptionUtil { - - - - public static enum Error { - SVC_GENERAL_SERVICE_ERROR("SVC0001","Internal Error"), - SVC_BAD_PARAMETER("SVC0002", "Invalid input value for message part %1"), - SVC_NO_SERVER_RESOURCES("SVC1000", "No server resources available to process the request"), - SVC_DETAILED_SERVICE_ERROR("SVC2000", "The following service error occurred: %1. Error code is %2."), - POL_GENERAL_POLICY_ERROR("POL0001", "A policy error occurred."), - POL_USER_NOT_PROVISIONED("POL1009", "User has not been provisioned for service"), - POL_USER_SUSPENDED("POL1010", "User has been suspended from service"), - POL_DETAILED_POLICY_ERROR("POL2000", "The following policy error occurred: %1. Error code is %2."), - POL_MSG_SIZE_EXCEEDS_LIMIT("POL9003", "Message content size exceeds the allowable limit") - - - private final String msgId - private final String msgTxt - - private Error(String msgId, String msgTxt) { - this.msgId = msgId - this.msgTxt = msgTxt - } - - public String getMsgId() { - return msgId - } - - public String getMsgTxt() { - return msgTxt - } - - } - - - - - String mapAdapterExecptionToCommonException(String response, DelegateExecution execution) - { - def utils=new MsoUtils() - def method = getClass().getSimpleName() + '.mapAdapterExecptionToCommonException(' + - 'execution=' + execution.getId() + - ')' - - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - utils.log("DEBUG",'Entered ' + method, isDebugLogEnabled) - - - def errorCode - - - try { - errorCode = MapCategoryToErrorCode(utils.getNodeText(response, "category")) - execution.setVariable(prefix+"err",errorCode) - String message = buildException(response, execution) - utils.log("DEBUG","=========== End MapAdapterExecptionToWorkflowException ===========",isDebugLogEnabled) - return message - }catch (Exception ex) { - //Ignore the exception - cases include non xml payload - utils.log("DEBUG","error mapping error, ignoring: " + ex,isDebugLogEnabled) - utils.log("DEBUG","=========== End MapAdapterExecptionToWorkflowException ===========",isDebugLogEnabled) - return buildException(response, execution) - } - } - - /** - * @param response - * @param execution - * @return mapped exception - */ - String mapAOTSExecptionToCommonException(String response, DelegateExecution execution) - { - def utils=new MsoUtils() - - def prefix=execution.getVariable("prefix") - def method = getClass().getSimpleName() + '.mapAOTSExecptionToCommonException(' + - 'execution=' + execution.getId() + - ')' - - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - utils.log("DEBUG",'Entered ' + method, isDebugLogEnabled) - - - try { - def errorCode = utils.getNodeText(response,"code") - def descr = utils.getNodeText(response, "description") - def mappedErr = mapErrorCodetoError(errorCode, descr) - if(mappedErr == Error.SVC_DETAILED_SERVICE_ERROR || mappedError == Error.POL_DETAILED_POLICY_ERROR){ - ArrayList myVars = new ArrayList() - myVars.add(descr) - myVars.add(errorCode) - execution.setVariable(prefix+"errVariables", myVars) - } - execution.setVariable(prefix+"err",mappedErr) - def message = buildException("Received error from AOTS: " + descr, execution) - utils.log("DEBUG","=========== End MapAOTSExecptionToCommonException ===========",isDebugLogEnabled) - return message - }catch (Exception ex) { - //Ignore the exception - cases include non xml payload - utils.log("DEBUG","error mapping error, ignoring: " + ex,isDebugLogEnabled) - utils.log("DEBUG","=========== End MapAOTSExecptionToCommonException ===========",isDebugLogEnabled) - return buildException(response, execution) - } - } - - String mapSDNCAdapterExceptionToErrorResponse(String sdncAdapterCallbackRequest, DelegateExecution execution) { - def utils=new MsoUtils() - def prefix=execution.getVariable("prefix") - def method = getClass().getSimpleName() + '.mapSDNCAdapterExceptionToErrorResponse(' + - 'execution=' + execution.getId() + - ')' - - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - utils.log("DEBUG",'Entered ' + method, isDebugLogEnabled) - - def sdncResponseCode - String responseCode = execution.getVariable(prefix+"ResponseCode") - utils.log("DEBUG",'responseCode to map: ' + responseCode, isDebugLogEnabled) - def errorMessage - - try { - - if(utils.nodeExists(sdncAdapterCallbackRequest, "RequestData")) { - def reqDataXml = StringEscapeUtils.unescapeXml(utils.getNodeXml(sdncAdapterCallbackRequest, "RequestData")) - errorMessage = utils.getNodeText(reqDataXml, "response-message") - sdncResponseCode = utils.getNodeText(reqDataXml, "response-code") - }else{ - errorMessage = utils.getNodeText(sdncAdapterCallbackRequest, "ResponseMessage") - sdncResponseCode = responseCode - } - def mappedErr = mapErrorCodetoError(responseCode, errorMessage) - errorMessage = errorMessage.replace("&", "&").replace("<", "<").replace(">", ">") - def modifiedErrorMessage = "Received error from SDN-C: " + errorMessage - if(mappedErr == Error.SVC_DETAILED_SERVICE_ERROR || mappedErr == Error.POL_DETAILED_POLICY_ERROR){ - ArrayList myVars = new ArrayList() - myVars.add(errorMessage) - myVars.add(sdncResponseCode) - execution.setVariable(prefix+"errVariables", myVars) - } - execution.setVariable(prefix+"err",mappedErr) - def message = buildException(modifiedErrorMessage, execution) - - - utils.log("DEBUG","=========== End MapSDNCAdapterException ===========",isDebugLogEnabled) - return message - }catch (Exception ex) { - //Ignore the exception - cases include non xml payload - utils.log("DEBUG","error mapping sdnc error, ignoring: " + ex,isDebugLogEnabled) - utils.log("DEBUG","=========== End MapSDNCAdapterException ===========",isDebugLogEnabled) - return null - } - - } - - /** - * @param response message from called component (ex: AAI) - * @param execution - * @return an error response conforming to the common - */ - String mapAAIExceptionTCommonException(String response, DelegateExecution execution) - { - def utils=new MsoUtils() - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - def prefix=execution.getVariable("prefix") - def method = getClass().getSimpleName() + '.mapAAIExceptionTCommonException(' + - 'execution=' + execution.getId() + - ')' - - utils.log("DEBUG",'Entered ' + method, isDebugLogEnabled) - def variables - def message - String errorCode = 'SVC0001' - utils.log("DEBUG","response: " + response, isDebugLogEnabled) - //they use the same format we do, pass their error along - //TODO add Received error from A&AI at beg of text - try { - message = utils.getNodeXml(response, "requestError") - message = utils.removeXmlNamespaces(message) - } catch (Exception ex) { - //Ignore the exception - cases include non xml payload - message = buildException("Received error from A&AI, unable to parse",execution) - utils.log("DEBUG","error mapping error, ignoring: " + ex,isDebugLogEnabled) - } - - if(message != null) { - execution.setVariable(prefix+"ErrorResponse",message) - utils.log("ERROR","Fault:"+ execution.getVariable(prefix+"ErrorResponse")) - return message - } else { - - return null - - } - } - - /** - * @param execution - * @return an error response conforming to the common API with default text msg - */ - String buildException(execution){ - return buildException(null, execution) - } - - /** - * @param response message from called component (ex: AAI) - * @param execution - * @return an error response conforming to the common - */ - String buildException(response, execution){ - def utils=new MsoUtils() - def method = getClass().getSimpleName() + '.buildException(' + - 'execution=' + execution.getId() + - ')' - - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - utils.log("DEBUG",'Entered ' + method, isDebugLogEnabled) - def prefix=execution.getVariable("prefix") - def responseCode = String.valueOf(execution.getVariable(prefix+"ResponseCode")) - def variables - utils.log("DEBUG","response: " + response, isDebugLogEnabled) - - try { - utils.log("DEBUG","formatting error message" ,isDebugLogEnabled) - def msgVars = execution.getVariable(prefix+"errVariables") - def myErr = execution.getVariable(prefix+"err") - def messageTxt = execution.getVariable(prefix+"errTxt") - def messageId = null - - if(myErr == null){ - utils.log("DEBUG","mapping response code: " + responseCode, isDebugLogEnabled) - myErr = mapErrorCodetoError(responseCode, response) - if(myErr == null){ - //not a service or policy error, just return error code - return "" - } - } - messageId = myErr.getMsgId() - - if(messageTxt == null){ - if(myErr!=null){ - messageTxt = myErr.getMsgTxt() - }else{ - messageTxt = response - } - } - - if(msgVars==null && (myErr == Error.SVC_DETAILED_SERVICE_ERROR || myErr == Error.POL_DETAILED_POLICY_ERROR)){ - msgVars = new ArrayList() - msgVars.add(response) - msgVars.add(responseCode) - } - - def msgVarsXML="" - StringBuffer msgVarsBuff = new StringBuffer() - if(msgVars!=null){ - for(String msgVar : msgVars){ - msgVarsBuff.append( - """ - ${msgVar}""") - } - - } - def message = "" - if(messageId.startsWith("SVC")){ - message = """ - - ${messageId} - ${messageTxt}${msgVarsBuff} - -""" - }else{ - message =""" - - ${messageId} - ${messageTxt}${msgVarsBuff} - -""" - } - utils.log("DEBUG", "message " + message, isDebugLogEnabled) - execution.setVariable(prefix+"ErrorResponse",message) - execution.setVariable(prefix+"err", myErr) - execution.setVariable(prefix+"errTxt", messageTxt) - execution.setVariable(prefix+"errVariables", msgVars) - utils.log("ERROR","Fault:"+ execution.getVariable(prefix+"ErrorResponse")) - return message - }catch(Exception ex) { - utils.log("DEBUG","error mapping error, return null: " + ex,isDebugLogEnabled) - return null - } - - } - - String parseError(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - def utils=new MsoUtils() - def prefix=execution.getVariable("prefix") - def text = execution.getVariable(prefix+"errTxt") - def msgVars = execution.getVariable(prefix+"errVariables") - utils.log("DEBUG",'parsing message: ' + text, isDebugLogEnabled) - if(text == null){ - return 'failed' - } - if(msgVars!=null && !msgVars.isEmpty()){ - for(int i=0; i - ${networkRole} - ${networkName} - - """ - vnfNetworks = vnfNetworks + vnfNetwork - } - } - } catch (Exception e) { - logWarn('Exception transforming \'_network\' params to vnfNetworks', e) - } - return vnfNetworks - } - - /** - * Transform the parameter specifications from the incoming '*-params' root element to - * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater). - * Each element in '*-params' is used to create an 'entry' element. - * - * @param paramsNode A Node representing a '*-params' element. - * @return a String of 'entry' elements, one for each 'param' element. - */ - protected String transformParamsToEntries(String paramsRootXml) { - if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) { - return '' - } - def String entries = '' - try { - paramsRootXml = utils.removeXmlNamespaces(paramsRootXml) - def paramsNode = xmlParser.parseText(paramsRootXml) - def params = utils.getIdenticalChildren(paramsNode, 'param') - for (param in params) { - def key = (String) param.attribute('name') - if (key == null) { - key = '' - } - def value = (String) param.text() - String entry = """ - - ${key} - ${value} - - """ - entries = entries + entry - } - } catch (Exception e) { - logWarn('Exception transforming params to entries', e) - } - return entries - } - - /** - * Transform the parameter specifications from the incoming '*-params' root element to - * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater). - * Each element in '*-params' is used to create an 'entry' element. - * - * @param paramsNode A Node representing a '*-params' element. - * @return a String of 'entry' elements, one for each 'param' element. - */ - protected String transformVolumeParamsToEntries(String paramsRootXml) { - if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) { - return '' - } - def String entries = '' - try { - paramsRootXml = utils.removeXmlNamespaces(paramsRootXml) - def paramsNode = xmlParser.parseText(paramsRootXml) - def params = utils.getIdenticalChildren(paramsNode, 'param') - for (param in params) { - def key = (String) param.attribute('name') - if (key == null) { - key = '' - } - if ( !(key in ['vnf_id', 'vnf_name', 'vf_module_id', 'vf_module_name'])) { - def value = (String) param.text() - String entry = """ - - ${key} - ${value} - - """ - entries = entries + entry - } - } - } catch (Exception e) { - logWarn('Exception transforming params to entries', e) - } - return entries - } - - /** - * Extract the Tenant Id from the Volume Group information returned by AAI. - * - * @param volumeGroupXml Volume Group XML returned by AAI. - * @return the Tenant Id extracted from the Volume Group information. 'null' is returned if - * the Tenant Id is missing or could not otherwise be extracted. - */ - protected String getTenantIdFromVolumeGroup(String volumeGroupXml) { - def groovy.util.Node volumeGroupNode = xmlParser.parseText(volumeGroupXml) - def groovy.util.Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list') - if (relationshipList != null) { - def groovy.util.NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') - for (groovy.util.Node relationship in relationships) { - def groovy.util.Node relatedTo = utils.getChildNode(relationship, 'related-to') - if ((relatedTo != null) && (relatedTo.text().equals('tenant'))) { - def groovy.util.NodeList relationshipDataList = utils.getIdenticalChildren(relationship, 'relationship-data') - for (groovy.util.Node relationshipData in relationshipDataList) { - def groovy.util.Node relationshipKey = utils.getChildNode(relationshipData, 'relationship-key') - if ((relationshipKey != null) && (relationshipKey.text().equals('tenant.tenant-id'))) { - def groovy.util.Node relationshipValue = utils.getChildNode(relationshipData, 'relationship-value') - if (relationshipValue != null) { - return relationshipValue.text() - } - } - } - } - } - } - return null - } - - - /* - * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response - * and puts them into the format expected by VNF adapter. - * @param vnfParamsMap - map of VNF parameters passed in the request body - * @param sdncGetResponse - response string from SDNC GET topology request - * @param vnfId - * @param vnfName - * @param vfModuleId - * @param vfModuleName - * @param vfModuleIndex - can be null - * @return a String of key/value entries for vfModuleParams - */ - - - protected String buildVfModuleParams(Map vnfParamsMap, String sdncGetResponse, String vnfId, String vnfName, - String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) { - - //Get SDNC Response Data - - String data = utils.getNodeXml(sdncGetResponse, "response-data") - data = data.replaceAll("<", "<") - data = data.replaceAll(">", ">") - - String serviceData = utils.getNodeXml(data, "service-data") - serviceData = utils.removeXmlPreamble(serviceData) - serviceData = utils.removeXmlNamespaces(serviceData) - String vnfRequestInfo = utils.getNodeXml(serviceData, "vnf-request-information") - String oldVnfId = utils.getNodeXml(vnfRequestInfo, "vnf-id") - oldVnfId = utils.removeXmlPreamble(oldVnfId) - oldVnfId = utils.removeXmlNamespaces(oldVnfId) - serviceData = serviceData.replace(oldVnfId, "") - def vnfId1 = utils.getNodeText1(serviceData, "vnf-id") - - Map paramsMap = new HashMap() - - if (vfModuleIndex != null) { - paramsMap.put("vf_module_index", "${vfModuleIndex}") - } - - // Add-on data - paramsMap.put("vnf_id", "${vnfId}") - paramsMap.put("vnf_name", "${vnfName}") - paramsMap.put("vf_module_id", "${vfModuleId}") - paramsMap.put("vf_module_name", "${vfModuleName}") - paramsMap.put("environment_context", "${environmentContext}") - paramsMap.put("workload_context", "${workloadContext}") - - InputSource source = new InputSource(new StringReader(data)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docFactory.setNamespaceAware(true) - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document responseXml = docBuilder.parse(source) - - - // Availability Zones Data - - NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones") - String aZonePosition = "0" - for (int z = 0; z < aZonesList.getLength(); z++) { - Node node = aZonesList.item(z) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String aZoneValue = utils.getElementText(eElement, "availability-zone") - aZonePosition = z.toString() - paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}") - } - } - - // Map of network-roles and network-tags from vm-networks - - NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks") - Map networkRoleMap = new HashMap() - for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){ - Node nodeNetworkKey = vmNetworksListGlobal.item(n) - if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { - Element eElementNetworkKey = (Element) nodeNetworkKey - String networkRole = utils.getElementText(eElementNetworkKey, "network-role") - String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag") - if (networkRoleValue.isEmpty()) { - networkRoleValue = networkRole - } - networkRoleMap.put(networkRole, networkRoleValue) - } - } - - // VNF Networks Data - - StringBuilder sbNet = new StringBuilder() - - NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks") - for (int x = 0; x < vnfNetworkList.getLength(); x++) { - Node node = vnfNetworkList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag") - String networkRole = utils.getElementText(eElement, "network-role") - if (vnfNetworkKey.isEmpty()) { - vnfNetworkKey = networkRoleMap.get(networkRole) - if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) { - vnfNetworkKey = networkRole - } - } - String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id") - String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name") - String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id") - String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id") - String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn") - paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}") - paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}") - paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}") - paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}") - paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}") - - NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list") - StringBuffer sriovFilterBuf = new StringBuffer() - String values = "" - for(int i = 0; i < sriovVlanFilterList.getLength(); i++){ - Node node1 = sriovVlanFilterList.item(i) - if (node1.getNodeType() == Node.ELEMENT_NODE) { - Element eElement1 = (Element) node1 - String value = utils.getElementText(eElement1, "sriov-vlan-filter") - if (i != sriovVlanFilterList.getLength() - 1) { - values = sriovFilterBuf.append(value + ",") - } - else { - values = sriovFilterBuf.append(value); - } - } - } - if (!values.isEmpty()) { - paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}") - } - } - } - - // VNF-VMS Data - - def key - def value - def networkKey - def networkValue - def floatingIPKey - def floatingIPKeyValue - def floatingIPV6Key - def floatingIPV6KeyValue - StringBuilder sb = new StringBuilder() - - NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms") - for (int x = 0; x < vmsList.getLength(); x++) { - Node node = vmsList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - key = utils.getElementText(eElement, "vm-type") - String values - String position = "0" - StringBuilder sb1 = new StringBuilder() - NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names") - NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks") - for(int i = 0; i < valueList.getLength(); i++){ - Node node1 = valueList.item(i) - if (node1.getNodeType() == Node.ELEMENT_NODE) { - Element eElement1 = (Element) node1 - value = utils.getElementText(eElement1, "vm-name") - if (i != valueList.getLength() - 1) { - values = sb1.append(value + ",") - } - else { - values = sb1.append(value); - } - position = i.toString() - paramsMap.put("${key}_name_${position}", "${value}") - } - } - for(int n = 0; n < vmNetworksList.getLength(); n++){ - String floatingIpKeyValueStr = "" - String floatingIpV6KeyValueStr = "" - Node nodeNetworkKey = vmNetworksList.item(n) - if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { - Element eElementNetworkKey = (Element) nodeNetworkKey - String ipAddressValues - String ipV6AddressValues - String networkPosition = "0" - StringBuilder sb2 = new StringBuilder() - StringBuilder sb3 = new StringBuilder() - StringBuilder sb4 = new StringBuilder() - networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag") - if (networkKey.isEmpty()) { - networkKey = utils.getElementText(eElementNetworkKey, "network-role") - } - floatingIPKey = key + '_' + networkKey + '_floating_ip' - floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip") - if(!floatingIPKeyValue.isEmpty()){ - paramsMap.put("$floatingIPKey", "$floatingIPKeyValue") - } - floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip' - floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6") - if(!floatingIPV6KeyValue.isEmpty()){ - paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue") - } - NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips") - for(int a = 0; a < networkIpsList.getLength(); a++){ - Node ipAddress = networkIpsList.item(a) - if (ipAddress.getNodeType() == Node.ELEMENT_NODE) { - Element eElementIpAddress = (Element) ipAddress - String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address") - if (a != networkIpsList.getLength() - 1) { - ipAddressValues = sb2.append(ipAddressValue + ",") - } - else { - ipAddressValues = sb2.append(ipAddressValue); - } - networkPosition = a.toString() - paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}") - } - } - - paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}") - - NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes") - String interfaceRoutePrefixValues = sb3.append("[") - - for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){ - Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a) - if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) { - Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix - String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr") - if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) { - interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") - } - if (a != interfaceRoutePrefixesList.getLength() - 1) { - interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",") - } - else { - interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}") - } - } - } - interfaceRoutePrefixValues = sb3.append("]") - if (interfaceRoutePrefixesList.getLength() > 0) { - paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}") - } - - NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6") - for(int a = 0; a < networkIpsV6List.getLength(); a++){ - Node ipV6Address = networkIpsV6List.item(a) - if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) { - Element eElementIpV6Address = (Element) ipV6Address - String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6") - if (a != networkIpsV6List.getLength() - 1) { - ipV6AddressValues = sb4.append(ipV6AddressValue + ",") - } - else { - ipV6AddressValues = sb4.append(ipV6AddressValue); - } - networkPosition = a.toString() - paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}") - } - } - paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}") - } - } - paramsMap.put("${key}_names", "${values}") - } - } - //SDNC Response Params - String sdncResponseParams = "" - List sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"] - String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters") - if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ - // No SDNC params - }else{ - NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters") - for (int z = 0; z < paramsList.getLength(); z++) { - Node node = paramsList.item(z) - Element eElement = (Element) node - String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name") - if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { - String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value") - paramsMap.put("${vnfParameterName}", "${vnfParameterValue}") - } - } - } - - // Parameters received from the request should overwrite any parameters received from SDNC - if (vnfParamsMap != null) { - for (Map.Entry entry : vnfParamsMap.entrySet()) { - String vnfKey = entry.getKey() - String vnfValue = entry.getValue() - paramsMap.put("$vnfKey", "$vnfValue") - } - } - - StringBuilder sbParams = new StringBuilder() - def vfModuleParams = "" - for (Map.Entry entry : paramsMap.entrySet()) { - String paramsXml - String paramName = entry.getKey() - String paramValue = entry.getValue() - paramsXml = - """ - ${paramName} - ${paramValue} - - """ - - vfModuleParams = sbParams.append(paramsXml) - } - - return vfModuleParams - - } - - - /* - * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response - * for both VNF and VF Module - * and puts them into the format expected by VNF adapter. - * @param vnfParamsMap - map of VNF parameters passed in the request body - * @param vnfSdncGetResponse - response string from SDNC GET VNF topology request - * @param vfmoduleSdncGetResponse - response string from SDNC GET VF Module topology request - * @param vnfId - * @param vnfName - * @param vfModuleId - * @param vfModuleName - * @param vfModuleIndex - can be null - * @return a String of key/value entries for vfModuleParams - */ - - protected String buildVfModuleParamsFromCombinedTopologies(Map vnfParamsMap, String vnfSdncGetResponse, String vfmoduleSdncGetResponse, String vnfId, String vnfName, - String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) { - - // Set up initial parameters - - Map paramsMap = new HashMap() - - if (vfModuleIndex != null) { - paramsMap.put("vf_module_index", "${vfModuleIndex}") - } - - // Add-on data - paramsMap.put("vnf_id", "${vnfId}") - paramsMap.put("vnf_name", "${vnfName}") - paramsMap.put("vf_module_id", "${vfModuleId}") - paramsMap.put("vf_module_name", "${vfModuleName}") - paramsMap.put("environment_context","${environmentContext}") - paramsMap.put("workload_context", "${workloadContext}") - - //Get SDNC Response Data for VNF - - String vnfData = utils.getNodeXml(vnfSdncGetResponse, "response-data") - vnfData = vnfData.replaceAll("<", "<") - vnfData = vnfData.replaceAll(">", ">") - - String vnfTopology = utils.getNodeXml(vnfData, "vnf-topology") - vnfTopology = utils.removeXmlPreamble(vnfTopology) - vnfTopology = utils.removeXmlNamespaces(vnfTopology) - - InputSource sourceVnf = new InputSource(new StringReader(vnfData)); - DocumentBuilderFactory docFactoryVnf = DocumentBuilderFactory.newInstance(); - docFactoryVnf.setNamespaceAware(true) - DocumentBuilder docBuilderVnf = docFactoryVnf.newDocumentBuilder() - Document responseXmlVnf = docBuilderVnf.parse(sourceVnf) - - // Availability Zones Data - - NodeList aZonesList = responseXmlVnf.getElementsByTagNameNS("*", "availability-zones") - String aZonePosition = "0" - for (int z = 0; z < aZonesList.getLength(); z++) { - Node node = aZonesList.item(z) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String aZoneValue = utils.getElementText(eElement, "availability-zone") - aZonePosition = z.toString() - paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}") - } - } - - //Get SDNC Response Data for VF Module - - String vfModuleData = utils.getNodeXml(vfmoduleSdncGetResponse, "response-data") - vfModuleData = vfModuleData.replaceAll("<", "<") - vfModuleData = vfModuleData.replaceAll(">", ">") - - String vfModuleTopology = utils.getNodeXml(vfModuleData, "vf-module-topology") - vfModuleTopology = utils.removeXmlPreamble(vfModuleTopology) - vfModuleTopology = utils.removeXmlNamespaces(vfModuleTopology) - String vfModuleTopologyIdentifier = utils.getNodeXml(vfModuleTopology, "vf-module-topology-identifier") - - InputSource sourceVfModule = new InputSource(new StringReader(vfModuleData)); - DocumentBuilderFactory docFactoryVfModule = DocumentBuilderFactory.newInstance(); - docFactoryVfModule.setNamespaceAware(true) - DocumentBuilder docBuilderVfModule = docFactoryVfModule.newDocumentBuilder() - Document responseXmlVfModule = docBuilderVfModule.parse(sourceVfModule) - - // Map of network-roles and network-tags from vm-networks - - NodeList vmNetworksListGlobal = responseXmlVfModule.getElementsByTagNameNS("*", "vm-networks") - Map networkRoleMap = new HashMap() - for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){ - Node nodeNetworkKey = vmNetworksListGlobal.item(n) - if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { - Element eElementNetworkKey = (Element) nodeNetworkKey - String networkRole = utils.getElementText(eElementNetworkKey, "network-role") - String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag") - if (networkRoleValue.isEmpty()) { - networkRoleValue = networkRole - } - networkRoleMap.put(networkRole, networkRoleValue) - } - } - - // VNF Networks Data - - StringBuilder sbNet = new StringBuilder() - - NodeList vnfNetworkList = responseXmlVnf.getElementsByTagNameNS("*", "vnf-networks") - for (int x = 0; x < vnfNetworkList.getLength(); x++) { - Node node = vnfNetworkList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag") - String networkRole = utils.getElementText(eElement, "network-role") - if (vnfNetworkKey.isEmpty()) { - vnfNetworkKey = networkRoleMap.get(networkRole) - if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) { - vnfNetworkKey = networkRole - } - } - String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id") - String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name") - String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id") - String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id") - String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn") - paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}") - paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}") - paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}") - paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}") - paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}") - - NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list") - StringBuffer sriovFilterBuf = new StringBuffer() - String values = "" - for(int i = 0; i < sriovVlanFilterList.getLength(); i++){ - Node node1 = sriovVlanFilterList.item(i) - if (node1.getNodeType() == Node.ELEMENT_NODE) { - Element eElement1 = (Element) node1 - String value = utils.getElementText(eElement1, "sriov-vlan-filter") - if (i != sriovVlanFilterList.getLength() - 1) { - values = sriovFilterBuf.append(value + ",") - } - else { - values = sriovFilterBuf.append(value); - } - } - } - if (!values.isEmpty()) { - paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}") - } - } - } - - - - // VMS Data - - def key - def value - def networkKey - def networkValue - def floatingIPKey - def floatingIPKeyValue - def floatingIPV6Key - def floatingIPV6KeyValue - StringBuilder sb = new StringBuilder() - - NodeList vmsList = responseXmlVfModule.getElementsByTagNameNS("*","vm") - for (int x = 0; x < vmsList.getLength(); x++) { - Node node = vmsList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - key = utils.getElementText(eElement, "vm-type") - String values - String position = "0" - StringBuilder sb1 = new StringBuilder() - NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names") - NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks") - for(int i = 0; i < valueList.getLength(); i++){ - Node node1 = valueList.item(i) - if (node1.getNodeType() == Node.ELEMENT_NODE) { - Element eElement1 = (Element) node1 - value = utils.getElementText(eElement1, "vm-name") - if (i != valueList.getLength() - 1) { - values = sb1.append(value + ",") - } - else { - values = sb1.append(value); - } - position = i.toString() - paramsMap.put("${key}_name_${position}", "${value}") - } - } - for(int n = 0; n < vmNetworksList.getLength(); n++){ - String floatingIpKeyValueStr = "" - String floatingIpV6KeyValueStr = "" - Node nodeNetworkKey = vmNetworksList.item(n) - if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { - Element eElementNetworkKey = (Element) nodeNetworkKey - String ipAddressValues - String ipV6AddressValues - String networkPosition = "0" - StringBuilder sb2 = new StringBuilder() - StringBuilder sb3 = new StringBuilder() - StringBuilder sb4 = new StringBuilder() - networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag") - if (networkKey.isEmpty()) { - networkKey = utils.getElementText(eElementNetworkKey, "network-role") - } - floatingIPKey = key + '_' + networkKey + '_floating_ip' - floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip") - if(!floatingIPKeyValue.isEmpty()){ - paramsMap.put("$floatingIPKey", "$floatingIPKeyValue") - } - floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip' - floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6") - if(!floatingIPV6KeyValue.isEmpty()){ - paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue") - } - NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips") - for(int a = 0; a < networkIpsList.getLength(); a++){ - Node ipAddress = networkIpsList.item(a) - if (ipAddress.getNodeType() == Node.ELEMENT_NODE) { - Element eElementIpAddress = (Element) ipAddress - String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address") - if (a != networkIpsList.getLength() - 1) { - ipAddressValues = sb2.append(ipAddressValue + ",") - } - else { - ipAddressValues = sb2.append(ipAddressValue); - } - networkPosition = a.toString() - paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}") - } - } - - paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}") - - NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes") - String interfaceRoutePrefixValues = sb3.append("[") - - for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){ - Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a) - if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) { - Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix - String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr") - if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) { - interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") - } - if (a != interfaceRoutePrefixesList.getLength() - 1) { - interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",") - } - else { - interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}") - } - } - } - interfaceRoutePrefixValues = sb3.append("]") - if (interfaceRoutePrefixesList.getLength() > 0) { - paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}") - } - - NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6") - for(int a = 0; a < networkIpsV6List.getLength(); a++){ - Node ipV6Address = networkIpsV6List.item(a) - if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) { - Element eElementIpV6Address = (Element) ipV6Address - String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6") - if (a != networkIpsV6List.getLength() - 1) { - ipV6AddressValues = sb4.append(ipV6AddressValue + ",") - } - else { - ipV6AddressValues = sb4.append(ipV6AddressValue); - } - networkPosition = a.toString() - paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}") - } - } - paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}") - } - } - paramsMap.put("${key}_names", "${values}") - } - } - //SDNC Response Params - List sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"] - - String vnfParamsChildNodes = utils.getChildNodes(vnfData, "param") - if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ - // No SDNC params for VNF - }else{ - NodeList paramsList = responseXmlVnf.getElementsByTagNameNS("*", "param") - for (int z = 0; z < paramsList.getLength(); z++) { - Node node = paramsList.item(z) - Element eElement = (Element) node - String vnfParameterName = utils.getElementText(eElement, "name") - if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { - String vnfParameterValue = utils.getElementText(eElement, "value") - paramsMap.put("${vnfParameterName}", "${vnfParameterValue}") - } - } - } - - String vfModuleParamsChildNodes = utils.getChildNodes(vfModuleData, "param") - if(vfModuleParamsChildNodes == null || vfModuleParamsChildNodes.length() < 1){ - // No SDNC params for VF Module - }else{ - NodeList paramsList = responseXmlVfModule.getElementsByTagNameNS("*", "param") - for (int z = 0; z < paramsList.getLength(); z++) { - Node node = paramsList.item(z) - Element eElement = (Element) node - String vnfParameterName = utils.getElementText(eElement, "name") - if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { - String vnfParameterValue = utils.getElementText(eElement, "value") - paramsMap.put("${vnfParameterName}", "${vnfParameterValue}") - } - } - } - - // Parameters received from the request should overwrite any parameters received from SDNC - if (vnfParamsMap != null) { - for (Map.Entry entry : vnfParamsMap.entrySet()) { - String vnfKey = entry.getKey() - String vnfValue = entry.getValue() - paramsMap.put("$vnfKey", "$vnfValue") - } - } - - StringBuilder sbParams = new StringBuilder() - def vfModuleParams = "" - for (Map.Entry entry : paramsMap.entrySet()) { - String paramsXml - String paramName = entry.getKey() - String paramValue = entry.getValue() - paramsXml = - """ - ${paramName} - ${paramValue} - - """ - - vfModuleParams = sbParams.append(paramsXml) - } - - return vfModuleParams - - } - - - /* - * VBNG specific method that parses VNF parameters passed in on the - * incoming requests and SDNC parameters returned from SDNC get response - * and puts them into the format expected by VNF adapter. - * @param vnfParamsMap - map of VNF parameters passed in the request body - * @param sdncGetResponse - response string from SDNC GET topology request - * @param vnfId - * @param vnfName - * @param vfModuleId - * @param vfModuleName - * @return a String of key/value entries for vfModuleParams - */ - - protected String buildVfModuleParamsVbng(String vnfParams, String sdncGetResponse, String vnfId, String vnfName, - String vfModuleId, String vfModuleName) { - - //Get SDNC Response Data - - String data = utils.getNodeXml(sdncGetResponse, "response-data") - data = data.replaceAll("<", "<") - data = data.replaceAll(">", ">") - - - - // Add-on data - String vnfInfo = - """ - vnf_id - ${vnfId} - - - vnf_name - ${vnfName} - - - vf_module_id - ${vfModuleId} - - - vf_module_name - ${vfModuleName} - """ - - utils.logAudit("vnfInfo: " + vnfInfo) - InputSource source = new InputSource(new StringReader(data)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docFactory.setNamespaceAware(true) - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document responseXml = docBuilder.parse(source) - - - // Availability Zones Data - String aZones = "" - StringBuilder sbAZone = new StringBuilder() - NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones") - String aZonePosition = "0" - for (int z = 0; z < aZonesList.getLength(); z++) { - Node node = aZonesList.item(z) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String aZoneValue = utils.getElementText(eElement, "availability-zone") - aZonePosition = z.toString() - String aZoneXml = - """ - availability_zone_${aZonePosition} - ${aZoneValue} - """ - aZones = sbAZone.append(aZoneXml) - } - } - - // Map of network-roles and network-tags from vm-networks - - NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks") - Map networkRoleMap = new HashMap() - for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){ - Node nodeNetworkKey = vmNetworksListGlobal.item(n) - if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { - Element eElementNetworkKey = (Element) nodeNetworkKey - String networkRole = utils.getElementText(eElementNetworkKey, "network-role") - String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag") - if (networkRoleValue.isEmpty()) { - networkRoleValue = networkRole - } - networkRoleMap.put(networkRole, networkRoleValue) - } - } - - // VNF Networks Data - String vnfNetworkNetId = "" - String vnfNetworkNetName = "" - String vnfNetworkSubNetId = "" - String vnfNetworkV6SubNetId = "" - String vnfNetworkNetFqdn = "" - String vnfNetworksSriovVlanFilters = "" - StringBuilder sbNet = new StringBuilder() - StringBuilder sbNet2 = new StringBuilder() - StringBuilder sbNet3 = new StringBuilder() - StringBuilder sbNet4 = new StringBuilder() - StringBuilder sbNet5 = new StringBuilder() - StringBuilder sbNet6 = new StringBuilder() - NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks") - for (int x = 0; x < vnfNetworkList.getLength(); x++) { - Node node = vnfNetworkList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag") - String networkRole = utils.getElementText(eElement, "network-role") - if (vnfNetworkKey.isEmpty()) { - vnfNetworkKey = networkRoleMap.get(networkRole) - if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) { - vnfNetworkKey = networkRole - } - } - String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id") - String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name") - String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id") - String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id") - String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn") - String vnfNetworkNetIdXml = - """ - ${vnfNetworkKey}_net_id - ${vnfNetworkNeutronIdValue} - """ - vnfNetworkNetId = sbNet.append(vnfNetworkNetIdXml) - String vnfNetworkNetNameXml = - """ - ${vnfNetworkKey}_net_name - ${vnfNetworkNetNameValue} - """ - vnfNetworkNetName = sbNet2.append(vnfNetworkNetNameXml) - String vnfNetworkSubNetIdXml = - """ - ${vnfNetworkKey}_subnet_id - ${vnfNetworkSubNetIdValue} - """ - vnfNetworkSubNetId = sbNet3.append(vnfNetworkSubNetIdXml) - String vnfNetworkV6SubNetIdXml = - """ - ${vnfNetworkKey}_v6_subnet_id - ${vnfNetworkV6SubNetIdValue} - """ - vnfNetworkV6SubNetId = sbNet5.append(vnfNetworkV6SubNetIdXml) - String vnfNetworkNetFqdnXml = - """ - ${vnfNetworkKey}_net_fqdn - ${vnfNetworkNetFqdnValue} - """ - vnfNetworkNetFqdn = sbNet4.append(vnfNetworkNetFqdnXml) - - NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list") - StringBuffer sriovFilterBuf = new StringBuffer() - String values = "" - for(int i = 0; i < sriovVlanFilterList.getLength(); i++){ - Node node1 = sriovVlanFilterList.item(i) - if (node1.getNodeType() == Node.ELEMENT_NODE) { - Element eElement1 = (Element) node1 - String value = utils.getElementText(eElement1, "sriov-vlan-filter") - if (i != sriovVlanFilterList.getLength() - 1) { - values = sriovFilterBuf.append(value + ",") - } - else { - values = sriovFilterBuf.append(value); - } - } - } - if (!values.isEmpty()) { - String vnfNetworkSriovVlanFilterXml = - """ - ${vnfNetworkKey}_ATT_VF_VLAN_FILTER - ${values} - """ - vnfNetworksSriovVlanFilters = sbNet6.append(vnfNetworkSriovVlanFilterXml) - } - } - } - - // VNF-VMS Data - String vnfVMS = "" - String vnfVMSPositions = "" - String vmNetworks = "" - String vmNetworksPositions = "" - String vmNetworksPositionsV6 = "" - String interfaceRoutePrefixes = "" - def key - def value - def networkKey - def networkValue - def floatingIPKey - def floatingIPKeyValue - def floatingIPV6Key - def floatingIPV6KeyValue - StringBuilder sb = new StringBuilder() - StringBuilder sbPositions = new StringBuilder() - StringBuilder sbVmNetworks = new StringBuilder() - StringBuilder sbNetworksPositions = new StringBuilder() - StringBuilder sbInterfaceRoutePrefixes = new StringBuilder() - StringBuilder sbNetworksPositionsV6 = new StringBuilder() - - NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms") - for (int x = 0; x < vmsList.getLength(); x++) { - Node node = vmsList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - key = utils.getElementText(eElement, "vm-type") - String values - String position = "0" - StringBuilder sb1 = new StringBuilder() - NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names") - NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks") - for(int i = 0; i < valueList.getLength(); i++){ - Node node1 = valueList.item(i) - if (node1.getNodeType() == Node.ELEMENT_NODE) { - Element eElement1 = (Element) node1 - value = utils.getElementText(eElement1, "vm-name") - if (i != valueList.getLength() - 1) { - values = sb1.append(value + ",") - } - else { - values = sb1.append(value); - } - position = i.toString() - String vnfPositionXml = - """ - ${key}_name_${position} - ${value} - """ - vnfVMSPositions = sbPositions.append(vnfPositionXml) - } - } - for(int n = 0; n < vmNetworksList.getLength(); n++){ - String floatingIpKeyValueStr = "" - String floatingIpV6KeyValueStr = "" - Node nodeNetworkKey = vmNetworksList.item(n) - if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { - Element eElementNetworkKey = (Element) nodeNetworkKey - String ipAddressValues - String ipV6AddressValues - String networkPosition = "0" - StringBuilder sb2 = new StringBuilder() - StringBuilder sb3 = new StringBuilder() - StringBuilder sb4 = new StringBuilder() - networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag") - if (networkKey.isEmpty()) { - networkKey = utils.getElementText(eElementNetworkKey, "network-role") - } - floatingIPKey = key + '_' + networkKey + '_floating_ip' - floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip") - if(!floatingIPKeyValue.isEmpty()){ - floatingIpKeyValueStr = """ - $floatingIPKey - $floatingIPKeyValue - """ - } - floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip' - floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6") - if(!floatingIPV6KeyValue.isEmpty()){ - floatingIpV6KeyValueStr = """ - $floatingIPV6Key - $floatingIPV6KeyValue - """ - } - NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips") - for(int a = 0; a < networkIpsList.getLength(); a++){ - Node ipAddress = networkIpsList.item(a) - if (ipAddress.getNodeType() == Node.ELEMENT_NODE) { - Element eElementIpAddress = (Element) ipAddress - String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address") - if (a != networkIpsList.getLength() - 1) { - ipAddressValues = sb2.append(ipAddressValue + ",") - } - else { - ipAddressValues = sb2.append(ipAddressValue); - } - networkPosition = a.toString() - String vmNetworksPositionsXml = - """ - ${key}_${networkKey}_ip_${networkPosition} - ${ipAddressValue} - """ - vmNetworksPositions = sbNetworksPositions.append(vmNetworksPositionsXml) - } - } - vmNetworksPositions = sbNetworksPositions.append(floatingIpKeyValueStr).append(floatingIpV6KeyValueStr) - - String vmNetworksXml = - """ - ${key}_${networkKey}_ips - ${ipAddressValues} - """ - vmNetworks = sbVmNetworks.append(vmNetworksXml) - - NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes") - String interfaceRoutePrefixValues = sb3.append("[") - - for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){ - Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a) - if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) { - Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix - String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr") - if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) { - interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") - } - if (a != interfaceRoutePrefixesList.getLength() - 1) { - interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",") - } - else { - interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}") - } - } - } - interfaceRoutePrefixValues = sb3.append("]") - if (interfaceRoutePrefixesList.getLength() > 0) { - String interfaceRoutePrefixesXml = - """ - ${key}_${networkKey}_route_prefixes - ${interfaceRoutePrefixValues} - """ - interfaceRoutePrefixes = sbInterfaceRoutePrefixes.append(interfaceRoutePrefixesXml) - } - - NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6") - for(int a = 0; a < networkIpsV6List.getLength(); a++){ - Node ipV6Address = networkIpsV6List.item(a) - if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) { - Element eElementIpV6Address = (Element) ipV6Address - String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6") - if (a != networkIpsV6List.getLength() - 1) { - ipV6AddressValues = sb4.append(ipV6AddressValue + ",") - } - else { - ipV6AddressValues = sb4.append(ipV6AddressValue); - } - networkPosition = a.toString() - String vmNetworksPositionsV6Xml = - """ - ${key}_${networkKey}_v6_ip_${networkPosition} - ${ipV6AddressValue} - """ - vmNetworksPositionsV6 = sbNetworksPositionsV6.append(vmNetworksPositionsV6Xml) - } - } - String vmNetworksV6Xml = - """ - ${key}_${networkKey}_v6_ips - ${ipV6AddressValues} - """ - vmNetworks = sbVmNetworks.append(vmNetworksV6Xml) - } - } - String vnfXml = - """ - ${key}_names - ${values} - """ - vnfVMS = sb.append(vnfXml) - } - } - //SDNC Response Params - String sdncResponseParams = "" - List sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"] - String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters") - if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ - // No SDNC params - }else{ - NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters") - for (int z = 0; z < paramsList.getLength(); z++) { - Node node = paramsList.item(z) - Element eElement = (Element) node - String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name") - if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { - String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value") - String paraEntry = - """ - ${vnfParameterName} - ${vnfParameterValue} - """ - sdncResponseParams = sb.append(paraEntry) - } - } - } - - - def vfModuleParams = """ - ${vnfInfo} - ${aZones} - ${vnfNetworkNetId} - ${vnfNetworkNetName} - ${vnfNetworkSubNetId} - ${vnfNetworkV6SubNetId} - ${vnfNetworkNetFqdn} - ${vnfNetworksSriovVlanFilters} - ${vnfVMS} - ${vnfVMSPositions} - ${vmNetworks} - ${vmNetworksPositions} - ${vmNetworksPositionsV6} - ${interfaceRoutePrefixes} - ${vnfParams} - ${sdncResponseParams}""" - - return vfModuleParams - - } - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtils.groovy deleted file mode 100644 index 2a8dd95c33..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtils.groovy +++ /dev/null @@ -1,548 +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.bpmn.common.scripts - -import groovy.json.JsonBuilder -import groovy.json.JsonSlurper - -import org.json.JSONObject -import org.json.XML -import org.openecomp.mso.bpmn.core.xml.XmlTool - -class VidUtils { - - public MsoUtils utils = new MsoUtils() - private AbstractServiceTaskProcessor taskProcessor - - public VidUtils(AbstractServiceTaskProcessor taskProcessor) { - this.taskProcessor = taskProcessor - } - - /** - * Create a volume-request XML using a JSON string - * @param jsonReq - JSON request from VID - * @param action - * @return - */ - public String createXmlVolumeRequest(String jsonReq, String action, String serviceInstanceId) { - def jsonSlurper = new JsonSlurper() - try{ - Map reqMap = jsonSlurper.parseText(jsonReq) - return createXmlVolumeRequest(reqMap, action, serviceInstanceId) - } - catch(Exception e) { - throw e - } - } - - /** - * Create a volume-request XML using a map - * @param requestMap - map created from VID JSON - * @param action - * @param serviceInstanceId - * @return - */ - public String createXmlVolumeRequest(Map requestMap, String action, String serviceInstanceId) { - createXmlVolumeRequest(requestMap, action, serviceInstanceId, '') - } - - - /** - * Create a volume-request XML using a map - * @param requestMap - * @param action - * @param serviceInstanceId - * @param volumeGroupId - * @return - */ - public String createXmlVolumeRequest(Map requestMap, String action, String serviceInstanceId, String volumeGroupId) { - def vnfType = '' - def serviceName = '' - def modelCustomizationName = '' - def asdcServiceModelVersion = '' - - def suppressRollback = requestMap.requestDetails.requestInfo.suppressRollback - - def backoutOnFailure = "" - if(suppressRollback != null){ - if ( suppressRollback == true) { - backoutOnFailure = "false" - } else if ( suppressRollback == false) { - backoutOnFailure = "true" - } - } - - def volGrpName = requestMap.requestDetails.requestInfo?.instanceName ?: '' - def serviceId = requestMap.requestDetails.requestParameters?.serviceId ?: '' - def relatedInstanceList = requestMap.requestDetails.relatedInstanceList - relatedInstanceList.each { - if (it.relatedInstance.modelInfo?.modelType == 'service') { - serviceName = it.relatedInstance.modelInfo?.modelName - asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion - } - if (it.relatedInstance.modelInfo?.modelType == 'vnf') { - modelCustomizationName = it.relatedInstance.modelInfo?.modelInstanceName - } - } - - vnfType = serviceName + '/' + modelCustomizationName - - def userParams = requestMap.requestDetails?.requestParameters?.userParams - def userParamsNode = '' - if(userParams != null) { - userParamsNode = buildUserParams(userParams) - } - def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: '' - - def xmlReq = """ - - - ${action} - ${requestMap.requestDetails.requestInfo.source} - ${serviceInstanceId} - - - ${volumeGroupId} - ${volGrpName} - ${vnfType} - ${requestMap.requestDetails.modelInfo.modelName} - ${asdcServiceModelVersion} - ${requestMap.requestDetails.cloudConfiguration.lcpCloudRegionId} - ${requestMap.requestDetails.cloudConfiguration.tenantId} - ${serviceId} - ${backoutOnFailure} - ${modelCustomizationId} - - - $userParamsNode - - - """ - // return a pretty-print of the volume-request xml without the preamble - return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") - } - - /** - * A common method that can be used to build volume-params node from a map. - * @param Map userParams - * @return - */ - public String buildUserParams(userParams) { - if (userParams == null) return "" - def xml = "" - def key = "" - def value = "" - userParams.each {it -> - key = it.name.replaceAll(/\B[A-Z]/) { '_' + it }.toLowerCase() - value = it.value - xml += "${value}" - } - - return xml - } - - /** - * A common method that can be used to extract 'requestDetails' - * @param String json - * @return String json requestDetails - */ - @Deprecated - public getJsonRequestDetails(String jsonInput) { - String rtn = "" - if (jsonInput.isEmpty() || jsonInput == null) { - return rtn - } else { - def jsonMapObject = new JsonSlurper().parseText(jsonInput) - if (jsonMapObject instanceof Map) { - String jsonString = new JsonBuilder(jsonMapObject.requestDetails) - rtn = '{'+"requestDetails"+":"+jsonString+'}' - return rtn - } else { - return rtn - } - } - } - - /** - * A common method that can be used to extract 'requestDetails' in Xml - * @param String json - * @return String xml requestDetails - */ - @Deprecated - public getJsonRequestDetailstoXml(String jsonInput) { - String rtn = null - def jsonString = getJsonRequestDetails(jsonInput) - if (jsonString == null) { - return rtn - } else { - JSONObject jsonObj = new JSONObject(jsonString) - return XmlTool.normalize(XML.toString(jsonObj)) - } - } - - /** - * Create a network-request XML using a map - * @param execution - * @param xmlRequestDetails - requestDetails in xml - * @return - * Note: See latest version: createXmlNetworkRequestInstance() - */ - - public String createXmlNetworkRequestInfra(execution, def networkJsonIncoming) { - - def requestId = execution.getVariable("requestId") - def serviceInstanceId = execution.getVariable("serviceInstanceId") - def requestAction = execution.getVariable("requestAction") - def networkId = (execution.getVariable("networkId")) != null ? execution.getVariable("networkId") : "" - - def jsonSlurper = new JsonSlurper() - try { - Map reqMap = jsonSlurper.parseText(networkJsonIncoming) - def instanceName = reqMap.requestDetails.requestInfo.instanceName - def modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationId - if (modelCustomizationId == null) { - modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationUuid !=null ? - reqMap.requestDetails.modelInfo.modelCustomizationUuid : "" - } - def modelName = reqMap.requestDetails.modelInfo.modelName - def lcpCloudRegionId = reqMap.requestDetails.cloudConfiguration.lcpCloudRegionId - def tenantId = reqMap.requestDetails.cloudConfiguration.tenantId - def serviceId = reqMap.requestDetails.requestInfo.productFamilyId - def suppressRollback = reqMap.requestDetails.requestInfo.suppressRollback.toString() - def backoutOnFailure = "true" - if(suppressRollback != null){ - if (suppressRollback == true || suppressRollback == "true") { - backoutOnFailure = "false" - } else if (suppressRollback == false || suppressRollback == "false") { - backoutOnFailure = "true" - } - } - - //def userParams = reqMap.requestDetails.requestParameters.userParams - //def userParamsNode = buildUserParams(userParams) - def userParams = reqMap.requestDetails?.requestParameters?.userParams - def userParamsNode = '' - if(userParams != null) { - userParamsNode = buildUserParams(userParams) - } - - //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC) - def sdncVersion = execution.getVariable("sdncVersion") - - def xmlReq = """ - - - ${requestId} - ${requestAction} - VID - ${serviceInstanceId} - - - ${networkId} - ${instanceName} - ${modelName} - ${modelCustomizationId} - ${lcpCloudRegionId} - ${tenantId} - ${serviceId} - ${backoutOnFailure} - ${sdncVersion} - - - ${userParamsNode} - - - """ - // return a pretty-print of the volume-request xml without the preamble - return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") - - } catch(Exception e) { - throw e - } - } - - /** - * Create a network-request XML using a map, - * @param execution - * @return - */ - public String createXmlNetworkRequestInstance(execution) { - - def networkModelUuid = "" - def networkModelName = "" - def networkModelVersion = "" - def networkModelCustomizationUuid = "" - def networkModelInvariantUuid = "" - - // verify the DB Catalog response JSON structure - def networkModelInfo = execution.getVariable("networkModelInfo") - def jsonSlurper = new JsonSlurper() - if (networkModelInfo != null) { - try { - Map modelMap = jsonSlurper.parseText(networkModelInfo) - if (modelMap != null) { - if (networkModelInfo.contains("modelUuid")) { - networkModelUuid = modelMap.modelUuid !=null ? modelMap.modelUuid : "" - } - if (networkModelInfo.contains("modelName")) { - networkModelName = modelMap.modelName !=null ? modelMap.modelName : "" - } - if (networkModelInfo.contains("modelVersion")) { - networkModelVersion = modelMap.modelVersion !=null ? modelMap.modelVersion : "" - } - if (networkModelInfo.contains("modelCustomizationUuid")) { - networkModelCustomizationUuid = modelMap.modelCustomizationUuid !=null ? modelMap.modelCustomizationUuid : "" - } - if (networkModelInfo.contains("modelInvariantUuid")) { - networkModelInvariantUuid = modelMap.modelInvariantUuid !=null ? modelMap.modelInvariantUuid : "" - } - } - } catch (Exception ex) { - throw ex - } - } - - def serviceModelUuid = "" - def serviceModelName = "" - def serviceModelVersion = "" - def serviceModelCustomizationUuid = "" - def serviceModelInvariantUuid = "" - - // verify the DB Catalog response JSON structure - def serviceModelInfo = execution.getVariable("serviceModelInfo") - def jsonServiceSlurper = new JsonSlurper() - if (serviceModelInfo != null) { - try { - Map modelMap = jsonServiceSlurper.parseText(serviceModelInfo) - if (modelMap != null) { - if (serviceModelInfo.contains("modelUuid")) { - serviceModelUuid = modelMap.modelUuid !=null ? modelMap.modelUuid : "" - } - if (serviceModelInfo.contains("modelName")) { - serviceModelName = modelMap.modelName !=null ? modelMap.modelName : "" - } - if (serviceModelInfo.contains("modelVersion")) { - serviceModelVersion = modelMap.modelVersion !=null ? modelMap.modelVersion : "" - } - if (serviceModelInfo.contains("modelCustomizationUuid")) { - serviceModelCustomizationUuid = modelMap.modelCustomizationUuid !=null ? modelMap.modelCustomizationUuid : "" - } - if (serviceModelInfo.contains("modelInvariantUuid")) { - serviceModelInvariantUuid = modelMap.modelInvariantUuid !=null ? modelMap.modelInvariantUuid : "" - } - } - } catch (Exception ex) { - throw ex - } - } - - - def subscriptionServiceType = execution.getVariable("subscriptionServiceType") != null ? execution.getVariable("subscriptionServiceType") : "" - def globalSubscriberId = execution.getVariable("globalSubscriberId") != null ? execution.getVariable("globalSubscriberId") : "" - def requestId = execution.getVariable("msoRequestId") - def serviceInstanceId = execution.getVariable("serviceInstanceId") != null ? execution.getVariable("serviceInstanceId") : "" - def networkId = (execution.getVariable("networkId")) != null ? execution.getVariable("networkId") : "" // optional - def networkName = execution.getVariable("networkName") != null ? execution.getVariable("networkName") : "" // optional - def aicCloudReqion = execution.getVariable("lcpCloudRegionId") != null ? execution.getVariable("lcpCloudRegionId") : "" - def tenantId = execution.getVariable("tenantId") != null ? execution.getVariable("tenantId") : "" - def serviceId = execution.getVariable("productFamilyId") != null ? execution.getVariable("productFamilyId") : "" - def failIfExist = execution.getVariable("failIfExists") != null ? execution.getVariable("failIfExists") : "" - def suppressRollback = execution.getVariable("disableRollback") - def backoutOnFailure = "true" - if(suppressRollback != null){ - if (suppressRollback == true || suppressRollback == "true") { - backoutOnFailure = "false" - } else if (suppressRollback == false || suppressRollback == "false") { - backoutOnFailure = "true" - } - } - - //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC) - def sdncVersion = execution.getVariable("sdncVersion") - - def source = "VID" - def action = execution.getVariable("action") - - def userParamsNode = "" - def userParams = execution.getVariable("networkInputParams") - if(userParams != null) { - userParamsNode = buildUserParams(userParams) - } - - def xmlReq = """ - - - ${requestId} - ${action} - ${source} - ${serviceInstanceId} - - - ${networkId} - ${networkName} - ${networkModelName} - ${subscriptionServiceType} - ${globalSubscriberId} - ${aicCloudReqion} - ${tenantId} - ${serviceId} - ${backoutOnFailure} - ${failIfExist} - - ${networkModelName} - ${networkModelUuid} - ${networkModelInvariantUuid} - ${networkModelVersion} - ${networkModelCustomizationUuid} - - - ${serviceModelName} - ${serviceModelUuid} - ${serviceModelInvariantUuid} - ${serviceModelVersion} - ${serviceModelCustomizationUuid} - - - ${sdncVersion} - - - ${userParamsNode} - - - """ - // return a pretty-print of the volume-request xml without the preamble - return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") - - } - - /** - * Create a vnf-request XML using a map - * @param requestMap - map created from VID JSON - * @param action - * @return - */ - public String createXmlVfModuleRequest(execution, Map requestMap, String action, String serviceInstanceId) { - - //def relatedInstanceList = requestMap.requestDetails.relatedInstanceList - - //relatedInstanceList.each { - // if (it.relatedInstance.modelInfo.modelType == 'vnf') { - // vnfType = it.relatedInstance.modelInfo.modelName - // vnfId = it.relatedInstance.modelInfo.modelInvariantId - // } - //} - - def vnfName = '' - def asdcServiceModelInfo = '' - - def relatedInstanceList = requestMap.requestDetails?.relatedInstanceList - - - if (relatedInstanceList != null) { - relatedInstanceList.each { - if (it.relatedInstance.modelInfo?.modelType == 'service') { - asdcServiceModelInfo = it.relatedInstance.modelInfo?.modelVersion - } - if (it.relatedInstance.modelInfo.modelType == 'vnf') { - vnfName = it.relatedInstance.instanceName ?: '' - } - } - } - - def vnfType = execution.getVariable('vnfType') - def vnfId = execution.getVariable('vnfId') - - def vfModuleId = execution.getVariable('vfModuleId') - def volumeGroupId = execution.getVariable('volumeGroupId') - def userParams = requestMap.requestDetails?.requestParameters?.userParams - - - def userParamsNode = '' - if(userParams != null) { - userParamsNode = buildUserParams(userParams) - } - - def isBaseVfModule = "false" - if (execution.getVariable('isBaseVfModule') == true) { - isBaseVfModule = "true" - } - - def requestId = execution.getVariable("mso-request-id") - def vfModuleName = requestMap.requestDetails?.requestInfo?.instanceName ?: '' - def vfModuleModelName = requestMap.requestDetails?.modelInfo?.modelName ?: '' - def suppressRollback = requestMap.requestDetails?.requestInfo?.suppressRollback - - def backoutOnFailure = "" - if(suppressRollback != null){ - if ( suppressRollback == true) { - backoutOnFailure = "false" - } else if ( suppressRollback == false) { - backoutOnFailure = "true" - } - } - - def serviceId = requestMap.requestDetails?.requestParameters?.serviceId ?: '' - def aicCloudRegion = requestMap.requestDetails?.cloudConfiguration?.lcpCloudRegionId ?: '' - def tenantId = requestMap.requestDetails?.cloudConfiguration?.tenantId ?: '' - def personaModelId = requestMap.requestDetails?.modelInfo?.modelInvariantUuid ?: '' - def personaModelVersion = requestMap.requestDetails?.modelInfo?.modelUuid ?: '' - def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: '' - - def xmlReq = """ - - - ${requestId} - ${action} - VID - - ${serviceInstanceId} - - - - ${vnfName} - ${vnfType} - ${vnfId} - ${volumeGroupId} - ${vfModuleId} - ${vfModuleName} - ${vfModuleModelName} - ${modelCustomizationId} - ${isBaseVfModule} - ${asdcServiceModelInfo} - ${aicCloudRegion} - ${tenantId} - ${serviceId} - ${backoutOnFailure} - ${personaModelId} - ${personaModelVersion} - - - $userParamsNode - - - """ - - // return a pretty-print of the volume-request xml without the preamble - return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") - } - - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy deleted file mode 100644 index 5f2a845ef2..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy +++ /dev/null @@ -1,413 +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.bpmn.common.scripts - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - // VNF Response Processing - public void preProcessRequest (DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - def prefix="VNFREST_" - execution.setVariable("prefix", prefix) - setSuccessIndicator(execution, false) - - try { - String request = validateRequest(execution, "mso-request-id") - - // Get the request type (the name of the root element) from the request - - Node root = new XmlParser().parseText(request) - String requestType = root.name() - execution.setVariable(prefix + 'requestType', requestType) - logDebug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType, isDebugLogEnabled) - - utils.logAudit('VnfAdapterRestV1, request: ' + request) - // Get the messageId from the request - - String messageId = getChildText(root, 'messageId') - - if ('rollbackVolumeGroupRequest'.equals(requestType)) { - messageId = getMessageIdForVolumeGroupRollback(root) - } - - if (messageId == null || messageId.isEmpty()) { - String msg = getProcessKey(execution) + ': no messageId in ' + requestType - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - execution.setVariable('VNFAResponse_CORRELATOR', messageId) - logDebug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId, isDebugLogEnabled) - - // Get the notificationUrl from the request - - String notificationUrl = getChildText(root, 'notificationUrl') - - if (notificationUrl == null || notificationUrl.isEmpty()) { - String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - execution.setVariable(prefix + 'notificationUrl', notificationUrl) - logDebug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl, isDebugLogEnabled) - - // Determine the VnfAdapter endpoint - - String vnfAdapterEndpoint = execution.getVariable("URN_mso_adapters_vnf_rest_endpoint") - - if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) { - String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined' - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - while (vnfAdapterEndpoint.endsWith('/')) { - vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, vnfAdapterEndpoint.length()-1) - } - - String vnfAdapterMethod = null - String vnfAdapterUrl = null - String vnfAdapterRequest = request - - if ('createVfModuleRequest'.equals(requestType)) { - String vnfId = getChildText(root, 'vnfId') - - if (vnfId == null || vnfId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - vnfAdapterMethod = 'POST' - vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + '/vf-modules' - - } else if ('updateVfModuleRequest'.equals(requestType)) { - String vnfId = getChildText(root, 'vnfId') - - if (vnfId == null || vnfId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - String vfModuleId = getChildText(root, 'vfModuleId') - - if (vfModuleId == null || vfModuleId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - vnfAdapterMethod = 'PUT' - vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + - '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') - - } else if ('deleteVfModuleRequest'.equals(requestType)) { - String vnfId = getChildText(root, 'vnfId') - - if (vnfId == null || vnfId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - String vfModuleId = getChildText(root, 'vfModuleId') - - if (vfModuleId == null || vfModuleId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - vnfAdapterMethod = 'DELETE' - vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + - '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') - - } else if ('rollbackVfModuleRequest'.equals(requestType)) { - Node vfModuleRollbackNode = getChild(root, 'vfModuleRollback') - - if (vfModuleRollbackNode == null) { - String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - String vnfId = getChildText(vfModuleRollbackNode, 'vnfId') - - if (vnfId == null || vnfId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId') - - if (vfModuleId == null || vfModuleId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - vnfAdapterMethod = 'DELETE' - vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + - '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + '/rollback' - - } else if ('createVolumeGroupRequest'.equals(requestType)) { - vnfAdapterMethod = 'POST' - if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { - vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) - } - vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups' - - } else if ('updateVolumeGroupRequest'.equals(requestType)) { - String volumeGroupId = getChildText(root, 'volumeGroupId') - - if (volumeGroupId == null || volumeGroupId.isEmpty()) { - String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - vnfAdapterMethod = 'PUT' - if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { - vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) - } - vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') - - } else if ('deleteVolumeGroupRequest'.equals(requestType)) { - String volumeGroupId = getChildText(root, 'volumeGroupId') - - if (volumeGroupId == null || volumeGroupId.isEmpty()) { - String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - vnfAdapterMethod = 'DELETE' - if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { - vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) - } - vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') - - } else if ('rollbackVolumeGroupRequest'.equals(requestType)) { - String volumeGroupId = root.'volumeGroupRollback'.'volumeGroupId'.text() - - if (volumeGroupId == null || volumeGroupId.isEmpty()) { - String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - vnfAdapterMethod = 'DELETE' - if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { - vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) - } - vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + '/rollback' - - } else { - String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod) - logDebug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod, isDebugLogEnabled) - execution.setVariable(prefix + 'vnfAdapterUrl', vnfAdapterUrl) - logDebug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl, isDebugLogEnabled) - execution.setVariable(prefix + 'vnfAdapterRequest', vnfAdapterRequest) - logDebug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest, isDebugLogEnabled) - - // Get the Basic Auth credentials for the VnfAdapter - - String basicAuthValue = execution.getVariable("URN_mso_adapters_po_auth") - - if (basicAuthValue == null || basicAuthValue.isEmpty()) { - logError(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") - } else { - logDebug(getProcessKey(execution) + ": Obtained BasicAuth credentials for VnfAdapter:" + - basicAuthValue, isDebugLogEnabled) - try { - def encodedString = utils.getBasicAuth(basicAuthValue, execution.getVariable("URN_mso_msoKey")) - execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) - } catch (IOException ex) { - logError(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter") - } - } - - } catch (BpmnError e) { - logDebug(" Rethrowing MSOWorkflowException", isDebugLogEnabled) - throw e - } catch (Exception e) { - String msg = 'Caught exception in ' + method + ": " + e - logError(msg) - logDebug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - } - - public String getMessageIdForVolumeGroupRollback(Node root) { - return root.'volumeGroupRollback'.'messageId'.text() - } - - /** - * This method is used instead of an HTTP Connector task because the - * connector does not allow DELETE with a body. - */ - public void sendRequestToVnfAdapter(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String prefix = execution.getVariable('prefix') - - try { - String vnfAdapterMethod = execution.getVariable(prefix + 'vnfAdapterMethod') - String vnfAdapterUrl = execution.getVariable(prefix + 'vnfAdapterUrl') - String vnfAdapterRequest = execution.getVariable(prefix + 'vnfAdapterRequest') - - RESTConfig config = new RESTConfig(vnfAdapterUrl) - RESTClient client = new RESTClient(config). - addHeader("Content-Type", "application/xml"). - addAuthorizationHeader(execution.getVariable(prefix + "basicAuthHeaderValue")); - - APIResponse response; - - if ("GET".equals(vnfAdapterMethod)) { - response = client.httpGet() - } else if ("PUT".equals(vnfAdapterMethod)) { - response = client.httpPut(vnfAdapterRequest) - } else if ("POST".equals(vnfAdapterMethod)) { - response = client.httpPost(vnfAdapterRequest) - } else if ("DELETE".equals(vnfAdapterMethod)) { - response = client.httpDelete(vnfAdapterRequest) - } else { - String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatusCode()) - execution.setVariable(prefix + "vnfAdapterResponse", response.getResponseBodyAsString()) - } catch (BpmnError e) { - throw e - } catch (Exception e) { - String msg = 'Caught exception in ' + method + ": " + e - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - } - - public void processCallback(DelegateExecution execution){ - def method = getClass().getSimpleName() + '.processCallback(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String callback = execution.getVariable('VNFAResponse_MESSAGE') - - try { - logDebug(getProcessKey(execution) + ": received callback:\n" + callback, isDebugLogEnabled) - - // The XML callback is available to the calling flow in any case, - // even if a WorkflowException is generated. - execution.setVariable(getProcessKey(execution) + 'Response', callback) - // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead. - execution.setVariable("WorkflowResponse", callback) - - Node root = new XmlParser().parseText(callback) - if (root.name().endsWith('Exception')) { - vnfAdapterWorkflowException(execution, callback) - } - } catch (Exception e) { - e.printStackTrace() - callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback - String msg = "Received error from VnfAdapter: " + callback - logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled) - exceptionUtil.buildWorkflowException(execution, 7020, msg) - } - } - - /** - * Tries to parse the response as XML to extract the information to create - * a WorkflowException. If the response cannot be parsed, a more generic - * WorkflowException is created. - */ - public void vnfAdapterWorkflowException(DelegateExecution execution, Object response) { - try { - Node root = new XmlParser().parseText(response) - String category = getChildText(root, "category") - category = category == null || category.isEmpty() ? "" : " category='" + category + "'" - String message = getChildText(root, "message") - message = message == null || message.isEmpty() ? "" : " message='" + message + "'" - String rolledBack = getChildText(root, "rolledBack") - rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'" - exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() + - " from VnfAdapter:" + category + message + rolledBack); - } catch (Exception e) { - response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response - exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response) - } - } - - /** - * Gets the named child of the specified node. - * @param node the node - * @param name the child name - * @return the child node, or null if no such child exists - */ - private Node getChild(Node node, String name) { - for (Node child : node.children()) { - if (child.name() == name) { - return child - } - } - return null - } - - /** - * Gets the text of the named child of the specified node. - * @param node the node - * @param name the child name - * @return the child node text, or null if no such child exists - */ - private String getChildText(Node node, String name) { - Node child = getChild(node, name) - return child == null ? null : child.text() - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy deleted file mode 100644 index 9c1a472a67..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy +++ /dev/null @@ -1,86 +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.bpmn.common.scripts - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.openecomp.mso.bpmn.core.WorkflowException - -class VnfAdapterUtils { - - private AbstractServiceTaskProcessor taskProcessor - - public VnfAdapterUtils(AbstractServiceTaskProcessor taskProcessor) { - this.taskProcessor = taskProcessor - } - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - public void validateVnfResponse(DelegateExecution execution, String responseVar, String responseCodeVar, String errorResponseVar) { - def method = getClass().getSimpleName() + '.validateVnfResponse(' + - 'execution=' + execution.getId() + - ', responseVar=' + responseVar + - ', responseCodeVar=' + responseCodeVar + - ', errorResponseVar=' + errorResponseVar + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def prefix = execution.getVariable('prefix') - - def response = execution.getVariable(responseVar) - def responseCode = execution.getVariable(responseCodeVar) - def errorResponse = execution.getVariable(errorResponseVar) - - // The following if statement never appears to be true as any VNF Adapter error seems to be stored in 'errorResponse'. - // Also, the value is stored as a WorkflowException object, not a String. Added the else if to provide the proper - // functionality but leaving the original code in case it is hit under some circumstances. - if (response.contains("WorkflowException")) { - execution.setVariable(prefix + "ErrorResponse", response) - //execution.setVariable(prefix + "ResponseCode", responseCode) - taskProcessor.logDebug(" Sub Vnf flow Error WorkflowException Response - " + "\n" + response, isDebugLogEnabled) - throw new BpmnError("MSOWorkflowException") - } else if (errorResponse != null && errorResponse instanceof WorkflowException) { - // Not sure the variables with the associated prefix are still used - execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage()) - execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode()) - taskProcessor.logDebug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + - errorResponse.getErrorMessage(), isDebugLogEnabled) - // this is the important part to ensure we hit the Fallout Handler - throw new BpmnError("MSOWorkflowException") - } else if (errorResponse != null && errorResponse instanceof WorkflowException) { - // Not sure the variables with the associated prefix are still used - execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage()) - execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode()) - taskProcessor.logDebug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + - errorResponse.getErrorMessage(), isDebugLogEnabled) - // this is the important part to ensure we hit the Fallout Handler - throw new BpmnError("MSOWorkflowException") - } - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - taskProcessor.logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, 'Internal Error- Unable to validate VNF Response ' + e.getMessage()) - } - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java new file mode 100644 index 0000000000..d3ddc60d3e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.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.bpmn.appc.payload; + +import java.util.Optional; + +import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersHealthCheck; +import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersQuiesce; +import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersResumeTraffic; +import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersUpgrade; +import org.onap.so.bpmn.appc.payload.beans.HealthCheckAction; +import org.onap.so.bpmn.appc.payload.beans.QuiesceTrafficAction; +import org.onap.so.bpmn.appc.payload.beans.RequestParametersHealthCheck; +import org.onap.so.bpmn.appc.payload.beans.ResumeTrafficAction; +import org.onap.so.bpmn.appc.payload.beans.SnapshotAction; +import org.onap.so.bpmn.appc.payload.beans.StartStopAction; +import org.onap.so.bpmn.appc.payload.beans.UpgradeAction; +import org.onap.so.bpmn.core.json.JsonUtils; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class PayloadClient { + + protected static ObjectMapper mapper = new ObjectMapper(); + + private PayloadClient() {} + + public static Optional upgradeFormat(Optional payload, String vnfName) throws JsonProcessingException{ + UpgradeAction payloadResult = new UpgradeAction(); + ConfigurationParametersUpgrade configParams = new ConfigurationParametersUpgrade(); + String payloadString = payload.isPresent() ? payload.get() : ""; + String existingSoftware = JsonUtils.getJsonValue(payloadString, "existing-software-version"); + String newSoftware = JsonUtils.getJsonValue(payloadString, "new-software-version"); + configParams.setExistingSoftwareVersion(existingSoftware); + configParams.setNewSoftwareVersion(newSoftware); + configParams.setVnfName(vnfName); + payloadResult.setConfigurationParameters(configParams); + return Optional.of(mapper.writeValueAsString(payloadResult)); + } + + public static Optional resumeTrafficFormat(String vnfName) throws JsonProcessingException{ + ResumeTrafficAction payloadResult = new ResumeTrafficAction(); + ConfigurationParametersResumeTraffic configParams = new ConfigurationParametersResumeTraffic(); + configParams.setVnfName(vnfName); + payloadResult.setConfigurationParameters(configParams); + return Optional.of(mapper.writeValueAsString(payloadResult)); + } + + public static Optional quiesceTrafficFormat(Optional payload, String vnfName) throws JsonProcessingException{ + QuiesceTrafficAction payloadResult = new QuiesceTrafficAction(); + ConfigurationParametersQuiesce configParams = new ConfigurationParametersQuiesce(); + String payloadString = payload.isPresent() ? payload.get() : ""; + String operationsTimeout = JsonUtils.getJsonValue(payloadString, "operations-timeout"); + configParams.setOperationsTimeout(operationsTimeout); + configParams.setVnfName(vnfName); + payloadResult.setConfigurationParameters(configParams); + return Optional.of(mapper.writeValueAsString(payloadResult)); + } + + public static Optional startStopFormat(String aicIdentity) throws JsonProcessingException{ + StartStopAction payloadResult = new StartStopAction(); + payloadResult.setAicIdentity(aicIdentity); + return Optional.of(mapper.writeValueAsString(payloadResult)); + } + + public static Optional healthCheckFormat(String vnfName, String vnfHostIpAddress) throws JsonProcessingException{ + HealthCheckAction payloadResult = new HealthCheckAction(); + RequestParametersHealthCheck requestParams = new RequestParametersHealthCheck(); + ConfigurationParametersHealthCheck configParams = new ConfigurationParametersHealthCheck(); + requestParams.setVnfName(vnfName); + configParams.setVnfName(vnfName); + payloadResult.setConfigurationParameters(configParams); + payloadResult.setRequestParameters(requestParams); + return Optional.of(mapper.writeValueAsString(payloadResult)); + } + + public static Optional snapshotFormat(String vmId, String identityUrl)throws JsonProcessingException{ + SnapshotAction payloadResult = new SnapshotAction(); + payloadResult.setVmId(vmId); + payloadResult.setIdentityUrl(identityUrl); + return Optional.of(mapper.writeValueAsString(payloadResult)); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigModifyAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigModifyAction.java new file mode 100644 index 0000000000..3c39a8d66c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigModifyAction.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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"request-parameters", +"configuration-parameters" +}) +public class ConfigModifyAction { + +@JsonProperty("request-parameters") +private RequestParametersConfigModify requestParameters; +@JsonProperty("configuration-parameters") +private ConfigurationParametersConfigModify configurationParameters; + +@JsonProperty("request-parameters") +public RequestParametersConfigModify getRequestParameters() { +return requestParameters; +} + +@JsonProperty("request-parameters") +public void setRequestParameters(RequestParametersConfigModify requestParameters) { +this.requestParameters = requestParameters; +} + +@JsonProperty("configuration-parameters") +public ConfigurationParametersConfigModify getConfigurationParameters() { +return configurationParameters; +} + +@JsonProperty("configuration-parameters") +public void setConfigurationParameters(ConfigurationParametersConfigModify configurationParameters) { +this.configurationParameters = configurationParameters; +} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java new file mode 100644 index 0000000000..c88169bb80 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"node0_hostname", +"node0_backup_router_address" +}) +public class ConfigurationParametersConfigModify { + +@JsonProperty("node0_hostname") +private String node0Hostname; +@JsonProperty("node0_backup_router_address") +private String node0BackupRouterAddress; + +@JsonProperty("node0_hostname") +public String getNode0Hostname() { +return node0Hostname; +} + +@JsonProperty("node0_hostname") +public void setNode0Hostname(String node0Hostname) { +this.node0Hostname = node0Hostname; +} + +@JsonProperty("node0_backup_router_address") +public String getNode0BackupRouterAddress() { +return node0BackupRouterAddress; +} + +@JsonProperty("node0_backup_router_address") +public void setNode0BackupRouterAddress(String node0BackupRouterAddress) { +this.node0BackupRouterAddress = node0BackupRouterAddress; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java new file mode 100644 index 0000000000..a8964f3bc5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"vnf_name" +}) +public class ConfigurationParametersHealthCheck { + +@JsonProperty("vnf_name") +private String vnfName; + +@JsonProperty("vnf_name") +public String getVnfName() { +return vnfName; +} + +@JsonProperty("vnf_name") +public void setVnfName(String vnfName) { +this.vnfName = vnfName; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java new file mode 100644 index 0000000000..878a136962 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"vnf_name", +"operations_timeout" +}) +public class ConfigurationParametersQuiesce { + +@JsonProperty("vnf_name") +private String vnfName; +@JsonProperty("operations_timeout") +private String operationsTimeout; + +@JsonProperty("vnf_name") +public String getVnfName() { +return vnfName; +} + +@JsonProperty("vnf_name") +public void setVnfName(String vnfName) { +this.vnfName = vnfName; +} + +@JsonProperty("operations_timeout") +public String getOperationsTimeout() { +return operationsTimeout; +} + +@JsonProperty("operations_timeout") +public void setOperationsTimeout(String operationsTimeout) { +this.operationsTimeout = operationsTimeout; +} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java new file mode 100644 index 0000000000..6b5e59f2e0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"vnf_name" +}) +public class ConfigurationParametersResumeTraffic { + +@JsonProperty("vnf_name") +private String vnfName; + +@JsonProperty("vnf_name") +public String getVnfName() { +return vnfName; +} + +@JsonProperty("vnf_name") +public void setVnfName(String vnfName) { +this.vnfName = vnfName; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java new file mode 100644 index 0000000000..ff51b06dbe --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"vnf_name", +"existing-software-version", +"new-software-version" +}) +public class ConfigurationParametersUpgrade { +@JsonProperty("vnf_name") +private String vnfName; +@JsonProperty("existing-software-version") +private String existingSoftwareVersion; +@JsonProperty("new-software-version") +private String newSoftwareVersion; + +@JsonProperty("vnf_name") +public String getVnfName() { +return vnfName; +} + +@JsonProperty("vnf_name") +public void setVnfName(String vnfName) { +this.vnfName = vnfName; +} + +@JsonProperty("existing-software-version") +public String getExistingSoftwareVersion() { +return existingSoftwareVersion; +} + +@JsonProperty("existing-software-version") +public void setExistingSoftwareVersion(String existingSoftwareVersion) { +this.existingSoftwareVersion = existingSoftwareVersion; +} + +@JsonProperty("new-software-version") +public String getNewSoftwareVersion() { +return newSoftwareVersion; +} + +@JsonProperty("new-software-version") +public void setNewSoftwareVersion(String newSoftwareVersion) { +this.newSoftwareVersion = newSoftwareVersion; +} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/HealthCheckAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/HealthCheckAction.java new file mode 100644 index 0000000000..4d194650c4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/HealthCheckAction.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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"request-parameters", +"configuration-parameters" +}) +public class HealthCheckAction { + +@JsonProperty("request-parameters") +private RequestParametersHealthCheck requestParameters; +@JsonProperty("configuration-parameters") +private ConfigurationParametersHealthCheck configurationParameters; + +@JsonProperty("request-parameters") +public RequestParametersHealthCheck getRequestParameters() { +return requestParameters; +} + +@JsonProperty("request-parameters") +public void setRequestParameters(RequestParametersHealthCheck requestParameters) { +this.requestParameters = requestParameters; +} + +@JsonProperty("configuration-parameters") +public ConfigurationParametersHealthCheck getConfigurationParameters() { +return configurationParameters; +} + +@JsonProperty("configuration-parameters") +public void setConfigurationParameters(ConfigurationParametersHealthCheck configurationParameters) { +this.configurationParameters = configurationParameters; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/QuiesceTrafficAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/QuiesceTrafficAction.java new file mode 100644 index 0000000000..0b16c6ca90 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/QuiesceTrafficAction.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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"configuration-parameters" +}) +public class QuiesceTrafficAction { + +@JsonProperty("configuration-parameters") +private ConfigurationParametersQuiesce configurationParameters; + +@JsonProperty("configuration-parameters") +public ConfigurationParametersQuiesce getConfigurationParameters() { +return configurationParameters; +} + +@JsonProperty("configuration-parameters") +public void setConfigurationParameters(ConfigurationParametersQuiesce configurationParameters) { +this.configurationParameters = configurationParameters; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigModify.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigModify.java new file mode 100644 index 0000000000..58c9234d60 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigModify.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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"vnf-host-ip-address" +}) +public class RequestParametersConfigModify { + +@JsonProperty("vnf-host-ip-address") +private String vnfHostIpAddress; + +@JsonProperty("vnf-host-ip-address") +public String getVnfHostIpAddress() { +return vnfHostIpAddress; +} + +@JsonProperty("vnf-host-ip-address") +public void setVnfHostIpAddress(String vnfHostIpAddress) { +this.vnfHostIpAddress = vnfHostIpAddress; +} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java new file mode 100644 index 0000000000..ca87ad6d15 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"vnf-name" +}) +public class RequestParametersHealthCheck { + +@JsonProperty("vnf-name") +private String vnfName; + + +@JsonProperty("vnf-name") +public String getVnfName() { +return vnfName; +} + +@JsonProperty("vnf-name") +public void setVnfName(String vnfName) { +this.vnfName = vnfName; +} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ResumeTrafficAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ResumeTrafficAction.java new file mode 100644 index 0000000000..b642a376fe --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ResumeTrafficAction.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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"configuration-parameters" +}) +public class ResumeTrafficAction { + +@JsonProperty("configuration-parameters") +private ConfigurationParametersResumeTraffic configurationParameters; + +@JsonProperty("configuration-parameters") +public ConfigurationParametersResumeTraffic getConfigurationParameters() { +return configurationParameters; +} + +@JsonProperty("configuration-parameters") +public void setConfigurationParameters(ConfigurationParametersResumeTraffic configurationParameters) { +this.configurationParameters = configurationParameters; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/SnapshotAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/SnapshotAction.java new file mode 100644 index 0000000000..0499e5d6c0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/SnapshotAction.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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"vm-id", +"identity-url" +}) +public class SnapshotAction { + +@JsonProperty("vm-id") +private String vmId; +@JsonProperty("identity-url") +private String identityUrl; + +@JsonProperty("vm-id") +public String getVmId() { +return vmId; +} + +@JsonProperty("vm-id") +public void setVmId(String vmId) { +this.vmId = vmId; +} + +@JsonProperty("identity-url") +public String getIdentityUrl() { +return identityUrl; +} + +@JsonProperty("identity-url") +public void setIdentityUrl(String identityUrl) { +this.identityUrl = identityUrl; +} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/StartStopAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/StartStopAction.java new file mode 100644 index 0000000000..f2b5b905a5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/StartStopAction.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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + " AICIdentity " +}) +public class StartStopAction { + + @JsonProperty(" AICIdentity ") + private String aicIdentity; + + @JsonProperty(" AICIdentity ") + public String getAicIdentity() { + return aicIdentity; + } + + @JsonProperty(" AICIdentity ") + public void setAicIdentity(String aicIdentity) { + this.aicIdentity = aicIdentity; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/UpgradeAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/UpgradeAction.java new file mode 100644 index 0000000000..3e07f328ce --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/UpgradeAction.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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"configuration-parameters" +}) +public class UpgradeAction { + +@JsonProperty("configuration-parameters") +private ConfigurationParametersUpgrade configurationParameters; + +@JsonProperty("configuration-parameters") +public ConfigurationParametersUpgrade getConfigurationParameters() { +return configurationParameters; +} + +@JsonProperty("configuration-parameters") +public void setConfigurationParameters(ConfigurationParametersUpgrade configurationParameters) { +this.configurationParameters = configurationParameters; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/ActionPreProcessor.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/ActionPreProcessor.java new file mode 100644 index 0000000000..19ab520c6c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/ActionPreProcessor.java @@ -0,0 +1,45 @@ +/*- + * ============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.bpmn.common; + + +import org.camunda.bpm.engine.delegate.DelegateExecution; + +/** + * interface to be extended by the classes, where pre processing is required + */ +public interface ActionPreProcessor { + + /** + * method to bind and return the action + * + * @return + */ + String getAction(); + + /** + * method to preform certain pre processing task before BB execution + * + * @param execution + * @return + */ + boolean process(DelegateExecution execution); +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java new file mode 100644 index 0000000000..a2f6637b5b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.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.bpmn.common; + +import java.io.Serializable; +import java.util.Map; + +import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; + +public interface BuildingBlockExecution { + + public GeneralBuildingBlock getGeneralBuildingBlock(); + public T getVariable(String key); + public T getRequiredVariable(String key) throws RequiredExecutionVariableExeception; + public void setVariable(String key, Serializable value); + public Map getLookupMap(); +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGenerator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGenerator.java new file mode 100644 index 0000000000..5a126ffe7d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGenerator.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.AnnotationBeanNameGenerator; +import org.springframework.util.ClassUtils; + +public class DefaultToShortClassNameBeanNameGenerator extends AnnotationBeanNameGenerator { + + @Override + protected String buildDefaultBeanName(BeanDefinition definition) { + return ClassUtils.getShortName(definition.getBeanClassName()); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java new file mode 100644 index 0000000000..ef564c6af4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.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.bpmn.common; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.common.exceptions.MalformedBuildingBlockInputException; +import org.onap.so.bpmn.common.exceptions.MissingBuildingBlockInputException; +import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; + +public class DelegateExecutionImpl implements BuildingBlockExecution, Serializable { + + private final Map seedMap; + private transient DelegateExecution execution; + private static final String INVALID_INPUT_MISSING = "Expected variable of \"%s\" not found in execution"; + private static final String INVALID_INPUT_CLASS_CAST = "Expected variable of \"%s\" was the wrong object type in the execution"; + + private static final String MISSING_MSG = "Execution variable \"gBBInput\" cannot be null when executing building blocks"; + private static final String MALFORMED_MSG = "Execution variable \"gBBInput\" must contain an element of type GeneralBuildingBlock"; + + public DelegateExecutionImpl(Map seedMap) { + this.seedMap = seedMap; + } + + public DelegateExecutionImpl(DelegateExecution execution) { + this.seedMap = new HashMap<>(); + execution.getVariables().forEach((key, value) -> { + if (value instanceof Serializable) { + seedMap.put(key, (Serializable)value); + } + }); + /* must occur for junit tests to work */ + this.execution = execution; + } + @Override + public GeneralBuildingBlock getGeneralBuildingBlock() { + try { + GeneralBuildingBlock generalBuildingBlock = (GeneralBuildingBlock) execution.getVariable("gBBInput"); + + if (generalBuildingBlock == null) { + throw new MissingBuildingBlockInputException(MISSING_MSG); + } + + return generalBuildingBlock; + } catch (ClassCastException e) { + throw new MalformedBuildingBlockInputException(MALFORMED_MSG, e); + } + } + + @Override + public T getVariable(String key) { + return this.get(key); + } + + @Override + public T getRequiredVariable(String key) throws RequiredExecutionVariableExeception { + final T result; + + result = this.get(key); + if (result == null) { + throw new RequiredExecutionVariableExeception(String.format(INVALID_INPUT_MISSING, key)); + + } + return result; + } + + @Override + public void setVariable(String key, Serializable value) { + this.execution.setVariable(key, value); + } + + @Override + public Map getLookupMap() { + return this.get("lookupKeyMap"); + } + + public DelegateExecution getDelegateExecution() { + return this.execution; + } + + public void setDelegateExecution(DelegateExecution execution) { + this.execution = execution; + this.seedMap.forEach((key, value) -> { + if (!execution.hasVariable(key)) { + execution.setVariable(key, value); + } + }); + } + + protected T get(String key) { + final Object value = this.execution.getVariable(key); + + return (T)value; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectExecution.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectExecution.java new file mode 100644 index 0000000000..56b059ec16 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectExecution.java @@ -0,0 +1,34 @@ +/*- + * ============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.bpmn.common; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.springframework.stereotype.Component; + +@Component +public class InjectExecution { + + public DelegateExecutionImpl execute (DelegateExecution execution, DelegateExecutionImpl impl) { + + impl.setDelegateExecution(execution); + return impl; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java new file mode 100644 index 0000000000..f1c2c8dda6 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java @@ -0,0 +1,60 @@ +/*- + * ============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.bpmn.common; + +import org.onap.so.client.aai.AAICommonObjectMapperProvider; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.sdno.SDNOValidator; +import org.onap.so.client.sdno.SDNOValidatorImpl; +import org.springframework.stereotype.Component; + +/* + * This object is intended to be a helper for acquiring classes + * that cannot be acquired via Spring injection. + * + * It brings two benefits: + * + * 1) Enforces acquisition of a new copy of these classes every + * time to help with picking up properties files changes, etc + * 2) The classes are exposed in such a way that mocks of them can + * still be injected when testing the Spring objects that use + * them + */ + +@Component +public class InjectionHelper { + public AAIResourcesClient getAaiClient() { + return new AAIResourcesClient(); + } + + public SDNOValidator getSdnoValidator() { + return new SDNOValidatorImpl(); + } + + public AAICommonObjectMapperProvider getAaiCommonObjectMapperProvider() { + return new AAICommonObjectMapperProvider(); + } + + public AAIResultWrapper getAaiResultWrapper(String json) { + return new AAIResultWrapper(json); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/SpringContextHelper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/SpringContextHelper.java new file mode 100644 index 0000000000..edc544d939 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/SpringContextHelper.java @@ -0,0 +1,41 @@ +/*- + * ============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.bpmn.common; + +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/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MalformedBuildingBlockInputException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MalformedBuildingBlockInputException.java new file mode 100644 index 0000000000..1da989bfb7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MalformedBuildingBlockInputException.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.bpmn.common.exceptions; + +public class MalformedBuildingBlockInputException extends RuntimeException { + private static final long serialVersionUID = -9168146273898271648L; + + public MalformedBuildingBlockInputException() { + super(); + } + + public MalformedBuildingBlockInputException(String message) { + super(message); + } + + public MalformedBuildingBlockInputException(String message, Throwable cause) { + super(message, cause); + } + + public MalformedBuildingBlockInputException(Throwable cause) { + super(cause); + } + + protected MalformedBuildingBlockInputException(String message, Throwable cause, + boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MissingBuildingBlockInputException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MissingBuildingBlockInputException.java new file mode 100644 index 0000000000..5ad28a5ba0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MissingBuildingBlockInputException.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.bpmn.common.exceptions; + +public class MissingBuildingBlockInputException extends RuntimeException { + private static final long serialVersionUID = 7098084383189271401L; + + public MissingBuildingBlockInputException() { + super(); + } + + public MissingBuildingBlockInputException(String message) { + super(message); + } + + public MissingBuildingBlockInputException(String message, Throwable cause) { + super(message, cause); + } + + public MissingBuildingBlockInputException(Throwable cause) { + super(cause); + } + + protected MissingBuildingBlockInputException(String message, Throwable cause, + boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/RequiredExecutionVariableExeception.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/RequiredExecutionVariableExeception.java new file mode 100644 index 0000000000..8c77bb445e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/RequiredExecutionVariableExeception.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.bpmn.common.exceptions; + +public class RequiredExecutionVariableExeception extends Exception { + + private static final long serialVersionUID = 5135274986874563746L; + + public RequiredExecutionVariableExeception(String message) { + super(message); + } + + public RequiredExecutionVariableExeception(String message, Throwable t) { + super(message, t); + } + + public RequiredExecutionVariableExeception(Throwable t) { + super(t); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnIntegerParam.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnIntegerParam.java new file mode 100644 index 0000000000..80479e19c0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnIntegerParam.java @@ -0,0 +1,48 @@ +/*- + * ============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.bpmn.common.recipe; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class BpmnIntegerParam { + + @JsonProperty("value") + private int value; + @JsonProperty("type") + private final String type = "Integer"; + + public BpmnIntegerParam() { + } + + @JsonProperty("value") + public int getValue() { + return value; + } + + @JsonProperty("type") + public void setValue(int value) { + this.value = value; + } + + @Override + public String toString() { + return "CamundaInput [value=" + Integer.toString(value) + ", type=" + type + "]"; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnParam.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnParam.java new file mode 100644 index 0000000000..01285cd5ec --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnParam.java @@ -0,0 +1,54 @@ +/*- + * ============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.bpmn.common.recipe; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The bpmn workflow input param object + */ +public class BpmnParam { + + @JsonProperty("value") + private String value; + @JsonProperty("type") + private String type = "String"; + + + public BpmnParam() { + /* Empty constructor */ + } + + @JsonProperty("value") + public String getValue() { + return value; + } + + @JsonProperty("value") + public void setValue(String value) { + this.value = value; + } + + @Override + public String toString() { + return "CamundaInput [value=" + value + ", type=" + type + "]"; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java new file mode 100644 index 0000000000..bbaebb64dc --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java @@ -0,0 +1,205 @@ +/*- + * ============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.bpmn.common.recipe; + +import java.io.IOException; +import java.security.GeneralSecurityException; + +import javax.xml.bind.DatatypeConverter; + +import org.apache.http.HttpResponse; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClientBuilder; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.CryptoUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Support to call resource recipes from the BPMN workflow. + * Such as call resource recipe in service workflow. + *
+ *

+ *

+ * + * @author + * @version ONAP Beijing Release 2018-02-27 + */ +@Component +public class BpmnRestClient { + + public static final String DEFAULT_BPEL_AUTH = "admin:admin"; + + public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + + public static final String CONTENT_TYPE_JSON = "application/json"; + + public static final String CAMUNDA_AUTH = "camundaAuth"; + + private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; + @Autowired + private UrnPropertiesReader urnPropertiesReader; + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BpmnRestClient.class); + + private static boolean noProperties = true; + + //because for NS it will take a long time the time out of the resouce will be 2 hours. + private static final String DEFAULT_TIME_OUT = "7200"; + + public synchronized final boolean getNoPropertiesState() { + return noProperties; + } + + /** + * post the recipe Uri + *
+ * + * @param recipeUri The request recipe uri + * @param requestId the request id + * @param recipeTimeout The recipe time out + * @param requestAction The request action + * @param serviceInstanceId The service instance id + * @param serviceType The service Type + * @param requestDetails The request Details, these information is from runtime + * @param recipeParamXsd The recipe params, its from recipe design + * @return The response of the recipe. + * @throws ClientProtocolException + * @throws IOException + * @since ONAP Beijing Release + */ + public HttpResponse post(String recipeUri, String requestId, int recipeTimeout, String requestAction, String serviceInstanceId, String serviceType, + String requestDetails, String recipeParamXsd) throws ClientProtocolException, IOException { + + HttpClient client = HttpClientBuilder.create().build(); + + HttpPost post = new HttpPost(recipeUri); + RequestConfig requestConfig = + RequestConfig.custom().setSocketTimeout(recipeTimeout).setConnectTimeout(recipeTimeout).setConnectionRequestTimeout(recipeTimeout).build(); + post.setConfig(requestConfig); + msoLogger.debug("call the bpmn, url:" + recipeUri); + String jsonReq = wrapResourceRequest(requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, requestDetails, recipeParamXsd); + + StringEntity input = new StringEntity(jsonReq); + input.setContentType(CONTENT_TYPE_JSON); + String encryptedCredentials; + encryptedCredentials = urnPropertiesReader.getVariable(CAMUNDA_AUTH); + if(encryptedCredentials != null) { + String userCredentials = getEncryptedPropValue(encryptedCredentials, DEFAULT_BPEL_AUTH, ENCRYPTION_KEY); + if(userCredentials != null) { + post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes())); + } + } + + post.setEntity(input); + return client.execute(post); + } + + /** + * prepare the resource recipe bpmn request. + *
+ * + * @param requestId + * @param recipeTimeout + * @param requestAction + * @param serviceInstanceId + * @param serviceType + * @param requestDetails + * @param recipeParams + * @return + * @since ONAP Beijing Release + */ + private String wrapResourceRequest(String requestId, int recipeTimeout, String requestAction, String serviceInstanceId, String serviceType, + String requestDetails, String recipeParams) { + String jsonReq = null; + if(requestId == null) { + requestId = ""; + } + if(requestAction == null) { + requestAction = ""; + } + if(serviceInstanceId == null) { + serviceInstanceId = ""; + } + + if(requestDetails == null) { + requestDetails = ""; + } + + try { + ResourceRecipeRequest recipeRequest = new ResourceRecipeRequest(); + BpmnParam resourceInput = new BpmnParam(); + BpmnParam host = new BpmnParam(); + BpmnParam requestIdInput = new BpmnParam(); + BpmnParam requestActionInput = new BpmnParam(); + BpmnParam serviceInstanceIdInput = new BpmnParam(); + BpmnParam serviceTypeInput = new BpmnParam(); + BpmnParam recipeParamsInput = new BpmnParam(); + BpmnIntegerParam recipeTimeoutInput = new BpmnIntegerParam(); + recipeTimeoutInput.setValue(recipeTimeout); + // host.setValue(parseURL()); + requestIdInput.setValue(requestId); + requestActionInput.setValue(requestAction); + serviceInstanceIdInput.setValue(serviceInstanceId); + serviceTypeInput.setValue(serviceType); + recipeParamsInput.setValue(recipeParams); + resourceInput.setValue(requestDetails); + recipeRequest.setHost(host); + recipeRequest.setRequestId(requestIdInput); + recipeRequest.setRequestAction(requestActionInput); + recipeRequest.setServiceInstanceId(serviceInstanceIdInput); + recipeRequest.setServiceType(serviceTypeInput); + recipeRequest.setRecipeParams(recipeParamsInput); + recipeRequest.setResourceInput(resourceInput); + recipeRequest.setRecipeTimeout(recipeTimeoutInput); + jsonReq = recipeRequest.toString(); + 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; + } + + /** + *
+ * + * @param prop + * @param defaultValue + * @param encryptionKey + * @return + * @since ONAP Beijing Release + */ + 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/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java new file mode 100644 index 0000000000..4c345babc8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java @@ -0,0 +1,295 @@ +/*- + * ============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.bpmn.common.recipe; + +import org.onap.so.bpmn.core.domain.ModelInfo; +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +/** + * the inputs for the resource recipe + *
+ *

+ *

+ * + * @author + * @version ONAP Beijing Release 2018-03-08 + */ +@JsonPropertyOrder({"resourceInstanceName", "resourceInstanceDes", "globalSubscriberId", "serviceType", "serviceId", "operationId", "serviceModelInfo","resourceModelInfo", "resourceInstancenUuid","resourceParameters","operationType"}) +@JsonRootName("variables") +public class ResourceInput { + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, ResourceInput.class); + + @JsonProperty("resourceInstanceName") + private String resourceInstanceName; + + @JsonProperty("resourceInstanceDes") + private String resourceInstanceDes; + + @JsonProperty("globalSubscriberId") + private String globalSubscriberId; + + @JsonProperty("serviceType") + private String serviceType; + + @JsonProperty("serviceInstanceId") + private String serviceInstanceId; + + @JsonProperty("operationId") + private String operationId; + + @JsonProperty("serviceModelInfo") + private ModelInfo serviceModelInfo; + + @JsonProperty("resourceModelInfo") + private ModelInfo resourceModelInfo; + + //for delete resource + @JsonProperty("resourceInstancenUuid") + private String resourceInstancenUuid; + + @JsonProperty("resourceParameters") + private String resourceParameters; + + @JsonProperty("operationType") + private String operationType; + + + /** + * @return Returns the resourceInstanceName. + */ + @JsonProperty("resourceInstanceName") + public String getResourceInstanceName() { + return resourceInstanceName; + } + + + /** + * @param resourceInstanceName The resourceInstanceName to set. + */ + @JsonProperty("resourceInstanceName") + public void setResourceInstanceName(String resourceInstanceName) { + this.resourceInstanceName = resourceInstanceName; + } + + + /** + * @return Returns the resourceInstanceDes. + */ + @JsonProperty("resourceInstanceDes") + public String getResourceInstanceDes() { + return resourceInstanceDes; + } + + + /** + * @param resourceInstanceDes The resourceInstanceDes to set. + */ + @JsonProperty("resourceInstanceDes") + public void setResourceInstanceDes(String resourceInstanceDes) { + this.resourceInstanceDes = resourceInstanceDes; + } + + + /** + * @return Returns the globalSubscriberId. + */ + @JsonProperty("globalSubscriberId") + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + + + /** + * @param globalSubscriberId The globalSubscriberId to set. + */ + @JsonProperty("globalSubscriberId") + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + + + /** + * @return Returns the serviceType. + */ + @JsonProperty("serviceType") + public String getServiceType() { + return serviceType; + } + + + /** + * @param serviceType The serviceType to set. + */ + @JsonProperty("serviceType") + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + + /** + * @return Returns the serviceId. + */ + @JsonProperty("serviceInstanceId") + public String getServiceInstanceId() { + return serviceInstanceId; + } + + + /** + * @param serviceId The serviceId to set. + */ + @JsonProperty("serviceInstanceId") + public void setServiceInstanceId(String serviceId) { + this.serviceInstanceId = serviceId; + } + + + /** + * @return Returns the operationId. + */ + @JsonProperty("operationId") + public String getOperationId() { + return operationId; + } + + + /** + * @param operationId The operationId to set. + */ + @JsonProperty("operationId") + public void setOperationId(String operationId) { + this.operationId = operationId; + } + + /** + * @return Returns the serviceModelInfo. + */ + @JsonProperty("serviceModelInfo") + public ModelInfo getServiceModelInfo() { + return serviceModelInfo; + } + + + + /** + * @param serviceModelInfo The serviceModelInfo to set. + */ + @JsonProperty("serviceModelInfo") + public void setServiceModelInfo(ModelInfo serviceModelInfo) { + this.serviceModelInfo = serviceModelInfo; + } + + + + /** + * @return Returns the resourceModelInfo. + */ + @JsonProperty("resourceModelInfo") + public ModelInfo getResourceModelInfo() { + return resourceModelInfo; + } + + + + /** + * @param resourceModelInfo The resourceModelInfo to set. + */ + @JsonProperty("resourceModelInfo") + public void setResourceModelInfo(ModelInfo resourceModelInfo) { + this.resourceModelInfo = resourceModelInfo; + } + + + /** + * @return Returns the resourceParameters. + */ + @JsonProperty("resourceParameters") + public String getResourceParameters() { + return resourceParameters; + } + + + /** + * @param resourceParameters The resourceParameters to set. + */ + @JsonProperty("resourceParameters") + public void setResourceParameters(String resourceParameters) { + this.resourceParameters = resourceParameters; + } + + + /** + * @return Returns the operationType. + */ + @JsonProperty("operationType") + public String getOperationType() { + return operationType; + } + + + /** + * @param operationType The operationType to set. + */ + @JsonProperty("operationType") + public void setOperationType(String operationType) { + this.operationType = operationType; + } + + + + /** + * @return Returns the resourceInstancenUuid. + */ + @JsonProperty("resourceInstancenUuid") + public String getResourceInstancenUuid() { + return resourceInstancenUuid; + } + + + + /** + * @param resourceInstancenUuid The resourceInstancenUuid to set. + */ + @JsonProperty("resourceInstancenUuid") + public void setResourceInstancenUuid(String resourceInstancenUuid) { + this.resourceInstancenUuid = resourceInstancenUuid; + } + + @Override + public String toString() { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); + String jsonStr = ""; + try { + jsonStr = mapper.writeValueAsString(this); + } catch(JsonProcessingException e) { + msoLogger.error("JsonProcessingException", e); + } + return jsonStr; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java new file mode 100644 index 0000000000..4c6edfa099 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java @@ -0,0 +1,159 @@ +/*- + * ============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.bpmn.common.recipe; + +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +/** + * java object of the resource recipe , it + * will be passed to the Camunda process + */ +@JsonPropertyOrder({"resourceInput", "host", "requestId", "requestAction", "serviceInstanceId", "serviceType", "recipeParams"}) +@JsonRootName("variables") +public class ResourceRecipeRequest { + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, ResourceRecipeRequest.class); + + @JsonProperty("resourceInput") + private BpmnParam resourceInput; + + @JsonProperty("host") + private BpmnParam host; + + @JsonProperty("mso-request-id") + private BpmnParam requestId; + + @JsonProperty("requestAction") + private BpmnParam requestAction; + + @JsonProperty("serviceInstanceId") + private BpmnParam serviceInstanceId; + + @JsonProperty("serviceType") + private BpmnParam serviceType; + + @JsonProperty("recipeParams") + private BpmnParam recipeParams; + + @JsonProperty("mso-service-request-timeout") + private BpmnIntegerParam recipeTimeout; + + @JsonProperty("resourceInput") + public BpmnParam getResourceInput() { + return resourceInput; + } + + @JsonProperty("resourceInput") + public void setResourceInput(BpmnParam resourceInput) { + this.resourceInput = resourceInput; + } + + @JsonProperty("host") + public BpmnParam getHost() { + return host; + } + + @JsonProperty("host") + public void setHost(BpmnParam host) { + this.host = host; + } + + @JsonProperty("mso-request-id") + public BpmnParam getRequestId() { + return requestId; + } + + @JsonProperty("mso-request-id") + public void setRequestId(BpmnParam requestId) { + this.requestId = requestId; + } + + @JsonProperty("requestAction") + public BpmnParam getRequestAction() { + return requestAction; + } + + @JsonProperty("requestAction") + public void setRequestAction(BpmnParam requestAction) { + this.requestAction = requestAction; + } + + @JsonProperty("serviceInstanceId") + public BpmnParam getServiceInstanceId() { + return serviceInstanceId; + } + + @JsonProperty("serviceInstanceId") + public void setServiceInstanceId(BpmnParam serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + @JsonProperty("serviceType") + public BpmnParam getServiceType() { + return serviceType; + } + + @JsonProperty("serviceType") + public void setServiceType(BpmnParam serviceType) { + this.serviceType = serviceType; + } + + @JsonProperty("recipeParams") + public BpmnParam getRecipeParams() { + return recipeParams; + } + + @JsonProperty("recipeParams") + public void setRecipeParams(BpmnParam recipeParams) { + this.recipeParams = recipeParams; + } + + @JsonProperty("mso-service-request-timeout") + public BpmnIntegerParam getRecipeTimeout() { + return recipeTimeout; + } + + @JsonProperty("mso-service-request-timeout") + public void setRecipeTimeout(BpmnIntegerParam recipeTimeout) { + this.recipeTimeout = recipeTimeout; + } + + @Override + public String toString() { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + String jsonStr = "ResourceRecipeRequest"; + try { + jsonStr = mapper.writeValueAsString(this); + } catch(JsonProcessingException e) { + msoLogger.error("JsonProcessingException", e); + } + return jsonStr; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java new file mode 100644 index 0000000000..ca2da772fb --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -0,0 +1,225 @@ +/*- + * ============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.bpmn.common.resource; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; + +import org.camunda.bpm.engine.runtime.Execution; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException; +import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory; +import org.onap.sdc.toscaparser.api.NodeTemplate; +import org.onap.sdc.toscaparser.api.Property; +import org.onap.sdc.toscaparser.api.functions.GetInput; +import org.onap.sdc.toscaparser.api.parameters.Input; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.client.HttpClient; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +public class ResourceRequestBuilder { + + public static String CUSTOMIZATION_UUID = "customizationUUID"; + + public static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar?serviceModelUuid="; + + private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ResourceRequestBuilder.class); + + static JsonUtils jsonUtil = new JsonUtils(); + + /** + * build the resource Parameters detail. + * It's a json string for resource instantiant + * { + * "locationConstraints":[...] + * "requestInputs":{K,V} + * } + *
+ * + * @param execution Execution context + * @param serviceUuid The service template uuid + * @param resourceCustomizationUuid The resource customization uuid + * @param serviceParameters the service parameters passed from the API + * @return the resource instantiate parameters + * @since ONAP Beijing Release + */ + @SuppressWarnings("unchecked") + public static String buildResourceRequestParameters(Execution execution, String serviceUuid, String resourceCustomizationUuid, String serviceParameters) { + List resourceList = jsonUtil.StringArrayToList(execution, (String)JsonUtils.getJsonValue(serviceParameters, "resources")); + //Get the right location str for resource. default is an empty array. + String locationConstraints ="[]"; + String resourceInputsFromUui = ""; + for(String resource: resourceList){ + String resCusUuid = (String)JsonUtils.getJsonValue(resource, "resourceCustomizationUuid"); + if(resourceCustomizationUuid.equals(resCusUuid)){ + String resourceParameters = JsonUtils.getJsonValue(resource, "parameters"); + locationConstraints = JsonUtils.getJsonValue(resourceParameters, "locationConstraints"); + resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs"); + } + } + Map serviceInput = null; + if (JsonUtils.getJsonValue(serviceParameters, "requestInputs") != null) { + serviceInput = getJsonObject((String)JsonUtils.getJsonValue(serviceParameters, "requestInputs"), Map.class); + } + + Map resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class); + + if (serviceInput == null) { + serviceInput = new HashMap(); + } + + if (resourceInputsFromUuiMap == null) { + resourceInputsFromUuiMap = new HashMap(); + } + + try { + Map resourceInputsFromServiceDeclaredLevel = buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput); + resourceInputsFromUuiMap.putAll(resourceInputsFromServiceDeclaredLevel); + } catch(SdcToscaParserException e) { + LOGGER.error("SdcToscaParserException", e); + } + String resourceInputsStr = getJsonString(resourceInputsFromUuiMap); + String result = "{\n" + + "\"locationConstraints\":" + locationConstraints +",\n" + + "\"requestInputs\":" + resourceInputsStr +"\n" + +"}"; + return result; + } + + public static Map buildResouceRequest(String serviceUuid, String resourceCustomizationUuid, Map serviceInputs) + throws SdcToscaParserException { + + Map resouceRequest = new HashMap<>(); + + String csarpath = null; + try { + csarpath = getCsarFromUuid(serviceUuid); + } catch(Exception e) { + LOGGER.debug("csar file is not available for service uuid:" + serviceUuid, e); + return resouceRequest; + } + + SdcToscaParserFactory toscaParser = SdcToscaParserFactory.getInstance(); + ISdcCsarHelper iSdcCsarHelper = toscaParser.getSdcCsarHelper(csarpath, false); + + List serInput = iSdcCsarHelper.getServiceInputs(); + Optional nodeTemplateOpt = iSdcCsarHelper.getServiceNodeTemplates().stream() + .filter(e -> e.getMetaData().getValue(CUSTOMIZATION_UUID).equals(resourceCustomizationUuid)).findFirst(); + + if(nodeTemplateOpt.isPresent()) { + NodeTemplate nodeTemplate = nodeTemplateOpt.get(); + LinkedHashMap resourceProperties = nodeTemplate.getProperties(); + + for(String key : resourceProperties.keySet()) { + Property property = resourceProperties.get(key); + + Object value = getValue(property.getValue(), serviceInputs, serInput); + resouceRequest.put(key, value); + } + } + return resouceRequest; + } + + private static Object getValue(Object value, Map serviceInputs, List servInputs) { + if(value instanceof Map) { + Map valueMap = new HashMap<>(); + + Map propertyMap = (Map)value; + + for(String key : propertyMap.keySet()) { + valueMap.put(key, getValue(propertyMap.get(key), serviceInputs, servInputs)); + } + return valueMap; // return if the value is nested hashmap + } else if(value instanceof GetInput) { + String inputName = ((GetInput)value).getInputName(); + + if(serviceInputs.get(inputName) != null) { + value = serviceInputs.get(inputName); + } else { + for(Input input : servInputs) { + if(input.getName().equals(inputName)) { + return input.getDefault(); // return default value + } + } + } + } + return value; // return property value + } + + private static String getCsarFromUuid(String uuid) throws Exception { + String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint"); + HttpClient client = new HttpClient(UriBuilder.fromUri(catalogEndPoint + SERVICE_URL_TOSCA_CSAR + uuid).build().toURL(), "application/json", TargetEntity.CATALOG_DB); + + Response response = client.get(); + String value = response.readEntity(String.class); + + HashMap map = new Gson().fromJson(value, new TypeToken>() {}.getType()); + + File csarFile = new File(System.getProperty("mso.config.path") + "ASDC/" + map.get("name")); + + if(!csarFile.exists()) { + throw new Exception("csar file does not exist."); + } + + return csarFile.getAbsolutePath(); + } + + public static T getJsonObject(String jsonstr, Class type) { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + try { + return mapper.readValue(jsonstr, type); + } catch(IOException e) { + LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "fail to unMarshal json", e); + } + return null; + } + + public static String getJsonString(Object srcObj) { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); + String jsonStr = null; + try { + jsonStr = mapper.writeValueAsString(srcObj); + } catch(JsonProcessingException e) { + LOGGER.error("SdcToscaParserException", e); + } + return jsonStr; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java new file mode 100644 index 0000000000..093dac39c3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java @@ -0,0 +1,68 @@ +/*- + * ============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.bpmn.common.util; +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.util.Properties; +import org.onap.so.utils.CryptoUtils; + +import org.onap.so.logger.MsoLogger; + +public class CryptoHandler implements ICryptoHandler { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CryptoHandler.class); + private static final String GENERAL_SECURITY_EXCEPTION_PREFIX = "GeneralSecurityException :"; + private static final String MSO_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + private static final String PROPERTY_KEY = "mso.AaiEncrypted.Pwd"; + + @Override + public String getMsoAaiPassword() { + Properties keyProp = new Properties (); + try { + keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("urn.properties")); + return CryptoUtils.decrypt((String) keyProp.get(PROPERTY_KEY), MSO_KEY); + } catch (GeneralSecurityException | IOException e) { + LOGGER.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); + return null; + } + } + + + @Override + public String encryptMsoPassword(String plainMsoPwd) { + try { + return CryptoUtils.encrypt(plainMsoPwd, MSO_KEY); + } catch (GeneralSecurityException e) { + LOGGER.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); + return null; + } + } + + @Override + public String decryptMsoPassword(String encryptedPwd) { + try { + return CryptoUtils.decrypt(encryptedPwd, MSO_KEY); + } catch (GeneralSecurityException e) { + LOGGER.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); + return null; + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java new file mode 100644 index 0000000000..6314a849d2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.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.bpmn.common.util; + +public interface ICryptoHandler { + public String getMsoAaiPassword(); + public String encryptMsoPassword(String plainPwd); + public String decryptMsoPassword(String encryptedPwd); +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowCallbackResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowCallbackResponse.java new file mode 100644 index 0000000000..13d2126805 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowCallbackResponse.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.bpmn.common.workflow.context; + + +/** + * @version 1.0 + * Workflow Response bean to generate workflow response in JSON format + */ +public class WorkflowCallbackResponse { + + private String response; + private int statusCode; + private String message; + + public String getResponse() { + return response; + } + public void setResponse(String response) { + this.response = response; + } + public int getStatusCode() { + return statusCode; + } + public void setStatusCode(int statusCode) { + this.statusCode = statusCode; + } + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContext.java new file mode 100644 index 0000000000..3ec7773791 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContext.java @@ -0,0 +1,98 @@ +package org.onap.so.bpmn.common.workflow.context; +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + + + +import java.util.concurrent.Delayed; +import java.util.concurrent.TimeUnit; + + +/** + * @version 1.0 + * Workflow context object used to send timeout response, if workflow instance does not write the response in time + */ +public class WorkflowContext implements Delayed { + private final String processKey; + private final String requestId; + + private final long startTime; + private final long timeout; + + private final WorkflowResponse workflowResponse; + + public WorkflowContext(String processKey, String requestId, long timeout, WorkflowResponse workflowResponse) { + this.processKey = processKey; + this.requestId = requestId; + this.timeout = timeout; + this.startTime = System.currentTimeMillis(); + this.workflowResponse = workflowResponse; + } + + public String getRequestId() { + return requestId; + } + + public String getProcessKey() { + return processKey; + } + + + public long getTimeout() { + return timeout; + } + + public long getStartTime() { + return startTime; + } + + public WorkflowResponse getWorkflowResponse() { + return workflowResponse; + } + + /** + * Required implementation by Delay queue + * Returns the elapsed time for this context + */ + @Override + public long getDelay(TimeUnit unit) { + // 0 or negative means this object is considered to be expired + return unit.convert(startTime + timeout - System.currentTimeMillis(), unit); + } + + /** + * Required implementation by Delay queue + * Compares the object to determine whether the object can be marked as expired + */ + @Override + public int compareTo(Delayed object) { + WorkflowContext that = (WorkflowContext) object; + long thisEndTime = startTime + timeout; + long thatEndTime = that.startTime + that.timeout; + + if (thisEndTime < thatEndTime) { + return -1; + } else if (thisEndTime > thatEndTime) { + return 1; + } else { + return 0; + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java new file mode 100644 index 0000000000..39c32de77d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java @@ -0,0 +1,140 @@ +package org.onap.so.bpmn.common.workflow.context; +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + + + +import java.util.concurrent.DelayQueue; +import java.util.concurrent.TimeUnit; + +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.stereotype.Component; + +/** + * Workflow Context Holder instance which can be accessed elsewhere either in groovy scripts or Java + * @version 1.0 + * + */ + +@Component +public class WorkflowContextHolder { + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,WorkflowContextHolder.class); + private static final String logMarker = "[WORKFLOW-CONTEXT-HOLDER]"; + private static WorkflowContextHolder instance = null; + + + private long defaultContextTimeout=60000; + + /** + * Delay Queue which holds workflow context holder objects + */ + private final DelayQueue responseQueue = new DelayQueue<>(); + private final TimeoutThread timeoutThread = new TimeoutThread(); + + private WorkflowContextHolder() { + timeoutThread.start(); + } + + /** + * Singleton holder which eliminates hot lock + * Since the JVM synchronizes static method there is no synchronization needed for this method + * @return + */ + public static synchronized WorkflowContextHolder getInstance() { + if (instance == null) { + instance = new WorkflowContextHolder(); + } + return instance; + } + + public void put(WorkflowContext context) { + msoLogger.debug(logMarker + " Adding context to the queue: " + + context.getRequestId()); + responseQueue.put(context); + } + + public void remove(WorkflowContext context) { + msoLogger.debug(logMarker + " Removing context from the queue: " + + context.getRequestId()); + responseQueue.remove(context); + } + + public WorkflowContext getWorkflowContext(String requestId) { + // Note: DelayQueue interator is threadsafe + for (WorkflowContext context : responseQueue) { + if (requestId.equals(context.getRequestId())) { + msoLogger.debug("Found context for request id: " + requestId); + return context; + } + } + + msoLogger.debug("Unable to find context for request id: " + requestId); + return null; + } + + /** + * Builds the callback response object to respond to client + * @param processKey + * @param processInstanceId + * @param requestId + * @param callbackResponse + * @return + */ + public void processCallback(String processKey, String processInstanceId, + String requestId, WorkflowCallbackResponse callbackResponse) { + WorkflowResponse workflowResponse = new WorkflowResponse(); + workflowResponse.setResponse(callbackResponse.getResponse()); + workflowResponse.setProcessInstanceID(processInstanceId); + workflowResponse.setMessageCode(callbackResponse.getStatusCode()); + workflowResponse.setMessage(callbackResponse.getMessage()); + WorkflowContext context = new WorkflowContext(processKey, requestId, defaultContextTimeout,workflowResponse); + put(context); + } + + + /** + * Timeout thread which monitors the delay queue for expired context and send timeout response + * to client + * + * */ + private class TimeoutThread extends Thread { + @Override + public void run() { + while (!isInterrupted()) { + try { + WorkflowContext requestObject = responseQueue.take(); + MsoLogger.setLogContext(requestObject.getRequestId(), null); + msoLogger.debug("Time remaining for request id: " + requestObject.getRequestId() + ":" + requestObject.getDelay(TimeUnit.MILLISECONDS)); + msoLogger.debug("Preparing timeout response for " + requestObject.getProcessKey() + ":" + ":" + requestObject.getRequestId()); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } catch (Exception e) { + msoLogger.debug("WorkflowContextHolder timeout thread caught exception: " + e); + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, "Error in WorkflowContextHolder timeout thread"); + + } + } + msoLogger.debug("WorkflowContextHolder timeout thread interrupted, quitting"); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowResponse.java new file mode 100644 index 0000000000..f5aa0b33c6 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowResponse.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.bpmn.common.workflow.context; + +import java.util.Map; + +/** + * @version 1.0 + * Synchronous workflow response bean + * + */ + +public class WorkflowResponse { + + private String response; + private String message; + private String processInstanceID; + private Map variables; + private int messageCode; + + public String getResponse() { + return response; + } + public void setResponse(String response) { + this.response = response; + } + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + public String getProcessInstanceID() { + return processInstanceID; + } + public void setProcessInstanceID(String pID) { + this.processInstanceID = pID; + } + public Map getVariables() { + return variables; + } + public void setVariables(Map variables) { + this.variables = variables; + } + public void setMessageCode(int messageCode) { + this.messageCode = messageCode; + } + + public int getMessageCode() { + return messageCode; + } + + @Override + public String toString() { + return "WorkflowResponse [response=" + response + ", message=" + message + ", processInstanceID=" + + processInstanceID + ", variables=" + variables + ", messageCode=" + messageCode + "]"; + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java new file mode 100644 index 0000000000..1f83c3135e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Metadatum; + +public class Metadata implements Serializable{ + + private static final long serialVersionUID = 4981393122007858950L; + + @JsonProperty("metadatum") + private List metadatum = new ArrayList(); + + public List getMetadatum() { + return metadatum; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java new file mode 100644 index 0000000000..1263e7ba7c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java @@ -0,0 +1,48 @@ +/*- + * ============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.bpmn.servicedecomposition; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import javax.persistence.Id; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +public interface ShallowCopy { + default T shallowCopyId() { + try { + T obj = (T) this.getClass().newInstance(); + for (Field field : this.getClass().getDeclaredFields()) { + if (field.isAnnotationPresent(Id.class)) { + String fieldName = Character.toUpperCase(field.getName().charAt(0)) + field.getName().substring(1); + Method setter = this.getClass().getMethod("set" + fieldName, field.getType()); + Method getter = this.getClass().getMethod("get" + fieldName, null); + setter.invoke(obj, getter.invoke(this, null)); + } + } + return obj; + }catch(Exception e){ + throw new RuntimeException(e); + } + + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AllottedResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AllottedResource.java new file mode 100644 index 0000000000..775d80db75 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AllottedResource.java @@ -0,0 +1,129 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; +import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionCandidates; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoAllottedResource; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.EqualsBuilder; + +@JsonRootName("allotted-resource") +public class AllottedResource extends SolutionCandidates implements Serializable, ShallowCopy { + + private static final long serialVersionUID = 8674239064804424306L; + + @Id + @JsonProperty("id") + private String id; + @JsonProperty("target-network-role") + private String targetNetworkRole; + @JsonProperty("self-link") + private String selflink; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("operational-status") + private String operationalStatus; + @JsonProperty("type") + private String type; + @JsonProperty("role") + private String role; + @JsonProperty("model-info-allotted-resource") + private ModelInfoAllottedResource modelInfoAllottedResource; + @JsonProperty("service-instance") + private ServiceInstance parentServiceInstance; + + public ModelInfoAllottedResource getModelInfoAllottedResource() { + return modelInfoAllottedResource; + } + public void setModelInfoAllottedResource(ModelInfoAllottedResource modelInfoAllottedResource) { + this.modelInfoAllottedResource = modelInfoAllottedResource; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getTargetNetworkRole() { + return targetNetworkRole; + } + public void setTargetNetworkRole(String targetNetworkRole) { + this.targetNetworkRole = targetNetworkRole; + } + public String getSelflink() { + return selflink; + } + public void setSelflink(String selflink) { + this.selflink = selflink; + } + public String getOperationalStatus() { + return operationalStatus; + } + public void setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + } + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public String getRole() { + return role; + } + public void setRole(String role) { + this.role = role; + } + public ServiceInstance getParentServiceInstance() { + return parentServiceInstance; + } + public void setParentServiceInstance(ServiceInstance parentServiceInstance) { + this.parentServiceInstance = parentServiceInstance; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof AllottedResource)) { + return false; + } + AllottedResource castOther = (AllottedResource) other; + return new EqualsBuilder().append(id, castOther.id).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(id).toHashCode(); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CloudRegion.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CloudRegion.java new file mode 100644 index 0000000000..f39253e6aa --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CloudRegion.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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +public class CloudRegion implements Serializable, ShallowCopy { + + private static final long serialVersionUID = 680593168655326021L; + + @Id + @JsonProperty("lcp-cloud-region-id") + private String lcpCloudRegionId; + @Id + @JsonProperty("cloud-owner") + private String cloudOwner; + @JsonProperty("tenant-id") + private String tenantId; + @JsonProperty("complex") + private String complex; + @JsonProperty("cloud-region-version") + private String cloudRegionVersion; + + public String getLcpCloudRegionId() { + return lcpCloudRegionId; + } + public void setLcpCloudRegionId(String lcpCloudRegionId) { + this.lcpCloudRegionId = lcpCloudRegionId; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getCloudOwner() { + return cloudOwner; + } + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + /** + * i.e. aic version + */ + public String getCloudRegionVersion() { + return cloudRegionVersion; + } + /** + * i.e. aic version + */ + public void setCloudRegionVersion(String cloudRegionVersion) { + this.cloudRegionVersion = cloudRegionVersion; + } + /** + * i.e. aic clli, physical location id, site id + */ + public String getComplex() { + return complex; + } + /** + * i.e. aic clli, physical location id, site id + */ + public void setComplex(String complex) { + this.complex = complex; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof CloudRegion)) { + return false; + } + CloudRegion castOther = (CloudRegion) other; + return new EqualsBuilder().append(lcpCloudRegionId, castOther.lcpCloudRegionId) + .append(cloudOwner, castOther.cloudOwner).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(lcpCloudRegionId).append(cloudOwner).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Collection.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Collection.java new file mode 100644 index 0000000000..6bbdb1ed67 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Collection.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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + + +@JsonRootName("collection") +public class Collection implements Serializable, ShallowCopy { + + private static final long serialVersionUID = 6389915895863066288L; + + @Id + @JsonProperty("id") + private String id; + @JsonProperty("model-info-collection") + private ModelInfoCollection modelInfoCollection; + @JsonProperty("instance-group") + private InstanceGroup instanceGroup; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("name") + private String name; + + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public ModelInfoCollection getModelInfoCollection() { + return modelInfoCollection; + } + public void setModelInfoCollection(ModelInfoCollection modelInfoCollection) { + this.modelInfoCollection = modelInfoCollection; + } + public InstanceGroup getInstanceGroup() { + return instanceGroup; + } + public void setInstanceGroup(InstanceGroup instanceGroup) { + this.instanceGroup = instanceGroup; + } + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof Collection)) { + return false; + } + Collection castOther = (Collection) other; + return new EqualsBuilder().append(id, castOther.id).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(id).toHashCode(); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java new file mode 100644 index 0000000000..bcff93c5af --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java @@ -0,0 +1,230 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.Metadata; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import javax.persistence.Id; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("configuration") +public class Configuration implements Serializable, ShallowCopy { + private static final long serialVersionUID = 4525487672816730299L; + + @Id + @JsonProperty("configuration-id") + private String configurationId; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("tunnel-bandwidth") + private String tunnelBandwidth; + @JsonProperty("vendor-allowed-max-bandwidth") + private String vendorAllowedMaxBandwidth; + @JsonProperty("management-option") + private String managementOption; + @JsonProperty("configuration-name") + private String configurationName; + @JsonProperty("configuration-type") + private String configurationType; + @JsonProperty("configuration-sub-type") + private String configurationSubType; + @JsonProperty("operational-status") + private String operationalStatus; + @JsonProperty("configuration-selflink") + private String configurationSelflink; + @JsonProperty("metadata") + private Metadata metadata; + @JsonProperty("forwarder-evcs") + private List forwarderEvcs = new ArrayList(); + @JsonProperty("evcs") + private List evcs = new ArrayList(); + @JsonProperty("model-info-configuration") + private ModelInfoConfiguration modelInfoConfiguration; + + @JsonProperty("related-configuration") + private Configuration relatedConfiguration; + + @JsonProperty("l3-network") + private L3Network network; + + @JsonProperty("l-interface") + private LInterface lInterface; + + public ModelInfoConfiguration getModelInfoConfiguration() { + return modelInfoConfiguration; + } + + public void setModelInfoConfiguration(ModelInfoConfiguration modelInfoConfiguration) { + this.modelInfoConfiguration = modelInfoConfiguration; + } + + public List getForwarderEvcs() { + return forwarderEvcs; + } + + public List getEvcs() { + return evcs; + } + + public String getConfigurationId() { + return configurationId; + } + + public void setConfigurationId(String configurationId) { + this.configurationId = configurationId; + } + + public String getManagementOption() { + return managementOption; + } + + public void setManagementOption(String managementOption) { + this.managementOption = managementOption; + } + + public String getConfigurationName() { + return configurationName; + } + + public void setConfigurationName(String configurationName) { + this.configurationName = configurationName; + } + + public String getConfigurationType() { + return configurationType; + } + + public void setConfigurationType(String configurationType) { + this.configurationType = configurationType; + } + + public String getConfigurationSubType() { + return configurationSubType; + } + + public void setConfigurationSubType(String configurationSubType) { + this.configurationSubType = configurationSubType; + } + + public String getOperationalStatus() { + return operationalStatus; + } + + public void setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + } + + public String getConfigurationSelflink() { + return configurationSelflink; + } + + public void setConfigurationSelflink(String configurationSelflink) { + this.configurationSelflink = configurationSelflink; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public String getTunnelBandwidth() { + return tunnelBandwidth; + } + + public void setTunnelBandwidth(String tunnelBandwidth) { + this.tunnelBandwidth = tunnelBandwidth; + } + + public String getVendorAllowedMaxBandwidth() { + return vendorAllowedMaxBandwidth; + } + + public void setVendorAllowedMaxBandwidth(String vendorAllowedMaxBandwidth) { + this.vendorAllowedMaxBandwidth = vendorAllowedMaxBandwidth; + } + + public Metadata getMetadata() { + return metadata; + } + + public void setMetadata(Metadata metadata) { + this.metadata = metadata; + } + + public Configuration getRelatedConfiguration() { + return relatedConfiguration; + } + + public void setRelatedConfiguration(Configuration relatedConfiguration) { + this.relatedConfiguration = relatedConfiguration; + } + + public void setForwarderEvcs(List forwarderEvcs) { + this.forwarderEvcs = forwarderEvcs; + } + + public void setEvcs(List evcs) { + this.evcs = evcs; + } + + public L3Network getNetwork() { + return network; + } + + public void setNetwork(L3Network network) { + this.network = network; + } + + public LInterface getlInterface() { + return lInterface; + } + + public void setlInterface(LInterface lInterface) { + this.lInterface = lInterface; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Configuration)) { + return false; + } + Configuration castOther = (Configuration) other; + return new EqualsBuilder().append(configurationId, castOther.configurationId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(configurationId).toHashCode(); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java new file mode 100644 index 0000000000..937c79be1d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("ctag-assignment") +public class CtagAssignment implements Serializable, ShallowCopy { + + private static final long serialVersionUID = 2314290576523243571L; + + @Id + @JsonProperty("vlan-id-inner") + private long vlanIdInner; + + public long getVlanIdInner() { + return vlanIdInner; + } + + public void setVlanIdInner(long vlanIdInner) { + this.vlanIdInner = vlanIdInner; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof CtagAssignment)) { + return false; + } + CtagAssignment castOther = (CtagAssignment) other; + return new EqualsBuilder().append(vlanIdInner, castOther.vlanIdInner).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(vlanIdInner).toHashCode(); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Customer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Customer.java new file mode 100644 index 0000000000..985f51035c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Customer.java @@ -0,0 +1,99 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Id; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("customer") +public class Customer implements Serializable, ShallowCopy { + + private static final long serialVersionUID = 2006599484099139618L; + + @Id + @JsonProperty("global-customer-id") + private String globalCustomerId; + @JsonProperty("subscriber-name") + private String subscriberName; + @JsonProperty("subscriber-type") + private String subscriberType; + @JsonProperty("subscriber-common-site-id") + private String subscriberCommonSiteId; + @JsonProperty("service-subscription") + private ServiceSubscription serviceSubscription; + @JsonProperty("vpn-bindings") + private List vpnBindings = new ArrayList<>(); + + public String getGlobalCustomerId() { + return globalCustomerId; + } + public void setGlobalCustomerId(String globalCustomerId) { + this.globalCustomerId = globalCustomerId; + } + public String getSubscriberName() { + return subscriberName; + } + public void setSubscriberName(String subscriberName) { + this.subscriberName = subscriberName; + } + public String getSubscriberType() { + return subscriberType; + } + public void setSubscriberType(String subscriberType) { + this.subscriberType = subscriberType; + } + public String getSubscriberCommonSiteId() { + return subscriberCommonSiteId; + } + public void setSubscriberCommonSiteId(String subscriberCommonSiteId) { + this.subscriberCommonSiteId = subscriberCommonSiteId; + } + public ServiceSubscription getServiceSubscription() { + return serviceSubscription; + } + public void setServiceSubscription(ServiceSubscription serviceSubscription) { + this.serviceSubscription = serviceSubscription; + } + public List getVpnBindings() { + return vpnBindings; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof Customer)) { + return false; + } + Customer castOther = (Customer) other; + return new EqualsBuilder().append(globalCustomerId, castOther.globalCustomerId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(globalCustomerId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Entitlement.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Entitlement.java new file mode 100644 index 0000000000..fdcb59d3c3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Entitlement.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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("entitlement") +public class Entitlement implements Serializable, ShallowCopy{ + + private static final long serialVersionUID = 5186878328988717088L; + + @Id + @JsonProperty("group-uuid") + private String groupUuid; + @Id + @JsonProperty("resource-uuid") + private String resourceUuid; + + public String getGroupUuid() { + return groupUuid; + } + public void setGroupUuid(String groupUuid) { + this.groupUuid = groupUuid; + } + public String getResourceUuid() { + return resourceUuid; + } + public void setResourceUuid(String resourceUuid) { + this.resourceUuid = resourceUuid; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof Entitlement)) { + return false; + } + Entitlement castOther = (Entitlement) other; + return new EqualsBuilder().append(groupUuid, castOther.groupUuid).append(resourceUuid, castOther.resourceUuid) + .isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(groupUuid).append(resourceUuid).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Evc.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Evc.java new file mode 100644 index 0000000000..3ef0f71386 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Evc.java @@ -0,0 +1,164 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("evc") +public class Evc implements Serializable, ShallowCopy { + + private static final long serialVersionUID = -3556506672371317659L; + + @Id + @JsonProperty("evc-id") + private String evcId; + @JsonProperty("forwarding-path-topology") + private String forwardingPathTopology; + @JsonProperty("cir-value") + private String cirValue; + @JsonProperty("cir-units") + private String cirUnits; + @JsonProperty("connection-diversity-group-id") + private String connectionDiversityGroupId; + @JsonProperty("service-hours") + private String serviceHours; + @JsonProperty("esp-evc-circuit-id") + private String espEvcCircuitId; + @JsonProperty("esp-evc-cir-value") + private String espEvcCirValue; + @JsonProperty("esp-evc-cir-units") + private String espEvcCirUnits; + @JsonProperty("esp-itu-code") + private String espItuCode; + @JsonProperty("collector-pop-clli") + private String collectorPopClli; + @JsonProperty("inter-connect-type-ingress") + private String interConnectTypeIngress; + @JsonProperty("tagmode-access-ingress") + private String tagmodeAccessIngress; + @JsonProperty("tagmode-access-egress") + private String tagmodeAccessEgress; + + public String getEvcId() { + return evcId; + } + public void setEvcId(String evcId) { + this.evcId = evcId; + } + public String getForwardingPathTopology() { + return forwardingPathTopology; + } + public void setForwardingPathTopology(String forwardingPathTopology) { + this.forwardingPathTopology = forwardingPathTopology; + } + public String getCirValue() { + return cirValue; + } + public void setCirValue(String cirValue) { + this.cirValue = cirValue; + } + public String getCirUnits() { + return cirUnits; + } + public void setCirUnits(String cirUnits) { + this.cirUnits = cirUnits; + } + public String getConnectionDiversityGroupId() { + return connectionDiversityGroupId; + } + public void setConnectionDiversityGroupId(String connectionDiversityGroupId) { + this.connectionDiversityGroupId = connectionDiversityGroupId; + } + public String getServiceHours() { + return serviceHours; + } + public void setServiceHours(String serviceHours) { + this.serviceHours = serviceHours; + } + public String getEspEvcCircuitId() { + return espEvcCircuitId; + } + public void setEspEvcCircuitId(String espEvcCircuitId) { + this.espEvcCircuitId = espEvcCircuitId; + } + public String getEspEvcCirValue() { + return espEvcCirValue; + } + public void setEspEvcCirValue(String espEvcCirValue) { + this.espEvcCirValue = espEvcCirValue; + } + public String getEspEvcCirUnits() { + return espEvcCirUnits; + } + public void setEspEvcCirUnits(String espEvcCirUnits) { + this.espEvcCirUnits = espEvcCirUnits; + } + public String getEspItuCode() { + return espItuCode; + } + public void setEspItuCode(String espItuCode) { + this.espItuCode = espItuCode; + } + public String getCollectorPopClli() { + return collectorPopClli; + } + public void setCollectorPopClli(String collectorPopClli) { + this.collectorPopClli = collectorPopClli; + } + public String getInterConnectTypeIngress() { + return interConnectTypeIngress; + } + public void setInterConnectTypeIngress(String interConnectTypeIngress) { + this.interConnectTypeIngress = interConnectTypeIngress; + } + public String getTagmodeAccessIngress() { + return tagmodeAccessIngress; + } + public void setTagmodeAccessIngress(String tagmodeAccessIngress) { + this.tagmodeAccessIngress = tagmodeAccessIngress; + } + public String getTagmodeAccessEgress() { + return tagmodeAccessEgress; + } + public void setTagmodeAccessEgress(String tagmodeAccessEgress) { + this.tagmodeAccessEgress = tagmodeAccessEgress; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof Evc)) { + return false; + } + Evc castOther = (Evc) other; + return new EqualsBuilder().append(evcId, castOther.evcId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(evcId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ForwarderEvc.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ForwarderEvc.java new file mode 100644 index 0000000000..70f7d5af42 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ForwarderEvc.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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("forwarder-evc") +public class ForwarderEvc implements Serializable, ShallowCopy { + + private static final long serialVersionUID = 3822241337439817708L; + + @Id + @JsonProperty("forwarder-evc-id") + private String forwarderEvcId; + @JsonProperty("circuit-id") + private String circuitId; + @JsonProperty("ivlan") + private String ivlan; + @JsonProperty("svlan") + private String svlan; + @JsonProperty("cvlan") + private String cvlan; + + public String getForwarderEvcId() { + return forwarderEvcId; + } + + public void setForwarderEvcId(String forwarderEvcId) { + this.forwarderEvcId = forwarderEvcId; + } + + public String getCircuitId() { + return circuitId; + } + + public void setCircuitId(String circuitId) { + this.circuitId = circuitId; + } + + public String getIvlan() { + return ivlan; + } + + public void setIvlan(String ivlan) { + this.ivlan = ivlan; + } + + public String getSvlan() { + return svlan; + } + + public void setSvlan(String svlan) { + this.svlan = svlan; + } + + public String getCvlan() { + return cvlan; + } + + public void setCvlan(String cvlan) { + this.cvlan = cvlan; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof ForwarderEvc)) { + return false; + } + ForwarderEvc castOther = (ForwarderEvc) other; + return new EqualsBuilder().append(forwarderEvcId, castOther.forwarderEvcId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(forwarderEvcId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java new file mode 100644 index 0000000000..218763a006 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java @@ -0,0 +1,510 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; +import org.onap.so.bpmn.servicedecomposition.generalobjects.License; +import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionInfo; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("generic-vnf") +public class GenericVnf implements Serializable, ShallowCopy { + + private static final long serialVersionUID = -5107610336831330403L; + + @Id + @JsonProperty("vnf-id") + private String vnfId; + @JsonProperty("vnf-name") + private String vnfName; + @JsonProperty("vnf-type") + private String vnfType; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("vf-modules") + private List vfModules = new ArrayList<>(); + @JsonProperty("volume-groups") + private List volumeGroups = new ArrayList<>(); + @JsonProperty("line-of-business") + private LineOfBusiness lineOfBusiness; + @JsonProperty("platform") + private Platform platform; + @JsonProperty("cascaded") + private boolean cascaded; + @JsonProperty("cloud-params") + private Map cloudParams = new HashMap<>(); + @JsonProperty("cloud-context") + private CloudRegion cloudRegion; + @JsonProperty("solution") + private SolutionInfo solution; + @JsonProperty("vnf-name-2") + private String vnfName2; + @JsonProperty("service-id") + private String serviceId; + @JsonProperty("regional-resource-zone") + private String regionalResourceZone; + @JsonProperty("prov-status") + private String provStatus; + @JsonProperty("operational-status") + private String operationalStatus; + @JsonProperty("equipment-role") + private String equipmentRole; + @JsonProperty("management-option") + private String managementOption; + @JsonProperty("ipv4-oam-address") + private String ipv4OamAddress; + @JsonProperty("ipv4-loopback0-address") + private String ipv4Loopback0Address; + @JsonProperty("nm-lan-v6-address") + private String nmLanV6Address; + @JsonProperty("management-v6-address") + private String managementV6Address; + @JsonProperty("vcpu") + private Long vcpu; + @JsonProperty("vcpu-units") + private String vcpuUnits; + @JsonProperty("vmemory") + private Long vmemory; + @JsonProperty("vmemory-units") + private String vmemoryUnits; + @JsonProperty("vdisk") + private Long vdisk; + @JsonProperty("vdisk-units") + private String vdiskUnits; + @JsonProperty("in-maint") + private boolean inMaint; + @JsonProperty("is-closed-loop-disabled") + private boolean isClosedLoopDisabled; + @JsonProperty("summary-status") + private String summaryStatus; + @JsonProperty("encrypted-access-flag") + private Boolean encryptedAccessFlag; + @JsonProperty("as-number") + private String asNumber; + @JsonProperty("regional-resource-subzone") + private String regionalResourceSubzone; + @JsonProperty("self-link") + private String selflink; + @JsonProperty("ipv4-oam-gateway-address") + private String ipv4OamGatewayAddress; + @JsonProperty("ipv4-oam-gateway-address-prefix-length") + private Integer ipv4OamGatewayAddressPrefixLength; + @JsonProperty("vlan-id-outer") + private Long vlanIdOuter; + @JsonProperty("nm-profile-name") + private String nmProfileName; + @JsonProperty("l-interfaces") + private List lInterfaces = new ArrayList<>(); + @JsonProperty("lag-interfaces") + private List lagInterfaces = new ArrayList<>(); + @JsonProperty("license") + private License license; + @JsonProperty("entitlements") //TODO remove, duplicated + private List entitlements = new ArrayList<>(); + @JsonProperty("model-info-generic-vnf") + private ModelInfoGenericVnf modelInfoGenericVnf; + @JsonProperty("instance-groups") + private List instanceGroups = new ArrayList(); + @JsonProperty("call-homing") + private boolean callHoming; + + + public List getInstanceGroups() { + return instanceGroups; + } + + public List getVolumeGroups() { + return volumeGroups; + } + + public ModelInfoGenericVnf getModelInfoGenericVnf() { + return modelInfoGenericVnf; + } + + public void setModelInfoGenericVnf(ModelInfoGenericVnf modelInfoGenericVnf) { + this.modelInfoGenericVnf = modelInfoGenericVnf; + } + + public String getVnfName2() { + return vnfName2; + } + + public void setVnfName2(String vnfName2) { + this.vnfName2 = vnfName2; + } + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public String getRegionalResourceZone() { + return regionalResourceZone; + } + + public void setRegionalResourceZone(String regionalResourceZone) { + this.regionalResourceZone = regionalResourceZone; + } + + public String getProvStatus() { + return provStatus; + } + + public void setProvStatus(String provStatus) { + this.provStatus = provStatus; + } + + public String getOperationalStatus() { + return operationalStatus; + } + + public void setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + } + + public String getEquipmentRole() { + return equipmentRole; + } + + public void setEquipmentRole(String equipmentRole) { + this.equipmentRole = equipmentRole; + } + + public String getManagementOption() { + return managementOption; + } + + public void setManagementOption(String managementOption) { + this.managementOption = managementOption; + } + + public String getIpv4OamAddress() { + return ipv4OamAddress; + } + + public void setIpv4OamAddress(String ipv4OamAddress) { + this.ipv4OamAddress = ipv4OamAddress; + } + + public String getIpv4Loopback0Address() { + return ipv4Loopback0Address; + } + + public void setIpv4Loopback0Address(String ipv4Loopback0Address) { + this.ipv4Loopback0Address = ipv4Loopback0Address; + } + + public String getNmLanV6Address() { + return nmLanV6Address; + } + + public void setNmLanV6Address(String nmLanV6Address) { + this.nmLanV6Address = nmLanV6Address; + } + + public String getManagementV6Address() { + return managementV6Address; + } + + public void setManagementV6Address(String managementV6Address) { + this.managementV6Address = managementV6Address; + } + + public Long getVcpu() { + return vcpu; + } + + public void setVcpu(Long vcpu) { + this.vcpu = vcpu; + } + + public String getVcpuUnits() { + return vcpuUnits; + } + + public void setVcpuUnits(String vcpuUnits) { + this.vcpuUnits = vcpuUnits; + } + + public List getlInterfaces() { + return lInterfaces; + } + + public List getLagInterfaces() { + return lagInterfaces; + } + + public List getEntitlements() { + return entitlements; + } + + public List getVfModules() { + return vfModules; + } + + public Long getVmemory() { + return vmemory; + } + + public void setVmemory(Long vmemory) { + this.vmemory = vmemory; + } + + public String getVmemoryUnits() { + return vmemoryUnits; + } + + public void setVmemoryUnits(String vmemoryUnits) { + this.vmemoryUnits = vmemoryUnits; + } + + public Long getVdisk() { + return vdisk; + } + + public void setVdisk(Long vdisk) { + this.vdisk = vdisk; + } + + public String getVdiskUnits() { + return vdiskUnits; + } + + public void setVdiskUnits(String vdiskUnits) { + this.vdiskUnits = vdiskUnits; + } + + public boolean isInMaint() { + return inMaint; + } + + public void setInMaint(boolean inMaint) { + this.inMaint = inMaint; + } + + public boolean isClosedLoopDisabled() { + return isClosedLoopDisabled; + } + + public void setClosedLoopDisabled(boolean isClosedLoopDisabled) { + this.isClosedLoopDisabled = isClosedLoopDisabled; + } + + public String getSummaryStatus() { + return summaryStatus; + } + + public void setSummaryStatus(String summaryStatus) { + this.summaryStatus = summaryStatus; + } + + public Boolean getEncryptedAccessFlag() { + return encryptedAccessFlag; + } + + public void setEncryptedAccessFlag(Boolean encryptedAccessFlag) { + this.encryptedAccessFlag = encryptedAccessFlag; + } + + public String getAsNumber() { + return asNumber; + } + + public void setAsNumber(String asNumber) { + this.asNumber = asNumber; + } + + public String getRegionalResourceSubzone() { + return regionalResourceSubzone; + } + + public void setRegionalResourceSubzone(String regionalResourceSubzone) { + this.regionalResourceSubzone = regionalResourceSubzone; + } + + public License getLicense() { + return license; + } + + public void setLicense(License license) { + this.license = license; + } + + public String getSelflink() { + return selflink; + } + + public void setSelflink(String selflink) { + this.selflink = selflink; + } + + public String getIpv4OamGatewayAddress() { + return ipv4OamGatewayAddress; + } + + public void setIpv4OamGatewayAddress(String ipv4OamGatewayAddress) { + this.ipv4OamGatewayAddress = ipv4OamGatewayAddress; + } + + public Integer getIpv4OamGatewayAddressPrefixLength() { + return ipv4OamGatewayAddressPrefixLength; + } + + public void setIpv4OamGatewayAddressPrefixLength(Integer ipv4OamGatewayAddressPrefixLength) { + this.ipv4OamGatewayAddressPrefixLength = ipv4OamGatewayAddressPrefixLength; + } + + public Long getVlanIdOuter() { + return vlanIdOuter; + } + + public void setVlanIdOuter(Long vlanIdOuter) { + this.vlanIdOuter = vlanIdOuter; + } + + public String getNmProfileName() { + return nmProfileName; + } + + public void setNmProfileName(String nmProfileName) { + this.nmProfileName = nmProfileName; + } + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public String getVnfName() { + return vnfName; + } + + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } + + public String getVnfType() { + return vnfType; + } + + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public LineOfBusiness getLineOfBusiness() { + return lineOfBusiness; + } + + public void setLineOfBusiness(LineOfBusiness lineOfBusiness) { + this.lineOfBusiness = lineOfBusiness; + } + + public Platform getPlatform() { + return platform; + } + + public void setPlatform(Platform platform) { + this.platform = platform; + } + + public boolean isCascaded() { + return cascaded; + } + + public void setCascaded(boolean cascaded) { + this.cascaded = cascaded; + } + + public Map getCloudParams() { + return cloudParams; + } + + public void setCloudParams(Map cloudParams) { + this.cloudParams = cloudParams; + } + + public SolutionInfo getSolution() { + return solution; + } + + public void setSolution(SolutionInfo solution) { + this.solution = solution; + } + + public CloudRegion getCloudRegion() { + return cloudRegion; + } + + public void setCloudRegion(CloudRegion cloudRegion) { + this.cloudRegion = cloudRegion; + } + + public boolean isCallHoming() { + return callHoming; + } + + public void setCallHoming(boolean callHoming) { + this.callHoming = callHoming; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof GenericVnf)) { + return false; + } + GenericVnf castOther = (GenericVnf) other; + return new EqualsBuilder().append(vnfId, castOther.vnfId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(vnfId).toHashCode(); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/HostRoute.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/HostRoute.java new file mode 100644 index 0000000000..75356ac9db --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/HostRoute.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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("host-route") +public class HostRoute implements Serializable, ShallowCopy{ + + private static final long serialVersionUID = -2468793257174064133L; + + @Id + @JsonProperty("host-route-id") + private String hostRouteId; + @JsonProperty("route-prefix") + private String routePrefix; + @JsonProperty("next-hop") + private String nextHop; + @JsonProperty("next-hop-type") + private String nextHopType; + + public String getHostRouteId() { + return hostRouteId; + } + public void setHostRouteId(String hostRouteId) { + this.hostRouteId = hostRouteId; + } + public String getRoutePrefix() { + return routePrefix; + } + public void setRoutePrefix(String routePrefix) { + this.routePrefix = routePrefix; + } + public String getNextHop() { + return nextHop; + } + public void setNextHop(String nextHop) { + this.nextHop = nextHop; + } + public String getNextHopType() { + return nextHopType; + } + public void setNextHopType(String nextHopType) { + this.nextHopType = nextHopType; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof HostRoute)) { + return false; + } + HostRoute castOther = (HostRoute) other; + return new EqualsBuilder().append(hostRouteId, castOther.hostRouteId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(hostRouteId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java new file mode 100644 index 0000000000..deb8c8e393 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("instance-group") +public class InstanceGroup implements Serializable, ShallowCopy { + + private static final long serialVersionUID = -2330859693128099141L; + + @Id + @JsonProperty("id") + private String id; + @JsonProperty("description") + private String description; + @JsonProperty("resource-version") + private String resourceVersion; + @JsonProperty("instance-group-name") + private String instanceGroupName; + @JsonProperty("model-info-instance-group") + private ModelInfoInstanceGroup modelInfoInstanceGroup; + @JsonProperty("instance-group-function") + private String instanceGroupFunction; + + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public String getResourceVersion() { + return resourceVersion; + } + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + public String getInstanceGroupName() { + return instanceGroupName; + } + public void setInstanceGroupName(String instanceGroupName) { + this.instanceGroupName = instanceGroupName; + } + public ModelInfoInstanceGroup getModelInfoInstanceGroup() { + return modelInfoInstanceGroup; + } + public void setModelInfoInstanceGroup(ModelInfoInstanceGroup modelInfoInstanceGroup) { + this.modelInfoInstanceGroup = modelInfoInstanceGroup; + } + public String getInstanceGroupFunction() { + return instanceGroupFunction; + } + public void setInstanceGroupFunction(String instanceGroupFunction) { + this.instanceGroupFunction = instanceGroupFunction; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof InstanceGroup)) { + return false; + } + InstanceGroup castOther = (InstanceGroup) other; + return new EqualsBuilder().append(id, castOther.id).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(id).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv4AddressList.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv4AddressList.java new file mode 100644 index 0000000000..55b8a752b6 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv4AddressList.java @@ -0,0 +1,108 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("l3-interface-ipv4-address-list") +public class L3InterfaceIpv4AddressList implements Serializable, ShallowCopy{ + + private static final long serialVersionUID = -1566884527411610879L; + + @Id + @JsonProperty("l3-interface-ipv4-address") + private String l3InterfaceIpv4Address; + @JsonProperty("l3-interface-ipv4-prefix-length") + private Long l3InterfaceIpv4PrefixLength; + @JsonProperty("vlan-id-inner") + private Long vlanIdInner; + @JsonProperty("vlan-id-outer") + private Long vlanIdOuter; + @JsonProperty("is-floating") + private Boolean isFloating; + @JsonProperty("neutron-network-id") + private String neutronNetworkId; + @JsonProperty("neutron-subnet-id") + private String neutronSubnetId; + + public String getL3InterfaceIpv4Address() { + return l3InterfaceIpv4Address; + } + public void setL3InterfaceIpv4Address(String l3InterfaceIpv4Address) { + this.l3InterfaceIpv4Address = l3InterfaceIpv4Address; + } + public Long getL3InterfaceIpv4PrefixLength() { + return l3InterfaceIpv4PrefixLength; + } + public void setL3InterfaceIpv4PrefixLength(Long l3InterfaceIpv4PrefixLength) { + this.l3InterfaceIpv4PrefixLength = l3InterfaceIpv4PrefixLength; + } + public Long getVlanIdInner() { + return vlanIdInner; + } + public void setVlanIdInner(Long vlanIdInner) { + this.vlanIdInner = vlanIdInner; + } + public Long getVlanIdOuter() { + return vlanIdOuter; + } + public void setVlanIdOuter(Long vlanIdOuter) { + this.vlanIdOuter = vlanIdOuter; + } + public Boolean getIsFloating() { + return isFloating; + } + public void setIsFloating(Boolean isFloating) { + this.isFloating = isFloating; + } + public String getNeutronNetworkId() { + return neutronNetworkId; + } + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + public String getNeutronSubnetId() { + return neutronSubnetId; + } + public void setNeutronSubnetId(String neutronSubnetId) { + this.neutronSubnetId = neutronSubnetId; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof L3InterfaceIpv4AddressList)) { + return false; + } + L3InterfaceIpv4AddressList castOther = (L3InterfaceIpv4AddressList) other; + return new EqualsBuilder().append(l3InterfaceIpv4Address, castOther.l3InterfaceIpv4Address).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(l3InterfaceIpv4Address).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv6AddressList.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv6AddressList.java new file mode 100644 index 0000000000..209c64762f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv6AddressList.java @@ -0,0 +1,123 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("l3-interface-ipv6-address-list") +public class L3InterfaceIpv6AddressList implements Serializable, ShallowCopy { + + private static final long serialVersionUID = -414901751774739052L; + + @Id + @JsonProperty("l3-interface-ipv6-address") + private String l3InterfaceIpv6Address; + @JsonProperty("l3-interface-ipv6-prefix-length") + private Long l3InterfaceIpv6PrefixLength; + @JsonProperty("vlan-id-inner") + private Long vlanIdInner; + @JsonProperty("vlan-id-outer") + private Long vlanIdOuter; + @JsonProperty("is-floating") + private Boolean isFloating; + @JsonProperty("neutron-network-id") + private String neutronNetworkId; + @JsonProperty("neutron-subnet-id") + private String neutronSubnetId; + + public String getL3InterfaceIpv6Address() { + return l3InterfaceIpv6Address; + } + + public void setL3InterfaceIpv6Address(String l3InterfaceIpv6Address) { + this.l3InterfaceIpv6Address = l3InterfaceIpv6Address; + } + + public Long getL3InterfaceIpv6PrefixLength() { + return l3InterfaceIpv6PrefixLength; + } + + public void setL3InterfaceIpv6PrefixLength(Long l3InterfaceIpv6PrefixLength) { + this.l3InterfaceIpv6PrefixLength = l3InterfaceIpv6PrefixLength; + } + + public Long getVlanIdInner() { + return vlanIdInner; + } + + public void setVlanIdInner(Long vlanIdInner) { + this.vlanIdInner = vlanIdInner; + } + + public Long getVlanIdOuter() { + return vlanIdOuter; + } + + public void setVlanIdOuter(Long vlanIdOuter) { + this.vlanIdOuter = vlanIdOuter; + } + + public Boolean getIsFloating() { + return isFloating; + } + + public void setIsFloating(Boolean isFloating) { + this.isFloating = isFloating; + } + + public String getNeutronNetworkId() { + return neutronNetworkId; + } + + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + + public String getNeutronSubnetId() { + return neutronSubnetId; + } + + public void setNeutronSubnetId(String neutronSubnetId) { + this.neutronSubnetId = neutronSubnetId; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof L3InterfaceIpv6AddressList)) { + return false; + } + L3InterfaceIpv6AddressList castOther = (L3InterfaceIpv6AddressList) other; + return new EqualsBuilder().append(l3InterfaceIpv6Address, castOther.l3InterfaceIpv6Address).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(l3InterfaceIpv6Address).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java new file mode 100644 index 0000000000..51cd998073 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java @@ -0,0 +1,269 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("l3Network") +public class L3Network implements Serializable, ShallowCopy { + + private static final long serialVersionUID = 4434492567957111317L; + + @Id + @JsonProperty("network-id") + private String networkId; + @JsonProperty("cascaded") + private boolean cascaded; + @JsonProperty("cloud-params") + private Map cloudParams = new HashMap<>(); + @JsonProperty("network-name") + private String networkName; + @JsonProperty("neutron-network-id") + private String neutronNetworkId; + @JsonProperty("network-type") + private String networkType; + @JsonProperty("network-technology") + private String networkTechnology; + @JsonProperty("network-role") + private String networkRole; + @JsonProperty("is-bound-to-vpn") + private boolean isBoundToVpn; + @JsonProperty("service-id") + private String serviceId; + @JsonProperty("network-role-instance") + private Long networkRoleInstance; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("heat-stack-id") + private String heatStackId; + @JsonProperty("contrail-network-fqdn") + private String contrailNetworkFqdn; + @JsonProperty("network-policies") + private List networkPolicies = new ArrayList<>(); + @JsonProperty("contrail-network-route-table-references") + private List contrailNetworkRouteTableReferences = new ArrayList<>(); + @JsonProperty("widget-model-id") + private String widgetModelId; + @JsonProperty("widget-model-version") + private String widgetModelVersion; + @JsonProperty("physical-network-name") + private String physicalNetworkName; + @JsonProperty("is-provider-network") + private boolean isProviderNetwork; + @JsonProperty("is-shared-network") + private boolean isSharedNetwork; + @JsonProperty("is-external-network") + private boolean isExternalNetwork; + @JsonProperty("self-link") + private String selflink; + @JsonProperty("operational-status") + private String operationalStatus; + @JsonProperty("subnets") + private List subnets = new ArrayList<>(); + @JsonProperty("ctag-assignments") + private List ctagAssignments = new ArrayList<>(); + @JsonProperty("segmentation-assignments") + private List segmentationAssignments = new ArrayList<>(); + @JsonProperty("model-info-network") + private ModelInfoNetwork modelInfoNetwork; + + public ModelInfoNetwork getModelInfoNetwork() { + return modelInfoNetwork; + } + public void setModelInfoNetwork(ModelInfoNetwork modelInfoNetwork) { + this.modelInfoNetwork = modelInfoNetwork; + } + public String getNeutronNetworkId() { + return neutronNetworkId; + } + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + public String getNetworkId() { + return networkId; + } + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + public String getNetworkName() { + return networkName; + } + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + public String getNetworkType() { + return networkType; + } + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + public String getNetworkTechnology() { + return networkTechnology; + } + public void setNetworkTechnology(String networkTechnology) { + this.networkTechnology = networkTechnology; + } + public String getNetworkRole() { + return networkRole; + } + public void setNetworkRole(String networkRole) { + this.networkRole = networkRole; + } + public boolean isBoundToVpn() { + return isBoundToVpn; + } + public void setIsBoundToVpn(boolean isBoundToVpn) { + this.isBoundToVpn = isBoundToVpn; + } + public String getServiceId() { + return serviceId; + } + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + public Long getNetworkRoleInstance() { + return networkRoleInstance; + } + public void setNetworkRoleInstance(Long networkRoleInstance) { + this.networkRoleInstance = networkRoleInstance; + } + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public String getHeatStackId() { + return heatStackId; + } + public void setHeatStackId(String heatStackId) { + this.heatStackId = heatStackId; + } + public String getContrailNetworkFqdn() { + return contrailNetworkFqdn; + } + public void setContrailNetworkFqdn(String contrailNetworkFqdn) { + this.contrailNetworkFqdn = contrailNetworkFqdn; + } + public List getNetworkPolicies() { + return networkPolicies; + } + public List getContrailNetworkRouteTableReferences() { + return contrailNetworkRouteTableReferences; + } + public String getWidgetModelId() { + return widgetModelId; + } + public void setWidgetModelId(String widgetModelId) { + this.widgetModelId = widgetModelId; + } + public String getWidgetModelVersion() { + return widgetModelVersion; + } + public void setWidgetModelVersion(String widgetModelVersion) { + this.widgetModelVersion = widgetModelVersion; + } + public String getPhysicalNetworkName() { + return physicalNetworkName; + } + public void setPhysicalNetworkName(String physicalNetworkName) { + this.physicalNetworkName = physicalNetworkName; + } + public boolean isProviderNetwork() { + return isProviderNetwork; + } + public void setIsProviderNetwork(boolean isProviderNetwork) { + this.isProviderNetwork = isProviderNetwork; + } + public boolean isSharedNetwork() { + return isSharedNetwork; + } + public void setIsSharedNetwork(boolean isSharedNetwork) { + this.isSharedNetwork = isSharedNetwork; + } + public boolean isExternalNetwork() { + return isExternalNetwork; + } + public void setIsExternalNetwork(boolean isExternalNetwork) { + this.isExternalNetwork = isExternalNetwork; + } + public String getSelflink() { + return selflink; + } + public void setSelflink(String selflink) { + this.selflink = selflink; + } + public String getOperationalStatus() { + return operationalStatus; + } + public void setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + } + + public List getSubnets() { + return subnets; + } + public List getCtagAssignments() { + return ctagAssignments; + } + public List getSegmentationAssignments() { + return segmentationAssignments; + } + public boolean isCascaded() { + return cascaded; + } + public void setIsCascaded(boolean cascaded) { + this.cascaded = cascaded; + } + public Map getCloudParams() { + return cloudParams; + } + public void setCloudParams(Map cloudParams) { + this.cloudParams = cloudParams; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof L3Network)) { + return false; + } + L3Network castOther = (L3Network) other; + return new EqualsBuilder().append(networkId, castOther.networkId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(networkId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java new file mode 100644 index 0000000000..4bba39ee62 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java @@ -0,0 +1,191 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("l-interface") +public class LInterface implements Serializable, ShallowCopy{ + + private static final long serialVersionUID = 5629921809747079453L; + + @Id + @JsonProperty("interface-name") + private String interfaceName; + @JsonProperty("interface-role") + private String interfaceRole; + @JsonProperty("v6-wan-link-ip") + private String v6WanLinkIp; + @JsonProperty("self-link") + private String selflink; + @JsonProperty("interface-id") + private String interfaceId; + @JsonProperty("macaddr") + private String macaddr; + @JsonProperty("network-name") + private String networkName; + @JsonProperty("management-option") + private String managementOption; + @JsonProperty("interface-description") + private String interfaceDescription; + @JsonProperty("is-port-mirrored") + private boolean isPortMirrored; + @JsonProperty("in-maint") + private boolean inMaint; + @JsonProperty("prov-status") + private String provStatus; + @JsonProperty("is-ip-unnumbered") + private boolean isIpUnnumbered; + @JsonProperty("allowed-address-pairs") + private String allowedAddressPairs; + @JsonProperty("vlans") + private List vlans = new ArrayList(); + @JsonProperty("sriov-vfs") + private List sriovVfs = new ArrayList(); + @JsonProperty("l-interfaces") + private List lInterfaces = new ArrayList(); + @JsonProperty("l3-interface-ipv4-address-list") + private List l3InterfaceIpv4AddressList = new ArrayList(); + @JsonProperty("l3-interface-ipv6-address-list") + private List l3InterfaceIpv6AddressList = new ArrayList(); + + public String getInterfaceName() { + return interfaceName; + } + public void setInterfaceName(String interfaceName) { + this.interfaceName = interfaceName; + } + public String getInterfaceRole() { + return interfaceRole; + } + public void setInterfaceRole(String interfaceRole) { + this.interfaceRole = interfaceRole; + } + public String getV6WanLinkIp() { + return v6WanLinkIp; + } + public void setV6WanLinkIp(String v6WanLinkIp) { + this.v6WanLinkIp = v6WanLinkIp; + } + public String getSelflink() { + return selflink; + } + public void setSelflink(String selflink) { + this.selflink = selflink; + } + public String getInterfaceId() { + return interfaceId; + } + public void setInterfaceId(String interfaceId) { + this.interfaceId = interfaceId; + } + public String getMacaddr() { + return macaddr; + } + public void setMacaddr(String macaddr) { + this.macaddr = macaddr; + } + public String getNetworkName() { + return networkName; + } + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + public String getManagementOption() { + return managementOption; + } + public void setManagementOption(String managementOption) { + this.managementOption = managementOption; + } + public String getInterfaceDescription() { + return interfaceDescription; + } + public void setInterfaceDescription(String interfaceDescription) { + this.interfaceDescription = interfaceDescription; + } + public boolean isPortMirrored() { + return isPortMirrored; + } + public void setPortMirrored(boolean isPortMirrored) { + this.isPortMirrored = isPortMirrored; + } + public boolean isInMaint() { + return inMaint; + } + public void setInMaint(boolean inMaint) { + this.inMaint = inMaint; + } + public String getProvStatus() { + return provStatus; + } + public void setProvStatus(String provStatus) { + this.provStatus = provStatus; + } + public boolean isIpUnnumbered() { + return isIpUnnumbered; + } + public void setIpUnnumbered(boolean isIpUnnumbered) { + this.isIpUnnumbered = isIpUnnumbered; + } + public String getAllowedAddressPairs() { + return allowedAddressPairs; + } + public void setAllowedAddressPairs(String allowedAddressPairs) { + this.allowedAddressPairs = allowedAddressPairs; + } + public List getVlans() { + return vlans; + } + public List getSriovVfs() { + return sriovVfs; + } + public List getlInterfaces() { + return lInterfaces; + } + public List getL3InterfaceIpv4AddressList() { + return l3InterfaceIpv4AddressList; + } + public List getL3InterfaceIpv6AddressList() { + return l3InterfaceIpv6AddressList; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof LInterface)) { + return false; + } + LInterface castOther = (LInterface) other; + return new EqualsBuilder().append(interfaceName, castOther.interfaceName).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(interfaceName).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java new file mode 100644 index 0000000000..8a3248e92c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java @@ -0,0 +1,123 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("lag-interface") +public class LagInterface implements Serializable, ShallowCopy{ + + private static final long serialVersionUID = -7493461787172382640L; + + @Id + @JsonProperty("interface-name") + private String interfaceName; + @JsonProperty("interface-description") + private String interfaceDescription; + @JsonProperty("speed-value") + private String speedValue; + @JsonProperty("speed-units") + private String speedUnits; + @JsonProperty("interface-id") + private String interfaceId; + @JsonProperty("interface-role") + private String interfaceRole; + @JsonProperty("prov-status") + private String provStatus; + @JsonProperty("in-maint") + private boolean inMaint; + @JsonProperty("l-interfaces") + private List lInterfaces = new ArrayList<>(); + + public String getInterfaceName() { + return interfaceName; + } + public void setInterfaceName(String interfaceName) { + this.interfaceName = interfaceName; + } + public String getInterfaceDescription() { + return interfaceDescription; + } + public void setInterfaceDescription(String interfaceDescription) { + this.interfaceDescription = interfaceDescription; + } + public String getSpeedValue() { + return speedValue; + } + public void setSpeedValue(String speedValue) { + this.speedValue = speedValue; + } + public String getSpeedUnits() { + return speedUnits; + } + public void setSpeedUnits(String speedUnits) { + this.speedUnits = speedUnits; + } + public String getInterfaceId() { + return interfaceId; + } + public void setInterfaceId(String interfaceId) { + this.interfaceId = interfaceId; + } + public String getInterfaceRole() { + return interfaceRole; + } + public void setInterfaceRole(String interfaceRole) { + this.interfaceRole = interfaceRole; + } + public String getProvStatus() { + return provStatus; + } + public void setProvStatus(String provStatus) { + this.provStatus = provStatus; + } + public boolean isInMaint() { + return inMaint; + } + public void setInMaint(boolean inMaint) { + this.inMaint = inMaint; + } + public List getlInterfaces() { + return lInterfaces; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof LagInterface)) { + return false; + } + LagInterface castOther = (LagInterface) other; + return new EqualsBuilder().append(interfaceName, castOther.interfaceName).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(interfaceName).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java new file mode 100644 index 0000000000..5868da563c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("line-of-business") +public class LineOfBusiness implements Serializable, ShallowCopy { + + private static final long serialVersionUID = -7697815326894443926L; + + @Id + @JsonProperty("line-of-business-name") + private String lineOfBusinessName; + + public String getLineOfBusinessName() { + return lineOfBusinessName; + } + + public void setLineOfBusinessName(String lineOfBusinessName) { + this.lineOfBusinessName = lineOfBusinessName; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof LineOfBusiness)) { + return false; + } + LineOfBusiness castOther = (LineOfBusiness) other; + return new EqualsBuilder().append(lineOfBusinessName, castOther.lineOfBusinessName).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(lineOfBusinessName).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Metadatum.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Metadatum.java new file mode 100644 index 0000000000..2e7d278901 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Metadatum.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +public class Metadatum implements Serializable, ShallowCopy{ + + private static final long serialVersionUID = -2259570072414712965L; + + @Id + @JsonProperty("metaname") + private String metaname; + @JsonProperty("metaval") + private String metaval; + + public String getMetaname() { + return metaname; + } + public void setMetaname(String metaname) { + this.metaname = metaname; + } + public String getMetaval() { + return metaval; + } + public void setMetaval(String metaval) { + this.metaval = metaval; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof Metadatum)) { + return false; + } + Metadatum castOther = (Metadatum) other; + return new EqualsBuilder().append(metaname, castOther.metaname).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(metaname).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/NetworkPolicy.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/NetworkPolicy.java new file mode 100644 index 0000000000..a920a585cb --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/NetworkPolicy.java @@ -0,0 +1,91 @@ +/*- + * ============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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +public class NetworkPolicy implements Serializable, ShallowCopy{ + + private static final long serialVersionUID = 8925599588239522447L; + + @Id + @JsonProperty("network-policy-id") + private String networkPolicyId; + @JsonProperty("network-policy-fqdn") + private String networkPolicyFqdn; + @JsonProperty("heat-stack-id") + private String heatStackId; + @JsonProperty("resource-version") + private String resourceVersion; + + public String getNetworkPolicyId() { + return this.networkPolicyId; + } + + public void setNetworkPolicyId(String networkPolicyId) { + this.networkPolicyId = networkPolicyId; + } + + public String getNetworkPolicyFqdn() { + return this.networkPolicyFqdn; + } + + public void setNetworkPolicyFqdn(String networkPolicyFqdn) { + this.networkPolicyFqdn = networkPolicyFqdn; + } + + public String getHeatStackId() { + return this.heatStackId; + } + + public void setHeatStackId(String heatStackId) { + this.heatStackId = heatStackId; + } + + public String getResourceVersion() { + return this.resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof NetworkPolicy)) { + return false; + } + NetworkPolicy castOther = (NetworkPolicy) other; + return new EqualsBuilder().append(networkPolicyId, castOther.networkPolicyId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(networkPolicyId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/OwningEntity.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/OwningEntity.java new file mode 100644 index 0000000000..e28e41ed46 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/OwningEntity.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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("owning-entity") +public class OwningEntity implements Serializable, ShallowCopy { + + private static final long serialVersionUID = -6565917570694869603L; + + @Id + @JsonProperty("owning-entity-id") + private String owningEntityId; + @JsonProperty("owning-entity-name") + private String owningEntityName; + + public String getOwningEntityId() { + return owningEntityId; + } + public void setOwningEntityId(String owningEntityId) { + this.owningEntityId = owningEntityId; + } + public String getOwningEntityName() { + return owningEntityName; + } + public void setOwningEntityName(String owningEntityName) { + this.owningEntityName = owningEntityName; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof OwningEntity)) { + return false; + } + OwningEntity castOther = (OwningEntity) other; + return new EqualsBuilder().append(owningEntityId, castOther.owningEntityId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(owningEntityId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java new file mode 100644 index 0000000000..498d096e65 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java @@ -0,0 +1,83 @@ +/*- + * ============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.bpmn.servicedecomposition.bbobjects; + + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; + + +public class PServer implements Serializable, ShallowCopy { + + private static final long serialVersionUID = 1378547515775540874L; + + @Id + @JsonProperty("pserver-id") + private String pserverId; + @JsonProperty("hostname") + private String hostname; + @JsonProperty("physical-links") + private List physicalLinks = new ArrayList(); //TODO techincally there is a pInterface between (pserver <--> physical-link) but dont really need that pojo + + public String getPserverId(){ + return pserverId; + } + + public void setPserverId(String pserverId){ + this.pserverId = pserverId; + } + + public String getHostname(){ + return hostname; + } + + public void setHostname(String hostname){ + this.hostname = hostname; + } + + public List getPhysicalLinks(){ + return physicalLinks; + } + + @Override + public boolean equals(final Object other){ + if(!(other instanceof PServer)){ + return false; + } + PServer castOther = (PServer) other; + return new EqualsBuilder().append(pserverId, castOther.pserverId).isEquals(); + } + + @Override + public int hashCode(){ + return new HashCodeBuilder().append(pserverId).toHashCode(); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java new file mode 100644 index 0000000000..4f54139386 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java @@ -0,0 +1,149 @@ +/*- + * ============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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("physical-link") +public class PhysicalLink implements Serializable, ShallowCopy { + + private static final long serialVersionUID = -6378347998443741227L; + + @Id + @JsonProperty("link-name") + private String linkName; + @JsonProperty("interface-name") + private String interfaceName; + @JsonProperty("service-provider-name") + private String serviceProviderName; + @JsonProperty("circuit-id") + private String circuitId; + @JsonProperty("management-option") + private String managementOption; + @JsonProperty("bandwidth-up") + private int bandwidthUp; + @JsonProperty("bandwidth-down") + private int bandwidthDown; + @JsonProperty("bandwidth-units") + private String bandwidthUnits; + @JsonProperty("wan-port") + private String wanPort; + + + public String getLinkName(){ + return linkName; + } + + public void setLinkName(String linkName){ + this.linkName = linkName; + } + + public String getInterfaceName(){ + return interfaceName; + } + + public void setInterfaceName(String interfaceName){ + this.interfaceName = interfaceName; + } + + + public String getServiceProviderName(){ + return serviceProviderName; + } + + + public void setServiceProviderName(String serviceProviderName){ + this.serviceProviderName = serviceProviderName; + } + + public String getCircuitId(){ + return circuitId; + } + + public void setCircuitId(String circuitId){ + this.circuitId = circuitId; + } + + public String getManagementOption(){ + return managementOption; + } + + public void setManagementOption(String managementOption){ + this.managementOption = managementOption; + } + + public int getBandwidthUp(){ + return bandwidthUp; + } + + public void setBandwidthUp(int bandwidthUp){ + this.bandwidthUp = bandwidthUp; + } + + public int getBandwidthDown(){ + return bandwidthDown; + } + + public void setBandwidthDown(int bandwidthDown){ + this.bandwidthDown = bandwidthDown; + } + + public String getBandwidthUnits(){ + return bandwidthUnits; + } + + public void setBandwidthUnits(String bandwidthUnits){ + this.bandwidthUnits = bandwidthUnits; + } + + public String getWanPort(){ + return wanPort; + } + + public void setWanPort(String wanPort){ + this.wanPort = wanPort; + } + + + @Override + public boolean equals(final Object other){ + if(!(other instanceof PhysicalLink)){ + return false; + } + PhysicalLink castOther = (PhysicalLink) other; + return new EqualsBuilder().append(linkName, castOther.linkName).isEquals(); + } + + @Override + public int hashCode(){ + return new HashCodeBuilder().append(linkName).toHashCode(); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.java new file mode 100644 index 0000000000..642417fa56 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("platform") +public class Platform implements Serializable, ShallowCopy { + + private static final long serialVersionUID = -9127507763010448699L; + + @Id + @JsonProperty("platform-name") + private String platformName; + + public String getPlatformName() { + return platformName; + } + + public void setPlatformName(String platformName) { + this.platformName = platformName; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Platform)) { + return false; + } + Platform castOther = (Platform) other; + return new EqualsBuilder().append(platformName, castOther.platformName).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(platformName).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java new file mode 100644 index 0000000000..2ec4108343 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java @@ -0,0 +1,116 @@ +/*- + * ============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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("pnf") +public class Pnf implements Serializable, ShallowCopy { + + private static final long serialVersionUID = -2544848120774529501L; + + @Id + @JsonProperty("pnf-id") + private String pnfId; + + @JsonProperty("pnf-name") + private String pnfName; + + @JsonProperty("role") + private String role; + + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + + @JsonProperty("cloud-region") + private CloudRegion cloudRegion; + + + public String getPnfId() { + return pnfId; + } + + public void setPnfId(String pnfId) { + this.pnfId = pnfId; + } + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } + + /** + * Distinguishes Primary or Secondary + */ + public String getRole() { + return role; + } + + /** + * Distinguishes Primary or Secondary + */ + public void setRole(String role) { + this.role = role; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public CloudRegion getCloudRegion() { + return cloudRegion; + } + + public void setCloudRegion(CloudRegion cloudRegion) { + this.cloudRegion = cloudRegion; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Pnf)) { + return false; + } + Pnf castOther = (Pnf) other; + return new EqualsBuilder().append(pnfId, castOther.pnfId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(pnfId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Project.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Project.java new file mode 100644 index 0000000000..a815f6af1a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Project.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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("project") +public class Project implements Serializable, ShallowCopy { + + private static final long serialVersionUID = 2449880559554533585L; + + @Id + @JsonProperty("project-name") + private String projectName; + + public String getProjectName() { + return projectName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Project)) { + return false; + } + Project castOther = (Project) other; + return new EqualsBuilder().append(projectName, castOther.projectName).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(projectName).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTableReference.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTableReference.java new file mode 100644 index 0000000000..0d8c3201bc --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTableReference.java @@ -0,0 +1,74 @@ +/*- + * ============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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +public class RouteTableReference implements Serializable, ShallowCopy { + + private static final long serialVersionUID = -698474994443040491L; + + @Id + @JsonProperty("route-table-reference-id") + private String routeTableReferenceId; + @JsonProperty("route-table-reference-fqdn") + private String routeTableReferenceFqdn; + @JsonProperty("resource-version") + private String resourceVersion; + + public String getRouteTableReferenceId() { + return routeTableReferenceId; + } + public void setRouteTableReferenceId(String routeTableReferenceId) { + this.routeTableReferenceId = routeTableReferenceId; + } + public String getRouteTableReferenceFqdn() { + return routeTableReferenceFqdn; + } + public void setRouteTableReferenceFqdn(String routeTableReferenceFqdn) { + this.routeTableReferenceFqdn = routeTableReferenceFqdn; + } + public String getResourceVersion() { + return resourceVersion; + } + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof RouteTableReference)) { + return false; + } + RouteTableReference castOther = (RouteTableReference) other; + return new EqualsBuilder().append(routeTableReferenceId, castOther.routeTableReferenceId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(routeTableReferenceId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTarget.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTarget.java new file mode 100644 index 0000000000..fc97306cfe --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTarget.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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("route-target") +public class RouteTarget implements Serializable, ShallowCopy { + private static final long serialVersionUID = -4635525992843470461L; + + @Id + @JsonProperty("global-route-target") + protected String globalRouteTarget; + @Id + @JsonProperty("route-target-role") + protected String routeTargetRole; + @JsonProperty("resource-version") + protected String resourceVersion; + + public String getGlobalRouteTarget() { + return globalRouteTarget; + } + + public void setGlobalRouteTarget(String value) { + this.globalRouteTarget = value; + } + + public String getRouteTargetRole() { + return routeTargetRole; + } + + public void setRouteTargetRole(String value) { + this.routeTargetRole = value; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String value) { + this.resourceVersion = value; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof RouteTarget)) { + return false; + } + RouteTarget castOther = (RouteTarget) other; + return new EqualsBuilder().append(globalRouteTarget, castOther.globalRouteTarget) + .append(routeTargetRole, castOther.routeTargetRole).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(globalRouteTarget).append(routeTargetRole).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SegmentationAssignment.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SegmentationAssignment.java new file mode 100644 index 0000000000..a299f1ef42 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SegmentationAssignment.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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("segmentation-assignment") +public class SegmentationAssignment implements Serializable, ShallowCopy{ + + private static final long serialVersionUID = 5751570091375657521L; + + @Id + @JsonProperty("segmentation-id") + private String segmentationId; + + public String getSegmentationId() { + return segmentationId; + } + public void setSegmentationId(String segmentationId) { + this.segmentationId = segmentationId; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof SegmentationAssignment)) { + return false; + } + SegmentationAssignment castOther = (SegmentationAssignment) other; + return new EqualsBuilder().append(segmentationId, castOther.segmentationId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(segmentationId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java new file mode 100644 index 0000000000..259a988262 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java @@ -0,0 +1,206 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.Metadata; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; +import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionInfo; + +@JsonRootName("service-instance") +public class ServiceInstance implements Serializable, ShallowCopy { + + private static final long serialVersionUID = -1843348234891739356L; + + @Id + @JsonProperty("service-instance-id") + private String serviceInstanceId; + @JsonProperty("service-instance-name") + private String serviceInstanceName; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("owning-entity") + private OwningEntity owningEntity; + @JsonProperty("project") + private Project project; + @JsonProperty("collection") + private Collection collection; + @JsonProperty("vnfs") + private List vnfs = new ArrayList<>(); + @JsonProperty("pnfs") + private List pnfs = new ArrayList<>(); + @JsonProperty("allotted-resources") + private List allottedResources = new ArrayList<>(); + @JsonProperty("networks") + private List networks = new ArrayList<>(); + @JsonProperty("vpn-bonding-links") + private List vpnBondingLinks = new ArrayList<>(); + @JsonProperty("vhn-portal-url") + private String vhnPortalUrl; + @JsonProperty("service-instance-location-id") + private String serviceInstanceLocationId; + @JsonProperty("selflink") + private String selflink; + @JsonProperty("metadata") + private Metadata metadata; + @JsonProperty("configurations") + private List configurations = new ArrayList<>(); + @JsonProperty("solution-info") + private SolutionInfo solutionInfo; + @JsonProperty("model-info-service-instance") + private ModelInfoServiceInstance modelInfoServiceInstance; + + public List getVnfs() { + return vnfs; + } + public List getAllottedResources() { + return allottedResources; + } + public List getNetworks() { + return networks; + } + public ModelInfoServiceInstance getModelInfoServiceInstance() { + return modelInfoServiceInstance; + } + public void setModelInfoServiceInstance(ModelInfoServiceInstance modelInfoServiceInstance) { + this.modelInfoServiceInstance = modelInfoServiceInstance; + } + public List getConfigurations() { + return configurations; + } + public void setConfigurations(List configurations) { + this.configurations = configurations; + } + public String getVhnPortalUrl() { + return vhnPortalUrl; + } + + public void setVhnPortalUrl(String vhnPortalUrl) { + this.vhnPortalUrl = vhnPortalUrl; + } + + public String getServiceInstanceLocationId() { + return serviceInstanceLocationId; + } + + public void setServiceInstanceLocationId(String serviceInstanceLocationId) { + this.serviceInstanceLocationId = serviceInstanceLocationId; + } + + public String getSelflink() { + return selflink; + } + + public void setSelflink(String selflink) { + this.selflink = selflink; + } + + public Metadata getMetadata() { + return metadata; + } + + public void setMetadata(Metadata metadata) { + this.metadata = metadata; + } + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + public String getServiceInstanceName() { + return serviceInstanceName; + } + + public void setServiceInstanceName(String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public OwningEntity getOwningEntity() { + return owningEntity; + } + + public void setOwningEntity(OwningEntity owningEntity) { + this.owningEntity = owningEntity; + } + + public Project getProject() { + return project; + } + + public void setProject(Project project) { + this.project = project; + } + + public Collection getCollection() { + return collection; + } + public void setCollection(Collection collection) { + this.collection = collection; + } + public List getVpnBondingLinks() { + return vpnBondingLinks; + } + public List getPnfs() { + return pnfs; + } + public SolutionInfo getSolutionInfo() { + return solutionInfo; + } + public void setSolutionInfo(SolutionInfo solutionInfo) { + this.solutionInfo = solutionInfo; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof ServiceInstance)) { + return false; + } + ServiceInstance castOther = (ServiceInstance) other; + return new EqualsBuilder().append(serviceInstanceId, castOther.serviceInstanceId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(serviceInstanceId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceProxy.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceProxy.java new file mode 100644 index 0000000000..fa076770d7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceProxy.java @@ -0,0 +1,108 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; +import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionCandidates; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy; + +import java.io.Serializable; +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +@JsonRootName("service-proxy") +public class ServiceProxy extends SolutionCandidates implements Serializable, ShallowCopy { + private static final long serialVersionUID = 1491890223056651430L; + + @Id + @JsonProperty("id") + private String id; + + @JsonProperty("type") + private String type; + + @JsonProperty("service-instance") + private ServiceInstance serviceInstance; + + @JsonProperty("model-info-service-proxy") + private ModelInfoServiceProxy modelInfoServiceProxy; + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * Way to identify the type of proxy + * i.e. "infrastructure", "transport", etc. + */ + public String getType() { + return type; + } + + /** + * Way to identify the type of proxy + * i.e. "infrastructure", "transport", etc. + */ + public void setType(String type) { + this.type = type; + } + + public ServiceInstance getServiceInstance() { + return serviceInstance; + } + + public void setServiceInstance(ServiceInstance serviceInstance) { + this.serviceInstance = serviceInstance; + } + + public ModelInfoServiceProxy getModelInfoServiceProxy() { + return modelInfoServiceProxy; + } + + public void setModelInfoServiceProxy(ModelInfoServiceProxy modelInfoServiceProxy) { + this.modelInfoServiceProxy = modelInfoServiceProxy; + } + + @Override + public boolean equals(final Object other){ + if(!(other instanceof ServiceProxy)){ + return false; + } + ServiceProxy castOther = (ServiceProxy) other; + return new EqualsBuilder().append(id, castOther.id).isEquals(); + } + + @Override + public int hashCode(){ + return new HashCodeBuilder().append(id).toHashCode(); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java new file mode 100644 index 0000000000..56f95516b1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("service-subscription") +public class ServiceSubscription implements Serializable, ShallowCopy{ + + private static final long serialVersionUID = 9064449329296611436L; + + @Id + @JsonProperty("service-type") + private String serviceType; + @JsonProperty("temp-ub-sub-account-id") + private String tempUbSubAccountId; + @JsonProperty("service-instances") + private List serviceInstances = new ArrayList(); + + public String getServiceType() { + return serviceType; + } + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + public String getTempUbSubAccountId() { + return tempUbSubAccountId; + } + public void setTempUbSubAccountId(String tempUbSubAccountId) { + this.tempUbSubAccountId = tempUbSubAccountId; + } + public List getServiceInstances() { + return serviceInstances; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof ServiceSubscription)) { + return false; + } + ServiceSubscription castOther = (ServiceSubscription) other; + return new EqualsBuilder().append(serviceType, castOther.serviceType).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(serviceType).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SriovVf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SriovVf.java new file mode 100644 index 0000000000..fcea22819e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SriovVf.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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("sriov-vf") +public class SriovVf implements Serializable, ShallowCopy{ + + private static final long serialVersionUID = -7790331637399859914L; + + @Id + @JsonProperty("pci-id") + private String pciId; + @JsonProperty("vf-vlan-filter") + private String vfVlanFilter; + @JsonProperty("vf-mac-filter") + private String vfMacFilter; + @JsonProperty("vf-vlan-strip") + private Boolean vfVlanStrip; + @JsonProperty("vf-vlan-anti-spoof-check") + private Boolean vfVlanAntiSpoofCheck; + @JsonProperty("vf-mac-anti-spoof-check") + private Boolean vfMacAntiSpoofCheck; + @JsonProperty("vf-mirrors") + private String vfMirrors; + @JsonProperty("vf-broadcast-allow") + private Boolean vfBroadcastAllow; + @JsonProperty("vf-unknown-multicast-allow") + private Boolean vfUnknownMulticastAllow; + @JsonProperty("vf-unknown-unicast-allow") + private Boolean vfUnknownUnicastAllow; + @JsonProperty("vf-insert-stag") + private Boolean vfInsertStag; + @JsonProperty("vf-link-status") + private String vfLinkStatus; + @JsonProperty("neutron-network-id") + private String neutronNetworkId; + + public String getPciId() { + return pciId; + } + public void setPciId(String pciId) { + this.pciId = pciId; + } + public String getVfVlanFilter() { + return vfVlanFilter; + } + public void setVfVlanFilter(String vfVlanFilter) { + this.vfVlanFilter = vfVlanFilter; + } + public String getVfMacFilter() { + return vfMacFilter; + } + public void setVfMacFilter(String vfMacFilter) { + this.vfMacFilter = vfMacFilter; + } + public Boolean getVfVlanStrip() { + return vfVlanStrip; + } + public void setVfVlanStrip(Boolean vfVlanStrip) { + this.vfVlanStrip = vfVlanStrip; + } + public Boolean getVfVlanAntiSpoofCheck() { + return vfVlanAntiSpoofCheck; + } + public void setVfVlanAntiSpoofCheck(Boolean vfVlanAntiSpoofCheck) { + this.vfVlanAntiSpoofCheck = vfVlanAntiSpoofCheck; + } + public Boolean getVfMacAntiSpoofCheck() { + return vfMacAntiSpoofCheck; + } + public void setVfMacAntiSpoofCheck(Boolean vfMacAntiSpoofCheck) { + this.vfMacAntiSpoofCheck = vfMacAntiSpoofCheck; + } + public String getVfMirrors() { + return vfMirrors; + } + public void setVfMirrors(String vfMirrors) { + this.vfMirrors = vfMirrors; + } + public Boolean getVfBroadcastAllow() { + return vfBroadcastAllow; + } + public void setVfBroadcastAllow(Boolean vfBroadcastAllow) { + this.vfBroadcastAllow = vfBroadcastAllow; + } + public Boolean getVfUnknownMulticastAllow() { + return vfUnknownMulticastAllow; + } + public void setVfUnknownMulticastAllow(Boolean vfUnknownMulticastAllow) { + this.vfUnknownMulticastAllow = vfUnknownMulticastAllow; + } + public Boolean getVfUnknownUnicastAllow() { + return vfUnknownUnicastAllow; + } + public void setVfUnknownUnicastAllow(Boolean vfUnknownUnicastAllow) { + this.vfUnknownUnicastAllow = vfUnknownUnicastAllow; + } + public Boolean getVfInsertStag() { + return vfInsertStag; + } + public void setVfInsertStag(Boolean vfInsertStag) { + this.vfInsertStag = vfInsertStag; + } + public String getVfLinkStatus() { + return vfLinkStatus; + } + public void setVfLinkStatus(String vfLinkStatus) { + this.vfLinkStatus = vfLinkStatus; + } + public String getNeutronNetworkId() { + return neutronNetworkId; + } + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof SriovVf)) { + return false; + } + SriovVf castOther = (SriovVf) other; + return new EqualsBuilder().append(pciId, castOther.pciId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(pciId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java new file mode 100644 index 0000000000..cb23f3a3b9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java @@ -0,0 +1,173 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("subnet") +public class Subnet implements Serializable, ShallowCopy{ + + private static final long serialVersionUID = -6789344717555598319L; + + @Id + @JsonProperty("subnet-id") + private String subnetId; + @JsonProperty("subnet-name") + private String subnetName; + @JsonProperty("neutron-subnet-id") + private String neutronSubnetId; + @JsonProperty("gateway-address") + private String gatewayAddress; + @JsonProperty("network-start-address") + private String networkStartAddress; + @JsonProperty("cidr-mask") + private String cidrMask; + @JsonProperty("ip-version") + private String ipVersion; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("dhcp-enabled") + private boolean dhcpEnabled; + @JsonProperty("dhcp-start") + private String dhcpStart; + @JsonProperty("dhcp-end") + private String dhcpEnd; + @JsonProperty("subnet-role") + private String subnetRole; + @JsonProperty("ip-assignment-direction") + private String ipAssignmentDirection; + @JsonProperty("subnet-sequence") + private Integer subnetSequence; + @JsonProperty("host-routes") + private List hostRoutes = new ArrayList<>(); + + public String getSubnetId() { + return subnetId; + } + public void setSubnetId(String subnetId) { + this.subnetId = subnetId; + } + public String getSubnetName() { + return subnetName; + } + public void setSubnetName(String subnetName) { + this.subnetName = subnetName; + } + public String getNeutronSubnetId() { + return neutronSubnetId; + } + public void setNeutronSubnetId(String neutronSubnetId) { + this.neutronSubnetId = neutronSubnetId; + } + public String getGatewayAddress() { + return gatewayAddress; + } + public void setGatewayAddress(String gatewayAddress) { + this.gatewayAddress = gatewayAddress; + } + public String getNetworkStartAddress() { + return networkStartAddress; + } + public void setNetworkStartAddress(String networkStartAddress) { + this.networkStartAddress = networkStartAddress; + } + public String getCidrMask() { + return cidrMask; + } + public void setCidrMask(String cidrMask) { + this.cidrMask = cidrMask; + } + public String getIpVersion() { + return ipVersion; + } + public void setIpVersion(String ipVersion) { + this.ipVersion = ipVersion; + } + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public boolean isDhcpEnabled() { + return dhcpEnabled; + } + public void setDhcpEnabled(boolean dhcpEnabled) { + this.dhcpEnabled = dhcpEnabled; + } + public String getDhcpStart() { + return dhcpStart; + } + public void setDhcpStart(String dhcpStart) { + this.dhcpStart = dhcpStart; + } + public String getDhcpEnd() { + return dhcpEnd; + } + public void setDhcpEnd(String dhcpEnd) { + this.dhcpEnd = dhcpEnd; + } + public String getSubnetRole() { + return subnetRole; + } + public void setSubnetRole(String subnetRole) { + this.subnetRole = subnetRole; + } + public String getIpAssignmentDirection() { + return ipAssignmentDirection; + } + public void setIpAssignmentDirection(String ipAssignmentDirection) { + this.ipAssignmentDirection = ipAssignmentDirection; + } + public Integer getSubnetSequence() { + return subnetSequence; + } + public void setSubnetSequence(Integer subnetSequence) { + this.subnetSequence = subnetSequence; + } + public List getHostRoutes() { + return hostRoutes; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof Subnet)) { + return false; + } + Subnet castOther = (Subnet) other; + return new EqualsBuilder().append(subnetId, castOther.subnetId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(subnetId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java new file mode 100644 index 0000000000..fba78d7a87 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java @@ -0,0 +1,137 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("vf-module") +public class VfModule implements Serializable, ShallowCopy { + + private static final long serialVersionUID = 6570087672008609773L; + + @Id + @JsonProperty("vf-module-id") + private String vfModuleId; + @JsonProperty("vf-module-name") + private String vfModuleName; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("cloud-params") + private Map cloudParams = new HashMap<>(); + @JsonProperty("cascaded") + private boolean cascaded; + @JsonProperty("heat-stack-id") + private String heatStackId; + @JsonProperty("contrail-service-instance-fqdn") + private String contrailServiceInstanceFqdn; + @JsonProperty("module-index") + private Integer moduleIndex; + @JsonProperty("selflink") + private String selflink; + @JsonProperty("model-info-vf-module") + private ModelInfoVfModule modelInfoVfModule; + + public ModelInfoVfModule getModelInfoVfModule() { + return modelInfoVfModule; + } + public void setModelInfoVfModule(ModelInfoVfModule modelInfoVfModule) { + this.modelInfoVfModule = modelInfoVfModule; + } + public String getHeatStackId() { + return heatStackId; + } + public void setHeatStackId(String heatStackId) { + this.heatStackId = heatStackId; + } + public String getContrailServiceInstanceFqdn() { + return contrailServiceInstanceFqdn; + } + public void setContrailServiceInstanceFqdn(String contrailServiceInstanceFqdn) { + this.contrailServiceInstanceFqdn = contrailServiceInstanceFqdn; + } + public Integer getModuleIndex() { + return moduleIndex; + } + public void setModuleIndex(Integer moduleIndex) { + this.moduleIndex = moduleIndex; + } + public String getSelflink() { + return selflink; + } + public void setSelflink(String selflink) { + this.selflink = selflink; + } + public String getVfModuleId() { + return vfModuleId; + } + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + public String getVfModuleName() { + return vfModuleName; + } + public void setVfModuleName(String vfModuleName) { + this.vfModuleName = vfModuleName; + } + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public Map getCloudParams() { + return cloudParams; + } + public void setCloudParams(Map cloudParams) { + this.cloudParams = cloudParams; + } + public boolean isCascaded() { + return cascaded; + } + public void setCascaded(boolean cascaded) { + this.cascaded = cascaded; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof VfModule)) { + return false; + } + VfModule castOther = (VfModule) other; + return new EqualsBuilder().append(vfModuleId, castOther.vfModuleId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(vfModuleId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java new file mode 100644 index 0000000000..65eeedc44c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.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.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("vlan") +public class Vlan implements Serializable, ShallowCopy{ + + private static final long serialVersionUID = 1260512753640402946L; + + @Id + @JsonProperty("vlan-interface") + private String vlanInterface; + @JsonProperty("vlan-id-inner") + private Long vlanIdInner; + @JsonProperty("vlan-id-outer") + private Long vlanIdOuter; + @JsonProperty("speed-value") + private String speedValue; + @JsonProperty("speed-units") + private String speedUnits; + @JsonProperty("vlan-description") + private String vlanDescription; + @JsonProperty("backdoor-connection") + private String backdoorConnection; + @JsonProperty("vpn-key") + private String vpnKey; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("in-maint") + private boolean inMaint; + @JsonProperty("prov-status") + private String provStatus; + @JsonProperty("is-ip-unnumbered") + private boolean isIpUnnumbered; + @JsonProperty("l3-interface-ipv4-address-list") + private List l3InterfaceIpv4AddressList = new ArrayList(); + @JsonProperty("l3-interface-ipv6-address-list") + private List l3InterfaceIpv6AddressList = new ArrayList(); + + public String getVlanInterface() { + return vlanInterface; + } + public void setVlanInterface(String vlanInterface) { + this.vlanInterface = vlanInterface; + } + public Long getVlanIdInner() { + return vlanIdInner; + } + public void setVlanIdInner(Long vlanIdInner) { + this.vlanIdInner = vlanIdInner; + } + public Long getVlanIdOuter() { + return vlanIdOuter; + } + public void setVlanIdOuter(Long vlanIdOuter) { + this.vlanIdOuter = vlanIdOuter; + } + public String getSpeedValue() { + return speedValue; + } + public void setSpeedValue(String speedValue) { + this.speedValue = speedValue; + } + public String getSpeedUnits() { + return speedUnits; + } + public void setSpeedUnits(String speedUnits) { + this.speedUnits = speedUnits; + } + public String getVlanDescription() { + return vlanDescription; + } + public void setVlanDescription(String vlanDescription) { + this.vlanDescription = vlanDescription; + } + public String getBackdoorConnection() { + return backdoorConnection; + } + public void setBackdoorConnection(String backdoorConnection) { + this.backdoorConnection = backdoorConnection; + } + public String getVpnKey() { + return vpnKey; + } + public void setVpnKey(String vpnKey) { + this.vpnKey = vpnKey; + } + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public boolean isInMaint() { + return inMaint; + } + public void setInMaint(boolean inMaint) { + this.inMaint = inMaint; + } + public String getProvStatus() { + return provStatus; + } + public void setProvStatus(String provStatus) { + this.provStatus = provStatus; + } + public boolean isIpUnnumbered() { + return isIpUnnumbered; + } + public void setIpUnnumbered(boolean isIpUnnumbered) { + this.isIpUnnumbered = isIpUnnumbered; + } + public List getL3InterfaceIpv4AddressList() { + return l3InterfaceIpv4AddressList; + } + public List getL3InterfaceIpv6AddressList() { + return l3InterfaceIpv6AddressList; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof Vlan)) { + return false; + } + Vlan castOther = (Vlan) other; + return new EqualsBuilder().append(vlanInterface, castOther.vlanInterface).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(vlanInterface).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java new file mode 100644 index 0000000000..565a151077 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java @@ -0,0 +1,121 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("volume-group") +public class VolumeGroup implements Serializable, ShallowCopy { + + private static final long serialVersionUID = 870124265764370922L; + + @Id + @JsonProperty("volume-group-id") + private String volumeGroupId; + @JsonProperty("volume-group-name") + private String volumeGroupName; + @JsonProperty("vnf-type") + private String vnfType; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("cloud-params") + private Map cloudParams = new HashMap<>(); + @JsonProperty("cascaded") + private boolean cascaded; + @JsonProperty("heat-stack-id") + private String heatStackId; + @JsonProperty("model-info-vf-module") + private ModelInfoVfModule modelInfoVfModule; + + public ModelInfoVfModule getModelInfoVfModule() { + return modelInfoVfModule; + } + public void setModelInfoVfModule(ModelInfoVfModule modelInfoVfModule) { + this.modelInfoVfModule = modelInfoVfModule; + } + public String getHeatStackId() { + return heatStackId; + } + public void setHeatStackId(String heatStackId) { + this.heatStackId = heatStackId; + } + public String getVolumeGroupId() { + return volumeGroupId; + } + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + public String getVolumeGroupName() { + return volumeGroupName; + } + public void setVolumeGroupName(String volumeGroupName) { + this.volumeGroupName = volumeGroupName; + } + public String getVnfType() { + return vnfType; + } + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public Map getCloudParams() { + return cloudParams; + } + public void setCloudParams(Map cloudParams) { + this.cloudParams = cloudParams; + } + public boolean isCascaded() { + return cascaded; + } + public void setCascaded(boolean cascaded) { + this.cascaded = cascaded; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof VolumeGroup)) { + return false; + } + VolumeGroup castOther = (VolumeGroup) other; + return new EqualsBuilder().append(volumeGroupId, castOther.volumeGroupId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(volumeGroupId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBinding.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBinding.java new file mode 100644 index 0000000000..36e1af443c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBinding.java @@ -0,0 +1,141 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Id; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + + +@JsonRootName("vpn-binding") +public class VpnBinding implements Serializable, ShallowCopy { + private static final long serialVersionUID = 3283413795353486924L; + + @Id + @JsonProperty("vpn-id") + private String vpnId; + @JsonProperty("vpn-name") + private String vpnName; + @JsonProperty("vpn-platform") + private String vpnPlatform; + @JsonProperty("vpn-type") + private String vpnType; + @JsonProperty("vpn-region") + private String vpnRegion; + @JsonProperty("customer-vpn-id") + private String customerVpnId; + @JsonProperty("route-distinguisher") + private String routeDistinguisher; + @JsonProperty("resource-version") + private String resourceVersion; + @JsonProperty("route-targets") + private List routeTargets = new ArrayList<>(); + + public String getVpnId() { + return vpnId; + } + + public void setVpnId(String value) { + this.vpnId = value; + } + + public String getVpnName() { + return vpnName; + } + + public void setVpnName(String value) { + this.vpnName = value; + } + + public String getVpnPlatform() { + return vpnPlatform; + } + + public void setVpnPlatform(String value) { + this.vpnPlatform = value; + } + + public String getVpnType() { + return vpnType; + } + + public void setVpnType(String value) { + this.vpnType = value; + } + + public String getVpnRegion() { + return vpnRegion; + } + + public void setVpnRegion(String value) { + this.vpnRegion = value; + } + + public String getCustomerVpnId() { + return customerVpnId; + } + + public void setCustomerVpnId(String value) { + this.customerVpnId = value; + } + + public String getRouteDistinguisher() { + return routeDistinguisher; + } + + public void setRouteDistinguisher(String value) { + this.routeDistinguisher = value; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String value) { + this.resourceVersion = value; + } + + public List getRouteTargets() { + return routeTargets; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VpnBinding)) { + return false; + } + VpnBinding castOther = (VpnBinding) other; + return new EqualsBuilder().append(vpnId, castOther.vpnId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(vpnId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java new file mode 100644 index 0000000000..dec3d48203 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.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.bpmn.servicedecomposition.bbobjects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +import javax.persistence.Id; + +import static org.apache.commons.lang3.StringUtils.*; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("vpn-bonding-link") +public class VpnBondingLink implements Serializable, ShallowCopy { + + private static final long serialVersionUID = -8355973761714642727L; + + @Id + @JsonProperty("vpn-bonding-link-id") + private String vpnBondingLinkId; + + @JsonProperty("configurations") + private List configurations = new ArrayList(); + + @JsonProperty("service-proxies") + private List serviceProxies = new ArrayList(); + + public String getVpnBondingLinkId() { + return vpnBondingLinkId; + } + + public void setVpnBondingLinkId(String vpnBondingLinkId) { + this.vpnBondingLinkId = vpnBondingLinkId; + } + + public List getConfigurations() { + return configurations; + } + + public List getServiceProxies() { + return serviceProxies; + } + + public ServiceProxy getServiceProxy(String id) { + ServiceProxy serviceProxy = null; + for(ServiceProxy s : serviceProxies){ + if(s.getId().equals(id)){ + serviceProxy = s; + } + } + return serviceProxy; + } + + //TODO temp solution until references are updated to use getConfigurationByType + public Configuration getVnrConfiguration() { + Configuration configuration = null; + for(Configuration c:configurations){ + if(containsIgnoreCase(c.getConfigurationType(), "vlan") || containsIgnoreCase(c.getConfigurationType(), "vnr")){ + configuration = c; + } + } + return configuration; + } + + //TODO temp solution until references are updatedd + public void setVnrConfiguration(Configuration vnrConfiguration) { + if(vnrConfiguration.getConfigurationType() == null){ + vnrConfiguration.setConfigurationType("vlan"); + } + configurations.add(vnrConfiguration); + } + + //TODO temp solution until references are updated to use getConfigurationByType + public Configuration getVrfConfiguration() { + Configuration configuration = null; + for(Configuration c:configurations){ + if(containsIgnoreCase(c.getConfigurationType(), "vrf")){ + configuration = c; + } + } + return configuration; + } + + //TODO temp solution until references are updated + public void setVrfConfiguration(Configuration vrfConfiguration) { + if(vrfConfiguration.getConfigurationType() == null){ + vrfConfiguration.setConfigurationType("vrf"); + } + configurations.add(vrfConfiguration); + } + + //TODO temp solution until references are updated to use getServiceProxyByType + public ServiceProxy getInfrastructureServiceProxy() { + ServiceProxy serviceProxy = null; + for(ServiceProxy sp:serviceProxies){ + if(sp.getType().equals("infrastructure")){ + serviceProxy = sp; + } + } + return serviceProxy; + } + + //TODO temp solution until references are updated + public void setInfrastructureServiceProxy(ServiceProxy infrastructureServiceProxy) { + infrastructureServiceProxy.setType("infrastructure"); + serviceProxies.add(infrastructureServiceProxy); + } + + //TODO temp solution until references are updated to use getServiceProxyByType + public ServiceProxy getTransportServiceProxy() { + ServiceProxy serviceProxy = null; + for(ServiceProxy sp:serviceProxies){ + if(sp != null){ + if(sp.getType().equals("transport")){ + serviceProxy = sp; + } + } + } + return serviceProxy; + } + + //TODO temp solution until references are updated + public void setTransportServiceProxy(ServiceProxy transportServiceProxy) { + transportServiceProxy.setType("transport"); + serviceProxies.add(transportServiceProxy); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VpnBondingLink)) { + return false; + } + VpnBondingLink castOther = (VpnBondingLink) other; + return new EqualsBuilder().append(vpnBondingLinkId, castOther.vpnBondingLinkId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(vpnBondingLinkId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java new file mode 100644 index 0000000000..5746dcd586 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.entities; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("buildingBlock") +public class BuildingBlock implements Serializable{ + + private static final long serialVersionUID = -1144315411128866052L; + + @JsonProperty("mso-id") + private String msoId; + @JsonProperty("bpmn-flow-name") + private String bpmnFlowName; + @JsonProperty("key") + private String key; + @JsonProperty("is-virtual-link") + private boolean isVirtualLink; + + public String getBpmnFlowName() { + return bpmnFlowName; + } + public void setBpmnFlowName(String bpmnFlowName) { + this.bpmnFlowName = bpmnFlowName; + } + public String getMsoId() { + return msoId; + } + public void setMsoId(String msoId) { + this.msoId = msoId; + } + public String getKey() { + return key; + } + public void setKey(String key) { + this.key = key; + } + public boolean getIsVirtualLink() { + return isVirtualLink; + } + public void setIsVirtualLink(boolean isVirtualLink) { + this.isVirtualLink = isVirtualLink; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java new file mode 100644 index 0000000000..36a24bd1e1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.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.bpmn.servicedecomposition.entities; + +import java.io.Serializable; + +import org.onap.so.serviceinstancebeans.RequestDetails; + +public class ExecuteBuildingBlock implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 1L; + private BuildingBlock buildingBlock; + private String requestId; + private String apiVersion; + private String resourceId; + private String requestAction; + private String vnfType; + private boolean aLaCarte; + private boolean homing; + private WorkflowResourceIds workflowResourceIds; + private RequestDetails requestDetails; + + public BuildingBlock getBuildingBlock() { + return buildingBlock; + } + public void setBuildingBlock(BuildingBlock buildingBlock) { + this.buildingBlock = buildingBlock; + } + public String getRequestId() { + return requestId; + } + public void setRequestId(String requestId) { + this.requestId = requestId; + } + public String getApiVersion() { + return apiVersion; + } + public void setApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + } + public String getResourceId() { + return resourceId; + } + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + public String getRequestAction() { + return requestAction; + } + public void setRequestAction(String requestAction) { + this.requestAction = requestAction; + } + public boolean isaLaCarte() { + return aLaCarte; + } + public void setaLaCarte(boolean aLaCarte) { + this.aLaCarte = aLaCarte; + } + public String getVnfType() { + return vnfType; + } + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + public boolean isHoming() { + return homing; + } + public void setHoming(boolean homing) { + this.homing = homing; + } + public WorkflowResourceIds getWorkflowResourceIds() { + return workflowResourceIds; + } + public void setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) { + this.workflowResourceIds = workflowResourceIds; + } + public RequestDetails getRequestDetails() { + return requestDetails; + } + public void setRequestDetails(RequestDetails requestDetails) { + this.requestDetails = requestDetails; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java new file mode 100644 index 0000000000..adea99c4f3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.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.bpmn.servicedecomposition.entities; + +import java.io.Serializable; +import java.util.Map; + +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; + +public class GeneralBuildingBlock implements Serializable { + private static final String INVALID_INPUT_MISSING = "Expected building block input of \"%s\" not found in decomposition"; + private static final String INVALID_INPUT_CLASS_CAST = "Expected building block input of \"%s\" was the wrong object type in the decomposition"; + + private static final long serialVersionUID = -429247436428110843L; + + private RequestContext requestContext; + private OrchestrationContext orchContext; + private Map userInput; + private CloudRegion cloudRegion; + + private Customer customer; + private ServiceInstance serviceInstance; + + public CloudRegion getCloudRegion() { + return cloudRegion; + } + + public void setCloudRegion(CloudRegion cloudRegion) { + this.cloudRegion = cloudRegion; + } + + public RequestContext getRequestContext() { + return requestContext; + } + + public void setRequestContext(RequestContext requestContext) { + this.requestContext = requestContext; + } + + public OrchestrationContext getOrchContext() { + return orchContext; + } + + public void setOrchContext(OrchestrationContext orchContext) { + this.orchContext = orchContext; + } + + public Map getUserInput() { + return userInput; + } + + public void setUserInput(Map userInput) { + this.userInput = userInput; + } + + public Customer getCustomer() { + return customer; + } + + public void setCustomer(Customer customer) { + this.customer = customer; + } + + public ServiceInstance getServiceInstance() { + return serviceInstance; + } + + public void setServiceInstance(ServiceInstance serviceInstance) { + this.serviceInstance = serviceInstance; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java new file mode 100644 index 0000000000..4662db23a1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.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.bpmn.servicedecomposition.entities; + +public enum ResourceKey { + SERVICE_INSTANCE_ID, + GENERIC_VNF_ID, + NETWORK_ID, + VOLUME_GROUP_ID, + VF_MODULE_ID, + ALLOTTED_RESOURCE_ID, + CONFIGURATION_ID, + NETWORK_COLLECTION_ID, + VPN_ID, + VPN_BONDING_LINK_ID; +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java new file mode 100644 index 0000000000..433315b2ed --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java @@ -0,0 +1,103 @@ +/*- + * ============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.bpmn.servicedecomposition.entities; + +import java.io.Serializable; +import org.apache.commons.lang3.builder.ToStringBuilder; + +public class WorkflowResourceIds implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 8591599114353940105L; + private String serviceInstanceId; + private String vnfId; + private String networkId; + private String volumeGroupId; + private String vfModuleId; + private String networkCollectionId; + private String configurationId; + + @Override + public String toString() { + return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId).append("vnfId", vnfId) + .append("networkId", networkId).append("volumeGroupId", volumeGroupId).append("vfModuleId", vfModuleId) + .append("networkCollectionId", networkCollectionId).append("configurationId", configurationId) + .toString(); + } + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getVolumeGroupId() { + return volumeGroupId; + } + + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public String getNetworkCollectionId() { + return networkCollectionId; + } + + public void setNetworkCollectionId(String networkCollectionId) { + this.networkCollectionId = networkCollectionId; + } + + public String getConfigurationId() { + return configurationId; + } + + public void setConfigurationId(String configurationId) { + this.configurationId = configurationId; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputException.java new file mode 100644 index 0000000000..21828871db --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputException.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.bpmn.servicedecomposition.entities.exceptions; + +public class InvalidBuildingBlockInputException extends Exception { + private static final long serialVersionUID = 221404474263656742L; + + public InvalidBuildingBlockInputException() { + super(); + } + + public InvalidBuildingBlockInputException(String message) { + super(message); + } + + public InvalidBuildingBlockInputException(String message, Throwable cause) { + super(message, cause); + } + + public InvalidBuildingBlockInputException(Throwable cause) { + super(cause); + } + + protected InvalidBuildingBlockInputException(String message, Throwable cause, + boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java new file mode 100644 index 0000000000..e1a12bbad9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.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.bpmn.servicedecomposition.generalobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +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("license") +public class License implements Serializable { + + private static final long serialVersionUID = 2345786874755685318L; + + @JsonProperty("entitlement-pool-uuids") + private List entitlementPoolUuids = new ArrayList(); + @JsonProperty("license-key-group-uuids") + private List licenseKeyGroupUuids = new ArrayList(); + + + public List getEntitlementPoolUuids() { + return entitlementPoolUuids; + } + public void setEntitlementPoolUuids(List entitlementPoolUuids) { + this.entitlementPoolUuids = entitlementPoolUuids; + } + public List getLicenseKeyGroupUuids() { + return licenseKeyGroupUuids; + } + public void setLicenseKeyGroupUuids(List licenseKeyGroupUuids) { + this.licenseKeyGroupUuids = licenseKeyGroupUuids; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java new file mode 100644 index 0000000000..d594c73638 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.generalobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("orchestration-context") +public class OrchestrationContext implements Serializable { + + private static final long serialVersionUID = 6843015923244810369L; + + @JsonProperty("is-rollback-enabled") + private boolean isRollbackEnabled; + + public boolean getIsRollbackEnabled() { + return this.isRollbackEnabled; + } + + public void setIsRollbackEnabled(boolean isRollbackEnabled) { + this.isRollbackEnabled = isRollbackEnabled; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java new file mode 100644 index 0000000000..7715651b68 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.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.bpmn.servicedecomposition.generalobjects; + +import java.io.Serializable; +import java.util.HashMap; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("request-context") +public class RequestContext implements Serializable{ + + private static final long serialVersionUID = -6482733428879732822L; + + @JsonProperty("product-family-id") + private String productFamilyId; + @JsonProperty("source") + private String source; + @JsonProperty("requestor-id") + private String requestorId; + @JsonProperty("subscription-service-type") + private String subscriptionServiceType; + @JsonProperty("user-params") + private HashMap userParams; + @JsonProperty("action") + private String action; + @JsonProperty("callback-url") + private String callbackURL; + @JsonProperty("service-uri") + private String serviceURI; + @JsonProperty("mso-request-id") + private String msoRequestId; + @JsonProperty("requestParameters") + private RequestParameters requestParameters; + + public String getServiceURI() { + return serviceURI; + } + public void setServiceURI(String serviceURI) { + this.serviceURI = serviceURI; + } + public String getProductFamilyId() { + return productFamilyId; + } + public void setProductFamilyId(String productFamilyId) { + this.productFamilyId = productFamilyId; + } + public String getSource() { + return source; + } + public void setSource(String source) { + this.source = source; + } + public String getRequestorId() { + return requestorId; + } + public void setRequestorId(String requestorId) { + this.requestorId = requestorId; + } + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + public HashMap getUserParams() { + return userParams; + } + public void setUserParams(HashMap userParams) { + this.userParams = userParams; + } + public String getAction() { + return action; + } + public void setAction(String action) { + this.action = action; + } + public String getCallbackURL() { + return callbackURL; + } + public void setCallbackURL(String callbackURL) { + this.callbackURL = callbackURL; + } + public String getMsoRequestId() { + return msoRequestId; + } + public void setMsoRequestId(String msoRequestId) { + this.msoRequestId = msoRequestId; + } + public RequestParameters getRequestParameters() { + return requestParameters; + } + public void setRequestParameters(RequestParameters requestParameters) { + this.requestParameters = requestParameters; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java new file mode 100644 index 0000000000..24c0548641 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java @@ -0,0 +1,112 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - 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========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.generalobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +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 MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, RequestParameters.class); + + private static final long serialVersionUID = -5979049912538894930L; + @JsonProperty("subscriptionServiceType") + private String subscriptionServiceType; + @JsonProperty("userParams") + private List> userParams = new ArrayList<>(); + @JsonProperty("aLaCarte") + private Boolean aLaCarte; + + + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + @JsonProperty("aLaCarte") + public Boolean getALaCarte() { + return aLaCarte; + } + @JsonProperty("aLaCarte") + public void setaLaCarte(Boolean aLaCarte) { + this.aLaCarte = aLaCarte; + } + + public Boolean isaLaCarte() { + return aLaCarte; + } + + public List> getUserParams() { + return userParams; + } + + public void setUserParams(List> userParams) { + this.userParams = userParams; + } + + public Object getUserParamValue(String name) { + if (userParams != null) { + for (Map param : userParams) { + if (param.get(name) != null) { + return param.get(name); + } + } + } + return null; + } + + + @JsonInclude(Include.NON_NULL) + public String toJsonString(){ + String json = ""; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + ObjectWriter ow = mapper.writer(); + try{ + json = ow.writeValueAsString(this); + }catch (Exception e){ + log.error("Unable to convert Sniro Manager Request to string", e); + } + return json; + } + + @Override + public String toString() { + return "RequestParameters [subscriptionServiceType=" + + subscriptionServiceType + ", userParams=" + userParams + + ", aLaCarte=" + aLaCarte + "]"; + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java new file mode 100644 index 0000000000..01846681db --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java @@ -0,0 +1,71 @@ +/*- + * ============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.bpmn.servicedecomposition.homingobjects; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class Candidate implements Serializable { + + + private static final long serialVersionUID = -3959572501582849328L; + + @JsonProperty("candidateType") + private CandidateType candidateType; + @JsonProperty("candidates") + private List candidates; + + /** + * list of candidates + * i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc. + */ + public List getCandidates() { + return candidates; + } + + /** + * list of candidates + * i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc. + */ + public void setCandidates(List candidates) { + this.candidates = candidates; + } + + /** + * Way to identify the type of candidate + * i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc. + */ + public CandidateType getCandidateType(){ + return candidateType; + } + + /** + * Way to identify the type of candidate + * i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc. + */ + public void setCandidateType(CandidateType candidateType){ + this.candidateType = candidateType; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java new file mode 100644 index 0000000000..9540b9148e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.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.bpmn.servicedecomposition.homingobjects; + +public enum CandidateType { + SERVICE_INSTANCE_ID("serviceInstanceId"), + CLOUD_REGION_ID("cloudRegionId"), + VNF_ID("vnfId"), + VNF_NAME("vnfName"); + + private final String name; + + private CandidateType(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } + + //TODO added to get PojoTest to work + public String getName(){ + return name; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java new file mode 100644 index 0000000000..0cbd88b665 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java @@ -0,0 +1,66 @@ +/*- + * ============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.bpmn.servicedecomposition.homingobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.onap.so.bpmn.servicedecomposition.homingobjects.Candidate; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class SolutionCandidates implements Serializable{ + + private static final long serialVersionUID = 2188754118148819627L; + + @JsonProperty("requiredCandidates") + private List requiredCandidates = new ArrayList(); + @JsonProperty("excludedCandidates") + private List excludedCandidates = new ArrayList(); + //TODO figure out best way to do this + @JsonProperty("existingCandidates") + private List existingCandidates = new ArrayList(); + + + public List getRequiredCandidates() { + return requiredCandidates; + } + public void addRequiredCandidates(Candidate requiredCandidate) { + this.requiredCandidates.add(requiredCandidate); + } + public List getExcludedCandidates() { + return excludedCandidates; + } + public void addExcludedCandidates(Candidate excludedCandidate) { + this.excludedCandidates.add(excludedCandidate); + } + + public List getExistingCandidates(){ + return existingCandidates; + } + + + + + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java new file mode 100644 index 0000000000..17e42b4396 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java @@ -0,0 +1,99 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.homingobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; + +@JsonRootName("solution") +public class SolutionInfo implements Serializable { + + private static final long serialVersionUID = 6903399488466840832L; + + @JsonProperty("solution-id") //identifies which solution + private int solutionId; + @JsonProperty("homed") + private boolean homed; + @JsonProperty("is-rehome") + private boolean isRehome; + @JsonProperty("targeted-cloud") + private CloudRegion targetedCloudRegion; + + + public boolean isHomed() { + return homed; + } + + public void setHomed(boolean homed) { + this.homed = homed; + } + + public boolean isRehome() { + return isRehome; + } + + public void setRehome(boolean isRehome) { + this.isRehome = isRehome; + } + + /** + * Identifies which solution when multiple solutions exist for a + * given resource or resource pair. + * i.e. 1, 2, 3.... + */ + public int getSolutionId() { + return solutionId; + } + + /** + * Identifies which solution when multiple solutions exist for a + * given resource or resource pair. + * i.e. 1, 2, 3.... + */ + public void setSolutionId(int solutionId) { + this.solutionId = solutionId; + } + + /** + * Identifies where the resource should be created for + * homed equals false scenarios. Will return null if resource + * was homed. + */ + public CloudRegion getTargetedCloudRegion() { + return targetedCloudRegion; + } + + /** + * Identifies where the resource should be created for + * homed equals false scenarios. Will return null if resource + * was homed. + */ + public void setTargetedCloudRegion(CloudRegion targetedCloudRegion) { + this.targetedCloudRegion = targetedCloudRegion; + } + + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoAllottedResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoAllottedResource.java new file mode 100644 index 0000000000..b4f2e85e55 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoAllottedResource.java @@ -0,0 +1,146 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.modelinfo; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoAllottedResource extends ModelInfoMetadata implements Serializable{ + + private static final long serialVersionUID = -5240932898637922018L; + + @JsonProperty("max-instances") + private String MaxInstances; + @JsonProperty("min-instances") + private String MinInstances; + @JsonProperty("nf-naming-code") + private String NfNamingCode; + @JsonProperty("nf-role") + private String NfRole; + @JsonProperty("nf-type") + private String NfType; + @JsonProperty("nf-function") + private String NfFunction; + @JsonProperty("target-network-role") + private String TarNetworkRole; + @JsonProperty("providing-service-model-invariant-uuid") + private String ProvidingServiceModelInvariantUUID; + @JsonProperty("providing-service-model-name") + private String ProvidingServiceModelName; + @JsonProperty("providing-service-model-uuid") + private String ProvidingServiceModelUUID; + @JsonProperty("description") + private String Description; + @JsonProperty("created") + private String Created; + @JsonProperty("tosca-node-type") + private String ToscaNodeType; + @JsonProperty("subcategory") + private String Subcategory; +// private ModelInfoMetadata modelInfoMetadata; + + + public String getMaxInstances() { + return MaxInstances; + } + public void setMaxInstances(String maxInstances) { + MaxInstances = maxInstances; + } + public String getMinInstances() { + return MinInstances; + } + public void setMinInstances(String minInstances) { + MinInstances = minInstances; + } + public String getNfNamingCode() { + return NfNamingCode; + } + public void setNfNamingCode(String nfNamingCode) { + NfNamingCode = nfNamingCode; + } + public String getNfRole() { + return NfRole; + } + public void setNfRole(String nfRole) { + NfRole = nfRole; + } + public String getNfType() { + return NfType; + } + public void setNfType(String nfType) { + NfType = nfType; + } + public String getNfFunction() { + return NfFunction; + } + public void setNfFunction(String nfFunction) { + NfFunction = nfFunction; + } + public String getTarNetworkRole() { + return TarNetworkRole; + } + public void setTarNetworkRole(String tarNetworkRole) { + TarNetworkRole = tarNetworkRole; + } + public String getProvidingServiceModelInvariantUUID() { + return ProvidingServiceModelInvariantUUID; + } + public void setProvidingServiceModelInvariantUUID(String providingServiceModelInvariantUUID) { + ProvidingServiceModelInvariantUUID = providingServiceModelInvariantUUID; + } + public String getProvidingServiceModelName() { + return ProvidingServiceModelName; + } + public void setProvidingServiceModelName(String providingServiceModelName) { + ProvidingServiceModelName = providingServiceModelName; + } + public String getProvidingServiceModelUUID() { + return ProvidingServiceModelUUID; + } + public void setProvidingServiceModelUUID(String providingServiceModelUUID) { + ProvidingServiceModelUUID = providingServiceModelUUID; + } + public String getDescription() { + return Description; + } + public void setDescription(String description) { + Description = description; + } + public String getCreated() { + return Created; + } + public void setCreated(String created) { + Created = created; + } + public String getToscaNodeType() { + return ToscaNodeType; + } + public void setToscaNodeType(String toscaNodeType) { + ToscaNodeType = toscaNodeType; + } + public String getSubcategory() { + return Subcategory; + } + public void setSubcategory(String subcategory) { + Subcategory = subcategory; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java new file mode 100644 index 0000000000..6ceac935f1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.modelinfo; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoCollection implements Serializable { + + private static final long serialVersionUID = 8380534468706675508L; + + @JsonProperty("model-version-id") + private String modelVersionId; + @JsonProperty("model-invariant-uuid") + private String modelInvariantUUID; + @JsonProperty("collection-function") + private String collectionFunction; + @JsonProperty("collection-role") + private String collectionRole; + @JsonProperty("collection-type") + private String collectionType; + @JsonProperty("description") + private String description; + @JsonProperty("quantity") + private int quantity; + + public String getModelVersionId() { + return modelVersionId; + } + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + public String getModelInvariantUUID() { + return this.modelInvariantUUID; + } + public void setModelInvariantUUID(String modelInvariantUUID) { + this.modelInvariantUUID = modelInvariantUUID; + } + public String getCollectionFunction() { + return collectionFunction; + } + public void setCollectionFunction(String collectionFunction) { + this.collectionFunction = collectionFunction; + } + public String getCollectionRole() { + return collectionRole; + } + public void setCollectionRole(String collectionRole) { + this.collectionRole = collectionRole; + } + public String getCollectionType() { + return collectionType; + } + public void setCollectionType(String collectionType) { + this.collectionType = collectionType; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public int getQuantity() { + return quantity; + } + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java new file mode 100644 index 0000000000..9d3aa5934b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.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.bpmn.servicedecomposition.modelinfo; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoConfiguration implements Serializable{ + + private static final long serialVersionUID = -387242776138157250L; + + @JsonProperty("model-invariant-id") + private String modelInvariantId; + @JsonProperty("model-version-id") + private String modelVersionId; + @JsonProperty("model-customization-id") + private String modelCustomizationId; + + public String getModelInvariantId() { + return modelInvariantId; + } + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + public String getModelVersionId() { + return modelVersionId; + } + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + public String getModelCustomizationId() { + return modelCustomizationId; + } + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java new file mode 100644 index 0000000000..6b53272a75 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java @@ -0,0 +1,145 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.modelinfo; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoGenericVnf extends ModelInfoMetadata implements Serializable{ + + private static final long serialVersionUID = -5963022750248280669L; + + @JsonProperty("tosca-node-type") + private String ToscaNodeType; + @JsonProperty("description") + private String Description; + @JsonProperty("orchestration-mode") + private String OrchestrationMode; + @JsonProperty("aic-version-min") + private String AicVersionMin; + @JsonProperty("aic-version-max") + private String AicVersionMax; + @JsonProperty("min-instances") + private String MinInstances; + @JsonProperty("max-instances") + private String MaxInstances; + @JsonProperty("availability-zone-max-count") + private String AvailabilityZoneMaxCount; + @JsonProperty("nf-function") + private String NfFunction; + @JsonProperty("nf-type") + private String NfType; + @JsonProperty("nf-role") + private String NfRole; + @JsonProperty("nf-naming-code") + private String NfNamingCode; + @JsonProperty("multi-stage-design") + private String MultiStageDesign; + @JsonProperty("created") + private String Created; + + + public String getToscaNodeType() { + return ToscaNodeType; + } + public void setToscaNodeType(String toscaNodeType) { + ToscaNodeType = toscaNodeType; + } + public String getDescription() { + return Description; + } + public void setDescription(String description) { + Description = description; + } + public String getOrchestrationMode() { + return OrchestrationMode; + } + public void setOrchestrationMode(String orchestrationMode) { + OrchestrationMode = orchestrationMode; + } + public String getAicVersionMin() { + return AicVersionMin; + } + public void setAicVersionMin(String aicVersionMin) { + AicVersionMin = aicVersionMin; + } + public String getAicVersionMax() { + return AicVersionMax; + } + public void setAicVersionMax(String aicVersionMax) { + AicVersionMax = aicVersionMax; + } + public String getMinInstances() { + return MinInstances; + } + public void setMinInstances(String minInstances) { + MinInstances = minInstances; + } + public String getMaxInstances() { + return MaxInstances; + } + public void setMaxInstances(String maxInstances) { + MaxInstances = maxInstances; + } + public String getAvailabilityZoneMaxCount() { + return AvailabilityZoneMaxCount; + } + public void setAvailabilityZoneMaxCount(String availabilityZoneMaxCount) { + AvailabilityZoneMaxCount = availabilityZoneMaxCount; + } + public String getNfFunction() { + return NfFunction; + } + public void setNfFunction(String nfFunction) { + NfFunction = nfFunction; + } + public String getNfType() { + return NfType; + } + public void setNfType(String nfType) { + NfType = nfType; + } + public String getNfRole() { + return NfRole; + } + public void setNfRole(String nfRole) { + NfRole = nfRole; + } + public String getNfNamingCode() { + return NfNamingCode; + } + public void setNfNamingCode(String nfNamingCode) { + NfNamingCode = nfNamingCode; + } + public String getMultiStageDesign() { + return MultiStageDesign; + } + public void setMultiStageDesign(String multiStageDesign) { + MultiStageDesign = multiStageDesign; + } + public String getCreated() { + return Created; + } + public void setCreated(String created) { + Created = created; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.java new file mode 100644 index 0000000000..1f02fea071 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.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.bpmn.servicedecomposition.modelinfo; + +import java.io.Serializable; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoInstanceGroup implements Serializable { + + private static final long serialVersionUID = -8279040393230356226L; + + public static final String TYPE_L3_NETWORK = "L3-NETWORK"; + public static final String TYPE_NETWORK_INSTANCE_GROUP = "networkInstanceGroup"; + public static final String TYPE_VNFC = "VNFC"; + + @JsonProperty("model-uuid") + private String ModelUUID; + @JsonProperty("model-invariant-uuid") + private String ModelInvariantUUID; + @JsonProperty("type") + private String type; + @JsonProperty("instance-group-role") + private String instanceGroupRole; + @JsonProperty("function") + private String function; + @JsonProperty("description") + private String description; + + public String getModelUUID() { + return ModelUUID; + } + public void setModelUUID(String modelUUID) { + ModelUUID = modelUUID; + } + public String getModelInvariantUUID() { + return ModelInvariantUUID; + } + public void setModelInvariantUUID(String modelInvariantUUID) { + ModelInvariantUUID = modelInvariantUUID; + } + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public String getInstanceGroupRole() { + return instanceGroupRole; + } + public void setInstanceGroupRole(String instanceGroupRole) { + this.instanceGroupRole = instanceGroupRole; + } + public String getFunction() { + return function; + } + public void setFunction(String function) { + this.function = function; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoMetadata.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoMetadata.java new file mode 100644 index 0000000000..c873912922 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoMetadata.java @@ -0,0 +1,83 @@ +/*- + * ============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.bpmn.servicedecomposition.modelinfo; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoMetadata implements Serializable{ + + private static final long serialVersionUID = -2182850364281359289L; + + @JsonProperty("model-customization-uuid") + private String modelCustomizationUuid; + @JsonProperty("model-invariant-uuid") + private String modelInvariantUuid; + @JsonProperty("model-uuid") + private String modelUuid; + @JsonProperty("model-version") + private String modelVersion; + @JsonProperty("model-instance-name") + private String modelInstanceName; + @JsonProperty("model-name") + private String modelName; + + + public String getModelCustomizationUuid() { + return modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public String getModelInvariantUuid() { + return modelInvariantUuid; + } + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + public String getModelUuid() { + return modelUuid; + } + public void setModelUuid(String modelUuid) { + this.modelUuid = modelUuid; + } + public String getModelVersion() { + return modelVersion; + } + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + public String getModelInstanceName() { + return modelInstanceName; + } + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + public String getModelName() { + return modelName; + } + public void setModelName(String modelName) { + this.modelName = modelName; + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoNetwork.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoNetwork.java new file mode 100644 index 0000000000..22233e94a5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoNetwork.java @@ -0,0 +1,169 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.modelinfo; + +import java.io.Serializable; +import java.sql.Timestamp; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoNetwork implements Serializable{ + + private static final long serialVersionUID = -3612850497900637132L; + + @JsonProperty("model-customization-uuid") + private String ModelCustomizationUUID; + @JsonProperty("model-instance-name") + private String ModelInstanceName; + @JsonProperty("network-technology") + private String NetworkTechnology; + @JsonProperty("network-type") + private String NetworkType; + @JsonProperty("network-scope") + private String NetworkScope; + @JsonProperty("network-role") + private String NetworkRole; + @JsonProperty("description") + private String Description; + @JsonProperty("created") + private Timestamp Created; + @JsonProperty("model-version") + private String ModelVersion; + @JsonProperty("model-invariant-uuid") + private String ModelInvariantUUID; + @JsonProperty("model-name") + private String ModelName; + @JsonProperty("model-uuid") + private String ModelUUID; + @JsonProperty("neutron-network-type") + private String NeutronNetworkType; + @JsonProperty("aic-version-min") + private String AicVersionMin; + @JsonProperty("aic-version-max") + private String AicVersionMax; + @JsonProperty("orchestration-mode") + private String OrchestrationMode; + @JsonProperty("tosca-node-type") + private String ToscaNodeType; + + public String getModelCustomizationUUID() { + return ModelCustomizationUUID; + } + public void setModelCustomizationUUID(String modelCustomizationUUID) { + ModelCustomizationUUID = modelCustomizationUUID; + } + public String getModelInstanceName() { + return ModelInstanceName; + } + public void setModelInstanceName(String modelInstanceName) { + ModelInstanceName = modelInstanceName; + } + public String getNetworkTechnology() { + return NetworkTechnology; + } + public void setNetworkTechnology(String networkTechnology) { + NetworkTechnology = networkTechnology; + } + public String getNetworkType() { + return NetworkType; + } + public void setNetworkType(String networkType) { + NetworkType = networkType; + } + public String getNetworkScope() { + return NetworkScope; + } + public void setNetworkScope(String networkScope) { + NetworkScope = networkScope; + } + public String getNetworkRole() { + return NetworkRole; + } + public void setNetworkRole(String networkRole) { + NetworkRole = networkRole; + } + public String getDescription() { + return Description; + } + public void setDescription(String description) { + Description = description; + } + public Timestamp getCreated() { + return Created; + } + public void setCreated(Timestamp created) { + Created = created; + } + public String getModelVersion() { + return ModelVersion; + } + public void setModelVersion(String modelVersion) { + ModelVersion = modelVersion; + } + public String getModelInvariantUUID() { + return ModelInvariantUUID; + } + public void setModelInvariantUUID(String modelInvariantUUID) { + ModelInvariantUUID = modelInvariantUUID; + } + public String getModelName() { + return ModelName; + } + public void setModelName(String modelName) { + ModelName = modelName; + } + public String getModelUUID() { + return ModelUUID; + } + public void setModelUUID(String modelUUID) { + ModelUUID = modelUUID; + } + public String getNeutronNetworkType() { + return NeutronNetworkType; + } + public void setNeutronNetworkType(String neutronNetworkType) { + NeutronNetworkType = neutronNetworkType; + } + public String getAicVersionMin() { + return AicVersionMin; + } + public void setAicVersionMin(String aicVersionMin) { + AicVersionMin = aicVersionMin; + } + public String getAicVersionMax() { + return AicVersionMax; + } + public void setAicVersionMax(String aicVersionMax) { + AicVersionMax = aicVersionMax; + } + public String getOrchestrationMode() { + return OrchestrationMode; + } + public void setOrchestrationMode(String orchestrationMode) { + OrchestrationMode = orchestrationMode; + } + public String getToscaNodeType() { + return ToscaNodeType; + } + public void setToscaNodeType(String toscaNodeType) { + ToscaNodeType = toscaNodeType; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java new file mode 100644 index 0000000000..ac206d3dd0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.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.bpmn.servicedecomposition.modelinfo; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoServiceInstance extends ModelInfoMetadata implements Serializable { + + private static final long serialVersionUID = -1812787934683419141L; + + @JsonProperty("description") + private String description; + @JsonProperty("created") + private String created; + @JsonProperty("service-type") + private String serviceType; + @JsonProperty("service-role") + private String serviceRole; + @JsonProperty("environment-context") + private String environmentContext; + @JsonProperty("workload-context") + private String workloadContext; + + + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public String getCreated() { + return created; + } + public void setCreated(String created) { + this.created = created; + } + public String getServiceType() { + return serviceType; + } + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + public String getServiceRole() { + return serviceRole; + } + public void setServiceRole(String serviceRole) { + this.serviceRole = serviceRole; + } + public String getEnvironmentContext() { + return environmentContext; + } + public void setEnvironmentContext(String environmentContext) { + this.environmentContext = environmentContext; + } + public String getWorkloadContext() { + return workloadContext; + } + public void setWorkloadContext(String workloadContext) { + this.workloadContext = workloadContext; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java new file mode 100644 index 0000000000..b2494384f4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.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.bpmn.servicedecomposition.modelinfo; + + +import java.io.Serializable; + + +public class ModelInfoServiceProxy extends ModelInfoMetadata implements Serializable { + + private static final long serialVersionUID = -6256897576261215926L; + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVfModule.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVfModule.java new file mode 100644 index 0000000000..593f8c2532 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVfModule.java @@ -0,0 +1,136 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.modelinfo; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoVfModule implements Serializable { + + private static final long serialVersionUID = 636556989022688657L; + + @JsonProperty("model-customization-uuid") + private String ModelCustomizationUUID; + @JsonProperty("model-name") + private String ModelName; + @JsonProperty("model-uuid") + private String ModelUUID; + @JsonProperty("model-invariant-uuid") + private String ModelInvariantUUID; + @JsonProperty("model-version") + private String ModelVersion; + @JsonProperty("description") + private String Description; + @JsonProperty("is-base-boolean") + private Boolean IsBaseBoolean; + @JsonProperty("min-instances") + private String MinInstances; + @JsonProperty("max-instances") + private String MaxInstances; + @JsonProperty("availability-zone-count") + private String AvailabilityZoneCount; + @JsonProperty("label") + private String Label; + @JsonProperty("initial-count") + private String InitialCount; + @JsonProperty("created") + private String Created; + + public String getModelCustomizationUUID() { + return ModelCustomizationUUID; + } + public void setModelCustomizationUUID(String modelCustomizationUUID) { + ModelCustomizationUUID = modelCustomizationUUID; + } + public String getModelName() { + return ModelName; + } + public void setModelName(String modelName) { + ModelName = modelName; + } + public String getModelUUID() { + return ModelUUID; + } + public void setModelUUID(String modelUUID) { + ModelUUID = modelUUID; + } + public String getModelInvariantUUID() { + return ModelInvariantUUID; + } + public void setModelInvariantUUID(String modelInvariantUUID) { + ModelInvariantUUID = modelInvariantUUID; + } + public String getModelVersion() { + return ModelVersion; + } + public void setModelVersion(String modelVersion) { + ModelVersion = modelVersion; + } + public String getDescription() { + return Description; + } + public void setDescription(String description) { + Description = description; + } + public Boolean getIsBaseBoolean() { + return IsBaseBoolean; + } + public void setIsBaseBoolean(Boolean isBaseBoolean) { + IsBaseBoolean = isBaseBoolean; + } + public String getMinInstances() { + return MinInstances; + } + public void setMinInstances(String minInstances) { + MinInstances = minInstances; + } + public String getMaxInstances() { + return MaxInstances; + } + public void setMaxInstances(String maxInstances) { + MaxInstances = maxInstances; + } + public String getAvailabilityZoneCount() { + return AvailabilityZoneCount; + } + public void setAvailabilityZoneCount(String availabilityZoneCount) { + AvailabilityZoneCount = availabilityZoneCount; + } + public String getLabel() { + return Label; + } + public void setLabel(String label) { + Label = label; + } + public String getInitialCount() { + return InitialCount; + } + public void setInitialCount(String initialCount) { + InitialCount = initialCount; + } + public String getCreated() { + return Created; + } + public void setCreated(String created) { + Created = created; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java new file mode 100644 index 0000000000..d3bf99ccb8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.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========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.modelinfo; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoVolumeGroup extends ModelInfoVfModule implements Serializable { + + private static final long serialVersionUID = -1157856848495642223L; +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java new file mode 100644 index 0000000000..ac96aceec3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.tasks; + +public enum AssignFlows { + + SERVICE_INSTANCE("AssignServiceInstanceBB"), + VNF("AssignVnfBB"), + VF_MODULE("AssignVfModuleBB"), + NETWORK_A_LA_CARTE("AssignNetwork1802BB"), + NETWORK_MACRO("AssignNetworkBB"), + VOLUME_GROUP("AssignVolumeGroupBB"), + NETWORK_COLLECTION("CreateNetworkCollectionBB"), + FABRIC_CONFIGURATION("AssignFabricConfigurationBB"); + + private final String flowName; + + private AssignFlows(String flowName) { + this.flowName = flowName; + } + + @Override + public String toString() { + return this.flowName; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java new file mode 100644 index 0000000000..aa68114011 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -0,0 +1,1586 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.tasks; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.javatuples.Pair; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.aai.AAICommonObjectMapperProvider; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.Relationships; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResource; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; +import org.onap.so.db.request.beans.InfraActiveRequests; +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.Resources; +import org.onap.so.serviceinstancebeans.VfModules; +import org.onap.so.serviceinstancebeans.Vnfs; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +@Component("BBInputSetup") +public class BBInputSetup implements JavaDelegate { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BBInputSetup.class); + private static final String FLOW_VAR_NAME = "flowToBeCalled"; + private static final String LOOKUP_KEY_MAP_VAR_NAME = "lookupKeyMap"; + private static final String GBB_INPUT_VAR_NAME = "gBBInput"; + private static final String EXECUTE_BB_VAR_NAME = "buildingBlock"; + private static final String CLOUD_OWNER = "att-aic"; + private static final String VOLUME_GROUP = "VolumeGroup"; + private static final String VF_MODULE = "VfModule"; + private static final String NETWORK = "Network"; + private static final String VNF = "Vnf"; + private static final String NETWORK_COLLECTION = "NetworkCollection"; + + @Autowired + private BBInputSetupUtils bbInputSetupUtils; + + @Autowired + private BBInputSetupMapperLayer mapperLayer; + + @Autowired + private ExceptionBuilder exceptionUtil; + + private ObjectMapper mapper = new ObjectMapper(); + + public BBInputSetupUtils getBbInputSetupUtils() { + return bbInputSetupUtils; + } + + public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) { + this.bbInputSetupUtils = bbInputSetupUtils; + } + + public BBInputSetupMapperLayer getMapperLayer() { + return mapperLayer; + } + + public void setMapperLayer(BBInputSetupMapperLayer mapperLayer) { + this.mapperLayer = mapperLayer; + } + + @Override + public void execute(DelegateExecution execution) throws Exception { + try { + GeneralBuildingBlock outputBB = null; + ExecuteBuildingBlock executeBB = this.getExecuteBBFromExecution(execution); + String resourceId = executeBB.getResourceId(); + String requestAction = executeBB.getRequestAction(); + String vnfType = executeBB.getVnfType(); + boolean aLaCarte = executeBB.isaLaCarte(); + boolean homing = executeBB.isHoming(); + Map lookupKeyMap = new HashMap<>(); + outputBB = this.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte, resourceId, vnfType); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.INDENT_OUTPUT); + msoLogger.debug("GeneralBB: " + mapper.writeValueAsString(outputBB)); + + setHomingFlag(outputBB, homing, lookupKeyMap); + + execution.setVariable(FLOW_VAR_NAME, executeBB.getBuildingBlock().getBpmnFlowName()); + execution.setVariable(GBB_INPUT_VAR_NAME, outputBB); + execution.setVariable(LOOKUP_KEY_MAP_VAR_NAME, lookupKeyMap); + + BuildingBlockExecution gBuildingBlockExecution = new DelegateExecutionImpl(execution); + execution.setVariable("gBuildingBlockExecution", gBuildingBlockExecution); + execution.setVariable("RetryCount", 1); + execution.setVariable("handlingCode", "Success"); + } catch (Exception e) { + msoLogger.error(e); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e.getMessage()); + } + } + + protected void setHomingFlag(GeneralBuildingBlock outputBB, boolean homing, Map lookupKeyMap) { + + if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null && homing && outputBB != null) { + for (GenericVnf vnf : outputBB.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs()) { + if (vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + vnf.setCallHoming(homing); + } + } + } + } + + protected ExecuteBuildingBlock getExecuteBBFromExecution(DelegateExecution execution) { + return (ExecuteBuildingBlock) execution.getVariable(EXECUTE_BB_VAR_NAME); + } + + protected GeneralBuildingBlock getGBB(ExecuteBuildingBlock executeBB, Map lookupKeyMap, + String requestAction, boolean aLaCarte, String resourceId, String vnfType) throws Exception { + String requestId = executeBB.getRequestId(); + this.populateLookupKeyMapWithIds(executeBB.getWorkflowResourceIds(), lookupKeyMap); + RequestDetails requestDetails = executeBB.getRequestDetails(); + if(requestDetails == null) { + requestDetails = bbInputSetupUtils.getRequestDetails(requestId); + } + ModelType modelType = requestDetails.getModelInfo().getModelType(); + if (aLaCarte && modelType.equals(ModelType.service)) { + return this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId); + } else if (aLaCarte && !modelType.equals(ModelType.service)) { + return this.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, + vnfType); + } else { + return this.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + } + } + + protected void populateLookupKeyMapWithIds(WorkflowResourceIds workflowResourceIds, + Map lookupKeyMap) { + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, workflowResourceIds.getServiceInstanceId()); + lookupKeyMap.put(ResourceKey.NETWORK_ID, workflowResourceIds.getNetworkId()); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, workflowResourceIds.getVnfId()); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, workflowResourceIds.getVfModuleId()); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, workflowResourceIds.getVolumeGroupId()); + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, workflowResourceIds.getConfigurationId()); + } + + protected GeneralBuildingBlock getGBBALaCarteNonService(ExecuteBuildingBlock executeBB, + RequestDetails requestDetails, Map lookupKeyMap, String requestAction, + String resourceId, String vnfType) throws Exception { + String bbName = executeBB.getBuildingBlock().getBpmnFlowName(); + String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID); + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null; + if (serviceInstanceId != null) { + aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + } + Service service = null; + if (aaiServiceInstance != null) { + service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + } + if (aaiServiceInstance != null && service != null) { + ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance); + serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service)); + this.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap, + resourceId, vnfType); + return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); + } else { + msoLogger.debug("Related Service Instance from AAI: " + aaiServiceInstance); + msoLogger.debug("Related Service Instance Model Info from AAI: " + service); + throw new Exception("Could not find relevant information for related Service Instance"); + } + } + + protected void populateObjectsOnAssignAndCreateFlows(RequestDetails requestDetails, Service service, String bbName, + ServiceInstance serviceInstance, Map lookupKeyMap, String resourceId, String vnfType) + throws Exception { + ModelInfo modelInfo = requestDetails.getModelInfo(); + String instanceName = requestDetails.getRequestInfo().getInstanceName(); + ModelType modelType = modelInfo.getModelType(); + RelatedInstanceList[] relatedInstanceList = requestDetails.getRelatedInstanceList(); + + org.onap.so.serviceinstancebeans.Platform platform = requestDetails.getPlatform(); + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = requestDetails.getLineOfBusiness(); + + if (modelType.equals(ModelType.network)) { + this.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null); + } else if (modelType.equals(ModelType.vnf)) { + this.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, + lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); + } else if (modelType.equals(ModelType.volumeGroup)) { + this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + relatedInstanceList, instanceName, vnfType, null); + } else if (modelType.equals(ModelType.vfModule)) { + this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration()); + } else { + return; + } + } + + protected void populateConfiguration(ModelInfo modelInfo, Service service, String bbName, + ServiceInstance serviceInstance, Map lookupKeyMap, String resourceId, String instanceName) { + boolean foundByName = false; + boolean foundById = false; + for (Configuration configuration : serviceInstance.getConfigurations()) { + if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null + && configuration.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) { + foundById = true; + org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()); + if(aaiConfiguration!=null){ + modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId()); + } + this.mapCatalogConfiguration(configuration, modelInfo, service); + } else if (instanceName != null && configuration.getConfigurationName().equalsIgnoreCase(instanceName)) { + foundByName = true; + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, configuration.getConfigurationId()); + org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()); + if(aaiConfiguration!=null){ + modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId()); + } + this.mapCatalogConfiguration(configuration, modelInfo, service); + } + } + if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) { + Configuration configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId); + serviceInstance.getConfigurations().add(configuration); + this.mapCatalogConfiguration(configuration, modelInfo, service); + } + } + + protected Configuration createConfiguration(Map lookupKeyMap, + String instanceName, String resourceId) { + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, resourceId); + Configuration configuration = new Configuration(); + configuration.setConfigurationId(resourceId); + configuration.setConfigurationName(instanceName); + configuration.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + return configuration; + } + + protected void mapCatalogConfiguration(Configuration configuration, ModelInfo modelInfo, Service service) { + ConfigurationResourceCustomization configurationResourceCustomization = findConfigurationResourceCustomization(modelInfo, service); + if (configurationResourceCustomization != null) { + configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization)); + } + } + + protected ConfigurationResourceCustomization findConfigurationResourceCustomization(ModelInfo modelInfo, Service service) { + for (ConfigurationResourceCustomization resourceCust : service.getConfigurationCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { + return resourceCust; + } + } + return null; + } + + protected void populateVfModule(ModelInfo modelInfo, Service service, String bbName, + ServiceInstance serviceInstance, Map lookupKeyMap, String resourceId, + RelatedInstanceList[] relatedInstanceList, String instanceName, List> instanceParams, CloudConfiguration cloudConfiguration) throws Exception { + boolean foundByName = false; + boolean foundById = false; + String vnfModelCustomizationUUID = null; + if (relatedInstanceList != null) { + for (RelatedInstanceList relatedInstList : relatedInstanceList) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { + vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId(); + } + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.volumeGroup)) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, relatedInstance.getInstanceId()); + } + } + } + GenericVnf vnf = null; + for (GenericVnf tempVnf : serviceInstance.getVnfs()) { + if (tempVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + vnf = tempVnf; + vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()) + .getModelCustomizationId(); + ModelInfo vnfModelInfo = new ModelInfo(); + vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); + this.mapCatalogVnf(tempVnf, vnfModelInfo, service); + for(VolumeGroup volumeGroup : tempVnf.getVolumeGroups()) { + String volumeGroupCustId = + this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER, + cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId(); + if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); + } + } + break; + } + } + if (vnf != null) { + for (VfModule vfModule : vnf.getVfModules()) { + if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null + && vfModule.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) { + foundById = true; + this.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + } else if (instanceName != null && vfModule.getVfModuleName().equalsIgnoreCase(instanceName)) { + foundByName = true; + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId()); + this.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + } + } + if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) { + VfModule vfModule = this.createVfModule(lookupKeyMap, + resourceId, instanceName, instanceParams); + this.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + vnf.getVfModules().add(vfModule); + } + } else { + msoLogger.debug("Related VNF instance Id not found: " + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + throw new Exception("Could not find relevant information for related VNF"); + } + } + + protected void mapCatalogVfModule(VfModule vfModule, ModelInfo modelInfo, Service service, + String vnfModelCustomizationUUID) { + if(modelInfo.getModelCustomizationUuid() != null) { + modelInfo.setModelCustomizationId(modelInfo.getModelCustomizationUuid()); + } + VnfResourceCustomization vnfResourceCustomization = null; + for (VnfResourceCustomization resourceCust : service.getVnfCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(vnfModelCustomizationUUID)) { + vnfResourceCustomization = resourceCust; + break; + } + } + if (vnfResourceCustomization != null) { + VfModuleCustomization vfResourceCustomization = vnfResourceCustomization.getVfModuleCustomizations() + .stream() // Convert to steam + .filter(x -> modelInfo.getModelCustomizationId().equalsIgnoreCase(x.getModelCustomizationUUID()))// find + // what + // we + // want + .findAny() // If 'findAny' then return found + .orElse(null); + if (vfResourceCustomization != null) { + vfModule.setModelInfoVfModule(this.mapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization)); + } + } + } + + protected VfModule createVfModule(Map lookupKeyMap, String vfModuleId, String instanceName, List> instanceParams) { + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModuleId); + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId(vfModuleId); + vfModule.setVfModuleName(instanceName); + vfModule.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + if(instanceParams != null) { + for(Map params : instanceParams) { + vfModule.getCloudParams().putAll(params); + } + } + return vfModule; + } + + protected void populateVolumeGroup(ModelInfo modelInfo, Service service, String bbName, + ServiceInstance serviceInstance, Map lookupKeyMap, String resourceId, + RelatedInstanceList[] relatedInstanceList, String instanceName, String vnfType, List> instanceParams) throws Exception { + boolean foundByName = false; + boolean foundById = false; + String vnfModelCustomizationUUID = null; + if (relatedInstanceList != null) { + for (RelatedInstanceList relatedInstList : relatedInstanceList) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { + vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid(); + } + } + } + GenericVnf vnf = null; + for (GenericVnf tempVnf : serviceInstance.getVnfs()) { + if (tempVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + vnf = tempVnf; + vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()) + .getModelCustomizationId(); + ModelInfo vnfModelInfo = new ModelInfo(); + vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); + this.mapCatalogVnf(tempVnf, vnfModelInfo, service); + break; + } + } + if (vnf != null && vnfModelCustomizationUUID != null) { + for (VolumeGroup volumeGroup : vnf.getVolumeGroups()) { + if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroup.getVolumeGroupId() + .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID))) { + foundById = true; + this.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); + } else if (instanceName != null && volumeGroup.getVolumeGroupName().equalsIgnoreCase(instanceName)) { + foundByName = true; + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); + this.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); + } + } + if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString())) { + if (vnfType == null || vnfType.isEmpty()) { + vnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); + } + VolumeGroup volumeGroup = this.createVolumeGroup(lookupKeyMap, resourceId, instanceName, vnfType, instanceParams); + vnf.getVolumeGroups().add(volumeGroup); + this.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); + } + } else { + msoLogger.debug("Related VNF instance Id not found: " + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + throw new Exception("Could not find relevant information for related VNF"); + } + } + + protected VolumeGroup createVolumeGroup(Map lookupKeyMap, String volumeGroupId, String instanceName, String vnfType, List> instanceParams) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupId); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId(volumeGroupId); + volumeGroup.setVolumeGroupName(instanceName); + volumeGroup.setVnfType(vnfType); + volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + if(instanceParams != null) { + for(Map params : instanceParams) { + volumeGroup.getCloudParams().putAll(params); + } + } + return volumeGroup; + } + + protected void mapCatalogVolumeGroup(VolumeGroup volumeGroup, ModelInfo modelInfo, Service service, + String vnfModelCustomizationUUID) { + VfModuleCustomization vfResourceCustomization = getVfResourceCustomization(modelInfo, service, + vnfModelCustomizationUUID); + if (vfResourceCustomization != null) { + volumeGroup.setModelInfoVfModule(this.mapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization)); + } + } + + protected VfModuleCustomization getVfResourceCustomization(ModelInfo modelInfo, Service service, + String vnfModelCustomizationUUID) { + VnfResourceCustomization vnfResourceCustomization = null; + for (VnfResourceCustomization resourceCust : service.getVnfCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(vnfModelCustomizationUUID)) { + vnfResourceCustomization = resourceCust; + break; + } + } + if (vnfResourceCustomization != null) { + for (VfModuleCustomization vfResourceCust : vnfResourceCustomization.getVfModuleCustomizations()) { + if (vfResourceCust.getModelCustomizationUUID() + .equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { + return vfResourceCust; + } + } + + } + return null; + } + + protected void populateGenericVnf(ModelInfo modelInfo, String instanceName, + org.onap.so.serviceinstancebeans.Platform platform, + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, Service service, String bbName, + ServiceInstance serviceInstance, Map lookupKeyMap, + RelatedInstanceList[] relatedInstanceList, String resourceId, String vnfType, List> instanceParams) { + boolean foundByName = false; + boolean foundById = false; + ModelInfo instanceGroupModelInfo = null; + String instanceGroupId = null; + if (relatedInstanceList != null) { + for (RelatedInstanceList relatedInstList : relatedInstanceList) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.networkCollection)) { + instanceGroupModelInfo = relatedInstance.getModelInfo(); + instanceGroupId = relatedInstance.getInstanceId(); + } + } + } + for (GenericVnf genericVnf : serviceInstance.getVnfs()) { + if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null + && genericVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + foundById = true; + org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId()); + if(vnf!=null){ + modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId()); + } + this.mapCatalogVnf(genericVnf, modelInfo, service); + } else if (instanceName != null && genericVnf.getVnfName().equalsIgnoreCase(instanceName)) { + foundByName = true; + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId()); + org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId()); + if(vnf!=null){ + modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId()); + } + this.mapCatalogVnf(genericVnf, modelInfo, service); + } + } + if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.VNF.toString())) { + if(vnfType == null || vnfType.isEmpty()) { + vnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); + } + GenericVnf genericVnf = this.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, + resourceId, vnfType, instanceParams); + serviceInstance.getVnfs().add(genericVnf); + this.mapCatalogVnf(genericVnf, modelInfo, service); + this.mapVnfcCollectionInstanceGroup(genericVnf, modelInfo, service); + if (instanceGroupId != null && instanceGroupModelInfo != null) + this.mapNetworkCollectionInstanceGroup(genericVnf, instanceGroupId); + } + } + + protected void mapVnfcCollectionInstanceGroup(GenericVnf genericVnf, ModelInfo modelInfo, Service service) { + VnfResourceCustomization vnfResourceCustomization = getVnfResourceCustomizationFromService(modelInfo, service); + if(vnfResourceCustomization != null) { + List vnfcInstanceGroups = vnfResourceCustomization + .getVnfcInstanceGroupCustomizations(); + for (VnfcInstanceGroupCustomization vnfcInstanceGroupCust : vnfcInstanceGroups) { + InstanceGroup instanceGroup = this.createInstanceGroup(); + instanceGroup.setModelInfoInstanceGroup(this.mapperLayer + .mapCatalogInstanceGroupToInstanceGroup(null, vnfcInstanceGroupCust.getInstanceGroup())); + instanceGroup.getModelInfoInstanceGroup().setFunction(vnfcInstanceGroupCust.getFunction()); + instanceGroup.setDescription(vnfcInstanceGroupCust.getDescription()); + genericVnf.getInstanceGroups().add(instanceGroup); + } + } + } + + protected void mapNetworkCollectionInstanceGroup(GenericVnf genericVnf, String instanceGroupId) { + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = this.bbInputSetupUtils + .getAAIInstanceGroup(instanceGroupId); + InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstanceGroup); + instanceGroup.setModelInfoInstanceGroup(this.mapperLayer.mapCatalogInstanceGroupToInstanceGroup( + null, this.bbInputSetupUtils.getCatalogInstanceGroup(aaiInstanceGroup.getModelVersionId()))); + genericVnf.getInstanceGroups().add(instanceGroup); + } + + protected GenericVnf createGenericVnf(Map lookupKeyMap, String instanceName, + org.onap.so.serviceinstancebeans.Platform platform, + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, String vnfId, String vnfType, List> instanceParams) { + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId); + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId(vnfId); + genericVnf.setVnfName(instanceName); + genericVnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + genericVnf.setVnfType(vnfType); + if (platform != null) { + genericVnf.setPlatform(this.mapperLayer.mapRequestPlatform(platform)); + } + if (lineOfBusiness != null) { + genericVnf.setLineOfBusiness(this.mapperLayer.mapRequestLineOfBusiness(lineOfBusiness)); + } + if(instanceParams != null) { + for(Map params : instanceParams) { + genericVnf.getCloudParams().putAll(params); + } + } + return genericVnf; + } + + protected void mapCatalogVnf(GenericVnf genericVnf, ModelInfo modelInfo, Service service) { + VnfResourceCustomization vnfResourceCustomization = getVnfResourceCustomizationFromService(modelInfo, service); + if (vnfResourceCustomization != null) { + genericVnf.setModelInfoGenericVnf(this.mapperLayer.mapCatalogVnfToVnf(vnfResourceCustomization)); + } + } + + protected VnfResourceCustomization getVnfResourceCustomizationFromService(ModelInfo modelInfo, Service service) { + VnfResourceCustomization vnfResourceCustomization = null; + for (VnfResourceCustomization resourceCust : service.getVnfCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { + vnfResourceCustomization = resourceCust; + break; + } + } + return vnfResourceCustomization; + } + + protected void populateL3Network(String instanceName, ModelInfo modelInfo, Service service, String bbName, + ServiceInstance serviceInstance, Map lookupKeyMap, String resourceId, List> instanceParams) { + boolean foundByName = false; + boolean foundById = false; + for (L3Network network : serviceInstance.getNetworks()) { + if (lookupKeyMap.get(ResourceKey.NETWORK_ID) != null + && network.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) { + foundById = true; + this.mapCatalogNetwork(network, modelInfo, service); + } else if (instanceName != null && network.getNetworkName().equalsIgnoreCase(instanceName)) { + foundByName = true; + lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId()); + this.mapCatalogNetwork(network, modelInfo, service); + } + } + if (!foundByName && !foundById + && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) + || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { + L3Network l3Network = this.createNetwork(lookupKeyMap, instanceName, resourceId, instanceParams); + serviceInstance.getNetworks().add(l3Network); + this.mapCatalogNetwork(l3Network, modelInfo, service); + } + } + + protected L3Network createNetwork(Map lookupKeyMap, String instanceName, + String networkId, List> instanceParams) { + lookupKeyMap.put(ResourceKey.NETWORK_ID, networkId); + L3Network network = new L3Network(); + network.setNetworkId(networkId); + network.setNetworkName(instanceName); + network.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + if(instanceParams != null) { + for(Map params : instanceParams) { + network.getCloudParams().putAll(params); + } + } + return network; + } + + protected void mapCatalogNetwork(L3Network network, ModelInfo modelInfo, Service service) { + NetworkResourceCustomization networkResourceCustomization = null; + for (NetworkResourceCustomization resourceCust : service.getNetworkCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { + networkResourceCustomization = resourceCust; + break; + } + } + if (networkResourceCustomization != null) { + network.setModelInfoNetwork(this.mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization)); + } + } + + protected GeneralBuildingBlock getGBBALaCarteService(ExecuteBuildingBlock executeBB, RequestDetails requestDetails, + Map lookupKeyMap, String requestAction, String resourceId) throws Exception { + Customer customer = getCustomerAndServiceSubscription(requestDetails, resourceId); + if (customer != null) { + Project project = null; + OwningEntity owningEntity = null; + + if (requestDetails.getProject() != null) + project = mapperLayer.mapRequestProject(requestDetails.getProject()); + if (requestDetails.getOwningEntity() != null) + owningEntity = mapperLayer.mapRequestOwningEntity(requestDetails.getOwningEntity()); + + + Service service = bbInputSetupUtils + .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); + if (service == null) { + service = bbInputSetupUtils.getCatalogServiceByModelVersionAndModelInvariantUUID( + requestDetails.getModelInfo().getModelVersion(), + requestDetails.getModelInfo().getModelInvariantId()); + if(service == null) { + throw new Exception("Could not find service for model version Id: " + + requestDetails.getModelInfo().getModelVersionId() + " and for model invariant Id: " + + requestDetails.getModelInfo().getModelInvariantId()); + } + } + ServiceInstance serviceInstance = this.getALaCarteServiceInstance(service, requestDetails, customer, + project, owningEntity, lookupKeyMap, resourceId, executeBB.isaLaCarte(), + executeBB.getBuildingBlock().getBpmnFlowName()); + return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, customer); + } else { + throw new Exception("Could not find customer"); + } + } + + protected Customer getCustomerAndServiceSubscription(RequestDetails requestDetails, String resourceId) { + Customer customer; + if (requestDetails.getSubscriberInfo() != null) { + customer = this.getCustomerFromRequest(requestDetails); + } else { + customer = this.getCustomerFromURI(resourceId); + } + if (customer != null) { + ServiceSubscription serviceSubscription = null; + serviceSubscription = getServiceSubscription(requestDetails, customer); + if (serviceSubscription == null) { + serviceSubscription = getServiceSubscriptionFromURI(resourceId, customer); + } + customer.setServiceSubscription(serviceSubscription); + return customer; + } else { + return null; + } + } + + protected ServiceSubscription getServiceSubscriptionFromURI(String resourceId, Customer customer) { + Map uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(resourceId); + String subscriptionServiceType = uriKeys.get("service-type"); + org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionAAI = bbInputSetupUtils + .getAAIServiceSubscription(customer.getGlobalCustomerId(), subscriptionServiceType); + if (serviceSubscriptionAAI != null) { + return mapperLayer.mapAAIServiceSubscription(serviceSubscriptionAAI); + } else { + return null; + } + } + + protected Customer getCustomerFromURI(String resourceId) { + Map uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(resourceId); + String globalCustomerId = uriKeys.get("global-customer-id"); + org.onap.aai.domain.yang.Customer customerAAI = this.bbInputSetupUtils.getAAICustomer(globalCustomerId); + if (customerAAI != null) { + return mapperLayer.mapAAICustomer(customerAAI); + } else { + return null; + } + } + + protected GeneralBuildingBlock populateGBBWithSIAndAdditionalInfo(RequestDetails requestDetails, + ServiceInstance serviceInstance, ExecuteBuildingBlock executeBB, String requestAction, Customer customer) { + GeneralBuildingBlock outputBB = new GeneralBuildingBlock(); + OrchestrationContext orchContext = mapperLayer.mapOrchestrationContext(requestDetails); + RequestContext requestContext = mapperLayer.mapRequestContext(requestDetails); + requestContext.setAction(requestAction); + requestContext.setMsoRequestId(executeBB.getRequestId()); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils + .getCloudRegion(requestDetails.getCloudConfiguration(), CLOUD_OWNER); + CloudRegion cloudRegion = mapperLayer.mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion, + CLOUD_OWNER); + outputBB.setOrchContext(orchContext); + outputBB.setRequestContext(requestContext); + outputBB.setCloudRegion(cloudRegion); + if(customer == null){ + Map uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(serviceInstance.getServiceInstanceId()); + String globalCustomerId = uriKeys.get("global-customer-id"); + String subscriptionServiceType = uriKeys.get("service-type"); + customer = mapCustomer(globalCustomerId, subscriptionServiceType); + } + outputBB.setServiceInstance(serviceInstance); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + outputBB.setCustomer(customer); + return outputBB; + } + + protected ServiceSubscription getServiceSubscription(RequestDetails requestDetails, Customer customer) { + org.onap.aai.domain.yang.ServiceSubscription aaiServiceSubscription = bbInputSetupUtils + .getAAIServiceSubscription(customer.getGlobalCustomerId(), + requestDetails.getRequestParameters().getSubscriptionServiceType()); + if (aaiServiceSubscription != null) { + return mapperLayer.mapAAIServiceSubscription(aaiServiceSubscription); + } else { + return null; + } + } + + protected Customer getCustomerFromRequest(RequestDetails requestDetails) { + org.onap.aai.domain.yang.Customer aaiCustomer = bbInputSetupUtils + .getAAICustomer(requestDetails.getSubscriberInfo().getGlobalSubscriberId()); + if (aaiCustomer != null) { + return mapperLayer.mapAAICustomer(aaiCustomer); + } else { + return null; + } + } + + protected ServiceInstance getALaCarteServiceInstance(Service service, RequestDetails requestDetails, + Customer customer, Project project, OwningEntity owningEntity, Map lookupKeyMap, + String serviceInstanceId, boolean aLaCarte, String bbName) throws Exception { + ServiceInstance serviceInstance = this.getServiceInstanceHelper(requestDetails, customer, project, owningEntity, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = this.bbInputSetupUtils + .getAAIServiceInstanceById(serviceInstanceId); + if (serviceInstanceAAI != null + && !serviceInstanceAAI.getModelVersionId().equalsIgnoreCase(service.getModelUUID())) { + Service tempService = this.bbInputSetupUtils + .getCatalogServiceByModelUUID(serviceInstanceAAI.getModelVersionId()); + if (tempService != null) { + serviceInstance + .setModelInfoServiceInstance(mapperLayer.mapCatalogServiceIntoServiceInstance(tempService)); + return serviceInstance; + } else { + throw new Exception( + "Could not find model of existing SI. Service Instance in AAI already exists with different model version id: " + + serviceInstanceAAI.getModelVersionId()); + } + } + serviceInstance.setModelInfoServiceInstance(mapperLayer.mapCatalogServiceIntoServiceInstance(service)); + return serviceInstance; + } + + protected GeneralBuildingBlock getGBBMacro(ExecuteBuildingBlock executeBB, RequestDetails requestDetails, + Map lookupKeyMap, String requestAction, String resourceId, String vnfType) + throws Exception { + String bbName = executeBB.getBuildingBlock().getBpmnFlowName(); + String key = executeBB.getBuildingBlock().getKey(); + GeneralBuildingBlock gBB = this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, + resourceId); + RequestParameters requestParams = requestDetails.getRequestParameters(); + Service service = null; + if (gBB != null && gBB.getServiceInstance() != null + && gBB.getServiceInstance().getModelInfoServiceInstance() != null + && gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid() != null) { + service = bbInputSetupUtils.getCatalogServiceByModelUUID( + gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + } else { + throw new Exception("Could not get service instance for macro request"); + } + if (requestParams != null && requestParams.getUserParams() != null) { + for(Map userParams : requestParams.getUserParams()) { + if(userParams.containsKey("service")) { + String input = mapper.writeValueAsString(userParams.get("service")); + return getGBBMacroUserParams(executeBB, requestDetails, lookupKeyMap, vnfType, bbName, key, gBB, + requestParams, service, input); + } + } + } + if (requestAction.equalsIgnoreCase("deactivateInstance")) { + return gBB; + } else if (requestAction.equalsIgnoreCase("createInstance")) { + return getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, bbName, key, gBB, service); + } else if (requestAction.equalsIgnoreCase("deleteInstance") + || requestAction.equalsIgnoreCase("unassignInstance") + || requestAction.equalsIgnoreCase("activateInstance") + || requestAction.equalsIgnoreCase("activateFabricConfiguration")) { + return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, gBB, service, requestAction, + requestDetails.getCloudConfiguration()); + } else { + throw new IllegalArgumentException( + "No user params on requestAction: assignInstance. Please specify user params."); + } + } + + protected GeneralBuildingBlock getGBBMacroNoUserParamsCreate(ExecuteBuildingBlock executeBB, + Map lookupKeyMap, String bbName, String key, GeneralBuildingBlock gBB, Service service) + throws Exception { + ServiceInstance serviceInstance = gBB.getServiceInstance(); + if (bbName.contains(NETWORK) && !bbName.contains(NETWORK_COLLECTION)) { + String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID); + ModelInfo networkModelInfo = new ModelInfo(); + if(!executeBB.getBuildingBlock().getIsVirtualLink()) { + NetworkResourceCustomization networkCust = getNetworkCustomizationByKey(key, service); + if (networkCust != null) { + networkModelInfo.setModelCustomizationUuid(networkCust.getModelCustomizationUUID()); + this.populateL3Network(null, networkModelInfo, service, bbName, serviceInstance, lookupKeyMap, + networkId, null); + } else { + msoLogger.debug("Could not find a network customization with key: " + key); + } + } else { + msoLogger.debug("Orchestrating on Collection Network Resource Customization"); + serviceInstance.getNetworks().add(getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId)); + } + } else if(bbName.contains("Configuration")) { + String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID); + ModelInfo configurationModelInfo = new ModelInfo(); + configurationModelInfo.setModelCustomizationUuid(key); + ConfigurationResourceCustomization configurationCust = findConfigurationResourceCustomization(configurationModelInfo, service); + if(configurationCust != null) { + this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null); + } else { + msoLogger.debug("Could not find a configuration customization with key: " + key); + } + } + if (executeBB.getWorkflowResourceIds() != null) { + this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance, + executeBB.getWorkflowResourceIds().getNetworkCollectionId(), key); + } + return gBB; + } + + protected L3Network getVirtualLinkL3Network(Map lookupKeyMap, String bbName, String key, + String networkId) { + CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key); + if(collectionNetworkResourceCust != null && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) + || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { + NetworkResourceCustomization networkResourceCustomization = + mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); + L3Network l3Network = createNetwork(lookupKeyMap, null, networkId, null); + l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization)); + return l3Network; + } + return null; + } + + protected NetworkResourceCustomization getNetworkCustomizationByKey(String key, Service service) { + for (NetworkResourceCustomization networkCust : service.getNetworkCustomizations()) { + if (networkCust.getModelCustomizationUUID().equalsIgnoreCase(key)) { + return networkCust; + } + } + return null; + } + + protected GeneralBuildingBlock getGBBMacroExistingService(ExecuteBuildingBlock executeBB, + Map lookupKeyMap, String bbName, GeneralBuildingBlock gBB, Service service, + String requestAction, CloudConfiguration cloudConfiguration) throws Exception { + ServiceInstance serviceInstance = gBB.getServiceInstance(); + if (cloudConfiguration != null && requestAction.equalsIgnoreCase("deleteInstance")) { + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration, + CLOUD_OWNER); + CloudRegion cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion, CLOUD_OWNER); + gBB.setCloudRegion(cloudRegion); + } + if (bbName.contains(VNF)) { + for (GenericVnf genericVnf : serviceInstance.getVnfs()) { + if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null + && genericVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId()); + ModelInfo modelInfo = new ModelInfo(); + if (vnf != null) { + modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId()); + } + this.mapCatalogVnf(genericVnf, modelInfo, service); + } + } + } else if (bbName.contains(VF_MODULE)) { + for (GenericVnf vnf : serviceInstance.getVnfs()) { + for (VfModule vfModule : vnf.getVfModules()) { + if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null + && vfModule.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) { + String vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()) + .getModelCustomizationId(); + ModelInfo vnfModelInfo = new ModelInfo(); + vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); + this.mapCatalogVnf(vnf, vnfModelInfo, service); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnf.getVnfId()); + String vfModuleCustomizationUUID = this.bbInputSetupUtils + .getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId(); + ModelInfo vfModuleModelInfo = new ModelInfo(); + vfModuleModelInfo.setModelCustomizationId(vfModuleCustomizationUUID); + this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, vnfModelCustomizationUUID); + break; + } + } + } + } else if (bbName.contains(VOLUME_GROUP)) { + for (GenericVnf vnf : serviceInstance.getVnfs()) { + for (VolumeGroup volumeGroup : vnf.getVolumeGroups()) { + if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroup.getVolumeGroupId() + .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID))) { + String vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()) + .getModelCustomizationId(); + ModelInfo vnfModelInfo = new ModelInfo(); + vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); + this.mapCatalogVnf(vnf, vnfModelInfo, service); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnf.getVnfId()); + if (cloudConfiguration != null) { + String volumeGroupCustomizationUUID = this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER, + cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()) + .getModelCustomizationId(); + ModelInfo volumeGroupModelInfo = new ModelInfo(); + volumeGroupModelInfo.setModelCustomizationId(volumeGroupCustomizationUUID); + this.mapCatalogVolumeGroup(volumeGroup, volumeGroupModelInfo, service, + vnfModelCustomizationUUID); + } + break; + } + } + } + } else if (bbName.contains(NETWORK)) { + for (L3Network network : serviceInstance.getNetworks()) { + if (lookupKeyMap.get(ResourceKey.NETWORK_ID) != null + && network.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) { + String networkCustomizationUUID = this.bbInputSetupUtils.getAAIL3Network(network.getNetworkId()) + .getModelCustomizationId(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid(networkCustomizationUUID); + this.mapCatalogNetwork(network, modelInfo, service); + break; + } + } + } else if (bbName.contains("Fabric")) { + for(Configuration configuration : serviceInstance.getConfigurations()) { + if(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null + && configuration.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) { + String configurationCustUUID = this.bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()) + .getModelCustomizationId(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid(configurationCustUUID); + this.mapCatalogConfiguration(configuration, modelInfo, service); + break; + } + } + } + if (executeBB.getWorkflowResourceIds() != null) { + this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance, + executeBB.getWorkflowResourceIds().getNetworkCollectionId(), executeBB.getBuildingBlock().getKey()); + } + return gBB; + } + + protected GeneralBuildingBlock getGBBMacroUserParams(ExecuteBuildingBlock executeBB, RequestDetails requestDetails, + Map lookupKeyMap, String vnfType, String bbName, String key, GeneralBuildingBlock gBB, + RequestParameters requestParams, Service service, String input) throws Exception { + ServiceInstance serviceInstance = gBB.getServiceInstance(); + org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(input, + org.onap.so.serviceinstancebeans.Service.class); + + Resources resources = serviceMacro.getResources(); + Vnfs vnfs = null; + VfModules vfModules = null; + Networks networks = null; + CloudConfiguration cloudConfiguration = requestDetails.getCloudConfiguration(); + CloudRegion cloudRegion = getCloudRegionFromMacroRequest(cloudConfiguration, resources); + gBB.setCloudRegion(cloudRegion); + if (bbName.contains(VNF)) { + vnfs = findVnfsByKey(key, resources, vnfs); + String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID); + // This stores the vnf id in request db to be retrieved later when + // working on a vf module or volume group + InfraActiveRequests request = this.bbInputSetupUtils.getInfraActiveRequest(executeBB.getRequestId()); + if (request != null) { + this.bbInputSetupUtils.updateInfraActiveRequestVnfId(request, vnfId); + } + this.populateGenericVnf(vnfs.getModelInfo(), vnfs.getInstanceName(), vnfs.getPlatform(), + vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null, vnfId, vnfType, vnfs.getInstanceParams()); + } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP)) { + Pair vnfsAndVfModules = getVfModulesAndItsVnfsByKey(key, resources); + vfModules = vnfsAndVfModules.getValue1(); + vnfs = vnfsAndVfModules.getValue0(); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, getVnfId(executeBB, lookupKeyMap)); + if (vnfs == null) { + throw new Exception("Could not find Vnf to orchestrate VfModule"); + } + ModelInfo modelInfo = vfModules.getModelInfo(); + if (bbName.contains(VOLUME_GROUP)) { + String volumeGroupId = lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID); + this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, volumeGroupId, null, + vfModules.getVolumeGroupInstanceName(), vnfType, vfModules.getInstanceParams()); + } else { + String vfModuleId = lookupKeyMap.get(ResourceKey.VF_MODULE_ID); + CloudConfiguration cloudConfig = new CloudConfiguration(); + cloudConfig.setLcpCloudRegionId(cloudRegion.getLcpCloudRegionId()); + this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, vfModuleId, null, + vfModules.getInstanceName(), vfModules.getInstanceParams(), cloudConfig); + } + } else if (bbName.contains(NETWORK)) { + networks = findNetworksByKey(key, resources); + String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID); + this.populateL3Network(networks.getInstanceName(), networks.getModelInfo(), service, bbName, + serviceInstance, lookupKeyMap, networkId, networks.getInstanceParams()); + } else if (bbName.contains("Configuration")) { + String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID); + ModelInfo configurationModelInfo = new ModelInfo(); + configurationModelInfo.setModelCustomizationUuid(key); + ConfigurationResourceCustomization configurationCust = findConfigurationResourceCustomization(configurationModelInfo, service); + if(configurationCust != null) { + this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null); + } else { + msoLogger.debug("Could not find a configuration customization with key: " + key); + } + } + return gBB; + } + + protected Networks findNetworksByKey(String key, Resources resources) { + for (Networks networks : resources.getNetworks()) { + if (networks.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) { + return networks; + } + } + return null; + } + + protected Pair getVfModulesAndItsVnfsByKey(String key, Resources resources) { + for (Vnfs vnfs : resources.getVnfs()) { + for (VfModules vfModules : vnfs.getVfModules()) { + if (vfModules.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) { + return new Pair(vnfs, vfModules); + } + } + } + return null; + } + + protected Vnfs findVnfsByKey(String key, Resources resources, Vnfs vnfs) { + for (Vnfs tempVnfs : resources.getVnfs()) { + if (tempVnfs.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) { + vnfs = tempVnfs; + break; + } + } + return vnfs; + } + + protected CloudRegion getCloudRegionFromMacroRequest(CloudConfiguration cloudConfiguration, Resources resources) { + if(cloudConfiguration == null) { + for(Vnfs vnfs : resources.getVnfs()) { + if(cloudConfiguration == null) { + cloudConfiguration = vnfs.getCloudConfiguration(); + } else { + break; + } + for(VfModules vfModules : vnfs.getVfModules()) { + if(cloudConfiguration == null) { + cloudConfiguration = vfModules.getCloudConfiguration(); + } else { + break; + } + } + } + for(Networks networks : resources.getNetworks()) { + if(cloudConfiguration == null) { + cloudConfiguration = networks.getCloudConfiguration(); + } else { + break; + } + } + } + if(cloudConfiguration != null) { + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration, + CLOUD_OWNER); + return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion, CLOUD_OWNER); + } else { + msoLogger.debug("Could not find any cloud configuration for this request."); + return null; + } + } + + protected String getVnfId(ExecuteBuildingBlock executeBB, Map lookupKeyMap) { + String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID); + if (vnfId == null) { + InfraActiveRequests request = this.bbInputSetupUtils.getInfraActiveRequest(executeBB.getRequestId()); + vnfId = request.getVnfId(); + } + + return vnfId; + } + + protected String generateRandomUUID() { + return UUID.randomUUID().toString(); + } + + protected ServiceInstance getServiceInstanceHelper(RequestDetails requestDetails, Customer customer, + Project project, OwningEntity owningEntity, Map lookupKeyMap, String serviceInstanceId, + boolean aLaCarte, Service service, String bbName) throws Exception { + if (requestDetails.getRequestInfo().getInstanceName() == null && aLaCarte + && bbName.equalsIgnoreCase(AssignFlows.SERVICE_INSTANCE.toString())) { + throw new Exception("Request invalid missing: RequestInfo:InstanceName"); + } else { + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = null; + if (aLaCarte && bbName.equalsIgnoreCase(AssignFlows.SERVICE_INSTANCE.toString())) { + serviceInstanceAAI = bbInputSetupUtils + .getAAIServiceInstanceByName(requestDetails.getRequestInfo().getInstanceName(), customer); + } + if (serviceInstanceId != null && serviceInstanceAAI == null) { + serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + } + if (serviceInstanceAAI != null) { + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId); + return this.getExistingServiceInstance(serviceInstanceAAI); + } else { + return createServiceInstance(requestDetails, project, owningEntity, lookupKeyMap, + serviceInstanceId); + } + } + } + + protected ServiceInstance createServiceInstance(RequestDetails requestDetails, Project project, + OwningEntity owningEntity, Map lookupKeyMap, String serviceInstanceId) { + ServiceInstance serviceInstance = new ServiceInstance(); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId); + serviceInstance.setServiceInstanceId(serviceInstanceId); + if(requestDetails.getRequestInfo() != null) { + serviceInstance.setServiceInstanceName(requestDetails.getRequestInfo().getInstanceName()); + } + serviceInstance.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + serviceInstance.setProject(project); + serviceInstance.setOwningEntity(owningEntity); + return serviceInstance; + } + + public ServiceInstance getExistingServiceInstance(org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI) + throws Exception { + ServiceInstance serviceInstance = mapperLayer.mapAAIServiceInstanceIntoServiceInstance(serviceInstanceAAI); + if (serviceInstanceAAI.getRelationshipList() != null + && serviceInstanceAAI.getRelationshipList().getRelationship() != null + && !serviceInstanceAAI.getRelationshipList().getRelationship().isEmpty()) { + addRelationshipsToSI(serviceInstanceAAI, serviceInstance); + } + return serviceInstance; + } + + protected void populateNetworkCollectionAndInstanceGroupAssign(Service service, String bbName, + ServiceInstance serviceInstance, String resourceId, String key) throws Exception { + if (serviceInstance.getCollection() == null + && bbName.equalsIgnoreCase(AssignFlows.NETWORK_COLLECTION.toString())) { + Collection collection = this.createCollection(resourceId); + serviceInstance.setCollection(collection); + this.mapCatalogCollection(service, serviceInstance.getCollection(), key); + if(isVlanTagging(service, key)) { + InstanceGroup instanceGroup = this.createInstanceGroup(); + serviceInstance.getCollection().setInstanceGroup(instanceGroup); + this.mapCatalogNetworkCollectionInstanceGroup(service, + serviceInstance.getCollection().getInstanceGroup(), key); + } + } + } + + protected CollectionResourceCustomization findCatalogNetworkCollection(Service service, String key) { + for(CollectionResourceCustomization collectionCust : service.getCollectionResourceCustomizations()){ + if(collectionCust.getModelCustomizationUUID().equalsIgnoreCase(key)) { + return collectionCust; + } + } + return null; + } + + protected boolean isVlanTagging(Service service, String key) { + CollectionResourceCustomization collectionCust = findCatalogNetworkCollection(service, key); + if (collectionCust != null) { + CollectionResource collectionResource = collectionCust.getCollectionResource(); + if (collectionResource != null + && collectionResource.getInstanceGroup() != null + && collectionResource.getInstanceGroup().getToscaNodeType() != null + && collectionResource.getInstanceGroup().getToscaNodeType().contains("NetworkCollection")) { + return true; + } + } + return false; + } + + protected void mapCatalogNetworkCollectionInstanceGroup(Service service, InstanceGroup instanceGroup, String key) { + CollectionResourceCustomization collectionCust = this.findCatalogNetworkCollection(service, key); + org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = collectionCust.getCollectionResource().getInstanceGroup(); + instanceGroup.setModelInfoInstanceGroup( + mapperLayer.mapCatalogInstanceGroupToInstanceGroup(collectionCust, catalogInstanceGroup)); + } + + protected void mapCatalogCollection(Service service, Collection collection, String key) { + CollectionResourceCustomization collectionCust = findCatalogNetworkCollection(service, key); + if (collectionCust != null) { + CollectionResource collectionResource = collectionCust.getCollectionResource(); + if (collectionResource != null) { + collection.setModelInfoCollection( + mapperLayer.mapCatalogCollectionToCollection(collectionCust, collectionResource)); + } + } + } + + protected Collection createCollection(String collectionId) { + Collection collection = new Collection(); + collection.setId(collectionId); + collection.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + return collection; + } + + protected InstanceGroup createInstanceGroup() { + InstanceGroup instanceGroup = new InstanceGroup(); + String instanceGroupId = this.generateRandomUUID(); + instanceGroup.setId(instanceGroupId); + return instanceGroup; + } + + protected void addRelationshipsToSI(org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI, + ServiceInstance serviceInstance) throws Exception { + AAIResultWrapper serviceInstanceWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(serviceInstanceAAI)); + Optional relationshipsOp = serviceInstanceWrapper.getRelationships(); + Relationships relationships = null; + if (relationshipsOp.isPresent()) { + relationships = relationshipsOp.get(); + } else { + return; + } + + this.mapProject(relationships.getByType(AAIObjectType.PROJECT), serviceInstance); + this.mapOwningEntity(relationships.getByType(AAIObjectType.OWNING_ENTITY), serviceInstance); + this.mapL3Networks(relationships.getRelatedAAIUris(AAIObjectType.L3_NETWORK), serviceInstance.getNetworks()); + this.mapGenericVnfs(relationships.getRelatedAAIUris(AAIObjectType.GENERIC_VNF), serviceInstance.getVnfs()); + this.mapCollection(relationships.getByType(AAIObjectType.COLLECTION), serviceInstance); + this.mapConfigurations(relationships.getRelatedAAIUris(AAIObjectType.CONFIGURATION), serviceInstance.getConfigurations()); + } + + protected void mapConfigurations(List relatedAAIUris, List configurations) { + for (AAIResourceUri aaiResourceUri : relatedAAIUris) { + configurations.add(mapConfiguration(aaiResourceUri)); + } + } + + protected Configuration mapConfiguration(AAIResourceUri aaiResourceUri) { + AAIResultWrapper aaiConfigurationWrapper = this.bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri); + Optional aaiConfigurationOp = aaiConfigurationWrapper + .asBean(org.onap.aai.domain.yang.Configuration.class); + if (!aaiConfigurationOp.isPresent()) { + return null; + } + + return this.mapperLayer.mapAAIConfiguration(aaiConfigurationOp.get()); + } + + protected void mapGenericVnfs(List list, List genericVnfs) { + for (AAIResourceUri aaiResourceUri : list) { + genericVnfs.add(this.mapGenericVnf(aaiResourceUri)); + } + } + + protected GenericVnf mapGenericVnf(AAIResourceUri aaiResourceUri) { + AAIResultWrapper aaiGenericVnfWrapper = this.bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri); + Optional aaiGenericVnfOp = aaiGenericVnfWrapper + .asBean(org.onap.aai.domain.yang.GenericVnf.class); + if (!aaiGenericVnfOp.isPresent()) { + return null; + } + + GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnfOp.get()); + + Optional relationshipsOp = aaiGenericVnfWrapper.getRelationships(); + if (relationshipsOp.isPresent()) { + Relationships relationships = relationshipsOp.get(); + this.mapPlatform(relationships.getByType(AAIObjectType.PLATFORM), genericVnf); + this.mapLineOfBusiness(relationships.getByType(AAIObjectType.LINE_OF_BUSINESS), genericVnf); + genericVnf.getVolumeGroups().addAll(mapVolumeGroups(relationships.getByType(AAIObjectType.VOLUME_GROUP))); + genericVnf.getInstanceGroups().addAll(mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP))); + } + + return genericVnf; + } + + protected List mapInstanceGroups(List instanceGroups) { + List instanceGroupsList = new ArrayList<>(); + for (AAIResultWrapper volumeGroupWrapper : instanceGroups) { + instanceGroupsList.add(this.mapInstanceGroup(volumeGroupWrapper)); + } + return instanceGroupsList; + } + + protected InstanceGroup mapInstanceGroup(AAIResultWrapper instanceGroupWrapper) { + Optional aaiInstanceGroupOp = instanceGroupWrapper + .asBean(org.onap.aai.domain.yang.InstanceGroup.class); + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = null; + + if (!aaiInstanceGroupOp.isPresent()) { + return null; + } + + aaiInstanceGroup = aaiInstanceGroupOp.get(); + InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstanceGroup); + instanceGroup.setModelInfoInstanceGroup(this.mapperLayer.mapCatalogInstanceGroupToInstanceGroup(null, + this.bbInputSetupUtils.getCatalogInstanceGroup(aaiInstanceGroup.getModelVersionId()))); + return instanceGroup; + } + + protected List mapVolumeGroups(List volumeGroups) { + List volumeGroupsList = new ArrayList<>(); + for (AAIResultWrapper volumeGroupWrapper : volumeGroups) { + volumeGroupsList.add(this.mapVolumeGroup(volumeGroupWrapper)); + } + return volumeGroupsList; + } + + protected VolumeGroup mapVolumeGroup(AAIResultWrapper volumeGroupWrapper) { + Optional aaiVolumeGroupOp = volumeGroupWrapper + .asBean(org.onap.aai.domain.yang.VolumeGroup.class); + org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = null; + + if (!aaiVolumeGroupOp.isPresent()) { + return null; + } + + aaiVolumeGroup = aaiVolumeGroupOp.get(); + return this.mapperLayer.mapAAIVolumeGroup(aaiVolumeGroup); + } + + protected void mapLineOfBusiness(List lineOfBusinesses, GenericVnf genericVnf) { + if (!lineOfBusinesses.isEmpty()) { + AAIResultWrapper lineOfBusinessWrapper = lineOfBusinesses.get(0); + Optional aaiLineOfBusinessOp = lineOfBusinessWrapper + .asBean(org.onap.aai.domain.yang.LineOfBusiness.class); + org.onap.aai.domain.yang.LineOfBusiness aaiLineOfBusiness = null; + if (!aaiLineOfBusinessOp.isPresent()) { + return; + } + aaiLineOfBusiness = aaiLineOfBusinessOp.get(); + + LineOfBusiness lineOfBusiness = this.mapperLayer.mapAAILineOfBusiness(aaiLineOfBusiness); + genericVnf.setLineOfBusiness(lineOfBusiness); + } + } + + protected void mapPlatform(List platforms, GenericVnf genericVnf) { + if (!platforms.isEmpty()) { + AAIResultWrapper platformWrapper = platforms.get(0); + Optional aaiPlatformOp = platformWrapper + .asBean(org.onap.aai.domain.yang.Platform.class); + org.onap.aai.domain.yang.Platform aaiPlatform = null; + if (!aaiPlatformOp.isPresent()) { + return; + } + aaiPlatform = aaiPlatformOp.get(); + + Platform platform = this.mapperLayer.mapAAIPlatform(aaiPlatform); + genericVnf.setPlatform(platform); + } + } + + protected void mapCollection(List collections, ServiceInstance serviceInstance) { + if (!collections.isEmpty()) { + AAIResultWrapper collectionWrapper = collections.get(0); + Optional aaiCollectionOp = collectionWrapper + .asBean(org.onap.aai.domain.yang.Collection.class); + org.onap.aai.domain.yang.Collection aaiCollection = null; + if (!aaiCollectionOp.isPresent()) { + return; + } + aaiCollection = aaiCollectionOp.get(); + + Collection collection = this.mapperLayer.mapAAICollectionIntoCollection(aaiCollection); + + Optional relationshipsOp = collectionWrapper.getRelationships(); + Relationships relationships = null; + if (relationshipsOp.isPresent()) { + relationships = relationshipsOp.get(); + } else { + serviceInstance.setCollection(collection); + return; + } + List instanceGroupsList = mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP)); + if(!instanceGroupsList.isEmpty()) { + collection.setInstanceGroup(instanceGroupsList.get(0)); + } + serviceInstance.setCollection(collection); + } + } + + protected void mapL3Networks(List list, List l3Networks) { + for (AAIResourceUri aaiResourceUri : list) { + l3Networks.add(this.mapL3Network(aaiResourceUri)); + } + } + + protected L3Network mapL3Network(AAIResourceUri aaiResourceUri) { + AAIResultWrapper aaiNetworkWrapper = this.bbInputSetupUtils.getAAIResourceDepthTwo(aaiResourceUri); + Optional aaiL3NetworkOp = aaiNetworkWrapper + .asBean(org.onap.aai.domain.yang.L3Network.class); + org.onap.aai.domain.yang.L3Network aaiL3Network = null; + + if (!aaiL3NetworkOp.isPresent()) { + return null; + } + + aaiL3Network = aaiL3NetworkOp.get(); + L3Network network = this.mapperLayer.mapAAIL3Network(aaiL3Network); + + Optional relationshipsOp = aaiNetworkWrapper.getRelationships(); + if (relationshipsOp.isPresent()) { + Relationships relationships = relationshipsOp.get(); + this.mapNetworkPolicies(relationships.getByType(AAIObjectType.NETWORK_POLICY), + network.getNetworkPolicies()); + this.mapRouteTableReferences(relationships.getByType(AAIObjectType.ROUTE_TABLE_REFERENCE), + network.getContrailNetworkRouteTableReferences()); + } + + return network; + } + + protected void mapNetworkPolicies(List aaiNetworkPolicies, List networkPolicies) { + for (AAIResultWrapper networkPolicyWrapper : aaiNetworkPolicies) { + networkPolicies.add(this.mapNetworkPolicy(networkPolicyWrapper)); + } + } + + protected NetworkPolicy mapNetworkPolicy(AAIResultWrapper networkPolicyWrapper) { + Optional aaiNetworkPolicyOp = networkPolicyWrapper + .asBean(org.onap.aai.domain.yang.NetworkPolicy.class); + org.onap.aai.domain.yang.NetworkPolicy aaiNetworkPolicy = null; + + if (!aaiNetworkPolicyOp.isPresent()) { + return null; + } + + aaiNetworkPolicy = aaiNetworkPolicyOp.get(); + return this.mapperLayer.mapAAINetworkPolicy(aaiNetworkPolicy); + } + + protected void mapRouteTableReferences(List routeTableReferences, + List contrailNetworkRouteTableReferences) { + for (AAIResultWrapper routeTableReferenceWrapper : routeTableReferences) { + contrailNetworkRouteTableReferences.add(this.mapRouteTableReference(routeTableReferenceWrapper)); + } + } + + protected RouteTableReference mapRouteTableReference(AAIResultWrapper routeTableReferenceWrapper) { + Optional aaiRouteTableReferenceOp = routeTableReferenceWrapper + .asBean(org.onap.aai.domain.yang.RouteTableReference.class); + org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference = null; + + if (!aaiRouteTableReferenceOp.isPresent()) { + return null; + } + + aaiRouteTableReference = aaiRouteTableReferenceOp.get(); + return this.mapperLayer.mapAAIRouteTableReferenceIntoRouteTableReference(aaiRouteTableReference); + } + + protected void mapOwningEntity(List owningEntities, ServiceInstance serviceInstance) { + if (!owningEntities.isEmpty()) { + AAIResultWrapper owningEntityWrapper = owningEntities.get(0); + Optional aaiOwningEntityOp = owningEntityWrapper + .asBean(org.onap.aai.domain.yang.OwningEntity.class); + org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = null; + if (!aaiOwningEntityOp.isPresent()) { + return; + } + aaiOwningEntity = aaiOwningEntityOp.get(); + + OwningEntity owningEntity = this.mapperLayer.mapAAIOwningEntity(aaiOwningEntity); + serviceInstance.setOwningEntity(owningEntity); + } + } + + protected void mapProject(List projects, ServiceInstance serviceInstance) { + if (!projects.isEmpty()) { + AAIResultWrapper projectWrapper = projects.get(0); + Optional aaiProjectOp = projectWrapper + .asBean(org.onap.aai.domain.yang.Project.class); + org.onap.aai.domain.yang.Project aaiProject = null; + if (!aaiProjectOp.isPresent()) { + return; + } + aaiProject = aaiProjectOp.get(); + + Project project = this.mapperLayer.mapAAIProject(aaiProject); + serviceInstance.setProject(project); + } + } + protected Customer mapCustomer(String globalCustomerId, String subscriptionServiceType) { + org.onap.aai.domain.yang.Customer aaiCustomer = this.bbInputSetupUtils.getAAICustomer(globalCustomerId); + org.onap.aai.domain.yang.ServiceSubscription aaiServiceSubscription = this.bbInputSetupUtils + .getAAIServiceSubscription(globalCustomerId, subscriptionServiceType); + Customer customer = this.mapperLayer.mapAAICustomer(aaiCustomer); + ServiceSubscription serviceSubscription = this.mapperLayer.mapAAIServiceSubscription(aaiServiceSubscription); + if(serviceSubscription != null){ + customer.setServiceSubscription(serviceSubscription); + } + return customer; + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java new file mode 100644 index 0000000000..04f9cdcb86 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -0,0 +1,464 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.tasks; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.modelmapper.ModelMapper; +import org.modelmapper.convention.MatchingStrategies; +import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Entitlement; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Evc; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ForwarderEvc; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LagInterface; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; +import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.License; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResource; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.InstanceGroup; +import org.onap.so.db.catalog.beans.InstanceGroupType; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.logger.MsoLogger; +import org.onap.so.serviceinstancebeans.CloudConfiguration; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.springframework.stereotype.Component; + +@Component("BBInputSetupMapperLayer") +public class BBInputSetupMapperLayer { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, + BBInputSetupMapperLayer.class); + + private ModelMapper modelMapper = new ModelMapper(); + + public Customer mapAAICustomer(org.onap.aai.domain.yang.Customer customerAAI) { + return modelMapper.map(customerAAI, Customer.class); + } + + public ServiceSubscription mapAAIServiceSubscription( + org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionAAI) { + return modelMapper.map(serviceSubscriptionAAI, ServiceSubscription.class); + } + + protected Project mapAAIProject(org.onap.aai.domain.yang.Project aaiProject) { + return modelMapper.map(aaiProject, Project.class); + } + + protected OwningEntity mapAAIOwningEntity(org.onap.aai.domain.yang.OwningEntity aaiOwningEntity) { + return modelMapper.map(aaiOwningEntity, OwningEntity.class); + } + + protected Platform mapAAIPlatform(org.onap.aai.domain.yang.Platform aaiPlatform) { + return modelMapper.map(aaiPlatform, Platform.class); + } + + protected LineOfBusiness mapAAILineOfBusiness(org.onap.aai.domain.yang.LineOfBusiness aaiLineOfBusiness) { + return modelMapper.map(aaiLineOfBusiness, LineOfBusiness.class); + } + + protected SegmentationAssignment mapAAISegmentationAssignment( + org.onap.aai.domain.yang.SegmentationAssignment aaiSegmentationAssignment) { + return modelMapper.map(aaiSegmentationAssignment, SegmentationAssignment.class); + } + + protected CtagAssignment mapAAICtagAssignment(org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment) { + return modelMapper.map(aaiCtagAssignment, CtagAssignment.class); + } + + protected Subnet mapAAISubnet(org.onap.aai.domain.yang.Subnet aaiSubnet) { + return modelMapper.map(aaiSubnet, Subnet.class); + } + + protected License mapAAILicense(org.onap.aai.domain.yang.License aaiLicense) { + return modelMapper.map(aaiLicense, License.class); + } + + protected Entitlement mapAAIEntitlement(org.onap.aai.domain.yang.Entitlement aaiEntitlement) { + return modelMapper.map(aaiEntitlement, Entitlement.class); + } + + protected LagInterface mapAAILagInterface(org.onap.aai.domain.yang.LagInterface aaiLagInterface) { + return modelMapper.map(aaiLagInterface, LagInterface.class); + } + + protected VfModule mapAAIVfModule(org.onap.aai.domain.yang.VfModule aaiVfModule) { + VfModule vfModule = modelMapper.map(aaiVfModule, VfModule.class); + vfModule.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVfModule.getOrchestrationStatus())); + return vfModule; + } + + public NetworkPolicy mapAAINetworkPolicy(org.onap.aai.domain.yang.NetworkPolicy aaiNetworkPolicy) { + return modelMapper.map(aaiNetworkPolicy, NetworkPolicy.class); + } + + protected VolumeGroup mapAAIVolumeGroup(org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup) { + VolumeGroup volumeGroup = modelMapper.map(aaiVolumeGroup, VolumeGroup.class); + volumeGroup.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVolumeGroup.getOrchestrationStatus())); + return volumeGroup; + } + + protected void setPlatformAndLOBIntoServiceInstance(Platform platformMSO, LineOfBusiness lineOfBusinessMSO, + ServiceInstance serviceInstance, Map resourcesToBeOrchestrated) { + String vnfId = resourcesToBeOrchestrated.get(ResourceKey.GENERIC_VNF_ID); + if (vnfId != null && !serviceInstance.getVnfs().isEmpty()) { + for (GenericVnf vnf : serviceInstance.getVnfs()) { + if (vnf.getVnfId().equalsIgnoreCase(vnfId)) { + vnf.setPlatform(platformMSO); + vnf.setLineOfBusiness(lineOfBusinessMSO); + break; + } + } + } + } + + public ModelInfoServiceInstance mapCatalogServiceIntoServiceInstance(Service service) { + return modelMapper.map(service, ModelInfoServiceInstance.class); + } + + protected ModelInfoInstanceGroup mapCatalogInstanceGroupToInstanceGroup(CollectionResourceCustomization collectionCust, InstanceGroup instanceGroup) { + ModelInfoInstanceGroup modelInfoInstanceGroup = modelMapper.map(instanceGroup, ModelInfoInstanceGroup.class); + if(instanceGroup.getType().equals(InstanceGroupType.L3_NETWORK)) + modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_L3_NETWORK); + else + modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_VNFC); + if(collectionCust != null) { + List instanceGroupCustList = instanceGroup.getCollectionInstanceGroupCustomizations(); + for(CollectionResourceInstanceGroupCustomization collectionInsatnceGroupCust : instanceGroupCustList) { + if(collectionInsatnceGroupCust.getModelCustomizationUUID().equalsIgnoreCase(collectionCust.getModelCustomizationUUID())) { + modelInfoInstanceGroup.setFunction(collectionInsatnceGroupCust.getFunction()); + modelInfoInstanceGroup.setDescription(collectionInsatnceGroupCust.getDescription()); + break; + } + } + } + return modelInfoInstanceGroup; + } + + protected ModelInfoCollection mapCatalogCollectionToCollection(CollectionResourceCustomization collectionCust, + CollectionResource collectionResource) { + ModelInfoCollection modelInfoCollection = new ModelInfoCollection(); + modelInfoCollection.setCollectionFunction(collectionCust.getFunction()); + modelInfoCollection.setCollectionRole(collectionCust.getRole()); + modelInfoCollection.setCollectionType(collectionCust.getType()); + modelInfoCollection.setDescription(collectionResource.getDescription()); + modelInfoCollection.setModelInvariantUUID(collectionResource.getModelInvariantUUID()); + modelInfoCollection.setModelVersionId(collectionResource.getModelUUID()); + return modelInfoCollection; + } + + public ServiceInstance mapAAIServiceInstanceIntoServiceInstance( + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance) { + ServiceInstance serviceInstance = modelMapper.map(aaiServiceInstance, ServiceInstance.class); + if (aaiServiceInstance.getAllottedResources() != null) { + for (org.onap.aai.domain.yang.AllottedResource allottedResource : aaiServiceInstance.getAllottedResources() + .getAllottedResource()) { + serviceInstance.getAllottedResources().add(mapAAIAllottedResource(allottedResource)); + } + } + serviceInstance.setOrchestrationStatus( + this.mapOrchestrationStatusFromAAI(aaiServiceInstance.getOrchestrationStatus())); + return serviceInstance; + } + + protected AllottedResource mapAAIAllottedResource(org.onap.aai.domain.yang.AllottedResource aaiAllottedResource) { + AllottedResource allottedResource = modelMapper.map(aaiAllottedResource, AllottedResource.class); + return allottedResource; + } + + protected L3Network mapAAIL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network) { + L3Network network = modelMapper.map(aaiL3Network, L3Network.class); + mapAllSubnetsIntoL3Network(aaiL3Network, network); + mapAllCtagAssignmentsIntoL3Network(aaiL3Network, network); + mapAllSegmentationAssignmentsIntoL3Network(aaiL3Network, network); + network.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiL3Network.getOrchestrationStatus())); + return network; + } + + protected void mapAllSegmentationAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, + L3Network network) { + if (aaiL3Network.getSegmentationAssignments() != null) { + for (org.onap.aai.domain.yang.SegmentationAssignment aaiSegmentationAssignment : aaiL3Network + .getSegmentationAssignments().getSegmentationAssignment()) { + network.getSegmentationAssignments().add(mapAAISegmentationAssignment(aaiSegmentationAssignment)); + } + } + } + + protected void mapAllCtagAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, + L3Network network) { + if (aaiL3Network.getCtagAssignments() != null) { + for (org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment : aaiL3Network.getCtagAssignments() + .getCtagAssignment()) { + network.getCtagAssignments().add(mapAAICtagAssignment(aaiCtagAssignment)); + } + } + } + + protected void mapAllSubnetsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, L3Network network) { + if (aaiL3Network.getSubnets() != null) { + for (org.onap.aai.domain.yang.Subnet aaiSubnet : aaiL3Network.getSubnets().getSubnet()) { + network.getSubnets().add(mapAAISubnet(aaiSubnet)); + } + } + } + + protected GenericVnf mapAAIGenericVnfIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf) { + GenericVnf genericVnf = modelMapper.map(aaiGenericVnf, GenericVnf.class); + mapAllVfModulesIntoGenericVnf(aaiGenericVnf, genericVnf); + mapAllLagInterfacesIntoGenericVnf(aaiGenericVnf, genericVnf); + mapAllEntitlementsIntoGenericVnf(aaiGenericVnf, genericVnf); + mapAllLicensesIntoGenericVnf(aaiGenericVnf, genericVnf); + genericVnf.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiGenericVnf.getOrchestrationStatus())); + return genericVnf; + } + + protected void mapAllLicensesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, + GenericVnf genericVnf) { + if (aaiGenericVnf.getLicenses() != null) { + for (org.onap.aai.domain.yang.License aaiLicense : aaiGenericVnf.getLicenses().getLicense()) { + genericVnf.setLicense(mapAAILicense(aaiLicense)); + } + } + } + + protected void mapAllEntitlementsIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, + GenericVnf genericVnf) { + if (aaiGenericVnf.getEntitlements() != null) { + for (org.onap.aai.domain.yang.Entitlement aaiEntitlement : aaiGenericVnf.getEntitlements() + .getEntitlement()) { + genericVnf.getEntitlements().add(mapAAIEntitlement(aaiEntitlement)); + } + } + } + + protected void mapAllLagInterfacesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, + GenericVnf genericVnf) { + if (aaiGenericVnf.getLagInterfaces() != null) { + for (org.onap.aai.domain.yang.LagInterface aaiLagInterface : aaiGenericVnf.getLagInterfaces() + .getLagInterface()) { + genericVnf.getLagInterfaces().add(mapAAILagInterface(aaiLagInterface)); + } + } + } + + protected void mapAllVfModulesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, + GenericVnf genericVnf) { + if (aaiGenericVnf.getVfModules() != null) { + for (org.onap.aai.domain.yang.VfModule aaiVfModule : aaiGenericVnf.getVfModules().getVfModule()) { + VfModule vfModule = mapAAIVfModule(aaiVfModule); + genericVnf.getVfModules().add(vfModule); + } + } + } + + public OrchestrationStatus mapOrchestrationStatusFromAAI(String orchestrationStatus) { + + Optional result = Arrays.asList(OrchestrationStatus.values()).stream() + .filter(item -> item.fuzzyMap(orchestrationStatus)) + .findFirst(); + + return result.orElse(null); + + } + + public RequestContext mapRequestContext(RequestDetails requestDetails) { + RequestContext context = new RequestContext(); + modelMapper.map(requestDetails.getRequestInfo(), context); + org.onap.so.serviceinstancebeans.RequestParameters requestParameters = requestDetails.getRequestParameters(); + if (null != requestParameters) { + context.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType()); + context.setRequestParameters(this.mapRequestParameters(requestDetails.getRequestParameters())); + } + return context; + } + + protected RequestParameters mapRequestParameters(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) { + RequestParameters requestParams = new RequestParameters(); + requestParams.setaLaCarte(requestParameters.getALaCarte()); + requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType()); + requestParams.setUserParams(requestParameters.getUserParams()); + return requestParams; + } + + protected OrchestrationContext mapOrchestrationContext(RequestDetails requestDetails) { + OrchestrationContext context = new OrchestrationContext(); + context.setIsRollbackEnabled((requestDetails.getRequestInfo().getSuppressRollback())); + return context; + } + + protected CloudRegion mapCloudRegion(CloudConfiguration cloudConfiguration, org.onap.aai.domain.yang.CloudRegion aaiCloudRegion, String cloudOwner) { + CloudRegion cloudRegion = new CloudRegion(); + if(cloudConfiguration != null) + cloudRegion = modelMapper.map(cloudConfiguration, CloudRegion.class); + if(aaiCloudRegion != null) + modelMapper.map(aaiCloudRegion, cloudRegion); + if(cloudOwner != null) + cloudRegion.setCloudOwner(cloudOwner); + return cloudRegion; + } + + protected Collection mapAAICollectionIntoCollection(org.onap.aai.domain.yang.Collection aaiCollection) { + Collection collection = new Collection(); + collection.setId(aaiCollection.getCollectionId()); + collection.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiCollection.getOrchestrationStatus())); + return collection; + } + + protected org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup mapAAIInstanceGroupIntoInstanceGroup( + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup) { + return modelMapper.map(aaiInstanceGroup, + org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup.class); + } + + public RouteTableReference mapAAIRouteTableReferenceIntoRouteTableReference( + org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference) { + return modelMapper.map(aaiRouteTableReference, RouteTableReference.class); + } + + protected ModelInfoNetwork mapCatalogNetworkToNetwork(NetworkResourceCustomization networkResourceCustomization) { + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + ModelInfoNetwork modelInfoNetwork = modelMapper.map(networkResourceCustomization, ModelInfoNetwork.class); + modelMapper.map(networkResourceCustomization.getNetworkResource(), modelInfoNetwork); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STANDARD); + return modelInfoNetwork; + } + + protected ModelInfoGenericVnf mapCatalogVnfToVnf(VnfResourceCustomization vnfResourceCustomization) { + ModelInfoGenericVnf modelInfoVnf = modelMapper.map(vnfResourceCustomization, ModelInfoGenericVnf.class); + modelMapper.map(vnfResourceCustomization.getVnfResources(), modelInfoVnf); + return modelInfoVnf; + } + + protected ModelInfoVfModule mapCatalogVfModuleToVfModule(VfModuleCustomization vfResourceCustomization) { + ModelInfoVfModule modelInfoVfModule = modelMapper.map(vfResourceCustomization, ModelInfoVfModule.class); + modelMapper.map(vfResourceCustomization.getVfModule(), modelInfoVfModule); + return modelInfoVfModule; + } + + protected Platform mapRequestPlatform(org.onap.so.serviceinstancebeans.Platform platform) { + return modelMapper.map(platform, Platform.class); + } + + protected LineOfBusiness mapRequestLineOfBusiness( + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness) { + return modelMapper.map(lineOfBusiness, LineOfBusiness.class); + } + + public Configuration mapAAIConfiguration(org.onap.aai.domain.yang.Configuration configurationAAI) { + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + Configuration configuration = modelMapper.map(configurationAAI, Configuration.class); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STANDARD); + configuration.getForwarderEvcs().addAll(mapAllForwarderEvcs(configurationAAI)); + configuration.getEvcs().addAll(mapAllEvcs(configurationAAI)); + configuration.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(configurationAAI.getOrchestrationStatus())); + return configuration; + } + + protected List mapAllEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) { + List listOfEvcs = new ArrayList<>(); + if (configurationAAI.getEvcs() != null) { + for (org.onap.aai.domain.yang.Evc aaiEvc : configurationAAI.getEvcs().getEvc()) { + listOfEvcs.add(mapEvc(aaiEvc)); + } + } + return listOfEvcs; + } + + protected Evc mapEvc(org.onap.aai.domain.yang.Evc aaiEvc) { + return modelMapper.map(aaiEvc, Evc.class); + } + + protected List mapAllForwarderEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) { + List listOfForwarderEvcs = new ArrayList<>(); + if (configurationAAI.getForwarderEvcs() != null) { + for (org.onap.aai.domain.yang.ForwarderEvc aaiForwarderEvc : configurationAAI.getForwarderEvcs().getForwarderEvc()) { + listOfForwarderEvcs.add(mapForwarderEvc(aaiForwarderEvc)); + } + } + return listOfForwarderEvcs; + } + + protected ForwarderEvc mapForwarderEvc(org.onap.aai.domain.yang.ForwarderEvc aaiForwarderEvc) { + return modelMapper.map(aaiForwarderEvc, ForwarderEvc.class); + } + + protected OwningEntity mapRequestOwningEntity(org.onap.so.serviceinstancebeans.OwningEntity owningEntity) { + return modelMapper.map(owningEntity, OwningEntity.class); + } + + protected Project mapRequestProject(org.onap.so.serviceinstancebeans.Project project) { + return modelMapper.map(project, Project.class); + } + + protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration( + ConfigurationResourceCustomization configurationResourceCustomization) { + ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); + modelInfoConfiguration.setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID()); + modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID()); + modelInfoConfiguration.setModelInvariantId(configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID()); + return modelInfoConfiguration; + } + + public NetworkResourceCustomization mapCollectionNetworkResourceCustToNetworkResourceCust( + CollectionNetworkResourceCustomization collectionNetworkResourceCust) { + return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java new file mode 100644 index 0000000000..14c162935a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -0,0 +1,409 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.tasks; + +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.onap.aai.domain.yang.CloudRegion; +import org.onap.aai.domain.yang.Configuration; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.GenericVnfs; +import org.onap.aai.domain.yang.InstanceGroup; +import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.L3Networks; +import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.ServiceInstances; +import org.onap.aai.domain.yang.ServiceSubscription; +import org.onap.aai.domain.yang.VfModule; +import org.onap.aai.domain.yang.VolumeGroup; +import org.onap.aai.domain.yang.VolumeGroups; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.client.aai.AAIObjectPlurals; +import org.onap.so.client.aai.AAIObjectType; +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.db.request.RequestsDbClient; +import org.onap.so.client.graphinventory.entities.uri.Depth; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.logger.MsoLogger; +import org.onap.so.serviceinstancebeans.CloudConfiguration; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +@Component("BBInputSetupUtils") +public class BBInputSetupUtils { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BBInputSetupUtils.class); + private ObjectMapper objectMapper = new ObjectMapper(); + private static final String REQUEST_ERROR = "Could not find request."; + + @Autowired + protected CatalogDbClient catalogDbClient; + + @Autowired + protected RequestsDbClient requestsDbClient; + + @Autowired + protected InjectionHelper injectionHelper; + + public void updateInfraActiveRequestVnfId(InfraActiveRequests request, String vnfId) { + if(request != null) { + request.setVnfId(vnfId); + this.requestsDbClient.updateInfraActiveRequests(request); + } else { + msoLogger.debug(REQUEST_ERROR); + } + } + + public void updateInfraActiveRequestVfModuleId(InfraActiveRequests request, String vfModuleId) { + if(request != null) { + request.setVfModuleId(vfModuleId); + this.requestsDbClient.updateInfraActiveRequests(request); + } else { + msoLogger.debug(REQUEST_ERROR); + } + } + + public void updateInfraActiveRequestVolumeGroupId(InfraActiveRequests request, String volumeGroupId) { + if(request != null) { + request.setVolumeGroupId(volumeGroupId); + this.requestsDbClient.updateInfraActiveRequests(request); + } else { + msoLogger.debug(REQUEST_ERROR); + } + } + + public void updateInfraActiveRequestNetworkId(InfraActiveRequests request, String networkId) { + if(request != null) { + request.setNetworkId(networkId); + this.requestsDbClient.updateInfraActiveRequests(request); + } else { + msoLogger.debug(REQUEST_ERROR); + } + } + + public Service getCatalogServiceByModelUUID(String modelUUID) { + return catalogDbClient.getServiceByID(modelUUID); + } + + public Service getCatalogServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) { + return catalogDbClient.getServiceByModelVersionAndModelInvariantUUID(modelVersion, modelInvariantUUID); + } + + public CollectionNetworkResourceCustomization getCatalogCollectionNetworkResourceCustByID(String key) { + return catalogDbClient.getCollectionNetworkResourceCustomizationByID(key); + } + + public List getVnfcInstanceGroups(String modelCustomizationUUID) { + return catalogDbClient.getVnfcInstanceGroupsByVnfResourceCust(modelCustomizationUUID); + } + + public Map getURIKeysFromServiceInstance(String serviceInstanceId) { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + return uri.getURIKeys(); + } + + protected RequestDetails getRequestDetails(String requestId) throws IOException { + if (requestId != null && !requestId.isEmpty()) { + InfraActiveRequests activeRequest = this.getInfraActiveRequest(requestId); + String requestBody = activeRequest.getRequestBody().replaceAll("\\\\", ""); + objectMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + objectMapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + return objectMapper.readValue(requestBody, RequestDetails.class); + } else { + return null; + } + } + + protected InfraActiveRequests getInfraActiveRequest(String requestId) { + if (requestId != null && !requestId.isEmpty()) { + return requestsDbClient.getInfraActiveRequestbyRequestId(requestId); + } else { + return null; + } + } + + protected CloudRegion getCloudRegion(CloudConfiguration cloudConfiguration, String cloudOwner) { + if (cloudConfiguration != null) { + String cloudRegionId = cloudConfiguration.getLcpCloudRegionId(); + if (cloudRegionId != null && !cloudRegionId.isEmpty()) { + return injectionHelper.getAaiClient().get(CloudRegion.class, + AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, + cloudConfiguration.getLcpCloudRegionId())).orElse(null); + + } else { + return null; + } + } else { + return null; + } + } + + protected InstanceGroup getAAIInstanceGroup(String instanceGroupId) { + return injectionHelper.getAaiClient().get(InstanceGroup.class, + AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)) + .orElse(null); + } + + public org.onap.aai.domain.yang.Customer getAAICustomer(String globalSubscriberId) { + return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Customer.class, + AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId)) + .orElse(null); + } + + public ServiceSubscription getAAIServiceSubscription(String globalSubscriberId, String subscriptionServiceType) { + + if(globalSubscriberId == null || globalSubscriberId.equals("") || subscriptionServiceType == null || subscriptionServiceType.equals("")) { + return null; + } else { + return injectionHelper.getAaiClient().get(ServiceSubscription.class, AAIUriFactory.createResourceUri( + AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId, subscriptionServiceType)) + .orElse(null); + } + + } + + public ServiceInstance getAAIServiceInstanceById(String serviceInstanceId) { + return injectionHelper.getAaiClient().get(ServiceInstance.class, + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId).depth(Depth.TWO)) + .orElse(null); + } + + protected ServiceInstance getAAIServiceInstanceByIdAndCustomer(String globalCustomerId, String serviceType, + String serviceInstanceId) { + return injectionHelper.getAaiClient().get(ServiceInstance.class, AAIUriFactory.createResourceUri( + AAIObjectType.SERVICE_INSTANCE, globalCustomerId, serviceType, serviceInstanceId).depth(Depth.TWO)) + .orElse(null); + } + + protected org.onap.aai.domain.yang.ServiceInstances getAAIServiceInstancesByName(String serviceInstanceName, + Customer customer) { + + return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.ServiceInstances.class, + AAIUriFactory + .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(), + customer.getServiceSubscription().getServiceType()) + .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO)) + .orElseGet(() -> { + msoLogger.debug("No Service Instance matched by name"); + return null; + }); + } + + public org.onap.aai.domain.yang.ServiceInstance getAAIServiceInstanceByName(String serviceInstanceName, + Customer customer) throws Exception { + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null; + org.onap.aai.domain.yang.ServiceInstances aaiServiceInstances = null; + aaiServiceInstances = getAAIServiceInstancesByName(serviceInstanceName, customer); + + if (aaiServiceInstances == null) { + return null; + } else if (aaiServiceInstances.getServiceInstance().size() > 1) { + throw new Exception("Multiple Service Instances Returned"); + } else { + aaiServiceInstance = aaiServiceInstances.getServiceInstance().get(0); + } + return aaiServiceInstance; + } + + protected ServiceInstances getAAIServiceInstancesByName(String globalCustomerId, String serviceType, + String serviceInstanceName) { + + return injectionHelper.getAaiClient().get(ServiceInstances.class, + AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, globalCustomerId, serviceType) + .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO)) + .orElseGet(() -> { + msoLogger.debug("No Service Instance matched by name"); + return null; + }); + } + + public Optional getAAIServiceInstanceByName(String globalCustomerId, String serviceType, + String serviceInstanceName) throws Exception { + ServiceInstance aaiServiceInstance = null; + ServiceInstances aaiServiceInstances = null; + aaiServiceInstances = getAAIServiceInstancesByName(globalCustomerId, serviceType, serviceInstanceName); + + if (aaiServiceInstances == null) { + return Optional.empty(); + } else if (aaiServiceInstances.getServiceInstance().size() > 1) { + throw new Exception("Multiple Service Instances Returned"); + } else { + aaiServiceInstance = aaiServiceInstances.getServiceInstance().get(0); + } + return Optional.of(aaiServiceInstance); + } + + public org.onap.so.db.catalog.beans.InstanceGroup getCatalogInstanceGroup(String modelUUID) { + return this.catalogDbClient.getInstanceGroupByModelUUID(modelUUID); + } + + public List getCollectionResourceInstanceGroupCustomization( + String modelCustomizationUUID) { + return this.catalogDbClient + .getCollectionResourceInstanceGroupCustomizationByModelCustUUID(modelCustomizationUUID); + } + + public AAIResultWrapper getAAIResourceDepthOne(AAIResourceUri aaiResourceUri) { + AAIResourceUri clonedUri = aaiResourceUri.clone(); + return this.injectionHelper.getAaiClient().get(clonedUri.depth(Depth.ONE)); + } + + public AAIResultWrapper getAAIResourceDepthTwo(AAIResourceUri aaiResourceUri) { + AAIResourceUri clonedUri = aaiResourceUri.clone(); + return this.injectionHelper.getAaiClient().get(clonedUri.depth(Depth.TWO)); + } + + public Configuration getAAIConfiguration(String configurationId) { + return this.injectionHelper.getAaiClient().get(Configuration.class, + AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId).depth(Depth.ONE)) + .orElseGet(() -> { + msoLogger.debug("No Configuration matched by id"); + return null; + }); + } + + public GenericVnf getAAIGenericVnf(String vnfId) { + + return this.injectionHelper.getAaiClient().get(GenericVnf.class, + AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)) + .orElseGet(() -> { + msoLogger.debug("No Generic Vnf matched by id"); + return null; + }); + } + + public VolumeGroup getAAIVolumeGroup(String cloudOwnerId, String cloudRegionId, String volumeGroupId) { + return this.injectionHelper.getAaiClient().get(VolumeGroup.class, + AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwnerId, cloudRegionId, volumeGroupId).depth(Depth.ONE)) + .orElseGet(() -> { + msoLogger.debug("No Generic Vnf matched by id"); + return null; + }); + } + + public VfModule getAAIVfModule(String vnfId, String vfModuleId) { + return this.injectionHelper.getAaiClient().get(VfModule.class, + AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId).depth(Depth.ONE)) + .orElseGet(() -> { + msoLogger.debug("No Generic Vnf matched by id"); + return null; + }); + } + + public L3Network getAAIL3Network(String networkId) { + + return this.injectionHelper.getAaiClient().get(L3Network.class, + AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE)) + .orElseGet(() -> { + msoLogger.debug("No Generic Vnf matched by id"); + return null; + }); + + } + + public Optional getRelatedNetworkByNameFromServiceInstance(String serviceInstanceId, String networkName) throws Exception{ + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + uri.relatedTo(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName); + Optional networks = injectionHelper.getAaiClient().get(L3Networks.class, uri); + L3Network network = null; + if (!networks.isPresent()) { + msoLogger.debug("No Networks matched by name"); + return Optional.empty(); + } else { + if (networks.get().getL3Network().size() > 1) { + throw new Exception("Multiple Networks Returned"); + } else { + network = networks.get().getL3Network().get(0); + } + return Optional.of(network); + } + } + + public Optional getRelatedVnfByNameFromServiceInstance(String serviceInstanceId, String vnfName) throws Exception { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + uri.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName); + Optional vnfs = injectionHelper.getAaiClient().get(GenericVnfs.class, uri); + GenericVnf vnf = null; + if (!vnfs.isPresent()) { + msoLogger.debug("No Vnfs matched by name"); + return Optional.empty(); + } else { + if (vnfs.get().getGenericVnf().size() > 1) { + throw new Exception("Multiple Vnfs Returned"); + } else { + vnf = vnfs.get().getGenericVnf().get(0); + } + return Optional.of(vnf); + } + } + + public Optional getRelatedVolumeGroupByNameFromVnf(String vnfId, String volumeGroupName) throws Exception{ + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName); + Optional volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri); + VolumeGroup volumeGroup = null; + if (!volumeGroups.isPresent()) { + msoLogger.debug("No VolumeGroups matched by name"); + return Optional.empty(); + } else { + if (volumeGroups.get().getVolumeGroup().size() > 1) { + throw new Exception("Multiple VolumeGroups Returned"); + } else { + volumeGroup = volumeGroups.get().getVolumeGroup().get(0); + } + return Optional.of(volumeGroup); + } + } + + public Optional getRelatedVolumeGroupByNameFromVfModule(String vfModuleId, String volumeGroupName) throws Exception { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vfModuleId); + uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName); + Optional volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri); + VolumeGroup volumeGroup = null; + if (!volumeGroups.isPresent()) { + msoLogger.debug("No VolumeGroups matched by name"); + return Optional.empty(); + } else { + if (volumeGroups.get().getVolumeGroup().size() > 1) { + throw new Exception("Multiple VolumeGroups Returned"); + } else { + volumeGroup = volumeGroups.get().getVolumeGroup().get(0); + } + return Optional.of(volumeGroup); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java new file mode 100644 index 0000000000..7a56ab88ab --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -0,0 +1,116 @@ +/*- + * ============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.bpmn.servicedecomposition.tasks; + +import java.util.Map; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class ExecuteBuildingBlockRainyDay { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExecuteBuildingBlockRainyDay.class); + + @Autowired + private CatalogDbClient catalogDbClient; + private static final String ASTERISK = "ASTERISK"; + + public void setRetryTimer(DelegateExecution execution) { + try { + int retryCount = (int) execution.getVariable("retryCount"); + int retryTimeToWait = (int) Math.pow(5, retryCount); + String RetryDuration = "PT" + retryTimeToWait + "M"; + execution.setVariable("RetryDuration", RetryDuration); + } catch (Exception e) { + msoLogger.error(e); + throw new BpmnError("Unknown error incrementing retry counter"); + } + } + + public void queryRainyDayTable(DelegateExecution execution) { + try { + ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock"); + String bbName = ebb.getBuildingBlock().getBpmnFlowName(); + GeneralBuildingBlock gBBInput = (GeneralBuildingBlock) execution.getVariable("gBBInput"); + Map lookupKeyMap = (Map) execution.getVariable("lookupKeyMap"); + String serviceType = ASTERISK; + try { + serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getModelInfoServiceInstance().getServiceType(); + } catch (Exception ex) { + // keep default serviceType value + } + String vnfType = ASTERISK; + try { + for(GenericVnf vnf : gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs()) { + if(vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + vnfType = vnf.getVnfType(); + } + } + } catch (Exception ex) { + // keep default vnfType value + } + WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); + String errorCode = ASTERISK; + try { + errorCode = "" + workflowException.getErrorCode(); + } catch (Exception ex) { + // keep default errorCode value + } + String workStep = ASTERISK; + try { + workStep = workflowException.getWorkStep(); + } catch (Exception ex) { + // keep default workStep value + } + //Extract error data to be returned to WorkflowAction + execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage()); + RainyDayHandlerStatus rainyDayHandlerStatus; + String handlingCode = ""; + rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,serviceType,vnfType,errorCode,workStep); + if(rainyDayHandlerStatus==null){ + rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,ASTERISK,ASTERISK,ASTERISK,ASTERISK); + if(rainyDayHandlerStatus==null){ + handlingCode = "Abort"; + }else{ + handlingCode = rainyDayHandlerStatus.getPolicy(); + } + }else{ + handlingCode = rainyDayHandlerStatus.getPolicy(); + } + msoLogger.debug("RainyDayHandler Status Code is: " + handlingCode); + execution.setVariable("handlingCode", handlingCode); + } catch (Exception e) { + msoLogger.debug("RainyDayHandler Status Code is: Abort"); + execution.setVariable("handlingCode", "Abort"); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java new file mode 100644 index 0000000000..a212668fec --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java @@ -0,0 +1,137 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.tasks; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.util.List; +import java.util.Optional; + +import javax.persistence.Id; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.logger.MsoLogger; +import org.springframework.stereotype.Component; + +import com.google.common.base.CaseFormat; + +@Component +public class ExtractPojosForBB { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExtractPojosForBB.class); + + public T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value) + throws BBObjectNotFoundException { + + Optional result = Optional.empty(); + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + try { + ServiceInstance serviceInstance; + GenericVnf vnf; + switch (key) { + case SERVICE_INSTANCE_ID: + result = lookupObjectInList(gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), value); + break; + case GENERIC_VNF_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(serviceInstance.getVnfs(), value); + break; + case NETWORK_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(serviceInstance.getNetworks(), value); + break; + case VOLUME_GROUP_ID: + vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + result = lookupObjectInList(vnf.getVolumeGroups(), value); + break; + case VF_MODULE_ID: + vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + result = lookupObjectInList(vnf.getVfModules(), value); + break; + case ALLOTTED_RESOURCE_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(serviceInstance.getAllottedResources(), value); + break; + case CONFIGURATION_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(serviceInstance.getConfigurations(), value); + break; + case VPN_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(gBBInput.getCustomer().getVpnBindings(), value); + break; + case VPN_BONDING_LINK_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(serviceInstance.getVpnBondingLinks(),value); + break; + default: + throw new BBObjectNotFoundException(key, value); + } + } catch (BBObjectNotFoundException e) { // re-throw parent object not found + throw e; + } catch (Exception e) { // convert all other exceptions to object not found + msoLogger.warnSimple("BBObjectNotFoundException in ExtractPojosForBB", "BBObject " + key + " was not found in gBBInput using reference value: " + value); + throw new BBObjectNotFoundException(key, value); + } + + if (result.isPresent()) { + return result.get(); + } else { + throw new BBObjectNotFoundException(key, value); + } + } + + protected Optional lookupObject(Object obj, String value) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { + return findValue(obj, value); + } + + protected Optional lookupObjectInList(List list, String value) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { + Optional result = Optional.empty(); + for (Object obj : list) { + result = findValue(obj, value); + if (result.isPresent()) { + break; + } + } + return result; + + } + + protected Optional findValue(Object obj, String value) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { + for (Field field : obj.getClass().getDeclaredFields()) { + if (field.isAnnotationPresent(Id.class)) { + String fieldName = field.getName(); + fieldName = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, fieldName); + String fieldValue = (String) obj.getClass().getMethod("get" + fieldName).invoke(obj); + if (fieldValue.equals(value)) { + return Optional.of((T)obj); + } + } + } + + return Optional.empty(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java new file mode 100644 index 0000000000..9feee14640 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java @@ -0,0 +1,182 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.appc; + +import java.util.HashMap; +import java.util.List; +import java.util.Optional; + +import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.Status; +import org.onap.so.bpmn.appc.payload.PayloadClient; +import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.client.appc.ApplicationControllerSupport.StatusCategory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + + +public class ApplicationControllerAction { + protected ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator(); + private String errorCode = "1002"; + private String errorMessage = "Unable to reach App C Servers"; + private static Logger logger = LoggerFactory.getLogger(ApplicationControllerAction.class); + + public void runAppCCommand(Action action, String msoRequestId, String vnfId, Optional payload, HashMap payloadInfo, String controllerType){ + Status appCStatus = null; + try{ + String vnfName = payloadInfo.getOrDefault("vnfName", ""); + String aicIdentity = payloadInfo.getOrDefault("vnfName",""); + String vnfHostIpAddress = payloadInfo.getOrDefault("vnfHostIpAddress",""); + String vmIdList = payloadInfo.getOrDefault("vmIdList", ""); + String vserverIdList = payloadInfo.getOrDefault("vserverIdList", ""); + String identityUrl = payloadInfo.getOrDefault("identityUrl", ""); + switch(action){ + case ResumeTraffic: + appCStatus = resumeTrafficAction(msoRequestId, vnfId, vnfName, controllerType); + break; + case Start: + case Stop: + appCStatus = startStopAction(action, msoRequestId, vnfId, aicIdentity, controllerType); + break; + case Unlock: + case Lock: + appCStatus = client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), Optional.empty(), controllerType); + break; + case QuiesceTraffic: + appCStatus = quiesceTrafficAction(msoRequestId, vnfId, payload, vnfName, controllerType); + break; + case HealthCheck: + appCStatus = healthCheckAction(msoRequestId, vnfId, vnfName, vnfHostIpAddress, controllerType); + break; + case Snapshot: + String vmIds = JsonUtils.getJsonValue(vmIdList, "vmIds"); + String vserverIds = JsonUtils.getJsonValue(vserverIdList, "vserverIds"); + String vmId = ""; + String vserverId = ""; + ObjectMapper mapper = new ObjectMapper(); + List vmIdJsonList = mapper.readValue(vmIds, new TypeReference>(){}); + List vserverIdJsonList = mapper.readValue(vserverIds, new TypeReference>(){}); + int i = 0; + while(i < vmIdJsonList.size()){ + vmId = vmIdJsonList.get(i); + vserverId = vserverIdJsonList.get(i); + Optional vserverIdString = Optional.of(vserverId); + appCStatus = snapshotAction(msoRequestId, vnfId, vmId, vserverIdString, identityUrl, controllerType); + i++; + } + break; + case ConfigModify: + case ConfigScaleOut: + appCStatus = payloadAction(action, msoRequestId, vnfId, payload, controllerType); + break; + case UpgradePreCheck: + case UpgradePostCheck: + case UpgradeSoftware: + case UpgradeBackup: + appCStatus = upgradeAction(action,msoRequestId, vnfId, payload, vnfName, controllerType); + break; + default: + errorMessage = "Unable to idenify Action request for AppCClient"; + break; + } + if(appCStatus != null){ + errorCode = Integer.toString(appCStatus.getCode()); + errorMessage = appCStatus.getMessage(); + + } + if(ApplicationControllerSupport.getCategoryOf(appCStatus).equals(StatusCategory.NORMAL)){ + errorCode = "0"; + } + } + catch(JsonProcessingException e){ + logger.error("Incorrect Payload format for action request: {}", action.toString(),e); + errorMessage = e.getMessage(); + } + catch(ApplicationControllerOrchestratorException e){ + logger.error("Error building Appc request: {}",e.getMessage(), e); + errorCode = "1002"; + errorMessage = e.getMessage(); + } + catch (NoSuchMethodError e) { + logger.error( "Error building Appc request: {}", e.getMessage(), e); + errorMessage = e.getMessage(); + } + catch(Exception e){ + logger.error("Error building Appc request: {}", e.getMessage(), e); + errorMessage = e.getMessage(); + } + } + + private Status payloadAction(Action action, String msoRequestId, String vnfId, Optional payload, String controllerType) throws JsonProcessingException, IllegalArgumentException,ApplicationControllerOrchestratorException{ + if(!(payload.isPresent())){ + throw new IllegalArgumentException("Payload is not present for " + action.toString()); + } + return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); + } + + private Status quiesceTrafficAction(String msoRequestId, String vnfId, Optional payload, String vnfName, String controllerType) throws JsonProcessingException, IllegalArgumentException,ApplicationControllerOrchestratorException{ + if(!(payload.isPresent())){ + throw new IllegalArgumentException("Payload is not present for " + Action.QuiesceTraffic.toString()); + } + payload = PayloadClient.quiesceTrafficFormat(payload, vnfName); + return client.vnfCommand(Action.QuiesceTraffic, msoRequestId, vnfId, Optional.empty(), payload, controllerType); + } + + private Status upgradeAction(Action action, String msoRequestId, String vnfId, Optional payload, String vnfName, String controllerType) throws JsonProcessingException, IllegalArgumentException,ApplicationControllerOrchestratorException{ + if(!(payload.isPresent())){ + throw new IllegalArgumentException("Payload is not present for " + action.toString()); + } + payload = PayloadClient.upgradeFormat(payload, vnfName); + return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); + } + + private Status resumeTrafficAction(String msoRequestId, String vnfId, String vnfName, String controllerType)throws JsonProcessingException, ApplicationControllerOrchestratorException{ + Optional payload = PayloadClient.resumeTrafficFormat(vnfName); + return client.vnfCommand(Action.ResumeTraffic, msoRequestId, vnfId, Optional.empty(), payload, controllerType); + } + + private Status startStopAction(Action action, String msoRequestId, String vnfId, String aicIdentity, String controllerType)throws JsonProcessingException, ApplicationControllerOrchestratorException{ + Optional payload = PayloadClient.startStopFormat(aicIdentity); + return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); + } + + private Status healthCheckAction(String msoRequestId, String vnfId, String vnfName, String vnfHostIpAddress, String controllerType)throws JsonProcessingException, ApplicationControllerOrchestratorException{ + Optional payload = PayloadClient.healthCheckFormat(vnfName, vnfHostIpAddress); + return client.vnfCommand(Action.HealthCheck, msoRequestId, vnfId, Optional.empty(), payload, controllerType); + } + + private Status snapshotAction(String msoRequestId, String vnfId, String vmId, Optional vserverId, String identityUrl, String controllerType) throws JsonProcessingException, ApplicationControllerOrchestratorException{ + Optional payload = PayloadClient.snapshotFormat(vmId, identityUrl); + return client.vnfCommand(Action.Snapshot, msoRequestId, vnfId, vserverId, payload, controllerType); + } + + public String getErrorMessage(){ + return errorMessage; + } + + public String getErrorCode(){ + return errorCode; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerCallback.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerCallback.java new file mode 100644 index 0000000000..cb3f144cd1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerCallback.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.appc; + +import org.onap.appc.client.lcm.api.ResponseHandler; +import org.onap.appc.client.lcm.exceptions.AppcClientException; + +public class ApplicationControllerCallback implements ResponseHandler { + + @Override + public void onResponse(T response) { + + + } + + @Override + public void onException(AppcClientException exception) { + + + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java new file mode 100644 index 0000000000..f87ec91440 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java @@ -0,0 +1,206 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.appc; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.time.Instant; +import java.util.Properties; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.onap.appc.client.lcm.api.AppcClientServiceFactoryProvider; +import org.onap.appc.client.lcm.api.AppcLifeCycleManagerServiceFactory; +import org.onap.appc.client.lcm.api.ApplicationContext; +import org.onap.appc.client.lcm.api.LifeCycleManagerStateful; +import org.onap.appc.client.lcm.exceptions.AppcClientException; +import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.ActionIdentifiers; +import org.onap.appc.client.lcm.model.CommonHeader; +import org.onap.appc.client.lcm.model.Flags; +import org.onap.appc.client.lcm.model.Flags.Force; +import org.onap.appc.client.lcm.model.Flags.Mode; +import org.onap.appc.client.lcm.model.Payload; +import org.onap.appc.client.lcm.model.Status; +import org.onap.appc.client.lcm.model.ZULU; + +public class ApplicationControllerClient { + + public static final String DEFAULT_CONTROLLER_TYPE = "APPC"; + + private static final String CLIENT_NAME = "MSO"; + + private static final String API_VER = "2.00"; + private static final String ORIGINATOR_ID = "MSO"; + private static final int FLAGS_TTL = 65000; + private static Logger logger = LoggerFactory.getLogger(ApplicationControllerClient.class); + + private ApplicationControllerSupport appCSupport; + + // APPC gave us an API where the controllerType is configured in the + // client object, which is not what we asked for. We asked for an API + // in which the client would have additional methods that could take + // the controllerType as a parameter, so that we would not need to + // maintain multiple client objects. This map should be removed when + // the (hopefully short-term) controllerType becomes obsolete. + + private final String controllerType; + + private static ConcurrentHashMap appCClients = new ConcurrentHashMap<>(); + + /** + * Creates an ApplicationControllerClient for communication with APP-C. + */ + public ApplicationControllerClient() { + this(DEFAULT_CONTROLLER_TYPE); + } + + /** + * Creates an ApplicationControllerClient for the specified controller type. + * @param controllerType the controller type: "appc" or "sdnc". + */ + public ApplicationControllerClient(String controllerType) { + if (controllerType == null) { + controllerType = DEFAULT_CONTROLLER_TYPE; + } + this.controllerType = controllerType.toUpperCase(); + appCSupport = new ApplicationControllerSupport(); + } + + /** + * Gets the controller type. + * @return the controllertype + */ + public String getControllerType() { + return controllerType; + } + + /** + * Returns the AppC client object associated with this ApplicationControllerClient. + * AppC client objects are shared objects. One is created if it does not exist. + * @return the client object, or null if creation failed + */ + public LifeCycleManagerStateful getAppCClient() { + return appCClients.computeIfAbsent(controllerType, k -> createAppCClient(k)); + } + + protected LifeCycleManagerStateful createAppCClient(String controllerType) { + try { + if (controllerType == null) { + controllerType = DEFAULT_CONTROLLER_TYPE; + } + controllerType = controllerType.toUpperCase(); + return AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class) + .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType)); + } catch (AppcClientException e) { + logger.error("Error in getting LifeCycleManagerStateful: {}",e.getMessage(), e); + // This null value will cause NullPointerException when used later. + // Error handling could certainly be improved here. + return null; + } + } + + public Status runCommand(Action action, org.onap.appc.client.lcm.model.ActionIdentifiers actionIdentifiers, + org.onap.appc.client.lcm.model.Payload payload, String requestID) + throws ApplicationControllerOrchestratorException { + Object requestObject; + requestObject = createRequest(action, actionIdentifiers, payload, requestID); + appCSupport.logLCMMessage(requestObject); + LifeCycleManagerStateful client = getAppCClient(); + Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, false); + try { + Object response = lcmMethod.invoke(client, requestObject); + return appCSupport.getStatusFromGenericResponse(response); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + throw new RuntimeException(String.format("%s : %s", "Unable to invoke action", action.toString()), e); + } + } + + protected Properties getLCMProperties() { + return getLCMProperties("appc"); + } + + protected Properties getLCMProperties(String controllerType) { + Properties properties = new Properties(); + + properties.put("topic.read", UrnPropertiesReader.getVariable("appc.client.topic.read.name")); + properties.put("topic.write", UrnPropertiesReader.getVariable("appc.client.topic.write")); + properties.put("SDNC-topic.read", UrnPropertiesReader.getVariable("appc.client.topic.sdnc.read")); + properties.put("SDNC-topic.write", UrnPropertiesReader.getVariable("appc.client.topic.sdnc.write")); + properties.put("topic.read.timeout", UrnPropertiesReader.getVariable("appc.client.topic.read.timeout")); + properties.put("client.response.timeout", UrnPropertiesReader.getVariable("appc.client.response.timeout")); + properties.put("poolMembers", UrnPropertiesReader.getVariable("appc.client.poolMembers")); + properties.put("controllerType", controllerType); + properties.put("client.key", UrnPropertiesReader.getVariable("appc.client.key")); + properties.put("client.secret", UrnPropertiesReader.getVariable("appc.client.secret")); + properties.put("client.name", CLIENT_NAME); + properties.put("service", UrnPropertiesReader.getVariable("appc.client.service")); + return properties; + } + + public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId) { + Object requestObject = appCSupport.getInput(action.name()); + try { + CommonHeader commonHeader = buildCommonHeader(requestId); + requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject, + commonHeader); + requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action); + requestObject.getClass().getDeclaredMethod("setActionIdentifiers", ActionIdentifiers.class) + .invoke(requestObject, identifier); + if (payload != null) { + requestObject.getClass().getDeclaredMethod("setPayload", Payload.class).invoke(requestObject, payload); + } + } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { + logger.error("Error building Appc request", e); + } + return requestObject; + } + + private CommonHeader buildCommonHeader(String requestId) { + CommonHeader commonHeader = new CommonHeader(); + commonHeader.setApiVer(API_VER); + commonHeader.setOriginatorId(ORIGINATOR_ID); + commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId); + commonHeader.setSubRequestId(requestId); + Flags flags = new Flags(); + String flagsMode = "NORMAL"; + Mode mode = Mode.valueOf(flagsMode); + flags.setMode(mode); + String flagsForce = "FALSE"; + Force force = Force.valueOf(flagsForce); + flags.setForce(force); + flags.setTtl(FLAGS_TTL); + commonHeader.setFlags(flags); + Instant timestamp = Instant.now(); + ZULU zulu = new ZULU(timestamp.toString()); + commonHeader.setTimestamp(zulu); + return commonHeader; + } + + public Flags createRequestFlags() { + Flags flags = new Flags(); + flags.setTtl(6000); + return flags; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClientV2.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClientV2.java new file mode 100644 index 0000000000..d4599a5248 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClientV2.java @@ -0,0 +1,154 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.appc; + +import org.onap.appc.client.lcm.api.AppcClientServiceFactoryProvider; +import org.onap.appc.client.lcm.api.AppcLifeCycleManagerServiceFactory; +import org.onap.appc.client.lcm.api.ApplicationContext; +import org.onap.appc.client.lcm.api.LifeCycleManagerStateful; +import org.onap.appc.client.lcm.exceptions.AppcClientException; +import org.onap.appc.client.lcm.model.*; +import org.onap.appc.client.lcm.model.Flags.Force; +import org.onap.appc.client.lcm.model.Flags.Mode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.time.Instant; +import java.util.Properties; +import java.util.UUID; + +@Component +@Deprecated +public class ApplicationControllerClientV2 { + + private static final String CLIENT_NAME = "MSO"; + private static final String API_VER = "2.00"; + private static final String ORIGINATOR_ID = "MSO"; + private static final int FLAGS_TTL = 65000; + private static Logger logger = LoggerFactory.getLogger(ApplicationControllerClientV2.class); + + //@Autowired + ApplicationControllerConfiguration applicationControllerConfiguration; + + //@Autowired + private ApplicationControllerSupport appCSupport; + + private static LifeCycleManagerStateful client; + + //@PostConstruct + public void buildClient() { + client = this.getAppCClient(""); + } + + //@PostConstruct + public void buildClient(String controllerType) { + client = this.getAppCClient(controllerType); + } + + public Status runCommand(Action action, ActionIdentifiers actionIdentifiers, Payload payload, String requestID) + throws ApplicationControllerOrchestratorException { + Object requestObject; + requestObject = createRequest(action, actionIdentifiers, payload, requestID); + appCSupport.logLCMMessage(requestObject); + Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, false); + try { + Object response = lcmMethod.invoke(client, requestObject); + return appCSupport.getStatusFromGenericResponse(response); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + throw new RuntimeException(String.format("%s : %s", "Unable to invoke action", action.toString()), e); + } + } + + public LifeCycleManagerStateful getAppCClient(String controllerType) { + if (client == null) + try { + client = AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class) + .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType)); + } catch (AppcClientException e) { + logger.error("Error in getting LifeCycleManagerStateful Client", e); + } + return client; + } + + protected Properties getLCMProperties(String controllerType) { + Properties properties = new Properties(); + properties.put("topic.read", applicationControllerConfiguration.getReadTopic()); + properties.put("topic.read.timeout", applicationControllerConfiguration.getReadTimeout()); + properties.put("client.response.timeout", applicationControllerConfiguration.getResponseTimeout()); + properties.put("topic.write", applicationControllerConfiguration.getWrite()); + properties.put("poolMembers", applicationControllerConfiguration.getPoolMembers()); + properties.put("client.key", applicationControllerConfiguration.getClientKey()); + properties.put("client.secret", applicationControllerConfiguration.getClientSecret()); + properties.put("client.name", CLIENT_NAME); + properties.put("service", applicationControllerConfiguration.getService()); + return properties; + } + + public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId) { + Object requestObject = appCSupport.getInput(action.name()); + try { + CommonHeader commonHeader = buildCommonHeader(requestId); + requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject, + commonHeader); + requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action); + requestObject.getClass().getDeclaredMethod("setActionIdentifiers", ActionIdentifiers.class) + .invoke(requestObject, identifier); + if (payload != null) { + requestObject.getClass().getDeclaredMethod("setPayload", Payload.class).invoke(requestObject, payload); + } + } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { + logger.error("Error building Appc request", e); + } + return requestObject; + } + + private CommonHeader buildCommonHeader(String requestId) { + CommonHeader commonHeader = new CommonHeader(); + commonHeader.setApiVer(API_VER); + commonHeader.setOriginatorId(ORIGINATOR_ID); + commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId); + commonHeader.setSubRequestId(requestId); + Flags flags = new Flags(); + String flagsMode = "NORMAL"; + Mode mode = Mode.valueOf(flagsMode); + flags.setMode(mode); + String flagsForce = "FALSE"; + Force force = Force.valueOf(flagsForce); + flags.setForce(force); + flags.setTtl(FLAGS_TTL); + commonHeader.setFlags(flags); + Instant timestamp = Instant.now(); + ZULU zulu = new ZULU(timestamp.toString()); + commonHeader.setTimestamp(zulu); + return commonHeader; + } + + public Flags createRequestFlags() { + Flags flags = new Flags(); + flags.setTtl(6000); + return flags; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java new file mode 100644 index 0000000000..430767f24a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java @@ -0,0 +1,85 @@ +/*- + * ============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.client.appc; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Service; + +@Configuration +public class ApplicationControllerConfiguration { + @Value("${appc.client.topic.read.name}") + private String readTopic; + + @Value("${appc.client.topic.read.timeout}") + private String readTimeout; + + @Value("${appc.client.response.timeout}") + private String responseTimeout; + + @Value("${appc.client.topic.write}") + private String write; + + @Value("${appc.client.poolMembers}") + private String poolMembers; + + @Value("${appc.client.key}") + private String clientKey; + + @Value("${appc.client.secret}") + private String clientSecret; + + @Value("${appc.client.service}") + private String service; + + public String getClientKey() { + return clientKey; + } + + public String getClientSecret() { + return clientSecret; + } + + public String getPoolMembers() { + return poolMembers; + } + + public String getReadTimeout() { + return readTimeout; + } + + public String getResponseTimeout() { + return responseTimeout; + } + + public String getReadTopic() { + return readTopic; + } + + public String getService() { + return service; + } + + public String getWrite() { + return write; + } +} + diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestrator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestrator.java new file mode 100644 index 0000000000..84e0f93294 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestrator.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.client.appc; + +import java.util.Optional; + +import org.onap.so.client.appc.ApplicationControllerSupport.StatusCategory; + +import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.ActionIdentifiers; +import org.onap.appc.client.lcm.model.Payload; +import org.onap.appc.client.lcm.model.Status; + +public class ApplicationControllerOrchestrator { + + public Status vnfCommand(Action action, String requestId, String vnfId, Optional vserverId, Optional request, String controllerType) throws ApplicationControllerOrchestratorException { + ApplicationControllerClient client = new ApplicationControllerClient(controllerType); + Status status; + ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); + actionIdentifiers.setVnfId(vnfId); + if (vserverId.isPresent()) { + actionIdentifiers.setVserverId(vserverId.get()); + } + Payload payload = null; + if (request.isPresent()) { + payload = new Payload(request.get()); + } + status = client.runCommand(action, actionIdentifiers, payload, requestId); + if (ApplicationControllerSupport.getCategoryOf(status).equals(StatusCategory.ERROR)) { + throw new ApplicationControllerOrchestratorException(status.getMessage(), status.getCode()); + } else { + return status; + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestratorException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestratorException.java new file mode 100644 index 0000000000..2532e485ed --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestratorException.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.client.appc; + +public class ApplicationControllerOrchestratorException extends Exception { + + private final int appcCode; + + public ApplicationControllerOrchestratorException(String message, int code) { + super(message); + appcCode = code; + } + + public int getAppcCode() + { + return appcCode; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java new file mode 100644 index 0000000000..ef8749ece9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java @@ -0,0 +1,215 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.appc; + +import java.beans.BeanInfo; +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.springframework.stereotype.Component; + +import org.onap.appc.client.lcm.api.LifeCycleManagerStateful; +import org.onap.appc.client.lcm.api.ResponseHandler; +import org.onap.appc.client.lcm.model.Status; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import org.springframework.stereotype.Service; + +public class ApplicationControllerSupport { + + private static final int ACCEPT_SERIES = 100; + private static final int ERROR_SERIES = 200; + private static final int REJECT_SERIES = 300; + private static final int SUCCESS_SERIES = 400; + private static final int SUCCESS_STATUS = SUCCESS_SERIES; + private static final int PARTIAL_SERIES = 500; + private static final int PARTIAL_SUCCESS_STATUS = PARTIAL_SERIES; + private static final int PARTIAL_FAILURE_STATUS = PARTIAL_SERIES + 1; + + private static Logger logger = LoggerFactory.getLogger(ApplicationControllerSupport.class); + private String lcmModelPackage = "org.onap.appc.client.lcm.model"; + + /** + * @param action + * @return + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + */ + public Object getInput(String action) { + try { + return getInputClass(action).newInstance(); + } catch (IllegalAccessException | InstantiationException e) { + throw new RuntimeException( + String.format("%s : %s", "Unable to instantiate viable LCM Kit input class for action", action), e); + } + } + + /** + * @param action + * @return + * @throws ClassNotFoundException + */ + public Method getAPIMethod(String action, LifeCycleManagerStateful lcmStateful, boolean async) { + Method[] methods = lcmStateful.getClass().getMethods(); + for (Method method : methods) { + if (method.getName().equalsIgnoreCase(action)) { + Class[] methodParameterTypes = method.getParameterTypes(); + if (methodParameterTypes.length > 0) { + if (getInputClass(action).equals(methodParameterTypes[0])) { + if (async) { + if (methodParameterTypes.length == 2 + && ResponseHandler.class.isAssignableFrom(methodParameterTypes[1])) { + return method; + } + } else if (methodParameterTypes.length == 1) { + return method; + } + } + } + } + } + throw new RuntimeException(String.format("%s : %s, async=%b", + "Unable to derive viable LCM Kit API method for action", action, async)); + } + + public Status getStatusFromGenericResponse(Object response) { + Method statusReader = getBeanPropertyMethodFor(response.getClass(), "status", false); + if (statusReader != null) { + try { + return (Status) statusReader.invoke(response); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + logger.error("Unable to obtain status from LCM Kit response", e); + } + } + return new Status(); + } + + public static StatusCategory getCategoryOf(Status status) { + int codeSeries = status.getCode() - (status.getCode() % 100); + switch (codeSeries) { + case ACCEPT_SERIES: + return StatusCategory.NORMAL; + case ERROR_SERIES: + case REJECT_SERIES: + return StatusCategory.ERROR; + case SUCCESS_SERIES: + return status.getCode() == SUCCESS_STATUS ? StatusCategory.NORMAL : StatusCategory.ERROR; + case PARTIAL_SERIES: + switch (status.getCode()) { + case PARTIAL_SUCCESS_STATUS: + return StatusCategory.NORMAL; + case PARTIAL_FAILURE_STATUS: + return StatusCategory.ERROR; + default: + return StatusCategory.WARNING; + } + default: + return StatusCategory.WARNING; + } + } + + public static boolean getFinalityOf(Status status) { + int codeSeries = status.getCode() - (status.getCode() % 100); + switch (codeSeries) { + case ACCEPT_SERIES: + case PARTIAL_SERIES: + return false; + case ERROR_SERIES: + case REJECT_SERIES: + case SUCCESS_SERIES: + return true; + default: + return true; + } + } + + private Method getBeanPropertyMethodFor(Class clazz, String propertyName, boolean isWriter) { + BeanInfo beanInfo; + try { + beanInfo = Introspector.getBeanInfo(clazz, Object.class); + } catch (IntrospectionException e) { + throw new RuntimeException( + String.format("Unable to produce bean property method for class : %s, property : %s, writer=%b", + clazz.getName(), propertyName, isWriter), + e); + } + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { + if (propertyDescriptor.getName().equals(propertyName)) { + return isWriter ? propertyDescriptor.getWriteMethod() : propertyDescriptor.getReadMethod(); + } + } + throw new RuntimeException( + String.format("Unable to produce bean property method for class : %s, property : %s, writer=%b", + clazz.getName(), propertyName, isWriter)); + } + + /** + * @param action + * @return + * @throws ClassNotFoundException + */ + private Class getInputClass(String action) { + try { + return Class.forName(lcmModelPackage + '.' + action + "Input"); + } catch (ClassNotFoundException e) { + throw new RuntimeException(String.format("%s : %s using package : %s", + "Unable to identify viable LCM Kit input class for action", action, lcmModelPackage), e); + } + } + + public enum StatusCategory { + NORMAL("normal"), WARNING("warning"), ERROR("error"); + + private final String category; + + private StatusCategory(final String category) { + this.category = category; + } + + @Override + public String toString() { + return category; + } + } + + public void logLCMMessage(Object message) { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.setSerializationInclusion(Include.NON_NULL); + ObjectWriter writer = objectMapper.writerWithDefaultPrettyPrinter(); + String inputAsJSON; + try { + inputAsJSON = writer.writeValueAsString(message); + logger.info("LCM Kit input message follows: {}" , inputAsJSON); + } catch (JsonProcessingException e) { + logger.error("Error in logging LCM Message", e); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBean.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBean.java new file mode 100644 index 0000000000..fff818f09b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBean.java @@ -0,0 +1,40 @@ +/*- + * ============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.client.avpn.dmaap.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class AVPNDmaapBean { + + @JsonProperty("asyncRequestStatus") + private AsyncRequestStatus asyncRequestStatus; + + public AsyncRequestStatus getAsyncRequestStatus() { + return asyncRequestStatus; + } + + public void setAsyncRequestStatus(AsyncRequestStatus asyncRequestStatus) { + this.asyncRequestStatus = asyncRequestStatus; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AsyncRequestStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AsyncRequestStatus.java new file mode 100644 index 0000000000..13206e8c92 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AsyncRequestStatus.java @@ -0,0 +1,119 @@ +/*- + * ============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.client.avpn.dmaap.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName(value = "asyncRequestStatus") +public class AsyncRequestStatus { + + @JsonProperty("requestId") + private String requestId; + @JsonProperty("clientSource") + private String clientSource; + @JsonProperty("correlator") + private String correlator; + @JsonProperty("instanceReferences") + private InstanceReferences instanceReferences; + @JsonProperty("startTime") + private String startTime; + @JsonProperty("finishTime") + private String finishTime; + @JsonProperty("requestScope") + private String requestScope; + @JsonProperty("requestType") + private String requestType; + @JsonProperty("requestStatus") + private RequestStatus requestStatus; + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public String getClientSource() { + return clientSource; + } + + public void setClientSource(String clientSource) { + this.clientSource = clientSource; + } + + public String getCorrelator() { + return correlator; + } + + public void setCorrelator(String correlator) { + this.correlator = correlator; + } + + public InstanceReferences getInstanceReferences() { + return instanceReferences; + } + + public void setInstanceReferences(InstanceReferences instanceReferences) { + this.instanceReferences = instanceReferences; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getFinishTime() { + return finishTime; + } + + public void setFinishTime(String finishTime) { + this.finishTime = finishTime; + } + + 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; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/InstanceReferences.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/InstanceReferences.java new file mode 100644 index 0000000000..322f41bf75 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/InstanceReferences.java @@ -0,0 +1,39 @@ +/*- + * ============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.client.avpn.dmaap.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName(value = "instanceReferences") +public class InstanceReferences { + + @JsonProperty("serviceInstanceId") + private String serviceInstanceId; + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/RequestStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/RequestStatus.java new file mode 100644 index 0000000000..edc8be7bfe --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/RequestStatus.java @@ -0,0 +1,79 @@ +/*- + * ============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.client.avpn.dmaap.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName(value = "requestStatus") +public class RequestStatus { + + @JsonProperty("timestamp") + private String timestamp; + @JsonProperty("requestState") + private String requestState; + @JsonProperty("statusMessage") + private String statusMessage; + @JsonProperty("percentProgress") + private String percentProgress; + @JsonProperty("wasRolledBack") + private Boolean wasRolledBack; + + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(String timestamp) { + this.timestamp = 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 Boolean isWasRolledBack() { + return wasRolledBack; + } + + public void setWasRolledBack(Boolean wasRolledBack) { + this.wasRolledBack = wasRolledBack; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java new file mode 100644 index 0000000000..61869ca322 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.db.request; + +import java.io.IOException; +import java.net.URI; + +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpRequest; +import org.springframework.http.client.ClientHttpRequestExecution; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.http.client.ClientHttpResponse; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import uk.co.blackpepper.bowman.Client; +import uk.co.blackpepper.bowman.ClientFactory; +import uk.co.blackpepper.bowman.Configuration; +import uk.co.blackpepper.bowman.RestTemplateConfigurer; + +@Component("RequestDbClient") +public class RequestsDbClient { + + private Client infraActiveRequestClient; + + @Value("${mso.adapters.db.spring.endpoint}") + private String endpoint; + + @Value("${mso.db.auth}") + private String msoAdaptersAuth; + + public RequestsDbClient() { + ClientFactory clientFactory = Configuration.builder().setRestTemplateConfigurer(new RestTemplateConfigurer() { + + public void configure(RestTemplate restTemplate) { + + restTemplate.getInterceptors().add(new ClientHttpRequestInterceptor() { + + public ClientHttpResponse intercept(HttpRequest request, byte[] body, + ClientHttpRequestExecution execution) throws IOException { + + request.getHeaders().add("Authorization", msoAdaptersAuth); + return execution.execute(request, body); + } + }); + } + }).build().buildClientFactory(); + infraActiveRequestClient = clientFactory.create(InfraActiveRequests.class); + + } + + public InfraActiveRequests getInfraActiveRequestbyRequestId(String requestId) { + return this.getSingleInfraActiveRequests(this.getUri(endpoint + "/infraActiveRequests/" + requestId)); + } + + protected InfraActiveRequests getSingleInfraActiveRequests(URI uri) { + return infraActiveRequestClient.get(uri); + } + + public void updateInfraActiveRequests(InfraActiveRequests request) { + infraActiveRequestClient.put(request); + } + + protected URI getUri(String uri) { + return URI.create(uri); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DefaultDmaapPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DefaultDmaapPropertiesImpl.java new file mode 100644 index 0000000000..c5f08d4809 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DefaultDmaapPropertiesImpl.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.dmaapproperties; + +import org.onap.so.client.dmaap.DmaapProperties; + +import java.util.Map; + +public class DefaultDmaapPropertiesImpl implements DmaapProperties { + + private final Map properties; + + public DefaultDmaapPropertiesImpl() { + this.properties = new DmaapPropertiesMap(); + } + + @Override + public Map getProperties() { + return properties; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java new file mode 100644 index 0000000000..af7c608fee --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java @@ -0,0 +1,115 @@ +/*- + * ============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.client.dmaapproperties; + +import javax.inject.Provider; + +import org.onap.so.client.avpn.dmaap.beans.AVPNDmaapBean; +import org.onap.so.client.avpn.dmaap.beans.AsyncRequestStatus; +import org.onap.so.client.avpn.dmaap.beans.InstanceReferences; +import org.onap.so.client.avpn.dmaap.beans.RequestStatus; +import org.onap.so.client.exception.MapperException; +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 DmaapPropertiesClient { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DmaapPropertiesClient.class); + + @Autowired + private Provider dmaapPublisher; + + protected AVPNDmaapBean buildRequestJson(String requestId, String clientSource, String correlator, String serviceInstanceId, String startTime, String finishTime, + String requestScope, String requestType, String timestamp, String requestState, String statusMessage, String percentProgress, Boolean wasRolledBack) { + + RequestStatus requestStatus = buildRequestStatus(timestamp, requestState, statusMessage, percentProgress, wasRolledBack); + + InstanceReferences instanceReferences = buildInstanceReferences(serviceInstanceId); + + AsyncRequestStatus asyncRequestStatus = buildAsyncRequestStatus(requestId, clientSource, correlator, startTime, finishTime, + requestScope, requestType, requestStatus, instanceReferences); + + AVPNDmaapBean dmaapBean = new AVPNDmaapBean(); + dmaapBean.setAsyncRequestStatus(asyncRequestStatus); + + return dmaapBean; + } + + private String jsonToString(AVPNDmaapBean dmaapBean) throws JsonProcessingException, MapperException { + try { + return new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(dmaapBean); + } catch (JsonProcessingException e) { + msoLogger.error(e); + throw new MapperException(e.getMessage()); + } + } + + private AsyncRequestStatus buildAsyncRequestStatus(String requestId, String clientSource, String correlator, String startTime, + String finishTime, String requestScope, String requestType, + RequestStatus requestStatus, InstanceReferences instanceReferences) { + + AsyncRequestStatus asyncRequestStatus = new AsyncRequestStatus(); + asyncRequestStatus.setRequestId(requestId); + asyncRequestStatus.setClientSource(clientSource); + asyncRequestStatus.setCorrelator(correlator); + asyncRequestStatus.setStartTime(startTime); + asyncRequestStatus.setFinishTime(finishTime); + asyncRequestStatus.setRequestScope(requestScope); + asyncRequestStatus.setRequestType(requestType); + asyncRequestStatus.setInstanceReferences(instanceReferences); + asyncRequestStatus.setRequestStatus(requestStatus); + + return asyncRequestStatus; + } + + private InstanceReferences buildInstanceReferences(String serviceInstanceId) { + InstanceReferences instanceReferences = new InstanceReferences(); + instanceReferences.setServiceInstanceId(serviceInstanceId); + return instanceReferences; + } + + private RequestStatus buildRequestStatus(String timestamp, String requestState, String statusMessage, + String percentProgress, Boolean wasRolledBack) { + RequestStatus requestStatus = new RequestStatus(); + requestStatus.setTimestamp(timestamp); + requestStatus.setRequestState(requestState); + requestStatus.setStatusMessage(statusMessage); + requestStatus.setPercentProgress(percentProgress); + requestStatus.setWasRolledBack(wasRolledBack); + return requestStatus; + } + + public void dmaapPublishRequest(String requestId, String clientSource, String correlator, String serviceInstanceId, String startTime, + String finishTime, String requestScope, String requestType, String timestamp, String requestState, + String statusMessage, String percentProgress, Boolean wasRolledBack) throws MapperException, JsonProcessingException { + + AVPNDmaapBean bean = this.buildRequestJson(requestId, clientSource, correlator, serviceInstanceId, startTime, finishTime, + requestScope, requestType, timestamp, requestState, statusMessage, percentProgress, wasRolledBack); + + String request = jsonToString(bean); + dmaapPublisher.get().send(request); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesMap.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesMap.java new file mode 100644 index 0000000000..796ccf18b7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesMap.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.dmaapproperties; + +import org.onap.so.bpmn.core.UrnPropertiesReader; + +import java.util.HashMap; + +/** + * This class is used when Dmaap Properties are to be accessed from + * application.yaml and it delegates get calls to UrnPropertyReader class + * for reading the value from active configuration + * @param Key for Map Entry + * @param Value for Map Entry + */ +public class DmaapPropertiesMap extends HashMap { + + @Override + public V get(Object key) { + return (V)UrnPropertiesReader.getVariable((String)key); + } + + @Override + public V getOrDefault(Object key, V defaultValue) { + String str = UrnPropertiesReader.getVariable((String)key); + return str ==null ? defaultValue : (V)str; + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java new file mode 100644 index 0000000000..382852886e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.client.dmaapproperties; + +import java.io.IOException; +import java.util.Optional; + +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.dmaap.DmaapPublisher; + +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +@Component +@Scope("prototype") +public class GlobalDmaapPublisher extends DmaapPublisher { + + + public GlobalDmaapPublisher() throws IOException { + super(); + } + + @Override + public String getUserName() { + + return UrnPropertiesReader.getVariable("mso.global.dmaap.username"); + } + + + + @Override + public String getPassword() { + + return UrnPropertiesReader.getVariable("mso.global.dmaap.password"); + } + + @Override + public String getTopic() { + + return UrnPropertiesReader.getVariable("mso.global.dmaap.publisher.topic"); + } + + @Override + public Optional getHost() { + return Optional.ofNullable(UrnPropertiesReader.getVariable("mso.global.dmaap.host")); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BBObjectNotFoundException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BBObjectNotFoundException.java new file mode 100644 index 0000000000..26c8d80075 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BBObjectNotFoundException.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.client.exception; + +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; + +public class BBObjectNotFoundException extends Exception{ + private ResourceKey resourceKey; + private String resourceValue; + + public BBObjectNotFoundException() {} + + public BBObjectNotFoundException(ResourceKey resourceKey, String resourceValue) + { + super("BBObject" + resourceKey + " was not found in gBBInput using reference value: " + resourceValue); + this.resourceKey = resourceKey; + this.resourceValue = resourceValue; + } + + public ResourceKey getResourceKey() { + return resourceKey; + } + + public String getResourceValue() { + return resourceValue; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java new file mode 100644 index 0000000000..ac8ff9efe4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.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.client.exception; + +public class BadResponseException extends Exception{ + + public BadResponseException() {} + + public BadResponseException(String message) + { + super(message); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java new file mode 100644 index 0000000000..c74e81506c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.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.client.exception; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.stereotype.Component; + +@Component +public class ExceptionBuilder { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExceptionBuilder.class); + + public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception) { + String msg = "Exception in %s.%s "; + try{ + msoLogger.error(exception); + + String errorVariable = "Error%s%s"; + + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); + for (StackTraceElement traceElement : trace) { + if (!traceElement.getClassName().equals(this.getClass().getName()) && !traceElement.getClassName().equals(Thread.class.getName())) { + msg = String.format(msg, traceElement.getClassName(), traceElement.getMethodName()); + String shortClassName = traceElement.getClassName().substring(traceElement.getClassName().lastIndexOf(".") + 1); + errorVariable = String.format(errorVariable, shortClassName, traceElement.getMethodName()); + break; + } + } + + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, msg.toString()); + execution.setVariable(errorVariable, exception.getMessage()); + } catch (Exception ex){ + //log trace, allow process to complete gracefully + msoLogger.error(ex); + } + + if (exception.getMessage() != null) + msg = msg.concat(exception.getMessage()); + buildAndThrowWorkflowException(execution, errorCode, msg); + } + + public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage) { + if (execution instanceof DelegateExecutionImpl) { + buildAndThrowWorkflowException(((DelegateExecutionImpl) execution).getDelegateExecution(), errorCode, errorMessage); + } + } + + public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { + String processKey = getProcessKey(execution); + msoLogger.info("Building a WorkflowException for Subflow"); + + WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage); + execution.setVariable("WorkflowException", exception); + msoLogger.info("Outgoing WorkflowException is " + exception); + msoLogger.info("Throwing MSOWorkflowException"); + throw new BpmnError("MSOWorkflowException"); + } + + public String getProcessKey(DelegateExecution execution) { + String testKey = (String) execution.getVariable("testProcessKey"); + if (testKey != null) { + return testKey; + } + return execution.getProcessEngineServices().getRepositoryService() + .getProcessDefinition(execution.getProcessDefinitionId()).getKey(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java new file mode 100644 index 0000000000..3f3beadb92 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.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.client.exception; + +public class MapperException extends Exception{ + + public MapperException() {} + + public MapperException(String message) + { + super(message); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/OrchestrationStatusValidationException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/OrchestrationStatusValidationException.java new file mode 100644 index 0000000000..fe7b079568 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/OrchestrationStatusValidationException.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.client.exception; + +public class OrchestrationStatusValidationException extends Exception{ + public OrchestrationStatusValidationException() {} + + public OrchestrationStatusValidationException(String message) { + super(message); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java new file mode 100644 index 0000000000..b7164e327e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.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.client.restproperties; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.aai.AAIProperties; +import org.onap.so.client.aai.AAIVersion; +import org.springframework.stereotype.Component; + +@Component +public class AAIPropertiesImpl implements AAIProperties { + + public static final String MSO_MSO_KEY = "mso.msoKey"; + public static final String AAI_AUTH = "aai.auth"; + public static final String AAI_ENDPOINT = "aai.endpoint"; + private UrnPropertiesReader reader; + + @Override + public URL getEndpoint() throws MalformedURLException { + return new URL(reader.getVariable(AAI_ENDPOINT)); + } + + @Override + public String getSystemName() { + return "MSO"; + } + + @Override + public AAIVersion getDefaultVersion() { + return AAIVersion.LATEST; + } + + @Override + public String getAuth() { + return reader.getVariable(AAI_AUTH); + } + + @Override + public String getKey() { + return reader.getVariable(MSO_MSO_KEY); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AaiPropertiesConfiguration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AaiPropertiesConfiguration.java new file mode 100644 index 0000000000..b7582922b1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AaiPropertiesConfiguration.java @@ -0,0 +1,42 @@ +/*- + * ============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.client.restproperties; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +@Service +public class AaiPropertiesConfiguration { + + @Value("${aai.endpoint}") + private String endpoint; + + @Value("${aai.auth}") + private String auth; + + public String getEndpoint() { + return endpoint; + } + + public String getAuth() { + return auth; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/PolicyRestPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/PolicyRestPropertiesImpl.java new file mode 100644 index 0000000000..1e43adceba --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/PolicyRestPropertiesImpl.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.restproperties; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.policy.PolicyRestProperties; + +public class PolicyRestPropertiesImpl implements PolicyRestProperties { + + public static final String POLICY_ENDPOINT = "policy.endpoint"; + public static final String POLICY_ENVIRONMENT = "policy.environment"; + public static final String POLICY_AUTH = "policy.auth"; + public static final String POLICY_CLIENT_AUTH = "policy.client.auth"; + + public PolicyRestPropertiesImpl() { + } + + @Override + public URL getEndpoint() { + try { + return new URL(UrnPropertiesReader.getVariable(POLICY_ENDPOINT)); + } catch (MalformedURLException e) { + return null; + } + } + + @Override + public String getSystemName() { + return "MSO"; + } + + public String getClientAuth() { + return UrnPropertiesReader.getVariable(POLICY_CLIENT_AUTH); + } + + public String getAuth() { + return UrnPropertiesReader.getVariable(POLICY_AUTH); + } + + public String getEnvironment() { + return UrnPropertiesReader.getVariable(POLICY_ENVIRONMENT); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/UrnPropertiesReaderWrapper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/UrnPropertiesReaderWrapper.java new file mode 100644 index 0000000000..030eff92e2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/UrnPropertiesReaderWrapper.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========================================================= + */ + +package org.onap.so.client.restproperties; + +import org.onap.so.bpmn.core.UrnPropertiesReader; + +public class UrnPropertiesReaderWrapper { + + public String getVariable(String key) { + return UrnPropertiesReader.getVariable(key); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/PayloadClient.java deleted file mode 100644 index 5a0de6f5e9..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/PayloadClient.java +++ /dev/null @@ -1,109 +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.bpmn.appc.payload; - -import org.openecomp.mso.bpmn.appc.payload.beans.*; - -import java.util.Optional; - -import com.fasterxml.jackson.core.JsonProcessingException; -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class PayloadClient { - - protected static ObjectMapper mapper = new ObjectMapper(); - - - public static Optional upgradeFormat(Optional payload, String vnfName) throws JsonProcessingException{ - UpgradeAction payloadResult = new UpgradeAction(); - ConfigurationParametersUpgrade configParams = new ConfigurationParametersUpgrade(); - String payloadString = payload.get(); - String existingSoftware = JsonUtils.getJsonValue(payloadString, "existing-software-version"); - String newSoftware = JsonUtils.getJsonValue(payloadString, "new-software-version"); - configParams.setExistingSoftwareVersion(existingSoftware); - configParams.setNewSoftwareVersion(newSoftware); - configParams.setVnfName(vnfName); - payloadResult.setConfigurationParameters(configParams); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - - public static Optional resumeTrafficFormat(String vnfName) throws JsonProcessingException{ - ResumeTrafficAction payloadResult = new ResumeTrafficAction(); - ConfigurationParametersResumeTraffic configParams = new ConfigurationParametersResumeTraffic(); - configParams.setVnfName(vnfName); - payloadResult.setConfigurationParameters(configParams); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - - public static Optional quiesceTrafficFormat(Optional payload, String vnfName) throws JsonProcessingException{ - QuiesceTrafficAction payloadResult = new QuiesceTrafficAction(); - ConfigurationParametersQuiesce configParams = new ConfigurationParametersQuiesce(); - String payloadString = payload.get(); - String operationsTimeout = JsonUtils.getJsonValue(payloadString, "operations-timeout"); - configParams.setOperationsTimeout(operationsTimeout); - configParams.setVnfName(vnfName); - payloadResult.setConfigurationParameters(configParams); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - - public static Optional startStopFormat(String aicIdentity) throws JsonProcessingException{ - StartStopAction payloadResult = new StartStopAction(); - payloadResult.setAICIdentity(aicIdentity); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - - public static Optional healthCheckFormat(String vnfName, String vnfHostIpAddress) throws JsonProcessingException{ - HealthCheckAction payloadResult = new HealthCheckAction(); - RequestParametersHealthCheck requestParams = new RequestParametersHealthCheck(); - ConfigurationParametersHealthCheck configParams = new ConfigurationParametersHealthCheck(); - requestParams.setVnfName(vnfName); - configParams.setVnfName(vnfName); - payloadResult.setConfigurationParameters(configParams); - payloadResult.setRequestParameters(requestParams); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - - public static Optional snapshotFormat(String vmId, String identityUrl)throws JsonProcessingException{ - SnapshotAction payloadResult = new SnapshotAction(); - payloadResult.setVmId(vmId); - payloadResult.setIdentityUrl(identityUrl); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - - /*public Optional verifySnapshotFormat(Optional payload) throws Exception, JsonProcessingException, JsonMappingException{ - final Snapshot check = mapper.readValue(payload.get(), Snapshot.class); - return Optional.of(mapper.writeValueAsString(check)); - } - - public Optional verifyUpgradeFormat(Optional payload) throws Exception, JsonProcessingException, JsonMappingException{ - final UpdateCheck check = mapper.readValue(payload.get(), UpdateCheck.class); - return Optional.of(mapper.writeValueAsString(check)); - } - - public Optional verifyQuiesceTrafficFormat(Optional payload)throws Exception, JsonProcessingException, JsonMappingException{ - final QuiesceTraffic check = mapper.readValue(payload.get(), QuiesceTraffic.class); - return Optional.of(mapper.writeValueAsString(check)); - } - */ - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigModifyAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigModifyAction.java deleted file mode 100644 index 09ad2bf439..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigModifyAction.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.bpmn.appc.payload.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"request-parameters", -"configuration-parameters" -}) -public class ConfigModifyAction { - -@JsonProperty("request-parameters") -private RequestParametersConfigModify requestParameters; -@JsonProperty("configuration-parameters") -private ConfigurationParametersConfigModify configurationParameters; - -@JsonProperty("request-parameters") -public RequestParametersConfigModify getRequestParameters() { -return requestParameters; -} - -@JsonProperty("request-parameters") -public void setRequestParameters(RequestParametersConfigModify requestParameters) { -this.requestParameters = requestParameters; -} - -@JsonProperty("configuration-parameters") -public ConfigurationParametersConfigModify getConfigurationParameters() { -return configurationParameters; -} - -@JsonProperty("configuration-parameters") -public void setConfigurationParameters(ConfigurationParametersConfigModify configurationParameters) { -this.configurationParameters = configurationParameters; -} - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java deleted file mode 100644 index dda7856168..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.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.bpmn.appc.payload.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"node0_hostname", -"node0_backup_router_address" -}) -public class ConfigurationParametersConfigModify { - -@JsonProperty("node0_hostname") -private String node0Hostname; -@JsonProperty("node0_backup_router_address") -private String node0BackupRouterAddress; - -@JsonProperty("node0_hostname") -public String getNode0Hostname() { -return node0Hostname; -} - -@JsonProperty("node0_hostname") -public void setNode0Hostname(String node0Hostname) { -this.node0Hostname = node0Hostname; -} - -@JsonProperty("node0_backup_router_address") -public String getNode0BackupRouterAddress() { -return node0BackupRouterAddress; -} - -@JsonProperty("node0_backup_router_address") -public void setNode0BackupRouterAddress(String node0BackupRouterAddress) { -this.node0BackupRouterAddress = node0BackupRouterAddress; -} -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java deleted file mode 100644 index 000b1bdbf7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.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.bpmn.appc.payload.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"vnf_name" -}) -public class ConfigurationParametersHealthCheck { - -@JsonProperty("vnf_name") -private String vnfName; - -@JsonProperty("vnf_name") -public String getVnfName() { -return vnfName; -} - -@JsonProperty("vnf_name") -public void setVnfName(String vnfName) { -this.vnfName = vnfName; -} -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java deleted file mode 100644 index e354d9ca2e..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.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.bpmn.appc.payload.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"vnf_name", -"operations_timeout" -}) -public class ConfigurationParametersQuiesce { - -@JsonProperty("vnf_name") -private String vnfName; -@JsonProperty("operations_timeout") -private String operationsTimeout; - -@JsonProperty("vnf_name") -public String getVnfName() { -return vnfName; -} - -@JsonProperty("vnf_name") -public void setVnfName(String vnfName) { -this.vnfName = vnfName; -} - -@JsonProperty("operations_timeout") -public String getOperationsTimeout() { -return operationsTimeout; -} - -@JsonProperty("operations_timeout") -public void setOperationsTimeout(String operationsTimeout) { -this.operationsTimeout = operationsTimeout; -} - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java deleted file mode 100644 index 820618e828..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.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.bpmn.appc.payload.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"vnf_name" -}) -public class ConfigurationParametersResumeTraffic { - -@JsonProperty("vnf_name") -private String vnfName; - -@JsonProperty("vnf_name") -public String getVnfName() { -return vnfName; -} - -@JsonProperty("vnf_name") -public void setVnfName(String vnfName) { -this.vnfName = vnfName; -} -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java deleted file mode 100644 index 0845e7c37d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.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.bpmn.appc.payload.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"vnf_name", -"existing-software-version", -"new-software-version" -}) -public class ConfigurationParametersUpgrade { -@JsonProperty("vnf_name") -private String vnfName; -@JsonProperty("existing-software-version") -private String existingSoftwareVersion; -@JsonProperty("new-software-version") -private String newSoftwareVersion; - -@JsonProperty("vnf_name") -public String getVnfName() { -return vnfName; -} - -@JsonProperty("vnf_name") -public void setVnfName(String vnfName) { -this.vnfName = vnfName; -} - -@JsonProperty("existing-software-version") -public String getExistingSoftwareVersion() { -return existingSoftwareVersion; -} - -@JsonProperty("existing-software-version") -public void setExistingSoftwareVersion(String existingSoftwareVersion) { -this.existingSoftwareVersion = existingSoftwareVersion; -} - -@JsonProperty("new-software-version") -public String getNewSoftwareVersion() { -return newSoftwareVersion; -} - -@JsonProperty("new-software-version") -public void setNewSoftwareVersion(String newSoftwareVersion) { -this.newSoftwareVersion = newSoftwareVersion; -} - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/HealthCheckAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/HealthCheckAction.java deleted file mode 100644 index 53408f1ead..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/HealthCheckAction.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.bpmn.appc.payload.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"request-parameters", -"configuration-parameters" -}) -public class HealthCheckAction { - -@JsonProperty("request-parameters") -private RequestParametersHealthCheck requestParameters; -@JsonProperty("configuration-parameters") -private ConfigurationParametersHealthCheck configurationParameters; - -@JsonProperty("request-parameters") -public RequestParametersHealthCheck getRequestParameters() { -return requestParameters; -} - -@JsonProperty("request-parameters") -public void setRequestParameters(RequestParametersHealthCheck requestParameters) { -this.requestParameters = requestParameters; -} - -@JsonProperty("configuration-parameters") -public ConfigurationParametersHealthCheck getConfigurationParameters() { -return configurationParameters; -} - -@JsonProperty("configuration-parameters") -public void setConfigurationParameters(ConfigurationParametersHealthCheck configurationParameters) { -this.configurationParameters = configurationParameters; -} -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/QuiesceTrafficAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/QuiesceTrafficAction.java deleted file mode 100644 index cbe8ee0b91..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/QuiesceTrafficAction.java +++ /dev/null @@ -1,46 +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.bpmn.appc.payload.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"configuration-parameters" -}) -public class QuiesceTrafficAction { - -@JsonProperty("configuration-parameters") -private ConfigurationParametersQuiesce configurationParameters; - -@JsonProperty("configuration-parameters") -public ConfigurationParametersQuiesce getConfigurationParameters() { -return configurationParameters; -} - -@JsonProperty("configuration-parameters") -public void setConfigurationParameters(ConfigurationParametersQuiesce configurationParameters) { -this.configurationParameters = configurationParameters; -} -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersConfigModify.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersConfigModify.java deleted file mode 100644 index 41b3314e7c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersConfigModify.java +++ /dev/null @@ -1,46 +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.bpmn.appc.payload.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"vnf-host-ip-address" -}) -public class RequestParametersConfigModify { - -@JsonProperty("vnf-host-ip-address") -private String vnfHostIpAddress; - -@JsonProperty("vnf-host-ip-address") -public String getVnfHostIpAddress() { -return vnfHostIpAddress; -} - -@JsonProperty("vnf-host-ip-address") -public void setVnfHostIpAddress(String vnfHostIpAddress) { -this.vnfHostIpAddress = vnfHostIpAddress; -} - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersHealthCheck.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersHealthCheck.java deleted file mode 100644 index dcdb4fb71e..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersHealthCheck.java +++ /dev/null @@ -1,47 +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.bpmn.appc.payload.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"vnf-name" -}) -public class RequestParametersHealthCheck { - -@JsonProperty("vnf-name") -private String vnfName; - - -@JsonProperty("vnf-name") -public String getVnfName() { -return vnfName; -} - -@JsonProperty("vnf-name") -public void setVnfName(String vnfName) { -this.vnfName = vnfName; -} - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ResumeTrafficAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ResumeTrafficAction.java deleted file mode 100644 index de4fe25cd7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ResumeTrafficAction.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.bpmn.appc.payload.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"configuration-parameters" -}) -public class ResumeTrafficAction { - -@JsonProperty("configuration-parameters") -private ConfigurationParametersResumeTraffic configurationParameters; - -@JsonProperty("configuration-parameters") -public ConfigurationParametersResumeTraffic getConfigurationParameters() { -return configurationParameters; -} - -@JsonProperty("configuration-parameters") -public void setConfigurationParameters(ConfigurationParametersResumeTraffic configurationParameters) { -this.configurationParameters = configurationParameters; -} -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/SnapshotAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/SnapshotAction.java deleted file mode 100644 index bb74798300..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/SnapshotAction.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.bpmn.appc.payload.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"vm-id", -"identity-url" -}) -public class SnapshotAction { - -@JsonProperty("vm-id") -private String vmId; -@JsonProperty("identity-url") -private String identityUrl; - -@JsonProperty("vm-id") -public String getVmId() { -return vmId; -} - -@JsonProperty("vm-id") -public void setVmId(String vmId) { -this.vmId = vmId; -} - -@JsonProperty("identity-url") -public String getIdentityUrl() { -return identityUrl; -} - -@JsonProperty("identity-url") -public void setIdentityUrl(String identityUrl) { -this.identityUrl = identityUrl; -} - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/StartStopAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/StartStopAction.java deleted file mode 100644 index 988c282076..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/StartStopAction.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.bpmn.appc.payload.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - " AICIdentity " -}) -public class StartStopAction { - - @JsonProperty(" AICIdentity ") - private String aICIdentity; - - @JsonProperty(" AICIdentity ") - public String getAICIdentity() { - return aICIdentity; - } - - @JsonProperty(" AICIdentity ") - public void setAICIdentity(String aICIdentity) { - this.aICIdentity = aICIdentity; - } - - public String getaICIdentity() { - return aICIdentity; - } - - public void setaICIdentity(String aICIdentity) { - this.aICIdentity = aICIdentity; - } - - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/UpgradeAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/UpgradeAction.java deleted file mode 100644 index 3486fa73ba..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/UpgradeAction.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.bpmn.appc.payload.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"configuration-parameters" -}) -public class UpgradeAction { - -@JsonProperty("configuration-parameters") -private ConfigurationParametersUpgrade configurationParameters; - -@JsonProperty("configuration-parameters") -public ConfigurationParametersUpgrade getConfigurationParameters() { -return configurationParameters; -} - -@JsonProperty("configuration-parameters") -public void setConfigurationParameters(ConfigurationParametersUpgrade configurationParameters) { -this.configurationParameters = configurationParameters; -} -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/CallbackHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/CallbackHeader.java deleted file mode 100644 index 67109d5578..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/CallbackHeader.java +++ /dev/null @@ -1,139 +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.bpmn.common.adapter.sdnc; - -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="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="ResponseCode" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="ResponseMessage" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestId", - "responseCode", - "responseMessage" -}, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") -@XmlRootElement(name = "CallbackHeader") -public class CallbackHeader { - - @XmlElement(name = "RequestId", required = true, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected String requestId; - @XmlElement(name = "ResponseCode", required = true,namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected String responseCode; - @XmlElement(name = "ResponseMessage", required = true,namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected String responseMessage; - - /** - * 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 responseCode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseCode() { - return responseCode; - } - - /** - * Sets the value of the responseCode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseCode(String value) { - this.responseCode = value; - } - - /** - * Gets the value of the responseMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseMessage() { - return responseMessage; - } - - /** - * Sets the value of the responseMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseMessage(String value) { - this.responseMessage = value; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java deleted file mode 100644 index 1835fbe41c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java +++ /dev/null @@ -1,91 +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.bpmn.common.adapter.sdnc; - -import javax.xml.bind.annotation.XmlRegistry; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the org.openecomp.domain2.workflow.sdnc.adapter.schema.v1 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 { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.domain2.workflow.sdnc.adapter.schema.v1 - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link RequestHeader } - * - */ - public RequestHeader createRequestHeader() { - return new RequestHeader(); - } - - /** - * Create an instance of {@link SDNCAdapterResponse } - * - */ - public SDNCAdapterResponse createSDNCAdapterResponse() { - return new SDNCAdapterResponse(); - } - - /** - * Create an instance of {@link SDNCAdapterCallbackRequest } - * - */ - public SDNCAdapterCallbackRequest createSDNCAdapterCallbackRequest() { - return new SDNCAdapterCallbackRequest(); - } - - /** - * Create an instance of {@link CallbackHeader } - * - */ - public CallbackHeader createCallbackHeader() { - return new CallbackHeader(); - } - - /** - * Create an instance of {@link SDNCAdapterRequest } - * - */ - public SDNCAdapterRequest createSDNCAdapterRequest() { - return new SDNCAdapterRequest(); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java deleted file mode 100644 index 12f2fef668..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java +++ /dev/null @@ -1,223 +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.bpmn.common.adapter.sdnc; - -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="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="SvcInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="SvcAction" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="SvcOperation" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="CallbackUrl" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="MsoAction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestId", - "svcInstanceId", - "svcAction", - "svcOperation", - "callbackUrl", - "msoAction" -}) -@XmlRootElement(name = "RequestHeader") -public class RequestHeader { - - @XmlElement(name = "RequestId", required = true) - protected String requestId; - @XmlElement(name = "SvcInstanceId") - protected String svcInstanceId; - @XmlElement(name = "SvcAction", required = true) - protected String svcAction; - @XmlElement(name = "SvcOperation", required = true) - protected String svcOperation; - @XmlElement(name = "CallbackUrl", required = true) - protected String callbackUrl; - @XmlElement(name = "MsoAction") - protected String msoAction; - - /** - * 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 svcInstanceId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSvcInstanceId() { - return svcInstanceId; - } - - /** - * Sets the value of the svcInstanceId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSvcInstanceId(String value) { - this.svcInstanceId = value; - } - - /** - * Gets the value of the svcAction property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSvcAction() { - return svcAction; - } - - /** - * Sets the value of the svcAction property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSvcAction(String value) { - this.svcAction = value; - } - - /** - * Gets the value of the svcOperation property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSvcOperation() { - return svcOperation; - } - - /** - * Sets the value of the svcOperation property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSvcOperation(String value) { - this.svcOperation = value; - } - - /** - * Gets the value of the callbackUrl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCallbackUrl() { - return callbackUrl; - } - - /** - * Sets the value of the callbackUrl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCallbackUrl(String value) { - this.callbackUrl = value; - } - - /** - * Gets the value of the msoAction property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMsoAction() { - return msoAction; - } - - /** - * Sets the value of the msoAction property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMsoAction(String value) { - this.msoAction = value; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java deleted file mode 100644 index 8c9d4e2a50..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java +++ /dev/null @@ -1,130 +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.bpmn.common.adapter.sdnc; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -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/workflow/sdnc/adapter/schema/v1}CallbackHeader"/>
- *         <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1", propOrder = { - "callbackHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterCallbackRequest", namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") -public class SDNCAdapterCallbackRequest { - - @XmlElement(name = "CallbackHeader", required = true, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected CallbackHeader callbackHeader; - @XmlElement(name = "RequestData", required=false, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected Object requestData; - - /** - * Gets the value of the callbackHeader property. - * - * @return - * possible object is - * {@link CallbackHeader } - * - */ - public CallbackHeader getCallbackHeader() { - return callbackHeader; - } - - /** - * Sets the value of the callbackHeader property. - * - * @param value - * allowed object is - * {@link CallbackHeader } - * - */ - public void setCallbackHeader(CallbackHeader value) { - this.callbackHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - - @Override - public String toString() { - StringWriter writer = new StringWriter(); - try { - JAXBContext context = JAXBContext - .newInstance(SDNCAdapterCallbackRequest.class); - Marshaller m = context.createMarshaller(); - m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - m.marshal(this, writer); - return writer.getBuffer().toString(); - } catch (JAXBException e) { - return ""; - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java deleted file mode 100644 index 1043b48944..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java +++ /dev/null @@ -1,111 +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.bpmn.common.adapter.sdnc; - -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/workflow/sdnc/adapter/schema/v1}RequestHeader"/>
- *         <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterRequest") -public class SDNCAdapterRequest { - - @XmlElement(name = "RequestHeader", required = true) - protected RequestHeader requestHeader; - @XmlElement(name = "RequestData", required = true) - protected Object requestData; - - /** - * Gets the value of the requestHeader property. - * - * @return - * possible object is - * {@link RequestHeader } - * - */ - public RequestHeader getRequestHeader() { - return requestHeader; - } - - /** - * Sets the value of the requestHeader property. - * - * @param value - * allowed object is - * {@link RequestHeader } - * - */ - public void setRequestHeader(RequestHeader value) { - this.requestHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java deleted file mode 100644 index 34e68d68ef..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.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========================================================= - */ - -package org.openecomp.mso.bpmn.common.adapter.sdnc; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -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">
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "SDNCAdapterResponse") -public class SDNCAdapterResponse { - - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java deleted file mode 100644 index c2f68ff6a4..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.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.bpmn.common.adapter.sdnc; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; - - -/** - * This class was generated by the JAX-WS RI. - * JAX-WS RI 2.2.4-b01 - * Generated source version: 2.2 - * - */ -@WebService(name = "SDNCCallbackAdapterPortType", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1") -@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -public interface SDNCCallbackAdapterPortType { - - - /** - * - * @param sdncAdapterCallbackRequest - * @return - * returns org.openecomp.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterResponse - */ - @WebMethod(operationName = "SDNCAdapterCallback") - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") - public SDNCAdapterResponse sdncAdapterCallback( - @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest") - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest); - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/package-info.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/package-info.java deleted file mode 100644 index 42f4ce374f..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/package-info.java +++ /dev/null @@ -1,22 +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========================================================= - */ - -@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package org.openecomp.mso.bpmn.common.adapter.sdnc; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotification.java deleted file mode 100644 index 1b5c080045..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotification.java +++ /dev/null @@ -1,462 +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.bpmn.common.adapter.vnf; - -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.XmlType; - - -/** - *

Java class for createVnfNotification complex type. - * - *

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

- * <complexType name="createVnfNotification">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/>
- *         <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="outputs" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <element name="entry" maxOccurs="unbounded" minOccurs="0">
- *                     <complexType>
- *                       <complexContent>
- *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                           <sequence>
- *                             <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *                             <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *                           </sequence>
- *                         </restriction>
- *                       </complexContent>
- *                     </complexType>
- *                   </element>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *         <element name="rollback" type="{http://org.openecomp.mso/vnfNotify}vnfRollback" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "createVnfNotification1", propOrder = { - "messageId", - "completed", - "exception", - "errorMessage", - "vnfId", - "outputs", - "rollback" -}) -public class CreateVnfNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - protected String vnfId; - protected CreateVnfNotification.Outputs outputs; - protected VnfRollback rollback; - - /** - * Gets the value of the messageId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return - * possible object is - * {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value - * allowed object is - * {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = 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 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 outputs property. - * - * @return - * possible object is - * {@link CreateVnfNotification.Outputs } - * - */ - public CreateVnfNotification.Outputs getOutputs() { - return outputs; - } - - /** - * Sets the value of the outputs property. - * - * @param value - * allowed object is - * {@link CreateVnfNotification.Outputs } - * - */ - public void setOutputs(CreateVnfNotification.Outputs value) { - this.outputs = value; - } - - /** - * Gets the value of the rollback property. - * - * @return - * possible object is - * {@link VnfRollback } - * - */ - public VnfRollback getRollback() { - return rollback; - } - - /** - * Sets the value of the rollback property. - * - * @param value - * allowed object is - * {@link VnfRollback } - * - */ - public void setRollback(VnfRollback value) { - this.rollback = value; - } - - - /** - *

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="entry" maxOccurs="unbounded" minOccurs="0">
-     *           <complexType>
-     *             <complexContent>
-     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
-     *                 <sequence>
-     *                   <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
-     *                   <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
-     *                 </sequence>
-     *               </restriction>
-     *             </complexContent>
-     *           </complexType>
-     *         </element>
-     *       </sequence>
-     *     </restriction>
-     *   </complexContent>
-     * </complexType>
-     * 
- * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "entry" - }) - public static class Outputs { - - protected List entry; - - /** - * Gets the value of the entry 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 entry property. - * - *

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

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

- * Objects of the following type(s) are allowed in the list - * {@link CreateVnfNotification.Outputs.Entry } - * - * - */ - public List getEntry() { - if (entry == null) { - entry = new ArrayList<>(); - } - return this.entry; - } - - // Not a generated method - @Override - public String toString() { - StringBuilder out = new StringBuilder(); - out.append("\n"); - if (entry != null) { - for (Entry e : entry) { - out.append(e.toString()); - out.append('\n'); - } - } - out.append(""); - return out.toString(); - } - - /** - *

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="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
-         *         <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
-         *       </sequence>
-         *     </restriction>
-         *   </complexContent>
-         * </complexType>
-         * 
- * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "key", - "value" - }) - public static class Entry { - - protected String key; - protected String value; - - /** - * Gets the value of the key property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getKey() { - return key; - } - - /** - * Sets the value of the key property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setKey(String value) { - this.key = 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; - - } - - // Not a generated method - @Override - public String toString() { - String entrystr; - entrystr = - ""+ '\n' + - " "+key+"" + '\n' + - " "+value+"" + '\n' + - ""; - return entrystr; - } - - } - - } - - // Not a generated method - @Override - public String toString() { - String createVnfNotification; - if (exception==null) { - createVnfNotification = "" + '\n' + - " "+messageId+"" + '\n' + - " "+completed+"" + '\n' + - " "+vnfId+"" + '\n' + - (outputs == null ? "" : outputs.toString() + '\n') + - " "+rollback+"" + '\n' + - ""; - } else { - createVnfNotification = "" + '\n' + - " "+messageId+"" + '\n' + - " "+completed+"" + '\n' + - (outputs == null ? "" : outputs.toString() + '\n') + - " "+exception+"" + '\n' + - " "+errorMessage+"" + '\n' + - ""; - } - return createVnfNotification; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java deleted file mode 100644 index 651fd1aca7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java +++ /dev/null @@ -1,198 +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.bpmn.common.adapter.vnf; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for deleteVnfNotification complex type. - * - *

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

- * <complexType name="deleteVnfNotification">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/>
- *         <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "deleteVnfNotification1", propOrder = { - "messageId", - "completed", - "exception", - "errorMessage" -}) -public class DeleteVnfNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - - /** - * Gets the value of the messageId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return - * possible object is - * {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value - * allowed object is - * {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = 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; - } - - /** - * Overrides toString() method - * @return String type (deleteVnfNotification) - */ - - @Override - public String toString() { - String deleteVnfNotification; - if (exception == null) { - deleteVnfNotification = "" + '\n' + - " "+messageId+"" + '\n' + - " "+completed+"" + '\n' + - ""; - } else { - deleteVnfNotification = "" + '\n' + - " "+messageId+"" + '\n' + - " "+completed+"" + '\n' + - " "+exception+"" + '\n' + - " "+errorMessage+"" + '\n' + - ""; - } - return deleteVnfNotification; - } - -/* - public String toString() { - StringWriter writer = new StringWriter(); - try { - JAXBContext context = JAXBContext - .newInstance(DeleteVnfNotification.class); - Marshaller m = context.createMarshaller(); - m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - m.marshal(this, writer); - //System.out.println("toString() - " + writer.getBuffer().toString()); - return writer.getBuffer().toString(); - } catch (JAXBException e) { - //System.out.println("JAXBException - " + e.getStackTrace()); - return ""; - } - } -*/ - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java deleted file mode 100644 index 02dc1edcb7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.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.bpmn.common.adapter.vnf; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for msoExceptionCategory. - * - *

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

- *

- * <simpleType name="msoExceptionCategory">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="OPENSTACK"/>
- *     <enumeration value="IO"/>
- *     <enumeration value="INTERNAL"/>
- *     <enumeration value="USERDATA"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "msoExceptionCategory") -@XmlEnum -public enum MsoExceptionCategory { - - OPENSTACK, - IO, - INTERNAL, - USERDATA; - - public String value() { - return name(); - } - - public static MsoExceptionCategory fromValue(String v) { - return valueOf(v); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java deleted file mode 100644 index eabd465934..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java +++ /dev/null @@ -1,112 +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.bpmn.common.adapter.vnf; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for msoRequest complex type. - * - *

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

- * <complexType name="msoRequest">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="requestId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="serviceInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "msoRequest", propOrder = { - "requestId", - "serviceInstanceId" -}) -public class MsoRequest { - - protected String requestId; - protected String serviceInstanceId; - - /** - * 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 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; - } - - @Override - public String toString() { - return "" + requestId + "" + '\n' + "" + serviceInstanceId - + ""; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactory.java deleted file mode 100644 index c22fd286cf..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactory.java +++ /dev/null @@ -1,208 +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.bpmn.common.adapter.vnf; - -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.adapters.vnf.async.client 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 _RollbackVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "rollbackVnfNotification"); - private final static QName _DeleteVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "deleteVnfNotification"); - private final static QName _CreateVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "createVnfNotification"); - private final static QName _UpdateVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "updateVnfNotification"); - private final static QName _QueryVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "queryVnfNotification"); - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.adapters.vnf.async.client - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link UpdateVnfNotification } - * - */ - public UpdateVnfNotification createUpdateVnfNotification() { - return new UpdateVnfNotification(); - } - - /** - * Create an instance of {@link UpdateVnfNotification.Outputs } - * - */ - public UpdateVnfNotification.Outputs createUpdateVnfNotificationOutputs() { - return new UpdateVnfNotification.Outputs(); - } - - /** - * Create an instance of {@link QueryVnfNotification } - * - */ - public QueryVnfNotification createQueryVnfNotification() { - return new QueryVnfNotification(); - } - - /** - * Create an instance of {@link QueryVnfNotification.Outputs } - * - */ - public QueryVnfNotification.Outputs createQueryVnfNotificationOutputs() { - return new QueryVnfNotification.Outputs(); - } - - /** - * Create an instance of {@link CreateVnfNotification } - * - */ - public CreateVnfNotification createCreateVnfNotification() { - return new CreateVnfNotification(); - } - - /** - * Create an instance of {@link CreateVnfNotification.Outputs } - * - */ - public CreateVnfNotification.Outputs createCreateVnfNotificationOutputs() { - return new CreateVnfNotification.Outputs(); - } - - /** - * Create an instance of {@link DeleteVnfNotification } - * - */ - public DeleteVnfNotification createDeleteVnfNotification() { - return new DeleteVnfNotification(); - } - - /** - * Create an instance of {@link RollbackVnfNotification } - * - */ - public RollbackVnfNotification createRollbackVnfNotification() { - return new RollbackVnfNotification(); - } - - /** - * Create an instance of {@link MsoRequest } - * - */ - public MsoRequest createMsoRequest() { - return new MsoRequest(); - } - - /** - * Create an instance of {@link VnfRollback } - * - */ - public VnfRollback createVnfRollback() { - return new VnfRollback(); - } - - /** - * Create an instance of {@link UpdateVnfNotification.Outputs.Entry } - * - */ - public UpdateVnfNotification.Outputs.Entry createUpdateVnfNotificationOutputsEntry() { - return new UpdateVnfNotification.Outputs.Entry(); - } - - /** - * Create an instance of {@link QueryVnfNotification.Outputs.Entry } - * - */ - public QueryVnfNotification.Outputs.Entry createQueryVnfNotificationOutputsEntry() { - return new QueryVnfNotification.Outputs.Entry(); - } - - /** - * Create an instance of {@link CreateVnfNotification.Outputs.Entry } - * - */ - public CreateVnfNotification.Outputs.Entry createCreateVnfNotificationOutputsEntry() { - return new CreateVnfNotification.Outputs.Entry(); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link RollbackVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "rollbackVnfNotification") - public JAXBElement createRollbackVnfNotification(RollbackVnfNotification value) { - return new JAXBElement<>(_RollbackVnfNotification_QNAME, RollbackVnfNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link DeleteVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "deleteVnfNotification") - public JAXBElement createDeleteVnfNotification(DeleteVnfNotification value) { - return new JAXBElement<>(_DeleteVnfNotification_QNAME, DeleteVnfNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link CreateVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "createVnfNotification") - public JAXBElement createCreateVnfNotification(CreateVnfNotification value) { - return new JAXBElement<>(_CreateVnfNotification_QNAME, CreateVnfNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link UpdateVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "updateVnfNotification") - public JAXBElement createUpdateVnfNotification(UpdateVnfNotification value) { - return new JAXBElement<>(_UpdateVnfNotification_QNAME, UpdateVnfNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link QueryVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "queryVnfNotification") - public JAXBElement createQueryVnfNotification(QueryVnfNotification value) { - return new JAXBElement<>(_QueryVnfNotification_QNAME, QueryVnfNotification.class, null, value); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java deleted file mode 100644 index 4e84234c81..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java +++ /dev/null @@ -1,488 +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.bpmn.common.adapter.vnf; - -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.XmlType; - - -/** - *

Java class for queryVnfNotification complex type. - * - *

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

- * <complexType name="queryVnfNotification">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/>
- *         <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="vnfExists" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- *         <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="status" type="{http://org.openecomp.mso/vnfNotify}vnfStatus" minOccurs="0"/>
- *         <element name="outputs" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <element name="entry" maxOccurs="unbounded" minOccurs="0">
- *                     <complexType>
- *                       <complexContent>
- *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                           <sequence>
- *                             <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *                             <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *                           </sequence>
- *                         </restriction>
- *                       </complexContent>
- *                     </complexType>
- *                   </element>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "queryVnfNotification1", propOrder = { - "messageId", - "completed", - "exception", - "errorMessage", - "vnfExists", - "vnfId", - "status", - "outputs" -}) -public class QueryVnfNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - protected Boolean vnfExists; - protected String vnfId; - protected VnfStatus status; - protected QueryVnfNotification.Outputs outputs; - - /** - * Gets the value of the messageId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return - * possible object is - * {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value - * allowed object is - * {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = 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 vnfExists property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isVnfExists() { - return vnfExists; - } - - /** - * Sets the value of the vnfExists property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setVnfExists(Boolean value) { - this.vnfExists = value; - } - - /** - * 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 status property. - * - * @return - * possible object is - * {@link VnfStatus } - * - */ - public VnfStatus getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value - * allowed object is - * {@link VnfStatus } - * - */ - public void setStatus(VnfStatus value) { - this.status = value; - } - - /** - * Gets the value of the outputs property. - * - * @return - * possible object is - * {@link QueryVnfNotification.Outputs } - * - */ - public QueryVnfNotification.Outputs getOutputs() { - return outputs; - } - - /** - * Sets the value of the outputs property. - * - * @param value - * allowed object is - * {@link QueryVnfNotification.Outputs } - * - */ - public void setOutputs(QueryVnfNotification.Outputs value) { - this.outputs = value; - } - - - /** - *

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="entry" maxOccurs="unbounded" minOccurs="0">
-     *           <complexType>
-     *             <complexContent>
-     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
-     *                 <sequence>
-     *                   <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
-     *                   <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
-     *                 </sequence>
-     *               </restriction>
-     *             </complexContent>
-     *           </complexType>
-     *         </element>
-     *       </sequence>
-     *     </restriction>
-     *   </complexContent>
-     * </complexType>
-     * 
- * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "entry" - }) - public static class Outputs { - - protected List entry; - - /** - * Gets the value of the entry 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 entry property. - * - *

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

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

- * Objects of the following type(s) are allowed in the list - * {@link QueryVnfNotification.Outputs.Entry } - * - * - */ - public List getEntry() { - if (entry == null) { - entry = new ArrayList<>(); - } - return this.entry; - } - - // Not a generated method - public String toString() { - StringBuilder out = new StringBuilder(); - out.append("\n"); - if (entry != null) { - for (Entry e : entry) { - out.append(e.toString()); - out.append('\n'); - } - } - out.append(""); - return out.toString(); - } - - - /** - *

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="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
-         *         <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
-         *       </sequence>
-         *     </restriction>
-         *   </complexContent>
-         * </complexType>
-         * 
- * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "key", - "value" - }) - public static class Entry { - - protected String key; - protected String value; - - /** - * Gets the value of the key property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getKey() { - return key; - } - - /** - * Sets the value of the key property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setKey(String value) { - this.key = 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; - } - - // Not a generated method - public String toString() { - String entry = ""; - entry = - ""+ '\n' + - " "+key+"" + '\n' + - " "+value+"" + '\n' + - ""; - return entry; - } - - } - - } - - // Not a generated method - public String toString() { - String queryVnfNotification = ""; - if (exception==null) { - queryVnfNotification = "" + '\n' + - " "+messageId+"" + '\n' + - " "+completed+"" + '\n' + - " "+vnfExists+"" + '\n' + - " "+vnfId+"" + '\n' + - " "+status+"" + '\n' + - (outputs == null ? "" : outputs.toString() + '\n') + - ""; - } else { - queryVnfNotification = "" + '\n' + - " "+messageId+"" + '\n' + - " "+completed+"" + '\n' + - (outputs == null ? "" : outputs.toString() + '\n') + - " "+exception+"" + '\n' + - " "+errorMessage+"" + '\n' + - ""; - } - return queryVnfNotification; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotification.java deleted file mode 100644 index 0cf088d023..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotification.java +++ /dev/null @@ -1,175 +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.bpmn.common.adapter.vnf; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for rollbackVnfNotification complex type. - * - *

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

- * <complexType name="rollbackVnfNotification">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/>
- *         <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "rollbackVnfNotification1", propOrder = { - "messageId", - "completed", - "exception", - "errorMessage" -}) -public class RollbackVnfNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - - /** - * Gets the value of the messageId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return - * possible object is - * {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value - * allowed object is - * {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = 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; - } - - public String toString() { - String rollbackVnfNotification = ""; - if (exception==null) { - rollbackVnfNotification = "" + '\n' + - " "+messageId+"" + '\n' + - " "+completed+"" + '\n' + - ""; - } else { - rollbackVnfNotification = "" + '\n' + - " "+messageId+"" + '\n' + - " "+completed+"" + '\n' + - " "+exception+"" + '\n' + - " "+errorMessage+"" + '\n' + - ""; - } - return rollbackVnfNotification; - - } - - } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotification.java deleted file mode 100644 index 79188e77b6..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotification.java +++ /dev/null @@ -1,412 +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.bpmn.common.adapter.vnf; - -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.XmlType; - - -/** - *

Java class for updateVnfNotification complex type. - * - *

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

- * <complexType name="updateVnfNotification">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/>
- *         <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="outputs" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <element name="entry" maxOccurs="unbounded" minOccurs="0">
- *                     <complexType>
- *                       <complexContent>
- *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                           <sequence>
- *                             <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *                             <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *                           </sequence>
- *                         </restriction>
- *                       </complexContent>
- *                     </complexType>
- *                   </element>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *         <element name="rollback" type="{http://org.openecomp.mso/vnfNotify}vnfRollback" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "updateVnfNotification1", propOrder = { - "messageId", - "completed", - "exception", - "errorMessage", - "outputs", - "rollback" -}) -public class UpdateVnfNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - protected UpdateVnfNotification.Outputs outputs; - protected VnfRollback rollback; - - /** - * Gets the value of the messageId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return - * possible object is - * {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value - * allowed object is - * {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = 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 outputs property. - * - * @return - * possible object is - * {@link UpdateVnfNotification.Outputs } - * - */ - public UpdateVnfNotification.Outputs getOutputs() { - return outputs; - } - - /** - * Sets the value of the outputs property. - * - * @param value - * allowed object is - * {@link UpdateVnfNotification.Outputs } - * - */ - public void setOutputs(UpdateVnfNotification.Outputs value) { - this.outputs = value; - } - - /** - * Gets the value of the rollback property. - * - * @return - * possible object is - * {@link VnfRollback } - * - */ - public VnfRollback getRollback() { - return rollback; - } - - /** - * Sets the value of the rollback property. - * - * @param value - * allowed object is - * {@link VnfRollback } - * - */ - public void setRollback(VnfRollback value) { - this.rollback = value; - } - - - /** - *

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="entry" maxOccurs="unbounded" minOccurs="0">
-     *           <complexType>
-     *             <complexContent>
-     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
-     *                 <sequence>
-     *                   <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
-     *                   <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
-     *                 </sequence>
-     *               </restriction>
-     *             </complexContent>
-     *           </complexType>
-     *         </element>
-     *       </sequence>
-     *     </restriction>
-     *   </complexContent>
-     * </complexType>
-     * 
- * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "entry" - }) - public static class Outputs { - - protected List entry; - - /** - * Gets the value of the entry 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 entry property. - * - *

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

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

- * Objects of the following type(s) are allowed in the list - * {@link UpdateVnfNotification.Outputs.Entry } - * - * - */ - public List getEntry() { - if (entry == null) { - entry = new ArrayList<>(); - } - return this.entry; - } - - - /** - *

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="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
-         *         <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
-         *       </sequence>
-         *     </restriction>
-         *   </complexContent>
-         * </complexType>
-         * 
- * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "key", - "value" - }) - public static class Entry { - - protected String key; - protected String value; - - /** - * Gets the value of the key property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getKey() { - return key; - } - - /** - * Sets the value of the key property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setKey(String value) { - this.key = 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; - } - - public String toString() { - String entry = ""; - entry = - " "+key+"" + '\n' + - " "+value+""; - return entry; - } - } - - } - - public String toString(){ - String updateVnfNotification = ""; - if (exception==null) { - updateVnfNotification = "" + '\n' + - " "+messageId+"" + '\n' + - " "+completed+"" + '\n' + - " "+rollback+"" + '\n' + - ""; - } else { - updateVnfNotification = "" + '\n' + - " "+messageId+"" + '\n' + - " "+completed+"" + '\n' + - " "+exception+"" + '\n' + - " "+errorMessage+"" + '\n' + - ""; - } - - return updateVnfNotification; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify.java deleted file mode 100644 index d192bb34a9..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify.java +++ /dev/null @@ -1,177 +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.bpmn.common.adapter.vnf; - -import javax.jws.Oneway; -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebService; -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.ws.Action; -import javax.xml.ws.RequestWrapper; - - -/** - * This class was generated by the JAX-WS RI. - * JAX-WS RI 2.2.8 - * Generated source version: 2.2 - * - */ -@WebService(name = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify") -@XmlSeeAlso({ - ObjectFactory.class -}) -public interface VnfAdapterNotify { - - - /** - * - * @param errorMessage - * @param exception - * @param messageId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.RollbackVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/rollbackVnfNotificationRequest") - public void rollbackVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage); - - /** - * - * @param errorMessage - * @param vnfExists - * @param status - * @param exception - * @param outputs - * @param messageId - * @param vnfId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.QueryVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/queryVnfNotificationRequest") - public void queryVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage, - @WebParam(name = "vnfExists", targetNamespace = "") - Boolean vnfExists, - @WebParam(name = "vnfId", targetNamespace = "") - String vnfId, - @WebParam(name = "status", targetNamespace = "") - VnfStatus status, - @WebParam(name = "outputs", targetNamespace = "") - org.openecomp.mso.bpmn.common.adapter.vnf.QueryVnfNotification.Outputs outputs); - - /** - * - * @param errorMessage - * @param exception - * @param rollback - * @param outputs - * @param messageId - * @param vnfId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.CreateVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/createVnfNotificationRequest") - public void createVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage, - @WebParam(name = "vnfId", targetNamespace = "") - String vnfId, - @WebParam(name = "outputs", targetNamespace = "") - org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs outputs, - @WebParam(name = "rollback", targetNamespace = "") - VnfRollback rollback); - - /** - * - * @param errorMessage - * @param exception - * @param rollback - * @param outputs - * @param messageId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.UpdateVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest") - public void updateVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage, - @WebParam(name = "outputs", targetNamespace = "") - org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs outputs, - @WebParam(name = "rollback", targetNamespace = "") - VnfRollback rollback); - - /** - * - * @param errorMessage - * @param exception - * @param messageId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.DeleteVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/deleteVnfNotificationRequest") - public void deleteVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage); - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java deleted file mode 100644 index 38385fbe9c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java +++ /dev/null @@ -1,108 +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.bpmn.common.adapter.vnf; - -import java.net.URL; -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import javax.xml.ws.WebEndpoint; -import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceException; -import javax.xml.ws.WebServiceFeature; - - -/** - * This class was generated by the JAX-WS RI. - * JAX-WS RI 2.2.8 - * Generated source version: 2.2 - * - */ -@WebServiceClient(name = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify", wsdlLocation = "/VnfAdapterNotify.wsdl") -public class VnfAdapterNotify_Service extends Service -{ - - private final static URL VNFADAPTERNOTIFY_WSDL_LOCATION; - private final static WebServiceException VNFADAPTERNOTIFY_EXCEPTION; - private final static QName VNFADAPTERNOTIFY_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "vnfAdapterNotify"); - - static { - VNFADAPTERNOTIFY_WSDL_LOCATION = org.openecomp.mso.bpmn.common.adapter.vnf.VnfAdapterNotify_Service.class.getResource("/VnfAdapterNotify.wsdl"); - WebServiceException e = null; - if (VNFADAPTERNOTIFY_WSDL_LOCATION == null) { - e = new WebServiceException("Cannot find '/VnfAdapterNotify.wsdl' wsdl. Place the resource correctly in the classpath."); - } - VNFADAPTERNOTIFY_EXCEPTION = e; - } - - public VnfAdapterNotify_Service() { - super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME); - } - - public VnfAdapterNotify_Service(WebServiceFeature... features) { - super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME, features); - } - - public VnfAdapterNotify_Service(URL wsdlLocation) { - super(wsdlLocation, VNFADAPTERNOTIFY_QNAME); - } - - public VnfAdapterNotify_Service(URL wsdlLocation, WebServiceFeature... features) { - super(wsdlLocation, VNFADAPTERNOTIFY_QNAME, features); - } - - public VnfAdapterNotify_Service(URL wsdlLocation, QName serviceName) { - super(wsdlLocation, serviceName); - } - - public VnfAdapterNotify_Service(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { - super(wsdlLocation, serviceName, features); - } - - /** - * - * @return - * returns VnfAdapterNotify - */ - @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort") - public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort() { - return super.getPort(new QName("http://org.openecomp.mso/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class); - } - - /** - * - * @param features - * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. - * @return - * returns VnfAdapterNotify - */ - @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort") - public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort(WebServiceFeature... features) { - return super.getPort(new QName("http://org.openecomp.mso/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class, features); - } - - private static URL __getWsdlLocation() { - if (VNFADAPTERNOTIFY_EXCEPTION!= null) { - throw VNFADAPTERNOTIFY_EXCEPTION; - } - return VNFADAPTERNOTIFY_WSDL_LOCATION; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollback.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollback.java deleted file mode 100644 index a546b82325..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollback.java +++ /dev/null @@ -1,210 +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.bpmn.common.adapter.vnf; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for vnfRollback complex type. - * - *

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

- * <complexType name="vnfRollback">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="cloudSiteId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="msoRequest" type="{http://org.openecomp.mso/vnfNotify}msoRequest" minOccurs="0"/>
- *         <element name="tenantCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="tenantId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="vnfCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "vnfRollback", propOrder = { - "cloudSiteId", - "msoRequest", - "tenantCreated", - "tenantId", - "vnfCreated", - "vnfId" -}) -public class VnfRollback { - - protected String cloudSiteId; - protected MsoRequest msoRequest; - protected boolean tenantCreated; - protected String tenantId; - protected boolean vnfCreated; - protected String vnfId; - - /** - * Gets the value of the cloudSiteId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCloudSiteId() { - return cloudSiteId; - } - - /** - * Sets the value of the cloudSiteId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCloudSiteId(String value) { - this.cloudSiteId = value; - } - - /** - * Gets the value of the msoRequest property. - * - * @return - * possible object is - * {@link MsoRequest } - * - */ - public MsoRequest getMsoRequest() { - return msoRequest; - } - - /** - * Sets the value of the msoRequest property. - * - * @param value - * allowed object is - * {@link MsoRequest } - * - */ - public void setMsoRequest(MsoRequest value) { - this.msoRequest = value; - } - - /** - * Gets the value of the tenantCreated property. - * - */ - public boolean isTenantCreated() { - return tenantCreated; - } - - /** - * Sets the value of the tenantCreated property. - * - */ - public void setTenantCreated(boolean value) { - this.tenantCreated = 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 vnfCreated property. - * - */ - public boolean isVnfCreated() { - return vnfCreated; - } - - /** - * Sets the value of the vnfCreated property. - * - */ - public void setVnfCreated(boolean value) { - this.vnfCreated = value; - } - - /** - * 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; - } - - public String toString() { - String msoRequestElement = msoRequest == null ? "" - : ""+msoRequest+"" + '\n'; - - return - ""+cloudSiteId+"" + '\n' + - msoRequestElement + - ""+tenantCreated+"" + '\n' + - ""+tenantId+"" + '\n' + - ""+vnfCreated+"" + '\n' + - ""+vnfId+""; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java deleted file mode 100644 index aef85470a7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.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.bpmn.common.adapter.vnf; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for vnfStatus. - * - *

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

- *

- * <simpleType name="vnfStatus">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="ACTIVE"/>
- *     <enumeration value="FAILED"/>
- *     <enumeration value="NOTFOUND"/>
- *     <enumeration value="UNKNOWN"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "vnfStatus") -@XmlEnum -public enum VnfStatus { - - ACTIVE, - FAILED, - NOTFOUND, - UNKNOWN; - - public String value() { - return name(); - } - - public static VnfStatus fromValue(String v) { - return valueOf(v); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/package-info.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/package-info.java deleted file mode 100644 index c6ee6ca015..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/package-info.java +++ /dev/null @@ -1,22 +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========================================================= - */ - -@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp.mso/vnfNotify") -package org.openecomp.mso.bpmn.common.adapter.vnf; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnIntegerParam.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnIntegerParam.java deleted file mode 100644 index 033c6876bd..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnIntegerParam.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.common.recipe; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class BpmnIntegerParam { - - @JsonProperty("value") - private int value; - @JsonProperty("type") - private final String type = "Integer"; - - public BpmnIntegerParam() { - } - - @JsonProperty("value") - public int getValue() { - return value; - } - - @JsonProperty("type") - public void setValue(int value) { - this.value = value; - } - - @Override - public String toString() { - return "CamundaInput [value=" + Integer.toString(value) + ", type=" + type + "]"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnParam.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnParam.java deleted file mode 100644 index 4b58b51560..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnParam.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.common.recipe; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * The bpmn workflow input param object - */ -public class BpmnParam { - - @JsonProperty("value") - private String value; - @JsonProperty("type") - private String type = "String"; - - - public BpmnParam() { - /* Empty constructor */ - } - - @JsonProperty("value") - public String getValue() { - return value; - } - - @JsonProperty("value") - public void setValue(String value) { - this.value = value; - } - - @Override - public String toString() { - return "CamundaInput [value=" + value + ", type=" + type + "]"; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java deleted file mode 100644 index 6a17d600cb..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java +++ /dev/null @@ -1,224 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.common.recipe; - -import java.io.IOException; -import java.security.GeneralSecurityException; - -import javax.xml.bind.DatatypeConverter; - -import org.apache.http.HttpResponse; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.HttpClient; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.HttpClientBuilder; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesFactory; -import org.openecomp.mso.utils.CryptoUtils; - -/** - * Support to call resource recipes from the BPMN workflow. - * Such as call resource recipe in service workflow. - *
- *

- *

- * - * @author - * @version ONAP Beijing Release 2018-02-27 - */ -public class BpmnRestClient { - - public static final String DEFAULT_BPEL_AUTH = "admin:admin"; - - public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; - - public static final String CONTENT_TYPE_JSON = "application/json"; - - public static final String CAMUNDA_AUTH = "camundaAuth"; - - private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; - - private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private static boolean noProperties = true; - - //because for NS it will take a long time the time out of the resouce will be 2 hours. - private static final String DEFAULT_TIME_OUT = "7200"; - - public synchronized static MsoJavaProperties loadMsoProperties() { - MsoJavaProperties msoProperties; - try { - msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_APIHANDLER_INFRA); - } catch(Exception e) { - msoLogger.error(MessageEnum.APIH_LOAD_PROPERTIES_FAIL, 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, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, - "No MSO APIH_INFRA Properties found"); - return null; - } - } - - public synchronized static final boolean getNoPropertiesState() { - return noProperties; - } - - /** - * post the recipe Uri - *
- * - * @param recipeUri The request recipe uri - * @param requestId the request id - * @param recipeTimeout The recipe time out - * @param requestAction The request action - * @param serviceInstanceId The service instance id - * @param serviceType The service Type - * @param requestDetails The request Details, these information is from runtime - * @param recipeParamXsd The recipe params, its from recipe design - * @return The response of the recipe. - * @throws ClientProtocolException - * @throws IOException - * @since ONAP Beijing Release - */ - public static HttpResponse post(String recipeUri, String requestId, int recipeTimeout, String requestAction, String serviceInstanceId, String serviceType, - String requestDetails, String recipeParamXsd) throws ClientProtocolException, IOException { - - HttpClient client = HttpClientBuilder.create().build(); - - HttpPost post = new HttpPost(recipeUri); - MsoJavaProperties props = loadMsoProperties(); - msoLogger.debug("call the bpmn, url:" + recipeUri); - String jsonReq = wrapResourceRequest(requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, requestDetails, recipeParamXsd); - - StringEntity input = new StringEntity(jsonReq); - input.setContentType(CONTENT_TYPE_JSON); - String encryptedCredentials; - if(props != null) { - encryptedCredentials = props.getProperty(CAMUNDA_AUTH, null); - if(encryptedCredentials != null) { - String userCredentials = getEncryptedPropValue(encryptedCredentials, DEFAULT_BPEL_AUTH, ENCRYPTION_KEY); - if(userCredentials != null) { - post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes())); - } - } - } - post.setEntity(input); - return client.execute(post); - } - - /** - * prepare the resource recipe bpmn request. - *
- * - * @param requestId - * @param recipeTimeout - * @param requestAction - * @param serviceInstanceId - * @param serviceType - * @param requestDetails - * @param recipeParams - * @return - * @since ONAP Beijing Release - */ - private static String wrapResourceRequest(String requestId, int recipeTimeout, String requestAction, String serviceInstanceId, String serviceType, - String requestDetails, String recipeParams) { - String jsonReq = null; - if(requestId == null) { - requestId = ""; - } - if(requestAction == null) { - requestAction = ""; - } - if(serviceInstanceId == null) { - serviceInstanceId = ""; - } - - if(requestDetails == null) { - requestDetails = ""; - } - - try { - ResourceRecipeRequest recipeRequest = new ResourceRecipeRequest(); - BpmnParam resourceInput = new BpmnParam(); - BpmnParam host = new BpmnParam(); - BpmnParam requestIdInput = new BpmnParam(); - BpmnParam requestActionInput = new BpmnParam(); - BpmnParam serviceInstanceIdInput = new BpmnParam(); - BpmnParam serviceTypeInput = new BpmnParam(); - BpmnParam recipeParamsInput = new BpmnParam(); - BpmnParam recipeTimeoutInput = new BpmnParam(); - recipeTimeoutInput.setValue(DEFAULT_TIME_OUT); - // host.setValue(parseURL()); - requestIdInput.setValue(requestId); - requestActionInput.setValue(requestAction); - serviceInstanceIdInput.setValue(serviceInstanceId); - serviceTypeInput.setValue(serviceType); - recipeParamsInput.setValue(recipeParams); - resourceInput.setValue(requestDetails); - recipeRequest.setHost(host); - recipeRequest.setRequestId(requestIdInput); - recipeRequest.setRequestAction(requestActionInput); - recipeRequest.setServiceInstanceId(serviceInstanceIdInput); - recipeRequest.setServiceType(serviceTypeInput); - recipeRequest.setRecipeParams(recipeParamsInput); - recipeRequest.setResourceInput(resourceInput); - recipeRequest.setRecipeTimeout(recipeTimeoutInput); - jsonReq = recipeRequest.toString(); - 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; - } - - /** - *
- * - * @param prop - * @param defaultValue - * @param encryptionKey - * @return - * @since ONAP Beijing Release - */ - protected static 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/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java deleted file mode 100644 index 42547faa1e..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java +++ /dev/null @@ -1,295 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.common.recipe; - -import org.openecomp.mso.bpmn.core.domain.ModelInfo; -import org.openecomp.mso.logger.MsoLogger; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRootName; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -/** - * the inputs for the resource recipe - *
- *

- *

- * - * @author - * @version ONAP Beijing Release 2018-03-08 - */ -@JsonPropertyOrder({"resourceInstanceName", "resourceInstanceDes", "globalSubscriberId", "serviceType", "serviceId", "operationId", "serviceModelInfo","resourceModelInfo", "resourceInstancenUuid","resourceParameters","operationType"}) -@JsonRootName("variables") -public class ResourceInput { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); - - @JsonProperty("resourceInstanceName") - private String resourceInstanceName; - - @JsonProperty("resourceInstanceDes") - private String resourceInstanceDes; - - @JsonProperty("globalSubscriberId") - private String globalSubscriberId; - - @JsonProperty("serviceType") - private String serviceType; - - @JsonProperty("serviceInstanceId") - private String serviceInstanceId; - - @JsonProperty("operationId") - private String operationId; - - @JsonProperty("serviceModelInfo") - private ModelInfo serviceModelInfo; - - @JsonProperty("resourceModelInfo") - private ModelInfo resourceModelInfo; - - //for delete resource - @JsonProperty("resourceInstancenUuid") - private String resourceInstancenUuid; - - @JsonProperty("resourceParameters") - private String resourceParameters; - - @JsonProperty("operationType") - private String operationType; - - - /** - * @return Returns the resourceInstanceName. - */ - @JsonProperty("resourceInstanceName") - public String getResourceInstanceName() { - return resourceInstanceName; - } - - - /** - * @param resourceInstanceName The resourceInstanceName to set. - */ - @JsonProperty("resourceInstanceName") - public void setResourceInstanceName(String resourceInstanceName) { - this.resourceInstanceName = resourceInstanceName; - } - - - /** - * @return Returns the resourceInstanceDes. - */ - @JsonProperty("resourceInstanceDes") - public String getResourceInstanceDes() { - return resourceInstanceDes; - } - - - /** - * @param resourceInstanceDes The resourceInstanceDes to set. - */ - @JsonProperty("resourceInstanceDes") - public void setResourceInstanceDes(String resourceInstanceDes) { - this.resourceInstanceDes = resourceInstanceDes; - } - - - /** - * @return Returns the globalSubscriberId. - */ - @JsonProperty("globalSubscriberId") - public String getGlobalSubscriberId() { - return globalSubscriberId; - } - - - /** - * @param globalSubscriberId The globalSubscriberId to set. - */ - @JsonProperty("globalSubscriberId") - public void setGlobalSubscriberId(String globalSubscriberId) { - this.globalSubscriberId = globalSubscriberId; - } - - - /** - * @return Returns the serviceType. - */ - @JsonProperty("serviceType") - public String getServiceType() { - return serviceType; - } - - - /** - * @param serviceType The serviceType to set. - */ - @JsonProperty("serviceType") - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - - - /** - * @return Returns the serviceId. - */ - @JsonProperty("serviceInstanceId") - public String getServiceInstanceId() { - return serviceInstanceId; - } - - - /** - * @param serviceId The serviceId to set. - */ - @JsonProperty("serviceInstanceId") - public void setServiceInstanceId(String serviceId) { - this.serviceInstanceId = serviceId; - } - - - /** - * @return Returns the operationId. - */ - @JsonProperty("operationId") - public String getOperationId() { - return operationId; - } - - - /** - * @param operationId The operationId to set. - */ - @JsonProperty("operationId") - public void setOperationId(String operationId) { - this.operationId = operationId; - } - - /** - * @return Returns the serviceModelInfo. - */ - @JsonProperty("serviceModelInfo") - public ModelInfo getServiceModelInfo() { - return serviceModelInfo; - } - - - - /** - * @param serviceModelInfo The serviceModelInfo to set. - */ - @JsonProperty("serviceModelInfo") - public void setServiceModelInfo(ModelInfo serviceModelInfo) { - this.serviceModelInfo = serviceModelInfo; - } - - - - /** - * @return Returns the resourceModelInfo. - */ - @JsonProperty("resourceModelInfo") - public ModelInfo getResourceModelInfo() { - return resourceModelInfo; - } - - - - /** - * @param resourceModelInfo The resourceModelInfo to set. - */ - @JsonProperty("resourceModelInfo") - public void setResourceModelInfo(ModelInfo resourceModelInfo) { - this.resourceModelInfo = resourceModelInfo; - } - - - /** - * @return Returns the resourceParameters. - */ - @JsonProperty("resourceParameters") - public String getResourceParameters() { - return resourceParameters; - } - - - /** - * @param resourceParameters The resourceParameters to set. - */ - @JsonProperty("resourceParameters") - public void setResourceParameters(String resourceParameters) { - this.resourceParameters = resourceParameters; - } - - - /** - * @return Returns the operationType. - */ - @JsonProperty("operationType") - public String getOperationType() { - return operationType; - } - - - /** - * @param operationType The operationType to set. - */ - @JsonProperty("operationType") - public void setOperationType(String operationType) { - this.operationType = operationType; - } - - - - /** - * @return Returns the resourceInstancenUuid. - */ - @JsonProperty("resourceInstancenUuid") - public String getResourceInstancenUuid() { - return resourceInstancenUuid; - } - - - - /** - * @param resourceInstancenUuid The resourceInstancenUuid to set. - */ - @JsonProperty("resourceInstancenUuid") - public void setResourceInstancenUuid(String resourceInstancenUuid) { - this.resourceInstancenUuid = resourceInstancenUuid; - } - - @Override - public String toString() { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); - String jsonStr = ""; - try { - jsonStr = mapper.writeValueAsString(this); - } catch(JsonProcessingException e) { - msoLogger.error("JsonProcessingException", e); - } - return jsonStr; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java deleted file mode 100644 index 3ec43e10ae..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java +++ /dev/null @@ -1,159 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.common.recipe; - -import org.openecomp.mso.logger.MsoLogger; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRootName; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -/** - * java object of the resource recipe , it - * will be passed to the Camunda process - */ -@JsonPropertyOrder({"resourceInput", "host", "requestId", "requestAction", "serviceInstanceId", "serviceType", "recipeParams"}) -@JsonRootName("variables") -public class ResourceRecipeRequest { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); - - @JsonProperty("resourceInput") - private BpmnParam resourceInput; - - @JsonProperty("host") - private BpmnParam host; - - @JsonProperty("mso-request-id") - private BpmnParam requestId; - - @JsonProperty("requestAction") - private BpmnParam requestAction; - - @JsonProperty("serviceInstanceId") - private BpmnParam serviceInstanceId; - - @JsonProperty("serviceType") - private BpmnParam serviceType; - - @JsonProperty("recipeParams") - private BpmnParam recipeParams; - - @JsonProperty("mso-service-request-timeout") - private BpmnParam recipeTimeout; - - @JsonProperty("resourceInput") - public BpmnParam getResourceInput() { - return resourceInput; - } - - @JsonProperty("resourceInput") - public void setResourceInput(BpmnParam resourceInput) { - this.resourceInput = resourceInput; - } - - @JsonProperty("host") - public BpmnParam getHost() { - return host; - } - - @JsonProperty("host") - public void setHost(BpmnParam host) { - this.host = host; - } - - @JsonProperty("mso-request-id") - public BpmnParam getRequestId() { - return requestId; - } - - @JsonProperty("mso-request-id") - public void setRequestId(BpmnParam requestId) { - this.requestId = requestId; - } - - @JsonProperty("requestAction") - public BpmnParam getRequestAction() { - return requestAction; - } - - @JsonProperty("requestAction") - public void setRequestAction(BpmnParam requestAction) { - this.requestAction = requestAction; - } - - @JsonProperty("serviceInstanceId") - public BpmnParam getServiceInstanceId() { - return serviceInstanceId; - } - - @JsonProperty("serviceInstanceId") - public void setServiceInstanceId(BpmnParam serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } - - @JsonProperty("serviceType") - public BpmnParam getServiceType() { - return serviceType; - } - - @JsonProperty("serviceType") - public void setServiceType(BpmnParam serviceType) { - this.serviceType = serviceType; - } - - @JsonProperty("recipeParams") - public BpmnParam getRecipeParams() { - return recipeParams; - } - - @JsonProperty("recipeParams") - public void setRecipeParams(BpmnParam recipeParams) { - this.recipeParams = recipeParams; - } - - @JsonProperty("mso-service-request-timeout") - public BpmnParam getRecipeTimeout() { - return recipeTimeout; - } - - @JsonProperty("mso-service-request-timeout") - public void setRecipeTimeout(BpmnParam recipeTimeout) { - this.recipeTimeout = recipeTimeout; - } - - @Override - public String toString() { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - String jsonStr = "ResourceRecipeRequest"; - try { - jsonStr = mapper.writeValueAsString(this); - } catch(JsonProcessingException e) { - msoLogger.error("JsonProcessingException", e); - } - return jsonStr; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java deleted file mode 100644 index d1ec60a1cd..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java +++ /dev/null @@ -1,227 +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.bpmn.common.resource; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import javax.ws.rs.core.Response; - -import org.camunda.bpm.engine.runtime.Execution; -import org.jboss.resteasy.client.jaxrs.ResteasyClient; -import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; -import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; -import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; -import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException; -import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory; -import org.onap.sdc.toscaparser.api.NodeTemplate; -import org.onap.sdc.toscaparser.api.Property; -import org.onap.sdc.toscaparser.api.functions.GetInput; -import org.onap.sdc.toscaparser.api.parameters.Input; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; - -public class ResourceRequestBuilder { - - public static String CUSTOMIZATION_UUID = "customizationUUID"; - - public static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar?serviceModelUuid="; - - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - - static JsonUtils jsonUtil = new JsonUtils(); - - /** - * build the resource Parameters detail. - * It's a json string for resource instantiant - * { - * "locationConstraints":[...] - * "requestInputs":{K,V} - * } - *
- * - * @param execution Execution context - * @param serviceUuid The service template uuid - * @param resourceCustomizationUuid The resource customization uuid - * @param serviceParameters the service parameters passed from the API - * @return the resource instantiate parameters - * @since ONAP Beijing Release - */ - @SuppressWarnings("unchecked") - public static String buildResourceRequestParameters(Execution execution, String serviceUuid, String resourceCustomizationUuid, String serviceParameters) { - List resourceList = jsonUtil.StringArrayToList(execution, (String)JsonUtils.getJsonValue(serviceParameters, "resources")); - //Get the right location str for resource. default is an empty array. - String locationConstraints ="[]"; - String resourceInputsFromUui = ""; - for(String resource: resourceList){ - String resCusUuid = (String)JsonUtils.getJsonValue(resource, "resourceCustomizationUuid"); - if(resourceCustomizationUuid.equals(resCusUuid)){ - String resourceParameters = JsonUtils.getJsonValue(resource, "parameters"); - locationConstraints = JsonUtils.getJsonValue(resourceParameters, "locationConstraints"); - resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs"); - } - } - Map serviceInput = null; - if (JsonUtils.getJsonValue(serviceParameters, "requestInputs") != null) { - serviceInput = getJsonObject((String)JsonUtils.getJsonValue(serviceParameters, "requestInputs"), Map.class); - } - - Map resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class); - - if (serviceInput == null) { - serviceInput = new HashMap(); - } - - if (resourceInputsFromUuiMap == null) { - resourceInputsFromUuiMap = new HashMap(); - } - - try { - Map resourceInputsFromServiceDeclaredLevel = buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput); - resourceInputsFromUuiMap.putAll(resourceInputsFromServiceDeclaredLevel); - } catch(SdcToscaParserException e) { - LOGGER.error("SdcToscaParserException", e); - } - String resourceInputsStr = getJsonString(resourceInputsFromUuiMap); - String result = "{\n" - + "\"locationConstraints\":" + locationConstraints +",\n" - + "\"requestInputs\":" + resourceInputsStr +"\n" - +"}"; - return result; - } - - public static Map buildResouceRequest(String serviceUuid, String resourceCustomizationUuid, Map serviceInputs) - throws SdcToscaParserException { - - Map resouceRequest = new HashMap<>(); - String csarpath = null; - try { - csarpath = getCsarFromUuid(serviceUuid); - } catch(Exception e) { - LOGGER.debug("csar file is not available for service uuid:" + serviceUuid, e); - return resouceRequest; - } - - SdcToscaParserFactory toscaParser = SdcToscaParserFactory.getInstance(); - ISdcCsarHelper iSdcCsarHelper = toscaParser.getSdcCsarHelper(csarpath, false); - - List serInput = iSdcCsarHelper.getServiceInputs(); - Optional nodeTemplateOpt = iSdcCsarHelper.getServiceNodeTemplates().stream() - .filter(e -> e.getMetaData().getValue(CUSTOMIZATION_UUID).equals(resourceCustomizationUuid)).findFirst(); - - if(nodeTemplateOpt.isPresent()) { - NodeTemplate nodeTemplate = nodeTemplateOpt.get(); - LinkedHashMap resourceProperties = nodeTemplate.getProperties(); - - for(String key : resourceProperties.keySet()) { - Property property = resourceProperties.get(key); - - Object value = getValue(property.getValue(), serviceInputs, serInput); - resouceRequest.put(key, value); - } - } - return resouceRequest; - } - - private static Object getValue(Object value, Map serviceInputs, List servInputs) { - if(value instanceof Map) { - Map valueMap = new HashMap<>(); - - Map propertyMap = (Map)value; - - for(String key : propertyMap.keySet()) { - valueMap.put(key, getValue(propertyMap.get(key), serviceInputs, servInputs)); - } - return valueMap; // return if the value is nested hashmap - } else if(value instanceof GetInput) { - String inputName = ((GetInput)value).getInputName(); - - if(serviceInputs.get(inputName) != null) { - value = serviceInputs.get(inputName); - } else { - for(Input input : servInputs) { - if(input.getName().equals(inputName)) { - return input.getDefault(); // return default value - } - } - } - } - return value; // return property value - } - - private static String getCsarFromUuid(String uuid) throws Exception { - - ResteasyClient client = new ResteasyClientBuilder().build(); - Map properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - String catalogEndPoint = properties.get("mso.catalog.db.endpoint"); - ResteasyWebTarget target = client.target(catalogEndPoint + SERVICE_URL_TOSCA_CSAR + uuid); - Response response = target.request().get(); - String value = response.readEntity(String.class); - - HashMap map = new Gson().fromJson(value, new TypeToken>() {}.getType()); - - File csarFile = new File(System.getProperty("mso.config.path") + "ASDC/" + map.get("name")); - - if(!csarFile.exists()) { - throw new Exception("csar file does not exist."); - } - - return csarFile.getAbsolutePath(); - } - - public static T getJsonObject(String jsonstr, Class type) { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - try { - return mapper.readValue(jsonstr, type); - } catch(IOException e) { - LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "fail to unMarshal json", e); - } - return null; - } - - public static String getJsonString(Object srcObj) { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); - String jsonStr = null; - try { - jsonStr = mapper.writeValueAsString(srcObj); - } catch(JsonProcessingException e) { - LOGGER.error("SdcToscaParserException", e); - } - return jsonStr; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java deleted file mode 100644 index 13cff65018..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java +++ /dev/null @@ -1,68 +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.bpmn.common.util; -import java.io.IOException; -import java.security.GeneralSecurityException; -import org.openecomp.mso.logger.MsoLogger; -import java.util.Properties; - -public class CryptoHandler implements ICryptoHandler { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private static String msoKey = "aa3871669d893c7fb8abbcda31b88b4f"; - private static String msoAaiEncryptedPwd; - - @Override - public String getMsoAaiPassword() { - Properties keyProp = new Properties (); - try { - keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("urn.properties")); - msoAaiEncryptedPwd =(String) keyProp.get ("mso.AaiEncrypted.Pwd"); - return CryptoUtils.decrypt(msoAaiEncryptedPwd, msoKey); - } catch (GeneralSecurityException | IOException e) { - LOGGER.debug("GeneralSecurityException :",e); - return null; - } - } - - - @Override - public String encryptMsoPassword(String plainMsoPwd) { - try { - return CryptoUtils.encrypt(plainMsoPwd, msoKey); - } catch (GeneralSecurityException e) { - LOGGER.debug("GeneralSecurityException :",e); - return null; - } - } - - @Override - public String decryptMsoPassword(String encryptedPwd) { - try { - return CryptoUtils.decrypt(encryptedPwd, msoKey); - } catch (GeneralSecurityException e) { - LOGGER.debug("GeneralSecurityException :",e); - return null; - } - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java deleted file mode 100644 index 846b87aba8..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java +++ /dev/null @@ -1,98 +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.bpmn.common.util; - - -import java.security.GeneralSecurityException; -import java.security.NoSuchAlgorithmException; - -import javax.crypto.Cipher; -import javax.crypto.spec.SecretKeySpec; - -//Need to add BPM error handler - -/** - * CryptoUtils adapted from RTTP client. - * - */ -public class CryptoUtils { - - public static final String AES = "AES"; - - /** - * encrypt a value and generate a keyfile - * if the keyfile is not found then a new one is created - * @throws GeneralSecurityException - * */ - public static String encrypt(String value, String keyString) throws GeneralSecurityException - { - SecretKeySpec sks = getSecretKeySpec(keyString); - Cipher cipher = Cipher.getInstance(CryptoUtils.AES); - cipher.init(Cipher.ENCRYPT_MODE, sks, cipher.getParameters()); - byte[] encrypted = cipher.doFinal(value.getBytes()); - return byteArrayToHexString(encrypted); - } - - /** - * decrypt a value - * @throws GeneralSecurityException - */ - public static String decrypt(String message, String keyString) throws GeneralSecurityException - { - SecretKeySpec sks = getSecretKeySpec(keyString); - Cipher cipher = Cipher.getInstance(CryptoUtils.AES); - cipher.init(Cipher.DECRYPT_MODE, sks); - byte[] decrypted = cipher.doFinal(hexStringToByteArray(message)); - return new String(decrypted); - } - - private static SecretKeySpec getSecretKeySpec(String keyString) throws NoSuchAlgorithmException - { - byte [] key = hexStringToByteArray(keyString); - SecretKeySpec sks = new SecretKeySpec(key, CryptoUtils.AES); - return sks; - } - - - private static String byteArrayToHexString(byte[] b){ - StringBuilder sb = new StringBuilder(b.length * 2); - for (byte aB : b) { - int v = aB & 0xff; - if (v < 16) { - sb.append('0'); - } - sb.append(Integer.toHexString(v)); - } - return sb.toString().toUpperCase(); - } - - private static byte[] hexStringToByteArray(String s) { - byte[] b = new byte[s.length() / 2]; - for (int i = 0; i < b.length; i++){ - int index = i * 2; - int v = Integer.parseInt(s.substring(index, index + 2), 16); - b[i] = (byte)v; - } - return b; - } - -} - diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java deleted file mode 100644 index acf92f5aa8..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.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.bpmn.common.util; - -public interface ICryptoHandler { - public String getMsoAaiPassword(); - public String encryptMsoPassword(String plainPwd); - public String decryptMsoPassword(String encryptedPwd); -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java deleted file mode 100644 index f61c692775..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java +++ /dev/null @@ -1,421 +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.bpmn.common.workflow.service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.camunda.bpm.BpmPlatform; -import org.camunda.bpm.engine.MismatchingMessageCorrelationException; -import org.camunda.bpm.engine.OptimisticLockingException; -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.runtime.Execution; -import org.camunda.bpm.engine.runtime.MessageCorrelationResult; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * Abstract base class for callback services. - */ -public abstract class AbstractCallbackService extends ProcessEngineAwareService { - public static final long DEFAULT_TIMEOUT_SECONDS = 60; - public static final long FAST_POLL_DUR_SECONDS = 5; - public static final long FAST_POLL_INT_MS = 100; - public static final long SLOW_POLL_INT_MS = 1000; - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - /** - * Parameterized callback handler. - */ - protected CallbackResult handleCallback(String method, Object message, - String messageEventName, String messageVariable, - String correlationVariable, String correlationValue, - String logMarker) { - - return handleCallback(method, message, messageEventName, messageVariable, - correlationVariable, correlationValue, logMarker, null); - } - - /** - * Parameterized callback handler. - */ - protected CallbackResult handleCallback(String method, Object message, - String messageEventName, String messageVariable, - String correlationVariable, String correlationValue, - String logMarker, Map injectedVariables) { - - long startTime = System.currentTimeMillis(); - - LOGGER.debug(logMarker + " " + method + " received message: " - + (message == null ? "" : System.lineSeparator()) + message); - - try { - Map variables = new HashMap<>(); - - if (injectedVariables != null) { - variables.putAll(injectedVariables); - } - - variables.put(correlationVariable, correlationValue); - variables.put(messageVariable, message == null ? null : message.toString()); - - boolean ok = correlate(messageEventName, correlationVariable, - correlationValue, variables, logMarker); - - if (!ok) { - String msg = "No process is waiting for " + messageEventName - + " with " + correlationVariable + " = '" + correlationValue + "'"; - logCallbackError(method, startTime, msg); - return new CallbackError(msg); - } - - logCallbackSuccess(method, startTime); - return new CallbackSuccess(); - } catch (Exception e) { - LOGGER.debug("Exception :",e); - String msg = "Caught " + e.getClass().getSimpleName() - + " processing " + messageEventName + " with " + correlationVariable - + " = '" + correlationValue + "'"; - logCallbackError(method, startTime, msg); - return new CallbackError(msg); - } - } - - /** - * Performs message correlation. Waits a limited amount of time for - * a process to become ready for correlation. The return value indicates - * whether or not a process was found to receive the message. Due to the - * synchronous nature of message injection in Camunda, by the time this - * method returns, one of 3 things will have happened: (1) the process - * received the message and ended, (2) the process received the message - * and reached an activity that suspended, or (3) an exception occurred - * during correlation or while the process was executing. Correlation - * exceptions are handled differently from process execution exceptions. - * Correlation exceptions are thrown so the client knows something went - * wrong with the delivery of the message. Process execution exceptions - * are logged but not thrown. - * @param messageEventName the message event name - * @param correlationVariable the process variable used as the correlator - * @param correlationValue the correlation value - * @param variables variables to inject into the process - * @param logMarker a marker for debug logging - * @return true if a process could be found, false if not - * @throws Exception for correlation errors - */ - protected boolean correlate(String messageEventName, String correlationVariable, - String correlationValue, Map variables, String logMarker) - throws Exception { - try{ - LOGGER.debug(logMarker + " Attempting to find process waiting" - + " for " + messageEventName + " with " + correlationVariable - + " = '" + correlationValue + "'"); - - RuntimeService runtimeService = - getProcessEngineServices().getRuntimeService(); - - Map properties = - PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - - long timeout = DEFAULT_TIMEOUT_SECONDS; - - // The code is here in case we ever need to change the default. - String s = properties.get("mso.correlation.timeout"); - if (s != null) { - try { - timeout = Long.parseLong(s); - } catch (NumberFormatException e) { - // Ignore - } - } - - long now = System.currentTimeMillis(); - long fastPollEndTime = now + (FAST_POLL_DUR_SECONDS * 1000); - long endTime = now + (timeout * 1000); - long sleep = FAST_POLL_INT_MS; - - List waitingProcesses = null; - Exception queryException = null; - int queryCount = 0; - int queryFailCount = 0; - - while (true) { - try { - ++queryCount; - waitingProcesses = runtimeService.createExecutionQuery() - .messageEventSubscriptionName(messageEventName) - .processVariableValueEquals(correlationVariable, correlationValue) - .list(); - } catch (Exception e) { - ++queryFailCount; - queryException = e; - } - - if (waitingProcesses != null && waitingProcesses.size() > 0) { - break; - } - - if (now > endTime - sleep) { - break; - } - - Thread.sleep(sleep); - now = System.currentTimeMillis(); - - if (now > fastPollEndTime) { - sleep = SLOW_POLL_INT_MS; - } - } - - if (waitingProcesses == null) { - waitingProcesses = new ArrayList(0); - } - - int count = waitingProcesses.size(); - - List execInfoList = new ArrayList<>(count); - for (Execution execution : waitingProcesses) { - execInfoList.add(new ExecInfo(execution)); - } - - LOGGER.debug(logMarker + " Found " + count + " process(es) waiting" - + " for " + messageEventName + " with " + correlationVariable - + " = '" + correlationValue + "': " + execInfoList); - - if (count == 0) { - if (queryFailCount > 0) { - String msg = queryFailCount + "/" + queryCount - + " execution queries failed attempting to correlate " - + messageEventName + " with " + correlationVariable - + " = '" + correlationValue + "'; last exception was:" - + queryException; - LOGGER.debug(msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, queryException); - } - - return false; - } - - if (count > 1) { - // Only one process should be waiting. Throw an exception back to the client. - throw new MismatchingMessageCorrelationException(messageEventName, - "more than 1 process is waiting with " + correlationVariable - + " = '" + correlationValue + "'"); - } - - // We prototyped an asynchronous solution, i.e. resuming the process - // flow in a separate thread, but this affected too many existing tests, - // and we went back to the synchronous solution. The synchronous solution - // has some troublesome characteristics though. For example, the - // resumed flow may send request #2 to a remote system before MSO has - // acknowledged the notification associated with request #1. - - try { - LOGGER.debug(logMarker + " Running " + execInfoList.get(0) + " to receive " - + messageEventName + " with " + correlationVariable + " = '" - + correlationValue + "'"); - - @SuppressWarnings("unused") - MessageCorrelationResult result = runtimeService - .createMessageCorrelation(messageEventName) - .setVariables(variables) - .processInstanceVariableEquals(correlationVariable, correlationValue) - .correlateWithResult(); - - } catch (MismatchingMessageCorrelationException e) { - // A correlation exception occurred even after we identified - // one waiting process. Throw it back to the client. - throw e; - } catch (OptimisticLockingException ole) { - - String msg = "Caught " + ole.getClass().getSimpleName() + " after receiving " + messageEventName - + " with " + correlationVariable + " = '" + correlationValue - + "': " + ole; - LOGGER.debug(msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, ole); - - //Retry for OptimisticLocking Exceptions - int retryCount = 0; - String retryStr = properties.get("mso.bpmn.optimisticlockingexception.retrycount"); - if (retryStr != null) { - try { - retryCount = Integer.parseInt(retryStr); - } catch (NumberFormatException e) { - // Ignore - } - } - - LOGGER.debug("Retry correlate for OptimisticLockingException, retryCount:" + retryCount); - - for (; retryCount >0 ; retryCount--) { - - try{ - Thread.sleep(SLOW_POLL_INT_MS); - - @SuppressWarnings("unused") - MessageCorrelationResult result = runtimeService - .createMessageCorrelation(messageEventName) - .setVariables(variables) - .processInstanceVariableEquals(correlationVariable, correlationValue) - .correlateWithResult(); - retryCount = 0; - LOGGER.debug("OptimisticLockingException retry was successful, seting retryCount: " + retryCount); - } catch (OptimisticLockingException olex) { - //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException; - String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex; - LOGGER.debug(strMsg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, strMsg, olex); - } catch (Exception excep) { - retryCount = 0; - //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException; - String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + excep; - LOGGER.debug(strMsg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, strMsg, excep); - } - - } - - }catch (Exception e) { - // This must be an exception from the flow itself. Log it, but don't - // report it back to the client. - String msg = "Caught " + e.getClass().getSimpleName() + " running " - + execInfoList.get(0) + " after receiving " + messageEventName - + " with " + correlationVariable + " = '" + correlationValue - + "': " + e; - LOGGER.debug(msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, e); - } - } catch (Exception e) { - // This must be an exception from the flow itself. Log it, but don't - // report it back to the client. - String msg = "Caught " + e.getClass().getSimpleName() + " after receiving " + messageEventName - + " with " + correlationVariable + " = '" + correlationValue - + "': " + e; - LOGGER.debug(msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, e); - } - - return true; - } - - /** - * Records audit and metric events in the log for a callback success. - * @param method the method name - * @param startTime the request start time - */ - protected void logCallbackSuccess(String method, long startTime) { - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, - MsoLogger.ResponseCode.Suc, "Completed " + method); - - LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, - MsoLogger.ResponseCode.Suc, "Completed " + method, - "BPMN", MsoLogger.getServiceName(), null); - } - - /** - * Records error, audit and metric events in the log for a callback - * internal error. - * @param method the method name - * @param startTime the request start time - * @param msg the error message - */ - protected void logCallbackError(String method, long startTime, String msg) { - logCallbackError(method, startTime, msg, null); - } - - /** - * Records error, audit and metric events in the log for a callback - * internal error. - * @param method the method name - * @param startTime the request start time - * @param msg the error message - * @param e the exception - */ - protected void logCallbackError(String method, long startTime, String msg, Exception e) { - if (e == null) { - LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg); - } else { - LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, e); - } - - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, - MsoLogger.ResponseCode.InternalError, "Completed " + method); - - LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, - MsoLogger.ResponseCode.InternalError, "Completed " + method, - "BPMN", MsoLogger.getServiceName(), null); - } - - /** - * Abstract callback result object. - */ - protected abstract class CallbackResult { - } - - /** - * Indicates that callback handling was successful. - */ - protected class CallbackSuccess extends CallbackResult { - } - - /** - * Indicates that callback handling failed. - */ - protected class CallbackError extends CallbackResult { - private final String errorMessage; - - public CallbackError(String errorMessage) { - this.errorMessage = errorMessage; - } - - /** - * Gets the error message. - */ - public String getErrorMessage() { - return errorMessage; - } - } - - private static class ExecInfo { - private final Execution execution; - - public ExecInfo(Execution execution) { - this.execution = execution; - } - - @Override - public String toString() { - return "Process[" + execution.getProcessInstanceId() - + ":" + execution.getId() + "]"; - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/ProcessEngineAwareService.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/ProcessEngineAwareService.java deleted file mode 100644 index dbb6674a64..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/ProcessEngineAwareService.java +++ /dev/null @@ -1,64 +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.bpmn.common.workflow.service; - -import java.util.Optional; - -import org.camunda.bpm.engine.ProcessEngineServices; -import org.camunda.bpm.engine.ProcessEngines; - -/** - * Base class for services that must be process-engine aware. The only - * process engine currently supported is the "default" process engine. - */ -public class ProcessEngineAwareService { - - private final String processEngineName = "default"; - private volatile Optional pes4junit = Optional.empty(); - - /** - * Gets the process engine name. - * @return the process engine name - */ - public String getProcessEngineName() { - return processEngineName; - } - - /** - * Gets process engine services. - * @return process engine services - */ - public ProcessEngineServices getProcessEngineServices() { - return pes4junit.orElse(ProcessEngines.getProcessEngine( - getProcessEngineName())); - } - - /** - * Allows a particular process engine to be specified, overriding the - * usual process engine lookup by name. Intended primarily for the - * unit test environment. - * @param pes process engine services - */ - public void setProcessEngineServices4junit(ProcessEngineServices pes) { - pes4junit = Optional.ofNullable(pes); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java deleted file mode 100644 index c5f0d02dff..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java +++ /dev/null @@ -1,83 +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.bpmn.common.workflow.service; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.ws.rs.core.Context; -import javax.xml.ws.WebServiceContext; - -import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest; -import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse; -import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType; -import org.openecomp.mso.logger.MsoLogger; - -/** - * Implementation of SDNCAdapterCallbackService. - */ -@WebService(serviceName="SDNCAdapterCallbackService", targetNamespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") -public class SDNCAdapterCallbackServiceImpl extends AbstractCallbackService implements SDNCCallbackAdapterPortType { - - private final String logMarker = "[SDNC-CALLBACK]"; - - @Context WebServiceContext wsContext; - - @WebMethod(operationName = "SDNCAdapterCallback") - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") - public SDNCAdapterResponse sdncAdapterCallback( - @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest") - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest) { - - String method = "sdncAdapterCallback"; - Object message = sdncAdapterCallbackRequest; - String messageEventName = "sdncAdapterCallbackRequest"; - String messageVariable = "sdncAdapterCallbackRequest"; - String correlationVariable = "SDNCA_requestId"; - String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId(); - - MsoLogger.setServiceName("MSO." + method); - MsoLogger.setLogContext(correlationValue, "N/A"); - - CallbackResult result = handleCallback(method, message, messageEventName, - messageVariable, correlationVariable, correlationValue, logMarker); - - if (result instanceof CallbackError) { - return new SDNCAdapterErrorResponse(((CallbackError)result).getErrorMessage()); - } else { - return new SDNCAdapterResponse(); - } - } - - // This subclass allows unit tests to extract the error - public class SDNCAdapterErrorResponse extends SDNCAdapterResponse { - private String error; - - public SDNCAdapterErrorResponse(String error) { - this.error = error; - } - - public String getError() { - return error; - } - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java deleted file mode 100644 index 621e35e57d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java +++ /dev/null @@ -1,249 +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.bpmn.common.workflow.service; - -import javax.jws.Oneway; -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebService; -import javax.ws.rs.core.Context; -import javax.xml.ws.Action; -import javax.xml.ws.RequestWrapper; -import javax.xml.ws.WebServiceContext; - -import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification; -import org.openecomp.mso.bpmn.common.adapter.vnf.DeleteVnfNotification; -import org.openecomp.mso.bpmn.common.adapter.vnf.MsoExceptionCategory; -import org.openecomp.mso.bpmn.common.adapter.vnf.QueryVnfNotification; -import org.openecomp.mso.bpmn.common.adapter.vnf.RollbackVnfNotification; -import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification; -import org.openecomp.mso.bpmn.common.adapter.vnf.VnfAdapterNotify; -import org.openecomp.mso.bpmn.common.adapter.vnf.VnfRollback; -import org.openecomp.mso.bpmn.common.adapter.vnf.VnfStatus; -import org.openecomp.mso.logger.MsoLogger; - -/** - * Implementation of the VnfAdapterNotify service. - */ -@WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify") -public class VnfAdapterNotifyServiceImpl extends AbstractCallbackService implements VnfAdapterNotify{ - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private final String logMarker = "[VNF-NOTIFY]"; - - @Context WebServiceContext wsContext; - - @WebMethod(operationName = "rollbackVnfNotification") - @Oneway - @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.RollbackVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/rollbackVnfNotificationRequest") - public void rollbackVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage) { - - RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification(); - - rollbackVnfNotification.setMessageId(messageId); - rollbackVnfNotification.setCompleted(completed); - rollbackVnfNotification.setException(exception); - rollbackVnfNotification.setErrorMessage(errorMessage); - - String method = "rollbackVnfNotification"; - Object message = rollbackVnfNotification; - String messageEventName = "rollbackVnfNotificationCallback"; - String messageVariable = "rollbackVnfNotificationCallback"; - String correlationVariable = "VNFRB_messageId"; - String correlationValue = messageId; - - handleCallback(method, message, messageEventName, messageVariable, - correlationVariable, correlationValue, logMarker); - } - - @WebMethod(operationName = "queryVnfNotification") - @Oneway - @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.QueryVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/queryVnfNotificationRequest") - public void queryVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage, - @WebParam(name = "vnfExists", targetNamespace = "") - Boolean vnfExists, - @WebParam(name = "vnfId", targetNamespace = "") - String vnfId, - @WebParam(name = "status", targetNamespace = "") - VnfStatus status, - @WebParam(name = "outputs", targetNamespace = "") - QueryVnfNotification.Outputs outputs){ - - String method = "queryVnfNotification"; - String messageEventName = "queryVnfNotificationCallback"; - String messageVariable = "queryVnfNotificationCallback"; - String correlationVariable = "VNFQ_messageId"; - String correlationValue = messageId; - - MsoLogger.setServiceName("MSO." + method); - MsoLogger.setLogContext(correlationValue, "N/A"); - - QueryVnfNotification message = new QueryVnfNotification(); - - message.setMessageId(messageId); - message.setCompleted(completed); - message.setException(exception); - message.setErrorMessage(errorMessage); - message.setVnfExists(vnfExists); - message.setVnfId(vnfId); - message.setStatus(status); - message.setOutputs(outputs); - - handleCallback(method, message, messageEventName, messageVariable, - correlationVariable, correlationValue, logMarker); - } - - @WebMethod(operationName = "createVnfNotification") - @Oneway - @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.CreateVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/createVnfNotificationRequest") - public void createVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage, - @WebParam(name = "vnfId", targetNamespace = "") - String vnfId, - @WebParam(name = "outputs", targetNamespace = "") - CreateVnfNotification.Outputs outputs, - @WebParam(name = "rollback", targetNamespace = "") - VnfRollback rollback){ - - String method = "createVnfNotification"; - String messageEventName = "createVnfNotificationCallback"; - String messageVariable = "createVnfNotificationCallback"; - String correlationVariable = "VNFC_messageId"; - String correlationValue = messageId; - - MsoLogger.setServiceName("MSO." + method); - MsoLogger.setLogContext(correlationValue, "N/A"); - - CreateVnfNotification message = new CreateVnfNotification(); - - message.setMessageId(messageId); - message.setCompleted(completed); - message.setException(exception); - message.setErrorMessage(errorMessage); - message.setVnfId(vnfId); - message.setOutputs(outputs); - message.setRollback(rollback); - - handleCallback(method, message, messageEventName, messageVariable, - correlationVariable, correlationValue, logMarker); - } - - @WebMethod(operationName = "updateVnfNotification") - @Oneway - @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.UpdateVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest") - public void updateVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage, - @WebParam(name = "outputs", targetNamespace = "") - UpdateVnfNotification.Outputs outputs, - @WebParam(name = "rollback", targetNamespace = "") - VnfRollback rollback){ - - String method = "updateVnfNotification"; - String messageEventName = "updateVnfNotificationCallback"; - String messageVariable = "updateVnfNotificationCallback"; - String correlationVariable = "VNFU_messageId"; - String correlationValue = messageId; - - MsoLogger.setServiceName("MSO." + method); - MsoLogger.setLogContext(correlationValue, "N/A"); - - UpdateVnfNotification message = new UpdateVnfNotification(); - - message.setMessageId(messageId); - message.setCompleted(completed); - message.setException(exception); - message.setErrorMessage(errorMessage); - message.setOutputs(outputs); - message.setRollback(rollback); - - handleCallback(method, message, messageEventName, messageVariable, - correlationVariable, correlationValue, logMarker); - } - - @WebMethod(operationName = "deleteVnfNotification") - @Oneway - @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.DeleteVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/deleteVnfNotificationRequest") - public void deleteVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage) { - - String method = "deleteVnfNotification"; - String messageEventName = "deleteVnfACallback"; - String messageVariable = "deleteVnfACallback"; - String correlationVariable = "VNFDEL_uuid"; - String correlationValue = messageId; - - MsoLogger.setServiceName("MSO." + method); - MsoLogger.setLogContext(correlationValue, "N/A"); - - DeleteVnfNotification message = new DeleteVnfNotification(); - - message.setMessageId(messageId); - message.setCompleted(completed); - message.setException(exception); - message.setErrorMessage(errorMessage); - - handleCallback(method, message, messageEventName, messageVariable, - correlationVariable, correlationValue, logMarker); - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java deleted file mode 100644 index cd98860efe..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java +++ /dev/null @@ -1,33 +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.bpmn.common.workflow.service; - -import org.camunda.bpm.engine.ProcessEngineServices; -import org.camunda.bpm.engine.ProcessEngines; - - -public class WorkflowAsyncCommonResource extends WorkflowAsyncResource { - - @Override - public String getProcessEngineName() { - return "default"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java deleted file mode 100644 index b4543b1445..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java +++ /dev/null @@ -1,289 +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.bpmn.common.workflow.service; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.UUID; - -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.Response; - -import org.camunda.bpm.engine.ProcessEngineServices; -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.runtime.ProcessInstance; -import org.camunda.bpm.engine.variable.impl.VariableMapImpl; -import org.jboss.resteasy.annotations.Suspend; -import org.jboss.resteasy.spi.AsynchronousResponse; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.slf4j.MDC; - -/** - * - * @version 1.0 - * Asynchronous Workflow processing using JAX RS RESTeasy implementation - * Both Synchronous and Asynchronous BPMN process can benefit from this implementation since the workflow gets executed in the background - * and the server thread is freed up, server scales better to process more incoming requests - * - * Usage: For synchronous process, when you are ready to send the response invoke the callback to write the response - * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process - */ -@Path("/async") -public class WorkflowAsyncResource extends ProcessEngineAwareService { - - private static final WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); - protected Optional pes4junit = Optional.empty(); - - private final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private static final String logMarker = "[WRKFLOW-RESOURCE]"; - private static final long DEFAULT_WAIT_TIME = 30000; //default wait time - - /** - * Asynchronous JAX-RS method that starts a process instance. - * @param asyncResponse an object that will receive the asynchronous response - * @param processKey the process key - * @param variableMap input variables to the process - */ - @POST - @Path("/services/{processKey}") - @Produces("application/json") - @Consumes("application/json") - public void startProcessInstanceByKey(final @Suspend(180000) AsynchronousResponse asyncResponse, - @PathParam("processKey") String processKey, VariableMapImpl variableMap) { - - long startTime = System.currentTimeMillis(); - Map inputVariables = null; - WorkflowContext workflowContext = null; - - try { - inputVariables = getInputVariables(variableMap); - setLogContext(processKey, inputVariables); - - // This variable indicates that the flow was invoked asynchronously - inputVariables.put("isAsyncProcess", "true"); - - workflowContext = new WorkflowContext(processKey, getRequestId(inputVariables), - asyncResponse, getWaitTime(inputVariables)); - - msoLogger.debug("Adding the workflow context into holder: " - + workflowContext.getProcessKey() + ":" - + workflowContext.getRequestId() + ":" - + workflowContext.getTimeout()); - - contextHolder.put(workflowContext); - - ProcessThread processThread = new ProcessThread(processKey, inputVariables); - processThread.start(); - } catch (Exception e) { - setLogContext(processKey, inputVariables); - - if (workflowContext != null) { - contextHolder.remove(workflowContext); - } - - msoLogger.debug(logMarker + "Exception in startProcessInstance by key"); - WorkflowResponse response = new WorkflowResponse(); - response.setMessage("Fail" ); - response.setContent("Error occurred while executing the process: " + e); - response.setMessageCode(500); - recordEvents(processKey, response, startTime); - - msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logMarker - + response.getMessage() + " for processKey: " - + processKey + " with content: " + response.getContent()); - - Response errorResponse = Response.serverError().entity(response).build(); - asyncResponse.setResponse(errorResponse); - } - } - - /** - * - * @version 1.0 - * - */ - class ProcessThread extends Thread { - private final String processKey; - private final Map inputVariables; - - public ProcessThread(String processKey, Map inputVariables) { - this.processKey = processKey; - this.inputVariables = inputVariables; - } - - public void run() { - - String processInstanceId = null; - long startTime = System.currentTimeMillis(); - - try { - setLogContext(processKey, inputVariables); - - // Note: this creates a random businessKey if it wasn't specified. - String businessKey = getBusinessKey(inputVariables); - - msoLogger.debug(logMarker + "***Received MSO startProcessInstanceByKey with processKey: " - + processKey + " and variables: " + inputVariables); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker - + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with processKey:" - + processKey + " and variables: " + inputVariables); - - RuntimeService runtimeService = getProcessEngineServices().getRuntimeService(); - ProcessInstance processInstance = runtimeService.startProcessInstanceByKey( - processKey, businessKey, inputVariables); - processInstanceId = processInstance.getId(); - - msoLogger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " " + - (processInstance.isEnded() ? "ENDED" : "RUNNING")); - } catch (Exception e) { - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, - logMarker + "Error in starting the process: "+ e.getMessage()); - - WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse(); - callbackResponse.setStatusCode(500); - callbackResponse.setMessage("Fail"); - callbackResponse.setResponse("Error occurred while executing the process: " + e); - - // TODO: is the processInstanceId used by the API handler? I don't think so. - // It may be null here. - WorkflowContextHolder.getInstance().processCallback( - processKey, processInstanceId, - getRequestId(inputVariables), - callbackResponse); - } - } - } - - - /** - * Callback resource which is invoked from BPMN to process to send the workflow response - * - * @param processKey - * @param processInstanceId - * @param requestId - * @param callbackResponse - * @return - */ - @POST - @Path("/services/callback/{processKey}/{processInstanceId}/{requestId}") - @Produces("application/json") - @Consumes("application/json") - public Response processWorkflowCallback( - @PathParam("processKey") String processKey, - @PathParam("processInstanceId") String processInstanceId, - @PathParam("requestId")String requestId, - WorkflowCallbackResponse callbackResponse) { - - msoLogger.debug(logMarker + "Process instance ID:" + processInstanceId + ":" + requestId + ":" + processKey + ":" + isProcessEnded(processInstanceId)); - msoLogger.debug(logMarker + "About to process the callback request:" + callbackResponse.getResponse() + ":" + callbackResponse.getMessage() + ":" + callbackResponse.getStatusCode()); - return contextHolder.processCallback(processKey, processInstanceId, requestId, callbackResponse); - } - - private static String getOrCreate(Map inputVariables, String key) { - String value = Objects.toString(inputVariables.get(key), null); - if (value == null) { - value = UUID.randomUUID().toString(); - inputVariables.put(key, value); - } - return value; - } - - // Note: the business key is used to identify the process in unit tests - private static String getBusinessKey(Map inputVariables) { - return getOrCreate(inputVariables, "mso-business-key"); - } - - private static String getRequestId(Map inputVariables) { - return getOrCreate(inputVariables, "mso-request-id"); - } - - private long getWaitTime(Map inputVariables) - { - - String timeout = Objects.toString(inputVariables.get("mso-service-request-timeout"), null); - - if (timeout != null) { - try { - return Long.parseLong(timeout)*1000; - } catch (NumberFormatException nex) { - msoLogger.debug("Invalid input for mso-service-request-timeout"); - } - } - - return DEFAULT_WAIT_TIME; - } - - private void recordEvents(String processKey, WorkflowResponse response, - long startTime) { - - msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - logMarker + response.getMessage() + " for processKey: " - + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - logMarker + response.getMessage() + "for processKey: " + processKey + " with content: " + response.getContent()); - - } - - private static void setLogContext(String processKey, - Map inputVariables) { - MsoLogger.setServiceName("MSO." + processKey); - if (inputVariables != null) { - MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"mso-service-instance-id")); - } - } - - private static String getKeyValueFromInputVariables(Map inputVariables, String key) { - if (inputVariables == null) { - return ""; - } - - return Objects.toString(inputVariables.get(key), "N/A"); - } - - private boolean isProcessEnded(String processInstanceId) { - ProcessEngineServices pes = getProcessEngineServices(); - return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null; - } - - private static Map getInputVariables(VariableMapImpl variableMap) { - Map inputVariables = new HashMap<>(); - @SuppressWarnings("unchecked") - Map vMap = (Map) variableMap.get("variables"); - for (Map.Entry entry : vMap.entrySet()) { - String vName = entry.getKey(); - Object value = entry.getValue(); - @SuppressWarnings("unchecked") - Map valueMap = (Map)value; // value, type - inputVariables.put(vName, valueMap.get("value")); - } - return inputVariables; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java deleted file mode 100644 index 25669d7625..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java +++ /dev/null @@ -1,52 +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.bpmn.common.workflow.service; - -/** - * @version 1.0 - * Workflow Response bean to generate workflow response in JSON format - */ -public class WorkflowCallbackResponse { - - private String response; - private int statusCode; - private String message; - - public String getResponse() { - return response; - } - public void setResponse(String response) { - this.response = response; - } - public int getStatusCode() { - return statusCode; - } - public void setStatusCode(int statusCode) { - this.statusCode = statusCode; - } - public String getMessage() { - return message; - } - public void setMessage(String message) { - this.message = message; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java deleted file mode 100644 index fc0ba44974..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.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.bpmn.common.workflow.service; - -import java.util.concurrent.Delayed; -import java.util.concurrent.TimeUnit; - -import org.jboss.resteasy.spi.AsynchronousResponse; - -/** - * @version 1.0 - * Workflow context object used to send timeout response, if workflow instance does not write the response in time - */ -public class WorkflowContext implements Delayed { - private final String processKey; - private final String requestId; - private final AsynchronousResponse asynchronousResponse; - private final long startTime; - private final long timeout; - - public WorkflowContext(String processKey, String requestId, - AsynchronousResponse asynchronousResponse, long timeout) { - this.processKey = processKey; - this.requestId = requestId; - this.asynchronousResponse = asynchronousResponse; - this.timeout = timeout; - this.startTime = System.currentTimeMillis(); - } - - public String getRequestId() { - return requestId; - } - - public String getProcessKey() { - return processKey; - } - - public AsynchronousResponse getAsynchronousResponse() { - return asynchronousResponse; - } - - public long getTimeout() { - return timeout; - } - - public long getStartTime() { - return startTime; - } - - /** - * Required implementation by Delay queue - * Returns the elapsed time for this context - */ - @Override - public long getDelay(TimeUnit unit) { - // 0 or negative means this object is considered to be expired - return unit.convert(startTime + timeout - System.currentTimeMillis(), unit); - } - - /** - * Required implementation by Delay queue - * Compares the object to determine whether the object can be marked as expired - */ - @Override - public int compareTo(Delayed object) { - WorkflowContext that = (WorkflowContext) object; - long thisEndTime = startTime + timeout; - long thatEndTime = that.startTime + that.timeout; - - if (thisEndTime < thatEndTime) { - return -1; - } else if (thisEndTime > thatEndTime) { - return 1; - } else { - return 0; - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java deleted file mode 100644 index 4dfae8b2a3..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java +++ /dev/null @@ -1,188 +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.bpmn.common.workflow.service; - -import java.util.concurrent.DelayQueue; -import java.util.concurrent.TimeUnit; - -import javax.ws.rs.core.Response; - -import org.jboss.resteasy.spi.AsynchronousResponse; -import org.slf4j.MDC; - -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * Workflow Context Holder instance which can be accessed elsewhere either in groovy scripts or Java - * @version 1.0 - * - */ -public class WorkflowContextHolder { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - private static final String logMarker = "[WORKFLOW-CONTEXT-HOLDER]"; - private static WorkflowContextHolder instance = null; - - /** - * Delay Queue which holds workflow context holder objects - */ - private final DelayQueue responseQueue = new DelayQueue<>(); - private final TimeoutThread timeoutThread = new TimeoutThread(); - - private WorkflowContextHolder() { - timeoutThread.start(); - } - - /** - * Singleton holder which eliminates hot lock - * Since the JVM synchronizes static method there is no synchronization needed for this method - * @return - */ - public static synchronized WorkflowContextHolder getInstance() { - if (instance == null) { - instance = new WorkflowContextHolder(); - } - return instance; - } - - public void put(WorkflowContext context) { - msoLogger.debug(logMarker + " Adding context to the queue: " - + context.getRequestId()); - responseQueue.put(context); - } - - public void remove(WorkflowContext context) { - msoLogger.debug(logMarker + " Removing context from the queue: " - + context.getRequestId()); - responseQueue.remove(context); - } - - public WorkflowContext getWorkflowContext(String requestId) { - // Note: DelayQueue interator is threadsafe - for (WorkflowContext context : responseQueue) { - if (requestId.equals(context.getRequestId())) { - msoLogger.debug("Found context for request id: " + requestId); - return context; - } - } - - msoLogger.debug("Unable to find context for request id: " + requestId); - return null; - } - - /** - * Builds the callback response object to respond to client - * @param processKey - * @param processInstanceId - * @param requestId - * @param callbackResponse - * @return - */ - public Response processCallback(String processKey, String processInstanceId, - String requestId, WorkflowCallbackResponse callbackResponse) { - WorkflowResponse workflowResponse = new WorkflowResponse(); - WorkflowContext workflowContext = getWorkflowContext(requestId); - - if (workflowContext == null) { - msoLogger.debug("Unable to correlate workflow context for request id: " + requestId - + ":processInstance Id:" + processInstanceId - + ":process key:" + processKey); - workflowResponse.setMessage("Fail"); - workflowResponse.setMessageCode(400); - workflowResponse.setContent("Unable to correlate workflow context, bad request. Request Id: " + requestId); - return Response.serverError().entity(workflowResponse).build(); - } - - responseQueue.remove(workflowContext); - - msoLogger.debug("Using callback response for request id: " + requestId); - workflowResponse.setContent(callbackResponse.getResponse()); - workflowResponse.setProcessInstanceId(processInstanceId); - workflowResponse.setMessageCode(callbackResponse.getStatusCode()); - workflowResponse.setMessage(callbackResponse.getMessage()); - sendWorkflowResponseToClient(processKey, workflowContext, workflowResponse); - return Response.ok().entity(workflowResponse).build(); - } - - /** - * Send the response to client asynchronously when invoked by the BPMN process - * @param processKey - * @param workflowContext - * @param workflowResponse - */ - private void sendWorkflowResponseToClient(String processKey, WorkflowContext workflowContext, - WorkflowResponse workflowResponse) { - msoLogger.debug(logMarker + "Sending the response for request id: " + workflowContext.getRequestId()); - recordEvents(processKey, workflowResponse, workflowContext.getStartTime()); - Response response = Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build(); - AsynchronousResponse asyncResp = workflowContext.getAsynchronousResponse(); - asyncResp.setResponse(response); - } - - /** - * Timeout thread which monitors the delay queue for expired context and send timeout response - * to client - *git review -R - * */ - private class TimeoutThread extends Thread { - public void run() { - while (!isInterrupted()) { - try { - WorkflowContext requestObject = responseQueue.take(); - msoLogger.debug("Time remaining for request id: " + requestObject.getRequestId() + ":" + requestObject.getDelay(TimeUnit.MILLISECONDS)); - msoLogger.debug("Preparing timeout response for " + requestObject.getProcessKey() + ":" + ":" + requestObject.getRequestId()); - WorkflowResponse response = new WorkflowResponse(); - response.setMessage("Fail"); - response.setContent("Request timedout, request id:" + requestObject.getRequestId()); - //response.setProcessInstanceID(requestObject.getProcessInstance().getProcessInstanceId()); - recordEvents(requestObject.getProcessKey(), response, requestObject.getStartTime()); - response.setMessageCode(500); - Response result = Response.status(500).entity(response).build(); - requestObject.getAsynchronousResponse().setResponse(result); - msoLogger.debug("Sending timeout response for request id:" + requestObject.getRequestId() + ":response:" + response); - } catch (InterruptedException e) { - break; - } catch (Exception e) { - msoLogger.debug("WorkflowContextHolder timeout thread caught exception: " + e); - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, "Error in WorkflowContextHolder timeout thread"); - - } - } - - msoLogger.debug("WorkflowContextHolder timeout thread interrupted, quitting"); - } - } - - private static void recordEvents(String processKey, WorkflowResponse response, - long startTime) { - - msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - logMarker + response.getMessage() + " for processKey: " - + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker - + response.getMessage() + " for processKey: " - + processKey + " with content: " + response.getContent()); - - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java deleted file mode 100644 index 4ba35907b9..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java +++ /dev/null @@ -1,108 +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.bpmn.common.workflow.service; - -import java.util.HashMap; -import java.util.Map; - -import javax.ws.rs.Consumes; -import javax.ws.rs.HeaderParam; -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.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * Generalized REST interface that injects a message event into a waiting BPMN process. - * Examples: - *
- *     /WorkflowMessage/SDNCAResponse/6d10d075-100c-42d0-9d84-a52432681cae-1478486185286
- *     /WorkflowMessage/SDNCAEvent/USOSTCDALTX0101UJZZ01
- * 
- */ -@Path("/") -public class WorkflowMessageResource extends AbstractCallbackService { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - private static final String LOGMARKER = "[WORKFLOW-MESSAGE]"; - - @POST - @Path("/WorkflowMessage/{messageType}/{correlator}") - @Consumes("*/*") - @Produces(MediaType.TEXT_PLAIN) - public Response deliver( - @HeaderParam("Content-Type") String contentType, - @PathParam("messageType") String messageType, - @PathParam("correlator") String correlator, - String message) { - - String method = "receiveWorkflowMessage"; - MsoLogger.setServiceName("MSO." + method); - MsoLogger.setLogContext(correlator, "N/A"); - - LOGGER.debug(LOGMARKER + " Received workflow message" - + " type='" + messageType + "'" - + " correlator='" + correlator + "'" - + (contentType == null ? "" : " contentType='" + contentType + "'") - + " message=" + System.lineSeparator() + message); - - if (messageType == null || messageType.isEmpty()) { - String msg = "Missing message type"; - LOGGER.debug(LOGMARKER + " " + msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg); - return Response.status(400).entity(msg).build(); - } - - if (correlator == null || correlator.isEmpty()) { - String msg = "Missing correlator"; - LOGGER.debug(LOGMARKER + " " + msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg); - return Response.status(400).entity(msg).build(); - } - - String messageEventName = "WorkflowMessage"; - String messageVariable = messageType + "_MESSAGE"; - String correlationVariable = messageType + "_CORRELATOR"; - String correlationValue = correlator; - String contentTypeVariable = messageType + "_CONTENT_TYPE"; - - Map variables = new HashMap<>(); - - if (contentType != null) { - variables.put(contentTypeVariable, contentType); - } - - CallbackResult result = handleCallback(method, message, messageEventName, - messageVariable, correlationVariable, correlationValue, LOGMARKER, variables); - - if (result instanceof CallbackError) { - return Response.status(500).entity(((CallbackError)result).getErrorMessage()).build(); - } else { - return Response.status(204).build(); - } - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java deleted file mode 100644 index 25c67fed63..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java +++ /dev/null @@ -1,615 +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.bpmn.common.workflow.service; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicLong; - -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.Context; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -import org.camunda.bpm.engine.HistoryService; -import org.camunda.bpm.engine.ProcessEngineException; -import org.camunda.bpm.engine.ProcessEngineServices; -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.history.HistoricVariableInstance; -import org.camunda.bpm.engine.runtime.ProcessInstance; -import org.camunda.bpm.engine.variable.VariableMap; -import org.camunda.bpm.engine.variable.Variables; -import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats; -import org.camunda.bpm.engine.variable.impl.VariableMapImpl; -import org.openecomp.mso.bpmn.core.WorkflowException; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.slf4j.MDC; - -@Path("/workflow") -public class WorkflowResource extends ProcessEngineAwareService { - - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - private static final String LOGMARKER = "[WRKFLOW-RESOURCE]"; - - private static final int DEFAULT_WAIT_TIME = 30000; - - @Context - private UriInfo uriInfo = null; - - /** - * Starts the process instance and responds to client synchronously - * If the request does not contain mso-service-request-timeout then it waits for the value specified in DEFAULT_WAIT_TIME - * Note: value specified in mso-service-request-timeout is in seconds - * During polling time, if there is an exception encountered in the process execution then polling is stopped and the error response is - * returned to the client - * @param processKey - * @param variableMap - * @return - */ - @POST - @Path("/services/{processKey}") - @Produces("application/json") - @Consumes("application/json") - public Response startProcessInstanceByKey(@PathParam("processKey") String processKey, - VariableMapImpl variableMap) { - - Map inputVariables = getInputVariables(variableMap); - setLogContext(processKey, inputVariables); - - WorkflowResponse workflowResponse = new WorkflowResponse(); - long startTime = System.currentTimeMillis(); - ProcessInstance processInstance = null; - - try { - //Kickoff the process - ProcessThread thread = new ProcessThread(inputVariables,processKey,msoLogger); - thread.start(); - - Map responseMap = null; - - //wait for process to be completed - long waitTime = getWaitTime(inputVariables); - long now = System.currentTimeMillis(); - long start = now; - long endTime = start + waitTime; - long pollingInterval = 500; - - // TEMPORARY LOGIC FOR UNIT TEST REFACTORING - // If this is a unit test (method is invoked directly), wait a max - // of 5 seconds after process ended for a result. In production, - // wait up to 60 seconds. - long timeToWaitAfterProcessEnded = uriInfo == null ? 5000 : 60000; - AtomicLong timeProcessEnded = new AtomicLong(0); - boolean endedWithNoResponse = false; - - while (now <= endTime) { - Thread.sleep(pollingInterval); - - now = System.currentTimeMillis(); - - // Increase the polling interval over time - - long elapsed = now - start; - - if (elapsed > 60000) { - pollingInterval = 5000; - } else if (elapsed > 10000) { - pollingInterval = 1000; - } - Exception exception = thread.getException(); - if (exception != null) { - throw new Exception(exception); - } - - processInstance = thread.getProcessInstance(); - - if (processInstance == null) { - msoLogger.debug(LOGMARKER + processKey + " process has not been created yet"); - continue; - } - - String processInstanceId = processInstance.getId(); - workflowResponse.setProcessInstanceId(processInstanceId); - - responseMap = getResponseMap(processInstance, processKey, timeProcessEnded); - - if (responseMap == null) { - msoLogger.debug(LOGMARKER + processKey + " has not produced a response yet"); - - if (timeProcessEnded.longValue() != 0) { - long elapsedSinceEnded = System.currentTimeMillis() - timeProcessEnded.longValue(); - - if (elapsedSinceEnded > timeToWaitAfterProcessEnded) { - endedWithNoResponse = true; - break; - } - } - } else { - processResponseMap(workflowResponse, responseMap); - recordEvents(processKey, workflowResponse, startTime); - return Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build(); - } - } - - //if we dont get response after waiting then send timeout response - - String state; - String processInstanceId; - - if (processInstance == null) { - processInstanceId = "N/A"; - state = "NOT STARTED"; - } else { - processInstanceId = processInstance.getProcessInstanceId(); - state = isProcessEnded(processInstanceId) ? "ENDED" : "NOT ENDED"; - } - - workflowResponse.setMessage("Fail"); - if (endedWithNoResponse) { - workflowResponse.setContent("Process ended without producing a response"); - } else { - workflowResponse.setContent("Request timed out, process state: " + state); - } - workflowResponse.setProcessInstanceId(processInstanceId); - recordEvents(processKey, workflowResponse, startTime); - workflowResponse.setMessageCode(500); - return Response.status(500).entity(workflowResponse).build(); - } catch (Exception ex) { - msoLogger.debug(LOGMARKER + "Exception in startProcessInstance by key",ex); - workflowResponse.setMessage("Fail" ); - workflowResponse.setContent("Error occurred while executing the process: " + ex.getMessage()); - if (processInstance != null) workflowResponse.setProcessInstanceId(processInstance.getId()); - - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), - MsoLogger.ErrorCode.UnknownError, LOGMARKER + workflowResponse.getMessage() - + " for processKey: " + processKey + " with content: " + workflowResponse.getContent()); - - workflowResponse.setMessageCode(500); - recordEvents(processKey, workflowResponse, startTime); - return Response.status(500).entity(workflowResponse).build(); - } - } - - /** - * Returns the wait time, this is used by the resource on how long it should wait to send a response - * If none specified DEFAULT_WAIT_TIME is used - * @param inputVariables - * @return - */ - private int getWaitTime(Map inputVariables) - { - String timeout = inputVariables.get("mso-service-request-timeout") == null - ? null : inputVariables.get("mso-service-request-timeout").toString(); - - if (timeout != null) { - try { - return Integer.parseInt(timeout)*1000; - } catch (NumberFormatException nex) { - msoLogger.debug("Invalid input for mso-service-request-timeout"); - } - } - return DEFAULT_WAIT_TIME; - } - - private void recordEvents(String processKey, WorkflowResponse response, long startTime) { - - msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - LOGMARKER + response.getMessage() + " for processKey: " - + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - LOGMARKER + response.getMessage() + " for processKey: " - + processKey + " with content: " + response.getContent()); - } - - private void setLogContext(String processKey, Map inputVariables) { - MsoLogger.setServiceName("MSO." + processKey); - if (inputVariables != null) { - MsoLogger.setLogContext(getValueFromInputVariables(inputVariables, "mso-request-id"), - getValueFromInputVariables(inputVariables, "mso-service-instance-id")); - } - } - - private String getValueFromInputVariables(Map inputVariables, String key) { - Object value = inputVariables.get(key); - if (value == null) { - return "N/A"; - } else { - return value.toString(); - } - } - - /** - * Checks to see if the specified process is ended. - * @param processInstanceId the process instance ID - * @return true if the process is ended - */ - private boolean isProcessEnded(String processInstanceId) { - ProcessEngineServices pes = getProcessEngineServices(); - try { - return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ; - } catch (Exception e) { - msoLogger.debug("Exception :",e); - return true; - } - } - - private void processResponseMap(WorkflowResponse workflowResponse, Map responseMap) { - Object object = responseMap.get("Response"); - String content = object == null ? null : String.valueOf(object); - if (content == null){ - object = responseMap.get("WorkflowResponse"); - content = object == null ? null : String.valueOf(object); - } - - workflowResponse.setContent(content); - - object = responseMap.get("ResponseCode"); - String responseCode = object == null ? null : String.valueOf(object); - - try { - workflowResponse.setMessageCode(Integer.parseInt(responseCode)); - } catch(NumberFormatException nex) { - msoLogger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode); - workflowResponse.setMessageCode(-1); - } - - Object status = responseMap.get("Status"); - - if ("Success".equalsIgnoreCase(String.valueOf(status))) { - workflowResponse.setMessage("Success"); - } else if ("Fail".equalsIgnoreCase(String.valueOf(status))) { - workflowResponse.setMessage("Fail"); - } else { - msoLogger.debug(LOGMARKER + "Unrecognized Status: " + responseCode); - workflowResponse.setMessage("Fail"); - } - } - - /** - * @version 1.0 - * Triggers the workflow in a separate thread - */ - private class ProcessThread extends Thread { - private final Map inputVariables; - private final String processKey; - private final MsoLogger msoLogger; - private final String businessKey; - private ProcessInstance processInstance = null; - private Exception exception = null; - - public ProcessThread(Map inputVariables, String processKey, MsoLogger msoLogger) { - this.inputVariables = inputVariables; - this.processKey = processKey; - this.msoLogger = msoLogger; - this.businessKey = UUID.randomUUID().toString(); - } - - /** - * If an exception occurs when starting the process instance, it may - * be obtained by calling this method. Note that exceptions are only - * recorded while the process is executing in its original thread. - * Once a process is suspended, exception recording stops. - * @return the exception, or null if none has occurred - */ - public Exception getException() { - return exception; - } - - - public ProcessInstance getProcessInstance() { - return this.processInstance; - } - - /** - * Sets the process instance exception. - * @param exception the exception - */ - private void setException(Exception exception) { - this.exception = exception; - } - - public void run() { - setLogContext(processKey, inputVariables); - - long startTime = System.currentTimeMillis(); - - try { - msoLogger.debug(LOGMARKER + "***Received MSO startProcessInstanceByKey with processKey:" - + processKey + " and variables: " + inputVariables); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER - + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with" - + " processKey:" + processKey - + " businessKey:" + businessKey - + " variables: " + inputVariables); - - RuntimeService runtimeService = getProcessEngineServices().getRuntimeService(); - - // Note that this method doesn't return until the process suspends - // itself or finishes. We provide a business key so we can identify - // the process instance immediately. - processInstance = runtimeService.startProcessInstanceByKey( - processKey, inputVariables); - - } catch (Exception e) { - msoLogger.debug(LOGMARKER + "ProcessThread caught an exception executing " - + processKey + ": " + e); - setException(e); - } - } - - } - - private Map getInputVariables(VariableMapImpl variableMap) { - VariableMap inputVariables = Variables.createVariables(); - @SuppressWarnings("unchecked") - Map vMap = (Map) variableMap.get("variables"); - for (String key : vMap.keySet()) { //variabe name vn - @SuppressWarnings("unchecked") - Map valueMap = (Map)vMap.get(key); //value, type - inputVariables.putValueTyped(key, Variables - .objectValue(valueMap.get("value")) - .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value - .create()); - } - return inputVariables; - } - - /** - * Attempts to get a response map from the specified process instance. - * @return the response map, or null if it is unavailable - */ - private Map getResponseMap(ProcessInstance processInstance, - String processKey, AtomicLong timeProcessEnded) { - - String responseMapVariable = processKey + "ResponseMap"; - String processInstanceId = processInstance.getId(); - - // Query the runtime service to see if a response map is ready. - -/* RuntimeService runtimeService = getProcessEngineServices().getRuntimeService(); - List executions = runtimeService.createExecutionQuery() - .processInstanceId(processInstanceId).list(); - - for (Execution execution : executions) { - @SuppressWarnings("unchecked") - Map responseMap = (Map) - getVariableFromExecution(runtimeService, execution.getId(), - responseMapVariable); - - if (responseMap != null) { - msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable - + " from process " + processInstanceId + " execution " - + execution.getId()); - return responseMap; - } - } -*/ - //Querying history seem to return consistent results compared to querying the runtime service - - boolean alreadyEnded = timeProcessEnded.longValue() != 0; - - if (alreadyEnded || isProcessEnded(processInstance.getId())) { - if (!alreadyEnded) { - timeProcessEnded.set(System.currentTimeMillis()); - } - - // Query the history service to see if a response map exists. - - HistoryService historyService = getProcessEngineServices().getHistoryService(); - @SuppressWarnings("unchecked") - Map responseMap = (Map) - getVariableFromHistory(historyService, processInstance.getId(), - responseMapVariable); - - if (responseMap != null) { - msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable - + " from process " + processInstanceId + " history"); - return responseMap; - } - - // Query the history service for old-style response variables. - - String prefix = (String) getVariableFromHistory(historyService, processInstanceId, "prefix"); - - if (prefix != null) { - - // Check for 'WorkflowResponse' variable - Object workflowResponseObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowResponse"); - String workflowResponse = workflowResponseObject == null ? null : String.valueOf(workflowResponseObject); - msoLogger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse); - - if (workflowResponse != null) { - Object responseCodeObject = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); - String responseCode = responseCodeObject == null ? null : String.valueOf(responseCodeObject); - msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); - responseMap = new HashMap<>(); - responseMap.put("WorkflowResponse", workflowResponse); - responseMap.put("ResponseCode", responseCode); - responseMap.put("Status", "Success"); - return responseMap; - } - - - // Check for 'WorkflowException' variable - WorkflowException workflowException = null; - String workflowExceptionText = null; - - Object workflowExceptionObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowException"); - if(workflowExceptionObject != null) { - if(workflowExceptionObject instanceof WorkflowException) { - workflowException = (WorkflowException) workflowExceptionObject; - workflowExceptionText = workflowException.toString(); - responseMap = new HashMap<>(); - responseMap.put("WorkflowException", workflowExceptionText); - responseMap.put("ResponseCode", workflowException.getErrorCode()); - responseMap.put("Status", "Fail"); - return responseMap; - } - else if (workflowExceptionObject instanceof String) { - Object object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); - String responseCode = object == null ? null : String.valueOf(object); - workflowExceptionText = (String) workflowExceptionObject; - responseMap = new HashMap<>(); - responseMap.put("WorkflowException", workflowExceptionText); - responseMap.put("ResponseCode", responseCode); - responseMap.put("Status", "Fail"); - return responseMap; - } - - } - msoLogger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText); - - // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE - Object object = getVariableFromHistory(historyService, processInstanceId, processKey + "Response"); - String response = object == null ? null : String.valueOf(object); - msoLogger.debug(LOGMARKER + processKey + "Response: " + response); - - if (response != null) { - object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); - String responseCode = object == null ? null : String.valueOf(object); - msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); - responseMap = new HashMap<>(); - responseMap.put("Response", response); - responseMap.put("ResponseCode", responseCode); - responseMap.put("Status", "Success"); - return responseMap; - } - - object = getVariableFromHistory(historyService, processInstanceId, prefix + "ErrorResponse"); - String errorResponse = object == null ? null : String.valueOf(object); - msoLogger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse); - - if (errorResponse != null) { - object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); - String responseCode = object == null ? null : String.valueOf(object); - msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); - responseMap = new HashMap<>(); - responseMap.put("Response", errorResponse); - responseMap.put("ResponseCode", responseCode); - responseMap.put("Status", "Fail"); - return responseMap; - } - // END LEGACY SUPPORT. TODO: REMOVE THIS CODE - } - } - return null; - } - - /** - * Gets a variable value from the specified execution. - * @return the variable value, or null if the variable could not be - * obtained - */ - private Object getVariableFromExecution(RuntimeService runtimeService, - String executionId, String variableName) { - try { - return runtimeService.getVariable(executionId, variableName); - } catch (ProcessEngineException e) { - // Most likely cause is that the execution no longer exists. - msoLogger.debug("Error retrieving execution " + executionId - + " variable " + variableName + ": " + e); - return null; - } - } - /** - * Gets a variable value from specified historical process instance. - * @return the variable value, or null if the variable could not be - * obtained - */ - private Object getVariableFromHistory(HistoryService historyService, - String processInstanceId, String variableName) { - try { - HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery() - .processInstanceId(processInstanceId).variableName(variableName).singleResult(); - return v == null ? null : v.getValue(); - } catch (Exception e) { - msoLogger.debug("Error retrieving process " + processInstanceId - + " variable " + variableName + " from history: " + e); - return null; - } - } - - @POST - @Path("/services/{processKey}/{processInstanceId}") - @Produces("application/json") - @Consumes("application/json") - public WorkflowResponse getProcessVariables(@PathParam("processKey") String processKey, @PathParam("processInstanceId") String processInstanceId) { - //TODO filter only set of variables - WorkflowResponse response = new WorkflowResponse(); - - long startTime = System.currentTimeMillis(); - try { - ProcessEngineServices engine = getProcessEngineServices(); - List variables = engine.getHistoryService().createHistoricVariableInstanceQuery().processInstanceId(processInstanceId).list(); - Map variablesMap = new HashMap<>(); - for (HistoricVariableInstance variableInstance: variables) { - variablesMap.put(variableInstance.getName(), variableInstance.getValue().toString()); - } - - msoLogger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey + " and variables: " + variablesMap.toString()); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER - + "Call to MSO workflow/services in Camunda. Received MSO getProcessVariables with processKey:" - + processKey + " and variables: " - + variablesMap.toString()); - - - response.setVariables(variablesMap); - response.setMessage("Success"); - response.setContent("Successfully retrieved the variables"); - response.setProcessInstanceId(processInstanceId); - - msoLogger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with content: " + response.getContent()); - } catch (Exception ex) { - response.setMessage("Fail"); - response.setContent("Failed to retrieve the variables," + ex.getMessage()); - response.setProcessInstanceId(processInstanceId); - - msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), MsoLogger.ErrorCode.UnknownError, LOGMARKER - + response.getMessage() - + " for processKey: " - + processKey - + " with content: " - + response.getContent()); - msoLogger.debug("Exception :",ex); - } - - msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - LOGMARKER + response.getMessage() + " for processKey: " - + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - LOGMARKER + response.getMessage() + " for processKey: " - + processKey + " with content: " + response.getContent()); - - return response; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java deleted file mode 100644 index 64e5adc091..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java +++ /dev/null @@ -1,46 +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.bpmn.common.workflow.service; - -import java.util.HashSet; -import java.util.Set; - -import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; - -@ApplicationPath("/") -public class WorkflowResourceApplication extends Application { - private Set singletons = new HashSet<>(); - private Set> classes = new HashSet<>(); - - public WorkflowResourceApplication() { - } - - @Override - public Set> getClasses() { - return classes; - } - - @Override - public Set getSingletons() { - return singletons; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java deleted file mode 100644 index 02702e3b3c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java +++ /dev/null @@ -1,97 +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.bpmn.common.workflow.service; - -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * A synchronous response from a workflow. - */ -public class WorkflowResponse { - - @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/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClient.java deleted file mode 100644 index 5e3aca5613..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClient.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.client.adapter.network; - -import org.openecomp.mso.adapters.nwrest.CreateNetworkRequest; -import org.openecomp.mso.adapters.nwrest.CreateNetworkResponse; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkRequest; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkResponse; -import org.openecomp.mso.adapters.nwrest.QueryNetworkResponse; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkRequest; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkResponse; -import org.openecomp.mso.adapters.nwrest.UpdateNetworkRequest; -import org.openecomp.mso.adapters.nwrest.UpdateNetworkResponse; - -public interface NetworkAdapterClient { - - CreateNetworkResponse createNetwork(CreateNetworkRequest req); - - DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req); - - RollbackNetworkResponse rollbackNetwork(String aaiNetworkId, RollbackNetworkRequest req); - - QueryNetworkResponse queryNetwork(String aaiNetworkId, String cloudSiteId, String tenantId, String networkStackId, boolean skipAAI, String requestId, String serviceInstanceId); - - UpdateNetworkResponse updateNetwork(String aaiNetworkId, UpdateNetworkRequest req); - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientImpl.java deleted file mode 100644 index 6a1c862a66..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientImpl.java +++ /dev/null @@ -1,97 +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.client.adapter.network; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.UriBuilder; - -import org.openecomp.mso.adapters.nwrest.CreateNetworkRequest; -import org.openecomp.mso.adapters.nwrest.CreateNetworkResponse; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkRequest; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkResponse; -import org.openecomp.mso.adapters.nwrest.QueryNetworkResponse; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkRequest; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkResponse; -import org.openecomp.mso.adapters.nwrest.UpdateNetworkRequest; -import org.openecomp.mso.adapters.nwrest.UpdateNetworkResponse; -import org.openecomp.mso.client.adapter.vnf.AdapterRestClient; - -public class NetworkAdapterClientImpl implements NetworkAdapterClient { - - private final NetworkAdapterRestProperties props; - public NetworkAdapterClientImpl() { - this.props = new NetworkAdapterRestProperties(); - } - @Override - public CreateNetworkResponse createNetwork(CreateNetworkRequest req) { - return new AdapterRestClient(this.props, this.getUri("").build()).post(req, - CreateNetworkResponse.class); - } - - @Override - public DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req, - DeleteNetworkResponse.class); - } - - @Override - public RollbackNetworkResponse rollbackNetwork(String aaiNetworkId, RollbackNetworkRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req, - RollbackNetworkResponse.class); - } - - @Override - public QueryNetworkResponse queryNetwork(String aaiNetworkId, String cloudSiteId, String tenantId, - String networkStackId, boolean skipAAI, String requestId, String serviceInstanceId) { - UriBuilder builder = this.getUri("/" + aaiNetworkId); - if (cloudSiteId != null) { - builder.queryParam("cloudSiteId", cloudSiteId); - } - if (tenantId != null) { - builder.queryParam("tenantId", tenantId); - } - if (networkStackId != null) { - builder.queryParam("networkStackId", networkStackId); - } - - builder.queryParam("skipAAI", skipAAI); - - if (requestId != null) { - builder.queryParam("msoRequest.requestId", requestId); - } - if (serviceInstanceId != null) { - builder.queryParam("msoRequest.serviceInstanceId", serviceInstanceId); - } - return new AdapterRestClient(this.props, builder.build(), MediaType.TEXT_XML, MediaType.TEXT_XML) - .get(QueryNetworkResponse.class); - } - - @Override - public UpdateNetworkResponse updateNetwork(String aaiNetworkId, UpdateNetworkRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).put(req, - UpdateNetworkResponse.class); - } - - protected UriBuilder getUri(String path) { - return UriBuilder.fromPath(path); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterRestProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterRestProperties.java deleted file mode 100644 index 62d78d423c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterRestProperties.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.client.adapter.network; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; - -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.adapter.vnf.AdapterRestProperties; - -public class NetworkAdapterRestProperties implements AdapterRestProperties { - - private final Map props; - - public NetworkAdapterRestProperties() { - this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - } - - @Override - public String getAuth() { - return props.get("mso.adapters.po.auth"); - } - @Override - public String getKey() { - return props.get("mso.msoKey"); - } - @Override - public URL getEndpoint() throws MalformedURLException { - return new URL(props.get("mso.adapters.network.rest.endpoint")); - } - - @Override - public String getSystemName() { - return "MSO"; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapter.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapter.java deleted file mode 100644 index c3ba8e16ea..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapter.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.client.adapter.requests.db; - -import org.openecomp.mso.client.adapter.requests.db.entities.MsoRequestsDbException; -import org.openecomp.mso.client.adapter.requests.db.entities.UpdateInfraRequest; -import org.openecomp.mso.requestsdb.InfraActiveRequests; - -public interface MsoRequestsDbAdapter { - - public void updateInfraRequest(UpdateInfraRequest request) throws MsoRequestsDbException; - - public InfraActiveRequests getInfraRequest(String requestId) throws MsoRequestsDbException; - - public boolean getSiteStatus(String siteName); - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.java deleted file mode 100644 index 2443169151..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.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.client.adapter.requests.db; - -import java.sql.Timestamp; - -import org.hibernate.HibernateException; -import org.hibernate.Query; -import org.hibernate.Session; -import org.openecomp.mso.client.adapter.requests.db.entities.MsoRequestsDbException; -import org.openecomp.mso.client.adapter.requests.db.entities.RequestStatusType; -import org.openecomp.mso.client.adapter.requests.db.entities.UpdateInfraRequest; -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.RequestsDbSessionFactoryManager; -import org.openecomp.mso.requestsdb.SiteStatus; -import org.openecomp.mso.utils.UUIDChecker; - -public class MsoRequestsDbAdapterClient implements MsoRequestsDbAdapter { - - protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager(); - - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - @Override - public void updateInfraRequest(UpdateInfraRequest request) throws MsoRequestsDbException { - Session session = requestsDbSessionFactoryManager.getSessionFactory().openSession(); - int result = 0; - long startTime = System.currentTimeMillis(); - if (request.getRequestId() != null && request.getLastModifiedBy() != null) { - MsoLogger.setLogContext(request.getRequestId(), null); - try { - session.beginTransaction(); - StringBuilder queryString = new StringBuilder("update InfraActiveRequests set "); - String statusMessage = null; - String responseBody = null; - RequestStatusType requestStatus = null; - String progress = null; - String vnfOutputs = null; - String serviceInstanceId = null; - String networkId = null; - String vnfId = null; - String vfModuleId = null; - String volumeGroupId = null; - String serviceInstanceName = null; - String vfModuleName = null; - String configurationId = null; - String configurationName = null; - if (request.getStatusMessage() != null) { - queryString.append("statusMessage = :statusMessage, "); - statusMessage = request.getStatusMessage(); - } - if (request.getResponseBody() != null) { - queryString.append("responseBody = :responseBody, "); - responseBody = request.getResponseBody(); - } - if (request.getRequestStatus() != null) { - queryString.append("requestStatus = :requestStatus, "); - requestStatus = request.getRequestStatus(); - } - if (request.getProgress() != null) { - queryString.append("progress = :progress, "); - progress = request.getProgress(); - } - if (request.getVnfOutputs() != null) { - queryString.append("vnfOutputs = :vnfOutputs, "); - vnfOutputs = request.getVnfOutputs(); - } - if (request.getServiceInstanceId() != null) { - queryString.append("serviceInstanceId = :serviceInstanceId, "); - serviceInstanceId = request.getServiceInstanceId(); - } - if (request.getNetworkId() != null) { - queryString.append("networkId = :networkId, "); - networkId = request.getNetworkId(); - } - if (request.getVnfId() != null) { - queryString.append("vnfId = :vnfId, "); - vnfId = request.getVnfId(); - } - if (request.getVfModuleId() != null) { - queryString.append("vfModuleId = :vfModuleId, "); - vfModuleId = request.getVfModuleId(); - } - if (request.getVolumeGroupId() != null) { - queryString.append("volumeGroupId = :volumeGroupId, "); - volumeGroupId = request.getVolumeGroupId(); - } - if (request.getServiceInstanceName() != null) { - queryString.append("serviceInstanceName = :serviceInstanceName, "); - serviceInstanceName = request.getServiceInstanceName(); - } - if (request.getVfModuleName() != null) { - queryString.append("vfModuleName = :vfModuleName, "); - vfModuleName = request.getVfModuleName(); - } - if (request.getConfigurationId() != null) { - queryString.append("configurationId = :configurationId, "); - configurationId = request.getConfigurationId(); - } - if (request.getConfigurationName() != null) { - queryString.append("configurationName = :configurationName, "); - configurationName = request.getConfigurationName(); - } - if (request.getRequestStatus() == RequestStatusType.COMPLETE - || request.getRequestStatus() == RequestStatusType.FAILED) { - queryString.append("endTime = :endTime, "); - } else { - queryString.append("modifyTime = :modifyTime, "); - } - queryString.append("lastModifiedBy = :lastModifiedBy where requestId = :requestId OR clientRequestId = :requestId"); - - LOGGER.debug("Executing update: " + queryString.toString()); - - Query query = session.createQuery(queryString.toString()); - query.setParameter("requestId", request.getRequestId()); - if (statusMessage != null) { - query.setParameter("statusMessage", statusMessage); - LOGGER.debug("StatusMessage in updateInfraRequest is set to: " + statusMessage); - } - if (responseBody != null) { - query.setParameter("responseBody", responseBody); - LOGGER.debug("ResponseBody in updateInfraRequest is set to: " + responseBody); - } - if (requestStatus != null) { - query.setParameter("requestStatus", requestStatus.toString()); - LOGGER.debug("RequestStatus in updateInfraRequest is set to: " + requestStatus.toString()); - } - - if (progress != null) { - query.setParameter("progress", Long.parseLong(progress)); - LOGGER.debug("Progress in updateInfraRequest is set to: " + progress); - } - if (vnfOutputs != null) { - query.setParameter("vnfOutputs", vnfOutputs); - LOGGER.debug("VnfOutputs in updateInfraRequest is set to: " + vnfOutputs); - } - if (serviceInstanceId != null) { - query.setParameter("serviceInstanceId", serviceInstanceId); - LOGGER.debug("ServiceInstanceId in updateInfraRequest is set to: " + serviceInstanceId); - } - if (networkId != null) { - query.setParameter("networkId", networkId); - LOGGER.debug("NetworkId in updateInfraRequest is set to: " + networkId); - } - if (vnfId != null) { - query.setParameter("vnfId", vnfId); - LOGGER.debug("VnfId in updateInfraRequest is set to: " + vnfId); - } - if (vfModuleId != null) { - query.setParameter("vfModuleId", vfModuleId); - LOGGER.debug("vfModuleId in updateInfraRequest is set to: " + vfModuleId); - } - if (volumeGroupId != null) { - query.setParameter("volumeGroupId", volumeGroupId); - LOGGER.debug("VolumeGroupId in updateInfraRequest is set to: " + volumeGroupId); - } - if (serviceInstanceName != null) { - query.setParameter("serviceInstanceName", serviceInstanceName); - LOGGER.debug("ServiceInstanceName in updateInfraRequest is set to: " + serviceInstanceName); - } - if (configurationId != null) { - query.setParameter("configurationId", configurationId); - LOGGER.debug("configurationId in updateInfraRequest is set to: " + configurationId); - } - if (configurationName != null) { - query.setParameter("configurationName", configurationName); - LOGGER.debug("configurationName in updateInfraRequest is set to: " + configurationName); - } - if (vfModuleName != null) { - query.setParameter("vfModuleName", vfModuleName); - LOGGER.debug("vfModuleName in updateInfraRequest is set to: " + vfModuleName); - } - Timestamp nowTimeStamp = new Timestamp(System.currentTimeMillis()); - if (request.getRequestStatus() == RequestStatusType.COMPLETE - || request.getRequestStatus() == RequestStatusType.FAILED) { - query.setParameter("endTime", nowTimeStamp); - LOGGER.debug("EndTime in updateInfraRequest is set to: " + nowTimeStamp); - } else { - query.setParameter("modifyTime", nowTimeStamp); - LOGGER.debug("ModifyTime in updateInfraRequest is set to: " + nowTimeStamp); - } - query.setParameter("lastModifiedBy", request.getLastModifiedBy()); - LOGGER.debug("LastModifiedBy in updateInfraRequest is set to: " + request.getLastModifiedBy()); - result = query.executeUpdate(); - checkIfExists(result, request.getRequestId(), startTime); - session.getTransaction().commit(); - } catch (HibernateException e) { - String error = "Unable to update MSO Requests DB: " + e.getMessage(); - LOGGER.error(MessageEnum.RA_CANT_UPDATE_REQUEST, "infra request parameters", request.getRequestId(), "", - "", MsoLogger.ErrorCode.BusinessProcesssError, "HibernateException - " + error, e); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, - error); - throw new MsoRequestsDbException(error, e); - } finally { - if (session != null && session.isOpen()) { - session.close(); - } - } - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); - } else { - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, - "Required fields: requestId and lastModifiedBy"); - } - } - - private void checkIfExists(int result, String requestId, long startTime) throws MsoRequestsDbException { - if (result == 0) { - String error = "Request ID does not exist in MSO Requests DB: " + requestId; - LOGGER.error(MessageEnum.RA_DB_REQUEST_NOT_EXIST, requestId, "", "", MsoLogger.ErrorCode.DataError, error); - throw new MsoRequestsDbException(error); - } - } - - @Override - public InfraActiveRequests getInfraRequest(String requestId) throws MsoRequestsDbException { - long startTime = System.currentTimeMillis(); - MsoLogger.setLogContext(requestId, null); - Session session = requestsDbSessionFactoryManager.getSessionFactory().openSession(); - - LOGGER.debug("Call to MSO Infra RequestsDb adapter get method with request Id: " + requestId); - - InfraActiveRequests request = null; - try { - session.beginTransaction(); - Query query = session.createQuery( - "FROM InfraActiveRequests where requestId = :requestId OR clientRequestId = :requestId"); - query.setParameter("requestId", requestId); - request = (InfraActiveRequests) query.uniqueResult(); - } catch (HibernateException e) { - String error = "Unable to retrieve MSO Infra Requests DB for Request ID " + requestId; - LOGGER.error(MessageEnum.RA_DB_REQUEST_NOT_EXIST, "Get Infra request", requestId, "", "", - MsoLogger.ErrorCode.BusinessProcesssError, "HibernateException - " + error, e); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, error); - throw new MsoRequestsDbException(error, e); - } finally { - if (session != null && session.isOpen()) { - session.close(); - } - } - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); - return request; - } - - /** - * Get SiteStatus by SiteName. - * - * @param siteName - * The unique name of the site - * @return Status of that site - */ - public boolean getSiteStatus(String siteName) { - UUIDChecker.generateUUID(LOGGER); - Session session = requestsDbSessionFactoryManager.getSessionFactory().openSession(); - - long startTime = System.currentTimeMillis(); - SiteStatus siteStatus = null; - LOGGER.debug("Request database - get Site Status with Site name:" + siteName); - try { - String hql = "FROM SiteStatus WHERE siteName = :site_name"; - Query query = session.createQuery(hql); - query.setParameter("site_name", siteName); - - siteStatus = (SiteStatus) query.uniqueResult(); - } finally { - if (session != null && session.isOpen()) { - session.close(); - } - } - if (siteStatus == null) { - // if not exist in DB, it means the site is not disabled, thus - // return true - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); - return true; - } else { - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); - return siteStatus.getStatus(); - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbException.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbException.java deleted file mode 100644 index a495d0eac1..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbException.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.client.adapter.requests.db.entities; - - - -import javax.xml.ws.WebFault; - -/** - * This class simply extends Exception (without addition additional functionality) - * to provide an identifier for RequestsDB related exceptions on create, delete, query. - * - * - */ -@WebFault (name="MsoRequestsDbException", faultBean="org.openecomp.mso.adapters.requestsdb.exceptions.MsoRequestsDbExceptionBean", targetNamespace="http://org.openecomp.mso/requestsdb") -public class MsoRequestsDbException extends Exception { - - private static final long serialVersionUID = 1L; - - private MsoRequestsDbExceptionBean faultInfo; - - public MsoRequestsDbException (String msg) { - super(msg); - faultInfo = new MsoRequestsDbExceptionBean (msg); - } - - public MsoRequestsDbException (Throwable e) { - super(e); - faultInfo = new MsoRequestsDbExceptionBean (e.getMessage()); - } - - public MsoRequestsDbException (String msg, Throwable e) { - super (msg, e); - faultInfo = new MsoRequestsDbExceptionBean (msg); - } - - public MsoRequestsDbExceptionBean getFaultInfo() { - return faultInfo; - } - - public void setFaultInfo(MsoRequestsDbExceptionBean faultInfo) { - this.faultInfo = faultInfo; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBean.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBean.java deleted file mode 100644 index f566418ade..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBean.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.client.adapter.requests.db.entities; - - -import java.io.Serializable; - -/** - * Jax-WS Fault Bean for MsoRequestsDB Exception - */ -public class MsoRequestsDbExceptionBean implements Serializable { - - private static final long serialVersionUID = 1360000062602372639L; - - private String message; - - public MsoRequestsDbExceptionBean () {} - - public MsoRequestsDbExceptionBean (String message) { - this.message = message; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/RequestStatusType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/RequestStatusType.java deleted file mode 100644 index 2fa6f2b6a2..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/RequestStatusType.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========================================================= - */ - -// -// 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.07.24 at 11:49:17 AM EDT -// - - -package org.openecomp.mso.client.adapter.requests.db.entities; - - - -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; - - public String value() { - return name(); - } - - public static RequestStatusType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/ResponseStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/ResponseStatus.java deleted file mode 100644 index cc00fd1ff2..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/ResponseStatus.java +++ /dev/null @@ -1,33 +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.client.adapter.requests.db.entities; - - - -/* - * Enum for Status values returned by API Handler to Tail-F -*/ -public enum ResponseStatus { - SENDING_FINAL_NOTIFY, - SUCCESS, - FAILED, - TIMEOUT -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/Status.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/Status.java deleted file mode 100644 index e9750a2b3b..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/Status.java +++ /dev/null @@ -1,40 +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.client.adapter.requests.db.entities; - - -/* - * Enum for Status values returned by API Handler to Tail-F -*/ -public enum Status { - PENDING, INPROGRESS, COMPLETED, FAILED, TIMEOUT; - - public boolean isFinished () { - switch (this) { - case COMPLETED: - case FAILED: - case TIMEOUT: - return true; - default: - return false; - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequest.java deleted file mode 100644 index 15c57253f3..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequest.java +++ /dev/null @@ -1,138 +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.client.adapter.requests.db.entities; - -public class UpdateInfraRequest { - - private String requestId; - private String lastModifiedBy; - private String statusMessage; - private String responseBody; - private RequestStatusType requestStatus; - private String progress; - private String vnfOutputs; - private String serviceInstanceId; - private String networkId; - private String vnfId; - private String vfModuleId; - private String volumeGroupId; - private String serviceInstanceName; - private String configurationId; - private String configurationName; - private String vfModuleName; - - public String getRequestId() { - return requestId; - } - public void setRequestId(String requestId) { - this.requestId = requestId; - } - public String getLastModifiedBy() { - return lastModifiedBy; - } - public void setLastModifiedBy(String lastModifiedBy) { - this.lastModifiedBy = lastModifiedBy; - } - public String getStatusMessage() { - return statusMessage; - } - public void setStatusMessage(String statusMessage) { - this.statusMessage = statusMessage; - } - public String getResponseBody() { - return responseBody; - } - public void setResponseBody(String responseBody) { - this.responseBody = responseBody; - } - public RequestStatusType getRequestStatus() { - return requestStatus; - } - public void setRequestStatus(RequestStatusType requestStatus) { - this.requestStatus = requestStatus; - } - public String getProgress() { - return progress; - } - public void setProgress(String progress) { - this.progress = progress; - } - public String getVnfOutputs() { - return vnfOutputs; - } - public void setVnfOutputs(String vnfOutputs) { - this.vnfOutputs = vnfOutputs; - } - public String getServiceInstanceId() { - return serviceInstanceId; - } - public void setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } - public String getNetworkId() { - return networkId; - } - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - public String getVnfId() { - return vnfId; - } - public void setVnfId(String vnfId) { - this.vnfId = vnfId; - } - public String getVfModuleId() { - return vfModuleId; - } - public void setVfModuleId(String vfModuleId) { - this.vfModuleId = vfModuleId; - } - public String getVolumeGroupId() { - return volumeGroupId; - } - public void setVolumeGroupId(String volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } - public String getServiceInstanceName() { - return serviceInstanceName; - } - public void setServiceInstanceName(String serviceInstanceName) { - this.serviceInstanceName = serviceInstanceName; - } - public String getConfigurationId() { - return configurationId; - } - public void setConfigurationId(String configurationId) { - this.configurationId = configurationId; - } - public String getConfigurationName() { - return configurationName; - } - public void setConfigurationName(String configurationName) { - this.configurationName = configurationName; - } - public String getVfModuleName() { - return vfModuleName; - } - public void setVfModuleName(String vfModuleName) { - this.vfModuleName = vfModuleName; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java deleted file mode 100644 index 16fd351b43..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.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.client.adapter.vnf; - -import java.net.URI; -import java.util.Map; -import java.util.Optional; -import java.util.UUID; - -import javax.ws.rs.client.ClientResponseFilter; -import javax.ws.rs.ext.ContextResolver; - -import org.openecomp.mso.client.ResponseExceptionMapperImpl; -import org.openecomp.mso.client.policy.JettisonStyleMapperProvider; -import org.openecomp.mso.client.policy.RestClient; - -import com.fasterxml.jackson.databind.ObjectMapper; - -public class AdapterRestClient extends RestClient { - - private final AdapterRestProperties props; - public AdapterRestClient(AdapterRestProperties props, URI uri) { - super(props, UUID.randomUUID(), Optional.of(uri)); - this.props = props; - } - - public AdapterRestClient(AdapterRestProperties props, URI uri, String accept, String contentType) { - super(props, UUID.randomUUID(), Optional.of(uri), accept, contentType); - this.props = props; - } - - @Override - protected void initializeHeaderMap(Map headerMap) { - addBasicAuthHeader(props.getAuth(), props.getKey()); - } - - @Override - protected Optional addResponseFilter() { - return Optional.of(new ResponseExceptionMapperImpl()); - } - - @Override - public RestClient addRequestId(UUID requestId) { - return null; - } - - @Override - protected ContextResolver getMapper() { - return new JettisonStyleMapperProvider(); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestProperties.java deleted file mode 100644 index af429db1f2..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestProperties.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.client.adapter.vnf; - -import org.openecomp.mso.client.RestProperties; - -public interface AdapterRestProperties extends RestProperties { - - public String getAuth(); - public String getKey(); -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClient.java deleted file mode 100644 index 5ee38fe0fb..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClient.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.client.adapter.vnf; - -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.QueryVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleResponse; - -public interface VnfAdapterClient { - - CreateVfModuleResponse createVfModule(String aaiVnfId, CreateVfModuleRequest req); - - RollbackVfModuleResponse rollbackVfModule(String aaiVnfId, String aaiVfModuleId, RollbackVfModuleRequest req); - - DeleteVfModuleResponse deleteVfModule(String aaiVnfId, String aaiVfModuleId, DeleteVfModuleRequest req); - - UpdateVfModuleResponse updateVfModule(String aaiVnfId, String aaiVfModuleId, UpdateVfModuleRequest req); - - QueryVfModuleResponse queryVfModule(String aaiVnfId, String aaiVfModuleId, String cloudSiteId, String tenantId, - String vfModuleName, boolean skipAAI, String requestId, String serviceInstanceId); - - String healthCheck(); - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientImpl.java deleted file mode 100644 index 2b391d302d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientImpl.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.client.adapter.vnf; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.UriBuilder; - -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.QueryVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleResponse; - -public class VnfAdapterClientImpl implements VnfAdapterClient { - - private static final String VF_MODULES = "/vf-modules/"; - - private final VnfAdapterRestProperties props; - public VnfAdapterClientImpl() { - this.props = new VnfAdapterRestProperties(); - } - - @Override - public CreateVfModuleResponse createVfModule(String aaiVnfId, CreateVfModuleRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + "/vf-modules").build()).post(req, - CreateVfModuleResponse.class); - } - - @Override - public RollbackVfModuleResponse rollbackVfModule(String aaiVnfId, String aaiVfModuleId, - RollbackVfModuleRequest req) { - return new AdapterRestClient(this.props, - this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId + "/rollback").build()).delete(req, - RollbackVfModuleResponse.class); - } - - @Override - public DeleteVfModuleResponse deleteVfModule(String aaiVnfId, String aaiVfModuleId, DeleteVfModuleRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build()) - .delete(req, DeleteVfModuleResponse.class); - } - - @Override - public UpdateVfModuleResponse updateVfModule(String aaiVnfId, String aaiVfModuleId, UpdateVfModuleRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build()) - .put(req, UpdateVfModuleResponse.class); - } - - @Override - public QueryVfModuleResponse queryVfModule(String aaiVnfId, String aaiVfModuleId, String cloudSiteId, - String tenantId, String vfModuleName, boolean skipAAI, String requestId, String serviceInstanceId) { - UriBuilder builder = this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId); - if (cloudSiteId != null) { - builder.queryParam("cloudSiteId", cloudSiteId); - } - if (tenantId != null) { - builder.queryParam("tenantId", tenantId); - } - if (vfModuleName != null) { - builder.queryParam("vfModuleName", vfModuleName); - } - - builder.queryParam("skipAAI", skipAAI); - - if (requestId != null) { - builder.queryParam("msoRequest.requestId", requestId); - } - if (serviceInstanceId != null) { - builder.queryParam("msoRequest.serviceInstanceId", serviceInstanceId); - } - return new AdapterRestClient(this.props, builder.build(), MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON) - .get(QueryVfModuleResponse.class); - } - - @Override - public String healthCheck() { - return new AdapterRestClient(this.props, this.getUri("/healthcheck").build()).get(String.class); - } - - public UriBuilder getUri(String path) { - return UriBuilder.fromPath(path); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterRestProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterRestProperties.java deleted file mode 100644 index e342aeedac..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterRestProperties.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.client.adapter.vnf; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; - -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.adapter.vnf.AdapterRestProperties; - -public class VnfAdapterRestProperties implements AdapterRestProperties { - - private final Map props; - - public VnfAdapterRestProperties() { - this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - } - - @Override - public String getAuth() { - return props.get("mso.adapters.po.auth"); - } - @Override - public String getKey() { - return props.get("mso.msoKey"); - } - @Override - public URL getEndpoint() throws MalformedURLException { - return new URL(props.get("mso.adapters.vnf.rest.endpoint")); - } - - @Override - public String getSystemName() { - return "MSO"; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java deleted file mode 100644 index 3c00627bff..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java +++ /dev/null @@ -1,178 +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.client.appc; - -import java.util.HashMap; -import java.util.List; - -import org.openecomp.mso.client.appc.ApplicationControllerSupport.StatusCategory; -import org.openecomp.mso.bpmn.appc.payload.PayloadClient; -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.client.appc.ApplicationControllerOrchestrator; -import java.util.Optional; -import org.onap.appc.client.lcm.model.Action; -import org.onap.appc.client.lcm.model.Status; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.att.eelf.configuration.EELFLogger.Level; -import java.lang.NoSuchMethodError; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - - -public class ApplicationControllerAction { - protected ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator(); - private String errorCode = "1002"; - private String errorMessage = "Unable to reach App C Servers"; - protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); - - public void runAppCCommand(Action action, String msoRequestId, String vnfId, Optional payload, HashMap payloadInfo, String controllerType){ Status appCStatus = null; - try{ - String vnfName = payloadInfo.getOrDefault("vnfName", ""); - String aicIdentity = payloadInfo.getOrDefault("vnfName",""); - String vnfHostIpAddress = payloadInfo.getOrDefault("vnfHostIpAddress",""); - String vmIdList = payloadInfo.getOrDefault("vmIdList", ""); - String identityUrl = payloadInfo.getOrDefault("identityUrl", ""); - switch(action){ - case ResumeTraffic: - appCStatus = resumeTrafficAction(msoRequestId, vnfId, vnfName, controllerType); - break; - case Start: - case Stop: - appCStatus = startStopAction(action, msoRequestId, vnfId, aicIdentity, controllerType); - break; - case Unlock: - case Lock: - appCStatus = client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), controllerType); - break; - case QuiesceTraffic: - appCStatus = quiesceTrafficAction(msoRequestId, vnfId, payload, vnfName, controllerType); - break; - case HealthCheck: - appCStatus = healthCheckAction(msoRequestId, vnfId, vnfName, vnfHostIpAddress, controllerType); - break; - case Snapshot: - String vmIds = JsonUtils.getJsonValue(vmIdList, "vmIds"); - String vmId = ""; - ObjectMapper mapper = new ObjectMapper(); - List vmIdJsonList = mapper.readValue(vmIds, new TypeReference>(){}); - int i = 0; - while(i < vmIdJsonList.size()){ - vmId = vmIdJsonList.get(i); - appCStatus = snapshotAction(msoRequestId, vnfId, vmId, identityUrl, controllerType); - i++; - } - break; - case ConfigModify: - case ConfigScaleOut: - appCStatus = payloadAction(action, msoRequestId, vnfId, payload, controllerType); - break; - case UpgradePreCheck: - case UpgradePostCheck: - case UpgradeSoftware: - case UpgradeBackup: - appCStatus = upgradeAction(action,msoRequestId, vnfId, payload, vnfName, controllerType); - break; - default: - errorMessage = "Unable to idenify Action request for AppCClient"; - break; - } - if(appCStatus != null){ - errorCode = Integer.toString(appCStatus.getCode()); - errorMessage = appCStatus.getMessage(); - - } - if(ApplicationControllerSupport.getCategoryOf(appCStatus).equals(StatusCategory.NORMAL)){ - errorCode = "0"; - } - } - catch(JsonProcessingException e){ - auditLogger.log(Level.ERROR, "Incorrect Payload format for action request" + action.toString(),e, e.getMessage()); - errorMessage = e.getMessage(); - } - catch(ApplicationControllerOrchestratorException e){ - auditLogger.log(Level.ERROR, "Error building Appc request: ", e, e.getMessage()); - errorCode = "1002"; - errorMessage = e.getMessage(); - } - catch (NoSuchMethodError e) { - auditLogger.log(Level.ERROR, "Error building Appc request: ", e, e.getMessage()); - errorMessage = e.getMessage(); - } - catch(Exception e){ - auditLogger.log(Level.ERROR, "Error building Appc request: ", e, e.getMessage()); - errorMessage = e.getMessage(); - } - } - - private Status payloadAction(Action action, String msoRequestId, String vnfId, Optional payload, String controllerType) throws JsonProcessingException, IllegalArgumentException,ApplicationControllerOrchestratorException{ - if(!(payload.isPresent())){ - throw new IllegalArgumentException("Payload is not present for " + action.toString()); - } - return client.vnfCommand(action, msoRequestId, vnfId, payload, controllerType); - } - - private Status quiesceTrafficAction(String msoRequestId, String vnfId, Optional payload, String vnfName, String controllerType) throws JsonProcessingException, IllegalArgumentException,ApplicationControllerOrchestratorException{ - if(!(payload.isPresent())){ - throw new IllegalArgumentException("Payload is not present for " + Action.QuiesceTraffic.toString()); - } - payload = PayloadClient.quiesceTrafficFormat(payload, vnfName); - return client.vnfCommand(Action.QuiesceTraffic, msoRequestId, vnfId, payload, controllerType); - } - - private Status upgradeAction(Action action, String msoRequestId, String vnfId, Optional payload, String vnfName, String controllerType) throws JsonProcessingException, IllegalArgumentException,ApplicationControllerOrchestratorException{ - if(!(payload.isPresent())){ - throw new IllegalArgumentException("Payload is not present for " + action.toString()); - } - payload = PayloadClient.upgradeFormat(payload, vnfName); - return client.vnfCommand(action, msoRequestId, vnfId, payload, controllerType); - } - - private Status resumeTrafficAction(String msoRequestId, String vnfId, String vnfName, String controllerType)throws JsonProcessingException, ApplicationControllerOrchestratorException{ - Optional payload = PayloadClient.resumeTrafficFormat(vnfName); - return client.vnfCommand(Action.ResumeTraffic, msoRequestId, vnfId, payload, controllerType); - } - - private Status startStopAction(Action action, String msoRequestId, String vnfId, String aicIdentity, String controllerType)throws JsonProcessingException, ApplicationControllerOrchestratorException{ - Optional payload = PayloadClient.startStopFormat(aicIdentity); - return client.vnfCommand(action, msoRequestId, vnfId, payload, controllerType); - } - - private Status healthCheckAction(String msoRequestId, String vnfId, String vnfName, String vnfHostIpAddress, String controllerType)throws JsonProcessingException, ApplicationControllerOrchestratorException{ - Optional payload = PayloadClient.healthCheckFormat(vnfName, vnfHostIpAddress); - return client.vnfCommand(Action.HealthCheck, msoRequestId, vnfId, payload, controllerType); - } - - private Status snapshotAction(String msoRequestId, String vnfId, String vmId, String identityUrl, String controllerType) throws JsonProcessingException, ApplicationControllerOrchestratorException{ - Optional payload = PayloadClient.snapshotFormat(vmId, identityUrl); - return client.vnfCommand(Action.Snapshot, msoRequestId, vnfId, payload, controllerType); - } - - public String getErrorMessage(){ - return errorMessage; - } - - public String getErrorCode(){ - return errorCode; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerCallback.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerCallback.java deleted file mode 100644 index 1bb4dc7eed..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerCallback.java +++ /dev/null @@ -1,40 +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.client.appc; - -import org.onap.appc.client.lcm.api.ResponseHandler; -import org.onap.appc.client.lcm.exceptions.AppcClientException; - -public class ApplicationControllerCallback implements ResponseHandler { - - @Override - public void onResponse(T response) { - System.out.println("ON RESPONSE"); - - } - - @Override - public void onException(AppcClientException exception) { - System.out.println("ON EXCEPTION"); - - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java deleted file mode 100644 index c9e2e880e7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java +++ /dev/null @@ -1,212 +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.client.appc; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.time.Instant; -import java.util.Map; -import java.util.Properties; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; - -import org.onap.appc.client.lcm.api.AppcClientServiceFactoryProvider; -import org.onap.appc.client.lcm.api.AppcLifeCycleManagerServiceFactory; -import org.onap.appc.client.lcm.api.ApplicationContext; -import org.onap.appc.client.lcm.api.LifeCycleManagerStateful; -import org.onap.appc.client.lcm.exceptions.AppcClientException; -import org.onap.appc.client.lcm.model.Action; -import org.onap.appc.client.lcm.model.ActionIdentifiers; -import org.onap.appc.client.lcm.model.CommonHeader; -import org.onap.appc.client.lcm.model.Flags; -import org.onap.appc.client.lcm.model.Flags.Force; -import org.onap.appc.client.lcm.model.Flags.Mode; -import org.onap.appc.client.lcm.model.Payload; -import org.onap.appc.client.lcm.model.Status; -import org.onap.appc.client.lcm.model.ZULU; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.springframework.beans.factory.annotation.Autowired; - -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFLogger.Level; -import com.att.eelf.configuration.EELFManager; - -public class ApplicationControllerClient { - - public static final String DEFAULT_CONTROLLER_TYPE = "SDNC"; - - private static final String CLIENT_NAME = "MSO"; - - private static final String API_VER = "2.00"; - private static final String ORIGINATOR_ID = "MSO"; - private static final int FLAGS_TTL = 65000; - protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); - - @Autowired - public ApplicationControllerSupport appCSupport; - - // APPC gave us an API where the controllerType is configured in the - // client object, which is not what we asked for. We asked for an API - // in which the client would have additional methods that could take - // the controllerType as a parameter, so that we would not need to - // maintain multiple client objects. This map should be removed when - // the (hopefully short-term) controllerType becomes obsolete. - - private final String controllerType; - - private static ConcurrentHashMap appCClients = new ConcurrentHashMap<>(); - - /** - * Creates an ApplicationControllerClient for communication with APP-C. - */ - public ApplicationControllerClient() { - this(DEFAULT_CONTROLLER_TYPE); - } - - /** - * Creates an ApplicationControllerClient for the specified controller type. - * @param controllerType the controller type: "appc" or "sdnc". - */ - public ApplicationControllerClient(String controllerType) { - if (controllerType == null) { - controllerType = DEFAULT_CONTROLLER_TYPE; - } - this.controllerType = controllerType.toUpperCase(); - appCSupport = new ApplicationControllerSupport(); - } - - /** - * Gets the controller type. - * @return the controllertype - */ - public String getControllerType() { - return controllerType; - } - - /** - * Returns the AppC client object associated with this ApplicationControllerClient. - * AppC client objects are shared objects. One is created if it does not exist. - * @return the client object, or null if creation failed - */ - public LifeCycleManagerStateful getAppCClient() { - return appCClients.computeIfAbsent(controllerType, k -> createAppCClient(k)); - } - - protected LifeCycleManagerStateful createAppCClient(String controllerType) { - try { - if (controllerType == null) { - controllerType = DEFAULT_CONTROLLER_TYPE; - } - controllerType = controllerType.toUpperCase(); - return AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class) - .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType)); - } catch (AppcClientException e) { - auditLogger.log(Level.ERROR, "Error in getting LifeCycleManagerStateful: ", e, e.getMessage()); - // This null value will cause NullPointerException when used later. - // Error handling could certainly be improved here. - return null; - } - } - - public Status runCommand(Action action, org.onap.appc.client.lcm.model.ActionIdentifiers actionIdentifiers, - org.onap.appc.client.lcm.model.Payload payload, String requestID) - throws ApplicationControllerOrchestratorException { - Object requestObject = createRequest(action, actionIdentifiers, payload, requestID); - appCSupport.logLCMMessage(requestObject); - LifeCycleManagerStateful client = getAppCClient(); - Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, false); - try { - Object response = lcmMethod.invoke(client, requestObject); - return appCSupport.getStatusFromGenericResponse(response); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - throw new RuntimeException(String.format("%s : %s", "Unable to invoke action", action.toString()), e); - } - } - - protected Properties getLCMProperties() { - return getLCMProperties("appc"); - } - - protected Properties getLCMProperties(String controllerType) { - Properties properties = new Properties(); - Map globalProperties = PropertyConfiguration.getInstance() - .getProperties("mso.bpmn.urn.properties"); - - properties.put("topic.read", globalProperties.get("appc.client.topic.read")); - properties.put("topic.write", globalProperties.get("appc.client.topic.write")); - properties.put("SDNC-topic.read", globalProperties.get("appc.client.topic.sdnc.read")); - properties.put("SDNC-topic.write", globalProperties.get("appc.client.topic.sdnc.write")); - properties.put("topic.read.timeout", globalProperties.get("appc.client.topic.read.timeout")); - properties.put("client.response.timeout", globalProperties.get("appc.client.response.timeout")); - properties.put("poolMembers", globalProperties.get("appc.client.poolMembers")); - properties.put("controllerType", controllerType); - properties.put("client.key", globalProperties.get("appc.client.key")); - properties.put("client.secret", globalProperties.get("appc.client.secret")); - properties.put("client.name", CLIENT_NAME); - properties.put("service", globalProperties.get("appc.client.service")); - return properties; - } - - public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId) { - Object requestObject = appCSupport.getInput(action.name()); - try { - CommonHeader commonHeader = buildCommonHeader(requestId); - requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject, - commonHeader); - requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action); - requestObject.getClass().getDeclaredMethod("setActionIdentifiers", ActionIdentifiers.class) - .invoke(requestObject, identifier); - if (payload != null) { - requestObject.getClass().getDeclaredMethod("setPayload", Payload.class).invoke(requestObject, payload); - } - } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { - auditLogger.log(Level.ERROR, "Error building Appc request: ", e, e.getMessage()); - } - return requestObject; - } - - private CommonHeader buildCommonHeader(String requestId) { - CommonHeader commonHeader = new CommonHeader(); - commonHeader.setApiVer(API_VER); - commonHeader.setOriginatorId(ORIGINATOR_ID); - commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId); - commonHeader.setSubRequestId(requestId); - Flags flags = new Flags(); - String flagsMode = "NORMAL"; - Mode mode = Mode.valueOf(flagsMode); - flags.setMode(mode); - String flagsForce = "FALSE"; - Force force = Force.valueOf(flagsForce); - flags.setForce(force); - flags.setTtl(FLAGS_TTL); - commonHeader.setFlags(flags); - Instant timestamp = Instant.now(); - ZULU zulu = new ZULU(timestamp.toString()); - commonHeader.setTimestamp(zulu); - return commonHeader; - } - - public Flags createRequestFlags() { - Flags flags = new Flags(); - flags.setTtl(6000); - return flags; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestrator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestrator.java deleted file mode 100644 index 744be5f28f..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestrator.java +++ /dev/null @@ -1,50 +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.client.appc; - -import java.util.Optional; - -import org.openecomp.mso.client.appc.ApplicationControllerSupport.StatusCategory; - -import org.onap.appc.client.lcm.model.Action; -import org.onap.appc.client.lcm.model.ActionIdentifiers; -import org.onap.appc.client.lcm.model.Payload; -import org.onap.appc.client.lcm.model.Status; - -public class ApplicationControllerOrchestrator { - - public Status vnfCommand(Action action, String requestId, String vnfId, Optional request, String controllerType) throws ApplicationControllerOrchestratorException { - ApplicationControllerClient client = new ApplicationControllerClient(controllerType); - Status status; - ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); - actionIdentifiers.setVnfId(vnfId); - Payload payload = null; - if (request.isPresent()) { - payload = new Payload(request.get()); - } - status = client.runCommand(action, actionIdentifiers, payload, requestId); - if (ApplicationControllerSupport.getCategoryOf(status).equals(StatusCategory.ERROR)) { - throw new ApplicationControllerOrchestratorException(status.getMessage(), status.getCode()); - } else { - return status; - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorException.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorException.java deleted file mode 100644 index 4692f1dcc2..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorException.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.client.appc; - -public class ApplicationControllerOrchestratorException extends Exception { - - private final int appcCode; - - public ApplicationControllerOrchestratorException(String message, int code) { - super(message); - appcCode = code; - } - - public int getAppcCode() - { - return appcCode; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java deleted file mode 100644 index e3ed432dfc..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java +++ /dev/null @@ -1,215 +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.client.appc; - -import java.beans.BeanInfo; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import org.springframework.stereotype.Component; - -import org.onap.appc.client.lcm.api.LifeCycleManagerStateful; -import org.onap.appc.client.lcm.api.ResponseHandler; -import org.onap.appc.client.lcm.model.Status; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.att.eelf.configuration.EELFLogger.Level; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; - -@Component -public class ApplicationControllerSupport { - - private static final int ACCEPT_SERIES = 100; - private static final int ERROR_SERIES = 200; - private static final int REJECT_SERIES = 300; - private static final int SUCCESS_SERIES = 400; - private static final int SUCCESS_STATUS = SUCCESS_SERIES; - private static final int PARTIAL_SERIES = 500; - private static final int PARTIAL_SUCCESS_STATUS = PARTIAL_SERIES; - private static final int PARTIAL_FAILURE_STATUS = PARTIAL_SERIES + 1; - - protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); - private String lcmModelPackage = "org.onap.appc.client.lcm.model"; - - /** - * @param action - * @return - * @throws ClassNotFoundException - * @throws InstantiationException - * @throws IllegalAccessException - */ - public Object getInput(String action) { - try { - return getInputClass(action).newInstance(); - } catch (IllegalAccessException | InstantiationException e) { - throw new RuntimeException( - String.format("%s : %s", "Unable to instantiate viable LCM Kit input class for action", action), e); - } - } - - /** - * @param action - * @return - * @throws ClassNotFoundException - */ - public Method getAPIMethod(String action, LifeCycleManagerStateful lcmStateful, boolean async) { - Method[] methods = lcmStateful.getClass().getMethods(); - for (Method method : methods) { - if (method.getName().equalsIgnoreCase(action)) { - Class[] methodParameterTypes = method.getParameterTypes(); - if (methodParameterTypes.length > 0) { - if (getInputClass(action).equals(methodParameterTypes[0])) { - if (async) { - if (methodParameterTypes.length == 2 - && ResponseHandler.class.isAssignableFrom(methodParameterTypes[1])) { - return method; - } - } else if (methodParameterTypes.length == 1) { - return method; - } - } - } - } - } - throw new RuntimeException(String.format("%s : %s, async=%b", - "Unable to derive viable LCM Kit API method for action", action, async)); - } - - public Status getStatusFromGenericResponse(Object response) { - Method statusReader = getBeanPropertyMethodFor(response.getClass(), "status", false); - if (statusReader != null) { - try { - return (Status) statusReader.invoke(response); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - auditLogger.log(Level.ERROR, "Unable to obtain status from LCM Kit response", e, e.getMessage()); - } - } - return new Status(); - } - - public static StatusCategory getCategoryOf(Status status) { - int codeSeries = status.getCode() - (status.getCode() % 100); - switch (codeSeries) { - case ACCEPT_SERIES: - return StatusCategory.NORMAL; - case ERROR_SERIES: - case REJECT_SERIES: - return StatusCategory.ERROR; - case SUCCESS_SERIES: - return status.getCode() == SUCCESS_STATUS ? StatusCategory.NORMAL : StatusCategory.ERROR; - case PARTIAL_SERIES: - switch (status.getCode()) { - case PARTIAL_SUCCESS_STATUS: - return StatusCategory.NORMAL; - case PARTIAL_FAILURE_STATUS: - return StatusCategory.ERROR; - default: - return StatusCategory.WARNING; - } - default: - return StatusCategory.WARNING; - } - } - - public static boolean getFinalityOf(Status status) { - int codeSeries = status.getCode() - (status.getCode() % 100); - switch (codeSeries) { - case ACCEPT_SERIES: - case PARTIAL_SERIES: - return false; - case ERROR_SERIES: - case REJECT_SERIES: - case SUCCESS_SERIES: - return true; - default: - return true; - } - } - - private Method getBeanPropertyMethodFor(Class clazz, String propertyName, boolean isWriter) { - BeanInfo beanInfo; - try { - beanInfo = Introspector.getBeanInfo(clazz, Object.class); - } catch (IntrospectionException e) { - throw new RuntimeException( - String.format("Unable to produce bean property method for class : %s, property : %s, writer=%b", - clazz.getName(), propertyName, isWriter), - e); - } - PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); - for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { - if (propertyDescriptor.getName().equals(propertyName)) { - return isWriter ? propertyDescriptor.getWriteMethod() : propertyDescriptor.getReadMethod(); - } - } - throw new RuntimeException( - String.format("Unable to produce bean property method for class : %s, property : %s, writer=%b", - clazz.getName(), propertyName, isWriter)); - } - - /** - * @param action - * @return - * @throws ClassNotFoundException - */ - private Class getInputClass(String action) { - try { - return Class.forName(lcmModelPackage + '.' + action + "Input"); - } catch (ClassNotFoundException e) { - throw new RuntimeException(String.format("%s : %s using package : %s", - "Unable to identify viable LCM Kit input class for action", action, lcmModelPackage), e); - } - } - - public enum StatusCategory { - NORMAL("normal"), WARNING("warning"), ERROR("error"); - - private final String category; - - private StatusCategory(final String category) { - this.category = category; - } - - @Override - public String toString() { - return category; - } - } - - public void logLCMMessage(Object message) { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.setSerializationInclusion(Include.NON_NULL); - ObjectWriter writer = objectMapper.writerWithDefaultPrettyPrinter(); - String inputAsJSON; - try { - inputAsJSON = writer.writeValueAsString(message); - auditLogger.log(Level.INFO, "\nLCM Kit input message follows: \n" + inputAsJSON, null); - } catch (JsonProcessingException e) { - auditLogger.log(Level.ERROR, "Error in logging LCM Message: ", e, e.getMessage()); - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaaproperties/DefaultDmaapPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaaproperties/DefaultDmaapPropertiesImpl.java deleted file mode 100644 index c3bf53cfde..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaaproperties/DefaultDmaapPropertiesImpl.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.client.dmaaproperties; - -import java.util.Map; - -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.dmaap.DmaapProperties; - -public class DefaultDmaapPropertiesImpl implements DmaapProperties { - - private final Map properties; - public DefaultDmaapPropertiesImpl() { - this.properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - } - @Override - public Map getProperties() { - return this.properties; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/AAIOrchestrator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/AAIOrchestrator.java deleted file mode 100644 index 73bad21c87..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/AAIOrchestrator.java +++ /dev/null @@ -1,114 +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.client.orchestration; - -import java.util.Optional; -import java.util.logging.Logger; - -import org.modelmapper.ModelMapper; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.client.aai.AAIResourcesClient; -import org.openecomp.mso.client.aai.entities.AAIEntityObject; -import org.openecomp.mso.client.aai.objects.AAIOwningEntity; -import org.openecomp.mso.client.aai.objects.AAIProject; -import org.openecomp.mso.client.aai.objects.AAIServiceInstance; - -public class AAIOrchestrator { - - private static Logger LOGGER = Logger.getLogger("AAIOrchestrator"); - - public void createServiceInstance(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject serviceInstance = modelMapper.map(serviceDecomp.getServiceInstance(), AAIServiceInstance.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(serviceInstance.getUri(), Optional.of(serviceInstance)); - }catch(Exception ex) { - String msg = "Failed to create service instance in A&AI."; - throw new IllegalStateException(msg); - } - } - - public void deleteServiceInstance(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject serviceInstance = modelMapper.map(serviceDecomp.getServiceInstance(), AAIServiceInstance.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.delete(serviceInstance.getUri()); - } catch (Exception ex) { - String msg = "Failed to delete service instance in A&AI."; - throw new IllegalStateException(msg); - } - } - - public void createProject(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject project = modelMapper.map(serviceDecomp.getProject(), AAIProject.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(project.getUri(), Optional.of(project)); - }catch(Exception ex) { - String msg = "Failed to create project in A&AI."; - throw new IllegalStateException(msg); } - } - - public void createProjectandConnectServiceInstance(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject project = modelMapper.map(serviceDecomp.getProject(), AAIProject.class); - AAIEntityObject serviceInstance = modelMapper.map(serviceDecomp.getServiceInstance(), AAIServiceInstance.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(project.getUri(), Optional.of(project)).connect(project.getUri(), serviceInstance.getUri()); - } catch(Exception ex) { - String msg = "Failed to create project and connect service instance in A&AI."; - throw new IllegalStateException(msg); - } - } - - public void createOwningEntity(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject owningEntity = modelMapper.map(serviceDecomp.getOwningEntity(), AAIOwningEntity.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(owningEntity.getUri(), Optional.of(owningEntity)); - }catch(Exception ex) { - String msg = "Failed to create owning entity in A&AI."; - throw new IllegalStateException(msg); - } - } - - public void createOwningEntityandConnectServiceInstance(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject owningEntity = modelMapper.map(serviceDecomp.getOwningEntity(), AAIOwningEntity.class); - AAIEntityObject serviceInstance = modelMapper.map(serviceDecomp.getServiceInstance(), AAIServiceInstance.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(owningEntity.getUri(), Optional.of(owningEntity)).connect(owningEntity.getUri(), serviceInstance.getUri()); - }catch(Exception ex) { - String msg = "Failed to create owning entity and connect service instance in A&AI."; - throw new IllegalStateException(msg); } - } - - protected AAIResourcesClient getClient() { - return new AAIResourcesClient(); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/SDNCOrchestrator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/SDNCOrchestrator.java deleted file mode 100644 index 4cefad2a3b..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/SDNCOrchestrator.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.client.orchestration; - -import java.util.Optional; -import java.util.logging.Logger; - -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.client.sdnc.beans.SDNCRequest; -import org.openecomp.mso.client.sdnc.beans.SDNCSvcAction; -import org.openecomp.mso.client.sdnc.beans.SDNCSvcOperation; -import org.openecomp.mso.client.sdnc.mapper.ServiceTopologyOperationRequestMapper; -import org.openecomp.mso.client.sdnc.sync.SDNCSyncRpcClient; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -public class SDNCOrchestrator { - - private static MsoPropertiesFactory msoPF = new MsoPropertiesFactory(); - - public void createServiceInstance (ServiceDecomposition serviceDecomp) { - - try{ - msoPF.initializeMsoProperties("MSO_PROP_SDNC_ADAPTER", "mso.sdnc.properties"); - Optional msoAction = getMSOAction(serviceDecomp); - ServiceTopologyOperationRequestMapper sdncRM = new ServiceTopologyOperationRequestMapper(msoAction, SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, "CreateServiceInstance"); - SDNCRequest request = sdncRM.reqMapper(serviceDecomp); - SDNCSyncRpcClient sdncRC = new SDNCSyncRpcClient (request, msoPF); - sdncRC.run(); - } catch (Exception ex) { - throw new IllegalStateException(); - } - } - - private Optional getMSOAction (ServiceDecomposition serviceDecomp){ - String serviceType = serviceDecomp.getServiceInstance().getServiceType(); - if(serviceType == null || serviceType.equals("")){ - return Optional.empty(); - } - - return Optional.of(serviceType); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java deleted file mode 100644 index a1ef35a49d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.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.client.restproperties; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; - -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.aai.AAIProperties; -import org.openecomp.mso.client.aai.AAIVersion; - -public class AAIPropertiesImpl implements AAIProperties { - - final Map props; - - public AAIPropertiesImpl() { - this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - - } - - @Override - public URL getEndpoint() throws MalformedURLException { - return new URL(props.get("aai.endpoint")); - } - - @Override - public String getSystemName() { - return "MSO"; - } - - @Override - public AAIVersion getDefaultVersion() { - return AAIVersion.LATEST; - } - - @Override - public String getAuth() { - return props.get("aai.auth"); - } - - @Override - public String getKey() { - return props.get("mso.msoKey"); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/PolicyRestPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/PolicyRestPropertiesImpl.java deleted file mode 100644 index eccf87c09d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/PolicyRestPropertiesImpl.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.client.restproperties; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; - -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.policy.PolicyRestProperties; - -public class PolicyRestPropertiesImpl implements PolicyRestProperties { - - - final Map props; - public PolicyRestPropertiesImpl() { - this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - - } - @Override - public URL getEndpoint() { - try { - return new URL(props.getOrDefault("policy.endpoint", "")); - } catch (MalformedURLException e) { - return null; - } - } - - @Override - public String getSystemName() { - return "MSO"; - } - - public String getClientAuth() { - return props.get("policy.client.auth"); - } - - public String getAuth() { - return props.get("policy.auth"); - } - - public String getEnvironment() { - return props.get("policy.environment"); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCRequest.java deleted file mode 100644 index cd04fc5ef0..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCRequest.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.client.sdnc.beans; - -public class SDNCRequest { - private String requestId; - private String svcInstanceId; - private SDNCSvcAction svcAction; - private SDNCSvcOperation svcOperation; - private String callbackUrl; - private String msoAction; - private String requestData; - - public SDNCRequest(String requestId, String svcInstanceId, SDNCSvcAction svcAction, SDNCSvcOperation svcOperation, - String callbackUrl, String msoAction, String requestData) { - this.requestId = requestId; - this.svcInstanceId = svcInstanceId; - this.svcAction = svcAction; - this.svcOperation = svcOperation; - this.callbackUrl = callbackUrl; - this.msoAction = msoAction; - this.requestData = requestData; - } - public SDNCRequest(){ - - } - - public String getRequestId() { - return requestId; - } - public void setRequestId(String requestId) { - this.requestId = requestId; - } - public String getSvcInstanceId() { - return svcInstanceId; - } - public void setSvcInstanceId(String svcInstanceId) { - this.svcInstanceId = svcInstanceId; - } - public SDNCSvcAction getSvcAction() { - return svcAction; - } - public void setSvcAction(SDNCSvcAction svcAction) { - this.svcAction = svcAction; - } - public SDNCSvcOperation getSvcOperation() { - return svcOperation; - } - public void setSvcOperation(SDNCSvcOperation svcOperation) { - this.svcOperation = svcOperation; - } - public String getCallbackUrl() { - return callbackUrl; - } - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - } - public String getMsoAction() { - return msoAction; - } - public void setMsoAction(String msoAction) { - this.msoAction = msoAction; - } - - public String getRequestData() { - return requestData; - } - public void setRequestData(String requestData) { - this.requestData = requestData; - } - @Override - public String toString() { - return "SDNCRequest [requestId=" + requestId + ", svcInstanceId=" + svcInstanceId + ", svcAction=" + svcAction - + ", svcOperation=" + svcOperation + ", callbackUrl=" + callbackUrl + ", msoAction=" + msoAction - + ", requestData=" + requestData + "]"; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcAction.java deleted file mode 100644 index 91e3a59276..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcAction.java +++ /dev/null @@ -1,46 +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.client.sdnc.beans; - -public enum SDNCSvcAction { - ACTIVATE("activate"), - DELETE("delete"), - ASSIGN("assign"), - ROLLBACK("rollback"), - UNASSIGN("unassign"), - DEACTIVATE("deactivate"), - CHANGE_DELETE("changedelete"), - CHANGE_ASSIGN("changeassign"), - CREATE("create"), - ENABLE("enable"), - DISABLE("disable"); - - private final String name; - - private SDNCSvcAction(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcOperation.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcOperation.java deleted file mode 100644 index 8cf1052064..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcOperation.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.client.sdnc.beans; - -public enum SDNCSvcOperation { - - VF_MODULE_TOPOLOGY_OPERATION("vf-module-topology-operation"), - NETWORK_TOPOLOGY_OPERATION("network-topology-operation"), - VNF_TOPOLOGY_OPERATION("vnf-topology-operation"), - CONTRAIL_ROUTE_TOPOLOGY_OPERATION("contrail-route-topology-operation"), - SECURITY_ZONE_TOPOLOGY_OPERATION("security-zone-topology-operation"), - PORT_MIRROR_TOPOLOGY_OPERATION("port-mirror-topology-operation"), - SERVICE_TOPOLOGY_OPERATION("service-topology-operation"); - - private final String name; - - private SDNCSvcOperation(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/SDNCRequestMapper.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/SDNCRequestMapper.java deleted file mode 100644 index 3e714e901d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/SDNCRequestMapper.java +++ /dev/null @@ -1,46 +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.client.sdnc.mapper; - -import java.util.Optional; - -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.client.sdnc.beans.SDNCRequest; -import org.openecomp.mso.client.sdnc.beans.SDNCSvcAction; -import org.openecomp.mso.client.sdnc.beans.SDNCSvcOperation; - -public abstract class SDNCRequestMapper { - - protected final Optional msoAction; - protected final SDNCSvcOperation svcOperation; - protected final SDNCSvcAction svcAction; - protected final String requestAction; - - public SDNCRequestMapper (Optional msoAction, SDNCSvcOperation svcOperation, - SDNCSvcAction svcAction, String requestAction) { - this.msoAction = msoAction; - this.svcOperation = svcOperation; - this.svcAction = svcAction; - this.requestAction = requestAction; - } - - public abstract SDNCRequest reqMapper (ServiceDecomposition serviceDecomp); -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/ServiceTopologyOperationRequestMapper.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/ServiceTopologyOperationRequestMapper.java deleted file mode 100644 index b87ed00650..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/ServiceTopologyOperationRequestMapper.java +++ /dev/null @@ -1,98 +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.client.sdnc.mapper; - -import java.io.StringWriter; -import java.util.Optional; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; - -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.client.sdnc.beans.SDNCRequest; -import org.openecomp.mso.client.sdnc.beans.SDNCSvcAction; -import org.openecomp.mso.client.sdnc.beans.SDNCSvcOperation; - -import openecomp.org.mso.workflow.schema.v1.EcompModelInformation; -import openecomp.org.mso.workflow.schema.v1.RequestInformation; -import openecomp.org.mso.workflow.schema.v1.SDNCServiceInstanceRequestData; -import openecomp.org.mso.workflow.schema.v1.ServiceInformation; -import openecomp.org.mso.workflow.schema.v1.ServiceRequestInput; - -public class ServiceTopologyOperationRequestMapper extends SDNCRequestMapper{ - - public ServiceTopologyOperationRequestMapper(Optional msoAction, SDNCSvcOperation svcOperation, - SDNCSvcAction svcAction, String requestAction) { - super(msoAction, svcOperation, svcAction, requestAction); - } - - @Override - public SDNCRequest reqMapper (ServiceDecomposition serviceDecomp) { - SDNCRequest req = new SDNCRequest(); - req.setCallbackUrl(serviceDecomp.getCallbackURN()); - if(msoAction.isPresent()){ - req.setMsoAction(msoAction.get()); - } - req.setRequestId(serviceDecomp.getRequest().getSdncRequestId()); - req.setSvcInstanceId(serviceDecomp.getServiceInstance().getInstanceId()); - req.setSvcAction(svcAction); - req.setSvcOperation(svcOperation); - String reqData =""; - - RequestInformation reqInfo = new RequestInformation(); - reqInfo.setRequestAction(requestAction); - reqInfo.setSource("MSO"); - reqInfo.setRequestId(serviceDecomp.getRequest().getRequestId()); - ServiceInformation servInfo = new ServiceInformation(); - EcompModelInformation emi = new EcompModelInformation(); - emi.setModelInvariantUuid(serviceDecomp.getRequest().getModelInfo().getModelInvariantUuid()); - emi.setModelName(serviceDecomp.getRequest().getModelInfo().getModelName()); - emi.setModelVersion(serviceDecomp.getRequest().getModelInfo().getModelVersion() ); - servInfo.setEcompModelInformation(emi); - servInfo.setServiceId(serviceDecomp.getServiceInstance().getServiceId()); - servInfo.setSubscriptionServiceType(serviceDecomp.getCustomer().getSubscriptionServiceType()); - servInfo.setServiceInstanceId(serviceDecomp.getServiceInstance().getInstanceName()); - servInfo.setGlobalCustomerId(serviceDecomp.getCustomer().getGlobalSubscriberId()); - ServiceRequestInput servReqInput = new ServiceRequestInput(); - servReqInput.setServiceInstanceName(serviceDecomp.getServiceInstance().getInstanceName()); - SDNCServiceInstanceRequestData sdncSIRD = new SDNCServiceInstanceRequestData(); - sdncSIRD.setRequestInformation(reqInfo); - sdncSIRD.setServiceInformation(servInfo); - sdncSIRD.setServiceRequestInput(servReqInput); - - try { - JAXBContext context = JAXBContext.newInstance(SDNCServiceInstanceRequestData.class); - - Marshaller jaxbMarshaller = context.createMarshaller(); - jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - - StringWriter sw = new StringWriter(); - jaxbMarshaller.marshal(sdncSIRD, sw); - reqData = sw.toString(); - req.setRequestData(reqData); - } catch (JAXBException e) { - e.printStackTrace(); - } - - return req; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/CallbackHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/CallbackHeader.java deleted file mode 100644 index 2ddafc1c17..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/CallbackHeader.java +++ /dev/null @@ -1,154 +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.client.sdnc.sync; - - -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="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="ResponseCode" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="ResponseMessage" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -//SDNCAdapter to BPEL Async response header -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestId", - "responseCode", - "responseMessage" -}) -@XmlRootElement(name = "CallbackHeader") -public class CallbackHeader { - - @XmlElement(name = "RequestId", required = true) - protected String requestId; - @XmlElement(name = "ResponseCode", required = true) - protected String responseCode; - @XmlElement(name = "ResponseMessage", required = true) - protected String responseMessage; - - public CallbackHeader() { - } - - public CallbackHeader(String reqId, String respCode, String respMsg) { - this.requestId = reqId; - this.responseCode = respCode; - this.responseMessage = respMsg; - } - - /** - * 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 responseCode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseCode() { - return responseCode; - } - - /** - * Sets the value of the responseCode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseCode(String value) { - this.responseCode = value; - } - - /** - * Gets the value of the responseMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseMessage() { - return responseMessage; - } - - /** - * Sets the value of the responseMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseMessage(String value) { - this.responseMessage = value; - } - - @Override - public String toString() { - return "CallbackHeader [requestId=" + requestId + ", responseCode=" - + responseCode + ", responseMessage=" + responseMessage + "]"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Constants.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Constants.java deleted file mode 100644 index 331fefa677..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/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.client.sdnc.sync; - - -public interface Constants { - - public static final String BPEL_REST_URL_PROP = "org.openecomp.mso.adapters.sdnc.rest.bpelurl"; - public static final String BPEL_URL_PROP = "org.openecomp.mso.adapters.sdnc.bpelurl"; - public static final String DEFAULT_BPEL_URL = "http://localhost:8080//active-bpel/services/SDNCAdapterCallbackV1"; - - public static final String MY_URL_PROP = "org.openecomp.mso.adapters.sdnc.myurl"; - public static final String DEFAULT_MY_URL = "https://localhost:8443/adapters/rest/SDNCNotify"; - - public static final String SDNC_AUTH_PROP = "org.openecomp.mso.adapters.sdnc.sdncauth"; - public static final String DEFAULT_SDNC_AUTH = "406B2AE613211B6FB52466DE6E1769AC"; - - public static final String DEFAULT_BPEL_AUTH = "05FDA034C27D1CA51AAB8FAE512EDE45241E16FC8C137D292AA3A964431C82DB"; - public static final String BPEL_AUTH_PROP = "org.openecomp.mso.adapters.sdnc.bpelauth"; - - - public static final String SDNC_SVCCFGRESP_ROOT = "input"; - public static final String SDNC_REQ_ID = "/svc-request-id"; - public static final String SDNC_RESP_CODE = "/response-code"; - public static final String SDNC_RESP_MSG = "/response-message"; - public static final String SDNC_CONNECTTIME_PROP = "org.openecomp.mso.adapters.sdnc.sdncconnecttime"; - public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; - - public static final String REQUEST_TUNABLES = "org.openecomp.mso.adapters.sdnc"; -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/ObjectFactory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/ObjectFactory.java deleted file mode 100644 index 3ddfdb2925..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/ObjectFactory.java +++ /dev/null @@ -1,77 +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.client.sdnc.sync; - - -import javax.xml.bind.annotation.XmlRegistry; - - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the org.openecomp.mso.adapters.sdnc 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 { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.adapters.sdnc - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link RequestHeader } - * - */ - public RequestHeader createRequestHeader() { - return new RequestHeader(); - } - - /** - * Create an instance of {@link SDNCAdapterResponse } - * - */ - public SDNCAdapterResponse createSDNCAdapterResponse() { - return new SDNCAdapterResponse(); - } - - /** - * Create an instance of {@link SDNCAdapterRequest } - * - */ - public SDNCAdapterRequest createSDNCAdapterRequest() { - return new SDNCAdapterRequest(); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestHeader.java deleted file mode 100644 index dee79898fa..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestHeader.java +++ /dev/null @@ -1,219 +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.client.sdnc.sync; - - -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="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="SvcInstanceId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="SvcAction" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="SvcOperation" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="CallbackUrl" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -//BPEL to SDNCAdapter request header -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestId", - "svcInstanceId", - "svcAction", - "svcOperation", - "callbackUrl", - "msoAction" -}) -@XmlRootElement(name = "RequestHeader") -public class RequestHeader { - - @XmlElement(name = "RequestId", required = true) - protected String requestId; - @XmlElement(name = "SvcInstanceId") - protected String svcInstanceId; - @XmlElement(name = "SvcAction", required = true) - protected String svcAction; - @XmlElement(name = "SvcOperation", required = true) - protected String svcOperation; - @XmlElement(name = "CallbackUrl", required = true) - protected String callbackUrl; - @XmlElement(name = "MsoAction") - protected String msoAction; - - /** - * 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; - } - - public String getSvcInstanceId() { - return svcInstanceId; - } - - public void setSvcInstanceId(String svcInstanceId) { - this.svcInstanceId = svcInstanceId; - } - - /** - * Gets the value of the svcAction property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSvcAction() { - return svcAction; - } - - /** - * Sets the value of the svcAction property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSvcAction(String value) { - this.svcAction = value; - } - - /** - * Gets the value of the svcOperation property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSvcOperation() { - return svcOperation; - } - - /** - * Sets the value of the svcOperation property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSvcOperation(String value) { - this.svcOperation = value; - } - - /** - * Gets the value of the callbackUrl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCallbackUrl() { - return callbackUrl; - } - - /** - * Sets the value of the callbackUrl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCallbackUrl(String value) { - this.callbackUrl = value; - } - - /** - * Gets the value of the callbackUrl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMsoAction() { - return msoAction; - } - - /** - * Sets the value of the callbackUrl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMsoAction(String value) { - this.msoAction = value; - } - - - @Override - public String toString() { - return "RequestHeader [requestId=" + requestId + - ", svcInstanceId=" + svcInstanceId + - ", svcAction=" + svcAction + - ", svcOperation=" + svcOperation + - ", callbackUrl=" + callbackUrl + - ", msoAction=" + msoAction + "]"; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestTunables.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestTunables.java deleted file mode 100644 index 55d42df6e1..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestTunables.java +++ /dev/null @@ -1,222 +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.client.sdnc.sync; - - -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -import org.openecomp.mso.logger.MessageEnum; -public class RequestTunables { - - private MsoPropertiesFactory msoPropertiesFactory; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER"; - - //criteria - private String reqId = ""; - private String msoAction = ""; - private String operation = ""; - private String action = ""; - - //tunables - private String reqMethod = "POST"; - private String sdncUrl = null; - private String timeout = "60000"; - private String headerName = "sdnc-request-header"; - private String namespace = ""; - private String asyncInd = "N"; //future use - - private String sdncaNotificationUrl = null; - - public RequestTunables(String reqId, String msoAction, String operation, String action, MsoPropertiesFactory msoPropFactory) { - super(); - msoPropertiesFactory = msoPropFactory; - if (reqId != null) { - this.reqId = reqId; - } - if (msoAction != null) { - this.msoAction = msoAction; - } - if (operation != null) { - this.operation = operation; - } - if (action != null) { - this.action = action; - } - } - - public String getReqId() { - return reqId; - } - public void setReqId(String reqId) { - this.reqId = reqId; - } - public String getReqMethod() { - return reqMethod; - } - public void setReqMethod(String reqMethod) { - this.reqMethod = reqMethod; - } - public String getMsoAction() { - return msoAction; - } - public void setMsoAction(String msoAction) { - this.msoAction = msoAction; - } - public String getAction() { - return action; - } - public void setAction(String action) { - this.action = action; - } - public String getOperation() { - return operation; - } - public void setOperation(String operation) { - this.operation = operation; - } - public String getSdncUrl() { - return sdncUrl; - } - public void setSdncUrl(String sdncUrl) { - this.sdncUrl = sdncUrl; - } - public String getTimeout() { - return timeout; - } - public void setTimeout(String timeout) { - this.timeout = timeout; - } - public String getAsyncInd() { - return asyncInd; - } - public void setAsyncInd(String asyncInd) { - this.asyncInd = asyncInd; - } - public String getHeaderName() { - return headerName; - } - public void setHeaderName(String headerName) { - this.headerName = headerName; - } - - - public String getSdncaNotificationUrl() { - return sdncaNotificationUrl; - } - - public void setSdncaNotificationUrl(String sdncaNotificationUrl) { - this.sdncaNotificationUrl = sdncaNotificationUrl; - } - - public String getNamespace() { - return namespace; - } - - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - @Override - public String toString() { - return "RequestTunables [reqId=" + reqId + ", msoAction=" + msoAction - + ", operation=" + operation + ", action=" + action - + ", reqMethod=" + reqMethod + ", sdncUrl=" + sdncUrl - + ", timeout=" + timeout + ", headerName=" + headerName - + ", sdncaNotificationUrl=" + sdncaNotificationUrl - + ", namespace=" + namespace + "]"; - } - - public void setTunables() - { - String error = null; - String key = null; - if ("query".equals(action)) { //due to variable format for operation eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9 - key = Constants.REQUEST_TUNABLES + "." + msoAction + ".." + action; - msoLogger.debug("Generated key: " + key); - } - else if ("put".equals(action) || "restdelete".equals(action)) { //due to variable format for operation eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9 - key = Constants.REQUEST_TUNABLES + "..." + action; - msoLogger.debug("Generated key: " + key); - } else { - key = Constants.REQUEST_TUNABLES + "." + msoAction + "." + operation +"." + action; - msoLogger.debug("Generated key: " + key); - } - - String value; - try { - value = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getProperty(key, ""); - } catch (MsoPropertiesException e) { - msoLogger.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Mso Properties ID not found in cache: " + MSO_PROP_SDNC_ADAPTER, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); - value=""; - } - - if (value != null && value.length() > 0) { - - String[] parts = value.split("\\|"); //escape pipe - if (parts.length < 3) { - msoLogger.warn(MessageEnum.RA_SDNC_INVALID_CONFIG, key, value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config"); - } - - for (int i = 0; i < parts.length; i++) { - if (i == 0) { - reqMethod = parts[i]; - msoLogger.debug("Request Method is set to: " + reqMethod); - } else if (i == 1) { - timeout = parts[i]; - msoLogger.debug("Timeout is set to: " + timeout); - } else if (i == 2) { - sdncUrl = SDNCAdapterPortTypeImpl.getProperty(Constants.REQUEST_TUNABLES + "." + parts[i], "",msoPropertiesFactory); - if (operation != null && sdncUrl != null) { - sdncUrl = sdncUrl + operation; - } - msoLogger.debug("SDNC Url is set to: " + sdncUrl); - } else if (i == 3) { - headerName = parts[i]; - msoLogger.debug("HeaderName is set to: " + headerName); - } else if (i == 4) { - namespace = parts[i]; - msoLogger.debug("NameSpace is set to: " + namespace); - } else if (i == 5) { - asyncInd = parts[i]; - msoLogger.debug("AsyncInd is set to: " + asyncInd); - } - } - if (sdncUrl == null) { - error = "Invalid configuration, sdncUrl required for:" + key + " value:" + value; - } - } else { - error = "Missing configuration for:" + key; - } - if (error != null) { - msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, key, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param"); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); - } - msoLogger.debug ("RequestTunables Key:" + key + " Value:" + value + " Tunables:" + this.toString()); - return; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequest.java deleted file mode 100644 index 6e9d6757ad..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequest.java +++ /dev/null @@ -1,136 +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.client.sdnc.sync; - - -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; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import java.io.StringWriter; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -/** - *

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/workflow/sdnc/adapter/schema/v1}CallbackHeader"/>
- *         <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -//SDNCAdapter to BPEL Async response -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "callbackHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterCallbackRequest") -public class SDNCAdapterCallbackRequest { - - @XmlElement(name = "CallbackHeader", required = true) - protected CallbackHeader callbackHeader; - @XmlElement(name = "RequestData") - protected Object requestData; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - /** - * Gets the value of the callbackHeader property. - * - * @return - * possible object is - * {@link CallbackHeader } - * - */ - public CallbackHeader getCallbackHeader() { - return callbackHeader; - } - - /** - * Sets the value of the callbackHeader property. - * - * @param value - * allowed object is - * {@link CallbackHeader } - * - */ - public void setCallbackHeader(CallbackHeader value) { - this.callbackHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - - @Override - public String toString() { - try { - JAXBContext ctx = JAXBContext.newInstance("org.openecomp.mso.adapters.sdnc.client"); - Marshaller m = ctx.createMarshaller(); - m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); - StringWriter w = new StringWriter(); - m.marshal(this, w); - return (w.toString()); - } - catch (Exception e) - { - msoLogger.error(MessageEnum.RA_MARSHING_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception - MARSHING_ERROR", e); - } - return(""); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortType.java deleted file mode 100644 index 8b56932769..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortType.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.client.sdnc.sync; - - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.xml.bind.annotation.XmlSeeAlso; - -import org.openecomp.mso.client.sdnc.beans.SDNCRequest; - - -/** - * This class was generated by Apache CXF 2.7.11.redhat-3 - * 2015-01-27T18:25:50.914-05:00 - * Generated source version: 2.7.11.redhat-3 - * - */ -//BPEL SDNCAdapter SOAP WebService - impl class in impl pkg -@WebService(targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/wsdl/v1", name = "SDNCAdapterPortType") -@XmlSeeAlso({ObjectFactory.class}) -@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -public interface SDNCAdapterPortType { - - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterResponse") - @WebMethod(operationName = "SDNCAdapter") - public SDNCAdapterResponse sdncAdapter( - @WebParam(partName = "SDNCAdapterRequest", name = "SDNCAdapterRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1") - SDNCAdapterRequest sdncAdapterRequest - ); - - @WebMethod - public void healthCheck(); - - SDNCAdapterResponse sdncAdapter(SDNCRequest bpelRequest); -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortTypeImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortTypeImpl.java deleted file mode 100644 index 3d9aab666a..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortTypeImpl.java +++ /dev/null @@ -1,108 +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.client.sdnc.sync; - -import javax.annotation.PostConstruct; -import javax.jws.WebService; -import javax.servlet.http.HttpServletResponse; - -import org.openecomp.mso.client.sdnc.beans.SDNCRequest; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -//BPEL SDNCAdapter SOAP Web Service implementation -@WebService(serviceName = "SDNCAdapterService", endpointInterface = "org.openecomp.mso.client.sdnc.sync.SDNCAdapterPortType", targetNamespace = "http://org.openecomp/workflow/sdnc/ad") -public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { - - private MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory(); - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - private static final String LOG_SERVICE_NAME = "MSO-BPMN:MSO-SDNCAdapter."; - private static final String LOG_REPLY_NAME = "MSO-SDNCAdapter:MSO-BPMN."; - public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER"; - - @PostConstruct - public void init () { - msoLogger.info(MessageEnum.RA_INIT_SDNC_ADAPTER, "SDNC", "SDNCAdapterPortType"); - } - - /** - * Health Check web method. Does nothing but return to show the adapter is deployed. - */ - @Override - public void healthCheck () - { - msoLogger.debug("Health check call in SDNC Adapter"); - } - - public static String getProperty(String key, String defaultValue, MsoPropertiesFactory msoPropertiesFactoryp) { - String value; - try { - value = msoPropertiesFactoryp.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getProperty(key, defaultValue); - } catch (MsoPropertiesException e) { - msoLogger.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: " + MSO_PROP_SDNC_ADAPTER, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); - return null; - } - msoLogger.debug("Config read for " + MSO_PROP_SDNC_ADAPTER + " - key:" + key + " value:" + value); - return value; - } - - @Override - public SDNCAdapterResponse sdncAdapter(SDNCRequest bpelRequest) { - String bpelReqId = bpelRequest.getRequestId(); - String callbackUrl = bpelRequest.getCallbackUrl(); - long startTime = System.currentTimeMillis (); - MsoLogger.setLogContext(SDNCRequestIdUtil.getSDNCOriginalRequestId (bpelReqId), bpelRequest.getSvcInstanceId()); - MsoLogger.setServiceName (bpelRequest.getSvcAction().toString()); - msoLogger.info(MessageEnum.RA_RECEIVE_BPEL_REQUEST, bpelReqId, callbackUrl, "SDNC", ""); - - SDNCSyncRpcClient sdncClient = new SDNCSyncRpcClient(bpelRequest,msoPropertiesFactory); - long subStartTime = System.currentTimeMillis (); - try { - Thread sdncClientThread = new Thread(sdncClient); - sdncClientThread.start(); - } - catch (Exception e){ - String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage(); - msoLogger.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception sending request to SDNC. Failed to start SDNC Client thread", e); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg); - SDNCResponse sdncResp = new SDNCResponse(bpelReqId); - sdncResp.setRespCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - sdncResp.setRespMsg(respMsg); - } - - msoLogger.debug("Sending synchronous response to BPEL"); - SDNCAdapterResponse wsResp = new SDNCAdapterResponse(); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); - return (wsResp); - } - - @Override - public org.openecomp.mso.client.sdnc.sync.SDNCAdapterResponse sdncAdapter( - org.openecomp.mso.client.sdnc.sync.SDNCAdapterRequest sdncAdapterRequest) { - // TODO Auto-generated method stub - return null; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequest.java deleted file mode 100644 index 5beedb12be..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequest.java +++ /dev/null @@ -1,128 +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.client.sdnc.sync; - - -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; - -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -/** - *

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/workflow/sdnc/adapter/schema/v1}RequestHeader"/>
- *         <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -//BPEL to SDNCAdapter request -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterRequest") -public class SDNCAdapterRequest { - - @XmlElement(name = "RequestHeader", required = true) - protected RequestHeader requestHeader; - @XmlElement(name = "RequestData", required = true) - protected Object requestData; - - /** - * Gets the value of the requestHeader property. - * - * @return - * possible object is - * {@link RequestHeader } - * - */ - public RequestHeader getRequestHeader() { - return requestHeader; - } - - /** - * Sets the value of the requestHeader property. - * - * @param value - * allowed object is - * {@link RequestHeader } - * - */ - public void setRequestHeader(RequestHeader value) { - this.requestHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - - @Override - public String toString() { - - String rd = ""; - if (requestData != null) - { - Node node = (Node) requestData; - Document doc = node.getOwnerDocument(); - rd = Utils.domToStr(doc); - } - return "SDNCAdapterRequest [requestHeader=" + requestHeader.toString() - + ", requestData=" + rd + "]"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterResponse.java deleted file mode 100644 index 4625bfb74f..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterResponse.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.client.sdnc.sync; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -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">
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -//SDNCAdapter to BPEL Sync Response(ACK) - async response(s) follow -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "SDNCAdapterResponse") -public class SDNCAdapterResponse { - - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterPortType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterPortType.java deleted file mode 100644 index 08d3bdbad7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterPortType.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.client.sdnc.sync; - - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.xml.bind.annotation.XmlSeeAlso; - - - -//SDNCAdapter to BPEL Async response WEB Service -@WebService(targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", name = "SDNCCallbackAdapterPortType") -@XmlSeeAlso({ObjectFactory.class}) -@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -public interface SDNCCallbackAdapterPortType { - - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") - @WebMethod(operationName = "SDNCAdapterCallback") - public SDNCAdapterResponse sdncAdapterCallback( - @WebParam(partName = "SDNCAdapterCallbackRequest", name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1") - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest - ); -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterService.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterService.java deleted file mode 100644 index 0e65a3080f..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterService.java +++ /dev/null @@ -1,126 +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.client.sdnc.sync; - - -import java.net.URL; - -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import javax.xml.ws.WebEndpoint; -import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceFeature; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * This class was generated by Apache CXF 2.7.11.redhat-3 - * 2015-01-28T11:07:02.074-05:00 - * Generated source version: 2.7.11.redhat-3 - * - */ -//SDNCAdapter to BPEL Async response WEB Service -@WebServiceClient(name = "SDNCCallbackAdapterService", - wsdlLocation = "main/resources/SDNCCallbackAdapter.wsdl", - targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1") -public class SDNCCallbackAdapterService extends Service { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - public final static URL WSDL_LOCATION; - public final static QName SERVICE = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterService"); - public final static QName SDNCCallbackAdapterSoapHttpPort = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterSoapHttpPort"); - static { - URL wsdlUrl = null; - try { - wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCCallbackAdapter.wsdl"); - //wsdlUrl = SDNCCallbackAdapterService.class.getClassLoader().getResource("SDNCCallbackAdapter.wsdl"); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e); - } - if(wsdlUrl == null) { - msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "WSDL not found"); - } else { - try { - msoLogger.info(MessageEnum.RA_PRINT_URL, "SDNCCallbackAdapter.wsdl", wsdlUrl.toURI().toString(), "SDNC", ""); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - URL convention problem", e); - } - } - WSDL_LOCATION = wsdlUrl; - } - - public SDNCCallbackAdapterService(URL wsdlLocation) { - super(wsdlLocation, SERVICE); - } - - public SDNCCallbackAdapterService(URL wsdlLocation, QName serviceName) { - super(wsdlLocation, serviceName); - } - - public SDNCCallbackAdapterService() { - super(WSDL_LOCATION, SERVICE); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCCallbackAdapterService(WebServiceFeature ... features) { - super(WSDL_LOCATION, SERVICE, features); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCCallbackAdapterService(URL wsdlLocation, WebServiceFeature ... features) { - super(wsdlLocation, SERVICE, features); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCCallbackAdapterService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) { - super(wsdlLocation, serviceName, features); - } - - /** - * - * @return - * returns SDNCCallbackAdapterPortType - */ - @WebEndpoint(name = "SDNCCallbackAdapterSoapHttpPort") - public SDNCCallbackAdapterPortType getSDNCCallbackAdapterSoapHttpPort() { - return super.getPort(SDNCCallbackAdapterSoapHttpPort, SDNCCallbackAdapterPortType.class); - } - - /** - * - * @param features - * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. - * @return - * returns SDNCCallbackAdapterPortType - */ - @WebEndpoint(name = "SDNCCallbackAdapterSoapHttpPort") - public SDNCCallbackAdapterPortType getSDNCCallbackAdapterSoapHttpPort(WebServiceFeature... features) { - return super.getPort(SDNCCallbackAdapterSoapHttpPort, SDNCCallbackAdapterPortType.class, features); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCRequestIdUtil.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCRequestIdUtil.java deleted file mode 100644 index d905748591..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCRequestIdUtil.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.client.sdnc.sync; - - -public class SDNCRequestIdUtil { - // Add private constructor to prevent instance creation. - private SDNCRequestIdUtil () {} - - public static String getSDNCOriginalRequestId (String newRequestId) { - - // Camunda scripts will add postfix, such as -1, -2, on the original requestID, to make sure requestID is unique while sending request to SDNC - // In order to use the unique requestID in logging, need to remove the postfix added by the Camunda scripts - // Verify whether the requestId is a valid UUID with postfix (-1, -2). If yes, it should contain 5 times char '-', since valid UUID contains 4 times '-' - // If the requestId is not a valid UUID with postfix, we do nothing - if (newRequestId.split("-").length == 6) { - return newRequestId.substring(0, newRequestId.lastIndexOf('-')); - } - return newRequestId; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCResponse.java deleted file mode 100644 index 850f5b4734..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCResponse.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.client.sdnc.sync; - - -import java.io.Serializable; - -public class SDNCResponse implements Serializable { - - private static final long serialVersionUID = 1L; - private String reqId = null; - private int respCode = 0; - private String respMsg = null; - private String sdncResp = null; - - public SDNCResponse(String reqId) { - this.reqId = reqId; - } - public SDNCResponse(String reqId, int respCode, String respMsg) { - this.reqId = reqId; - this.respCode = respCode; - this.respMsg = respMsg; - } - - public String getReqId() { - return reqId; - } - public void setReqId(String reqId) { - this.reqId = reqId; - } - public int getRespCode() { - return respCode; - } - public void setRespCode(int respCode) { - this.respCode = respCode; - } - public String getRespMsg() { - return respMsg; - } - public void setRespMsg(String respMsg) { - this.respMsg = respMsg; - } - public String getSdncResp() { - return sdncResp; - } - public void setSdncResp(String sdncResp) { - this.sdncResp = sdncResp; - } - - @Override - public String toString() { - return "SDNCResponse [reqId=" + reqId + ", respCode=" + respCode - + ", respMsg=" + respMsg + ", sdncResp=" + sdncResp + "]"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCSyncRpcClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCSyncRpcClient.java deleted file mode 100644 index ce9b706760..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCSyncRpcClient.java +++ /dev/null @@ -1,317 +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.client.sdnc.sync; - - -import java.io.BufferedReader; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.XMLConstants; -import javax.xml.bind.DatatypeConverter; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.ws.BindingProvider; -import javax.xml.ws.handler.MessageContext; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathFactory; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.json.JSONArray; -import org.json.JSONObject; -import org.openecomp.mso.client.sdnc.beans.SDNCRequest; -import org.openecomp.mso.client.sdnc.beans.SDNCSvcAction; -import org.openecomp.mso.client.sdnc.beans.SDNCSvcOperation; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -//SDNCAdapter to SDNC Rest Client -public class SDNCSyncRpcClient implements Runnable { - - private MsoPropertiesFactory msoPropertiesFactory; - - private SDNCRequest bpelRequest; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER"; - - - public SDNCSyncRpcClient(SDNCRequest bpelRequest,MsoPropertiesFactory msoPropFactory) { - this.bpelRequest = bpelRequest; - msoPropertiesFactory = msoPropFactory; - } - - @Override - public void run() - { - String action = bpelRequest.getSvcAction().toString(); - String operation = bpelRequest.getSvcOperation().toString(); - String bpelReqId = bpelRequest.getRequestId(); - String msoAction = bpelRequest.getMsoAction(); - MsoLogger.setLogContext(SDNCRequestIdUtil.getSDNCOriginalRequestId (bpelReqId), bpelRequest.getSvcInstanceId()); - MsoLogger.setServiceName("SDNCRestClient"); - String sdncReqBody = ""; - - msoLogger.debug("BPEL Request:" + bpelRequest.toString()); - RequestTunables rt = new RequestTunables(bpelReqId, msoAction, operation, action, msoPropertiesFactory); - rt.setTunables(); - rt.setSdncaNotificationUrl(SDNCAdapterPortTypeImpl.getProperty(Constants.MY_URL_PROP, Constants.DEFAULT_MY_URL,msoPropertiesFactory)); - - if ("POST".equals(rt.getReqMethod())) { - try { - DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - InputSource is = new InputSource(); - is.setCharacterStream(new StringReader(bpelRequest.getRequestData())); - Document reqDoc = db.parse(is); - sdncReqBody = Utils.genSdncReq(reqDoc, rt); - }catch(Exception ex) { - throw new IllegalStateException(); - } - } else if("PUT".equals(rt.getReqMethod())) { - try { - DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - InputSource is = new InputSource(); - is.setCharacterStream(new StringReader(bpelRequest.getRequestData())); - Document reqDoc = db.parse(is); - sdncReqBody = Utils.genSdncPutReq(reqDoc, rt); - }catch(Exception ex) { - throw new IllegalStateException(); - } - } - long sdncStartTime = System.currentTimeMillis(); - SDNCResponse sdncResp = getSdncResp(sdncReqBody, rt, msoPropertiesFactory); - msoLogger.recordMetricEvent (sdncStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from SDNC", "SDNC", action + "." + operation, null); - msoLogger.debug ("Got the SDNC Code : " + sdncResp.getRespCode()); - msoLogger.debug ("Got the SDNC Response Message:" + sdncResp.getRespMsg()); - validateSDNCResponse(sdncResp.getSdncResp()); - return; - } - - public static SDNCResponse getSdncResp(String sdncReqBody, RequestTunables rt, MsoPropertiesFactory msoPropertiesFactoryp) { - URL url; - HttpURLConnection con = null; - DataOutputStream out = null; - BufferedReader in = null; - SDNCResponse sdncResp = new SDNCResponse(rt.getReqId()); - StringBuffer response = new StringBuffer(); - - msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, rt.toString(), "SDNC", ""); - msoLogger.debug("SDNC Request Body:\n" + sdncReqBody); - - try { - msoLogger.debug("url is: " + rt.getSdncUrl()); - url = new URL(rt.getSdncUrl()); - con = (HttpURLConnection) url.openConnection(); - con.setConnectTimeout(Integer.parseInt(SDNCAdapterPortTypeImpl.getProperty(Constants.SDNC_CONNECTTIME_PROP, "2000",msoPropertiesFactoryp))); - con.setReadTimeout(Integer.parseInt(rt.getTimeout())); - con.setRequestProperty("Accept", "application/json"); - String userCredentials = msoPropertiesFactoryp.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getEncryptedProperty(Constants.SDNC_AUTH_PROP, Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY); - - String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()); - con.setRequestProperty ("Authorization", basicAuth); - con.setRequestMethod(rt.getReqMethod()); - - if ("POST".equals(rt.getReqMethod()) || "PUT".equals(rt.getReqMethod())) { - con.setRequestProperty("Content-type", "application/json"); - con.setRequestProperty("Content-length",String.valueOf(sdncReqBody.length())); - con.setDoOutput(true); - out = new DataOutputStream(con.getOutputStream()); - out.writeBytes(sdncReqBody); - out.flush(); - out.close(); - } - - //Get response - sdncResp.setRespCode(con.getResponseCode()); - sdncResp.setRespMsg(con.getResponseMessage()); - - if (con.getResponseCode()>= 200 && con.getResponseCode()<=299) { - in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - //Not parsing the response -it contains a responseHdr section and data section - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - } - - sdncResp.setSdncResp(response.toString()); - msoLogger.info(MessageEnum.RA_RESPONSE_FROM_SDNC, sdncResp.toString(), "SDNC", ""); - return(sdncResp); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception processing request to SDNC", e); - //default - sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR); - String respMsg = "Error processing request to SDNC. "; - String sdncErrMsg = null; - - if (e instanceof java.net.SocketTimeoutException ) { - sdncResp.setRespCode(HttpURLConnection.HTTP_CLIENT_TIMEOUT); - respMsg = "Request to SDNC timed out. "; - } - if (con != null) { - try { //e1 - if (con.getResponseCode() != HttpURLConnection.HTTP_OK) //seen in SocketException connection reset - sdncResp.setRespCode(con.getResponseCode()); - respMsg = respMsg + con.getResponseMessage() + ". "; - InputStream is = con.getErrorStream(); - if (is != null) { - XPathFactory xpathFactory = XPathFactory.newInstance(); - XPath xpath = xpathFactory.newXPath(); - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true); - DocumentBuilder db; - Document doc = null; - try { //e2 - db = dbf.newDocumentBuilder(); - doc = db.parse(is); - NodeList errors = (NodeList)xpath.evaluate("errors/error", doc, XPathConstants.NODESET); - for (int i = 0; i < errors.getLength(); i++) { - Element error = (Element) errors.item(i); - String eType = null; - try { - eType = xpath.evaluate("error-type", error); - sdncErrMsg = ". SDNC Returned-[error-type:" + eType; - } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); - } - - String eTag = null; - try { - eTag = xpath.evaluate( "error-tag", error); - sdncErrMsg = sdncErrMsg + ", error-tag:" + eTag; - } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); - } - - String eMsg = null; - try { - eMsg = xpath.evaluate("error-message", error); - sdncErrMsg = sdncErrMsg + ", error-message:" + eMsg + "]"; - } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); - } - } - } catch (Exception e2) { - msoLogger.error (MessageEnum.RA_ANALYZE_ERROR_EXC, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while analyse error", e2); - } - } //is != null - } catch (Exception e1) { - msoLogger.error (MessageEnum.RA_ERROR_GET_RESPONSE_SDNC, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception while get SDNC response", e1); - } - } //con != null - - if (e.getMessage() != null) { - respMsg = respMsg + e.getMessage(); - } - if (sdncErrMsg != null) { - respMsg = respMsg + sdncErrMsg; - } - - sdncResp.setRespMsg(respMsg); - - msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with SDNC", e); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg); - return(sdncResp); - } - finally { - if (con != null) { - con.disconnect(); - } - } - } - public void validateSDNCResponse (String sdncResponse){ - String msg; - msoLogger.debug ("Starting validate sdnc response"); - String responseMessage = ""; - String responseCode = ""; - if (sdncResponse != null || !sdncResponse.equals("")){ - try{ - msoLogger.debug ("Got the SDNC Response: " + sdncResponse); - JSONObject jsonObj = new JSONObject(sdncResponse); - msoLogger.debug ("jsonObj has been created"); - - JSONObject requestData = jsonObj.getJSONObject("v1:RequestData"); - JSONObject output = requestData.getJSONObject("output"); - try{ - responseMessage = output.getString("response-message"); - responseCode = output.getString("response-code"); - } catch (Exception ex) { - msoLogger.debug("Response not in lower hyphen"); - } - if(responseMessage.equals("")&&responseCode.equals("")){ - try{ - responseMessage = output.getString("ResponseMessage"); - responseCode = output.getString("ResponseCode"); - } catch (Exception ex) { - msoLogger.debug("Response does not exist"); - } - } - msoLogger.debug("ResponseMessage is: " + responseMessage); - msoLogger.debug("Response Code is: " + responseCode); - if(responseMessage.equals("")){ - msg = "Error from SDNC: Response Message is empty."; - msoLogger.debug(msg); - throw new IllegalStateException(msg); - } - - if(responseCode.equals("")){ - responseCode = "0"; - } - - int code = Integer.parseInt(responseCode); - if(code >=200 && code <=299 || code ==0){ - msoLogger.debug ("Successful Response from SDNC"); - - } else { - msg = "Error from SDNC: Code is not 200-299 or 0."; - msoLogger.debug(msg); - throw new IllegalStateException(msg); - } - } catch (Exception ex) { - msg = "Validate SDNC Response has failed."; - msoLogger.debug(msg); - throw new IllegalStateException(msg); - } - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Utils.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Utils.java deleted file mode 100644 index 7457b59390..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Utils.java +++ /dev/null @@ -1,195 +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.client.sdnc.sync; - - -import java.io.StringWriter; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -public class Utils { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - public static String genSdncReq(Document reqDoc, RequestTunables rt) { - try { - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - //NewDoc for output - //Root - Document newdoc = db.newDocument(); - Element root = newdoc.createElementNS(rt.getNamespace(), "input"); - newdoc.appendChild(root); - - //Header - Element hdr = newdoc.createElement(rt.getHeaderName()); - root.appendChild(hdr); - - String elemData = rt.getReqId(); - Element hdrChild; - if (elemData != null && elemData.length() > 0) - { - hdrChild = newdoc.createElement("svc-request-id"); - hdrChild.appendChild(newdoc.createTextNode(elemData)); - hdr.appendChild(hdrChild); - } - - elemData = rt.getAction(); - if (elemData != null && elemData.length() > 0) - { - hdrChild = newdoc.createElement("svc-action"); - hdrChild.appendChild(newdoc.createTextNode(elemData)); - hdr.appendChild(hdrChild); - } - - elemData = rt.getSdncaNotificationUrl(); - if (elemData != null && elemData.length() > 0) - { - hdrChild = newdoc.createElement("svc-notification-url"); - hdrChild.appendChild(newdoc.createTextNode(elemData)); - hdr.appendChild(hdrChild); - } - - //RequestData - NodeList nodes = reqDoc.getDocumentElement().getChildNodes(); - for (int i = 0; i < nodes.getLength(); i++) { - Node n = nodes.item(i); - Node newNode = newdoc.importNode(n, true); - root.appendChild(newNode); - } - - String s = domToStr(newdoc); - msoLogger.debug("Formatted SdncReq:\n" + s); - return (s); - - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in genSdncReq", e); - } - return(null); - } - - public static String genSdncPutReq(Document reqDoc, RequestTunables rt) { - try { - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - //NewDoc for output - //Root - Document newdoc = db.newDocument(); - - //RequestData - NodeList nodes = reqDoc.getDocumentElement().getChildNodes(); - - - Element root = newdoc.createElement(nodes.item(0).getNodeName()); - newdoc.appendChild(root); - - NodeList childNodes = nodes.item(0).getChildNodes(); - for (int i = 0; i < childNodes.getLength(); i++) { - Node n = childNodes.item(i); - Node newNode = newdoc.importNode(n, true); - root.appendChild(newNode); - } - - String s = domToStr(newdoc); - msoLogger.debug("Formatted SdncPutReq:\n" + s); - return (s); - - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception in genSdncPutReq", e); - } - return(null); - } - - public static String genMsoFailResp(SDNCResponse resp) { - try { - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - //NewDoc for output - //Root - Document newdoc = db.newDocument(); - Element root = newdoc.createElement("output"); - newdoc.appendChild(root); - - Element elem1 = newdoc.createElement("svc-request-id"); - elem1.appendChild(newdoc.createTextNode(resp.getReqId())); - root.appendChild(elem1); - - Element elem2 = newdoc.createElement("response-code"); - elem2.appendChild(newdoc.createTextNode(String.valueOf(resp.getRespCode()))); - root.appendChild(elem2); - - Element elem3 = newdoc.createElement("response-message"); - elem3.appendChild(newdoc.createTextNode(String.valueOf(resp.getRespMsg()))); - root.appendChild(elem3); - - String s = domToStr(newdoc); - msoLogger.debug("Formatted SdncReq:" + s); - return (s); - - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception in genMsoFailResp", e); - } - return(null); - } - - - public static String domToStr(Document doc) - { - if (doc != null) - { - try { - DOMSource ds = new DOMSource(doc); - StringWriter sw = new StringWriter(); - StreamResult sr = new StreamResult(sw); - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer t = tf.newTransformer(); - //t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");// - t.transform(ds, sr); - String s = sw.toString(); - - // This is an awful fix for now but we don't want that xmlns="" to be generated - s = s.replaceAll("xmlns=\"\"", ""); - return(s); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CONVERT_XML2STR, "", "", MsoLogger.ErrorCode.DataError, "Exception - domToStr", e); - } - } - return(null); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/persistence.xml b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/persistence.xml index d7166d81a9..fb027b8ed0 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/persistence.xml +++ b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/persistence.xml @@ -1,37 +1,37 @@ - - - - - - - java:jboss/datasources/ProcessEngine - - - - - - - - + + + + + + + java:jboss/datasources/ProcessEngine + + + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml index 772867d3f2..33c8cb1ac0 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml +++ b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml @@ -22,7 +22,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - default false true diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties new file mode 100644 index 0000000000..bdc72c86a4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties @@ -0,0 +1,2 @@ +org.onap.so.client.restproperties.AAIPropertiesImpl +org.onap.so.client.restproperties.PolicyRestPropertiesImpl \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.dmaap.DmaapProperties b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.dmaap.DmaapProperties new file mode 100644 index 0000000000..878841f563 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.dmaap.DmaapProperties @@ -0,0 +1 @@ +org.onap.so.client.dmaapproperties.DefaultDmaapPropertiesImpl \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties deleted file mode 100644 index 2668367d16..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties +++ /dev/null @@ -1,2 +0,0 @@ -org.openecomp.mso.client.restproperties.AAIPropertiesImpl -org.openecomp.mso.client.restproperties.PolicyRestPropertiesImpl \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.openecomp.mso.client.dmaap.DmaapProperties b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.openecomp.mso.client.dmaap.DmaapProperties deleted file mode 100644 index 8010194263..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.openecomp.mso.client.dmaap.DmaapProperties +++ /dev/null @@ -1 +0,0 @@ -org.openecomp.mso.client.dmaaproperties.DefaultDmaapPropertiesImpl \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/logback.xml b/bpmn/MSOCommonBPMN/src/main/resources/logback.xml deleted file mode 100644 index 133fa54003..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/logback.xml +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${logDirectory}/${auditLogName}${jboss.server.name}.log - - ${logDirectory}/${auditLogName}${jboss.server.name}.log.%d - - - - ${auditPattern} - - - - 256 - - - - - ${logDirectory}/${metricsLogName}${jboss.server.name}.log - - ${logDirectory}/${metricsLogName}${jboss.server.name}.log.%d - - - - - ${metricPattern} - - - - - - 256 - - - - - ${logDirectory}/${errorLogName}${jboss.server.name}.log - - ${logDirectory}/${errorLogName}${jboss.server.name}.log.%d - - - - INFO - - - ${errorPattern} - - - - - 256 - - - - - ${debugLogDirectory}/${debugLogName}${jboss.server.name}.log - - ${debugLogDirectory}/${debugLogName}${jboss.server.name}.log.%d - - - - ${debugPattern} - - - - - 256 - - true - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/AppCClient.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/AppCClient.bpmn index fb25363a76..db811b10e7 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/AppCClient.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/AppCClient.bpmn @@ -8,7 +8,7 @@ SequenceFlow_1wz1rfg SequenceFlow_14vlkf4 - @@ -21,7 +21,7 @@ acc.preProcessRequest(execution)]]> SequenceFlow_14vlkf4 SequenceFlow_1j937vi @@ -38,7 +38,7 @@ acc.runAppcCommand(execution)]]> SequenceFlow_1wi3avf SequenceFlow_1gq753e - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/DecomposeService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/DecomposeService.bpmn index 841964211e..d5223bca14 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/DecomposeService.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/DecomposeService.bpmn @@ -1,142 +1,142 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_0tj2l1j - - - - SequenceFlow_0tgrn11 - - - - SequenceFlow_0g4aus9 - - - - SequenceFlow_0tgrn11 - SequenceFlow_0g4aus9 - - - - - - SequenceFlow_12vj619 - SequenceFlow_0tj2l1j - - - - - SequenceFlow_1 - SequenceFlow_0yxffj2 - - - - - - SequenceFlow_0yxffj2 - SequenceFlow_12vj619 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + SequenceFlow_1 + + + + SequenceFlow_0tj2l1j + + + + SequenceFlow_0tgrn11 + + + + SequenceFlow_0g4aus9 + + + + SequenceFlow_0tgrn11 + SequenceFlow_0g4aus9 + + + + + + SequenceFlow_12vj619 + SequenceFlow_0tj2l1j + + + + + SequenceFlow_1 + SequenceFlow_0yxffj2 + + + + + + SequenceFlow_0yxffj2 + SequenceFlow_12vj619 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Homing.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Homing.bpmn index 91a6546621..fdb54116b8 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Homing.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Homing.bpmn @@ -1,17 +1,22 @@ - + SequenceFlow_1x9usa6 - - sniroCall - SequenceFlow_0gajic6 - + + SequenceFlow_1x9usa6 + SequenceFlow_0lc15i7 + - + SequenceFlow_1rf4vs8 @@ -24,7 +29,7 @@ homing.callSniro(execution)]]> SequenceFlow_00nlh7l SequenceFlow_1rf4vs8 - @@ -35,7 +40,7 @@ ex.processSubflowsBPMNException(execution)]]> SequenceFlow_0kamg53 SequenceFlow_1o7154s - @@ -50,37 +55,18 @@ ex.processJavaException(execution)]]> - - sniroProcess - SequenceFlow_1h9opg9 - - - - SequenceFlow_12t0lqb - SequenceFlow_0gajic6 - badResponse - goodResponse - - - badResponse - SequenceFlow_0clfkld - + + SequenceFlow_1fipbmk + SequenceFlow_01apjvo + - - - - SequenceFlow_0clfkld - - - - - @@ -90,71 +76,16 @@ ex.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync - goodResponse + SequenceFlow_0lc15i7 SequenceFlow_1fipbmk - - - SequenceFlow_1h9opg9 - SequenceFlow_07u9d7f + + + + SequenceFlow_01apjvo - - SequenceFlow_1x9usa6 - sniroCall - oofCall - SequenceFlow_02eywxz - - - oofCall - SequenceFlow_12t0lqb - - - - - - - - - - - - SequenceFlow_1fipbmk - sniroProcess - oofProcess - - - - - - - - - - oofProcess - SequenceFlow_07u9d7f - - - - - SequenceFlow_1bub8mj - - - - SequenceFlow_02eywxz - SequenceFlow_1bub8mj - - - - + @@ -164,239 +95,112 @@ ex.buildAndThrowWorkflowException(execution, responseCode, "No sniroHomingSoluti - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - - - + + + + - + - - + + - + - - + + - + - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - + + - + - - - - + + + - + - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - + + + - + diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/HomingV2.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/HomingV2.bpmn new file mode 100644 index 0000000000..9481ad892e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/HomingV2.bpmn @@ -0,0 +1,194 @@ + + + + + SequenceFlow_0gpuwes + + + + SequenceFlow_14dg22y + + + + SequenceFlow_0g3mn4b + + + + SequenceFlow_0g3mn4b + SequenceFlow_14dg22y + + + + + + + + seq + SequenceFlow_1epbfhx + + + + seq + + + + SequenceFlow_1epbfhx + + + + + + + + + + + + + + + sequence_2 + SequenceFlow_0m9c6gt + + + updateExecution + + + + + + + + SequenceFlow_0gpuwes + sequence_2 + + + SequenceFlow_0m9c6gt + updateExecution + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/ManualHandling.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/ManualHandling.bpmn index 4d31eee45a..cec3e249ea 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/ManualHandling.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/ManualHandling.bpmn @@ -19,7 +19,7 @@ SequenceFlow_0tgrn11 SequenceFlow_0g4aus9 - @@ -30,7 +30,7 @@ exceptionUtil.processJavaException(execution)]]> - @@ -38,7 +38,7 @@ mh.completeTask(task)]]> - @@ -54,7 +54,7 @@ mh.setTaskVariables(task)]]> - ${URN_mso_adapters_openecomp_db_endpoint} + @@ -75,14 +75,14 @@ mh.setTaskVariables(task)]]> SequenceFlow_0zgg47r SequenceFlow_0mbjrvr - SequenceFlow_192yimz SequenceFlow_0zer29a - @@ -90,7 +90,7 @@ mh.prepareRequestsDBStatusUpdate(execution, "IN_PROGRESS")]]> - ${URN_mso_adapters_openecomp_db_endpoint} + @@ -111,7 +111,7 @@ mh.prepareRequestsDBStatusUpdate(execution, "IN_PROGRESS")]]> SequenceFlow_0jav6cu SequenceFlow_0zgg47r - @@ -120,7 +120,7 @@ mh.preProcessRequest(execution)]]> SequenceFlow_0b84ki5 SequenceFlow_0igra4l - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Orchestration.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Orchestration.bpmn new file mode 100644 index 0000000000..c2214aac26 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Orchestration.bpmn @@ -0,0 +1,56 @@ + + + + + SequenceFlow_10gblml + + + SequenceFlow_0x1lx7c + + + + + + + + + SequenceFlow_10gblml + SequenceFlow_0x1lx7c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/RainyDayHandler.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/RainyDayHandler.bpmn index 8183469798..b4a3fc7721 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/RainyDayHandler.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/RainyDayHandler.bpmn @@ -21,7 +21,7 @@ SequenceFlow_0tgrn11 SequenceFlow_0g4aus9 - @@ -30,7 +30,7 @@ exceptionUtil.processJavaException(execution)]]> SequenceFlow_1 SequenceFlow_0yxffj2 - @@ -40,7 +40,7 @@ rdh.preProcessRequest(execution) SequenceFlow_0yxffj2 SequenceFlow_12vj619 - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn index 9bfd4535ea..31a981729b 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn @@ -1,17 +1,17 @@ - + SequenceFlow_18 SequenceFlow_2 - - + SequenceFlow_18 @@ -41,7 +41,7 @@ preProcessRequestData.preProcessRequest(execution) SequenceFlow_127i45q SequenceFlow_10 - @@ -50,7 +50,7 @@ completeMsoProcess.setUpdateDBstatustoSuccessPayload(execution)]]> - ${URN_mso_adapters_openecomp_db_endpoint} + @@ -75,7 +75,7 @@ completeMsoProcess.setUpdateDBstatustoSuccessPayload(execution)]]>SequenceFlow_9 Build Error Message @@@@" //println "CMSO_updateRequestResponse IS --> " + execution.getVariable("CMSO_updateRequestResponse") -import org.openecomp.mso.bpmn.common.scripts.* +import org.onap.so.bpmn.common.scripts.* def buildDataErrorMessage = new CompleteMsoProcess() buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB status to SUCCESS -- Failed")]]> @@ -95,7 +95,7 @@ buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB stat - + @@ -132,7 +132,7 @@ buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB stat - + SequenceFlow_0xe5zck SequenceFlow_127i45q SequenceFlow_1ffkc0n @@ -156,7 +156,7 @@ buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB stat SequenceFlow_1g8ig3h SequenceFlow_1pzb94j Complete MSO Process Done SUCCESSFULLY" -import org.openecomp.mso.bpmn.common.scripts.* +import org.onap.so.bpmn.common.scripts.* def postProcessResponseData = new CompleteMsoProcess() postProcessResponseData.postProcessResponse(execution) println "CompleteMsoProcess Response -->" + "\n" + execution.getVariable("CompletionHandlerResponse")]]> @@ -171,7 +171,7 @@ println "CompleteMsoProcess Response -->" + "\n" + execution.getVariable("Comple - + diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupName.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupName.bpmn index b190107d5e..0e99ce9683 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupName.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupName.bpmn @@ -12,7 +12,7 @@ SequenceFlow_23 SequenceFlow_18 - @@ -24,7 +24,7 @@ cvgn.handleAAIQueryFailure(execution)]]> SequenceFlow_38 SequenceFlow_39 - @@ -32,7 +32,7 @@ cvgn.queryAAIForVolumeGroupId(execution)]]> SequenceFlow_1 SequenceFlow_38 - @@ -41,7 +41,7 @@ cvgn.preProcessRequest(execution)]]> SequenceFlow_2 SequenceFlow_4 - @@ -49,7 +49,7 @@ cvgn.checkAAIQueryResult(execution)]]> SequenceFlow_7 SequenceFlow_11 - @@ -66,7 +66,7 @@ cvgn.handleVolumeGroupNameNoMatch(execution)]]> - + SUCCESS ]]> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupTenant.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupTenant.bpmn index df55046a7b..eb83adf2d4 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupTenant.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupTenant.bpmn @@ -1,190 +1,190 @@ - - - - - SequenceFlow_1 - SequenceFlow_2 - + + + + SequenceFlow_1 + SequenceFlow_2 + - - - SequenceFlow_2 - idsMatchNo - idsMatchYes - - - - - - - - SequenceFlow_7 - - - - idsMatchNo - SequenceFlow_8 - + + + SequenceFlow_2 + idsMatchNo + idsMatchYes + + + + + + + + SequenceFlow_7 + + + + idsMatchNo + SequenceFlow_8 + - - - - SequenceFlow_8 - - - - groupNamesMatchYes - SequenceFlow_7 - + + + + SequenceFlow_8 + + + + groupNamesMatchYes + SequenceFlow_7 + - - - - groupNamesMatchNo - SequenceFlow_9 - + + + + groupNamesMatchNo + SequenceFlow_9 + - - - - SequenceFlow_9 - - - - idsMatchYes - groupNamesMatchNo - groupNamesMatchYes - - - - - - - SequenceFlow_1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +volume.assignWorkflowException(execution, "name does not match")]]> + + + + SequenceFlow_9 + + + + idsMatchYes + groupNamesMatchNo + groupNamesMatchYes + + + + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModule.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModule.bpmn index 3ac1fe7781..6f1db9da07 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModule.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModule.bpmn @@ -1,519 +1,519 @@ - - - - - SequenceFlow_24 - SequenceFlow_6 - SequenceFlow_7 - SequenceFlow_28 - - - - - - - SequenceFlow_39 - SequenceFlow_22 - SequenceFlow_23 - - - - - - - SequenceFlow_23 - SequenceFlow_18 - - - - - SequenceFlow_18 - - - - SequenceFlow_22 - SequenceFlow_24 - - - - - SequenceFlow_8 - SequenceFlow_5 - SequenceFlow_10 - - - SequenceFlow_4 - SequenceFlow_35 - SequenceFlow_8 - - - - - - SequenceFlow_28 - SequenceFlow_26 - SequenceFlow_33 - SequenceFlow_29 - - - - SequenceFlow_29 - - - - - SequenceFlow_7 - SequenceFlow_31 - - - - - SequenceFlow_34 - SequenceFlow_35 - - - - - SequenceFlow_31 - SequenceFlow_33 - SequenceFlow_34 - - - - - - - SequenceFlow_38 - SequenceFlow_39 - - - - - SequenceFlow_1 - SequenceFlow_38 - - - - - SequenceFlow_2 - - - - SequenceFlow_5 - SequenceFlow_2 - - - - - - - SequenceFlow_10 - - - - - - SequenceFlow_20 - SequenceFlow_13 - SequenceFlow_26 - SequenceFlow_27 - - - - - - - SequenceFlow_6 - SequenceFlow_9 - SequenceFlow_11 - - - - SequenceFlow_9 - SequenceFlow_20 - - - - - - - - SequenceFlow_27 - SequenceFlow_12 - SequenceFlow_4 - - - - - SequenceFlow_1 - - - - - SequenceFlow_11 - SequenceFlow_3 - - - - - SequenceFlow_3 - SequenceFlow_12 - SequenceFlow_13 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + SequenceFlow_24 + SequenceFlow_6 + SequenceFlow_7 + SequenceFlow_28 + + + + + + + SequenceFlow_39 + SequenceFlow_22 + SequenceFlow_23 + + + + + + + SequenceFlow_23 + SequenceFlow_18 + + + + + SequenceFlow_18 + + + + SequenceFlow_22 + SequenceFlow_24 + + + + + SequenceFlow_8 + SequenceFlow_5 + SequenceFlow_10 + + + SequenceFlow_4 + SequenceFlow_35 + SequenceFlow_8 + + + + + + SequenceFlow_28 + SequenceFlow_26 + SequenceFlow_33 + SequenceFlow_29 + + + + SequenceFlow_29 + + + + + SequenceFlow_7 + SequenceFlow_31 + + + + + SequenceFlow_34 + SequenceFlow_35 + + + + + SequenceFlow_31 + SequenceFlow_33 + SequenceFlow_34 + + + + + + + SequenceFlow_38 + SequenceFlow_39 + + + + + SequenceFlow_1 + SequenceFlow_38 + + + + + SequenceFlow_2 + + + + SequenceFlow_5 + SequenceFlow_2 + + + + + + + SequenceFlow_10 + + + + + + SequenceFlow_20 + SequenceFlow_13 + SequenceFlow_26 + SequenceFlow_27 + + + + + + + SequenceFlow_6 + SequenceFlow_9 + SequenceFlow_11 + + + + SequenceFlow_9 + SequenceFlow_20 + + + + + + + + SequenceFlow_27 + SequenceFlow_12 + SequenceFlow_4 + + + + + SequenceFlow_1 + + + + + SequenceFlow_11 + SequenceFlow_3 + + + + + SequenceFlow_3 + SequenceFlow_12 + SequenceFlow_13 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModuleVolumeGroup.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModuleVolumeGroup.bpmn index dc94c898c2..232ae027cd 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModuleVolumeGroup.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModuleVolumeGroup.bpmn @@ -5,7 +5,7 @@ SequenceFlow_38 SequenceFlow_39 - @@ -17,7 +17,7 @@ cvfvg.getVfModule(execution)]]> SequenceFlow_23 SequenceFlow_18 - @@ -30,7 +30,7 @@ cvfvg.handleAAIQueryFailure(execution)]]> - + ${CCV1_subscriberglobalid} ]]> @@ -50,7 +50,7 @@ cvfvg.handleAAIQueryFailure(execution)]]> SequenceFlow_4 SequenceFlow_8 - @@ -62,7 +62,7 @@ cvfvg.handleUpdateVfModuleFailure(execution)]]> SequenceFlow_2 SequenceFlow_38 - @@ -70,7 +70,7 @@ cvfvg.preProcessRequest(execution)]]> SequenceFlow_22 SequenceFlow_14 - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn index 37c6605a0e..90722a95f3 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn @@ -4,7 +4,7 @@ SequenceFlow_1 SequenceFlow_2 - @@ -23,7 +23,7 @@ getService.preProcessRequest(execution) SequenceFlow_7 SequenceFlow_8 - @@ -41,7 +41,7 @@ ex.processSubflowsBPMNException(execution)]]> SequenceFlow_3 SequenceFlow_6 - @@ -50,7 +50,7 @@ getService.setSuccessIndicator(execution, true) SequenceFlow_5 SequenceFlow_3 - @@ -64,7 +64,7 @@ getService.getServiceObject(execution)]]> obtainById SequenceFlow_4 - @@ -72,7 +72,7 @@ getService.obtainServiceInstanceUrlById(execution)]]> obtainByName SequenceFlow_13 - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn index 9d989d2aac..f519bc9dbe 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn @@ -12,7 +12,7 @@ SequenceFlow_4 SequenceFlow_5 - SequenceFlow_3 SequenceFlow_4 - @@ -32,7 +32,7 @@ serviceInstance.putServiceInstance(execution)]]> SequenceFlow_1 SequenceFlow_3 - SequenceFlow_6 SequenceFlow_7 - @@ -67,9 +67,9 @@ ex.processSubflowsBPMNException(execution)]]> SequenceFlow_9 SequenceFlow_10 - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/DeleteAAIVfModule.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/DeleteAAIVfModule.bpmn index 297e04c0f7..9c60284e20 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/DeleteAAIVfModule.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/DeleteAAIVfModule.bpmn @@ -1,482 +1,482 @@ - - - - - SequenceFlow_24 - SequenceFlow_6 - SequenceFlow_8 - - - - - - SequenceFlow_39 - SequenceFlow_22 - SequenceFlow_23 - - - - - - - SequenceFlow_23 - SequenceFlow_18 - + + + + SequenceFlow_24 + SequenceFlow_6 + SequenceFlow_8 + + + + + + SequenceFlow_39 + SequenceFlow_22 + SequenceFlow_23 + + + + + + + SequenceFlow_23 + SequenceFlow_18 + - - - - SequenceFlow_18 - - - - SequenceFlow_22 - SequenceFlow_24 - + + + + SequenceFlow_18 + + + + SequenceFlow_22 + SequenceFlow_24 + - - - - SequenceFlow_6 - SequenceFlow_20 - + + + + SequenceFlow_6 + SequenceFlow_20 + - - - - SequenceFlow_20 - SequenceFlow_26 - SequenceFlow_27 - SequenceFlow_11 - - - - - - - SequenceFlow_26 - SequenceFlow_8 - SequenceFlow_29 - + + + + SequenceFlow_20 + SequenceFlow_26 + SequenceFlow_27 + SequenceFlow_11 + + + + + + + SequenceFlow_26 + SequenceFlow_8 + SequenceFlow_29 + - - - - SequenceFlow_38 - SequenceFlow_39 - + + + + SequenceFlow_38 + SequenceFlow_39 + - - - - - SequenceFlow_29 - - - - - - - SequenceFlow_3 - SequenceFlow_9 - + + + + + SequenceFlow_29 + + + + + + + SequenceFlow_3 + SequenceFlow_9 + - - - - SequenceFlow_5 - SequenceFlow_2 - + + + + SequenceFlow_5 + SequenceFlow_2 + - - - - SequenceFlow_2 - - - - SequenceFlow_11 - SequenceFlow_4 - SequenceFlow_5 - SequenceFlow_7 - - - - - - - SequenceFlow_7 - SequenceFlow_15 - - - SequenceFlow_10 - SequenceFlow_12 - + + + + SequenceFlow_2 + + + + SequenceFlow_11 + SequenceFlow_4 + SequenceFlow_5 + SequenceFlow_7 + + + + + + + SequenceFlow_7 + SequenceFlow_15 + + + SequenceFlow_10 + SequenceFlow_12 + - - - - SequenceFlow_12 - - - - SequenceFlow_14 - SequenceFlow_4 - + + + + SequenceFlow_12 + + + + SequenceFlow_14 + SequenceFlow_4 + - - - - SequenceFlow_13 - SequenceFlow_14 - + + + + SequenceFlow_13 + SequenceFlow_14 + - - - - SequenceFlow_9 - SequenceFlow_10 - SequenceFlow_13 - - - - - - - SequenceFlow_1 - - - - - SequenceFlow_1 - SequenceFlow_38 - + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_13 + + + + + + + SequenceFlow_1 + + + + + SequenceFlow_1 + SequenceFlow_38 + - - - - SequenceFlow_27 - SequenceFlow_3 - SequenceFlow_15 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +dvm.preProcessRequest(execution)]]> + + + + SequenceFlow_27 + SequenceFlow_3 + SequenceFlow_15 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn index 4f27e0026a..c59564b1e3 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_12 @@ -20,7 +20,7 @@ SequenceFlow_10 SequenceFlow_12 - SequenceFlow_8 SequenceFlow_9 - @@ -64,7 +64,7 @@ falloutHandler.postProcessResponse(execution)]]> - ${URN_mso_adapters_db_endpoint} + POST @@ -74,7 +74,7 @@ falloutHandler.postProcessResponse(execution)]]> update Request Gamma" -import org.openecomp.mso.bpmn.common.scripts.* +import org.onap.so.bpmn.common.scripts.* def updateRequestGamma= new FalloutHandler() return updateRequestGamma.updateRequestGammaPayload(execution)]]> @@ -106,7 +106,7 @@ return updateRequestGamma.updateRequestGammaPayload(execution)]]>SequenceFlow_72 SequenceFlow_31 SequenceFlow_79 - @@ -124,7 +124,7 @@ falloutHandler.buildDBWorkflowException(execution, "FH_updateRequestGammaRespons SequenceFlow_32 SequenceFlow_80 SequenceFlow_73 - @@ -133,7 +133,7 @@ falloutHandler.buildDBWorkflowException(execution, "FH_updateRequestInfraRespons - ${URN_mso_adapters_openecomp_db_endpoint} + POST @@ -143,7 +143,7 @@ falloutHandler.buildDBWorkflowException(execution, "FH_updateRequestInfraRespons update Request Infra" -import org.openecomp.mso.bpmn.common.scripts.* +import org.onap.so.bpmn.common.scripts.* def updateRequestInfra= new FalloutHandler() return updateRequestInfra.updateRequestInfraPayload(execution)]]> @@ -175,7 +175,7 @@ return updateRequestInfra.updateRequestInfraPayload(execution)]]> SequenceFlow_1ko8ggw SequenceFlow_1pm9r7h - - + diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenerateVfModuleName.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenerateVfModuleName.bpmn index ab4afdad1c..092001b56a 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenerateVfModuleName.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenerateVfModuleName.bpmn @@ -7,14 +7,14 @@ SequenceFlow_1opqmjl SequenceFlow_0aqc89s - SequenceFlow_0aqc89s SequenceFlow_1afb896 - @@ -29,7 +29,7 @@ generateVfModuleName.queryAAI(execution)]]> SequenceFlow_1afb896 SequenceFlow_0o6nle0 - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn deleted file mode 100644 index 15929b87eb..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - SequenceFlow_9 - SequenceFlow_10 - - - - - SequenceFlow_9 - - - - - SequenceFlow_10 - - - - - - SequenceFlow_12 - - - SequenceFlow_11 - SequenceFlow_12 - - - - SequenceFlow_11 - - - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_3 - - - - - SequenceFlow_3 - no - yes - - - - - - - SequenceFlow_7 - SequenceFlow_4 - - - - - yes - siExistYes - SequenceFlow_6 - - - - SequenceFlow_4 - - - - SequenceFlow_6 - SequenceFlow_7 - - - - - no - SequenceFlow_5 - - - - - SequenceFlow_5 - siExistYes - siExistNo - - - - - - - siExistNo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn deleted file mode 100644 index f46f86613f..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn +++ /dev/null @@ -1,251 +0,0 @@ - - - - - SequenceFlow_1 - - - SequenceFlow_1 - SequenceFlow_9 - - - - - - SequenceFlow_9 - resourceVariableNotProvided - resourceVersionProvided - - - - - - - - SequenceFlow_2 - SequenceFlow_3 - - - - - SequenceFlow_2 - - - - - SequenceFlow_3 - - - - - resourceVariableNotProvided - SequenceFlow_5 - - - - - SequenceFlow_7 - SequenceFlow_8 - - - - - SequenceFlow_6 - SequenceFlow_7 - - - - - vnfFoundNo - - - - SequenceFlow_5 - vnfFoundYes - vnfFoundNo - - - - - - - resourceVersionProvided - vnfFoundYes - SequenceFlow_6 - - - - SequenceFlow_8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn index 6f012bcb88..2015526874 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn @@ -4,7 +4,7 @@ SequenceFlow_1 SequenceFlow_2 - @@ -23,7 +23,7 @@ getService.preProcessRequest(execution) SequenceFlow_7 SequenceFlow_8 - @@ -41,7 +41,7 @@ ex.processSubflowsBPMNException(execution)]]> SequenceFlow_3 SequenceFlow_6 - @@ -50,7 +50,7 @@ getService.setSuccessIndicator(execution, true) SequenceFlow_5 SequenceFlow_3 - @@ -64,7 +64,7 @@ getService.getServiceObject(execution)]]> obtainById SequenceFlow_4 - @@ -72,7 +72,7 @@ getService.obtainServiceInstanceUrlById(execution)]]> obtainByName SequenceFlow_13 - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn index 3300d86084..5784c10d3e 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn @@ -1,212 +1,212 @@ - - - - - SequenceFlow_1 - - - SequenceFlow_1 - SequenceFlow_2 - + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + - - - - - SequenceFlow_2 - noVnfId - haveVnfId - - - - - - - noVnfId - SequenceFlow_9 - + + + + + SequenceFlow_2 + noVnfId + haveVnfId + + + + + + + noVnfId + SequenceFlow_9 + - - - - SequenceFlow_9 - SequenceFlow_10 - SequenceFlow_7 - - - - haveVnfId - SequenceFlow_10 - + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_7 + + + + haveVnfId + SequenceFlow_10 + - - - - - SequenceFlow_12 - - - - SequenceFlow_11 - SequenceFlow_12 - + + + + + SequenceFlow_12 + + + + SequenceFlow_11 + SequenceFlow_12 + - - - - SequenceFlow_11 - - - - - - SequenceFlow_7 - SequenceFlow_8 - + + + + SequenceFlow_11 + + + + + + SequenceFlow_7 + SequenceFlow_8 + - - - - SequenceFlow_8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +]]> + + + + SequenceFlow_8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn index ca03a9560c..2d18f38c16 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn @@ -1,201 +1,201 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_5 - - - - SequenceFlow_4 - SequenceFlow_5 - - - - - SequenceFlow_3 - SequenceFlow_4 - - - - - SequenceFlow_1 - SequenceFlow_3 - - - - - - SequenceFlow_6 - - - - - SequenceFlow_7 - - - SequenceFlow_6 - SequenceFlow_7 - - - - - - - SequenceFlow_9 - - - - - SequenceFlow_9 - SequenceFlow_10 - - - - SequenceFlow_10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + SequenceFlow_1 + + + + SequenceFlow_5 + + + + SequenceFlow_4 + SequenceFlow_5 + + + + + SequenceFlow_3 + SequenceFlow_4 + + + + + SequenceFlow_1 + SequenceFlow_3 + + + + + + SequenceFlow_6 + + + + + SequenceFlow_7 + + + SequenceFlow_6 + SequenceFlow_7 + + + + + + + SequenceFlow_9 + + + + + SequenceFlow_9 + SequenceFlow_10 + + + + SequenceFlow_10 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn deleted file mode 100644 index f155783e3a..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn +++ /dev/null @@ -1,135 +0,0 @@ - - - - - SequenceFlow_1 - - - SequenceFlow_1 - SequenceFlow_2 - - - - - - - SequenceFlow_6 - - - - SequenceFlow_5 - - - - SequenceFlow_5 - SequenceFlow_6 - - - - - - - SequenceFlow_2 - SequenceFlow_3 - - - - - SequenceFlow_3 - SequenceFlow_4 - - - - - SequenceFlow_4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/PrepareUpdateAAIVfModule.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/PrepareUpdateAAIVfModule.bpmn index 956192c5af..de9adc59c7 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/PrepareUpdateAAIVfModule.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/PrepareUpdateAAIVfModule.bpmn @@ -6,7 +6,7 @@ and the updated VF Module (type=VfModule) is placed in the variable 'PUAAIVfMod_ SequenceFlow_38 SequenceFlow_39 - @@ -23,14 +23,14 @@ puvm.getGenericVnf(execution)]]> SequenceFlow_22 SequenceFlow_10 - SequenceFlow_23 SequenceFlow_18 - @@ -48,7 +48,7 @@ puvm.handleVnfNotFound(execution)]]> SequenceFlow_12 SequenceFlow_15 - @@ -75,7 +75,7 @@ puvm.handleVfModuleValidationError(execution)]]> - + ${CCV1_subscriberglobalid} ]]> @@ -86,7 +86,7 @@ puvm.handleVfModuleValidationError(execution)]]> SequenceFlow_4 SequenceFlow_8 - @@ -94,7 +94,7 @@ puvm.handleUpdateVfModuleFailure(execution)]]> SequenceFlow_16 SequenceFlow_14 - @@ -109,7 +109,7 @@ puvm.updateVfModule(execution)]]> SequenceFlow_1 SequenceFlow_38 - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ReceiveWorkflowMessage.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ReceiveWorkflowMessage.bpmn index abae950134..f19e3fc10f 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ReceiveWorkflowMessage.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ReceiveWorkflowMessage.bpmn @@ -4,7 +4,7 @@ SequenceFlow_9 SequenceFlow_1ps0nzi - @@ -16,7 +16,7 @@ receiveWorkflowMessage .preProcessRequest(execution) SequenceFlow_27 SequenceFlow_34 - @@ -28,7 +28,7 @@ exceptionUtil.buildWorkflowException(execution, 7010, "Receive Workflow Message SequenceFlow_44 SequenceFlow_1 - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn index c52612bb95..7a9a7f8308 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn @@ -1,34 +1,34 @@ - + SequenceFlow_3 SequenceFlow_14 - import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV1 = new SDNCAdapterRestV1() def statusCode = execution.getVariable('SDNCREST_sdncAdapterStatusCode') String response = String.valueOf(execution.getVariable('SDNCREST_sdncAdapterResponse')) def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') def processKey = sdncAdapterRestV1.getProcessKey(execution) sdncAdapterRestV1.logDebug(processKey + " received response from SDNCAdapter: statusCode=" + statusCode + - " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)]]> + " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled) SequenceFlow_17 SequenceFlow_35 - import org.onap.so.bpmn.common.scripts.* def exceptionUtil = new ExceptionUtil() -exceptionUtil.buildWorkflowException(execution, 5300, "Failed to communicate with SDNCAdapter")]]> +exceptionUtil.buildWorkflowException(execution, 5300, "Failed to communicate with SDNCAdapter") SequenceFlow_23 SequenceFlow_36 - import org.onap.so.bpmn.common.scripts.* String res = execution.getVariable('SDNCREST_sdncAdapterResponse') def sdncAdapterRestV1 = new SDNCAdapterRestV1() -sdncAdapterRestV1.sdncAdapterBuildWorkflowException(execution, res)]]> +sdncAdapterRestV1.sdncAdapterBuildWorkflowException(execution, res) @@ -38,11 +38,11 @@ sdncAdapterRestV1.sdncAdapterBuildWorkflowException(execution, res)]]>SequenceFlow_24 - + #{execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '404'} - + #{execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '200' || execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '202'} @@ -57,18 +57,18 @@ sdncAdapterRestV1.sdncAdapterBuildWorkflowException(execution, res)]]> SequenceFlow_2 SequenceFlow_3 - import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV1 = new SDNCAdapterRestV1() -sdncAdapterRestV1.sendRequestToSDNCAdapter(execution)]]> +sdncAdapterRestV1.sendRequestToSDNCAdapter(execution) SequenceFlow_9 SequenceFlow_2 - import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV1 = new SDNCAdapterRestV1() sdncAdapterRestV1.preProcessRequest(execution) -]]> + @@ -78,9 +78,9 @@ sdncAdapterRestV1.preProcessRequest(execution) SequenceFlow_27 SequenceFlow_34 - import org.onap.so.bpmn.common.scripts.* def exceptionUtil = new ExceptionUtil() -exceptionUtil.buildWorkflowException(execution, 5320, "SDNCAdapter Callback Timeout Error")]]> +exceptionUtil.buildWorkflowException(execution, 5320, "SDNCAdapter Callback Timeout Error") @@ -90,10 +90,10 @@ exceptionUtil.buildWorkflowException(execution, 5320, "SDNCAdapter Callback Time SequenceFlow_44 SequenceFlow_1 - import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV1 = new SDNCAdapterRestV1() sdncAdapterRestV1.setSuccessIndicator(execution, true) -execution.setVariable('WorkflowResponse', sdncAdapterRestV1.getLastCallback(execution))]]> +execution.setVariable('WorkflowResponse', sdncAdapterRestV1.getLastCallback(execution)) @@ -106,15 +106,15 @@ execution.setVariable('WorkflowResponse', sdncAdapterRestV1.getLastCallback(exec - + SequenceFlow_24 SequenceFlow_44 SequenceFlow_41 SequenceFlow_42 - import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV1 = new SDNCAdapterRestV1() -sdncAdapterRestV1.processCallback(execution)]]> +sdncAdapterRestV1.processCallback(execution) @@ -127,7 +127,7 @@ sdncAdapterRestV1.processCallback(execution)]]> SequenceFlow_43 - + #{execution.getVariable('SDNCREST_ackFinalIndicator')=="Y"} @@ -136,7 +136,7 @@ sdncAdapterRestV1.processCallback(execution)]]> SequenceFlow_30 - + #{execution.getVariable("WorkflowException") != null} @@ -164,10 +164,10 @@ sdncAdapterRestV1.processCallback(execution)]]> SequenceFlow_4 SequenceFlow_11 - import org.onap.so.bpmn.common.scripts.* def exUtil = new ExceptionUtil() exUtil.processSubflowsBPMNException(execution) -]]> + @@ -219,8 +219,8 @@ exUtil.processSubflowsBPMNException(execution) - - + + @@ -232,33 +232,33 @@ exUtil.processSubflowsBPMNException(execution) - - + + - - - + + + - - - - + + + + - - - + + + @@ -270,16 +270,16 @@ exUtil.processSubflowsBPMNException(execution) - - + + - - - + + + @@ -297,8 +297,8 @@ exUtil.processSubflowsBPMNException(execution) - - + + @@ -310,8 +310,8 @@ exUtil.processSubflowsBPMNException(execution) - - + + @@ -323,15 +323,15 @@ exUtil.processSubflowsBPMNException(execution) - - + + - - + + @@ -340,19 +340,19 @@ exUtil.processSubflowsBPMNException(execution) - - - - + + + + - - - - + + + + @@ -367,8 +367,8 @@ exUtil.processSubflowsBPMNException(execution) - - + + @@ -386,8 +386,8 @@ exUtil.processSubflowsBPMNException(execution) - - + + @@ -399,22 +399,22 @@ exUtil.processSubflowsBPMNException(execution) - - + + - - + + - - + + @@ -426,28 +426,28 @@ exUtil.processSubflowsBPMNException(execution) - - - - + + + + - - - - + + + + - - - - + + + + @@ -459,8 +459,8 @@ exUtil.processSubflowsBPMNException(execution) - - + + diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn index 68afc9ae5a..cee6e43f93 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn @@ -1,35 +1,35 @@ - + This version of SDNCAdapterRest allows for interim notifications to be sent for any non-final response received from SDNC. SequenceFlow_3 SequenceFlow_14 - import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV2 = new SDNCAdapterRestV2() def statusCode = execution.getVariable('SDNCREST_sdncAdapterStatusCode') String response = String.valueOf(execution.getVariable('SDNCREST_sdncAdapterResponse')) def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') def processKey = sdncAdapterRestV2.getProcessKey(execution) sdncAdapterRestV2.logDebug(processKey + " received response from SDNCAdapter: statusCode=" + statusCode + - " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)]]> + " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled) SequenceFlow_17 SequenceFlow_35 - import org.onap.so.bpmn.common.scripts.* def exceptionUtil = new ExceptionUtil() -exceptionUtil.buildWorkflowException(execution, 5300, "Failed to communicate with SDNCAdapter")]]> +exceptionUtil.buildWorkflowException(execution, 5300, "Failed to communicate with SDNCAdapter") SequenceFlow_23 SequenceFlow_36 - import org.onap.so.bpmn.common.scripts.* String res = execution.getVariable('SDNCREST_sdncAdapterResponse') def sdncAdapterRestV2 = new SDNCAdapterRestV2() -sdncAdapterRestV2.sdncAdapterBuildWorkflowException(execution, res)]]> +sdncAdapterRestV2.sdncAdapterBuildWorkflowException(execution, res) @@ -39,11 +39,11 @@ sdncAdapterRestV2.sdncAdapterBuildWorkflowException(execution, res)]]>SequenceFlow_24 - + #{execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '404'} - + #{execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '200' || execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '202'} @@ -58,18 +58,18 @@ sdncAdapterRestV2.sdncAdapterBuildWorkflowException(execution, res)]]> SequenceFlow_2 SequenceFlow_3 - import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV2 = new SDNCAdapterRestV2() -sdncAdapterRestV2.sendRequestToSDNCAdapter(execution)]]> +sdncAdapterRestV2.sendRequestToSDNCAdapter(execution) SequenceFlow_9 SequenceFlow_2 - import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV2 = new SDNCAdapterRestV2() sdncAdapterRestV2.preProcessRequest(execution) -]]> + @@ -79,9 +79,9 @@ sdncAdapterRestV2.preProcessRequest(execution) SequenceFlow_27 SequenceFlow_34 - import org.onap.so.bpmn.common.scripts.* def exceptionUtil = new ExceptionUtil() -exceptionUtil.buildWorkflowException(execution, 5320, "SDNCAdapter Callback Timeout Error")]]> +exceptionUtil.buildWorkflowException(execution, 5320, "SDNCAdapter Callback Timeout Error") @@ -91,10 +91,10 @@ exceptionUtil.buildWorkflowException(execution, 5320, "SDNCAdapter Callback Time SequenceFlow_44 SequenceFlow_1 - import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV2 = new SDNCAdapterRestV2() sdncAdapterRestV2.setSuccessIndicator(execution, true) -execution.setVariable('WorkflowResponse', sdncAdapterRestV2.getLastCallback(execution))]]> +execution.setVariable('WorkflowResponse', sdncAdapterRestV2.getLastCallback(execution)) @@ -107,15 +107,15 @@ execution.setVariable('WorkflowResponse', sdncAdapterRestV2.getLastCallback(exec - + SequenceFlow_24 SequenceFlow_44 SequenceFlow_41 SequenceFlow_42 - import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV2 = new SDNCAdapterRestV2() -sdncAdapterRestV2.processCallback(execution)]]> +sdncAdapterRestV2.processCallback(execution) @@ -128,7 +128,7 @@ sdncAdapterRestV2.processCallback(execution)]]> SequenceFlow_43 - + #{execution.getVariable('SDNCREST_ackFinalIndicator')=="Y"} @@ -137,7 +137,7 @@ sdncAdapterRestV2.processCallback(execution)]]> SequenceFlow_30 - + #{execution.getVariable("WorkflowException") != null} @@ -163,17 +163,17 @@ sdncAdapterRestV2.processCallback(execution)]]> SequenceFlow_1g8pswz SequenceFlow_0my3p6y - import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV2 = new SDNCAdapterRestV2() -sdncAdapterRestV2.prepareInterimNotification(execution)]]> +sdncAdapterRestV2.prepareInterimNotification(execution) - + #{execution.getVariable("SDNCREST_doInterimNotification") != null && execution.getVariable("SDNCREST_doInterimNotification") == true} - + @@ -192,10 +192,10 @@ sdncAdapterRestV2.prepareInterimNotification(execution)]]> SequenceFlow_4 SequenceFlow_11 - import org.onap.so.bpmn.common.scripts.* def exUtil = new ExceptionUtil() exUtil.processSubflowsBPMNException(execution) -]]> + @@ -247,8 +247,8 @@ exUtil.processSubflowsBPMNException(execution) - - + + @@ -260,33 +260,33 @@ exUtil.processSubflowsBPMNException(execution) - - + + - - - + + + - - - - + + + + - - - + + + @@ -298,18 +298,18 @@ exUtil.processSubflowsBPMNException(execution) - - - - + + + + - - - + + + @@ -327,10 +327,10 @@ exUtil.processSubflowsBPMNException(execution) - - - - + + + + @@ -342,8 +342,8 @@ exUtil.processSubflowsBPMNException(execution) - - + + @@ -355,15 +355,15 @@ exUtil.processSubflowsBPMNException(execution) - - + + - - + + @@ -372,19 +372,19 @@ exUtil.processSubflowsBPMNException(execution) - - - - + + + + - - - - + + + + @@ -399,8 +399,8 @@ exUtil.processSubflowsBPMNException(execution) - - + + @@ -418,8 +418,8 @@ exUtil.processSubflowsBPMNException(execution) - - + + @@ -431,22 +431,22 @@ exUtil.processSubflowsBPMNException(execution) - - + + - - + + - - + + @@ -458,22 +458,22 @@ exUtil.processSubflowsBPMNException(execution) - - + + - - + + - - + + @@ -485,8 +485,8 @@ exUtil.processSubflowsBPMNException(execution) - - + + @@ -501,32 +501,32 @@ exUtil.processSubflowsBPMNException(execution) - - - + + + - - - + + + - - + + - - - + + + diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn index 6a4223d2ad..2ae2ff7f8b 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_15 @@ -8,23 +8,23 @@ - + #{execution.getVariable("SDNCA_ResponseCode")=='200'} badSynchronousResponse Exception - import org.onap.so.bpmn.common.scripts.* int responseCode = execution.getVariable("SDNCA_ResponseCode") ExceptionUtil exceptionUtil = new ExceptionUtil() -exceptionUtil.buildWorkflowException(execution, 7000, "Could not communicate with the SDNC Adapter" )]]> +exceptionUtil.buildWorkflowException(execution, 7000, "Could not communicate with the SDNC Adapter" ) - ${URN_mso_adapters_sdnc_endpoint} + ${execution.getVariable("mso.adapters.sdnc.endpoint")} POST @@ -65,20 +65,20 @@ exceptionUtil.buildWorkflowException(execution, 7000, "Could not communicate wit SequenceFlow_1 SequenceFlow_8 - import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() sdnc.preProcessRequest(execution) -]]> + SequenceFlow_9 SequenceFlow_11ah5pw SequenceFlow_14 - import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() sdnc.postProcessResponse(execution) -]]> + @@ -88,9 +88,9 @@ sdnc.postProcessResponse(execution) - + #{execution.getVariable("asynchronousResponseTimeout")==true} - + SequenceFlow_2 SequenceFlow_9 @@ -111,17 +111,17 @@ sdnc.postProcessResponse(execution) SequenceFlow_0mzs1ze SequenceFlow_11ah5pw - import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() -sdnc.setTimeout(execution)]]> +sdnc.setTimeout(execution) goodSynchronousResponse SequenceFlow_26 SequenceFlow_2 - import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() -sdnc.resetCallbackRequest(execution)]]> +sdnc.resetCallbackRequest(execution) @@ -131,14 +131,14 @@ sdnc.resetCallbackRequest(execution)]]> - + #{execution.getVariable("continueListening")==true} SequenceFlow_1w1za5m SequenceFlow_17 - import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() -sdnc.toggleSuccessIndicator(execution)]]> +sdnc.toggleSuccessIndicator(execution) @@ -168,9 +168,9 @@ sdnc.toggleSuccessIndicator(execution)]]> SequenceFlow_22 SequenceFlow_27 - import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() -sdnc.assignError(execution)]]> +sdnc.assignError(execution) @@ -183,7 +183,7 @@ sdnc.assignError(execution)]]> SequenceFlow_23 - + #{execution.getVariable("serviceConfigActivate")==true} @@ -202,7 +202,7 @@ sdnc.assignError(execution)]]> - + @@ -215,7 +215,7 @@ sdnc.assignError(execution)]]> SequenceFlow_4 SequenceFlow_193cb6p - + execution.setVariable("SDNCA_InterimNotify", true) @@ -225,7 +225,7 @@ sdnc.assignError(execution)]]> Done SequenceFlow_1w1za5m - + execution.setVariable("SDNCA_InterimNotify", false) @@ -264,23 +264,23 @@ sdnc.assignError(execution)]]> - - - + + + - - + + - - + + @@ -292,24 +292,24 @@ sdnc.assignError(execution)]]> - - + + - - + + - - - - + + + + @@ -330,8 +330,8 @@ sdnc.assignError(execution)]]> - - + + @@ -340,8 +340,8 @@ sdnc.assignError(execution)]]> - - + + @@ -350,8 +350,8 @@ sdnc.assignError(execution)]]> - - + + @@ -363,16 +363,16 @@ sdnc.assignError(execution)]]> - - + + - - - + + + @@ -384,8 +384,8 @@ sdnc.assignError(execution)]]> - - + + @@ -394,17 +394,17 @@ sdnc.assignError(execution)]]> - - - - + + + + - - + + @@ -416,8 +416,8 @@ sdnc.assignError(execution)]]> - - + + @@ -428,9 +428,9 @@ sdnc.assignError(execution)]]> - - - + + + @@ -442,17 +442,17 @@ sdnc.assignError(execution)]]> - - - + + + - - - + + + @@ -461,47 +461,47 @@ sdnc.assignError(execution)]]> - - + + - + - + - + - + - + - + - - + + - + - - + + - + - - + + @@ -519,17 +519,17 @@ sdnc.assignError(execution)]]> - - - + + + - - - + + + @@ -547,8 +547,8 @@ sdnc.assignError(execution)]]> - - + + @@ -560,8 +560,8 @@ sdnc.assignError(execution)]]> - - + + @@ -570,8 +570,8 @@ sdnc.assignError(execution)]]> - - + + diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIGenericVnf.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIGenericVnf.bpmn index 0932221944..42ffb762e7 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIGenericVnf.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIGenericVnf.bpmn @@ -5,7 +5,7 @@ SequenceFlow_38 SequenceFlow_39 - @@ -26,7 +26,7 @@ ugv.getGenericVnf(execution)]]> SequenceFlow_4 SequenceFlow_8 - @@ -35,7 +35,7 @@ ugv.handleUpdateGenericVnfFailure(execution)]]> - + ${CCV1_subscriberglobalid} ]]> @@ -46,7 +46,7 @@ ugv.handleUpdateGenericVnfFailure(execution)]]> SequenceFlow_22 SequenceFlow_14 - @@ -63,7 +63,7 @@ ugv.updateGenericVnf(execution)]]> SequenceFlow_23 SequenceFlow_18 - @@ -79,7 +79,7 @@ ugv.handleAAIQueryFailure(execution)]]> SequenceFlow_1 SequenceFlow_38 - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIVfModule.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIVfModule.bpmn index 6eacaee530..f0b1d8d027 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIVfModule.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIVfModule.bpmn @@ -5,7 +5,7 @@ SequenceFlow_38 SequenceFlow_39 - @@ -17,7 +17,7 @@ uvm.getVfModule(execution)]]> SequenceFlow_23 SequenceFlow_18 - @@ -30,7 +30,7 @@ uvm.handleAAIQueryFailure(execution)]]> - + ${CCV1_subscriberglobalid} ]]> @@ -50,7 +50,7 @@ uvm.handleAAIQueryFailure(execution)]]> SequenceFlow_4 SequenceFlow_8 - @@ -67,7 +67,7 @@ uvm.handleUpdateVfModuleFailure(execution)]]> SequenceFlow_22 SequenceFlow_14 - @@ -79,7 +79,7 @@ uvm.updateVfModule(execution)]]> SequenceFlow_1 SequenceFlow_38 - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn index 82d89b0c64..cdd710d102 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn @@ -1,442 +1,442 @@ - - - - - SequenceFlow_3 - SequenceFlow_14 - - - - SequenceFlow_17 - SequenceFlow_35 - - - - SequenceFlow_23 - SequenceFlow_36 - - - - - SequenceFlow_14 - SequenceFlow_17 - SequenceFlow_23 - SequenceFlow_24 - - - - - - - - - - SequenceFlow_27 - - ${URN_mso_po_timeout} - - - - SequenceFlow_24 - SequenceFlow_28 - - SequenceFlow_25 - SequenceFlow_26 - - - - - SequenceFlow_25 - - - - SequenceFlow_26 - - - - - SequenceFlow_27 - SequenceFlow_34 - - - - - SequenceFlow_28 - SequenceFlow_33 - - - - - - SequenceFlow_34 - - - - - SequenceFlow_35 - - - - SequenceFlow_36 - - - - - SequenceFlow_32 - - - - SequenceFlow_33 - SequenceFlow_31 - SequenceFlow_32 - - - - - - - SequenceFlow_31 - SequenceFlow_1 - - - - - SequenceFlow_1 - - - SequenceFlow_2 - SequenceFlow_3 - - - - - - SequenceFlow_4 - SequenceFlow_5 - - - - - SequenceFlow_5 - - - SequenceFlow_4 - - - - - - SequenceFlow_9 - SequenceFlow_2 - - - - - SequenceFlow_9 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + SequenceFlow_3 + SequenceFlow_14 + + + + SequenceFlow_17 + SequenceFlow_35 + + + + SequenceFlow_23 + SequenceFlow_36 + + + + + SequenceFlow_14 + SequenceFlow_17 + SequenceFlow_23 + SequenceFlow_24 + + + + + + + + + + SequenceFlow_27 + + + + + + SequenceFlow_24 + SequenceFlow_28 + + SequenceFlow_25 + SequenceFlow_26 + + + + + SequenceFlow_25 + + + + SequenceFlow_26 + + + + + SequenceFlow_27 + SequenceFlow_34 + + + + + SequenceFlow_28 + SequenceFlow_33 + + + + + + SequenceFlow_34 + + + + + SequenceFlow_35 + + + + SequenceFlow_36 + + + + + SequenceFlow_32 + + + + SequenceFlow_33 + SequenceFlow_31 + SequenceFlow_32 + + + + + + + SequenceFlow_31 + SequenceFlow_1 + + + + + SequenceFlow_1 + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + SequenceFlow_4 + SequenceFlow_5 + + + + + SequenceFlow_5 + + + SequenceFlow_4 + + + + + + SequenceFlow_9 + SequenceFlow_2 + + + + + SequenceFlow_9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/urn.properties b/bpmn/MSOCommonBPMN/src/main/resources/urn.properties deleted file mode 100644 index 12253aa9d2..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/urn.properties +++ /dev/null @@ -1,30 +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========================================================= -### - -# URN mappings for this project. - -# TODO: Remove all the non-URN stuff that's in here. -# TODO: Implement a real URN mapping capability. - -#AAIEndPoint= http://localhost:28080/SoapUIMocks -AAIEndPoint= http://localhost:28090/ -SDNCEndPoint=http://localhost:28090/SDNCAdapter/ -msoRollback = true -mso.AaiEncrypted.Pwd = C1FC4A39E16419DD41DFC1212843F440 diff --git a/bpmn/MSOCommonBPMN/src/main/resources/wsdl/VnfAdapterNotify.wsdl b/bpmn/MSOCommonBPMN/src/main/resources/wsdl/VnfAdapterNotify.wsdl index a4f194045a..b2c9a34c9b 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/wsdl/VnfAdapterNotify.wsdl +++ b/bpmn/MSOCommonBPMN/src/main/resources/wsdl/VnfAdapterNotify.wsdl @@ -1,17 +1,17 @@ + targetNamespace="http://org.onap.so/vnfNotify"> @@ -36,7 +36,7 @@ - + @@ -78,7 +78,7 @@ - + @@ -102,7 +102,7 @@ - + @@ -172,23 +172,23 @@ + wsam:Action="http://org.onap.so/notify/adapterNotify/rollbackVnfNotificationRequest"/> + wsam:Action="http://org.onap.so/notify/adapterNotify/queryVnfNotificationRequest"/> + wsam:Action="http://org.onap.so/notify/adapterNotify/createVnfNotificationRequest"/> + wsam:Action="http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest"/> + wsam:Action="http://org.onap.so/notify/adapterNotify/deleteVnfNotificationRequest"/> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/xjb/AAI.xjb b/bpmn/MSOCommonBPMN/src/main/resources/xjb/AAI.xjb deleted file mode 100644 index ca8ac4766d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/xjb/AAI.xjb +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/xsd/MSOWorkflowSchemaV1.xsd b/bpmn/MSOCommonBPMN/src/main/resources/xsd/MSOWorkflowSchemaV1.xsd deleted file mode 100644 index 0472e54693..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/xsd/MSOWorkflowSchemaV1.xsd +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/xsd/ManualTasks.xsd b/bpmn/MSOCommonBPMN/src/main/resources/xsd/ManualTasks.xsd deleted file mode 100644 index f1754b6ba7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/xsd/ManualTasks.xsd +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/xsd/MsoServiceRequestTypesV1.xsd b/bpmn/MSOCommonBPMN/src/main/resources/xsd/MsoServiceRequestTypesV1.xsd deleted file mode 100644 index c5fa26c998..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/xsd/MsoServiceRequestTypesV1.xsd +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - order-number is required if service-type equals SDN-ETHERNET-INTERNET. order-version is required if service-type equals - SDN-ETHERNET-INTERNET, source=OMX, and request-action=Layer3ServiceActivateRequest or ChangeLayer3ServiceProvRequest - - - - - - - - - - - - - - - - subscriber-name required if request-action=Layer3ServiceActivateRequest - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/xsd/aai_schema_v10.xsd b/bpmn/MSOCommonBPMN/src/main/resources/xsd/aai_schema_v10.xsd deleted file mode 100644 index 0972056432..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/xsd/aai_schema_v10.xsd +++ /dev/null @@ -1,6547 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="The specific type of node in the A&AI graph") - - - - - - - @com.att.aai.annotations.Metadata(description="The URL to the specific resource") - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="A keyword provided by A&AI to indicate an attribute.") - - - - - - - @com.att.aai.annotations.Metadata(description="Value of the attribute.") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Key part of a key/value pair") - - - - - - - @com.att.aai.annotations.Metadata(description="Value part of a key/value pair") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="A keyword provided by A&AI to indicate type of node.") - - - - - - - @com.att.aai.annotations.Metadata(description="URL to the object in A&AI.") - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="OAM network, to be deprecated shortly. Do not use for new purposes. ",nameProps="network-name",indexedProps="cvlan-tag,network-uuid,network-name",dependentOn="cloud-region",container="oam-networks") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="UUID of the network. Unique across a cloud-region") - - - - - - - @com.att.aai.annotations.Metadata(description="Name of the network.") - - - - - - - @com.att.aai.annotations.Metadata(description="cvlan-id") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for VNF firewall rule so customer cannot send customer traffic over this oam network") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for VNF firewall rule so customer cannot send customer traffic over this oam network") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of OAM networks, to be deprecated shortly. Do not use for new purposes. ") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Digital virtual switch metadata, used by SDN-C to configure VCEs. A&AI needs to receive this data from the PO deployment team and administer it using the provisioningTool.sh into A&AI. ",indexedProps="vcenter-url,switch-name",dependentOn="cloud-region",container="dvs-switches") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="DVS switch name") - - - - - - - @com.att.aai.annotations.Metadata(description="URL used to reach the vcenter") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of digital virtual switch metadata used for vmWare VCEs and VPEs.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Availability zone, a collection of compute hosts/pservers",indexedProps="availability-zone-name",dependentOn="cloud-region",container="availability-zones") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Name of the availability zone. Unique across a cloud region") - - - - - - - @com.att.aai.annotations.Metadata(description="Type of hypervisor. Source of truth should define valid values.") - - - - - - - @com.att.aai.annotations.Metadata(description="Status that indicates whether the asset is in or out of the service path. Valid values are null, in-service-path, out-of-service-path.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Serves a PATCH like function. Does not enforce concurrency control. Clear each usage with AAI team.") - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="APIs that are more action related than REST (e.g., notify, update).") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="A collection of C tags (vlan tags) grouped for a specific purpose.",indexedProps="availability-zone-name",dependentOn="complex",container="ctag-pools") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="The Target provider edge router") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Name of the availability zone") - - - - - - - @com.att.aai.annotations.Metadata(description="Describes what the intended purpose of this pool is.") - - - - - - - @com.att.aai.annotations.Metadata(description="Comma separated list of ctags") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of physical locations that can house cloud-regions.",indexedProps="identity-url,data-center-code,complex-name,physical-location-id",searchable="physical-location-id,data-center-code,complex-name,street1,street2,postal-code",uniqueProps="physical-location-id",container="complexes",namespace="cloud-infrastructure") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique identifier for physical location, e.g., CLLI") - - - - - - - @com.att.aai.annotations.Metadata(description="Data center code which can be an alternate way to identify a complex") - - - - - - - @com.att.aai.annotations.Metadata(description="Gamma complex name for LCP instance.") - - - - - - - @com.att.aai.annotations.Metadata(description="URL of the keystone identity service") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="Type, e.g., central office, data center.") - - - - - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of physical locations that can house cloud-regions.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Persistent block-level storage.",indexedProps="volume-group-name,vnf-type,heat-stack-id,volume-group-id",searchable="volume-group-id,volume-group-name",dependentOn="cloud-region",container="volume-groups") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of volume-group.") - - - - - - - @com.att.aai.annotations.Metadata(description="Name of the volume group.") - - - - - - - @com.att.aai.annotations.Metadata(description="Heat stack id corresponding to this volume-group") - - - - - - - @com.att.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.") - - - - - - - @com.att.aai.annotations.Metadata(description="Orchestration status of this volume-group") - - - - - - - @com.att.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.") - - - - - - - @com.att.aai.annotations.Metadata(description="helps relate the volume group to the vf-module whose components will require the volume group") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of persistent block-level storage.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Ephemeral Block storage volume.",indexedProps="volume-id",dependentOn="vserver",container="volumes") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of block storage volume relative to the vserver.") - - - - - - - @com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of ephemeral Block storage volumes.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="IPv4 Address Range",indexedProps="l3-interface-ipv4-address,vlan-id-inner,neutron-network-id,neutron-subnet-id",dependentOn="vlan,l-interface") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="IP address") - - - - - - - @com.att.aai.annotations.Metadata(description="Prefix length, 32 for single address") - - - - - - - @com.att.aai.annotations.Metadata(description="Inner VLAN tag") - - - - - - - @com.att.aai.annotations.Metadata(description="Outer VLAN tag") - - - - - - - @com.att.aai.annotations.Metadata(description="Indicator of fixed or floating address") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="Neutron network id of the interface that address belongs to") - - - - - - - @com.att.aai.annotations.Metadata(description="Neutron id of subnet that address belongs to") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="IPv6 Address Range",indexedProps="l3-interface-ipv6-address,vlan-id-inner,neutron-network-id,neutron-subnet-id",dependentOn="vlan,l-interface") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="IP address") - - - - - - - @com.att.aai.annotations.Metadata(description="Prefix length, 128 for single address") - - - - - - - @com.att.aai.annotations.Metadata(description="Inner VLAN tag") - - - - - - - @com.att.aai.annotations.Metadata(description="Outer VLAN tag") - - - - - - - @com.att.aai.annotations.Metadata(description="Indicator of fixed or floating address") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="Neutron network id of the interface that address belongs to") - - - - - - - @com.att.aai.annotations.Metadata(description="Neutron id of subnet that address belongs to") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Definition of vlan",indexedProps="vlan-interface,vlan-id-inner,vpn-id",uniqueProps="vpn-id",dependentOn="l-interface",container="vlans") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="String that identifies the interface") - - - - - - - @com.att.aai.annotations.Metadata(description="Inner VLAN tag") - - - - - - - @com.att.aai.annotations.Metadata(description="Outer VLAN tag") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="Captures the numeric part of the speed") - - - - - - - @com.att.aai.annotations.Metadata(description="Captures the units corresponding to the speed") - - - - - - - @com.att.aai.annotations.Metadata(description="Used to describe (the service associated with) the vlan") - - - - - - - @com.att.aai.annotations.Metadata(description="Whether customer is going to use this VLAN for backdoor connection to another customer premise device.") - - - - - - - @com.att.aai.annotations.Metadata(description="This indicates the customers VPN ID associated with this vlan") - - - - - - - @com.att.aai.annotations.Metadata(description="Status of a vnf's vlan interface, on which the customer circuit resides, mastered by SDN-C.") - - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="SR-IOV Virtual Function (not to be confused with virtual network function)",indexedProps="pci-id,vf-vlan-filter,vf-mac-filter,vf-vlan-strip,neutron-network-id",dependentOn="l-interface",container="sriov-vfs") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="PCI ID used to identify the sriov-vf") - - - - - - - @com.att.aai.annotations.Metadata(description="This metadata provides option to specify list of VLAN filters applied on VF to pass the traffic to VM.") - - - - - - - @com.att.aai.annotations.Metadata(description="When MAC filters are specified, VF-agent service configures VFs to do MAC level filtering before the traffic is passed to VM.") - - - - - - - @com.att.aai.annotations.Metadata(description="When this field is set to true, VF will configured to strip the outer TAG before the traffic is passed to VM.") - - - - - - - @com.att.aai.annotations.Metadata(description="This option ensures anti VLAN spoof checks are done at the VF level to comply with security. The disable check will also be honored per the VNF needs for trusted VMs.") - - - - - - - @com.att.aai.annotations.Metadata(description="This option ensures anti MAC spoof checks are done at the VF level to comply with security. The disable check will also be honored per the VNF needs for trusted VMs.") - - - - - - - @com.att.aai.annotations.Metadata(description="This option defines the set of Mirror objects which essentially mirrors the traffic from source to set of collector VNF Ports.") - - - - - - - @com.att.aai.annotations.Metadata(description="This option, if set to true, sets the VF in promiscuous mode and allows all broadcast traffic to reach the VM") - - - - - - - @com.att.aai.annotations.Metadata(description="This option, if set to true, sets the VF in promiscuous mode and allows unknown multicast traffic to reach the VM") - - - - - - - @com.att.aai.annotations.Metadata(description="This option, if set to true, sets the VF in promiscuous mode and allows unknown unicast traffic to reach the VM") - - - - - - - @com.att.aai.annotations.Metadata(description="This option, if set to true, instructs to insert outer tag after traffic comes out of VM.") - - - - - - - @com.att.aai.annotations.Metadata(description="This option is used to set the link status. Valid values as of 1607 are on, off, and auto.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="Neutron network id of the interface") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of SR-IOV Virtual Functions.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Logical interfaces, e.g., a vnic.",indexedProps="macaddr,interface-id,interface-name,network-name",dependentOn="generic-vnf,newvce,vpe,p-interface,vserver,lag-interface",container="l-interfaces") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Name given to the interface") - - - - - - - @com.att.aai.annotations.Metadata(description="E.g., CUSTOMER, UPLINK, etc.") - - - - - - - @com.att.aai.annotations.Metadata(description="Questionably placed - v6 ip addr of this interface (is in vr-lan-interface from Mary B.") - - - - - - - @com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @com.att.aai.annotations.Metadata(description="ID of interface") - - - - - - - @com.att.aai.annotations.Metadata(description="MAC address for the interface") - - - - - - - @com.att.aai.annotations.Metadata(description="Name of the network") - - - - - - - @com.att.aai.annotations.Metadata(description="Whether A&AI should be managing this interface of not. Could have value like CUSTOMER") - - - - - - - @com.att.aai.annotations.Metadata(description="Human friendly text regarding this interface.") - - - - - - - @com.att.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this port is mirrored.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of logical interfaces.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Virtual Servers, aka virtual machine or VM.",nameProps="vserver-name",indexedProps="is-closed-loop-disabled,prov-status,vserver-name,vserver-id,in-maint,vserver-name2",searchable="vserver-id,vserver-name,vserver-name2",dependentOn="tenant",container="vservers") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique identifier for this vserver relative to its tenant") - - - - - - - @com.att.aai.annotations.Metadata(description="Name of vserver") - - - - - - - @com.att.aai.annotations.Metadata(description="Alternative name of vserver") - - - - - - - @com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.") - - - - - - - @com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @com.att.aai.annotations.Metadata(defaultValue="false",description="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.") - - - - - - - @com.att.aai.annotations.Metadata(defaultValue="false",description="Used to indicate whether closed loop function is enabled on this node") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of virtual Servers, aka virtual machines or VMs.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Openstack tenant",nameProps="tenant-name",indexedProps="tenant-name,tenant-id",searchable="tenant-id,tenant-name",dependentOn="cloud-region",container="tenants") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique id relative to the cloud-region.") - - - - - - - @com.att.aai.annotations.Metadata(description="Readable name of tenant") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of openstack tenants.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Openstack flavor.",nameProps="flavor-name",indexedProps="flavor-name,flavor-id",dependentOn="cloud-region",container="flavors") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Flavor id, expected to be unique across cloud-region.") - - - - - - - @com.att.aai.annotations.Metadata(description="Flavor name") - - - - - - - @com.att.aai.annotations.Metadata(description="Number of CPUs") - - - - - - - @com.att.aai.annotations.Metadata(description="Amount of memory") - - - - - - - @com.att.aai.annotations.Metadata(description="Disk space") - - - - - - - @com.att.aai.annotations.Metadata(description="Amount of ephemeral disk space") - - - - - - - @com.att.aai.annotations.Metadata(description="amount of swap space allocation") - - - - - - - @com.att.aai.annotations.Metadata(description="whether flavor is available to all users or private to the tenant it was created in.") - - - - - - - @com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @com.att.aai.annotations.Metadata(description="Boolean as to whether this flavor is no longer enabled") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of openstack flavors.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Openstack group-assignment used to store exclusivity groups (EG).",nameProps="group-name",indexedProps="group-id,group-type,group-name",dependentOn="cloud-region",container="group-assignments") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Group id, expected to be unique across cloud-region.") - - - - - - - @com.att.aai.annotations.Metadata(description="Group type - the type of group this instance refers to") - - - - - - - @com.att.aai.annotations.Metadata(description="Group name - name assigned to the group") - - - - - - - @com.att.aai.annotations.Metadata(description="Group description - description of the group") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of openstack group assignments") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Openstack snapshot",nameProps="snapshot-name",uniqueProps="snapshot-id",indexedProps="application,snapshot-name,application-vendor,snapshot-id,application-version,prev-snapshot-id",dependentOn="cloud-region",container="snapshots") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Snapshot id, this is the key UUID assoc associated in glance with the snapshots.") - - - - - - - @com.att.aai.annotations.Metadata(description="Snapshot name") - - - - - - - @com.att.aai.annotations.Metadata(description="Operating system architecture") - - - - - - - @com.att.aai.annotations.Metadata(description="The common name of the operating system distribution in lowercase") - - - - - - - @com.att.aai.annotations.Metadata(description="The operating system version as specified by the distributor.") - - - - - - - @com.att.aai.annotations.Metadata(description="The application that the image instantiates.") - - - - - - - @com.att.aai.annotations.Metadata(description="The vendor of the application.") - - - - - - - @com.att.aai.annotations.Metadata(description="The version of the application.") - - - - - - - @com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @com.att.aai.annotations.Metadata(description="This field contains the UUID of the previous snapshot (if any).") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of openstack snapshots") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Key/value pairs",indexedProps="metaname",dependentOn="tenant,image,service-instance,connector,model",container="metadata") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true) - - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of metadatum (key/value pairs)") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Openstack image.",nameProps="image-name",indexedProps="application,image-name,application-vendor,image-id,application-version",dependentOn="cloud-region",container="images") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Image id, expected to be unique across cloud region") - - - - - - - @com.att.aai.annotations.Metadata(description="Image name") - - - - - - - @com.att.aai.annotations.Metadata(description="Operating system architecture.") - - - - - - - @com.att.aai.annotations.Metadata(description="The common name of the operating system distribution in lowercase") - - - - - - - @com.att.aai.annotations.Metadata(description="The operating system version as specified by the distributor.") - - - - - - - @com.att.aai.annotations.Metadata(description="The application that the image instantiates.") - - - - - - - @com.att.aai.annotations.Metadata(description="The vendor of the application.") - - - - - - - @com.att.aai.annotations.Metadata(description="The version of the application.") - - - - - - - @com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collectio of Openstack images.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of availability zones") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="cloud-region designates an installation of a cloud cluster or region or instantiation. In AT&Ts AIC cloud, this could be an LCP or DCP. Cloud regions are uniquely identified by a composite key, cloud-owner + cloud-region-id. The format of the cloud-owner is vendor-cloudname and we will use att-aic for AT&T's AIC. It's important to note that the cloud-region data is not updated once created, so there is a potential for the data to become stale.",indexedProps="cloud-owner,cloud-region-id,cloud-type,owner-defined-type",nameProps="owner-defined-type",container="cloud-regions",namespace="cloud-infrastructure") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Identifies the vendor and cloud name, e.g., att-aic. First part of composite key should be formatted as vendor-cloudname") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Identifier used by the vendor for the region. Second part of composite key") - - - - - - - @com.att.aai.annotations.Metadata(description="Type of the cloud (e.g., openstack)") - - - - - - - @com.att.aai.annotations.Metadata(description="Cloud-owner defined type indicator (e.g., dcp, lcp)") - - - - - - - @com.att.aai.annotations.Metadata(description="Software version employed at the site. NOTE - THIS FIELD IS NOT KEPT UP TO DATE.") - - - - - - - @com.att.aai.annotations.Metadata(description="URL of the keystone identity service") - - - - - - - @com.att.aai.annotations.Metadata(description="Zone where the cloud is homed. NOTE - THIS FIELD IS NOT CORRECTLY POPULATED.") - - - - - - - @com.att.aai.annotations.Metadata(description="complex name for cloud-region instance. NOTE - THIS FIELD IS NOT CORRECTLY POPULATED.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(maximumDepth="0") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Network profile populated by SDN-GP for SNMP",indexedProps="nm-profile-name",container="network-profiles",namespace="cloud-infrastructure") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique name of network profile.") - - - - - - - @com.att.aai.annotations.Metadata(description="Encrypted SNMP community string") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of network profiles") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Physical interface (e.g., nic)",indexedProps="interface-name,prov-status",nameProps="prov-status",dependentOn="vpls-pe,pserver,pnf",container="p-interfaces") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Name that identifies the physical interface") - - - - - - - @com.att.aai.annotations.Metadata(description="Captures the numeric part of the speed") - - - - - - - @com.att.aai.annotations.Metadata(description="Captures the units corresponding to the speed") - - - - - - - @com.att.aai.annotations.Metadata(description="Nature of the services and connectivity on this port.") - - - - - - - @com.att.aai.annotations.Metadata(description="CLEI or other specification for p-interface hardware.") - - - - - - - @com.att.aai.annotations.Metadata(description="Role specification for p-interface hardware.") - - - - - - - @com.att.aai.annotations.Metadata(description="Indicates the physical properties of the interface.") - - - - - - - @com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of physical interfaces.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Link aggregate interface",indexedProps="interface-name,interface-id,interface-role",dependentOn="generic-vnf,pserver,vpe,vpls-pe,pnf",container="lag-interfaces") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Name that identifies the link aggregate interface") - - - - - - - @com.att.aai.annotations.Metadata(description="Human friendly text regarding this interface.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="Captures the numeric part of the speed") - - - - - - - @com.att.aai.annotations.Metadata(description="Captures the units corresponding to the speed") - - - - - - - @com.att.aai.annotations.Metadata(description="ID of interface") - - - - - - - @com.att.aai.annotations.Metadata(description="Role assigned to this Interface, should use values as defined in ECOMP Yang models.") - - - - - - - @com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of link aggregate interfaces.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Compute host whose hostname must be unique and must exactly match what is sent as a relationship to a vserver.",nameProps="pserver-name2",indexedProps="hostname,in-maint,pserver-id,pserver-name2,inv-status",searchable="hostname,pserver-name2,pserver-id,ipv4-oam-address",container="pservers",namespace="cloud-infrastructure") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Value from executing hostname on the compute node.") - - - - - - - @com.att.aai.annotations.Metadata(description="PTNII name") - - - - - - - @com.att.aai.annotations.Metadata(description="Number of cpus") - - - - - - - @com.att.aai.annotations.Metadata(description="Disk size, in GBs") - - - - - - - @com.att.aai.annotations.Metadata(description="RAM size, in MBs") - - - - - - - @com.att.aai.annotations.Metadata(description="Equipment type. Source of truth should define valid values.") - - - - - - - @com.att.aai.annotations.Metadata(description="Equipment vendor. Source of truth should define valid values.") - - - - - - - @com.att.aai.annotations.Metadata(description="Equipment model. Source of truth should define valid values.") - - - - - - - @com.att.aai.annotations.Metadata(description="Fully-qualified domain name") - - - - - - - @com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @com.att.aai.annotations.Metadata(description="Used to configure device, also used for troubleshooting and is IP used for traps generated by device.") - - - - - - - @com.att.aai.annotations.Metadata(description="Serial number, may be queried") - - - - - - - @com.att.aai.annotations.Metadata(description="IPV4 Loopback 0 address") - - - - - - - @com.att.aai.annotations.Metadata(description="IPV6 Loopback 0 address") - - - - - - - @com.att.aai.annotations.Metadata(description="IPV4 AIM address") - - - - - - - @com.att.aai.annotations.Metadata(description="IPV6 AIM address") - - - - - - - @com.att.aai.annotations.Metadata(description="IPV6 OAM address") - - - - - - - @com.att.aai.annotations.Metadata(description="CANOPI's inventory status. Only set with values exactly as defined by CANOPI.") - - - - - - - @com.att.aai.annotations.Metadata(description="ID of Pserver") - - - - - - - @com.att.aai.annotations.Metadata(description="internet topology of Pserver") - - - - - - - @com.att.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="alternative pserver name") - - - - - - - @com.att.aai.annotations.Metadata(description="purpose of pserver") - - - - - - - @com.att.aai.annotations.Metadata(description="Prov Status of this device (not under canopi control) Valid values [PREPROV/NVTPROV/PROV]") - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of compute hosts.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Virtual organization of cloud infrastructure elements in a data center context",nameProps="vdc-name",indexedProps="vdc-name,vdc-id",container="virtual-data-centers",namespace="cloud-infrastructure") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of the vdc") - - - - - - - @com.att.aai.annotations.Metadata(description="Name of the virtual data center") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Virtual organization of cloud infrastructure elements in a data center context") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Namespace for cloud infrastructure.") - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of resource instances used to connect a variety of disparate inventory widgets",indexedProps="resource-instance-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version",container="connectors",namespace="business") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique id of resource instance.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC model version uuid for this resource or service model.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of resource instances used to connect a variety of disparate inventory widgets") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Represents the specifics of a tunnel cross connect piece of a resource that gets separately allotted",uniqueProps="id",indexedProps="id",dependentOn="allotted-resource",container="tunnel-xconnects") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Allotted Resource id UUID assigned to this instance.") - - - - - - - @com.att.aai.annotations.Metadata(description="The WAN uplink bandwidth for WAN1") - - - - - - - @com.att.aai.annotations.Metadata(description="The WAN downlink bandwidth for WAN1") - - - - - - - @com.att.aai.annotations.Metadata(description="The WAN uplink bandwidth for WAN2") - - - - - - - @com.att.aai.annotations.Metadata(description="The WAN downlink bandwidth for WAN2") - - - - - - - @com.att.aai.annotations.Metadata(description="Concurrency value") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="This object is used to store the specific tunnel cross connect aspects of an allotted resource") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Represents a slice or partial piece of a resource that gets separately allotted",nameProps="description",uniqueProps="id",indexedProps="id,model-invariant-id,model-version-id,type,role",dependentOn="service-instance",container="allotted-resources") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Allotted Resource id UUID assigned to this instance.") - - - - - - - @com.att.aai.annotations.Metadata(description="The descriptive information assigned to this allotted resource instance") - - - - - - - @com.att.aai.annotations.Metadata(description="Link back to more information in the controller") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC model version uuid for this resource or service model.") - - - - - - - @com.att.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.") - - - - - - - @com.att.aai.annotations.Metadata(description="Orchestration status of this resource, mastered by MSO") - - - - - - - @com.att.aai.annotations.Metadata(description="Status that indicates whether the asset is in or out of the service path. Valid values are null, in-service-path, out-of-service-path.") - - - - - - - @com.att.aai.annotations.Metadata(description="Concurrency value") - - - - - - - @com.att.aai.annotations.Metadata(description="Generic description of the type of the resource") - - - - - - - @com.att.aai.annotations.Metadata(description="Role that this asset will be playing in its context.") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="This object is used to store slices of services being offered") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Instance of a service",indexedProps="service-instance-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,service-instance-name,service-instance-location-id,orchestration-status",nameProps="service-instance-name",searchable="service-instance-id,service-instance-name",uniqueProps="service-instance-id",dependentOn="service-subscription",container="service-instances") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Uniquely identifies this instance of a service") - - - - - - - @com.att.aai.annotations.Metadata(description="This field will store a name assigned to the service-instance.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC model version uuid for this resource or service model.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.") - - - - - - - @com.att.aai.annotations.Metadata(description="Indicates the total bandwidth to be used for this service.") - - - - - - - @com.att.aai.annotations.Metadata(description="indicates the upstream bandwidth this service will use on the WAN1 port of the physical device.") - - - - - - - @com.att.aai.annotations.Metadata(description="indicates the downstream bandwidth this service will use on the WAN1 port of the physical device.") - - - - - - - @com.att.aai.annotations.Metadata(description="indicates the upstream bandwidth this service will use on the WAN2 port of the physical device.") - - - - - - - @com.att.aai.annotations.Metadata(description="indicates the downstream bandwidth this service will use on the WAN2 port of the physical device.") - - - - - - - @com.att.aai.annotations.Metadata(description="URL customers will use to access the vHN Portal.") - - - - - - - @com.att.aai.annotations.Metadata(description="An identifier that customers assign to the location where this service is being used.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="Path to the controller object.") - - - - - - - @com.att.aai.annotations.Metadata(description="Orchestration status of this service.") - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of service instances") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Object that group service instances.",indexedProps="service-type",dependentOn="customer",container="service-subscriptions",crossEntityReference="service-instance,service-type") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Value defined by orchestration to identify this service across ECOMP.") - - - - - - - @com.att.aai.annotations.Metadata(description="This property will be deleted from A&AI in the near future. Only stop gap solution.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of objects that group service instances.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="customer identifiers to provide linkage back to BSS information.",nameProps="subscriber-name",indexedProps="subscriber-name,global-customer-id,subscriber-type",searchable="global-customer-id,subscriber-name",uniqueProps="global-customer-id",container="customers",namespace="business") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Global customer id used across ECOMP to uniquely identify customer.") - - - - - - - @com.att.aai.annotations.Metadata(description="Subscriber name, an alternate way to retrieve a customer.") - - - - - - - @com.att.aai.annotations.Metadata(description="Subscriber type, a way to provide VID with only the INFRA customers.",defaultValue="CUST") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of customer identifiers to provide linkage back to BSS information.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Namespace for business related constructs") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Image object that pertain to a VNF that doesn't have associated vservers. This is a kludge.",indexedProps="application,att-uuid,application-vendor,application-version",uniqueProps="att-uuid",container="vnf-images",namespace="service-design-and-creation") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of this asset") - - - - - - - @com.att.aai.annotations.Metadata(description="The application that the image instantiates.") - - - - - - - @com.att.aai.annotations.Metadata(description="The vendor of the application.") - - - - - - - @com.att.aai.annotations.Metadata(description="The version of the application.") - - - - - - - @com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of image objects that pertain to a VNF that doesn't have associated vservers. This is a kludge.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Stand-in for service model definitions. Likely to be deprecated in favor of models from ASDC. Does not strictly map to ASDC services.",indexedProps="service-description,service-id",container="services",namespace="service-design-and-creation") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="This gets defined by others to provide a unique ID for the service, we accept what is sent.") - - - - - - - @com.att.aai.annotations.Metadata(description="Description of the service") - - - - - - - @com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="service version") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of service model definitions. Likely to be deprecated in favor of models from ASDC.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Early definition of server/resource pairings, likely to be replaced by models. No new use should be made of this.",indexedProps="service-type,vnf-type",container="service-capabilities",namespace="service-design-and-creation") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="This gets defined by others to provide a unique ID for the service, we accept what is sent.") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of service capabilities.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="This is how we would capture constraints defining allowed sets of elements.",uniqueProps="element-choice-set-uuid",indexedProps="element-choice-set-uuid",allowDirectRead="true",allowDirectWrite="false",container="element-choice-sets") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true") - - - - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="This is how we would capture constraints defining allowed sets of elements.",uniqueProps="constrained-element-set-uuid",indexedProps="constrained-element-set-uuid",allowDirectRead="true",allowDirectWrite="false",container="constrained-element-sets") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true") - - - - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="This is how we would capture constraints defining allowed sets of elements.",uniqueProps="model-constraint-uuid",indexedProps="model-constraint-uuid",allowDirectRead="true",allowDirectWrite="false",container="model-constraints") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true") - - - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Defines how other models combine to make up a higher-level model.",uniqueProps="model-element-uuid",indexedProps="model-element-uuid",allowDirectRead="true",allowDirectWrite="false",container="model-elements") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true") - - - - - - - @com.att.aai.annotations.Metadata(description="Indicates whether this element was created as part of instantiation from this model") - - - - - - - @com.att.aai.annotations.Metadata(description="How many of this type of element are required/allowed") - - - - - - - - @com.att.aai.annotations.Metadata(description="Defines how other models combine to make up a higher-level model.",uniqueProps="model-element-uuid",indexedProps="model-element-uuid",allowDirectRead="true",allowDirectWrite="false",container="model-elements") - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="Defines how other models combine to make up a higher-level model") - - - - - - - @com.att.aai.annotations.Metadata(description="Describes new constraints on this model element that are not part of that model's definition") - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Subgraph definition provided by ASDC to describe a specific version of an inventory asset and its connections related to ASDC models",nameProps="model-name",indexedProps="model-version-id,model-name,model-version",uniqueProps="model-version-id",container="model-vers") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique identifier corresponding to one version of a model in ASDC") - - - - - - - @com.att.aai.annotations.Metadata(description="Name of the model, which can change from version to version.") - - - - - - - @com.att.aai.annotations.Metadata(description="Version") - - - - - - - @com.att.aai.annotations.Metadata(description="Description") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Subgraph definition provided by ASDC to describe an inventory asset and its connections related to ASDC models, independent of version",nameProps="model-type",indexedProps="model-invariant-id,model-type",uniqueProps="model-invariant-id",container="models",namespace="service-design-and-creation") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique identifier corresponding to the main definition of a model in ASDC") - - - - - - - @com.att.aai.annotations.Metadata(description="Type of the model, e.g., service, resource, widget, etc.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of subgraph definitions provided by ASDC to describe the inventory assets and their connections related to ASDC models") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="TBD",uniqueProps="related-lookup-uuid",indexedProps="related-lookup-uuid",allowDirectRead="true",allowDirectWrite="false",container="related-lookups") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true") - - - - - - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="TBD",uniqueProps="property-constraint-uuid",indexedProps="property-constraint-uuid",allowDirectRead="true",allowDirectWrite="false",container="property-constraints") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true") - - - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="TBD",uniqueProps="named-query-element-uuid",indexedProps="named-query-element-uuid",allowDirectRead="true",allowDirectWrite="false",container="named-query-elements") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true") - - - - - - - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="TBD",nameProps="named-query-name",uniqueProps="named-query-uuid",indexedProps="named-query-uuid,named-query-name",container="named-queries",namespace="service-design-and-creation") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true) - - - - - - - - - - @com.att.aai.annotations.Metadata(description="TBD",nameProps="named-query-name",uniqueProps="named-query-uuid",indexedProps="named-query-uuid,named-query-name",container="named-queries",namespace="service-design-and-creation") - - - - - - - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Namespace for objects managed by ASDC") - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Logical links generally connect l-interfaces but are used to express logical connectivity between two points",indexedProps="link-name,model-invariant-id,model-version-id,widget-model-id,widget-model-version,link-id,prov-status,circuit-id,purpose",uniqueProps="link-id",container="logical-links",namespace="network",searchable="link-name") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="e.g., evc-name, or vnf-nameA_interface-nameA_vnf-nameZ_interface-nameZ") - - - - - - - @com.att.aai.annotations.Metadata(description="Type of logical link, e.g., evc") - - - - - - - @com.att.aai.annotations.Metadata(description="Captures the numeric part of the speed") - - - - - - - @com.att.aai.annotations.Metadata(description="Captures the units corresponding to the speed") - - - - - - - @com.att.aai.annotations.Metadata(description="v4, v6, or ds for dual stack (should be att-ip-version)") - - - - - - - @com.att.aai.annotations.Metadata(description="For example, static or BGP") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC model version uuid for this resource or service model.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.") - - - - - - - @com.att.aai.annotations.Metadata(description="Status that indicates whether the asset is in or out of the service path. Valid values are null, in-service-path, out-of-service-path.") - - - - - - - @com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this VNF by BAU Service Assurance systems.") - - - - - - - @com.att.aai.annotations.Metadata(description="Indication of the network use of the logical link.") - - - - - - - @com.att.aai.annotations.Metadata(description="Alias or alternate name (CLCI or D1 name).") - - - - - - - @com.att.aai.annotations.Metadata(description="UUID of the logical-link, SDNC generates this.") - - - - - - - @com.att.aai.annotations.Metadata(description="Circuit id") - - - - - - - @com.att.aai.annotations.Metadata(description="Reason for this entity, role it is playing") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of logical connections") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(indexedProps="cos",dependentOn="site-pair",container="classes-of-service") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="unique identifier of probe") - - - - - - - @com.att.aai.annotations.Metadata(description="identifier of probe") - - - - - - - @com.att.aai.annotations.Metadata(description="type of probe") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="class-of-service of probe") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(indexedProps="site-pair-id",uniqueProps="site-pair-id",dependentOn="routing-instance",container="site-pairs") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="unique identifier of probe") - - - - - - - @com.att.aai.annotations.Metadata(description="Prefix address") - - - - - - - @com.att.aai.annotations.Metadata(description="Prefix address") - - - - - - - @com.att.aai.annotations.Metadata(description="ip version, v4, v6") - - - - - - - @com.att.aai.annotations.Metadata(description="Hostname of the destination equipment to which SLAs are measured against.") - - - - - - - @com.att.aai.annotations.Metadata(description="The type of destinatination equipment. Could be Router, UCPE, etc.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="probe within a set") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(indexedProps="routing-instance-id",uniqueProps="routing-instance-id",dependentOn="site-pair-set",container="routing-instances") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique id of routing instance") - - - - - - - @com.att.aai.annotations.Metadata(description="rpm owner") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="set of probes related to generic-vnf routing instance") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Set of instances for probes used to measure service level agreements",indexedProps="site-pair-set-id",uniqueProps="site-pair-set-id",container="site-pair-sets",namespace="network") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique id of site pair set.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of sets of instances for probes related to generic-vnf") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="stores the global route targets associated with a VPN",indexedProps="global-route-target,route-target-role",searchable="global-route-target",container="route-targets",namespace="network") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Number used to identify an RT, globally unique in the network") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Role assigned to this route target, valid values EXPORT/IMPORT/BOTH") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="Relationship to other objects") - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="VPN binding",nameProps="vpn-name,vpn-type",indexedProps="vpn-name,vpn-id,global-route-target,vpn-type",searchable="vpn-id,vpn-name",uniqueProps="vpn-id",container="vpn-bindings",namespace="network") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="VPN ID, globally unique within A&AI") - - - - - - - @com.att.aai.annotations.Metadata(description="VPN Name") - - - - - - - @com.att.aai.annotations.Metadata(description="Number used to identify a VPN, globally unique in the network. NOTE - WILL BE RETIRED IN 1802, see child object") - - - - - - - @com.att.aai.annotations.Metadata(description="the platform associated with the VPN example AVPN, Mobility") - - - - - - - @com.att.aai.annotations.Metadata(description="Type of the vpn, should be taken from enumerated/valid values") - - - - - - - @com.att.aai.annotations.Metadata(description="Used to distinguish the distinct VPN routes of separate customers who connect to the provider in an MPLS network.") - - - - - - - @com.att.aai.annotations.Metadata(description="Role assigned to this route target. NOTE - WILL BE RETIRED IN 1802, see child object") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - @com.att.aai.annotations.Metadata(description="l3-networks relate to vpn-bindings") - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="VPLS Provider Edge routers.",indexedProps="prov-status,equipment-name",container="vpls-pes",namespace="network") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true) - - - - - - - @com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this VNF by BAU Service Assurance systems.") - - - - - - - @com.att.aai.annotations.Metadata(description="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address).") - - - - - - - @com.att.aai.annotations.Metadata(description="Client should send valid enumerated value, e.g., VPLS-PE.") - - - - - - - @com.att.aai.annotations.Metadata(description="Temporary location for stag to get to VCE") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of VPLS Provider Edge routers") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(indexedProps="multicast-configuration-id",uniqueProps="multicast-configuration-id",container="multicast-configurations",namespace="network") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique id of multicast configuration.") - - - - - - - @com.att.aai.annotations.Metadata(description="protocol of multicast configuration") - - - - - - - @com.att.aai.annotations.Metadata(description="rp type of multicast configuration") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="multicast configuration of generic-vnf ip-address") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(dependentOn="port-group",indexedProps="cvlan-tag",container="cvlan-tags") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="See mis-na-virtualization-platform.yang") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Used to capture the network interfaces of this VCE",nameProps="port-group-name",indexedProps="port-group-id,heat-stack-id,interface-id,interface-name,switch-name",dependentOn="vce",container="port-groups") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of the interface") - - - - - - - @com.att.aai.annotations.Metadata(description="Neutron network id of this Interface") - - - - - - - @com.att.aai.annotations.Metadata(description="Neutron network name of this Interface") - - - - - - - @com.att.aai.annotations.Metadata(description="Role assigned to this Interface, should use values as defined in ECOMP Yang models.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="Unique ID for port group in vmware") - - - - - - - @com.att.aai.annotations.Metadata(description="Likely to duplicate value of neutron network name") - - - - - - - @com.att.aai.annotations.Metadata(description="DVS or standard switch name (should be non-null for port groups associated with DVS)") - - - - - - - @com.att.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO") - - - - - - - @com.att.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO") - - - - - - - @com.att.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE") - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Metadata for license group.",indexedProps="group-uuid,resource-uuid",dependentOn="generic-vnf,vce,vpe",container="licenses") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique ID for the license group the resource belongs to, should be uuid.") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of a license resource. ") - - - - - - - @com.att.aai.annotations.Metadata(description="Concurrency value") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Licenses to be allocated across resources, keyed by group-uuid and resource-uuid, related to license management") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Metadata for entitlement group.",indexedProps="group-uuid,resource-uuid",dependentOn="generic-vnf,vce,vpe",container="entitlements") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique ID for the entitlement group the resource comes from, should be uuid.") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of an entitlement resource. ") - - - - - - - @com.att.aai.annotations.Metadata(description="Concurrency value") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Entitlements, keyed by group-uuid and resource-uuid, related to license management") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Virtual Customer Edge Router, used specifically for Gamma. This object is deprecated.",nameProps="vnf-name",indexedProps="vnf-name,vnf-name2,vnf-type,heat-stack-id,vnf-id,interface-name,regional-resource-zone,vpe-id,prov-status,service-id",searchable="vnf-id,vnf-name,vnf-name2",uniqueProps="vnf-id",container="vces",namespace="network",extendsFrom="vnf") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique id of VNF. This is unique across the graph.") - - - - - - - @com.att.aai.annotations.Metadata(description="Name of VNF.") - - - - - - - @com.att.aai.annotations.Metadata(description="Alternate name of VNF.") - - - - - - - @com.att.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.") - - - - - - - @com.att.aai.annotations.Metadata(description="Unique identifier of service, does not strictly map to ASDC services, SOON TO BE DEPRECATED.") - - - - - - - @com.att.aai.annotations.Metadata(description="Regional way of organizing pservers, source of truth should define values") - - - - - - - @com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.") - - - - - - - @com.att.aai.annotations.Metadata(description="Status that indicates whether the asset is in or out of the service path. Valid values are null, in-service-path, out-of-service-path.") - - - - - - - @com.att.aai.annotations.Metadata(description="Network role being played by this VNF") - - - - - - - @com.att.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO") - - - - - - - @com.att.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO") - - - - - - - @com.att.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE") - - - - - - - @com.att.aai.annotations.Metadata(description="Unique ID of VPE connected to this VCE.") - - - - - - - @com.att.aai.annotations.Metadata(description="Valid v6 IP address for the WAN Link on this router. Implied length of /64.") - - - - - - - @com.att.aai.annotations.Metadata(description="Address tail-f uses to configure vce, also used for troubleshooting and is IP used for traps generated by VCE.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="Loopback0 address") - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of Virtual Customer Edge Routers, used specifically for Gamma. This object is deprecated.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Relationship-list must include related to info for complex.",nameProps="vnf-name",indexedProps="vnf-name,vnf-name2,vnf-type,heat-stack-id,vnf-id,regional-resource-zone,prov-status,service-id",searchable="vnf-id,vnf-name,vnf-name2",uniqueProps="vnf-id",container="vpes",namespace="network",extendsFrom="vnf") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique id of VNF. This is unique across the graph.") - - - - - - - @com.att.aai.annotations.Metadata(description="Name of VNF.") - - - - - - - @com.att.aai.annotations.Metadata(description="Alternate name of VNF.") - - - - - - - @com.att.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.") - - - - - - - @com.att.aai.annotations.Metadata(description="Unique identifier of service. Does not map strictly to ASDC services. SOON TO BE DEPRECATED") - - - - - - - @com.att.aai.annotations.Metadata(description="Regional way of organizing pservers, source of truth should define values") - - - - - - - @com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.") - - - - - - - @com.att.aai.annotations.Metadata(description="Status that indicates whether the asset is in or out of the service path. Valid values are null, in-service-path, out-of-service-path.") - - - - - - - @com.att.aai.annotations.Metadata(description="Client should send valid enumerated value") - - - - - - - @com.att.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO") - - - - - - - @com.att.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO") - - - - - - - @com.att.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE") - - - - - - - @com.att.aai.annotations.Metadata(description="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address).") - - - - - - - @com.att.aai.annotations.Metadata(description="Prefix length for oam-address") - - - - - - - @com.att.aai.annotations.Metadata(description="Gateway address") - - - - - - - @com.att.aai.annotations.Metadata(description="Loopback0 address") - - - - - - - @com.att.aai.annotations.Metadata(description="Temporary location for stag to get to VCE") - - - - - - - @com.att.aai.annotations.Metadata(description="as-number of the VPE") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="details regarding the vpe operation, PLEASE DISCONTINUE USE OF THIS FIELD.") - - - - - - - @com.att.aai.annotations.Metadata(description="indicates whether vpe access uses SSH") - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Virtual provider edge router. In 1504, A&AI will populate this object through an M&P and tool provided to operations.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(indexedProps="vnfc-name,prov-status,vnfc-type,vnfc-function-code,ipaddress-v4-oam-vip,in-maint,is-closed-loop-disabled,group-notation",searchable="vnfc-name",container="vnfcs",namespace="network") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of vnfc.") - - - - - - - @com.att.aai.annotations.Metadata(description="function code") - - - - - - - @com.att.aai.annotations.Metadata(description="type") - - - - - - - @com.att.aai.annotations.Metadata(description="prov status of this vnfc") - - - - - - - @com.att.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by APP-C") - - - - - - - @com.att.aai.annotations.Metadata(description="Oam V4 vip address of this vnfc") - - - - - - - @com.att.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)") - - - - - - - @com.att.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether closed loop function is enabled on this node") - - - - - - - @com.att.aai.annotations.Metadata(description="Group notation of VNFC") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="virtual network components associated with a vserver from application controller.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(indexedProps="subnet-id,subnet-name",nameProps="subnet-name",uniqueProps="subnet-id",dependentOn="l3-network",container="subnets") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Subnet ID, should be UUID.") - - - - - - - @com.att.aai.annotations.Metadata(description="Name associated with the subnet.") - - - - - - - @com.att.aai.annotations.Metadata(description="Neutron id of this subnet") - - - - - - - @com.att.aai.annotations.Metadata(description="gateway ip address") - - - - - - - @com.att.aai.annotations.Metadata(description="network start address") - - - - - - - @com.att.aai.annotations.Metadata(description="cidr mask") - - - - - - - @com.att.aai.annotations.Metadata(description="ip version") - - - - - - - @com.att.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO") - - - - - - - @com.att.aai.annotations.Metadata(defaultValue="false",description="dhcp enabled") - - - - - - - @com.att.aai.annotations.Metadata(description="the start address reserved for use by dhcp") - - - - - - - @com.att.aai.annotations.Metadata(description="the last address reserved for use by dhcp") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(indexedProps="vlan-id-inner",dependentOn="l3-network",container="ctag-assignments") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="id.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Openstack segmentation assignment.",indexedProps="segmentation-id",dependentOn="l3-network",container="segmentation-assignments") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Route Table Reference id, UUID assigned to this instance.") - - - - - - - @com.att.aai.annotations.Metadata(description="Concurrency value") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of openstack segmentation assignments") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Generic network definition",nameProps="network-name",indexedProps="heat-stack-id,network-uuid,service-id,network-id,network-name,model-invariant-id,model-version-id,widget-model-id,widget-model-version,contrail-network-fqdn,network-role",searchable="network-id,network-name",uniqueProps="network-id",container="l3-networks",namespace="network") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Network ID, should be uuid. Unique across A&AI.") - - - - - - - @com.att.aai.annotations.Metadata(description="Name of the network, governed by some naming convention..") - - - - - - - @com.att.aai.annotations.Metadata(description="Type of the network - who defines these values?") - - - - - - - @com.att.aai.annotations.Metadata(description="Role the network plans - who defines these values?") - - - - - - - @com.att.aai.annotations.Metadata(description="Network technology - who defines these values?") - - - - - - - @com.att.aai.annotations.Metadata(description="Neutron network id of this Interface") - - - - - - - @com.att.aai.annotations.Metadata(defaultValue="false",description="Set to true if bound to VPN") - - - - - - - @com.att.aai.annotations.Metadata(description="Unique identifier of service from ASDC. Does not strictly map to ASDC services. SOON TO BE DEPRECATED") - - - - - - - @com.att.aai.annotations.Metadata(description="network role instance") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO") - - - - - - - @com.att.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO") - - - - - - - @com.att.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE") - - - - - - - @com.att.aai.annotations.Metadata(description="Contrail FQDN for the network") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC model version uuid for this resource or service model.") - - - - - - - @com.att.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.") - - - - - - - @com.att.aai.annotations.Metadata(description="Name associated with the physical network.") - - - - - - - @com.att.aai.annotations.Metadata(defaultValue="false",description="boolean indicatating whether or not network is a provider network.") - - - - - - - @com.att.aai.annotations.Metadata(defaultValue="false",description="boolean indicatating whether or not network is a shared network.") - - - - - - - @com.att.aai.annotations.Metadata(defaultValue="false",description="boolean indicatating whether or not network is an external network.") - - - - - - - @com.att.aai.annotations.Metadata(description="Status that indicates whether the asset is in or out of the service path. Valid values are null, in-service-path, out-of-service-path.") - - - - - - - @com.att.aai.annotations.Metadata(description="Path to the controller object.") - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Relates to tenant (or is it a child of tenant), complex, service, vpn-binding") - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(nameProps="network-policy-fqdn",indexedProps="network-policy-id,network-policy-fqdn",searchable="network-policy-id,network-policy-fqdn",uniqueProps="network-policy-id",container="network-policies",namespace="network") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="UUID representing unique key to this instance") - - - - - - - @com.att.aai.annotations.Metadata(description="Contrail FQDN for the policy") - - - - - - - @com.att.aai.annotations.Metadata(description="ID for the openStack Heat instance") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="a deployment unit of VNFCs",indexedProps="vf-module-id,vf-module-name,heat-stack-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,contrail-service-instance-fqdn",searchable="vf-module-id,vf-module-name",dependentOn="generic-vnf",container="vf-modules") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of vf-module.") - - - - - - - @com.att.aai.annotations.Metadata(description="Name of vf-module") - - - - - - - @com.att.aai.annotations.Metadata(description="Heat stack id corresponding to this instance.") - - - - - - - @com.att.aai.annotations.Metadata(description="orchestration status of this vf-module, mastered by MSO") - - - - - - - @com.att.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is base vf module") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC model version uuid for this resource or service model.") - - - - - - - @com.att.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.") - - - - - - - @com.att.aai.annotations.Metadata(description="the Contrail unique ID for a service-instance") - - - - - - - @com.att.aai.annotations.Metadata(description="the index will track the number of modules of a given type that have been deployed in a VNF, starting with 0, and always choosing the lowest available digit") - - - - - - - @com.att.aai.annotations.Metadata(description="Path to the controller object.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of vf-modules, a deployment unit of VNFCs") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="General purpose VNF",nameProps="vnf-name",indexedProps="is-closed-loop-disabled,vnf-name2,vnf-type,heat-stack-id,in-maint,vnf-name,vnf-id,regional-resource-zone,prov-status,service-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,nf-type,nf-role,nf-function,nf-naming-code",searchable="vnf-id,vnf-name,vnf-name2",uniqueProps="vnf-id",container="generic-vnfs",namespace="network",extendsFrom="vnf") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique id of VNF. This is unique across the graph.") - - - - - - - @com.att.aai.annotations.Metadata(description="Name of VNF.") - - - - - - - @com.att.aai.annotations.Metadata(description="Alternate name of VNF.") - - - - - - - @com.att.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.") - - - - - - - @com.att.aai.annotations.Metadata(description="Unique identifier of service, does not necessarily map to ASDC service models. SOON TO BE DEPRECATED") - - - - - - - @com.att.aai.annotations.Metadata(description="Regional way of organizing pservers, source of truth should define values") - - - - - - - @com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.") - - - - - - - @com.att.aai.annotations.Metadata(description="Status that indicates whether the asset is in or out of the service path. Valid values are null, in-service-path, out-of-service-path.") - - - - - - - @com.att.aai.annotations.Metadata(description="Client should send valid enumerated value") - - - - - - - @com.att.aai.annotations.Metadata(description="Orchestration status of this VNF, used by MSO.") - - - - - - - @com.att.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO") - - - - - - - @com.att.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE") - - - - - - - @com.att.aai.annotations.Metadata(description="identifier of managed by ATT or customer") - - - - - - - @com.att.aai.annotations.Metadata(description="Address tail-f uses to configure generic-vnf, also used for troubleshooting and is IP used for traps generated by generic-vnf.") - - - - - - - @com.att.aai.annotations.Metadata(description="v4 Loopback0 address") - - - - - - - @com.att.aai.annotations.Metadata(description="v6 Loopback address") - - - - - - - @com.att.aai.annotations.Metadata(description="v6 management address") - - - - - - - @com.att.aai.annotations.Metadata(description="number of vcpus ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only by uCPE") - - - - - - - @com.att.aai.annotations.Metadata(description="units associated with vcpu, used for VNFs with no vservers/flavors, to be used only by uCPE") - - - - - - - @com.att.aai.annotations.Metadata(description="number of GB of memory ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only by uCPE") - - - - - - - @com.att.aai.annotations.Metadata(description="units associated with vmemory, used for VNFs with no vservers/flavors, to be used only by uCPE") - - - - - - - @com.att.aai.annotations.Metadata(description="number of vdisks ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only uCPE") - - - - - - - @com.att.aai.annotations.Metadata(description="units associated with vdisk, used for VNFs with no vservers/flavors, to be used only by uCPE") - - - - - - - @com.att.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.") - - - - - - - @com.att.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether closed loop function is enabled on this node") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="details regarding the generic-vnf operation, PLEASE DISCONTINUE USE OF THIS FIELD.") - - - - - - - @com.att.aai.annotations.Metadata(description="indicates whether generic-vnf access uses SSH") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC model version uuid for this resource or service model.") - - - - - - - @com.att.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.") - - - - - - - @com.att.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.") - - - - - - - @com.att.aai.annotations.Metadata(description="as-number of the VNF") - - - - - - - @com.att.aai.annotations.Metadata(description="represents sub zone of the rr plane") - - - - - - - @com.att.aai.annotations.Metadata(description="Generic description of the type of the resource") - - - - - - - @com.att.aai.annotations.Metadata(description="Role that this asset will be playing in its context.") - - - - - - - @com.att.aai.annotations.Metadata(description="English description of function that the specific resource deployment is providing. Assigned as part of the customization of a resource in a service") - - - - - - - @com.att.aai.annotations.Metadata(description="Short code that is used in naming instances of the item being modelled") - - - - - - - @com.att.aai.annotations.Metadata(description="Path to the controller object.") - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of VNFs") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="LAG links can connect lag-interfaces",indexedProps="link-name",container="lag-links",namespace="network") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Alphabetical concatenation of lag-interface names") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of link aggregation connections") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="This object fills in the gaps from vce that were incorporated into generic-vnf. This object will be retired with vce.",nameProps="vnf-name",indexedProps="vnf-name,vnf-name2,vnf-type,heat-stack-id,prov-status,vnf-id2",searchable="vnf-id2,vnf-name,vnf-name2",uniqueProps="vnf-id2",container="newvces",namespace="network") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique id of VNF, can't use same attribute name right now until we promote this new object") - - - - - - - @com.att.aai.annotations.Metadata(description="Name of VNF.") - - - - - - - @com.att.aai.annotations.Metadata(description="Alternate name of VNF.") - - - - - - - @com.att.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.") - - - - - - - @com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this VNF by BAU Service Assurance systems.") - - - - - - - @com.att.aai.annotations.Metadata(description="Status that indicates whether the asset is in or out of the service path. Valid values are null, in-service-path, out-of-service-path.") - - - - - - - @com.att.aai.annotations.Metadata(description="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address).") - - - - - - - @com.att.aai.annotations.Metadata(description="Client should send valid enumerated value, e.g., VPE.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="v4 Loopback0 address") - - - - - - - @com.att.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO.") - - - - - - - @com.att.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO") - - - - - - - @com.att.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="This object fills in the gaps from vce that were incorporated into generic-vnf. This object will be retired with vce.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="PNF represents a physical network function. typically equipment used in the D1 world. in 1607, this will be populated by SDN-C to represent a premises router that a uCPE connects to. But this can be used to represent any physical device that is not an AIC node or uCPE.",indexedProps="pnf-name,orchestration-status,inv-status",searchable="pnf-name",uniqueProps="pnf-name",container="pnfs",namespace="network") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="unique name of Physical Network Function.") - - - - - - - @com.att.aai.annotations.Metadata(description="name of Physical Network Function.") - - - - - - - @com.att.aai.annotations.Metadata(description="source of name2") - - - - - - - @com.att.aai.annotations.Metadata(description="id of pnf") - - - - - - - @com.att.aai.annotations.Metadata(description="Equipment type. Source of truth should define valid values.") - - - - - - - @com.att.aai.annotations.Metadata(description="Equipment vendor. Source of truth should define valid values.") - - - - - - - @com.att.aai.annotations.Metadata(description="Equipment model. Source of truth should define valid values.") - - - - - - - @com.att.aai.annotations.Metadata(description="identifier of managed by ATT or customer") - - - - - - - @com.att.aai.annotations.Metadata(description="ipv4-oam-address with new naming convention for IP addresses") - - - - - - - @com.att.aai.annotations.Metadata(description="sw-version is the version of SW for the hosted application on the PNF.") - - - - - - - @com.att.aai.annotations.Metadata(defaultValue="false",description="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.") - - - - - - - @com.att.aai.annotations.Metadata(description="ID of the physical frame (relay rack) where pnf is installed.") - - - - - - - @com.att.aai.annotations.Metadata(description="Serial number of the device") - - - - - - - @com.att.aai.annotations.Metadata(description="IPV4 Loopback 0 address") - - - - - - - @com.att.aai.annotations.Metadata(description="IPV6 Loopback 0 address") - - - - - - - @com.att.aai.annotations.Metadata(description="IPV4 AIM address") - - - - - - - @com.att.aai.annotations.Metadata(description="IPV6 AIM address") - - - - - - - @com.att.aai.annotations.Metadata(description="IPV6 OAM address") - - - - - - - @com.att.aai.annotations.Metadata(description="CANOPI's inventory status. Only set with values exactly as defined by CANOPI.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @com.att.aai.annotations.Metadata(description="Prov Status of this device (not under canopi control) Valid values [PREPROV/NVTPROV/PROV]") - - - - - - - @com.att.aai.annotations.Metadata(description="Nf Role is the role performed by this instance in the network.") - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of Physical Network Functions.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of physical connections, typically between p-interfaces",indexedProps="circuit-id,link-name",alternateKeys1="circuit-id",container="physical-links",namespace="network",searchable="link-name,circuit-id") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="e.g., hostnameA_p-connection_nameA_hostnameZ+p_connection-nameZ") - - - - - - - @com.att.aai.annotations.Metadata(description="Captures the numeric part of the speed") - - - - - - - @com.att.aai.annotations.Metadata(description="Captures the units corresponding to the speed") - - - - - - - @com.att.aai.annotations.Metadata(description="Circuit it") - - - - - - - @com.att.aai.annotations.Metadata(description="Dual access mode (e.g., primary, secondary") - - - - - - - @com.att.aai.annotations.Metadata(description="To provide information on who manages this circuit. A&AI or 3rd party transport provider") - - - - - - - @com.att.aai.annotations.Metadata(description="Name of the service Provider on this link.") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of physical connections, typically between p-interfaces") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="vig-server contains information about a vig server used for IPSec-configuration. Populated by SDN-C from 1607",indexedProps="vig-address-type",dependentOn="ipsec-configuration",container="vig-servers") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="indicates whether the VIG is for AVPN or INTERNET") - - - - - - - @com.att.aai.annotations.Metadata(description="v4 IP of the vig server") - - - - - - - @com.att.aai.annotations.Metadata(description="v6 IP of the vig server") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="IPSec configuration node will contain various configuration data for the NMTE VNF. This node will have an edge to the generic-vnf (vnf type = TE). Starting 1607, this data will be populated by SDN-C",indexedProps="ipsec-configuration-id",uniqueProps="ipsec-configuration-id",container="ipsec-configurations",namespace="network") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="UUID of this configuration") - - - - - - - @com.att.aai.annotations.Metadata(description="Indicate the type of VIG server like AVPN, INTERNET, BOTH") - - - - - - - @com.att.aai.annotations.Metadata(description="Encryption values like 3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc") - - - - - - - @com.att.aai.annotations.Metadata(description="ATT can offer a shared DMZ or a DMZ specific to a customer") - - - - - - - @com.att.aai.annotations.Metadata(description="Network address of shared DMZ") - - - - - - - @com.att.aai.annotations.Metadata(description="If the DMZ is a custom DMZ, this field will indicate the customer information") - - - - - - - @com.att.aai.annotations.Metadata(description="can be 1 or 2") - - - - - - - @com.att.aai.annotations.Metadata(description="Contains values like md5, sha1, sha256, sha384") - - - - - - - @com.att.aai.annotations.Metadata(description="Encyption values like 3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc") - - - - - - - @com.att.aai.annotations.Metadata(description="Diffie-Hellman group like DH-GROUP2, DH-GROUP5, DH-GROUP14") - - - - - - - @com.att.aai.annotations.Metadata(description="Group name defined in VIG for clients using aggressive mode") - - - - - - - @com.att.aai.annotations.Metadata(description="pre-shared key for the above group name ") - - - - - - - @com.att.aai.annotations.Metadata(description="Lifetime for IKEv1 SA") - - - - - - - @com.att.aai.annotations.Metadata(description="md5, sha1, sha256, sha384") - - - - - - - @com.att.aai.annotations.Metadata(description="3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc") - - - - - - - @com.att.aai.annotations.Metadata(description="Life time for IPSec SA") - - - - - - - @com.att.aai.annotations.Metadata(description="enable PFS or not") - - - - - - - @com.att.aai.annotations.Metadata(description="user ID for xAuth, sm-user,ucpeHostName,nmteHostName") - - - - - - - @com.att.aai.annotations.Metadata(description="Encrypted using the Juniper $9$ algorithm") - - - - - - - @com.att.aai.annotations.Metadata(description="The time between DPD probe") - - - - - - - @com.att.aai.annotations.Metadata(description="Maximum number of DPD before claiming the tunnel is down") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Openstack route table reference.",nameProps="route-table-reference-fqdn",uniqueProps="route-table-reference-id",indexedProps="route-table-reference-id,route-table-reference-fqdn",container="route-table-references",namespace="network") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Route Table Reference id, UUID assigned to this instance.") - - - - - - - @com.att.aai.annotations.Metadata(description="FQDN entry in the route table.") - - - - - - - @com.att.aai.annotations.Metadata(description="Concurrency value") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of openstack route table references") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="General mechanism for grouping instances",nameProps="description",uniqueProps="id",indexedProps="id,description,type,sub-type",container="instance-groups",namespace="network") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Instance Group ID, UUID assigned to this instance.") - - - - - - - @com.att.aai.annotations.Metadata(description="Descriptive text to help identify the usage of this instance-group") - - - - - - - @com.att.aai.annotations.Metadata(description="Only valid value today is lower case ha for high availability") - - - - - - - @com.att.aai.annotations.Metadata(description="Valid values for ha type are [geo-activeactive, geo-activestandby, local-activeactive, local-activestandby]") - - - - - - - @com.att.aai.annotations.Metadata(description="Concurrency value") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of openstack route table references") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="A zone is a grouping of assets in a location homing to the same connections into the CBB",nameProps="zone-name",indexedProps="zone-id,design-type,zone-context",uniqueProps="zone-id",container="zones",namespace="network") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Code assigned by AIC to the zone") - - - - - - - @com.att.aai.annotations.Metadata(description="English name associated with the zone") - - - - - - - @com.att.aai.annotations.Metadata(description="Design of zone [Medium/Large…]") - - - - - - - @com.att.aai.annotations.Metadata(description="Context of zone [production/test]") - - - - - - - @com.att.aai.annotations.Metadata(description="Status of a zone.") - - - - - - - @com.att.aai.annotations.Metadata(description="Concurrency value") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Collection of zones") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Namespace for network inventory resources.") - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Internal map to define some reserved properties of a vertex",uniqueProps="aai-unique-key",indexedProps="aai-unique-key,source-of-truth,aai-node-type,aai-uri") - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Internal map to define the properties of an edge and interpret the map EdgeRules",edgeInfo="edgeLabel,direction,multiplicityRule,isParent,usesResource,hasDelTarget,SVC-INFRA,SVC-INFRA-REV") - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Allows for legacy POST of old-style and new-style models") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique identifier corresponding to the main definition of a model in ASDC") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique identifier corresponding to one version of a model in ASDC") - - - - - - - @com.att.aai.annotations.Metadata(description="Type of the model, e.g., service, resource, widget, etc.") - - - - - - - @com.att.aai.annotations.Metadata(description="Name of the model, which can change from version to version.") - - - - - - - @com.att.aai.annotations.Metadata(description="Invariant unique ID which does not change from version to version") - - - - - - - @com.att.aai.annotations.Metadata(description="Version") - - - - - - - @com.att.aai.annotations.Metadata(description="Description") - - - - - - - @com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="QueryParameters for performing a named-query or model query") - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="InstanceFilters for performing a named-query or model query") - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="SecondaryFilts for performing a named-query or model query") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="ModelAndNamedQuerySearch holds query-parameters and instance-properties for performing a named-query or model query") - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Property holder for query properties or instance properties") - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Inventory item for response list",container="inventory-response-items") - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Container for inventory items in response list",container="response-list") - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Response container for the results of a named-query or model query") - - - - - - - - - - - - - - - - - - - @com.att.aai.annotations.Metadata(description="Abstract vnf class",indexedProps="vnf-id",uniqueProps="vnf-id",inheritors="vce,vpe,generic-vnf",isAbstract="true") - - - - - - - @com.att.aai.annotations.Metadata(isKey=true,description="Unique id of VNF. This is unique across the graph.") - - - - - - - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/xsd/aai_schema_v11.xsd b/bpmn/MSOCommonBPMN/src/main/resources/xsd/aai_schema_v11.xsd deleted file mode 100644 index 47385168cc..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/xsd/aai_schema_v11.xsd +++ /dev/null @@ -1,6934 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The specific type of node in the A&AI graph") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The URL to the specific resource") - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="A keyword provided by A&AI to indicate an attribute.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Value of the attribute.") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Key part of a key/value pair") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Value part of a key/value pair") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="A keyword provided by A&AI to indicate type of node.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="URL to the object in A&AI.") - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="OAM network, to be deprecated shortly. Do not use for new purposes. ",nameProps="network-name",indexedProps="cvlan-tag,network-uuid,network-name",dependentOn="cloud-region",container="oam-networks") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="UUID of the network. Unique across a cloud-region") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Name of the network.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="cvlan-id") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for VNF firewall rule so customer cannot send customer traffic over this oam network") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for VNF firewall rule so customer cannot send customer traffic over this oam network") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of OAM networks, to be deprecated shortly. Do not use for new purposes. ") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Digital virtual switch metadata, used by SDN-C to configure VCEs. A&AI needs to receive this data from the PO deployment team and administer it using the provisioningTool.sh into A&AI. ",indexedProps="vcenter-url,switch-name",dependentOn="cloud-region",container="dvs-switches") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="DVS switch name") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="URL used to reach the vcenter") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of digital virtual switch metadata used for vmWare VCEs and VPEs.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Availability zone, a collection of compute hosts/pservers",indexedProps="availability-zone-name",dependentOn="cloud-region",container="availability-zones") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Name of the availability zone. Unique across a cloud region") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Type of hypervisor. Source of truth should define valid values.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="State that indicates whether the availability zone should be used, etc. Source of truth should define valid values.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Serves a PATCH like function. Does not enforce concurrency control. Clear each usage with AAI team.") - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="APIs that are more action related than REST (e.g., notify, update).") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="A collection of C tags (vlan tags) grouped for a specific purpose.",indexedProps="availability-zone-name",dependentOn="complex",container="ctag-pools") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="The Target provider edge router") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Name of the availability zone") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Describes what the intended purpose of this pool is.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Comma separated list of ctags") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of physical locations that can house cloud-regions.",indexedProps="identity-url,data-center-code,complex-name,physical-location-id",searchable="physical-location-id,data-center-code,complex-name,street1,street2,postal-code",uniqueProps="physical-location-id",container="complexes",namespace="cloud-infrastructure") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique identifier for physical location, e.g., CLLI") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Data center code which can be an alternate way to identify a complex") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Gamma complex name for LCP instance.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="URL of the keystone identity service") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Type, e.g., central office, data center.") - - - - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of physical locations that can house cloud-regions.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Persistent block-level storage.",indexedProps="volume-group-name,vnf-type,heat-stack-id,volume-group-id",searchable="volume-group-id,volume-group-name",dependentOn="cloud-region",container="volume-groups") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of volume-group.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Name of the volume group.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Heat stack id corresponding to this volume-group") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Orchestration status of this volume-group") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="helps relate the volume group to the vf-module whose components will require the volume group") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of persistent block-level storage.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Ephemeral Block storage volume.",indexedProps="volume-id",dependentOn="vserver",container="volumes") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of block storage volume relative to the vserver.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of ephemeral Block storage volumes.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="IPv4 Address Range",indexedProps="l3-interface-ipv4-address,vlan-id-inner,neutron-network-id,neutron-subnet-id",dependentOn="vlan,l-interface") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="IP address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Prefix length, 32 for single address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Inner VLAN tag") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Outer VLAN tag") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Indicator of fixed or floating address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Neutron network id of the interface that address belongs to") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Neutron id of subnet that address belongs to") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="IPv6 Address Range",indexedProps="l3-interface-ipv6-address,vlan-id-inner,neutron-network-id,neutron-subnet-id",dependentOn="vlan,l-interface") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="IP address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Prefix length, 128 for single address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Inner VLAN tag") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Outer VLAN tag") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Indicator of fixed or floating address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Neutron network id of the interface that address belongs to") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Neutron id of subnet that address belongs to") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Definition of vlan",indexedProps="vlan-interface,vlan-id-inner,vpn-key",dependentOn="l-interface",container="vlans") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="String that identifies the interface") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Inner VLAN tag") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Outer VLAN tag") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Captures the numeric part of the speed") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Captures the units corresponding to the speed") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used to describe (the service associated with) the vlan") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Whether customer is going to use this VLAN for backdoor connection to another customer premise device.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This indicates the customers VPN ID associated with this vlan") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Status of a vnf's vlan interface, on which the customer circuit resides, mastered by SDN-C.") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Prov Status of the VLAN configuration related to a logical interface. Valid values [PREPROV/NVTPROV/PROV].") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="Flag indicating the interface uses the IP Unnumbered configuration.") - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="SR-IOV Virtual Function (not to be confused with virtual network function)",indexedProps="pci-id,vf-vlan-filter,vf-mac-filter,vf-vlan-strip,neutron-network-id",dependentOn="l-interface",container="sriov-vfs") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="PCI ID used to identify the sriov-vf") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This metadata provides option to specify list of VLAN filters applied on VF to pass the traffic to VM.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="When MAC filters are specified, VF-agent service configures VFs to do MAC level filtering before the traffic is passed to VM.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="When this field is set to true, VF will configured to strip the outer TAG before the traffic is passed to VM.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This option ensures anti VLAN spoof checks are done at the VF level to comply with security. The disable check will also be honored per the VNF needs for trusted VMs.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This option ensures anti MAC spoof checks are done at the VF level to comply with security. The disable check will also be honored per the VNF needs for trusted VMs.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This option defines the set of Mirror objects which essentially mirrors the traffic from source to set of collector VNF Ports.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This option, if set to true, sets the VF in promiscuous mode and allows all broadcast traffic to reach the VM") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This option, if set to true, sets the VF in promiscuous mode and allows unknown multicast traffic to reach the VM") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This option, if set to true, sets the VF in promiscuous mode and allows unknown unicast traffic to reach the VM") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This option, if set to true, instructs to insert outer tag after traffic comes out of VM.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This option is used to set the link status. Valid values as of 1607 are on, off, and auto.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Neutron network id of the interface") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of SR-IOV Virtual Functions.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Logical interfaces, e.g., a vnic.",indexedProps="macaddr,interface-id,interface-name,network-name",dependentOn="generic-vnf,newvce,vpe,p-interface,vserver,lag-interface",container="l-interfaces") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Name given to the interface") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="E.g., CUSTOMER, UPLINK, etc.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Questionably placed - v6 ip addr of this interface (is in vr-lan-interface from Mary B.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="ID of interface") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="MAC address for the interface") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Name of the network") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Whether A&AI should be managing this interface of not. Could have value like CUSTOMER") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Human friendly text regarding this interface.") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="boolean indicatating whether or not port is a mirrored.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Prov Status of the logical interface. Valid values [PREPROV/NVTPROV/PROV].") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="Flag indicating the interface uses the IP Unnumbered configuration.") - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of logical interfaces.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Virtual Servers, aka virtual machine or VM.",nameProps="vserver-name",indexedProps="is-closed-loop-disabled,prov-status,vserver-name,vserver-id,in-maint,vserver-name2",searchable="vserver-id,vserver-name,vserver-name2",dependentOn="tenant",container="vservers") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique identifier for this vserver relative to its tenant") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Name of vserver") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Alternative name of vserver") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="Used to indicate whether closed loop function is enabled on this node") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of virtual Servers, aka virtual machines or VMs.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Openstack tenant",nameProps="tenant-name",indexedProps="tenant-name,tenant-id,tenant-context",searchable="tenant-id,tenant-name",dependentOn="cloud-region",container="tenants") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id relative to the cloud-region.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Readable name of tenant") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This field will store the tenant context.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of openstack tenants.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Openstack flavor.",nameProps="flavor-name",indexedProps="flavor-name,flavor-id",dependentOn="cloud-region",container="flavors") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Flavor id, expected to be unique across cloud-region.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Flavor name") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Number of CPUs") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Amount of memory") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Disk space") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Amount of ephemeral disk space") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="amount of swap space allocation") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="whether flavor is available to all users or private to the tenant it was created in.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Boolean as to whether this flavor is no longer enabled") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of openstack flavors.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Openstack group-assignment used to store exclusivity groups (EG).",nameProps="group-name",indexedProps="group-id,group-type,group-name",searchable="group-id,group-name",dependentOn="cloud-region",container="group-assignments") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Group id, expected to be unique across cloud-region.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Group type - the type of group this instance refers to") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Group name - name assigned to the group") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Group description - description of the group") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of openstack group assignments") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Openstack snapshot",nameProps="snapshot-name",uniqueProps="snapshot-id",indexedProps="application,snapshot-name,application-vendor,snapshot-id,application-version,prev-snapshot-id",dependentOn="cloud-region",container="snapshots") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Snapshot id, this is the key UUID assoc associated in glance with the snapshots.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Snapshot name") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Operating system architecture") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The common name of the operating system distribution in lowercase") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The operating system version as specified by the distributor.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The application that the image instantiates.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The vendor of the application.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The version of the application.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This field contains the UUID of the previous snapshot (if any).") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of openstack snapshots") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Key/value pairs",indexedProps="metaname",dependentOn="tenant,image,service-instance,connector,model",container="metadata") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true) - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of metadatum (key/value pairs)") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Openstack image.",nameProps="image-name",indexedProps="application,image-name,application-vendor,image-id,application-version",dependentOn="cloud-region",container="images") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Image id, expected to be unique across cloud region") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Image name") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Operating system architecture.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The common name of the operating system distribution in lowercase") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The operating system version as specified by the distributor.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The application that the image instantiates.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The vendor of the application.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The version of the application.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collectio of Openstack images.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of availability zones") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="cloud-region designates an installation of a cloud cluster or region or instantiation. In AT&Ts AIC cloud, this could be an LCP or DCP. Cloud regions are uniquely identified by a composite key, cloud-owner + cloud-region-id. The format of the cloud-owner is vendor-cloudname and we will use att-aic for AT&T's AIC.",indexedProps="cloud-owner,cloud-region-id,cloud-type,owner-defined-type",nameProps="owner-defined-type",container="cloud-regions",namespace="cloud-infrastructure") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Identifies the vendor and cloud name, e.g., att-aic. First part of composite key should be formatted as vendor-cloudname") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Identifier used by the vendor for the region. Second part of composite key") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Type of the cloud (e.g., openstack)") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Cloud-owner defined type indicator (e.g., dcp, lcp)") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Software version employed at the site. NOTE - THIS FIELD IS NOT KEPT UP TO DATE.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="URL of the keystone identity service") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Zone where the cloud is homed. NOTE - THIS FIELD IS NOT CORRECTLY POPULATED.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="complex name for cloud-region instance. NOTE - THIS FIELD IS NOT CORRECTLY POPULATED.") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="Whether the cloud region supports (true) or does not support (false) SR-IOV automation.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(maximumDepth="0") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Network profile populated by SDN-GP for SNMP",indexedProps="nm-profile-name",container="network-profiles",namespace="cloud-infrastructure") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique name of network profile.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Encrypted SNMP community string") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of network profiles") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="SR-IOV Physical Function",indexedProps="pf-pci-id",dependentOn="p-interface",container="sriov-pfs") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Identifier for the sriov-pf") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of SR-IOV Physical Functions.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Physical interface (e.g., nic)",indexedProps="interface-name,prov-status",nameProps="prov-status",dependentOn="vpls-pe,pserver,pnf",container="p-interfaces") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Name that identifies the physical interface") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Captures the numeric part of the speed") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Captures the units corresponding to the speed") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Nature of the services and connectivity on this port.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="CLEI or other specification for p-interface hardware.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Role specification for p-interface hardware.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Indicates the physical properties of the interface.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="inventory status") - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of physical interfaces.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Link aggregate interface",indexedProps="interface-name,interface-id,interface-role",dependentOn="generic-vnf,pserver,vpe,vpls-pe,pnf",container="lag-interfaces") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Name that identifies the link aggregate interface") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Human friendly text regarding this interface.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Captures the numeric part of the speed") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Captures the units corresponding to the speed") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="ID of interface") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Role assigned to this Interface, should use values as defined in ECOMP Yang models.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of link aggregate interfaces.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Compute host whose hostname must be unique and must exactly match what is sent as a relationship to a vserver.",nameProps="pserver-name2",indexedProps="hostname,in-maint,pserver-id,pserver-name2,inv-status",searchable="hostname,pserver-name2,pserver-id,ipv4-oam-address",container="pservers",namespace="cloud-infrastructure") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Value from executing hostname on the compute node.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="PTNII name") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Number of cpus") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Disk size, in GBs") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="RAM size, in MBs") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Equipment type. Source of truth should define valid values.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Equipment vendor. Source of truth should define valid values.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Equipment model. Source of truth should define valid values.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Fully-qualified domain name") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used to configure device, also used for troubleshooting and is IP used for traps generated by device.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Serial number, may be queried") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="IPV4 Loopback 0 address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="IPV6 Loopback 0 address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="IPV4 AIM address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="IPV6 AIM address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="IPV6 OAM address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="CANOPI's inventory status. Only set with values exactly as defined by CANOPI.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="ID of Pserver") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="internet topology of Pserver") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="alternative pserver name") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="purpose of pserver") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Prov Status of this device (not under canopi control) Valid values [PREPROV/NVTPROV/PROV]") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Indicates who owns and or manages the device.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The host profile that defines the configuration of the pserver.") - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of compute hosts.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Virtual organization of cloud infrastructure elements in a data center context",nameProps="vdc-name",indexedProps="vdc-name,vdc-id",container="virtual-data-centers",namespace="cloud-infrastructure") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of the vdc") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Name of the virtual data center") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Virtual organization of cloud infrastructure elements in a data center context") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Namespace for cloud infrastructure.") - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="OBSOLETE OBJECT: do not use",nameProps="name",indexedProps="assignment-group-uuid,att-uuid,name",uniqueProps="att-uuid",container="license-key-resources",namespace="license-management") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true) - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of resource instances used to connect a variety of disparate inventory widgets",indexedProps="resource-instance-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version",container="connectors",namespace="business") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of resource instance.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id",dbAlias="model-invariant-id-local") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id",dbAlias="model-version-id-local") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="internal",dataCopy="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of resource instances used to connect a variety of disparate inventory widgets") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Represents the specifics of a tunnel cross connect piece of a resource that gets separately allotted",uniqueProps="id",indexedProps="id",dependentOn="allotted-resource",container="tunnel-xconnects") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Allotted Resource id UUID assigned to this instance.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The WAN uplink bandwidth for WAN1") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The WAN downlink bandwidth for WAN1") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The WAN uplink bandwidth for WAN2") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The WAN downlink bandwidth for WAN2") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Concurrency value") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This object is used to store the specific tunnel cross connect aspects of an allotted resource") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Represents a slice or partial piece of a resource that gets separately allotted",nameProps="description",uniqueProps="id",indexedProps="id,model-invariant-id,model-version-id,type,role",dependentOn="service-instance",container="allotted-resources") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Allotted Resource id UUID assigned to this instance.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The descriptive information assigned to this allotted resource instance") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Link back to more information in the controller") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id",dbAlias="model-invariant-id-local") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id",dbAlias="model-version-id-local") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="internal",dataCopy="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Concurrency value") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Orchestration status") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Indicator for whether the resource is considered operational") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Generic description of the type of allotted resource.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="role in the network that this resource will be providing.") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This object is used to store slices of services being offered") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Instance of a service",indexedProps="service-instance-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,service-instance-name,service-instance-location-id,orchestration-status,environment-context,workload-context",nameProps="service-instance-name",searchable="service-instance-id,service-instance-name",uniqueProps="service-instance-id",dependentOn="service-subscription",container="service-instances") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="String capturing type of service.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="String capturing the service role.") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Uniquely identifies this instance of a service") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This field will store a name assigned to the service-instance.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This field will store the environment context assigned to the service-instance.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This field will store the workload context assigned to the service-instance.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id",dbAlias="model-invariant-id-local") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id",dbAlias="model-version-id-local") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="internal",dataCopy="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Indicates the total bandwidth to be used for this service.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="indicates the upstream bandwidth this service will use on the WAN1 port of the physical device.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="indicates the downstream bandwidth this service will use on the WAN1 port of the physical device.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="indicates the upstream bandwidth this service will use on the WAN2 port of the physical device.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="indicates the downstream bandwidth this service will use on the WAN2 port of the physical device.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="URL customers will use to access the vHN Portal.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="An identifier that customers assign to the location where this service is being used.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Path to the controller object.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Orchestration status of this service.") - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of service instances") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Object that group service instances.",indexedProps="service-type",dependentOn="customer",container="service-subscriptions",crossEntityReference="service-instance,service-type") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Value defined by orchestration to identify this service across ECOMP.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This property will be deleted from A&AI in the near future. Only stop gap solution.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of objects that group service instances.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="customer identifiers to provide linkage back to BSS information.",nameProps="subscriber-name",indexedProps="subscriber-name,global-customer-id,subscriber-type",searchable="global-customer-id,subscriber-name",uniqueProps="global-customer-id",container="customers",namespace="business") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Global customer id used across ECOMP to uniquely identify customer.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Subscriber name, an alternate way to retrieve a customer.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Subscriber type, a way to provide VID with only the INFRA customers.",defaultValue="CUST") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of customer identifiers to provide linkage back to BSS information.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Namespace for business related constructs") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Image object that pertain to a VNF that doesn't have associated vservers. This is a kludge.",indexedProps="application,att-uuid,application-vendor,application-version",uniqueProps="att-uuid",container="vnf-images",namespace="service-design-and-creation") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of this asset") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The application that the image instantiates.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The vendor of the application.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The version of the application.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of image objects that pertain to a VNF that doesn't have associated vservers. This is a kludge.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Stand-in for service model definitions. Likely to be deprecated in favor of models from ASDC. Does not strictly map to ASDC services.",indexedProps="service-description,service-id",container="services",namespace="service-design-and-creation") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="This gets defined by others to provide a unique ID for the service, we accept what is sent.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Description of the service") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="service version") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of service model definitions. Likely to be deprecated in favor of models from ASDC.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Early definition of server/resource pairings, likely to be replaced by models. No new use should be made of this.",indexedProps="service-type,vnf-type",container="service-capabilities",namespace="service-design-and-creation") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="This gets defined by others to provide a unique ID for the service, we accept what is sent.") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of service capabilities.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This is how we would capture constraints defining allowed sets of elements.",uniqueProps="element-choice-set-uuid",indexedProps="element-choice-set-uuid",allowDirectRead="true",allowDirectWrite="false",container="element-choice-sets") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true") - - - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This is how we would capture constraints defining allowed sets of elements.",uniqueProps="constrained-element-set-uuid",indexedProps="constrained-element-set-uuid",allowDirectRead="true",allowDirectWrite="false",container="constrained-element-sets") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true") - - - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This is how we would capture constraints defining allowed sets of elements.",uniqueProps="model-constraint-uuid",indexedProps="model-constraint-uuid",allowDirectRead="true",allowDirectWrite="false",container="model-constraints") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true") - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Defines how other models combine to make up a higher-level model.",uniqueProps="model-element-uuid",indexedProps="model-element-uuid",allowDirectRead="true",allowDirectWrite="false",container="model-elements") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Indicates whether this element was created as part of instantiation from this model") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="How many of this type of element are required/allowed") - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Defines how other models combine to make up a higher-level model") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Describes new constraints on this model element that are not part of that model's definition") - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Subgraph definition provided by ASDC to describe a specific version of an inventory asset and its connections related to ASDC models",nameProps="model-name",indexedProps="model-version-id,model-name,model-version",uniqueProps="model-version-id",container="model-vers") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique identifier corresponding to one version of a model in ASDC") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Name of the model, which can change from version to version.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Version") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Description") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Subgraph definition provided by ASDC to describe an inventory asset and its connections related to ASDC models, independent of version",nameProps="model-type",indexedProps="model-invariant-id,model-type",uniqueProps="model-invariant-id",container="models",namespace="service-design-and-creation") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique identifier corresponding to the main definition of a model in ASDC") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Type of the model, e.g., service, resource, widget, etc.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of subgraph definitions provided by ASDC to describe the inventory assets and their connections related to ASDC models") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="TBD",uniqueProps="related-lookup-uuid",indexedProps="related-lookup-uuid",allowDirectRead="true",allowDirectWrite="false",container="related-lookups") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true") - - - - - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="TBD",uniqueProps="property-constraint-uuid",indexedProps="property-constraint-uuid",allowDirectRead="true",allowDirectWrite="false",container="property-constraints") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true") - - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="TBD",uniqueProps="named-query-element-uuid",indexedProps="named-query-element-uuid",allowDirectRead="true",allowDirectWrite="false",container="named-query-elements") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true") - - - - - - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="TBD",nameProps="named-query-name",uniqueProps="named-query-uuid",indexedProps="named-query-uuid,named-query-name",container="named-queries",namespace="service-design-and-creation") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true) - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="TBD",nameProps="named-query-name",uniqueProps="named-query-uuid",indexedProps="named-query-uuid,named-query-name",container="named-queries",namespace="service-design-and-creation") - - - - - - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Namespace for objects managed by ASDC") - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Logical links generally connect l-interfaces but are used to express logical connectivity between two points",indexedProps="link-name,model-invariant-id,model-version-id,widget-model-id,widget-model-version,link-id,prov-status,circuit-id,purpose",uniqueProps="link-id",container="logical-links",namespace="network",searchable="link-name") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="e.g., evc-name, or vnf-nameA_interface-nameA_vnf-nameZ_interface-nameZ") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Type of logical link, e.g., evc") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Captures the numeric part of the speed") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Captures the units corresponding to the speed") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="v4, v6, or ds for dual stack (should be att-ip-version)") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="For example, static or BGP") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id",dbAlias="model-invariant-id-local") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id",dbAlias="model-version-id-local") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="internal",dataCopy="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Indication of operational status of the logical link.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this VNF by BAU Service Assurance systems.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Indication of the network use of the logical link.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Alias or alternate name (CLCI or D1 name).") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="UUID of the logical-link, SDNC generates this.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Circuit id") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Reason for this entity, role it is playing") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of logical connections") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(indexedProps="cos",dependentOn="site-pair",container="classes-of-service") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="unique identifier of probe") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="identifier of probe") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="type of probe") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="class-of-service of probe") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(indexedProps="site-pair-id",uniqueProps="site-pair-id",dependentOn="routing-instance",container="site-pairs") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="unique identifier of probe") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Prefix address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Prefix address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="ip version, v4, v6") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Hostname of the destination equipment to which SLAs are measured against.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The type of destinatination equipment. Could be Router, UCPE, etc.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="probe within a set") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(indexedProps="routing-instance-id",uniqueProps="routing-instance-id",dependentOn="site-pair-set",container="routing-instances") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of routing instance") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="rpm owner") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="set of probes related to generic-vnf routing instance") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Set of instances for probes used to measure service level agreements",indexedProps="site-pair-set-id",uniqueProps="site-pair-set-id",container="site-pair-sets",namespace="network") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of site pair set.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of sets of instances for probes related to generic-vnf") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Route target information",container="route-targets",dependentOn="vpn-binding",canBeLinked="true") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Number used to identify an RT, globally unique in the network") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Role assigned to this route target") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of route target information") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="VPN binding",nameProps="vpn-name,vpn-type",indexedProps="vpn-name,vpn-id,vpn-type",searchable="vpn-id,vpn-name",uniqueProps="vpn-id",container="vpn-bindings",namespace="network") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="VPN ID, globally unique within A&AI") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="VPN Name") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the platform associated with the VPN example AVPN, Mobility") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Type of the vpn, should be taken from enumerated/valid values") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="region of customer vpn") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="id for this customer vpn") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used to distinguish the distinct VPN routes of separate customers who connect to the provider in an MPLS network.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="l3-networks relate to vpn-bindings") - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="VPLS Provider Edge routers.",indexedProps="prov-status,equipment-name",container="vpls-pes",namespace="network") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true) - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this VNF by BAU Service Assurance systems.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address).") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Client should send valid enumerated value, e.g., VPLS-PE.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Temporary location for stag to get to VCE") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of VPLS Provider Edge routers") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(indexedProps="multicast-configuration-id",uniqueProps="multicast-configuration-id",container="multicast-configurations",namespace="network") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of multicast configuration.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="protocol of multicast configuration") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="rp type of multicast configuration") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="multicast configuration of generic-vnf ip-address") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(dependentOn="port-group",indexedProps="cvlan-tag",container="cvlan-tags") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="See mis-na-virtualization-platform.yang") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used to capture the network interfaces of this VCE",nameProps="port-group-name",indexedProps="port-group-id,heat-stack-id,interface-id,interface-name,switch-name",dependentOn="vce",container="port-groups") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of the interface") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Neutron network id of this Interface") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Neutron network name of this Interface") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Role assigned to this Interface, should use values as defined in ECOMP Yang models.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Unique ID for port group in vmware") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Likely to duplicate value of neutron network name") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="DVS or standard switch name (should be non-null for port groups associated with DVS)") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE") - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Metadata for license group.",indexedProps="group-uuid,resource-uuid",dependentOn="generic-vnf,vce,vpe",container="licenses") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID for the license group the resource belongs to, should be uuid.") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of a license resource. ") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Concurrency value") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Licenses to be allocated across resources, keyed by group-uuid and resource-uuid, related to license management") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Metadata for entitlement group.",indexedProps="group-uuid,resource-uuid",dependentOn="generic-vnf,vce,vpe",container="entitlements") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID for the entitlement group the resource comes from, should be uuid.") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of an entitlement resource. ") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Concurrency value") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Entitlements, keyed by group-uuid and resource-uuid, related to license management") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Virtual Customer Edge Router, used specifically for Gamma. This object is deprecated.",nameProps="vnf-name",indexedProps="vnf-name,vnf-name2,vnf-type,heat-stack-id,vnf-id,interface-name,regional-resource-zone,vpe-id,prov-status,service-id",searchable="vnf-id,vnf-name,vnf-name2",uniqueProps="vnf-id",container="vces",namespace="network",extendsFrom="vnf") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of VNF. This is unique across the graph.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Name of VNF.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Alternate name of VNF.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Unique identifier of service, does not strictly map to ASDC services, SOON TO BE DEPRECATED.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Regional way of organizing pservers, source of truth should define values") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Indicator for whether the resource is considered operational") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="OBSOLETE - do not use") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Network role being played by this VNF") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Unique ID of VPE connected to this VCE.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Valid v6 IP address for the WAN Link on this router. Implied length of /64.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Address tail-f uses to configure vce, also used for troubleshooting and is IP used for traps generated by VCE.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Loopback0 address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="OBSOLETE - see child relationships") - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of Virtual Customer Edge Routers, used specifically for Gamma. This object is deprecated.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Relationship-list must include related to info for complex.",nameProps="vnf-name",indexedProps="vnf-name,vnf-name2,vnf-type,heat-stack-id,vnf-id,regional-resource-zone,prov-status,service-id",searchable="vnf-id,vnf-name,vnf-name2",uniqueProps="vnf-id",container="vpes",namespace="network",extendsFrom="vnf") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of VNF. This is unique across the graph.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Name of VNF.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Alternate name of VNF.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Unique identifier of service. Does not map strictly to ASDC services. SOON TO BE DEPRECATED") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Regional way of organizing pservers, source of truth should define values") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Indicator for whether the resource is considered operational") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="OBSOLETE - do not use. See child relationships.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Client should send valid enumerated value") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address).") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Prefix length for oam-address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Gateway address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Loopback0 address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Temporary location for stag to get to VCE") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="as-number of the VPE") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="details regarding the vpe operation, PLEASE DISCONTINUE USE OF THIS FIELD.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="indicates whether vpe access uses SSH") - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Virtual provider edge router. In 1504, A&AI will populate this object through an M&P and tool provided to operations.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(indexedProps="vnfc-name,prov-status,nfc-function,nfc-naming-code,ipaddress-v4-oam-vip,in-maint,is-closed-loop-disabled,group-notation,model-invariant-id,model-version-id",searchable="vnfc-name",container="vnfcs",namespace="network") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of vnfc.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Short code that is used in naming instances of the item being modeled") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="English description of function that the specific resource deployment is providing. Assigned as part of the customization of a resource in a service") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="prov status of this vnfc") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by APP-C") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Oam V4 vip address of this vnfc") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether closed loop function is enabled on this node") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Group notation of VNFC") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="virtual network components associated with a vserver from application controller.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(indexedProps="subnet-id,subnet-name",nameProps="subnet-name",uniqueProps="subnet-id",dependentOn="l3-network",container="subnets") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Subnet ID, should be UUID.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Name associated with the subnet.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Neutron id of this subnet") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="gateway ip address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="network start address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="cidr mask") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="ip version") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="dhcp enabled") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the start address reserved for use by dhcp") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the last address reserved for use by dhcp") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="role of the subnet, referenced when assigning IPs") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(indexedProps="vlan-id-inner",dependentOn="l3-network",container="ctag-assignments") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="id.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Openstack segmentation assignment.",indexedProps="segmentation-id",dependentOn="l3-network",container="segmentation-assignments") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Route Table Reference id, UUID assigned to this instance.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Concurrency value") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of openstack segmentation assignments") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Generic network definition",nameProps="network-name",indexedProps="heat-stack-id,network-uuid,service-id,network-id,network-name,model-invariant-id,model-version-id,widget-model-id,widget-model-version,contrail-network-fqdn,network-role",searchable="network-id,network-name",uniqueProps="network-id",container="l3-networks",namespace="network") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Network ID, should be uuid. Unique across A&AI.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Name of the network, governed by some naming convention..") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Type of the network - who defines these values?") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Role the network plans - who defines these values?") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Network technology - who defines these values?") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Neutron network id of this Interface") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="Set to true if bound to VPN") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Unique identifier of service from ASDC. Does not strictly map to ASDC services. SOON TO BE DEPRECATED") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="network role instance") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Contrail FQDN for the network") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id",dbAlias="model-invariant-id-local") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id",dbAlias="model-version-id-local") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="internal",dataCopy="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Name associated with the physical network.") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="boolean indicatating whether or not network is a provider network.") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="boolean indicatating whether or not network is a shared network.") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="boolean indicatating whether or not network is an external network.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Path to the controller object.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Indicator for whether the resource is considered operational.") - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Relates to tenant (or is it a child of tenant), complex, service, vpn-binding") - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(nameProps="network-policy-fqdn",indexedProps="network-policy-id,network-policy-fqdn",searchable="network-policy-id,network-policy-fqdn",uniqueProps="network-policy-id",container="network-policies",namespace="network") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="UUID representing unique key to this instance") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Contrail FQDN for the policy") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="ID for the openStack Heat instance") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="a deployment unit of VNFCs",indexedProps="vf-module-id,vf-module-name,heat-stack-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,contrail-service-instance-fqdn",searchable="vf-module-id,vf-module-name",dependentOn="generic-vnf",container="vf-modules") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of vf-module.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Name of vf-module") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Heat stack id corresponding to this instance.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="orchestration status of this vf-module, mastered by MSO") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is base vf module") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id",dbAlias="model-invariant-id-local") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id",dbAlias="model-version-id-local") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="internal",dataCopy="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the Contrail unique ID for a service-instance") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the index will track the number of modules of a given type that have been deployed in a VNF, starting with 0, and always choosing the lowest available digit") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Path to the controller object.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of vf-modules, a deployment unit of VNFCs") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="General purpose VNF",nameProps="vnf-name",indexedProps="is-closed-loop-disabled,vnf-name2,vnf-type,heat-stack-id,in-maint,vnf-name,vnf-id,regional-resource-zone,prov-status,service-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,nf-type,nf-function,nf-naming-code,nf-role",searchable="vnf-id,vnf-name,vnf-name2",uniqueProps="vnf-id",container="generic-vnfs",namespace="network",extendsFrom="vnf",containsSuggestibleProps="true",suggestionAliases="VNFs") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of VNF. This is unique across the graph.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Name of VNF.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Alternate name of VNF.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Unique identifier of service, does not necessarily map to ASDC service models. SOON TO BE DEPRECATED") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Regional way of organizing pservers, source of truth should define values") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.",suggestibleOnSearch="true") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Indicator for whether the resource is considered operational. Valid values are in-service-path and out-of-service-path.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="OBSOLETE - do not use") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Client should send valid enumerated value") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Orchestration status of this VNF, used by MSO.",suggestibleOnSearch="true") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="identifier of managed by ATT or customer") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Address tail-f uses to configure generic-vnf, also used for troubleshooting and is IP used for traps generated by generic-vnf.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="v4 Loopback0 address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="v6 Loopback address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="v6 management address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="number of vcpus ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only by uCPE") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="units associated with vcpu, used for VNFs with no vservers/flavors, to be used only by uCPE") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="number of GB of memory ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only by uCPE") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="units associated with vmemory, used for VNFs with no vservers/flavors, to be used only by uCPE") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="number of vdisks ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only uCPE") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="units associated with vdisk, used for VNFs with no vservers/flavors, to be used only by uCPE") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether closed loop function is enabled on this node") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="details regarding the generic-vnf operation, PLEASE DISCONTINUE USE OF THIS FIELD.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="indicates whether generic-vnf access uses SSH") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="UUID of the Entitlement group used for licensing VNFs, OBSOLETE - See child relationships.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="UUID of the specific entitlement resource. OBSOLETE - See child relationships.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="UUID of the license assignment group. OBSOLETE - See child relationships.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="UUID of the actual license resource. OBSOLETE - See child relationships.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id",dbAlias="model-invariant-id-local") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id",dbAlias="model-version-id-local") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="internal",dataCopy="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="as-number of the VNF") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="represents sub zone of the rr plane") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Generic description of the type of NF",suggestibleOnSearch="true") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="English description of Network function that the specific VNF deployment is providing") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="role in the network that this model will be providing") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="string assigned to this model used for naming purposes") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Path to the controller object.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Gateway address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Prefix length for oam-address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Temporary location for S-TAG to get to VCE") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Network Management profile of this VNF") - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of VNFs") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="LAG links can connect lag-interfaces",indexedProps="link-name",container="lag-links",namespace="network") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Alphabetical concatenation of lag-interface names") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of link aggregation connections") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This object fills in the gaps from vce that were incorporated into generic-vnf. This object will be retired with vce.",nameProps="vnf-name",indexedProps="vnf-name,vnf-name2,vnf-type,heat-stack-id,prov-status,vnf-id2",searchable="vnf-id2,vnf-name,vnf-name2",uniqueProps="vnf-id2",container="newvces",namespace="network") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of VNF, can't use same attribute name right now until we promote this new object") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Name of VNF.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Alternate name of VNF.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this VNF by BAU Service Assurance systems.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Indicator for whether the resource is considered operational") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="OBSOLETE - do not use") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address).") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Client should send valid enumerated value, e.g., VPE.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="v4 Loopback0 address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="This object fills in the gaps from vce that were incorporated into generic-vnf. This object will be retired with vce.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="PNF represents a physical network function. typically equipment used in the D1 world. in 1607, this will be populated by SDN-C to represent a premises router that a uCPE connects to. But this can be used to represent any physical device that is not an AIC node or uCPE.",indexedProps="pnf-name,orchestration-status,inv-status",searchable="pnf-name",uniqueProps="pnf-name",container="pnfs",namespace="network") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="unique name of Physical Network Function.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="name of Physical Network Function.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="source of name2") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="id of pnf") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Equipment type. Source of truth should define valid values.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Equipment vendor. Source of truth should define valid values.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Equipment model. Source of truth should define valid values.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="identifier of managed by ATT or customer") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="ipv4-oam-address with new naming convention for IP addresses") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="sw-version is the version of SW for the hosted application on the PNF.") - - - - - - - @org.openecomp.aai.annotations.Metadata(defaultValue="false",description="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="ID of the physical frame (relay rack) where pnf is installed.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Serial number of the device") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="IPV4 Loopback 0 address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="IPV6 Loopback 0 address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="IPV4 AIM address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="IPV6 AIM address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="IPV6 OAM address") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="CANOPI's inventory status. Only set with values exactly as defined by CANOPI.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Prov Status of this device (not under canopi control) Valid values [PREPROV/NVTPROV/PROV]") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Nf Role is the role performed by this instance in the network.") - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of Physical Network Functions.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of physical connections, typically between p-interfaces",indexedProps="circuit-id,link-name",alternateKeys1="circuit-id",container="physical-links",namespace="network",searchable="link-name,circuit-id") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="e.g., hostnameA_p-connection_nameA_hostnameZ+p_connection-nameZ") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Captures the numeric part of the speed") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Captures the units corresponding to the speed") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Circuit it") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Dual access mode (e.g., primary, secondary") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="To provide information on who manages this circuit. A&AI or 3rd party transport provider") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Name of the service Provider on this link.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of physical connections, typically between p-interfaces") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="vig-server contains information about a vig server used for IPSec-configuration. Populated by SDN-C from 1607",indexedProps="vig-address-type",dependentOn="ipsec-configuration",container="vig-servers") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="indicates whether the VIG is for AVPN or INTERNET") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="v4 IP of the vig server") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="v6 IP of the vig server") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="IPSec configuration node will contain various configuration data for the NMTE VNF. This node will have an edge to the generic-vnf (vnf type = TE). Starting 1607, this data will be populated by SDN-C",indexedProps="ipsec-configuration-id",uniqueProps="ipsec-configuration-id",container="ipsec-configurations",namespace="network") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="UUID of this configuration") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Indicate the type of VIG server like AVPN, INTERNET, BOTH") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Encryption values like 3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="ATT can offer a shared DMZ or a DMZ specific to a customer") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Network address of shared DMZ") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="If the DMZ is a custom DMZ, this field will indicate the customer information") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="can be 1 or 2") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Contains values like md5, sha1, sha256, sha384") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Encyption values like 3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Diffie-Hellman group like DH-GROUP2, DH-GROUP5, DH-GROUP14") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Group name defined in VIG for clients using aggressive mode") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="pre-shared key for the above group name ") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Lifetime for IKEv1 SA") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="md5, sha1, sha256, sha384") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Life time for IPSec SA") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="enable PFS or not") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="user ID for xAuth, sm-user,ucpeHostName,nmteHostName") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Encrypted using the Juniper $9$ algorithm") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="The time between DPD probe") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Maximum number of DPD before claiming the tunnel is down") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Openstack route table reference.",nameProps="route-table-reference-fqdn",uniqueProps="route-table-reference-id",indexedProps="route-table-reference-id,route-table-reference-fqdn",container="route-table-references",namespace="network") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Route Table Reference id, UUID assigned to this instance.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="FQDN entry in the route table.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Concurrency value") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of openstack route table references") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="General mechanism for grouping instances",nameProps="description",uniqueProps="id",searchable="id,description",indexedProps="id,description,type,sub-type",container="instance-groups",namespace="network") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="role of the instance group.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="ASDC model id for this resource or service model.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="ASDC model version uid for this resource model.") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Instance Group ID, UUID assigned to this instance.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Descriptive text to help identify the usage of this instance-group") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Only valid value today is lower case ha for high availability") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Valid values for ha type are [geo-activeactive, geo-activestandby, local-activeactive, local-activestandby]") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Concurrency value") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of openstack route table references") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="A zone is a grouping of assets in a location homing to the same connections into the CBB",nameProps="zone-name",indexedProps="zone-id,design-type,zone-context",uniqueProps="zone-id",container="zones",namespace="network") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Code assigned by AIC to the zone") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="English name associated with the zone") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Design of zone [Medium/Large…]") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Context of zone [production/test]") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Status of a zone.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Concurrency value") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Collection of zones") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Namespace for network inventory resources.") - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Internal map to define some reserved properties of a vertex",uniqueProps="aai-unique-key",indexedProps="aai-unique-key,source-of-truth,aai-node-type,aai-uri") - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Internal map to define the properties of an edge and interpret the map EdgeRules",edgeInfo="edgeLabel,direction,multiplicityRule,isParent,usesResource,hasDelTarget,SVC-INFRA,SVC-INFRA-REV") - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Allows for legacy POST of old-style and new-style models") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique identifier corresponding to the main definition of a model in ASDC") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique identifier corresponding to one version of a model in ASDC") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Type of the model, e.g., service, resource, widget, etc.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Name of the model, which can change from version to version.") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Invariant unique ID which does not change from version to version") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Version") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Description") - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="QueryParameters for performing a named-query or model query") - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="InstanceFilters for performing a named-query or model query") - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="SecondaryFilts for performing a named-query or model query") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="ModelAndNamedQuerySearch holds query-parameters and instance-properties for performing a named-query or model query") - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Property holder for query properties or instance properties") - - - - - - - - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Extra properties for inventory item for response list") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Inventory item for response list",container="inventory-response-items") - - - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Container for inventory items in response list",container="response-list") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Response container for the results of a named-query or model query") - - - - - - - - - - - - @org.openecomp.aai.annotations.Metadata(description="Abstract vnf class",indexedProps="vnf-id",uniqueProps="vnf-id",inheritors="vce,vpe,generic-vnf",isAbstract="true") - - - - - - - @org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of VNF. This is unique across the graph.") - - - - - - - diff --git a/bpmn/MSOCommonBPMN/src/main/resources/xsd/test.xsd b/bpmn/MSOCommonBPMN/src/main/resources/xsd/test.xsd deleted file mode 100644 index 456ae1e9a7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/xsd/test.xsd +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AaiUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AaiUtilTest.groovy new file mode 100644 index 0000000000..79caf5b9ac --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AaiUtilTest.groovy @@ -0,0 +1,471 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +import static org.junit.Assert.*; +import static org.mockito.Mockito.* + +import org.onap.so.rest.HttpHeader +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.junit.Before +import org.onap.so.bpmn.common.scripts.AaiUtil; +import org.junit.Rule; +import org.junit.Test +import org.junit.rules.ExpectedException +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.Before; +import org.junit.Test; +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class AaiUtilTest extends MsoGroovyTest { + + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + @Rule + public ExpectedException thrown = ExpectedException.none + + + def aaiPaylod = "\n" + + "\t\t\t\tallottedResourceId\n" + + "\t\t\t\t\n" + + "\t\t\t\tallottedResourceType\n" + + "\t\t\t\tallottedResourceRole\n" + + "\t\t\t\t\n" + + "\t\t\t\t\n" + + "\t\t\t\t\n" + + "\t\t\t\t\n" + + "\t\t\t\tPendingCreate\n" + + "\t\t\t\t\n" + + "\t\t\t\t\n" + + "\t\t\t\t\t\n" + + " \t\t\tservice-instance\n" + + " \t\t\tCSI_resourceLink\n" + + "\t\t\t\t\t\n" + + "\t\t\t\t\n" + + "\t\t\t"; + + @Test + public void testGetVersionDefault() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') + assertEquals('8', version) + } + + @Test + public void testGetVersionResourceSpecific() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.default.aai.l3-network.version")).thenReturn('7') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') + assertEquals('7', version) + } + + @Test + public void testGetVersionFlowSpecific() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.custom.CreateAAIVfModule.aai.version")).thenReturn('6') + when(mockExecution.getVariable("mso.workflow.default.aai.l3-network.version")).thenReturn('7') + + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') + assertEquals('6', version) + } + + @Test + public void testGetVersionNotDefined() { + thrown.expect(Exception.class) + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("") + + def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') + + } + + @Test + public void testGetUriDefaultVersion() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.l3-network.uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getUri(mockExecution, 'l3-network') + assertEquals('/aai/v8/network/l3-networks/l3-network', uri) + } + + @Test + public void testGetUriFlowAndResourceSpecific() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.CreateAAIVfModule.aai.l3-network.uri")).thenReturn('/aai/v6/network/l3-networks/l3-network') + + when(mockExecution.getVariable("mso.workflow.default.aai.v8.l3-network.uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getUri(mockExecution, 'l3-network') + assertEquals('/aai/v6/network/l3-networks/l3-network', uri) + } + + @Test + public void testGetNetworkGenericVnfEndpoint() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') + + when(mockExecution.getVariable('aai.endpoint')).thenReturn('http://localhost:28090') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn('8') + + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def endpoint = aaiUtil.getNetworkGenericVnfEndpoint(mockExecution) + assertEquals('http://localhost:28090/aai/v8/network/generic-vnfs/generic-vnf', endpoint) + } + + @Test + public void testGetNetworkGenericVnfUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') + + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn('8') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkGenericVnfUri(mockExecution) + assertEquals('/aai/v8/network/generic-vnfs/generic-vnf', uri) + } + + @Test + public void testGetNetworkVpnBindingUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.vpn-binding.uri")).thenReturn('/aai/v8/network/vpn-bindings/vpn-binding') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkVpnBindingUri(mockExecution) + assertEquals('/aai/v8/network/vpn-bindings/vpn-binding', uri) + } + + @Test + public void testGetNetworkPolicyUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.network-policy.uri")).thenReturn('/aai/v8/network/network-policies/network-policy') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkPolicyUri(mockExecution) + assertEquals('/aai/v8/network/network-policies/network-policy', uri) + } + + @Test + public void testGetNetworkTableReferencesUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.route-table-reference.uri")).thenReturn('/aai/v8/network/route-table-references/route-table-reference') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkTableReferencesUri(mockExecution) + assertEquals('/aai/v8/network/route-table-references/route-table-reference', uri) + } + + @Test + public void testGetNetworkVceUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.vce.uri")).thenReturn('/aai/v8/network/vces/vce') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkVceUri(mockExecution) + assertEquals('/aai/v8/network/vces/vce', uri) + } + + @Test + public void testGetNetworkL3NetworkUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.l3-network.uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) + assertEquals('/aai/v8/network/l3-networks/l3-network', uri) + } + + @Test + public void testGetBusinessCustomerUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.customer.uri")).thenReturn('/aai/v8/business/customers/customer') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getBusinessCustomerUri(mockExecution) + assertEquals('/aai/v8/business/customers/customer', uri) + } + + @Test + public void testGetCloudInfrastructureCloudRegionEndpoint() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic') + + when(mockExecution.getVariable('aai.endpoint')).thenReturn('http://localhost:28090') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(mockExecution) + assertEquals('http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri) + } + + @Test + public void testGetCloudInfrastructureCloudRegionUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic') + + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getCloudInfrastructureCloudRegionUri(mockExecution) + assertEquals('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri) + } + + @Test + public void testGetCloudInfrastructureTenantUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.tenant.uri")).thenReturn('/aai/v8/cloud-infrastructure/tenants/tenant') + + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getCloudInfrastructureTenantUri(mockExecution) + assertEquals('/aai/v8/cloud-infrastructure/tenants/tenant', uri) + } + + @Test + public void testGetSearchNodesQueryUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') + + when(mockExecution.getVariable('aai.endpoint')).thenReturn('http://localhost:28090') + + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getSearchNodesQueryUri(mockExecution) + assertEquals('/aai/v8/search/nodes-query', uri) + } + + @Test + public void testGetSearchNodesQueryEndpoint() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') + + when(mockExecution.getVariable('aai.endpoint')).thenReturn('http://localhost:28090') + + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getSearchNodesQueryEndpoint(mockExecution) + assertEquals('http://localhost:28090/aai/v8/search/nodes-query', uri) + } + + @Test + public void testGetSearchGenericQueryUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-query.uri")).thenReturn('/aai/v8/search/generic-query') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getSearchGenericQueryUri(mockExecution) + assertEquals('/aai/v8/search/generic-query', uri) + } + + @Test + public void testGetNamespaceFromUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('6') + when(mockExecution.getVariable("mso.workflow.default.aai.v6.l3-network.uri")).thenReturn('/aai/v6/network/l3-networks/l3-network') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) // Required to populate the namespace in the class + def ns = aaiUtil.getNamespaceFromUri('/aai/v6/search/generic-query') + assertEquals('http://org.openecomp.aai.inventory/v6', ns) + } + + @Test + public void testExecuteAAIGetCall() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("aai.auth")).thenReturn("9B2278E8B8E95F256A560719055F4DF3") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("aa3871669d893c7fb8abbcda31b88b4f") + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.executeAAIGetCall(mockExecution,"http://localhost:8090/aai/v9/business/customers/customer/CUST/service-subscriptions/service-subscription/SVC/service-instances/service-instance/NST/allotted-resources/allotted-resource/allottedResourceId") + } + + + @Test + public void testExecuteAAIPutCall() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("aai.auth")).thenReturn("9B2278E8B8E95F256A560719055F4DF3") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("aa3871669d893c7fb8abbcda31b88b4f") + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.executeAAIPutCall(mockExecution,"http://localhost:8090/aai/v9/business/customers/customer/CUST/service-subscriptions/service-subscription/SVC/service-instances/service-instance/NST/allotted-resources/allotted-resource/allottedResourceId",aaiPaylod) + } + + @Test + public void testGetNamespaceFromUri2() { + ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') + // + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('10') + when(mockExecution.getVariable("mso.workflow.default.aai.v10.l3-network.uri")).thenReturn('/aai/v10/network/l3-networks/l3-network') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + // + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) // Required to populate the namespace in the class + def ns = aaiUtil.getNamespaceFromUri('/aai/v10/search/generic-query') + assertEquals('http://org.openecomp.aai.inventory/v10', ns) + } + + @Test + public void testGetNamespaceFromUri3() { + ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') + // + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('100') + when(mockExecution.getVariable("mso.workflow.default.aai.v100.l3-network.uri")).thenReturn('/aai/v100/network/l3-networks/l3-network') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + // + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) // Required to populate the namespace in the class + def ns = aaiUtil.getNamespaceFromUri('/aai/v100/search/generic-query') + assertEquals('http://org.openecomp.aai.inventory/v100', ns) + } + + @Test + public void testGetNamespaceFromUri_twoArguments() { // (execution, uri) + ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') + // + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('10') + when(mockExecution.getVariable("mso.workflow.default.aai.v10.l3-network.uri")).thenReturn('/aai/v10/network/l3-networks/l3-network') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + // + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def ns = aaiUtil.getNamespaceFromUri(mockExecution, '/aai/v10/search/generic-query') + assertEquals('http://org.openecomp.aai.inventory/v10', ns) + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessorTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessorTest.groovy new file mode 100644 index 0000000000..86a175d811 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessorTest.groovy @@ -0,0 +1,182 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Assert +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.onap.so.bpmn.core.WorkflowException; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.* + +import org.onap.so.rest.HttpHeader +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.junit.Before +import org.onap.so.bpmn.common.scripts.AaiUtil; +import org.junit.Rule; +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.Before; +import org.junit.Test; +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition + + + +class AbstractServiceTaskProcessorImpl extends AbstractServiceTaskProcessor{ + + @Override + void preProcessRequest(DelegateExecution execution) { + + } +} + +@RunWith(MockitoJUnitRunner.class) +public class AbstractServiceTaskProcessorTest extends MsoGroovyTest { + + @Captor + ArgumentCaptor captor= ArgumentCaptor.forClass(ExecutionEntity.class); + + @Test + public void testCreateCallbackURL_Success() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("mso.workflow.message.endpoint")).thenReturn('http://localhost:18080/mso/WorkflowMessage/') + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + def endpoint = serviceTaskProcessor.createCallbackURL(mockExecution, 'testMessageType', 'testCorrelator') + assertEquals('http://localhost:18080/mso/WorkflowMessage/testMessageType/testCorrelator', endpoint) + } + + @Test + public void testCreateCallbackURL_NullEndpoint() { + + ExecutionEntity mockExecution = setupMock() + try { + + when(mockExecution.getVariable("mso.workflow.message.endpoint")).thenReturn("") + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + def endpoint = serviceTaskProcessor.createCallbackURL(mockExecution, 'testMessageType', 'testCorrelator') + } + catch(Exception ex){ + } + Mockito.verify(mockExecution,times(1)).setVariable(captor.capture(),captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals("mso:workflow:message:endpoint URN mapping is not set",workflowException.getErrorMessage()) + Assert.assertEquals(2000,workflowException.getErrorCode()) + } + + @Test + public void testCreateWorkflowMessageAdapterCallbackURL_Success() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("mso.adapters.workflow.message.endpoint")).thenReturn('http://localhost:18080/workflows/messages/message/') + + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + def endpoint = serviceTaskProcessor.createWorkflowMessageAdapterCallbackURL(mockExecution, 'testMessageType', 'testCorrelator') + assertEquals('http://localhost:18080/workflows/messages/message/testMessageType/testCorrelator', endpoint) + } + + @Test + public void testCreateWorkflowMessageAdapterCallbackURL_NullEndpoint() { + + ExecutionEntity mockExecution = setupMock() + try { + + when(mockExecution.getVariable("mso.adapters.workflow.message.endpoint")).thenReturn("") + + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + def endpoint = serviceTaskProcessor.createWorkflowMessageAdapterCallbackURL(mockExecution, 'testMessageType', 'testCorrelator') + } + catch(Exception ex){ + } + Mockito.verify(mockExecution,times(1)).setVariable(captor.capture(),captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals("mso:adapters:workflow:message:endpoint URN mapping is not set",workflowException.getErrorMessage()) + Assert.assertEquals(2000,workflowException.getErrorCode()) + } + + @Test + public void testSetRollbackEnabledNullOrEmptyDisableRollback() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn('TEST_PREFIX') + when(mockExecution.getVariable("disableRollback")).thenReturn(null) + when(mockExecution.getVariable("mso.rollback")).thenReturn("") + + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + serviceTaskProcessor.setRollbackEnabled(mockExecution, "true") + assertEquals(null, mockExecution.getVariable('TEST_PREFIXbackoutOnFailure')) + } + + @Test + public void testSetRollbackEnabledDisableRollback() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn('TEST_PREFIX') + when(mockExecution.getVariable("disableRollback")).thenReturn(true) + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + serviceTaskProcessor.setRollbackEnabled(mockExecution, "true") + verify(mockExecution).setVariable("TEST_PREFIXbackoutOnFailure",false) + } + + @Test + public void testSetRollbackEnabledRollback() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn('TEST_PREFIX') + when(mockExecution.getVariable("disableRollback")).thenReturn(false) + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + serviceTaskProcessor.setRollbackEnabled(mockExecution, "true") + verify(mockExecution).setVariable("TEST_PREFIXbackoutOnFailure",true) + } + + @Test + public void testSetRollbackEnabledDefaultRollback() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn('TEST_PREFIX') + when(mockExecution.getVariable("disableRollback")).thenReturn("test") + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + serviceTaskProcessor.setRollbackEnabled(mockExecution, "true") + verify(mockExecution).setVariable("TEST_PREFIXbackoutOnFailure",true) + } + + @Test + public void testSetBasicDBAuthHeader_Success() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn('9B2278E8B8E95F256A560719055F4DF3') + when(mockExecution.getVariable("mso.msoKey")).thenReturn('aa3871669d893c7fb8abbcda31b88b4f') + + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + serviceTaskProcessor.setBasicDBAuthHeader(mockExecution, "true") + verify(mockExecution).setVariable("BasicAuthHeaderValueDB",'Basic dXAyMTE4OnVwMjExOA==') + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy new file mode 100644 index 0000000000..39064caa28 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.Mockito +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.mock.FileUtil + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse +import static com.github.tomakehurst.wiremock.client.WireMock.get +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when + +@RunWith(MockitoJUnitRunner.class) +class CatalogDbUtilsTest { + + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090) + + @Test + public void testGetResponseFromCatalogDb() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("mso.catalog.db.endpoint")).thenReturn('http://localhost:8090') + when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn('757A94191D685FD2092AC1490730A4FC') + when(mockExecution.getVariable("mso.msoKey")).thenReturn('07a7159d3bf51a0e53be7a8f89699be7') + + stubFor(get(urlMatching(".*/serviceNetworks[?]serviceModelUuid=12345")) + .willReturn(aResponse() + .withStatus(200) + .withBodyFile("catalogDbFiles/DoCreateServiceInstance_request.json"))) + + CatalogDbUtils obj = new CatalogDbUtils() + String str = obj.getResponseFromCatalogDb(mockExecution, "/serviceNetworks?serviceModelUuid=12345") + String expectedValue = + FileUtil.readResourceFile("__files/catalogDbFiles/DoCreateServiceInstance_request.json"); + Assert.assertEquals(expectedValue, str) + + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("GenericGetService") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("GenericGetService") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("GenericGetService") + when(mockExecution.getProcessInstanceId()).thenReturn("GenericGetService") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy new file mode 100644 index 0000000000..9aa8425a50 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy @@ -0,0 +1,170 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException + +import static org.assertj.core.api.Assertions.assertThat +import static org.assertj.core.api.Assertions.assertThatThrownBy +import static org.mockito.Matchers.eq +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +class CompleteMsoProcessTest { + @Before + public void init() { + MockitoAnnotations.initMocks(this) + } + + private String completeMsoProcessRequest = """ + + + uCPE1020_STUW105_5002 + Layer3ServiceActivateRequest + COMPLETE + OMX + http://localhost:28090/CCD/StatusNotification + 10205000 + 1 + + UCPELayer3ServiceActivateV1 + + """ + + @Test + public void testPreProcessRequest() { + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("CompleteMsoProcessRequest")).thenReturn(completeMsoProcessRequest) + when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); + + CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() + completeMsoProcess.preProcessRequest(mockExecution) + + /* Initialize all the process request variables in this block */ + verify(mockExecution).setVariable("prefix","CMSO_") + //verify(mockExecution).setVariable("getLayer3ServiceDetailsV1Response","") + verify(mockExecution).setVariable("CMSO_request_id","") + verify(mockExecution).setVariable("CMSO_notification-url","") + verify(mockExecution).setVariable("CMSO_mso-bpel-name","") + verify(mockExecution).setVariable("CMSO_request_action","") + + verify(mockExecution).setVariable("CMSO_notification-url-Ok", false) + verify(mockExecution).setVariable("CMSO_request_id-Ok", false) + + //updateRequest Adapter process variables + verify(mockExecution).setVariable("CMSO_updateRequestResponse", "") + verify(mockExecution).setVariable("CMSO_updateRequestResponseCode", "") + verify(mockExecution).setVariable("CMSO_updateFinalNotifyAckStatusFailedPayload", "") + + //Set DB adapter variables here + verify(mockExecution).setVariable("CMSO_updateDBStatusToSuccessPayload", "") + verify(mockExecution).setVariable("CMSO_updateInfraRequestDBPayload", "") + verify(mockExecution).setVariable("CMSO_setUpdateDBstatustoSuccessPayload", "") + + //Auth variables + verify(mockExecution).setVariable("BasicAuthHeaderValue","") + + //Response variables + verify(mockExecution).setVariable("CompletionHandlerResponse","") + verify(mockExecution).setVariable("CMSO_ErrorResponse", null) + verify(mockExecution).setVariable("CMSO_ResponseCode", "") + + verify(mockExecution).setVariable("CMSO_notification-url-Ok",true) + verify(mockExecution).setVariable("CMSO_request_id-Ok",true) + verify(mockExecution).setVariable("CMSO_notification-url","http://localhost:28090/CCD/StatusNotification") + verify(mockExecution).setVariable("CMSO_request_id","uCPE1020_STUW105_5002") + verify(mockExecution).setVariable("CMSO_request_action","Layer3ServiceActivateRequest") + verify(mockExecution).setVariable("CMSO_source","OMX") + + } + + private String setUpdateDBstatustoSuccessPayload = """ + + + + + testReqId + BPEL + Resource Completed Successfully + COMPLETE + 100 + + + + """ + + @Test + public void testsetUpdateDBstatustoSuccessPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("CMSO_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("CMSO_mso-bpel-name")).thenReturn("BPEL") + when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); + + CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() + completeMsoProcess.setUpdateDBstatustoSuccessPayload(mockExecution) + + verify(mockExecution).setVariable("CMSO_setUpdateDBstatustoSuccessPayload",setUpdateDBstatustoSuccessPayload) + } + + private String msoCompletionResponse = """onse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + BPEL BPEL-NAME FAILED +""" + +/* + private String msoCompletionResponse = """ + BPEL BPEL-NAME FAILED +""" +*/ + @Test + void testBuildDataError() { + // given + def message = "Some-Message" + + def mockExecution = mock ExecutionEntity.class + when mockExecution.getVariable("CMSO_mso-bpel-name") thenReturn "BPEL-NAME" + when mockExecution.getVariable("testProcessKey") thenReturn "CompleteMsoProcess" + + def completeMsoProcess = new CompleteMsoProcess() + // when + assertThatThrownBy { completeMsoProcess.buildDataError(mockExecution, message) } isInstanceOf BpmnError + // then + verify mockExecution setVariable("CompleteMsoProcessResponse", msoCompletionResponse) + def argumentCaptor = ArgumentCaptor.forClass WorkflowException.class + verify mockExecution setVariable(eq("WorkflowException"), argumentCaptor.capture()) + def capturedException = argumentCaptor.value + + assertThat capturedException.processKey isEqualTo "CompleteMsoProcess" + assertThat capturedException.errorCode isEqualTo 500 + assertThat capturedException.errorMessage isEqualTo message + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy new file mode 100644 index 0000000000..9b3b8c2fb0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy @@ -0,0 +1,130 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +import static org.junit.Assert.*; +import static org.mockito.Mockito.* + +import org.onap.so.rest.HttpHeader +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.junit.Before +import org.onap.so.bpmn.common.scripts.AaiUtil; +import org.junit.Rule; +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.Before; +import org.junit.Test; +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupName +import org.onap.so.bpmn.core.WorkflowException + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class ConfirmVolumeGroupNameTest extends MsoGroovyTest { + + @Captor + ArgumentCaptor captor= ArgumentCaptor.forClass(ExecutionEntity.class); + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + @Test + public void testQueryAAIForVolumeGroupId() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("aai.endpoint")).thenReturn('http://localhost:8090') + when(mockExecution.getVariable("CVGN_volumeGroupGetEndpoint")).thenReturn('/aai/test/volume-groups/volume-group/testVolumeGroup') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + + mockData() + + ConfirmVolumeGroupName confirmVolumeGroupName = new ConfirmVolumeGroupName() + confirmVolumeGroupName.queryAAIForVolumeGroupId(mockExecution) + verify(mockExecution).setVariable("CVGN_queryVolumeGroupResponseCode",200) + verify(mockExecution).setVariable("CVGN_queryVolumeGroupResponse","") + } + + @Test + public void testQueryAAIForVolumeGroupId_404() { + + ExecutionEntity mockExecution = setupMock() + try { + when(mockExecution.getVariable("CVGN_volumeGroupGetEndpoint")).thenReturn('/aai/test/volume-groups/volume-group/testVolumeGroup') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + + mockData() + + ConfirmVolumeGroupName confirmVolumeGroupName = new ConfirmVolumeGroupName() + confirmVolumeGroupName.queryAAIForVolumeGroupId(mockExecution) + } + catch(Exception ex){ + + } + Mockito.verify(mockExecution,times(4)).setVariable(captor.capture(),captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals("AAI GET Failed",workflowException.getErrorMessage()) + Assert.assertEquals(500,workflowException.getErrorCode()) + } + private void mockData() { + stubFor(get(urlMatching("/aai/test/volume-groups/volume-group/testVolumeGroup")) + .willReturn(aResponse() + .withStatus(200))) + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("ConfirmVolumeGroupName") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("ConfirmVolumeGroupName") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("ConfirmVolumeGroupName") + when(mockExecution.getProcessInstanceId()).thenReturn("ConfirmVolumeGroupName") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy new file mode 100644 index 0000000000..1b76f5cb3f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy @@ -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.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +import static org.junit.Assert.*; +import static org.mockito.Mockito.* + +import org.onap.so.rest.HttpHeader +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.junit.Before +import org.onap.so.bpmn.common.scripts.AaiUtil; +import org.junit.Rule; +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.Before; +import org.junit.Test; +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupTenant +import org.onap.so.bpmn.core.WorkflowException + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class ConfirmVolumeGroupTenantTest extends MsoGroovyTest { + + @Captor + ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class); + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + @Test + public void testpreProcessRequest() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("aai.endpoint")).thenReturn('http://localhost:8090') + when(mockExecution.getVariable("volumeGroupId")).thenReturn('testVolumeGroupId') + when(mockExecution.getVariable("volumeGroupName")).thenReturn('testVolumeGroupName') + when(mockExecution.getVariable("tenantId")).thenReturn('tenantId') + when(mockExecution.getVariable("aicCloudRegion")).thenReturn('aicCloudRegion') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + + mockData() + + + ConfirmVolumeGroupTenant confirmVolumeGroupTenant = new ConfirmVolumeGroupTenant() + confirmVolumeGroupTenant.preProcessRequest(mockExecution) + /* Mockito.verify(mockExecution, times(5)).setVariable(captor.capture(), captor.capture())*/ + verify(mockExecution).setVariable("prefix", "CVGT_") + verify(mockExecution).setVariable("queryVolumeGroupResponseCode", 200) + verify(mockExecution).setVariable("queryAAIVolumeGroupResponse", "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122cMSOTESTVOL103a-vSAMP12_base_module-0_vol9d1f53e3-3158-44f8-8032-a6bf40bbc9dbpcrf-capacityActive0000020tenantcloud-region.cloud-owneratt-aiccloud-region.cloud-region-idRegionOnetenant.tenant-id22eb191dd41a4f3c9be370fc638322f4") + verify(mockExecution).setVariable("tenantIdsMatch", false) + verify(mockExecution).setVariable("groupNamesMatch", false) + } + + + private void mockData() { + stubFor(get(urlMatching("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/aicCloudRegion/volume-groups/volume-group/testVolumeGroupId")) + .willReturn(aResponse() + .withStatus(200) + .withBody("17ef4658-bd1f-4ef0-9ca0-ea76e2bf122cMSOTESTVOL103a-vSAMP12_base_module-0_vol9d1f53e3-3158-44f8-8032-a6bf40bbc9dbpcrf-capacityActive0000020tenantcloud-region.cloud-owneratt-aiccloud-region.cloud-region-idRegionOnetenant.tenant-id22eb191dd41a4f3c9be370fc638322f4"))) + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("ConfirmVolumeGroupTenant") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("ConfirmVolumeGroupTenant") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("ConfirmVolumeGroupTenant") + when(mockExecution.getProcessInstanceId()).thenReturn("ConfirmVolumeGroupTenant") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetServiceTest.groovy new file mode 100644 index 0000000000..a8c10b1e81 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetServiceTest.groovy @@ -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.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.runners.MockitoJUnitRunner + +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance +import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById +import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName + +/** + * @author sushilma + * @since January 10, 2018 + */ +@RunWith(MockitoJUnitRunner.class) +@Ignore +class CustomE2EGetServiceTest extends MsoGroovyTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + public void testObtainServiceInstanceUrlById (){ + ExecutionEntity mockExecution = setupMockWithPrefix('CustomE2EGetService','GENGS_') + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') + when(mockExecution.getVariable("GENGS_type")).thenReturn('service-instance') + when(mockExecution.getVariable("GENGS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") + MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); + CustomE2EGetService customE2EGetService = new CustomE2EGetService(); + customE2EGetService.obtainServiceInstanceUrlById(mockExecution) + Mockito.verify(mockExecution, times(9)).setVariable(captor.capture(), captor.capture()) + Assert.assertEquals(200, captor.getAllValues().get(5)) + } + + @Test + public void testObtainServiceInstanceUrlByName (){ + ExecutionEntity mockExecution = setupMockWithPrefix('CustomE2EGetService','GENGS_') + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') + when(mockExecution.getVariable("GENGS_type")).thenReturn('service-instance') + when(mockExecution.getVariable("GENGS_serviceInstanceName")).thenReturn("1604-MVM-26") + MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByName.xml"); + CustomE2EGetService customE2EGetService = new CustomE2EGetService(); + customE2EGetService.obtainServiceInstanceUrlByName(mockExecution) + Mockito.verify(mockExecution, times(8)).setVariable(captor.capture(), captor.capture()) + Assert.assertEquals(200, captor.getAllValues().get(5)) + } + + @Test + public void testServiceObject (){ + ExecutionEntity mockExecution = setupMockWithPrefix('CustomE2EGetService','GENGS_') + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') + when(mockExecution.getVariable("GENGS_type")).thenReturn('service-instance') + when(mockExecution.getVariable("GENGS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") + when(mockExecution.getVariable("GENGS_resourceLink")).thenReturn("/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/1234453") + MockGetServiceInstance("MSO_1610_dev", "MSO-dev-service-type", "1234453", "GenericFlows/getServiceInstance.xml"); + CustomE2EGetService customE2EGetService = new CustomE2EGetService(); + customE2EGetService.getServiceObject(mockExecution) + Mockito.verify(mockExecution, times(7)).setVariable(captor.capture(), captor.capture()) + Assert.assertEquals(200, captor.getAllValues().get(5)) + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutServiceTest.groovy new file mode 100644 index 0000000000..879ef7ab4f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutServiceTest.groovy @@ -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.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.runners.MockitoJUnitRunner + +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutServiceInstance + +/** + * @author sushilma + * @since January 10, 2018 + */ +@RunWith(MockitoJUnitRunner.class) +@Ignore +class CustomE2EPutServiceTest extends MsoGroovyTest { + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + public void testPutServiceInstance(){ + ExecutionEntity mockExecution = setupMockWithPrefix('CustomE2EPutService','GENPS_') + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.customer.uri")).thenReturn('/aai/v8/business/customers/customer') + when(mockExecution.getVariable("GENPS_type")).thenReturn('service-instance') + when(mockExecution.getVariable("GENPS_payload")).thenReturn('') + when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") + when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") + when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn( "1234") + MockPutServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", "GenericFlows/getServiceInstance.xml"); + + CustomE2EPutService customE2EPutService = new CustomE2EPutService() + customE2EPutService.putServiceInstance(mockExecution); + Mockito.verify(mockExecution, times(6)).setVariable(captor.capture(), captor.capture()) + Assert.assertEquals(200, captor.getAllValues().get(7)) + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy new file mode 100644 index 0000000000..025bea5325 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy @@ -0,0 +1,218 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mock +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.StubResponseAAI + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class DeleteAAIVfModuleTest { + + def prefix = "DAAIVfMod_" + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + void testQueryAAIForGenericVnf() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "genericVnfEndpoint")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf/skask") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("aai.auth")).thenReturn("9B2278E8B8E95F256A560719055F4DF3") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("aa3871669d893c7fb8abbcda31b88b4f") + + StubResponseAAI.MockAAIVfModule() + DeleteAAIVfModule obj = new DeleteAAIVfModule() + obj.queryAAIForGenericVnf(mockExecution) + + Mockito.verify(mockExecution).setVariable(prefix + "queryGenericVnfResponseCode", 200) + } + + @Test + void testQueryAAIForGenericVnfEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "genericVnfEndpoint")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf/skask") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("aai.auth")).thenReturn("9B2278E8B8E95F256A560719055F4DF3") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("aa3871669d893c7fb8abbcda31b88b4f") + + StubResponseAAI.MockAAIVfModule() + try { + DeleteAAIVfModule obj = new DeleteAAIVfModule() + obj.queryAAIForGenericVnf(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(2)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(5000, workflowException.getErrorCode()) + Assert.assertEquals("Internal Error - Occured during queryAAIForGenericVnf", workflowException.getErrorMessage()) + } + + @Test + void testDeleteGenericVnf() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "genericVnfEndpoint")).thenReturn("/aai/v9/cloud-infrastructure/volume-groups/volume-group/78987") + when(mockExecution.getVariable(prefix + "genVnfRsrcVer")).thenReturn("0000020") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("aai.auth")).thenReturn("9B2278E8B8E95F256A560719055F4DF3") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("aa3871669d893c7fb8abbcda31b88b4f") + + stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group/78987/[?]resource-version=0000020")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(""))) + + StubResponseAAI.MockAAIVfModule() + DeleteAAIVfModule obj = new DeleteAAIVfModule() + obj.deleteGenericVnf(mockExecution) + + Mockito.verify(mockExecution).setVariable(prefix + "deleteGenericVnfResponseCode", 200) + } + + @Test + void testDeleteGenericVnfEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "genericVnfEndpoint")).thenReturn("/aai/v9/cloud-infrastructure/volume-groups/volume-group/78987") + when(mockExecution.getVariable(prefix + "genVnfRsrcVer")).thenReturn("0000020") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("aai.auth")).thenReturn("9B2278E8B8E95F256A560719055F4DF3") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("aa3871669d893c7fb8abbcda31b88b4f") + + StubResponseAAI.MockAAIVfModule() + try { + DeleteAAIVfModule obj = new DeleteAAIVfModule() + obj.deleteGenericVnf(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(5000, workflowException.getErrorCode()) + Assert.assertEquals("Internal Error - Occured during deleteGenericVnf", workflowException.getErrorMessage()) + } + + @Test + void testDeleteVfModule() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "vfModuleEndpoint")).thenReturn("/aai/v9/cloud-infrastructure/volume-groups/volume-group/78987") + when(mockExecution.getVariable(prefix + "vfModRsrcVer")).thenReturn("0000020") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("aai.auth")).thenReturn("9B2278E8B8E95F256A560719055F4DF3") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("aa3871669d893c7fb8abbcda31b88b4f") + + stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group/78987/[?]resource-version=0000020")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(""))) + + DeleteAAIVfModule obj = new DeleteAAIVfModule() + obj.deleteVfModule(mockExecution) + + Mockito.verify(mockExecution).setVariable(prefix + "deleteVfModuleResponseCode", 200) + } + + @Test + void testDeleteVfModuleEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "vfModuleEndpoint")).thenReturn("/aai/v9/cloud-infrastructure/volume-groups/volume-group/78987") + when(mockExecution.getVariable(prefix + "vfModRsrcVer")).thenReturn("0000020") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("aai.auth")).thenReturn("9B2278E8B8E95F256A560719055F4DF3") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("aa3871669d893c7fb8abbcda31b88b4f") + + StubResponseAAI.MockAAIVfModule() + try { + DeleteAAIVfModule obj = new DeleteAAIVfModule() + obj.deleteVfModule(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(5000, workflowException.getErrorCode()) + Assert.assertEquals("Internal Error - Occured during deleteVfModule", workflowException.getErrorMessage()) + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DeleteAAIVfModule") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DeleteAAIVfModule") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DeleteAAIVfModule") + when(mockExecution.getProcessInstanceId()).thenReturn("DeleteAAIVfModule") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtilTest.groovy new file mode 100644 index 0000000000..c7015cda50 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtilTest.groovy @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.junit.Assert +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; + + +import org.junit.Ignore; + +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.bpmn.core.WorkflowException +@RunWith(MockitoJUnitRunner.class) +import org.junit.Test + + + +class ExceptionUtilTest { + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + public void testMapErrorCode5010(){ + String msg = "Connect to njcdtl20ew2988:8070 failed: Connection refused: connect" + ExceptionUtil util = new ExceptionUtil() + Assert.assertEquals("5010",util.MapErrorCode(msg)) + } + + @Test + public void testMapErrorCode5020(){ + String msg = "Connection timed out" + ExceptionUtil util = new ExceptionUtil() + Assert.assertEquals("5020",util.MapErrorCode(msg)) + } + + @Test + public void testGetErrorCode() { + ExceptionUtil eUtil = new ExceptionUtil() + WorkflowException we = new WorkflowException("CreateVCEV2", 400, "SDNC Test Error") + int errCd = eUtil.getErrorCode(we) + Assert.assertEquals(400, errCd) + } + + @Test + public void testGetErrorCodeWithNullWfe() { + ExceptionUtil eUtil = new ExceptionUtil() + int errCd = eUtil.getErrorCode(null) + Assert.assertEquals(2500, errCd) + } + + @Test + public void testGetErrorMessage() { + ExceptionUtil eUtil = new ExceptionUtil() + WorkflowException we = new WorkflowException("CreateVCEV2", 400, "SDNC Test Error") + String errMsg = eUtil.getErrorMessage(we, "CreateVCEV2") + Assert.assertEquals("SDNC Test Error", errMsg) + } + + @Test + public void testGetErrorMessageWithNullWfe() { + ExceptionUtil eUtil = new ExceptionUtil() + String errMsg = eUtil.getErrorMessage(null, "CreateVCEV2") + Assert.assertEquals("Unexpected error encountered in CreateVCEV2", errMsg) + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/FalloutHandlerTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/FalloutHandlerTest.groovy new file mode 100644 index 0000000000..016d968a12 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/FalloutHandlerTest.groovy @@ -0,0 +1,312 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.junit.runner.RunWith; +import static org.mockito.Mockito.* +import static org.junit.Assert.*; + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor; +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.MsoUtils; +import org.onap.so.bpmn.common.scripts.FalloutHandler; + +@RunWith(MockitoJUnitRunner.class) +class FalloutHandlerTest { + + public MsoUtils utils = new MsoUtils() + + @Before + public void init() { + MockitoAnnotations.initMocks(this) + } + + private String falloutHandlerRequest = """ + + + uCPE1020_STUW105_5002 + Layer3ServiceActivateRequest + CANCEL + OMX + 10205000 + 1 + + + Some Error Message - Fallout Handler + Some Error Code - Fallout Handler + Some Source System Error Code- Fallout Handler + + + """ + + private String falloutHandlerResponse = """ + Fallout Handler Failed +""" + + @Test + public void testPreProcessRequest() { + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("FalloutHandlerRequest")).thenReturn(falloutHandlerRequest) + when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.preProcessRequest(mockExecution) + + /* Initialize all the process request variables in this block */ + verify(mockExecution).setVariable("prefix","FH_") + //verify(mockExecution).setVariable("getLayer3ServiceDetailsV1Response","") + + //These variables are form the input Message to the BPMN + verify(mockExecution).setVariable("FH_request_id","") + verify(mockExecution).setVariable("FH_request_action","") + verify(mockExecution).setVariable("FH_notification-url","") + verify(mockExecution).setVariable("FH_mso-bpel-name","") + verify(mockExecution).setVariable("FH_ErrorCode", "") + verify(mockExecution).setVariable("FH_ErrorMessage", "") + + verify(mockExecution).setVariable("FH_notification-url-Ok", false) + verify(mockExecution).setVariable("FH_request_id-Ok", false) + + //These variables are for Get Mso Aai Password Adapter + verify(mockExecution).setVariable("FH_deliveryStatus", true) + + //update Response Status to pending ...Adapter variables + verify(mockExecution).setVariable("FH_updateResponseStatusPayload", null) + verify(mockExecution).setVariable("FH_updateResponseStatusResponse", null) + + //update Request Gamma ...Adapter variables + verify(mockExecution).setVariable("FH_updateRequestGammaPayload", "") + verify(mockExecution).setVariable("FH_updateRequestGammaResponse", null) + verify(mockExecution).setVariable("FH_updateRequestGammaResponseCode", null) + + //update Request Infra ...Adapter variables + verify(mockExecution).setVariable("FH_updateRequestInfraPayload", "") + verify(mockExecution).setVariable("FH_updateRequestInfraResponse", null) + verify(mockExecution).setVariable("FH_updateRequestInfraResponseCode", null) + + //assign False to success variable + verify(mockExecution).setVariable("FH_success", true) + + //Set notify status to Failed variable + verify(mockExecution).setVariable("FH_NOTIFY_STATUS", "SUCCESS") + + //Set DB update variable + verify(mockExecution).setVariable("FH_updateRequestPayload", "") + verify(mockExecution).setVariable("FH_updateRequestResponse", null) + verify(mockExecution).setVariable("FH_updateRequestResponseCode", null) + + //Auth variables + verify(mockExecution).setVariable("BasicAuthHeaderValue","") + + //Response variables + verify(mockExecution).setVariable("FalloutHandlerResponse","") + verify(mockExecution).setVariable("FH_ErrorResponse", null) + verify(mockExecution).setVariable("FH_ResponseCode", "") + + verify(mockExecution).setVariable("FH_request_id-Ok",true) + verify(mockExecution).setVariable("FH_request_id","uCPE1020_STUW105_5002") + verify(mockExecution).setVariable("FH_request_action","Layer3ServiceActivateRequest") + verify(mockExecution).setVariable("FH_source","OMX") + verify(mockExecution).setVariable("FH_ErrorCode","Some Error Code - Fallout Handler") + verify(mockExecution).setVariable("FH_ErrorMessage","Some Error Message - Fallout Handler") + + } + + @Test + public void testpostProcessResponse(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("FH_success")).thenReturn(false) + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.postProcessResponse(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(4)).setVariable(captor1.capture(), captor2.capture()) + List arg2List = captor2.getAllValues() + String payloadResponseActual = arg2List.get(1) + + assertEquals(falloutHandlerResponse.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", "")) + + verify(mockExecution).setVariable("FH_ResponseCode","500") + } + + private String updateRequestPayload = """ + + + + + testReqId + BPEL + ErrorMessage + ErrorCode + FAILED + NotifyStatus + + + + """ + + @Test + public void testupdateRequestPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") + when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode") + when(mockExecution.getVariable("FH_NOTIFY_STATUS")).thenReturn("NotifyStatus") + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.updateRequestPayload(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) + List arg2List = captor2.getAllValues() + String payloadRequestActual = arg2List.get(0) + + assertEquals(updateRequestPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) + } + + private String updateRequestInfraPayload = """ + + + + + testReqId + BPEL + ErrorMessage + FAILED + 100 + + + + """ + + @Test + public void testupdateRequestInfraPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.updateRequestInfraPayload(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) + List arg2List = captor2.getAllValues() + String payloadRequestActual = arg2List.get(0) + + assertEquals(updateRequestInfraPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) + } + + private String updateRequestGammaPayload = """ + + + + + testReqId + BPEL + ErrorMessage + ErrorCode + FAILED + + + + """ + + @Test + public void testupdateRequestGammaPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") + when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode") + when(mockExecution.getVariable("mso.default.adapter.namespace")).thenReturn("http://org.onap.so"); + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.updateRequestGammaPayload(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) + List arg2List = captor2.getAllValues() + String payloadRequestActual = arg2List.get(0) + + assertEquals(updateRequestGammaPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) + } + + + String updateResponseStatusPayload = """ + + + + + testReqId + BPEL + SENDING_FINAL_NOTIFY + + + + """ + + @Test + public void testupdateResponseStatusPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.updateResponseStatusPayload(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) + List arg2List = captor2.getAllValues() + String payloadResponseActual = arg2List.get(0) + + assertEquals(updateResponseStatusPayload.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", "")) + } + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleNameTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleNameTest.groovy new file mode 100644 index 0000000000..c5baf8cc6c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleNameTest.groovy @@ -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.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class GenerateVfModuleNameTest { + + @Captor + ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class); + + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + @Test + public void testQueryAAI() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("aai.endpoint")).thenReturn('http://localhost:8090') + when(mockExecution.getVariable("vnfId")).thenReturn('skask') + when(mockExecution.getVariable("personaModelId")).thenReturn('personaModelId_test') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn('8') + + mockData() + GenerateVfModuleName obj = new GenerateVfModuleName() + obj.queryAAI(mockExecution) + + Mockito.verify(mockExecution).setVariable("GVFMN_queryAAIVfModuleResponseCode", 200) + } + + @Test + public void testQueryAAIEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("vnfId")).thenReturn('skask') + when(mockExecution.getVariable("personaModelId")).thenReturn('personaModelId_test') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn('8') + + mockData() + try { + GenerateVfModuleName obj = new GenerateVfModuleName() + obj.queryAAI(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(1002, workflowException.getErrorCode()) + Assert.assertEquals("AAI GET Failed:org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) + } + + + private void mockData() { + stubFor(get(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf.*")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfResponse.xml"))) + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("GenerateVfModuleName") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("GenerateVfModuleName") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("GenerateVfModuleName") + when(mockExecution.getProcessInstanceId()).thenReturn("GenerateVfModuleName") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetServiceTest.groovy new file mode 100644 index 0000000000..49edd813f7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetServiceTest.groovy @@ -0,0 +1,124 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class GenericGetServiceTest { + + def prefix = "GENGS_" + @Captor + ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class); + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + @Test + public void testGetServiceObject() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("aai.endpoint")).thenReturn('http://localhost:8090') + when(mockExecution.getVariable(prefix + "type")).thenReturn('service-instance') + when(mockExecution.getVariable(prefix + "serviceInstanceId")).thenReturn('12345') + when(mockExecution.getVariable(prefix + "resourceLink")).thenReturn("/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + mockData() + GenericGetService obj = new GenericGetService() + obj.getServiceObject(mockExecution) + + Mockito.verify(mockExecution).setVariable("prefix", prefix) + Mockito.verify(mockExecution).setVariable(prefix + "getServiceUrl", "http://localhost:8090/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/") + Mockito.verify(mockExecution).setVariable(prefix + "getServiceResponseCode", 200) + } + + @Test + public void testGetServiceObjectEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable(prefix + "type")).thenReturn('service-instance') + when(mockExecution.getVariable(prefix + "serviceInstanceId")).thenReturn('12345') + when(mockExecution.getVariable(prefix + "resourceLink")).thenReturn("/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + mockData() + try { + GenericGetService obj = new GenericGetService() + obj.getServiceObject(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(9999, workflowException.getErrorCode()) + Assert.assertEquals("org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) + } + + private void mockData() { + stubFor(get(urlMatching(".*/aai/v[0-9]+/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/.*")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile(""))) + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("GenericGetService") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("GenericGetService") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("GenericGetService") + when(mockExecution.getProcessInstanceId()).thenReturn("GenericGetService") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnfTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnfTest.groovy new file mode 100644 index 0000000000..1aef78f0d5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnfTest.groovy @@ -0,0 +1,180 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class GenericGetVnfTest { + + def prefix = "GENGV_" + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + public void testGetVnfByName() { + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable(prefix+"vnfName")).thenReturn("genricVnf_test") + when(mockExecution.getVariable(prefix+"type")).thenReturn("generic-vnf") + when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + GenericGetVnf obj = new GenericGetVnf() + obj.getVnfByName(mockExecution) + + Mockito.verify(mockExecution).setVariable("prefix","GENGV_") + Mockito.verify(mockExecution).setVariable(prefix+"getVnfPath","http://localhost:28090/aai/v9/network/generic-vnfs/generic-vnf?vnf-name=genricVnf_test&depth=1") + } + + @Test + public void testGetVnfByNameEndpointNull() { + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable(prefix+"vnfName")).thenReturn("genricVnf_test") + when(mockExecution.getVariable(prefix+"type")).thenReturn("generic-vnf") + when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + try{ + GenericGetVnf obj = new GenericGetVnf() + obj.getVnfByName(mockExecution) + }catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(9999, workflowException.getErrorCode()) + Assert.assertEquals("org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) + } + + @Test + public void testGetVnfById() { + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable(prefix+"vnfId")).thenReturn("genricVnf_test") + when(mockExecution.getVariable(prefix+"type")).thenReturn("generic-vnf") + when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + GenericGetVnf obj = new GenericGetVnf() + obj.getVnfById(mockExecution) + + Mockito.verify(mockExecution).setVariable("prefix","GENGV_") + Mockito.verify(mockExecution).setVariable(prefix+"getVnfPath","http://localhost:28090/aai/v9/network/generic-vnfs/generic-vnf/genricVnf_test?depth=1") + } + + @Test + public void testGetVnfByIdEndpointNull() { + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable(prefix+"vnfId")).thenReturn("genricVnf_test") + when(mockExecution.getVariable(prefix+"type")).thenReturn("generic-vnf") + when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + try{ + GenericGetVnf obj = new GenericGetVnf() + obj.getVnfById(mockExecution) + }catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(9999, workflowException.getErrorCode()) + Assert.assertEquals("org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoCreateVfModule") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateVfModule") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateVfModule") + when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateVfModule") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + + private static void mockData() { + stubFor(get(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf.*")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfResponse.xml"))) + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericPutServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericPutServiceTest.groovy new file mode 100644 index 0000000000..d4ea8ce71f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericPutServiceTest.groovy @@ -0,0 +1,235 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import static org.mockito.Mockito.* +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutServiceInstance; + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.mockito.runners.MockitoJUnitRunner + +import com.github.tomakehurst.wiremock.client.WireMock +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.apache.commons.lang3.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class GenericPutServiceTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + + } + + @Test + public void preProcessRequest() { + + + println "************ preProcessRequest ************* " + + ExecutionEntity mockExecution = setupMock() + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") + when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") + when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") + when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("GENPS_type")).thenReturn("service-instance") + + GenericPutService putServiceInstance= new GenericPutService() + putServiceInstance.preProcessRequest(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", "GENPS_") + + // execution.getVariable("isDebugLogEnabled") + + verify(mockExecution).setVariable("GENPS_SuccessIndicator", false) + // verify(mockExecution).setVariable("globalSubscriberId", "1604-MVM-26") + // verify(mockExecution).setVariable("serviceInstanceId", "MIS%2F1604%2F0026%2FSW_INTERNET") + // verify(mockExecution).setVariable("serviceType", "SDN-ETHERNET-INTERNET") + // verify(mockExecution).setVariable("ServiceInstanceData", "f70e927b-6087-4974-9ef8-c5e4d5847ca4") + + + } + + + @Test + @Ignore + public void putServiceInstance() { + println "************ putServiceInstance ************* " + + WireMock.reset(); + + MockPutServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"); + ExecutionEntity mockExecution = setupMock() + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") + when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") + when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") + when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.PutServiceInstance.aai.business.customer.uri")).thenReturn("/aai/v7/business/customers/customer") + when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("GENPS_type")).thenReturn("service-instance") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("7") + when(mockExecution.getVariable("mso.workflow.default.aai.v7.customer.uri")).thenReturn("/aai/v7/business/customers/customer") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + GenericPutService serviceInstance= new GenericPutService() + serviceInstance.putServiceInstance(mockExecution) + + // check the sequence of variable invocation + MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", "GENPS_") + + // execution.getVariable("isDebugLogEnabled") + // verify(mockExecution).setVariable("GENPSI_serviceInstanceData","f70e927b-6087-4974-9ef8-c5e4d5847ca4") + + String servicePayload = """f70e927b-6087-4974-9ef8-c5e4d5847ca4""" as String + verify(mockExecution).setVariable("GENPS_serviceInstancePayload",servicePayload) + + String serviceAaiPath = "http://localhost:28090/aai/v7/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET" + verify(mockExecution).setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath) + + int responseCode = 200 + verify(mockExecution).setVariable("GENPS_putServiceInstanceResponseCode", responseCode) + + String aaiResponse = """ + + + + + + + + +""" + + verify(mockExecution).setVariable("GENPS_putServiceInstanceResponse", aaiResponse) + + verify(mockExecution).setVariable("GENPS_SuccessIndicator", true) + } + + @Test + @Ignore + public void putServiceInstance_404() { + + + println "************ putServiceInstance ************* " + + WireMock.reset(); + + ExecutionEntity mockExecution = setupMock() + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") + when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") + when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") + when(mockExecution.getVariable("GENPS_ServiceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.PutServiceInstance.aai.business.customer_uri")).thenReturn("/aai/v7/business/customers/customer") + when(mockExecution.getVariable("GENPS_ServiceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + + GenericPutService serviceInstance= new GenericPutService() + serviceInstance.putServiceInstance(mockExecution) + + // check the sequence of variable invocation + MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", "GENPS_") + + // execution.getVariable("isDebugLogEnabled") + + + verify(mockExecution).setVariable("GENPS_serviceInstanceData","f70e927b-6087-4974-9ef8-c5e4d5847ca4") + + String serviceInstancepayload = """f70e927b-6087-4974-9ef8-c5e4d5847ca4 + """ as String + verify(mockExecution).setVariable("GENPS_serviceInstancePayload",serviceInstancepayload) + + String serviceInstanceAaiPath = "http://localhost:8090/aai/v7/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET" + verify(mockExecution).setVariable("GENPS_putServiceInstanceAaiPath", serviceInstanceAaiPath) + + int responseCode = 404 + verify(mockExecution).setVariable("GENPS_putServiceInstanceResponseCode", responseCode) + + String aaiResponse = "" + verify(mockExecution).setVariable("GENPS_putServiceInstanceResponse", aaiResponse) + + verify(mockExecution).setVariable("GENPS_SuccessIndicator", false) + + + } + + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("PutServiceInstance") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("PutServiceInstance") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("PutServiceInstance") + when(mockExecution.getProcessInstanceId()).thenReturn("PutServiceInstance") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy new file mode 100644 index 0000000000..cd95a3a733 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy @@ -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.bpmn.common.scripts + +import static org.mockito.Mockito.* + +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition + +abstract class MsoGroovyTest { + + protected ExecutionEntity setupMock(String procName) { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn(procName) + + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(procName) + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + + return mockExecution + } + + protected ExecutionEntity setupMockWithPrefix(String procName, String prefix) { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + + ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class) + RepositoryService repositoryService = mock(RepositoryService.class) + ProcessDefinition processDefinition = mock(ProcessDefinition.class) + + when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices) + when(processEngineServices.getRepositoryService()).thenReturn(repositoryService) + when(repositoryService.getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(processDefinition) + when(processDefinition.getKey()).thenReturn(procName) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + return mockExecution + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy new file mode 100644 index 0000000000..dfcf69a931 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy @@ -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========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +// JUnit 4 +import org.junit.Test +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; + +import static groovy.test.GroovyAssert.shouldFail + +import groovy.util.slurpersupport.NodeChild + +import static groovy.test.GroovyAssert.assertTrue +import static groovy.test.GroovyAssert.assertEquals +import static groovy.test.GroovyAssert.assertNotNull; + +import org.onap.so.bpmn.common.scripts.MsoUtils; +import org.apache.commons.lang3.* + + +class MsoUtilsTest { + + def utils = new MsoUtils() + def origXmlResponse = null + // Expected rebuilds + def expected_buildElements = "10Kbps1192.168.1.15192.168.1.15282192.168.1.16192.168.1.1628" + def expected_rebuildDhcp = "YNY192.168.1.7192.168.1.8192.155.2.328192.168.1.5192.168.1.62.2.2.11.1.1.1192.155.2.428192.168.1.6192.168.1.72.2.2.21.1.1.2N1:51:60:0281:12:23:34:40:0281:12:23:34:4" + def expected_rebuildFirewallLite = "YN0.0.0.11Y110.0.0.22Y22:0Y33:1Y44" + def expected_rebuildInternetEvcAccess = "8Mbpsds" + def expected_rebuildInternetServiceChangeDetails = "10Kbps1192.168.1.15192.168.1.15282192.168.1.16192.168.1.162812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:2da::28" + def expected_rebuildInternetServiceChangeDetailsWithVrLanParams = "10Kbps10.10.7.14101192.168.1.15192.168.1.15282192.168.1.16192.168.1.162812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:2da::28" + def expected_rebuildL2Home = "AS/VLXM/003717//SWMultiPointMTSNJA4LCP1" + def expected_rebuildL2HomeFor_aic_clli = "AS/VLXM/003717//SWMultiPointMTSNJA4LCP12.5" + def expected_rebuildNat = "Y0.0.0.00.0.0.00.0.0.00.0.0.10.0.0.10.0.0.1" + def expected_rebuildPat = "NY192.168.1.440192.168.1.5192.168.1.4528192.168.1.6" + def expected_rebuildStaticRoutes = "255.255.252.128192.168.1.15255.255.252.228192.168.1.15255.255.252.328192.168.1.152001:1890:12e3:2da::282001:1890:12e3:2da::2001:1890:12e3:2da::282001:1890:12e3:2da::" + def expected_rebuildUcpeVmsServiceInformation = "AVPN1Active2StandbyhostnameactivecodeOOB11ZZJUNIPERMODEL11111122HYJUNIPERMODEL222222" + def expected_rebuildVrLan = "noneprimary10.192.27.254242620:0:10d0:f:ffff:ffff:ffff:fffe64162.200.3.1442001:1890:12e3:2da::1192.168.1.2192.168.1.1281192.168.1.72192.168.1.71281192.168.1.68192.168.1.672812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:3da::2812001:1890:12e3:2da::2001:1890:12e3:4da::28YNY192.168.1.7192.168.1.8192.155.2.328192.168.1.5192.168.1.62.2.2.11.1.1.1192.155.2.428192.168.1.6192.168.1.72.2.2.21.1.1.2N1:51:60:0281:12:23:34:40:0281:12:23:34:4NY192.168.1.440192.168.1.5192.168.1.4528192.168.1.6Y0.0.0.00.0.0.00.0.0.00.0.0.10.0.0.10.0.0.1YN0.0.0.11Y110.0.0.22Y22:0Y33:1Y44255.255.252.128192.168.1.15255.255.252.228192.168.1.15255.255.252.328192.168.1.152001:1890:12e3:2da::282001:1890:12e3:2da::2001:1890:12e3:2da::282001:1890:12e3:2da::" + def expected_rebuildVrLanInterfacePartial = "primary10.192.27.254242620:0:10d0:f:ffff:ffff:ffff:fffe64162.200.3.1442001:1890:12e3:2da::1192.168.1.2192.168.1.1281192.168.1.72192.168.1.71281192.168.1.68192.168.1.67281192.168.1.15192.168.1.15282192.168.1.16192.168.1.162812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:3da::2812001:1890:12e3:2da::2001:1890:12e3:4da::2812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:2da::28" + + @Before + public void setUp() { + def responseAsString = getFile("sdncadaptercallbackrequest.xml") + def varrequestData=utils.getNodeText(responseAsString,"RequestData") + origXmlResponse = utils.getNodeXml(varrequestData, "layer3-service-list").drop(38).trim() + + } + + @Test + public void testBuildL2Home() { + def rebuildL2Home = utils.buildL2HomingInformation(origXmlResponse) + println " rebuildL2Home: " + println " actual - " + rebuildL2Home + println " expected - " + expected_rebuildL2Home + assertEquals("rebuildL2Home - expected vs actual", expected_rebuildL2Home, rebuildL2Home) + } + + @Test + public void testBuildInternetEvcAccess() { + def rebuildInternetEvcAccess = utils.buildInternetEvcAccessInformation(origXmlResponse) + println " rebuildInternetEvcAccess: " + println " actual - " + rebuildInternetEvcAccess + println " expected - " + expected_rebuildInternetEvcAccess + assertEquals("rebuildInternetEvcAccess - expected vs actual", expected_rebuildInternetEvcAccess, rebuildInternetEvcAccess) + } + + @Test + public void testBuildInternetServiceChangeDetails() { + def rebuildInternetServiceChangeDetails = utils.buildInternetServiceChangeDetails(origXmlResponse) + println " rebuildInternetServiceChangeDetails: " + println " actual - " + rebuildInternetServiceChangeDetails + println " expected - " + expected_rebuildInternetServiceChangeDetails + assertEquals("rebuildInternetServiceChangeDetails - expected vs actual", expected_rebuildInternetServiceChangeDetails, rebuildInternetServiceChangeDetails) + } + + @Test + public void testBuildInternetServiceChangeDetailsWithVrLanParams() { + def responseAsString = getFile("sdncadaptercallbackrequest_with_aic_version.xml") + def varrequestData=utils.getNodeText(responseAsString,"RequestData") + def xmlResponse = utils.getNodeXml(varrequestData, "layer3-service-list").drop(38).trim() + def rebuildInternetServiceChangeDetails = utils.buildInternetServiceChangeDetails(xmlResponse) + println " rebuildInternetServiceChangeDetails: " + println " actual - " + rebuildInternetServiceChangeDetails + println " expected - " + expected_rebuildInternetServiceChangeDetails + assertEquals("rebuildInternetServiceChangeDetails - expected vs actual", expected_rebuildInternetServiceChangeDetailsWithVrLanParams, rebuildInternetServiceChangeDetails) + } + + // Coming v100 + @Test + @Ignore + public void testBuildUcpeVmsServiceInformation() { + def rebuildUcpeVmsServiceInformation = utils.buildUcpeVmsServiceInformation(origXmlResponse) + println " rebuildUcpeVmsServiceInformation: " + println " actual - " + rebuildUcpeVmsServiceInformation + println " expected - " + expected_rebuildUcpeVmsServiceInformation + assertEquals("rebuildUcpeVmsServiceInformation - expected vs actual", expected_rebuildUcpeVmsServiceInformation, rebuildUcpeVmsServiceInformation) + } + + @Test + public void testBuildElements() { + // testing utility codes: buildElements() & buildElementsUnblunded() + def internetServiceChangeDetails = utils.getNodeXml(origXmlResponse, "internet-service-change-details").drop(38).trim() + def buildElements = '' + buildElements = "" + buildElements += utils.buildElements(internetServiceChangeDetails, ["internet-evc-speed-value"], "") + buildElements += utils.buildElements(internetServiceChangeDetails, ["internet-evc-speed-units"], "") + def tProvidedV4LanPublicPrefixesChangesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length"] + buildElements += utils.buildElementsUnbounded(internetServiceChangeDetails, tProvidedV4LanPublicPrefixesChangesList, "t-provided-v4-lan-public-prefixes") + buildElements += "" + println " buildElements: " + println " actual - " + buildElements + println " expected - " + expected_buildElements + assertEquals("buildElements - expected vs actual", expected_buildElements, buildElements) + } + + @Test + public void testBuildVrLan() { + def rebuildVrLan = utils.buildVrLan(origXmlResponse) + println " rebuildVrLans: " + println " actual - " + rebuildVrLan + println " expected - " + expected_rebuildVrLan + assertEquals("rebuildVrLan - expected vs actual", expected_rebuildVrLan, rebuildVrLan) + } + + @Test + public void testBuildVrLanInterfacePartial() { + def rebuildVrLanInterfacePartial = utils.buildVrLanInterfacePartial(origXmlResponse) + println " rebuildVrLanInterfacePartial: " + println " actual - " + rebuildVrLanInterfacePartial + println " expected - " + expected_rebuildVrLanInterfacePartial + assertEquals("rebuildVrLanInterfacePartial - expected vs actual", expected_rebuildVrLanInterfacePartial, rebuildVrLanInterfacePartial) + } + + @Test + public void testBuildDhcp() { + def rebuildDhcp = utils.buildDhcp(origXmlResponse) + println " rebuildDhcp: " + println " actual - " + rebuildDhcp + println " expected - " + expected_rebuildDhcp + assertEquals("rebuildDhcp - expected vs actual", expected_rebuildDhcp, rebuildDhcp) + } + + @Test + public void testBuildPat() { + def rebuildPat = utils.buildPat(origXmlResponse) + println " rebuildPat: " + println " actual - " + rebuildPat + println " expected - " + expected_rebuildPat + assertEquals("rebuildPat - expected vs actual", expected_rebuildPat, rebuildPat) + } + + @Test + public void testBuildNat() { + def rebuildNat = utils.buildNat(origXmlResponse) + println " rebuildNat: " + println " actual - " + rebuildNat + println " expected - " + expected_rebuildNat + assertEquals("rebuildNat - expected vs actual", expected_rebuildNat, rebuildNat) + } + + @Test + public void testBuildFirewallLite() { + def rebuildFirewallLite = utils.buildFirewallLite(origXmlResponse) + println " rebuildFirewallLite: " + println " actual - " + rebuildFirewallLite + println " expected - " + expected_rebuildFirewallLite + assertEquals("rebuildFirewallLite - expected vs actual", expected_rebuildFirewallLite, rebuildFirewallLite) + } + + @Test + public void testBuildStaticRoutes() { + def rebuildStaticRoutes = utils.buildStaticRoutes(origXmlResponse) + println " rebuildStaticRoutes: " + println " actual - " + rebuildStaticRoutes + println " expected - " + expected_rebuildStaticRoutes + assertEquals("rebuildStaticRoutes - expected vs actual", expected_rebuildStaticRoutes, rebuildStaticRoutes) + } + + @Test + public void testGetBasicAuth(){ + def encodedAuth = utils.getBasicAuth("3E3CFA7BE2F6107AAD4AAA65F8976690","07a7159d3bf51a0e53be7a8f89699be7") + assertEquals("Basic bXlTdHJpbmc=", encodedAuth) + } + + @Test + public void testEncrypt(){ + def encrypted = utils.encrypt("myString","07a7159d3bf51a0e53be7a8f89699be7") + assertEquals("3E3CFA7BE2F6107AAD4AAA65F8976690", encrypted) + + //use to get value for urn properties + //println(utils.encrypt("password")) + } + + @Test + public void testDecrypt(){ + def decrypted = utils.decrypt("3E3CFA7BE2F6107AAD4AAA65F8976690", "07a7159d3bf51a0e53be7a8f89699be7") + assertEquals("myString", decrypted) + } + + @Test + public void testGetPBGFList(){ + def responseAsString = getFile("sdncDeleteResponse.xml") + def nodes = utils.getPBGFList("true", responseAsString) + //assertEquals(2, nodes.size()) + while(!nodes.empty){ + def myBGFXML = nodes.remove(0) + def myBGF= new XmlSlurper().parseText(myBGFXML) + println "borderElmtId: " + myBGF.'border-element-id' + println "vlanid: " + myBGF.'vlan-id' +"\n" + } + } + + @Test + public void testBuildL2HomingInformation_with_aic_clli() { + + def responseAsString = getFile("sdncadaptercallbackrequest_with_aic_version.xml") + def varrequestData=utils.getNodeText(responseAsString,"RequestData") + def xmlResponse = utils.getNodeXml(varrequestData, "layer3-service-list").drop(38).trim() + def rebuildL2Home = utils.buildL2HomingInformation(xmlResponse) + println " rebuildL2Home: " + println " actual - " + rebuildL2Home + println " expected - " + expected_rebuildL2Home + assertEquals("rebuildL2Home - expected vs actual", expected_rebuildL2HomeFor_aic_clli, rebuildL2Home) + } + + @Test + public void testUnescapeNodeContents() { + String output = "AT&T" + String noChangeInput = "AT&T" + String decodeWithNamespacesNodeInput = '<b>AT&amp;T</b>' + String decodeWithNamespacesInput = '<b>AT&amp;T</b>' + String decodeWithNamespacesOutput = 'AT&T' + String decodeWithoutNamespacesInput = '<b>AT&amp;T</b>' + String decodeWithoutNamespacesOutput = 'AT&T' + String normalString = "AT&T" + NodeChild noChangeInputNode = new XmlSlurper().parseText(noChangeInput).'**'.find {it.name() == 'a'} + NodeChild decodeWithNamespacesInputNode = new XmlSlurper().parseText(decodeWithNamespacesNodeInput).'**'.find {it.name() == 'a'} + NodeChild decodeWithoutNamespacesInputNode = new XmlSlurper().parseText(decodeWithoutNamespacesInput).'**'.find {it.name() == 'a'} + NodeChild normalStringNode = new XmlSlurper().parseText(normalString).'**'.find {it.name() == 'a'} + + assertEquals("no change", output, utils.unescapeNodeContents(noChangeInputNode, noChangeInput)) + assertEquals("single unescape", decodeWithNamespacesOutput, utils.unescapeNodeContents(decodeWithNamespacesInputNode, decodeWithNamespacesInput)) + assertEquals("single unescape", decodeWithoutNamespacesOutput, utils.unescapeNodeContents(decodeWithoutNamespacesInputNode, decodeWithoutNamespacesInput)) + assertEquals("unescape normal string", "AT&T", utils.unescapeNodeContents(normalStringNode, "AT&T")) + } + + @Test + public void testXmlEncode() { + + String expected = "&amp;"; + + assertEquals("is double encoded", expected, MsoUtils.xmlEscape("&")) + + } + public String getFile(String fileName) { + def SLASH = File.separator + def pathBase = ' ' + def fileAsString = '' + try { + pathBase = new File(".").getCanonicalPath() + //println "pathBase " + pathBase + "${SLASH}src${SLASH}test${SLASH}resources${SLASH}${fileName}" + fileAsString = new File(pathBase, "${SLASH}src${SLASH}test${SLASH}resources${SLASH}${fileName}").getText() + } catch (Exception ex) { + println " *** getFile error: " + ex.getStackTrace() + } finally { + return fileAsString + } + } + + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/NetworkUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/NetworkUtilsTest.groovy new file mode 100644 index 0000000000..510dcf665c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/NetworkUtilsTest.groovy @@ -0,0 +1,101 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.junit.Before +import org.mockito.MockitoAnnotations + +import static org.mockito.Mockito.* +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import static org.junit.Assert.*; +import org.junit.Test; + +class NetworkUtilsTest { + + def volumeRequestXml = """ + + CREATE_VF_MODULE_VOL + VID + + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + + + STMTN5MMSC20 + US1117MTSNJVBR0246 + +""" + + + @Test + public void testIsRollbackEnabled() { + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.rollback")).thenReturn(true) + + NetworkUtils networkUtils = new NetworkUtils() + def rollbackEnabled = networkUtils.isRollbackEnabled(mockExecution, volumeRequestXml) + + assertEquals(true, rollbackEnabled) + + } + + @Test + public void testIsRollbackEnabled2() { + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.rollback")).thenReturn(false) + + NetworkUtils networkUtils = new NetworkUtils() + def rollbackEnabled = networkUtils.isRollbackEnabled(mockExecution, volumeRequestXml) + + assertEquals(false, rollbackEnabled) + + } + + @Test + public void testGetIpvVersion() { + + NetworkUtils networkUtils = new NetworkUtils() + println "test: ipv4" + String version4 = networkUtils.getIpvVersion("ipv4") + assertEquals("4", version4) + println "test: ipv6" + String version6 = networkUtils.getIpvVersion("ipv6") + assertEquals("6", version6) + println "test: 4" + String versionDigit4 = networkUtils.getIpvVersion("4") + assertEquals("4", versionDigit4) + + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy new file mode 100644 index 0000000000..c5b8fab9eb --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy @@ -0,0 +1,171 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.mock.StubResponseAAI + +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class PrepareUpdateAAIVfModuleTest { + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + void testGetGenericVnf() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("PUAAIVfMod_vnfId")).thenReturn("skask") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.PrepareUpdateAAIVfModule.aai.version")).thenReturn('8') + + StubResponseAAI.MockAAIVfModule() + + PrepareUpdateAAIVfModule obj = new PrepareUpdateAAIVfModule() + obj.getGenericVnf(mockExecution) + + verify(mockExecution).setVariable("PUAAIVfMod_getVnfResponseCode", 200) + } + + @Test + void testGetGenericVnfEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("PUAAIVfMod_vnfId")).thenReturn("skask") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.PrepareUpdateAAIVfModule.aai.version")).thenReturn('8') + + StubResponseAAI.MockAAIVfModule() + try { + PrepareUpdateAAIVfModule obj = new PrepareUpdateAAIVfModule() + obj.getGenericVnf(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + verify(mockExecution).setVariable("PUAAIVfMod_getVnfResponseCode", 500) + verify(mockExecution).setVariable("PUAAIVfMod_getVnfResponse", "AAI GET Failed:org.apache.http.client.ClientProtocolException") + } + + @Test + void testUpdateVfModule() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("PUAAIVfMod_vnfId")).thenReturn("skask") + when(mockExecution.getVariable("PUAAIVfMod_vfModuleId")).thenReturn("supercool") + + def node = new Node(null, 'vfModule') + new Node(node, 'vf-module-name', "abc") + VfModule vfModule = new VfModule(node, true) + + when(mockExecution.getVariable("PUAAIVfMod_vfModule")).thenReturn(vfModule) + when(mockExecution.getVariable("PUAAIVfMod_orchestrationStatus")).thenReturn("created") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.PrepareUpdateAAIVfModule.aai.version")).thenReturn('8') + + StubResponseAAI.MockAAIVfModule() + PrepareUpdateAAIVfModule obj = new PrepareUpdateAAIVfModule() + obj.updateVfModule(mockExecution) + + verify(mockExecution).setVariable("PUAAIVfMod_updateVfModuleResponseCode", 200) + verify(mockExecution).setVariable("PUAAIVfMod_updateVfModuleResponse", "") + } + + @Test + void testUpdateVfModuleEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("PUAAIVfMod_vnfId")).thenReturn("skask") + when(mockExecution.getVariable("PUAAIVfMod_vfModuleId")).thenReturn("supercool") + + def node = new Node(null, 'vfModule') + new Node(node, 'vf-module-name', "abc") + VfModule vfModule = new VfModule(node, true) + + when(mockExecution.getVariable("PUAAIVfMod_vfModule")).thenReturn(vfModule) + when(mockExecution.getVariable("PUAAIVfMod_orchestrationStatus")).thenReturn("created") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.PrepareUpdateAAIVfModule.aai.version")).thenReturn('8') + + StubResponseAAI.MockAAIVfModule() + try { + PrepareUpdateAAIVfModule obj = new PrepareUpdateAAIVfModule() + obj.updateVfModule(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + verify(mockExecution).setVariable("PUAAIVfMod_updateVfModuleResponseCode", 500) + verify(mockExecution).setVariable("PUAAIVfMod_updateVfModuleResponse", "AAI PATCH Failed:org.apache.http.client.ClientProtocolException") + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("PrepareUpdateAAIVfModule") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("PrepareUpdateAAIVfModule") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("PrepareUpdateAAIVfModule") + when(mockExecution.getProcessInstanceId()).thenReturn("PrepareUpdateAAIVfModule") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1Test.groovy new file mode 100644 index 0000000000..1079bb48b3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1Test.groovy @@ -0,0 +1,151 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Ignore +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.bpmn.core.json.JsonUtils + +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +public class SDNCAdapterRestV1Test { + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + public void testPreProcessRequest() { + // bpTimeout is empty and "mso.adapters.sdnc.timeout" is defined + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("SDNCREST_") + when(mockExecution.getVariable("mso-request-id")).thenReturn("testMsoRequestId") + when(mockExecution.getVariable("SDNCREST_Request")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.sdnc.rest.endpoint")).thenReturn("http://localhost:18080/adapters/rest/v1/sdnc/") + + when(mockExecution.getVariable("mso.adapters.sdnc.timeout")).thenReturn("PT5M") + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") + + + SDNCAdapterRestV1 sdncAdapterRestV1 = new SDNCAdapterRestV1() + sdncAdapterRestV1.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","SDNCREST_") + + verify(mockExecution).setVariable("SDNCREST_SuccessIndicator",false) + verify(mockExecution).setVariable("SDNCREST_requestType","SDNCServiceRequest") + verify(mockExecution).setVariable("SDNCAResponse_CORRELATOR","0d883b7f-dd34-4e1b-9ed5-341d33052360-1511808197479") + verify(mockExecution).setVariable("SDNCREST_sdncAdapterMethod","POST") + verify(mockExecution).setVariable("SDNCREST_timeout","PT5M") + } + + @Test + public void testPreProcessRequestGoodTimeout() { + // bpTimeout is valid and "mso.adapters.sdnc.timeout" is undefined + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json"); + sdncAdapterWorkflowRequest = JsonUtils.addJsonValue(sdncAdapterWorkflowRequest, "SDNCServiceRequest.bpTimeout", "PT20S") + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("SDNCREST_") + when(mockExecution.getVariable("mso-request-id")).thenReturn("testMsoRequestId") + when(mockExecution.getVariable("SDNCREST_Request")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.sdnc.rest.endpoint")).thenReturn("http://localhost:18080/adapters/rest/v1/sdnc/") + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") + + + SDNCAdapterRestV1 sdncAdapterRestV1 = new SDNCAdapterRestV1() + sdncAdapterRestV1.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","SDNCREST_") + + verify(mockExecution).setVariable("SDNCREST_SuccessIndicator",false) + verify(mockExecution).setVariable("SDNCREST_requestType","SDNCServiceRequest") + verify(mockExecution).setVariable("SDNCAResponse_CORRELATOR","0d883b7f-dd34-4e1b-9ed5-341d33052360-1511808197479") + verify(mockExecution).setVariable("SDNCREST_sdncAdapterMethod","POST") + verify(mockExecution).setVariable("SDNCREST_timeout","PT20S") + } + + @Test + @Ignore + public void testPreProcessRequestBadTimeout() { + // bpTimeout is invalid and "mso.adapters.sdnc.timeout" is undefined + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json"); + sdncAdapterWorkflowRequest = JsonUtils.addJsonValue(sdncAdapterWorkflowRequest, "SDNCServiceRequest.bpTimeout", "badTimeout") + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("SDNCREST_") + when(mockExecution.getVariable("mso-request-id")).thenReturn("testMsoRequestId") + when(mockExecution.getVariable("SDNCREST_Request")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.sdnc.rest.endpoint")).thenReturn("http://localhost:18080/adapters/rest/v1/sdnc/") + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") + + + SDNCAdapterRestV1 sdncAdapterRestV1 = new SDNCAdapterRestV1() + sdncAdapterRestV1.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","SDNCREST_") + + verify(mockExecution).setVariable("SDNCREST_SuccessIndicator",false) + verify(mockExecution).setVariable("SDNCREST_requestType","SDNCServiceRequest") + verify(mockExecution).setVariable("SDNCAResponse_CORRELATOR","0d883b7f-dd34-4e1b-9ed5-341d33052360-1511808197479") + verify(mockExecution).setVariable("SDNCREST_sdncAdapterMethod","POST") + verify(mockExecution).setVariable("SDNCREST_timeout","PT10S") + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2Test.groovy new file mode 100644 index 0000000000..d7fe0ee208 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2Test.groovy @@ -0,0 +1,151 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Ignore +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.bpmn.core.json.JsonUtils + +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +public class SDNCAdapterRestV2Test { + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + public void testPreProcessRequest() { + // bpTimeout is empty and "mso.adapters.sdnc.timeout" is defined + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("SDNCREST_") + when(mockExecution.getVariable("mso-request-id")).thenReturn("testMsoRequestId") + when(mockExecution.getVariable("SDNCREST_Request")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.sdnc.rest.endpoint")).thenReturn("http://localhost:18080/adapters/rest/v1/sdnc/") + + when(mockExecution.getVariable("mso.adapters.sdnc.timeout")).thenReturn("PT5M") + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") + + + SDNCAdapterRestV2 sdncAdapterRestV2 = new SDNCAdapterRestV2() + sdncAdapterRestV2.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","SDNCREST_") + + verify(mockExecution).setVariable("SDNCREST_SuccessIndicator",false) + verify(mockExecution).setVariable("SDNCREST_requestType","SDNCServiceRequest") + verify(mockExecution).setVariable("SDNCAResponse_CORRELATOR","0d883b7f-dd34-4e1b-9ed5-341d33052360-1511808197479") + verify(mockExecution).setVariable("SDNCREST_sdncAdapterMethod","POST") + verify(mockExecution).setVariable("SDNCREST_timeout","PT5M") + } + + @Test + public void testPreProcessRequestGoodTimeout() { + // bpTimeout is valid and "mso.adapters.sdnc.timeout" is undefined + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json"); + sdncAdapterWorkflowRequest = JsonUtils.addJsonValue(sdncAdapterWorkflowRequest, "SDNCServiceRequest.bpTimeout", "PT20S") + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("SDNCREST_") + when(mockExecution.getVariable("mso-request-id")).thenReturn("testMsoRequestId") + when(mockExecution.getVariable("SDNCREST_Request")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.sdnc.rest.endpoint")).thenReturn("http://localhost:18080/adapters/rest/v1/sdnc/") + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") + + + SDNCAdapterRestV2 sdncAdapterRestV2 = new SDNCAdapterRestV2() + sdncAdapterRestV2.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","SDNCREST_") + + verify(mockExecution).setVariable("SDNCREST_SuccessIndicator",false) + verify(mockExecution).setVariable("SDNCREST_requestType","SDNCServiceRequest") + verify(mockExecution).setVariable("SDNCAResponse_CORRELATOR","0d883b7f-dd34-4e1b-9ed5-341d33052360-1511808197479") + verify(mockExecution).setVariable("SDNCREST_sdncAdapterMethod","POST") + verify(mockExecution).setVariable("SDNCREST_timeout","PT20S") + } + + @Ignore + @Test + public void testPreProcessRequestBadTimeout() { + // bpTimeout is invalid and "mso.adapters.sdnc.timeout" is undefined + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json"); + sdncAdapterWorkflowRequest = JsonUtils.addJsonValue(sdncAdapterWorkflowRequest, "SDNCServiceRequest.bpTimeout", "badTimeout") + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("SDNCREST_") + when(mockExecution.getVariable("mso-request-id")).thenReturn("testMsoRequestId") + when(mockExecution.getVariable("SDNCREST_Request")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.sdnc.rest.endpoint")).thenReturn("http://localhost:18080/adapters/rest/v1/sdnc/") + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") + + + SDNCAdapterRestV2 sdncAdapterRestV2 = new SDNCAdapterRestV2() + sdncAdapterRestV2.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","SDNCREST_") + + verify(mockExecution).setVariable("SDNCREST_SuccessIndicator",false) + verify(mockExecution).setVariable("SDNCREST_requestType","SDNCServiceRequest") + verify(mockExecution).setVariable("SDNCAResponse_CORRELATOR","0d883b7f-dd34-4e1b-9ed5-341d33052360-1511808197479") + verify(mockExecution).setVariable("SDNCREST_sdncAdapterMethod","POST") + verify(mockExecution).setVariable("SDNCREST_timeout","PT10S") + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy new file mode 100644 index 0000000000..18d65d00d8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy @@ -0,0 +1,951 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + + +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.onap.so.bpmn.common.scripts.SDNCAdapter; + +import org.onap.so.bpmn.mock.FileUtil + +@RunWith(MockitoJUnitRunner.class) +public class SDNCAdapterTest { + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + System.setProperty("jboss.qualified.host.name","myhost.com") + } + + + String workflowResponse = """ + + + testRequestId + 200 + OK + + + + FK/VLXM/003717//SW_INTERNET + + service-configuration-operation + activate + synccomplete + N + Layer3ServiceActivateRequest + SUPP + 2015-04-28T21:32:11.386Z + + + + ds + 8 + Mbps + + + + + + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + 255.255.252.1 + 192.168.1.15 + 28 + + + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + 255.255.252.2 + 192.168.1.15 + 28 + + + 255.255.252.3 + 192.168.1.15 + 28 + + + + N + Y + N + + 192.168.1.7 + + + 192.168.1.8 + + + 1.1.1.1 + 28 + + 192.168.1.5 + + 2.2.2.1 + + 192.168.1.6 + + 192.155.2.3 + + + 1.1.1.2 + 28 + + 192.168.1.6 + + 2.2.2.2 + + 192.168.1.7 + + 192.155.2.4 + + Y + + 1:5 + + + 1:6 + + + 4:4 + 28 + + 1:1 + + 3:3 + + 2:2 + + 0:0 + + + 4:4 + 28 + + 1:1 + + 3:3 + + 2:2 + + 0:0 + + + + N + Y + + 0.0.0.1 + 1 + Y + + 1 + + + 1 + + + + 0.0.0.2 + 2 + Y + + 2 + + + 2 + + + + : + 0 + Y + + 3 + + + 3 + + + + : + 1 + Y + + 4 + + + 4 + + + + + + 192.168.1.44 + 192.168.1.5 + 0 + + Y + N + + 192.168.1.45 + 192.168.1.6 + 28 + + + + Y + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + + + 0.0.0.1 + 0.0.0.1 + 0.0.0.1 + + + primary + 162.200.3.144 + 64 + 2001:1890:12e3:2da:: + 2620:0:10d0:f:ffff:ffff:ffff:fffe + 24 + 10.192.27.254 + + + 1 + 192.168.1.2 + 192.168.1.1 + 28 + + + 1 + 192.168.1.72 + 192.168.1.71 + 28 + + + 1 + 192.168.1.68 + 192.168.1.67 + 28 + + + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:3da:: + 28 + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:4da:: + 28 + + + + none + + + + AVPN + + 1 + Active + + + 2 + Standby + + + + hostname + activecode + OOB + + + + 1 + 1 + ZZ + JUNIPER + MODEL1 + 1 + 1 + 1 + 1 + 1 + + + 2 + 2 + HY + JUNIPER + MODEL2 + 2 + 2 + 2 + 2 + 2 + + + + + Layer3ServiceActivateRequest + 4281555 + 155415ab-b4a7-4382-b4c6-d17d9sm42855 + https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws + OMX + 1 + + + activate + https://localhost:8443/adapters/rest/SDNCNotify + 5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760 + + + MultiPoint + MTSNJA4LCP1 + AS/VLXM/003717//SW + + + FK/VLXM/003717//SW_INTERNET + ST E2E Test42855_1300004281555 + SDN-ETHERNET-INTERNET + + + 10 + Kbps + + 1 + 192.168.1.15 + 192.168.1.15 + 28 + + + 2 + 192.168.1.16 + 192.168.1.16 + 28 + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + + + + +""" + + String sdncAdapterRequest = """ + + + + + 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 + query + services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET + http://myhost.com:28080/mso/sdncAdapterCallbackServiceImpl + + + + + + 12570a36-7388-4c0a-bec4-189ce3kg9956 + GetLayer3ServiceDetailsRequest + OMX + + + SDN-ETHERNET-INTERNET + PD/VLXM/003717//SW_INTERNET + + + + """ + +def sdncAdapterResponse = """ + + + 39542e39-ccc3-4d1a-8b79-04ce88526613 + 404 + Error processing request to SDNC. Not Found. + https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist.] + + + +""" + +def workflowErrorResponse = """ + Received error from SDN-C: Error processing request to SDNC. Not Found. + https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist.] + 5300 + 404 + """ + +String workflowErrorResponse1 = """ + Invalid Callback Response from SDNC Adapter + 5300 + """ + +String enhancedCallbackRequestData = + """ + FK/VLXM/003717//SW_INTERNET + + service-configuration-operation + activate + synccomplete + N + Layer3ServiceActivateRequest + SUPP + 2015-04-28T21:32:11.386Z + + + + ds + 8 + Mbps + + + + + + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + 255.255.252.1 + 192.168.1.15 + 28 + + + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + 255.255.252.2 + 192.168.1.15 + 28 + + + 255.255.252.3 + 192.168.1.15 + 28 + + + + N + Y + N + + 192.168.1.7 + + + 192.168.1.8 + + + 1.1.1.1 + 28 + + 192.168.1.5 + + 2.2.2.1 + + 192.168.1.6 + + 192.155.2.3 + + + 1.1.1.2 + 28 + + 192.168.1.6 + + 2.2.2.2 + + 192.168.1.7 + + 192.155.2.4 + + Y + + 1:5 + + + 1:6 + + + 4:4 + 28 + + 1:1 + + 3:3 + + 2:2 + + 0:0 + + + 4:4 + 28 + + 1:1 + + 3:3 + + 2:2 + + 0:0 + + + + N + Y + + 0.0.0.1 + 1 + Y + + 1 + + + 1 + + + + 0.0.0.2 + 2 + Y + + 2 + + + 2 + + + + : + 0 + Y + + 3 + + + 3 + + + + : + 1 + Y + + 4 + + + 4 + + + + + + 192.168.1.44 + 192.168.1.5 + 0 + + Y + N + + 192.168.1.45 + 192.168.1.6 + 28 + + + + Y + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + + + 0.0.0.1 + 0.0.0.1 + 0.0.0.1 + + + primary + 162.200.3.144 + 64 + 2001:1890:12e3:2da:: + 2620:0:10d0:f:ffff:ffff:ffff:fffe + 24 + 10.192.27.254 + + + 1 + 192.168.1.2 + 192.168.1.1 + 28 + + + 1 + 192.168.1.72 + 192.168.1.71 + 28 + + + 1 + 192.168.1.68 + 192.168.1.67 + 28 + + + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:3da:: + 28 + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:4da:: + 28 + + + + none + + + + AVPN + + 1 + Active + + + 2 + Standby + + + + hostname + activecode + OOB + + + + 1 + 1 + ZZ + JUNIPER + MODEL1 + 1 + 1 + 1 + 1 + 1 + + + 2 + 2 + HY + JUNIPER + MODEL2 + 2 + 2 + 2 + 2 + 2 + + + + + Layer3ServiceActivateRequest + 4281555 + 155415ab-b4a7-4382-b4c6-d17d9sm42855 + https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws + OMX + 1 + + + activate + https://localhost:8443/adapters/rest/SDNCNotify + 5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760 + + + MultiPoint + MTSNJA4LCP1 + AS/VLXM/003717//SW + + + FK/VLXM/003717//SW_INTERNET + ST E2E Test42855_1300004281555 + SDN-ETHERNET-INTERNET + + + 10 + Kbps + + 1 + 192.168.1.15 + 192.168.1.15 + 28 + + + 2 + 192.168.1.16 + 192.168.1.16 + 28 + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + + + +""" + +def sdncAdapterResponseEmpty = +""" + +""" + +def sdncAdapterResponseError = +""" + + + 39542e39-ccc3-4d1a-8b79-04ce88526613 + 404 + Error processing request to SDNC. Not Found. + https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist.] + + +""" + + + @Test + public void testPreProcessRequest() { + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("sdncAdapterWorkflowRequest")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://someurl.someting.com:28080/mso/sdncAdapterCallbackServiceImpl") + when(mockExecution.getVariable("mso.use.qualified.host")).thenReturn("true") + + when(mockExecution.getProcessInstanceId()).thenReturn("745b1b50-e39e-4685-9cc8-c71f0bde8bf0") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","SDNCA_") + verify(mockExecution).setVariable("sdncAdapterResponse","") + verify(mockExecution).setVariable("asynchronousResponseTimeout",false) + verify(mockExecution).setVariable("continueListening",false) + verify(mockExecution).setVariable("BasicAuthHeaderValue","Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable("serviceConfigActivate",false) + verify(mockExecution).setVariable("SDNCA_requestId", "745b1b50-e39e-4685-9cc8-c71f0bde8bf0") + verify(mockExecution).setVariable("SDNCA_SuccessIndicator",false) + verify(mockExecution).setVariable("source","") + verify(mockExecution).setVariable("SDNCA_InterimNotify",false) + verify(mockExecution).setVariable("sdncAdapterRequest", sdncAdapterRequest) + } + + @Test + public void testProcessResponse() + { + String sdncAdapterCallbackResponse = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackResponse) + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.postProcessResponse(mockExecution) + +// MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() +// debugger.printInvocations(mockExecution) + + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") + verify(mockExecution).setVariable("enhancedCallbackRequestData",enhancedCallbackRequestData) + verify(mockExecution).setVariable("sdncAdapterResponse",workflowResponse) + verify(mockExecution).setVariable("continueListening",false) + + } + + @Test + public void testProcessResponse_ErrorCase_404() + { + String sdncAdapterCallbackErrorResponse = FileUtil.readResourceFile("sdncadaptercallbackrequest_404CallBack.xml"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackErrorResponse) + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.postProcessResponse(mockExecution) + + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") + verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseError) + verify(mockExecution).setVariable("enhancedCallbackRequestData", "") + verify(mockExecution).setVariable("continueListening",false) + + } + + @Test + public void testProcessResponse_ErrorCase_InvalidCallback() + { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn("

Service Unavailable

") + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.postProcessResponse(mockExecution) + + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") + verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseEmpty) + verify(mockExecution).setVariable("enhancedCallbackRequestData", "") + verify(mockExecution).setVariable("continueListening",false) + + } + + @Test + public void postProcessResponse() + { + + String SDNCAdapterCallbackRequest = + """ + + + 3bb02798-b344-4d28-9bca-1f029954d1c9 + 404 + Error processing request to SDNC. Not Found. + https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist ] + +""" + + String sdncAdapterResponse = + """ + + + 3bb02798-b344-4d28-9bca-1f029954d1c9 + 404 + Error processing request to SDNC. Not Found. + https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist ] + + +""" + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(SDNCAdapterCallbackRequest) + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.postProcessResponse(mockExecution) + + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") + verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponse) + verify(mockExecution).setVariable("enhancedCallbackRequestData", "") + verify(mockExecution).setVariable("continueListening",false) + + } + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy new file mode 100644 index 0000000000..803e2b03a3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy @@ -0,0 +1,191 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.* + +import org.junit.Before +import org.junit.Ignore +import org.junit.Test +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils + +import org.onap.so.bpmn.mock.FileUtil + +public class SDNCAdapterUtilsTest { + + private def map + private ExecutionEntity svcex + private WorkflowException wfex + private AbstractServiceTaskProcessor tp + private String resp + private SDNCAdapterUtils utils + + @Before + public void init() + { + map = new HashMap() + svcex = mock(ExecutionEntity.class) + wfex = null + tp = new AbstractServiceTaskProcessor() { + @Override + public void preProcessRequest(DelegateExecution execution) { + } + }; + utils = new SDNCAdapterUtils(tp) + + // svcex gets its variables from "map" + when(svcex.getVariable(any())).thenAnswer( + { invocation -> + return map.get(invocation.getArgumentAt(0, String.class)) }) + + // svcex puts its variables into "map" + when(svcex.setVariable(any(), any())).thenAnswer( + { invocation -> + return map.put( + invocation.getArgumentAt(0, String.class), + invocation.getArgumentAt(1, String.class)) }) + + map.put("isDebugLogEnabled", "true") + map.put("prefix", "mypfx-") + map.put("testProcessKey", "mykey") + } + + @Test + public void testValidateSDNCResponse_Success_NoCode() { + resp = """""" + + utils.validateSDNCResponse(svcex, resp, wfex, true) + + assertEquals(true, map.get("mypfx-sdncResponseSuccess")) + assertEquals("0", map.get("mypfx-sdncRequestDataResponseCode")) + assertFalse(map.containsKey("WorkflowException")) + } + + @Test + public void testValidateSDNCResponse_200() { + utils.validateSDNCResponse(svcex, makeResp("200", "OK", ""), wfex, true) + + assertEquals(true, map.get("mypfx-sdncResponseSuccess")) + assertEquals("200", map.get("mypfx-sdncRequestDataResponseCode")) + assertFalse(map.containsKey("WorkflowException")) + } + + @Test + public void testValidateSDNCResponse_408() { + try { + utils.validateSDNCResponse(svcex, makeResp("408", "failed", ""), wfex, true) + + // this has been commented out as, currently, the code doesn't + // throw an exception in this case +// fail("missing exception") + + } catch(BpmnError ex) { + ex.printStackTrace() + } + + assertEquals(false, map.get("mypfx-sdncResponseSuccess")) + assertEquals("408", map.get("mypfx-sdncRequestDataResponseCode")) + + wfex = map.get("WorkflowException") + assertNotNull(wfex) + + assertEquals(5320, wfex.getErrorCode()) + assertEquals("Received error from SDN-C: failed", wfex.getErrorMessage()) + } + + @Test + public void testValidateSDNCResponse_408_200() { + + utils.validateSDNCResponse(svcex, makeResp("408", "failed", makeReq("200", "ok")), wfex, true) + + assertEquals(true , map.get("mypfx-sdncResponseSuccess")) + assertEquals("200", map.get("mypfx-sdncRequestDataResponseCode")) + assertFalse(map.containsKey("WorkflowException")) + } + + @Test + public void testValidateSDNCResponse_408_200_WithEmbeddedLt() { + + utils.validateSDNCResponse(svcex, makeResp("408", "failed", makeReq("200", " message")), wfex, true) + + assertEquals(true, map.get("mypfx-sdncResponseSuccess")) + assertEquals("200", map.get("mypfx-sdncRequestDataResponseCode")) + assertFalse(map.containsKey("WorkflowException")) + } + + @Test + public void testUpdateHomingInfo() { + String actual = utils.updateHomingInfo(null, "AIC3.0") + println actual + assertEquals("AIC3.0", actual) + } + + @Test + public void testUpdateHomingInfo2() { + String homingInfo = "TESTCLLI" + String actual = utils.updateHomingInfo(homingInfo, "AIC3.0") + println actual + assertEquals("TESTCLLIAIC3.0", actual) + } + + private String makeResp(String respcode, String respmsg, String reqdata) { + def rc = respcode + def rm = respmsg + + return """ + + + + myreq + ${MsoUtils.xmlEscape(rc)} + ${MsoUtils.xmlEscape(rm)} + + ${reqdata} + + +""" + + } + + private String makeReq(String respcode, String respmsg) { + def rc = respcode + def rm = respmsg + + def output = """ + + 8b46e36e-b44f-4085-9404-427be1bc8a3 + ${MsoUtils.xmlEscape(rc)} + ${MsoUtils.xmlEscape(rm)} + Y + +""" + output = output + + return """${MsoUtils.xmlEscape(output)}""" + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy new file mode 100644 index 0000000000..b093aaa491 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy @@ -0,0 +1,196 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.AllottedResource +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.VnfResource + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class SniroHomingV1Test { + String subsInfo = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}" + ServiceDecomposition serviceDecomp + + { + serviceDecomp = new ServiceDecomposition("{\"serviceResources\":{}}", "123") + ModelInfo modelInfo = new ModelInfo() + serviceDecomp.modelInfo = modelInfo + + AllottedResource allottedResource = new AllottedResource() + allottedResource.setModelInfo(modelInfo) + List allottedResourceList = new ArrayList() + allottedResourceList.add(allottedResource) + + VnfResource vnfResource = new VnfResource() + vnfResource.setModelInfo(modelInfo) + List vnfResourceList = new ArrayList() + vnfResourceList.add(vnfResource) + + serviceDecomp.serviceAllottedResources = allottedResourceList + serviceDecomp.setVnfResources(vnfResourceList) + } + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + + @Before + public void init() { + MockitoAnnotations.initMocks(this) + } + + @Test + public void testCallSniro() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("msoRequestId")).thenReturn("12345") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("subscriberInfo")).thenReturn(subsInfo) + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomp) + when(mockExecution.getVariable("mso.sniro.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("mso.adapters.workflow.message.endpoint")).thenReturn('http://localhost:18080/workflows/messages/message/') + when(mockExecution.getVariable("mso.service.agnostic.sniro.endpoint")).thenReturn("/sniro") + when(mockExecution.getVariable("mso.service.agnostic.sniro.host")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.GenericPutVnf.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + + SniroHomingV1 obj = new SniroHomingV1() + obj.callSniro(mockExecution) + + Mockito.verify(mockExecution, times(10)).setVariable(captor.capture(), captor.capture()) + Assert.assertEquals(200, captor.getAllValues().get(17)) + + } + + @Test + public void testCallSniroMissingAuth() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("msoRequestId")).thenReturn("12345") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("subscriberInfo")).thenReturn(subsInfo) + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomp) + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("mso.adapters.workflow.message.endpoint")).thenReturn('http://localhost:18080/workflows/messages/message/') + when(mockExecution.getVariable("mso.service.agnostic.sniro.endpoint")).thenReturn("/sniro") + when(mockExecution.getVariable("mso.service.agnostic.sniro.host")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.GenericPutVnf.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + + try { + SniroHomingV1 obj = new SniroHomingV1() + obj.callSniro(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + Mockito.verify(mockExecution, times(4)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(401, workflowException.getErrorCode()) + Assert.assertEquals("Internal Error - BasicAuth value null", workflowException.getErrorMessage()) + } + + @Test + public void testCallSniroHostNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("msoRequestId")).thenReturn("12345") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("subscriberInfo")).thenReturn(subsInfo) + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomp) + when(mockExecution.getVariable("mso.sniro.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("mso.adapters.workflow.message.endpoint")).thenReturn('http://localhost:18080/workflows/messages/message/') + when(mockExecution.getVariable("mso.service.agnostic.sniro.endpoint")).thenReturn("/sniro") + when(mockExecution.getVariable("mso.service.agnostic.sniro.host")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.GenericPutVnf.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + try { + SniroHomingV1 obj = new SniroHomingV1() + obj.callSniro(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + Mockito.verify(mockExecution, times(9)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(2500, workflowException.getErrorCode()) + Assert.assertEquals("Internal Error - Occured in Homing CallSniro: org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("Homing") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("Homing") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("Homing") + when(mockExecution.getProcessInstanceId()).thenReturn("Homing") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + + private static void mockData() { + stubFor(post(urlMatching(".*/sniro")) + .willReturn(aResponse() + .withStatus(200) + .withBody(""))) + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtilTest.groovy new file mode 100644 index 0000000000..52f59a3fad --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtilTest.groovy @@ -0,0 +1,201 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.junit.Assert +import org.junit.Ignore +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; + + + +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.TrinityExceptionUtil; +@RunWith(MockitoJUnitRunner.class) +import org.junit.Test + +class TrinityExceptionUtilTest { + + def aotsFault =""" + xml:space + String + http://test.com + + + + 400 + bad stuff + + + String + *** ERROR *** + String + String + String + String + + String + String + + String + String + String + String + + + + + + String + *** ERROR *** + String + String + String + String + String + String + String + + +""" + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + @Ignore + public void testMapAAIExceptionTCommonException() { + + + + String restFault = """ + + + +SVC3002 +Error writing output performing %1 on %2 (msg=%3) (ec=%4) + +PUTcustomer +SubName01 +Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id] +ERR.5.4.5105 + + + + + """ + def errorString = """ + +SVC3002 +Error writing output performing %1 on %2 (msg=%3) (ec=%4) + +PUTcustomer +SubName01 +Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id] +ERR.5.4.5105 + + +""" as String + + + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + TrinityExceptionUtil util = new TrinityExceptionUtil() + Assert.assertEquals(errorString, util.mapAAIExceptionTCommonException(restFault, mockExecution)) + } + + + + + @Test + public void testBuildException() { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("test_ResponseCode")).thenReturn("400") + ArrayList msgVars = new ArrayList() + msgVars.add("var1") + msgVars.add("var2") + when(mockExecution.getVariable("test_errVariables")).thenReturn(msgVars) + + + TrinityExceptionUtil util = new TrinityExceptionUtil() + String msg = "Bad request" + String errorString = """ + + SVC2000 + The following service error occurred: %1. Error code is %2. + var1 + var2 + +""" + Assert.assertEquals(errorString, util.buildException(msg, mockExecution)) + } + + @Test + public void testMapAOTSExecptionToCommonException() { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("test_ResponseCode")).thenReturn("400") + + TrinityExceptionUtil util = new TrinityExceptionUtil() + String errorString = """ + + SVC2000 + The following service error occurred: %1. Error code is %2. + Received error from AOTS: bad stuff + 400 + +""" + Assert.assertEquals(errorString, util.mapAOTSExecptionToCommonException(aotsFault, mockExecution)) + } + + + @Test + public void testParseError() { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + String errorString = "The following service error occurred: %1. Error code is %2." + ArrayList msgVars = new ArrayList() + msgVars.add("var1") + msgVars.add("var2") + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("test_errTxt")).thenReturn(errorString) + when(mockExecution.getVariable("test_errVariables")).thenReturn(msgVars) + + TrinityExceptionUtil util = new TrinityExceptionUtil() + + Assert.assertEquals("The following service error occurred: var1. Error code is var2.", util.parseError(mockExecution)) +} + + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy new file mode 100644 index 0000000000..e0166f3602 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy @@ -0,0 +1,172 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.bpmn.mock.StubResponseAAI + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Matchers.any +import static org.mockito.Matchers.refEq +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class UpdateAAIGenericVnfTest { + + String getVfModuleResponse = FileUtil.readResourceFile("__files/VfModularity/GenericVnf.xml") + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + void testGetGenericVnf() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UAAIGenVnf_vnfId")).thenReturn("skask") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIGenericVnf.aai.version")).thenReturn('8') + + StubResponseAAI.MockAAIVfModule() + UpdateAAIGenericVnf obj = new UpdateAAIGenericVnf() + obj.getGenericVnf(mockExecution) + + Mockito.verify(mockExecution).setVariable("UAAIGenVnf_getGenericVnfResponseCode", 200) + } + + @Test + void testGetGenericVnfEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UAAIGenVnf_vnfId")).thenReturn("skask") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIGenericVnf.aai.version")).thenReturn('8') + + StubResponseAAI.MockAAIVfModule() + try { + UpdateAAIGenericVnf obj = new UpdateAAIGenericVnf() + obj.getGenericVnf(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + WorkflowException exception = new WorkflowException("UpdateAAIGenericVnf", 9999, "org.apache.http.client.ClientProtocolException") + Mockito.verify(mockExecution).setVariable("WorkflowException", refEq(exception, any(WorkflowException.class))) + Mockito.verify(mockExecution).setVariable("UAAIGenVnf_getGenericVnfResponseCode", 500) + Mockito.verify(mockExecution).setVariable("UAAIGenVnf_getGenericVnfResponse", "AAI GET Failed:null") + } + + @Test + void testUpdateGenericVnf() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UAAIGenVnf_vnfId")).thenReturn("skask") + when(mockExecution.getVariable("UAAIGenVnf_getGenericVnfResponse")).thenReturn(getVfModuleResponse) + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIGenericVnf.aai.version")).thenReturn('8') + + stubFor(patch(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) + .willReturn(aResponse() + .withStatus(200))) + UpdateAAIGenericVnf obj = new UpdateAAIGenericVnf() + obj.updateGenericVnf(mockExecution) + + Mockito.verify(mockExecution).setVariable("UAAIGenVnf_updateGenericVnfResponseCode", 200) + Mockito.verify(mockExecution).setVariable("UAAIGenVnf_updateGenericVnfResponse", "") + } + + @Test + void testUpdateGenericVnfEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UAAIGenVnf_vnfId")).thenReturn("skask") + when(mockExecution.getVariable("UAAIGenVnf_getGenericVnfResponse")).thenReturn(getVfModuleResponse) + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIGenericVnf.aai.version")).thenReturn('8') + + stubFor(patch(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) + .willReturn(aResponse() + .withStatus(200))) + + try { + UpdateAAIGenericVnf obj = new UpdateAAIGenericVnf() + obj.updateGenericVnf(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + WorkflowException exception = new WorkflowException("UpdateAAIGenericVnf", 9999, "org.apache.http.client.ClientProtocolException") + Mockito.verify(mockExecution).setVariable("WorkflowException", refEq(exception, any(WorkflowException.class))) + Mockito.verify(mockExecution).setVariable("UAAIGenVnf_updateGenericVnfResponseCode", 500) + Mockito.verify(mockExecution).setVariable("UAAIGenVnf_updateGenericVnfResponse", "AAI PATCH Failed:null") + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("UpdateAAIGenericVnf") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("UpdateAAIGenericVnf") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("UpdateAAIGenericVnf") + when(mockExecution.getProcessInstanceId()).thenReturn("UpdateAAIGenericVnf") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy new file mode 100644 index 0000000000..d2f9095e2d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy @@ -0,0 +1,175 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.bpmn.mock.StubResponseAAI + +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class UpdateAAIVfModuleTest { + def prefix = "UAAIVfMod_" + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + void testGetVfModule() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIVfModule.aai.version")).thenReturn('8') + + StubResponseAAI.MockAAIVfModule() + UpdateAAIVfModule obj = new UpdateAAIVfModule() + obj.getVfModule(mockExecution) + + verify(mockExecution).setVariable(prefix + "getVfModuleResponseCode", 200) + } + + @Test + void testGetVfModuleEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIVfModule.aai.version")).thenReturn('8') + + StubResponseAAI.MockAAIVfModule() + try { + UpdateAAIVfModule obj = new UpdateAAIVfModule() + obj.getVfModule(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getAllValues().get(1) + Assert.assertEquals(9999, workflowException.getErrorCode()) + Assert.assertEquals("org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) + } + + @Test + void testUpdateVfModule() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIVfModule.aai.version")).thenReturn('8') + + String getVfModuleResponse = FileUtil.readResourceFile("__files/VfModularity/GenericVnf.xml") + when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(getVfModuleResponse) + StubResponseAAI.MockAAIVfModule() + UpdateAAIVfModule obj = new UpdateAAIVfModule() + obj.updateVfModule(mockExecution) + + verify(mockExecution).setVariable(prefix + "updateVfModuleResponseCode", 200) + } + + @Test + void testUpdateVfModuleEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIVfModule.aai.version")).thenReturn('8') + + String getVfModuleResponse = FileUtil.readResourceFile("__files/VfModularity/GenericVnf.xml") + when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(getVfModuleResponse) + StubResponseAAI.MockAAIVfModule() + try { + UpdateAAIVfModule obj = new UpdateAAIVfModule() + obj.updateVfModule(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getAllValues().get(1) + Assert.assertEquals(9999, workflowException.getErrorCode()) + Assert.assertEquals("org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("UpdateAAIVfModule") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("UpdateAAIVfModule") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("UpdateAAIVfModule") + when(mockExecution.getProcessInstanceId()).thenReturn("UpdateAAIVfModule") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VidUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VidUtilsTest.groovy new file mode 100644 index 0000000000..1ab049571a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VidUtilsTest.groovy @@ -0,0 +1,969 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts; + +import static org.mockito.Mockito.* + +import org.onap.so.bpmn.common.scripts.VidUtils; +import org.onap.so.bpmn.core.WorkflowException + +import groovy.json.JsonSlurper + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution; + +import static org.junit.Assert.*; + +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.junit.Before +import org.junit.Rule; +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; +import org.junit.Before; +import org.junit.Test; + +@RunWith(MockitoJUnitRunner.class) + +class VidUtilsTest { + + def vfModuleReqJson = """ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "STMTN5MMSC21-MMSC::model-1-0", + "modelVersion": "1", + "modelCustomizationUuid": "ee6478e5-ea33-3346-ac12-ab121484a3fe" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "MDTWNJ21", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "PCRF::module-0-2", + "source": "VID", + "suppressRollback": true + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", + "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12..base..module-0", + "modelVersion": "1" + } + } + }, + { + "relatedInstance": { + "instanceId": "123456", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "SERVICE_MODEL_NAME", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "skask", + "instanceName": "skask-test", + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "skask", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelInstanceName": "vSAMP12 1" + } + } + } + ], + "requestParameters": { + "userParams": [ + { + "name": "vnfName", + "value": "STMTN5MMSC20" + }, + { + "name": "tenantId", + "value": "vpe-tenant-123" + }, + { + "name": "aicCloudRegion", + "value": "MDTWNJ21" + }, + { + "name": "isAvpnService", + "value": "true" + }, + { + "name": "asn", + "value": "asn-1234" + }, + { + "name": "releaseForAero", + "value": "release-for-aero-something" + }, + { + "name": "aicClli", + "value": "MTJWNJA4LCP" + }, + { + "name": "svcProviderPartNumber", + "value": "svc-provide-number-1234" + } + ] + } + } +} +""" + def bpmnReq1 = """ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1", + "modelInstanceName": "vSAMP12" + } + } + } + ], + "requestParameters": { + "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "userParams": [ + {"name": "vnfName", "value": "STMTN5MMSC20" }, + {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, + {"name": "vnfNmInformation", "value": "" }, + {"name": "vnfType", "value": "pcrf-capacity" }, + {"name": "vnfId", "value": "skask" }, + {"name": "vnfStackId", "value": "slowburn" }, + {"name": "vnfStatus", "value": "created" }, + {"name": "aicCloudRegion", "value": "MDTWNJ21" }, + {"name": "availabilityZone", "value": "slcp3-esx-az01" }, + {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, + {"name": "vmName", "value": "slcp34246vbc246ceb" }, + {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, + {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" } + ] + } + } +} +""" + + def vidUtilResp1 = """ + + CREATE_VF_MODULE_VOL + VID + test-service-instance-id-123 + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + true + + + + STMTN5MMSC20 + US1117MTSNJVBR0246 + + pcrf-capacity + skask + slowburn + created + MDTWNJ21 + slcp3-esx-az01 + VLAN-OAM-1323 + slcp34246vbc246ceb + 970cd2b9-7f09-4a12-af47-182ea38ba1f0 + 545cc2c3-1930-4100-b534-5d82d0e12bb6 + + +""" + + def bpmnReq2 = """ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1", + "modelInstanceName": "vSAMP12" + } + } + } + ] + } +} +""" + + def bpmnReqJsonVolumeSuppressRollbackTrue = """ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": true + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1", + "modelInstanceName": "vSAMP12" + } + } + } + ] + } +} +""" + +def bpmnReqJsonVolumeSuppressRollbackFalse = """ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1", + "modelInstanceName": "vSAMP12" + } + } + } + ] + } +} +""" + +def bpmnReqJsonVolumeSuppressRollbackNone = """ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1", + "modelInstanceName": "vSAMP12" + } + } + } + ] + } +} +""" + + def bpmnReqJsonVfModuleSuppressRollbackTrue = """ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "PCRF::module-0-2", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", +"instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", +"modelInfo": { +"modelType": "volumeGroup", +"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12..base..module-0", +"modelVersion": "1" +} +} +}, +{ +"relatedInstance": { +"instanceId": "123456", +"modelInfo": { +"modelType": "service", +"modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", +"modelName": "SERVICE_MODEL_NAME", +"modelVersion": "1.0" +} +} +}, +{ +"relatedInstance": { +"instanceId": "skask", +"instanceName": "skask-test", +"modelInfo": { +"modelType": "vnf", +"modelInvariantUuid": "skask", +"modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelInstanceName": "vSAMP12 1" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} +} +""" + +def bpmnReqJsonVfModuleSuppressRollbackFalse = """ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "PCRF::module-0-2", +"source": "VID", +"suppressRollback": false +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", +"instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", +"modelInfo": { +"modelType": "volumeGroup", +"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12..base..module-0", +"modelVersion": "1" +} +} +}, +{ +"relatedInstance": { +"instanceId": "123456", +"modelInfo": { +"modelType": "service", +"modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", +"modelName": "SERVICE_MODEL_NAME", +"modelVersion": "1.0" +} +} +}, +{ +"relatedInstance": { +"instanceId": "skask", +"instanceName": "skask-test", +"modelInfo": { +"modelType": "vnf", +"modelInvariantUuid": "skask", +"modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelInstanceName": "vSAMP12 1" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} +} +""" + +def bpmnReqJsonVfModuleSuppressRollbackNone = """ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "PCRF::module-0-2", +"source": "VID" +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", +"instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", +"modelInfo": { +"modelType": "volumeGroup", +"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12..base..module-0", +"modelVersion": "1" +} +} +}, +{ +"relatedInstance": { +"instanceId": "123456", +"modelInfo": { +"modelType": "service", +"modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", +"modelName": "SERVICE_MODEL_NAME", +"modelVersion": "1.0" +} +} +}, +{ +"relatedInstance": { +"instanceId": "skask", +"instanceName": "skask-test", +"modelInfo": { +"modelType": "vnf", +"modelInvariantUuid": "skask", +"modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelInstanceName": "vSAMP12 1" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} +} +""" + def vidUtilResp2 = """ + + CREATE_VF_MODULE_VOL + VID + test-service-instance-id-123 + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + + true + + + + +""" + +def vidUtilVolumeRespBackoutOnFailureFalse = """ + + CREATE_VF_MODULE_VOL + VID + test-service-instance-id-123 + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + + false + + + + +""" + +def vidUtilVolumeRespBackoutOnFailureTrue = """ + + CREATE_VF_MODULE_VOL + VID + test-service-instance-id-123 + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + + true + + + + +""" + +def vidUtilVolumeRespBackoutOnFailureEmpty = """ + + CREATE_VF_MODULE_VOL + VID + test-service-instance-id-123 + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + + + + + + +""" + +def vidUtilVfModuleRespBackoutOnFailureFalse = """ + + test-request-id-123 + CREATE_VF_MODULE + VID + test-service-instance-id-123 + + + skask-test + test-vnf-type-123 + test-vnf-id-123 + test-volume-group-id-123 + test-vf-module-id-123 + PCRF::module-0-2 + STMTN5MMSC21-MMSC::model-1-0 + + false + 1.0 + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + + false + ff5256d2-5a33-55df-13ab-12abad84e7ff + fe6478e5-ea33-3346-ac12-ab121484a3fe + + + +""" + +def vidUtilVfModuleRespBackoutOnFailureTrue = """ + + test-request-id-123 + CREATE_VF_MODULE + VID + test-service-instance-id-123 + + + skask-test + test-vnf-type-123 + test-vnf-id-123 + test-volume-group-id-123 + test-vf-module-id-123 + PCRF::module-0-2 + STMTN5MMSC21-MMSC::model-1-0 + + false + 1.0 + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + + true + ff5256d2-5a33-55df-13ab-12abad84e7ff + fe6478e5-ea33-3346-ac12-ab121484a3fe + + + +""" + +def vidUtilVfModuleRespBackoutOnFailureEmpty = """ + + test-request-id-123 + CREATE_VF_MODULE + VID + test-service-instance-id-123 + + + skask-test + test-vnf-type-123 + test-vnf-id-123 + test-volume-group-id-123 + test-vf-module-id-123 + PCRF::module-0-2 + STMTN5MMSC21-MMSC::model-1-0 + + false + 1.0 + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + + + ff5256d2-5a33-55df-13ab-12abad84e7ff + fe6478e5-ea33-3346-ac12-ab121484a3fe + + + +""" + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + + } + + @Test + public void test() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReq1) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') + print xmlReq + assertEquals(vidUtilResp1, xmlReq) + } + + //@Test + public void testVfModule() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(vfModuleReqJson) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVfModuleRequest(null, reqMap, "CREATE_VF_MODULE", "test-service-instance-id-123") + print xmlReq + assertTrue(true) + } + + @Test + public void testNoRequestParams() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReq2) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') + + assertEquals(vidUtilResp2, xmlReq) + } + + @Test + public void testVfModuleVolumeRollbackTrue() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVolumeSuppressRollbackTrue) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') + + assertEquals(vidUtilVolumeRespBackoutOnFailureFalse, xmlReq) + } + + @Test + public void testVfModuleVolumeRollbackFalse() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVolumeSuppressRollbackFalse) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') + + assertEquals(vidUtilVolumeRespBackoutOnFailureTrue, xmlReq) + } + + @Test + public void testVfModuleVolumeRollbackNone() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVolumeSuppressRollbackNone) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') + + assertEquals(vidUtilVolumeRespBackoutOnFailureEmpty, xmlReq) + } + + @Test + public void testVfModuleRollbackTrue() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVfModuleSuppressRollbackTrue) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("vnfType")).thenReturn('test-vnf-type-123') + when(mockExecution.getVariable("vnfId")).thenReturn('test-vnf-id-123') + when(mockExecution.getVariable("vfModuleId")).thenReturn('test-vf-module-id-123') + when(mockExecution.getVariable("volumeGroupId")).thenReturn('test-volume-group-id-123') + when(mockExecution.getVariable("isBaseVfModule")).thenReturn('false') + when(mockExecution.getVariable("mso-request-id")).thenReturn('test-request-id-123') + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVfModuleRequest(mockExecution, reqMap, 'CREATE_VF_MODULE', 'test-service-instance-id-123') + + println 'ggg->' + xmlReq + assertEquals(vidUtilVfModuleRespBackoutOnFailureFalse, xmlReq) + } + + @Test + public void testVfModuleRollbackFalse() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVfModuleSuppressRollbackFalse) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("vnfType")).thenReturn('test-vnf-type-123') + when(mockExecution.getVariable("vnfId")).thenReturn('test-vnf-id-123') + when(mockExecution.getVariable("vfModuleId")).thenReturn('test-vf-module-id-123') + when(mockExecution.getVariable("volumeGroupId")).thenReturn('test-volume-group-id-123') + when(mockExecution.getVariable("isBaseVfModule")).thenReturn('false') + when(mockExecution.getVariable("mso-request-id")).thenReturn('test-request-id-123') + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVfModuleRequest(mockExecution, reqMap, 'CREATE_VF_MODULE', 'test-service-instance-id-123') + + println 'ggg->' + xmlReq + assertEquals(vidUtilVfModuleRespBackoutOnFailureTrue, xmlReq) + } + + @Test + public void testVfModuleRollbackNone() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVfModuleSuppressRollbackNone) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("vnfType")).thenReturn('test-vnf-type-123') + when(mockExecution.getVariable("vnfId")).thenReturn('test-vnf-id-123') + when(mockExecution.getVariable("vfModuleId")).thenReturn('test-vf-module-id-123') + when(mockExecution.getVariable("volumeGroupId")).thenReturn('test-volume-group-id-123') + when(mockExecution.getVariable("isBaseVfModule")).thenReturn('false') + when(mockExecution.getVariable("mso-request-id")).thenReturn('test-request-id-123') + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVfModuleRequest(mockExecution, reqMap, 'CREATE_VF_MODULE', 'test-service-instance-id-123') + + println 'ggg->' + xmlReq + assertEquals(vidUtilVfModuleRespBackoutOnFailureEmpty, xmlReq) + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy new file mode 100644 index 0000000000..22c8e297ca --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy @@ -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.bpmn.common.scripts + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.mock.FileUtil + +import static org.mockito.Mockito.* +import static org.junit.Assert.*; + +@RunWith(MockitoJUnitRunner.class) +public class VnfAdapterRestV1Test { + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + + @Test + public void testPreProcessRequest() { + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfadapter_request.xml"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("VNFREST_") + when(mockExecution.getVariable("mso-request-id")).thenReturn("testMsoRequestId") + when(mockExecution.getVariable("VNFREST_Request")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.vnf.rest.endpoint")).thenReturn("http://localhost:18080/vnfs/rest/v1/vnfs") + + when(mockExecution.getVariable("mso.adapters.sdnc.timeout")).thenReturn("PT5M") + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") + + + VnfAdapterRestV1 vnfAdapterRestV1 = new VnfAdapterRestV1() + vnfAdapterRestV1.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","VNFREST_") + + verify(mockExecution).setVariable("VNFREST_SuccessIndicator",false) + verify(mockExecution).setVariable("VNFREST_requestType","createVfModuleRequest") + verify(mockExecution).setVariable("VNFAResponse_CORRELATOR","8892cffa-3514-45d4-b2b0-0fde9a96e323-1511813289000") + verify(mockExecution).setVariable("VNFREST_vnfAdapterMethod","POST") + verify(mockExecution).setVariable("VNFREST_notificationUrl","http://localhost:18080/mso/WorkflowMessage/VNFAResponse/8892cffa-3514-45d4-b2b0-0fde9a96e323-1511813289000") + verify(mockExecution).setVariable("VNFREST_vnfAdapterUrl","http://localhost:18080/vnfs/rest/v1/vnfs/6d2e2469-8708-47c3-a0d4-73fa28a8a50b/vf-modules") + + } + + def rollbackReq = """ + + + 8a07b246-155e-4b08-b56e-76e98a3c2d66 + phmaz401me6-vpevre-VOLUMEGROUP/dbd560b6-b03f-4a17-92e7-8942459a60c1 + mtrnj1b + cfb5e0a790374c9a98a1c0d2044206a7 + true + + 1e1a72ca-7300-4ac4-b718-30351f3b6845 + 15eb2c68-f771-4030-b185-cff179fdad44 + + 683ca1ac-2145-4a00-9484-20d48bd701aa + + true + http://localhost:8080/mso/WorkflowMessage/VNFAResponse/683ca1ac-2145-4a00-9484-20d48bd701aa + +""" + + @Test + public void testGetVolumeGroupId() { + Node root = new XmlParser().parseText(rollbackReq) + VnfAdapterRestV1 vnfAdapterRestV1 = new VnfAdapterRestV1() + def volGrpId = vnfAdapterRestV1.getVolumeGroupIdFromRollbackRequest(root) + assertEquals('8a07b246-155e-4b08-b56e-76e98a3c2d66', volGrpId) + } + + + @Test + public void testGetMessageId() { + Node root = new XmlParser().parseText(rollbackReq) + + VnfAdapterRestV1 p = new VnfAdapterRestV1() + def messageId = p.getMessageIdForVolumeGroupRollback(root) + assertEquals('683ca1ac-2145-4a00-9484-20d48bd701aa', messageId) + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/IgnoreNamedElementsDifferenceListener.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/IgnoreNamedElementsDifferenceListener.groovy new file mode 100644 index 0000000000..9c38634885 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/IgnoreNamedElementsDifferenceListener.groovy @@ -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.bpmn.common.scripts.utils + +import org.custommonkey.xmlunit.Difference +import org.custommonkey.xmlunit.DifferenceConstants +import org.custommonkey.xmlunit.DifferenceListener +import org.w3c.dom.Node + +class IgnoreNamedElementsDifferenceListener implements DifferenceListener { + private Set blackList = new HashSet(); + + public IgnoreNamedElementsDifferenceListener(String ... ignoreTags) { + for (String name : ignoreTags) { + blackList.add(name); + } + } + + public int differenceFound(Difference difference) { + if (difference.getId() == DifferenceConstants.TEXT_VALUE_ID) { + if (blackList.contains(difference.getControlNodeDetail().getNode().getParentNode().getNodeName())) { + return DifferenceListener.RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL; + } + } + + return DifferenceListener.RETURN_ACCEPT_DIFFERENCE; + } + + + public void skippedComparison(Node node, Node node1) { + + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/XmlComparator.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/XmlComparator.groovy new file mode 100644 index 0000000000..e1c86edd90 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/XmlComparator.groovy @@ -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.bpmn.common.scripts.utils + +import org.custommonkey.xmlunit.DetailedDiff +import org.custommonkey.xmlunit.XMLUnit +import org.junit.Assert + + +class XmlComparator { + + public static void assertXMLEquals(String expectedXML, String actualXML, String ... ignoreTags ) throws Exception { + XMLUnit.setIgnoreWhitespace(true); + XMLUnit.setIgnoreAttributeOrder(true); + + DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expectedXML, actualXML)); + + diff.overrideDifferenceListener(new IgnoreNamedElementsDifferenceListener(ignoreTags)); + + List allDifferences = diff.getAllDifferences(); + Assert.assertEquals("Differences found: "+ diff.toString(), 0, allDifferences.size()); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy deleted file mode 100644 index b4b2b951b2..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy +++ /dev/null @@ -1,385 +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.bpmn.common.scripts; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.* - -import org.openecomp.mso.rest.HttpHeader -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.junit.Before -import org.openecomp.mso.bpmn.common.scripts.AaiUtil; -import org.junit.Rule; -import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.Before; -import org.junit.Test; -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl -import org.camunda.bpm.engine.repository.ProcessDefinition - -@RunWith(MockitoJUnitRunner.class) -class AaiUtilTest extends MsoGroovyTest { - - @Test - public void testGetVersionDefault() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') - assertEquals('8', version) - } - - @Test - public void testGetVersionResourceSpecific() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_l3_network_version")).thenReturn('7') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') - assertEquals('7', version) - } - - @Test - public void testGetVersionFlowSpecific() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_custom_CreateAAIVfModule_aai_version")).thenReturn('6') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_l3_network_version")).thenReturn('7') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') - assertEquals('6', version) - } - - @Test(expected=java.lang.Exception.class) - public void testGetVersionNotDefined() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') - } - - @Test - public void testGetUriDefaultVersion() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getUri(mockExecution, 'l3-network') - assertEquals('/aai/v8/network/l3-networks/l3-network', uri) - } - - @Test - public void testGetUriFlowAndResourceSpecific() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_CreateAAIVfModule_aai_l3_network_uri")).thenReturn('/aai/v6/network/l3-networks/l3-network') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getUri(mockExecution, 'l3-network') - assertEquals('/aai/v6/network/l3-networks/l3-network', uri) - } - - @Test - public void testGetNetworkGenericVnfEndpoint() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_vnf_uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') - when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def endpoint = aaiUtil.getNetworkGenericVnfEndpoint(mockExecution) - assertEquals('http://localhost:28090/aai/v8/network/generic-vnfs/generic-vnf', endpoint) - } - - @Test - public void testGetNetworkGenericVnfUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_vnf_uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkGenericVnfUri(mockExecution) - assertEquals('/aai/v8/network/generic-vnfs/generic-vnf', uri) - } - - @Test - public void testGetNetworkVpnBindingUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vpn_binding_uri")).thenReturn('/aai/v8/network/vpn-bindings/vpn-binding') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkVpnBindingUri(mockExecution) - assertEquals('/aai/v8/network/vpn-bindings/vpn-binding', uri) - } - - @Test - public void testGetNetworkPolicyUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_network_policy_uri")).thenReturn('/aai/v8/network/network-policies/network-policy') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkPolicyUri(mockExecution) - assertEquals('/aai/v8/network/network-policies/network-policy', uri) - } - - @Test - public void testGetNetworkTableReferencesUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_route_table_reference_uri")).thenReturn('/aai/v8/network/route-table-references/route-table-reference') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkTableReferencesUri(mockExecution) - assertEquals('/aai/v8/network/route-table-references/route-table-reference', uri) - } - - @Test - public void testGetNetworkVceUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vce_uri")).thenReturn('/aai/v8/network/vces/vce') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkVceUri(mockExecution) - assertEquals('/aai/v8/network/vces/vce', uri) - } - - @Test - public void testGetNetworkL3NetworkUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) - assertEquals('/aai/v8/network/l3-networks/l3-network', uri) - } - - @Test - public void testGetBusinessCustomerUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_customer_uri")).thenReturn('/aai/v8/business/customers/customer') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getBusinessCustomerUri(mockExecution) - assertEquals('/aai/v8/business/customers/customer', uri) - } - - @Test - public void testGetCloudInfrastructureCloudRegionEndpoint() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic') - when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(mockExecution) - assertEquals('http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri) - } - - @Test - public void testGetCloudInfrastructureCloudRegionUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getCloudInfrastructureCloudRegionUri(mockExecution) - assertEquals('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri) - } - - @Test - public void testGetCloudInfrastructureTenantUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_tenant_uri")).thenReturn('/aai/v8/cloud-infrastructure/tenants/tenant') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getCloudInfrastructureTenantUri(mockExecution) - assertEquals('/aai/v8/cloud-infrastructure/tenants/tenant', uri) - } - - @Test - public void testGetSearchNodesQueryUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn('/aai/v8/search/nodes-query') - when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getSearchNodesQueryUri(mockExecution) - assertEquals('/aai/v8/search/nodes-query', uri) - } - - @Test - public void testGetSearchNodesQueryEndpoint() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn('/aai/v8/search/nodes-query') - when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getSearchNodesQueryEndpoint(mockExecution) - assertEquals('http://localhost:28090/aai/v8/search/nodes-query', uri) - } - - @Test - public void testGetSearchGenericQueryUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_query_uri")).thenReturn('/aai/v8/search/generic-query') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getSearchGenericQueryUri(mockExecution) - assertEquals('/aai/v8/search/generic-query', uri) - } - - @Test - public void testGetNamespaceFromUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('6') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v6_l3_network_uri")).thenReturn('/aai/v6/network/l3-networks/l3-network') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) // Required to populate the namespace in the class - def ns = aaiUtil.getNamespaceFromUri('/aai/v6/search/generic-query') - assertEquals('http://org.openecomp.aai.inventory/v6', ns) - } - - @Test - public void testGetNamespaceFromUri2() { - ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') - // - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('10') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v10_l3_network_uri")).thenReturn('/aai/v10/network/l3-networks/l3-network') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - // - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) // Required to populate the namespace in the class - def ns = aaiUtil.getNamespaceFromUri('/aai/v10/search/generic-query') - assertEquals('http://org.openecomp.aai.inventory/v10', ns) - } - - @Test - public void testGetNamespaceFromUri3() { - ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') - // - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('100') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v100_l3_network_uri")).thenReturn('/aai/v100/network/l3-networks/l3-network') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - // - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) // Required to populate the namespace in the class - def ns = aaiUtil.getNamespaceFromUri('/aai/v100/search/generic-query') - assertEquals('http://org.openecomp.aai.inventory/v100', ns) - } - - @Test - public void testGetNamespaceFromUri_twoArguments() { // (execution, uri) - ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') - // - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('10') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v10_l3_network_uri")).thenReturn('/aai/v10/network/l3-networks/l3-network') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - // - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def ns = aaiUtil.getNamespaceFromUri(mockExecution,'/aai/v10/search/generic-query') - assertEquals('http://org.openecomp.aai.inventory/v10', ns) - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcessTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcessTest.groovy deleted file mode 100644 index 5949c3af53..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcessTest.groovy +++ /dev/null @@ -1,170 +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.bpmn.common.scripts - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.ArgumentCaptor -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.openecomp.mso.bpmn.core.WorkflowException - -import static org.assertj.core.api.Assertions.assertThat -import static org.assertj.core.api.Assertions.assertThatThrownBy -import static org.mockito.Matchers.eq -import static org.mockito.Mockito.* - -@RunWith(MockitoJUnitRunner.class) -class CompleteMsoProcessTest { - @Before - public void init() { - MockitoAnnotations.initMocks(this) - } - - private String completeMsoProcessRequest = """ - - - uCPE1020_STUW105_5002 - Layer3ServiceActivateRequest - COMPLETE - OMX - http://localhost:28090/CCD/StatusNotification - 10205000 - 1 - - UCPELayer3ServiceActivateV1 - - """ - - @Test - public void testPreProcessRequest() { - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("CompleteMsoProcessRequest")).thenReturn(completeMsoProcessRequest) - when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); - - CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() - completeMsoProcess.preProcessRequest(mockExecution) - - /* Initialize all the process request variables in this block */ - verify(mockExecution).setVariable("prefix","CMSO_") - //verify(mockExecution).setVariable("getLayer3ServiceDetailsV1Response","") - verify(mockExecution).setVariable("CMSO_request_id","") - verify(mockExecution).setVariable("CMSO_notification-url","") - verify(mockExecution).setVariable("CMSO_mso-bpel-name","") - verify(mockExecution).setVariable("CMSO_request_action","") - - verify(mockExecution).setVariable("CMSO_notification-url-Ok", false) - verify(mockExecution).setVariable("CMSO_request_id-Ok", false) - - //updateRequest Adapter process variables - verify(mockExecution).setVariable("CMSO_updateRequestResponse", "") - verify(mockExecution).setVariable("CMSO_updateRequestResponseCode", "") - verify(mockExecution).setVariable("CMSO_updateFinalNotifyAckStatusFailedPayload", "") - - //Set DB adapter variables here - verify(mockExecution).setVariable("CMSO_updateDBStatusToSuccessPayload", "") - verify(mockExecution).setVariable("CMSO_updateInfraRequestDBPayload", "") - verify(mockExecution).setVariable("CMSO_setUpdateDBstatustoSuccessPayload", "") - - //Auth variables - verify(mockExecution).setVariable("BasicAuthHeaderValue","") - - //Response variables - verify(mockExecution).setVariable("CompletionHandlerResponse","") - verify(mockExecution).setVariable("CMSO_ErrorResponse", null) - verify(mockExecution).setVariable("CMSO_ResponseCode", "") - - verify(mockExecution).setVariable("CMSO_notification-url-Ok",true) - verify(mockExecution).setVariable("CMSO_request_id-Ok",true) - verify(mockExecution).setVariable("CMSO_notification-url","http://localhost:28090/CCD/StatusNotification") - verify(mockExecution).setVariable("CMSO_request_id","uCPE1020_STUW105_5002") - verify(mockExecution).setVariable("CMSO_request_action","Layer3ServiceActivateRequest") - verify(mockExecution).setVariable("CMSO_source","OMX") - - } - - private String setUpdateDBstatustoSuccessPayload = """ - - - - - testReqId - BPEL - Resource Completed Successfully - COMPLETE - 100 - - - - """ - - @Test - public void testsetUpdateDBstatustoSuccessPayload(){ - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("CMSO_request_id")).thenReturn("testReqId") - when(mockExecution.getVariable("CMSO_mso-bpel-name")).thenReturn("BPEL") - when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); - - CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() - completeMsoProcess.setUpdateDBstatustoSuccessPayload(mockExecution) - - verify(mockExecution).setVariable("CMSO_setUpdateDBstatustoSuccessPayload",setUpdateDBstatustoSuccessPayload) - } - - private String msoCompletionResponse = """onse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"> - BPEL BPEL-NAME FAILED -""" - -/* - private String msoCompletionResponse = """ - BPEL BPEL-NAME FAILED -""" -*/ - @Test - void testBuildDataError() { - // given - def message = "Some-Message" - - def mockExecution = mock ExecutionEntity.class - when mockExecution.getVariable("CMSO_mso-bpel-name") thenReturn "BPEL-NAME" - when mockExecution.getVariable("testProcessKey") thenReturn "CompleteMsoProcess" - - def completeMsoProcess = new CompleteMsoProcess() - // when - assertThatThrownBy { completeMsoProcess.buildDataError(mockExecution, message) } isInstanceOf BpmnError - // then - verify mockExecution setVariable("CompleteMsoProcessResponse", msoCompletionResponse) - def argumentCaptor = ArgumentCaptor.forClass WorkflowException.class - verify mockExecution setVariable(eq("WorkflowException"), argumentCaptor.capture()) - def capturedException = argumentCaptor.value - - assertThat capturedException.processKey isEqualTo "CompleteMsoProcess" - assertThat capturedException.errorCode isEqualTo 500 - assertThat capturedException.errorMessage isEqualTo message - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy deleted file mode 100644 index 95272c22af..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy +++ /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.bpmn.common.scripts - -import org.junit.Assert -import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; - - -import org.junit.Ignore; - -import static org.mockito.Mockito.* - -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.junit.Before -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.mockito.runners.MockitoJUnitRunner -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -@RunWith(MockitoJUnitRunner.class) -import org.junit.Test - - - -class ExceptionUtilTest { - - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - @Test - public void testMapErrorCode5010(){ - String msg = "Connect to njcdtl20ew2988:8070 failed: Connection refused: connect" - ExceptionUtil util = new ExceptionUtil() - Assert.assertEquals("5010",util.MapErrorCode(msg)) - } - - @Test - public void testMapErrorCode5020(){ - String msg = "Connection timed out" - ExceptionUtil util = new ExceptionUtil() - Assert.assertEquals("5020",util.MapErrorCode(msg)) - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy deleted file mode 100644 index 730b44065d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy +++ /dev/null @@ -1,312 +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.bpmn.common.scripts - -import org.junit.runner.RunWith; -import static org.mockito.Mockito.* -import static org.junit.Assert.*; - -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.ArgumentCaptor; -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.openecomp.mso.bpmn.common.scripts.MsoUtils; -import org.openecomp.mso.bpmn.common.scripts.FalloutHandler; - -@RunWith(MockitoJUnitRunner.class) -class FalloutHandlerTest { - - public MsoUtils utils = new MsoUtils() - - @Before - public void init() { - MockitoAnnotations.initMocks(this) - } - - private String falloutHandlerRequest = """ - - - uCPE1020_STUW105_5002 - Layer3ServiceActivateRequest - CANCEL - OMX - 10205000 - 1 - - - Some Error Message - Fallout Handler - Some Error Code - Fallout Handler - Some Source System Error Code- Fallout Handler - - - """ - - private String falloutHandlerResponse = """ - Fallout Handler Failed -""" - - @Test - public void testPreProcessRequest() { - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - - when(mockExecution.getVariable("FalloutHandlerRequest")).thenReturn(falloutHandlerRequest) - when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.preProcessRequest(mockExecution) - - /* Initialize all the process request variables in this block */ - verify(mockExecution).setVariable("prefix","FH_") - //verify(mockExecution).setVariable("getLayer3ServiceDetailsV1Response","") - - //These variables are form the input Message to the BPMN - verify(mockExecution).setVariable("FH_request_id","") - verify(mockExecution).setVariable("FH_request_action","") - verify(mockExecution).setVariable("FH_notification-url","") - verify(mockExecution).setVariable("FH_mso-bpel-name","") - verify(mockExecution).setVariable("FH_ErrorCode", "") - verify(mockExecution).setVariable("FH_ErrorMessage", "") - - verify(mockExecution).setVariable("FH_notification-url-Ok", false) - verify(mockExecution).setVariable("FH_request_id-Ok", false) - - //These variables are for Get Mso Aai Password Adapter - verify(mockExecution).setVariable("FH_deliveryStatus", true) - - //update Response Status to pending ...Adapter variables - verify(mockExecution).setVariable("FH_updateResponseStatusPayload", null) - verify(mockExecution).setVariable("FH_updateResponseStatusResponse", null) - - //update Request Gamma ...Adapter variables - verify(mockExecution).setVariable("FH_updateRequestGammaPayload", "") - verify(mockExecution).setVariable("FH_updateRequestGammaResponse", null) - verify(mockExecution).setVariable("FH_updateRequestGammaResponseCode", null) - - //update Request Infra ...Adapter variables - verify(mockExecution).setVariable("FH_updateRequestInfraPayload", "") - verify(mockExecution).setVariable("FH_updateRequestInfraResponse", null) - verify(mockExecution).setVariable("FH_updateRequestInfraResponseCode", null) - - //assign False to success variable - verify(mockExecution).setVariable("FH_success", true) - - //Set notify status to Failed variable - verify(mockExecution).setVariable("FH_NOTIFY_STATUS", "SUCCESS") - - //Set DB update variable - verify(mockExecution).setVariable("FH_updateRequestPayload", "") - verify(mockExecution).setVariable("FH_updateRequestResponse", null) - verify(mockExecution).setVariable("FH_updateRequestResponseCode", null) - - //Auth variables - verify(mockExecution).setVariable("BasicAuthHeaderValue","") - - //Response variables - verify(mockExecution).setVariable("FalloutHandlerResponse","") - verify(mockExecution).setVariable("FH_ErrorResponse", null) - verify(mockExecution).setVariable("FH_ResponseCode", "") - - verify(mockExecution).setVariable("FH_request_id-Ok",true) - verify(mockExecution).setVariable("FH_request_id","uCPE1020_STUW105_5002") - verify(mockExecution).setVariable("FH_request_action","Layer3ServiceActivateRequest") - verify(mockExecution).setVariable("FH_source","OMX") - verify(mockExecution).setVariable("FH_ErrorCode","Some Error Code - Fallout Handler") - verify(mockExecution).setVariable("FH_ErrorMessage","Some Error Message - Fallout Handler") - - } - - @Test - public void testpostProcessResponse(){ - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("FH_success")).thenReturn(false) - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.postProcessResponse(mockExecution) - - // Capture the arguments to setVariable - ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); - ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); - - verify(mockExecution, times(4)).setVariable(captor1.capture(), captor2.capture()) - List arg2List = captor2.getAllValues() - String payloadResponseActual = arg2List.get(1) - - assertEquals(falloutHandlerResponse.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", "")) - - verify(mockExecution).setVariable("FH_ResponseCode","500") - } - - private String updateRequestPayload = """ - - - - - testReqId - BPEL - ErrorMessage - ErrorCode - FAILED - NotifyStatus - - - - """ - - @Test - public void testupdateRequestPayload(){ - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") - when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") - when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode") - when(mockExecution.getVariable("FH_NOTIFY_STATUS")).thenReturn("NotifyStatus") - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.updateRequestPayload(mockExecution) - - // Capture the arguments to setVariable - ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); - ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); - - verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) - List arg2List = captor2.getAllValues() - String payloadRequestActual = arg2List.get(0) - - assertEquals(updateRequestPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) - } - - private String updateRequestInfraPayload = """ - - - - - testReqId - BPEL - ErrorMessage - FAILED - 100 - - - - """ - - @Test - public void testupdateRequestInfraPayload(){ - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") - when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.updateRequestInfraPayload(mockExecution) - - // Capture the arguments to setVariable - ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); - ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); - - verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) - List arg2List = captor2.getAllValues() - String payloadRequestActual = arg2List.get(0) - - assertEquals(updateRequestInfraPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) - } - - private String updateRequestGammaPayload = """ - - - - - testReqId - BPEL - ErrorMessage - ErrorCode - FAILED - - - - """ - - @Test - public void testupdateRequestGammaPayload(){ - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") - when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") - when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode") - when(mockExecution.getVariable("URN_mso_default_adapter_namespace")).thenReturn("http://org.openecomp.mso"); - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.updateRequestGammaPayload(mockExecution) - - // Capture the arguments to setVariable - ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); - ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); - - verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) - List arg2List = captor2.getAllValues() - String payloadRequestActual = arg2List.get(0) - - assertEquals(updateRequestGammaPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) - } - - - String updateResponseStatusPayload = """ - - - - - testReqId - BPEL - SENDING_FINAL_NOTIFY - - - - """ - - @Test - public void testupdateResponseStatusPayload(){ - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.updateResponseStatusPayload(mockExecution) - - // Capture the arguments to setVariable - ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); - ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); - - verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) - List arg2List = captor2.getAllValues() - String payloadResponseActual = arg2List.get(0) - - assertEquals(updateResponseStatusPayload.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", "")) - } - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutServiceTest.groovy deleted file mode 100644 index 1e7342de68..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutServiceTest.groovy +++ /dev/null @@ -1,214 +0,0 @@ -package org.openecomp.mso.bpmn.common.scripts - -import static org.mockito.Mockito.* -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutServiceInstance; - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Before -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.mockito.runners.MockitoJUnitRunner - -import com.github.tomakehurst.wiremock.client.WireMock -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.apache.commons.lang3.* - -@RunWith(MockitoJUnitRunner.class) -class GenericPutServiceTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(8090); - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - - } - - @Test - public void preProcessRequest() { - - - println "************ preProcessRequest ************* " - - ExecutionEntity mockExecution = setupMock() - - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") - when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") - when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") - when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("GENPS_type")).thenReturn("service-instance") - - GenericPutService putServiceInstance= new GenericPutService() - putServiceInstance.preProcessRequest(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", "GENPS_") - - // execution.getVariable("isDebugLogEnabled") - - verify(mockExecution).setVariable("GENPS_SuccessIndicator", false) - // verify(mockExecution).setVariable("globalSubscriberId", "1604-MVM-26") - // verify(mockExecution).setVariable("serviceInstanceId", "MIS%2F1604%2F0026%2FSW_INTERNET") - // verify(mockExecution).setVariable("serviceType", "SDN-ETHERNET-INTERNET") - // verify(mockExecution).setVariable("ServiceInstanceData", "f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - - } - - - @Test - @Ignore - public void putServiceInstance() { - println "************ putServiceInstance ************* " - - WireMock.reset(); - - MockPutServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"); - ExecutionEntity mockExecution = setupMock() - - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") - when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") - when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") - when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_PutServiceInstance_aai_business_customer_uri")).thenReturn("/aai/v7/business/customers/customer") - when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("GENPS_type")).thenReturn("service-instance") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("7") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v7_customer_uri")).thenReturn("/aai/v7/business/customers/customer") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - GenericPutService serviceInstance= new GenericPutService() - serviceInstance.putServiceInstance(mockExecution) - - // check the sequence of variable invocation - MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", "GENPS_") - - // execution.getVariable("isDebugLogEnabled") - // verify(mockExecution).setVariable("GENPSI_serviceInstanceData","f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - String servicePayload = """f70e927b-6087-4974-9ef8-c5e4d5847ca4""" as String - verify(mockExecution).setVariable("GENPS_serviceInstancePayload",servicePayload) - - String serviceAaiPath = "http://localhost:28090/aai/v7/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET" - verify(mockExecution).setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath) - - int responseCode = 200 - verify(mockExecution).setVariable("GENPS_putServiceInstanceResponseCode", responseCode) - - String aaiResponse = """ - - - - - - - - -""" - - verify(mockExecution).setVariable("GENPS_putServiceInstanceResponse", aaiResponse) - - verify(mockExecution).setVariable("GENPS_SuccessIndicator", true) - } - - @Test - @Ignore - public void putServiceInstance_404() { - - - println "************ putServiceInstance ************* " - - WireMock.reset(); - - ExecutionEntity mockExecution = setupMock() - - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") - when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") - when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") - when(mockExecution.getVariable("GENPS_ServiceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_PutServiceInstance_aai_business_customer_uri")).thenReturn("/aai/v7/business/customers/customer") - when(mockExecution.getVariable("GENPS_ServiceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - GenericPutService serviceInstance= new GenericPutService() - serviceInstance.putServiceInstance(mockExecution) - - // check the sequence of variable invocation - MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", "GENPS_") - - // execution.getVariable("isDebugLogEnabled") - - - verify(mockExecution).setVariable("GENPS_serviceInstanceData","f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - String serviceInstancepayload = """f70e927b-6087-4974-9ef8-c5e4d5847ca4 - """ as String - verify(mockExecution).setVariable("GENPS_serviceInstancePayload",serviceInstancepayload) - - String serviceInstanceAaiPath = "http://localhost:8090/aai/v7/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET" - verify(mockExecution).setVariable("GENPS_putServiceInstanceAaiPath", serviceInstanceAaiPath) - - int responseCode = 404 - verify(mockExecution).setVariable("GENPS_putServiceInstanceResponseCode", responseCode) - - String aaiResponse = "" - verify(mockExecution).setVariable("GENPS_putServiceInstanceResponse", aaiResponse) - - verify(mockExecution).setVariable("GENPS_SuccessIndicator", false) - - - } - - - private ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("PutServiceInstance") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("PutServiceInstance") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("PutServiceInstance") - when(mockExecution.getProcessInstanceId()).thenReturn("PutServiceInstance") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - - return mockExecution - } - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoGroovyTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoGroovyTest.groovy deleted file mode 100644 index 57055401f3..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoGroovyTest.groovy +++ /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.bpmn.common.scripts - -import static org.mockito.Mockito.* - -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl -import org.camunda.bpm.engine.repository.ProcessDefinition - -abstract class MsoGroovyTest { - - protected ExecutionEntity setupMock(String procName) { - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn(procName) - - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(procName) - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - - return mockExecution - } - - protected ExecutionEntity setupMockWithPrefix(String procName, String prefix) { - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - - when(mockExecution.getVariable("prefix")).thenReturn(prefix) - - ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class) - RepositoryService repositoryService = mock(RepositoryService.class) - ProcessDefinition processDefinition = mock(ProcessDefinition.class) - - when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices) - when(processEngineServices.getRepositoryService()).thenReturn(repositoryService) - when(repositoryService.getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(processDefinition) - when(processDefinition.getKey()).thenReturn(procName) - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - return mockExecution - } - - -} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtilsTest.groovy deleted file mode 100644 index 12e7855808..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtilsTest.groovy +++ /dev/null @@ -1,233 +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.bpmn.common.scripts - -// JUnit 4 -import org.junit.Test -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; - -import static groovy.test.GroovyAssert.shouldFail -import static groovy.test.GroovyAssert.assertTrue -import static groovy.test.GroovyAssert.assertEquals - -import org.openecomp.mso.bpmn.common.scripts.MsoUtils; -import org.apache.commons.lang3.* - - -class MsoUtilsTest { - - def utils = new MsoUtils() - def origXmlResponse = null - // Expected rebuilds - def expected_buildElements = "10Kbps1192.168.1.15192.168.1.15282192.168.1.16192.168.1.1628" - def expected_rebuildDhcp = "YNY192.168.1.7192.168.1.8192.155.2.328192.168.1.5192.168.1.62.2.2.11.1.1.1192.155.2.428192.168.1.6192.168.1.72.2.2.21.1.1.2N1:51:60:0281:12:23:34:40:0281:12:23:34:4" - def expected_rebuildFirewallLite = "YN0.0.0.11Y110.0.0.22Y22:0Y33:1Y44" - def expected_rebuildInternetEvcAccess = "8Mbpsds" - def expected_rebuildInternetServiceChangeDetails = "10Kbps1192.168.1.15192.168.1.15282192.168.1.16192.168.1.162812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:2da::28" - def expected_rebuildL2Home = "AS/VLXM/003717//SWMultiPointMTSNJA4LCP1" - def expected_rebuildNat = "Y0.0.0.00.0.0.00.0.0.00.0.0.10.0.0.10.0.0.1" - def expected_rebuildPat = "NY192.168.1.440192.168.1.5192.168.1.4528192.168.1.6" - def expected_rebuildStaticRoutes = "255.255.252.128192.168.1.15255.255.252.228192.168.1.15255.255.252.328192.168.1.152001:1890:12e3:2da::282001:1890:12e3:2da::2001:1890:12e3:2da::282001:1890:12e3:2da::" - def expected_rebuildUcpeVmsServiceInformation = "AVPN1Active2StandbyhostnameactivecodeOOB11ZZJUNIPERMODEL11111122HYJUNIPERMODEL222222" - def expected_rebuildVrLan = "noneprimary10.192.27.254242620:0:10d0:f:ffff:ffff:ffff:fffe64162.200.3.1442001:1890:12e3:2da::1192.168.1.2192.168.1.1281192.168.1.72192.168.1.71281192.168.1.68192.168.1.672812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:3da::2812001:1890:12e3:2da::2001:1890:12e3:4da::28YNY192.168.1.7192.168.1.8192.155.2.328192.168.1.5192.168.1.62.2.2.11.1.1.1192.155.2.428192.168.1.6192.168.1.72.2.2.21.1.1.2N1:51:60:0281:12:23:34:40:0281:12:23:34:4NY192.168.1.440192.168.1.5192.168.1.4528192.168.1.6Y0.0.0.00.0.0.00.0.0.00.0.0.10.0.0.10.0.0.1YN0.0.0.11Y110.0.0.22Y22:0Y33:1Y44255.255.252.128192.168.1.15255.255.252.228192.168.1.15255.255.252.328192.168.1.152001:1890:12e3:2da::282001:1890:12e3:2da::2001:1890:12e3:2da::282001:1890:12e3:2da::" - def expected_rebuildVrLanInterfacePartial = "primary10.192.27.254242620:0:10d0:f:ffff:ffff:ffff:fffe64162.200.3.1442001:1890:12e3:2da::1192.168.1.2192.168.1.1281192.168.1.72192.168.1.71281192.168.1.68192.168.1.67281192.168.1.15192.168.1.15282192.168.1.16192.168.1.162812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:3da::2812001:1890:12e3:2da::2001:1890:12e3:4da::2812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:2da::28" - - @Before - public void setUp() { - def responseAsString = getFile("sdncadaptercallbackrequest.xml") - def varrequestData=utils.getNodeText(responseAsString,"RequestData") - //def varResponseListData = StringEscapeUtils.unescapeXml(varrequestData) - def varResponseListData = varrequestData.replace("&", "&") - origXmlResponse = utils.getNodeXml(varResponseListData, "layer3-service-list").drop(38).trim() - - } - - @Test - public void testBuildL2Home() { - def rebuildL2Home = utils.buildL2HomingInformation(origXmlResponse) - println " rebuildL2Home: " - println " actual - " + rebuildL2Home - println " expected - " + expected_rebuildL2Home - assertEquals("rebuildL2Home - expected vs actual", expected_rebuildL2Home, rebuildL2Home) - } - - @Test - public void testBuildInternetEvcAccess() { - def rebuildInternetEvcAccess = utils.buildInternetEvcAccessInformation(origXmlResponse) - println " rebuildInternetEvcAccess: " - println " actual - " + rebuildInternetEvcAccess - println " expected - " + expected_rebuildInternetEvcAccess - assertEquals("rebuildInternetEvcAccess - expected vs actual", expected_rebuildInternetEvcAccess, rebuildInternetEvcAccess) - } - - @Test - public void testBuildInternetServiceChangeDetails() { - def rebuildInternetServiceChangeDetails = utils.buildInternetServiceChangeDetails(origXmlResponse) - println " rebuildInternetServiceChangeDetails: " - println " actual - " + rebuildInternetServiceChangeDetails - println " expected - " + expected_rebuildInternetServiceChangeDetails - assertEquals("rebuildInternetServiceChangeDetails - expected vs actual", expected_rebuildInternetServiceChangeDetails, rebuildInternetServiceChangeDetails) - } - - // Coming v100 - @Test - @Ignore - public void testBuildUcpeVmsServiceInformation() { - def rebuildUcpeVmsServiceInformation = utils.buildUcpeVmsServiceInformation(origXmlResponse) - println " rebuildUcpeVmsServiceInformation: " - println " actual - " + rebuildUcpeVmsServiceInformation - println " expected - " + expected_rebuildUcpeVmsServiceInformation - assertEquals("rebuildUcpeVmsServiceInformation - expected vs actual", expected_rebuildUcpeVmsServiceInformation, rebuildUcpeVmsServiceInformation) - } - - @Test - public void testBuildElements() { - // testing utility codes: buildElements() & buildElementsUnblunded() - def internetServiceChangeDetails = utils.getNodeXml(origXmlResponse, "internet-service-change-details").drop(38).trim() - def buildElements = '' - buildElements = "" - buildElements += utils.buildElements(internetServiceChangeDetails, ["internet-evc-speed-value"], "") - buildElements += utils.buildElements(internetServiceChangeDetails, ["internet-evc-speed-units"], "") - def tProvidedV4LanPublicPrefixesChangesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length"] - buildElements += utils.buildElementsUnbounded(internetServiceChangeDetails, tProvidedV4LanPublicPrefixesChangesList, "t-provided-v4-lan-public-prefixes") - buildElements += "" - println " buildElements: " - println " actual - " + buildElements - println " expected - " + expected_buildElements - assertEquals("buildElements - expected vs actual", expected_buildElements, buildElements) - } - - @Test - public void testBuildVrLan() { - def rebuildVrLan = utils.buildVrLan(origXmlResponse) - println " rebuildVrLans: " - println " actual - " + rebuildVrLan - println " expected - " + expected_rebuildVrLan - assertEquals("rebuildVrLan - expected vs actual", expected_rebuildVrLan, rebuildVrLan) - } - - @Test - public void testBuildVrLanInterfacePartial() { - def rebuildVrLanInterfacePartial = utils.buildVrLanInterfacePartial(origXmlResponse) - println " rebuildVrLanInterfacePartial: " - println " actual - " + rebuildVrLanInterfacePartial - println " expected - " + expected_rebuildVrLanInterfacePartial - assertEquals("rebuildVrLanInterfacePartial - expected vs actual", expected_rebuildVrLanInterfacePartial, rebuildVrLanInterfacePartial) - } - - @Test - public void testBuildDhcp() { - def rebuildDhcp = utils.buildDhcp(origXmlResponse) - println " rebuildDhcp: " - println " actual - " + rebuildDhcp - println " expected - " + expected_rebuildDhcp - assertEquals("rebuildDhcp - expected vs actual", expected_rebuildDhcp, rebuildDhcp) - } - - @Test - public void testBuildPat() { - def rebuildPat = utils.buildPat(origXmlResponse) - println " rebuildPat: " - println " actual - " + rebuildPat - println " expected - " + expected_rebuildPat - assertEquals("rebuildPat - expected vs actual", expected_rebuildPat, rebuildPat) - } - - @Test - public void testBuildNat() { - def rebuildNat = utils.buildNat(origXmlResponse) - println " rebuildNat: " - println " actual - " + rebuildNat - println " expected - " + expected_rebuildNat - assertEquals("rebuildNat - expected vs actual", expected_rebuildNat, rebuildNat) - } - - @Test - public void testBuildFirewallLite() { - def rebuildFirewallLite = utils.buildFirewallLite(origXmlResponse) - println " rebuildFirewallLite: " - println " actual - " + rebuildFirewallLite - println " expected - " + expected_rebuildFirewallLite - assertEquals("rebuildFirewallLite - expected vs actual", expected_rebuildFirewallLite, rebuildFirewallLite) - } - - @Test - public void testBuildStaticRoutes() { - def rebuildStaticRoutes = utils.buildStaticRoutes(origXmlResponse) - println " rebuildStaticRoutes: " - println " actual - " + rebuildStaticRoutes - println " expected - " + expected_rebuildStaticRoutes - assertEquals("rebuildStaticRoutes - expected vs actual", expected_rebuildStaticRoutes, rebuildStaticRoutes) - } - - @Test - public void testGetBasicAuth(){ - def encodedAuth = utils.getBasicAuth("3E3CFA7BE2F6107AAD4AAA65F8976690","07a7159d3bf51a0e53be7a8f89699be7") - assertEquals("Basic bXlTdHJpbmc=", encodedAuth) - } - - @Test - public void testEncrypt(){ - def encrypted = utils.encrypt("myString","07a7159d3bf51a0e53be7a8f89699be7") - assertEquals("3E3CFA7BE2F6107AAD4AAA65F8976690", encrypted) - - //use to get value for urn properties - //println(utils.encrypt("password")) - } - - @Test - public void testDecrypt(){ - def decrypted = utils.decrypt("3E3CFA7BE2F6107AAD4AAA65F8976690", "07a7159d3bf51a0e53be7a8f89699be7") - assertEquals("myString", decrypted) - } - - @Test - public void testGetPBGFList(){ - def responseAsString = getFile("sdncDeleteResponse.xml") - def nodes = utils.getPBGFList("true", responseAsString) - //assertEquals(2, nodes.size()) - while(!nodes.empty){ - def myBGFXML = nodes.remove(0) - def myBGF= new XmlSlurper().parseText(myBGFXML) - println "borderElmtId: " + myBGF.'border-element-id' - println "vlanid: " + myBGF.'vlan-id' +"\n" - } - } - - public String getFile(String fileName) { - def SLASH = File.separator - def pathBase = ' ' - def fileAsString = '' - try { - pathBase = new File(".").getCanonicalPath() - //println "pathBase " + pathBase + "${SLASH}src${SLASH}test${SLASH}resources${SLASH}${fileName}" - fileAsString = new File(pathBase, "${SLASH}src${SLASH}test${SLASH}resources${SLASH}${fileName}").getText() - } catch (Exception ex) { - println " *** getFile error: " + ex.getStackTrace() - } finally { - return fileAsString - } - } - - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtilsTest.groovy deleted file mode 100644 index 63d88f5c3a..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtilsTest.groovy +++ /dev/null @@ -1,97 +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.bpmn.common.scripts - -import static org.mockito.Mockito.* -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import static org.junit.Assert.*; -import org.junit.Test; - -class NetworkUtilsTest { - - def volumeRequestXml = """ - - CREATE_VF_MODULE_VOL - VID - - - - - MSOTESTVOL101a-vSAMP12_base_vol_module-0 - Test/vSAMP12 - vSAMP12::base::module-0 - 2.0 - mdt1 - 88a6ca3ee0394ade9403f075db23167e - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - - - - STMTN5MMSC20 - US1117MTSNJVBR0246 - -""" - - @Test - public void testIsRollbackEnabled() { - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_rollback")).thenReturn(true) - - NetworkUtils networkUtils = new NetworkUtils() - def rollbackEnabled = networkUtils.isRollbackEnabled(mockExecution, volumeRequestXml) - - assertEquals(true, rollbackEnabled) - - } - - @Test - public void testIsRollbackEnabled2() { - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_rollback")).thenReturn(false) - - NetworkUtils networkUtils = new NetworkUtils() - def rollbackEnabled = networkUtils.isRollbackEnabled(mockExecution, volumeRequestXml) - - assertEquals(false, rollbackEnabled) - - } - - @Test - public void testGetIpvVersion() { - - NetworkUtils networkUtils = new NetworkUtils() - println "test: ipv4" - String version4 = networkUtils.getIpvVersion("ipv4") - assertEquals("4", version4) - println "test: ipv6" - String version6 = networkUtils.getIpvVersion("ipv6") - assertEquals("6", version6) - println "test: 4" - String versionDigit4 = networkUtils.getIpvVersion("4") - assertEquals("4", versionDigit4) - - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy deleted file mode 100644 index 2ecb108b4e..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy +++ /dev/null @@ -1,948 +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.bpmn.common.scripts; - -import static org.mockito.Mockito.* - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapter; - -import org.openecomp.mso.bpmn.mock.FileUtil - -@RunWith(MockitoJUnitRunner.class) -public class SDNCAdapterTest { - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - System.setProperty("jboss.qualified.host.name","myhost.com") - } - - - def workflowResponse = """ - - - testRequestId - 200 - OK - - <layer3-service-list xmlns="com:att:sdnctl:l3api"> - <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> - <service-status> - <rpc-name>service-configuration-operation</rpc-name> - <rpc-action>activate</rpc-action> - <request-status>synccomplete</request-status> - <final-indicator>N</final-indicator> - <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> - <l3sdn-subaction>SUPP</l3sdn-subaction> - <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> - </service-status> - <service-data> - <internet-evc-access-information> - <ip-version>ds</ip-version> - <internet-evc-speed-value>8</internet-evc-speed-value> - <internet-evc-speed-units>Mbps</internet-evc-speed-units> - </internet-evc-access-information> - <vr-lan xmlns="com:att:sdnctl:l3api"> - <vr-lan-interface> - <static-routes> - <v6-static-routes> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> - <v6-static-route-prefix-length>28</v6-static-route-prefix-length> - </v6-static-routes> - <v4-static-routes> - <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-static-route-prefix-length>28</v4-static-route-prefix-length> - </v4-static-routes> - <v6-static-routes> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> - <v6-static-route-prefix-length>28</v6-static-route-prefix-length> - </v6-static-routes> - <v4-static-routes> - <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-static-route-prefix-length>28</v4-static-route-prefix-length> - </v4-static-routes> - <v4-static-routes> - <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-static-route-prefix-length>28</v4-static-route-prefix-length> - </v4-static-routes> - </static-routes> - <dhcp> - <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> - <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> - <use-v6-default-pool>N</use-v6-default-pool> - <excluded-v4-dhcp-addresses-from-default-pool> - <excluded-v4-address>192.168.1.7</excluded-v4-address> - </excluded-v4-dhcp-addresses-from-default-pool> - <excluded-v4-dhcp-addresses-from-default-pool> - <excluded-v4-address>192.168.1.8</excluded-v4-address> - </excluded-v4-dhcp-addresses-from-default-pool> - <v4-dhcp-pools> - <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> - <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.5</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.6</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> - </v4-dhcp-pools> - <v4-dhcp-pools> - <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> - <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.6</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.7</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> - </v4-dhcp-pools> - <use-v4-default-pool>Y</use-v4-default-pool> - <excluded-v6-dhcp-addresses-from-default-pool> - <excluded-v6-address>1:5</excluded-v6-address> - </excluded-v6-dhcp-addresses-from-default-pool> - <excluded-v6-dhcp-addresses-from-default-pool> - <excluded-v6-address>1:6</excluded-v6-address> - </excluded-v6-dhcp-addresses-from-default-pool> - <v6-dhcp-pools> - <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> - <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> - <excluded-v6-addresses> - <excluded-v6-address>1:1</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> - <excluded-v6-addresses> - <excluded-v6-address>2:2</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> - </v6-dhcp-pools> - <v6-dhcp-pools> - <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> - <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> - <excluded-v6-addresses> - <excluded-v6-address>1:1</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> - <excluded-v6-addresses> - <excluded-v6-address>2:2</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> - </v6-dhcp-pools> - </dhcp> - <firewall-lite> - <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> - <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> - <v4-firewall-packet-filters> - <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> - <v4-firewall-prefix-length>1</v4-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>1</port-number> - </udp-ports> - <tcp-ports> - <port-number>1</port-number> - </tcp-ports> - </v4-firewall-packet-filters> - <v4-firewall-packet-filters> - <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> - <v4-firewall-prefix-length>2</v4-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>2</port-number> - </udp-ports> - <tcp-ports> - <port-number>2</port-number> - </tcp-ports> - </v4-firewall-packet-filters> - <v6-firewall-packet-filters> - <v6-firewall-prefix>:</v6-firewall-prefix> - <v6-firewall-prefix-length>0</v6-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>3</port-number> - </udp-ports> - <tcp-ports> - <port-number>3</port-number> - </tcp-ports> - </v6-firewall-packet-filters> - <v6-firewall-packet-filters> - <v6-firewall-prefix>:</v6-firewall-prefix> - <v6-firewall-prefix-length>1</v6-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>4</port-number> - </udp-ports> - <tcp-ports> - <port-number>4</port-number> - </tcp-ports> - </v6-firewall-packet-filters> - </firewall-lite> - <pat> - <v4-pat-pools> - <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> - <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> - <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> - </v4-pat-pools> - <use-v4-default-pool>Y</use-v4-default-pool> - <v4-pat-enabled>N</v4-pat-enabled> - <v4-pat-pools> - <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> - <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> - <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> - </v4-pat-pools> - </pat> - <nat> - <v4-nat-enabled>Y</v4-nat-enabled> - <v4-nat-mapping-entries> - <v4-nat-internal>0.0.0.0</v4-nat-internal> - <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> - <v4-nat-external>0.0.0.0</v4-nat-external> - </v4-nat-mapping-entries> - <v4-nat-mapping-entries> - <v4-nat-internal>0.0.0.1</v4-nat-internal> - <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> - <v4-nat-external>0.0.0.1</v4-nat-external> - </v4-nat-mapping-entries> - </nat> - <vr-designation>primary</vr-designation> - <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> - <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> - <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> - <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> - <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> - <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> - <v4-public-lan-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.2</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.72</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.68</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - </v4-public-lan-prefixes> - <v6-public-lan-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - </v6-public-lan-prefixes> - </vr-lan-interface> - <routing-protocol>none</routing-protocol> - </vr-lan> -<ucpe-vms-service-information> - <transport-service-information> - <transport-service-type>AVPN</transport-service-type> - <access-circuit-info> - <access-circuit-id>1</access-circuit-id> - <dual-mode>Active</dual-mode> - </access-circuit-info> - <access-circuit-info> - <access-circuit-id>2</access-circuit-id> - <dual-mode>Standby</dual-mode> - </access-circuit-info> - </transport-service-information> - <ucpe-information> - <ucpe-host-name>hostname</ucpe-host-name> - <ucpe-activation-code>activecode</ucpe-activation-code> - <out-of-band-management-modem>OOB</out-of-band-management-modem> - </ucpe-information> - <vnf-list> - <vnf-information> - <vnf-instance-id>1</vnf-instance-id> - <vnf-sequence-number>1</vnf-sequence-number> - <vnf-type>ZZ</vnf-type> - <vnf-vendor>JUNIPER</vnf-vendor> - <vnf-model>MODEL1</vnf-model> - <vnf-id>1</vnf-id> - <prov-status>1</prov-status> - <operational-state>1</operational-state> - <orchestration-status>1</orchestration-status> - <equipment-role>1</equipment-role> - </vnf-information> - <vnf-information> - <vnf-instance-id>2</vnf-instance-id> - <vnf-sequence-number>2</vnf-sequence-number> - <vnf-type>HY</vnf-type> - <vnf-vendor>JUNIPER</vnf-vendor> - <vnf-model>MODEL2</vnf-model> - <vnf-id>2</vnf-id> - <prov-status>2</prov-status> - <operational-state>2</operational-state> - <orchestration-status>2</orchestration-status> - <equipment-role>2</equipment-role> - </vnf-information> - </vnf-list> - </ucpe-vms-service-information> - <request-information> - <request-action>Layer3ServiceActivateRequest</request-action> - <order-number>4281555</order-number> - <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> - <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> - <source>OMX</source> - <order-version>1</order-version> - </request-information> - <sdnc-request-header> - <svc-action>activate</svc-action> - <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.com:8443/adapters/rest/SDNCNotify</svc-notification-url> - <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> - </sdnc-request-header> - <l2-homing-information> - <topology>MultiPoint</topology> - <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> - <evc-name>AS/VLXM/003717//SW</evc-name> - </l2-homing-information> - <service-information> - <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> - <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name> - <service-type>SDN-ETHERNET-INTERNET</service-type> - </service-information> - <internet-service-change-details> - <internet-evc-speed-value>10</internet-evc-speed-value> - <internet-evc-speed-units>Kbps</internet-evc-speed-units> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>2</request-index> - <v4-next-hop-address>192.168.1.16</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - </internet-service-change-details> - </service-data> - </layer3-service-list> - - -""" - - String sdncAdapterRequest = """ - - - - - 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 - query - services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET - http://myhost.com:28080/mso/sdncAdapterCallbackServiceImpl - - - - - 12570a36-7388-4c0a-bec4-189ce3kg9956 - GetLayer3ServiceDetailsRequest - OMX - - - SDN-ETHERNET-INTERNET - PD/VLXM/003717//SW_INTERNET - - -""" - -def sdncAdapterResponse = """ - - - 39542e39-ccc3-4d1a-8b79-04ce88526613 - 404 - Error processing request to SDNC. Not Found. - https://sdncodl.us.aic.cip.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. - SDNC Returned-[error-type:application, error-tag:data-missing, - error-message:Request could not be completed because the relevant - data model content does not exist.] - - - -""" - -def workflowErrorResponse = """ - Received error from SDN-C: Error processing request to SDNC. Not Found. - https://sdncodl.us.aic.cip.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. - SDNC Returned-[error-type:application, error-tag:data-missing, - error-message:Request could not be completed because the relevant - data model content does not exist.] - 5300 - 404 - """ - -def workflowErrorResponse1 = """ - Invalid Callback Response from SDNC Adapter - 5300 - """ - -def enhancedCallbackRequestData = - """ - FK/VLXM/003717//SW_INTERNET - - service-configuration-operation - activate - synccomplete - N - Layer3ServiceActivateRequest - SUPP - 2015-04-28T21:32:11.386Z - - - - ds - 8 - Mbps - - - - - - 2001:1890:12e3:2da:: - 2001:1890:12e3:2da:: - 28 - - - 255.255.252.1 - 192.168.1.15 - 28 - - - 2001:1890:12e3:2da:: - 2001:1890:12e3:2da:: - 28 - - - 255.255.252.2 - 192.168.1.15 - 28 - - - 255.255.252.3 - 192.168.1.15 - 28 - - - - N - Y - N - - 192.168.1.7 - - - 192.168.1.8 - - - 1.1.1.1 - 28 - - 192.168.1.5 - - 2.2.2.1 - - 192.168.1.6 - - 192.155.2.3 - - - 1.1.1.2 - 28 - - 192.168.1.6 - - 2.2.2.2 - - 192.168.1.7 - - 192.155.2.4 - - Y - - 1:5 - - - 1:6 - - - 4:4 - 28 - - 1:1 - - 3:3 - - 2:2 - - 0:0 - - - 4:4 - 28 - - 1:1 - - 3:3 - - 2:2 - - 0:0 - - - - N - Y - - 0.0.0.1 - 1 - Y - - 1 - - - 1 - - - - 0.0.0.2 - 2 - Y - - 2 - - - 2 - - - - : - 0 - Y - - 3 - - - 3 - - - - : - 1 - Y - - 4 - - - 4 - - - - - - 192.168.1.44 - 192.168.1.5 - 0 - - Y - N - - 192.168.1.45 - 192.168.1.6 - 28 - - - - Y - - 0.0.0.0 - 0.0.0.0 - 0.0.0.0 - - - 0.0.0.1 - 0.0.0.1 - 0.0.0.1 - - - primary - 162.200.3.144 - 64 - 2001:1890:12e3:2da:: - 2620:0:10d0:f:ffff:ffff:ffff:fffe - 24 - 10.192.27.254 - - - 1 - 192.168.1.2 - 192.168.1.1 - 28 - - - 1 - 192.168.1.72 - 192.168.1.71 - 28 - - - 1 - 192.168.1.68 - 192.168.1.67 - 28 - - - - - 1 - 2001:1890:12e3:2da:: - 2001:1890:12e3:2da:: - 28 - - - 1 - 2001:1890:12e3:2da:: - 2001:1890:12e3:3da:: - 28 - - - 1 - 2001:1890:12e3:2da:: - 2001:1890:12e3:4da:: - 28 - - - - none - - - - AVPN - - 1 - Active - - - 2 - Standby - - - - hostname - activecode - OOB - - - - 1 - 1 - ZZ - JUNIPER - MODEL1 - 1 - 1 - 1 - 1 - 1 - - - 2 - 2 - HY - JUNIPER - MODEL2 - 2 - 2 - 2 - 2 - 2 - - - - - Layer3ServiceActivateRequest - 4281555 - 155415ab-b4a7-4382-b4c6-d17d9sm42855 - https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws - OMX - 1 - - - activate - https://msojra.mtsnjdcp1.aic.cip.com:8443/adapters/rest/SDNCNotify - 5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760 - - - MultiPoint - MTSNJA4LCP1 - AS/VLXM/003717//SW - - - FK/VLXM/003717//SW_INTERNET - ST E2E Test42855_1300004281555 - SDN-ETHERNET-INTERNET - - - 10 - Kbps - - 1 - 192.168.1.15 - 192.168.1.15 - 28 - - - 2 - 192.168.1.16 - 192.168.1.16 - 28 - - - 1 - 2001:1890:12e3:2da:: - 2001:1890:12e3:2da:: - 28 - - - 1 - 2001:1890:12e3:2da:: - 2001:1890:12e3:2da:: - 28 - - - - - -""" - -def sdncAdapterResponseEmpty = -""" - -""" - -def sdncAdapterResponseError = -""" - - - 39542e39-ccc3-4d1a-8b79-04ce88526613 - 404 - Error processing request to SDNC. Not Found. - https://sdncodl.us.aic.cip.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. - SDNC Returned-[error-type:application, error-tag:data-missing, - error-message:Request could not be completed because the relevant - data model content does not exist.] - - -""" - - - @Test - public void testPreProcessRequest() { - - String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml"); - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("sdncAdapterWorkflowRequest")).thenReturn(sdncAdapterWorkflowRequest) - when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://someurl.someting.com:28080/mso/sdncAdapterCallbackServiceImpl") - when(mockExecution.getVariable("URN_mso_use_qualified_host")).thenReturn("true") - when(mockExecution.getProcessInstanceId()).thenReturn("745b1b50-e39e-4685-9cc8-c71f0bde8bf0") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - - - SDNCAdapter sdncAdapter = new SDNCAdapter() - sdncAdapter.preProcessRequest(mockExecution) - - MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - debugger.printInvocations(mockExecution) - - - verify(mockExecution).setVariable("prefix","SDNCA_") - verify(mockExecution).setVariable("sdncAdapterResponse","") - verify(mockExecution).setVariable("asynchronousResponseTimeout",false) - verify(mockExecution).setVariable("continueListening",false) - verify(mockExecution).setVariable("BasicAuthHeaderValue","Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable("serviceConfigActivate",false) - verify(mockExecution).setVariable("SDNCA_requestId", "745b1b50-e39e-4685-9cc8-c71f0bde8bf0") - verify(mockExecution).setVariable("SDNCA_SuccessIndicator",false) - verify(mockExecution).setVariable("source","") - verify(mockExecution).setVariable("sdncAdapterRequest", sdncAdapterRequest) - } - - @Test - public void testProcessResponse() - { - String sdncAdapterCallbackResponse = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml"); - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackResponse) - SDNCAdapter sdncAdapter = new SDNCAdapter() - sdncAdapter.postProcessResponse(mockExecution) - -// MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() -// debugger.printInvocations(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") - verify(mockExecution).setVariable("sdncAdapterResponse",workflowResponse) - verify(mockExecution).setVariable("enhancedCallbackRequestData",enhancedCallbackRequestData) - verify(mockExecution).setVariable("continueListening",false) - - } - - @Test - public void testProcessResponse_ErrorCase_404() - { - String sdncAdapterCallbackErrorResponse = FileUtil.readResourceFile("sdncadaptercallbackrequest_404CallBack.xml"); - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackErrorResponse) - SDNCAdapter sdncAdapter = new SDNCAdapter() - sdncAdapter.postProcessResponse(mockExecution) - - verify(mockExecution, times(1)).getVariable("isDebugLogEnabled") - verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") - verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseError) - verify(mockExecution).setVariable("enhancedCallbackRequestData", "") - verify(mockExecution).setVariable("continueListening",false) - - } - - @Test - public void testProcessResponse_ErrorCase_InvalidCallback() - { - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn("

Service Unavailable

") - SDNCAdapter sdncAdapter = new SDNCAdapter() - sdncAdapter.postProcessResponse(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") - verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseEmpty) - verify(mockExecution).setVariable("enhancedCallbackRequestData", "") - verify(mockExecution).setVariable("continueListening",false) - - } - - @Test - public void postProcessResponse() - { - - String SDNCAdapterCallbackRequest = - """ - - - 3bb02798-b344-4d28-9bca-1f029954d1c9 - 404 - Error processing request to SDNC. Not Found. - https://sdncodl.us.infra.aic.net:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693. - SDNC Returned-[error-type:application, error-tag:data-missing, - error-message:Request could not be completed because the relevant - data model content does not exist ] - -""" - - String sdncAdapterResponse = - """ - - - 3bb02798-b344-4d28-9bca-1f029954d1c9 - 404 - Error processing request to SDNC. Not Found. - https://sdncodl.us.infra.aic.net:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693. - SDNC Returned-[error-type:application, error-tag:data-missing, - error-message:Request could not be completed because the relevant - data model content does not exist ] - - -""" - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(SDNCAdapterCallbackRequest) - SDNCAdapter sdncAdapter = new SDNCAdapter() - sdncAdapter.postProcessResponse(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") - verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponse) - verify(mockExecution).setVariable("enhancedCallbackRequestData", "") - verify(mockExecution).setVariable("continueListening",false) - - } - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy deleted file mode 100644 index 161b71cb9c..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy +++ /dev/null @@ -1,213 +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.bpmn.common.scripts; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.* - -import org.junit.Before -import org.junit.Ignore -import org.junit.Test -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils - -import org.openecomp.mso.bpmn.mock.FileUtil - -public class SDNCAdapterUtilsTest { - - private def map - private ExecutionEntity svcex - private WorkflowException wfex - private AbstractServiceTaskProcessor tp - private String resp - private SDNCAdapterUtils utils - - @Before - public void init() - { - map = new HashMap() - svcex = mock(ExecutionEntity.class) - wfex = null - tp = new AbstractServiceTaskProcessor() { - @Override - public void preProcessRequest(DelegateExecution execution) { - } - }; - utils = new SDNCAdapterUtils(tp) - - // svcex gets its variables from "map" - when(svcex.getVariable(any())).thenAnswer( - { invocation -> - return map.get(invocation.getArgumentAt(0, String.class)) }) - - // svcex puts its variables into "map" - when(svcex.setVariable(any(), any())).thenAnswer( - { invocation -> - return map.put( - invocation.getArgumentAt(0, String.class), - invocation.getArgumentAt(1, String.class)) }) - - map.put("isDebugLogEnabled", "true") - map.put("prefix", "mypfx-") - map.put("testProcessKey", "mykey") - } - - @Test - public void testValidateSDNCResponse_Success_NoCode() { - resp = """""" - - utils.validateSDNCResponse(svcex, resp, wfex, true) - - assertEquals(true, map.get("mypfx-sdncResponseSuccess")) - assertEquals("0", map.get("mypfx-sdncRequestDataResponseCode")) - assertFalse(map.containsKey("WorkflowException")) - } - - @Test - public void testValidateSDNCResponse_200() { - utils.validateSDNCResponse(svcex, makeResp("200", "OK", ""), wfex, true) - - assertEquals(true, map.get("mypfx-sdncResponseSuccess")) - assertEquals("200", map.get("mypfx-sdncRequestDataResponseCode")) - assertFalse(map.containsKey("WorkflowException")) - } - - @Test - public void testValidateSDNCResponse_408() { - try { - utils.validateSDNCResponse(svcex, makeResp("408", "failed", ""), wfex, true) - - // this has been commented out as, currently, the code doesn't - // throw an exception in this case -// fail("missing exception") - - } catch(BpmnError ex) { - ex.printStackTrace() - } - - assertEquals(false, map.get("mypfx-sdncResponseSuccess")) - assertEquals("408", map.get("mypfx-sdncRequestDataResponseCode")) - - wfex = map.get("WorkflowException") - assertNotNull(wfex) - - assertEquals(5320, wfex.getErrorCode()) - assertEquals("Received error from SDN-C: failed", wfex.getErrorMessage()) - } - - @Test - public void testValidateSDNCResponse_408_200() { - - utils.validateSDNCResponse(svcex, makeResp("408", "failed", makeReq("200", "ok")), wfex, true) - - assertEquals(true, map.get("mypfx-sdncResponseSuccess")) - assertEquals("200", map.get("mypfx-sdncRequestDataResponseCode")) - assertFalse(map.containsKey("WorkflowException")) - } - - @Ignore // 1802 merge - @Test - public void testValidateSDNCResponse_408_200_WithEmbeddedLt() { - - utils.validateSDNCResponse(svcex, makeResp("408", "failed", makeReq("200", " message")), wfex, true) - - assertEquals(true, map.get("mypfx-sdncResponseSuccess")) - assertEquals("200", map.get("mypfx-sdncRequestDataResponseCode")) - assertFalse(map.containsKey("WorkflowException")) - } - - @Test - public void testUpdateHomingInfo() { - String actual = utils.updateHomingInfo(null, "AIC3.0") - println actual - assertEquals("AIC3.0", actual) - } - - @Test - public void testUpdateHomingInfo2() { - String homingInfo = "TESTCLLI" - String actual = utils.updateHomingInfo(homingInfo, "AIC3.0") - println actual - assertEquals("TESTCLLIAIC3.0", actual) - } - - @Ignore // 1802 merge - testing method that doesn't exist - @Test - public void testUpdateServiceInfo() { - String actual = utils.updateServiceInfo(null, "96688f6f-ab06-4ef6-ae55-9d3af28ae909") - println actual - assertEquals("96688f6f-ab06-4ef6-ae55-9d3af28ae909", actual) - } - - @Ignore // 1802 merge - testing method that doesn't exist - @Test - public void testUpdateServiceInfo2() { - String serviceInfo = "SDN-ETHERNET-INTERNETMIS/1602/00029/SB_INTERNET" - String actual = utils.updateServiceInfo(serviceInfo, "96688f6f-ab06-4ef6-ae55-9d3af28ae909") - println actual - assertEquals("SDN-ETHERNET-INTERNETMIS/1602/00029/SB_INTERNET96688f6f-ab06-4ef6-ae55-9d3af28ae909", actual) - } - - private String makeResp(String respcode, String respmsg, String reqdata) { - def rc = encodeXml(respcode) - def rm = encodeXml(respmsg) - - return """ - - - - myreq - ${rc} - ${rm} - - ${reqdata} - - -""" - - } - - private String makeReq(String respcode, String respmsg) { - def rc = encodeXml(respcode) - def rm = encodeXml(respmsg) - - def output = """ - - 8b46e36e-b44f-4085-9404-427be1bc8a3 - ${rc} - ${rm} - Y - -""" - output = encodeXml(output) - - return """${output}""" - } - - private String encodeXml(String txt) { - return txt.replace("&", "&").replace("<", "<") - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtilTest.groovy deleted file mode 100644 index 203f11a42e..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtilTest.groovy +++ /dev/null @@ -1,201 +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.bpmn.common.scripts - -import org.junit.Assert -import org.junit.Ignore -import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; - - - -import static org.mockito.Mockito.* - -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.junit.Before -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.mockito.runners.MockitoJUnitRunner -import org.openecomp.mso.bpmn.common.scripts.TrinityExceptionUtil; -@RunWith(MockitoJUnitRunner.class) -import org.junit.Test - -class TrinityExceptionUtilTest { - - def aotsFault =""" - xml:space - String - http://test.com - - - - 400 - bad stuff - - - String - *** ERROR *** - String - String - String - String - - String - String - - String - String - String - String - - - - - - String - *** ERROR *** - String - String - String - String - String - String - String - - -""" - - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - @Test - @Ignore - public void testMapAAIExceptionTCommonException() { - - - - String restFault = """ - - - -SVC3002 -Error writing output performing %1 on %2 (msg=%3) (ec=%4) - -PUTcustomer -SubName01 -Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id] -ERR.5.4.5105 - - - - - """ - def errorString = """ - -SVC3002 -Error writing output performing %1 on %2 (msg=%3) (ec=%4) - -PUTcustomer -SubName01 -Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id] -ERR.5.4.5105 - - -""" as String - - - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - - TrinityExceptionUtil util = new TrinityExceptionUtil() - Assert.assertEquals(errorString, util.mapAAIExceptionTCommonException(restFault, mockExecution)) - } - - - - - @Test - public void testBuildException() { - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("prefix")).thenReturn("test_") - when(mockExecution.getVariable("test_ResponseCode")).thenReturn("400") - ArrayList msgVars = new ArrayList() - msgVars.add("var1") - msgVars.add("var2") - when(mockExecution.getVariable("test_errVariables")).thenReturn(msgVars) - - - TrinityExceptionUtil util = new TrinityExceptionUtil() - String msg = "Bad request" - String errorString = """ - - SVC2000 - The following service error occurred: %1. Error code is %2. - var1 - var2 - -""" - Assert.assertEquals(errorString, util.buildException(msg, mockExecution)) - } - - @Test - public void testMapAOTSExecptionToCommonException() { - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("prefix")).thenReturn("test_") - when(mockExecution.getVariable("test_ResponseCode")).thenReturn("400") - - TrinityExceptionUtil util = new TrinityExceptionUtil() - String errorString = """ - - SVC2000 - The following service error occurred: %1. Error code is %2. - Received error from AOTS: bad stuff - 400 - -""" - Assert.assertEquals(errorString, util.mapAOTSExecptionToCommonException(aotsFault, mockExecution)) - } - - - @Test - public void testParseError() { - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - String errorString = "The following service error occurred: %1. Error code is %2." - ArrayList msgVars = new ArrayList() - msgVars.add("var1") - msgVars.add("var2") - when(mockExecution.getVariable("prefix")).thenReturn("test_") - when(mockExecution.getVariable("test_errTxt")).thenReturn(errorString) - when(mockExecution.getVariable("test_errVariables")).thenReturn(msgVars) - - TrinityExceptionUtil util = new TrinityExceptionUtil() - - Assert.assertEquals("The following service error occurred: var1. Error code is var2.", util.parseError(mockExecution)) -} - - - -} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtilsTest.groovy deleted file mode 100644 index ffdaf0653d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtilsTest.groovy +++ /dev/null @@ -1,972 +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.bpmn.common.scripts; - -import static org.mockito.Mockito.* - -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.WorkflowException - -import groovy.json.JsonSlurper - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.camunda.bpm.engine.delegate.DelegateExecution; - -import static org.junit.Assert.*; - -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.junit.Before -import org.junit.Rule; -import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; -import org.junit.Before; -import org.junit.Test; - -@RunWith(MockitoJUnitRunner.class) - -class VidUtilsTest { - - def vfModuleReqJson = """ -{ - "requestDetails": { - "modelInfo": { - "modelType": "vfModule", - "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "STMTN5MMSC21-MMSC::model-1-0", - "modelVersion": "1", - "modelCustomizationUuid": "ee6478e5-ea33-3346-ac12-ab121484a3fe" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "MDTWNJ21", - "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" - }, - "requestInfo": { - "instanceName": "PCRF::module-0-2", - "source": "VID", - "suppressRollback": true - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", - "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", - "modelInfo": { - "modelType": "volumeGroup", - "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12..base..module-0", - "modelVersion": "1" - } - } - }, - { - "relatedInstance": { - "instanceId": "123456", - "modelInfo": { - "modelType": "service", - "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "SERVICE_MODEL_NAME", - "modelVersion": "1.0" - } - } - }, - { - "relatedInstance": { - "instanceId": "skask", - "instanceName": "skask-test", - "modelInfo": { - "modelType": "vnf", - "modelInvariantUuid": "skask", - "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12", - "modelVersion": "1.0", - "modelInstanceName": "vSAMP12 1" - } - } - } - ], - "requestParameters": { - "userParams": [ - { - "name": "vnfName", - "value": "STMTN5MMSC20" - }, - { - "name": "tenantId", - "value": "vpe-tenant-123" - }, - { - "name": "aicCloudRegion", - "value": "MDTWNJ21" - }, - { - "name": "isAvpnService", - "value": "true" - }, - { - "name": "asn", - "value": "asn-1234" - }, - { - "name": "releaseForAero", - "value": "release-for-aero-something" - }, - { - "name": "aicClli", - "value": "MTJWNJA4LCP" - }, - { - "name": "svcProviderPartNumber", - "value": "svc-provide-number-1234" - } - ] - } - } -} -""" - def bpmnReq1 = """ -{ - "requestDetails": { - "modelInfo": { - "modelType": "volumeGroup", - "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12::base::module-0", - "modelVersion": "1" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "mdt1", - "tenantId": "88a6ca3ee0394ade9403f075db23167e" - }, - "requestInfo": { - "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", - "source": "VID", - "suppressRollback": false - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "{service-instance-id}", - "modelInfo": { - "modelType": "service", - "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "Test", - "modelVersion": "2.0" - } - } - }, { - "relatedInstance": { - "instanceId": "{vnf-instance-id}", - "modelInfo": { - "modelType": "vnf", - "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", - "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12", - "modelVersion": "1", - "modelInstanceName": "vSAMP12" - } - } - } - ], - "requestParameters": { - "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", - "userParams": [ - {"name": "vnfName", "value": "STMTN5MMSC20" }, - {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, - {"name": "vnfNmInformation", "value": "" }, - {"name": "vnfType", "value": "pcrf-capacity" }, - {"name": "vnfId", "value": "skask" }, - {"name": "vnfStackId", "value": "slowburn" }, - {"name": "vnfStatus", "value": "created" }, - {"name": "aicCloudRegion", "value": "MDTWNJ21" }, - {"name": "availabilityZone", "value": "slcp3-esx-az01" }, - {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, - {"name": "vmName", "value": "slcp34246vbc246ceb" }, - {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, - {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" } - ] - } - } -} -""" - - def vidUtilResp1 = """ - - CREATE_VF_MODULE_VOL - VID - test-service-instance-id-123 - - - - MSOTESTVOL101a-vSAMP12_base_vol_module-0 - Test/vSAMP12 - vSAMP12::base::module-0 - 2.0 - mdt1 - 88a6ca3ee0394ade9403f075db23167e - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - true - - - - STMTN5MMSC20 - US1117MTSNJVBR0246 - - pcrf-capacity - skask - slowburn - created - MDTWNJ21 - slcp3-esx-az01 - VLAN-OAM-1323 - slcp34246vbc246ceb - 970cd2b9-7f09-4a12-af47-182ea38ba1f0 - 545cc2c3-1930-4100-b534-5d82d0e12bb6 - - -""" - - def bpmnReq2 = """ -{ - "requestDetails": { - "modelInfo": { - "modelType": "volumeGroup", - "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12::base::module-0", - "modelVersion": "1" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "mdt1", - "tenantId": "88a6ca3ee0394ade9403f075db23167e" - }, - "requestInfo": { - "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", - "source": "VID", - "suppressRollback": false - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "{service-instance-id}", - "modelInfo": { - "modelType": "service", - "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "Test", - "modelVersion": "2.0" - } - } - }, { - "relatedInstance": { - "instanceId": "{vnf-instance-id}", - "modelInfo": { - "modelType": "vnf", - "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12", - "modelVersion": "1", - "modelInstanceName": "vSAMP12" - } - } - } - ] - } -} -""" - - def bpmnReqJsonVolumeSuppressRollbackTrue = """ -{ - "requestDetails": { - "modelInfo": { - "modelType": "volumeGroup", - "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12::base::module-0", - "modelVersion": "1" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "mdt1", - "tenantId": "88a6ca3ee0394ade9403f075db23167e" - }, - "requestInfo": { - "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", - "source": "VID", - "suppressRollback": true - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "{service-instance-id}", - "modelInfo": { - "modelType": "service", - "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "Test", - "modelVersion": "2.0" - } - } - }, { - "relatedInstance": { - "instanceId": "{vnf-instance-id}", - "modelInfo": { - "modelType": "vnf", - "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12", - "modelVersion": "1", - "modelInstanceName": "vSAMP12" - } - } - } - ] - } -} -""" - -def bpmnReqJsonVolumeSuppressRollbackFalse = """ -{ - "requestDetails": { - "modelInfo": { - "modelType": "volumeGroup", - "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12::base::module-0", - "modelVersion": "1" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "mdt1", - "tenantId": "88a6ca3ee0394ade9403f075db23167e" - }, - "requestInfo": { - "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", - "source": "VID", - "suppressRollback": false - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "{service-instance-id}", - "modelInfo": { - "modelType": "service", - "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "Test", - "modelVersion": "2.0" - } - } - }, { - "relatedInstance": { - "instanceId": "{vnf-instance-id}", - "modelInfo": { - "modelType": "vnf", - "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12", - "modelVersion": "1", - "modelInstanceName": "vSAMP12" - } - } - } - ] - } -} -""" - -def bpmnReqJsonVolumeSuppressRollbackNone = """ -{ - "requestDetails": { - "modelInfo": { - "modelType": "volumeGroup", - "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12::base::module-0", - "modelVersion": "1" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "mdt1", - "tenantId": "88a6ca3ee0394ade9403f075db23167e" - }, - "requestInfo": { - "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", - "source": "VID" - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "{service-instance-id}", - "modelInfo": { - "modelType": "service", - "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "Test", - "modelVersion": "2.0" - } - } - }, { - "relatedInstance": { - "instanceId": "{vnf-instance-id}", - "modelInfo": { - "modelType": "vnf", - "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12", - "modelVersion": "1", - "modelInstanceName": "vSAMP12" - } - } - } - ] - } -} -""" - - def bpmnReqJsonVfModuleSuppressRollbackTrue = """ -{ -"requestDetails": { -"modelInfo": { -"modelType": "vfModule", -"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", -"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", -"modelName": "STMTN5MMSC21-MMSC::model-1-0", -"modelVersion": "1" -}, -"cloudConfiguration": { -"lcpCloudRegionId": "MDTWNJ21", -"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" -}, -"requestInfo": { -"instanceName": "PCRF::module-0-2", -"source": "VID", -"suppressRollback": true -}, -"relatedInstanceList": [ -{ -"relatedInstance": { -"instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", -"instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", -"modelInfo": { -"modelType": "volumeGroup", -"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", -"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", -"modelName": "vSAMP12..base..module-0", -"modelVersion": "1" -} -} -}, -{ -"relatedInstance": { -"instanceId": "123456", -"modelInfo": { -"modelType": "service", -"modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", -"modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", -"modelName": "SERVICE_MODEL_NAME", -"modelVersion": "1.0" -} -} -}, -{ -"relatedInstance": { -"instanceId": "skask", -"instanceName": "skask-test", -"modelInfo": { -"modelType": "vnf", -"modelInvariantUuid": "skask", -"modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", -"modelName": "vSAMP12", -"modelVersion": "1.0", -"modelInstanceName": "vSAMP12 1" -} -} -} -], -"requestParameters": { -"userParams": {} -} -} -} -""" - -def bpmnReqJsonVfModuleSuppressRollbackFalse = """ -{ -"requestDetails": { -"modelInfo": { -"modelType": "vfModule", -"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", -"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", -"modelName": "STMTN5MMSC21-MMSC::model-1-0", -"modelVersion": "1" -}, -"cloudConfiguration": { -"lcpCloudRegionId": "MDTWNJ21", -"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" -}, -"requestInfo": { -"instanceName": "PCRF::module-0-2", -"source": "VID", -"suppressRollback": false -}, -"relatedInstanceList": [ -{ -"relatedInstance": { -"instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", -"instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", -"modelInfo": { -"modelType": "volumeGroup", -"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", -"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", -"modelName": "vSAMP12..base..module-0", -"modelVersion": "1" -} -} -}, -{ -"relatedInstance": { -"instanceId": "123456", -"modelInfo": { -"modelType": "service", -"modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", -"modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", -"modelName": "SERVICE_MODEL_NAME", -"modelVersion": "1.0" -} -} -}, -{ -"relatedInstance": { -"instanceId": "skask", -"instanceName": "skask-test", -"modelInfo": { -"modelType": "vnf", -"modelInvariantUuid": "skask", -"modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", -"modelName": "vSAMP12", -"modelVersion": "1.0", -"modelInstanceName": "vSAMP12 1" -} -} -} -], -"requestParameters": { -"userParams": {} -} -} -} -""" - -def bpmnReqJsonVfModuleSuppressRollbackNone = """ -{ -"requestDetails": { -"modelInfo": { -"modelType": "vfModule", -"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", -"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", -"modelName": "STMTN5MMSC21-MMSC::model-1-0", -"modelVersion": "1" -}, -"cloudConfiguration": { -"lcpCloudRegionId": "MDTWNJ21", -"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" -}, -"requestInfo": { -"instanceName": "PCRF::module-0-2", -"source": "VID" -}, -"relatedInstanceList": [ -{ -"relatedInstance": { -"instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", -"instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", -"modelInfo": { -"modelType": "volumeGroup", -"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", -"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", -"modelName": "vSAMP12..base..module-0", -"modelVersion": "1" -} -} -}, -{ -"relatedInstance": { -"instanceId": "123456", -"modelInfo": { -"modelType": "service", -"modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", -"modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", -"modelName": "SERVICE_MODEL_NAME", -"modelVersion": "1.0" -} -} -}, -{ -"relatedInstance": { -"instanceId": "skask", -"instanceName": "skask-test", -"modelInfo": { -"modelType": "vnf", -"modelInvariantUuid": "skask", -"modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", -"modelName": "vSAMP12", -"modelVersion": "1.0", -"modelInstanceName": "vSAMP12 1" -} -} -} -], -"requestParameters": { -"userParams": {} -} -} -} -""" - def vidUtilResp2 = """ - - CREATE_VF_MODULE_VOL - VID - test-service-instance-id-123 - - - - MSOTESTVOL101a-vSAMP12_base_vol_module-0 - Test/vSAMP12 - vSAMP12::base::module-0 - 2.0 - mdt1 - 88a6ca3ee0394ade9403f075db23167e - - true - - - - -""" - -def vidUtilVolumeRespBackoutOnFailureFalse = """ - - CREATE_VF_MODULE_VOL - VID - test-service-instance-id-123 - - - - MSOTESTVOL101a-vSAMP12_base_vol_module-0 - Test/vSAMP12 - vSAMP12::base::module-0 - 2.0 - mdt1 - 88a6ca3ee0394ade9403f075db23167e - - false - - - - -""" - -def vidUtilVolumeRespBackoutOnFailureTrue = """ - - CREATE_VF_MODULE_VOL - VID - test-service-instance-id-123 - - - - MSOTESTVOL101a-vSAMP12_base_vol_module-0 - Test/vSAMP12 - vSAMP12::base::module-0 - 2.0 - mdt1 - 88a6ca3ee0394ade9403f075db23167e - - true - - - - -""" - -def vidUtilVolumeRespBackoutOnFailureEmpty = """ - - CREATE_VF_MODULE_VOL - VID - test-service-instance-id-123 - - - - MSOTESTVOL101a-vSAMP12_base_vol_module-0 - Test/vSAMP12 - vSAMP12::base::module-0 - 2.0 - mdt1 - 88a6ca3ee0394ade9403f075db23167e - - - - - - -""" - -def vidUtilVfModuleRespBackoutOnFailureFalse = """ - - test-request-id-123 - CREATE_VF_MODULE - VID - - test-service-instance-id-123 - - - skask-test - test-vnf-type-123 - test-vnf-id-123 - test-volume-group-id-123 - test-vf-module-id-123 - PCRF::module-0-2 - STMTN5MMSC21-MMSC::model-1-0 - - false - 1.0 - MDTWNJ21 - fba1bd1e195a404cacb9ce17a9b2b421 - - false - ff5256d2-5a33-55df-13ab-12abad84e7ff - fe6478e5-ea33-3346-ac12-ab121484a3fe - - - -""" - -def vidUtilVfModuleRespBackoutOnFailureTrue = """ - - test-request-id-123 - CREATE_VF_MODULE - VID - - test-service-instance-id-123 - - - skask-test - test-vnf-type-123 - test-vnf-id-123 - test-volume-group-id-123 - test-vf-module-id-123 - PCRF::module-0-2 - STMTN5MMSC21-MMSC::model-1-0 - - false - 1.0 - MDTWNJ21 - fba1bd1e195a404cacb9ce17a9b2b421 - - true - ff5256d2-5a33-55df-13ab-12abad84e7ff - fe6478e5-ea33-3346-ac12-ab121484a3fe - - - -""" - -def vidUtilVfModuleRespBackoutOnFailureEmpty = """ - - test-request-id-123 - CREATE_VF_MODULE - VID - - test-service-instance-id-123 - - - skask-test - test-vnf-type-123 - test-vnf-id-123 - test-volume-group-id-123 - test-vf-module-id-123 - PCRF::module-0-2 - STMTN5MMSC21-MMSC::model-1-0 - - false - 1.0 - MDTWNJ21 - fba1bd1e195a404cacb9ce17a9b2b421 - - - ff5256d2-5a33-55df-13ab-12abad84e7ff - fe6478e5-ea33-3346-ac12-ab121484a3fe - - - -""" - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - - } - - @Test - public void test() { - - def jsonSlurper = new JsonSlurper() - Map reqMap = jsonSlurper.parseText(bpmnReq1) - - VidUtils vidUtils = new VidUtils() - def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') - print xmlReq - assertEquals(vidUtilResp1, xmlReq) - } - - //@Test - public void testVfModule() { - - def jsonSlurper = new JsonSlurper() - Map reqMap = jsonSlurper.parseText(vfModuleReqJson) - - VidUtils vidUtils = new VidUtils() - def xmlReq = vidUtils.createXmlVfModuleRequest(null, reqMap, "CREATE_VF_MODULE", "test-service-instance-id-123") - print xmlReq - assertTrue(true) - } - - @Test - public void testNoRequestParams() { - - def jsonSlurper = new JsonSlurper() - Map reqMap = jsonSlurper.parseText(bpmnReq2) - - VidUtils vidUtils = new VidUtils() - def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') - - assertEquals(vidUtilResp2, xmlReq) - } - - @Test - public void testVfModuleVolumeRollbackTrue() { - - def jsonSlurper = new JsonSlurper() - Map reqMap = jsonSlurper.parseText(bpmnReqJsonVolumeSuppressRollbackTrue) - - VidUtils vidUtils = new VidUtils() - def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') - - assertEquals(vidUtilVolumeRespBackoutOnFailureFalse, xmlReq) - } - - @Test - public void testVfModuleVolumeRollbackFalse() { - - def jsonSlurper = new JsonSlurper() - Map reqMap = jsonSlurper.parseText(bpmnReqJsonVolumeSuppressRollbackFalse) - - VidUtils vidUtils = new VidUtils() - def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') - - assertEquals(vidUtilVolumeRespBackoutOnFailureTrue, xmlReq) - } - - @Test - public void testVfModuleVolumeRollbackNone() { - - def jsonSlurper = new JsonSlurper() - Map reqMap = jsonSlurper.parseText(bpmnReqJsonVolumeSuppressRollbackNone) - - VidUtils vidUtils = new VidUtils() - def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') - - assertEquals(vidUtilVolumeRespBackoutOnFailureEmpty, xmlReq) - } - - @Test - public void testVfModuleRollbackTrue() { - - def jsonSlurper = new JsonSlurper() - Map reqMap = jsonSlurper.parseText(bpmnReqJsonVfModuleSuppressRollbackTrue) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("vnfType")).thenReturn('test-vnf-type-123') - when(mockExecution.getVariable("vnfId")).thenReturn('test-vnf-id-123') - when(mockExecution.getVariable("vfModuleId")).thenReturn('test-vf-module-id-123') - when(mockExecution.getVariable("volumeGroupId")).thenReturn('test-volume-group-id-123') - when(mockExecution.getVariable("isBaseVfModule")).thenReturn('false') - when(mockExecution.getVariable("mso-request-id")).thenReturn('test-request-id-123') - - VidUtils vidUtils = new VidUtils() - def xmlReq = vidUtils.createXmlVfModuleRequest(mockExecution, reqMap, 'CREATE_VF_MODULE', 'test-service-instance-id-123') - - println 'ggg->' + xmlReq - assertEquals(vidUtilVfModuleRespBackoutOnFailureFalse, xmlReq) - } - - @Test - public void testVfModuleRollbackFalse() { - - def jsonSlurper = new JsonSlurper() - Map reqMap = jsonSlurper.parseText(bpmnReqJsonVfModuleSuppressRollbackFalse) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("vnfType")).thenReturn('test-vnf-type-123') - when(mockExecution.getVariable("vnfId")).thenReturn('test-vnf-id-123') - when(mockExecution.getVariable("vfModuleId")).thenReturn('test-vf-module-id-123') - when(mockExecution.getVariable("volumeGroupId")).thenReturn('test-volume-group-id-123') - when(mockExecution.getVariable("isBaseVfModule")).thenReturn('false') - when(mockExecution.getVariable("mso-request-id")).thenReturn('test-request-id-123') - - VidUtils vidUtils = new VidUtils() - def xmlReq = vidUtils.createXmlVfModuleRequest(mockExecution, reqMap, 'CREATE_VF_MODULE', 'test-service-instance-id-123') - - println 'ggg->' + xmlReq - assertEquals(vidUtilVfModuleRespBackoutOnFailureTrue, xmlReq) - } - - @Test - public void testVfModuleRollbackNone() { - - def jsonSlurper = new JsonSlurper() - Map reqMap = jsonSlurper.parseText(bpmnReqJsonVfModuleSuppressRollbackNone) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("vnfType")).thenReturn('test-vnf-type-123') - when(mockExecution.getVariable("vnfId")).thenReturn('test-vnf-id-123') - when(mockExecution.getVariable("vfModuleId")).thenReturn('test-vf-module-id-123') - when(mockExecution.getVariable("volumeGroupId")).thenReturn('test-volume-group-id-123') - when(mockExecution.getVariable("isBaseVfModule")).thenReturn('false') - when(mockExecution.getVariable("mso-request-id")).thenReturn('test-request-id-123') - - VidUtils vidUtils = new VidUtils() - def xmlReq = vidUtils.createXmlVfModuleRequest(mockExecution, reqMap, 'CREATE_VF_MODULE', 'test-service-instance-id-123') - - println 'ggg->' + xmlReq - assertEquals(vidUtilVfModuleRespBackoutOnFailureEmpty, xmlReq) - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1Test.groovy deleted file mode 100644 index b37676a044..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1Test.groovy +++ /dev/null @@ -1,44 +0,0 @@ -package org.openecomp.mso.bpmn.common.scripts - -import org.junit.Test -import static org.junit.Assert.*; - -class VnfAdapterRestV1Test { - - - def rollbackReq = """ - - - 8a07b246-155e-4b08-b56e-76e98a3c2d66 - phmaz401me6-vpevre-VOLUMEGROUP/dbd560b6-b03f-4a17-92e7-8942459a60c1 - mtrnj1b - cfb5e0a790374c9a98a1c0d2044206a7 - true - - 1e1a72ca-7300-4ac4-b718-30351f3b6845 - 15eb2c68-f771-4030-b185-cff179fdad44 - - 683ca1ac-2145-4a00-9484-20d48bd701aa - - true - http://msobpel-app-e2e.ecomp.cci.att.com:8080/mso/WorkflowMessage/VNFAResponse/683ca1ac-2145-4a00-9484-20d48bd701aa - -""" - - @Test - public void testGetNodeText() { - Node root = new XmlParser().parseText(rollbackReq) - def volGrpId = root.'volumeGroupRollback'.'volumeGroupId'.text() - assertEquals('8a07b246-155e-4b08-b56e-76e98a3c2d66', volGrpId) - } - - @Test - public void testGetMessageId() { - Node root = new XmlParser().parseText(rollbackReq) - //def messageId = root.'volumeGroupRollback'.'messageId'.text() - - VnfAdapterRestV1 p = new VnfAdapterRestV1() - def messageId = p.getMessageIdForVolumeGroupRollback(root) - assertEquals('683ca1ac-2145-4a00-9484-20d48bd701aa', messageId) - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllBaseTaskTestSuite.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllBaseTaskTestSuite.java new file mode 100644 index 0000000000..cd9bdc9532 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllBaseTaskTestSuite.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; + +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses({"**/common/aai/tasks/*Test.class", "**/bpmn/sdno/tasks/*Test.class", "**/buildingblock/SniroHomingV2Test.class"}) +public class AllBaseTaskTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllGroovyTestSuites.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllGroovyTestSuites.java new file mode 100644 index 0000000000..696323c4ad --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllGroovyTestSuites.java @@ -0,0 +1,32 @@ +/*- + * ============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; +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses({"**/bpmn/common/scripts/**/*Test.class"}) +public class AllGroovyTestSuites { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllTestSuites.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllTestSuites.java new file mode 100644 index 0000000000..fa70ccf23d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllTestSuites.java @@ -0,0 +1,32 @@ +/*- + * ============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; +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses({"**/*Test.class", "!**/bpmn/common/scripts/**/*Test.class"}) +public class AllTestSuites { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java new file mode 100644 index 0000000000..d2f1186ad0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java @@ -0,0 +1,163 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.model.bpmn.Bpmn; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.junit.Before; +import org.junit.runner.RunWith; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.common.MockLoggerDelegate; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupMapperLayer; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.embedded.LocalServerPort; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.boot.test.mock.mockito.SpyBean; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; +import org.springframework.http.HttpHeaders; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.tomakehurst.wiremock.client.WireMock; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +@ContextConfiguration +@AutoConfigureWireMock(port = 0) +public abstract class BaseTest extends BuildingBlockTestDataSetup { + + + protected Map variables = new HashMap<>(); + + protected TestRestTemplate restTemplate = new TestRestTemplate(); + + protected HttpHeaders headers = new HttpHeaders(); + + + @Autowired + protected RuntimeService runtimeService; + + @Autowired + private RepositoryService repositoryService; + /* + * Mocked for injection via autowiring + */ + + @Value("${mso.catalog.db.spring.endpoint}") + protected String endpoint; + + @Value("${wiremock.server.port}") + protected String wireMockPort; + + @MockBean + protected CatalogDbClient MOCK_catalogDbClient; + + @SpyBean + protected InjectionHelper MOCK_injectionHelper; + + @SpyBean + protected ExceptionBuilder exceptionUtil; + + /* + * Classes that cannot be simply mocked because they are both + * needed for testing another class, and must be autowired when + * being tested themselves....or classes with private methods that + * must be stubbed during testing + */ + + @SpyBean + protected BBInputSetupMapperLayer SPY_bbInputSetupMapperLayer; + @SpyBean + protected BBInputSetupUtils SPY_bbInputSetupUtils; + @SpyBean + protected BBInputSetup SPY_bbInputSetup; + + /* + * Mocked for injection via the IntectionHelper + */ + + + + @Before + public void baseTestBefore() { + WireMock.reset(); + variables.put("gBuildingBlockExecution", execution); + } + + @LocalServerPort + private int port; + + protected String readFile(String path) throws IOException { + return readFile(path, Charset.defaultCharset()); + } + + protected String readFile(String path, Charset encoding) throws IOException { + byte[] encoded = Files.readAllBytes(Paths.get(path)); + return new String(encoded, encoding); + } + + protected String readJsonFileAsString(String fileLocation) throws IOException{ + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(new File(fileLocation)); + return jsonNode.asText(); + } + + protected String createURLWithPort(String uri) { + return "http://localhost:" + port + uri; + } + /** + * Create and deploy a process model with one logger delegate as service task. + * + * @param origProcessKey + * key to call + * @param mockProcessName + * process name + * @param fileName + * file name without extension + */ + protected void mockSubprocess(String origProcessKey, String mockProcessName, String fileName) { + BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(origProcessKey).name(mockProcessName) + .startEvent().name("Start Point").serviceTask().name("Log Something for Test") + .camundaClass(MockLoggerDelegate.class.getName()).endEvent().name("End Point").done(); + repositoryService.createDeployment().addModelInstance(fileName + ".bpmn", modelInstance).deploy(); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseUnitTest.java new file mode 100644 index 0000000000..5719ce15e2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseUnitTest.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; + +public abstract class BaseUnitTest extends BuildingBlockTestDataSetup{ + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java new file mode 100644 index 0000000000..a983193ca3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java @@ -0,0 +1,668 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.assertj.core.util.Arrays; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; +import org.junit.Before; +import org.junit.Rule; +import org.junit.rules.ExpectedException; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoAllottedResource; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy; + +public class BuildingBlockTestDataSetup{ + private int collectionCounter; + private int configurationCounter; + private int customerCounter; + private int genericVnfCounter; + private int instanceGroupCounter; + private int l3NetworkCounter; + private int owningEntityCounter; + private int pnfCounter; + private int projectCounter; + private int serviceInstanceCounter; + private int serviceProxyCounter; + private int serviceSubscriptionCounter; + private int vfModuleCounter; + private int volumeGroupCounter; + private int vpnBindingCounter; + private int vpnBondingLinkCounter; + + protected BuildingBlockExecution execution; + + protected GeneralBuildingBlock gBBInput; + + protected HashMap lookupKeyMap; + + protected ExtractPojosForBB extractPojosForBB = new ExtractPojosForBB(); + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + protected DelegateExecution delegateExecution; + + @Before + public void buildingBlockTestDataSetupBefore() { + collectionCounter = 0; + configurationCounter = 0; + customerCounter = 0; + genericVnfCounter = 0; + instanceGroupCounter = 0; + l3NetworkCounter = 0; + owningEntityCounter = 0; + pnfCounter = 0; + projectCounter = 0; + serviceInstanceCounter = 0; + serviceProxyCounter = 0; + serviceSubscriptionCounter = 0; + vfModuleCounter = 0; + volumeGroupCounter = 0; + vpnBindingCounter = 0; + vpnBondingLinkCounter = 0; + + execution = new DelegateExecutionImpl(new ExecutionImpl()); + execution.setVariable("testProcessKey", "testProcessKeyValue"); + + gBBInput = new GeneralBuildingBlock(); + execution.setVariable("gBBInput", gBBInput); + + lookupKeyMap = new HashMap(); + execution.setVariable("lookupKeyMap", lookupKeyMap); + + ExecutionImpl mockExecutionImpl = mock(ExecutionImpl.class); + doReturn("test").when(mockExecutionImpl).getProcessInstanceId(); + + ExecutionImpl executionImpl = new ExecutionImpl(); + executionImpl.setProcessInstance(mockExecutionImpl); + + delegateExecution = (DelegateExecution) executionImpl; + delegateExecution.setVariable("testProcessKey", "testProcessKeyValue"); + } + + public Map buildUserInput() { + Map userInput = new HashMap<>(); + userInput.put("testUserInputKey", "testUserInputValue"); + + return userInput; + } + + public Map setUserInput() { + Map userInput = buildUserInput(); + + gBBInput.setUserInput(userInput); + + return userInput; + } + + public RequestContext buildRequestContext() { + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId(UUID.randomUUID().toString()); + requestContext.setProductFamilyId("testProductFamilyId"); + requestContext.setRequestorId("testRequestorId"); + + requestContext.setUserParams(new HashMap<>()); + + Map dataMap = new HashMap<>(); + dataMap.put("vpnId","testVpnId"); + dataMap.put("vpnRegion","testVpnRegion"); + dataMap.put("vpnRt","testVpnRt"); + dataMap.put("vpnName","vpnName"); + dataMap.put("vpnRegion", Arrays.asList(new String[] {"USA", "EMEA", "APAC"})); + + HashMap userParams = new HashMap<>(); + userParams.put("vpnData",dataMap); + + List> userParamsList = new ArrayList<>(); + userParamsList.add(userParams); + + RequestParameters requestParameters = new RequestParameters(); + requestParameters.setUserParams(userParamsList); + requestContext.setRequestParameters(requestParameters); + + return requestContext; + } + + public RequestContext setRequestContext() { + RequestContext requestContext = buildRequestContext(); + + gBBInput.setRequestContext(requestContext); + + return requestContext; + } + + public CloudRegion buildCloudRegion() { + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("testLcpCloudRegionId"); + cloudRegion.setTenantId("testTenantId"); + cloudRegion.setCloudOwner("testCloudOwner"); + + return cloudRegion; + } + + public CloudRegion setCloudRegion() { + CloudRegion cloudRegion = buildCloudRegion(); + + gBBInput.setCloudRegion(cloudRegion); + + return cloudRegion; + } + + public OrchestrationContext buildOrchestrationContext() { + OrchestrationContext orchestrationContext = new OrchestrationContext(); + + return orchestrationContext; + } + + public OrchestrationContext setOrchestrationContext() { + OrchestrationContext orchestrationContext = buildOrchestrationContext(); + + gBBInput.setOrchContext(orchestrationContext); + + return orchestrationContext; + } + + public Collection buildCollection() { + collectionCounter++; + + Collection collection = new Collection(); + collection.setId("testId" + collectionCounter); + collection.setInstanceGroup(buildInstanceGroup()); + + return collection; + } + + public Configuration buildConfiguration() { + configurationCounter++; + + Configuration configuration = new Configuration(); + configuration.setConfigurationId("testConfigurationId" + configurationCounter); + configuration.setConfigurationName("testConfigurationName" + configurationCounter); + + ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); + modelInfoConfiguration.setModelVersionId("testModelVersionId" + configurationCounter); + modelInfoConfiguration.setModelInvariantId("testModelInvariantId" + configurationCounter); + modelInfoConfiguration.setModelCustomizationId("testModelCustomizationId" + configurationCounter); + + configuration.setModelInfoConfiguration(modelInfoConfiguration); + + return configuration; + } + + public OwningEntity buildOwningEntity() { + owningEntityCounter++; + + OwningEntity owningEntity = new OwningEntity(); + owningEntity.setOwningEntityId("testOwningEntityId" + owningEntityCounter); + owningEntity.setOwningEntityName("testOwningEntityName" + owningEntityCounter); + + return owningEntity; + } + + public Project buildProject() { + projectCounter++; + + Project project = new Project(); + project.setProjectName("testProjectName" + projectCounter); + + return project; + } + + public ServiceSubscription buildServiceSubscription() { + serviceSubscriptionCounter++; + + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setTempUbSubAccountId("testTempUbSubAccountId" + serviceSubscriptionCounter); + serviceSubscription.setServiceType("testServiceType" + serviceSubscriptionCounter); + + return serviceSubscription; + } + + public Customer buildCustomer() { + customerCounter++; + + Customer customer = new Customer(); + customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter); + customer.setSubscriberType("testSubscriberType" + customerCounter); + + customer.setServiceSubscription(buildServiceSubscription()); + + return customer; + } + + public ServiceInstance buildServiceInstance() { + serviceInstanceCounter++; + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("testServiceInstanceId" + serviceInstanceCounter); + serviceInstance.setServiceInstanceName("testServiceInstanceName" + serviceInstanceCounter); + + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("testModelInvariantUUID" + serviceInstanceCounter); + modelInfoServiceInstance.setModelUuid("testModelUUID" + serviceInstanceCounter); + modelInfoServiceInstance.setModelVersion("testModelVersion" + serviceInstanceCounter); + modelInfoServiceInstance.setModelName("testModelName" + serviceInstanceCounter); + modelInfoServiceInstance.setServiceType("testServiceType" + serviceInstanceCounter); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + serviceInstance.setProject(buildProject()); + + serviceInstance.setOwningEntity(buildOwningEntity()); + + serviceInstance.setCollection(buildCollection()); + + serviceInstance.getConfigurations().add(buildConfiguration()); + + return serviceInstance; + } + + public ServiceInstance setServiceInstance() { + ServiceInstance serviceInstance = buildServiceInstance(); + + if(gBBInput.getCustomer() == null) { + gBBInput.setCustomer(buildCustomer()); + } + gBBInput.getCustomer().getServiceSubscription().getServiceInstances().add(serviceInstance); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId()); + + return serviceInstance; + } + + public Customer setCustomer() { + if(gBBInput.getCustomer() != null) return gBBInput.getCustomer(); + Customer customer = new Customer(); + customer.setGlobalCustomerId("testGlobalCustomerId"); + customer.setSubscriberType("testSubscriberType"); + + customer.setServiceSubscription(buildServiceSubscription()); + + gBBInput.setCustomer(customer); + + return customer; + } + + public Collection setCollection() { + Collection collection = new Collection(); + collection.setId("testId"); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.setCollection(collection); + + return collection; + } + + public InstanceGroup setInstanceGroup() { + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId("testId"); + instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction"); + + Collection collection = null; + + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + collection = serviceInstance.getCollection(); + + if (collection == null) { + collection = setCollection(); + } + } catch(BBObjectNotFoundException e) { + collection = setCollection(); + } + + collection.setInstanceGroup(instanceGroup); + + return instanceGroup; + } + + public VpnBinding buildVpnBinding() { + vpnBindingCounter++; + + VpnBinding vpnBinding = new VpnBinding(); + vpnBinding.setVpnId("testVpnId" + vpnBindingCounter); + vpnBinding.setVpnName("testVpnName" + vpnBindingCounter); + vpnBinding.setCustomerVpnId("testCustomerVpnId" + vpnBindingCounter); + + return vpnBinding; + } + + public VpnBinding setVpnBinding() { + VpnBinding vpnBinding = buildVpnBinding(); + + Customer customer = gBBInput.getCustomer(); + + if(customer == null){ + customer = buildCustomer(); + } + + customer.getVpnBindings().add(vpnBinding); + lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId()); + + return vpnBinding; + } + + public InstanceGroup buildInstanceGroup() { + instanceGroupCounter++; + + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId("testId" + instanceGroupCounter); + instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter); + + return instanceGroup; + } + + public L3Network buildL3Network() { + l3NetworkCounter++; + + L3Network network = new L3Network(); + network.setNetworkId("testNetworkId" + l3NetworkCounter); + network.setNetworkName("testNetworkName" + l3NetworkCounter); + network.setNetworkType("testNetworkType" + l3NetworkCounter); + + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + modelInfoNetwork.setModelInvariantUUID("testModelInvariantUUID" + l3NetworkCounter); + modelInfoNetwork.setModelName("testModelName" + l3NetworkCounter); + modelInfoNetwork.setModelVersion("testModelVersion" + l3NetworkCounter); + modelInfoNetwork.setModelUUID("testModelUUID" + l3NetworkCounter); + network.setModelInfoNetwork(modelInfoNetwork); + + return network; + } + + public L3Network setL3Network() { + L3Network network = buildL3Network(); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.getNetworks().add(network); + lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId()); + + return network; + } + + public GenericVnf buildGenericVnf() { + genericVnfCounter++; + + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId("testVnfId" + genericVnfCounter); + genericVnf.setVnfName("testVnfName" + genericVnfCounter); + genericVnf.setVnfType("testVnfType" + genericVnfCounter); + + Platform platform = new Platform(); + platform.setPlatformName("testPlatformName"); + genericVnf.setPlatform(platform); + + LineOfBusiness lob = new LineOfBusiness(); + lob.setLineOfBusinessName("testLineOfBusinessName"); + genericVnf.setLineOfBusiness(lob); + + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelName("testModelName" + genericVnfCounter); + modelInfoGenericVnf.setModelCustomizationUuid("testModelCustomizationUUID" + genericVnfCounter); + modelInfoGenericVnf.setModelInvariantUuid("testModelInvariantUUID" + genericVnfCounter); + modelInfoGenericVnf.setModelVersion("testModelVersion" + genericVnfCounter); + modelInfoGenericVnf.setModelUuid("testModelUUID" + genericVnfCounter); + modelInfoGenericVnf.setModelInstanceName("testModelInstanceName" + genericVnfCounter); + genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + return genericVnf; + } + + public GenericVnf setGenericVnf() { + GenericVnf genericVnf = buildGenericVnf(); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.getVnfs().add(genericVnf); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId()); + + return genericVnf; + } + + public VfModule buildVfModule() { + vfModuleCounter++; + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter); + vfModule.setVfModuleName("testVfModuleName" + vfModuleCounter); + + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID" + vfModuleCounter); + modelInfoVfModule.setModelVersion("testModelVersion" + vfModuleCounter); + modelInfoVfModule.setModelUUID("testModelUUID" + vfModuleCounter); + modelInfoVfModule.setModelName("testModelName" + vfModuleCounter); + modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID" + vfModuleCounter); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + return vfModule; + } + + public VfModule setVfModule() { + VfModule vfModule = buildVfModule(); + + GenericVnf genericVnf = null; + + try { + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + } catch(BBObjectNotFoundException e) { + genericVnf = setGenericVnf(); + } + + genericVnf.getVfModules().add(vfModule); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId()); + + return vfModule; + } + + public VolumeGroup buildVolumeGroup() { + volumeGroupCounter++; + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("testVolumeGroupId" + volumeGroupCounter); + volumeGroup.setVolumeGroupName("testVolumeGroupName" + volumeGroupCounter); + volumeGroup.setHeatStackId("testHeatStackId" + volumeGroupCounter); + + return volumeGroup; + } + + public VolumeGroup setVolumeGroup() { + VolumeGroup volumeGroup = buildVolumeGroup(); + + GenericVnf genericVnf = null; + + try { + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + } catch(BBObjectNotFoundException e) { + genericVnf = setGenericVnf(); + } + + genericVnf.getVolumeGroups().add(volumeGroup); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); + + return volumeGroup; + } + + public Pnf buildPnf() { + pnfCounter++; + + Pnf pnf = new Pnf(); + pnf.setPnfId("testPnfId" + pnfCounter); + pnf.setPnfName("testPnfName" + pnfCounter); + + return pnf; + } + + public ServiceProxy buildServiceProxy() { + serviceProxyCounter++; + + ServiceProxy serviceProxy = new ServiceProxy(); + serviceProxy.setServiceInstance(buildServiceInstance()); + serviceProxy.getServiceInstance().getVnfs().add(buildGenericVnf()); + + Pnf primaryPnf = buildPnf(); + primaryPnf.setRole("Primary"); + serviceProxy.getServiceInstance().getPnfs().add(primaryPnf); + + Pnf secondaryPnf = buildPnf(); + secondaryPnf.setRole("Secondary"); + serviceProxy.getServiceInstance().getPnfs().add(secondaryPnf); + + return serviceProxy; + } + + public VpnBondingLink buildVpnBondingLink() { + vpnBondingLinkCounter++; + + VpnBondingLink vpnBondingLink = new VpnBondingLink(); + vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter); + + Configuration vnrConfiguration = buildConfiguration(); + vnrConfiguration.setNetwork(buildL3Network()); + vpnBondingLink.setVnrConfiguration(vnrConfiguration); + + vpnBondingLink.setVrfConfiguration(buildConfiguration()); + + vpnBondingLink.setInfrastructureServiceProxy(buildServiceProxy()); + + vpnBondingLink.setTransportServiceProxy(buildServiceProxy()); + + return vpnBondingLink; + } + + public VpnBondingLink setVpnBondingLink() { + VpnBondingLink vpnBondingLink = buildVpnBondingLink(); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.getVpnBondingLinks().add(vpnBondingLink); + lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId()); + + + return vpnBondingLink; + } + + public Customer setAvpnCustomer() { + Customer customer = buildCustomer(); + + gBBInput.setCustomer(customer); + + return customer; + } + + public ServiceProxy setServiceProxy(String uniqueIdentifier, String type) { + ServiceProxy serviceProxy = new ServiceProxy(); + serviceProxy.setId("testProxyId" + uniqueIdentifier); + serviceProxy.setType(type); + + ModelInfoServiceProxy modelInfo = new ModelInfoServiceProxy(); + modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier); + modelInfo.setModelName("testProxyModelName" + uniqueIdentifier); + modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier); + modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier); + modelInfo.setModelInstanceName("testProxyInstanceName" + uniqueIdentifier); + + serviceProxy.setModelInfoServiceProxy(modelInfo); + + return serviceProxy; + } + + public AllottedResource setAllottedResource(String uniqueIdentifier) { + AllottedResource ar = new AllottedResource(); + ar.setId("testAllottedResourceId" + uniqueIdentifier); + + ModelInfoAllottedResource modelInfo = new ModelInfoAllottedResource(); + modelInfo.setModelInvariantUuid("testAllottedModelInvariantUuid" + uniqueIdentifier); + modelInfo.setModelName("testAllottedModelName" + uniqueIdentifier); + modelInfo.setModelUuid("testAllottedModelUuid" + uniqueIdentifier); + modelInfo.setModelVersion("testAllottedModelVersion" + uniqueIdentifier); + modelInfo.setModelInstanceName("testAllottedInstanceName" + uniqueIdentifier); + + ar.setModelInfoAllottedResource(modelInfo); + + return ar; + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java new file mode 100644 index 0000000000..a29df9cbcf --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java @@ -0,0 +1,64 @@ +/*- + * ============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; +import ch.vorburger.exec.ManagedProcessException; +import ch.vorburger.mariadb4j.DBConfigurationBuilder; +import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import javax.sql.DataSource; + +@Configuration +@Profile({"test"}) +public class EmbeddedMariaDbConfig { + + @Bean + MariaDB4jSpringService mariaDB4jSpringService() { + MariaDB4jSpringService service = new MariaDB4jSpringService(); + + + service.getConfiguration().addArg("--lower_case_table_names=1"); + return service; + } + + @Bean + DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService, + @Value("${mariaDB4j.databaseName}") String databaseName, + @Value("${spring.datasource.username}") String datasourceUsername, + @Value("${spring.datasource.password}") String datasourcePassword, + @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException { + //Create our database with default root user and no password + mariaDB4jSpringService.getDB().createDB(databaseName); + + DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration(); + + return DataSourceBuilder + .create() + .username(datasourceUsername) + .password(datasourcePassword) + .url(config.getURL(databaseName)) + .driverClassName(datasourceDriver) + .build(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/SerializableChecker.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/SerializableChecker.java new file mode 100644 index 0000000000..97c17d5238 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/SerializableChecker.java @@ -0,0 +1,181 @@ +/*- + * ============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; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public final class SerializableChecker +{ + public static class SerializationFailure + { + private final String mContainingClass; + private final String mMemberName; + + public SerializationFailure(String inNonSerializableClass, String inMemberName) + { + mContainingClass = inNonSerializableClass; + mMemberName = inMemberName; + } + + public String getContainingClass() + { + return mContainingClass; + } + + public String getMemberName() + { + return mMemberName; + } + + public String getBadMemberString() + { + if (mMemberName == null) + return mContainingClass; + return mContainingClass + "." + mMemberName; + } + + @Override + public String toString() + { + return "SerializationFailure [mNonSerializableClass=" + mContainingClass + ", mMemberName=" + mMemberName + "]"; + } + } + + private static class SerializationCheckerData + { + private Set> mSerializableClasses; + + SerializationCheckerData() + { + mSerializableClasses = new HashSet>(); + } + + boolean isAlreadyChecked(Class inClass) + { + return mSerializableClasses.contains(inClass); + } + + void addSerializableClass(Class inClass) + { + mSerializableClasses.add(inClass); + } + } + + private SerializableChecker() + { } + + public static SerializationFailure isFullySerializable(Class inClass) + { + if (!isSerializable(inClass)) + return new SerializationFailure(inClass.getName(), null); + + return isFullySerializable(inClass, new SerializationCheckerData()); + } + + private static SerializationFailure isFullySerializable(Class inClass, SerializationCheckerData inSerializationCheckerData) + { + for (Field field : declaredFields(inClass)) + { + Class fieldDeclaringClass = field.getType(); + + if (field.getType() == Object.class) + continue; + + if (Modifier.isStatic(field.getModifiers())) + continue; + + if (field.isSynthetic()) + continue; + + if (fieldDeclaringClass.isInterface() || fieldDeclaringClass.isPrimitive()) + continue; + + if (Modifier.isAbstract(field.getType().getModifiers())) + continue; + + if (inSerializationCheckerData.isAlreadyChecked(fieldDeclaringClass)) + continue; + + if (isSerializable(fieldDeclaringClass)) + { + inSerializationCheckerData.addSerializableClass(inClass); + + SerializationFailure failure = isFullySerializable(field.getType(), inSerializationCheckerData); + if (failure != null) + return failure; + else + continue; + } + + if (Modifier.isTransient(field.getModifiers())) + continue; + + return new SerializationFailure(field.getDeclaringClass().getName(), field.getName()); + } + return null; + } + + private static boolean isSerializable(Class inClass) + { + Set> interfaces = getInterfaces(inClass); + if (interfaces == null) + return false; + boolean isSerializable = interfaces.contains(Serializable.class); + if (isSerializable) + return true; + + for (Class classInterface : interfaces) + { + if (isSerializable(classInterface)) + return true; + } + + if (inClass.getSuperclass() != null && isSerializable(inClass.getSuperclass())) + return true; + + return false; + } + + private static Set> getInterfaces(Class inFieldDeclaringClass) + { + return new HashSet>(Arrays.asList(inFieldDeclaringClass.getInterfaces())); + } + + private static List declaredFields(Class inClass) + { + List fields = new ArrayList(Arrays.asList(inClass.getDeclaredFields())); + + Class parentClasses = inClass.getSuperclass(); + + if (parentClasses == null) + return fields; + fields.addAll(declaredFields(parentClasses)); + + return fields; + } + } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java new file mode 100644 index 0000000000..ba8caee058 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.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; + +import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; +import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; +import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; +import org.onap.so.requestsdb.RequestsDBHelper; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.ComponentScan.Filter; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.Profile; + +@SpringBootApplication +@Profile("test") +@EnableProcessApplication("MSO CommonBPMN Test Application") +@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) +public class TestApplication { + public static void main(String... args) { + SpringApplication.run(TestApplication.class, args); + System.getProperties().setProperty("mso.db", "MARIADB"); + System.getProperties().setProperty("server.name", "Springboot"); + + + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplicationConfig.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplicationConfig.java new file mode 100644 index 0000000000..c483f13887 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplicationConfig.java @@ -0,0 +1,96 @@ +/*- + * ============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; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.List; + +import org.onap.so.bpmn.common.WorkflowTestTransformer; +import org.springframework.cloud.contract.wiremock.WireMockConfigurationCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; + +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; +import com.github.tomakehurst.wiremock.extension.ResponseTransformer; + +@Configuration +@Profile({"test"}) +public class TestApplicationConfig { + + @Bean + protected ResponseTransformer[] transformerArray() { + // Process WorkflowTestTransformer annotations + List transformerList = new ArrayList(); + + for (Field field : getClass().getFields()) { + WorkflowTestTransformer annotation = field.getAnnotation(WorkflowTestTransformer.class); + + if (annotation == null) { + continue; + } + + if (!Modifier.isStatic(field.getModifiers())) { + throw new RuntimeException(field.getDeclaringClass().getName() + + "#" + field.getName() + " has a @WorkflowTestTransformer " + + " annotation but it is not declared static"); + } + + ResponseTransformer transformer; + + try { + transformer = (ResponseTransformer) field.get(null); + } catch (IllegalAccessException e) { + throw new RuntimeException(field.getDeclaringClass().getName() + + "#" + field.getName() + " is not accessible", e); + } catch (ClassCastException e) { + throw new RuntimeException(field.getDeclaringClass().getName() + + "#" + field.getName() + " is not a ResponseTransformer", e); + } + + if (transformer == null) { + continue; + } + + transformerList.add(transformer); + } + + ResponseTransformer[] transformerArray = + transformerList.toArray(new ResponseTransformer[transformerList.size()]); + + optionsCustomizer(transformerArray); + + return transformerArray; + } + + @Bean + WireMockConfigurationCustomizer optionsCustomizer(ResponseTransformer[] transformerArray) { + return new WireMockConfigurationCustomizer() { + @Override + public void customize(WireMockConfiguration options) { + options.extensions(transformerArray); + } + }; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java new file mode 100644 index 0000000000..8d681d721c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java @@ -0,0 +1,81 @@ +/*- + * ============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.bpmn.appc.payload; + +import static org.junit.Assert.assertEquals; + +import java.util.Optional; + +import org.json.JSONObject; +import org.junit.Test; + +public class PayloadClientTest { + + @Test + public void upgradeFormatTest() throws Exception { + String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"existing-software-version\":\"existingVersion\",\"new-software-version\":\"newVersion\"}}"; + JSONObject jsonObject = new JSONObject(); + jsonObject.put("existing-software-version", "existingVersion"); + jsonObject.put("new-software-version", "newVersion"); + Optional payload = Optional.of(jsonObject.toString()); + Optional payloadClient = PayloadClient.upgradeFormat(payload, "vnfName1"); + assertEquals(payloadResult, payloadClient.get()); + } + + @Test + public void resumeTrafficFormatTest() throws Exception { + String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}"; + Optional payloadClient = PayloadClient.resumeTrafficFormat("vnfName1"); + assertEquals(payloadResult, payloadClient.get()); + } + + @Test + public void quiesceTrafficFormatTest() throws Exception { + String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"operations_timeout\":\"operationTimeout\"}}"; + JSONObject jsonObject = new JSONObject(); + jsonObject.put("operations-timeout", "operationTimeout"); + Optional payload = Optional.of(jsonObject.toString()); + Optional payloadClient = PayloadClient.quiesceTrafficFormat(payload, "vnfName1"); + assertEquals(payloadResult, payloadClient.get()); + } + + @Test + public void startStopFormatTest() throws Exception { + String payloadResult = "{\" AICIdentity \":\"aicIdentity1\"}"; + Optional payloadClient = PayloadClient.startStopFormat("aicIdentity1"); + assertEquals(payloadResult, payloadClient.get()); + } + + @Test + public void healthCheckFormatTest() throws Exception { + String payloadResult = "{\"request-parameters\":{\"vnf-name\":\"vnfName1\"},\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}"; + Optional payloadClient = PayloadClient.healthCheckFormat("vnfName1", "vnfHostIpAddress1"); + assertEquals(payloadResult, payloadClient.get()); + } + + @Test + public void snapshotFormatTest() throws Exception { + String payloadResult = "{\"vm-id\":\"vmId1\",\"identity-url\":\"identityUrl1\"}"; + Optional payloadClient = PayloadClient.snapshotFormat("vmId1", "identityUrl1"); + assertEquals(payloadResult, payloadClient.get()); + } + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/BeansTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/BeansTest.java new file mode 100644 index 0000000000..7949fd26e6 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/BeansTest.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.bpmn.common; + +import org.junit.Test; +import org.onap.so.openpojo.rules.ToStringTester; + +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 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; + +public class BeansTest { + + + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + private PojoClassFilter enumFilter = new FilterEnum(); + + + @Test + public void pojoStructure() { + test("org.onap.so.bpmn.appc.payload.beans"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create() + .with(new GetterMustExistRule()) + .with(new SetterMustExistRule()) + + .with(new SetterTester()) + .with(new GetterTester()) + + .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 { + @Override + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGeneratorTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGeneratorTest.java new file mode 100644 index 0000000000..8a2c8fbfdd --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGeneratorTest.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.HashSet; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition; +import org.springframework.beans.factory.support.BeanDefinitionRegistry; +import org.springframework.core.type.AnnotationMetadata; + +public class DefaultToShortClassNameBeanNameGeneratorTest { + + + @Mock + private BeanDefinitionRegistry beanDefinitionRegistry; + + private DefaultToShortClassNameBeanNameGenerator customBeanNameGenerator = new DefaultToShortClassNameBeanNameGenerator(); + + @Before + public void before() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void test_generateBeanName_notAnnotatedBeanDefinition() { + String expectedBeanName = "BeanName"; + + AnnotatedBeanDefinition annotatedBeanDefinition = mock(AnnotatedBeanDefinition.class); + AnnotationMetadata metadata = mock(AnnotationMetadata.class); + when(metadata.getAnnotationTypes()).thenReturn(new HashSet()); + when(annotatedBeanDefinition.getBeanClassName()).thenReturn("org.onap.so.BeanName"); + when(annotatedBeanDefinition.getMetadata()).thenReturn(metadata); + String actualBeanName = customBeanNameGenerator.generateBeanName(annotatedBeanDefinition, beanDefinitionRegistry); + + assertEquals(expectedBeanName, actualBeanName); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DelegateExecutionImplTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DelegateExecutionImplTest.java new file mode 100644 index 0000000000..cf74356fa2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DelegateExecutionImplTest.java @@ -0,0 +1,146 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.hamcrest.CoreMatchers.hasItems; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.contains; +import static org.mockito.Mockito.mock; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.hamcrest.collection.IsIterableContainingInOrder; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.bpmn.common.exceptions.MalformedBuildingBlockInputException; +import org.onap.so.bpmn.common.exceptions.MissingBuildingBlockInputException; +import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; + +public class DelegateExecutionImplTest { + + @Rule + public ExpectedException thrown= ExpectedException.none(); + + + @Test + public void getVariable() throws RequiredExecutionVariableExeception { + Map map = new HashMap<>(); + map.put("var1", "value1"); + map.put("var2", "value2"); + map.put("list1", (Serializable)Arrays.asList("value1", "value2")); + DelegateExecutionImpl impl = create(map); + + assertEquals("value1", impl.getVariable("var1")); + assertEquals("value2", impl.getRequiredVariable("var2")); + assertThat(impl.getVariable("list1"), IsIterableContainingInOrder.contains("value1", "value2")); + + } + + + @Test + public void getRequiredVariableNotFound() throws RequiredExecutionVariableExeception { + DelegateExecutionImpl impl = create(); + + thrown.expect(RequiredExecutionVariableExeception.class); + impl.getRequiredVariable("var1"); + } + + + @Test + public void setVariable() { + DelegateExecutionImpl impl = create(); + impl.setVariable("var1", "value1"); + + assertEquals("value1", impl.get("var1")); + } + + @Test + public void getGeneralBuildingBlock() { + GeneralBuildingBlock gBB = mock(GeneralBuildingBlock.class); + Map map = new HashMap<>(); + map.put("gBBInput", gBB); + DelegateExecutionImpl impl = create(map); + + assertEquals(gBB, impl.getGeneralBuildingBlock()); + } + + @Test + public void getGeneralBuildingBlockNotFound() { + + DelegateExecutionImpl impl = create(); + + thrown.expect(MissingBuildingBlockInputException.class); + impl.getGeneralBuildingBlock(); + } + + @Test + public void getGeneralBuildingBlockCastException() { + Map map = new HashMap<>(); + map.put("gBBInput", new DelegateExecutionFake()); + DelegateExecutionImpl impl = create(map); + + thrown.expect(MalformedBuildingBlockInputException.class); + impl.getGeneralBuildingBlock(); + } + + @Test + public void getDelegateExecution() { + DelegateExecutionImpl impl = create(); + + assertNotNull(impl.getDelegateExecution()); + } + + @Test + public void getLookupMap() { + Map lookup = new HashMap<>(); + Map map = new HashMap<>(); + map.put("lookupKeyMap", (Serializable) lookup); + DelegateExecutionImpl impl = create(map); + + assertEquals(lookup, impl.getLookupMap()); + } + + private DelegateExecutionImpl create() { + return create(new HashMap()); + } + + private DelegateExecutionImpl create(Map map) { + DelegateExecutionFake fake = new DelegateExecutionFake(); + + for (Entry entry : map.entrySet()) { + fake.setVariable(entry.getKey(), entry.getValue()); + } + return new DelegateExecutionImpl(fake); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java new file mode 100644 index 0000000000..514d93bdf8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.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.bpmn.common; + +import java.util.List; +import java.util.concurrent.Executor; + +import org.camunda.bpm.application.PostDeploy; +import org.camunda.bpm.application.PreUndeploy; +import org.camunda.bpm.application.ProcessApplicationInfo; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; +import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; +import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; +import org.onap.so.logger.MsoLogger; +import org.onap.so.requestsdb.RequestsDBHelper; +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.context.annotation.ComponentScan; +import org.springframework.context.annotation.ComponentScan.Filter; +import org.springframework.context.annotation.FilterType; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +/** + * @since Version 1.0 + * + */ + +@SpringBootApplication +@EnableProcessApplication("MSO Common Application") +@EnableAsync +@ComponentScan(basePackages = { "org.onap" }, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) +public class MSOCommonApplication { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, + MSOCommonApplication.class); + + @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/bpmn/"); + } + } + + public static void main(String... args) { + SpringApplication.run(MSOCommonApplication.class, args); + System.getProperties().setProperty("mso.config.path", "."); + setLogsDir(); + } + + @PostDeploy + public void postDeploy(ProcessEngine processEngineInstance) { + long startTime = System.currentTimeMillis(); + + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Post deployment complete..."); + } + + @PreUndeploy + public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo, + List processEngines) { + long startTime = System.currentTimeMillis(); + + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Pre Undeploy complete..."); + + } + + @Bean + public Executor asyncExecutor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + + executor.setCorePoolSize(corePoolSize); + executor.setMaxPoolSize(maxPoolSize); + executor.setQueueCapacity(queueCapacity); + executor.setThreadNamePrefix("Camunda-"); + executor.initialize(); + return executor; + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java new file mode 100644 index 0000000000..819962f16c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java @@ -0,0 +1,39 @@ +/*- + * ============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.bpmn.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +public class MockAAIDeleteGenericVnf { + public MockAAIDeleteGenericVnf(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021")) + .willReturn(aResponse() + .withStatus(200))); + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java new file mode 100644 index 0000000000..9cb10a0494 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java @@ -0,0 +1,53 @@ +/*- + * ============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.bpmn.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +public class MockAAIDeleteVfModule { + + public MockAAIDeleteVfModule() + { + stubFor(delete(urlMatching( + "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073")) + .willReturn(aResponse().withStatus(200))); + stubFor(delete(urlMatching( + "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075")) + .willReturn(aResponse().withStatus(200))); + stubFor(delete(urlMatching( + "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078")) + .willReturn(aResponse().withStatus(200))); + stubFor(delete(urlMatching( + "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077")) + .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*")) + .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml"))); + + stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*")) + .willReturn(aResponse().withStatus(200))); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java new file mode 100644 index 0000000000..b46d528cc5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java @@ -0,0 +1,340 @@ +/*- + * ============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.bpmn.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +public class MockAAIGenericVnfSearch { + + private static final String EOL = "\n"; + + public MockAAIGenericVnfSearch(){ + String body; + + // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule + + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1")) + .willReturn(aResponse() + .withStatus(404) + .withHeader("Content-Type", "text/xml") + .withBody("Generic VNF Not Found"))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1")) + .willReturn(aResponse() + .withStatus(404) + .withHeader("Content-Type", "text/xml") + .withBody("Generic VNF Not Found"))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 1508691" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 1508692" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + body = + "" + EOL + + " 2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4" + EOL + + " STMTN5MMSC20" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 1508691" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC20-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 1508692" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " STMTN5MMSC20-MMSC::module-1-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " 1.0" + EOL + + " false" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 1508692" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + // The following stubs are for DeleteAAIVfModule + + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1")) + .willReturn(aResponse() + .withStatus(404) + .withHeader("Content-Type", "text/xml") + .withBody("Generic VNF Not Found"))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000021" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000073" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c720" + EOL + + " STMTN5MMSC20" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000020" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " STMTN5MMSC20-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000074" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL + + " STMTN5MMSC20-MMSC::module-1-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL + + " 1.0" + EOL + + " false" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000075" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c719" + EOL + + " STMTN5MMSC19" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000019" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a76" + EOL + + " STMTN5MMSC19-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a76" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000076" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL + + " STMTN5MMSC19-MMSC::module-1-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL + + " 1.0" + EOL + + " false" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000077" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c718" + EOL + + " STMTN5MMSC18" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000018" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL + + " STMTN5MMSC18-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000078" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000021" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000073" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java new file mode 100644 index 0000000000..6a9ff2a4a8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java @@ -0,0 +1,35 @@ +/*- + * ============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.bpmn.common; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +public class MockLoggerDelegate implements JavaDelegate { + @Override + public void execute(DelegateExecution execution) throws Exception { + System.out.println("\n\n ..." + MockLoggerDelegate.class.getName() + " invoked by " + "processDefinitionId=" + + execution.getProcessDefinitionId() + ", activtyId=" + execution.getCurrentActivityId() + + ", activtyName='" + execution.getCurrentActivityName() + "'" + ", processInstanceId=" + + execution.getProcessInstanceId() + ", businessKey=" + execution.getProcessBusinessKey() + + ", executionId=" + execution.getId() + " \n\n"); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java new file mode 100644 index 0000000000..9239889f28 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.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.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + +import java.io.FileNotFoundException; +import java.io.IOException; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.so.client.RestPropertiesLoader; +import org.onap.so.client.aai.AAIProperties; +import org.onap.so.client.dmaap.DmaapProperties; +import org.onap.so.client.dmaap.DmaapPropertiesLoader; +import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer; + +public class SPIPropertiesTest { + + @BeforeClass + public static void beforeClass() { + System.setProperty("mso.config.path", "src/test/resources"); + } + + @Test + public void notEqual() { + DmaapProperties one = DmaapPropertiesLoader.getInstance().getNewImpl(); + DmaapProperties two = DmaapPropertiesLoader.getInstance().getNewImpl(); + assertNotEquals(one, two); + } + @Test + public void equal() { + DmaapProperties one = DmaapPropertiesLoader.getInstance().getImpl(); + DmaapProperties two = DmaapPropertiesLoader.getInstance().getImpl(); + assertEquals(one, two); + } + @Test + public void restNotEqual() { + AAIProperties one = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class); + AAIProperties two = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class); + assertNotEquals(one, two); + } + @Test + public void restEqual() { + AAIProperties one = RestPropertiesLoader.getInstance().getImpl(AAIProperties.class); + AAIProperties two = RestPropertiesLoader.getInstance().getImpl(AAIProperties.class); + assertEquals(one, two); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java new file mode 100644 index 0000000000..4a51d34c3e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.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.bpmn.common; + + + +import java.util.UUID; +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse; +import org.onap.so.bpmn.common.workflow.context.WorkflowContext; +import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder; +import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; + + +public class WorkflowContextHolderTest { + + + @Test + public void testProcessCallback() throws Exception { + String requestId = UUID.randomUUID().toString(); + String message = "TEST MESSATGE"; + String responseMessage = "Successfully processed request"; + int testCode = 200; + + + WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); + + WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse(); + callbackResponse.setMessage(message); + callbackResponse.setResponse(responseMessage); + callbackResponse.setStatusCode(testCode); + + contextHolder.processCallback("testAsyncProcess","process-instance-id",requestId,callbackResponse); + + //same object returned + WorkflowContext contextFound = contextHolder.getWorkflowContext(requestId); + if(contextFound == null) + throw new Exception("Expected to find Context Object"); + + WorkflowResponse testResponse = contextFound.getWorkflowResponse(); + Assert.assertEquals(200,testResponse.getMessageCode()); + Assert.assertEquals(message, testResponse.getMessage()); + Assert.assertEquals(responseMessage, testResponse.getResponse()); + + + + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java new file mode 100644 index 0000000000..dbad35a6a4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.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.bpmn.common; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Allows a subclass of WorkflowTest to specify one or more WireMock + * response transformers. A transformer must be declared as a public + * static field in the subclass. For example: + *
+ *     @WorkflowTestTransformer
+ *     public static final ResponseTransformer sdncAdapterMockTransformer =
+ *         new SDNCAdapterMockTransformer();
+ * 
+ */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface WorkflowTestTransformer { +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/BpmnParamTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/BpmnParamTest.java new file mode 100644 index 0000000000..5510e21b31 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/BpmnParamTest.java @@ -0,0 +1,41 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ + +package org.onap.so.bpmn.common.recipe; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class BpmnParamTest { + + BpmnParam bp=new BpmnParam(); + + @Test + public void test() { + bp.setValue("testdata"); + assertEquals(bp.getValue(),"testdata"); + } + @Test + public void testToString(){ + assert(bp.toString()!=null); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceInputTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceInputTest.java new file mode 100644 index 0000000000..70191311b2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceInputTest.java @@ -0,0 +1,66 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.common.recipe; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.bpmn.core.domain.ModelInfo; + +public class ResourceInputTest extends BaseTest{ + + ResourceInput ri=new ResourceInput(); + @Test + public void test() { + ri.setResourceInstanceName("resourceInstanceName"); + ri.setResourceInstanceDes("resourceInstanceDes"); + ri.setGlobalSubscriberId("globalSubscriberId"); + ri.setServiceType("serviceType"); + ri.setServiceInstanceId("serviceId"); + ri.setOperationId("operationId"); + ModelInfo serviceModelInfo = new ModelInfo(); + serviceModelInfo.setModelCustomizationUuid("modelCustomizationUuid"); + serviceModelInfo.setModelInvariantUuid("modelInvariantUuid"); + serviceModelInfo.setModelUuid("modelUuid"); + ri.setServiceModelInfo(serviceModelInfo); + ModelInfo resourceModelInfo = new ModelInfo(); + resourceModelInfo.setModelCustomizationUuid("modelCustomizationUuid"); + resourceModelInfo.setModelInvariantUuid("modelInvariantUuid"); + resourceModelInfo.setModelUuid("modelUuid"); + ri.setResourceModelInfo(resourceModelInfo); + ri.setResourceInstancenUuid("resourceInstancenUuid"); + ri.setResourceParameters("resourceParameters"); + ri.setOperationType("operationType"); + assertEquals(ri.getResourceInstanceName(), "resourceInstanceName"); + assertEquals(ri.getResourceInstanceDes(), "resourceInstanceDes"); + assertEquals(ri.getGlobalSubscriberId(), "globalSubscriberId"); + assertEquals(ri.getServiceType(), "serviceType"); + assertEquals(ri.getServiceInstanceId(), "serviceId"); + assertEquals(ri.getOperationId(), "operationId"); + assertEquals(ri.getResourceInstancenUuid(), "resourceInstancenUuid"); + assertEquals(ri.getResourceParameters(), "resourceParameters"); + assertEquals(ri.getOperationType(), "operationType"); + } + @Test + public void testToString(){ + assert(ri.toString()!=null); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequestTest.java new file mode 100644 index 0000000000..f0f6fa79e0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequestTest.java @@ -0,0 +1,52 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.common.recipe; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.so.BaseTest; + +public class ResourceRecipeRequestTest extends BaseTest{ + + ResourceRecipeRequest rr=new ResourceRecipeRequest(); + BpmnParam bp=new BpmnParam(); + @Test + public void test() { + rr.setResourceInput(bp); + rr.setHost(bp); + rr.setRequestId(bp); + rr.setRequestAction(bp); + rr.setServiceInstanceId(bp); + rr.setServiceType(bp); + rr.setRecipeParams(bp); + assertEquals(rr.getResourceInput(),bp); + assertEquals(rr.getHost(),bp); + assertEquals(rr.getRequestId(),bp); + assertEquals(rr.getRequestAction(),bp); + assertEquals(rr.getServiceInstanceId(),bp); + assertEquals(rr.getServiceType(),bp); + assertEquals(rr.getRecipeParams(),bp); + } + @Test + public void testToString(){ + assert(rr.toString()!=null); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java new file mode 100644 index 0000000000..5598e3d2e4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java @@ -0,0 +1,42 @@ +/*- + * ============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.bpmn.common.resource; + +import org.junit.Test; + +import java.util.HashMap; + +public class ResourceRequestBuilderTest { + + @Test + public void buildResouceRequestTest() throws Exception { + + ResourceRequestBuilder.buildResouceRequest("xxxxxx", + "a1074969-944f-4ddc-b687-9550b0c8cd57", new HashMap<>()); + } + + @Test + public void buildResouceRequestParametersTest() throws Exception { + + String parameters = + "{ \"locationConstraints\":[ ], \"resources\":[ { \"resourceName\":\"vEPC_ONAP01\", \"resourceInvariantUuid\":\"36ebe421-283a-4ee8-92f1-d09e7c44b911\", \"resourceUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed111\", \"resourceCustomizationUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed231\", \"parameters\":{ \"locationConstraints\":[ { \"vnfProfileId\":\"b244d433-8c9c-49ad-9c70-8e34b8dc8328\", \"locationConstraints\":{ \"vimId\":\"vmware_vio\" } }, { \"vnfProfileId\":\"8a9f7c48-21ce-41b7-95b8-a8ac61ccb1ff\", \"locationConstraints\":{ \"vimId\":\"core-dc_RegionOne\" } } ], \"resources\":[ ], \"requestInputs\":{ \"sdncontroller\":\"\" } } }, { \"resourceName\":\"VL OVERLAYTUNNEL\", \"resourceInvariantUuid\":\"184494cf-472f-436f-82e2-d83dddde21cb\", \"resourceUuid\":\"95bc3e59-c9c5-458f-ad6e-78874ab4b3cc\", \"resourceCustomizationUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed232\", \"parameters\":{ \"locationConstraints\":[ ], \"resources\":[ ], \"requestInputs\":{ } } } ], \"requestInputs\":{ \"vlunderlayvpn0_name\":\"l3connect\", \"vlunderlayvpn0_site1_id\":\"IP-WAN-Controller-1\", \"vlunderlayvpn0_site2_id\":\"SPTNController\", \"vlunderlayvpn0_site1_networkName\":\"network1,network2\", \"vlunderlayvpn0_site2_networkName\":\"network3,network4\", \"vlunderlayvpn0_site1_routerId\":\"a8098c1a-f86e-11da-bd1a-00112444be1a\", \"vlunderlayvpn0_site2_routerId\":\"a8098c1a-f86e-11da-bd1a-00112444be1e\", \"vlunderlayvpn0_site2_importRT1\":\"200:1,200:2\", \"vlunderlayvpn0_site1_exportRT1\":\"300:1,300:2\", \"vlunderlayvpn0_site2_exportRT1\":\"400:1,400:2\", \"vlunderlayvpn0_site1_vni\":\"2000\", \"vlunderlayvpn0_site2_vni\":\"3000\", \"vlunderlayvpn0_tunnelType\":\"L3-DCI\" } }"; + ResourceRequestBuilder.buildResourceRequestParameters(null, "1bd0eae6-2dcc-4461-9ae6-56d641f369d6", "27a0e235-b67a-4ea4-a0cf-25761afed231", parameters); + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/util/CryptoHandlerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/util/CryptoHandlerTest.java new file mode 100644 index 0000000000..cbde63e933 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/util/CryptoHandlerTest.java @@ -0,0 +1,55 @@ +/*- + * ============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.bpmn.common.util; + +import static org.junit.Assert.assertEquals; + +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseTest; + +public class CryptoHandlerTest { + private static final String plainPswd = "mso0206"; + private static final String encryptPwd = "C1FC4A39E16419DD41DFC1212843F440"; + private CryptoHandler cryptoHandler; + + @Before + public void setup() { + cryptoHandler = new CryptoHandler(); + } + + @Test + @Ignore // ignored until we can mock the properties file. + public void getMsoAaiPasswordTest() { + assertEquals(plainPswd, cryptoHandler.getMsoAaiPassword()); + } + + @Test + public void encryptMsoPasswordTest() { + assertEquals(encryptPwd, cryptoHandler.encryptMsoPassword(plainPswd)); + } + + @Test + public void decryptMsoPasswordTest() { + assertEquals(plainPswd, cryptoHandler.decryptMsoPassword(encryptPwd)); + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/FileUtil.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/FileUtil.java new file mode 100644 index 0000000000..b6acdf7adb --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/FileUtil.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.bpmn.mock; + +import java.io.IOException; +import java.io.InputStream; +import org.onap.so.logger.MsoLogger; + +/** + * + * File utility class.
+ *

+ *

+ * + * @author + * @version ONAP Sep 15, 2017 + */ +public class FileUtil { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, FileUtil.class); + + /** + * Read the specified resource file and return the contents as a String. + * + * @param fileName Name of the resource file + * @return the contents of the resource file as a String + * @throws IOException if there is a problem reading the file + */ + public static String readResourceFile(String fileName) { + InputStream stream; + try { + stream = getResourceAsStream(fileName); + byte[] bytes; + bytes = new byte[stream.available()]; + if(stream.read(bytes) > 0) { + stream.close(); + return new String(bytes); + } else { + stream.close(); + return ""; + } + } catch (IOException e) { + LOGGER.debug("Exception:", e); + return ""; + } + } + + /** + * Get an InputStream for the resource specified. + * + * @param resourceName Name of resource for which to get InputStream. + * @return an InputStream for the resource specified. + * @throws IOException If we can't get the InputStream for whatever reason. + */ + private static InputStream getResourceAsStream(String resourceName) throws IOException { + InputStream stream = + FileUtil.class.getClassLoader().getResourceAsStream(resourceName); + if (stream == null) { + throw new IOException("Can't access resource '" + resourceName + "'"); + } + return stream; + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java new file mode 100644 index 0000000000..b9a413fc96 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java @@ -0,0 +1,207 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; + +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; + +import java.util.HashMap; +import java.util.Map; + +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.Response; + +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.client.WireMock; + +/** + * + * Mock Resource which is used to start, stop the WireMock Server + * Also up to 50 mock properties can be added at run-time to change the properties used in transformers such as sdnc_delay in SDNCAdapterMockTransformer + * You can also selectively setup a stub (use reset before setting up), reset all stubs + */ +@Path("/server") +public class MockResource { + + private boolean started = false; + private final Integer defaultPort = 28090; + private WireMockServer wireMockServer = null; + private static Map mockProperties = new HashMap<>(); + + public static String getMockProperties(String key) { + return mockProperties.get(key); + } + + private synchronized void initMockServer(int portNumber) { + String path = "src/test/resources/" + "__files/sdncSimResponse.xml"; + path = path.substring(0,path.indexOf("__files/")); + + wireMockServer = new WireMockServer(wireMockConfig().port(portNumber).extensions("org.onap.so.bpmn.mock.SDNCAdapterMockTransformer") + .extensions("org.onap.so.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer") + .extensions("org.onap.so.bpmn.mock.VnfAdapterCreateMockTransformer") + .extensions("org.onap.so.bpmn.mock.VnfAdapterDeleteMockTransformer") + .extensions("org.onap.so.bpmn.mock.VnfAdapterUpdateMockTransformer") + .extensions("org.onap.so.bpmn.mock.VnfAdapterRollbackMockTransformer") + .extensions("org.onap.so.bpmn.mock.VnfAdapterQueryMockTransformer")); + //.withRootDirectory(path)); + //Mocks were failing - commenting out for now, both mock and transformers seem to work fine + WireMock.configureFor("localhost", portNumber); + wireMockServer.start(); +// StubResponse.setupAllMocks(); + started= true; + } + + public static void main(String [] args) { + MockResource mockresource = new MockResource(); + mockresource.start(28090); + mockresource.reset(); +// mockresource.setupStub("MockCreateTenant"); + } + + /** + * Starts the wiremock server in default port + * @return + */ + @GET + @Path("/start") + @Produces("application/json") + public Response start() { + return startMockServer(defaultPort); + } + + private Response startMockServer(int port) { + if (!started) { + initMockServer(defaultPort); + System.out.println("Started Mock Server in port " + port); + return Response.status(200).entity("Started Mock Server in port " + port).build(); + } else { + return Response.status(200).entity("Mock Server is already running").build(); + } + } + + /** + * Starts the wiremock server in a different port + * @param portNumber + * @return + */ + @GET + @Path("/start/{portNumber}") + @Produces("application/json") + public Response start(@PathParam("portNumber") Integer portNumber) { + if (portNumber == null) portNumber = defaultPort; + return startMockServer(portNumber); + } + + + /** + * Stop the wiremock server + * @return + */ + @GET + @Path("/stop") + @Produces("application/json") + public synchronized Response stop() { + if (wireMockServer.isRunning()) { + wireMockServer.stop(); + started = false; + return Response.status(200).entity("Stopped Mock Server in port ").build(); + } + return Response.status(200).entity("Mock Server is not running").build(); + } + + + /** + * Return list of mock properties + * @return + */ + @GET + @Path("/properties") + @Produces("application/json") + public Response getProperties() { + return Response.status(200).entity(mockProperties).build(); + } + + /** + * Update a particular mock property at run-time + * @param name + * @param value + * @return + */ + @POST + @Path("/properties/{name}/{value}") + public Response updateProperties(@PathParam("name") String name, @PathParam("value") String value) { + if (mockProperties.size() > 50) return Response.serverError().build(); + mockProperties.put(name, value); + return Response.status(200).build(); + } + + /** + * Reset all stubs + * @return + */ + @GET + @Path("/reset") + @Produces("application/json") + public Response reset() { + WireMock.reset(); + return Response.status(200).entity("Wiremock stubs are reset").build(); + } + + + /** + * Setup a stub selectively + * Prior to use, make sure that stub method is available in StubResponse class + * @param methodName + * @return + */ + + // commenting for now until we figure out a way to use new StubResponse classes to setupStubs +// @GET +// @Path("/stub/{methodName}") +// @Produces("application/json") +// public Response setupStub(@PathParam("methodName") String methodName) { +// +// @SuppressWarnings("rawtypes") +// Class params[] = {}; +// Object paramsObj[] = {}; +// +// try { +// Method thisMethod = StubResponse.class.getDeclaredMethod(methodName, params); +// try { +// thisMethod.invoke(StubResponse.class, paramsObj); +// } catch (IllegalAccessException | IllegalArgumentException +// | InvocationTargetException e) { +// return Response.status(200).entity("Error invoking " + methodName ).build(); +// } +// } catch (NoSuchMethodException | SecurityException e) { +// return Response.status(200).entity("Stub " + methodName + " not found...").build(); +// } +// return Response.status(200).entity("Successfully invoked " + methodName).build(); +// } + + + public static Map getMockProperties(){ + return mockProperties; + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java new file mode 100644 index 0000000000..6c62920781 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.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.bpmn.mock; + +import java.util.HashSet; +import java.util.Set; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +import org.junit.Ignore; + +/** + * + * JAX RS Application wiring for Mock Resource + */ +@ApplicationPath("/console") +@Ignore +public class MockResourceApplication extends Application { + + private Set singletons = new HashSet<>(); + private Set> classes = new HashSet<>(); + + public MockResourceApplication() { + singletons.add(new MockResource()); + } + + @Override + public Set> getClasses() { + return classes; + } + + @Override + public Set getSingletons() { + return singletons; + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java new file mode 100644 index 0000000000..9b5bb33bf8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java @@ -0,0 +1,153 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; + +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.client.HttpClient; +import org.onap.so.utils.TargetEntity; + +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.common.BinaryFile; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; + +/** + * + * Simulates SDNC Adapter Callback response + * + */ +public class SDNCAdapterAsyncTransformer extends ResponseDefinitionTransformer { + + private String syncResponse; + private String callbackResponseWrapper; + + public SDNCAdapterAsyncTransformer() { + syncResponse = FileUtil.readResourceFile("__files/StandardSDNCSynchResponse.xml"); + callbackResponseWrapper = FileUtil.readResourceFile("__files/sdncCallbackSoapWrapper.xml"); + } + + @Override + public String getName() { + return "sdnc-adapter-vf-module-assign"; + } + + /** + * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id + * so that callback response can be correlated + * + * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before + * the callback response is sent + */ + @Override + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, + FileSource fileSource, Parameters parameters) { + + String requestBody = request.getBodyAsString(); + + String callbackUrl = requestBody.substring(requestBody.indexOf("")+25, requestBody.indexOf("")); + String requestId = requestBody.substring(requestBody.indexOf("")+23, requestBody.indexOf("")); + + System.out.println("responseDefinition: " + responseDefinition); + + // For this mock, the mapped response body is the Async callback (since the sync response is generic for all requests) + String sdncResponse = responseDefinition.getBody(); + System.out.println("sdncResponse:" + sdncResponse); + + if (sdncResponse == null) { + // Body wasn't specified. Check for a body file + String bodyFileName = responseDefinition.getBodyFileName(); + System.out.println("bodyFileName" + bodyFileName); + if (bodyFileName != null) { + System.out.println("fileSource Class: " + fileSource.getClass().getName()); + BinaryFile bodyFile = fileSource.getBinaryFileNamed(bodyFileName); + byte[] responseFile = bodyFile.readContents(); + sdncResponse = new String(responseFile); + System.out.println("sdncResponse(2):" + sdncResponse); + } + } + + // Next substitute the SDNC response into the callbackResponse (SOAP wrapper). + // Also, replace the request ID wherever it appears + String callbackResponse = callbackResponseWrapper.replace("SDNC_RESPONSE_DATA", sdncResponse).replaceAll("SDNC_REQUEST_ID", requestId); + + Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay"); + int delay = 2000; + if (sdncDelay != null) { + delay = Integer.parseInt(sdncDelay.toString()); + } + + //Kick off callback thread + System.out.println("callback Url:" + callbackUrl + ":delay:" + delay); + CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay); + calbackResponseThread.start(); + + //return 200 OK with empty body + return ResponseDefinitionBuilder + .like(responseDefinition).but() + .withStatus(200).withBody(syncResponse).withHeader("Content-Type", "text/xml") + .build(); + } + + @Override + public boolean applyGlobally() { + return false; + } + + /** + * + * Callback response thread which sends the callback response asynchronously + * + */ + private class CallbackResponseThread extends Thread { + + private String callbackUrl; + private String payLoad; + private int delay; + + public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { + this.callbackUrl = callbackUrl; + this.payLoad = payLoad; + this.delay = delay; + } + + public void run () { + try { + //Delay sending callback response + sleep(delay); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + try { + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.SDNC_ADAPTER); + client.post(payLoad); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java new file mode 100644 index 0000000000..8c34b65c00 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java @@ -0,0 +1,142 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; + +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.client.HttpClient; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; + +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; + +/** + * + * Simulates SDNC Adapter Callback response + * + */ +public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterMockTransformer.class); + private String callbackResponse; + private String requestId; + + public SDNCAdapterMockTransformer() { + callbackResponse = FileUtil.readResourceFile("__files/sdncSimResponse.xml"); + } + + public SDNCAdapterMockTransformer(String requestId) { + this.requestId = requestId; + } + + @Override + public String getName() { + return "sdnc-adapter-transformer"; + } + + /** + * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id + * so that callback response can be correlated + * + * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before + * the callback response is sent + */ + @Override + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, + FileSource fileSource, Parameters parameters) { + String requestBody = request.getBodyAsString(); + + String callbackUrl = requestBody.substring(requestBody.indexOf("")+25, requestBody.indexOf("")); + String requestId = requestBody.substring(requestBody.indexOf("")+23, requestBody.indexOf("")); + + callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); + System.out.println("callbackResponse:" + callbackResponse); + + if (this.requestId != null) { + callbackResponse = callbackResponse.replace(this.requestId, requestId); + } else { + callbackResponse = callbackResponse.replace("testRequestId", requestId); + } + + + Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay"); + int delay = 300; + if (sdncDelay != null) { + delay = Integer.parseInt(sdncDelay.toString()); + } + + //Kick off callback thread + System.out.println("callback Url:" + callbackUrl + ":delay:" + delay); + CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay); + calbackResponseThread.start(); + + //return 200 OK with empty body + return ResponseDefinitionBuilder + .like(responseDefinition).but() + .withStatus(200).withBody("").withHeader("Content-Type", "text/xml") + .build(); + } + + @Override + public boolean applyGlobally() { + return false; + } + + /** + * + * Callback response thread which sends the callback response asynchronously + * + */ + private class CallbackResponseThread extends Thread { + + private String callbackUrl; + private String payLoad; + private int delay; + + public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { + this.callbackUrl = callbackUrl; + this.payLoad = payLoad; + this.delay = delay; + } + + public void run () { + try { + //Delay sending callback response + sleep(delay); + } catch (InterruptedException e1) { + LOGGER.debug("Exception :",e1); + } + LOGGER.debug("Sending callback response:" + callbackUrl); + try { + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.SDNC_ADAPTER); + client.post(payLoad); + } catch (Exception e) { + LOGGER.debug("Exception :",e); + } + } + + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java new file mode 100644 index 0000000000..f53fd6f424 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java @@ -0,0 +1,136 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.client.HttpClient; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; + +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; + +public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitionTransformer { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterNetworkTopologyMockTransformer.class); + + private String callbackResponse; + private String requestId; + + public SDNCAdapterNetworkTopologyMockTransformer() { + callbackResponse = ""; // FileUtil.readResourceFile("__files/sdncDeleteNetworkTopologySimResponse.xml"); + } + + public SDNCAdapterNetworkTopologyMockTransformer(String requestId) { + this.requestId = requestId; + } + + @Override + public String getName() { + return "network-topology-operation-transformer"; + } + + @Override + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, FileSource fileSource, Parameters parameters) { + String requestBody = request.getBodyAsString(); + + String callbackUrl = requestBody.substring(requestBody.indexOf("")+25, requestBody.indexOf("")); + String requestId = requestBody.substring(requestBody.indexOf("")+23, requestBody.indexOf("")); + System.out.println("request callbackUrl : " + callbackUrl); + System.out.println("request requestId : " + requestId); + + System.out.println("file path/name : " + responseDefinition.getBodyFileName()); + callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); + // extract Response responseRequestId + String responseRequestId = callbackResponse.substring(callbackResponse.indexOf("")+11, callbackResponse.indexOf("")); + System.out.println("response requestId: " + responseRequestId); + System.out.println("callbackResponse (before): " + callbackResponse); + callbackResponse = callbackResponse.replace(responseRequestId, requestId); + if (this.requestId != null) { + callbackResponse = callbackResponse.replace(this.requestId, requestId); + } else { + callbackResponse = callbackResponse.replace(responseRequestId, requestId); + } + System.out.println("callbackResponse (after):" + callbackResponse); + + Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay"); + int delay = 300; + if (sdncDelay != null) { + delay = Integer.parseInt(sdncDelay.toString()); + } + + //Kick off callback thread + System.out.println("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay); + CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay); + calbackResponseThread.start(); + + //return 200 OK with body + return ResponseDefinitionBuilder + .like(responseDefinition).but() + .withStatus(200).withBody(callbackResponse).withHeader("Content-Type", "text/xml") + .build(); + } + + @Override + public boolean applyGlobally() { + return false; + } + + private class CallbackResponseThread extends Thread { + + private String callbackUrl; + private String payLoad; + private int delay; + + public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { + this.callbackUrl = callbackUrl; + this.payLoad = payLoad; + this.delay = delay; + } + + public void run () { + try { + //Delay sending callback response + sleep(delay); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + LOGGER.debug("Exception :",e1); + } + LOGGER.debug("Sending callback response to url: " + callbackUrl); + try { + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.SDNC_ADAPTER); + Response response = client.post(payLoad); + LOGGER.debug("Successfully posted callback? Status: " + response.getStatus()); + } catch (Exception e) { + // TODO Auto-generated catch block + LOGGER.debug("catch error in - request.post() "); + LOGGER.debug("Exception :",e); + } + } + + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java new file mode 100644 index 0000000000..c7d1a7c81f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java @@ -0,0 +1,1110 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; + +import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static com.github.tomakehurst.wiremock.client.WireMock.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.patch; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + + +/** + * Reusable Mock StubResponses for AAI Endpoints + * + */ +public class StubResponseAAI { + + public static void setupAllMocks() { + + } + + + /** + * Tunnel-XConnect Mock Stub Response + */ + public static void MockPutTunnelXConnect(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String tunnelId){ + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "/tunnel-xconnects/tunnel-xconnect/" + tunnelId)) + .willReturn(aResponse() + .withStatus(200))); + } + + + /** + * Allotted Resource Mock StubResponses below + */ + public static void MockGetAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPutAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutAllottedResource_500(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockDeleteAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String resourceVersion) { + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(204))); + } + + public static void MockPatchAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { + stubFor(patch(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockQueryAllottedResourceById(String allottedResourceId, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=allotted-resource[&]filter=id:EQUALS:" + allottedResourceId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + + /** + * Service Instance Mock StubResponses below + */ + public static void MockGetServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId) { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml"))); + } + + /** + * Service Instance Mock StubResponses below + */ + public static void MockGetServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockNodeQueryServiceInstanceByName(String serviceInstanceName, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-name:EQUALS:" + serviceInstanceName)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockNodeQueryServiceInstanceByName_404(String serviceInstanceName){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockNodeQueryServiceInstanceByName_500(String serviceInstanceName){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockNodeQueryServiceInstanceById(String serviceInstanceId, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-id:EQUALS:" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockNodeQueryServiceInstanceById_404(String serviceInstanceId){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockNodeQueryServiceInstanceById_500(String serviceInstanceId){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(204))); + } + + public static void MockGetServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockGetServiceInstance(String customer, String serviceSubscription, int statusCode){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml"))); + } + + public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" +1234)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockDeleteServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockDeleteServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockPutServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPutServiceInstance_500(String globalCustId, String subscriptionType, String serviceInstanceId) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(500))); + } + + /** + * Service-Subscription Mock StubResponses below + */ + public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockDeleteServiceSubscription(String globalCustId, String subscriptionType, int statusCode) { + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockDeleteServiceInstanceId(String globalCustId, String subscriptionType, String serviceInstanceId) { + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutServiceSubscription(String globalCustId, String subscriptionType) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + /** + * Customer Mock StubResponses below + */ + public static void MockGetCustomer(String globalCustId, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockDeleteCustomer(String globalCustId) { + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutCustomer(String globalCustId) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutCustomer_500(String globalCustId) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) + .willReturn(aResponse() + .withStatus(500))); + } + + + /** + * Generic-Vnf Mock StubResponses below + */ + + public static void MockGetGenericVnfById(String vnfId, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfById(String vnfId, String responseFile, int statusCode){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfByIdWithPriority(String vnfId, int statusCode, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) + .atPriority(1) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfByIdWithPriority(String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .atPriority(priority) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfByIdWithDepth(String vnfId, int depth, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=" + depth)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfById_404(String vnfId){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockGetGenericVnfById_500(String vnfId){ + stubFor(get(urlMatching("/aai/v9/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1")) + .withQueryParam("depth", equalTo("1")) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockGetGenericVnfByName(String vnfName, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfByNameWithDepth(String vnfName, int depth, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfByName_404(String vnfName){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockDeleteGenericVnf(String vnfId, String resourceVersion){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(204))); + } + + public static void MockDeleteGenericVnf(String vnfId, String resourceVersion, int statusCode){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockDeleteGenericVnf_500(String vnfId, String resourceVersion){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockPutGenericVnf(String vnfId){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutGenericVnf(String vnfId, String requestBodyContaining, int statusCode) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) + .withRequestBody(containing(requestBodyContaining)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockPutGenericVnf(String vnfId, int statusCode) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockPutGenericVnf_Bad(String vnfId, int statusCode){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockPatchGenericVnf(String vnfId){ + stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + .willReturn(aResponse() + .withStatus(200))); + } + /** + * Vce Mock StubResponses below + */ + public static void MockGetVceById(String vnfId, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetVceByName(String vnfName, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockDeleteVce(String vnfId, String resourceVersion, int statusCode){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockPutVce(String vnfId){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockGetGenericVceByNameWithDepth(String vnfName, int depth, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetVceGenericQuery(String serviceInstanceName, int depth, int statusCode, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=service-instance.service-instance-name:" + serviceInstanceName + "[&]start-node-type=service-instance[&]include=vce[&]depth=" + depth)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + /** + * Tenant Mock StubResponses below + */ + public static void MockGetTenantGenericQuery(String customer, String serviceType, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=customer.global-customer-id:" + customer + "&key=service-subscription.service-type:" + serviceType + "&start-node-type=service-subscription&include=tenant&include=service-subscription&depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetTenant(String tenantId, String responseFile) { + stubFor(get(urlEqualTo("/aai/v2/cloud-infrastructure/tenants/tenant/" + tenantId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + /** + * Network Mock StubResponses below + */ + public static void MockGetNetwork(String networkId, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkByIdWithDepth(String networkId, String responseFile, String depth) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkCloudRegion(String responseFile, String cloudRegion) { + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkByName(String networkName, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkByName_404(String responseFile, String networkName) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName)) + .willReturn(aResponse() + .withStatus(404) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkCloudRegion_404(String cloudRegion) { + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockPutNetwork(String networkId, int statusCode, String responseFile) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPutNetwork(String networkPolicyId, String responseFile, int statusCode) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkName(String networkPolicyName, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkVpnBinding(String responseFile, String vpnBinding) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/"+vpnBinding + "[?]depth=all")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkPolicy(String responseFile, String policy) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/"+policy + "[?]depth=all")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkVpnBinding(String networkBindingId, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkPolicy(String networkPolicy, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkTableReference(String responseFile, String tableReference) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/"+tableReference + "[?]depth=all")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPutNetworkIdWithDepth(String responseFile, String networkId, String depth) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/"+networkId+"[?]depth="+depth )) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkPolicyfqdn(String networkPolicy, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkRouteTable(String networkRouteId, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPatchVfModuleId(String vnfId, String vfModuleId) { + stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .willReturn(aResponse() + .withStatus(200))); + } + + ///////////// + + public static void MockVNFAdapterRestVfModule() { + stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/xml"))); + stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/xml"))); + stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/xml"))); + stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/xml"))); + } + + public static void MockDBUpdateVfModule(){ + stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/DBUpdateResponse.xml"))); + } + + // start of mocks used locally and by other VF Module unit tests + public static void MockSDNCAdapterVfModule() { + // simplified the implementation to return "success" for all requests + stubFor(post(urlEqualTo("/SDNCAdapter")) +// .withRequestBody(containing("SvcInstanceId><")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml"))); + + } + + // start of mocks used locally and by other VF Module unit tests + public static void MockAAIVfModule() { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool")) + .atPriority(1) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/VfModule-supercool.xml"))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/lukewarm")) + .atPriority(2) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/VfModule-lukewarm.xml"))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) + .atPriority(5) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/VfModule-new.xml"))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/GenericVnf.xml"))); + stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool")) +// .withRequestBody(containing("PCRF")) + .willReturn(aResponse() + .withStatus(200))); + stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) +// .withRequestBody(containing("PCRF")) + .willReturn(aResponse() + .withStatus(200))); + // HTTP PUT stub still used by CreateAAIvfModuleVolumeGroup + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) + .withRequestBody(containing("PCRF")) + .willReturn(aResponse() + .withStatus(200))); + // HTTP PUT stub still used by DoCreateVfModuleTest + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) + .withRequestBody(containing("MODULELABEL")) + .willReturn(aResponse() + .withStatus(200))); + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml"))); + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml"))); + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/MDTWNJ21/volume-groups/volume-group/78987")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/VolumeGroup.xml"))); + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group/78987")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/VolumeGroup.xml"))); + stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group/78987[?]resource-version=0000020")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("DeleteCinderVolumeV1/DeleteVolumeId_AAIResponse_Success.xml"))); + stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/AddNetworkPolicy_AAIResponse_Success.xml"))); + stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/NEWvBNGModuleId")) + .withRequestBody(containing("NEWvBNGModuleId")) + .willReturn(aResponse() + .withStatus(200))); + } + + + + ////////////// + + /** + * Cloud infrastructure below + */ + + public static void MockGetCloudRegion(String cloudRegionId, int statusCode, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + /** + * Volume Group StubResponse below + */ + public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) { + MockGetVolumeGroupById(cloudRegionId, volumeGroupId, responseFile, 200); + } + + public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int responseCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) + .willReturn(aResponse() + .withStatus(responseCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPutVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) { + stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetVolumeGroupByName(String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockDeleteVolumeGroupById(String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) { + stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockGetVolumeGroupByName_404(String cloudRegionId, String volumeGroupName) { + stubFor(get(urlMatching("/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockDeleteVolumeGroup(String cloudRegionId, String volumeGroupId, String resourceVersion) { + stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(200))); + } + + /** + * VF-Module StubResponse below + * @param statusCode TODO + */ + public static void MockGetVfModuleId(String vnfId, String vfModuleId, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetVfModuleByNameWithDepth(String vnfId, String vfModuleName, int depth, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName + "[?]depth=" + depth)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetVfModuleByName(String vnfId, String vfModuleName, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml"))); + } + + public static void MockPutVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId +"/vf-modules/vf-module/" +vfModuleId)) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutVfModuleId(String vnfId, String vfModuleId) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutVfModuleId(String vnfId, String vfModuleId, int returnCode) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .willReturn(aResponse() + .withStatus(returnCode))); + } + + public static void MockDeleteVfModuleId(String vnfId, String vfModuleId, String resourceVersion, int returnCode) { + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(returnCode))); + } + + public static void MockAAIVfModuleBadPatch(String endpoint, int statusCode) { + stubFor(patch(urlMatching(endpoint)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + /* AAI Pserver Queries */ + public static void MockGetPserverByVnfId(String vnfId, String responseFile, int statusCode) { + stubFor(put(urlMatching("/aai/v1[0-9]/query.*")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/json") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfsByVnfId(String vnfId, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/json; charset=utf-8") + .withBodyFile(responseFile))); + } + + public static void MockSetInMaintFlagByVnfId(String vnfId, int statusCode) { + stubFor(patch(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) + .willReturn(aResponse() + .withStatus(statusCode) + )); + } + + public static void MockSetInMaintFlagByVnfId(String vnfId, String responseFile, int statusCode) { + stubFor(post(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) + .willReturn(aResponse() + .withStatus(statusCode) + .withBodyFile(responseFile) + )); + } + + public static void MockGetDefaultCloudRegionByCloudRegionId(String cloudRegionId, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v1[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegionId + ".*")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/json; charset=utf-8") + .withBodyFile(responseFile))); + } + + //// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones above //// + @Deprecated + public static void MockGetVceById(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123?depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getVceResponse.xml"))); + } + @Deprecated + public static void MockGetVceByName(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=testVnfName123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getVceByNameResponse.xml"))); + } + @Deprecated + public static void MockPutVce(){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123")) + .willReturn(aResponse() + .withStatus(200))); + } + @Deprecated + public static void MockDeleteVce(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(204))); + } + @Deprecated + public static void MockDeleteVce_404(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(404))); + } + + @Deprecated + public static void MockDeleteServiceSubscription(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234")) + .willReturn(aResponse() + .withStatus(204))); + } + @Deprecated + public static void MockGetServiceSubscription(){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getServiceSubscription.xml"))); + } + @Deprecated + public static void MockGetServiceSubscription_200Empty(){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(" "))); + } + @Deprecated + public static void MockGetServiceSubscription_404() { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) + .willReturn(aResponse() + .withStatus(404))); + } + @Deprecated + public static void MockGENPSIPutServiceInstance(){ + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"))); + } + + @Deprecated + public static void MockGENPSIPutServiceSubscription(){ + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"))); + } + @Deprecated + public static void MockGENPSIPutServiceInstance_get500(){ + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericPutServiceInstance/aaiFault.xml"))); + } + + @Deprecated + public static void MockGetGenericVnfById(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml"))); + } + @Deprecated + public static void MockGetGenericVnfById_404(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(404))); + } + @Deprecated + public static void MockGetGenericVnfByName(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfResponse.xml"))); + } + @Deprecated + public static void MockGetGenericVnfByName_hasRelationships(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml"))); + } + @Deprecated + public static void MockGetGenericVnfById_hasRelationships(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml"))); + } + @Deprecated + public static void MockGetGenericVnfById_500(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(500))); + } + @Deprecated + public static void MockGetGenericVnfByName_404(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) + .willReturn(aResponse() + .withStatus(404))); + } + @Deprecated + public static void MockPutGenericVnf(){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(200))); + } + @Deprecated + public static void MockPutGenericVnf_400(){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(400))); + } + @Deprecated + public static void MockDeleteGenericVnf(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(204))); + } + @Deprecated + public static void MockDeleteGenericVnf_404(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(404))); + } + @Deprecated + public static void MockDeleteGenericVnf_500(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(500))); + } + @Deprecated + public static void MockDeleteGenericVnf_412(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[[?]]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(412))); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAPPC.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAPPC.java new file mode 100644 index 0000000000..58e7dcdaad --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAPPC.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.patch; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +/** + * Reusable Mock StubResponses for Policy + * + */ +public class StubResponseAPPC { + + public static void setupAllMocks() { + + } + + // start of Policy mocks + public static void MockAppcError() { + stubFor(get(urlMatching("/events/.*")) + // .withRequestBody(containing("APPC")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("APPC/appc_error.json"))); + stubFor(put(urlMatching("/events/.*")) + // .withRequestBody(containing("APPC")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("APPC/appc_error.json"))); + + + + } + + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseDatabase.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseDatabase.java new file mode 100644 index 0000000000..6227b05d07 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseDatabase.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.bpmn.mock; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; + +/** + * Stub response class for Database stubs + * including database adapter, catalog db, + * and other databases. + */ +public class StubResponseDatabase { + + public static void setupAllMocks() { + + } + + public static void MockUpdateRequestDB(String fileName){ + stubFor(post(urlEqualTo("/services/RequestsDbAdapter")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(fileName))); + } + + public static void mockUpdateRequestDB(int statusCode, String reponseFile) { + stubFor(post(urlEqualTo("/services/RequestsDbAdapter")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(reponseFile))); + } + + public static void MockGetAllottedResourcesByModelInvariantId(String modelInvariantId, String responseFile){ + stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile(responseFile))); + } + + public static void MockGetAllottedResourcesByModelInvariantId_500(String modelInvariantId, String responseFile){ + stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockGetVnfCatalogDataCustomizationUuid(String vnfModelCustomizationUuid, String responseFile){ + stubFor(get(urlEqualTo("/v2/serviceVnfs?vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile(responseFile))); + } + + public static void MockGetVfModuleByModelNameCatalogData(String vfModuleModelName, String responseFile){ + stubFor(get(urlEqualTo("/v2/vfModules?vfModuleModelName=" + vfModuleModelName)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile(responseFile))); + } + + public static void MockGetServiceResourcesCatalogData(String serviceModelInvariantUuid, String serviceModelVersion, String responseFile){ + stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelInvariantUuid=" + + serviceModelInvariantUuid + + "&serviceModelVersion=" + serviceModelVersion)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile(responseFile))); + } + + public static void MockGetServiceResourcesCatalogData(String serviceModelInvariantUuid, String responseFile){ + stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile(responseFile))); + } + + public static void MockGetServiceResourcesCatalogDataByModelUuid(String serviceModelUuid, String responseFile){ + stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelUuid=" + serviceModelUuid)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile(responseFile))); + } + + public static void MockPostRequestDB(){ + stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml"))); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseNetworkAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseNetworkAdapter.java new file mode 100644 index 0000000000..d88509cb57 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseNetworkAdapter.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.bpmn.mock; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; + +/** + * Please describe the StubResponseNetwork.java class + * + */ +public class StubResponseNetworkAdapter { + + private static final String EOL = "\n"; + + public static void setupAllMocks() { + + } + + + public static void MockNetworkAdapter() { + stubFor(post(urlEqualTo("/networks/NetworkAdapter")) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockNetworkAdapter(String response) { + stubFor(post(urlEqualTo("/networks/NetworkAdapter")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(response))); + } + + public static void MockNetworkAdapter_500() { + stubFor(post(urlEqualTo("/networks/NetworkAdapter")) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockNetworkAdapterPost(String responseFile, String requestContaining) { + stubFor(post(urlEqualTo("/networks/NetworkAdapter")) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockNetworkAdapter(String networkId, int statusCode, String responseFile) { + stubFor(delete(urlEqualTo("/networks/NetworkAdapter/" + networkId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml") + .withBodyFile(responseFile))); + } + + public static void MockNetworkAdapterContainingRequest(String requestContaining, int statusCode, String responseFile) { + stubFor(post(urlEqualTo("/networks/NetworkAdapter")) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPutNetworkAdapter(String networkId, String requestContaining, int statusCode, String responseFile) { + stubFor(put(urlEqualTo("/networks/NetworkAdapter/" + networkId)) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockNetworkAdapterRestRollbackDelete(String responseFile, String networkId) { + stubFor(delete(urlEqualTo("/networks/NetworkAdapter/"+networkId+"/rollback")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockNetworkAdapterRestPut(String responseFile, String networkId) { + stubFor(put(urlEqualTo("/networks/NetworkAdapter/"+networkId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseOof.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseOof.java new file mode 100644 index 0000000000..335fd94f5b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseOof.java @@ -0,0 +1,66 @@ +/*- + * ============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.bpmn.mock; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; + +/** + * StubResponseOof.java class + */ +public class StubResponseOof { + + public static void setupAllMocks() { + + } + + public static void mockOof() { + stubFor(post(urlEqualTo("/api/oof/v1/placement")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/json"))); + } + + public static void mockOof(String responseFile) { + stubFor(post(urlEqualTo("/api/oof/v1/placement")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/json") + .withBodyFile(responseFile))); + } + + public static void mockOof_400() { + stubFor(post(urlEqualTo("/api/oof/v1/placement")) + .willReturn(aResponse() + .withStatus(400) + .withHeader("Content-Type", "application/json"))); + } + + public static void mockOof_500() { + stubFor(post(urlEqualTo("/api/oof/v1/placement")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "application/json"))); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponsePolicy.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponsePolicy.java new file mode 100644 index 0000000000..809616dff0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponsePolicy.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.bpmn.mock; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.patch; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +/** + * Reusable Mock StubResponses for Policy + * + */ +public class StubResponsePolicy { + + public static void setupAllMocks() { + + } + + // start of Policy mocks + public static void MockPolicyAbort() { + stubFor(post(urlEqualTo("/pdp/api/getDecision")) + .withRequestBody(containing("BB1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("policyAbortResponse.json"))); + + stubFor(post(urlEqualTo("/pdp/api/getDecision")) + .withRequestBody(containing("UPDVnfI")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("policyAbortResponse.json"))); + + stubFor(post(urlEqualTo("/pdp/api/getDecision")) + .withRequestBody(containing("RPLVnfI")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("policyAbortResponse.json"))); + + stubFor(post(urlEqualTo("/pdp/api/getDecision")) + .withRequestBody(containing("VnfIPU")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("policyAbortResponse.json"))); + + stubFor(post(urlEqualTo("/pdp/api/getDecision")) + .withRequestBody(containing("VnfCU")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("policyAbortResponse.json"))); + + + + } + + public static void MockPolicySkip() { + stubFor(post(urlEqualTo("/pdp/api/getDecision")) + .withRequestBody(containing("BB1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("Policy/policySkipResponse.json"))); + + stubFor(post(urlEqualTo("/pdp/api/getDecision")) + .withRequestBody(containing("UPDVnfI")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("Policy/policySkipResponse.json"))); + + stubFor(post(urlEqualTo("/pdp/api/getDecision")) + .withRequestBody(containing("RPLVnfI")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("Policy/policySkipResponse.json"))); + + stubFor(post(urlEqualTo("/pdp/api/getDecision")) + .withRequestBody(containing("VnfIPU")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("Policy/policySkipResponse.json"))); + + stubFor(post(urlEqualTo("/pdp/api/getDecision")) + .withRequestBody(containing("VnfCU")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("Policy/policySkipResponse.json"))); + + + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java new file mode 100644 index 0000000000..e0c51b794c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java @@ -0,0 +1,149 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +/** + * Please describe the StubResponseSDNC.java class + */ +public class StubResponseSDNCAdapter { + + public static void setupAllMocks() { + + } + + public static void mockSDNCAdapter_500() { + stubFor(post(urlEqualTo("/SDNCAdapter")) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void mockSDNCAdapter_500(String requestContaining) { + stubFor(post(urlEqualTo("/SDNCAdapter")) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void mockSDNCAdapter(int statusCode) { + stubFor(post(urlMatching(".*/SDNCAdapter")) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void mockSDNCAdapter(String endpoint, int statusCode, String responseFile) { + stubFor(post(urlEqualTo(endpoint)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void mockSDNCAdapter(String responseFile) { + stubFor(post(urlEqualTo("/SDNCAdapter")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void mockSDNCAdapter(String endpoint, String requestContaining, int statusCode, String responseFile) { + stubFor(post(urlEqualTo(endpoint)) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void mockSDNCAdapterSimulator(String responseFile) { + MockResource mockResource = new MockResource(); + mockResource.updateProperties("sdnc_delay", "300"); + stubFor(post(urlEqualTo("/SDNCAdapter")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/soap+xml") + .withTransformers("sdnc-adapter-transformer") + .withBodyFile(responseFile))); + } + + public static void mockSDNCAdapterSimulator(String responseFile, String requestContaining) { + MockResource mockResource = new MockResource(); + mockResource.updateProperties("sdnc_delay", "300"); + stubFor(post(urlEqualTo("/SDNCAdapter")) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/soap+xml") + .withTransformers("sdnc-adapter-transformer") + .withBodyFile(responseFile))); + } + + public static void mockSDNCAdapterRest() { + stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/json"))); + } + + public static void mockSDNCAdapterRest_500() { + stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "application/json"))); + } + + public static void mockSDNCAdapterRest(String requestContaining) { + stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/json"))); + } + + public static void mockSDNCAdapterRest_500(String requestContaining) { + stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "application/json"))); + } + + public static void mockSDNCAdapterTopology(String responseFile, String requestContaining) { + MockResource mockResource = new MockResource(); + mockResource.updateProperties("sdnc_delay", "300"); + stubFor(post(urlEqualTo("/SDNCAdapter")) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withTransformers("network-topology-operation-transformer") + .withBodyFile(responseFile))); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSNIRO.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSNIRO.java new file mode 100644 index 0000000000..22d3191821 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSNIRO.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; + +/** + * Please describe the StubResponseSNIRO.java class + * + */ +public class StubResponseSNIRO { + + public static void setupAllMocks() { + + } + + public static void mockSNIRO() { + stubFor(post(urlEqualTo("/sniro/api/v2/placement")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/json"))); + } + + public static void mockSNIRO(String responseFile) { + stubFor(post(urlEqualTo("/sniro/api/v2/placement")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/json") + .withBodyFile(responseFile))); + } + + public static void mockSNIRO_400() { + stubFor(post(urlEqualTo("/sniro/api/v2/placement")) + .willReturn(aResponse() + .withStatus(400) + .withHeader("Content-Type", "application/json"))); + } + + public static void mockSNIRO_500() { + stubFor(post(urlEqualTo("/sniro/api/v2/placement")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "application/json"))); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java new file mode 100644 index 0000000000..91ecbd23b4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java @@ -0,0 +1,206 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +/** + * Please describe the StubResponseVNF.java class + */ +public class StubResponseVNFAdapter { + + public static void mockVNFAdapter() { + stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void mockVNFAdapter(String responseFile) { + stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void mockVNFAdapter_500() { + stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void mockVNFAdapterTransformer(String transformer, String responseFile) { + MockResource mockResource = new MockResource(); + mockResource.updateProperties("vnf_delay", "300"); + stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/soap+xml") + .withTransformers(transformer) + .withBodyFile(responseFile))); + } + + public static void mockVNFAdapterTransformer(String transformer, String responseFile, String requestContaining) { + MockResource mockResource = new MockResource(); + mockResource.updateProperties("vnf_delay", "300"); + stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/soap+xml") + .withTransformers(transformer) + .withBodyFile(responseFile))); + } + + public static void mockVNFPost(String vfModuleId, int statusCode, String vnfId) { + stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + } + + public static void mockVNFPut(String vfModuleId, int statusCode) { + stubFor(put(urlEqualTo("/services/rest/v1/vnfsvnfId/vf-modules" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + stubFor(put(urlEqualTo("/services/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + } + + public static void mockVNFPut(String vnfId, String vfModuleId, int statusCode) { + stubFor(put(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + stubFor(put(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + } + + public static void mockVNFDelete(String vnfId, String vfModuleId, int statusCode) { + stubFor(delete(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + stubFor(delete(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + } + + public static void mockVNFRollbackDelete(String vfModuleId, int statusCode) { + stubFor(delete(urlEqualTo("/services/rest/v1/vnfsvnfId/vf-modules" + vfModuleId + "/rollback")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + stubFor(delete(urlEqualTo("/services/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId + "/rollback")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + } + + public static void mockPutVNFVolumeGroup(String volumeGroupId, int statusCode) { + stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/" + volumeGroupId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + stubFor(put(urlEqualTo("/vnfs/rest/v1/volume-groups/" + volumeGroupId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + } + + public static void mockPutVNFVolumeGroupRollback(String volumeGroupId, int statusCode) { + stubFor(delete(urlMatching("/vnfs/v1/volume-groups/" + volumeGroupId + "/rollback")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/" + volumeGroupId + "/rollback")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + } + public static void mockPostVNFVolumeGroup(int statusCode) { + stubFor(post(urlEqualTo("/vnfs/v1/volume-groups")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + stubFor(post(urlEqualTo("/vnfs/rest/v1/volume-groups")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + } + + public static void mockVNFAdapterRest(String vnfId) { + stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules")) + .willReturn(aResponse() + .withStatus(200))); + stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules")) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void mockVNFAdapterRest_500(String vnfId) { + stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules")) + .willReturn(aResponse() + .withStatus(500))); + stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules")) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void mockVfModuleDelete(String volumeGroupId) { + stubFor(delete(urlMatching("/vnfs/v1/volume-groups/"+ volumeGroupId)) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/xml"))); + stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/"+ volumeGroupId)) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/xml"))); + } + + public static void mockVfModuleDelete(String volumeGroupId, int statusCode) { + stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/78987")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java new file mode 100644 index 0000000000..63abf4d064 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java @@ -0,0 +1,164 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; + +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.client.HttpClient; +import org.onap.so.utils.TargetEntity; + +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.common.BinaryFile; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; + +/** + * + * Simulates VNF Adapter Asynch Callback response. + * This should work for any of the operations. + * + * This transformer uses the mapped message as the asynchronous response. + * By definition, the async API sends a 202 (with no body) in the sync response. + * + */ +public class VnfAdapterAsyncTransformer extends ResponseDefinitionTransformer { + + public VnfAdapterAsyncTransformer() { + } + + @Override + public String getName() { + return "vnf-adapter-async"; + } + + /** + * Grab the incoming request, extract properties to be copied to the response + * (request id, vnf id, vf module ID, message ID). Then fetch the actual response + * body from its FileSource, make the replacements. + * + * The sync response is an empty 202 response. + * The transformed mapped response file is sent asynchronously after a delay. + * + * Mock Resource can be used to add dynamic properties. If vnf_delay is not in the list by + * default waits for 5s before the callback response is sent + */ + @Override + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, + FileSource fileSource, Parameters parameters) { + + String requestBody = request.getBodyAsString(); + + // Note: Should recognize both XML and JSON. But current BPMN uses XML. + String notificationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); + + String vnfId = requestBody.substring(requestBody.indexOf("")+7, requestBody.indexOf("")); + String vfModuleId = requestBody.substring(requestBody.indexOf("")+12, requestBody.indexOf("")); + String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); + String requestId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); + + System.out.println("responseDefinition: " + responseDefinition); + + // For this mock, the mapped response body is the Async callback (since the sync response is generic for all requests) + String vnfResponse = responseDefinition.getBody(); + System.out.println("VNF Response:" + vnfResponse); + + if (vnfResponse == null) { + // Body wasn't specified. Check for a body file + String bodyFileName = responseDefinition.getBodyFileName(); + System.out.println("bodyFileName" + bodyFileName); + if (bodyFileName != null) { + System.out.println("fileSource Class: " + fileSource.getClass().getName()); + BinaryFile bodyFile = fileSource.getBinaryFileNamed(bodyFileName); + byte[] responseFile = bodyFile.readContents(); + vnfResponse = new String(responseFile); + System.out.println("vnfResponse(2):" + vnfResponse); + } + } + + // Transform the SDNC response to escape < and > + vnfResponse = vnfResponse.replaceAll ("VNF_ID", vnfId); + vnfResponse = vnfResponse.replaceAll ("VF_MODULE_ID", vfModuleId); + vnfResponse = vnfResponse.replaceAll ("REQUEST_ID", requestId); + vnfResponse = vnfResponse.replaceAll ("MESSAGE_ID", messageId); + + Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); + int delay = 5000; + if (vnfDelay != null) { + delay = Integer.parseInt(vnfDelay.toString()); + } + + //Kick off callback thread + System.out.println("notification Url:" + notificationUrl + ":delay:" + delay); + CallbackResponseThread calbackResponseThread = new CallbackResponseThread(notificationUrl,vnfResponse, delay); + calbackResponseThread.start(); + + //return 200 OK with empty body + return ResponseDefinitionBuilder + .like(responseDefinition).but() + .withStatus(202).withBody("").withHeader("Content-Type", "text/xml") + .build(); + } + + @Override + public boolean applyGlobally() { + return false; + } + + /** + * + * Callback response thread which sends the callback response asynchronously + * + */ + private class CallbackResponseThread extends Thread { + + private String callbackUrl; + private String payLoad; + private int delay; + + public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { + this.callbackUrl = callbackUrl; + this.payLoad = payLoad; + this.delay = delay; + } + + public void run () { + try { + //Delay sending callback response + sleep(delay); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + try { + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + client.post(payLoad); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java new file mode 100644 index 0000000000..de21d64863 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.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========================================================= + */ + +package org.onap.so.bpmn.mock; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.client.HttpClient; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; + +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; + +/** + * Please describe the VnfAdapterCreateMockTransformer.java class + * + */ +public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransformer { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterCreateMockTransformer.class); + + private String notifyCallbackResponse; + private String ackResponse; + + public VnfAdapterCreateMockTransformer() { + notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfCreateSimResponse.xml"); // default response + } + + @Override + public String getName() { + return "vnf-adapter-create-transformer"; + } + + @Override + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, + FileSource fileSource, Parameters parameters) { + + String requestBody = request.getBodyAsString(); + + String notficationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); + String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); + String responseMessageId = ""; + String updatedResponse = ""; + + try { + // try supplied response file (if any) + System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); + notifyCallbackResponse = ackResponse; + responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); + updatedResponse = ackResponse.replace(responseMessageId, messageId); + } catch (Exception ex) { + LOGGER.debug("Exception :",ex); + System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfCreateSimResponse.xml'"); + responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); + updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); + } + + System.out.println("response (mock) messageId : " + responseMessageId); + System.out.println("request (replacement) messageId: " + messageId); + + System.out.println("vnf Response (before):" + notifyCallbackResponse); + System.out.println("vnf Response (after):" + updatedResponse); + + Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); + int delay = 300; + if (vnfDelay != null) { + delay = Integer.parseInt(vnfDelay.toString()); + } + + //Kick off callback thread + System.out.println("VnfAdapterCreateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); + callbackResponseThread.start(); + + return ResponseDefinitionBuilder + .like(responseDefinition).but() + .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") + .build(); + + } + + @Override + public boolean applyGlobally() { + return false; + } + + private class CallbackResponseThread extends Thread { + + private String callbackUrl; + private String payLoad; + private int delay; + + public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { + this.callbackUrl = callbackUrl; + this.payLoad = payLoad; + this.delay = delay; + } + + @SuppressWarnings("deprecation") + public void run () { + try { + //Delay sending callback response + sleep(delay); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + LOGGER.debug("Exception :",e1); + } + LOGGER.debug("Sending callback response to url: " + callbackUrl); + try { + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + Response response = client.post(payLoad); + LOGGER.debug("Successfully posted callback? Status: " + response.getStatus()); + //System.err.println("Successfully posted callback:" + result.getStatus()); + } catch (Exception e) { + // TODO Auto-generated catch block + LOGGER.debug("catch error in - request.post() "); + LOGGER.debug("Exception :",e); + } + } + + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java new file mode 100644 index 0000000000..99ad84dad4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java @@ -0,0 +1,145 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; + +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.client.HttpClient; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; + +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; + +/** + * Please describe the VnfAdapterCreateMockTransformer.java class + * + */ +public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransformer { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterDeleteMockTransformer.class); + + private String notifyCallbackResponse; + private String ackResponse; + + public VnfAdapterDeleteMockTransformer() { + notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfDeleteSimResponse.xml"); + } + + @Override + public String getName() { + return "vnf-adapter-delete-transformer"; + } + + @Override + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, + FileSource fileSource, Parameters parameters) { + + // System.err.println("notifyCallbackResponse:" + notifyCallbackResponse); + + String requestBody = request.getBodyAsString(); + + String notficationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); + String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); + String responseMessageId = ""; + String updatedResponse = ""; + + try { + // try supplied response file (if any) + System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); + notifyCallbackResponse = ackResponse; + responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); + updatedResponse = ackResponse.replace(responseMessageId, messageId); + } catch (Exception ex) { + LOGGER.debug("Exception :",ex); + System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'"); + responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); + updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); + } + + System.out.println("response (mock) messageId : " + responseMessageId); + System.out.println("request (replacement) messageId: " + messageId); + + System.out.println("vnf Response (before):" + notifyCallbackResponse); + System.out.println("vnf Response (after):" + updatedResponse); + + Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); + int delay = 300; + if (vnfDelay != null) { + delay = Integer.parseInt(vnfDelay.toString()); + } + + //Kick off callback thread + System.out.println("VnfAdapterDeleteMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); + callbackResponseThread.start(); + + return ResponseDefinitionBuilder + .like(responseDefinition).but() + .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") + .build(); + + } + + @Override + public boolean applyGlobally() { + return false; + } + + private class CallbackResponseThread extends Thread { + + private String callbackUrl; + private String payLoad; + private int delay; + + public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { + this.callbackUrl = callbackUrl; + this.payLoad = payLoad; + this.delay = delay; + } + + @SuppressWarnings("deprecation") + public void run () { + try { + //Delay sending callback response + sleep(delay); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + LOGGER.debug("Exception :",e1); + } + + try { + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + client.post(payLoad); + } catch (Exception e) { + // TODO Auto-generated catch block + System.out.println("catch error in - request.post() "); + LOGGER.debug("Exception :",e); + } + } + + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java new file mode 100644 index 0000000000..7ad687a2b3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java @@ -0,0 +1,161 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; + + +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.client.HttpClient; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; + +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; + +/** + * Please describe the VnfAdapterQueryMockTransformer.java class + * + */ + + +public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransformer{ + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterQueryMockTransformer.class); + + private String notifyCallbackResponse; + private String ackResponse; + private String messageId; + + public VnfAdapterQueryMockTransformer() { + notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfQuerySimResponse.xml"); + } + + public VnfAdapterQueryMockTransformer(String messageId) { + this.messageId = messageId; + } + + @Override + public String getName() { + return "vnf-adapter-query-transformer"; + } + + @Override + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, + FileSource fileSource, Parameters parameters) { + + String requestBody = request.getBodyAsString(); + + String notficationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); + String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); + // String updatedResponse = notifyCallbackResponse.replace("b1a82ce6-7f5c-45fd-9273-acaf88fc2137", messageId); + + String responseMessageId = ""; + String updatedResponse = ""; + + // if (ackResponse == null) { + //System.err.println("file:" + responseDefinition.getBodyFileName()); + // ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); + //} + + + try { + // try supplied response file (if any) + System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); + notifyCallbackResponse = ackResponse; + responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); + updatedResponse = ackResponse.replace(responseMessageId, messageId); + } catch (Exception ex) { + LOGGER.debug("Exception :",ex); + System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'"); + responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); + updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); + } + + System.out.println("response (mock) messageId : " + responseMessageId); + System.out.println("request (replacement) messageId: " + messageId); + + System.out.println("vnf Response (before):" + notifyCallbackResponse); + System.out.println("vnf Response (after):" + updatedResponse); + + + Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); + int delay = 300; + if (vnfDelay != null) { + delay = Integer.parseInt(vnfDelay.toString()); + } + + //Kick off callback thread + + //System.out.println("notficationUrl" + notficationUrl); + //System.out.println("updatedResponse" + updatedResponse); + System.out.println("VnfAdapterQueryMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); + System.out.println("Inside Callback" ); + callbackResponseThread.start(); + + return ResponseDefinitionBuilder + .like(responseDefinition).but() + .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") + .build(); + } + + @Override + public boolean applyGlobally() { + return false; + } + + private class CallbackResponseThread extends Thread { + + private String callbackUrl; + private String payLoad; + private int delay; + + public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { + this.callbackUrl = callbackUrl; + this.payLoad = payLoad; + this.delay = delay; + } + + public void run () { + try { + //Delay sending callback response + sleep(delay); + } catch (InterruptedException e1) { + LOGGER.debug("Exception :",e1); + } + + try { + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + client.post(payLoad); + } catch (Exception e) { + LOGGER.debug("Exception :",e); + } + } + + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java new file mode 100644 index 0000000000..560915d1f1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java @@ -0,0 +1,145 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; + +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.client.HttpClient; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; + +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; + +/** + * Please describe the VnfAdapterCreateMockTransformer.java class + * + */ +public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransformer { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterRollbackMockTransformer.class); + + private String notifyCallbackResponse; + private String ackResponse; + private String messageId; + + public VnfAdapterRollbackMockTransformer() { + notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfRollbackSimResponse.xml"); + } + + public VnfAdapterRollbackMockTransformer(String messageId) { + this.messageId = messageId; + } + + @Override + public String getName() { + return "vnf-adapter-rollback-transformer"; + } + + @Override + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, + FileSource fileSource, Parameters parameters) { + + String requestBody = request.getBodyAsString(); + + String notficationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); + String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); + String responseMessageId = ""; + String updatedResponse = ""; + + try { + // try supplied response file (if any) + System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); + notifyCallbackResponse = ackResponse; + responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); + updatedResponse = ackResponse.replace(responseMessageId, messageId); + } catch (Exception ex) { + LOGGER.debug("Exception :",ex); + System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'"); + responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); + updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); + } + + System.out.println("response (mock) messageId : " + responseMessageId); + System.out.println("request (replacement) messageId: " + messageId); + + System.out.println("vnf Response (before):" + notifyCallbackResponse); + System.out.println("vnf Response (after):" + updatedResponse); + + Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); + int delay = 300; + if (vnfDelay != null) { + delay = Integer.parseInt(vnfDelay.toString()); + } + + //Kick off callback thread + System.out.println("VnfAdapterRollbackMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); + callbackResponseThread.start(); + + return ResponseDefinitionBuilder + .like(responseDefinition).but() + .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") + .build(); + + } + + @Override + public boolean applyGlobally() { + return false; + } + + private class CallbackResponseThread extends Thread { + + private String callbackUrl; + private String payLoad; + private int delay; + + public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { + this.callbackUrl = callbackUrl; + this.payLoad = payLoad; + this.delay = delay; + } + + public void run () { + try { + //Delay sending callback response + sleep(delay); + } catch (InterruptedException e1) { + LOGGER.debug("Exception :",e1); + } + + try { + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + client.post(payLoad); + } catch (Exception e) { + System.out.println("catch error in - request.post() "); + LOGGER.debug("Exception :",e); + } + } + + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java new file mode 100644 index 0000000000..9e8927102a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java @@ -0,0 +1,146 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; + +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.client.HttpClient; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; + +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; + +/** + * Please describe the VnfAdapterUpdateMockTransformer.java class + * + */ +public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransformer { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterUpdateMockTransformer.class); + + private String notifyCallbackResponse; + private String requestId; + private String ackResponse; + + public VnfAdapterUpdateMockTransformer() { + notifyCallbackResponse = FileUtil.readResourceFile("vnfAdapter/vnfUpdateSimResponse.xml"); + } + + public VnfAdapterUpdateMockTransformer(String requestId) { + this.requestId = requestId; + } + + @Override + public String getName() { + return "vnf-adapter-update-transformer"; + } + + @Override + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, + FileSource fileSource, Parameters parameters) { + + String requestBody = request.getBodyAsString(); + + String notficationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); + String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); + String responseMessageId = ""; + String updatedResponse = ""; + + try { + // try supplied response file (if any) + System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); + notifyCallbackResponse = ackResponse; + responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); + updatedResponse = ackResponse.replace(responseMessageId, messageId); + } catch (Exception ex) { + LOGGER.debug("Exception :",ex); + System.out.println(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'"); + responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); + updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); + } + + System.out.println("response (mock) messageId : " + responseMessageId); + System.out.println("request (replacement) messageId: " + messageId); + + System.out.println("vnf Response (before):" + notifyCallbackResponse); + System.out.println("vnf Response (after):" + updatedResponse); + + Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); + int delay = 300; + if (vnfDelay != null) { + delay = Integer.parseInt(vnfDelay.toString()); + } + + //Kick off callback thread + System.out.println("VnfAdapterUpdateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); + callbackResponseThread.start(); + + return ResponseDefinitionBuilder + .like(responseDefinition).but() + .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") + .build(); + + } + + @Override + public boolean applyGlobally() { + return false; + } + + private class CallbackResponseThread extends Thread { + + private String callbackUrl; + private String payLoad; + private int delay; + + public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { + this.callbackUrl = callbackUrl; + this.payLoad = payLoad; + this.delay = delay; + } + + public void run () { + try { + //Delay sending callback response + sleep(delay); + } catch (InterruptedException e1) { + LOGGER.debug("Exception :", e1); + } + + try { + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + client.post(payLoad); + } catch (Exception e) { + System.out.println("catch error in - request.post() "); + LOGGER.debug("Exception :",e); + } + } + + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBDecompPojoTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBDecompPojoTest.java new file mode 100644 index 0000000000..a72db062aa --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBDecompPojoTest.java @@ -0,0 +1,55 @@ +/*- + * ============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.bpmn.servicedecomposition; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.PojoClassFilter; +import com.openpojo.reflection.filters.FilterNonConcrete; +import com.openpojo.reflection.filters.FilterPackageInfo; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import org.junit.Test; +import org.onap.so.openpojo.rules.EqualsAndHashCodeTester; +import org.onap.so.openpojo.rules.HasEqualsAndHashCodeRule; + +public class BBDecompPojoTest { + + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + @Test + public void pojoStructure() { + test("org.onap.so.bpmn.servicedecomposition.bbobjects"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create() + .with(new EqualsAndHashCodeTester()) + .with(new HasEqualsAndHashCodeRule()) + .build(); + validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, new FilterNonConcrete()); + } + + private static class FilterTestClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBPojoTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBPojoTest.java new file mode 100644 index 0000000000..801314b2ae --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBPojoTest.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.bpmn.servicedecomposition; + +import org.junit.Test; +import org.onap.so.BaseTest; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.PojoClassFilter; +import com.openpojo.reflection.filters.FilterNonConcrete; +import com.openpojo.reflection.filters.FilterPackageInfo; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.rule.impl.SerializableMustHaveSerialVersionUIDRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + + +public class BBPojoTest extends BaseTest{ + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + @Test + public void pojoStructure() { + test("org.onap.so.bpmn.servicedecomposition.bbobjects"); + test("org.onap.so.bpmn.servicedecomposition.modelinfo"); + test("org.onap.so.bpmn.servicedecomposition.entities"); + test("org.onap.so.bpmn.servicedecomposition.homingobjects"); + test("org.onap.so.bpmn.servicedecomposition.generalobjects"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create() + .with(new GetterMustExistRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .with(new SerializableMustHaveSerialVersionUIDRule()) + .build(); + validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, new FilterNonConcrete()); + } + + private static class FilterTestClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java new file mode 100644 index 0000000000..5f90f1e827 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.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.bpmn.servicedecomposition; + +import static org.junit.Assert.assertEquals; + +import java.util.HashMap; +import java.util.List; + +import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.BaseTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.servicedecomposition.bbobjects.*; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; + +public class ExtractPojosForBBTest extends BaseTest{ + ExtractPojosForBB extractPojos = new ExtractPojosForBB(); + private BuildingBlockExecution execution; + private GeneralBuildingBlock gBBInput; + private HashMap lookupKeyMap; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Before + public void before() { + execution = new DelegateExecutionImpl(new ExecutionImpl()); + execution.setVariable("testProcessKey", "AAICreateTasksTests"); + gBBInput = new GeneralBuildingBlock(); + execution.setVariable("gBBInput", gBBInput); + lookupKeyMap = new HashMap<>(); + execution.setVariable("lookupKeyMap", lookupKeyMap); + } + + @Test + public void get() throws BBObjectNotFoundException { + ServiceInstance serviceInstancePend = new ServiceInstance(); + serviceInstancePend.setServiceInstanceId("abc"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstancePend.getServiceInstanceId()); + + VpnBondingLink vpnBondingLinkPend = new VpnBondingLink(); + vpnBondingLinkPend.setVpnBondingLinkId("testVpnBondingLink"); + serviceInstancePend.getVpnBondingLinks().add(vpnBondingLinkPend); + lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLinkPend.getVpnBondingLinkId()); + + Customer customer = new Customer(); + customer.setServiceSubscription(new ServiceSubscription()); + VpnBinding vpnBinding = new VpnBinding(); + vpnBinding.setVpnId("abc"); + customer.getVpnBindings().add(vpnBinding); + lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId()); + + List vnfsPend = serviceInstancePend.getVnfs(); + GenericVnf vnfPend = new GenericVnf(); + vnfPend.setVnfId("abc"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfPend.getVnfId()); + + List vfModulesPend = vnfPend.getVfModules(); + VfModule vfModulePend = new VfModule(); + vfModulePend.setVfModuleId("abc"); + vfModulesPend.add(vfModulePend); + vnfsPend.add(vnfPend); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModulePend.getVfModuleId()); + + List networksPend = serviceInstancePend.getNetworks(); + L3Network networkPend = new L3Network(); + networkPend.setNetworkId("abc"); + networksPend.add(networkPend); + lookupKeyMap.put(ResourceKey.NETWORK_ID, networkPend.getNetworkId()); + + List volumeGroupsPend = serviceInstancePend.getVnfs().get(0).getVolumeGroups(); + VolumeGroup volumeGroupPend = new VolumeGroup(); + volumeGroupPend.setVolumeGroupId("abc"); + volumeGroupsPend.add(volumeGroupPend); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupPend.getVolumeGroupId()); + + List allotedResourcesPend = serviceInstancePend.getAllottedResources(); + AllottedResource allotedResourcePend = new AllottedResource(); + allotedResourcePend.setId("abc"); + allotedResourcesPend.add(allotedResourcePend); + lookupKeyMap.put(ResourceKey.ALLOTTED_RESOURCE_ID, allotedResourcePend.getId()); + + Configuration configurationPend = new Configuration(); + configurationPend.setConfigurationId("abc"); + serviceInstancePend.getConfigurations().add(configurationPend); + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, configurationPend.getConfigurationId()); + + customer.getServiceSubscription().getServiceInstances().add(serviceInstancePend); + gBBInput.setCustomer(customer); + + ServiceInstance extractServPend = extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, "abc"); + assertEquals(extractServPend.getServiceInstanceId(), serviceInstancePend.getServiceInstanceId()); + GenericVnf extractVnfPend = extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, "abc"); + assertEquals(extractVnfPend.getVnfId(), vnfPend.getVnfId()); + L3Network extractNetworkPend = extractPojos.extractByKey(execution, ResourceKey.NETWORK_ID, "abc"); + assertEquals(extractNetworkPend.getNetworkId(), networkPend.getNetworkId()); + VolumeGroup extractVolumeGroupPend = extractPojos.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, "abc"); + assertEquals(extractVolumeGroupPend.getVolumeGroupId(), volumeGroupPend.getVolumeGroupId()); + AllottedResource extractallotedResourcePend = extractPojos.extractByKey(execution, + ResourceKey.ALLOTTED_RESOURCE_ID, "abc"); + assertEquals(extractallotedResourcePend.getId(), allotedResourcePend.getId()); + Configuration extractConfigurationPend = extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID, + "abc"); + assertEquals(extractConfigurationPend.getConfigurationId(), configurationPend.getConfigurationId()); + VpnBinding extractVpnBinding = extractPojos.extractByKey(execution, ResourceKey.VPN_ID, "abc"); + assertEquals(extractVpnBinding.getVpnId(), vpnBinding.getVpnId()); + + VfModule extractVfModulePend = extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID, "abc"); + assertEquals(extractVfModulePend.getVfModuleId(), vfModulePend.getVfModuleId()); + + VpnBondingLink extractVpnBondingLinkPend = extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID, "testVpnBondingLink"); + assertEquals(extractVpnBondingLinkPend.getVpnBondingLinkId(), vpnBondingLinkPend.getVpnBondingLinkId()); + } + + @Test + public void siError() throws BBObjectNotFoundException { + expectedException.expect(BBObjectNotFoundException.class); + + Customer customer = new Customer(); + customer.setServiceSubscription(new ServiceSubscription()); + ServiceInstance serviceInstance = new ServiceInstance(); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + gBBInput.setCustomer(customer); + + extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, "abc"); + } + + @Test + public void vnfError() throws BBObjectNotFoundException { + expectedException.expect(BBObjectNotFoundException.class); + + Customer customer = new Customer(); + customer.setServiceSubscription(new ServiceSubscription()); + ServiceInstance serviceInstance = new ServiceInstance(); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + gBBInput.setCustomer(customer); + extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, "bbb"); + } + + @Test + public void vfModuleError() throws BBObjectNotFoundException { + expectedException.expect(BBObjectNotFoundException.class); + + Customer customer = new Customer(); + customer.setServiceSubscription(new ServiceSubscription()); + ServiceInstance serviceInstance = new ServiceInstance(); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + gBBInput.setCustomer(customer); + extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID, "bbb"); + } + + @Test + public void configurationError() throws BBObjectNotFoundException { + expectedException.expect(BBObjectNotFoundException.class); + + Customer customer = new Customer(); + customer.setServiceSubscription(new ServiceSubscription()); + ServiceInstance serviceInstance = new ServiceInstance(); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + gBBInput.setCustomer(customer); + extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID, "bbb"); + } + @Test + public void allotedError() throws BBObjectNotFoundException { + expectedException.expect(BBObjectNotFoundException.class); + + Customer customer = new Customer(); + customer.setServiceSubscription(new ServiceSubscription()); + ServiceInstance serviceInstance = new ServiceInstance(); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + gBBInput.setCustomer(customer); + extractPojos.extractByKey(execution, ResourceKey.ALLOTTED_RESOURCE_ID, "bbb"); + } + @Test + public void vpnBindingError() throws BBObjectNotFoundException { + expectedException.expect(BBObjectNotFoundException.class); + Customer customer = new Customer(); + customer.setServiceSubscription(new ServiceSubscription()); + ServiceInstance serviceInstance = new ServiceInstance(); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + gBBInput.setCustomer(customer); + extractPojos.extractByKey(execution, ResourceKey.VPN_ID, "bbb"); + } + + @Test + public void vpnBondingLinkError() throws BBObjectNotFoundException { + expectedException.expect(BBObjectNotFoundException.class); + Customer customer = new Customer(); + customer.setServiceSubscription(new ServiceSubscription()); + ServiceInstance serviceInstance = new ServiceInstance(); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + gBBInput.setCustomer(customer); + extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID, "bbb"); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/SerializationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/SerializationTest.java new file mode 100644 index 0000000000..cfafe1622b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/SerializationTest.java @@ -0,0 +1,130 @@ +/*- + * ============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.bpmn.servicedecomposition; + +import static org.junit.Assert.assertEquals; + +import java.io.ByteArrayOutputStream; +import java.io.Externalizable; +import java.io.File; +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; +import org.junit.Test; +import org.onap.so.SerializableChecker; +import org.onap.so.SerializableChecker.SerializationFailure; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class SerializationTest { + + private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/"; + private static final String FLOW_VAR_NAME = "flowToBeCalled"; + private static final String LOOKUP_KEY_MAP_VAR_NAME = "lookupKeyMap"; + private static final String GBB_INPUT_VAR_NAME = "gBBInput"; + protected ObjectMapper mapper = new ObjectMapper(); + + @Test + public void testSerializationOfAllPojos() throws IOException { + GeneralBuildingBlock gbb = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + Map lookupKeyMap = new HashMap<>(); + DelegateExecution execution = new ExecutionImpl(); + execution.setVariable(FLOW_VAR_NAME, "AssignServiceInstanceBB"); + execution.setVariable(GBB_INPUT_VAR_NAME, gbb); + execution.setVariable(LOOKUP_KEY_MAP_VAR_NAME, lookupKeyMap); + System.out.println(execution.getVariables()); + BuildingBlockExecution gBuildingBlockExecution = new DelegateExecutionImpl(execution); + boolean isSerializable = SerializationTest.isSerializable(gBuildingBlockExecution); + assertEquals(true, isSerializable); + } + + public static boolean isSerializable(final Object o) + { + final boolean retVal; + + if(implementsInterface(o)) + { + retVal = attemptToSerialize(o); + } + else + { + retVal = false; + } + + return (retVal); + } + + private static boolean implementsInterface(final Object o) + { + final boolean retVal; + + retVal = ((o instanceof Serializable) || (o instanceof Externalizable)); + + return (retVal); + } + + private static boolean attemptToSerialize(final Object o) + { + final OutputStream sink; + ObjectOutputStream stream; + + stream = null; + + try + { + sink = new ByteArrayOutputStream(); + stream = new ObjectOutputStream(sink); + stream.writeObject(o); + // could also re-serilalize at this point too + } + catch(final IOException ex) + { + return (false); + } + finally + { + if(stream != null) + { + try + { + stream.close(); + } + catch(final IOException ex) + { + // should not be able to happen + } + } + } + + return (true); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputExceptionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputExceptionTest.java new file mode 100644 index 0000000000..9d34a95e79 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputExceptionTest.java @@ -0,0 +1,67 @@ +/*- + * ============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.bpmn.servicedecomposition.entities.exceptions; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class InvalidBuildingBlockInputExceptionTest { + private static final String MESSAGE = "message"; + private static final Throwable CAUSE = new Throwable(); + private InvalidBuildingBlockInputException invalidBuildingBlockInputException; + + @Test + public void defaultConstructorTest() { + invalidBuildingBlockInputException = new InvalidBuildingBlockInputException(); + assertEquals(null, invalidBuildingBlockInputException.getMessage()); + assertEquals(null, invalidBuildingBlockInputException.getCause()); + } + + @Test + public void messageConstructorTest() { + invalidBuildingBlockInputException = new InvalidBuildingBlockInputException(MESSAGE); + assertEquals(MESSAGE, invalidBuildingBlockInputException.getMessage()); + assertEquals(null, invalidBuildingBlockInputException.getCause()); + } + + @Test + public void causeConstructorTest() { + invalidBuildingBlockInputException = new InvalidBuildingBlockInputException(CAUSE); + assertEquals(CAUSE.toString(), invalidBuildingBlockInputException.getMessage()); // CAUSE.toString because of the implementation of Exception(Throwable cause) + assertEquals(CAUSE, invalidBuildingBlockInputException.getCause()); + } + + @Test + public void messageAndCauseConstructorTest() { + invalidBuildingBlockInputException = new InvalidBuildingBlockInputException(MESSAGE, CAUSE); + assertEquals(MESSAGE, invalidBuildingBlockInputException.getMessage()); + assertEquals(CAUSE, invalidBuildingBlockInputException.getCause()); + } + + @Test + public void messageAndCauseAndFlagsConstructorTest() { + invalidBuildingBlockInputException = new InvalidBuildingBlockInputException(MESSAGE, CAUSE, true, true); + assertEquals(MESSAGE, invalidBuildingBlockInputException.getMessage()); + assertEquals(CAUSE, invalidBuildingBlockInputException.getCause()); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java new file mode 100644 index 0000000000..0abbb2dbe2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -0,0 +1,630 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.tasks; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.hamcrest.CoreMatchers.equalTo; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.mockito.InjectMocks; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResource; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.ConfigurationResource; +import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.InstanceGroup; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.serviceinstancebeans.CloudConfiguration; +import org.onap.so.serviceinstancebeans.RequestDetails; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class BBInputSetupMapperLayerTest { + @InjectMocks + BBInputSetupMapperLayer bbInputSetupMapperLayer = new BBInputSetupMapperLayer(); + + ObjectMapper mapper = new ObjectMapper(); + + private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/"; + + @Test + public void testMapOrchestrationStatusFromAAI() { + OrchestrationStatus expected = OrchestrationStatus.INVENTORIED; + String orchStatusInput = "Inventoried"; + OrchestrationStatus actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + + expected = OrchestrationStatus.ASSIGNED; + orchStatusInput = "Assigned"; + actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + + expected = OrchestrationStatus.ACTIVE; + orchStatusInput = "Active"; + actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + + expected = OrchestrationStatus.CREATED; + orchStatusInput = "Created"; + actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + + expected = OrchestrationStatus.PRECREATED; + orchStatusInput = "PreCreated"; + actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + + expected = OrchestrationStatus.PENDING_CREATE; + orchStatusInput = "PendingCreate"; + actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + + expected = OrchestrationStatus.PENDING_DELETE; + orchStatusInput = "PendingDelete"; + actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + + expected = OrchestrationStatus.PENDING; + orchStatusInput = "Pending"; + actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + + expected = OrchestrationStatus.PENDING_ACTIVATION; + orchStatusInput = "PendingActivation"; + actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapOrchestrationFuzzyCases() { + List values = Arrays.asList("pending-create", "pending_Create", "pendinggcreate", "PendingCreate"); + values.forEach(value -> { + assertThat(bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(value), equalTo(OrchestrationStatus.PENDING_CREATE)); + }); + } + + @Test + public void testMapAAICustomer() throws IOException { + Customer expected = mapper.readValue( + new File(RESOURCE_PATH+"Customer.json"), + Customer.class); + + org.onap.aai.domain.yang.Customer customerAAI = mapper.readValue( + new File(RESOURCE_PATH+"Customer_AAI.json"), org.onap.aai.domain.yang.Customer.class); + + Customer actual = bbInputSetupMapperLayer.mapAAICustomer(customerAAI); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAIServiceSubscription() throws IOException { + ServiceSubscription expected = mapper.readValue( + new File(RESOURCE_PATH + "ServiceSubscriptionExpected.json"), ServiceSubscription.class); + + org.onap.aai.domain.yang.ServiceSubscription svcSubscriptionAAI = mapper.readValue( + new File(RESOURCE_PATH + "ServiceSubscription_AAI.json"), org.onap.aai.domain.yang.ServiceSubscription.class); + + ServiceSubscription actual = bbInputSetupMapperLayer.mapAAIServiceSubscription(svcSubscriptionAAI); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAIProject() throws IOException { + Project expected = mapper.readValue(new File(RESOURCE_PATH+"Project.json"),Project.class); + + org.onap.aai.domain.yang.Project projectAAI = new org.onap.aai.domain.yang.Project(); + projectAAI.setProjectName("projectName"); + + Project actual = bbInputSetupMapperLayer.mapAAIProject(projectAAI); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapRequestProject() throws IOException { + Project expected = mapper.readValue(new File(RESOURCE_PATH+"Project.json"),Project.class); + + org.onap.so.serviceinstancebeans.Project requestProject = new org.onap.so.serviceinstancebeans.Project(); + requestProject.setProjectName("projectName"); + + Project actual = bbInputSetupMapperLayer.mapRequestProject(requestProject); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAIOwningEntity() throws IOException { + OwningEntity expected = mapper.readValue(new File(RESOURCE_PATH+"OwningEntity.json"),OwningEntity.class); + + org.onap.aai.domain.yang.OwningEntity entityAAI = new org.onap.aai.domain.yang.OwningEntity(); + entityAAI.setOwningEntityId("owningEntityId"); + entityAAI.setOwningEntityName("owningEntityName"); + + OwningEntity actual = bbInputSetupMapperLayer.mapAAIOwningEntity(entityAAI); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapRequestOwningEntity() throws IOException { + OwningEntity expected = mapper.readValue(new File(RESOURCE_PATH+"OwningEntity.json"),OwningEntity.class); + + org.onap.so.serviceinstancebeans.OwningEntity requestOwningEntity = new org.onap.so.serviceinstancebeans.OwningEntity(); + requestOwningEntity.setOwningEntityId("owningEntityId"); + requestOwningEntity.setOwningEntityName("owningEntityName"); + + OwningEntity actual = bbInputSetupMapperLayer.mapRequestOwningEntity(requestOwningEntity); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAIPlatform() throws IOException { + Platform expected = mapper.readValue(new File(RESOURCE_PATH+"Platform.json"),Platform.class); + + org.onap.aai.domain.yang.Platform platformAAI = new org.onap.aai.domain.yang.Platform(); + platformAAI.setPlatformName("platformName"); + + Platform actual = bbInputSetupMapperLayer.mapAAIPlatform(platformAAI); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAILineOfBusiness() throws IOException { + LineOfBusiness expected = mapper.readValue(new File(RESOURCE_PATH+"LineOfBusiness.json"),LineOfBusiness.class); + + org.onap.aai.domain.yang.LineOfBusiness lobAAI = new org.onap.aai.domain.yang.LineOfBusiness(); + lobAAI.setLineOfBusinessName("lineOfBusinessName"); + + LineOfBusiness actual = bbInputSetupMapperLayer.mapAAILineOfBusiness(lobAAI); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAINetworkPolicy() throws JsonParseException, JsonMappingException, IOException { + NetworkPolicy expectedNetworkPolicy = mapper.readValue(new File(RESOURCE_PATH + "NetworkPolicy.json"), NetworkPolicy.class); + + org.onap.aai.domain.yang.NetworkPolicy aaiNetworkPolicy = new org.onap.aai.domain.yang.NetworkPolicy(); + aaiNetworkPolicy.setNetworkPolicyId("networkPolicyId"); + aaiNetworkPolicy.setNetworkPolicyFqdn("networkPolicyFqdn"); + aaiNetworkPolicy.setHeatStackId("heatStackId"); + aaiNetworkPolicy.setResourceVersion("resourceVersion"); + + NetworkPolicy actualNetworkPolicy = bbInputSetupMapperLayer.mapAAINetworkPolicy(aaiNetworkPolicy); + + assertThat(actualNetworkPolicy, sameBeanAs(expectedNetworkPolicy)); + } + + @Test + public void testMapAAIVolumeGroup() throws JsonParseException, JsonMappingException, IOException { + VolumeGroup expectedVolumeGroup = mapper.readValue(new File(RESOURCE_PATH + "VolumeGroup.json"), VolumeGroup.class); + + org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = mapper.readValue( + new File(RESOURCE_PATH + "VolumeGroup_AAI.json"), org.onap.aai.domain.yang.VolumeGroup.class); + + VolumeGroup actualVolumeGroup = bbInputSetupMapperLayer.mapAAIVolumeGroup(aaiVolumeGroup); + + assertThat(actualVolumeGroup, sameBeanAs(expectedVolumeGroup)); + } + + @Test + public void testMapCatalogServiceIntoServiceInstance() throws IOException { + ModelInfoServiceInstance expected = mapper.readValue( + new File(RESOURCE_PATH + "ModelInfoServiceInstance.json"), + ModelInfoServiceInstance.class); + + Service catalogService = mapper.readValue( + new File(RESOURCE_PATH + "CatalogServiceInput.json"), Service.class); + + ModelInfoServiceInstance actual = bbInputSetupMapperLayer.mapCatalogServiceIntoServiceInstance(catalogService); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapCatalogInstanceGroupToInstanceGroup() throws IOException { + ModelInfoInstanceGroup expected = mapper.readValue( + new File(RESOURCE_PATH + "ModelInfoInstanceGroup.json"), + ModelInfoInstanceGroup.class); + + InstanceGroup instanceGroup = mapper.readValue( + new File(RESOURCE_PATH + "InstanceGroup.json"), InstanceGroup.class); + instanceGroup.setCollectionInstanceGroupCustomizations(new ArrayList<>()); + CollectionResourceInstanceGroupCustomization collectionInstanceGroupCust = new CollectionResourceInstanceGroupCustomization(); + collectionInstanceGroupCust.setModelCustomizationUUID("modelCustomizationUUID"); + collectionInstanceGroupCust.setFunction("function"); + collectionInstanceGroupCust.setDescription("description"); + instanceGroup.getCollectionInstanceGroupCustomizations().add(collectionInstanceGroupCust); + CollectionResourceCustomization collectionResourceCust = new CollectionResourceCustomization(); + collectionResourceCust.setModelCustomizationUUID("modelCustomizationUUID"); + ModelInfoInstanceGroup actual = bbInputSetupMapperLayer.mapCatalogInstanceGroupToInstanceGroup(collectionResourceCust, instanceGroup); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapCollectionNetworkResourceCustToNetworkResourceCust() { + String modelCustomizationUUID = "modelCustomizationUUID"; + String modelInstanceName = "modelInstanceName"; + String networkRole = "networkRole"; + String networkScope = "networkScope"; + String networkTechnology = "networkTechnology"; + String networkType = "networkType"; + + NetworkResourceCustomization expected = new NetworkResourceCustomization(); + expected.setModelCustomizationUUID(modelCustomizationUUID); + expected.setModelInstanceName(modelInstanceName); + expected.setNetworkRole(networkRole); + expected.setNetworkScope(networkScope); + expected.setNetworkTechnology(networkTechnology); + expected.setNetworkType(networkType); + CollectionNetworkResourceCustomization collectionNetworkResourceCust = new CollectionNetworkResourceCustomization(); + collectionNetworkResourceCust.setModelCustomizationUUID(modelCustomizationUUID); + collectionNetworkResourceCust.setModelInstanceName(modelInstanceName); + collectionNetworkResourceCust.setNetworkRole(networkRole); + collectionNetworkResourceCust.setNetworkScope(networkScope); + collectionNetworkResourceCust.setNetworkTechnology(networkTechnology); + collectionNetworkResourceCust.setNetworkType(networkType); + NetworkResourceCustomization actual = bbInputSetupMapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapCatalogCollectionToCollection() throws IOException { + ModelInfoCollection expected = mapper.readValue( + new File(RESOURCE_PATH + "ModelInfoCollection.json"), + ModelInfoCollection.class); + + CollectionResourceCustomization collectionCust = mapper.readValue( + new File(RESOURCE_PATH + "CollectionResourceCustomization.json"), + CollectionResourceCustomization.class); + + CollectionResource collectionResource = mapper.readValue( + new File(RESOURCE_PATH + "CollectionResource.json"), + CollectionResource.class); + + ModelInfoCollection actual = bbInputSetupMapperLayer.mapCatalogCollectionToCollection(collectionCust, collectionResource); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAIServiceInstanceIntoServiceInstance() throws IOException { + ServiceInstance expected = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_aaiServiceInstanceToSI.json"), + ServiceInstance.class); + + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstanceAAIInput.json"), + org.onap.aai.domain.yang.ServiceInstance.class); + + ServiceInstance actual = bbInputSetupMapperLayer.mapAAIServiceInstanceIntoServiceInstance(serviceInstanceAAI); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testSetPlatformAndLOB() throws IOException { + ServiceInstance expected = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_aaiPlatformAndLOBToSI.json"), + ServiceInstance.class); + + Map resourcesToBeOrchestrated = new HashMap<>(); + resourcesToBeOrchestrated.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + Platform platformMSO = new Platform(); + platformMSO.setPlatformName("platformName"); + LineOfBusiness lineOfBusinessMSO = new LineOfBusiness(); + lineOfBusinessMSO.setLineOfBusinessName("lineOfBusinessName"); + + ServiceInstance actual = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstanceAAIPlatformAndLOBInput.json"), + ServiceInstance.class); + + bbInputSetupMapperLayer.setPlatformAndLOBIntoServiceInstance(platformMSO, lineOfBusinessMSO, actual, + resourcesToBeOrchestrated); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAIL3NetworkIntoL3Network() throws IOException { + L3Network expected = mapper.readValue( + new File(RESOURCE_PATH + "l3NetworkExpected.json"), L3Network.class); + + org.onap.aai.domain.yang.L3Network aaiL3Network = mapper.readValue( + new File(RESOURCE_PATH + "aaiL3NetworkInput.json"), + org.onap.aai.domain.yang.L3Network.class); + + L3Network actual = bbInputSetupMapperLayer.mapAAIL3Network(aaiL3Network); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAIGenericVnfIntoGenericVnf() throws IOException { + GenericVnf expected = mapper.readValue(new File(RESOURCE_PATH + "GenericVnfExpected.json"), GenericVnf.class); + org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = mapper.readValue( + new File(RESOURCE_PATH + "aaiGenericVnfInput.json"), org.onap.aai.domain.yang.GenericVnf.class); + + GenericVnf actual = bbInputSetupMapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAICollectionIntoCollection() throws JsonParseException, JsonMappingException, IOException { + org.onap.aai.domain.yang.Collection aaiCollection = mapper.readValue( + new File(RESOURCE_PATH + "CollectionInput.json"), org.onap.aai.domain.yang.Collection.class); + + Collection expectedCollection = mapper.readValue(new File(RESOURCE_PATH + "CollectionExpected.json"), Collection.class); + + Collection actualCollection = bbInputSetupMapperLayer.mapAAICollectionIntoCollection(aaiCollection); + + assertThat(actualCollection, sameBeanAs(expectedCollection)); + } + + @Test + public void testMapAAIInstanceGroupIntoInstanceGroup() throws JsonParseException, JsonMappingException, IOException { + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = mapper.readValue( + new File(RESOURCE_PATH + "InstanceGroupInput.json"), org.onap.aai.domain.yang.InstanceGroup.class); + + org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup expectedInstanceGroup = mapper.readValue( + new File(RESOURCE_PATH + "InstanceGroupExpected.json"), org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup.class); + + org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup actualInstanceGroup = + bbInputSetupMapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstanceGroup); + + assertThat(actualInstanceGroup, sameBeanAs(expectedInstanceGroup)); + } + + @Test + public void testMapAAIRouteTableReferenceIntoRouteTableReference() throws JsonParseException, JsonMappingException, IOException { + org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference = mapper.readValue( + new File(RESOURCE_PATH + "RouteTableReferenceInput.json"), org.onap.aai.domain.yang.RouteTableReference.class); + + RouteTableReference expectedRouteTableReference = mapper.readValue( + new File(RESOURCE_PATH + "RouteTableReferenceExpected.json"), RouteTableReference.class); + + RouteTableReference actualRouteTableReference = bbInputSetupMapperLayer.mapAAIRouteTableReferenceIntoRouteTableReference(aaiRouteTableReference); + + assertThat(actualRouteTableReference, sameBeanAs(expectedRouteTableReference)); + } + + @Test + public void testMapCatalogNetworkToNetwork() throws JsonParseException, JsonMappingException, IOException { + NetworkResourceCustomization networkResourceCustomization = mapper.readValue( + new File(RESOURCE_PATH + "NetworkResourceCustomizationInput.json"), NetworkResourceCustomization.class); + + ModelInfoNetwork expectedModelInfoNetwork = mapper.readValue( + new File(RESOURCE_PATH + "ModelInfoNetworkExpected.json"), ModelInfoNetwork.class); + + ModelInfoNetwork actualModelInfoNetwork = bbInputSetupMapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization); + + assertThat(actualModelInfoNetwork, sameBeanAs(expectedModelInfoNetwork)); + } + + @Test + public void testMapCatalogVnfToVnf() throws IOException { + VnfResourceCustomization vnfResourceCustomization = mapper.readValue( + new File(RESOURCE_PATH + "VnfResourceCustomizationInput.json"), VnfResourceCustomization.class); + + ModelInfoGenericVnf expectedModelInfoGenericVnf = mapper.readValue( + new File(RESOURCE_PATH + "ModelInfoGenericVnfExpected.json"), ModelInfoGenericVnf.class); + + ModelInfoGenericVnf actualModelInfoGenericVnf = bbInputSetupMapperLayer.mapCatalogVnfToVnf(vnfResourceCustomization); + + assertThat(actualModelInfoGenericVnf, sameBeanAs(expectedModelInfoGenericVnf)); + } + + @Test + public void testMapCatalogVfModuleToVfModule() throws JsonParseException, JsonMappingException, IOException { + VfModuleCustomization vfResourceCustomization = mapper.readValue( + new File(RESOURCE_PATH + "VfModuleCustomizationInput.json"), VfModuleCustomization.class); + + ModelInfoVfModule expectedModelInfoVfModule = mapper.readValue(new File(RESOURCE_PATH + "ModelInfoVfModuleExpected.json"), ModelInfoVfModule.class); + + ModelInfoVfModule actualModelInfoVfModule = bbInputSetupMapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization); + + assertThat(actualModelInfoVfModule, sameBeanAs(expectedModelInfoVfModule)); + } + + @Test + public void testMapRequestPlatform() throws JsonParseException, JsonMappingException, IOException { + org.onap.so.serviceinstancebeans.Platform platform = mapper.readValue( + new File(RESOURCE_PATH + "RequestPlatformInput.json"), org.onap.so.serviceinstancebeans.Platform.class); + + Platform expectedPlatform = mapper.readValue(new File(RESOURCE_PATH + "PlatformExpected.json"), Platform.class); + + Platform actualPlatform = bbInputSetupMapperLayer.mapRequestPlatform(platform); + + assertThat(actualPlatform, sameBeanAs(expectedPlatform)); + } + + @Test + public void testMapRequestLineOfBusiness() throws JsonParseException, JsonMappingException, IOException { + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = mapper.readValue( + new File(RESOURCE_PATH + "RequestLineOfBusinessInput.json"), org.onap.so.serviceinstancebeans.LineOfBusiness.class); + + LineOfBusiness expectedLineOfBusiness = mapper.readValue(new File(RESOURCE_PATH + "LineOfBusinessExpected.json"), LineOfBusiness.class); + + LineOfBusiness actualLineOfBusiness = bbInputSetupMapperLayer.mapRequestLineOfBusiness(lineOfBusiness); + + assertThat(actualLineOfBusiness, sameBeanAs(expectedLineOfBusiness)); + } + + @Test + public void testMapAAIConfiguration() throws JsonParseException, JsonMappingException, IOException { + org.onap.aai.domain.yang.Configuration configurationAAI = mapper.readValue( + new File(RESOURCE_PATH + "ConfigurationInput.json"), org.onap.aai.domain.yang.Configuration.class); + + Configuration expectedConfiguration = mapper.readValue( + new File(RESOURCE_PATH + "ConfigurationExpected.json"), Configuration.class); + + Configuration actualConfiguration = bbInputSetupMapperLayer.mapAAIConfiguration(configurationAAI); + + assertThat(actualConfiguration, sameBeanAs(expectedConfiguration)); + } + + @Test + public void testMapRequestContext() throws IOException { + RequestContext expected = mapper.readValue( + new File(RESOURCE_PATH + "RequestContextExpected.json"), + RequestContext.class); + + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), + RequestDetails.class); + RequestContext actual = bbInputSetupMapperLayer.mapRequestContext(requestDetails); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapOrchestrationContext() throws IOException { + OrchestrationContext expected = new OrchestrationContext(); + expected.setIsRollbackEnabled(false); + + RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class); + + OrchestrationContext actual = bbInputSetupMapperLayer.mapOrchestrationContext(requestDetails); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapLocationContext() { + CloudRegion expected = new CloudRegion(); + expected.setCloudOwner("att-aic"); + expected.setLcpCloudRegionId("cloudRegionId"); + expected.setComplex("complexName"); + expected.setTenantId("tenantId"); + CloudConfiguration cloudConfig = new CloudConfiguration(); + cloudConfig.setTenantId("tenantId"); + cloudConfig.setLcpCloudRegionId("cloudRegionId"); + cloudConfig.setAicNodeClli("aicNodeClli"); + org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion(); + cloudRegion.setCloudOwner("att-aic"); + cloudRegion.setCloudRegionId("cloudRegionId"); + cloudRegion.setComplexName("complexName"); + + CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion, "att-aic"); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapCloudRegion() { + CloudRegion expected = new CloudRegion(); + expected.setCloudOwner("att-aic"); + expected.setLcpCloudRegionId("cloudRegionId"); + expected.setTenantId("tenantId"); + expected.setCloudRegionVersion("cloudRegionVersion"); + + CloudConfiguration cloudConfig = new CloudConfiguration(); + cloudConfig.setTenantId("tenantId"); + cloudConfig.setLcpCloudRegionId("cloudRegionId"); + cloudConfig.setAicNodeClli("aicNodeClli"); + + org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion(); + cloudRegion.setCloudOwner("att-aic"); + cloudRegion.setCloudRegionId("cloudRegionId"); + cloudRegion.setCloudRegionVersion("cloudRegionVersion"); + + CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion, "att-aic"); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapCloudRegionWithNullCheck() { + CloudRegion expected = new CloudRegion(); + + CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(null, null, null); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testmapCatalogConfigurationToConfiguration() { + String modelCustUUID = "modelCustomizationUUID"; + String modelInvariantUUID = "modelInvariantUUID"; + String modelVersionUUID = "modelUUID"; + ModelInfoConfiguration expected = new ModelInfoConfiguration(); + expected.setModelCustomizationId(modelCustUUID); + expected.setModelInvariantId(modelInvariantUUID); + expected.setModelVersionId(modelVersionUUID); + ConfigurationResourceCustomization configurationResourceCustomization = new ConfigurationResourceCustomization(); + configurationResourceCustomization.setModelCustomizationUUID(modelCustUUID); + configurationResourceCustomization.setConfigurationResource(new ConfigurationResource()); + configurationResourceCustomization.getConfigurationResource().setModelInvariantUUID(modelInvariantUUID); + configurationResourceCustomization.getConfigurationResource().setModelUUID(modelVersionUUID); + + ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization ); + + assertThat(actual, sameBeanAs(expected)); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java new file mode 100644 index 0000000000..355dc15bbf --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -0,0 +1,2433 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.tasks; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.client.aai.AAICommonObjectMapperProvider; +import org.onap.so.client.aai.AAIObjectType; +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.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResource; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.InstanceGroupType; +import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.serviceinstancebeans.CloudConfiguration; +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.RequestDetails; +import org.onap.so.serviceinstancebeans.RequestInfo; +import org.onap.so.serviceinstancebeans.RequestParameters; +import org.onap.so.serviceinstancebeans.Resources; +import org.onap.so.serviceinstancebeans.SubscriberInfo; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +@RunWith(MockitoJUnitRunner.class) +public class BBInputSetupTest { + private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/"; + + protected ObjectMapper mapper = new ObjectMapper(); + private static final String CLOUD_OWNER = "att-aic"; + + @Spy + private BBInputSetup SPY_bbInputSetup = new BBInputSetup(); + + @Mock + private BBInputSetupUtils SPY_bbInputSetupUtils; + + @Spy + private BBInputSetupMapperLayer bbInputSetupMapperLayer; + + @Before + public void setup(){ + SPY_bbInputSetup.setBbInputSetupUtils(SPY_bbInputSetupUtils); + SPY_bbInputSetup.setMapperLayer(bbInputSetupMapperLayer); + } + + @Test + public void testGetAlaCarteServiceInstance() throws Exception { + ServiceInstance expected = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), + ServiceInstance.class); + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + requestInfo.setInstanceName("SharansInstanceName"); + requestDetails.setRequestInfo(requestInfo); + Customer customer = new Customer(); + String serviceInstanceId = "SharansInstanceId"; + boolean aLaCarte = true; + Service service = new Service(); + service.setModelUUID("modelUUID"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelUuid("modelUUID"); + expected.setModelInfoServiceInstance(modelInfoServiceInstance); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + serviceInstanceAAI.setModelVersionId("modelUUIDDifferent"); + Map lookupKeyMap = new HashMap<>(); + String bbName = AssignFlows.SERVICE_INSTANCE.toString(); + Service differentService = new Service(); + differentService.setModelUUID("modelUUIDDifferent"); + + doReturn(expected).when(SPY_bbInputSetup).getServiceInstanceHelper(requestDetails, customer, null, null, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(serviceInstanceId); + doReturn(differentService).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(serviceInstanceAAI.getModelVersionId()); + doReturn(expected.getModelInfoServiceInstance()).when(bbInputSetupMapperLayer) + .mapCatalogServiceIntoServiceInstance(differentService); + + ServiceInstance actual = SPY_bbInputSetup.getALaCarteServiceInstance(service, requestDetails, customer, null, + null, lookupKeyMap, serviceInstanceId, aLaCarte, bbName); + assertThat(actual, sameBeanAs(expected)); + } + + @Test(expected = Exception.class) + public void testGetAlaCarteServiceInstanceException() throws Exception { + ServiceInstance expected = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), + ServiceInstance.class); + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + requestInfo.setInstanceName("SharansInstanceName"); + requestDetails.setRequestInfo(requestInfo); + Customer customer = new Customer(); + String serviceInstanceId = "SharansInstanceId"; + boolean aLaCarte = true; + Service service = new Service(); + service.setModelUUID("modelUUID"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelUuid("modelUUID"); + expected.setModelInfoServiceInstance(modelInfoServiceInstance); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + serviceInstanceAAI.setModelVersionId("modelUUIDDifferent"); + Map lookupKeyMap = new HashMap<>(); + String bbName = AssignFlows.SERVICE_INSTANCE.toString(); + Service differentService = new Service(); + differentService.setModelUUID("modelUUIDDifferent"); + + doReturn(expected).when(SPY_bbInputSetup).getServiceInstanceHelper(requestDetails, customer, null, null, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(serviceInstanceId); + doReturn(null).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(serviceInstanceAAI.getModelVersionId()); + + ServiceInstance actual = SPY_bbInputSetup.getALaCarteServiceInstance(service, requestDetails, customer, null, + null, lookupKeyMap, serviceInstanceId, aLaCarte, bbName); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetCustomerAndServiceSubscription() throws JsonParseException, JsonMappingException, IOException { + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class); + SubscriberInfo subscriberInfo = new SubscriberInfo(); + subscriberInfo.setGlobalSubscriberId("globalSubscriberId"); + RequestParameters requestParams = new RequestParameters(); + requestParams.setSubscriptionServiceType("subscriptionServiceType"); + requestDetails.setRequestParameters(requestParams); + requestDetails.setSubscriberInfo(subscriberInfo); + String resourceId = "resourceId"; + Customer expected = new Customer(); + expected.setGlobalCustomerId("globalCustomerId"); + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("subscriptionServiceType"); + + doReturn(expected).when(this.SPY_bbInputSetup).getCustomerFromRequest(requestDetails); + doReturn(serviceSubscription).when(this.SPY_bbInputSetup).getServiceSubscription(requestDetails, expected); + + Customer actual = this.SPY_bbInputSetup.getCustomerAndServiceSubscription(requestDetails, resourceId); + + assertThat(actual, sameBeanAs(expected)); + + requestDetails.setSubscriberInfo(null); + + doReturn(null).when(this.SPY_bbInputSetup).getServiceSubscription(requestDetails, expected); + doReturn(expected).when(this.SPY_bbInputSetup).getCustomerFromURI(resourceId); + doReturn(serviceSubscription).when(this.SPY_bbInputSetup).getServiceSubscriptionFromURI(resourceId, expected); + + assertThat(actual, sameBeanAs(expected)); + + } + + @Test + public void testSetHomingFlag() throws JsonParseException, JsonMappingException, IOException { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + GenericVnf genericVnfExpected = new GenericVnf(); + genericVnfExpected.setVnfId("vnfId"); + genericVnfExpected.setCallHoming(true); + expected.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs().add(genericVnfExpected); + boolean homing = true; + GenericVnf genericVnfActual = new GenericVnf(); + genericVnfActual.setVnfId("vnfId"); + genericVnfActual.setCallHoming(false); + GeneralBuildingBlock actual = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + actual.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs().add(genericVnfActual); + + SPY_bbInputSetup.setHomingFlag(actual, homing, lookupKeyMap); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetExecuteBBFromExecution() throws IOException { + ExecuteBuildingBlock expected = new ExecuteBuildingBlock(); + BuildingBlock bb = new BuildingBlock(); + bb.setBpmnFlowName("AssignServiceInstanceBB"); + expected.setBuildingBlock(bb); + expected.setRequestId("00032ab7-3fb3-42e5-965d-8ea592502017"); + DelegateExecution execution = Mockito.mock(DelegateExecution.class); + doReturn(expected).when(execution).getVariable(any(String.class)); + ExecuteBuildingBlock actual = SPY_bbInputSetup.getExecuteBBFromExecution(execution); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetGBB() throws Exception { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + + ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock(); + executeBB.setRequestId("requestId"); + RequestDetails requestDetails = new RequestDetails(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelType(ModelType.service); + requestDetails.setModelInfo(modelInfo); + RequestParameters requestParams = new RequestParameters(); + requestParams.setaLaCarte(true); + requestDetails.setRequestParameters(requestParams); + doReturn(requestDetails).when(SPY_bbInputSetupUtils).getRequestDetails(executeBB.getRequestId()); + Map lookupKeyMap = new HashMap<>(); + String resourceId = "123"; + String requestAction = "createInstance"; + doReturn(expected).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doNothing().when(SPY_bbInputSetup).populateLookupKeyMapWithIds(any(WorkflowResourceIds.class), any()); + boolean aLaCarte = true; + GeneralBuildingBlock actual = SPY_bbInputSetup.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte, + resourceId, null); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetGBBALaCarteNonService() throws Exception { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class); + Map lookupKeyMap = new HashMap<>(); + String requestAction = "createInstance"; + Service service = Mockito.mock(Service.class); + ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class); + String resourceId = "123"; + String vnfType = "vnfType"; + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance(); + aaiServiceInstance.setModelVersionId("modelVersionId"); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "instanceId"); + doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + + doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName", + serviceInstance, lookupKeyMap, resourceId, vnfType); + doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance); + doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, + executeBB, requestAction, null); + + GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId, vnfType); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test(expected = Exception.class) + public void testGetGBBALaCarteNonServiceWithoutServiceModelInfo() throws Exception { + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class); + Map lookupKeyMap = new HashMap<>(); + String requestAction = "createInstance"; + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance(); + aaiServiceInstance.setModelVersionId("modelVersionId"); + String resourceId = "123"; + String vnfType = "vnfType"; + doReturn(null).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId"); + + SPY_bbInputSetup.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, + vnfType); + } + + @Test + public void testGetGBBALaCarteNonServiceWithoutRelatedInstances() throws Exception { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withoutRelatedInstanceList.json"), RequestDetails.class); + Map lookupKeyMap = new HashMap<>(); + String requestAction = "createInstance"; + Service service = Mockito.mock(Service.class); + String resourceId = "123"; + ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class); + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance(); + aaiServiceInstance.setModelVersionId("modelVersionId"); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + String vnfType = "vnfType"; + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "instanceId"); + doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + + doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName", + serviceInstance, lookupKeyMap, resourceId, vnfType); + + doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance); + doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, + executeBB, requestAction,null); + + GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId, vnfType); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetGBBALaCarteService() throws Exception { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class); + Map lookupKeyMap = new HashMap<>(); + + org.onap.so.serviceinstancebeans.Project requestProject = new org.onap.so.serviceinstancebeans.Project(); + org.onap.so.serviceinstancebeans.OwningEntity requestOwningEntity = new org.onap.so.serviceinstancebeans.OwningEntity(); + requestDetails.setProject(requestProject); + requestDetails.setOwningEntity(requestOwningEntity); + + Service service = Mockito.mock(Service.class); + Customer customer = Mockito.mock(Customer.class); + ServiceSubscription serviceSubscription = Mockito.mock(ServiceSubscription.class); + Project project = Mockito.mock(Project.class); + OwningEntity owningEntity = Mockito.mock(OwningEntity.class); + ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class); + String resourceId = "123"; + String requestAction = "createInstance"; + executeBB.setaLaCarte(true); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.SERVICE_INSTANCE.toString()); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(project).when(bbInputSetupMapperLayer).mapRequestProject(requestDetails.getProject()); + doReturn(owningEntity).when(bbInputSetupMapperLayer) + .mapRequestOwningEntity(requestDetails.getOwningEntity()); + + doReturn(customer).when(SPY_bbInputSetup).getCustomerAndServiceSubscription(requestDetails, resourceId); + doReturn(serviceInstance).when(SPY_bbInputSetup).getALaCarteServiceInstance(service, requestDetails, customer, + project, owningEntity, lookupKeyMap, resourceId, executeBB.isaLaCarte(), + executeBB.getBuildingBlock().getBpmnFlowName()); + doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, + executeBB, requestAction, customer); + + GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetGBBALaCarteServiceFindServiceByModelVersionId() throws Exception { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class); + Map lookupKeyMap = new HashMap<>(); + + org.onap.so.serviceinstancebeans.Project requestProject = new org.onap.so.serviceinstancebeans.Project(); + org.onap.so.serviceinstancebeans.OwningEntity requestOwningEntity = new org.onap.so.serviceinstancebeans.OwningEntity(); + requestDetails.setProject(requestProject); + requestDetails.setOwningEntity(requestOwningEntity); + + Service service = Mockito.mock(Service.class); + Customer customer = Mockito.mock(Customer.class); + ServiceSubscription serviceSubscription = Mockito.mock(ServiceSubscription.class); + Project project = Mockito.mock(Project.class); + OwningEntity owningEntity = Mockito.mock(OwningEntity.class); + ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class); + String resourceId = "123"; + String requestAction = "createInstance"; + executeBB.setaLaCarte(true); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.SERVICE_INSTANCE.toString()); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + + doReturn(null).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); + doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelVersionAndModelInvariantUUID( + requestDetails.getModelInfo().getModelVersion(), requestDetails.getModelInfo().getModelInvariantId()); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(project).when(bbInputSetupMapperLayer).mapRequestProject(requestDetails.getProject()); + doReturn(owningEntity).when(bbInputSetupMapperLayer) + .mapRequestOwningEntity(requestDetails.getOwningEntity()); + + doReturn(customer).when(SPY_bbInputSetup).getCustomerAndServiceSubscription(requestDetails, resourceId); + doReturn(serviceSubscription).when(SPY_bbInputSetup).getServiceSubscription(requestDetails, customer); + doReturn(serviceInstance).when(SPY_bbInputSetup).getALaCarteServiceInstance(service, requestDetails, customer, + project, owningEntity, lookupKeyMap, resourceId, executeBB.isaLaCarte(), + executeBB.getBuildingBlock().getBpmnFlowName()); + doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, + executeBB, requestAction,customer); + + GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetGBBALaCarteServiceNoProjectNoOE() throws Exception { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class); + Map lookupKeyMap = new HashMap<>(); + + Service service = Mockito.mock(Service.class); + Customer customer = Mockito.mock(Customer.class); + ServiceSubscription serviceSubscription = Mockito.mock(ServiceSubscription.class); + ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class); + String resourceId = "123"; + String requestAction = "createInstance"; + executeBB.setaLaCarte(true); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.SERVICE_INSTANCE.toString()); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + + Map uriKeys = new HashMap<>(); + uriKeys.put("global-customer-id", "globalCustomerId"); + uriKeys.put("service-type", "serviceType"); + doReturn(uriKeys).when(SPY_bbInputSetupUtils) + .getURIKeysFromServiceInstance(resourceId); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + + doReturn(customer).when(SPY_bbInputSetup).getCustomerAndServiceSubscription(requestDetails, resourceId); + doReturn(serviceSubscription).when(SPY_bbInputSetup).getServiceSubscription(requestDetails, customer); + doReturn(serviceInstance).when(SPY_bbInputSetup).getALaCarteServiceInstance(service, requestDetails, customer, + null, null, lookupKeyMap, resourceId, executeBB.isaLaCarte(), + executeBB.getBuildingBlock().getBpmnFlowName()); + doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, + executeBB, requestAction,customer); + + GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetServiceInstanceHelperCreateScenario() throws Exception { + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + requestInfo.setInstanceName("SharansInstanceName"); + requestDetails.setRequestInfo(requestInfo); + Customer customer = new Customer(); + String serviceInstanceId = "SharansInstanceId"; + boolean aLaCarte = true; + ServiceInstance expected = new ServiceInstance(); + Map lookupKeyMap = new HashMap<>(); + Service service = new Service(); + service.setModelUUID("modelUUID"); + String bbName = AssignFlows.SERVICE_INSTANCE.toString(); + + doReturn(null).when(SPY_bbInputSetupUtils).getAAIServiceInstanceByName(requestInfo.getInstanceName(), customer); + doReturn(null).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(serviceInstanceId); + + + doReturn(expected).when(SPY_bbInputSetup).createServiceInstance(requestDetails, null, null, + lookupKeyMap, serviceInstanceId); + + ServiceInstance actual = SPY_bbInputSetup.getServiceInstanceHelper(requestDetails, customer, null, null, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetServiceInstanceHelperCreateScenarioExisting() throws Exception { + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + requestInfo.setInstanceName("SharansInstanceName"); + requestDetails.setRequestInfo(requestInfo); + Customer customer = new Customer(); + String serviceInstanceId = "SharansInstanceId"; + boolean aLaCarte = true; + Service service = new Service(); + service.setModelUUID("modelUUID"); + ServiceInstance expected = new ServiceInstance(); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + serviceInstanceAAI.setModelVersionId("modelUUID"); + Map lookupKeyMap = new HashMap<>(); + String bbName = AssignFlows.SERVICE_INSTANCE.toString(); + + doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils) + .getAAIServiceInstanceByName(requestInfo.getInstanceName(), customer); + doReturn(expected).when(SPY_bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); + + ServiceInstance actual = SPY_bbInputSetup.getServiceInstanceHelper(requestDetails, customer, null, null, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetServiceInstanceHelperCreateScenarioExistingNoNameButWithId() throws Exception { + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + requestInfo.setInstanceName("SharansInstanceName"); + requestDetails.setRequestInfo(requestInfo); + Customer customer = new Customer(); + String serviceInstanceId = "SharansInstanceId"; + boolean aLaCarte = true; + Service service = new Service(); + service.setModelUUID("modelUUID"); + ServiceInstance expected = new ServiceInstance(); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + serviceInstanceAAI.setModelVersionId("modelUUID"); + Map lookupKeyMap = new HashMap<>(); + String bbName = "ActivateServiceInstanceBB"; + + doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(serviceInstanceId); + doReturn(expected).when(SPY_bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); + + ServiceInstance actual = SPY_bbInputSetup.getServiceInstanceHelper(requestDetails, customer, null, null, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetServiceInstanceHelperCreateScenarioExistingNoNameButWithIdDifferentModel() throws Exception { + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + requestDetails.setRequestInfo(requestInfo); + Customer customer = new Customer(); + String serviceInstanceId = "SharansInstanceId"; + boolean aLaCarte = true; + Service service = new Service(); + service.setModelUUID("modelUUID"); + ServiceInstance expected = new ServiceInstance(); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + serviceInstanceAAI.setModelVersionId("modelUUIDDifferent"); + Map lookupKeyMap = new HashMap<>(); + String bbName = "ActivateServiceInstanceBB"; + Service differentService = new Service(); + differentService.setModelUUID("modelUUIDDifferent"); + + doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(serviceInstanceId); + doReturn(differentService).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(serviceInstanceAAI.getModelVersionId()); + doReturn(expected).when(SPY_bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); + + ServiceInstance actual = SPY_bbInputSetup.getServiceInstanceHelper(requestDetails, customer, null, null, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + assertThat(actual, sameBeanAs(expected)); + } + + @Test(expected = Exception.class) + public void testGetServiceInstanceHelperCreateScenarioExistingNoNameButWithIdExceptionThrown() throws Exception { + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + requestDetails.setRequestInfo(requestInfo); + Customer customer = new Customer(); + String serviceInstanceId = "SharansInstanceId"; + boolean aLaCarte = true; + Service service = new Service(); + service.setModelUUID("modelUUID"); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + serviceInstanceAAI.setModelVersionId("modelUUIDDifferent"); + Map lookupKeyMap = new HashMap<>(); + String bbName = AssignFlows.SERVICE_INSTANCE.toString(); + + ServiceInstance actual = SPY_bbInputSetup.getServiceInstanceHelper(requestDetails, customer, null, null, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + } + + @Test + public void testPopulateObjectsOnAssignAndCreateFlows() throws Exception { + String bbName = AssignFlows.SERVICE_INSTANCE.toString(); + String instanceName = "instanceName"; + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class); + RequestDetails requestDetails = Mockito.mock(RequestDetails.class); + ModelInfo modelInfo = Mockito.mock(ModelInfo.class); + RequestInfo requestInfo = Mockito.mock(RequestInfo.class); + RelatedInstanceList[] relatedInstanceList = new RelatedInstanceList[] {}; + CloudConfiguration cloudConfiguration = new CloudConfiguration(); + org.onap.so.serviceinstancebeans.Platform platform = Mockito + .mock(org.onap.so.serviceinstancebeans.Platform.class); + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = Mockito + .mock(org.onap.so.serviceinstancebeans.LineOfBusiness.class); + Map lookupKeyMap = new HashMap<>(); + + doNothing().when(SPY_bbInputSetup).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, + lookupKeyMap, resourceId, null); + doNothing().when(SPY_bbInputSetup).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, + service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); + doNothing().when(SPY_bbInputSetup).populateVolumeGroup(modelInfo, service, bbName, serviceInstance, + lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); + doNothing().when(SPY_bbInputSetup).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, relatedInstanceList, instanceName, null, cloudConfiguration); + doReturn(modelInfo).when(requestDetails).getModelInfo(); + doReturn(requestInfo).when(requestDetails).getRequestInfo(); + doReturn(instanceName).when(requestInfo).getInstanceName(); + doReturn(platform).when(requestDetails).getPlatform(); + doReturn(lineOfBusiness).when(requestDetails).getLineOfBusiness(); + doReturn(relatedInstanceList).when(requestDetails).getRelatedInstanceList(); + doReturn(cloudConfiguration).when(requestDetails).getCloudConfiguration(); + + doReturn(ModelType.network).when(modelInfo).getModelType(); + + SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, + lookupKeyMap, resourceId, vnfType); + + verify(SPY_bbInputSetup, times(1)).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, + lookupKeyMap, resourceId, null); + + doReturn(ModelType.vnf).when(modelInfo).getModelType(); + + SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, + lookupKeyMap, resourceId, vnfType); + + verify(SPY_bbInputSetup, times(1)).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, + service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); + + doReturn(ModelType.volumeGroup).when(modelInfo).getModelType(); + + SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, + lookupKeyMap, resourceId, vnfType); + + verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(modelInfo, service, bbName, serviceInstance, + lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); + + doReturn(ModelType.vfModule).when(modelInfo).getModelType(); + + SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, + lookupKeyMap, resourceId, vnfType); + + verify(SPY_bbInputSetup, times(1)).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, relatedInstanceList, instanceName, null, cloudConfiguration); + } + + @Test + public void testPopulateGBBWithSIAndAdditionalInfo() throws Exception { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class); + RequestContext requestContext = mapper.readValue(new File(RESOURCE_PATH + "RequestContextExpected.json"), + RequestContext.class); + ServiceInstance serviceInstance = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), + ServiceInstance.class); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setCloudOwner("att-aic"); + cloudRegion.setLcpCloudRegionId("lcpCloudRegionId"); + cloudRegion.setComplex("complexName"); + cloudRegion.setTenantId("tenantId"); + + Map uriKeys = new HashMap<>(); + uriKeys.put("global-customer-id","global-customer-id"); + uriKeys.put("service-type","service-type"); + + Customer customer = new Customer(); + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("subscriptionServiceType"); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setSubscriberName("subscriberName"); + customer.setSubscriberType("subscriberType"); + customer.setServiceSubscription(serviceSubscription); + + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + + String requestAction = "createInstance"; + + doReturn(uriKeys).when(SPY_bbInputSetupUtils).getURIKeysFromServiceInstance(serviceInstance.getServiceInstanceId()); + doReturn(customer).when(SPY_bbInputSetup).mapCustomer(uriKeys.get("global-customer-id"),uriKeys.get("service-type")); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(orchestrationContext).when(bbInputSetupMapperLayer).mapOrchestrationContext(requestDetails); + doReturn(requestContext).when(bbInputSetupMapperLayer).mapRequestContext(requestDetails); + doReturn(cloudRegion).when(bbInputSetupMapperLayer).mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion, + "att-aic"); + + GeneralBuildingBlock actual = SPY_bbInputSetup.populateGBBWithSIAndAdditionalInfo(requestDetails, + serviceInstance, executeBB, requestAction, null); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetServiceInstanceNOAAI() throws Exception { + ServiceInstance expected = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), + ServiceInstance.class); + Service service = mapper.readValue( + new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class); + Customer customer = mapper.readValue(new File(RESOURCE_PATH + "Customer.json"), Customer.class); + Project project = mapper.readValue(new File(RESOURCE_PATH + "Project.json"), Project.class); + OwningEntity owningEntity = mapper.readValue(new File(RESOURCE_PATH + "OwningEntity.json"), OwningEntity.class); + Map lookupKeyMap = new HashMap<>(); + + ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock(); + executeBB.setaLaCarte(true); + BuildingBlock buildingBlock = new BuildingBlock(); + buildingBlock.setBpmnFlowName(AssignFlows.SERVICE_INSTANCE.toString()); + executeBB.setBuildingBlock(buildingBlock); + RequestDetails requestDetails = new RequestDetails(); + RequestInfo reqInfo = new RequestInfo(); + reqInfo.setInstanceName("serviceInstanceName"); + requestDetails.setRequestInfo(reqInfo); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelType(ModelType.service); + requestDetails.setModelInfo(modelInfo); + doReturn(null).when(SPY_bbInputSetupUtils) + .getAAIServiceInstanceByName(requestDetails.getRequestInfo().getInstanceName(), customer); + doReturn(expected.getModelInfoServiceInstance()).when(bbInputSetupMapperLayer) + .mapCatalogServiceIntoServiceInstance(service); + doReturn(null).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(any(String.class)); + String serviceInstanceId = "3655a595-05d1-433c-93c0-3afd6b572545"; + boolean aLaCarte = true; + + ServiceInstance actual = SPY_bbInputSetup.getALaCarteServiceInstance(service, requestDetails, customer, project, + owningEntity, lookupKeyMap, serviceInstanceId, aLaCarte, + executeBB.getBuildingBlock().getBpmnFlowName()); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetServiceSubscription() throws IOException { + ServiceSubscription expected = new ServiceSubscription(); + RequestDetails requestDetails = new RequestDetails(); + RequestParameters params = new RequestParameters(); + params.setSubscriptionServiceType("subscriptionServiceType"); + requestDetails.setRequestParameters(params); + org.onap.aai.domain.yang.ServiceSubscription aaiServiceSubscription = new org.onap.aai.domain.yang.ServiceSubscription(); + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + doReturn(aaiServiceSubscription).when(SPY_bbInputSetupUtils).getAAIServiceSubscription( + customer.getGlobalCustomerId(), requestDetails.getRequestParameters().getSubscriptionServiceType()); + doReturn(expected).when(bbInputSetupMapperLayer).mapAAIServiceSubscription(aaiServiceSubscription); + + ServiceSubscription actual = SPY_bbInputSetup.getServiceSubscription(requestDetails, customer); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetCustomer() throws IOException { + Customer expected = new Customer(); + RequestDetails requestDetails = new RequestDetails(); + SubscriberInfo subscriberInfo = new SubscriberInfo(); + subscriberInfo.setGlobalSubscriberId("globalSubscriberId"); + requestDetails.setSubscriberInfo(subscriberInfo); + org.onap.aai.domain.yang.Customer aaiCustomer = new org.onap.aai.domain.yang.Customer(); + doReturn(aaiCustomer).when(SPY_bbInputSetupUtils) + .getAAICustomer(requestDetails.getSubscriberInfo().getGlobalSubscriberId()); + doReturn(expected).when(bbInputSetupMapperLayer).mapAAICustomer(aaiCustomer); + + Customer actual = SPY_bbInputSetup.getCustomerFromRequest(requestDetails); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetExistingServiceInstance() throws Exception { + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + ServiceInstance expected = new ServiceInstance(); + + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAIServiceInstanceIntoServiceInstance(serviceInstanceAAI); + + doNothing().when(SPY_bbInputSetup).addRelationshipsToSI(serviceInstanceAAI, expected); + + ServiceInstance actual = SPY_bbInputSetup.getExistingServiceInstance(serviceInstanceAAI); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testPopulateNetworkCollectionAndInstanceGroupAssign() throws Exception { + Service service = Mockito.mock(Service.class); + String key = "collectionCustId"; + ServiceInstance serviceInstance = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), + ServiceInstance.class); + String resourceId = "123"; + Collection collection = SPY_bbInputSetup.createCollection(resourceId); + InstanceGroup instanceGroup = SPY_bbInputSetup.createInstanceGroup(); + assertNull(serviceInstance.getCollection()); + doReturn(true).when(SPY_bbInputSetup).isVlanTagging(service, key); + doReturn(collection).when(SPY_bbInputSetup).createCollection(resourceId); + doReturn(instanceGroup).when(SPY_bbInputSetup).createInstanceGroup(); + doNothing().when(SPY_bbInputSetup).mapCatalogCollection(service, collection, key); + doNothing().when(SPY_bbInputSetup).mapCatalogNetworkCollectionInstanceGroup(service, + collection.getInstanceGroup(), key); + NetworkCollectionResourceCustomization networkCollection = new NetworkCollectionResourceCustomization(); + networkCollection.setModelCustomizationUUID(key); + networkCollection.setCollectionResource(new CollectionResource()); + networkCollection.getCollectionResource().setInstanceGroup(new org.onap.so.db.catalog.beans.InstanceGroup()); + networkCollection.getCollectionResource().getInstanceGroup().setToscaNodeType("NetworkCollectionResource"); + networkCollection.getCollectionResource().getInstanceGroup().setType(InstanceGroupType.L3_NETWORK); + networkCollection.getCollectionResource().getInstanceGroup().setCollectionInstanceGroupCustomizations(new ArrayList<>()); + List customizations = new ArrayList<>(); + customizations.add(networkCollection); + doReturn(customizations).when(service).getCollectionResourceCustomizations(); + + SPY_bbInputSetup.populateNetworkCollectionAndInstanceGroupAssign(service, + AssignFlows.NETWORK_COLLECTION.toString(), serviceInstance, resourceId, key); + + assertNotNull(serviceInstance.getCollection()); + assertNotNull(serviceInstance.getCollection().getInstanceGroup()); + + verify(SPY_bbInputSetup, times(1)).mapCatalogCollection(service, serviceInstance.getCollection(), key); + verify(SPY_bbInputSetup, times(1)).mapCatalogNetworkCollectionInstanceGroup(service, + serviceInstance.getCollection().getInstanceGroup(), key); + } + + @Test + public void testIsVlanTagging() throws Exception { + boolean expected = true; + Service service = Mockito.mock(Service.class); + String key = "collectionCustId"; + NetworkCollectionResourceCustomization networkCollection = new NetworkCollectionResourceCustomization(); + networkCollection.setModelCustomizationUUID(key); + networkCollection.setCollectionResource(new CollectionResource()); + networkCollection.getCollectionResource().setInstanceGroup(new org.onap.so.db.catalog.beans.InstanceGroup()); + networkCollection.getCollectionResource().getInstanceGroup().setToscaNodeType("org.openecomp.resource.cr.NetworkCollectionResource1806"); + List customizations = new ArrayList<>(); + customizations.add(networkCollection); + doReturn(customizations).when(service).getCollectionResourceCustomizations(); + boolean actual = SPY_bbInputSetup.isVlanTagging(service, key); + assertEquals("Is Vlan Tagging check.", expected, actual); + } + + @Test + public void testPopulateVolumeGroup() throws Exception { + RequestDetails requestDetails = new RequestDetails(); + RelatedInstanceList ril = new RelatedInstanceList(); + RelatedInstance ri = new RelatedInstance(); + ModelInfo mi = new ModelInfo(); + mi.setModelType(ModelType.vnf); + mi.setModelCustomizationUuid("vnfModelCustomizationUUID"); + ri.setModelInfo(mi); + ril.setRelatedInstance(ri); + requestDetails.setRelatedInstanceList(new RelatedInstanceList[] { ril }); + + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelType(ModelType.volumeGroup); + + RequestInfo reqInfo = new RequestInfo(); + reqInfo.setInstanceName("volumeGroupName"); + requestDetails.setModelInfo(modelInfo); + requestDetails.setRequestInfo(reqInfo); + + ServiceInstance serviceInstance = new ServiceInstance(); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("genericVnfId"); + + VolumeGroup vg = new VolumeGroup(); + vg.setVolumeGroupName("volumeGroupName"); + vg.setVolumeGroupId("volumeGroupId"); + vnf.getVolumeGroups().add(vg); + vnf.getVolumeGroups().add(vg); + serviceInstance.getVnfs().add(vnf); + + Service service = mapper.readValue( + new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId"); + + String bbName = AssignFlows.VOLUME_GROUP.toString(); + String resourceId = "123"; + doNothing().when(SPY_bbInputSetup).mapCatalogVolumeGroup(isA(VolumeGroup.class), eq(modelInfo), + eq(service), eq("vnfModelCustomizationUUID")); + org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiGenericVnf.setModelCustomizationId("vnfModelCustomizationUUID"); + doReturn(aaiGenericVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); + + SPY_bbInputSetup.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null); + verify(SPY_bbInputSetup, times(2)).mapCatalogVolumeGroup(vg, modelInfo, service, "vnfModelCustomizationUUID"); + vnf.getVolumeGroups().clear(); + SPY_bbInputSetup.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null); + verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(vnf.getVolumeGroups().get(0), modelInfo, service, + "vnfModelCustomizationUUID"); + } + + @Test + public void testMapCatalogVolumeGroup() { + VolumeGroup volumeGroup = new VolumeGroup(); + RequestDetails requestDetails = new RequestDetails(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid("modelCustomizationUUID"); + requestDetails.setModelInfo(modelInfo); + Service service = new Service(); + VnfResourceCustomization resourceCust = new VnfResourceCustomization(); + resourceCust.setModelCustomizationUUID("vnfModelCustomizationUUID"); + service.getVnfCustomizations().add(resourceCust); + VfModuleCustomization vfResourceCust = new VfModuleCustomization(); + vfResourceCust.setModelCustomizationUUID("modelCustomizationUUID"); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + resourceCust.getVfModuleCustomizations().add(vfResourceCust); + + doReturn(modelInfoVfModule).when(bbInputSetupMapperLayer).mapCatalogVfModuleToVfModule(vfResourceCust); + + SPY_bbInputSetup.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, "vnfModelCustomizationUUID"); + + assertEquals(modelInfoVfModule, volumeGroup.getModelInfoVfModule()); + } + + @Test + public void testPopulateL3Network() throws JsonParseException, JsonMappingException, IOException { + String instanceName = "networkName"; + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelType(ModelType.network); + + ServiceInstance serviceInstance = new ServiceInstance(); + L3Network network = new L3Network(); + network.setNetworkId("networkId"); + network.setNetworkName("networkName"); + serviceInstance.getNetworks().add(network); + String resourceId = "123"; + // Mock service + Service service = mapper.readValue( + new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + String bbName = AssignFlows.NETWORK_A_LA_CARTE.toString(); + + doNothing().when(SPY_bbInputSetup).mapCatalogNetwork(network, modelInfo, service); + + SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, null); + + lookupKeyMap.put(ResourceKey.NETWORK_ID, null); + + SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, null); + verify(SPY_bbInputSetup, times(2)).mapCatalogNetwork(network, modelInfo, service); + + instanceName = "networkName2"; + L3Network network2 = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, resourceId, null); + doReturn(network2).when(SPY_bbInputSetup).createNetwork(lookupKeyMap, instanceName, resourceId, null); + SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, null); + verify(SPY_bbInputSetup, times(1)).mapCatalogNetwork(network2, modelInfo, service); + } + + @Test + public void testMapCatalogNetwork() { + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + L3Network network = new L3Network(); + + RequestDetails requestDetails = new RequestDetails(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid("modelCustomizationUUID"); + requestDetails.setModelInfo(modelInfo); + Service service = new Service(); + NetworkResourceCustomization resourceCust = new NetworkResourceCustomization(); + resourceCust.setModelCustomizationUUID("modelCustomizationUUID"); + service.setNetworkCustomizations(Arrays.asList(new NetworkResourceCustomization[] { resourceCust })); + + doReturn(modelInfoNetwork).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(resourceCust); + + SPY_bbInputSetup.mapCatalogNetwork(network, modelInfo, service); + + assertEquals(modelInfoNetwork, network.getModelInfoNetwork()); + } + + @Test + public void testPopulateConfiguration() throws JsonParseException, JsonMappingException, IOException { + String instanceName = "configurationName"; + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); + + ServiceInstance serviceInstance = new ServiceInstance(); + Configuration configuration = new Configuration(); + configuration.setConfigurationId("configurationId"); + configuration.setConfigurationName("configurationName"); + serviceInstance.getConfigurations().add(configuration); + String resourceId = "configurationId"; + // Mock service + Service service = mapper.readValue( + new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class); + ConfigurationResourceCustomization configurationCust = new ConfigurationResourceCustomization(); + configurationCust.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); + service.getConfigurationCustomizations().add(configurationCust); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId"); + String bbName = AssignFlows.FABRIC_CONFIGURATION.toString(); + + doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service); + + SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + instanceName); + verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service); + + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, null); + + SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + instanceName); + verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service); + + instanceName = "configurationName2"; + resourceId = "resourceId2"; + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId2"); + Configuration configuration2 = SPY_bbInputSetup.createConfiguration(lookupKeyMap, instanceName, resourceId); + doReturn(configuration2).when(SPY_bbInputSetup).createConfiguration(lookupKeyMap, instanceName, resourceId); + doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration2, modelInfo, service); + SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + instanceName); + verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service); + } + + @Test + public void testMapCatalogConfiguration() { + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + L3Network network = new L3Network(); + + RequestDetails requestDetails = new RequestDetails(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid("modelCustomizationUUID"); + requestDetails.setModelInfo(modelInfo); + Service service = new Service(); + NetworkResourceCustomization resourceCust = new NetworkResourceCustomization(); + resourceCust.setModelCustomizationUUID("modelCustomizationUUID"); + service.setNetworkCustomizations(Arrays.asList(new NetworkResourceCustomization[] { resourceCust })); + + doReturn(modelInfoNetwork).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(resourceCust); + + SPY_bbInputSetup.mapCatalogNetwork(network, modelInfo, service); + + assertEquals(modelInfoNetwork, network.getModelInfoNetwork()); + } + + @Test + public void testPopulateGenericVnf() throws JsonParseException, JsonMappingException, IOException { + org.onap.so.serviceinstancebeans.Platform platform = new org.onap.so.serviceinstancebeans.Platform(); + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = new org.onap.so.serviceinstancebeans.LineOfBusiness(); + String instanceName = "vnfName"; + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelType(ModelType.vnf); + + ServiceInstance serviceInstance = new ServiceInstance(); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("genericVnfId"); + vnf.setVnfName("vnfName"); + serviceInstance.getVnfs().add(vnf); + String vnfType = "vnfType"; + RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetails_CreateVnf.json"), + RequestDetails.class); + + Service service = mapper.readValue( + new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId"); + String bbName = AssignFlows.VNF.toString(); + + Platform expectedPlatform = new Platform(); + LineOfBusiness expectedLineOfBusiness = new LineOfBusiness(); + String resourceId = "123"; + doReturn(expectedPlatform).when(bbInputSetupMapperLayer).mapRequestPlatform(platform); + doReturn(expectedLineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(lineOfBusiness); + doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf, modelInfo, service); + doReturn(null).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); + + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf, modelInfo, service); + + instanceName = "vnfName2"; + GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, + resourceId, vnfType, null); + doReturn(vnf2).when(SPY_bbInputSetup).createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, + resourceId, vnfType, null); + doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); + doNothing().when(SPY_bbInputSetup).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf2, modelInfo, service); + verify(SPY_bbInputSetup, times(1)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); + verify(SPY_bbInputSetup, times(1)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); + } + + @Test + public void testPopulateGenericVnfWhereVnfTypeIsNull() + throws JsonParseException, JsonMappingException, IOException { + org.onap.so.serviceinstancebeans.Platform platform = new org.onap.so.serviceinstancebeans.Platform(); + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = new org.onap.so.serviceinstancebeans.LineOfBusiness(); + String instanceName = "vnfName"; + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelType(ModelType.vnf); + + ServiceInstance serviceInstance = new ServiceInstance(); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("genericVnfId"); + vnf.setVnfName("vnfName"); + serviceInstance.getVnfs().add(vnf); + String vnfType = null; + RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetails_CreateVnf.json"), + RequestDetails.class); + + Service service = mapper.readValue( + new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId"); + String bbName = AssignFlows.VNF.toString(); + + Platform expectedPlatform = new Platform(); + LineOfBusiness expectedLineOfBusiness = new LineOfBusiness(); + String resourceId = "123"; + doReturn(expectedPlatform).when(bbInputSetupMapperLayer).mapRequestPlatform(platform); + doReturn(expectedLineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(lineOfBusiness); + doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf, modelInfo, service); + + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); + + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf, modelInfo, service); + + instanceName = "vnfName2"; + GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, + resourceId, vnfType, null); + doReturn(vnf2).when(SPY_bbInputSetup).createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, + resourceId, vnfType, null); + doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); + doNothing().when(SPY_bbInputSetup).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf2, modelInfo, service); + verify(SPY_bbInputSetup, times(1)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); + verify(SPY_bbInputSetup, times(1)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); + } + + @Test + public void testMapCatalogVnf() { + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + GenericVnf genericVnf = new GenericVnf(); + RequestDetails requestDetails = new RequestDetails(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid("modelCustomizationUUID"); + requestDetails.setModelInfo(modelInfo); + Service service = new Service(); + VnfResourceCustomization resourceCust = new VnfResourceCustomization(); + resourceCust.setModelCustomizationUUID("vnfModelCustomizationUUID"); + service.getVnfCustomizations().add(resourceCust); + resourceCust.setModelCustomizationUUID("modelCustomizationUUID"); + + doReturn(modelInfoGenericVnf).when(bbInputSetupMapperLayer).mapCatalogVnfToVnf(resourceCust); + + SPY_bbInputSetup.mapCatalogVnf(genericVnf, modelInfo, service); + + assertEquals(modelInfoGenericVnf, genericVnf.getModelInfoGenericVnf()); + } + + @Test + public void testMapCatalogCollectionAndInstanceGroup() { + ModelInfoCollection modelInfoCollection = new ModelInfoCollection(); + modelInfoCollection.setCollectionFunction("collectionFunction"); + modelInfoCollection.setCollectionRole("collectionRole"); + modelInfoCollection.setCollectionType("collectionType"); + modelInfoCollection.setDescription("description"); + modelInfoCollection.setModelInvariantUUID("modelInvariantUUID"); + modelInfoCollection.setQuantity(0); + + ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup(); + modelInfoInstanceGroup.setFunction("function"); + modelInfoInstanceGroup.setInstanceGroupRole("instanceGroupRole"); + modelInfoInstanceGroup.setModelInvariantUUID("modelInvariantUUID"); + modelInfoInstanceGroup.setModelUUID("modelUUID"); + modelInfoInstanceGroup.setType("VNFC"); + modelInfoInstanceGroup.setDescription("description"); + + InstanceGroup instanceGroup = new InstanceGroup(); + Collection collection = new Collection(); + collection.setInstanceGroup(instanceGroup); + + CollectionResource collectionResource = new CollectionResource(); + org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup(); + collectionResource.setToscaNodeType("NetworkCollection"); + collectionResource.setInstanceGroup(catalogInstanceGroup); + + CollectionResourceCustomization collectionCust = new NetworkCollectionResourceCustomization(); + collectionCust.setModelCustomizationUUID("modelCustomizationUUID"); + collectionCust.setCollectionResource(collectionResource); + + Service service = new Service(); + service.getCollectionResourceCustomizations().add(collectionCust); + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setCollection(collection); + + List instanceGroupCustList = new ArrayList<>(); + CollectionResourceInstanceGroupCustomization instanceGroupCust = new CollectionResourceInstanceGroupCustomization(); + instanceGroupCust.setFunction("function"); + instanceGroupCust.setDescription("description"); + + doReturn(modelInfoCollection).when(bbInputSetupMapperLayer).mapCatalogCollectionToCollection(collectionCust, + collectionResource); + doReturn(instanceGroupCustList).when(SPY_bbInputSetupUtils) + .getCollectionResourceInstanceGroupCustomization(collectionCust.getModelCustomizationUUID()); + doReturn(modelInfoInstanceGroup).when(bbInputSetupMapperLayer).mapCatalogInstanceGroupToInstanceGroup(collectionCust, + catalogInstanceGroup); + + SPY_bbInputSetup.mapCatalogCollection(service, serviceInstance.getCollection(), "modelCustomizationUUID"); + SPY_bbInputSetup.mapCatalogNetworkCollectionInstanceGroup(service, + serviceInstance.getCollection().getInstanceGroup(), collectionCust.getModelCustomizationUUID()); + + assertThat(collection.getModelInfoCollection(), sameBeanAs(modelInfoCollection)); + assertThat(instanceGroup.getModelInfoInstanceGroup(), sameBeanAs(modelInfoInstanceGroup)); + } + + @Test + public void testAddRelationshipsToSI() throws Exception { + ServiceInstance serviceInstance = new ServiceInstance(); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + serviceInstanceAAI.setServiceInstanceId("serviceInstanceId"); + + org.onap.aai.domain.yang.RelationshipList relationshipList = new org.onap.aai.domain.yang.RelationshipList(); + org.onap.aai.domain.yang.Relationship relationship = new org.onap.aai.domain.yang.Relationship(); + relationshipList.getRelationship().add(relationship); + serviceInstanceAAI.setRelationshipList(relationshipList); + + Map uriKeys = new HashMap<>(); + uriKeys.put("global-customer-id", "globalCustomerId"); + uriKeys.put("service-type", "serviceType"); + + doReturn(uriKeys).when(SPY_bbInputSetupUtils) + .getURIKeysFromServiceInstance(serviceInstanceAAI.getServiceInstanceId()); + doNothing().when(SPY_bbInputSetup).mapProject(any(), eq(serviceInstance)); + doNothing().when(SPY_bbInputSetup).mapOwningEntity(any(), eq(serviceInstance)); + doNothing().when(SPY_bbInputSetup).mapL3Networks(any(), eq(serviceInstance.getNetworks())); + doNothing().when(SPY_bbInputSetup).mapGenericVnfs(any(), eq(serviceInstance.getVnfs())); + doNothing().when(SPY_bbInputSetup).mapCollection(any(), eq(serviceInstance)); + + SPY_bbInputSetup.addRelationshipsToSI(serviceInstanceAAI, serviceInstance); + + verify(SPY_bbInputSetup, times(1)).mapProject(any(), eq(serviceInstance)); + verify(SPY_bbInputSetup, times(1)).mapOwningEntity(any(), eq(serviceInstance)); + verify(SPY_bbInputSetup, times(1)).mapL3Networks(any(), eq(serviceInstance.getNetworks())); + verify(SPY_bbInputSetup, times(1)).mapGenericVnfs(any(), eq(serviceInstance.getVnfs())); + verify(SPY_bbInputSetup, times(1)).mapCollection(any(), eq(serviceInstance)); + verify(SPY_bbInputSetup, times(1)).mapConfigurations(any(), eq(serviceInstance.getConfigurations())); + } + + @Test + public void testMapConfigurations() throws JsonProcessingException { + org.onap.aai.domain.yang.Configuration expectedAAI = new org.onap.aai.domain.yang.Configuration(); + org.onap.aai.domain.yang.RelationshipList relationshipList = new org.onap.aai.domain.yang.RelationshipList(); + org.onap.aai.domain.yang.Relationship relationship = new org.onap.aai.domain.yang.Relationship(); + relationshipList.getRelationship().add(relationship); + expectedAAI.setRelationshipList(relationshipList); + + Configuration expected = new Configuration(); + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId"); + AAIResultWrapper configurationWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(configurationWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri); + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAIConfiguration(isA(org.onap.aai.domain.yang.Configuration.class)); + + List configurations = new ArrayList<>(); + + SPY_bbInputSetup.mapConfigurations(Arrays.asList(new AAIResourceUri[] { aaiResourceUri }), configurations); + + assertEquals(expected, configurations.get(0)); + } + + @Test + public void testMapGenericVnfs() throws JsonProcessingException { + org.onap.aai.domain.yang.GenericVnf expectedAAI = new org.onap.aai.domain.yang.GenericVnf(); + org.onap.aai.domain.yang.RelationshipList relationshipList = new org.onap.aai.domain.yang.RelationshipList(); + org.onap.aai.domain.yang.Relationship relationship = new org.onap.aai.domain.yang.Relationship(); + relationshipList.getRelationship().add(relationship); + expectedAAI.setRelationshipList(relationshipList); + + GenericVnf expected = new GenericVnf(); + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId"); + AAIResultWrapper vnfWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(vnfWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri); + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAIGenericVnfIntoGenericVnf(isA(org.onap.aai.domain.yang.GenericVnf.class)); + doNothing().when(SPY_bbInputSetup).mapPlatform(any(), eq(expected)); + doNothing().when(SPY_bbInputSetup).mapLineOfBusiness(any(), eq(expected)); + doReturn(new ArrayList<>()).when(SPY_bbInputSetup).mapVolumeGroups(any()); + + List genericVnfs = new ArrayList<>(); + + SPY_bbInputSetup.mapGenericVnfs(Arrays.asList(new AAIResourceUri[] { aaiResourceUri }), genericVnfs); + + assertEquals(expected, genericVnfs.get(0)); + verify(SPY_bbInputSetup, times(1)).mapPlatform(any(), eq(expected)); + verify(SPY_bbInputSetup, times(1)).mapLineOfBusiness(any(), eq(expected)); + verify(SPY_bbInputSetup, times(1)).mapVolumeGroups(any()); + } + + @Test + public void testMapVolumeGroups() throws JsonProcessingException { + org.onap.aai.domain.yang.VolumeGroup expectedAAI = new org.onap.aai.domain.yang.VolumeGroup(); + + VolumeGroup expected = new VolumeGroup(); + AAIResultWrapper vnfWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAIVolumeGroup(isA(org.onap.aai.domain.yang.VolumeGroup.class)); + + List volumeGroupsList = + SPY_bbInputSetup.mapVolumeGroups(Arrays.asList(new AAIResultWrapper[] { vnfWrapper })); + + assertEquals(expected, volumeGroupsList.get(0)); + } + + @Test + public void testMapLineOfBusiness() throws JsonProcessingException { + org.onap.aai.domain.yang.LineOfBusiness expectedAAI = new org.onap.aai.domain.yang.LineOfBusiness(); + + LineOfBusiness expected = new LineOfBusiness(); + AAIResultWrapper vnfWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAILineOfBusiness(isA(org.onap.aai.domain.yang.LineOfBusiness.class)); + + GenericVnf vnf = new GenericVnf(); + + SPY_bbInputSetup.mapLineOfBusiness(Arrays.asList(new AAIResultWrapper[] { vnfWrapper }), vnf); + + assertEquals(expected, vnf.getLineOfBusiness()); + } + + @Test + public void testMapPlatform() throws JsonProcessingException { + org.onap.aai.domain.yang.Platform expectedAAI = new org.onap.aai.domain.yang.Platform(); + + Platform expected = new Platform(); + AAIResultWrapper vnfWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAIPlatform(isA(org.onap.aai.domain.yang.Platform.class)); + + GenericVnf vnf = new GenericVnf(); + + SPY_bbInputSetup.mapPlatform(Arrays.asList(new AAIResultWrapper[] { vnfWrapper }), vnf); + + assertEquals(expected, vnf.getPlatform()); + } + + @Test + public void testMapCollection() throws JsonProcessingException { + List collections = new ArrayList<>(); + ServiceInstance serviceInstance = new ServiceInstance(); + + org.onap.aai.domain.yang.Collection aaiCollection = new org.onap.aai.domain.yang.Collection(); + org.onap.aai.domain.yang.RelationshipList collectionRelationshipList = new org.onap.aai.domain.yang.RelationshipList(); + org.onap.aai.domain.yang.Relationship collectionInstanceGroupRelationship = new org.onap.aai.domain.yang.Relationship(); + collectionRelationshipList.getRelationship().add(collectionInstanceGroupRelationship); + aaiCollection.setRelationshipList(collectionRelationshipList); + + collections.add(new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiCollection))); + + Collection collection = new Collection(); + List instanceGroupsList = new ArrayList<>(); + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroupsList.add(instanceGroup); + + doReturn(collection).when(bbInputSetupMapperLayer) + .mapAAICollectionIntoCollection(isA(org.onap.aai.domain.yang.Collection.class)); + doReturn(instanceGroup).when(SPY_bbInputSetup).mapInstanceGroup(isA(AAIResultWrapper.class)); + doReturn(instanceGroupsList).when(SPY_bbInputSetup).mapInstanceGroups(any()); + SPY_bbInputSetup.mapCollection(collections, serviceInstance); + + assertEquals(collection, serviceInstance.getCollection()); + assertEquals(instanceGroup, collection.getInstanceGroup()); + + instanceGroupsList.clear(); + collection = new Collection(); + + SPY_bbInputSetup.mapCollection(collections, serviceInstance); + assertEquals(collection, serviceInstance.getCollection()); + assertNull(collection.getInstanceGroup()); + } + + @Test + public void testMapL3Networks() throws JsonProcessingException { + org.onap.aai.domain.yang.L3Network expectedAAI = new org.onap.aai.domain.yang.L3Network(); + org.onap.aai.domain.yang.RelationshipList relationshipList = new org.onap.aai.domain.yang.RelationshipList(); + org.onap.aai.domain.yang.Relationship relationship = new org.onap.aai.domain.yang.Relationship(); + relationshipList.getRelationship().add(relationship); + expectedAAI.setRelationshipList(relationshipList); + + L3Network expected = new L3Network(); + List l3Networks = new ArrayList<>(); + AAIResultWrapper l3NetworksWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, "networkId"); + + doReturn(l3NetworksWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthTwo(aaiResourceUri); + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAIL3Network(isA(org.onap.aai.domain.yang.L3Network.class)); + doNothing().when(SPY_bbInputSetup).mapNetworkPolicies(any(), eq(expected.getNetworkPolicies())); + doNothing().when(SPY_bbInputSetup).mapRouteTableReferences(any(), + eq(expected.getContrailNetworkRouteTableReferences())); + + SPY_bbInputSetup.mapL3Networks(Arrays.asList(new AAIResourceUri[] { aaiResourceUri }), l3Networks); + + assertEquals(expected, l3Networks.get(0)); + verify(SPY_bbInputSetup, times(1)).mapNetworkPolicies(any(), eq(expected.getNetworkPolicies())); + verify(SPY_bbInputSetup, times(1)).mapRouteTableReferences(any(), + eq(expected.getContrailNetworkRouteTableReferences())); + } + + @Test + public void testMapRouteTableReferences() throws JsonProcessingException { + org.onap.aai.domain.yang.RouteTableReference expectedAAI = new org.onap.aai.domain.yang.RouteTableReference(); + + RouteTableReference expected = new RouteTableReference(); + List contrailNetworkRouteTableReferences = new ArrayList<>(); + AAIResultWrapper vnfWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(expected).when(bbInputSetupMapperLayer).mapAAIRouteTableReferenceIntoRouteTableReference( + isA(org.onap.aai.domain.yang.RouteTableReference.class)); + + SPY_bbInputSetup.mapRouteTableReferences(Arrays.asList(new AAIResultWrapper[] { vnfWrapper }), + contrailNetworkRouteTableReferences); + + assertEquals(expected, contrailNetworkRouteTableReferences.get(0)); + } + + @Test + public void testMapOwningEntity() throws JsonProcessingException { + org.onap.aai.domain.yang.OwningEntity expectedAAI = new org.onap.aai.domain.yang.OwningEntity(); + + OwningEntity expected = new OwningEntity(); + AAIResultWrapper vnfWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAIOwningEntity(isA(org.onap.aai.domain.yang.OwningEntity.class)); + + ServiceInstance serviceInstance = new ServiceInstance(); + + SPY_bbInputSetup.mapOwningEntity(Arrays.asList(new AAIResultWrapper[] { vnfWrapper }), serviceInstance); + + assertEquals(expected, serviceInstance.getOwningEntity()); + } + + @Test + public void testMapProject() throws JsonProcessingException { + org.onap.aai.domain.yang.Project expectedAAI = new org.onap.aai.domain.yang.Project(); + + Project expected = new Project(); + AAIResultWrapper vnfWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(expected).when(bbInputSetupMapperLayer).mapAAIProject(isA(org.onap.aai.domain.yang.Project.class)); + + ServiceInstance serviceInstance = new ServiceInstance(); + + SPY_bbInputSetup.mapProject(Arrays.asList(new AAIResultWrapper[] { vnfWrapper }), serviceInstance); + + assertEquals(expected, serviceInstance.getProject()); + } + + @Test + public void testMapCustomer() throws Exception { + org.onap.aai.domain.yang.Customer customerAAI = new org.onap.aai.domain.yang.Customer(); + org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionAAI = new org.onap.aai.domain.yang.ServiceSubscription(); + + Customer expected = new Customer(); + ServiceSubscription serviceSubscription = new ServiceSubscription(); + + String globalCustomerId = "globalCustomerId"; + String subscriptionServiceType = "subscriptionServiceType"; + + doReturn(customerAAI).when(SPY_bbInputSetupUtils).getAAICustomer(globalCustomerId); + doReturn(serviceSubscriptionAAI).when(SPY_bbInputSetupUtils).getAAIServiceSubscription(globalCustomerId, + subscriptionServiceType); + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAICustomer(isA(org.onap.aai.domain.yang.Customer.class)); + doReturn(serviceSubscription).when(bbInputSetupMapperLayer) + .mapAAIServiceSubscription(isA(org.onap.aai.domain.yang.ServiceSubscription.class)); + + Customer actual = SPY_bbInputSetup.mapCustomer(globalCustomerId, subscriptionServiceType); + + assertEquals(expected, actual); + assertEquals(serviceSubscription, expected.getServiceSubscription()); + } + + @Test + public void testPopulateLookupKeyMapWithIds() { + Map expected = new HashMap<>(); + Map actual = new HashMap<>(); + String serviceInstanceId = "serviceInstanceId"; + String networkId = "networkId"; + String vnfId = "vnfId"; + String vfModuleId = "vfModuleId"; + String volumeGroupId = "volumeGroupId"; + String configurationId = "configurationId"; + + expected.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId); + expected.put(ResourceKey.NETWORK_ID, networkId); + expected.put(ResourceKey.GENERIC_VNF_ID, vnfId); + expected.put(ResourceKey.VF_MODULE_ID, vfModuleId); + expected.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupId); + expected.put(ResourceKey.CONFIGURATION_ID, configurationId); + + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId(serviceInstanceId); + workflowResourceIds.setNetworkId(networkId); + workflowResourceIds.setVnfId(vnfId); + workflowResourceIds.setVfModuleId(vfModuleId); + workflowResourceIds.setVolumeGroupId(volumeGroupId); + workflowResourceIds.setConfigurationId(configurationId); + + SPY_bbInputSetup.populateLookupKeyMapWithIds(workflowResourceIds, actual); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testgetGBBMacro() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + InfraActiveRequests request = Mockito.mock(InfraActiveRequests.class); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId"); + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + String requestAction = "createInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId()); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + doNothing().when(SPY_bbInputSetupUtils).updateInfraActiveRequestVnfId(request, + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + doReturn("vnfId").when(SPY_bbInputSetup).getVnfId(executeBB, lookupKeyMap); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), isA(ModelInfo.class), + isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), any()); + + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VNF.toString()); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateGenericVnf(isA(ModelInfo.class), any(String.class), + isA(org.onap.so.serviceinstancebeans.Platform.class), + isA(org.onap.so.serviceinstancebeans.LineOfBusiness.class), isA(Service.class), any(String.class), + isA(ServiceInstance.class), any(), any(), any(String.class), any(String.class), any()); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString()); + executeBB.getBuildingBlock().setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateVfModule(isA(ModelInfo.class), isA(Service.class), any(String.class), + isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), any(), isA(CloudConfiguration.class)); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString()); + executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(isA(ModelInfo.class), isA(Service.class), + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), + any(String.class), any()); + + Configuration configuration = new Configuration(); + configuration.setConfigurationId("configurationId"); + gBB.getServiceInstance().getConfigurations().add(configuration); + List configurationCustList = new ArrayList<>(); + ConfigurationResourceCustomization configurationCust = new ConfigurationResourceCustomization(); + configurationCust.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); + doReturn(configurationCustList).when(service).getConfigurationCustomizations(); + configurationCustList.add(configurationCust); + doNothing().when(SPY_bbInputSetup).populateConfiguration(isA(ModelInfo.class), isA(Service.class), + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class)); + + executeBB.getBuildingBlock().setBpmnFlowName("AssignFabricConfigurationBB"); + executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateConfiguration(isA(ModelInfo.class), isA(Service.class), + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class)); + } + + @Test + public void testgetGBBMacroCloudConfiguration() throws Exception { + org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue( + new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class); + CloudConfiguration cloudConfig = null; + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = new org.onap.aai.domain.yang.CloudRegion(); + Resources resources = serviceMacro.getResources(); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(any(CloudConfiguration.class), eq("att-aic")); + CloudRegion expected = new CloudRegion(); + expected.setLcpCloudRegionId("mdt1"); + expected.setCloudOwner("att-aic"); + expected.setTenantId("88a6ca3ee0394ade9403f075db23167e"); + + CloudRegion actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); + assertThat(actual, sameBeanAs(expected)); + + serviceMacro = mapper.readValue( + new File(RESOURCE_PATH + "ServiceMacroVnfs.json"), org.onap.so.serviceinstancebeans.Service.class); + resources = serviceMacro.getResources(); + + actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); + assertThat(actual, sameBeanAs(expected)); + + serviceMacro = mapper.readValue( + new File(RESOURCE_PATH + "ServiceMacroNetworks.json"), org.onap.so.serviceinstancebeans.Service.class); + resources = serviceMacro.getResources(); + + actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); + assertThat(actual, sameBeanAs(expected)); + + serviceMacro = mapper.readValue( + new File(RESOURCE_PATH + "ServiceMacroNoCloudConfig.json"), org.onap.so.serviceinstancebeans.Service.class); + resources = serviceMacro.getResources(); + + actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); + assertNull(actual); + } + + @Test + public void testgetGBBMacroWithEmptyUserParams() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + requestDetails.getRequestParameters().getUserParams().clear(); + InfraActiveRequests request = Mockito.mock(InfraActiveRequests.class); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + String requestAction = "createInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + doNothing().when(SPY_bbInputSetupUtils).updateInfraActiveRequestVnfId(request, + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + doReturn("vnfId").when(SPY_bbInputSetup).getVnfId(executeBB, lookupKeyMap); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).getGBBMacroNoUserParamsCreate(any(ExecuteBuildingBlock.class), any(), + any(String.class), any(String.class), any(GeneralBuildingBlock.class), any(Service.class)); + } + + @Test(expected = Exception.class) + public void testgetGBBMacroException() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + Map lookupKeyMap = new HashMap<>(); + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + String requestAction = "createInstance"; + doReturn(null).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + + executeBB.getBuildingBlock().setBpmnFlowName("Network"); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + } + + @Test + public void testgetGBBMacroWithVnfTypeNull() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + InfraActiveRequests request = Mockito.mock(InfraActiveRequests.class); + String resourceId = "123"; + String vnfType = null; + Service service = Mockito.mock(Service.class); + String requestAction = "createInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId()); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + doNothing().when(SPY_bbInputSetupUtils).updateInfraActiveRequestVnfId(request, + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + doReturn("vnfId").when(SPY_bbInputSetup).getVnfId(executeBB, lookupKeyMap); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), isA(ModelInfo.class), + isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), any()); + + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VNF.toString()); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateGenericVnf(isA(ModelInfo.class), any(String.class), + isA(org.onap.so.serviceinstancebeans.Platform.class), + isA(org.onap.so.serviceinstancebeans.LineOfBusiness.class), isA(Service.class), any(String.class), + isA(ServiceInstance.class), any(), any(), any(String.class), any(String.class), any()); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString()); + executeBB.getBuildingBlock().setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateVfModule(isA(ModelInfo.class), isA(Service.class), any(String.class), + isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), any(), isA(CloudConfiguration.class)); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString()); + executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(isA(ModelInfo.class), isA(Service.class), + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), + any(String.class), any()); + } + + @Test + public void testgetGBBMacroGetServiceWithInvariantId() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + InfraActiveRequests request = Mockito.mock(InfraActiveRequests.class); + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + String requestAction = "createInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId()); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + doNothing().when(SPY_bbInputSetupUtils).updateInfraActiveRequestVnfId(request, + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + doReturn("vnfId").when(SPY_bbInputSetup).getVnfId(executeBB, lookupKeyMap); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), isA(ModelInfo.class), + isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), any()); + + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VNF.toString()); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateGenericVnf(isA(ModelInfo.class), any(String.class), + isA(org.onap.so.serviceinstancebeans.Platform.class), + isA(org.onap.so.serviceinstancebeans.LineOfBusiness.class), isA(Service.class), any(String.class), + isA(ServiceInstance.class), any(), any(), any(String.class), any(String.class), any()); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString()); + executeBB.getBuildingBlock().setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateVfModule(isA(ModelInfo.class), isA(Service.class), any(String.class), + isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), any(), isA(CloudConfiguration.class)); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString()); + executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(isA(ModelInfo.class), isA(Service.class), + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), + any(String.class), any()); + } + + @Test + public void testgetGBBMacroNoUserParamsDeactivateInstnace() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + requestDetails.getRequestParameters().setUserParams(null); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + String requestAction = "deactivateInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + String generatedId = "12131"; + doReturn(generatedId).when(SPY_bbInputSetup).generateRandomUUID(); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + + executeBB.getBuildingBlock().setBpmnFlowName("DeactivateServiceInstanceBB"); + executeBB.getBuildingBlock().setKey("3c40d244-808e-42ca-b09a-256d83d19d0a"); + GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId, vnfType); + assertThat(actual, sameBeanAs(gBB)); + } + + @Test + public void testgetGBBMacroNoUserParamsCreateInstance() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + InfraActiveRequests request = Mockito.mock(InfraActiveRequests.class); + requestDetails.getRequestParameters().setUserParams(null); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId"); + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + String requestAction = "createInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(null).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + List networkCustList = new ArrayList<>(); + NetworkResourceCustomization networkCust = Mockito.mock(NetworkResourceCustomization.class); + doReturn("ab153b6e-c364-44c0-bef6-1f2982117f04").when(networkCust).getModelCustomizationUUID(); + networkCustList.add(networkCust); + doReturn(networkCustList).when(service).getNetworkCustomizations(); + doNothing().when(SPY_bbInputSetup).populateL3Network(any(), isA(ModelInfo.class), isA(Service.class), + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any()); + + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + executeBB.getBuildingBlock().setIsVirtualLink(false); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), "ab153b6e-c364-44c0-bef6-1f2982117f04", gBB, service); + + CollectionNetworkResourceCustomization collectionNetworkResourceCust = Mockito.mock(CollectionNetworkResourceCustomization.class); + doReturn(collectionNetworkResourceCust).when(SPY_bbInputSetupUtils).getCatalogCollectionNetworkResourceCustByID(any(String.class)); + NetworkResourceCustomization networkResourceCustomization = Mockito.mock(NetworkResourceCustomization.class); + doReturn(networkResourceCustomization).when(bbInputSetupMapperLayer).mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); + ModelInfoNetwork modelInfoNetwork = Mockito.mock(ModelInfoNetwork.class); + doReturn(modelInfoNetwork ).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(networkResourceCustomization); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + executeBB.getBuildingBlock().setIsVirtualLink(true); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(2)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), "ab153b6e-c364-44c0-bef6-1f2982117f04", gBB, service); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.FABRIC_CONFIGURATION.toString()); + executeBB.getBuildingBlock().setKey("modelCustId"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), "modelCustId", gBB, service); + } + + @Test + public void testgetGBBMacroNoUserParamsOther() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + requestDetails.getRequestParameters().setUserParams(null); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + String requestAction = "deleteInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + + CloudConfiguration cloudConfig = new CloudConfiguration(); + cloudConfig.setLcpCloudRegionId("lcpCloudRegionId"); + requestDetails.setCloudConfiguration(cloudConfig); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), + "att-aic"); + executeBB.getBuildingBlock().setBpmnFlowName("DeleteNetworkBB"); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).getGBBMacroExistingService(isA(ExecuteBuildingBlock.class), any(), + any(String.class), any(GeneralBuildingBlock.class), isA(Service.class), isA(String.class), + isA(CloudConfiguration.class)); + + requestAction = "activateInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + executeBB.getBuildingBlock().setBpmnFlowName("ActivateNetworkBB"); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(2)).getGBBMacroExistingService(isA(ExecuteBuildingBlock.class), any(), + any(String.class), any(GeneralBuildingBlock.class), isA(Service.class), isA(String.class), + isA(CloudConfiguration.class)); + + requestAction = "unassignInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + executeBB.getBuildingBlock().setBpmnFlowName("UnassignNetworkBB"); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(3)).getGBBMacroExistingService(isA(ExecuteBuildingBlock.class), any(), + any(String.class), any(GeneralBuildingBlock.class), isA(Service.class), isA(String.class), + isA(CloudConfiguration.class)); + + requestAction = "activateFabricConfiguration"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + executeBB.getBuildingBlock().setBpmnFlowName("ActivateFabricConfigurationBB"); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-134534656234"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(4)).getGBBMacroExistingService(isA(ExecuteBuildingBlock.class), any(), + any(String.class), any(GeneralBuildingBlock.class), isA(Service.class), isA(String.class), + isA(CloudConfiguration.class)); + } + + @Test(expected = IllegalArgumentException.class) + public void testgetGBBMacroNoUserParamsOtherException() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + requestDetails.getRequestParameters().setUserParams(null); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + String requestAction = "assignInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + String generatedId = "12131"; + doReturn(generatedId).when(SPY_bbInputSetup).generateRandomUUID(); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.SERVICE_INSTANCE.toString()); + executeBB.getBuildingBlock().setKey("3c40d244-808e-42ca-b09a-256d83d19d0a"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + } + @Test + public void testgetGBBMacroNoUserParamsExistingService() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + requestDetails.getRequestParameters().setUserParams(null); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId"); + Service service = Mockito.mock(Service.class); + CloudConfiguration cloudConfiguration = new CloudConfiguration(); + cloudConfiguration.setLcpCloudRegionId("cloudRegionId"); + String requestAction = "unassignInstance"; + + L3Network network = new L3Network(); + network.setNetworkId("networkId"); + gBB.getServiceInstance().getNetworks().add(network); + org.onap.aai.domain.yang.L3Network aaiNetwork = new org.onap.aai.domain.yang.L3Network(); + aaiNetwork.setModelCustomizationId("modelCustId"); + doReturn(aaiNetwork).when(SPY_bbInputSetupUtils).getAAIL3Network(network.getNetworkId()); + doNothing().when(SPY_bbInputSetup).mapCatalogNetwork(any(L3Network.class), any(ModelInfo.class), + any(Service.class)); + + executeBB.getBuildingBlock().setBpmnFlowName("DeleteNetworkBB"); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); + verify(SPY_bbInputSetup, times(1)).mapCatalogNetwork(any(L3Network.class), any(ModelInfo.class), + any(Service.class)); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + gBB.getServiceInstance().getVnfs().add(vnf); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); + doNothing().when(SPY_bbInputSetup).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), + any(Service.class)); + + executeBB.getBuildingBlock().setBpmnFlowName("ActivateVnfBB"); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); + verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), + any(Service.class)); + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + gBB.getServiceInstance().getVnfs().get(0).getVfModules().add(vfModule); + org.onap.aai.domain.yang.VfModule aaiVfModule = new org.onap.aai.domain.yang.VfModule(); + aaiVfModule.setModelCustomizationId("modelCustId"); + doReturn(aaiVfModule).when(SPY_bbInputSetupUtils).getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()); + + executeBB.getBuildingBlock().setBpmnFlowName("UnassignVfModuleBB"); + executeBB.getBuildingBlock().setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); + verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), + any(Service.class)); + verify(SPY_bbInputSetup, times(1)).mapCatalogVfModule(any(VfModule.class), any(ModelInfo.class), + any(Service.class), any(String.class)); + + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), + "att-aic"); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + gBB.getServiceInstance().getVnfs().get(0).getVolumeGroups().add(volumeGroup); + org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = new org.onap.aai.domain.yang.VolumeGroup(); + aaiVolumeGroup.setModelCustomizationId("modelCustId"); + doReturn(aaiVolumeGroup).when(SPY_bbInputSetupUtils).getAAIVolumeGroup("att-aic", + cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + + executeBB.getBuildingBlock().setBpmnFlowName("UnassignVolumeGroupBB"); + executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); + verify(SPY_bbInputSetup, times(3)).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), + any(Service.class)); + verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(isA(VolumeGroup.class), isA(ModelInfo.class), + isA(Service.class), isA(String.class)); + + Configuration configuration = new Configuration(); + configuration.setConfigurationId("configurationId"); + gBB.getServiceInstance().getConfigurations().add(configuration); + org.onap.aai.domain.yang.Configuration aaiConfiguration = new org.onap.aai.domain.yang.Configuration(); + aaiConfiguration.setModelCustomizationId("modelCustId"); + doReturn(aaiConfiguration).when(SPY_bbInputSetupUtils).getAAIConfiguration(configuration.getConfigurationId()); + + executeBB.getBuildingBlock().setBpmnFlowName("ActivateFabricConfigurationBB"); + executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); + SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); + verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(any(Configuration.class), any(ModelInfo.class), + any(Service.class)); + } + + @Test + public void testGetVnfId() { + String expected = "vnfId"; + ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock(); + Map lookupKeyMap = new HashMap<>(); + executeBB.setRequestId("requestId"); + InfraActiveRequests request = new InfraActiveRequests(); + request.setVnfId(expected); + doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId()); + + String actual = SPY_bbInputSetup.getVnfId(executeBB, lookupKeyMap); + + assertEquals("VnfId is set correctly", expected, actual); + } + + @Test + public void testCreateVfModule() { + String vfModuleId = "vfModuleId"; + String instanceName = "vfModuleName"; + Map cloudParams = new HashMap<>(); + cloudParams.put("param1", "param1Value"); + VfModule expected = new VfModule(); + expected.setVfModuleId(vfModuleId); + expected.setVfModuleName(instanceName); + expected.setCloudParams(cloudParams); + expected.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + Map lookupKeyMap = new HashMap<>(); + List> instanceParams = new ArrayList<>(); + instanceParams.add(cloudParams); + + VfModule actual = SPY_bbInputSetup.createVfModule(lookupKeyMap, vfModuleId, instanceName, instanceParams); + + assertThat(actual, sameBeanAs(expected)); + assertEquals("LookupKeyMap is populated", vfModuleId, lookupKeyMap.get(ResourceKey.VF_MODULE_ID)); + + expected.getCloudParams().clear(); + actual = SPY_bbInputSetup.createVfModule(lookupKeyMap, vfModuleId, instanceName, null); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testCreateVolumeGroup() { + String volumeGroupId = "volumeGroupId"; + String instanceName = "vfModuleName"; + String vnfType = "vnfType"; + Map cloudParams = new HashMap<>(); + cloudParams.put("param1", "param1Value"); + VolumeGroup expected = new VolumeGroup(); + expected.setVolumeGroupId(volumeGroupId); + expected.setVolumeGroupName(instanceName); + expected.setCloudParams(cloudParams); + expected.setVnfType(vnfType); + expected.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + Map lookupKeyMap = new HashMap<>(); + List> instanceParams = new ArrayList<>(); + instanceParams.add(cloudParams); + + VolumeGroup actual = SPY_bbInputSetup.createVolumeGroup(lookupKeyMap, volumeGroupId, instanceName, vnfType, instanceParams); + + assertThat(actual, sameBeanAs(expected)); + assertEquals("LookupKeyMap is populated", volumeGroupId, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID)); + + expected.getCloudParams().clear(); + actual = SPY_bbInputSetup.createVolumeGroup(lookupKeyMap, volumeGroupId, instanceName, vnfType, null); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testCreateNetwork() { + String networkId = "networkId"; + String instanceName = "networkName"; + Map cloudParams = new HashMap<>(); + cloudParams.put("param1", "param1Value"); + L3Network expected = new L3Network(); + expected.setNetworkId(networkId); + expected.setNetworkName(instanceName); + expected.setCloudParams(cloudParams); + expected.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + Map lookupKeyMap = new HashMap<>(); + List> instanceParams = new ArrayList<>(); + instanceParams.add(cloudParams); + L3Network actual = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, instanceParams); + + assertThat(actual, sameBeanAs(expected)); + assertEquals("LookupKeyMap is populated", networkId, lookupKeyMap.get(ResourceKey.NETWORK_ID)); + + expected.getCloudParams().clear(); + actual = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, null); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testCreateGenericVnf() { + String vnfId = "vnfId"; + String instanceName = "vnfName"; + String vnfType = "vnfType"; + String platformName = "platformName"; + String lineOfBusinessName = "lineOfBusinessName"; + Platform platform = new Platform(); + platform.setPlatformName(platformName); + LineOfBusiness lineOfBusiness = new LineOfBusiness(); + lineOfBusiness.setLineOfBusinessName(lineOfBusinessName); + Map cloudParams = new HashMap<>(); + cloudParams.put("param1", "param1Value"); + GenericVnf expected = new GenericVnf(); + expected.setVnfId(vnfId); + expected.setVnfName(instanceName); + expected.setVnfType(vnfType); + expected.setCloudParams(cloudParams); + expected.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + expected.setPlatform(platform); + expected.setLineOfBusiness(lineOfBusiness); + Map lookupKeyMap = new HashMap<>(); + List> instanceParams = new ArrayList<>(); + instanceParams.add(cloudParams); + org.onap.so.serviceinstancebeans.Platform requestPlatform = new org.onap.so.serviceinstancebeans.Platform(); + platform.setPlatformName(platformName); + org.onap.so.serviceinstancebeans.LineOfBusiness requestLineOfBusiness = new org.onap.so.serviceinstancebeans.LineOfBusiness(); + lineOfBusiness.setLineOfBusinessName(lineOfBusinessName); + + doReturn(platform).when(bbInputSetupMapperLayer).mapRequestPlatform(requestPlatform); + doReturn(lineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(requestLineOfBusiness); + + GenericVnf actual = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, requestPlatform, requestLineOfBusiness, vnfId, vnfType, instanceParams); + + assertThat(actual, sameBeanAs(expected)); + assertEquals("LookupKeyMap is populated", vnfId, lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + + expected.getCloudParams().clear(); + actual = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, requestPlatform, requestLineOfBusiness, vnfId, vnfType, null); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapCatalogVfModule() { + String vnfModelCustomizationUUID = "vnfResourceCustUUID"; + String vfModuleCustomizationUUID = "vfModelCustomizationUUID"; + VfModule vfModule = new VfModule(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid(vfModuleCustomizationUUID); + Service service = new Service(); + VnfResourceCustomization vnfResourceCust = new VnfResourceCustomization(); + vnfResourceCust.setModelCustomizationUUID(vnfModelCustomizationUUID); + VfModuleCustomization vfModuleCust = new VfModuleCustomization(); + vfModuleCust.setModelCustomizationUUID(vfModuleCustomizationUUID); + vnfResourceCust.getVfModuleCustomizations().add(vfModuleCust); + service.getVnfCustomizations().add(vnfResourceCust); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + + doReturn(modelInfoVfModule).when(bbInputSetupMapperLayer).mapCatalogVfModuleToVfModule(vfModuleCust); + + SPY_bbInputSetup.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + + assertThat(vfModule.getModelInfoVfModule(), sameBeanAs(modelInfoVfModule)); + + modelInfo.setModelCustomizationUuid(null); + modelInfo.setModelCustomizationId(vfModuleCustomizationUUID); + + SPY_bbInputSetup.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + + assertThat(vfModule.getModelInfoVfModule(), sameBeanAs(modelInfoVfModule)); + } + + @Test + public void testPopulateVfModule() throws Exception { + String vnfId = "vnfId"; + String vfModuleId = "vfModuleId"; + String volumeGroupId = "volumeGroupId"; + String vfModuleCustomizationId = "vfModuleCustomizationId"; + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationId(vfModuleCustomizationId); + Service service = new Service(); + String bbName = AssignFlows.VF_MODULE.toString(); + ServiceInstance serviceInstance = new ServiceInstance(); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId(vnfId); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId(volumeGroupId); + vnf.getVolumeGroups().add(volumeGroup); + serviceInstance.getVnfs().add(vnf); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId); + String resourceId = vfModuleId; + RelatedInstanceList[] relatedInstanceList = null; + String instanceName = "vfModuleName"; + List> instanceParams = null; + CloudConfiguration cloudConfiguration = new CloudConfiguration(); + + org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf(); + vnfAAI.setModelCustomizationId("vnfModelCustId"); + org.onap.aai.domain.yang.VolumeGroup volumeGroupAAI = new org.onap.aai.domain.yang.VolumeGroup(); + volumeGroupAAI.setModelCustomizationId(vfModuleCustomizationId); + + doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); + doReturn(volumeGroupAAI).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(CLOUD_OWNER, + cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + doNothing().when(SPY_bbInputSetup).mapCatalogVnf(isA(GenericVnf.class), isA(ModelInfo.class), isA(Service.class)); + doNothing().when(SPY_bbInputSetup).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), isA(Service.class), isA(String.class)); + + SPY_bbInputSetup.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, relatedInstanceList, instanceName, instanceParams, cloudConfiguration); + + assertEquals("Lookup Key Map populated with VfModule Id", vfModuleId, lookupKeyMap.get(ResourceKey.VF_MODULE_ID)); + assertEquals("Lookup Key Map populated with VolumeGroup Id", volumeGroupId, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID)); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java new file mode 100644 index 0000000000..d576242318 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java @@ -0,0 +1,774 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.tasks; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.aai.domain.yang.CloudRegion; +import org.onap.aai.domain.yang.Configuration; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.GenericVnfs; +import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.L3Networks; +import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.ServiceInstances; +import org.onap.aai.domain.yang.VolumeGroup; +import org.onap.aai.domain.yang.VolumeGroups; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.client.aai.AAIObjectPlurals; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +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.db.request.RequestsDbClient; +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.serviceinstancebeans.CloudConfiguration; +import org.onap.so.serviceinstancebeans.ModelInfo; +import org.onap.so.serviceinstancebeans.RequestDetails; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +@RunWith(MockitoJUnitRunner.class) +public class BBInputSetupUtilsTest { + protected ObjectMapper mapper = new ObjectMapper(); + private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/"; + + @InjectMocks + BBInputSetupUtils bbInputSetupUtils = new BBInputSetupUtils(); + + @Mock + protected CatalogDbClient MOCK_catalogDbClient; + + @Mock + protected RequestsDbClient MOCK_requestsDbClient; + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Before + public void setup(){ + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + @Test + public void testGetCatalogServiceByModelUUID() throws JsonParseException, JsonMappingException, IOException { + Service expected = mapper.readValue( + new File(RESOURCE_PATH + "CatalogServiceExpected.json"), Service.class); + + RequestDetails requestDetails = new RequestDetails(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelVersionId("modelUUID"); + requestDetails.setModelInfo(modelInfo); + doReturn(expected).when(MOCK_catalogDbClient).getServiceByID("modelUUID"); + Service actual = bbInputSetupUtils.getCatalogServiceByModelUUID(modelInfo.getModelVersionId()); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetCatalogServiceByModelVersionAndModelInvariantUUID() throws JsonParseException, JsonMappingException, IOException { + String modelVersion = "modelVersion"; + String modelInvariantUUID = "modelInvariantUUID"; + Service expectedService = mapper.readValue( + new File(RESOURCE_PATH + "CatalogServiceExpected.json"), Service.class); + + doReturn(expectedService).when(MOCK_catalogDbClient).getServiceByModelVersionAndModelInvariantUUID(isA(String.class), isA(String.class)); + + Service actualService = bbInputSetupUtils.getCatalogServiceByModelVersionAndModelInvariantUUID(modelVersion, modelInvariantUUID); + + assertThat(actualService, sameBeanAs(expectedService)); + } + + @Test + public void testGetVnfcInstanceGroups() throws JsonParseException, JsonMappingException, IOException { + VnfcInstanceGroupCustomization vnfc = mapper.readValue( + new File(RESOURCE_PATH + "VnfcInstanceGroupCustomization.json"), VnfcInstanceGroupCustomization.class); + String modelCustomizationUUID = "modelCustomizationUUID"; + + doReturn(Arrays.asList(vnfc)).when(MOCK_catalogDbClient).getVnfcInstanceGroupsByVnfResourceCust(isA(String.class)); + + List actualVnfcList = bbInputSetupUtils.getVnfcInstanceGroups(modelCustomizationUUID); + + assertThat(actualVnfcList, sameBeanAs(Arrays.asList(vnfc))); + } + + @Test + public void testGetRequestDetails() throws JsonParseException, JsonMappingException, IOException { + InfraActiveRequests infraActiveRequest = mapper.readValue( + new File(RESOURCE_PATH + "InfraActiveRequestExpected.json"), + InfraActiveRequests.class); + + RequestDetails expected = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsExpected.json"), + RequestDetails.class); + String requestId = "requestId"; + doReturn(infraActiveRequest).when(MOCK_requestsDbClient).getInfraActiveRequestbyRequestId(requestId); + RequestDetails actual = bbInputSetupUtils.getRequestDetails(requestId); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void getRequestDetailsNullTest() throws IOException { + RequestDetails requestDetails = bbInputSetupUtils.getRequestDetails(""); + + assertNull(requestDetails); + } + + @Test + public void testGetCloudRegion() { + String cloudOwner = "cloudOwnerId"; + CloudConfiguration cloudConfig = new CloudConfiguration(); + cloudConfig.setLcpCloudRegionId("lcpCloudRegionId"); + Optional expected = Optional.of(new org.onap.aai.domain.yang.CloudRegion()); + expected.get().setCloudOwner(cloudOwner); + expected.get().setCloudRegionId("lcpCloudRegionId"); + doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.CloudRegion.class, + AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, + cloudConfig.getLcpCloudRegionId())); + + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, + cloudConfig.getLcpCloudRegionId()); + bbInputSetupUtils.getCloudRegion(cloudConfig, cloudOwner); + + verify(MOCK_aaiResourcesClient, times(1)).get(CloudRegion.class, expectedUri); + } + + @Test + public void testGetCloudRegionExceptionTest() { + String cloudOwner = "cloudOwnerId"; + + CloudConfiguration cloudConfig = new CloudConfiguration(); + cloudConfig.setLcpCloudRegionId("lcpCloudRegionId"); + + RequestDetails requestDetails = new RequestDetails(); + requestDetails.setCloudConfiguration(cloudConfig); + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + + CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfig, cloudOwner); + + assertNull(cloudRegion); + } + + @Test + public void testGetCloudRegionEmptyId() { + String cloudOwner = "cloudOwnerId"; + + CloudConfiguration cloudConfig = new CloudConfiguration(); + cloudConfig.setLcpCloudRegionId(""); + + RequestDetails requestDetails = new RequestDetails(); + requestDetails.setCloudConfiguration(cloudConfig); + + CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfig, cloudOwner); + + assertNull(cloudRegion); + } + + @Test + public void testGetCloudRegionEmptyConfiguration() { + String cloudOwner = "cloudOwnerId"; + + RequestDetails requestDetails = new RequestDetails(); + + CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(requestDetails.getCloudConfiguration(), cloudOwner); + + assertNull(cloudRegion); + } + + @Test + public void testGetAAIInstanceGroup() { + Optional expected = Optional.of(new org.onap.aai.domain.yang.InstanceGroup()); + String instanceGroupId = "instanceGroupId"; + expected.get().setId(instanceGroupId); + doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.InstanceGroup.class, + AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)); + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId); + + bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId); + verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.InstanceGroup.class, expectedUri); + } + + @Test + public void testGetAAIInstanceGroupThrowNotFound() { + String instanceGroupId = "instanceGroupId"; + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.InstanceGroup.class, + AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)); + + org.onap.aai.domain.yang.InstanceGroup actual = bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId); + + assertNull(actual); + } + + @Test + public void testGetAAICustomer() { + Optional expected = Optional.of(new org.onap.aai.domain.yang.Customer()); + String globalSubscriberId = "globalSubscriberId"; + expected.get().setGlobalCustomerId(globalSubscriberId); + doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.Customer.class, + AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId)); + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId); + + bbInputSetupUtils.getAAICustomer(globalSubscriberId); + verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.Customer.class, expectedUri); + } + + @Test + public void testGetAAICustomerThrowNotFound() { + String globalSubscriberId = "globalSubscriberId"; + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.Customer.class, + AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId)); + + org.onap.aai.domain.yang.Customer actual = bbInputSetupUtils.getAAICustomer(globalSubscriberId); + + assertNull(actual); + } + + @Test + public void testGetAAIServiceSubscription() { + Optional expected = Optional.of(new org.onap.aai.domain.yang.ServiceSubscription()); + String globalSubscriberId = "globalSubscriberId"; + String subscriptionServiceType = "subscriptionServiceType"; + expected.get().setServiceType(subscriptionServiceType); + doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.ServiceSubscription.class, + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId, + subscriptionServiceType)); + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId, + subscriptionServiceType); + + bbInputSetupUtils.getAAIServiceSubscription(globalSubscriberId, subscriptionServiceType); + verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.ServiceSubscription.class, expectedUri); + } + + @Test + public void testGetAAIServiceSubscriptionErrors() { + String globalSubId = null; + String subServiceType = null; + org.onap.aai.domain.yang.ServiceSubscription actual = bbInputSetupUtils.getAAIServiceSubscription(globalSubId, subServiceType); + assertNull(actual); + + String globalSubId2 = ""; + String subServiceType2 = ""; + org.onap.aai.domain.yang.ServiceSubscription actual2 = bbInputSetupUtils.getAAIServiceSubscription(globalSubId2, subServiceType2); + assertNull(actual2); + + String globalSubId3 = ""; + String subServiceType3 = null; + org.onap.aai.domain.yang.ServiceSubscription actual3 = bbInputSetupUtils.getAAIServiceSubscription(globalSubId3, subServiceType3); + assertNull(actual3); + + String globalSubId4 = null; + String subServiceType4 = ""; + org.onap.aai.domain.yang.ServiceSubscription actual4 = bbInputSetupUtils.getAAIServiceSubscription(globalSubId4, subServiceType4); + assertNull(actual4); + } + + @Test + public void testGetAAIServiceSubscriptionThrowNotFound() { + String globalSubscriberId = "globalSubscriberId"; + String subscriptionServiceType = "subscriptionServiceType"; + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient) + .get(org.onap.aai.domain.yang.ServiceSubscription.class, AAIUriFactory.createResourceUri( + AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId, subscriptionServiceType)); + org.onap.aai.domain.yang.ServiceSubscription actual = bbInputSetupUtils + .getAAIServiceSubscription(globalSubscriberId, subscriptionServiceType); + assertNull(actual); + } + + @Test + public void testGetAAIServiceInstanceById() { + String serviceInstanceId = "serviceInstanceId"; + + ServiceInstance expectedServiceInstance = new ServiceInstance(); + + doReturn(Optional.of(expectedServiceInstance)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + + ServiceInstance actualServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + + assertThat(actualServiceInstance, sameBeanAs(expectedServiceInstance)); + } + + @Test + public void testGetAAIServiceInstanceByIdThrowNotFound() { + String serviceInstanceId = "serviceInstanceId"; + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + + ServiceInstance actualServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + + assertNull(actualServiceInstance); + } + + @Test + public void testGetAAIServiceInstanceByIdAndCustomer() { + String globalCustomerId = "globalCustomerId"; + String serviceType = "serviceType"; + String serviceInstanceId = "serviceInstanceId"; + ServiceInstance expected = new ServiceInstance(); + expected.setServiceInstanceId(serviceInstanceId); + doReturn(Optional.of(expected)).when(MOCK_aaiResourcesClient).get(isA(Class.class), + isA(AAIResourceUri.class)); + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri( + AAIObjectType.SERVICE_INSTANCE, globalCustomerId, serviceType, serviceInstanceId).depth(Depth.TWO); + this.bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(globalCustomerId, serviceType, serviceInstanceId); + + verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.ServiceInstance.class, expectedUri); + + } + + @Test + public void testGetAAIServiceInstanceByIdAndCustomerThrowNotFound() { + String globalCustomerId = "globalCustomerId"; + String serviceType = "serviceType"; + String serviceInstanceId = "serviceInstanceId"; + + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), + isA(AAIResourceUri.class)); + ServiceInstance actual = this.bbInputSetupUtils + .getAAIServiceInstanceByIdAndCustomer(globalCustomerId, serviceType, serviceInstanceId); + + assertNull(actual); + } + + @Test + public void testGetAAIServiceInstanceByName() throws Exception { + String serviceInstanceName = "serviceInstanceName"; + + ServiceInstance expectedServiceInstance = new ServiceInstance(); + expectedServiceInstance.setServiceInstanceId("serviceInstanceId"); + + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("serviceType"); + + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(serviceSubscription); + + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(expectedServiceInstance); + + doReturn(Optional.of(serviceInstances)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(), + customer.getServiceSubscription().getServiceType()) + .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO); + bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer); + + verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.ServiceInstances.class, expectedUri); + } + + @Test + public void testGetAAIServiceInstanceByNameException() throws Exception { + expectedException.expect(Exception.class); + + String serviceInstanceName = "serviceInstanceName"; + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("serviceType"); + + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(serviceSubscription); + + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(serviceInstance); + serviceInstances.getServiceInstance().add(serviceInstance); + + doReturn(Optional.of(serviceInstances)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + + bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer); + } + + @Test + public void testGetAAIServiceInstanceByNameNull() throws Exception { + String serviceInstanceName = "serviceInstanceName"; + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("serviceType"); + + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(serviceSubscription); + + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(serviceInstance); + serviceInstances.getServiceInstance().add(serviceInstance); + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + + ServiceInstance actualServiceInstance = bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer); + + assertNull(actualServiceInstance); + } + + @Test + public void testGetOptionalAAIServiceInstanceByNameException() throws Exception { + expectedException.expect(Exception.class); + + String globalCustomerId = "globalCustomerId"; + String serviceType = "serviceType"; + String serviceInstanceId = "serviceInstanceId"; + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + serviceInstance.setServiceType(serviceType); + serviceInstance.setServiceInstanceName("serviceInstanceName"); + + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(serviceInstance); + serviceInstances.getServiceInstance().add(serviceInstance); + + doReturn(Optional.of(serviceInstances)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + + bbInputSetupUtils.getAAIServiceInstanceByName(globalCustomerId, serviceType, serviceInstanceId); + } + + @Test + public void testGetOptionalAAIServiceInstanceByNameNull() throws Exception { + String globalCustomerId = "globalCustomerId"; + String serviceType = "serviceType"; + String serviceInstanceId = "serviceInstanceId"; + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + Optional actual = this.bbInputSetupUtils + .getAAIServiceInstanceByName(globalCustomerId, serviceType, serviceInstanceId); + + assertThat(actual, sameBeanAs(Optional.empty())); + } + + @Test + public void testGetCatalogInstanceGroup() throws JsonParseException, JsonMappingException, IOException { + String modelUUID = "modelUUID"; + + org.onap.so.db.catalog.beans.InstanceGroup expectedInstanceGroup = mapper.readValue( + new File(RESOURCE_PATH + "InstanceGroup.json"), org.onap.so.db.catalog.beans.InstanceGroup.class); + + doReturn(expectedInstanceGroup).when(MOCK_catalogDbClient).getInstanceGroupByModelUUID(isA(String.class)); + + org.onap.so.db.catalog.beans.InstanceGroup actualInstanceGroup = bbInputSetupUtils.getCatalogInstanceGroup(modelUUID); + + assertThat(actualInstanceGroup, sameBeanAs(expectedInstanceGroup)); + } + + @Test + public void testGetCollectionResourceInstanceGroupCustomization() { + String modelCustomizationUUID = "modelCustomizationUUID"; + + CollectionResourceInstanceGroupCustomization expectedCollection = new CollectionResourceInstanceGroupCustomization(); + + doReturn(Arrays.asList(expectedCollection)).when(MOCK_catalogDbClient) + .getCollectionResourceInstanceGroupCustomizationByModelCustUUID(modelCustomizationUUID); + + List actualCollection = bbInputSetupUtils + .getCollectionResourceInstanceGroupCustomization(modelCustomizationUUID); + + assertThat(actualCollection, sameBeanAs(Arrays.asList(expectedCollection))); + } + + @Test + public void testGetAAIGenericVnf() throws JsonParseException, JsonMappingException, IOException { + String vnfId = "vnfId"; + + GenericVnf expectedAaiVnf = mapper.readValue( + new File(RESOURCE_PATH + "aaiGenericVnfInput.json"), GenericVnf.class); + + doReturn(Optional.of(expectedAaiVnf)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE); + GenericVnf actualAaiVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId); + + assertThat(actualAaiVnf, sameBeanAs(expectedAaiVnf)); + + verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.GenericVnf.class, expectedUri); + } + + @Test + public void testGetAAIConfiguration() throws JsonParseException, JsonMappingException, IOException { + String configurationId = "configurationId"; + + Configuration expectedAaiConfiguration = mapper.readValue( + new File(RESOURCE_PATH + "ConfigurationInput.json"), Configuration.class); + + doReturn(Optional.of(expectedAaiConfiguration)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId).depth(Depth.ONE); + bbInputSetupUtils.getAAIConfiguration(configurationId); + + verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.Configuration.class, expectedUri); + } + + @Test + public void testGetAAIGenericVnfThrowNotFound() throws JsonParseException, JsonMappingException, IOException { + String vnfId = "vnfId"; + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + + GenericVnf actualAaiVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId); + + assertNull(actualAaiVnf); + } + + @Test + public void testGetAAIResourceDepthOne() { + String vnfId = "vnfId"; + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIResourceUri expectedUri = aaiResourceUri.clone().depth(Depth.ONE); + AAIResourceUri aaiResourceUriClone = aaiResourceUri.clone(); + bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri); + + verify(MOCK_aaiResourcesClient, times(1)).get(expectedUri); + assertEquals("Uri should not have changed", aaiResourceUriClone.build(), aaiResourceUri.build()); + } + + @Test + public void testGetAAIResourceDepthTwo() { + String vnfId = "vnfId"; + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIResourceUri expectedUri = aaiResourceUri.clone().depth(Depth.TWO); + AAIResourceUri aaiResourceUriClone = aaiResourceUri.clone(); + bbInputSetupUtils.getAAIResourceDepthTwo(aaiResourceUri); + + verify(MOCK_aaiResourcesClient, times(1)).get(expectedUri); + assertEquals("Uri should not have changed", aaiResourceUriClone.build(), aaiResourceUri.build()); + } + + @Test + public void getRelatedNetworkByNameFromServiceInstanceTest() throws Exception { + Optional expected = Optional.of(new L3Networks()); + L3Network network = new L3Network(); + network.setNetworkId("id123"); + network.setNetworkName("name123"); + expected.get().getL3Network().add(network); + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class), any(AAIResourceUri.class)); + Optional actual = this.bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance("id123", "name123"); + assertEquals(actual.get().getNetworkId(), expected.get().getL3Network().get(0).getNetworkId()); + } + + @Test + public void getRelatedNetworkByNameFromServiceInstanceMultipleNetworksExceptionTest() throws Exception { + expectedException.expect(Exception.class); + + String serviceInstanceId = "serviceInstanceId"; + String networkName = "networkName"; + + L3Network network = new L3Network(); + network.setNetworkId("id123"); + network.setNetworkName("name123"); + + L3Networks expected = new L3Networks(); + expected.getL3Network().add(network); + expected.getL3Network().add(network); + + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class), any(AAIResourceUri.class)); + + bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(serviceInstanceId, networkName); + } + + @Test + public void getRelatedNetworkByNameFromServiceInstanceNotFoundTest() throws Exception { + String serviceInstanceId = "serviceInstanceId"; + String networkName = "networkName"; + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class), any(AAIResourceUri.class)); + + Optional actualNetwork = bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(serviceInstanceId, networkName); + + assertEquals(Optional.empty(), actualNetwork); + } + + @Test + public void getRelatedVnfByNameFromServiceInstanceTest() throws Exception { + Optional expected = Optional.of(new GenericVnfs()); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("id123"); + vnf.setVnfName("name123"); + expected.get().getGenericVnf().add(vnf); + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(GenericVnfs.class), any(AAIResourceUri.class)); + Optional actual = this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance("id123", "name123"); + assertEquals(actual.get().getVnfId(), expected.get().getGenericVnf().get(0).getVnfId()); + } + + @Test + public void getRelatedVnfByNameFromServiceInstanceMultipleVnfsExceptionTest() throws Exception { + expectedException.expect(Exception.class); + + String serviceInstanceId = "serviceInstanceId"; + String vnfName = "vnfName"; + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("id123"); + vnf.setVnfName("name123"); + + GenericVnfs expectedVnf = new GenericVnfs(); + expectedVnf.getGenericVnf().add(vnf); + expectedVnf.getGenericVnf().add(vnf); + + doReturn(expectedVnf).when(MOCK_aaiResourcesClient).get(eq(GenericVnfs.class), any(AAIResourceUri.class)); + + bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName); + } + + @Test + public void getRelatedVnfByNameFromServiceInstanceNotFoundTest() throws Exception { + String serviceInstanceId = "serviceInstanceId"; + String vnfName = "vnfName"; + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(GenericVnfs.class), any(AAIResourceUri.class)); + + Optional actualVnf = this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName); + + assertEquals(actualVnf, Optional.empty()); + } + + @Test + public void getRelatedVolumeGroupByNameFromVnfTest() throws Exception { + Optional expected = Optional.of(new VolumeGroups()); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("id123"); + volumeGroup.setVolumeGroupName("name123"); + expected.get().getVolumeGroup().add(volumeGroup); + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); + Optional actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123", "name123"); + assertEquals(actual.get().getVolumeGroupId(), expected.get().getVolumeGroup().get(0).getVolumeGroupId()); + } + + @Test + public void getRelatedVolumeGroupByNameFromVnfMultipleVolumeGroupsExceptionTest() throws Exception { + expectedException.expect(Exception.class); + + String vnfId = "vnfId"; + String volumeGroupName = "volumeGroupName"; + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("id123"); + volumeGroup.setVolumeGroupName("name123"); + + VolumeGroups expectedVolumeGroup = new VolumeGroups(); + expectedVolumeGroup.getVolumeGroup().add(volumeGroup); + expectedVolumeGroup.getVolumeGroup().add(volumeGroup); + + doReturn(expectedVolumeGroup).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); + + bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName); + } + + @Test + public void getRelatedVolumeGroupByNameFromVnfNotFoundTest() throws Exception { + String vnfId = "vnfId"; + String volumeGroupName = "volumeGroupName"; + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); + + Optional actualVolumeGroup = bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName); + + assertEquals(actualVolumeGroup, Optional.empty()); + } + + @Test + public void getRelatedVolumeGroupByNameFromVfModuleTest() throws Exception { + Optional expected = Optional.of(new VolumeGroups()); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("id123"); + volumeGroup.setVolumeGroupName("name123"); + expected.get().getVolumeGroup().add(volumeGroup); + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); + Optional actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "name123"); + assertEquals(actual.get().getVolumeGroupId(), expected.get().getVolumeGroup().get(0).getVolumeGroupId()); + } + + @Test + public void getRelatedVolumeGroupByNameFromVfModuleMultipleVolumeGroupsExceptionTest() throws Exception { + expectedException.expect(Exception.class); + + String vnfId = "vnfId"; + String volumeGroupName = "volumeGroupName"; + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("id123"); + volumeGroup.setVolumeGroupName("name123"); + + VolumeGroups expectedVolumeGroup = new VolumeGroups(); + expectedVolumeGroup.getVolumeGroup().add(volumeGroup); + expectedVolumeGroup.getVolumeGroup().add(volumeGroup); + + doReturn(expectedVolumeGroup).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); + + bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupName); + } + + @Test + public void getRelatedVolumeGroupByNameFromVfModuleNotFoundTest() throws Exception { + String vnfId = "vnfId"; + String volumeGroupName = "volumeGroupName"; + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); + + Optional actualVolumeGroup = bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupName); + + assertEquals(actualVolumeGroup, Optional.empty()); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java new file mode 100644 index 0000000000..5e2275015b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java @@ -0,0 +1,147 @@ +/*- + * ============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.bpmn.servicedecomposition.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; +import org.springframework.beans.factory.annotation.Autowired; + +public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { + @Autowired + private ExecuteBuildingBlockRainyDay executeBuildingBlockRainyDay; + + private ServiceInstance serviceInstance; + private Customer customer; //will build service sub + private GenericVnf vnf; + private BuildingBlock buildingBlock; + private ExecuteBuildingBlock executeBuildingBlock; + + @Before + public void before() { + serviceInstance = setServiceInstance(); + customer = setCustomer(); + vnf = setGenericVnf(); + + buildingBlock = new BuildingBlock(); + buildingBlock.setBpmnFlowName("AssignServiceInstanceBB"); + + executeBuildingBlock = new ExecuteBuildingBlock(); + executeBuildingBlock.setBuildingBlock(buildingBlock); + + delegateExecution.setVariable("gBBInput", gBBInput); + delegateExecution.setVariable("WorkflowException", new WorkflowException("", 7000, "")); + delegateExecution.setVariable("buildingBlock", executeBuildingBlock); + delegateExecution.setVariable("lookupKeyMap", lookupKeyMap); + } + + @Test + public void setRetryTimerTest() throws Exception{ + delegateExecution.setVariable("retryCount", 2); + executeBuildingBlockRainyDay.setRetryTimer(delegateExecution); + assertEquals("PT25M",delegateExecution.getVariable("RetryDuration")); + } + + @Test + public void setRetryTimerExceptionTest() { + expectedException.expect(BpmnError.class); + + executeBuildingBlockRainyDay.setRetryTimer(null); + } + + @Test + public void queryRainyDayTableExists() throws Exception{ + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); + vnf.setVnfType("vnft1"); + + RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); + rainyDayHandlerStatus.setErrorCode("7000"); + rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB"); + rainyDayHandlerStatus.setServiceType("st1"); + rainyDayHandlerStatus.setVnfType("vnft1"); + rainyDayHandlerStatus.setPolicy("Rollback"); + rainyDayHandlerStatus.setWorkStep("ASTERISK"); + + doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "st1", "vnft1", "7000", "*"); + + executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution); + + assertEquals("Rollback", delegateExecution.getVariable("handlingCode")); + } + + @Test + public void queryRainyDayTableDefault() throws Exception{ + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); + vnf.setVnfType("vnft1"); + + RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); + rainyDayHandlerStatus.setErrorCode("ASTERISK"); + rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB"); + rainyDayHandlerStatus.setServiceType("ASTERISK"); + rainyDayHandlerStatus.setVnfType("ASTERISK"); + rainyDayHandlerStatus.setPolicy("Rollback"); + rainyDayHandlerStatus.setWorkStep("ASTERISK"); + + doReturn(null).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "st1", "vnft1", "7000", "ASTERISK"); + doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "ASTERISK", "ASTERISK", "ASTERISK", "ASTERISK"); + + executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution); + + assertEquals("Rollback", delegateExecution.getVariable("handlingCode")); + } + + @Test + public void queryRainyDayTableDoesNotExist() throws Exception{ + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); + vnf.setVnfType("vnft1"); + + doReturn(null).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class)); + + executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution); + + assertEquals("Abort", delegateExecution.getVariable("handlingCode")); + } + + @Test + public void queryRainyDayTableExceptionTest() { + doThrow(Exception.class).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class)); + + executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution); + + assertEquals("Abort", delegateExecution.getVariable("handlingCode")); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java new file mode 100644 index 0000000000..3a4d6a0cc9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client; + +import static org.assertj.core.api.Assertions.assertThatCode; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.ByteArrayInputStream; +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; + +import javax.ws.rs.BadRequestException; +import javax.ws.rs.ForbiddenException; +import javax.ws.rs.InternalServerErrorException; +import javax.ws.rs.NotAcceptableException; +import javax.ws.rs.NotAllowedException; +import javax.ws.rs.NotAuthorizedException; +import javax.ws.rs.NotFoundException; +import javax.ws.rs.NotSupportedException; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.BaseTest; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; + +@RunWith(JUnitParamsRunner.class) +public class ResponseExceptionMapperImplTest{ + + private static final ResponseExceptionMapperImpl mapper = new ResponseExceptionMapperImpl(); + + public static Object[][] statusesAndCorrespondingExceptions() { + return new Object[][]{ + {Status.BAD_REQUEST, BadRequestException.class}, + {Status.UNAUTHORIZED, NotAuthorizedException.class}, + {Status.FORBIDDEN, ForbiddenException.class}, + {Status.NOT_FOUND, NotFoundException.class}, + {Status.METHOD_NOT_ALLOWED, NotAllowedException.class}, + {Status.NOT_ACCEPTABLE, NotAcceptableException.class}, + {Status.PRECONDITION_FAILED, PreconditionFailedException.class}, + {Status.UNSUPPORTED_MEDIA_TYPE, NotSupportedException.class}, + {Status.INTERNAL_SERVER_ERROR, InternalServerErrorException.class}, + {Status.SERVICE_UNAVAILABLE, WebApplicationException.class}, + {Status.BAD_GATEWAY, WebApplicationException.class}, + }; + } + + @Test + @Parameters(method = "statusesAndCorrespondingExceptions") + public void shouldThrowExceptionWhenStatusIsNotOk(Status status, Class expectedException) { + // given + Response response = createMockResponse(status); + // when, then + assertThatThrownBy(() -> mapper.map(response)).isInstanceOf(expectedException); + } + + @Test + public void shouldNotThrowExceptionWhenStatusIsOk() { + // given + Response response = createMockResponse(Status.OK); + // when, then + assertThatCode(() -> mapper.map(response)).doesNotThrowAnyException(); + } + + @Test + public void shouldThrowExceptionWithCustomMessageWhenResponseHasEntity() throws UnsupportedEncodingException { + // given + Response response = createMockResponse(Status.BAD_REQUEST); + when(response.hasEntity()).thenReturn(true); + when(response.getEntity()).thenReturn(new ByteArrayInputStream("test message".getBytes(StandardCharsets.UTF_8))); + // when, then + assertThatThrownBy(() -> mapper.map(response)).isInstanceOf(BadRequestException.class) + .hasMessage("test message"); + } + + @Test + public void shouldThrowExceptionWithDefaultMessageWhenResponseHasNoEntity() { + // given + Response response = createMockResponse(Status.BAD_REQUEST); + when(response.hasEntity()).thenReturn(false); + // when, then + assertThatThrownBy(() -> mapper.map(response)).isInstanceOf(BadRequestException.class) + .hasMessage("empty message"); + } + + private static Response createMockResponse(Status status) { + Response responseContext = mock(Response.class); + when(responseContext.getStatusInfo()).thenReturn(status); + when(responseContext.getStatus()).thenReturn(status.getStatusCode()); + return responseContext; + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java new file mode 100644 index 0000000000..8d33a08c7a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java @@ -0,0 +1,463 @@ +/*- + * ============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.client.appc; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Optional; + +import org.json.JSONObject; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.Status; +import org.onap.so.BaseTest; +import org.onap.so.bpmn.appc.payload.PayloadClient; + +import com.fasterxml.jackson.core.JsonProcessingException; + + +public class ApplicationControllerActionTest extends BaseTest{ + + private ApplicationControllerAction appCAction; + + @Mock + private ApplicationControllerOrchestrator client; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + + appCAction = new ApplicationControllerAction(); + appCAction.client = client; + } + + @Test + public void runAppCCommand_ResumeTraffic_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + //Prepare method + Action action = Action.ResumeTraffic; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional payload = Optional.empty(); + Optional vserverId = Optional.empty(); + HashMap payloadInfo = new HashMap(); + payloadInfo.put("vnfName", "testVnfName"); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + Optional otherPayload = PayloadClient.resumeTrafficFormat(payloadInfo.get("vnfName")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + } + + @Test + public void runAppCCommand_Start_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + runAppCCommand_StartStop_Test(Action.Start); + } + + @Test + public void runAppCCommand_Stop_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + runAppCCommand_StartStop_Test(Action.Stop); + } + + private void runAppCCommand_StartStop_Test(Action action) throws ApplicationControllerOrchestratorException, JsonProcessingException { + //Prepare method + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional payload = Optional.empty(); + Optional vserverId = Optional.empty(); + HashMap payloadInfo = new HashMap(); + payloadInfo.put("vnfName", "testVnfName"); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + Optional otherPayload = PayloadClient.startStopFormat(payloadInfo.get("vnfName")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + } + + @Test + public void runAppCCommand_Unlock_Test() throws ApplicationControllerOrchestratorException { + runAppCCommand_LockUnlock_Test(Action.Unlock); + } + + @Test + public void runAppCCommand_Lock_Test() throws ApplicationControllerOrchestratorException { + runAppCCommand_LockUnlock_Test(Action.Lock); + } + + private void runAppCCommand_LockUnlock_Test(Action action) throws ApplicationControllerOrchestratorException { + //Prepare method + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional payload = Optional.empty(); + Optional vserverId = Optional.empty(); + HashMap payloadInfo = new HashMap(); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + Optional otherPayload = Optional.empty(); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + } + + @Test + public void runAppCCommand_QuiesceTraffic_PayloadPresent_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + //Prepare method + Action action = Action.QuiesceTraffic; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional payload = Optional.of("testPayload"); + Optional vserverId = Optional.empty(); + HashMap payloadInfo = new HashMap(); + payloadInfo.put("vnfName", "testVnfName"); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + Optional modifiedPayload = PayloadClient.quiesceTrafficFormat(payload, payloadInfo.get("vnfName")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, modifiedPayload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverId, modifiedPayload, controllerType); + } + + @Test + public void runAppCCommand_QuiesceTraffic_NoPayload_Test() throws ApplicationControllerOrchestratorException { + //Prepare method + Action action = Action.QuiesceTraffic; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional payload = Optional.empty(); + HashMap payloadInfo = new HashMap(); + String controllerType = "testControllerType"; + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify non call + verify(client, times(0)).vnfCommand(any(), any(), any(), any(), any(), any()); + assertEquals("Payload is not present for " + action.toString(), appCAction.getErrorMessage()); + } + + @Test + public void runAppCCommand_HealthCheck_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + //Prepare method + Action action = Action.HealthCheck; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional payload = Optional.empty(); + Optional vserverId = Optional.empty(); + HashMap payloadInfo = new HashMap(); + payloadInfo.put("vnfName", "testVnfName"); + payloadInfo.put("vnfHostIpAddress", "testVnfHostIpAddress"); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + Optional otherPayload = PayloadClient.healthCheckFormat(payloadInfo.get("vnfName"), payloadInfo.get("vnfHostIpAddress")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + } + + @Test + public void runAppCCommand_Snapshot_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + //Prepare method + Action action = Action.Snapshot; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional payload = Optional.empty(); + HashMap payloadInfo = new HashMap(); + payloadInfo.put("identityUrl", "testIdentityUrl"); + ArrayList vmIdList = new ArrayList(); + String vmId1 = "testlink:testVmId1"; + vmIdList.add(vmId1); + String vmId2 = "testlink:testVmId2"; + vmIdList.add(vmId2); + JSONObject vmIdListJson = new JSONObject(); + vmIdListJson.put("vmIds", vmIdList); + payloadInfo.put("vmIdList", vmIdListJson.toString()); + ArrayList vserverIdList = new ArrayList(); + String vserverId1 = "testVserverId1"; + Optional vserverIdString1 = Optional.of(vserverId1); + vserverIdList.add(vserverId1); + String vserverId2 = "testVserverId2"; + Optional vserverIdString2 = Optional.of(vserverId2); + vserverIdList.add(vserverId2); + + JSONObject vserverIdListJson = new JSONObject(); + vserverIdListJson.put("vserverIds", vserverIdList); + payloadInfo.put("vserverIdList", vserverIdListJson.toString()); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + Optional otherPayloadVm1 = PayloadClient.snapshotFormat(vmId1, payloadInfo.get("identityUrl")); + Optional otherPayloadVm2 = PayloadClient.snapshotFormat(vmId2, payloadInfo.get("identityUrl")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverIdString1, otherPayloadVm1, controllerType); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverIdString2, otherPayloadVm2, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverIdString1, otherPayloadVm1, controllerType); + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverIdString2, otherPayloadVm2, controllerType); + } + + @Test + public void runAppCCommand_ConfigModify__PayloadPresent_Test() throws ApplicationControllerOrchestratorException { + //Prepare method + Action action = Action.ConfigModify; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional payload = Optional.of("testPayload"); + Optional vserverId = Optional.empty(); + HashMap payloadInfo = new HashMap(); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, payload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverId, payload, controllerType); + } + + @Test + public void runAppCCommand_ConfigModify__NoPayload_Test() throws ApplicationControllerOrchestratorException { + //Prepare method + Action action = Action.ConfigModify; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional payload = Optional.empty(); + HashMap payloadInfo = new HashMap(); + String controllerType = "testControllerType"; + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify non call + verify(client, times(0)).vnfCommand(any(), any(), any(), any(), any(), any()); + assertEquals("Payload is not present for " + action.toString(), appCAction.getErrorMessage()); + } + + @Test + public void runAppCCommand_UpgradePreCheck_PayloadPresent_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + runAppCCommand_Upgrade_PayloadPresent_Test(Action.UpgradePreCheck); + } + + @Test + public void runAppCCommand_UpgradePostCheck_PayloadPresent_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + runAppCCommand_Upgrade_PayloadPresent_Test(Action.UpgradePostCheck); + } + + @Test + public void runAppCCommand_UpgradeSoftware_PayloadPresent_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + runAppCCommand_Upgrade_PayloadPresent_Test(Action.UpgradeSoftware); + } + + @Test + public void runAppCCommand_UpgradeBackup_PayloadPresent_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + runAppCCommand_Upgrade_PayloadPresent_Test(Action.UpgradeBackup); + } + + private void runAppCCommand_Upgrade_PayloadPresent_Test(Action action) throws ApplicationControllerOrchestratorException, JsonProcessingException { + //Prepare method + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional payload = Optional.of("testPayload"); + Optional vserverId = Optional.empty(); + HashMap payloadInfo = new HashMap(); + payloadInfo.put("vnfName", "testVnfName"); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + Optional modifiedPayload = PayloadClient.upgradeFormat(payload, payloadInfo.get("vnfName")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, modifiedPayload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverId, modifiedPayload, controllerType); + } + + @Test + public void runAppCCommand_UpgradePreCheck_NoPayload_Test() throws ApplicationControllerOrchestratorException { + runAppCCommand_Upgrade_NoPayload_Test(Action.UpgradePreCheck); + } + + @Test + public void runAppCCommand_UpgradePostCheck_NoPayload_Test() throws ApplicationControllerOrchestratorException { + runAppCCommand_Upgrade_NoPayload_Test(Action.UpgradePostCheck); + } + + @Test + public void runAppCCommand_UpgradeSoftware_NoPayload_Test() throws ApplicationControllerOrchestratorException { + runAppCCommand_Upgrade_NoPayload_Test(Action.UpgradeSoftware); + } + + @Test + public void runAppCCommand_UpgradeBackup_NoPayload_Test() throws ApplicationControllerOrchestratorException { + runAppCCommand_Upgrade_NoPayload_Test(Action.UpgradeBackup); + } + + private void runAppCCommand_Upgrade_NoPayload_Test(Action action) throws ApplicationControllerOrchestratorException { + //Prepare method + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional payload = Optional.empty(); + HashMap payloadInfo = new HashMap(); + String controllerType = "testControllerType"; + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify non call + verify(client, times(0)).vnfCommand(any(), any(), any(), any(), any(), any()); + assertEquals("Payload is not present for " + action.toString(), appCAction.getErrorMessage()); + } + + @Test + public void runAppCCommand_InvalidAppCAction_Test() throws ApplicationControllerOrchestratorException { + //Prepare method + Action action = Action.ActionStatus; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional payload = Optional.empty(); + HashMap payloadInfo = new HashMap(); + String controllerType = "testControllerType"; + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify non call + verify(client, times(0)).vnfCommand(any(), any(), any(), any(), any(), any()); + //TODO For original author/architect: it appears that whoever coded this wanted the error message to be "Unable to idenify Action request for AppCClient" and this is not the case because of the ApplicationControllerSupport.getCategoryOf(appCStatus) call with a null appCStatus, so this may be something worth looking into + } + + @Test + public void runAppCCommand_NormalAppCStatusGetErrorCode_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + //Prepare method + Action action = Action.Start; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional payload = Optional.empty(); + Optional vserverId = Optional.empty(); + HashMap payloadInfo = new HashMap(); + payloadInfo.put("vnfName", "testVnfName"); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + status.setCode(100); + Optional otherPayload = PayloadClient.startStopFormat(payloadInfo.get("vnfName")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + String expectedErrorCode = "0"; + assertEquals(expectedErrorCode, appCAction.getErrorCode()); + } + + @Test + public void getErrorCode_Test() { + String defaultErrorCode = "1002"; + //Verify default error code + assertEquals(defaultErrorCode, appCAction.getErrorCode()); + } + + @Test + public void getErrorMessage_Test() { + String defaultErrorMessage = "Unable to reach App C Servers"; + //Verify default error message + assertEquals(defaultErrorMessage, appCAction.getErrorMessage()); + } + + @Test + public void applicationControllerOrchestratorExceptionCaught_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + //Prepare method + Action action = Action.Start; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional payload = Optional.empty(); + Optional vserverId = Optional.empty(); + HashMap payloadInfo = new HashMap(); + payloadInfo.put("vnfName", "testVnfName"); + String controllerType = "testControllerType"; + + //Prepare mocks + Optional otherPayload = PayloadClient.startStopFormat(payloadInfo.get("vnfName")); + String expectedErrorMessage = "Test appc orchestrator error message"; + doThrow(new ApplicationControllerOrchestratorException(expectedErrorMessage, 0)).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify error + assertEquals(expectedErrorMessage, appCAction.getErrorMessage()); + String expectedErrorCode = "1002"; + assertEquals(expectedErrorCode, appCAction.getErrorCode()); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerClientV2Test.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerClientV2Test.java new file mode 100644 index 0000000000..7fabb2ac0e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerClientV2Test.java @@ -0,0 +1,131 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.appc; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.ActionIdentifiers; +import org.onap.appc.client.lcm.model.CheckLockInput; +import org.onap.appc.client.lcm.model.Status; +import org.onap.so.BaseTest; + +import java.util.Properties; +import java.util.UUID; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; + +@RunWith(MockitoJUnitRunner.class) +public class ApplicationControllerClientV2Test { + + @Mock + ApplicationControllerSupport applicationControllerSupport; + + @Mock + ApplicationControllerConfiguration applicationControllerConfiguration; + + @InjectMocks + ApplicationControllerClientV2 client; + + + @Before + public void setup(){ + when(applicationControllerConfiguration.getReadTopic()).thenReturn("APPC-TEST-AMDOCS2"); + when(applicationControllerConfiguration.getReadTimeout()).thenReturn("120000"); + when(applicationControllerConfiguration.getResponseTimeout()).thenReturn("120000"); + when(applicationControllerConfiguration.getWrite()).thenReturn("APPC-TEST-AMDOCS1-DEV3"); + when(applicationControllerConfiguration.getService()).thenReturn("ueb"); + when(applicationControllerConfiguration.getPoolMembers()).thenReturn("localhost:3904,localhost:3904,localhost:3904"); + when(applicationControllerConfiguration.getClientKey()).thenReturn("iaEMAfjsVsZnraBP"); + when(applicationControllerConfiguration.getClientSecret()).thenReturn("wcivUjsjXzmGFBfxMmyJu9dz"); + //client.buildClient(); + } + @BeforeClass + public static void beforeClass() { + System.setProperty("mso.config.path", "src/test/resources"); + } + @Ignore + @Test + public void createRequest_CheckLock_RequestBuilt() { + ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); + actionIdentifiers.setVnfId("vnfId"); + // when(applicationControllerSupport.getInput(eq(Action.CheckLock.name()))).thenReturn(new CheckLockInput()); + CheckLockInput checkLockInput = (CheckLockInput) client.createRequest(Action.CheckLock, actionIdentifiers, null, + "requestId"); + assertEquals(checkLockInput.getAction().name(), "CheckLock"); + } + @Ignore + @Test + public void runCommand_liveAppc() { + ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); + //actionIdentifiers.setVnfId("ca522254-2ba4-4fbd-b15b-0ef0d9cfda5f"); + actionIdentifiers.setVnfId("2d2bf10e-81a5-"); + Status status; + //when(applicationControllerSupport.getInput(eq(Action.Lock.name()))).thenReturn(new LockInput()); + //when(applicationControllerSupport.getAPIMethod(anyString(),any(),anyBoolean())).thenCallRealMethod(); + try { + status = client.runCommand(Action.Lock, actionIdentifiers, null, UUID.randomUUID().toString()); + } catch (ApplicationControllerOrchestratorException e) { + status = new Status(); + status.setCode(e.getAppcCode()); + status.setMessage(e.getMessage()); + } + assertEquals("Status of run command is correct", status.getCode(), 306); + } + + @Ignore + @Test + public void runCommand_CheckLock_RequestBuilt() { + ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); + actionIdentifiers.setVnfId("fusion-vpp-vnf-001"); + Status status; + try { + status = client.runCommand(Action.Unlock, actionIdentifiers, null, "requestId"); + } catch (ApplicationControllerOrchestratorException e) { + status = new Status(); + status.setCode(e.getAppcCode()); + status.setMessage(e.getMessage()); + } + assertEquals("Status of run command is correct", status.getCode(), 309); + } + + @Ignore + @Test + public void test_getLCMPropertiesHelper() { + Properties properties = client.getLCMProperties(""); + assertEquals(properties.get("topic.write"), "APPC-TEST-AMDOCS1-DEV3"); + assertEquals(properties.get("topic.read.timeout"), "120000"); + assertEquals(properties.get("client.response.timeout"), "120000"); + assertEquals(properties.get("topic.read"), "APPC-TEST-AMDOCS2"); + assertEquals(properties.get("poolMembers"), + "localhost:3904,localhost:3904,localhost:3904"); + assertEquals(properties.get("client.key"), "iaEMAfjsVsZnraBP"); + assertEquals(properties.get("client.secret"), "wcivUjsjXzmGFBfxMmyJu9dz"); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerSupportTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerSupportTest.java new file mode 100644 index 0000000000..5ef26b34ee --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerSupportTest.java @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.appc; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.appc.client.lcm.model.Status; +import org.onap.so.BaseTest; +import org.onap.so.client.appc.ApplicationControllerSupport.StatusCategory; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; + +@RunWith(JUnitParamsRunner.class) +public class ApplicationControllerSupportTest{ + + public static Object[][] statusesAndCategories() { + return new Object[][]{ + {100, StatusCategory.NORMAL}, + {200, StatusCategory.ERROR}, + {300, StatusCategory.ERROR}, + {400, StatusCategory.NORMAL}, + {401, StatusCategory.ERROR}, + {500, StatusCategory.NORMAL}, + {501, StatusCategory.ERROR}, + {502, StatusCategory.WARNING}, + {800, StatusCategory.WARNING}, + }; + } + + public static Object[][] statusesAndFinalities() { + return new Object[][]{ + {100, false}, + {200, true}, + {300, true}, + {400, true}, + {500, false}, + {800, true}, + }; + } + + @Test + @Parameters(method = "statusesAndCategories") + public void shouldReturnCategoryForCode(int code, StatusCategory category) throws Exception { + // when + StatusCategory detectedCategory = ApplicationControllerSupport.getCategoryOf(createStatus(code)); + // then + assertThat(detectedCategory).isEqualTo(category); + } + + @Test + @Parameters(method = "statusesAndFinalities") + public void shouldReturnFinalityForCode(int code, boolean expectedFinality) throws Exception { + // when + boolean finality = ApplicationControllerSupport.getFinalityOf(createStatus(code)); + // then + assertThat(finality).isEqualTo(expectedFinality); + } + + private Status createStatus(int code) { + Status status = new Status(); + status.setCode(code); + return status; + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBeansTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBeansTest.java new file mode 100644 index 0000000000..30ab21b2dd --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBeansTest.java @@ -0,0 +1,66 @@ +/*- + * ============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.client.avpn.dmaap.beans; + +import static org.junit.Assert.assertNotNull; + +import java.util.List; + +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.openpojo.rules.ToStringTester; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.filters.FilterPackageInfo; +import com.openpojo.reflection.impl.PojoClassFactory; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.affirm.Affirm; +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; + +public class AVPNDmaapBeansTest extends BaseTest{ + + private static final int EXPECTED_CLASS_COUNT = 5; + private static final String POJO_PACKAGE = "org.onap.so.client.avpn.dmaap.beans"; + + @Test + public void ensureExpectedPojoCount() { + List pojoClasses = PojoClassFactory.getPojoClasses( POJO_PACKAGE, + new FilterPackageInfo()); + Affirm.affirmEquals("Classes added / removed?", EXPECTED_CLASS_COUNT, pojoClasses.size()); + } + + @Test + public void testPojoStructureAndBehavior() { + Validator validator = ValidatorBuilder.create() + .with(new GetterMustExistRule()) + .with(new SetterMustExistRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .with(new ToStringTester()) + .build(); + + validator.validate(POJO_PACKAGE, new FilterPackageInfo()); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java new file mode 100644 index 0000000000..35586cc29e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java @@ -0,0 +1,82 @@ +/*- + * ============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.client.dmaapproperties; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; + +import java.io.File; +import java.io.IOException; + +import org.apache.http.HttpStatus; +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.client.avpn.dmaap.beans.AVPNDmaapBean; +import org.onap.so.client.exception.MapperException; +import org.springframework.beans.factory.annotation.Autowired; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import static com.github.tomakehurst.wiremock.client.WireMock.*; + +public class DmaapPropertiesClientTest extends BaseTest{ + + @Autowired + private DmaapPropertiesClient dmaapPropertiesClient; + + private final String file = "src/test/resources/org/onap/so/client/avpn/dmaap/avpnDmaapAsyncRequestStatus.json"; + private String requestId = "rq1234d1-5a33-55df-13ab-12abad84e331"; + private String clientSource = "SPP"; + private String correlator = "myClientId123"; + private String serviceInstanceId = "bc305d54-75b4-431b-adb2-eb6b9e546014"; + private String startTime = "2017-11-17T09:30:47Z"; + private String finishTime = "2017-11-17T09:30:47Z"; + private String requestScope = "service"; + private String requestType = "createInstance"; + private String timestamp = "2017-11-17T09:30:47Z"; + private String requestState = "COMPLETE"; + private String statusMessage = "Success"; + private String percentProgress = "100"; + + @Test + public void testBuildRequestJson() throws MapperException, IOException { + AVPNDmaapBean actualBean = dmaapPropertiesClient.buildRequestJson(requestId, clientSource, correlator, serviceInstanceId, startTime, finishTime, requestScope, + requestType, timestamp, requestState, statusMessage, percentProgress, true); + + AVPNDmaapBean expected = new ObjectMapper().readValue(new File(file), AVPNDmaapBean.class); + + assertNotNull(actualBean); + assertThat(actualBean, sameBeanAs(expected)); + } + + @Test + public void testDmaapPublishRequest() throws JsonProcessingException, MapperException { + stubFor(post(urlEqualTo("/events/com.att.mso.asyncStatusUpdate?timeout=20000")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); + + dmaapPropertiesClient.dmaapPublishRequest(requestId, clientSource, correlator, serviceInstanceId, startTime, finishTime, requestScope, + requestType, timestamp, requestState, statusMessage, percentProgress, false); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java new file mode 100644 index 0000000000..0992b59267 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java @@ -0,0 +1,41 @@ +/*- + * ============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.client.dmaapproperties; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.so.BaseTest; +import org.springframework.beans.factory.annotation.Autowired; + +public class GlobalDmaapPublisherTest extends BaseTest{ + + @Autowired + private GlobalDmaapPublisher globalDmaapPublisher; + + @Test + public void testGetters() { + assertEquals("dmaapUsername", globalDmaapPublisher.getUserName()); + assertEquals("dmaapPassword", globalDmaapPublisher.getPassword()); + assertEquals("com.att.mso.asyncStatusUpdate", globalDmaapPublisher.getTopic()); + assertEquals("http://localhost:" + wireMockPort, globalDmaapPublisher.getHost().get()); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java new file mode 100644 index 0000000000..9ada85fa38 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.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.client.exception; + +import static org.junit.Assert.assertEquals; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.bpmn.mock.FileUtil; + +public class ExceptionBuilderTest extends BaseTest { + + private static final String RESOURCE_PATH = "__files/"; + private static final String VALID_ERROR_MESSAGE = "{test error message}"; + + @Test + public void buildAndThrowWorkflowExceptionTest() { + try { + ExceptionBuilder exceptionBuilder = new ExceptionBuilder(); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, new NullPointerException(VALID_ERROR_MESSAGE)); + } catch (BpmnError bpmnException){ + assertEquals("MSOWorkflowException", bpmnException.getErrorCode()); + } + } + + @Test + public void buildAndThrowWorkflowExceptionInvalidMessageTest() { + try{ + ExceptionBuilder exceptionBuilder = new ExceptionBuilder(); + String invalidErrorMessage = FileUtil.readResourceFile(RESOURCE_PATH + "invalidErrorMessage.txt"); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, new NullPointerException(invalidErrorMessage)); + } catch (BpmnError bpmnException){ + assertEquals("MSOWorkflowException", bpmnException.getErrorCode()); + } + } + + @Test + public void buildAndThrowWorkflowExceptionInvalidMessageFlagTest() { + try{ + ExceptionBuilder exceptionBuilder = new ExceptionBuilder(); + String invalidErrorMessage = FileUtil.readResourceFile(RESOURCE_PATH + "invalidErrorMessageFlag.txt"); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, new NullPointerException(invalidErrorMessage)); + } catch (BpmnError bpmnException){ + assertEquals("MSOWorkflowException", bpmnException.getErrorCode()); + } + } + + @Test + public void buildAndThrowWorkflowExceptionNullMessageTest() { + try{ + ExceptionBuilder exceptionBuilder = new ExceptionBuilder(); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, new NullPointerException()); + } catch (BpmnError bpmnException){ + assertEquals("MSOWorkflowException", bpmnException.getErrorCode()); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/AAIPropertiesImplTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/AAIPropertiesImplTest.java new file mode 100644 index 0000000000..2e74d443bd --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/AAIPropertiesImplTest.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.client.restproperties; + +import static org.junit.Assert.assertEquals; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.junit.Test; +import org.onap.so.client.aai.AAIVersion; + +public class AAIPropertiesImplTest{ + + private AAIPropertiesImpl aaiPropertiesImpl = new AAIPropertiesImpl(); + + @Test + public void getEndpointTest() throws MalformedURLException { + assertEquals("aai.endpoint", AAIPropertiesImpl.AAI_ENDPOINT); + } + + @Test + public void getAuthTest() { + String expectedAuth = "aai.auth"; + assertEquals(expectedAuth, AAIPropertiesImpl.AAI_AUTH); + } + + @Test + public void getKeyTest() { + assertEquals("mso.msoKey", AAIPropertiesImpl.MSO_MSO_KEY); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/PolicyRestPropertiesImplTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/PolicyRestPropertiesImplTest.java new file mode 100644 index 0000000000..d1de702a81 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/PolicyRestPropertiesImplTest.java @@ -0,0 +1,52 @@ +/*- + * ============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.client.restproperties; + +import static org.junit.Assert.assertEquals; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.junit.Test; + +public class PolicyRestPropertiesImplTest { + + + @Test + public void getEndpointTest() throws MalformedURLException { + assertEquals("policy.endpoint", PolicyRestPropertiesImpl.POLICY_ENDPOINT); + } + + @Test + public void getEnvironmentTest() { + assertEquals("policy.environment", PolicyRestPropertiesImpl.POLICY_ENVIRONMENT); + } + + @Test + public void getClientAuthTest() { + assertEquals("policy.auth", PolicyRestPropertiesImpl.POLICY_AUTH); + } + + @Test + public void getAuthTest() { + assertEquals("policy.client.auth", PolicyRestPropertiesImpl.POLICY_CLIENT_AUTH); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/RestPropertiesPojoTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/RestPropertiesPojoTest.java new file mode 100644 index 0000000000..863338548e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/RestPropertiesPojoTest.java @@ -0,0 +1,47 @@ +/*- + * ============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.client.restproperties; + +import org.junit.Test; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.impl.PojoClassFactory; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.NoPrimitivesRule; +import com.openpojo.validation.rule.impl.NoPublicFieldsRule; +import com.openpojo.validation.test.impl.GetterTester; + +public class RestPropertiesPojoTest { + @Test + public void pojoStructure() { + test(PojoClassFactory.getPojoClass(AaiPropertiesConfiguration.class)); + } + + private void test(PojoClass pojoClass) { + Validator validator = ValidatorBuilder.create() + .with(new NoPrimitivesRule()) + .with(new NoPublicFieldsRule()) + .with(new GetterTester()) + .build(); + validator.validate(pojoClass); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java new file mode 100644 index 0000000000..8231c2f529 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java @@ -0,0 +1,104 @@ +/*- + * ============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.client.restproperties; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertThat; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.client.RestPropertiesLoader; +import org.onap.so.client.aai.AAIProperties; + +public class ThreadedReadTest { + @Test + public void allAtOnce() throws InterruptedException { + ExecutorService executorService = Executors.newFixedThreadPool(10); + + Callable callableTask = () -> { + return RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class); + }; + List> callableTasks = new ArrayList<>(); + + callableTasks.add(callableTask); + callableTasks.add(callableTask); + callableTasks.add(callableTask); + callableTasks.add(callableTask); + callableTasks.add(callableTask); + + List> futures = executorService.invokeAll(callableTasks); + + Set results = new HashSet<>(); + futures.forEach(item -> { + try { + results.add(item.get()); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }); + + assertThat("expect all unique results", results.size(), equalTo(callableTasks.size())); + + } + + @Test + public void executeOverTime() { + ScheduledExecutorService executorService = Executors.newScheduledThreadPool(10); + + Callable callableTask = () -> { + TimeUnit.MILLISECONDS.sleep(500); + return RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class); + }; + List> callableTasks = new ArrayList<>(); + + callableTasks.add(callableTask); + callableTasks.add(callableTask); + callableTasks.add(callableTask); + callableTasks.add(callableTask); + callableTasks.add(callableTask); + + Set results = new HashSet<>(); + callableTasks.forEach(callable -> { + try { + TimeUnit.MILLISECONDS.sleep(300); + Future result = executorService.submit(callable); + results.add(result.get()); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }); + + assertThat("expect all unique results", results.size(), equalTo(callableTasks.size())); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/appc/payload/PayloadClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/appc/payload/PayloadClientTest.java deleted file mode 100644 index 95af260ac6..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/appc/payload/PayloadClientTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.appc.payload; - -import static org.junit.Assert.assertEquals; - -import java.util.Optional; - -import org.json.JSONObject; -import org.junit.Test; - -public class PayloadClientTest { - - @Test - public void upgradeFormatTest() throws Exception { - String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"existing-software-version\":\"existingVersion\",\"new-software-version\":\"newVersion\"}}"; - JSONObject jsonObject = new JSONObject(); - jsonObject.put("existing-software-version", "existingVersion"); - jsonObject.put("new-software-version", "newVersion"); - Optional payload = Optional.of(jsonObject.toString()); - Optional payloadClient = PayloadClient.upgradeFormat(payload, "vnfName1"); - assertEquals(payloadResult, payloadClient.get()); - } - - @Test - public void resumeTrafficFormatTest() throws Exception { - String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}"; - Optional payloadClient = PayloadClient.resumeTrafficFormat("vnfName1"); - assertEquals(payloadResult, payloadClient.get()); - } - - @Test - public void quiesceTrafficFormatTest() throws Exception { - String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"operations_timeout\":\"operationTimeout\"}}"; - JSONObject jsonObject = new JSONObject(); - jsonObject.put("operations-timeout", "operationTimeout"); - Optional payload = Optional.of(jsonObject.toString()); - Optional payloadClient = PayloadClient.quiesceTrafficFormat(payload, "vnfName1"); - assertEquals(payloadResult, payloadClient.get()); - } - - @Test - public void startStopFormatTest() throws Exception { - String payloadResult = "{\" AICIdentity \":\"aicIdentity1\"}"; - Optional payloadClient = PayloadClient.startStopFormat("aicIdentity1"); - assertEquals(payloadResult, payloadClient.get()); - } - - @Test - public void healthCheckFormatTest() throws Exception { - String payloadResult = "{\"request-parameters\":{\"vnf-name\":\"vnfName1\"},\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}"; - Optional payloadClient = PayloadClient.healthCheckFormat("vnfName1", "vnfHostIpAddress1"); - assertEquals(payloadResult, payloadClient.get()); - } - - @Test - public void snapshotFormatTest() throws Exception { - String payloadResult = "{\"vm-id\":\"vmId1\",\"identity-url\":\"identityUrl1\"}"; - Optional payloadClient = PayloadClient.snapshotFormat("vmId1", "identityUrl1"); - assertEquals(payloadResult, payloadClient.get()); - } - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/AppCClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/AppCClientTest.java deleted file mode 100644 index 8561b030eb..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/AppCClientTest.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.bpmn.common; - - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfsByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetPserverByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSetInMaintFlagByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponsePolicy.MockPolicySkip; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut; - -//import static org.junit.Assert.assertEquals; -//import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -//import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -//import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.onap.appc.client.lcm.model.Action; - -//import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; - -public class AppCClientTest extends WorkflowTest{ - - - @Test - @Ignore // 1802 merge - @Deployment(resources = {"subprocess/BuildingBlock/AppCClient.bpmn"}) - public void test() throws Exception{ - - logStart(); - - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - //MockGetGenericVnfById_404("testVnfId"); - MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "1.0", "VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json"); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockPutGenericVnf(".*"); - MockAAIVfModule(); - MockPatchGenericVnf("skask"); - MockPatchVfModuleId("skask", ".*"); - mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml"); - mockVNFPut("skask", "/supercool", 202); - mockVNFPut("skask", "/lukewarm", 202); - MockVNFAdapterRestVfModule(); - MockDBUpdateVfModule(); - MockGetPserverByVnfId("skask", "AAI/AAI_pserverByVnfId.json", 200); - MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200); - MockSetInMaintFlagByVnfId("skask", 200); - MockPolicySkip(); - mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map variables = new HashMap(); - variables = setVariablesInstance(); - String businessKey = UUID.randomUUID().toString(); - invokeSubProcess("AppCClient", businessKey, variables); - waitForProcessEnd(businessKey, 10000); - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, "AppCClient", "WorkflowException"); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - logEnd(); - } - - - private Map setVariablesInstance(){ - Map variables = new HashMap(); - variables.put("isDebugLogEnabled", "true"); - variables.put("mso-request-id", "RaaACCTest1"); - variables.put("msoRequestId", "RaaACCTestRequestId-1"); - variables.put("requestId", "testRequestId"); - variables.put("vnfId", "skask"); - variables.put("action", Action.Stop); - variables.put("healthCheckIndex", 0); - variables.put("payload", "{\"existing-software-version\":\"3.1\",\"new-software-version\":\"3.2\"}"); - //variables.put("payload", "{\"vm-id\": \"\", \"identy-url\":\"\", \"tenant-id\": \"\"}, \"Hello\":\"Whats up\"" ); - return variables; - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java deleted file mode 100644 index 0bb5186a17..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java +++ /dev/null @@ -1,248 +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.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.spy; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.camunda.bpm.engine.ProcessEngineServices; -import org.camunda.bpm.engine.history.HistoricProcessInstance; -import org.camunda.bpm.engine.history.HistoricVariableInstance; -import org.camunda.bpm.engine.variable.impl.VariableMapImpl; -import org.jboss.resteasy.spi.AsynchronousResponse; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; - -/** - * Set of utility methods used for Unit testing - * - */ -public class BPMNUtil { - - public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) { - String pID = getProcessInstanceId(processEngineServices, - processDefinitionID); - assertProcessInstanceFinished(processEngineServices, pID); - HistoricVariableInstance responseData = processEngineServices.getHistoryService() - .createHistoricVariableInstanceQuery().processInstanceId(pID) - .variableName(name) - .singleResult(); - - if (responseData != null) { - return (responseData.getValue() != null ? responseData.getValue().toString(): null); - } - return null; - } - - @SuppressWarnings("unchecked") - public static T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) { - String pID = getProcessInstanceId(processEngineServices, - processDefinitionID); - assertProcessInstanceFinished(processEngineServices, pID); - Object responseData = processEngineServices.getHistoryService() - .createHistoricVariableInstanceQuery().processInstanceId(pID) - .variableName(name) - .singleResult() - .getValue(); - return (T) responseData; - } - - - public static void assertAnyProcessInstanceFinished(ProcessEngineServices processEngineServices, String processDefinitionID) { - String pID = getProcessInstanceId(processEngineServices, - processDefinitionID); - assertNotNull(pID); - assertTrue(processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count() > 0); - } - - public static void assertNoProcessInstance(ProcessEngineServices processEngineServices, String processDefinitionID) { - assertNull(getProcessInstanceId(processEngineServices, processDefinitionID)); - } - - public static void assertProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) { - assertEquals(1, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count()); - } - - public static void assertProcessInstanceNotFinished(ProcessEngineServices processEngineServices, String processDefinitionID) { - String pID = getProcessInstanceId(processEngineServices, - processDefinitionID); - assertEquals(0, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count()); - } - - private static String getProcessInstanceId( - ProcessEngineServices processEngineServices, String processDefinitionID) { - List historyList = processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list(); - String pID = null; - for (HistoricProcessInstance hInstance: historyList) { - if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) { - pID = hInstance.getId(); - break; - } - } - return pID; - } - - public static boolean isProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) { - return processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count() == 1 ? true: false; - } - - - private static void buildVariable(String key, String value, Map variableValueType) { - Map host = new HashMap<>(); - host.put("value", value); - host.put("type", "String"); - variableValueType.put(key, host); - } - - public static WorkflowResponse executeWorkFlow(ProcessEngineServices processEngineServices, String processKey, Map variables) { - WorkflowResource workflowResource = new WorkflowResource(); - VariableMapImpl variableMap = new VariableMapImpl(); - - Map variableValueType = new HashMap<>(); - for (String key : variables.keySet()) { - buildVariable(key, variables.get(key), variableValueType); - } - buildVariable("mso-service-request-timeout","600", variableValueType); - variableMap.put("variables", variableValueType); - - workflowResource.setProcessEngineServices4junit(processEngineServices); - Response response = workflowResource.startProcessInstanceByKey( - processKey, variableMap); - WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity(); - return workflowResponse; - } - - //Check the runtime service to see whether the process is completed - public static void waitForWorkflowToFinish(ProcessEngineServices processEngineServices, String pid) throws InterruptedException { - // Don't wait forever - long waitTime = 120000; - long endTime = System.currentTimeMillis() + waitTime; - - while (true) { - if (processEngineServices.getRuntimeService().createProcessInstanceQuery().processInstanceId(pid).singleResult() == null) { - break; - } - - if (System.currentTimeMillis() >= endTime) { - fail("Process " + pid + " did not finish in " + waitTime + "ms"); - } - - Thread.sleep(200); - } - } - - /** - * Executes the Asynchronous workflow in synchronous fashion and returns the WorkflowResponse object - * @param processEngineServices - * @param processKey - * @param variables - * @return - * @throws InterruptedException - */ - public static WorkflowResponse executeAsyncWorkflow(ProcessEngineServices processEngineServices, String processKey, Map variables) throws InterruptedException { - ProcessThread pthread = new ProcessThread(processKey, processEngineServices, variables); - pthread.start(); - BPMNUtil.assertProcessInstanceNotFinished(processEngineServices, processKey); - String pid = getProcessInstanceId(processEngineServices, processKey); - //Caution: If there is a problem with workflow, this may wait for ever - while (true) { - pid = getProcessInstanceId(processEngineServices, processKey); - if (!isProcessInstanceFinished(processEngineServices,pid)) { - Thread.sleep(200); - } else{ - break; - } - } - //need to retrieve for second time ? - pid = getProcessInstanceId(processEngineServices, processKey); - waitForWorkflowToFinish(processEngineServices, pid); - return pthread.workflowResponse; - } - - /** - * Execute workflow using async resource - * @param processEngineServices - * @param processKey - * @param asyncResponse - * @param variables - */ - private static void executeAsyncFlow(ProcessEngineServices processEngineServices, String processKey, AsynchronousResponse asyncResponse, Map variables) { - WorkflowAsyncResource workflowResource = new WorkflowAsyncResource(); - VariableMapImpl variableMap = new VariableMapImpl(); - - Map variableValueType = new HashMap<>(); - for (String key : variables.keySet()) { - buildVariable(key, variables.get(key), variableValueType); - } - buildVariable("mso-service-request-timeout","600", variableValueType); - variableMap.put("variables", variableValueType); - - workflowResource.setProcessEngineServices4junit(processEngineServices); - workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMap); - } - - /** - * Helper class which executes workflow in a thread - * - */ - static class ProcessThread extends Thread { - - public WorkflowResponse workflowResponse = null; - public String processKey; - public AsynchronousResponse asyncResponse = spy(AsynchronousResponse.class); - public boolean started; - public ProcessEngineServices processEngineServices; - public Map variables; - - public ProcessThread(String processKey, ProcessEngineServices processEngineServices, Map variables) { - this.processKey = processKey; - this.processEngineServices = processEngineServices; - this.variables = variables; - } - - public void run() { - started = true; - doAnswer(new Answer() { - public Void answer(InvocationOnMock invocation) { - Response response = (Response) invocation.getArguments()[0]; - workflowResponse = (WorkflowResponse) response.getEntity(); - return null; - } - }).when(asyncResponse).setResponse(any(Response.class)); - executeAsyncFlow(processEngineServices, processKey, asyncResponse, variables); - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BeansTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BeansTest.java deleted file mode 100644 index 358ebfa13c..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BeansTest.java +++ /dev/null @@ -1,75 +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.bpmn.common; - -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.bpmn.appc.payload.beans"); - test("org.openecomp.mso.client.sdnc.beans"); - } - - private void test(String pojoPackage) { - Validator validator = ValidatorBuilder.create() - .with(new GetterMustExistRule()) - .with(new SetterMustExistRule()) - - .with(new SetterTester()) - .with(new GetterTester()) - - .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/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java deleted file mode 100644 index bf69223b52..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java +++ /dev/null @@ -1,217 +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.bpmn.common; - -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; - -/** - * Unit test for CompleteMsoProcess.bpmn. - */ -public class CompleteMsoProcessTest extends WorkflowTest { - - private void executeFlow(String inputRequestFile) throws InterruptedException { - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - //String changeFeatureActivateRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/ChangeFeatureActivateV1/" + inputRequestFile); - Map variables = new HashMap<>(); - variables.put("CompleteMsoProcessRequest",inputRequestFile); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CompleteMsoProcess", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - logEnd(); - } - - @Test - @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericNotificationService.bpmn" - }) - public void msoCompletionRequestWithNotificationurl_200() throws Exception { - logStart(); - - //Execute Flow - executeFlow(gMsoCompletionRequestWithNotificationurl()); - - //Verify Error - String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode"); - Assert.assertEquals("200", CMSO_ResponseCode); - Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator")); - logEnd(); - } - - @Test - @Ignore // BROKEN TEST - @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericNotificationService.bpmn" - }) - public void msoCompletionRequestWithNotificationurl_500() throws Exception { - logStart(); - - //Execute Flow - executeFlow(gMsoCompletionRequestWithNotificationurl()); - - //Verify Error - String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode"); - Assert.assertEquals("500", CMSO_ResponseCode); - Assert.assertFalse((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator")); - logEnd(); - } - - @Test - @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericNotificationService.bpmn" - }) - public void msoCompletionRequestWithNoNotificationurl() throws Exception { - logStart(); - - //Execute Flow - executeFlow(gMsoCompletionRequestWithNoNotificationurl()); - - //Verify Error - String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode"); - Assert.assertEquals("200", CMSO_ResponseCode); - Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator")); - logEnd(); - } - - @Test - @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericNotificationService.bpmn" - }) - public void msoCompletionRequestWithNotificationurlNoRequestId() throws Exception { - logStart(); - - //Execute Flow - executeFlow(gMsoCompletionRequestWithNotificationurlNoRequestId()); - - //Verify Error - String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode"); - Assert.assertEquals("200", CMSO_ResponseCode); - Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator")); - logEnd(); - } - - @Test - @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericNotificationService.bpmn" - }) - public void msoCompletionRequestWithNoNotificationurlNoRequestId() throws Exception { - logStart(); - - //Execute Flow - executeFlow(gMsoCompletionRequestWithNoNotificationurlNoRequestId()); - - //Verify Error - String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode"); - Assert.assertEquals("200", CMSO_ResponseCode); - Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator")); - logEnd(); - } - - public String gMsoCompletionRequestWithNotificationurl() { - //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS - String xml = "" - + "" - + " " - + " uCPE1020_STUW105_5002" - + " Layer3ServiceActivateRequest" - + " COMPLETE" - + " OMX" - + " https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl" - + " 10205000" - + " 1" - + " " - + " UCPELayer3ServiceActivateV1" - + ""; - - return xml; - } - - - - public String gMsoCompletionRequestWithNoNotificationurl() { - //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS - String xml = "" - + "" - + " " - + " uCPE1020_STUW105_5002" - + " Layer3ServiceActivateRequest" - + " COMPLETE" - + " OMX" - + " " - + " 10205000" - + " 1" - + " " - + " UCPELayer3ServiceActivateV1" - + ""; - - return xml; - } - - public String gMsoCompletionRequestWithNoNotificationurlNoRequestId() { - //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS - String xml = "" - + "" - + " " - + " " - + " Layer3ServiceActivateRequest" - + " COMPLETE" - + " OMX" - + " " - + " 10205000" - + " 1" - + " " - + " UCPELayer3ServiceActivateV1" - + ""; - - return xml; - } - - public String gMsoCompletionRequestWithNotificationurlNoRequestId() { - //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS - String xml = "" - + "" - + " " - + " " - + " Layer3ServiceActivateRequest" - + " COMPLETE" - + " OMX" - + " https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl" - + " 10205000" - + " 1" - + " " - + " UCPELayer3ServiceActivateV1" - + ""; - - return xml; - } -} - diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java deleted file mode 100644 index 845f06045a..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.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.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; - -/** - * Unit test cases for ConfirmVolumeGroupName.bpmn - */ -public class ConfirmVolumeGroupNameTest extends WorkflowTest { - /** - * Sunny day scenario. - * - * @throws Exception - */ - @Test - @Deployment(resources = { - "subprocess/ConfirmVolumeGroupName.bpmn" - }) - public void sunnyDay() throws Exception { - - logStart(); - MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml"); - - System.out.println("Before starting process"); - - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1"); - variables.put("ConfirmVolumeGroupName_volumeGroupName", "VOLUME_GROUP_ID_1_NAME"); - variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21"); - System.out.println("after setting variables"); - runtimeService.startProcessInstanceByKey("ConfirmVolumeGroupName", variables); - String response = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponse"); - String responseCode = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode"); - - assertEquals("200", responseCode); - System.out.println(response); - logEnd(); - } - - /** - * Rainy day scenario - nonexisting volume group id. - * - * @throws Exception - */ - @Test - @Deployment(resources = { - "subprocess/ConfirmVolumeGroupName.bpmn" - }) - public void rainyDayNoVolumeGroupId() throws Exception { - - logStart(); - MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml"); - - System.out.println("Before starting process"); - - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST"); - variables.put("ConfirmVolumeGroupName_volumeGroupName", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - System.out.println("after setting variables"); - runtimeService.startProcessInstanceByKey("ConfirmVolumeGroupName", variables); - String response = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponse"); - String responseCode = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode"); - - assertEquals("404", responseCode); - System.out.println(response); - - logEnd(); - } - - /** - * Rainy day scenario - volume group name does not match the name in AAI - * - * - * @throws Exception - */ - @Test - @Deployment(resources = { - "subprocess/ConfirmVolumeGroupName.bpmn" - }) - public void rainyDayNameDoesNotMatch() throws Exception { - - logStart(); - MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml"); - - System.out.println("Before starting process"); - - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1"); - variables.put("ConfirmVolumeGroupName_volumeGroupName", "BAD_VOLUME_GROUP_NAME"); - System.out.println("after setting variables"); - runtimeService.startProcessInstanceByKey("ConfirmVolumeGroupName", variables); - String response = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponse"); - String responseCode = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode"); - - assertEquals("404", responseCode); - System.out.println(response); - - logEnd(); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java deleted file mode 100644 index 13c400e71e..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; - -/** - * Please describe the ConfirmVolumeGroupTenantTest.java class - * - */ -public class ConfirmVolumeGroupTenantTest extends WorkflowTest { - - @Test - @Deployment(resources = {"subprocess/ConfirmVolumeGroupTenant.bpmn"}) - public void testRemoveLayer3Service_success() throws Exception{ - MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume.xml"); - - Map variables = new HashMap<>(); - setVariables(variables); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "ConfirmVolumeGroupTenant", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String actualNameMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "groupNamesMatch"); - String actualIdMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "tenantIdsMatch"); - String actualResponse = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "volumeHeatStackId"); - - assertEquals("Response", "true", actualNameMatch); - assertEquals("Response", "true", actualIdMatch); - assertEquals("Response", "MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845", actualResponse); - } - - @Test - @Deployment(resources = {"subprocess/ConfirmVolumeGroupTenant.bpmn"}) - public void testRemoveLayer3Service_idsNotMatch() throws Exception{ - MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml"); - - Map variables = new HashMap<>(); - setVariables(variables); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "ConfirmVolumeGroupTenant", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String actualNameMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "groupNamesMatch"); - String actualIdMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "tenantIdsMatch"); - String actualResponse = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "WorkflowException"); - - assertEquals("Response", "true", actualNameMatch); - assertEquals("Response", "false", actualIdMatch); - assertEquals("Response", "WorkflowException[processKey=ConfirmVolumeGroupTenant,errorCode=1,errorMessage=Volume Group a8399879-31b3-4973-be26-0a0cbe776b58 does not belong to your tenant]", actualResponse); - - } - - private void setVariables(Map variables) { - variables.put("isDebugLogEnabled", "true"); - variables.put("volumeGroupId","a8399879-31b3-4973-be26-0a0cbe776b58"); - variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); - variables.put("aicCloudRegion", "MDTWNJ21"); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java deleted file mode 100644 index b2b7760327..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java +++ /dev/null @@ -1,277 +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.bpmn.common; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIGenericVnfSearch; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.core.WorkflowException; - -/** - * Unit test for CreateAAIVfModule.bpmn. - */ -public class CreateAAIVfModuleTest extends WorkflowTest { - - @Test - @Deployment(resources = { - "subprocess/CreateAAIVfModule.bpmn" - }) - public void TestCreateGenericVnfSuccess_200() { - - MockAAIGenericVnfSearch(); - MockAAICreateGenericVnf(); - MockAAIVfModulePUT(true); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("isVidRequest", "false"); - variables.put("vnfName", "STMTN5MMSC22"); - variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); - variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - variables.put("personaModelVersion", "1.0"); - variables.put("vfModuleName", "STMTN5MMSC22-MMSC::module-0-0"); - variables.put("vfModuleModelName", "MMSC::module-0"); - - runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); - String response = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode"); - String responseCode = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode"); - Assert.assertEquals("201", responseCode); - System.out.println(response); - } - - @Test - @Deployment(resources = { - "subprocess/CreateAAIVfModule.bpmn" - }) - public void TestCreateVfModuleSuccess_200() { - // create Add-on VF Module for existing Generic VNF - MockAAIGenericVnfSearch(); - MockAAICreateGenericVnf(); - MockAAIVfModulePUT(true); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("isVidRequest", "false"); - variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); - variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - variables.put("personaModelVersion", "1.0"); - variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-1-0"); - variables.put("vfModuleModelName", "STMTN5MMSC21-MMSC::model-1-0"); - runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); - String response = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode"); - String responseCode = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode"); - Assert.assertEquals("201", responseCode); - System.out.println(response); - } - - @Test - @Deployment(resources = { - "subprocess/CreateAAIVfModule.bpmn" - }) - public void TestQueryGenericVnfFailure_5000() { - MockAAIGenericVnfSearch(); - MockAAICreateGenericVnf(); - MockAAIVfModulePUT(true); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("isVidRequest", "false"); - variables.put("vnfName", "STMTN5MMSC23"); - variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); - variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - variables.put("personaModelVersion", "1.0"); - variables.put("vfModuleName", "STMTN5MMSC23-MMSC::module-0-0"); - variables.put("vfModuleModelName", "MMSC::module-0"); - runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); - WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); - Assert.assertEquals(500, exception.getErrorCode()); - Assert.assertEquals(true, exception.getErrorMessage().contains("Error occurred attempting to query AAI")); - System.out.println(exception.getErrorMessage()); - } - - @Test - @Deployment(resources = { - "subprocess/CreateAAIVfModule.bpmn" - }) - public void TestCreateDupGenericVnfFailure_1002() { - MockAAIGenericVnfSearch(); - MockAAICreateGenericVnf(); - MockAAIVfModulePUT(true); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("isVidRequest", "false"); - variables.put("vnfName", "STMTN5MMSC21"); - variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); - variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - variables.put("personaModelVersion", "1.0"); - variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0"); - variables.put("vfModuleModelName", "MMSC::module-0"); - runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); - WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); - Assert.assertEquals(1002, exception.getErrorCode()); - Assert.assertEquals(true, exception.getErrorMessage().contains("Invalid request for new Generic VNF which already exists")); - System.out.println(exception.getErrorMessage()); - } - - @Test - @Deployment(resources = { - "subprocess/CreateAAIVfModule.bpmn" - }) - public void TestCreateDupVfModuleFailure_1002() { - MockAAIGenericVnfSearch(); - MockAAICreateGenericVnf(); - MockAAIVfModulePUT(true); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("isVidRequest", "false"); - variables.put("vnfId", "2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4"); - variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); - variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - variables.put("personaModelVersion", "1.0"); - variables.put("vfModuleName", "STMTN5MMSC20-MMSC::module-1-0"); - variables.put("vfModuleModelName", "STMTN5MMSC20-MMSC::model-1-0"); - runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); - WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); - Assert.assertEquals(1002, exception.getErrorCode()); - Assert.assertEquals(true, exception.getErrorMessage().contains("already exists for Generic VNF")); - System.out.println(exception.getErrorMessage()); - } - - @Test - @Deployment(resources = { - "subprocess/CreateAAIVfModule.bpmn" - }) - public void TestCreateGenericVnfFailure_5000() { - MockAAIGenericVnfSearch(); - MockAAICreateGenericVnf(); - MockAAIVfModulePUT(true); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("isVidRequest", "false"); - variables.put("vnfName", "STMTN5MMSC22"); - variables.put("serviceId", "99999999-9999-9999-9999-999999999999"); - variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - variables.put("personaModelVersion", "1.0"); - variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0"); - variables.put("vfModuleModelName", "PCRF::module-0"); - runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); - WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); - Assert.assertEquals(5000, exception.getErrorCode()); - Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); - System.out.println(exception.getErrorMessage()); - } - - @Test - @Deployment(resources = { - "subprocess/CreateAAIVfModule.bpmn" - }) - public void TestCreateGenericVnfFailure_1002() { - MockAAIGenericVnfSearch(); - MockAAICreateGenericVnf(); - MockAAIVfModulePUT(true); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("isVidRequest", "false"); - variables.put("vnfId", "768073c7-f41f-4822-9323-b75962763d74"); - variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); - variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - variables.put("personaModelVersion", "1.0"); - variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0"); - variables.put("vfModuleModelName", "PCRF::module-0"); - runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); - WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); - Assert.assertEquals(1002, exception.getErrorCode()); - Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found")); - System.out.println(exception.getErrorMessage()); - } - - @Test - @Deployment(resources = { - "subprocess/CreateAAIVfModule.bpmn" - }) - public void TestCreateVfModuleFailure_5000() { - MockAAIGenericVnfSearch(); - MockAAICreateGenericVnf(); - MockAAIVfModulePUT(true); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("isVidRequest", "false"); - variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("serviceId", "99999999-9999-9999-9999-999999999999"); - variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - variables.put("personaModelVersion", "1.0"); - variables.put("vfModuleName", "STMTN5MMSC21-PCRF::module-1-0"); - variables.put("vfModuleModelName", "STMTN5MMSC21-PCRF::model-1-0"); - runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); - WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); - Assert.assertEquals(5000, exception.getErrorCode()); - Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); - System.out.println(exception.getErrorMessage()); - } - - public static void MockAAICreateGenericVnf(){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) - .withRequestBody(containing("00000000-0000-0000-0000-000000000000")) - .willReturn(aResponse() - .withStatus(201))); - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) - .withRequestBody(containing("99999999-9999-9999-9999-999999999999")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile("aaiFault.xml"))); - } - - // start of mocks used locally and by other VF Module unit tests - public static void MockAAIVfModulePUT(boolean isCreate){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*")) - .withRequestBody(containing("MMSC")) - .willReturn(aResponse() - .withStatus(isCreate ? 201 : 200))); - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*")) - .withRequestBody(containing("PCRF")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile("aaiFault.xml"))); - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721")) - .willReturn(aResponse() - .withStatus(200))); - } - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java deleted file mode 100644 index 5cc26459e8..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java +++ /dev/null @@ -1,136 +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.bpmn.common; - -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit tests for CreateAAIVfModuleVolumeGroup.bpmn. - */ -public class CreateAAIVfModuleVolumeGroupTest extends WorkflowTest { - - /** - * Test the happy path through the flow. - */ - @Test - @Deployment(resources = { - "subprocess/CreateAAIVfModuleVolumeGroup.bpmn" - }) - public void happyPath() throws IOException { - - logStart(); - - String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml"); - MockGetGenericVnfByIdWithPriority("skask", "lukewarm", 200, "VfModularity/VfModule-lukewarm.xml", 2); - MockPutVfModuleIdNoResponse("skask", "PCRF", "lukewarm"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "999-99-9999"); - variables.put("isDebugLogEnabled","true"); - variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest); - invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables); - - Assert.assertTrue(isProcessEnded(businessKey)); - String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse"); - Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode"); - System.out.println("Subflow response code: " + responseCode); - System.out.println("Subflow response: " + response); - Assert.assertEquals(200, responseCode.intValue()); - - logEnd(); - } - - /** - * Test the case where the GET to AAI returns a 404. - */ - @Test - @Deployment(resources = { - "subprocess/CreateAAIVfModuleVolumeGroup.bpmn" - }) - public void badGet() throws IOException { - - logStart(); - - String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml"); - MockGetVfModuleId("skask", ".*", "VfModularity/VfModule-supercool.xml", 404); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "999-99-9999"); - variables.put("isDebugLogEnabled","true"); - variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest); - invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables); - - Assert.assertTrue(isProcessEnded(businessKey)); - String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponse"); - Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponseCode"); - System.out.println("Subflow response code: " + responseCode); - System.out.println("Subflow response: " + response); - Assert.assertEquals(404, responseCode.intValue()); - - logEnd(); - } - - /** - * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404. - */ - @Test - @Deployment(resources = { - "subprocess/CreateAAIVfModuleVolumeGroup.bpmn" - }) - public void badPatch() throws IOException { - - logStart(); - - String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml"); - MockGetVfModuleId("skask", "lukewarm", "VfModularity/VfModule-lukewarm.xml", 200); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "999-99-9999"); - variables.put("isDebugLogEnabled","true"); - variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest); - invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables); - - Assert.assertTrue(isProcessEnded(businessKey)); - String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse"); - Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode"); - System.out.println("Subflow response code: " + responseCode); - System.out.println("Subflow response: " + response); - Assert.assertEquals(404, responseCode.intValue()); - - logEnd(); - } -} - diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DecomposeServiceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DecomposeServiceTest.java deleted file mode 100644 index 873e87cc49..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DecomposeServiceTest.java +++ /dev/null @@ -1,94 +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.bpmn.common; - -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; - -/** - * Unit Test for the DecomposeService Flow - * - */ -public class DecomposeServiceTest extends WorkflowTest { - - - public DecomposeServiceTest() throws IOException { - - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/DecomposeService.bpmn"}) - public void testDecomposeService_success() throws Exception{ - MockGetServiceResourcesCatalogData("cmw-123-456-789", "1.0", "/getCatalogServiceResourcesDataWithConfig.json"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff"); - invokeSubProcess("DecomposeService", businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - - } - - //@Test - @Deployment(resources = {"subprocess/BuildingBlock/DecomposeService.bpmn"}) - public void testDecomposeService_success_partial() throws Exception{ - MockGetServiceResourcesCatalogData("cmw-123-456-789", "/getCatalogServiceResourcesDataNoNetwork.json"); - - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff"); - invokeSubProcess("DecomposeService", businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - - } - - private void setVariablesSuccess(Map variables, String requestId, String siId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("mso-request-id", requestId); - variables.put("msoRequestId", requestId); - variables.put("serviceInstanceId",siId); - - String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," + - "\"modelInvariantUuid\": \"cmw-123-456-789\"," + - "\"modelVersionId\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"ServicevSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "}"; - variables.put("serviceModelInfo", serviceModelInfo); - - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java deleted file mode 100644 index 564927a854..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java +++ /dev/null @@ -1,643 +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.bpmn.common; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.core.WorkflowException; - -/** - * Unit test for DeleteAAIVfModule.bpmn. - */ -public class DeleteAAIVfModuleTest extends WorkflowTest { - private static final String EOL = "\n"; - - @Test - @Deployment(resources = { - "subprocess/DeleteAAIVfModule.bpmn" - }) - public void TestDeleteGenericVnfSuccess_200() { - // delete the Base Module and Generic Vnf - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73 - MockAAIGenericVnfSearch(); - MockAAIDeleteGenericVnf(); - MockAAIDeleteVfModule(); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("DeleteAAIVfModuleRequest"," DELETE_VF_MODULE PORTAL a27ce5a9-29c4-4c22-a017-6615ac73c721 STMTN5MMSC21 973ed047-d251-4fb9-bf1a-65b8949e0a73 STMTN5MMSC21-MMSC::module-0-0 "); - runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); - String response = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode"); - String responseCode = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode"); - Assert.assertEquals("200", responseCode); - System.out.println(response); - } - - @Test - @Deployment(resources = { - "subprocess/DeleteAAIVfModule.bpmn" - }) - public void TestDeleteVfModuleSuccess_200() { - // delete Add-on Vf Module for existing Generic Vnf - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a75 - String request = - "" + EOL + - " " + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c720" + EOL + - " STMTN5MMSC20" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL + - " STMTN5MMSC20-MMSC::module-1-0" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - - MockAAIGenericVnfSearch(); - MockAAIDeleteGenericVnf(); - MockAAIDeleteVfModule(); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("DeleteAAIVfModuleRequest",request); - runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); - String response = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode"); - String responseCode = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode"); - Assert.assertEquals("200", responseCode); - System.out.println(response); - } - - @Test - @Deployment(resources = { - "subprocess/DeleteAAIVfModule.bpmn" - }) - public void TestQueryGenericVnfFailure_5000() { - // query Generic Vnf failure (non-404) with A&AI - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c723, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a71 - String request = - "" + EOL + - " " + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c723" + EOL + - " STMTN5MMSC23" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a71" + EOL + - " STMTN5MMSC20-MMSC::module-1-0" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - MockAAIGenericVnfSearch(); - MockAAIDeleteGenericVnf(); - MockAAIDeleteVfModule(); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("DeleteAAIVfModuleRequest",request); - runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); - WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); - Assert.assertEquals(5000, exception.getErrorCode()); - Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); - System.out.println(exception.getErrorMessage()); - } - - @Test - @Deployment(resources = { - "subprocess/DeleteAAIVfModule.bpmn" - }) - public void TestQueryGenericVnfFailure_1002() { - // attempt to delete Vf Module for Generic Vnf that does not exist (A&AI returns 404) - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c722, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a72 - String request = - "" + EOL + - " " + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c722" + EOL + - " STMTN5MMSC22" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a72" + EOL + - " STMTN5MMSC22-MMSC::module-1-0" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - MockAAIGenericVnfSearch(); - MockAAIDeleteGenericVnf(); - MockAAIDeleteVfModule(); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("DeleteAAIVfModuleRequest",request); - runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); - WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); - Assert.assertEquals(1002, exception.getErrorCode()); - Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found")); - System.out.println(exception.getErrorMessage()); - } - - @Test - @Deployment(resources = { - "subprocess/DeleteAAIVfModule.bpmn" - }) - public void TestDeleteGenericVnfFailure_5000() { - // A&AI failure (non-200) when attempting to delete a Generic Vnf - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c718, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a78 - String request = - "" + EOL + - " " + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c718" + EOL + - " STMTN5MMSC18" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL + - " STMTN5MMSC18-MMSC::module-0-0" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - MockAAIGenericVnfSearch(); - MockAAIDeleteGenericVnf(); - MockAAIDeleteVfModule(); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("DeleteAAIVfModuleRequest",request); - runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); - WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); - Assert.assertEquals(5000, exception.getErrorCode()); - Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); - System.out.println(exception.getErrorMessage()); - } - - @Test - @Deployment(resources = { - "subprocess/DeleteAAIVfModule.bpmn" - }) - public void TestDeleteVfModuleFailure_5000() { - // A&AI failure (non-200) when attempting to delete a Vf Module - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c719, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a77 - String request = - "" + EOL + - " " + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c719" + EOL + - " STMTN5MMSC19" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL + - " STMTN5MMSC19-MMSC::module-1-0" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - MockAAIGenericVnfSearch(); - MockAAIDeleteGenericVnf(); - MockAAIDeleteVfModule(); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("DeleteAAIVfModuleRequest",request); - runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); - WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); - Assert.assertEquals(5000, exception.getErrorCode()); - Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); - System.out.println(exception.getErrorMessage()); - } - - @Test - @Deployment(resources = { - "subprocess/DeleteAAIVfModule.bpmn" - }) - public void TestDeleteVfModuleFailure_1002_1() { - // failure attempting to delete Base Module when not the last Vf Module - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a74 - String request = - "" + EOL + - " " + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c720" + EOL + - " STMTN5MMSC20" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + - " STMTN5MMSC20-MMSC::module-0-0" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - MockAAIGenericVnfSearch(); - MockAAIDeleteGenericVnf(); - MockAAIDeleteVfModule(); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("DeleteAAIVfModuleRequest",request); - runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); - WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); - Assert.assertEquals(1002, exception.getErrorCode()); - Assert.assertEquals(true, exception.getErrorMessage().contains("is Base Module, not Last Module")); - System.out.println(exception.getErrorMessage()); - } - - @Test - @Deployment(resources = { - "subprocess/DeleteAAIVfModule.bpmn" - }) - public void TestDeleteVfModuleFailure_1002_2() { - // failure attempting to delete a Vf Module that does not exist (A&AI returns 404) - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a76 - MockAAIGenericVnfSearch(); - MockAAIDeleteGenericVnf(); - MockAAIDeleteVfModule(); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("DeleteAAIVfModuleRequest"," DELETE_VF_MODULE PORTAL a27ce5a9-29c4-4c22-a017-6615ac73c720 STMTN5MMSC20 973ed047-d251-4fb9-bf1a-65b8949e0a76 STMTN5MMSC20-MMSC::module-2-0 "); - runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); - WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); - Assert.assertEquals(1002, exception.getErrorCode()); - Assert.assertEquals(true, exception.getErrorMessage().contains("does not exist for Generic Vnf Id")); - System.out.println(exception.getErrorMessage()); - } - - // Start of VF Modularization A&AI mocks - - public static void MockAAIGenericVnfSearch(){ - String body; - - // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule - - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile("aaiFault.xml"))); - - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1")) - .willReturn(aResponse() - .withStatus(404) - .withHeader("Content-Type", "text/xml") - .withBody("Generic VNF Not Found"))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1")) - .willReturn(aResponse() - .withStatus(404) - .withHeader("Content-Type", "text/xml") - .withBody("Generic VNF Not Found"))); - - body = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " mmsc-capacity" + EOL + - " SDN-MOBILITY" + EOL + - " vMMSC" + EOL + - " pending-create" + EOL + - " false" + EOL + - " false" + EOL + - " 1508691" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " 1.0" + EOL + - " true" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 1508692" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - - body = - "" + EOL + - " 2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4" + EOL + - " STMTN5MMSC20" + EOL + - " mmsc-capacity" + EOL + - " SDN-MOBILITY" + EOL + - " vMMSC" + EOL + - " pending-create" + EOL + - " false" + EOL + - " false" + EOL + - " 1508691" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC20-MMSC::module-0-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " 1.0" + EOL + - " true" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 1508692" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + - " STMTN5MMSC20-MMSC::module-1-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + - " 1.0" + EOL + - " false" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 1508692" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - - // The following stubs are for DeleteAAIVfModule - - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile("aaiFault.xml"))); - - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1")) - .willReturn(aResponse() - .withStatus(404) - .withHeader("Content-Type", "text/xml") - .withBody("Generic VNF Not Found"))); - - body = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " mmsc-capacity" + EOL + - " SDN-MOBILITY" + EOL + - " vMMSC" + EOL + - " pending-create" + EOL + - " false" + EOL + - " false" + EOL + - " 0000021" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " 1.0" + EOL + - " true" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 0000073" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - - body = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c720" + EOL + - " STMTN5MMSC20" + EOL + - " mmsc-capacity" + EOL + - " SDN-MOBILITY" + EOL + - " vMMSC" + EOL + - " pending-create" + EOL + - " false" + EOL + - " false" + EOL + - " 0000020" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + - " STMTN5MMSC20-MMSC::module-0-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + - " 1.0" + EOL + - " true" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 0000074" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL + - " STMTN5MMSC20-MMSC::module-1-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL + - " 1.0" + EOL + - " false" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 0000075" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - - body = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c719" + EOL + - " STMTN5MMSC19" + EOL + - " mmsc-capacity" + EOL + - " SDN-MOBILITY" + EOL + - " vMMSC" + EOL + - " pending-create" + EOL + - " false" + EOL + - " false" + EOL + - " 0000019" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a76" + EOL + - " STMTN5MMSC19-MMSC::module-0-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a76" + EOL + - " 1.0" + EOL + - " true" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 0000076" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL + - " STMTN5MMSC19-MMSC::module-1-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL + - " 1.0" + EOL + - " false" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 0000077" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - - body = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c718" + EOL + - " STMTN5MMSC18" + EOL + - " mmsc-capacity" + EOL + - " SDN-MOBILITY" + EOL + - " vMMSC" + EOL + - " pending-create" + EOL + - " false" + EOL + - " false" + EOL + - " 0000018" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL + - " STMTN5MMSC18-MMSC::module-0-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL + - " 1.0" + EOL + - " true" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 0000078" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - - body = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " mmsc-capacity" + EOL + - " SDN-MOBILITY" + EOL + - " vMMSC" + EOL + - " pending-create" + EOL + - " false" + EOL + - " false" + EOL + - " 0000021" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " 1.0" + EOL + - " true" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 0000073" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - } - public static void MockAAIDeleteGenericVnf(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021")) - .willReturn(aResponse() - .withStatus(200))); - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile("aaiFault.xml"))); - } - - public static void MockAAIDeleteVfModule(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073")) - .willReturn(aResponse() - .withStatus(200))); - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075")) - .willReturn(aResponse() - .withStatus(200))); - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078")) - .willReturn(aResponse() - .withStatus(200))); - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile("aaiFault.xml"))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml"))); - - stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*")) - .willReturn(aResponse() - .withStatus(200))); - } -} - diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java deleted file mode 100644 index c3259a0de5..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java +++ /dev/null @@ -1,235 +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.bpmn.common; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; - -/** - * Unit test for FalloutHandler.bpmn. - */ -public class FalloutHandlerTest extends WorkflowTest { - private void setupMocks() { - stubFor(post(urlEqualTo("/dbadapters/MsoRequestsDbAdapter")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody("Notified"))); - stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody("Notified"))); - } - - private void executeFlow(String inputRequestFile) throws InterruptedException { - String method = getClass().getSimpleName() + "." + new Object() { - }.getClass().getEnclosingMethod().getName(); - System.out.println("STARTED TEST: " + method); - - //String changeFeatureActivateRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/ChangeFeatureActivateV1/" + inputRequestFile); - Map variables = new HashMap<>(); - variables.put("FalloutHandlerRequest",inputRequestFile); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "FalloutHandler", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - System.out.println("ENDED TEST: " + method); - } - - @Test - @Deployment(resources = {"subprocess/FalloutHandler.bpmn", - "subprocess/GenericNotificationService.bpmn" - }) - public void msoFalloutHandlerWithNotificationurl_200() throws Exception{ - String method = getClass().getSimpleName() + "." + new Object() { - }.getClass().getEnclosingMethod().getName(); - System.out.println("STARTED TEST: " + method); - - //Setup Mocks - setupMocks(); - //Execute Flow - executeFlow(gMsoFalloutHandlerWithNotificationurl()); - //Verify Error - String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode"); - Assert.assertEquals("200", FH_ResponseCode); - Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator")); - } - - public String gMsoFalloutHandlerWithNotificationurl() { - //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS - String xml = "" - + "" - + " " - + " uCPE1020_STUW105_5002" - + " Layer3ServiceActivateRequest" - + " CANCEL" - + " OMX" - + " http://localhost:28090/CCD/StatusNotification" - + " 10205000" - + " 1" - + " " - + " " - + " Some Error Message - Fallout Handler" - + " Some Error Code - Fallout Handler" - + " Some Source System Error Code- Fallout Handler" - + " " - + ""; - - return xml; - - } - - - - - @Test - @Deployment(resources = {"subprocess/FalloutHandler.bpmn"}) - public void msoFalloutHandlerWithNoNotificationurl() throws Exception{ - String method = getClass().getSimpleName() + "." + new Object() { - }.getClass().getEnclosingMethod().getName(); - System.out.println("STARTED TEST: " + method); - //Setup Mocks - setupMocks(); - //Execute Flow - executeFlow(gMsoFalloutHandlerWithNoNotificationurl()); - //Verify Error - String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode"); - Assert.assertEquals("200", FH_ResponseCode); - Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator")); - } - - public String gMsoFalloutHandlerWithNoNotificationurl() { - //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS - String xml = "" - + "" - + " " - + " uCPE1020_STUW105_5002" - + " Layer3ServiceActivateRequest" - + " CANCEL" - + " OMX" - + " " - + " 10205000" - + " 1" - + " " - + " " - + " Some Error Message - Fallout Handler" - + " Some Error Code - Fallout Handler" - + " Some Source System Error Code- Fallout Handler" - + " " - + ""; - - return xml; - } - - @Test - @Deployment(resources = {"subprocess/FalloutHandler.bpmn", - "subprocess/GenericNotificationService.bpmn" - }) - public void msoFalloutHandlerWithNotificationurlNoRequestId() throws Exception{ - String method = getClass().getSimpleName() + "." + new Object() { - }.getClass().getEnclosingMethod().getName(); - System.out.println("STARTED TEST: " + method); - //Setup Mocks - setupMocks(); - //Execute Flow - executeFlow(gMsoFalloutHandlerWithNotificationurlNoRequestId()); - //Verify Error - String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode"); - Assert.assertEquals("200", FH_ResponseCode); - Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator")); - } - - public String gMsoFalloutHandlerWithNotificationurlNoRequestId() { - //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS - String xml = "" - + "" - + " " - + " " - + " Layer3ServiceActivateRequest" - + " CANCEL" - + " OMX" - + " www.test.com" - + " 10205000" - + " 1" - + " " - + " " - + " Some Error Message - Fallout Handler" - + " Some Error Code - Fallout Handler" - + " Some Source System Error Code- Fallout Handler" - + " " - + ""; - - return xml; - } - - @Test - @Deployment(resources = {"subprocess/FalloutHandler.bpmn"}) - public void msoFalloutHandlerWithNoNotificationurlNoRequestId() throws Exception{ - String method = getClass().getSimpleName() + "." + new Object() { - }.getClass().getEnclosingMethod().getName(); - System.out.println("STARTED TEST: " + method); - //Setup Mocks - setupMocks(); - //Execute Flow - executeFlow(gMsoFalloutHandlerWithNoNotificationurlNoRequestId()); - //Verify Error - String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode"); - Assert.assertEquals("200", FH_ResponseCode); - Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator")); - } - - public String gMsoFalloutHandlerWithNoNotificationurlNoRequestId() { - //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS - String xml = "" - + "" - + " " - + " " - + " Layer3ServiceActivateRequest" - + " CANCEL" - + " OMX" - + " " - + " 10205000" - + " 1" - + " " - + " " - + " Some Error Message - Fallout Handler" - + " Some Error Code - Fallout Handler" - + " Some Source System Error Code- Fallout Handler" - + " " - + ""; - - return xml; - } - -} - diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenerateVfModuleNameTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenerateVfModuleNameTest.java deleted file mode 100644 index 051d935527..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenerateVfModuleNameTest.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.bpmn.common; - -import static org.junit.Assert.assertNotNull; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; - -/** - * Unit test for GenerateVfModuleName.bpmn. - */ -public class GenerateVfModuleNameTest extends WorkflowTest { - private static final String EOL = "\n"; - - @Test - @Deployment(resources = { - "subprocess/GenerateVfModuleName.bpmn" - }) - public void TestGenerateVfModuleNameSuvvess() { - // - String request = - "" + EOL + - " " + EOL + - " CREATE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " STMTN5MMSC22" + EOL + - " STMTN5MMSC22-MMSC::module-0-0" + EOL + - " MMSC::module-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " 1.0" + EOL + - " 00000000-0000-0000-0000-000000000000" + EOL + - " MDTWNJ21" + EOL + - " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - - MockGetGenericVnfById(".*", "GenericFlows/getGenericVnfByNameResponse.xml"); - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap(); - variables.put("isDebugLogEnabled","true"); - variables.put("vnfName", "STMTN5MMSC20"); - variables.put("vfModuleLabel", "ModuleLabel1"); - variables.put("personaModelId", "extrovert"); - variables.put("vnfId", "12345678-f41f-4822-9323-b75962763d74"); - - runtimeService.startProcessInstanceByKey("GenerateVfModuleName", variables); - String response = BPMNUtil.getVariable(processEngineRule, "GenerateVfModuleName", "vfModuleName"); - - assertNotNull(response); - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java deleted file mode 100644 index 67ac34c1d0..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteServiceInstance_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceSubscription; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; - - - -/** - * Please describe the GenericDeleteServiceTest.java class - * - */ -public class GenericDeleteServiceTest extends WorkflowTest { - @Test - @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) - public void testGenericDeleteService_success_serviceInstance() throws Exception{ - MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "1234"); - Map variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234"); - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); - String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); - String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); - assertEquals("true", foundIndicator); - assertEquals("true", successIndicator); - assertEquals("true", resourceVersionProvidedFlag); - assertEquals(null, workflowException); - } - @Test - @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) - public void testGenericDeleteService_success_serviceSubscription() throws Exception{ - - MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", 204); - - Map variables = new HashMap<>(); - setVariablesSubscription(variables, "", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); - String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); - String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); - - assertEquals("true", foundIndicator); - assertEquals("true", successIndicator); - assertEquals("true", resourceVersionProvidedFlag); - assertEquals(null, workflowException); - - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) - public void testGenericDeleteService_success_instanceNoResourceVersion() throws Exception { - MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceSubscription.xml"); - MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "1234"); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); - String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); - String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); - - assertEquals("true", foundIndicator); - assertEquals("true", successIndicator); - assertEquals("false", resourceVersionProvidedFlag); - assertEquals(null, workflowException); - - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) - public void testGenericDeleteService_success_subscriptionNoResourceVersion() throws Exception{ - MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", "GenericFlows/getServiceSubscription.xml"); - MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", 204); - - Map variables = new HashMap<>(); - setVariablesSubscription(variables, null, "1604-MVM-26", "SDN-ETHERNET-INTERNET", null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); - String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); - String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); - - assertEquals("true", foundIndicator); - assertEquals("true", successIndicator); - assertEquals("false", resourceVersionProvidedFlag); - assertEquals(null, workflowException); - - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) - public void testGenericDeleteService_success_get404Response() throws Exception{ - - MockGetServiceInstance_404("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET"); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); - String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); - String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); - - assertEquals("false", foundIndicator); - assertEquals("true", successIndicator); - assertEquals("false", resourceVersionProvidedFlag); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) - public void testGenericDeleteService_success_subscriptionGetEmpty200() throws Exception{ - MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", 200); - - Map variables = new HashMap<>(); - setVariablesSubscription(variables, "", "1604-MVM-26", "SDN-ETHERNET-INTERNET", ""); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); - String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); - String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); - - assertEquals("false", foundIndicator); - assertEquals("true", successIndicator); - assertEquals("false", resourceVersionProvidedFlag); - assertEquals(null, workflowException); - - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) - public void testGenericDeleteService_success_delete404Response() throws Exception{ - - MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "GENDSI_getServiceInstanceResponse.xml"); - MockDeleteServiceInstance_404("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "1234"); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); - String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); - String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); - - assertEquals("false", foundIndicator); - assertEquals("true", successIndicator); - assertEquals("true", resourceVersionProvidedFlag); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) - public void testGenericDeleteService_error_invalidVariables() throws Exception{ - - Map variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "1234"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); - String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); - String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); - - String expectedResponse = "WorkflowException[processKey=GenericDeleteService,errorCode=500,errorMessage=Incoming Required Variable is Missing or Null!]"; - - assertEquals("false", foundIndicator); - assertEquals("false", successIndicator); - assertEquals("true", resourceVersionProvidedFlag); - assertEquals(expectedResponse, workflowException); - - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) - public void testGenericDeleteService_error_getBadAAIResponse() throws Exception{ - - MockGetServiceInstance_500("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "aaiFault.xml"); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); - String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); - String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); - - String expectedResponse = "WorkflowException[processKey=GenericDeleteService,errorCode=500,errorMessage=SVC3002Error writing output performing %1 on %2 (msg=%3) (ec=%4)PUTcustomerSubName01Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id]ERR.5.4.5105" + "\n" + - "]"; - - assertEquals("false", foundIndicator); - assertEquals("false", successIndicator); - assertEquals("false", resourceVersionProvidedFlag); - assertEquals(expectedResponse, workflowException); - } - - - private void setVariablesInstance(Map variables, String siId, String globalCustId, String serviceType, String reVersion) { - variables.put("isDebugLogEnabled", "true"); - variables.put("GENDS_serviceInstanceId", siId); - variables.put("GENDS_globalCustomerId",globalCustId); - variables.put("GENDS_serviceType", serviceType); - variables.put("GENDS_resourceVersion", reVersion); - variables.put("GENDS_type", "service-instance"); - } - - private void setVariablesSubscription(Map variables, String siId, String globalCustId, String serviceType, String reVersion) { - variables.put("isDebugLogEnabled", "true"); - variables.put("GENDS_serviceInstanceId", siId); - variables.put("GENDS_globalCustomerId",globalCustId); - variables.put("GENDS_serviceType", serviceType); - variables.put("GENDS_resourceVersion", reVersion); - variables.put("GENDS_type", "service-subscription"); - } - - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java deleted file mode 100644 index a318be5b10..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf_500; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteVce; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVceById; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; - -/** - * Please describe the GenericDeleteVnfTest.java class - * - */ -public class GenericDeleteVnfTest extends WorkflowTest { - - @Test - @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) - public void testGenericDeleteVnf_success_genericVnf() throws Exception{ - MockDeleteGenericVnf("testVnfId123", "testReVer123"); - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables("true", "true", "true", null); - - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) - public void testGenericDeleteVnf_success_vce() throws Exception{ - MockDeleteVce("testVnfId123", "testReVer123", 204); - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "vce", "testReVer123"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables("true", "true", "true", null); - - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) - public void testGenericDeleteVnf_success_genericVnfNoResourceVersion() throws Exception{ - - MockGetGenericVnfById("/testVnfId123", "GenericFlows/getGenericVnfByNameResponse.xml", 200); - MockDeleteGenericVnf("testVnfId123", "testReVer123"); - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "generic-vnf", ""); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables("true", "true", "false", null); - - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) - public void testGenericDeleteVnf_success_vceNoResourceVersion() throws Exception{ - MockDeleteVce("testVnfId123", "testReVer123", 204); - MockGetVceById("testVnfId123", "GenericFlows/getVceResponse.xml"); - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "vce", null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables("true", "true", "false", null); - - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) - public void testGenericDeleteVnf_success_genericVnf404() throws Exception{ - MockDeleteGenericVnf("testVnfId123", "testReVer123", 404); - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables("true", "false", "true", null); - - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) - public void testGenericDeleteVnf_success_vce404() throws Exception{ - MockDeleteVce("testVnfId123", "testReVer123", 404); - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "vce", "testReVer123"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables("true", "false", "true", null); - - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) - public void testGenericDeleteVnf_success_genericVnfNoResourceVersion404() throws Exception{ - MockGetGenericVnfById_404("testVnfId123"); - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "generic-vnf", ""); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables("true", "false", "false", null); - - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) - public void testGenericDeleteVnf_error_missingVariables() throws Exception{ - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "", "testReVer123"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=500,errorMessage=Incoming Required Variable is Missing or Null!]"); - - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) - public void testGenericDeleteVnf_error_genericVnf500() throws Exception{ - - MockDeleteGenericVnf_500("testVnfId123", "testReVer123"); - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=500,errorMessage=Received a bad response from AAI]"); - - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) - public void testGenericDeleteVnf_error_genericVnf412() throws Exception{ - MockDeleteGenericVnf("testVnfId123", "testReVer123", 412); - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=412,errorMessage=Delete Vnf Received a resource-version Mismatch Error Response from AAI]"); - - } - - private void assertVariables(String exSuccessIndicator, String exFound, String exRVProvided, String exWorkflowException) { - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "GENDV_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "GENDV_FoundIndicator"); - String rvProvided = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "GENDV_resourceVersionProvided"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "WorkflowException"); - - assertEquals(exSuccessIndicator, successIndicator); - assertEquals(exFound, found); - assertEquals(exRVProvided, rvProvided); - assertEquals(exWorkflowException, workflowException); - } - - private void setVariables(Map variables, String vnfId, String type, String resourceVer) { - variables.put("isDebugLogEnabled", "true"); - variables.put("GENDV_vnfId", vnfId); - variables.put("GENDV_type", type); - variables.put("GENDV_resourceVersion", resourceVer); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java deleted file mode 100644 index 6da6924d11..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java +++ /dev/null @@ -1,560 +0,0 @@ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceSubscription; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_500; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_500; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; - - -/** - * Unit Test for the GenericGetService Sub Flow - */ -public class GenericGetServiceTest extends WorkflowTest { - - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_success_serviceInstance() throws Exception{ - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - Map variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789"); - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); - String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - assertEquals("true", successIndicator); - assertEquals("true", found); - assertEquals("false", obtainUrl); - assertEquals("false", byName); - assertNotNull(response); - assertEquals(null, workflowException); - } - - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_success_serviceSubscription() throws Exception{ - - MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", "GenericFlows/getServiceSubscription.xml"); - - Map variables = new HashMap<>(); - setVariablesSubscription(variables, "", null , "1604-MVM-26", "SDN-ETHERNET-INTERNET"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); - String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - - assertEquals("true", successIndicator); - assertEquals("true", found); - assertEquals("false", obtainUrl); - assertEquals("false", byName); - assertNotNull(response); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_success_serviceInstance_byName() throws Exception{ - - MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByName.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, null, "1604-MVM-26", null, null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); - String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); - - assertEquals("true", successIndicator); - assertEquals("true", found); - assertEquals("true", obtainUrl); - assertEquals("true", byName); - assertNotNull(response); - assertEquals("200", siUrlResponseCode); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_success_serviceInstance_byId() throws Exception{ - - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); - String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_genericQueryResponseCode"); - - assertEquals("true", successIndicator); - assertEquals("true", found); - assertEquals("true", obtainUrl); - assertEquals("false", byName); - assertNotNull(response); - assertEquals("200", siUrlResponseCode); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_success_serviceInstance_404Response() throws Exception{ - - MockGetServiceInstance_404("SDN-ETHERNET-INTERNET", "123456789", "MIS%2F1604%2F0026%2FSW_INTERNET"); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - - assertEquals("true", successIndicator); - assertEquals("false", found); - assertEquals("false", obtainUrl); - assertEquals("false", byName); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_success_serviceSubscription404() throws Exception{ - MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", 404); - - Map variables = new HashMap<>(); - setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", "1604-MVM-26"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); - String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - - assertEquals("true", successIndicator); - assertEquals("false", found); - assertEquals("false", obtainUrl); - assertEquals("false", byName); - assertNotNull(response); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_success_serviceInstanceByName404() throws Exception{ - - MockNodeQueryServiceInstanceByName_404("1604-MVM-26"); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, "", "1604-MVM-26", null, null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); - - assertEquals("true", successIndicator); - assertEquals("false", found); - assertEquals("true", obtainUrl); - assertEquals("true", byName); - assertEquals("404", siUrlResponseCode); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_success_serviceInstanceById404() throws Exception{ - - MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET"); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_genericQueryResponseCode"); - - assertEquals("true", successIndicator); - assertEquals("false", found); - assertEquals("true", obtainUrl); - assertEquals("false", byName); - assertEquals("404", siUrlResponseCode); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_success_serviceInstanceEmptyResponse() throws Exception{ - - MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", " "); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - - assertEquals("true", successIndicator); - assertEquals("false", found); - assertEquals("false", obtainUrl); - assertEquals("false", byName); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_success_serviceInstanceByNameEmpty() throws Exception{ - MockNodeQueryServiceInstanceByName("1604-MVM-26", ""); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, "", "1604-MVM-26", null, null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); - - assertEquals("true", successIndicator); - assertEquals("false", found); - assertEquals("true", obtainUrl); - assertEquals("true", byName); - assertEquals("200", siUrlResponseCode); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_success_serviceInstanceByIdEmpty() throws Exception{ - - MockNodeQueryServiceInstanceById("MIS[%]2F1604[%]2F0026[%]2FSW_INTERNET", ""); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_genericQueryResponseCode"); - - assertEquals("true", successIndicator); - assertEquals("false", found); - assertEquals("true", obtainUrl); - assertEquals("false", byName); - assertEquals("200", siUrlResponseCode); - assertEquals(null, workflowException); - } - - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_error_serviceInstanceInvalidVariables() throws Exception{ - - Map variables = new HashMap<>(); - setVariablesInstance(variables, null, null, "SDN-ETHERNET-INTERNET", null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); - - String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.]"; - - assertEquals("false", successIndicator); - assertEquals("false", found); - assertEquals("false", obtainUrl); - assertEquals("false", byName); - assertEquals(expectedWorkflowException, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_success_serviceSubscriptionInvalidVariables() throws Exception{ - - Map variables = new HashMap<>(); - setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - - String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.]"; - - - assertEquals("false", successIndicator); - assertEquals("false", found); - assertEquals("false", obtainUrl); - assertEquals("false", byName); - assertEquals(expectedWorkflowException, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_error_serviceInstance_getSIBadResponse() throws Exception{ - - MockGetServiceInstance_500("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET"); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "123456789"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); - - String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]"; - - assertEquals("false", successIndicator); - assertEquals("false", found); - assertEquals("false", obtainUrl); - assertEquals("false", byName); - assertEquals(expectedWorkflowException, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_error_serviceInstance_getUrlByIdBadResponse() throws Exception{ - - MockNodeQueryServiceInstanceById_500("MIS%2F1604%2F0026%2FSW_INTERNET"); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); - String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_genericQueryResponseCode"); - - String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]"; - - assertEquals("false", successIndicator); - assertEquals("false", found); - assertEquals("true", obtainUrl); - assertEquals("false", byName); - assertEquals("500", siUrlResponseCode); - assertEquals(expectedWorkflowException, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_error_serviceInstance_getUrlByNameBadResponse() throws Exception{ - - MockNodeQueryServiceInstanceByName_500("1604-MVM-26"); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, null, "1604-MVM-26", null, null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); - String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); - - String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]"; - - assertEquals("false", successIndicator); - assertEquals("false", found); - assertEquals("true", obtainUrl); - assertEquals("true", byName); - assertEquals("500", siUrlResponseCode); - assertEquals(expectedWorkflowException, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_success_serviceInstance_byNameServicePresent() throws Exception{ - - MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml"); - MockGetServiceInstance("XyCorporation", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, null, "1604-MVM-26", "XyCorporation", null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String resourceLink = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_resourceLink"); - String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); - - assertEquals("true", successIndicator); - assertEquals("true", found); - assertNotNull(resourceLink); - assertNotNull(response); - assertEquals("200", siUrlResponseCode); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) - public void testGenericGetService_success_serviceInstance_byNameServiceNotPresent() throws Exception{ - - MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml"); - MockGetServiceInstance("CorporationNotPresent", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - - Map variables = new HashMap<>(); - setVariablesInstance(variables, null, "1604-MVM-26", "CorporationNotPresent", null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); - String resourceLink = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_resourceLink"); - String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); - String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); - - assertEquals("true", successIndicator); - assertEquals("false", found); - assertEquals(null, resourceLink); - assertEquals(" ", response); - assertEquals("200", siUrlResponseCode); - assertEquals(null, workflowException); - } - - private void setVariablesInstance(Map variables, String siId, String siName, String globalCustId, String serviceType) { - variables.put("isDebugLogEnabled", "true"); - variables.put("GENGS_serviceInstanceId", siId); - variables.put("GENGS_serviceInstanceName", siName); - variables.put("GENGS_globalCustomerId",globalCustId); - variables.put("GENGS_serviceType", serviceType); - variables.put("GENGS_type", "service-instance"); - } - - private void setVariablesSubscription(Map variables, String siId, String siName, String globalCustId, String serviceType) { - variables.put("isDebugLogEnabled", "true"); - variables.put("GENGS_serviceInstanceId", siId); - variables.put("GENGS_serviceInstanceName", siName); - variables.put("GENGS_globalCustomerId",globalCustId); - variables.put("GENGS_serviceType", serviceType); - variables.put("GENGS_type", "service-subscription"); - } - - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java deleted file mode 100644 index 7de493a621..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_500; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByNameWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVceByNameWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVceById; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; - -/** - * Please describe the GenericGetVnfTest.java class - * - */ -public class GenericGetVnfTest extends WorkflowTest { - - @Test - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"}) - public void testGenericGetVnf_success_genericVnf() throws Exception{ - MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfByNameResponse.xml"); - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "testVnfName123", "generic-vnf"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); - String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName"); - String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException"); - - assertEquals("true", successIndicator); - assertEquals("true", found); - assertEquals("false", byName); - assertNotNull(response); - assertNotNull(vnf); - assertEquals(null, workflowException); - - } - - @Test - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"}) - public void testGenericGetVnf_success_vce() throws Exception{ - MockGetVceById("testVnfId123[?]depth=1", "GenericFlows/getVceResponse.xml"); - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "testVnfName123", "vce"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); - String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName"); - String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException"); - - assertEquals("true", successIndicator); - assertEquals("true", found); - assertEquals("false", byName); - assertNotNull(response); - assertNotNull(vnf); - assertEquals(null, workflowException); - - } - - @Test - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"}) - public void testGenericGetVnf_success_genericVnfByName() throws Exception{ - MockGetGenericVnfByNameWithDepth("testVnfName123", 1, "GenericFlows/getGenericVnfResponse.xml"); - - Map variables = new HashMap<>(); - setVariables(variables, "", "testVnfName123", "generic-vnf"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); - String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName"); - String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException"); - - assertEquals("true", successIndicator); - assertEquals("true", found); - assertEquals("true", byName); - assertNotNull(response); - assertNotNull(vnf); - assertEquals(null, workflowException); - - } - - @Test - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"}) - public void testGenericGetVnf_success_vceByName() throws Exception{ - MockGetGenericVceByNameWithDepth("testVnfName123", 1, "GenericFlows/getVceByNameResponse.xml"); - - Map variables = new HashMap<>(); - setVariables(variables, null, "testVnfName123", "vce"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); - String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName"); - String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException"); - - assertEquals("true", successIndicator); - assertEquals("true", found); - assertEquals("true", byName); - assertNotNull(response); - assertNotNull(vnf); - assertEquals(null, workflowException); - - } - - @Test - @Ignore // BROKEN TEST (previously ignored) - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"}) - public void testGenericGetVnf_error_genericVnf500() throws Exception{ - - MockGetGenericVnfById_500("testVnfId123"); - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "testVnfName123", "generic-vnf"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); - String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException"); - String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName"); - - String expectedWorkflowException = "WorkflowException[processKey=GenericGetVnf,errorCode=500,errorMessage=Incoming VnfId and VnfName are null. VnfId or VnfName is required!]"; - - assertEquals("false", successIndicator); - assertEquals("false", found); - assertEquals("false", byName); - - assertEquals(expectedWorkflowException, workflowException); - } - - private void setVariables(Map variables, String vnfId, String vnfName, String type) { - variables.put("isDebugLogEnabled", "true"); - variables.put("GENGV_vnfId", vnfId); - variables.put("GENGV_vnfName",vnfName); - variables.put("GENGV_type", type); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java deleted file mode 100644 index 7c003c986a..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVce; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; - -/** - * Please describe the GenericPutVnf.java class - * - */ -public class GenericPutVnfTest extends WorkflowTest { - - private String genericVnfPayload = "testId"; - private String vcePayload = "testId"; - - @Test - @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) - public void testGenericPutVnf_success_genericVnf() throws Exception{ - - MockPutGenericVnf("testVnfId123"); - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); - - assertEquals("true", successIndicator); - assertEquals(null, workflowException); - - } - - @Test - @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) - public void testGenericPutVnf_success_vce() throws Exception{ - - MockPutVce("testVnfId123"); - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", vcePayload, "vce"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); - - assertEquals("true", successIndicator); - assertEquals(null, workflowException); - - } - - @Test - @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) - public void testGenericPutVnf_error_missingType() throws Exception{ - - MockPutGenericVnf("testVnfId123"); - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", genericVnfPayload, ""); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); - - String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=500,errorMessage=Incoming Vnf Payload and/or Type is null. These Variables are required!]"; - - assertEquals("false", successIndicator); - assertEquals(expectedWFEX, workflowException); - - } - - @Test - @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) - public void testGenericPutVnf_error_missingPayload() throws Exception{ - - MockPutGenericVnf("testVnfId123"); - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", genericVnfPayload, ""); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); - - String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=500,errorMessage=Incoming Vnf Payload and/or Type is null. These Variables are required!]"; - - assertEquals("false", successIndicator); - assertEquals(expectedWFEX, workflowException); - - } - - @Test - @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) - public void testGenericPutVnf_error_404() throws Exception{ - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); - - String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=404,errorMessage=Received a bad response from AAI]"; - - assertEquals("false", successIndicator); - assertEquals(expectedWFEX, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) - public void testGenericPutVnf_error_400() throws Exception{ - - MockPutGenericVnf("/testVnfId123", 400); - - Map variables = new HashMap<>(); - setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); - - String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=400,errorMessage=Received a bad response from AAI]"; - - assertEquals("false", successIndicator); - assertEquals(expectedWFEX, workflowException); - - - } - - private void setVariables(Map variables, String vnfId, String payload, String type) { - variables.put("isDebugLogEnabled", "true"); - variables.put("GENPV_vnfId", vnfId); - variables.put("GENPV_vnfPayload",payload); - variables.put("GENPV_type", type); - } - - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ManualHandlingTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ManualHandlingTest.java deleted file mode 100644 index 85a0bb789d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ManualHandlingTest.java +++ /dev/null @@ -1,124 +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.bpmn.common; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; - -import org.camunda.bpm.engine.TaskService; -import org.camunda.bpm.ProcessEngineService; -import org.camunda.bpm.engine.task.TaskQuery; -import org.camunda.bpm.engine.task.Task; -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateTask; -import org.camunda.bpm.engine.runtime.Execution; - -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponsePolicy.MockPolicyAbort; - -import java.io.DataOutputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import java.util.List; - -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.core.WorkflowException; - -/** - * Unit test for RainyDayHandler.bpmn. - */ -public class ManualHandlingTest extends WorkflowTest { - - @Test - @Deployment(resources = { - "subprocess/BuildingBlock/ManualHandling.bpmn" - }) - public void TestManualHandlingSuccess() { - - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceType", "X"); - variables.put("vnfType", "Y"); - variables.put("currentActivity", "BB1"); - variables.put("workStep", "1"); - variables.put("failedActivity", "AAI"); - variables.put("vnfName", "vSAMP12"); - variables.put("errorCode", "123"); - variables.put("errorText", "update failed"); - variables.put("validResponses", "Rollback"); - variables.put("vnfName", "vSAMP1"); - - - String businessKey = UUID.randomUUID().toString(); - invokeSubProcess("ManualHandling", businessKey, variables); - - try { - Thread.sleep(5); - } catch (Exception e) { - - } - - TaskService taskService = processEngineRule.getTaskService(); - - TaskQuery q = taskService.createTaskQuery(); - - List tasks = q.orderByTaskCreateTime().asc().list(); - int i = 0; - - for (Task task : tasks) { - - - System.out.println("TASK ID: " + task.getId()); - System.out.println("TASK NAME: " + task.getName()); - try { - System.out.println("Completing the task"); - Map completeVariables = new HashMap<>(); - completeVariables.put("responseValue", "skip"); - taskService.complete(task.getId(), completeVariables); - } - catch(Exception e) { - System.out.println("GOT EXCEPTION: " + e.getMessage()); - } - } - - waitForProcessEnd(businessKey, 100000); - - Assert.assertTrue(isProcessEnded(businessKey)); - - } - - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java deleted file mode 100644 index 1f64fb55f8..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java +++ /dev/null @@ -1,781 +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========================================================= - */ - -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -package org.openecomp.mso.bpmn.common; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.core.WorkflowException; -import org.openecomp.mso.bpmn.core.domain.AllottedResource; -import org.openecomp.mso.bpmn.core.domain.CloudFlavor; -import org.openecomp.mso.bpmn.core.domain.HomingSolution; -import org.openecomp.mso.bpmn.core.domain.ModelInfo; -import org.openecomp.mso.bpmn.core.domain.NetworkResource; -import org.openecomp.mso.bpmn.core.domain.Resource; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.bpmn.core.domain.ServiceInstance; -import org.openecomp.mso.bpmn.core.domain.VnfResource; -import org.openecomp.mso.bpmn.mock.FileUtil; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid; -import static org.openecomp.mso.bpmn.mock.StubResponseOof.mockOof; -import static org.openecomp.mso.bpmn.mock.StubResponseOof.mockOof_500; - - -/** - * Test the OOF Homing subflow building block. - */ -public class OofHomingTest extends WorkflowTest { - - ServiceDecomposition serviceDecomposition = new ServiceDecomposition(); - String subscriber = ""; - String subscriber2 = ""; - - private final CallbackSet callbacks = new CallbackSet(); - - public OofHomingTest() throws IOException { - String oofCallback = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackInfraVnf"); - String oofCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf"); - String oofCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf2Net"); - - String oofCallbackNoSolution = FileUtil. - readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound"); - String oofCallbackPolicyException = FileUtil. - readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException"); - String oofCallbackServiceException = FileUtil. - readResourceFile("__files/BuildingBlocks/oofCallbackServiceException"); - - callbacks.put("oof", JSON, "oofResponse", oofCallback); - callbacks.put("oof2", JSON, "oofResponse", oofCallback2); - callbacks.put("oof3", JSON, "oofResponse", oofCallback3); - callbacks.put("oofNoSol", JSON, "oofResponse", oofCallbackNoSolution); - callbacks.put("oofPolicyEx", JSON, "oofResponse", oofCallbackPolicyException); - callbacks.put("oofServiceEx", JSON, "oofResponse", oofCallbackServiceException); - - // Service Model - ModelInfo sModel = new ModelInfo(); - sModel.setModelCustomizationName("testModelCustomizationName"); - sModel.setModelInstanceName("testModelInstanceName"); - sModel.setModelInvariantUuid("testModelInvariantId"); - sModel.setModelName("testModelName"); - sModel.setModelUuid("testModelUuid"); - sModel.setModelVersion("testModelVersion"); - // Service Instance - ServiceInstance si = new ServiceInstance(); - si.setInstanceId("testServiceInstanceId123"); - // Allotted Resources - List arList = new ArrayList(); - AllottedResource ar = new AllottedResource(); - ar.setResourceId("testResourceIdAR"); - ar.setNfFunction("testARFunctionName"); - ModelInfo arModel = new ModelInfo(); - arModel.setModelCustomizationUuid("testModelCustomizationUuidAR"); - arModel.setModelInvariantUuid("testModelInvariantIdAR"); - arModel.setModelName("testModelNameAR"); - arModel.setModelVersion("testModelVersionAR"); - arModel.setModelUuid("testARModelUuid"); - arModel.setModelType("testModelTypeAR"); - ar.setModelInfo(arModel); - AllottedResource ar2 = new AllottedResource(); - ar2.setResourceId("testResourceIdAR2"); - ar2.setNfFunction("testAR2FunctionName"); - ModelInfo arModel2 = new ModelInfo(); - arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2"); - arModel2.setModelInvariantUuid("testModelInvariantIdAR2"); - arModel2.setModelName("testModelNameAR2"); - arModel2.setModelVersion("testModelVersionAR2"); - arModel2.setModelUuid("testAr2ModelUuid"); - arModel2.setModelType("testModelTypeAR2"); - ar2.setModelInfo(arModel2); - arList.add(ar); - arList.add(ar2); - // Vnfs - List vnfList = new ArrayList(); - VnfResource vnf = new VnfResource(); - vnf.setResourceId("testResourceIdVNF"); - vnf.setNfFunction("testVnfFunctionName"); - ArrayList flavors = new ArrayList<>(); - CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx"); - CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx"); - flavors.add(flavor1); - flavors.add(flavor2); - vnf.getHomingSolution().setFlavors(flavors); - ModelInfo vnfModel = new ModelInfo(); - vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF"); - vnfModel.setModelInvariantUuid("testModelInvariantIdVNF"); - vnfModel.setModelName("testModelNameVNF"); - vnfModel.setModelVersion("testModelVersionVNF"); - vnfModel.setModelUuid("testVnfModelUuid"); - vnfModel.setModelType("testModelTypeVNF"); - vnf.setModelInfo(vnfModel); - vnfList.add(vnf); - System.out.println("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString()); - serviceDecomposition.setModelInfo(sModel); - serviceDecomposition.setServiceAllottedResources(arList); - serviceDecomposition.setServiceVnfs(vnfList); - serviceDecomposition.setServiceInstance(si); - - // Subscriber - subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}"; - subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}"; - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_success_2AR1Vnf() throws Exception { - - mockOof(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "oof2"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, - "WorkflowException"); - ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, - "serviceDecomposition"); - String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); - - Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); - HomingSolution resourceARHoming = resourceAR.getHomingSolution(); - Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); - HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution(); - Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); - HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution(); - String resourceARHomingString = resourceARHoming.toString(); - resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); - String resourceARHoming2String = resourceARHoming2.toString(); - resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); - String resourceVNFHomingString = resourceVNFHoming.toString(); - resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); - expectedOofRequest = expectedOofRequest.replaceAll("\\s+", ""); - - assertNull(workflowException); - assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", - resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx", - "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", - "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), - resourceARHomingString); - assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", - resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2", - null, null), resourceARHoming2String); - assertEquals(homingSolutionCloud("cloud","aic", "testCloudRegionId3", - true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", - "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), - resourceVNFHomingString); - assertEquals(verifyOofRequest(), expectedOofRequest); - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_success_2AR1Vnf2Net() throws Exception { - - mockOof(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables2(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "oof3"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, - "WorkflowException"); - ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, - "serviceDecomposition"); - String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); - - Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); - HomingSolution resourceARHoming = resourceAR.getHomingSolution(); - Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); - HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution(); - Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); - HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution(); - Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet"); - HomingSolution resourceNetHoming = resourceNet.getHomingSolution(); - Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2"); - HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution(); - - String resourceARHomingString = resourceARHoming.toString(); - resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); - String resourceARHoming2String = resourceARHoming2.toString(); - resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); - String resourceVNFHomingString = resourceVNFHoming.toString(); - resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); - String resourceNetHomingString = resourceNetHoming.toString(); - resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " "); - String resourceNetHoming2String = resourceNetHoming2.toString(); - resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " "); - expectedOofRequest = expectedOofRequest.replaceAll("\\s+", ""); - - - assertNull(workflowException); - assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", - resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx", - "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", - "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), - resourceARHomingString); - assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", - resourceARHoming2.getVnf().getResourceId(), - "aic", "testCloudRegionId2", - null, null), resourceARHoming2String); - assertEquals(homingSolutionCloud("cloud","aic", - "testCloudRegionId3", - true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", - "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), - resourceVNFHomingString); - assertEquals(homingSolutionService("service", "testServiceInstanceIdNet", - "testVnfHostNameNet", resourceNetHoming.getVnf().getResourceId(),"aic", - "testCloudRegionIdNet", - null, null), resourceNetHomingString); - assertEquals(homingSolutionCloud("cloud", "aic", - "testCloudRegionIdNet2", - false, "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"", - "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""), - resourceNetHoming2String); - assertEquals(verifyOofRequest(), expectedOofRequest); - - } - - @Test - @Ignore - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/BuildingBlock/DecomposeService.bpmn", - "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_success_vnfResourceList() throws Exception { - - // Create a Service Decomposition - MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4", - "/BuildingBlocks/oofCatalogResp.json"); - String busKey = UUID.randomUUID().toString(); - Map vars = new HashMap<>(); - setVariablesForServiceDecomposition(vars, "testRequestId123", - "ff5256d2-5a33-55df-13ab-12abad84e7ff"); - invokeSubProcess("DecomposeService", busKey, vars); - - ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, - "serviceDecomposition"); - System.out.println("In testHoming_success_vnfResourceList, ServiceDecomposition = " + sd); - List vnfResourceList = sd.getServiceVnfs(); -//System.out.println(" vnfResourceList = " + vnfResourceList); - vnfResourceList.get(0).setResourceId("test-resource-id-000"); - - // Invoke Homing - - mockOof(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("homingService", "oof"); - variables.put("isDebugLogEnabled", "true"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId"); - variables.put("serviceDecomposition", sd); - variables.put("subscriberInfo", subscriber2); - HashMap customerLocation = new HashMap(); - customerLocation.put("customerLatitude", "32.89748"); - customerLocation.put("customerLongitude", "-97.040443"); - customerLocation.put("customerName", "xyz"); - variables.put("customerLatitude", "32.89748"); - variables.put("customerLongitude", "-97.040443"); - variables.put("customerName", "xyz"); - variables.put("customerLocation", customerLocation); - variables.put("cloudOwner", "amazon"); - variables.put("cloudRegionId", "TNZED"); - - invokeSubProcess("Homing", businessKey, variables); - injectWorkflowMessages(callbacks, "oof3"); - waitForProcessEnd(businessKey, 10000); - - //Get Variables - - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, - "WorkflowException"); - ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, - "serviceDecomposition"); - System.out.println("serviceDecompositionExp is: " + serviceDecompositionExp); - - Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000"); - System.out.println("resourceVnf is: " + resourceVnf); - HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution(); - - String resourceVnfHomingString = resourceVnfHoming.toString(); - System.out.println("resourceVnfHomingString is: " + resourceVnfHomingString); - resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " "); - System.out.println("Now resourceVnfHomingString is: " + resourceVnfHomingString); - - assertNull(workflowException); - - //Verify request - String oofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); - System.out.println("oofRequest is: " + oofRequest); - assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf"). - replaceAll("\n", "").replaceAll("\r", ""). - replaceAll("\t", ""), oofRequest.replaceAll("\n", ""). - replaceAll("\r", "").replaceAll("\t", "")); - - //System.out.println("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId()); - - assertEquals(homingSolutionService("service", "service-instance-01234", - "MDTNJ01", "test-resource-id-000","att-aic", - "mtmnj1a", - "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," + - " \"j1d563e8-e714-4393-8f99-cc480144a05e\"", - "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," + - " \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString); - } - - @Test - @Ignore // 1802 merge - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_success_existingLicense() throws Exception { - - mockOof(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap(); - setVariablesExistingLicense(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "sniro"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition"); - String oofRequest = (String) getVariableFromHistory(businessKey, "sniroRequest"); - - Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); - HomingSolution resourceARHoming = (HomingSolution) resourceAR.getHomingSolution(); - Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); - HomingSolution resourceARHoming2 = (HomingSolution) resourceAR2.getHomingSolution(); - Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); - HomingSolution resourceVNFHoming = (HomingSolution) resourceVNF.getHomingSolution(); - String resourceARHomingString = resourceARHoming.toString(); - resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); - String resourceARHoming2String = resourceARHoming2.toString(); - resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); - String resourceVNFHomingString = resourceVNFHoming.toString(); - resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); - oofRequest = oofRequest.replaceAll("\\s+", ""); - - assertNull(workflowException); - assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", - "aic", "dfwtx", "KDTNJ01", - "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", - "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), - resourceARHomingString); - assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", - resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2", - null, null), resourceARHoming2String); - assertEquals(homingSolutionCloud("cloud", "aic", - "testCloudRegionId3", - false, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", - "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), - resourceVNFHomingString); - assertEquals(verifyOofRequestExistingLicense(), oofRequest); - - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_error_inputVariable() throws Exception { - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables3(variables); - - invokeSubProcess("Homing", businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, - "WorkflowException"); - - assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required " + - "input variable is missing or null]", workflowException.toString()); - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_error_badResponse() throws Exception { - mockOof_500(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("Homing", businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, - "WorkflowException"); - - assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a " + - "Bad Sync Response from Sniro/OOF.]", workflowException.toString()); - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_error_oofNoSolution() throws Exception { - mockOof(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "oofNoSol"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, - "WorkflowException"); - Boolean errorMatch = workflowException.toString().contains("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " + - "Response contains error: Unable to find any candidate for demand *** Response:"); - assert(errorMatch); - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_error_oofPolicyException() throws Exception { - mockOof(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "oofPolicyEx"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, - "WorkflowException"); - - assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " + - "Response contains a Request Error Policy Exception: Message content size exceeds the allowable " + - "limit]", workflowException.toString()); - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_error_oofServiceException() throws Exception { - mockOof(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "oofServiceEx"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, - "WorkflowException"); - - assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " + - "Response contains a Request Error Service Exception: OOF PlacementError: " + - "requests.exceptions.HTTPError: 404 Client Error: Not Found for " + - "url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]", - workflowException.toString()); - } - - - private void setVariables(Map variables) { - variables.put("homingService", "oof"); - HashMap customerLocation = new HashMap(); - customerLocation.put("customerLatitude", "32.89748"); - customerLocation.put("customerLongitude", "-97.040443"); - customerLocation.put("customerName", "xyz"); - variables.put("customerLatitude", "32.89748"); - variables.put("customerLongitude", "-97.040443"); - variables.put("customerName", "xyz"); - variables.put("customerLocation", customerLocation); - variables.put("cloudOwner", "amazon"); - variables.put("cloudRegionId", "TNZED"); - variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR"); - variables.put("vgMuxInfraModelId", "testArModelUuid"); - // variables.put("mso-request-id", "testRequestId"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId123"); - variables.put("serviceInstanceName", "testServiceName"); - variables.put("serviceDecomposition", serviceDecomposition); - variables.put("subscriberInfo", subscriber2); - } - - private void setVariables2(Map variables) { - List netList = new ArrayList(); - NetworkResource net = new NetworkResource(); - net.setResourceId("testResourceIdNet"); - ModelInfo netModel = new ModelInfo(); - netModel.setModelCustomizationUuid("testModelCustomizationUuidNet"); - netModel.setModelInvariantUuid("testModelInvariantIdNet"); - netModel.setModelName("testModelNameNet"); - netModel.setModelVersion("testModelVersionNet"); - net.setModelInfo(netModel); - netList.add(net); - NetworkResource net2 = new NetworkResource(); - net2.setResourceId("testResourceIdNet2"); - ModelInfo netModel2 = new ModelInfo(); - netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2"); - netModel2.setModelCustomizationName("testModelCustomizationNameNet2"); - netModel2.setModelInvariantUuid("testModelInvariantIdNet2"); - netModel2.setModelName("testModelNameNet2"); - netModel2.setModelVersion("testModelVersionNet2"); - net2.setModelInfo(netModel2); - netList.add(net2); - serviceDecomposition.setServiceNetworks(netList); - - variables.put("homingService", "oof"); - HashMap customerLocation = new HashMap(); - customerLocation.put("customerLatitude", "32.89748"); - customerLocation.put("customerLongitude", "-97.040443"); - customerLocation.put("customerName", "xyz"); - variables.put("customerLatitude", "32.89748"); - variables.put("customerLongitude", "-97.040443"); - variables.put("customerName", "xyz"); - variables.put("customerLocation", customerLocation); - variables.put("cloudOwner", "amazon"); - variables.put("cloudRegionId", "TNZED"); - variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR"); - variables.put("vgMuxInfraModelId", "testArModelUuid"); - variables.put("isDebugLogEnabled", "true"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId123"); - variables.put("serviceInstanceName", "testServiceName"); - variables.put("serviceDecomposition", serviceDecomposition); - variables.put("subscriberInfo", subscriber2); - } - - private void setVariables3(Map variables) { - variables.put("homingService", "oof"); - HashMap customerLocation = new HashMap(); - customerLocation.put("customerLatitude", "32.89748"); - customerLocation.put("customerLongitude", "-97.040443"); - customerLocation.put("customerName", "xyz"); - variables.put("customerLatitude", "32.89748"); - variables.put("customerLongitude", "-97.040443"); - variables.put("customerName", "xyz"); - variables.put("customerLocation", customerLocation); - variables.put("cloudOwner", "amazon"); - variables.put("cloudRegionId", "TNZED"); - variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR"); - variables.put("vgMuxInfraModelId", "testArModelUuid"); - variables.put("isDebugLogEnabled", "true"); - // variables.put("mso-request-id", "testRequestId"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId123"); - variables.put("serviceInstanceName", "testServiceName"); - variables.put("serviceDecomposition", null); - variables.put("subscriberInfo", subscriber2); - } - - private void setVariablesExistingLicense(Map variables) { - HomingSolution currentHomingSolution = new HomingSolution(); - serviceDecomposition.getServiceVnfs().get(0).setCurrentHomingSolution(currentHomingSolution); - serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1"); - serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2"); - - serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1"); - serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2"); - - variables.put("isDebugLogEnabled", "true"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId"); - variables.put("serviceDecomposition", serviceDecomposition); - variables.put("subscriberInfo", subscriber2); - - } - - private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname, - String vnfResourceId, String cloudOwner, - String cloudRegionId, String enList, - String licenseList){ - - String solution = ""; - if(enList == null){ - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + - serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + - cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId + - "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :" + - " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { }," + - " \"rehome\" : false } }"; - }else{ - //language=JSON - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + - serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + - cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :" + - " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :" + - " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :" + - " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }"; - } - return solution; - } - - private String homingSolutionCloud(String type, String cloudOwner, - String cloudRegionId, Boolean flavors, String enList, - String licenseList){ - String solution = ""; - if(enList == null){ - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + - cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + - "\", \"license\" : { }, \"rehome\" : false } }"; - } else if (flavors && enList == null){ - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + - cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + - "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " + - "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " + - "\"license\" : { }, \"rehome\" : false } }"; - } else if (flavors) { - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + - cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + - "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " + - "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " + - "\"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + - licenseList + " ] }, \"rehome\" : false } }"; - } else { - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + - cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + - "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + - licenseList + " ] }, \"rehome\" : false } }"; - } - return solution; - } - - private void setVariablesForServiceDecomposition(Map variables, String requestId, String siId) { - variables.put("homingService", "oof"); - variables.put("isDebugLogEnabled", "true"); - variables.put("mso-request-id", requestId); - variables.put("msoRequestId", requestId); - variables.put("serviceInstanceId", siId); - HashMap customerLocation = new HashMap(); - customerLocation.put("customerLatitude", "32.89748"); - customerLocation.put("customerLongitude", "-97.040443"); - customerLocation.put("customerName", "xyz"); - variables.put("customerLatitude", "32.89748"); - variables.put("customerLongitude", "-97.040443"); - variables.put("customerName", "xyz"); - variables.put("customerLocation", customerLocation); - variables.put("cloudOwner", "amazon"); - variables.put("cloudRegionId", "TNZED"); - - - String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":" + - "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}"; - variables.put("serviceModelInfo", serviceModelInfo); - } - - private String verifyOofRequest() { - String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," + - "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\"," + - "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"]," + - "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":" + - "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":" + - "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," + - "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"testARFunctionName\"" + - ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":" + - "\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\"," + - "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\",\"modelType\":" + - "\"\",\"modelVersion\":\"\",\"modelCustomizationName\":\"\"}}," + - "{\"resourceModuleName\":\"testAR2FunctionName\",\"serviceResourceId\":\"testResourceIdAR2\"," + - "\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\"," + - "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\"," + - "\"modelType\":\"\",\"modelVersion\":\"\"," + - "\"modelCustomizationName\":\"\"}},{\"resourceModuleName\":\"testVnfFunctionName\",\"serviceResourceId\":\"" + - "testResourceIdVNF\",\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\"" + - ":\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":\"" + - "testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\"" + - ",\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":" + - "{\"serviceInstanceId\":\"testServiceInstanceId123\"," + - "\"serviceName\":\"testServiceName\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" + - "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\"," + - "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" + - "\"}}}"; - return request; - } - - private String verifyOofRequestExistingLicense(){ - String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," + - "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\"," + - "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"]," + - "\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\"," + - "\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":" + - "\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":" + - "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," + - "\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":" + - "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\"," + - "\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\"," + - "\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\"," + - "\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":" + - "\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":" + - "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":" + - "\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\"," + - "\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\"," + - "\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\"," + - "\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":" + - "[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\"," + - "\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":" + - "\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\"," + - "\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\"," + - "\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}," + - "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\"," + - "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\"," + - "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":" + - "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}"; - return request; - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java deleted file mode 100644 index be74770e98..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java +++ /dev/null @@ -1,212 +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.bpmn.common; - -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModuleBadPatch; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.core.WorkflowException; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit tests for PrepareUpdateAAIVfModule.bpmn. - */ -public class PrepareUpdateAAIVfModuleTest extends WorkflowTest { - - /** - * Test the happy path through the flow. - */ - @Test - @Deployment(resources = { - "subprocess/PrepareUpdateAAIVfModule.bpmn" - }) - public void happyPath() throws IOException { - - logStart(); - - String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); - - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200); - MockPatchVfModuleId("skask", "supercool"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "999-99-9999"); - variables.put("isDebugLogEnabled","true"); - variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); - invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); - - Assert.assertTrue(isProcessEnded(businessKey)); - String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse"); - Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode"); - System.out.println("Subflow response code: " + responseCode); - System.out.println("Subflow response: " + response); - Assert.assertEquals(200, responseCode.intValue()); - String heatStackId = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_heatStackId"); - System.out.println("Ouput heat-stack-id:" + heatStackId); - Assert.assertEquals("slowburn", heatStackId); - - logEnd(); - } - - /** - * Test the case where the GET to AAI returns a 404. - */ - @Test - @Deployment(resources = { - "subprocess/PrepareUpdateAAIVfModule.bpmn" - }) - public void badGet() throws IOException { - - logStart(); - - String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); - MockGetGenericVnfById_404("skask[?]depth=1"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "999-99-9999"); - variables.put("isDebugLogEnabled","true"); - variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); - invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); - - Assert.assertTrue(isProcessEnded(businessKey)); - String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponse"); - Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponseCode"); - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - System.out.println("Subflow response code: " + responseCode); - System.out.println("Subflow response: " + response); - Assert.assertEquals(404, responseCode.intValue()); - Assert.assertNotNull(workflowException); - System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); - - logEnd(); - } - - /** - * Test the case where the validation of the VF Module fails. - */ - @Test - @Deployment(resources = { - "subprocess/PrepareUpdateAAIVfModule.bpmn" - }) - public void failValidation1() throws IOException { - - logStart(); - - String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "lukewarm"); - - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "999-99-9999"); - variables.put("isDebugLogEnabled","true"); - variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); - invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); - - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - Assert.assertNotNull(workflowException); - System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); - Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: Orchestration")); - - logEnd(); - } - - /** - * Test the case where the validation of the VF Module fails. - */ - @Test - @Deployment(resources = { - "subprocess/PrepareUpdateAAIVfModule.bpmn" - }) - public void failValidation2() throws IOException { - - logStart(); - - String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "notsocool"); - - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "999-99-9999"); - variables.put("isDebugLogEnabled","true"); - variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); - invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); - - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - Assert.assertNotNull(workflowException); - System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); - Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: VF Module")); - - logEnd(); - } - - /** - * Test the case where the GET to AAI is successful, but the subsequent PUT returns 404. - */ - @Test - @Deployment(resources = { - "subprocess/PrepareUpdateAAIVfModule.bpmn" - }) - public void badPatch() throws IOException { - - logStart(); - - String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); - - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "999-99-9999"); - variables.put("isDebugLogEnabled","true"); - variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); - invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); - - Assert.assertTrue(isProcessEnded(businessKey)); - String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse"); - Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode"); - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - System.out.println("Subflow response code: " + responseCode); - System.out.println("Subflow response: " + response); - Assert.assertEquals(404, responseCode.intValue()); - Assert.assertNotNull(workflowException); - System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); - - logEnd(); - } -} - diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/RainyDayHandlerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/RainyDayHandlerTest.java deleted file mode 100644 index d450dad05e..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/RainyDayHandlerTest.java +++ /dev/null @@ -1,85 +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.bpmn.common; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponsePolicy.MockPolicyAbort; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.core.WorkflowException; - -/** - * Unit test for RainyDayHandler.bpmn. - */ -public class RainyDayHandlerTest extends WorkflowTest { - - @Test - @Deployment(resources = { - "subprocess/BuildingBlock/RainyDayHandler.bpmn", - "subprocess/BuildingBlock/ManualHandling.bpmn" - }) - public void TestRainyDayHandlingSuccess() { - - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceType", "X"); - variables.put("vnfType", "Y"); - variables.put("currentActivity", "BB1"); - variables.put("workStep", "1"); - variables.put("failedActivity", ""); - variables.put("errorCode", "123"); - variables.put("errorText", "update failed"); - variables.put("vnfName", "vSAMP1"); - - MockPolicyAbort(); - - - String businessKey = UUID.randomUUID().toString(); - invokeSubProcess("RainyDayHandler", businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - - } - - - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ReceiveWorkflowMessageTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ReceiveWorkflowMessageTest.java deleted file mode 100644 index 64b8ba53b7..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ReceiveWorkflowMessageTest.java +++ /dev/null @@ -1,143 +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.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.WorkflowTest.CallbackSet; -import org.openecomp.mso.bpmn.core.WorkflowException; - -/** - * Unit tests for SDNCAdapterRestV1. - */ -public class ReceiveWorkflowMessageTest extends WorkflowTest { - - private static final String EOL = "\n"; - - private final CallbackSet callbacks = new CallbackSet(); - - public ReceiveWorkflowMessageTest() throws IOException { - callbacks.put("sdnc-event-success", JSON, "SDNCAEvent", - "{" + EOL + - " \"SDNCEvent\": {" + EOL + - " \"eventType\": \"UCPE-ACTIVATION\"," + EOL + - " \"eventCorrelatorType\": \"UCPE-HOST-NAME\"," + EOL + - " \"eventCorrelator\": \"((CORRELATOR))\"," + EOL + - " \"params\": {" + EOL + - " \"success-indicator\":\"Y\"" + EOL + - " }" +EOL + - " }" + EOL + - "}" + EOL); - - callbacks.put("sdnc-event-fail", JSON, "SDNCAEvent", - "{" + EOL + - " \"SDNCEvent\": {" + EOL + - " \"eventType\": \"UCPE-ACTIVATION\"," + EOL + - " \"eventCorrelatorType\": \"UCPE-HOST-NAME\"," + EOL + - " \"eventCorrelator\": \"((CORRELATOR))\"," + EOL + - " \"params\": {" + EOL + - " \"success-indicator\":\"N\"," + EOL + - " \"error-message\":\"SOMETHING BAD HAPPENED\"" + EOL + - " }" +EOL + - " }" + EOL + - "}" + EOL); - } - - /** - * Test the happy path. - */ - @Test - @Deployment(resources = { - "subprocess/ReceiveWorkflowMessage.bpmn" - }) - public void happyPath() throws Exception { - - logStart(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312"); - variables.put("isDebugLogEnabled", "true"); - variables.put("RCVWFMSG_timeout", "PT1M"); - variables.put("RCVWFMSG_messageType", "SDNCAEvent"); - variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31"); - - invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables); - injectWorkflowMessages(callbacks, "sdnc-event-success"); - waitForProcessEnd(businessKey, 10000); - - String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse"); - System.out.println("Response:\n" + response); - assertTrue(response.contains("\"SDNCEvent\"")); - assertTrue((boolean)getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator")); - - logEnd(); - } - - /** - * Test the timeout scenario. - */ - @Test - @Deployment(resources = { - "subprocess/ReceiveWorkflowMessage.bpmn" - }) - public void timeout() throws Exception { - - logStart(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312"); - variables.put("isDebugLogEnabled", "true"); - variables.put("RCVWFMSG_timeout", "PT5S"); - variables.put("RCVWFMSG_messageType", "SDNCAEvent"); - variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31"); - - invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables); - - // No injection - - waitForProcessEnd(businessKey, 10000); - - // There is no response from SDNC, so the flow doesn't set WorkflowResponse. - String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse"); - assertNull(response); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - assertNotNull(wfe); - System.out.println(wfe.toString()); - assertEquals("Receive Workflow Message Timeout Error", wfe.getErrorMessage()); - assertFalse((boolean)getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator")); - - logEnd(); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java deleted file mode 100644 index ec1a22347b..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.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.bpmn.common; - -import javax.xml.ws.Endpoint; - -import org.camunda.bpm.engine.ProcessEngineServices; -import org.junit.rules.TestRule; -import org.junit.runner.Description; -import org.junit.runners.model.Statement; -import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl; - -/** - * A JUnit rule that starts the SDNC Adapter Callback Service before - * every test, and tears it down after every test. Example: - *
- *     @Rule
- *     public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
- *         new SDNCAdapterCallbackRule(processEngineRule);
- * 
- */ -public class SDNCAdapterCallbackRule implements TestRule { - public static final String DEFAULT_ENDPOINT_URL = - "http://localhost:28080/mso/SDNCAdapterCallbackService"; - - private final ProcessEngineServices processEngineServices; - private final String endpointUrl; - - public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices) { - this(processEngineServices, DEFAULT_ENDPOINT_URL); - } - - public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices, - String endpointUrl) { - this.processEngineServices = processEngineServices; - this.endpointUrl = endpointUrl; - } - - @Override - public Statement apply(final Statement baseStmt, Description description) { - return new Statement() { - @Override - public void evaluate() throws Throwable { - Endpoint endpoint = null; - - try { - SDNCAdapterCallbackServiceImpl sdncCallbackService = new SDNCAdapterCallbackServiceImpl(); - sdncCallbackService.setProcessEngineServices4junit(processEngineServices); - - System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true"); - System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true"); - - System.out.println("Publishing Endpoint - " + endpointUrl); - endpoint = Endpoint.publish(endpointUrl, sdncCallbackService); - - baseStmt.evaluate(); - } finally { - if (endpoint != null) { - System.out.println("Stopping Endpoint - " + endpointUrl); - endpoint.stop(); - } - } - } - }; - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterRestV2Test.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterRestV2Test.java deleted file mode 100644 index 90336bb391..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterRestV2Test.java +++ /dev/null @@ -1,152 +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.bpmn.common; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import javax.ws.rs.core.Response; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowMessageResource; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit tests for SDNCAdapterRestV2.bpmn. - * - * This version of SDNCAdapterRest allows for interim notifications to be sent for - * any non-final response received from SDNC. - */ -public class SDNCAdapterRestV2Test extends WorkflowTest { - - private final CallbackSet callbacks = new CallbackSet(); - - /** - * Constructor. Insert callbacks. - * - * @throws IOException - */ - public SDNCAdapterRestV2Test() throws IOException { - String sdncCallbackFinal = FileUtil.readResourceFile("__files/SDNCAdapterRestCallbackFinal.json"); - String sdncCallbackNonFinal = FileUtil.readResourceFile("__files/SDNCAdapterRestCallbackNonFinal.json"); - callbacks.put("nonfinal", sdncCallbackNonFinal); - callbacks.put("final", sdncCallbackFinal); - } - - /** - * Test the success path through the subflow. - */ - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterRestV2.bpmn", - "subprocess/GenericNotificationService.bpmn" - }) - public void success() throws IOException { - logStart(); - mocks(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap(); - variables.put("mso-request-id", "a4383a52-b9de-4bc4-bedf-02f3f9466535"); - variables.put("mso-service-instance-id", "fd8bcdbb-b799-43ce-a7ff-ed8f2965a3b5"); - variables.put("isDebugLogEnabled", "true"); - variables.put("SDNCREST_Request", - FileUtil.readResourceFile("__files/SDNCAdapterRestV2Request.json")); - variables.put("SDNCREST_InterimNotification1", - FileUtil.readResourceFile("__files/SDNCInterimNotification1.json")); - - invokeSubProcess("SDNCAdapterRestV2", businessKey, variables); - - injectSDNCRestCallbacks(callbacks, "nonfinal"); - - // First non-final response will have done a notification - Object interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification"); - Assert.assertNotNull(interimNotification); - - injectSDNCRestCallbacks(callbacks, "nonfinal"); - - // Second non-final response will not have done a notification - interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification"); - Assert.assertNull(interimNotification); - - injectSDNCRestCallbacks(callbacks, "final"); - - interimNotification = this.getVariableFromHistory(businessKey, "SDNCREST_interimNotification"); - Assert.assertNull(interimNotification); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - - logEnd(); - } - - /** - * Injects a single SDNC adapter callback request. The specified callback data - * may contain the placeholder string ((REQUEST-ID)) which is replaced with - * the actual SDNC request ID. Note: this is not the requestId in the original - * MSO request. - * @param contentType the HTTP content type for the callback - * @param content the content of the callback - * @param timeout the timeout in milliseconds - * @return true if the callback could be injected, false otherwise - */ - @Override - protected boolean injectSDNCRestCallback(String contentType, String content, long timeout) { - String sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV2", - "SDNCAResponse_CORRELATOR", timeout); - - if (sdncRequestId == null) { - return false; - } - - content = content.replace("((REQUEST-ID))", sdncRequestId); - // Deprecated usage. All test code should switch to the (( ... )) syntax. - content = content.replace("{{REQUEST-ID}}", sdncRequestId); - - System.out.println("Injecting SDNC adapter callback"); - WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource(); - workflowMessageResource.setProcessEngineServices4junit(processEngineRule); - Response response = workflowMessageResource.deliver(contentType, "SDNCAResponse", sdncRequestId, content); - System.out.println("Workflow response to SDNC adapter callback: " + response); - return true; - } - - /** - * Defines WireMock stubs needed by these tests. - */ - private void mocks() { - stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/json"))); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java deleted file mode 100644 index 02e029de46..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java +++ /dev/null @@ -1,475 +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.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; -import org.camunda.bpm.engine.runtime.Job; -import org.camunda.bpm.engine.test.Deployment; -import org.camunda.bpm.engine.variable.impl.VariableMapImpl; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.adapter.sdnc.CallbackHeader; -import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest; -import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse; -import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl; -import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl.SDNCAdapterErrorResponse; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.core.PropertyConfigurationSetup; -import org.openecomp.mso.bpmn.core.xml.XmlTool; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit test cases for SDNCAdapterV1.bpmn - */ -public class SDNCAdapterV1Test extends WorkflowTest { - - private String sdncAdapterWorkflowRequest; - private String sdncAdapterWorkflowRequestAct; - private String sdncAdapterCallbackRequestData; - private String sdncAdapterCallbackRequestDataNonfinal; - - public SDNCAdapterV1Test() throws IOException { - sdncAdapterWorkflowRequest = FileUtil.readResourceFile("sdncadapterworkflowrequest.xml"); - sdncAdapterWorkflowRequestAct = FileUtil.readResourceFile("sdncadapterworkflowrequest-act.xml"); - sdncAdapterCallbackRequestData = FileUtil.readResourceFile("sdncadaptercallbackrequestdata.text"); - sdncAdapterCallbackRequestDataNonfinal = FileUtil.readResourceFile("sdncadaptercallbackrequestdata-nonfinal.text"); - } - - /** - * End-to-End flow - Unit test for SDNCAdapterV1.bpmn - * - String input & String response - */ - - private WorkflowResponse invokeFlow(String workflowRequest) { - - MapvalueMap = new HashMap<>(); - valueMap.put("value", workflowRequest); - Map variables = new HashMap<>(); - variables.put("sdncAdapterWorkflowRequest", valueMap); - - Map valueMap2 = new HashMap<>(); - valueMap2.put("value", "true"); - variables.put("isDebugLogEnabled", valueMap2); - - VariableMapImpl varMap = new VariableMapImpl(); - varMap.put("variables", variables); - - //System.out.println("Invoking the flow"); - - WorkflowResource workflowResource = new WorkflowResource(); - workflowResource.setProcessEngineServices4junit(processEngineRule); - - Response response = workflowResource.startProcessInstanceByKey("sdncAdapter", varMap); - WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity(); - - //String pid = workflowResponse.getProcessInstanceId(); - //System.out.println("Back from executing process instance with pid=" + pid); - return workflowResponse; - } - - @Test - @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericNotificationService.bpmn" - }) - public void sunnyDay() throws InterruptedException { - - mockSDNCAdapter(200); - - //System.out.println("SDNCAdapter sunny day flow Started!"); - - ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest); - thread.start(); - waitForExecutionToStart("sdncAdapter", 3); - String pid = getPid(); - - assertProcessInstanceNotFinished(pid); - - System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing"); - String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId"); - CallbackHeader callbackHeader = new CallbackHeader(); - callbackHeader.setRequestId(generatedRequestId); - callbackHeader.setResponseCode("200"); - callbackHeader.setResponseMessage("OK"); - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); - sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); - sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData); - SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); - callbackService.setProcessEngineServices4junit(processEngineRule); - SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); - //System.out.println("Back from executing process again"); - - assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse); - assertProcessInstanceFinished(pid); - - //System.out.println("SDNCAdapter sunny day flow Completed!"); - } - - @Test - @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericNotificationService.bpmn" - }) - public void nonFinalWithTimeout() throws InterruptedException { - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBAdapter.xml"); - - //System.out.println("SDNCAdapter interim status processing flow Started!"); - - ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequestAct); - thread.start(); - waitForExecutionToStart("sdncAdapter", 3); - String pid = getPid(); - - assertProcessInstanceNotFinished(pid); - - //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing"); - String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId"); - CallbackHeader callbackHeader = new CallbackHeader(); - callbackHeader.setRequestId(generatedRequestId); - callbackHeader.setResponseCode("200"); - callbackHeader.setResponseMessage("OK"); - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); - sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); - sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestDataNonfinal); - SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); - callbackService.setProcessEngineServices4junit(processEngineRule); - SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); - //System.out.println("Back from executing process again"); - - assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse); - assertProcessInstanceNotFinished(pid); - - checkForTimeout(pid); - - assertEquals(true, (Boolean) (getVariable(pid, "continueListening"))); - assertEquals(false, (Boolean) (getVariable(pid, "SDNCA_InterimNotify"))); - - - //System.out.println("SDNCAdapter interim status processing flow Completed!"); - } - - @Test - @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericNotificationService.bpmn" - }) - public void nonFinalThenFinal() throws InterruptedException { - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBAdapter.xml"); - - //System.out.println("SDNCAdapter non-final then final processing flow Started!"); - - // Start the flow - ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequestAct); - thread.start(); - waitForExecutionToStart("sdncAdapter", 3); - String pid = getPid(); - - assertProcessInstanceNotFinished(pid); - - // Inject a "non-final" SDNC Adapter asynchronous callback message - //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing"); - String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId"); - CallbackHeader callbackHeader = new CallbackHeader(); - callbackHeader.setRequestId(generatedRequestId); - callbackHeader.setResponseCode("200"); - callbackHeader.setResponseMessage("OK"); - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); - sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); - sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestDataNonfinal); - SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); - callbackService.setProcessEngineServices4junit(processEngineRule); - SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); - //System.out.println("Back from executing process again"); - - assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse); - assertProcessInstanceNotFinished(pid); - assertEquals(true, (Boolean) (getVariable(pid, "continueListening"))); - assertEquals(false, (Boolean) (getVariable(pid, "SDNCA_InterimNotify"))); - - // Inject a "final" SDNC Adapter asynchronous callback message - sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData); - sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); - //System.out.println("Back from executing process again"); - - assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse); - assertProcessInstanceFinished(pid); - assertEquals(false, (Boolean) (getVariable(pid, "continueListening"))); - assertEquals(false, (Boolean) (getVariable(pid, "SDNCA_InterimNotify"))); - - //System.out.println("SDNCAdapter non-final then final processing flow Completed!"); - } - - - @Test - @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericNotificationService.bpmn" - }) - public void nonFinalThenFinalWithNotify() throws InterruptedException { - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBAdapter.xml"); - - //System.out.println("SDNCAdapter non-final then final processing flow Started!"); - - String modSdncAdapterWorkflowRequestAct = sdncAdapterWorkflowRequestAct; - try { - // only service-type "uCPE-VMS" is applicable to notification, so modify the test request - modSdncAdapterWorkflowRequestAct = XmlTool.modifyElement(sdncAdapterWorkflowRequestAct, "tag0:service-type", "uCPE-VMS").get(); - System.out.println("modified request: " + modSdncAdapterWorkflowRequestAct); - } catch (Exception e) { - System.out.println("request modification failed"); - //e.printStackTrace(); - } - - // Start the flow - ProcessExecutionThread thread = new ProcessExecutionThread(modSdncAdapterWorkflowRequestAct); - thread.start(); - waitForExecutionToStart("sdncAdapter", 3); - String pid = getPid(); - - assertProcessInstanceNotFinished(pid); - - // Inject a "non-final" SDNC Adapter asynchronous callback message - //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing"); - String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId"); - CallbackHeader callbackHeader = new CallbackHeader(); - callbackHeader.setRequestId(generatedRequestId); - callbackHeader.setResponseCode("200"); - callbackHeader.setResponseMessage("OK"); - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); - sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); - sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestDataNonfinal); - SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); - callbackService.setProcessEngineServices4junit(processEngineRule); - SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); - //System.out.println("Back from executing process again"); - - assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse); - assertProcessInstanceNotFinished(pid); - assertEquals(true, (Boolean) (getVariable(pid, "continueListening"))); - assertEquals(true, (Boolean) (getVariable(pid, "SDNCA_InterimNotify"))); - - // Inject a "final" SDNC Adapter asynchronous callback message - sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData); - sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); - //System.out.println("Back from executing process again"); - - assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse); - assertProcessInstanceFinished(pid); - assertEquals(false, (Boolean) (getVariable(pid, "continueListening"))); - assertEquals(false, (Boolean) (getVariable(pid, "SDNCA_InterimNotify"))); - - //System.out.println("SDNCAdapter non-final then final processing flow Completed!"); - } - - - private void waitForExecutionToStart(String processDefintion, int count) throws InterruptedException { - //System.out.println(processEngineRule.getRuntimeService().createExecutionQuery().processDefinitionKey(processDefintion).count()); - while (processEngineRule.getRuntimeService().createExecutionQuery().processDefinitionKey(processDefintion).count() != count) { - Thread.sleep(200); - } - } - - @Test - @Ignore // Ignored because PropertyConfigurationSetup is timing out - @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericNotificationService.bpmn" - }) - public void badCorrelationIdTest() throws InterruptedException, IOException { - - mockSDNCAdapter(200); - - Map urnProperties = PropertyConfigurationSetup.createBpmnUrnProperties(); - urnProperties.put("mso.correlation.timeout", "5"); - PropertyConfigurationSetup.addProperties(urnProperties, 10000); - - //System.out.println("SDNCAdapter bad RequestId test Started!"); - - ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest); - thread.start(); - waitForExecutionToStart("sdncAdapter", 3); - String pid = getPid(); - assertProcessInstanceNotFinished(pid); - - //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing"); - String badRequestId = "This is not the RequestId that was used"; - CallbackHeader callbackHeader = new CallbackHeader(); - callbackHeader.setRequestId(badRequestId); - callbackHeader.setResponseCode("200"); - callbackHeader.setResponseMessage("OK"); - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); - sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); - sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData); - SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); - callbackService.setProcessEngineServices4junit(processEngineRule); - SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); - //System.out.println("Back from executing process again"); - - assertTrue(sdncAdapterResponse instanceof SDNCAdapterErrorResponse); - assertTrue(((SDNCAdapterErrorResponse) sdncAdapterResponse).getError().contains("No process is waiting for sdncAdapterCallbackRequest")); - assertProcessInstanceNotFinished(pid); - - //System.out.println("SDNCAdapter bad RequestId test Completed!"); - } - - @Test - @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericNotificationService.bpmn" - }) - public void badSynchronousResponse() throws IOException, InterruptedException { - - mockSDNCAdapter(404); - - //System.out.println("SDNCAdapter bad synchronous response flow Started!"); - - ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest); - thread.start(); - while (thread.isAlive()) { - Thread.sleep(200); - } - WorkflowResponse response = thread.workflowResponse; - Assert.assertNotNull(response); - Assert.assertEquals("404 error", response.getMessageCode(),7000); -// assertProcessInstanceFinished(response.getProcessInstanceId()); - //System.out.println("SDNCAdapter bad synchronous response flow Completed!"); - } - - @Test - @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericNotificationService.bpmn" - }) - public void sdncNotFound() throws IOException, InterruptedException { - mockSDNCAdapter(200); - mockSDNCAdapter("/sdncAdapterMock/404", 400, "sdncCallbackErrorResponse.xml"); - - ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest); - thread.start(); - waitForExecutionToStart("sdncAdapter", 3); - String pid = getPid(); - - //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing"); - String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId"); - CallbackHeader callbackHeader = new CallbackHeader(); - callbackHeader.setRequestId(generatedRequestId); - callbackHeader.setResponseCode("404"); - callbackHeader.setResponseMessage("Error processing request to SDNC. Not Found. https://sdncodl.it.us.aic.cip.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET. SDNC Returned-[error-type:application, error-tag:data-missing, error-message:Request could not be completed because the relevant data model content does not exist.]"); - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); - sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); - SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); - callbackService.setProcessEngineServices4junit(processEngineRule); - SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); - //System.out.println("Back from executing process again"); - - assertProcessInstanceFinished(pid); - assertNotNull(sdncAdapterResponse); - //TODO query history to see SDNCA_ResponseCode, SDNCA_ErrorResponse - //System.out.println("SDNCAdapter SDNC Notfound test Completed!"); - } - - @Test - @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericNotificationService.bpmn" - }) - public void asynchronousMessageTimeout() throws IOException, InterruptedException { - mockSDNCAdapter(200); - //System.out.println("SDNCAdapter asynchronous message timeout flow Started!"); - ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest); - thread.start(); - waitForExecutionToStart("sdncAdapter", 3); - checkForTimeout(getPid()); - } - - private void checkForTimeout(String pid) throws InterruptedException { - - assertProcessInstanceNotFinished(pid); - - ProcessEngineConfigurationImpl processEngineConfiguration = - (ProcessEngineConfigurationImpl) processEngineRule.getProcessEngine().getProcessEngineConfiguration(); - assertTrue(processEngineConfiguration.getJobExecutor().isActive()); - - Job timerJob = processEngineRule.getManagementService().createJobQuery().processInstanceId(pid).singleResult(); - assertNotNull(timerJob); - - processEngineRule.getManagementService().executeJob(timerJob.getId()); - - assertProcessInstanceFinished(pid); - - //System.out.println("SDNCAdapter asynchronous message timeout flow Completed!"); - } - - class ProcessExecutionThread extends Thread { - - private String workflowRequest; - private WorkflowResponse workflowResponse; - - public ProcessExecutionThread(String workflowRequest) { - this.workflowRequest = workflowRequest; - } - - public void run() { - workflowResponse = invokeFlow(workflowRequest); - workflowResponse.getProcessInstanceId(); - } - } - - private String getPid() { - return processEngineRule.getHistoryService().createHistoricProcessInstanceQuery().list().get(0).getId(); - } - - private Object getVariable(String pid, String variableName) { - try { - return - processEngineRule - .getHistoryService() - .createHistoricVariableInstanceQuery() - .processInstanceId(pid).variableName(variableName) - .singleResult() - .getValue(); - } catch(Exception ex) { - return null; - } - } - - private void assertProcessInstanceFinished(String pid) { - assertEquals(1, processEngineRule.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count()); - } - - private void assertProcessInstanceNotFinished(String pid) { - assertEquals(0, processEngineRule.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count()); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SPIPropertiesTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SPIPropertiesTest.java deleted file mode 100644 index e9a5492b6f..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SPIPropertiesTest.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.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; - -import java.io.FileNotFoundException; -import java.io.IOException; - -import org.junit.BeforeClass; -import org.junit.Test; -import org.openecomp.mso.client.RestPropertiesLoader; -import org.openecomp.mso.client.aai.AAIProperties; -import org.openecomp.mso.client.dmaap.DmaapProperties; -import org.openecomp.mso.client.dmaap.DmaapPropertiesLoader; -import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer; - -public class SPIPropertiesTest { - - @BeforeClass - public static void beforeClass() { - System.setProperty("mso.config.path", "src/test/resources"); - } - - @Test - public void notEqual() { - DmaapProperties one = DmaapPropertiesLoader.getInstance().getNewImpl(); - DmaapProperties two = DmaapPropertiesLoader.getInstance().getNewImpl(); - assertNotEquals(one, two); - } - @Test - public void equal() { - DmaapProperties one = DmaapPropertiesLoader.getInstance().getImpl(); - DmaapProperties two = DmaapPropertiesLoader.getInstance().getImpl(); - assertEquals(one, two); - } - @Test - public void restNotEqual() { - AAIProperties one = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class); - AAIProperties two = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class); - assertNotEquals(one, two); - } - @Test - public void restEqual() { - AAIProperties one = RestPropertiesLoader.getInstance().getImpl(AAIProperties.class); - AAIProperties two = RestPropertiesLoader.getInstance().getImpl(AAIProperties.class); - assertEquals(one, two); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SniroHomingTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SniroHomingTest.java deleted file mode 100644 index 314d4d3b42..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SniroHomingTest.java +++ /dev/null @@ -1,548 +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========================================================= - */ - -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -package org.openecomp.mso.bpmn.common; - -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid; -import static org.openecomp.mso.bpmn.mock.StubResponseSNIRO.*; -import static org.junit.Assert.*; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; - -import org.openecomp.mso.bpmn.core.WorkflowException; -import org.openecomp.mso.bpmn.core.domain.*; -import org.openecomp.mso.bpmn.mock.FileUtil; - - -/** - * Test the SNIRO Homing subflow building block. - */ -public class SniroHomingTest extends WorkflowTest { - - ServiceDecomposition serviceDecomposition = new ServiceDecomposition(); - String subscriber = ""; - String subscriber2 = ""; - - private final CallbackSet callbacks = new CallbackSet(); - - public SniroHomingTest() throws IOException { - String sniroCallback = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf"); - String sniroCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf2Net"); - String sniroCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackInfraVnf"); - String sniroCallbackNoSolution = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackNoSolutionFound"); - String sniroCallbackPolicyException = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackPolicyException"); - String sniroCallbackServiceException = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackServiceException"); - callbacks.put("sniro", JSON, "SNIROResponse", sniroCallback); - callbacks.put("sniro2", JSON, "SNIROResponse", sniroCallback2); - callbacks.put("sniro3", JSON, "SNIROResponse", sniroCallback3); - callbacks.put("sniroNoSol", JSON, "SNIROResponse", sniroCallbackNoSolution); - callbacks.put("sniroPolicyEx", JSON, "SNIROResponse", sniroCallbackPolicyException); - callbacks.put("sniroServiceEx", JSON, "SNIROResponse", sniroCallbackServiceException); - - // Service Model - ModelInfo sModel = new ModelInfo(); - sModel.setModelCustomizationUuid("testModelCustomizationUuid"); - sModel.setModelInstanceName("testModelInstanceName"); - sModel.setModelInvariantUuid("testModelInvariantId"); - sModel.setModelName("testModelName"); - sModel.setModelUuid("testModelUuid"); - sModel.setModelVersion("testModelVersion"); - // Service Instance - ServiceInstance si = new ServiceInstance(); - si.setInstanceId("testServiceInstanceId123"); - // Allotted Resources - List arList = new ArrayList(); - AllottedResource ar = new AllottedResource(); - ar.setResourceId("testResourceIdAR"); - ar.setResourceInstanceName("testARInstanceName"); - ModelInfo arModel = new ModelInfo(); - arModel.setModelCustomizationUuid("testModelCustomizationUuidAR"); - arModel.setModelInvariantUuid("testModelInvariantIdAR"); - arModel.setModelName("testModelNameAR"); - arModel.setModelVersion("testModelVersionAR"); - arModel.setModelUuid("testARModelUuid"); - arModel.setModelType("testModelTypeAR"); - ar.setModelInfo(arModel); - AllottedResource ar2 = new AllottedResource(); - ar2.setResourceId("testResourceIdAR2"); - ar2.setResourceInstanceName("testAR2InstanceName"); - ModelInfo arModel2 = new ModelInfo(); - arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2"); - arModel2.setModelInvariantUuid("testModelInvariantIdAR2"); - arModel2.setModelName("testModelNameAR2"); - arModel2.setModelVersion("testModelVersionAR2"); - arModel2.setModelUuid("testAr2ModelUuid"); - arModel2.setModelType("testModelTypeAR2"); - ar2.setModelInfo(arModel2); - arList.add(ar); - arList.add(ar2); - // Vnfs - List vnfList = new ArrayList(); - VnfResource vnf = new VnfResource(); - vnf.setResourceId("testResourceIdVNF"); - vnf.setResourceInstanceName("testVnfInstanceName"); - ModelInfo vnfModel = new ModelInfo(); - vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF"); - vnfModel.setModelInvariantUuid("testModelInvariantIdVNF"); - vnfModel.setModelName("testModelNameVNF"); - vnfModel.setModelVersion("testModelVersionVNF"); - vnfModel.setModelUuid("testVnfModelUuid"); - vnfModel.setModelType("testModelTypeVNF"); - vnf.setModelInfo(vnfModel); - vnfList.add(vnf); - System.out.println("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString()); - serviceDecomposition.setModelInfo(sModel); - serviceDecomposition.setServiceAllottedResources(arList); - serviceDecomposition.setServiceVnfs(vnfList); - serviceDecomposition.setServiceInstance(si); - - // Subscriber - subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}"; - subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}"; - } - - @Test - @Ignore // 1802 merge - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_success_2AR1Vnf() throws Exception { - - mockSNIRO(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "sniro"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition"); - String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest"); - - Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); - HomingSolution resourceARHoming = resourceAR.getHomingSolution(); - Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); - HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution(); - Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); - HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution(); - String resourceARHomingString = resourceARHoming.toString(); - resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); - String resourceARHoming2String = resourceARHoming2.toString(); - resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); - String resourceVNFHomingString = resourceVNFHoming.toString(); - resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); - expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", ""); - - assertNull(workflowException); - assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString); - assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String); - assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString); - assertEquals(verifySniroRequest(), expectedSniroRequest); - - } - - @Test - @Ignore // 1802 merge - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_success_2AR1Vnf2Net() throws Exception { - - mockSNIRO(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables2(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "sniro2"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition"); - String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest"); - - Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); - HomingSolution resourceARHoming = resourceAR.getHomingSolution(); - Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); - HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution(); - Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); - HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution(); - Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet"); - HomingSolution resourceNetHoming = resourceNet.getHomingSolution(); - Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2"); - HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution(); - - String resourceARHomingString = resourceARHoming.toString(); - resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); - String resourceARHoming2String = resourceARHoming2.toString(); - resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); - String resourceVNFHomingString = resourceVNFHoming.toString(); - resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); - String resourceNetHomingString = resourceNetHoming.toString(); - resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " "); - String resourceNetHoming2String = resourceNetHoming2.toString(); - resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " "); - expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", ""); - - assertNull(workflowException); - assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString); - assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String); - assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString); - assertEquals(homingSolutionService("service", "testServiceInstanceIdNet", "testVnfHostNameNet", "aic", "testCloudRegionIdNet", "testAicClliNet", "3.0", null, null), resourceNetHomingString); - assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionIdNet2", "testAicClliNet2", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"", "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""), resourceNetHoming2String); - assertEquals(verifySniroRequest(), expectedSniroRequest); - } - - @Test - @Ignore // 1802 merge - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/BuildingBlock/DecomposeService.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_success_vnfResourceList() throws Exception { - - // Create a Service Decomposition - MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4", "/BuildingBlocks/catalogResp.json"); - String busKey = UUID.randomUUID().toString(); - Map vars = new HashMap<>(); - setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff"); - invokeSubProcess("DecomposeService", busKey, vars); - - ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition"); - List vnfResourceList = sd.getServiceVnfs(); - vnfResourceList.get(0).setResourceId("test-resource-id-000"); - - // Invoke Homing - - mockSNIRO(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("homingService", "sniro"); - variables.put("isDebugLogEnabled", "true"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId"); - variables.put("serviceDecomposition", sd); - variables.put("subscriberInfo", subscriber2); - - invokeSubProcess("Homing", businessKey, variables); - injectWorkflowMessages(callbacks, "sniro3"); - waitForProcessEnd(businessKey, 10000); - - //Get Variables - - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition"); - - Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000"); - HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution(); - - String resourceVnfHomingString = resourceVnfHoming.toString(); - resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " "); - - assertNull(workflowException); - - //Verify request - String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest"); - assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/sniroRequest_infravnf").replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""), sniroRequest.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", "")); - - assertEquals(homingSolutionService("service", "service-instance-01234", "MDTNJ01", "att-aic", "mtmnj1a", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString); - } - - @Test - @Ignore // 1802 merge - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_success_existingLicense() throws Exception { - - mockSNIRO(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap(); - setVariablesExistingLicense(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "sniro"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition"); - String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest"); - - Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); - HomingSolution resourceARHoming = resourceAR.getHomingSolution(); - Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); - HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution(); - Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); - HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution(); - String resourceARHomingString = resourceARHoming.toString(); - resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); - String resourceARHoming2String = resourceARHoming2.toString(); - resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); - String resourceVNFHomingString = resourceVNFHoming.toString(); - resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); - sniroRequest = sniroRequest.replaceAll("\\s+", ""); - - assertNull(workflowException); - assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString); - assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String); - assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString); - assertEquals(verifySniroRequest_existingLicense(), sniroRequest); - - } - - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_error_inputVariable() throws Exception { - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables3(variables); - - invokeSubProcess("Homing", businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - - assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required input variable is missing or null]", workflowException.toString()); - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_error_badResponse() throws Exception { - mockSNIRO_500(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("Homing", businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - - assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a Bad Sync Response from Sniro/OOF.]", workflowException.toString()); - } - - @Test - @Ignore // 1802 merge - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_error_sniroNoSolution() throws Exception { - mockSNIRO(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "sniroNoSol"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - - assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString()); - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_error_sniroPolicyException() throws Exception { - mockSNIRO(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "sniroPolicyEx"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - - assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Policy Exception: Message content size exceeds the allowable limit]", workflowException.toString()); - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_error_sniroServiceException() throws Exception { - mockSNIRO(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "sniroServiceEx"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - - assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Service Exception: SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]", workflowException.toString()); - } - - - - private void setVariables(Map variables) { - variables.put("homingService", "sniro"); - variables.put("isDebugLogEnabled", "true"); - // variables.put("mso-request-id", "testRequestId"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId"); - variables.put("serviceDecomposition", serviceDecomposition); - variables.put("subscriberInfo", subscriber2); - - } - - private void setVariables2(Map variables) { - List netList = new ArrayList(); - NetworkResource net = new NetworkResource(); - net.setResourceId("testResourceIdNet"); - ModelInfo netModel = new ModelInfo(); - netModel.setModelCustomizationUuid("testModelCustomizationUuidNet"); - netModel.setModelInvariantUuid("testModelInvariantIdNet"); - netModel.setModelName("testModelNameNet"); - netModel.setModelVersion("testModelVersionNet"); - net.setModelInfo(netModel); - netList.add(net); - NetworkResource net2 = new NetworkResource(); - net2.setResourceId("testResourceIdNet2"); - ModelInfo netModel2 = new ModelInfo(); - netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2"); - netModel2.setModelInvariantUuid("testModelInvariantIdNet2"); - netModel2.setModelName("testModelNameNet2"); - netModel2.setModelVersion("testModelVersionNet2"); - net2.setModelInfo(netModel2); - netList.add(net2); - serviceDecomposition.setServiceNetworks(netList); - - variables.put("homingService", "sniro"); - variables.put("isDebugLogEnabled", "true"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId"); - variables.put("serviceDecomposition", serviceDecomposition); - variables.put("subscriberInfo", subscriber2); - } - - private void setVariables3(Map variables) { - variables.put("homingService", "sniro"); - variables.put("isDebugLogEnabled", "true"); - // variables.put("mso-request-id", "testRequestId"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId"); - variables.put("serviceDecomposition", null); - variables.put("subscriberInfo", subscriber2); - - } - - private void setVariablesExistingLicense(Map variables) { - HomingSolution currentHomingSolution = new HomingSolution(); - serviceDecomposition.getServiceVnfs().get(0).setCurrentHomingSolution(currentHomingSolution); - serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1"); - serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2"); - - serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1"); - serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2"); - - variables.put("isDebugLogEnabled", "true"); - // variables.put("mso-request-id", "testRequestId"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId"); - variables.put("serviceDecomposition", serviceDecomposition); - variables.put("subscriberInfo", subscriber2); - - } - - private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname, String cloudOwner, String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList){ - String solution = ""; - if(enList == null){ - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { }, \"rehome\" : false } }"; - }else{ - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }"; - } - return solution; - } - - private String homingSolutionCloud(String type, String serviceInstanceId, String vnfHostname, String cloudOwner, String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList){ - String solution = ""; - if(enList == null){ - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { }, \"rehome\" : false } }"; - }else{ - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }"; - } - return solution; - } - - private void setVariablesForServiceDecomposition(Map variables, String requestId, String siId) { - variables.put("homingService", "sniro"); - variables.put("isDebugLogEnabled", "true"); - variables.put("mso-request-id", requestId); - variables.put("msoRequestId", requestId); - variables.put("serviceInstanceId",siId); - - String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," + - "\"modelInvariantUuid\": \"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\"," + - "\"modelUuid\": \"2f7f309d-c842-4644-a2e4-34167be5eeb4\"," + - "\"modelName\": \"ADIOD vRouter vCE 011017 Service\"," + - "\"modelVersion\": \"5.0\"," + - "}"; - variables.put("serviceModelInfo", serviceModelInfo); - } - - private String verifySniroRequest(){ - String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"initial\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placement\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}"; - return request; - } - - private String verifySniroRequest_existingLicense(){ - String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placement\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"},\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\",\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\",\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}"; - return request; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java deleted file mode 100644 index 7c557ffe63..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java +++ /dev/null @@ -1,175 +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.bpmn.common; - -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModuleBadPatch; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf_Bad; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.core.WorkflowException; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit tests for UpdateAAIGenericVnf bpmn. - */ -public class UpdateAAIGenericVnfTest extends WorkflowTest { - - /** - * Test the happy path through the flow. - */ - @Test - @Deployment(resources = { - "subprocess/UpdateAAIGenericVnf.bpmn" - }) - public void happyPath() throws IOException { - logStart(); - - String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockPutGenericVnf("/skask", 200); - MockPatchGenericVnf("skask"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "999-99-9999"); - variables.put("isDebugLogEnabled","true"); - variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest); - invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables); - - Assert.assertTrue(isProcessEnded(businessKey)); - String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse"); - Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode"); - System.out.println("Subflow response code: " + responseCode); - System.out.println("Subflow response: " + response); - Assert.assertEquals(200, responseCode.intValue()); - - logEnd(); - } - - /** - * Test the happy path through the flow. - */ - @Test - @Deployment(resources = { - "subprocess/UpdateAAIGenericVnf.bpmn" - }) - public void personaMismatch() throws IOException { - - logStart(); - - String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); - updateAAIGenericVnfRequest = updateAAIGenericVnfRequest.replaceFirst("introvert", "extrovert"); - - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "999-99-9999"); - variables.put("isDebugLogEnabled","true"); - variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest); - invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables); - - Assert.assertTrue(isProcessEnded(businessKey)); - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - System.out.println("Workflow Exception: " + workflowException); - Assert.assertNotNull(workflowException); - - logEnd(); - } - - /** - * Test the case where the GET to AAI returns a 404. - */ - @Test - @Deployment(resources = { - "subprocess/UpdateAAIGenericVnf.bpmn" - }) - public void badGet() throws IOException { - - logStart(); - - String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); - - MockGetGenericVnfById_404("skask[?]depth=1"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "999-99-9999"); - variables.put("isDebugLogEnabled","true"); - variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest); - invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables); - - Assert.assertTrue(isProcessEnded(businessKey)); - String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponse"); - Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponseCode"); - System.out.println("Subflow response code: " + responseCode); - System.out.println("Subflow response: " + response); - Assert.assertEquals(404, responseCode.intValue()); - - logEnd(); - } - - /** - * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404. - */ - @Test - @Deployment(resources = { - "subprocess/UpdateAAIGenericVnf.bpmn" - }) - public void badPatch() throws IOException { - - logStart(); - - String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); - - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockPutGenericVnf_Bad("skask", 404); - MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask", 404); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "999-99-9999"); - variables.put("isDebugLogEnabled","true"); - variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest); - invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables); - - Assert.assertTrue(isProcessEnded(businessKey)); - String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse"); - Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode"); - System.out.println("Subflow response code: " + responseCode); - System.out.println("Subflow response: " + response); - Assert.assertEquals(404, responseCode.intValue()); - - logEnd(); - } -} - diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java deleted file mode 100644 index 30d7e6d8c6..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java +++ /dev/null @@ -1,141 +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.bpmn.common; - -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModuleBadPatch; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit tests for UpdateAAIVfModuleTest.bpmn. - */ -public class UpdateAAIVfModuleTest extends WorkflowTest { - - /** - * Test the happy path through the flow. - */ - @Test - @Deployment(resources = { - "subprocess/UpdateAAIVfModule.bpmn" - }) - public void happyPath() throws IOException { - logStart(); - - String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); - MockGetGenericVnfByIdWithPriority("/skask/vf-modules/vf-module/supercool", 200, "VfModularity/VfModule-supercool.xml"); - MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200); - MockPatchVfModuleId("skask", "supercool"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "999-99-9999"); - variables.put("isDebugLogEnabled","true"); - variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest); - invokeSubProcess("UpdateAAIVfModule", businessKey, variables); - - Assert.assertTrue(isProcessEnded(businessKey)); - String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse"); - Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode"); - System.out.println("Subflow response code: " + responseCode); - System.out.println("Subflow response: " + response); - Assert.assertEquals(200, responseCode.intValue()); - - logEnd(); - } - - /** - * Test the case where the GET to AAI returns a 404. - */ - @Test - @Deployment(resources = { - "subprocess/UpdateAAIVfModule.bpmn" - }) - public void badGet() throws IOException { - - logStart(); - - String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); - MockGetGenericVnfById("/skask/vf-modules/vf-module/.*", "VfModularity/VfModule-supercool.xml", 404); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "999-99-9999"); - variables.put("isDebugLogEnabled","true"); - variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest); - invokeSubProcess("UpdateAAIVfModule", businessKey, variables); - - Assert.assertTrue(isProcessEnded(businessKey)); - String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponse"); - Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponseCode"); - System.out.println("Subflow response code: " + responseCode); - System.out.println("Subflow response: " + response); - Assert.assertEquals(404, responseCode.intValue()); - - logEnd(); - } - - /** - * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404. - */ - @Test - @Deployment(resources = { - "subprocess/UpdateAAIVfModule.bpmn" - }) - public void badPatch() throws IOException { - - logStart(); - - String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); - MockGetGenericVnfById_404("/skask/vf-modules/vf-module/supercool"); - MockGetGenericVnfById("/skask/vf-modules/vf-module/supercool", "VfModularity/VfModule-supercool.xml", 200); - MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "999-99-9999"); - variables.put("isDebugLogEnabled","true"); - variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest); - invokeSubProcess("UpdateAAIVfModule", businessKey, variables); - - Assert.assertTrue(isProcessEnded(businessKey)); - String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse"); - Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode"); - System.out.println("Subflow response code: " + responseCode); - System.out.println("Subflow response: " + response); - Assert.assertEquals(404, responseCode.intValue()); - - logEnd(); - } -} - diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java deleted file mode 100644 index ea49176df0..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java +++ /dev/null @@ -1,390 +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.bpmn.common; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPost; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFRollbackDelete; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.core.WorkflowException; - -/** - * Unit tests for VnfAdapterRestV1. - */ -public class VnfAdapterRestV1Test extends WorkflowTest { - - private static final String EOL = "\n"; - - private final CallbackSet callbacks = new CallbackSet(); - - private final String CREATE_VF_MODULE_REQUEST = - "" + EOL + - " cloudSiteId" + EOL + - " tenantId" + EOL + - " vnfId" + EOL + - " vfModuleName" + EOL + - " vfModuleId" + EOL + - " vnfType" + EOL + - " vnfVersion" + EOL + - " vfModuleType" + EOL + - " volumeGroupId" + EOL + - " volumeGroupStackId" + EOL + - " baseVfModuleId" + EOL + - " baseVfModuleStackId" + EOL + - " true" + EOL + - " false" + EOL + - " true" + EOL + - " " + EOL + - " " + EOL + - " key1" + EOL + - " value1" + EOL + - " " + EOL + - " " + EOL + - " key2" + EOL + - " value2" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " requestId" + EOL + - " serviceInstanceId" + EOL + - " " + EOL + - " {{MESSAGE-ID}}" + EOL + - " http://localhost:28080/mso/WorkflowMessage" + EOL + - "" + EOL; - - private final String UPDATE_VF_MODULE_REQUEST = - "" + EOL + - " cloudSiteId" + EOL + - " tenantId" + EOL + - " vnfId" + EOL + - " vfModuleName" + EOL + - " vfModuleId" + EOL + - " vfModuleStackId" + EOL + - " vnfType" + EOL + - " vnfVersion" + EOL + - " vfModuleType" + EOL + - " volumeGroupId" + EOL + - " volumeGroupStackId" + EOL + - " baseVfModuleId" + EOL + - " baseVfModuleStackId" + EOL + - " true" + EOL + - " false" + EOL + - " true" + EOL + - " " + EOL + - " " + EOL + - " key1" + EOL + - " value1" + EOL + - " " + EOL + - " " + EOL + - " key2" + EOL + - " value2" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " requestId" + EOL + - " serviceInstanceId" + EOL + - " " + EOL + - " {{MESSAGE-ID}}" + EOL + - " http://localhost:28080/mso/WorkflowMessage" + EOL + - "" + EOL; - - private final String DELETE_VF_MODULE_REQUEST = - "" + EOL + - " cloudSiteId" + EOL + - " tenantId" + EOL + - " vnfId" + EOL + - " vfModuleId" + EOL + - " vfModuleStackId" + EOL + - " true" + EOL + - " " + EOL + - " requestId" + EOL + - " serviceInstanceId" + EOL + - " " + EOL + - " {{MESSAGE-ID}}" + EOL + - " http://localhost:28080/mso/WorkflowMessage" + EOL + - "" + EOL; - - private final String ROLLBACK_VF_MODULE_REQUEST = - "" + EOL + - " {{MESSAGE-ID}}" + EOL + - " http://localhost:28080/mso/WorkflowMessage" + EOL + - " true" + EOL + - " " + EOL + - " cloudSiteId" + EOL + - " tenantId" + EOL + - " vnfId" + EOL + - " vfModuleId" + EOL + - " vfModuleStackId" + EOL + - " " + EOL + - " requestId" + EOL + - " serviceInstanceId" + EOL + - " " + EOL + - " {{MESSAGE-ID}}" + EOL + - " true" + EOL + - " " + EOL + - "" + EOL; - - public VnfAdapterRestV1Test() throws IOException { - callbacks.put("createVfModule", - "" + EOL + - " vnfId" + EOL + - " vfModuleId" + EOL + - " vfModuleStackId" + EOL + - " true" + EOL + - " " + EOL + - " " + EOL + - " key1" + EOL + - " value1" + EOL + - " " + EOL + - " " + EOL + - " key2" + EOL + - " value2" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " vnfId" + EOL + - " vfModuleId" + EOL + - " vfModuleStackId" + EOL + - " true" + EOL + - " tenantId" + EOL + - " cloudSiteId" + EOL + - " " + EOL + - " requestId" + EOL + - " serviceInstanceId" + EOL + - " " + EOL + - " messageId" + EOL + - " " + EOL + - " {{MESSAGE-ID}}" + EOL + - "" + EOL); - - callbacks.put("updateVfModule", - "" + EOL + - " vnfId" + EOL + - " vfModuleId" + EOL + - " vfModuleStackId" + EOL + - " " + EOL + - " " + EOL + - " key1" + EOL + - " value1" + EOL + - " " + EOL + - " " + EOL + - " key2" + EOL + - " value2" + EOL + - " " + EOL + - " " + EOL + - " {{MESSAGE-ID}}" + EOL + - "" + EOL); - - callbacks.put("deleteVfModule", - "" + EOL + - " vnfId" + EOL + - " vfModuleId" + EOL + - " true" + EOL + - " {{MESSAGE-ID}}" + EOL + - "" + EOL); - - callbacks.put("rollbackVfModule", - "" + EOL + - " {{MESSAGE-ID}}" + EOL + - " true" + EOL + - "" + EOL); - - callbacks.put("vfModuleException", - "" + EOL + - " message" + EOL + - " category" + EOL + - " false" + EOL + - " {{MESSAGE-ID}}" + EOL + - "" + EOL); - } - - @Test - @Deployment(resources = { - "subprocess/VnfAdapterRestV1.bpmn" - }) - public void testCreateVfModuleSuccess() throws Exception { - logStart(); - - mockVNFPost("", 202, "vnfId"); - - String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; - String messageId = requestId + "-" + System.currentTimeMillis(); - String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", requestId); - variables.put("isDebugLogEnabled", "true"); - variables.put("vnfAdapterRestV1Request", request); - - invokeSubProcess("vnfAdapterRestV1", businessKey, variables); - injectVNFRestCallbacks(callbacks, "createVfModule"); - waitForProcessEnd(businessKey, 10000); - - String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); - System.out.println("Response:\n" + response); - assertTrue(response!=null && response.contains("")); - assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); - - logEnd(); - } - - @Test - @Deployment(resources = { - "subprocess/VnfAdapterRestV1.bpmn" - }) - public void testUpdateVfModuleSuccess() throws Exception { - logStart(); - - mockVNFPut("/vfModuleId", 202); - - String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; - String messageId = requestId + "-" + System.currentTimeMillis(); - String request = UPDATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", requestId); - variables.put("isDebugLogEnabled", "true"); - variables.put("vnfAdapterRestV1Request", request); - - invokeSubProcess("vnfAdapterRestV1", businessKey, variables); - injectVNFRestCallbacks(callbacks, "updateVfModule"); - waitForProcessEnd(businessKey, 10000); - - String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); - System.out.println("Response:\n" + response); - assertTrue(response.contains("")); - assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); - - logEnd(); - } - - @Test - @Deployment(resources = { - "subprocess/VnfAdapterRestV1.bpmn" - }) - public void testDeleteVfModuleSuccess() throws Exception { - logStart(); - - mockVNFDelete("vnfId", "/vfModuleId", 202); - - String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; - String messageId = requestId + "-" + System.currentTimeMillis(); - String request = DELETE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", requestId); - variables.put("isDebugLogEnabled", "true"); - variables.put("vnfAdapterRestV1Request", request); - - invokeSubProcess("vnfAdapterRestV1", businessKey, variables); - injectVNFRestCallbacks(callbacks, "deleteVfModule"); - waitForProcessEnd(businessKey, 10000); - - String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); - System.out.println("Response:\n" + response); - assertTrue(response.contains("")); - assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); - - logEnd(); - } - - @Test - @Deployment(resources = { - "subprocess/VnfAdapterRestV1.bpmn" - }) - public void testRollbackVfModuleSuccess() throws Exception { - logStart(); - - mockVNFRollbackDelete("/vfModuleId", 202); - - String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; - String messageId = requestId + "-" + System.currentTimeMillis(); - String request = ROLLBACK_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", requestId); - variables.put("isDebugLogEnabled", "true"); - variables.put("vnfAdapterRestV1Request", request); - - invokeSubProcess("vnfAdapterRestV1", businessKey, variables); - injectVNFRestCallbacks(callbacks, "rollbackVfModule"); - waitForProcessEnd(businessKey, 10000); - - String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); - System.out.println("Response:\n" + response); - assertTrue(response.contains("")); - assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); - - logEnd(); - } - - @Test - @Deployment(resources = { - "subprocess/VnfAdapterRestV1.bpmn" - }) - public void testCreateVfModuleException() throws Exception { - logStart(); - - mockVNFPost("", 202, "vnfId"); - - String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; - String messageId = requestId + "-" + System.currentTimeMillis(); - String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", requestId); - variables.put("isDebugLogEnabled", "true"); - variables.put("vnfAdapterRestV1Request", request); - - invokeSubProcess("vnfAdapterRestV1", businessKey, variables); - injectVNFRestCallbacks(callbacks, "vfModuleException"); - waitForProcessEnd(businessKey, 10000); - - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - assertNotNull(wfe); - System.out.println(wfe.toString()); - - String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse"); - System.out.println("Response:\n" + response); - assertTrue(response.contains("")); - assertFalse((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); - - logEnd(); - } -} - diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java deleted file mode 100644 index 5562cb80ae..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.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.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.camunda.bpm.engine.variable.impl.VariableMapImpl; -import org.jboss.resteasy.spi.AsynchronousResponse; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; - -public class WorkflowAsyncResourceTest extends WorkflowTest { - - @Test - @Deployment(resources = { "testAsyncResource.bpmn" }) - public void asyncRequestSuccess() throws InterruptedException { - //it can be any request which asynchronously processed by the workflow - String request = " SDN-ETHERNET-INTERNET HI/VLXM/950604//SW_INTERNET SubName01 "; - - Map variables = new HashMap<>(); - variables.put("testAsyncRequestMsg", request); - variables.put("mso-request-id", UUID.randomUUID().toString()); - variables.put("mso-service-request-timeout", "5"); - - WorkflowResponse workflowResponse = BPMNUtil.executeAsyncWorkflow(processEngineRule, "testAsyncProcess", variables); - assertEquals("Received the request, the process is getting executed, request message SDN-ETHERNET-INTERNET HI/VLXM/950604//SW_INTERNET SubName01 ", workflowResponse.getContent()); - assertEquals(200, workflowResponse.getMessageCode()); - } - - private void executeWorkflow(String request, String requestId, AsynchronousResponse asyncResponse, String processKey) { - WorkflowAsyncResource workflowResource = new WorkflowAsyncResource(); - VariableMapImpl variableMap = new VariableMapImpl(); - - Map variableValueType = new HashMap<>(); - - Map requestMsg = new HashMap<>(); - requestMsg.put("value", request); - requestMsg.put("type", "String"); - - Map msorequestId = new HashMap<>(); - msorequestId.put("type", "String"); - msorequestId.put("value",requestId); - - Map timeout = new HashMap<>(); - timeout.put("type", "String"); - timeout.put("value","5"); - - variableValueType.put("testAsyncRequestMsg", requestMsg); - variableValueType.put("mso-request-id", msorequestId); - variableValueType.put("mso-service-request-timeout", timeout); - - variableMap.put("variables", variableValueType); - - workflowResource.setProcessEngineServices4junit(processEngineRule); - workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMap); - } - - class ProcessThread extends Thread { - - public WorkflowResponse workflowResponse; - public String requestId; - public String processKey; - public AsynchronousResponse asyncResponse = mock(AsynchronousResponse.class); - public String request; - public boolean started; - public void run() { - started = true; - executeWorkflow(request, requestId, asyncResponse, processKey); - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java deleted file mode 100644 index de346d2dbe..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java +++ /dev/null @@ -1,97 +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.bpmn.common; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -import java.util.UUID; - -import javax.ws.rs.core.Response; - -import org.jboss.resteasy.spi.AsynchronousResponse; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowCallbackResponse; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowContext; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowContextHolder; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; - -public class WorkflowContextHolderTest { - - private WorkflowContext createContext(AsynchronousResponse asyncResponse) { - WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); - String requestId = UUID.randomUUID().toString(); - WorkflowContext workflowContext = new WorkflowContext("testAsyncProcess", - requestId, asyncResponse, 1000L); - contextHolder.put(workflowContext); - return workflowContext; - } - - @Test - @Ignore // BROKEN TEST (previously ignored) - public void testContextExpiry() throws InterruptedException { - - WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); - AsynchronousResponse asyncResponse = mock(AsynchronousResponse.class); - WorkflowContext workflowContext = createContext(asyncResponse); - String requestId = workflowContext.getRequestId(); - WorkflowContext context1 = contextHolder.getWorkflowContext(requestId); - - Assert.assertNotNull(context1); - Assert.assertEquals(requestId, context1.getRequestId()); - Assert.assertEquals(workflowContext.getProcessKey(), context1.getProcessKey()); - Assert.assertEquals(workflowContext.getStartTime(), context1.getStartTime()); - - Thread.sleep(1000); - //context should not be available after a second - WorkflowContext context2 = contextHolder.getWorkflowContext(requestId); - Assert.assertNull(context2); - } - -/* @Test - public void testProcessCallback() { - WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); - AsynchronousResponse asyncResponse = mock(AsynchronousResponse.class); - WorkflowContext workflowContext = createContext(asyncResponse); - - WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse(); - callbackResponse.setMessage("Success"); - callbackResponse.setResponse("Successfully processed request"); - callbackResponse.setStatusCode(200); - - Response response = contextHolder.processCallback("testAsyncProcess", - "process-instance-id", workflowContext.getRequestId(), - callbackResponse); - WorkflowResponse response1 = (WorkflowResponse) response.getEntity(); - Assert.assertNotNull(response1.getMessage()); - Assert.assertEquals(200,response1.getMessageCode()); - Assert.assertEquals("Success", response1.getMessage()); - Assert.assertEquals("Successfully processed request", response1.getContent()); - verify(asyncResponse).setResponse(any(Response.class)); - - WorkflowContext context1 = contextHolder.getWorkflowContext(workflowContext.getRequestId()); - Assert.assertNull(context1); - }*/ - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java deleted file mode 100644 index de25107fcc..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java +++ /dev/null @@ -1,2094 +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.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; -import static org.openecomp.mso.bpmn.core.json.JsonUtils.getJsonValue; -import static org.openecomp.mso.bpmn.core.json.JsonUtils.updJsonValue; - -import java.io.IOException; -import java.io.StringReader; -import java.lang.management.ManagementFactory; -import java.lang.management.RuntimeMXBean; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import javax.ws.rs.core.Response; -import javax.xml.bind.JAXBException; -import javax.xml.namespace.NamespaceContext; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpression; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.history.HistoricProcessInstance; -import org.camunda.bpm.engine.history.HistoricVariableInstance; -import org.camunda.bpm.engine.runtime.ProcessInstance; -import org.camunda.bpm.engine.test.ProcessEngineRule; -import org.camunda.bpm.engine.variable.impl.VariableMapImpl; -import org.custommonkey.xmlunit.DetailedDiff; -import org.custommonkey.xmlunit.XMLUnit; -import org.jboss.resteasy.spi.AsynchronousResponse; -import org.json.JSONArray; -import org.json.JSONObject; -import org.junit.Before; -import org.junit.Rule; -import org.openecomp.mso.bpmn.common.adapter.sdnc.CallbackHeader; -import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest; -import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse; -import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification; -import org.openecomp.mso.bpmn.common.adapter.vnf.DeleteVnfNotification; -import org.openecomp.mso.bpmn.common.adapter.vnf.MsoExceptionCategory; -import org.openecomp.mso.bpmn.common.adapter.vnf.MsoRequest; -import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification; -import org.openecomp.mso.bpmn.common.adapter.vnf.VnfRollback; -import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl; -import org.openecomp.mso.bpmn.common.workflow.service.VnfAdapterNotifyServiceImpl; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowMessageResource; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.core.PropertyConfigurationSetup; -import org.openecomp.mso.bpmn.core.domain.Resource; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.bpmn.core.utils.CamundaDBSetup; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -import com.github.tomakehurst.wiremock.core.WireMockConfiguration; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; -import com.github.tomakehurst.wiremock.junit.WireMockRule; - - - -/** - * A base class for Workflow tests. - *

- * WireMock response transformers may be specified by declaring public - * static fields with the @WorkflowTestTransformer annotation. For example: - *

- *     @WorkflowTestTransformer
- *     public static final ResponseTransformer sdncAdapterMockTransformer =
- *         new SDNCAdapterMockTransformer();
- * 
- */ -public class WorkflowTest { - @Rule - public final ProcessEngineRule processEngineRule = new ProcessEngineRule(); - - @Rule - public final WireMockRule wireMockRule; - - /** - * Content-Type for XML. - */ - protected static final String XML = "application/xml"; - - /** - * Content-Type for JSON. - */ - protected static final String JSON = "application/json; charset=UTF-8"; - - - /** - * Constructor. - */ - public WorkflowTest() throws RuntimeException { - // Process WorkflowTestTransformer annotations - List transformerList = new ArrayList(); - - for (Field field : getClass().getFields()) { - WorkflowTestTransformer annotation = field.getAnnotation(WorkflowTestTransformer.class); - - if (annotation == null) { - continue; - } - - if (!Modifier.isStatic(field.getModifiers())) { - throw new RuntimeException(field.getDeclaringClass().getName() - + "#" + field.getName() + " has a @WorkflowTestTransformer " - + " annotation but it is not declared static"); - } - - ResponseTransformer transformer; - - try { - transformer = (ResponseTransformer) field.get(null); - } catch (IllegalAccessException e) { - throw new RuntimeException(field.getDeclaringClass().getName() - + "#" + field.getName() + " is not accessible", e); - } catch (ClassCastException e) { - throw new RuntimeException(field.getDeclaringClass().getName() - + "#" + field.getName() + " is not a ResponseTransformer", e); - } - - if (transformer == null) { - continue; - } - - transformerList.add(transformer); - } - - ResponseTransformer[] transformerArray = - transformerList.toArray(new ResponseTransformer[transformerList.size()]); - - wireMockRule = new WireMockRule(WireMockConfiguration.wireMockConfig() - .port(28090).extensions(transformerArray)); - } - - @Before - public void testSetup() throws Exception { - CamundaDBSetup.configure(); - PropertyConfigurationSetup.init(); - } - - /** - * The current request ID. Normally set when an "invoke" method is called. - */ - protected volatile String msoRequestId = null; - - /** - * The current service instance ID. Normally set when an "invoke" method - * is called. - */ - protected volatile String msoServiceInstanceId = null; - - /** - * Logs a test start method. - */ - protected void logStart() { - StackTraceElement[] st = Thread.currentThread().getStackTrace(); - String method = st[2].getMethodName(); - System.out.println("STARTED TEST: " + method); - } - - /** - * Logs a test end method. - */ - protected void logEnd() { - StackTraceElement[] st = Thread.currentThread().getStackTrace(); - String method = st[2].getMethodName(); - System.out.println("ENDED TEST: " + method); - } - - /** - * Invokes a subprocess. - * @param processKey the process key - * @param businessKey a unique key that will identify the process instance - * @param injectedVariables variables to inject into the process - */ - protected void invokeSubProcess(String processKey, String businessKey, Map injectedVariables) { - RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); - List arguments = runtimeMxBean.getInputArguments(); - System.out.println("JVM args = " + arguments); - - msoRequestId = (String) injectedVariables.get("mso-request-id"); - String requestId = (String) injectedVariables.get("msoRequestId"); - - if (msoRequestId == null && requestId == null) { - String msg = "mso-request-id variable was not provided"; - System.out.println(msg); - fail(msg); - } - - // Note: some scenarios don't have a service-instance-id, may be null - msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id"); - - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - runtimeService.startProcessInstanceByKey(processKey, businessKey, injectedVariables); - } - - /** - * Invokes an asynchronous process. - * Errors are handled with junit assertions and will cause the test to fail. - * @param processKey the process key - * @param schemaVersion the API schema version, e.g. "v1" - * @param businessKey a unique key that will identify the process instance - * @param request the request - * @return a TestAsyncResponse object associated with the test - */ - protected TestAsyncResponse invokeAsyncProcess(String processKey, - String schemaVersion, String businessKey, String request) { - return invokeAsyncProcess(processKey, schemaVersion, businessKey, request, null); - } - - /** - * Invokes an asynchronous process. - * Errors are handled with junit assertions and will cause the test to fail. - * @param processKey the process key - * @param schemaVersion the API schema version, e.g. "v1" - * @param businessKey a unique key that will identify the process instance - * @param request the request - * @param injectedVariables optional variables to inject into the process - * @return a TestAsyncResponse object associated with the test - */ - protected TestAsyncResponse invokeAsyncProcess(String processKey, - String schemaVersion, String businessKey, String request, - Map injectedVariables) { - - RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); - List arguments = runtimeMxBean.getInputArguments(); - System.out.println("JVM args = " + arguments); - - Map variables = createVariables(schemaVersion, businessKey, - request, injectedVariables, false); - VariableMapImpl variableMapImpl = createVariableMapImpl(variables); - - System.out.println("Sending " + request + " to " + processKey + " process"); - WorkflowAsyncResource workflowResource = new WorkflowAsyncResource(); - workflowResource.setProcessEngineServices4junit(processEngineRule); - - TestAsyncResponse asyncResponse = new TestAsyncResponse(); - workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMapImpl); - return asyncResponse; - } - - /** - * Invokes an asynchronous process. - * Errors are handled with junit assertions and will cause the test to fail. - * @param processKey the process key - * @param schemaVersion the API schema version, e.g. "v1" - * @param businessKey a unique key that will identify the process instance - * @param request the request - * @param injectedVariables optional variables to inject into the process - * @param serviceInstantiationModel indicates whether this method is being - * invoked for a flow that is designed using the service instantiation model - * @return a TestAsyncResponse object associated with the test - */ - protected TestAsyncResponse invokeAsyncProcess(String processKey, - String schemaVersion, String businessKey, String request, - Map injectedVariables, boolean serviceInstantiationModel) { - - RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); - List arguments = runtimeMxBean.getInputArguments(); - System.out.println("JVM args = " + arguments); - - Map variables = createVariables(schemaVersion, businessKey, - request, injectedVariables, serviceInstantiationModel); - VariableMapImpl variableMapImpl = createVariableMapImpl(variables); - - System.out.println("Sending " + request + " to " + processKey + " process"); - WorkflowAsyncResource workflowResource = new WorkflowAsyncResource(); - workflowResource.setProcessEngineServices4junit(processEngineRule); - - TestAsyncResponse asyncResponse = new TestAsyncResponse(); - workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMapImpl); - return asyncResponse; - } - - /** - * Private helper method that creates a variable map for a request. - * Errors are handled with junit assertions and will cause the test to fail. - * @param schemaVersion the API schema version, e.g. "v1" - * @param businessKey a unique key that will identify the process instance - * @param request the request - * @param injectedVariables optional variables to inject into the process - * @param serviceInstantiationModel indicates whether this method is being - * invoked for a flow that is designed using the service instantiation model - * @return a variable map - */ - private Map createVariables(String schemaVersion, - String businessKey, String request, Map injectedVariables, - boolean serviceInstantiationModel) { - - Map variables = new HashMap<>(); - - // These variables may be overridded by injected variables. - variables.put("mso-service-request-timeout", "180"); - variables.put("isDebugLogEnabled", "true"); - - // These variables may not be overridded by injected variables. - String[] notAllowed = new String[] { - "mso-schema-version", - "mso-business-key", - "bpmnRequest", - "mso-request-id", - "mso-service-instance-id" - }; - - if (injectedVariables != null) { - for (String key : injectedVariables.keySet()) { - for (String var : notAllowed) { - if (var.equals(key)) { - String msg = "Cannot specify " + var + " in injected variables"; - System.out.println(msg); - fail(msg); - } - } - - variables.put(key, injectedVariables.get(key)); - } - } - - variables.put("mso-schema-version", schemaVersion); - variables.put("mso-business-key", businessKey); - variables.put("bpmnRequest", request); - - if (serviceInstantiationModel) { - - /* - * The request ID and the service instance ID are generated for flows - * that follow the service instantiation model unless "requestId" and - * "serviceInstanceId" are injected variables. - */ - - try { - msoRequestId = (String) injectedVariables.get("requestId"); - variables.put("mso-request-id", msoRequestId); - msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId"); - variables.put("mso-service-instance-id", msoServiceInstanceId); - } - catch(Exception e) { - } - if (msoRequestId == null || msoRequestId.trim().equals("")) { - System.out.println("No requestId element in injectedVariables"); - variables.put("mso-request-id", UUID.randomUUID().toString()); - } - if (msoServiceInstanceId == null || msoServiceInstanceId.trim().equals("")) { - System.out.println("No seviceInstanceId element in injectedVariables"); - variables.put("mso-service-instance-id", UUID.randomUUID().toString()); - } - - } else { - msoRequestId = getXMLTextElement(request, "request-id"); - - if (msoRequestId == null) { - //check in injected variables - try { - msoRequestId = (String) injectedVariables.get("requestId"); - } - catch(Exception e) { - } - if (msoRequestId == null || msoRequestId.trim().equals("")) { - String msg = "No request-id element in " + request; - System.out.println(msg); - fail(msg); - } - } - - variables.put("mso-request-id", msoRequestId); - - // Note: some request types don't have a service-instance-id - msoServiceInstanceId = getXMLTextElement(request, "service-instance-id"); - - if (msoServiceInstanceId != null) { - variables.put("mso-service-instance-id", msoServiceInstanceId); - } - } - - return variables; - } - - /** - * Private helper method that creates a camunda VariableMapImpl from a simple - * variable map. - * @param variables the simple variable map - * @return a VariableMap - */ - private VariableMapImpl createVariableMapImpl(Map variables) { - Map wrappedVariables = new HashMap<>(); - - for (String key : variables.keySet()) { - Object value = variables.get(key); - wrappedVariables.put(key, wrapVariableValue(value)); - } - - VariableMapImpl variableMapImpl = new VariableMapImpl(); - variableMapImpl.put("variables", wrappedVariables); - return variableMapImpl; - } - - /** - * Private helper method that wraps a variable value for inclusion in a - * camunda VariableMapImpl. - * @param value the variable value - * @return the wrapped variable - */ - private Map wrapVariableValue(Object value) { - HashMap valueMap = new HashMap<>(); - valueMap.put("value", value); - return valueMap; - } - - /** - * Receives a response from an asynchronous process. - * Errors are handled with junit assertions and will cause the test to fail. - * @param businessKey the process business key - * @param asyncResponse the TestAsyncResponse object associated with the test - * @param timeout the timeout in milliseconds - * @return the WorkflowResponse - */ - protected WorkflowResponse receiveResponse(String businessKey, - TestAsyncResponse asyncResponse, long timeout) { - System.out.println("Waiting " + timeout + "ms for process with business key " + businessKey - + " to send a response"); - - long now = System.currentTimeMillis() + timeout; - long endTime = now + timeout; - - while (now <= endTime) { - Response response = asyncResponse.getResponse(); - - if (response != null) { - System.out.println("Received a response from process with business key " + businessKey); - - Object entity = response.getEntity(); - - if (!(entity instanceof WorkflowResponse)) { - String msg = "Response entity is " + - (entity == null ? "null" : entity.getClass().getName()) + - ", expected WorkflowResponse"; - System.out.println(msg); - fail(msg); - return null; // unreachable - } - - return (WorkflowResponse) entity; - } - - try { - Thread.sleep(200); - } catch (InterruptedException e) { - String msg = "Interrupted waiting for a response from process with business key " + - businessKey; - System.out.println(msg); - fail(msg); - return null; // unreachable - } - - now = System.currentTimeMillis(); - } - - String msg = "No response received from process with business key " + businessKey + - " within " + timeout + "ms"; - System.out.println(msg); - fail("Process with business key " + businessKey + " did not end within 10000ms"); - return null; // unreachable - } - - /** - * Runs a program to inject SDNC callback data into the test environment. - * A program is essentially just a list of keys that identify callback data - * to be injected, in sequence. An example program: - *
-	 *     reserve, assign, delete:ERR
-	 * 
- * Errors are handled with junit assertions and will cause the test to fail. - * @param callbacks an object containing callback data for the program - * @param program the program to execute - */ - protected void injectSDNCRestCallbacks(CallbackSet callbacks, String program) { - - String[] cmds = program.replaceAll("\\s+", "").split(","); - - for (String cmd : cmds) { - String action = cmd; - String modifier = "STD"; - - if (cmd.contains(":")) { - String[] parts = cmd.split(":"); - action = parts[0]; - modifier = parts[1]; - } - - String content = null; - String contentType = null; - - if ("STD".equals(modifier)) { - CallbackData callbackData = callbacks.get(action); - - if (callbackData == null) { - String msg = "No callback defined for '" + action + "' SDNC request"; - System.out.println(msg); - fail(msg); - } - - content = callbackData.getContent(); - contentType = callbackData.getContentType(); - } else if ("ERR".equals(modifier)) { - content = "{\"SDNCServiceError\":{\"sdncRequestId\":\"((REQUEST-ID))\",\"responseCode\":\"500\",\"responseMessage\":\"SIMULATED ERROR FROM SDNC ADAPTER\",\"ackFinalIndicator\":\"Y\"}}"; - contentType = JSON; - } else { - String msg = "Invalid SDNC program modifier: '" + modifier + "'"; - System.out.println(msg); - fail(msg); - } - - if (contentType == null) { - // Default for backward compatibility with existing tests. - contentType = JSON; - } - - if (!injectSDNCRestCallback(contentType, content, 10000)) { - fail("Failed to inject SDNC '" + action + "' callback"); - } - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - fail("Interrupted after injection of SDNC '" + action + "' callback"); - } - } - } - - /** - * Runs a program to inject SDNC events into the test environment. - * A program is essentially just a list of keys that identify event data - * to be injected, in sequence. An example program: - *
-	 *     event1, event2
-	 * 
- * NOTE: Each callback must have a message type associated with it, e.g. - * "SDNCAEvent". - * Errors are handled with junit assertions and will cause the test to fail. - * @param callbacks an object containing event data for the program - * @param program the program to execute - */ - protected void injectSDNCEvents(CallbackSet callbacks, String program) { - injectWorkflowMessages(callbacks, program); - } - - /** - * Runs a program to inject SDNC callback data into the test environment. - * A program is essentially just a list of keys that identify callback data - * to be injected, in sequence. An example program: - *
-	 *     reserve, assign, delete:ERR
-	 * 
- * Errors are handled with junit assertions and will cause the test to fail. - * @param callbacks an object containing callback data for the program - * @param program the program to execute - */ - protected void injectSDNCCallbacks(CallbackSet callbacks, String program) { - - String[] cmds = program.replaceAll("\\s+", "").split(","); - - for (String cmd : cmds) { - String action = cmd; - String modifier = "STD"; - - if (cmd.contains(":")) { - String[] parts = cmd.split(":"); - action = parts[0]; - modifier = parts[1]; - } - - String content = null; - int respCode = 200; - String respMsg = "OK"; - - if ("STD".equals(modifier)) { - CallbackData callbackData = callbacks.get(action); - - if (callbackData == null) { - String msg = "No callback defined for '" + action + "' SDNC request"; - System.out.println(msg); - fail(msg); - } - - content = callbackData.getContent(); - respCode = 200; - respMsg = "OK"; - } else if ("CREATED".equals(modifier)) { - CallbackData callbackData = callbacks.get(action); - - if (callbackData == null) { - String msg = "No callback defined for '" + action + "' SDNC request"; - System.out.println(msg); - fail(msg); - } - - content = callbackData.getContent(); - respCode = 201; - respMsg = "Created"; - } else if ("ERR".equals(modifier)) { - content = "((REQUEST-ID))500SIMULATED ERROR FROM SDNC ADAPTER"; - respCode = 500; - respMsg = "SERVER ERROR"; - } else { - String msg = "Invalid SDNC program modifier: '" + modifier + "'"; - System.out.println(msg); - fail(msg); - } - - if (!injectSDNCCallback(respCode, respMsg, content, 10000)) { - fail("Failed to inject SDNC '" + action + "' callback"); - } - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - fail("Interrupted after injection of SDNC '" + action + "' callback"); - } - } - } - - /** - * Runs a program to inject VNF adapter REST callback data into the test environment. - * A program is essentially just a list of keys that identify callback data - * to be injected, in sequence. An example program: - *
-	 *     create, rollback
-	 * 
- * Errors are handled with junit assertions and will cause the test to fail. - * @param callbacks an object containing callback data for the program - * @param program the program to execute - */ - protected void injectVNFRestCallbacks(CallbackSet callbacks, String program) { - - String[] cmds = program.replaceAll("\\s+", "").split(","); - - for (String cmd : cmds) { - String action = cmd; - String modifier = "STD"; - - if (cmd.contains(":")) { - String[] parts = cmd.split(":"); - action = parts[0]; - modifier = parts[1]; - } - - String content = null; - String contentType = null; - - if ("STD".equals(modifier)) { - CallbackData callbackData = callbacks.get(action); - - if (callbackData == null) { - String msg = "No callback defined for '" + action + "' VNF REST request"; - System.out.println(msg); - fail(msg); - } - - content = callbackData.getContent(); - contentType = callbackData.getContentType(); - } else if ("ERR".equals(modifier)) { - content = "SIMULATED ERROR FROM VNF ADAPTER"; - contentType = "text/plain"; - } else { - String msg = "Invalid VNF REST program modifier: '" + modifier + "'"; - System.out.println(msg); - fail(msg); - } - - if (contentType == null) { - // Default for backward compatibility with existing tests. - contentType = XML; - } - - if (!injectVnfAdapterRestCallback(contentType, content, 10000)) { - fail("Failed to inject VNF REST '" + action + "' callback"); - } - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - fail("Interrupted after injection of VNF REST '" + action + "' callback"); - } - } - } - - /** - * Runs a program to inject VNF callback data into the test environment. - * A program is essentially just a list of keys that identify callback data - * to be injected, in sequence. An example program: - *
-	 *     createVnf, deleteVnf
-	 * 
- * Errors are handled with junit assertions and will cause the test to fail. - * @param callbacks an object containing callback data for the program - * @param program the program to execute - */ - protected void injectVNFCallbacks(CallbackSet callbacks, String program) { - - String[] cmds = program.replaceAll("\\s+", "").split(","); - - for (String cmd : cmds) { - String action = cmd; - String modifier = "STD"; - - if (cmd.contains(":")) { - String[] parts = cmd.split(":"); - action = parts[0]; - modifier = parts[1]; - } - - String content = null; - - if ("STD".equals(modifier)) { - CallbackData callbackData = callbacks.get(action); - - if (callbackData == null) { - String msg = "No callback defined for '" + action + "' VNF request"; - System.out.println(msg); - fail(msg); - } - - content = callbackData.getContent(); - } else if ("ERR".equals(modifier)) { - String msg = "Currently unsupported VNF program modifier: '" + modifier + "'"; - System.out.println(msg); - fail(msg); - } else { - String msg = "Invalid VNF program modifier: '" + modifier + "'"; - System.out.println(msg); - fail(msg); - } - - boolean injected = false; - - if (content.contains("createVnfNotification")) { - injected = injectCreateVNFCallback(content, 10000); - } else if (content.contains("deleteVnfNotification")) { - injected = injectDeleteVNFCallback(content, 10000); - } else if (content.contains("updateVnfNotification")) { - injected = injectUpdateVNFCallback(content, 10000); - } - - if (!injected) { - String msg = "Failed to inject VNF '" + action + "' callback"; - System.out.println(msg); - fail(msg); - } - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - fail("Interrupted after injection of VNF '" + action + "' callback"); - } - } - } - - /** - * Waits for the number of running processes with the specified process - * definition key to equal a particular count. - * @param processKey the process definition key - * @param count the desired count - * @param timeout the timeout in milliseconds - */ - protected void waitForRunningProcessCount(String processKey, int count, long timeout) { - System.out.println("Waiting " + timeout + "ms for there to be " + count + " " - + processKey + " instances"); - - long now = System.currentTimeMillis() + timeout; - long endTime = now + timeout; - int last = -1; - - while (now <= endTime) { - int actual = processEngineRule.getRuntimeService() - .createProcessInstanceQuery() - .processDefinitionKey(processKey) - .list().size(); - - if (actual != last) { - System.out.println("There are now " + actual + " " - + processKey + " instances"); - last = actual; - } - - if (actual == count) { - return; - } - - try { - Thread.sleep(200); - } catch (InterruptedException e) { - String msg = "Interrupted waiting for there to be " + count + " " - + processKey + " instances"; - System.out.println(msg); - fail(msg); - } - - now = System.currentTimeMillis(); - } - - String msg = "Timed out waiting for there to be " + count + " " - + processKey + " instances"; - System.out.println(msg); - fail(msg); - } - - /** - * Waits for the specified process variable to be set. - * @param processKey the process definition key - * @param variable the variable name - * @param timeout the timeout in milliseconds - * @return the variable value, or null if it cannot be obtained - * in the specified time - */ - protected Object getProcessVariable(String processKey, String variable, - long timeout) { - - System.out.println("Waiting " + timeout + "ms for " - + processKey + "." + variable + " to be set"); - - long now = System.currentTimeMillis() + timeout; - long endTime = now + timeout; - - ProcessInstance processInstance = null; - Object value = null; - - while (value == null) { - if (now > endTime) { - if (processInstance == null) { - System.out.println("Timed out waiting for " - + processKey + " to start"); - } else { - System.out.println("Timed out waiting for " - + processKey + "[" + processInstance.getId() - + "]." + variable + " to be set"); - } - - return null; - } - - if (processInstance == null) { - processInstance = processEngineRule.getRuntimeService() - .createProcessInstanceQuery() - .processDefinitionKey(processKey) - .singleResult(); - } - - if (processInstance != null) { - value = processEngineRule.getRuntimeService() - .getVariable(processInstance.getId(), variable); - } - - try { - Thread.sleep(200); - } catch (InterruptedException e) { - System.out.println("Interrupted waiting for " - + processKey + "." + variable + " to be set"); - return null; - } - - now = System.currentTimeMillis(); - } - - System.out.println(processKey + "[" - + processInstance.getId() + "]." + variable + "=" - + value); - - return value; - } - - /** - * Injects a single SDNC adapter callback request. The specified callback data - * may contain the placeholder string ((REQUEST-ID)) which is replaced with - * the actual SDNC request ID. Note: this is not the requestId in the original - * MSO request. - * @param contentType the HTTP content type for the callback - * @param content the content of the callback - * @param timeout the timeout in milliseconds - * @return true if the callback could be injected, false otherwise - */ - protected boolean injectSDNCRestCallback(String contentType, String content, long timeout) { - String sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV1", - "SDNCAResponse_CORRELATOR", timeout); - - if (sdncRequestId == null) { - return false; - } - - content = content.replace("((REQUEST-ID))", sdncRequestId); - // Deprecated usage. All test code should switch to the (( ... )) syntax. - content = content.replace("{{REQUEST-ID}}", sdncRequestId); - - System.out.println("Injecting SDNC adapter callback"); - WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource(); - workflowMessageResource.setProcessEngineServices4junit(processEngineRule); - Response response = workflowMessageResource.deliver(contentType, "SDNCAResponse", sdncRequestId, content); - System.out.println("Workflow response to SDNC adapter callback: " + response); - return true; - } - - /** - * Injects a single SDNC adapter callback request. The specified callback data - * may contain the placeholder string ((REQUEST-ID)) which is replaced with - * the actual SDNC request ID. Note: this is not the requestId in the original - * MSO request. - * @param content the content of the callback - * @param respCode the response code (normally 200) - * @param respMsg the response message (normally "OK") - * @param timeout the timeout in milliseconds - * @return true if the callback could be injected, false otherwise - */ - protected boolean injectSDNCCallback(int respCode, String respMsg, - String content, long timeout) { - - String sdncRequestId = (String) getProcessVariable("sdncAdapter", - "SDNCA_requestId", timeout); - - if (sdncRequestId == null) { - return false; - } - - content = content.replace("((REQUEST-ID))", sdncRequestId); - // Deprecated usage. All test code should switch to the (( ... )) syntax. - content = content.replace("{{REQUEST-ID}}", sdncRequestId); - - System.out.println("Injecting SDNC adapter callback"); - CallbackHeader callbackHeader = new CallbackHeader(); - callbackHeader.setRequestId(sdncRequestId); - callbackHeader.setResponseCode(String.valueOf(respCode)); - callbackHeader.setResponseMessage(respMsg); - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); - sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); - sdncAdapterCallbackRequest.setRequestData(content); - SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); - callbackService.setProcessEngineServices4junit(processEngineRule); - SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); - System.out.println("Workflow response to SDNC adapter callback: " + sdncAdapterResponse); - - return true; - } - - /** - * Injects a single VNF adapter callback request. The specified callback data - * may contain the placeholder string ((MESSAGE-ID)) which is replaced with - * the actual message ID. Note: this is not the requestId in the original - * MSO request. - * @param contentType the HTTP content type for the callback - * @param content the content of the callback - * @param timeout the timeout in milliseconds - * @return true if the callback could be injected, false otherwise - */ - protected boolean injectVnfAdapterRestCallback(String contentType, String content, long timeout) { - String messageId = (String) getProcessVariable("vnfAdapterRestV1", - "VNFAResponse_CORRELATOR", timeout); - - if (messageId == null) { - return false; - } - - content = content.replace("((MESSAGE-ID))", messageId); - // Deprecated usage. All test code should switch to the (( ... )) syntax. - content = content.replace("{{MESSAGE-ID}}", messageId); - - System.out.println("Injecting VNF adapter callback"); - WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource(); - workflowMessageResource.setProcessEngineServices4junit(processEngineRule); - Response response = workflowMessageResource.deliver(contentType, "VNFAResponse", messageId, content); - System.out.println("Workflow response to VNF adapter callback: " + response); - return true; - } - - /** - * Injects a Create VNF adapter callback request. The specified callback data - * may contain the placeholder string ((MESSAGE-ID)) which is replaced with - * the actual message ID. It may also contain the placeholder string - * ((REQUEST-ID)) which is replaced request ID of the original MSO request. - * @param content the content of the callback - * @param timeout the timeout in milliseconds - * @return true if the callback could be injected, false otherwise - * @throws JAXBException if the content does not adhere to the schema - */ - protected boolean injectCreateVNFCallback(String content, long timeout) { - - String messageId = (String) getProcessVariable("vnfAdapterCreateV1", - "VNFC_messageId", timeout); - - if (messageId == null) { - return false; - } - - content = content.replace("((MESSAGE-ID))", messageId); - // Deprecated usage. All test code should switch to the (( ... )) syntax. - content = content.replace("{{MESSAGE-ID}}", messageId); - - if(content.contains("((REQUEST-ID))")){ - content = content.replace("((REQUEST-ID))", msoRequestId); - // Deprecated usage. All test code should switch to the (( ... )) syntax. - content = content.replace("{{REQUEST-ID}}", msoRequestId); - } - - System.out.println("Injecting VNF adapter callback"); - - // Is it possible to unmarshal this with JAXB? I couldn't. - - CreateVnfNotification createVnfNotification = new CreateVnfNotification(); - XPathTool xpathTool = new VnfNotifyXPathTool(); - xpathTool.setXML(content); - - try { - String completed = xpathTool.evaluate( - "/tns:createVnfNotification/tns:completed/text()"); - createVnfNotification.setCompleted("true".equals(completed)); - - String vnfId = xpathTool.evaluate( - "/tns:createVnfNotification/tns:vnfId/text()"); - createVnfNotification.setVnfId(vnfId); - - NodeList entries = (NodeList) xpathTool.evaluate( - "/tns:createVnfNotification/tns:outputs/tns:entry", - XPathConstants.NODESET); - - CreateVnfNotificationOutputs outputs = new CreateVnfNotificationOutputs(); - - for (int i = 0; i < entries.getLength(); i++) { - Node node = entries.item(i); - - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element entry = (Element) node; - String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent(); - String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent(); - outputs.add(key, value); - } - } - - createVnfNotification.setOutputs(outputs); - - VnfRollback rollback = new VnfRollback(); - - String cloudSiteId = xpathTool.evaluate( - "/tns:createVnfNotification/tns:rollback/tns:cloudSiteId/text()"); - rollback.setCloudSiteId(cloudSiteId); - - String requestId = xpathTool.evaluate( - "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()"); - String serviceInstanceId = xpathTool.evaluate( - "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()"); - - if (requestId != null || serviceInstanceId != null) { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId(requestId); - msoRequest.setServiceInstanceId(serviceInstanceId); - rollback.setMsoRequest(msoRequest); - } - - String tenantCreated = xpathTool.evaluate( - "/tns:createVnfNotification/tns:rollback/tns:tenantCreated/text()"); - rollback.setTenantCreated("true".equals(tenantCreated)); - - String tenantId = xpathTool.evaluate( - "/tns:createVnfNotification/tns:rollback/tns:tenantId/text()"); - rollback.setTenantId(tenantId); - - String vnfCreated = xpathTool.evaluate( - "/tns:createVnfNotification/tns:rollback/tns:vnfCreated/text()"); - rollback.setVnfCreated("true".equals(vnfCreated)); - - String rollbackVnfId = xpathTool.evaluate( - "/tns:createVnfNotification/tns:rollback/tns:vnfId/text()"); - rollback.setVnfId(rollbackVnfId); - - createVnfNotification.setRollback(rollback); - - } catch (Exception e) { - System.out.println("Failed to unmarshal VNF callback content:"); - System.out.println(content); - return false; - } - - VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl(); - notifyService.setProcessEngineServices4junit(processEngineRule); - - notifyService.createVnfNotification( - messageId, - createVnfNotification.isCompleted(), - createVnfNotification.getException(), - createVnfNotification.getErrorMessage(), - createVnfNotification.getVnfId(), - createVnfNotification.getOutputs(), - createVnfNotification.getRollback()); - - return true; - } - - /** - * Injects a Delete VNF adapter callback request. The specified callback data - * may contain the placeholder string ((MESSAGE-ID)) which is replaced with - * the actual message ID. It may also contain the placeholder string - * ((REQUEST-ID)) which is replaced request ID of the original MSO request. - * @param content the content of the callback - * @param timeout the timeout in milliseconds - * @return true if the callback could be injected, false otherwise - * @throws JAXBException if the content does not adhere to the schema - */ - protected boolean injectDeleteVNFCallback(String content, long timeout) { - - String messageId = (String) getProcessVariable("vnfAdapterDeleteV1", - "VNFDEL_uuid", timeout); - - if (messageId == null) { - return false; - } - - content = content.replace("((MESSAGE-ID))", messageId); - // Deprecated usage. All test code should switch to the (( ... )) syntax. - content = content.replace("{{MESSAGE-ID}}", messageId); - - System.out.println("Injecting VNF adapter delete callback"); - - // Is it possible to unmarshal this with JAXB? I couldn't. - - DeleteVnfNotification deleteVnfNotification = new DeleteVnfNotification(); - XPathTool xpathTool = new VnfNotifyXPathTool(); - xpathTool.setXML(content); - - try { - String completed = xpathTool.evaluate( - "/tns:deleteVnfNotification/tns:completed/text()"); - deleteVnfNotification.setCompleted("true".equals(completed)); - // if notification failure, set the exception and error message - if (deleteVnfNotification.isCompleted() == false) { - deleteVnfNotification.setException(MsoExceptionCategory.INTERNAL); - deleteVnfNotification.setErrorMessage(xpathTool.evaluate( - "/tns:deleteVnfNotification/tns:errorMessage/text()")) ; - } - - } catch (Exception e) { - System.out.println("Failed to unmarshal VNF Delete callback content:"); - System.out.println(content); - return false; - } - - VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl(); - notifyService.setProcessEngineServices4junit(processEngineRule); - - notifyService.deleteVnfNotification( - messageId, - deleteVnfNotification.isCompleted(), - deleteVnfNotification.getException(), - deleteVnfNotification.getErrorMessage()); - - return true; - } - - /** - * Injects a Update VNF adapter callback request. The specified callback data - * may contain the placeholder string ((MESSAGE-ID)) which is replaced with - * the actual message ID. It may also contain the placeholder string - * ((REQUEST-ID)) which is replaced request ID of the original MSO request. - * @param content the content of the callback - * @param timeout the timeout in milliseconds - * @return true if the callback could be injected, false otherwise - * @throws JAXBException if the content does not adhere to the schema - */ - protected boolean injectUpdateVNFCallback(String content, long timeout) { - - String messageId = (String) getProcessVariable("vnfAdapterUpdate", - "VNFU_messageId", timeout); - - if (messageId == null) { - return false; - } - - content = content.replace("((MESSAGE-ID))", messageId); - // Deprecated usage. All test code should switch to the (( ... )) syntax. - content = content.replace("{{MESSAGE-ID}}", messageId); - - content = content.replace("((REQUEST-ID))", msoRequestId); - // Deprecated usage. All test code should switch to the (( ... )) syntax. - content = content.replace("{{REQUEST-ID}}", msoRequestId); - - System.out.println("Injecting VNF adapter callback"); - - // Is it possible to unmarshal this with JAXB? I couldn't. - - UpdateVnfNotification updateVnfNotification = new UpdateVnfNotification(); - XPathTool xpathTool = new VnfNotifyXPathTool(); - xpathTool.setXML(content); - - try { - String completed = xpathTool.evaluate( - "/tns:updateVnfNotification/tns:completed/text()"); - updateVnfNotification.setCompleted("true".equals(completed)); - - NodeList entries = (NodeList) xpathTool.evaluate( - "/tns:updateVnfNotification/tns:outputs/tns:entry", - XPathConstants.NODESET); - - UpdateVnfNotificationOutputs outputs = new UpdateVnfNotificationOutputs(); - - for (int i = 0; i < entries.getLength(); i++) { - Node node = entries.item(i); - - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element entry = (Element) node; - String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent(); - String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent(); - outputs.add(key, value); - } - } - - updateVnfNotification.setOutputs(outputs); - - VnfRollback rollback = new VnfRollback(); - - String cloudSiteId = xpathTool.evaluate( - "/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()"); - rollback.setCloudSiteId(cloudSiteId); - - String requestId = xpathTool.evaluate( - "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()"); - String serviceInstanceId = xpathTool.evaluate( - "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()"); - - if (requestId != null || serviceInstanceId != null) { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId(requestId); - msoRequest.setServiceInstanceId(serviceInstanceId); - rollback.setMsoRequest(msoRequest); - } - - String tenantCreated = xpathTool.evaluate( - "/tns:updateVnfNotification/tns:rollback/tns:tenantCreated/text()"); - rollback.setTenantCreated("true".equals(tenantCreated)); - - String tenantId = xpathTool.evaluate( - "/tns:updateVnfNotification/tns:rollback/tns:tenantId/text()"); - rollback.setTenantId(tenantId); - - String vnfCreated = xpathTool.evaluate( - "/tns:updateVnfNotification/tns:rollback/tns:vnfCreated/text()"); - rollback.setVnfCreated("true".equals(vnfCreated)); - - String rollbackVnfId = xpathTool.evaluate( - "/tns:updateVnfNotification/tns:rollback/tns:vnfId/text()"); - rollback.setVnfId(rollbackVnfId); - - updateVnfNotification.setRollback(rollback); - - } catch (Exception e) { - System.out.println("Failed to unmarshal VNF callback content:"); - System.out.println(content); - return false; - } - - VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl(); - notifyService.setProcessEngineServices4junit(processEngineRule); - - notifyService.updateVnfNotification( - messageId, - updateVnfNotification.isCompleted(), - updateVnfNotification.getException(), - updateVnfNotification.getErrorMessage(), - updateVnfNotification.getOutputs(), - updateVnfNotification.getRollback()); - - return true; - } - - /** - * Runs a program to inject workflow messages into the test environment. - * A program is essentially just a list of keys that identify event data - * to be injected, in sequence. An example program: - *
-	 *     event1, event2
-	 * 
- * Errors are handled with junit assertions and will cause the test to fail. - * NOTE: Each callback must have a workflow message type associated with it. - * @param callbacks an object containing event data for the program - * @param program the program to execute - */ - protected void injectWorkflowMessages(CallbackSet callbacks, String program) { - - String[] cmds = program.replaceAll("\\s+", "").split(","); - - for (String cmd : cmds) { - String action = cmd; - String modifier = "STD"; - - if (cmd.contains(":")) { - String[] parts = cmd.split(":"); - action = parts[0]; - modifier = parts[1]; - } - - String messageType = null; - String content = null; - String contentType = null; - - if ("STD".equals(modifier)) { - CallbackData callbackData = callbacks.get(action); - - if (callbackData == null) { - String msg = "No '" + action + "' workflow message callback is defined"; - System.out.println(msg); - fail(msg); - } - - messageType = callbackData.getMessageType(); - - if (messageType == null || messageType.trim().equals("")) { - String msg = "No workflow message type is defined in the '" + action + "' callback"; - System.out.println(msg); - fail(msg); - } - - content = callbackData.getContent(); - contentType = callbackData.getContentType(); - } else { - String msg = "Invalid workflow message program modifier: '" + modifier + "'"; - System.out.println(msg); - fail(msg); - } - - if (!injectWorkflowMessage(contentType, messageType, content, 10000)) { - fail("Failed to inject '" + action + "' workflow message"); - } - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - fail("Interrupted after injection of '" + action + "' workflow message"); - } - } - } - - /** - * Injects a workflow message. The specified callback data may contain the - * placeholder string ((CORRELATOR)) which is replaced with the actual - * correlator value. - * @param contentType the HTTP contentType for the message (possibly null) - * @param messageType the message type - * @param content the message content (possibly null) - * @param timeout the timeout in milliseconds - * @return true if the message could be injected, false otherwise - */ - protected boolean injectWorkflowMessage(String contentType, String messageType, String content, long timeout) { - String correlator = (String) getProcessVariable("ReceiveWorkflowMessage", - messageType + "_CORRELATOR", timeout); - - if (correlator == null) { - return false; - } - - if (content != null) { - content = content.replace("((CORRELATOR))", correlator); - } - - System.out.println("Injecting " + messageType + " message"); - WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource(); - workflowMessageResource.setProcessEngineServices4junit(processEngineRule); - Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content); - System.out.println("Workflow response to " + messageType + " message: " + response); - return true; - } - - /** - * Runs a program to inject sniro workflow messages into the test environment. - * A program is essentially just a list of keys that identify event data - * to be injected, in sequence. For more details, see - * injectSNIROCallbacks(String contentType, String messageType, String content, long timeout) - * - * Errors are handled with junit assertions and will cause the test to fail. - * NOTE: Each callback must have a workflow message type associated with it. - * - * @param callbacks an object containing event data for the program - * @param program the program to execute - */ - protected void injectSNIROCallbacks(CallbackSet callbacks, String program) { - - String[] cmds = program.replaceAll("\\s+", "").split(","); - - for (String cmd : cmds) { - String action = cmd; - String modifier = "STD"; - - if (cmd.contains(":")) { - String[] parts = cmd.split(":"); - action = parts[0]; - modifier = parts[1]; - } - - String messageType = null; - String content = null; - String contentType = null; - - if ("STD".equals(modifier)) { - CallbackData callbackData = callbacks.get(action); - - if (callbackData == null) { - String msg = "No '" + action + "' workflow message callback is defined"; - System.out.println(msg); - fail(msg); - } - - messageType = callbackData.getMessageType(); - - if (messageType == null || messageType.trim().equals("")) { - String msg = "No workflow message type is defined in the '" + action + "' callback"; - System.out.println(msg); - fail(msg); - } - - content = callbackData.getContent(); - contentType = callbackData.getContentType(); - } else { - String msg = "Invalid workflow message program modifier: '" + modifier + "'"; - System.out.println(msg); - fail(msg); - } - - if (!injectSNIROCallbacks(contentType, messageType, content, 10000)) { - fail("Failed to inject '" + action + "' workflow message"); - } - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - fail("Interrupted after injection of '" + action + "' workflow message"); - } - } - } - - /** - * Injects a sniro workflow message. The specified callback response may - * contain the placeholder strings ((CORRELATOR)) and ((SERVICE_RESOURCE_ID)) - * The ((CORRELATOR)) is replaced with the actual correlator value from the - * request. The ((SERVICE_RESOURCE_ID)) is replaced with the actual serviceResourceId - * value from the sniro request. Currently this only works with sniro request - * that contain only 1 resource. - * - * @param contentType the HTTP contentType for the message (possibly null) - * @param messageType the message type - * @param content the message content (possibly null) - * @param timeout the timeout in milliseconds - * @return true if the message could be injected, false otherwise - */ - protected boolean injectSNIROCallbacks(String contentType, String messageType, String content, long timeout) { - String correlator = (String) getProcessVariable("ReceiveWorkflowMessage", - messageType + "_CORRELATOR", timeout); - - if (correlator == null) { - return false; - } - if (content != null) { - content = content.replace("((CORRELATOR))", correlator); - if(messageType.equalsIgnoreCase("SNIROResponse")){ - //TODO figure out a solution for when there is more than 1 resource being homed (i.e. more than 1 reason in the placement list) - ServiceDecomposition decomp = (ServiceDecomposition) getProcessVariable("Homing", "serviceDecomposition", timeout); - List resourceList = decomp.getServiceResources(); - if(resourceList.size() == 1){ - String resourceId = ""; - for(Resource resource:resourceList){ - resourceId = resource.getResourceId(); - } - //TODO.. most other locations refer to solutionInfo.placementInfo - String homingList = getJsonValue(content, "solutionInfo.placement"); - JSONArray placementArr = null; - try { - placementArr = new JSONArray(homingList); - } - catch (Exception e) { - return false; - } - if(placementArr.length() == 1){ - content = content.replace("((SERVICE_RESOURCE_ID))", resourceId); - } - String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo"); - JSONArray licenseArr = null; - try { - licenseArr = new JSONArray(licenseInfoList); - } - catch (Exception e) { - return false; - } - if(licenseArr.length() == 1){ - content = content.replace("((SERVICE_RESOURCE_ID))", resourceId); - } - } - else { - try { - String homingList = getJsonValue(content, "solutionInfo.placement"); - String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo"); - JSONArray placementArr = new JSONArray(homingList); - JSONArray licenseArr = new JSONArray(licenseInfoList); - for (Resource resource: resourceList) { - String resourceModuleName = resource.getModelInfo().getModelInstanceName(); - String resourceId = resource.getResourceId(); - - for (int i=0; i processInstanceList = processEngineRule.getHistoryService() - .createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list(); - - if (processInstanceList == null) { - return null; - } - - processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime())); - - HistoricProcessInstance processInstance = processInstanceList.get(0); - - HistoricVariableInstance v = processEngineRule.getHistoryService() - .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()) - .variableName(variableName).singleResult(); - return v == null ? null : v.getValue(); - } catch (Exception e) { - System.out.println("Error retrieving variable " + variableName + - " from sub flow: " + subflowName + ", Exception is: " + e); - return null; - } - } - - /** - * Gets the value of a subflow variable from the subflow's - * historical process x instance. - * - * @param subflowName - the name of the subflow that contains the variable - * @param variableName the variable name - * @param subflowInstanceIndex - the instance of the subflow (use when same subflow is called more than once from mainflow) - * - * @return the variable value, or null if the variable could not be obtained - */ - protected Object getVariableFromSubflowHistory(int subflowInstanceIndex, String subflowName, String variableName) { - try { - List processInstanceList = processEngineRule.getHistoryService() - .createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list(); - - if (processInstanceList == null) { - return null; - } - - processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime())); - - HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex); - - HistoricVariableInstance v = processEngineRule.getHistoryService() - .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()) - .variableName(variableName).singleResult(); - return v == null ? null : v.getValue(); - } catch (Exception e) { - System.out.println("Error retrieving variable " + variableName + - " from " + subflowInstanceIndex + " instance index of sub flow: " + subflowName + ", Exception is: " + e); - return null; - } - } - - - /** - * Extracts text from an XML element. This method is not namespace aware - * (namespaces are ignored). The first matching element is selected. - * @param xml the XML document or fragment - * @param tag the desired element, e.g. "" - * @return the element text, or null if the element was not found - */ - protected String getXMLTextElement(String xml, String tag) { - xml = removeXMLNamespaces(xml); - - if (!tag.startsWith("<")) { - tag = "<" + tag + ">"; - } - - int start = xml.indexOf(tag); - - if (start == -1) { - return null; - } - - int end = xml.indexOf('<', start + tag.length()); - - if (end == -1) { - return null; - } - - return xml.substring(start + tag.length(), end); - } - - /** - * Removes namespace definitions and prefixes from XML, if any. - */ - private String removeXMLNamespaces(String xml) { - // remove xmlns declaration - xml = xml.replaceAll("xmlns.*?(\"|\').*?(\"|\')", ""); - - // remove opening tag prefix - xml = xml.replaceAll("(<)(\\w+:)(.*?>)", "$1$3"); - - // remove closing tags prefix - xml = xml.replaceAll("()", "$1$3"); - - // remove extra spaces left when xmlns declarations are removed - xml = xml.replaceAll("\\s+>", ">"); - - return xml; - } - - /** - * Asserts that two XML documents are semantically equivalent. Differences - * in whitespace or in namespace usage do not affect the comparison. - * @param expected the expected XML - * @param actual the XML to test - * @throws SAXException - * @throws IOException - */ - public static void assertXMLEquals(String expected, String actual) - throws SAXException, IOException { - XMLUnit.setIgnoreWhitespace(true); - XMLUnit.setIgnoreAttributeOrder(true); - DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expected, actual)); - List allDifferences = diff.getAllDifferences(); - assertEquals("Differences found: " + diff.toString(), 0, allDifferences.size()); - } - - /** - * A test implementation of AsynchronousResponse. - */ - public class TestAsyncResponse implements AsynchronousResponse { - Response response = null; - - /** - * {@inheritDoc} - */ - @Override - public synchronized void setResponse(Response response) { - this.response = response; - } - - /** - * Gets the response. - * @return the response, or null if none has been produced yet - */ - public synchronized Response getResponse() { - return response; - } - } - - /** - * An object that contains callback data for a "program". - */ - public class CallbackSet { - private final Map map = new HashMap<>(); - - /** - * Add untyped callback data to the set. - * @param action the action with which the data is associated - * @param content the callback data - */ - public void put(String action, String content) { - map.put(action, new CallbackData(null, null, content)); - } - - /** - * Add callback data to the set. - * @param action the action with which the data is associated - * @param messageType the callback message type - * @param content the callback data - */ - public void put(String action, String messageType, String content) { - map.put(action, new CallbackData(null, messageType, content)); - } - - /** - * Add callback data to the set. - * @param action the action with which the data is associated - * @param contentType the callback HTTP content type - * @param messageType the callback message type - * @param content the callback data - */ - public void put(String action, String contentType, String messageType, String content) { - map.put(action, new CallbackData(contentType, messageType, content)); - } - - /** - * Retrieve callback data from the set. - * @param action the action with which the data is associated - * @return the callback data, or null if there is none for the specified operation - */ - public CallbackData get(String action) { - return map.get(action); - } - } - - /** - * Represents a callback data item. - */ - public class CallbackData { - private final String contentType; - private final String messageType; - private final String content; - - /** - * Constructor - * @param contentType the HTTP content type (optional) - * @param messageType the callback message type (optional) - * @param content the content - */ - public CallbackData(String contentType, String messageType, String content) { - this.contentType = contentType; - this.messageType = messageType; - this.content = content; - } - - /** - * Gets the callback HTTP content type, possibly null. - */ - public String getContentType() { - return contentType; - } - - /** - * Gets the callback message type, possibly null. - */ - public String getMessageType() { - return messageType; - } - - /** - * Gets the callback content. - */ - public String getContent() { - return content; - } - } - - /** - * A tool for evaluating XPath expressions. - */ - protected class XPathTool { - private final DocumentBuilderFactory factory; - private final SimpleNamespaceContext context = new SimpleNamespaceContext(); - private final XPath xpath = XPathFactory.newInstance().newXPath(); - private String xml = null; - private Document doc = null; - - /** - * Constructor. - */ - public XPathTool() { - factory = DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); - xpath.setNamespaceContext(context); - } - - /** - * Adds a namespace. - * @param prefix the namespace prefix - * @param uri the namespace uri - */ - public synchronized void addNamespace(String prefix, String uri) { - context.add(prefix, uri); - } - - /** - * Sets the XML content to be operated on. - * @param xml the XML content - */ - public synchronized void setXML(String xml) { - this.xml = xml; - this.doc = null; - } - - /** - * Returns the document object. - * @return the document object, or null if XML has not been set - * @throws SAXException - * @throws IOException - * @throws ParserConfigurationException - */ - public synchronized Document getDocument() - throws ParserConfigurationException, IOException, SAXException { - if (xml == null) { - return null; - } - - buildDocument(); - return doc; - } - - /** - * Evaluates the specified XPath expression and returns a string result. - * This method throws exceptions on error. - * @param expression the expression - * @return the result object - * @throws ParserConfigurationException - * @throws IOException - * @throws SAXException - * @throws XPathExpressionException on error - */ - public synchronized String evaluate(String expression) - throws ParserConfigurationException, SAXException, - IOException, XPathExpressionException { - return (String) evaluate(expression, XPathConstants.STRING); - } - - /** - * Evaluates the specified XPath expression. - * This method throws exceptions on error. - * @param expression the expression - * @param returnType the return type - * @return the result object - * @throws ParserConfigurationException - * @throws IOException - * @throws SAXException - * @throws XPathExpressionException on error - */ - public synchronized Object evaluate(String expression, QName returnType) - throws ParserConfigurationException, SAXException, - IOException, XPathExpressionException { - - buildDocument(); - XPathExpression expr = xpath.compile(expression); - return expr.evaluate(doc, returnType); - } - - /** - * Private helper method that builds the document object. - * Assumes the calling method is synchronized. - * @throws ParserConfigurationException - * @throws IOException - * @throws SAXException - */ - private void buildDocument() throws ParserConfigurationException, - IOException, SAXException { - if (doc == null) { - if (xml == null) { - throw new IOException("XML input is null"); - } - - DocumentBuilder builder = factory.newDocumentBuilder(); - InputSource source = new InputSource(new StringReader(xml)); - doc = builder.parse(source); - } - } - } - - /** - * A NamespaceContext class based on a Map. - */ - private class SimpleNamespaceContext implements NamespaceContext { - private Map prefixMap = new HashMap<>(); - private Map uriMap = new HashMap<>(); - - public synchronized void add(String prefix, String uri) { - prefixMap.put(prefix, uri); - uriMap.put(uri, prefix); - } - - @Override - public synchronized String getNamespaceURI(String prefix) { - return prefixMap.get(prefix); - } - - @Override - public Iterator getPrefixes(String uri) { - List list = new ArrayList<>(); - String prefix = uriMap.get(uri); - if (prefix != null) { - list.add(prefix); - } - return list.iterator(); - } - - @Override - public String getPrefix(String uri) { - return uriMap.get(uri); - } - } - - /** - * A VnfNotify XPathTool. - */ - protected class VnfNotifyXPathTool extends XPathTool { - public VnfNotifyXPathTool() { - addNamespace("tns", "http://org.openecomp.mso/vnfNotify"); - } - } - - /** - * Helper class to make it easier to create this type. - */ - private static class CreateVnfNotificationOutputs - extends CreateVnfNotification.Outputs { - public void add(String key, String value) { - Entry entry = new Entry(); - entry.setKey(key); - entry.setValue(value); - getEntry().add(entry); - } - } - - /** - * Helper class to make it easier to create this type. - */ - private static class UpdateVnfNotificationOutputs - extends UpdateVnfNotification.Outputs { - public void add(String key, String value) { - Entry entry = new Entry(); - entry.setKey(key); - entry.setValue(value); - getEntry().add(entry); - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTestTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTestTransformer.java deleted file mode 100644 index ea338c21bf..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTestTransformer.java +++ /dev/null @@ -1,41 +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.bpmn.common; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Allows a subclass of WorkflowTest to specify one or more WireMock - * response transformers. A transformer must be declared as a public - * static field in the subclass. For example: - *
- *     @WorkflowTestTransformer
- *     public static final ResponseTransformer sdncAdapterMockTransformer =
- *         new SDNCAdapterMockTransformer();
- * 
- */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface WorkflowTestTransformer { -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotificationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotificationTest.java deleted file mode 100644 index 18a2108c86..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotificationTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common.adapter.vnf; - -import static org.junit.Assert.*; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs; -import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs.Entry; - -public class CreateVnfNotificationTest { - - @Test - public void test() { - CreateVnfNotification cvn=new CreateVnfNotification(); - Entry ent = new Entry(); - MsoExceptionCategory exception = MsoExceptionCategory.OPENSTACK; - Outputs value=new Outputs(); - VnfRollback vnf=new VnfRollback(); - vnf.setCloudSiteId("cloud"); - cvn.setCompleted(true); - cvn.setErrorMessage("emsg"); - cvn.setException(exception); - cvn.setMessageId("id"); - cvn.setOutputs(value); - ent.setKey("key"); - ent.setValue("value"); - cvn.setRollback(vnf); - cvn.setVnfId("vnf"); - assertTrue(cvn.isCompleted()); - assert(cvn.getErrorMessage().equals("emsg")); - assert(cvn.getException()).equals(exception); - assert(cvn.getMessageId()).equals("id"); - assert(cvn.getRollback()).equals(vnf); - assert(cvn.getOutputs()).equals(value); - assert(cvn.getVnfId()).equals("vnf"); - assert(ent.getKey()).equals("key"); - assert(ent.getValue()).equals("value"); - assert(ent.toString()!=null); - assert(cvn.toString()!=null); - assert(vnf.getCloudSiteId().equals("cloud")); - assert(value.getEntry()!=null); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotificationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotificationTest.java deleted file mode 100644 index 10e760e8de..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotificationTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common.adapter.vnf; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class DeleteVnfNotificationTest { - - @Test - public void test() { - DeleteVnfNotification dvn=new DeleteVnfNotification(); - MsoExceptionCategory exception = MsoExceptionCategory.OPENSTACK; - dvn.setCompleted(true); - dvn.setErrorMessage("msg"); - dvn.setMessageId("id"); - dvn.setException(exception); - assert(dvn.getErrorMessage().equals("msg")); - assert(dvn.getMessageId().equals("id")); - assert(dvn.getException().equals(exception)); - assert(dvn.toString()!=null); - assertTrue(dvn.isCompleted()); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequestTest.java deleted file mode 100644 index 59aff8cf77..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequestTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common.adapter.vnf; -import static org.junit.Assert.assertEquals; -import org.junit.Test; - -public class MsoRequestTest { - private MsoRequest msorequest = new MsoRequest(); - @Test - public void testMsoRequest() { - msorequest.setRequestId("requestId"); - msorequest.setServiceInstanceId("serviceInstanceId"); - assertEquals(msorequest.getRequestId(), "requestId"); - assertEquals(msorequest.getServiceInstanceId(), "serviceInstanceId"); - } - @Test - public void testtoString() { - assert(msorequest.toString())!= null; - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactoryTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactoryTest.java deleted file mode 100644 index 77ba0ea59b..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactoryTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common.adapter.vnf; - -import static org.mockito.Mockito.mock; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs; - -public class ObjectFactoryTest { - private ObjectFactory ofa=new ObjectFactory(); - - @Test - public void test() { - CreateVnfNotification cvn=mock( CreateVnfNotification.class); - UpdateVnfNotification uvn=mock (UpdateVnfNotification.class); - QueryVnfNotification qn=mock(QueryVnfNotification.class); - DeleteVnfNotification dvn=mock( DeleteVnfNotification.class); - RollbackVnfNotification rvn=mock( RollbackVnfNotification.class); - MsoRequest mr=mock( MsoRequest.class); - Outputs opt=mock(Outputs.class); - ofa.createCreateVnfNotification(); - ofa.createCreateVnfNotificationOutputs(); - ofa.createDeleteVnfNotification(); - ofa.createQueryVnfNotification(); - ofa.createUpdateVnfNotification(); - ofa.createMsoRequest(); - ofa.createRollbackVnfNotification(); - ofa.createUpdateVnfNotificationOutputs(); - ofa.createQueryVnfNotificationOutputs(); - ofa.createVnfRollback(); - ofa.createUpdateVnfNotificationOutputsEntry(); - ofa.createQueryVnfNotificationOutputsEntry(); - ofa.createCreateVnfNotificationOutputsEntry(); - ofa.createCreateVnfNotification(cvn); - ofa.createDeleteVnfNotification(dvn); - ofa.createQueryVnfNotification(qn); - ofa.createRollbackVnfNotification(rvn); - ofa.createUpdateVnfNotification(uvn); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotificationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotificationTest.java deleted file mode 100644 index 59e10baedc..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotificationTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common.adapter.vnf; - -import static org.junit.Assert.*; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs; -import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs.Entry; - -public class QueryVnfNotificationTest { - private QueryVnfNotification qvn=new QueryVnfNotification(); - - @Test - public void test() { - Entry ent = new Entry(); - MsoExceptionCategory exception = MsoExceptionCategory.OPENSTACK; - Outputs opt=new Outputs(); - VnfStatus vnf=VnfStatus.ACTIVE; - qvn.setCompleted(true); - qvn.setErrorMessage("error"); - qvn.setException(exception); - qvn.setMessageId("id"); - qvn.setStatus(vnf); - qvn.setVnfId("id"); - qvn.setVnfExists(true); - ent.setKey("key"); - ent.setValue("value"); - assert(qvn.getErrorMessage().equals("error")); - assert(qvn.getException()).equals(exception); - assert(qvn.getMessageId()).equals("id"); - assert(qvn.getStatus()).equals(vnf); - assert(qvn.getVnfId()).equals("id"); - assertTrue(qvn.isVnfExists()); - assertTrue(qvn.isCompleted()); - assert(opt.getEntry()!=null); - assert(opt.toString()!=null); - assert(ent.getValue()).equals("value"); - assert(ent.getKey()).equals("key"); - assert(ent.toString()!=null); - assert(qvn.toString()!=null); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotificationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotificationTest.java deleted file mode 100644 index c6602d33f9..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotificationTest.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.bpmn.common.adapter.vnf; - -import static org.junit.Assert.assertEquals; -import org.junit.Test; - -public class RollbackVnfNotificationTest { - private RollbackVnfNotification rvn = new RollbackVnfNotification(); - MsoExceptionCategory mso= MsoExceptionCategory.OPENSTACK; - @Test - public void testRollbackVnfNotification() { - rvn.setMessageId("messageId"); - rvn.setCompleted(true); - rvn.setException(mso); - rvn.setErrorMessage("errorMessage"); - assertEquals(rvn.getMessageId(), "messageId"); - assertEquals(rvn.isCompleted(), true); - assertEquals(rvn.getException(), mso); - assertEquals(rvn.getErrorMessage(), "errorMessage"); - } - @Test - public void testtoString() { - assert(rvn.toString()!=null); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotificationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotificationTest.java deleted file mode 100644 index 825695b3dd..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotificationTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common.adapter.vnf; - -import static org.junit.Assert.*; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs; -import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs.Entry; - -public class UpdateVnfNotificationTest { - private UpdateVnfNotification updatevnf = new UpdateVnfNotification(); - MsoExceptionCategory mso; - Outputs value= new Outputs(); - VnfRollback roll = new VnfRollback(); - private Entry entry = new Entry(); - - @Test - public void testUpdateVnfNotification() { - updatevnf.setMessageId("messageId"); - updatevnf.setCompleted(true); - updatevnf.setException(mso); - updatevnf.setErrorMessage("errorMessage"); - updatevnf.setOutputs(value); - updatevnf.setRollback(roll); - entry.setKey("key"); - entry.setValue("value"); - assertEquals(updatevnf.getMessageId(), "messageId"); - assertEquals(updatevnf.isCompleted(), true); - assertEquals(updatevnf.getException(), mso); - assertEquals(updatevnf.getErrorMessage(), "errorMessage"); - assertEquals(updatevnf.getOutputs(), value); - assertEquals(updatevnf.getRollback(), roll); - assertEquals(entry.getKey(), "key"); - assertEquals(entry.getValue(), "value"); - } - @Test - public void testtoString() { - assert(updatevnf.toString()!= null); - assert(entry.toString()!= null); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollbackTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollbackTest.java deleted file mode 100644 index ebed8714df..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollbackTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common.adapter.vnf; - -import static org.junit.Assert.assertEquals; -import org.junit.Test; - -public class VnfRollbackTest { - private VnfRollback vnfrollback = new VnfRollback(); - MsoRequest mso = new MsoRequest(); - @Test - public void testVnfRollback() { - vnfrollback.setCloudSiteId("cloudSiteId"); - vnfrollback.setMsoRequest(mso); - vnfrollback.setTenantCreated(true); - vnfrollback.setTenantId("tenantId"); - vnfrollback.setVnfCreated(true); - vnfrollback.setVnfId("vnfId"); - assertEquals(vnfrollback.getCloudSiteId(), "cloudSiteId"); - assertEquals(vnfrollback.getMsoRequest(), mso); - assertEquals(vnfrollback.isTenantCreated(), true); - assertEquals(vnfrollback.getTenantId(), "tenantId"); - assertEquals(vnfrollback.isVnfCreated(), true); - assertEquals(vnfrollback.getVnfId(), "vnfId"); - } - @Test - public void testtoString() { - assert(vnfrollback.toString() != null); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/BpmnParamTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/BpmnParamTest.java deleted file mode 100644 index 166e3d78c1..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/BpmnParamTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common.recipe; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -public class BpmnParamTest { - - BpmnParam bp=new BpmnParam(); - - @Test - public void test() { - bp.setValue("testdata"); - assertEquals(bp.getValue(),"testdata"); - } - @Test - public void testToString(){ - assert(bp.toString()!=null); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClientTest.java deleted file mode 100644 index 89f538b085..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClientTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common.recipe; - -import static org.junit.Assert.*; -import org.junit.Test; - -public class BpmnRestClientTest { - - @Test - public void test() { - BpmnRestClient.getEncryptedPropValue("prop", "123", "456"); - BpmnRestClient.loadMsoProperties(); - assertEquals(true,BpmnRestClient.getNoPropertiesState()); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceInputTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceInputTest.java deleted file mode 100644 index 466f4a1f3f..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceInputTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common.recipe; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.mso.bpmn.core.domain.ModelInfo; - -public class ResourceInputTest { - - ResourceInput ri=new ResourceInput(); - @Test - public void test() { - ri.setResourceInstanceName("resourceInstanceName"); - ri.setResourceInstanceDes("resourceInstanceDes"); - ri.setGlobalSubscriberId("globalSubscriberId"); - ri.setServiceType("serviceType"); - ri.setServiceInstanceId("serviceId"); - ri.setOperationId("operationId"); - ModelInfo serviceModelInfo = new ModelInfo(); - serviceModelInfo.setModelCustomizationUuid("modelCustomizationUuid"); - serviceModelInfo.setModelInvariantUuid("modelInvariantUuid"); - serviceModelInfo.setModelUuid("modelUuid"); - ri.setServiceModelInfo(serviceModelInfo); - ModelInfo resourceModelInfo = new ModelInfo(); - resourceModelInfo.setModelCustomizationUuid("modelCustomizationUuid"); - resourceModelInfo.setModelInvariantUuid("modelInvariantUuid"); - resourceModelInfo.setModelUuid("modelUuid"); - ri.setResourceModelInfo(resourceModelInfo); - ri.setResourceInstancenUuid("resourceInstancenUuid"); - ri.setResourceParameters("resourceParameters"); - ri.setOperationType("operationType"); - assertEquals(ri.getResourceInstanceName(), "resourceInstanceName"); - assertEquals(ri.getResourceInstanceDes(), "resourceInstanceDes"); - assertEquals(ri.getGlobalSubscriberId(), "globalSubscriberId"); - assertEquals(ri.getServiceType(), "serviceType"); - assertEquals(ri.getServiceInstanceId(), "serviceId"); - assertEquals(ri.getOperationId(), "operationId"); - assertEquals(ri.getResourceInstancenUuid(), "resourceInstancenUuid"); - assertEquals(ri.getResourceParameters(), "resourceParameters"); - assertEquals(ri.getOperationType(), "operationType"); - } - @Test - public void testToString(){ - assert(ri.toString()!=null); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequestTest.java deleted file mode 100644 index 3b185bae22..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequestTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.common.recipe; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class ResourceRecipeRequestTest { - - ResourceRecipeRequest rr=new ResourceRecipeRequest(); - BpmnParam bp=new BpmnParam(); - @Test - public void test() { - rr.setResourceInput(bp); - rr.setHost(bp); - rr.setRequestId(bp); - rr.setRequestAction(bp); - rr.setServiceInstanceId(bp); - rr.setServiceType(bp); - rr.setRecipeParams(bp); - assertEquals(rr.getResourceInput(),bp); - assertEquals(rr.getHost(),bp); - assertEquals(rr.getRequestId(),bp); - assertEquals(rr.getRequestAction(),bp); - assertEquals(rr.getServiceInstanceId(),bp); - assertEquals(rr.getServiceType(),bp); - assertEquals(rr.getRecipeParams(),bp); - } - @Test - public void testToString(){ - assert(rr.toString()!=null); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilderTest.java deleted file mode 100644 index 5170e9d5d9..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilderTest.java +++ /dev/null @@ -1,42 +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.bpmn.common.resource; - -import org.junit.Test; - -import java.util.HashMap; - -public class ResourceRequestBuilderTest { - - @Test - public void buildResouceRequestTest() throws Exception { - - ResourceRequestBuilder.buildResouceRequest("aa4535", - "a1074969-944f-4ddc-b687-9550b0c8cd57", new HashMap<>()); - } - - @Test - public void buildResouceRequestParametersTest() throws Exception { - - String parameters = - "{ \"locationConstraints\":[ ], \"resources\":[ { \"resourceName\":\"vEPC_ONAP01\", \"resourceInvariantUuid\":\"36ebe421-283a-4ee8-92f1-d09e7c44b911\", \"resourceUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed111\", \"resourceCustomizationUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed231\", \"parameters\":{ \"locationConstraints\":[ { \"vnfProfileId\":\"b244d433-8c9c-49ad-9c70-8e34b8dc8328\", \"locationConstraints\":{ \"vimId\":\"vmware_vio\" } }, { \"vnfProfileId\":\"8a9f7c48-21ce-41b7-95b8-a8ac61ccb1ff\", \"locationConstraints\":{ \"vimId\":\"core-dc_RegionOne\" } } ], \"resources\":[ ], \"requestInputs\":{ \"sdncontroller\":\"\" } } }, { \"resourceName\":\"VL OVERLAYTUNNEL\", \"resourceInvariantUuid\":\"184494cf-472f-436f-82e2-d83dddde21cb\", \"resourceUuid\":\"95bc3e59-c9c5-458f-ad6e-78874ab4b3cc\", \"resourceCustomizationUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed232\", \"parameters\":{ \"locationConstraints\":[ ], \"resources\":[ ], \"requestInputs\":{ } } } ], \"requestInputs\":{ \"vlunderlayvpn0_name\":\"l3connect\", \"vlunderlayvpn0_site1_id\":\"IP-WAN-Controller-1\", \"vlunderlayvpn0_site2_id\":\"SPTNController\", \"vlunderlayvpn0_site1_networkName\":\"network1,network2\", \"vlunderlayvpn0_site2_networkName\":\"network3,network4\", \"vlunderlayvpn0_site1_routerId\":\"a8098c1a-f86e-11da-bd1a-00112444be1a\", \"vlunderlayvpn0_site2_routerId\":\"a8098c1a-f86e-11da-bd1a-00112444be1e\", \"vlunderlayvpn0_site2_importRT1\":\"200:1,200:2\", \"vlunderlayvpn0_site1_exportRT1\":\"300:1,300:2\", \"vlunderlayvpn0_site2_exportRT1\":\"400:1,400:2\", \"vlunderlayvpn0_site1_vni\":\"2000\", \"vlunderlayvpn0_site2_vni\":\"3000\", \"vlunderlayvpn0_tunnelType\":\"L3-DCI\" } }"; - ResourceRequestBuilder.buildResourceRequestParameters(null, "1bd0eae6-2dcc-4461-9ae6-56d641f369d6", "27a0e235-b67a-4ea4-a0cf-25761afed231", parameters); - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/util/CryptoHandlerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/util/CryptoHandlerTest.java deleted file mode 100644 index 724d3edf4d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/util/CryptoHandlerTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.common.util; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -public class CryptoHandlerTest { - - @Test - public void test() throws Exception { - String plainPswd = "mso0206"; - String encryptPwd = "C1FC4A39E16419DD41DFC1212843F440"; - CryptoHandler cryptoHandler = new CryptoHandler(); - String aaiPassword = cryptoHandler.getMsoAaiPassword(); - assertEquals(plainPswd, aaiPassword); - String encryptPassword = cryptoHandler.encryptMsoPassword(plainPswd); - assertEquals(encryptPwd, encryptPassword); - String decryptPassword = cryptoHandler.decryptMsoPassword(encryptPwd); - assertEquals(plainPswd, decryptPassword); - } - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java deleted file mode 100644 index 38d0584d0d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.mock; - -import java.io.IOException; -import java.io.InputStream; -import org.openecomp.mso.logger.MsoLogger; - -/** - * - * File utility class.
- *

- *

- * - * @author - * @version ONAP Sep 15, 2017 - */ -public class FileUtil { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - /** - * Read the specified resource file and return the contents as a String. - * - * @param fileName Name of the resource file - * @return the contents of the resource file as a String - * @throws IOException if there is a problem reading the file - */ - public static String readResourceFile(String fileName) { - InputStream stream; - try { - stream = getResourceAsStream(fileName); - byte[] bytes; - bytes = new byte[stream.available()]; - stream.read(bytes); - stream.close(); - return new String(bytes); - } catch (IOException e) { - LOGGER.debug("Exception:", e); - return ""; - } - } - - /** - * Get an InputStream for the resource specified. - * - * @param resourceName Name of resource for which to get InputStream. - * @return an InputStream for the resource specified. - * @throws IOException If we can't get the InputStream for whatever reason. - */ - private static InputStream getResourceAsStream(String resourceName) throws IOException { - InputStream stream = - FileUtil.class.getClassLoader().getResourceAsStream(resourceName); - if (stream == null) { - throw new IOException("Can't access resource '" + resourceName + "'"); - } - return stream; - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java deleted file mode 100644 index 9ead882b07..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.mock; - -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; - -import java.util.HashMap; -import java.util.Map; - -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.Response; - -import com.github.tomakehurst.wiremock.WireMockServer; -import com.github.tomakehurst.wiremock.client.WireMock; - -/** - * - * Mock Resource which is used to start, stop the WireMock Server - * Also up to 50 mock properties can be added at run-time to change the properties used in transformers such as sdnc_delay in SDNCAdapterMockTransformer - * You can also selectively setup a stub (use reset before setting up), reset all stubs - */ -@Path("/server") -public class MockResource { - - private boolean started = false; - private final Integer defaultPort = 28090; - private WireMockServer wireMockServer = null; - private static Map mockProperties = new HashMap<>(); - - public static String getMockProperties(String key) { - return mockProperties.get(key); - } - - private synchronized void initMockServer(int portNumber) { - String path = FileUtil.class.getClassLoader().getResource("__files/sdncSimResponse.xml").getFile(); - path = path.substring(0,path.indexOf("__files/")); - - wireMockServer = new WireMockServer(wireMockConfig().port(portNumber).extensions("org.openecomp.mso.bpmn.mock.SDNCAdapterMockTransformer") - .extensions("org.openecomp.mso.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer") - .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterCreateMockTransformer") - .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterDeleteMockTransformer") - .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterUpdateMockTransformer") - .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterRollbackMockTransformer") - .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterQueryMockTransformer")); - //.withRootDirectory(path)); - //Mocks were failing - commenting out for now, both mock and transformers seem to work fine - WireMock.configureFor("localhost", portNumber); - wireMockServer.start(); -// StubResponse.setupAllMocks(); - started= true; - } - - public static void main(String [] args) { - MockResource mockresource = new MockResource(); - mockresource.start(28090); - mockresource.reset(); -// mockresource.setupStub("MockCreateTenant"); - } - - /** - * Starts the wiremock server in default port - * @return - */ - @GET - @Path("/start") - @Produces("application/json") - public Response start() { - return startMockServer(defaultPort); - } - - private Response startMockServer(int port) { - if (!started) { - initMockServer(defaultPort); - System.out.println("Started Mock Server in port " + port); - return Response.status(200).entity("Started Mock Server in port " + port).build(); - } else { - return Response.status(200).entity("Mock Server is already running").build(); - } - } - - /** - * Starts the wiremock server in a different port - * @param portNumber - * @return - */ - @GET - @Path("/start/{portNumber}") - @Produces("application/json") - public Response start(@PathParam("portNumber") Integer portNumber) { - if (portNumber == null) portNumber = defaultPort; - return startMockServer(portNumber); - } - - - /** - * Stop the wiremock server - * @return - */ - @GET - @Path("/stop") - @Produces("application/json") - public synchronized Response stop() { - if (wireMockServer.isRunning()) { - wireMockServer.stop(); - started = false; - return Response.status(200).entity("Stopped Mock Server in port ").build(); - } - return Response.status(200).entity("Mock Server is not running").build(); - } - - - /** - * Return list of mock properties - * @return - */ - @GET - @Path("/properties") - @Produces("application/json") - public Response getProperties() { - return Response.status(200).entity(mockProperties).build(); - } - - /** - * Update a particular mock property at run-time - * @param name - * @param value - * @return - */ - @POST - @Path("/properties/{name}/{value}") - public Response updateProperties(@PathParam("name") String name, @PathParam("value") String value) { - if (mockProperties.size() > 50) return Response.serverError().build(); - mockProperties.put(name, value); - return Response.status(200).build(); - } - - /** - * Reset all stubs - * @return - */ - @GET - @Path("/reset") - @Produces("application/json") - public Response reset() { - WireMock.reset(); - return Response.status(200).entity("Wiremock stubs are reset").build(); - } - - - /** - * Setup a stub selectively - * Prior to use, make sure that stub method is available in StubResponse class - * @param methodName - * @return - */ - - // commenting for now until we figure out a way to use new StubResponse classes to setupStubs -// @GET -// @Path("/stub/{methodName}") -// @Produces("application/json") -// public Response setupStub(@PathParam("methodName") String methodName) { -// -// @SuppressWarnings("rawtypes") -// Class params[] = {}; -// Object paramsObj[] = {}; -// -// try { -// Method thisMethod = StubResponse.class.getDeclaredMethod(methodName, params); -// try { -// thisMethod.invoke(StubResponse.class, paramsObj); -// } catch (IllegalAccessException | IllegalArgumentException -// | InvocationTargetException e) { -// return Response.status(200).entity("Error invoking " + methodName ).build(); -// } -// } catch (NoSuchMethodException | SecurityException e) { -// return Response.status(200).entity("Stub " + methodName + " not found...").build(); -// } -// return Response.status(200).entity("Successfully invoked " + methodName).build(); -// } - - - public static Map getMockProperties(){ - return mockProperties; - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java deleted file mode 100644 index ba48bffca0..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.mock; - -import java.util.HashSet; -import java.util.Set; - -import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; - -/** - * - * JAX RS Application wiring for Mock Resource - */ -@ApplicationPath("/console") -public class MockResourceApplication extends Application { - - private Set singletons = new HashSet<>(); - private Set> classes = new HashSet<>(); - - public MockResourceApplication() { - singletons.add(new MockResource()); - } - - @Override - public Set> getClasses() { - return classes; - } - - @Override - public Set getSingletons() { - return singletons; - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterAsyncTransformer.java deleted file mode 100644 index 93cf0bddef..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterAsyncTransformer.java +++ /dev/null @@ -1,157 +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.bpmn.mock; - -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.BinaryFile; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; - -/** - * - * Simulates SDNC Adapter Callback response - * - */ -public class SDNCAdapterAsyncTransformer extends ResponseTransformer { - - private String syncResponse; - private String callbackResponseWrapper; - - public SDNCAdapterAsyncTransformer() { - syncResponse = FileUtil.readResourceFile("__files/StandardSDNCSynchResponse.xml"); - callbackResponseWrapper = FileUtil.readResourceFile("__files/sdncCallbackSoapWrapper.xml"); - } - - public String name() { - return "sdnc-adapter-vf-module-assign"; - } - - /** - * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id - * so that callback response can be correlated - * - * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before - * the callback response is sent - */ - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource) { - - String requestBody = request.getBodyAsString(); - - String callbackUrl = requestBody.substring(requestBody.indexOf("")+25, requestBody.indexOf("")); - String requestId = requestBody.substring(requestBody.indexOf("")+23, requestBody.indexOf("")); - - System.out.println("responseDefinition: " + responseDefinition); - - // For this mock, the mapped response body is the Async callback (since the sync response is generic for all requests) - String sdncResponse = responseDefinition.getBody(); - System.out.println("sdncResponse:" + sdncResponse); - - if (sdncResponse == null) { - // Body wasn't specified. Check for a body file - String bodyFileName = responseDefinition.getBodyFileName(); - System.out.println("bodyFileName" + bodyFileName); - if (bodyFileName != null) { - System.out.println("fileSource Class: " + fileSource.getClass().getName()); - BinaryFile bodyFile = fileSource.getBinaryFileNamed(bodyFileName); - byte[] responseFile = bodyFile.readContents(); - sdncResponse = new String(responseFile); - System.out.println("sdncResponse(2):" + sdncResponse); - } - } - - // Transform the SDNC response to escape < and > - sdncResponse = sdncResponse.replaceAll ("<", "<"); - sdncResponse = sdncResponse.replaceAll (">", ">"); - - // Next substitute the SDNC response into the callbackResponse (SOAP wrapper). - // Also, replace the request ID wherever it appears - String callbackResponse = callbackResponseWrapper.replace("SDNC_RESPONSE_DATA", sdncResponse).replaceAll("SDNC_REQUEST_ID", requestId); - - Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay"); - int delay = 2000; - if (sdncDelay != null) { - delay = Integer.parseInt(sdncDelay.toString()); - } - - //Kick off callback thread - System.out.println("callback Url:" + callbackUrl + ":delay:" + delay); - CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay); - calbackResponseThread.start(); - - //return 200 OK with empty body - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(200).withBody(syncResponse).withHeader("Content-Type", "text/xml") - .build(); - } - - @Override - public boolean applyGlobally() { - return false; - } - - /** - * - * Callback response thread which sends the callback response asynchronously - * - */ - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - System.out.println("Sending callback response:" + callbackUrl); - ClientRequest request = new ClientRequest(callbackUrl); - request.body("text/xml", payLoad); - System.err.println(payLoad); - try { - ClientResponse result = request.post(); - //System.err.println("Successfully posted callback:" + result.getStatus()); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java deleted file mode 100644 index 9c4e7936b1..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.mock; - -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; -import org.openecomp.mso.logger.MsoLogger; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; - -import org.openecomp.mso.logger.MsoLogger; -/** - * - * Simulates SDNC Adapter Callback response - * - */ -public class SDNCAdapterMockTransformer extends ResponseTransformer { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - private String callbackResponse; - private String requestId; - - public SDNCAdapterMockTransformer() { - callbackResponse = FileUtil.readResourceFile("__files/sdncSimResponse.xml"); - } - - public SDNCAdapterMockTransformer(String requestId) { - this.requestId = requestId; - } - - public String name() { - return "sdnc-adapter-transformer"; - } - - /** - * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id - * so that callback response can be correlated - * - * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before - * the callback response is sent - */ - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource) { - String requestBody = request.getBodyAsString(); - - String callbackUrl = requestBody.substring(requestBody.indexOf("")+25, requestBody.indexOf("")); - String requestId = requestBody.substring(requestBody.indexOf("")+23, requestBody.indexOf("")); - - callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - System.out.println("callbackResponse:" + callbackResponse); - - if (this.requestId != null) { - callbackResponse = callbackResponse.replace(this.requestId, requestId); - } else { - callbackResponse = callbackResponse.replace("testRequestId", requestId); - } - - - Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay"); - int delay = 300; - if (sdncDelay != null) { - delay = Integer.parseInt(sdncDelay.toString()); - } - - //Kick off callback thread - System.out.println("callback Url:" + callbackUrl + ":delay:" + delay); - CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay); - calbackResponseThread.start(); - - //return 200 OK with empty body - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(200).withBody("").withHeader("Content-Type", "text/xml") - .build(); - } - - @Override - public boolean applyGlobally() { - return false; - } - - /** - * - * Callback response thread which sends the callback response asynchronously - * - */ - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - LOGGER.debug("Exception :",e1); - } - LOGGER.debug("Sending callback response:" + callbackUrl); - ClientRequest request = new ClientRequest(callbackUrl); - request.body("text/xml", payLoad); - System.err.println(payLoad); - try { - ClientResponse result = request.post(); - //System.err.println("Successfully posted callback:" + result.getStatus()); - } catch (Exception e) { - LOGGER.debug("Exception :",e); - } - } - - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java deleted file mode 100644 index e59e3b67d2..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.mock; - -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; - -import org.openecomp.mso.logger.MsoLogger; - -public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseTransformer { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private String callbackResponse; - private String requestId; - - public SDNCAdapterNetworkTopologyMockTransformer() { - callbackResponse = ""; // FileUtil.readResourceFile("__files/sdncDeleteNetworkTopologySimResponse.xml"); - } - - public SDNCAdapterNetworkTopologyMockTransformer(String requestId) { - this.requestId = requestId; - } - - public String name() { - return "network-topology-operation-transformer"; - } - - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, FileSource fileSource) { - String requestBody = request.getBodyAsString(); - - String callbackUrl = requestBody.substring(requestBody.indexOf("")+25, requestBody.indexOf("")); - String requestId = requestBody.substring(requestBody.indexOf("")+23, requestBody.indexOf("")); - System.out.println("request callbackUrl : " + callbackUrl); - System.out.println("request requestId : " + requestId); - - System.out.println("file path/name : " + responseDefinition.getBodyFileName()); - callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - // extract Response responseRequestId - String responseRequestId = callbackResponse.substring(callbackResponse.indexOf("")+11, callbackResponse.indexOf("")); - System.out.println("response requestId: " + responseRequestId); - System.out.println("callbackResponse (before): " + callbackResponse); - callbackResponse = callbackResponse.replace(responseRequestId, requestId); - if (this.requestId != null) { - callbackResponse = callbackResponse.replace(this.requestId, requestId); - } else { - callbackResponse = callbackResponse.replace(responseRequestId, requestId); - } - System.out.println("callbackResponse (after):" + callbackResponse); - - Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay"); - int delay = 300; - if (sdncDelay != null) { - delay = Integer.parseInt(sdncDelay.toString()); - } - - //Kick off callback thread - System.out.println("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay); - CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay); - calbackResponseThread.start(); - - //return 200 OK with body - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(200).withBody(callbackResponse).withHeader("Content-Type", "text/xml") - .build(); - } - - @Override - public boolean applyGlobally() { - return false; - } - - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - // TODO Auto-generated catch block - LOGGER.debug("Exception :",e1); - } - LOGGER.debug("Sending callback response to url: " + callbackUrl); - ClientRequest request = new ClientRequest(callbackUrl); - request.body("text/xml", payLoad); - //System.err.println(payLoad); - try { - ClientResponse result = request.post(); - LOGGER.debug("Successfully posted callback? Status: " + result.getStatus()); - } catch (Exception e) { - // TODO Auto-generated catch block - LOGGER.debug("catch error in - request.post() "); - LOGGER.debug("Exception :",e); - } - } - - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java deleted file mode 100644 index 6efd992566..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java +++ /dev/null @@ -1,1093 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.mock; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.patch; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; - - -/** - * Reusable Mock StubResponses for AAI Endpoints - * - */ -public class StubResponseAAI { - - public static void setupAllMocks() { - - } - - - /** - * Tunnel-XConnect Mock Stub Response - */ - public static void MockPutTunnelXConnect(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String tunnelId){ - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "/tunnel-xconnects/tunnel-xconnect/" + tunnelId)) - .willReturn(aResponse() - .withStatus(200))); - } - - - /** - * Allotted Resource Mock StubResponses below - */ - public static void MockGetAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockPutAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) - .willReturn(aResponse() - .withStatus(200))); - } - - public static void MockPutAllottedResource_500(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) - .willReturn(aResponse() - .withStatus(500))); - } - - public static void MockDeleteAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String resourceVersion) { - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "[?]resource-version=" + resourceVersion)) - .willReturn(aResponse() - .withStatus(204))); - } - - public static void MockPatchAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { - stubFor(patch(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) - .willReturn(aResponse() - .withStatus(200))); - } - - public static void MockQueryAllottedResourceById(String allottedResourceId, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=allotted-resource[&]filter=id:EQUALS:" + allottedResourceId)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - - /** - * Service Instance Mock StubResponses below - */ - public static void MockGetServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId){ - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) - .willReturn(aResponse() - .withStatus(404))); - } - - public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId){ - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) - .willReturn(aResponse() - .withStatus(500))); - } - - public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockNodeQueryServiceInstanceByName(String serviceInstanceName, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-name:EQUALS:" + serviceInstanceName)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockNodeQueryServiceInstanceByName_404(String serviceInstanceName){ - stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName)) - .willReturn(aResponse() - .withStatus(404))); - } - - public static void MockNodeQueryServiceInstanceByName_500(String serviceInstanceName){ - stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName)) - .willReturn(aResponse() - .withStatus(500))); - } - - public static void MockNodeQueryServiceInstanceById(String serviceInstanceId, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-id:EQUALS:" + serviceInstanceId)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockNodeQueryServiceInstanceById_404(String serviceInstanceId){ - stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId)) - .willReturn(aResponse() - .withStatus(404))); - } - - public static void MockNodeQueryServiceInstanceById_500(String serviceInstanceId){ - stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId)) - .willReturn(aResponse() - .withStatus(500))); - } - - public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) - .willReturn(aResponse() - .withStatus(204))); - } - - public static void MockGetServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){ - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) - .willReturn(aResponse() - .withStatus(statusCode))); - } - - public static void MockGetServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){ - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" + resourceVersion)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml"))); - } - - public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){ - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) - .willReturn(aResponse() - .withStatus(statusCode))); - } - - public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){ - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" +1234)) - .willReturn(aResponse() - .withStatus(statusCode))); - } - - public static void MockDeleteServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) - .willReturn(aResponse() - .withStatus(404))); - } - - public static void MockDeleteServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) - .willReturn(aResponse() - .withStatus(500))); - } - - public static void MockPutServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) { - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockPutServiceInstance_500(String globalCustId, String subscriptionType, String serviceInstanceId) { - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) - .willReturn(aResponse() - .withStatus(500))); - } - - /** - * Service-Subscription Mock StubResponses below - */ - public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockDeleteServiceSubscription(String globalCustId, String subscriptionType, int statusCode) { - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) - .willReturn(aResponse() - .withStatus(statusCode))); - } - - public static void MockDeleteServiceInstanceId(String globalCustId, String subscriptionType, String serviceInstanceId) { - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) - .willReturn(aResponse() - .withStatus(200))); - } - - public static void MockPutServiceSubscription(String globalCustId, String subscriptionType) { - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) - .willReturn(aResponse() - .withStatus(200))); - } - - public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) - .willReturn(aResponse() - .withStatus(statusCode))); - } - - /** - * Customer Mock StubResponses below - */ - public static void MockGetCustomer(String globalCustId, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockDeleteCustomer(String globalCustId) { - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) - .willReturn(aResponse() - .withStatus(200))); - } - - public static void MockPutCustomer(String globalCustId) { - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) - .willReturn(aResponse() - .withStatus(200))); - } - - public static void MockPutCustomer_500(String globalCustId) { - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) - .willReturn(aResponse() - .withStatus(500))); - } - - - /** - * Generic-Vnf Mock StubResponses below - */ - - public static void MockGetGenericVnfById(String vnfId, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetGenericVnfById(String vnfId, String responseFile, int statusCode){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetGenericVnfByIdWithPriority(String vnfId, int statusCode, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) - .atPriority(1) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetGenericVnfByIdWithPriority(String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) - .atPriority(priority) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetGenericVnfByIdWithDepth(String vnfId, int depth, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=" + depth)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetGenericVnfById_404(String vnfId){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) - .willReturn(aResponse() - .withStatus(404))); - } - - public static void MockGetGenericVnfById_500(String vnfId){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) - .willReturn(aResponse() - .withStatus(500))); - } - - public static void MockGetGenericVnfByName(String vnfName, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetGenericVnfByNameWithDepth(String vnfName, int depth, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetGenericVnfByName_404(String vnfName){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName)) - .willReturn(aResponse() - .withStatus(404))); - } - - public static void MockDeleteGenericVnf(String vnfId, String resourceVersion){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) - .willReturn(aResponse() - .withStatus(204))); - } - - public static void MockDeleteGenericVnf(String vnfId, String resourceVersion, int statusCode){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) - .willReturn(aResponse() - .withStatus(statusCode))); - } - - public static void MockDeleteGenericVnf_500(String vnfId, String resourceVersion){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) - .willReturn(aResponse() - .withStatus(500))); - } - - public static void MockPutGenericVnf(String vnfId){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) - .willReturn(aResponse() - .withStatus(200))); - } - - public static void MockPutGenericVnf(String vnfId, String requestBodyContaining, int statusCode) { - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) - .withRequestBody(containing(requestBodyContaining)) - .willReturn(aResponse() - .withStatus(statusCode))); - } - - public static void MockPutGenericVnf(String vnfId, int statusCode) { - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) - .willReturn(aResponse() - .withStatus(statusCode))); - } - - public static void MockPutGenericVnf_Bad(String vnfId, int statusCode){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) - .willReturn(aResponse() - .withStatus(statusCode))); - } - - public static void MockPatchGenericVnf(String vnfId){ - stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) - .willReturn(aResponse() - .withStatus(200))); - } - /** - * Vce Mock StubResponses below - */ - public static void MockGetVceById(String vnfId, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetVceByName(String vnfName, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockDeleteVce(String vnfId, String resourceVersion, int statusCode){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId + "[?]resource-version=" + resourceVersion)) - .willReturn(aResponse() - .withStatus(statusCode))); - } - - public static void MockPutVce(String vnfId){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId)) - .willReturn(aResponse() - .withStatus(200))); - } - - public static void MockGetGenericVceByNameWithDepth(String vnfName, int depth, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetVceGenericQuery(String serviceInstanceName, int depth, int statusCode, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=service-instance.service-instance-name:" + serviceInstanceName + "[&]start-node-type=service-instance[&]include=vce[&]depth=" + depth)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - /** - * Tenant Mock StubResponses below - */ - public static void MockGetTenantGenericQuery(String customer, String serviceType, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=customer.global-customer-id:" + customer + "&key=service-subscription.service-type:" + serviceType + "&start-node-type=service-subscription&include=tenant&include=service-subscription&depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetTenant(String tenantId, String responseFile) { - stubFor(get(urlEqualTo("/aai/v2/cloud-infrastructure/tenants/tenant/" + tenantId)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - /** - * Network Mock StubResponses below - */ - public static void MockGetNetwork(String networkId, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetNetworkByIdWithDepth(String networkId, String responseFile, String depth) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetNetworkCloudRegion(String responseFile, String cloudRegion) { - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetNetworkByName(String networkName, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetNetworkByName_404(String responseFile, String networkName) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName)) - .willReturn(aResponse() - .withStatus(404) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetNetworkCloudRegion_404(String cloudRegion) { - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion)) - .willReturn(aResponse() - .withStatus(404))); - } - - public static void MockPutNetwork(String networkId, int statusCode, String responseFile) { - stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockPutNetwork(String networkPolicyId, String responseFile, int statusCode) { - stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetNetworkName(String networkPolicyName, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetNetworkVpnBinding(String responseFile, String vpnBinding) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/"+vpnBinding + "[?]depth=all")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetNetworkPolicy(String responseFile, String policy) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/"+policy + "[?]depth=all")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetNetworkVpnBinding(String networkBindingId, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetNetworkPolicy(String networkPolicy, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetNetworkTableReference(String responseFile, String tableReference) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/"+tableReference + "[?]depth=all")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockPutNetworkIdWithDepth(String responseFile, String networkId, String depth) { - stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/"+networkId+"[?]depth="+depth )) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetNetworkPolicyfqdn(String networkPolicy, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetNetworkRouteTable(String networkRouteId, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockPatchVfModuleId(String vnfId, String vfModuleId) { - stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) - .willReturn(aResponse() - .withStatus(200))); - } - - ///////////// - - public static void MockVNFAdapterRestVfModule() { - stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - } - - public static void MockDBUpdateVfModule(){ - stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VfModularity/DBUpdateResponse.xml"))); - } - - // start of mocks used locally and by other VF Module unit tests - public static void MockSDNCAdapterVfModule() { - // simplified the implementation to return "success" for all requests - stubFor(post(urlEqualTo("/SDNCAdapter")) -// .withRequestBody(containing("SvcInstanceId><")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml"))); - - } - - // start of mocks used locally and by other VF Module unit tests - public static void MockAAIVfModule() { - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool")) - .atPriority(1) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VfModularity/VfModule-supercool.xml"))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/lukewarm")) - .atPriority(2) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VfModularity/VfModule-lukewarm.xml"))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) - .atPriority(5) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VfModularity/VfModule-new.xml"))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VfModularity/GenericVnf.xml"))); - stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool")) -// .withRequestBody(containing("PCRF")) - .willReturn(aResponse() - .withStatus(200))); - stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) -// .withRequestBody(containing("PCRF")) - .willReturn(aResponse() - .withStatus(200))); - // HTTP PUT stub still used by CreateAAIvfModuleVolumeGroup - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) - .withRequestBody(containing("PCRF")) - .willReturn(aResponse() - .withStatus(200))); - // HTTP PUT stub still used by DoCreateVfModuleTest - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) - .withRequestBody(containing("MODULELABEL")) - .willReturn(aResponse() - .withStatus(200))); - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml"))); - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml"))); - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/MDTWNJ21/volume-groups/volume-group/78987")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VfModularity/VolumeGroup.xml"))); - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group/78987")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VfModularity/VolumeGroup.xml"))); - stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group/78987[?]resource-version=0000020")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("DeleteCinderVolumeV1/DeleteVolumeId_AAIResponse_Success.xml"))); - stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VfModularity/AddNetworkPolicy_AAIResponse_Success.xml"))); - stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/NEWvBNGModuleId")) - .withRequestBody(containing("NEWvBNGModuleId")) - .willReturn(aResponse() - .withStatus(200))); - } - - - - ////////////// - - /** - * Cloud infrastructure below - */ - - public static void MockGetCloudRegion(String cloudRegionId, int statusCode, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - /** - * Volume Group StubResponse below - */ - public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockPutVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) { - stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetVolumeGroupByName(String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockDeleteVolumeGroupById(String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) { - stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) - .willReturn(aResponse() - .withStatus(statusCode))); - } - - public static void MockGetVolumeGroupByName_404(String cloudRegionId, String volumeGroupName) { - stubFor(get(urlMatching("/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) - .willReturn(aResponse() - .withStatus(404))); - } - - public static void MockDeleteVolumeGroup(String cloudRegionId, String volumeGroupId, String resourceVersion) { - stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) - .willReturn(aResponse() - .withStatus(200))); - } - - /** - * VF-Module StubResponse below - * @param statusCode TODO - */ - public static void MockGetVfModuleId(String vnfId, String vfModuleId, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetVfModuleByNameWithDepth(String vnfId, String vfModuleName, int depth, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName + "[?]depth=" + depth)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetVfModuleByName(String vnfId, String vfModuleName, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockGetVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) - .withRequestBody(containing(requestContaining)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml"))); - } - - public static void MockPutVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) { - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId +"/vf-modules/vf-module/" +vfModuleId)) - .withRequestBody(containing(requestContaining)) - .willReturn(aResponse() - .withStatus(200))); - } - - public static void MockPutVfModuleId(String vnfId, String vfModuleId) { - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) - .willReturn(aResponse() - .withStatus(200))); - } - - public static void MockPutVfModuleId(String vnfId, String vfModuleId, int returnCode) { - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) - .willReturn(aResponse() - .withStatus(returnCode))); - } - - public static void MockDeleteVfModuleId(String vnfId, String vfModuleId, String resourceVersion, int returnCode) { - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion)) - .willReturn(aResponse() - .withStatus(returnCode))); - } - - public static void MockAAIVfModuleBadPatch(String endpoint, int statusCode) { - stubFor(patch(urlMatching(endpoint)) - .willReturn(aResponse() - .withStatus(statusCode))); - } - - /* AAI Pserver Queries */ - public static void MockGetPserverByVnfId(String vnfId, String responseFile, int statusCode) { - stubFor(put(urlMatching("/aai/v1[0-9]/query.*")) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/json") - .withBodyFile(responseFile))); - } - - public static void MockGetGenericVnfsByVnfId(String vnfId, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/json; charset=utf-8") - .withBodyFile(responseFile))); - } - - public static void MockSetInMaintFlagByVnfId(String vnfId, int statusCode) { - stubFor(patch(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) - .willReturn(aResponse() - .withStatus(statusCode) - )); - } - - public static void MockSetInMaintFlagByVnfId(String vnfId, String responseFile, int statusCode) { - stubFor(post(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) - .willReturn(aResponse() - .withStatus(statusCode) - .withBodyFile(responseFile) - )); - } - - public static void MockGetDefaultCloudRegionByCloudRegionId(String cloudRegionId, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v1[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegionId + ".*")) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/json; charset=utf-8") - .withBodyFile(responseFile))); - } - - //// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones above //// - @Deprecated - public static void MockGetVceById(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123?depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericFlows/getVceResponse.xml"))); - } - @Deprecated - public static void MockGetVceByName(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=testVnfName123")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericFlows/getVceByNameResponse.xml"))); - } - @Deprecated - public static void MockPutVce(){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123")) - .willReturn(aResponse() - .withStatus(200))); - } - @Deprecated - public static void MockDeleteVce(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123")) - .willReturn(aResponse() - .withStatus(204))); - } - @Deprecated - public static void MockDeleteVce_404(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123")) - .willReturn(aResponse() - .withStatus(404))); - } - - @Deprecated - public static void MockDeleteServiceSubscription(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234")) - .willReturn(aResponse() - .withStatus(204))); - } - @Deprecated - public static void MockGetServiceSubscription(){ - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericFlows/getServiceSubscription.xml"))); - } - @Deprecated - public static void MockGetServiceSubscription_200Empty(){ - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(" "))); - } - @Deprecated - public static void MockGetServiceSubscription_404() { - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) - .willReturn(aResponse() - .withStatus(404))); - } - @Deprecated - public static void MockGENPSIPutServiceInstance(){ - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"))); - } - - @Deprecated - public static void MockGENPSIPutServiceSubscription(){ - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"))); - } - @Deprecated - public static void MockGENPSIPutServiceInstance_get500(){ - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericPutServiceInstance/aaiFault.xml"))); - } - - @Deprecated - public static void MockGetGenericVnfById(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml"))); - } - @Deprecated - public static void MockGetGenericVnfById_404(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) - .willReturn(aResponse() - .withStatus(404))); - } - @Deprecated - public static void MockGetGenericVnfByName(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericFlows/getGenericVnfResponse.xml"))); - } - @Deprecated - public static void MockGetGenericVnfByName_hasRelationships(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml"))); - } - @Deprecated - public static void MockGetGenericVnfById_hasRelationships(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml"))); - } - @Deprecated - public static void MockGetGenericVnfById_500(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) - .willReturn(aResponse() - .withStatus(500))); - } - @Deprecated - public static void MockGetGenericVnfByName_404(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) - .willReturn(aResponse() - .withStatus(404))); - } - @Deprecated - public static void MockPutGenericVnf(){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) - .willReturn(aResponse() - .withStatus(200))); - } - @Deprecated - public static void MockPutGenericVnf_400(){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) - .willReturn(aResponse() - .withStatus(400))); - } - @Deprecated - public static void MockDeleteGenericVnf(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) - .willReturn(aResponse() - .withStatus(204))); - } - @Deprecated - public static void MockDeleteGenericVnf_404(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) - .willReturn(aResponse() - .withStatus(404))); - } - @Deprecated - public static void MockDeleteGenericVnf_500(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) - .willReturn(aResponse() - .withStatus(500))); - } - @Deprecated - public static void MockDeleteGenericVnf_412(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[[?]]resource-version=testReVer123")) - .willReturn(aResponse() - .withStatus(412))); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAPPC.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAPPC.java deleted file mode 100644 index e94f0142d2..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAPPC.java +++ /dev/null @@ -1,65 +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.bpmn.mock; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.patch; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; - -/** - * Reusable Mock StubResponses for Policy - * - */ -public class StubResponseAPPC { - - public static void setupAllMocks() { - - } - - // start of Policy mocks - public static void MockAppcError() { - stubFor(get(urlMatching("/events/.*")) - // .withRequestBody(containing("APPC")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile("APPC/appc_error.json"))); - stubFor(put(urlMatching("/events/.*")) - // .withRequestBody(containing("APPC")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile("APPC/appc_error.json"))); - - - - } - - - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java deleted file mode 100644 index ffa6701a89..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.mock; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; - -/** - * Stub response class for Database stubs - * including database adapter, catalog db, - * and other databases. - */ -public class StubResponseDatabase { - - public static void setupAllMocks() { - - } - - public static void MockUpdateRequestDB(String fileName){ - stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(fileName))); - } - - public static void mockUpdateRequestDB(int statusCode, String reponseFile) { - stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(reponseFile))); - } - - public static void MockGetAllottedResourcesByModelInvariantId(String modelInvariantId, String responseFile){ - stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile(responseFile))); - } - - public static void MockGetAllottedResourcesByModelInvariantId_500(String modelInvariantId, String responseFile){ - stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId)) - .willReturn(aResponse() - .withStatus(500))); - } - - public static void MockGetVnfCatalogDataCustomizationUuid(String vnfModelCustomizationUuid, String responseFile){ - stubFor(get(urlEqualTo("/v2/serviceVnfs?vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile(responseFile))); - } - - public static void MockGetVfModuleByModelNameCatalogData(String vfModuleModelName, String responseFile){ - stubFor(get(urlEqualTo("/v2/vfModules?vfModuleModelName=" + vfModuleModelName)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile(responseFile))); - } - - public static void MockGetServiceResourcesCatalogData(String serviceModelInvariantUuid, String serviceModelVersion, String responseFile){ - stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid + - "&serviceModelVersion=" + serviceModelVersion)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile(responseFile))); - } - - public static void MockGetServiceResourcesCatalogData(String serviceModelInvariantUuid, String responseFile){ - stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile(responseFile))); - } - - public static void MockGetServiceResourcesCatalogDataByModelUuid(String serviceModelUuid, String responseFile){ - stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelUuid=" + serviceModelUuid)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile(responseFile))); - } - - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java deleted file mode 100644 index 8baeb1b137..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.mock; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; - -/** - * Please describe the StubResponseNetwork.java class - * - */ -public class StubResponseNetworkAdapter { - - private static final String EOL = "\n"; - - public static void setupAllMocks() { - - } - - - public static void MockNetworkAdapter() { - stubFor(post(urlEqualTo("/networks/NetworkAdapter")) - .willReturn(aResponse() - .withStatus(200))); - } - - public static void MockNetworkAdapter(String response) { - stubFor(post(urlEqualTo("/networks/NetworkAdapter")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(response))); - } - - public static void MockNetworkAdapter_500() { - stubFor(post(urlEqualTo("/networks/NetworkAdapter")) - .willReturn(aResponse() - .withStatus(500))); - } - - public static void MockNetworkAdapterPost(String responseFile, String requestContaining) { - stubFor(post(urlEqualTo("/networks/NetworkAdapter")) - .withRequestBody(containing(requestContaining)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockNetworkAdapter(String networkId, int statusCode, String responseFile) { - stubFor(delete(urlEqualTo("/networks/NetworkAdapter/" + networkId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml") - .withBodyFile(responseFile))); - } - - public static void MockNetworkAdapterContainingRequest(String requestContaining, int statusCode, String responseFile) { - stubFor(post(urlEqualTo("/networks/NetworkAdapter")) - .withRequestBody(containing(requestContaining)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockPutNetworkAdapter(String networkId, String requestContaining, int statusCode, String responseFile) { - stubFor(put(urlEqualTo("/networks/NetworkAdapter/" + networkId)) - .withRequestBody(containing(requestContaining)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockNetworkAdapterRestRollbackDelete(String responseFile, String networkId) { - stubFor(delete(urlEqualTo("/networks/NetworkAdapter/"+networkId+"/rollback")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void MockNetworkAdapterRestPut(String responseFile, String networkId) { - stubFor(put(urlEqualTo("/networks/NetworkAdapter/"+networkId)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseOof.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseOof.java deleted file mode 100644 index b969b382c0..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseOof.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -package org.openecomp.mso.bpmn.mock; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; - -/** - * StubResponseOof.java class - */ -public class StubResponseOof { - - public static void setupAllMocks() { - - } - - public static void mockOof() { - stubFor(post(urlEqualTo("/api/oof/v1/placement")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/json"))); - } - - public static void mockOof(String responseFile) { - stubFor(post(urlEqualTo("/api/oof/v1/placement")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/json") - .withBodyFile(responseFile))); - } - - public static void mockOof_400() { - stubFor(post(urlEqualTo("/api/oof/v1/placement")) - .willReturn(aResponse() - .withStatus(400) - .withHeader("Content-Type", "application/json"))); - } - - public static void mockOof_500() { - stubFor(post(urlEqualTo("/api/oof/v1/placement")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "application/json"))); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java deleted file mode 100644 index fd13084613..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.mock; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.patch; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; - -/** - * Reusable Mock StubResponses for Policy - * - */ -public class StubResponsePolicy { - - public static void setupAllMocks() { - - } - - // start of Policy mocks - public static void MockPolicyAbort() { - stubFor(post(urlEqualTo("/pdp/api/getDecision")) - .withRequestBody(containing("BB1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile("policyAbortResponse.json"))); - - stubFor(post(urlEqualTo("/pdp/api/getDecision")) - .withRequestBody(containing("UPDVnfI")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile("policyAbortResponse.json"))); - - stubFor(post(urlEqualTo("/pdp/api/getDecision")) - .withRequestBody(containing("RPLVnfI")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile("policyAbortResponse.json"))); - - stubFor(post(urlEqualTo("/pdp/api/getDecision")) - .withRequestBody(containing("VnfIPU")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile("policyAbortResponse.json"))); - - stubFor(post(urlEqualTo("/pdp/api/getDecision")) - .withRequestBody(containing("VnfCU")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile("policyAbortResponse.json"))); - - - - } - - public static void MockPolicySkip() { - stubFor(post(urlEqualTo("/pdp/api/getDecision")) - .withRequestBody(containing("BB1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile("Policy/policySkipResponse.json"))); - - stubFor(post(urlEqualTo("/pdp/api/getDecision")) - .withRequestBody(containing("UPDVnfI")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile("Policy/policySkipResponse.json"))); - - stubFor(post(urlEqualTo("/pdp/api/getDecision")) - .withRequestBody(containing("RPLVnfI")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile("Policy/policySkipResponse.json"))); - - stubFor(post(urlEqualTo("/pdp/api/getDecision")) - .withRequestBody(containing("VnfIPU")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile("Policy/policySkipResponse.json"))); - - stubFor(post(urlEqualTo("/pdp/api/getDecision")) - .withRequestBody(containing("VnfCU")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBodyFile("Policy/policySkipResponse.json"))); - - - } - - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java deleted file mode 100644 index f41d6d7dba..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.mock; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; - -/** - * Please describe the StubResponseSDNC.java class - */ -public class StubResponseSDNCAdapter { - - public static void setupAllMocks() { - - } - - public static void mockSDNCAdapter_500() { - stubFor(post(urlEqualTo("/SDNCAdapter")) - .willReturn(aResponse() - .withStatus(500))); - } - - public static void mockSDNCAdapter_500(String requestContaining) { - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing(requestContaining)) - .willReturn(aResponse() - .withStatus(500))); - } - - public static void mockSDNCAdapter(int statusCode) { - stubFor(post(urlEqualTo("/SDNCAdapter")) - .willReturn(aResponse() - .withStatus(statusCode))); - } - - public static void mockSDNCAdapter(String endpoint, int statusCode, String responseFile) { - stubFor(post(urlEqualTo(endpoint)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void mockSDNCAdapter(String responseFile) { - stubFor(post(urlEqualTo("/SDNCAdapter")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void mockSDNCAdapter(String endpoint, String requestContaining, int statusCode, String responseFile) { - stubFor(post(urlEqualTo(endpoint)) - .withRequestBody(containing(requestContaining)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void mockSDNCAdapterSimulator(String responseFile) { - MockResource mockResource = new MockResource(); - mockResource.updateProperties("sdnc_delay", "300"); - stubFor(post(urlEqualTo("/SDNCAdapter")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/soap+xml") - .withTransformers("sdnc-adapter-transformer") - .withBodyFile(responseFile))); - } - - public static void mockSDNCAdapterSimulator(String responseFile, String requestContaining) { - MockResource mockResource = new MockResource(); - mockResource.updateProperties("sdnc_delay", "300"); - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing(requestContaining)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/soap+xml") - .withTransformers("sdnc-adapter-transformer") - .withBodyFile(responseFile))); - } - - public static void mockSDNCAdapterRest() { - stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/json"))); - } - - public static void mockSDNCAdapterRest_500() { - stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "application/json"))); - } - - public static void mockSDNCAdapterRest(String requestContaining) { - stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) - .withRequestBody(containing(requestContaining)) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/json"))); - } - - public static void mockSDNCAdapterRest_500(String requestContaining) { - stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) - .withRequestBody(containing(requestContaining)) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "application/json"))); - } - - public static void mockSDNCAdapterTopology(String responseFile, String requestContaining) { - MockResource mockResource = new MockResource(); - mockResource.updateProperties("sdnc_delay", "300"); - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing(requestContaining)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withTransformers("network-topology-operation-transformer") - .withBodyFile(responseFile))); - } - - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java deleted file mode 100644 index c16ac43d41..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -package org.openecomp.mso.bpmn.mock; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; - -/** - * Please describe the StubResponseSNIRO.java class - * - * @author cb645j - */ -public class StubResponseSNIRO { - - public static void setupAllMocks() { - - } - - public static void mockSNIRO() { - stubFor(post(urlEqualTo("/sniro/api/v2/placement")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/json"))); - } - - public static void mockSNIRO(String responseFile) { - stubFor(post(urlEqualTo("/sniro/api/v2/placement")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/json") - .withBodyFile(responseFile))); - } - - public static void mockSNIRO_400() { - stubFor(post(urlEqualTo("/sniro/api/v2/placement")) - .willReturn(aResponse() - .withStatus(400) - .withHeader("Content-Type", "application/json"))); - } - - public static void mockSNIRO_500() { - stubFor(post(urlEqualTo("/sniro/api/v2/placement")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "application/json"))); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java deleted file mode 100644 index d518ab0b1c..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.mock; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; - -/** - * Please describe the StubResponseVNF.java class - */ -public class StubResponseVNFAdapter { - - public static void mockVNFAdapter() { - stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) - .willReturn(aResponse() - .withStatus(200))); - } - - public static void mockVNFAdapter(String responseFile) { - stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } - - public static void mockVNFAdapter_500() { - stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) - .willReturn(aResponse() - .withStatus(500))); - } - - public static void mockVNFAdapterTransformer(String transformer, String responseFile) { - MockResource mockResource = new MockResource(); - mockResource.updateProperties("vnf_delay", "300"); - stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/soap+xml") - .withTransformers(transformer) - .withBodyFile(responseFile))); - } - - public static void mockVNFAdapterTransformer(String transformer, String responseFile, String requestContaining) { - MockResource mockResource = new MockResource(); - mockResource.updateProperties("vnf_delay", "300"); - stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) - .withRequestBody(containing(requestContaining)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/soap+xml") - .withTransformers(transformer) - .withBodyFile(responseFile))); - } - - public static void mockVNFPost(String vfModuleId, int statusCode, String vnfId) { - stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - stubFor(post(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - } - - public static void mockVNFPut(String vfModuleId, int statusCode) { - stubFor(put(urlEqualTo("/vnfs/v1/vnfs/vnfId/vf-modules" + vfModuleId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - stubFor(put(urlEqualTo("/vnfs/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - } - - public static void mockVNFPut(String vnfId, String vfModuleId, int statusCode) { - stubFor(put(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - stubFor(put(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - } - - public static void mockVNFDelete(String vnfId, String vfModuleId, int statusCode) { - stubFor(delete(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - } - - public static void mockVNFRollbackDelete(String vfModuleId, int statusCode) { - stubFor(delete(urlEqualTo("/vnfs/v1/vnfs/vnfId/vf-modules" + vfModuleId + "/rollback")) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlEqualTo("/vnfs/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId + "/rollback")) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - } - - public static void mockPutVNFVolumeGroup(String volumeGroupId, int statusCode) { - stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/" + volumeGroupId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - stubFor(put(urlEqualTo("/vnfs/rest/v1/volume-groups/" + volumeGroupId)) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - } - - public static void mockPutVNFVolumeGroupRollback(String volumeGroupId, int statusCode) { - stubFor(delete(urlMatching("/vnfs/v1/volume-groups/" + volumeGroupId + "/rollback")) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/" + volumeGroupId + "/rollback")) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - } - public static void mockPostVNFVolumeGroup(int statusCode) { - stubFor(post(urlEqualTo("/vnfs/v1/volume-groups")) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - stubFor(post(urlEqualTo("/vnfs/rest/v1/volume-groups")) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - } - - public static void mockVNFAdapterRest(String vnfId) { - stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules")) - .willReturn(aResponse() - .withStatus(200))); - stubFor(post(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules")) - .willReturn(aResponse() - .withStatus(200))); - } - - public static void mockVNFAdapterRest_500(String vnfId) { - stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules")) - .willReturn(aResponse() - .withStatus(500))); - stubFor(post(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules")) - .willReturn(aResponse() - .withStatus(500))); - } - - public static void mockVfModuleDelete(String volumeGroupId) { - stubFor(delete(urlMatching("/vnfs/v1/volume-groups/"+ volumeGroupId)) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/"+ volumeGroupId)) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - } - - public static void mockVfModuleDelete(String volumeGroupId, int statusCode) { - stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987")) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/78987")) - .willReturn(aResponse() - .withStatus(statusCode) - .withHeader("Content-Type", "application/xml"))); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterAsyncTransformer.java deleted file mode 100644 index 2eebe94f2b..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterAsyncTransformer.java +++ /dev/null @@ -1,163 +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.bpmn.mock; - -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.BinaryFile; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; - -/** - * - * Simulates VNF Adapter Asynch Callback response. - * This should work for any of the operations. - * - * This transformer uses the mapped message as the asynchronous response. - * By definition, the async API sends a 202 (with no body) in the sync response. - * - */ -public class VnfAdapterAsyncTransformer extends ResponseTransformer { - - public VnfAdapterAsyncTransformer() { - } - - public String name() { - return "vnf-adapter-async"; - } - - /** - * Grab the incoming request, extract properties to be copied to the response - * (request id, vnf id, vf module ID, message ID). Then fetch the actual response - * body from its FileSource, make the replacements. - * - * The sync response is an empty 202 response. - * The transformed mapped response file is sent asynchronously after a delay. - * - * Mock Resource can be used to add dynamic properties. If vnf_delay is not in the list by - * default waits for 5s before the callback response is sent - */ - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource) { - - String requestBody = request.getBodyAsString(); - - // Note: Should recognize both XML and JSON. But current BPMN uses XML. - String notificationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); - - String vnfId = requestBody.substring(requestBody.indexOf("")+7, requestBody.indexOf("")); - String vfModuleId = requestBody.substring(requestBody.indexOf("")+12, requestBody.indexOf("")); - String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); - String requestId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); - - System.out.println("responseDefinition: " + responseDefinition); - - // For this mock, the mapped response body is the Async callback (since the sync response is generic for all requests) - String vnfResponse = responseDefinition.getBody(); - System.out.println("VNF Response:" + vnfResponse); - - if (vnfResponse == null) { - // Body wasn't specified. Check for a body file - String bodyFileName = responseDefinition.getBodyFileName(); - System.out.println("bodyFileName" + bodyFileName); - if (bodyFileName != null) { - System.out.println("fileSource Class: " + fileSource.getClass().getName()); - BinaryFile bodyFile = fileSource.getBinaryFileNamed(bodyFileName); - byte[] responseFile = bodyFile.readContents(); - vnfResponse = new String(responseFile); - System.out.println("vnfResponse(2):" + vnfResponse); - } - } - - // Transform the SDNC response to escape < and > - vnfResponse = vnfResponse.replaceAll ("VNF_ID", vnfId); - vnfResponse = vnfResponse.replaceAll ("VF_MODULE_ID", vfModuleId); - vnfResponse = vnfResponse.replaceAll ("REQUEST_ID", requestId); - vnfResponse = vnfResponse.replaceAll ("MESSAGE_ID", messageId); - - Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); - int delay = 5000; - if (vnfDelay != null) { - delay = Integer.parseInt(vnfDelay.toString()); - } - - //Kick off callback thread - System.out.println("notification Url:" + notificationUrl + ":delay:" + delay); - CallbackResponseThread calbackResponseThread = new CallbackResponseThread(notificationUrl,vnfResponse, delay); - calbackResponseThread.start(); - - //return 200 OK with empty body - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(202).withBody("").withHeader("Content-Type", "text/xml") - .build(); - } - - @Override - public boolean applyGlobally() { - return false; - } - - /** - * - * Callback response thread which sends the callback response asynchronously - * - */ - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - System.out.println("Sending callback response:" + callbackUrl); - ClientRequest request = new ClientRequest(callbackUrl); - request.body("text/xml", payLoad); - System.err.println(payLoad); - try { - ClientResponse result = request.post(); - //System.err.println("Successfully posted callback:" + result.getStatus()); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java deleted file mode 100644 index 23921da8d8..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.mock; - -import javax.xml.ws.Endpoint; - -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; -import org.openecomp.mso.logger.MsoLogger; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; - -import org.openecomp.mso.logger.MsoLogger; -/** - * Please describe the VnfAdapterCreateMockTransformer.java class - * - */ -public class VnfAdapterCreateMockTransformer extends ResponseTransformer { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private String notifyCallbackResponse; - private String ackResponse; - - public VnfAdapterCreateMockTransformer() { - notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfCreateSimResponse.xml"); // default response - } - - @Override - public String name() { - return "vnf-adapter-create-transformer"; - } - - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource) { - - String requestBody = request.getBodyAsString(); - - String notficationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); - String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); - String responseMessageId = ""; - String updatedResponse = ""; - - try { - // try supplied response file (if any) - System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); - ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - notifyCallbackResponse = ackResponse; - responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); - updatedResponse = ackResponse.replace(responseMessageId, messageId); - } catch (Exception ex) { - LOGGER.debug("Exception :",ex); - System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfCreateSimResponse.xml'"); - responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); - updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); - } - - System.out.println("response (mock) messageId : " + responseMessageId); - System.out.println("request (replacement) messageId: " + messageId); - - System.out.println("vnf Response (before):" + notifyCallbackResponse); - System.out.println("vnf Response (after):" + updatedResponse); - - Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); - int delay = 300; - if (vnfDelay != null) { - delay = Integer.parseInt(vnfDelay.toString()); - } - - //Kick off callback thread - System.out.println("VnfAdapterCreateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); - CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); - callbackResponseThread.start(); - - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") - .build(); - - } - - @Override - public boolean applyGlobally() { - return false; - } - - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - @SuppressWarnings("deprecation") - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - // TODO Auto-generated catch block - LOGGER.debug("Exception :",e1); - } - LOGGER.debug("Sending callback response to url: " + callbackUrl); - ClientRequest request = new ClientRequest(callbackUrl); - request.body("text/xml", payLoad); - //System.out.println("payLoad: " + payLoad); - - try { - ClientResponse result = request.post(); - LOGGER.debug("Successfully posted callback? Status: " + result.getStatus()); - //System.err.println("Successfully posted callback:" + result.getStatus()); - } catch (Exception e) { - // TODO Auto-generated catch block - LOGGER.debug("catch error in - request.post() "); - LOGGER.debug("Exception :",e); - } - } - - } - - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java deleted file mode 100644 index ee6972e46e..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.mock; - -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; -import org.openecomp.mso.logger.MsoLogger; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; -/** - * Please describe the VnfAdapterCreateMockTransformer.java class - * - */ -public class VnfAdapterDeleteMockTransformer extends ResponseTransformer { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private String notifyCallbackResponse; - private String ackResponse; - - public VnfAdapterDeleteMockTransformer() { - notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfDeleteSimResponse.xml"); - } - - @Override - public String name() { - return "vnf-adapter-delete-transformer"; - } - - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource) { - - // System.err.println("notifyCallbackResponse:" + notifyCallbackResponse); - - String requestBody = request.getBodyAsString(); - - String notficationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); - String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); - String responseMessageId = ""; - String updatedResponse = ""; - - try { - // try supplied response file (if any) - System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); - ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - notifyCallbackResponse = ackResponse; - responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); - updatedResponse = ackResponse.replace(responseMessageId, messageId); - } catch (Exception ex) { - LOGGER.debug("Exception :",ex); - System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'"); - responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); - updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); - } - - System.out.println("response (mock) messageId : " + responseMessageId); - System.out.println("request (replacement) messageId: " + messageId); - - System.out.println("vnf Response (before):" + notifyCallbackResponse); - System.out.println("vnf Response (after):" + updatedResponse); - - Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); - int delay = 300; - if (vnfDelay != null) { - delay = Integer.parseInt(vnfDelay.toString()); - } - - //Kick off callback thread - System.out.println("VnfAdapterDeleteMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); - CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); - callbackResponseThread.start(); - - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") - .build(); - - } - - @Override - public boolean applyGlobally() { - return false; - } - - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - @SuppressWarnings("deprecation") - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - // TODO Auto-generated catch block - LOGGER.debug("Exception :",e1); - } - System.out.println("Sending callback response to url: " + callbackUrl); - ClientRequest request = new ClientRequest(callbackUrl); - request.body("text/xml", payLoad); - //System.err.println(payLoad); - try { - ClientResponse result = request.post(); - System.out.println("Successfully posted callback? Status: " + result.getStatus()); - //System.err.println("Successfully posted callback:" + result.getStatus()); - } catch (Exception e) { - // TODO Auto-generated catch block - System.out.println("catch error in - request.post() "); - LOGGER.debug("Exception :",e); - } - } - - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java deleted file mode 100644 index 1582071d3a..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.mock; - - -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; - -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; -import org.openecomp.mso.logger.MsoLogger; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; - -import org.openecomp.mso.logger.MsoLogger; -/** - * Please describe the VnfAdapterQueryMockTransformer.java class - * - */ - - -public class VnfAdapterQueryMockTransformer extends ResponseTransformer{ - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private String notifyCallbackResponse; - private String ackResponse; - private String messageId; - - public VnfAdapterQueryMockTransformer() { - notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfQuerySimResponse.xml"); - } - - public VnfAdapterQueryMockTransformer(String messageId) { - this.messageId = messageId; - } - - @Override - public String name() { - return "vnf-adapter-query-transformer"; - } - - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource) { - - String requestBody = request.getBodyAsString(); - - String notficationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); - String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); - // String updatedResponse = notifyCallbackResponse.replace("b1a82ce6-7f5c-45fd-9273-acaf88fc2137", messageId); - - String responseMessageId = ""; - String updatedResponse = ""; - - // if (ackResponse == null) { - //System.err.println("file:" + responseDefinition.getBodyFileName()); - // ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - //} - - - try { - // try supplied response file (if any) - System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); - ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - notifyCallbackResponse = ackResponse; - responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); - updatedResponse = ackResponse.replace(responseMessageId, messageId); - } catch (Exception ex) { - LOGGER.debug("Exception :",ex); - System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'"); - responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); - updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); - } - - System.out.println("response (mock) messageId : " + responseMessageId); - System.out.println("request (replacement) messageId: " + messageId); - - System.out.println("vnf Response (before):" + notifyCallbackResponse); - System.out.println("vnf Response (after):" + updatedResponse); - - - Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); - int delay = 300; - if (vnfDelay != null) { - delay = Integer.parseInt(vnfDelay.toString()); - } - - //Kick off callback thread - - //System.out.println("notficationUrl" + notficationUrl); - //System.out.println("updatedResponse" + updatedResponse); - System.out.println("VnfAdapterQueryMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); - CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); - System.out.println("Inside Callback" ); - callbackResponseThread.start(); - - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") - .build(); - } - - @Override - public boolean applyGlobally() { - return false; - } - - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - LOGGER.debug("Exception :",e1); - } - ClientRequest request = new ClientRequest(callbackUrl); - request.body("text/xml", payLoad); - //System.err.println(payLoad); - try { - ClientResponse result = request.post(); - //System.err.println("Successfully posted callback:" + result.getStatus()); - } catch (Exception e) { - LOGGER.debug("Exception :",e); - } - } - - } - - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java deleted file mode 100644 index 186fd35b6f..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.mock; - -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; - -import org.openecomp.mso.logger.MsoLogger; -/** - * Please describe the VnfAdapterCreateMockTransformer.java class - * - */ -public class VnfAdapterRollbackMockTransformer extends ResponseTransformer { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private String notifyCallbackResponse; - private String ackResponse; - private String messageId; - - public VnfAdapterRollbackMockTransformer() { - notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfRollbackSimResponse.xml"); - } - - public VnfAdapterRollbackMockTransformer(String messageId) { - this.messageId = messageId; - } - - @Override - public String name() { - return "vnf-adapter-rollback-transformer"; - } - - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource) { - - String requestBody = request.getBodyAsString(); - - String notficationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); - String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); - String responseMessageId = ""; - String updatedResponse = ""; - - try { - // try supplied response file (if any) - System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); - ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - notifyCallbackResponse = ackResponse; - responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); - updatedResponse = ackResponse.replace(responseMessageId, messageId); - } catch (Exception ex) { - LOGGER.debug("Exception :",ex); - System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'"); - responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); - updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); - } - - System.out.println("response (mock) messageId : " + responseMessageId); - System.out.println("request (replacement) messageId: " + messageId); - - System.out.println("vnf Response (before):" + notifyCallbackResponse); - System.out.println("vnf Response (after):" + updatedResponse); - - Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); - int delay = 300; - if (vnfDelay != null) { - delay = Integer.parseInt(vnfDelay.toString()); - } - - //Kick off callback thread - System.out.println("VnfAdapterRollbackMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); - CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); - callbackResponseThread.start(); - - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") - .build(); - - } - - @Override - public boolean applyGlobally() { - return false; - } - - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - LOGGER.debug("Exception :",e1); - } - System.out.println("Sending callback response to url: " + callbackUrl); - ClientRequest request = new ClientRequest(callbackUrl); - request.body("text/xml", payLoad); - //System.err.println(payLoad); - try { - ClientResponse result = request.post(); - System.out.println("Successfully posted callback? Status: " + result.getStatus()); - //System.err.println("Successfully posted callback:" + result.getStatus()); - } catch (Exception e) { - System.out.println("catch error in - request.post() "); - LOGGER.debug("Exception :",e); - } - } - - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java deleted file mode 100644 index 7808b47d24..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java +++ /dev/null @@ -1,149 +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.bpmn.mock; - -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; -import org.openecomp.mso.logger.MsoLogger; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; - -import org.openecomp.mso.logger.MsoLogger; -/** - * Please describe the VnfAdapterUpdateMockTransformer.java class - * - */ -public class VnfAdapterUpdateMockTransformer extends ResponseTransformer { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private String notifyCallbackResponse; - private String requestId; - private String ackResponse; - - public VnfAdapterUpdateMockTransformer() { - notifyCallbackResponse = FileUtil.readResourceFile("vnfAdapter/vnfUpdateSimResponse.xml"); - } - - public VnfAdapterUpdateMockTransformer(String requestId) { - this.requestId = requestId; - } - - - public String name() { - return "vnf-adapter-update-transformer"; - } - - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource) { - - String requestBody = request.getBodyAsString(); - - String notficationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); - String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); - String responseMessageId = ""; - String updatedResponse = ""; - - try { - // try supplied response file (if any) - System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); - ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - notifyCallbackResponse = ackResponse; - responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); - updatedResponse = ackResponse.replace(responseMessageId, messageId); - } catch (Exception ex) { - LOGGER.debug("Exception :",ex); - System.out.println(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'"); - responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); - updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); - } - - System.out.println("response (mock) messageId : " + responseMessageId); - System.out.println("request (replacement) messageId: " + messageId); - - System.out.println("vnf Response (before):" + notifyCallbackResponse); - System.out.println("vnf Response (after):" + updatedResponse); - - Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); - int delay = 300; - if (vnfDelay != null) { - delay = Integer.parseInt(vnfDelay.toString()); - } - - //Kick off callback thread - System.out.println("VnfAdapterUpdateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); - CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); - callbackResponseThread.start(); - - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") - .build(); - - } - - @Override - public boolean applyGlobally() { - return false; - } - - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - LOGGER.debug("Exception :", e1); - } - System.out.println("Sending callback response to url: " + callbackUrl); - ClientRequest request = new ClientRequest(callbackUrl); - request.body("text/xml", payLoad); - //System.err.println(payLoad); - try { - ClientResponse result = request.post(); - System.out.println("Successfully posted callback? Status: " + result.getStatus()); - //System.err.println("Successfully posted callback:" + result.getStatus()); - } catch (Exception e) { - System.out.println("catch error in - request.post() "); - LOGGER.debug("Exception :",e); - } - } - - } -} - diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/ResponseExceptionMapperImplTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/ResponseExceptionMapperImplTest.java deleted file mode 100644 index 8943014ad0..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/ResponseExceptionMapperImplTest.java +++ /dev/null @@ -1,111 +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.client; - -import static org.assertj.core.api.Assertions.assertThatCode; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import com.google.common.base.Charsets; -import javax.ws.rs.BadRequestException; -import javax.ws.rs.ForbiddenException; -import javax.ws.rs.InternalServerErrorException; -import javax.ws.rs.NotAcceptableException; -import javax.ws.rs.NotAllowedException; -import javax.ws.rs.NotAuthorizedException; -import javax.ws.rs.NotFoundException; -import javax.ws.rs.NotSupportedException; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.client.ClientResponseContext; -import javax.ws.rs.core.Response.Status; -import junitparams.JUnitParamsRunner; -import junitparams.Parameters; -import org.apache.commons.io.IOUtils; -import org.junit.Test; -import org.junit.runner.RunWith; - -@RunWith(JUnitParamsRunner.class) -public class ResponseExceptionMapperImplTest { - - private static final ResponseExceptionMapperImpl mapper = new ResponseExceptionMapperImpl(); - - public static Object[][] statusesAndCorrespondingExceptions() { - return new Object[][]{ - {Status.BAD_REQUEST, BadRequestException.class}, - {Status.UNAUTHORIZED, NotAuthorizedException.class}, - {Status.FORBIDDEN, ForbiddenException.class}, - {Status.NOT_FOUND, NotFoundException.class}, - {Status.METHOD_NOT_ALLOWED, NotAllowedException.class}, - {Status.NOT_ACCEPTABLE, NotAcceptableException.class}, - {Status.PRECONDITION_FAILED, PreconditionFailedException.class}, - {Status.UNSUPPORTED_MEDIA_TYPE, NotSupportedException.class}, - {Status.INTERNAL_SERVER_ERROR, InternalServerErrorException.class}, - {Status.SERVICE_UNAVAILABLE, WebApplicationException.class}, - {Status.BAD_GATEWAY, WebApplicationException.class}, - }; - } - - @Test - @Parameters(method = "statusesAndCorrespondingExceptions") - public void shouldThrowExceptionWhenStatusIsNotOk(Status status, Class expectedException) { - // given - ClientResponseContext responseContext = createMockResponseContext(status); - // when, then - assertThatThrownBy(() -> mapper.filter(null, responseContext)).isInstanceOf(expectedException); - } - - @Test - public void shouldNotThrowExceptionWhenStatusIsOk() { - // given - ClientResponseContext responseContext = createMockResponseContext(Status.OK); - // when, then - assertThatCode(() -> mapper.filter(null, responseContext)).doesNotThrowAnyException(); - } - - @Test - public void shouldThrowExceptionWithCustomMessageWhenResponseHasEntity() { - // given - ClientResponseContext responseContext = createMockResponseContext(Status.BAD_REQUEST); - when(responseContext.hasEntity()).thenReturn(true); - when(responseContext.getEntityStream()).thenReturn(IOUtils.toInputStream("test message", Charsets.UTF_8)); - // when, then - assertThatThrownBy(() -> mapper.filter(null, responseContext)).isInstanceOf(BadRequestException.class) - .hasMessage("test message"); - } - - @Test - public void shouldThrowExceptionWithDefaultMessageWhenResponseHasNoEntity() { - // given - ClientResponseContext responseContext = createMockResponseContext(Status.BAD_REQUEST); - when(responseContext.hasEntity()).thenReturn(false); - // when, then - assertThatThrownBy(() -> mapper.filter(null, responseContext)).isInstanceOf(BadRequestException.class) - .hasMessage("empty message"); - } - - private static ClientResponseContext createMockResponseContext(Status status) { - ClientResponseContext responseContext = mock(ClientResponseContext.class); - when(responseContext.getStatusInfo()).thenReturn(status); - when(responseContext.getStatus()).thenReturn(status.getStatusCode()); - return responseContext; - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientTest.java deleted file mode 100644 index 0584bea012..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientTest.java +++ /dev/null @@ -1,146 +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.client.adapter.network; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; -import static org.junit.Assert.assertEquals; - -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openecomp.mso.adapters.nwrest.CreateNetworkRequest; -import org.openecomp.mso.adapters.nwrest.CreateNetworkResponse; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkRequest; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkResponse; -import org.openecomp.mso.adapters.nwrest.QueryNetworkResponse; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkRequest; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkResponse; -import org.openecomp.mso.adapters.nwrest.UpdateNetworkRequest; -import org.openecomp.mso.adapters.nwrest.UpdateNetworkResponse; -import org.openecomp.mso.openstack.beans.NetworkRollback; - -import com.github.tomakehurst.wiremock.junit.WireMockRule; - -public class NetworkAdapterClientTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(28090)); - - private static final String TESTING_ID = "___TESTING___"; - private static final String AAI_NETWORK_ID = "test"; - private static final String REST_ENDPOINT = "/networks/rest/v1/networks"; - - private NetworkAdapterClientImpl client = new NetworkAdapterClientImpl(); - - @BeforeClass - public static void setUp() { - System.setProperty("mso.config.path", "src/test/resources"); - } - - @Test - public void createNetworkTest() { - CreateNetworkRequest request = new CreateNetworkRequest(); - request.setCloudSiteId(TESTING_ID); - - CreateNetworkResponse mockResponse = new CreateNetworkResponse(); - mockResponse.setNetworkCreated(true); - wireMockRule.stubFor(post(urlPathEqualTo(REST_ENDPOINT)).willReturn(aResponse() - .withHeader("Content-Type", "application/json").withBody(mockResponse.toJsonString()).withStatus(200))); - - CreateNetworkResponse response = client.createNetwork(request); - assertEquals("Testing CreateVfModule response", true, response.getNetworkCreated()); - } - - @Test - public void deleteNetworkTest() { - DeleteNetworkRequest request = new DeleteNetworkRequest(); - request.setCloudSiteId(TESTING_ID); - - DeleteNetworkResponse mockResponse = new DeleteNetworkResponse(); - mockResponse.setNetworkDeleted(true); - - wireMockRule.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).willReturn(aResponse() - .withHeader("Content-Type", "application/json").withBody(mockResponse.toJsonString()).withStatus(200))); - - DeleteNetworkResponse response = client.deleteNetwork(AAI_NETWORK_ID, request); - assertEquals("Testing DeleteVfModule response", true, response.getNetworkDeleted()); - } - - @Test - public void rollbackNetworkTest() { - RollbackNetworkRequest request = new RollbackNetworkRequest(); - NetworkRollback rollback = new NetworkRollback(); - rollback.setCloudId(TESTING_ID); - request.setNetworkRollback(rollback); - - RollbackNetworkResponse mockResponse = new RollbackNetworkResponse(); - mockResponse.setNetworkRolledBack(true); - - wireMockRule.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).willReturn(aResponse() - .withHeader("Content-Type", "application/json").withBody(mockResponse.toJsonString()).withStatus(200))); - - RollbackNetworkResponse response = client.rollbackNetwork(AAI_NETWORK_ID, request); - assertEquals("Testing DeleteVfModule response", true, response.getNetworkRolledBack()); - } - - @Test - public void queryNetworkTest() { - QueryNetworkResponse mockResponse = new QueryNetworkResponse(); - mockResponse.setNetworkExists(true); - - wireMockRule.stubFor(get(urlPathEqualTo(REST_ENDPOINT)) - .withQueryParam("cloudSiteId", equalTo(TESTING_ID)) - .withQueryParam("tenantId", equalTo(TESTING_ID)) - .withQueryParam("networkStackId", equalTo("networkStackId")) - .withQueryParam("skipAAI", equalTo("true")) - .withQueryParam("msoRequest.requestId", equalTo("testRequestId")) - .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId")) - .willReturn(aResponse() - .withHeader("Content-Type", "application/json").withBody(mockResponse.toJsonString()).withStatus(200))); - - QueryNetworkResponse response = client.queryNetwork(AAI_NETWORK_ID, TESTING_ID, TESTING_ID, - "networkStackId", true, "testRequestId", "serviceInstanceId"); - assertEquals("Testing QueryVfModule response", true, response.getNetworkExists()); - } - - @Ignore - @Test - public void updateNetworkTest() { - UpdateNetworkRequest request = new UpdateNetworkRequest(); - request.setCloudSiteId(TESTING_ID); - request.setNetworkId("test1"); - - UpdateNetworkResponse mockResponse = new UpdateNetworkResponse(); - mockResponse.setNetworkId("test1"); - wireMockRule.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).willReturn(aResponse() - .withHeader("Content-Type", "application/json").withBody(mockResponse.toJsonString()).withStatus(200))); - - UpdateNetworkResponse response = client.updateNetwork(AAI_NETWORK_ID, request); - assertEquals("Testing UpdateVfModule response", "test1", response.getNetworkId()); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/RequestsDbAdapterClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/RequestsDbAdapterClientTest.java deleted file mode 100644 index 2c35151895..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/RequestsDbAdapterClientTest.java +++ /dev/null @@ -1,50 +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.client.adapter.requests.db; - -import org.junit.BeforeClass; -import org.junit.Test; - -public class RequestsDbAdapterClientTest { - - @BeforeClass - public static void setUp() { - System.setProperty("mso.config.path", "src/test/resources"); - } - - @Test - public void updateInfraRequestTest() - { - - } - - @Test - public void getInfraRequestTest() - { - - } - - @Test - public void getSiteStatusTest() - { - - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBeanTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBeanTest.java deleted file mode 100644 index f0c6e7ec52..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBeanTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.client.adapter.requests.db.entities; - -import org.junit.Test; - -public class MsoRequestsDbExceptionBeanTest { - - @Test - public void test() { - MsoRequestsDbExceptionBean mrde=new MsoRequestsDbExceptionBean("msg"); - mrde.setMessage("msg"); - assert(mrde.getMessage().equals("msg")); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionTest.java deleted file mode 100644 index 28b8cc991f..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.client.adapter.requests.db.entities; - -import org.junit.Test; - -public class MsoRequestsDbExceptionTest { - - @Test - public void test() { - Throwable e = new Throwable(); - MsoRequestsDbExceptionBean mredb=new MsoRequestsDbExceptionBean(); - MsoRequestsDbException mrde=new MsoRequestsDbException("msg",e); - MsoRequestsDbException mrd=new MsoRequestsDbException("msg"); - MsoRequestsDbException mrd1=new MsoRequestsDbException(e); - mrde.setFaultInfo(mredb); - assert(mrde.getFaultInfo().equals(mredb)); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequestTest.java deleted file mode 100644 index d01c11948b..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequestTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.client.adapter.requests.db.entities; - -import org.junit.Test; - -public class UpdateInfraRequestTest { - - @Test - public void test() { - UpdateInfraRequest uir=new UpdateInfraRequest(); - RequestStatusType requestStatus=RequestStatusType.COMPLETE; - uir.setConfigurationId("configurationId"); - uir.setConfigurationName("configurationName"); - uir.setLastModifiedBy("lastModifiedBy"); - uir.setNetworkId("networkId"); - uir.setProgress("progress"); - uir.setRequestId("requestId"); - uir.setRequestStatus(requestStatus); - uir.setResponseBody("responseBody"); - uir.setServiceInstanceId("serviceInstanceId"); - uir.setServiceInstanceName("serviceInstanceName"); - uir.setStatusMessage("statusMessage"); - uir.setVfModuleId("vfModuleId"); - uir.setVfModuleName("vfModuleName"); - uir.setVnfId("vnfId"); - uir.setVnfOutputs("vnfOutputs"); - uir.setVolumeGroupId("volumeGroupId"); - assert(uir.getConfigurationId().equals("configurationId")); - assert(uir.getConfigurationName().equals("configurationName")); - assert(uir.getLastModifiedBy().equals("lastModifiedBy")); - assert(uir.getNetworkId().equals("networkId")); - assert(uir.getProgress().equals("progress")); - assert(uir.getRequestId().equals("requestId")); - assert(uir.getRequestStatus().equals(requestStatus)); - assert(uir.getResponseBody().equals("responseBody")); - assert(uir.getServiceInstanceId().equals("serviceInstanceId")); - assert(uir.getServiceInstanceName().equals("serviceInstanceName")); - assert(uir.getStatusMessage().equals("statusMessage")); - assert(uir.getVfModuleId().equals("vfModuleId")); - assert(uir.getVnfOutputs().equals("vnfOutputs")); - assert(uir.getVolumeGroupId().equals("volumeGroupId")); - assert(uir.getVfModuleName().equals("vfModuleName")); - assert(uir.getVnfId().equals("vnfId")); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientTest.java deleted file mode 100644 index 21448256ed..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientTest.java +++ /dev/null @@ -1,156 +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.client.adapter.vnf; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; -import static org.junit.Assert.assertEquals; - -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.QueryVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.VfModuleRollback; - -import com.github.tomakehurst.wiremock.junit.WireMockRule; - -public class VnfAdapterClientTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(28090)); - - private static final String TESTING_ID = "___TESTING___"; - private static final String AAI_VNF_ID = "test"; - private static final String AAI_VF_MODULE_ID = "test"; - private static final String REST_ENDPOINT = "/vnfs/rest/v1/vnfs"; - - private VnfAdapterClientImpl client = new VnfAdapterClientImpl(); - - @BeforeClass - public static void setUp() { - System.setProperty("mso.config.path", "src/test/resources"); - } - - @Test - public void createVfModuleTest() { - CreateVfModuleRequest request = new CreateVfModuleRequest(); - request.setCloudSiteId(TESTING_ID); - - CreateVfModuleResponse mockResponse = new CreateVfModuleResponse(); - mockResponse.setVfModuleCreated(true); - wireMockRule.stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(mockResponse.toJsonString()).withStatus(200))); - - CreateVfModuleResponse response = client.createVfModule(AAI_VNF_ID, request); - assertEquals("Testing CreateVfModule response", true, response.getVfModuleCreated()); - } - - @Test - public void rollbackVfModuleTest() { - RollbackVfModuleRequest request = new RollbackVfModuleRequest(); - VfModuleRollback rollback = new VfModuleRollback(); - rollback.setCloudSiteId(TESTING_ID); - request.setVfModuleRollback(rollback); - - RollbackVfModuleResponse mockResponse = new RollbackVfModuleResponse(); - mockResponse.setVfModuleRolledback(true); - wireMockRule.stubFor( - put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(mockResponse.toJsonString()).withStatus(200))); - - RollbackVfModuleResponse response = client.rollbackVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request); - assertEquals("Testing RollbackVfModule response", true, response.getVfModuleRolledback()); - } - - @Test - public void deleteVfModuleTest() { - DeleteVfModuleRequest request = new DeleteVfModuleRequest(); - request.setCloudSiteId(TESTING_ID); - - DeleteVfModuleResponse mockResponse = new DeleteVfModuleResponse(); - mockResponse.setVfModuleDeleted(true); - wireMockRule.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(mockResponse.toJsonString()).withStatus(200))); - - DeleteVfModuleResponse response = client.deleteVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request); - assertEquals("Testing DeleteVfModule response", true, response.getVfModuleDeleted()); - } - - @Test - public void updateVfModuleTest() { - UpdateVfModuleRequest request = new UpdateVfModuleRequest(); - request.setCloudSiteId(TESTING_ID); - request.setVfModuleId("test1"); - - UpdateVfModuleResponse mockResponse = new UpdateVfModuleResponse(); - mockResponse.setVfModuleId("test1"); - wireMockRule.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(mockResponse.toJsonString()).withStatus(200))); - - UpdateVfModuleResponse response = client.updateVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request); - assertEquals("Testing UpdateVfModule response", "test1", response.getVfModuleId()); - } - - @Test - public void queryVfModuleTest() { - QueryVfModuleResponse mockResponse = new QueryVfModuleResponse(); - mockResponse.setVnfId(AAI_VNF_ID); - mockResponse.setVfModuleId(AAI_VF_MODULE_ID); - wireMockRule.stubFor(get(urlPathEqualTo(REST_ENDPOINT)) - .withQueryParam("cloudSiteId", equalTo(TESTING_ID)) - .withQueryParam("tenantId", equalTo(TESTING_ID)) - .withQueryParam("vfModuleName", equalTo("someName")) - .withQueryParam("skipAAI", equalTo("true")) - .withQueryParam("msoRequest.requestId", equalTo("testRequestId")) - .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(mockResponse.toJsonString()).withStatus(200))); - QueryVfModuleResponse response = client.queryVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, TESTING_ID, TESTING_ID, - "someName", true, "testRequestId", "serviceInstanceId"); - assertEquals("Testing QueryVfModule response", AAI_VF_MODULE_ID, response.getVfModuleId()); - } - - @Test - public void healthCheckTest() { - wireMockRule.stubFor(get(urlPathEqualTo("/vnfs/rest/v1/vnfs")).willReturn( - aResponse().withHeader("Content-Type", "text/plain").withBody("healthCheck").withStatus(200))); - - String healthCheck = client.healthCheck(); - assertEquals("HealthCheck is correct", "healthCheck", healthCheck); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java deleted file mode 100644 index 59be8235fe..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java +++ /dev/null @@ -1,113 +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.client.appc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.Properties; -import java.util.UUID; - -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; -import org.onap.appc.client.lcm.model.Action; -import org.onap.appc.client.lcm.model.ActionIdentifiers; -import org.onap.appc.client.lcm.model.CheckLockInput; -import org.onap.appc.client.lcm.model.Status; - -public class ApplicationControllerClientTest { - - @BeforeClass - public static void beforeClass() { - System.setProperty("mso.config.path", "src/test/resources"); - } - - @Test - public void testClientCreation() { - ApplicationControllerClient client = new ApplicationControllerClient("appc"); - assertEquals(client.getControllerType(), "APPC"); - assertNotNull(client.getAppCClient()); - } - - @Test - public void createRequest_CheckLock_RequestBuilt() { - ApplicationControllerClient client = new ApplicationControllerClient("APPC"); - ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); - actionIdentifiers.setVnfId("vnfId"); - CheckLockInput checkLockInput = (CheckLockInput) client.createRequest(Action.CheckLock, actionIdentifiers, null, - "requestId"); - assertEquals(checkLockInput.getAction().name(), "CheckLock"); - } - - @Test - @Ignore // 1802 merge - public void runCommand_liveAppc() { - ApplicationControllerClient client = new ApplicationControllerClient("appc"); - ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); - //actionIdentifiers.setVnfId("ca522254-2ba4-4fbd-b15b-0ef0d9cfda5f"); - actionIdentifiers.setVnfId("2d2bf10e-81a5-"); - Status status; - try { - status = client.runCommand(Action.Lock, actionIdentifiers, null, UUID.randomUUID().toString()); - } catch (ApplicationControllerOrchestratorException e) { - status = new Status(); - status.setCode(e.getAppcCode()); - status.setMessage(e.getMessage()); - } - assertEquals("Status of run command is correct", status.getCode(), 306); - } - - @Test - @Ignore // 1802 merge - public void runCommand_CheckLock_RequestBuilt() { - ApplicationControllerClient client = new ApplicationControllerClient("appc"); - ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); - actionIdentifiers.setVnfId("fusion-vpp-vnf-001"); - Status status; - try { - status = client.runCommand(Action.Unlock, actionIdentifiers, null, "requestId"); - } catch (ApplicationControllerOrchestratorException e) { - status = new Status(); - status.setCode(e.getAppcCode()); - status.setMessage(e.getMessage()); - } - assertEquals("Status of run command is correct", status.getCode(), 309); - } - - @Test - public void test_getLCMPropertiesHelper() { - ApplicationControllerClient client = new ApplicationControllerClient(); - Properties properties = client.getLCMProperties(); - assertEquals(properties.get("topic.read"), "APPC-TEST-AMDOCS2"); - assertEquals(properties.get("topic.write"), "APPC-TEST-AMDOCS1-DEV3"); - assertEquals(properties.get("SDNC-topic.read"), "SDNC-LCM-READ"); - assertEquals(properties.get("SDNC-topic.write"), "SDNC-LCM-WRITE"); - assertEquals(properties.get("topic.read.timeout"), "120000"); - assertEquals(properties.get("client.response.timeout"), "120000"); - assertEquals(properties.get("poolMembers"), - "uebsb93kcdc.it.att.com:3904,uebsb92kcdc.it.att.com:3904,uebsb91kcdc.it.att.com:3904"); - assertEquals(properties.get("client.key"), "iaEMAfjsVsZnraBP"); - assertEquals(properties.get("client.secret"), "wcivUjsjXzmGFBfxMmyJu9dz"); - assertEquals(properties.get("controllerType"), "appc"); - } - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorTest.java deleted file mode 100644 index d9c5654989..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorTest.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.client.appc; - -import static org.junit.Assert.assertEquals; - -import java.util.Optional; -import java.util.UUID; - -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; - -import org.onap.appc.client.lcm.model.Action; -import org.onap.appc.client.lcm.model.Status; - -public class ApplicationControllerOrchestratorTest { - - @BeforeClass - public static void beforeClass() { - System.setProperty("mso.config.path", "src/test/resources"); - } - - @Test - @Ignore - public void vnfCommandTest() { - ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator(); - Status status; - try { - status = client.vnfCommand(Action.Lock, UUID.randomUUID().toString(), - "3ffdee3c-94d2-45fe-904d-fc1efa0f8b59", Optional.of(""), "appc"); - } catch (ApplicationControllerOrchestratorException e) { - status = new Status(); - status.setCode(e.getAppcCode()); - status.setMessage(e.getMessage()); - } - assertEquals("Status of vnfCommand is correct", status.getCode(), 306); - } - - @Test - @Ignore - public void vnfCommandTest1() { - ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator(); - Status status; - try { - status = client.vnfCommand(Action.Unlock, UUID.randomUUID().toString(), - "ca522254-2ba4-4fbd-b15b-0ef0d9cfda5f", Optional.of(""), "appc"); - } catch (ApplicationControllerOrchestratorException e) { - status = new Status(); - status.setCode(e.getAppcCode()); - status.setMessage(e.getMessage()); - } - assertEquals("Status of vnfCommand is correct", status.getCode(), 306); - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerSupportTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerSupportTest.java deleted file mode 100644 index d2d4f5002a..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerSupportTest.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.client.appc; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.appc.client.lcm.model.Status; -import org.openecomp.mso.client.appc.ApplicationControllerSupport.StatusCategory; - -import junitparams.JUnitParamsRunner; -import junitparams.Parameters; - -@RunWith(JUnitParamsRunner.class) -public class ApplicationControllerSupportTest { - - public static Object[][] statusesAndCategories() { - return new Object[][]{ - {100, StatusCategory.NORMAL}, - {200, StatusCategory.ERROR}, - {300, StatusCategory.ERROR}, - {400, StatusCategory.NORMAL}, - {401, StatusCategory.ERROR}, - {500, StatusCategory.NORMAL}, - {501, StatusCategory.ERROR}, - {502, StatusCategory.WARNING}, - {800, StatusCategory.WARNING}, - }; - } - - public static Object[][] statusesAndFinalities() { - return new Object[][]{ - {100, false}, - {200, true}, - {300, true}, - {400, true}, - {500, false}, - {800, true}, - }; - } - - @Test - @Parameters(method = "statusesAndCategories") - public void shouldReturnCategoryForCode(int code, StatusCategory category) throws Exception { - // when - StatusCategory detectedCategory = ApplicationControllerSupport.getCategoryOf(createStatus(code)); - // then - assertThat(detectedCategory).isEqualTo(category); - } - - @Test - @Parameters(method = "statusesAndFinalities") - public void shouldReturnFinalityForCode(int code, boolean expectedFinality) throws Exception { - // when - boolean finality = ApplicationControllerSupport.getFinalityOf(createStatus(code)); - // then - assertThat(finality).isEqualTo(expectedFinality); - } - - private Status createStatus(int code) { - Status status = new Status(); - status.setCode(code); - return status; - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/policy/CommonObjectMapperProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/policy/CommonObjectMapperProviderTest.java deleted file mode 100644 index e1b1770180..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/policy/CommonObjectMapperProviderTest.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.client.policy; - -import static org.assertj.core.api.Assertions.assertThat; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import org.junit.Test; - -public class CommonObjectMapperProviderTest { - - @Test - public void shouldSetCorrectMapperProperties() throws Exception { - // given - CommonObjectMapperProvider provider = new CommonObjectMapperProvider(); - // when - ObjectMapper context = provider.getContext(Object.class); - // then - assertThat(context.isEnabled(MapperFeature.USE_ANNOTATIONS)).isTrue(); - assertThat(context.isEnabled(SerializationFeature.WRAP_ROOT_VALUE)).isFalse(); - assertThat(context.isEnabled(DeserializationFeature.UNWRAP_ROOT_VALUE)).isFalse(); - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/beans/SDNCRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/beans/SDNCRequestTest.java deleted file mode 100644 index 3fd433d017..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/beans/SDNCRequestTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.client.sdnc.beans; - -import static org.junit.Assert.*; - - - -import org.junit.Test; -public class SDNCRequestTest { - private SDNCRequest sdncrequest = new SDNCRequest(); - SDNCSvcAction svcaction = SDNCSvcAction.ACTIVATE; - SDNCSvcOperation svcoperation = SDNCSvcOperation.VNF_TOPOLOGY_OPERATION; - @Test - public void testSDNCRequestTest() { - sdncrequest.setRequestId("requestId"); - sdncrequest.setSvcInstanceId("svcInstanceId"); - sdncrequest.setSvcAction(svcaction); - sdncrequest.setSvcOperation(svcoperation); - sdncrequest.setCallbackUrl("callbackUrl"); - sdncrequest.setMsoAction("msoAction"); - sdncrequest.setRequestData("requestData"); - assertEquals(sdncrequest.getRequestId(), "requestId"); - assertEquals(sdncrequest.getSvcInstanceId(), "svcInstanceId"); - assertEquals(sdncrequest.getSvcAction(), svcaction); - assertEquals(sdncrequest.getSvcOperation(), svcoperation); - assertEquals(sdncrequest.getCallbackUrl(), "callbackUrl"); - assertEquals(sdncrequest.getMsoAction(), "msoAction"); - assertEquals(sdncrequest.getRequestData(), "requestData"); - } - @Test - public void testToString(){ - assert(sdncrequest.toString()!=null); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.java deleted file mode 100644 index 995bb5b19c..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.client.sdnc.sync; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class CallbackHeaderTest { - - CallbackHeader cbh = new CallbackHeader(); - CallbackHeader cbh1 = new CallbackHeader("reqId", "respCode", "respMsg"); - - @Test - public void testCallbackHeader() { - cbh.setRequestId("requestId"); - cbh.setResponseCode("responseCode"); - cbh.setResponseMessage("responseMessage"); - assertEquals(cbh.getRequestId(), "requestId"); - assertEquals(cbh.getResponseCode(), "responseCode"); - assertEquals(cbh.getResponseMessage(), "responseMessage"); - assert(cbh.toString()!=null); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java deleted file mode 100644 index 04bc7dc132..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.client.sdnc.sync; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class ObjectFactoryTest { - ObjectFactory of = new ObjectFactory(); - - @Test - public void testObjectFactory() { - of.createRequestHeader(); - of.createSDNCAdapterRequest(); - of.createSDNCAdapterResponse(); - - - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java deleted file mode 100644 index 1d04572207..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.client.sdnc.sync; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class RequestHeaderTest { - RequestHeader rh = new RequestHeader(); - - @Test - public void testRequestHeader() { - rh.setRequestId("requestId"); - rh.setSvcInstanceId("svcInstanceId"); - rh.setSvcAction("svcAction"); - rh.setSvcOperation("svcOperation"); - rh.setCallbackUrl("callbackUrl"); - rh.setMsoAction("msoAction"); - assertEquals(rh.getRequestId(), "requestId"); - assertEquals(rh.getSvcInstanceId(), "svcInstanceId"); - assertEquals(rh.getSvcAction(), "svcAction"); - assertEquals(rh.getSvcOperation(), "svcOperation"); - assertEquals(rh.getCallbackUrl(), "callbackUrl"); - assertEquals(rh.getMsoAction(), "msoAction"); - assert(rh.toString()!=null); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.java deleted file mode 100644 index 1219f69874..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.client.sdnc.sync; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -public class RequestTunablesTest { - MsoPropertiesFactory mpf = new MsoPropertiesFactory(); - - RequestTunables rt = new RequestTunables("reqId", "msoAction", "operation", "action", mpf); - - @Test - public void testRequestTunables() { - rt.setReqId("reqId"); - rt.setReqMethod("reqMethod"); - rt.setMsoAction("msoAction"); - rt.setAction("action"); - rt.setOperation("operation"); - rt.setSdncUrl("sdncUrl"); - rt.setTimeout("timeout"); - rt.setAsyncInd("asyncInd"); - rt.setHeaderName("headerName"); - rt.setSdncaNotificationUrl("sdncaNotificationUrl"); - rt.setNamespace("namespace"); - assertEquals(rt.getReqId(), "reqId"); - assertEquals(rt.getReqMethod(), "reqMethod"); - assertEquals(rt.getMsoAction(), "msoAction"); - assertEquals(rt.getAction(), "action"); - assertEquals(rt.getOperation(), "operation"); - assertEquals(rt.getSdncUrl(), "sdncUrl"); - assertEquals(rt.getTimeout(), "timeout"); - assertEquals(rt.getAsyncInd(), "asyncInd"); - assertEquals(rt.getHeaderName(), "headerName"); - assertEquals(rt.getSdncaNotificationUrl(), "sdncaNotificationUrl"); - assertEquals(rt.getNamespace(), "namespace"); - assert(rt.toString()!=null); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java deleted file mode 100644 index 53fbb0a4aa..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.client.sdnc.sync; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class SDNCAdapterCallbackRequestTest { - - SDNCAdapterCallbackRequest sdnccall = new SDNCAdapterCallbackRequest(); - CallbackHeader cbh = new CallbackHeader(); - Object o = new Object(); - - @Test - public void testSDNCAdapterCallbackRequest() { - sdnccall.setCallbackHeader(cbh); - sdnccall.setRequestData(o); - assertEquals(sdnccall.getCallbackHeader(), cbh); - assertEquals(sdnccall.getRequestData(), o); - assert(sdnccall.toString()!=null); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java deleted file mode 100644 index 6b10f25e70..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.client.sdnc.sync; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class SDNCAdapterRequestTest { - - SDNCAdapterRequest adapter = new SDNCAdapterRequest(); - RequestHeader rh = new RequestHeader(); - Object o = new Object(); - - @Test - public void testSDNCAdapterRequest() { - adapter.setRequestHeader(rh); - adapter.setRequestData(o); - assertEquals(adapter.getRequestHeader(), rh); - assertEquals(adapter.getRequestData(), o); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java deleted file mode 100644 index d8c23249c4..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.client.sdnc.sync; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class SDNCResponseTest { - - SDNCResponse sdnc = new SDNCResponse("reqId"); - SDNCResponse sdnc1 = new SDNCResponse("reqId", 0, "respMsg"); - - @Test - public void testSDNCResponse() { - sdnc.setReqId("reqId"); - sdnc.setRespCode(0); - sdnc.setRespMsg("respMsg"); - sdnc.setSdncResp("sdncResp"); - assertEquals(sdnc.getReqId(), "reqId"); - assertEquals(sdnc.getRespCode(), 0); - assertEquals(sdnc.getRespMsg(), "respMsg"); - assertEquals(sdnc.getSdncResp(), "sdncResp"); - assert(sdnc.toString()!= null); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sndc/SDNCOrchTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sndc/SDNCOrchTest.java deleted file mode 100644 index 724ae4a90d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sndc/SDNCOrchTest.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.client.sndc; - -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.core.domain.Customer; -import org.openecomp.mso.bpmn.core.domain.ModelInfo; -import org.openecomp.mso.bpmn.core.domain.Request; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.bpmn.core.domain.ServiceInstance; -import org.openecomp.mso.bpmn.core.json.JsonDecomposingException; -import org.openecomp.mso.client.orchestration.SDNCOrchestrator; -import org.openecomp.mso.client.sdnc.sync.SDNCSyncRpcClient; - -public class SDNCOrchTest { - - @BeforeClass - public static void setup() { - System.setProperty("mso.config.path", "src/test/resources/"); - } - - @Ignore // 1802 merge - @Test - public void run () throws JsonDecomposingException { - ServiceDecomposition serviceDecomp = new ServiceDecomposition ("{\"serviceResources\":{}}","123"); - - ServiceInstance servInst = new ServiceInstance(); - servInst.setInstanceId("RaaTest-1-id"); - servInst.setServiceType(""); - servInst.setInstanceName("some-junk-name"); - servInst.setServiceId("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - - ModelInfo model = new ModelInfo(); - model.setModelInvariantUuid("uuid-miu-svc-011-abcdef"); - model.setModelName("SIModelName1"); - model.setModelUuid(""); - model.setModelVersion("2"); - - Request req = new Request(); - req.setRequestId("RaaCSIRequestId-1"); - req.setSdncRequestId("c0c5e8bf-d5c4-4d81-b2a9-78832c2c789e"); - req.setModelInfo(model); - - Customer cust = new Customer(); - cust.setGlobalSubscriberId("MCBH-1610"); - cust.setSubscriptionServiceType("viprsvc"); - - serviceDecomp.setCustomer(cust); - serviceDecomp.setRequest(req); - serviceDecomp.setCallbackURN("http://localhost:28080/mso/SDNCAdapterCallbackService"); - serviceDecomp.setServiceInstance(servInst); - - SDNCOrchestrator sdncO = new SDNCOrchestrator(); - sdncO.createServiceInstance(serviceDecomp); - } - - @Test - public void runValidateSdncResponse () { - SDNCSyncRpcClient client = new SDNCSyncRpcClient(null, null); - client.validateSDNCResponse("{\"v1:RequestData\": {\"output\": {\"svc-request-id\": \"0ca5bf8f-c944-4318-810b-6ddfbec13cc5\",\"response-code\": \"200\",\"response-message\": \"a\"}}}"); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySim500Response.xml b/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySim500Response.xml index 2cf94b2ef2..c9ec2f0a9d 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySim500Response.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySim500Response.xml @@ -1,10 +1,10 @@ + xmlns:v1="http://org.onap/workflow/sdnc/adapter/schema/v1"> - + testRequestId 200 diff --git a/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse_noExtraTag.xml b/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse_noExtraTag.xml index 57dc2d6f30..d39df7934a 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse_noExtraTag.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse_noExtraTag.xml @@ -1,9 +1,9 @@ + xmlns:v1="http://org.onap/workflow/sdnc/adapter/schema/v1"> - + testRequestId 200 diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json new file mode 100644 index 0000000000..4c4c9b3f00 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json @@ -0,0 +1,6 @@ +{ + "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, + "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, + "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testAllottedModelName1","modelVersionId":"testAllottedModelUuid1","modelVersion":"testAllottedModelVersion1","modelInvariantId":"testAllottedModelInvariantUuid1"},"resourceModuleName":"testAllottedInstanceName1","serviceResourceId":"testAllottedResourceId1"},{"resourceModelInfo":{"modelName":"testAllottedModelName2","modelVersionId":"testAllottedModelUuid2","modelVersion":"testAllottedModelVersion2","modelInvariantId":"testAllottedModelInvariantUuid2"},"resourceModuleName":"testAllottedInstanceName2","serviceResourceId":"testAllottedResourceId2"},{"resourceModelInfo":{"modelName":"testAllottedModelName3","modelVersionId":"testAllottedModelUuid3","modelVersion":"testAllottedModelVersion3","modelInvariantId":"testAllottedModelInvariantUuid3"},"resourceModuleName":"testAllottedInstanceName3","serviceResourceId":"testAllottedResourceId3"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, + "licenseInfo" : [] +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/catalogResp.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/catalogResp.json deleted file mode 100644 index 09026d1d8c..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/catalogResp.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "serviceResources": { - "serviceType": null, - "serviceAllottedResources": [], - "modelInfo": { - "modelInvariantUuid": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", - "modelName": "ADIOD vRouter vCE 011017 Service", - "modelVersion": "5.0", - "modelUuid": "2f7f309d-c842-4644-a2e4-34167be5eeb4" - }, - "serviceRole": null, - "serviceVnfs": [ - { - "toscaNodeType": "org.openecomp.resource.vf.AdiodVce", - "vfModules": [ - { - "initialCount": null, - "vfModuleLabel": null, - "modelInfo": { - "modelInvariantUuid": "7fb428e1-8000-4800-a71a-f21b946973c5", - "modelName": "AdiodVce..base_vCE..module-0", - "modelVersion": "2", - "modelCustomizationUuid": "1126e7e2-b377-4fd2-ad48-660a20caa829", - "modelUuid": "435d57e1-93a2-4d58-aa5d-f2df2d126276" - }, - "hasVolumeGroup": true, - "isBase": true - } - ], - "modelInfo": { - "modelInvariantUuid": "fc72435b-4366-4257-a2f7-c70a3a998a7b", - "modelName": "ADIoD vCE", - "modelVersion": "2.0", - "modelCustomizationUuid": "bdaeed40-c964-4966-bdb8-51320dcaf587", - "modelInstanceName": "ADIoD vCE 0", - "modelUuid": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1" - }, - "nfRole": "", - "nfType": "", - "nfFunction": "", - "nfNamingCode": "", - "multiStageDesign": "N" - } - ], - "serviceNetworks": [] - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf deleted file mode 100644 index 53cd70c514..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf +++ /dev/null @@ -1,113 +0,0 @@ -{ - "transactionId": "testRequestId", - "requestId": "testRequestId", - "requestState": "complete", - "statusMessage": "success", - "solutions": { - "licenseSolutions": [ - { - "entitlementPoolUUID": [ - "f1d563e8-e714-4393-8f99-cc480144a05e", - "j1d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupUUID": [ - "s1d563e8-e714-4393-8f99-cc480144a05e", - "b1d563e8-e714-4393-8f99-cc480144a05e" - ], - "resourceModuleName": "vHNPortalaaS_primary_1", - "serviceResourceId": "testResourceIdAR" - }, - { - "entitlementPoolUUID": [ - "91d563e8-e714-4393-8f99-cc480144a05e", - "21d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupUUID": [ - "31d563e8-e714-4393-8f99-cc480144a05e", - "71d563e8-e714-4393-8f99-cc480144a05e" - ], - "resourceModuleName": "vHNPortalaaS_secondary_1", - "serviceResourceId": "testResourceIdVNF" - } - ], - "placementSolutions": [ - [ - { - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceInstanceId": "testSIID1", - "serviceResourceId": "testResourceIdAR", - "solution": { - "identifierType": "serviceInstanceId", - "identifiers": ["testSIID1"] - }, - "assignmentInfo": [ - { - "key": "cloudOwner", - "value": "aic" - }, - { - "key": "vnfHostName", - "value": "MDTNJ01" - }, - { - "key": "isRehome", - "value": "False" - }, - { - "key": "locationId", - "value": "dfwtx" - } - ] - }, - { "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceResourceId": "testResourceIdAR2", - "solution": { - "identifierType": "serviceInstanceId", - "identifiers": ["testSIID2"] - }, - "assignmentInfo": [ - { - "key": "cloudOwner", - "value": "aic" - }, - { - "key": "vnfHostName", - "value": "testVnfHostname2" - }, - { - "key": "isRehome", - "value": "False" - }, - { - "key": "locationId", - "value": "testCloudRegionId2" - } - ] - }, - { - "resourceModuleName": "VNF", - "serviceResourceId": "testResourceIdVNF", - "solution": { - "identifierType": "cloudRegionId", - "cloudOwner": "aic", - "identifiers": [ - "testCloudRegionId3" - ] - }, - "assignmentInfo": [ - { - "key": "cloudOwner", - "value": "aic" - }, - { - "key": "locationId", - "value": "testCloudRegionId3" - }, - { "key":"flavors", - "value":{"flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}} - ] - } - ] - ] - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net deleted file mode 100644 index d95587746b..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net +++ /dev/null @@ -1,119 +0,0 @@ -{ - "transactionId": "testRequestId", - "requestId": "testRequestId", - "requestState": "completed", - "statusMessage": "success", - "solutions": { - "licenseSolutions": [ - { - "resourceModuleName": "vHNPortalaaS_primary_1", - "serviceResourceId": "testResourceIdAR", - "entitlementPoolUUID": ["f1d563e8-e714-4393-8f99-cc480144a05e", - "j1d563e8-e714-4393-8f99-cc480144a05e"], - "licenseKeyGroupUUID": ["s1d563e8-e714-4393-8f99-cc480144a05e", - "b1d563e8-e714-4393-8f99-cc480144a05e"], - "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", - "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], - "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", - "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] - }, - { - "resourceModuleName": "net", - "serviceResourceId": "testResourceIdNet2", - "entitlementPoolUUID": ["f1d563e8-e714-4393-8f99-cc480144a05n", - "j1d563e8-e714-4393-8f99-cc480144a05n"], - "licenseKeyGroupUUID": ["s1d563e8-e714-4393-8f99-cc480144a05n", - "b1d563e8-e714-4393-8f99-cc480144a05n"], - "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", - "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], - "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", - "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] - }, - { - "resourceModuleName": "vHNPortalaaS_secondary_1", - "serviceResourceId": "testResourceIdVNF", - "entitlementPoolUUID": ["91d563e8-e714-4393-8f99-cc480144a05e", - "21d563e8-e714-4393-8f99-cc480144a05e"], - "licenseKeyGroupUUID": [ "31d563e8-e714-4393-8f99-cc480144a05e", - "71d563e8-e714-4393-8f99-cc480144a05e"], - "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", - "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], - "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", - "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] - }, - ], - "placementSolutions": [ - [ - { - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceResourceId": "testResourceIdAR", - "solution": { - "identifierType": "serviceInstanceId", - "identifiers": ["testSIID1"] - }, - "assignmentInfo": [ - { "key": "cloudOwner", "value": "aic" }, - { "key": "vnfHostName", "value": "MDTNJ01" }, - { "key": "isRehome", "value": "False" }, - { "key": "locationId", "value": "dfwtx" } - ] - }, - { - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceResourceId": "testResourceIdAR2", - "solution": { - "identifierType": "serviceInstanceId", - "identifiers": ["testSIID2"] - }, - "assignmentInfo": [ - { "key": "cloudOwner", "value": "aic" }, - { "key": "vnfHostName", "value": "testVnfHostname2" }, - { "key": "isRehome", "value": "False" }, - { "key": "locationId", "value": "testCloudRegionId2" } - ] - }, - { - "resourceModuleName": "NETWORK", - "serviceResourceId": "testResourceIdNet", - "solution": { - "identifierType": "serviceInstanceId", - "identifiers": ["testServiceInstanceIdNet"] - }, - "assignmentInfo": [ - { "key": "cloudOwner", "value": "aic" }, - { "key": "vnfHostName", "value": "testVnfHostNameNet" }, - { "key": "isRehome", "value": "False" }, - { "key": "locationId", "value": "testCloudRegionIdNet" } - ] - }, - { - "resourceModuleName": "NETWORK", - "serviceResourceId": "testResourceIdNet2", - "solution": { - "identifierType": "cloudRegionId", - "cloudOwner": "aic", - "identifiers": ["testCloudRegionIdNet2"] - }, - "assignmentInfo": [ - { "key": "cloudOwner", "value": "aic" }, - { "key": "locationId", "value": "testCloudRegionIdNet2" } - ] - }, - { - "resourceModuleName": "VNF", - "serviceResourceId": "testResourceIdVNF", - "solution": { - "identifierType": "cloudRegionId", - "cloudOwner": "aic", - "identifiers": ["testCloudRegionId3"] - }, - "assignmentInfo": [ - { "key": "cloudOwner", "value": "aic" }, - { "key": "locationId", "value": "testCloudRegionId3" }, - { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}} - ] - } - ] - ] - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf deleted file mode 100644 index 15e601bae8..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf +++ /dev/null @@ -1,50 +0,0 @@ -{ - "transactionId": "xxx-xxx-xxxx", - "requestId": "yyy-yyy-yyyy", - "requestStatus": "completed", - "statusMessage": "success", - "solutions": { - "placementSolutions": [ - [ - { - "resourceModuleName": "vGMuxInfra", - "serviceResourceId": "some_resource_id", - "solution": { - "identifierType": "serviceInstanceId", - "identifiers": ["gjhd-098-fhd-987"] - }, - "assignmentInfo": [ - { "key": "cloudOwner", "value": "amazon" }, - { "key": "vnfHostName", "value": "ahr344gh" }, - { "key": "isRehome", "value": "False" }, - { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" } - ] - }, - { - "resourceModuleName": "vG", - "serviceResourceId": "some_resource_id", - "solution": { - "identifierType": "cloudRegionId", - "cloudOwner": "amazon", - "identifiers": ["gjhd-098-fhd-987"] - }, - "assignmentInfo": [ - { "key": "cloudOwner", "value": "amazon" }, - { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" }, - { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}} - ] - } - ] - ], - "licenseSolutions": [ - { - "resourceModuleName": "vGMuxInfra", - "serviceResourceId": "some_resource_id", - "entitlementPoolUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], - "licenseKeyGroupUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], - "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], - "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] - } - ] - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound deleted file mode 100644 index 2024df401b..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound +++ /dev/null @@ -1,18 +0,0 @@ -{ - "plans":[ - { - "name":"356fdb73-cef2-4dda-8865-31fd6733d6e4", - "message":"Unable to find any candidate for demand vGW", - "links":[ - [ - { - "rel":"self", - "href":"http://172.17.0.6:8091/v1/plans/1c15e194-6df5-43fe-a5ff-42e6093b8ddd" - } - ] - ], - "id":"1c15e194-6df5-43fe-a5ff-42e6093b8ddd", - "status":"error" - } - ] -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException deleted file mode 100644 index b82688428e..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException +++ /dev/null @@ -1,9 +0,0 @@ -{ - "requestError": { - "policyException": { - "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", - "text": "Message content size exceeds the allowable limit", - "messageId": "SVC0001" - } - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException deleted file mode 100644 index de43e82c9e..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException +++ /dev/null @@ -1,12 +0,0 @@ -{ - "requestError": { - "serviceException": { - "variables": [ - "severity", 400 - ], - "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", - "text": "OOF PlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8", - "messageId": "SVC0001" - } - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json deleted file mode 100644 index 889431663d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "serviceResources": { - "serviceType": null, - "serviceAllottedResources": [], - "modelInfo": { - "modelInvariantUuid": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", - "modelName": "ADIOD vRouter vCE 011017 Service", - "modelVersion": "5.0", - "modelUuid": "2f7f309d-c842-4644-a2e4-34167be5eeb4" - }, - "serviceRole": null, - "serviceVnfs": [ - { - "toscaNodeType": "org.openecomp.resource.vf.AdiodVce", - "vfModules": [ - { - "initialCount": null, - "vfModuleLabel": null, - "modelInfo": { - "modelInvariantUuid": "7fb428e1-8000-4800-a71a-f21b946973c5", - "modelName": "AdiodVce..base_vCE..module-0", - "modelVersion": "2", - "modelCustomizationUuid": "1126e7e2-b377-4fd2-ad48-660a20caa829", - "modelUuid": "435d57e1-93a2-4d58-aa5d-f2df2d126276" - }, - "hasVolumeGroup": true, - "isBase": true - } - ], - "modelInfo": { - "modelInvariantUuid": "fc72435b-4366-4257-a2f7-c70a3a998a7b", - "modelName": "ADIoD vCE", - "modelVersion": "2.0", - "modelCustomizationUuid": "bdaeed40-c964-4966-bdb8-51320dcaf587", - "modelInstanceName": "ADIoD vCE 0", - "modelUuid": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1" - }, - "nfRole": "", - "nfType": "", - "nfFunction": "ADIoDvCE", - "nfNamingCode": "", - "multiStageDesign": "N" - } - ], - "serviceNetworks": [] - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest deleted file mode 100644 index 42b2a0f24a..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest +++ /dev/null @@ -1,99 +0,0 @@ -{ - "requestInfo": { - "transactionId": "testRequestId-xxx-xxx", - "requestId": "testRequestId-yyy-yyy", - "callbackUrl": "http://localhost:28090/workflows/messages/message/oofResponse/testRequestId", - "sourceId": "so", - "requestType": "create", - "numSolutions": 1, - "optimizers": ["placement"], - "timeout": 600 - }, - "placementInfo": { - "requestParameters": { "customerLatitude": 32.89748, "customerLongitude": -97.040443, "customerName": "xyz" }, - "placementDemands": [ - { - "resourceModuleName": "vGMuxInfra", - "serviceResourceId": "vGMuxInfra-xx", - "tenantId": "vGMuxInfra-tenant", - "resourceModelInfo": { - "modelInvariantId": "vGMuxInfra-modelInvariantId", - "modelVersionId": "vGMuxInfra-versionId", - "modelName": "vGMuxInfra-model", - "modelType": "resource", - "modelVersion": "1.0", - "modelCustomizationName": "vGMuxInfra-customeModelName" - } - }, - { - "resourceModuleName": "vG", - "serviceResourceId": "71d563e8-e714-4393-8f99-cc480144a05e", - "tenantId": "vG-tenant", - "resourceModelInfo": { - "modelInvariantId": "vG-modelInvariantId", - "modelVersionId": "vG-versionId", - "modelName": "vG-model", - "modelType": "resource", - "modelVersion": "1.0", - "modelCustomizationName": "vG-customeModelName" - }, - "existingCandidates": [ - { - "identifierType": "service_instance_id", - "cloudOwner": "", - "identifiers": ["gjhd-098-fhd-987"] - } - ], - "excludedCandidates": [ - { - "identifierType": "service_instance_id", - "cloudOwner": "", - "identifiers": ["gjhd-098-fhd-987"] - }, - { - "identifierType": "vimId", - "cloudOwner": "vmware", - "identifiers": ["NYMDT67"] - } - ], - "requiredCandidates": [ - { - "identifierType": "vimId", - "cloudOwner": "amazon", - "identifiers": ["TXAUS219"] - } - ] - } - ] - }, - "serviceInfo": { - "serviceInstanceId": "d61b2543-5914-4b8f-8e81-81e38575b8ec", - "serviceName": "vCPE", - "modelInfo": { - "modelInvariantId": "vCPE-invariantId", - "modelVersionId": "vCPE-versionId", - "modelName": "vCPE-model", - "modelType": "service", - "modelVersion": "1.0", - "modelCustomizationName": "" - } - }, - "licenseDemands": [ - { - "resourceModuleName": "vGMuxInfra", - "serviceResourceId": "vGMuxInfra-xx", - "resourceModelInfo": { - "modelInvariantId": "vGMuxInfra-modelInvariantId", - "modelVersionId": "vGMuxInfra-versionId", - "modelName": "vGMuxInfra-model", - "modelType": "resource", - "modelVersion": "1.0", - "modelCustomizationName": "" - }, - "existingLicenses": { - "entitlementPoolUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"], - "licenseKeyGroupUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"] - } - } - ] -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf deleted file mode 100644 index 67c9fbedc9..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf +++ /dev/null @@ -1,56 +0,0 @@ -{ - "requestInfo": { - "transactionId": "testRequestId", - "requestId": "testRequestId", - "callbackUrl": "http://localhost:28090/workflows/messages/message/oofResponse/testRequestId", - "sourceId": "so", - "requestType": "create", - "numSolutions": 1, - "optimizers": ["placement"], - "timeout": 600 }, - "placementInfo": { - "requestParameters": { - "customerLatitude": "32.89748", - "customerLongitude": "-97.040443", - "customerName": "xyz" }, - "subscriberInfo": { "globalSubscriberId": "SUB12_0322_DS_1201", - "subscriberName": "SUB_12_0322_DS_1201", - "subscriberCommonSiteId": "" }, - "placementDemands": [ - {"resourceModuleName": "VNF","serviceResourceId": "test-resource-id-000","tenantId": "null","resourceModelInfo": { - "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", - "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", - "modelName": "ADIoD vCE", - "modelType": "", - "modelVersion": "2.0", - "modelCustomizationName": "" }} - ] - }, - "serviceInfo": { - "serviceInstanceId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "serviceName": "null", - "modelInfo": { - "modelType": "", - "modelInvariantId": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", - "modelVersionId": "2f7f309d-c842-4644-a2e4-34167be5eeb4", - "modelName": "ADIOD vRouter vCE 011017 Service", - "modelVersion": "5.0", - "modelCustomizationName": "" - } - }, - "licenseInfo": { - "licenseDemands": [ - { -"resourceModuleName": "VNF", -"serviceResourceId": "test-resource-id-000", -"resourceInstanceType": "VNF", -"resourceModelInfo": { - "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", - "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", - "modelName": "ADIoD vCE", - "modelType": "", - "modelVersion": "2.0", - "modelCustomizationName": "" - } - }] - }} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf deleted file mode 100644 index 372f5d9e4d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf +++ /dev/null @@ -1,110 +0,0 @@ -{ - "transactionId": "testRequestId", - "requestId": "testRequestId", - "requestState": "complete", - "statusMessage": "", - "solutionInfo": { - "licenseInfo": [ - { - "entitlementPoolList": [ - "f1d563e8-e714-4393-8f99-cc480144a05e", - "j1d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupList": [ - "s1d563e8-e714-4393-8f99-cc480144a05e", - "b1d563e8-e714-4393-8f99-cc480144a05e" - ], - "resourceModuleName": "vHNPortalaaS_primary_1", - "serviceResourceId": "testResourceIdAR" - }, - { - "entitlementPoolList": [ - "91d563e8-e714-4393-8f99-cc480144a05e", - "21d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupList": [ - "31d563e8-e714-4393-8f99-cc480144a05e", - "71d563e8-e714-4393-8f99-cc480144a05e" - ], - "resourceModuleName": "vHNPortalaaS_secondary_1", - "serviceResourceId": "testResourceIdVNF" - } - ], - "placementInfo": [ - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "MDTNJ01" - }, - { - "variableName": "aicClli", - "variableValue": "KDTNJ01" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "dfwtx", - "inventoryType": "service", - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceInstanceId": "testSIID1", - "serviceResourceId": "testResourceIdAR", - "isRehome": "False" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "testVnfHostname2" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClli2" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionId2", - "inventoryType": "service", - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceInstanceId": "testSIID2", - "serviceResourceId": "testResourceIdAR2", - "isRehome": "False" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClli3" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionId3", - "inventoryType": "cloud", - "resourceModuleName": "VNF", - "serviceInstanceId": "", - "serviceResourceId": "testResourceIdVNF", - "isRehome": "False" - } - ] - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net deleted file mode 100644 index 694419700d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net +++ /dev/null @@ -1,170 +0,0 @@ -{ - "transactionId": "testRequestId", - "requestId": "testRequestId", - "requestState": "complete", - "statusMessage": "", - "solutionInfo": { - "licenseInfo": [ - { - "entitlementPoolList": [ - "f1d563e8-e714-4393-8f99-cc480144a05e", - "j1d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupList": [ - "s1d563e8-e714-4393-8f99-cc480144a05e", - "b1d563e8-e714-4393-8f99-cc480144a05e" - ], - "resourceModuleName": "vHNPortalaaS_primary_1", - "serviceResourceId": "testResourceIdAR" - }, - { - "entitlementPoolList": [ - "f1d563e8-e714-4393-8f99-cc480144a05n", - "j1d563e8-e714-4393-8f99-cc480144a05n" - ], - "licenseKeyGroupList": [ - "s1d563e8-e714-4393-8f99-cc480144a05n", - "b1d563e8-e714-4393-8f99-cc480144a05n" - ], - "resourceModuleName": "net", - "serviceResourceId": "testResourceIdNet2" - }, - { - "entitlementPoolList": [ - "91d563e8-e714-4393-8f99-cc480144a05e", - "21d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupList": [ - "31d563e8-e714-4393-8f99-cc480144a05e", - "71d563e8-e714-4393-8f99-cc480144a05e" - ], - "resourceModuleName": "vHNPortalaaS_secondary_1", - "serviceResourceId": "testResourceIdVNF" - } - ], - "placementInfo": [ - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "MDTNJ01" - }, - { - "variableName": "aicClli", - "variableValue": "KDTNJ01" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "dfwtx", - "inventoryType": "service", - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceInstanceId": "testSIID1", - "serviceResourceId": "testResourceIdAR", - "isRehome": "False" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "testVnfHostname2" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClli2" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionId2", - "inventoryType": "service", - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceInstanceId": "testSIID2", - "serviceResourceId": "testResourceIdAR2", - "isRehome": "False" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "testVnfHostNameNet" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClliNet" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionIdNet", - "inventoryType": "service", - "resourceModuleName": "NETWORK", - "serviceInstanceId": "testServiceInstanceIdNet", - "serviceResourceId": "testResourceIdNet", - "isRehome": "False" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClliNet2" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionIdNet2", - "inventoryType": "cloud", - "resourceModuleName": "NETWORK", - "serviceInstanceId": "", - "serviceResourceId": "testResourceIdNet2", - "isRehome": "False" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClli3" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionId3", - "inventoryType": "cloud", - "resourceModuleName": "VNF", - "serviceInstanceId": "", - "serviceResourceId": "testResourceIdVNF", - "isRehome": "False" - } - ] - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf deleted file mode 100644 index 9159d80c43..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf +++ /dev/null @@ -1,50 +0,0 @@ -{ - "transactionId": "testRequestId", - "requestId": "testRequestId", - "requestState": "complete", - "statusMessage": "", - "solutionInfo": { - "placementInfo": [ - { - "serviceResourceId": "test-resource-id-000", - "resourceModuleName": "ADIOD vRouter vCE", - "inventoryType": "service", - "serviceInstanceId": "service-instance-01234", - "cloudRegionId": "mtmnj1a", - "isRehome": "False", - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "att-aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "MDTNJ01" - }, - { - "variableName": "aicClli", - "variableValue": "KDTNJ01" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ] - } - ], - "licenseInfo": [ - { - "serviceResourceId": "test-resource-id-000", - "resourceModuleName": "ADIOD vRouter vCE", - "entitlementPoolList": [ - "f1d563e8-e714-4393-8f99-cc480144a05e", - "j1d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupList": [ - "s1d563e8-e714-4393-8f99-cc480144a05e", - "b1d563e8-e714-4393-8f99-cc480144a05e" - ] - } - ] - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound deleted file mode 100644 index 5cb748ae9d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound +++ /dev/null @@ -1,15 +0,0 @@ -{ - "requestState": "", - "responseTime": "", - "solutionInfo": { - "placement": [], - "licenseInfo": { - "featureGroupId": "" - } - }, - "percentProgress": "", - "requestId": "02c2e322-5839-4c97-9d46-0a5fa6bb642e", - "startTime": "", - "statusMessage": "No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8", - "requestType": "" -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException deleted file mode 100644 index b82688428e..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException +++ /dev/null @@ -1,9 +0,0 @@ -{ - "requestError": { - "policyException": { - "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", - "text": "Message content size exceeds the allowable limit", - "messageId": "SVC0001" - } - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException deleted file mode 100644 index 6cc78a7cdb..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException +++ /dev/null @@ -1,12 +0,0 @@ -{ - "requestError": { - "serviceException": { - "variables": [ - "severity", 400 - ], - "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", - "text": "SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8", - "messageId": "SVC0001" - } - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf deleted file mode 100644 index 2af6bf3423..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf +++ /dev/null @@ -1,65 +0,0 @@ -{ - "requestInfo": { - "transactionId": "testRequestId", - "requestId": "testRequestId", - "callbackUrl": "http://localhost:8090/workflows/messages/message/SNIROResponse/testRequestId", - "sourceId": "mso", - "optimizer": [ - "placement", - "license" - ], - "numSolutions": 1, - "timeout": 600 - }, - "placementInfo": { - "serviceModelInfo": { - "modelType": "", - "modelInvariantId": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", - "modelVersionId": "2f7f309d-c842-4644-a2e4-34167be5eeb4", - "modelName": "ADIOD vRouter vCE 011017 Service", - "modelVersion": "5.0" - }, - "subscriberInfo": { - "globalSubscriberId": "SUB12_0322_DS_1201", - "subscriberName": "SUB_12_0322_DS_1201", - "subscriberCommonSiteId": "" - }, - "demandInfo": { - "placementDemand": [ - { - "resourceInstanceType": "VNF", - "serviceResourceId": "test-resource-id-000", - "resourceModuleName": "ADIoD vCE 0", - "resourceModelInfo": { - "modelCustomizationId": "bdaeed40-c964-4966-bdb8-51320dcaf587", - "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", - "modelName": "ADIoD vCE", - "modelVersion": "2.0", - "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", - "modelType": "" - }, - "tenantId": "", - "tenantName": "" - } - ], - "licenseDemand": [ - { - "resourceInstanceType": "VNF", - "serviceResourceId": "test-resource-id-000", - "resourceModuleName": "ADIoD vCE 0", - "resourceModelInfo": { - "modelCustomizationId": "bdaeed40-c964-4966-bdb8-51320dcaf587", - "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", - "modelName": "ADIoD vCE", - "modelVersion": "2.0", - "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", - "modelType": "" - } - } - ] - }, - "policyId": [], - "serviceInstanceId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "orderInfo": "{\"requestParameters\": null}" - } - } \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume.xml index 182d7c9a11..c7a42923c8 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume.xml @@ -1,22 +1,22 @@ - - a8399879-31b3-4973-be26-0a0cbe776b58 - MoG_CinderVolumes_2 - MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845 - VmogSvc/moge2e2 - Active - 1458839419 - - - tenant - https://aai-app-e2e.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - tenant.tenant-name - MOG-25208-D-01 - - - + + a8399879-31b3-4973-be26-0a0cbe776b58 + MoG_CinderVolumes_2 + MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845 + VmogSvc/moge2e2 + Active + 1458839419 + + + tenant + https://aai-app-e2e.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + tenant.tenant-name + MOG-25208-D-01 + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml index 9b91bc5beb..ffa5829cdc 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml @@ -1,22 +1,22 @@ - - a8399879-31b3-4973-be26-0a0cbe776b58 - MoG_CinderVolumes_2 - MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845 - VmogSvc/moge2e2 - Active - 1458839419 - - - tenant - https://aai-app-e2e.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 83464847234ee8937416c65507d267 - - - tenant.tenant-name - MOG-25208-D-01 - - - + + a8399879-31b3-4973-be26-0a0cbe776b58 + MoG_CinderVolumes_2 + MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845 + VmogSvc/moge2e2 + Active + 1458839419 + + + tenant + https://aai-app-e2e.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 83464847234ee8937416c65507d267 + + + tenant.tenant-name + MOG-25208-D-01 + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/drop_mariadb_engine_7.5.6.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/drop_mariadb_engine_7.5.6.sql index 6ebc6e221e..027f2d92fc 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/drop_mariadb_engine_7.5.6.sql +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/drop_mariadb_engine_7.5.6.sql @@ -1,75 +1,75 @@ -use camundabpmn; -/* -Drop a archive tables -*/ -/*-- TMP_ARCHIVING_PROCINST */ -DROP TABLE IF EXISTS TMP_ARCHIVING_PROCINST; - -/*-- TMP_ARCHIVING_BYTEARRAY */ -DROP TABLE IF EXISTS TMP_ARCHIVING_BYTEARRAY; - -/*-- TMP LOG TABLE */ -DROP TABLE IF EXISTS TMPLOGTABLE; - -/* -- Camunda Hi Tables --*/ -DROP TABLE IF EXISTS Camunda_Hi_Tables; - -/* drop own extentions columns: -alter table ARCHIVE_ACT_HI_PROCINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -alter table ARCHIVE_ACT_HI_ACTINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -alter table ARCHIVE_ACT_HI_TASKINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -alter table ARCHIVE_ACT_HI_VARINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -alter table ARCHIVE_ACT_HI_DETAIL DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -alter table ARCHIVE_ACT_HI_COMMENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -alter table ARCHIVE_ACT_HI_ATTACHMENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -alter table ARCHIVE_ACT_HI_OP_LOG DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -alter table ARCHIVE_ACT_HI_INCIDENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -*/ - -/*--#1 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_PROCINST; -/*--#2 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_ACTINST; -/*--#3 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_TASKINST; -/*--#4 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_VARINST; -/*--#5 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_DETAIL; -/*--#6 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_COMMENT; -/*--#7 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_ATTACHMENT; -/*--#8 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_OP_LOG; -/*--#9 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_INCIDENT; -/*--#10 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_GE_BYTEARRAY; - -/* drop PL SQL procedures: */ -DROP PROCEDURE IF EXISTS ARCHIVE_CAMUNDA_HISTORY; -DROP PROCEDURE IF EXISTS ROLLB_ARCHIVE_CAMUNDA_HISTORY; - -/*-- Sequence */ --- as sequence drop doesn't work automatically in MariaDB, use this procedure to drop sequence - DROP PROCEDURE IF EXISTS DropSequence; - - DELIMITER // - - CREATE PROCEDURE DropSequence (vname VARCHAR(30)) - BEGIN - -- Drop the sequence - DELETE FROM _sequences WHERE name = vname; - END - // - DELIMITER ; - --- use the above procedure to drop sequence -CALL DropSequence('STAT_EXECUTION_SEQ'); - -/*-- To Drop the MariaDB specific user defined procedures and functions */ -DROP FUNCTION IF EXISTS NextVal; -DROP PROCEDURE IF EXISTS CreateSequence; -DROP PROCEDURE IF EXISTS DropSequence; +use camundabpmn; +/* +Drop a archive tables +*/ +/*-- TMP_ARCHIVING_PROCINST */ +DROP TABLE IF EXISTS TMP_ARCHIVING_PROCINST; + +/*-- TMP_ARCHIVING_BYTEARRAY */ +DROP TABLE IF EXISTS TMP_ARCHIVING_BYTEARRAY; + +/*-- TMP LOG TABLE */ +DROP TABLE IF EXISTS TMPLOGTABLE; + +/* -- Camunda Hi Tables --*/ +DROP TABLE IF EXISTS Camunda_Hi_Tables; + +/* drop own extentions columns: +alter table ARCHIVE_ACT_HI_PROCINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_ACTINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_TASKINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_VARINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_DETAIL DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_COMMENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_ATTACHMENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_OP_LOG DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_INCIDENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +*/ + +/*--#1 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_PROCINST; +/*--#2 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_ACTINST; +/*--#3 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_TASKINST; +/*--#4 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_VARINST; +/*--#5 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_DETAIL; +/*--#6 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_COMMENT; +/*--#7 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_ATTACHMENT; +/*--#8 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_OP_LOG; +/*--#9 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_INCIDENT; +/*--#10 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_GE_BYTEARRAY; + +/* drop PL SQL procedures: */ +DROP PROCEDURE IF EXISTS ARCHIVE_CAMUNDA_HISTORY; +DROP PROCEDURE IF EXISTS ROLLB_ARCHIVE_CAMUNDA_HISTORY; + +/*-- Sequence */ +-- as sequence drop doesn't work automatically in MariaDB, use this procedure to drop sequence + DROP PROCEDURE IF EXISTS DropSequence; + + DELIMITER // + + CREATE PROCEDURE DropSequence (vname VARCHAR(30)) + BEGIN + -- Drop the sequence + DELETE FROM _sequences WHERE name = vname; + END + // + DELIMITER ; + +-- use the above procedure to drop sequence +CALL DropSequence('STAT_EXECUTION_SEQ'); + +/*-- To Drop the MariaDB specific user defined procedures and functions */ +DROP FUNCTION IF EXISTS NextVal; +DROP PROCEDURE IF EXISTS CreateSequence; +DROP PROCEDURE IF EXISTS DropSequence; DROP TABLE IF EXISTS _sequences; \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/mariadb_engine_7.5_patch_7.5.6.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/mariadb_engine_7.5_patch_7.5.6.sql index c5b69c7a34..81485d3433 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/mariadb_engine_7.5_patch_7.5.6.sql +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/mariadb_engine_7.5_patch_7.5.6.sql @@ -1,221 +1,221 @@ -use camundabpmn; -/* - 1. Add some Camunda Indexes to history schema part (for Archiving) -*/ -create INDEX IF NOT EXISTS IDX_ACT_HI_TASKINST_PIID ON ACT_HI_TASKINST (PROC_INST_ID_); -create INDEX IF NOT EXISTS IDX_ACT_HI_COMMENT_PIID ON ACT_HI_COMMENT (PROC_INST_ID_); -create INDEX IF NOT EXISTS IDX_ACT_HI_ATTACHMENT_PIID ON ACT_HI_ATTACHMENT (PROC_INST_ID_); -create INDEX IF NOT EXISTS IDX_ACT_HI_OP_LOG_PIID ON ACT_HI_OP_LOG (PROC_INST_ID_); -create INDEX IF NOT EXISTS IDX_ACT_HI_INCIDENT_PIID ON ACT_HI_INCIDENT (PROC_INST_ID_); -create INDEX IF NOT EXISTS IDX_ACT_HI_ACTINST_PIID ON ACT_HI_ACTINST(PROC_INST_ID_); - - -/* - 2. Create Archiving Tables in current schema -*/ - -/*-- TMP_ARCHIVING_PROCINST */ -CREATE TABLE TMP_ARCHIVING_PROCINST -( PROC_INST_ID_ varchar(64) not null, - END_TIME_ datetime(3) -); -CREATE INDEX AI_TMP_ARCH_PROCINST_PI_ID ON TMP_ARCHIVING_PROCINST(PROC_INST_ID_); - -/*-- TMP_ARCHIVING_BYTEARRAY */ -CREATE TABLE TMP_ARCHIVING_BYTEARRAY -( BYTEARRAY_ID_ varchar(64) not null, - PROC_INST_ID_ varchar(64) -); -CREATE INDEX AI_TMP_ARCH_BYTEARRAY_BAID ON TMP_ARCHIVING_BYTEARRAY(BYTEARRAY_ID_); - - -/*--#1 ARCHIVE_ACT_HI_PROCINST; */ -create TABLE ARCHIVE_ACT_HI_PROCINST -AS ( select * from ACT_HI_PROCINST where 1=0); - -create index AI_HI_PROCINST_END_TIME on ARCHIVE_ACT_HI_PROCINST(END_TIME_); -ALTER TABLE ARCHIVE_ACT_HI_PROCINST ADD CONSTRAINT ARCHIVE_ACT_HI_PROCINST_UQ UNIQUE ( PROC_INST_ID_); - -/*--#2 ARCHIVE_ACT_HI_ACTINST; */ -create TABLE ARCHIVE_ACT_HI_ACTINST -AS ( select * from ACT_HI_ACTINST where 1=0); - -create index AI_HI_ACTINST_PROC_INST_ID on ARCHIVE_ACT_HI_ACTINST(PROC_INST_ID_); -create index AI_HI_ACTINST_END_TIME on ARCHIVE_ACT_HI_ACTINST(END_TIME_); - -/*--#3 ARCHIVE_ACT_HI_TASKINST; */ -create TABLE ARCHIVE_ACT_HI_TASKINST -AS ( select * from ACT_HI_TASKINST where 1=0); - -create index AI_HI_TASKINST_PROC_INST_ID on ARCHIVE_ACT_HI_TASKINST(PROC_INST_ID_); -create index AI_HI_TASKINST_END_TIME on ARCHIVE_ACT_HI_TASKINST(END_TIME_); - -/*--#4 ARCHIVE_ACT_HI_VARINST; */ -create TABLE ARCHIVE_ACT_HI_VARINST -AS ( select * from ACT_HI_VARINST where 1=0); - -create index AI_HI_VARINST_PROC_INST_ID on ARCHIVE_ACT_HI_VARINST(PROC_INST_ID_); - -/*--#5 ARCHIVE_ACT_HI_DETAIL; */ -create TABLE ARCHIVE_ACT_HI_DETAIL -AS ( select * from ACT_HI_DETAIL where 1=0); - -create index AI_HI_DETAIL_PROC_INST_ID on ARCHIVE_ACT_HI_DETAIL(PROC_INST_ID_); -create index AI_HI_DETAIL_TIME on ARCHIVE_ACT_HI_DETAIL(TIME_); - -/*--#6 ARCHIVE_ACT_HI_COMMENT; */ -create TABLE ARCHIVE_ACT_HI_COMMENT -AS ( select * from ACT_HI_COMMENT where 1=0); - -create index AI_HI_COMMENT_PROC_INST_ID on ARCHIVE_ACT_HI_COMMENT(PROC_INST_ID_); -create index AI_HI_COMMENT_TIME on ARCHIVE_ACT_HI_COMMENT(TIME_); - -/*--#7 ARCHIVE_ACT_HI_ATTACHMENT; */ -create TABLE ARCHIVE_ACT_HI_ATTACHMENT -AS ( select * from ACT_HI_ATTACHMENT where 1=0); - -create index AI_HI_ATTACHMENT_PROC_INST_ID on ARCHIVE_ACT_HI_ATTACHMENT(PROC_INST_ID_); - -/*--#8 ARCHIVE_ACT_HI_OP_LOG; */ -create TABLE ARCHIVE_ACT_HI_OP_LOG -AS ( select * from ACT_HI_OP_LOG where 1=0); - -create index AI_HI_OP_LOG_PROC_INST_ID on ARCHIVE_ACT_HI_OP_LOG(PROC_INST_ID_); -create index AI_HI_OP_LOG_TIMESTAMP on ARCHIVE_ACT_HI_OP_LOG(TIMESTAMP_); - -/*--#9 ARCHIVE_ACT_HI_INCIDENT; */ -create TABLE ARCHIVE_ACT_HI_INCIDENT -AS ( select * from ACT_HI_INCIDENT where 1=0); - -create index AI_HI_INCIDENT_PROC_INST_ID on ARCHIVE_ACT_HI_INCIDENT(PROC_INST_ID_); - -/*--#10 ARCHIVE_ACT_GE_BYTEARRAY; */ -create TABLE ARCHIVE_ACT_GE_BYTEARRAY -AS ( select * from ACT_GE_BYTEARRAY where 1=0); - -create index AI_GE_BYTEARRAY_ID_ on ARCHIVE_ACT_GE_BYTEARRAY(ID_); - -/* ----------------------------------------------------------------------------- -Extend a ARCHIVE: Table by two attributes: STAT_EXECUTION_ID, STAT_EXECUTION_TS -*/ - -/* ---TEMPLATE: -alter table ARCHIVE_%TableName% - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_%TableName%_EXE_ID ON ARCHIVE_%TableName%(STAT_EXECUTION_ID); -*/ - - -/*--#1 ACT_HI_PROCINST */ -alter table ARCHIVE_ACT_HI_PROCINST - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_PROCINST_EXE_ID ON ARCHIVE_ACT_HI_PROCINST(STAT_EXECUTION_ID); - -/*--#2 ACT_HI_ACTINST */ -alter table ARCHIVE_ACT_HI_ACTINST - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_ACTINST_EXE_ID ON ARCHIVE_ACT_HI_ACTINST(STAT_EXECUTION_ID); - -/*--#3 ACT_HI_TASKINST */ -alter table ARCHIVE_ACT_HI_TASKINST - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_TASKINST_EXE_ID ON ARCHIVE_ACT_HI_TASKINST(STAT_EXECUTION_ID); - -/*--#4 ACT_HI_VARINST */ -alter table ARCHIVE_ACT_HI_VARINST - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_VARINST_EXE_ID ON ARCHIVE_ACT_HI_VARINST(STAT_EXECUTION_ID); - -/*--#5 ACT_HI_DETAIL */ -alter table ARCHIVE_ACT_HI_DETAIL - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_DETAIL_EXE_ID ON ARCHIVE_ACT_HI_DETAIL(STAT_EXECUTION_ID); - -/*--#6 ACT_HI_COMMENT */ -alter table ARCHIVE_ACT_HI_COMMENT - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_COMMENT_EXE_ID ON ARCHIVE_ACT_HI_COMMENT(STAT_EXECUTION_ID); - -/*--#7 ACT_HI_ATTACHMENT */ -alter table ARCHIVE_ACT_HI_ATTACHMENT - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_ATTACHMENT_EXE_ID ON ARCHIVE_ACT_HI_ATTACHMENT(STAT_EXECUTION_ID); - -/*--#8 ACT_HI_OP_LOG */ -alter table ARCHIVE_ACT_HI_OP_LOG - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_OP_LOG_EXE_ID ON ARCHIVE_ACT_HI_OP_LOG(STAT_EXECUTION_ID); - -/*--#9 ACT_HI_INCIDENT */ -alter table ARCHIVE_ACT_HI_INCIDENT - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_INCIDENT_EXE_ID ON ARCHIVE_ACT_HI_INCIDENT(STAT_EXECUTION_ID); - -/*--#10 ACT_GE_BYTEARRAY */ -alter table ARCHIVE_ACT_GE_BYTEARRAY - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_GE_BYTEARRAY_EXE_ID ON ARCHIVE_ACT_GE_BYTEARRAY(STAT_EXECUTION_ID); - - -/* -- Next Val as a user defined function needed only in MariaDB--*/ -DROP FUNCTION IF EXISTS NextVal; - DELIMITER // - CREATE FUNCTION NextVal (vname VARCHAR(30)) - RETURNS INT - BEGIN - -- Retrieve and update in single statement - UPDATE _sequences - SET next = next + 1 - WHERE name = vname; - - RETURN (SELECT next FROM _sequences LIMIT 1); - END - // - DELIMITER ; - -/* -- History tables for use in archive procedure, there is no array type in MariaDB --*/ -Create Table Camunda_Hi_Tables (id_ MEDIUMINT NOT NULL AUTO_INCREMENT, - TableName_ varchar(80) NOT NULL, - PRIMARY KEY (id_)); - -Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_PROCINST'); -Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_ACTINST'); -Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_TASKINST'); -Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_VARINST'); -Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_DETAIL'); -Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_COMMENT'); -Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_ATTACHMENT'); -Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_OP_LOG'); -Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_INCIDENT'); - -/*-- log table --*/ -CREATE TABLE TMPLOGTABLE (LogMessage Varchar(700)); - - -/* -- Below user defined functions and procedures needed only in MariaDB, they are in-built in Oracle --*/ -/*-- Create a sequence SP */ -DROP PROCEDURE IF EXISTS CreateSequence; - DELIMITER // - CREATE PROCEDURE CreateSequence (name VARCHAR(30), start INT, inc INT) - BEGIN - -- Create a table to store sequences - CREATE TABLE IF NOT EXISTS _sequences - ( - name VARCHAR(70) NOT NULL UNIQUE, - next INT NOT NULL, - inc INT NOT NULL - ); - - -- Add the new sequence - INSERT INTO _sequences VALUES (name, start, inc); - END - // - DELIMITER ; - -/*-------------------------------------------------------------------------------------------------- - Add Meta to Archive - -------------------------------------------------------------------------------------------------- */ - -/* Create STAT_EXECUTION_SEQ: each Archive Entry has a same Execution ID during one Archiving Run */ -CALL CreateSequence('STAT_EXECUTION_SEQ', 1, 1); +use camundabpmn; +/* + 1. Add some Camunda Indexes to history schema part (for Archiving) +*/ +create INDEX IF NOT EXISTS IDX_ACT_HI_TASKINST_PIID ON ACT_HI_TASKINST (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_COMMENT_PIID ON ACT_HI_COMMENT (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_ATTACHMENT_PIID ON ACT_HI_ATTACHMENT (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_OP_LOG_PIID ON ACT_HI_OP_LOG (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_INCIDENT_PIID ON ACT_HI_INCIDENT (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_ACTINST_PIID ON ACT_HI_ACTINST(PROC_INST_ID_); + + +/* + 2. Create Archiving Tables in current schema +*/ + +/*-- TMP_ARCHIVING_PROCINST */ +CREATE TABLE TMP_ARCHIVING_PROCINST +( PROC_INST_ID_ varchar(64) not null, + END_TIME_ datetime(3) +); +CREATE INDEX AI_TMP_ARCH_PROCINST_PI_ID ON TMP_ARCHIVING_PROCINST(PROC_INST_ID_); + +/*-- TMP_ARCHIVING_BYTEARRAY */ +CREATE TABLE TMP_ARCHIVING_BYTEARRAY +( BYTEARRAY_ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) +); +CREATE INDEX AI_TMP_ARCH_BYTEARRAY_BAID ON TMP_ARCHIVING_BYTEARRAY(BYTEARRAY_ID_); + + +/*--#1 ARCHIVE_ACT_HI_PROCINST; */ +create TABLE ARCHIVE_ACT_HI_PROCINST +AS ( select * from ACT_HI_PROCINST where 1=0); + +create index AI_HI_PROCINST_END_TIME on ARCHIVE_ACT_HI_PROCINST(END_TIME_); +ALTER TABLE ARCHIVE_ACT_HI_PROCINST ADD CONSTRAINT ARCHIVE_ACT_HI_PROCINST_UQ UNIQUE ( PROC_INST_ID_); + +/*--#2 ARCHIVE_ACT_HI_ACTINST; */ +create TABLE ARCHIVE_ACT_HI_ACTINST +AS ( select * from ACT_HI_ACTINST where 1=0); + +create index AI_HI_ACTINST_PROC_INST_ID on ARCHIVE_ACT_HI_ACTINST(PROC_INST_ID_); +create index AI_HI_ACTINST_END_TIME on ARCHIVE_ACT_HI_ACTINST(END_TIME_); + +/*--#3 ARCHIVE_ACT_HI_TASKINST; */ +create TABLE ARCHIVE_ACT_HI_TASKINST +AS ( select * from ACT_HI_TASKINST where 1=0); + +create index AI_HI_TASKINST_PROC_INST_ID on ARCHIVE_ACT_HI_TASKINST(PROC_INST_ID_); +create index AI_HI_TASKINST_END_TIME on ARCHIVE_ACT_HI_TASKINST(END_TIME_); + +/*--#4 ARCHIVE_ACT_HI_VARINST; */ +create TABLE ARCHIVE_ACT_HI_VARINST +AS ( select * from ACT_HI_VARINST where 1=0); + +create index AI_HI_VARINST_PROC_INST_ID on ARCHIVE_ACT_HI_VARINST(PROC_INST_ID_); + +/*--#5 ARCHIVE_ACT_HI_DETAIL; */ +create TABLE ARCHIVE_ACT_HI_DETAIL +AS ( select * from ACT_HI_DETAIL where 1=0); + +create index AI_HI_DETAIL_PROC_INST_ID on ARCHIVE_ACT_HI_DETAIL(PROC_INST_ID_); +create index AI_HI_DETAIL_TIME on ARCHIVE_ACT_HI_DETAIL(TIME_); + +/*--#6 ARCHIVE_ACT_HI_COMMENT; */ +create TABLE ARCHIVE_ACT_HI_COMMENT +AS ( select * from ACT_HI_COMMENT where 1=0); + +create index AI_HI_COMMENT_PROC_INST_ID on ARCHIVE_ACT_HI_COMMENT(PROC_INST_ID_); +create index AI_HI_COMMENT_TIME on ARCHIVE_ACT_HI_COMMENT(TIME_); + +/*--#7 ARCHIVE_ACT_HI_ATTACHMENT; */ +create TABLE ARCHIVE_ACT_HI_ATTACHMENT +AS ( select * from ACT_HI_ATTACHMENT where 1=0); + +create index AI_HI_ATTACHMENT_PROC_INST_ID on ARCHIVE_ACT_HI_ATTACHMENT(PROC_INST_ID_); + +/*--#8 ARCHIVE_ACT_HI_OP_LOG; */ +create TABLE ARCHIVE_ACT_HI_OP_LOG +AS ( select * from ACT_HI_OP_LOG where 1=0); + +create index AI_HI_OP_LOG_PROC_INST_ID on ARCHIVE_ACT_HI_OP_LOG(PROC_INST_ID_); +create index AI_HI_OP_LOG_TIMESTAMP on ARCHIVE_ACT_HI_OP_LOG(TIMESTAMP_); + +/*--#9 ARCHIVE_ACT_HI_INCIDENT; */ +create TABLE ARCHIVE_ACT_HI_INCIDENT +AS ( select * from ACT_HI_INCIDENT where 1=0); + +create index AI_HI_INCIDENT_PROC_INST_ID on ARCHIVE_ACT_HI_INCIDENT(PROC_INST_ID_); + +/*--#10 ARCHIVE_ACT_GE_BYTEARRAY; */ +create TABLE ARCHIVE_ACT_GE_BYTEARRAY +AS ( select * from ACT_GE_BYTEARRAY where 1=0); + +create index AI_GE_BYTEARRAY_ID_ on ARCHIVE_ACT_GE_BYTEARRAY(ID_); + +/* ----------------------------------------------------------------------------- +Extend a ARCHIVE: Table by two attributes: STAT_EXECUTION_ID, STAT_EXECUTION_TS +*/ + +/* +--TEMPLATE: +alter table ARCHIVE_%TableName% + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_%TableName%_EXE_ID ON ARCHIVE_%TableName%(STAT_EXECUTION_ID); +*/ + + +/*--#1 ACT_HI_PROCINST */ +alter table ARCHIVE_ACT_HI_PROCINST + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_PROCINST_EXE_ID ON ARCHIVE_ACT_HI_PROCINST(STAT_EXECUTION_ID); + +/*--#2 ACT_HI_ACTINST */ +alter table ARCHIVE_ACT_HI_ACTINST + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_ACTINST_EXE_ID ON ARCHIVE_ACT_HI_ACTINST(STAT_EXECUTION_ID); + +/*--#3 ACT_HI_TASKINST */ +alter table ARCHIVE_ACT_HI_TASKINST + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_TASKINST_EXE_ID ON ARCHIVE_ACT_HI_TASKINST(STAT_EXECUTION_ID); + +/*--#4 ACT_HI_VARINST */ +alter table ARCHIVE_ACT_HI_VARINST + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_VARINST_EXE_ID ON ARCHIVE_ACT_HI_VARINST(STAT_EXECUTION_ID); + +/*--#5 ACT_HI_DETAIL */ +alter table ARCHIVE_ACT_HI_DETAIL + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_DETAIL_EXE_ID ON ARCHIVE_ACT_HI_DETAIL(STAT_EXECUTION_ID); + +/*--#6 ACT_HI_COMMENT */ +alter table ARCHIVE_ACT_HI_COMMENT + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_COMMENT_EXE_ID ON ARCHIVE_ACT_HI_COMMENT(STAT_EXECUTION_ID); + +/*--#7 ACT_HI_ATTACHMENT */ +alter table ARCHIVE_ACT_HI_ATTACHMENT + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_ATTACHMENT_EXE_ID ON ARCHIVE_ACT_HI_ATTACHMENT(STAT_EXECUTION_ID); + +/*--#8 ACT_HI_OP_LOG */ +alter table ARCHIVE_ACT_HI_OP_LOG + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_OP_LOG_EXE_ID ON ARCHIVE_ACT_HI_OP_LOG(STAT_EXECUTION_ID); + +/*--#9 ACT_HI_INCIDENT */ +alter table ARCHIVE_ACT_HI_INCIDENT + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_INCIDENT_EXE_ID ON ARCHIVE_ACT_HI_INCIDENT(STAT_EXECUTION_ID); + +/*--#10 ACT_GE_BYTEARRAY */ +alter table ARCHIVE_ACT_GE_BYTEARRAY + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_GE_BYTEARRAY_EXE_ID ON ARCHIVE_ACT_GE_BYTEARRAY(STAT_EXECUTION_ID); + + +/* -- Next Val as a user defined function needed only in MariaDB--*/ +DROP FUNCTION IF EXISTS NextVal; + DELIMITER // + CREATE FUNCTION NextVal (vname VARCHAR(30)) + RETURNS INT + BEGIN + -- Retrieve and update in single statement + UPDATE _sequences + SET next = next + 1 + WHERE name = vname; + + RETURN (SELECT next FROM _sequences LIMIT 1); + END + // + DELIMITER ; + +/* -- History tables for use in archive procedure, there is no array type in MariaDB --*/ +Create Table Camunda_Hi_Tables (id_ MEDIUMINT NOT NULL AUTO_INCREMENT, + TableName_ varchar(80) NOT NULL, + PRIMARY KEY (id_)); + +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_PROCINST'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_ACTINST'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_TASKINST'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_VARINST'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_DETAIL'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_COMMENT'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_ATTACHMENT'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_OP_LOG'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_INCIDENT'); + +/*-- log table --*/ +CREATE TABLE TMPLOGTABLE (LogMessage Varchar(700)); + + +/* -- Below user defined functions and procedures needed only in MariaDB, they are in-built in Oracle --*/ +/*-- Create a sequence SP */ +DROP PROCEDURE IF EXISTS CreateSequence; + DELIMITER // + CREATE PROCEDURE CreateSequence (name VARCHAR(30), start INT, inc INT) + BEGIN + -- Create a table to store sequences + CREATE TABLE IF NOT EXISTS _sequences + ( + name VARCHAR(70) NOT NULL UNIQUE, + next INT NOT NULL, + inc INT NOT NULL + ); + + -- Add the new sequence + INSERT INTO _sequences VALUES (name, start, inc); + END + // + DELIMITER ; + +/*-------------------------------------------------------------------------------------------------- + Add Meta to Archive + -------------------------------------------------------------------------------------------------- */ + +/* Create STAT_EXECUTION_SEQ: each Archive Entry has a same Execution ID during one Archiving Run */ +CALL CreateSequence('STAT_EXECUTION_SEQ', 1, 1); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Cleanup/create_mariadb_camunda7.5.6_ee.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Cleanup/create_mariadb_camunda7.5.6_ee.sql index bf866b4878..810bce6d0d 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Cleanup/create_mariadb_camunda7.5.6_ee.sql +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Cleanup/create_mariadb_camunda7.5.6_ee.sql @@ -1096,25 +1096,6 @@ alter table ACT_ID_TENANT_MEMBER foreign key (GROUP_ID_) references ACT_ID_GROUP (ID_); -CREATE TABLE `mso_urn_mapping` ( -`NAME_` VARCHAR(64) NOT NULL COLLATE 'utf8_bin', -`VALUE_` VARCHAR(300) NULL DEFAULT NULL COLLATE 'utf8_bin', -`REV_` INT(11) NULL DEFAULT NULL -) -COLLATE='latin1_swedish_ci' -ENGINE=InnoDB -; - -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:rollback', 'true', 1); -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('aai:endpoint', 'http://localhost:28090', 1); -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:adapters:tenant:endpoint', 'http://localhost:28090/tenantAdapterMock', 1); -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:adapters:sdnc:endpoint', 'http://localhost:28090/sdncAdapterMock', 1); -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:workflow:sdncadapter:callback', 'http://localhost:28080/mso/SDNCAdapterCallbackService', 1); -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:sdnc:timeout', 'PT5M', 1); -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:sdnc:firewall:yang:model', 'http://com/att/svc/mis/firewall-lite-gui', 1); -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:sdnc:firewall:yang:model:version', '2015-05-15', 1); -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:sdnc:timeout:firewall:minutes', '20', 1); - -- add indexes on PROC_DEF_KEY_ columns in history tables CAM-6679 create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/Client/CatalogServiceExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/Client/CatalogServiceExpected.json new file mode 100644 index 0000000000..c4a0a29b34 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/Client/CatalogServiceExpected.json @@ -0,0 +1,17 @@ +{ + "modelName": "modelName", + "description": "description", + "modelUUID": "modelUUID", + "modelInvariantUUID": "modelInvariantUUID", + "created": 10, + "modelVersion": "modelVersion", + "serviceType": "serviceType", + "serviceRole": "serviceRole", + "environmentContext": "environmentContext", + "workloadContext": "workloadContext", + "networkCustomizations": null, + "vnfCustomizations": [], + "allottedCustomizations": null, + "recipes": null, + "csar": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/Client/InfraActiveRequestExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/Client/InfraActiveRequestExpected.json new file mode 100644 index 0000000000..fe58357d53 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/Client/InfraActiveRequestExpected.json @@ -0,0 +1,46 @@ +{ + "requestId": "00032ab7-3fb3-42e5-965d-8ea592502017", + "clientRequestId": "00032ab7-3fb3-42e5-965d-8ea592502016", + "action": "deleteInstance", + "requestStatus": "COMPLETE", + "statusMessage": "Vf Module has been deleted successfully.", + "progress": 100, + "startTime": 1482451194000, + "endTime": 1482451228000, + "source": "VID", + "vnfId": "b92f60c8-8de3-46c1-8dc1-e4390ac2b005", + "vnfName": null, + "vnfType": null, + "serviceType": null, + "aicNodeClli": null, + "tenantId": "6accefef3cb442ff9e644d589fb04107", + "provStatus": null, + "vnfParams": null, + "vnfOutputs": null, + "requestBody": "{\"modelInfo\":{\"modelType\":\"vfModule\",\"modelName\":\"vSAMP10aDEV::base::module-0\"},\"requestInfo\":{\"source\":\"VID\"},\"cloudConfiguration\":{\"tenantId\":\"6accefef3cb442ff9e644d589fb04107\",\"lcpCloudRegionId\":\"mtn6\"}}", + "responseBody": null, + "lastModifiedBy": "BPMN", + "modifyTime": 1482451228000, + "requestType": null, + "volumeGroupId": null, + "volumeGroupName": null, + "vfModuleId": "c7d527b1-7a91-49fd-b97d-1c8c0f4a7992", + "vfModuleName": null, + "vfModuleModelName": "vSAMP10aDEV::base::module-0", + "aaiServiceId": null, + "aicCloudRegion": "mtn6", + "callBackUrl": null, + "correlator": null, + "serviceInstanceId": "e3b5744d-2ad1-4cdd-8390-c999a38829bc", + "serviceInstanceName": null, + "requestScope": "vfModule", + "requestAction": "deleteInstance", + "networkId": null, + "networkName": null, + "networkType": null, + "requestorId": null, + "configurationId": null, + "configurationName": null, + "operationalEnvId": null, + "operationalEnvName": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml index 40bb93bda0..81e8e2a233 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml @@ -1,10 +1,10 @@ + xmlns:v1="http://org.onap/workflow/sdnc/adapter/schema/v1"> - + testRequestId 200 diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_200.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_200.xml index fce5afafec..2b59145bc8 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_200.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_200.xml @@ -1,13 +1,13 @@ - - - - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - gg0e927b-6087-5574-9ef8-c5e4d5847db5 - V1.0 - vMOG-AKRON-1234 - 1462561835 - - - - + + + + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + gg0e927b-6087-5574-9ef8-c5e4d5847db5 + V1.0 + vMOG-AKRON-1234 + 1462561835 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml index 7c30f75497..0ae5b79484 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml @@ -1,4 +1,4 @@ - \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml index cb5d0001f7..41441b6f41 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml @@ -1,10 +1,10 @@ + xmlns:v1="http://org.onap/workflow/sdnc/adapter/schema/v1"> - + 19174929-3809-49ca-89eb-17f84a035389 200 diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogDBService_getServiceInstanceNOAAIInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogDBService_getServiceInstanceNOAAIInput.json new file mode 100644 index 0000000000..630b6f36c5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogDBService_getServiceInstanceNOAAIInput.json @@ -0,0 +1,17 @@ +{ + "modelName": "modelName", + "description": "description", + "modelUUID": "modelUUID", + "modelInvariantUUID": "modelInvariantUUID", + "created": null, + "modelVersion": "modelVersion", + "serviceType": "serviceType", + "serviceRole": "serviceRole", + "environmentContext": "environmentContext", + "workloadContext": "workloadContext", + "networkCustomizations": null, + "vnfCustomizations": [], + "allottedCustomizations": null, + "recipes": null, + "csar": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogServiceExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogServiceExpected.json new file mode 100644 index 0000000000..c4a0a29b34 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogServiceExpected.json @@ -0,0 +1,17 @@ +{ + "modelName": "modelName", + "description": "description", + "modelUUID": "modelUUID", + "modelInvariantUUID": "modelInvariantUUID", + "created": 10, + "modelVersion": "modelVersion", + "serviceType": "serviceType", + "serviceRole": "serviceRole", + "environmentContext": "environmentContext", + "workloadContext": "workloadContext", + "networkCustomizations": null, + "vnfCustomizations": [], + "allottedCustomizations": null, + "recipes": null, + "csar": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogServiceInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogServiceInput.json new file mode 100644 index 0000000000..630b6f36c5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogServiceInput.json @@ -0,0 +1,17 @@ +{ + "modelName": "modelName", + "description": "description", + "modelUUID": "modelUUID", + "modelInvariantUUID": "modelInvariantUUID", + "created": null, + "modelVersion": "modelVersion", + "serviceType": "serviceType", + "serviceRole": "serviceRole", + "environmentContext": "environmentContext", + "workloadContext": "workloadContext", + "networkCustomizations": null, + "vnfCustomizations": [], + "allottedCustomizations": null, + "recipes": null, + "csar": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionExpected.json new file mode 100644 index 0000000000..ffdf75a256 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionExpected.json @@ -0,0 +1,6 @@ +{ + "id" : "collectionId", + "model-info-collection" : null, + "instance-group" : null, + "orchestration-status" : "PRECREATED" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionInput.json new file mode 100644 index 0000000000..5c71fdc93c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionInput.json @@ -0,0 +1,4 @@ +{ + "collectionId" : "collectionId", + "orchestrationStatus" : "PRECREATED" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json new file mode 100644 index 0000000000..a500e0ba88 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json @@ -0,0 +1,11 @@ +{ + "modelUUID":null, + "modelName":null, + "modelInvariantUUID":"modelInvariantUUID", + "modelVersion":null, + "toscaNodeType":null, + "description":"description", + "created":null, + "collectionResourceCustomization":null, + "instanceGroup":null +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json new file mode 100644 index 0000000000..d87875da81 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json @@ -0,0 +1,9 @@ +{ + "modelCustomizationUUID":null, + "modelInstanceName":null, + "type":"type", + "role":"role", + "function":"function", + "created":null, + "collectionResource":null +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ConfigurationExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ConfigurationExpected.json new file mode 100644 index 0000000000..a27c488aca --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ConfigurationExpected.json @@ -0,0 +1,27 @@ +{ + "configuration-id" : "configurationId", + "orchestration-status" : "PRECREATED", + "tunnel-bandwidth" : "tunnelBandwidth", + "vendor-allowed-max-bandwidth" : "vendorAllowedMaxBandwidth", + "management-option" : "managementOption", + "configuration-name" : "configurationName", + "configuration-type" : "configurationType", + "configuration-sub-type" : "configurationSubType", + "operational-status" : "operationalStatus", + "configuration-selflink" : "configurationSelflink", + "metadata" : null, + "forwarder-evcs" : [ + { + "forwarder-evc-id": "forwarderEvcId" + } + ], + "evcs" : [ + { + "evc-id": "evcId" + } + ], + "model-info-configuration" : null, + "related-configuration" : null, + "l3-network" : null, + "l-interface" : null +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ConfigurationInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ConfigurationInput.json new file mode 100644 index 0000000000..748f3cde5a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ConfigurationInput.json @@ -0,0 +1,32 @@ +{ + "configurationId" : "configurationId", + "managementOption" : "managementOption", + "configurationName" : "configurationName", + "configurationType" : "configurationType", + "configurationSubType" : "configurationSubType", + "modelInvariantId" : "modelInvariantId", + "modelVersionId" : "modelVersionId", + "orchestrationStatus" : "PRECREATED", + "operationalStatus" : "operationalStatus", + "configurationSelflink" : "configurationSelflink", + "modelCustomizationId" : "modelCustomizationId", + "tunnelBandwidth" : "tunnelBandwidth", + "vendorAllowedMaxBandwidth" : "vendorAllowedMaxBandwidth", + "resourceVersion" : "resourceVersion", + "relationshipList" : {}, + "metadata" : {}, + "forwarderEvcs" : { + "forwarderEvc": [ + { + "forwarderEvcId": "forwarderEvcId" + } + ] + }, + "evcs" : { + "evc": [ + { + "evcId": "evcId" + } + ] + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Customer.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Customer.json new file mode 100644 index 0000000000..8f6483b4d4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Customer.json @@ -0,0 +1,6 @@ +{ + "global-customer-id": "globalCustomerId", + "subscriber-name": "subscriberName", + "subscriber-type": "subscriberType", + "service-subscription": null +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Customer_AAI.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Customer_AAI.json new file mode 100644 index 0000000000..3069c10e07 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Customer_AAI.json @@ -0,0 +1,16 @@ +{ + "globalCustomerId":"globalCustomerId", + "subscriberName":"subscriberName", + "subscriberType":"subscriberType", + "resourceVersion":null, + "serviceSubscriptions":{ + "serviceSubscription":[{ + "serviceType":"subscriptionServiceType", + "tempUbSubAccountId":null, + "resourceVersion":null, + "serviceInstances":null, + "relationshipList":null + }] + }, + "relationshipList":null +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ExecuteBuildingBlockSimple.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ExecuteBuildingBlockSimple.json new file mode 100644 index 0000000000..ede5264a02 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ExecuteBuildingBlockSimple.json @@ -0,0 +1,7 @@ +{ + "buildingBlock":{ + "mso-id":"msoId", + "bpmn-flow-name":"bbName" + }, + "requestId":"requestId" +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json new file mode 100644 index 0000000000..9b021ae1e7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json @@ -0,0 +1,99 @@ +{ + "requestContext": { + "product-family-id": "productFamilyId", + "source": "source", + "requestor-id": "requestorId", + "mso-request-id": "requestId", + "subscription-service-type": "subscriptionServiceType", + "user-params": null, + "action": "createInstance", + "callback-url": "callbackURL", + "requestParameters": { + "subscriptionServiceType": "subscriptionServiceType" + } + }, + "orchContext": { + "is-rollback-enabled": false + }, + "cloudRegion": { + "lcp-cloud-region-id": "lcpCloudRegionId", + "cloud-owner": "att-aic", + "tenant-id": "tenantId", + "complex": "complexName" + }, + "userInput": null, + "customer": { + "global-customer-id": "globalCustomerId", + "subscriber-name": "subscriberName", + "subscriber-type": "subscriberType", + "service-subscription": { + "service-type": "subscriptionServiceType", + "service-instances": [ + { + "service-instance-id": "3655a595-05d1-433c-93c0-3afd6b572545", + "service-instance-name": "serviceInstanceName", + "orchestration-status": "PRECREATED", + "owning-entity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "project": { + "project-name": "projectName" + }, + "vnfs": [], + "allotted-resources": [], + "networks": [], + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "configurations": [], + "model-info-service-instance": { + "description": "description", + "created": null, + "model-name": "modelName", + "model-uuid": "modelUUID", + "model-invariant-uuid": "modelInvariantUUID", + "model-version": "modelVersion", + "service-type": "serviceType", + "service-role": "serviceRole", + "environment-context": "environmentContext", + "workload-context": "workloadContext" + } + } + ] + } + }, + "serviceInstance": { + "service-instance-id": "3655a595-05d1-433c-93c0-3afd6b572545", + "service-instance-name": "serviceInstanceName", + "orchestration-status": "PRECREATED", + "owning-entity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "project": { + "project-name": "projectName" + }, + "vnfs": [], + "allotted-resources": [], + "networks": [], + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "configurations": [], + "model-info-service-instance": { + "description": "description", + "created": null, + "model-name": "modelName", + "model-uuid": "modelUUID", + "model-invariant-uuid": "modelInvariantUUID", + "model-version": "modelVersion", + "service-type": "serviceType", + "service-role": "serviceRole", + "environment-context": "environmentContext", + "workload-context": "workloadContext" + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json new file mode 100644 index 0000000000..0d00e4d007 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json @@ -0,0 +1,72 @@ +{ + "closedLoopDisabled":false, + "vnf-id":"vnfId", + "vnf-name":"vnfName", + "vnf-type":"vnfType", + "orchestration-status":"PRECREATED", + "vf-modules":[{ + "vf-module-id":"vfModuleId", + "vf-module-name":"vfModuleName", + "orchestration-status":"PRECREATED", + "cascaded":false, + "heat-stack-id":"heatStackId", + "contrail-service-instance-fqdn":"contrailServiceInstanceFqdn", + "module-index":1,"selflink":"selflink", + "model-info-vf-module":null + }], + "volume-groups":[], + "line-of-business":null, + "platform":null, + "cascaded":false, + "cloud-params":{}, + "cloud-context":null, + "solution":null, + "vnf-name-2":null, + "service-id":null, + "regional-resource-zone":null, + "prov-status":null, + "operational-status":null, + "equipment-role":null, + "management-option":null, + "ipv4-oam-address":null, + "ipv4-loopback0-address":null, + "nm-lan-v6-address":null, + "management-v6-address":null, + "vcpu":null, + "vcpu-units":null, + "vmemory":null, + "vmemory-units":null, + "vdisk":null, + "vdisk-units":null, + "in-maint":false, + "is-closed-loop-disabled":false, + "summary-status":null, + "encrypted-access-flag":null, + "as-number":null, + "regional-resource-subzone":null, + "self-link":null, + "ipv4-oam-gateway-address":null, + "ipv4-oam-gateway-address-prefix-length":null, + "vlan-id-outer":null,"nm-profile-name":null, + "l-interfaces":[], + "lag-interfaces":[{ + "interface-name":"interfaceName", + "interface-description":"interfaceDescription", + "speed-value":"speedValue", + "speed-units":"speedUnits", + "interface-id":"interfaceId", + "interface-role":"interfaceRole", + "prov-status":"provStatus", + "in-maint":true, + "l-interfaces":[] + }], + "license": { + "entitlement-pool-uuids": [], + "license-key-group-uuids": [] + }, + "entitlements":[{ + "group-uuid":"groupUuid", + "resource-uuid":"resourceUuid" + }], + "model-info-generic-vnf":null +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjectsExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjectsExpected.json new file mode 100644 index 0000000000..79c9c3015a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjectsExpected.json @@ -0,0 +1,23 @@ +{ + "customer": { + "global-customer-id": "globalCustomerId", + "subscriber-name": "subscriberName", + "subscriber-type": "subscriberType", + "service-subscription": { + "service-type": "subscriptionServiceType" + } + }, + "project": { + "project-name": "projectName" + }, + "owningEntity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "platform": { + "platform-name": "platformName" + }, + "lineOfBusiness": { + "line-of-business-name": "lineOfBusinessName" + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjectsInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjectsInput.json new file mode 100644 index 0000000000..403ca30450 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjectsInput.json @@ -0,0 +1,19 @@ +{ + "customer": { + "global-customer-id": "globalCustomerId", + "subscriber-name": "subscriberName", + "subscriber-type": "subscriberType", + "service-subscription": { + "service-type": "subscriptionServiceType" + } + }, + "project": { + "project-name": "projectName" + }, + "owningEntity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "platform": null, + "lineOfBusiness": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjects_getServiceInstanceNOAAIInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjects_getServiceInstanceNOAAIInput.json new file mode 100644 index 0000000000..403ca30450 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjects_getServiceInstanceNOAAIInput.json @@ -0,0 +1,19 @@ +{ + "customer": { + "global-customer-id": "globalCustomerId", + "subscriber-name": "subscriberName", + "subscriber-type": "subscriberType", + "service-subscription": { + "service-type": "subscriptionServiceType" + } + }, + "project": { + "project-name": "projectName" + }, + "owningEntity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "platform": null, + "lineOfBusiness": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InfraActiveRequestExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InfraActiveRequestExpected.json new file mode 100644 index 0000000000..dd4dc65190 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InfraActiveRequestExpected.json @@ -0,0 +1,46 @@ +{ + "requestId": "00032ab7-3fb3-42e5-965d-8ea592502017", + "clientRequestId": "00032ab7-3fb3-42e5-965d-8ea592502016", + "action": "deleteInstance", + "requestStatus": "COMPLETE", + "statusMessage": "Vf Module has been deleted successfully.", + "progress": 100, + "startTime": 1482451194000, + "endTime": 1482451228000, + "source": "VID", + "vnfId": "b92f60c8-8de3-46c1-8dc1-e4390ac2b005", + "vnfName": null, + "vnfType": null, + "serviceType": null, + "aicNodeClli": null, + "tenantId": "6accefef3cb442ff9e644d589fb04107", + "provStatus": null, + "vnfParams": null, + "vnfOutputs": null, + "requestBody": "{\"requestDetails\":{\"modelInfo\":{\"modelType\":\"vfModule\",\"modelName\":\"vSAMP10aDEV::base::module-0\"},\"requestInfo\":{\"source\":\"VID\"},\"cloudConfiguration\":{\"tenantId\":\"6accefef3cb442ff9e644d589fb04107\",\"lcpCloudRegionId\":\"mtn6\"}}}", + "responseBody": null, + "lastModifiedBy": "BPMN", + "modifyTime": 1482451228000, + "requestType": null, + "volumeGroupId": null, + "volumeGroupName": null, + "vfModuleId": "c7d527b1-7a91-49fd-b97d-1c8c0f4a7992", + "vfModuleName": null, + "vfModuleModelName": "vSAMP10aDEV::base::module-0", + "aaiServiceId": null, + "aicCloudRegion": "mtn6", + "callBackUrl": null, + "correlator": null, + "serviceInstanceId": "e3b5744d-2ad1-4cdd-8390-c999a38829bc", + "serviceInstanceName": null, + "requestScope": "vfModule", + "requestAction": "deleteInstance", + "networkId": null, + "networkName": null, + "networkType": null, + "requestorId": null, + "configurationId": null, + "configurationName": null, + "operationalEnvId": null, + "operationalEnvName": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroup.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroup.json new file mode 100644 index 0000000000..723905b226 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroup.json @@ -0,0 +1,11 @@ +{ + "modelUUID" : "modelUUID", + "modelName" : null, + "modelInvariantUUID" : "modelInvariantUUID", + "modelVersion" : null, + "role" : "instanceGroupRole", + "toscaNodeType" : null, + "type" : "VNFC", + "created" : null, + "collectionResource" : null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroupExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroupExpected.json new file mode 100644 index 0000000000..b2e7b719f3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroupExpected.json @@ -0,0 +1,8 @@ +{ + "id" : "instanceGroupId", + "description" : "description", + "resource-version" : "resourceVersion", + "instance-group-name" : "instanceGroupName", + "model-info-instance-group" : null, + "instance-group-function" : "instanceGroupFunction" +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroupInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroupInput.json new file mode 100644 index 0000000000..ec116fe74c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroupInput.json @@ -0,0 +1,12 @@ +{ + "id" : "instanceGroupId", + "instanceGroupRole" : "instanceGroupRole", + "modelInvariantId" : "modelInvariantId", + "modelVersionId" : "modelVersionId", + "description" : "description", + "instanceGroupType" : "instanceGroupType", + "resourceVersion" : "resourceVersion", + "instanceGroupName" : "instanceGroupName", + "instanceGroupFunction" : "instanceGroupFunction", + "relationshipList" : {} +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/LineOfBusiness.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/LineOfBusiness.json new file mode 100644 index 0000000000..b2446c753a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/LineOfBusiness.json @@ -0,0 +1,3 @@ +{ + "line-of-business-name": "lineOfBusinessName" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/LineOfBusinessExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/LineOfBusinessExpected.json new file mode 100644 index 0000000000..b2446c753a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/LineOfBusinessExpected.json @@ -0,0 +1,3 @@ +{ + "line-of-business-name": "lineOfBusinessName" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json new file mode 100644 index 0000000000..45ca00bd32 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json @@ -0,0 +1,8 @@ +{ + "model-invariant-uuid":"modelInvariantUUID", + "collection-function":"function", + "collection-role":"role", + "collection-type":"type", + "description":"description", + "quantity":0 +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoGenericVnfExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoGenericVnfExpected.json new file mode 100644 index 0000000000..98f966e753 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoGenericVnfExpected.json @@ -0,0 +1,21 @@ +{ + "tosca-node-type": "toscaNodeType", + "description": "description", + "orchestration-mode": "orchestrationMode", + "aic-version-min" : "aicVersionMin", + "aic-version-max" : "aicVersionMax", + "min-instances": 2, + "max-instances": 3, + "availability-zone-max-count": 5, + "nf-function" : "nfFunction", + "nf-type" : "nfType", + "nf-role" : "nfRole", + "nf-naming-code" : "nfNamingCode", + "multi-stage-design" : "multiStageDesign", + "model-customization-uuid": "modelCustomizationUUID", + "model-instance-name": "modelInstanceName", + "model-version" : "modelVersion", + "model-invariant-uuid" : "modelInvariantUUID", + "model-name" : "modelName", + "model-uuid" : "modelUUID" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoInstanceGroup.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoInstanceGroup.json new file mode 100644 index 0000000000..f7bc4c33db --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoInstanceGroup.json @@ -0,0 +1,10 @@ +{ + "modelUUID":"modelUUID", + "modelInvariantUUID":"modelInvariantUUID", + "model-uuid":"modelUUID", + "model-invariant-uuid":"modelInvariantUUID", + "type":"VNFC", + "instance-group-role":"instanceGroupRole", + "function": "function", + "description": "description" +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoNetworkExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoNetworkExpected.json new file mode 100644 index 0000000000..d082cd91bf --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoNetworkExpected.json @@ -0,0 +1,18 @@ +{ + "model-customization-uuid": "modelCustomizationUUID", + "model-instance-name": "modelInstanceName", + "network-technology": "networkTechnology", + "network-type": "networkType", + "network-scope": "networkScope", + "network-role": "networkRole", + "description" : "description", + "model-version" : "modelVersion", + "model-invariant-uuid" : "modelInvariantUUID", + "model-name" : "modelName", + "model-uuid" : "modelUUID", + "neutron-network-type" : "neutronNetworkType", + "aic-version-min" : "aicVersionMin", + "aic-version-max" : "aicVersionMax", + "orchestration-mode" : "orchestrationMode", + "tosca-node-type" : "toscaNodeType" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json new file mode 100644 index 0000000000..42ae25a7b1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json @@ -0,0 +1,12 @@ +{ + "model-name": "modelName", + "description": "description", + "created": null, + "model-uuid": "modelUUID", + "model-invariant-uuid": "modelInvariantUUID", + "model-version": "modelVersion", + "service-type": "serviceType", + "service-role": "serviceRole", + "environment-context": "environmentContext", + "workload-context": "workloadContext" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoVfModuleExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoVfModuleExpected.json new file mode 100644 index 0000000000..1f9a8be5cf --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoVfModuleExpected.json @@ -0,0 +1,14 @@ +{ + "model-customization-uuid": "modelCustomizationUUID", + "model-name" : "modelName", + "model-uuid" : "modelUUID", + "model-invariant-uuid" : "modelInvariantUUID", + "model-version" : "modelVersion", + "description": "description", + "is-base-boolean": true, + "min-instances": 2, + "max-instances": 3, + "availability-zone-count": 5, + "label": "label", + "initial-count": null +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/NetworkPolicy.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/NetworkPolicy.json new file mode 100644 index 0000000000..90b5108bc1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/NetworkPolicy.json @@ -0,0 +1,6 @@ +{ + "network-policy-id": "networkPolicyId", + "network-policy-fqdn" : "networkPolicyFqdn", + "heat-stack-id" : "heatStackId", + "resource-version" : "resourceVersion" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/NetworkResourceCustomizationInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/NetworkResourceCustomizationInput.json new file mode 100644 index 0000000000..f1e5969117 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/NetworkResourceCustomizationInput.json @@ -0,0 +1,25 @@ +{ + "modelCustomizationUUID" : "modelCustomizationUUID", + "modelInstanceName" : "modelInstanceName", + "networkTechnology" : "networkTechnology", + "networkType" : "networkType", + "networkScope" : "networkScope", + "networkRole" : "networkRole", + "networkResource" : { + "modelUUID" : "modelUUID", + "orchestrationMode" : "orchestrationMode", + "description" : "description", + "neutronNetworkType" : "neutronNetworkType", + "aicVersionMin" : "aicVersionMin", + "aicVersionMax" : "aicVersionMax", + "modelName" : "modelName", + "modelInvariantUUID" : "modelInvariantUUID", + "modelVersion" : "modelVersion", + "toscaNodeType" : "toscaNodeType", + "category" : "category", + "subCategory" : "subCategory", + "networkResourceCustomization" : [], + "collectionNetworkResourceCustomization" : [], + "heatTemplate" : {} + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/OwningEntity.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/OwningEntity.json new file mode 100644 index 0000000000..699079f6f9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/OwningEntity.json @@ -0,0 +1,4 @@ +{ + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Platform.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Platform.json new file mode 100644 index 0000000000..12b4e0b530 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Platform.json @@ -0,0 +1,3 @@ +{ + "platform-name": "platformName" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PlatformExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PlatformExpected.json new file mode 100644 index 0000000000..12b4e0b530 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PlatformExpected.json @@ -0,0 +1,3 @@ +{ + "platform-name": "platformName" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Project.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Project.json new file mode 100644 index 0000000000..4904d2cdb5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Project.json @@ -0,0 +1,3 @@ +{ + "project-name": "projectName" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json new file mode 100644 index 0000000000..6f82a9dd75 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json @@ -0,0 +1,12 @@ +{ + "product-family-id": "productFamilyId", + "source": "source", + "requestor-id": "requestorId", + "subscription-service-type": "subscriptionServiceType", + "user-params": null, + "action": null, + "callback-url": "callbackURL", + "requestParameters": { + "subscriptionServiceType": "subscriptionServiceType" + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsExpected.json new file mode 100644 index 0000000000..fa5fd9740c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsExpected.json @@ -0,0 +1,14 @@ +{ + "modelInfo": { + "modelType": "vfModule", + "modelName": "vSAMP10aDEV::base::module-0" + }, + "requestInfo": { + "source": "VID", + "suppressRollback": false + }, + "cloudConfiguration": { + "tenantId": "6accefef3cb442ff9e644d589fb04107", + "lcpCloudRegionId": "mtn6" + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput.json new file mode 100644 index 0000000000..e3c6e8c61e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput.json @@ -0,0 +1,18 @@ +{ + "requestParameters": { + "subscriptionServiceType": "subscriptionServiceType" + }, + "project": { + "projectName": "projectName" + }, + "owningEntity": { + "owningEntityId": "owningEntityId", + "owningEntityName": "owningEntityName" + }, + "platform": { + "platformName": "platformName" + }, + "lineOfBusiness": { + "lineOfBusinessName": "lineOfBusinessName" + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json new file mode 100644 index 0000000000..e91875135b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json @@ -0,0 +1,13 @@ +{ + "requestInfo": { + "callbackUrl": "callbackURL", + "productFamilyId": "productFamilyId", + "source": "source", + "suppressRollback": false, + "requestorId": "requestorId" + }, + "requestParameters": { + "subscriptionServiceType": "subscriptionServiceType" + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json new file mode 100644 index 0000000000..1cc387aaa0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json @@ -0,0 +1,151 @@ +{ + "modelInfo": { + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersion": "10.0" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "project": { + "projectName": "projectName" + }, + "subscriberInfo": { + "globalSubscriberId": "subscriberId" + }, + "requestInfo": { + "instanceName": "vPE_Service", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": true, + "requestorId": "xxxxxx" + }, + "requestParameters": { + "subscriptionServiceType": "VMX", + "aLaCarte": false, + "userParams": [ + { + "service": { + "modelInfo": { + "modelType": "service", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceName": "vPE_Service", + "instanceParams": [], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelType": "vnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001", + "instanceParams": [], + "vfModules": [ + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", + "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79", + "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f" + }, + "instanceName": "vmxnjr001_AVPN_base_vPE_BV_base_001", + "instanceParams": [ + { + "vmx_int_net_len": "24" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "100" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_002", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "50" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-2", + "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969" + }, + "instanceName": "vmxnjr001_AVPN_vPFE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vmx_vpfe_int_ip_0": "192.168.0.16" + } + ] + } + ] + } + ], + "networks": [ + { + "modelInfo": { + "modelType": "network", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001" + } + ] + } + } + } + ] + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withRelatedInstanceList.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withRelatedInstanceList.json new file mode 100644 index 0000000000..bb1612b11d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withRelatedInstanceList.json @@ -0,0 +1,19 @@ +{ + "modelInfo":{ + "modelType":"service", + "modelVersionId":"modelUUID", + "modelUuid":"modelUUID", + "modelInvariantId":"modelInvariantId", + "modelVersion":"modelVersion" + }, + "relatedInstanceList":[{ + "relatedInstance":{ + "instanceId":"instanceId", + "modelInfo":{ + "modelType":"service", + "modelVersionId":"modelUUID", + "modelUuid":"modelUUID" + } + } + }] +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withoutRelatedInstanceList.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withoutRelatedInstanceList.json new file mode 100644 index 0000000000..4111c7835f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withoutRelatedInstanceList.json @@ -0,0 +1,17 @@ +{ + "modelInfo":{ + "modelType":"service", + "modelVersionId":"modelUUID", + "modelUuid":"modelUUID" + }, + "relatedInstanceList":[{ + "relatedInstance":{ + "instanceId":"instanceId", + "modelInfo":{ + "modelType":"service", + "modelVersionId":"modelUUID", + "modelUuid":"modelUUID" + } + } + }] +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetails_CreateVnf.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetails_CreateVnf.json new file mode 100644 index 0000000000..8332ddc28f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetails_CreateVnf.json @@ -0,0 +1,60 @@ +{ + "modelInfo": { + "modelType": "vnf", + "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelVersionId": "fe042c22-ba82-43c6-b2f6-8f1fc4164091", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelCustomizationName": "vSAMP12 1", + "modelCustomizationId": "a7f1d08e-b02d-11e6-80f5-76304dec7eb7" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "subscriberInfo": { + "globalSubscriberId": "subscriberId" + }, + "requestInfo": { + "instanceName": "MSOTEST103a", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": false, + "requestorId": "xxxxxx" + }, + "platform": { + "platformName": "{some platformName}" + }, + "lineOfBusiness": { + "lineOfBusinessName": "{some string}" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{serviceInstanceId}", + "modelInfo": { + "modelType": "service", + "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "{parent service model name}", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "{instanceGroupId}", + "modelInfo": { + "modelType": "networkCollection", + "modelInvariantId": "9ea660dc-155f-44d3-b45c-cc7648b4f31c", + "modelVersionId": "bb07aad1-ce2d-40c1-85cb-5392f76bb1ef", + "modelName": "{network collection model name}", + "modelVersion": "1.0" + } + } + } + ], + "requestParameters": { + "userParams": [] + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestLineOfBusinessInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestLineOfBusinessInput.json new file mode 100644 index 0000000000..1fd5fffaef --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestLineOfBusinessInput.json @@ -0,0 +1,3 @@ +{ + "lineOfBusinessName": "lineOfBusinessName" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestPlatformInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestPlatformInput.json new file mode 100644 index 0000000000..80a5d6201a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestPlatformInput.json @@ -0,0 +1,3 @@ +{ + "platformName": "platformName" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RouteTableReferenceExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RouteTableReferenceExpected.json new file mode 100644 index 0000000000..dcef8b5831 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RouteTableReferenceExpected.json @@ -0,0 +1,5 @@ +{ + "route-table-reference-id": "routeTableReferenceId", + "route-table-reference-fqdn": "routeTableReferenceFqdn", + "resource-version": "resourceVersion" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RouteTableReferenceInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RouteTableReferenceInput.json new file mode 100644 index 0000000000..5aec724ab3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RouteTableReferenceInput.json @@ -0,0 +1,6 @@ +{ + "routeTableReferenceId": "routeTableReferenceId", + "routeTableReferenceFqdn": "routeTableReferenceFqdn", + "resourceVersion": "resourceVersion", + "relationshipList": {} +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/SerializationTest.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/SerializationTest.json new file mode 100644 index 0000000000..5e879dc78e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/SerializationTest.json @@ -0,0 +1,86 @@ +{ + "requestContext" : { + "product-family-id" : null, + "source" : "VID", + "requestor-id" : "xxxxxx", + "subscription-service-type" : "Mobility", + "user-params" : null, + "action" : "createInstance", + "callback-url" : null, + "service-uri" : null, + "mso-request-id" : "fa807605-ebf5-4edd-83aa-c23edba607a2", + "requestParameters" : { + "subscriptionServiceType" : "Mobility", + "aLaCarte" : true, + "testApi" : "GR_API" + } + }, + "orchContext" : { + "is-rollback-enabled" : false + }, + "locationContext" : { + "cloud-owner" : null, + "cloud-region-id" : null, + "tenant-id" : null, + "complex" : null, + "aic-version" : null + }, + "userInput" : null, + "serviceInstance" : { + "service-instance-id" : "a446e2ab-7c92-4b4c-bfc2-9ab88f3c99c3", + "service-instance-name" : "Network_vprobes_mgmt_1_SI_sk316t", + "orchestration-status" : "PRECREATED", + "owning-entity" : { + "owning-entity-id" : "f160c875-ddd1-4ef5-84d8-d098784daa3a", + "owning-entity-name" : "OE1" + }, + "customer" : { + "global-customer-id" : "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "subscriber-name" : "Mobility", + "subscriber-type" : "INFRA", + "service-subscription" : { + "service-type" : "Mobility", + "temp-ub-sub-account-id" : null, + "service-instances" : [ ] + }, + "vpn-bindings" : [ ] + }, + "project" : { + "project-name" : "project1" + }, + "collection" : null, + "vnfs" : [ ], + "allotted-resources" : [ ], + "networks" : [ ], + "bandwidth-total" : null, + "bandwidth-up-wan-1" : null, + "bandwidth-down-wan-1" : null, + "bandwidth-up-wan-2" : null, + "bandwidth-down-wan-2" : null, + "vhn-portal-url" : null, + "service-instance-location-id" : null, + "selflink" : null, + "metadata" : null, + "configuration" : null, + "vpn-bonding-links" : [ ], + "model-info-service-instance" : { + "model-name" : "Network_vprobes_mgmt_1", + "description" : "tbd", + "created" : "Mon Jan 15 10:54:06 GMT 2018", + "model-uuid" : "13da7f84-f380-4591-a714-937d4bef0c34", + "model-invariant-uuid" : "0bd8b143-41cf-4373-8601-61be1bf01c9a", + "model-version" : "1.0", + "service-type" : "", + "service-role" : "", + "environment-context" : "General_Revenue-Bearing", + "workload-context" : "Production" + } + }, + "cloudRegion" : { + "lcp-cloud-region-id" : null, + "tenant-id" : null, + "cloud-owner" : null, + "cloud-region-version" : null + }, + "customer" : null +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIInput.json new file mode 100644 index 0000000000..8cf6f6c3ab --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIInput.json @@ -0,0 +1,32 @@ +{ + "serviceInstanceId": "serviceInstanceId", + "serviceInstanceName": "serviceInstanceName", + "serviceType": null, + "serviceRole": null, + "environmentContext": null, + "workloadContext": null, + "modelInvariantId": null, + "modelVersionId": null, + "personaModelVersion": null, + "widgetModelId": null, + "widgetModelVersion": null, + "bandwidthTotal": "bandwidthTotal", + "bandwidthUpWan1": "bandwidthUpWan1", + "bandwidthDownWan1": "bandwidthDownWan1", + "bandwidthUpWan2": "bandwidthUpWan2", + "bandwidthDownWan2": "bandwidthDownWan2", + "vhnPortalUrl": "vhnPortalUrl", + "serviceInstanceLocationId": "serviceInstanceLocId", + "resourceVersion": null, + "selflink": "selfLink", + "orchestrationStatus": "Created", + "relationshipList": null, + "metadata": null, + "allottedResources": { + "allottedResource": [ + { + "id": "allottedID" + } + ] + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIPlatformAndLOBInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIPlatformAndLOBInput.json new file mode 100644 index 0000000000..9bf854c31d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIPlatformAndLOBInput.json @@ -0,0 +1,72 @@ +{ + "service-instance-id": null, + "service-instance-name": null, + "orchestration-status": null, + "owning-entity": null, + "project": null, + "vnfs": [ + { + "closedLoopDisabled": false, + "vnf-id": "vnfId", + "vnf-name": null, + "vnf-type": null, + "orchestration-status": null, + "vf-modules": [], + "volume-groups": [], + "line-of-business": { + "line-of-business-name": "lineOfBusinessName" + }, + "platform": { + "platform-name": "platformName" + }, + "cascaded": false, + "cloud-params": null, + "cloud-context": null, + "solution": null, + "vnf-name-2": null, + "service-id": null, + "regional-resource-zone": null, + "prov-status": null, + "operational-status": null, + "equipment-role": null, + "management-option": null, + "ipv4-oam-address": null, + "ipv4-loopback0-address": null, + "nm-lan-v6-address": null, + "management-v6-address": null, + "vcpu": null, + "vcpu-units": null, + "vmemory": null, + "vmemory-units": null, + "vdisk": null, + "vdisk-units": null, + "in-maint": false, + "is-closed-loop-disabled": false, + "summary-status": null, + "encrypted-access-flag": null, + "as-number": null, + "regional-resource-subzone": null, + "self-link": null, + "ipv4-oam-gateway-address": null, + "ipv4-oam-gateway-address-prefix-length": null, + "vlan-id-outer": null, + "nm-profile-name": null, + "l-interfaces": [], + "lag-interfaces": [], + "license": { + "entitlement-pool-uuids": [], + "license-key-group-uuids": [] + }, + "entitlements": [], + "model-info-generic-vnf": null + } + ], + "allotted-resources": [], + "networks": [], + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "configurations": [], + "model-info-service-instance": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_aaiPlatformAndLOBToSI.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_aaiPlatformAndLOBToSI.json new file mode 100644 index 0000000000..9d4851d34c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_aaiPlatformAndLOBToSI.json @@ -0,0 +1,72 @@ +{ + "service-instance-id": null, + "service-instance-name": null, + "orchestration-status": null, + "owning-entity": null, + "project": null, + "vnfs": [ + { + "closedLoopDisabled": false, + "vnf-id": "vnfId", + "vnf-name": null, + "vnf-type": null, + "orchestration-status": null, + "vf-modules": [], + "volume-groups": [], + "line-of-business": { + "line-of-business-name": "lineOfBusinessName" + }, + "platform": { + "platform-name": "platformName" + }, + "cascaded": false, + "cloud-params": null, + "cloud-context": null, + "solution": null, + "vnf-name-2": null, + "service-id": null, + "regional-resource-zone": null, + "prov-status": null, + "operational-status": null, + "equipment-role": null, + "management-option": null, + "ipv4-oam-address": null, + "ipv4-loopback0-address": null, + "nm-lan-v6-address": null, + "management-v6-address": null, + "vcpu": null, + "vcpu-units": null, + "vmemory": null, + "vmemory-units": null, + "vdisk": null, + "vdisk-units": null, + "in-maint": false, + "is-closed-loop-disabled": false, + "summary-status": null, + "encrypted-access-flag": null, + "as-number": null, + "regional-resource-subzone": null, + "self-link": null, + "ipv4-oam-gateway-address": null, + "ipv4-oam-gateway-address-prefix-length": null, + "vlan-id-outer": null, + "nm-profile-name": null, + "l-interfaces": [], + "lag-interfaces": [], + "license": { + "entitlement-pool-uuids": [], + "license-key-group-uuids": [] + }, + "entitlements": [], + "model-info-generic-vnf": null + } + ], + "allotted-resources": [], + "networks": [], + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "configurations": [], + "model-info-service-instance": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_aaiServiceInstanceToSI.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_aaiServiceInstanceToSI.json new file mode 100644 index 0000000000..19d6e6dea1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_aaiServiceInstanceToSI.json @@ -0,0 +1,27 @@ +{ + "service-instance-id": "serviceInstanceId", + "service-instance-name": "serviceInstanceName", + "orchestration-status": "CREATED", + "owning-entity": null, + "project": null, + "vnfs": [], + "allotted-resources": [ + { + "id": "allottedID", + "target-network-role": null, + "self-link": null, + "orchestration-status": null, + "operational-status": null, + "type": null, + "role": null, + "model-info-allotted-resource": null + } + ], + "networks": [], + "vhn-portal-url": "vhnPortalUrl", + "service-instance-location-id": "serviceInstanceLocId", + "selflink": "selfLink", + "metadata": null, + "configurations": [], + "model-info-service-instance": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_catalogServiceToSI.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_catalogServiceToSI.json new file mode 100644 index 0000000000..0906ea29ab --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_catalogServiceToSI.json @@ -0,0 +1,34 @@ +{ + "service-instance-id": null, + "service-instance-name": null, + "orchestration-status": null, + "owning-entity": null, + "customer": null, + "project": null, + "vnfs": [], + "allotted-resources": [], + "networks": [], + "bandwidth-total": null, + "bandwidth-up-wan-1": null, + "bandwidth-down-wan-1": null, + "bandwidth-up-wan-2": null, + "bandwidth-down-wan-2": null, + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "volume-groups": [], + "configuration": null, + "model-info-service-instance": { + "description": "description", + "created": null, + "model-name": "modelName", + "model-uuid": "modelUUID", + "model-invariant-uuid": "modelInvariantUUID", + "model-version": "modelVersion", + "service-type": "serviceType", + "service-role": "serviceRole", + "environment-context": "environmentContext", + "workload-context": "workloadContext" + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_getServiceInstanceNOAAIExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_getServiceInstanceNOAAIExpected.json new file mode 100644 index 0000000000..38cca740c7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_getServiceInstanceNOAAIExpected.json @@ -0,0 +1,32 @@ +{ + "service-instance-id": "3655a595-05d1-433c-93c0-3afd6b572545", + "service-instance-name": "serviceInstanceName", + "orchestration-status": "PRECREATED", + "owning-entity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "project": { + "project-name": "projectName" + }, + "vnfs": [], + "allotted-resources": [], + "networks": [], + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "configurations": [], + "model-info-service-instance": { + "description": "description", + "created": null, + "model-name": "modelName", + "model-uuid": "modelUUID", + "model-invariant-uuid": "modelInvariantUUID", + "model-version": "modelVersion", + "service-type": "serviceType", + "service-role": "serviceRole", + "environment-context": "environmentContext", + "workload-context": "workloadContext" + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_highLevelObjectsToSI.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_highLevelObjectsToSI.json new file mode 100644 index 0000000000..4cb6940a74 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_highLevelObjectsToSI.json @@ -0,0 +1,35 @@ +{ + "service-instance-id": null, + "service-instance-name": null, + "orchestration-status": null, + "owning-entity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "customer": { + "global-customer-id": "globalCustomerId", + "subscriber-name": "subscriberName", + "subscriber-type": "subscriberType", + "service-subscription": { + "service-type": "subscriptionServiceType" + } + }, + "project": { + "project-name": "projectName" + }, + "vnfs": [], + "allotted-resources": [], + "networks": [], + "bandwidth-total": null, + "bandwidth-up-wan-1": null, + "bandwidth-down-wan-1": null, + "bandwidth-up-wan-2": null, + "bandwidth-down-wan-2": null, + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "volume-groups": [], + "configuration": null, + "model-info-service-instance": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json new file mode 100644 index 0000000000..f458d732d2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json @@ -0,0 +1,109 @@ +{ + "modelInfo": { + "modelType": "service", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceName": "vPE_Service", + "instanceParams": [], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelType": "vnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001", + "instanceParams": [], + "vfModules": [ + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", + "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79", + "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f" + }, + "instanceName": "vmxnjr001_AVPN_base_vPE_BV_base_001", + "instanceParams": [ + { + "vmx_int_net_len": "24" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "100" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_002", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "50" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-2", + "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969" + }, + "instanceName": "vmxnjr001_AVPN_vPFE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vmx_vpfe_int_ip_0": "128.0.0.16" + } + ] + } + ] + } + ], + "networks": [ + { + "modelInfo": { + "modelType": "network", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001" + } + ] + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json new file mode 100644 index 0000000000..0c3d8e709e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json @@ -0,0 +1,105 @@ +{ + "modelInfo": { + "modelType": "service", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceName": "vPE_Service", + "instanceParams": [], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelType": "vnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001", + "instanceParams": [], + "vfModules": [ + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", + "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79", + "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f" + }, + "instanceName": "vmxnjr001_AVPN_base_vPE_BV_base_001", + "instanceParams": [ + { + "vmx_int_net_len": "24" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "100" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_002", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "50" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-2", + "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969" + }, + "instanceName": "vmxnjr001_AVPN_vPFE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vmx_vpfe_int_ip_0": "128.0.0.16" + } + ] + } + ] + } + ], + "networks": [ + { + "modelInfo": { + "modelType": "network", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001" + } + ] + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json new file mode 100644 index 0000000000..3f07e8d526 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json @@ -0,0 +1,113 @@ +{ + "modelInfo": { + "modelType": "service", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceName": "vPE_Service", + "instanceParams": [], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelType": "vnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001", + "instanceParams": [], + "vfModules": [ + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", + "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79", + "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f" + }, + "instanceName": "vmxnjr001_AVPN_base_vPE_BV_base_001", + "instanceParams": [ + { + "vmx_int_net_len": "24" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "100" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_002", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "50" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-2", + "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969" + }, + "instanceName": "vmxnjr001_AVPN_vPFE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vmx_vpfe_int_ip_0": "128.0.0.16" + } + ] + } + ] + } + ], + "networks": [ + { + "modelInfo": { + "modelType": "network", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001" + } + ] + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json new file mode 100644 index 0000000000..4c29f96361 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json @@ -0,0 +1,113 @@ +{ + "modelInfo": { + "modelType": "service", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceName": "vPE_Service", + "instanceParams": [], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelType": "vnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001", + "instanceParams": [], + "vfModules": [ + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", + "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79", + "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f" + }, + "instanceName": "vmxnjr001_AVPN_base_vPE_BV_base_001", + "instanceParams": [ + { + "vmx_int_net_len": "24" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "100" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_002", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "50" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-2", + "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969" + }, + "instanceName": "vmxnjr001_AVPN_vPFE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vmx_vpfe_int_ip_0": "128.0.0.16" + } + ] + } + ] + } + ], + "networks": [ + { + "modelInfo": { + "modelType": "network", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001" + } + ] + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceSubscriptionExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceSubscriptionExpected.json new file mode 100644 index 0000000000..5c41329fb8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceSubscriptionExpected.json @@ -0,0 +1,5 @@ +{ + "service-type": "serviceType", + "temp-ub-sub-account-id" : "tempUbSubAccountId", + "service-instances" : [] +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceSubscription_AAI.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceSubscription_AAI.json new file mode 100644 index 0000000000..bc72bea767 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceSubscription_AAI.json @@ -0,0 +1,7 @@ +{ + "serviceType" : "serviceType", + "tempUbSubAccountId" : "tempUbSubAccountId", + "resourceVersion" : "resourceVersion", + "serviceInstances" : {}, + "relationshipList" : {} +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VfModuleCustomizationInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VfModuleCustomizationInput.json new file mode 100644 index 0000000000..08bd8c7d14 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VfModuleCustomizationInput.json @@ -0,0 +1,24 @@ +{ + "modelCustomizationUUID" : "modelCustomizationUUID", + "label" : "label", + "minInstances": 2, + "maxInstances": 3, + "availabilityZoneCount": 5, + "volumeHeatEnv" : {}, + "heatEnvironment" : {}, + "vfModule" : { + "modelUUID" : "modelUUID", + "modelInvariantUUID" : "modelInvariantUUID", + "modelName" : "modelName", + "modelVersion" : "modelVersion", + "description" : "description", + "isBase" : true, + "volumeHeatTemplate" : {}, + "moduleHeatTemplate" : {}, + "heatFiles" : [], + "vfModuleCustomization" : [], + "vnfResources" : { + "modelName" : "vnfResourceModelName" + } + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfResourceCustomizationInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfResourceCustomizationInput.json new file mode 100644 index 0000000000..26516ce907 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfResourceCustomizationInput.json @@ -0,0 +1,25 @@ +{ + "modelCustomizationUUID" : "modelCustomizationUUID", + "modelInstanceName" : "modelInstanceName", + "minInstances": 2, + "maxInstances": 3, + "availabilityZoneMaxCount": 5, + "nfFunction" : "nfFunction", + "nfType" : "nfType", + "nfRole" : "nfRole", + "nfNamingCode" : "nfNamingCode", + "multiStageDesign" : "multiStageDesign", + "vnfResources" : { + "modelUUID" : "modelUUID", + "modelInvariantUUID" : "modelInvariantUUID", + "modelName" : "modelName", + "modelVersion" : "modelVersion", + "toscaNodeType" : "toscaNodeType", + "description" : "description", + "orchestrationMode" : "orchestrationMode", + "aicVersionMin" : "aicVersionMin", + "aicVersionMax" : "aicVersionMax", + "category" : "category", + "subCategory" : "subCategory" + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfcInstanceGroupCustomization.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfcInstanceGroupCustomization.json new file mode 100644 index 0000000000..457b23f841 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfcInstanceGroupCustomization.json @@ -0,0 +1,8 @@ +{ + "modelCustomizationUUID" : "modelCustomizationUUID", + "modelUUID" : "modelUUID", + "vnfResourceCust" : {}, + "instanceGroup" : {}, + "function" : "function", + "description" : "description" +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json new file mode 100644 index 0000000000..f807276773 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json @@ -0,0 +1,9 @@ +{ + "volume-group-id":"volumeGroupId", + "volume-group-name":"volumeGroupName", + "vnf-type":"vnfType", + "orchestration-status":"PRECREATED", + "cloud-params":{}, + "cascaded":false, + "heat-stack-id":"heatStackId" +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup_AAI.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup_AAI.json new file mode 100644 index 0000000000..fb46478592 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup_AAI.json @@ -0,0 +1,11 @@ +{ + "volumeGroupId" : "volumeGroupId", + "volumeGroupName" : "volumeGroupName", + "heatStackId" : "heatStackId", + "vnfType" : "vnfType", + "orchestrationStatus" : "PRECREATED", + "modelCustomizationId" : "modelCustomizationId", + "vfModuleModelCustomizationId" : "vfModuleModelCustomizationId", + "resourceVersion" : null, + "relationshipList" : {} +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiGenericVnfInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiGenericVnfInput.json new file mode 100644 index 0000000000..14b316d001 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiGenericVnfInput.json @@ -0,0 +1,104 @@ +{ + "vnfId":"vnfId", + "vnfName":"vnfName", + "vnfName2":null, + "vnfType":"vnfType", + "serviceId":null, + "regionalResourceZone":null, + "provStatus":null, + "operationalStatus":null, + "licenseKey":null, + "equipmentRole":null, + "orchestrationStatus":"PRECREATED", + "heatStackId":null, + "msoCatalogKey":null, + "managementOption":null, + "ipv4OamAddress":null, + "ipv4Loopback0Address":null, + "nmLanV6Address":null, + "managementV6Address":null, + "vcpu":null, + "vcpuUnits":null, + "vmemory":null, + "vmemoryUnits":null, + "vdisk":null, + "vdiskUnits":null, + "inMaint":false, + "isClosedLoopDisabled":false, + "resourceVersion":null, + "summaryStatus":null, + "encryptedAccessFlag":null, + "entitlementAssignmentGroupUuid":null, + "entitlementResourceUuid":null, + "licenseAssignmentGroupUuid":null, + "licenseKeyUuid":null, + "modelInvariantId":null, + "modelVersionId":null, + "personaModelVersion":null, + "modelCustomizationId":null, + "widgetModelId":null, + "widgetModelVersion":null, + "asNumber":null, + "regionalResourceSubzone":null, + "nfType":null, + "nfFunction":null, + "nfRole":null, + "nfNamingCode":null, + "selflink":null, + "ipv4OamGatewayAddress":null, + "ipv4OamGatewayAddressPrefixLength":null, + "vlanIdOuter":null, + "nmProfileName":null, + "relationshipList":null, + "lagInterfaces":{ + "lagInterface":[{ + "interfaceName":"interfaceName", + "interfaceDescription":"interfaceDescription", + "resourceVersion":null, + "speedValue":"speedValue", + "speedUnits":"speedUnits", + "interfaceId":"interfaceId", + "interfaceRole":"interfaceRole", + "provStatus":"provStatus", + "inMaint":true,"relationshipList":null, + "linterfaces":null + }] + }, + "vfModules":{ + "vfModule":[{ + "vfModuleId":"vfModuleId", + "vfModuleName":"vfModuleName", + "heatStackId":"heatStackId", + "orchestrationStatus":"PRECREATED", + "isBaseVfModule":false, + "resourceVersion":null, + "modelInvariantId":null, + "modelVersionId":null, + "personaModelVersion":null, + "modelCustomizationId":null, + "widgetModelId":null, + "widgetModelVersion":null, + "contrailServiceInstanceFqdn":"contrailServiceInstanceFqdn", + "moduleIndex":1, + "selflink":"selflink", + "relationshipList":null + }] + }, + "licenses":{ + "license":[{ + "groupUuid":"groupUuid", + "resourceUuid":null, + "resourceVersion":null, + "relationshipList":null + }] + }, + "entitlements":{ + "entitlement":[{ + "groupUuid":"groupUuid", + "resourceUuid":"resourceUuid", + "resourceVersion":null, + "relationshipList":null + }] + }, + "linterfaces":null +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInput.json new file mode 100644 index 0000000000..212074ba06 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInput.json @@ -0,0 +1,50 @@ +{ + "networkId": "networkId", + "networkName": "networkName", + "networkType": null, + "networkRole": null, + "networkTechnology": null, + "neutronNetworkId": null, + "isBoundToVpn": true, + "serviceId": "serviceId", + "networkRoleInstance": 1234, + "resourceVersion": null, + "orchestrationStatus": "Assigned", + "heatStackId": "heatStackId", + "msoCatalogKey": null, + "contrailNetworkFqdn": "contrailNetworkFqdn", + "modelInvariantId": null, + "modelVersionId": null, + "personaModelVersion": null, + "modelCustomizationId": null, + "widgetModelId": "widgetModelId", + "widgetModelVersion": "widgetModelVersion", + "physicalNetworkName": "physicalNetworkName", + "isProviderNetwork": true, + "isSharedNetwork": true, + "isExternalNetwork": true, + "selflink": "selflink", + "operationalStatus": "operationalStatus", + "subnets": { + "subnet": [ + { + "subnetId": "subnetId" + } + ] + }, + "ctagAssignments": { + "ctagAssignment": [ + { + "vlanIdInner": 1234 + } + ] + }, + "segmentationAssignments": { + "segmentationAssignment": [ + { + "segmentationId": "segmentationId" + } + ] + }, + "relationshipList": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiVolumeGroupInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiVolumeGroupInput.json new file mode 100644 index 0000000000..dce65e7b67 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiVolumeGroupInput.json @@ -0,0 +1,11 @@ +{ + "volumeGroupId":"volumeGroupId", + "volumeGroupName":"volumeGroupId", + "heatStackId":"heatStackId", + "vnfType":"vnfType", + "orchestrationStatus":"PRECREATED", + "modelCustomizationId":"modelCustomizationId", + "vfModuleModelCustomizationId":"vfModuleModelCustomizationId", + "resourceVersion":null, + "relationshipList":null +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpected.json new file mode 100644 index 0000000000..5006717a02 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpected.json @@ -0,0 +1,36 @@ +{ + "network-id": "networkId", + "cascaded": null, + "cloud-params": {}, + "network-name": "networkName", + "is-bound-to-vpn": true, + "service-id": "serviceId", + "network-role-instance": 1234, + "orchestration-status": "ASSIGNED", + "heat-stack-id": "heatStackId", + "contrail-network-fqdn": "contrailNetworkFqdn", + "widget-model-id": "widgetModelId", + "widget-model-version": "widgetModelVersion", + "physical-network-name": "physicalNetworkName", + "is-provider-network": true, + "is-shared-network": true, + "is-external-network": true, + "self-link": "selflink", + "operational-status": "operationalStatus", + "subnets": [ + { + "subnet-id": "subnetId" + } + ], + "ctag-assignments": [ + { + "vlan-id-inner": 1234 + } + ], + "segmentation-assignments": [ + { + "segmentation-id": "segmentationId" + } + ], + "model-info-network": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GENDSI_getServiceInstanceResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GENDSI_getServiceInstanceResponse.xml index 30b0afb3dc..e11c4499e0 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GENDSI_getServiceInstanceResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GENDSI_getServiceInstanceResponse.xml @@ -1,35 +1,35 @@ - - SDN-ETHERNET-INTERNET - 1234 - - - MIS/1604/0026/SW_INTERNET - - - cvlan-tag - https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ - - cvlan-tag.cvlan-tag - 2003 - - - port-group.interface-id - slcp1447vbc.ipag - - - vce.vnf-id - 832bace2-3fb0-49e0-a6a4-07c47223c535 - - - - vce - https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ - - vce.vnf-id - 832bace2-3fb0-49e0-a6a4-07c47223c535 - - - - - + + SDN-ETHERNET-INTERNET + 1234 + + + MIS/1604/0026/SW_INTERNET + + + cvlan-tag + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml index a609a35857..7c879879ef 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml @@ -1,23 +1,23 @@ - - - 2f1cc940-455f-4ee2-9411-a7899cd4f124 - testVnfName123 - mmsc-capacity - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - vMMSC - pending-create - testReVer123 - - - nothing - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ - - l3-network.network-id - c597ab81-fece-49f4-a4f5-710cebb13c29 - - - - - - + + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + testReVer123 + + + nothing + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml index 2b70f0b600..0b5a822b68 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml @@ -1,90 +1,90 @@ - - - 2f1cc940-455f-4ee2-9411-a7899cd4f124 - testVnfName123 - mmsc-capacity - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - vMMSC - pending-create - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ - - l3-network.network-id - c597ab81-fece-49f4-a4f5-710cebb13c29 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ - - l3-network.network-id - 53956c91-6e5e-49aa-88dd-535f57e66e70 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ - - l3-network.network-id - 44e0d9e0-9334-4ec6-9344-07a96dac629f - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ - - l3-network.network-id - ac49d99b-5daf-4624-9f8e-188b126ea166 - - - - - - - - 802767b3-18a6-4432-96db-25522786aee0 - ZRDM1MMSC03 - mmsc-capacity - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - vMMSC - pending-create - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ - - l3-network.network-id - c597ab81-fece-49f4-a4f5-710cebb13c29 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ - - l3-network.network-id - 53956c91-6e5e-49aa-88dd-535f57e66e70 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ - - l3-network.network-id - 44e0d9e0-9334-4ec6-9344-07a96dac629f - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ - - l3-network.network-id - ac49d99b-5daf-4624-9f8e-188b126ea166 - - - - - - + + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + + 802767b3-18a6-4432-96db-25522786aee0 + ZRDM1MMSC03 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml index 2b70f0b600..0b5a822b68 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml @@ -1,90 +1,90 @@ - - - 2f1cc940-455f-4ee2-9411-a7899cd4f124 - testVnfName123 - mmsc-capacity - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - vMMSC - pending-create - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ - - l3-network.network-id - c597ab81-fece-49f4-a4f5-710cebb13c29 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ - - l3-network.network-id - 53956c91-6e5e-49aa-88dd-535f57e66e70 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ - - l3-network.network-id - 44e0d9e0-9334-4ec6-9344-07a96dac629f - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ - - l3-network.network-id - ac49d99b-5daf-4624-9f8e-188b126ea166 - - - - - - - - 802767b3-18a6-4432-96db-25522786aee0 - ZRDM1MMSC03 - mmsc-capacity - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - vMMSC - pending-create - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ - - l3-network.network-id - c597ab81-fece-49f4-a4f5-710cebb13c29 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ - - l3-network.network-id - 53956c91-6e5e-49aa-88dd-535f57e66e70 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ - - l3-network.network-id - 44e0d9e0-9334-4ec6-9344-07a96dac629f - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ - - l3-network.network-id - ac49d99b-5daf-4624-9f8e-188b126ea166 - - - - - - + + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + + 802767b3-18a6-4432-96db-25522786aee0 + ZRDM1MMSC03 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml index b1f640f47f..d0fccd80c9 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml @@ -1,6 +1,6 @@ - - - service-instance - https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET - + + + service-instance + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml index b1f640f47f..d0fccd80c9 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml @@ -1,6 +1,6 @@ - - - service-instance - https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET - + + + service-instance + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml index 84d8600eac..e377c70474 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml @@ -1,30 +1,30 @@ - - MIS/1604/0026/SW_INTERNET - 123456789 - - - cvlan-tag - https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ - - cvlan-tag.cvlan-tag - 2003 - - - port-group.interface-id - slcp1447vbc.ipag - - - vce.vnf-id - 832bace2-3fb0-49e0-a6a4-07c47223c535 - - - - vce - https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ - - vce.vnf-id - 832bace2-3fb0-49e0-a6a4-07c47223c535 - - - + + MIS/1604/0026/SW_INTERNET + 123456789 + + + cvlan-tag + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml index 85cd5d605a..52e75d970a 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml @@ -1,34 +1,34 @@ - - SDN-ETHERNET-INTERNET - 1234 - - MIS/1604/0026/SW_INTERNET - 123456789 - - - cvlan-tag - https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ - - cvlan-tag.cvlan-tag - 2003 - - - port-group.interface-id - slcp1447vbc.ipag - - - vce.vnf-id - 832bace2-3fb0-49e0-a6a4-07c47223c535 - - - - vce - https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ - - vce.vnf-id - 832bace2-3fb0-49e0-a6a4-07c47223c535 - - - - + + SDN-ETHERNET-INTERNET + 1234 + + MIS/1604/0026/SW_INTERNET + 123456789 + + + cvlan-tag + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml index 7ada696cb7..b55d51971d 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml @@ -1,97 +1,97 @@ - - 1936628a-d22f-4943-8587-a57bab2ece7a - testVnfName123 - US0112SLCP1VBRT076 - esx-vce - NVTPROV - created - 0000020 - slcp1476vbc/94a3c72b-94d5-444b-9a1f-647a36c2181d - - VPESAT-mtanjrsv126 - 135.21.249.160 - - - slcp1476vbc.vpe - e7568706-a2a9-45f8-aef8-95a0e2910953 - dvspg-VCE_VPE-slcp1476vbc - Internet - dvspg-VCE_VPE-slcp1476vbc - 0000020 - dvs-slcp1-01 - created - dvspg-VCE_VPE-slcp1476vbc/c1299f74-da35-4228-b1e0-d2fd07176196 - - - - 3012 - 0000020 - - - - - slcp1476vbc.ipag - 3477ddb6-b925-4971-ab62-c84b69634c49 - dvspg-IPAG_VCE-slcp1476vbc - Customer - dvspg-IPAG_VCE-slcp1476vbc - dvs-slcp1-01 - 0000020 - created - dvspg-IPAG_VCE-slcp1476vbc/1e9c033a-2eef-47f5-9d48-98e0b59538e7 - - - - 2003 - 0000020 - - - - - - - service-instance - https://aai-ext1.test.com:8443/aai/v2/business/customers/customer/011216-1602-SDNC001/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/SDNC%2FVLXM%2F0112001%2F%2FSW_INTERNET/ - - service-instance.service-instance-id - SDNC/VLXM/0112001//SW_INTERNET - - - service-subscription.service-type - SDN-ETHERNET-INTERNET - - - customer.global-customer-id - 011216-1602-SDNC001 - - - - vserver - https://aai-ext1.test.com:8443/aai/servers/v2/3d5f3fe23821416fac2b69af65248c74/vservers/ecab47d5-3450-4507-ada9-2b3c58485c51/ - - vserver.vserver-id - ecab47d5-3450-4507-ada9-2b3c58485c51 - - - tenant.tenant-id - 3d5f3fe23821416fac2b69af65248c74 - - - - complex - https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/complexes/complex/MDTWNJ21A4/ - - complex.physical-location-id - MDTWNJ21A4 - - - - availability-zone - https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/availability-zones/availability-zone/slcp1-esx-az01/ - - availability-zone.availability-zone-name - slcp1-esx-az01 - - - + + 1936628a-d22f-4943-8587-a57bab2ece7a + testVnfName123 + US0112SLCP1VBRT076 + esx-vce + NVTPROV + created + 0000020 + slcp1476vbc/94a3c72b-94d5-444b-9a1f-647a36c2181d + + VPESAT-mtanjrsv126 + 135.21.249.160 + + + slcp1476vbc.vpe + e7568706-a2a9-45f8-aef8-95a0e2910953 + dvspg-VCE_VPE-slcp1476vbc + Internet + dvspg-VCE_VPE-slcp1476vbc + 0000020 + dvs-slcp1-01 + created + dvspg-VCE_VPE-slcp1476vbc/c1299f74-da35-4228-b1e0-d2fd07176196 + + + + 3012 + 0000020 + + + + + slcp1476vbc.ipag + 3477ddb6-b925-4971-ab62-c84b69634c49 + dvspg-IPAG_VCE-slcp1476vbc + Customer + dvspg-IPAG_VCE-slcp1476vbc + dvs-slcp1-01 + 0000020 + created + dvspg-IPAG_VCE-slcp1476vbc/1e9c033a-2eef-47f5-9d48-98e0b59538e7 + + + + 2003 + 0000020 + + + + + + + service-instance + https://aai-ext1.test.com:8443/aai/v2/business/customers/customer/011216-1602-SDNC001/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/SDNC%2FVLXM%2F0112001%2F%2FSW_INTERNET/ + + service-instance.service-instance-id + SDNC/VLXM/0112001//SW_INTERNET + + + service-subscription.service-type + SDN-ETHERNET-INTERNET + + + customer.global-customer-id + 011216-1602-SDNC001 + + + + vserver + https://aai-ext1.test.com:8443/aai/servers/v2/3d5f3fe23821416fac2b69af65248c74/vservers/ecab47d5-3450-4507-ada9-2b3c58485c51/ + + vserver.vserver-id + ecab47d5-3450-4507-ada9-2b3c58485c51 + + + tenant.tenant-id + 3d5f3fe23821416fac2b69af65248c74 + + + + complex + https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/complexes/complex/MDTWNJ21A4/ + + complex.physical-location-id + MDTWNJ21A4 + + + + availability-zone + https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/availability-zones/availability-zone/slcp1-esx-az01/ + + availability-zone.availability-zone-name + slcp1-esx-az01 + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml index 5dc3033445..e5f98bfe33 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml @@ -1,97 +1,92 @@ - - 1936628a-d22f-4943-8587-a57bab2ece7a - testVnfName123 - US0112SLCP1VBRT076 - esx-vce - NVTPROV - created - 0000020 - slcp1476vbc/94a3c72b-94d5-444b-9a1f-647a36c2181d - - VPESAT-mtanjrsv126 - 135.21.249.160 - - - slcp1476vbc.vpe - e7568706-a2a9-45f8-aef8-95a0e2910953 - dvspg-VCE_VPE-slcp1476vbc - Internet - dvspg-VCE_VPE-slcp1476vbc - 0000020 - dvs-slcp1-01 - created - dvspg-VCE_VPE-slcp1476vbc/c1299f74-da35-4228-b1e0-d2fd07176196 - - - - 3012 - 0000020 - - - - - slcp1476vbc.ipag - 3477ddb6-b925-4971-ab62-c84b69634c49 - dvspg-IPAG_VCE-slcp1476vbc - Customer - dvspg-IPAG_VCE-slcp1476vbc - dvs-slcp1-01 - 0000020 - created - dvspg-IPAG_VCE-slcp1476vbc/1e9c033a-2eef-47f5-9d48-98e0b59538e7 - - - - 2003 - 0000020 - - - - - - - service-instance - https://aai-ext1.test.com:8443/aai/v2/business/customers/customer/011216-1602-SDNC001/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/SDNC%2FVLXM%2F0112001%2F%2FSW_INTERNET/ - - service-instance.service-instance-id - SDNC/VLXM/0112001//SW_INTERNET - - - service-subscription.service-type - SDN-ETHERNET-INTERNET - - - customer.global-customer-id - 011216-1602-SDNC001 - - - - vserver - https://aai-ext1.test.com:8443/aai/servers/v2/3d5f3fe23821416fac2b69af65248c74/vservers/ecab47d5-3450-4507-ada9-2b3c58485c51/ - - vserver.vserver-id - ecab47d5-3450-4507-ada9-2b3c58485c51 - - - tenant.tenant-id - 3d5f3fe23821416fac2b69af65248c74 - - - - complex - https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/complexes/complex/MDTWNJ21A4/ - - complex.physical-location-id - MDTWNJ21A4 - - - - availability-zone - https://aai-ext1.test..com:8443/aai/v2/cloud-infrastructure/availability-zones/availability-zone/slcp1-esx-az01/ - - availability-zone.availability-zone-name - slcp1-esx-az01 - - - + + 1936628a-d22f-4943-8587-a57bab2ece7a + testVnfName123 + US0112SLCP1VBRT076 + esx-vce + NVTPROV + created + slcp1476vbc/94a3c72b-94d5-444b-9a1f-647a36c2181d + + VPESAT-mtanjrsv126 + 135.21.249.160 + + + slcp1476vbc.vpe + e7568706-a2a9-45f8-aef8-95a0e2910953 + dvspg-VCE_VPE-slcp1476vbc + Internet + dvspg-VCE_VPE-slcp1476vbc + dvs-slcp1-01 + created + dvspg-VCE_VPE-slcp1476vbc/c1299f74-da35-4228-b1e0-d2fd07176196 + + + + 3012 + + + + + slcp1476vbc.ipag + 3477ddb6-b925-4971-ab62-c84b69634c49 + dvspg-IPAG_VCE-slcp1476vbc + Customer + dvspg-IPAG_VCE-slcp1476vbc + dvs-slcp1-01 + created + dvspg-IPAG_VCE-slcp1476vbc/1e9c033a-2eef-47f5-9d48-98e0b59538e7 + + + + 2003 + + + + + + + service-instance + https://aai-ext1.test.com:8443/aai/v2/business/customers/customer/011216-1602-SDNC001/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/SDNC%2FVLXM%2F0112001%2F%2FSW_INTERNET/ + + service-instance.service-instance-id + SDNC/VLXM/0112001//SW_INTERNET + + + service-subscription.service-type + SDN-ETHERNET-INTERNET + + + customer.global-customer-id + 011216-1602-SDNC001 + + + + vserver + https://aai-ext1.test.com:8443/aai/servers/v2/3d5f3fe23821416fac2b69af65248c74/vservers/ecab47d5-3450-4507-ada9-2b3c58485c51/ + + vserver.vserver-id + ecab47d5-3450-4507-ada9-2b3c58485c51 + + + tenant.tenant-id + 3d5f3fe23821416fac2b69af65248c74 + + + + complex + https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/complexes/complex/MDTWNJ21A4/ + + complex.physical-location-id + MDTWNJ21A4 + + + + availability-zone + https://aai-ext1.test..com:8443/aai/v2/cloud-infrastructure/availability-zones/availability-zone/slcp1-esx-az01/ + + availability-zone.availability-zone-name + slcp1-esx-az01 + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json new file mode 100644 index 0000000000..83a5478668 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json @@ -0,0 +1,21 @@ +{ + "SDNCServiceRequest": { + "requestInformation": { + "requestId": "0d883b7f-dd34-4e1b-9ed5-341d33052360", + "source": "MSO", + "notificationUrl": "null" + }, + "serviceInformation": { + "serviceType": "vRRaaS", + "serviceInstanceId": "5dad9aac-6e05-4bdb-a8ec-4f3cd718c5c6", + "subscriberName": "MSO-MUX-User", + "subscriberGlobalId": "MSO-MUX-User" + }, + "bpNotificationUrl": "http://localhost:18080/mso/WorkflowMessage/SDNCAResponse/0d883b7f-dd34-4e1b-9ed5-341d33052360-1511808197479", + "sdncRequestId": "0d883b7f-dd34-4e1b-9ed5-341d33052360-1511808197479", + "sdncService": "infra", + "sdncOperation": "service-topology-infra-assign-operation", + "sdncServiceDataType": "XML", + "sdncServiceData": " vRR-Internal-Network-L2 MTJWNJA4LCP RegionOne 22eb191dd41a4f3c9be370fc638322f4 6d2e2469-8708-47c3-a0d4-73fa28a8a50b no d6c7c582-cf7f-4542-a19e-5fa7e7d89bf2 1.0 vRR_AIC30_1702-0505-SRVS 5add3a0f-5379-4800-b87a-430ff45f8793 532ff79f-fbe8-4c88-aecf-4fe885b93b47 87056771-4d7c-47d0-b5df-6cf02e227458 1.0 vRR_AIC30_1702-0505-VSP 978ac869-b506-41d0-9125-9d0e95097c29 4e5868c5-8321-492b-882f-e4476c878746 2badc305-b2c0-4e2b-b03a-4e5d22079b30 2badc305-b2c0-4e2b-b03a-4e5d22079b31 e1b1819f-a9d1-4c27-b419-d98a2500fc47 1 Vrr_Internal_Networks_module-1 " + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml index f71f529593..8cbcce138f 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml @@ -1,7 +1,7 @@ + xmlns:v1="http://org.onap/so/workflow/schema/v1" + xmlns:v11="http://org.onap/workflow/sdnc/adapter/schema/v1"> @@ -13,7 +13,7 @@ - + 12570a36-7388-4c0a-bec4-189ce3kg9956 GetLayer3ServiceDetailsRequest diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml index 3d1e03916d..1d707a6cc5 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml @@ -1,350 +1,350 @@ - - - - - - - testRequestId - 200 - OK - - <layer3-service-list xmlns="com:att:sdnctl:l3api"> - <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> - <service-status> - <rpc-name>service-configuration-operation</rpc-name> - <rpc-action>activate</rpc-action> - <request-status>synccomplete</request-status> - <final-indicator>N</final-indicator> - <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> - <l3sdn-subaction>SUPP</l3sdn-subaction> - <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> - </service-status> - <service-data> - <internet-evc-access-information> - <ip-version>ds</ip-version> - <internet-evc-speed-value>8</internet-evc-speed-value> - <internet-evc-speed-units>Mbps</internet-evc-speed-units> - </internet-evc-access-information> - <vr-lan xmlns="com:att:sdnctl:l3api"> - <vr-lan-interface> - <static-routes> - <v6-static-routes> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> - <v6-static-route-prefix-length>28</v6-static-route-prefix-length> - </v6-static-routes> - <v4-static-routes> - <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-static-route-prefix-length>28</v4-static-route-prefix-length> - </v4-static-routes> - <v6-static-routes> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> - <v6-static-route-prefix-length>28</v6-static-route-prefix-length> - </v6-static-routes> - <v4-static-routes> - <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-static-route-prefix-length>28</v4-static-route-prefix-length> - </v4-static-routes> - <v4-static-routes> - <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-static-route-prefix-length>28</v4-static-route-prefix-length> - </v4-static-routes> - </static-routes> - <dhcp> - <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> - <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> - <use-v6-default-pool>N</use-v6-default-pool> - <excluded-v4-dhcp-addresses-from-default-pool> - <excluded-v4-address>192.168.1.7</excluded-v4-address> - </excluded-v4-dhcp-addresses-from-default-pool> - <excluded-v4-dhcp-addresses-from-default-pool> - <excluded-v4-address>192.168.1.8</excluded-v4-address> - </excluded-v4-dhcp-addresses-from-default-pool> - <v4-dhcp-pools> - <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> - <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.5</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.6</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> - </v4-dhcp-pools> - <v4-dhcp-pools> - <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> - <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.6</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.7</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> - </v4-dhcp-pools> - <use-v4-default-pool>Y</use-v4-default-pool> - <excluded-v6-dhcp-addresses-from-default-pool> - <excluded-v6-address>1:5</excluded-v6-address> - </excluded-v6-dhcp-addresses-from-default-pool> - <excluded-v6-dhcp-addresses-from-default-pool> - <excluded-v6-address>1:6</excluded-v6-address> - </excluded-v6-dhcp-addresses-from-default-pool> - <v6-dhcp-pools> - <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> - <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> - <excluded-v6-addresses> - <excluded-v6-address>1:1</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> - <excluded-v6-addresses> - <excluded-v6-address>2:2</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> - </v6-dhcp-pools> - <v6-dhcp-pools> - <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> - <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> - <excluded-v6-addresses> - <excluded-v6-address>1:1</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> - <excluded-v6-addresses> - <excluded-v6-address>2:2</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> - </v6-dhcp-pools> - </dhcp> - <firewall-lite> - <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> - <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> - <v4-firewall-packet-filters> - <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> - <v4-firewall-prefix-length>1</v4-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>1</port-number> - </udp-ports> - <tcp-ports> - <port-number>1</port-number> - </tcp-ports> - </v4-firewall-packet-filters> - <v4-firewall-packet-filters> - <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> - <v4-firewall-prefix-length>2</v4-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>2</port-number> - </udp-ports> - <tcp-ports> - <port-number>2</port-number> - </tcp-ports> - </v4-firewall-packet-filters> - <v6-firewall-packet-filters> - <v6-firewall-prefix>:</v6-firewall-prefix> - <v6-firewall-prefix-length>0</v6-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>3</port-number> - </udp-ports> - <tcp-ports> - <port-number>3</port-number> - </tcp-ports> - </v6-firewall-packet-filters> - <v6-firewall-packet-filters> - <v6-firewall-prefix>:</v6-firewall-prefix> - <v6-firewall-prefix-length>1</v6-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>4</port-number> - </udp-ports> - <tcp-ports> - <port-number>4</port-number> - </tcp-ports> - </v6-firewall-packet-filters> - </firewall-lite> - <pat> - <v4-pat-pools> - <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> - <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> - <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> - </v4-pat-pools> - <use-v4-default-pool>Y</use-v4-default-pool> - <v4-pat-enabled>N</v4-pat-enabled> - <v4-pat-pools> - <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> - <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> - <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> - </v4-pat-pools> - </pat> - <nat> - <v4-nat-enabled>Y</v4-nat-enabled> - <v4-nat-mapping-entries> - <v4-nat-internal>0.0.0.0</v4-nat-internal> - <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> - <v4-nat-external>0.0.0.0</v4-nat-external> - </v4-nat-mapping-entries> - <v4-nat-mapping-entries> - <v4-nat-internal>0.0.0.1</v4-nat-internal> - <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> - <v4-nat-external>0.0.0.1</v4-nat-external> - </v4-nat-mapping-entries> - </nat> - <vr-designation>primary</vr-designation> - <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> - <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> - <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> - <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> - <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> - <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> - <v4-public-lan-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.2</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.72</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.68</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - </v4-public-lan-prefixes> - <v6-public-lan-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - </v6-public-lan-prefixes> - </vr-lan-interface> - <routing-protocol>none</routing-protocol> - </vr-lan> -<ucpe-vms-service-information> - <transport-service-information> - <transport-service-type>AVPN</transport-service-type> - <access-circuit-info> - <access-circuit-id>1</access-circuit-id> - <dual-mode>Active</dual-mode> - </access-circuit-info> - <access-circuit-info> - <access-circuit-id>2</access-circuit-id> - <dual-mode>Standby</dual-mode> - </access-circuit-info> - </transport-service-information> - <ucpe-information> - <ucpe-host-name>hostname</ucpe-host-name> - <ucpe-activation-code>activecode</ucpe-activation-code> - <out-of-band-management-modem>OOB</out-of-band-management-modem> - </ucpe-information> - <vnf-list> - <vnf-information> - <vnf-instance-id>1</vnf-instance-id> - <vnf-sequence-number>1</vnf-sequence-number> - <vnf-type>ZZ</vnf-type> - <vnf-vendor>JUNIPER</vnf-vendor> - <vnf-model>MODEL1</vnf-model> - <vnf-id>1</vnf-id> - <prov-status>1</prov-status> - <operational-state>1</operational-state> - <orchestration-status>1</orchestration-status> - <equipment-role>1</equipment-role> - </vnf-information> - <vnf-information> - <vnf-instance-id>2</vnf-instance-id> - <vnf-sequence-number>2</vnf-sequence-number> - <vnf-type>HY</vnf-type> - <vnf-vendor>JUNIPER</vnf-vendor> - <vnf-model>MODEL2</vnf-model> - <vnf-id>2</vnf-id> - <prov-status>2</prov-status> - <operational-state>2</operational-state> - <orchestration-status>2</orchestration-status> - <equipment-role>2</equipment-role> - </vnf-information> - </vnf-list> - </ucpe-vms-service-information> - <request-information> - <request-action>Layer3ServiceActivateRequest</request-action> - <order-number>4281555</order-number> - <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> - <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> - <source>OMX</source> - <order-version>1</order-version> - </request-information> - <sdnc-request-header> - <svc-action>activate</svc-action> - <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.com:8443/adapters/rest/SDNCNotify</svc-notification-url> - <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> - </sdnc-request-header> - <l2-homing-information> - <topology>MultiPoint</topology> - <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> - <evc-name>AS/VLXM/003717//SW</evc-name> - </l2-homing-information> - <service-information> - <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> - <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name> - <service-type>SDN-ETHERNET-INTERNET</service-type> - </service-information> - <internet-service-change-details> - <internet-evc-speed-value>10</internet-evc-speed-value> - <internet-evc-speed-units>Kbps</internet-evc-speed-units> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>2</request-index> - <v4-next-hop-address>192.168.1.16</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - </internet-service-change-details> - </service-data> - </layer3-service-list> - - - - + + + + + + + testRequestId + 200 + OK + + <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <vr-lan xmlns="com:att:sdnctl:l3api"> + <vr-lan-interface> + <static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + </static-routes> + <dhcp> + <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> + <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> + <use-v6-default-pool>N</use-v6-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.8</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.5</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:5</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:6</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + </dhcp> + <firewall-lite> + <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> + <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> + <v4-firewall-prefix-length>1</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>1</port-number> + </udp-ports> + <tcp-ports> + <port-number>1</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> + <v4-firewall-prefix-length>2</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>2</port-number> + </udp-ports> + <tcp-ports> + <port-number>2</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>0</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>3</port-number> + </udp-ports> + <tcp-ports> + <port-number>3</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>1</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>4</port-number> + </udp-ports> + <tcp-ports> + <port-number>4</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + </firewall-lite> + <pat> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> + </v4-pat-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <v4-pat-enabled>N</v4-pat-enabled> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> + </v4-pat-pools> + </pat> + <nat> + <v4-nat-enabled>Y</v4-nat-enabled> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.0</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.0</v4-nat-external> + </v4-nat-mapping-entries> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.1</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.1</v4-nat-external> + </v4-nat-mapping-entries> + </nat> + <vr-designation>primary</vr-designation> + <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> + <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> + <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> + <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> + <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> + <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> + <v4-public-lan-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.2</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.72</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.68</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + </v4-public-lan-prefixes> + <v6-public-lan-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </v6-public-lan-prefixes> + </vr-lan-interface> + <routing-protocol>none</routing-protocol> + </vr-lan> +<ucpe-vms-service-information> + <transport-service-information> + <transport-service-type>AVPN</transport-service-type> + <access-circuit-info> + <access-circuit-id>1</access-circuit-id> + <dual-mode>Active</dual-mode> + </access-circuit-info> + <access-circuit-info> + <access-circuit-id>2</access-circuit-id> + <dual-mode>Standby</dual-mode> + </access-circuit-info> + </transport-service-information> + <ucpe-information> + <ucpe-host-name>hostname</ucpe-host-name> + <ucpe-activation-code>activecode</ucpe-activation-code> + <out-of-band-management-modem>OOB</out-of-band-management-modem> + </ucpe-information> + <vnf-list> + <vnf-information> + <vnf-instance-id>1</vnf-instance-id> + <vnf-sequence-number>1</vnf-sequence-number> + <vnf-type>ZZ</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL1</vnf-model> + <vnf-id>1</vnf-id> + <prov-status>1</prov-status> + <operational-state>1</operational-state> + <orchestration-status>1</orchestration-status> + <equipment-role>1</equipment-role> + </vnf-information> + <vnf-information> + <vnf-instance-id>2</vnf-instance-id> + <vnf-sequence-number>2</vnf-sequence-number> + <vnf-type>HY</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL2</vnf-model> + <vnf-id>2</vnf-id> + <prov-status>2</prov-status> + <operational-state>2</operational-state> + <orchestration-status>2</orchestration-status> + <equipment-role>2</equipment-role> + </vnf-information> + </vnf-list> + </ucpe-vms-service-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> + <source>OMX</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>https://localhost:8443/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + <internet-service-change-details> + <internet-evc-speed-value>10</internet-evc-speed-value> + <internet-evc-speed-units>Kbps</internet-evc-speed-units> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>2</request-index> + <v4-next-hop-address>192.168.1.16</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </internet-service-change-details> + </service-data> + </layer3-service-list> + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDNCAdapterRestV2Request.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDNCAdapterRestV2Request.json index 68af27db9f..ccb9587d04 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDNCAdapterRestV2Request.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDNCAdapterRestV2Request.json @@ -1,21 +1,21 @@ -{ - "SDNCServiceRequest": { - "bpNotificationUrl": "http://localhost:28080/mso/WorkflowMesssage/SDNCAResponse/a4383a52-b9de-4bc4-bedf-02f3f9466535-1510232328526", - "sdncRequestId": "a4383a52-b9de-4bc4-bedf-02f3f9466535-1510232328526", - "requestInformation": { - "requestId": "a4383a52-b9de-4bc4-bedf-02f3f9466535", - "source": "CCD", - "notificationUrl": "http://localhost:28090/CCD/StatusNotification" - }, - "serviceInformation": { - "serviceType": "vWanX", - "serviceInstanceId": "fd8bcdbb-b799-43ce-a7ff-ed8f2965a3b5", - "subscriberName": "Monster Joe's Truck & Tow", - "subscriberGlobalId": "8310000058863" - }, - "sdncService": "ucpe-vnf", - "sdncOperation": "service-topology-cust-assign-operation", - "sdncServiceDataType": "XML", - "sdncServiceData": "BT/SLIR/70901AS/KRFN/34601USOSTCDALTX0101VFWX01USOSTCDALTX0101UJZZ11WXWX-VM00*1.0.2ATTATT-VENDOR-OWNED" - } +{ + "SDNCServiceRequest": { + "bpNotificationUrl": "http://localhost:28080/mso/WorkflowMesssage/SDNCAResponse/a4383a52-b9de-4bc4-bedf-02f3f9466535-1510232328526", + "sdncRequestId": "a4383a52-b9de-4bc4-bedf-02f3f9466535-1510232328526", + "requestInformation": { + "requestId": "a4383a52-b9de-4bc4-bedf-02f3f9466535", + "source": "CCD", + "notificationUrl": "http://localhost:28090/CCD/StatusNotification" + }, + "serviceInformation": { + "serviceType": "vWanX", + "serviceInstanceId": "fd8bcdbb-b799-43ce-a7ff-ed8f2965a3b5", + "subscriberName": "Monster Joe's Truck & Tow", + "subscriberGlobalId": "8310000058863" + }, + "sdncService": "ucpe-vnf", + "sdncOperation": "service-topology-cust-assign-operation", + "sdncServiceDataType": "XML", + "sdncServiceData": "BT/SLIR/70901AS/KRFN/34601USOSTCDALTX0101VFWX01USOSTCDALTX0101UJZZ11WXWX-VM00*1.0.2ATTATT-VENDOR-OWNED" + } } \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/Schemas/CreateServiceInstanceV3Schema.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/Schemas/CreateServiceInstanceV3Schema.json new file mode 100644 index 0000000000..36b51e9575 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/Schemas/CreateServiceInstanceV3Schema.json @@ -0,0 +1,16 @@ +{ + "CreateServiceInstanceV3": { + "serviceInstance": { + "@class": "inventory.aai.onap.org.v12.ServiceInstance" + }, + "project": { + "@class": "inventory.aai.onap.org.v12.Project" + }, + "owningEntity": { + "@class": "inventory.aai.onap.org.v12.OwningEntity" + }, + "customer": { + "@class": "inventory.aai.onap.org.v12.Customer" + } + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SetupServiceDecompJson.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/SetupServiceDecompJson.json new file mode 100644 index 0000000000..a6efe9663f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SetupServiceDecompJson.json @@ -0,0 +1,36 @@ +{ + "requestDetails": { + "serviceInstance": { + "serviceInstanceId": "MSORefactorTest2", + "serviceInstanceName": "bensServiceInstance2", + "serviceType": "MSO-dev-service-type", + "serviceRole": "abc", + "modelInvariantUuid": "9647dfc4-2083-11e7-93ae-92361f002671", + "modelUuid": "5df8b6de-2083-11e7-93ae-92361f002671", + "modelVersion": "1.0", + "modelName": "MSOTADevInfra_vSAMP10a_Service", + "environmentContext": "Luna", + "workloadContext": "Oxygen", + "orchestrationStatus": "ACTIVE" + }, + "project": { + "projectName": "MSORefactorTest1234" + }, + "owningEntity": { + "owningEntityId": "MSORefactorTestId1234", + "owningEntityName": "MSORefactorTest1234" + }, + "customer": { + "subscriptionServiceType": "MSO-dev-service-type", + "globalSubscriberId": "MSO_1610_dev" + }, + "request": { + "sdncRequestId": "736c7370-640b-4f7a-975d-320f73340dd3", + "callbackURL": "abc", + "requestId": "223c2e74-a23a-4ab8-bddb-2c2431dcb67f", + "productFamilyId": "abc", + "callbackUrl": "http://localhost:8080/adapters/rest/SDNCNotify", + "serviceId": "123" + } + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/StandardSDNCSynchResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/StandardSDNCSynchResponse.xml index 919ff2c36b..77528ccf61 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/StandardSDNCSynchResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/StandardSDNCSynchResponse.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml index 07730e2df9..02996a13ea 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml @@ -42,14 +42,14 @@ org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) - org.openecomp.mso.logger.LogFilter.doFilter(LogFilter.java:35) + org.onap.so.logger.LogFilter.doFilter(LogFilter.java:35)

JBWEB000071: root cause

java.lang.NullPointerException
-				org.openecomp.mso.adapters.network.NetworkAdapterRest$CreateNetworkVolumesTask.run(NetworkAdapterRest.java:128)
-				org.openecomp.mso.adapters.network.NetworkAdapterRest.createNetwork(NetworkAdapterRest.java:64)
+				org.onap.so.adapters.network.NetworkAdapterRest$CreateNetworkVolumesTask.run(NetworkAdapterRest.java:128)
+				org.onap.so.adapters.network.NetworkAdapterRest.createNetwork(NetworkAdapterRest.java:64)
 				sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 				sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 				sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
@@ -65,7 +65,7 @@
 				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
 				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
 				javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
-				org.openecomp.mso.logger.LogFilter.doFilter(LogFilter.java:35)
+				org.onap.so.logger.LogFilter.doFilter(LogFilter.java:35)
 			

diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml index 7a00744103..0faec794b0 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml @@ -1,4 +1,4 @@ - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 c4f4e878-cde0-4b15-ae9a-bda857759cea diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml index 09f01fb7ca..ca5145c226 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml @@ -1,4 +1,4 @@ - - service-instance - https://aai-conexus-e2e.test.com:8443/aai/v8/business/customers/customer/8310000058863/service-subscriptions/service-subscription/vMOG/service-instances/service-instance/f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + service-instance + https://aai-conexus-e2e.test.com:8443/aai/v8/business/customers/customer/8310000058863/service-subscriptions/service-subscription/vMOG/service-instances/service-instance/f70e927b-6087-4974-9ef8-c5e4d5847ca4 \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml index 196558633b..99ea5bace6 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml @@ -1,73 +1,73 @@ - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - pending-create - networkName - false - true - false - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-create - true - subnetName - - - - - 413 - 4132176 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - network-policy - https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg - - network-policy.network-policy-id - cee6d136-e378-4678-a024-2cd15f0ee0cg - - - - route-table-reference - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml index 48f652cc0e..886c9b4ce2 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml @@ -1,20 +1,20 @@ - - - - - - - - - - - - - 5938baec-03ca-2bd5-a3f1-d54x123e253a - refFQDN1 - 12345 - - + + + + + + + + + + + + + 5938baec-03ca-2bd5-a3f1-d54x123e253a + refFQDN1 + 12345 + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml index c911d320ec..7509fd8625 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml @@ -1,20 +1,20 @@ - - - - - - - - - - - - - 5938baec-03ca-2bd5-a3f1-d54x123e253a - refFQDN2 - 12345 - - + + + + + + + + + + + + + 5938baec-03ca-2bd5-a3f1-d54x123e253a + refFQDN2 + 12345 + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml index 2cf94b2ef2..c9ec2f0a9d 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml @@ -1,10 +1,10 @@ + xmlns:v1="http://org.onap/workflow/sdnc/adapter/schema/v1"> - + testRequestId 200 diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml index 40bb93bda0..81e8e2a233 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml @@ -1,10 +1,10 @@ + xmlns:v1="http://org.onap/workflow/sdnc/adapter/schema/v1"> - + testRequestId 200 diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml index d3f9c1eaf3..e2db499929 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml @@ -1,21 +1,21 @@ - - - - - - - - - - - - - 9a7b327d9-287aa00-82c4b0-105757 - fqdn123 - slowburn - 145878989 - - + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + fqdn123 + slowburn + 145878989 + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml index d041565ac7..5232e530e9 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml @@ -1,4 +1,4 @@ - + DEV-VF-0011 UPDATE_VF_MODULE diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml index c159e2eae2..c86a4aaa73 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml @@ -1,38 +1,38 @@ - - skask - STMTN5MMSC20 - pcrf-capacity - SDN-MOBILITY - vPCRF - pending-create - false - false - introvert - 2.0 - 0000020 - - - lukewarm - PCRF::module-0-0 - introvert - 2.0 - true - fastburn - pending-create - 0000074 - - - supercool - PCRF::module-1-0 - extrovert - 2.0 - false - slowburn - pending-create - 0000075 - - - - - - + + skask + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + pending-create + false + false + introvert + 2.0 + 0000020 + + + lukewarm + PCRF::module-0-0 + introvert + 2.0 + true + fastburn + pending-create + 0000074 + + + supercool + PCRF::module-1-0 + extrovert + 2.0 + false + slowburn + pending-create + 0000075 + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml index 94e00427a2..f40b6bc991 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml @@ -1,21 +1,21 @@ - - - - - - - - - - - - - 9a7b327d9-287aa00-82c4b0-105757 - GN_EVPN_Test - 195159195 - 14567890 - - + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 195159195 + 14567890 + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml index 7c67095af1..dbd55b0cf4 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml @@ -1,315 +1,315 @@ - - - bd1b3789-6474-4935-94b2-90b656e035d0 - - bd1b3789-6474-4935-94b2-90b656e035d0 - - 9ddf628a-9eca-430e-8974-22d520a31be1 - assign - https://msojra.infra.aic.net:8443/adapters/rest/SDNCNotify - - - notsurewecare - bd1b3789-6474-4935-94b2-90b656e035d0 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - - - PendingCreate - - - VNN1CA52LCP - ZVNNMOGX01_base - afd0f02a-1ddb-43bb-aded-5113e46e82ae - ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 - ZVNN1MOGX01 - 33d209df14ac4c08ad60747185d2f3e0 - bd1b3789-6474-4935-94b2-90b656e035d0 - ZVNN1MOGX01 - VF AUG 1::module-0 - - - - - mog_exn - 03dbd833-785c-40c0-bf32-37594b5334bc - MNS-25180-P-VNNYCA01_exn_protected_net_1 - - - 6f82d234-41a4-48e9-a9e8-415667a72929 - - filter1 - - - filter2 - - - - mog_oam - 3f181cde-9380-4c20-9d3a-e1a4ee74f994 - MNS-25180-P-VNNYCA01_oam_protected_net_1 - - - 713b6770-13fa-4949-8dbb-a1288c5e5932 - - - mog_cor_B - 821a550a-3f50-4725-995b-f212d5caec7c - MNS-25180-P-VNNYCA01_cor_direct_net_1 - - - 18926e56-12b6-4a4d-98b6-37e0c05626ee - - - mog_cor_A - 3dabf5c0-cffb-420c-8960-8499c74eb25f - MNS-25180-P-VNNYCA01_cor_direct_net_2 - - - 35530b29-a4de-48ff-a014-111110ccc652 - - - mog_gn - 3ce97321-6e7f-49af-bd12-f833e377c310 - MNS-25180-P-VNNYCA01_gn_direct_net_1 - - - 32bfdd2c-28e1-4895-87a6-373bf12c3129 - - - mog_dmz - d43ca910-02a5-47dc-8510-100a68a3c9e0 - MNS-25180-P-VNNYCA01_dmz_protected_net_1 - - - cb9500fb-943f-412e-aea6-458711564a75 - - - nova - - - ps - - ZVNN1MOGX01MPS001 - - - ZVNN1MOGX01MPS002 - - - ZVNN1MOGX01MPS003 - - - ZVNN1MOGX01MPS004 - - 4 - - mog_cor_B - - 107.224.36.251 - - - 107.224.36.252 - - - 107.224.36.253 - - - 107.224.36.254 - - N - - - - cm - - ZVNN1MOGX01MCM001 - - - ZVNN1MOGX01OAM002 - - 1 - - mog_cor_B - - 107.224.36.249 - - - 107.224.36.250 - - N - - - mog_oam - - 107.239.167.250 - - - 107.239.167.251 - - N - - - - oam - - ZVNN1MOGX01OAM001 - - - ZVNN1MOGX01OAM002 - - 2 - - mog_oam - - 107.239.167.252 - - - 107.239.167.251 - - N - - - mog_cor_B - - 107.224.36.249 - - - 107.224.36.250 - - N - - - - pd - - ZVNN1MOGX01MPD001 - - - ZVNN1MOGX01MPD002 - - 2 - - mog_dmz - - 107.225.25.253 - - - 107.225.25.254 - - N - 107.225.254.253 - - - mog_oam - - 107.239.167.254 - - - 107.239.167.253 - - N - 107.239.167.249 - - - mog_exn - - 107.224.46.253 - - - 107.224.46.254 - - N - 107.224.46.252 - - - mog_cor_B - - 107.224.36.247 - - - 107.224.36.248 - - N - 107.224.41.252 - - - mog_gn - - 107.224.41.253 - - - 107.224.41.254 - - N - 107.224.41.252 - - - mog_cor_A - - 107.224.38.253 - - - 107.224.38.254 - - N - - - - sm - - ZVNN1MOGX01MSM001 - - - ZVNN1MOGX01MSM002 - - - ZVNN1MOGX01MSM003 - - - ZVNN1MOGX01MSM004 - - 4 - - mog_cor_B - - 107.224.36.243 - - - 107.224.36.244 - - - 107.224.36.245 - - - 107.224.36.246 - - N - - - - - ZVNNMOGX01_base - SDN-MOBILITY - ZVNN1MOGX01 - VF AUG 1::module-0 - ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 - ZVNN1MOGX01 - - - - 9ddf628a-9eca-430e-8974-22d520a31be1 - - PORTAL - VNFActivateRequest - - - - 200 - Y - synccomplete - 2016-08-05T16:15:19.398Z - vnf-topology-operation - VNFActivateRequest - assign - - - - + + + bd1b3789-6474-4935-94b2-90b656e035d0 + + bd1b3789-6474-4935-94b2-90b656e035d0 + + 9ddf628a-9eca-430e-8974-22d520a31be1 + assign + https://localhost:8443/adapters/rest/SDNCNotify + + + notsurewecare + bd1b3789-6474-4935-94b2-90b656e035d0 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + + PendingCreate + + + VNN1CA52LCP + ZVNNMOGX01_base + afd0f02a-1ddb-43bb-aded-5113e46e82ae + ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 + ZVNN1MOGX01 + 33d209df14ac4c08ad60747185d2f3e0 + bd1b3789-6474-4935-94b2-90b656e035d0 + ZVNN1MOGX01 - VF AUG 1::module-0 + + + + + mog_exn + 03dbd833-785c-40c0-bf32-37594b5334bc + MNS-25180-P-VNNYCA01_exn_protected_net_1 + + + 6f82d234-41a4-48e9-a9e8-415667a72929 + + filter1 + + + filter2 + + + + mog_oam + 3f181cde-9380-4c20-9d3a-e1a4ee74f994 + MNS-25180-P-VNNYCA01_oam_protected_net_1 + + + 713b6770-13fa-4949-8dbb-a1288c5e5932 + + + mog_cor_B + 821a550a-3f50-4725-995b-f212d5caec7c + MNS-25180-P-VNNYCA01_cor_direct_net_1 + + + 18926e56-12b6-4a4d-98b6-37e0c05626ee + + + mog_cor_A + 3dabf5c0-cffb-420c-8960-8499c74eb25f + MNS-25180-P-VNNYCA01_cor_direct_net_2 + + + 35530b29-a4de-48ff-a014-111110ccc652 + + + mog_gn + 3ce97321-6e7f-49af-bd12-f833e377c310 + MNS-25180-P-VNNYCA01_gn_direct_net_1 + + + 32bfdd2c-28e1-4895-87a6-373bf12c3129 + + + mog_dmz + d43ca910-02a5-47dc-8510-100a68a3c9e0 + MNS-25180-P-VNNYCA01_dmz_protected_net_1 + + + cb9500fb-943f-412e-aea6-458711564a75 + + + nova + + + ps + + ZVNN1MOGX01MPS001 + + + ZVNN1MOGX01MPS002 + + + ZVNN1MOGX01MPS003 + + + ZVNN1MOGX01MPS004 + + 4 + + mog_cor_B + + 107.224.36.251 + + + 107.224.36.252 + + + 107.224.36.253 + + + 107.224.36.254 + + N + + + + cm + + ZVNN1MOGX01MCM001 + + + ZVNN1MOGX01OAM002 + + 1 + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + N + + + mog_oam + + 107.239.167.250 + + + 107.239.167.251 + + N + + + + oam + + ZVNN1MOGX01OAM001 + + + ZVNN1MOGX01OAM002 + + 2 + + mog_oam + + 107.239.167.252 + + + 107.239.167.251 + + N + + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + N + + + + pd + + ZVNN1MOGX01MPD001 + + + ZVNN1MOGX01MPD002 + + 2 + + mog_dmz + + 107.225.25.253 + + + 107.225.25.254 + + N + 107.225.254.253 + + + mog_oam + + 107.239.167.254 + + + 107.239.167.253 + + N + 107.239.167.249 + + + mog_exn + + 107.224.46.253 + + + 107.224.46.254 + + N + 107.224.46.252 + + + mog_cor_B + + 107.224.36.247 + + + 107.224.36.248 + + N + 107.224.41.252 + + + mog_gn + + 107.224.41.253 + + + 107.224.41.254 + + N + 107.224.41.252 + + + mog_cor_A + + 107.224.38.253 + + + 107.224.38.254 + + N + + + + sm + + ZVNN1MOGX01MSM001 + + + ZVNN1MOGX01MSM002 + + + ZVNN1MOGX01MSM003 + + + ZVNN1MOGX01MSM004 + + 4 + + mog_cor_B + + 107.224.36.243 + + + 107.224.36.244 + + + 107.224.36.245 + + + 107.224.36.246 + + N + + + + + ZVNNMOGX01_base + SDN-MOBILITY + ZVNN1MOGX01 - VF AUG 1::module-0 + ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 + ZVNN1MOGX01 + + + + 9ddf628a-9eca-430e-8974-22d520a31be1 + + PORTAL + VNFActivateRequest + + + + 200 + Y + synccomplete + 2016-08-05T16:15:19.398Z + vnf-topology-operation + VNFActivateRequest + assign + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml index 9b69fdc053..e8a69da0f8 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml @@ -1,141 +1,141 @@ - - - 28455973-1ee5-4ad1-8d35-c4732679743a - - 200 - Y - synccomplete - 2016-06-08T19:44:59.138Z - vnf-topology-operation - VNFActivateRequest - assign - - - 28455973-1ee5-4ad1-8d35-c4732679743 - - notsurewecare - 28455973-1ee5-4ad1-8d35-c4732679743a - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - - - 5e168556-a5c6-4813-bff3-cc03007afbbc - http://mtanjv9moja01-eth1-0.aic.cip.com:28080/adapters/rest/SDNCNotify - assign - - - AAIAIC25 - MSOTEST06-vSAMP3::base::module-0 - 91ad7ab0-9ffd-471d-971c-3eb913a2cc75 - Test/vSAMP3 1 - MSOTEST06 - 4ae1d3446a4c48b2bec44b6cfba06d68 - 28455973-1ee5-4ad1-8d35-c4732679743a - vSAMP3::base::module-0 - - - PendingCreate - - - - image - Ubuntu_Perf - - - flavor - m1.small - - - - int_imbl - 680b7453-0ec4-4d96-b355-280d981d418f - Nimbus-25193-T-Willows2_int_imbl_net_1 - default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_int_imbl_net_1 - - 775607fb-e16a-45ef-94a7-82fba0d16eec - 640d07fb-e16a-45ef-94a7-82fba0d169bf - - filter1 - - - filter2 - - - - sgi_protected - f9039ce9-e3cf-4716-b2d1-ec7912178ea4 - Nimbus-25193-T-Willows2_sgi_protected_net_1 - default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_sgi_protected_net_1 - b9999ce9-e3cf-4716-b2d1-ec791217678c - - bf11bba8-b971-4ab5-8281-215b3fedcd3c - - - cm - - ZVNN1MOGX01MCM001 - - - ZVNN1MOGX01OAM002 - - 1 - - mog_cor_B - - 107.224.36.249 - - - 107.224.36.250 - - - 2606:ae00:2e01:800::67 - - N - 107.224.41.252 - 2001:1890:1001:2B32::29:C - - - mog_oam - - 107.239.167.250 - - - 107.239.167.251 - - - aa::aa::aa::aa::aa::aa - - - bb::bb::bb::bb::bb::bb - - - 1.2.3.4/26 - - - 2002::/64 - - N - 1111:1890:1001:2B32::29:D - - - - nova - - - - MSOTEST06-vSAMP3::base::module-0 - SDN-MOBILITY - vSAMP3::base::module-0 - Test/vSAMP3 1 - MSOTEST06 - - - - 5e168556-a5c6-4813-bff3-cc03007afbbc - - SoapUI-bns-vf-base-vSAMP3-9001 - VNFActivateRequest - - - - + + + 28455973-1ee5-4ad1-8d35-c4732679743a + + 200 + Y + synccomplete + 2016-06-08T19:44:59.138Z + vnf-topology-operation + VNFActivateRequest + assign + + + 28455973-1ee5-4ad1-8d35-c4732679743 + + notsurewecare + 28455973-1ee5-4ad1-8d35-c4732679743a + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + + 5e168556-a5c6-4813-bff3-cc03007afbbc + http://localhost:28080/adapters/rest/SDNCNotify + assign + + + AAIAIC25 + MSOTEST06-vSAMP3::base::module-0 + 91ad7ab0-9ffd-471d-971c-3eb913a2cc75 + Test/vSAMP3 1 + MSOTEST06 + 4ae1d3446a4c48b2bec44b6cfba06d68 + 28455973-1ee5-4ad1-8d35-c4732679743a + vSAMP3::base::module-0 + + + PendingCreate + + + + image + Ubuntu_Perf + + + flavor + m1.small + + + + int_imbl + 680b7453-0ec4-4d96-b355-280d981d418f + Nimbus-25193-T-Willows2_int_imbl_net_1 + default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_int_imbl_net_1 + + 775607fb-e16a-45ef-94a7-82fba0d16eec + 640d07fb-e16a-45ef-94a7-82fba0d169bf + + filter1 + + + filter2 + + + + sgi_protected + f9039ce9-e3cf-4716-b2d1-ec7912178ea4 + Nimbus-25193-T-Willows2_sgi_protected_net_1 + default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_sgi_protected_net_1 + b9999ce9-e3cf-4716-b2d1-ec791217678c + + bf11bba8-b971-4ab5-8281-215b3fedcd3c + + + cm + + ZVNN1MOGX01MCM001 + + + ZVNN1MOGX01OAM002 + + 1 + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + + 2606:ae00:2e01:800::67 + + N + 107.224.41.252 + 2001:1890:1001:2B32::29:C + + + mog_oam + + 107.239.167.250 + + + 107.239.167.251 + + + aa::aa::aa::aa::aa::aa + + + bb::bb::bb::bb::bb::bb + + + 1.2.3.4/26 + + + 2002::/64 + + N + 1111:1890:1001:2B32::29:D + + + + nova + + + + MSOTEST06-vSAMP3::base::module-0 + SDN-MOBILITY + vSAMP3::base::module-0 + Test/vSAMP3 1 + MSOTEST06 + + + + 5e168556-a5c6-4813-bff3-cc03007afbbc + + SoapUI-bns-vf-base-vSAMP3-9001 + VNFActivateRequest + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml index 919ff2c36b..77528ccf61 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml index 7b72812f1a..8a690403c4 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml @@ -1,10 +1,10 @@ - - skask - supercool - slowburn - complete - 78987 - introvert - 3.14 - myhost.appl.com + + skask + supercool + slowburn + complete + 78987 + introvert + 3.14 + myhost.appl.com \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml index 966ca50b16..0dc1b1d410 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml @@ -1,4 +1,4 @@ - + DEV-VF-0011 UPDATE_VF_MODULE diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml index cfbf903ce9..b882c4c6f4 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml @@ -1,10 +1,10 @@ - - lukewarm - PCRF::module-1 - slowburn - pending-create - true - 330-90 - introvert - 2.0 + + lukewarm + PCRF::module-1 + slowburn + pending-create + true + 330-90 + introvert + 2.0 \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml index 27c8ecf60a..3b8bea4e4e 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml @@ -1,9 +1,9 @@ - - b37d96db-7d2c-47ce-bf61-a6c7b82fe161 - PCRF::module-0-2 - 00000000-0000-0000-0000-000000000000 - 1.0 - false - pending-create - 330-90 + + b37d96db-7d2c-47ce-bf61-a6c7b82fe161 + PCRF::module-0-2 + 00000000-0000-0000-0000-000000000000 + 1.0 + false + pending-create + 330-90 \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml index ee09c9bc4a..5a2b7300b1 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml @@ -1,27 +1,27 @@ - - supercool - PCRF::module-2 - fastburn - pending-create - false - 330-89 - introvert - 2.0 - - - volume-group - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - pdk1 - - - volume-group.volume-group-id - 78987 - - - + + supercool + PCRF::module-2 + fastburn + pending-create + false + 330-89 + introvert + 2.0 + + + volume-group + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + pdk1 + + + volume-group.volume-group-id + 78987 + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml index b44c977eaf..7e913dd418 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml @@ -1,25 +1,25 @@ - - 78987 - Volume_2 - slowburn - pcrf-capacity - Active - 0000020 - - - tenant - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - MDTWNJ21 - - - tenant.tenant-id - fba1bd1e195a404cacb9ce17a9b2b421 - - - + + 78987 + Volume_2 + slowburn + pcrf-capacity + Active + 0000020 + + + tenant + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + MDTWNJ21 + + + tenant.tenant-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml index 396f553b60..4167e2e87d 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml @@ -1,28 +1,28 @@ - - - VOLUME_GROUP_ID_1 - VOLUME_GROUP_ID_1_NAME - heat-stack-id - vnf-type - OK - 1 - - - tenant - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - pdk1 - - - tenant.tenant-id - cee6d136-e378-4678-a024-2cd15f0ee0cg - - - - - - + + + VOLUME_GROUP_ID_1 + VOLUME_GROUP_ID_1_NAME + heat-stack-id + vnf-type + OK + 1 + + + tenant + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + pdk1 + + + tenant.tenant-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/e2e-complex.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/e2e-complex.json index 6fc9cb36e6..21bacbd5ce 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/e2e-complex.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/e2e-complex.json @@ -24,7 +24,7 @@ "relationship": [ { "related-to": "vpls-pe", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vpls-pes/vpls-pe/sfcca301vr1", + "related-link": "https://localhost:8443/aai/v9/network/vpls-pes/vpls-pe/sfcca301vr1", "relationship-data": [ { "relationship-key": "vpls-pe.equipment-name", @@ -48,7 +48,7 @@ "relationship": [ { "related-to": "vce", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", + "related-link": "https://localhost:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", "relationship-data": [ { "relationship-key": "vce.vnf-id", @@ -64,7 +64,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj104snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj104snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -79,7 +79,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj105snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj105snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -94,7 +94,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/compute_host", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/compute_host", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -109,7 +109,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj106snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj106snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -124,7 +124,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj126sd9", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj126sd9", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -139,7 +139,7 @@ }, { "related-to": "vce", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/8ae1e5f8-61f1-4c71-913a-b40cc4593cb9", + "related-link": "https://localhost:8443/aai/v9/network/vces/vce/8ae1e5f8-61f1-4c71-913a-b40cc4593cb9", "relationship-data": [ { "relationship-key": "vce.vnf-id", @@ -155,7 +155,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj102sta", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj102sta", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -170,7 +170,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnjtax102", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnjtax102", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -185,7 +185,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj107snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj107snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -200,7 +200,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj118snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj118snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -215,7 +215,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj110snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj110snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -230,7 +230,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj109snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj109snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -245,7 +245,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj114snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj114snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -260,7 +260,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj119snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj119snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -275,7 +275,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj116snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj116snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -290,7 +290,7 @@ }, { "related-to": "vce", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/a2935fa9-b743-49f4-9813-a127f13c4e93", + "related-link": "https://localhost:8443/aai/v9/network/vces/vce/a2935fa9-b743-49f4-9813-a127f13c4e93", "relationship-data": [ { "relationship-key": "vce.vnf-id", @@ -306,7 +306,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj108snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj108snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -321,7 +321,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj123sd9", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj123sd9", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -336,7 +336,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj101snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj101snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -351,7 +351,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj102snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj102snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -366,7 +366,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnjtax101", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnjtax101", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -381,7 +381,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj113snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj113snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -396,7 +396,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj111snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj111snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -411,7 +411,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj103snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj103snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -426,7 +426,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj117snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj117snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -441,7 +441,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj101sta", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj101sta", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -456,7 +456,7 @@ }, { "related-to": "vce", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/c7fe7698-8063-4e26-8bd3-ca3edde0b0d4", + "related-link": "https://localhost:8443/aai/v9/network/vces/vce/c7fe7698-8063-4e26-8bd3-ca3edde0b0d4", "relationship-data": [ { "relationship-key": "vce.vnf-id", @@ -472,7 +472,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj120snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj120snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -487,7 +487,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj124sd9", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj124sd9", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -502,7 +502,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj125sd9", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj125sd9", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -517,7 +517,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj112snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj112snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -532,7 +532,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj115snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj115snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -547,7 +547,7 @@ }, { "related-to": "cloud-region", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtcnj2", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtcnj2", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", @@ -567,7 +567,7 @@ }, { "related-to": "oam-network", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/f9263cat-4eaa-43a0-bea4-adcf6e123456", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/f9263cat-4eaa-43a0-bea4-adcf6e123456", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", @@ -591,7 +591,7 @@ }, { "related-to": "oam-network", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/b9263fab-4eaa-43a0-bea4-adcf6e999999", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/b9263fab-4eaa-43a0-bea4-adcf6e999999", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", @@ -615,7 +615,7 @@ }, { "related-to": "oam-network", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/cf33dc95-c5d2-48fd-8078-fd949363f63b", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/cf33dc95-c5d2-48fd-8078-fd949363f63b", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", @@ -639,7 +639,7 @@ }, { "related-to": "availability-zone", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/availability-zones/availability-zone/mtcnj-esx-az01", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/availability-zones/availability-zone/mtcnj-esx-az01", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/service-instance-pathed-query.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/service-instance-pathed-query.json index 6ec513e4bb..0fa9515820 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/service-instance-pathed-query.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/service-instance-pathed-query.json @@ -2,7 +2,7 @@ "results": [ { "resource-type": "service-instance", - "resource-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3" + "resource-link": "https://localhost:8443/aai/v9/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3" } ] } \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/catalogDbFiles/DoCreateServiceInstance_request.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/catalogDbFiles/DoCreateServiceInstance_request.json new file mode 100644 index 0000000000..c135923f84 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/catalogDbFiles/DoCreateServiceInstance_request.json @@ -0,0 +1,162 @@ +{ "serviceResources" : { + "modelInfo" : { + "modelName" : "MSOTADevInfra_vSAMP10a_Service", + "modelUuid" : "5df8b6de-2083-11e7-93ae-92361f002671", + "modelInvariantUuid" : "9647dfc4-2083-11e7-93ae-92361f002671", + "modelVersion" : "1.0" + }, + "serviceType" : "PortMirroring", + "serviceRole" : "InfraRole", + "environmentContext" : "Luna", + "workloadContext" : "Oxygen", + "serviceVnfs": [ + + { "modelInfo" : { + "modelName" : "vSAMP10a", + "modelUuid" : "ff2ae348-214a-11e7-93ae-92361f002671", + "modelInvariantUuid" : "2fff5b20-214b-11e7-93ae-92361f002671", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "68dc9a92-214c-11e7-93ae-92361f002671", + "modelInstanceName" : "vSAMP10a 1" + }, + "toscaNodeType" : "VF", + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null, + "multiStageDesign" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "NetworkFqdnTest4", + "modelUuid" : "025606c1-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba01a", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba01a" + }, "isBase" : true, + "vfModuleLabel" : "label", + "initialCount" : 0, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "NetworkFqdnTest3", + "modelUuid" : "02560575-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba0bb", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba0bb" + }, "isBase" : true, + "vfModuleLabel" : "label", + "initialCount" : 0, + "hasVolumeGroup" : false + }, + { + "modelInfo" : { + "modelName" : "NetworkFqdnTest5", + "modelUuid" : "025607e4-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : "06bd0a18-65c0-4418-83c7-5b0d14cba01a", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "06bd0a18-65c0-4418-83c7-5b0d14cba01a" + }, "isBase" : false, + "vfModuleLabel" : "label", + "initialCount" : 0, + "hasVolumeGroup" : false + }, + { + "modelInfo" : { + "modelName" : "vSAMP10aDEV::PCM::module-2", + "modelUuid" : "7774b4e4-7d37-11e7-bb31-be2e44b06b34", + "modelInvariantUuid" : "93e9c1d2-7d37-11e7-bb31-be2e44b06b34", + "modelVersion" : "2", + "modelCustomizationUuid" : "6728bee8-7d3a-11e7-bb31-be2e44b06b34" + }, "isBase" : false, + "vfModuleLabel" : "PCM", + "initialCount" : 0, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "vSAMP10aDEV::PCM::module-1", + "modelUuid" : "066de97e-253e-11e7-93ae-92361f002671", + "modelInvariantUuid" : "64efd51a-2544-11e7-93ae-92361f002671", + "modelVersion" : "2", + "modelCustomizationUuid" : "b4ea86b4-253f-11e7-93ae-92361f002671" + }, "isBase" : false, + "vfModuleLabel" : "PCM", + "initialCount" : 0, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "vSAMP10aDEV::base::module-0", + "modelUuid" : "20c4431c-246d-11e7-93ae-92361f002671", + "modelInvariantUuid" : "78ca26d0-246d-11e7-93ae-92361f002671", + "modelVersion" : "2", + "modelCustomizationUuid" : "cb82ffd8-252a-11e7-93ae-92361f002671" + }, "isBase" : true, + "vfModuleLabel" : "base", + "initialCount" : 1, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "vSAMP10a::base::module-0", + "modelUuid" : "02560de2-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : null, + "modelVersion" : "2", + "modelCustomizationUuid" : "MIGRATED_36e76920-ef30-4793-9979-cbd7d4b2bfc4" + }, "isBase" : true, + "vfModuleLabel" : "base", + "initialCount" : 1, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "base::module-0", + "modelUuid" : "02561381-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : null, + "modelVersion" : "1", + "modelCustomizationUuid" : "MIGRATED_51baae4c-b7c7-4f57-b77e-6e01acca89e5" + }, "isBase" : true, + "vfModuleLabel" : "module-0", + "initialCount" : 1, + "hasVolumeGroup" : false + }, + { + "modelInfo" : { + "modelName" : "vSAMP10a::PCM::module-1", + "modelUuid" : "02560f1b-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : null, + "modelVersion" : "1", + "modelCustomizationUuid" : "MIGRATED_e9be2ed7-45b6-479c-b06e-9093899f8ce8" + }, "isBase" : true, + "vfModuleLabel" : "PCM", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ], + "serviceNetworks": [], + "serviceAllottedResources": [ + { + "modelInfo" : { + "modelName" : "Tunnel_Xconn", + "modelUuid" : "f6b7d4c6-e8a4-46e2-81bc-31cad5072842", + "modelInvariantUuid" : "b7a1b78e-6b6b-4b36-9698-8c9530da14af", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "5b9bee43-f537-4fb3-9e8b-4de9f714d28a", + "modelInstanceName" : "Pri_Tunnel_Xconn 9" + }, + "toscaNodeType" : null, + "allottedResourceType" : null, + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + } + ] + }} + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/getCatalogServiceResourcesDataWithConfig.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/getCatalogServiceResourcesDataWithConfig.json index 610965038f..b408af8f2c 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/getCatalogServiceResourcesDataWithConfig.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/getCatalogServiceResourcesDataWithConfig.json @@ -1,182 +1,182 @@ -{ - "serviceResources": { - "modelInfo": { - "modelName": "MSOTADevInfra_vSAMP10a_Service", - "modelUuid": "5df8b6de-2083-11e7-93ae-92361f002671", - "modelInvariantUuid": "9647dfc4-2083-11e7-93ae-92361f002671", - "modelVersion": "1.0" - }, - "serviceType": "PortMirroring", - "serviceRole": "InfraRole", - "serviceVnfs": [ - { - "modelInfo": { - "modelName": "vSAMP10a", - "modelUuid": "ff2ae348-214a-11e7-93ae-92361f002671", - "modelInvariantUuid": "2fff5b20-214b-11e7-93ae-92361f002671", - "modelVersion": "1.0", - "modelCustomizationUuid": "68dc9a92-214c-11e7-93ae-92361f002671", - "modelInstanceName": "vSAMP10a 1" - }, - "toscaNodeType": "VF", - "nfFunction": null, - "nfType": null, - "nfRole": null, - "nfNamingCode": null, - "vfModules": [ - { - "modelInfo": { - "modelName": "NetworkFqdnTest4", - "modelUuid": "025606c1-4223-11e7-9252-005056850d2e", - "modelInvariantUuid": "06bd0a18-65c0-4418-83c7-5b0d13cba01a", - "modelVersion": "2.0", - "modelCustomizationUuid": "06bd0a18-65c0-4418-83c7-5b0d13cba01a" - }, - "isBase": true, - "vfModuleLabel": "label", - "initialCount": 0, - "hasVolumeGroup": true - }, - { - "modelInfo": { - "modelName": "NetworkFqdnTest3", - "modelUuid": "02560575-4223-11e7-9252-005056850d2e", - "modelInvariantUuid": "06bd0a18-65c0-4418-83c7-5b0d13cba0bb", - "modelVersion": "1.0", - "modelCustomizationUuid": "06bd0a18-65c0-4418-83c7-5b0d13cba0bb" - }, - "isBase": true, - "vfModuleLabel": "label", - "initialCount": 0, - "hasVolumeGroup": false - }, - { - "modelInfo": { - "modelName": "NetworkFqdnTest5", - "modelUuid": "025607e4-4223-11e7-9252-005056850d2e", - "modelInvariantUuid": "06bd0a18-65c0-4418-83c7-5b0d14cba01a", - "modelVersion": "1.0", - "modelCustomizationUuid": "06bd0a18-65c0-4418-83c7-5b0d14cba01a" - }, - "isBase": false, - "vfModuleLabel": "label", - "initialCount": 0, - "hasVolumeGroup": false - }, - { - "modelInfo": { - "modelName": "vSAMP10aDEV::PCM::module-2", - "modelUuid": "7774b4e4-7d37-11e7-bb31-be2e44b06b34", - "modelInvariantUuid": "93e9c1d2-7d37-11e7-bb31-be2e44b06b34", - "modelVersion": "2", - "modelCustomizationUuid": "6728bee8-7d3a-11e7-bb31-be2e44b06b34" - }, - "isBase": false, - "vfModuleLabel": "PCM", - "initialCount": 0, - "hasVolumeGroup": true - }, - { - "modelInfo": { - "modelName": "vSAMP10aDEV::PCM::module-1", - "modelUuid": "066de97e-253e-11e7-93ae-92361f002671", - "modelInvariantUuid": "64efd51a-2544-11e7-93ae-92361f002671", - "modelVersion": "2", - "modelCustomizationUuid": "b4ea86b4-253f-11e7-93ae-92361f002671" - }, - "isBase": false, - "vfModuleLabel": "PCM", - "initialCount": 0, - "hasVolumeGroup": true - }, - { - "modelInfo": { - "modelName": "vSAMP10aDEV::base::module-0", - "modelUuid": "20c4431c-246d-11e7-93ae-92361f002671", - "modelInvariantUuid": "78ca26d0-246d-11e7-93ae-92361f002671", - "modelVersion": "2", - "modelCustomizationUuid": "cb82ffd8-252a-11e7-93ae-92361f002671" - }, - "isBase": true, - "vfModuleLabel": "base", - "initialCount": 1, - "hasVolumeGroup": true - }, - { - "modelInfo": { - "modelName": "vSAMP10a::base::module-0", - "modelUuid": "02560de2-4223-11e7-9252-005056850d2e", - "modelInvariantUuid": null, - "modelVersion": "2", - "modelCustomizationUuid": "MIGRATED_36e76920-ef30-4793-9979-cbd7d4b2bfc4" - }, - "isBase": true, - "vfModuleLabel": "base", - "initialCount": 1, - "hasVolumeGroup": true - }, - { - "modelInfo": { - "modelName": "base::module-0", - "modelUuid": "02561381-4223-11e7-9252-005056850d2e", - "modelInvariantUuid": null, - "modelVersion": "1", - "modelCustomizationUuid": "MIGRATED_51baae4c-b7c7-4f57-b77e-6e01acca89e5" - }, - "isBase": true, - "vfModuleLabel": "module-0", - "initialCount": 1, - "hasVolumeGroup": false - }, - { - "modelInfo": { - "modelName": "vSAMP10a::PCM::module-1", - "modelUuid": "02560f1b-4223-11e7-9252-005056850d2e", - "modelInvariantUuid": null, - "modelVersion": "1", - "modelCustomizationUuid": "MIGRATED_e9be2ed7-45b6-479c-b06e-9093899f8ce8" - }, - "isBase": true, - "vfModuleLabel": "PCM", - "initialCount": 1, - "hasVolumeGroup": true - } - ] - } - ], - "serviceNetworks": [], - "serviceAllottedResources": [ - { - "modelInfo": { - "modelName": "Tunnel_Xconn", - "modelUuid": "f6b7d4c6-e8a4-46e2-81bc-31cad5072842", - "modelInvariantUuid": "b7a1b78e-6b6b-4b36-9698-8c9530da14af", - "modelVersion": "1.0", - "modelCustomizationUuid": "5b9bee43-f537-4fb3-9e8b-4de9f714d28a", - "modelInstanceName": "Pri_Tunnel_Xconn 9" - }, - "toscaNodeType": null, - "allottedResourceType": null, - "allottedResourceRole": null, - "providingServiceModelInvariantUuid": null, - "nfFunction": null, - "nfType": null, - "nfRole": null, - "nfNamingCode": null - } - ], - "serviceConfigs": [ - { - "modelInfo": { - "modelName": "Molder", - "modelUuid": "025606c1-4fff-11e7-9252-005056850d2e", - "modelInvariantUuid": "025606c1-4eee-11e7-9252-005056850d2e", - "modelVersion": "1.0", - "modelCustomizationUuid": "025606c1-4ddd-11e7-9252-005056850d2e", - "modelInstanceName": "X_FILES_001" - }, - "toscaNodeType": "Scully" - } - ] - } +{ + "serviceResources": { + "modelInfo": { + "modelName": "MSOTADevInfra_vSAMP10a_Service", + "modelUuid": "5df8b6de-2083-11e7-93ae-92361f002671", + "modelInvariantUuid": "9647dfc4-2083-11e7-93ae-92361f002671", + "modelVersion": "1.0" + }, + "serviceType": "PortMirroring", + "serviceRole": "InfraRole", + "serviceVnfs": [ + { + "modelInfo": { + "modelName": "vSAMP10a", + "modelUuid": "ff2ae348-214a-11e7-93ae-92361f002671", + "modelInvariantUuid": "2fff5b20-214b-11e7-93ae-92361f002671", + "modelVersion": "1.0", + "modelCustomizationUuid": "68dc9a92-214c-11e7-93ae-92361f002671", + "modelInstanceName": "vSAMP10a 1" + }, + "toscaNodeType": "VF", + "nfFunction": null, + "nfType": null, + "nfRole": null, + "nfNamingCode": null, + "vfModules": [ + { + "modelInfo": { + "modelName": "NetworkFqdnTest4", + "modelUuid": "025606c1-4223-11e7-9252-005056850d2e", + "modelInvariantUuid": "06bd0a18-65c0-4418-83c7-5b0d13cba01a", + "modelVersion": "2.0", + "modelCustomizationUuid": "06bd0a18-65c0-4418-83c7-5b0d13cba01a" + }, + "isBase": true, + "vfModuleLabel": "label", + "initialCount": 0, + "hasVolumeGroup": true + }, + { + "modelInfo": { + "modelName": "NetworkFqdnTest3", + "modelUuid": "02560575-4223-11e7-9252-005056850d2e", + "modelInvariantUuid": "06bd0a18-65c0-4418-83c7-5b0d13cba0bb", + "modelVersion": "1.0", + "modelCustomizationUuid": "06bd0a18-65c0-4418-83c7-5b0d13cba0bb" + }, + "isBase": true, + "vfModuleLabel": "label", + "initialCount": 0, + "hasVolumeGroup": false + }, + { + "modelInfo": { + "modelName": "NetworkFqdnTest5", + "modelUuid": "025607e4-4223-11e7-9252-005056850d2e", + "modelInvariantUuid": "06bd0a18-65c0-4418-83c7-5b0d14cba01a", + "modelVersion": "1.0", + "modelCustomizationUuid": "06bd0a18-65c0-4418-83c7-5b0d14cba01a" + }, + "isBase": false, + "vfModuleLabel": "label", + "initialCount": 0, + "hasVolumeGroup": false + }, + { + "modelInfo": { + "modelName": "vSAMP10aDEV::PCM::module-2", + "modelUuid": "7774b4e4-7d37-11e7-bb31-be2e44b06b34", + "modelInvariantUuid": "93e9c1d2-7d37-11e7-bb31-be2e44b06b34", + "modelVersion": "2", + "modelCustomizationUuid": "6728bee8-7d3a-11e7-bb31-be2e44b06b34" + }, + "isBase": false, + "vfModuleLabel": "PCM", + "initialCount": 0, + "hasVolumeGroup": true + }, + { + "modelInfo": { + "modelName": "vSAMP10aDEV::PCM::module-1", + "modelUuid": "066de97e-253e-11e7-93ae-92361f002671", + "modelInvariantUuid": "64efd51a-2544-11e7-93ae-92361f002671", + "modelVersion": "2", + "modelCustomizationUuid": "b4ea86b4-253f-11e7-93ae-92361f002671" + }, + "isBase": false, + "vfModuleLabel": "PCM", + "initialCount": 0, + "hasVolumeGroup": true + }, + { + "modelInfo": { + "modelName": "vSAMP10aDEV::base::module-0", + "modelUuid": "20c4431c-246d-11e7-93ae-92361f002671", + "modelInvariantUuid": "78ca26d0-246d-11e7-93ae-92361f002671", + "modelVersion": "2", + "modelCustomizationUuid": "cb82ffd8-252a-11e7-93ae-92361f002671" + }, + "isBase": true, + "vfModuleLabel": "base", + "initialCount": 1, + "hasVolumeGroup": true + }, + { + "modelInfo": { + "modelName": "vSAMP10a::base::module-0", + "modelUuid": "02560de2-4223-11e7-9252-005056850d2e", + "modelInvariantUuid": null, + "modelVersion": "2", + "modelCustomizationUuid": "MIGRATED_36e76920-ef30-4793-9979-cbd7d4b2bfc4" + }, + "isBase": true, + "vfModuleLabel": "base", + "initialCount": 1, + "hasVolumeGroup": true + }, + { + "modelInfo": { + "modelName": "base::module-0", + "modelUuid": "02561381-4223-11e7-9252-005056850d2e", + "modelInvariantUuid": null, + "modelVersion": "1", + "modelCustomizationUuid": "MIGRATED_51baae4c-b7c7-4f57-b77e-6e01acca89e5" + }, + "isBase": true, + "vfModuleLabel": "module-0", + "initialCount": 1, + "hasVolumeGroup": false + }, + { + "modelInfo": { + "modelName": "vSAMP10a::PCM::module-1", + "modelUuid": "02560f1b-4223-11e7-9252-005056850d2e", + "modelInvariantUuid": null, + "modelVersion": "1", + "modelCustomizationUuid": "MIGRATED_e9be2ed7-45b6-479c-b06e-9093899f8ce8" + }, + "isBase": true, + "vfModuleLabel": "PCM", + "initialCount": 1, + "hasVolumeGroup": true + } + ] + } + ], + "serviceNetworks": [], + "serviceAllottedResources": [ + { + "modelInfo": { + "modelName": "Tunnel_Xconn", + "modelUuid": "f6b7d4c6-e8a4-46e2-81bc-31cad5072842", + "modelInvariantUuid": "b7a1b78e-6b6b-4b36-9698-8c9530da14af", + "modelVersion": "1.0", + "modelCustomizationUuid": "5b9bee43-f537-4fb3-9e8b-4de9f714d28a", + "modelInstanceName": "Pri_Tunnel_Xconn 9" + }, + "toscaNodeType": null, + "allottedResourceType": null, + "allottedResourceRole": null, + "providingServiceModelInvariantUuid": null, + "nfFunction": null, + "nfType": null, + "nfRole": null, + "nfNamingCode": null + } + ], + "serviceConfigs": [ + { + "modelInfo": { + "modelName": "Molder", + "modelUuid": "025606c1-4fff-11e7-9252-005056850d2e", + "modelInvariantUuid": "025606c1-4eee-11e7-9252-005056850d2e", + "modelVersion": "1.0", + "modelCustomizationUuid": "025606c1-4ddd-11e7-9252-005056850d2e", + "modelInstanceName": "X_FILES_001" + }, + "toscaNodeType": "Scully" + } + ] + } } \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/invalidErrorMessage.txt b/bpmn/MSOCommonBPMN/src/test/resources/__files/invalidErrorMessage.txt new file mode 100644 index 0000000000..d28b8f9920 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/invalidErrorMessage.txt @@ -0,0 +1 @@ +{"messageId":"43b634ca-903f-47bb-8ef9-5ceb9f1b04bd","message":"0 : Stack error (CREATE_FAILED): Resource CREATE failed: Exception: resources.network: HTTP Status: 500 Content:

Traceback (most recent call last):\n  File \"/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_api_server.py\", line 622, in http_resource_create\n    ok, result = stateful_create()\n  File \"/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_api_server.py\", line 566, in stateful_create\n    tenant_name, obj_dict, db_conn)\n  File \"/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_types.py\", line 1463, in pre_dbe_create\n    vn_uuid)\n  File \"/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_types.py\", line 1396, in _check_ipam_network_subnets\n    (ok, result) = cls.addr_mgmt.net_check_subnet(ipam_subnets)\n  File \"/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_addr_mgmt.py\", line 987, in net_check_subnet\n    network = IPNetwork('%s/%s' % (prefix, prefix_len))\n  File \"/usr/lib/python2.7/dist-packages/netaddr/ip/__init__.py\", line 933, in __init__\n    raise AddrFormatError('invalid IPNetwork %s' % addr)\nAddrFormatError: invalid IPNetwork /0\n
\n","category":"INTERNAL","rolledBack":true} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/invalidErrorMessageFlag.txt b/bpmn/MSOCommonBPMN/src/test/resources/__files/invalidErrorMessageFlag.txt new file mode 100644 index 0000000000..9eef2b4a48 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/invalidErrorMessageFlag.txt @@ -0,0 +1 @@ +{ %1$d Two: %2$d, # '-' /# } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/requestDetails.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/requestDetails.json new file mode 100644 index 0000000000..76616e14a5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/requestDetails.json @@ -0,0 +1,37 @@ +{ + "requestDetails": { + "project": { + "projectName": "vSAMP12 Project" + }, + "owningEntity": { + "owningEntityId": "MSO-Test-OE", + "owningEntityName": "MSO-Test123" + }, + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "d214abcc-2083-11e7-93ae-92361f002671", + "modelUuid": "c4503baa-2083-11e7-93ae-92361f002671", + "modelName": "MSOTADevInfra_vSAMP12_Service", + "modelVersion": "1.0" + }, + "subscriberInfo": { + "globalSubscriberId": "MSO_1610_dev", + "subscriberName": "MSO_1610_dev" + }, + "requestInfo": { + "instanceName": "bensServiceInstance3", + "source": "VID", + "suppressRollback": "true", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "8b1df54faa3b49078e3416e21370a3ba" + }, + "requestParameters": { + "subscriptionServiceType": "MSO-dev-service-type", + "aLaCarte": "false", + "userParams": [] + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/schema.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/schema.json new file mode 100644 index 0000000000..36b51e9575 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/schema.json @@ -0,0 +1,16 @@ +{ + "CreateServiceInstanceV3": { + "serviceInstance": { + "@class": "inventory.aai.onap.org.v12.ServiceInstance" + }, + "project": { + "@class": "inventory.aai.onap.org.v12.Project" + }, + "owningEntity": { + "@class": "inventory.aai.onap.org.v12.OwningEntity" + }, + "customer": { + "@class": "inventory.aai.onap.org.v12.Customer" + } + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/sdncCallbackSoapWrapper.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/sdncCallbackSoapWrapper.xml index 0b1baf2cb4..3907f463be 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/sdncCallbackSoapWrapper.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/sdncCallbackSoapWrapper.xml @@ -1,10 +1,10 @@ + xmlns:v1="http://org.onap/workflow/sdnc/adapter/schema/v1"> + xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"> SDNC_REQUEST_ID 200 diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfCreateSimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfCreateSimResponse.xml index 7b5d22a1de..2c10f83b05 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfCreateSimResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfCreateSimResponse.xml @@ -1,9 +1,9 @@ + xmlns:v1="http://org.onap.so/vnfNotify"> - + edab9ec7-6cf8-47cf-b58c-9ba4ef5d3f70 true slcp34248vbc/020a112b-a0c8-4143-87a3-698680ba2efe diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfDeleteSimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfDeleteSimResponse.xml index a4b0becee4..923ae70b4b 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfDeleteSimResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfDeleteSimResponse.xml @@ -1,9 +1,9 @@ + xmlns:v1="http://org.onap.so/vnfNotify"> - + f5e42814-72c0-4422-b840-e14e757a709b true diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfQuerySimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfQuerySimResponse.xml index 3b99363ea8..290749bba0 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfQuerySimResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfQuerySimResponse.xml @@ -1,9 +1,9 @@ + xmlns:v1="http://org.onap.so/vnfNotify"> - + b1a82ce6-7f5c-45fd-9273-acaf88fc2222 true true diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfRollbackSimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfRollbackSimResponse.xml index 4fd0b62610..554dc2cdc0 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfRollbackSimResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfRollbackSimResponse.xml @@ -1,9 +1,9 @@ + xmlns:v1="http://org.onap.so/vnfNotify"> - + b1a82ce6-7f5c-45fd-9273-acaf88fc2137 true diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfadapter_request.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfadapter_request.xml new file mode 100644 index 0000000000..fb18d77ad7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfadapter_request.xml @@ -0,0 +1,41 @@ + + + true + + + RegionOne + true + 8892cffa-3514-45d4-b2b0-0fde9a96e323-1511813289000 + 2badc305-b2c0-4e2b-b03a-4e5d22079b30 + + 8892cffa-3514-45d4-b2b0-0fde9a96e323 + 5dad9aac-6e05-4bdb-a8ec-4f3cd718c5c6 + + http://localhost:18080/mso/WorkflowMessage/VNFAResponse/8892cffa-3514-45d4-b2b0-0fde9a96e323-1511813289000 + + true + false + 22eb191dd41a4f3c9be370fc638322f4 + dbfad358-de02-4370-a0aa-c6651a5848b8 + vRR-Internal-Network-L2 + + MTJWNJA4LCP + nova + VRR-STMTN5MMSC20-INT1 + VRR-STMTN5MMSC20-INT2 + no + 6d2e2469-8708-47c3-a0d4-73fa28a8a50b + STMTN5MMSC20 + ns.c16r32d128.v1 + MDT17 + 12 + 24 + 24 + + Vrr_Internal_Networks_module-1 + 6d2e2469-8708-47c3-a0d4-73fa28a8a50b + STMTN5MMSC20 + 1.0 + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml new file mode 100644 index 0000000000..715ddaa937 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml @@ -0,0 +1,223 @@ +aai: + auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764 + endpoint: http://localhost:${wiremock.server.port} +appc: + client: + key: iaEMAfjsVsZnraBP + response: + timeout: '120000' + secret: wcivUjsjXzmGFBfxMmyJu9dz + poolMembers: localhost + service: ueb + topic: + read: + name: APPC-TEST-AMDOCS2 + timeout: '120000' + write: APPC-TEST-AMDOCS1-DEV3 + sdnc: + read: SDNC-LCM-READ + write: SDNC-LCM-WRITE +log: + debug: + CompleteMsoProcess: 'true' + CreateNetworkInstanceInfra: 'true' + CreateServiceInstanceInfra: 'true' + DeleteNetworkInstanceInfra: 'true' + FalloutHandler: 'true' + UpdateNetworkInstanceInfra: 'true' + VnfAdapterRestV1: 'true' + sdncAdapter: 'true' + vnfAdapterCreateV1: 'true' + vnfAdapterRestV1: 'true' +mso: + adapters: + completemsoprocess: + endpoint: http://localhost:${wiremock.server.port}/CompleteMsoProcess + db: + auth: 757A94191D685FD2092AC1490730A4FC + endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter + att-endpoint: http://localhost:${wiremock.server.port}/dbadapters/AttRequestsDbAdapter + spring: + endpoint: http://localhost:${wiremock.server.port} + network: + endpoint: http://localhost:${wiremock.server.port}/networks/NetworkAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/networks/rest/v1/networks + openecomp: + db: + endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter + po: + auth: 757A94191D685FD2092AC1490730A4FC + password: 3141634BF7E070AA289CF2892C986C0B + sdnc: + endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter/v1/sdnc + timeout: PT60S + tenant: + endpoint: http://localhost:${wiremock.server.port}/tenantAdapterMock + vnf: + endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/vnfs + volume-groups: + rest: + endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/volume-groups + vnf-async: + endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapterAsync + workflow: + message: + endpoint: http://localhost:${wiremock.server.port}/workflows/messages/message + + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + + bpmn: + optimisticlockingexception: + retrycount: '3' + callbackRetryAttempts: '5' + catalog: + db: + endpoint: http://localhost:${wiremock.server.port}/ + spring: + endpoint: http://localhost:${wiremock.server.port} + correlation: + timeout: 60 + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + default: + adapter: + namespace: http://org.onap.so + healthcheck: + log: + debug: 'false' + infra: + customer: + id: testCustIdInfra + logPath: logs + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + po: + timeout: PT60S + request: + db: + endpoint: http://localhost:${wiremock.server.port}/ + rollback: 'true' + site-name: localDevEnv + workflow: + default: + aai: + cloud-region: + version: '9' + generic-vnf: + version: '9' + v8: + customer: + uri: /aai/v8/business/customers/customer + generic-query: + uri: /aai/v8/search/generic-query + l3-network: + uri: /aai/v8/network/l3-networks/l3-network + network-policy: + uri: /aai/v8/network/network-policies/network-policy + nodes-query: + uri: /aai/v8/search/nodes-query + route-table-reference: + uri: /aai/v8/network/route-table-references/route-table-reference + tenant: + uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + vce: + uri: /aai/v8/network/vces/vce + vpn-binding: + uri: /aai/v8/network/vpn-bindings/vpn-binding + v9: + cloud-region: + uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic + generic-vnf: + uri: /aai/v9/network/generic-vnfs/generic-vnf + global: + default: + aai: + namespace: http://org.openecomp.aai.inventory/ + version: '8' + message: + endpoint: http://localhost:${wiremock.server.port}/mso/WorkflowMesssage + notification: + name: GenericNotificationService + sdncadapter: + callback: http://localhost:${wiremock.server.port}/mso/SDNCAdapterCallbackService + vnfadapter: + create: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + delete: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + query: + callback: http://localhost:${wiremock.server.port}/mso/services/VNFAdapterQuerCallbackV1 + rollback: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + global: + dmaap: + username: dmaapUsername + password: dmaapPassword + host: http://localhost:${wiremock.server.port} + publisher: + topic: com.att.mso.asyncStatusUpdate + oof: + auth: test + timeout: PT10S + service: + agnostic: + endpoint: /api/oof/v1/placement + host: http://localhost:${wiremock.server.port} +policy: + auth: Basic dGVzdHBkcDphbHBoYTEyMw== + client: + auth: Basic bTAzNzQzOnBvbGljeVIwY2sk + endpoint: https://localhost:8081/pdp/api/ + environment: TEST +sdnc: + auth: Basic YWRtaW46YWRtaW4= + host: http://localhost:8446 + path: /restconf/operations/GENERIC-RESOURCE-API +sniro: + conductor: + enabled: true + host: http://localhost:${wiremock.server.port} + uri: /v1/release-orders + headers.auth: Basic dGVzdDp0ZXN0cHdk + manager: + timeout: PT30M + host: http://localhost:${wiremock.server.port} + uri.v1: /sniro/api/v2/placement + uri.v2: /sniro/api/placement/v2 + headers.auth: Basic dGVzdDp0ZXN0cHdk + headers.patchVersion: 1 + headers.minorVersion: 1 + headers.latestVersion: 2 + +spring: + datasource: + url: jdbc:mariadb://localhost:3307/camundabpmn + username: root + password: password + driver-class-name: org.mariadb.jdbc.Driver + initialize: true + jpa: + generate-ddl: false + show-sql: false + hibernate: + ddl-auto: none + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + +mariaDB4j: + dataDir: + port: 3307 + databaseName: camundabpmn +camunda: + bpm: + metrics: + enabled: false + db-reporter-activate: false diff --git a/bpmn/MSOCommonBPMN/src/test/resources/camunda.cfg.xml b/bpmn/MSOCommonBPMN/src/test/resources/camunda.cfg.xml deleted file mode 100644 index e151aca5fd..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/camunda.cfg.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml b/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..d8f6ba3930 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml @@ -0,0 +1,30 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/logging.properties b/bpmn/MSOCommonBPMN/src/test/resources/logging.properties deleted file mode 100644 index 4941c55971..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/logging.properties +++ /dev/null @@ -1,2 +0,0 @@ -#register SLF4JBridgeHandler as handler for the j.u.l. root logger -handlers = org.slf4j.bridge.SLF4JBridgeHandler diff --git a/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.properties b/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.properties deleted file mode 100644 index f800d00245..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.properties +++ /dev/null @@ -1,3 +0,0 @@ -# Default BPMN properties for unit tests - -URNMapping.FileSystemLoading.Enabled=true \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties b/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties deleted file mode 100644 index 4b338aed0c..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties +++ /dev/null @@ -1,139 +0,0 @@ -# Default URN Mappings for unit tests - -mso.rollback=true - -canopi.auth=757A94191D685FD2092AC1490730A4FC -csi.aots.addincidentmanagement.endpoint=http://localhost:28090/AddIncidentManagementTicketRequest -csi.networkstatus.endpoint=http://localhost:28090/SendManagedNetworkStatusNotification -mso.csi.pwd=4EA237303511EFBBC37F17A351562131 -mso.csi.usrname=mso -mso.msoKey=07a7159d3bf51a0e53be7a8f89699be7 - -mso.healthcheck.log.debug=false - -mso.adapters.completemsoprocess.endpoint=http://localhost:28090/CompleteMsoProcess - -mso.adapters.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter -mso.adapters.openecomp.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter -mso.adapters.db.auth=757A94191D685FD2092AC1490730A4FC - -mso.adapters.network.endpoint=http://localhost:28090/networks/NetworkAdapter -mso.adapters.network.rest.endpoint=http://localhost:28090/networks/rest/v1/networks - -mso.adapters.po.auth=757A94191D685FD2092AC1490730A4FC -mso.adapters.po.password=3141634BF7E070AA289CF2892C986C0B -mso.po.timeout=PT60S -mso.default.adapter.namespace=http://org.openecomp.mso -mso.adapters.workflow.message.endpoint=http://localhost:28090/workflows/messages/message - -aai.auth=26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764 - -policy.endpoint=https://mtanjvsgcvm02.nvp.cip.att.com:8081/pdp/api/ -policy.client.auth=Basic bTAzNzQzOnBvbGljeVIwY2sk -policy.auth=Basic dGVzdHBkcDphbHBoYTEyMw== -policy.environment=TEST - -appc.client.topic.read=APPC-TEST-AMDOCS2 -appc.client.topic.write=APPC-TEST-AMDOCS1-DEV3 -appc.client.topic.sdnc.read=SDNC-LCM-READ -appc.client.topic.sdnc.write=SDNC-LCM-WRITE -appc.client.topic.read.timeout=120000 -appc.client.response.timeout=120000 -appc.client.poolMembers=uebsb93kcdc.it.att.com:3904,uebsb92kcdc.it.att.com:3904,uebsb91kcdc.it.att.com:3904 -appc.client.key=iaEMAfjsVsZnraBP -appc.client.secret=wcivUjsjXzmGFBfxMmyJu9dz -appc.client.service=ueb - -mso.adapters.sdnc.endpoint=http://localhost:28090/SDNCAdapter -mso.adapters.sdnc.rest.endpoint=http://localhost:28090/SDNCAdapter/v1/sdnc -mso.adapters.sdnc.timeout=PT60S -mso.sdnc.firewall.yang.model=http://com/openecomp/svc/mis/firewall-lite-gui -mso.sdnc.firewall.yang.model.version=2015-05-15 -mso.sdnc.password=3141634BF7E070AA289CF2892C986C0B -mso.sdnc.timeout.firewall.minutes=20 -mso.callbackRetryAttempts=5 -mso.sdnc.timeout=PT10S -mso.sdnc.timeout.ucpe.async.hours=120 -mso.sdnc.timeout.ucpe.async.minutes=5 -mso.workflow.message.endpoint=http://localhost:28080/mso/WorkflowMesssage -mso.workflow.sdncadapter.callback=http://localhost:28080/mso/SDNCAdapterCallbackService - -mso.sniro.auth=test:testpwd -mso.sniro.timeout=PT30M -mso.sniro.policies.dhv.2vvig=SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1 -mso.sniro.policies.dhv.4vvig=SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.VNFPolicy_vvigprimary2_v1,SNIRO.VNFPolicy_vvigsecondary2_v1,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1 - -mso.service.agnostic.sniro.host=http://localhost:28090 -mso.service.agnostic.sniro.endpoint=/sniro/api/v2/placement - -mso.oof.auth=test:testpwd -mso.oof.endpoint=http://localhost:28090/api/oof/v1/placement -mso.oof.timeout=PT30M -mso.service.agnostic.oof.host=http://localhost:28090 -mso.service.agnostic.oof.endpoint=/api/oof/v1/placement - -mso.catalog.db.endpoint=http://localhost:28090/ - -ruby.create-ticket-request.dmaap.username=m04768@mso.ecomp.att.com -ruby.create-ticket-request.dmaap.password=eHQ1cUJrOUc -ruby.create-ticket-request.publisher.topic=com.att.pdas.st1.msoCMFallout-v1 - - -mso.adapters.tenant.endpoint=http://localhost:28090/tenantAdapterMock -mso.adapters.vnf-async.endpoint=http://localhost:28090/vnfs/VnfAdapterAsync -mso.adapters.vnf.endpoint=http://localhost:28090/vnfs/VnfAdapter -mso.adapters.vnf.rest.endpoint=http://localhost:28090/vnfs/rest/v1/vnfs -mso.workflow.vnfadapter.create.callback=http://localhost:28080/mso/vnfAdapterNotify -mso.workflow.vnfadapter.delete.callback=http://localhost:28080/mso/vnfAdapterNotify -mso.workflow.vnfadapter.query.callback=http://localhost:28080/mso/services/VNFAdapterQuerCallbackV1 -mso.workflow.vnfadapter.rollback.callback=http://localhost:28080/mso/vnfAdapterNotify -mso.workflow.createvce.delay.seconds=1 -mso.infra.customer.id=testCustIdInfra - -aai.endpoint=http://localhost:28090 - -# AAI version mappings - -# Example to override default version for a resource: -#mso.workflow.default.aai.vce.version=6 -#mso.workflow.default.aai.v6.vce.uri=/aai/v6/network/vces/vce -mso.workflow.global.default.aai.namespace=http://org.openecomp.aai.inventory/ -mso.workflow.global.default.aai.version=8 -mso.workflow.default.aai.cloud-region.version=9 -mso.workflow.default.aai.generic-vnf.version=9 - -mso.workflow.default.aai.v9.cloud-region.uri=/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic -mso.workflow.default.aai.v8.customer.uri=/aai/v8/business/customers/customer -mso.workflow.default.aai.v8.generic-query.uri=/aai/v8/search/generic-query -mso.workflow.default.aai.v9.generic-vnf.uri=/aai/v9/network/generic-vnfs/generic-vnf -mso.workflow.default.aai.v8.l3-network.uri=/aai/v8/network/l3-networks/l3-network -mso.workflow.default.aai.v8.network-policy.uri=/aai/v8/network/network-policies/network-policy -mso.workflow.default.aai.v8.nodes-query.uri=/aai/v8/search/nodes-query -mso.workflow.default.aai.v8.route-table-reference.uri=/aai/v8/network/route-table-references/route-table-reference -mso.workflow.default.aai.v8.tenant.uri=/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant -mso.workflow.default.aai.v8.vce.uri=/aai/v8/network/vces/vce -mso.workflow.default.aai.v8.vpn-binding.uri=/aai/v8/network/vpn-bindings/vpn-binding -mso.workflow.notification.name=GenericNotificationService -mso.bpmn.optimisticlockingexception.retrycount=3 - -log.debug.CompleteMsoProcess=true -log.debug.CreateNetworkInstanceInfra=true -log.debug.CreateServiceInstanceInfra=true -log.debug.DeleteNetworkInstanceInfra=true -log.debug.FalloutHandler=true -log.debug.GenericGetService=true -log.debug.sdncAdapter=true -log.debug.UpdateNetworkInstanceInfra=true -log.debug.VnfAdapterRestV1=true -log.debug.GenericGetNetwork=true -log.debug.GenericGetVnf=true -log.debug.GenericDeleteService=true -log.debug.GenericDeleteNetwork=true -log.debug.GenericDeleteVnf=true -log.debug.vnfAdapterCreateV1=true -log.debug.vnfAdapterRestV1=true - -sdno.health-check.dmaap.username=m04768@mso.ecomp.att.com -sdno.health-check.dmaap.password=eHQ1cUJrOUc -sdno.health-check.dmaap.subscriber.topic=com.att.sdno.test-health-diagnostic-v02 -sdno.health-check.dmaap.publisher.topic=com.att.sdno.test-health-diagnostic-v02 diff --git a/bpmn/MSOCommonBPMN/src/test/resources/mso.properties b/bpmn/MSOCommonBPMN/src/test/resources/mso.properties deleted file mode 100644 index 2428b512b1..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/mso.properties +++ /dev/null @@ -1,42 +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========================================================= -### - -### SDNCURL -### -#EE# -org.openecomp.mso.adapters.sdnc.sdncgeturl=https://localhost:8443/restconf/config/L3SDN-API: -org.openecomp.mso.adapters.sdnc.sdncposturl=https://localhost:8443/restconf/operations/L3SDN-API: -### -### BPEL ASYNC CALLLBACK/NOTIFICATION URL -### -#EE# -org.openecomp.mso.adapters.sdnc.bpelurl=http://localhost:8080/active-bpel/services/SDNCAdapterCallbackV1 -### -### SDNC ASYNC NOTIFICATION/RESPONSE URL -### -#EE# -org.openecomp.mso.adapters.sdnc.myurl=https://localhost:8443/adapters/rest/SDNCNotify -### -org.openecomp.mso.adapters.sdnc.sdncauth=admin:admin -org.openecomp.mso.adapters.sdnc.bpelauth=avosAdmin:jboss123 -org.openecomp.mso.adapters.sdnc.sdncconnecttime=2000 -org.openecomp.mso.adapters.sdnc.sdncreadtime=5000 - -org.openecomp.mso.adapters.sdnc...query=toto diff --git a/bpmn/MSOCommonBPMN/src/test/resources/mso.sdnc.properties b/bpmn/MSOCommonBPMN/src/test/resources/mso.sdnc.properties deleted file mode 100644 index f53e2d2b65..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/mso.sdnc.properties +++ /dev/null @@ -1,152 +0,0 @@ -#MSO SDNCA Properties go here -### -### UNIQUE SDNCURLs for Requests supported by SDNCA. URLS have unique tags eg a format like sdncurlXY (XY is unique eg digits) -### -org.openecomp.mso.adapters.sdnc.sdncurl1=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/L3SDN-API: -org.openecomp.mso.adapters.sdnc.sdncurl2=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/config/L3SDN-API: -org.openecomp.mso.adapters.sdnc.sdncurl3=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/AicHoming: -org.openecomp.mso.adapters.sdnc.sdncurl4=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/Firewall-API: -org.openecomp.mso.adapters.sdnc.sdncurl5=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/config -org.openecomp.mso.adapters.sdnc.sdncurl6=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/VNF-API: -org.openecomp.mso.adapters.sdnc.sdncurl7=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/L3UCPE-API: -org.openecomp.mso.adapters.sdnc.sdncurl8=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/NBNC-API: -org.openecomp.mso.adapters.sdnc.sdncurl9=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/NORTHBOUND-API:service-topology-operation -org.openecomp.mso.adapters.sdnc.sdncurl10=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/GENERIC-RESOURCE-API: -org.openecomp.mso.adapters.sdnc.sdncurl11=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/VNFTOPOLOGYAIC-API: -org.openecomp.mso.adapters.sdnc.sdncurl12=https://sdncodl.it.us.03.aic.cip.att.com:8443/ -org.openecomp.mso.adapters.sdnc.sdncurl13=http://mtznjv1fcbc01.kvm.cip.att.com:8181/restconf/operations/SDNW-API: -#org.openecomp.mso.adapters.sdnc.sdncurl14=http://txcdtl01bb2697.itservices.sbc.com:8181/restconf/operations/GENERIC-RESOURCE-API:port-mirror-topology-operation -org.openecomp.mso.adapters.sdnc.sdncurl14=http://mtanjv9sdbc51-eth1-0.aic.cip.att.com:8443/restconf/operations/GENERIC-RESOURCE-API: -### BPEL ASYNC CALLBACK/NOTIFICATION URL -### -org.openecomp.mso.adapters.sdnc.bpelurl=http://mtanjv9mobp01-eth1-0.aic.cip.att.com:8080/mso/SDNCAdapterCallbackService -org.openecomp.mso.adapters.sdnc.rest.bpelurl=http://mtanjv9mobp01-eth1-0.aic.cip.att.com:8080/mso/WorkflowMessage -### -### SDNC ASYNC NOTIFICATION/RESPONSE URL -### -org.openecomp.mso.adapters.sdnc.myurl=http://mtanjv9moja02-eth1-0.aic.cip.att.com:8080/adapters/rest/SDNCNotify -### Production value diff from other servers -org.openecomp.mso.adapters.sdnc.sdncauth=406B2AE613211B6FB52466DE6E1769AC -org.openecomp.mso.adapters.sdnc.bpelauth=F8E9452B55DDE4CCE77547B0E748105C54CF5EF1351B4E2CBAABF2981EFE776D -org.openecomp.mso.adapters.sdnc.sdncconnecttime=5000 -### -### Distinct Requests Supported by SDNCA. sdncurls added on top of file. fields may be null eg msoaction,operation resulting in .. construct -### -###org.openecomp.mso.adapters.sdnc.MSOACTION.OPERATION.ACTION=METHOD|TIMEOUT|URL|HEADERNAME|NAMESPACE -### -org.openecomp.mso.adapters.sdnc..service-homing-operation.homing=POST|60000|sdncurl3|sdnc-homing-header|com:att:sdnctl:aicHoming -org.openecomp.mso.adapters.sdnc.infra..query=GET|60000|sdncurl5| -org.openecomp.mso.adapters.sdnc.mobility..query=GET|60000|sdncurl5| -org.openecomp.mso.adapters.sdnc.vfmodule..query=GET|60000|sdncurl12| -org.openecomp.mso.adapters.sdnc...query=GET|60000|sdncurl2| -org.openecomp.mso.adapters.sdnc...put=PUT|60000|sdncurl5| -org.openecomp.mso.adapters.sdnc...restdelete=DELETE|60000|sdncurl5| -org.openecomp.mso.adapters.sdnc.gammainternet.svc-topology-operation.assign=POST|60000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.svc-topology-operation.delete=POST|250000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.reserve=POST|60000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.activate=POST|90000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.delete=POST|250000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.turnup=POST|60000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.changereserve=POST|60000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.changedelete=POST|250000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.changeactivate=POST|60000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc..feature-configuration-operation.activate=POST|60000|sdncurl4|sdnc-feature-request-header|com:att:sdnctl:firewallapi -org.openecomp.mso.adapters.sdnc..feature-configuration-operation.changeactivate=POST|60000|sdncurl4|sdnc-feature-request-header|com:att:sdnctl:firewallapi -org.openecomp.mso.adapters.sdnc..feature-configuration-operation.delete=POST|60000|sdncurl4|sdnc-feature-request-header|com:att:sdnctl:firewallapi -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.assign=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.activate=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.rollback=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.delete=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.changeassign=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.changedelete=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.reserve=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.assign=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.activate=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.rollback=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.delete=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.changeassign=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.changedelete=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.prepare=POST|360000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.activate=POST|60000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.delete=POST|360000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.complete=POST|60000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.activatevnf=POST|600000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.designvnf=POST|60000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.removevnf=POST|60000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc..svc-topology-operation.assign=POST|285000|sdncurl8|sdnc-request-header|com:att:sdnctl:nbncapi -org.openecomp.mso.adapters.sdnc..svc-topology-operation.activate=POST|285000|sdncurl8|sdnc-request-header|com:att:sdnctl:nbncapi -org.openecomp.mso.adapters.sdnc..svc-topology-operation.delete=POST|285000|sdncurl8|sdnc-request-header|com:att:sdnctl:nbncapi - -org.openecomp.mso.adapters.sdnc.service.ucpe.service-topology-assign-operation=POST|120000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.ucpe.service-topology-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.ucpe-vnf.service-topology-cust-assign-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.ucpe-vnf.service-topology-cust-stage-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.ucpe-vnf.service-topology-cust-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.ucpe-vnf.service-topology-cust-remove-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.dhv.service-topology-assign-operation=POST|120000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.infra.service-topology-infra-assign-operation=POST|120000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.infra.service-topology-infra-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vhnportal.service-topology-cust-assign-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vhnportal.service-topology-cust-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vhngw.service-topology-cust-assign-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vhngw.service-topology-infra-register-vnf-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vhngw.service-topology-cust-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vvig.service-topology-cust-assign-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vvig.service-topology-cust-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.pe.service-topology-cust-assign-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.pe.service-topology-cust-stage-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.pe.service-topology-cust-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 - -org.openecomp.mso.adapters.sdnc..service-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..service-topology-operation.rollback=POST|270000|sdncur10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..service-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..service-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.network-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.network-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.network-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.network-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.rollback=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.changeassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.changedelete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.rollback=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.changeassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.changedelete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.create=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.create=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource - -org.openecomp.mso.adapters.sdnc..vnf-topology-aic-operation.assign=POST|270000|sdncurl11|sdnc-request-header|com:att:sdnctl:vnftopologyaic -org.openecomp.mso.adapters.sdnc..vnf-topology-aic-operation.activate=POST|270000|sdncurl11|sdnc-request-header|com:att:sdnctl:vnftopologyaic - -org.openecomp.mso.adapters.sdnc.TRANSPORT.service-topology-operation.assign=POST|270000|sdncurl13|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.TRANSPORT.service-topology-operation.rollback=POST|270000|sdncur13|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.TRANSPORT.service-topology-operation.delete=POST|270000|sdncurl13|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.TRANSPORT.service-topology-operation.deactivate=POST|270000|sdncurl13|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.TRANSPORT.service-topology-operation.activate=POST|270000|sdncurl13|sdnc-request-header|com:att:sdnctl:generic-resource - -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.enable=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.disable=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource - diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/avpn/dmaap/avpnDmaapAsyncRequestStatus.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/avpn/dmaap/avpnDmaapAsyncRequestStatus.json new file mode 100644 index 0000000000..e9172c5ba0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/avpn/dmaap/avpnDmaapAsyncRequestStatus.json @@ -0,0 +1,21 @@ +{ + "asyncRequestStatus" : { + "requestId" : "rq1234d1-5a33-55df-13ab-12abad84e331", + "clientSource" : "SPP", + "correlator" : "myClientId123", + "instanceReferences" : { + "serviceInstanceId" : "bc305d54-75b4-431b-adb2-eb6b9e546014" + }, + "startTime" : "2017-11-17T09:30:47Z", + "finishTime" : "2017-11-17T09:30:47Z", + "requestScope" : "service", + "requestType" : "createInstance", + "requestStatus" : { + "timestamp" : "2017-11-17T09:30:47Z", + "requestState" : "COMPLETE", + "statusMessage" : "Success", + "percentProgress" : "100", + "wasRolledBack" : true + } + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/ruby/create-ticket/create-ticket-request.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/ruby/create-ticket/create-ticket-request.json new file mode 100644 index 0000000000..e388d3e9ad --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/ruby/create-ticket/create-ticket-request.json @@ -0,0 +1,15 @@ +{ + "event": { + "msoRequest": { + "requestClientName": "MSO", + "requestId": "abc123", + "requestTime": "test-time", + "sourceName": "source-name", + "reason": "reason", + "action": "Create Ticket", + "workflowId": "work-flow-Id", + "notification": "notification" + } +} +} + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json new file mode 100644 index 0000000000..8c3ca1938d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json @@ -0,0 +1,26 @@ +{ + "body": { + "input": { + "request-hd-custom": { + "request-client-name": "MSO", + "request-user-id": "test-user", + "request-id": "test-request-id", + "health-diagnostic-code": "VROUTER000004", + "operation-type": "lport_mirroring_check", + "aai-param-list": [ + { + "key": "configuration-id", + "value": "test-configuration-id" + }, + { + "key": "interface-id", + "value": "test-interface-id" + } + ] + } + } + }, + "operation": "health-diagnostic-custom", + "nodeLoc": "test-clli", + "nodeType": "VROUTER" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json new file mode 100644 index 0000000000..08220abe2d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json @@ -0,0 +1,26 @@ +{ + "body": { + "input": { + "request-hd-custom": { + "request-client-name": "MSO", + "request-user-id": "test-user", + "request-id": "test-request-id", + "health-diagnostic-code": "VROUTER000003", + "operation-type": "lport_mirroring_check", + "aai-param-list": [ + { + "key": "configuration-id", + "value": "test-configuration-id" + }, + { + "key": "interface-id", + "value": "test-interface-id" + } + ] + } + } + }, + "operation": "health-diagnostic-custom", + "nodeLoc": "test-clli", + "nodeType": "VROUTER" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json new file mode 100644 index 0000000000..834fcc8e72 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json @@ -0,0 +1,22 @@ +{ + "body": { + "input": { + "request-hd-custom": { + "request-client-name": "MSO", + "request-user-id": "test-user", + "request-id": "test-request-id", + "health-diagnostic-code": "VROUTER000004", + "operation-type": "mirroring_check", + "aai-param-list": [ + { + "key": "configuration-id", + "value": "test-configuration-id" + } + ] + } + } + }, + "operation": "health-diagnostic-custom", + "nodeLoc": "test-clli", + "nodeType": "VROUTER" +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json new file mode 100644 index 0000000000..19d934d291 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json @@ -0,0 +1,22 @@ +{ + "body": { + "input": { + "request-hd-custom": { + "request-client-name": "MSO", + "request-user-id": "test-user", + "request-id": "test-request-id", + "health-diagnostic-code": "VROUTER000003", + "operation-type": "mirroring_check", + "aai-param-list": [ + { + "key": "configuration-id", + "value": "test-configuration-id" + } + ] + } + } + }, + "operation": "health-diagnostic-custom", + "nodeLoc": "test-clli", + "nodeType": "VROUTER" +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/output-failure.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/output-failure.json new file mode 100644 index 0000000000..8cf0a820cd --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/output-failure.json @@ -0,0 +1,25 @@ +{ + "body": { + "output": { + "response-hd-custom": { + "response-status": "Failure", + "cached-data": "false", + "response-interface-type": "ansible", + "response-id": "191bf423-8473-4f7c-9fbb-e5dcbb40a12b", + "remote_end_time": "2017-10-13T14:51:53.490+0000", + "response-client-name": "MSO", + "user_id": "xxxxxx", + "remote_start_time": "2017-10-13T14:51:53.173+0000", + "error-message": "my error message", + "connection-failure-msg": "SDNO was unable to connect to an Ansible REST API server; Please ensure Ansible REST server is running" + } + } + }, + "result-info": { + "code": "200", + "status": "SUCCESS", + "request-id": "xyz123", + "client-name": "MSO", + "processing-host": "sdno-sdno-mtsnjv9sdno01" + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/output-success.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/output-success.json new file mode 100644 index 0000000000..a6794327d8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/output-success.json @@ -0,0 +1,22 @@ +{ + "body": { + "output": { + "response-healthdiagnostic": { + "response-node-ip": "192.20.127.76", + "response-id": "xyz123", + "response-node-name": "mtvnjv9aads11", + "response-status": "Success", + "response-interface-type": "ssh", + "response-details-json": "result", + "cached-data": "false" + } + } + }, + "result-info": { + "client-name": "MSO", + "code": "200", + "processing-host": "sdno1-host01", + "request-id": "xyz123", + "status": "SUCCESS" + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/response.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/response.json new file mode 100644 index 0000000000..2355e86938 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/response.json @@ -0,0 +1,17 @@ +{ + + "result-info": { + + "client-name": "MSO", + + "code": "202", + + "processing-host": "sdno1-host01", + + "request-id": "xyz123", + + "status": "ACCEPTED" + + } + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/ruby/create-ticket/create-ticket-request.json b/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/ruby/create-ticket/create-ticket-request.json deleted file mode 100644 index e388d3e9ad..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/ruby/create-ticket/create-ticket-request.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "event": { - "msoRequest": { - "requestClientName": "MSO", - "requestId": "abc123", - "requestTime": "test-time", - "sourceName": "source-name", - "reason": "reason", - "action": "Create Ticket", - "workflowId": "work-flow-Id", - "notification": "notification" - } -} -} - diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-post-check-request.json b/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-post-check-request.json deleted file mode 100644 index b9ad7a1f94..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-post-check-request.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "body": { - "input": { - "request-hd-custom": { - "request-client-name": "MSO", - "request-user-id": "test-user", - "request-id": "test-request-id", - "health-diagnostic-code": "VROUTER000004", - "operation-type": "lport_mirroring_check", - "aai-param-list": [ - { - "key": "configuration-id", - "value": "test-configuration-id" - }, - { - "key": "interface-id", - "value": "test-interface-id" - } - ] - } - } - }, - "operation": "health-diagnostic-custom", - "nodeLoc": "test-clli", - "nodeType": "VROUTER" -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-pre-check-request.json b/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-pre-check-request.json deleted file mode 100644 index ee28da86b9..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-pre-check-request.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "body": { - "input": { - "request-hd-custom": { - "request-client-name": "MSO", - "request-user-id": "test-user", - "request-id": "test-request-id", - "health-diagnostic-code": "VROUTER000003", - "operation-type": "lport_mirroring_check", - "aai-param-list": [ - { - "key": "configuration-id", - "value": "test-configuration-id" - }, - { - "key": "interface-id", - "value": "test-interface-id" - } - ] - } - } - }, - "operation": "health-diagnostic-custom", - "nodeLoc": "test-clli", - "nodeType": "VROUTER" -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-post-check-request.json b/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-post-check-request.json deleted file mode 100644 index 95746ec3f9..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-post-check-request.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "body": { - "input": { - "request-hd-custom": { - "request-client-name": "MSO", - "request-user-id": "test-user", - "request-id": "test-request-id", - "health-diagnostic-code": "VROUTER000004", - "operation-type": "mirroring_check", - "aai-param-list": [ - { - "key": "configuration-id", - "value": "test-configuration-id" - } - ] - } - } - }, - "operation": "health-diagnostic-custom", - "nodeLoc": "test-clli", - "nodeType": "VROUTER" -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-pre-check-request.json b/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-pre-check-request.json deleted file mode 100644 index 19d934d291..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-pre-check-request.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "body": { - "input": { - "request-hd-custom": { - "request-client-name": "MSO", - "request-user-id": "test-user", - "request-id": "test-request-id", - "health-diagnostic-code": "VROUTER000003", - "operation-type": "mirroring_check", - "aai-param-list": [ - { - "key": "configuration-id", - "value": "test-configuration-id" - } - ] - } - } - }, - "operation": "health-diagnostic-custom", - "nodeLoc": "test-clli", - "nodeType": "VROUTER" -} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/output-failure.json b/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/output-failure.json deleted file mode 100644 index 15160b9dd9..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/output-failure.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "body": { - "output": { - "response-hd-custom": { - "response-status": "Failure", - "cached-data": "false", - "response-interface-type": "ansible", - "response-id": "191bf423-8473-4f7c-9fbb-e5dcbb40a12b", - "remote_end_time": "2017-10-13T14:51:53.490+0000", - "response-client-name": "MSO", - "user_id": "md5621", - "remote_start_time": "2017-10-13T14:51:53.173+0000", - "error-message": "my error message", - "connection-failure-msg": "SDNO was unable to connect to an Ansible REST API server; Please ensure Ansible REST server is running" - } - } - }, - "result-info": { - "code": "200", - "status": "SUCCESS", - "request-id": "xyz123", - "client-name": "MSO", - "processing-host": "sdno-sdno-mtsnjv9sdno01" - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/output-success.json b/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/output-success.json deleted file mode 100644 index a6794327d8..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/output-success.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "body": { - "output": { - "response-healthdiagnostic": { - "response-node-ip": "192.20.127.76", - "response-id": "xyz123", - "response-node-name": "mtvnjv9aads11", - "response-status": "Success", - "response-interface-type": "ssh", - "response-details-json": "result", - "cached-data": "false" - } - } - }, - "result-info": { - "client-name": "MSO", - "code": "200", - "processing-host": "sdno1-host01", - "request-id": "xyz123", - "status": "SUCCESS" - } -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/response.json b/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/response.json deleted file mode 100644 index 2355e86938..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/response.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - - "result-info": { - - "client-name": "MSO", - - "code": "202", - - "processing-host": "sdno1-host01", - - "request-id": "xyz123", - - "status": "ACCEPTED" - - } - -} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/response/clientServiceResponse.json b/bpmn/MSOCommonBPMN/src/test/resources/response/clientServiceResponse.json new file mode 100644 index 0000000000..0259e2f7fe --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/response/clientServiceResponse.json @@ -0,0 +1,105 @@ +{ + "version": null, + "modelName": "MSOTADevInfra_vSAMP10a_Service", + "description": "MSO aLaCarte Vfmodule with addon", + "modelUUID": "5df8b6de-2083-11e7-93ae-92361f002672", + "modelInvariantUUID": "9647dfc4-2083-11e7-93ae-92361f002671", + "created": 1492191759000, + "modelVersion": "2.0", + "serviceType": "NA", + "serviceRole": "NA", + "environmentContext": "Luna", + "workloadContext": "Oxygen", + "networkCustomizations": [ + { + "modelCustomizationUUID": "3bdbb104-476c-483e-9f8b-c095b3d308ac", + "modelInstanceName": "CONTRAIL30_GNDIRECT 9", + "created": 1484703305000, + "networkTechnology": "", + "networkType": "", + "networkScope": "", + "networkRole": "", + "networkResource": null, + "handler": { + + } + } + ], + "vnfCustomizations": [ + { + "version": null, + "modelCustomizationUUID": "68dc9a92-214c-11e7-93ae-92361f002672", + "modelInstanceName": "vSAMP10a 2", + "created": "2017-04-14 21:46:28.000", + "minInstances": 0, + "maxInstances": 0, + "availabilityZoneMaxCount": 0, + "nfFunction": "vSAMP", + "nfType": "vSAMP", + "nfRole": "vSAMP", + "nfNamingCode": "vSAMP", + "multiStageDesign": null, + "vnfResources": null, + "vfModuleCustomizations": [ + { + "modelCustomizationUUID": "cb82ffd8-252a-11e7-93ae-92361f002672", + "label": "base", + "minInstances": 0, + "maxInstances": 0, + "initialCount": 1, + "availabilityZoneCount": 0, + "created": "2016-09-14 18:19:56.000", + "volumeHeatEnv": null, + "heatEnvironment": null, + "vfModule": null + }, + { + "modelCustomizationUUID": "b4ea86b4-253f-11e7-93ae-92361f002672", + "label": "PCM", + "minInstances": 0, + "maxInstances": 0, + "initialCount": 0, + "availabilityZoneCount": 0, + "created": "2016-09-14 18:19:56.000", + "volumeHeatEnv": null, + "heatEnvironment": null, + "vfModule": null + } + ], + "handler": { + + }, + "vnfResource": null, + "creationTimestamp": 1492206388000 + } + ], + "allottedCustomizations": [ + { + "version": null, + "modelCustomizationUUID": null, + "created": 1484946860000, + "modelInstanceName": "Sec_Tunnel_Xconn 11", + "providingServiceModelInvariantUUID": null, + "providingServiceModelUUID": null, + "providingServiceModelName": null, + "targetNetworkRole": null, + "nfFunction": null, + "nfType": null, + "nfRole": null, + "nfNamingCode": null, + "minInstances": null, + "maxInstances": null, + "allottedResource": null, + "handler": { + + } + } + ], + "recipes": { + + }, + "csar": null, + "handler": { + + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/response/infraActiveRequestsResponse.json b/bpmn/MSOCommonBPMN/src/test/resources/response/infraActiveRequestsResponse.json new file mode 100644 index 0000000000..9cc84f2cd4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/response/infraActiveRequestsResponse.json @@ -0,0 +1,46 @@ +{ + "requestId": "00032ab7-3fb3-42e5-965d-8ea592502017", + "clientRequestId": "00032ab7-3fb3-42e5-965d-8ea592502016", + "action": "deleteInstance", + "requestStatus": "COMPLETE", + "statusMessage": "Vf Module has been deleted successfully.", + "progress": 100, + "startTime": 1482451194000, + "endTime": 1482451228000, + "source": "VID", + "vnfId": "b92f60c8-8de3-46c1-8dc1-e4390ac2b005", + "vnfName": null, + "vnfType": null, + "serviceType": null, + "aicNodeClli": null, + "tenantId": "6accefef3cb442ff9e644d589fb04107", + "provStatus": null, + "vnfParams": null, + "vnfOutputs": null, + "requestBody": "{\"modelInfo\":{\"modelType\":\"vfModule\",\"modelName\":\"vSAMP10aDEV::base::module-0\"},\"requestInfo\":{\"source\":\"VID\"},\"cloudConfiguration\":{\"tenantId\":\"6accefef3cb442ff9e644d589fb04107\",\"lcpCloudRegionId\":\"mtn6\"}}", + "responseBody": null, + "lastModifiedBy": "BPMN", + "modifyTime": 1482451228000, + "requestType": null, + "volumeGroupId": null, + "volumeGroupName": null, + "vfModuleId": "c7d527b1-7a91-49fd-b97d-1c8c0f4a7992", + "vfModuleName": null, + "vfModuleModelName": "vSAMP10aDEV::base::module-0", + "aaiServiceId": null, + "aicCloudRegion": "mtn6", + "callBackUrl": null, + "correlator": null, + "serviceInstanceId": "e3b5744d-2ad1-4cdd-8390-c999a38829bc", + "serviceInstanceName": null, + "requestScope": "vfModule", + "requestAction": "deleteInstance", + "networkId": null, + "networkName": null, + "networkType": null, + "requestorId": null, + "configurationId": null, + "configurationName": null, + "operationalEnvId": null, + "operationalEnvName": null +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/schema.sql b/bpmn/MSOCommonBPMN/src/test/resources/schema.sql new file mode 100644 index 0000000000..7a15e84662 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/schema.sql @@ -0,0 +1,1188 @@ + +USE `camundabpmn`; + + +create table ACT_GE_PROPERTY ( + NAME_ varchar(64), + VALUE_ varchar(300), + REV_ integer, + primary key (NAME_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + + +create table ACT_GE_BYTEARRAY ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + BYTES_ LONGBLOB, + GENERATED_ TINYINT, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RE_DEPLOYMENT ( + ID_ varchar(64), + NAME_ varchar(255), + DEPLOY_TIME_ timestamp(3), + SOURCE_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EXECUTION ( + ID_ varchar(64), + REV_ integer, + PROC_INST_ID_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + SUPER_EXEC_ varchar(64), + SUPER_CASE_EXEC_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + IS_ACTIVE_ TINYINT, + IS_CONCURRENT_ TINYINT, + IS_SCOPE_ TINYINT, + IS_EVENT_SCOPE_ TINYINT, + SUSPENSION_STATE_ integer, + CACHED_ENT_STATE_ integer, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_JOB ( + ID_ varchar(64) NOT NULL, + REV_ integer, + TYPE_ varchar(255) NOT NULL, + LOCK_EXP_TIME_ timestamp(3) NULL, + LOCK_OWNER_ varchar(255), + EXCLUSIVE_ boolean, + EXECUTION_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROCESS_DEF_ID_ varchar(64), + PROCESS_DEF_KEY_ varchar(255), + RETRIES_ integer, + EXCEPTION_STACK_ID_ varchar(64), + EXCEPTION_MSG_ varchar(4000), + DUEDATE_ timestamp(3) NULL, + REPEAT_ varchar(255), + HANDLER_TYPE_ varchar(255), + HANDLER_CFG_ varchar(4000), + DEPLOYMENT_ID_ varchar(64), + SUSPENSION_STATE_ integer NOT NULL DEFAULT 1, + JOB_DEF_ID_ varchar(64), + PRIORITY_ bigint NOT NULL DEFAULT 0, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_JOBDEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + JOB_TYPE_ varchar(255) NOT NULL, + JOB_CONFIGURATION_ varchar(255), + SUSPENSION_STATE_ integer, + JOB_PRIORITY_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RE_PROCDEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + HAS_START_FORM_KEY_ TINYINT, + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(64), + VERSION_TAG_ varchar(64), + HISTORY_TTL_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_TASK ( + ID_ varchar(64), + REV_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + TASK_DEF_KEY_ varchar(255), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + DELEGATION_ varchar(64), + PRIORITY_ integer, + CREATE_TIME_ timestamp(3), + DUE_DATE_ datetime(3), + FOLLOW_UP_DATE_ datetime(3), + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_IDENTITYLINK ( + ID_ varchar(64), + REV_ integer, + GROUP_ID_ varchar(255), + TYPE_ varchar(255), + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_VARIABLE ( + ID_ varchar(64) not null, + REV_ integer, + TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + TASK_ID_ varchar(64), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + VAR_SCOPE_ varchar(64) not null, + SEQUENCE_COUNTER_ bigint, + IS_CONCURRENT_LOCAL_ TINYINT, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EVENT_SUBSCR ( + ID_ varchar(64) not null, + REV_ integer, + EVENT_TYPE_ varchar(255) not null, + EVENT_NAME_ varchar(255), + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTIVITY_ID_ varchar(255), + CONFIGURATION_ varchar(255), + CREATED_ timestamp(3) not null, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_INCIDENT ( + ID_ varchar(64) not null, + REV_ integer not null, + INCIDENT_TIMESTAMP_ timestamp(3) not null, + INCIDENT_MSG_ varchar(4000), + INCIDENT_TYPE_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + ACTIVITY_ID_ varchar(255), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CAUSE_INCIDENT_ID_ varchar(64), + ROOT_CAUSE_INCIDENT_ID_ varchar(64), + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_AUTHORIZATION ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ integer not null, + GROUP_ID_ varchar(255), + USER_ID_ varchar(255), + RESOURCE_TYPE_ integer not null, + RESOURCE_ID_ varchar(255), + PERMS_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_FILTER ( + ID_ varchar(64) not null, + REV_ integer not null, + RESOURCE_TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + OWNER_ varchar(255), + QUERY_ LONGTEXT not null, + PROPERTIES_ LONGTEXT, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_METER_LOG ( + ID_ varchar(64) not null, + NAME_ varchar(64) not null, + REPORTER_ varchar(255), + VALUE_ bigint, + TIMESTAMP_ timestamp(3), + MILLISECONDS_ bigint DEFAULT 0, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EXT_TASK ( + ID_ varchar(64) not null, + REV_ integer not null, + WORKER_ID_ varchar(255), + TOPIC_NAME_ varchar(255), + RETRIES_ integer, + ERROR_MSG_ varchar(4000), + ERROR_DETAILS_ID_ varchar(64), + LOCK_EXP_TIME_ timestamp(3) NULL, + SUSPENSION_STATE_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + TENANT_ID_ varchar(64), + PRIORITY_ bigint NOT NULL DEFAULT 0, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_BATCH ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_CREATED_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + SUSPENSION_STATE_ integer, + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_); +create index ACT_IDX_EXEC_TENANT_ID on ACT_RU_EXECUTION(TENANT_ID_); +create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_); +create index ACT_IDX_TASK_ASSIGNEE on ACT_RU_TASK(ASSIGNEE_); +create index ACT_IDX_TASK_TENANT_ID on ACT_RU_TASK(TENANT_ID_); +create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_); +create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_); +create index ACT_IDX_EVENT_SUBSCR_TENANT_ID on ACT_RU_EVENT_SUBSCR(TENANT_ID_); +create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_); +create index ACT_IDX_VARIABLE_TENANT_ID on ACT_RU_VARIABLE(TENANT_ID_); +create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); +create index ACT_IDX_INC_CONFIGURATION on ACT_RU_INCIDENT(CONFIGURATION_); +create index ACT_IDX_INC_TENANT_ID on ACT_RU_INCIDENT(TENANT_ID_); +-- CAM-5914 +create index ACT_IDX_JOB_EXECUTION_ID on ACT_RU_JOB(EXECUTION_ID_); +-- this index needs to be limited in mariadb see CAM-6938 +create index ACT_IDX_JOB_HANDLER on ACT_RU_JOB(HANDLER_TYPE_(100),HANDLER_CFG_(155)); +create index ACT_IDX_JOB_PROCINST on ACT_RU_JOB(PROCESS_INSTANCE_ID_); +create index ACT_IDX_JOB_TENANT_ID on ACT_RU_JOB(TENANT_ID_); +create index ACT_IDX_JOBDEF_TENANT_ID on ACT_RU_JOBDEF(TENANT_ID_); + +-- new metric milliseconds column +CREATE INDEX ACT_IDX_METER_LOG_MS ON ACT_RU_METER_LOG(MILLISECONDS_); +CREATE INDEX ACT_IDX_METER_LOG_NAME_MS ON ACT_RU_METER_LOG(NAME_, MILLISECONDS_); +CREATE INDEX ACT_IDX_METER_LOG_REPORT ON ACT_RU_METER_LOG(NAME_, REPORTER_, MILLISECONDS_); + +-- old metric timestamp column +CREATE INDEX ACT_IDX_METER_LOG_TIME ON ACT_RU_METER_LOG(TIMESTAMP_); +CREATE INDEX ACT_IDX_METER_LOG ON ACT_RU_METER_LOG(NAME_, TIMESTAMP_); + +create index ACT_IDX_EXT_TASK_TOPIC on ACT_RU_EXT_TASK(TOPIC_NAME_); +create index ACT_IDX_EXT_TASK_TENANT_ID on ACT_RU_EXT_TASK(TENANT_ID_); +create index ACT_IDX_EXT_TASK_PRIORITY ON ACT_RU_EXT_TASK(PRIORITY_); +create index ACT_IDX_EXT_TASK_ERR_DETAILS ON ACT_RU_EXT_TASK(ERROR_DETAILS_ID_); +create index ACT_IDX_AUTH_GROUP_ID ON ACT_RU_AUTHORIZATION(GROUP_ID_); +create index ACT_IDX_JOB_JOB_DEF_ID on ACT_RU_JOB(JOB_DEF_ID_); + +alter table ACT_GE_BYTEARRAY + add constraint ACT_FK_BYTEARR_DEPL + foreign key (DEPLOYMENT_ID_) + references ACT_RE_DEPLOYMENT (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade; + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PARENT + foreign key (PARENT_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_SUPER + foreign key (SUPER_EXEC_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_IDENTITYLINK + add constraint ACT_FK_TSKASS_TASK + foreign key (TASK_ID_) + references ACT_RU_TASK (ID_); + +alter table ACT_RU_IDENTITYLINK + add constraint ACT_FK_ATHRZ_PROCEDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF(ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION(ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_BYTEARRAY + foreign key (BYTEARRAY_ID_) + references ACT_GE_BYTEARRAY (ID_); + +alter table ACT_RU_JOB + add constraint ACT_FK_JOB_EXCEPTION + foreign key (EXCEPTION_STACK_ID_) + references ACT_GE_BYTEARRAY (ID_); + +alter table ACT_RU_EVENT_SUBSCR + add constraint ACT_FK_EVENT_EXEC + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION(ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_CAUSE + foreign key (CAUSE_INCIDENT_ID_) + references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_RCAUSE + foreign key (ROOT_CAUSE_INCIDENT_ID_) + references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_ERROR_DETAILS + foreign key (ERROR_DETAILS_ID_) + references ACT_GE_BYTEARRAY (ID_); + +create index ACT_IDX_INC_JOB_DEF on ACT_RU_INCIDENT(JOB_DEF_ID_); +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_JOB_DEF + foreign key (JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +alter table ACT_RU_AUTHORIZATION + add constraint ACT_UNIQ_AUTH_USER + unique (USER_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); + +alter table ACT_RU_AUTHORIZATION + add constraint ACT_UNIQ_AUTH_GROUP + unique (GROUP_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_UNIQ_VARIABLE + unique (VAR_SCOPE_, NAME_); + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_BATCH_SEED_JOB_DEF ON ACT_RU_BATCH(SEED_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_SEED_JOB_DEF + foreign key (SEED_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_MONITOR_JOB_DEF ON ACT_RU_BATCH(MONITOR_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_MONITOR_JOB_DEF + foreign key (MONITOR_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_JOB_DEF ON ACT_RU_BATCH(BATCH_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_JOB_DEF + foreign key (BATCH_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +-- indexes for deadlock problems - https://app.camunda.com/jira/browse/CAM-2567 -- +create index ACT_IDX_INC_CAUSEINCID on ACT_RU_INCIDENT(CAUSE_INCIDENT_ID_); +create index ACT_IDX_INC_EXID on ACT_RU_INCIDENT(EXECUTION_ID_); +create index ACT_IDX_INC_PROCDEFID on ACT_RU_INCIDENT(PROC_DEF_ID_); +create index ACT_IDX_INC_PROCINSTID on ACT_RU_INCIDENT(PROC_INST_ID_); +create index ACT_IDX_INC_ROOTCAUSEINCID on ACT_RU_INCIDENT(ROOT_CAUSE_INCIDENT_ID_); +-- index for deadlock problem - https://app.camunda.com/jira/browse/CAM-4440 -- +create index ACT_IDX_AUTH_RESOURCE_ID on ACT_RU_AUTHORIZATION(RESOURCE_ID_); +-- index to prevent deadlock on fk constraint - https://app.camunda.com/jira/browse/CAM-5440 -- +create index ACT_IDX_EXT_TASK_EXEC on ACT_RU_EXT_TASK(EXECUTION_ID_); + +-- indexes to improve deployment +create index ACT_IDX_BYTEARRAY_NAME on ACT_GE_BYTEARRAY(NAME_); +create index ACT_IDX_DEPLOYMENT_NAME on ACT_RE_DEPLOYMENT(NAME_); +create index ACT_IDX_DEPLOYMENT_TENANT_ID on ACT_RE_DEPLOYMENT(TENANT_ID_); +create index ACT_IDX_JOBDEF_PROC_DEF_ID ON ACT_RU_JOBDEF(PROC_DEF_ID_); +create index ACT_IDX_JOB_HANDLER_TYPE ON ACT_RU_JOB(HANDLER_TYPE_); +create index ACT_IDX_EVENT_SUBSCR_EVT_NAME ON ACT_RU_EVENT_SUBSCR(EVENT_NAME_); +create index ACT_IDX_PROCDEF_DEPLOYMENT_ID ON ACT_RE_PROCDEF(DEPLOYMENT_ID_); +create index ACT_IDX_PROCDEF_TENANT_ID ON ACT_RE_PROCDEF(TENANT_ID_); +create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); +-- create case definition table -- +create table ACT_RE_CASE_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + HISTORY_TTL_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create case execution table -- +create table ACT_RU_CASE_EXECUTION ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CASE_INST_ID_ varchar(64), + SUPER_CASE_EXEC_ varchar(64), + SUPER_EXEC_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + ACT_ID_ varchar(255), + PREV_STATE_ integer, + CURRENT_STATE_ integer, + REQUIRED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create case sentry part table -- + +create table ACT_RU_CASE_SENTRY_PART ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CASE_INST_ID_ varchar(64), + CASE_EXEC_ID_ varchar(64), + SENTRY_ID_ varchar(255), + TYPE_ varchar(255), + SOURCE_CASE_EXEC_ID_ varchar(64), + STANDARD_EVENT_ varchar(255), + SOURCE_ varchar(255), + VARIABLE_EVENT_ varchar(255), + VARIABLE_NAME_ varchar(255), + SATISFIED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create index on business key -- +create index ACT_IDX_CASE_EXEC_BUSKEY on ACT_RU_CASE_EXECUTION(BUSINESS_KEY_); + +-- create foreign key constraints on ACT_RU_CASE_EXECUTION -- +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_) on delete cascade on update cascade; + +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_PARENT + foreign key (PARENT_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_CASE_DEF + foreign key (CASE_DEF_ID_) + references ACT_RE_CASE_DEF(ID_); + +-- create foreign key constraints on ACT_RU_VARIABLE -- +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_CASE_EXE + foreign key (CASE_EXECUTION_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +-- create foreign key constraints on ACT_RU_TASK -- +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_CASE_EXE + foreign key (CASE_EXECUTION_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_CASE_DEF + foreign key (CASE_DEF_ID_) + references ACT_RE_CASE_DEF(ID_); + +-- create foreign key constraints on ACT_RU_CASE_SENTRY_PART -- +alter table ACT_RU_CASE_SENTRY_PART + add constraint ACT_FK_CASE_SENTRY_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_CASE_SENTRY_PART + add constraint ACT_FK_CASE_SENTRY_CASE_EXEC + foreign key (CASE_EXEC_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_); +create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_); +-- create decision definition table -- +create table ACT_RE_DECISION_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + DEC_REQ_ID_ varchar(64), + DEC_REQ_KEY_ varchar(255), + TENANT_ID_ varchar(64), + HISTORY_TTL_ integer, + VERSION_TAG_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create decision requirements definition table -- +create table ACT_RE_DECISION_REQ_DEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) NOT NULL, + VERSION_ integer NOT NULL, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_RE_DECISION_DEF + add constraint ACT_FK_DEC_REQ + foreign key (DEC_REQ_ID_) + references ACT_RE_DECISION_REQ_DEF(ID_); + +create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_); +create index ACT_IDX_DEC_DEF_REQ_ID on ACT_RE_DECISION_DEF(DEC_REQ_ID_); +create index ACT_IDX_DEC_REQ_DEF_TENANT_ID on ACT_RE_DECISION_REQ_DEF(TENANT_ID_); +create table ACT_HI_PROCINST ( + ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + START_USER_ID_ varchar(255), + START_ACT_ID_ varchar(255), + END_ACT_ID_ varchar(255), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + SUPER_CASE_INSTANCE_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + DELETE_REASON_ varchar(4000), + TENANT_ID_ varchar(64), + STATE_ varchar(255), + primary key (ID_), + unique (PROC_INST_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_ACTINST ( + ID_ varchar(64) not null, + PARENT_ACT_INST_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + EXECUTION_ID_ varchar(64) not null, + ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + CALL_CASE_INST_ID_ varchar(64), + ACT_NAME_ varchar(255), + ACT_TYPE_ varchar(255) not null, + ASSIGNEE_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + ACT_INST_STATE_ integer, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_TASKINST ( + ID_ varchar(64) not null, + TASK_DEF_KEY_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + DELETE_REASON_ varchar(4000), + PRIORITY_ integer, + DUE_DATE_ datetime(3), + FOLLOW_UP_DATE_ datetime(3), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_VARINST ( + ID_ varchar(64) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(100), + REV_ integer, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + TENANT_ID_ varchar(64), + STATE_ varchar(20), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_DETAIL ( + ID_ varchar(64) not null, + TYPE_ varchar(255) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + VAR_INST_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(255), + REV_ integer, + TIME_ datetime(3) not null, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + OPERATION_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_IDENTITYLINK ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + TYPE_ varchar(255), + USER_ID_ varchar(255), + GROUP_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + OPERATION_TYPE_ varchar(64), + ASSIGNER_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_COMMENT ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TIME_ datetime(3) not null, + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTION_ varchar(255), + MESSAGE_ varchar(4000), + FULL_MSG_ LONGBLOB, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_ATTACHMENT ( + ID_ varchar(64) not null, + REV_ integer, + USER_ID_ varchar(255), + NAME_ varchar(255), + DESCRIPTION_ varchar(4000), + TYPE_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + URL_ varchar(4000), + CONTENT_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_OP_LOG ( + ID_ varchar(64) not null, + DEPLOYMENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + JOB_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + BATCH_ID_ varchar(64), + USER_ID_ varchar(255), + TIMESTAMP_ timestamp(3) not null, + OPERATION_TYPE_ varchar(64), + OPERATION_ID_ varchar(64), + ENTITY_TYPE_ varchar(30), + PROPERTY_ varchar(64), + ORG_VALUE_ varchar(4000), + NEW_VALUE_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_INCIDENT ( + ID_ varchar(64) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CREATE_TIME_ timestamp(3) not null, + END_TIME_ timestamp(3) null, + INCIDENT_MSG_ varchar(4000), + INCIDENT_TYPE_ varchar(255) not null, + ACTIVITY_ID_ varchar(255), + CAUSE_INCIDENT_ID_ varchar(64), + ROOT_CAUSE_INCIDENT_ID_ varchar(64), + CONFIGURATION_ varchar(255), + INCIDENT_STATE_ integer, + TENANT_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_JOB_LOG ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + JOB_ID_ varchar(64) not null, + JOB_DUEDATE_ timestamp(3) NULL, + JOB_RETRIES_ integer, + JOB_PRIORITY_ bigint NOT NULL DEFAULT 0, + JOB_EXCEPTION_MSG_ varchar(4000), + JOB_EXCEPTION_STACK_ID_ varchar(64), + JOB_STATE_ integer, + JOB_DEF_ID_ varchar(64), + JOB_DEF_TYPE_ varchar(255), + JOB_DEF_CONFIGURATION_ varchar(255), + ACT_ID_ varchar(255), + EXECUTION_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROCESS_DEF_ID_ varchar(64), + PROCESS_DEF_KEY_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_BATCH ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_EXT_TASK_LOG ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + EXT_TASK_ID_ varchar(64) not null, + RETRIES_ integer, + TOPIC_NAME_ varchar(255), + WORKER_ID_ varchar(255), + PRIORITY_ bigint NOT NULL DEFAULT 0, + ERROR_MSG_ varchar(4000), + ERROR_DETAILS_ID_ varchar(64), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + TENANT_ID_ varchar(64), + STATE_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_); +create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_); +create index ACT_IDX_HI_PRO_INST_TENANT_ID on ACT_HI_PROCINST(TENANT_ID_); +create index ACT_IDX_HI_PRO_INST_PROC_DEF_KEY on ACT_HI_PROCINST(PROC_DEF_KEY_); + +create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_); +create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_); +create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_); +create index ACT_IDX_HI_ACT_INST_COMP on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_, END_TIME_, ID_); +create index ACT_IDX_HI_ACT_INST_STATS on ACT_HI_ACTINST(PROC_DEF_ID_, ACT_ID_, END_TIME_, ACT_INST_STATE_); +create index ACT_IDX_HI_ACT_INST_TENANT_ID on ACT_HI_ACTINST(TENANT_ID_); +create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_); + +create index ACT_IDX_HI_TASK_INST_TENANT_ID on ACT_HI_TASKINST(TENANT_ID_); +create index ACT_IDX_HI_TASK_INST_PROC_DEF_KEY on ACT_HI_TASKINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_TASKINST_PROCINST on ACT_HI_TASKINST(PROC_INST_ID_); +create index ACT_IDX_HI_TASKINSTID_PROCINST on ACT_HI_TASKINST(ID_,PROC_INST_ID_); + +create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_); +create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_); +create index ACT_IDX_HI_DETAIL_CASE_INST on ACT_HI_DETAIL(CASE_INST_ID_); +create index ACT_IDX_HI_DETAIL_CASE_EXEC on ACT_HI_DETAIL(CASE_EXECUTION_ID_); +create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_); +create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_); +create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_); +create index ACT_IDX_HI_DETAIL_TENANT_ID on ACT_HI_DETAIL(TENANT_ID_); +create index ACT_IDX_HI_DETAIL_PROC_DEF_KEY on ACT_HI_DETAIL(PROC_DEF_KEY_); +create index ACT_IDX_HI_DETAIL_BYTEAR on ACT_HI_DETAIL(BYTEARRAY_ID_); + +create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); +create index ACT_IDX_HI_IDENT_LNK_GROUP on ACT_HI_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_HI_IDENT_LNK_TENANT_ID on ACT_HI_IDENTITYLINK(TENANT_ID_); +create index ACT_IDX_HI_IDENT_LNK_PROC_DEF_KEY on ACT_HI_IDENTITYLINK(PROC_DEF_KEY_); +create index ACT_IDX_HI_IDENT_LINK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_); + +create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_); +create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_); +create index ACT_IDX_HI_CASEVAR_CASE_INST on ACT_HI_VARINST(CASE_INST_ID_); +create index ACT_IDX_HI_VAR_INST_TENANT_ID on ACT_HI_VARINST(TENANT_ID_); +create index ACT_IDX_HI_VAR_INST_PROC_DEF_KEY on ACT_HI_VARINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_VARINST_BYTEAR on ACT_HI_VARINST(BYTEARRAY_ID_); + +create index ACT_IDX_HI_INCIDENT_TENANT_ID on ACT_HI_INCIDENT(TENANT_ID_); +create index ACT_IDX_HI_INCIDENT_PROC_DEF_KEY on ACT_HI_INCIDENT(PROC_DEF_KEY_); +create index ACT_IDX_HI_INCIDENT_PROCINST on ACT_HI_INCIDENT(PROC_INST_ID_); + +create index ACT_IDX_HI_JOB_LOG_PROCINST on ACT_HI_JOB_LOG(PROCESS_INSTANCE_ID_); +create index ACT_IDX_HI_JOB_LOG_PROCDEF on ACT_HI_JOB_LOG(PROCESS_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_TENANT_ID on ACT_HI_JOB_LOG(TENANT_ID_); +create index ACT_IDX_HI_JOB_LOG_JOB_DEF_ID on ACT_HI_JOB_LOG(JOB_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_PROC_DEF_KEY on ACT_HI_JOB_LOG(PROCESS_DEF_KEY_); +create index ACT_IDX_HI_JOB_LOG_EX_STACK on ACT_HI_JOB_LOG(JOB_EXCEPTION_STACK_ID_); + +create index ACT_HI_EXT_TASK_LOG_PROCINST on ACT_HI_EXT_TASK_LOG(PROC_INST_ID_); +create index ACT_HI_EXT_TASK_LOG_PROCDEF on ACT_HI_EXT_TASK_LOG(PROC_DEF_ID_); +create index ACT_HI_EXT_TASK_LOG_PROC_DEF_KEY on ACT_HI_EXT_TASK_LOG(PROC_DEF_KEY_); +create index ACT_HI_EXT_TASK_LOG_TENANT_ID on ACT_HI_EXT_TASK_LOG(TENANT_ID_); +create index ACT_IDX_HI_EXTTASKLOG_ERRORDET on ACT_HI_EXT_TASK_LOG(ERROR_DETAILS_ID_); + +create index ACT_IDX_HI_OP_LOG_PROCINST on ACT_HI_OP_LOG(PROC_INST_ID_); +create index ACT_IDX_HI_OP_LOG_PROCDEF on ACT_HI_OP_LOG(PROC_DEF_ID_); + +create index ACT_IDX_HI_COMMENT_TASK on ACT_HI_COMMENT(TASK_ID_); +create index ACT_IDX_HI_COMMENT_PROCINST on ACT_HI_COMMENT(PROC_INST_ID_); + +create index ACT_IDX_HI_ATTACHMENT_CONTENT on ACT_HI_ATTACHMENT(CONTENT_ID_); +create index ACT_IDX_HI_ATTACHMENT_PROCINST on ACT_HI_ATTACHMENT(PROC_INST_ID_); +create index ACT_IDX_HI_ATTACHMENT_TASK on ACT_HI_ATTACHMENT(TASK_ID_); +create table ACT_HI_CASEINST ( + ID_ varchar(64) not null, + CASE_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64) not null, + CREATE_TIME_ datetime(3) not null, + CLOSE_TIME_ datetime(3), + DURATION_ bigint, + STATE_ integer, + CREATE_USER_ID_ varchar(255), + SUPER_CASE_INSTANCE_ID_ varchar(64), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_), + unique (CASE_INST_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_CASEACTINST ( + ID_ varchar(64) not null, + PARENT_ACT_INST_ID_ varchar(64), + CASE_DEF_ID_ varchar(64) not null, + CASE_INST_ID_ varchar(64) not null, + CASE_ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + CALL_CASE_INST_ID_ varchar(64), + CASE_ACT_NAME_ varchar(255), + CASE_ACT_TYPE_ varchar(255), + CREATE_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + STATE_ integer, + REQUIRED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_CAS_I_CLOSE on ACT_HI_CASEINST(CLOSE_TIME_); +create index ACT_IDX_HI_CAS_I_BUSKEY on ACT_HI_CASEINST(BUSINESS_KEY_); +create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_); +create index ACT_IDX_HI_CAS_A_I_CREATE on ACT_HI_CASEACTINST(CREATE_TIME_); +create index ACT_IDX_HI_CAS_A_I_END on ACT_HI_CASEACTINST(END_TIME_); +create index ACT_IDX_HI_CAS_A_I_COMP on ACT_HI_CASEACTINST(CASE_ACT_ID_, END_TIME_, ID_); +create index ACT_IDX_HI_CAS_A_I_CASEINST on ACT_HI_CASEACTINST(CASE_INST_ID_, CASE_ACT_ID_); +create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_); +-- create history decision instance table -- +create table ACT_HI_DECINST ( + ID_ varchar(64) NOT NULL, + DEC_DEF_ID_ varchar(64) NOT NULL, + DEC_DEF_KEY_ varchar(255) NOT NULL, + DEC_DEF_NAME_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + EVAL_TIME_ datetime(3) not null, + COLLECT_VALUE_ double, + USER_ID_ varchar(255), + ROOT_DEC_INST_ID_ varchar(64), + DEC_REQ_ID_ varchar(64), + DEC_REQ_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision input table -- +create table ACT_HI_DEC_IN ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64), + CLAUSE_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision output table -- +create table ACT_HI_DEC_OUT ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64), + CLAUSE_NAME_ varchar(255), + RULE_ID_ varchar(64), + RULE_ORDER_ integer, + VAR_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + + +create index ACT_IDX_HI_DEC_INST_ID on ACT_HI_DECINST(DEC_DEF_ID_); +create index ACT_IDX_HI_DEC_INST_KEY on ACT_HI_DECINST(DEC_DEF_KEY_); +create index ACT_IDX_HI_DEC_INST_PI on ACT_HI_DECINST(PROC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_CI on ACT_HI_DECINST(CASE_INST_ID_); +create index ACT_IDX_HI_DEC_INST_ACT on ACT_HI_DECINST(ACT_ID_); +create index ACT_IDX_HI_DEC_INST_ACT_INST on ACT_HI_DECINST(ACT_INST_ID_); +create index ACT_IDX_HI_DEC_INST_TIME on ACT_HI_DECINST(EVAL_TIME_); +create index ACT_IDX_HI_DEC_INST_TENANT_ID on ACT_HI_DECINST(TENANT_ID_); +create index ACT_IDX_HI_DEC_INST_ROOT_ID on ACT_HI_DECINST(ROOT_DEC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_REQ_ID on ACT_HI_DECINST(DEC_REQ_ID_); +create index ACT_IDX_HI_DEC_INST_REQ_KEY on ACT_HI_DECINST(DEC_REQ_KEY_); + + +create index ACT_IDX_HI_DEC_IN_INST on ACT_HI_DEC_IN(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_IN_CLAUSE on ACT_HI_DEC_IN(DEC_INST_ID_, CLAUSE_ID_); + +create index ACT_IDX_HI_DEC_OUT_INST on ACT_HI_DEC_OUT(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_OUT_RULE on ACT_HI_DEC_OUT(RULE_ORDER_, CLAUSE_ID_); + +-- mariadb_identity_7.8.0-ee + +create table ACT_ID_GROUP ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + TYPE_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_MEMBERSHIP ( + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (USER_ID_, GROUP_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_USER ( + ID_ varchar(64), + REV_ integer, + FIRST_ varchar(255), + LAST_ varchar(255), + EMAIL_ varchar(255), + PWD_ varchar(255), + SALT_ varchar(255), + PICTURE_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_INFO ( + ID_ varchar(64), + REV_ integer, + USER_ID_ varchar(64), + TYPE_ varchar(64), + KEY_ varchar(255), + VALUE_ varchar(255), + PASSWORD_ LONGBLOB, + PARENT_ID_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT_MEMBER ( + ID_ varchar(64) not null, + TENANT_ID_ varchar(64) not null, + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_ID_MEMBERSHIP + add constraint ACT_FK_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + +alter table ACT_ID_MEMBERSHIP + add constraint ACT_FK_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_USER + unique (TENANT_ID_, USER_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_GROUP + unique (TENANT_ID_, GROUP_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB + foreign key (TENANT_ID_) + references ACT_ID_TENANT (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncCallbackErrorResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncCallbackErrorResponse.xml index 136917c5ff..24b7988db1 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/sdncCallbackErrorResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncCallbackErrorResponse.xml @@ -1 +1 @@ -1a152f97-566e-4f22-b17b-761f807bfedc404Error processing request to SDNC. Not Found. https://sdncodl.it.us.aic.cip.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET. SDNC Returned-[error-type:application, error-tag:data-missing, error-message:Request could not be completed because the relevant data model content does not exist.] \ No newline at end of file +1a152f97-566e-4f22-b17b-761f807bfedc404Error processing request to SDNC. Not Found. https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET. SDNC Returned-[error-type:application, error-tag:data-missing, error-message:Request could not be completed because the relevant data model content does not exist.] \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncDeleteResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncDeleteResponse.xml index c8a2e30282..6e4f4160ec 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/sdncDeleteResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncDeleteResponse.xml @@ -1,212 +1,212 @@ - - - - - - Y - SK-2016-10-22-001 - - - SUCCESS - ERROR - - - 15001417 - - ALPRTR2 - 1.1.1.2 - - 1255.ae81 - VDBE - VIRTUAL - - ALPVDBE1 - 3.1.1.0/22 - ae81 - 3:1:1::0/22 - - - 1995.ae81 - ASBG - VIRTUAL - - ALPASBG1 - 3.1.1.0/22 - ae81 - 3:1:1::0/22 - - - 85.xe-10/0/2 - BGF2 - PHYSICAL - xe-10/0/2 - ALPBGF2 - 3.1.2.0/22 - - 3:1:2::0/22 - - - 85.xe-10/0/1 - BGF1 - PHYSICAL - xe-10/0/1 - ALPBGF1 - 3.1.2.0/22 - - 3:1:2::0/22 - - 2 - - - ALPRTR1 - 1.1.1.1 - - 1255.ae81 - VDBE - VIRTUAL - - ALPVDBE1 - 3.1.1.0/22 - ae81 - 3:1:1::0/22 - - - 1995.ae81 - ASBG - VIRTUAL - - ALPASBG1 - 3.1.1.0/22 - ae81 - 3:1:1::0/22 - - - 85.xe-10/0/2 - BGF2 - PHYSICAL - xe-10/0/2 - ALPBGF2 - 3.1.2.0/22 - - 3:1:2::0/22 - - - 85.xe-10/0/1 - BGF1 - PHYSICAL - xe-10/0/1 - ALPBGF1 - 3.1.2.0/22 - - 3:1:2::0/22 - - 1 - - - - 15001418 - - SANRTR1 - 2.1.1.1 - - 1255.ae81 - VDBE - VIRTUAL - - SANVDBE1 - 4.1.1.0/22 - ae81 - 4:1:1::0/22 - - - 1995.ae81 - ASBG - VIRTUAL - - SANASBG1 - 4.1.1.0/22 - ae81 - 4:1:1::0/22 - - - 85.xe-10/0/2 - BGF2 - PHYSICAL - xe-10/0/2 - SANBGF2 - 4.1.2.0/22 - - 4:1:2::0/22 - - - 85.xe-10/0/1 - BGF1 - PHYSICAL - xe-10/0/1 - SANBGF1 - 4.1.2.0/22 - - 4:1:2::0/22 - - 1 - - - SANRTR2 - 2.1.1.2 - - 1255.ae81 - VDBE - VIRTUAL - - SANVDBE1 - 4.1.1.0/22 - ae81 - 4:1:1::0/22 - - - 1995.ae81 - ASBG - VIRTUAL - - SANASBG1 - 4.1.1.0/22 - ae81 - 4:1:1::0/22 - - - 85.xe-10/0/2 - BGF2 - PHYSICAL - xe-10/0/2 - SANBGF2 - 4.1.2.0/22 - - 4:1:2::0/22 - - - 85.xe-10/0/1 - BGF1 - PHYSICAL - xe-10/0/1 - SANBGF1 - 4.1.2.0/22 - - 4:1:2::0/22 - - 2 - - - COLLABORATE - DISABLE - custid-888 - SII-2016-10-22-001 - CUSTOMER - 100668 - - - - + + + + + + Y + SK-2016-10-22-001 + + + SUCCESS + ERROR + + + 15001417 + + ALPRTR2 + 1.1.1.2 + + 1255.ae81 + VDBE + VIRTUAL + + ALPVDBE1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + ALPASBG1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + ALPBGF2 + 3.1.2.0/22 + + 3:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + ALPBGF1 + 3.1.2.0/22 + + 3:1:2::0/22 + + 2 + + + ALPRTR1 + 1.1.1.1 + + 1255.ae81 + VDBE + VIRTUAL + + ALPVDBE1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + ALPASBG1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + ALPBGF2 + 3.1.2.0/22 + + 3:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + ALPBGF1 + 3.1.2.0/22 + + 3:1:2::0/22 + + 1 + + + + 15001418 + + SANRTR1 + 2.1.1.1 + + 1255.ae81 + VDBE + VIRTUAL + + SANVDBE1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + SANASBG1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + SANBGF2 + 4.1.2.0/22 + + 4:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + SANBGF1 + 4.1.2.0/22 + + 4:1:2::0/22 + + 1 + + + SANRTR2 + 2.1.1.2 + + 1255.ae81 + VDBE + VIRTUAL + + SANVDBE1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + SANASBG1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + SANBGF2 + 4.1.2.0/22 + + 4:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + SANBGF1 + 4.1.2.0/22 + + 4:1:2::0/22 + + 2 + + + COLLABORATE + DISABLE + custid-888 + SII-2016-10-22-001 + CUSTOMER + 100668 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdnc_adapter_data_request.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdnc_adapter_data_request.xml index 24fe72c62e..6962946ab2 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/sdnc_adapter_data_request.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdnc_adapter_data_request.xml @@ -1,33 +1,33 @@ - - - ca424e60-cb22-43c5-88f9-ed68e17cebe2 - MSO - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - - - de19ae10-9a25-11e7-abc4-cec278b6b50a - ee938612-9a25-11e7-abc4-cec278b6b50a - 1.0 - MSOTADevInfra_Configuration_Service - - 14c5c14f-6caf-4028-9788-bb5ec9e8f9b8 - - MSO_1610_dev - - - MSO-DEV-SI-1802-PCM-926-100 - - - paramName - paramValue - - - + + + ca424e60-cb22-43c5-88f9-ed68e17cebe2 + MSO + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + + + de19ae10-9a25-11e7-abc4-cec278b6b50a + ee938612-9a25-11e7-abc4-cec278b6b50a + 1.0 + MSOTADevInfra_Configuration_Service + + 14c5c14f-6caf-4028-9788-bb5ec9e8f9b8 + + MSO_1610_dev + + + MSO-DEV-SI-1802-PCM-926-100 + + + paramName + paramValue + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdnc_adapter_request.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdnc_adapter_request.xml index 2ecd36d68b..17ba0cee65 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/sdnc_adapter_request.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdnc_adapter_request.xml @@ -1,7 +1,7 @@ + xmlns:ns5="http://org.onap/so/request/types/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1"> 3a77913d-6d36-4507-8c6d-ab523af21fbf 14c5c14f-6caf-4028-9788-bb5ec9e8f9b8 @@ -24,12 +24,12 @@ serviceId-test subscriptionServiceType-test - + modelInvariantUuid-test modelUuid-test modelVersion-test modelName-test - + serviceInstanceId-test globalSubscriberId-test diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest.xml index 754dc20ee6..21cf3460a9 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest.xml @@ -1,342 +1,342 @@ - - - 2f7d1b38-2b78-4ef2-8ad6-1552d88620fa - 200 - OK - - <layer3-service-list xmlns="com:att:sdnctl:l3api"> - <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> - <service-status> - <rpc-name>service-configuration-operation</rpc-name> - <rpc-action>activate</rpc-action> - <request-status>synccomplete</request-status> - <final-indicator>N</final-indicator> - <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> - <l3sdn-subaction>SUPP</l3sdn-subaction> - <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> - </service-status> - <service-data> - <internet-evc-access-information> - <ip-version>ds</ip-version> - <internet-evc-speed-value>8</internet-evc-speed-value> - <internet-evc-speed-units>Mbps</internet-evc-speed-units> - </internet-evc-access-information> - <vr-lan xmlns="com:att:sdnctl:l3api"> - <vr-lan-interface> - <static-routes> - <v6-static-routes> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> - <v6-static-route-prefix-length>28</v6-static-route-prefix-length> - </v6-static-routes> - <v4-static-routes> - <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-static-route-prefix-length>28</v4-static-route-prefix-length> - </v4-static-routes> - <v6-static-routes> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> - <v6-static-route-prefix-length>28</v6-static-route-prefix-length> - </v6-static-routes> - <v4-static-routes> - <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-static-route-prefix-length>28</v4-static-route-prefix-length> - </v4-static-routes> - <v4-static-routes> - <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-static-route-prefix-length>28</v4-static-route-prefix-length> - </v4-static-routes> - </static-routes> - <dhcp> - <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> - <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> - <use-v6-default-pool>N</use-v6-default-pool> - <excluded-v4-dhcp-addresses-from-default-pool> - <excluded-v4-address>192.168.1.7</excluded-v4-address> - </excluded-v4-dhcp-addresses-from-default-pool> - <excluded-v4-dhcp-addresses-from-default-pool> - <excluded-v4-address>192.168.1.8</excluded-v4-address> - </excluded-v4-dhcp-addresses-from-default-pool> - <v4-dhcp-pools> - <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> - <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.5</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.6</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> - </v4-dhcp-pools> - <v4-dhcp-pools> - <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> - <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.6</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.7</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> - </v4-dhcp-pools> - <use-v4-default-pool>Y</use-v4-default-pool> - <excluded-v6-dhcp-addresses-from-default-pool> - <excluded-v6-address>1:5</excluded-v6-address> - </excluded-v6-dhcp-addresses-from-default-pool> - <excluded-v6-dhcp-addresses-from-default-pool> - <excluded-v6-address>1:6</excluded-v6-address> - </excluded-v6-dhcp-addresses-from-default-pool> - <v6-dhcp-pools> - <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> - <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> - <excluded-v6-addresses> - <excluded-v6-address>1:1</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> - <excluded-v6-addresses> - <excluded-v6-address>2:2</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> - </v6-dhcp-pools> - <v6-dhcp-pools> - <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> - <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> - <excluded-v6-addresses> - <excluded-v6-address>1:1</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> - <excluded-v6-addresses> - <excluded-v6-address>2:2</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> - </v6-dhcp-pools> - </dhcp> - <firewall-lite> - <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> - <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> - <v4-firewall-packet-filters> - <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> - <v4-firewall-prefix-length>1</v4-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>1</port-number> - </udp-ports> - <tcp-ports> - <port-number>1</port-number> - </tcp-ports> - </v4-firewall-packet-filters> - <v4-firewall-packet-filters> - <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> - <v4-firewall-prefix-length>2</v4-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>2</port-number> - </udp-ports> - <tcp-ports> - <port-number>2</port-number> - </tcp-ports> - </v4-firewall-packet-filters> - <v6-firewall-packet-filters> - <v6-firewall-prefix>:</v6-firewall-prefix> - <v6-firewall-prefix-length>0</v6-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>3</port-number> - </udp-ports> - <tcp-ports> - <port-number>3</port-number> - </tcp-ports> - </v6-firewall-packet-filters> - <v6-firewall-packet-filters> - <v6-firewall-prefix>:</v6-firewall-prefix> - <v6-firewall-prefix-length>1</v6-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>4</port-number> - </udp-ports> - <tcp-ports> - <port-number>4</port-number> - </tcp-ports> - </v6-firewall-packet-filters> - </firewall-lite> - <pat> - <v4-pat-pools> - <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> - <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> - <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> - </v4-pat-pools> - <use-v4-default-pool>Y</use-v4-default-pool> - <v4-pat-enabled>N</v4-pat-enabled> - <v4-pat-pools> - <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> - <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> - <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> - </v4-pat-pools> - </pat> - <nat> - <v4-nat-enabled>Y</v4-nat-enabled> - <v4-nat-mapping-entries> - <v4-nat-internal>0.0.0.0</v4-nat-internal> - <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> - <v4-nat-external>0.0.0.0</v4-nat-external> - </v4-nat-mapping-entries> - <v4-nat-mapping-entries> - <v4-nat-internal>0.0.0.1</v4-nat-internal> - <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> - <v4-nat-external>0.0.0.1</v4-nat-external> - </v4-nat-mapping-entries> - </nat> - <vr-designation>primary</vr-designation> - <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> - <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> - <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> - <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> - <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> - <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> - <v4-public-lan-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.2</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.72</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.68</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - </v4-public-lan-prefixes> - <v6-public-lan-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - </v6-public-lan-prefixes> - </vr-lan-interface> - <routing-protocol>none</routing-protocol> - </vr-lan> -<ucpe-vms-service-information> - <transport-service-information> - <transport-service-type>AVPN</transport-service-type> - <access-circuit-info> - <access-circuit-id>1</access-circuit-id> - <dual-mode>Active</dual-mode> - </access-circuit-info> - <access-circuit-info> - <access-circuit-id>2</access-circuit-id> - <dual-mode>Standby</dual-mode> - </access-circuit-info> - </transport-service-information> - <ucpe-information> - <ucpe-host-name>hostname</ucpe-host-name> - <ucpe-activation-code>activecode</ucpe-activation-code> - <out-of-band-management-modem>OOB</out-of-band-management-modem> - </ucpe-information> - <vnf-list> - <vnf-information> - <vnf-instance-id>1</vnf-instance-id> - <vnf-sequence-number>1</vnf-sequence-number> - <vnf-type>ZZ</vnf-type> - <vnf-vendor>JUNIPER</vnf-vendor> - <vnf-model>MODEL1</vnf-model> - <vnf-id>1</vnf-id> - <prov-status>1</prov-status> - <operational-state>1</operational-state> - <orchestration-status>1</orchestration-status> - <equipment-role>1</equipment-role> - </vnf-information> - <vnf-information> - <vnf-instance-id>2</vnf-instance-id> - <vnf-sequence-number>2</vnf-sequence-number> - <vnf-type>HY</vnf-type> - <vnf-vendor>JUNIPER</vnf-vendor> - <vnf-model>MODEL2</vnf-model> - <vnf-id>2</vnf-id> - <prov-status>2</prov-status> - <operational-state>2</operational-state> - <orchestration-status>2</orchestration-status> - <equipment-role>2</equipment-role> - </vnf-information> - </vnf-list> - </ucpe-vms-service-information> - <request-information> - <request-action>Layer3ServiceActivateRequest</request-action> - <order-number>4281555</order-number> - <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> - <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> - <source>OMX</source> - <order-version>1</order-version> - </request-information> - <sdnc-request-header> - <svc-action>activate</svc-action> - <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.com:8443/adapters/rest/SDNCNotify</svc-notification-url> - <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> - </sdnc-request-header> - <l2-homing-information> - <topology>MultiPoint</topology> - <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> - <evc-name>AS/VLXM/003717//SW</evc-name> - </l2-homing-information> - <service-information> - <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> - <subscriber-name>FOUR SEASONS HEATING & COOLING_8310006378683</subscriber-name> - <service-type>SDN-ETHERNET-INTERNET</service-type> - </service-information> - <internet-service-change-details> - <internet-evc-speed-value>10</internet-evc-speed-value> - <internet-evc-speed-units>Kbps</internet-evc-speed-units> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>2</request-index> - <v4-next-hop-address>192.168.1.16</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - </internet-service-change-details> - </service-data> - </layer3-service-list> - - + + + 2f7d1b38-2b78-4ef2-8ad6-1552d88620fa + 200 + OK + + <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <vr-lan xmlns="com:att:sdnctl:l3api"> + <vr-lan-interface> + <static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + </static-routes> + <dhcp> + <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> + <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> + <use-v6-default-pool>N</use-v6-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.8</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.5</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:5</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:6</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + </dhcp> + <firewall-lite> + <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> + <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> + <v4-firewall-prefix-length>1</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>1</port-number> + </udp-ports> + <tcp-ports> + <port-number>1</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> + <v4-firewall-prefix-length>2</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>2</port-number> + </udp-ports> + <tcp-ports> + <port-number>2</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>0</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>3</port-number> + </udp-ports> + <tcp-ports> + <port-number>3</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>1</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>4</port-number> + </udp-ports> + <tcp-ports> + <port-number>4</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + </firewall-lite> + <pat> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> + </v4-pat-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <v4-pat-enabled>N</v4-pat-enabled> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> + </v4-pat-pools> + </pat> + <nat> + <v4-nat-enabled>Y</v4-nat-enabled> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.0</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.0</v4-nat-external> + </v4-nat-mapping-entries> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.1</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.1</v4-nat-external> + </v4-nat-mapping-entries> + </nat> + <vr-designation>primary</vr-designation> + <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> + <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> + <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> + <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> + <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> + <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> + <v4-public-lan-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.2</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.72</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.68</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + </v4-public-lan-prefixes> + <v6-public-lan-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </v6-public-lan-prefixes> + </vr-lan-interface> + <routing-protocol>none</routing-protocol> + </vr-lan> +<ucpe-vms-service-information> + <transport-service-information> + <transport-service-type>AVPN</transport-service-type> + <access-circuit-info> + <access-circuit-id>1</access-circuit-id> + <dual-mode>Active</dual-mode> + </access-circuit-info> + <access-circuit-info> + <access-circuit-id>2</access-circuit-id> + <dual-mode>Standby</dual-mode> + </access-circuit-info> + </transport-service-information> + <ucpe-information> + <ucpe-host-name>hostname</ucpe-host-name> + <ucpe-activation-code>activecode</ucpe-activation-code> + <out-of-band-management-modem>OOB</out-of-band-management-modem> + </ucpe-information> + <vnf-list> + <vnf-information> + <vnf-instance-id>1</vnf-instance-id> + <vnf-sequence-number>1</vnf-sequence-number> + <vnf-type>ZZ</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL1</vnf-model> + <vnf-id>1</vnf-id> + <prov-status>1</prov-status> + <operational-state>1</operational-state> + <orchestration-status>1</orchestration-status> + <equipment-role>1</equipment-role> + </vnf-information> + <vnf-information> + <vnf-instance-id>2</vnf-instance-id> + <vnf-sequence-number>2</vnf-sequence-number> + <vnf-type>HY</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL2</vnf-model> + <vnf-id>2</vnf-id> + <prov-status>2</prov-status> + <operational-state>2</operational-state> + <orchestration-status>2</orchestration-status> + <equipment-role>2</equipment-role> + </vnf-information> + </vnf-list> + </ucpe-vms-service-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> + <source>OMX</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>https://localhost:8443/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>FOUR SEASONS HEATING &amp; COOLING_8310006378683</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + <internet-service-change-details> + <internet-evc-speed-value>10</internet-evc-speed-value> + <internet-evc-speed-units>Kbps</internet-evc-speed-units> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>2</request-index> + <v4-next-hop-address>192.168.1.16</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </internet-service-change-details> + </service-data> + </layer3-service-list> + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_404CallBack.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_404CallBack.xml index aa481ea600..7873fd49d2 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_404CallBack.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_404CallBack.xml @@ -1,13 +1,13 @@ - - - - 39542e39-ccc3-4d1a-8b79-04ce88526613 - 404 - Error processing request to SDNC. Not Found. - https://sdncodl.us.aic.cip.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. - SDNC Returned-[error-type:application, error-tag:data-missing, - error-message:Request could not be completed because the relevant - data model content does not exist.] - + + + + 39542e39-ccc3-4d1a-8b79-04ce88526613 + 404 + Error processing request to SDNC. Not Found. + https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist.] + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_with_aic_version.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_with_aic_version.xml new file mode 100644 index 0000000000..7ce81f1caf --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_with_aic_version.xml @@ -0,0 +1,345 @@ + + + 2f7d1b38-2b78-4ef2-8ad6-1552d88620fa + 200 + OK + + <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <vr-lan xmlns="com:att:sdnctl:l3api"> + <vr-lan-interface> + <static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + </static-routes> + <dhcp> + <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> + <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> + <use-v6-default-pool>N</use-v6-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.8</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.5</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:5</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:6</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + </dhcp> + <firewall-lite> + <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> + <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> + <v4-firewall-prefix-length>1</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>1</port-number> + </udp-ports> + <tcp-ports> + <port-number>1</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> + <v4-firewall-prefix-length>2</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>2</port-number> + </udp-ports> + <tcp-ports> + <port-number>2</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>0</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>3</port-number> + </udp-ports> + <tcp-ports> + <port-number>3</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>1</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>4</port-number> + </udp-ports> + <tcp-ports> + <port-number>4</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + </firewall-lite> + <pat> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> + </v4-pat-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <v4-pat-enabled>N</v4-pat-enabled> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> + </v4-pat-pools> + </pat> + <nat> + <v4-nat-enabled>Y</v4-nat-enabled> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.0</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.0</v4-nat-external> + </v4-nat-mapping-entries> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.1</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.1</v4-nat-external> + </v4-nat-mapping-entries> + </nat> + <vr-designation>primary</vr-designation> + <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> + <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> + <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> + <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> + <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> + <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> + <v4-public-lan-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.2</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.72</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.68</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + </v4-public-lan-prefixes> + <v6-public-lan-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </v6-public-lan-prefixes> + </vr-lan-interface> + <routing-protocol>none</routing-protocol> + </vr-lan> +<ucpe-vms-service-information> + <transport-service-information> + <transport-service-type>AVPN</transport-service-type> + <access-circuit-info> + <access-circuit-id>1</access-circuit-id> + <dual-mode>Active</dual-mode> + </access-circuit-info> + <access-circuit-info> + <access-circuit-id>2</access-circuit-id> + <dual-mode>Standby</dual-mode> + </access-circuit-info> + </transport-service-information> + <ucpe-information> + <ucpe-host-name>hostname</ucpe-host-name> + <ucpe-activation-code>activecode</ucpe-activation-code> + <out-of-band-management-modem>OOB</out-of-band-management-modem> + </ucpe-information> + <vnf-list> + <vnf-information> + <vnf-instance-id>1</vnf-instance-id> + <vnf-sequence-number>1</vnf-sequence-number> + <vnf-type>ZZ</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL1</vnf-model> + <vnf-id>1</vnf-id> + <prov-status>1</prov-status> + <operational-state>1</operational-state> + <orchestration-status>1</orchestration-status> + <equipment-role>1</equipment-role> + </vnf-information> + <vnf-information> + <vnf-instance-id>2</vnf-instance-id> + <vnf-sequence-number>2</vnf-sequence-number> + <vnf-type>HY</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL2</vnf-model> + <vnf-id>2</vnf-id> + <prov-status>2</prov-status> + <operational-state>2</operational-state> + <orchestration-status>2</orchestration-status> + <equipment-role>2</equipment-role> + </vnf-information> + </vnf-list> + </ucpe-vms-service-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> + <source>OMX</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>https://localhost:8443/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> + <aic-version>2.5</aic-version> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>FOUR SEASONS HEATING &amp; COOLING_8310006378683</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + <internet-service-change-details> + <internet-evc-speed-value>10</internet-evc-speed-value> + <internet-evc-speed-units>Kbps</internet-evc-speed-units> + <v4-vr-lan-address>10.10.7.14</v4-vr-lan-address> + <v4-vr-lan-prefix-length>10</v4-vr-lan-prefix-length> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>2</request-index> + <v4-next-hop-address>192.168.1.16</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </internet-service-change-details> + </service-data> + </layer3-service-list> + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest-act.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest-act.xml index 231898adfa..77babba7f7 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest-act.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest-act.xml @@ -1,7 +1,7 @@ + xmlns:v1="http://org.onap/so/workflow/schema/v1" + xmlns:v11="http://org.onap/workflow/sdnc/adapter/schema/v1"> @@ -13,7 +13,7 @@ - + 12570a36-7388-4c0a-bec4-189ce3kg9956 Layer3ServiceActivate diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest.xml index f71f529593..8cbcce138f 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest.xml @@ -1,7 +1,7 @@ + xmlns:v1="http://org.onap/so/workflow/schema/v1" + xmlns:v11="http://org.onap/workflow/sdnc/adapter/schema/v1"> @@ -13,7 +13,7 @@ - + 12570a36-7388-4c0a-bec4-189ce3kg9956 GetLayer3ServiceDetailsRequest diff --git a/bpmn/MSOCommonBPMN/src/test/resources/testAsyncResource.bpmn b/bpmn/MSOCommonBPMN/src/test/resources/testAsyncResource.bpmn index e5498e4d2b..5f9a6f52af 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/testAsyncResource.bpmn +++ b/bpmn/MSOCommonBPMN/src/test/resources/testAsyncResource.bpmn @@ -10,7 +10,7 @@ SequenceFlow_1 SequenceFlow_9 + xmlns:v1="http://org.onap.so/vnfNotify"> - + testRequestId true diff --git a/bpmn/MSOCoreBPMN/pom.xml b/bpmn/MSOCoreBPMN/pom.xml index 2f9d574ae1..fc686e503c 100644 --- a/bpmn/MSOCoreBPMN/pom.xml +++ b/bpmn/MSOCoreBPMN/pom.xml @@ -1,134 +1,111 @@ - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + org.onap.so - bpmn - 1.2.0-SNAPSHOT - - 4.0.0 - MSOCoreBPMN - jar + bpmn + 1.3.0-SNAPSHOT + + 4.0.0 + MSOCoreBPMN + jar - - - - org.apache.maven.plugins - maven-compiler-plugin - - - test-compile - compile - - testCompile - - - false - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.0.2 - - - tests-jar - package - - test-jar - - - false - - - - - - + + + + org.apache.maven.plugins + maven-compiler-plugin + + + test-compile + compile + + testCompile + + + false + + + + - + + org.apache.maven.plugins + maven-jar-plugin + 3.0.2 + + + tests-jar + package + + test-jar + + + false + + + + + + - - - org.camunda.bpm - camunda-engine - provided - - - org.camunda.bpm - camunda-engine-rest - classes - - - - commons-fileupload - commons-fileupload - - - - - - commons-fileupload - commons-fileupload + + + + commons-fileupload + commons-fileupload 1.3.3 - - - javax.servlet - javax.servlet-api - 3.0.1 - provided - - - - org.camunda.connect - camunda-connect-connectors-all - compile - - - org.camunda.template-engines - camunda-template-engines-freemarker - - - org.camunda.bpm - camunda-engine-plugin-spin - - - - - org.camunda.spin - camunda-spin-dataformat-all - - - org.camunda.bpm - camunda-engine-plugin-connect - - - org.codehaus.groovy - groovy-all - compile - - - com.h2database - h2 - test - - - net.sf.saxon - Saxon-HE - - + + + javax.servlet + javax.servlet-api + 3.0.1 + provided + + + org.camunda.connect + camunda-connect-connectors-all + 1.0.5 + + + org.camunda.bpm + camunda-engine-plugin-connect + 7.7.0 + + + org.camunda.bpm + camunda-engine + 7.7.0 + + + org.codehaus.groovy + groovy-all + compile + + + com.h2database + h2 + test + + + net.sf.saxon + Saxon-HE + + org.onap.so - common - ${project.version} - - - org.json - json - 20160212 - + common + ${project.version} + + + org.json + json + 20160212 + + + org.xmlunit + xmlunit-core + test + com.github.fge json-schema-validator @@ -139,27 +116,13 @@ json-schema-core 1.2.4 - - org.xmlunit - xmlunit-core - 2.5.1 - test - - - org.onap.so - status-control - ${project.version} - - org.onap.so - mso-api-handler-common - ${project.version} + org.springframework + spring-beans - - org.assertj - assertj-core - 3.8.0 - test - + + org.yaml + snakeyaml + diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java new file mode 100644 index 0000000000..286526445c --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.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.bpmn.core; + +import org.onap.so.logger.MsoLogger; +import org.jboss.logging.MDC; + +public class BPMNLogger { + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BPMNLogger.class); + + public static void debug (String isDebugLogEnabled, String LogText) { + msoLogger.debug(LogText); + } + + +} + diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BadInjectedFieldException.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BadInjectedFieldException.java new file mode 100644 index 0000000000..3002d0e70a --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BadInjectedFieldException.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.bpmn.core; + +public class BadInjectedFieldException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + /** + * Constructor. + * + * @param fieldName the field name + * @param taskName the task name + * @param info additional information, e.g. the field value + */ + public BadInjectedFieldException(String fieldName, String taskName, + Object info) { + super(taskName + " injected field '" + fieldName + "' is bad: " + info); + } + + /** + * Constructor. + * + * @param fieldName the field name + * @param taskName the task name + * @param info additional information, e.g. the field value + * @param cause the cause + */ + public BadInjectedFieldException(String fieldName, + String taskName, Object info, Throwable cause) { + super(taskName + " injected field '" + fieldName + "' is bad: " + + info, cause); + } +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java new file mode 100644 index 0000000000..99157410d5 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java @@ -0,0 +1,454 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.Expression; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.onap.so.bpmn.core.internal.VariableNameExtractor; + +/** + * Base class for service tasks. + */ +public class BaseTask implements JavaDelegate { + + /** + * Get the value of a required field. This method throws + * MissingInjectedFieldException if the expression is null, and + * BadInjectedFieldException if the expression evaluates to a null + * value. + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the field value + */ + protected Object getField(Expression expression, + DelegateExecution execution, String fieldName) { + return getFieldImpl(expression, execution, fieldName, false); + } + + /** + * Gets the value of an optional field. There are three conditions + * in which this method returns null: + *

+ *

    + *
  1. The expression itself is null (i.e. the field is missing + * altogether.
  2. + *
  3. The expression evaluates to a null value.
  4. + *
  5. The expression references a single variable which has not + * been set.
  6. + *
+ *

+ * Examples:
+ * Expression ${x} when x is null: return null
+ * Expression ${x} when x is unset: return null
+ * Expression ${x+y} when x and/or y are unset: exception
+ * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the field value, possibly null + */ + protected Object getOptionalField(Expression expression, + DelegateExecution execution, String fieldName) { + return getFieldImpl(expression, execution, fieldName, true); + } + + /** + * Get the value of a required output variable field. This method + * throws MissingInjectedFieldException if the expression is null, and + * BadInjectedFieldException if the expression produces a null or + * illegal variable name. Legal variable names contain only letters, + * numbers, and the underscore character ('_'). + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the output variable name + */ + protected String getOutputField(Expression expression, + DelegateExecution execution, String fieldName) { + Object o = getFieldImpl(expression, execution, fieldName, false); + if (o instanceof String) { + String variable = (String) o; + if (!isLegalVariable(variable)) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "'" + variable + + "' is not a legal variable name"); + } + return variable; + } else { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "expected a variable name string" + + ", got object of type " + o.getClass().getName()); + } + } + + /** + * Get the value of an optional output variable field. This method + * throws BadInjectedFieldException if the expression produces an illegal + * variable name. Legal variable names contain only letters, numbers, + * and the underscore character ('_'). + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the output variable name, possibly null + */ + protected String getOptionalOutputField(Expression expression, + DelegateExecution execution, String fieldName) { + Object o = getFieldImpl(expression, execution, fieldName, true); + if (o instanceof String) { + String variable = (String) o; + if (!isLegalVariable(variable)) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "'" + variable + + "' is not a legal variable name"); + } + return variable; + } else if (o == null) { + return null; + } else { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "expected a variable name string" + + ", got object of type " + o.getClass().getName()); + } + } + + /** + * Get the value of a required string field. This method throws + * MissingInjectedFieldException if the expression is null, and + * BadInjectedFieldException if the expression evaluates to a null + * value. + *

+ * Note: the result is coerced to a string value, if necessary. + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the field value + */ + protected String getStringField(Expression expression, + DelegateExecution execution, String fieldName) { + Object o = getFieldImpl(expression, execution, fieldName, false); + if (o instanceof String) { + return (String) o; + } else { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "cannot convert '" + o.toString() + + "' to Integer"); + } + } + + /** + * Gets the value of an optional string field. There are three conditions + * in which this method returns null: + *

+ *

    + *
  1. The expression itself is null (i.e. the field is missing + * altogether.
  2. + *
  3. The expression evaluates to a null value.
  4. + *
  5. The expression references a single variable which has not + * been set.
  6. + *
+ *

+ * Examples:
+ * Expression ${x} when x is null: return null
+ * Expression ${x} when x is unset: return null
+ * Expression ${x+y} when x and/or y are unset: exception
+ *

+ * Note: the result is coerced to a string value, if necessary. + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the field value, possibly null + */ + protected String getOptionalStringField(Expression expression, + DelegateExecution execution, String fieldName) { + Object o = getFieldImpl(expression, execution, fieldName, true); + if (o instanceof String) { + return (String) o; + } else if (o == null) { + return null; + } else { + return o.toString(); + } + } + + /** + * Get the value of a required integer field. This method throws + * MissingInjectedFieldException if the expression is null, and + * BadInjectedFieldException if the expression evaluates to a null + * value or a value that cannot be coerced to an integer. + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the field value + */ + protected Integer getIntegerField(Expression expression, + DelegateExecution execution, String fieldName) { + Object o = getFieldImpl(expression, execution, fieldName, false); + if (o instanceof Integer) { + return (Integer) o; + } else { + try { + return Integer.parseInt(o.toString()); + } catch (NumberFormatException e) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "cannot convert '" + o.toString() + + "' to Integer"); + } + } + } + + /** + * Gets the value of an optional integer field. There are three conditions + * in which this method returns null: + *

+ *

    + *
  1. The expression itself is null (i.e. the field is missing + * altogether.
  2. + *
  3. The expression evaluates to a null value.
  4. + *
  5. The expression references a single variable which has not + * been set.
  6. + *
+ *

+ * Examples:
+ * Expression ${x} when x is null: return null
+ * Expression ${x} when x is unset: return null
+ * Expression ${x+y} when x and/or y are unset: exception
+ *

+ * Note: the result is coerced to an integer value, if necessary. This + * method throws BadInjectedFieldException if the result cannot be coerced + * to an integer. + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the field value, possibly null + */ + protected Integer getOptionalIntegerField(Expression expression, + DelegateExecution execution, String fieldName) { + Object o = getFieldImpl(expression, execution, fieldName, true); + if (o instanceof Integer) { + return (Integer) o; + } else if (o == null) { + return null; + } else { + try { + return Integer.parseInt(o.toString()); + } catch (NumberFormatException e) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "cannot convert '" + o.toString() + + "' to Integer"); + } + } + } + + /** + * Gets the value of an optional long field. There are three conditions + * in which this method returns null: + *

+ *

    + *
  1. The expression itself is null (i.e. the field is missing + * altogether.
  2. + *
  3. The expression evaluates to a null value.
  4. + *
  5. The expression references a single variable which has not + * been set.
  6. + *
+ *

+ * Examples:
+ * Expression ${x} when x is null: return null
+ * Expression ${x} when x is unset: return null
+ * Expression ${x+y} when x and/or y are unset: exception
+ *

+ * Note: the result is coerced to a long value, if necessary. This + * method throws BadInjectedFieldException if the result cannot be coerced + * to a long. + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the field value, possibly null + */ + protected Long getOptionalLongField(Expression expression, + DelegateExecution execution, String fieldName) { + Object o = getFieldImpl(expression, execution, fieldName, true); + if (o instanceof Long) { + return (Long) o; + } else if (o == null) { + return null; + } else { + try { + return Long.parseLong(o.toString()); + } catch (NumberFormatException e) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "cannot convert '" + o.toString() + + "' to Long"); + } + } + } + + /** + * Get the value of a required long field. This method throws + * MissingInjectedFieldException if the expression is null, and + * BadInjectedFieldException if the expression evaluates to a null + * value or a value that cannot be coerced to a long. + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the field value + */ + protected Long getLongField(Expression expression, + DelegateExecution execution, String fieldName) { + Object o = getFieldImpl(expression, execution, fieldName, false); + if (o instanceof Long) { + return (Long) o; + } else { + try { + return Long.parseLong(o.toString()); + } catch (NumberFormatException e) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "cannot convert '" + o.toString() + + "' to Long"); + } + } + } + + /** + * Common implementation for field "getter" methods. + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @param optional true if the field is optional + * @return the field value, possibly null + */ + private Object getFieldImpl(Expression expression, + DelegateExecution execution, String fieldName, boolean optional) { + if (expression == null) { + if (!optional) { + throw new MissingInjectedFieldException( + fieldName, getTaskName()); + } + return null; + } + + Object value = null; + + try { + value = expression.getValue(execution); + } catch (Exception e) { + if (!optional) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), e.getClass().getSimpleName(), e); + } + + // At this point, we have an exception that occurred while + // evaluating an expression for an optional field. A common + // problem is that the expression is a simple reference to a + // variable which has never been set, e.g. the expression is + // ${x}. The normal activiti behavior is to throw an exception, + // but we don't like that, so we have the following workaround, + // which parses the expression text to see if it is a "simple" + // variable reference, and if so, returns null. If the + // expression is anything other than a single variable + // reference, then an exception is thrown, as it would have + // been without this workaround. + + // Get the expression text so we can parse it + String s = expression.getExpressionText(); + new VariableNameExtractor(s).extract().ifPresent(name -> { + if (execution.hasVariable(name)) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), e.getClass().getSimpleName(), e); + } + }); + } + + if (value == null && !optional) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "required field has null value"); + } + + return value; + } + + /** + * Tests if a character is a "word" character. + * + * @param c the character + * @return true if the character is a "word" character. + */ + private static boolean isWordCharacter(char c) { + return (Character.isLetterOrDigit(c) || c == '_'); + } + + /** + * Tests if the specified string is a legal flow variable name. + * + * @param name the string + * @return true if the string is a legal flow variable name + */ + private boolean isLegalVariable(String name) { + if (name == null) { + return false; + } + + int len = name.length(); + + if (len == 0) { + return false; + } + + char c = name.charAt(0); + + if (!Character.isLetter(c) && c != '_') { + return false; + } + + for (int i = 1; i < len; i++) { + c = name.charAt(i); + if (!Character.isLetterOrDigit(c) && c != '_') { + return false; + } + } + + return true; + } + + /** + * Returns the name of the task (normally the java class name). + * + * @return the name of the task + */ + public String getTaskName() { + return getClass().getSimpleName(); + } + + @Override + public void execute(DelegateExecution execution) throws Exception { + } +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/MissingInjectedFieldException.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/MissingInjectedFieldException.java new file mode 100644 index 0000000000..17a78d37b8 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/MissingInjectedFieldException.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.bpmn.core; + +/** + * A BadInjectedFieldException that indicates a required field is missing. + */ +public class MissingInjectedFieldException extends BadInjectedFieldException { + + private static final long serialVersionUID = 1L; + + /** + * Constructor. + * + * @param fieldName the field name + * @param taskName the task name + */ + public MissingInjectedFieldException(String fieldName, String taskName) { + super(fieldName, taskName, "missing required field"); + } +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java new file mode 100644 index 0000000000..6166071437 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.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.bpmn.core; + +import org.camunda.bpm.engine.delegate.DelegateExecution; + +/** + * Used in the output variable mapping configuration of subflow call activity + * tasks to normalize subflow responses. The output mapping is normally set up + * as follows. Note that the order of these mappings is important! + *

+ * OUTPUT MAPPING + *

+ *   SOURCE EXPRESSION                                      TARGET
+ *   ${ResponseBuilder.buildWorkflowException(execution)}   WorkflowException
+ *   ${ResponseBuilder.buildWorkflowResponse(execution)}    SomeResponseVariable
+ * 
+ */ +public class ResponseBuilder implements java.io.Serializable { + private static final long serialVersionUID = 1L; + + /** + * Creates a WorkflowException using data from the execution variables. + * If the variables do not indicate that there was an error, null + * is returned. + * @param execution the execution + */ + public WorkflowException buildWorkflowException(DelegateExecution execution) { + + String method = getClass().getSimpleName() + ".buildWorkflowException(" + + "execution=" + execution.getId() + + ")"; + String isDebugLogEnabled = (String) execution.getVariable("isDebugLogEnabled"); + logDebug("Entered " + method, isDebugLogEnabled); + + String prefix = (String) execution.getVariable("prefix"); + String processKey = getProcessKey(execution); + + logDebug("processKey=" + processKey, isDebugLogEnabled); + + // See if there"s already a WorkflowException object in the execution. + WorkflowException theException = (WorkflowException) execution.getVariable("WorkflowException"); + + if (theException != null) { + logDebug("Exited " + method + " - propagated " + theException, isDebugLogEnabled); + return theException; + } + + // Look in the legacy variables: ErrorResponse and ResponseCode + + String errorResponse = trimString(execution.getVariable(prefix + "ErrorResponse"), null); + String responseCode = trimString(execution.getVariable(prefix + "ResponseCode"), null); + logDebug("errorResponse=" + errorResponse, isDebugLogEnabled); + logDebug("responseCode=" + responseCode, isDebugLogEnabled); + if (errorResponse != null || !isOneOf(responseCode, null, "0", "200", "201", "202", "204")) { + // This is an error condition. We need to return a WorkflowExcpetion + + if (errorResponse == null) { + // No errorResponse string. See if there"s something in the Response variable + String response = trimString(execution.getVariable(processKey + "Response"), null); + if (response == null) { + errorResponse = "Received response code " + responseCode + " from " + processKey; + } else { + errorResponse = response; + } + } + + // Some subflows may try to return a WorkflowException as XML in the + // errorResponse. If provided, use the errorCode and errorMessage + // from the XML + + String maybeXML = removeXMLNamespaces(errorResponse); + + String xmlErrorMessage = trimString(getXMLTextElement(maybeXML, "ErrorMessage"), null); + String xmlErrorCode = trimString(getXMLTextElement(maybeXML, "ErrorCode"), null); + + if (xmlErrorMessage != null || xmlErrorCode != null) { + logDebug("xmlErrorMessage=" + xmlErrorMessage, isDebugLogEnabled); + logDebug("xmlErrorCode=" + xmlErrorCode, isDebugLogEnabled); + + if (xmlErrorMessage == null) { + errorResponse = "Received error code " + xmlErrorCode + " from " + processKey; + } else { + errorResponse = xmlErrorMessage; + } + + if (xmlErrorCode != null) { + responseCode = xmlErrorCode; + } + } + + // Convert the responseCode to an integer + + int intResponseCode; + + try { + intResponseCode = Integer.valueOf(responseCode); + } catch (NumberFormatException e) { + // Internal Error + intResponseCode = 2000; + } + + // Convert 3-digit HTTP response codes (we should not be using them here) + // to appropriate 4-digit response codes + + if (intResponseCode < 1000) { + if (intResponseCode >= 400 && intResponseCode <= 499) { + // Invalid Message + intResponseCode = 1002; + } else { + // Internal Error + intResponseCode = 2000; + } + } + + // Create a new WorkflowException object + + theException = new WorkflowException(processKey, intResponseCode, errorResponse); + execution.setVariable("WorkflowException", theException); + logDebug("Exited " + method + " - created " + theException, isDebugLogEnabled); + return theException; + } + + logDebug("Exited " + method + " - no WorkflowException", isDebugLogEnabled); + return null; + } + + /** + * Returns the "Response" variable, unless the execution variables + * indicate there was an error. In that case, null is returned. + * @param execution the execution + */ + public Object buildWorkflowResponse(DelegateExecution execution) { + + String method = getClass().getSimpleName() + ".buildWorkflowResponse(" + + "execution=" + execution.getId() + + ")"; + String isDebugLogEnabled = (String) execution.getVariable("isDebugLogEnabled"); + logDebug("Entered " + method, isDebugLogEnabled); + + String prefix = (String) execution.getVariable("prefix"); + String processKey = getProcessKey(execution); + + Object theResponse = null; + + WorkflowException theException = (WorkflowException) execution.getVariable("WorkflowException"); + String errorResponse = trimString(execution.getVariable(prefix + "ErrorResponse"), null); + String responseCode = trimString(execution.getVariable(prefix + "ResponseCode"), null); + + if (theException == null && errorResponse == null && + isOneOf(responseCode, null, "0", "200", "201", "202", "204")) { + + theResponse = execution.getVariable("WorkflowResponse"); + + if (theResponse == null) { + theResponse = execution.getVariable(processKey + "Response"); + } + } + + logDebug("Exited " + method, isDebugLogEnabled); + return theResponse; + } + + /** + * Checks if the specified item is one of the specified values. + * @param item the item + * @param values the list of values + * @return true if the item is in the list of values + */ + private boolean isOneOf(Object item, Object ... values) { + if (values == null) { + return item == null; + } + + for (Object value : values) { + if (value == null) { + if (item == null) { + return true; + } + } else { + if (value.equals(item)) { + return true; + } + } + } + + return false; + } + + /** + * Creates a string value of the specified object, trimming whitespace in + * the process. If the result is null or empty, the specified empty string + * value is returned. Otherwise the trimmed value is returned. This method + * helps ensure consistent treatment of empty and null strings. + * @param object the object to convert (possibly null) + * @param emptyStringValue the desired value for empty results + */ + private String trimString(Object object, String emptyStringValue) { + if (object == null) { + return emptyStringValue; + } + + String s = String.valueOf(object).trim(); + return s.equals("") ? emptyStringValue : s; + } + + /** + * Returns the process definition key (i.e. the process name) from the + * execution. + * @param execution the execution + */ + private String getProcessKey(DelegateExecution execution) { + Object testKey = execution.getVariable("testProcessKey"); + + if (testKey instanceof String) { + return (String) testKey; + } + + return execution.getProcessEngineServices().getRepositoryService() + .getProcessDefinition(execution.getProcessDefinitionId()).getKey(); + } + + /** + * Logs a message at the DEBUG level. + * @param message the message + * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled + */ + private void logDebug(String message, String isDebugLogEnabled) { + BPMNLogger.debug(isDebugLogEnabled, message); + } + + /** + * Removes namespace definitions and prefixes from XML, if any. + */ + private String removeXMLNamespaces(String xml) { + // remove xmlns declaration + xml = xml.replaceAll("xmlns.*?(\"|\').*?(\"|\')", ""); + + // remove opening tag prefix + xml = xml.replaceAll("(<)(\\w+:)(.*?>)", "$1$3"); + + // remove closing tags prefix + xml = xml.replaceAll("()", "$1$3"); + + // remove extra spaces left when xmlns declarations are removed + xml = xml.replaceAll("\\s+>", ">"); + + return xml; + } + + /** + * Extracts text from an XML element. This method is not namespace aware + * (namespaces are ignored). The first matching element is selected. + * @param xml the XML document or fragment + * @param tag the desired element, e.g. "" + * @return the element text, or null if the element was not found + */ + private String getXMLTextElement(String xml, String tag) { + xml = removeXMLNamespaces(xml); + + if (!tag.startsWith("<")) { + tag = "<" + tag + ">"; + } + + int start = xml.indexOf(tag); + + if (start == -1) { + return null; + } + + int end = xml.indexOf('<', start + tag.length()); + + if (end == -1) { + return null; + } + + return xml.substring(start + tag.length(), end); + } +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/RollbackData.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/RollbackData.java new file mode 100644 index 0000000000..9c80548490 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/RollbackData.java @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * An object that stores data for rollbacks. Data is organized by type. A + * type is simply a string identifier. Multiple types of data may be stored + * in the same object for separate rollback operations. + */ +public class RollbackData implements Serializable { + + private static final long serialVersionUID = 1L; + + private Map> dictionary = + new HashMap<>(); + + /** + * Returns true if the specified type is stored in this object. + * + * @param type the data type + */ + public boolean hasType(String type) { + return dictionary.containsKey(type); + } + + /** + * Stores a single item. + * + * @param type the data type + * @param key the key + * @param value the value + */ + public void put(String type, String key, String value) { + Map mapForType = dictionary + .computeIfAbsent(type, k -> new HashMap<>()); + + mapForType.put(key, value); + } + + /** + * Gets a single item. + * + * @param type the data type + * @param key the key + * @return the item or null if there is no item for the specified type and key + */ + public Serializable get(String type, String key) { + Map mapForType = dictionary.get(type); + + if (mapForType == null) { + return null; + } + + return mapForType.get(key); + } + + /** + * Gets a map containing all items associated with the specified data type. + * + * @param type the data type + * @return a map, or null if there are no items associated with the specified data type + */ + public Map get(String type) { + return dictionary.get(type); + } + + /** + * Returns a string representation of this object. + */ + @Override + public String toString() { + return dictionary.entrySet().stream().map(entry -> entry.getKey() + entry.getValue()) + .collect(Collectors.joining(",", "[", "]")); + } +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java new file mode 100644 index 0000000000..968c8c1590 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.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.bpmn.core; + +import java.util.Optional; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + + +/** + * Read the URN property value from the execution object or from the spring environment object + */ +@Component +@Configuration +public class UrnPropertiesReader { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,UrnPropertiesReader.class); + private static Environment environment; + + @Autowired + public void setEnvironment(Environment environment) { + this.environment = environment; + } + /** + * Return the URN property value + * if property is present in the execution object, return the same + * else search in the environment object. If found, add it to the execution object and return the value + * otherwise return null + * + * @param variableName URN property name + * @param execution The flow's execution instance. + * @return URN property value + */ + public static String getVariable(String variableName, DelegateExecution execution) { + Object value = execution.getVariable(variableName); + if (value != null) { + LOGGER.trace("Retrieved value for the URN variable, " + variableName + ", from the execution object: " + String.valueOf(value)); + return String.valueOf(value); + } + String variableValue = null; + if (environment != null && environment.getProperty(variableName) != null) { + variableValue = environment.getProperty(variableName); + LOGGER.trace("Retrieved value for the URN variable, " + variableName + ", from the environment variable: " + variableValue); + execution.setVariable(variableName, variableValue); + return variableValue; + } + return variableValue; + } + + /** + * Return the URN property value from the environment object + * @param variableName URN property name + * @return URN property value + */ + + public static String getVariable(String variableName){ + if (environment != null) { + return environment.getProperty(variableName); + } else { + return null; + } + } + + public static String getVariable(String variableName, String defaultValue) { + return Optional.ofNullable(getVariable(variableName)).orElse(defaultValue); + } +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java new file mode 100644 index 0000000000..8551007795 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core; + +import java.io.Serializable; + +/** + * An object that represents a workflow exception. + */ +public class WorkflowException implements Serializable { + private static final long serialVersionUID = 1L; + + private final String processKey; + private final int errorCode; + private final String errorMessage; + private final String workStep; + + /** + * Constructor + * @param processKey the process key for the process that generated the exception + * @param errorCode the numeric error code (normally 1xxx or greater) + * @param errorMessage a short error message + */ + public WorkflowException(String processKey, int errorCode, + String errorMessage) { + this.processKey = processKey; + this.errorCode = errorCode; + this.errorMessage = errorMessage; + workStep = "*"; + } + + public WorkflowException(String processKey, int errorCode, + String errorMessage, String workStep) { + this.processKey = processKey; + this.errorCode = errorCode; + this.errorMessage = errorMessage; + this.workStep = workStep; + } + + /** + * Returns the process key. + */ + public String getProcessKey() { + return processKey; + } + + /** + * Returns the error code. + */ + public int getErrorCode() { + return errorCode; + } + + /** + * Returns the error message. + */ + public String getErrorMessage() { + return errorMessage; + } + + /** + * Returns the error message. + */ + public String getWorkStep() { + return workStep; + } + + /** + * Returns a string representation of this object. + */ + @Override + public String toString() { + return getClass().getSimpleName() + "[processKey=" + getProcessKey() + ",errorCode=" + getErrorCode() + + ",errorMessage=" + getErrorMessage() + ",workStep=" + getWorkStep() + "]"; + } +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java new file mode 100644 index 0000000000..f143346cae --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java @@ -0,0 +1,122 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.domain; + +import java.util.UUID; + +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * Stores allotted-resource information + * + */ +@JsonRootName("allottedResource") +public class AllottedResource extends Resource { + + private static final long serialVersionUID = 1L; + + /* + * set resourceType for this object + */ + public AllottedResource(){ + resourceType = ResourceType.ALLOTTED_RESOURCE; + setResourceId(UUID.randomUUID().toString()); + } + + /* + * fields specific to Allotted Resource resource type + */ + private String allottedResourceType; + private String allottedResourceRole; + private String providingServiceModelName; + private String providingServiceModelInvariantUuid; + private String providingServiceModelUuid; + private String nfFunction; + private String nfType; + private String nfRole; + private String nfNamingCode; + private String orchestrationStatus; + + /* + * GET and SET + */ + public String getAllottedResourceType() { + return allottedResourceType; + } + public void setAllottedResourceType(String allottedResourceType) { + this.allottedResourceType = allottedResourceType; + } + public String getAllottedResourceRole() { + return allottedResourceRole; + } + public void setAllottedResourceRole(String allottedResourceRole) { + this.allottedResourceRole = allottedResourceRole; + } + public String getProvidingServiceModelName() { + return providingServiceModelName; + } + public void setProvidingServiceModelName(String providingServiceModelName) { + this.providingServiceModelName = providingServiceModelName; + } + public String getProvidingServiceModelInvariantUuid() { + return providingServiceModelInvariantUuid; + } + public void setProvidingServiceModelInvariantUuid( + String providingServiceModelInvariantUuid) { + this.providingServiceModelInvariantUuid = providingServiceModelInvariantUuid; + } + public String getProvidingServiceModelUuid() { + return providingServiceModelUuid; + } + public void setProvidingServiceModelUuid(String providingServiceModelUuid) { + this.providingServiceModelUuid = providingServiceModelUuid; + } + public String getNfFunction() { + return nfFunction; + } + public void setNfFunction(String nfFunction) { + this.nfFunction = nfFunction; + } + public String getNfType() { + return nfType; + } + public void setNfType(String nfType) { + this.nfType = nfType; + } + public String getNfRole() { + return nfRole; + } + public void setNfRole(String nfRole) { + this.nfRole = nfRole; + } + public String getNfNamingCode() { + return nfNamingCode; + } + public void setNfNamingCode(String nfNamingCode) { + this.nfNamingCode = nfNamingCode; + } + public String getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(String orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CloudFlavor.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CloudFlavor.java new file mode 100644 index 0000000000..7160a2f333 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CloudFlavor.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Intel Corp. Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.domain; + +import java.io.Serializable; + +/** + * Stores Cloud Flavor information and is an attribute + * of a HomingSolution + * + */ +public class CloudFlavor extends JsonWrapper implements Serializable { + + private static final long serialVersionUID = 8423934332773299577L; + private String flavorLabel; + private String flavor; + + public CloudFlavor (String flavorLabel, String flavor){ + this.flavorLabel = flavorLabel; + this.flavor = flavor; + } + + public String getFlavorLabel() { + return flavorLabel; + } + + public void setFlavorLabel(String flavorLabel) { + this.flavorLabel = flavorLabel; + } + + public String getFlavor() { + return flavor; + } + + public void setFlavor(String flavor) { + this.flavor = flavor; + } + +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CompareModelsResult.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CompareModelsResult.java new file mode 100644 index 0000000000..bb50597c31 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CompareModelsResult.java @@ -0,0 +1,53 @@ +/*- + * ============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.bpmn.core.domain; + +import java.io.Serializable; +import java.util.List; + +public class CompareModelsResult extends JsonWrapper implements Serializable +{ + private static final long serialVersionUID = 1L; + + List addedResourceList; + List deletedResourceList; + List requestInputs; + + public List getAddedResourceList() { + return addedResourceList; + } + public void setAddedResourceList(List addedResourceList) { + this.addedResourceList = addedResourceList; + } + public List getDeletedResourceList() { + return deletedResourceList; + } + public void setDeletedResourceList(List deletedResourceList) { + this.deletedResourceList = deletedResourceList; + } + public List getRequestInputs() { + return requestInputs; + } + public void setRequestInputs(List requestInputs) { + this.requestInputs = requestInputs; + } + +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ConfigResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ConfigResource.java new file mode 100644 index 0000000000..1a8a1d83d9 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ConfigResource.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.bpmn.core.domain; + +import java.util.UUID; + +import com.fasterxml.jackson.annotation.JsonRootName; + + +@JsonRootName("configResource") +public class ConfigResource extends Resource { + + private static final long serialVersionUID = 1L; + + /* + * set resourceType for this object + */ + public ConfigResource(){ + resourceType = ResourceType.CONFIGURATION; + setResourceId(UUID.randomUUID().toString()); + } + + /* + * fields specific to Config Resource resource type + */ + +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Configuration.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Configuration.java new file mode 100644 index 0000000000..815d85692e --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Configuration.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.bpmn.core.domain; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * Stores configuration information and modeled off + * of the AAI configuration object + * + */ +@JsonRootName("configuration") +public class Configuration extends JsonWrapper implements Serializable{ + + private static final long serialVersionUID = 1L; + + private String id; + private String name; + private String type; + private String orchestrationStatus; + private String tunnelBandwidth; + private String vendorAllowedMaxBandwidth; + private String resourceVersion; + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public String getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(String orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public String getTunnelBandwidth() { + return tunnelBandwidth; + } + public void setTunnelBandwidth(String tunnelBandwidth) { + this.tunnelBandwidth = tunnelBandwidth; + } + public String getVendorAllowedMaxBandwidth() { + return vendorAllowedMaxBandwidth; + } + public void setVendorAllowedMaxBandwidth(String vendorAllowedMaxBandwidth) { + this.vendorAllowedMaxBandwidth = vendorAllowedMaxBandwidth; + } + public String getResourceVersion() { + return resourceVersion; + } + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Customer.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Customer.java new file mode 100644 index 0000000000..ca6d35cf46 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Customer.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.bpmn.core.domain; + +import java.io.Serializable; +/** + * This class is used to store customer + * data of services aka ServiceDecomposition + * + * @author bb3476 + * + */ + +public class Customer extends JsonWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + private String subscriptionServiceType; + private String globalSubscriberId; + + + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java new file mode 100644 index 0000000000..57e6864943 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java @@ -0,0 +1,155 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.domain; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * Stores resources placement and licensing information + * + */ +@JsonRootName("homingSolution") +@JsonInclude(JsonInclude.Include.NON_NULL) +public class HomingSolution extends JsonWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + + private InventoryType inventoryType; + private boolean isRehome; + private String serviceInstanceId; //TODO should start using si object instead + private String cloudOwner; + private String cloudRegionId; + private String aicClli; + private String aicVersion; + private String tenant; + private VnfResource vnf; + private List flavors; + private License license = new License(); + + + /** + * @return the inventoryType which indicates the solution type + */ + public InventoryType getInventoryType() { + return inventoryType; + } + + public void setInventoryType(InventoryType inventoryType) { + this.inventoryType = inventoryType; + } + public boolean isRehome() { + return isRehome; + } + public void setRehome(boolean isRehome) { + this.isRehome = isRehome; + } + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + public String getCloudOwner() { + return cloudOwner; + } + + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + + public String getCloudRegionId() { + return cloudRegionId; + } + + public void setCloudRegionId(String cloudRegionId) { + this.cloudRegionId = cloudRegionId; + } + /** + * @return the aicClli (aka aic site, physical location id) + */ + public String getAicClli() { + return aicClli; + } + + public void setAicClli(String aicClli) { + this.aicClli = aicClli; + } + + public String getAicVersion() { + return aicVersion; + } + + public void setAicVersion(String aicVersion) { + this.aicVersion = aicVersion; + } + + public String getTenant() { + return tenant; + } + + public void setTenant(String tenant) { + this.tenant = tenant; + } + + /** + * @return the vnf that the resource was homed too. + */ + public VnfResource getVnf() { + return vnf; + } + + public void setVnf(VnfResource vnf) { + this.vnf = vnf; + } + + /** + * @return a map key is label name, value is any flavor + */ + public List getFlavors() { + return flavors; + } + + public void setFlavors(List flavors) { + this.flavors = flavors; + } + + public License getLicense() { + return license; + } + + public void setLicense(License license) { + this.license = license; + } + + + public static long getSerialversionuid() { + return serialVersionUID; + } + + +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/InventoryType.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/InventoryType.java new file mode 100644 index 0000000000..e56ca76b2b --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/InventoryType.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.bpmn.core.domain; + +public enum InventoryType{ + + cloud("CLOUD"), + service("SERVICE"); + + private String type; + + InventoryType(String type){ + this.type = type; + } + + public String type(){ + return type; + } +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java new file mode 100644 index 0000000000..a725933024 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java @@ -0,0 +1,134 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.domain; + +import java.io.IOException; +import java.io.Serializable; +import java.util.List; + +import org.json.JSONException; +import org.json.JSONObject; + +import com.fasterxml.jackson.annotation.JsonInclude; +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; +import com.fasterxml.jackson.databind.ObjectWriter; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +import org.onap.so.logger.MsoLogger; +//import com.fasterxml.jackson.map.SerializationFeature; + + +/** + * Wrapper encapsulates needed JSON functionality + * to be extended by MSO service decomposition objects + * providing ways to convert to and from JSON + * + */ +@JsonInclude(Include.NON_NULL) +public abstract class JsonWrapper implements Serializable { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, JsonWrapper.class); + @JsonInclude(Include.NON_NULL) + public String toJsonString(){ + + String jsonString = ""; + //convert with Jackson + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + + mapper.setSerializationInclusion(Include.NON_NULL); + + ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter(); + try { + jsonString = ow.writeValueAsString(this); + } catch (Exception e){ + + LOGGER.debug("Exception :",e); + } + return jsonString; + } + + @JsonInclude(Include.NON_NULL) + public JSONObject toJsonObject(){ + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + JSONObject json = new JSONObject(); + try { + json = new JSONObject(mapper.writeValueAsString(this)); + } catch (JsonGenerationException e) { + LOGGER.debug("Exception :",e); + } catch (JsonMappingException e) { + LOGGER.debug("Exception :",e); + } catch (JSONException e) { + LOGGER.debug("Exception :",e); + } catch (IOException e) { + LOGGER.debug("Exception :",e); + } + return json; + } + + public String listToJson(List list) { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + + String jsonString = ""; + try { + jsonString = mapper.writeValueAsString(list); + } catch (JsonGenerationException e) { + LOGGER.debug("Exception :",e); + } catch (JsonMappingException e) { + LOGGER.debug("Exception :",e); + } catch (IOException e) { + LOGGER.debug("Exception :",e); + } + return jsonString; + } + + @JsonInclude(Include.NON_NULL) + public String toJsonStringNoRootName(){ + + String jsonString = ""; + //convert with Jackson + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + + ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter(); + try { + jsonString = ow.writeValueAsString(this); + } catch (Exception e){ + + LOGGER.debug("Exception :",e); + } + return jsonString; + } + + /** + * Returns a string representation of this object. + */ + public String toString() { + return this.toJsonString(); + } +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/License.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/License.java new file mode 100644 index 0000000000..93dfd4f1f1 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/License.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.bpmn.core.domain; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.json.JSONArray; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * Stores licensing information and is an attribute + * of a HomingSolution + * + */ +@JsonRootName("license") +@JsonInclude(JsonInclude.Include.NON_EMPTY) +public class License extends JsonWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List entitlementPoolList = new ArrayList(); + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List licenseKeyGroupList = new ArrayList(); + + + public List getEntitlementPoolList() { + return entitlementPoolList; + } + + public void setEntitlementPoolList(List entitlementPoolList) { + this.entitlementPoolList = entitlementPoolList; + } + + public List getLicenseKeyGroupList() { + return licenseKeyGroupList; + } + + public void setLicenseKeyGroupList(List licenseKeyGroupList) { + this.licenseKeyGroupList = licenseKeyGroupList; + } + + /** + * This method adds a Entitlement Pool Uuid + * to the EntitlementPoolList + * + * @param the EntitlementPoolUuid + */ + public void addEntitlementPool(String entitlementPoolUuid) { + entitlementPoolList.add(entitlementPoolUuid); + } + + /** + * This method adds a License Key Group Uuid + * to the LicenseKeyGroupList + * + * @param the licenseKeyGroupUuid + */ + public void addLicenseKeyGroup(String licenseKeyGroupUuid) { + licenseKeyGroupList.add(licenseKeyGroupUuid); + } + + /** + * This method returns the licenseKeyGroupList + * as a json array + * + * @return the strList + */ + @JsonIgnore + public JSONArray getLicenseKeyGroupListAsString() { + JSONArray array = new JSONArray(licenseKeyGroupList); + return array; + } + + /** + * This method returns the entitlementPoolList + * as a json array + * + * @return the strList + */ + @JsonIgnore + public JSONArray getEntitlementPoolListAsString() { + JSONArray array = new JSONArray(entitlementPoolList); + return array; + } + + /** + * @return the serialversionuid + */ + public static long getSerialversionuid() { + return serialVersionUID; + } + +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ModelInfo.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ModelInfo.java new file mode 100644 index 0000000000..983fe50d88 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ModelInfo.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.bpmn.core.domain; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("modelInfo") +public class ModelInfo extends JsonWrapper implements Serializable { + + /** + * This is domain object defining structure for MODEL INFO + * It will be valid for each Resource type object + */ + private static final long serialVersionUID = 1L; + + private String modelName = ""; + private String modelUuid = ""; + private String modelInvariantUuid = ""; + private String modelVersion = ""; + //additionally on resource level + private String modelCustomizationUuid = ""; + private String modelCustomizationName = ""; + private String modelInstanceName = ""; + private String modelType = ""; + + //GET and SET methods + + public String getModelName() { + return modelName; + } + public void setModelName(String modelName) { + this.modelName = modelName; + } + public String getModelUuid() { + return modelUuid; + } + public void setModelUuid(String modelUuid) { + this.modelUuid = modelUuid; + } + public String getModelInvariantUuid() { + return modelInvariantUuid; + } + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + public String getModelVersion() { + return modelVersion; + } + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + public String getModelCustomizationUuid() { + return modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public String getModelCustomizationName() { + return modelCustomizationName; + } + public void setModelCustomizationName(String modelCustomizationName) { + this.modelCustomizationName = modelCustomizationName; + } + public String getModelInstanceName() { + return modelInstanceName; + } + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + public String getModelType() { + return modelType; + } + public void setModelType(String modelType) { + this.modelType = modelType; + } + +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ModuleResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ModuleResource.java new file mode 100644 index 0000000000..459d203325 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ModuleResource.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.domain; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("vfModule") +public class ModuleResource extends Resource { + + private static final long serialVersionUID = 1L; + + /* + * set resourceType for this object + */ + public ModuleResource(){ + resourceType = ResourceType.MODULE; + } + + /* + * fields specific to VF Module resource type + */ + private String vfModuleName; + private String vfModuleType; + private String heatStackId; + private boolean hasVolumeGroup; + private boolean isBase; + private String vfModuleLabel; + private int initialCount; + + /* + * GET && SET + */ + public String getVfModuleName() { + return vfModuleName; + } + public void setVfModuleName(String vfModuleName) { + this.vfModuleName = vfModuleName; + } + public String getHeatStackId() { + return heatStackId; + } + public void setHeatStackId(String heatStackId) { + this.heatStackId = heatStackId; + } + public boolean getIsBase() { + return isBase; + } + public void setIsBase(boolean isBase) { + this.isBase = isBase; + } + public String getVfModuleLabel() { + return vfModuleLabel; + } + public void setVfModuleLabel(String vfModuleLabel) { + this.vfModuleLabel = vfModuleLabel; + } + public int getInitialCount() { + return initialCount; + } + public void setInitialCount(int initialCount) { + this.initialCount = initialCount; + } + public String getVfModuleType() { + return vfModuleType; + } + public void setVfModuleType(String vfModuleType) { + this.vfModuleType = vfModuleType; + } + public boolean isHasVolumeGroup() { + return hasVolumeGroup; + } + public void setHasVolumeGroup(boolean hasVolumeGroup) { + this.hasVolumeGroup = hasVolumeGroup; + } + +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java new file mode 100644 index 0000000000..20ab3ecc84 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.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.bpmn.core.domain; + +import java.util.UUID; + +import com.fasterxml.jackson.annotation.JsonRootName; + + +/** + * Encapsulates Network resource data set + * + */ +@JsonRootName("networkResource") +public class NetworkResource extends Resource { + + private static final long serialVersionUID = 1L; + /* + * set resourceType for this object + */ + public NetworkResource(){ + resourceType = ResourceType.NETWORK; + setResourceId(UUID.randomUUID().toString()); + } + /* + * fields specific to Network resource type + */ + private String networkType; + private String networkRole; + private String networkTechnology; + private String networkScope; + + /* + * GET and SET + */ + public String getNetworkType() { + return networkType; + } + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + public String getNetworkRole() { + return networkRole; + } + public void setNetworkRole(String networkRole) { + this.networkRole = networkRole; + } + public String getNetworkTechnology() { + return networkTechnology; + } + public void setNetworkTechnology(String networkTechnology) { + this.networkTechnology = networkTechnology; + } + public String getNetworkScope() { + return networkScope; + } + public void setNetworkScope(String networkScope) { + this.networkScope = networkScope; + } +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/OwningEntity.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/OwningEntity.java new file mode 100644 index 0000000000..903b84ac8a --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/OwningEntity.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.bpmn.core.domain; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * This class is used to store instance + * data of owningEntity for ServiceDecomposition + * + * @author bb3476 + * + */ +@JsonRootName("owningEntity") +public class OwningEntity extends JsonWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + private String owningEntityId; + private String owningEntityName; + public String getOwningEntityId() { + return owningEntityId; + } + public void setOwningEntityId(String owningEntityId) { + this.owningEntityId = owningEntityId; + } + public String getOwningEntityName() { + return owningEntityName; + } + public void setOwningEntityName(String owningEntityName) { + this.owningEntityName = owningEntityName; + } + +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Project.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Project.java new file mode 100644 index 0000000000..337626ec61 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Project.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.bpmn.core.domain; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * This class is used to store instance + * data of projects for ServiceDecomposition + * + * @author bb3476 + * + */ +@JsonRootName("project") +public class Project extends JsonWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + private String projectName; + + public String getProjectName() { + return projectName; + } + public void setProjectName(String projectName) { + this.projectName = projectName; + } + +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Request.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Request.java new file mode 100644 index 0000000000..dac7336013 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Request.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.bpmn.core.domain; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * This class is used to store instance + * data of services aka ServiceDecomposition + * + * @author bb3476 + * + */ + +public class Request extends JsonWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + private String sdncRequestId; + private String requestId; + private ModelInfo modelInfo; + private String productFamilyId; + private String callbackUrl; + private String serviceId; + private String tenantId; + private String cloudRegion; + + public String getSdncRequestId() { + return sdncRequestId; + } + public void setSdncRequestId(String sdncRequestId) { + this.sdncRequestId = sdncRequestId; + } + public String getRequestId() { + return requestId; + } + public void setRequestId(String requestId) { + this.requestId = requestId; + } + public ModelInfo getModelInfo() { + return modelInfo; + } + public void setModelInfo(ModelInfo modelInfo) { + this.modelInfo = modelInfo; + } + public String getProductFamilyId() { + return productFamilyId; + } + public void setProductFamilyId(String productFamilyId) { + this.productFamilyId = productFamilyId; + } + public String getCallbackUrl() { + return callbackUrl; + } + public void setCallbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + } + public String getServiceId() { + return serviceId; + } + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + public String getCloudRegion() { + return cloudRegion; + } + public void setCloudRegion(String cloudRegion) { + this.cloudRegion = cloudRegion; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Resource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Resource.java new file mode 100644 index 0000000000..00fdbec305 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Resource.java @@ -0,0 +1,134 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.domain; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; + + + +public abstract class Resource extends JsonWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + private String resourceId; // TODO name this field just id instead, should be the id of the object as it is in aai + protected ResourceType resourceType; // Enum of vnf or network or allotted resource + protected ModelInfo modelInfo; + private long concurrencyCounter = 1L; + + //private List modules; + private ResourceInstance resourceInstance = new ResourceInstance(); // TODO possibly remove + private HomingSolution homingSolution = new HomingSolution(); + @JsonInclude(JsonInclude.Include.NON_NULL) + private HomingSolution currentHomingSolution; + + //common parameters for all Resources + private String toscaNodeType; + + // GET and SET + public String getResourceId() { + return resourceId; + } + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + public ModelInfo getModelInfo() { + return modelInfo; + } + public void setModelInfo(ModelInfo modelInfo) { + this.modelInfo = modelInfo; + } + + public ResourceInstance getResourceInstance() { + return resourceInstance; + } + public void setResourceInstance(ResourceInstance resourceInstance) { + this.resourceInstance = resourceInstance; + } + public HomingSolution getHomingSolution(){ + return homingSolution; + } + + public void setHomingSolution(HomingSolution homingSolution){ + this.homingSolution = homingSolution; + } + public HomingSolution getCurrentHomingSolution() { + return currentHomingSolution; + } + public void setCurrentHomingSolution(HomingSolution currentHomingSolution) { + this.currentHomingSolution = currentHomingSolution; + } + public void setResourceType(ResourceType resourceType) { + this.resourceType = resourceType; + } + + public ResourceType getResourceType(){ + return resourceType; + } + + public String getToscaNodeType() { + return toscaNodeType; + } + public void setToscaNodeType(String toscaNodeType) { + this.toscaNodeType = toscaNodeType; + } + + //Utility methods + + public String getResourceInstanceId() { + return this.getResourceInstance().getInstanceId(); + } + public String getResourceInstanceName() { + return this.getResourceInstance().getInstanceName(); + } + //TODO +// @JsonIgnore +// public String getResourceHomingSolution() { +// } + + public void setResourceInstanceId(String newInstanceId){ + this.getResourceInstance().setInstanceId(newInstanceId); + } + public void setResourceInstanceName(String newInstanceName){ + this.getResourceInstance().setInstanceName(newInstanceName); + } + + //TODO +// @JsonIgnore +// public String setResourceHomingSolution() { +// } + /** + * To be used by macro flow to increment concurrency counter after update to it's structure was completed + */ + public void incrementConcurrencyCounter(){ + this.concurrencyCounter ++; + } + /** + * Method to get concurrency counter data + * @return long value for the counter + */ + @JsonIgnore + public long getConcurrencyCounter(){ + return concurrencyCounter; + } + +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceDecomposition.java new file mode 100644 index 0000000000..7cbd565c77 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceDecomposition.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.domain; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * Abstract superclass for all individual decomposition resources + * + */ +//@JsonIgnoreProperties +public abstract class ResourceDecomposition extends JsonWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + + protected String resourceType; // Enum of vnf or network or allotted resource + private ModelInfo modelInfo; + + //private List modules; + private ResourceInstance instanceData = new ResourceInstance(); + + // GET and SET + public ModelInfo getModelInfo() { + return modelInfo; + } + public void setModelInfo(ModelInfo modelInfo) { + this.modelInfo = modelInfo; + } + + public ResourceInstance getInstanceData() { + return instanceData; + } + public void setInstanceData(ResourceInstance instanceData) { + this.instanceData = instanceData; + } + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + //Utility methods + @JsonIgnore + public ModelInfo getResourceModel() { + return modelInfo; + } + @JsonIgnore + public String getResourceInstanceId() { + return this.getInstanceData().getInstanceId(); + } + @JsonIgnore + public String getResourceInstanceName() { + return this.getInstanceData().getInstanceName(); + } +// @JsonIgnore +// public String getResourceHomingSolution() { +// } + + public void setResourceInstanceId(String newInstanceId){ + this.getInstanceData().setInstanceId(newInstanceId); + } + public void setResourceInstanceName(String newInstanceName){ + this.getInstanceData().setInstanceName(newInstanceName); + } +// @JsonIgnore +// public String setResourceHomingSolution() { +// } +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceInstance.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceInstance.java new file mode 100644 index 0000000000..085e278e11 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceInstance.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.domain; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +/** + * Use resourceId in resource class instead + * + * @author cb645j + * + */ +//@JsonIgnoreProperties +//TODO update any existing references then remove this pointless class +@Deprecated +public class ResourceInstance extends JsonWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + + private String instanceId; + private String instanceName; + + + public String getInstanceId() { + return instanceId; + } + + /** + * This class and method is deprecated so use + * resourceId field in resource class instead + * + * @author cb645j + * + */ + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + public String getInstanceName() { + return instanceName; + } + public void setInstanceName(String instanceName) { + this.instanceName = instanceName; + } + +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceModelInfo.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceModelInfo.java new file mode 100644 index 0000000000..af36fa01df --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceModelInfo.java @@ -0,0 +1,58 @@ +/*- + * ============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.bpmn.core.domain; + +import java.io.Serializable; + +public class ResourceModelInfo extends JsonWrapper implements Serializable{ + + private static final long serialVersionUID = 1L; + String resourceName; + String resourceInvariantUuid; + String resourceUuid; + String resourceCustomizationUuid; + + public String getResourceName() { + return resourceName; + } + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + 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; + } + +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java new file mode 100644 index 0000000000..6147822d31 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/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.bpmn.core.domain; + +public enum ResourceType { + + VNF, NETWORK, MODULE, ALLOTTED_RESOURCE, CONFIGURATION // etc. +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java new file mode 100644 index 0000000000..5be0fb4f59 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java @@ -0,0 +1,47 @@ +/*- + * ============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.bpmn.core.domain; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +public class RollbackData implements Serializable{ + + private static final long serialVersionUID = -4811571658272937718L; + + private String requestId; + private Map additionalData = new HashMap(); + + + public String getRequestId(){ + return requestId; + } + + public void setRequestId(String requestId){ + this.requestId = requestId; + } + + public Map getAdditionalData(){ + return additionalData; + } + +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java new file mode 100644 index 0000000000..099f084637 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java @@ -0,0 +1,544 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.domain; + + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.json.JSONObject; +import org.onap.so.bpmn.core.json.DecomposeJsonUtil; +import org.onap.so.bpmn.core.json.JsonDecomposingException; + + + + +/** + * Service Decomposition Structure + * This Java object contains service information: + * - Service model info + * - Service type and role + * - list of VNF resource's decompositon + * - list of network resource's decompositon + * - list of allotted resource's decompositon + */ +@JsonRootName(value = "serviceResources") +//@JsonTypeInfo(include=As.WRAPPER_OBJECT, use=Id.NAME) +public class ServiceDecomposition extends JsonWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + + @JsonProperty("modelInfo") + private ModelInfo modelInfo; + @JsonProperty("serviceType") + private String serviceType; + @JsonProperty("serviceRole") + private String serviceRole; + private ServiceInstance serviceInstance; + private Request request; + private Customer customer; + private String callbackURN; + private String sdncVersion; + @JsonProperty("project") + private Project project; + @JsonProperty("owningEntity") + private OwningEntity owningEntity; + @JsonProperty("serviceVnfs") + private List vnfResources; + @JsonProperty("networkResource") + private List networkResources; + @JsonProperty("serviceAllottedResources") + private List allottedResources; + @JsonProperty("configResource") + private List configResources; + + public ServiceDecomposition () { + super(); + } + + public ServiceDecomposition (String catalogRestOutput) throws JsonDecomposingException { + ServiceDecomposition serviceDecomposition = DecomposeJsonUtil.jsonToServiceDecomposition(catalogRestOutput); + this.modelInfo = serviceDecomposition.getModelInfo(); + this.vnfResources = serviceDecomposition.getVnfResources(); + this.allottedResources = serviceDecomposition.getAllottedResources(); + this.networkResources = serviceDecomposition.getNetworkResources(); + this.serviceRole = serviceDecomposition.getServiceRole(); + this.serviceType = serviceDecomposition.getServiceType(); + this.configResources = serviceDecomposition.getConfigResources(); + } + + /** + * Constructor taking Catalog DB Adapter REST output (serviceResources model) + service Instance ID + * + * @param catalogRestOutput + * @param serviceInstanceId + */ + public ServiceDecomposition (String catalogRestOutput, String serviceInstanceId) throws JsonDecomposingException { + ServiceDecomposition serviceDecomposition = DecomposeJsonUtil.jsonToServiceDecomposition(catalogRestOutput); + this.modelInfo = serviceDecomposition.getModelInfo(); + this.vnfResources = serviceDecomposition.getVnfResources(); + this.allottedResources = serviceDecomposition.getAllottedResources(); + this.configResources = serviceDecomposition.getConfigResources(); + this.networkResources = serviceDecomposition.getNetworkResources(); + + this.serviceRole = serviceDecomposition.getServiceRole(); + this.serviceType = serviceDecomposition.getServiceType(); + + this.serviceInstance = new ServiceInstance(); + this.serviceInstance.setInstanceId(serviceInstanceId); + + this.project = serviceDecomposition.getProject(); + this.owningEntity = serviceDecomposition.getOwningEntity(); + } + + /** + * Constructor taking a Service Decomposition JSON serialization + * @param catalogRestOutput + * @param serviceInstanceId + */ + public ServiceDecomposition (JSONObject jsonServiceDecomposition, String serviceInstanceId) { + //TODO provide constructor implementation + + } + + //***** + //GET and SET section + /** + * Return just the service model portion of the Service Decomposition as a Java object. + * The service model object should support retrieval as JSON string that is formatted correctly for sending serviceModelInfo to Building Blocks. + * @return + */ + public ModelInfo getModelInfo() { + return modelInfo; + } + public void setModelInfo(ModelInfo modelInfo) { + this.modelInfo = modelInfo; + } + public ServiceInstance getServiceInstance() { + return serviceInstance; + } + public void setServiceInstance(ServiceInstance serviceInstance) { + this.serviceInstance = serviceInstance; + } + public Project getProject() { + return project; + } + public OwningEntity getOwningEntity() { + return owningEntity; + } + public void setProject(Project project) { + this.project = project; + } + public void setOwningEntity(OwningEntity owningEntity) { + this.owningEntity = owningEntity; + } + public List getVnfResources() { + return vnfResources; + } + public void setVnfResources(List vnfResources) { + this.vnfResources = vnfResources; + } + public void setConfigResources(List configResources) { + this.configResources = configResources; + } + public List getConfigResources() { + return configResources; + } + public void setNetworkResources(List networkResources) { + this.networkResources = networkResources; + } + public List getNetworkResources() { + return networkResources; + } + public List getAllottedResources() { + return allottedResources; + } + public void setAllottedResources(List allottedResources) { + this.allottedResources = allottedResources; + } + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public String getServiceRole() { + return serviceRole; + } + + public void setServiceRole(String serviceRole) { + this.serviceRole = serviceRole; + } + public Request getRequest() { + return request; + } + + public void setRequest(Request request) { + this.request = request; + } + public Customer getCustomer() { + return customer; + } + public void setCustomer(Customer customer) { + this.customer = customer; + } + public String getCallbackURN() { + return callbackURN; + } + + public void setCallbackURN(String callbackURN) { + this.callbackURN = callbackURN; + } + public String getSdncVersion() { + return sdncVersion; + } + + public void setSdncVersion(String sdncVersion) { + this.sdncVersion = sdncVersion; + } + + //***** + + //***** + //Access methods + + + /** + * This method returns one combined list of Resources of All Types + * @return + */ + @JsonIgnore + public List getServiceResources(){ + ArrayList serviceResources = new ArrayList(); + if(this.getAllottedResources() != null){ + serviceResources.addAll(this.getAllottedResources()); + } + if(this.getNetworkResources() != null){ + serviceResources.addAll(this.getNetworkResources()); + } + if(this.getVnfResources() != null){ + serviceResources.addAll(this.getVnfResources()); + } + if(this.getConfigResources() != null){ + serviceResources.addAll(this.getConfigResources()); + } + return serviceResources; + } + + /** + * This method returns String representation of one combined list of Resources of All Types + */ + @JsonIgnore + public String getServiceResourcesJsonString() { + return getServiceNetworksJson() + + getServiceVnfsJson() + + getServiceAllottedResourcesJson() + + getServiceConfigResourcesJson(); + } + + /** + * Returns a JSON list of all Network Resource structures (i.e. the serialized NetworkDecomposition objects). + * @return + */ + @JsonIgnore + public String getServiceNetworksJson(){ + return listToJson(this.getNetworkResources()); + } + /** + * Returns a JSON list of all VnfResource structures (i.e. the serialized VnfResource objects). + * @return + */ + @JsonIgnore + public String getServiceVnfsJson(){ + return listToJson(this.getVnfResources()); + } + /** + * Returns a JSON list of all Allotted Resource structures (i.e. the serialized AllottedResource objects). + * @return + */ + @JsonIgnore + public String getServiceAllottedResourcesJson(){ + return listToJson(this.getAllottedResources()); + } + /** + * Returns a JSON list of all Config Resource structures (i.e. the serialized ConfigResource objects). + * @return + */ + @JsonIgnore + public String getServiceConfigResourcesJson(){ + return listToJson(this.getConfigResources()); + } + + //TODO - define Resource Object ID + @JsonIgnore + public String getVnfResource(String resourceObjectId) { + + for (Resource resource : getServiceResources()) { + //resource.getModelInfo().getModelInvariantId(); + + if ("extracted information".equals(resourceObjectId)) { + return resource.toJsonString(); + } + } + return ""; + } + + //Methods to add Resource to the list + /** + * Add VNF resource to the list + * @param vnfResource + */ + public void addVnfResource(Resource vnfResource) { + if (vnfResources == null){ + vnfResources = new ArrayList<>(); + } + this.vnfResources.add((VnfResource)vnfResource); + } + /** + * Add Network resource to the list + * @param networkResource + */ + public void addNetworkResource(Resource networkResource) { + if (networkResources == null){ + networkResources = new ArrayList<>(); + } + this.networkResources.add((NetworkResource)networkResource); + } + /** + * Add Allotted resource to the list + * @param allottedResource + */ + public void addAllottedResource(Resource allottedResource) { + if (allottedResources == null){ + allottedResources = new ArrayList<>(); + } + this.allottedResources.add((AllottedResource)allottedResource); + } + /** + * Add Config resource to the list + * @param allottedResource + */ + public void addConfigResource(Resource configResource) { + if (configResources == null){ + configResources = new ArrayList<>(); + } + this.configResources.add((ConfigResource)configResource); + } + /** + * Add resource to the list + * Given a ResourceDecomposition (subclass) object, add it to the Service Decomposition (in the appropriate category, e.g. as a VNF, Network, or Allotted Resource). + * As dependencies are not currently supported, add it to the end of any ordered lists. + * @param resource + */ + public void addResource(Resource resource) { + //create resource based upon type + switch (resource.resourceType) { + case VNF: + this.addVnfResource(resource); + break; + case NETWORK: + this.addNetworkResource(resource); + break; + case ALLOTTED_RESOURCE: + this.addAllottedResource(resource); + break; + case CONFIGURATION: + this.addConfigResource(resource); + break; + default: + throw new IllegalArgumentException("Invalid resource type: " + resource.resourceType); + } + } + + /** + * Add resource to the list + * @param jsonResource + */ + public void addVnfResource(String jsonResource) throws JsonDecomposingException { + VnfResource vnfResource = null; + vnfResource = DecomposeJsonUtil.jsonToVnfResource(jsonResource); + this.addVnfResource(vnfResource); + } + /** + * Add resource to the list + * @param jsonResource + */ + public void addNetworkResource(String jsonResource) throws JsonDecomposingException { + NetworkResource networkResource = null; + networkResource = DecomposeJsonUtil.jsonToNetworkResource(jsonResource); + this.addNetworkResource(networkResource); + } + /** + * Add resource to the list + * @param Resource + */ + public void addAllottedResource(String jsonResource) throws JsonDecomposingException { + AllottedResource allottedResource = null; + allottedResource = DecomposeJsonUtil.jsonToAllottedResource(jsonResource); + this.addAllottedResource(allottedResource); + } + /** + * Add resource to the list + * @param Resource + */ + public void addConfigResource(String jsonResource) throws JsonDecomposingException { + ConfigResource configResource = null; + configResource = DecomposeJsonUtil.jsonToConfigResource(jsonResource); + this.addConfigResource(configResource); + } + /** + * Given a ResourceDecomposition (subclass) object, locate it in the Service Decomposition by its unique ID, and replace the current version with the new one. + * This method should support concurrency control via an auto-incrementing field in the ResourceDecomposition class. + * @param newResource + * @return TRUE if replacement was a success + */ + public boolean replaceResource(Resource newResource){ + List resources = getResourceList(newResource); + + boolean result = false; + for (Resource resource : (Iterable) resources) { + System.out.println("resource found"); + if (resource.resourceType == newResource.resourceType) { + System.out.println("resource type matches"); + if (resource.getResourceId().equalsIgnoreCase(newResource.getResourceId())) { + System.out.println("resource id matches"); + //returns TRUE if replacement is a success + result = Collections.replaceAll(resources, resource, newResource); + } + } + } + return result; + } + + /** + * Given a ResourceDecomposition as a JSON string, locate it in the Service Decomposition by its unique ID, + * and replace the current version with the new one. + * @param jsonString + * @return + */ + public boolean replaceResource(String jsonString){ + //TODO: define unique ID for the Resource! + return false; + } + + /** + * Given a resource object ID, locate it in the Service Decomposition by its unique ID, and delete it. + * @param resource + * @return TRUE if delete was a success + */ + public boolean deleteResource(Resource resource){ + List serviceResourceList = getResourceList(resource); + for (Resource item : (Iterable) serviceResourceList) { + if (item.resourceType == resource.resourceType) { + if (item.getResourceId().equalsIgnoreCase(resource.getResourceId())) { + //returns TRUE if replacement is a success + return serviceResourceList.remove(resource); + } + } + } + + return false; + } + + /** + * Generic method to get List of Resource objects based on input resource's resourceType + * @param resource + * @return List matching the resourceType of resource + */ + public List getResourceList(Resource resource) { + List resourceList; + switch(resource.getResourceType()) { + case VNF: + resourceList = getVnfResources(); + break; + case NETWORK: + resourceList = getNetworkResources(); + break; + case ALLOTTED_RESOURCE: + resourceList = getAllottedResources(); + break; + case CONFIGURATION: + resourceList = getConfigResources(); + break; + default: + resourceList = new ArrayList<>(); + } + return resourceList; + } + + /** + * Generic method to set List of ResourceDecomposition objects + * @param resources + * @return + */ + public boolean setResourceList(List resources){ + if(resources != null && !resources.isEmpty()) { + //create resource based upon type + switch (resources.get(0).resourceType) { + case VNF: + this.setVnfResources((List)(List)resources); + break; + case NETWORK: + this.setNetworkResources((List)(List)resources); + break; + case ALLOTTED_RESOURCE: + this.setAllottedResources((List)(List)resources); + break; + case CONFIGURATION: + this.setConfigResources((List)(List)resources); + break; + default: + throw new IllegalArgumentException("Invalid resource type: " + resources.get(0).resourceType); + } + } + + return false; + } + + /** + * + * This method locates and returns a resource in a given + * Service Decomposition object by its unique resource id. + * Returns null if resource doesn't exist. + * + * @param resourceId - id of the resource + * @return resource + */ + @JsonIgnore + public Resource getServiceResource(String resourceId){ + List resources = getServiceResources(); + for (Resource resource : resources) { + if (resource.getResourceId().equalsIgnoreCase(resourceId)) { + //match + return resource; + } + } + return null; + } +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java new file mode 100644 index 0000000000..6d2db0ca33 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.domain; + +import java.io.Serializable; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * This class is used to store instance + * data of services aka ServiceDecomposition + * + * @author cb645j + * + */ +public class ServiceInstance extends JsonWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + private String instanceId; + private String instanceName; + private String orchestrationStatus; + private Configuration configuration; + private String serviceType; + private String serviceRole; + private String serviceId; + private ModelInfo modelInfo; + private String environmentContext; + private String workloadContext; + private Map serviceParams; + + public String getServiceType() { + return serviceType; + } + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + public String getServiceId() { + return serviceId; + } + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + public Map getServiceParams() { + return serviceParams; + } + public void setServiceParams(Map serviceParams) { + this.serviceParams = serviceParams; + } + public String getInstanceId() { + return instanceId; + } + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + public String getInstanceName() { + return instanceName; + } + public void setInstanceName(String instanceName) { + this.instanceName = instanceName; + } + public String getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(String orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public Configuration getConfiguration() { + return configuration; + } + public void setConfiguration(Configuration configuration) { + this.configuration = configuration; + } + public ModelInfo getModelInfo() { + return modelInfo; + } + public void setModelInfo(ModelInfo modelInfo) { + this.modelInfo = modelInfo; + } + public String getEnvironmentContext() { + return environmentContext; + } + public void setEnvironmentContext(String environmentContext) { + this.environmentContext = environmentContext; + } + public String getWorkloadContext() { + return workloadContext; + } + public void setWorkloadContext(String workloadContext) { + this.workloadContext = workloadContext; + } + public String getServiceRole() { + return serviceRole; + } + public void setServiceRole(String serviceRole) { + this.serviceRole = serviceRole; + } +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Subscriber.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Subscriber.java new file mode 100644 index 0000000000..e9028ded17 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Subscriber.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.bpmn.core.domain; + +import java.io.Serializable; + +public class Subscriber implements Serializable { + + private static final long serialVersionUID = -2416018315129127022L; + private String globalId; + private String name; + private String commonSiteId; + + public Subscriber(String globalId, String name, String commonSiteId){ + super(); + this.globalId = globalId; + this.name = name; + this.commonSiteId = commonSiteId; + } + + + public String getGlobalId(){ + return globalId; + } + + + public void setGlobalId(String globalId){ + this.globalId = globalId; + } + + + public String getName(){ + return name; + } + + + public void setName(String name){ + this.name = name; + } + + + public String getCommonSiteId(){ + return commonSiteId; + } + + public void setCommonSiteId(String commonSiteId){ + this.commonSiteId = commonSiteId; + } + + +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Vnf.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Vnf.java new file mode 100644 index 0000000000..83043b3ec5 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Vnf.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.bpmn.core.domain; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * This class is used to store instance + * data of Vnf for ServiceDecomposition + * + * @author bb3476 + * + */ +@JsonRootName("vnf") +public class Vnf extends JsonWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + private String vnfId; + private String vnfName; + private String serviceId; + private String vnfType; + private String orchStatus; + private String modelInvariantId; + private String modelVersionId; + private String modelCustomizationId; + private String nfType; + private String nfRole; + private String nfFunction; + private String nfNamingCode; + private String tenantId; + private String cloudSiteId; + + + public String getVnfName() { + return vnfName; + } + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } + public String getServiceId() { + return serviceId; + } + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + public String getVnfType() { + return vnfType; + } + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + public String getOrchStatus() { + return orchStatus; + } + public void setOrchStatus(String orchStatus) { + this.orchStatus = orchStatus; + } + public String getModelInvariantId() { + return modelInvariantId; + } + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + public String getModelVersionId() { + return modelVersionId; + } + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + public String getModelCustomizationId() { + return modelCustomizationId; + } + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + public String getNfType() { + return nfType; + } + public void setNfType(String nfType) { + this.nfType = nfType; + } + public String getNfRole() { + return nfRole; + } + public void setNfRole(String nfRole) { + this.nfRole = nfRole; + } + public String getNfFunction() { + return nfFunction; + } + public void setNfFunction(String nfFunction) { + this.nfFunction = nfFunction; + } + public String getNfNamingCode() { + return nfNamingCode; + } + public void setNfNamingCode(String nfNamingCode) { + this.nfNamingCode = nfNamingCode; + } + public String getVnfId() { + return vnfId; + } + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getCloudSiteId() { + return cloudSiteId; + } + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java new file mode 100644 index 0000000000..dc76ab0bc7 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java @@ -0,0 +1,176 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.domain; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * Encapsulates VNF resource data set + * + */ +@JsonRootName("vnfResource") +public class VnfResource extends Resource { + + private static final long serialVersionUID = 1L; + + /* + * set resourceType for this object + */ + public VnfResource(){ + resourceType = ResourceType.VNF; + setResourceId(UUID.randomUUID().toString()); + } + + /* + * fields specific to VNF resource type + */ + @JsonProperty("vfModules") + private List vfModules; + private String vnfHostname; + private String vnfType; + private String nfFunction; + private String nfType; + private String nfRole; + private String nfNamingCode; + private String multiStageDesign; + private String orchestrationStatus; + + /* + * GET and SET + */ + public List getVfModules() { + return vfModules; + } + public void setModules(List moduleResources) { + this.vfModules = moduleResources; + } + public String getVnfHostname() { + return vnfHostname; + } + public void setVnfHostname(String vnfHostname) { + this.vnfHostname = vnfHostname; + } + @Deprecated + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + public String getVnfType() { + return vnfType; + } + public String getNfFunction() { + return nfFunction; + } + public void setNfFunction(String nfFunction) { + this.nfFunction = nfFunction; + } + public String getNfType() { + return nfType; + } + public void setNfType(String nfType) { + this.nfType = nfType; + } + public String getNfRole() { + return nfRole; + } + public void setNfRole(String nfRole) { + this.nfRole = nfRole; + } + public String getNfNamingCode() { + return nfNamingCode; + } + public void setNfNamingCode(String nfNamingCode) { + this.nfNamingCode = nfNamingCode; + } + public String getMultiStageDesign() { + return multiStageDesign; + } + public void setMultiStageDesign(String multiStageDesign) { + this.multiStageDesign = multiStageDesign; + } + /* + * GET accessors per design requirements + */ + + + public String getOrchestrationStatus(){ + return orchestrationStatus; + } + + public void setOrchestrationStatus(String orchestrationStatus){ + this.orchestrationStatus = orchestrationStatus; + } + /** + * Returns a list of all VfModule objects. + * Base module is first entry in the list + * @return ordered list of ModuleResources objects + */ + @JsonIgnore + public List getAllVfModuleObjects(){ + if (vfModules == null) { + return null; + } + + for (int i = 0; i < vfModules.size(); i++) { + ModuleResource moduleResource = vfModules.get(i); + if (moduleResource.getIsBase()){ + vfModules.remove(moduleResource); + vfModules.add(0,moduleResource); + } + } + return vfModules; + } + + /** + * + * @return Returns JSON list of all VfModule structures. + */ + @JsonIgnore + public String getAllVfModulesJson(){ + + return listToJson(vfModules); + } + + // methods to add to the list + public void addVfModule(ModuleResource moduleResource) { + if (vfModules == null){ + vfModules = new ArrayList<>(); + } + this.vfModules.add(moduleResource); + } + + + /** + * Utility method to allow construction of the filed in the form of + * / + * + * default setter for this field deprecated + * @param modelName << serviceResources.modelInfo.modelName + */ + public void constructVnfType(String modelName) { + this.vnfType = modelName.concat("/").concat(this.modelInfo.getModelInstanceName()); + } +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/internal/VariableNameExtractor.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/internal/VariableNameExtractor.java new file mode 100644 index 0000000000..f63ab31496 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/internal/VariableNameExtractor.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.internal; + +import java.util.Optional; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Extracts variable name from expression if entire expression is just + * one variable, for example "${x}". + * + * Ignores all whitespaces, except inside variable name. + * + * Examples: + * "${x}", extracted variable name is "x" + * " ${\t weird_NAME }", extracted variable name is "weird_NAME" + * "${incorrect name}", no extracted name + * "${two}+${two}", no extracted name + */ +public class VariableNameExtractor { + + private static final Pattern VARIABLE_NAME_PATTERN = Pattern + .compile("^\\s*\\$\\s*\\{\\s*([a-zA-Z0-9_]+)\\s*\\}\\s*$"); + + private final String expression; + + + /** + * Creates new VariableNameExtractor + * @param expression expression to be parsed + */ + public VariableNameExtractor(String expression) { + this.expression = expression; + } + + /** + * Extracts variable name from expression given in constructor + * @return Optional of variable name, empty if expression wasn't single variable + */ + public Optional extract() { + Matcher matcher = VARIABLE_NAME_PATTERN.matcher(expression); + if (!matcher.matches()) { + return Optional.empty(); + } + return Optional.of(matcher.group(1)); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/DecomposeJsonUtil.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/DecomposeJsonUtil.java new file mode 100644 index 0000000000..be7851362c --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/DecomposeJsonUtil.java @@ -0,0 +1,143 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.json; + +import java.io.IOException; +import java.io.Serializable; + +import org.onap.so.bpmn.core.domain.AllottedResource; +import org.onap.so.bpmn.core.domain.ConfigResource; +import org.onap.so.bpmn.core.domain.NetworkResource; +import org.onap.so.bpmn.core.domain.ServiceDecomposition; +import org.onap.so.bpmn.core.domain.ServiceInstance; +import org.onap.so.bpmn.core.domain.VnfResource; +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; + + +public class DecomposeJsonUtil implements Serializable { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DecomposeJsonUtil.class); + /** + * + */ + private static final long serialVersionUID = 1L; + + private static final ObjectMapper OBJECT_MAPPER = createObjectMapper(); + + private DecomposeJsonUtil() { + } + + private static ObjectMapper createObjectMapper() { + ObjectMapper om = new ObjectMapper(); + om.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + return om; + } + + /** + * Method to construct Service Decomposition object converting JSON structure + * + * @param jsonString input in JSON format confirming ServiceDecomposition + * @return decoded object + * @throws JsonDecomposingException thrown when decoding json fails + */ + public static ServiceDecomposition jsonToServiceDecomposition(String jsonString) throws JsonDecomposingException { + try { + ObjectMapper om = new ObjectMapper(); + om.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + return om.readValue(jsonString, ServiceDecomposition.class); + } catch (IOException e) { + throw new JsonDecomposingException("Exception while converting json to service decomposition", e); + } + } + + /** + * Method to construct Service Decomposition object converting JSON structure + * + * @param jsonString input in JSON format confirming ServiceDecomposition + * @param serviceInstanceId service instance id to be put in decoded ServiceDecomposition + * @return decoded object + * @throws JsonDecomposingException thrown when decoding json fails + */ + public static ServiceDecomposition jsonToServiceDecomposition(String jsonString, String serviceInstanceId) + throws JsonDecomposingException { + ServiceDecomposition serviceDecomposition = jsonToServiceDecomposition(jsonString); + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setInstanceId(serviceInstanceId); + serviceDecomposition.setServiceInstance(serviceInstance); + return serviceDecomposition; + } + + /** + * Method to construct Resource Decomposition object converting JSON structure + * + * @param jsonString input in JSON format confirming ResourceDecomposition + * @return decoded object + * @throws JsonDecomposingException thrown when decoding json fails + */ + public static VnfResource jsonToVnfResource(String jsonString) throws JsonDecomposingException { + try { + return OBJECT_MAPPER.readValue(jsonString, VnfResource.class); + } catch (IOException e) { + throw new JsonDecomposingException("Exception while converting json to vnf resource", e); + } + } + + /** + * Method to construct Resource Decomposition object converting JSON structure + * + * @param jsonString input in JSON format confirming ResourceDecomposition + * @return decoded object + * @throws JsonDecomposingException thrown when decoding json fails + */ + public static NetworkResource jsonToNetworkResource(String jsonString) throws JsonDecomposingException { + try { + return OBJECT_MAPPER.readValue(jsonString, NetworkResource.class); + } catch (IOException e) { + throw new JsonDecomposingException("Exception while converting json to network resource", e); + } + } + + /** + * Method to construct Resource Decomposition object converting JSON structure + * + * @param jsonString - input in JSON format confirming ResourceDecomposition + * @return decoded object + * @throws JsonDecomposingException thrown when decoding json fails + */ + public static AllottedResource jsonToAllottedResource(String jsonString) throws JsonDecomposingException { + try { + return OBJECT_MAPPER.readValue(jsonString, AllottedResource.class); + } catch (IOException e) { + throw new JsonDecomposingException("Exception while converting json to allotted resource", e); + } + } + + public static ConfigResource jsonToConfigResource(String jsonString) throws JsonDecomposingException { + try { + return OBJECT_MAPPER.readValue(jsonString, ConfigResource.class); + } catch (IOException e) { + throw new JsonDecomposingException("Exception while converting json to allotted resource", e); + } + } +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonDecomposingException.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonDecomposingException.java new file mode 100644 index 0000000000..c9d46b9122 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonDecomposingException.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========================================================= + */ + +package org.onap.so.bpmn.core.json; + +import java.io.IOException; + +public class JsonDecomposingException extends IOException { + + public JsonDecomposingException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java new file mode 100644 index 0000000000..ee53148e44 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java @@ -0,0 +1,1087 @@ +/*- + * ============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.bpmn.core.json; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.runtime.Execution; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.XML; +import org.onap.so.bpmn.core.xml.XmlTool; +import org.onap.so.exceptions.ValidationException; +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.databind.JsonNode; +import com.github.fge.jackson.JsonLoader; +import com.github.fge.jsonschema.core.exceptions.ProcessingException; +import com.github.fge.jsonschema.core.report.ProcessingReport; +import com.github.fge.jsonschema.main.JsonSchemaFactory; +import com.github.fge.jsonschema.main.JsonValidator; + +/** + * Utility class for JSON processing + * + * @version 1.0 + * + * Note: It was observed, that depending on the JSON implementation, an org.json.JSONException or a + * java.util.NoSuchElementException will be thrown in the event of the key value being "not found" + * in a JSON document. A general check has been added to the applicable catch blocks for this + * this type of behavior to reduce the amount of logging. As a key value not being found is + * expect behavior, it makes no sense to log the stack trace associated with this type of failure. + */ +public class JsonUtils { + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, JsonUtils.class); + private static int MSOJsonIndentFactor = 3; + + /** + * Uses the JSONObject static method to convert a XML doc to JSON. + * + * @param xml String containing the XML doc + * @param pretty flag to determine if the output should be formatted + * @return String containing the JSON translation + */ + public static String xml2json(String xml, Boolean pretty) { + try { + // name spaces cause problems, so just remove them + JSONObject jsonObj = XML.toJSONObject(XmlTool.removeNamespaces(xml)); + if (!pretty) { + return jsonObj.toString(); + } else { + // add an indent to make it 'pretty' + return jsonObj.toString(MSOJsonIndentFactor); + } + } catch (Exception e){ + msoLogger.debug("xml2json(): unable to parse xml and convert to json. Exception was: " + e.toString(), e); + return null; + } + } + + /** + * Invokes xml2json(String, Boolean) defaulting to 'pretty' output. + * + * @param xml String containing the XML doc + * @return String containing the JSON translation + */ + public static String xml2json(String xml) { + return xml2json(xml, true); + } + + /** + * Uses the JSONObject static method to convert a JSON doc to XML. + * Note: this method may not generate valid XML if the JSONObject + * contains JSONArrays which are used to represent XML attributes + * in the JSON doc. + * + * @param jsonStr String containing the JSON doc + * @param pretty flag to determine if the output should be formatted + * @return String containing the XML translation + */ + public static String json2xml(String jsonStr, Boolean pretty) { + + try { + JSONObject jsonObj = new JSONObject(jsonStr); + if (pretty) { +// return XmlTool.normalize(XML.toString(jsonObj)); +// use the local class method which properly handles certain JSONArray content + return XmlTool.normalize(toXMLString(jsonObj, null)); + } else { +// return XML.toString(jsonObj); +// use the local class method which properly handles certain JSONArray content + return toXMLString(jsonObj, null); + } + } catch (Exception e){ + msoLogger.debug("json2xml(): unable to parse json and convert to xml. Exception was: " + e.toString(), e); + return null; + } + } + + /** + * Uses a modified version of the org.json.XML toString() algorithm + * to convert a JSONObject to an XML Doc. The intent of this is to + * correctly generate XML from JSON including TAGs for JSONArrays + * + * @param obj org.json.JSON object to be converted to XML + * @param tagName optional XML tagname supplied primarily during recursive calls + * @return String containing the XML translation + */ + public static String toXMLString(Object obj, String tagName) throws JSONException { + StringBuilder strBuf = new StringBuilder(); + int i; + JSONArray jsonArr; + JSONObject jsonObj; + String key; + Iterator keys; + int len; + String str; + Object curObj; + if (obj instanceof JSONObject) { + // msoLogger.debug("toXMLString(): is a JSONObject"); + // append "" to the XML output + if (tagName != null) { +// msoLogger.debug("toXMLString(): adding opening tagName: " + tagName); + strBuf.append("<"); + strBuf.append(tagName); + strBuf.append(">"); + } + // iterate thru the keys. + jsonObj = (JSONObject) obj; + keys = jsonObj.keys(); + while (keys.hasNext()) { + key = keys.next(); + // msoLogger.debug("toXMLString(): key is " + k); + curObj = jsonObj.opt(key); + if (curObj == null) { + curObj = ""; + } + if (curObj instanceof String) { + str = (String) curObj; + } else { + str = null; + } + // append the content to the XML output + if ("content".equals(key)) { + if (curObj instanceof JSONArray) { + jsonArr = (JSONArray) curObj; + len = jsonArr.length(); + for (i = 0; i < len; i += 1) { + if (i > 0) { + strBuf.append('\n'); + } + strBuf.append(XML.escape(jsonArr.get(i).toString())); + } + } else { + strBuf.append(XML.escape(curObj.toString())); + } + // append an array of similar keys to the XML output + } else if (curObj instanceof JSONArray) { + jsonArr = (JSONArray) curObj; + len = jsonArr.length(); +// msoLogger.debug("toXMLString(): found JSONArray: " + key + ", size: " + len); + for (i = 0; i < len; i += 1) { + curObj = jsonArr.get(i); + if (curObj instanceof JSONArray) { +// The XML tags for the nested array should be generated below when this method +// is called recursively and the JSONArray object is passed +// strBuf.append("<"); +// strBuf.append(key); +// strBuf.append(">"); + strBuf.append(toXMLString(curObj, null)); +// strBuf.append(""); + } else { +// msoLogger.debug("toXMLString(): recursive call toXML() with tagName null"); + // append the opening tag for the array (before 1st element) + if (i == 0) { + strBuf.append("<"); + strBuf.append(key); + strBuf.append(">"); + } + // append the opening tag for the array + strBuf.append(toXMLString(curObj, null)); + // append the closing tag for the array (after last element) + if (i == (len - 1)) { + strBuf.append(""); + } + } + } + } else if (curObj.equals("")) { + // append a closing tag "" to the XML output + strBuf.append("<"); + strBuf.append(key); + strBuf.append("/>"); + } else { +// msoLogger.debug("toXMLString(): recursive call toXMLString() with tagName: " + key); + strBuf.append(toXMLString(curObj, key)); + } + // msoLogger.debug("toXML(): partial XML: " + strBuf.toString()); + } + if (tagName != null) { + // append the closing tag "" to the XML output +// msoLogger.debug("toXMLString(): adding closing tagName: " + tagName); + strBuf.append(""); + } + return strBuf.toString(); + // XML does not have good support for arrays. If an array appears in a place + // where XML is lacking, synthesize an < array > element. + } else if (obj instanceof JSONArray) { + jsonArr = (JSONArray) obj; + len = jsonArr.length(); + for (i = 0; i < len; ++i) { + curObj = jsonArr.opt(i); + strBuf.append(toXMLString(curObj, (tagName == null) ? "array" + : tagName)); + } + return strBuf.toString(); + } else { +// msoLogger.debug("toXML(): in else block with tagName: " + tagName); + str = (obj == null) ? "null" : XML.escape(obj.toString()); + return (tagName == null) ? "\"" + str + "\"" + : (str.length() == 0) ? "<" + tagName + "/>" : "<" + + tagName + ">" + str + ""; + } + } + + /** + * Invokes json2xml(String, Boolean) defaulting to 'pretty' output. + * + * @param jsonStr String containing the XML doc + * @return String containing the JSON translation + */ + public static String json2xml(String jsonStr) { + return json2xml(jsonStr, true); + } + + /** + * Formats the JSON String using the value of MSOJsonIndentFactor. + * + * @param jsonStr String containing the JSON doc + * @return String containing the formatted JSON doc + */ + public static String prettyJson(String jsonStr) { +// String isDebugLogEnabled = "true"; + try { + JSONObject jsonObj = new JSONObject(jsonStr); + return jsonObj.toString(MSOJsonIndentFactor); + } catch (Exception e){ + msoLogger.debug("prettyJson(): unable to parse/format json input. Exception was: " + e.toString(), e); + return null; + } + } + + /** + * Returns an Iterator over the JSON keys in the specified JSON doc. + * + * @param jsonStr String containing the JSON doc + * @return Iterator over the JSON keys + * @throws JSONException if the doc cannot be parsed + */ + public static Iterator getJsonIterator(String jsonStr) throws JSONException { + return new JSONObject(jsonStr).keys(); + } + + /** + * Returns the name of the "root" property in the specified JSON doc. The + * "root" property is the single top-level property in the JSON doc. An + * exception is thrown if the doc is empty or if it contains more than one + * top-level property. + * + * @param jsonStr String containing the JSON doc + * @return the name of the "root" property + * @throws JSONException if the doc cannot be parsed, or if it is empty, or if + * it contains more than one top-level property + */ + public static String getJsonRootProperty(String jsonStr) throws JSONException { + Iterator iter = getJsonIterator(jsonStr); + + if (!iter.hasNext()) { + throw new JSONException("Empty JSON object"); + } + + String rootPropertyName = iter.next(); + + if (iter.hasNext()) { + throw new JSONException("JSON object has more than one root property"); + } + + return rootPropertyName; + } + + /** + * Invokes the getJsonRawValue() method and returns the String equivalent of + * the object returned. + * + * TBD: May need separate methods for boolean, float, and integer fields if the + * String representation is not sufficient to meet client needs. + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @return String field value associated with keys + */ + public static String getJsonValue(String jsonStr, String keys) { +// String isDebugLogEnabled = "true"; + try { + Object rawValue = getJsonRawValue(jsonStr, keys); + if (rawValue == null) { + return null; + } else { + if (rawValue instanceof String) { + msoLogger.debug("getJsonValue(): the raw value is a String Object=" + rawValue); + return (String) rawValue; + } else { + msoLogger.debug("getJsonValue(): the raw value is NOT a String Object=" + rawValue.toString()); + return rawValue.toString(); + } + } + } catch (Exception e) { + msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e); + } + return null; + } + + /** + * Invokes the getJsonRawValue() method with the wrap flag set to true + * and returns the String equivalent of the json node object returned. + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @return String field value associated with keys + */ + public static String getJsonNodeValue(String jsonStr, String keys) { +// String isDebugLogEnabled = "true"; + try { + Object rawValue = getJsonRawValue(jsonStr, keys, true); + if (rawValue == null) { + return null; + } else { + if (rawValue instanceof String) { + msoLogger.debug("getJsonNodeValue(): the raw value is a String Object=" + rawValue); + return (String) rawValue; + } else { + msoLogger.debug("getJsonNodeValue(): the raw value is NOT a String Object=" + rawValue.toString()); + return rawValue.toString(); + } + } + } catch (Exception e) { + msoLogger.debug("getJsonNodeValue(): unable to parse json to retrieve node for field=" + keys + ". Exception was: " + e.toString(), e); + } + return null; + } + + /** + * Invokes the getJsonRawValue() method and returns the String equivalent of + * the object returned. + * + * TBD: May need separate methods for boolean, float, and integer fields if the + * String representation is not sufficient to meet client needs. + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @return String field value associated with keys + */ + public static int getJsonIntValue(String jsonStr, String keys) { +// String isDebugLogEnabled = "true"; + try { + Object rawValue = getJsonRawValue(jsonStr, keys); + if (rawValue == null) { + return 0; + } else { + if (rawValue instanceof Integer) { + msoLogger.debug("getJsonIntValue(): the raw value is an Integer Object=" + ((String) rawValue).toString()); + return (Integer) rawValue; + } else { + msoLogger.debug("getJsonIntValue(): the raw value is NOT an Integer Object=" + rawValue.toString()); + return 0; + } + } + } catch (Exception e) { + msoLogger.debug("getJsonIntValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(), e); + } + return 0; + } + + /** + * Invokes the getJsonRawValue() method and returns the boolean equivalent of + * the object returned. + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @return boolean field value associated with keys - default is false + */ + public static boolean getJsonBooleanValue(String jsonStr, String keys) { + try { + Object rawValue = getJsonRawValue(jsonStr, keys); + if (rawValue == null) { + return false; + } else { + if (rawValue instanceof Boolean) { + msoLogger.debug("getJsonBooleanValue(): the raw value is a Boolean Object=" + rawValue); + return (Boolean) rawValue; + } else { + msoLogger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object=" + rawValue.toString()); + return false; + } + } + } catch (Exception e) { + msoLogger.debug("getJsonBooleanValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e); + } + return false; + } + + /** + * Invokes the getJsonParamValue() method to obtain the JSONArray associated with + * the specified keys. The JSONArray is then walked to retrieve the first array + * value associated with the specified field name (index=0). + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @param name field name for the param to be retrieved + * @return String param value associated with field name + */ + public static String getJsonParamValue(String jsonStr, String keys, String name) { + return getJsonParamValue(jsonStr, keys, name, 0); + } + + /** + * Invokes the getJsonRawValue() method to obtain the JSONArray associated with + * the specified keys. The JSONArray is then walked to retrieve the nth array + * value associated with the specified field name and index. + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @param name field name for the param to be retrieved + * @param index the nth param associated with name starting at 0 + * @return String param value associated with field name + */ + public static String getJsonParamValue(String jsonStr, String keys, String name, int index) { +// String isDebugLogEnabled = "true"; + try { + Object rawValue = getJsonRawValue(jsonStr, keys); + if (rawValue == null) { + return null; + } else { + if (rawValue instanceof JSONArray) { + msoLogger.debug("getJsonParamValue(): keys=" + keys + " points to JSONArray: " + rawValue.toString()); + int arrayLen = ((JSONArray) rawValue).length(); + if (index < 0 || arrayLen < index+1) { + msoLogger.debug("getJsonParamValue(): index: " + index + " is out of bounds for array size of " + arrayLen); + return null; + } + int foundCnt = 0; + for (int i = 0; i < arrayLen; i++) { + msoLogger.debug("getJsonParamValue(): index: " + i + ", value: " + ((JSONArray) rawValue).get(i).toString()); + if (((JSONArray) rawValue).get(i) instanceof JSONObject) { +// msoLogger.debug("getJsonParamValue(): index: " + i + " is a JSONObject"); + JSONObject jsonObj = (JSONObject)((JSONArray) rawValue).get(i); + String parmValue = jsonObj.get(name).toString(); + if (parmValue != null) { + msoLogger.debug("getJsonParamValue(): found value: " + parmValue + " for name: " + name + " and index: " + i); + if (foundCnt == index) { + return parmValue; + } else { + foundCnt++; + continue; + } + } else { + continue; + } + } else { + msoLogger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject=" + rawValue.toString()); + return null; + } + } + msoLogger.debug("getJsonParamValue(): content value NOT found for name: " + name); + return null; + } else { + msoLogger.debug("getJsonParamValue(): the raw value is NOT a JSONArray Object=" + rawValue.toString()); + return null; + } + } + } catch (Exception e) { + // JSONObject::get() throws a "not found" exception if one of the specified keys is not found + if (e.getMessage().contains("not found")) { + msoLogger.debug("getJsonParamValue(): failed to retrieve param value for keys:" + keys + ", name=" + name + ": " + e.getMessage()); + } else { + msoLogger.debug("getJsonParamValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(), e); + } + } + return null; + } + + /** + * Wrapper to generate the JSONObject to pass to the getJsonValueForKey(JSONObject, String) + * method so that recursion over the subobjects can be supported there + * + * @param jsonStr String containing the JSON doc + * @param key key to the target value + * @return String field value associated with key + */ + public static String getJsonValueForKey(String jsonStr, String key) { + + try { + JSONObject jsonObj = new JSONObject(jsonStr); + return getJsonValueForKey(jsonObj, key); + } catch (Exception e) { + msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(), e); + } + return null; + } + + /** + * Walks the JSONObject (and sub-objects recursively), searching for the first value associated with the + * single key/field name specified. Returns the associated value if found or null if the key is not found + * + * @param jsonObj JSONObject representation of the the JSON doc + * @param key key to the target value + * @return String field value associated with key + */ + public static String getJsonValueForKey(JSONObject jsonObj, String key) { + + String keyValue = null; + try { + if (jsonObj.has(key)) { + Object value = jsonObj.get(key); + msoLogger.debug("getJsonValueForKey(): found value=" + (String) value + ", for key=" + key); + if (value == null) { + return null; + } else { + return ((String) value); + } + } else { +// msoLogger.debug("getJsonValueForKey(): iterating over the keys"); + Iterator itr = jsonObj.keys(); + while (itr.hasNext()) { + String nextKey = itr.next(); + Object obj = jsonObj.get(nextKey); + if (obj instanceof JSONObject) { +// msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call on: " + +// ((JSONObject) obj).toString(MSOJsonIndentFactor)); + keyValue = getJsonValueForKey((JSONObject) obj, key); + if (keyValue != null) { +// msoLogger.debug("getJsonValueForKey(): found value=" + keyValue + ", for key=" + key); + break; + } + } else { + msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", does not point to a JSONObject, next key"); + } + } + } + } catch (Exception e) { + // JSONObject::get() throws a "not found" exception if one of the specified keys is not found + if (e.getMessage().contains("not found")) { + msoLogger.debug("getJsonValueForKey(): failed to retrieve param value for key=" + key + ": " + e.getMessage()); + } else { + msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(), e); + } + keyValue = null; + } + return keyValue; + } + + /** + * Walks the JSONObject (and sub-objects recursively), searching for the first value associated with the + * single key/field name specified. Returns the associated value if found or null if the key is not found + * + * @param jsonObj JSONObject representation of the the JSON doc + * @param key key to the target value + * @return String field value associated with key + */ + public static Integer getJsonIntValueForKey(JSONObject jsonObj, String key) { +// String isDebugLogEnabled = "true"; + Integer keyValue = null; + try { + if (jsonObj.has(key)) { + Integer value = (Integer) jsonObj.get(key); + msoLogger.debug("getJsonIntValueForKey(): found value=" + value + ", for key=" + key); + return value; + } else { +// msoLogger.debug("getJsonIntValueForKey(): iterating over the keys"); + Iterator itr = jsonObj.keys(); + while (itr.hasNext()) { + String nextKey = itr.next(); + Object obj = jsonObj.get(nextKey); + if (obj instanceof JSONObject) { +// msoLogger.debug("getJsonIntValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call"); + keyValue = getJsonIntValueForKey((JSONObject) obj, key); + if (keyValue != null) { +// msoLogger.debug("getJsonIntValueForKey(): found value=" + keyValue + ", for key=" + key); + break; + } + } else { + msoLogger.debug("getJsonIntValueForKey(): key=" + nextKey + ", does not point to a JSONObject, next key"); + } + } + } + } catch (Exception e) { + // JSONObject::get() throws a "not found" exception if one of the specified keys is not found + if (e.getMessage().contains("not found")) { + msoLogger.debug("getJsonIntValueForKey(): failed to retrieve param value for key=" + key + ": " + e.getMessage()); + } else { + msoLogger.debug("getJsonIntValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(),e); + } + keyValue = null; + } + return keyValue; + } + + /** + * Walks the JSONObject (and sub-objects recursively), searching for the first value associated with the + * single key/field name specified. Returns the associated value if found or null if the key is not found + * + * @param jsonObj JSONObject representation of the the JSON doc + * @param key key to the target value + * @return String field value associated with key + */ + public static Boolean getJsonBooleanValueForKey(JSONObject jsonObj, String key) { + Boolean keyValue = null; + try { + if (jsonObj.has(key)) { + Boolean value = (Boolean) jsonObj.get(key); + msoLogger.debug("getJsonBooleanValueForKey(): found value=" + value + ", for key=" + key); + return value; + } else { +// msoLogger.debug("getJsonBooleanValueForKey(): iterating over the keys"); + Iterator itr = jsonObj.keys(); + while (itr.hasNext()) { + String nextKey = itr.next(); + Object obj = jsonObj.get(nextKey); + if (obj instanceof JSONObject) { +// msoLogger.debug("getJsonBooleanValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call"); + keyValue = getJsonBooleanValueForKey((JSONObject) obj, key); + if (keyValue != null) { +// msoLogger.debug("getJsonBooleanValueForKey(): found value=" + keyValue + ", for key=" + key); + break; + } + } else { + msoLogger.debug("getJsonBooleanValueForKey(): key=" + nextKey + ", does not point to a JSONObject, next key"); + } + } + } + } catch (Exception e) { + // JSONObject::get() throws a "not found" exception if one of the specified keys is not found + if (e.getMessage().contains("not found")) { + msoLogger.debug("getJsonBooleanValueForKey(): failed to retrieve param value for key=" + key + ": " + e.getMessage()); + } else { + msoLogger.debug("getJsonBooleanValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(),e); + } + keyValue = null; + } + return keyValue; + } + + /** + * Boolean method to determine if a key path is valid for the JSON doc. Invokes + * getJsonValue(). + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @return Boolean true if keys points to value in the JSON doc + */ + public static Boolean jsonValueExists(String jsonStr, String keys) { + if (getJsonRawValue(jsonStr, keys) == null) { + return false; + } else { + return true; + } + } + + /** + * Inserts the new key/value pair at the appropriate location in the JSON + * document after first determining if keyed field already exists. If + * it does exist, return the JSON unmodified, otherwise return the new JSON + * Note: this method currently only supports String value inserts. + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the value to be added in the format of "key1.key2.key3..." + * @return String containing the updated JSON doc + */ + public static String addJsonValue(String jsonStr, String keys, String value) { + + // only attempt to insert the key/value pair if it does not exist + if (!jsonValueExists(jsonStr, keys)) { + return putJsonValue(jsonStr, keys, value); + } else { + msoLogger.debug("addJsonValue(): JSON add failed, key=" + keys + "/value=" + value + " already exists"); + return jsonStr; + } + } + + /** + * Updates the value for the specified key in the JSON document + * after first determining if keyed field exists. If it does + * not exist, return the JSON unmodified, otherwise return the updated JSON. + * Note: this method currently only supports String value updates. + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the value to be updated in the format of "key1.key2.key3..." + * @return String containing the updated JSON doc + */ + public static String updJsonValue(String jsonStr, String keys, String newValue) { +// String isDebugLogEnabled = "true"; + // only attempt to modify the key/value pair if it exists + if (jsonValueExists(jsonStr, keys)) { + return putJsonValue(jsonStr, keys, newValue); + } else { + msoLogger.debug("updJsonValue(): JSON update failed, no value exists for key=" + keys); + return jsonStr; + } + } + + /** + * Deletes the value for the specified key in the JSON document + * after first determining if keyed field exists. If it does + * not exist, return the JSON unmodified, otherwise return the updated JSON + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the value to be deleted in the format of "key1.key2.key3..." + * @return String containing the updated JSON doc + */ + public static String delJsonValue(String jsonStr, String keys) { + + // only attempt to remove the key/value pair if it exists + if (jsonValueExists(jsonStr, keys)) { + // passing a null value results in a delete + return putJsonValue(jsonStr, keys, null); + } else { + msoLogger.debug("delJsonValue(): JSON delete failed, no value exists for key=" + keys); + return jsonStr; + } + } + + /** + * Walks the JSON doc using the full key path to retrieve the associated + * value. All but the last key points to the 'parent' object name(s) in order + * in the JSON hierarchy with the last key pointing to the target value. + * The value returned is a Java object. + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @return Object field value associated with keys + */ + private static Object getJsonRawValue(String jsonStr, String keys) { + return getJsonRawValue(jsonStr, keys, false); + } + + /** + * Walks the JSON doc using the full key path to retrieve the associated + * value. All but the last key points to the 'parent' object name(s) in order + * in the JSON hierarchy with the last key pointing to the target value. + * The value returned is a Java object. + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @param wrap Boolean which determines if returned JSONObjects sould be "wrapped" + * Note: wrap does not apply to returned scalar values + * @return Object field value associated with keys + */ + private static Object getJsonRawValue(String jsonStr, String keys, Boolean wrap) { + + String keyStr = ""; + try { + JSONObject jsonObj = new JSONObject(jsonStr); + StringTokenizer keyTokens = new StringTokenizer(keys, "."); + while (keyTokens.hasMoreElements()) { + keyStr = keyTokens.nextToken(); + Object keyValue = jsonObj.get(keyStr); + if (keyValue instanceof JSONObject) { +// msoLogger.debug("getJsonRawValue(): key=" + keyStr + " points to json object"); + jsonObj = (JSONObject) keyValue; + } else { + if (keyTokens.hasMoreElements()) { + msoLogger.debug("getJsonRawValue(): value found prior to last key for key=" + keyStr); + } + return keyValue; + } + } + // return the json 'node' that the key points to + // note: since this is a json object and not a scalar value, + // use the wrap flag to determine if the object should + // be wrapped with a root node value + // (the last key in the keys String) + if (wrap) { + JSONObject wrappedJsonObj = new JSONObject(); + wrappedJsonObj.put(keyStr, jsonObj); + return wrappedJsonObj.toString(); + } else { + return jsonObj.toString(); + } + + } catch (Exception e) { + // JSONObject::get() throws a "not found" exception if one of the specified keys is not found + if (e.getMessage().contains("not found")) { + msoLogger.debug("getJsonRawValue(): failed to retrieve param value for key=" + keyStr + ": " + e.getMessage()); + } else { + msoLogger.debug("getJsonRawValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e); + } + } + return null; + } + + /** + * Private method invoked by the public add, update, and delete methods. + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the value to be deleted in the format of "key1.key2.key3..." + * @return String containing the updated JSON doc + */ + private static String putJsonValue(String jsonStr, String keys, String value) { + + String keyStr = ""; + try { + JSONObject jsonObj = new JSONObject(jsonStr); + JSONObject jsonObjOut = jsonObj; + StringTokenizer keyTokens = new StringTokenizer(keys, "."); + while (keyTokens.hasMoreElements()) { + keyStr = keyTokens.nextToken(); + if (keyTokens.hasMoreElements()) { + Object keyValue = jsonObj.get(keyStr); + if (keyValue instanceof JSONObject) { +// msoLogger.debug("putJsonValue(): key=" + keyStr + " points to json object"); + jsonObj = (JSONObject) keyValue; + } else { + msoLogger.debug("putJsonValue(): key=" + keyStr + " not the last key but points to non-json object: " + keyValue); + return null; + } + } else { // at the last/new key value + jsonObj.put(keyStr, value); + return jsonObjOut.toString(3); + } + } + // should not hit this point if the key points to a valid key value + return null; + + } catch (Exception e) { + // JSONObject::get() throws a "not found" exception if one of the specified keys is not found + if (e.getMessage().contains("not found")) { + msoLogger.debug("putJsonValue(): failed to put param value for key=" + keyStr + ": " + e.getMessage()); + } else { + msoLogger.debug("putJsonValue(): unable to parse json to put value for key=" + keys + ". Exception was: " + e.toString(),e); + } + } + return null; + } + + /** + * This json util method converts a json array of Key Value + * pair objects into a Java Map. + * + * @param execution + * @param entryArray - the getJsonValue of a json Array of key/value pairs + * + * @return Map - a Map containing the entries + */ + public Map jsonStringToMap(DelegateExecution execution, String entry) { + msoLogger.debug("Started Json String To Map Method"); + + Map map = new HashMap<>(); + + //Populate Map + JSONObject obj = new JSONObject(entry); + + /* Wildfly is pushing a version of org.json which does not + * auto cast to string. Leaving it as an object prevents + * a method not found exception at runtime. + */ + final Iterator keys = obj.keys(); + while (keys.hasNext()) { + final String key = keys.next(); + map.put(key, obj.getString(key)); + } + msoLogger.debug("Outgoing Map is: " + map); + msoLogger.debug("Completed Json String To Map Method"); + return map; + } + + /** + * This json util method converts a json array of Key Value + * pair objects into a Java Map. + * + * @param execution + * @param entryArray - the getJsonValue of a json Array of key/value pairs + * @param keyNode - the name of the node that represents the key + * @param valueNode - the name of the node that represents the value + * @return Map - a Map containing the entries + * + */ + public Map entryArrayToMap(DelegateExecution execution, String entryArray, String keyNode, String valueNode) { + msoLogger.debug("Started Entry Array To Map Util Method"); + + Map map = new HashMap<>(); + //Populate Map + String entryListJson = "{ \"wrapper\":" + entryArray + "}"; + JSONObject obj = new JSONObject(entryListJson); + JSONArray arr = obj.getJSONArray("wrapper"); + for (int i = 0; i < arr.length(); i++){ + JSONObject jo = arr.getJSONObject(i); + String key = jo.getString(keyNode); + String value = jo.getString(valueNode); + map.put(key, value); + } + msoLogger.debug("Completed Entry Array To Map Util Method"); + return map; + } + + /** + * This json util method converts a json array of Key Value pair objects into a Java Map. + * + * @param entryArray - the json Array of key/value pairs objects + * @param keyNode - the name of the node that represents the key + * @param valueNode - the name of the node that represents the value + * @return Map - a Map containing the entries + * @author cb645j + * + */ + public Map entryArrayToMap(String entryArray, String keyNode, String valueNode){ + msoLogger.debug("Started Entry Array To Map Util Method"); + + Map map = new HashMap<>(); + String entryListJson = "{ \"wrapper\":" + entryArray + "}"; + JSONObject obj = new JSONObject(entryListJson); // TODO just put in json array + JSONArray arr = obj.getJSONArray("wrapper"); + for(int i = 0; i < arr.length(); i++){ + JSONObject jo = arr.getJSONObject(i); + String key = jo.getString(keyNode); + String value = jo.getString(valueNode); + map.put(key, value); + } + msoLogger.debug("Completed Entry Array To Map Util Method"); + return map; + } + + /** + * This json util method converts a json Array of Strings to a Java List. It takes each + * String in the json Array and puts it in a Java List. + * + * @param execution + * @param jsonArray - string value of a json array + * @return List - a java list containing the strings + * + * @author cb645j + */ + public List StringArrayToList(Execution execution, String jsonArray){ + msoLogger.debug("Started String Array To List Util Method"); + + List list = new ArrayList<>(); + // Populate List + // TODO + String stringListJson = "{ \"strings\":" + jsonArray + "}"; + JSONObject obj = new JSONObject(stringListJson); + JSONArray arr = obj.getJSONArray("strings"); + for(int i = 0; i < arr.length(); i++){ + String s = arr.get(i).toString(); + list.add(s); + } + msoLogger.debug("Outgoing List is: " + list); + msoLogger.debug("Completed String Array To List Util Method"); + return list; + } + + /** + * This json util method converts a json Array of Strings to a Java List. It takes each + * String in the json Array and puts it in a Java List. + * + * @param jsonArray - string value of a json array + * @return List - a java list containing the strings + * + * @author cb645j + */ + public List StringArrayToList(String jsonArray){ + msoLogger.debug("Started Json Util String Array To List"); + List list = new ArrayList<>(); + + JSONArray arr = new JSONArray(jsonArray); + for(int i = 0; i < arr.length(); i++){ + String s = arr.get(i).toString(); + list.add(s); + } + msoLogger.debug("Completed Json Util String Array To List"); + return list; + } + + /** + * This json util method converts a json Array of Strings to a Java List. It takes each + * String in the json Array and puts it in a Java List. + * + * @param jsonArray - json array + * @return List - a java list containing the strings + * + * @author cb645j + */ + public List StringArrayToList(JSONArray jsonArray){ + msoLogger.debug("Started Json Util String Array To List"); + List list = new ArrayList<>(); + + for(int i = 0; i < jsonArray.length(); i++){ + String s = jsonArray.get(i).toString(); + list.add(s); + } + msoLogger.debug("Completed Json Util String Array To List"); + return list; + } + + /** + * + * Invokes the getJsonRawValue() method to determine if the json element/variable exist. + * Returns true if the json element exist + * + * @param jsonStr - String containing the JSON doc + * @param keys - full key path to the target value in the format of "key1.key2.key3..." + * @return boolean field value associated with keys + * + */ + public static boolean jsonElementExist(String jsonStr, String keys){ + + try{ + Object rawValue = getJsonRawValue(jsonStr, keys); + + return !(rawValue == null); + + } catch(Exception e){ + msoLogger.debug("jsonElementExist(): unable to determine if json element exist. Exception is: " + e.toString(), e); + } + return true; + } + + /** + * + * Validates the JSON document against a schema file. + * + * @param jsonStr String containing the JSON doc + * @param jsonSchemaPath full path to a valid JSON schema file + * + */ + public static String jsonSchemaValidation(String jsonStr, String jsonSchemaPath) throws ValidationException { + try { + msoLogger.debug("JSON document to be validated: " + jsonStr); + JsonNode document = JsonLoader.fromString(jsonStr); +// JsonNode document = JsonLoader.fromFile(jsonDoc); + JsonNode schema = JsonLoader.fromPath(jsonSchemaPath); + + JsonSchemaFactory factory = JsonSchemaFactory.byDefault(); + JsonValidator validator = factory.getValidator(); + + ProcessingReport report = validator.validate(schema, document); + msoLogger.debug("JSON schema validation report: " + report.toString()); + return report.toString(); + } catch (IOException e) { + msoLogger.debug("IOException performing JSON schema validation on document: " + e.toString()); + throw new ValidationException(e.getMessage()); + } catch (ProcessingException e) { + msoLogger.debug("ProcessingException performing JSON schema validation on document: " + e.toString()); + throw new ValidationException(e.getMessage()); + } + } +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java new file mode 100644 index 0000000000..f261b56f00 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java @@ -0,0 +1,254 @@ +/*- + * ============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.bpmn.core.xml; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.StringReader; +import java.io.StringWriter; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; + +import org.apache.commons.lang3.StringEscapeUtils; +import org.onap.so.logger.MsoLogger; +import org.w3c.dom.Document; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * XML transformation methods and other useful functions. + */ +public final class XmlTool { + + private static final Map ENTITIES = new HashMap<>(); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.BPEL, XmlTool.class); + static { + ENTITIES.put("amp", 38); + ENTITIES.put("quot", 34); + ENTITIES.put("lt", 60); + ENTITIES.put("gt", 62); + } + + /** + * Instantiation is not allowed. + */ + private XmlTool() { + } + + /** + * Normalizes and formats XML. This method consolidates and moves all namespace + * declarations to the root element. The result will not have an XML prolog or + * a trailing newline. + * @param xml the XML to normalize + * @throws IOException + * @throws TransformerException + * @throws ParserConfigurationException + * @throws SAXException + * @throws XPathExpressionException + */ + public static String normalize(Object xml) throws IOException, TransformerException, + ParserConfigurationException, SAXException, XPathExpressionException { + + if (xml == null) { + return null; + } + + Source xsltSource = new StreamSource(new StringReader( + readResourceFile("normalize-namespaces.xsl"))); + + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); + dbFactory.setNamespaceAware(true); + dbFactory.setFeature("http://xml.org/sax/features/external-general-entities", false); + dbFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + DocumentBuilder db = dbFactory.newDocumentBuilder(); + InputSource source = new InputSource(new StringReader(String.valueOf(xml))); + Document doc = db.parse(source); + + // Start of code to remove whitespace outside of tags + XPath xPath = XPathFactory.newInstance().newXPath(); + NodeList nodeList = (NodeList) xPath.evaluate( + "//text()[normalize-space()='']", doc, XPathConstants.NODESET); + + for (int i = 0; i < nodeList.getLength(); ++i) { + Node node = nodeList.item(i); + node.getParentNode().removeChild(node); + } + // End of code to remove whitespace outside of tags + + // the factory pattern supports different XSLT processors + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + Transformer transformer = transformerFactory.newTransformer(xsltSource); + + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); + + StringWriter writer = new StringWriter(); + transformer.transform(new DOMSource(doc), new StreamResult(writer)); + return writer.toString().trim(); + } + + /** + * Encodes a value so it can be used inside an XML text element. + * @param value the string to encode + * @return the encoded string + */ + public static String encode(Object value) { + if (value == null) { + return null; + } + return StringEscapeUtils.escapeXml11(value.toString()); + } + + /** + * Removes the preamble, if present, from an XML document. + * @param xml the XML document + * @return a possibly modified document + */ + public static String removePreamble(Object xml) { + if (xml == null) { + return null; + } + + return String.valueOf(xml).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", ""); + } + + /** + * Removes namespaces and namespace declarations from an XML document. + * @param xml the XML document + * @return a possibly modified document + */ + public static String removeNamespaces(Object xml) { + if (xml == null) { + LOGGER.debug("removeNamespaces input object is null , returning null"); + return null; + } + + String text = String.valueOf(xml); + + // remove xmlns declaration + text = text.replaceAll("xmlns.*?(\"|\').*?(\"|\')", ""); + // remove opening tag prefix + text = text.replaceAll("(<)(\\w+:)(.*?>)", "$1$3"); + // remove closing tags prefix + text = text.replaceAll("()", "$1$3"); + // remove extra spaces left when xmlns declarations are removed + text = text.replaceAll("\\s+>", ">"); + + return text; + } + + + /** + * Reads the specified resource file and return the contents as a string. + * @param file Name of the resource file + * @return the contents of the resource file as a String + * @throws IOException if there is a problem reading the file + */ + private static String readResourceFile(String file) throws IOException { + + try (InputStream stream = XmlTool.class.getClassLoader().getResourceAsStream(file); + Reader reader = new InputStreamReader(stream, "UTF-8")) { + + StringBuilder out = new StringBuilder(); + char[] buf = new char[1024]; + int n; + + while ((n = reader.read(buf)) >= 0) { + out.append(buf, 0, n); + } + return out.toString(); + } catch (Exception e) { + LOGGER.debug("Exception at readResourceFile stream: " + e); + return null; + } + } + + /** + * Parses the XML document String for the first occurrence of the specified element tag. + * If found, the value associated with that element tag is replaced with the new value + * and a String containing the modified XML document is returned. If the XML passed is + * null or the element tag is not found in the document, null will be returned. + * @param xml String containing the original XML document. + * @param elementTag String containing the tag of the element to be modified. + * @param newValue String containing the new value to be used to modify the corresponding element. + * @return the contents of the modified XML document as a String or null/empty if the modification failed. + * @throws IOException, TransformerException, ParserConfigurationException, SAXException + */ + public static Optional modifyElement(String xml, String elementTag, String newValue) throws IOException, TransformerException, + ParserConfigurationException, SAXException { + + if (xml == null || xml.isEmpty()) { + // no XML content to be modified, return empty + return Optional.empty(); + } + + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); + dbFactory.setNamespaceAware(true); + dbFactory.setFeature("http://xml.org/sax/features/external-general-entities", false); + dbFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + DocumentBuilder db = dbFactory.newDocumentBuilder(); + InputSource source = new InputSource(new StringReader(xml)); + Document doc = db.parse(source); + + Node modNode = doc.getElementsByTagName(elementTag).item(0); + if (modNode == null) { + // did not find the specified element to be modified, return empty + //System.out.println("Did not find element tag " + elementTag + " in XML"); + return Optional.empty(); + } else { + modNode.setTextContent(newValue); + } + + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + Transformer transformer = transformerFactory.newTransformer(); + StringWriter writer = new StringWriter(); + transformer.transform(new DOMSource(doc), new StreamResult(writer)); + // return the modified String representation of the XML + return Optional.of(writer.toString().trim()); + } +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BPMNLogger.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BPMNLogger.java deleted file mode 100644 index 042cac454d..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BPMNLogger.java +++ /dev/null @@ -1,33 +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.bpmn.core; - -import org.openecomp.mso.logger.MsoLogger; - -public class BPMNLogger { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - public static void debug (String isDebugLogEnabled, String LogText) { - if (("true").equalsIgnoreCase(isDebugLogEnabled)) - msoLogger.debug(LogText); - } -} - diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BadInjectedFieldException.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BadInjectedFieldException.java deleted file mode 100644 index 09015f0808..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BadInjectedFieldException.java +++ /dev/null @@ -1,52 +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.bpmn.core; - -public class BadInjectedFieldException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - /** - * Constructor. - * - * @param fieldName the field name - * @param taskName the task name - * @param info additional information, e.g. the field value - */ - public BadInjectedFieldException(String fieldName, String taskName, - Object info) { - super(taskName + " injected field '" + fieldName + "' is bad: " + info); - } - - /** - * Constructor. - * - * @param fieldName the field name - * @param taskName the task name - * @param info additional information, e.g. the field value - * @param cause the cause - */ - public BadInjectedFieldException(String fieldName, - String taskName, Object info, Throwable cause) { - super(taskName + " injected field '" + fieldName + "' is bad: " - + info, cause); - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BaseTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BaseTask.java deleted file mode 100644 index 77e418d4c3..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BaseTask.java +++ /dev/null @@ -1,454 +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.bpmn.core; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.Expression; -import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.openecomp.mso.bpmn.core.internal.VariableNameExtractor; - -/** - * Base class for service tasks. - */ -public class BaseTask implements JavaDelegate { - - /** - * Get the value of a required field. This method throws - * MissingInjectedFieldException if the expression is null, and - * BadInjectedFieldException if the expression evaluates to a null - * value. - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the field value - */ - protected Object getField(Expression expression, - DelegateExecution execution, String fieldName) { - return getFieldImpl(expression, execution, fieldName, false); - } - - /** - * Gets the value of an optional field. There are three conditions - * in which this method returns null: - *

- *

    - *
  1. The expression itself is null (i.e. the field is missing - * altogether.
  2. - *
  3. The expression evaluates to a null value.
  4. - *
  5. The expression references a single variable which has not - * been set.
  6. - *
- *

- * Examples:
- * Expression ${x} when x is null: return null
- * Expression ${x} when x is unset: return null
- * Expression ${x+y} when x and/or y are unset: exception
- * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the field value, possibly null - */ - protected Object getOptionalField(Expression expression, - DelegateExecution execution, String fieldName) { - return getFieldImpl(expression, execution, fieldName, true); - } - - /** - * Get the value of a required output variable field. This method - * throws MissingInjectedFieldException if the expression is null, and - * BadInjectedFieldException if the expression produces a null or - * illegal variable name. Legal variable names contain only letters, - * numbers, and the underscore character ('_'). - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the output variable name - */ - protected String getOutputField(Expression expression, - DelegateExecution execution, String fieldName) { - Object o = getFieldImpl(expression, execution, fieldName, false); - if (o instanceof String) { - String variable = (String) o; - if (!isLegalVariable(variable)) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "'" + variable - + "' is not a legal variable name"); - } - return variable; - } else { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "expected a variable name string" - + ", got object of type " + o.getClass().getName()); - } - } - - /** - * Get the value of an optional output variable field. This method - * throws BadInjectedFieldException if the expression produces an illegal - * variable name. Legal variable names contain only letters, numbers, - * and the underscore character ('_'). - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the output variable name, possibly null - */ - protected String getOptionalOutputField(Expression expression, - DelegateExecution execution, String fieldName) { - Object o = getFieldImpl(expression, execution, fieldName, true); - if (o instanceof String) { - String variable = (String) o; - if (!isLegalVariable(variable)) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "'" + variable - + "' is not a legal variable name"); - } - return variable; - } else if (o == null) { - return null; - } else { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "expected a variable name string" - + ", got object of type " + o.getClass().getName()); - } - } - - /** - * Get the value of a required string field. This method throws - * MissingInjectedFieldException if the expression is null, and - * BadInjectedFieldException if the expression evaluates to a null - * value. - *

- * Note: the result is coerced to a string value, if necessary. - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the field value - */ - protected String getStringField(Expression expression, - DelegateExecution execution, String fieldName) { - Object o = getFieldImpl(expression, execution, fieldName, false); - if (o instanceof String) { - return (String) o; - } else { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "cannot convert '" + o.toString() - + "' to Integer"); - } - } - - /** - * Gets the value of an optional string field. There are three conditions - * in which this method returns null: - *

- *

    - *
  1. The expression itself is null (i.e. the field is missing - * altogether.
  2. - *
  3. The expression evaluates to a null value.
  4. - *
  5. The expression references a single variable which has not - * been set.
  6. - *
- *

- * Examples:
- * Expression ${x} when x is null: return null
- * Expression ${x} when x is unset: return null
- * Expression ${x+y} when x and/or y are unset: exception
- *

- * Note: the result is coerced to a string value, if necessary. - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the field value, possibly null - */ - protected String getOptionalStringField(Expression expression, - DelegateExecution execution, String fieldName) { - Object o = getFieldImpl(expression, execution, fieldName, true); - if (o instanceof String) { - return (String) o; - } else if (o == null) { - return null; - } else { - return o.toString(); - } - } - - /** - * Get the value of a required integer field. This method throws - * MissingInjectedFieldException if the expression is null, and - * BadInjectedFieldException if the expression evaluates to a null - * value or a value that cannot be coerced to an integer. - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the field value - */ - protected Integer getIntegerField(Expression expression, - DelegateExecution execution, String fieldName) { - Object o = getFieldImpl(expression, execution, fieldName, false); - if (o instanceof Integer) { - return (Integer) o; - } else { - try { - return Integer.parseInt(o.toString()); - } catch (NumberFormatException e) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "cannot convert '" + o.toString() - + "' to Integer"); - } - } - } - - /** - * Gets the value of an optional integer field. There are three conditions - * in which this method returns null: - *

- *

    - *
  1. The expression itself is null (i.e. the field is missing - * altogether.
  2. - *
  3. The expression evaluates to a null value.
  4. - *
  5. The expression references a single variable which has not - * been set.
  6. - *
- *

- * Examples:
- * Expression ${x} when x is null: return null
- * Expression ${x} when x is unset: return null
- * Expression ${x+y} when x and/or y are unset: exception
- *

- * Note: the result is coerced to an integer value, if necessary. This - * method throws BadInjectedFieldException if the result cannot be coerced - * to an integer. - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the field value, possibly null - */ - protected Integer getOptionalIntegerField(Expression expression, - DelegateExecution execution, String fieldName) { - Object o = getFieldImpl(expression, execution, fieldName, true); - if (o instanceof Integer) { - return (Integer) o; - } else if (o == null) { - return null; - } else { - try { - return Integer.parseInt(o.toString()); - } catch (NumberFormatException e) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "cannot convert '" + o.toString() - + "' to Integer"); - } - } - } - - /** - * Gets the value of an optional long field. There are three conditions - * in which this method returns null: - *

- *

    - *
  1. The expression itself is null (i.e. the field is missing - * altogether.
  2. - *
  3. The expression evaluates to a null value.
  4. - *
  5. The expression references a single variable which has not - * been set.
  6. - *
- *

- * Examples:
- * Expression ${x} when x is null: return null
- * Expression ${x} when x is unset: return null
- * Expression ${x+y} when x and/or y are unset: exception
- *

- * Note: the result is coerced to a long value, if necessary. This - * method throws BadInjectedFieldException if the result cannot be coerced - * to a long. - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the field value, possibly null - */ - protected Long getOptionalLongField(Expression expression, - DelegateExecution execution, String fieldName) { - Object o = getFieldImpl(expression, execution, fieldName, true); - if (o instanceof Long) { - return (Long) o; - } else if (o == null) { - return null; - } else { - try { - return Long.parseLong(o.toString()); - } catch (NumberFormatException e) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "cannot convert '" + o.toString() - + "' to Long"); - } - } - } - - /** - * Get the value of a required long field. This method throws - * MissingInjectedFieldException if the expression is null, and - * BadInjectedFieldException if the expression evaluates to a null - * value or a value that cannot be coerced to a long. - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the field value - */ - protected Long getLongField(Expression expression, - DelegateExecution execution, String fieldName) { - Object o = getFieldImpl(expression, execution, fieldName, false); - if (o instanceof Long) { - return (Long) o; - } else { - try { - return Long.parseLong(o.toString()); - } catch (NumberFormatException e) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "cannot convert '" + o.toString() - + "' to Long"); - } - } - } - - /** - * Common implementation for field "getter" methods. - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @param optional true if the field is optional - * @return the field value, possibly null - */ - private Object getFieldImpl(Expression expression, - DelegateExecution execution, String fieldName, boolean optional) { - if (expression == null) { - if (!optional) { - throw new MissingInjectedFieldException( - fieldName, getTaskName()); - } - return null; - } - - Object value = null; - - try { - value = expression.getValue(execution); - } catch (Exception e) { - if (!optional) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), e.getClass().getSimpleName(), e); - } - - // At this point, we have an exception that occurred while - // evaluating an expression for an optional field. A common - // problem is that the expression is a simple reference to a - // variable which has never been set, e.g. the expression is - // ${x}. The normal activiti behavior is to throw an exception, - // but we don't like that, so we have the following workaround, - // which parses the expression text to see if it is a "simple" - // variable reference, and if so, returns null. If the - // expression is anything other than a single variable - // reference, then an exception is thrown, as it would have - // been without this workaround. - - // Get the expression text so we can parse it - String s = expression.getExpressionText(); - new VariableNameExtractor(s).extract().ifPresent(name -> { - if (execution.hasVariable(name)) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), e.getClass().getSimpleName(), e); - } - }); - } - - if (value == null && !optional) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "required field has null value"); - } - - return value; - } - - /** - * Tests if a character is a "word" character. - * - * @param c the character - * @return true if the character is a "word" character. - */ - private static boolean isWordCharacter(char c) { - return (Character.isLetterOrDigit(c) || c == '_'); - } - - /** - * Tests if the specified string is a legal flow variable name. - * - * @param name the string - * @return true if the string is a legal flow variable name - */ - private boolean isLegalVariable(String name) { - if (name == null) { - return false; - } - - int len = name.length(); - - if (len == 0) { - return false; - } - - char c = name.charAt(0); - - if (!Character.isLetter(c) && c != '_') { - return false; - } - - for (int i = 1; i < len; i++) { - c = name.charAt(i); - if (!Character.isLetterOrDigit(c) && c != '_') { - return false; - } - } - - return true; - } - - /** - * Returns the name of the task (normally the java class name). - * - * @return the name of the task - */ - public String getTaskName() { - return getClass().getSimpleName(); - } - - @Override - public void execute(DelegateExecution execution) throws Exception { - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java deleted file mode 100644 index 1e55586be3..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java +++ /dev/null @@ -1,285 +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.bpmn.core; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.util.Base64; -import java.util.Map; -import java.util.UUID; - -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.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.camunda.bpm.engine.ProcessEngines; -import org.openecomp.mso.HealthCheckUtils; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.utils.CryptoUtils; -import org.openecomp.mso.utils.UUIDChecker; - -@Path("/") -public class HealthCheckHandler { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - private static final String SITENAME = "mso.sitename"; - private static final String ADAPTER_ENDPOINT = "mso.adapters.openecomp.db.endpoint"; - private static final String ADAPTER_NAMESPACE = "mso.adapters.namespace"; - private static final String CONFIG = "mso.bpmn.urn.properties"; - private static final String CREDENTIAL = "mso.adapters.db.auth"; - private static final String MSOKEY = "mso.msoKey"; - private String healthcheckDebugEnabled = "mso.healthcheck.log.debug"; - - private static final String CHECK_HTML = "Health CheckApplication ready"; - private static final String NOT_FOUND = "Application Not StartedApplication not started. Properties file missing or invalid or database Connection failed"; - private static final String NOT_HEALTHY = "Application Not StartedApplication not available or at least one of the sub-modules is not available."; - public static final Response HEALTH_CHECK_RESPONSE = Response.status (HttpStatus.SC_OK) - .entity (CHECK_HTML) - .build (); - public static final Response HEALTH_CHECK_NOK_RESPONSE = Response.status (HttpStatus.SC_SERVICE_UNAVAILABLE) - .entity (NOT_HEALTHY) - . build (); - public static final Response NOT_STARTED_RESPONSE = Response.status (HttpStatus.SC_SERVICE_UNAVAILABLE) - .entity (NOT_FOUND) - .build (); - - @HEAD - @GET - @Path("/nodehealthcheck") - @Produces("text/html") - public Response nodeHealthcheck () { - MsoLogger.setServiceName ("NodeHealthcheck"); - // Generate a Request Id - String requestId = UUIDChecker.generateUUID(msoLogger); - - PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); - Map props = propertyConfiguration.getProperties(CONFIG); - - if (props == null) { - - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.AvailabilityError, "Unable to load " + CONFIG); - - return NOT_STARTED_RESPONSE; - } - - String siteName = props.get(SITENAME); - String endpoint = props.get(ADAPTER_ENDPOINT); - - if (null == siteName || siteName.length () == 0 || null == endpoint || endpoint.length () == 0) { - - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, "Unable to load key attributes (" + SITENAME + " or " + ADAPTER_ENDPOINT + ") from the config file:" + CONFIG); - - return NOT_STARTED_RESPONSE; - } - - try { - if (!this.getSiteStatus (endpoint, siteName, props.get(CREDENTIAL), props.get(MSOKEY), props.get(ADAPTER_NAMESPACE))) { - msoLogger.debug("This site is currently disabled for maintenance."); - return HEALTH_CHECK_NOK_RESPONSE; - } - } catch (Exception e) { - - msoLogger.error(MessageEnum.GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception while getting SiteStatus", e); - - msoLogger.debug("Exception while getting SiteStatus"); - return NOT_STARTED_RESPONSE; - } - - - HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (healthCheck.verifyNodeHealthCheck(HealthCheckUtils.NodeType.BPMN, 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; - } - } - - @HEAD - @GET - @Path("/healthcheck") - @Produces("text/html") - public Response healthcheck (@QueryParam("requestId") String requestId) { - MsoLogger.setServiceName ("Healthcheck"); - verifyOldUUID(requestId); - - PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); - Map props = propertyConfiguration.getProperties(CONFIG); - - if (props == null) { - - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.AvailabilityError, "Unable to load " + CONFIG); - - return NOT_STARTED_RESPONSE; - } - - String siteName = props.get(SITENAME); - String endpoint = props.get(ADAPTER_ENDPOINT); - - if (null == siteName || siteName.length () == 0 || null == endpoint || endpoint.length () == 0) { - - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, "Unable to load key attributes (" + SITENAME + " or " + ADAPTER_ENDPOINT + ") from the config file:" + CONFIG); - - return NOT_STARTED_RESPONSE; - } - - try { - if (!this.getSiteStatus (endpoint, siteName, props.get(CREDENTIAL), props.get(MSOKEY), props.get(ADAPTER_NAMESPACE))) { - msoLogger.debug("This site is currently disabled for maintenance."); - return HEALTH_CHECK_NOK_RESPONSE; - } - } catch (Exception e) { - - msoLogger.error(MessageEnum.GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception while getting SiteStatus", e); - - msoLogger.debug("Exception while getting SiteStatus"); - return NOT_STARTED_RESPONSE; - } - - try { - // TODO: check the appropriate process engine - // ProcessEngines.getDefaultProcessEngine().getIdentityService().createGroupQuery().list(); - } catch (final Exception e) { - - msoLogger.error(MessageEnum.GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception while verifying Camunda engine", e); - - msoLogger.debug("Exception while verifying Camunda engine"); - return NOT_STARTED_RESPONSE; - } - - return HEALTH_CHECK_RESPONSE; - } - - - private String verifyOldUUID (String oldId) { - if (!isValidUUID(oldId)) { - String newId = UUID.randomUUID().toString(); - MsoLogger.setLogContext(newId, null); - return newId; - } - MsoLogger.setLogContext(oldId, null); - return oldId; - } - - - private boolean isValidUUID (String id) { - try { - if (null == id) { - return false; - } - UUID uuid = UUID.fromString(id); - return uuid.toString().equalsIgnoreCase(id); - } catch (IllegalArgumentException iae) { - msoLogger.debug("IllegalArgumentException :",iae); - return false; - } - } - - private String decrypt(String encryptedString, String key){ - try { - if (encryptedString != null && !encryptedString.isEmpty() && key != null && !key.isEmpty()) { - return CryptoUtils.decrypt(encryptedString, key); - } - } catch (Exception e) { - msoLogger.error(MessageEnum.GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Failed to decrypt credentials", e); - } - return null; - } - - private boolean getSiteStatus (String url, String site, String credential, String key, String adapterNamespace) throws Exception { - // set the connection timeout value to 30 seconds (30000 milliseconds) - RequestConfig.Builder requestBuilder = RequestConfig.custom(); - requestBuilder = requestBuilder.setConnectTimeout(30000); - requestBuilder = requestBuilder.setConnectionRequestTimeout(30000); - HttpClientBuilder builder = HttpClientBuilder.create (); - builder.setDefaultRequestConfig (requestBuilder.build ()); - - HttpPost post = new HttpPost(url); - - String cred = decrypt(credential, key); - if (cred != null && !cred.isEmpty()) { - post.setHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(cred.getBytes())); - } - if(healthcheckDebugEnabled == null){ - healthcheckDebugEnabled = "false"; - } - BPMNLogger.debug(healthcheckDebugEnabled, "Post url is: " + url); - - //now create a soap request message as follows: - final StringBuilder payload = new StringBuilder(); - payload.append("\n"); - payload.append("\n"); - payload.append("\n"); - payload.append("\n"); - payload.append("\n"); - payload.append("").append(site).append("\n"); - payload.append("\n"); - payload.append("\n"); - payload.append("\n"); - - BPMNLogger.debug(healthcheckDebugEnabled, "Initialize SOAP request to url:" + url); - BPMNLogger.debug(healthcheckDebugEnabled, "The payload of the request is:" + payload); - HttpEntity entity = new StringEntity(payload.toString(),"UTF-8"); - post.setEntity(entity); - - CloseableHttpClient client = builder.build (); - HttpResponse response = client.execute(post); - BPMNLogger.debug(healthcheckDebugEnabled, "Response received is:" + response); - - int statusCode = response.getStatusLine().getStatusCode(); - if (statusCode != 200) { - - msoLogger.error(MessageEnum.GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, - "Communication with DB Adapter failed, The response received from DB Adapter is with failed status code:" + statusCode); - - Exception e = new Exception("Communication with DB Adapter failed"); - throw e; - } - BufferedReader rd = new BufferedReader( - new InputStreamReader(response.getEntity().getContent())); - - StringBuilder result = new StringBuilder(); - String line = ""; - while ((line = rd.readLine()) != null) { - result.append(line); - } - BPMNLogger.debug(healthcheckDebugEnabled, "Content of the response is:" + result); - String status = result.substring(result.indexOf("") + 8, result.indexOf("")); - - client.close (); //shut down the connection - return Boolean.valueOf(status); - } -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldException.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldException.java deleted file mode 100644 index 7d019c5841..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldException.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.bpmn.core; - -/** - * A BadInjectedFieldException that indicates a required field is missing. - */ -public class MissingInjectedFieldException extends BadInjectedFieldException { - - private static final long serialVersionUID = 1L; - - /** - * Constructor. - * - * @param fieldName the field name - * @param taskName the task name - */ - public MissingInjectedFieldException(String fieldName, String taskName) { - super(fieldName, taskName, "missing required field"); - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java deleted file mode 100644 index f75722ecc5..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java +++ /dev/null @@ -1,443 +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.bpmn.core; - -import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; - -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.nio.file.ClosedWatchServiceException; -import java.nio.file.FileSystems; -import java.nio.file.Path; -import java.nio.file.WatchEvent; -import java.nio.file.WatchKey; -import java.nio.file.WatchService; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Properties; -import java.util.Timer; -import java.util.TimerTask; -import java.util.concurrent.ConcurrentHashMap; - -import org.slf4j.MDC; - -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * Loads the property configuration from file system and refreshes the - * properties when the property gets changed. - * - * WARNING: automatic refreshes might not work on network filesystems. - */ -public class PropertyConfiguration { - - /** - * The base name of the MSO BPMN properties file (mso.bpmn.properties). - */ - public static final String MSO_BPMN_PROPERTIES = "mso.bpmn.properties"; - - /** - * The base name of the MSO BPMN URN-Mappings properties file (mso.bpmn.urn.properties). - */ - public static final String MSO_BPMN_URN_PROPERTIES = "mso.bpmn.urn.properties"; - - /** - * The base name of the MSO Topology properties file (topology.properties). - */ - public static final String MSO_TOPOLOGY_PROPERTIES = "topology.properties"; - /** - * The name of the meta-property holding the time the properties were loaded - * from the file. - */ - public static final String TIMESTAMP_PROPERTY = "mso.properties.timestamp"; - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private static final List SUPPORTED_FILES = - Arrays.asList(MSO_BPMN_PROPERTIES, MSO_BPMN_URN_PROPERTIES, MSO_TOPOLOGY_PROPERTIES); - - private volatile String msoConfigPath = null; - - private final ConcurrentHashMap> propFileCache = - new ConcurrentHashMap<>(); - - private final Object CACHELOCK = new Object(); - private FileWatcherThread fileWatcherThread = null; - - // The key is the file name - private Map timerTaskMap = new HashMap<>(); - - /** - * Private Constructor. - */ - private PropertyConfiguration() { - startUp(); - } - - /** - * Singleton holder pattern eliminates locking when accessing the instance - * and still provides for lazy initialization. - */ - private static class PropertyConfigurationInstanceHolder { - private static PropertyConfiguration instance = new PropertyConfiguration(); - } - - /** - * Gets the one and only instance of this class. - */ - public static PropertyConfiguration getInstance() { - return PropertyConfigurationInstanceHolder.instance; - } - - static void resetPropertyConfigurationSingletonInstance(){ - PropertyConfigurationInstanceHolder.instance = new PropertyConfiguration(); - } - - /** - * Returns the list of supported files. - */ - public static List supportedFiles() { - return new ArrayList<>(SUPPORTED_FILES); - } - - /** - * May be called to restart the PropertyConfiguration if it was previously shut down. - */ - public synchronized void startUp() { - msoConfigPath = System.getProperty("mso.config.path"); - - if (msoConfigPath == null) { - LOGGER.debug("mso.config.path JVM system property is not set"); - return; - } - - try { - Path directory = FileSystems.getDefault().getPath(msoConfigPath); - WatchService watchService = FileSystems.getDefault().newWatchService(); - directory.register(watchService, ENTRY_MODIFY); - - LOGGER.info(MessageEnum.BPMN_GENERAL_INFO, "BPMN", "Starting FileWatcherThread"); - LOGGER.debug("Starting FileWatcherThread"); - fileWatcherThread = new FileWatcherThread(watchService); - fileWatcherThread.start(); - } catch (Exception e) { - LOGGER.debug("Error occurred while starting FileWatcherThread:", e); - LOGGER.error( - MessageEnum.BPMN_GENERAL_EXCEPTION, - "BPMN", - "Property Configuration", - MsoLogger.ErrorCode.UnknownError, - "Error occurred while starting FileWatcherThread:" + e); - } - } - - /** - * May be called to shut down the PropertyConfiguration. A shutDown followed - * by a startUp will reset the PropertyConfiguration to its initial state. - */ - public synchronized void shutDown() { - if (fileWatcherThread != null) { - LOGGER.debug("Shutting down FileWatcherThread " + System.identityHashCode(fileWatcherThread)); - fileWatcherThread.shutdown(); - - long waitInSeconds = 10; - - try { - fileWatcherThread.join(waitInSeconds * 1000); - } catch (InterruptedException e) { - LOGGER.debug("FileWatcherThread " + System.identityHashCode(fileWatcherThread) - + " shutdown did not occur within " + waitInSeconds + " seconds",e); - } - - LOGGER.debug("Finished shutting down FileWatcherThread " + System.identityHashCode(fileWatcherThread)); - fileWatcherThread = null; - } - - clearCache(); - msoConfigPath = null; - } - - public synchronized boolean isFileWatcherRunning() { - return fileWatcherThread != null; - } - - public void clearCache() { - synchronized(CACHELOCK) { - propFileCache.clear(); - } - } - - public int cacheSize() { - return propFileCache.size(); - } - - // TODO: throw IOException? - public Map getProperties(String fileName) { - Map properties = propFileCache.get(fileName); - - if (properties == null) { - if (!SUPPORTED_FILES.contains(fileName)) { - throw new IllegalArgumentException("Not a supported property file: " + fileName); - } - - if (msoConfigPath == null) { - LOGGER.debug("mso.config.path JVM system property must be set to load " + fileName); - - LOGGER.error( - MessageEnum.BPMN_GENERAL_EXCEPTION, - "BPMN", - MDC.get(fileName), - MsoLogger.ErrorCode.UnknownError, - "mso.config.path JVM system property must be set to load " + fileName); - - return null; - } - - try { - properties = readProperties(new File(msoConfigPath, fileName)); - } catch (Exception e) { - LOGGER.debug("Error loading " + fileName); - - LOGGER.error( - MessageEnum.BPMN_GENERAL_EXCEPTION, - "BPMN", - MDC.get(fileName), - MsoLogger.ErrorCode.UnknownError, - "Error loading " + fileName, e); - - return null; - } - } - - return Collections.unmodifiableMap(properties); - } - - /** - * Reads properties from the specified file, updates the property file cache, and - * returns the properties in a map. - * @param file the file to read - * @return a map of properties - */ - private Map readProperties(File file) throws IOException { - String fileName = file.getName(); - LOGGER.debug("Reading " + fileName); - - Map properties = new HashMap<>(); - Properties newProperties = new Properties(); - - try (FileReader reader = new FileReader(file)) { - newProperties.load(reader); - } - catch (Exception e) { - LOGGER.debug("Exception :",e); - } - - for (Entry entry : newProperties.entrySet()) { - properties.put(entry.getKey().toString(), entry.getValue().toString()); - } - - properties.put(TIMESTAMP_PROPERTY, String.valueOf(System.currentTimeMillis())); - - synchronized(CACHELOCK) { - propFileCache.put(fileName, properties); - } - - return properties; - } - - /** - * File watcher thread which monitors a directory for file modification. - */ - private class FileWatcherThread extends Thread { - private final WatchService watchService; - private final Timer timer = new Timer("FileWatcherTimer"); - - public FileWatcherThread(WatchService service) { - this.watchService = service; - } - - public void shutdown() { - interrupt(); - } - - @Override - public void run() { - LOGGER.info(MessageEnum.BPMN_GENERAL_INFO, "BPMN", - "FileWatcherThread started"); - - LOGGER.debug("Started FileWatcherThread " + System.identityHashCode(fileWatcherThread)); - - try { - WatchKey watchKey = null; - - while (!isInterrupted()) { - try { - if (watchKey != null) { - watchKey.reset(); - } - - watchKey = watchService.take(); - - for (WatchEvent event : watchKey.pollEvents()) { - @SuppressWarnings("unchecked") - WatchEvent pathEvent = (WatchEvent) event; - - if ("EVENT_OVERFLOW".equals(pathEvent.kind())) { - LOGGER.debug("Ignored overflow event for " + msoConfigPath); - continue; - } - - String fileName = pathEvent.context().getFileName().toString(); - - if (!SUPPORTED_FILES.contains(fileName)) { - LOGGER.debug("Ignored modify event for " + fileName); - continue; - } - - LOGGER.debug("Configuration file has changed: " + fileName); - - LOGGER.info(MessageEnum.BPMN_GENERAL_INFO, "BPMN", - "Configuation file has changed: " + fileName); - - // There's a potential problem here. The MODIFY event is - // triggered as soon as somebody starts writing the file but - // there's no obvious way to know when the write is done. If we - // read the file while the write is still in progress, then the - // cache can really be messed up. As a workaround, we use a timer - // to sleep for at least one second, and then we sleep for as long - // as it takes for the file's lastModified time to stop changing. - // The timer has another benefit: it consolidates multiple events - // that we seem to receive when a file is modified. - - synchronized(timerTaskMap) { - TimerTask task = timerTaskMap.get(fileName); - - if (task != null) { - task.cancel(); - } - - File file = new File(msoConfigPath, fileName); - task = new DelayTimerTask(timer, file, 1000); - timerTaskMap.put(fileName, task); - } - } - } catch (InterruptedException e) { - LOGGER.debug("InterruptedException :",e); - break; - } catch (ClosedWatchServiceException e) { - LOGGER.info( - MessageEnum.BPMN_GENERAL_INFO, - "BPMN", - "FileWatcherThread shut down because the watch service was closed"); - LOGGER.debug("ClosedWatchServiceException :",e); - break; - } catch (Exception e) { - LOGGER.error( - MessageEnum.BPMN_GENERAL_EXCEPTION, - "BPMN", - "Property Configuration", - MsoLogger.ErrorCode.UnknownError, - "FileWatcherThread caught unexpected " + e.getClass().getSimpleName(), e); - } - - } - } finally { - timer.cancel(); - - synchronized(timerTaskMap) { - timerTaskMap.clear(); - } - - try { - watchService.close(); - } catch (IOException e) { - LOGGER.debug("FileWatcherThread caught " + e.getClass().getSimpleName() - + " while closing the watch service",e); - } - - LOGGER.info(MessageEnum.BPMN_GENERAL_INFO, "BPMN", - "FileWatcherThread stopped"); - } - } - } - - private class DelayTimerTask extends TimerTask { - private final File file; - private final long lastModifiedTime; - private final Timer timer; - - public DelayTimerTask(Timer timer, File file, long delay) { - this.timer = timer; - this.file = file; - this.lastModifiedTime = file.lastModified(); - timer.schedule(this, delay); - } - - @Override - public void run() { - try { - long newLastModifiedTime = file.lastModified(); - - if (newLastModifiedTime == lastModifiedTime) { - try { - readProperties(file); - } catch (Exception e) { - LOGGER.error( - MessageEnum.BPMN_GENERAL_EXCEPTION, - "BPMN", - "Property Configuration", - MsoLogger.ErrorCode.UnknownError, - "Unable to reload " + file, e); - } - } else { - LOGGER.debug("Delaying reload of " + file + " by 1 second"); - - synchronized(timerTaskMap) { - TimerTask task = timerTaskMap.get(file.getName()); - - if (task != null && task != this) { - task.cancel(); - } - - task = new DelayTimerTask(timer, file, 1000); - timerTaskMap.put(file.getName(), task); - } - } - } finally { - synchronized(timerTaskMap) { - TimerTask task = timerTaskMap.get(file.getName()); - - if (task == this) { - timerTaskMap.remove(file.getName()); - } - } - } - } - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java deleted file mode 100644 index 98659d2a62..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java +++ /dev/null @@ -1,320 +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.bpmn.core; - -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -import org.openecomp.mso.logger.MsoLogger; - -import org.openecomp.mso.bpmn.core.PropertyConfiguration; - -/** - * Sets up mso.bpmn.properties and mso.bpmn.urn.properties for unit tests. - */ -public class PropertyConfigurationSetup { - - private static Path msoConfigPath = null; - private static Path bpmnPropertiesPath = null; - private static Path bpmnUrnPropertiesPath = null; - private static boolean modifiedConfiguration = false; - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - /** - * Ensures that the the PropertyConfiguration is initialized and that the - * property data is reset to initial values. Any extra properties that are - * specified will be merged with the initial values. The following example - * shows how a test can specify a replacement URN mapping property. - *

-	 *     Map urnProperties =
-	 *         PropertyConfigurationSetup.createBpmnUrnProperties();
-	 *     urnProperties.add("mso.po.timeout", "PT1M");
-	 *     PropertyConfiguration.init(urnProperties);
-	 * 
- * @param args one or more maps created with createBpmnProperties() - * and/or createBpmnUrnProperties() - */ - public static synchronized void init(Object ... args) throws IOException { - - Map extraBpmnProperties = null; - Map extraBpmnUrnProperties = null; - - boolean propertiesSpecified = false; - - for (Object arg : args) { - @SuppressWarnings("unchecked") - Map properties = (Map) arg; - - String type = properties.get("PROPERTIES-TYPE"); - - if (PropertyConfiguration.MSO_BPMN_PROPERTIES.equals(type)) { - if (properties.size() > 1) { - extraBpmnProperties = properties; - propertiesSpecified = false; - } - } else if (PropertyConfiguration.MSO_BPMN_URN_PROPERTIES.equals(type)) { - if (properties.size() > 1) { - extraBpmnUrnProperties = properties; - propertiesSpecified = false; - } - } else { - throw new IllegalArgumentException("Not a supported PROPERTIES-TYPE map"); - } - } - - // There are three cases in which we need to change the existing configuration: - // 1) There is no existing configuration, i.e. first time setup - // 2) The existing configuration was modified, i.e. it has non-default values - // 3) Non-default values are specified for this initialization - - if (msoConfigPath == null || modifiedConfiguration || propertiesSpecified) { - modifiedConfiguration = propertiesSpecified; - - Path bpmnPropertiesSourcePath = Paths.get("src", "test", "resources", "mso.bpmn.properties"); - Path bpmnUrnPropertiesSourcePath = Paths.get("src", "test", "resources", "mso.bpmn.urn.properties"); - - if (msoConfigPath == null) { - // Initialize from scratch. - msoConfigPath = Files.createTempDirectory("mso-config-path-"); - System.setProperty("mso.config.path", msoConfigPath.toString()); - msoConfigPath.toFile().deleteOnExit(); - - bpmnPropertiesPath = msoConfigPath.resolve("mso.bpmn.properties"); - mergeCopy(bpmnPropertiesSourcePath, extraBpmnProperties, bpmnPropertiesPath); - bpmnPropertiesPath.toFile().deleteOnExit(); - - bpmnUrnPropertiesPath = msoConfigPath.resolve("mso.bpmn.urn.properties"); - mergeCopy(bpmnUrnPropertiesSourcePath, extraBpmnUrnProperties, bpmnUrnPropertiesPath); - bpmnUrnPropertiesPath.toFile().deleteOnExit(); - - PropertyConfiguration.getInstance(); - } else { - // Just reset the data. - PropertyConfiguration.getInstance().clearCache(); - mergeCopy(bpmnPropertiesSourcePath, extraBpmnProperties, bpmnPropertiesPath); - mergeCopy(bpmnUrnPropertiesSourcePath, extraBpmnUrnProperties, bpmnUrnPropertiesPath); - } - } - } - - /** - * Resets the PropertyConfiguration to its initial state, as if it had never - * been started. Note that this is a very expensive option and should not - * be needed by most unit tests. - * @throws IOException - */ - public static synchronized void nuke() throws IOException { - if (msoConfigPath == null) { - return; - } - - PropertyConfiguration.getInstance().shutDown(); - - bpmnUrnPropertiesPath.toFile().delete(); - bpmnUrnPropertiesPath = null; - - bpmnPropertiesPath.toFile().delete(); - bpmnPropertiesPath = null; - - msoConfigPath.toFile().delete(); - msoConfigPath = null; - - System.setProperty("mso.config.path", null); - - modifiedConfiguration = false; - } - - /** - * Create a map to hold properties to be added to mso.bpmn.properties. - */ - public static Map createBpmnProperties() { - Map properties = new HashMap<>(); - properties.put("PROPERTIES-TYPE", PropertyConfiguration.MSO_BPMN_PROPERTIES); - return properties; - } - - /** - * Create a map to hold properties to be added to mso.bpmn.urn.properties. - */ - public static Map createBpmnUrnProperties() { - Map properties = new HashMap<>(); - properties.put("PROPERTIES-TYPE", PropertyConfiguration.MSO_BPMN_URN_PROPERTIES); - return properties; - } - - /** - * Adds (or replaces) the specified values in the mso.bpmn.urn.properties file. - * Note that properties added this way may take some time to be loaded by the - * PropertyConfiguration, just like they do when a property file is updated on - * a real MSO system. This method will optionally wait for the new properties - * to be loaded. Timeout results in an IOException. - * @param properties new properties - * @param wait maximum amount of time to wait for new properties to be loaded, - * in milliseconds. A value of zero means, "Do not wait." - * @throws IOException - */ - public static synchronized void addProperties(Map properties, long wait) - throws IOException, InterruptedException { - - if (msoConfigPath == null) { - throw new IllegalStateException(); - } - - String type = properties.get("PROPERTIES-TYPE"); - Path path; - - if (PropertyConfiguration.MSO_BPMN_PROPERTIES.equals(type)) { - path = bpmnPropertiesPath; - } else if (PropertyConfiguration.MSO_BPMN_URN_PROPERTIES.equals(type)) { - path = bpmnUrnPropertiesPath; - } else { - throw new IllegalArgumentException("Not a supported PROPERTIES-TYPE map"); - } - - String oldTimestamp = PropertyConfiguration.getInstance().getProperties(type) - .get(PropertyConfiguration.TIMESTAMP_PROPERTY); - - modifiedConfiguration = true; - addProperties(properties, path); - - if (wait <= 0) { - return; - } - - long endTime = System.currentTimeMillis() + wait; - - while (true) { - Thread.sleep(250); - - String newTimestamp = PropertyConfiguration.getInstance().getProperties(type) - .get(PropertyConfiguration.TIMESTAMP_PROPERTY); - - if (!newTimestamp.equals(oldTimestamp)) { - return; - } - - long now = System.currentTimeMillis(); - - if (now >= endTime) { - throw new IOException("Timed out after " + wait - + "ms waiting for PropertyConfiguration change"); - } - } - } - - /** - * Helper method that adds properties to the specified file. - */ - private static void addProperties(Map values, Path path) - throws IOException { - - FileReader fileReader = null; - FileOutputStream outputStream = null; - - try { - fileReader = new FileReader(path.toFile()); - Properties properties = new Properties(); - properties.load(fileReader); - - for (String key : values.keySet()) { - if (!key.equals("PROPERTIES-TYPE")) { - properties.setProperty(key, values.get(key)); - } - } - - outputStream = new FileOutputStream(path.toFile()); - properties.store(outputStream, "Custom Test Properties"); - } finally { - if (fileReader != null) { - try { - fileReader.close(); - } catch (IOException e) { - LOGGER.debug("Exception :",e); - } - } - - if (outputStream != null) { - try { - outputStream.close(); - } catch (IOException e) { - LOGGER.debug("Exception :",e); - } - } - } - } - - /** - * Helper method that copies properties from the specified source file, and - * optionally merges them with the specified extra values, then writes the - * whole mess to the destination file. - */ - private static void mergeCopy(Path sourcePath, Map extraValues, Path destPath) - throws IOException { - if (extraValues == null || extraValues.isEmpty()) { - Files.copy(sourcePath, destPath, StandardCopyOption.REPLACE_EXISTING); - return; - } - - FileReader fileReader = null; - FileOutputStream outputStream = null; - - try { - fileReader = new FileReader(sourcePath.toFile()); - Properties properties = new Properties(); - properties.load(fileReader); - - for (String key : extraValues.keySet()) { - if (!key.equals("PROPERTIES-TYPE")) { - properties.setProperty(key, extraValues.get(key)); - } - } - - outputStream = new FileOutputStream(destPath.toFile()); - properties.store(outputStream, "Custom Test Properties"); - } finally { - if (fileReader != null) { - try { - fileReader.close(); - } catch (IOException e) { - LOGGER.debug("Exception :",e); - } - } - - if (outputStream != null) { - try { - outputStream.close(); - } catch (IOException e) { - LOGGER.debug("Exception :",e); - } - } - } - } -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ResponseBuilder.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ResponseBuilder.java deleted file mode 100644 index 58e85bf78d..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ResponseBuilder.java +++ /dev/null @@ -1,297 +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.bpmn.core; - -import org.camunda.bpm.engine.delegate.DelegateExecution; - -/** - * Used in the output variable mapping configuration of subflow call activity - * tasks to normalize subflow responses. The output mapping is normally set up - * as follows. Note that the order of these mappings is important! - *

- * OUTPUT MAPPING - *

- *   SOURCE EXPRESSION                                      TARGET
- *   ${ResponseBuilder.buildWorkflowException(execution)}   WorkflowException
- *   ${ResponseBuilder.buildWorkflowResponse(execution)}    SomeResponseVariable
- * 
- */ -public class ResponseBuilder implements java.io.Serializable { - private static final long serialVersionUID = 1L; - - /** - * Creates a WorkflowException using data from the execution variables. - * If the variables do not indicate that there was an error, null - * is returned. - * @param execution the execution - */ - public WorkflowException buildWorkflowException(DelegateExecution execution) { - - String method = getClass().getSimpleName() + ".buildWorkflowException(" + - "execution=" + execution.getId() + - ")"; - String isDebugLogEnabled = (String) execution.getVariable("isDebugLogEnabled"); - logDebug("Entered " + method, isDebugLogEnabled); - - String prefix = (String) execution.getVariable("prefix"); - String processKey = getProcessKey(execution); - - logDebug("processKey=" + processKey, isDebugLogEnabled); - - // See if there"s already a WorkflowException object in the execution. - WorkflowException theException = (WorkflowException) execution.getVariable("WorkflowException"); - - if (theException != null) { - logDebug("Exited " + method + " - propagated " + theException, isDebugLogEnabled); - return theException; - } - - // Look in the legacy variables: ErrorResponse and ResponseCode - - String errorResponse = trimString(execution.getVariable(prefix + "ErrorResponse"), null); - String responseCode = trimString(execution.getVariable(prefix + "ResponseCode"), null); - logDebug("errorResponse=" + errorResponse, isDebugLogEnabled); - logDebug("responseCode=" + responseCode, isDebugLogEnabled); - if (errorResponse != null || !isOneOf(responseCode, null, "0", "200", "201", "202", "204")) { - // This is an error condition. We need to return a WorkflowExcpetion - - if (errorResponse == null) { - // No errorResponse string. See if there"s something in the Response variable - String response = trimString(execution.getVariable(processKey + "Response"), null); - if (response == null) { - errorResponse = "Received response code " + responseCode + " from " + processKey; - } else { - errorResponse = response; - } - } - - // Some subflows may try to return a WorkflowException as XML in the - // errorResponse. If provided, use the errorCode and errorMessage - // from the XML - - String maybeXML = removeXMLNamespaces(errorResponse); - - String xmlErrorMessage = trimString(getXMLTextElement(maybeXML, "ErrorMessage"), null); - String xmlErrorCode = trimString(getXMLTextElement(maybeXML, "ErrorCode"), null); - - if (xmlErrorMessage != null || xmlErrorCode != null) { - logDebug("xmlErrorMessage=" + xmlErrorMessage, isDebugLogEnabled); - logDebug("xmlErrorCode=" + xmlErrorCode, isDebugLogEnabled); - - if (xmlErrorMessage == null) { - errorResponse = "Received error code " + xmlErrorCode + " from " + processKey; - } else { - errorResponse = xmlErrorMessage; - } - - if (xmlErrorCode != null) { - responseCode = xmlErrorCode; - } - } - - // Convert the responseCode to an integer - - int intResponseCode; - - try { - intResponseCode = Integer.valueOf(responseCode); - } catch (NumberFormatException e) { - // Internal Error - intResponseCode = 2000; - } - - // Convert 3-digit HTTP response codes (we should not be using them here) - // to appropriate 4-digit response codes - - if (intResponseCode < 1000) { - if (intResponseCode >= 400 && intResponseCode <= 499) { - // Invalid Message - intResponseCode = 1002; - } else { - // Internal Error - intResponseCode = 2000; - } - } - - // Create a new WorkflowException object - - theException = new WorkflowException(processKey, intResponseCode, errorResponse); - execution.setVariable("WorkflowException", theException); - logDebug("Exited " + method + " - created " + theException, isDebugLogEnabled); - return theException; - } - - logDebug("Exited " + method + " - no WorkflowException", isDebugLogEnabled); - return null; - } - - /** - * Returns the "Response" variable, unless the execution variables - * indicate there was an error. In that case, null is returned. - * @param execution the execution - */ - public Object buildWorkflowResponse(DelegateExecution execution) { - - String method = getClass().getSimpleName() + ".buildWorkflowResponse(" + - "execution=" + execution.getId() + - ")"; - String isDebugLogEnabled = (String) execution.getVariable("isDebugLogEnabled"); - logDebug("Entered " + method, isDebugLogEnabled); - - String prefix = (String) execution.getVariable("prefix"); - String processKey = getProcessKey(execution); - - Object theResponse = null; - - WorkflowException theException = (WorkflowException) execution.getVariable("WorkflowException"); - String errorResponse = trimString(execution.getVariable(prefix + "ErrorResponse"), null); - String responseCode = trimString(execution.getVariable(prefix + "ResponseCode"), null); - - if (theException == null && errorResponse == null && - isOneOf(responseCode, null, "0", "200", "201", "202", "204")) { - - theResponse = execution.getVariable("WorkflowResponse"); - - if (theResponse == null) { - theResponse = execution.getVariable(processKey + "Response"); - } - } - - logDebug("Exited " + method, isDebugLogEnabled); - return theResponse; - } - - /** - * Checks if the specified item is one of the specified values. - * @param item the item - * @param values the list of values - * @return true if the item is in the list of values - */ - private boolean isOneOf(Object item, Object ... values) { - if (values == null) { - return item == null; - } - - for (Object value : values) { - if (value == null) { - if (item == null) { - return true; - } - } else { - if (value.equals(item)) { - return true; - } - } - } - - return false; - } - - /** - * Creates a string value of the specified object, trimming whitespace in - * the process. If the result is null or empty, the specified empty string - * value is returned. Otherwise the trimmed value is returned. This method - * helps ensure consistent treatment of empty and null strings. - * @param object the object to convert (possibly null) - * @param emptyStringValue the desired value for empty results - */ - private String trimString(Object object, String emptyStringValue) { - if (object == null) { - return emptyStringValue; - } - - String s = String.valueOf(object).trim(); - return s.equals("") ? emptyStringValue : s; - } - - /** - * Returns the process definition key (i.e. the process name) from the - * execution. - * @param execution the execution - */ - private String getProcessKey(DelegateExecution execution) { - Object testKey = execution.getVariable("testProcessKey"); - - if (testKey instanceof String) { - return (String) testKey; - } - - return execution.getProcessEngineServices().getRepositoryService() - .getProcessDefinition(execution.getProcessDefinitionId()).getKey(); - } - - /** - * Logs a message at the DEBUG level. - * @param message the message - * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled - */ - private void logDebug(String message, String isDebugLogEnabled) { - BPMNLogger.debug(isDebugLogEnabled, message); - } - - /** - * Removes namespace definitions and prefixes from XML, if any. - */ - private String removeXMLNamespaces(String xml) { - // remove xmlns declaration - xml = xml.replaceAll("xmlns.*?(\"|\').*?(\"|\')", ""); - - // remove opening tag prefix - xml = xml.replaceAll("(<)(\\w+:)(.*?>)", "$1$3"); - - // remove closing tags prefix - xml = xml.replaceAll("()", "$1$3"); - - // remove extra spaces left when xmlns declarations are removed - xml = xml.replaceAll("\\s+>", ">"); - - return xml; - } - - /** - * Extracts text from an XML element. This method is not namespace aware - * (namespaces are ignored). The first matching element is selected. - * @param xml the XML document or fragment - * @param tag the desired element, e.g. "" - * @return the element text, or null if the element was not found - */ - private String getXMLTextElement(String xml, String tag) { - xml = removeXMLNamespaces(xml); - - if (!tag.startsWith("<")) { - tag = "<" + tag + ">"; - } - - int start = xml.indexOf(tag); - - if (start == -1) { - return null; - } - - int end = xml.indexOf('<', start + tag.length()); - - if (end == -1) { - return null; - } - - return xml.substring(start + tag.length(), end); - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/RollbackData.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/RollbackData.java deleted file mode 100644 index f49712ee8b..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/RollbackData.java +++ /dev/null @@ -1,98 +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.bpmn.core; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * An object that stores data for rollbacks. Data is organized by type. A - * type is simply a string identifier. Multiple types of data may be stored - * in the same object for separate rollback operations. - */ -public class RollbackData implements Serializable { - - private static final long serialVersionUID = 1L; - - private Map> dictionary = - new HashMap<>(); - - /** - * Returns true if the specified type is stored in this object. - * - * @param type the data type - */ - public boolean hasType(String type) { - return dictionary.containsKey(type); - } - - /** - * Stores a single item. - * - * @param type the data type - * @param key the key - * @param value the value - */ - public void put(String type, String key, String value) { - Map mapForType = dictionary - .computeIfAbsent(type, k -> new HashMap<>()); - - mapForType.put(key, value); - } - - /** - * Gets a single item. - * - * @param type the data type - * @param key the key - * @return the item or null if there is no item for the specified type and key - */ - public Serializable get(String type, String key) { - Map mapForType = dictionary.get(type); - - if (mapForType == null) { - return null; - } - - return mapForType.get(key); - } - - /** - * Gets a map containing all items associated with the specified data type. - * - * @param type the data type - * @return a map, or null if there are no items associated with the specified data type - */ - public Map get(String type) { - return dictionary.get(type); - } - - /** - * Returns a string representation of this object. - */ - @Override - public String toString() { - return dictionary.entrySet().stream().map(entry -> entry.getKey() + entry.getValue()) - .collect(Collectors.joining(",", "[", "]")); - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/WorkflowException.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/WorkflowException.java deleted file mode 100644 index b555563936..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/WorkflowException.java +++ /dev/null @@ -1,77 +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.bpmn.core; - -import java.io.Serializable; - -/** - * An object that represents a workflow exception. - */ -public class WorkflowException implements Serializable { - private static final long serialVersionUID = 1L; - - private final String processKey; - private final int errorCode; - private final String errorMessage; - - /** - * Constructor - * @param processKey the process key for the process that generated the exception - * @param errorCode the numeric error code (normally 1xxx or greater) - * @param errorMessage a short error message - */ - public WorkflowException(String processKey, int errorCode, - String errorMessage) { - this.processKey = processKey; - this.errorCode = errorCode; - this.errorMessage = errorMessage; - } - - /** - * Returns the process key. - */ - public String getProcessKey() { - return processKey; - } - - /** - * Returns the error code. - */ - public int getErrorCode() { - return errorCode; - } - - /** - * Returns the error message. - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Returns a string representation of this object. - */ - @Override - public String toString() { - return getClass().getSimpleName() + "[processKey=" + getProcessKey() + ",errorCode=" + getErrorCode() - + ",errorMessage=" + getErrorMessage() + "]"; - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/AllottedResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/AllottedResource.java deleted file mode 100644 index 21943c047f..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/AllottedResource.java +++ /dev/null @@ -1,129 +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.bpmn.core.domain; - -import java.util.UUID; - -import com.fasterxml.jackson.annotation.JsonRootName; - -/** - * Stores allotted-resource information - * - */ -@JsonRootName("allottedResource") -public class AllottedResource extends Resource { - - private static final long serialVersionUID = 1L; - - /* - * set resourceType for this object - */ - public AllottedResource(){ - resourceType = ResourceType.ALLOTTED_RESOURCE; - setResourceId(UUID.randomUUID().toString()); - } - - /* - * fields specific to Allotted Resource resource type - */ - private String allottedResourceType; - private String allottedResourceRole; - private String providingServiceModelName; - private String providingServiceModelInvariantUuid; - private String providingServiceModelUuid; - private String nfFunction; - private String nfType; - private String nfRole; - private String nfNamingCode; - private String orchestrationStatus; - private TunnelConnect tunnelConnect; - - /* - * GET and SET - */ - public String getAllottedResourceType() { - return allottedResourceType; - } - public void setAllottedResourceType(String allottedResourceType) { - this.allottedResourceType = allottedResourceType; - } - public String getAllottedResourceRole() { - return allottedResourceRole; - } - public void setAllottedResourceRole(String allottedResourceRole) { - this.allottedResourceRole = allottedResourceRole; - } - public String getProvidingServiceModelName() { - return providingServiceModelName; - } - public void setProvidingServiceModelName(String providingServiceModelName) { - this.providingServiceModelName = providingServiceModelName; - } - public String getProvidingServiceModelInvariantUuid() { - return providingServiceModelInvariantUuid; - } - public void setProvidingServiceModelInvariantUuid( - String providingServiceModelInvariantUuid) { - this.providingServiceModelInvariantUuid = providingServiceModelInvariantUuid; - } - public String getProvidingServiceModelUuid() { - return providingServiceModelUuid; - } - public void setProvidingServiceModelUuid(String providingServiceModelUuid) { - this.providingServiceModelUuid = providingServiceModelUuid; - } - public String getNfFunction() { - return nfFunction; - } - public void setNfFunction(String nfFunction) { - this.nfFunction = nfFunction; - } - public String getNfType() { - return nfType; - } - public void setNfType(String nfType) { - this.nfType = nfType; - } - public String getNfRole() { - return nfRole; - } - public void setNfRole(String nfRole) { - this.nfRole = nfRole; - } - public String getNfNamingCode() { - return nfNamingCode; - } - public void setNfNamingCode(String nfNamingCode) { - this.nfNamingCode = nfNamingCode; - } - public String getOrchestrationStatus() { - return orchestrationStatus; - } - public void setOrchestrationStatus(String orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - public TunnelConnect getTunnelConnect() { - return tunnelConnect; - } - public void setTunnelConnect(TunnelConnect tunnelConnect) { - this.tunnelConnect = tunnelConnect; - } -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CloudFlavor.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CloudFlavor.java deleted file mode 100644 index 100d70e1b2..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CloudFlavor.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import java.io.Serializable; - -/** - * Stores Cloud Flavor information and is an attribute - * of a HomingSolution - * - */ -public class CloudFlavor extends JsonWrapper implements Serializable { - private String flavorLabel; - private String flavor; - - public CloudFlavor (String flavorLabel, String flavor){ - this.flavorLabel = flavorLabel; - this.flavor = flavor; - } - - public String getFlavorLabel() { - return flavorLabel; - } - - public void setFlavorLabel(String flavorLabel) { - this.flavorLabel = flavorLabel; - } - - public String getFlavor() { - return flavor; - } - - public void setFlavor(String flavor) { - this.flavor = flavor; - } - -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResult.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResult.java deleted file mode 100644 index 740e89b9d7..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResult.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.core.domain; - -import java.io.Serializable; -import java.util.List; - -public class CompareModelsResult extends JsonWrapper implements Serializable -{ - private static final long serialVersionUID = 1L; - - List addedResourceList; - List deletedResourceList; - List requestInputs; - - public List getAddedResourceList() { - return addedResourceList; - } - public void setAddedResourceList(List addedResourceList) { - this.addedResourceList = addedResourceList; - } - public List getDeletedResourceList() { - return deletedResourceList; - } - public void setDeletedResourceList(List deletedResourceList) { - this.deletedResourceList = deletedResourceList; - } - public List getRequestInputs() { - return requestInputs; - } - public void setRequestInputs(List requestInputs) { - this.requestInputs = requestInputs; - } - -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ConfigResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ConfigResource.java deleted file mode 100644 index cd45309f28..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ConfigResource.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.bpmn.core.domain; - -import java.util.UUID; - -import com.fasterxml.jackson.annotation.JsonRootName; - - -@JsonRootName("configResource") -public class ConfigResource extends Resource { - - private static final long serialVersionUID = 1L; - - /* - * set resourceType for this object - */ - public ConfigResource(){ - resourceType = ResourceType.CONFIGURATION; - setResourceId(UUID.randomUUID().toString()); - } - - /* - * fields specific to Config Resource resource type - */ - - /* - * GET and SET - */ - - private String toscaNodeType; - - public String getToscaNodeType() { - return toscaNodeType; - } - - public void setToscaNodeType(String toscaNodeType) { - this.toscaNodeType = toscaNodeType; - } - - -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Configuration.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Configuration.java deleted file mode 100644 index c80a1fddb4..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Configuration.java +++ /dev/null @@ -1,88 +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.bpmn.core.domain; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonRootName; - -/** - * Stores configuration information and modeled off - * of the AAI configuration object - * - */ -@JsonRootName("configuration") -public class Configuration extends JsonWrapper implements Serializable{ - - private static final long serialVersionUID = 1L; - - private String id; - private String name; - private String type; - private String orchestrationStatus; - private String tunnelBandwidth; - private String vendorAllowedMaxBandwidth; - private String resourceVersion; - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - public String getOrchestrationStatus() { - return orchestrationStatus; - } - public void setOrchestrationStatus(String orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - public String getTunnelBandwidth() { - return tunnelBandwidth; - } - public void setTunnelBandwidth(String tunnelBandwidth) { - this.tunnelBandwidth = tunnelBandwidth; - } - public String getVendorAllowedMaxBandwidth() { - return vendorAllowedMaxBandwidth; - } - public void setVendorAllowedMaxBandwidth(String vendorAllowedMaxBandwidth) { - this.vendorAllowedMaxBandwidth = vendorAllowedMaxBandwidth; - } - public String getResourceVersion() { - return resourceVersion; - } - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - - -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Customer.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Customer.java deleted file mode 100644 index 623ab0df20..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Customer.java +++ /dev/null @@ -1,52 +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.bpmn.core.domain; - -import java.io.Serializable; -/** - * This class is used to store customer - * data of services aka ServiceDecomposition - * - * @author bb3476 - * - */ - -public class Customer extends JsonWrapper implements Serializable { - - private static final long serialVersionUID = 1L; - private String subscriptionServiceType; - private String globalSubscriberId; - - - public String getSubscriptionServiceType() { - return subscriptionServiceType; - } - public void setSubscriptionServiceType(String subscriptionServiceType) { - this.subscriptionServiceType = subscriptionServiceType; - } - public String getGlobalSubscriberId() { - return globalSubscriberId; - } - public void setGlobalSubscriberId(String globalSubscriberId) { - this.globalSubscriberId = globalSubscriberId; - } - -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java deleted file mode 100644 index f0193bc1c3..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java +++ /dev/null @@ -1,155 +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.bpmn.core.domain; - -import java.io.Serializable; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonRootName; - -/** - * Stores resources placement and licensing information - * - */ -@JsonRootName("homingSolution") -@JsonInclude(JsonInclude.Include.NON_NULL) -public class HomingSolution extends JsonWrapper implements Serializable { - - private static final long serialVersionUID = 1L; - - private InventoryType inventoryType; - private boolean isRehome; - private String serviceInstanceId; //TODO should start using si object instead - private String cloudOwner; - private String cloudRegionId; - private String aicClli; - private String aicVersion; - private String tenant; - private VnfResource vnf; - private List flavors; - private License license = new License(); - - - /** - * @return the inventoryType which indicates the solution type - */ - public InventoryType getInventoryType() { - return inventoryType; - } - - public void setInventoryType(InventoryType inventoryType) { - this.inventoryType = inventoryType; - } - public boolean isRehome() { - return isRehome; - } - public void setRehome(boolean isRehome) { - this.isRehome = isRehome; - } - - public String getServiceInstanceId() { - return serviceInstanceId; - } - - public void setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } - - public String getCloudOwner() { - return cloudOwner; - } - - public void setCloudOwner(String cloudOwner) { - this.cloudOwner = cloudOwner; - } - - public String getCloudRegionId() { - return cloudRegionId; - } - - public void setCloudRegionId(String cloudRegionId) { - this.cloudRegionId = cloudRegionId; - } - /** - * @return the aicClli (aka aic site, physical location id) - */ - public String getAicClli() { - return aicClli; - } - - public void setAicClli(String aicClli) { - this.aicClli = aicClli; - } - - public String getAicVersion() { - return aicVersion; - } - - public void setAicVersion(String aicVersion) { - this.aicVersion = aicVersion; - } - - public String getTenant() { - return tenant; - } - - public void setTenant(String tenant) { - this.tenant = tenant; - } - - /** - * @return the vnf that the resource was homed too. - */ - public VnfResource getVnf() { - return vnf; - } - - public void setVnf(VnfResource vnf) { - this.vnf = vnf; - } - - /** - * @return a map key is label name, value is any flavor - */ - public List getFlavors() { - return flavors; - } - - public void setFlavors(List flavors) { - this.flavors = flavors; - } - - public License getLicense() { - return license; - } - - public void setLicense(License license) { - this.license = license; - } - - - public static long getSerialversionuid() { - return serialVersionUID; - } - - -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/InventoryType.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/InventoryType.java deleted file mode 100644 index fbc312e750..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/InventoryType.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.bpmn.core.domain; - -public enum InventoryType{ - - cloud("CLOUD"), - service("SERVICE"); - - private String type; - - InventoryType(String type){ - this.type = type; - } - - public String type(){ - return type; - } -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java deleted file mode 100644 index 5cd078d69c..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java +++ /dev/null @@ -1,139 +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.bpmn.core.domain; - -import java.io.IOException; -import java.io.Serializable; -import java.util.List; - -import org.json.JSONException; -import org.json.JSONObject; - -import com.fasterxml.jackson.annotation.JsonInclude; -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; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -import org.openecomp.mso.logger.MsoLogger; -//import com.fasterxml.jackson.map.SerializationFeature; - - -/** - * Wrapper encapsulates needed JSON functionality - * to be extended by MSO service decomposition objects - * providing ways to convert to and from JSON - * - */ -@JsonInclude(Include.NON_NULL) -public abstract class JsonWrapper implements Serializable { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - @JsonInclude(Include.NON_NULL) - public String toJsonString(){ - - String jsonString = ""; - //convert with Jackson - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - - mapper.setSerializationInclusion(Include.NON_NULL); - - ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter(); - try { - jsonString = ow.writeValueAsString(this); -// } catch (JsonGenerationException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } catch (JsonMappingException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } catch (IOException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } - } catch (Exception e){ - - LOGGER.debug("Exception :",e); - } - return jsonString; - } - - @JsonInclude(Include.NON_NULL) - public JSONObject toJsonObject(){ - - ObjectMapper mapper = new ObjectMapper(); - // mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - //mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - // mapper.enable(com.fasterxml.jackson.map.DeserializationFeature.UNWRAP_ROOT_VALUE); - JSONObject json = new JSONObject(); - try { - json = new JSONObject(mapper.writeValueAsString(this)); - } catch (JSONException | IOException e) { - LOGGER.debug("Exception :",e); - } - return json; - } - - public String listToJson(List list) { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - - String jsonString = ""; - try { - jsonString = mapper.writeValueAsString(list); - } catch (IOException e) { - LOGGER.debug("Exception :",e); - } - return jsonString; - } - - @JsonInclude(Include.NON_NULL) - public String toJsonStringNoRootName(){ - - String jsonString = ""; - //convert with Jackson - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - - ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter(); - try { - jsonString = ow.writeValueAsString(this); - } catch (Exception e){ - - LOGGER.debug("Exception :",e); - } - return jsonString; - } - - /** - * Returns a string representation of this object. - */ - @Override - public String toString() { - return this.toJsonString(); - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/License.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/License.java deleted file mode 100644 index eeb533c7f2..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/License.java +++ /dev/null @@ -1,120 +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.bpmn.core.domain; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.json.JSONArray; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonRootName; - -/** - * Stores licensing information and is an attribute - * of a HomingSolution - * - */ -@JsonRootName("license") -@JsonInclude(JsonInclude.Include.NON_EMPTY) -public class License extends JsonWrapper implements Serializable { - - private static final long serialVersionUID = 1L; - - StringBuilder sb = new StringBuilder(); - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - private List entitlementPoolList = new ArrayList(); - @JsonInclude(JsonInclude.Include.NON_EMPTY) - private List licenseKeyGroupList = new ArrayList(); - - - public List getEntitlementPoolList() { - return entitlementPoolList; - } - - public void setEntitlementPoolList(List entitlementPoolList) { - this.entitlementPoolList = entitlementPoolList; - } - - public List getLicenseKeyGroupList() { - return licenseKeyGroupList; - } - - public void setLicenseKeyGroupList(List licenseKeyGroupList) { - this.licenseKeyGroupList = licenseKeyGroupList; - } - - /** - * This method adds a Entitlement Pool Uuid - * to the EntitlementPoolList - * - * @param the EntitlementPoolUuid - */ - public void addEntitlementPool(String entitlementPoolUuid) { - entitlementPoolList.add(entitlementPoolUuid); - } - - /** - * This method adds a License Key Group Uuid - * to the LicenseKeyGroupList - * - * @param the licenseKeyGroupUuid - */ - public void addLicenseKeyGroup(String licenseKeyGroupUuid) { - licenseKeyGroupList.add(licenseKeyGroupUuid); - } - - /** - * This method returns the licenseKeyGroupList - * as a json array - * - * @return the strList - */ - @JsonIgnore - public JSONArray getLicenseKeyGroupListAsString() { - JSONArray array = new JSONArray(licenseKeyGroupList); - return array; - } - - /** - * This method returns the entitlementPoolList - * as a json array - * - * @return the strList - */ - @JsonIgnore - public JSONArray getEntitlementPoolListAsString() { - JSONArray array = new JSONArray(entitlementPoolList); - return array; - } - - /** - * @return the serialversionuid - */ - public static long getSerialversionuid() { - return serialVersionUID; - } - -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModelInfo.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModelInfo.java deleted file mode 100644 index a5bb2bc159..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModelInfo.java +++ /dev/null @@ -1,97 +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.bpmn.core.domain; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("modelInfo") -public class ModelInfo extends JsonWrapper implements Serializable { - - /** - * This is domain object defining structure for MODEL INFO - * It will be valid for each Resource type object - */ - private static final long serialVersionUID = 1L; - - private String modelName = ""; - private String modelUuid = ""; - private String modelInvariantUuid = ""; - private String modelVersion = ""; - //additionally on resource level - private String modelCustomizationUuid = ""; - private String modelCustomizationName = ""; - private String modelInstanceName = ""; - private String modelType = ""; - - //GET and SET methods - - public String getModelName() { - return modelName; - } - public void setModelName(String modelName) { - this.modelName = modelName; - } - public String getModelUuid() { - return modelUuid; - } - public void setModelUuid(String modelUuid) { - this.modelUuid = modelUuid; - } - public String getModelInvariantUuid() { - return modelInvariantUuid; - } - public void setModelInvariantUuid(String modelInvariantUuid) { - this.modelInvariantUuid = modelInvariantUuid; - } - public String getModelVersion() { - return modelVersion; - } - public void setModelVersion(String modelVersion) { - this.modelVersion = modelVersion; - } - public String getModelCustomizationUuid() { - return modelCustomizationUuid; - } - public void setModelCustomizationUuid(String modelCustomizationUuid) { - this.modelCustomizationUuid = modelCustomizationUuid; - } - public String getModelCustomizationName() { - return modelCustomizationName; - } - public void setModelCustomizationName(String modelCustomizationName) { - this.modelCustomizationName = modelCustomizationName; - } - public String getModelInstanceName() { - return modelInstanceName; - } - public void setModelInstanceName(String modelInstanceName) { - this.modelInstanceName = modelInstanceName; - } - public String getModelType() { - return modelType; - } - public void setModelType(String modelType) { - this.modelType = modelType; - } - -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModuleResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModuleResource.java deleted file mode 100644 index cbc9196289..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModuleResource.java +++ /dev/null @@ -1,94 +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.bpmn.core.domain; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("vfModule") -public class ModuleResource extends Resource { - - private static final long serialVersionUID = 1L; - - /* - * set resourceType for this object - */ - public ModuleResource(){ - resourceType = ResourceType.MODULE; - } - - /* - * fields specific to VF Module resource type - */ - private String vfModuleName; - private String vfModuleType; - private String heatStackId; - private boolean hasVolumeGroup; - private boolean isBase; - private String vfModuleLabel; - private int initialCount; - - /* - * GET && SET - */ - public String getVfModuleName() { - return vfModuleName; - } - public void setVfModuleName(String vfModuleName) { - this.vfModuleName = vfModuleName; - } - public String getHeatStackId() { - return heatStackId; - } - public void setHeatStackId(String heatStackId) { - this.heatStackId = heatStackId; - } - public boolean getIsBase() { - return isBase; - } - public void setIsBase(boolean isBase) { - this.isBase = isBase; - } - public String getVfModuleLabel() { - return vfModuleLabel; - } - public void setVfModuleLabel(String vfModuleLabel) { - this.vfModuleLabel = vfModuleLabel; - } - public int getInitialCount() { - return initialCount; - } - public void setInitialCount(int initialCount) { - this.initialCount = initialCount; - } - public String getVfModuleType() { - return vfModuleType; - } - public void setVfModuleType(String vfModuleType) { - this.vfModuleType = vfModuleType; - } - public boolean isHasVolumeGroup() { - return hasVolumeGroup; - } - public void setHasVolumeGroup(boolean hasVolumeGroup) { - this.hasVolumeGroup = hasVolumeGroup; - } - -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/NetworkResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/NetworkResource.java deleted file mode 100644 index 827885929e..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/NetworkResource.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.bpmn.core.domain; - -import java.util.UUID; - -import com.fasterxml.jackson.annotation.JsonRootName; - - -/** - * Encapsulates Network resource data set - * - */ -@JsonRootName("networkResource") -public class NetworkResource extends Resource { - - private static final long serialVersionUID = 1L; - /* - * set resourceType for this object - */ - public NetworkResource(){ - resourceType = ResourceType.NETWORK; - setResourceId(UUID.randomUUID().toString()); - } - /* - * fields specific to Network resource type - */ - private String networkType; - private String networkRole; - private String networkTechnology; - private String networkScope; - - /* - * GET and SET - */ - public String getNetworkType() { - return networkType; - } - public void setNetworkType(String networkType) { - this.networkType = networkType; - } - public String getNetworkRole() { - return networkRole; - } - public void setNetworkRole(String networkRole) { - this.networkRole = networkRole; - } - public String getNetworkTechnology() { - return networkTechnology; - } - public void setNetworkTechnology(String networkTechnology) { - this.networkTechnology = networkTechnology; - } - public String getNetworkScope() { - return networkScope; - } - public void setNetworkScope(String networkScope) { - this.networkScope = networkScope; - } -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/OwningEntity.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/OwningEntity.java deleted file mode 100644 index 8fcbbd5d3f..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/OwningEntity.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.bpmn.core.domain; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonRootName; - -/** - * This class is used to store instance - * data of owningEntity for ServiceDecomposition - * - * @author bb3476 - * - */ -@JsonRootName("owningEntity") -public class OwningEntity extends JsonWrapper implements Serializable { - - private static final long serialVersionUID = 1L; - private String owningEntityId; - private String owningEntityName; - public String getOwningEntityId() { - return owningEntityId; - } - public void setOwningEntityId(String owningEntityId) { - this.owningEntityId = owningEntityId; - } - public String getOwningEntityName() { - return owningEntityName; - } - public void setOwningEntityName(String owningEntityName) { - this.owningEntityName = owningEntityName; - } - -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Project.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Project.java deleted file mode 100644 index 8088585d23..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Project.java +++ /dev/null @@ -1,47 +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.bpmn.core.domain; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonRootName; - -/** - * This class is used to store instance - * data of projects for ServiceDecomposition - * - * @author bb3476 - * - */ -@JsonRootName("project") -public class Project extends JsonWrapper implements Serializable { - - private static final long serialVersionUID = 1L; - private String projectName; - - public String getProjectName() { - return projectName; - } - public void setProjectName(String projectName) { - this.projectName = projectName; - } - -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Request.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Request.java deleted file mode 100644 index 394528f897..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Request.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.bpmn.core.domain; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonRootName; - -/** - * This class is used to store instance - * data of services aka ServiceDecomposition - * - * @author bb3476 - * - */ - -public class Request extends JsonWrapper implements Serializable { - - private static final long serialVersionUID = 1L; - private String sdncRequestId; - private String requestId; - private ModelInfo modelInfo; - private String productFamilyId; - - public String getSdncRequestId() { - return sdncRequestId; - } - public void setSdncRequestId(String sdncRequestId) { - this.sdncRequestId = sdncRequestId; - } - public String getRequestId() { - return requestId; - } - public void setRequestId(String requestId) { - this.requestId = requestId; - } - public ModelInfo getModelInfo() { - return modelInfo; - } - public void setModelInfo(ModelInfo modelInfo) { - this.modelInfo = modelInfo; - } - public String getProductFamilyId() { - return productFamilyId; - } - public void setProductFamilyId(String productFamilyId) { - this.productFamilyId = productFamilyId; - } - - -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Resource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Resource.java deleted file mode 100644 index ce5ad47a15..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Resource.java +++ /dev/null @@ -1,134 +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.bpmn.core.domain; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; - - - -public abstract class Resource extends JsonWrapper implements Serializable { - - private static final long serialVersionUID = 1L; - private String resourceId; // TODO name this field just id instead, should be the id of the object as it is in aai - protected ResourceType resourceType; // Enum of vnf or network or allotted resource - protected ModelInfo modelInfo; - private long concurrencyCounter = 1L; - - //private List modules; - private ResourceInstance resourceInstance = new ResourceInstance(); // TODO possibly remove - private HomingSolution homingSolution = new HomingSolution(); - @JsonInclude(JsonInclude.Include.NON_NULL) - private HomingSolution currentHomingSolution; - - //common parameters for all Resources - private String toscaNodeType; - - // GET and SET - public String getResourceId() { - return resourceId; - } - public void setResourceId(String resourceId) { - this.resourceId = resourceId; - } - public ModelInfo getModelInfo() { - return modelInfo; - } - public void setModelInfo(ModelInfo modelInfo) { - this.modelInfo = modelInfo; - } - - public ResourceInstance getResourceInstance() { - return resourceInstance; - } - public void setResourceInstance(ResourceInstance resourceInstance) { - this.resourceInstance = resourceInstance; - } - public HomingSolution getHomingSolution(){ - return homingSolution; - } - - public void setHomingSolution(HomingSolution homingSolution){ - this.homingSolution = homingSolution; - } - public HomingSolution getCurrentHomingSolution() { - return currentHomingSolution; - } - public void setCurrentHomingSolution(HomingSolution currentHomingSolution) { - this.currentHomingSolution = currentHomingSolution; - } - public void setResourceType(ResourceType resourceType) { - this.resourceType = resourceType; - } - - public ResourceType getResourceType(){ - return resourceType; - } - - public String getToscaNodeType() { - return toscaNodeType; - } - public void setToscaNodeType(String toscaNodeType) { - this.toscaNodeType = toscaNodeType; - } - - //Utility methods - - public String getResourceInstanceId() { - return this.getResourceInstance().getInstanceId(); - } - public String getResourceInstanceName() { - return this.getResourceInstance().getInstanceName(); - } - //TODO -// @JsonIgnore -// public String getResourceHomingSolution() { -// } - - public void setResourceInstanceId(String newInstanceId){ - this.getResourceInstance().setInstanceId(newInstanceId); - } - public void setResourceInstanceName(String newInstanceName){ - this.getResourceInstance().setInstanceName(newInstanceName); - } - - //TODO -// @JsonIgnore -// public String setResourceHomingSolution() { -// } - /** - * To be used by macro flow to increment concurrency counter after update to it's structure was completed - */ - public void incrementConcurrencyCounter(){ - this.concurrencyCounter ++; - } - /** - * Method to get concurrency counter data - * @return long value for the counter - */ - @JsonIgnore - public long getConcurrencyCounter(){ - return concurrencyCounter; - } - -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceDecomposition.java deleted file mode 100644 index 226ed0e01a..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceDecomposition.java +++ /dev/null @@ -1,86 +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.bpmn.core.domain; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonIgnore; - -/** - * Abstract superclass for all individual decomposition resources - * - */ -//@JsonIgnoreProperties -public abstract class ResourceDecomposition extends JsonWrapper implements Serializable { - - private static final long serialVersionUID = 1L; - - protected String resourceType; // Enum of vnf or network or allotted resource - private ModelInfo modelInfo; - - //private List modules; - private ResourceInstance instanceData = new ResourceInstance(); - - // GET and SET - public ModelInfo getModelInfo() { - return modelInfo; - } - public void setModelInfo(ModelInfo modelInfo) { - this.modelInfo = modelInfo; - } - - public ResourceInstance getInstanceData() { - return instanceData; - } - public void setInstanceData(ResourceInstance instanceData) { - this.instanceData = instanceData; - } - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - //Utility methods - @JsonIgnore - public ModelInfo getResourceModel() { - return modelInfo; - } - @JsonIgnore - public String getResourceInstanceId() { - return this.getInstanceData().getInstanceId(); - } - @JsonIgnore - public String getResourceInstanceName() { - return this.getInstanceData().getInstanceName(); - } -// @JsonIgnore -// public String getResourceHomingSolution() { -// } - - public void setResourceInstanceId(String newInstanceId){ - this.getInstanceData().setInstanceId(newInstanceId); - } - public void setResourceInstanceName(String newInstanceName){ - this.getInstanceData().setInstanceName(newInstanceName); - } -// @JsonIgnore -// public String setResourceHomingSolution() { -// } -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceInstance.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceInstance.java deleted file mode 100644 index 70977e1d86..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceInstance.java +++ /dev/null @@ -1,65 +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.bpmn.core.domain; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -/** - * Use resourceId in resource class instead - * - * @author cb645j - * - */ -//@JsonIgnoreProperties -//TODO update any existing references then remove this pointless class -@Deprecated -public class ResourceInstance extends JsonWrapper implements Serializable { - - private static final long serialVersionUID = 1L; - - private String instanceId; - private String instanceName; - - - public String getInstanceId() { - return instanceId; - } - - /** - * This class and method is deprecated so use - * resourceId field in resource class instead - * - * @author cb645j - * - */ - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - public String getInstanceName() { - return instanceName; - } - public void setInstanceName(String instanceName) { - this.instanceName = instanceName; - } - -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceModelInfo.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceModelInfo.java deleted file mode 100644 index 724fe16bdc..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceModelInfo.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.core.domain; - -import java.io.Serializable; - -public class ResourceModelInfo extends JsonWrapper implements Serializable{ - - private static final long serialVersionUID = 1L; - String resourceName; - String resourceInvariantUuid; - String resourceUuid; - String resourceCustomizationUuid; - - public String getResourceName() { - return resourceName; - } - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - 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; - } - -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceType.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceType.java deleted file mode 100644 index 65cf03cd15..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/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.bpmn.core.domain; - -public enum ResourceType { - - VNF, NETWORK, MODULE, ALLOTTED_RESOURCE, CONFIGURATION // etc. -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java deleted file mode 100644 index 077e5726d7..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java +++ /dev/null @@ -1,524 +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.bpmn.core.domain; - - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; -import org.json.JSONObject; -import org.openecomp.mso.bpmn.core.json.DecomposeJsonUtil; -import org.openecomp.mso.bpmn.core.json.JsonDecomposingException; - - - - -/** - * Service Decomposition Structure - * This Java object contains service information: - * - Service model info - * - Service type and role - * - list of VNF resource's decompositon - * - list of network resource's decompositon - * - list of allotted resource's decompositon - */ -@JsonRootName(value = "serviceResources") -//@JsonTypeInfo(include=As.WRAPPER_OBJECT, use=Id.NAME) -public class ServiceDecomposition extends JsonWrapper implements Serializable { - - private static final long serialVersionUID = 1L; - - @JsonProperty("modelInfo") - private ModelInfo modelInfo; - @JsonProperty("serviceType") - private String serviceType; - @JsonProperty("serviceRole") - private String serviceRole; - private ServiceInstance serviceInstance; - private Request request; - private Customer customer; - private String callbackURN; - private String sdncVersion; - @JsonProperty("project") - private Project project; - @JsonProperty("owningEntity") - private OwningEntity owningEntity; - @JsonProperty("vnfResource") - private List vnfResources; - @JsonProperty("networkResource") - private List networkResources; - @JsonProperty("allottedResource") - private List allottedResources; - @JsonProperty("configResource") - private List configResources; - - public ServiceDecomposition () { - super(); - } - - public ServiceDecomposition (String catalogRestOutput) throws JsonDecomposingException { - ServiceDecomposition serviceDecomposition = DecomposeJsonUtil.jsonToServiceDecomposition(catalogRestOutput); - this.modelInfo = serviceDecomposition.getModelInfo(); - this.vnfResources = serviceDecomposition.getServiceVnfs(); - this.allottedResources = serviceDecomposition.getServiceAllottedResources(); - this.networkResources = serviceDecomposition.getServiceNetworks(); - this.serviceRole = serviceDecomposition.getServiceRole(); - this.serviceType = serviceDecomposition.getServiceType(); - this.configResources = serviceDecomposition.getServiceConfigResources(); - } - - /** - * Constructor taking Catalog DB Adapter REST output (serviceResources model) + service Instance ID - * @param catalogRestOutput - * @param serviceInstanceId - */ - public ServiceDecomposition (String catalogRestOutput, String serviceInstanceId) throws JsonDecomposingException { - ServiceDecomposition serviceDecomposition = DecomposeJsonUtil.jsonToServiceDecomposition(catalogRestOutput); - this.modelInfo = serviceDecomposition.getModelInfo(); - this.vnfResources = serviceDecomposition.getServiceVnfs(); - this.allottedResources = serviceDecomposition.getServiceAllottedResources(); - this.configResources = serviceDecomposition.getServiceConfigResources(); - this.networkResources = serviceDecomposition.getServiceNetworks(); - - this.serviceRole = serviceDecomposition.getServiceRole(); - this.serviceType = serviceDecomposition.getServiceType(); - - this.serviceInstance = new ServiceInstance(); - this.serviceInstance.setInstanceId(serviceInstanceId); - - this.project = serviceDecomposition.getProject(); - this.owningEntity = serviceDecomposition.getOwningEntity(); - } - - /** - * Constructor taking a Service Decomposition JSON serialization - * @param catalogRestOutput - * @param serviceInstanceId - */ - public ServiceDecomposition (JSONObject jsonServiceDecomposition, String serviceInstanceId) { - //TODO provide constructor implementation - - } - - //***** - //GET and SET section - /** - * Return just the service model portion of the Service Decomposition as a Java object. - * The service model object should support retrieval as JSON string that is formatted correctly for sending serviceModelInfo to Building Blocks. - * @return - */ - public ModelInfo getModelInfo() { - return modelInfo; - } - public void setModelInfo(ModelInfo modelInfo) { - this.modelInfo = modelInfo; - } - public ServiceInstance getServiceInstance() { - return serviceInstance; - } - public void setServiceInstance(ServiceInstance serviceInstance) { - this.serviceInstance = serviceInstance; - } - public Project getProject() { - return project; - } - public OwningEntity getOwningEntity() { - return owningEntity; - } - public void setProject(Project project) { - this.project = project; - } - public void setOwningEntity(OwningEntity owningEntity) { - this.owningEntity = owningEntity; - } - public List getServiceVnfs() { - return vnfResources; - } - public void setServiceVnfs(List vnfResources) { - this.vnfResources = vnfResources; - } - public List getServiceNetworks() { - return networkResources; - } - public void setServiceConfigs(List configResources) { - this.configResources = configResources; - } - public List getServiceConfigs() { - return configResources; - } - public void setServiceNetworks(List networkResources) { - this.networkResources = networkResources; - } - public List getServiceAllottedResources() { - return allottedResources; - } - public void setServiceAllottedResources(List allottedResources) { - this.allottedResources = allottedResources; - } - public List getServiceConfigResources() { - return configResources; - } - public void setServiceConfigResources(List configResources) { - this.configResources = configResources; - } - public String getServiceType() { - return serviceType; - } - - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - - public String getServiceRole() { - return serviceRole; - } - - public void setServiceRole(String serviceRole) { - this.serviceRole = serviceRole; - } - public Request getRequest() { - return request; - } - - public void setRequest(Request request) { - this.request = request; - } - public Customer getCustomer() { - return customer; - } - public void setCustomer(Customer customer) { - this.customer = customer; - } - public String getCallbackURN() { - return callbackURN; - } - - public void setCallbackURN(String callbackURN) { - this.callbackURN = callbackURN; - } - - public String getSdncVersion() { - return sdncVersion; - } - - public void setSdncVersion(String sdncVersion) { - this.sdncVersion = sdncVersion; - } - - //***** - - //***** - //Access methods - - - /** - * This method returns one combined list of Resources of All Types - * @return - */ - @JsonIgnore - public List getServiceResources(){ - ArrayList serviceResources = new ArrayList(); - if(this.getServiceAllottedResources() != null){ - serviceResources.addAll(this.getServiceAllottedResources()); - } - if(this.getServiceNetworks() != null){ - serviceResources.addAll(this.getServiceNetworks()); - } - if(this.getServiceVnfs() != null){ - serviceResources.addAll(this.getServiceVnfs()); - } - if(this.getServiceConfigResources() != null){ - serviceResources.addAll(this.getServiceConfigResources()); - } - return serviceResources; - } - - /** - * This method returns String representation of one combined list of Resources of All Types - */ - @JsonIgnore - public String getServiceResourcesJsonString() { - return listToJson((this.getServiceNetworks())) + - listToJson((this.getServiceVnfs())) + - listToJson((this.getServiceAllottedResources())) + - listToJson((this.getServiceConfigResources())); - } - - /** - * Returns a JSON list of all Network Resource structures (i.e. the serialized NetworkDecomposition objects). - * @return - */ - @JsonIgnore - public String getServiceNetworksJson(){ - return listToJson(this.getServiceNetworks()); - } - /** - * Returns a JSON list of all VnfResource structures (i.e. the serialized VnfResource objects). - * @return - */ - @JsonIgnore - public String getServiceVnfsJson(){ - return listToJson(this.getServiceVnfs()); - } - /** - * Returns a JSON list of all Allotted Resource structures (i.e. the serialized AllottedResource objects). - * @return - */ - @JsonIgnore - public String getServiceAllottedResourcesJson(){ - return listToJson(this.getServiceAllottedResources()); - } - /** - * Returns a JSON list of all Config Resource structures (i.e. the serialized ConfigResource objects). - * @return - */ - @JsonIgnore - public String getServiceConfigResourcesJson(){ - return listToJson(this.getServiceConfigResources()); - } - - //TODO - define Resource Object ID - @JsonIgnore - public String getVnfResource(String resourceObjectId) { - - for (Resource resource : getServiceResources()) { - //resource.getModelInfo().getModelInvariantId(); - - if ("extracted information".equals(resourceObjectId)) { - return resource.toJsonString(); - } - } - return ""; - } - - //Methods to add Resource to the list - /** - * Add VNF resource to the list - * @param vnfResource - */ - public void addVnfResource(Resource vnfResource) { - if (vnfResources == null){ - vnfResources = new ArrayList<>(); - } - this.vnfResources.add((VnfResource)vnfResource); - } - /** - * Add Network resource to the list - * @param networkResource - */ - public void addNetworkResource(Resource networkResource) { - if (networkResources == null){ - networkResources = new ArrayList<>(); - } - this.networkResources.add((NetworkResource)networkResource); - } - /** - * Add Allotted resource to the list - * @param allottedResource - */ - public void addAllottedResource(Resource allottedResource) { - if (allottedResources == null){ - allottedResources = new ArrayList<>(); - } - this.allottedResources.add((AllottedResource)allottedResource); - } - /** - * Add Config resource to the list - * @param allottedResource - */ - public void addConfigResource(Resource configResource) { - if (configResources == null){ - configResources = new ArrayList<>(); - } - this.configResources.add((ConfigResource)configResource); - } - /** - * Add resource to the list - * Given a ResourceDecomposition (subclass) object, add it to the Service Decomposition (in the appropriate category, e.g. as a VNF, Network, or Allotted Resource). - * As dependencies are not currently supported, add it to the end of any ordered lists. - * @param resource - */ - public void addResource(Resource resource) { - //create resource based upon type - switch (resource.resourceType) { - case VNF: - this.addVnfResource(resource); - break; - case NETWORK: - this.addNetworkResource(resource); - break; - case ALLOTTED_RESOURCE: - this.addAllottedResource(resource); - break; - case CONFIGURATION: - this.addConfigResource(resource); - break; - default: - throw new IllegalArgumentException("Invalid resource type: " + resource.resourceType); - } - } - - /** - * Add resource to the list - * @param jsonResource - */ - public void addVnfResource(String jsonResource) throws JsonDecomposingException { - VnfResource vnfResource = null; - vnfResource = DecomposeJsonUtil.jsonToVnfResource(jsonResource); - this.addVnfResource(vnfResource); - } - /** - * Add resource to the list - * @param jsonResource - */ - public void addNetworkResource(String jsonResource) throws JsonDecomposingException { - NetworkResource networkResource = null; - networkResource = DecomposeJsonUtil.jsonToNetworkResource(jsonResource); - this.addVnfResource(networkResource); - } - /** - * Add resource to the list - * @param Resource - */ - public void addAllottedResource(String jsonResource) throws JsonDecomposingException { - AllottedResource allottedResource = null; - allottedResource = DecomposeJsonUtil.jsonToAllottedResource(jsonResource); - this.addVnfResource(allottedResource); - } - /** - * Add resource to the list - * @param Resource - */ - public void addConfigResource(String jsonResource) throws JsonDecomposingException { - ConfigResource configResource = null; - configResource = DecomposeJsonUtil.jsonToConfigResource(jsonResource); - this.addVnfResource(configResource); - } - /** - * Given a ResourceDecomposition (subclass) object, locate it in the Service Decomposition by its unique ID, and replace the current version with the new one. - * This method should support concurrency control via an auto-incrementing field in the ResourceDecomposition class. - * @param newResource - * @return TRUE if replacement was a success - */ - public boolean replaceResource(Resource newResource){ - boolean result = false; - List serviceResources = getServiceResources(); - for (Resource resource : (Iterable) serviceResources) { - System.out.println("resource found"); - if (resource.resourceType == newResource.resourceType) { - System.out.println("resource type matches"); - if (resource.getResourceId().equalsIgnoreCase(newResource.getResourceId())) { - System.out.println("resource id matches"); - //returns TRUE if replacement is a success - result = Collections.replaceAll(serviceResources, resource, newResource); - } - } - } - //set updated list into ServiceDecomposition - this.setResourceList(serviceResources); - return result; - } - - /** - * Given a ResourceDecomposition as a JSON string, locate it in the Service Decomposition by its unique ID, - * and replace the current version with the new one. - * @param jsonString - * @return - */ - public boolean replaceResource(String jsonString){ - //TODO: define unique ID for the Resource! - return false; - } - - /** - * Given a resource object ID, locate it in the Service Decomposition by its unique ID, and delete it. - * @param resource - * @return TRUE if delete was a success - */ - public boolean deleteResource(Resource resource){ - List serviceResources = getServiceResources(); - for (Resource item : (Iterable) serviceResources) { - if (item.resourceType == resource.resourceType) { - if (item.getResourceId().equalsIgnoreCase(resource.getResourceId())) { - //returns TRUE if replacement is a success - return serviceResources.remove(resource); - } - } - } - - return false; - } - - /** - * Generic method to set List of ResourceDecomposition objects - * @param resources - * @return - */ - public boolean setResourceList(List resources){ - //create resource based upon type - switch (resources.get(0).resourceType) { - case VNF: - this.setServiceVnfs((List)(List)resources); - break; - case NETWORK: - this.setServiceNetworks((List)(List)resources); - break; - case ALLOTTED_RESOURCE: - this.setServiceAllottedResources((List)(List)resources); - break; - case CONFIGURATION: - this.setServiceConfigResources((List)(List)resources); - break; - default: - throw new IllegalArgumentException("Invalid resource type: " + resources.get(0).resourceType); - } - - return false; - } - - /** - * - * This method locates and returns a resource in a given - * Service Decomposition object by its unique resource id. - * Returns null if resource doesn't exist. - * - * @param resourceId - id of the resource - * @return resource - */ - @JsonIgnore - public Resource getServiceResource(String resourceId){ - List resources = getServiceResources(); - for (Resource resource : resources) { - if (resource.getResourceId().equalsIgnoreCase(resourceId)) { - //match - return resource; - } - } - return null; - } - -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceInstance.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceInstance.java deleted file mode 100644 index aa5e9a035d..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceInstance.java +++ /dev/null @@ -1,109 +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.bpmn.core.domain; - -import java.io.Serializable; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonRootName; - -/** - * This class is used to store instance - * data of services aka ServiceDecomposition - * - * @author cb645j - * - */ -public class ServiceInstance extends JsonWrapper implements Serializable { - - private static final long serialVersionUID = 1L; - private String instanceId; - private String instanceName; - private String orchestrationStatus; - private Configuration configuration; - private String serviceType; - private String serviceId; - private ModelInfo modelInfo; - private String environmentContext; - private String workloadContext; - private Map serviceParams; - - public String getServiceType() { - return serviceType; - } - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - public String getServiceId() { - return serviceId; - } - public void setServiceId(String serviceId) { - this.serviceId = serviceId; - } - public Map getServiceParams() { - return serviceParams; - } - public void setServiceParams(Map serviceParams) { - this.serviceParams = serviceParams; - } - public String getInstanceId() { - return instanceId; - } - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - public String getInstanceName() { - return instanceName; - } - public void setInstanceName(String instanceName) { - this.instanceName = instanceName; - } - public String getOrchestrationStatus() { - return orchestrationStatus; - } - public void setOrchestrationStatus(String orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - public Configuration getConfiguration() { - return configuration; - } - public void setConfiguration(Configuration configuration) { - this.configuration = configuration; - } - public ModelInfo getModelInfo() { - return modelInfo; - } - public void setModelInfo(ModelInfo modelInfo) { - this.modelInfo = modelInfo; - } - public String getEnvironmentContext() { - return environmentContext; - } - public void setEnvironmentContext(String environmentContext) { - this.environmentContext = environmentContext; - } - public String getWorkloadContext() { - return workloadContext; - } - public void setWorkloadContext(String workloadContext) { - this.workloadContext = workloadContext; - } -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Subscriber.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Subscriber.java deleted file mode 100644 index 5eba487d05..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Subscriber.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.bpmn.core.domain; - -import java.io.Serializable; - -public class Subscriber implements Serializable { - - private static final long serialVersionUID = -2416018315129127022L; - private String globalId; - private String name; - private String commonSiteId; - - public Subscriber(String globalId, String name, String commonSiteId){ - super(); - this.globalId = globalId; - this.name = name; - this.commonSiteId = commonSiteId; - } - - - public String getGlobalId(){ - return globalId; - } - - - public void setGlobalId(String globalId){ - this.globalId = globalId; - } - - - public String getName(){ - return name; - } - - - public void setName(String name){ - this.name = name; - } - - - public String getCommonSiteId(){ - return commonSiteId; - } - - public void setCommonSiteId(String commonSiteId){ - this.commonSiteId = commonSiteId; - } - - -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/TunnelConnect.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/TunnelConnect.java deleted file mode 100644 index 01e7245aa7..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/TunnelConnect.java +++ /dev/null @@ -1,77 +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.bpmn.core.domain; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonRootName; - -/** - * This class represents the specifics of a tunnel - * cross connect piece of a resource - * - * @author cb645j - * - *TODO This may change to house both isp speeds - */ -@JsonRootName("tunnelConnect") -public class TunnelConnect extends JsonWrapper implements Serializable { - - private static final long serialVersionUID = 1L; - private String id; - private String upBandwidth; - private String downBandwidth; - private String upBandwidth2; - private String downBandwidth2; - - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - public String getUpBandwidth() { - return upBandwidth; - } - public void setUpBandwidth(String upBandwidth) { - this.upBandwidth = upBandwidth; - } - public String getDownBandwidth() { - return downBandwidth; - } - public void setDownBandwidth(String downBandwidth) { - this.downBandwidth = downBandwidth; - } - public String getUpBandwidth2() { - return upBandwidth2; - } - public void setUpBandwidth2(String upBandwidth2) { - this.upBandwidth2 = upBandwidth2; - } - public String getDownBandwidth2() { - return downBandwidth2; - } - public void setDownBandwidth2(String downBandwidth2) { - this.downBandwidth2 = downBandwidth2; - } - -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java deleted file mode 100644 index a328ddf719..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java +++ /dev/null @@ -1,167 +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.bpmn.core.domain; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -/** - * Encapsulates VNF resource data set - * - */ -@JsonRootName("vnfResource") -public class VnfResource extends Resource { - - private static final long serialVersionUID = 1L; - - /* - * set resourceType for this object - */ - public VnfResource(){ - resourceType = ResourceType.VNF; - setResourceId(UUID.randomUUID().toString()); - } - - /* - * fields specific to VNF resource type - */ - @JsonProperty("vfModules") - private List vfModules; - private String vnfHostname; - private String vnfType; - private String nfFunction; - private String nfType; - private String nfRole; - private String nfNamingCode; - private String multiStageDesign; - - /* - * GET and SET - */ - public List getVfModules() { - return vfModules; - } - public void setModules(List moduleResources) { - this.vfModules = moduleResources; - } - public String getVnfHostname() { - return vnfHostname; - } - public void setVnfHostname(String vnfHostname) { - this.vnfHostname = vnfHostname; - } - @Deprecated - public void setVnfType(String vnfType) { - this.vnfType = vnfType; - } - public String getVnfType() { - return vnfType; - } - public String getNfFunction() { - return nfFunction; - } - public void setNfFunction(String nfFunction) { - this.nfFunction = nfFunction; - } - public String getNfType() { - return nfType; - } - public void setNfType(String nfType) { - this.nfType = nfType; - } - public String getNfRole() { - return nfRole; - } - public void setNfRole(String nfRole) { - this.nfRole = nfRole; - } - public String getNfNamingCode() { - return nfNamingCode; - } - public void setNfNamingCode(String nfNamingCode) { - this.nfNamingCode = nfNamingCode; - } - public String getMultiStageDesign() { - return multiStageDesign; - } - public void setMultiStageDesign(String multiStageDesign) { - this.multiStageDesign = multiStageDesign; - } - /* - * GET accessors per design requirements - */ - - /** - * Returns a list of all VfModule objects. - * Base module is first entry in the list - * @return ordered list of ModuleResources objects - */ - @JsonIgnore - public List getAllVfModuleObjects(){ - if (vfModules == null) { - return null; - } - - for (int i = 0; i < vfModules.size(); i++) { - ModuleResource moduleResource = vfModules.get(i); - if (moduleResource.getIsBase()){ - vfModules.remove(moduleResource); - vfModules.add(0,moduleResource); - } - } - return vfModules; - } - - /** - * - * @return Returns JSON list of all VfModule structures. - */ - @JsonIgnore - public String getAllVfModulesJson(){ - - return listToJson(vfModules); - } - - // methods to add to the list - public void addVfModule(ModuleResource moduleResource) { - if (vfModules == null){ - vfModules = new ArrayList<>(); - } - this.vfModules.add(moduleResource); - } - - - /** - * Utility method to allow construction of the filed in the form of - * / - * - * default setter for this field deprecated - * @param modelName << serviceResources.modelInfo.modelName - */ - public void constructVnfType(String modelName) { - this.vnfType = modelName.concat("/").concat(this.modelInfo.getModelInstanceName()); - } -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractor.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractor.java deleted file mode 100644 index e1aaba74da..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractor.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.bpmn.core.internal; - -import java.util.Optional; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Extracts variable name from expression if entire expression is just - * one variable, for example "${x}". - * - * Ignores all whitespaces, except inside variable name. - * - * Examples: - * "${x}", extracted variable name is "x" - * " ${\t weird_NAME }", extracted variable name is "weird_NAME" - * "${incorrect name}", no extracted name - * "${two}+${two}", no extracted name - */ -public class VariableNameExtractor { - - private static final Pattern VARIABLE_NAME_PATTERN = Pattern - .compile("^\\s*\\$\\s*\\{\\s*([a-zA-Z0-9_]+)\\s*\\}\\s*$"); - - private final String expression; - - - /** - * Creates new VariableNameExtractor - * @param expression expression to be parsed - */ - public VariableNameExtractor(String expression) { - this.expression = expression; - } - - /** - * Extracts variable name from expression given in constructor - * @return Optional of variable name, empty if expression wasn't single variable - */ - public Optional extract() { - Matcher matcher = VARIABLE_NAME_PATTERN.matcher(expression); - if (!matcher.matches()) { - return Optional.empty(); - } - return Optional.of(matcher.group(1)); - } - -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java deleted file mode 100644 index 8ab93f2842..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java +++ /dev/null @@ -1,138 +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.bpmn.core.json; - -import java.io.IOException; -import java.io.Serializable; - -import org.openecomp.mso.bpmn.core.domain.AllottedResource; -import org.openecomp.mso.bpmn.core.domain.ConfigResource; -import org.openecomp.mso.bpmn.core.domain.NetworkResource; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.bpmn.core.domain.ServiceInstance; -import org.openecomp.mso.bpmn.core.domain.VnfResource; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class DecomposeJsonUtil implements Serializable { - - private static final long serialVersionUID = 1L; - - private static final ObjectMapper OBJECT_MAPPER = createObjectMapper(); - - private DecomposeJsonUtil() { - } - - private static ObjectMapper createObjectMapper() { - ObjectMapper om = new ObjectMapper(); - om.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - return om; - } - - /** - * Method to construct Service Decomposition object converting JSON structure - * - * @param jsonString input in JSON format confirming ServiceDecomposition - * @return decoded object - * @throws JsonDecomposingException thrown when decoding json fails - */ - public static ServiceDecomposition jsonToServiceDecomposition(String jsonString) throws JsonDecomposingException { - try { - ObjectMapper om = new ObjectMapper(); - om.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - return om.readValue(jsonString, ServiceDecomposition.class); - } catch (IOException e) { - throw new JsonDecomposingException("Exception while converting json to service decomposition", e); - } - } - - /** - * Method to construct Service Decomposition object converting JSON structure - * - * @param jsonString input in JSON format confirming ServiceDecomposition - * @param serviceInstanceId service instance id to be put in decoded ServiceDecomposition - * @return decoded object - * @throws JsonDecomposingException thrown when decoding json fails - */ - public static ServiceDecomposition jsonToServiceDecomposition(String jsonString, String serviceInstanceId) - throws JsonDecomposingException { - ServiceDecomposition serviceDecomposition = jsonToServiceDecomposition(jsonString); - ServiceInstance serviceInstance = new ServiceInstance(); - serviceInstance.setInstanceId(serviceInstanceId); - serviceDecomposition.setServiceInstance(serviceInstance); - return serviceDecomposition; - } - - /** - * Method to construct Resource Decomposition object converting JSON structure - * - * @param jsonString input in JSON format confirming ResourceDecomposition - * @return decoded object - * @throws JsonDecomposingException thrown when decoding json fails - */ - public static VnfResource jsonToVnfResource(String jsonString) throws JsonDecomposingException { - try { - return OBJECT_MAPPER.readValue(jsonString, VnfResource.class); - } catch (IOException e) { - throw new JsonDecomposingException("Exception while converting json to vnf resource", e); - } - } - - /** - * Method to construct Resource Decomposition object converting JSON structure - * - * @param jsonString input in JSON format confirming ResourceDecomposition - * @return decoded object - * @throws JsonDecomposingException thrown when decoding json fails - */ - public static NetworkResource jsonToNetworkResource(String jsonString) throws JsonDecomposingException { - try { - return OBJECT_MAPPER.readValue(jsonString, NetworkResource.class); - } catch (IOException e) { - throw new JsonDecomposingException("Exception while converting json to network resource", e); - } - } - - /** - * Method to construct Resource Decomposition object converting JSON structure - * - * @param jsonString - input in JSON format confirming ResourceDecomposition - * @return decoded object - * @throws JsonDecomposingException thrown when decoding json fails - */ - public static AllottedResource jsonToAllottedResource(String jsonString) throws JsonDecomposingException { - try { - return OBJECT_MAPPER.readValue(jsonString, AllottedResource.class); - } catch (IOException e) { - throw new JsonDecomposingException("Exception while converting json to allotted resource", e); - } - } - - public static ConfigResource jsonToConfigResource(String jsonString) throws JsonDecomposingException { - try { - return OBJECT_MAPPER.readValue(jsonString, ConfigResource.class); - } catch (IOException e) { - throw new JsonDecomposingException("Exception while converting json to allotted resource", e); - } - } -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonDecomposingException.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonDecomposingException.java deleted file mode 100644 index 352979e7dd..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonDecomposingException.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========================================================= - */ - -package org.openecomp.mso.bpmn.core.json; - -import java.io.IOException; - -public class JsonDecomposingException extends IOException { - - public JsonDecomposingException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java deleted file mode 100644 index 01388352de..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java +++ /dev/null @@ -1,1027 +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.bpmn.core.json; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.runtime.Execution; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.XML; -import org.openecomp.mso.apihandler.common.ValidationException; - -import org.openecomp.mso.bpmn.core.xml.XmlTool; -import org.openecomp.mso.logger.MsoLogger; - -import com.fasterxml.jackson.databind.JsonNode; -import com.github.fge.jackson.JsonLoader; -import com.github.fge.jsonschema.core.exceptions.ProcessingException; -import com.github.fge.jsonschema.core.report.ProcessingReport; -import com.github.fge.jsonschema.main.JsonSchemaFactory; -import com.github.fge.jsonschema.main.JsonValidator; - -/** - * Utility class for JSON processing - * - * @version 1.0 - * - * Note: It was observed, that depending on the JSON implementation, an org.json.JSONException or a - * java.util.NoSuchElementException will be thrown in the event of the key value being "not found" - * in a JSON document. A general check has been added to the applicable catch blocks for this - * this type of behavior to reduce the amount of logging. As a key value not being found is - * expect behavior, it makes no sense to log the stack trace associated with this type of failure. - */ - -public class JsonUtils { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - private static int MSOJsonIndentFactor = 3; - - /** - * Uses the JSONObject static method to convert a XML doc to JSON. - * - * @param xml String containing the XML doc - * @param pretty flag to determine if the output should be formatted - * @return String containing the JSON translation - */ - public static String xml2json(String xml, Boolean pretty) { - - try { - // name spaces cause problems, so just remove them - JSONObject jsonObj = XML.toJSONObject(XmlTool.removeNamespaces(xml)); - if (!pretty) { - return jsonObj.toString(); - } else { - // add an indent to make it 'pretty' - return jsonObj.toString(MSOJsonIndentFactor); - } - } catch (Exception e){ - msoLogger.debug("xml2json(): unable to parse xml and convert to json. Exception was: " + e.toString(), e); - return null; - } - } - - /** - * Invokes xml2json(String, Boolean) defaulting to 'pretty' output. - * - * @param xml String containing the XML doc - * @return String containing the JSON translation - */ - public static String xml2json(String xml) { - return xml2json(xml, true); - } - - /** - * Uses the JSONObject static method to convert a JSON doc to XML. - * Note: this method may not generate valid XML if the JSONObject - * contains JSONArrays which are used to represent XML attributes - * in the JSON doc. - * - * @param jsonStr String containing the JSON doc - * @param pretty flag to determine if the output should be formatted - * @return String containing the XML translation - */ - public static String json2xml(String jsonStr, Boolean pretty) { - - try { - JSONObject jsonObj = new JSONObject(jsonStr); - if (pretty) { -// return XmlTool.normalize(XML.toString(jsonObj)); -// use the local class method which properly handles certain JSONArray content - return XmlTool.normalize(toXMLString(jsonObj, null)); - } else { -// return XML.toString(jsonObj); -// use the local class method which properly handles certain JSONArray content - return toXMLString(jsonObj, null); - } - } catch (Exception e){ - msoLogger.debug("json2xml(): unable to parse json and convert to xml. Exception was: " + e.toString(), e); - return null; - } - } - - /** - * Uses a modified version of the org.json.XML toString() algorithm - * to convert a JSONObject to an XML Doc. The intent of this is to - * correctly generate XML from JSON including TAGs for JSONArrays - * - * @param obj org.json.JSON object to be converted to XML - * @param tagName optional XML tagname supplied primarily during recursive calls - * @return String containing the XML translation - */ - public static String toXMLString(Object obj, String tagName) throws JSONException { - StringBuilder strBuf = new StringBuilder(); - int i; - JSONArray jsonArr; - JSONObject jsonObj; - String key; - Iterator keys; - int len; - String str; - Object curObj; - if (obj instanceof JSONObject) { - // msoLogger.debug("toXMLString(): is a JSONObject"); - // append "" to the XML output - if (tagName != null) { -// msoLogger.debug("toXMLString(): adding opening tagName: " + tagName); - strBuf.append("<"); - strBuf.append(tagName); - strBuf.append(">"); - } - // iterate thru the keys. - jsonObj = (JSONObject) obj; - keys = jsonObj.keys(); - while (keys.hasNext()) { - key = keys.next(); - // msoLogger.debug("toXMLString(): key is " + k); - curObj = jsonObj.opt(key); - if (curObj == null) { - curObj = ""; - } - if (curObj instanceof String) { - str = (String) curObj; - } else { - str = null; - } - // append the content to the XML output - if ("content".equals(key)) { - if (curObj instanceof JSONArray) { - jsonArr = (JSONArray) curObj; - len = jsonArr.length(); - for (i = 0; i < len; i += 1) { - if (i > 0) { - strBuf.append('\n'); - } - strBuf.append(XML.escape(jsonArr.get(i).toString())); - } - } else { - strBuf.append(XML.escape(curObj.toString())); - } - // append an array of similar keys to the XML output - } else if (curObj instanceof JSONArray) { - jsonArr = (JSONArray) curObj; - len = jsonArr.length(); -// msoLogger.debug("toXMLString(): found JSONArray: " + key + ", size: " + len); - for (i = 0; i < len; i += 1) { - curObj = jsonArr.get(i); - if (curObj instanceof JSONArray) { -// The XML tags for the nested array should be generated below when this method -// is called recursively and the JSONArray object is passed -// strBuf.append("<"); -// strBuf.append(key); -// strBuf.append(">"); - strBuf.append(toXMLString(curObj, null)); -// strBuf.append(""); - } else { -// msoLogger.debug("toXMLString(): recursive call toXML() with tagName null"); - // append the opening tag for the array (before 1st element) - if (i == 0) { - strBuf.append("<"); - strBuf.append(key); - strBuf.append(">"); - } - // append the opening tag for the array - strBuf.append(toXMLString(curObj, null)); - // append the closing tag for the array (after last element) - if (i == (len - 1)) { - strBuf.append(""); - } - } - } - } else if (curObj.equals("")) { - // append a closing tag "" to the XML output - strBuf.append("<"); - strBuf.append(key); - strBuf.append("/>"); - } else { -// msoLogger.debug("toXMLString(): recursive call toXMLString() with tagName: " + key); - strBuf.append(toXMLString(curObj, key)); - } - // msoLogger.debug("toXML(): partial XML: " + strBuf.toString()); - } - if (tagName != null) { - // append the closing tag "" to the XML output -// msoLogger.debug("toXMLString(): adding closing tagName: " + tagName); - strBuf.append(""); - } - return strBuf.toString(); - // XML does not have good support for arrays. If an array appears in a place - // where XML is lacking, synthesize an < array > element. - } else if (obj instanceof JSONArray) { - jsonArr = (JSONArray) obj; - len = jsonArr.length(); - for (i = 0; i < len; ++i) { - curObj = jsonArr.opt(i); - strBuf.append(toXMLString(curObj, (tagName == null) ? "array" - : tagName)); - } - return strBuf.toString(); - } else { -// msoLogger.debug("toXML(): in else block with tagName: " + tagName); - str = (obj == null) ? "null" : XML.escape(obj.toString()); - return (tagName == null) ? "\"" + str + "\"" - : (str.length() == 0) ? "<" + tagName + "/>" : "<" - + tagName + ">" + str + ""; - } - } - - /** - * Invokes json2xml(String, Boolean) defaulting to 'pretty' output. - * - * @param jsonStr String containing the XML doc - * @return String containing the JSON translation - */ - public static String json2xml(String jsonStr) { - return json2xml(jsonStr, true); - } - - /** - * Formats the JSON String using the value of MSOJsonIndentFactor. - * - * @param jsonStr String containing the JSON doc - * @return String containing the formatted JSON doc - */ - public static String prettyJson(String jsonStr) { -// String isDebugLogEnabled = "true"; - try { - JSONObject jsonObj = new JSONObject(jsonStr); - return jsonObj.toString(MSOJsonIndentFactor); - } catch (Exception e){ - msoLogger.debug("prettyJson(): unable to parse/format json input. Exception was: " + e.toString(), e); - return null; - } - } - - /** - * Returns an Iterator over the JSON keys in the specified JSON doc. - * - * @param jsonStr String containing the JSON doc - * @return Iterator over the JSON keys - * @throws JSONException if the doc cannot be parsed - */ - public static Iterator getJsonIterator(String jsonStr) throws JSONException { - return new JSONObject(jsonStr).keys(); - } - - /** - * Returns the name of the "root" property in the specified JSON doc. The - * "root" property is the single top-level property in the JSON doc. An - * exception is thrown if the doc is empty or if it contains more than one - * top-level property. - * - * @param jsonStr String containing the JSON doc - * @return the name of the "root" property - * @throws JSONException if the doc cannot be parsed, or if it is empty, or if - * it contains more than one top-level property - */ - public static String getJsonRootProperty(String jsonStr) throws JSONException { - Iterator iter = getJsonIterator(jsonStr); - - if (!iter.hasNext()) { - throw new JSONException("Empty JSON object"); - } - - String rootPropertyName = iter.next(); - - if (iter.hasNext()) { - throw new JSONException("JSON object has more than one root property"); - } - - return rootPropertyName; - } - - /** - * Invokes the getJsonRawValue() method and returns the String equivalent of - * the object returned. - * - * TBD: May need separate methods for boolean, float, and integer fields if the - * String representation is not sufficient to meet client needs. - * - * @param jsonStr String containing the JSON doc - * @param keys full key path to the target value in the format of "key1.key2.key3..." - * @return String field value associated with keys - */ - public static String getJsonValue(String jsonStr, String keys) { - - try { - Object rawValue = getJsonRawValue(jsonStr, keys); - if (rawValue == null) { - return null; - } else { - if (rawValue instanceof String) { - msoLogger.debug("getJsonValue(): the raw value is a String Object=" + rawValue); - return (String) rawValue; - } else { - msoLogger.debug("getJsonValue(): the raw value is NOT a String Object=" + rawValue.toString()); - return rawValue.toString(); - } - } - } catch (Exception e) { - msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e); - } - return null; - } - - /** - * Invokes the getJsonRawValue() method with the wrap flag set to true - * and returns the String equivalent of the json node object returned. - * - * @param jsonStr String containing the JSON doc - * @param keys full key path to the target value in the format of "key1.key2.key3..." - * @return String field value associated with keys - */ - public static String getJsonNodeValue(String jsonStr, String keys) { -// String isDebugLogEnabled = "true"; - try { - Object rawValue = getJsonRawValue(jsonStr, keys, true); - if (rawValue == null) { - return null; - } else { - if (rawValue instanceof String) { - msoLogger.debug("getJsonNodeValue(): the raw value is a String Object=" + rawValue); - return (String) rawValue; - } else { - msoLogger.debug("getJsonNodeValue(): the raw value is NOT a String Object=" + rawValue.toString()); - return rawValue.toString(); - } - } - } catch (Exception e) { - msoLogger.debug("getJsonNodeValue(): unable to parse json to retrieve node for field=" + keys + ". Exception was: " + e.toString(), e); - } - return null; - } - - /** - * Invokes the getJsonRawValue() method and returns the String equivalent of - * the object returned. - * - * TBD: May need separate methods for boolean, float, and integer fields if the - * String representation is not sufficient to meet client needs. - * - * @param jsonStr String containing the JSON doc - * @param keys full key path to the target value in the format of "key1.key2.key3..." - * @return String field value associated with keys - */ - public static int getJsonIntValue(String jsonStr, String keys) { -// String isDebugLogEnabled = "true"; - try { - Object rawValue = getJsonRawValue(jsonStr, keys); - if (rawValue == null) { - return 0; - } else { - if (rawValue instanceof Integer) { - msoLogger.debug("getJsonValue(): the raw value is an Integer Object=" + rawValue); - return (Integer) rawValue; - } else { - msoLogger.debug("getJsonIntValue(): the raw value is NOT an Integer Object=" + rawValue.toString()); - return 0; - } - } - } catch (Exception e) { - msoLogger.debug("getJsonIntValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(), e); - } - return 0; - } - - /** - * Invokes the getJsonRawValue() method and returns the boolean equivalent of - * the object returned. - * - * @param jsonStr String containing the JSON doc - * @param keys full key path to the target value in the format of "key1.key2.key3..." - * @return boolean field value associated with keys - default is false - */ - public static boolean getJsonBooleanValue(String jsonStr, String keys) { - try { - Object rawValue = getJsonRawValue(jsonStr, keys); - if (rawValue == null) { - return false; - } else { - if (rawValue instanceof Boolean) { - msoLogger.debug("getJsonBooleanValue(): the raw value is a Boolean Object=" + rawValue); - return (Boolean) rawValue; - } else { - msoLogger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object=" + rawValue.toString()); - return false; - } - } - } catch (Exception e) { - msoLogger.debug("getJsonBooleanValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e); - } - return false; - } - - /** - * Invokes the getJsonParamValue() method to obtain the JSONArray associated with - * the specified keys. The JSONArray is then walked to retrieve the first array - * value associated with the specified field name (index=0). - * - * @param jsonStr String containing the JSON doc - * @param keys full key path to the target value in the format of "key1.key2.key3..." - * @param name field name for the param to be retrieved - * @return String param value associated with field name - */ - public static String getJsonParamValue(String jsonStr, String keys, String name) { - return getJsonParamValue(jsonStr, keys, name, 0); - } - - /** - * Invokes the getJsonRawValue() method to obtain the JSONArray associated with - * the specified keys. The JSONArray is then walked to retrieve the nth array - * value associated with the specified field name and index. - * - * @param jsonStr String containing the JSON doc - * @param keys full key path to the target value in the format of "key1.key2.key3..." - * @param name field name for the param to be retrieved - * @param index the nth param associated with name starting at 0 - * @return String param value associated with field name - */ - public static String getJsonParamValue(String jsonStr, String keys, String name, int index) { - - try { - Object rawValue = getJsonRawValue(jsonStr, keys); - if (rawValue == null) { - return null; - } else { - if (rawValue instanceof JSONArray) { - msoLogger.debug("getJsonParamValue(): keys=" + keys + " points to JSONArray: " + rawValue.toString()); - int arrayLen = ((JSONArray) rawValue).length(); - if (index < 0 || arrayLen < index+1) { - msoLogger.debug("getJsonParamValue(): index: " + index + " is out of bounds for array size of " + arrayLen); - return null; - } - int foundCnt = 0; - for (int i = 0; i < arrayLen; i++) { - msoLogger.debug("getJsonParamValue(): index: " + i + ", value: " + ((JSONArray) rawValue).get(i).toString()); - if (((JSONArray) rawValue).get(i) instanceof JSONObject) { -// msoLogger.debug("getJsonParamValue(): index: " + i + " is a JSONObject"); - JSONObject jsonObj = (JSONObject)((JSONArray) rawValue).get(i); - String parmValue = jsonObj.get(name).toString(); - if (parmValue != null) { - msoLogger.debug("getJsonParamValue(): found value: " + parmValue + " for name: " + name + " and index: " + i); - if (foundCnt == index) { - return parmValue; - } else { - foundCnt++; - continue; - } - } else { - continue; - } - } else { - msoLogger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject=" + rawValue.toString()); - return null; - } - } - msoLogger.debug("getJsonParamValue(): content value NOT found for name: " + name); - return null; - } else { - msoLogger.debug("getJsonParamValue(): the raw value is NOT a JSONArray Object=" + rawValue.toString()); - return null; - } - } - } catch (Exception e) { - // JSONObject::get() throws a "not found" exception if one of the specified keys is not found - if (e.getMessage().contains("not found")) { - msoLogger.debug("getJsonParamValue(): failed to retrieve param value for keys:" + keys + ", name=" + name + ": " + e.getMessage()); - } else { - msoLogger.debug("getJsonParamValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(), e); - } - } - return null; - } - - /** - * Wrapper to generate the JSONObject to pass to the getJsonValueForKey(JSONObject, String) - * method so that recursion over the subobjects can be supported there - * - * @param jsonStr String containing the JSON doc - * @param key key to the target value - * @return String field value associated with key - */ - public static String getJsonValueForKey(String jsonStr, String key) { - - try { - JSONObject jsonObj = new JSONObject(jsonStr); - return getJsonValueForKey(jsonObj, key); - } catch (Exception e) { - msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(), e); - } - return null; - } - - /** - * Walks the JSONObject (and sub-objects recursively), searching for the first value associated with the - * single key/field name specified. Returns the associated value if found or null if the key is not found - * - * @param jsonObj JSONObject representation of the the JSON doc - * @param key key to the target value - * @return String field value associated with key - */ - public static String getJsonValueForKey(JSONObject jsonObj, String key) { - - String keyValue = null; - try { - if (jsonObj.has(key)) { - Object value = jsonObj.get(key); - msoLogger.debug("getJsonValueForKey(): found value=" + (String) value + ", for key=" + key); - if (value == null) { - return null; - } else { - return ((String) value); - } - } else { -// msoLogger.debug("getJsonValueForKey(): iterating over the keys"); - Iterator itr = jsonObj.keys(); - while (itr.hasNext()) { - String nextKey = itr.next(); - Object obj = jsonObj.get(nextKey); - if (obj instanceof JSONObject) { -// msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call on: " + -// ((JSONObject) obj).toString(MSOJsonIndentFactor)); - keyValue = getJsonValueForKey((JSONObject) obj, key); - if (keyValue != null) { -// msoLogger.debug("getJsonValueForKey(): found value=" + keyValue + ", for key=" + key); - break; - } - } else { - msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", does not point to a JSONObject, next key"); - } - } - } - } catch (Exception e) { - // JSONObject::get() throws a "not found" exception if one of the specified keys is not found - if (e.getMessage().contains("not found")) { - msoLogger.debug("getJsonValueForKey(): failed to retrieve param value for key=" + key + ": " + e.getMessage()); - } else { - msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(), e); - } - keyValue = null; - } - return keyValue; - } - - /** - * Walks the JSONObject (and sub-objects recursively), searching for the first value associated with the - * single key/field name specified. Returns the associated value if found or null if the key is not found - * - * @param jsonObj JSONObject representation of the the JSON doc - * @param key key to the target value - * @return String field value associated with key - */ - public static Integer getJsonIntValueForKey(JSONObject jsonObj, String key) { -// String isDebugLogEnabled = "true"; - Integer keyValue = null; - try { - if (jsonObj.has(key)) { - Integer value = (Integer) jsonObj.get(key); - msoLogger.debug("getJsonIntValueForKey(): found value=" + value + ", for key=" + key); - return value; - } else { -// msoLogger.debug("getJsonIntValueForKey(): iterating over the keys"); - Iterator itr = jsonObj.keys(); - while (itr.hasNext()) { - String nextKey = itr.next(); - Object obj = jsonObj.get(nextKey); - if (obj instanceof JSONObject) { -// msoLogger.debug("getJsonIntValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call"); - keyValue = getJsonIntValueForKey((JSONObject) obj, key); - if (keyValue != null) { -// msoLogger.debug("getJsonIntValueForKey(): found value=" + keyValue + ", for key=" + key); - break; - } - } else { - msoLogger.debug("getJsonIntValueForKey(): key=" + nextKey + ", does not point to a JSONObject, next key"); - } - } - } - } catch (Exception e) { - // JSONObject::get() throws a "not found" exception if one of the specified keys is not found - if (e.getMessage().contains("not found")) { - msoLogger.debug("getJsonIntValueForKey(): failed to retrieve param value for key=" + key + ": " + e.getMessage()); - } else { - msoLogger.debug("getJsonIntValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(),e); - } - keyValue = null; - } - return keyValue; - } - - /** - * Walks the JSONObject (and sub-objects recursively), searching for the first value associated with the - * single key/field name specified. Returns the associated value if found or null if the key is not found - * - * @param jsonObj JSONObject representation of the the JSON doc - * @param key key to the target value - * @return String field value associated with key - */ - public static Boolean getJsonBooleanValueForKey(JSONObject jsonObj, String key) { - Boolean keyValue = null; - try { - if (jsonObj.has(key)) { - Boolean value = (Boolean) jsonObj.get(key); - msoLogger.debug("getJsonBooleanValueForKey(): found value=" + value + ", for key=" + key); - return value; - } else { -// msoLogger.debug("getJsonBooleanValueForKey(): iterating over the keys"); - Iterator itr = jsonObj.keys(); - while (itr.hasNext()) { - String nextKey = itr.next(); - Object obj = jsonObj.get(nextKey); - if (obj instanceof JSONObject) { -// msoLogger.debug("getJsonBooleanValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call"); - keyValue = getJsonBooleanValueForKey((JSONObject) obj, key); - if (keyValue != null) { -// msoLogger.debug("getJsonBooleanValueForKey(): found value=" + keyValue + ", for key=" + key); - break; - } - } else { - msoLogger.debug("getJsonBooleanValueForKey(): key=" + nextKey + ", does not point to a JSONObject, next key"); - } - } - } - } catch (Exception e) { - // JSONObject::get() throws a "not found" exception if one of the specified keys is not found - if (e.getMessage().contains("not found")) { - msoLogger.debug("getJsonBooleanValueForKey(): failed to retrieve param value for key=" + key + ": " + e.getMessage()); - } else { - msoLogger.debug("getJsonBooleanValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(),e); - } - keyValue = null; - } - return keyValue; - } - - /** - * Boolean method to determine if a key path is valid for the JSON doc. Invokes - * getJsonValue(). - * - * @param jsonStr String containing the JSON doc - * @param keys full key path to the target value in the format of "key1.key2.key3..." - * @return Boolean true if keys points to value in the JSON doc - */ - public static Boolean jsonValueExists(String jsonStr, String keys) { - if (getJsonRawValue(jsonStr, keys) == null) { - return false; - } else { - return true; - } - } - - /** - * Inserts the new key/value pair at the appropriate location in the JSON - * document after first determining if keyed field already exists. If - * it does exist, return the JSON unmodified, otherwise return the new JSON - * Note: this method currently only supports String value inserts. - * - * @param jsonStr String containing the JSON doc - * @param keys full key path to the value to be added in the format of "key1.key2.key3..." - * @return String containing the updated JSON doc - */ - public static String addJsonValue(String jsonStr, String keys, String value) { - - // only attempt to insert the key/value pair if it does not exist - if (!jsonValueExists(jsonStr, keys)) { - return putJsonValue(jsonStr, keys, value); - } else { - msoLogger.debug("addJsonValue(): JSON add failed, key=" + keys + "/value=" + value + " already exists"); - return jsonStr; - } - } - - /** - * Updates the value for the specified key in the JSON document - * after first determining if keyed field exists. If it does - * not exist, return the JSON unmodified, otherwise return the updated JSON. - * Note: this method currently only supports String value updates. - * - * @param jsonStr String containing the JSON doc - * @param keys full key path to the value to be updated in the format of "key1.key2.key3..." - * @return String containing the updated JSON doc - */ - public static String updJsonValue(String jsonStr, String keys, String newValue) { - - // only attempt to modify the key/value pair if it exists - if (jsonValueExists(jsonStr, keys)) { - return putJsonValue(jsonStr, keys, newValue); - } else { - msoLogger.debug("updJsonValue(): JSON update failed, no value exists for key=" + keys); - return jsonStr; - } - } - - /** - * Deletes the value for the specified key in the JSON document - * after first determining if keyed field exists. If it does - * not exist, return the JSON unmodified, otherwise return the updated JSON - * - * @param jsonStr String containing the JSON doc - * @param keys full key path to the value to be deleted in the format of "key1.key2.key3..." - * @return String containing the updated JSON doc - */ - public static String delJsonValue(String jsonStr, String keys) { - - // only attempt to remove the key/value pair if it exists - if (jsonValueExists(jsonStr, keys)) { - // passing a null value results in a delete - return putJsonValue(jsonStr, keys, null); - } else { - msoLogger.debug("delJsonValue(): JSON delete failed, no value exists for key=" + keys); - return jsonStr; - } - } - - /** - * Walks the JSON doc using the full key path to retrieve the associated - * value. All but the last key points to the 'parent' object name(s) in order - * in the JSON hierarchy with the last key pointing to the target value. - * The value returned is a Java object. - * - * @param jsonStr String containing the JSON doc - * @param keys full key path to the target value in the format of "key1.key2.key3..." - * @return Object field value associated with keys - */ - private static Object getJsonRawValue(String jsonStr, String keys) { - return getJsonRawValue(jsonStr, keys, false); - } - - /** - * Walks the JSON doc using the full key path to retrieve the associated - * value. All but the last key points to the 'parent' object name(s) in order - * in the JSON hierarchy with the last key pointing to the target value. - * The value returned is a Java object. - * - * @param jsonStr String containing the JSON doc - * @param keys full key path to the target value in the format of "key1.key2.key3..." - * @param wrap Boolean which determines if returned JSONObjects sould be "wrapped" - * Note: wrap does not apply to returned scalar values - * @return Object field value associated with keys - */ - private static Object getJsonRawValue(String jsonStr, String keys, Boolean wrap) { - - String keyStr = ""; - try { - JSONObject jsonObj = new JSONObject(jsonStr); - StringTokenizer keyTokens = new StringTokenizer(keys, "."); - while (keyTokens.hasMoreElements()) { - keyStr = keyTokens.nextToken(); - Object keyValue = jsonObj.get(keyStr); - if (keyValue instanceof JSONObject) { -// msoLogger.debug("getJsonRawValue(): key=" + keyStr + " points to json object"); - jsonObj = (JSONObject) keyValue; - } else { - if (keyTokens.hasMoreElements()) { - msoLogger.debug("getJsonRawValue(): value found prior to last key for key=" + keyStr); - } - return keyValue; - } - } - // return the json 'node' that the key points to - // note: since this is a json object and not a scalar value, - // use the wrap flag to determine if the object should - // be wrapped with a root node value - // (the last key in the keys String) - if (wrap) { - JSONObject wrappedJsonObj = new JSONObject(); - wrappedJsonObj.put(keyStr, jsonObj); - return wrappedJsonObj.toString(); - } else { - return jsonObj.toString(); - } - - } catch (Exception e) { - // JSONObject::get() throws a "not found" exception if one of the specified keys is not found - if (e.getMessage().contains("not found")) { - msoLogger.debug("getJsonRawValue(): failed to retrieve param value for key=" + keyStr + ": " + e.getMessage()); - } else { - msoLogger.debug("getJsonRawValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e); - } - } - return null; - } - - /** - * Private method invoked by the public add, update, and delete methods. - * - * @param jsonStr String containing the JSON doc - * @param keys full key path to the value to be deleted in the format of "key1.key2.key3..." - * @return String containing the updated JSON doc - */ - private static String putJsonValue(String jsonStr, String keys, String value) { - - String keyStr = ""; - try { - JSONObject jsonObj = new JSONObject(jsonStr); - JSONObject jsonObjOut = jsonObj; - StringTokenizer keyTokens = new StringTokenizer(keys, "."); - while (keyTokens.hasMoreElements()) { - keyStr = keyTokens.nextToken(); - if (keyTokens.hasMoreElements()) { - Object keyValue = jsonObj.get(keyStr); - if (keyValue instanceof JSONObject) { -// msoLogger.debug("putJsonValue(): key=" + keyStr + " points to json object"); - jsonObj = (JSONObject) keyValue; - } else { - msoLogger.debug("putJsonValue(): key=" + keyStr + " not the last key but points to non-json object: " + keyValue); - return null; - } - } else { // at the last/new key value - jsonObj.put(keyStr, value); - return jsonObjOut.toString(3); - } - } - // should not hit this point if the key points to a valid key value - return null; - - } catch (Exception e) { - // JSONObject::get() throws a "not found" exception if one of the specified keys is not found - if (e.getMessage().contains("not found")) { - msoLogger.debug("putJsonValue(): failed to put param value for key=" + keyStr + ": " + e.getMessage()); - } else { - msoLogger.debug("putJsonValue(): unable to parse json to put value for key=" + keys + ". Exception was: " + e.toString(),e); - } - } - return null; - } - - /** - * This json util method converts a json array of Key Value - * pair objects into a Java Map. - * - * @param execution - * @param entryArray - the getJsonValue of a json Array of key/value pairs - * - * @return Map - a Map containing the entries - */ - public Map jsonStringToMap(DelegateExecution execution, String entry) { - msoLogger.debug("Started Json String To Map Method"); - - Map map = new HashMap<>(); - - //Populate Map - JSONObject obj = new JSONObject(entry); - - /* Wildfly is pushing a version of org.json which does not - * auto cast to string. Leaving it as an object prevents - * a method not found exception at runtime. - */ - final Iterator keys = obj.keys(); - while (keys.hasNext()) { - final String key = keys.next(); - map.put(key, obj.getString(key)); - } - msoLogger.debug("Outgoing Map is: " + map); - msoLogger.debug("Completed Json String To Map Method"); - return map; - } - - /** - * This json util method converts a json array of Key Value - * pair objects into a Java Map. - * - * @param execution - * @param entryArray - the getJsonValue of a json Array of key/value pairs - * @param keyNode - the name of the node that represents the key - * @param valueNode - the name of the node that represents the value - * - * @return Map - a Map containing the entries - * - */ - public Map entryArrayToMap(DelegateExecution execution, String entryArray, String keyNode, String valueNode) { - msoLogger.debug("Started Entry Array To Map Util Method"); - - Map map = new HashMap<>(); - //Populate Map - String entryListJson = "{ \"wrapper\":" + entryArray + "}"; - JSONObject obj = new JSONObject(entryListJson); - JSONArray arr = obj.getJSONArray("wrapper"); - for (int i = 0; i < arr.length(); i++){ - JSONObject jo = arr.getJSONObject(i); - String key = jo.getString(keyNode); - String value = jo.getString(valueNode); - map.put(key, value); - } - msoLogger.debug("Outgoing Map is: " + map); - msoLogger.debug("Completed Entry Array To Map Util Method"); - return map; - } - - /** - * This json util method converts a json Array of Strings - * to a Java List. It takes each String in the json Array - * and puts it in a Java List. - * - * @param execution - * @param jsonArrayOfStrings - the getJsonValue of a json array of strings - * - * @return List - a java list containing the strings - * - * - */ - public List StringArrayToList(Execution execution, String jsonArrayOfStrings) { - msoLogger.debug("Started String Array To List Util Method"); - - List list = new ArrayList<>(); - //Populate List - String stringListJson = "{ \"strings\":" + jsonArrayOfStrings + "}"; - JSONObject obj = new JSONObject(stringListJson); - JSONArray arr = obj.getJSONArray("strings"); - for (int i = 0; i < arr.length(); i++){ - String s = arr.get(i).toString(); - list.add(s); - } - msoLogger.debug("Outgoing List is: " + list); - msoLogger.debug("Completed String Array To List Util Method"); - return list; - } - - /** - * - * Invokes the getJsonRawValue() method to determine if the - * json element/variable exist. Returns true if the - * json element exist - * - * @param jsonStr String containing the JSON doc - * @param keys full key path to the target value in the format of "key1.key2.key3..." - * @return boolean field value associated with keys - * - * - */ - public static boolean jsonElementExist(String jsonStr, String keys) { - - try { - Object rawValue = getJsonRawValue(jsonStr, keys); - - return !(rawValue == null); - - } catch (Exception e) { - msoLogger.debug("jsonElementExist(): unable to determine if json element exist. Exception is: " + e.toString(),e); - } - return true; - } - - /** - * - * Validates the JSON document against a schema file. - * - * @param jsonStr String containing the JSON doc - * @param jsonSchemaPath full path to a valid JSON schema file - * @return String the validation results/report - * - * - */ - public static String jsonSchemaValidation(String jsonStr, String jsonSchemaPath) throws ValidationException { - try { - msoLogger.debug("JSON document to be validated: " + jsonStr); - JsonNode document = JsonLoader.fromString(jsonStr); -// JsonNode document = JsonLoader.fromFile(jsonDoc); - JsonNode schema = JsonLoader.fromPath(jsonSchemaPath); - - JsonSchemaFactory factory = JsonSchemaFactory.byDefault(); - JsonValidator validator = factory.getValidator(); - - ProcessingReport report = validator.validate(schema, document); - msoLogger.debug("JSON schema validation report: " + report.toString()); - return report.toString(); - } catch (IOException e) { - msoLogger.debug("IOException performing JSON schema validation on document: " + e.toString()); - throw new ValidationException(e.getMessage()); - } catch (ProcessingException e) { - msoLogger.debug("ProcessingException performing JSON schema validation on document: " + e.toString()); - throw new ValidationException(e.getMessage()); - } - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java deleted file mode 100644 index 1efcf5f286..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java +++ /dev/null @@ -1,131 +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.bpmn.core.json; - -import java.io.IOException; -import java.io.Serializable; -import java.util.List; - -import org.json.JSONException; -import org.json.JSONObject; - -import com.fasterxml.jackson.annotation.JsonInclude; -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; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.databind.SerializationFeature; - -import org.openecomp.mso.logger.MsoLogger; - -@JsonInclude(Include.NON_NULL) -public abstract class JsonWrapper implements Serializable { - - - private static final long serialVersionUID = 8633550139273639875L; - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - @JsonInclude(Include.NON_NULL) - public String toJsonString(){ - - String jsonString = ""; - //convert with Jackson - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - mapper.setSerializationInclusion(Include.NON_NULL); - - ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter(); - try { - jsonString = ow.writeValueAsString(this); -// } catch (JsonGenerationException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } catch (JsonMappingException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } catch (IOException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } - } catch (Exception e){ - - LOGGER.debug("Exception :",e); - } - return jsonString; - } - - @JsonInclude(Include.NON_NULL) - public JSONObject toJsonObject() { - - ObjectMapper mapper = new ObjectMapper(); - // mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - //mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - // mapper.enable(com.fasterxml.jackson.map.DeserializationFeature.UNWRAP_ROOT_VALUE); - JSONObject json = new JSONObject(); - try { - json = new JSONObject(mapper.writeValueAsString(this)); - } catch (JSONException | IOException e) { - LOGGER.debug("Exception :",e); - } - return json; - } - - public String listToJson(List list) { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - - String jsonString = ""; - try { - jsonString = mapper.writeValueAsString(list); - } catch (IOException e) { - LOGGER.debug("Exception :",e); - } - return jsonString; - } - - @JsonInclude(Include.NON_NULL) - public String toJsonStringNoRootName(){ - - String jsonString = ""; - //convert with Jackson - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - - ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter(); - try { - jsonString = ow.writeValueAsString(this); - } catch (Exception e){ - - LOGGER.debug("Exception :",e); - } - return jsonString; - } - - /** - * Returns a string representation of this object. - */ - public String toString() { - return this.toJsonString(); - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/CustomMyBatisSessionFactory.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/CustomMyBatisSessionFactory.java deleted file mode 100644 index 4dde5ae595..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/CustomMyBatisSessionFactory.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.bpmn.core.mybatis; - -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; -import org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration; -import org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor; -import org.camunda.bpm.engine.impl.interceptor.CommandInterceptor; -import org.camunda.bpm.engine.impl.interceptor.LogInterceptor; -import org.camunda.bpm.engine.impl.util.ReflectUtil; - - -/** - * A special process engine that provides access to MyBatis mappings. - * @version 1.0 - */ -public class CustomMyBatisSessionFactory extends - StandaloneProcessEngineConfiguration { - - private String resourceName; - - /** - * Overridden to ensure nobody ever tries to initialize this process engine - * in the normal way. We are using this process engine only for MyBatis - * access. - */ - @Override - protected void init() { - throw new UnsupportedOperationException("init"); - } - - /** - * Initialize the ProcessEngineConfiguration from an existing one, just - * using the database settings to initialize the database / MyBatis stuff. - */ - public void initFromProcessEngineConfiguration( - ProcessEngineConfigurationImpl processEngineConfiguration, - String resourceName) { - this.resourceName = resourceName; - - setDatabaseType(processEngineConfiguration.getDatabaseType()); - setDataSource(processEngineConfiguration.getDataSource()); - setDatabaseTablePrefix(processEngineConfiguration - .getDatabaseTablePrefix()); - - initDataSource(); - // initVariableTypes(); - initCommandContextFactory(); - initTransactionFactory(); - initTransactionContextFactory(); - initCommandExecutors(); - initSqlSessionFactory(); - initIncidentHandlers(); - initIdentityProviderSessionFactory(); - initSessionFactories(); - } - - /** - * In order to always open a new command context set the property - * "alwaysOpenNew" to true inside the CommandContextInterceptor. - * - * If you execute the custom queries inside the process engine (for example - * in a service task), you have to do this. - */ - @Override - protected Collection getDefaultCommandInterceptorsTxRequired() { - List defaultCommandInterceptorsTxRequired = - new ArrayList<>(); - defaultCommandInterceptorsTxRequired.add(new LogInterceptor()); - defaultCommandInterceptorsTxRequired.add(new CommandContextInterceptor( - commandContextFactory, this, true)); - return defaultCommandInterceptorsTxRequired; - } - - @Override - protected InputStream getMyBatisXmlConfigurationSteam() { - return ReflectUtil.getResourceAsStream(resourceName); - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/URNMapping.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/URNMapping.java deleted file mode 100644 index c48b671b72..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/URNMapping.java +++ /dev/null @@ -1,122 +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.bpmn.core.mybatis; - -/** - * A bean that represents a single URN mapping. - */ -public class URNMapping { - private String name; - private String value; - private String rev; - - /** - * Get the name. - * @return the name - */ - public String getName() { - return name; - } - - /** - * Set the name. - * @param name the name - */ - public void setName(String name) { - this.name = name; - } - - /** - * Get the value mapped to the name. - * @return the value mapped to the name - */ - public String getValue() { - return value; - } - - /** - * Set the value mapped to the name. - * @param value the value mapped to the name - */ - public void setValue(String value) { - this.value = value; - } - - /** - * Get the revision attribute (currently unused). - * @return the revision attribute - */ - public String getRev() { - return rev; - } - - /** - * Set the revision attribute (currently unused). - * @param rev the revision attribute - */ - public void setRev(String rev) { - this.rev = rev; - } - - /** - * Converts a URN to "normal" form so it can used as a java or groovy - * variable identifier. This is done in a way that makes the identifier - * as readable as possible, but note that it might result in a loss of - * uniqueness. - *
    - *
  1. URN_ is prepended
  2. - *
  3. All characters that are not letters or digits are converted to - * underscore characters
  4. - *
  5. Sequences of multiple underscores are collapsed to a single - * underscore character
  6. - *
- * Examples: - *

- * aai:endpoint becomes URN_aai_endpoint
- * ae:internal-reporting becomes URN_ae_internal_reporting
- * - * @param urn the URN - * @return a normalized identifier - */ - public static String createIdentifierFromURN(String urn) { - StringBuilder builder = new StringBuilder(); - builder.append("URN_"); - char last = builder.charAt(builder.length() - 1); - - int len = urn.length(); - - for (int i = 0; i < len; i++) { - char c = urn.charAt(i); - - if (!Character.isLetterOrDigit(c) && c != '_') { - c = '_'; - } - - if (!(c == '_' && last == '_')) { - builder.append(c); - } - - last = c; - } - - return builder.toString(); - } -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java deleted file mode 100644 index b66169db92..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java +++ /dev/null @@ -1,454 +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.bpmn.core.plugins; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.ExecutionListener; -import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener; -import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener; -import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin; -import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; -import org.camunda.bpm.engine.impl.context.Context; -import org.camunda.bpm.engine.impl.interceptor.Command; -import org.camunda.bpm.engine.impl.interceptor.CommandContext; -import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity; -import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl; -import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl; -import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl; -import org.camunda.bpm.engine.impl.util.xml.Element; -import org.camunda.bpm.engine.impl.variable.VariableDeclaration; - -import org.openecomp.mso.bpmn.core.BPMNLogger; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.bpmn.core.mybatis.CustomMyBatisSessionFactory; -import org.openecomp.mso.bpmn.core.mybatis.URNMapping; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * Plugin for MSO logging and URN mapping. - */ -public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - private static final String FSPROPKEY = "URNMapping.FileSystemLoading.Enabled"; - - @Override - public void preInit( - ProcessEngineConfigurationImpl processEngineConfiguration) { - List preParseListeners = processEngineConfiguration - .getCustomPreBPMNParseListeners(); - if (preParseListeners == null) { - preParseListeners = new ArrayList<>(); - processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners); - } - preParseListeners.add(new LoggingParseListener()); - } - - /** - * Called when a process flow is parsed so we can inject listeners. - */ - public static class LoggingParseListener extends AbstractBpmnParseListener { - private void injectLogExecutionListener(ActivityImpl activity) { - activity.addListener( - ExecutionListener.EVENTNAME_END, - new LoggingExecutionListener("END")); - - activity.addListener( - ExecutionListener.EVENTNAME_START, - new LoggingExecutionListener("START")); - - activity.addListener( - ExecutionListener.EVENTNAME_TAKE, - new LoggingExecutionListener("TAKE")); - } - - @Override - public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) { - } - - @Override - public void parseStartEvent(Element startEventElement, ScopeImpl scope, ActivityImpl startEventActivity) { - // Inject these listeners only on the main start event for the flow, not on any embedded subflow start events - if (scope instanceof ProcessDefinitionEntity) { - startEventActivity.addListener(ExecutionListener.EVENTNAME_START, new URNMappingInitializerListener("START")); - startEventActivity.addListener(ExecutionListener.EVENTNAME_START, new LoggingInitializerListener("START")); - } - - injectLogExecutionListener(startEventActivity); - } - - @Override - public void parseServiceTask(Element serviceTaskElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseExclusiveGateway(Element exclusiveGwElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseInclusiveGateway(Element inclusiveGwElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseParallelGateway(Element parallelGwElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseScriptTask(Element scriptTaskElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseBusinessRuleTask(Element businessRuleTaskElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseTask(Element taskElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseManualTask(Element manualTaskElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseEndEvent(Element endEventElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseBoundaryTimerEventDefinition(Element timerEventDefinition, boolean interrupting, ActivityImpl timerActivity) { - injectLogExecutionListener(timerActivity); - } - - @Override - public void parseBoundaryErrorEventDefinition(Element errorEventDefinition, boolean interrupting, ActivityImpl activity, ActivityImpl nestedErrorEventActivity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseSubProcess(Element subProcessElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseCallActivity(Element callActivityElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseProperty(Element propertyElement, VariableDeclaration variableDeclaration, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseSequenceFlow(Element sequenceFlowElement, ScopeImpl scopeElement, TransitionImpl transition) { - //injectLogExecutionListener(activity); - } - - @Override - public void parseSendTask(Element sendTaskElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseMultiInstanceLoopCharacteristics(Element activityElement, Element multiInstanceLoopCharacteristicsElement, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseIntermediateTimerEventDefinition(Element timerEventDefinition, ActivityImpl timerActivity) { - injectLogExecutionListener(timerActivity); - } - - @Override - public void parseRootElement(Element rootElement, List processDefinitions) { - //injectLogExecutionListener(activity); - } - - @Override - public void parseReceiveTask(Element receiveTaskElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseIntermediateSignalCatchEventDefinition(Element signalEventDefinition, ActivityImpl signalActivity) { - injectLogExecutionListener(signalActivity); - } - - @Override - public void parseBoundarySignalEventDefinition(Element signalEventDefinition, boolean interrupting, ActivityImpl signalActivity) { - injectLogExecutionListener(signalActivity); - } - - @Override - public void parseEventBasedGateway(Element eventBasedGwElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseTransaction(Element transactionElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseCompensateEventDefinition(Element compensateEventDefinition, ActivityImpl compensationActivity) { - injectLogExecutionListener(compensationActivity); - } - - @Override - public void parseIntermediateThrowEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseIntermediateCatchEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) { - injectLogExecutionListener(activity); - } - - @Override - public void parseBoundaryEvent(Element boundaryEventElement, ScopeImpl scopeElement, ActivityImpl nestedActivity) { - injectLogExecutionListener(nestedActivity); - } - - @Override - public void parseIntermediateMessageCatchEventDefinition(Element messageEventDefinition, ActivityImpl nestedActivity) { - injectLogExecutionListener(nestedActivity); - } - - @Override - public void parseBoundaryMessageEventDefinition(Element element, boolean interrupting, ActivityImpl messageActivity) { - injectLogExecutionListener(messageActivity); - } - } - - /** - * Initializes URN mapping variables on process entry. - */ - public static class URNMappingInitializerListener implements ExecutionListener { - private String event; - - public URNMappingInitializerListener(String eventData) { - this.event = eventData; - } - - public String getEvent() { - return event; - } - - @Override - public void notify(DelegateExecution execution) throws Exception { - ProcessEngineConfigurationImpl processEngineConfiguration = - Context.getProcessEngineConfiguration(); - loadURNProperties(execution, processEngineConfiguration); - } - - private void loadURNProperties(DelegateExecution execution, - ProcessEngineConfigurationImpl processEngineConfiguration) { - Map bpmnProps = PropertyConfiguration.getInstance().getProperties("mso.bpmn.properties"); - if (bpmnProps == null) { - LOGGER.debug("Unable to load mso.bpmn.properties; loading URN Mapping from DB"); - - LOGGER.error (MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, - "Unable to load mso.bpmn.properties; loading URN Mapping from DB"); - - loadFromDB(execution, processEngineConfiguration); - } else { - String fsEnabled = bpmnProps.get(FSPROPKEY); - if (fsEnabled != null) { - if (Boolean.parseBoolean(fsEnabled)) { - LOGGER.debug("File system loading is enabled; loading URN properties from File system"); - LOGGER.info(MessageEnum.BPMN_GENERAL_INFO, "BPMN", "File system loading is enabled; loading URN properties from File System"); - loadFromFileSystem(execution); - } else { - LOGGER.debug("File system loading is disabled; loading URN properties from DB"); - LOGGER.info (MessageEnum.BPMN_GENERAL_INFO, "BPMN", "File system loading is disabled; loading URN properties from DB"); - - loadFromDB(execution, processEngineConfiguration); - } - } else { - - LOGGER.error (MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, - "Unable to retrieve URNMapping.FileSystemLoading.Enabled from mso.bpmn.properties; loading URN Mapping from DB"); - - loadFromDB(execution, processEngineConfiguration); - } - } - } - - private void loadFromFileSystem(DelegateExecution execution) { - PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); - Map props = propertyConfiguration.getProperties("mso.bpmn.urn.properties"); - for (String key : props.keySet()) { - String varName = URNMapping.createIdentifierFromURN(key); - String varValue = props.get(key); - execution.setVariable(varName, varValue); - } - } - - private void loadFromDB(DelegateExecution execution, ProcessEngineConfigurationImpl processEngineConfiguration) { - Command> command = commandContext -> (List) commandContext.getDbSqlSession() - .selectList("mso.urnMapping.selectAll", null); - - CustomMyBatisSessionFactory sessionFactory = new CustomMyBatisSessionFactory(); - sessionFactory.initFromProcessEngineConfiguration(processEngineConfiguration, - "customMyBatisConfiguration.xml"); - - List mappings = sessionFactory.getCommandExecutorTxRequired().execute(command); - - if (mappings != null && !mappings.isEmpty()) { - for (URNMapping mapping : mappings) { - String varName = URNMapping.createIdentifierFromURN(mapping.getName()); - String varValue = mapping.getValue(); - - LOGGER.debug("URN Mapping = '" + mapping.getName() - + "', setting variable '" + varName + "' to '" + varValue + "'"); - - execution.setVariable(varName, varValue); - } - } - } - } - - /** - * Sets the isDebugLogEnabled variable on process entry. - */ - public static class LoggingInitializerListener implements ExecutionListener { - private String event; - - public LoggingInitializerListener(String eventData) { - this.event = eventData; - } - - public String getEvent() { - return event; - } - - @Override - public void notify(DelegateExecution execution) throws Exception { - String processKey = execution.getProcessEngineServices().getRepositoryService() - .getProcessDefinition(execution.getProcessDefinitionId()).getKey(); - - // If a "true" value is already injected, e.g. from a top-level flow, it SHOULD NOT be - // overridden by the value in the URN mapping. This allows a top-level flow and all - // invoked subflows to be debugged by turning on the debug flag for just the top-level - // flow, assuming the isDebugEnabled flag variable is passed from the top-level flow to - // its subflows. - - // If a "false" value is already injected, e.g. from a top-level flow, it SHOULD be - // overridden by the value in the URN mapping. This allows a subflow to be debugged - // without turning on the the debug flag for the top-level flow. - - String injectedValue = (String) execution.getVariable("isDebugLogEnabled"); - String urnValue = "true".equals(execution.getVariable("URN_log_debug_" + processKey)) ? "true" : "false"; - - if ("true".equals(injectedValue)) { - LOGGER.debug("Setting isDebugLogEnabled to \"" + injectedValue + "\" for process: " + processKey + " (injected value)"); - execution.setVariable("isDebugLogEnabled", injectedValue); - } else { - LOGGER.debug("Setting isDebugLogEnabled to \"" + urnValue + "\" for process: " + processKey + " (from URN mapping)"); - execution.setVariable("isDebugLogEnabled", urnValue); - } - } - } - - /** - * Logs details about the current activity. - */ - public static class LoggingExecutionListener implements ExecutionListener { - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - private static ConcurrentHashMap startTimes = new ConcurrentHashMap<>(); - - private String event; - - public LoggingExecutionListener(String event) { - this.event = event; - } - - public String getEvent() { - return event; - } - - public void notify(DelegateExecution execution) throws Exception { - BPMNLogger.debug( - (String) execution.getVariable("isDebugLogEnabled"), - "Logging for activity---------------:" + event + ":" - + execution.getCurrentActivityName() - + ", processDefinitionId=" - + execution.getProcessDefinitionId() + ", activtyId=" - + execution.getCurrentActivityId() + ", activtyName='" - + execution.getCurrentActivityName() + "'" - + ", processInstanceId=" - + execution.getProcessInstanceId() + ", businessKey=" - + execution.getProcessBusinessKey() + ", executionId=" - + execution.getId()); - - if (!isBlank(execution.getCurrentActivityName())) { - try { - String id = execution.getId(); - if ("START".equals(event) && id != null ) { - startTimes.put(id, System.currentTimeMillis()); - } else if ("END".equals(event) && id != null) { - String prefix = (String) execution.getVariable("prefix"); - - if (prefix != null ) { - MsoLogger.setServiceName("MSO." + prefix.substring(0,prefix.length()-1)); - } - - String requestId = (String) execution.getVariable("mso-request-id"); - String svcid = (String) execution.getVariable("mso-service-instance-id"); - MsoLogger.setLogContext(requestId, svcid); - long startTime = startTimes.remove(id); - - if (startTime != 0) { - - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - event + ": " + execution.getCurrentActivityName(), "BPMN", execution.getCurrentActivityName(), null); - - } - } - } catch(Exception e) { - LOGGER.debug("Exception at notify: " + e); - } - } - } - - private boolean isBlank(Object object) { - return object == null || "".equals(object.toString().trim()); - } - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/WorkflowExceptionPlugin.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/WorkflowExceptionPlugin.java deleted file mode 100644 index d25dcb6f3c..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/WorkflowExceptionPlugin.java +++ /dev/null @@ -1,170 +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.bpmn.core.plugins; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.ExecutionListener; -import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.camunda.bpm.engine.impl.bpmn.behavior.ClassDelegateActivityBehavior; -import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener; -import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener; -import org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration; -import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin; -import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; -import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity; -import org.camunda.bpm.engine.impl.pvm.PvmTransition; -import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl; -import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl; -import org.camunda.bpm.engine.impl.util.xml.Element; - -import org.openecomp.mso.bpmn.core.BPMNLogger; -import org.openecomp.mso.bpmn.core.WorkflowException; - -/** - * This plugin does the following: - *

    - *
  1. - * Adds logic at the start of every Call Activity to remove any existing - * WorkflowException object from the execution (saving a copy of it in a - * different variable). - *
  2. - *
  3. - * Adds logic at the end of every Call Activity to generate a MSOWorkflowException - * event if there is a WorkflowException object in the execution. - *
  4. - *
- */ -public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { - - @Override - public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) { - List preParseListeners = - processEngineConfiguration.getCustomPreBPMNParseListeners(); - - if (preParseListeners == null) { - preParseListeners = new ArrayList<>(); - processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners); - } - - preParseListeners.add(new WorkflowExceptionParseListener()); - } - - public static class WorkflowExceptionParseListener extends AbstractBpmnParseListener { - @Override - public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) { - AtomicInteger triggerTaskIndex = new AtomicInteger(1); - List activities = new ArrayList<>(processDefinition.getActivities()); - recurse(activities, triggerTaskIndex); - } - - /** - * Helper method that recurses (into subprocesses) over all the listed activities. - * @param activities a list of workflow activities - * @param triggerTaskIndex the index of the next trigger task (mutable) - */ - private void recurse(List activities, AtomicInteger triggerTaskIndex) { - for (ActivityImpl activity : activities) { - String type = (String) activity.getProperty("type"); - - if ("callActivity".equals(type)) { - // Add a WorkflowExceptionResetListener to clear the WorkflowException - // variable when each Call Activity starts. - - activity.addListener( - ExecutionListener.EVENTNAME_START, - new WorkflowExceptionResetListener()); - - // Add a WorkflowExceptionTriggerTask after the call activity. - // It must be a task because a listener cannot be used to generate - // an event. Throwing BpmnError from an execution listener will - // cause the process to die. - - List outTransitions = - new ArrayList<>(activity.getOutgoingTransitions()); - - for (PvmTransition transition : outTransitions) { - String triggerTaskId = "WorkflowExceptionTriggerTask_" + triggerTaskIndex; - - ActivityImpl triggerTask = activity.getFlowScope().createActivity(triggerTaskId); - - ClassDelegateActivityBehavior behavior = new ClassDelegateActivityBehavior( - WorkflowExceptionTriggerTask.class.getName(), - new ArrayList<>(0)); - - triggerTask.setActivityBehavior(behavior); - triggerTask.setName("Workflow Exception Trigger Task " + triggerTaskIndex); - triggerTaskIndex.getAndIncrement(); - - TransitionImpl transitionImpl = (TransitionImpl) transition; - TransitionImpl triggerTaskOutTransition = triggerTask.createOutgoingTransition(); - triggerTaskOutTransition.setDestination((ActivityImpl)transitionImpl.getDestination()); - transitionImpl.setDestination(triggerTask); - } - } else if ("subProcess".equals(type)) { - recurse(new ArrayList<>(activity.getActivities()), triggerTaskIndex); - } - } - } - } - - /** - * If there is a WorkflowException object in the execution, this method - * removes it (saving a copy of it in a different variable). - */ - public static class WorkflowExceptionResetListener implements ExecutionListener { - public void notify(DelegateExecution execution) throws Exception { - Object workflowException = execution.getVariable("WorkflowException"); - - if (workflowException instanceof WorkflowException) { - int index = 1; - String saveName = "SavedWorkflowException" + index; - while (execution.getVariable(saveName) != null) { - saveName = "SavedWorkflowException" + (++index); - } - - BPMNLogger.debug((String)execution.getVariable("isDebugLogEnabled"), - "WorkflowExceptionResetTask is moving WorkflowException to " + saveName); - - execution.setVariable(saveName, workflowException); - execution.setVariable("WorkflowException", null); - } - } - } - - /** - * Generates an MSOWorkflowException event if there is a WorkflowException - * object in the execution. - */ - public static class WorkflowExceptionTriggerTask implements JavaDelegate { - public void execute(DelegateExecution execution) throws Exception { - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - BPMNLogger.debug((String)execution.getVariable("isDebugLogEnabled"), - "WorkflowExceptionTriggerTask is generating a MSOWorkflowException event"); - throw new BpmnError("MSOWorkflowException"); - } - } - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java deleted file mode 100644 index 1fc43baef8..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java +++ /dev/null @@ -1,374 +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.bpmn.core.xml; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.StringReader; -import java.io.StringWriter; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import org.openecomp.mso.logger.MsoLogger; -import org.w3c.dom.Document; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -/** - * XML transformation methods and other useful functions. - */ -public final class XmlTool { - - private static final Map ENTITIES = new HashMap<>(); - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.BPEL); - static { - ENTITIES.put("amp", 38); - ENTITIES.put("quot", 34); - ENTITIES.put("lt", 60); - ENTITIES.put("gt", 62); - } - - /** - * Instantiation is not allowed. - */ - private XmlTool() { - } - - /** - * Normalizes and formats XML. This method consolidates and moves all namespace - * declarations to the root element. The result will not have an XML prolog or - * a trailing newline. - * @param xml the XML to normalize - * @throws IOException - * @throws TransformerException - * @throws ParserConfigurationException - * @throws SAXException - * @throws XPathExpressionException - */ - public static String normalize(Object xml) throws IOException, TransformerException, - ParserConfigurationException, SAXException, XPathExpressionException { - - if (xml == null) { - return null; - } - - Source xsltSource = new StreamSource(new StringReader( - readResourceFile("normalize-namespaces.xsl"))); - - DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); - dbFactory.setNamespaceAware(true); - DocumentBuilder db = dbFactory.newDocumentBuilder(); - InputSource source = new InputSource(new StringReader(String.valueOf(xml))); - Document doc = db.parse(source); - - // Start of code to remove whitespace outside of tags - XPath xPath = XPathFactory.newInstance().newXPath(); - NodeList nodeList = (NodeList) xPath.evaluate( - "//text()[normalize-space()='']", doc, XPathConstants.NODESET); - - for (int i = 0; i < nodeList.getLength(); ++i) { - Node node = nodeList.item(i); - node.getParentNode().removeChild(node); - } - // End of code to remove whitespace outside of tags - - // the factory pattern supports different XSLT processors - TransformerFactory transformerFactory = TransformerFactory.newInstance(); - Transformer transformer = transformerFactory.newTransformer(xsltSource); - - transformer.setOutputProperty(OutputKeys.INDENT, "yes"); - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); - transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); - transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); - - StringWriter writer = new StringWriter(); - transformer.transform(new DOMSource(doc), new StreamResult(writer)); - return writer.toString().trim(); - } - - /** - * Encodes a value so it can be used inside an XML text element. - * @param value the string to encode - * @return the encoded string - */ - public static String encode(Object value) { - if (value == null) { - return null; - } - - String s = String.valueOf(value); - StringBuilder out = new StringBuilder(); - boolean modified = false; - - for (int i = 0; i < s.length(); i++) { - char c = s.charAt(i); - - if (c == '<') { - out.append("<"); - modified = true; - } else if (c == '>') { - out.append(">"); - modified = true; - } else if (c == '&') { - out.append("&"); - modified = true; - } else if (c < 32 || c > 126) { - out.append("&#").append((int) c).append(";"); - modified = true; - } else { - out.append(c); - } - } - - if (modified) { - return out.toString(); - } else { - return s; - } - } - - /** - * Encodes a value so it can be used inside an XML attribute. - * @param value the string to encode - * @return the encoded string - */ - public static String encodeAttr(Object value) { - if (value == null) { - return null; - } - - String s = String.valueOf(value); - StringBuilder out = new StringBuilder(); - boolean modified = false; - - for (int i = 0; i < s.length(); i++) { - char c = s.charAt(i); - - if (c == '<') { - out.append("<"); - modified = true; - } else if (c == '>') { - out.append(">"); - modified = true; - } else if (c == '"') { - out.append("""); - modified = true; - } else if (c == '&') { - out.append("&"); - modified = true; - } else if (c < 32 || c > 126) { - out.append("&#").append((int) c).append(";"); - modified = true; - } else { - out.append(c); - } - } - - if (modified) { - return out.toString(); - } else { - return s; - } - } - - /** - * Decodes XML entities in a string value - * @param value a value with embedded XML entities - * @return the decoded string - */ - public static String decode(Object value) { - if (value == null) { - return null; - } - - String s = String.valueOf(value); - - StringBuilder out = new StringBuilder(s.length()); - int ampIndex = s.indexOf("&"); - int lastEnd = 0; - - while (ampIndex >= 0) { - int nextAmpIndex = s.indexOf("&", ampIndex + 1); - int nextSemiIndex = s.indexOf(";", ampIndex + 1); - if (nextSemiIndex != -1 && (nextAmpIndex == -1 || nextSemiIndex < nextAmpIndex)) { - int code = -1; - String entity = s.substring(ampIndex + 1, nextSemiIndex); - - try { - if (entity.startsWith("#")) { - code = Integer.parseInt(entity.substring(1), 10); - } else { - if (ENTITIES.containsKey(entity)) { - code = ENTITIES.get(entity); - } - } - } catch (NumberFormatException x) { - // Do nothing - } - - out.append(s.substring(lastEnd, ampIndex)); - lastEnd = nextSemiIndex + 1; - if (code >= 0 && code <= 0xffff) { - out.append((char) code); - } else { - out.append("&"); - out.append(entity); - out.append(";"); - } - } - - ampIndex = nextAmpIndex; - } - - out.append(s.substring(lastEnd)); - return out.toString(); - } - - /** - * Removes the preamble, if present, from an XML document. - * @param xml the XML document - * @return a possibly modified document - */ - public static String removePreamble(Object xml) { - if (xml == null) { - return null; - } - - return String.valueOf(xml).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", ""); - } - - /** - * Removes namespaces and namespace declarations from an XML document. - * @param xml the XML document - * @return a possibly modified document - */ - public static String removeNamespaces(Object xml) { - if (xml == null) { - LOGGER.debug("removeNamespaces input object is null , returning null"); - return null; - } - - String text = String.valueOf(xml); - - // remove xmlns declaration - text = text.replaceAll("xmlns.*?(\"|\').*?(\"|\')", ""); - // remove opening tag prefix - text = text.replaceAll("(<)(\\w+:)(.*?>)", "$1$3"); - // remove closing tags prefix - text = text.replaceAll("()", "$1$3"); - // remove extra spaces left when xmlns declarations are removed - text = text.replaceAll("\\s+>", ">"); - - return text; - } - - - /** - * Reads the specified resource file and return the contents as a string. - * @param file Name of the resource file - * @return the contents of the resource file as a String - * @throws IOException if there is a problem reading the file - */ - private static String readResourceFile(String file) throws IOException { - - try (InputStream stream = XmlTool.class.getClassLoader().getResourceAsStream(file); - Reader reader = new InputStreamReader(stream, "UTF-8")) { - - StringBuilder out = new StringBuilder(); - char[] buf = new char[1024]; - int n; - - while ((n = reader.read(buf)) >= 0) { - out.append(buf, 0, n); - } - return out.toString(); - } catch (Exception e) { - LOGGER.debug("Exception at readResourceFile stream: " + e); - return null; - } - } - - /** - * Parses the XML document String for the first occurrence of the specified element tag. - * If found, the value associated with that element tag is replaced with the new value - * and a String containing the modified XML document is returned. If the XML passed is - * null or the element tag is not found in the document, null will be returned. - * @param xml String containing the original XML document. - * @param elementTag String containing the tag of the element to be modified. - * @param newValue String containing the new value to be used to modify the corresponding element. - * @return the contents of the modified XML document as a String or null/empty if the modification failed. - * @throws IOException, TransformerException, ParserConfigurationException, SAXException - */ - public static Optional modifyElement(String xml, String elementTag, String newValue) throws IOException, TransformerException, - ParserConfigurationException, SAXException { - - if (xml == null || xml.isEmpty()) { - // no XML content to be modified, return empty - return Optional.empty(); - } - - DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); - dbFactory.setNamespaceAware(true); - DocumentBuilder db = dbFactory.newDocumentBuilder(); - InputSource source = new InputSource(new StringReader(xml)); - Document doc = db.parse(source); - - Node modNode = doc.getElementsByTagName(elementTag).item(0); - if (modNode == null) { - // did not find the specified element to be modified, return empty - //System.out.println("Did not find element tag " + elementTag + " in XML"); - return Optional.empty(); - } else { - modNode.setTextContent(newValue); - } - - TransformerFactory transformerFactory = TransformerFactory.newInstance(); - Transformer transformer = transformerFactory.newTransformer(); - StringWriter writer = new StringWriter(); - transformer.transform(new DOMSource(doc), new StreamResult(writer)); - // return the modified String representation of the XML - return Optional.of(writer.toString().trim()); - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/resources/customMyBatisConfiguration.xml b/bpmn/MSOCoreBPMN/src/main/resources/customMyBatisConfiguration.xml deleted file mode 100644 index 2c3d5dad0a..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/resources/customMyBatisConfiguration.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - diff --git a/bpmn/MSOCoreBPMN/src/main/resources/urnMapping.xml b/bpmn/MSOCoreBPMN/src/main/resources/urnMapping.xml deleted file mode 100644 index 274c859dd9..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/resources/urnMapping.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BadInjectedFiledExceptionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BadInjectedFiledExceptionTest.java new file mode 100644 index 0000000000..b35e65485f --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BadInjectedFiledExceptionTest.java @@ -0,0 +1,46 @@ +/* +* ============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.bpmn.core; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; + +public class BadInjectedFiledExceptionTest { + + private BadInjectedFieldException badInjectedFieldException; + + @Test + public void test() { + String fieldName = "anyFieldName"; + String taskName = "anyTask"; + Object info = new String("info"); + + String expectedMessage1 = taskName+" injected field '"+fieldName+"' is bad: "+(String)info; + badInjectedFieldException = new BadInjectedFieldException(fieldName, taskName, info); + assertEquals(expectedMessage1, badInjectedFieldException.getMessage()); + + String expectedMessage2 = "java.lang.Throwable: anyCause"; + Throwable cause = new Throwable("anyCause"); + badInjectedFieldException = new BadInjectedFieldException(fieldName, taskName, info, cause); + assertEquals(expectedMessage2, badInjectedFieldException.getCause().toString()); + + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java new file mode 100644 index 0000000000..40fcb982c1 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java @@ -0,0 +1,247 @@ +/* +* ============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.bpmn.core; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.Expression; +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import org.junit.rules.ExpectedException; + +public class BaseTaskTest { + + private String prefix = "PRE_"; + private String processKey = "AnyProcessKey"; + private String definitionId = "100"; + private String anyVariable = "anyVariable"; + private String anyValueString = "anyValue"; + private String badValueString = "123abc"; + private int anyValueInt = 123; + private Integer anyValueInteger = new Integer(anyValueInt); + private long anyValuelong = 123L; + private Long anyValueLong = new Long(anyValuelong); + + private DelegateExecution mockExecution; + private Expression mockExpression; + private BaseTask baseTask; + private Object obj1; + private Object obj2; + private Object objectString; + private Object objectInteger; + private Object objectLong; + private Object objectBoolean; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Before + public void before() throws Exception { + baseTask = new BaseTask(); + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class); + when(mockProcessDefinition.getKey()).thenReturn(processKey); + RepositoryService mockRepositoryService = mock(RepositoryService.class); + when(mockRepositoryService.getProcessDefinition(definitionId)).thenReturn(mockProcessDefinition); + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class); + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService); + mockExecution = mock(DelegateExecution.class); + when(mockExecution.getId()).thenReturn(definitionId); + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices); + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition); + when(mockExecution.getVariable("prefix")).thenReturn(prefix); + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true"); + mockExpression = mock(Expression.class); + } + + @Test + public void testExecution() throws Exception{ + baseTask.execute(mockExecution); + assertEquals("BaseTask", baseTask.getTaskName()); + } + + @Test + public void testGetFieldAndMissingInjectedException() throws Exception{ + objectString = new String(anyValueString); + when(mockExpression.getValue(mockExecution)).thenReturn(objectString); + obj1 = baseTask.getField(mockExpression, mockExecution, anyVariable); + assertEquals(anyValueString, obj1.toString()); + + expectedException.expect(MissingInjectedFieldException.class); + obj2 = baseTask.getField(null, mockExecution, anyVariable); + } + + @Test + public void testGetFieldAndBadInjectedFieldException() throws Exception{ + expectedException.expect(BadInjectedFieldException.class); + obj1 = baseTask.getField(mockExpression, mockExecution, null); + } + + @Test + public void testGetOptionalField() throws Exception{ + objectString = new String(anyValueString); + when(mockExpression.getValue(mockExecution)).thenReturn(objectString); + obj1 = baseTask.getOptionalField(mockExpression, mockExecution, anyVariable); + assertEquals(anyValueString, obj1.toString()); + } + + @Test + public void testGetStringFieldAndMissingInjectedFieldException() throws Exception{ + objectString = new String(anyValueString); + when(mockExpression.getValue(mockExecution)).thenReturn(objectString); + obj1 = baseTask.getStringField(mockExpression, mockExecution, anyVariable); + assertEquals(anyValueString, obj1.toString()); + + expectedException.expect(MissingInjectedFieldException.class); + Object objectBoolean = new Boolean(true); // bad data + when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean); + obj2 = baseTask.getStringField(null, mockExecution, anyVariable); + } + + @Test + public void testGetStringFieldAndBadInjectedFieldException() throws Exception{ + expectedException.expect(BadInjectedFieldException.class); + obj1 = baseTask.getStringField(mockExpression, mockExecution, null); + } + + @Test + public void testGetOptionalStringField() throws Exception{ + objectString = new String(anyValueString); + when(mockExpression.getValue(mockExecution)).thenReturn(objectString); + obj1 = baseTask.getOptionalStringField(mockExpression, mockExecution, anyVariable); + assertEquals(anyValueString, obj1.toString()); + } + + @Test + public void testGetIntegerFieldAndMissingInjectedFieldException() throws Exception{ + objectInteger = new Integer(anyValueInt); + when(mockExpression.getValue(mockExecution)).thenReturn(objectInteger); + obj1 = baseTask.getIntegerField(mockExpression, mockExecution, anyVariable); + assertEquals(anyValueInteger, (Integer)obj1); + + expectedException.expect(MissingInjectedFieldException.class); + objectString = new String(badValueString); + when(mockExpression.getValue(mockExecution)).thenReturn(objectString); + obj2 = baseTask.getIntegerField(null, mockExecution, anyVariable); + } + + @Test + public void testGetIntegerFieldAndBadInjectedFieldException() throws Exception{ + expectedException.expect(BadInjectedFieldException.class); + obj1 = baseTask.getIntegerField(mockExpression, mockExecution, null); + } + + + @Test + public void testGetOptionalIntegerField() throws Exception{ + objectInteger = new Integer(anyValueInt); + when(mockExpression.getValue(mockExecution)).thenReturn(objectInteger); + obj1 = baseTask.getOptionalIntegerField(mockExpression, mockExecution, anyVariable); + assertEquals(anyValueInteger, (Integer)obj1); + } + + @Test + public void testGetOptionalIntegerFieldAndBadInjectedFieldException() throws Exception{ + expectedException.expect(BadInjectedFieldException.class); + objectBoolean = new Boolean(true); + when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean); + obj1 = baseTask.getOptionalIntegerField(mockExpression, mockExecution, anyVariable); + } + + @Test + public void testGetLongFieldAndMissingInjectedFieldException() throws Exception{ + objectLong = new Long(anyValuelong); + when(mockExpression.getValue(mockExecution)).thenReturn(objectLong); + obj1 = baseTask.getLongField(mockExpression, mockExecution, anyVariable); + assertEquals(anyValueLong, (Long)obj1); + + expectedException.expect(MissingInjectedFieldException.class); + objectString = new String(badValueString); + when(mockExpression.getValue(mockExecution)).thenReturn(objectString); + obj2 = baseTask.getLongField(null, mockExecution, anyVariable); + } + + @Test + public void testGetLongFieldAndBadInjectedFieldException() throws Exception{ + expectedException.expect(BadInjectedFieldException.class); + obj2 = baseTask.getLongField(mockExpression, mockExecution, null); + } + + @Test + public void testGetOptionalLongField() throws Exception{ + objectLong = new Long(anyValuelong); + when(mockExpression.getValue(mockExecution)).thenReturn(objectLong); + obj1 = baseTask.getOptionalLongField(mockExpression, mockExecution, anyVariable); + assertEquals(anyValueLong, (Long)obj1); + } + + @Test + public void testGetOptionalLongFieldAndBadInjectedFieldException() throws Exception{ + expectedException.expect(BadInjectedFieldException.class); + objectBoolean = new Boolean(true); + when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean); + obj1 = baseTask.getOptionalLongField(mockExpression, mockExecution, anyVariable); + } + + @Test + public void testGetOutputAndMissingInjectedFieldException() throws Exception{ + objectString = new String(anyValueString); + when(mockExpression.getValue(mockExecution)).thenReturn(objectString); + obj1 = baseTask.getOutputField(mockExpression, mockExecution, anyVariable); + assertEquals(anyValueString, obj1.toString()); + + expectedException.expect(MissingInjectedFieldException.class); + objectString = new String(anyValueString); + when(mockExpression.getValue(mockExecution)).thenReturn(objectString); + obj2 = baseTask.getOutputField(null, mockExecution, anyVariable); + } + + @Test + public void testGetOutputAndBadInjectedFieldException() throws Exception{ + expectedException.expect(BadInjectedFieldException.class); + obj2 = baseTask.getOutputField(null, mockExecution, anyVariable); + } + + @Test + public void testGetOptionalOutputField() throws Exception{ + objectString = new String(anyValueString); + when(mockExpression.getValue(mockExecution)).thenReturn(objectString); + obj1 = baseTask.getOptionalOutputField(mockExpression, mockExecution, anyVariable); + assertEquals(anyValueString, obj1.toString()); + } + + @Test + public void testGetOptionalOutputFieldAndBadInjectedFieldException() throws Exception{ + expectedException.expect(BadInjectedFieldException.class); + objectBoolean = new Boolean(true); + when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean); + obj1 = baseTask.getOptionalOutputField(mockExpression, mockExecution, anyVariable); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BeansTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BeansTest.java new file mode 100644 index 0000000000..2415e619d7 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BeansTest.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core; + +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.onap.so.openpojo.rules.HasAnnotationMatcher.hasAnnotation; +import static org.onap.so.openpojo.rules.HasAnnotationPropertyWithValueMatcher.hasAnnotationPropertyWithValue; + +import javax.persistence.Column; +import javax.persistence.Temporal; + +import org.junit.Test; +import org.onap.so.openpojo.rules.CustomSetterMustExistRule; +import org.onap.so.openpojo.rules.EqualsAndHashCodeTester; +import org.onap.so.openpojo.rules.HasEqualsAndHashCodeRule; +import org.onap.so.openpojo.rules.HasToStringRule; +import org.onap.so.openpojo.rules.ToStringTester; + +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 com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.BusinessKeyMustExistRule; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.rule.impl.NoNestedClassRule; +import com.openpojo.validation.rule.impl.NoPrimitivesRule; +import com.openpojo.validation.rule.impl.NoPublicFieldsExceptStaticFinalRule; +import com.openpojo.validation.rule.impl.NoStaticExceptFinalRule; +import com.openpojo.validation.rule.impl.SerializableMustHaveSerialVersionUIDRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + + +public class BeansTest { + + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + private PojoClassFilter enumFilter = new FilterEnum(); + + + + @Test + public void pojoStructure() { + test("org.onap.so.bpmn.core.domain"); + + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create() + .with(new GetterMustExistRule()) + .with(new NoNestedClassRule()) + .with(new SerializableMustHaveSerialVersionUIDRule()) + .with(new NoPublicFieldsExceptStaticFinalRule()) + .with(new SetterTester()) + .with(new GetterTester()) + + + + .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/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/MissingInjectedFiledExceptionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/MissingInjectedFiledExceptionTest.java new file mode 100644 index 0000000000..b0aa41b05d --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/MissingInjectedFiledExceptionTest.java @@ -0,0 +1,39 @@ +/* +* ============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.bpmn.core; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; + +public class MissingInjectedFiledExceptionTest { + + private MissingInjectedFieldException missingInjectedFieldException; + + @Test + public void test() { + String fieldName = "anyFieldName"; + String taskName = "anyTask"; + String info = "missing required field"; + String expectedMessage1 = taskName+" injected field '"+fieldName+"' is bad: "+info; + missingInjectedFieldException = new MissingInjectedFieldException(fieldName, taskName); + assertEquals(expectedMessage1, missingInjectedFieldException.getMessage()); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/ResponseBuilderTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/ResponseBuilderTest.java new file mode 100644 index 0000000000..b605209739 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/ResponseBuilderTest.java @@ -0,0 +1,110 @@ +/* +* ============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.bpmn.core; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.junit.Before; +import org.junit.Test; + +public class ResponseBuilderTest { + + private String prefix = "PRE_"; + private String processKey = "AnyProcessKey"; + private String definitionId = "100"; + private int errorCode_200 = 200; + private int errorCode_404 = 404; + private String errorMessage = "any error message!"; + private String errorMessageXML = "any error message!200"; + private String response = "bad"; + + private DelegateExecution mockExecution; + private ResponseBuilder responseBuilder; + private WorkflowException workflowException; + private Object obj; + + @Before + public void before() throws Exception { + responseBuilder = new ResponseBuilder(); + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class); + when(mockProcessDefinition.getKey()).thenReturn(processKey); + RepositoryService mockRepositoryService = mock(RepositoryService.class); + when(mockRepositoryService.getProcessDefinition(definitionId)).thenReturn(mockProcessDefinition); + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class); + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService); + mockExecution = mock(DelegateExecution.class); + when(mockExecution.getId()).thenReturn(definitionId); + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices); + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition); + when(mockExecution.getVariable("prefix")).thenReturn(prefix); + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true"); + } + + @Test + public void buildWorkflowException_WorkflowException_2000_Test() { + when(mockExecution.getVariable(prefix+"ErrorResponse")).thenReturn(errorMessage); + when(mockExecution.getVariable(prefix+"ResponseCode")).thenReturn(errorCode_200); + workflowException = responseBuilder.buildWorkflowException(mockExecution); + assertEquals(2000, workflowException.getErrorCode()); + assertEquals("any error message!", workflowException.getErrorMessage()); + } + + @Test + public void buildWorkflowException_WorkflowException_XML_2000_Test() { + when(mockExecution.getVariable(prefix+"ErrorResponse")).thenReturn(errorMessageXML); + when(mockExecution.getVariable(prefix+"ResponseCode")).thenReturn(errorCode_200); + workflowException = responseBuilder.buildWorkflowException(mockExecution); + assertEquals(2000, workflowException.getErrorCode()); + assertEquals("any error message!", workflowException.getErrorMessage()); + } + + @Test + public void buildWorkflowException_WorkflowException_NULL_Test() { + when(mockExecution.getVariable(prefix+"ErrorResponse")).thenReturn(null); + when(mockExecution.getVariable(prefix+"ResponseCode")).thenReturn(null); + workflowException = responseBuilder.buildWorkflowException(mockExecution); + assertEquals(null, workflowException); + } + + @Test + public void buildWorkflowException_Response_1002_Test() { + when(mockExecution.getVariable(processKey+"Response")).thenReturn(response); + when(mockExecution.getVariable(prefix+"ResponseCode")).thenReturn(errorCode_404); + workflowException = responseBuilder.buildWorkflowException(mockExecution); + assertEquals(response, workflowException.getErrorMessage()); + assertEquals(1002, workflowException.getErrorCode()); + } + + @Test + public void buildWorkflowResponse_Object_Test() { + String workflowResponse = "good"; + when(mockExecution.getVariable("WorkflowResponse")).thenReturn(workflowResponse); + obj = responseBuilder.buildWorkflowResponse(mockExecution); + assertEquals(workflowResponse, obj); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/RollbackDataTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/RollbackDataTest.java new file mode 100644 index 0000000000..875df6cf94 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/RollbackDataTest.java @@ -0,0 +1,92 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.hamcrest.Matchers.isIn; +import java.util.Arrays; +import java.util.Collections; + +import org.junit.Test; + +public class RollbackDataTest { + + private final static String TYPE_A = "typeA"; + private final static String TYPE_B = "typeB"; + private static final String KEY_1 = "key1"; + private static final String VALUE_1 = "value1"; + private static final String VALUE_2 = "value2"; + + @Test + public void shouldReturnStringRepresentationOfDataInAnyPermutation() throws Exception { + // given + RollbackData data = new RollbackData(); + data.put(TYPE_A, KEY_1, VALUE_1); + data.put(TYPE_A, "key2", "value2"); + data.put(TYPE_B, "key3", "value3"); + // when, then + assertThat(data.toString(), isIn(Arrays.asList( + "[typeB{key3=value3},typeA{key1=value1, key2=value2}]", + "[typeB{key3=value3},typeA{key2=value2, key1=value1}]", + "[typeA{key1=value1, key2=value2},typeB{key3=value3}]", + "[typeA{key2=value2, key1=value1},typeB{key3=value3}]"))); + } + + @Test + public void shouldBeEmptyOnCreation() throws Exception { + // given + RollbackData data = new RollbackData(); + // then + assertFalse(data.hasType(TYPE_A)); + assertNull(data.get(TYPE_A, KEY_1)); + } + + @Test + public void shouldHaveTypeAfterPuttingDataOfThatType() throws Exception { + // given + RollbackData data = new RollbackData(); + // when + data.put(TYPE_A, KEY_1, VALUE_1); + // then + assertTrue(data.hasType(TYPE_A)); + assertFalse(data.hasType(TYPE_B)); + assertEquals(VALUE_1, data.get(TYPE_A, KEY_1)); + } + + @Test + public void shouldKeepTwoValuesWithSameKeysButDifferentTypes() throws Exception { + // given + RollbackData data = new RollbackData(); + // when + data.put(TYPE_A, KEY_1, VALUE_1); + data.put(TYPE_B, KEY_1, VALUE_2); + // then + assertEquals(VALUE_1, data.get(TYPE_A, KEY_1)); + assertThat(data.get(TYPE_A), is(Collections.singletonMap(KEY_1, VALUE_1))); + assertEquals(VALUE_2, data.get(TYPE_B, KEY_1)); + assertThat(data.get(TYPE_B), is(Collections.singletonMap(KEY_1, VALUE_2))); + } +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/UrnPropertiesReaderTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/UrnPropertiesReaderTest.java new file mode 100644 index 0000000000..5d9a1d61f2 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/UrnPropertiesReaderTest.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.bpmn.core; + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; +import org.junit.Assert; +import org.junit.Test; +import org.springframework.core.env.Environment; + +import static org.mockito.Mockito.*; + +public class UrnPropertiesReaderTest { + + @Test + public void testGetVariableFromExecution() { + ExecutionEntity mockExecution = mock(ExecutionEntity.class); + when(mockExecution.getVariable("testKey")).thenReturn("testValue"); + String value = UrnPropertiesReader.getVariable("testKey",mockExecution); + Assert.assertEquals("testValue", value); + verify(mockExecution).getVariable("testKey"); + verify(mockExecution, never()).setVariable("testKey", value); + } + + @Test + public void testGetVariableFromEnvironment() { + ExecutionEntity mockExecution = mock(ExecutionEntity.class); + Environment mockEnvironment = mock(Environment.class); + when(mockEnvironment.getProperty("testKey")).thenReturn("testValue"); + UrnPropertiesReader urnPropertiesReader = new UrnPropertiesReader(); + urnPropertiesReader.setEnvironment(mockEnvironment); + String value = UrnPropertiesReader.getVariable("testKey",mockExecution); + Assert.assertEquals("testValue",value); + verify(mockExecution).getVariable("testKey"); + verify(mockExecution).setVariable("testKey", value); + } + + @Test + public void testGetVariableNotExist() { + ExecutionEntity mockExecution = mock(ExecutionEntity.class); + String value = UrnPropertiesReader.getVariable("notExist", mockExecution); + Assert.assertEquals(null, value); + verify(mockExecution).getVariable("notExist"); + verify(mockExecution, never()).setVariable("notExist", value); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/WorkflowExceptionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/WorkflowExceptionTest.java new file mode 100644 index 0000000000..c1e9b8776b --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/WorkflowExceptionTest.java @@ -0,0 +1,47 @@ +/* +* ============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.bpmn.core; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + +import org.junit.Test; + +public class WorkflowExceptionTest { + + private WorkflowException workflowException; + + @Test + public void test() { + String processKey = "AnyProcessKey"; + int errorCode = 200; + String errorMessage = "any error message!"; + workflowException = new WorkflowException(processKey, errorCode, errorMessage); + assertEquals(errorCode, workflowException.getErrorCode()); + assertEquals(errorMessage, workflowException.getErrorMessage()); + assertEquals(processKey, workflowException.getProcessKey()); + assertEquals("*", workflowException.getWorkStep()); + String workStep = "one"; + workflowException = new WorkflowException(processKey, errorCode, errorMessage, workStep); + assertEquals(workStep, workflowException.getWorkStep()); + assertNotEquals(null, workflowException.toString()); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/AllottedResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/AllottedResourceTest.java new file mode 100644 index 0000000000..b1dd8659cd --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/AllottedResourceTest.java @@ -0,0 +1,54 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class AllottedResourceTest { + private AllottedResource ar = new AllottedResource(); + + @Test + public void testAllottedResource() { + ar.setAllottedResourceType("allottedResourceType"); + ar.setAllottedResourceRole("allottedResourceRole"); + ar.setProvidingServiceModelName("providingServiceModelName"); + ar.setProvidingServiceModelInvariantUuid("providingServiceModelInvariantUuid"); + ar.setProvidingServiceModelUuid("providingServiceModelUuid"); + ar.setNfFunction("nfFunction"); + ar.setNfType("nfType"); + ar.setNfRole("nfRole"); + ar.setNfNamingCode("nfNamingCode"); + ar.setOrchestrationStatus("orchestrationStatus"); + assertEquals(ar.getAllottedResourceType(), "allottedResourceType"); + assertEquals(ar.getAllottedResourceRole(), "allottedResourceRole"); + assertEquals(ar.getProvidingServiceModelName(), "providingServiceModelName"); + assertEquals(ar.getProvidingServiceModelInvariantUuid(), "providingServiceModelInvariantUuid"); + assertEquals(ar.getProvidingServiceModelUuid(), "providingServiceModelUuid"); + assertEquals(ar.getNfFunction(), "nfFunction"); + assertEquals(ar.getNfType(), "nfType"); + assertEquals(ar.getNfRole(), "nfRole"); + assertEquals(ar.getNfNamingCode(), "nfNamingCode"); + assertEquals(ar.getOrchestrationStatus(), "orchestrationStatus"); + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/CompareModelsResultTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/CompareModelsResultTest.java new file mode 100644 index 0000000000..af9c7a7fa6 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/CompareModelsResultTest.java @@ -0,0 +1,83 @@ +/* +* ============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.bpmn.core.domain; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +public class CompareModelsResultTest { + + private CompareModelsResult modelsResult; + private List addedResourceList; + private List deletedResourceList; + private ResourceModelInfo resourceModelInfo1; + private ResourceModelInfo resourceModelInfo2; + private List requestInputs; + + @Before + public void before() { + resourceModelInfo1 = new ResourceModelInfo(); + resourceModelInfo1.setResourceCustomizationUuid("f1d563e8-e714-4393-8f99-cc480144a05e"); + resourceModelInfo1.setResourceInvariantUuid("e1d563e8-e714-4393-8f99-cc480144a05f"); + resourceModelInfo1.setResourceName("resourceName1"); + resourceModelInfo1.setResourceUuid("f1d563e8-e714-4393-8f99-cc480144a05g"); + resourceModelInfo2 = new ResourceModelInfo(); + resourceModelInfo2.setResourceCustomizationUuid("a1d563e8-e714-4393-8f99-cc480144a05d"); + resourceModelInfo2.setResourceInvariantUuid("b1d563e8-e714-4393-8f99-cc480144a05e"); + resourceModelInfo2.setResourceName("resourceName2"); + resourceModelInfo2.setResourceUuid("c1d563e8-e714-4393-8f99-cc480144a05f"); + } + + @Test + public void testSetAddedResourceList() { + addedResourceList = new ArrayList(); + addedResourceList.add(resourceModelInfo1); + addedResourceList.add(resourceModelInfo2); + modelsResult = new CompareModelsResult(); + modelsResult.setAddedResourceList(addedResourceList); + assertEquals(addedResourceList, modelsResult.getAddedResourceList()); + } + + @Test + public void testSetDeletedResourceList() { + deletedResourceList = new ArrayList(); + deletedResourceList.add(resourceModelInfo1); + deletedResourceList.add(resourceModelInfo2); + modelsResult = new CompareModelsResult(); + modelsResult.setDeletedResourceList(deletedResourceList); + assertEquals(deletedResourceList, modelsResult.getDeletedResourceList()); + } + + @Test + public void testSetRequestInputs() { + requestInputs = new ArrayList(); + requestInputs.add("requestInput1"); + requestInputs.add("requestInput2"); + modelsResult = new CompareModelsResult(); + modelsResult.setRequestInputs(requestInputs); + assertEquals(requestInputs, modelsResult.getRequestInputs()); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ConfigResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ConfigResourceTest.java new file mode 100644 index 0000000000..13a30d26ee --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ConfigResourceTest.java @@ -0,0 +1,39 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ConfigResourceTest { + private ConfigResource configresource = new ConfigResource();{ + configresource.resourceType = ResourceType.CONFIGURATION; + } + + @Test + public void testConfigResource() { + configresource.setToscaNodeType("toscaNodeType"); + assertEquals(configresource.getToscaNodeType(), "toscaNodeType"); + + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ConfigurationTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ConfigurationTest.java new file mode 100644 index 0000000000..fe84a1b5a7 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ConfigurationTest.java @@ -0,0 +1,47 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ConfigurationTest { + private Configuration configuration = new Configuration(); + + @Test + public void testConfigurationTest() { + configuration.setId("id"); + configuration.setName("name"); + configuration.setType("type"); + configuration.setOrchestrationStatus("orchestrationStatus"); + configuration.setTunnelBandwidth("tunnelBandwidth"); + configuration.setVendorAllowedMaxBandwidth("vendorAllowedMaxBandwidth"); + configuration.setResourceVersion("resourceVersion"); + assertEquals(configuration.getId(), "id"); + assertEquals(configuration.getName(), "name"); + assertEquals(configuration.getType(), "type"); + assertEquals(configuration.getOrchestrationStatus(), "orchestrationStatus"); + assertEquals(configuration.getTunnelBandwidth(), "tunnelBandwidth"); + assertEquals(configuration.getVendorAllowedMaxBandwidth(), "vendorAllowedMaxBandwidth"); + assertEquals(configuration.getResourceVersion(), "resourceVersion"); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/CustomerTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/CustomerTest.java new file mode 100644 index 0000000000..86eb717664 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/CustomerTest.java @@ -0,0 +1,38 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class CustomerTest { + private Customer customer = new Customer(); + + @Test + public void testCustomer() { + customer.setSubscriptionServiceType("subscriptionServiceType"); + customer.setGlobalSubscriberId("globalSubscriberId"); + assertEquals(customer.getSubscriptionServiceType(), "subscriptionServiceType"); + assertEquals(customer.getGlobalSubscriberId(), "globalSubscriberId"); + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/DomainPojoTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/DomainPojoTest.java new file mode 100644 index 0000000000..b4860c6323 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/DomainPojoTest.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.bpmn.core.domain; + +import org.junit.Test; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.PojoClassFilter; +import com.openpojo.reflection.filters.FilterNonConcrete; +import com.openpojo.reflection.filters.FilterPackageInfo; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + + +public class DomainPojoTest { + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + @Test + public void pojoStructure() { + test("org.onap.so.bpmn.core.domain"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create() + .with(new SetterTester()) + .with(new GetterTester()) + .build(); + validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, new FilterNonConcrete()); + } + + private static class FilterTestClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/HomingSolutionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/HomingSolutionTest.java new file mode 100644 index 0000000000..9750e03b4c --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/HomingSolutionTest.java @@ -0,0 +1,58 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class HomingSolutionTest { + + private HomingSolution homingsolution = new HomingSolution(); + InventoryType inventory = InventoryType.cloud; + VnfResource vnfresource = new VnfResource(); + License license = new License(); + + @Test + public void testHomingSolution() { + homingsolution.setInventoryType(inventory); + homingsolution.setRehome(true); + homingsolution.setServiceInstanceId("serviceInstanceId"); + homingsolution.setCloudOwner("cloudOwner"); + homingsolution.setCloudRegionId("cloudRegionId"); + homingsolution.setAicClli("aicClli"); + homingsolution.setAicVersion("aicVersion"); + homingsolution.setTenant("tenant"); + homingsolution.setVnf(vnfresource); + homingsolution.setLicense(license); + assertEquals(homingsolution.getInventoryType(), inventory); + assertEquals(homingsolution.isRehome(), true); + assertEquals(homingsolution.getServiceInstanceId(), "serviceInstanceId"); + assertEquals(homingsolution.getCloudOwner(), "cloudOwner"); + assertEquals(homingsolution.getCloudRegionId(), "cloudRegionId"); + assertEquals(homingsolution.getAicClli(), "aicClli"); + assertEquals(homingsolution.getAicVersion(), "aicVersion"); + assertEquals(homingsolution.getTenant(), "tenant"); + assertEquals(homingsolution.getVnf(), vnfresource); + assertEquals(homingsolution.getLicense(), license); + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/LicenseTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/LicenseTest.java new file mode 100644 index 0000000000..e3133cb1c6 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/LicenseTest.java @@ -0,0 +1,89 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.BDDMockito.Then; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + + +//@RunWith(PowerMockRunner.class) +//@PrepareForTest({License.class}) +public class LicenseTest { + + //@Mock + private License license= new License(); + //@InjectMocks + //private LicenseTest licenceTest; + List entitlementPoolList = new ArrayList(); + private List licenseKeyGroupList = new ArrayList(); + //JSONArray array = new JSONArray(entitlementPoolList); + //JSONArray array1 = new JSONArray(licenseKeyGroupList); + //@PrepareForTest({License.class}) + Long serialVersionUID = 333L; + + @Test + public void testLicense() { + license.setEntitlementPoolList(entitlementPoolList); + license.setLicenseKeyGroupList(licenseKeyGroupList); + //license.addEntitlementPool("entitlementPoolUuid"); + license.addLicenseKeyGroup("licenseKeyGroupUuid"); + assertEquals(license.getEntitlementPoolList(), entitlementPoolList); + assertEquals(license.getLicenseKeyGroupList(), licenseKeyGroupList); + assert(license.getEntitlementPoolListAsString()!= null); + assert(license.getLicenseKeyGroupListAsString()!=null); + license.addEntitlementPool("entitlementPoolUuid"); + //assertEquals(license.getSerialversionuid(), serialVersionUID); + //assertArrayEquals(license.getSerialversionuid(), serialVersionUID); + //assert + + /*PowerMockito.mockStatic(License.class); + Mockito.when(License.getSerialversionuid()).thenReturn(getserial()); + assertEquals(License.getSerialversionuid(),"abc");*/ + + } + // @Before + // public void mocksetUp() { +// Long serialVersionUID = 333L; +// PowerMockito.mockStatic(License.class); +// expect (license.getSerialversionuid()).andReturn(serialVersionUID); +// //PowerMockito.when(license.getSerialversionuid(). +// //PowerMockito.when(MathUtil.addInteger(2, 2)).thenReturn(1); +// } + + /*private Long getserial() { + + return abc; + }*/ + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ModelInfoTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ModelInfoTest.java new file mode 100644 index 0000000000..3d07f85c04 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ModelInfoTest.java @@ -0,0 +1,47 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ModelInfoTest { + private ModelInfo modelinfo = new ModelInfo(); + + @Test + public void testModelInfo() { + modelinfo.setModelName("modelName"); + modelinfo.setModelUuid("modelUuid"); + modelinfo.setModelInvariantUuid("modelInvariantUuid"); + modelinfo.setModelVersion("modelVersion"); + modelinfo.setModelCustomizationUuid("modelCustomizationUuid"); + modelinfo.setModelInstanceName("modelInstanceName"); + modelinfo.setModelType("modelType"); + assertEquals(modelinfo.getModelName(), "modelName"); + assertEquals(modelinfo.getModelUuid(), "modelUuid"); + assertEquals(modelinfo.getModelInvariantUuid(), "modelInvariantUuid"); + assertEquals(modelinfo.getModelVersion(), "modelVersion"); + assertEquals(modelinfo.getModelCustomizationUuid(), "modelCustomizationUuid"); + assertEquals(modelinfo.getModelInstanceName(), "modelInstanceName"); + assertEquals(modelinfo.getModelType(), "modelType"); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ModuleResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ModuleResourceTest.java new file mode 100644 index 0000000000..dcb62cfc40 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ModuleResourceTest.java @@ -0,0 +1,48 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ModuleResourceTest { + private ModuleResource moduleresource = new ModuleResource(); + + @Test + public void testModuleResource() { + + moduleresource.setVfModuleName("vfModuleName"); + moduleresource.setHeatStackId("heatStackId"); + moduleresource.setIsBase(true); + moduleresource.setVfModuleLabel("vfModuleLabel"); + moduleresource.setInitialCount(0); + moduleresource.setVfModuleType("vfModuleType"); + moduleresource.setHasVolumeGroup(true); + assertEquals(moduleresource.getVfModuleName(), "vfModuleName"); + assertEquals(moduleresource.getHeatStackId(), "heatStackId"); + assertEquals(moduleresource.getIsBase(), true); + assertEquals(moduleresource.getVfModuleLabel(), "vfModuleLabel"); + assertEquals(moduleresource.getInitialCount(), 0); + assertEquals(moduleresource.getVfModuleType(), "vfModuleType"); + assertEquals(moduleresource.isHasVolumeGroup(), true); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/NetworkResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/NetworkResourceTest.java new file mode 100644 index 0000000000..6ca9cef8d2 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/NetworkResourceTest.java @@ -0,0 +1,42 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class NetworkResourceTest { + private NetworkResource nr = new NetworkResource(); + + @Test + public void testNetworkResource() { + nr.setNetworkType("networkType"); + nr.setNetworkRole("networkRole"); + nr.setNetworkTechnology("networkTechnology"); + nr.setNetworkScope("networkScope"); + assertEquals(nr.getNetworkType(), "networkType"); + assertEquals(nr.getNetworkRole(), "networkRole"); + assertEquals(nr.getNetworkTechnology(), "networkTechnology"); + assertEquals(nr.getNetworkScope(), "networkScope"); + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/OwningEntityTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/OwningEntityTest.java new file mode 100644 index 0000000000..396d866446 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/OwningEntityTest.java @@ -0,0 +1,39 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ + +package org.onap.so.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class OwningEntityTest { + private OwningEntity oe = new OwningEntity(); + + @Test + public void testOwingEntity() { + oe.setOwningEntityId("owningEntityId"); + oe.setOwningEntityName("owningEntityName"); + assertEquals(oe.getOwningEntityId(), "owningEntityId"); + assertEquals(oe.getOwningEntityName(), "owningEntityName"); + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ProjectTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ProjectTest.java new file mode 100644 index 0000000000..9081f9dd14 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ProjectTest.java @@ -0,0 +1,36 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ProjectTest { + + private Project project = new Project(); + + @Test + public void testProject() { + project.setProjectName("projectName"); + assertEquals(project.getProjectName(), "projectName"); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/RequestTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/RequestTest.java new file mode 100644 index 0000000000..0c552ce19e --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/RequestTest.java @@ -0,0 +1,44 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class RequestTest { + + private Request request = new Request(); + ModelInfo model = new ModelInfo(); + + @Test + public void testRequest() { + request.setSdncRequestId("sdncRequestId"); + request.setRequestId("requestId"); + request.setModelInfo(model); + request.setProductFamilyId("productFamilyId"); + assertEquals(request.getSdncRequestId(), "sdncRequestId"); + assertEquals(request.getRequestId(), "requestId"); + assertEquals(request.getModelInfo(), model); + assertEquals(request.getProductFamilyId(), "productFamilyId"); + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ResourceDecompositionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ResourceDecompositionTest.java new file mode 100644 index 0000000000..573ffab4aa --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ResourceDecompositionTest.java @@ -0,0 +1,50 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ResourceDecompositionTest { + + private ResourceDecomposition rd = new ResourceDecomposition() { + private static final long serialVersionUID = 1L; + }; + ModelInfo model = new ModelInfo(); + ResourceInstance ri = new ResourceInstance(); + + + + @Test + public void testResourceDecomposition() { + rd.setModelInfo(model); + rd.setInstanceData(ri); + rd.setResourceType("resourceType"); + rd.setResourceInstanceId("newInstanceId"); + rd.setResourceInstanceName("newInstanceName"); + assertEquals(rd.getResourceModel(), model); + assertEquals(rd.getModelInfo(), model); + assertEquals(rd.getInstanceData(), ri); + assertEquals(rd.getResourceInstanceId(), "newInstanceId"); + assertEquals(rd.getResourceInstanceName(), "newInstanceName"); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ResourceTest.java new file mode 100644 index 0000000000..afdbcd9f98 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ResourceTest.java @@ -0,0 +1,68 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ResourceTest { + private Resource resource = new Resource() { + private static final long serialVersionUID = 1L; + + + }; + ModelInfo model = new ModelInfo(); + ResourceInstance ri = new ResourceInstance(); + HomingSolution hs = new HomingSolution(); + ResourceType rt = ResourceType.VNF; + public long concurrencyCounter = 1L; + long initval = resource.getConcurrencyCounter(); + + @Test + public void testResource() { + resource.setResourceId("resourceId"); + resource.setModelInfo(model); + resource.setResourceInstance(ri); + resource.setHomingSolution(hs); + resource.setCurrentHomingSolution(hs); + resource.setResourceType(rt); + resource.setToscaNodeType("toscaNodeType"); + resource.setResourceInstanceId("newInstanceId"); + resource.setResourceInstanceName("newInstanceName"); + resource.incrementConcurrencyCounter(); + assertEquals(resource.getResourceId(), "resourceId"); + assertEquals(resource.getModelInfo(), model); + assertEquals(resource.getResourceInstance(), ri); + assertEquals(resource.getHomingSolution(), hs); + assertEquals(resource.getCurrentHomingSolution(), hs); + assertEquals(resource.getResourceType(), rt); + assertEquals(resource.getToscaNodeType(), "toscaNodeType"); + assertEquals(resource.getResourceInstanceId(), "newInstanceId"); + assertEquals(resource.getResourceInstanceName(), "newInstanceName"); + assertEquals(resource.getConcurrencyCounter(), initval+1); + + + + + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java new file mode 100644 index 0000000000..82470f125b --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java @@ -0,0 +1,125 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; + +import org.junit.Before; +import org.junit.Test; + +import com.fasterxml.jackson.core.JsonProcessingException; + +public class ServiceDecompositionTest { + private static final String RESOURCE_PATH = "src/test/resources/json-examples/"; + + VnfResource vnfResource; + NetworkResource networkResource; + AllottedResource allottedResource; + ConfigResource configResource; + + @Before + public void before() { + vnfResource = new VnfResource(); + vnfResource.setResourceId("vnfResourceId"); + vnfResource.setModules(new ArrayList<>()); + + networkResource = new NetworkResource(); + networkResource.setResourceId("networkResourceId"); + + allottedResource = new AllottedResource(); + allottedResource.setResourceId("allottedResourceId"); + + configResource = new ConfigResource(); + configResource.setResourceId("configResourceId"); + } + + @Test + public void serviceDecompositionTest() throws JsonProcessingException, IOException { + // covering methods not covered by openpojo test + String catalogRestOutput = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "ServiceDecomposition.json"))); + + ServiceDecomposition serviceDecomp = new ServiceDecomposition(catalogRestOutput); + serviceDecomp.addVnfResource(vnfResource); + serviceDecomp.addNetworkResource(networkResource); + serviceDecomp.addAllottedResource(allottedResource); + serviceDecomp.addConfigResource(configResource); + + assertThat(serviceDecomp.getServiceResource(vnfResource.getResourceId()), sameBeanAs(vnfResource)); + assertThat(serviceDecomp.getServiceResource(networkResource.getResourceId()), sameBeanAs(networkResource)); + assertThat(serviceDecomp.getServiceResource(allottedResource.getResourceId()), sameBeanAs(allottedResource)); + assertThat(serviceDecomp.getServiceResource(configResource.getResourceId()), sameBeanAs(configResource)); + + VnfResource vnfResourceReplace = new VnfResource(); + vnfResourceReplace.setResourceId(vnfResource.getResourceId()); + vnfResourceReplace.setResourceInstanceName("vnfResourceReplaceInstanceName"); + + assertTrue(serviceDecomp.replaceResource(vnfResourceReplace)); + assertTrue(serviceDecomp.getVnfResources().contains(vnfResourceReplace)); + + assertTrue(serviceDecomp.deleteResource(vnfResourceReplace)); + assertFalse(serviceDecomp.deleteResource(vnfResourceReplace)); + assertFalse(serviceDecomp.deleteResource(new VnfResource())); + } + + @Test + public void serviceDecompositionJsonTest() throws IOException { + String catalogRestOutput = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "ServiceDecomposition.json"))); + String expectedCatalogRestOutput = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "ServiceDecompositionExpected.json"))); + String vnfResourceJson = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "VnfResource.json"))); + String networkResourceJson = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "NetworkResource.json"))); + String allottedResourceJson = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "AllottedResource.json"))); + String configResourceJson = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "ConfigResource.json"))); + + ServiceDecomposition serviceDecomp = new ServiceDecomposition(catalogRestOutput, "serviceInstanceId"); + serviceDecomp.addResource(vnfResource); + serviceDecomp.addResource(networkResource); + serviceDecomp.addResource(allottedResource); + serviceDecomp.addResource(configResource); + + assertThat(serviceDecomp.getServiceResource(vnfResource.getResourceId()), sameBeanAs(vnfResource)); + assertThat(serviceDecomp.getServiceResource(networkResource.getResourceId()), sameBeanAs(networkResource)); + assertThat(serviceDecomp.getServiceResource(allottedResource.getResourceId()), sameBeanAs(allottedResource)); + assertThat(serviceDecomp.getServiceResource(configResource.getResourceId()), sameBeanAs(configResource)); + + serviceDecomp = new ServiceDecomposition(catalogRestOutput, "serviceInstanceId"); + serviceDecomp.addVnfResource(vnfResourceJson); + serviceDecomp.addNetworkResource(networkResourceJson); + serviceDecomp.addAllottedResource(allottedResourceJson); + serviceDecomp.addConfigResource(configResourceJson); + + ServiceDecomposition expectedServiceDecomp = new ServiceDecomposition(expectedCatalogRestOutput, "serviceInstanceId"); + + assertThat(serviceDecomp, sameBeanAs(expectedServiceDecomp)); + assertEquals(serviceDecomp.listToJson(Arrays.asList(networkResource)) + serviceDecomp.listToJson(Arrays.asList(vnfResource)) + + serviceDecomp.listToJson(Arrays.asList(allottedResource)) + serviceDecomp.listToJson(Arrays.asList(configResource)), + serviceDecomp.getServiceResourcesJsonString()); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceInstanceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceInstanceTest.java new file mode 100644 index 0000000000..7cacc9da88 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceInstanceTest.java @@ -0,0 +1,61 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + +import static org.junit.Assert.*; + +import java.util.Map; + +import org.junit.Test; + +public class ServiceInstanceTest { + + private ServiceInstance si= new ServiceInstance(); + Map serviceParams; + Configuration config= new Configuration(); + ModelInfo model= new ModelInfo(); + + @Test + public void testServiceInstance() { + si.setServiceType("serviceType"); + si.setServiceId("serviceId"); + si.setServiceParams(serviceParams); + si.setInstanceId("instanceId"); + si.setInstanceName("instanceName"); + si.setOrchestrationStatus("orchestrationStatus"); + si.setConfiguration(config); + si.setModelInfo(model); + si.setEnvironmentContext("environmentContext"); + si.setWorkloadContext("workloadContext"); + assertEquals(si.getServiceType(), "serviceType"); + assertEquals(si.getServiceId(), "serviceId"); + assertEquals(si.getServiceParams(), serviceParams); + assertEquals(si.getInstanceId(), "instanceId"); + assertEquals(si.getInstanceName(), "instanceName"); + assertEquals(si.getOrchestrationStatus(), "orchestrationStatus"); + assertEquals(si.getConfiguration(), config); + assertEquals(si.getModelInfo(), model); + assertEquals(si.getEnvironmentContext(), "environmentContext"); + assertEquals(si.getWorkloadContext(), "workloadContext"); + + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/SubscriberTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/SubscriberTest.java new file mode 100644 index 0000000000..b862c8704f --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/SubscriberTest.java @@ -0,0 +1,41 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class SubscriberTest { + Subscriber subscriber= new Subscriber("globalId", "name", "commonSiteId"); + + @Test + public void testSubscriber() { + subscriber.setGlobalId("globalId"); + subscriber.setName("name"); + subscriber.setCommonSiteId("commonSiteId"); + assertEquals(subscriber.getGlobalId(), "globalId"); + assertEquals(subscriber.getName(), "name"); + assertEquals(subscriber.getCommonSiteId(), "commonSiteId"); + + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java new file mode 100644 index 0000000000..24947e9a8d --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java @@ -0,0 +1,55 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.core.domain; + +import static org.junit.Assert.*; + +import java.util.List; + +import org.junit.Test; + +public class VnfResourceTest { + + private VnfResource vnf= new VnfResource(); + List moduleResources; + + @Test + public void testVnfResource() { + vnf.setModules(moduleResources); + vnf.setVnfHostname("vnfHostname"); + vnf.setVnfType("vnfType"); + vnf.setNfFunction("nfFunction"); + vnf.setNfType("nfType"); + vnf.setNfRole("nfRole"); + vnf.setNfNamingCode("nfNamingCode"); + vnf.setMultiStageDesign("multiStageDesign"); + assertEquals(vnf.getVfModules(), moduleResources); + assertEquals(vnf.getVnfHostname(), "vnfHostname"); + assertEquals(vnf.getVnfType(), "vnfType"); + assertEquals(vnf.getNfFunction(), "nfFunction"); + assertEquals(vnf.getNfType(), "nfType"); + assertEquals(vnf.getNfRole(), "nfRole"); + assertEquals(vnf.getNfNamingCode(), "nfNamingCode"); + assertEquals(vnf.getMultiStageDesign(), "multiStageDesign"); + + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/internal/VariableNameExtractorTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/internal/VariableNameExtractorTest.java new file mode 100644 index 0000000000..e32bc88b7c --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/internal/VariableNameExtractorTest.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.bpmn.core.internal; +import static org.hamcrest.CoreMatchers.containsString; +import static org.junit.Assert.*; +import static org.mockito.Matchers.contains; + +import java.util.Optional; +import org.junit.Test; + +public class VariableNameExtractorTest { + + @Test + public void shouldExtractVariableName() throws Exception { + // given + String name = "A_different_NAME123"; + String variable = "${A_different_NAME123}"; + VariableNameExtractor extractor = new VariableNameExtractor(variable); + // when + Optional extracted = extractor.extract(); + // then + assertTrue(extracted.isPresent()); + assertThat(extracted.get(), containsString(name)); + } + + @Test + public void shouldExtractVariableNameFromWhitespaces() throws Exception { + // given + String name = "name"; + String variable = " \n\t$ \n\t{ \n\tname \n\t} \n\t"; + VariableNameExtractor extractor = new VariableNameExtractor(variable); + // when + Optional extracted = extractor.extract(); + // then + assertTrue(extracted.isPresent()); + assertThat(extracted.get(), containsString(name)); + } + + @Test + public void shouldReturnEmptyIfThereIsMoreThanVariable() throws Exception { + // given + String variable = "a ${test}"; + VariableNameExtractor extractor = new VariableNameExtractor(variable); + // when + Optional extracted = extractor.extract(); + // then + assertFalse(extracted.isPresent()); + } + + @Test + public void shouldReturnEmptyIfVariableNameIsIncorrect() throws Exception { + // given + String variable = "${name with space}"; + VariableNameExtractor extractor = new VariableNameExtractor(variable); + // when + Optional extracted = extractor.extract(); + // then + assertFalse(extracted.isPresent()); + } + + @Test + public void shouldReturnEmptyIfTwoVariablesPresent() throws Exception { + // given + String variable = "${var1} ${var2}"; + VariableNameExtractor extractor = new VariableNameExtractor(variable); + // when + Optional extracted = extractor.extract(); + // then + assertFalse(extracted.isPresent()); + } +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/DecomposeJsonUtilTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/DecomposeJsonUtilTest.java new file mode 100644 index 0000000000..c1f7cce30b --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/DecomposeJsonUtilTest.java @@ -0,0 +1,170 @@ +/* +* ============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.bpmn.core.json; + +import static org.junit.Assert.assertEquals; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.bpmn.core.domain.AllottedResource; +import org.onap.so.bpmn.core.domain.ConfigResource; +import org.onap.so.bpmn.core.domain.NetworkResource; +import org.onap.so.bpmn.core.domain.ServiceDecomposition; +import org.onap.so.bpmn.core.domain.VnfResource; + +public class DecomposeJsonUtilTest { + + private VnfResource vnfResource; + private NetworkResource networkResource; + private AllottedResource allottedResource; + private ConfigResource configResource; + private ServiceDecomposition serviceDecomposition; + + private String serviceInstanceId = "serviceInstanceId"; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Before + public void before() throws Exception { + + } + + @Test + public void testJsonToServiceDecomposition_twoParams() throws JsonDecomposingException { + serviceDecomposition = createServiceDecompositionData(); + ServiceDecomposition serviceDecompositionObj = DecomposeJsonUtil.jsonToServiceDecomposition(serviceDecomposition.toString(), "serviceInstanceId"); + assertEquals(serviceInstanceId, serviceDecompositionObj.getServiceInstance().getInstanceId()); + } + + @Test + public void testJsonToServiceDecomposition() throws JsonDecomposingException { + serviceDecomposition = createServiceDecompositionData(); + ServiceDecomposition serviceDecompositionObj = DecomposeJsonUtil.jsonToServiceDecomposition(serviceDecomposition.toString()); + assertEquals(serviceDecomposition.getServiceType(), serviceDecompositionObj.getServiceType()); + } + + @Test + public void testJsonToServiceDecomposition_JsonDecomposingException() throws JsonDecomposingException { + expectedException.expect(JsonDecomposingException.class); + vnfResource = createVnfResourceData(); // wrong object + ServiceDecomposition serviceDecompositionObj = DecomposeJsonUtil.jsonToServiceDecomposition(vnfResource.toString()); + } + + @Test + public void testJsonToVnfResource() throws JsonDecomposingException { + vnfResource = createVnfResourceData(); + VnfResource vnfResourceObj = DecomposeJsonUtil.jsonToVnfResource(vnfResource.toString()); + assertEquals(vnfResource.getResourceId(), vnfResourceObj.getResourceId()); + } + + @Test + public void testJsonToVnfResource_JsonDecomposingException() throws JsonDecomposingException { + expectedException.expect(JsonDecomposingException.class); + networkResource = createNetworkResourceData(); // wrong object + VnfResource vnfResourceObj = DecomposeJsonUtil.jsonToVnfResource(networkResource.toString()); + } + + @Test + public void testJsonToNetworkResource() throws JsonDecomposingException { + networkResource = createNetworkResourceData(); + NetworkResource networkResourceObj = DecomposeJsonUtil.jsonToNetworkResource(networkResource.toString()); + assertEquals(networkResource.getResourceId(), networkResourceObj.getResourceId()); + } + + @Test + public void testJsonToNetworkResource_JsonDecomposingException() throws JsonDecomposingException { + expectedException.expect(JsonDecomposingException.class); + vnfResource = createVnfResourceData(); // wrong object + NetworkResource networkResourceObj = DecomposeJsonUtil.jsonToNetworkResource(vnfResource.toString()); + } + + @Test + public void testJsonToAllottedResource() throws JsonDecomposingException { + allottedResource = createAllottedResourceData(); + AllottedResource allottedResourceObj = DecomposeJsonUtil.jsonToAllottedResource(allottedResource.toString()); + assertEquals(allottedResource.getResourceId(), allottedResourceObj.getResourceId()); + } + + @Test + public void testJsonToAllottedResource_JsonDecomposingException() throws JsonDecomposingException { + expectedException.expect(JsonDecomposingException.class); + configResource = createConfigResourceData(); // wrong object + AllottedResource allottedResourceObj = DecomposeJsonUtil.jsonToAllottedResource(configResource.toString()); + } + + @Test + public void testJsonToConfigResource() throws JsonDecomposingException { + configResource = createConfigResourceData(); + ConfigResource configResourceObj = DecomposeJsonUtil.jsonToConfigResource(configResource.toString()); + assertEquals(configResource.getResourceId(), configResourceObj.getResourceId()); + } + + @Test + public void testJsonToConfigResource_JsonDecomposingException() throws JsonDecomposingException { + expectedException.expect(JsonDecomposingException.class); + allottedResource = createAllottedResourceData(); // wrong object + ConfigResource configResourceObj = DecomposeJsonUtil.jsonToConfigResource(allottedResource.toString()); + } + + // data creation section + private VnfResource createVnfResourceData() { + vnfResource = new VnfResource(); + vnfResource.setResourceId("resourceId"); + vnfResource.setNfFunction("nfFunction"); + vnfResource.setNfNamingCode("nfNamingCode"); + vnfResource.setNfRole("nfRole"); + return vnfResource; + } + + private NetworkResource createNetworkResourceData() { + networkResource = new NetworkResource(); + networkResource.setNetworkRole("networkRole"); + networkResource.setResourceId("resourceId"); + return networkResource; + } + + private AllottedResource createAllottedResourceData() { + allottedResource = new AllottedResource(); + allottedResource.setResourceId("resourceId"); + allottedResource.setNfFunction("nfFunction"); + allottedResource.setNfNamingCode("nfNamingCode"); + allottedResource.setNfRole("nfRole"); + return allottedResource; + } + + private ConfigResource createConfigResourceData() { + configResource = new ConfigResource(); + configResource.setResourceId("resourceId"); + configResource.setToscaNodeType("toscaNodeType"); + return configResource; + } + + private ServiceDecomposition createServiceDecompositionData() { + serviceDecomposition = new ServiceDecomposition(); + serviceDecomposition.setSdncVersion("sdncVersion"); + serviceDecomposition.setServiceRole("serviceRole"); + serviceDecomposition.setServiceType("serviceType"); + return serviceDecomposition; + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonDecomposingExceptionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonDecomposingExceptionTest.java new file mode 100644 index 0000000000..6c8b7326e2 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonDecomposingExceptionTest.java @@ -0,0 +1,38 @@ +/* +* ============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.bpmn.core.json; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; + +public class JsonDecomposingExceptionTest { + + private JsonDecomposingException jsonDecomposingException; + + @Test + public void test() { + String expectedMessage = "java.lang.Throwable: anyCause"; + String message = "java.lang.Throwable: anyCause"; + Throwable cause = new Throwable("anyCause"); + jsonDecomposingException = new JsonDecomposingException(message, cause); + assertEquals(expectedMessage, jsonDecomposingException.getMessage()); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtils2Test.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtils2Test.java new file mode 100644 index 0000000000..667027f8de --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtils2Test.java @@ -0,0 +1,329 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.json; + + +import static org.junit.Assert.*; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; + +import org.json.JSONObject; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.bpmn.core.xml.XmlTool; +import org.onap.so.exceptions.ValidationException; +import org.xmlunit.builder.DiffBuilder; +import org.xmlunit.diff.DefaultNodeMatcher; +import org.xmlunit.diff.Diff; +import org.xmlunit.diff.ElementSelectors; + +/** + * @version 1.0 + */ +public class JsonUtils2Test { + + private static final String EOL = "\n"; + private static final String XML_REQ = + "" + EOL + + " " + EOL + + " DEV-VF-0021" + EOL + + " CREATE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " asc_heat-int" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " STMTN5MMSC21-MMSC::model-1-0" + EOL + + " true" + EOL + + " 00000000-0000-0000-0000-000000000000" + EOL + + " 1.0" + EOL + + " 999999999-0000-0000-0000-000000000000" + EOL + + " 1.5" + EOL + + " 00000000-0000-0000-0000-000000000000" + EOL + + " SDN-ETHERNET-INTERNET" + EOL + + " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + + " pending-delete" + EOL + + " RDM2WAGPLCP" + EOL + + " 1" + EOL + + " " + EOL + + " " + EOL + + " network1111" + EOL + + " server1111" + EOL + + " " + EOL + + "" + EOL; + + private static final String XML_REQ_NO_ATTRS = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " asc_heat-int" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 00000000-0000-0000-0000-000000000000" + EOL + + " SDN-ETHERNET-INTERNET" + EOL + + " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + + " pending-delete" + EOL + + " RDM2WAGPLCP" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + + private static final String XML_ARRAY_REQ = + "" + EOL + + " BROADBAND" + EOL + + " IVLAN" + EOL + + " SHELLUCPE31" + EOL + + " " + EOL + + " " + EOL + + " AVPN" + EOL + + " 1000BASE-T" + EOL + + " ATT" + EOL + + " BT/SLIR/70911" + EOL + + " Active" + EOL + + " WAN1" + EOL + + " ATT" + EOL + + " 100" + EOL + + " ELECTRICAL" + EOL + + " " + EOL + + " " + EOL + + " AVPN" + EOL + + " 10/100/1000BASE-T" + EOL + + " ATT" + EOL + + " AS/KRFN/34611" + EOL + + " Active" + EOL + + " WAN2" + EOL + + " ATT" + EOL + + " 10000" + EOL + + " MMF" + EOL + + " " + EOL + + " " + EOL + + " ASD-987-M31" + EOL + + " USOSTCDALTX0101UJZZ31" + EOL + + " FG-VM00*" + EOL + + ""; + + // JSON request w/ embedded XML will be read from a file + private static String jsonReq; + private static String jsonReqArray; + + @BeforeClass + public static void initialize() throws Exception { + jsonReq = readFileToString("src/test/resources/request.json"); + jsonReqArray = readFileToString("src/test/resources/requestArray.json"); + } + + private static String readFileToString(String path) throws IOException { + File file = new File(path); + return new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8); + } + + @Test + public void shouldConvertXmlToJsonAndBackToSameXml() throws Exception { + // Note: the current version of the JsonUtils.json2xml() method + // does not support converting the JSONObject representation + // of XML attributes (JSONArray) back to XML. So this test will + // only succeed if the original XML does not contain attributes + + // given + String xmlIn = XmlTool.removeNamespaces(XML_REQ_NO_ATTRS); + // when + String json = JsonUtils.xml2json(XML_REQ_NO_ATTRS); + String xmlOut = JsonUtils.json2xml(json); + // then + Diff diffXml = DiffBuilder.compare(xmlIn).withTest(xmlOut).ignoreWhitespace() + .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)).checkForSimilar().build(); + + assertFalse(diffXml.hasDifferences()); + } + + @Test + public void shouldReadValuesForAbsoluteJsonPaths() throws Exception { + // given + String json = JsonUtils.xml2json(XML_REQ); + // when, then + assertEquals("STMTN5MMSC21", JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.vnf-name")); + assertEquals("CREATE_VF_MODULE", JsonUtils.getJsonValue(json, "vnf-request.request-info.action")); + assertEquals("1", JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.persona-model-version")); + assertEquals("1.5", JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.vnf-persona-model-version")); + assertEquals("true", JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.is-base-module")); + } + + @Test + public void shouldReturnValueForJsonKey() throws Exception { + // given + String json = JsonUtils.xml2json(XML_REQ); + // when, then + assertEquals("PORTAL", JsonUtils.getJsonValueForKey(json, "source")); + } + + @Test + public void shouldReturnNullForNonexistentJsonNode() throws Exception { + // given + String json = JsonUtils.xml2json(XML_REQ); + // when, then + assertNull(JsonUtils.getJsonValueForKey(json, "nonexistent-node")); + } + + @Test + public void shouldReturnNullForNonExistentParameter() throws Exception { + // given + String json = JsonUtils.xml2json(XML_REQ); + // when, then + assertNull(JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.bad")); + } + + @Test + public void shouldGetJasonParametersFromArray() throws Exception { + // given + String json = JsonUtils.xml2json(XML_REQ); + // when, then + assertEquals("network", JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name")); + assertEquals("network1111", JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "content")); + assertEquals("server", JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name", 1)); + assertEquals("server1111", JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "content", 1)); + assertNull(JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "badParam")); + assertNull(JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name", 2)); + } + + @Test + public void shouldAddJsonValue() throws Exception { + // given + String json = JsonUtils.xml2json(XML_REQ); + String key = "vnf-request.request-info.comment"; + String value = "Some comment"; + // when + String jsonUpd = JsonUtils.addJsonValue(json, key, value); + // then + String extractedValue = JsonUtils.getJsonValue(jsonUpd, key); + assertEquals(value, extractedValue); + } + + @Test + public void shouldIgnoreAddIfFieldAlreadyExists() throws Exception { + // given + String json = JsonUtils.xml2json(XML_REQ); + String key = "vnf-request.vnf-inputs.vnf-name"; + String newValue = "STMTN5MMSC22"; + // when + String jsonUpd = JsonUtils.addJsonValue(json, key, newValue); + // then + String extractedValue = JsonUtils.getJsonValue(jsonUpd, key); + assertNotEquals(newValue, extractedValue); + } + + @Test + public void shouldUpdateValueInJson() throws Exception { + // given + String json = JsonUtils.xml2json(XML_REQ); + String key = "vnf-request.vnf-inputs.vnf-name"; + String newValue = "STMTN5MMSC22"; + String oldValue = JsonUtils.getJsonValue(json, key); + // when + String jsonUpd = JsonUtils.updJsonValue(json, key, newValue); + // then + String extractedValue = JsonUtils.getJsonValue(jsonUpd, key); + assertEquals(newValue, extractedValue); + } + + @Test + public void shouldDeleteValue() throws Exception { + // given + String json = JsonUtils.xml2json(XML_REQ); + String key = "vnf-request.vnf-inputs.vnf-name"; + // when + String jsonUpd = JsonUtils.delJsonValue(json, key); + // then + String extractedValue = JsonUtils.getJsonValue(jsonUpd, key); + assertNull(extractedValue); + JSONObject jsonObj = new JSONObject(json); + Integer intValue = JsonUtils.getJsonIntValueForKey(jsonObj, "persona-model-version"); + Assert.assertTrue(intValue == 1); + Boolean boolValue = JsonUtils.getJsonBooleanValueForKey(jsonObj, "is-base-module"); + Assert.assertTrue(boolValue); + } + + @Test + public void shouldReturnOriginalJsonWhenTryingToRemoveNonexistentField() throws Exception { + // given + String json = JsonUtils.xml2json(XML_REQ); + String key = "vnf-request.vnf-inputs.does-not-exist"; + // when + String jsonUpd = JsonUtils.delJsonValue(json, key); + // then + assertEquals(json, jsonUpd); + } + + @Test + public void shouldConvertXmlToJsonAndBackToSameXmlExtractedFromTheRequest() throws Exception { + // given + String value = JsonUtils.getJsonValue(jsonReq, "variables.bpmnRequest.value"); + String xmlReq = XmlTool.removeNamespaces(XmlTool.normalize(value)); + // when + String json = JsonUtils.xml2json(xmlReq); + String xmlOut = JsonUtils.json2xml(json); + // then + Diff diffXml = DiffBuilder.compare(xmlReq).withTest(xmlOut).ignoreWhitespace() + .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)).checkForSimilar().build(); + assertFalse(diffXml.hasDifferences()); + } + + @Test + public void shouldConvertJsonContainingArrayToXml() throws Exception { + // when + String jsonParm = JsonUtils.getJsonNodeValue(jsonReqArray, "requestDetails.requestParameters.ucpeInfo"); + String xmlOut = JsonUtils.json2xml(jsonParm); + // then + Diff diffXml = DiffBuilder.compare(XML_ARRAY_REQ).withTest(xmlOut).ignoreWhitespace() + .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)).checkForSimilar().build(); + assertFalse(diffXml.hasDifferences()); + } + + @Test + // Tests the jsonSchemaValidation() method + public void testJsonSchemaValidation() { + try { + String myReqArray = jsonReqArray; + String result = JsonUtils.jsonSchemaValidation(myReqArray, "src/test/resources/requestSchema.json"); + System.out.println("Schema Validation Result: " + result); + Assert.assertTrue(result.contains("success")); + // remove a required parameter from the JSON doc so that validation fails + myReqArray = JsonUtils.delJsonValue(myReqArray, "requestDetails.requestParameters.ucpeInfo.ucpeHostName"); + result = JsonUtils.jsonSchemaValidation(myReqArray, "src/test/resources/requestSchema.json"); + System.out.println("Schema Validation Result: " + result); + Assert.assertTrue(result.contains("failure")); + Assert.assertTrue(result.contains("error: object has missing required properties ([\"ucpeHostName\"])")); + } catch (ValidationException e) { + e.printStackTrace(); + } + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java new file mode 100644 index 0000000000..07523ca931 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java @@ -0,0 +1,233 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.json; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.List; +import java.util.Map; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.runtime.Execution; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.Mock; +import org.onap.so.exceptions.ValidationException; + +public class JsonUtilsTest { + + @Mock public DelegateExecution execution; + @Mock public Execution mockEexecution; + private final String fileLocation = "src/test/resources/json-examples/"; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Test + public void jsonStringToMapTest() throws IOException { + + JsonUtils utils = new JsonUtils(); + String response = this.getJson("SDNCServiceResponseExample.json"); + String entry = JsonUtils.getJsonValue(response, "SDNCServiceResponse.params"); + Map map = utils.jsonStringToMap(execution, entry); + assertEquals(map.get("e2e-vpn-key"), "my-key"); + } + + @Test + public void entryArrayToMapTest() throws IOException { + JsonUtils utils = new JsonUtils(); + String response = this.getJson("SNIROExample.json"); + String entry = JsonUtils.getJsonValue(response, "solutionInfo.placementInfo"); + JSONArray arr = new JSONArray(entry); + JSONObject homingDataJson = arr.getJSONObject(0); + JSONArray assignmentInfo = homingDataJson.getJSONArray("assignmentInfo"); + Map map = utils.entryArrayToMap(execution, assignmentInfo.toString(), "variableName", "variableValue"); + assertEquals(map.get("cloudOwner"), "att-aic"); + } + @Test + public void entryArrayToMapStringTest() throws IOException { + JsonUtils utils = new JsonUtils(); + String response = this.getJson("SNIROExample.json"); + String entry = JsonUtils.getJsonValue(response, "solutionInfo.placementInfo"); + JSONArray arr = new JSONArray(entry); + JSONObject homingDataJson = arr.getJSONObject(0); + JSONArray assignmentInfo = homingDataJson.getJSONArray("assignmentInfo"); + Map map = utils.entryArrayToMap(assignmentInfo.toString(), "variableName", "variableValue"); + assertEquals(map.get("cloudOwner"), "att-aic"); + } + @Test + public void getJsonRootPropertyTest() throws IOException { + String response = this.getJson("SDNCServiceResponseExample.json"); + assertEquals("SDNCServiceResponse",JsonUtils.getJsonRootProperty(response)); + } + @Test + public void getJsonRootProperty_ExceptionTest() throws IOException { + expectedException.expect(JSONException.class); + String response = this.getJson("SNIROExample.json"); + String root = JsonUtils.getJsonRootProperty(response); + } + @Test + public void getJsonNodeValueTest() throws IOException { + String response = this.getJson("SDNCServiceResponseExample.json"); + String code = JsonUtils.getJsonNodeValue(response,"SDNCServiceResponse.responseCode"); + assertEquals("200", code); + } + @Test + public void stringArrayToList_jsonStringTest() throws IOException { + String response = this.getJson("SNIROExample.json"); + String licenseInfo = JsonUtils.getJsonNodeValue(response,"solutionInfo.licenseInfo"); + JsonUtils utils = new JsonUtils(); + List listString = utils.StringArrayToList(licenseInfo); + assertNotNull(listString.get(0)); + } + @Test + public void stringArrayToList_JSONArrayTest() throws IOException { + String response = this.getJson("SNIROExample.json"); + String licenseInfo = JsonUtils.getJsonNodeValue(response,"solutionInfo.licenseInfo"); + JSONArray jsonArray = new JSONArray(licenseInfo); + JsonUtils utils = new JsonUtils(); + List listString = utils.StringArrayToList(jsonArray); + assertNotNull(listString.get(0)); + } + @Test + public void stringArrayToList_withExecutionTest() throws IOException { + String response = this.getJson("SNIROExample.json"); + String licenseInfo = JsonUtils.getJsonNodeValue(response,"solutionInfo.licenseInfo"); + JsonUtils utils = new JsonUtils(); + List listString = utils.StringArrayToList(mockEexecution, licenseInfo); + assertNotNull(listString.get(0)); + } + @Test + public void jsonElementExist_trueTest() throws IOException { + String response = this.getJson("SDNCServiceResponseExample.json"); + boolean isExist = JsonUtils.jsonElementExist(response,"SDNCServiceResponse.responseCode"); + assertEquals(true, isExist); + } + @Test + public void jsonElementExist_falseTest() throws IOException { + String response = this.getJson("SDNCServiceResponseExample.json"); + boolean isExist = JsonUtils.jsonElementExist(response,"SDNCServiceResponse.responseX"); + assertEquals(false, isExist); + } + @Test + public void jsonElementExist_NullTest() throws IOException { + String response = this.getJson("SDNCServiceResponseExample.json"); + boolean isExist = JsonUtils.jsonElementExist(response, null); + assertEquals(true, isExist); + } + @Test + public void jsonSchemaValidation_ExceptionTest() throws IOException, ValidationException { + expectedException.expect(ValidationException.class); + String response = this.getJson("SDNCServiceResponseExample.json"); + String isExist = JsonUtils.jsonSchemaValidation(response, fileLocation); + } + @Test + public void getJsonIntValueTest() throws IOException { + String response = this.getJson("SDNCServiceResponseExample.json"); + int intValue = JsonUtils.getJsonIntValue(response,"SDNCServiceResponse.responseCode"); + assertEquals(0, intValue); + } + @Test + public void getJsonBooleanValueTest() throws IOException { + String response = this.getJson("SDNCServiceResponseExample.json"); + boolean isBoolean = JsonUtils.getJsonBooleanValue(response,"SDNCServiceResponse.responseCode"); + assertEquals(false, isBoolean); + } + @Test + public void prettyJsonTest() throws IOException { + String response = this.getJson("SNIROExample.json"); + assertNotNull(JsonUtils.prettyJson(response)); + String malformedJson = "{\"name\" \"myName\"}"; + assertNull(JsonUtils.prettyJson(malformedJson)); + } + @Test + public void xml2jsonTest() throws IOException { + String expectedJson = "{\"name\":\"myName\"}"; + String xml = "myName"; + assertEquals(expectedJson, JsonUtils.xml2json(xml,false)); + } + @Test + public void xml2jsonErrorTest() throws IOException { + String malformedXml = "myName"; + assertNull(JsonUtils.xml2json(malformedXml)); + } + @Test + public void json2xmlTest() throws IOException { + String expectedXml = "myName"; + String malformedJson = "{\"name\":\"myName\"}"; + assertEquals(expectedXml, JsonUtils.json2xml(malformedJson, false)); + } + @Test + public void json2xmlErrorTest() throws IOException { + String malformedJson = "{\"name\" \"myName\"}"; + assertNull(JsonUtils.json2xml(malformedJson)); + } + @Test + public void getJsonValueErrorTest() throws IOException { + String response = this.getJson("SDNCServiceResponseExample.json"); + assertNull(JsonUtils.getJsonValue(response,null)); + } + @Test + public void getJsonNodeValueErrorTest() throws IOException { + String response = this.getJson("SDNCServiceResponseExample.json"); + assertNull(JsonUtils.getJsonNodeValue(response,null)); + } + @Test + public void getJsonIntValueErrorTest() throws IOException { + String response = this.getJson("SDNCServiceResponseExample.json"); + assertEquals(0, JsonUtils.getJsonIntValue(response,null)); + } + @Test + public void getJsonBooleanValueErrorTest() throws IOException { + String response = this.getJson("SDNCServiceResponseExample.json"); + assertEquals(false, JsonUtils.getJsonBooleanValue(response,null)); + } + @Test + public void getJsonValueForKeyErrorTest() throws IOException { + String malformedJson = "{\"name\" \"myName\"}"; + assertNull(JsonUtils.getJsonValueForKey(malformedJson, "name")); + } + @Test + public void updJsonValueTest() throws IOException { + String expectedJson = "{\"name\": \"yourName\"}"; + String json = "{\"name\":\"myName\"}"; + assertEquals(expectedJson, JsonUtils.updJsonValue(json, "name", "yourName")); + } + @Test + public void updJsonValueErrorTest() throws IOException { + String expectedJson = "{\"name\" \"myName\"}"; + String json = "{\"name\" \"myName\"}"; + assertEquals(expectedJson, JsonUtils.updJsonValue(json, "name", "yourName")); + } + + private String getJson(String filename) throws IOException { + return new String(Files.readAllBytes(Paths.get(fileLocation + filename))); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/utils/CamundaDBSetup.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/utils/CamundaDBSetup.java new file mode 100644 index 0000000000..f3cc094873 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/utils/CamundaDBSetup.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.bpmn.core.utils; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +import org.onap.so.logger.MsoLogger; + +/** + * Sets up the unit test (H2) database for Camunda. + */ +public class CamundaDBSetup { + private static boolean isDBConfigured = false; + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CamundaDBSetup.class); + + private CamundaDBSetup() { + } + + public static synchronized void configure() throws SQLException { + if (isDBConfigured) { + return; + } + + LOGGER.debug ("Configuring the Camunda H2 database for MSO"); + + Connection connection = null; + PreparedStatement stmt = null; + + try { + + + isDBConfigured = true; + + } finally { + if (stmt != null) { + try { + stmt.close(); + } catch (Exception e) { + LOGGER.debug("Exception :",e); + } + } + + if (connection != null) { + try { + connection.close(); + } catch (Exception e) { + LOGGER.debug("Exception :",e); + } + } + } + } +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/xml/XmlToolTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/xml/XmlToolTest.java new file mode 100644 index 0000000000..6bad0c6c29 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/xml/XmlToolTest.java @@ -0,0 +1,82 @@ +/* +* ============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.bpmn.core.xml; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.Optional; + +import org.junit.Test; + +public class XmlToolTest { + + private String response = "good"; + private String responseModified = "veryGood"; + private String encodeResponse = "<Response>good</Response>"; + private String encodeResponseNamespace = "good"; + private String attribute = "good&\"bad\""; + private String updatedAttribute = "<Response>good&"bad"</Response>"; + + private String content = "" + + "test" + + "test" + + "123" + + "" + + "test" + + "test" + + ""; + + @Test + public void test() throws Exception { + Object xmlMessage = new String(response); + String xmlResponse = XmlTool.normalize(xmlMessage); + assertEquals(response, xmlResponse.toString()); + String xmlEncode = XmlTool.encode(xmlMessage); + assertEquals(encodeResponse, xmlEncode.toString()); + Optional optXml = XmlTool.modifyElement(response, "Response", "veryGood"); + Object obj1 = new String(optXml.get().toString()); + String noPreamble = XmlTool.removePreamble(obj1); + assertEquals(responseModified, noPreamble.toString()); + Object obj2 = new String(encodeResponseNamespace); + String noNamespace = XmlTool.removeNamespaces(obj2); + assertEquals(response, noNamespace.toString()); + Object obj3 = new String(attribute); + + assertEquals(null, XmlTool.normalize(null)); + assertEquals(null, XmlTool.encode(null)); + assertEquals(null, XmlTool.removePreamble(null)); + assertEquals(null, XmlTool.removeNamespaces(null)); + assertEquals(Optional.empty(), XmlTool.modifyElement(null, "Response", "veryGood")); + } + + @Test + public void normalizeTest() throws Exception { + String response = XmlTool.normalize(content); + assertNotNull(response); + } + + @Test + public void modifyElementTest() throws Exception { + String response = XmlTool.modifyElement(content, "event-type", "uCPE-VMS").get(); + assertNotNull(response); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/HealthCheckHandlerTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/HealthCheckHandlerTest.java deleted file mode 100644 index 1086cc75ef..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/HealthCheckHandlerTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.core; - -import org.junit.Test; - -public class HealthCheckHandlerTest { - - HealthCheckHandler healthCheckHandler = new HealthCheckHandler(); - - @Test - public void nodeHealthcheck() throws Exception { - healthCheckHandler.nodeHealthcheck(); - } - - @Test - public void healthcheck() throws Exception { - healthCheckHandler.healthcheck("test-123"); - } - -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java deleted file mode 100644 index 9643db7834..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java +++ /dev/null @@ -1,356 +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========================================================= - */ - -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core; - - - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; - -import org.json.JSONObject; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; -import org.openecomp.mso.apihandler.common.ValidationException; -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.bpmn.core.xml.XmlTool; -import org.xmlunit.builder.DiffBuilder; -import org.xmlunit.diff.DefaultNodeMatcher; -import org.xmlunit.diff.Diff; -import org.xmlunit.diff.ElementSelectors; - -/** - * @version 1.0 - */ -public class JsonUtilsTest { - - private static final String EOL = "\n"; - private static final String XML_REQ = - "" + EOL + - " " + EOL + - " DEV-VF-0021" + EOL + - " CREATE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " asc_heat-int" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " STMTN5MMSC21-MMSC::model-1-0" + EOL + - " true" + EOL + - " 00000000-0000-0000-0000-000000000000" + EOL + - " 1.0" + EOL + - " 999999999-0000-0000-0000-000000000000" + EOL + - " 1.5" + EOL + - " 00000000-0000-0000-0000-000000000000" + EOL + - " SDN-ETHERNET-INTERNET" + EOL + - " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + - " pending-delete" + EOL + - " RDM2WAGPLCP" + EOL + - " 1" + EOL + - " " + EOL + - " " + EOL + - " network1111" + EOL + - " server1111" + EOL + - " " + EOL + - "" + EOL; - - private static final String XML_REQ_NO_ATTRS = - "" + EOL + - " " + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " asc_heat-int" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 00000000-0000-0000-0000-000000000000" + EOL + - " SDN-ETHERNET-INTERNET" + EOL + - " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + - " pending-delete" + EOL + - " RDM2WAGPLCP" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - - private static final String XML_ARRAY_REQ = - "" + EOL + - " BROADBAND" + EOL + - " IVLAN" + EOL + - " SHELLUCPE31" + EOL + - " " + EOL + - " " + EOL + - " AVPN" + EOL + - " 1000BASE-T" + EOL + - " ATT" + EOL + - " BT/SLIR/70911" + EOL + - " Active" + EOL + - " WAN1" + EOL + - " ATT" + EOL + - " 100" + EOL + - " ELECTRICAL" + EOL + - " " + EOL + - " " + EOL + - " AVPN" + EOL + - " 10/100/1000BASE-T" + EOL + - " ATT" + EOL + - " AS/KRFN/34611" + EOL + - " Active" + EOL + - " WAN2" + EOL + - " ATT" + EOL + - " 10000" + EOL + - " MMF" + EOL + - " " + EOL + - " " + EOL + - " ASD-987-M31" + EOL + - " USOSTCDALTX0101UJZZ31" + EOL + - " FG-VM00*" + EOL + - ""; - - // JSON request w/ embedded XML will be read from a file - private static String jsonReq; - private static String jsonReqArray; - - @BeforeClass - public static void initialize() throws Exception { - jsonReq = readFileToString("src/test/resources/request.json"); - jsonReqArray = readFileToString("src/test/resources/requestArray.json"); - } - - private static String readFileToString(String path) throws IOException { - File file = new File(path); - return new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8); - } - - @Test - public void shouldConvertXmlToJsonAndBackToSameXml() throws Exception { - // Note: the current version of the JsonUtils.json2xml() method - // does not support converting the JSONObject representation - // of XML attributes (JSONArray) back to XML. So this test will - // only succeed if the original XML does not contain attributes - - // given - String xmlIn = XmlTool.removeNamespaces(XML_REQ_NO_ATTRS); - // when - String json = JsonUtils.xml2json(XML_REQ_NO_ATTRS); - String xmlOut = JsonUtils.json2xml(json); - // then - Diff diffXml = DiffBuilder.compare(xmlIn).withTest(xmlOut).ignoreWhitespace() - .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)).checkForSimilar().build(); - - assertThat(diffXml.hasDifferences()).withFailMessage(diffXml.toString()).isFalse(); - } - - @Test - public void shouldReadValuesForAbsoluteJsonPaths() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - // when, then - assertThat(JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.vnf-name")).isEqualTo("STMTN5MMSC21"); - assertThat(JsonUtils.getJsonValue(json, "vnf-request.request-info.action")).isEqualTo("CREATE_VF_MODULE"); - assertThat(JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.persona-model-version")).isEqualTo("1"); - assertThat(JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.vnf-persona-model-version")).isEqualTo("1.5"); - assertThat(JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.is-base-module")).isEqualTo("true"); - } - - @Test - public void shouldReturnValueForJsonKey() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - // when, then - assertThat(JsonUtils.getJsonValueForKey(json, "source")).isEqualTo("PORTAL"); - } - - @Test - public void shouldReturnNullForNonexistentJsonNode() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - // when, then - assertThat(JsonUtils.getJsonValueForKey(json, "nonexistent-node")).isNull(); - } - - @Test - public void shouldReturnNullForNonExistentParameter() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - // when, then - assertThat(JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.bad")).isNull(); - } - - @Test - public void shouldGetJasonParametersFromArray() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - // when, then - assertThat(JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name")).isEqualTo("network"); - assertThat(JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "content")) - .isEqualTo("network1111"); - assertThat(JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name", 1)).isEqualTo("server"); - assertThat(JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "content", 1)) - .isEqualTo("server1111"); - assertThat(JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "badParam")) - .withFailMessage("Expected null for nonexistent param").isNull(); - assertThat(JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name", 2)) - .withFailMessage("Expected null for index out of bound").isNull(); - } - - @Test - public void shouldAddJsonValue() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - String key = "vnf-request.request-info.comment"; - String value = "Some comment"; - // when - String jsonUpd = JsonUtils.addJsonValue(json, key, value); - // then - String extractedValue = JsonUtils.getJsonValue(jsonUpd, key); - assertThat(extractedValue).isEqualTo(value); - } - - @Test - public void shouldIgnoreAddIfFieldAlreadyExists() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - String key = "vnf-request.vnf-inputs.vnf-name"; - String newValue = "STMTN5MMSC22"; - String oldValue = JsonUtils.getJsonValue(json, key); - // when - String jsonUpd = JsonUtils.addJsonValue(json, key, newValue); - // then - String extractedValue = JsonUtils.getJsonValue(jsonUpd, key); - assertThat(extractedValue).isEqualTo(oldValue).isNotEqualTo(newValue); - } - - @Test - public void shouldUpdateValueInJson() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - String key = "vnf-request.vnf-inputs.vnf-name"; - String newValue = "STMTN5MMSC22"; - String oldValue = JsonUtils.getJsonValue(json, key); - // when - String jsonUpd = JsonUtils.updJsonValue(json, key, newValue); - // then - String extractedValue = JsonUtils.getJsonValue(jsonUpd, key); - assertThat(extractedValue).isNotEqualTo(oldValue).isEqualTo(newValue); - } - - @Test - public void shouldDeleteValue() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - String key = "vnf-request.vnf-inputs.vnf-name"; - String oldValue = JsonUtils.getJsonValue(json, key); - // when - String jsonUpd = JsonUtils.delJsonValue(json, key); - // then - String extractedValue = JsonUtils.getJsonValue(jsonUpd, key); - assertThat(extractedValue).isNotEqualTo(oldValue).isNull(); - JSONObject jsonObj = new JSONObject(json); - Integer intValue = JsonUtils.getJsonIntValueForKey(jsonObj, "persona-model-version"); - Assert.assertTrue(intValue == 1); - Boolean boolValue = JsonUtils.getJsonBooleanValueForKey(jsonObj, "is-base-module"); - Assert.assertTrue(boolValue); - } - - @Test - public void shouldReturnOriginalJsonWhenTryingToRemoveNonexistentField() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - String key = "vnf-request.vnf-inputs.does-not-exist"; - // when - String jsonUpd = JsonUtils.delJsonValue(json, key); - // then - assertThat(jsonUpd).isEqualTo(json); - } - - @Test - public void shouldConvertXmlToJsonAndBackToSameXmlExtractedFromTheRequest() throws Exception { - // given - String value = JsonUtils.getJsonValue(jsonReq, "variables.bpmnRequest.value"); - String xmlReq = XmlTool.removeNamespaces(XmlTool.normalize(value)); - // when - String json = JsonUtils.xml2json(xmlReq); - String xmlOut = JsonUtils.json2xml(json); - // then - Diff diffXml = DiffBuilder.compare(xmlReq).withTest(xmlOut).ignoreWhitespace() - .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)).checkForSimilar().build(); - assertThat(diffXml.hasDifferences()).withFailMessage(diffXml.toString()).isFalse(); - } - - @Test - public void shouldConvertJsonContainingArrayToXml() throws Exception { - // when - String jsonParm = JsonUtils.getJsonNodeValue(jsonReqArray, "requestDetails.requestParameters.ucpeInfo"); - String xmlOut = JsonUtils.json2xml(jsonParm); - // then - Diff diffXml = DiffBuilder.compare(XML_ARRAY_REQ).withTest(xmlOut).ignoreWhitespace() - .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)).checkForSimilar().build(); - assertThat(diffXml.hasDifferences()).withFailMessage(diffXml.toString()).isFalse(); - } - - @Test - // Tests the jsonSchemaValidation() method - public void testJsonSchemaValidation() { - try { - String myReqArray = jsonReqArray; - String result = JsonUtils.jsonSchemaValidation(myReqArray, "src/test/resources/requestSchema.json"); - System.out.println("Schema Validation Result: " + result); - Assert.assertTrue(result.contains("success")); - // remove a required parameter from the JSON doc so that validation fails - myReqArray = JsonUtils.delJsonValue(myReqArray, "requestDetails.requestParameters.ucpeInfo.ucpeHostName"); - result = JsonUtils.jsonSchemaValidation(myReqArray, "src/test/resources/requestSchema.json"); - System.out.println("Schema Validation Result: " + result); - Assert.assertTrue(result.contains("failure")); - Assert.assertTrue(result.contains("error: object has missing required properties ([\"ucpeHostName\"])")); - } catch (ValidationException e) { - e.printStackTrace(); - } - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java deleted file mode 100644 index 57a512891f..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.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========================================================= - */ - -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core; - -import java.io.IOException; -import java.util.Map; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - - -public class PropertyConfigurationTest { - @Before - public void beforeTest() throws IOException { - PropertyConfiguration.resetPropertyConfigurationSingletonInstance(); - - Map defaultProperties = PropertyConfigurationSetup.createBpmnProperties(); - defaultProperties.put("testValue", "testKey"); - PropertyConfigurationSetup.init(defaultProperties); - } - - @Test - public void testPropertyFileWatcher() throws InterruptedException, IOException { - Assert.assertEquals(true, PropertyConfiguration.getInstance().isFileWatcherRunning()); - } - - @Test - public void testPropertyLoading() throws IOException, InterruptedException { - PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); - Map props = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES); - Assert.assertNotNull(props); - Assert.assertEquals("testValue", props.get("testKey")); - } - - @Test - public void testPropertyReload() throws IOException, InterruptedException { - PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); - Map properties = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES); - Assert.assertNotNull(properties); - Assert.assertEquals("testValue", properties.get("testKey")); - - Map newProperties = PropertyConfigurationSetup.createBpmnProperties(); - newProperties.put("newKey", "newValue"); - PropertyConfigurationSetup.addProperties(newProperties, 10000); - - // Reload and check for the new value - properties = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES); - Assert.assertNotNull(properties); - Assert.assertEquals("newValue", properties.get("newKey")); - } - - @Test(expected=IllegalArgumentException.class) - public void testPropertyFileDoesNotExists_NotIntheList() throws IOException { - PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); - propertyConfiguration.getProperties("badfile.properties"); - Assert.fail("Expected IllegalArgumentException"); - } - - @Test(expected=java.lang.UnsupportedOperationException.class) - public void testPropertyModificationException() throws IOException { - PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); - Map props = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES); - Assert.assertNotNull(props); - Assert.assertEquals("testValue", props.get("testKey")); - props.put("newKey", "newvalue"); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataTest.java deleted file mode 100644 index c51af23e30..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataTest.java +++ /dev/null @@ -1,85 +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.bpmn.core; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.entry; - -import org.junit.Test; - -public class RollbackDataTest { - - private final static String TYPE_A = "typeA"; - private final static String TYPE_B = "typeB"; - private static final String KEY_1 = "key1"; - private static final String VALUE_1 = "value1"; - private static final String VALUE_2 = "value2"; - - @Test - public void shouldReturnStringRepresentationOfDataInAnyPermutation() throws Exception { - // given - RollbackData data = new RollbackData(); - data.put(TYPE_A, KEY_1, VALUE_1); - data.put(TYPE_A, "key2", "value2"); - data.put(TYPE_B, "key3", "value3"); - // when, then - assertThat(data.toString()).isIn( - "[typeB{key3=value3},typeA{key1=value1, key2=value2}]", - "[typeB{key3=value3},typeA{key2=value2, key1=value1}]", - "[typeA{key1=value1, key2=value2},typeB{key3=value3}]", - "[typeA{key2=value2, key1=value1},typeB{key3=value3}]"); - } - - @Test - public void shouldBeEmptyOnCreation() throws Exception { - // given - RollbackData data = new RollbackData(); - // then - assertThat(data.hasType(TYPE_A)).isFalse(); - assertThat(data.get(TYPE_A, KEY_1)).isNull(); - } - - @Test - public void shouldHaveTypeAfterPuttingDataOfThatType() throws Exception { - // given - RollbackData data = new RollbackData(); - // when - data.put(TYPE_A, KEY_1, VALUE_1); - // then - assertThat(data.hasType(TYPE_A)).isTrue(); - assertThat(data.hasType(TYPE_B)).isFalse(); - assertThat(data.get(TYPE_A, KEY_1)).isEqualTo(VALUE_1); - } - - @Test - public void shouldKeepTwoValuesWithSameKeysButDifferentTypes() throws Exception { - // given - RollbackData data = new RollbackData(); - // when - data.put(TYPE_A, KEY_1, VALUE_1); - data.put(TYPE_B, KEY_1, VALUE_2); - // then - assertThat(data.get(TYPE_A, KEY_1)).isEqualTo(VALUE_1); - assertThat(data.get(TYPE_A)).containsExactly(entry(KEY_1, VALUE_1)); - assertThat(data.get(TYPE_B, KEY_1)).isEqualTo(VALUE_2); - assertThat(data.get(TYPE_B)).containsExactly(entry(KEY_1, VALUE_2)); - } -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java deleted file mode 100644 index 1346fde674..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java +++ /dev/null @@ -1,271 +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.bpmn.core; - -import static org.junit.Assert.assertNotNull; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.Expression; -import org.camunda.bpm.engine.test.Deployment; -import org.camunda.bpm.engine.test.ProcessEngineRule; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; - -import org.openecomp.mso.bpmn.core.utils.CamundaDBSetup; -import org.openecomp.mso.logger.MsoLogger; - -/** - * Unit test for BaseTask class. - */ -public class TestBaseTask { - - @Rule - public ProcessEngineRule processEngineRule = new ProcessEngineRule(); - - @BeforeClass - public static void setUpClass() { - System.setProperty("mso.config.path", "src/test/resources"); - PropertyConfiguration.resetPropertyConfigurationSingletonInstance(); - } - - @Before - public void beforeTest() throws Exception { - CamundaDBSetup.configure(); - PropertyConfigurationSetup.init(); - } - - @Test - @Deployment(resources={"BaseTaskTest.bpmn"}) - public void shouldInvokeService() { - Map variables = new HashMap<>(); - variables.put("firstName", "Jane"); - variables.put("lastName", "Doe"); - variables.put("age", 25); - variables.put("lastVisit", 1438270117000L); - - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - assertNotNull(runtimeService); - processEngineRule.getTaskService(); - runtimeService.startProcessInstanceByKey("BaseTaskTest", variables); - } - - /** - * Unit test code for BaseTask. - */ - public static class TestTask extends BaseTask { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private Expression existingString; - private Expression nonExistingString; - private Expression existingStringFromVar; - private Expression nonExistingStringFromVar; - - private Expression existingInteger; - private Expression nonExistingInteger; - private Expression existingIntegerFromVar; - private Expression nonExistingIntegerFromVar; - - private Expression existingLong; - private Expression nonExistingLong; - private Expression existingLongFromVar; - private Expression nonExistingLongFromVar; - - private Expression existingOutputVar; - private Expression nonExistingOutputVar; - private Expression existingBadOutputVar; - - public void execute(DelegateExecution execution) throws Exception { - msoLogger.debug("Started executing " + getClass().getSimpleName()); - - /*********************************************************************/ - msoLogger.debug("Running String Field Tests"); - /*********************************************************************/ - - String s = getStringField(existingString, execution, "existingString"); - Assert.assertEquals("Hello World", s); - - try { - s = getStringField(nonExistingString, execution, "nonExistingString"); - Assert.fail("Expected BadInjectedFieldException for nonExistingString"); - } catch (Exception e) { - if (!(e instanceof BadInjectedFieldException)) { - Assert.fail("Expected BadInjectedFieldException for nonExistingString"); - } - } - - s = getOptionalStringField(existingString, execution, "existingString"); - Assert.assertEquals("Hello World", s); - - s = getOptionalStringField(nonExistingString, execution, "nonExistingString"); - Assert.assertEquals(null, s); - - /*********************************************************************/ - msoLogger.debug("Running String Expression Tests"); - /*********************************************************************/ - - s = getStringField(existingStringFromVar, execution, "existingStringFromVar"); - Assert.assertEquals("Jane", s); - - try { - s = getStringField(nonExistingStringFromVar, execution, "nonExistingStringFromVar"); - Assert.fail("Expected BadInjectedFieldException for nonExistingString"); - } catch (Exception e) { - if (!(e instanceof BadInjectedFieldException)) { - Assert.fail("Expected BadInjectedFieldException for nonExistingStringFromVar"); - } - } - - s = getOptionalStringField(existingStringFromVar, execution, "existingStringFromVar"); - Assert.assertEquals("Jane", s); - - s = getOptionalStringField(nonExistingStringFromVar, execution, "nonExistingStringFromVar"); - Assert.assertEquals(null, s); - - /*********************************************************************/ - msoLogger.debug("Running Integer Field Tests"); - /*********************************************************************/ - - Integer i = getIntegerField(existingInteger, execution, "existingInteger"); - Assert.assertEquals((Integer)42, i); - - try { - i = getIntegerField(nonExistingInteger, execution, "nonExistingInteger"); - Assert.fail("Expected BadInjectedFieldException for nonExistingInteger"); - } catch (Exception e) { - if (!(e instanceof BadInjectedFieldException)) { - Assert.fail("Expected BadInjectedFieldException for nonExistingInteger"); - } - } - - i = getOptionalIntegerField(existingInteger, execution, "existingInteger"); - Assert.assertEquals((Integer)42, i); - - i = getOptionalIntegerField(nonExistingInteger, execution, "nonExistingInteger"); - Assert.assertEquals(null, i); - - /*********************************************************************/ - msoLogger.debug("Running Integer Expression Tests"); - /*********************************************************************/ - - i = getIntegerField(existingIntegerFromVar, execution, "existingIntegerFromVar"); - Assert.assertEquals((Integer)25, i); - - try { - i = getIntegerField(nonExistingIntegerFromVar, execution, "nonExistingIntegerFromVar"); - Assert.fail("Expected BadInjectedFieldException for nonExistingInteger"); - } catch (Exception e) { - if (!(e instanceof BadInjectedFieldException)) { - Assert.fail("Expected BadInjectedFieldException for nonExistingIntegerFromVar"); - } - } - - i = getOptionalIntegerField(existingIntegerFromVar, execution, "existingIntegerFromVar"); - Assert.assertEquals((Integer)25, i); - - i = getOptionalIntegerField(nonExistingIntegerFromVar, execution, "nonExistingIntegerFromVar"); - Assert.assertEquals(null, i); - - /*********************************************************************/ - msoLogger.debug("Running Long Field Tests"); - /*********************************************************************/ - - Long l = getLongField(existingLong, execution, "existingLong"); - Assert.assertEquals((Long)123456789L, l); - - try { - l = getLongField(nonExistingLong, execution, "nonExistingLong"); - Assert.fail("Expected BadInjectedFieldException for nonExistingLong"); - } catch (Exception e) { - if (!(e instanceof BadInjectedFieldException)) { - Assert.fail("Expected BadInjectedFieldException for nonExistingLong"); - } - } - - l = getOptionalLongField(existingLong, execution, "existingLong"); - Assert.assertEquals((Long)123456789L, l); - - l = getOptionalLongField(nonExistingLong, execution, "nonExistingLong"); - Assert.assertEquals(null, l); - - /*********************************************************************/ - msoLogger.debug("Running Long Expression Tests"); - /*********************************************************************/ - - l = getLongField(existingLongFromVar, execution, "existingLongFromVar"); - Assert.assertEquals((Long)1438270117000L, l); - - try { - l = getLongField(nonExistingLongFromVar, execution, "nonExistingLongFromVar"); - Assert.fail("Expected BadInjectedFieldException for nonExistingLong"); - } catch (Exception e) { - if (!(e instanceof BadInjectedFieldException)) { - Assert.fail("Expected BadInjectedFieldException for nonExistingLongFromVar"); - } - } - - l = getOptionalLongField(existingLongFromVar, execution, "existingLongFromVar"); - Assert.assertEquals((Long)1438270117000L, l); - - l = getOptionalLongField(nonExistingLongFromVar, execution, "nonExistingLongFromVar"); - Assert.assertEquals(null, i); - - /*********************************************************************/ - msoLogger.debug("Running Output Variable Field Tests"); - /*********************************************************************/ - - String var = getOutputField(existingOutputVar, execution, "existingOutputVar"); - Assert.assertEquals("goodVariable", var); - - try { - var = getOutputField(nonExistingOutputVar, execution, "nonExistingOutputVar"); - Assert.fail("Expected BadInjectedFieldException for nonExistingString"); - } catch (Exception e) { - if (!(e instanceof BadInjectedFieldException)) { - Assert.fail("Expected BadInjectedFieldException for nonExistingString"); - } - } - - var = getOptionalOutputField(existingOutputVar, execution, "existingOutputVar"); - Assert.assertEquals("goodVariable", var); - - var = getOptionalOutputField(nonExistingOutputVar, execution, "nonExistingOutputVar"); - Assert.assertEquals(null, var); - - try { - var = getOutputField(existingBadOutputVar, execution, "existingBadOutputVar"); - Assert.fail("Expected BadInjectedFieldException for nonExistingString"); - } catch (Exception e) { - if (!(e instanceof BadInjectedFieldException)) { - Assert.fail("Expected BadInjectedFieldException for nonExistingString"); - } - } - - msoLogger.debug("Finished executing " + getClass().getSimpleName()); - } - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/AllottedResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/AllottedResourceTest.java deleted file mode 100644 index 09720be9b9..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/AllottedResourceTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class AllottedResourceTest { - private AllottedResource ar = new AllottedResource(); - TunnelConnect tc = new TunnelConnect(); - - @Test - public void testAllottedResource() { - ar.setAllottedResourceType("allottedResourceType"); - ar.setAllottedResourceRole("allottedResourceRole"); - ar.setProvidingServiceModelName("providingServiceModelName"); - ar.setProvidingServiceModelInvariantUuid("providingServiceModelInvariantUuid"); - ar.setProvidingServiceModelUuid("providingServiceModelUuid"); - ar.setNfFunction("nfFunction"); - ar.setNfType("nfType"); - ar.setNfRole("nfRole"); - ar.setNfNamingCode("nfNamingCode"); - ar.setOrchestrationStatus("orchestrationStatus"); - ar.setTunnelConnect(tc); - assertEquals(ar.getAllottedResourceType(), "allottedResourceType"); - assertEquals(ar.getAllottedResourceRole(), "allottedResourceRole"); - assertEquals(ar.getProvidingServiceModelName(), "providingServiceModelName"); - assertEquals(ar.getProvidingServiceModelInvariantUuid(), "providingServiceModelInvariantUuid"); - assertEquals(ar.getProvidingServiceModelUuid(), "providingServiceModelUuid"); - assertEquals(ar.getNfFunction(), "nfFunction"); - assertEquals(ar.getNfType(), "nfType"); - assertEquals(ar.getNfRole(), "nfRole"); - assertEquals(ar.getNfNamingCode(), "nfNamingCode"); - assertEquals(ar.getOrchestrationStatus(), "orchestrationStatus"); - assertEquals(ar.getTunnelConnect(), tc); - - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResultTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResultTest.java deleted file mode 100644 index 90cb7362cf..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResultTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* -* ============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.openecomp.mso.bpmn.core.domain; - -import static org.junit.Assert.*; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Before; -import org.junit.Test; - -public class CompareModelsResultTest { - - private CompareModelsResult modelsResult; - private List addedResourceList; - private List deletedResourceList; - private ResourceModelInfo resourceModelInfo1; - private ResourceModelInfo resourceModelInfo2; - private List requestInputs; - - @Before - public void before() { - resourceModelInfo1 = new ResourceModelInfo(); - resourceModelInfo1.setResourceCustomizationUuid("f1d563e8-e714-4393-8f99-cc480144a05e"); - resourceModelInfo1.setResourceInvariantUuid("e1d563e8-e714-4393-8f99-cc480144a05f"); - resourceModelInfo1.setResourceName("resourceName1"); - resourceModelInfo1.setResourceUuid("f1d563e8-e714-4393-8f99-cc480144a05g"); - resourceModelInfo2 = new ResourceModelInfo(); - resourceModelInfo2.setResourceCustomizationUuid("a1d563e8-e714-4393-8f99-cc480144a05d"); - resourceModelInfo2.setResourceInvariantUuid("b1d563e8-e714-4393-8f99-cc480144a05e"); - resourceModelInfo2.setResourceName("resourceName2"); - resourceModelInfo2.setResourceUuid("c1d563e8-e714-4393-8f99-cc480144a05f"); - } - - @Test - public void testSetAddedResourceList() { - addedResourceList = new ArrayList(); - addedResourceList.add(resourceModelInfo1); - addedResourceList.add(resourceModelInfo2); - modelsResult = new CompareModelsResult(); - modelsResult.setAddedResourceList(addedResourceList); - assertEquals(addedResourceList, modelsResult.getAddedResourceList()); - } - - @Test - public void testSetDeletedResourceList() { - deletedResourceList = new ArrayList(); - deletedResourceList.add(resourceModelInfo1); - deletedResourceList.add(resourceModelInfo2); - modelsResult = new CompareModelsResult(); - modelsResult.setDeletedResourceList(deletedResourceList); - assertEquals(deletedResourceList, modelsResult.getDeletedResourceList()); - } - - @Test - public void testSetRequestInputs() { - requestInputs = new ArrayList(); - requestInputs.add("requestInput1"); - requestInputs.add("requestInput2"); - modelsResult = new CompareModelsResult(); - modelsResult.setRequestInputs(requestInputs); - assertEquals(requestInputs, modelsResult.getRequestInputs()); - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigResourceTest.java deleted file mode 100644 index ecaf601c90..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigResourceTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class ConfigResourceTest { - private ConfigResource configresource = new ConfigResource();{ - configresource.resourceType = ResourceType.CONFIGURATION; - } - - @Test - public void testConfigResource() { - configresource.setToscaNodeType("toscaNodeType"); - assertEquals(configresource.getToscaNodeType(), "toscaNodeType"); - - - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigurationTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigurationTest.java deleted file mode 100644 index df8440addf..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigurationTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class ConfigurationTest { - private Configuration configuration = new Configuration(); - - @Test - public void testConfigurationTest() { - configuration.setId("id"); - configuration.setName("name"); - configuration.setType("type"); - configuration.setOrchestrationStatus("orchestrationStatus"); - configuration.setTunnelBandwidth("tunnelBandwidth"); - configuration.setVendorAllowedMaxBandwidth("vendorAllowedMaxBandwidth"); - configuration.setResourceVersion("resourceVersion"); - assertEquals(configuration.getId(), "id"); - assertEquals(configuration.getName(), "name"); - assertEquals(configuration.getType(), "type"); - assertEquals(configuration.getOrchestrationStatus(), "orchestrationStatus"); - assertEquals(configuration.getTunnelBandwidth(), "tunnelBandwidth"); - assertEquals(configuration.getVendorAllowedMaxBandwidth(), "vendorAllowedMaxBandwidth"); - assertEquals(configuration.getResourceVersion(), "resourceVersion"); - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CustomerTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CustomerTest.java deleted file mode 100644 index 1a4e0898ee..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CustomerTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class CustomerTest { - private Customer customer = new Customer(); - - @Test - public void testCustomer() { - customer.setSubscriptionServiceType("subscriptionServiceType"); - customer.setGlobalSubscriberId("globalSubscriberId"); - assertEquals(customer.getSubscriptionServiceType(), "subscriptionServiceType"); - assertEquals(customer.getGlobalSubscriberId(), "globalSubscriberId"); - - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/HomingSolutionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/HomingSolutionTest.java deleted file mode 100644 index e334348b5d..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/HomingSolutionTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class HomingSolutionTest { - - private HomingSolution homingsolution = new HomingSolution(); - InventoryType inventory = InventoryType.cloud; - VnfResource vnfresource = new VnfResource(); - License license = new License(); - - @Test - public void testHomingSolution() { - homingsolution.setInventoryType(inventory); - homingsolution.setRehome(true); - homingsolution.setServiceInstanceId("serviceInstanceId"); - homingsolution.setCloudOwner("cloudOwner"); - homingsolution.setCloudRegionId("cloudRegionId"); - homingsolution.setAicClli("aicClli"); - homingsolution.setAicVersion("aicVersion"); - homingsolution.setTenant("tenant"); - homingsolution.setVnf(vnfresource); - homingsolution.setLicense(license); - assertEquals(homingsolution.getInventoryType(), inventory); - assertEquals(homingsolution.isRehome(), true); - assertEquals(homingsolution.getServiceInstanceId(), "serviceInstanceId"); - assertEquals(homingsolution.getCloudOwner(), "cloudOwner"); - assertEquals(homingsolution.getCloudRegionId(), "cloudRegionId"); - assertEquals(homingsolution.getAicClli(), "aicClli"); - assertEquals(homingsolution.getAicVersion(), "aicVersion"); - assertEquals(homingsolution.getTenant(), "tenant"); - assertEquals(homingsolution.getVnf(), vnfresource); - assertEquals(homingsolution.getLicense(), license); - - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/LicenseTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/LicenseTest.java deleted file mode 100644 index 9ed194c455..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/LicenseTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.BDDMockito.Then; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - - -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({License.class}) -public class LicenseTest { - - //@Mock - private License license= new License(); - //@InjectMocks - //private LicenseTest licenceTest; - List entitlementPoolList = new ArrayList(); - private List licenseKeyGroupList = new ArrayList(); - //JSONArray array = new JSONArray(entitlementPoolList); - //JSONArray array1 = new JSONArray(licenseKeyGroupList); - //@PrepareForTest({License.class}) - Long serialVersionUID = 333L; - - @Test - public void testLicense() { - license.setEntitlementPoolList(entitlementPoolList); - license.setLicenseKeyGroupList(licenseKeyGroupList); - //license.addEntitlementPool("entitlementPoolUuid"); - license.addLicenseKeyGroup("licenseKeyGroupUuid"); - assertEquals(license.getEntitlementPoolList(), entitlementPoolList); - assertEquals(license.getLicenseKeyGroupList(), licenseKeyGroupList); - assert(license.getEntitlementPoolListAsString()!= null); - assert(license.getLicenseKeyGroupListAsString()!=null); - license.addEntitlementPool("entitlementPoolUuid"); - //assertEquals(license.getSerialversionuid(), serialVersionUID); - //assertArrayEquals(license.getSerialversionuid(), serialVersionUID); - //assert - - /*PowerMockito.mockStatic(License.class); - Mockito.when(License.getSerialversionuid()).thenReturn(getserial()); - assertEquals(License.getSerialversionuid(),"abc");*/ - - } - // @Before - // public void mocksetUp() { -// Long serialVersionUID = 333L; -// PowerMockito.mockStatic(License.class); -// expect (license.getSerialversionuid()).andReturn(serialVersionUID); -// //PowerMockito.when(license.getSerialversionuid(). -// //PowerMockito.when(MathUtil.addInteger(2, 2)).thenReturn(1); -// } - - /*private Long getserial() { - - return abc; - }*/ - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModelInfoTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModelInfoTest.java deleted file mode 100644 index 90eb230a4c..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModelInfoTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class ModelInfoTest { - private ModelInfo modelinfo = new ModelInfo(); - - @Test - public void testModelInfo() { - modelinfo.setModelName("modelName"); - modelinfo.setModelUuid("modelUuid"); - modelinfo.setModelInvariantUuid("modelInvariantUuid"); - modelinfo.setModelVersion("modelVersion"); - modelinfo.setModelCustomizationUuid("modelCustomizationUuid"); - modelinfo.setModelInstanceName("modelInstanceName"); - modelinfo.setModelType("modelType"); - assertEquals(modelinfo.getModelName(), "modelName"); - assertEquals(modelinfo.getModelUuid(), "modelUuid"); - assertEquals(modelinfo.getModelInvariantUuid(), "modelInvariantUuid"); - assertEquals(modelinfo.getModelVersion(), "modelVersion"); - assertEquals(modelinfo.getModelCustomizationUuid(), "modelCustomizationUuid"); - assertEquals(modelinfo.getModelInstanceName(), "modelInstanceName"); - assertEquals(modelinfo.getModelType(), "modelType"); - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModuleResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModuleResourceTest.java deleted file mode 100644 index 58cd45c3f1..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModuleResourceTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class ModuleResourceTest { - private ModuleResource moduleresource = new ModuleResource(); - - @Test - public void testModuleResource() { - - moduleresource.setVfModuleName("vfModuleName"); - moduleresource.setHeatStackId("heatStackId"); - moduleresource.setIsBase(true); - moduleresource.setVfModuleLabel("vfModuleLabel"); - moduleresource.setInitialCount(0); - moduleresource.setVfModuleType("vfModuleType"); - moduleresource.setHasVolumeGroup(true); - assertEquals(moduleresource.getVfModuleName(), "vfModuleName"); - assertEquals(moduleresource.getHeatStackId(), "heatStackId"); - assertEquals(moduleresource.getIsBase(), true); - assertEquals(moduleresource.getVfModuleLabel(), "vfModuleLabel"); - assertEquals(moduleresource.getInitialCount(), 0); - assertEquals(moduleresource.getVfModuleType(), "vfModuleType"); - assertEquals(moduleresource.isHasVolumeGroup(), true); - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/NetworkResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/NetworkResourceTest.java deleted file mode 100644 index 22e62663c9..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/NetworkResourceTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class NetworkResourceTest { - private NetworkResource nr = new NetworkResource(); - - @Test - public void testNetworkResource() { - nr.setNetworkType("networkType"); - nr.setNetworkRole("networkRole"); - nr.setNetworkTechnology("networkTechnology"); - nr.setNetworkScope("networkScope"); - assertEquals(nr.getNetworkType(), "networkType"); - assertEquals(nr.getNetworkRole(), "networkRole"); - assertEquals(nr.getNetworkTechnology(), "networkTechnology"); - assertEquals(nr.getNetworkScope(), "networkScope"); - - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/OwningEntityTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/OwningEntityTest.java deleted file mode 100644 index 215fa3cff9..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/OwningEntityTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class OwningEntityTest { - private OwningEntity oe = new OwningEntity(); - - @Test - public void testOwingEntity() { - oe.setOwningEntityId("owningEntityId"); - oe.setOwningEntityName("owningEntityName"); - assertEquals(oe.getOwningEntityId(), "owningEntityId"); - assertEquals(oe.getOwningEntityName(), "owningEntityName"); - - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ProjectTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ProjectTest.java deleted file mode 100644 index 3a9a53f743..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ProjectTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class ProjectTest { - - private Project project = new Project(); - - @Test - public void testProject() { - project.setProjectName("projectName"); - assertEquals(project.getProjectName(), "projectName"); - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/RequestTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/RequestTest.java deleted file mode 100644 index 9a9d41567a..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/RequestTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class RequestTest { - - private Request request = new Request(); - ModelInfo model = new ModelInfo(); - - @Test - public void testRequest() { - request.setSdncRequestId("sdncRequestId"); - request.setRequestId("requestId"); - request.setModelInfo(model); - request.setProductFamilyId("productFamilyId"); - assertEquals(request.getSdncRequestId(), "sdncRequestId"); - assertEquals(request.getRequestId(), "requestId"); - assertEquals(request.getModelInfo(), model); - assertEquals(request.getProductFamilyId(), "productFamilyId"); - - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceDecompositionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceDecompositionTest.java deleted file mode 100644 index 5eaa60260b..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceDecompositionTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class ResourceDecompositionTest { - - private ResourceDecomposition rd = new ResourceDecomposition() { - private static final long serialVersionUID = 1L; - }; - ModelInfo model = new ModelInfo(); - ResourceInstance ri = new ResourceInstance(); - - - - @Test - public void testResourceDecomposition() { - rd.setModelInfo(model); - rd.setInstanceData(ri); - rd.setResourceType("resourceType"); - rd.setResourceInstanceId("newInstanceId"); - rd.setResourceInstanceName("newInstanceName"); - assertEquals(rd.getResourceModel(), model); - assertEquals(rd.getModelInfo(), model); - assertEquals(rd.getInstanceData(), ri); - assertEquals(rd.getResourceInstanceId(), "newInstanceId"); - assertEquals(rd.getResourceInstanceName(), "newInstanceName"); - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceTest.java deleted file mode 100644 index 8d6b61f4aa..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class ResourceTest { - private Resource resource = new Resource() { - private static final long serialVersionUID = 1L; - - - }; - ModelInfo model = new ModelInfo(); - ResourceInstance ri = new ResourceInstance(); - HomingSolution hs = new HomingSolution(); - ResourceType rt = ResourceType.VNF; - public long concurrencyCounter = 1L; - long initval = resource.getConcurrencyCounter(); - - @Test - public void testResource() { - resource.setResourceId("resourceId"); - resource.setModelInfo(model); - resource.setResourceInstance(ri); - resource.setHomingSolution(hs); - resource.setCurrentHomingSolution(hs); - resource.setResourceType(rt); - resource.setToscaNodeType("toscaNodeType"); - resource.setResourceInstanceId("newInstanceId"); - resource.setResourceInstanceName("newInstanceName"); - resource.incrementConcurrencyCounter(); - assertEquals(resource.getResourceId(), "resourceId"); - assertEquals(resource.getModelInfo(), model); - assertEquals(resource.getResourceInstance(), ri); - assertEquals(resource.getHomingSolution(), hs); - assertEquals(resource.getCurrentHomingSolution(), hs); - assertEquals(resource.getResourceType(), rt); - assertEquals(resource.getToscaNodeType(), "toscaNodeType"); - assertEquals(resource.getResourceInstanceId(), "newInstanceId"); - assertEquals(resource.getResourceInstanceName(), "newInstanceName"); - assertEquals(resource.getConcurrencyCounter(), initval+1); - - - - - - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceDecompositionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceDecompositionTest.java deleted file mode 100644 index 58548db23b..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceDecompositionTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import java.util.List; - -import org.junit.Test; - -public class ServiceDecompositionTest { - private ServiceDecomposition sd = new ServiceDecomposition(); - ModelInfo model= new ModelInfo(); - ServiceInstance si= new ServiceInstance(); - Project project= new Project(); - OwningEntity oe= new OwningEntity(); - //VnfResource vnf = new VnfResource(); - List vnfResources; - List networkResources; - List configResources; - List allottedResources; - Request request= new Request(); - Customer customer= new Customer(); - - - @Test - public void testServiceDecomposition() { - sd.setModelInfo(model); - sd.setServiceInstance(si); - sd.setProject(project); - sd.setOwningEntity(oe); - sd.setServiceVnfs(vnfResources); - sd.setServiceConfigs(configResources); - sd.setServiceNetworks(networkResources); - sd.setServiceAllottedResources(allottedResources); - sd.setServiceConfigResources(configResources); - sd.setServiceType("serviceType"); - sd.setServiceRole("serviceRole"); - sd.setRequest(request); - sd.setCustomer(customer); - sd.setCallbackURN("callbackURN"); - sd.setSdncVersion("sdncVersion"); - assertEquals(sd.getModelInfo(), model); - assertEquals(sd.getServiceInstance(), si); - assertEquals(sd.getProject(), project); - assertEquals(sd.getOwningEntity(), oe); - assertEquals(sd.getServiceVnfs(), vnfResources); - assertEquals(sd.getServiceConfigs(), configResources); - assertEquals(sd.getServiceNetworks(), networkResources); - assertEquals(sd.getServiceAllottedResources(), allottedResources); - assertEquals(sd.getServiceConfigResources(), configResources); - assertEquals(sd.getRequest(), request); - assertEquals(sd.getCustomer(), customer); - assertEquals(sd.getCallbackURN(), "callbackURN"); - assertEquals(sd.getSdncVersion(), "sdncVersion"); - - - - - - - - - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceInstanceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceInstanceTest.java deleted file mode 100644 index b600fef3fd..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceInstanceTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import java.util.Map; - -import org.junit.Test; - -public class ServiceInstanceTest { - - private ServiceInstance si= new ServiceInstance(); - Map serviceParams; - Configuration config= new Configuration(); - ModelInfo model= new ModelInfo(); - - @Test - public void testServiceInstance() { - si.setServiceType("serviceType"); - si.setServiceId("serviceId"); - si.setServiceParams(serviceParams); - si.setInstanceId("instanceId"); - si.setInstanceName("instanceName"); - si.setOrchestrationStatus("orchestrationStatus"); - si.setConfiguration(config); - si.setModelInfo(model); - si.setEnvironmentContext("environmentContext"); - si.setWorkloadContext("workloadContext"); - assertEquals(si.getServiceType(), "serviceType"); - assertEquals(si.getServiceId(), "serviceId"); - assertEquals(si.getServiceParams(), serviceParams); - assertEquals(si.getInstanceId(), "instanceId"); - assertEquals(si.getInstanceName(), "instanceName"); - assertEquals(si.getOrchestrationStatus(), "orchestrationStatus"); - assertEquals(si.getConfiguration(), config); - assertEquals(si.getModelInfo(), model); - assertEquals(si.getEnvironmentContext(), "environmentContext"); - assertEquals(si.getWorkloadContext(), "workloadContext"); - - - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/SubscriberTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/SubscriberTest.java deleted file mode 100644 index 7e9aef29a6..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/SubscriberTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class SubscriberTest { - Subscriber subscriber= new Subscriber("globalId", "name", "commonSiteId"); - - @Test - public void testSubscriber() { - subscriber.setGlobalId("globalId"); - subscriber.setName("name"); - subscriber.setCommonSiteId("commonSiteId"); - assertEquals(subscriber.getGlobalId(), "globalId"); - assertEquals(subscriber.getName(), "name"); - assertEquals(subscriber.getCommonSiteId(), "commonSiteId"); - - - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/TunnelConnectTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/TunnelConnectTest.java deleted file mode 100644 index 2a5639f0ff..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/TunnelConnectTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class TunnelConnectTest { - private TunnelConnect tc= new TunnelConnect(); - - @Test - public void testTunnelConnect() { - tc.setId("id"); - tc.setUpBandwidth("upBandwidth"); - tc.setDownBandwidth("downBandwidth"); - tc.setUpBandwidth2("upBandwidth2"); - tc.setDownBandwidth2("downBandwidth2"); - assertEquals(tc.getId(), "id"); - assertEquals(tc.getUpBandwidth(), "upBandwidth"); - assertEquals(tc.getDownBandwidth(), "downBandwidth"); - assertEquals(tc.getUpBandwidth2(), "upBandwidth2"); - assertEquals(tc.getDownBandwidth2(), "downBandwidth2"); - - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/VnfResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/VnfResourceTest.java deleted file mode 100644 index e476ef9fd5..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/VnfResourceTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.core.domain; - -import static org.junit.Assert.*; - -import java.util.List; - -import org.junit.Test; - -public class VnfResourceTest { - - private VnfResource vnf= new VnfResource(); - List moduleResources; - - @Test - public void testVnfResource() { - vnf.setModules(moduleResources); - vnf.setVnfHostname("vnfHostname"); - vnf.setVnfType("vnfType"); - vnf.setNfFunction("nfFunction"); - vnf.setNfType("nfType"); - vnf.setNfRole("nfRole"); - vnf.setNfNamingCode("nfNamingCode"); - vnf.setMultiStageDesign("multiStageDesign"); - assertEquals(vnf.getVfModules(), moduleResources); - assertEquals(vnf.getVnfHostname(), "vnfHostname"); - assertEquals(vnf.getVnfType(), "vnfType"); - assertEquals(vnf.getNfFunction(), "nfFunction"); - assertEquals(vnf.getNfType(), "nfType"); - assertEquals(vnf.getNfRole(), "nfRole"); - assertEquals(vnf.getNfNamingCode(), "nfNamingCode"); - assertEquals(vnf.getMultiStageDesign(), "multiStageDesign"); - - - } - -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java deleted file mode 100644 index 57f479f7cb..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java +++ /dev/null @@ -1,86 +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.bpmn.core.internal; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Optional; -import org.junit.Test; - -public class VariableNameExtractorTest { - - @Test - public void shouldExtractVariableName() throws Exception { - // given - String name = "A_different_NAME123"; - String variable = "${A_different_NAME123}"; - VariableNameExtractor extractor = new VariableNameExtractor(variable); - // when - Optional extracted = extractor.extract(); - // then - assertThat(extracted).isPresent().contains(name); - } - - @Test - public void shouldExtractVariableNameFromWhitespaces() throws Exception { - // given - String name = "name"; - String variable = " \n\t$ \n\t{ \n\tname \n\t} \n\t"; - VariableNameExtractor extractor = new VariableNameExtractor(variable); - // when - Optional extracted = extractor.extract(); - // then - assertThat(extracted).isPresent().contains(name); - } - - @Test - public void shouldReturnEmptyIfThereIsMoreThanVariable() throws Exception { - // given - String variable = "a ${test}"; - VariableNameExtractor extractor = new VariableNameExtractor(variable); - // when - Optional extracted = extractor.extract(); - // then - assertThat(extracted).isNotPresent(); - } - - @Test - public void shouldReturnEmptyIfVariableNameIsIncorrect() throws Exception { - // given - String variable = "${name with space}"; - VariableNameExtractor extractor = new VariableNameExtractor(variable); - // when - Optional extracted = extractor.extract(); - // then - assertThat(extracted).isNotPresent(); - } - - @Test - public void shouldReturnEmptyIfTwoVariablesPresent() throws Exception { - // given - String variable = "${var1} ${var2}"; - VariableNameExtractor extractor = new VariableNameExtractor(variable); - // when - Optional extracted = extractor.extract(); - // then - assertThat(extracted).isNotPresent(); - } -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsTest.java deleted file mode 100644 index 644f98349c..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsTest.java +++ /dev/null @@ -1,65 +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.bpmn.core.json; - -import static org.junit.Assert.assertEquals; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Map; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.json.JSONArray; -import org.json.JSONObject; -import org.junit.Test; -import org.mockito.Mock; - -public class JsonUtilsTest { - - @Mock public DelegateExecution execution; - private final String fileLocation = "src/test/resources/json-examples/"; - - @Test - public void jsonStringToMapTest() throws IOException { - - JsonUtils utils = new JsonUtils(); - String response = this.getJson("SDNCServiceResponseExample.json"); - String entry = utils.getJsonValue(response, "SDNCServiceResponse.params"); - Map map = utils.jsonStringToMap(execution, entry); - assertEquals(map.get("e2e-vpn-key"), "my-key"); - } - - @Test - public void entryArrayToMapTest() throws IOException { - JsonUtils utils = new JsonUtils(); - String response = this.getJson("SNIROExample.json"); - String entry = utils.getJsonValue(response, "solutionInfo.placement"); - JSONArray arr = new JSONArray(entry); - JSONObject homingDataJson = arr.getJSONObject(0); - JSONArray assignmentInfo = homingDataJson.getJSONArray("assignmentInfo"); - Map map = utils.entryArrayToMap(execution, assignmentInfo.toString(), "variableName", "variableValue"); - assertEquals(map.get("cloudOwner"), "att-aic"); - } - private String getJson(String filename) throws IOException { - return new String(Files.readAllBytes(Paths.get(fileLocation + filename))); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java deleted file mode 100644 index f29ccc75e0..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java +++ /dev/null @@ -1,114 +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.bpmn.core.utils; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -import org.openecomp.mso.logger.MsoLogger; - -/** - * Sets up the unit test (H2) database for Camunda. - */ -public class CamundaDBSetup { - private static boolean isDBConfigured = false; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private CamundaDBSetup() { - } - - public static synchronized void configure() throws SQLException { - if (isDBConfigured) { - return; - } - - LOGGER.debug ("Configuring the Camunda H2 database for MSO"); - - Connection connection = null; - PreparedStatement stmt = null; - - try { - connection = DriverManager.getConnection( - "jdbc:h2:mem:camunda;DB_CLOSE_DELAY=-1", "sa", ""); - - stmt = connection.prepareStatement("delete from ACT_HI_VARINST"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - - stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column TEXT_ clob"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - -// stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column NAME_ clob"); -// stmt.executeUpdate(); -// stmt.close(); -// stmt = null; - - stmt = connection.prepareStatement("delete from ACT_HI_DETAIL"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - - stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column TEXT_ clob"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - -// stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column NAME_ clob"); -// stmt.executeUpdate(); -// stmt.close(); -// stmt = null; - - stmt = connection.prepareStatement("ALTER TABLE ACT_RU_VARIABLE alter column TEXT_ clob"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - - connection.close(); - connection = null; - - isDBConfigured = true; - } catch (SQLException e) { - LOGGER.debug ("CamundaDBSetup caught " + e.getClass().getSimpleName()); - LOGGER.debug("SQLException :",e); - } finally { - if (stmt != null) { - try { - stmt.close(); - } catch (Exception e) { - LOGGER.debug("Exception :",e); - } - } - - if (connection != null) { - try { - connection.close(); - } catch (Exception e) { - LOGGER.debug("Exception :",e); - } - } - } - } -} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/test/resources/BaseTaskTest.bpmn b/bpmn/MSOCoreBPMN/src/test/resources/BaseTaskTest.bpmn index bb15ce2e5e..4d531d23e2 100644 --- a/bpmn/MSOCoreBPMN/src/test/resources/BaseTaskTest.bpmn +++ b/bpmn/MSOCoreBPMN/src/test/resources/BaseTaskTest.bpmn @@ -1,79 +1,79 @@ - - - - - SequenceFlow_1 - - - - - Hello World - - - ${firstName} - - - ${undefinedVariable} - - - 42 - - - ${age} - - - ${undefinedVariable} - - - 123456789 - - - ${lastVisit} - - - ${undefinedVariable} - - - goodVariable - - - bad Variable - - - SequenceFlow_1 - SequenceFlow_2 - - - - - SequenceFlow_2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + SequenceFlow_1 + + + + + Hello World + + + ${firstName} + + + ${undefinedVariable} + + + 42 + + + ${age} + + + ${undefinedVariable} + + + 123456789 + + + ${lastVisit} + + + ${undefinedVariable} + + + goodVariable + + + bad Variable + + + SequenceFlow_1 + SequenceFlow_2 + + + + + SequenceFlow_2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/test/resources/application-dev.yaml b/bpmn/MSOCoreBPMN/src/test/resources/application-dev.yaml new file mode 100644 index 0000000000..7aa9a26e63 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/resources/application-dev.yaml @@ -0,0 +1,5 @@ +log: + debug: + TestTask: 'true' + +testKey: 'testValue' \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/test/resources/camunda.cfg.xml b/bpmn/MSOCoreBPMN/src/test/resources/camunda.cfg.xml deleted file mode 100644 index bc218f0125..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/resources/camunda.cfg.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/AllottedResource.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/AllottedResource.json new file mode 100644 index 0000000000..9731e70dde --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/AllottedResource.json @@ -0,0 +1,6 @@ +{ + "allottedResource" : { + "resourceId" : "allottedResourceId", + "resourceType" : "ALLOTTED_RESOURCE" + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ConfigResource.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ConfigResource.json new file mode 100644 index 0000000000..412d13bcb6 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ConfigResource.json @@ -0,0 +1,6 @@ +{ + "configResource" : { + "resourceId" : "configResourceId", + "resourceType" : "CONFIGURATION" + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/NetworkResource.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/NetworkResource.json new file mode 100644 index 0000000000..57d3c5d70d --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/NetworkResource.json @@ -0,0 +1,6 @@ +{ + "networkResource" : { + "resourceId" : "networkResourceId", + "resourceType" : "NETWORK" + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SNIROExample.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SNIROExample.json index 7e56b1a59d..838bcd85a7 100644 --- a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SNIROExample.json +++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SNIROExample.json @@ -11,7 +11,7 @@ ] } ], - "placement": [ + "placementInfo": [ { "assignmentInfo": [ { diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecomposition.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecomposition.json new file mode 100644 index 0000000000..9acaabe2d1 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecomposition.json @@ -0,0 +1,22 @@ +{ + "serviceResources" : { + "modelInfo" : { + "modelName" : "modelName", + "modelUuid" : "modelUuid", + "modelInvariantUuid" : "modelInvariantUuid", + "modelVersion" : "modelVersion", + "modelCustomizationUuid" : "modelCustomizationUuid", + "modelCustomizationName" : "modelCustomizationName", + "modelInstanceName" : "modelInstanceName", + "modelType" : "modelType" + }, + "serviceType" : "serviceType", + "serviceRole" : "serviceRole", + "project" : {}, + "owningEntity" : {}, + "vnfResource" : [], + "networkResource" : [], + "allottedResource" : [], + "configResource" : [] + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecompositionExpected.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecompositionExpected.json new file mode 100644 index 0000000000..c424293ca2 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecompositionExpected.json @@ -0,0 +1,51 @@ +{ + "serviceResources" : { + "modelInfo" : { + "modelName" : "modelName", + "modelUuid" : "modelUuid", + "modelInvariantUuid" : "modelInvariantUuid", + "modelVersion" : "modelVersion", + "modelCustomizationUuid" : "modelCustomizationUuid", + "modelCustomizationName" : "modelCustomizationName", + "modelInstanceName" : "modelInstanceName", + "modelType" : "modelType" + }, + "serviceType" : "serviceType", + "serviceRole" : "serviceRole", + "project" : {}, + "owningEntity" : {}, + "serviceInstance" : { + "serviceInstanceId" : "serviceInstanceId" + }, + "serviceVnfs" : [ + { + "resourceId" : "vnfResourceId", + "resourceType" : "VNF", + "resourceInstance" : {}, + "homingSolution" : { + "license" : {}, + "rehome" : false + }, + "vfModules" : [] + } + ], + "networkResource" : [ + { + "resourceId" : "networkResourceId", + "resourceType" : "NETWORK" + } + ], + "serviceAllottedResources" : [ + { + "resourceId" : "allottedResourceId", + "resourceType" : "ALLOTTED_RESOURCE" + } + ], + "configResource" : [ + { + "resourceId" : "configResourceId", + "resourceType" : "CONFIGURATION" + } + ] + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/VnfResource.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/VnfResource.json new file mode 100644 index 0000000000..cd8c59d248 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/VnfResource.json @@ -0,0 +1,12 @@ +{ + "vnfResource" : { + "resourceId" : "vnfResourceId", + "resourceType" : "VNF", + "resourceInstance" : {}, + "homingSolution" : { + "license" : {}, + "rehome" : false + }, + "vfModules" : [] + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/resources/logback-test.xml b/bpmn/MSOCoreBPMN/src/test/resources/logback-test.xml index 92876fcb19..02ac437db6 100644 --- a/bpmn/MSOCoreBPMN/src/test/resources/logback-test.xml +++ b/bpmn/MSOCoreBPMN/src/test/resources/logback-test.xml @@ -39,7 +39,9 @@ - + + + diff --git a/bpmn/MSOCoreBPMN/src/test/resources/mso.bpmn.properties b/bpmn/MSOCoreBPMN/src/test/resources/mso.bpmn.properties deleted file mode 100644 index d329dbb207..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/resources/mso.bpmn.properties +++ /dev/null @@ -1,22 +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========================================================= -### - -URNMapping.FileSystemLoading.Enabled=true -testKey=testValue diff --git a/bpmn/MSOCoreBPMN/src/test/resources/mso.bpmn.urn.properties b/bpmn/MSOCoreBPMN/src/test/resources/mso.bpmn.urn.properties deleted file mode 100644 index 7fa587311a..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/resources/mso.bpmn.urn.properties +++ /dev/null @@ -1,21 +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========================================================= -### - -log.debug.TestTask=true diff --git a/bpmn/MSOCoreBPMN/src/test/resources/request.json b/bpmn/MSOCoreBPMN/src/test/resources/request.json index 8fa195b839..9513e81d6a 100644 --- a/bpmn/MSOCoreBPMN/src/test/resources/request.json +++ b/bpmn/MSOCoreBPMN/src/test/resources/request.json @@ -1,7 +1,7 @@ { "variables": { "bpmnRequest": { - "value": "\n \n d00eb185-b1d7-429e-aca3-42a61b459535\n Layer3ServiceActivateRequest\n OMX\n http://localhost:28080/simulada/CSI/SendManagedNetworkStatusNotification\n 19630501\n 1\n \n \n SDN-ETHERNET-INTERNET\n AA01|VLXM|003717||SW_INTERNET\n TEST_4306301\n \n \n \n 01|VLXM|121601/PT\n PointToPoint\n MTSNJA4LX01\n \n \n \n 10\n Mbps\n ds\n \n \n none\n \n primary\n \n \n 1\n 32.10.30.116\n 32\n \n \n \n \n 1\n 2507:0CB4:85A5:0030:0000:0000:0000:0010\n 48\n \n \n \n Y\n Y\n Y\n Y\n \n \n Y\n N\n \n \n Y\n Y\n \n \n \n \n \n\n", + "value": "\n \n d00eb185-b1d7-429e-aca3-42a61b459535\n Layer3ServiceActivateRequest\n OMX\n http://localhost:28080/simulada/CSI/SendManagedNetworkStatusNotification\n 19630501\n 1\n \n \n SDN-ETHERNET-INTERNET\n AA01|VLXM|003717||SW_INTERNET\n TEST_4306301\n \n \n \n 01|VLXM|121601/PT\n PointToPoint\n MTSNJA4LX01\n \n \n \n 10\n Mbps\n ds\n \n \n none\n \n primary\n \n \n 1\n 32.10.30.116\n 32\n \n \n \n \n 1\n 2507:0CB4:85A5:0030:0000:0000:0000:0010\n 48\n \n \n \n Y\n Y\n Y\n Y\n \n \n Y\n N\n \n \n Y\n Y\n \n \n \n \n \n\n", "type": "String" }, "host": { diff --git a/bpmn/MSOInfrastructureBPMN/WebContent/META-INF/MANIFEST.MF b/bpmn/MSOInfrastructureBPMN/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e9495128c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/bpmn/MSOInfrastructureBPMN/pom.xml b/bpmn/MSOInfrastructureBPMN/pom.xml deleted file mode 100644 index be2a1dacbe..0000000000 --- a/bpmn/MSOInfrastructureBPMN/pom.xml +++ /dev/null @@ -1,396 +0,0 @@ - - - org.onap.so - bpmn - 1.2.0-SNAPSHOT - - 4.0.0 - MSOInfrastructureBPMN - war - - - - - org.apache.maven.plugins - maven-war-plugin - 2.3 - - false - - - - org.apache.maven.plugins - maven-jar-plugin - 2.6 - - - default-jar - package - - jar - - - - org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.class - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.0.0 - - - - attach-artifact - - package - - - - ${project.build.directory}/${project.artifactId}-${project.version}.jar - jar - - - - - - - - org.apache.cxf - cxf-codegen-plugin - 2.5.2 - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - org.eclipse.jdt.groovy.core.groovyNature - - - **/*.groovy - - - - - maven-antrun-plugin - - - compile - compile - - - - - - - - - - - - - - run - - - - test-compile - test-compile - - - - - - - - - - - - - - run - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - maven-failsafe-plugin - 2.6 - - - - integration-test - verify - - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - org.apache.maven.plugins - - - maven-antrun-plugin - - - [1.3,) - - - run - - - - - - - - - - - - - - - - - - org.camunda.bpm - camunda-engine - compile - - - org.slf4j - slf4j-api - - - - - - - org.camunda.bpm - camunda-engine-cdi - - - com.google.guava - guava - 22.0 - - - - org.camunda.bpm.extension - camunda-bpm-assert - 2.0-alpha2 - test - - - - - org.camunda.spin - camunda-spin-dataformat-all - compile - - - camunda-spin-dataformat-all - org.camunda.spin - compile - - - org.camunda.bpm - camunda-engine-plugin-spin - compile - - - - org.camunda.bpm - camunda-engine-plugin-connect - compile - - - - - org.webjars - bootstrap - 2.3.2 - - - - com.h2database - h2 - test - - - - com.fasterxml.uuid - java-uuid-generator - - - org.codehaus.groovy - groovy-all - - - org.apache.commons - commons-lang3 - 3.4 - - - org.onap.so - MSOCoreBPMN - ${project.version} - - - org.onap.so - MSOCommonBPMN - ${project.version} - - - org.onap.so - MSOCommonBPMN - ${project.version} - tests - test - - - - org.onap.so - MSOCoreBPMN - ${project.version} - tests - test - - - javax.ws.rs - javax.ws.rs-api - 2.0 - - - - org.springframework - spring-web - 4.3.2.RELEASE - - - org.onap.so - MSORESTClient - ${project.version} - - - - javax.servlet - javax.servlet-api - 3.0.1 - provided - - - - - org.camunda.bpm - camunda-engine-spring - - - org.springframework - spring-beans - 4.3.2.RELEASE - - - - org.camunda.bpm.workbench - camunda-workbench-dist-embeddable - 1.0.0-alpha8 - test - - - - org.onap.msb.java-sdk - msb-java-sdk - 1.0.0 - - - com.eclipsesource.jaxrs - jersey-all - - - - - - - org.eclipse.jetty - jetty-util - 9.4.8.v20171121 - - - - org.hibernate - hibernate-validator - 5.4.2.Final - - - - org.springframework - spring-test - 4.3.14.RELEASE - - - - com.googlecode.libphonenumber - libphonenumber - 8.9.1 - - - org.assertj - assertj-core - 2.4.0 - test - - - org.springframework.boot - spring-boot-test - 1.4.2.RELEASE - test - - - ch.qos.logback - logback-classic - 1.2.3 - - - ch.qos.logback - logback-core - 1.2.3 - - - org.slf4j - slf4j-api - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy deleted file mode 100644 index e2a2de66d0..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - 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.openecomp.mso.bpmn.infrastructure.scripts - -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils - -/** - * This groovy class supports the ActivateSDNCCNetworkResource.bpmn process. - * flow for SDNC Network Resource Activate - */ -public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { - - String Prefix = "ACTSDNCRES_" - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - JsonUtils jsonUtil = new JsonUtils() - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started preProcessRequest *****", isDebugEnabled) - } - - public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** started prepareUpdateAfterActivateSDNCResource *****", isDebugEnabled) - } - - public void postCreateSDNCCall(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** started postCreateSDNCCall *****", isDebugEnabled) - } - - public void sendSyncResponse(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** started sendSyncResponse *****", isDebugEnabled) - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy deleted file mode 100644 index 3652d56303..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy +++ /dev/null @@ -1,278 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.infrastructure.scripts; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.ServiceInstance -import org.openecomp.mso.bpmn.core.domain.CompareModelsResult -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.UUID; -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.json.JSONArray; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; - -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource -/** - * This groovy class supports the CompareModelofE2EServiceInstance.bpmn process. - * - * Inputs: - * @param - msoRequestId - * @param - globalSubscriberId - * @param - subscriptionServiceType - * @param - serviceInstanceId - * @param - modelInvariantIdTarget - * @param - modelVersionIdTarget - - * - * Outputs: - * @param - WorkflowException - */ -public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcessor { - - String Prefix="CMPMDSI_" - private static final String DebugFlag = "isDebugEnabled" - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - String msg = "" - - utils.log("INFO", " *** preProcessRequest Request *** ", isDebugEnabled) - - try { - // check for incoming json message/input - String siRequest = execution.getVariable("bpmnRequest") - utils.logAudit(siRequest) - - - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("msoRequestId", requestId) - utils.log("INFO", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)) { - msg = "Input serviceInstanceId' is null" - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - //subscriberInfo - String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId") - if (isBlank(globalSubscriberId)) { - msg = "Input globalSubscriberId' is null" - utils.log("INFO", msg, isDebugEnabled) - } else { - execution.setVariable("globalSubscriberId", globalSubscriberId) - } - - //subscriptionServiceType - String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType") - if (isBlank(subscriptionServiceType)) { - msg = "Input subscriptionServiceType is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("serviceType", subscriptionServiceType) - } - - //modelInvariantIdTarget - String modelInvariantIdTarget = jsonUtil.getJsonValue(siRequest, "modelInvariantIdTarget") - if (isBlank(modelInvariantIdTarget)) { - msg = "Input modelInvariantIdTarget' is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("modelInvariantIdTarget", modelInvariantIdTarget) - } - - //modelVersionIdTarget - String modelVersionIdTarget = jsonUtil.getJsonValue(siRequest, "modelVersionIdTarget") - if (isBlank(modelVersionIdTarget)) { - msg = "Input modelVersionIdTarget is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("modelVersionIdTarget", modelVersionIdTarget) - } - - execution.setVariable("operationType", "CompareModel") - - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** sendSyncResponse *** ", isDebugEnabled) - - try { - CompareModelsResult compareModelsResult = execution.getVariable("compareModelsResult") - - // RESTResponse (for API Handler(APIH) Reply Task) - String syncResponse = compareModelsResult.toJsonStringNoRootName() - utils.log("INFO", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) - sendWorkflowResponse(execution, 202, syncResponse) - - } catch (Exception ex) { - String msg = "Exception in sendSyncResponse: " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," ***** Exit sendSyncResopnse *****", isDebugEnabled) - } - - public void sendSyncError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** sendSyncError *** ", isDebugEnabled) - - try { - String errorMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """ - ${errorMessage} - 7000 - """ - - utils.logAudit(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - - } catch (Exception ex) { - utils.log("INFO", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) - } - - } - - public void prepareCompletionRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** prepareCompletion *** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("msoRequestId") - String source = execution.getVariable("source") - String msoCompletionRequest = - """ - - ${requestId} - COMPAREMODEL - ${source} - - E2E Service Instance Compare model successfully. - CompareModelofE2EServiceInstance - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - execution.setVariable("completionRequest", xmlMsoCompletionRequest) - utils.log("INFO", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - - } catch (Exception ex) { - String msg = " Exception in prepareCompletion:" + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO", "*** Exit prepareCompletionRequest ***", isDebugEnabled) - } - - public void prepareFalloutRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** prepareFalloutRequest *** ", isDebugEnabled) - - try { - WorkflowException wfex = execution.getVariable("WorkflowException") - utils.log("INFO", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) - String requestId = execution.getVariable("msoRequestId") - String source = execution.getVariable("source") - String requestInfo = - """ - ${requestId} - COMPAREMODEL - ${source} - """ - - String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) - execution.setVariable("falloutRequest", falloutRequest) - } catch (Exception ex) { - utils.log("INFO", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) - String errorException = " Bpmn error encountered in CompareModelofE2EServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() - String requestId = execution.getVariable("msoRequestId") - String falloutRequest = - """ - - ${requestId} - COMPAREMODEL - UUI - - - ${errorException} - 7000 - - """ - - execution.setVariable("falloutRequest", falloutRequest) - } - utils.log("INFO", "*** Exit prepareFalloutRequest ***", isDebugEnabled) - } - -} - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy deleted file mode 100644 index e5f52a7406..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy +++ /dev/null @@ -1,425 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - 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.openecomp.mso.bpmn.infrastructure.scripts - -import org.json.JSONObject -import org.json.XML; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.recipe.ResourceInput; -import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.infrastructure.workflow.service.ServicePluginFactory -import java.util.UUID; - -import org.camunda.bpm.engine.runtime.Execution -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -/** - * This groovy class supports the CreateActivateSDNCResource.bpmn process. - * flow for SDNC Network Resource Create - */ -public class CreateActivateSDNCResource extends AbstractServiceTaskProcessor { - - String Prefix="CRESDNCRES_" - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - JsonUtils jsonUtil = new JsonUtils() - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - - public void preProcessRequest(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started preProcessRequest *****", isDebugEnabled) - try { - - //get bpmn inputs from resource request. - String requestId = execution.getVariable("mso-request-id") - String requestAction = execution.getVariable("requestAction") - utils.log("INFO","The requestAction is: " + requestAction, isDebugEnabled) - String recipeParamsFromRequest = execution.getVariable("recipeParams") - utils.log("INFO","The recipeParams is: " + recipeParamsFromRequest, isDebugEnabled) - String resourceInput = execution.getVariable("resourceInput") - utils.log("INFO","The resourceInput is: " + resourceInput, isDebugEnabled) - //Get ResourceInput Object - ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) - execution.setVariable(Prefix + "resourceInput", resourceInputObj) - - //Deal with recipeParams - String recipeParamsFromWf = execution.getVariable("recipeParamXsd") - String resourceName = resourceInputObj.getResourceInstanceName() - //For sdnc requestAction default is "createNetworkInstance" - String operationType = "Network" - String apiType = "network" - if(!StringUtils.isBlank(recipeParamsFromRequest)){ - //the operationType from worflow(first node) is second priority. - operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") - apiType = jsonUtil.getJsonValue(recipeParamsFromRequest, "apiType") - } - if(!StringUtils.isBlank(recipeParamsFromWf)){ - //the operationType from worflow(first node) is highest priority. - operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") - apiType = jsonUtil.getJsonValue(recipeParamsFromRequest, "apiType") - } - - execution.setVariable(Prefix + "operationType", operationType) - execution.setVariable(Prefix + "apiType", apiType) - execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) - execution.setVariable("mso-request-id", requestId) - execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) - //TODO Here build networkrequest - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - String msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - - String customizeResourceParam(String netowrkInputParametersJson) { - List> paramList = new ArrayList(); - JSONObject jsonObject = new JSONObject(netowrkInputParametersJson); - Iterator iterator = jsonObject.keys(); - while (iterator.hasNext()) { - String key = iterator.next(); - HashMap hashMap = new HashMap(); - hashMap.put("name", key); - hashMap.put("value", jsonObject.get(key)) - paramList.add(hashMap) - } - Map>> paramMap = new HashMap(); - paramMap.put("param", paramList); - - return new JSONObject(paramMap).toString(); - } - - public void prepareSDNCRequest (DelegateExecution execution) { - String svcAction = "create" - prepareSDNCRequestReq(execution, svcAction, "") - } - - - public void prepareSDNCActivateRequest (DelegateExecution execution) { - String svcAction = "activate" - String sndcResourceId = execution.getVariable(Prefix + "sdncResourceId") - prepareSDNCRequestReq(execution, svcAction, sndcResourceId) - } - /** - * Pre Process the BPMN Flow Request - * Inclouds: - * generate the nsOperationKey - * generate the nsParameters - */ - public void prepareSDNCRequestReq (DelegateExecution execution, String svcAction, String sdncResourceId) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled) - - try { - // get variables - String operationType = execution.getVariable(Prefix + "operationType") - String sdnc_apiType = execution.getVariable(Prefix + "apiType") - String sdnc_svcAction = svcAction - String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" - - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String createNetworkInput = execution.getVariable(Prefix + "networkRequest") - - String hdrRequestId = execution.getVariable("mso-request-id") - String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - String source = execution.getVariable("source") - String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") - String serviceType = resourceInputObj.getServiceType() - String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() - String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() - String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion() - String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName() - String globalCustomerId = resourceInputObj.getGlobalSubscriberId() - String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid(); - String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() - String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() - String modelName = resourceInputObj.getResourceModelInfo().getModelName() - String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() - String resourceInputPrameters = resourceInputObj.getResourceParameters() - String netowrkInputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") - //here convert json string to xml string - String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(netowrkInputParametersJson))) - - // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyCreateRequest = - """ - - ${hdrRequestId} - ${serviceInstanceId} - ${sdnc_svcAction} - ${sdnc_apiType}-topology-operation - sdncCallback - generic-resource - - - - ${hdrRequestId} - ${sdnc_requestAction} - ${source} - - - - - - ${serviceInstanceId} - ${serviceType} - - ${serviceModelInvariantUuid} - ${serviceModelUuid} - ${serviceModelVersion} - ${serviceModelName} - - ${serviceInstanceId} - ${globalCustomerId} - - <${sdnc_apiType}-information> - <${sdnc_apiType}-id>${sdncResourceId} - - ${modelInvariantUuid} - ${modelCustomizationUuid} - ${modelUuid} - ${modelVersion} - ${modelName} - - - <${sdnc_apiType}-request-input> - <${sdnc_apiType}-input-parameters>${netowrkInputParameters} - - - """.trim() - - String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) - utils.logAudit(sndcTopologyCreateRequesAsString) - execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString) - utils.log("INFO","sdncAdapterWorkflowRequest :" + sndcTopologyCreateRequesAsString, isDebugEnabled) - utils.log("DEBUG","sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString, isDebugEnabled) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) - } - - private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - execution.setVariable("CVFMI_updateResOperStatusRequest", body) - } - - public void prepareUpdateBeforeCreateSDNCResource(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareUpdateBeforeCreateSDNCResource *****", isDebugEnabled) - - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") - String operType = resourceInputObj.getOperationType() - String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() - String ServiceInstanceId = resourceInputObj.getServiceInstanceId() - String operationId = resourceInputObj.getOperationId() - String modelName = resourceInputObj.getResourceModelInfo().getModelName() - String progress = "20" - String status = "processing" - String statusDescription = "Create " + modelName - - execution.getVariable("operationId") - - String body = """ - - - - - ${operType} - ${operationId} - ${progress} - ${resourceCustomizationUuid} - ${ServiceInstanceId} - ${status} - ${statusDescription} - - - """; - - setProgressUpdateVariables(execution, body) - utils.log("INFO"," ***** End prepareUpdateBeforeCreateSDNCResource *****", isDebugEnabled) - } - - public void postCreateSDNC(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - ServicePluginFactory.getInstance().test() - utils.log("INFO"," ***** Started postCreateSDNC *****", isDebugEnabled) - String sdnc_apiType = execution.getVariable(Prefix + "apiType") - String sdncAdapterResponse = execution.getVariable("sdncAdapterResponse") - utils.log("INFO","sdncAdapterResponse for create:" + sdncAdapterResponse , isDebugEnabled) - sdncAdapterResponse = sdncAdapterResponse.replace("\n", "") - sdncAdapterResponse = sdncAdapterResponse.replaceAll('tag0:', '').replaceAll(':tag0', '') - utils.log("INFO","sdncAdapterResponse for create after replace:" + sdncAdapterResponse , isDebugEnabled) - //if it is vnf we need to query the vnf-id,if it is network , we need to query the network-id - String sdncRespData = utils.getNodeText1(sdncAdapterResponse, "RequestData") - utils.log("INFO","sdncRespData:" + sdncRespData , isDebugEnabled) - String objectKey = "/" + sdnc_apiType + "/" - String objectDataKey = "/" + sdnc_apiType + "-data/" - String objectPath = utils.getNodeText1(sdncRespData, "object-path") - - String resourceObjId = objectPath.substring(objectPath.indexOf(objectKey) + objectKey.length(), objectPath.indexOf(objectDataKey)) - utils.log("INFO", "resourceObjId:" + resourceObjId, isDebugEnabled) - execution.setVariable(Prefix + "sdncResourceId", resourceObjId) - - utils.log("INFO"," ***** End postCreateSDNC *****", isDebugEnabled) - - } - - public void postActivateSDNC(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started postActivateSDNC *****", isDebugEnabled) - String sdncAdapterResponse = execution.getVariable("sdncAdapterResponse") - utils.log("INFO","sdncAdapterResponse for activate:" + sdncAdapterResponse , isDebugEnabled) - utils.log("INFO"," ***** End postActivateSDNC *****", isDebugEnabled) - } - - public void prepareUpdateAfterCreateSDNCResource(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareUpdateAfterCreateSDNCResource *****", isDebugEnabled) - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") - String operType = resourceInputObj.getOperationType() - String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() - String ServiceInstanceId = resourceInputObj.getServiceInstanceId() - String modelName = resourceInputObj.getResourceModelInfo().getModelName() - String operationId = resourceInputObj.getOperationId() - String progress = "50" - String status = "processing" - String statusDescription = "Instantiate " + modelName - - execution.getVariable("operationId") - - String body = """ - - - - - ${operType} - ${operationId} - ${progress} - ${resourceCustomizationUuid} - ${ServiceInstanceId} - ${status} - ${statusDescription} - - - """; - - setProgressUpdateVariables(execution, body) - utils.log("INFO"," ***** End prepareUpdateAfterCreateSDNCResource *****", isDebugEnabled) - } - - public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareUpdateAfterActivateSDNCResource *****", isDebugEnabled) - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") - String operType = resourceInputObj.getOperationType() - String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() - String ServiceInstanceId = resourceInputObj.getServiceInstanceId() - String modelName = resourceInputObj.getResourceModelInfo().getModelName() - String operationId = resourceInputObj.getOperationId() - String progress = "100" - String status = "finished" - String statusDescription = "Instantiate " + modelName + " finished" - - execution.getVariable("operationId") - - String body = """ - - - - - ${operType} - ${operationId} - ${progress} - ${resourceCustomizationUuid} - ${ServiceInstanceId} - ${status} - ${statusDescription} - - - """; - - setProgressUpdateVariables(execution, body) - utils.log("INFO"," ***** End prepareUpdateAfterActivateSDNCResource *****", isDebugEnabled) - } - - public void postCreateSDNCCall(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled) - String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode") - String responseObj = execution.getVariable(Prefix + "SuccessIndicator") - - utils.log("INFO","response from sdnc, response code :" + responseCode + " response object :" + responseObj, isDebugEnabled) - utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) - - try { - String operationStatus = "finished" - // RESTResponse for main flow - String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) - sendWorkflowResponse(execution, 202, resourceOperationResp) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy deleted file mode 100644 index 3903e12ba2..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy +++ /dev/null @@ -1,344 +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.bpmn.infrastructure.scripts; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil - -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils - -/** - * This groovy class supports the CreateServiceInstance.bpmn process. - * AlaCarte flow for 1702 ServiceInstance Create - * - */ -public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor { - String Prefix="CRESI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - String msg = "" - utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled) - - try { - - String siRequest = execution.getVariable("bpmnRequest") - utils.logAudit(siRequest) - - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("msoRequestId", requestId) - utils.log("DEBUG", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)) { - serviceInstanceId = UUID.randomUUID().toString() - } - utils.log("DEBUG", "Generated new Service Instance:" + serviceInstanceId, isDebugEnabled) - serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceInstanceId) - - //subscriberInfo - String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") - if (isBlank(globalSubscriberId)) { - msg = "Input globalSubscriberId' is null" - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("globalSubscriberId", globalSubscriberId) - } - - //requestInfo - execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")) - execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")) - execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback")) - String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") - if (isBlank(productFamilyId)) - { - msg = "Input productFamilyId is null" - utils.log("DEBUG", msg, isDebugEnabled) - //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("productFamilyId", productFamilyId) - } - - //modelInfo - String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") - if (isBlank(serviceModelInfo)) { - msg = "Input serviceModelInfo is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else - { - execution.setVariable("serviceModelInfo", serviceModelInfo) - } - - utils.log("DEBUG", "modelInfo" + serviceModelInfo, isDebugEnabled) - - //requestParameters - String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") - if (isBlank(subscriptionServiceType)) { - msg = "Input subscriptionServiceType is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - } - - - /* - * Extracting User Parameters from incoming Request and converting into a Map - */ - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - - Map reqMap = jsonSlurper.parseText(siRequest) - - //InputParams - def userParamsList = reqMap.requestDetails?.requestParameters?.userParams - - Map inputMap = [:] - if (userParamsList) { - for (def i=0; i inputMap.put(param.key, param.value)} - } - } - - - utils.log("DEBUG", "User Input Parameters map: " + inputMap.toString(), isDebugEnabled) - execution.setVariable("serviceInputParams", inputMap) - execution.setVariable("uuiRequest", inputMap.get("UUIRequest")) - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - //TODO - //execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams")) - //execution.setVariable("failExists", true) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) - - try { - String operationId = execution.getVariable("operationId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - // RESTResponse for API Handler (APIH) Reply Task - String createServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + createServiceRestRequest, isDebugEnabled) - sendWorkflowResponse(execution, 202, createServiceRestRequest) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) - } - - - public void sendSyncError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncError *** ", isDebugEnabled) - - try { - String errorMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """ - ${errorMessage} - 7000 - """ - - utils.logAudit(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - - } catch (Exception ex) { - utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) - } - - } - - public void prepareCompletionRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** prepareCompletion *** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String source = execution.getVariable("source") - - String msoCompletionRequest = - """ - - ${requestId} - CREATE - ${source} - - Service Instance was created successfully. - ${serviceInstanceId} - CreateGenericALaCarteServiceInstance - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - execution.setVariable("completionRequest", xmlMsoCompletionRequest) - utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - - } catch (Exception ex) { - String msg = " Exception in prepareCompletion:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG", "*** Exit prepareCompletionRequest ***", isDebugEnabled) - } - - public void prepareFalloutRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** prepareFalloutRequest *** ", isDebugEnabled) - - try { - WorkflowException wfex = execution.getVariable("WorkflowException") - utils.log("DEBUG", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) - String requestId = execution.getVariable("msoRequestId") - String source = execution.getVariable("source") - String requestInfo = - """ - ${requestId} - CREATE - ${source} - """ - - String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) - execution.setVariable("falloutRequest", falloutRequest) - } catch (Exception ex) { - utils.log("DEBUG", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) - String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() - String requestId = execution.getVariable("msoRequestId") - String falloutRequest = - """ - - ${requestId} - CREATE - UUI - - - ${errorException} - 7000 - - """ - - execution.setVariable("falloutRequest", falloutRequest) - } - utils.log("DEBUG", "*** Exit prepareFalloutRequest ***", isDebugEnabled) - } - - /** - * Init the service Operation Status - */ - public void prepareInitServiceOperationStatus(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) - try{ - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = UUID.randomUUID().toString() - String operationType = "CREATE" - String userId = "" - String result = "processing" - String progress = "0" - String reason = "" - String operationContent = "Prepare service creation" - utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) - serviceId = UriUtils.encode(serviceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceId) - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", operationType) - - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) - - String payload = - """ - - - - ${serviceId} - ${operationId} - ${operationType} - ${userId} - ${result} - ${operationContent} - ${progress} - ${reason} - - - """ - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) - utils.logAudit("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) - execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) - } - utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy deleted file mode 100644 index 0de28f77ce..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy +++ /dev/null @@ -1,359 +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.bpmn.infrastructure.scripts; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils -import org.json.JSONException; - -/** - * This groovy class supports the CreateGenericALaCarteServiceInstance.bpmn process. - * AlaCarte flow for 1702 ServiceInstance Create - * - */ -public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskProcessor { - String Prefix="CRESI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - String msg = "" - utils.log("DEBUG", " *** preProcessRequest() of CreateGenericALaCarteServiceInstance *** ", isDebugEnabled) - - try { - - String siRequest = execution.getVariable("bpmnRequest") - utils.logAudit(siRequest) - - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("msoRequestId", requestId) - utils.log("DEBUG", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)) { - serviceInstanceId = UUID.randomUUID().toString() - utils.log("DEBUG", "Generated new Service Instance ID:" + serviceInstanceId, isDebugEnabled) - } else { - utils.log("DEBUG", "Using provided Service Instance ID:" + serviceInstanceId, isDebugEnabled) - } - - serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceInstanceId) - - //subscriberInfo - String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") - if (isBlank(globalSubscriberId)) { - msg = "Input globalSubscriberId' is null" - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("globalSubscriberId", globalSubscriberId) - } - - //requestInfo - execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")) - execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")) - execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback")) - String productFamilyId = null; - try { - productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") - } catch (JSONException e) { - productFamilyId = null; - } - if (isBlank(productFamilyId)) - { - msg = "Input productFamilyId is null" - utils.log("DEBUG", msg, isDebugEnabled) - //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("productFamilyId", productFamilyId) - } - - //modelInfo - String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") - if (isBlank(serviceModelInfo)) { - msg = "Input serviceModelInfo is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else - { - execution.setVariable("serviceModelInfo", serviceModelInfo) - } - - utils.log("DEBUG", "modelInfo" + serviceModelInfo, isDebugEnabled) - - //requestParameters - String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") - if (isBlank(subscriptionServiceType)) { - msg = "Input subscriptionServiceType is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - } - - - /* - * Extracting User Parameters from incoming Request and converting into a Map - */ - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - - Map reqMap = jsonSlurper.parseText(siRequest) - - //InputParams - def userParams = reqMap.requestDetails?.requestParameters?.userParams - - Map inputMap = [:] - if (userParams) { - userParams.each { - userParam -> inputMap.put(userParam.name, userParam.value.toString()) - } - } - - utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) - execution.setVariable("serviceInputParams", inputMap) - - //TODO - //execution.setVariable("failExists", true) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest of CreateGenericALaCarteServiceInstance *****", isDebugEnabled) - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - // RESTResponse for API Handler (APIH) Reply Task - String createServiceRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + createServiceRestRequest, isDebugEnabled) - sendWorkflowResponse(execution, 202, createServiceRestRequest) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) - } - - - public void sendSyncError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncError *** ", isDebugEnabled) - - try { - String errorMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """ - ${errorMessage} - 7000 - """ - - utils.logAudit(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - - } catch (Exception ex) { - utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) - } - - } - - // ******************************* - // - // ******************************* - public void prepareDecomposeService(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ***** Inside prepareDecomposeService of CreateGenericALaCarteServiceInstance ***** ", isDebugEnabled) - try { - String siRequest = execution.getVariable("bpmnRequest") - String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") - execution.setVariable("serviceModelInfo", serviceModelInfo) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - utils.log("DEBUG", " ***** Completed prepareDecomposeService of CreateGenericALaCarteServiceInstance ***** ", isDebugEnabled) - } - - - // ******************************* - // - // ******************************* - public void prepareCreateServiceInstance(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - try { - utils.log("DEBUG", " ***** Inside prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ", isDebugEnabled) - - /* - * Extracting User Parameters from incoming Request and converting into a Map - */ - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - def siRequest = execution.getVariable("bpmnRequest") - Map reqMap = jsonSlurper.parseText(siRequest) - //InputParams - def userParams = reqMap.requestDetails?.requestParameters?.userParams - Map inputMap = [:] - if (userParams != null) { - userParams.each { - userParam -> inputMap.put(userParam.name, userParam.value) - } - } - - utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) - execution.setVariable("serviceInputParams", inputMap) - - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - serviceDecomposition.getServiceInstance().setInstanceId(serviceInstanceId) - - String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName") - serviceDecomposition.getServiceInstance().setInstanceName(serviceInstanceName) - execution.setVariable("serviceInstanceName", serviceInstanceName) - execution.setVariable("serviceDecomposition", serviceDecomposition) - execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString()) - utils.log("DEBUG", "serviceDecomposition.serviceInstanceName: " + serviceDecomposition.getServiceInstance().getInstanceName(), isDebugEnabled) - - utils.log("DEBUG", " ***** Completed prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - - public void prepareCompletionRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** prepareCompletion *** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String source = execution.getVariable("source") - - String msoCompletionRequest = - """ - - ${requestId} - CREATE - ${source} - - Service Instance was created successfully. - ${serviceInstanceId} - CreateGenericALaCarteServiceInstance - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - execution.setVariable("completionRequest", xmlMsoCompletionRequest) - utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - - } catch (Exception ex) { - String msg = " Exception in prepareCompletion:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG", "*** Exit prepareCompletionRequest ***", isDebugEnabled) - } - - public void prepareFalloutRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** prepareFalloutRequest *** ", isDebugEnabled) - - try { - WorkflowException wfex = execution.getVariable("WorkflowException") - utils.log("DEBUG", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) - String requestId = execution.getVariable("msoRequestId") - String source = execution.getVariable("source") - String requestInfo = - """ - ${requestId} - CREATE - ${source} - """ - - String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) - execution.setVariable("falloutRequest", falloutRequest) - } catch (Exception ex) { - utils.log("DEBUG", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) - String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() - String requestId = execution.getVariable("msoRequestId") - String falloutRequest = - """ - - ${requestId} - CREATE - VID - - - ${errorException} - 7000 - - """ - - execution.setVariable("falloutRequest", falloutRequest) - } - utils.log("DEBUG", "*** Exit prepareFalloutRequest ***", isDebugEnabled) - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy deleted file mode 100644 index 5f7d1e3452..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy +++ /dev/null @@ -1,457 +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.bpmn.infrastructure.scripts; - -import groovy.xml.XmlUtil -import groovy.json.* -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils - -/** - * This groovy class supports the CreateNetworkInstance.bpmn process. - * - */ -public class CreateNetworkInstance extends AbstractServiceTaskProcessor { - String Prefix="CRENI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public InitializeProcessVariables(DelegateExecution execution){ - - execution.setVariable(Prefix + "source", "") - execution.setVariable(Prefix + "Success", false) - - execution.setVariable(Prefix + "CompleteMsoProcessRequest", "") - execution.setVariable(Prefix + "FalloutHandlerRequest", "") - execution.setVariable(Prefix + "isSilentSuccess", false) - - } - - - /** - * This method is executed during the preProcessRequest task of the CreateNetworkInstance.bpmn process. - * @param execution - */ - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - /** - * This method is executed during the preProcessRequest task of the CreateNetworkInstance.bpmn process. - * @param execution - */ - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest() of CreateNetworkInstance Request ***** ", isDebugEnabled) - - try { - // initialize flow variables - InitializeProcessVariables(execution) - - String sdncVersion = execution.getVariable("sdncVersion") - if (sdncVersion == null || sdncVersion == '1610') { - // 'a-la-cart' default, sdncVersion = '1610' - execution.setVariable("sdncVersion", "1610") - String bpmnRequest = execution.getVariable("bpmnRequest") - // set 'disableRollback' - if (bpmnRequest != null) { - String disableRollback = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.requestInfo.suppressRollback") - if (disableRollback != null) { - execution.setVariable("disableRollback", disableRollback) - utils.log("DEBUG", "Received 'suppressRollback': " + disableRollback , isDebugEnabled) - } else { - execution.setVariable("disableRollback", false) - } - utils.log("DEBUG", " Set 'disableRollback' : " + execution.getVariable("disableRollback") , isDebugEnabled) - } else { - String dataErrorMessage = " Invalid 'bpmnRequest' request." - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - } else { - // 'macro' TEST ONLY, sdncVersion = '1702' - utils.log("DEBUG", " 'disableRollback' : " + execution.getVariable("disableRollback") , isDebugEnabled) - } - - // get/set 'msoRequestId' and 'mso-request-id' - String requestId = execution.getVariable("msoRequestId") - if (requestId != null) { - execution.setVariable("mso-request-id", requestId) - } else { - requestId = execution.getVariable("mso-request-id") - } - execution.setVariable(Prefix + "requestId", requestId) - - // get/set 'requestId' - if (execution.getVariable("requestId") == null) { - execution.setVariable("requestId", requestId) - } - - //Place holder for additional code. - - // TODO ??? - // userParams??? 1) pre-loads indicator, 2) 'auto-activation' - // Tag/Value parameters - // - // Map: 'networkInputParams': 'auto-activation'' - // Sample format? - // "requestParameters": { - // "userParams": [ - // { - // "name": "someUserParam1", - // "value": "someValue1" - // } - // ] - // } - // - // String userParams = //use json util to extract "userParams"// - // execution.setVariable("networkInputParams", userParams) - // else: execution.setVariable("networkInputParams", null) - // - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex){ - sendSyncError(execution) - // caught exception - String exceptionMessage = "Exception Encountered in CreateNetworkInstance, PreProcessRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside sendSyncResponse() of CreateNetworkInstance ***** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("mso-request-id") - - // RESTResponse (for API Handler (APIH) Reply Task) - String createNetworkRestRequest = """{"requestReferences":{"instanceId":"","requestId":"${requestId}"}}""".trim() - - utils.log("DEBUG", " sendSyncResponse to APIH - " + "\n" + createNetworkRestRequest, isDebugEnabled) - sendWorkflowResponse(execution, 202, createNetworkRestRequest) - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in CreateNetworkInstance flow. sendSyncResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - } - - - public void getNetworkModelInfo (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside getNetworkModelInfo() of CreateNetworkInstance ***** ", isDebugEnabled) - - try { - - // For Ala-Carte (sdnc = 1610): - // 1. the Network ModelInfo is expected to be sent - // via requestDetails.modelInfo (modelType = network). - // 2. the Service ModelInfo is expected to be sent but will be IGNORE - // via requestDetails.relatedInstanceList.relatedInstance.modelInfo (modelType = service) - - } catch (Exception ex) { - sendSyncError(execution) - String exceptionMessage = "Bpmn error encountered in CreateNetworkInstance flow. getNetworkModelInfo() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - public void sendSyncError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside sendSyncError() of CreateNetworkInstance ***** ", isDebugEnabled) - - try { - - String requestId = execution.getVariable("mso-request-id") - - // REST Error (for API Handler (APIH) Reply Task) - String syncError = """{"requestReferences":{"instanceId":"","requestId":"${requestId}"}}""".trim() - - sendWorkflowResponse(execution, 500, syncError) - - } catch (Exception ex) { - utils.log("DEBUG", " Bpmn error encountered in CreateNetworkInstance flow. sendSyncError() - " + ex.getMessage(), isDebugEnabled) - } - - } - - public void prepareDBRequestError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - try { - utils.log("DEBUG", " ***** Inside prepareDBRequestError() of CreateNetworkInstance ***** ", isDebugEnabled) - - // set DB Header Authorization - setBasicDBAuthHeader(execution, isDebugEnabled) - - String statusMessage = "" - WorkflowException wfe = null - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - wfe = execution.getVariable("WorkflowException") - statusMessage = wfe.getErrorMessage() - } - - String requestId = execution.getVariable(Prefix + "requestId") - String networkName = execution.getVariable("networkName") !=null ? execution.getVariable("networkName") : "" - String networkId = execution.getVariable("networkId") !=null ? execution.getVariable("networkId") : "" - String dbRequest = - """ - - - - ${requestId} - BPMN - ${statusMessage} - - FAILED - <network-id>${networkId}</network-id><network-name>${networkName}</network-names> - - - """ - - execution.setVariable(Prefix + "createDBRequest", dbRequest) - utils.log("DEBUG", " DB Adapter Request - " + "\n" + dbRequest, isDebugEnabled) - utils.logAudit(dbRequest) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. prepareDBRequestError() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareCompletion (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareCompletion() of CreateNetworkInstance ***** ", isDebugEnabled) - - try { - - String requestId = execution.getVariable("mso-request-id") - String source = execution.getVariable(Prefix + "source") - - String msoCompletionRequest = - """ - - ${requestId} - CREATE - VID - - Network has been created successfully. - BPMN Network action: CREATE - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - // normal path - execution.setVariable(Prefix + "Success", true) - execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) - utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. prepareCompletion() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - - } - - - - - // ************************************************** - // Post or Validate Response Section - // ************************************************** - - public void postProcessResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside postProcessResponse() of CreateNetworkInstance ***** ", isDebugEnabled) - - try { - - if (execution.getVariable("CMSO_ResponseCode") == "200") { - execution.setVariable(Prefix + "Success", true) - utils.log("DEBUG", " ***** CreateNetworkInstance Success ***** ", isDebugEnabled) - // Place holder for additional code. - - } else { - execution.setVariable(Prefix + "Success", false) - utils.log("DEBUG", " ***** CreateNetworkInstance Failed in CompletionMsoProces flow!. ***** ", isDebugEnabled) - - } - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - // ******************************* - // Build Error Section - // ******************************* - - public void processRollbackData (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside processRollbackData() of CreateNetworkInstance ***** ", isDebugEnabled) - - try { - //execution.getVariable("orchestrationStatus") - //execution.getVariable("networkId") - //execution.getVariable("networkName") - //networkOutputParams - //rollbackData - //rolledBack - - } catch (Exception ex) { - utils.log("DEBUG", " Bpmn error encountered in CreateNetworkInstance flow. callDBCatalog() - " + ex.getMessage(), isDebugEnabled) - } - - } - - // Prepare for FalloutHandler - public void buildErrorResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", "DB updateInfraRequest ResponseCode: " + execution.getVariable(Prefix + "dbReturnCode"), isDebugEnabled) - utils.log("DEBUG", "DB updateInfraRequest Response: " + execution.getVariable(Prefix + "createDBResponse"), isDebugEnabled) - - utils.log("DEBUG", " ***** Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler. *****", isDebugEnabled) - - String falloutHandlerRequest = "" - String requestId = execution.getVariable("mso-request-id") - - try { - - WorkflowException wfe = execution.getVariable("WorkflowException") - String errorCode = String.valueOf(wfe.getErrorCode()) - String errorMessage = wfe.getErrorMessage() - falloutHandlerRequest = - """ - - ${requestId} - CREATE - VID - - - ${errorMessage} - ${errorCode} - - """ - - utils.logAudit(falloutHandlerRequest) - execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - utils.log("DEBUG", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) - - } catch (Exception ex) { - String errorException = " Bpmn error encountered in CreateNetworkInstance flow. FalloutHandlerRequest, buildErrorResponse()" - utils.log("DEBUG", "Exception error in CreateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage(), isDebugEnabled) - falloutHandlerRequest = - """ - - ${requestId} - CREATE - VID - - - ${errorException} - 7000 - - """ - - execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - utils.log("DEBUG", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) - - } - - } - - public void processJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - try{ - utils.log("DEBUG", "Caught a Java Exception in " + Prefix, isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) - } - utils.log("DEBUG", "Completed processJavaException Method in " + Prefix, isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy deleted file mode 100644 index 43b32a4d85..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ /dev/null @@ -1,341 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - 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.openecomp.mso.bpmn.infrastructure.scripts - -import org.json.JSONObject -import org.json.XML; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.recipe.ResourceInput; -import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.rest.APIResponse; - -/** - * This groovy class supports the CreateSDNCCNetworkResource.bpmn process. - * flow for SDNC Network Resource Create - */ -public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { - - String Prefix="CRESDNCRES_" - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - JsonUtils jsonUtil = new JsonUtils() - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - - public void preProcessRequest(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started preProcessRequest *****", isDebugEnabled) - try { - - //get bpmn inputs from resource request. - String requestId = execution.getVariable("mso-request-id") - String requestAction = execution.getVariable("requestAction") - utils.log("INFO","The requestAction is: " + requestAction, isDebugEnabled) - String recipeParamsFromRequest = execution.getVariable("recipeParams") - utils.log("INFO","The recipeParams is: " + recipeParamsFromRequest, isDebugEnabled) - String resourceInput = execution.getVariable("resourceInput") - utils.log("INFO","The resourceInput is: " + resourceInput, isDebugEnabled) - //Get ResourceInput Object - ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) - execution.setVariable(Prefix + "resourceInput", resourceInputObj) - - //Deal with recipeParams - String recipeParamsFromWf = execution.getVariable("recipeParamXsd") - String resourceName = resourceInputObj.getResourceInstanceName() - //For sdnc requestAction default is "createNetworkInstance" - String operationType = "Network" - if(!StringUtils.isBlank(recipeParamsFromRequest)){ - //the operationType from worflow(first node) is second priority. - operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") - } - if(!StringUtils.isBlank(recipeParamsFromWf)){ - //the operationType from worflow(first node) is highest priority. - operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") - } - - - //For sdnc, generate svc_action and request_action - String sdnc_svcAction = "create" - if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "overlay")){ - //This will be resolved in R3. - sdnc_svcAction ="activate" - operationType = "NCINetwork" - } - if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "underlay")){ - //This will be resolved in R3. - operationType ="Network" - } - String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" - execution.setVariable(Prefix + "svcAction", sdnc_svcAction) - execution.setVariable(Prefix + "requestAction", sdnc_requestAction) - execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) - execution.setVariable("mso-request-id", requestId) - execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) - //TODO Here build networkrequest - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - - String customizeResourceParam(String netowrkInputParametersJson) { - List> paramList = new ArrayList(); - JSONObject jsonObject = new JSONObject(netowrkInputParametersJson); - Iterator iterator = jsonObject.keys(); - while (iterator.hasNext()) { - String key = iterator.next(); - HashMap hashMap = new HashMap(); - hashMap.put("name", key); - hashMap.put("value", jsonObject.get(key)) - paramList.add(hashMap) - } - Map>> paramMap = new HashMap(); - paramMap.put("param", paramList); - - return new JSONObject(paramMap).toString(); - } - - /** - * Pre Process the BPMN Flow Request - * Inclouds: - * generate the nsOperationKey - * generate the nsParameters - */ - public void prepareSDNCRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled) - - try { - // get variables - String sdnc_svcAction = execution.getVariable(Prefix + "svcAction") - String sdnc_requestAction = execution.getVariable(Prefix + "requestAction") - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String createNetworkInput = execution.getVariable(Prefix + "networkRequest") - - String hdrRequestId = execution.getVariable("mso-request-id") - String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - String source = execution.getVariable("source") - String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") - String serviceType = resourceInputObj.getServiceType() - String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() - String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() - String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion() - String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName() - String globalCustomerId = resourceInputObj.getGlobalSubscriberId() - String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid(); - String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() - String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() - String modelName = resourceInputObj.getResourceModelInfo().getModelName() - String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() - String resourceInputPrameters = resourceInputObj.getResourceParameters() - String netowrkInputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") - //here convert json string to xml string - String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(netowrkInputParametersJson))) - // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyCreateRequest = - """ - - ${hdrRequestId} - ${serviceInstanceId} - ${sdnc_svcAction} - network-topology-operation - sdncCallback - generic-resource - - - - ${hdrRequestId} - ${sdnc_requestAction} - ${source} - - - - - - ${serviceInstanceId} - ${serviceType} - - ${serviceModelInvariantUuid} - ${serviceModelUuid} - ${serviceModelVersion} - ${serviceModelName} - - ${serviceInstanceId} - ${globalCustomerId} - - - - ${modelInvariantUuid} - ${modelCustomizationUuid} - ${modelUuid} - ${modelVersion} - ${modelName} - - - - ${netowrkInputParameters} - - - """.trim() - - String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) - utils.logAudit(sndcTopologyCreateRequesAsString) - execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString) - utils.log("DEBUG","sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString, isDebugEnabled) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) - } - - private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - execution.setVariable("CVFMI_updateResOperStatusRequest", body) - } - - public void prepareUpdateBeforeCreateSDNCResource(DelegateExecution execution) { - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") - String operType = resourceInputObj.getOperationType() - String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() - String ServiceInstanceId = resourceInputObj.getServiceInstanceId() - String operationId = resourceInputObj.getOperationId() - String progress = "20" - String status = "processing" - String statusDescription = "SDCN resource creation invoked" - - execution.getVariable("operationId") - - String body = """ - - - - - ${operType} - ${operationId} - ${progress} - ${resourceCustomizationUuid} - ${ServiceInstanceId} - ${status} - ${statusDescription} - - - """; - - setProgressUpdateVariables(execution, body) - - } - - public void prepareUpdateAfterCreateSDNCResource(execution) { - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") - String operType = resourceInputObj.getOperationType() - String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() - String ServiceInstanceId = resourceInputObj.getServiceInstanceId() - String operationId = resourceInputObj.getOperationId() - String progress = "100" - String status = "finished" - String statusDescription = "SDCN resource creation completed" - - execution.getVariable("operationId") - - String body = """ - - - - - ${operType} - ${operationId} - ${progress} - ${resourceCustomizationUuid} - ${ServiceInstanceId} - ${status} - ${statusDescription} - - - """; - - setProgressUpdateVariables(execution, body) - } - - public void postCreateSDNCCall(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled) - String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode") - String responseObj = execution.getVariable(Prefix + "SuccessIndicator") - - utils.log("INFO","response from sdnc, response code :" + responseCode + " response object :" + responseObj, isDebugEnabled) - utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) - - try { - String operationStatus = "finished" - // RESTResponse for main flow - String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) - sendWorkflowResponse(execution, 202, resourceOperationResp) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy deleted file mode 100644 index fd819fd3d5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy +++ /dev/null @@ -1,335 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - 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.bpmn.infrastructure.scripts; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.rest.APIResponse; - -/** - * This groovy class supports the DoCreateVFCNetworkServiceInstance.bpmn process. - * flow for VFC Network Service Create - */ -public class CreateVFCNSResource extends AbstractServiceTaskProcessor { - - String vfcUrl = "/vfc/rest/v1/vfcadapter" - - String host = "http://mso.mso.testlab.openecomp.org:8080" - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - JsonUtils jsonUtil = new JsonUtils() - - /** - * CreateVFCNSResource - * Pre Process the BPMN Flow Request - * Inclouds: - * generate the nsOperationKey - * generate the nsParameters - */ - public void preProcessRequest (DelegateExecution execution) { - JsonUtils jsonUtil = new JsonUtils() - - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("INFO", " *** preProcessRequest() *** ", isDebugEnabled) - try { - //deal with nsName and Description - String resourceInput = execution.getVariable("resourceInput") - - String resourceParameters = jsonUtil.getJsonValue(resourceInput, "resourceParameters") - // get service name - String resourceName = jsonUtil.getJsonValue(resourceInput, "resourceInstanceName") - execution.setVariable("nsServiceName", resourceName) - - String nsServiceDescription = execution.getVariable("nsServiceDescription") - utils.log("INFO", "nsServiceName:" + resourceName + " nsServiceDescription:" + nsServiceDescription, isDebugEnabled) - //deal with operation key - String globalSubscriberId = jsonUtil.getJsonValue(resourceInput, "globalSubscriberId") - utils.log("INFO", "globalSubscriberId:" + globalSubscriberId, isDebugEnabled) - //set local globalSubscriberId variable - execution.setVariable("globalSubscriberId", globalSubscriberId); - - String serviceType = execution.getVariable("serviceType") - utils.log("INFO", "serviceType:" + serviceType, isDebugEnabled) - - String serviceId = execution.getVariable("serviceInstanceId") - utils.log("INFO", "serviceId:" + serviceId, isDebugEnabled) - - String operationId = jsonUtil.getJsonValue(resourceInput, "operationId") - utils.log("INFO", "serviceType:" + serviceType, isDebugEnabled) - - String nodeTemplateUUID = jsonUtil.getJsonValue(resourceInput, "resourceModelInfo.modelCustomizationUuid") - String nsServiceModelUUID = jsonUtil.getJsonValue(resourceParameters, "requestInputs.nsd0_providing_service_uuid") - utils.log("INFO", "nodeTemplateUUID:" + nodeTemplateUUID, isDebugEnabled) - /* - * segmentInformation needed as a object of segment - * { - * "domain":"", - * "nodeTemplateName":"", - * "nodeType":"", - * "nsParameters":{ - * //this is the nsParameters sent to VF-C - * } - * } - */ - String nsParameters = jsonUtil.getJsonValue(resourceInput, "resourceParameters") - utils.log("INFO", "nsParameters:" + nsParameters, isDebugEnabled) - String nsOperationKey = """{ - "globalSubscriberId":"${globalSubscriberId}", - "serviceType":"${serviceType}", - "serviceId":"${serviceId}", - "operationId":"${operationId}", - "nodeTemplateUUID":"${nodeTemplateUUID}" - }""" - execution.setVariable("nsOperationKey", nsOperationKey); - execution.setVariable("nsParameters", nsParameters) - execution.setVariable("nsServiceModelUUID", nsServiceModelUUID); - - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - /** - * create NS task - */ - public void createNetworkService(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** createNetworkService *****", isDebugEnabled) - String nsOperationKey = execution.getVariable("nsOperationKey"); - String nsServiceModelUUID = execution.getVariable("nsServiceModelUUID"); - String nsParameters = execution.getVariable("nsParameters"); - String nsServiceName = execution.getVariable("nsServiceName") - String nsServiceDescription = execution.getVariable("nsServiceDescription") - String locationConstraints = jsonUtil.getJsonValue(nsParameters, "locationConstraints") - String requestInputs = jsonUtil.getJsonValue(nsParameters, "requestInputs") - String reqBody ="""{ - "nsServiceName":"${nsServiceName}", - "nsServiceDescription":"${nsServiceDescription}", - "nsServiceModelUUID":"${nsServiceModelUUID}", - "nsOperationKey":${nsOperationKey}, - "nsParameters":{ - "locationConstraints":${locationConstraints}, - "additionalParamForNs":${requestInputs} - } - }""" - APIResponse apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() - String nsInstanceId = ""; - if(returnCode== "200" || returnCode == "201"){ - nsInstanceId = jsonUtil.getJsonValue(aaiResponseAsString, "nsInstanceId") - } - execution.setVariable("nsInstanceId", nsInstanceId) - utils.log("INFO"," *****Exit createNetworkService *****", isDebugEnabled) - } - - /** - * instantiate NS task - */ - public void instantiateNetworkService(DelegateExecution execution) { - def isDebugEnabled= execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** instantiateNetworkService *****", isDebugEnabled) - String nsOperationKey = execution.getVariable("nsOperationKey"); - String nsParameters = execution.getVariable("nsParameters"); - String nsServiceName = execution.getVariable("nsServiceName") - String nsServiceDescription = execution.getVariable("nsServiceDescription") - String reqBody ="""{ - "nsServiceName":"${nsServiceName}", - "nsServiceDescription":"${nsServiceDescription}", - "nsOperationKey":${nsOperationKey}, - "nsParameters":${nsParameters} - }""" - String nsInstanceId = execution.getVariable("nsInstanceId") - String url = host + vfcUrl + "/ns/" +nsInstanceId + "/instantiate" - APIResponse apiResponse = postRequest(execution, url, reqBody) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() - String jobId = ""; - if(returnCode== "200"|| returnCode == "201"){ - jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") - } - execution.setVariable("jobId", jobId) - utils.log("INFO"," *****Exit instantiateNetworkService *****", isDebugEnabled) - } - - /** - * query NS task - */ - public void queryNSProgress(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** queryNSProgress *****", isDebugEnabled) - String jobId = execution.getVariable("jobId") - String nsOperationKey = execution.getVariable("nsOperationKey"); - String url = host + vfcUrl + "/jobs/" + jobId - APIResponse apiResponse = postRequest(execution, url, nsOperationKey) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() - String operationStatus = "error" - if(returnCode== "200"|| returnCode == "201"){ - operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status") - } - execution.setVariable("operationStatus", operationStatus) - utils.log("INFO"," *****Exit queryNSProgress *****", isDebugEnabled) - } - - /** - * delay 5 sec - */ - public void timeDelay(DelegateExecution execution) { - def isDebugEnabled= execution.getVariable("isDebugLogEnabled") - try { - Thread.sleep(5000); - } catch(InterruptedException e) { - utils.log("ERROR", "Time Delay exception" + e , isDebugEnabled) - } - } - - /** - * finish NS task - */ - public void addNSRelationship(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** addNSRelationship *****", isDebugEnabled) - String nsInstanceId = execution.getVariable("nsInstanceId") - if(nsInstanceId == null || nsInstanceId == ""){ - utils.log("INFO"," create NS failed, so do not need to add relationship", isDebugEnabled) - return - } - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String serviceType = execution.getVariable("serviceType") - String serviceId = execution.getVariable("serviceInstanceId") - String addRelationPayload = """ - service-instance - /aai/v11/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${serviceId} - - customer.global-customer-id - ${globalSubscriberId} - - - service-subscription.service-type - ${serviceType} - - - service-instance.service-instance-id - ${serviceId} - - """ - String endpoint = execution.getVariable("URN_aai_endpoint") - utils.log("INFO","Add Relationship req:\n" + addRelationPayload, isDebugEnabled) - String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + nsInstanceId + "/relationship-list/relationship" - APIResponse aaiRsp = executeAAIPutCall(execution, url, addRelationPayload) - utils.log("INFO","aai response status code:" + aaiRsp.getStatusCode(), isDebugEnabled) - utils.log("INFO","aai response content:" + aaiRsp.getResponseBodyAsString(), isDebugEnabled) - utils.log("INFO"," *****Exit addNSRelationship *****", isDebugEnabled) - } - - public APIResponse executeAAIPutCall(DelegateExecution execution, String url, String payload){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " ======== Started Execute AAI Put Process ======== ", isDebugEnabled) - APIResponse apiResponse = null - try{ - String uuid = execution.getVariable("mso-request-id"); - utils.log("INFO","Generated uuid is: " + uuid, isDebugEnabled) - utils.log("INFO","URL to be used is: " + url, isDebugEnabled) - String userName = execution.getVariable("URN_aai_auth") - String password = execution.getVariable("URN_mso_msoKey") - String basicAuthCred = utils.getBasicAuth(userName,password) - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - apiResponse = client.httpPut(payload) - utils.log("INFO","======== Completed Execute AAI Put Process ======== ", isDebugEnabled) - }catch(Exception e){ - utils.log("ERROR","Exception occured while executing AAI Put Call. Exception is: \n" + e, isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - return apiResponse - } - - /** - * post request - * url: the url of the request - * requestBody: the body of the request - */ - private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started Execute VFC adapter Post Process *****", isDebugEnabled) - utils.log("INFO","url:"+url +"\nrequestBody:"+ requestBody, isDebugEnabled) - APIResponse apiResponse = null - try{ - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); - apiResponse = client.httpPost(requestBody) - utils.log("INFO","response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString(), isDebugEnabled) - utils.log("INFO","======== Completed Execute VF-C adapter Post Process ======== ", isDebugEnabled) - }catch(Exception e){ - utils.log("ERROR","Exception occured while executing AAI Post Call. Exception is: \n" + e, isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - return apiResponse - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) - - try { - String operationStatus = execution.getVariable("operationStatus") - // RESTResponse for main flow - String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) - sendWorkflowResponse(execution, 202, resourceOperationResp) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy deleted file mode 100644 index 0a53526263..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy +++ /dev/null @@ -1,639 +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.bpmn.infrastructure.scripts; - -import groovy.json.JsonSlurper -import groovy.json.JsonOutput - -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.appc.client.lcm.model.Action -import org.apache.commons.lang3.* -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.bpmn.common.scripts.NetworkUtils; -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils; -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.infrastructure.aai.AAICreateResources; -import org.onap.aai.domain.yang.v12.GenericVnf; - -public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - private AbstractServiceTaskProcessor taskProcessor - - public SDNCAdapterUtils(AbstractServiceTaskProcessor taskProcessor) { - this.taskProcessor = taskProcessor - } - - /** - * Validates the request message and sets up the workflow. - * @param execution the execution - */ - public void preProcessRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - execution.setVariable("CVFMI_sentSyncResponse", false) - - def prefix = 'CVFMI_' - logDebug('Entered 1' + method, isDebugLogEnabled) - execution.setVariable('prefix', prefix) - logDebug('Entered 2' + method, isDebugLogEnabled) - execution.setVariable("isVidRequest", "false") - - logDebug("Set variables", isDebugLogEnabled) - - def rollbackData = execution.getVariable("RollbackData") - if (rollbackData == null) { - rollbackData = new RollbackData() - } - execution.setVariable("RollbackData", rollbackData) - - logDebug("Set rollback data", isDebugLogEnabled) - def incomingRequest = execution.getVariable('bpmnRequest') - - utils.log("DEBUG", "Incoming Infra Request: " + incomingRequest, isDebugLogEnabled) - utils.logAudit("CreateVfModule Infra incoming Request: " + incomingRequest) - - setBasicDBAuthHeader(execution, isDebugLogEnabled) - - // check if request is xml or json - try { - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - Map reqMap = jsonSlurper.parseText(incomingRequest) - utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled) - - def serviceInstanceId = execution.getVariable('serviceInstanceId') - def vnfId = execution.getVariable('vnfId') - - execution.setVariable(prefix + 'serviceInstanceId', serviceInstanceId) - execution.setVariable(prefix+'vnfId', vnfId) - execution.setVariable("isVidRequest", "true") - - def vnfName = '' - def asdcServiceModelVersion = '' - def serviceModelInfo = null - def vnfModelInfo = null - - def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList - - if (relatedInstanceList != null) { - relatedInstanceList.each { - if (it.relatedInstance.modelInfo?.modelType == 'service') { - asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion - serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) - - } - if (it.relatedInstance.modelInfo.modelType == 'vnf') { - vnfName = it.relatedInstance.instanceName ?: '' - vnfModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) - } - } - } - - execution.setVariable(prefix + 'vnfName', vnfName) - execution.setVariable(prefix + 'asdcServiceModelVersion', asdcServiceModelVersion) - execution.setVariable(prefix + 'serviceModelInfo', serviceModelInfo) - execution.setVariable(prefix + 'vnfModelInfo', vnfModelInfo) - - - def vnfType = execution.getVariable('vnfType') - execution.setVariable(prefix + 'vnfType', vnfType) - def vfModuleId = execution.getVariable('vfModuleId') - execution.setVariable(prefix + 'vfModuleId', vfModuleId) - def volumeGroupId = execution.getVariable('volumeGroupId') - execution.setVariable(prefix + 'volumeGroupId', volumeGroupId) - def userParams = reqMap.requestDetails?.requestParameters?.userParams - - Map userParamsMap = [:] - if (userParams != null) { - userParams.each { userParam -> - userParamsMap.put(userParam.name, jsonOutput.toJson(userParam.value).toString()) - } - } - - utils.log("DEBUG", 'Processed user params: ' + userParamsMap, isDebugLogEnabled) - - execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap) - - def isBaseVfModule = "false" - if (execution.getVariable('isBaseVfModule') == true) { - isBaseVfModule = "true" - } - - execution.setVariable(prefix + 'isBaseVfModule', isBaseVfModule) - - def requestId = execution.getVariable("mso-request-id") - execution.setVariable(prefix + 'requestId', requestId) - - def vfModuleModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo) - execution.setVariable(prefix + 'vfModuleModelInfo', vfModuleModelInfo) - - def suppressRollback = reqMap.requestDetails?.requestInfo?.suppressRollback - - - def backoutOnFailure = "" - if(suppressRollback != null){ - if ( suppressRollback == true) { - backoutOnFailure = "false" - } else if ( suppressRollback == false) { - backoutOnFailure = "true" - } - } - - execution.setVariable('disableRollback', suppressRollback) - - def vfModuleName = reqMap.requestDetails?.requestInfo?.instanceName ?: null - execution.setVariable(prefix + 'vfModuleName', vfModuleName) - - def serviceId = reqMap.requestDetails?.requestParameters?.serviceId ?: '' - execution.setVariable(prefix + 'serviceId', serviceId) - - def usePreload = reqMap.requestDetails?.requestParameters?.usePreload - execution.setVariable(prefix + 'usePreload', usePreload) - - // This is aLaCarte flow, so aLaCarte flag is always on - execution.setVariable(prefix + 'aLaCarte', true) - - def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration - def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId - execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId) - def tenantId = cloudConfiguration.tenantId - execution.setVariable(prefix + 'tenantId', tenantId) - - def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: '' - execution.setVariable(prefix + 'globalSubscriberId', globalSubscriberId) - - execution.setVariable(prefix + 'sdncVersion', '1702') - - execution.setVariable("CreateVfModuleInfraSuccessIndicator", false) - execution.setVariable("RollbackCompleted", false) - - execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) - - - def source = reqMap.requestDetails?.requestInfo?.source - execution.setVariable("CVFMI_source", source) - - //For Completion Handler & Fallout Handler - String requestInfo = - """ - ${requestId} - CREATE - ${source} - """ - - execution.setVariable("CVFMI_requestInfo", requestInfo) - - //backoutOnFailure - - execution.setVariable("CVFMI_originalWorkflowException", null) - - - def newVfModuleId = UUID.randomUUID().toString() - execution.setVariable("newVfModuleId", newVfModuleId) - execution.setVariable(prefix + 'vfModuleId', newVfModuleId) - execution.setVariable('actionHealthCheck', Action.HealthCheck) - execution.setVariable('actionConfigScaleOut', Action.ConfigScaleOut) - execution.setVariable('controllerType', "APPC") - def controllerType = execution.getVariable('controllerType') - execution.setVariable(prefix + 'controllerType', controllerType) - execution.setVariable('healthCheckIndex0', 0) - - logDebug('RequestInfo: ' + execution.getVariable("CVFMI_requestInfo"), isDebugLogEnabled) - - logDebug('rollbackEnabled: ' + execution.getVariable("CVFMI_rollbackEnabled"), isDebugLogEnabled) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError bpmnError) { - throw bpmnError - } - catch(groovy.json.JsonException je) { - utils.log("DEBUG", " Request is not in JSON format.", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest") - } - catch(Exception e) { - String restFaultMessage = e.getMessage() - //execution.setVariable("CVFMODVOL2_RESTFault", restFaultMessage) - //execution.setVariable("CVFMODVOL2_isDataOk", false) - utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest") - } - - } - - /** - * Validates a workflow response. - * @param execution the execution - * @param responseVar the execution variable in which the response is stored - * @param responseCodeVar the execution variable in which the response code is stored - * @param errorResponseVar the execution variable in which the error response is stored - */ - public void validateWorkflowResponse(DelegateExecution execution, String responseVar, - String responseCodeVar, String errorResponseVar) { - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, responseVar, responseCodeVar, errorResponseVar) - } - - - /** - * Sends the empty, synchronous response back to the API Handler. - * @param execution the execution - */ - public void sendResponse(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sendResponse(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def requestInfo = execution.getVariable('CVFMI_requestInfo') - def requestId = execution.getVariable('CVFMI_requestId') - def source = execution.getVariable('CVFMI_source') - - // RESTResponse (for API Handler (APIH) Reply Task) - def newVfModuleId = execution.getVariable("newVfModuleId") - String synchResponse = """{"requestReferences":{"instanceId":"${newVfModuleId}","requestId":"${requestId}"}}""".trim() - - sendWorkflowResponse(execution, 200, synchResponse) - - execution.setVariable("CVFMI_sentSyncResponse", true) - utils.logAudit("CreateVfModule Infra Response: " + synchResponse) - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) - } - } - - /** - * Query AAI for vnf orchestration status to determine if health check and config scaling should be run - */ - public void queryAAIForVnfOrchestrationStatus(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - def vnfId = execution.getVariable("CVFMI_vnfId") - execution.setVariable("runHealthCheck", false); - execution.setVariable("runConfigScaleOut", false); - AAICreateResources aaiCreateResources = new AAICreateResources(); - Optional vnf = aaiCreateResources.getVnfInstance(vnfId); - if(vnf.isPresent()){ - def vnfOrchestrationStatus = vnf.get().getOrchestrationStatus(); - if("active".equalsIgnoreCase(vnfOrchestrationStatus)){ - execution.setVariable("runHealthCheck", false); - execution.setVariable("runConfigScaleOut", true); - } - } - } - - /** - * Retrieve data for ConfigScaleOut from SDNC topology - */ - - public void retreiveConfigScaleOutData(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - def vfModuleId = execution.getVariable("CVFMI_vfModuleId") - String ipAddress = ""; - String oamIpAddress = ""; - String vnfHostIpAddress = ""; - - String vnfGetSDNC = execution.getVariable("DCVFM_getSDNCAdapterResponse"); - - String data = utils.getNodeXml(vnfGetSDNC, "response-data") - data = data.replaceAll("<", "<") - data = data.replaceAll(">", ">") - - InputSource source = new InputSource(new StringReader(data)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docFactory.setNamespaceAware(true) - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document responseXml = docBuilder.parse(source) - - NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters") - for (int z = 0; z < paramsList.getLength(); z++) { - Node node = paramsList.item(z) - Element eElement = (Element) node - String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name") - String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value") - if (vnfParameterName.equals("vlb_private_ip_1")) { - vnfHostIpAddress = vnfParameterValue - } - else if (vnfParameterName.equals("vdns_private_ip_0")) { - ipAddress = vnfParameterValue - } - else if (vnfParameterName.equals("vdns_private_ip_1")) { - oamIpAddress = vnfParameterValue - } - } - - String payload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"" + vnfHostIpAddress + "\",\"vf-module-id\":\"" + vfModuleId + "\"},\"configuration-parameters\":{\"ip-addr\":\"" + ipAddress +"\", \"oam-ip-addr\":\""+ oamIpAddress +"\",\"enabled\":\"true\"}}" - execution.setVariable("payload", payload); - } - - /** - * - * @param execution the execution - */ - public void postProcessResponse(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - utils.log("DEBUG", " ======== STARTED PostProcessResponse Process ======== ", isDebugEnabled) - try{ - def requestInfo = execution.getVariable("CVFMI_requestInfo") - def action = utils.getNodeText1(requestInfo, "action") - - utils.log("DEBUG", "requestInfo is: " + requestInfo, isDebugEnabled) - utils.log("DEBUG", "action is: " + action, isDebugEnabled) - - String payload = - """ - - ${requestInfo} - - Vf Module has been created successfully. - BPMN - """ - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_SuccessFlag", true) - execution.setVariable("CVFMI_msoCompletionRequest", payload) - utils.logAudit("CreateVfModuleInfra completion request: " + payload) - utils.log("DEBUG", "Outgoing MsoCompletionRequest: \n" + payload, isDebugEnabled) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing PostProcessResponse. Exception is:\n" + e, isDebugEnabled) - execution.setVariable("CVFMI_ErrorResponse", "Error Occured during PostProcessResponse Method:\n" + e.getMessage()) - } - utils.log("DEBUG", "======== COMPLETED PostProcessResponse Process ======== ", isDebugEnabled) - } - - - - - - /** - * Validates the request, request id and service instance id. If a problem is found, - * a WorkflowException is generated and an MSOWorkflowException event is thrown. This - * method also sets up the log context for the workflow. - * @param execution the execution - * @return the validated request - */ - public String validateInfraRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.validateInfraRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String processKey = getProcessKey(execution); - def prefix = execution.getVariable("prefix") - - if (prefix == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null") - } - - try { - def request = execution.getVariable(prefix + 'Request') - - if (request == null) { - request = execution.getVariable(processKey + 'Request') - - if (request == null) { - request = execution.getVariable('bpmnRequest') - } - - setVariable(execution, processKey + 'Request', null); - setVariable(execution, 'bpmnRequest', null); - setVariable(execution, prefix + 'Request', request); - } - - if (request == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null") - } - - /* - - def requestId = execution.getVariable("mso-request-id") - - if (requestId == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request has no mso-request-id") - } - - setVariable(execution, prefix + 'requestId', requestId) - - def serviceInstanceId = execution.getVariable("mso-service-instance-id") - - if (serviceInstanceId == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id") - } - - utils.logContext(requestId, serviceInstanceId) - */ - utils.logAudit("CreateVfModule incoming request: " + request) - logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled) - logDebug('Exited ' + method, isDebugLogEnabled) - return request - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") - } - } - - public void prepareUpdateInfraRequest(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - utils.log("DEBUG", " ======== STARTED prepareUpdateInfraRequest Process ======== ", isDebugEnabled) - try{ - - - String requestInfo = execution.getVariable("CVFMI_requestInfo") - def aicCloudRegion = execution.getVariable("CVFMI_lcpCloudRegionId") - def tenantId = execution.getVariable("CVFMI_tenantId") - def requestId = utils.getNodeText1(requestInfo, "request-id") - def vnfId = execution.getVariable("CVFMI_vnfId") - def vfModuleId = execution.getVariable("CVFMI_vfModuleId") - // vfModuleName may be generated by DoCreateVfModule subprocess if it is not specified on the input - def vfModuleName = execution.getVariable("CVFMI_vfModuleName") - - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) - - String payload = - """ - - - - ${requestId} - BPMN - VF Module successfully created - - COMPLETE - 100 - <vnf-outputs xmlns="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:aetgt="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"><vnf-id>${vnfId}</vnf-id><vf-module-id>${vfModuleId}</vf-module-id></vnf-outputs> - ${vfModuleId} - ${vfModuleName} - - - """ - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_updateInfraRequest", payload) - utils.log("DEBUG", "Outgoing UpdateInfraRequest: \n" + payload, isDebugEnabled) - utils.logAudit("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing prepareUpdateInfraRequest. Exception is:\n" + e, isDebugEnabled) - execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage()) - } - utils.log("DEBUG", "======== COMPLETED prepareUpdateInfraRequest Process ======== ", isDebugEnabled) - } - - /** - * Builds a "FalloutHandler" request and stores it in the specified execution variable. - * - * @param execution the execution - * @param resultVar the execution variable in which the result will be stored - */ - public void falloutHandlerPrep(DelegateExecution execution, String resultVar) { - def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + - 'execution=' + execution.getId() + - ', resultVar=' + resultVar + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - - try { - def WorkflowException workflowException = execution.getVariable("WorkflowException") - def requestInformation = execution.getVariable("CVFMI_requestInfo") - def errorResponseCode = workflowException.getErrorCode() - def errorResponseMsg = workflowException.getErrorMessage() - def encErrorResponseMsg = "" - if (errorResponseMsg != null) { - encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">") - } - - String content = """ - - ${requestInformation} - - ${encErrorResponseMsg} - ${errorResponseCode} - - - """ - - logDebug("CONTENT before translation: " + content, isDebugLogEnabled) - content = utils.formatXml(content) - logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) - utils.logAudit("CreateVfModuleInfra FallOutHander Request: " + content) - execution.setVariable(resultVar, content) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') - } - } - - public void logAndSaveOriginalException(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.validateRollbackResponse(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - logWorkflowException(execution, 'CreateVfModuleInfra caught an event') - saveWorkflowException(execution, 'CVFMI_originalWorkflowException') - } - - public void validateRollbackResponse(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.validateRollbackResponse(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - def originalException = execution.getVariable("CVFMI_originalWorkflowException") - execution.setVariable("WorkflowException", originalException) - - execution.setVariable("RollbackCompleted", true) - - } - - public void sendErrorResponse(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - utils.log("DEBUG", " *** STARTED CreateVfModulenfra sendErrorResponse Process *** ", isDebugEnabled) - try { - def sentSyncResponse = execution.getVariable("CVFMI_sentSyncResponse") - if(sentSyncResponse == false){ - WorkflowException wfex = execution.getVariable("WorkflowException") - String response = exceptionUtil.buildErrorResponseXml(wfex) - - utils.logAudit(response) - sendWorkflowResponse(execution, 500, response) - }else{ - utils.log("DEBUG", "Not Sending Error Response. Sync Response Already Sent", isDebugEnabled) - } - - } catch (Exception ex) { - utils.log("DEBUG", "Error Occured in CreateVfModuleInfra sendErrorResponse Process " + ex.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVfModuleInfra sendErrorResponse Process") - - } - utils.log("DEBUG", "*** COMPLETED CreateVfModuleInfra sendErrorResponse Process ***", isDebugEnabled) - } - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy deleted file mode 100644 index 49d67cb097..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy +++ /dev/null @@ -1,363 +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.bpmn.infrastructure.scripts - -import org.openecomp.mso.bpmn.common.scripts.AaiUtil; -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse -import java.util.Map; - -import groovy.json.JsonOutput -import groovy.json.JsonSlurper - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.apache.commons.lang3.* - -class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { - - public static final String prefix='CVMVINFRAV1_' - - /** - * Perform initial processing, such as request validation, initialization of variables, etc. - * * @param execution - */ - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - setBasicDBAuthHeader(execution, isDebugEnabled) - preProcessRequest(execution, isDebugEnabled) - } - - - /** - * Perform initial processing, such as request validation, initialization of variables, etc. - * @param execution - * @param isDebugEnabled - */ - public void preProcessRequest (DelegateExecution execution, isDebugEnabled) { - - execution.setVariable("prefix",prefix) - setSuccessIndicator(execution, false) - execution.setVariable(prefix+'syncResponseSent', false) - - String createVolumeIncoming = validateRequest(execution, 'vnfId') - utils.logAudit(createVolumeIncoming) - - try { - def jsonSlurper = new JsonSlurper() - Map reqMap = jsonSlurper.parseText(createVolumeIncoming) - setupVariables(execution, reqMap, isDebugEnabled) - utils.log("DEBUG", "XML request:\n" + createVolumeIncoming, isDebugEnabled) - } - catch(groovy.json.JsonException je) { - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, 'Request is not a valid JSON document') - } - - // For rollback in this flow - setBasicDBAuthHeader(execution, isDebugEnabled) - setRollbackEnabled(execution, isDebugEnabled) - } - - - /** - * Set up variables that will be passed to the BB DoCreatevfModuleVolume flow - * @param execution - * @param requestMap - * @param serviceInstanceId - * @param isDebugLogEnabled - */ - public void setupVariables(DelegateExecution execution, Map requestMap, isDebugLogEnabled) { - - def jsonOutput = new JsonOutput() - - // volumeGroupId - is generated - String volumeGroupId = UUID.randomUUID() - execution.setVariable('volumeGroupId', volumeGroupId) - utils.log("DEBUG", "Generated volumeGroupId: " + volumeGroupId, isDebugLogEnabled) - - // volumeGroupName - def volGrpName = requestMap.requestDetails.requestInfo?.instanceName ?: '' - execution.setVariable('volumeGroupName', volGrpName) - - // vfModuleModelInfo - def vfModuleModelInfo = jsonOutput.toJson(requestMap.requestDetails?.modelInfo) - execution.setVariable('vfModuleModelInfo', vfModuleModelInfo) - - // lcpCloudRegonId - def lcpCloudRegionId = requestMap.requestDetails.cloudConfiguration.lcpCloudRegionId - execution.setVariable('lcpCloudRegionId', lcpCloudRegionId) - - // tenant - def tenantId = requestMap.requestDetails.cloudConfiguration.tenantId - execution.setVariable('tenantId', tenantId) - - // source - def source = requestMap.requestDetails.requestInfo.source - execution.setVariable(prefix+'source', source) - - // vnfType and asdcServiceModelVersion - - def serviceName = '' - def asdcServiceModelVersion = '' - def modelCustomizationName = '' - - def relatedInstanceList = requestMap.requestDetails.relatedInstanceList - relatedInstanceList.each { - if (it.relatedInstance.modelInfo?.modelType == 'service') { - serviceName = it.relatedInstance.modelInfo?.modelName - asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion - } - if (it.relatedInstance.modelInfo?.modelType == 'vnf') { - modelCustomizationName = it.relatedInstance.modelInfo?.modelCustomizationName - } - } - - def vnfType = serviceName + '/' + modelCustomizationName - execution.setVariable('vnfType', vnfType) - execution.setVariable('asdcServiceModelVersion', asdcServiceModelVersion) - - // vfModuleInputParams - def userParams = requestMap.requestDetails?.requestParameters?.userParams - Map vfModuleInputMap = [:] - - userParams.each { userParam -> - vfModuleInputMap.put(userParam.name, userParam.value.toString()) - } - execution.setVariable('vfModuleInputParams', vfModuleInputMap) - - // disableRollback (true or false) - def disableRollback = requestMap.requestDetails.requestInfo.suppressRollback - execution.setVariable('disableRollback', disableRollback) - utils.log("DEBUG", 'disableRollback (suppressRollback) from request: ' + disableRollback, isDebugLogEnabled) - - } - - - - public void sendSyncResponse (DelegateExecution execution, isDebugEnabled) { - def volumeGroupId = execution.getVariable('volumeGroupId') - def requestId = execution.getVariable("mso-request-id") - def serviceInstanceId = execution.getVariable("serviceInstanceId") - - String syncResponse = """{"requestReferences":{"instanceId":"${volumeGroupId}","requestId":"${requestId}"}}""".trim() - - utils.log("DEBUG", "Sync Response: " + "\n" + syncResponse, isDebugEnabled) - sendWorkflowResponse(execution, 200, syncResponse) - - execution.setVariable(prefix+'syncResponseSent', true) - } - - - public void sendSyncError (DelegateExecution execution, isDebugEnabled) { - WorkflowException we = execution.getVariable('WorkflowException') - def errorCode = we?.getErrorCode() - def errorMessage = we?.getErrorMessage() - //default to 400 since only invalid request will trigger this method - sendWorkflowResponse(execution, 400, errorMessage) - } - - - /** - * Create a WorkflowException - * @param execution - * @param isDebugEnabled - */ - public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage, isDebugEnabled) { - utils.log("DEBUG", errorMessage, isDebugEnabled) - (new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage) - } - - - /** - * Build Infra DB Request - * @param execution - * @param isDebugEnabled - */ - public void prepareDbInfraSuccessRequest(DelegateExecution execution, isDebugEnabled) { - def dbVnfOutputs = execution.getVariable(prefix+'volumeOutputs') - def requestId = execution.getVariable('mso-request-id') - def statusMessage = "VolumeGroup successfully created." - def requestStatus = "COMPLETED" - def progress = "100" - - /* - from: $gVolumeGroup/aai:volume-group-id/text() - to: vnfreq:volume-outputs/vnfreq:volume-group-id - */ - // for now assume, generated volumeGroupId is accepted - def volumeGroupId = execution.getVariable(prefix+'volumeGroupId') - - String dbRequest = - """ - - - - ${requestId} - BPMN - ${statusMessage} - - ${requestStatus} - ${progress} - ${dbVnfOutputs} - ${volumeGroupId} - - - """ - - String buildDBRequestAsString = utils.formatXml(dbRequest) - execution.setVariable(prefix+"createDBRequest", buildDBRequestAsString) - utils.log("DEBUG", "DB Infra Request: " + buildDBRequestAsString, isDebugEnabled) - utils.logAudit(buildDBRequestAsString) - } - - - /** - * Build CommpleteMsoProcess request - * @param execution - * @param isDebugEnabled - */ - public void postProcessResponse (DelegateExecution execution, isDebugEnabled) { - - def dbReturnCode = execution.getVariable(prefix+'dbReturnCode') - def createDBResponse = execution.getVariable(prefix+'createDBResponse') - - utils.logAudit('DB return code: ' + dbReturnCode) - utils.logAudit('DB response: ' + createDBResponse) - - def requestId = execution.getVariable("mso-request-id") - def source = execution.getVariable(prefix+'source') - - String msoCompletionRequest = - """ - - ${requestId} - CREATE - ${source} - - Volume Group has been created successfully. - BPMN VF Module Volume action: CREATE - """ - - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - utils.logAudit(createDBResponse) - utils.logAudit(xmlMsoCompletionRequest) - execution.setVariable(prefix+'Success', true) - execution.setVariable(prefix+'CompleteMsoProcessRequest', xmlMsoCompletionRequest) - utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - - } - - public void prepareFalloutHandlerRequest(DelegateExecution execution, isDebugEnabled) { - - WorkflowException we = execution.getVariable('WorkflowException') - def errorCode = we?.getErrorCode() - def errorMessage = we?.getErrorMessage() - - def requestId = execution.getVariable("mso-request-id") - def source = execution.getVariable(prefix+'source') - - String falloutHandlerRequest = - """ - - ${requestId} - CREATE - ${source} - - - ${errorMessage} - ${errorCode} - - - """ - - // Format Response - String xmlHandlerRequest = utils.formatXml(falloutHandlerRequest) - utils.logAudit(xmlHandlerRequest) - - execution.setVariable(prefix+'FalloutHandlerRequest', xmlHandlerRequest) - utils.log("ERROR", "Overall Error Response going to FalloutHandler: " + "\n" + xmlHandlerRequest, isDebugEnabled) - } - - - /** - * Query AAI service instance - * @param execution - * @param isDebugEnabled - */ - public void callRESTQueryAAIServiceInstance(DelegateExecution execution, isDebugEnabled) { - - def request = execution.getVariable(prefix+"Request") - def serviceInstanceId = utils.getNodeText1(request, "service-instance-id") - - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = aaiUtil.getSearchNodesQueryEndpoint(execution) - - def String queryAAIRequest = aaiEndpoint + "?search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId - utils.logAudit("AAI query service instance request: " + queryAAIRequest) - - APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIRequest) - - String returnCode = response.getStatusCode() - String aaiResponseAsString = response.getResponseBodyAsString() - aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) - - utils.logAudit("AAI query service instance return code: " + returnCode) - utils.logAudit("AAI query service instance response: " + aaiResponseAsString) - - utils.log("DEBUG", "AAI query service instance return code: " + returnCode, isDebugEnabled) - utils.log("DEBUG", "AAI query service instance response: " + aaiResponseAsString, isDebugEnabled) - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - if (returnCode=='200') { - utils.log("DEBUG", 'Service instance ' + serviceInstanceId + ' found in AAI.', isDebugEnabled) - } else { - if (returnCode=='404') { - def message = 'Service instance ' + serviceInstanceId + ' was not found in AAI. Return code: 404.' - utils.log("DEBUG", message, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, message) - } else { - WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - throw new BpmnError("MSOWorkflowException") - } - } - } - - public void logAndSaveOriginalException(DelegateExecution execution, isDebugLogEnabled) { - logWorkflowException(execution, 'CreateVfModuleVolumeInfraV1 caught an event') - saveWorkflowException(execution, 'CVMVINFRAV1_originalWorkflowException') - } - - public void validateRollbackResponse(DelegateExecution execution, isDebugLogEnabled) { - - def originalException = execution.getVariable("CVMVINFRAV1_originalWorkflowException") - execution.setVariable("WorkflowException", originalException) - execution.setVariable("RollbackCompleted", true) - - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVnfInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVnfInfra.groovy deleted file mode 100644 index 24487d5013..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVnfInfra.groovy +++ /dev/null @@ -1,551 +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.bpmn.infrastructure.scripts - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution; - -import static org.apache.commons.lang3.StringUtils.*; -import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils; -import org.json.JSONObject; -import org.json.JSONArray; - -import org.openecomp.mso.bpmn.common.scripts.AaiUtil; -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils; -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.bpmn.infrastructure.aai.AAICreateResources; - - -/** - * This class supports the CreateVnfInfra Flow - * with the creation of a generic vnf for - * infrastructure. - */ -class CreateVnfInfra extends AbstractServiceTaskProcessor { - - String Prefix="CREVI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - CatalogDbUtils cutils = new CatalogDbUtils() - AAICreateResources aaiCR = new AAICreateResources() - - /** - * This method gets and validates the incoming - * request. - * - * @param - execution - * - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED CreateVnfInfra PreProcessRequest Process*** ", isDebugEnabled) - - setBasicDBAuthHeader(execution, isDebugEnabled) - execution.setVariable("CREVI_sentSyncResponse", false) - - try{ - // Get Variables - String createVnfRequest = execution.getVariable("bpmnRequest") - execution.setVariable("CREVI_createVnfRequest", createVnfRequest) - utils.logAudit("Incoming CreateVnfInfra Request is: \n" + createVnfRequest) - - if(createVnfRequest != null){ - - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("CREVI_requestId", requestId) - utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - execution.setVariable("CREVI_serviceInstanceId", serviceInstanceId) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - - String vnfType = execution.getVariable("vnfType") - execution.setVariable("CREVI_vnfType", vnfType) - utils.log("DEBUG", "Incoming Vnf Type is: " + vnfType, isDebugEnabled) - - String vnfName = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.instanceName") - execution.setVariable("CREVI_vnfName", vnfName) - utils.log("DEBUG", "Incoming Vnf Name is: " + vnfName, isDebugEnabled) - - String serviceId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.productFamilyId") - execution.setVariable("CREVI_serviceId", serviceId) - utils.log("DEBUG", "Incoming Service Id is: " + serviceId, isDebugEnabled) - - String source = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.source") - execution.setVariable("CREVI_source", source) - utils.log("DEBUG", "Incoming Source is: " + source, isDebugEnabled) - - String suppressRollback = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.suppressRollback") - execution.setVariable("CREVI_suppressRollback", suppressRollback) - utils.log("DEBUG", "Incoming Suppress Rollback is: " + suppressRollback, isDebugEnabled) - - def vnfModelInfo = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo") - execution.setVariable("CREVI_vnfModelInfo", vnfModelInfo) - - String modelInvariantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelInvariantUuid") - execution.setVariable("CREVI_modelInvariantId", modelInvariantId) - utils.log("DEBUG", "Incoming Invariant Id is: " + modelInvariantId, isDebugEnabled) - - String modelVersion = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelVersion") - execution.setVariable("CREVI_modelVersion", modelVersion) - utils.log("DEBUG", "Incoming Model Version is: " + modelVersion, isDebugEnabled) - - def cloudConfiguration = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration") - execution.setVariable("CREVI_cloudConfiguration", cloudConfiguration) - - String cloudSiteId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId") - execution.setVariable("CREVI_cloudSiteId", cloudSiteId) - utils.log("DEBUG", "Incoming Cloud Site Id is: " + cloudSiteId, isDebugEnabled) - - String tenantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.tenantId") - execution.setVariable("CREVI_tenantId", tenantId) - utils.log("DEBUG", "Incoming Tenant Id is: " + tenantId, isDebugEnabled) - - //For Completion Handler & Fallout Handler - String requestInfo = - """ - ${requestId} - CREATE - ${source} - """ - - execution.setVariable("CREVI_requestInfo", requestInfo) - - //TODO: Orch Status - TBD, will come from SDN-C Response in 1702 - String orchStatus = "Created" - execution.setVariable("CREVI_orchStatus", orchStatus) - - //TODO: Equipment Role - Should come from SDN-C Response in 1702 - String equipmentRole = " " - execution.setVariable("CREVI_equipmentRole", equipmentRole) - - String vnfId = execution.getVariable("testVnfId") // for junits - if(isBlank(vnfId)){ - vnfId = UUID.randomUUID().toString() - utils.log("DEBUG", "Generated Vnf Id is: " + vnfId, isDebugEnabled) - } - execution.setVariable("CREVI_vnfId", vnfId) - - // Setting for Sub Flow Calls - execution.setVariable("CREVI_type", "generic-vnf") - execution.setVariable("GENGS_type", "service-instance") - - String sdncCallbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { - def msg = 'Required variable \'URN_mso_workflow_sdncadapter_callback\' is missing' - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - execution.setVariable("CREVI_sdncCallbackUrl", sdncCallbackUrl) - - def vnfInputParameters = null - try { - vnfInputParameters = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestParameters.userParams") - } - catch (Exception e) { - utils.log("DEBUG", "userParams are not present in the request", isDebugEnabled) - } - execution.setVariable("CREVI_vnfInputParameters", vnfInputParameters) - - - utils.logAudit("SDNC Callback URL: " + sdncCallbackUrl) - logDebug("SDNC Callback URL is: " + sdncCallbackUrl, isDebugEnabled) - - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Bpmn Request is Null.") - } - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", " Error Occured in CreateVnfInfra PreProcessRequest method!" + e.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra PreProcessRequest") - - } - utils.log("DEBUG", "*** COMPLETED CreateVnfInfra PreProcessRequest Process ***", isDebugEnabled) - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " *** STARTED CreateVnfInfra SendSyncResponse Process *** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("CREVI_requestId") - String vnfId = execution.getVariable("CREVI_vnfId") - - String createVnfResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() - - utils.log("DEBUG", " CreateVnfInfra Sync Response is: \n" + createVnfResponse, isDebugEnabled) - - sendWorkflowResponse(execution, 202, createVnfResponse) - - execution.setVariable("CREVI_sentSyncResponse", true) - - } catch (Exception ex) { - utils.log("DEBUG", "Error Occured in CreateVnfInfra SendSyncResponse Process " + ex.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra SendSyncResponse Process") - - } - utils.log("DEBUG", "*** COMPLETED CreateVnfInfra SendSyncResponse Process ***", isDebugEnabled) - } - - - public void preProcessSDNCAssignRequest(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) - def vnfId = execution.getVariable("CREVI_vnfId") - def serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId") - logDebug("NEW VNF ID: " + vnfId, isDebugLogEnabled) - utils.logAudit("NEW VNF ID: " + vnfId) - - try{ - //Build SDNC Request - - String assignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "assign") - - assignSDNCRequest = utils.formatXml(assignSDNCRequest) - execution.setVariable("CREVI_assignSDNCRequest", assignSDNCRequest) - logDebug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest, isDebugLogEnabled) - utils.logAudit("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessSDNCAssignRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) - } - - public void preProcessSDNCActivateRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled) - try{ - String vnfId = execution.getVariable("CREVI_vnfId") - String serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId") - - String activateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "activate") - - execution.setVariable("CREVI_activateSDNCRequest", activateSDNCRequest) - logDebug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest, isDebugLogEnabled) - utils.logAudit("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest) - - }catch(Exception e){ - log.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled) - } - - public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ - - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() - } - def callbackURL = execution.getVariable("CREVI_sdncCallbackUrl") - def requestId = execution.getVariable("CREVI_requestId") - def serviceId = execution.getVariable("CREVI_serviceId") - def vnfType = execution.getVariable("CREVI_vnfType") - def vnfName = execution.getVariable("CREVI_vnfName") - def tenantId = execution.getVariable("CREVI_tenantId") - def source = execution.getVariable("CREVI_source") - def vnfId = execution.getVariable("CREVI_vnfId") - def cloudSiteId = execution.getVariable("CREVI_cloudSiteId") - - String sdncVNFParamsXml = "" - - if(execution.getVariable("CREVI_vnfParamsExistFlag") == true){ - sdncVNFParamsXml = buildSDNCParamsXml(execution) - }else{ - sdncVNFParamsXml = "" - } - - String sdncRequest = - """ - - ${requestId} - ${svcInstId} - ${action} - vnf-topology-operation - ${callbackURL} - - - - ${requestId} - VNFActivateRequest - ${source} - - - - ${serviceId} - ${serviceId} - ${svcInstId} - notsurewecare - - - ${vnfId} - ${vnfName} - ${vnfType} - ${cloudSiteId} - ${tenantId} - ${sdncVNFParamsXml} - - - """ - - utils.logAudit("sdncRequest: " + sdncRequest) - return sdncRequest - } - - public void validateSDNCResponse(DelegateExecution execution, String response, String method){ - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled) - - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - utils.logAudit("workflowException: " + workflowException) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - utils.logAudit("SDNCResponse: " + response) - - String sdncResponse = response - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - logDebug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse, isDebugLogEnabled) - - }else{ - logDebug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) - throw new BpmnError("MSOWorkflowException") - } - logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled) - } - - public void prepareCompletionHandlerRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " *** STARTED CreateVnfInfra PrepareCompletionHandlerRequest Process *** ", isDebugEnabled) - - try { - String requestInfo = execution.getVariable("CREVI_requestInfo") - String vnfId = execution.getVariable("CREVI_vnfId") - requestInfo = utils.removeXmlPreamble(requestInfo) - - String request = - """ - ${requestInfo} - Vnf has been created successfully. - ${vnfId} - CreateVnfInfra - """ - - execution.setVariable("CREVI_completionHandlerRequest", request) - utils.log("DEBUG", "Completion Handler Request is: " + request, isDebugEnabled) - - execution.setVariable("WorkflowResponse", "Success") // for junits - - } catch (Exception ex) { - utils.log("DEBUG", "Error Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process " + ex.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process") - - } - utils.log("DEBUG", "*** COMPLETED CreateVnfInfra PrepareCompletionHandlerRequest Process ***", isDebugEnabled) - } - - public void sendErrorResponse(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " *** STARTED CreateVnfInfra sendErrorResponse Process *** ", isDebugEnabled) - try { - def sentSyncResponse = execution.getVariable("CREVI_sentSyncResponse") - if(sentSyncResponse == false){ - WorkflowException wfex = execution.getVariable("WorkflowException") - String response = exceptionUtil.buildErrorResponseXml(wfex) - - utils.logAudit(response) - sendWorkflowResponse(execution, 500, response) - }else{ - utils.log("DEBUG", "Not Sending Error Response. Sync Response Already Sent", isDebugEnabled) - } - - } catch (Exception ex) { - utils.log("DEBUG", "Error Occured in CreateVnfInfra sendErrorResponse Process " + ex.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra sendErrorResponse Process") - - } - utils.log("DEBUG", "*** COMPLETED CreateVnfInfra sendErrorResponse Process ***", isDebugEnabled) - } - - public void prepareFalloutRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " *** STARTED CreateVnfInfra prepareFalloutRequest Process *** ", isDebugEnabled) - - try { - WorkflowException wfex = execution.getVariable("WorkflowException") - utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled) - String requestInfo = execution.getVariable("CREVI_requestInfo") - utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled) - - String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) - - execution.setVariable("CREVI_falloutRequest", falloutRequest) - - - } catch (Exception ex) { - utils.log("DEBUG", "Error Occured in CreateVnfInfra prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra prepareFalloutRequest Process") - - } - utils.log("DEBUG", "*** COMPLETED CreateVnfInfra prepareFalloutRequest Process ***", isDebugEnabled) - } - - - public void queryCatalogDB (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " *** STARTED CreateVnfInfra QueryCatalogDB Process *** ", isDebugEnabled) - try { - //Get Vnf Info - String vnfModelInfo = execution.getVariable("CREVI_vnfModelInfo") - String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationUuid") - utils.log("DEBUG", "querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid, isDebugEnabled) - - JSONArray vnfs = cutils.getAllVnfsByVnfModelCustomizationUuid(execution, - vnfModelCustomizationUuid, "v2") - utils.log("DEBUG", "obtained VNF list: " + vnfs, isDebugEnabled) - - if (vnfs == null) { - utils.log("ERROR", "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid) - } - - // Only one match here - JSONObject vnf = vnfs.get(0) - - if (vnf == null) { - utils.log("ERROR", "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid) - } - - VnfResource vnfResource = new VnfResource() - String nfType = jsonUtil.getJsonValueForKey(vnf, "nfType") - vnfResource.setNfType(nfType) - String nfRole = jsonUtil.getJsonValueForKey(vnf, "nfRole") - vnfResource.setNfRole(nfRole) - String nfFunction = jsonUtil.getJsonValueForKey(vnf, "nfFunction") - vnfResource.setNfFunction(nfFunction) - String nfNamingCode = jsonUtil.getJsonValueForKey(vnf, "nfNamingCode") - vnfResource.setNfNamingCode(nfNamingCode) - - execution.setVariable("CREVI_vnfResourceDecomposition", vnfResource) - - }catch(BpmnError e) { - throw e; - }catch(Exception ex) { - utils.log("DEBUG", "Error Occurred in CreateVnfInfra QueryCatalogDB Process " + ex.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra QueryCatalogDB Process") - } - - - utils.log("DEBUG", "*** COMPLETED CreateVnfInfra QueryCatalogDb Process ***", isDebugEnabled) - } - public void createPlatform (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** START createPlatform *****", isDebugEnabled) - - String request = execution.getVariable("bpmnRequest") - String platformName = jsonUtil.getJsonValue(request, "requestDetails.platform.platformName") - String vnfId = execution.getVariable("CREVI_vnfId") - - utils.log("DEBUG","Platform NAME: " + platformName, isDebugEnabled) - utils.log("DEBUG","VnfID: " + vnfId, isDebugEnabled) - - if(platformName == null||platformName.equals("")){ - String msg = "Exception in createPlatform. platformName was not found in the request."; - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - }else{ - utils.log("DEBUG", "platformName was found.", isDebugEnabled) - try{ - AAICreateResources aaiCR = new AAICreateResources() - aaiCR.createAAIPlatform(platformName, vnfId) - }catch(Exception ex){ - String msg = "Exception in createPlatform. " + ex.getMessage(); - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - utils.log("DEBUG"," *** Exit createPlatform *** ", isDebugEnabled) - } - public void createLineOfBusiness (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** START createLineOfBusiness *****", isDebugEnabled) - - String request = execution.getVariable("bpmnRequest") - String lineOfBusiness = jsonUtil.getJsonValue(request, "requestDetails.lineOfBusiness.lineOfBusinessName") - String vnfId = execution.getVariable("CREVI_vnfId") - - utils.log("DEBUG","LineOfBusiness NAME: " + lineOfBusiness, isDebugEnabled) - utils.log("DEBUG","VnfID: " + vnfId, isDebugEnabled) - - if(lineOfBusiness == null || lineOfBusiness.equals("")){ - utils.log("DEBUG", "LineOfBusiness was not found. Continuing on with flow...", isDebugEnabled) - }else{ - utils.log("DEBUG", "LineOfBusiness was found.", isDebugEnabled) - try{ - AAICreateResources aaiCR = new AAICreateResources() - aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId) - }catch(Exception ex){ - String msg = "Exception in LineOfBusiness. " + ex.getMessage(); - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - utils.log("DEBUG"," *** Exit createLineOfBusiness *** ", isDebugEnabled) - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy deleted file mode 100644 index 8c8543345f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy +++ /dev/null @@ -1,394 +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.bpmn.infrastructure.scripts; - -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; - -import java.util.UUID; -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource -import static org.apache.commons.lang3.StringUtils.*; - -import org.springframework.web.util.UriUtils; - -/** - * This groovy class supports the DelE2EServiceInstance.bpmn process. - * - */ -public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor { - - String Prefix="DELSI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - String msg = "" - - utils.log("INFO", " *** preProcessRequest Request *** ", isDebugEnabled) - - try { - // check for incoming json message/input - String siRequest = execution.getVariable("bpmnRequest") - utils.logAudit(siRequest) - - - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("msoRequestId", requestId) - utils.log("INFO", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)) { - msg = "Input serviceInstanceId' is null" - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - - //requestInfo -// String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") -// if (isBlank(productFamilyId)) -// { -// msg = "Input productFamilyId is null" -// utils.log("INFO", msg, isDebugEnabled) -// //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) -// } else { -// execution.setVariable("productFamilyId", productFamilyId) -// } - String source = jsonUtil.getJsonValue(siRequest, "source") - execution.setVariable("source", source) - - //subscriberInfo - String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId") - if (isBlank(globalSubscriberId)) { - msg = "Input globalSubscriberId' is null" - utils.log("INFO", msg, isDebugEnabled) - } else { - execution.setVariable("globalSubscriberId", globalSubscriberId) - } - - //requestParameters - String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType") - if (isBlank(subscriptionServiceType)) { - msg = "Input subscriptionServiceType is null" - utils.log("DEBUG", msg, isDebugEnabled) - //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - } - String operationId = jsonUtil.getJsonValue(siRequest, "operationId") - execution.setVariable("operationId", operationId) - - execution.setVariable("operationType", "DELETE") - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** sendSyncResponse *** ", isDebugEnabled) - try { - String operationId = execution.getVariable("operationId") - String syncResponse = """{"operationId":"${operationId}"}""".trim() - utils.log("INFO", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) - sendWorkflowResponse(execution, 202, syncResponse) - - } catch (Exception ex) { - String msg = "Exception in sendSyncResponse: " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - utils.log("INFO"," ***** Exit sendSyncResopnse *****", isDebugEnabled) - } - - public void sendSyncError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** sendSyncError *** ", isDebugEnabled) - - try { - String errorMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """ - ${errorMessage} - 7000 - """ - - utils.logAudit(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - - } catch (Exception ex) { - utils.log("INFO", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) - } - - } - - public void prepareCompletionRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** prepareCompletion *** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("msoRequestId") - String source = execution.getVariable("source") - String msoCompletionRequest = - """ - - ${requestId} - DELETE - ${source} - - E2E Service Instance was deleted successfully. - DeleteCustomE2EServiceInstance - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - execution.setVariable("completionRequest", xmlMsoCompletionRequest) - utils.log("INFO", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - - } catch (Exception ex) { - String msg = " Exception in prepareCompletion:" + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO", "*** Exit prepareCompletionRequest ***", isDebugEnabled) - } - - public void prepareFalloutRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** prepareFalloutRequest *** ", isDebugEnabled) - - try { - WorkflowException wfex = execution.getVariable("WorkflowException") - utils.log("INFO", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) - String requestId = execution.getVariable("msoRequestId") - String source = execution.getVariable("source") - String requestInfo = - """ - ${requestId} - DELETE - ${source} - """ - - String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) - execution.setVariable("falloutRequest", falloutRequest) - } catch (Exception ex) { - utils.log("INFO", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) - String errorException = " Bpmn error encountered in CreateServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() - String requestId = execution.getVariable("msoRequestId") - String falloutRequest = - """ - - ${requestId} - DELETE - VID - - - ${errorException} - 7000 - - """ - - execution.setVariable("falloutRequest", falloutRequest) - } - utils.log("INFO", "*** Exit prepareFalloutRequest ***", isDebugEnabled) - } - - - // ******************************* - // Build DB request Section - // ******************************* - public void prepareDBRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - try { - utils.log("INFO", " ***** Inside prepareDBRequest of DeleteCustomE2EServiceInstance ***** ", isDebugEnabled) - - String requestId = execution.getVariable("DELSI_requestId") - String statusMessage = "E2E Service Instance successfully deleted." - - //TODO - verify the format for Service Instance Delete, - String dbRequest = - """ - - - - ${requestId} - BPMN - ${statusMessage} - - COMPLETED - 100 - - - """ - - String buildDeleteDBRequestAsString = utils.formatXml(dbRequest) - execution.setVariable("DELSI_createDBRequest", buildDeleteDBRequestAsString) - utils.logAudit(buildDeleteDBRequestAsString) - - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in DeleteCustomE2EServiceInstance flow. Unexpected Error from method prepareDBRequest() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - // ******************************* - // Build Error Section - // ******************************* - public void prepareDBRequestError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("INFO", " ***** Inside prepareDBRequestError of DeleteCustomE2EServiceInstance ***** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("DELSI_requestId") - String statusMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - statusMessage = wfe.getErrorMessage() - - } else { - statusMessage = "Encountered Error during DeleteCustomE2EServiceInstance proccessing. " - } - - //TODO - verify the format for Service Instance Create, - String dbRequest = - """ - - - - ${requestId} - BPMN - ${statusMessage} - - FAILED - - - """ - - String buildDBRequestAsString = utils.formatXml(dbRequest) - execution.setVariable("DELSI_createDBInfraErrorRequest", buildDBRequestAsString) - utils.logAudit(buildDBRequestAsString) - - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in DeleteCustomE2EServiceInstance flow. Unexpected Error from method prepareDBRequestError() - " + ex.getMessage() - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void processJavaException(DelegateExecution execution) { - //TODO: - } - - /** - * Init the service Operation Status - */ - public void prepareInitServiceOperationStatus(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) - try{ - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String userId = "" - String result = "processing" - String progress = "0" - String reason = "" - String operationContent = "Prepare service creation" - utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) - serviceId = UriUtils.encode(serviceId,"UTF-8") - - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) - - String payload = - """ - - - - ${serviceId} - ${operationId} - DELETE - ${userId} - ${result} - ${operationContent} - ${progress} - ${reason} - - - """ - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) - execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) - } - utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy deleted file mode 100644 index c731a613cc..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy +++ /dev/null @@ -1,374 +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.bpmn.infrastructure.scripts; - -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; - -import java.util.UUID; -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource -import static org.apache.commons.lang3.StringUtils.*; - -import org.springframework.web.util.UriUtils; - -/** - * This groovy class supports the DelServiceInstance.bpmn process. - * - */ -public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskProcessor { - - String Prefix="DELSI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - String msg = "" - - utils.log("DEBUG", " *** preProcessRequest Request *** ", isDebugEnabled) - - try { - // check for incoming json message/input - String siRequest = execution.getVariable("bpmnRequest") - utils.logAudit(siRequest) - - - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("msoRequestId", requestId) - utils.log("DEBUG", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)) { - msg = "Input serviceInstanceId' is null" - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - //String xmlRequestDetails = vidUtils.getJsonRequestDetailstoXml(siRequest) - //execution.setVariable("requestDetails", xmlRequestDetails) - - //modelInfo - String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") - if (isBlank(serviceModelInfo)) { - msg = "Input serviceModelInfo is null" - utils.log("DEBUG", msg, isDebugEnabled) - } else - { - execution.setVariable("serviceModelInfo", serviceModelInfo) - //utils.log("DEBUG", "modelInfo" + serviceModelInfo, isDebugEnabled) - } - - //requestInfo - String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") - if (isBlank(productFamilyId)) - { - msg = "Input productFamilyId is null" - utils.log("DEBUG", msg, isDebugEnabled) - //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("productFamilyId", productFamilyId) - } - String source = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source") - execution.setVariable("source", source) - - //subscriberInfo - String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") - if (isBlank(globalSubscriberId)) { - msg = "Input globalSubscriberId' is null" - utils.log("DEBUG", msg, isDebugEnabled) - } else { - execution.setVariable("globalSubscriberId", globalSubscriberId) - } - - //requestParameters - String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") - if (isBlank(subscriptionServiceType)) { - msg = "Input subscriptionServiceType is null" - utils.log("DEBUG", msg, isDebugEnabled) - //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - } - - /* - * Extracting User Parameters from incoming Request and converting into a Map - */ - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - - Map reqMap = jsonSlurper.parseText(siRequest) - - //InputParams - def userParams = reqMap.requestDetails?.requestParameters?.userParams - - Map inputMap = [:] - if (userParams) { - userParams.each { - userParam -> inputMap.put(userParam.name, userParam.value.toString()) - } - } - - utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) - execution.setVariable("serviceInputParams", inputMap) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - // RESTResponse (for API Handler (APIH) Reply Task) - String syncResponse = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) - sendWorkflowResponse(execution, 202, syncResponse) - - } catch (Exception ex) { - String msg = "Exception in sendSyncResponse: " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) - } - - public void sendSyncError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncError *** ", isDebugEnabled) - - try { - String errorMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """ - ${errorMessage} - 7000 - """ - - utils.logAudit(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - - } catch (Exception ex) { - utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) - } - - } - - public void prepareCompletionRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** prepareCompletion *** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("msoRequestId") - String source = execution.getVariable("source") - String msoCompletionRequest = - """ - - ${requestId} - DELETE - ${source} - - Service Instance was deleted successfully. - DeleteGenericALaCarteServiceInstance - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - execution.setVariable("completionRequest", xmlMsoCompletionRequest) - utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - - } catch (Exception ex) { - String msg = " Exception in prepareCompletion:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG", "*** Exit prepareCompletionRequest ***", isDebugEnabled) - } - - public void prepareFalloutRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** prepareFalloutRequest *** ", isDebugEnabled) - - try { - WorkflowException wfex = execution.getVariable("WorkflowException") - utils.log("DEBUG", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) - String requestId = execution.getVariable("msoRequestId") - String source = execution.getVariable("source") - String requestInfo = - """ - ${requestId} - DELETE - ${source} - """ - - String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) - execution.setVariable("falloutRequest", falloutRequest) - } catch (Exception ex) { - utils.log("DEBUG", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) - String errorException = " Bpmn error encountered in CreateServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() - String requestId = execution.getVariable("msoRequestId") - String falloutRequest = - """ - - ${requestId} - DELETE - VID - - - ${errorException} - 7000 - - """ - - execution.setVariable("falloutRequest", falloutRequest) - } - utils.log("DEBUG", "*** Exit prepareFalloutRequest ***", isDebugEnabled) - } - - - // ******************************* - // Build DB request Section - // ******************************* - public void prepareDBRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - try { - utils.log("DEBUG", " ***** Inside prepareDBRequest of DeleteGenericALaCarteServiceInstance ***** ", isDebugEnabled) - - String requestId = execution.getVariable("DELSI_requestId") - String statusMessage = "Service Instance successfully deleted." - - //TODO - verify the format for Service Instance Delete, - String dbRequest = - """ - - - - ${requestId} - BPMN - ${statusMessage} - - COMPLETED - 100 - - - """ - - String buildDeleteDBRequestAsString = utils.formatXml(dbRequest) - execution.setVariable("DELSI_createDBRequest", buildDeleteDBRequestAsString) - utils.logAudit(buildDeleteDBRequestAsString) - - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in DeleteGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDBRequest() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - // ******************************* - // Build Error Section - // ******************************* - public void prepareDBRequestError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside prepareDBRequestError of DeleteGenericALaCarteServiceInstance ***** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("DELSI_requestId") - String statusMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - statusMessage = wfe.getErrorMessage() - - } else { - statusMessage = "Encountered Error during DeleteGenericALaCarteServiceInstance proccessing. " - } - - //TODO - verify the format for Service Instance Create, - String dbRequest = - """ - - - - ${requestId} - BPMN - ${statusMessage} - - FAILED - - - """ - - String buildDBRequestAsString = utils.formatXml(dbRequest) - execution.setVariable("DELSI_createDBInfraErrorRequest", buildDBRequestAsString) - utils.logAudit(buildDBRequestAsString) - - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in DeleteGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDBRequestError() - " + ex.getMessage() - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy deleted file mode 100644 index a9aef7f3ee..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy +++ /dev/null @@ -1,421 +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.bpmn.infrastructure.scripts; - -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.NetworkUtils -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.rest.APIResponse -import java.util.UUID; -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils -import groovy.xml.XmlUtil -import groovy.json.* - -public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { - String Prefix="DELNI_" - String groovyClassName = "DeleteNetworkInstance" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - NetworkUtils networkUtils = new NetworkUtils() - - - public InitializeProcessVariables(DelegateExecution execution){ - - execution.setVariable(Prefix + "Success", false) - - execution.setVariable(Prefix + "CompleteMsoProcessRequest", "") - execution.setVariable(Prefix + "FalloutHandlerRequest", "") - execution.setVariable(Prefix + "isSilentSuccess", false) - - } - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest() of " + groovyClassName + " ***** ", isDebugEnabled) - - try { - // initialize flow variables - InitializeProcessVariables(execution) - - String sdncVersion = execution.getVariable("sdncVersion") - if (sdncVersion == null || sdncVersion == '1610') { - // 'a-la-cart' default, sdncVersion = '1610' - execution.setVariable("sdncVersion", "1610") - String bpmnRequest = execution.getVariable("bpmnRequest") - // set 'disableRollback' - if (bpmnRequest != null) { - String disableRollback = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.requestInfo.suppressRollback") - if (disableRollback != null) { - execution.setVariable("disableRollback", disableRollback) - utils.log("DEBUG", "Received 'suppressRollback': " + disableRollback , isDebugEnabled) - } else { - execution.setVariable("disableRollback", false) - } - utils.log("DEBUG", " Set 'disableRollback' : " + execution.getVariable("disableRollback") , isDebugEnabled) - } else { - String dataErrorMessage = " Invalid 'bpmnRequest' request." - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - } else { - // 'macro' test ONLY, sdncVersion = '1702' - utils.log("DEBUG", " 'disableRollback' : " + execution.getVariable("disableRollback") , isDebugEnabled) - } - - // get/set 'msoRequestId' and 'mso-request-id' - String requestId = execution.getVariable("msoRequestId") - if (requestId != null) { - execution.setVariable("mso-request-id", requestId) - } else { - requestId = execution.getVariable("mso-request-id") - } - execution.setVariable(Prefix + "requestId", requestId) - - // get/set 'requestId' - if (execution.getVariable("requestId") == null) { - execution.setVariable("requestId", requestId) - } - - // set action to "DELETE" - execution.setVariable("action", "DELETE") - - //Place holder for additional code. - - // TODO ??? - // userParams??? 1) pre-loads indicator, 2) 'auto-activation' - // Tag/Value parameters - // - // Map: 'networkInputParams': 'auto-activation'' - // Sample format? - // "requestParameters": { - // "userParams": [ - // { - // "name": "someUserParam1", - // "value": "someValue1" - // } - // ] - // } - // - // String userParams = //use json util to extract "userParams"// - // execution.setVariable("networkInputParams", userParams) - // else: execution.setVariable("networkInputParams", null) - // - - - } catch (Exception ex){ - sendSyncError(execution) - String exceptionMessage = "Exception Encountered in " + groovyClassName + ", PreProcessRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void getNetworkModelInfo (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside getNetworkModelInfo() of DeleteNetworkInstance ***** ", isDebugEnabled) - - try { - - // For Ala-Carte (sdnc = 1610): - // 1. the Network ModelInfo is expected to be sent - // via requestDetails.modelInfo (modelType = network), ex: modelCustomizationId. - // 2. the Service ModelInfo is expected to be sent but will be IGNORE - // via requestDetails.relatedInstanceList.relatedInstance.modelInfo (modelType = service) - - } catch (Exception ex) { - sendSyncError(execution) - String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstance flow. getNetworkModelInfo() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside sendSyncResponse() of DeleteNetworkInstance ***** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("mso-request-id") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - // RESTResponse (for API Handler (APIH) Reply Task) - String deleteNetworkRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - - utils.log("DEBUG", " sendSyncResponse to APIH - " + "\n" + deleteNetworkRestRequest, isDebugEnabled) - - sendWorkflowResponse(execution, 202, deleteNetworkRestRequest) - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Exception Encountered in DeleteNetworkInstance, sendSyncResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareCompletion (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareCompletion() of CreateNetworkInstance ***** ", isDebugEnabled) - - try { - - String requestId = execution.getVariable("mso-request-id") - String source = execution.getVariable(Prefix + "source") - - String msoCompletionRequest = - """ - - ${requestId} - DELETE - VID - - Network has been deleted successfully. - BPMN Network action: DELETE - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - // normal path - execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) - utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. prepareCompletion() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - - } - - public void prepareDBRequestError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - try { - utils.log("DEBUG", " ***** Inside prepareDBRequestError of DeleteNetworkInstance ***** ", isDebugEnabled) - - // set DB Header Authorization - setBasicDBAuthHeader(execution, isDebugEnabled) - - WorkflowException wfe = execution.getVariable("WorkflowException") - String statusMessage = wfe.getErrorMessage() - String requestId = execution.getVariable(Prefix +"requestId") - - String dbRequest = - """ - - - - ${requestId} - BPMN - ${statusMessage} - - FAILED - - <network-outputs xmlns="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:aetgt="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"/> - - - """ - - execution.setVariable(Prefix + "deleteDBRequest", dbRequest) - utils.log("DEBUG", " DB Adapter Request - " + "\n" + dbRequest, isDebugEnabled) - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstance, prepareDBRequestError() - " + ex.getMessage() - logError(exceptionMessage) - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - // ************************************************** - // Post or Validate Response Section - // ************************************************** - - public void postProcessResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside postProcessResponse() of DeleteNetworkInstance ***** ", isDebugEnabled) - - try { - if (execution.getVariable("CMSO_ResponseCode") == "200") { - execution.setVariable(Prefix + "Success", true) - utils.log("DEBUG", " ***** DeleteNetworkInstance Success ***** ", isDebugEnabled) - // Place holder for additional code. - - } else { - execution.setVariable(Prefix + "Success", false) - utils.log("DEBUG", " ***** DeleteNetworkInstance Failed in CompletionMsoProces flow!. ***** ", isDebugEnabled) - - } - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DeleteNetworkInstance flow. postProcessResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - // ******************************* - // Build Error Section - // ******************************* - - // Prepare for FalloutHandler - public void buildErrorResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler. *****", isDebugEnabled) - - String dbReturnCode = execution.getVariable(Prefix + "dbReturnCode") - utils.log("DEBUG", " ***** DB Update Response Code : " + dbReturnCode, isDebugEnabled) - utils.log("DEBUG", " ***** DB Update Response String: " + '\n' + execution.getVariable(Prefix + "deleteDBResponse"), isDebugEnabled) - - String falloutHandlerRequest = "" - String requestId = execution.getVariable("mso-request-id") - String source = execution.getVariable(Prefix + "source") - execution.setVariable(Prefix + "Success", false) - try { - WorkflowException wfe = execution.getVariable("WorkflowException") - String errorCode = String.valueOf(wfe.getErrorCode()) - String errorMessage = wfe.getErrorMessage() - - falloutHandlerRequest = - """ - - ${requestId} - DELETE - ${source} - - - ${errorMessage} - ${errorCode} - - """ - - utils.logAudit(falloutHandlerRequest) - execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - utils.log("ERROR", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstance, buildErrorResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - falloutHandlerRequest = - """ - - ${requestId} - DELEtE - ${source} - - - ${exceptionMessage} - 9999 - - """ - execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - utils.log("DEBUG", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) - } - } - - - public void sendSyncError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - try { - String requestId = execution.getVariable("mso-request-id") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - // RESTResponse (for API Handler (APIH) Reply Task) - String deleteNetworkRestError = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - - utils.log("DEBUG", " sendSyncResponse to APIH - " + "\n" + deleteNetworkRestError, isDebugEnabled) - - sendWorkflowResponse(execution, 500, deleteNetworkRestError) - - } catch (Exception ex) { - utils.log("DEBUG", " Sending Sync Error Activity Failed - DeleteNetworkInstance, sendSyncError(): " + "\n" + ex.getMessage(), isDebugEnabled) - } - } - - public void processJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - try{ - utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable("UnexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method") - } - utils.log("DEBUG", "Completed processJavaException Method of " + Prefix, isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy deleted file mode 100644 index 9a12a699f9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ /dev/null @@ -1,320 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - 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.openecomp.mso.bpmn.infrastructure.scripts - -import org.json.JSONObject -import org.json.XML; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.recipe.ResourceInput; -import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.rest.APIResponse; - -/** - * This groovy class supports the DeleteSDNCCNetworkResource.bpmn process. - * flow for SDNC Network Resource - */ -public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { - - String Prefix="DELSDNCRES_" - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - JsonUtils jsonUtil = new JsonUtils() - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - - public void preProcessRequest(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started preProcessRequest *****", isDebugEnabled) - try { - - //get bpmn inputs from resource request. - String requestId = execution.getVariable("mso-request-id") - String requestAction = execution.getVariable("requestAction") - utils.log("INFO","The requestAction is: " + requestAction, isDebugEnabled) - String recipeParamsFromRequest = execution.getVariable("recipeParams") - utils.log("INFO","The recipeParams is: " + recipeParamsFromRequest, isDebugEnabled) - String resourceInput = execution.getVariable("resourceInput") - utils.log("INFO","The resourceInput is: " + resourceInput, isDebugEnabled) - //Get ResourceInput Object - ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) - execution.setVariable(Prefix + "resourceInput", resourceInputObj) - - //Deal with recipeParams - String recipeParamsFromWf = execution.getVariable("recipeParamXsd") - String resourceModelName = resourceInputObj.getResourceModelInfo().getModelName() - //For sdnc requestAction default is "NetworkInstance" - String operationType = "Network" - if(!StringUtils.isBlank(recipeParamsFromRequest) && "null" != recipeParamsFromRequest){ - //the operationType from worflow(first node) is second priority. - operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") - } - if(!StringUtils.isBlank(recipeParamsFromWf)){ - //the operationType from worflow(first node) is highest priority. - operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") - } - - - //For sdnc, generate svc_action and request_action - String sdnc_svcAction = "delete" - if(StringUtils.containsIgnoreCase(resourceModelName, "overlay")){ - //This will be resolved in R3. - sdnc_svcAction ="deactivate" - operationType = "NCINetwork" - } - if(StringUtils.containsIgnoreCase(resourceModelName, "underlay")){ - //This will be resolved in R3. - operationType ="Network" - } - String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" - execution.setVariable(Prefix + "svcAction", sdnc_svcAction) - execution.setVariable(Prefix + "requestAction", sdnc_requestAction) - execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) - execution.setVariable("mso-request-id", requestId) - execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) - //TODO Here build networkrequest - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - - /** - * Pre Process the BPMN Flow Request - * Inclouds: - * generate the nsOperationKey - * generate the nsParameters - */ - public void prepareSDNCRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled) - - try { - // get variables - String sdnc_svcAction = execution.getVariable(Prefix + "svcAction") - String sdnc_requestAction = execution.getVariable(Prefix + "requestAction") - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") - - String hdrRequestId = execution.getVariable("mso-request-id") - String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - String source = execution.getVariable("source") - String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") - String serviceType = resourceInputObj.getServiceType() - String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() - String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() - String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion() - String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName() - String globalCustomerId = resourceInputObj.getGlobalSubscriberId() - String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid(); - String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() - String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() - String modelName = resourceInputObj.getResourceModelInfo().getModelName() - String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() - // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyDeleteRequest = - """ - - ${hdrRequestId} - ${serviceInstanceId} - ${sdnc_svcAction} - network-topology-operation - sdncCallback - generic-resource - - - - ${hdrRequestId} - ${sdnc_requestAction} - ${source} - - - - - - ${serviceInstanceId} - ${serviceType} - - ${serviceModelInvariantUuid} - ${serviceModelUuid} - ${serviceModelVersion} - ${serviceModelName} - - ${serviceInstanceId} - ${globalCustomerId} - - - - ${modelInvariantUuid} - ${modelCustomizationUuid} - ${modelUuid} - ${modelVersion} - ${modelName} - - - - - - - """.trim() - - String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) - utils.logAudit(sndcTopologyDeleteRequesAsString) - execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) - utils.log("INFO","sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DeleteSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) - } - - private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - execution.setVariable("CVFMI_updateResOperStatusRequest", body) - } - - public void prepareUpdateBeforeDeleteSDNCResource(DelegateExecution execution) { - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") - String operType = resourceInputObj.getOperationType() - String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() - String serviceInstanceId = resourceInputObj.getServiceInstanceId() - String operationId = resourceInputObj.getOperationId() - String progress = "20" - String status = "processing" - String statusDescription = "SDCN resource delete invoked" - - //String operationId = execution.getVariable("operationId") - - String body = """ - - - - - ${operType} - ${operationId} - ${progress} - ${resourceCustomizationUuid} - ${serviceInstanceId} - ${status} - ${statusDescription} - - - """; - - setProgressUpdateVariables(execution, body) - - } - - public void prepareUpdateAfterDeleteSDNCResource(DelegateExecution execution) { - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") - String operType = resourceInputObj.getOperationType() - String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() - String serviceInstanceId = resourceInputObj.getServiceInstanceId() - String operationId = resourceInputObj.getOperationId() - String progress = "100" - String status = "finished" - String statusDescription = "SDCN resource delete completed" - - //String operationId = execution.getVariable("operationId") - - String body = """ - - - - - ${operType} - ${operationId} - ${progress} - ${resourceCustomizationUuid} - ${serviceInstanceId} - ${status} - ${statusDescription} - - - """; - - setProgressUpdateVariables(execution, body) - } - - public void postDeleteSDNCCall(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled) - String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") - String responseObj = execution.getVariable(Prefix + "SuccessIndicator") - - utils.log("INFO","response from sdnc, response code :" + responseCode + " response object :" + responseObj, isDebugEnabled) - utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) - - try { - String operationStatus = "finished" - // RESTResponse for main flow - String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) - sendWorkflowResponse(execution, 202, resourceOperationResp) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy deleted file mode 100644 index 72b88cb13d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy +++ /dev/null @@ -1,87 +0,0 @@ - -/*- - * ============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.openecomp.mso.bpmn.infrastructure.scripts - -import com.fasterxml.jackson.databind.ObjectMapper -import org.openecomp.mso.bpmn.common.recipe.ResourceInput -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil - - -public class DeleteVFCNSResource extends AbstractServiceTaskProcessor { - - String Prefix = "DCUSE_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** start preProcessRequest *****", isDebugEnabled) - - String resourceInputStr = execution.getVariable("resourceInput") - ResourceInput resourceInput = new ObjectMapper().readValue(resourceInputStr, ResourceInput.class) - - String globalSubscriberId = resourceInput.getGlobalSubscriberId() - String serviceType = execution.getVariable("serviceType") - String operationId = resourceInput.getOperationId() - String resourceModeluuid = resourceInput.getResourceModelInfo().getModelCustomizationUuid() - String resourceInstanceId = resourceInput.getResourceInstancenUuid() - - - execution.setVariable("globalSubscriberId",globalSubscriberId) - execution.setVariable("serviceType", serviceType) - execution.setVariable("operationId", operationId) - execution.setVariable("resourceTemplateId", resourceModeluuid) - execution.setVariable("resourceInstanceId", resourceInstanceId) - - utils.log("INFO"," ***** end preProcessRequest *****", isDebugEnabled) - } - - public void postProcessRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** start postProcessRequest *****", isDebugEnabled) - - utils.log("INFO"," ***** end postProcessRequest *****", isDebugEnabled) - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) - - try { - String nsInstanceId = execution.getVariable("nsInstanceId") - String operationStatus = execution.getVariable("operationStatus") - // RESTResponse for main flow - String createVFCResourceRestRsp = """{"nsInstanceId":"${nsInstanceId}","operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + createVFCResourceRestRsp, isDebugEnabled) - sendWorkflowResponse(execution, 202, createVFCResourceRestRsp) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy deleted file mode 100644 index 0aef81770f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy +++ /dev/null @@ -1,375 +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.bpmn.infrastructure.scripts - -import groovy.util.Node -import groovy.util.XmlParser; -import groovy.xml.QName - -import java.io.Serializable; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution - -import groovy.json.JsonSlurper - -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils; - - -public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - /** - * Initialize the flow's variables. - * - * @param execution The flow's execution instance. - */ - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable('prefix', 'DELVfModI_') - execution.setVariable('DELVfModI_requestInfo', null) - execution.setVariable('DELVfModI_requestId', null) - execution.setVariable('DELVfModI_source', null) - execution.setVariable('DELVfModI_vnfInputs', null) - execution.setVariable('DELVfModI_vnfId', null) - execution.setVariable('DELVfModI_vfModuleId', null) - execution.setVariable('DELVfModI_tenantId', null) - execution.setVariable('DELVfModI_volumeGroupId', null) - execution.setVariable('DELVfModI_vnfParams', null) - execution.setVariable('DELVfModI_updateInfraRequest', null) - execution.setVariable('DeleteVfModuleRequest', null) - execution.setVariable('DeleteVfModuleSuccessIndicator', false) - } - - /** - * Process the incoming DELETE_VF_MODULE vnf-request. - * - * @param execution The flow's execution instance. - */ - public void preProcessRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("isVidRequest", "false") - initProcessVariables(execution) - - def prefix = execution.getVariable('prefix') - - def incomingRequest = execution.getVariable('bpmnRequest') - - utils.log("DEBUG", "Incoming Infra Request: " + incomingRequest, isDebugLogEnabled) - utils.logAudit("DeleteVfModule Infra incoming Request: " + incomingRequest) - - // check if request is xml or json - try { - def jsonSlurper = new JsonSlurper() - Map reqMap = jsonSlurper.parseText(incomingRequest) - utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled) - - def serviceInstanceId = execution.getVariable('serviceInstanceId') - utils.log("DEBUG", "serviceInstanceId is: " + serviceInstanceId, isDebugLogEnabled) - def vnfId = execution.getVariable('vnfId') - utils.log("DEBUG", "vnfId is: " + vnfId, isDebugLogEnabled) - def cloudConfiguration = jsonUtil.getJsonValue(incomingRequest, "requestDetails.cloudConfiguration") - execution.setVariable("cloudConfiguration", cloudConfiguration) - utils.log("DEBUG", "CloudConfiguration is: " + cloudConfiguration, isDebugLogEnabled) - def vfModuleModelInfo = jsonUtil.getJsonValue(incomingRequest, "requestDetails.modelInfo") - - execution.setVariable("vfModuleModelInfo", vfModuleModelInfo) - utils.log("DEBUG", "VfModuleModelInfo is: " + vfModuleModelInfo, isDebugLogEnabled) - - // This is aLaCarte flow, so aLaCarte flag is always on - execution.setVariable('aLaCarte', true) - - def vidUtils = new VidUtils(this) - - String requestInXmlFormat = vidUtils.createXmlVfModuleRequest(execution, reqMap, 'DELETE_VF_MODULE', serviceInstanceId) - - utils.log("DEBUG", " Request in XML format: " + requestInXmlFormat, isDebugLogEnabled) - - setBasicDBAuthHeader(execution, isDebugLogEnabled) - - execution.setVariable(prefix + 'Request', requestInXmlFormat) - execution.setVariable(prefix+'vnfId', vnfId) - execution.setVariable("isVidRequest", "true") - - } - catch(groovy.json.JsonException je) { - utils.log("DEBUG", " Request is not in JSON format.", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request") - - } - catch(Exception e) { - String restFaultMessage = e.getMessage() - utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request") - } - - - try { - - String request = validateRequest(execution) - execution.setVariable('DeleteVfModuleRequest', request) - utils.logAudit("DeleteVfModuleInfra Request: " + request) - - def requestInfo = getRequiredNodeXml(execution, request, 'request-info') - execution.setVariable('DELVfModI_requestInfo', requestInfo) - execution.setVariable('DELVfModI_requestId', getRequiredNodeText(execution, requestInfo, 'request-id')) - execution.setVariable('DELVfModI_source', getNodeTextForce(requestInfo, 'source')) - - def vnfInputs = getRequiredNodeXml(execution, request, 'vnf-inputs') - execution.setVariable('DELVfModI_vnfInputs', vnfInputs) - execution.setVariable('DELVfModI_vnfId', getRequiredNodeText(execution, vnfInputs, 'vnf-id')) - execution.setVariable('DELVfModI_vfModuleId', getRequiredNodeText(execution, vnfInputs, 'vf-module-id')) - execution.setVariable('DELVfModI_vfModuleName', getNodeTextForce(vnfInputs, 'vf-module-name')) - execution.setVariable('DELVfModI_tenantId', getRequiredNodeText(execution, vnfInputs, 'tenant-id')) - execution.setVariable('DELVfModI_volumeGroupId', getNodeTextForce(vnfInputs, 'volume-group-id')) - - def vnfParams = utils.getNodeXml(request, 'vnf-params') - execution.setVariable('DELVfModI_vnfParams', vnfParams) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) - } - } - - /** - * Sends the 'IN_PROGRESS' synchronous response. - * - * @param execution The flow's execution instance. - */ - public void sendSynchResponse(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sendResponse(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def requestInfo = execution.getVariable('DELVfModI_requestInfo') - def requestId = execution.getVariable('DELVfModI_requestId') - def source = execution.getVariable('DELVfModI_source') - def progress = getNodeTextForce(requestInfo, 'progress') - if (progress.isEmpty()) { - progress = '0' - } - def startTime = getNodeTextForce(requestInfo, 'start-time') - if (startTime.isEmpty()) { - startTime = System.currentTimeMillis() - } - - // RESTResponse (for API Handler (APIH) Reply Task) - def vfModuleId = execution.getVariable('DELVfModI_vfModuleId') - String synchResponse = """{"requestReferences":{"instanceId":"${vfModuleId}","requestId":"${requestId}"}}""".trim() - - utils.logAudit("DeleteVfModuleInfra Synch Response: " + synchResponse) - sendWorkflowResponse(execution, 200, synchResponse) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) - } - } - - /** - * Currently passing the entire DELETE_VF_MODULE vnf-request to DoDeleteVfModule. - * 'DeleteVfModuleRequest' is now being set in preProcessRequest(). - * TBD: may want to eventually create a specific request that only contains the needed fields. - * - * @param execution The flow's execution instance. - */ - public void prepDoDeleteVfModule(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepDoDeleteVfModule(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoDeleteVfModule(): ' + e.getMessage()) - } - } - - /** - * Prepare the DB update to add an entry for the Vf Module request. - * - * @param execution The flow's execution instance. - */ - public void prepUpdateInfraRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepUpdateInfraRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def requestId = execution.getVariable('DELVfModI_requestId') - def vnfId = execution.getVariable('DELVfModI_vnfId') - def vfModuleId = execution.getVariable('DELVfModI_vfModuleId') - def tenantId = execution.getVariable('DELVfModI_tenantId') - def volumeGroupId = execution.getVariable('DELVfModI_volumeGroupId') - - String updateInfraRequest = """ - - - - - ${requestId} - BPMN - COMPLETED - 100 - - - - """ - - updateInfraRequest = utils.formatXml(updateInfraRequest) - execution.setVariable('DELVfModI_updateInfraRequest', updateInfraRequest) - utils.logAudit("DeleteAAIVfModuleInfra Update Request: " + updateInfraRequest) - logDebug('Request for Update Infra Request:\n' + updateInfraRequest, isDebugLogEnabled) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepInfraRequest(): ' + e.getMessage()) - } - } - - /** - * Builds a "CompletionHandler" request and stores it in the specified execution variable. - * - * @param execution the execution - * @param resultVar the execution variable in which the result will be stored - */ - public void completionHandlerPrep(DelegateExecution execution, String resultVar) { - def method = getClass().getSimpleName() + '.completionHandlerPrep(' + - 'execution=' + execution.getId() + - ', resultVar=' + resultVar + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def request = execution.getVariable("DeleteVfModuleRequest") - def requestInfo = utils.getNodeXml(request, 'request-info', false) - def action = utils.getNodeText1(requestInfo, "action") - - String content = - """ - - ${requestInfo} - - Vf Module has been deleted successfully. - BPMN - """ - - content = utils.formatXml(content) - logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) - utils.logAudit("DeleteVfModule Infra Completion Handler Request: " + content) - execution.setVariable(resultVar, content) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') - } - } - - /** - * Builds a "FalloutHandler" request and stores it in the specified execution variable. - * - * @param execution the execution - * @param resultVar the execution variable in which the result will be stored - */ - public void falloutHandlerPrep(DelegateExecution execution, String resultVar) { - def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + - 'execution=' + execution.getId() + - ', resultVar=' + resultVar + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def prefix = execution.getVariable('prefix') - def request = execution.getVariable("DeleteVfModuleRequest") - def requestInfo = utils.getNodeXml(request, 'request-info', false) - def WorkflowException workflowException = execution.getVariable("WorkflowException") - def errorResponseCode = workflowException.getErrorCode() - def errorResponseMsg = workflowException.getErrorMessage() - def encErrorResponseMsg = "" - if (errorResponseMsg != null) { - encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">") - } - - String content = """ - - ${requestInfo} - - ${encErrorResponseMsg} - ${errorResponseCode} - - - """ - content = utils.formatXml(content) - utils.logAudit("DeleteVfModuleInfra Fallout Handler Request: " + content) - logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) - execution.setVariable(resultVar, content) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') - } - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy deleted file mode 100644 index 5a38d9f011..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy +++ /dev/null @@ -1,549 +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.bpmn.infrastructure.scripts; - -import groovy.json.JsonSlurper - -import java.util.concurrent.ExecutionException; - -import org.springframework.web.util.UriUtils -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.openecomp.mso.bpmn.common.scripts.AaiUtil; -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse - -/** - * This groovy class supports the DeleteVfModuleVolume.bpmn process. - */ -public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { - - private XmlParser xmlParser = new XmlParser() - /** - * This method is executed during the preProcessRequest task of the DeleteVfModuleVolume.bpmn process. - * @param execution - */ - public InitializeProcessVariables(DelegateExecution execution){ - execution.setVariable('prefix', 'DELVfModVol_') - execution.setVariable("DELVfModVol_volumeRequest", null) - execution.setVariable('DELVfModVol_requestInfo', null) - execution.setVariable('DELVfModVol_requestId', null) - execution.setVariable('DELVfModVol_source', null) - execution.setVariable('DELVfModVol_volumeInputs', null) - execution.setVariable('DELVfModVol_volumeOutputs', null) - execution.setVariable('DELVfModVol_volumeGroupId', null) - execution.setVariable('DELVfModVol_vnfType', null) - execution.setVariable('DELVfModVol_serviceId', null) - execution.setVariable('DELVfModVol_cloudRegion', null) - execution.setVariable('DELVfModVol_tenantId', null) - execution.setVariable('DELVfModVol_volumeParams', null) - execution.setVariable('DELVfModVol_volumeGroupHeatStackId', null) - execution.setVariable('DELVfModVol_volumeGroupTenantId', null) - execution.setVariable("DELVfModVol_queryAAIVolGrpResponse", null) - execution.setVariable('DELVfModVol_messageId', null) - execution.setVariable('DELVfModVol_deleteVnfARequest', null) - execution.setVariable('DELVfModVol_updateInfraRequest', null) - execution.setVariable('DELVfModVol_CompleteMsoProcessRequest', null) - execution.setVariable('DELVfModVol_WorkflowException', null) - execution.setVariable('DELVfModVol_TransactionSuccessIndicator', false) - execution.setVariable("DELVfModVol_isErrorMessageException", false) - execution.setVariable('DELVfModVol_syncResponseSent', false) - } - - /** - * Perform initial processing, such as request validation, initialization of variables, etc. - * * @param execution - */ - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - preProcessRequest(execution, isDebugEnabled) - } - - /** - * This method is executed during the preProcessRequest task of the DeleteVfModuleVolume.bpmn process. - * @param execution - */ - public void preProcessRequest (DelegateExecution execution, isDebugLogEnabled) { - - InitializeProcessVariables(execution) - - String createVolumeIncoming = validateRequest(execution) - utils.logAudit(createVolumeIncoming) - - // check if request is xml or json - try { - def jsonSlurper = new JsonSlurper() - Map reqMap = jsonSlurper.parseText(createVolumeIncoming) - utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled) - - def serviceInstanceId = execution.getVariable('serviceInstanceId') - def volumeGroupId = execution.getVariable('volumeGroupId') - def vidUtils = new VidUtils(this) - createVolumeIncoming = vidUtils.createXmlVolumeRequest(reqMap, 'DELETE_VF_MODULE_VOL', serviceInstanceId, volumeGroupId) - execution.setVariable("DELVfModVol_isVidRequest", true) - } - catch(groovy.json.JsonException je) { - utils.log("DEBUG", " Request is in XML format.", isDebugLogEnabled) - // assume request is in XML format - proceed as usual to process XML request - } - - String request = utils.getNodeXml(createVolumeIncoming, "volume-request").drop(38).trim().replace("tag0:","").replace(":tag0","") - execution.setVariable("DELVfModVol_volumeRequest", request) - - def requestInfo = getRequiredNodeXml(execution, request, 'request-info') - execution.setVariable('DELVfModVol_requestInfo', requestInfo) - String requestId = execution.getVariable("mso-request-id") - if (requestId == null || requestId == "") { - requestId = getRequiredNodeText(execution, requestInfo, 'request-id') - } - execution.setVariable('DELVfModVol_requestId', requestId) - execution.setVariable('DELVfModVol_source', getNodeTextForce(requestInfo, 'source')) - - def volumeInputs = getRequiredNodeXml(execution, request, 'volume-inputs') - execution.setVariable('DELVfModVol_volumeInputs', volumeInputs) - execution.setVariable('DELVfModVol_volumeGroupId', getRequiredNodeText(execution, volumeInputs, 'volume-group-id')) - execution.setVariable('DELVfModVol_vnfType', getRequiredNodeText(execution, volumeInputs, 'vnf-type')) - execution.setVariable('DELVfModVol_serviceId', utils.getNodeText1(volumeInputs, 'service-id')) - execution.setVariable('DELVfModVol_tenantId', getRequiredNodeText(execution, volumeInputs, 'tenant-id')) - execution.setVariable('DELVfModVol_messageId', UUID.randomUUID().toString()) - execution.setVariable('DELVfModVol_volumeOutputs', utils.getNodeXml(request, 'volume-outputs', false)) - execution.setVariable('DELVfModVol_volumeParams', utils.getNodeXml(request, 'volume-params')) - execution.setVariable('DELVfModVol_cloudRegion', utils.getNodeText1(request, 'aic-cloud-region')) - - setBasicDBAuthHeader(execution, isDebugLogEnabled) - - logDebug('Request: ' + createVolumeIncoming, isDebugLogEnabled) - } - - public void sendSyncResponse (DelegateExecution execution, isDebugEnabled) { - - String volumeRequest = execution.getVariable("DELVfModVol_volumeRequest") - utils.log("DEBUG", " DELVfModVol_volumeRequest - " + "\n" + volumeRequest, isDebugEnabled) - // RESTResponse (for API Handler (APIH) Reply Task) - String deleteVolumeRequest = - """ - - ${volumeRequest} - - """.trim() - - def isVidRequest = execution.getVariable('DELVfModVol_isVidRequest') - def syncResponse = '' - - if(isVidRequest) { - def serviceInstanceId = execution.getVariable('serviceInstanceId') - def volumeGroupId = execution.getVariable('volumeGroupId') - def requestId = execution.getVariable('DELVfModVol_requestId') - syncResponse = """{"requestReferences":{"instanceId":"${volumeGroupId}","requestId":"${requestId}"}}""".trim() - } - else { - syncResponse = utils.formatXml(deleteVolumeRequest) - } - - execution.setVariable('DELVfModVol_syncResponseSent', true) - - sendWorkflowResponse(execution, 200, syncResponse) - } - - - public void sendSyncError (DelegateExecution execution, isDebugEnabled) { - WorkflowException we = execution.getVariable('WorkflowException') - def errorCode = we?.getErrorCode() - def errorMessage = we?.getErrorMessage() - //default to 400 since only invalid request will trigger this method - sendWorkflowResponse(execution, 400, errorMessage) - } - - - public void callRESTQueryAAICloudRegion (DelegateExecution execution, isDebugEnabled) { - - String cloudRegion = execution.getVariable('DELVfModVol_cloudRegion') - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUtil = new AaiUtil(this) - String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) - String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion - utils.logAudit(queryCloudRegionRequest) - execution.setVariable("DELVfModVol_queryCloudRegionRequest", queryCloudRegionRequest) - utils.log("DEBUG", " DELVfModVol_queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest, isDebugEnabled) - - cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - if ((cloudRegion != "ERROR")) { - if(execution.getVariable("DELVfModVol_queryCloudRegionReturnCode") == "404"){ - execution.setVariable("DELVfModVol_aicCloudRegion", "AAIAIC25") - }else{ - execution.setVariable("DELVfModVol_aicCloudRegion", cloudRegion) - } - execution.setVariable("DELVfModVol_cloudRegion", cloudRegion) - execution.setVariable("DELVfModVol_isCloudRegionGood", true) - - } else { - utils.log("DEBUG", "AAI Query Cloud Region Unsuccessful.", isDebugEnabled) - execution.setVariable("DELVfModVol_isCloudRegionGood", false) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable("DELVfModVol_queryCloudRegionReturnCode")) - } - - utils.log("DEBUG", " is Cloud Region Good: " + execution.getVariable("DELVfModVol_isCloudRegionGood"), isDebugEnabled) - } - - /** - * Query volume group by id - * @param execution - */ - public void queryAAIForVolumeGroup(DelegateExecution execution, isDebugLogEnabled) { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - def volumeGroupId = execution.getVariable('DELVfModVol_volumeGroupId') - if(volumeGroupId == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, 'volume-group-id is not provided in the request') - throw new Exception('volume-group-id is not provided in the request') - } - String cloudRegion = execution.getVariable('DELVfModVol_aicCloudRegion') - - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) - String queryAAIVolumeGroupRequest = aaiEndpoint + '/' + URLEncoder.encode(cloudRegion, "UTF-8") + "/volume-groups/volume-group/" + UriUtils.encode(volumeGroupId, "UTF-8") - - utils.logAudit('Query AAI volume group by ID: ' + queryAAIVolumeGroupRequest) - logDebug('Query AAI volume group by ID: ' + queryAAIVolumeGroupRequest, isDebugLogEnabled) - - APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIVolumeGroupRequest) - - String returnCode = response.getStatusCode() - String aaiResponseAsString = response.getResponseBodyAsString() - aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) - - utils.logAudit("AAI query volume group by id return code: " + returnCode) - utils.logAudit("AAI query volume group by id response: " + aaiResponseAsString) - - execution.setVariable("DELVfModVol_queryAAIVolGrpResponse", aaiResponseAsString) - - if (returnCode=='200' || returnCode == '204') { - - def heatStackId = getNodeTextForce(aaiResponseAsString, 'heat-stack-id') - execution.setVariable('DELVfModVol_volumeGroupHeatStackId', heatStackId) - - if(hasVfModuleRelationship(aaiResponseAsString)){ - utils.log("DEBUG", 'Volume Group ' + volumeGroupId + ' currently in use', isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} currently in use - found vf-module relationship.") - } - - def volumeGroupTenantId = getTenantIdFromVolumeGroup(aaiResponseAsString) - if (volumeGroupTenantId == null) { - utils.log("DEBUG", "Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}") - } - - execution.setVariable('DELVfModVol_volumeGroupTenantId', volumeGroupTenantId) - logDebug('Received Tenant Id ' + volumeGroupTenantId + ' from AAI for Volume Group with Volume Group Id ' + volumeGroupId , isDebugLogEnabled) - } - else { - if (returnCode=='404') { - utils.log("DEBUG", "Volume Group ${volumeGroupId} not found in AAI", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} not found in AAI. Response code: 404") - } - else { - WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - throw new BpmnError("MSOWorkflowException") - } - } - } - - /** - * Extract the Tenant Id from the Volume Group information returned by AAI. - * - * @param volumeGroupXml Volume Group XML returned by AAI. - * @return the Tenant Id extracted from the Volume Group information. 'null' is returned if - * the Tenant Id is missing or could not otherwise be extracted. - */ - private String getTenantIdFromVolumeGroup(String volumeGroupXml) { - def Node volumeGroupNode = xmlParser.parseText(volumeGroupXml) - def Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list') - if (relationshipList != null) { - def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') - for (Node relationship in relationships) { - def Node relatedTo = utils.getChildNode(relationship, 'related-to') - if ((relatedTo != null) && (relatedTo.text().equals('tenant'))) { - def NodeList relationshipDataList = utils.getIdenticalChildren(relationship, 'relationship-data') - for (Node relationshipData in relationshipDataList) { - def Node relationshipKey = utils.getChildNode(relationshipData, 'relationship-key') - if ((relationshipKey != null) && (relationshipKey.text().equals('tenant.tenant-id'))) { - def Node relationshipValue = utils.getChildNode(relationshipData, 'relationship-value') - if (relationshipValue != null) { - return relationshipValue.text() - } - } - } - } - } - } - return null - } - - private boolean hasVnfRelationship(String volumeGroupXml) { - def Node volumeGroupNode = xmlParser.parseText(volumeGroupXml) - def Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list') - if (relationshipList != null) { - def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') - for (Node relationship in relationships) { - def Node relatedTo = utils.getChildNode(relationship, 'related-to') - if ((relatedTo != null) && (relatedTo.text().equals('generic-vnf'))) { - def Node relatedLink = utils.getChildNode(relationship, 'related-link') - if (relatedLink !=null && relatedLink.text() != null){ - return true - } - } - } - } - return false - } - - private boolean hasVfModuleRelationship(String volumeGroupXml) { - def Node volumeGroupNode = xmlParser.parseText(volumeGroupXml) - def Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list') - if (relationshipList != null) { - def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') - for (Node relationship in relationships) { - def Node relatedTo = utils.getChildNode(relationship, 'related-to') - if ((relatedTo != null) && (relatedTo.text().equals('vf-module'))) { - def Node relatedLink = utils.getChildNode(relationship, 'related-link') - if (relatedLink !=null && relatedLink.text() != null){ - return true - } - } - } - } - return false - } - - public void prepareVnfAdapterDeleteRequest(DelegateExecution execution, isDebugLogEnabled) { - def cloudRegion = execution.getVariable('DELVfModVol_cloudRegion') - def tenantId = execution.getVariable('DELVfModVol_tenantId') - def volumeGroupId = execution.getVariable('DELVfModVol_volumeGroupId') - def volumeGroupHeatStackId = execution.getVariable('DELVfModVol_volumeGroupHeatStackId') - def requestId = execution.getVariable('DELVfModVol_requestId') - def serviceId = execution.getVariable('DELVfModVol_serviceId') - - def messageId = execution.getVariable('DELVfModVol_messageId') - def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) - def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") - if ('true'.equals(useQualifiedHostName)) { - notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) - } - - String vnfAdapterRestRequest = """ - - ${cloudRegion} - ${tenantId} - ${volumeGroupId} - ${volumeGroupHeatStackId} - true - - ${requestId} - ${serviceId} - - ${messageId} - ${notificationUrl} - - """ - vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest) - execution.setVariable('DELVfModVol_deleteVnfARequest', vnfAdapterRestRequest) - logDebug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest, isDebugLogEnabled) - } - - - public void deleteVolGrpId(DelegateExecution execution, isDebugEnabled) { - - // get variables - String queryAAIVolGrpIdResponse = execution.getVariable("DELVfModVol_queryAAIVolGrpResponse") - String groupId = utils.getNodeText(queryAAIVolGrpIdResponse, "volume-group-id") - String resourceVersion = utils.getNodeText(queryAAIVolGrpIdResponse, "resource-version") - String messageId = execution.getVariable('DELVfModVol_messageId') - String cloudRegion = execution.getVariable('DELVfModVol_aicCloudRegion') - - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) - String deleteAAIVolumeGrpIdRequest = aaiEndpoint + '/' + URLEncoder.encode(cloudRegion, "UTF-8") + "/volume-groups/volume-group/" + UriUtils.encode(groupId, "UTF-8") - - if(resourceVersion !=null){ - deleteAAIVolumeGrpIdRequest = deleteAAIVolumeGrpIdRequest +'?resource-version=' + UriUtils.encode(resourceVersion, 'UTF-8') - } - - utils.logAudit('Delete AAI volume group : ' + deleteAAIVolumeGrpIdRequest) - utils.log("DEBUG", "Delete AAI volume group : " + deleteAAIVolumeGrpIdRequest, isDebugEnabled) - - APIResponse response = aaiUtil.executeAAIDeleteCall(execution, deleteAAIVolumeGrpIdRequest) - - String returnCode = response.getStatusCode() - String aaiResponseAsString = response.getResponseBodyAsString() - aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) - - utils.logAudit("AAI delete volume group return code: " + returnCode) - utils.logAudit("AAI delete volume group response: " + aaiResponseAsString) - - ExceptionUtil exceptionUtil = new ExceptionUtil() - if (returnCode=='200' || (returnCode == '204')) { - utils.log("DEBUG", "Volume group $groupId deleted.", isDebugEnabled) - } else { - if (returnCode=='404') { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume group $groupId not found for delete in AAI Response code: 404") - } else { - WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - throw new BpmnError("MSOWorkflowException") - } - } - } - - - public void prepareDBRequest (DelegateExecution execution, isDebugLogEnabled) { - - WorkflowException workflowExceptionObj = execution.getVariable("WorkflowException") - ExceptionUtil exceptionUtil = new ExceptionUtil(); - def requestId = execution.getVariable('DELVfModVol_requestId') - def volOutputs = execution.getVariable('DELVfModVol_volumeOutputs') - def statusMessage = "VolumeGroup successfully deleted" - def progress = "100" - def requestStatus = "COMPLETE" - - if (workflowExceptionObj != null) { - statusMessage = (workflowExceptionObj.getErrorMessage()).replace("&", "&").replace("<", "<").replace(">", ">") - execution.setVariable("DELVfModVol_WorkflowExceptionMessage", statusMessage) - execution.setVariable("DELVfModVol_WorkflowExceptionCode", workflowExceptionObj.getErrorCode()) - requestStatus = "FAILURE" - progress = "" - } - - String updateInfraRequest = """ - - - - - ${requestId} - BPMN - ${statusMessage} - ${requestStatus} - ${progress} - ${volOutputs} - - - - """ - - updateInfraRequest = utils.formatXml(updateInfraRequest) - execution.setVariable('DELVfModVol_updateInfraRequest', updateInfraRequest) - logDebug('Request for Update Infra Request:\n' + updateInfraRequest, isDebugLogEnabled) - - } - - - public void prepareCompletionHandlerRequest (DelegateExecution execution, isDebugLogEnabled) { - def requestId = execution.getVariable("mso-request-id") - def source = execution.getVariable("DELVfModVol_source") - - String msoCompletionRequest = - """ - - ${requestId} - DELETE - ${source} - - Volume Group has been deleted successfully. - BPMN VF Module Volume action: DELETE - """ - - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - execution.setVariable('DELVfModVol_CompleteMsoProcessRequest', xmlMsoCompletionRequest) - utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugLogEnabled) - - } - - - - public void prepareFalloutHandler (DelegateExecution execution, isDebugEnabled) { - - execution.setVariable("DELVfModVol_Success", false) - String requestId = execution.getVariable("DELVfModVol_requestId") - String source = execution.getVariable("DELVfModVol_source") - - WorkflowException workflowExceptionObj = execution.getVariable("WorkflowException") - def errorMessage = workflowExceptionObj.getErrorMessage() - def errorCode = workflowExceptionObj.getErrorCode() - - String falloutHandlerRequest = - """ - - ${requestId} - DELETE - ${source} - - - ${errorMessage} - ${errorCode} - - """ - - // Format Response - String xmlHandlerRequest = utils.formatXml(falloutHandlerRequest) - utils.logAudit(xmlHandlerRequest) - - execution.setVariable("DELVfModVol_FalloutHandlerRequest", xmlHandlerRequest) - utils.log("ERROR", " Overall Error Response going to FalloutHandler: " + "\n" + xmlHandlerRequest, isDebugEnabled) - - } - - - /** - * Create a WorkflowException for the error case where the Tenant Id from - * AAI did not match the Tenant Id in the incoming request. - * - * @param execution The flow's execution instance. - */ - public void handleTenantIdMismatch(DelegateExecution execution, isDebugLogEnabled) { - - def volumeGroupId = execution.getVariable('DELVfModVol_volumeGroupId') - def aicCloudRegion = execution.getVariable('DELVfModVol_aicCloudRegion') - def tenantId = execution.getVariable('DELVfModVol_tenantId') - def volumeGroupTenantId = execution.getVariable('DELVfModVol_volumeGroupTenantId') - - def String errorMessage = 'TenantId ' + tenantId + ' in incoming request does not match Tenant Id ' + volumeGroupTenantId + - ' retrieved from AAI for Volume Group Id ' + volumeGroupId - - logError('Error in DeleteVfModuleVolume: ' + errorMessage) - - ExceptionUtil exceptionUtil = new ExceptionUtil() - exceptionUtil.buildWorkflowException(execution, 5000, errorMessage) - - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy deleted file mode 100644 index c789769131..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy +++ /dev/null @@ -1,217 +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.bpmn.infrastructure.scripts - - -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource - - -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils; - - -/** - * This class supports the DeleteVnfInfra Flow - * with the Deletion of a generic vnf for - * infrastructure. - */ -class DeleteVnfInfra extends AbstractServiceTaskProcessor { - - String Prefix="DELVI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - - /** - * This method gets and validates the incoming - * request. - * - * @param - execution - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED DeleteVnfInfra PreProcessRequest Process*** ", isDebugEnabled) - - execution.setVariable("DELVI_SuccessIndicator", false) - execution.setVariable("DELVI_vnfInUse", false) - - try{ - // Get Variables - String deleteVnfRequest = execution.getVariable("bpmnRequest") - execution.setVariable("DELVI_DeleteVnfRequest", deleteVnfRequest) - utils.logAudit("Incoming DeleteVnfInfra Request is: \n" + deleteVnfRequest) - - if(deleteVnfRequest != null){ - - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("DELVI_requestId", requestId) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - execution.setVariable("DELVI_serviceInstanceId", serviceInstanceId) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - - String vnfId = execution.getVariable("vnfId") - execution.setVariable("DELVI_vnfId", vnfId) - utils.log("DEBUG", "Incoming Vnf(Instance) Id is: " + vnfId, isDebugEnabled) - - String source = jsonUtil.getJsonValue(deleteVnfRequest, "requestDetails.requestInfo.source") - execution.setVariable("DELVI_source", source) - utils.log("DEBUG", "Incoming Source is: " + source, isDebugEnabled) - - def cloudConfiguration = jsonUtil.getJsonValue(deleteVnfRequest, "requestDetails.cloudConfiguration") - execution.setVariable("DELVI_cloudConfiguration", cloudConfiguration) - - boolean cascadeDelete = false - Boolean cascadeDeleteObj = jsonUtil.getJsonRawValue(deleteVnfRequest, "requestDetails.requestParameters.cascadeDelete") - if(cascadeDeleteObj!=null){ - cascadeDelete = cascadeDeleteObj.booleanValue() - } - execution.setVariable("DELVI_cascadeDelete", cascadeDelete) - utils.log("DEBUG", "Incoming cascadeDelete is: " + cascadeDelete, isDebugEnabled) - - //For Completion Handler & Fallout Handler - String requestInfo = - """ - ${requestId} - DELETE - ${source} - """ - - execution.setVariable("DELVI_requestInfo", requestInfo) - - // Setting for sub flow calls - execution.setVariable("DELVI_type", "generic-vnf") - - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Bpmn Request is Null.") - } - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", " Error Occured in DeleteVnfInfra PreProcessRequest method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra PreProcessRequest") - - } - utils.log("DEBUG", "*** COMPLETED DeleteVnfInfra PreProcessRequest Process ***", isDebugEnabled) - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " *** STARTED DeleteVnfInfra SendSyncResponse Process *** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("DELVI_requestId") - String vnfId = execution.getVariable("DELVI_vnfId") - - String DeleteVnfResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() - - utils.log("DEBUG", " DeleteVnfInfra Sync Response is: \n" + DeleteVnfResponse, isDebugEnabled) - execution.setVariable("DELVI_sentSyncResponse", true) - - sendWorkflowResponse(execution, 202, DeleteVnfResponse) - - } catch (Exception ex) { - utils.log("DEBUG", "Error Occured in DeleteVnfInfra SendSyncResponse Process " + ex.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra SendSyncResponse Process") - - } - utils.log("DEBUG", "*** COMPLETED DeleteVnfInfra SendSyncResponse Process ***", isDebugEnabled) - } - - public void prepareCompletionHandlerRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " *** STARTED DeleteVnfInfra PrepareCompletionHandlerRequest Process *** ", isDebugEnabled) - - try { - String requestInfo = execution.getVariable("DELVI_requestInfo") - requestInfo = utils.removeXmlPreamble(requestInfo) - String vnfId = execution.getVariable("DELVI_vnfId") - - String request = - """ - ${requestInfo} - Vnf has been deleted successfully. - ${vnfId} - DeleteVnfInfra - """ - - execution.setVariable("DELVI_completionHandlerRequest", request) - utils.log("DEBUG", "Completion Handler Request is: " + request, isDebugEnabled) - - execution.setVariable("WorkflowResponse", "Success") // for junits - - } catch (Exception ex) { - utils.log("DEBUG", "Error Occured in DeleteVnfInfra PrepareCompletionHandlerRequest Process " + ex.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra PrepareCompletionHandlerRequest Process") - - } - utils.log("DEBUG", "*** COMPLETED DeleteVnfInfra PrepareCompletionHandlerRequest Process ***", isDebugEnabled) - } - - public void sendErrorResponse(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " *** STARTED DeleteVnfInfra sendErrorResponse Process *** ", isDebugEnabled) - try { - def sentSyncResponse = execution.getVariable("DELVI_sentSyncResponse") - if(sentSyncResponse == false){ - utils.log("DEBUG", "Sending a Sync Error Response", isDebugEnabled) - WorkflowException wfex = execution.getVariable("WorkflowException") - String response = exceptionUtil.buildErrorResponseXml(wfex) - - utils.logAudit(response) - sendWorkflowResponse(execution, 500, response) - }else{ - utils.log("DEBUG", "A Sync Response has already been sent. Skipping Send Sync Error Response.", isDebugEnabled) - } - - } catch(Exception ex) { - utils.log("DEBUG", "Error Occured in DeleteVnfInfra sendErrorResponse Process " + ex.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra sendErrorResponse Process") - } - utils.log("DEBUG", "*** COMPLETED DeleteVnfInfra sendErrorResponse Process ***", isDebugEnabled) - } - - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy deleted file mode 100644 index 77b0657514..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy +++ /dev/null @@ -1,254 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.infrastructure.scripts; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.ServiceInstance -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.Resource -import org.openecomp.mso.bpmn.core.domain.AllottedResource -import org.openecomp.mso.bpmn.core.domain.NetworkResource -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.common.recipe.ResourceInput -import org.openecomp.mso.bpmn.common.recipe.BpmnRestClient -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils; -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.List; -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.json.JSONArray; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; - -/** - * This groovy class supports the DoCompareModelVersions.bpmn process. - * - * Inputs: - * @param - model-invariant-id-target - * @param - model-version-id-target - * @param - model-invariant-id-original - * @param - model-version-id-original - * - * Outputs: - * @param - addResourceList - * @param - delResourceList - * - */ -public class DoCompareModelVersions extends AbstractServiceTaskProcessor { - - String Prefix="DCMPMDV_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - CatalogDbUtils cutils = new CatalogDbUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled) - - try { - execution.setVariable("prefix", Prefix) - - //Inputs - String modelInvariantUuid_target = execution.getVariable("model-invariant-id-target") - if (isBlank(modelInvariantUuid_target)) { - msg = "Input model-invariant-id-target is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - String modelUuid_target = execution.getVariable("model-version-id-target") - if (isBlank(modelUuid_target)) { - msg = "Input model-version-id-target is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - String modelInvariantUuid_original = execution.getVariable("model-invariant-id-original") - if (isBlank(modelInvariantUuid_original)) { - msg = "Input model-invariant-id-original is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - String modelUuid_original = execution.getVariable("model-version-id-original") - if (isBlank(modelUuid_original)) { - msg = "Input model-version-id-original is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - // Target and original modelInvariantUuid must to be the same - if(modelInvariantUuid_target != modelInvariantUuid_original){ - msg = "Input model-invariant-id-target and model-invariant-id-original must to be the same" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - // Target and original modelUuid must not to be the same - if(modelUuid_target == modelUuid_original){ - msg = "Input model-version-id-target and model-version-id-original must not to be the same" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void prepareDecomposeService_Target(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - try { - utils.log("DEBUG", " ***** Inside prepareDecomposeService_Target of update generic e2e service ***** ", isDebugEnabled) - String modelInvariantUuid = execution.getVariable("model-invariant-id-target") - String modelUuid = execution.getVariable("model-version-id-target") - //here modelVersion is not set, we use modelUuid to decompose the service. - String serviceModelInfo = """{ - "modelInvariantUuid":"${modelInvariantUuid}", - "modelUuid":"${modelUuid}", - "modelVersion":"" - }""" - - execution.setVariable("serviceModelInfo_Target", serviceModelInfo) - - utils.log("DEBUG", " ***** Completed prepareDecomposeService_Target of update generic e2e service ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. Unexpected Error from method prepareDecomposeService_Target() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void processDecomposition_Target(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - utils.log("DEBUG", " ***** Inside processDecomposition_Target() of update generic e2e service flow ***** ", isDebugEnabled) - try { - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - execution.setVariable("serviceDecomposition_Target", serviceDecomposition) - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. Unexpected Error from method processDecomposition_Target() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void prepareDecomposeService_Original(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - try { - utils.log("DEBUG", " ***** Inside prepareDecomposeService_Original of update generic e2e service ***** ", isDebugEnabled) - String modelInvariantUuid = execution.getVariable("model-invariant-id-original") - String modelUuid = execution.getVariable("model-version-id-original") - //here modelVersion is not set, we use modelUuid to decompose the service. - String serviceModelInfo = """{ - "modelInvariantUuid":"${modelInvariantUuid}", - "modelUuid":"${modelUuid}", - "modelVersion":"" - }""" - - execution.setVariable("serviceModelInfo_Original", serviceModelInfo) - - utils.log("DEBUG", " ***** Completed prepareDecomposeService_Original of update generic e2e service ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. Unexpected Error from method prepareDecomposeService_Original() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void processDecomposition_Original(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - utils.log("DEBUG", " ***** Inside processDecomposition_Original() of update generic e2e service flow ***** ", isDebugEnabled) - try { - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - execution.setVariable("serviceDecomposition_Original", serviceDecomposition) - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. processDecomposition_Original() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void doCompareModelVersions(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start doCompareModelVersions Process ======== ", isDebugEnabled) - - ServiceDecomposition serviceDecomposition_Target = execution.getVariable("serviceDecomposition_Target") - ServiceDecomposition serviceDecomposition_Original = execution.getVariable("serviceDecomposition_Original") - - List allSR_target = serviceDecomposition_Target.getServiceResources(); - List allSR_original = serviceDecomposition_Original.getServiceResources(); - - List addResourceList = new ArrayList() - List delResourceList = new ArrayList() - - addResourceList.addAll(allSR_target) - delResourceList.addAll(allSR_original) - - //Compare - for (Resource rc_t : allSR_target){ - String muuid = rc_t.getModelInfo().getModelUuid() - String mIuuid = rc_t.getModelInfo().getModelInvariantUuid() - String mCuuid = rc_t.getModelInfo().getModelCustomizationUuid() - for (Resource rc_o : allSR_original){ - if(rc_o.getModelInfo().getModelUuid() == muuid - && rc_o.getModelInfo().getModelInvariantUuid() == mIuuid - && rc_o.getModelInfo().getModelCustomizationUuid() == mCuuid) { - addResourceList.remove(rc_t); - delResourceList.remove(rc_o); - } - } - } - - execution.setVariable("addResourceList", addResourceList) - execution.setVariable("delResourceList", delResourceList) - utils.log("INFO", "addResourceList: " + addResourceList, isDebugEnabled) - utils.log("INFO", "delResourceList: " + delResourceList, isDebugEnabled) - - utils.log("INFO", "======== COMPLETED doCompareModelVersions Process ======== ", isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy deleted file mode 100644 index 0172402185..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy +++ /dev/null @@ -1,260 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.infrastructure.scripts; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.ServiceInstance -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.Resource -import org.openecomp.mso.bpmn.core.domain.CompareModelsResult -import org.openecomp.mso.bpmn.core.domain.ResourceModelInfo -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - - -import java.util.List -import java.util.Map -import java.util.UUID; -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.json.JSONArray; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; - -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource -/** - * This groovy class supports the DoCompareModelofE2EServiceInstance.bpmn process. - * - * Inputs: - * @param - msoRequestId - * @param - globalSubscriberId - * @param - subscriptionServiceType - * @param - serviceInstanceId - * @param - modelInvariantIdTarget - * @param - modelVersionIdTarget - * - * Outputs: - * @param - compareModelsResult CompareModelsResult - - */ -public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProcessor { - - String Prefix="DCMPMDSI_" - private static final String DebugFlag = "isDebugEnabled" - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public void preProcessRequest (DelegateExecution execution) { - - def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - String msg = "" - utils.log("INFO"," ***** Enter DoCompareModelofE2EServiceInstance preProcessRequest *****", isDebugEnabled) - - execution.setVariable("prefix", Prefix) - //Inputs - - //subscriberInfo. for AAI GET - String globalSubscriberId = execution.getVariable("globalSubscriberId") - utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled) - - String serviceType = execution.getVariable("serviceType") - utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled) - - if (isBlank(globalSubscriberId)) { - msg = "Input globalSubscriberId is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - if (isBlank(serviceType)) { - msg = "Input serviceType is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)){ - msg = "Input serviceInstanceId is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - String modelInvariantUuid = execution.getVariable("modelInvariantIdTarget") - if (isBlank(modelInvariantUuid)){ - msg = "Input modelInvariantUuid is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - String modelUuid = execution.getVariable("modelVersionIdTarget") - if (isBlank(modelUuid)){ - msg = "Input modelUuid is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - // Set Target Template info - execution.setVariable("model-invariant-id-target", modelInvariantUuid) - execution.setVariable("model-version-id-target", modelUuid) - - - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) - String msg = "" - - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - String serviceType = "" - - if(foundInAAI){ - utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) - - String siData = execution.getVariable("GENGS_service") - utils.log("INFO", "SI Data", isDebugEnabled) - if (isBlank(siData)) - { - msg = "Could not retrive ServiceInstance data from AAI, Id:" + serviceInstanceId - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - else - { - utils.log("INFO", "SI Data" + siData, isDebugEnabled) - - // Get Template uuid and version - if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) { - utils.log("INFO", "SI Data model-invariant-id and model-version-id exist", isDebugEnabled) - - def modelInvariantId = utils.getNodeText1(siData, "model-invariant-id") - def modelVersionId = utils.getNodeText1(siData, "model-version-id") - - // Set Original Template info - execution.setVariable("model-invariant-id-original", modelInvariantId) - execution.setVariable("model-version-id-original", modelVersionId) - } - } - }else{ - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - - utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) - } - }catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) - } - - public void postCompareModelVersions(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - - List addResourceList = execution.getVariable("addResourceList") - List delResourceList = execution.getVariable("delResourceList") - - CompareModelsResult cmpResult = new CompareModelsResult() - List addedResourceList = new ArrayList() - List deletedResourceList = new ArrayList() - - - String serviceModelUuid = execution.getVariable("model-version-id-target") - List requestInputs = new ArrayList() - ModelInfo mi = null; - for(Resource rc : addResourceList) { - mi = rc.getModelInfo() - String resourceCustomizationUuid = mi.getModelCustomizationUuid() - ResourceModelInfo rmodel = new ResourceModelInfo() - rmodel.setResourceName(mi.getModelName()) - rmodel.setResourceInvariantUuid(mi.getModelInvariantUuid()) - rmodel.setResourceUuid(mi.getModelUuid()) - rmodel.setResourceCustomizationUuid(resourceCustomizationUuid) - addedResourceList.add(rmodel) - - Map resourceParameters = ResourceRequestBuilder.buildResouceRequest(serviceModelUuid, resourceCustomizationUuid, null) - requestInputs.addAll(resourceParameters.keySet()) - } - - for(Resource rc : delResourceList) { - mi = rc.getModelInfo() - String resourceCustomizationUuid = mi.getModelCustomizationUuid() - ResourceModelInfo rmodel = new ResourceModelInfo() - rmodel.setResourceName(mi.getModelName()) - rmodel.setResourceInvariantUuid(mi.getModelInvariantUuid()) - rmodel.setResourceUuid(mi.getModelUuid()) - rmodel.setResourceCustomizationUuid(resourceCustomizationUuid) - deletedResourceList.add(rmodel) - } - - cmpResult.setAddedResourceList(addedResourceList) - cmpResult.setDeletedResourceList(deletedResourceList) - cmpResult.setRequestInputs(requestInputs) - - execution.setVariable("compareModelsResult", cmpResult) - } - -} - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy deleted file mode 100644 index eaec39b5fd..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ /dev/null @@ -1,479 +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.bpmn.infrastructure.scripts; - -import static org.apache.commons.lang3.StringUtils.*; -import org.apache.http.HttpResponse -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.ServiceInstance -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.Resource -import org.openecomp.mso.bpmn.core.domain.AllottedResource -import org.openecomp.mso.bpmn.core.domain.NetworkResource -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.common.recipe.ResourceInput -import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder; -import org.openecomp.mso.bpmn.common.recipe.BpmnRestClient -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils; -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.infrastructure.workflow.service.ServicePluginFactory - -import java.util.List; -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.json.JSONArray; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; - -/** - * This groovy class supports the DoCreateServiceInstance.bpmn process. - * - * Inputs: - * @param - msoRequestId - * @param - globalSubscriberId - * @param - subscriptionServiceType - * @param - serviceInstanceId - * @param - serviceInstanceName - O - * @param - serviceModelInfo - * @param - productFamilyId - * @param - disableRollback - * @param - failExists - TODO - * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) - * @param - sdncVersion ("1610") - * @param - serviceDecomposition - Decomposition for R1710 - * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored) - * - * Outputs: - * @param - rollbackData (localRB->null) - * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) - * @param - WorkflowException - * @param - serviceInstanceName - (GET from AAI if null in input) - * - */ -public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { - - String Prefix="DCRESI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - CatalogDbUtils cutils = new CatalogDbUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled) - - try { - execution.setVariable("prefix", Prefix) - //Inputs - //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology - String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId - utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled) - //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology - String serviceType = execution.getVariable("serviceType") - utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled) - //requestDetails.requestParameters. for SDNC assignTopology - String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId - - if (isBlank(globalSubscriberId)) { - msg = "Input globalSubscriberId is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - if (isBlank(serviceType)) { - msg = "Input serviceType is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - if (productFamilyId == null) { - execution.setVariable("productFamilyId", "") - } - - String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (isBlank(sdncCallbackUrl)) { - msg = "URN_mso_workflow_sdncadapter_callback is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) - - //requestDetails.modelInfo.for AAI PUT servieInstanceData - //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData - String serviceInstanceName = execution.getVariable("serviceInstanceName") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String uuiRequest = execution.getVariable("uuiRequest") - String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") - String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") - String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName") - execution.setVariable("serviceModelName", serviceModelName) - //aai serviceType and Role can be setted as fixed value now. - String aaiServiceType = "E2E Service" - String aaiServiceRole = "E2E Service" - - execution.setVariable("modelInvariantUuid", modelInvariantUuid) - execution.setVariable("modelUuid", modelUuid) - - //AAI PUT - String oStatus = execution.getVariable("initialStatus") ?: "" - if ("TRANSPORT".equalsIgnoreCase(serviceType)) - { - oStatus = "Created" - } - - String statusLine = isBlank(oStatus) ? "" : "${oStatus}" - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) - String serviceInstanceData = - """ - ${serviceInstanceId} - ${serviceInstanceName} - ${aaiServiceType} - ${aaiServiceRole} - ${statusLine} - ${modelInvariantUuid} - ${modelUuid} - """.trim() - execution.setVariable("serviceInstanceData", serviceInstanceData) - utils.logAudit(serviceInstanceData) - utils.log("INFO", " aai_uri " + aai_uri + " namespace:" + namespace, isDebugEnabled) - utils.log("INFO", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void prepareDecomposeService(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - try { - utils.log("INFO", " ***** Inside prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled) - String modelInvariantUuid = execution.getVariable("modelInvariantUuid") - String modelUuid = execution.getVariable("modelUuid") - //here modelVersion is not set, we use modelUuid to decompose the service. - String serviceModelInfo = """{ - "modelInvariantUuid":"${modelInvariantUuid}", - "modelUuid":"${modelUuid}", - "modelVersion":"" - }""" - execution.setVariable("serviceModelInfo", serviceModelInfo) - - utils.log("DEBUG", " ***** Completed prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void processDecomposition(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - utils.log("INFO", " ***** Inside processDecomposition() of create generic e2e service flow ***** ", isDebugEnabled) - try { - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage() - utils.log("INFO", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void doServicePreOperation(DelegateExecution execution){ - //we need a service plugin platform here. - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - String uuiRequest = execution.getVariable("uuiRequest") - String newUuiRequest = ServicePluginFactory.getInstance().preProcessService(serviceDecomposition, uuiRequest); - execution.setVariable("uuiRequest", newUuiRequest) - } - - public void doServiceHoming(DelegateExecution execution) { - //we need a service plugin platform here. - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - String uuiRequest = execution.getVariable("uuiRequest") - String newUuiRequest = ServicePluginFactory.getInstance().doServiceHoming(serviceDecomposition, uuiRequest); - execution.setVariable("uuiRequest", newUuiRequest) - } - - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) - String msg = "" - - try { - String serviceInstanceName = execution.getVariable("serviceInstanceName") - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceName, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - else - { - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI){ - utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) - msg = "ServiceInstance already exists in AAI:" + serviceInstanceName - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) - } - - public void postProcessAAIPUT(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIPUT ***** ", isDebugEnabled) - String msg = "" - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - } - else - { - //start rollback set up - RollbackData rollbackData = new RollbackData() - def disableRollback = execution.getVariable("disableRollback") - rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) - rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") - rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId) - rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType")) - rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) - execution.setVariable("rollbackData", rollbackData) - } - - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," *** Exit postProcessAAIPUT *** ", isDebugEnabled) - } - - public void postProcessAAIGET2(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIGET2 ***** ", isDebugEnabled) - String msg = "" - - try { - String serviceInstanceName = execution.getVariable("serviceInstanceName") - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - else - { - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI){ - String aaiService = execution.getVariable("GENGS_service") - if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) { - execution.setVariable("serviceInstanceName", utils.getNodeText1(aaiService, "service-instance-name")) - utils.log("INFO","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled) - } - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," *** Exit postProcessAAIGET2 *** ", isDebugEnabled) - } - - public void preProcessRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** preProcessRollback ***** ", isDebugEnabled) - try { - - Object workflowException = execution.getVariable("WorkflowException"); - - if (workflowException instanceof WorkflowException) { - utils.log("INFO", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) - execution.setVariable("prevWorkflowException", workflowException); - //execution.setVariable("WorkflowException", null); - } - } catch (BpmnError e) { - utils.log("INFO", "BPMN Error during preProcessRollback", isDebugEnabled) - } catch(Exception ex) { - String msg = "Exception in preProcessRollback. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - } - utils.log("INFO"," *** Exit preProcessRollback *** ", isDebugEnabled) - } - - public void postProcessRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessRollback ***** ", isDebugEnabled) - String msg = "" - try { - Object workflowException = execution.getVariable("prevWorkflowException"); - if (workflowException instanceof WorkflowException) { - utils.log("INFO", "Setting prevException to WorkflowException: ", isDebugEnabled) - execution.setVariable("WorkflowException", workflowException); - } - execution.setVariable("rollbackData", null) - } catch (BpmnError b) { - utils.log("INFO", "BPMN Error during postProcessRollback", isDebugEnabled) - throw b; - } catch(Exception ex) { - msg = "Exception in postProcessRollback. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - } - utils.log("INFO"," *** Exit postProcessRollback *** ", isDebugEnabled) - } - - public void preInitResourcesOperStatus(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) - try{ - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String operationType = execution.getVariable("operationType") - String resourceTemplateUUIDs = "" - String result = "processing" - String progress = "0" - String reason = "" - String operationContent = "Prepare service creation" - utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled) - serviceId = UriUtils.encode(serviceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceId) - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", operationType) - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - List resourceList = serviceDecomposition.getServiceResources() - - for(Resource resource : resourceList){ - resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" - } - - def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) - - String payload = - """ - - - - ${serviceId} - ${operationId} - ${operationType} - ${resourceTemplateUUIDs} - - - """ - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_initResOperStatusRequest", payload) - utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled) - utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled) - execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) - } - utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) - } - - // prepare input param for using DoCreateResources.bpmn - public void preProcessForAddResource(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " ======== STARTED preProcessForAddResource Process ======== ", isDebugEnabled) - - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - List addResourceList = serviceDecomposition.getServiceResources() - execution.setVariable("addResourceList", addResourceList) - - utils.log("INFO", "======== COMPLETED preProcessForAddResource Process ======== ", isDebugEnabled) - } - - public void postProcessForAddResource(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - // do nothing now - - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy deleted file mode 100644 index 84dd0e4d73..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy +++ /dev/null @@ -1,238 +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.bpmn.infrastructure.scripts - - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; -/** - * This groovy class supports the DoCreateServiceInstanceRollback.bpmn process. - * - * Inputs: - * @param - msoRequestId - * @param - rollbackData with - * globalCustomerId - * subscriptionServiceType - * serviceInstanceId - * disableRollback - * rollbackAAI - * rollbackSDNC - * sdncRollbackRequest - * - * - * Outputs: - * @param - rollbackError - * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) - * - */ -public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProcessor{ - - String Prefix="DCRESIRB_" - - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - String msg = "" - utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) - execution.setVariable("rollbackAAI",false) - execution.setVariable("rollbackSDNC",false) - - try { - def rollbackData = execution.getVariable("rollbackData") - utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled) - - if (rollbackData != null) { - if (rollbackData.hasType("SERVICEINSTANCE")) { - - def serviceInstanceId = rollbackData.get("SERVICEINSTANCE", "serviceInstanceId") - execution.setVariable("serviceInstanceId", serviceInstanceId) - - def subscriptionServiceType = rollbackData.get("SERVICEINSTANCE", "subscriptionServiceType") - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - - def globalSubscriberId = rollbackData.get("SERVICEINSTANCE", "globalSubscriberId") - execution.setVariable("globalSubscriberId", globalSubscriberId) - - def rollbackAAI = rollbackData.get("SERVICEINSTANCE", "rollbackAAI") - if ("true".equals(rollbackAAI)) - { - execution.setVariable("rollbackAAI",true) - } - - def rollbackSDNC = rollbackData.get("SERVICEINSTANCE", "rollbackSDNC") - if ("true".equals(rollbackSDNC)) - { - execution.setVariable("rollbackSDNC", true) - } - - if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackSDNC") != true) - { - execution.setVariable("skipRollback", true) - } - - def sdncDelete = rollbackData.get("SERVICEINSTANCE", "sdncDelete") - execution.setVariable("sdncDelete", sdncDelete) - def sdncDeactivate = rollbackData.get("SERVICEINSTANCE", "sdncDeactivate") - execution.setVariable("sdncDeactivate", sdncDeactivate) - utils.log("DEBUG","sdncDeactivate:\n" + sdncDeactivate, isDebugEnabled) - utils.log("DEBUG","sdncDelete:\n" + sdncDelete, isDebugEnabled) - } - else { - execution.setVariable("skipRollback", true) - } - } - else { - execution.setVariable("skipRollback", true) - } - if (execution.getVariable("disableRollback").equals("true" )) - { - execution.setVariable("skipRollback", true) - } - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in Create ServiceInstance Rollback preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void validateSDNCResponse(DelegateExecution execution, String response, String method) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** validateSDNCResponse ***** ", isDebugEnabled) - String msg = "" - try { - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - utils.log("DEBUG", "SDNCResponse: " + response, isDebugEnabled) - utils.log("DEBUG", "workflowException: " + workflowException, isDebugEnabled) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msg = "SDNC Adapter service-instance rollback successful for " + method - utils.log("DEBUG", msg, isDebugEnabled) - }else{ - execution.setVariable("rolledBack", false) - msg = "Error Response from SDNC Adapter service-instance rollback for " + method - execution.setVariable("rollbackError", msg) - utils.log("DEBUG", msg, isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in Create ServiceInstance rollback for " + method + " Exception:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit validateSDNCResponse ***** ", isDebugEnabled) - } - - public void postProcessRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** postProcessRequest ***** ", isDebugEnabled) - String msg = "" - try { - execution.setVariable("rollbackData", null) - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean rollbackAAI = execution.getVariable("rollbackAAI") - boolean rollbackSDNC = execution.getVariable("rollbackSDNC") - if (rollbackAAI || rollbackSDNC) - { - execution.setVariable("rolledBack", true) - } - if (rollbackAAI) - { - boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator") - if(!succInAAI){ - execution.setVariable("rolledBack", false) //both sdnc and aai must be successful to declare rollback Succesful - execution.setVariable("rollbackError", "Error deleting service-instance in AAI for rollback") - utils.log("DEBUG","Error deleting service-instance in AAI for rollback", + serviceInstanceId, isDebugEnabled) - } - } - utils.log("DEBUG","*** Exit postProcessRequest ***", isDebugEnabled) - - } catch (BpmnError e) { - msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + e.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } catch (Exception ex) { - msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - - } - - public void processRollbackException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** processRollbackException ***** ", isDebugEnabled) - try{ - utils.log("DEBUG", "Caught an Exception in DoCreateServiceInstanceRollback", isDebugEnabled) - execution.setVariable("rollbackData", null) - execution.setVariable("rollbackError", "Caught exception in ServiceInstance Create Rollback") - execution.setVariable("WorkflowException", null) - - }catch(BpmnError b){ - utils.log("DEBUG", "BPMN Error during processRollbackExceptions Method: ", isDebugEnabled) - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processRollbackExceptions Method: " + e.getMessage(), isDebugEnabled) - } - - utils.log("DEBUG", " Exit processRollbackException", isDebugEnabled) - } - - public void processRollbackJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** processRollbackJavaException ***** ", isDebugEnabled) - try{ - execution.setVariable("rollbackData", null) - execution.setVariable("rollbackError", "Caught Java exception in ServiceInstance Create Rollback") - utils.log("DEBUG", "Caught Exception in processRollbackJavaException", isDebugEnabled) - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception in processRollbackJavaException " + e.getMessage(), isDebugEnabled) - } - utils.log("DEBUG", "***** Exit processRollbackJavaException *****", isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy deleted file mode 100644 index ccbe9b8325..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy +++ /dev/null @@ -1,1703 +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.bpmn.infrastructure.scripts; - -import groovy.xml.XmlUtil -import groovy.json.* -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.NetworkUtils -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils - -/** - * This groovy class supports the DoCreateNetworkInstance.bpmn process. - * - */ -public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { - String Prefix="CRENWKI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - NetworkUtils networkUtils = new NetworkUtils() - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - - def className = getClass().getSimpleName() - - /** - * This method is executed during the preProcessRequest task of the DoCreateNetworkInstance.bpmn process. - * @param execution - */ - public InitializeProcessVariables(DelegateExecution execution){ - /* Initialize all the process variables in this block */ - - execution.setVariable(Prefix + "networkRequest", "") - execution.setVariable(Prefix + "rollbackEnabled", null) - execution.setVariable(Prefix + "networkInputs", "") - //execution.setVariable(Prefix + "requestId", "") - execution.setVariable(Prefix + "messageId", "") - execution.setVariable(Prefix + "source", "") - execution.setVariable("BasicAuthHeaderValuePO", "") - execution.setVariable("BasicAuthHeaderValueSDNC", "") - execution.setVariable(Prefix + "serviceInstanceId","") - execution.setVariable("GENGS_type", "") - execution.setVariable(Prefix + "rsrc_endpoint", null) - execution.setVariable(Prefix + "networkOutputs", "") - execution.setVariable(Prefix + "networkId","") - execution.setVariable(Prefix + "networkName","") - - // AAI query Name - execution.setVariable(Prefix + "queryNameAAIRequest","") - execution.setVariable(Prefix + "queryNameAAIResponse", "") - execution.setVariable(Prefix + "aaiNameReturnCode", "") - execution.setVariable(Prefix + "isAAIqueryNameGood", false) - - // AAI query Cloud Region - execution.setVariable(Prefix + "queryCloudRegionRequest","") - execution.setVariable(Prefix + "queryCloudRegionReturnCode","") - execution.setVariable(Prefix + "queryCloudRegionResponse","") - execution.setVariable(Prefix + "cloudRegionPo","") - execution.setVariable(Prefix + "cloudRegionSdnc","") - execution.setVariable(Prefix + "isCloudRegionGood", false) - - // AAI query Id - execution.setVariable(Prefix + "queryIdAAIRequest","") - execution.setVariable(Prefix + "queryIdAAIResponse", "") - execution.setVariable(Prefix + "aaiIdReturnCode", "") - - // AAI query vpn binding - execution.setVariable(Prefix + "queryVpnBindingAAIRequest","") - execution.setVariable(Prefix + "queryVpnBindingAAIResponse", "") - execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "") - execution.setVariable(Prefix + "vpnBindings", null) - execution.setVariable(Prefix + "vpnCount", 0) - execution.setVariable(Prefix + "routeCollection", "") - - // AAI query network policy - execution.setVariable(Prefix + "queryNetworkPolicyAAIRequest","") - execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", "") - execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "") - execution.setVariable(Prefix + "networkPolicyUriList", null) - execution.setVariable(Prefix + "networkPolicyCount", 0) - execution.setVariable(Prefix + "networkCollection", "") - - // AAI query route table reference - execution.setVariable(Prefix + "queryNetworkTableRefAAIRequest","") - execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", "") - execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "") - execution.setVariable(Prefix + "networkTableRefUriList", null) - execution.setVariable(Prefix + "networkTableRefCount", 0) - execution.setVariable(Prefix + "tableRefCollection", "") - - // AAI requery Id - execution.setVariable(Prefix + "requeryIdAAIRequest","") - execution.setVariable(Prefix + "requeryIdAAIResponse", "") - execution.setVariable(Prefix + "aaiRequeryIdReturnCode", "") - - // AAI update contrail - execution.setVariable(Prefix + "updateContrailAAIUrlRequest","") - execution.setVariable(Prefix + "updateContrailAAIPayloadRequest","") - execution.setVariable(Prefix + "updateContrailAAIResponse", "") - execution.setVariable(Prefix + "aaiUpdateContrailReturnCode", "") - - execution.setVariable(Prefix + "createNetworkRequest", "") - execution.setVariable(Prefix + "createNetworkResponse", "") - execution.setVariable(Prefix + "rollbackNetworkRequest", "") - //execution.setVariable(Prefix + "rollbackNetworkResponse", "") - execution.setVariable(Prefix + "networkReturnCode", "") - //execution.setVariable(Prefix + "rollbackNetworkReturnCode", "") - execution.setVariable(Prefix + "isNetworkRollbackNeeded", false) - - execution.setVariable(Prefix + "assignSDNCRequest", "") - execution.setVariable(Prefix + "assignSDNCResponse", "") - execution.setVariable(Prefix + "rollbackSDNCRequest", "") - //execution.setVariable(Prefix + "rollbackSDNCResponse", "") - execution.setVariable(Prefix + "sdncReturnCode", "") - //execution.setVariable(Prefix + "rollbackSDNCReturnCode", "") - execution.setVariable(Prefix + "isSdncRollbackNeeded", false) - execution.setVariable(Prefix + "sdncResponseSuccess", false) - - execution.setVariable(Prefix + "activateSDNCRequest", "") - execution.setVariable(Prefix + "activateSDNCResponse", "") - execution.setVariable(Prefix + "rollbackActivateSDNCRequest", "") - //execution.setVariable(Prefix + "rollbackActivateSDNCResponse", "") - execution.setVariable(Prefix + "sdncActivateReturnCode", "") - //execution.setVariable(Prefix + "rollbackActivateSDNCReturnCode", "") - execution.setVariable(Prefix + "isSdncActivateRollbackNeeded", false) - execution.setVariable(Prefix + "sdncActivateResponseSuccess", false) - - execution.setVariable(Prefix + "orchestrationStatus", "") - execution.setVariable(Prefix + "isVnfBindingPresent", false) - execution.setVariable(Prefix + "Success", false) - - execution.setVariable(Prefix + "isException", false) - - } - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - /** - * This method is executed during the preProcessRequest task of the DoCreateNetworkInstance.bpmn process. - * @param execution - */ - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest() of " + className + ".groovy ***** ", isDebugEnabled) - - try { - // initialize flow variables - InitializeProcessVariables(execution) - - // GET Incoming request & validate 3 kinds of format. - execution.setVariable("action", "CREATE") - String networkRequest = execution.getVariable("bpmnRequest") - if (networkRequest != null) { - if (networkRequest.contains("requestDetails")) { - // JSON format request is sent, create xml - try { - def prettyJson = JsonOutput.prettyPrint(networkRequest.toString()) - utils.log("DEBUG", " Incoming message formatted . . . : " + '\n' + prettyJson, isDebugEnabled) - networkRequest = vidUtils.createXmlNetworkRequestInfra(execution, networkRequest) - - } catch (Exception ex) { - String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - } else { - // XML format request is sent - - } - } else { - // vIPR format request is sent, create xml from individual variables - networkRequest = vidUtils.createXmlNetworkRequestInstance(execution) - } - - networkRequest = utils.formatXml(networkRequest) - utils.logAudit(networkRequest) - execution.setVariable(Prefix + "networkRequest", networkRequest) - utils.log("DEBUG", Prefix + "networkRequest - " + '\n' + networkRequest, isDebugEnabled) - - // validate 'backout-on-failure' to override 'URN_mso_rollback' - boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, networkRequest) - execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled) - utils.log("DEBUG", Prefix + "rollbackEnabled - " + rollbackEnabled, isDebugEnabled) - - String networkInputs = utils.getNodeXml(networkRequest, "network-inputs", false).replace("tag0:","").replace(":tag0","") - execution.setVariable(Prefix + "networkInputs", networkInputs) - utils.log("DEBUG", Prefix + "networkInputs - " + '\n' + networkInputs, isDebugEnabled) - - // prepare messageId - String messageId = execution.getVariable("testMessageId") // for testing - if (messageId == null || messageId == "") { - messageId = UUID.randomUUID() - utils.log("DEBUG", Prefix + "messageId, random generated: " + messageId, isDebugEnabled) - } else { - utils.log("DEBUG", Prefix + "messageId, pre-assigned: " + messageId, isDebugEnabled) - } - execution.setVariable(Prefix + "messageId", messageId) - - String source = utils.getNodeText1(networkRequest, "source") - execution.setVariable(Prefix + "source", source) - utils.log("DEBUG", Prefix + "source - " + source, isDebugEnabled) - - // validate cloud region - String lcpCloudRegionId = utils.getNodeText1(networkRequest, "aic-cloud-region") - if ((lcpCloudRegionId == null) || (lcpCloudRegionId == "") || (lcpCloudRegionId == "null")) { - String dataErrorMessage = "Missing value/element: 'lcpCloudRegionId' or 'cloudConfiguration' or 'aic-cloud-region'." - utils.log("DEBUG", " Invalid Request - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - // validate service instance id - String serviceInstanceId = utils.getNodeText1(networkRequest, "service-instance-id") - if ((serviceInstanceId == null) || (serviceInstanceId == "") || (serviceInstanceId == "null")) { - String dataErrorMessage = "Missing value/element: 'serviceInstanceId'." - utils.log("DEBUG", " Invalid Request - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - // PO Authorization Info / headers Authorization= - String basicAuthValuePO = execution.getVariable("URN_mso_adapters_po_auth") - utils.log("DEBUG", " Obtained BasicAuth userid password for PO/SDNC adapter: " + basicAuthValuePO, isDebugEnabled) - try { - def encodedString = utils.getBasicAuth(basicAuthValuePO, execution.getVariable("URN_mso_msoKey")) - execution.setVariable("BasicAuthHeaderValuePO",encodedString) - execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) - - } catch (IOException ex) { - String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " - String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - // Set variables for Generic Get Sub Flow use - execution.setVariable(Prefix + "serviceInstanceId", serviceInstanceId) - utils.log("DEBUG", Prefix + "serviceInstanceId - " + serviceInstanceId, isDebugEnabled) - - execution.setVariable("GENGS_type", "service-instance") - utils.log("DEBUG", "GENGS_type - " + "service-instance", isDebugEnabled) - utils.log("DEBUG", " Url for SDNC adapter: " + execution.getVariable("URN_mso_adapters_sdnc_endpoint"), isDebugEnabled) - - String sdncVersion = execution.getVariable("sdncVersion") - utils.log("DEBUG", "sdncVersion? : " + sdncVersion, isDebugEnabled) - - // build 'networkOutputs' - String networkId = utils.getNodeText1(networkRequest, "network-id") - if ((networkId == null) || (networkId == "null")) { - networkId = "" - } - String networkName = utils.getNodeText1(networkRequest, "network-name") - if ((networkName == null) || (networkName == "null")) { - networkName = "" - } - String networkOutputs = - """ - ${networkId} - ${networkName} - """ - execution.setVariable(Prefix + "networkOutputs", networkOutputs) - utils.log("DEBUG", Prefix + "networkOutputs - " + '\n' + networkOutputs, isDebugEnabled) - execution.setVariable(Prefix + "networkId", networkId) - execution.setVariable(Prefix + "networkName", networkName) - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - sendSyncError(execution) - // caught exception - String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAINetworkName (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkName() of DoCreateNetworkInstance ***** " , isDebugEnabled) - - // get variables - String networkInputs = execution.getVariable(Prefix + "networkInputs") - String networkName = utils.getNodeText1(networkInputs, "network-name") - networkName = UriUtils.encode(networkName,"UTF-8") - - // Prepare AA&I url with network-name - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String queryAAINameRequest = "${aai_endpoint}${aai_uri}" + "?network-name=" + networkName - utils.logAudit(queryAAINameRequest) - execution.setVariable(Prefix + "queryNameAAIRequest", queryAAINameRequest) - utils.log("DEBUG", Prefix + "queryNameAAIRequest - " + "\n" + queryAAINameRequest, isDebugEnabled) - - try { - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryAAINameRequest) - String returnCode = response.getStatusCode() - execution.setVariable(Prefix + "aaiNameReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI Query Name Response Code : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - utils.log("DEBUG", " ***** AAI Query Name Response : " +'\n'+ aaiResponseAsString, isDebugEnabled) - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable(Prefix + "queryNameAAIResponse", aaiResponseAsString) - execution.setVariable(Prefix + "isAAIqueryNameGood", true) - String orchestrationStatus = "" - try { - // response is NOT empty - orchestrationStatus = utils.getNodeText1(aaiResponseAsString, "orchestration-status") - execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus.toUpperCase()) - utils.log("DEBUG", Prefix + "orchestrationStatus - " + orchestrationStatus.toUpperCase(), isDebugEnabled) - execution.setVariable("orchestrationStatus", orchestrationStatus) - - } catch (Exception ex) { - // response is empty - execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus) - utils.log("DEBUG", Prefix + "orchestrationStatus - " + orchestrationStatus, isDebugEnabled) - } - - } else { - if (returnCode=='404') { - utils.log("DEBUG", " QueryAAINetworkName return code = '404' (Not Found). Proceed with the Create !!! ", isDebugEnabled) - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Error Response from QueryAAINetworkName - " + returnCode - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 2500, dataErrorMessage) - - } - - } - - utils.log("DEBUG", Prefix + "isAAIqueryNameGood? : " + execution.getVariable(Prefix + "isAAIqueryNameGood"), isDebugEnabled) - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - // try error - String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow - callRESTQueryAAINetworkName() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAICloudRegion (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAICloudRegion() of DoCreateNetworkInstance ***** " , isDebugEnabled) - - try { - String networkInputs = execution.getVariable(Prefix + "networkInputs") - String cloudRegion = utils.getNodeText1(networkInputs, "aic-cloud-region") - cloudRegion = UriUtils.encode(cloudRegion,"UTF-8") - - // Prepare AA&I url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUtil = new AaiUtil(this) - String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) - String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion - utils.logAudit(queryCloudRegionRequest) - execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest) - utils.log("DEBUG", Prefix + "queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest, isDebugEnabled) - - String cloudRegionPo = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) - String cloudRegionSdnc = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "SDNC", cloudRegion) - - if ((cloudRegionPo != "ERROR") && (cloudRegionSdnc != "ERROR")) { - execution.setVariable(Prefix + "cloudRegionPo", cloudRegionPo) - execution.setVariable(Prefix + "cloudRegionSdnc", cloudRegionSdnc) - execution.setVariable(Prefix + "isCloudRegionGood", true) - - } else { - String dataErrorMessage = "QueryAAICloudRegion Unsuccessful. Return Code: " + execution.getVariable(Prefix + "queryCloudRegionReturnCode") - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - - utils.log("DEBUG", " is Cloud Region Good: " + execution.getVariable(Prefix + "isCloudRegionGood"), isDebugEnabled) - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - // try error - String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow - callRESTQueryAAICloudRegion() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAINetworkId(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkId() of DoCreateNetworkInstance ***** " , isDebugEnabled) - - try { - // get variables - String networkId = "" - String assignSDNCResponse = execution.getVariable(Prefix + "assignSDNCResponse") - if (execution.getVariable("sdncVersion") != "1610") { - String networkResponseInformation = "" - try { - networkResponseInformation = utils.getNodeXml(assignSDNCResponse, "network-response-information", false).replace("tag0:","").replace(":tag0","") - networkId = utils.getNodeText1(networkResponseInformation, "instance-id") - } catch (Exception ex) { - String dataErrorMessage = " SNDC Response network validation for 'instance-id' (network-id) failed: Empty " - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - } else { - networkId = utils.getNodeText1(assignSDNCResponse, "network-id") - } - if (networkId == null || networkId == "null") { - String dataErrorMessage = "SNDC Response did not contains 'instance-id' or 'network-id' element, or the value is null." - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } else { - utils.log("DEBUG", " SNDC Response network validation for 'instance-id' (network-id)' is good: " + networkId, isDebugEnabled) - } - - - execution.setVariable(Prefix + "networkId", networkId) - String networkName = utils.getNodeText1(assignSDNCResponse, "network-name") - execution.setVariable(Prefix + "networkName", networkName) - - networkId = UriUtils.encode(networkId,"UTF-8") - - // Prepare AA&I url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String queryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" - utils.logAudit(queryIdAAIRequest) - execution.setVariable(Prefix + "queryIdAAIRequest", queryIdAAIRequest) - utils.log("DEBUG", Prefix + "queryIdAAIRequest - " + "\n" + queryIdAAIRequest, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryIdAAIRequest) - String returnCode = response.getStatusCode() - execution.setVariable(Prefix + "aaiIdReturnCode", returnCode) - - utils.log("DEBUG", " ***** AAI Response Code : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable(Prefix + "queryIdAAIResponse", aaiResponseAsString) - utils.log("DEBUG", " QueryAAINetworkId Success REST Response - " + "\n" + aaiResponseAsString, isDebugEnabled) - - String netId = utils.getNodeText1(aaiResponseAsString, "network-id") - execution.setVariable(Prefix + "networkId", netId) - String netName = utils.getNodeText1(aaiResponseAsString, "network-name") - execution.setVariable(Prefix + "networkName", netName) - - } else { - if (returnCode=='404') { - String dataErrorMessage = "Response Error from QueryAAINetworkId is 404 (Not Found)." - utils.log("DEBUG", " AAI Query Failed. " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Response from QueryAAINetworkId - " + returnCode - utils.log("DEBUG", "Unexpected Response from QueryAAINetworkId - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkId() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTReQueryAAINetworkId(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside callRESTReQueryAAINetworkId() of DoCreateNetworkInstance ***** " , isDebugEnabled) - - try { - // get variables - String networkId = execution.getVariable(Prefix + "networkId") - String netId = networkId - networkId = UriUtils.encode(networkId,"UTF-8") - - // Prepare AA&I url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String requeryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" - utils.logAudit(requeryIdAAIRequest) - execution.setVariable(Prefix + "requeryIdAAIRequest", requeryIdAAIRequest) - utils.log("DEBUG", Prefix + "requeryIdAAIRequest - " + "\n" + requeryIdAAIRequest, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, requeryIdAAIRequest) - String returnCode = response.getStatusCode() - execution.setVariable(Prefix + "aaiRequeryIdReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI ReQuery Response Code : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable(Prefix + "requeryIdAAIResponse", aaiResponseAsString) - utils.log("DEBUG", " ReQueryAAINetworkId Success REST Response - " + "\n" + aaiResponseAsString, isDebugEnabled) - - String netName = utils.getNodeText1(aaiResponseAsString, "network-name") - String networkOutputs = - """ - ${netId} - ${netName} - """ - execution.setVariable(Prefix + "networkOutputs", networkOutputs) - utils.log("DEBUG", " networkOutputs - " + '\n' + networkOutputs, isDebugEnabled) - - } else { - if (returnCode=='404') { - String dataErrorMessage = "Response Error from ReQueryAAINetworkId is 404 (Not Found)." - utils.log("DEBUG", " AAI ReQuery Failed. - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Response from ReQueryAAINetworkId - " + returnCode - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTReQueryAAINetworkId() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAINetworkVpnBinding(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkVpnBinding() of DoCreateNetworkInstance ***** " , isDebugEnabled) - - try { - - // get variables - String queryIdAAIResponse = execution.getVariable(Prefix + "queryIdAAIResponse").replace('', "") - String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") - utils.log("DEBUG", " relationship - " + relationship, isDebugEnabled) - - // Check if Vnf Binding is present, then build a List of vnfBinding - List vpnBindingUri = networkUtils.getVnfBindingObject(relationship) - int vpnCount = vpnBindingUri.size() - execution.setVariable(Prefix + "vpnCount", vpnCount) - utils.log("DEBUG", Prefix + "vpnCount - " + vpnCount, isDebugEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - - if (vpnCount > 0) { - execution.setVariable(Prefix + "vpnBindings", vpnBindingUri) - utils.log("DEBUG", " vpnBindingUri List - " + vpnBindingUri, isDebugEnabled) - - String routeTargets = "" - // AII loop call using list vpnBindings - for (i in 0..vpnBindingUri.size()-1) { - - int counting = i+1 - - // prepare url using vpnBinding - String queryVpnBindingAAIRequest = "" - String aai_uri = aaiUriUtil.getNetworkVpnBindingUri(execution) - - // Note: By default, the vpnBinding url is found in 'related-link' of the response, - // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. - if (aai_uri == null || aai_uri == "") { - // using value of 'related-link' from response - if (vpnBindingUri[i].charAt(vpnBindingUri[i].length()-1) == '/') { - queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i].substring(0, vpnBindingUri[i].length()-1) + "?depth=all" - } else { - queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i] + "?depth=all" - } - - } else { - // using uri value in URN mapping - String vpnBindingId = vpnBindingUri[i].substring(vpnBindingUri[i].indexOf("/vpn-binding/")+13, vpnBindingUri[i].length()) - if (vpnBindingId.charAt(vpnBindingId.length()-1) == '/') { - vpnBindingId = vpnBindingId.substring(0, vpnBindingId.length()-1) - } - queryVpnBindingAAIRequest = "${aai_endpoint}${aai_uri}/" + vpnBindingId + "?depth=all" - } - - utils.logAudit(queryVpnBindingAAIRequest) - execution.setVariable(Prefix + "queryVpnBindingAAIRequest", queryVpnBindingAAIRequest) - utils.log("DEBUG", Prefix + "queryVpnBindingAAIRequest, , vpnBinding #" + counting + " : " + "\n" + queryVpnBindingAAIRequest, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryVpnBindingAAIRequest) - String returnCode = response.getStatusCode() - execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI query vpn binding Response Code, vpnBinding #" + counting + " : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable(Prefix + "queryVpnBindingAAIResponse", aaiResponseAsString) - utils.log("DEBUG", " AAI Query Vpn Binding Success REST Response, , vpnBinding #" + counting + " : " + "\n" + aaiResponseAsString, isDebugEnabled) - - String routeTarget = "" - String routeRole = "" - if (utils.nodeExists(aaiResponseAsString, "route-targets")) { - String aaiRouteTargets = utils.getNodeXml(aaiResponseAsString, "route-targets", false) - def aaiRouteTargetsXml = new XmlSlurper().parseText(aaiRouteTargets) - def aaiRouteTarget = aaiRouteTargetsXml.'**'.findAll {it.name() == "route-target"} - for (j in 0..aaiRouteTarget.size()-1) { - routeTarget = utils.getNodeText1(XmlUtil.serialize(aaiRouteTarget[j]), "global-route-target") - routeRole = utils.getNodeText1(XmlUtil.serialize(aaiRouteTarget[j]), "route-target-role") - routeTargets += "" + '\n' + - " " + routeTarget + "" + '\n' + - " " + routeRole + "" + '\n' + - "" + '\n' - } - } - - } else { - if (returnCode=='404') { - String dataErrorMessage = "Response Error from AAINetworkVpnBinding is 404 (Not Found)." - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = " Unexpected Response from AAINetworkVpnBinding - " + returnCode - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - } // end loop - - execution.setVariable(Prefix + "routeCollection", routeTargets) - utils.log("DEBUG", Prefix + "routeCollection - " + '\n' + routeTargets, isDebugEnabled) - - } else { - // reset return code to success - execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) - String aaiStubResponse = - """ - - - - """ - String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) - execution.setVariable(Prefix + "queryVpnBindingAAIResponse", aaiStubResponseAsXml) - execution.setVariable(Prefix + "routeCollection", "") - utils.log("DEBUG", " No vpnBinding, using this stub as response - " + '\n' + aaiStubResponseAsXml, isDebugEnabled) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkVpnBinding() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAINetworkPolicy(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkPolicy() of DoCreateNetworkInstance ***** " , isDebugEnabled) - - try { - // get variables - String queryIdAAIResponse = execution.getVariable(Prefix + "queryIdAAIResponse").replace('', "") - String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") - utils.log("DEBUG", " relationship - " + relationship, isDebugEnabled) - - // Check if Network Policy is present, then build a List of network policy - List networkPolicyUriList = networkUtils.getNetworkPolicyObject(relationship) - int networkPolicyCount = networkPolicyUriList.size() - execution.setVariable(Prefix + "networkPolicyCount", networkPolicyCount) - utils.log("DEBUG", Prefix + "networkPolicyCount - " + networkPolicyCount, isDebugEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - - if (networkPolicyCount > 0) { - execution.setVariable(Prefix + "networkPolicyUriList", networkPolicyUriList) - utils.log("DEBUG", " networkPolicyUri List - " + networkPolicyUriList, isDebugEnabled) - - String networkPolicies = "" - // AII loop call using list vpnBindings - for (i in 0..networkPolicyUriList.size()-1) { - - int counting = i+1 - - // prepare url using vpnBinding - String queryNetworkPolicyAAIRequest = "" - - String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) - - // Note: By default, the network policy url is found in 'related-link' of the response, - // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. - if (aai_uri == null || aai_uri == "") { - // using value of 'related-link' from response - if (networkPolicyUriList[i].charAt(networkPolicyUriList[i].length()-1) == '/') { - queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i].substring(0, networkPolicyUriList[i].length()-1) + "?depth=all" - } else { - queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i] + "?depth=all" - } - } else { - // using uri value in URN mapping - String networkPolicyId = networkPolicyUriList[i].substring(networkPolicyUriList[i].indexOf("/network-policy/")+16, networkPolicyUriList[i].length()) - println " networkPolicyId - " + networkPolicyId - if (networkPolicyId.charAt(networkPolicyId.length()-1) == '/') { - networkPolicyId = networkPolicyId.substring(0, networkPolicyId.length()-1) - } - queryNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + networkPolicyId + "?depth=all" - - } - - - utils.logAudit(queryNetworkPolicyAAIRequest) - execution.setVariable(Prefix + "queryNetworkPolicyAAIRequest", queryNetworkPolicyAAIRequest) - utils.log("DEBUG", Prefix + "queryNetworkPolicyAAIRequest, , NetworkPolicy #" + counting + " : " + "\n" + queryNetworkPolicyAAIRequest, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkPolicyAAIRequest) - String returnCode = response.getStatusCode() - execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", aaiResponseAsString) - utils.log("DEBUG", " QueryAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString, isDebugEnabled) - - String networkPolicy = "" - if (utils.nodeExists(aaiResponseAsString, "network-policy-fqdn")) { - networkPolicy = utils.getNodeText1(aaiResponseAsString, "network-policy-fqdn") - networkPolicies += "" + networkPolicy + "" + '\n' - } - - } else { - if (returnCode=='404') { - String dataErrorMessage = "Response Error from QueryAAINetworkPolicy is 404 (Not Found)." - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Response from QueryAAINetworkPolicy - " + returnCode - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - } // end loop - - execution.setVariable(Prefix + "networkCollection", networkPolicies) - utils.log("DEBUG", Prefix + "networkCollection - " + '\n' + networkPolicies, isDebugEnabled) - - } else { - // reset return code to success - execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "200") - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) - String aaiStubResponse = - """ - - - - """ - String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) - execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", aaiStubResponseAsXml) - execution.setVariable(Prefix + "networkCollection", "") - utils.log("DEBUG", " No net policies, using this stub as response - " + '\n' + aaiStubResponseAsXml, isDebugEnabled) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkPolicy() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAINetworkTableRef(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkTableRef() of DoCreateNetworkInstance ***** " , isDebugEnabled) - - try { - // get variables - String queryIdAAIResponse = execution.getVariable(Prefix + "queryIdAAIResponse").replace('', "") - String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") - utils.log("DEBUG", " relationship - " + relationship, isDebugEnabled) - - // Check if Network TableREf is present, then build a List of network policy - List networkTableRefUriList = networkUtils.getNetworkTableRefObject(relationship) - int networkTableRefCount = networkTableRefUriList.size() - execution.setVariable(Prefix + "networkTableRefCount", networkTableRefCount) - utils.log("DEBUG", Prefix + "networkTableRefCount - " + networkTableRefCount, isDebugEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - - if (networkTableRefCount > 0) { - execution.setVariable(Prefix + "networkTableRefUriList", networkTableRefUriList) - utils.log("DEBUG", " networkTableRefUri List - " + networkTableRefUriList, isDebugEnabled) - - // AII loop call using list vpnBindings - String networkTableRefs = "" - for (i in 0..networkTableRefUriList.size()-1) { - - int counting = i+1 - - // prepare url using tableRef - String queryNetworkTableRefAAIRequest = "" - - String aai_uri = aaiUriUtil.getNetworkTableReferencesUri(execution) - - // Note: By default, the network policy url is found in 'related-link' of the response, - // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. - if (aai_uri == null || aai_uri == "") { - // using value of 'related-link' from response - if (networkTableRefUriList[i].charAt(networkTableRefUriList[i].length()-1) == '/') { - queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i].substring(0, networkTableRefUriList[i].length()-1) + "?depth=all" - } else { - queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i] + "?depth=all" - } - } else { - // using uri value in URN mapping - String networkTableRefId = networkTableRefUriList[i].substring(networkTableRefUriList[i].indexOf("/route-table-reference/")+23, networkTableRefUriList[i].length()) - - if (networkTableRefId.charAt(networkTableRefId.length()-1) == '/') { - networkTableRefId = networkTableRefId.substring(0, networkTableRefId.length()-1) - } - queryNetworkTableRefAAIRequest = "${aai_endpoint}${aai_uri}/" + networkTableRefId + "?depth=all" - - } - - - utils.logAudit(queryNetworkTableRefAAIRequest) - execution.setVariable(Prefix + "queryNetworkTableRefAAIRequest", queryNetworkTableRefAAIRequest) - utils.log("DEBUG", Prefix + "queryNetworkTableRefAAIRequest, , NetworkTableRef #" + counting + " : " + "\n" + queryNetworkTableRefAAIRequest, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkTableRefAAIRequest) - String returnCode = response.getStatusCode() - execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI query network Table Reference Response Code, NetworkTableRef #" + counting + " : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", aaiResponseAsString) - utils.log("DEBUG", " QueryAAINetworkTableRef Success REST Response, , NetworkTableRef #" + counting + " : " + "\n" + aaiResponseAsString, isDebugEnabled) - - String networkTableRef = "" - if (utils.nodeExists(aaiResponseAsString, "route-table-reference-fqdn")) { - networkTableRef = utils.getNodeText1(aaiResponseAsString, "route-table-reference-fqdn") - networkTableRefs += "" + networkTableRef + "" + '\n' - } - - } else { - if (returnCode=='404') { - String dataErrorMessage = "Response Error from QueryAAINetworkTableRef is 404 (Not Found)." - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Response from QueryAAINetworkTableRef - " + returnCode - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - } // end loop - - execution.setVariable(Prefix + "tableRefCollection", networkTableRefs) - utils.log("DEBUG", Prefix + "tableRefCollection - " + '\n' + networkTableRefs, isDebugEnabled) - - } else { - // reset return code to success - execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200") - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) - String aaiStubResponse = - """ - - - - """ - String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) - execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", aaiStubResponseAsXml) - execution.setVariable(Prefix + "tableRefCollection", "") - utils.log("DEBUG", " No net table references, using this stub as response - " + '\n' + aaiStubResponseAsXml, isDebugEnabled) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkTableRef() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - public void callRESTUpdateContrailAAINetwork(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " , isDebugEnabled) - - try { - // get variables - String networkId = execution.getVariable(Prefix + "networkId") - networkId = UriUtils.encode(networkId,"UTF-8") - String requeryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") - String createNetworkResponse = execution.getVariable(Prefix + "createNetworkResponse") - - // Prepare url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String updateContrailAAIUrlRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" - - utils.logAudit(updateContrailAAIUrlRequest) - execution.setVariable(Prefix + "updateContrailAAIUrlRequest", updateContrailAAIUrlRequest) - utils.log("DEBUG", Prefix + "updateContrailAAIUrlRequest - " + "\n" + updateContrailAAIUrlRequest, isDebugEnabled) - - //Prepare payload (PUT) - String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) - String payload = networkUtils.ContrailNetworkCreatedUpdate(requeryIdAAIResponse, createNetworkResponse, schemaVersion) - String payloadXml = utils.formatXml(payload) - utils.logAudit(payloadXml) - execution.setVariable(Prefix + "updateContrailAAIPayloadRequest", payloadXml) - utils.log("DEBUG", " 'payload' to Update Contrail - " + "\n" + payloadXml, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIPutCall(execution, updateContrailAAIUrlRequest, payloadXml) - - String returnCode = response.getStatusCode() - execution.setVariable(Prefix + "aaiUpdateContrailReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI Update Contrail Response Code : " + returnCode, isDebugEnabled) - String aaiUpdateContrailResponseAsString = response.getResponseBodyAsString() - if (returnCode=='200') { - utils.logAudit(aaiUpdateContrailResponseAsString) - execution.setVariable(Prefix + "updateContrailAAIResponse", aaiUpdateContrailResponseAsString) - utils.log("DEBUG", " AAI Update Contrail Success REST Response - " + "\n" + aaiUpdateContrailResponseAsString, isDebugEnabled) - // Point-of-no-return is set to false, rollback not needed. - String rollbackEnabled = execution.getVariable(Prefix + "rollbackEnabled") - if (rollbackEnabled == "true") { - execution.setVariable(Prefix + "isPONR", false) - } else { - execution.setVariable(Prefix + "isPONR", true) - } - utils.log("DEBUG", Prefix + "isPONR" + ": " + execution.getVariable(Prefix + "isPONR"), isDebugEnabled) - } else { - if (returnCode=='404') { - String dataErrorMessage = " Response Error from UpdateContrailAAINetwork is 404 (Not Found)." - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiUpdateContrailResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiUpdateContrailResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String errorMessage = "Unexpected Response from UpdateContrailAAINetwork - " + returnCode - utils.log("DEBUG", errorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - } - } - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTUpdateContrailAAINetwork() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareCreateNetworkRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareCreateNetworkRequest() of DoCreateNetworkInstance ***** ", isDebugEnabled) - - try { - - // get variables - String requestId = execution.getVariable("msoRequestId") - if (requestId == null) { - requestId = execution.getVariable("mso-request-id") - } - String messageId = execution.getVariable(Prefix + "messageId") - String source = execution.getVariable(Prefix + "source") - - String requestInput = execution.getVariable(Prefix + "networkRequest") - String queryIdResponse = execution.getVariable(Prefix + "queryIdAAIResponse") - String cloudRegionId = execution.getVariable(Prefix + "cloudRegionPo") - String backoutOnFailure = execution.getVariable(Prefix + "rollbackEnabled") - - // Prepare Network request - String routeCollection = execution.getVariable(Prefix + "routeCollection") - String policyCollection = execution.getVariable(Prefix + "networkCollection") - String tableCollection = execution.getVariable(Prefix + "tableRefCollection") - String createNetworkRequest = networkUtils.CreateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyCollection, tableCollection, cloudRegionId, backoutOnFailure, source ) - // Format Response - String buildDeleteNetworkRequestAsString = utils.formatXml(createNetworkRequest) - buildDeleteNetworkRequestAsString = buildDeleteNetworkRequestAsString.replace(":w1aac13n0", "").replace("w1aac13n0:", "") - utils.logAudit(buildDeleteNetworkRequestAsString) - - execution.setVariable(Prefix + "createNetworkRequest", buildDeleteNetworkRequestAsString) - utils.log("DEBUG", Prefix + "createNetworkRequest - " + "\n" + buildDeleteNetworkRequestAsString, isDebugEnabled) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareCreateNetworkRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareSDNCRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareSDNCRequest() of DoCreateNetworkInstance ***** ", isDebugEnabled) - - try { - // get variables - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String createNetworkInput = execution.getVariable(Prefix + "networkRequest") - String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") - - String networkId = execution.getVariable(Prefix + "networkId") - String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - - // get/set 'msoRequestId' and 'mso-request-id' - String requestId = execution.getVariable("msoRequestId") - if (requestId != null) { - execution.setVariable("mso-request-id", requestId) - } else { - requestId = execution.getVariable("mso-request-id") - } - execution.setVariable(Prefix + "requestId", requestId) - - // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, createNetworkInput, serviceInstanceId, sdncCallback, "assign", "NetworkActivateRequest", cloudRegionId, networkId, null, null) - - String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) - utils.logAudit(sndcTopologyCreateRequesAsString) - execution.setVariable(Prefix + "assignSDNCRequest", sndcTopologyCreateRequesAsString) - utils.log("DEBUG", Prefix + "assignSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString, isDebugEnabled) - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSDNCRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareRpcSDNCRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareRpcSDNCRequest() of DoCreateNetworkInstance ***** ", isDebugEnabled) - - try { - // get variables - - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String createNetworkInput = execution.getVariable(Prefix + "networkRequest") - String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") - - String networkId = execution.getVariable(Prefix + "networkId") - String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - - // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "assign", "CreateNetworkInstance", cloudRegionId, networkId, null) - - String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) - utils.logAudit(sndcTopologyCreateRequesAsString) - execution.setVariable(Prefix + "assignSDNCRequest", sndcTopologyCreateRequesAsString) - utils.log("DEBUG", Prefix + "assignSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString, isDebugEnabled) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareRpcSDNCActivateRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareRpcSDNCActivateRequest() of DoCreateNetworkInstance ***** ", isDebugEnabled) - - try { - // get variables - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String createNetworkInput = execution.getVariable(Prefix + "networkRequest") - String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") - String networkId = execution.getVariable(Prefix + "networkId") - String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - - // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "activate", "CreateNetworkInstance", cloudRegionId, networkId, null) - - String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) - utils.logAudit(sndcTopologyCreateRequesAsString) - execution.setVariable(Prefix + "activateSDNCRequest", sndcTopologyCreateRequesAsString) - utils.log("DEBUG", Prefix + "activateSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString, isDebugEnabled) - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCActivateRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - - - // ************************************************** - // Post or Validate Response Section - // ************************************************** - - public void validateCreateNetworkResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside validateNetworkResponse() of DoCreateNetworkInstance *****", isDebugEnabled) - - try { - String returnCode = execution.getVariable(Prefix + "networkReturnCode") - String networkResponse = execution.getVariable(Prefix + "createNetworkResponse") - if (networkResponse==null) { - networkResponse="" // reset - } - - utils.log("DEBUG", " Network Adapter create responseCode: " + returnCode, isDebugEnabled) - - String errorMessage = "" - if (returnCode == "200") { - execution.setVariable(Prefix + "isNetworkRollbackNeeded", true) - utils.logAudit(networkResponse) - execution.setVariable(Prefix + "createNetworkResponse", networkResponse) - utils.log("DEBUG", " Network Adapter create Success Response - " + "\n" + networkResponse, isDebugEnabled) - - // prepare rollback data - String rollbackData = utils.getNodeXml(networkResponse, "rollback", false).replace("tag0:","").replace(":tag0","") - rollbackData = rollbackData.replace("rollback>", "networkRollback>") - String rollbackNetwork = - """ - ${rollbackData} - """ - String rollbackNetworkXml = utils.formatXml(rollbackNetwork) - execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkXml) - utils.log("DEBUG", " Network Adapter rollback data - " + "\n" + rollbackNetworkXml, isDebugEnabled) - - } else { // network error - if (returnCode.toInteger() > 399 && returnCode.toInteger() < 600) { //4xx, 5xx - if (networkResponse.contains("createNetworkError")) { - networkResponse = networkResponse.replace('', '') - errorMessage = utils.getNodeText1(networkResponse, "message") - errorMessage = "Received error from Network Adapter: " + errorMessage - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - - } else { // CatchAll exception - if (returnCode == "500") { - errorMessage = "JBWEB000065: HTTP Status 500." - } else { - errorMessage = "Return code is " + returnCode - } - errorMessage = "Received error from Network Adapter: " + errorMessage - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - - } - - } else { // CatchAll exception - String dataErrorMessage = "Received error from Network Adapter. Return code is: " + returnCode - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. validateCreateNetworkResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - - } - - public void validateSDNCResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside validateSDNCResponse() of DoCreateNetworkInstance ***** ", isDebugEnabled) - - String response = execution.getVariable(Prefix + "assignSDNCResponse") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - WorkflowException workflowException = execution.getVariable("WorkflowException") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - // reset variable - String assignSDNCResponseDecodeXml = sdncAdapterUtils.decodeXML(execution.getVariable(Prefix + "assignSDNCResponse")) - assignSDNCResponseDecodeXml = assignSDNCResponseDecodeXml.replace("&", "&").replace('', "") - execution.setVariable(Prefix + "assignSDNCResponse", assignSDNCResponseDecodeXml) - - if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, Prefix+'sdncResponseSuccess' - execution.setVariable(Prefix + "isSdncRollbackNeeded", true) - utils.log("DEBUG", "Successfully Validated SDNC Response", isDebugEnabled) - - } else { - utils.log("DEBUG", "Did NOT Successfully Validated SDNC Response", isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - - } - - public void validateRpcSDNCActivateResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside validateRpcSDNCActivateResponse() of DoCreateNetworkInstance ***** ", isDebugEnabled) - - String response = execution.getVariable(Prefix + "activateSDNCResponse") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - WorkflowException workflowException = execution.getVariable("WorkflowException") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - // reset variable - String assignSDNCResponseDecodeXml = sdncAdapterUtils.decodeXML(execution.getVariable(Prefix + "activateSDNCResponse")) - assignSDNCResponseDecodeXml = assignSDNCResponseDecodeXml.replace("&", "&").replace('', "") - execution.setVariable(Prefix + "activateSDNCResponse", assignSDNCResponseDecodeXml) - - if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, Prefix+'sdncResponseSuccess' - execution.setVariable(Prefix + "isSdncActivateRollbackNeeded", true) - utils.log("DEBUG", "Successfully Validated Rpc SDNC Activate Response", isDebugEnabled) - - } else { - utils.log("DEBUG", "Did NOT Successfully Validated Rpc SDNC Activate Response", isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - - } - - - public void prepareSDNCRollbackRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareSDNCRollbackRequest() of DoCreateNetworkInstance ***** ", isDebugEnabled) - - try { - // get variables - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String createNetworkInput = execution.getVariable(Prefix + "networkRequest") - String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") - String assignSDNCResponse = execution.getVariable(Prefix + "assignSDNCResponse") - String networkId = execution.getVariable(Prefix + "networkId") - if (networkId == 'null') {networkId = ""} - String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - - // 2. prepare rollback topology via SDNC Adapter SUBFLOW call - String sndcTopologyRollbackRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, createNetworkInput, serviceInstanceId, sdncCallback, "rollback", "NetworkActivateRequest", cloudRegionId, networkId, null, null) - String sndcTopologyRollbackRequestAsString = utils.formatXml(sndcTopologyRollbackRequest) - execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyRollbackRequestAsString) - utils.log("DEBUG", " Preparing request for SDNC Topology 'rollback-NetworkActivateRequest' rollback . . . - " + "\n" + sndcTopologyRollbackRequestAsString, isDebugEnabled) - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSDNCRollbackRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareRpcSDNCRollbackRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareRpcSDNCRollbackRequest() of DoCreateNetworkInstance ***** ", isDebugEnabled) - - try { - // get variables - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String createNetworkInput = execution.getVariable(Prefix + "networkRequest") - String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") - String assignSDNCResponse = execution.getVariable(Prefix + "assignSDNCResponse") - String networkId = execution.getVariable(Prefix + "networkId") - if (networkId == 'null') {networkId = ""} - String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - - // 2. prepare rollback topology via SDNC Adapter SUBFLOW call - String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "unassign", "DeleteNetworkInstance", cloudRegionId, networkId, null) - String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) - execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyRollbackRpcRequestAsString) - utils.log("DEBUG", " Preparing request for SDNC Topology 'unassign-DeleteNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString, isDebugEnabled) - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCRollbackRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareRpcSDNCActivateRollback(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareRpcSDNCActivateRollback() of DoCreateNetworkInstance ***** ", isDebugEnabled) - - try { - - // get variables - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String createNetworkInput = execution.getVariable(Prefix + "networkRequest") - String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") - String activateSDNCResponse = execution.getVariable(Prefix + "activateSDNCResponse") - String networkId = execution.getVariable(Prefix + "networkId") - if (networkId == 'null') {networkId = ""} - String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - - // 2. prepare rollback topology via SDNC Adapter SUBFLOW call - String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "deactivate", "DeleteNetworkInstance", cloudRegionId, networkId, null) - String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) - execution.setVariable(Prefix + "rollbackActivateSDNCRequest", sndcTopologyRollbackRpcRequestAsString) - utils.log("DEBUG", " Preparing request for RPC SDNC Topology 'deactivate-DeleteNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString, isDebugEnabled) - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCActivateRollback() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareRollbackData(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareRollbackData() of DoCreateNetworkInstance ***** ", isDebugEnabled) - - try { - - Map rollbackData = new HashMap(); - String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") - if (rollbackSDNCRequest != null) { - if (rollbackSDNCRequest != "") { - rollbackData.put("rollbackSDNCRequest", execution.getVariable(Prefix + "rollbackSDNCRequest")) - } - } - String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") - if (rollbackNetworkRequest != null) { - if (rollbackNetworkRequest != "") { - rollbackData.put("rollbackNetworkRequest", execution.getVariable(Prefix + "rollbackNetworkRequest")) - } - } - String rollbackActivateSDNCRequest = execution.getVariable(Prefix + "rollbackActivateSDNCRequest") - if (rollbackActivateSDNCRequest != null) { - if (rollbackActivateSDNCRequest != "") { - rollbackData.put("rollbackActivateSDNCRequest", execution.getVariable(Prefix + "rollbackActivateSDNCRequest")) - } - } - execution.setVariable("rollbackData", rollbackData) - utils.log("DEBUG", "** rollbackData : " + rollbackData, isDebugEnabled) - - execution.setVariable("WorkflowException", execution.getVariable(Prefix + "WorkflowException")) - utils.log("DEBUG", "** WorkflowException : " + execution.getVariable("WorkflowException"), isDebugEnabled) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRollbackData() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void postProcessResponse(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside postProcessResponse() of DoCreateNetworkInstance ***** ", isDebugEnabled) - - try { - - //Conditions: - // 1. Silent Success: execution.getVariable("CRENWKI_orchestrationStatus") == "ACTIVE" - // 2. Success: execution.getVariable("WorkflowException") == null (NULL) - // 3. WorkflowException: execution.getVariable("WorkflowException") != null (NOT NULL) - - utils.log("DEBUG", " ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException"), isDebugEnabled) - // successful flow - if (execution.getVariable(Prefix + "isException") == false) { - // set rollback data - execution.setVariable("orchestrationStatus", "") - execution.setVariable("networkId", execution.getVariable(Prefix + "networkId")) - execution.setVariable("networkName", execution.getVariable(Prefix + "networkName")) - prepareSuccessRollbackData(execution) // populate rollbackData - execution.setVariable("WorkflowException", null) - execution.setVariable(Prefix + "Success", true) - utils.log("DEBUG", " ***** postProcessResponse(), GOOD !!!", isDebugEnabled) - } else { - // inside sub-flow logic - execution.setVariable(Prefix + "Success", false) - execution.setVariable("rollbackData", null) - String exceptionMessage = " Exception encountered in MSO Bpmn. " - if (execution.getVariable("workflowException") != null) { // Output of Rollback flow. - utils.log("DEBUG", " ***** workflowException: " + execution.getVariable("workflowException"), isDebugEnabled) - WorkflowException wfex = execution.getVariable("workflowException") - exceptionMessage = wfex.getErrorMessage() - } else { - if (execution.getVariable(Prefix + "WorkflowException") != null) { - WorkflowException pwfex = execution.getVariable(Prefix + "WorkflowException") - exceptionMessage = pwfex.getErrorMessage() - } - } - // going to the Main flow: a-la-carte or macro - utils.log("DEBUG", " ***** postProcessResponse(), BAD !!!", isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - throw new BpmnError("MSOWorkflowException") - } - - } catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - throw new BpmnError("MSOWorkflowException") - - } - - - - } - - public void prepareSuccessRollbackData(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareSuccessRollbackData() of DoCreateNetworkInstance ***** ", isDebugEnabled) - - try { - - if (execution.getVariable("sdncVersion") != '1610') { - prepareRpcSDNCRollbackRequest(execution) - prepareRpcSDNCActivateRollback(execution) - } else { - prepareSDNCRollbackRequest(execution) - } - - Map rollbackData = new HashMap(); - String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") - if (rollbackSDNCRequest != null) { - if (rollbackSDNCRequest != "") { - rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) - } - } - String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") - if (rollbackNetworkRequest != null) { - if (rollbackNetworkRequest != "") { - rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) - } - } - String rollbackActivateSDNCRequest = execution.getVariable(Prefix + "rollbackActivateSDNCRequest") - if (rollbackActivateSDNCRequest != null) { - if (rollbackActivateSDNCRequest != "") { - rollbackData.put("rollbackActivateSDNCRequest", rollbackActivateSDNCRequest) - } - } - execution.setVariable("rollbackData", rollbackData) - - utils.log("DEBUG", "** 'rollbackData' for Full Rollback : " + rollbackData, isDebugEnabled) - execution.setVariable("WorkflowException", null) - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void setExceptionFlag(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside setExceptionFlag() of DoCreateNetworkInstance ***** ", isDebugEnabled) - - try { - - execution.setVariable(Prefix + "isException", true) - - if (execution.getVariable("SavedWorkflowException1") != null) { - execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) - } else { - execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) - } - utils.log("DEBUG", Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException"), isDebugEnabled) - - } catch(Exception ex){ - String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. setExceptionFlag(): " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - } - - } - - - // ******************************* - // Build Error Section - // ******************************* - - - - public void processJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - try{ - utils.log("DEBUG", "Caught a Java Exception in " + Prefix, isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) - } - utils.log("DEBUG", "Completed processJavaException Method in " + Prefix, isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy deleted file mode 100644 index 760389ef43..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy +++ /dev/null @@ -1,387 +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.bpmn.infrastructure.scripts; - -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.NetworkUtils -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils - -/** - * This groovy class supports the DoCreateNetworkInstance.bpmn process. - * - */ -public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcessor { - String Prefix="CRENWKIR_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - NetworkUtils networkUtils = new NetworkUtils() - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - - def className = getClass().getSimpleName() - - /** - * This method is executed during the preProcessRequest task of the DoCreateNetworkInstanceRollback.bpmn process. - * @param execution - */ - public InitializeProcessVariables(DelegateExecution execution){ - /* Initialize all the process variables in this block */ - - execution.setVariable(Prefix + "rollbackNetworkRequest", null) - execution.setVariable(Prefix + "rollbackSDNCRequest", null) - execution.setVariable(Prefix + "rollbackActivateSDNCRequest", null) - execution.setVariable(Prefix + "WorkflowException", null) - - execution.setVariable(Prefix + "rollbackNetworkRequest", "") - execution.setVariable(Prefix + "rollbackNetworkResponse", "") - execution.setVariable(Prefix + "rollbackNetworkReturnCode", "") - - execution.setVariable(Prefix + "rollbackSDNCRequest", "") - execution.setVariable(Prefix + "rollbackSDNCResponse", "") - execution.setVariable(Prefix + "rollbackSDNCReturnCode", "") - - execution.setVariable(Prefix + "rollbackActivateSDNCRequest", "") - execution.setVariable(Prefix + "rollbackActivateSDNCResponse", "") - execution.setVariable(Prefix + "rollbackActivateSDNCReturnCode", "") - - execution.setVariable(Prefix + "Success", false) - execution.setVariable(Prefix + "fullRollback", false) - execution.setVariable(Prefix + "networkId", "") - execution.setVariable(Prefix + "urlRollbackPoNetwork", "") - - } - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - /** - * This method is executed during the preProcessRequest task of the DoCreateNetworkInstanceRollback.bpmn process. - * @param execution - */ - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest() of " + className + ".groovy ***** ", isDebugEnabled) - - try { - // initialize flow variables - InitializeProcessVariables(execution) - - // GET Incoming request/variables - String rollbackNetworkRequest = null - String rollbackSDNCRequest = null - String rollbackActivateSDNCRequest = null - - // Partial Rollback - Map rollbackData = execution.getVariable("rollbackData") - if (rollbackData != null && rollbackData instanceof Map) { - - if(rollbackData.containsKey("rollbackSDNCRequest")) { - rollbackSDNCRequest = rollbackData["rollbackSDNCRequest"] - } - - if(rollbackData.containsKey("rollbackNetworkRequest")) { - rollbackNetworkRequest = rollbackData["rollbackNetworkRequest"] - } - - if(rollbackData.containsKey("rollbackActivateSDNCRequest")) { - rollbackActivateSDNCRequest = rollbackData["rollbackActivateSDNCRequest"] - } - - } - - execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkRequest) - execution.setVariable(Prefix + "rollbackSDNCRequest", rollbackSDNCRequest) - execution.setVariable(Prefix + "rollbackActivateSDNCRequest", rollbackActivateSDNCRequest) - utils.log("DEBUG", "'rollbackData': " + '\n' + execution.getVariable("rollbackData"), isDebugEnabled) - - String sdncVersion = execution.getVariable("sdncVersion") - utils.log("DEBUG", "sdncVersion? : " + sdncVersion, isDebugEnabled) - - // PO Authorization Info / headers Authorization= - String basicAuthValuePO = execution.getVariable("URN_mso_adapters_po_auth") - utils.log("DEBUG", " Obtained BasicAuth userid password for PO/SDNC adapter: " + basicAuthValuePO, isDebugEnabled) - try { - def encodedString = utils.getBasicAuth(basicAuthValuePO, execution.getVariable("URN_mso_msoKey")) - execution.setVariable("BasicAuthHeaderValuePO",encodedString) - execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) - - } catch (IOException ex) { - String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " - String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() - utils.log("DEBUG", dataErrorMessage , isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - if (execution.getVariable("SavedWorkflowException1") != null) { - execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) - } else { - execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) - } - utils.log("DEBUG", "*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException"), isDebugEnabled) - if(execution.getVariable(Prefix + "WorkflowException") != null) { - // called by: DoCreateNetworkInstance, partial rollback - execution.setVariable(Prefix + "fullRollback", false) - - } else { - // called by: Macro - Full Rollback, WorkflowException = null - execution.setVariable(Prefix + "fullRollback", true) - - } - utils.log("DEBUG", "*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"), isDebugEnabled) - - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callPONetworkAdapter (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside callPONetworkAdapter() of " + className + " ***** ", isDebugEnabled) - - try { - String poUrl = execution.getVariable("URN_mso_adapters_network_rest_endpoint") - String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") - String networkId = utils.getNodeText1(rollbackSDNCRequest, "network-id") - - String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") - - String urlRollbackPoNetwork = poUrl+ "/" + networkId + "/rollback" - utils.log("DEBUG", "'urlRollbackPoNetwork': " + urlRollbackPoNetwork, isDebugEnabled) - execution.setVariable(Prefix + "urlRollbackPoNetwork", urlRollbackPoNetwork) - - RESTConfig config = new RESTConfig(urlRollbackPoNetwork) - RESTClient client = new RESTClient(config). - addHeader("Content-Type", "application/xml"). - addAuthorizationHeader(execution.getVariable("BasicAuthHeaderValuePO")); - - APIResponse response = client.httpDelete(rollbackNetworkRequest) - String responseCode = response.getStatusCode() - String responseBody = response.getResponseBodyAsString() - - execution.setVariable(Prefix + "rollbackNetworkReturnCode", responseCode) - execution.setVariable(Prefix + "rollbackNetworkResponse", responseBody) - - utils.log("DEBUG", " Network Adapter rollback responseCode: " + responseCode, isDebugEnabled) - utils.log("DEBUG", " Network Adapter rollback responseBody: " + responseBody, isDebugEnabled) - - - } catch (Exception ex) { - String exceptionMessage = "Exception Encountered in callPONetworkAdapter() of DoCreateNetworkInstanceRollback flow - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - } - - - public void validateRollbackResponses (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside validateRollbackResponses() of DoCreateNetworkInstanceRollback ***** ", isDebugEnabled) - - try { - // validate PO network rollback response - String rollbackNetworkErrorMessages = "" - String rollbackNetworkReturnCode = "200" - if (execution.getVariable(Prefix + "rollbackNetworkRequest") != null) { - rollbackNetworkReturnCode = execution.getVariable(Prefix + "rollbackNetworkReturnCode") - String rollbackNetworkResponse = execution.getVariable(Prefix + "rollbackNetworkResponse") - utils.log("DEBUG", " NetworkRollback Code - " + rollbackNetworkReturnCode, isDebugEnabled) - utils.log("DEBUG", " NetworkRollback Response - " + rollbackNetworkResponse, isDebugEnabled) - if (rollbackNetworkReturnCode != "200") { - rollbackNetworkErrorMessages = " + PO Network rollback failed. " - } else { - rollbackNetworkErrorMessages = " + PO Network rollback completed." - } - } - - // validate SDNC rollback response - String rollbackSdncErrorMessages = "" - String rollbackSDNCReturnCode = "200" - if (execution.getVariable(Prefix + "rollbackSDNCRequest") != null) { - rollbackSDNCReturnCode = execution.getVariable(Prefix + "rollbackSDNCReturnCode") - String rollbackSDNCResponse = execution.getVariable(Prefix + "rollbackSDNCResponse") - String rollbackSDNCReturnInnerCode = "" - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - rollbackSDNCResponse = sdncAdapterUtils.decodeXML(rollbackSDNCResponse) - rollbackSDNCResponse = rollbackSDNCResponse.replace("&", "&").replace('$', '').replace('', "") - if (rollbackSDNCReturnCode == "200") { - if (utils.nodeExists(rollbackSDNCResponse, "response-code")) { - rollbackSDNCReturnInnerCode = utils.getNodeText1(rollbackSDNCResponse, "response-code") - if (rollbackSDNCReturnInnerCode == "200" || rollbackSDNCReturnInnerCode == "" || rollbackSDNCReturnInnerCode == "0") { - rollbackSdncErrorMessages = " + SNDC assign rollback completed." - } else { - rollbackSdncErrorMessages = " + SDNC assign rollback failed. " - } - } else { - rollbackSdncErrorMessages = " + SNDC assign rollback completed." - } - } else { - rollbackSdncErrorMessages = " + SDNC assign rollback failed. " - } - utils.log("DEBUG", " SDNC assign rollback Code - " + rollbackSDNCReturnCode, isDebugEnabled) - utils.log("DEBUG", " SDNC assign rollback Response - " + rollbackSDNCResponse, isDebugEnabled) - } - - // validate SDNC activate rollback response - String rollbackActivateSdncErrorMessages = "" - String rollbackActivateSDNCReturnCode = "200" - if (execution.getVariable(Prefix + "rollbackActivateSDNCRequest") != null) { - rollbackActivateSDNCReturnCode = execution.getVariable(Prefix + "rollbackActivateSDNCReturnCode") - String rollbackActivateSDNCResponse = execution.getVariable(Prefix + "rollbackActivateSDNCResponse") - String rollbackActivateSDNCReturnInnerCode = "" - rollbackActivateSDNCResponse = sdncAdapterUtils.decodeXML(rollbackActivateSDNCResponse) - rollbackActivateSDNCResponse = rollbackActivateSDNCResponse.replace("&", "&").replace('$', '').replace('', "") - if (rollbackActivateSDNCReturnCode == "200") { - if (utils.nodeExists(rollbackActivateSDNCResponse, "response-code")) { - rollbackActivateSDNCReturnInnerCode = utils.getNodeText1(rollbackActivateSDNCResponse, "response-code") - if (rollbackActivateSDNCReturnInnerCode == "200" || rollbackActivateSDNCReturnInnerCode == "" || rollbackActivateSDNCReturnInnerCode == "0") { - rollbackActivateSdncErrorMessages = " + SNDC activate rollback completed." - } else { - rollbackActivateSdncErrorMessages = " + SDNC activate rollback failed. " - } - } else { - rollbackActivateSdncErrorMessages = " + SNDC activate rollback completed." - } - } else { - rollbackActivateSdncErrorMessages = " + SDNC activate rollback failed. " - } - utils.log("DEBUG", " SDNC activate rollback Code - " + rollbackActivateSDNCReturnCode, isDebugEnabled) - utils.log("DEBUG", " SDNC activate rollback Response - " + rollbackActivateSDNCResponse, isDebugEnabled) - } - - - String statusMessage = "" - int errorCode = 7000 - utils.log("DEBUG", "*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"), isDebugEnabled) - if (execution.getVariable(Prefix + "fullRollback") == false) { - // original WorkflowException, - WorkflowException wfe = execution.getVariable(Prefix + "WorkflowException") - if (wfe != null) { - // rollback due to failure in DoCreate - Partial rollback - statusMessage = wfe.getErrorMessage() - errorCode = wfe.getErrorCode() - } else { - statusMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." - errorCode = '7000' - } - - // set if all rolledbacks are successful - if (rollbackNetworkReturnCode == "200" && rollbackSDNCReturnCode == "200" && rollbackActivateSDNCReturnCode == "200") { - execution.setVariable("rolledBack", true) - execution.setVariable("wasDeleted", true) - - } else { - execution.setVariable("rolledBack", false) - execution.setVariable("wasDeleted", true) - } - - statusMessage = statusMessage + rollbackActivateSdncErrorMessages + rollbackNetworkErrorMessages + rollbackSdncErrorMessages - utils.log("DEBUG", "Final DoCreateNetworkInstanceRollback status message: " + statusMessage, isDebugEnabled) - String processKey = getProcessKey(execution); - WorkflowException exception = new WorkflowException(processKey, errorCode, statusMessage); - execution.setVariable("workflowException", exception); - - } else { - // rollback due to failures in Main flow (Macro) - Full rollback - // WorkflowException = null - if (rollbackNetworkReturnCode == "200" && rollbackSDNCReturnCode == "200" && rollbackActivateSDNCReturnCode == "200") { - execution.setVariable("rollbackSuccessful", true) - execution.setVariable("rollbackError", false) - } else { - String exceptionMessage = "Network Create Rollback was not Successful. " - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - execution.setVariable("rollbackSuccessful", false) - execution.setVariable("rollbackError", true) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - throw new BpmnError("MSOWorkflowException") - } - - } - - - } catch (Exception ex) { - String errorMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." - String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstanceRollback flow. validateRollbackResponses() - " + errorMessage + ": " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - // ******************************* - // Build Error Section - // ******************************* - - - - public void processJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - try{ - utils.log("DEBUG", "Caught a Java Exception in " + Prefix, isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) - } - utils.log("DEBUG", "Completed processJavaException Method in " + Prefix, isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy deleted file mode 100644 index ab84168007..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy +++ /dev/null @@ -1,270 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.infrastructure.scripts - -import org.codehaus.jackson.map.ObjectMapper -import org.openecomp.mso.bpmn.infrastructure.properties.BPMNProperties - -import java.util.ArrayList -import java.util.Iterator -import java.util.List -import org.apache.commons.lang3.StringUtils -import org.apache.http.HttpResponse -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.codehaus.groovy.runtime.ArrayUtil -import org.codehaus.groovy.runtime.ScriptBytecodeAdapter -import org.codehaus.groovy.runtime.callsite.CallSite -import org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation -import org.codehaus.groovy.runtime.typehandling.ShortTypeHandling -import org.json.JSONArray -import org.json.JSONObject -import org.openecomp.mso.bpmn.common.recipe.BpmnRestClient -import org.openecomp.mso.bpmn.common.recipe.ResourceInput -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.domain.AllottedResource -import org.openecomp.mso.bpmn.core.domain.NetworkResource -import org.openecomp.mso.bpmn.core.domain.Resource -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder - -/** - * This groovy class supports the DoCreateResources.bpmn process. - * - * Inputs: - * @param - msoRequestId - * @param - globalSubscriberId - O - * @param - subscriptionServiceType - O - * @param - serviceInstanceId - * @param - serviceInstanceName - O - * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) - * @param - sdncVersion - * - * @param - addResourceList - * - * Outputs: - * @param - WorkflowException - - */ -public class DoCreateResources extends AbstractServiceTaskProcessor -{ - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - CatalogDbUtils cutils = new CatalogDbUtils() - - public void preProcessRequest(DelegateExecution execution) - { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled) - String msg = "" - - List addResourceList = execution.getVariable("addResourceList") - if (addResourceList == null) - { - msg = "Input addResourceList is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - else if (addResourceList.size() == 0) - { - msg = "No resource in addResourceList" - utils.log("INFO", msg, isDebugEnabled) - } - utils.log("INFO", " ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void sequenceResoure(DelegateExecution execution) - { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start sequenceResoure Process ======== ", isDebugEnabled) - - String serviceModelUUID = execution.getVariable("modelUuid") - - List addResourceList = execution.getVariable("addResourceList") - List networkResourceList = new ArrayList() - - List sequencedResourceList = new ArrayList() - - String serviceDecompose = execution.getVariable("serviceDecomposition") - String serviceModelName = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelName") - def resourceSequence = BPMNProperties.getResourceSequenceProp(serviceModelName) - - if(resourceSequence != null) { - // sequence is defined in config file - for (resourceType in resourceSequence) { - for (resource in addResourceList) { - if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) { - sequencedResourceList.add(resource) - - if (resource instanceof NetworkResource) { - networkResourceList.add(resource) - } - } - } - } - } else { - - //define sequenced resource list, we deploy vf first and then network and then ar - //this is defaule sequence - List vnfResourceList = new ArrayList() - List arResourceList = new ArrayList() - - for (Resource rc : addResourceList){ - if (rc instanceof VnfResource) { - vnfResourceList.add(rc) - } else if (rc instanceof NetworkResource) { - networkResourceList.add(rc) - } else if (rc instanceof AllottedResource) { - arResourceList.add(rc) - } - } - sequencedResourceList.addAll(vnfResourceList) - sequencedResourceList.addAll(networkResourceList) - sequencedResourceList.addAll(arResourceList) - } - - String isContainsWanResource = networkResourceList.isEmpty() ? "false" : "true" - execution.setVariable("isContainsWanResource", isContainsWanResource) - execution.setVariable("currentResourceIndex", 0) - execution.setVariable("sequencedResourceList", sequencedResourceList) - utils.log("INFO", "sequencedResourceList: " + sequencedResourceList, isDebugEnabled) - utils.log("INFO", "======== COMPLETED sequenceResoure Process ======== ", isDebugEnabled) - } - - public prepareServiceTopologyRequest(DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start prepareServiceTopologyRequest Process ======== ", isDebugEnabled) - - String serviceDecompose = execution.getVariable("serviceDecomposition") - - execution.setVariable("operationType", "create") - execution.setVariable("resourceType", "") - - String serviceInvariantUuid = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelInvariantUuid") - String serviceUuid = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelUuid") - String serviceModelName = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelName") - - execution.setVariable("modelInvariantUuid", serviceInvariantUuid) - execution.setVariable("modelUuid", serviceUuid) - execution.setVariable("serviceModelName", serviceModelName) - - utils.log("INFO", "======== End prepareServiceTopologyRequest Process ======== ", isDebugEnabled) - } - - public void getCurrentResoure(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start getCurrentResoure Process ======== ", isDebugEnabled) - def currentIndex = execution.getVariable("currentResourceIndex") - List sequencedResourceList = execution.getVariable("sequencedResourceList") - Resource currentResource = sequencedResourceList.get(currentIndex) - execution.setVariable("resourceType", currentResource.getModelInfo().getModelName()) - utils.log("INFO", "Now we deal with resouce:" + currentResource.getModelInfo().getModelName(), isDebugEnabled) - utils.log("INFO", "======== COMPLETED getCurrentResoure Process ======== ", isDebugEnabled) - } - - public void parseNextResource(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled) - def currentIndex = execution.getVariable("currentResourceIndex") - def nextIndex = currentIndex + 1 - execution.setVariable("currentResourceIndex", nextIndex) - List sequencedResourceList = execution.getVariable("sequencedResourceList") - if(nextIndex >= sequencedResourceList.size()){ - execution.setVariable("allResourceFinished", "true") - }else{ - execution.setVariable("allResourceFinished", "false") - } - utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled) - } - - public void prepareResourceRecipeRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled) - ResourceInput resourceInput = new ResourceInput() - String serviceInstanceName = execution.getVariable("serviceInstanceName") - String resourceType = execution.getVariable("resourceType") - String resourceInstanceName = resourceType + "_" + serviceInstanceName - resourceInput.setResourceInstanceName(resourceInstanceName) - utils.log("INFO", "Prepare Resource Request resourceInstanceName:" + resourceInstanceName, isDebugEnabled) - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String serviceType = execution.getVariable("serviceType") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String operationType = "createInstance" - resourceInput.setGlobalSubscriberId(globalSubscriberId) - resourceInput.setServiceType(serviceType) - resourceInput.setServiceInstanceId(serviceInstanceId) - resourceInput.setOperationId(operationId) - resourceInput.setOperationType(operationType); - def currentIndex = execution.getVariable("currentResourceIndex") - List sequencedResourceList = execution.getVariable("sequencedResourceList") - Resource currentResource = sequencedResourceList.get(currentIndex) - resourceInput.setResourceModelInfo(currentResource.getModelInfo()); - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); - def String resourceCustomizationUuid = currentResource.getModelInfo().getModelCustomizationUuid(); - - String incomingRequest = execution.getVariable("uuiRequest") - //set the requestInputs from tempalte To Be Done - String serviceModelUuid = jsonUtil.getJsonValue(incomingRequest,"service.serviceUuid") - String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters") - String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters) - resourceInput.setResourceParameters(resourceParameters) - execution.setVariable("resourceInput", resourceInput) - utils.log("INFO", "======== COMPLETED prepareResourceRecipeRequest Process ======== ", isDebugEnabled) - } - - public void executeResourceRecipe(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start executeResourceRecipe Process ======== ", isDebugEnabled) - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceType = execution.getVariable("serviceType") - ResourceInput resourceInput = execution.getVariable("resourceInput") - - // requestAction is action, not opertiontype - //String requestAction = resourceInput.getOperationType() - String requestAction = "createInstance" - JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction) - - if (resourceRecipe != null) { - String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri") - int recipeTimeOut = resourceRecipe.getInt("recipeTimeout") - String recipeParamXsd = resourceRecipe.get("paramXSD") - HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) - } else { - String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + - resourceInput.getResourceModelInfo().getModelUuid() - utils.log("ERROR", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, exceptionMessage) - } - - utils.log("INFO", "======== end executeResourceRecipe Process ======== ", isDebugEnabled) - } - - public void postConfigRequest(DelegateExecution execution){ - //now do noting - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy deleted file mode 100644 index c142532794..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy +++ /dev/null @@ -1,798 +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.bpmn.infrastructure.scripts; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.ServiceInstance -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.infrastructure.aai.AAICreateResources -import org.openecomp.mso.rest.APIResponse -import org.springframework.web.util.UriUtils - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.client.aai.AAIResourcesClient - -import java.util.logging.Logger; -import java.net.URI; - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; - -/** - * This groovy class supports the DoCreateServiceInstance.bpmn process. - * - * Inputs: - * @param - msoRequestId - * @param - globalSubscriberId - * @param - subscriptionServiceType - * @param - serviceInstanceId - * @param - serviceInstanceName - O - * @param - serviceModelInfo - * @param - productFamilyId - * @param - disableRollback - * @param - failExists - TODO - * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) - * @param - sdncVersion ("1610") - * @param - serviceDecomposition - Decomposition for R1710 - * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored) - * - * Outputs: - * @param - rollbackData (localRB->null) - * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) - * @param - WorkflowException - * @param - serviceInstanceName - (GET from AAI if null in input) - * - * This BB processes Macros(except TRANSPORT all sent to sdnc) and Alacartes(sdncSvcs && nonSdncSvcs) - */ -public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { - - String Prefix="DCRESI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - CatalogDbUtils cutils = new CatalogDbUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) - - try { - String requestId = execution.getVariable("msoRequestId") - execution.setVariable("prefix", Prefix) - - //Inputs - //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology - String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId - - //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - - //requestDetails.requestParameters. for SDNC assignTopology - String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId - - if (isBlank(globalSubscriberId)) { - msg = "Input globalSubscriberId is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - if (isBlank(subscriptionServiceType)) { - msg = "Input subscriptionServiceType is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - if (productFamilyId == null) { - execution.setVariable("productFamilyId", "") - } - - String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (isBlank(sdncCallbackUrl)) { - msg = "URN_mso_workflow_sdncadapter_callback is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) - - //requestDetails.modelInfo.for AAI PUT servieInstanceData & SDNC assignTopology - String modelInvariantUuid = "" - String modelVersion = "" - String modelUuid = "" - String modelName = "" - String serviceInstanceName = "" - //Generated in parent.for AAI PUT - String serviceInstanceId = "" - String serviceType = "" - String serviceRole = "" - - ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") - if (serviceDecomp != null) - { - serviceType = serviceDecomp.getServiceType() ?: "" - utils.log("DEBUG", "serviceType:" + serviceType, isDebugEnabled) - serviceRole = serviceDecomp.getServiceRole() ?: "" - - ServiceInstance serviceInstance = serviceDecomp.getServiceInstance() - if (serviceInstance != null) - { - serviceInstanceId = serviceInstance.getInstanceId() ?: "" - serviceInstanceName = serviceInstance.getInstanceName() ?: "" - execution.setVariable("serviceInstanceId", serviceInstanceId) - execution.setVariable("serviceInstanceName", serviceInstanceName) - } - - ModelInfo modelInfo = serviceDecomp.getModelInfo() - if (modelInfo != null) - { - modelInvariantUuid = modelInfo.getModelInvariantUuid() ?: "" - modelVersion = modelInfo.getModelVersion() ?: "" - modelUuid = modelInfo.getModelUuid() ?: "" - modelName = modelInfo.getModelName() ?: "" - } - else - { - msg = "Input serviceModelInfo is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - } - else - { - //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData & SDNC assignToplology - serviceInstanceName = execution.getVariable("serviceInstanceName") ?: "" - serviceInstanceId = execution.getVariable("serviceInstanceId") ?: "" - - String serviceModelInfo = execution.getVariable("serviceModelInfo") - if (isBlank(serviceModelInfo)) { - msg = "Input serviceModelInfo is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") ?: "" - modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") ?: "" - modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid") ?: "" - modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") ?: "" - //modelCustomizationUuid NA for SI - - } - - execution.setVariable("serviceType", serviceType) - execution.setVariable("serviceRole", serviceRole) - execution.setVariable("serviceInstanceName", serviceInstanceName) - - execution.setVariable("modelInvariantUuid", modelInvariantUuid) - execution.setVariable("modelVersion", modelVersion) - execution.setVariable("modelUuid", modelUuid) - execution.setVariable("modelName", modelName) - - //alacarte SIs are NOT sent to sdnc. exceptions are listed in config variable - String svcTypes = execution.getVariable("URN_sdnc_si_svc_types") ?: "" - utils.log("DEBUG", "SDNC SI serviceTypes:" + svcTypes, isDebugEnabled) - List svcList = Arrays.asList(svcTypes.split("\\s*,\\s*")); - boolean isSdncService= false - for (String listEntry : svcList){ - if (listEntry.equalsIgnoreCase(serviceType)){ - isSdncService = true - break; - } - } - - //All Macros are sent to SDNC, TRANSPORT(Macro) is sent to SDNW - //Alacartes are sent to SDNC if they are listed in config variable above - execution.setVariable("sendToSDNC", true) - if(execution.getVariable("sdncVersion").equals("1610")) //alacarte - { - if(!isSdncService){ - execution.setVariable("sendToSDNC", false) - //alacarte non-sdnc svcs must provide name (sdnc provides name for rest) - if (isBlank(execution.getVariable("serviceInstanceName" ))) - { - msg = "Input serviceInstanceName must be provided for alacarte" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - } - } - - utils.log("DEBUG", "isSdncService: " + isSdncService, isDebugEnabled) - utils.log("DEBUG", "Send To SDNC: " + execution.getVariable("sendToSDNC"), isDebugEnabled) - utils.log("DEBUG", "Service Type: " + execution.getVariable("serviceType"), isDebugEnabled) - - //macro may provide name and alacarte-portm may provide name - execution.setVariable("checkAAI", false) - if (!isBlank(execution.getVariable("serviceInstanceName" ))) - { - execution.setVariable("checkAAI", true) - } - - if (isBlank(serviceInstanceId)){ - msg = "Input serviceInstanceId is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - - StringBuilder sbParams = new StringBuilder() - Map paramsMap = execution.getVariable("serviceInputParams") - if (paramsMap != null) - { - sbParams.append("") - for (Map.Entry entry : paramsMap.entrySet()) { - String paramsXml - String paramName = entry.getKey() - String paramValue = entry.getValue() - paramsXml = - """ - ${paramName} - ${paramValue} - - """ - sbParams.append(paramsXml) - } - sbParams.append("") - } - String siParamsXml = sbParams.toString() - if (siParamsXml == null) - siParamsXml = "" - execution.setVariable("siParamsXml", siParamsXml) - - //AAI PUT - String oStatus = execution.getVariable("initialStatus") ?: "Active" - if ("TRANSPORT".equalsIgnoreCase(serviceType)) - { - oStatus = "Created" - } - - String statusLine = isBlank(oStatus) ? "" : "${oStatus}" - String serviceTypeLine = isBlank(serviceType) ? "" : "${serviceType}" - String serviceRoleLine = isBlank(serviceRole) ? "" : "${serviceRole}" - - //QUERY CATALOG DB AND GET WORKLOAD / ENVIRONMENT CONTEXT - String environmentContext = "" - String workloadContext ="" - - try{ - String json = cutils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) - - utils.log("DEBUG", "JSON IS: "+json, isDebugEnabled) - - environmentContext = jsonUtil.getJsonValue(json, "serviceResources.environmentContext") ?: "" - workloadContext = jsonUtil.getJsonValue(json, "serviceResources.workloadContext") ?: "" - utils.log("DEBUG", "Env Context is: "+ environmentContext, isDebugEnabled) - utils.log("DEBUG", "Workload Context is: "+ workloadContext, isDebugEnabled) - }catch(BpmnError e){ - throw e - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - - //Create AAI Payload - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) - String serviceInstanceData = - """ - ${serviceInstanceName} - ${serviceTypeLine} - ${serviceRoleLine} - ${statusLine} - ${modelInvariantUuid} - ${modelUuid} - ${environmentContext} - ${workloadContext} - """.trim() - - execution.setVariable("serviceInstanceData", serviceInstanceData) - utils.logAudit(serviceInstanceData) - utils.log("DEBUG", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - //TODO: Will be able to replace with call to GenericGetService - public void getAAICustomerById (DelegateExecution execution) { - // https://{aaiEP}/aai/v8/business/customers/customer/{globalCustomerId} - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - try { - - String globalCustomerId = execution.getVariable("globalSubscriberId") //VID to AAI name map - utils.log("DEBUG"," ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId, isDebugEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - if (isBlank(aai_endpoint) || isBlank(aai_uri)) - { - msg = "AAI URL is invalid. Endpoint:" + aai_endpoint + aai_uri - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - String getAAICustomerUrl = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") - - utils.logAudit(getAAICustomerUrl) - utils.log("DEBUG", "getAAICustomerById Url:" + getAAICustomerUrl, isDebugEnabled) - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getAAICustomerUrl) - String returnCode = response.getStatusCode() - String aaiResponseAsString = response.getResponseBodyAsString() - - msg = "getAAICustomerById ResponseCode:" + returnCode + " ResponseString:" + aaiResponseAsString - utils.log("DEBUG",msg, isDebugEnabled) - utils.logAudit(msg) - - if (returnCode=='200') { - // Customer found by ID. FLow to proceed. - utils.log("DEBUG",msg, isDebugEnabled) - - //TODO Deferred - //we might verify that service-subscription with matching name exists - //and throw error if not. If not checked, we will get exception in subsequent step on Create call - //in 1610 we assume both customer & service subscription were pre-created - - } else { - if (returnCode=='404') { - msg = "GlobalCustomerId:" + globalCustomerId + " not found (404) in AAI" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - utils.log("ERROR", aaiResponseAsString) - WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", workflowException) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - msg = "Error in getAAICustomerById ResponseCode:" + returnCode - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - } - - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in getAAICustomerById. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit getAAICustomerById *****", isDebugEnabled) - - } - - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** postProcessAAIGET ***** ", isDebugEnabled) - String msg = "" - - try { - String serviceInstanceName = execution.getVariable("serviceInstanceName") - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("DEBUG","Error getting Service-instance from AAI", + serviceInstanceName, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - else - { - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI){ - utils.log("DEBUG","Found Service-instance in AAI", isDebugEnabled) - msg = "ServiceInstance already exists in AAI:" + serviceInstanceName - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *** Exit postProcessAAIGET *** ", isDebugEnabled) - } - - public void postProcessAAIPUT(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** postProcessAAIPUT ***** ", isDebugEnabled) - String msg = "" - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator") - if(!succInAAI){ - utils.log("DEBUG","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - } - else - { - //start rollback set up - RollbackData rollbackData = new RollbackData() - def disableRollback = execution.getVariable("disableRollback") - rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) - rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") - rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId) - rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType")) - rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) - execution.setVariable("rollbackData", rollbackData) - } - - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *** Exit postProcessAAIPUT *** ", isDebugEnabled) - } - - public void preProcessSDNCAssignRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("DEBUG"," ***** preProcessSDNCAssignRequest *****", isDebugEnabled) - - try { - def serviceInstanceId = execution.getVariable("serviceInstanceId") - def serviceInstanceName = execution.getVariable("serviceInstanceName") - def callbackURL = execution.getVariable("sdncCallbackUrl") - def requestId = execution.getVariable("msoRequestId") - def serviceId = execution.getVariable("productFamilyId") - def subscriptionServiceType = execution.getVariable("subscriptionServiceType") - def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId - def msoAction = "" - - def modelInvariantUuid = execution.getVariable("modelInvariantUuid") - def modelVersion = execution.getVariable("modelVersion") - def modelUuid = execution.getVariable("modelUuid") - def modelName = execution.getVariable("modelName") - - def sdncRequestId = UUID.randomUUID().toString() - - def siParamsXml = execution.getVariable("siParamsXml") - - // special URL for SDNW, msoAction helps set diff url in SDNCA - if("TRANSPORT".equalsIgnoreCase(execution.getVariable("serviceType"))) - { - msoAction = "TRANSPORT" - } - - String sdncAssignRequest = - """ - - ${sdncRequestId} - ${serviceInstanceId} - assign - service-topology-operation - ${callbackURL} - ${msoAction} - - - - ${requestId} - MSO - - - - CreateServiceInstance - - - ${serviceId} - ${subscriptionServiceType} - - ${modelInvariantUuid} - ${modelUuid} - ${modelVersion} - ${modelName} - - ${serviceInstanceId} - - ${globalSubscriberId} - - - ${serviceInstanceName} - ${siParamsXml} - - - """ - - utils.log("DEBUG","sdncAssignRequest:\n" + sdncAssignRequest, isDebugEnabled) - sdncAssignRequest = utils.formatXml(sdncAssignRequest) - execution.setVariable("sdncAssignRequest", sdncAssignRequest) - utils.logAudit("sdncAssignRequest: " + sdncAssignRequest) - - def sdncRequestId2 = UUID.randomUUID().toString() - String sdncDelete = sdncAssignRequest.replace(">assign<", ">delete<").replace(">CreateServiceInstance<", ">DeleteServiceInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") - def sdncRequestId3 = UUID.randomUUID().toString() - String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId2}<", ">${sdncRequestId3}<") - def rollbackData = execution.getVariable("rollbackData") - rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", sdncDeactivate) - rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete) - execution.setVariable("rollbackData", rollbackData) - - utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in preProcessSDNCAssignRequest. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit preProcessSDNCAssignRequest *****", isDebugEnabled) - } - - public void postProcessSDNCAssign (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** postProcessSDNCAssign ***** ", isDebugEnabled) - try { - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - String response = execution.getVariable("sdncAdapterResponse") - utils.logAudit("SDNCResponse: " + response) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - utils.log("DEBUG","Good response from SDNC Adapter for service-instance topology assign: \n" + response, isDebugEnabled) - - def rollbackData = execution.getVariable("rollbackData") - rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true") - execution.setVariable("rollbackData", rollbackData) - - }else{ - utils.log("DEBUG","Bad Response from SDNC Adapter for service-instance assign", isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in postProcessSDNCAssign. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *** Exit postProcessSDNCAssign *** ", isDebugEnabled) - } - - public void postProcessAAIGET2(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** postProcessAAIGET2 ***** ", isDebugEnabled) - String msg = "" - - try { - String serviceInstanceName = execution.getVariable("serviceInstanceName") - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("DEBUG","Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - else - { - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI){ - String aaiService = execution.getVariable("GENGS_service") - if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) { - execution.setVariable("serviceInstanceName", utils.getNodeText1(aaiService, "service-instance-name")) - utils.log("DEBUG","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled) - } - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *** Exit postProcessAAIGET2 *** ", isDebugEnabled) - } - - public void preProcessRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled) - try { - - Object workflowException = execution.getVariable("WorkflowException"); - - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) - execution.setVariable("prevWorkflowException", workflowException); - //execution.setVariable("WorkflowException", null); - } - } catch (BpmnError e) { - utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) - } catch(Exception ex) { - String msg = "Exception in preProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled) - } - - public void postProcessRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled) - String msg = "" - try { - Object workflowException = execution.getVariable("prevWorkflowException"); - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) - execution.setVariable("WorkflowException", workflowException); - } - execution.setVariable("rollbackData", null) - } catch (BpmnError b) { - utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) - throw b; - } catch(Exception ex) { - msg = "Exception in postProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugEnabled) - } - - public void createProject(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ***** createProject ***** ", isDebugEnabled) - - String bpmnRequest = execution.getVariable("requestJson") - String projectName = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.project.projectName") - String serviceInstance = execution.getVariable("serviceInstanceId") - - utils.log("DEBUG", "BPMN REQUEST IS: "+ bpmnRequest, isDebugEnabled) - utils.log("DEBUG","PROJECT NAME: " + projectName, isDebugEnabled) - utils.log("DEBUG","Service Instance: " + serviceInstance, isDebugEnabled) - - if(projectName == null||projectName.equals("")){ - utils.log("DEBUG", "Project Name was not found in input. Skipping task...", isDebugEnabled) - }else{ - try{ - AAICreateResources aaiCR = new AAICreateResources() - aaiCR.createAAIProject(projectName, serviceInstance) - }catch(Exception ex){ - String msg = "Exception in createProject. " + ex.getMessage(); - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - utils.log("DEBUG"," *** Exit createProject *** ", isDebugEnabled) - } - - public void createOwningEntity(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ***** createOwningEntity ***** ", isDebugEnabled) - String msg = ""; - String bpmnRequest = execution.getVariable("requestJson") - String owningEntityId = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.owningEntity.owningEntityId") - String owningEntityName = jsonUtil.getJsonValue(bpmnRequest,"requestDetails.owningEntity.owningEntityName"); - String serviceInstance = execution.getVariable("serviceInstanceId") - - utils.log("DEBUG","owningEntity: " + owningEntityId, isDebugEnabled) - utils.log("DEBUG", "OwningEntityName: "+ owningEntityName, isDebugEnabled) - utils.log("DEBUG","Service Instance: " + serviceInstance, isDebugEnabled) - - try{ - AAICreateResources aaiCR = new AAICreateResources() - if(owningEntityId==null||owningEntityId.equals("")){ - msg = "Exception in createOwningEntity. OwningEntityId is null in input."; - throw new IllegalStateException(); - }else{ - if(aaiCR.existsOwningEntity(owningEntityId)){ - aaiCR.connectOwningEntityandServiceInstance(owningEntityId,serviceInstance) - }else{ - if(owningEntityName==null||owningEntityName.equals("")){ - msg = "Exception in createOwningEntity. Can't create an owningEntity without an owningEntityName in input."; - throw new IllegalStateException(); - }else{ - aaiCR.createAAIOwningEntity(owningEntityId, owningEntityName, serviceInstance) - } - } - } - }catch(Exception ex){ - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *** Exit createOwningEntity *** ", isDebugEnabled) - } - - // ******************************* - // Build Error Section - // ******************************* - - public void processJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - try{ - utils.log("DEBUG", "Caught a Java Exception in DoCreateServiceInstance", isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable("UnexpectedError", "Caught a Java Lang Exception in DoCreateServiceInstance") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception in DoCreateServiceInstance") - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable("UnexpectedError", "Exception in processJavaException") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method") - } - utils.log("DEBUG", "Completed processJavaException Method in DoCreateServiceInstance", isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy deleted file mode 100644 index cb69121e4e..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy +++ /dev/null @@ -1,237 +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.bpmn.infrastructure.scripts - - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; -/** - * This groovy class supports the DoCreateServiceInstanceRollback.bpmn process. - * - * Inputs: - * @param - msoRequestId - * @param - rollbackData with - * globalCustomerId - * subscriptionServiceType - * serviceInstanceId - * disableRollback - * rollbackAAI - * rollbackSDNC - * sdncRollbackRequest - * - * - * Outputs: - * @param - rollbackError - * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) - * - */ -public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcessor{ - - String Prefix="DCRESIRB_" - - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - String msg = "" - utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) - execution.setVariable("rollbackAAI",false) - execution.setVariable("rollbackSDNC",false) - - try { - def rollbackData = execution.getVariable("rollbackData") - utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled) - - if (rollbackData != null) { - if (rollbackData.hasType("SERVICEINSTANCE")) { - - def serviceInstanceId = rollbackData.get("SERVICEINSTANCE", "serviceInstanceId") - execution.setVariable("serviceInstanceId", serviceInstanceId) - - def subscriptionServiceType = rollbackData.get("SERVICEINSTANCE", "subscriptionServiceType") - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - - def globalSubscriberId = rollbackData.get("SERVICEINSTANCE", "globalSubscriberId") - execution.setVariable("globalSubscriberId", globalSubscriberId) - - def rollbackAAI = rollbackData.get("SERVICEINSTANCE", "rollbackAAI") - if ("true".equals(rollbackAAI)) - { - execution.setVariable("rollbackAAI",true) - } - - def rollbackSDNC = rollbackData.get("SERVICEINSTANCE", "rollbackSDNC") - if ("true".equals(rollbackSDNC)) - { - execution.setVariable("rollbackSDNC", true) - } - - if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackSDNC") != true) - { - execution.setVariable("skipRollback", true) - } - - def sdncDelete = rollbackData.get("SERVICEINSTANCE", "sdncDelete") - execution.setVariable("sdncDelete", sdncDelete) - def sdncDeactivate = rollbackData.get("SERVICEINSTANCE", "sdncDeactivate") - execution.setVariable("sdncDeactivate", sdncDeactivate) - utils.log("DEBUG","sdncDeactivate:\n" + sdncDeactivate, isDebugEnabled) - utils.log("DEBUG","sdncDelete:\n" + sdncDelete, isDebugEnabled) - } - else { - execution.setVariable("skipRollback", true) - } - } - else { - execution.setVariable("skipRollback", true) - } - if (execution.getVariable("disableRollback").equals("true" )) - { - execution.setVariable("skipRollback", true) - } - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in Create ServiceInstance Rollback preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void validateSDNCResponse(DelegateExecution execution, String response, String method) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** validateSDNCResponse ***** ", isDebugEnabled) - String msg = "" - try { - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - utils.log("DEBUG", "SDNCResponse: " + response, isDebugEnabled) - utils.log("DEBUG", "workflowException: " + workflowException, isDebugEnabled) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msg = "SDNC Adapter service-instance rollback successful for " + method - utils.log("DEBUG", msg, isDebugEnabled) - }else{ - execution.setVariable("rolledBack", false) - msg = "Error Response from SDNC Adapter service-instance rollback for " + method - execution.setVariable("rollbackError", msg) - utils.log("DEBUG", msg, isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in Create ServiceInstance rollback for " + method + " Exception:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit validateSDNCResponse ***** ", isDebugEnabled) - } - - public void postProcessRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** postProcessRequest ***** ", isDebugEnabled) - String msg = "" - try { - execution.setVariable("rollbackData", null) - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean rollbackAAI = execution.getVariable("rollbackAAI") - boolean rollbackSDNC = execution.getVariable("rollbackSDNC") - if (rollbackAAI || rollbackSDNC) - { - execution.setVariable("rolledBack", true) - } - if (rollbackAAI) - { - boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator") - if(!succInAAI){ - execution.setVariable("rolledBack", false) //both sdnc and aai must be successful to declare rollback Succesful - execution.setVariable("rollbackError", "Error deleting service-instance in AAI for rollback") - utils.log("DEBUG","Error deleting service-instance in AAI for rollback", + serviceInstanceId, isDebugEnabled) - } - } - utils.log("DEBUG","*** Exit postProcessRequest ***", isDebugEnabled) - - } catch (BpmnError e) { - msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + e.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } catch (Exception ex) { - msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - - } - - public void processRollbackException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** processRollbackException ***** ", isDebugEnabled) - try{ - utils.log("DEBUG", "Caught an Exception in DoCreateServiceInstanceRollback", isDebugEnabled) - execution.setVariable("rollbackData", null) - execution.setVariable("rollbackError", "Caught exception in ServiceInstance Create Rollback") - execution.setVariable("WorkflowException", null) - - }catch(BpmnError b){ - utils.log("DEBUG", "BPMN Error during processRollbackExceptions Method: ", isDebugEnabled) - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processRollbackExceptions Method: " + e.getMessage(), isDebugEnabled) - } - - utils.log("DEBUG", " Exit processRollbackException", isDebugEnabled) - } - - public void processRollbackJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** processRollbackJavaException ***** ", isDebugEnabled) - try{ - execution.setVariable("rollbackData", null) - execution.setVariable("rollbackError", "Caught Java exception in ServiceInstance Create Rollback") - utils.log("DEBUG", "Caught Exception in processRollbackJavaException", isDebugEnabled) - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception in processRollbackJavaException " + e.getMessage(), isDebugEnabled) - } - utils.log("DEBUG", "***** Exit processRollbackJavaException *****", isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollbackV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollbackV2.groovy deleted file mode 100644 index fa4250df13..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollbackV2.groovy +++ /dev/null @@ -1,51 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.client.orchestration.AAIOrchestrator -import org.openecomp.mso.client.orchestration.SDNCOrchestrator - -public class DoCreateServiceInstanceRollbackV2 extends AbstractServiceTaskProcessor{ - - @Override - public void preProcessRequest(DelegateExecution execution) { - - } - - public void aaiServiceInstanceRollback (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - def aaiServiceInstanceRollback = execution.getVariable("aaiServiceInstanceRollback") - if(aaiServiceInstanceRollback){ - utils.log("DEBUG"," ***** Started aaiServiceInstanceRollback *****", isDebugEnabled) - try{ - ServiceDecomposition serviceDecomp = execution.getVariable("ServiceDecomposition") - AAIOrchestrator aaiO = new AAIOrchestrator() - aaiO.deleteServiceInstance(serviceDecomp) - }catch (Exception ex) { - String msg = "Error Response from AAI for aaiServiceInstanceRollback" - execution.setVariable("rollbackError", msg) - utils.log("DEBUG", msg, isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - utils.log("DEBUG"," ***** Completed aaiServiceInstanceRollback *****", isDebugEnabled) - }else{ - utils.log("DEBUG", "***** SKIPPING A&AI ROLLBACK *****", isDebugEnabled) - } - } - - public void rollbackError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** rollbackError ***** ", isDebugEnabled) - try{ - utils.log("DEBUG", "Caught an Exception in DoCreateServiceInstanceRollbackV2", isDebugEnabled) - }catch(BpmnError b){ - utils.log("DEBUG", "BPMN Error during rollbackError: " + b.getMessage(), isDebugEnabled) - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during rollbackError: " + e.getMessage(), isDebugEnabled) - } - utils.log("DEBUG", " Exit processRollbackException", isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceV2.groovy deleted file mode 100644 index c55ce547c2..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceV2.groovy +++ /dev/null @@ -1,101 +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.bpmn.infrastructure.scripts; - -import static org.apache.commons.lang3.StringUtils.*; - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.client.orchestration.AAIOrchestrator -import org.openecomp.mso.client.orchestration.SDNCOrchestrator - -import groovy.json.* - -/** - * This groovy class supports the DoCreateServiceInstanceV2.bpmn process. - * -*/ - -public class DoCreateServiceInstanceV2 extends AbstractServiceTaskProcessor { - - AAIOrchestrator aaiO = new AAIOrchestrator() - SDNCOrchestrator sdncO = new SDNCOrchestrator() - - @Override - public void preProcessRequest(DelegateExecution execution) { - } - - public void createServiceInstance(DelegateExecution execution) { - execution.setVariable("callSDNC",true) - if(execution.getVariable("serviceType").equalsIgnoreCase("PORT-MIRROR")== false){ - if(execution.getVariable("sdncVersion").equals("1610")){ - execution.setVariable("callSDNC",false); - } - } - ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") - try{ - aaiO.createServiceInstance(serviceDecomp) - } catch (BpmnError e) { - throw e - } - } - - public void createProject(DelegateExecution execution) { - ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") - if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getProject() != null) { - try{ - aaiO.createProjectandConnectServiceInstance(serviceDecomp) - } catch (BpmnError e) { - throw e - } - } - } - - public void createOwningEntity(DelegateExecution execution) { - ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") - if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getOwningEntity() != null) { - try{ - aaiO.createOwningEntityandConnectServiceInstance(serviceDecomp) - } catch (BpmnError e) { - throw e - } - } - } - - public void sdncAssignRequest(DelegateExecution execution) { - ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") - if (serviceDecomp != null) { - try { - sdncO.sendSyncResponse(serviceDecomp) - } catch (BpmnError e) { - throw e - } - } - - } - - public void rollback(DelegateExecution execution) { - //TODO - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy deleted file mode 100644 index 95747d5a0b..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ /dev/null @@ -1,2148 +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.bpmn.infrastructure.scripts - -import org.openecomp.mso.bpmn.core.domain.CloudFlavor - -import java.util.Map -import java.util.Currency.CurrencyNameGetter - -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONArray -import org.json.JSONObject -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.NetworkUtils -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.scripts.VfModuleBase -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.core.json.DecomposeJsonUtil -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.client.aai.entities.AAIResultWrapper -import org.openecomp.mso.client.aai.entities.uri.AAIUri -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.springframework.web.util.UriUtils -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.NamedNodeMap -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource -import com.fasterxml.jackson.databind.ObjectMapper - -import com.fasterxml.jackson.databind.DeserializationFeature -import com.fasterxml.jackson.databind.ObjectMapper -import org.openecomp.mso.client.aai.AAIObjectType; -import org.openecomp.mso.client.aai.AAIResourcesClient -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; - - - -public class DoCreateVfModule extends VfModuleBase { - - String Prefix="DCVFM_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - CatalogDbUtils catalog = new CatalogDbUtils() - DecomposeJsonUtil decomposeJsonUtils = new DecomposeJsonUtil() - - /** - * Validates the request message and sets up the workflow. - * @param execution the execution - */ - public void preProcessRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - execution.setVariable('prefix', Prefix) - try{ - def rollbackData = execution.getVariable("rollbackData") - if (rollbackData == null) { - rollbackData = new RollbackData() - } - - execution.setVariable("DCVFM_vnfParamsExistFlag", false) - execution.setVariable("DCVFM_oamManagementV4Address", "") - execution.setVariable("DCVFM_oamManagementV6Address", "") - - String request = execution.getVariable("DoCreateVfModuleRequest") - - if (request == null || request.isEmpty()) { - // Building Block-type request - - String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo") - - def serviceModelInfo = execution.getVariable("serviceModelInfo") - logDebug("serviceModelInfo: " + serviceModelInfo, isDebugLogEnabled) - String modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") - logDebug("modelInvariantUuid: " + modelInvariantUuid, isDebugLogEnabled) - - def vnfModelInfo = execution.getVariable("vnfModelInfo") - - //tenantId - def tenantId = execution.getVariable("tenantId") - execution.setVariable("DCVFM_tenantId", tenantId) - rollbackData.put("VFMODULE", "tenantid", tenantId) - //volumeGroupId - def volumeGroupId = execution.getVariable("volumeGroupId") - execution.setVariable("DCVFM_volumeGroupId", volumeGroupId) - //volumeGroupName - def volumeGroupName = execution.getVariable("volumeGroupName") - execution.setVariable("DCVFM_volumeGroupName", volumeGroupName) - //cloudSiteId - def cloudSiteId = execution.getVariable("lcpCloudRegionId") - execution.setVariable("DCVFM_cloudSiteId", cloudSiteId) - rollbackData.put("VFMODULE", "aiccloudregion", cloudSiteId) - logDebug("cloudSiteId: " + cloudSiteId, isDebugLogEnabled) - //vnfType - def vnfType = execution.getVariable("vnfType") - execution.setVariable("DCVFM_vnfType", vnfType) - rollbackData.put("VFMODULE", "vnftype", vnfType) - logDebug("vnfType: " + vnfType, isDebugLogEnabled) - //vnfName - def vnfName = execution.getVariable("vnfName") - execution.setVariable("DCVFM_vnfName", vnfName) - rollbackData.put("VFMODULE", "vnfname", vnfName) - logDebug("vnfName: " + vnfName, isDebugLogEnabled) - //vnfId - def vnfId = execution.getVariable("vnfId") - execution.setVariable("DCVFM_vnfId", vnfId) - rollbackData.put("VFMODULE", "vnfid", vnfId) - logDebug("vnfId: " + vnfId, isDebugLogEnabled) - //vfModuleName - def vfModuleName = execution.getVariable("vfModuleName") - execution.setVariable("DCVFM_vfModuleName", vfModuleName) - rollbackData.put("VFMODULE", "vfmodulename", vfModuleName) - logDebug("vfModuleName: " + vfModuleName, isDebugLogEnabled) - //vfModuleModelName - def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName") - execution.setVariable("DCVFM_vfModuleModelName", vfModuleModelName) - rollbackData.put("VFMODULE", "vfmodulemodelname", vfModuleModelName) - logDebug("vfModuleModelName: " + vfModuleModelName, isDebugLogEnabled) - //modelCustomizationUuid - def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid") - execution.setVariable("DCVFM_modelCustomizationUuid", modelCustomizationUuid) - rollbackData.put("VFMODULE", "modelcustomizationuuid", modelCustomizationUuid) - logDebug("modelCustomizationUuid: " + modelCustomizationUuid, isDebugLogEnabled) - //vfModuleId - def vfModuleId = execution.getVariable("vfModuleId") - execution.setVariable("DCVFM_vfModuleId", vfModuleId) - logDebug("vfModuleId: " + vfModuleId, isDebugLogEnabled) - def requestId = execution.getVariable("msoRequestId") - execution.setVariable("DCVFM_requestId", requestId) - logDebug("requestId: " + requestId, isDebugLogEnabled) - rollbackData.put("VFMODULE", "msorequestid", requestId) - // Set mso-request-id to request-id for VNF Adapter interface - execution.setVariable("mso-request-id", requestId) - //serviceId - def serviceId = execution.getVariable("serviceId") - execution.setVariable("DCVFM_serviceId", serviceId) - logDebug("serviceId: " + serviceId, isDebugLogEnabled) - //serviceInstanceId - def serviceInstanceId = execution.getVariable("serviceInstanceId") - execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId) - rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId) - logDebug("serviceInstanceId: " + serviceInstanceId, isDebugLogEnabled) - //flavorList - ArrayList flavorList = execution.getVariable(cloudSiteId + "_flavorList") - if (flavorList != null) { - execution.setVariable("DCVFM_flavorList", flavorList) - logDebug("flavorList is: " + flavorList, isDebugLogEnabled) - } - //source - HARDCODED - def source = "VID" - execution.setVariable("DCVFM_source", source) - rollbackData.put("VFMODULE", "source", source) - logDebug("source: " + source, isDebugLogEnabled) - //backoutOnFailure - def disableRollback = execution.getVariable("disableRollback") - def backoutOnFailure = true - if (disableRollback != null && disableRollback == true) { - backoutOnFailure = false - } - execution.setVariable("DCVFM_backoutOnFailure", backoutOnFailure) - logDebug("backoutOnFailure: " + backoutOnFailure, isDebugLogEnabled) - //isBaseVfModule - def isBaseVfModule = execution.getVariable("isBaseVfModule") - execution.setVariable("DCVFM_isBaseVfModule", isBaseVfModule) - logDebug("isBaseVfModule: " + isBaseVfModule, isDebugLogEnabled) - //asdcServiceModelVersion - def asdcServiceModelVersion = execution.getVariable("asdcServiceModelVersion") - execution.setVariable("DCVFM_asdcServiceModelVersion", asdcServiceModelVersion) - logDebug("asdcServiceModelVersion: " + asdcServiceModelVersion, isDebugLogEnabled) - //personaModelId - execution.setVariable("DCVFM_personaModelId", jsonUtil.getJsonValue(vfModuleModelInfo, "modelInvariantUuid")) - //personaModelVersion - execution.setVariable("DCVFM_personaModelVersion", jsonUtil.getJsonValue(vfModuleModelInfo, "modelUuid")) - //vfModuleLabel - def vfModuleLabel = execution.getVariable("vfModuleLabel") - if (vfModuleLabel != null) { - execution.setVariable("DCVFM_vfModuleLabel", vfModuleLabel) - logDebug("vfModuleLabel: " + vfModuleLabel, isDebugLogEnabled) - } - //Get or Generate UUID - String uuid = execution.getVariable("DCVFM_uuid") - if(uuid == null){ - uuid = UUID.randomUUID() - logDebug("Generated messageId (UUID) is: " + uuid, isDebugLogEnabled) - }else{ - logDebug("Found messageId (UUID) is: " + uuid, isDebugLogEnabled) - } - //isVidRequest - String isVidRequest = execution.getVariable("isVidRequest") - // default to true - if (isVidRequest == null || isVidRequest.isEmpty()) { - execution.setVariable("isVidRequest", "true") - } - //globalSubscriberId - String globalSubscriberId = execution.getVariable("globalSubscriberId") - execution.setVariable("DCVFM_globalSubscriberId", globalSubscriberId) - logDebug("globalSubsrciberId: " + globalSubscriberId, isDebugLogEnabled) - Map vfModuleInputParams = execution.getVariable("vfModuleInputParams") - if (vfModuleInputParams != null) { - execution.setVariable("DCVFM_vnfParamsMap", vfModuleInputParams) - execution.setVariable("DCVFM_vnfParamsExistFlag", true) - } - //usePreload - def usePreload = execution.getVariable("usePreload") - execution.setVariable("DCVFM_usePreload", usePreload) - logDebug("usePreload: " + usePreload, isDebugLogEnabled) - //aLaCarte - def aLaCarte = execution.getVariable("aLaCarte") - execution.setVariable("DCVFM_aLaCarte", aLaCarte) - logDebug("aLaCarte: " + aLaCarte, isDebugLogEnabled) - - //get workload and environment context from parent SI - String environmentContext = "" - String workloadContext ="" - String serviceType ="" - - try{ - String json = catalog.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) - serviceType = jsonUtil.getJsonValue(json, "serviceResources.serviceType") - }catch(BpmnError e){ - throw e - } catch (Exception ex){ - String msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - - try{ - AAIUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId) - AAIResourcesClient aaiRC = new AAIResourcesClient() - AAIResultWrapper aaiRW = aaiRC.get(serviceInstanceURI) - Map aaiJson = aaiRW.asMap() - environmentContext = aaiJson.getOrDefault("environment-context","") - workloadContext = aaiJson.getOrDefault("workload-context","") - - }catch (Exception ex) { - utils.log("DEBUG","Error retreiving parent service instance information", isDebugLogEnabled) - } - - execution.setVariable("DCVFM_environmentContext",environmentContext) - execution.setVariable("DCVFM_workloadContext",workloadContext) - - } - else { - // The info is inside the request - DEAD CODE - utils.logAudit("DoCreateVfModule request: " + request) - - //tenantId - def tenantId = "" - if (utils.nodeExists(request, "tenant-id")) { - tenantId = utils.getNodeText(request, "tenant-id") - } - execution.setVariable("DCVFM_tenantId", tenantId) - rollbackData.put("VFMODULE", "tenantid", tenantId) - //volumeGroupId - def volumeGroupId = "" - if (utils.nodeExists(request, "volume-group-id")) { - volumeGroupId = utils.getNodeText(request, "volume-group-id") - } - execution.setVariable("DCVFM_volumeGroupId", volumeGroupId) - //volumeGroupId - def volumeGroupName = "" - if (utils.nodeExists(request, "volume-group-name")) { - volumeGroupName = utils.getNodeText(request, "volume-group-name") - } - execution.setVariable("DCVFM_volumeGroupName", volumeGroupName) - //cloudSiteId - def cloudSiteId = "" - if (utils.nodeExists(request, "aic-cloud-region")) { - cloudSiteId = utils.getNodeText(request, "aic-cloud-region") - } - execution.setVariable("DCVFM_cloudSiteId", cloudSiteId) - rollbackData.put("VFMODULE", "aiccloudregion", cloudSiteId) - logDebug("cloudSiteId: " + cloudSiteId, isDebugLogEnabled) - //vnfType - def vnfType = "" - if (utils.nodeExists(request, "vnf-type")) { - vnfType = utils.getNodeText(request, "vnf-type") - } - execution.setVariable("DCVFM_vnfType", vnfType) - rollbackData.put("VFMODULE", "vnftype", vnfType) - logDebug("vnfType: " + vnfType, isDebugLogEnabled) - //vnfName - def vnfName = "" - if (utils.nodeExists(request, "vnf-name")) { - vnfName = utils.getNodeText(request, "vnf-name") - } - execution.setVariable("DCVFM_vnfName", vnfName) - rollbackData.put("VFMODULE", "vnfname", vnfName) - logDebug("vnfName: " + vnfName, isDebugLogEnabled) - //vnfId - def vnfId = "" - if (utils.nodeExists(request, "vnf-id")) { - vnfId = utils.getNodeText(request, "vnf-id") - } - execution.setVariable("DCVFM_vnfId", vnfId) - rollbackData.put("VFMODULE", "vnfid", vnfId) - logDebug("vnfId: " + vnfId, isDebugLogEnabled) - //vfModuleName - def vfModuleName = "" - if (utils.nodeExists(request, "vf-module-name")) { - vfModuleName = utils.getNodeText(request, "vf-module-name") - } - execution.setVariable("DCVFM_vfModuleName", vfModuleName) - rollbackData.put("VFMODULE", "vfmodulename", vfModuleName) - logDebug("vfModuleName: " + vfModuleName, isDebugLogEnabled) - //vfModuleModelName - def vfModuleModelName = "" - if (utils.nodeExists(request, "vf-module-model-name")) { - vfModuleModelName = utils.getNodeText(request, "vf-module-model-name") - } - execution.setVariable("DCVFM_vfModuleModelName", vfModuleModelName) - rollbackData.put("VFMODULE", "vfmodulemodelname", vfModuleModelName) - logDebug("vfModuleModelName: " + vfModuleModelName, isDebugLogEnabled) - //modelCustomizationUuid - def modelCustomizationUuid = "" - if (utils.nodeExists(request, "model-customization-id")) { - modelCustomizationUuid = utils.getNodeText(request, "model-customization-id") - } - execution.setVariable("DCVFM_modelCustomizationUuid", modelCustomizationUuid) - rollbackData.put("VFMODULE", "modelcustomizationuuid", modelCustomizationUuid) - logDebug("modelCustomizationUuid: " + modelCustomizationUuid, isDebugLogEnabled) - //vfModuleId - def vfModuleId = "" - if (utils.nodeExists(request, "vf-module-id")) { - vfModuleId = utils.getNodeText(request, "vf-module-id") - } - execution.setVariable("DCVFM_vfModuleId", vfModuleId) - logDebug("vfModuleId: " + vfModuleId, isDebugLogEnabled) - def requestId = "" - if (utils.nodeExists(request, "request-id")) { - requestId = utils.getNodeText(request, "request-id") - } - execution.setVariable("DCVFM_requestId", requestId) - logDebug("requestId: " + requestId, isDebugLogEnabled) - //serviceId - def serviceId = "" - if (utils.nodeExists(request, "service-id")) { - serviceId = utils.getNodeText(request, "service-id") - } - execution.setVariable("DCVFM_serviceId", serviceId) - logDebug("serviceId: " + serviceId, isDebugLogEnabled) - //serviceInstanceId - def serviceInstanceId = "" - if (utils.nodeExists(request, "service-instance-id")) { - serviceInstanceId = utils.getNodeText(request, "service-instance-id") - } - execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId) - rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId) - logDebug("serviceInstanceId: " + serviceInstanceId, isDebugLogEnabled) - //source - def source = "" - if (utils.nodeExists(request, "source")) { - source = utils.getNodeText(request, "source") - } - execution.setVariable("DCVFM_source", source) - rollbackData.put("VFMODULE", "source", source) - logDebug("source: " + source, isDebugLogEnabled) - //backoutOnFailure - NetworkUtils networkUtils = new NetworkUtils() - def backoutOnFailure = networkUtils.isRollbackEnabled(execution,request) - execution.setVariable("DCVFM_backoutOnFailure", backoutOnFailure) - logDebug("backoutOnFailure: " + backoutOnFailure, isDebugLogEnabled) - //isBaseVfModule - def isBaseVfModule = "false" - if (utils.nodeExists(request, "is-base-vf-module")) { - isBaseVfModule = utils.getNodeText(request, "is-base-vf-module") - } - execution.setVariable("DCVFM_isBaseVfModule", isBaseVfModule) - logDebug("isBaseVfModule: " + isBaseVfModule, isDebugLogEnabled) - //asdcServiceModelVersion - def asdcServiceModelVersion = "" - if (utils.nodeExists(request, "asdc-service-model-version")) { - asdcServiceModelVersion = utils.getNodeText(request, "asdc-service-model-version") - } - execution.setVariable("DCVFM_asdcServiceModelVersion", asdcServiceModelVersion) - logDebug("asdcServiceModelVersion: " + asdcServiceModelVersion, isDebugLogEnabled) - - //personaModelId - def personaModelId = "" - if (utils.nodeExists(request, "persona-model-id")) { - personaModelId = utils.getNodeText(request, "persona-model-id") - } - execution.setVariable("DCVFM_personaModelId", personaModelId) - logDebug("personaModelId: " + personaModelId, isDebugLogEnabled) - - //personaModelVersion - def personaModelVersion = "" - if (utils.nodeExists(request, "persona-model-version")) { - personaModelVersion = utils.getNodeText(request, "persona-model-version") - } - execution.setVariable("DCVFM_personaModelVersion", personaModelVersion) - logDebug("personaModelVersion: " + personaModelVersion, isDebugLogEnabled) - - // Process the parameters - - String vnfParamsChildNodes = utils.getChildNodes(request, "vnf-params") - if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ - utils.log("DEBUG", "Request contains NO VNF Params", isDebugLogEnabled) - }else{ - utils.log("DEBUG", "Request does contain VNF Params", isDebugLogEnabled) - execution.setVariable("DCVFM_vnfParamsExistFlag", true) - - InputSource xmlSource = new InputSource(new StringReader(request)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docFactory.setNamespaceAware(true) - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document xml = docBuilder.parse(xmlSource) - //Get params, build map - Map paramsMap = new HashMap() - NodeList paramsList = xml.getElementsByTagNameNS("*", "param") - - for (int z = 0; z < paramsList.getLength(); z++) { - Node node = paramsList.item(z) - String paramValue = node.getTextContent() - NamedNodeMap e = node.getAttributes() - String paramName = e.getNamedItem("name").getTextContent() - paramsMap.put(paramName, paramValue) - } - execution.setVariable("DCVFM_vnfParamsMap", paramsMap) - } - } - - //Get or Generate UUID - String uuid = execution.getVariable("DCVFM_uuid") - if(uuid == null){ - uuid = UUID.randomUUID() - logDebug("Generated messageId (UUID) is: " + uuid, isDebugLogEnabled) - }else{ - logDebug("Found messageId (UUID) is: " + uuid, isDebugLogEnabled) - } - // Get sdncVersion, default to empty - String sdncVersion = execution.getVariable("sdncVersion") - if (sdncVersion == null) { - sdncVersion = "" - } - logDebug("sdncVersion: " + sdncVersion, isDebugLogEnabled) - execution.setVariable("DCVFM_sdncVersion", sdncVersion) - - execution.setVariable("DCVFM_uuid", uuid) - execution.setVariable("DCVFM_baseVfModuleId", "") - execution.setVariable("DCVFM_baseVfModuleHeatStackId", "") - execution.setVariable("DCVFM_heatStackId", "") - execution.setVariable("DCVFM_contrailServiceInstanceFqdn", "") - execution.setVariable("DCVFM_volumeGroupStackId", "") - execution.setVariable("DCVFM_cloudRegionForVolume", "") - execution.setVariable("DCVFM_contrailNetworkPolicyFqdnList", "") - execution.setVariable("DCVFM_vnfTypeToQuery", "generic-vnf") - rollbackData.put("VFMODULE", "rollbackPrepareUpdateVfModule", "false") - rollbackData.put("VFMODULE", "rollbackUpdateAAIVfModule", "false") - rollbackData.put("VFMODULE", "rollbackVnfAdapterCreate", "false") - rollbackData.put("VFMODULE", "rollbackSDNCRequestActivate", "false") - rollbackData.put("VFMODULE", "rollbackSDNCRequestAssign", "false") - rollbackData.put("VFMODULE", "rollbackCreateAAIVfModule", "false") - rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "false") - rollbackData.put("VFMODULE", "rollbackUpdateVnfAAI", "false") - rollbackData.put("VFMODULE", "heatstackid", "") - - String sdncCallbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { - def msg = 'Required variable \'URN_mso_workflow_sdncadapter_callback\' is missing' - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - execution.setVariable("DCVFM_sdncCallbackUrl", sdncCallbackUrl) - utils.logAudit("SDNC Callback URL: " + sdncCallbackUrl) - logDebug("SDNC Callback URL is: " + sdncCallbackUrl, isDebugLogEnabled) - - - execution.setVariable("rollbackData", rollbackData) - }catch(BpmnError b){ - throw b - }catch(Exception e){ - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!") - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } - - /** - * Validates a workflow response. - * @param execution the execution - * @param responseVar the execution variable in which the response is stored - * @param responseCodeVar the execution variable in which the response code is stored - * @param errorResponseVar the execution variable in which the error response is stored - */ - public void validateWorkflowResponse(DelegateExecution execution, String responseVar, - String responseCodeVar, String errorResponseVar) { - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, responseVar, responseCodeVar, errorResponseVar) - } - - - /** - * Sends the empty, synchronous response back to the API Handler. - * @param execution the execution - */ - public void sendResponse(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sendResponse(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - sendWorkflowResponse(execution, 200, "") - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Internal Error') - } - } - - /** - * Using the received vnfId and vfModuleId, query AAI to get the corresponding VNF info. - * A 200 response is expected with the VNF info in the response body. Will find out the base module info - * and existing VNF's name for add-on modules - * - * @param execution The flow's execution instance. - */ - public void postProcessCreateAAIVfModule(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.getVfModule(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def createResponse = execution.getVariable('DCVFM_createVfModuleResponse') - utils.logAudit("createVfModule Response: " + createResponse) - - def rollbackData = execution.getVariable("rollbackData") - String vnfName = utils.getNodeText1(createResponse, 'vnf-name') - if (vnfName != null) { - execution.setVariable('DCVFM_vnfName', vnfName) - logDebug("vnfName retrieved from AAI is: " + vnfName, isDebugLogEnabled) - rollbackData.put("VFMODULE", "vnfname", vnfName) - } - String vnfId = utils.getNodeText1(createResponse, 'vnf-id') - execution.setVariable('DCVFM_vnfId', vnfId) - logDebug("vnfId is: " + vnfId, isDebugLogEnabled) - String vfModuleId = utils.getNodeText1(createResponse, 'vf-module-id') - execution.setVariable('DCVFM_vfModuleId', vfModuleId) - logDebug("vfModuleId is: " + vfModuleId, isDebugLogEnabled) - String vfModuleIndex= utils.getNodeText1(createResponse, 'vf-module-index') - execution.setVariable('DCVFM_vfModuleIndex', vfModuleIndex) - logDebug("vfModuleIndex is: " + vfModuleIndex, isDebugLogEnabled) - rollbackData.put("VFMODULE", "vnfid", vnfId) - rollbackData.put("VFMODULE", "vfmoduleid", vfModuleId) - rollbackData.put("VFMODULE", "rollbackCreateAAIVfModule", "true") - rollbackData.put("VFMODULE", "rollbackPrepareUpdateVfModule", "true") - execution.setVariable("rollbackData", rollbackData) - } catch (Exception ex) { - ex.printStackTrace() - logDebug('Exception occurred while postProcessing CreateAAIVfModule request:' + ex.getMessage(),isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Bad response from CreateAAIVfModule' + ex.getMessage()) - } - logDebug('Exited ' + method, isDebugLogEnabled) - } - - - /** - * Using the received vnfId and vfModuleId, query AAI to get the corresponding VNF info. - * A 200 response is expected with the VNF info in the response body. Will find out the base module info. - * - * @param execution The flow's execution instance. - */ - public void queryAAIVfModule(DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - def method = getClass().getSimpleName() + '.getVfModule(' + - 'execution=' + execution.getId() + - ')' - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def vnfId = execution.getVariable('DCVFM_vnfId') - def vfModuleId = execution.getVariable('DCVFM_vfModuleId') - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - - String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" - utils.logAudit("AAI endPoint: " + endPoint) - - try { - RESTConfig config = new RESTConfig(endPoint); - def responseData = '' - def aaiRequestId = UUID.randomUUID().toString() - RESTClient client = new RESTClient(config). - addHeader('X-TransactionId', aaiRequestId). - addHeader('X-FromAppId', 'MSO'). - addHeader('Content-Type', 'application/xml'). - addHeader('Accept','application/xml'); - logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) - APIResponse response = client.httpGet() - utils.logAudit("createVfModule - invoking httpGet() to AAI") - - responseData = response.getResponseBodyAsString() - if (responseData != null) { - logDebug("Received generic VNF data: " + responseData, isDebugLogEnabled) - - } - - utils.logAudit("createVfModule - queryAAIVfModule Response: " + responseData) - utils.logAudit("createVfModule - queryAAIVfModule ResponseCode: " + response.getStatusCode()) - - execution.setVariable('DCVFM_queryAAIVfModuleResponseCode', response.getStatusCode()) - execution.setVariable('DCVFM_queryAAIVfModuleResponse', responseData) - logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) - logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) - if (response.getStatusCode() == 200) { - // Parse the VNF record from A&AI to find base module info - logDebug('Parsing the VNF data to find base module info', isDebugLogEnabled) - if (responseData != null) { - def vfModulesText = utils.getNodeXml(responseData, "vf-modules") - def xmlVfModules= new XmlSlurper().parseText(vfModulesText) - def vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} - int vfModulesSize = 0 - for (i in 0..vfModules.size()-1) { - def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i]) - def isBaseVfModule = utils.getNodeText(vfModuleXml, "is-base-vf-module") - - if (isBaseVfModule == "true") { - String baseModuleId = utils.getNodeText1(vfModuleXml, "vf-module-id") - execution.setVariable("DCVFM_baseVfModuleId", baseModuleId) - logDebug('Received baseVfModuleId: ' + baseModuleId, isDebugLogEnabled) - String baseModuleHeatStackId = utils.getNodeText1(vfModuleXml, "heat-stack-id") - execution.setVariable("DCVFM_baseVfModuleHeatStackId", baseModuleHeatStackId) - logDebug('Received baseVfModuleHeatStackId: ' + baseModuleHeatStackId, isDebugLogEnabled) - } - } - } - } - } catch (Exception ex) { - ex.printStackTrace() - logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) - } - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) - } - } - - /** - * Using the vnfId and vfModuleName provided in the inputs, - * query AAI to get the corresponding VF Module info. - * A 200 response is expected with the VF Module info in the response body, - * or a 404 response if the module does not exist yet. Will determine VF Module's - * orchestration status if one exists - * - * @param execution The flow's execution instance. - */ - public void queryAAIVfModuleForStatus(DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' + - 'execution=' + execution.getId() + - ')' - logDebug('Entered ' + method, isDebugLogEnabled) - - execution.setVariable('DCVFM_orchestrationStatus', '') - - try { - def vnfId = execution.getVariable('DCVFM_vnfId') - def vfModuleName = execution.getVariable('DCVFM_vfModuleName') - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - - String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + - "/vf-modules/vf-module?vf-module-name=" + UriUtils.encode(vfModuleName, "UTF-8") - utils.logAudit("AAI endPoint: " + endPoint) - - try { - RESTConfig config = new RESTConfig(endPoint); - def responseData = '' - def aaiRequestId = UUID.randomUUID().toString() - RESTClient client = new RESTClient(config). - addHeader('X-TransactionId', aaiRequestId). - addHeader('X-FromAppId', 'MSO'). - addHeader('Content-Type', 'application/xml'). - addHeader('Accept','application/xml'); - logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) - APIResponse response = client.httpGet() - utils.logAudit("createVfModule - invoking httpGet() to AAI") - - responseData = response.getResponseBodyAsString() - if (responseData != null) { - logDebug("Received generic VNF data: " + responseData, isDebugLogEnabled) - - } - - utils.logAudit("createVfModule - queryAAIVfModule Response: " + responseData) - utils.logAudit("createVfModule - queryAAIVfModule ResponseCode: " + response.getStatusCode()) - - execution.setVariable('DCVFM_queryAAIVfModuleForStatusResponseCode', response.getStatusCode()) - execution.setVariable('DCVFM_queryAAIVfModuleForStatusResponse', responseData) - logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) - logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) - // Retrieve VF Module info and its orchestration status; if not found, do nothing - if (response.getStatusCode() == 200) { - // Parse the VNF record from A&AI to find base module info - logDebug('Parsing the VNF data to find orchestration status', isDebugLogEnabled) - if (responseData != null) { - def vfModuleText = utils.getNodeXml(responseData, "vf-module") - //def xmlVfModule= new XmlSlurper().parseText(vfModuleText) - def orchestrationStatus = utils.getNodeText1(vfModuleText, "orchestration-status") - execution.setVariable("DCVFM_orchestrationStatus", orchestrationStatus) - // Also retrieve vfModuleId - def vfModuleId = utils.getNodeText1(vfModuleText, "vf-module-id") - execution.setVariable("DCVFM_vfModuleId", vfModuleId) - logDebug("Received orchestration status from A&AI: " + orchestrationStatus, isDebugLogEnabled) - - } - } - } catch (Exception ex) { - ex.printStackTrace() - logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) - } - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage()) - } - } - - - public void preProcessSDNCAssignRequest(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) - def vnfId = execution.getVariable("DCVFM_vnfId") - def vfModuleId = execution.getVariable("DCVFM_vfModuleId") - def serviceInstanceId = execution.getVariable("DCVFM_serviceInstanceId") - logDebug("NEW VNF ID: " + vnfId, isDebugLogEnabled) - utils.logAudit("NEW VNF ID: " + vnfId) - - try{ - - //Build SDNC Request - - def svcInstId = "" - if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { - svcInstId = vfModuleId - } - else { - svcInstId = serviceInstanceId - } - - String assignSDNCRequest = buildSDNCRequest(execution, svcInstId, "assign") - - assignSDNCRequest = utils.formatXml(assignSDNCRequest) - execution.setVariable("DCVFM_assignSDNCRequest", assignSDNCRequest) - logDebug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest, isDebugLogEnabled) - utils.logAudit("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessSDNCAssignRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) - } - - public void preProcessSDNCGetRequest(DelegateExecution execution, String element){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - String sdncVersion = execution.getVariable("DCVFM_sdncVersion") - execution.setVariable("prefix", Prefix) - utils.log("DEBUG", " ======== STARTED preProcessSDNCGetRequest Process ======== ", isDebugLogEnabled) - try{ - def serviceInstanceId = execution.getVariable('DCVFM_serviceInstanceId') - - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() - } - - def callbackUrl = execution.getVariable("DCVFM_sdncCallbackUrl") - utils.logAudit("callbackUrl:" + callbackUrl) - - def vfModuleId = execution.getVariable('DCVFM_vfModuleId') - - def svcInstId = "" - if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { - svcInstId = vfModuleId - } - else { - svcInstId = serviceInstanceId - } - - def msoAction = "" - if (!sdncVersion.equals("1707")) { - msoAction = "mobility" - } - else { - msoAction = "vfmodule" - } - // For VNF, serviceOperation (URI for topology GET) will be retrieved from "selflink" element - // in the response from GenericGetVnf - // For VF Module, in 1707 serviceOperation will be retrieved from "object-path" element - // in SDNC Assign Response - // For VF Module for older versions, serviceOperation is constructed using vfModuleId - - String serviceOperation = "" - if (element.equals("vnf")) { - def vnfQueryResponse = execution.getVariable("DCVFM_vnfQueryResponse") - serviceOperation = utils.getNodeText1(vnfQueryResponse, "selflink") - utils.log("DEBUG", "VNF - service operation: " + serviceOperation, isDebugLogEnabled) - } - else if (element.equals("vfmodule")) { - String response = execution.getVariable("DCVFM_assignSDNCAdapterResponse") - utils.logAudit("DCVFM_assignSDNCAdapterResponse is: \n" + response) - - if (!sdncVersion.equals("1707")) { - serviceOperation = "/VNF-API:vnfs/vnf-list/" + vfModuleId - utils.log("DEBUG", "VF Module with sdncVersion before 1707 - service operation: " + serviceOperation, isDebugLogEnabled) - } - else { - String data = utils.getNodeXml(response, "response-data") - data = data.replaceAll("<", "<") - data = data.replaceAll(">", ">") - utils.log("DEBUG", "responseData: " + data, isDebugLogEnabled) - serviceOperation = utils.getNodeText1(data, "object-path") - utils.log("DEBUG", "VF Module with sdncVersion of 1707 - service operation: " + serviceOperation, isDebugLogEnabled) - } - } - - //!!!! TEMPORARY WORKAROUND FOR SDNC REPLICATION ISSUE - sleep(5000) - - String SDNCGetRequest = - """ - - ${uuid} - ${svcInstId} - query - ${serviceOperation} - ${callbackUrl} - ${msoAction} - - - """ - - utils.logAudit("SDNCGetRequest: \n" + SDNCGetRequest) - execution.setVariable("DCVFM_getSDNCRequest", SDNCGetRequest) - utils.log("DEBUG", "Outgoing GetSDNCRequest is: \n" + SDNCGetRequest, isDebugLogEnabled) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occurred Processing preProcessSDNCGetRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) - } - utils.log("DEBUG", "======== COMPLETED preProcessSDNCGetRequest Process ======== ", isDebugLogEnabled) - } - - - public void preProcessVNFAdapterRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.VNFAdapterCreateVfModule(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - //def xml = execution.getVariable("DoCreateVfModuleRequest") - //logDebug('VNF REQUEST is: ' + xml, isDebugLogEnabled) - - //Get variables - //cloudSiteId - def cloudSiteId = execution.getVariable("DCVFM_cloudSiteId") - //tenantId - def tenantId = execution.getVariable("DCVFM_tenantId") - //vnfType - def vnfType = execution.getVariable("DCVFM_vnfType") - //vnfName - def vnfName = execution.getVariable("DCVFM_vnfName") - //vnfId - def vnfId = execution.getVariable("DCVFM_vnfId") - //vfModuleName - def vfModuleName = execution.getVariable("DCVFM_vfModuleName") - //vfModuleModelName - def vfModuleModelName = execution.getVariable("DCVFM_vfModuleModelName") - //vfModuleId - def vfModuleId = execution.getVariable("DCVFM_vfModuleId") - //vfModuleIndex - def vfModuleIndex = execution.getVariable("DCVFM_vfModuleIndex") - //requestId - def requestId = execution.getVariable("DCVFM_requestId") - //serviceId - def serviceId = execution.getVariable("DCVFM_serviceId") - //serviceInstanceId - def serviceInstanceId = execution.getVariable("DCVFM_serviceInstanceId") - //flavorList - ArrayList flavorList = execution.getVariable("DCVFM_flavorList") - //backoutOnFailure - def backoutOnFailure = execution.getVariable("DCVFM_backoutOnFailure") - //volumeGroupId - def volumeGroupId = execution.getVariable("DCVFM_volumeGroupId") - // baseVfModuleId - def baseVfModuleId = execution.getVariable("DCVFM_baseVfModuleId") - // baseVfModuleStackId - def baseVfModuleStackId = execution.getVariable("DCVFM_baseVfModuleHeatStackId") - // asdcServiceModelVersion - def asdcServiceModelVersion = execution.getVariable("DCVFM_asdcServiceModelVersion") - //volumeGroupStackId - def volumeGroupStackId = execution.getVariable("DCVFM_volumeGroupStackId") - //modelCustomizationUuid - def modelCustomizationUuid = execution.getVariable("DCVFM_modelCustomizationUuid") - //environmentContext - String environmentContext = execution.getVariable("DCVFM_environmentContext") - //workloadContext - String workloadContext = execution.getVariable("DCVFM_workloadContext") - logDebug("workloadContext: " + workloadContext, isDebugLogEnabled) - logDebug("environmentContext: " + environmentContext, isDebugLogEnabled) - - def messageId = execution.getVariable('mso-request-id') + '-' + - System.currentTimeMillis() - - def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) - def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") - - utils.logAudit("notificationUrl: " + notificationUrl) - utils.logAudit("QualifiedHostName: " + useQualifiedHostName) - - if ('true'.equals(useQualifiedHostName)) { - notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) - } - - Map vnfParamsMap = execution.getVariable("DCVFM_vnfParamsMap") - // Add flavorLabel List to vnfParamsMap - flavorList.each { cloudFlavor -> - vnfParamsMap.put("label_" + cloudFlavor.getFlavorLabel(), cloudFlavor.getFlavor()) - } - String vfModuleParams = "" - //Get SDNC Response Data for VF Module Topology - String vfModuleSdncGetResponse = execution.getVariable('DCVFM_getSDNCAdapterResponse') - utils.logAudit("sdncGetResponse: " + vfModuleSdncGetResponse) - def sdncVersion = execution.getVariable("sdncVersion") - - if (!sdncVersion.equals("1707")) { - - vfModuleParams = buildVfModuleParams(vnfParamsMap, vfModuleSdncGetResponse, vnfId, vnfName, - vfModuleId, vfModuleName, vfModuleIndex, environmentContext, workloadContext) - } - else { - //Get SDNC Response Data for Vnf Topology - String vnfSdncGetResponse = execution.getVariable('DCVFM_getVnfSDNCAdapterResponse') - utils.logAudit("vnfSdncGetResponse: " + vnfSdncGetResponse) - - vfModuleParams = buildVfModuleParamsFromCombinedTopologies(vnfParamsMap, vnfSdncGetResponse, vfModuleSdncGetResponse, vnfId, vnfName, - vfModuleId, vfModuleName, vfModuleIndex, environmentContext, workloadContext) - } - - def svcInstId = "" - if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { - svcInstId = serviceId - } - else { - svcInstId = serviceInstanceId - } - - def createVnfARequest = """ - - ${cloudSiteId} - ${tenantId} - ${vnfId} - ${vnfName} - ${vfModuleName} - ${vfModuleId} - ${vnfType} - ${vfModuleModelName} - ${asdcServiceModelVersion} - ${modelCustomizationUuid} - - ${volumeGroupId} - ${volumeGroupStackId} - ${baseVfModuleId} - ${baseVfModuleStackId} - true - ${backoutOnFailure} - true - - ${vfModuleParams} - - - ${requestId} - ${svcInstId} - - ${messageId} - ${notificationUrl} - """ - - utils.logAudit("Create VfModule Request to VNF Adapter : " + createVnfARequest) - logDebug("Create VfModule Request to VNF Adapter: " + createVnfARequest, isDebugLogEnabled) - execution.setVariable("DCVFM_createVnfARequest", createVnfARequest) - } - - /** - * Validates the request, request id and service instance id. If a problem is found, - * a WorkflowException is generated and an MSOWorkflowException event is thrown. This - * method also sets up the log context for the workflow. - * @param execution the execution - * @return the validated request - */ - public String validateInfraRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.validateInfraRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String processKey = getProcessKey(execution); - def prefix = execution.getVariable("prefix") - - if (prefix == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null") - } - - try { - def request = execution.getVariable(prefix + 'Request') - - if (request == null) { - request = execution.getVariable(processKey + 'Request') - - if (request == null) { - request = execution.getVariable('bpmnRequest') - } - - setVariable(execution, processKey + 'Request', null); - setVariable(execution, 'bpmnRequest', null); - setVariable(execution, prefix + 'Request', request); - } - - if (request == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null") - } - utils.logAudit("DoCreateVfModule Request: " + request) - - /* - - def requestId = execution.getVariable("mso-request-id") - - if (requestId == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request has no mso-request-id") - } - - def serviceInstanceId = execution.getVariable("mso-service-instance-id") - - if (serviceInstanceId == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id") - } - - utils.logContext(requestId, serviceInstanceId) - */ - logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled) - logDebug('Exited ' + method, isDebugLogEnabled) - return request - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") - } - } - - public boolean isVolumeGroupIdPresent(DelegateExecution execution) { - - def method = getClass().getSimpleName() + '.isVolumeGroupIdPresent(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - def request = execution.getVariable('DoCreateVfModuleRequest') - String volumeGroupId = utils.getNodeText1(request, "volume-group-id") - if (volumeGroupId == null || volumeGroupId.isEmpty()) { - logDebug('No volume group id is present', isDebugLogEnabled) - return false - } - else { - logDebug('Volume group id is present', isDebugLogEnabled) - return true - } - - } - - public boolean isVolumeGroupNamePresent(DelegateExecution execution) { - - def method = getClass().getSimpleName() + '.isVolumeGroupNamePresent(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - def request = execution.getVariable('DoCreateVfModuleRequest') - String volumeGroupName = utils.getNodeText1(request, "volume-group-name") - if (volumeGroupName == null || volumeGroupName.isEmpty()) { - logDebug('No volume group name is present', isDebugLogEnabled) - return false - } - else { - logDebug('Volume group name is present', isDebugLogEnabled) - return true - } - - } - - public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ - - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() - } - def callbackURL = execution.getVariable("DCVFM_sdncCallbackUrl") - def requestId = execution.getVariable("DCVFM_requestId") - def serviceId = execution.getVariable("DCVFM_serviceId") - def vnfType = execution.getVariable("DCVFM_vnfType") - def vnfName = execution.getVariable("DCVFM_vnfName") - def tenantId = execution.getVariable("DCVFM_tenantId") - def source = execution.getVariable("DCVFM_source") - def backoutOnFailure = execution.getVariable("DCVFM_backoutOnFailure") - def vfModuleId = execution.getVariable("DCVFM_vfModuleId") - def vfModuleName = execution.getVariable("DCVFM_vfModuleName") - def vfModuleModelName = execution.getVariable("DCVFM_vfModuleModelName") - def vnfId = execution.getVariable("DCVFM_vnfId") - def cloudSiteId = execution.getVariable("DCVFM_cloudSiteId") - def sdncVersion = execution.getVariable("DCVFM_sdncVersion") - def serviceModelInfo = execution.getVariable("serviceModelInfo") - def vnfModelInfo = execution.getVariable("vnfModelInfo") - def vfModuleModelInfo = execution.getVariable("vfModuleModelInfo") - String serviceEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(serviceModelInfo) - String vnfEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(vnfModelInfo) - String vfModuleEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(vfModuleModelInfo) - def globalSubscriberId = execution.getVariable("DCVFM_globalSubscriberId") - boolean usePreload = execution.getVariable("DCVFM_usePreload") - String usePreloadToSDNC = usePreload ? "Y" : "N" - def modelCustomizationUuid = execution.getVariable("DCVFM_modelCustomizationUuid") - def modelCustomizationUuidString = "" - if (!usePreload) { - modelCustomizationUuidString = "" + modelCustomizationUuid + "" - } - - String sdncVNFParamsXml = "" - - if(execution.getVariable("DCVFM_vnfParamsExistFlag") == true){ - sdncVNFParamsXml = buildSDNCParamsXml(execution) - }else{ - sdncVNFParamsXml = "" - } - - String sdncRequest = "" - - if (!sdncVersion.equals("1707")) { - - sdncRequest = - """ - - ${uuid} - ${svcInstId} - ${action} - vnf-topology-operation - ${callbackURL} - - - - ${requestId} - VNFActivateRequest - ${source} - - - - ${serviceId} - ${serviceId} - ${svcInstId} - notsurewecare - - - ${vfModuleId} - ${vfModuleModelName} - ${vfModuleName} - ${vnfId} - ${vnfName} - ${vnfType} - ${cloudSiteId} - ${tenantId} - ${modelCustomizationUuidString} - ${usePreloadToSDNC} - ${sdncVNFParamsXml} - - - """ - - } - else { - - sdncRequest = - """ - - ${uuid} - ${svcInstId} - ${action} - vf-module-topology-operation - ${callbackURL} - generic-resource - - - - ${requestId} - CreateVfModuleInstance - ${source} - - - - ${serviceId} - ${serviceId} - ${serviceEcompModelInformation} - ${svcInstId} - ${globalSubscriberId} - - - ${vnfId} - ${vnfType} - ${vnfEcompModelInformation} - - - ${vfModuleId} - ${vfModuleModelName} - ${vfModuleEcompModelInformation} - - - ${vfModuleName} - ${tenantId} - ${cloudSiteId} - ${sdncVNFParamsXml} - - - """ - - - /* - sdncRequest = - """ - - ${requestId} - ${svcInstId} - ${action} - vnf-topology-operation - ${callbackURL} - - - - ${requestId} - CreateVfModuleInstance - ${source} - - - - ${serviceId} - ${serviceId} - ${serviceEcompModelInformation} - ${svcInstId} - ${globalSubscriberId} - - - ${vnfId} - ${vnfType} - ${vnfEcompModelInformation} - - - ${vfModuleId} - ${vfModuleModelName} - ${vfModuleEcompModelInformation} - - - ${vfModuleName} - ${tenantId} - ${cloudSiteId} - ${sdncVNFParamsXml} - - - """ - */ - - } - - utils.logAudit("sdncRequest: " + sdncRequest) - return sdncRequest - - } - - public void preProcessSDNCActivateRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled) - try{ - String vnfId = execution.getVariable("DCVFM_vnfId") - String vfModuleId = execution.getVariable("DCVFM_vfModuleId") - String serviceInstanceId = execution.getVariable("DCVFM_serviceInstanceId") - - def svcInstId = "" - if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { - svcInstId = vfModuleId - } - else { - svcInstId = serviceInstanceId - } - String activateSDNCRequest = buildSDNCRequest(execution, svcInstId, "activate") - - execution.setVariable("DCVFM_activateSDNCRequest", activateSDNCRequest) - logDebug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest, isDebugLogEnabled) - utils.logAudit("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest) - - }catch(Exception e){ - log.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled) - } - - public void postProcessVNFAdapterRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix",Prefix) - try{ - logDebug(" *** STARTED postProcessVNFAdapterRequest Process*** ", isDebugLogEnabled) - - String vnfResponse = execution.getVariable("DCVFM_createVnfAResponse") - logDebug("VNF Adapter Response is: " + vnfResponse, isDebugLogEnabled) - utils.logAudit("createVnfAResponse is: \n" + vnfResponse) - - RollbackData rollbackData = execution.getVariable("rollbackData") - if(vnfResponse != null){ - - if(vnfResponse.contains("createVfModuleResponse")){ - logDebug("Received a Good Response from VNF Adapter for CREATE_VF_MODULE Call.", isDebugLogEnabled) - execution.setVariable("DCVFM_vnfVfModuleCreateCompleted", true) - String heatStackId = utils.getNodeText1(vnfResponse, "vfModuleStackId") - execution.setVariable("DCVFM_heatStackId", heatStackId) - logDebug("Received heat stack id from VNF Adapter: " + heatStackId, isDebugLogEnabled) - rollbackData.put("VFMODULE", "heatstackid", heatStackId) - // Parse vnfOutputs for network_fqdn - if (vnfResponse.contains("vfModuleOutputs")) { - def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs") - InputSource source = new InputSource(new StringReader(vfModuleOutputsXml)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docFactory.setNamespaceAware(true) - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document outputsXml = docBuilder.parse(source) - - NodeList entries = outputsXml.getElementsByTagNameNS("*", "entry") - List contrailNetworkPolicyFqdnList = [] - for (int i = 0; i< entries.getLength(); i++) { - Node node = entries.item(i) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element element = (Element) node - String key = element.getElementsByTagNameNS("*", "key").item(0).getTextContent() - if (key.equals("contrail-service-instance-fqdn")) { - String contrailServiceInstanceFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - logDebug("Obtained contrailServiceInstanceFqdn: " + contrailServiceInstanceFqdn, isDebugLogEnabled) - execution.setVariable("DCVFM_contrailServiceInstanceFqdn", contrailServiceInstanceFqdn) - } - else if (key.endsWith("contrail_network_policy_fqdn")) { - String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - logDebug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn, isDebugLogEnabled) - contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn) - } - else if (key.equals("oam_management_v4_address")) { - String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - logDebug("Obtained oamManagementV4Address: " + oamManagementV4Address, isDebugLogEnabled) - execution.setVariable("DCVFM_oamManagementV4Address", oamManagementV4Address) - } - else if (key.equals("oam_management_v6_address")) { - String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - logDebug("Obtained oamManagementV6Address: " + oamManagementV6Address, isDebugLogEnabled) - execution.setVariable("DCVFM_oamManagementV6Address", oamManagementV6Address) - } - - } - } - if (!contrailNetworkPolicyFqdnList.isEmpty()) { - execution.setVariable("DCVFM_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList) - } - } - }else{ - logDebug("Received a BAD Response from VNF Adapter for CREATE_VF_MODULE Call.", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error") - } - }else{ - logDebug("Response from VNF Adapter is Null for CREATE_VF_MODULE Call.", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter") - } - - rollbackData.put("VFMODULE", "rollbackVnfAdapterCreate", "true") - execution.setVariable("rollbackData", rollbackData) - - }catch(BpmnError b){ - throw b - }catch(Exception e){ - logDebug("Internal Error Occured in PostProcess Method", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method") - } - logDebug(" *** COMPLETED postProcessVnfAdapterResponse Process*** ", isDebugLogEnabled) - } - - - public void preProcessUpdateAAIVfModuleRequestOrch(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessUpdateAAIVfModuleRequestOrch(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessUpdateAAIVfModuleRequestOrch ======== ", isDebugLogEnabled) - - try{ - - //Build UpdateAAIVfModule Request - boolean setContrailServiceInstanceFqdn = false - def contrailServiceInstanceFqdn = execution.getVariable("DCVFM_contrailServiceInstanceFqdn") - if (!contrailServiceInstanceFqdn.equals("")) { - setContrailServiceInstanceFqdn = true - } - - execution.setVariable("DCVFM_orchestrationStatus", "Created") - - String updateAAIVfModuleRequest = buildUpdateAAIVfModuleRequest(execution, false, true, true, setContrailServiceInstanceFqdn) - - updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest) - execution.setVariable("DCVFM_updateAAIVfModuleRequest", updateAAIVfModuleRequest) - logDebug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest, isDebugLogEnabled) - utils.logAudit("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessUpdateAAIVfModuleRequestOrch. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestOrch Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessUpdateAAIVfModuleRequestOrch ======== ", isDebugLogEnabled) - - } - - public void preProcessUpdateAAIVfModuleRequestStatus(DelegateExecution execution, String status) { - def method = getClass().getSimpleName() + '.preProcessUpdateAAIVfModuleStatus(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessUpdateAAIVfModuleStatus ======== ", isDebugLogEnabled) - - try{ - - //Build UpdateAAIVfModule Request - execution.setVariable("DCVFM_orchestrationStatus", status) - - String updateAAIVfModuleRequest = buildUpdateAAIVfModuleRequest(execution, false, true, false, false) - - updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest) - execution.setVariable("DCVFM_updateAAIVfModuleRequest", updateAAIVfModuleRequest) - logDebug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest, isDebugLogEnabled) - utils.logAudit("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessUpdateAAIVfModuleStatus. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleStatus Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessUpdateAAIVfModuleStatus ======== ", isDebugLogEnabled) - - } - - - public void preProcessUpdateAAIVfModuleRequestGroup(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessUpdateAAIVfModuleRequestGroup(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessUpdateAAIVfModuleRequestGroup ======== ", isDebugLogEnabled) - - try{ - - //Build UpdateAAIVfModule Request - - String updateAAIVfModuleRequest = buildUpdateAAIVfModuleRequest(execution, true, false, false, false) - - updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest) - execution.setVariable("DCVFM_updateAAIVfModuleRequest", updateAAIVfModuleRequest) - logDebug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest, isDebugLogEnabled) - utils.logAudit("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessUpdateAAIVfModuleRequestGroup. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestGroup Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessUpdateAAIVfModuleRequestGroup ======== ", isDebugLogEnabled) - - } - - public void validateSDNCResponse(DelegateExecution execution, String response, String method){ - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled) - - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - utils.logAudit("workflowException: " + workflowException) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - utils.logAudit("SDNCResponse: " + response) - - String sdncResponse = response - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - logDebug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse, isDebugLogEnabled) - RollbackData rollbackData = execution.getVariable("rollbackData") - - if(method.equals("assign")){ - rollbackData.put("VFMODULE", "rollbackSDNCRequestAssign", "true") - execution.setVariable("CRTGVNF_sdncAssignCompleted", true) - } - else if (method.equals("activate")) { - rollbackData.put("VFMODULE", "rollbackSDNCRequestActivate", "true") - } - execution.setVariable("rollbackData", rollbackData) - }else{ - logDebug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) - throw new BpmnError("MSOWorkflowException") - } - logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled) - } - - public void preProcessUpdateAfterCreateRequest(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - utils.log("DEBUG", " ======== STARTED preProcessRequest Process ======== ", isDebugLogEnabled) - try{ - String response = execution.getVariable("DCVFM_assignSDNCAdapterResponse") - utils.logAudit("DCVFM_assignSDNCAdapterResponse: " + response) - - String data = utils.getNodeXml(response, "response-data") - data = data.replaceAll("<", "<") - data = data.replaceAll(">", ">") - String vnfId = utils.getNodeText1(data, "vnf-id") - - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() - } - - String serviceOperation = "/VNF-API:vnfs/vnf-list/" + vnfId - def callbackUrl = execution.getVariable("DCVFM_sdncCallbackUrl") - utils.logAudit("callbackUrl: " + callbackUrl) - - String SDNCGetRequest = - """ - - ${uuid} - query - ${serviceOperation} - ${callbackUrl} - mobility - - - """ - - execution.setVariable("DCVFM_getSDNCRequest", SDNCGetRequest) - utils.log("DEBUG", "Outgoing GetSDNCRequest is: \n" + SDNCGetRequest, isDebugLogEnabled) - utils.logAudit("Outgoing GetSDNCRequest: " + SDNCGetRequest) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessSDNCGetRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) - } - utils.log("DEBUG", "======== COMPLETED preProcessSDNCGetRequest Process ======== ", isDebugLogEnabled) - } - - public String buildUpdateAAIVfModuleRequest(DelegateExecution execution, boolean updateVolumeGroupId, - boolean updateOrchestrationStatus, boolean updateHeatStackId, boolean updateContrailFqdn){ - - def vnfId = execution.getVariable("DCVFM_vnfId") - def vfModuleId = execution.getVariable("DCVFM_vfModuleId") - def volumeGroupIdString = "" - if (updateVolumeGroupId) { - volumeGroupIdString = "" + execution.getVariable("DCVFM_volumeGroupId") + - "" - } - def orchestrationStatusString = "" - if (updateOrchestrationStatus) { - orchestrationStatusString = "" + execution.getVariable("DCVFM_orchestrationStatus") + "" - } - def heatStackIdString = "" - if (updateHeatStackId) { - heatStackIdString = "" + execution.getVariable("DCVFM_heatStackId") + "" - } - def contrailFqdnString = "" - if (updateContrailFqdn) { - contrailFqdnString = "" + execution.getVariable("DCVFM_contrailServiceInstanceFqdn") + - "" - } - - String updateAAIVfModuleRequest = - """ - ${vnfId} - ${vfModuleId} - ${heatStackIdString} - ${orchestrationStatusString} - ${volumeGroupIdString} - ${contrailFqdnString} - """ - - utils.logAudit("updateAAIVfModule Request: " + updateAAIVfModuleRequest) - return updateAAIVfModuleRequest - - } - - public String buildSDNCParamsXml(DelegateExecution execution){ - - String params = "" - StringBuilder sb = new StringBuilder() - Map paramsMap = execution.getVariable("DCVFM_vnfParamsMap") - - for (Map.Entry entry : paramsMap.entrySet()) { - String paramsXml - String key = entry.getKey(); - if(key.endsWith("_network")){ - String requestKey = key.substring(0, key.indexOf("_network")) - String requestValue = entry.getValue() - paramsXml = -""" - { functx:substring-before-match(data($param/@name), '_network') } - { $param/text() } -""" - }else{ - paramsXml = "" - } - params = sb.append(paramsXml) - } - return params - } - - public void queryCloudRegion (DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - utils.log("DEBUG", " ======== STARTED queryCloudRegion ======== ", isDebugLogEnabled) - - try { - String cloudRegion = execution.getVariable("DCVFM_cloudSiteId") - - // Prepare AA&I url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUtil = new AaiUtil(this) - String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) - String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion - utils.logAudit("CloudRegion Request: " + queryCloudRegionRequest) - - execution.setVariable("DCVFM_queryCloudRegionRequest", queryCloudRegionRequest) - utils.log("DEBUG", "DCVFM_queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest, isDebugLogEnabled) - - cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) - - if ((cloudRegion != "ERROR")) { - if(execution.getVariable("DCVFM_queryCloudRegionReturnCode") == "404"){ - execution.setVariable("DCVFM_cloudRegionForVolume", "AAIAIC25") - }else{ - execution.setVariable("DCVFM_cloudRegionForVolume", cloudRegion) - } - execution.setVariable("DCVFM_isCloudRegionGood", true) - } else { - String errorMessage = "AAI Query Cloud Region Unsuccessful. AAI Response Code: " + execution.getVariable("DCVFM_queryCloudRegionReturnCode") - utils.log("DEBUG", errorMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - execution.setVariable("DCVFM_isCloudRegionGood", false) - } - utils.log("DEBUG", " is Cloud Region Good: " + execution.getVariable("DCVFM_isCloudRegionGood"), isDebugLogEnabled) - - } catch(BpmnError b){ - utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugLogEnabled) - throw b - }catch (Exception ex) { - // try error - String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + ex.getMessage() - utils.log("ERROR", " AAI Query Cloud Region Failed. Exception - " + "\n" + errorMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during queryCloudRegion method") - } - } - - /** - * - *This method occurs when an MSOWorkflowException is caught. It logs the - *variables and ensures that the "WorkflowException" Variable is set. - * - */ - public void processBPMNException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - try{ - utils.log("DEBUG", "Caught a BPMN Exception", isDebugEnabled) - utils.log("DEBUG", "Started processBPMNException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - if(execution.getVariable("WorkflowException") == null){ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during DoCreateVfModule Sub Process") - } - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processBPMNException Method: " + e, isDebugEnabled) - } - utils.log("DEBUG", "Completed processBPMNException Method", isDebugEnabled) - } - - public void prepareCreateAAIVfModuleVolumeGroupRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepareCreateAAIVfModuleVolumeGroupRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED prepareCreateAAIVfModuleVolumeGroupRequest ======== ", isDebugLogEnabled) - - try{ - - //Build CreateAAIVfModuleVolumeGroup Request - - def vnfId = execution.getVariable("DCVFM_vnfId") - def vfModuleId = execution.getVariable("DCVFM_vfModuleId") - def volumeGroupId = execution.getVariable("DCVFM_volumeGroupId") - //def aicCloudRegion = execution.getVariable("DCVFM_cloudSiteId") - def aicCloudRegion = execution.getVariable("DCVFM_cloudRegionForVolume") - String createAAIVfModuleVolumeGroupRequest = - """ - ${vnfId} - ${vfModuleId} - ${volumeGroupId} - ${aicCloudRegion} - """ - - createAAIVfModuleVolumeGroupRequest = utils.formatXml(createAAIVfModuleVolumeGroupRequest) - execution.setVariable("DCVFM_createAAIVfModuleVolumeGroupRequest", createAAIVfModuleVolumeGroupRequest) - logDebug("Outgoing CreateAAIVfModuleVolumeGroupRequest is: \n" + createAAIVfModuleVolumeGroupRequest, isDebugLogEnabled) - utils.logAudit("Outgoing CreateAAIVfModuleVolumeGroupRequest is: \n" + createAAIVfModuleVolumeGroupRequest) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing prepareCreateAAIVfModuleVolumeGroupRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareCreateAAIVfModuleVolumeGroupRequest Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED prepareCreateAAIVfModuleVolumeGroupRequest ======== ", isDebugLogEnabled) - - } - - public void createNetworkPoliciesInAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.createNetworkPoliciesInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED createNetworkPoliciesInAAI ======== ", isDebugLogEnabled) - - try { - // get variables - List fqdnList = execution.getVariable("DCVFM_contrailNetworkPolicyFqdnList") - int fqdnCount = fqdnList.size() - def rollbackData = execution.getVariable("rollbackData") - - execution.setVariable("DCVFM_networkPolicyFqdnCount", fqdnCount) - logDebug("DCVFM_networkPolicyFqdnCount - " + fqdnCount, isDebugLogEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) - - if (fqdnCount > 0) { - - // AII loop call over contrail network policy fqdn list - for (i in 0..fqdnCount-1) { - - int counting = i+1 - String fqdn = fqdnList[i] - - // Query AAI for this network policy FQDN - - String queryNetworkPolicyByFqdnAAIRequest = "${aai_endpoint}${aai_uri}?network-policy-fqdn=" + UriUtils.encode(fqdn, "UTF-8") - utils.logAudit("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest) - - def aaiRequestId = UUID.randomUUID().toString() - RESTConfig config = new RESTConfig(queryNetworkPolicyByFqdnAAIRequest); - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - APIResponse response = client.get() - int returnCode = response.getStatusCode() - execution.setVariable("DCVFM_aaiQqueryNetworkPolicyByFqdnReturnCode", returnCode) - logDebug(" ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode, isDebugLogEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (isOneOf(returnCode, 200, 201)) { - logDebug("The return code is: " + returnCode, isDebugLogEnabled) - // This network policy FQDN already exists in AAI - utils.logAudit(aaiResponseAsString) - execution.setVariable("DCVFM_queryNetworkPolicyByFqdnAAIResponse", aaiResponseAsString) - logDebug(" QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString, isDebugLogEnabled) - - } else { - if (returnCode == 404) { - // This network policy FQDN is not in AAI yet. Add it now - logDebug("The return code is: " + returnCode, isDebugLogEnabled) - logDebug("This network policy FQDN is not in AAI yet: " + fqdn, isDebugLogEnabled) - utils.logAudit("Network policy FQDN is not in AAI yet") - // Add the network policy with this FQDN to AAI - def networkPolicyId = UUID.randomUUID().toString() - logDebug("Adding network-policy with network-policy-id " + networkPolicyId, isDebugLogEnabled) - - String aaiNamespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) - logDebug('AAI namespace is: ' + aaiNamespace, isDebugLogEnabled) - String payload = """ - ${networkPolicyId} - ${fqdn} - ${execution.getVariable("DCVFM_heatStackId")} - """ as String - - execution.setVariable("DCVFM_addNetworkPolicyAAIRequestBody", payload) - - String addNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(networkPolicyId, "UTF-8") - utils.logAudit("AAI request endpoint: " + addNetworkPolicyAAIRequest) - logDebug("AAI request endpoint: " + addNetworkPolicyAAIRequest, isDebugLogEnabled) - - def aaiRequestIdPut = UUID.randomUUID().toString() - RESTConfig configPut = new RESTConfig(addNetworkPolicyAAIRequest); - RESTClient clientPut = new RESTClient(configPut).addHeader("X-TransactionId", aaiRequestIdPut) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - logDebug("invoking PUT call to AAI with payload:"+System.lineSeparator()+payload, isDebugLogEnabled) - utils.logAudit("Sending PUT call to AAI with Endpoint /n" + addNetworkPolicyAAIRequest + " with payload /n" + payload) - APIResponse responsePut = clientPut.httpPut(payload) - int returnCodePut = responsePut.getStatusCode() - execution.setVariable("DCVFM_aaiAddNetworkPolicyReturnCode", returnCodePut) - logDebug(" ***** AAI add network policy Response Code, NetworkPolicy #" + counting + " : " + returnCodePut, isDebugLogEnabled) - - String aaiResponseAsStringPut = responsePut.getResponseBodyAsString() - if (isOneOf(returnCodePut, 200, 201)) { - logDebug("The return code from adding network policy is: " + returnCodePut, isDebugLogEnabled) - // This network policy was created in AAI successfully - utils.logAudit(aaiResponseAsStringPut) - execution.setVariable("DCVFM_addNetworkPolicyAAIResponse", aaiResponseAsStringPut) - logDebug(" AddAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsStringPut, isDebugLogEnabled) - rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "true") - rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn" + i, fqdn) - execution.setVariable("rollbackData", rollbackData) - - } else { - // aai all errors - String putErrorMessage = "Unable to add network-policy to AAI createNetworkPoliciesInAAI - " + returnCodePut - logDebug(putErrorMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, putErrorMessage) - } - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Response from createNetworkPoliciesInAAI - " + returnCode - logDebug(dataErrorMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - } // end loop - - - } else { - logDebug("No contrail network policies to query/create", isDebugLogEnabled) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoCreateVfModule flow. createNetworkPoliciesInAAI() - " + ex.getMessage() - logDebug(exceptionMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - } - - /** - * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. - * - * @param execution The flow's execution instance. - */ - public void prepUpdateAAIGenericVnf(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def rollbackData = execution.getVariable("rollbackData") - def vnfId = execution.getVariable('DCVFM_vnfId') - def oamManagementV4Address = execution.getVariable("DCVFM_oamManagementV4Address") - def oamManagementV6Address = execution.getVariable("DCVFM_oamManagementV6Address") - def ipv4OamAddressElement = '' - def managementV6AddressElement = '' - - if (oamManagementV4Address != null && !oamManagementV4Address.isEmpty()) { - ipv4OamAddressElement = '' + oamManagementV4Address + '' - } - - if (oamManagementV6Address != null && !oamManagementV6Address.isEmpty()) { - managementV6AddressElement = '' + oamManagementV6Address + '' - } - - rollbackData.put("VFMODULE", "oamManagementV4Address", oamManagementV4Address) - - - String updateAAIGenericVnfRequest = """ - - ${vnfId} - ${ipv4OamAddressElement} - ${managementV6AddressElement} - - """ - updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) - execution.setVariable('DCVM_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) - utils.logAudit("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) - logDebug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest, isDebugLogEnabled) - - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) - } - } - - /** - * Post process a result from invoking the UpdateAAIGenericVnf subflow. - * - * @param execution The flow's execution instance. - */ - public void postProcessUpdateAAIGenericVnf(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.postProcessUpdateAAIGenericVnf(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def rollbackData = execution.getVariable("rollbackData") - - rollbackData.put("VFMODULE", "rollbackUpdateVnfAAI", "true") - - def vnfId = execution.getVariable('DCVFM_vnfId') - def oamManagementV4Address = execution.getVariable("DCVFM_oamManagementV4Address") - def oamManagementV6Address = execution.getVariable("DCVFM_oamManagementV6Address") - def ipv4OamAddressElement = '' - def managementV6AddressElement = '' - - if (oamManagementV4Address != null && !oamManagementV4Address.isEmpty()) { - rollbackData.put("VFMODULE", "oamManagementV4Address", oamManagementV4Address) - } - - if (oamManagementV6Address != null && !oamManagementV6Address.isEmpty()) { - rollbackData.put("VFMODULE", "oamManagementV6Address", oamManagementV6Address) - } - - execution.setVariable("rollbackData", rollbackData) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in postProcessUpdateAAIGenericVnf(): ' + e.getMessage()) - } - } - - public void queryCatalogDB (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("DEBUG"," ***** queryCatalogDB *****", isDebugEnabled) - - try { - boolean twoPhaseDesign = false - // check for input - - String vfModuleModelName = execution.getVariable("DCVFM_vfModuleModelName") - utils.log("DEBUG", "vfModuleModelName: " + vfModuleModelName, isDebugEnabled) - def vnfModelInfo = execution.getVariable("vnfModelInfo") - def vnfModelCustomizationUuid = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationUuid") - - utils.log("DEBUG", "vnfModelCustomizationUuid: " + vnfModelCustomizationUuid, isDebugEnabled) - - JSONArray vnfs = catalog.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid, "v2") - - utils.log("DEBUG", "Incoming Query Catalog DB for Vnf Response is: " + vnfModelCustomizationUuid, isDebugEnabled) - utils.logAudit("Incoming Query Catalog DB for Vf Module Response is: " + vnfModelCustomizationUuid) - - utils.log("DEBUG", "obtained VNF list") - // Only one match here - if (vnfs != null) { - JSONObject vnfObject = vnfs.get(0) - if (vnfObject != null) { - String vnfJson = vnfObject.toString() - // - ObjectMapper om = new ObjectMapper(); - VnfResource vnf = om.readValue(vnfJson, VnfResource.class); - - // Get multiStageDesign flag - - String multiStageDesignValue = vnf.getMultiStageDesign() - utils.log("DEBUG", "multiStageDesign value from Catalog DB is: " + multiStageDesignValue, isDebugEnabled) - if (multiStageDesignValue != null) { - if (multiStageDesignValue.equalsIgnoreCase("true")) { - twoPhaseDesign = true - } - } - } - } - - utils.log("DEBUG", "setting twoPhaseDesign flag to: " + twoPhaseDesign, isDebugEnabled) - - execution.setVariable("DCVFM_twoPhaseDesign", twoPhaseDesign) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in queryCatalogDB()', e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryCatalogDB(): ' + e.getMessage()) - } - } - - - public void preProcessRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled) - try { - - Object workflowException = execution.getVariable("WorkflowException"); - - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) - execution.setVariable("prevWorkflowException", workflowException); - //execution.setVariable("WorkflowException", null); - } - } catch (BpmnError e) { - utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) - } catch(Exception ex) { - String msg = "Exception in preProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled) - } - - public void postProcessRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled) - String msg = "" - try { - Object workflowException = execution.getVariable("prevWorkflowException"); - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) - execution.setVariable("WorkflowException", workflowException); - } - execution.setVariable("rollbackData", null) - } catch (BpmnError b) { - utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) - throw b; - } catch(Exception ex) { - msg = "Exception in postProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy deleted file mode 100644 index f862a00ac2..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy +++ /dev/null @@ -1,676 +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.bpmn.infrastructure.scripts -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse -import org.springframework.web.util.UriUtils - - - -public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ - - def Prefix="DCVFMR_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable("prefix",Prefix) - } - - // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids - // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - initProcessVariables(execution) - - try { - - execution.setVariable("rolledBack", null) - execution.setVariable("rollbackError", null) - - def rollbackData = execution.getVariable("rollbackData") - utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled) - - if (rollbackData != null) { - String vnfId = rollbackData.get("VFMODULE", "vnfid") - execution.setVariable("DCVFMR_vnfId", vnfId) - String vfModuleId = rollbackData.get("VFMODULE", "vfmoduleid") - execution.setVariable("DCVFMR_vfModuleId", vfModuleId) - String source = rollbackData.get("VFMODULE", "source") - execution.setVariable("DCVFMR_source", source) - String serviceInstanceId = rollbackData.get("VFMODULE", "serviceInstanceId") - execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId) - String serviceId = rollbackData.get("VFMODULE", "service-id") - execution.setVariable("DCVFMR_serviceId", serviceId) - String vnfType = rollbackData.get("VFMODULE", "vnftype") - execution.setVariable("DCVFMR_vnfType", vnfType) - String vnfName = rollbackData.get("VFMODULE", "vnfname") - execution.setVariable("DCVFMR_vnfName", vnfName) - String tenantId = rollbackData.get("VFMODULE", "tenantid") - execution.setVariable("DCVFMR_tenantId", tenantId) - String vfModuleName = rollbackData.get("VFMODULE", "vfmodulename") - execution.setVariable("DCVFMR_vfModuleName", vfModuleName) - String vfModuleModelName = rollbackData.get("VFMODULE", "vfmodulemodelname") - execution.setVariable("DCVFMR_vfModuleModelName", vfModuleModelName) - String cloudSiteId = rollbackData.get("VFMODULE", "aiccloudregion") - execution.setVariable("DCVFMR_cloudSiteId", cloudSiteId) - String heatStackId = rollbackData.get("VFMODULE", "heatstackid") - execution.setVariable("DCVFMR_heatStackId", heatStackId) - String requestId = rollbackData.get("VFMODULE", "msorequestid") - execution.setVariable("DCVFMR_requestId", requestId) - // Set mso-request-id to request-id for VNF Adapter interface - execution.setVariable("mso-request-id", requestId) - List createdNetworkPolicyFqdnList = [] - int i = 0 - while (i < 100) { - String fqdn = rollbackData.get("VFMODULE", "contrailNetworkPolicyFqdn" + i) - if (fqdn == null) { - break - } - createdNetworkPolicyFqdnList.add(fqdn) - logDebug("got fqdn # " + i + ": " + fqdn, isDebugEnabled) - i = i + 1 - - } - - execution.setVariable("DCVFMR_createdNetworkPolicyFqdnList", createdNetworkPolicyFqdnList) - String oamManagementV4Address = rollbackData.get("VFMODULE", "oamManagementV4Address") - execution.setVariable("DCVFMR_oamManagementV4Address", oamManagementV4Address) - String oamManagementV6Address = rollbackData.get("VFMODULE", "oamManagementV6Address") - execution.setVariable("DCVFMR_oamManagementV6Address", oamManagementV6Address) - //String serviceInstanceId = rollbackData.get("VFMODULE", "msoserviceinstanceid") - //execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId) - execution.setVariable("DCVFMR_rollbackPrepareUpdateVfModule", rollbackData.get("VFMODULE", "rollbackPrepareUpdateVfModule")) - execution.setVariable("DCVFMR_rollbackUpdateAAIVfModule", rollbackData.get("VFMODULE", "rollbackUpdateAAIVfModule")) - execution.setVariable("DCVFMR_rollbackVnfAdapterCreate", rollbackData.get("VFMODULE", "rollbackVnfAdapterCreate")) - execution.setVariable("DCVFMR_rollbackSDNCRequestAssign", rollbackData.get("VFMODULE", "rollbackSDNCRequestAssign")) - execution.setVariable("DCVFMR_rollbackSDNCRequestActivate", rollbackData.get("VFMODULE", "rollbackSDNCRequestActivate")) - execution.setVariable("DCVFMR_rollbackCreateAAIVfModule", rollbackData.get("VFMODULE", "rollbackCreateAAIVfModule")) - execution.setVariable("DCVFMR_rollbackCreateNetworkPoliciesAAI", rollbackData.get("VFMODULE", "rollbackCreateNetworkPoliciesAAI")) - execution.setVariable("DCVFMR_rollbackUpdateVnfAAI", rollbackData.get("VFMODULE", "rollbackUpdateVnfAAI")) - - // formulate the request for PrepareUpdateAAIVfModule - String request = """ - ${vnfId} - ${vfModuleId} - pending-delete - """ as String - utils.log("DEBUG", "PrepareUpdateAAIVfModuleRequest :" + request, isDebugEnabled) - utils.logAudit("DoCreateVfModuleRollback PrepareUpdateAAIVfModule Request: " + request) - execution.setVariable("PrepareUpdateAAIVfModuleRequest", request) - } else { - execution.setVariable("skipRollback", true) - } - - if (execution.getVariable("disableRollback").equals("true" )) { - execution.setVariable("skipRollback", true) - } - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - def msg = "Exception in DoCreateVfModuleRollback preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - - // build a SDNC vnf-topology-operation request for the specified action - // (note: the action passed is expected to be 'changedelete' or 'delete') - public void prepSDNCAdapterRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId") - - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("DCVFMR_requestId") + "-" + System.currentTimeMillis() - } - - def callbackUrl = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - - String source = execution.getVariable("DCVFMR_source") - String serviceId = execution.getVariable("DCVFMR_serviceId") - String vnfId = execution.getVariable("DCVFMR_vnfId") - String vnfType = execution.getVariable("DCVFMR_vnfType") - String vnfName = execution.getVariable("DCVFMR_vnfName") - String tenantId = execution.getVariable("DCVFMR_tenantId") - String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") - String vfModuleName = execution.getVariable("DCVFMR_vfModuleName") - String vfModuleModelName = execution.getVariable("DCVFMR_vfModuleModelName") - String cloudSiteId = execution.getVariable("DCVFMR_cloudSiteId") - String requestId = execution.getVariable("DCVFMR_requestId") - - String serviceInstanceIdToSdnc = "" - if (srvInstId != null && !srvInstId.isEmpty()) { - serviceInstanceIdToSdnc = srvInstId - } else { - serviceInstanceIdToSdnc = vfModuleId - } - - def doSDNCActivateRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestActivate") - def doSDNCAssignRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestAssign") - - def action = "" - def requestAction = "" - - if (doSDNCActivateRollback.equals("true")) { - action = "delete" - requestAction = "DisconnectVNFRequest" - } - else if (doSDNCAssignRollback.equals("true")) { - action = "rollback" - requestAction = "VNFActivateRequest" - } - else - return - - - String request = """ - - ${uuid} - ${vfModuleId} - ${action} - vnf-topology-operation - ${callbackUrl} - - - - ${requestId} - ${requestAction} - ${source} - - - - - - ${serviceId} - ${serviceId} - ${serviceInstanceIdToSdnc} - notsurewecare - - - ${vfModuleId} - ${vfModuleModelName} - ${vfModuleName} - ${vnfId} - ${vnfName} - ${vnfType} - ${cloudSiteId} - ${tenantId} - - - """ - - utils.log("DEBUG", "sdncAdapterWorkflowRequest: " + request, isDebugEnabled) - utils.logAudit("DoCreateVfModuleRollback sdncAdapterWorkflow Request: " + request) - execution.setVariable("sdncAdapterWorkflowRequest", request) - } - - public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled) - - def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId") - - try{ - //Build SDNC Request - - String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate") - - deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest) - execution.setVariable("DCVFMR_deactivateSDNCRequest", deactivateSDNCRequest) - logDebug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest, isDebugLogEnabled) - utils.logAudit("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled) - } - - public void preProcessSDNCUnassignRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessSDNCUnassignRequest Process ======== ", isDebugLogEnabled) - try{ - String serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId") - - String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign") - - execution.setVariable("DCVFMR_unassignSDNCRequest", unassignSDNCRequest) - logDebug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest, isDebugLogEnabled) - utils.logAudit("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) - - }catch(Exception e){ - log.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessSDNCUnassignRequest Process ======== ", isDebugLogEnabled) - } - - public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ - - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("DCVFMR_requestId") + "-" + System.currentTimeMillis() - } - def callbackURL = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - def requestId = execution.getVariable("DCVFMR_requestId") - def serviceId = execution.getVariable("DCVFMR_serviceId") - def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId") - def vfModuleId = execution.getVariable("DCVFMR_vfModuleId") - def source = execution.getVariable("DCVFMR_source") - def vnfId = execution.getVariable("DCVFMR_vnfId") - - def sdncVersion = execution.getVariable("sdncVersion") - - String sdncRequest = - """ - - ${uuid} - ${svcInstId} - ${action} - vf-module-topology-operation - ${callbackURL} - generic-resource - - - - ${requestId} - DeleteVfModuleInstance - ${source} - - - - - - - - ${serviceInstanceId} - - - - ${vnfId} - - - - ${vfModuleId} - - - - """ - - utils.logAudit("sdncRequest: " + sdncRequest) - return sdncRequest - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing VnfAdapterDeleteV1 request - public void prepVNFAdapterRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - String requestId = UUID.randomUUID().toString() - String origRequestId = execution.getVariable("DCVFMR_requestId") - String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId") - String aicCloudRegion = execution.getVariable("DCVFMR_cloudSiteId") - String vnfId = execution.getVariable("DCVFMR_vnfId") - String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") - String vfModuleStackId = execution.getVariable("DCVFMR_heatStackId") - String tenantId = execution.getVariable("DCVFMR_tenantId") - def messageId = execution.getVariable('mso-request-id') + '-' + - System.currentTimeMillis() - def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) - def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") - if ('true'.equals(useQualifiedHostName)) { - notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) - } - - String request = """ - - ${aicCloudRegion} - ${tenantId} - ${vnfId} - ${vfModuleId} - ${vfModuleStackId} - true - - ${origRequestId} - ${srvInstId} - - ${messageId} - ${notificationUrl} - - """ as String - - utils.log("DEBUG", "vnfAdapterRestV1Request: " + request, isDebugEnabled) - utils.logAudit("PrepareUpdateAAIVfModule vnfAdapterRestV1 Request: " + request) - execution.setVariable("vnfAdapterRestV1Request", request) - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing UpdateAAIVfModuleRequest request - public void prepUpdateAAIVfModule(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - String vnfId = execution.getVariable("DCVFMR_vnfId") - String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") - // formulate the request for UpdateAAIVfModule - String request = """ - ${vnfId} - ${vfModuleId} - DELETE - deleted - """ as String - utils.log("DEBUG", "UpdateAAIVfModuleRequest :" + request, isDebugEnabled) - utils.logAudit("UpdateAAIVfModule Request: " + request) - execution.setVariable("UpdateAAIVfModuleRequest", request) - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing UpdateAAIVfModuleRequest request - public void prepUpdateAAIVfModuleToAssigned(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - String vnfId = execution.getVariable("DCVFMR_vnfId") - String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") - // formulate the request for UpdateAAIVfModule - String request = """ - ${vnfId} - ${vfModuleId} - - Assigned - """ as String - utils.log("DEBUG", "UpdateAAIVfModuleRequest :" + request, isDebugEnabled) - utils.logAudit("UpdateAAIVfModule Request: " + request) - execution.setVariable("UpdateAAIVfModuleRequest", request) - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing DeleteAAIVfModuleRequest request - public void prepDeleteAAIVfModule(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - String vnfId = execution.getVariable("DCVFMR_vnfId") - String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") - // formulate the request for UpdateAAIVfModule - String request = """ - ${vnfId} - ${vfModuleId} - """ as String - utils.log("DEBUG", "DeleteAAIVfModuleRequest :" + request, isDebugEnabled) - utils.logAudit("DeleteAAIVfModule Request: " + request) - execution.setVariable("DeleteAAIVfModuleRequest", request) - } - - // generates a WorkflowException if - // - - public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("ERROR", "AAI error occurred deleting the Generic Vnf: " - + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), isDebugEnabled) - String processKey = getProcessKey(execution); - exceptionUtil.buildWorkflowException(execution, 5000, "Failure in DoDeleteVfModule") - - } - - public void sdncValidateResponse(DelegateExecution execution, String response){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - utils.log("DEBUG", "Successfully Validated SDNC Response", isDebugEnabled) - }else{ - throw new BpmnError("MSOWorkflowException") - } - } - - public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED deleteNetworkPoliciesFromAAI ======== ", isDebugLogEnabled) - - try { - // get variables - List fqdnList = execution.getVariable(Prefix + "createdNetworkPolicyFqdnList") - if (fqdnList == null) { - logDebug("No network policies to delete", isDebugLogEnabled) - return - } - int fqdnCount = fqdnList.size() - - execution.setVariable(Prefix + "networkPolicyFqdnCount", fqdnCount) - logDebug("networkPolicyFqdnCount - " + fqdnCount, isDebugLogEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) - - if (fqdnCount > 0) { - // AII loop call over contrail network policy fqdn list - for (i in 0..fqdnCount-1) { - - int counting = i+1 - String fqdn = fqdnList[i] - - // Query AAI for this network policy FQDN - - String queryNetworkPolicyByFqdnAAIRequest = "${aai_endpoint}${aai_uri}?network-policy-fqdn=" + UriUtils.encode(fqdn, "UTF-8") - utils.logAudit("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest) - logDebug("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest, isDebugLogEnabled) - - def aaiRequestId = UUID.randomUUID().toString() - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkPolicyByFqdnAAIRequest) - int returnCode = response.getStatusCode() - execution.setVariable(Prefix + "aaiQueryNetworkPolicyByFqdnReturnCode", returnCode) - logDebug(" ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode, isDebugLogEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (isOneOf(returnCode, 200, 201)) { - logDebug("The return code is: " + returnCode, isDebugLogEnabled) - // This network policy FQDN exists in AAI - need to delete it now - utils.logAudit(aaiResponseAsString) - execution.setVariable(Prefix + "queryNetworkPolicyByFqdnAAIResponse", aaiResponseAsString) - logDebug("QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString, isDebugLogEnabled) - // Retrieve the network policy id for this FQDN - def networkPolicyId = utils.getNodeText1(aaiResponseAsString, "network-policy-id") - logDebug("Deleting network-policy with network-policy-id " + networkPolicyId, isDebugLogEnabled) - - // Retrieve the resource version for this network policy - def resourceVersion = utils.getNodeText1(aaiResponseAsString, "resource-version") - logDebug("Deleting network-policy with resource-version " + resourceVersion, isDebugLogEnabled) - - String delNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(networkPolicyId, "UTF-8") + - "?resource-version=" + UriUtils.encode(resourceVersion, "UTF-8") - - utils.logAudit("AAI request endpoint: " + delNetworkPolicyAAIRequest) - logDebug("AAI request endpoint: " + delNetworkPolicyAAIRequest, isDebugLogEnabled) - - def aaiRequestIdDel = UUID.randomUUID().toString() - logDebug("invoking DELETE call to AAI", isDebugLogEnabled) - utils.logAudit("Sending DELETE call to AAI with Endpoint /n" + delNetworkPolicyAAIRequest) - - APIResponse responseDel = aaiUriUtil.executeAAIDeleteCall(execution, delNetworkPolicyAAIRequest) - - int returnCodeDel = responseDel.getStatusCode() - execution.setVariable(Prefix + "aaiDeleteNetworkPolicyReturnCode", returnCodeDel) - logDebug(" ***** AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + returnCodeDel, isDebugLogEnabled) - - if (isOneOf(returnCodeDel, 200, 201, 204)) { - logDebug("The return code from deleting network policy is: " + returnCodeDel, isDebugLogEnabled) - // This network policy was deleted from AAI successfully - logDebug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ", isDebugLogEnabled) - - } else { - // aai all errors - String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + returnCodeDel - logDebug(delErrorMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage) - } - } else if (returnCode == 404) { - // This network policy FQDN is not in AAI. No need to delete. - logDebug("The return code is: " + returnCode, isDebugLogEnabled) - logDebug("This network policy FQDN is not in AAI: " + fqdn, isDebugLogEnabled) - utils.logAudit("Network policy FQDN is not in AAI") - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + returnCode - logDebug(dataErrorMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - - - - } // end loop - - - } else { - logDebug("No contrail network policies to query/create", isDebugLogEnabled) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoCreateVfModuleRollback flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() - logDebug(exceptionMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - } - - - /** - * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. - * - * @param execution The flow's execution instance. - */ - public void preProcessUpdateAAIGenericVnf(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessUpdateAAIGenericVnf((' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def vnfId = execution.getVariable('DCVFMR_vnfId') - def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address') - def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address') - def ipv4OamAddressElement = '' - def managementV6AddressElement = '' - - if (oamManagementV4Address != null) { - ipv4OamAddressElement = '' + 'DELETE' + '' - } - - if (oamManagementV6Address != null) { - managementV6AddressElement = '' + 'DELETE' + '' - } - - - String updateAAIGenericVnfRequest = """ - - ${vnfId} - ${ipv4OamAddressElement} - ${managementV6AddressElement} - - """ - updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) - execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) - utils.logAudit("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) - logDebug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest, isDebugLogEnabled) - - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessUpdateAAIGenericVnf((): ' + e.getMessage()) - } - } - - public void setSuccessfulRollbackStatus (DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED setSuccessfulRollbackStatus ======== ", isDebugLogEnabled) - - try{ - // Set rolledBack to true, rollbackError to null - execution.setVariable("rolledBack", true) - execution.setVariable("rollbackError", null) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing setSuccessfulRollbackStatus. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED setSuccessfulRollbackStatus ======== ", isDebugLogEnabled) - } - - public void setFailedRollbackStatus (DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED setFailedRollbackStatus ======== ", isDebugLogEnabled) - - try{ - // Set rolledBack to false, rollbackError to actual value, rollbackData to null - execution.setVariable("rolledBack", false) - execution.setVariable("rollbackError", 'Caught exception in DoCreateVfModuleRollback') - execution.setVariable("rollbackData", null) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing setFailedRollbackStatus. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED setFailedRollbackStatus ======== ", isDebugLogEnabled) - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy deleted file mode 100644 index e903a547f7..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy +++ /dev/null @@ -1,238 +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.bpmn.infrastructure.scripts; - -import groovy.xml.XmlUtil -import groovy.json.* - - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse -import org.springframework.web.util.UriUtils - - -public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor { - String Prefix="DCVFMODVOLRBK_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - - def className = getClass().getSimpleName() - - /** - * This method is executed during the preProcessRequest task of the DoCreateVfModuleVolumeRollback.bpmn process. - * @param execution - */ - public InitializeProcessVariables(DelegateExecution execution){ - /* Initialize all the process variables in this block */ - - execution.setVariable(Prefix + "volumeGroupName", null) - execution.setVariable(Prefix + "lcpCloudRegionId", null) - execution.setVariable(Prefix + "rollbackVnfARequest", null) - - } - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - /** - * This method is executed during the preProcessRequest task of the DoCreateVfModuleVolumeRollback.bpmn process. - * @param execution - */ - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - InitializeProcessVariables(execution) -// rollbackData.put("DCVFMODULEVOL", "aiccloudregion", cloudSiteId) - RollbackData rollbackData = execution.getVariable("rollbackData") - -// String vnfId = rollbackData.get("DCVFMODULEVOL", "vnfid") -// execution.setVariable("DCVFMODVOLRBK_vnfId", vnfId) -// String vfModuleId = rollbackData.get("DCVFMODULEVOL", "vfmoduleid") -// execution.setVariable("DCVFMODVOLRBK_vfModuleId", vfModuleId) -// String source = rollbackData.get("DCVFMODULEVOL", "source") -// execution.setVariable("DCVFMODVOLRBK_source", source) -// String serviceInstanceId = rollbackData.get("DCVFMODULEVOL", "serviceInstanceId") -// execution.setVariable("DCVFMODVOLRBK_serviceInstanceId", serviceInstanceId) -// String serviceId = rollbackData.get("DCVFMODULEVOL", "service-id") -// execution.setVariable("DCVFMODVOLRBK_serviceId", serviceId) -// String vnfType = rollbackData.get("DCVFMODULEVOL", "vnftype") -// execution.setVariable("DCVFMODVOLRBK_vnfType", vnfType) -// String vnfName = rollbackData.get("DCVFMODULEVOL", "vnfname") -// execution.setVariable("DCVFMODVOLRBK_vnfName", vnfName) -// String tenantId = rollbackData.get("DCVFMODULEVOL", "tenantid") -// execution.setVariable("DCVFMODVOLRBK_tenantId", tenantId) -// String vfModuleName = rollbackData.get("DCVFMODULEVOL", "vfmodulename") -// execution.setVariable("DCVFMODVOLRBK_vfModuleName", vfModuleName) -// String vfModuleModelName = rollbackData.get("DCVFMODULEVOL", "vfmodulemodelname") -// execution.setVariable("DCVFMODVOLRBK_vfModuleModelName", vfModuleModelName) -// String cloudSiteId = rollbackData.get("DCVFMODULEVOL", "aiccloudregion") -// execution.setVariable("DCVFMODVOLRBK_cloudSiteId", cloudSiteId) -// String heatStackId = rollbackData.get("DCVFMODULEVOL", "heatstackid") -// execution.setVariable("DCVFMODVOLRBK_heatStackId", heatStackId) -// String requestId = rollbackData.get("DCVFMODULEVOL", "msorequestid") -// execution.setVariable("DCVFMODVOLRBK_requestId", requestId) - - String volumeGroupName = rollbackData.get("DCVFMODULEVOL", "volumeGroupName") - execution.setVariable("DCVFMODVOLRBK_volumeGroupName", volumeGroupName) - - String lcpCloudRegionId = rollbackData.get("DCVFMODULEVOL", "aiccloudregion") - execution.setVariable("DCVFMODVOLRBK_lcpCloudRegionId", lcpCloudRegionId) - - execution.setVariable("DCVFMODVOLRBK_rollbackVnfARequest", rollbackData.get("DCVFMODULEVOL", "rollbackVnfARequest")) - execution.setVariable("DCVFMODVOLRBK_backoutOnFailure", rollbackData.get("DCVFMODULEVOL", "backoutOnFailure")) - execution.setVariable("DCVFMODVOLRBK_isCreateVnfRollbackNeeded", rollbackData.get("DCVFMODULEVOL", "isCreateVnfRollbackNeeded")) - execution.setVariable("DCVFMODVOLRBK_isAAIRollbackNeeded", rollbackData.get("DCVFMODULEVOL", "isAAIRollbackNeeded")) - - } - - /** - * Query AAI volume group by name - * @param execution - * @param isDebugEnabled - */ - public void callRESTQueryAAIVolGrpName(DelegateExecution execution, isDebugEnabled) { - - def volumeGroupName = execution.getVariable('DCVFMODVOLRBK_volumeGroupName') - def cloudRegion = execution.getVariable('DCVFMODVOLRBK_lcpCloudRegionId') - - // This is for stub testing - def testVolumeGroupName = execution.getVariable('test-volume-group-name') - if (testVolumeGroupName != null && testVolumeGroupName.length() > 0) { - volumeGroupName = testVolumeGroupName - } - - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) - String queryAAIVolumeNameRequest = aaiEndpoint + '/' + cloudRegion + "/volume-groups" + "?volume-group-name=" + UriUtils.encode(volumeGroupName, 'UTF-8') - - utils.logAudit('Query AAI volume group by name: ' + queryAAIVolumeNameRequest) - - APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIVolumeNameRequest) - - String returnCode = response.getStatusCode() - String aaiResponseAsString = response.getResponseBodyAsString() - //aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) - - utils.logAudit("AAI query volume group by name return code: " + returnCode) - utils.logAudit("AAI query volume group by name response: " + aaiResponseAsString) - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - execution.setVariable(prefix+"queryAAIVolGrpNameResponse", aaiResponseAsString) - execution.setVariable(prefix+'AaiReturnCode', returnCode) - - if (returnCode=='200') { - // @TODO: verify error code - // @TODO: create class of literals representing error codes - execution.setVariable(prefix+'queryAAIVolGrpNameResponse', aaiResponseAsString) - utils.log("DEBUG", "Volume Group Name $volumeGroupName exists in AAI.", isDebugEnabled) - } else { - if (returnCode=='404') { - utils.log("DEBUG", "Volume Group Name $volumeGroupName does not exist in AAI.", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume group $volumeGroupName not found in AAI. Response code: 404") - } else { - WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - throw new BpmnError("MSOWorkflowException") - } - } - } - - - - public void callRESTDeleteAAIVolumeGroup(DelegateExecution execution, isDebugEnabled) { - - callRESTQueryAAIVolGrpName(execution, isDebugEnabled) - - def queryAaiVolumeGroupResponse = execution.getVariable(prefix+'queryAAIVolGrpNameResponse') - - def volumeGroupId = utils.getNodeText(queryAaiVolumeGroupResponse, "volume-group-id") - def resourceVersion = utils.getNodeText(queryAaiVolumeGroupResponse, "resource-version") - - def cloudRegion = execution.getVariable("DCVFMODVOLRBK_lcpCloudRegionId") - - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) - String deleteAAIVolumeGrpIdRequest = aaiEndpoint + '/' + cloudRegion + "/volume-groups/volume-group" + '/' + volumeGroupId + "?resource-version=" + UriUtils.encode(resourceVersion, "UTF-8") - - utils.logAudit('Delete AAI volume group : ' + deleteAAIVolumeGrpIdRequest) - - APIResponse response = aaiUtil.executeAAIDeleteCall(execution, deleteAAIVolumeGrpIdRequest) - - String returnCode = response.getStatusCode() - String aaiResponseAsString = response.getResponseBodyAsString() - //aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) - - utils.logAudit("AAI delete volume group return code: " + returnCode) - utils.logAudit("AAI delete volume group response: " + aaiResponseAsString) - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - def volumeGroupNameFound = prefix+'volumeGroupNameFound' - if (returnCode=='200' || returnCode=='204' ) { - utils.log("DEBUG", "Volume group $volumeGroupId deleted.", isDebugEnabled) - } else { - if (returnCode=='404') { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume group $volumeGroupId not found for delete in AAI Response code: 404") - } else { - WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - throw new BpmnError("MSOWorkflowException") - } - } - } - - // ******************************* - // Build Error Section - // ******************************* - - - - public void processJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - try{ - utils.log("DEBUG", "Caught a Java Exception in " + Prefix, isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) - } - utils.log("DEBUG", "Completed processJavaException Method in " + Prefix, isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy deleted file mode 100644 index 13a7ffa498..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy +++ /dev/null @@ -1,609 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import static org.camunda.spin.Spin.XML; -import groovy.json.JsonSlurper -import groovy.lang.GroovyInterceptable; -import groovy.xml.XmlUtil - -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.NetworkUtils -import org.openecomp.mso.bpmn.common.scripts.VfModuleBase; -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.rest.APIResponse -import org.springframework.web.util.UriUtils - - - - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; - -class DoCreateVfModuleVolumeV2 extends VfModuleBase { - - String prefix='DCVFMODVOLV2_' - JsonUtils jsonUtil = new JsonUtils() - - - /** - * Perform initial processing, such as request validation, initialization of variables, etc. - * * @param execution - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - preProcessRequest(execution, isDebugEnabled) - } - - public void preProcessRequest(DelegateExecution execution, isDebugLogEnabled) { - - execution.setVariable("prefix",prefix) - execution.setVariable(prefix+'SuccessIndicator', false) - execution.setVariable(prefix+'isPONR', false) - - displayInput(execution, isDebugLogEnabled) - setRollbackData(execution, isDebugLogEnabled) - setRollbackEnabled(execution, isDebugLogEnabled) - - - def tenantId = execution.getVariable("tenantId") - if (tenantId == null) { - String cloudConfiguration = execution.getVariable("cloudConfiguration") - tenantId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.tenantId") - execution.setVariable("tenantId", tenantId) - } - - def cloudSiteId = execution.getVariable("lcpCloudRegionId") - if (cloudSiteId == null) { - String cloudConfiguration = execution.getVariable("cloudConfiguration") - cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.lcpCloudRegionId") - execution.setVariable("lcpCloudRegionId", cloudSiteId) - } - - // Extract attributes from modelInfo - String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo") - - //modelCustomizationUuid - def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid") - execution.setVariable("modelCustomizationId", modelCustomizationUuid) - logDebug("modelCustomizationId: " + modelCustomizationUuid, isDebugLogEnabled) - - //modelName - def modelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName") - execution.setVariable("modelName", modelName) - logDebug("modelName: " + modelName, isDebugLogEnabled) - - // The following is used on the get Generic Service Instance call - execution.setVariable('GENGS_type', 'service-instance') - } - - - /** - * Display input variables - * @param execution - * @param isDebugLogEnabled - */ - public void displayInput(DelegateExecution execution, isDebugLogEnabled) { - def input = ['mso-request-id', 'msoRequestId', 'isDebugLogEnabled', 'disableRollback', 'failIfExists', 'serviceInstanceId', - 'vnfId', 'vnfName', 'tenantId', 'volumeGroupId', 'volumeGroupName', 'lcpCloudRegionId', 'vnfType', 'vfModuleModelInfo', 'asdcServiceModelVersion', - 'test-volume-group-name', 'test-volume-group-id', 'vfModuleInputParams'] - - logDebug('Begin input: ', isDebugLogEnabled) - input.each { - logDebug(it + ': ' + execution.getVariable(it), isDebugLogEnabled) - } - logDebug('End input.', isDebugLogEnabled) - } - - - /** - * Define and set rollbackdata object - * @param execution - * @param isDebugEnabled - */ - public void setRollbackData(DelegateExecution execution, isDebugEnabled) { - def rollbackData = execution.getVariable("rollbackData") - if (rollbackData == null) { - rollbackData = new RollbackData() - } - def volumeGroupName = execution.getVariable('volumeGroupName') - rollbackData.put("DCVFMODULEVOL", "volumeGroupName", volumeGroupName) - execution.setVariable("rollbackData", rollbackData) - } - - - /** - * validate getServiceInstance response - * @param execution - * @param isDebugEnabled - */ - public void validateGetServiceInstanceCall(DelegateExecution execution, isDebugEnabled) { - def found = execution.getVariable('GENGS_FoundIndicator') - def success = execution.getVariable('GENGS_SuccessIndicator') - def serviceInstanceId = execution.getVariable('serviceInstanceId') - utils.log("DEBUG", "getServiceInstance success: " + success, isDebugEnabled) - utils.log("DEBUG", "getServiceInstance found: " + found, isDebugEnabled) - if(!found || !success) { - String errorMessage = "Service instance id not found in AAI: ${serviceInstanceId}." - utils.log("DEBUG", errorMessage, isDebugEnabled) - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage) - } - - } - - /** - * Get cloud region - * @param execution - * @param isDebugEnabled - */ - public void callRESTQueryAAICloudRegion (DelegateExecution execution, isDebugEnabled) { - - def cloudRegion = execution.getVariable("lcpCloudRegionId") - utils.log("DEBUG", 'Request cloud region is: ' + cloudRegion, isDebugEnabled) - - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) - String queryCloudRegionRequest = aaiEndpoint + '/' + cloudRegion - - utils.logAudit(queryCloudRegionRequest) - - cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) - - def aaiCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "AAI", cloudRegion) - if ((aaiCloudRegion != "ERROR")) { - execution.setVariable("lcpCloudRegionId", aaiCloudRegion) - utils.log("DEBUG", "AIC Cloud Region for AAI: " + aaiCloudRegion, isDebugEnabled) - } else { - String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode") - utils.log("DEBUG", errorMessage, isDebugEnabled) - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage) - } - - def poCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) - if ((poCloudRegion != "ERROR")) { - execution.setVariable("poLcpCloudRegionId", poCloudRegion) - utils.log("DEBUG", "AIC Cloud Region for PO: " + poCloudRegion, isDebugEnabled) - } else { - String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode") - utils.log("DEBUG", errorMessage, isDebugEnabled) - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage) - } - - def rollbackData = execution.getVariable("rollbackData") - rollbackData.put("DCVFMODULEVOL", "aiccloudregion", cloudRegion) - } - - - /** - * Query AAI volume group by name - * @param execution - * @param isDebugEnabled - */ - public void callRESTQueryAAIVolGrpName(DelegateExecution execution, isDebugEnabled) { - - def volumeGroupName = execution.getVariable('volumeGroupName') - def cloudRegion = execution.getVariable('lcpCloudRegionId') - - // This is for stub testing - def testVolumeGroupName = execution.getVariable('test-volume-group-name') - if (testVolumeGroupName != null && testVolumeGroupName.length() > 0) { - volumeGroupName = testVolumeGroupName - } - - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) - String queryAAIVolumeNameRequest = aaiEndpoint + '/' + cloudRegion + "/volume-groups" + "?volume-group-name=" + UriUtils.encode(volumeGroupName, 'UTF-8') - - utils.logAudit('Query AAI volume group by name: ' + queryAAIVolumeNameRequest) - - APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIVolumeNameRequest) - - String returnCode = response.getStatusCode() - String aaiResponseAsString = response.getResponseBodyAsString() - aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) - - utils.logAudit("AAI query volume group by name return code: " + returnCode) - utils.logAudit("AAI query volume group by name response: " + aaiResponseAsString) - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - execution.setVariable(prefix+"queryAAIVolGrpNameResponse", aaiResponseAsString) - execution.setVariable(prefix+'AaiReturnCode', returnCode) - - if (returnCode=='200') { - execution.setVariable(prefix+'queryAAIVolGrpNameResponse', aaiResponseAsString) - utils.log("DEBUG", "Volume Group Name $volumeGroupName exists in AAI.", isDebugEnabled) - } else { - if (returnCode=='404') { - utils.log("DEBUG", "Volume Group Name $volumeGroupName does not exist in AAI.", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume group $volumeGroupName not found in AAI. Response code: 404") - } else { - WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - throw new BpmnError("MSOWorkflowException") - } - } - } - - - /** - * Create a WorkflowException - * @param execution - * @param isDebugEnabled - */ - public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage, isDebugEnabled) { - utils.log("DEBUG", errorMessage, isDebugEnabled) - (new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage) - } - - - /** - * Create a WorkflowException - * @param execution - * @param isDebugEnabled - */ - public void handleError(DelegateExecution execution, isDebugEnabled) { - WorkflowException we = execution.getVariable('WorkflowException') - if (we == null) { - (new ExceptionUtil()).buildWorkflowException(execution, 2500, "Enexpected error encountered!") - } - throw new BpmnError("MSOWorkflowException") - } - - - /** - * Create volume group in AAI - * @param execution - * @param isDebugEnabled - */ - public void callRESTCreateAAIVolGrpName(DelegateExecution execution, isDebugEnabled) { - - def vnfId = execution.getVariable('vnfId') - def volumeGroupId = execution.getVariable('volumeGroupId') - def volumeName = execution.getVariable("volumeGroupName") - def modelCustomizationId = execution.getVariable("modelCustomizationId") - def vnfType = execution.getVariable("vnfType") - def tenantId = execution.getVariable("tenantId") - def cloudRegion = execution.getVariable('lcpCloudRegionId') - - utils.log("DEBUG", "volumeGroupId: " + volumeGroupId, isDebugEnabled) - - def testGroupId = execution.getVariable('test-volume-group-id') - if (testGroupId != null && testGroupId.trim() != '') { - utils.log("DEBUG", "test volumeGroupId is present: " + testGroupId, isDebugEnabled) - volumeGroupId = testGroupId - execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0") - } - - utils.log("DEBUG", "volumeGroupId to be used: " + volumeGroupId, isDebugEnabled) - - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) - String createAAIVolumeGrpNameUrlRequest = aaiEndpoint + '/' + cloudRegion + "/volume-groups/volume-group/" + UriUtils.encode(volumeGroupId, "UTF-8") - - String namespace = aaiUtil.getNamespaceFromUri(aaiUtil.getCloudInfrastructureCloudRegionUri(execution)) - utils.log("DEBUG", "AAI namespace is: " + namespace, isDebugEnabled) - - utils.logAudit("Request URL for PUT: " + createAAIVolumeGrpNameUrlRequest) - - NetworkUtils networkUtils = new NetworkUtils() - String payload = networkUtils.createCloudRegionVolumeRequest(volumeGroupId, volumeName, vnfType, vnfId, tenantId, cloudRegion, namespace, modelCustomizationId) - String payloadXml = utils.formatXml(payload) - utils.logAudit("Request payload for PUT: " + payloadXml) - - APIResponse response = aaiUtil.executeAAIPutCall(execution, createAAIVolumeGrpNameUrlRequest, payloadXml) - - String returnCode = response.getStatusCode() - String aaiResponseAsString = response.getResponseBodyAsString() - aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) - - utils.logAudit("AAI create volume group return code: " + returnCode) - utils.logAudit("AAI create volume group response: " + aaiResponseAsString) - - execution.setVariable(prefix+"createAAIVolumeGrpNameReturnCode", returnCode) - execution.setVariable(prefix+"createAAIVolumeGrpNameResponse", aaiResponseAsString) - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - if (returnCode =='201') { - RollbackData rollbackData = execution.getVariable("rollbackData") - rollbackData.put("DCVFMODULEVOL", "isAAIRollbackNeeded", "true") - } else { - execution.setVariable(prefix+"isErrorMessageException", true) - if (returnCode=='404') { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Unable to create volume group in AAI. Response code: 404") - } else { - WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - utils.log("DEBUG", " AAI Adapter Query Failed. WorkflowException - " + "\n" + aWorkflowException, isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - } - } - - - /** - * Prepare VNF adapter create request XML - * @param execution - */ - public void prepareVnfAdapterCreateRequest(DelegateExecution execution, isDebugEnabled) { - - def aaiGenericVnfResponse = execution.getVariable(prefix+'AAIQueryGenericVfnResponse') - def vnfId = utils.getNodeText1(aaiGenericVnfResponse, 'vnf-id') - def vnfName = utils.getNodeText1(aaiGenericVnfResponse, 'vnf-name') - def vnfType = utils.getNodeText1(aaiGenericVnfResponse, "vnf-type") - - def requestId = execution.getVariable('msoRequestId') - def serviceId = execution.getVariable('serviceInstanceId') - def cloudSiteId = execution.getVariable('poLcpCloudRegionId') - def tenantId = execution.getVariable('tenantId') - def volumeGroupId = execution.getVariable('volumeGroupId') - def volumeGroupnName = execution.getVariable('volumeGroupName') - - def vnfVersion = execution.getVariable("asdcServiceModelVersion") - def vnfModuleType = execution.getVariable("modelName") - - def modelCustomizationId = execution.getVariable("modelCustomizationId") - - // for testing - utils.log("DEBUG", "volumeGroupId: " + volumeGroupId, isDebugEnabled) - def testGroupId = execution.getVariable('test-volume-group-id') - if (testGroupId != null && testGroupId.trim() != '') { - utils.log("DEBUG", "test volumeGroupId is present: " + testGroupId, isDebugEnabled) - volumeGroupId = testGroupId - execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0") - } - utils.log("DEBUG", "volumeGroupId to be used: " + volumeGroupId, isDebugEnabled) - - // volume group parameters - - String volumeGroupParams = '' - StringBuilder sbParams = new StringBuilder() - Map paramsMap = execution.getVariable("vfModuleInputParams") - for (Map.Entry entry : paramsMap.entrySet()) { - String paramsXml - String paramName = entry.getKey(); - String paramValue = entry.getValue() - paramsXml = - """ - ${paramName} - ${paramValue} - - """ - sbParams.append(paramsXml) - } - - volumeGroupParams = sbParams.toString() - utils.log("DEBUG", "volumeGroupParams: "+ volumeGroupParams, isDebugEnabled) - - def backoutOnFailure = execution.getVariable(prefix+"backoutOnFailure") - utils.log("DEBUG", "backoutOnFailure: "+ backoutOnFailure, isDebugEnabled) - - def failIfExists = execution.getVariable("failIfExists") - if(failIfExists == null) { - failIfExists = 'true' - } - - String messageId = UUID.randomUUID() - utils.log("DEBUG", "messageId to be used is generated: " + messageId, isDebugEnabled) - - def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) - def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") - if ('true'.equals(useQualifiedHostName)) { - notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) - } - utils.log("DEBUG", "CreateVfModuleVolume - notificationUrl: "+ notificationUrl, isDebugEnabled) - - // build request - String vnfSubCreateWorkflowRequest = - """ - - ${cloudSiteId} - ${tenantId} - ${vnfId} - ${vnfName} - ${volumeGroupId} - ${volumeGroupnName} - ${vnfType} - ${vnfVersion} - ${vnfModuleType} - ${modelCustomizationId} - - - vnf_id - ${vnfId} - - - vnf_name - ${vnfName} - - - vf_module_id - ${volumeGroupId} - - - vf_module_name - ${volumeGroupnName} - - ${volumeGroupParams} - - true - ${backoutOnFailure} - ${failIfExists} - - ${requestId} - ${serviceId} - - ${messageId} - ${notificationUrl} - - """ - - String vnfSubCreateWorkflowRequestAsString = utils.formatXml(vnfSubCreateWorkflowRequest) - utils.logAudit(vnfSubCreateWorkflowRequestAsString) - utils.log('DEBUG', vnfSubCreateWorkflowRequestAsString, isDebugEnabled) - execution.setVariable(prefix+"createVnfARequest", vnfSubCreateWorkflowRequestAsString) - - // build rollback request for use later if needed - String vnfSubRollbackWorkflowRequest = buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) - - utils.log("DEBUG", "Sub Vnf flow rollback request: vnfSubRollbackWorkflowRequest " + "\n" + vnfSubRollbackWorkflowRequest, isDebugEnabled) - - String vnfSubRollbackWorkflowRequestAsString = utils.formatXml(vnfSubRollbackWorkflowRequest) - execution.setVariable(prefix+"rollbackVnfARequest", vnfSubRollbackWorkflowRequestAsString) - } - - public String buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) { - - def request = """ - - - ${volumeGroupId} - {{VOLUMEGROUPSTACKID}} - ${tenantId} - ${cloudSiteId} - true - - ${requestId} - ${serviceId} - - ${messageId} - - true - ${notificationUrl} - - """ - - return request - } - - public String updateRollbackVolumeGroupRequestXml(String rollabackRequest, String heatStackId) { - String newRequest = rollabackRequest.replace("{{VOLUMEGROUPSTACKID}}", heatStackId) - return newRequest - } - - /** - * Validate VNF adapter response - * @param execution - */ - public void validateVnfResponse(DelegateExecution execution, isDebugEnabled) { - def vnfSuccess = execution.getVariable('VNFREST_SuccessIndicator') - utils.log("DEBUG", "vnfAdapterSuccessIndicator: "+ vnfSuccess, isDebugEnabled) - if(vnfSuccess==true) { - String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse") - String heatStackID = utils.getNodeText1(createVnfAResponse, "volumeGroupStackId") - String vnfRollbackRequest = execution.getVariable(prefix+"rollbackVnfARequest") - String updatedVnfRollbackRequest = updateRollbackVolumeGroupRequestXml(vnfRollbackRequest, heatStackID) - utils.log("DEBUG", "vnfAdapter rollback request: "+ updatedVnfRollbackRequest, isDebugEnabled) - RollbackData rollbackData = execution.getVariable("rollbackData") - rollbackData.put("DCVFMODULEVOL", "rollbackVnfARequest", updatedVnfRollbackRequest) - rollbackData.put("DCVFMODULEVOL", "isCreateVnfRollbackNeeded", "true") - } - } - - - /** - * Update voulume group in AAI - * @TODO: Can we re-use the create method?? - * @param execution - * @param isDebugEnabled - */ - public void callRESTUpdateCreatedVolGrpName(DelegateExecution execution, isDebugEnabled) { - - String requeryAAIVolGrpNameResponse = execution.getVariable(prefix+"queryAAIVolGrpNameResponse") - String volumeGroupId = utils.getNodeText1(requeryAAIVolGrpNameResponse, "volume-group-id") - String modelCustomizationId = execution.getVariable("modelCustomizationId") - String cloudRegion = execution.getVariable("lcpCloudRegionId") - - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) - String updateAAIVolumeGroupUrlRequest = aaiEndpoint + '/' + cloudRegion + "/volume-groups/volume-group/" + UriUtils.encode(volumeGroupId, 'UTF-8') - - String namespace = aaiUtil.getNamespaceFromUri(aaiUtil.getCloudInfrastructureCloudRegionUri(execution)) - - utils.logAudit(updateAAIVolumeGroupUrlRequest) - utils.log("DEBUG", "updateAAIVolumeGroupUrlRequest - " + updateAAIVolumeGroupUrlRequest, isDebugEnabled) - - String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse") - def heatStackID = utils.getNodeText1(createVnfAResponse, "volumeGroupStackId") - - execution.setVariable(prefix+"heatStackId", heatStackID) - - NetworkUtils networkUtils = new NetworkUtils() - String payload = networkUtils.updateCloudRegionVolumeRequest(requeryAAIVolGrpNameResponse, heatStackID, namespace, modelCustomizationId) - String payloadXml = utils.formatXml(payload) - - utils.logAudit("Payload to Update Created VolumeGroupName - " + "\n" + payloadXml) - - APIResponse response = aaiUtil.executeAAIPutCall(execution, updateAAIVolumeGroupUrlRequest, payloadXml) - - String returnCode = response.getStatusCode() - String aaiResponseAsString = response.getResponseBodyAsString() - aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) - - utils.logAudit("AAI create volume group return code: " + returnCode) - utils.logAudit("AAI create volume group response: " + aaiResponseAsString) - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - if (returnCode =='200') { - execution.setVariable(prefix+"updateCreatedAAIVolumeGrpNameResponse", aaiResponseAsString) - execution.setVariable(prefix+"isPONR", true) - } else { - execution.setVariable(prefix+"isErrorMessageException", true) - if (returnCode=='404') { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Unable to update volume group in AAI. Response code: 404") - } else { - WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - utils.log("DEBUG", " AAI Adapter Query Failed. WorkflowException - " + "\n" + aWorkflowException, isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - } - } - - - /** - * Query AAI Generic VNF - * @param execution - * @param isDebugEnabled - */ - public void callRESTQueryAAIGenericVnf(DelegateExecution execution, isDebugEnabled) { - - def vnfId = execution.getVariable('vnfId') - - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = aaiUtil.getNetworkGenericVnfEndpoint(execution) - def String queryAAIRequest = aaiEndpoint + "/" + UriUtils.encode(vnfId, "UTF-8") - - utils.logAudit("AAI query generic vnf request: " + queryAAIRequest) - - APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIRequest) - - String returnCode = response.getStatusCode() - String aaiResponseAsString = response.getResponseBodyAsString() - aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) - - utils.logAudit("AAI query generic vnf return code: " + returnCode) - utils.logAudit("AAI query generic vnf response: " + aaiResponseAsString) - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - if (returnCode=='200') { - utils.log("DEBUG", 'Generic vnf ' + vnfId + ' found in AAI.', isDebugEnabled) - execution.setVariable(prefix+'AAIQueryGenericVfnResponse', aaiResponseAsString) - } else { - if (returnCode=='404') { - def message = 'Generic vnf ' + vnfId + ' was not found in AAI. Return code: 404.' - utils.log("DEBUG", message, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, message) - } else { - WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - throw new BpmnError("MSOWorkflowException") - } - } - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy deleted file mode 100644 index adc2b695ef..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy +++ /dev/null @@ -1,643 +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.bpmn.infrastructure.scripts - -import static org.apache.commons.lang3.StringUtils.* - -import org.openecomp.mso.bpmn.core.RollbackData -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.springframework.web.util.UriUtils -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.core.json.JsonUtils - - -/** - * This class supports the DoCreateVnf building block subflow - * with the creation of a generic vnf for - * infrastructure. - * - */ -class DoCreateVnf extends AbstractServiceTaskProcessor { - - String Prefix="DoCVNF_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - - /** - * This method gets and validates the incoming - * request. - * - * @param - execution - * - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED DoCreateVnf PreProcessRequest Process*** ", isDebugEnabled) - - // DISABLE SDNC INTERACTION FOR NOW - execution.setVariable("SDNCInteractionEnabled", false) - - - /*******************/ - try{ - // Get Variables - - def rollbackData = execution.getVariable("rollbackData") - if (rollbackData == null) { - rollbackData = new RollbackData() - } - - String vnfModelInfo = execution.getVariable("vnfModelInfo") - String serviceModelInfo = execution.getVariable("serviceModelInfo") - - String requestId = execution.getVariable("msoRequestId") - execution.setVariable("DoCVNF_requestId", requestId) - execution.setVariable("mso-request-id", requestId) - utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - execution.setVariable("DoCVNF_serviceInstanceId", serviceInstanceId) - rollbackData.put("VNF", "serviceInstanceId", serviceInstanceId) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - - String vnfType = execution.getVariable("vnfType") - execution.setVariable("DoCVNF_vnfType", vnfType) - utils.log("DEBUG", "Incoming Vnf Type is: " + vnfType, isDebugEnabled) - - String vnfName = execution.getVariable("vnfName") - if (vnfName.equals("") || vnfName.equals("null")) { - vnfName = null - } - execution.setVariable("DoCVNF_vnfName", vnfName) - utils.log("DEBUG", "Incoming Vnf Name is: " + vnfName, isDebugEnabled) - - String serviceId = execution.getVariable("productFamilyId") - execution.setVariable("DoCVNF_serviceId", serviceId) - utils.log("DEBUG", "Incoming Service Id is: " + serviceId, isDebugEnabled) - - String source = "VID" - execution.setVariable("DoCVNF_source", source) - rollbackData.put("VNF", "source", source) - utils.log("DEBUG", "Incoming Source is: " + source, isDebugEnabled) - - String suppressRollback = execution.getVariable("disableRollback") - execution.setVariable("DoCVNF_suppressRollback", suppressRollback) - utils.log("DEBUG", "Incoming Suppress Rollback is: " + suppressRollback, isDebugEnabled) - - String modelInvariantId = jsonUtil.getJsonValue(vnfModelInfo, "modelInvariantUuid") - execution.setVariable("DoCVNF_modelInvariantId", modelInvariantId) - utils.log("DEBUG", "Incoming Invariant Id is: " + modelInvariantId, isDebugEnabled) - - String modelVersionId = jsonUtil.getJsonValue(vnfModelInfo, "modelUuid") - if (modelVersionId == null) { - modelVersionId = "" - } - execution.setVariable("DoCVNF_modelVersionId", modelVersionId) - utils.log("DEBUG", "Incoming Version Id is: " + modelVersionId, isDebugEnabled) - - String modelVersion = jsonUtil.getJsonValue(vnfModelInfo, "modelVersion") - execution.setVariable("DoCVNF_modelVersion", modelVersion) - utils.log("DEBUG", "Incoming Model Version is: " + modelVersion, isDebugEnabled) - - String modelName = jsonUtil.getJsonValue(vnfModelInfo, "modelName") - execution.setVariable("DoCVNF_modelName", modelName) - utils.log("DEBUG", "Incoming Model Name is: " + modelName, isDebugEnabled) - - String modelCustomizationId = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationUuid") - if (modelCustomizationId == null) { - modelCustomizationId = "" - } - execution.setVariable("DoCVNF_modelCustomizationId", modelCustomizationId) - utils.log("DEBUG", "Incoming Model Customization Id is: " + modelCustomizationId, isDebugEnabled) - - String cloudSiteId = execution.getVariable("lcpCloudRegionId") - execution.setVariable("DoCVNF_cloudSiteId", cloudSiteId) - rollbackData.put("VNF", "cloudSiteId", cloudSiteId) - utils.log("DEBUG", "Incoming Cloud Site Id is: " + cloudSiteId, isDebugEnabled) - - String tenantId = execution.getVariable("tenantId") - execution.setVariable("DoCVNF_tenantId", tenantId) - rollbackData.put("VNF", "tenantId", tenantId) - utils.log("DEBUG", "Incoming Tenant Id is: " + tenantId, isDebugEnabled) - - String globalSubscriberId = execution.getVariable("globalSubscriberId") - if (globalSubscriberId == null) { - globalSubscriberId = "" - } - execution.setVariable("DoCVNF_globalSubscriberId", globalSubscriberId) - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - - String sdncVersion = execution.getVariable("sdncVersion") - if (sdncVersion == null) { - sdncVersion = "1702" - } - execution.setVariable("DoCVNF_sdncVersion", sdncVersion) - utils.log("DEBUG", "Incoming Sdnc Version is: " + sdncVersion, isDebugEnabled) - - //For Completion Handler & Fallout Handler - String requestInfo = - """ - ${requestId} - CREATE - ${source} - """ - - execution.setVariable("DoCVNF_requestInfo", requestInfo) - //TODO: Orch Status - TBD, will come from SDN-C Response in 1702 - String orchStatus = "Created" - execution.setVariable("DoCVNF_orchStatus", orchStatus) - - //TODO: Equipment Role - Should come from SDN-C Response in 1702 - String equipmentRole = " " - execution.setVariable("DoCVNF_equipmentRole", equipmentRole) - String vnfId = execution.getVariable("testVnfId") // for junits - if(isBlank(vnfId)){ - vnfId = execution.getVariable("vnfId") - if (isBlank(vnfId)) { - vnfId = UUID.randomUUID().toString() - utils.log("DEBUG", "Generated Vnf Id is: " + vnfId, isDebugEnabled) - } - } - execution.setVariable("DoCVNF_vnfId", vnfId) - - // Setting for Sub Flow Calls - execution.setVariable("DoCVNF_type", "generic-vnf") - execution.setVariable("GENGS_type", "service-instance") - - String sdncCallbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { - def msg = 'Required variable \'URN_mso_workflow_sdncadapter_callback\' is missing' - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - execution.setVariable("DoCVNF_sdncCallbackUrl", sdncCallbackUrl) - rollbackData.put("VNF", "sdncCallbackUrl", sdncCallbackUrl) - utils.logAudit("SDNC Callback URL: " + sdncCallbackUrl) - logDebug("SDNC Callback URL is: " + sdncCallbackUrl, isDebugEnabled) - - VnfResource vnfResource = (VnfResource) execution.getVariable((String)"vnfResourceDecomposition") - String nfRole = vnfResource.getNfRole() - - execution.setVariable("DoCVNF_nfRole", nfRole) - logDebug("NF Role is: " + nfRole, isDebugEnabled) - - String nfNamingCode = vnfResource.getNfNamingCode() - execution.setVariable("DoCVNF_nfNamingCode", nfNamingCode) - logDebug("NF Naming Code is: " + nfNamingCode, isDebugEnabled) - - String nfType = vnfResource.getNfType() - execution.setVariable("DoCVNF_nfType", nfType) - logDebug("NF Type is: " + nfType, isDebugEnabled) - - String nfFunction = vnfResource.getNfFunction() - execution.setVariable("DoCVNF_nfFunction", nfFunction) - logDebug("NF Function is: " + nfFunction, isDebugEnabled) - - rollbackData.put("VNF", "rollbackSDNCAssign", "false") - rollbackData.put("VNF", "rollbackSDNCActivate", "false") - rollbackData.put("VNF", "rollbackVnfCreate", "false") - - execution.setVariable("rollbackData", rollbackData) - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", " Error Occured in DoCreateVnf PreProcessRequest method!" + e.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest") - - } - utils.log("DEBUG", "*** COMPLETED DoCreateVnf PreProcessRequest Process ***", isDebugEnabled) - } - - private Object getVariableEnforced(DelegateExecution execution, String name){ - Object enforced = execution.getVariable(name) - if(!enforced){ - return ""; - } - return enforced; - } - - public void prepareCreateGenericVnf (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " *** STARTED DoCreateVnf PrepareCreateGenericVnf Process *** ", isDebugEnabled) - try { - //Get Vnf Info - String vnfId = getVariableEnforced(execution, "DoCVNF_vnfId") - String vnfName = getVariableEnforced(execution, "DoCVNF_vnfName") - if (vnfName == null) { - vnfName = "sdncGenerated" - utils.log("DEBUG", "Sending a dummy VNF name to AAI - the name will be generated by SDNC: " + vnfName, isDebugEnabled) - } - String vnfType = getVariableEnforced(execution, "DoCVNF_vnfType") - utils.log("DEBUG", "WE ARE HERE:" + vnfType, isDebugEnabled) - String serviceId = getVariableEnforced(execution, "DoCVNF_serviceId") - String orchStatus = getVariableEnforced(execution, "DoCVNF_orchStatus") - String modelInvariantId = getVariableEnforced(execution, "DoCVNF_modelInvariantId") - String modelVersionId = getVariableEnforced(execution, "DoCVNF_modelVersionId") - String modelCustomizationId = getVariableEnforced(execution, "DoCVNF_modelCustomizationId") - // TODO: 1702 Variable - String equipmentRole = getVariableEnforced(execution, "DoCVNF_equipmentRole") - String nfType = getVariableEnforced(execution, "DoCVNF_nfType") - String nfRole = getVariableEnforced(execution, "DoCVNF_nfRole") - String nfFunction = getVariableEnforced(execution, "DoCVNF_nfFunction") - String nfNamingCode = getVariableEnforced(execution, "DoCVNF_nfNamingCode") - - //Get Service Instance Info - String serviceInstanceId = getVariableEnforced(execution, "DoCVNF_serviceInstanceId") - String siRelatedLink = getVariableEnforced(execution, "GENGS_siResourceLink") - - int custStart = siRelatedLink.indexOf("customer/") - int custEnd = siRelatedLink.indexOf("/service-subscriptions") - String globalCustId = siRelatedLink.substring(custStart + 9, custEnd) - int serviceStart = siRelatedLink.indexOf("service-subscription/") - int serviceEnd = siRelatedLink.indexOf("/service-instances/") - String serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd) - serviceType = UriUtils.decode(serviceType,"UTF-8") - - //Get Namespace - AaiUtil aaiUtil = new AaiUtil(this) - def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution) - String namespace = aaiUtil.getNamespaceFromUri(execution, aai_uri) - - String payload = - """ - ${vnfId} - ${vnfName} - ${serviceId} - ${vnfType} - PREPROV - ${orchStatus} - ${modelInvariantId} - ${modelVersionId} - ${modelCustomizationId} - ${nfType} - ${nfRole} - ${nfFunction} - ${nfNamingCode} - - - service-instance - ${siRelatedLink} - - customer.global-customer-id - ${globalCustId} - - - service-subscription.service-type - ${serviceType} - - - service-instance.service-instance-id - ${serviceInstanceId} - - - - """ - - execution.setVariable("DoCVNF_genericVnfPayload", payload) - - }catch(Exception ex) { - utils.log("DEBUG", "Error Occured in DoCreateVnf PrepareCreateGenericVnf Process " + ex.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PrepareCreateGenericVnf Process") - } - utils.log("DEBUG", "*** COMPLETED DoCreateVnf PrepareCreateGenericVnf Process ***", isDebugEnabled) - } - - public void postProcessCreateGenericVnf (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " *** STARTED DoCreateVnf PostProcessCreateGenericVnf Process *** ", isDebugEnabled) - try { - //Get Vnf Info - String vnfId = execution.getVariable("DoCVNF_vnfId") - def rollbackData = execution.getVariable("rollbackData") - rollbackData.put("VNF", "vnfId", vnfId) - rollbackData.put("VNF", "rollbackVnfCreate", "true") - execution.setVariable("rollbackData", rollbackData) - }catch(Exception ex) { - utils.log("DEBUG", "Error Occured in DoCreateVnf PostProcessCreateGenericVnf Process " + ex.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PostProcessCreateGenericVnf Process") - } - utils.log("DEBUG", "*** COMPLETED DoCreateVnf PostProcessCreateGenericVnf Process ***", isDebugEnabled) - } - - - public void preProcessSDNCAssignRequest(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) - def vnfId = execution.getVariable("DoCVNF_vnfId") - def serviceInstanceId = execution.getVariable("DoCVNF_serviceInstanceId") - logDebug("NEW VNF ID: " + vnfId, isDebugLogEnabled) - utils.logAudit("NEW VNF ID: " + vnfId) - - try{ - //Build SDNC Request - - String assignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "assign") - - assignSDNCRequest = utils.formatXml(assignSDNCRequest) - execution.setVariable("DoCVNF_assignSDNCRequest", assignSDNCRequest) - logDebug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest, isDebugLogEnabled) - utils.logAudit("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessSDNCAssignRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCAssignRequest Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) - } - - public void preProcessSDNCActivateRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled) - try{ - String vnfId = execution.getVariable("DoCVNF_vnfId") - String serviceInstanceId = execution.getVariable("DoCVNF_serviceInstanceId") - - String activateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "activate") - - execution.setVariable("DoCVNF_activateSDNCRequest", activateSDNCRequest) - logDebug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest, isDebugLogEnabled) - utils.logAudit("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest) - - }catch(Exception e){ - log.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled) - } - - public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ - - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("DoCVNF_requestId") + "-" + System.currentTimeMillis() - } - def callbackURL = execution.getVariable("DoCVNF_sdncCallbackUrl") - def requestId = execution.getVariable("DoCVNF_requestId") - def serviceId = execution.getVariable("DoCVNF_serviceId") - def vnfType = execution.getVariable("DoCVNF_vnfType") - def vnfName = execution.getVariable("DoCVNF_vnfName") - // Only send vnfName to SDNC if it is not null, otherwise it will get generated by SDNC on Assign - String vnfNameString = "" - if (vnfName != null) { - vnfNameString = """${vnfName}""" - } - def tenantId = execution.getVariable("DoCVNF_tenantId") - def source = execution.getVariable("DoCVNF_source") - def vnfId = execution.getVariable("DoCVNF_vnfId") - def cloudSiteId = execution.getVariable("DoCVNF_cloudSiteId") - def modelCustomizationId = execution.getVariable("DoCVNF_modelCustomizationId") - def serviceModelInfo = execution.getVariable("serviceModelInfo") - def vnfModelInfo = execution.getVariable("vnfModelInfo") - String serviceEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(serviceModelInfo) - String vnfEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(vnfModelInfo) - def globalSubscriberId = execution.getVariable("DoCVNF_globalSubscriberId") - def sdncVersion = execution.getVariable("DoCVNF_sdncVersion") - - String sdncVNFParamsXml = "" - - if(execution.getVariable("DoCVNF_vnfParamsExistFlag") == true){ - sdncVNFParamsXml = buildSDNCParamsXml(execution) - }else{ - sdncVNFParamsXml = "" - } - - String sdncRequest = - """ - - ${uuid} - ${svcInstId} - ${action} - vnf-topology-operation - ${callbackURL} - generic-resource - - - - ${requestId} - CreateVnfInstance - ${source} - - - - - - ${serviceId} - ${serviceId} - ${serviceEcompModelInformation} - ${svcInstId} - ${globalSubscriberId} - - - ${vnfId} - ${vnfType} - ${vnfEcompModelInformation} - - - ${vnfNameString} - ${tenantId} - ${cloudSiteId} - ${sdncVNFParamsXml} - - - """ - - utils.logAudit("sdncRequest: " + sdncRequest) - return sdncRequest - } - - public void validateSDNCResponse(DelegateExecution execution, String response, String method){ - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled) - - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - utils.logAudit("workflowException: " + workflowException) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - utils.logAudit("SDNCResponse: " + response) - - String sdncResponse = response - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - logDebug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse, isDebugLogEnabled) - if(method.equals("get")){ - String topologyGetResponse = execution.getVariable("DoCVNF_getSDNCAdapterResponse") - String data = utils.getNodeXml(topologyGetResponse, "response-data") - data = data.replaceAll("<", "<") - data = data.replaceAll(">", ">") - utils.log("DEBUG", "topologyGetResponseData: " + data, isDebugLogEnabled) - String vnfName = utils.getNodeText1(data, "vnf-name") - utils.log("DEBUG", "vnfName received from SDNC: " + vnfName, isDebugLogEnabled) - execution.setVariable("vnfName", vnfName) - execution.setVariable("DoCVNF_vnfName", vnfName) - } - def rollbackData = execution.getVariable("rollbackData") - if (method.equals("assign")) { - rollbackData.put("VNF", "rollbackSDNCAssign", "true") - } - else if (method.equals("activate")) { - rollbackData.put("VNF", "rollbackSDNCActivate", "true") - } - execution.setVariable("rollbackData", rollbackData) - - - }else{ - logDebug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) - throw new BpmnError("MSOWorkflowException") - } - logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled) - } - - public void preProcessSDNCGetRequest(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - utils.log("DEBUG", " ======== STARTED preProcessSDNCGetRequest Process ======== ", isDebugLogEnabled) - try{ - def serviceInstanceId = execution.getVariable('DoCVNF_serviceInstanceId') - - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() - } - - def callbackUrl = execution.getVariable("DoCVFM_sdncCallbackUrl") - utils.logAudit("callbackUrl:" + callbackUrl) - - def vnfId = execution.getVariable('DCVFM_vnfId') - - def svcInstId = "" - if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { - svcInstId = vnfId - } - else { - svcInstId = serviceInstanceId - } - // serviceOperation will be retrieved from "object-path" element - // in SDNC Assign Response for VNF - String response = execution.getVariable("DoCVNF_assignSDNCAdapterResponse") - utils.logAudit("DoCVNF_assignSDNCAdapterResponse is: \n" + response) - - String serviceOperation = "" - - String data = utils.getNodeXml(response, "response-data") - data = data.replaceAll("<", "<") - data = data.replaceAll(">", ">") - utils.log("DEBUG", "responseData: " + data, isDebugLogEnabled) - serviceOperation = utils.getNodeText1(data, "object-path") - utils.log("DEBUG", "VNF with sdncVersion of 1707 or later - service operation: " + serviceOperation, isDebugLogEnabled) - - - //!!!! TEMPORARY WORKAROUND FOR SDNC REPLICATION ISSUE - sleep(5000) - - String SDNCGetRequest = - """ - - ${uuid} - ${svcInstId} - query - ${serviceOperation} - ${callbackUrl} - vfmodule - - - """ - - utils.logAudit("SDNCGetRequest: \n" + SDNCGetRequest) - execution.setVariable("DoCVNF_getSDNCRequest", SDNCGetRequest) - utils.log("DEBUG", "Outgoing GetSDNCRequest is: \n" + SDNCGetRequest, isDebugLogEnabled) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occurred Processing preProcessSDNCGetRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) - } - utils.log("DEBUG", "======== COMPLETED preProcessSDNCGetRequest Process ======== ", isDebugLogEnabled) - } - - /** - * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. - * - * @param execution The flow's execution instance. - */ - public void prepUpdateAAIGenericVnf(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def vnfId = execution.getVariable('DoCVNF_vnfId') - logDebug("VNF ID: " + vnfId, isDebugLogEnabled) - - String updateAAIGenericVnfRequest = """ - - ${vnfId} - Active - - """ - updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) - execution.setVariable('DoCVNF_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) - utils.logAudit("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) - logDebug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest, isDebugLogEnabled) - - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) - } - } - - - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy deleted file mode 100644 index 4e570f87a9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy +++ /dev/null @@ -1,411 +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.bpmn.infrastructure.scripts - -import java.util.UUID; -import java.util.List - -import org.json.JSONObject; -import org.json.JSONArray; -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.ModuleResource -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.core.json.DecomposeJsonUtil -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution; - -import static org.apache.commons.lang3.StringUtils.*; - - - -/** -* This class supports the macro VID Flow -* with the creation of a generic vnf and related VF modules. -*/ -class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { - - String Prefix="DCVAM_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - CatalogDbUtils cutils = new CatalogDbUtils() - - /** - * This method gets and validates the incoming - * request. - * - * @param - execution - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED DoCreateVnfAndModules PreProcessRequest Process*** ", isDebugLogEnabled) - - setBasicDBAuthHeader(execution, isDebugLogEnabled) - try{ - // Get Variables - - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - String vnfModelInfo = execution.getVariable("vnfModelInfo") - - String requestId = execution.getVariable("msoRequestId") - execution.setVariable("requestId", requestId) - execution.setVariable("mso-request-id", requestId) - utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugLogEnabled) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugLogEnabled) - - String vnfName = execution.getVariable("vnfName") - execution.setVariable("CREVI_vnfName", vnfName) - utils.log("DEBUG", "Incoming Vnf Name is: " + vnfName, isDebugLogEnabled) - - String productFamilyId = execution.getVariable("productFamilyId") - utils.log("DEBUG", "Incoming Product Family Id is: " + productFamilyId, isDebugLogEnabled) - - String source = "VID" - execution.setVariable("source", source) - utils.log("DEBUG", "Incoming Source is: " + source, isDebugLogEnabled) - - String lcpCloudRegionId = execution.getVariable("lcpCloudRegionId") - utils.log("DEBUG", "Incoming LCP Cloud Region Id is: " + lcpCloudRegionId) - - String tenantId = execution.getVariable("tenantId") - utils.log("DEBUG", "Incoming Tenant Id is: " + tenantId) - - String disableRollback = execution.getVariable("disableRollback") - utils.log("DEBUG", "Incoming Disable Rollback is: " + disableRollback, isDebugLogEnabled) - - String asdcServiceModelVersion = execution.getVariable("asdcServiceModelVersion") - utils.log("DEBUG", "Incoming asdcServiceModelVersion: " + asdcServiceModelVersion, isDebugLogEnabled) - - String vnfId = execution.getVariable("testVnfId") // for junits - if(isBlank(vnfId)){ - vnfId = execution.getVariable("vnfId") - if (isBlank(vnfId)) { - vnfId = UUID.randomUUID().toString() - utils.log("DEBUG", "Generated Vnf Id is: " + vnfId, isDebugLogEnabled) - } - } - execution.setVariable("vnfId", vnfId) - - // Set aLaCarte to false - execution.setVariable("aLaCarte", false) - - def rollbackData = execution.getVariable("rollbackData") - if (rollbackData == null) { - rollbackData = new RollbackData() - } - - def isTest = execution.getVariable("isTest") - - if (isTest == null || isTest == false) { - execution.setVariable("isBaseVfModule", "true") - } - execution.setVariable("numOfCreatedAddOnModules", 0) - - rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0") - execution.setVariable("rollbackData", rollbackData) - - sleep (20000) - - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugLogEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", " Error Occured in DoCreateVnfAndModules PreProcessRequest method!" + e.getMessage(), isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest") - - } - utils.log("DEBUG", "*** COMPLETED DoCreateVnfAndModules PreProcessRequest Process ***", isDebugLogEnabled) - } - - - public void queryCatalogDB (DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " *** STARTED DoCreateVnfAndModules QueryCatalogDB Process *** ", isDebugLogEnabled) - try { - VnfResource vnf = null - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - // if serviceDecomposition is specified, get info from serviceDecomposition - if (serviceDecomposition != null) { - utils.log("DEBUG", "Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString(), isDebugLogEnabled) - List vnfs = serviceDecomposition.getServiceVnfs() - utils.log("DEBUG", "Read vnfs", isDebugLogEnabled) - if (vnfs == null) { - utils.log("DEBUG", "Error - vnfs are empty in serviceDecomposition object", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf queryCatalogDB, vnfs are empty") - } - vnf = vnfs[0] - String serviceModelName = serviceDecomposition.getModelInfo().getModelName() - vnf.constructVnfType(serviceModelName) - String vnfType = vnf.getVnfType() - utils.log("DEBUG", "Incoming Vnf Type is: " + vnfType, isDebugLogEnabled) - execution.setVariable("vnfType", vnfType) - } - else { - //Get Vnf Info - String vnfModelInfo = execution.getVariable("vnfModelInfo") - utils.log("DEBUG", "vnfModelInfo: " + vnfModelInfo, isDebugLogEnabled) - String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationUuid") - if (vnfModelCustomizationUuid == null) { - vnfModelCustomizationUuid = "" - } - utils.log("DEBUG", "querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid, isDebugLogEnabled) - - JSONArray vnfs = cutils.getAllVnfsByVnfModelCustomizationUuid(execution, - vnfModelCustomizationUuid) - utils.log("DEBUG", "obtained VNF list") - // Only one match here - JSONObject vnfObject = vnfs[0] - vnf = DecomposeJsonUtil.jsonToVnfResource(vnfObject.toString()) - } - utils.log("DEBUG", "Read vnfResource", isDebugLogEnabled) - if (vnf == null) { - utils.log("DEBUG", "Error - vnf is empty in serviceDecomposition object", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf queryCatalogDB, vnf is null") - } - execution.setVariable("vnfResourceDecomposition", vnf) - - List vfModules = vnf.getAllVfModuleObjects() - utils.log("DEBUG", "Read vfModules", isDebugLogEnabled) - if (vfModules == null) { - utils.log("DEBUG", "Error - vfModules are empty in serviceDecomposition object", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf queryCatalogDB, vf modules are empty") - } - - ModuleResource baseVfModule = null - - for (int i = 0; i < vfModules.size; i++) { - utils.log("DEBUG", "handling VF Module ", isDebugLogEnabled) - ModuleResource vfModule = vfModules[i] - boolean isBase = vfModule.getIsBase() - if (isBase) { - ModelInfo baseVfModuleModelInfoObject = vfModule.getModelInfo() - String baseVfModuleModelInfoWithRoot = baseVfModuleModelInfoObject.toString() - String baseVfModuleModelInfo = jsonUtil.getJsonValue(baseVfModuleModelInfoWithRoot, "modelInfo") - execution.setVariable("baseVfModuleModelInfo", baseVfModuleModelInfo) - String baseVfModuleLabel = vfModule.getVfModuleLabel() - execution.setVariable("baseVfModuleLabel", baseVfModuleLabel) - String basePersonaModelId = baseVfModuleModelInfoObject.getModelInvariantUuid() - execution.setVariable("basePersonaModelId", basePersonaModelId) - baseVfModule = vfModule - break - } - - } - - ListaddOnModules = vfModules - baseVfModule - - int addOnModulesToDeploy = 0 - if (addOnModules != null) { - addOnModulesToDeploy = addOnModules.size - } - - utils.log("DEBUG", "AddOnModulesToDeploy: " + addOnModulesToDeploy) - - execution.setVariable("addOnModules", addOnModules) - execution.setVariable("addOnModulesToDeploy", addOnModulesToDeploy) - execution.setVariable("addOnModulesDeployed", 0) - - }catch(Exception ex) { - utils.log("DEBUG", "Error Occured in DoCreateVnfAndModules QueryCatalogDB Process " + ex.getMessage(), isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnfAndModules QueryCatalogDB Process") - } - - // Generate vfModuleId for base VF Module - def baseVfModuleId = UUID.randomUUID().toString() - execution.setVariable("baseVfModuleId", baseVfModuleId) - // For JUnits - String requestId = execution.getVariable("requestId") - if (requestId.equals("testRequestId123")) { - execution.setVariable("vnfId", "skask") - } - - utils.log("DEBUG", "*** COMPLETED DoCreateVnfAndModules QueryCatalogDB Process ***", isDebugLogEnabled) - } - - public void preProcessAddOnModule(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessAddOnModule ======== ", isDebugLogEnabled) - - try { - ListaddOnModules = execution.getVariable("addOnModules") - int addOnIndex = (int) execution.getVariable("addOnModulesDeployed") - - ModuleResource addOnModule = addOnModules[addOnIndex] - - utils.log("DEBUG", "Got addon module", isDebugLogEnabled) - - def newVfModuleId = UUID.randomUUID().toString() - execution.setVariable("addOnVfModuleId", newVfModuleId) - execution.setVariable("isBaseVfModule", "false") - - execution.setVariable("instancesOfThisModuleDeployed", 0) - - ModelInfo addOnVfModuleModelInfoObject = addOnModule.getModelInfo() - String addOnVfModuleModelInfoWithRoot = addOnVfModuleModelInfoObject.toString() - String addOnVfModuleModelInfo = jsonUtil.getJsonValue(addOnVfModuleModelInfoWithRoot, "modelInfo") - execution.setVariable("addOnVfModuleModelInfo", addOnVfModuleModelInfo) - String addOnVfModuleLabel = addOnModule.getVfModuleLabel() - execution.setVariable("addOnVfModuleLabel", addOnVfModuleLabel) - String addOnPersonaModelId = addOnVfModuleModelInfoObject.getModelInvariantUuid() - execution.setVariable("addOnPersonaModelId", addOnPersonaModelId) - int addOnInitialCount = addOnModule.getInitialCount() - execution.setVariable("initialCount", addOnInitialCount) - - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessAddOnModule ======== ", isDebugLogEnabled) - } - - public void postProcessAddOnModule(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED postProcessAddOnModule ======== ", isDebugLogEnabled) - - try { - int addOnModulesDeployed = execution.getVariable("addOnModulesDeployed") - execution.setVariable("addOnModulesDeployed", addOnModulesDeployed + 1) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing postProcessAddOnModule. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessAddOnModule Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED postProcessAddOnModule ======== ", isDebugLogEnabled) - } - - public void validateBaseModule(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED validateBaseModule ======== ", isDebugLogEnabled) - - try { - def baseRollbackData = execution.getVariable("DCVAM_baseRollbackData") - def rollbackData = execution.getVariable("rollbackData") - - def baseModuleMap = baseRollbackData.get("VFMODULE") - baseModuleMap.each{ k, v -> rollbackData.put("VFMODULE_BASE", "${k}","${v}") } - execution.setVariable("rollbackData", rollbackData) - logDebug("addOnModulesDeployed: " + execution.getVariable("addOnModulesDeployed"), isDebugLogEnabled) - logDebug("addOnModulesToDeploy: " + execution.getVariable("addOnModulesToDeploy"), isDebugLogEnabled) - if (execution.getVariable("addOnModulesDeployed") < execution.getVariable("addOnModulesToDeploy")) { - logDebug("More add on modules to deploy", isDebugLogEnabled) - } - else { - logDebug("No more add on modules to deploy", isDebugLogEnabled) - } - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing validateBaseModule. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during validateBaseModule Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED validateBaseModule ======== ", isDebugLogEnabled) - } - - public void validateAddOnModule(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED validateAddOnModule ======== ", isDebugLogEnabled) - - try { - int instancesOfThisModuleDeployed = execution.getVariable("instancesOfThisModuleDeployed") - int numOfCreatedAddOnModules = execution.getVariable("numOfCreatedAddOnModules") - def addOnRollbackData = execution.getVariable("DCVAM_addOnRollbackData") - def rollbackData = execution.getVariable("rollbackData") - - def addOnModuleMap = addOnRollbackData.get("VFMODULE") - numOfCreatedAddOnModules = numOfCreatedAddOnModules + 1 - addOnModuleMap.each{ k, v -> rollbackData.put("VFMODULE_ADDON_" + numOfCreatedAddOnModules, "${k}","${v}") } - - execution.setVariable("DCVAM_addOnRollbackData", null) - - execution.setVariable("instancesOfThisModuleDeployed", instancesOfThisModuleDeployed + 1) - - execution.setVariable("numOfCreatedAddOnModules", numOfCreatedAddOnModules) - rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "${numOfCreatedAddOnModules}") - execution.setVariable("rollbackData", rollbackData) - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED validateAddOnModule ======== ", isDebugLogEnabled) - } - - public void preProcessRollback (DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugLogEnabled) - try { - - Object workflowException = execution.getVariable("WorkflowException"); - - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugLogEnabled) - execution.setVariable("prevWorkflowException", workflowException); - //execution.setVariable("WorkflowException", null); - } - } catch (BpmnError e) { - utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugLogEnabled) - } catch(Exception ex) { - String msg = "Exception in preProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - } - utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugLogEnabled) - } - - public void postProcessRollback (DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugLogEnabled) - String msg = "" - try { - Object workflowException = execution.getVariable("prevWorkflowException"); - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugLogEnabled) - execution.setVariable("WorkflowException", workflowException); - } - execution.setVariable("rollbackData", null) - } catch (BpmnError b) { - utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugLogEnabled) - throw b; - } catch(Exception ex) { - msg = "Exception in postProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - } - utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugLogEnabled) - } - - -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy deleted file mode 100644 index e931903ea5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy +++ /dev/null @@ -1,366 +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.bpmn.infrastructure.scripts - -import java.util.UUID; - -import org.json.JSONObject; -import org.json.JSONArray; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution; - -import static org.apache.commons.lang3.StringUtils.*; - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException - -/** - * This class supports the macro VID Flow - * with the rollback of a creation of a generic vnf and related VF modules. - */ -class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { - - String Prefix="DCVAMR_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - - /** - * This method gets and validates the incoming - * request. - * - * @param - execution - * - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED DoCreateVnfAndModulesRollback PreProcessRequest Process*** ", isDebugEnabled) - - try{ - // Get Rollback Variables - - def rollbackData = execution.getVariable("rollbackData") - utils.log("DEBUG", "Incoming RollbackData is: " + rollbackData.toString(), isDebugEnabled) - execution.setVariable("rolledBack", null) - execution.setVariable("rollbackError", null) - - if (execution.getVariable("disableRollback").equals("true" )) - { - execution.setVariable("skipRollback", true) - } - - String vnfId = rollbackData.get("VNF", "vnfId") - utils.log("DEBUG", "Rollback vnfId is: " + vnfId, isDebugEnabled) - execution.setVariable("DCVAMR_vnfId", vnfId) - - execution.setVariable("mso-request-id", execution.getVariable("msoRequestId")) - - execution.setVariable("DCVAMR_rollbackSDNCAssign", rollbackData.get("VNF", "rollbackSDNCAssign")) - execution.setVariable("DCVAMR_rollbackSDNCActivate", rollbackData.get("VNF", "rollbackSDNCActivate")) - execution.setVariable("DCVAMR_rollbackVnfCreate", rollbackData.get("VNF", "rollbackVnfCreate")) - - String sdncCallbackUrl = rollbackData.get("VNF", "sdncCallbackUrl") - utils.log("DEBUG", "Rollback sdncCallbackUrl is: " + sdncCallbackUrl, isDebugEnabled) - execution.setVariable("DCVAMR_sdncCallbackUrl", sdncCallbackUrl) - - String tenantId= rollbackData.get("VNF", "tenantId") - utils.log("DEBUG", "Rollback tenantId is: " + tenantId, isDebugEnabled) - execution.setVariable("DCVAMR_tenantId", tenantId) - - String source= rollbackData.get("VNF", "source") - utils.log("DEBUG", "Rollback source is: " + source, isDebugEnabled) - execution.setVariable("DCVAMR_source", source) - - String serviceInstanceId = rollbackData.get("VNF", "serviceInstanceId") - utils.log("DEBUG", "Rollback serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) - execution.setVariable("DCVAMR_serviceInstanceId", serviceInstanceId) - - String cloudSiteId = rollbackData.get("VNF", "cloudSiteId") - utils.log("DEBUG", "Rollback cloudSiteId is: " + cloudSiteId, isDebugEnabled) - execution.setVariable("DCVAMR_cloudSiteId", cloudSiteId) - - def numOfAddOnModulesString = rollbackData.get("VNFANDMODULES", "numOfCreatedAddOnModules") - int numOfAddOnModules = 0 - if (numOfAddOnModulesString != null) { - numOfAddOnModules = Integer.parseInt(numOfAddOnModulesString) - } - execution.setVariable("DCVAMR_numOfAddOnModules", numOfAddOnModules) - - def baseVfModuleRollbackMap = rollbackData.get("VFMODULE_BASE") - if (baseVfModuleRollbackMap == null) { - // there are no VF Modules to delete - execution.setVariable("DCVAMR_numOfModulesToDelete", 0) - } - else { - execution.setVariable("DCVAMR_numOfModulesToDelete", numOfAddOnModules + 1) - } - - // Set aLaCarte to false - execution.setVariable("DCVAMR_aLaCarte", false) - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", " Error Occured in DoCreateVnfAndModulesRollback PreProcessRequest method!" + e.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnfAndModulesRollback PreProcessRequest") - - } - utils.log("DEBUG", "*** COMPLETED DoCreateVnfAndModulesRollback PreProcessRequest Process ***", isDebugEnabled) - } - - - - public void preProcessCreateVfModuleRollback(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessCreateVfModuleRollback ======== ", isDebugLogEnabled) - - try { - - def rollbackData = execution.getVariable("rollbackData") - - def vfModuleRollbackData = new RollbackData() - - def numOfModulesToDelete = execution.getVariable("DCVAMR_numOfModulesToDelete") - logDebug("numOfModulesToDelete: " + numOfModulesToDelete, isDebugLogEnabled) - def moduleMap = null - - if (numOfModulesToDelete > 1) { - int addOnModuleIndex = numOfModulesToDelete - 1 - moduleMap = rollbackData.get("VFMODULE_ADDON_" + addOnModuleIndex) - logDebug("Removing ADDON VF module # " + addOnModuleIndex, isDebugLogEnabled) - } - else { - moduleMap = rollbackData.get("VFMODULE_BASE") - logDebug("Removing BASE VF module", isDebugLogEnabled) - } - moduleMap.each{ k, v -> vfModuleRollbackData.put("VFMODULE", "${k}","${v}") } - execution.setVariable("DCVAMR_RollbackData", vfModuleRollbackData) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessCreateVfModuleRollback. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessCreateVfModuleRollback Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessCreateVfModuleRollback ======== ", isDebugLogEnabled) - } - - - public void postProcessCreateVfModuleRollback(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED postProcessCreateVfModuleRollback ======== ", isDebugLogEnabled) - def rolledBack = false - - try { - rolledBack = execution.getVariable("DCVM_rolledBack") - def numOfModulesToDelete = execution.getVariable("DCVAMR_numOfModulesToDelete") - execution.setVariable("DCVAMR_numOfModulesToDelete", numOfModulesToDelete - 1) - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing postProcessCreateVfModuleRollback. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessCreateVfModuleRollback Method:\n" + e.getMessage()) - } - if (!rolledBack) { - logDebug("Failure on DoCreateVfModuleRollback", isDebugLogEnabled) - utils.log("ERROR", "Unsuccessful rollback of DoCreateVfModule") - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during rollback of DoCreateVfModule") - } - logDebug("======== COMPLETED postProcessCreateVfModuleRollback ======== ", isDebugLogEnabled) - } - - - public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled) - def vnfId = execution.getVariable("vnfId") - def serviceInstanceId = execution.getVariable("serviceInstanceId") - - try{ - //Build SDNC Request - - String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate") - - deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest) - execution.setVariable(Prefix + "deactivateSDNCRequest", deactivateSDNCRequest) - logDebug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest, isDebugLogEnabled) - utils.logAudit("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled) - } - - public void preProcessSDNCUnassignRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessSDNCUnassignRequest Process ======== ", isDebugLogEnabled) - try{ - String vnfId = execution.getVariable("vnfId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign") - - execution.setVariable(Prefix + "unassignSDNCRequest", unassignSDNCRequest) - logDebug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest, isDebugLogEnabled) - utils.logAudit("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) - - }catch(Exception e){ - log.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessSDNCUnassignRequest Process ======== ", isDebugLogEnabled) - } - - public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ - - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis() - } - def callbackURL = execution.getVariable(Prefix + "sdncCallbackUrl") - def requestId = execution.getVariable("msoRequestId") - def tenantId = execution.getVariable(Prefix + "tenantId") - def source = execution.getVariable(Prefix + "source") - def vnfId = execution.getVariable(Prefix + "vnfId") - def serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - def cloudSiteId = execution.getVariable(Prefix + "cloudSiteId") - - String sdncRequest = - """ - - ${uuid} - ${svcInstId} - ${action} - vnf-topology-operation - ${callbackURL} - generic-resource - - - - ${requestId} - DeleteVnfInstance - ${source} - - - - - - - - ${serviceInstanceId} - - - - ${vnfId} - - - - - ${tenantId} - ${cloudSiteId} - - - """ - - utils.logAudit("sdncRequest: " + sdncRequest) - return sdncRequest - } - - public void validateSDNCResponse(DelegateExecution execution, String response, String method){ - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled) - - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - utils.logAudit("workflowException: " + workflowException) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - utils.logAudit("SDNCResponse: " + response) - - String sdncResponse = response - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - logDebug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse, isDebugLogEnabled) - }else{ - logDebug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) - throw new BpmnError("MSOWorkflowException") - } - logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled) - } - - public void setSuccessfulRollbackStatus (DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED setSuccessfulRollbackStatus ======== ", isDebugLogEnabled) - - try{ - // Set rolledBack to true, rollbackError to null - execution.setVariable("rolledBack", true) - execution.setVariable("rollbackError", null) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing setSuccessfulRollbackStatus. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED setSuccessfulRollbackStatus ======== ", isDebugLogEnabled) - } - - public void setFailedRollbackStatus (DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED setFailedRollbackStatus ======== ", isDebugLogEnabled) - - try{ - // Set rolledBack to false, rollbackError to actual value, rollbackData to null - execution.setVariable("rolledBack", false) - def rollbackError = execution.getVariable("rollbackError") - if (rollbackError == null) { - execution.setVariable("rollbackError", 'Caught exception in DoCreateVnfAndModulesRollback') - } - execution.setVariable("rollbackData", null) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing setFailedRollbackStatus. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED setFailedRollbackStatus ======== ", isDebugLogEnabled) - } - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy deleted file mode 100644 index a32fd7b538..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy +++ /dev/null @@ -1,661 +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.bpmn.infrastructure.scripts - -import org.json.JSONArray; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.List; -import java.util.UUID; -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource - -import com.fasterxml.jackson.jaxrs.json.annotation.JSONP.Def; - -/** - * This groovy class supports the DoDeleteE2EServiceInstance.bpmn process. - * - * Inputs: - * @param - msoRequestId - * @param - globalSubscriberId - O - * @param - subscriptionServiceType - O - * @param - serviceInstanceId - * @param - serviceInstanceName - O - * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) - * @param - sdncVersion - * @param - failNotFound - TODO - * @param - serviceInputParams - TODO - * - * Outputs: - * @param - WorkflowException - * - * Rollback - Deferred - */ -public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { - - String Prefix="DDELSI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled) - String msg = "" - - try { - String requestId = execution.getVariable("msoRequestId") - execution.setVariable("prefix",Prefix) - - //Inputs - //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology - String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId - if (globalSubscriberId == null) - { - execution.setVariable("globalSubscriberId", "") - } - - //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology - String serviceType = execution.getVariable("serviceType") - if (serviceType == null) - { - execution.setVariable("serviceType", "") - } - - //Generated in parent for AAI PUT - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)){ - msg = "Input serviceInstanceId is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (isBlank(sdncCallbackUrl)) { - msg = "URN_mso_workflow_sdncadapter_callback is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) - - StringBuilder sbParams = new StringBuilder() - Map paramsMap = execution.getVariable("serviceInputParams") - if (paramsMap != null) - { - sbParams.append("") - for (Map.Entry entry : paramsMap.entrySet()) { - String paramsXml - String paramName = entry.getKey() - String paramValue = entry.getValue() - paramsXml = - """ - ${paramName} - ${paramValue} - - """ - sbParams.append(paramsXml) - } - sbParams.append("") - } - String siParamsXml = sbParams.toString() - if (siParamsXml == null) - siParamsXml = "" - execution.setVariable("siParamsXml", siParamsXml) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - - public void preProcessVFCDelete (DelegateExecution execution) { - } - - public void postProcessVFCDelete(DelegateExecution execution, String response, String method) { - } - - public void preProcessSDNCDelete (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** preProcessSDNCDelete *****", isDebugEnabled) - String msg = "" - - try { - def serviceInstanceId = execution.getVariable("serviceInstanceId") - def serviceInstanceName = execution.getVariable("serviceInstanceName") - def callbackURL = execution.getVariable("sdncCallbackUrl") - def requestId = execution.getVariable("msoRequestId") - def serviceId = execution.getVariable("productFamilyId") - def subscriptionServiceType = execution.getVariable("subscriptionServiceType") - def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId - - String serviceModelInfo = execution.getVariable("serviceModelInfo") - def modelInvariantUuid = "" - def modelVersion = "" - def modelUuid = "" - def modelName = "" - if (!isBlank(serviceModelInfo)) - { - modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") - modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") - modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid") - modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") - - if (modelInvariantUuid == null) { - modelInvariantUuid = "" - } - if (modelVersion == null) { - modelVersion = "" - } - if (modelUuid == null) { - modelUuid = "" - } - if (modelName == null) { - modelName = "" - } - } - if (serviceInstanceName == null) { - serviceInstanceName = "" - } - if (serviceId == null) { - serviceId = "" - } - - def siParamsXml = execution.getVariable("siParamsXml") - def serviceType = execution.getVariable("serviceType") - if (serviceType == null) - { - serviceType = "" - } - - def sdncRequestId = UUID.randomUUID().toString() - - String sdncDelete = - """ - - ${sdncRequestId} - ${serviceInstanceId} - delete - service-topology-operation - ${callbackURL} - ${serviceType} - - - - ${requestId} - MSO - - - - DeleteServiceInstance - - - ${serviceId} - ${subscriptionServiceType} - - ${modelInvariantUuid} - ${modelUuid} - ${modelVersion} - ${modelName} - - ${serviceInstanceId} - - ${globalSubscriberId} - - - ${serviceInstanceName} - ${siParamsXml} - - - """ - - sdncDelete = utils.formatXml(sdncDelete) - def sdncRequestId2 = UUID.randomUUID().toString() - String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") - execution.setVariable("sdncDelete", sdncDelete) - execution.setVariable("sdncDeactivate", sdncDeactivate) - utils.log("INFO","sdncDeactivate:\n" + sdncDeactivate, isDebugEnabled) - utils.log("INFO","sdncDelete:\n" + sdncDelete, isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage()) - } - utils.log("INFO"," *****Exit preProcessSDNCDelete *****", isDebugEnabled) - } - - public void postProcessSDNCDelete(DelegateExecution execution, String response, String method) { - - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessSDNC " + method + " *****", isDebugEnabled) - String msg = "" - - /*try { - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - utils.log("INFO", "SDNCResponse: " + response, isDebugEnabled) - utils.log("INFO", "workflowException: " + workflowException, isDebugEnabled) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == "true"){ - utils.log("INFO","Good response from SDNC Adapter for service-instance " + method + "response:\n" + response, isDebugEnabled) - - }else{ - msg = "Bad Response from SDNC Adapter for service-instance " + method - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg) - } - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in postProcessSDNC " + method + " Exception:" + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - }*/ - utils.log("INFO"," *** Exit postProcessSDNC " + method + " ***", isDebugEnabled) - } - - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) - String msg = "" - - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - String serviceType = "" - - if(foundInAAI){ - utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) - - String siData = execution.getVariable("GENGS_service") - utils.log("INFO", "SI Data", isDebugEnabled) - if (isBlank(siData)) - { - msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - else - { - utils.log("INFO", "SI Data" + siData, isDebugEnabled) - //Confirm there are no related service instances (vnf/network or volume) - if (utils.nodeExists(siData, "relationship-list")) { - utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled) - InputSource source = new InputSource(new StringReader(siData)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document serviceXml = docBuilder.parse(source) - serviceXml.getDocumentElement().normalize() - //test(siData) - NodeList nodeList = serviceXml.getElementsByTagName("relationship") - JSONArray jArray = new JSONArray() - for (int x = 0; x < nodeList.getLength(); x++) { - Node node = nodeList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() //for ns - if(e.equals("service-instance")){ - def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent() - utils.log("INFO", "ServiceInstance Related NS :" + relatedObject, isDebugEnabled) - NodeList dataList = node.getChildNodes() - if(null != dataList) { - JSONObject jObj = new JSONObject() - for (int i = 0; i < dataList.getLength(); i++) { - Node dNode = dataList.item(i) - if(dNode.getNodeName() == "relationship-data") { - Element rDataEle = (Element)dNode - def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent() - def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent() - if(eKey.equals("service-instance.service-instance-id")){ - jObj.put("resourceInstanceId", eValue) - } - } - else if(dNode.getNodeName() == "related-to-property"){ - Element rDataEle = (Element)dNode - def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent() - def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent() - if(eKey.equals("service-instance.service-instance-name")){ - jObj.put("resourceType", eValue) - } - } - } - utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) - jArray.put(jObj) - } - //for overlay/underlay - }else if (e.equals("configuration")){ - def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent() - utils.log("INFO", "ServiceInstance Related Configuration :" + relatedObject, isDebugEnabled) - NodeList dataList = node.getChildNodes() - if(null != dataList) { - JSONObject jObj = new JSONObject() - for (int i = 0; i < dataList.getLength(); i++) { - Node dNode = dataList.item(i) - if(dNode.getNodeName() == "relationship-data") { - Element rDataEle = (Element)dNode - def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent() - def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent() - if(eKey.equals("configuration.configuration-id")){ - jObj.put("resourceInstanceId", eValue) - } - } - else if(dNode.getNodeName() == "related-to-property"){ - Element rDataEle = (Element)dNode - def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent() - def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent() - if(eKey.equals("configuration.configuration-type")){ - jObj.put("resourceType", eValue) - } - } - } - utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) - jArray.put(jObj) - } - } - } - } - execution.setVariable("serviceRelationShip", jArray.toString()) - } - } - }else{ - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - - utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) - } - }catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) - } - - public void postProcessAAIDEL(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIDEL ***** ", isDebugEnabled) - String msg = "" - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator") - if(!succInAAI){ - msg = "Error deleting Service-instance in AAI" + serviceInstanceId - utils.log("INFO", msg, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIDEL. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," *** Exit postProcessAAIDEL *** ", isDebugEnabled) - } - - public void preInitResourcesOperStatus(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) - try{ - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String operationType = execution.getVariable("operationType") - String resourceTemplateUUIDs = "" - String result = "processing" - String progress = "0" - String reason = "" - String operationContent = "Prepare service creation" - utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled) - serviceId = UriUtils.encode(serviceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceId) - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", operationType) - // we use resource instance ids for delete flow as resourceTemplateUUIDs - /*[ - { - "resourceInstanceId":"1111", - "resourceType":"vIMS" - }, - { - "resourceInstanceId":"222", - "resourceType":"vEPC" - }, - { - "resourceInstanceId":"3333", - "resourceType":"overlay" - }, - { - "resourceInstanceId":"4444", - "resourceType":"underlay" - } - ]*/ - String serviceRelationShip = execution.getVariable("serviceRelationShip") - - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - List relationShipList = jsonSlurper.parseText(serviceRelationShip) - - if (relationShipList != null) { - relationShipList.each { - resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":" - } - } - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - - String payload = - """ - - - - ${serviceId} - ${operationId} - ${operationType} - ${resourceTemplateUUIDs} - - - """ - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_initResOperStatusRequest", payload) - utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled) - utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled) - execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) - } - utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) - } - - /** - * prepare delete parameters - */ - public void preResourceDelete(execution, resourceName){ - // we use resource instance ids for delete flow as resourceTemplateUUIDs - /*[ - { - "resourceInstanceId":"1111", - "resourceType":"vIMS" - }, - { - "resourceInstanceId":"222", - "resourceType":"vEPC" - }, - { - "resourceInstanceId":"3333", - "resourceType":"overlay" - }, - { - "resourceInstanceId":"4444", - "resourceType":"underlay" - } - ]*/ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - utils.log("INFO", " ======== STARTED preResourceDelete Process ======== ", isDebugEnabled) - String serviceRelationShip = execution.getVariable("serviceRelationShip") - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - List relationShipList = jsonSlurper.parseText(serviceRelationShip) - - if (relationShipList != null) { - relationShipList.each { - if(StringUtils.containsIgnoreCase(it.resourceType, resourceName)) { - String resourceInstanceUUID = it.resourceInstanceId - String resourceTemplateUUID = it.resourceInstanceId - execution.setVariable("resourceTemplateId", resourceTemplateUUID) - execution.setVariable("resourceInstanceId", resourceInstanceUUID) - execution.setVariable("resourceType", resourceName) - utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName, isDebugEnabled) - } - } - } - utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled) - } - - public void sequenceResource(execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - utils.log("INFO", " ======== STARTED sequenceResource Process ======== ", isDebugEnabled) - List nsResources = new ArrayList() - List wanResources = new ArrayList() - List resourceSequence = new ArrayList() - - String serviceRelationShip = execution.getVariable("serviceRelationShip") - - - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - List relationShipList = jsonSlurper.parseText(serviceRelationShip) - - if (relationShipList != null) { - relationShipList.each { - if(StringUtils.containsIgnoreCase(it.resourceType, "overlay") || StringUtils.containsIgnoreCase(it.resourceType, "underlay")){ - wanResources.add(it.resourceType) - }else{ - nsResources.add(it.resourceType) - } - } - } - resourceSequence.addAll(wanResources) - resourceSequence.addAll(nsResources) - String isContainsWanResource = wanResources.isEmpty() ? "false" : "true" - execution.setVariable("isContainsWanResource", isContainsWanResource) - execution.setVariable("currentResourceIndex", 0) - execution.setVariable("resourceSequence", resourceSequence) - utils.log("INFO", "resourceSequence: " + resourceSequence, isDebugEnabled) - execution.setVariable("wanResources", wanResources) - utils.log("INFO", " ======== END sequenceResource Process ======== ", isDebugEnabled) - } - - public void getCurrentResource(execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start getCurrentResoure Process ======== ", isDebugEnabled) - def currentIndex = execution.getVariable("currentResourceIndex") - List resourceSequence = execution.getVariable("resourceSequence") - List wanResources = execution.getVariable("wanResources") - String resourceName = resourceSequence.get(currentIndex) - execution.setVariable("resourceType",resourceName) - if(wanResources.contains(resourceName)){ - execution.setVariable("controllerInfo", "SDN-C") - }else{ - execution.setVariable("controllerInfo", "VF-C") - } - utils.log("INFO", "======== COMPLETED getCurrentResoure Process ======== ", isDebugEnabled) - } - - public void parseNextResource(execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled) - def currentIndex = execution.getVariable("currentResourceIndex") - def nextIndex = currentIndex + 1 - execution.setVariable("currentResourceIndex", nextIndex) - List resourceSequence = execution.getVariable("resourceSequence") - if(nextIndex >= resourceSequence.size()){ - execution.setVariable("allResourceFinished", "true") - }else{ - execution.setVariable("allResourceFinished", "false") - } - utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled) - } - -} - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy deleted file mode 100644 index 03ba10a0c0..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy +++ /dev/null @@ -1,1169 +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.bpmn.infrastructure.scripts - -import static org.apache.commons.lang3.StringUtils.*; - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONArray; -import org.json.JSONObject; -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse; -import org.springframework.web.util.UriUtils; - -import groovy.json.* - -/** - * This groovy class supports the DoDeleteE2EServiceInstance.bpmn process. - * - * Inputs: - * @param - msoRequestId - * @param - globalSubscriberId - O - * @param - subscriptionServiceType - O - * @param - serviceInstanceId - * @param - serviceInstanceName - O - * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) - * @param - sdncVersion - * @param - failNotFound - TODO - * @param - serviceInputParams - TODO - * - * Outputs: - * @param - WorkflowException - * - * Rollback - Deferred - */ -public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { - - String Prefix="DDELSI_" - private static final String DebugFlag = "isDebugEnabled" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public void preProcessRequest (DelegateExecution execution) { - - def method = getClass().getSimpleName() + '.buildAPPCRequest(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled) - String msg = "" - - try { - String requestId = execution.getVariable("msoRequestId") - execution.setVariable("prefix",Prefix) - - //Inputs - //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology - String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId - if (globalSubscriberId == null) - { - execution.setVariable("globalSubscriberId", "") - } - - //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology - String serviceType = execution.getVariable("serviceType") - if (serviceType == null) - { - execution.setVariable("serviceType", "") - } - - //Generated in parent for AAI PUT - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)){ - msg = "Input serviceInstanceId is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (isBlank(sdncCallbackUrl)) { - msg = "URN_mso_workflow_sdncadapter_callback is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) - - StringBuilder sbParams = new StringBuilder() - Map paramsMap = execution.getVariable("serviceInputParams") - if (paramsMap != null) - { - sbParams.append("") - for (Map.Entry entry : paramsMap.entrySet()) { - String paramsXml - String paramName = entry.getKey() - String paramValue = entry.getValue() - paramsXml = - """ - ${paramName} - ${paramValue} - - """ - sbParams.append(paramsXml) - } - sbParams.append("") - } - String siParamsXml = sbParams.toString() - if (siParamsXml == null) - siParamsXml = "" - execution.setVariable("siParamsXml", siParamsXml) - execution.setVariable("operationStatus", "Waiting delete resource...") - execution.setVariable("progress", "0") - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - - - - public void postProcessAAIGET(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.postProcessAAIGET(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - - String msg = "" - - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - utils.log("INFO","serviceInstanceId: "+serviceInstanceId, isDebugEnabled) - - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - utils.log("INFO","foundInAAI: "+foundInAAI, isDebugEnabled) - - String serviceType = "" - - - if(foundInAAI){ - utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) - - String siData = execution.getVariable("GENGS_service") - utils.log("INFO", "SI Data", isDebugEnabled) - if (isBlank(siData)) - { - msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - }else{ - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - - utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) - } - }catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Bpmn error encountered in " + method + "--" + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - - private void loadResourcesProperties(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.loadResourcesProperties(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - String loadFilePath = "/etc/mso/config.d/reources.json" - try{ - def jsonPayload = new File(loadFilePath).text - utils.log("INFO","jsonPayload: " + jsonPayload, isDebugEnabled) - - String resourcesProperties = jsonUtil.prettyJson(jsonPayload.toString()) - utils.log("INFO","resourcesProperties: " + resourcesProperties, isDebugEnabled) - - String createResourceSort = jsonUtil.getJsonValue(resourcesProperties, "CreateResourceSort") - //utils.log("INFO","createResourceSort: " + createResourceSort, isDebugEnabled) - execution.setVariable("createResourceSort", createResourceSort) - - String deleteResourceSort = jsonUtil.getJsonValue(resourcesProperties, "DeleteResourceSort") - //utils.log("INFO","deleteResourceSort: " + deleteResourceSort, isDebugEnabled) - execution.setVariable("deleteResourceSort", deleteResourceSort) - - - String resourceControllerType = jsonUtil.getJsonValue(resourcesProperties, "ResourceControllerType") - //utils.log("INFO","resourceControllerType: " + resourceControllerType, isDebugEnabled) - execution.setVariable("resourceControllerType", resourceControllerType) - - - }catch(Exception ex){ - // try error in method block - String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - private void sortDeleteResource(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sortDeleteResource(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - String deleteResourceSortDef = """[ - { - "resourceType":"GRE_SAR" - }, - { - "resourceType":"VPN_SAR" - }, - { - "resourceType":"APN_AAR" - }, - { - "resourceType":"GRE_AAR" - }, - { - "resourceType":"Overlay" - }, - { - "resourceType":"Underlay" - }, - { - "resourceType":"vIMS" - }, - { - "resourceType":"vCPE" - }, - { - "resourceType":"vFW" - }, - { - "resourceType":"vEPC" - } - - - ]""".trim() - - try{ - loadResourcesProperties(execution) - String deleteResourceSort = execution.getVariable("deleteResourceSort") - if (isBlank(deleteResourceSort)) { - deleteResourceSort = deleteResourceSortDef; - } - - List sortResourceList = jsonUtil.StringArrayToList(execution, deleteResourceSort) - utils.log("INFO", "sortResourceList : " + sortResourceList, isDebugEnabled) - - JSONArray newResourceList = new JSONArray() - int resSortCount = sortResourceList.size() - - for ( int currentResource = 0 ; currentResource < resSortCount ; currentResource++ ) { - String currentSortResource = sortResourceList[currentResource] - String sortResourceType = jsonUtil.getJsonValue(currentSortResource, "resourceType") - List resourceList = execution.getVariable(Prefix+"resourceList") - - for (String resource : resourceList) { - //utils.log("INFO", "resource : " + resource, isDebugEnabled) - String resourceType = jsonUtil.getJsonValue(resource, "resourceType") - - if (StringUtils.containsIgnoreCase(resourceType, sortResourceType)) { - JSONObject jsonObj = new JSONObject(resource) - newResourceList.put(jsonObj) - } - utils.log("INFO", "Get next sort type " , isDebugEnabled) - } - } - - String newResourceStr = newResourceList.toString() - List newResourceListStr = jsonUtil.StringArrayToList(execution, newResourceStr) - - execution.setVariable(Prefix+"resourceList", newResourceListStr) - utils.log("INFO", "newResourceList : " + newResourceListStr, isDebugEnabled) - - }catch(Exception ex){ - // try error in method block - String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - utils.log("INFO", "Exited " + method, isDebugEnabled) - - } - public void prepareServiceDeleteResource(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepareServiceDeleteResource(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - - try { - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - // confirm if ServiceInstance was found - if ( !execution.getVariable("GENGS_FoundIndicator") ) - { - String exceptionMessage = "Bpmn error encountered in DeleteMobileAPNCustService flow. Service Instance was not found in AAI by id: " + serviceInstanceId - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - execution.setVariable(Prefix+"resourceList", "") - execution.setVariable(Prefix+"resourceCount", 0) - execution.setVariable(Prefix+"nextResource", 0) - execution.setVariable(Prefix+"resourceFinish", true) - - // get SI extracted by GenericGetService - String serviceInstanceAaiRecord = execution.getVariable("GENGS_service"); - utils.log("INFO", "serviceInstanceAaiRecord: " +serviceInstanceAaiRecord, isDebugEnabled) - - String aaiJsonRecord = jsonUtil.xml2json(serviceInstanceAaiRecord) - - //utils.log("INFO", "aaiJsonRecord: " +aaiJsonRecord, isDebugEnabled) - def serviceInstanceName = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.service-instance-name") - execution.setVariable("serviceInstanceName",serviceInstanceName) - - def serviceType = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.service-type") - execution.setVariable("serviceType",serviceType) - - - String relationshipList = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.relationship-list") - //utils.log("INFO", "relationship-list:" + relationshipList, isDebugEnabled) - if (! isBlank(relationshipList)){ - utils.log("INFO", "relationship-list exists" , isDebugEnabled) - String relationShip = jsonUtil.getJsonValue(relationshipList, "relationship") - utils.log("INFO", "relationship: " + relationShip, isDebugEnabled) - JSONArray allResources = new JSONArray() - JSONArray serviceResources = new JSONArray() - JSONArray networkResources = new JSONArray() - JSONArray allottedResources = new JSONArray() - - - if (! isBlank(relationShip)){ - JSONArray jsonArray = new JSONArray(); - if (relationShip.startsWith("{") && relationShip.endsWith("}")) { - JSONObject jsonObject = new JSONObject(relationShip); - jsonArray.put(jsonObject); - } else if (relationShip.startsWith("[") && relationShip.endsWith("]")) { - jsonArray = new JSONArray(relationShip); - } else { - utils.log("INFO", "The relationShip fomart is error" , isDebugEnabled) - } - - List relationList = jsonUtil.StringArrayToList(execution, jsonArray.toString()) - - utils.log("INFO", "relationList: " + relationList, isDebugEnabled) - - int relationNum =relationList.size() - utils.log("INFO", "**************relationList size: " + relationNum, isDebugEnabled) - - for ( int currentRelation = 0 ; currentRelation < relationNum ; currentRelation++ ) { - utils.log("INFO", "current Relation num: " + currentRelation, isDebugEnabled) - String relation = relationList[currentRelation] - utils.log("INFO", "relation: " + relation, isDebugEnabled) - - String relatedTo = jsonUtil.getJsonValue(relation, "related-to") - utils.log("INFO", "relatedTo: " + relatedTo, isDebugEnabled) - - String relatedLink = jsonUtil.getJsonValue(relation, "related-link") - utils.log("INFO", "relatedLink: " + relatedLink, isDebugEnabled) - - if (StringUtils.equalsIgnoreCase(relatedTo, "allotted-resource")) { - utils.log("INFO", "allotted-resource exists ", isDebugEnabled) - - String aaiArRsp = getAaiAr(execution, relatedLink) - utils.log("INFO", "aaiArRsp: " + aaiArRsp, isDebugEnabled) - if (! isBlank(aaiArRsp)) { - def type = utils.getNodeText1(aaiArRsp, "type") - def id = utils.getNodeText1(aaiArRsp, "id") - def role = utils.getNodeText1(aaiArRsp, "role") - def resourceVersion = utils.getNodeText1(aaiArRsp, "resource-version") - - JSONObject jObject = new JSONObject() - jObject.put("resourceType", type) - jObject.put("resourceInstanceId", id) - jObject.put("resourceRole", role) - jObject.put("resourceVersion", resourceVersion) - - allResources.put(jObject) - utils.log("INFO", "allResources: " + allResources, isDebugEnabled) - allottedResources.put(jObject) - utils.log("INFO", "allottedResources: " + allottedResources, isDebugEnabled) - } - } - else if (StringUtils.equalsIgnoreCase(relatedTo, "service-instance")){ - utils.log("INFO", "service-instance exists ", isDebugEnabled) - JSONObject jObject = new JSONObject() - - //relationship-data - String rsDataStr = jsonUtil.getJsonValue(relation, "relationship-data") - utils.log("INFO", "rsDataStr: " + rsDataStr, isDebugEnabled) - List rsDataList = jsonUtil.StringArrayToList(execution, rsDataStr) - utils.log("INFO", "rsDataList: " + rsDataList, isDebugEnabled) - for(String rsData : rsDataList){ - utils.log("INFO", "rsData: " + rsData, isDebugEnabled) - def eKey = jsonUtil.getJsonValue(rsData, "relationship-key") - def eValue = jsonUtil.getJsonValue(rsData, "relationship-value") - if(eKey.equals("service-instance.service-instance-id")){ - jObject.put("resourceInstanceId", eValue) - } - if(eKey.equals("service-subscription.service-type")){ - jObject.put("resourceType", eValue) - } - } - - //related-to-property - String rPropertyStr = jsonUtil.getJsonValue(relation, "related-to-property") - utils.log("INFO", "related-to-property: " + rPropertyStr, isDebugEnabled) - if (rPropertyStr instanceof JSONArray){ - List rPropertyList = jsonUtil.StringArrayToList(execution, rPropertyStr) - for (String rProperty : rPropertyList) { - utils.log("INFO", "rProperty: " + rProperty, isDebugEnabled) - def eKey = jsonUtil.getJsonValue(rProperty, "property-key") - def eValue = jsonUtil.getJsonValue(rProperty, "property-value") - if(eKey.equals("service-instance.service-instance-name")){ - jObject.put("resourceName", eValue) - } - } - } - else { - String rProperty = rPropertyStr - utils.log("INFO", "rProperty: " + rProperty, isDebugEnabled) - def eKey = jsonUtil.getJsonValue(rProperty, "property-key") - def eValue = jsonUtil.getJsonValue(rProperty, "property-value") - if (eKey.equals("service-instance.service-instance-name")) { - jObject.put("resourceName", eValue) - } - } - - allResources.put(jObject) - utils.log("INFO", "allResources: " + allResources, isDebugEnabled) - - serviceResources.put(jObject) - utils.log("INFO", "serviceResources: " + serviceResources, isDebugEnabled) - } - else if (StringUtils.equalsIgnoreCase(relatedTo, "configuration")) { - utils.log("INFO", "configuration ", isDebugEnabled) - JSONObject jObject = new JSONObject() - - //relationship-data - String rsDataStr = jsonUtil.getJsonValue(relation, "relationship-data") - utils.log("INFO", "rsDataStr: " + rsDataStr, isDebugEnabled) - List rsDataList = jsonUtil.StringArrayToList(execution, rsDataStr) - utils.log("INFO", "rsDataList: " + rsDataList, isDebugEnabled) - for (String rsData : rsDataList) { - utils.log("INFO", "rsData: " + rsData, isDebugEnabled) - def eKey = jsonUtil.getJsonValue(rsData, "relationship-key") - def eValue = jsonUtil.getJsonValue(rsData, "relationship-value") - if(eKey.equals("configuration.configuration-id")){ - jObject.put("resourceInstanceId", eValue) - } - } - - - //related-to-property - String rPropertyStr = jsonUtil.getJsonValue(relation, "related-to-property") - utils.log("INFO", "related-to-property: " + rPropertyStr, isDebugEnabled) - if (rPropertyStr instanceof JSONArray){ - List rPropertyList = jsonUtil.StringArrayToList(execution, rPropertyStr) - for(String rProperty : rPropertyList){ - utils.log("INFO", "rProperty: " + rProperty, isDebugEnabled) - def eKey = jsonUtil.getJsonValue(rProperty, "property-key") - def eValue = jsonUtil.getJsonValue(rProperty, "property-value") - if(eKey.equals("configuration.configuration-type")){ - jObject.put("resourceType", eValue) - } - } - } - else { - String rProperty = rPropertyStr - utils.log("INFO", "rProperty: " + rProperty, isDebugEnabled) - def eKey = jsonUtil.getJsonValue(rProperty, "property-key") - def eValue = jsonUtil.getJsonValue(rProperty, "property-value") - if(eKey.equals("configuration.configuration-type")){ - jObject.put("resourceType", eValue) - } - } - allResources.put(jObject) - utils.log("INFO", "allResources: " + allResources, isDebugEnabled) - - networkResources.put(jObject) - utils.log("INFO", "networkResources: " + networkResources, isDebugEnabled) - } - utils.log("INFO", "Get Next releation resource " , isDebugEnabled) - - } - utils.log("INFO", "Get releation finished. " , isDebugEnabled) - } - - execution.setVariable("serviceRelationShip", allResources.toString()) - utils.log("INFO", "allResources: " + allResources.toString(), isDebugEnabled) - String serviceRelationShip = execution.getVariable("serviceRelationShip") - utils.log("INFO", "serviceRelationShip: " + serviceRelationShip, isDebugEnabled) - if ((! isBlank(serviceRelationShip)) && (! serviceRelationShip.isEmpty())) { - - List relationShipList = jsonUtil.StringArrayToList(execution, serviceRelationShip) - utils.log("INFO", "relationShipList: " + relationShipList, isDebugEnabled) - execution.setVariable(Prefix+"resourceList", relationShipList) - - int resourceCount = relationShipList.size() - utils.log("INFO", "resourceCount: " + resourceCount, isDebugEnabled) - execution.setVariable(Prefix+"resourceCount",resourceCount ) - - int resourceNum = 0 - execution.setVariable(Prefix+"nextResource", resourceNum) - utils.log("INFO", "start sort delete resource: ", isDebugEnabled) - sortDeleteResource(execution) - - - if (resourceNum < resourceCount) { - execution.setVariable(Prefix+"resourceFinish", false) - } - else { - execution.setVariable(Prefix+"resourceFinish", true) - } - utils.log("INFO", "Resource list set end : " + resourceCount, isDebugEnabled) - } - - execution.setVariable("serviceResources", serviceResources.toString()) - utils.log("INFO", "serviceResources: " + serviceResources, isDebugEnabled) - String serviceResourcesShip = execution.getVariable("serviceResources") - utils.log("INFO", "serviceResourcesShip: " + serviceResourcesShip, isDebugEnabled) - - if ((! isBlank(serviceResourcesShip)) && (! serviceResourcesShip.isEmpty())) { - List serviceResourcesList = jsonUtil.StringArrayToList(execution, serviceResourcesShip) - utils.log("INFO", "serviceResourcesList: " + serviceResourcesList, isDebugEnabled) - execution.setVariable(Prefix+"serviceResourceList", serviceResourcesList) - execution.setVariable(Prefix+"serviceResourceCount", serviceResourcesList.size()) - execution.setVariable(Prefix+"nextServiceResource", 0) - utils.log("INFO", "Service Resource list set end : " + serviceResourcesList.size(), isDebugEnabled) - - } - - execution.setVariable("allottedResources", allottedResources.toString()) - utils.log("INFO", "allottedResources: " + allottedResources, isDebugEnabled) - String allottedResourcesShip = execution.getVariable("allottedResources") - utils.log("INFO", "allottedResourcesShip: " + allottedResourcesShip, isDebugEnabled) - if ((! isBlank(allottedResourcesShip)) && (! allottedResourcesShip.isEmpty())) { - List allottedResourcesList = jsonUtil.StringArrayToList(execution, allottedResourcesShip) - utils.log("INFO", "allottedResourcesList: " + allottedResourcesList, isDebugEnabled) - execution.setVariable(Prefix+"allottedResourcesList", allottedResourcesList) - execution.setVariable(Prefix+"allottedResourcesListCount", allottedResourcesList.size()) - execution.setVariable(Prefix+"nextAllottedResourcesList", 0) - utils.log("INFO", "Allotted Resource list set end : " + allottedResourcesList.size(), isDebugEnabled) - - } - execution.setVariable("networkResources", networkResources.toString()) - utils.log("INFO", "networkResources: " + networkResources, isDebugEnabled) - String networkResourcesShip = execution.getVariable("networkResources") - utils.log("INFO", "networkResourcesShip: " + networkResourcesShip, isDebugEnabled) - if ((! isBlank(networkResourcesShip)) && (! networkResourcesShip.isEmpty())) { - List networkResourcesList = jsonUtil.StringArrayToList(execution, networkResourcesShip) - utils.log("INFO", "networkResourcesList: " + networkResourcesList, isDebugEnabled) - execution.setVariable(Prefix+"networkResourcesList", networkResourcesList) - execution.setVariable(Prefix+"networkResourcesListCount", networkResourcesList.size()) - execution.setVariable(Prefix+"nextNetworkResourcesList", 0) - utils.log("INFO", "Network Resource list set end : " + networkResourcesList.size(), isDebugEnabled) - - } - } - } catch (BpmnError e){ - throw e; - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DeleteMobileAPNCustService flow. prepareServiceDeleteResource() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - - private String getAaiAr(DelegateExecution execution, String relink) { - def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = execution.getVariable("URN_aai_endpoint") + relink - - utils.log("DEBUG", "get AR info " + aaiEndpoint, isDebugEnabled) - APIResponse response = aaiUtil.executeAAIGetCall(execution, aaiEndpoint) - - int responseCode = response.getStatusCode() - utils.log("DEBUG", "get AR info responseCode:" + responseCode, isDebugEnabled) - - String aaiResponse = response.getResponseBodyAsString() - utils.log("DEBUG", "get AR info " + aaiResponse, isDebugEnabled) - - if(responseCode < 200 || responseCode >= 300 || isBlank(aaiResponse)) { - return null - } - - utils.log("INFO", "Exited " + method, isDebugEnabled) - return aaiResponse - } - /** - * prepare Decompose next resource to create request - */ - public void preProcessDecomposeNextResource(DelegateExecution execution){ - def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - utils.log("INFO", " ======== STARTED preProcessDecomposeNextResource Process ======== ", isDebugEnabled) - try{ - int resourceNum = execution.getVariable(Prefix+"nextServiceResource") - List serviceResourceList = execution.getVariable(Prefix+"serviceResourceList") - utils.log("INFO", "Service Resource List : " + serviceResourceList, isDebugEnabled) - - String serviceResource = serviceResourceList[resourceNum] - execution.setVariable(Prefix+"serviceResource", serviceResource) - utils.log("INFO", "Current Service Resource : " + serviceResource, isDebugEnabled) - - String resourceType = jsonUtil.getJsonValue(serviceResource, "resourceType") - execution.setVariable("resourceType", resourceType) - utils.log("INFO", "resourceType : " + resourceType, isDebugEnabled) - - String resourceInstanceId = jsonUtil.getJsonValue(serviceResource, "resourceInstanceId") - execution.setVariable("resourceInstanceId", resourceInstanceId) - utils.log("INFO", "resourceInstanceId : " + resourceInstanceId, isDebugEnabled) - - String resourceRole = jsonUtil.getJsonValue(serviceResource, "resourceRole") - execution.setVariable("resourceRole", resourceRole) - utils.log("INFO", "resourceRole : " + resourceRole, isDebugEnabled) - - String resourceVersion = jsonUtil.getJsonValue(serviceResource, "resourceVersion") - execution.setVariable("resourceVersion", resourceVersion) - utils.log("INFO", "resourceVersion : " + resourceVersion, isDebugEnabled) - - String resourceName = jsonUtil.getJsonValue(serviceResource, "resourceName") - if (isBlank(resourceName)){ - resourceName = resourceInstanceId - } - execution.setVariable(Prefix+"resourceName", resourceName) - utils.log("INFO", "resource Name : " + resourceName, isDebugEnabled) - - - execution.setVariable(Prefix+"nextServiceResource", resourceNum + 1) - - int serviceResourceCount = execution.getVariable(Prefix+"serviceResourceCount") - if (serviceResourceCount >0 ){ - int progress = (resourceNum*100) / serviceResourceCount - execution.setVariable("progress", progress.toString() ) - } - execution.setVariable("operationStatus", resourceName ) - - }catch(Exception e){ - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateMobileAPNCustService flow. Unexpected Error from method preProcessDecomposeNextResource() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - /** - * post Decompose next resource to create request - */ - public void postProcessDecomposeNextResource(DelegateExecution execution){ - def method = getClass().getSimpleName() + '.postProcessDecomposeNextResource(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - utils.log("INFO", " ======== STARTED postProcessDecomposeNextResource Process ======== ", isDebugEnabled) - try{ - String resourceName = execution.getVariable(Prefix+"resourceName") - int resourceNum = execution.getVariable(Prefix+"nextServiceResource") - utils.log("DEBUG", "Current Resource count:"+ execution.getVariable(Prefix+"nextServiceResource"), isDebugEnabled) - - int resourceCount = execution.getVariable(Prefix+"serviceResourceCount") - utils.log("DEBUG", "Total Resource count:"+ execution.getVariable(Prefix+"serviceResourceCount"), isDebugEnabled) - - if (resourceNum < resourceCount) { - execution.setVariable(Prefix+"resourceFinish", false) - } - else { - execution.setVariable(Prefix+"resourceFinish", true) - } - - utils.log("DEBUG", "Resource Finished:"+ execution.getVariable(Prefix+"resourceFinish"), isDebugEnabled) - - if (resourceCount >0 ){ - int progress = (resourceNum*100) / resourceCount - - execution.setVariable("progress", progress.toString() ) - utils.log("DEBUG", "progress :"+ execution.getVariable("progress"), isDebugEnabled) - } - execution.setVariable("operationStatus", resourceName ) - - - }catch(Exception e){ - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateMobileAPNCustService flow. Unexpected Error from method postProcessDecomposeNextResource() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - /** - * prepare post Unkown Resource Type - */ - public void postOtherControllerType(DelegateExecution execution){ - def method = getClass().getSimpleName() + '.postOtherControllerType(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - - try{ - - String resourceName = execution.getVariable(Prefix+"resourceName") - String resourceType = execution.getVariable(Prefix+"resourceType") - String controllerType = execution.getVariable("controllerType") - - String msg = "Resource name: "+ resourceName + " resource Type: " + resourceType+ " controller Type: " + controllerType + " can not be processed n the workflow" - utils.log("DEBUG", msg, isDebugEnabled) - - }catch(Exception e){ - // try error in method block - String exceptionMessage = "Bpmn error encountered in DoCreateMobileAPNServiceInstance flow. Unexpected Error from method postOtherControllerType() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - - /** - * prepare delete parameters - */ - public void preSDNCResourceDelete(execution, resourceName){ - // we use resource instance ids for delete flow as resourceTemplateUUIDs - - def method = getClass().getSimpleName() + '.preSDNCResourceDelete(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - - utils.log("INFO", " ======== STARTED preSDNCResourceDelete Process ======== ", isDebugEnabled) - String networkResources = execution.getVariable("networkResources") - - - execution.setVariable("foundResource", false) - if (networkResources != null) { - def jsonSlurper = new JsonSlurper() - List relationShipList = jsonSlurper.parseText(networkResources) - relationShipList.each { - if(StringUtils.containsIgnoreCase(it.resourceType, resourceName)) { - String resourceInstanceUUID = it.resourceInstanceId - String resourceTemplateUUID = it.resourceInstanceId - execution.setVariable("resourceTemplateId", resourceTemplateUUID) - execution.setVariable("resourceInstanceId", resourceInstanceUUID) - execution.setVariable("resourceType", resourceName) - execution.setVariable("foundResource", true) - utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName, isDebugEnabled) - } - } - } - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - public void preProcessSDNCDelete (DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessSDNCDelete(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - utils.log("INFO"," ***** preProcessSDNCDelete *****", isDebugEnabled) - String msg = "" - - try { - def serviceInstanceId = execution.getVariable("serviceInstanceId") - def serviceInstanceName = execution.getVariable("serviceInstanceName") - def callbackURL = execution.getVariable("sdncCallbackUrl") - def requestId = execution.getVariable("msoRequestId") - def serviceId = execution.getVariable("productFamilyId") - def subscriptionServiceType = execution.getVariable("subscriptionServiceType") - def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId - - String serviceModelInfo = execution.getVariable("serviceModelInfo") - def modelInvariantUuid = "" - def modelVersion = "" - def modelUuid = "" - def modelName = "" - if (!isBlank(serviceModelInfo)) - { - modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") - modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") - modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid") - modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") - - if (modelInvariantUuid == null) { - modelInvariantUuid = "" - } - if (modelVersion == null) { - modelVersion = "" - } - if (modelUuid == null) { - modelUuid = "" - } - if (modelName == null) { - modelName = "" - } - } - if (serviceInstanceName == null) { - serviceInstanceName = "" - } - if (serviceId == null) { - serviceId = "" - } - - def siParamsXml = execution.getVariable("siParamsXml") - def serviceType = execution.getVariable("serviceType") - if (serviceType == null) - { - serviceType = "" - } - - def sdncRequestId = UUID.randomUUID().toString() - - String sdncDelete = - """ - - ${sdncRequestId} - ${serviceInstanceId} - delete - service-topology-operation - ${callbackURL} - ${serviceType} - - - - ${requestId} - MSO - - - - DeleteServiceInstance - - - ${serviceId} - ${subscriptionServiceType} - - ${modelInvariantUuid} - ${modelUuid} - ${modelVersion} - ${modelName} - - ${serviceInstanceId} - - ${globalSubscriberId} - - - ${serviceInstanceName} - ${siParamsXml} - - - """ - - sdncDelete = utils.formatXml(sdncDelete) - def sdncRequestId2 = UUID.randomUUID().toString() - String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") - execution.setVariable("sdncDelete", sdncDelete) - execution.setVariable("sdncDeactivate", sdncDeactivate) - utils.log("INFO","sdncDeactivate:\n" + sdncDeactivate, isDebugEnabled) - utils.log("INFO","sdncDelete:\n" + sdncDelete, isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage()) - } - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - - public void postProcessSDNCDelete(DelegateExecution execution, String response, String action) { - - def method = getClass().getSimpleName() + '.postProcessSDNCDelete(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - utils.log("INFO"," ***** postProcessSDNC " + action + " *****", isDebugEnabled) - String msg = "" - - /*try { - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - utils.log("INFO", "SDNCResponse: " + response, isDebugEnabled) - utils.log("INFO", "workflowException: " + workflowException, isDebugEnabled) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == "true"){ - utils.log("INFO","Good response from SDNC Adapter for service-instance " + action + "response:\n" + response, isDebugEnabled) - - }else{ - msg = "Bad Response from SDNC Adapter for service-instance " + action - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg) - } - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in postProcessSDNC " + action + " Exception:" + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - }*/ - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - - public void postProcessAAIDEL(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.postProcessAAIDEL(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - utils.log("INFO"," ***** postProcessAAIDEL ***** ", isDebugEnabled) - String msg = "" - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator") - if(!succInAAI){ - msg = "Error deleting Service-instance in AAI" + serviceInstanceId - utils.log("INFO", msg, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIDEL. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - /** - * Init the service Operation Status - */ - public void preUpdateServiceOperationStatus(DelegateExecution execution){ - def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - - try{ - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String serviceName = execution.getVariable("serviceInstanceName") - String operationType = "DELETE" - String userId = "" - String result = "processing" - String progress = execution.getVariable("progress") - utils.log("INFO", "progress: " + progress , isDebugEnabled) - if ("100".equalsIgnoreCase(progress)) - { - result = "finished" - } - String reason = "" - String operationContent = "Prepare service delete: " + execution.getVariable("operationStatus") - utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) - serviceId = UriUtils.encode(serviceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceId) - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", operationType) - - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) - - execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - - String payload = - """ - - - - ${serviceId} - ${operationId} - ${serviceName} - ${operationType} - ${userId} - ${result} - ${operationContent} - ${progress} - ${reason} - - - """ - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - utils.log("INFO", "Outgoing preUpdateServiceOperationStatus: \n" + payload, isDebugEnabled) - - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) - execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage()) - } - utils.log("INFO", "======== COMPLETED preUpdateServiceOperationStatus Process ======== ", isDebugEnabled) - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - - public void preInitResourcesOperStatus(DelegateExecution execution){ - def method = getClass().getSimpleName() + '.preInitResourcesOperStatus(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - - utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) - String msg="" - try{ - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String operationType = "DELETE" - String resourceTemplateUUIDs = "" - String result = "processing" - String progress = "0" - String reason = "" - String operationContent = "Prepare service delete" - utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled) - serviceId = UriUtils.encode(serviceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceId) - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", operationType) - - String serviceRelationShip = execution.getVariable("serviceRelationShip") - utils.log("INFO", "serviceRelationShip: " + serviceRelationShip, isDebugEnabled) - if (! isBlank(serviceRelationShip)) { - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - List relationShipList = jsonSlurper.parseText(serviceRelationShip) - - if (relationShipList != null) { - relationShipList.each { - resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":" - } - } - } - def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) - - String payload = - """ - - - - ${serviceId} - ${operationId} - ${operationType} - ${resourceTemplateUUIDs} - - - """ - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_initResOperStatusRequest", payload) - utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled) - utils.logAudit("DoCustomDeleteE2EServiceInstanceV2 Outgoing initResourceOperationStatus Request: " + payload) - - }catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoCustomDeleteE2EServiceInstanceV2.preInitResourcesOperStatus. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - - - - /** - * prepare delete parameters - */ - public void preProcessVFCResourceDelete(execution){ - // we use resource instance ids for delete flow as resourceTemplateUUIDs - - def method = getClass().getSimpleName() + '.preProcessVFCResourceDelete(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - - utils.log("INFO", " ======== STARTED preProcessVFCResourceDelete Process ======== ", isDebugEnabled) - try{ - String serviceResource = execution.getVariable("serviceResource") - utils.log("INFO", "serviceResource : " + serviceResource, isDebugEnabled) - - String resourceInstanceId = execution.getVariable("resourceInstanceId") - utils.log("INFO", "resourceInstanceId : " + resourceInstanceId, isDebugEnabled) - - execution.setVariable("resourceTemplateId", resourceInstanceId) - utils.log("INFO", "resourceTemplateId : " + resourceInstanceId, isDebugEnabled) - - String resourceType = execution.getVariable("resourceType") - utils.log("INFO", "resourceType : " + resourceType, isDebugEnabled) - - - String resourceName = execution.getVariable(Prefix+"resourceName") - if (isBlank(resourceName)){ - resourceName = resourceInstanceId - } - execution.setVariable("resourceName", resourceName) - utils.log("INFO", "resource Name : " + resourceName, isDebugEnabled) - - utils.log("INFO", "Delete Resource Info: resourceInstanceId :" + resourceInstanceId + " resourceTemplateId: " + resourceInstanceId + " resourceType: " + resourceType, isDebugEnabled) - }catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteE2EServiceInstance.preProcessVFCResourceDelete. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - - public void postProcessVFCDelete(DelegateExecution execution, String response, String action) { - def method = getClass().getSimpleName() + '.postProcessVFCDelete(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - - utils.log("INFO", " ======== STARTED postProcessVFCDelete Process ======== ", isDebugEnabled) - try{ - - }catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteE2EServiceInstance.postProcessVFCDelete. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO", "Exited " + method, isDebugEnabled) - } -} - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy deleted file mode 100644 index bbf61744a8..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ /dev/null @@ -1,486 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.infrastructure.scripts - -import org.apache.http.HttpResponse -import org.json.JSONArray -import org.openecomp.mso.bpmn.common.recipe.BpmnRestClient -import org.openecomp.mso.bpmn.common.recipe.ResourceInput -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.Resource -import org.openecomp.mso.bpmn.core.domain.ServiceInstance -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.List; -import java.util.UUID; -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.camunda.bpm.engine.runtime.Execution -import org.json.JSONObject; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource - -import com.fasterxml.jackson.jaxrs.json.annotation.JSONP.Def; - -/** - * This groovy class supports the DoDeleteE2EServiceInstance.bpmn process. - * - * Inputs: - * @param - msoRequestId - * @param - globalSubscriberId - O - * @param - subscriptionServiceType - O - * @param - serviceInstanceId - * @param - serviceInstanceName - O - * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) - * @param - sdncVersion - * @param - failNotFound - TODO - * @param - serviceInputParams - TODO - * - * @param - delResourceList - * @param - serviceRelationShip - * - * Outputs: - * @param - WorkflowException - * - * Rollback - Deferred - */ -public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { - - String Prefix="DDEESI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled) - String msg = "" - - try { - String requestId = execution.getVariable("msoRequestId") - execution.setVariable("prefix",Prefix) - - //Inputs - //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology - String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId - if (globalSubscriberId == null) - { - execution.setVariable("globalSubscriberId", "") - } - - //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology - String serviceType = execution.getVariable("serviceType") - if (serviceType == null) - { - execution.setVariable("serviceType", "") - } - - //Generated in parent for AAI PUT - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)){ - msg = "Input serviceInstanceId is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (isBlank(sdncCallbackUrl)) { - msg = "URN_mso_workflow_sdncadapter_callback is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) - - StringBuilder sbParams = new StringBuilder() - Map paramsMap = execution.getVariable("serviceInputParams") - if (paramsMap != null) - { - sbParams.append("") - for (Map.Entry entry : paramsMap.entrySet()) { - String paramsXml - String paramName = entry.getKey() - String paramValue = entry.getValue() - paramsXml = - """ - ${paramName} - ${paramValue} - - """ - sbParams.append(paramsXml) - } - sbParams.append("") - } - String siParamsXml = sbParams.toString() - if (siParamsXml == null) - siParamsXml = "" - execution.setVariable("siParamsXml", siParamsXml) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) - String msg = "" - - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - String serviceType = "" - - if(foundInAAI){ - utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) - - String siData = execution.getVariable("GENGS_service") - utils.log("INFO", "SI Data", isDebugEnabled) - if (isBlank(siData)) - { - msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - else - { - InputSource source = new InputSource(new StringReader(siData)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document serviceXml = docBuilder.parse(source) - serviceXml.getDocumentElement().normalize() - // get model invariant id - // Get Template uuid and version - if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) { - utils.log("INFO", "SI Data model-invariant-id and model-version-id exist:", isDebugEnabled) - def modelInvariantId = serviceXml.getElementsByTagName("model-invariant-id").item(0).getTextContent() - def modelVersionId = serviceXml.getElementsByTagName("model-version-id").item(0).getTextContent() - - // Set Original Template info - execution.setVariable("model-invariant-id-original", modelInvariantId) - execution.setVariable("model-version-id-original", modelVersionId) - } - - utils.log("INFO", "SI Data" + siData, isDebugEnabled) - //Confirm there are no related service instances (vnf/network or volume) - if (utils.nodeExists(siData, "relationship-list")) { - utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled) - //test(siData) - NodeList nodeList = serviceXml.getElementsByTagName("relationship") - JSONArray jArray = new JSONArray() - for (int x = 0; x < nodeList.getLength(); x++) { - Node node = nodeList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() //for ns - if(e.equals("service-instance")){ - def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent() - utils.log("INFO", "ServiceInstance Related NS :" + relatedObject, isDebugEnabled) - NodeList dataList = node.getChildNodes() - if(null != dataList) { - JSONObject jObj = new JSONObject() - for (int i = 0; i < dataList.getLength(); i++) { - Node dNode = dataList.item(i) - if(dNode.getNodeName() == "relationship-data") { - Element rDataEle = (Element)dNode - def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent() - def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent() - if(eKey.equals("service-instance.service-instance-id")){ - jObj.put("resourceInstanceId", eValue) - } - - } - else if(dNode.getNodeName() == "related-to-property"){ - Element rDataEle = (Element)dNode - def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent() - def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent() - if(eKey.equals("service-instance.service-instance-name")){ - jObj.put("resourceType", eValue) - } - } - } - utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) - jArray.put(jObj) - } - //for overlay/underlay - }else if (e.equals("configuration")){ - def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent() - utils.log("INFO", "ServiceInstance Related Configuration :" + relatedObject, isDebugEnabled) - NodeList dataList = node.getChildNodes() - if(null != dataList) { - JSONObject jObj = new JSONObject() - for (int i = 0; i < dataList.getLength(); i++) { - Node dNode = dataList.item(i) - if(dNode.getNodeName() == "relationship-data") { - Element rDataEle = (Element)dNode - def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent() - def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent() - if(eKey.equals("configuration.configuration-id")){ - jObj.put("resourceInstanceId", eValue) - } - } - else if(dNode.getNodeName() == "related-to-property"){ - Element rDataEle = (Element)dNode - def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent() - def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent() - if(eKey.equals("configuration.configuration-type")){ - jObj.put("resourceType", eValue) - } - } - } - utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) - jArray.put(jObj) - } - } - } - } - execution.setVariable("serviceRelationShip", jArray.toString()) - } - } - }else{ - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - - utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) - } - }catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) - } - - public void getCurrentNS(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start getCurrentNS Process ======== ", isDebugEnabled) - - def currentIndex = execution.getVariable("currentNSIndex") - List nsSequence = execution.getVariable("nsSequence") - String nsResourceType = nsSequence.get(currentIndex) - - // GET AAI by Name, not ID, for process convenient - execution.setVariable("GENGS_type", "service-instance") - execution.setVariable("GENGS_serviceInstanceId", "") - execution.setVariable("GENGS_serviceInstanceName", nsResourceType) - - utils.log("INFO", "======== COMPLETED getCurrentNS Process ======== ", isDebugEnabled) - } - - public void prepareDecomposeService(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - try { - utils.log("DEBUG", " ***** Inside prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled) - String modelInvariantUuid = execution.getVariable("model-invariant-id-original") - String modelVersionId = execution.getVariable("model-version-id-original") - - String serviceModelInfo = """{ - "modelInvariantUuid":"${modelInvariantUuid}", - "modelUuid":"${modelVersionId}", - "modelVersion":"" - }""" - execution.setVariable("serviceModelInfo", serviceModelInfo) - - utils.log("DEBUG", " ***** Completed prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void postDecomposeService(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - utils.log("DEBUG", " ***** Inside processDecomposition() of delete generic e2e service flow ***** ", isDebugEnabled) - try { - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - // service model info - execution.setVariable("serviceModelInfo", serviceDecomposition.getModelInfo()) - - List deleteResourceList = serviceDecomposition.getServiceResources() - String serviceRelationShip = execution.getVariable("serviceRelationShip") - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - - List relationShipList = null - if (serviceRelationShip != null) { - relationShipList = jsonSlurper.parseText(serviceRelationShip) - } - - //Set the real resource instance id to the decomosed resource list - for (Resource resource: deleteResourceList) { - //reset the resource instance id , because in the decompose flow ,its a random one. - resource.setResourceId(""); - //match the resource-instance-name and the model name - if (relationShipList != null) { - relationShipList.each { - if (StringUtils.containsIgnoreCase(it.resourceType, resource.getModelInfo().getModelName())) { - resource.setResourceId(it.resourceInstanceId); - } - } - } - } - execution.setVariable("deleteResourceList", deleteResourceList) - utils.log("DEBUG", "delete resource list : " + deleteResourceList, isDebugEnabled) - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - utils.log("DEBUG", " ***** exit processDecomposition() of delete generic e2e service flow ***** ", isDebugEnabled) - } - - public void preInitResourcesOperStatus(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) - try{ - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String operationType = execution.getVariable("operationType") - String resourceTemplateUUIDs = "" - String result = "processing" - String progress = "0" - String reason = "" - String operationContent = "Prepare service creation" - utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled) - serviceId = UriUtils.encode(serviceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceId) - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", operationType) - List deleteResourceList = execution.getVariable("deleteResourceList") - - String serviceRelationShip = execution.getVariable("serviceRelationShip") - for(Resource resource : deleteResourceList){ - resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" - } - - - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - - String payload = - """ - - - - ${serviceId} - ${operationId} - ${operationType} - ${resourceTemplateUUIDs} - - - """ - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_initResOperStatusRequest", payload) - utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled) - utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled) - execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) - } - utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) - } - - public void postProcessAAIDEL(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIDEL ***** ", isDebugEnabled) - String msg = "" - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator") - if(!succInAAI){ - msg = "Error deleting Service-instance in AAI" + serviceInstanceId - utils.log("INFO", msg, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIDEL. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," *** Exit postProcessAAIDEL *** ", isDebugEnabled) - } - - /** - * post config request. - */ - public void postConfigRequest(execution){ - //to do - } - -} - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy deleted file mode 100644 index 023c80b3ba..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy +++ /dev/null @@ -1,1076 +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.bpmn.infrastructure.scripts; - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.NetworkUtils -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils - -import groovy.xml.XmlUtil -import groovy.json.* - -public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { - String Prefix= "DELNWKI_" - String groovyClassName = "DoDeleteNetworkInstance" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - NetworkUtils networkUtils = new NetworkUtils() - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - - public InitializeProcessVariables(DelegateExecution execution){ - /* Initialize all the process variables in this block */ - - execution.setVariable(Prefix + "networkRequest", "") - execution.setVariable(Prefix + "isSilentSuccess", false) - execution.setVariable(Prefix + "Success", false) - - execution.setVariable(Prefix + "requestId", "") - execution.setVariable(Prefix + "source", "") - execution.setVariable(Prefix + "lcpCloudRegion", "") - execution.setVariable(Prefix + "networkInputs", "") - execution.setVariable(Prefix + "tenantId", "") - - execution.setVariable(Prefix + "queryAAIRequest","") - execution.setVariable(Prefix + "queryAAIResponse", "") - execution.setVariable(Prefix + "aaiReturnCode", "") - execution.setVariable(Prefix + "isAAIGood", false) - execution.setVariable(Prefix + "isVfRelationshipExist", false) - - // AAI query Cloud Region - execution.setVariable(Prefix + "queryCloudRegionRequest","") - execution.setVariable(Prefix + "queryCloudRegionReturnCode","") - execution.setVariable(Prefix + "queryCloudRegionResponse","") - execution.setVariable(Prefix + "cloudRegionPo","") - execution.setVariable(Prefix + "cloudRegionSdnc","") - - execution.setVariable(Prefix + "deleteNetworkRequest", "") - execution.setVariable(Prefix + "deleteNetworkResponse", "") - execution.setVariable(Prefix + "networkReturnCode", "") - execution.setVariable(Prefix + "rollbackNetworkRequest", "") - - execution.setVariable(Prefix + "deleteSDNCRequest", "") - execution.setVariable(Prefix + "deleteSDNCResponse", "") - execution.setVariable(Prefix + "sdncReturnCode", "") - execution.setVariable(Prefix + "sdncResponseSuccess", false) - - execution.setVariable(Prefix + "deactivateSDNCRequest", "") - execution.setVariable(Prefix + "deactivateSDNCResponse", "") - execution.setVariable(Prefix + "deactivateSdncReturnCode", "") - execution.setVariable(Prefix + "isSdncDeactivateRollbackNeeded", "") - - execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", "") - execution.setVariable(Prefix + "isException", false) - - - } - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest() of " + groovyClassName + " Request ***** ", isDebugEnabled) - - // initialize flow variables - InitializeProcessVariables(execution) - - try { - // get incoming message/input - execution.setVariable("action", "DELETE") - String deleteNetwork = execution.getVariable("bpmnRequest") - if (deleteNetwork != null) { - if (deleteNetwork.contains("requestDetails")) { - // JSON format request is sent, create xml - try { - def prettyJson = JsonOutput.prettyPrint(deleteNetwork.toString()) - utils.log("DEBUG", " Incoming message formatted . . . : " + '\n' + prettyJson, isDebugEnabled) - deleteNetwork = vidUtils.createXmlNetworkRequestInfra(execution, deleteNetwork) - - } catch (Exception ex) { - String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - } else { - // XML format request is sent - - } - } else { - // vIPR format request is sent, create xml from individual variables - deleteNetwork = vidUtils.createXmlNetworkRequestInstance(execution) - } - - deleteNetwork = utils.formatXml(deleteNetwork) - utils.logAudit(deleteNetwork) - execution.setVariable(Prefix + "networkRequest", deleteNetwork) - utils.log("DEBUG", Prefix + "networkRequest - " + '\n' + deleteNetwork, isDebugEnabled) - - // validate 'backout-on-failure' to override 'URN_mso_rollback' - boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, deleteNetwork) - execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled) - utils.log("DEBUG", Prefix + "rollbackEnabled - " + rollbackEnabled, isDebugEnabled) - - String networkInputs = utils.getNodeXml(deleteNetwork, "network-inputs", false).replace("tag0:","").replace(":tag0","") - execution.setVariable(Prefix + "networkInputs", networkInputs) - - // prepare messageId - String messageId = execution.getVariable("testMessageId") // for testing - if (messageId == null || messageId == "") { - messageId = UUID.randomUUID() - utils.log("DEBUG", Prefix + "messageId, random generated: " + messageId, isDebugEnabled) - } else { - utils.log("DEBUG", Prefix + "messageId, pre-assigned: " + messageId, isDebugEnabled) - } - execution.setVariable(Prefix + "messageId", messageId) - - String source = utils.getNodeText1(deleteNetwork, "source") - execution.setVariable(Prefix + "source", source) - utils.log("DEBUG", Prefix + "source - " + source, isDebugEnabled) - - String networkId = "" - if (utils.nodeExists(networkInputs, "network-id")) { - networkId = utils.getNodeText1(networkInputs, "network-id") - if (networkId == null || networkId == "" || networkId == 'null' ) { - sendSyncError(execution) - // missing value of network-id - String dataErrorMessage = "network-request has missing 'network-id' element/value." - utils.log("DEBUG", " Invalid Request - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - } - - // lcpCloudRegion or tenantId not sent, will be extracted from query AA&I - def lcpCloudRegion = null - if (utils.nodeExists(networkInputs, "aic-cloud-region")) { - lcpCloudRegion = utils.getNodeText1(networkInputs, "aic-cloud-region") - if (lcpCloudRegion == 'null') { - lcpCloudRegion = null - } - } - execution.setVariable(Prefix + "lcpCloudRegion", lcpCloudRegion) - utils.log("DEBUG", "lcpCloudRegion : " + lcpCloudRegion, isDebugEnabled) - - String tenantId = null - if (utils.nodeExists(networkInputs, "tenant-id")) { - tenantId = utils.getNodeText1(networkInputs, "tenant-id") - if (tenantId == 'null') { - tenantId = null - } - - } - execution.setVariable(Prefix + "tenantId", tenantId) - utils.log("DEBUG", "tenantId : " + tenantId, isDebugEnabled) - - String sdncVersion = execution.getVariable("sdncVersion") - utils.log("DEBUG", "sdncVersion? : " + sdncVersion, isDebugEnabled) - - // PO Authorization Info / headers Authorization= - String basicAuthValuePO = execution.getVariable("URN_mso_adapters_po_auth") - utils.log("DEBUG", " Obtained BasicAuth userid password for PO/SDNC adapter: " + basicAuthValuePO, isDebugEnabled) - try { - def encodedString = utils.getBasicAuth(basicAuthValuePO, execution.getVariable("URN_mso_msoKey")) - execution.setVariable("BasicAuthHeaderValuePO",encodedString) - execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) - - } catch (IOException ex) { - String dataErrorMessage = " Unable to encode PO/SDNC user/password string - " + ex.getMessage() - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex){ - // caught exception - String exceptionMessage = "Exception Encountered in DoDeleteNetworkInstance, PreProcessRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - public void callRESTQueryAAI (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAI() of DoDoDeleteNetworkInstance ***** " , isDebugEnabled) - - // get variables - String networkInputs = execution.getVariable(Prefix + "networkInputs") - String networkId = utils.getNodeText(networkInputs, "network-id") - networkId = UriUtils.encode(networkId,"UTF-8") - - // Prepare AA&I url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String queryAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" - utils.logAudit(queryAAIRequest) - execution.setVariable(Prefix + "queryAAIRequest", queryAAIRequest) - utils.log("DEBUG", Prefix + "AAIRequest - " + "\n" + queryAAIRequest, isDebugEnabled) - - RESTConfig config = new RESTConfig(queryAAIRequest); - - ExceptionUtil exceptionUtil = new ExceptionUtil() - Boolean isVfRelationshipExist = false - try { - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryAAIRequest) - String returnCode = response.getStatusCode() - execution.setVariable(Prefix + "aaiReturnCode", returnCode) - - utils.log("DEBUG", " ***** AAI Response Code : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) - execution.setVariable(Prefix + "queryAAIResponse", aaiResponseAsString) - - if (returnCode=='200' || returnCode=='204') { - utils.logAudit(aaiResponseAsString) - execution.setVariable(Prefix + "isAAIGood", true) - utils.log("DEBUG", " AAI Query Success REST Response - " + "\n" + aaiResponseAsString, isDebugEnabled) - // verify if vf or vnf relationship exist - if (utils.nodeExists(aaiResponseAsString, "relationship")) { - NetworkUtils networkUtils = new NetworkUtils() - isVfRelationshipExist = networkUtils.isVfRelationshipExist(aaiResponseAsString) - execution.setVariable(Prefix + "isVfRelationshipExist", isVfRelationshipExist) - if (isVfRelationshipExist) { - String relationshipMessage = "AAI Query Success Response but 'vf-module' relationship exist, not allowed to delete: network Id: " + networkId - exceptionUtil.buildWorkflowException(execution, 2500, relationshipMessage) - - } else { - // verify if lcpCloudRegion was sent as input, if not get value from AAI Response - if (execution.getVariable(Prefix + "lcpCloudRegion") == null ) { - String lcpCloudRegion = networkUtils.getCloudRegion(aaiResponseAsString) - execution.setVariable(Prefix + "lcpCloudRegion", lcpCloudRegion) - utils.log("DEBUG", " Get AAI getCloudRegion() : " + lcpCloudRegion, isDebugEnabled) - } - if (execution.getVariable(Prefix + "tenantId") == null ) { - String tenantId = networkUtils.getTenantId(aaiResponseAsString) - execution.setVariable(Prefix + "tenantId", tenantId) - utils.log("DEBUG", " Get AAI getTenantId() : " + tenantId, isDebugEnabled) - } - - } - } - utils.log("DEBUG", Prefix + "isVfRelationshipExist - " + isVfRelationshipExist, isDebugEnabled) - - } else { - execution.setVariable(Prefix + "isAAIGood", false) - if (returnCode=='404' || aaiResponseAsString == "" || aaiResponseAsString == null) { - // not found // empty aai response - execution.setVariable(Prefix + "isSilentSuccess", true) - utils.log("DEBUG", " AAI Query is Silent Success", isDebugEnabled) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Error Response from callRESTQueryAAI() - " + returnCode - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - utils.log("DEBUG", " AAI Query call, isAAIGood? : " + execution.getVariable(Prefix + "isAAIGood"), isDebugEnabled) - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Exception Encountered in DoDeleteNetworkInstance, callRESTQueryAAI() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAICloudRegion (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAICloudRegion of DoDeleteNetworkInstance ***** " , isDebugEnabled) - - try { - String networkInputs = execution.getVariable(Prefix + "networkInputs") - // String cloudRegion = utils.getNodeText(networkInputs, "aic-cloud-region") - String cloudRegion = execution.getVariable(Prefix + "lcpCloudRegion") - cloudRegion = UriUtils.encode(cloudRegion,"UTF-8") - // Prepare AA&I url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUtil = new AaiUtil(this) - String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) - String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion - utils.logAudit(queryCloudRegionRequest) - execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest) - utils.log("DEBUG", Prefix + "queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest, isDebugEnabled) - - String cloudRegionPo = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) - String cloudRegionSdnc = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "SDNC", cloudRegion) - - if ((cloudRegionPo != "ERROR") && (cloudRegionSdnc != "ERROR")) { - execution.setVariable(Prefix + "cloudRegionPo", cloudRegionPo) - execution.setVariable(Prefix + "cloudRegionSdnc", cloudRegionSdnc) - - } else { - String dataErrorMessage = "QueryAAICloudRegion Unsuccessful. Return Code: " + execution.getVariable(Prefix + "queryCloudRegionReturnCode") - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, callRESTQueryAAICloudRegion(). Unexpected Response from AAI - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareNetworkRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside prepareNetworkRequest of DoDeleteNetworkInstance ***** ", isDebugEnabled) - ExceptionUtil exceptionUtil = new ExceptionUtil() - try { - // get variables - String networkRequest = execution.getVariable(Prefix + "networkRequest") - String cloudSiteId = execution.getVariable(Prefix + "cloudRegionPo") - String tenantId = execution.getVariable(Prefix + "tenantId") - - String queryAAIResponse = execution.getVariable(Prefix + "queryAAIResponse") - String networkType = utils.getNodeText1(queryAAIResponse, "network-type") - String networkId = utils.getNodeText1(queryAAIResponse, "network-id") - String backoutOnFailure = execution.getVariable(Prefix + "rollbackEnabled") - - String networkStackId = "" - networkStackId = utils.getNodeText1(queryAAIResponse, "heat-stack-id") - if (networkStackId == 'null' || networkStackId == "" || networkStackId == null) { - networkStackId = "force_delete" - } - - String requestId = execution.getVariable("msoRequestId") - if (requestId != null) { - execution.setVariable("mso-request-id", requestId) - } else { - requestId = execution.getVariable("mso-request-id") - } - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - // Added new Elements - String messageId = execution.getVariable(Prefix + "messageId") - String notificationUrl = "" //TODO - is this coming from URN? What variable/value to use? - //String notificationUrl = execution.getVariable("URN_?????") //TODO - is this coming from URN? What variable/value to use? - - String modelCustomizationUuid = "" - if (utils.nodeExists(networkRequest, "networkModelInfo")) { - String networkModelInfo = utils.getNodeXml(networkRequest, "networkModelInfo", false).replace("tag0:","").replace(":tag0","") - modelCustomizationUuid = utils.getNodeText1(networkModelInfo, "modelCustomizationUuid") - } else { - modelCustomizationUuid = utils.getNodeText1(networkRequest, "modelCustomizationId") - } - - String deleteNetworkRequest = """ - - ${cloudSiteId} - ${tenantId} - ${networkId} - ${networkStackId} - ${networkType} - ${modelCustomizationUuid} - true - - ${requestId} - ${serviceInstanceId} - - ${messageId} - ${notificationUrl} - - """.trim() - - utils.log("DEBUG", Prefix + "deleteNetworkRequest - " + "\n" + deleteNetworkRequest, isDebugEnabled) - // Format Response - String buildDeleteNetworkRequestAsString = utils.formatXml(deleteNetworkRequest) - utils.logAudit(buildDeleteNetworkRequestAsString) - utils.log("DEBUG", Prefix + "deleteNetworkRequestAsString - " + "\n" + buildDeleteNetworkRequestAsString, isDebugEnabled) - - String restURL = execution.getVariable("URN_mso_adapters_network_rest_endpoint") - execution.setVariable("URN_mso_adapters_network_rest_endpoint", restURL + "/" + networkId) - utils.log("DEBUG", "URN_mso_adapters_network_rest_endpoint - " + "\n" + restURL + "/" + networkId, isDebugEnabled) - - execution.setVariable(Prefix + "deleteNetworkRequest", buildDeleteNetworkRequestAsString) - utils.log("DEBUG", Prefix + "deleteNetworkRequest - " + "\n" + buildDeleteNetworkRequestAsString, isDebugEnabled) - } - catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareNetworkRequest(). Unexpected Response from AAI - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - } - - /** - * This method is used instead of an HTTP Connector task because the - * connector does not allow DELETE with a body. - */ - public void sendRequestToVnfAdapter(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' + - 'execution=' + execution.getId() + - ')' - def isDebugEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugEnabled) - - try { - - String vnfAdapterUrl = execution.getVariable("URN_mso_adapters_network_rest_endpoint") - String vnfAdapterRequest = execution.getVariable(Prefix + "deleteNetworkRequest") - - RESTConfig config = new RESTConfig(vnfAdapterUrl) - RESTClient client = new RESTClient(config). - addHeader("Content-Type", "application/xml"). - addAuthorizationHeader(execution.getVariable("BasicAuthHeaderValuePO")); - - APIResponse response; - - response = client.httpDelete(vnfAdapterRequest) - - execution.setVariable(Prefix + "networkReturnCode", response.getStatusCode()) - execution.setVariable(Prefix + "deleteNetworkResponse", response.getResponseBodyAsString()) - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, sendRequestToVnfAdapter() - " + ex.getMessage() - logError(exceptionMessage) - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - } - - - public void prepareSDNCRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside prepareSDNCRequest of DoDeleteNetworkInstance ***** ", isDebugEnabled) - - try { - // get variables - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") - - String networkId = "" - if (utils.nodeExists(deleteNetworkInput, "network-id")) { - networkId = utils.getNodeText1(deleteNetworkInput, "network-id") - } - if (networkId == 'null') {networkId = ""} - - String serviceInstanceId = utils.getNodeText1(deleteNetworkInput, "service-instance-id") - - // get/set 'msoRequestId' and 'mso-request-id' - String requestId = execution.getVariable("msoRequestId") - if (requestId != null) { - execution.setVariable("mso-request-id", requestId) - } else { - requestId = execution.getVariable("mso-request-id") - } - execution.setVariable(Prefix + "requestId", requestId) - utils.log("DEBUG", Prefix + "requestId " + requestId, isDebugEnabled) - String queryAAIResponse = execution.getVariable(Prefix + "queryAAIResponse") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") - // 1. prepare delete topology via SDNC Adapter SUBFLOW call - String sndcTopologyDeleteRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "delete", "DisconnectNetworkRequest", cloudRegionId, networkId, queryAAIResponse, null) - String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) - utils.logAudit(sndcTopologyDeleteRequesAsString) - execution.setVariable(Prefix + "deleteSDNCRequest", sndcTopologyDeleteRequesAsString) - utils.log("DEBUG", Prefix + "deleteSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage() - logError(exceptionMessage) - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareRpcSDNCRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside prepareRpcSDNCRequest of DoDeleteNetworkInstance ***** ", isDebugEnabled) - - try { - // get variables - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") - - String networkId = "" - if (utils.nodeExists(deleteNetworkInput, "network-id")) { - networkId = utils.getNodeText1(deleteNetworkInput, "network-id") - } - if (networkId == 'null') {networkId = ""} - - String serviceInstanceId = utils.getNodeText1(deleteNetworkInput, "service-instance-id") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") - // 1. prepare delete topology via SDNC Adapter SUBFLOW call - String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "unassign", "DeleteNetworkInstance", cloudRegionId, networkId, null) - String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) - utils.logAudit(sndcTopologyDeleteRequesAsString) - execution.setVariable(Prefix + "deleteSDNCRequest", sndcTopologyDeleteRequesAsString) - utils.log("DEBUG", Prefix + "deleteSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage() - logError(exceptionMessage) - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - public void prepareRpcSDNCDeactivate(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareRpcSDNCDeactivate() of DoDeleteNetworkInstance ***** ", isDebugEnabled) - - try { - - // get variables - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") - String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") - String networkId = "" - if (utils.nodeExists(deleteNetworkInput, "network-id")) { - networkId = utils.getNodeText1(deleteNetworkInput, "network-id") - } - if (networkId == 'null') {networkId = ""} - String serviceInstanceId = utils.getNodeText1(deleteNetworkInput, "service-instance-id") - - String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "deactivate", "DeleteNetworkInstance", cloudRegionId, networkId, null) - String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) - execution.setVariable(Prefix + "deactivateSDNCRequest", sndcTopologyRollbackRpcRequestAsString) - utils.log("DEBUG", " Preparing request for RPC SDNC Topology deactivate - " + "\n" + sndcTopologyRollbackRpcRequestAsString, isDebugEnabled) - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRpcSDNCActivateRollback() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - // ************************************************** - // Post or Validate Response Section - // ************************************************** - - public void validateNetworkResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside validateNetworkResponse of DoDeleteNetworkInstance *****", isDebugEnabled) - - try { - String returnCode = execution.getVariable(Prefix + "networkReturnCode") - String networkResponse = execution.getVariable(Prefix + "deleteNetworkResponse") - - utils.log("DEBUG", " Network Adapter responseCode: " + returnCode, isDebugEnabled) - utils.log("DEBUG", "Network Adapter Response - " + "\n" + networkResponse, isDebugEnabled) - utils.logAudit(networkResponse) - - String errorMessage = "" - if (returnCode == "200") { - utils.log("DEBUG", " Network Adapter Response is successful - " + "\n" + networkResponse, isDebugEnabled) - - // prepare rollback data - String rollbackData = utils.getNodeXml(networkResponse, "rollback", false).replace("tag0:","").replace(":tag0","") - if ((rollbackData == null) || (rollbackData.isEmpty())) { - utils.log("DEBUG", " Network Adapter 'rollback' data is not Sent: " + "\n" + networkResponse, isDebugEnabled) - execution.setVariable(Prefix + "rollbackNetworkRequest", "") - } else { - String rollbackNetwork = - """ - ${rollbackData} - """ - String rollbackNetworkXml = utils.formatXml(rollbackNetwork) - execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkXml) - utils.log("DEBUG", " Network Adapter rollback data - " + "\n" + rollbackNetworkXml, isDebugEnabled) - } - - - } else { // network error - if (returnCode.toInteger() > 399 && returnCode.toInteger() < 600) { //4xx, 5xx - if (networkResponse.contains("deleteNetworkError") ) { - networkResponse = networkResponse.replace('', '') - errorMessage = utils.getNodeText1(networkResponse, "message") - errorMessage = "Received error from Network Adapter: " + errorMessage - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - - } else { // CatchAll exception - if (returnCode == "500") { - errorMessage = "JBWEB000065: HTTP Status 500." - } else { - errorMessage = "Return code is " + returnCode - } - errorMessage = "Received error from Network Adapter: " + errorMessage - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - - } - - } else { // CatchAll exception - String dataErrorMessage = "Received error from Network Adapter. Return code is: " + returnCode - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, validateNetworkResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void validateSDNCResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside validateSDNCResponse of DoDeleteNetworkInstance ***** ", isDebugEnabled) - - String response = execution.getVariable(Prefix + "deleteSDNCResponse") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - WorkflowException workflowException = execution.getVariable("WorkflowException") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - // reset variable - String deleteSDNCResponseDecodeXml = sdncAdapterUtils.decodeXML(execution.getVariable(Prefix + "deleteSDNCResponse")) - deleteSDNCResponseDecodeXml = deleteSDNCResponseDecodeXml.replace("&", "&").replace('', "") - execution.setVariable(Prefix + "deleteSDNCResponse", deleteSDNCResponseDecodeXml) - - if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, prefix+'sdncResponseSuccess' - execution.setVariable(Prefix + "isSdncRollbackNeeded", true) // - execution.setVariable(Prefix + "isPONR", true) - utils.log("DEBUG", "Successfully Validated SDNC Response", isDebugEnabled) - } else { - utils.log("DEBUG", "Did NOT Successfully Validated SDNC Response", isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - - } - - public void validateRpcSDNCDeactivateResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside validateRpcSDNCDeactivateResponse() of DoDeleteNetworkInstance ***** ", isDebugEnabled) - - String response = execution.getVariable(Prefix + "deactivateSDNCResponse") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - WorkflowException workflowException = execution.getVariable("WorkflowException") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - // reset variable - String assignSDNCResponseDecodeXml = sdncAdapterUtils.decodeXML(execution.getVariable(Prefix + "deactivateSDNCResponse")) - assignSDNCResponseDecodeXml = assignSDNCResponseDecodeXml.replace("&", "&").replace('', "") - execution.setVariable(Prefix + "deactivateSDNCResponse", assignSDNCResponseDecodeXml) - - if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, Prefix+'sdncResponseSuccess' - execution.setVariable(Prefix + "isSdncDeactivateRollbackNeeded", true) - utils.log("DEBUG", "Successfully Validated Rpc SDNC Activate Response", isDebugEnabled) - - } else { - utils.log("DEBUG", "Did NOT Successfully Validated Rpc SDNC Deactivate Response", isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - - } - - public void prepareRpcSDNCDeactivateRollback(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareRpcSDNCDeactivateRollback() of DoDeleteNetworkInstance ***** ", isDebugEnabled) - - try { - - // get variables - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") - String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") - String deactivateSDNCResponse = execution.getVariable(Prefix + "deactivateSDNCResponse") - String networkId = utils.getNodeText1(deactivateSDNCResponse, "network-id") - if (networkId == 'null') {networkId = ""} - String serviceInstanceId = utils.getNodeText1(deleteNetworkInput, "service-instance-id") - - // 2. prepare rollback topology via SDNC Adapter SUBFLOW call - String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "activate", "CreateNetworkInstance", cloudRegionId, networkId, null) - String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) - execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", sndcTopologyRollbackRpcRequestAsString) - utils.log("DEBUG", " Preparing request for RPC SDNC Topology 'activate-CreateNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString, isDebugEnabled) - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRpcSDNCDeactivateRollback() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareRollbackData(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareRollbackData() of DoDeleteNetworkInstance ***** ", isDebugEnabled) - - try { - - Map rollbackData = new HashMap(); - String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") - if (rollbackNetworkRequest != null) { - if (rollbackNetworkRequest != "") { - rollbackData.put("rollbackNetworkRequest", execution.getVariable(Prefix + "rollbackNetworkRequest")) - } - } - String rollbackDeactivateSDNCRequest = execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest") - if (rollbackDeactivateSDNCRequest != null) { - if (rollbackDeactivateSDNCRequest != "") { - rollbackData.put("rollbackDeactivateSDNCRequest", execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest")) - } - } - execution.setVariable("rollbackData", rollbackData) - utils.log("DEBUG", "** rollbackData : " + rollbackData, isDebugEnabled) - - execution.setVariable("WorkflowException", execution.getVariable("WorkflowException")) - utils.log("DEBUG", "** WorkflowException : " + execution.getVariable("WorkflowException"), isDebugEnabled) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRollbackData() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void postProcessResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside postProcessResponse of DoDeleteNetworkInstance ***** ", isDebugEnabled) - - try { - - utils.log("DEBUG", " ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException"), isDebugEnabled) - if (execution.getVariable(Prefix + "isException") == false) { - execution.setVariable(Prefix + "Success", true) - execution.setVariable("WorkflowException", null) - if (execution.getVariable(Prefix + "isSilentSuccess") == true) { - execution.setVariable("rolledBack", false) - } else { - execution.setVariable("rolledBack", true) - } - prepareSuccessRollbackData(execution) // populate rollbackData - - } else { - execution.setVariable(Prefix + "Success", false) - execution.setVariable("rollbackData", null) - String exceptionMessage = " Exception encountered in MSO Bpmn. " - if (execution.getVariable("workflowException") != null) { // Output of Rollback flow. - utils.log("DEBUG", " ***** workflowException: " + execution.getVariable("workflowException"), isDebugEnabled) - WorkflowException wfex = execution.getVariable("workflowException") - exceptionMessage = wfex.getErrorMessage() - } else { - if (execution.getVariable(Prefix + "WorkflowException") != null) { - WorkflowException pwfex = execution.getVariable(Prefix + "WorkflowException") - exceptionMessage = pwfex.getErrorMessage() - } else { - if (execution.getVariable("WorkflowException") != null) { - WorkflowException pwfex = execution.getVariable("WorkflowException") - exceptionMessage = pwfex.getErrorMessage() - } - } - } - - // going to the Main flow: a-la-carte or macro - utils.log("DEBUG", " ***** postProcessResponse(), BAD !!!", isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - throw new BpmnError("MSOWorkflowException") - - } - - } catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, postProcessResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - throw new BpmnError("MSOWorkflowException") - - } - - } - - public void prepareSuccessRollbackData(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareSuccessRollbackData() of DoDeleteNetworkInstance ***** ", isDebugEnabled) - - try { - - if (execution.getVariable("sdncVersion") != '1610') { - prepareRpcSDNCDeactivateRollback(execution) - prepareRpcSDNCUnassignRollback(execution) - } else { - prepareSDNCRollback(execution) - } - - Map rollbackData = new HashMap(); - String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") - if (rollbackSDNCRequest != null) { - if (rollbackSDNCRequest != "") { - rollbackData.put("rollbackSDNCRequest", execution.getVariable(Prefix + "rollbackSDNCRequest")) - } - } - String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") - if (rollbackNetworkRequest != null) { - if (rollbackNetworkRequest != "") { - rollbackData.put("rollbackNetworkRequest", execution.getVariable(Prefix + "rollbackNetworkRequest")) - } - } - String rollbackDeactivateSDNCRequest = execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest") - if (rollbackDeactivateSDNCRequest != null) { - if (rollbackDeactivateSDNCRequest != "") { - rollbackData.put("rollbackDeactivateSDNCRequest", execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest")) - } - } - execution.setVariable("rollbackData", rollbackData) - - utils.log("DEBUG", "** rollbackData : " + rollbackData, isDebugEnabled) - execution.setVariable("WorkflowException", null) - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareRpcSDNCUnassignRollback(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareRpcSDNCUnassignRollbac() of DoDeleteNetworkInstance ***** ", isDebugEnabled) - - try { - - // get variables - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") - - String deleteSDNCResponse = execution.getVariable(Prefix + "deleteSDNCResponse") - String networkId = utils.getNodeText1(deleteSDNCResponse, "network-id") - if (networkId == 'null') {networkId = ""} - String serviceInstanceId = utils.getNodeText1(deleteNetworkInput, "service-instance-id") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") - // 1. prepare delete topology via SDNC Adapter SUBFLOW call - String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "assign", "CreateNetworkInstance", cloudRegionId, networkId, null) - String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) - utils.logAudit(sndcTopologyDeleteRequesAsString) - execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyDeleteRequesAsString) - utils.log("DEBUG", Prefix + "rollbackSDNCRequest" + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) - utils.log("DEBUG", " Preparing request for RPC SDNC Topology 'assign-CreateNetworkInstance' rollback . . . - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRpcSDNCUnassignRollback() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareSDNCRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside prepareSDNCRollback of DoDeleteNetworkInstance ***** ", isDebugEnabled) - - try { - - // get variables - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") - - String networkId = "" - if (utils.nodeExists(deleteNetworkInput, "network-id")) { - networkId = utils.getNodeText1(deleteNetworkInput, "network-id") - } - if (networkId == 'null') {networkId = ""} - - String serviceInstanceId = utils.getNodeText1(deleteNetworkInput, "service-instance-id") - - // get/set 'msoRequestId' and 'mso-request-id' - String requestId = execution.getVariable("msoRequestId") - if (requestId != null) { - execution.setVariable("mso-request-id", requestId) - } else { - requestId = execution.getVariable("mso-request-id") - } - execution.setVariable(Prefix + "requestId", requestId) - - String queryAAIResponse = execution.getVariable(Prefix + "queryAAIResponse") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") - // 1. prepare delete topology via SDNC Adapter SUBFLOW call - String sndcTopologyDeleteRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "rollback", "DisconnectNetworkRequest", cloudRegionId, networkId, queryAAIResponse, null) - String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) - utils.logAudit(sndcTopologyDeleteRequesAsString) - execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyDeleteRequesAsString) - utils.log("DEBUG", Prefix + "rollbackSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) - utils.log("DEBUG", " Preparing request for RPC SDNC Topology 'rollback-DisconnectNetworkRequest' rollback . . . - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) - - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRollback() - " + ex.getMessage() - logError(exceptionMessage) - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void setExceptionFlag(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside setExceptionFlag() of DoDeleteNetworkInstance ***** ", isDebugEnabled) - - try { - - execution.setVariable(Prefix + "isException", true) - - if (execution.getVariable("SavedWorkflowException1") != null) { - execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) - } else { - execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) - } - utils.log("DEBUG", Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException"), isDebugEnabled) - - } catch(Exception ex){ - String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance flow. setExceptionFlag(): " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - } - - } - - - // ******************************* - // Build Error Section - // ******************************* - - public void processJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - try{ - utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable("UnexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method") - } - utils.log("DEBUG", "Completed processJavaException Method of " + Prefix, isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy deleted file mode 100644 index c45b90f953..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy +++ /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.bpmn.infrastructure.scripts; - -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.NetworkUtils -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils - -/** - * This groovy class supports the DoCreateNetworkInstanceRollback.bpmn process. - * - */ -public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcessor { - String Prefix="DELNWKIR_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - NetworkUtils networkUtils = new NetworkUtils() - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - - def className = getClass().getSimpleName() - - /** - * This method is executed during the preProcessRequest task of the DoDeleteNetworkInstanceRollback.bpmn process. - * @param execution - */ - public InitializeProcessVariables(DelegateExecution execution){ - /* Initialize all the process variables in this block */ - - execution.setVariable(Prefix + "WorkflowException", null) - - execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", null) - execution.setVariable(Prefix + "rollbackDeactivateSDNCResponse", "") - execution.setVariable(Prefix + "rollbackDeactivateSDNCReturnCode", "") - - execution.setVariable(Prefix + "rollbackSDNCRequest", "") - execution.setVariable(Prefix + "rollbackSDNCResponse", "") - execution.setVariable(Prefix + "rollbackSDNCReturnCode", "") - - execution.setVariable(Prefix + "rollbackNetworkRequest", null) - execution.setVariable(Prefix + "rollbackNetworkResponse", "") - execution.setVariable(Prefix + "rollbackNetworkReturnCode", "") - - execution.setVariable(Prefix + "Success", false) - execution.setVariable(Prefix + "fullRollback", false) - - } - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - /** - * This method is executed during the preProcessRequest task of the DoDeleteNetworkInstanceRollback.bpmn process. - * @param execution - */ - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest() of " + className + ".groovy ***** ", isDebugEnabled) - - try { - // initialize flow variables - InitializeProcessVariables(execution) - - // GET Incoming request/variables - String rollbackDeactivateSDNCRequest = null - String rollbackSDNCRequest = null - String rollbackNetworkRequest = null - - Map rollbackData = execution.getVariable("rollbackData") - if (rollbackData != null && rollbackData instanceof Map) { - - if(rollbackData.containsKey("rollbackDeactivateSDNCRequest")) { - rollbackDeactivateSDNCRequest = rollbackData["rollbackDeactivateSDNCRequest"] - } - - if(rollbackData.containsKey("rollbackSDNCRequest")) { - rollbackSDNCRequest = rollbackData["rollbackSDNCRequest"] - } - - if(rollbackData.containsKey("rollbackNetworkRequest")) { - rollbackNetworkRequest = rollbackData["rollbackNetworkRequest"] - } - } - - execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkRequest) - execution.setVariable(Prefix + "rollbackSDNCRequest", rollbackSDNCRequest) - execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", rollbackDeactivateSDNCRequest) - utils.log("DEBUG", "'rollbackData': " + '\n' + execution.getVariable("rollbackData"), isDebugEnabled) - - String sdncVersion = execution.getVariable("sdncVersion") - utils.log("DEBUG", "sdncVersion? : " + sdncVersion, isDebugEnabled) - - // PO Authorization Info / headers Authorization= - String basicAuthValuePO = execution.getVariable("URN_mso_adapters_po_auth") - utils.log("DEBUG", " Obtained BasicAuth userid password for PO/SDNC adapter: " + basicAuthValuePO, isDebugEnabled) - try { - def encodedString = utils.getBasicAuth(basicAuthValuePO, execution.getVariable("URN_mso_msoKey")) - execution.setVariable("BasicAuthHeaderValuePO",encodedString) - execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) - - } catch (IOException ex) { - String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " - String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() - utils.log("DEBUG", dataErrorMessage , isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - if (execution.getVariable("SavedWorkflowException1") != null) { - execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) - } else { - execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) - } - utils.log("DEBUG", "*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException"), isDebugEnabled) - if(execution.getVariable(Prefix + "WorkflowException") != null) { - // called by: DoCreateNetworkInstance, partial rollback - execution.setVariable(Prefix + "fullRollback", false) - - } else { - // called by: Macro - Full Rollback, WorkflowException = null - execution.setVariable(Prefix + "fullRollback", true) - - } - - utils.log("DEBUG", "*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"), isDebugEnabled) - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - sendSyncError(execution) - // caught exception - String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void validateRollbackResponses (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside validateRollbackResponses() of DoDeleteNetworkInstanceRollback ***** ", isDebugEnabled) - - try { - - // validate SDNC activate response - String rollbackDeactivateSDNCMessages = "" - String rollbackDeactivateSDNCReturnCode = "200" - if (execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest") != null) { - rollbackDeactivateSDNCReturnCode = execution.getVariable(Prefix + "rollbackDeactivateSDNCReturnCode") - String rollbackDeactivateSDNCResponse = execution.getVariable(Prefix + "rollbackDeactivateSDNCResponse") - String rollbackDeactivateSDNCReturnInnerCode = "" - rollbackDeactivateSDNCResponse = sdncAdapterUtils.decodeXML(rollbackDeactivateSDNCResponse) - rollbackDeactivateSDNCResponse = rollbackDeactivateSDNCResponse.replace("&", "&").replace('$', '').replace('', "") - if (rollbackDeactivateSDNCReturnCode == "200") { - if (utils.nodeExists(rollbackDeactivateSDNCResponse, "response-code")) { - rollbackDeactivateSDNCReturnInnerCode = utils.getNodeText1(rollbackDeactivateSDNCResponse, "response-code") - if (rollbackDeactivateSDNCReturnInnerCode == "200" || rollbackDeactivateSDNCReturnInnerCode == "" || rollbackDeactivateSDNCReturnInnerCode == "0") { - rollbackDeactivateSDNCMessages = " + SNDC deactivate rollback completed." - } else { - rollbackDeactivateSDNCMessages = " + SDNC deactivate rollback failed. " - } - } else { - rollbackDeactivateSDNCMessages = " + SNDC deactivate rollback completed." - } - } else { - rollbackDeactivateSDNCMessages = " + SDNC deactivate rollback failed. " - } - utils.log("DEBUG", " SDNC deactivate rollback Code - " + rollbackDeactivateSDNCReturnCode, isDebugEnabled) - utils.log("DEBUG", " SDNC deactivate rollback Response - " + rollbackDeactivateSDNCResponse, isDebugEnabled) - } - - // validate SDNC rollback response - String rollbackSdncErrorMessages = "" - String rollbackSDNCReturnCode = "200" - if (execution.getVariable(Prefix + "rollbackSDNCRequest") != null) { - rollbackSDNCReturnCode = execution.getVariable(Prefix + "rollbackSDNCReturnCode") - String rollbackSDNCResponse = execution.getVariable(Prefix + "rollbackSDNCResponse") - String rollbackSDNCReturnInnerCode = "" - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - rollbackSDNCResponse = sdncAdapterUtils.decodeXML(rollbackSDNCResponse) - rollbackSDNCResponse = rollbackSDNCResponse.replace("&", "&").replace('$', '').replace('', "") - if (rollbackSDNCReturnCode == "200") { - if (utils.nodeExists(rollbackSDNCResponse, "response-code")) { - rollbackSDNCReturnInnerCode = utils.getNodeText1(rollbackSDNCResponse, "response-code") - if (rollbackSDNCReturnInnerCode == "200" || rollbackSDNCReturnInnerCode == "" || rollbackSDNCReturnInnerCode == "0") { - rollbackSdncErrorMessages = " + SNDC unassign rollback completed." - } else { - rollbackSdncErrorMessages = " + SDNC unassign rollback failed. " - } - } else { - rollbackSdncErrorMessages = " + SNDC unassign rollback completed." - } - } else { - rollbackSdncErrorMessages = " + SDNC unassign rollback failed. " - } - utils.log("DEBUG", " SDNC assign rollback Code - " + rollbackSDNCReturnCode, isDebugEnabled) - utils.log("DEBUG", " SDNC assign rollback Response - " + rollbackSDNCResponse, isDebugEnabled) - } - - // validate PO network rollback response - String rollbackNetworkErrorMessages = "" - String rollbackNetworkReturnCode = "200" - if (execution.getVariable(Prefix + "rollbackNetworkRequest") != null) { - rollbackNetworkReturnCode = execution.getVariable(Prefix + "rollbackNetworkReturnCode") - String rollbackNetworkResponse = execution.getVariable(Prefix + "rollbackNetworkResponse") - if (rollbackNetworkReturnCode != "200") { - rollbackNetworkErrorMessages = " + PO Network rollback failed. " - } else { - rollbackNetworkErrorMessages = " + PO Network rollback completed." - } - - utils.log("DEBUG", " NetworkRollback Code - " + rollbackNetworkReturnCode, isDebugEnabled) - utils.log("DEBUG", " NetworkRollback Response - " + rollbackNetworkResponse, isDebugEnabled) - } - - String statusMessage = "" - int errorCode = 7000 - utils.log("DEBUG", "*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"), isDebugEnabled) - if (execution.getVariable(Prefix + "fullRollback") == false) { - WorkflowException wfe = execution.getVariable(Prefix + "WorkflowException") // original WorkflowException - if (wfe != null) { - statusMessage = wfe.getErrorMessage() - errorCode = wfe.getErrorCode() - } else { - statusMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." - errorCode = '7000' - } - - // set if all rolledbacks are successful - if (rollbackDeactivateSDNCReturnCode == "200" && rollbackNetworkReturnCode == "200" && rollbackSDNCReturnCode == "200") { - execution.setVariable("rolledBack", true) - execution.setVariable("wasDeleted", true) - - } else { - execution.setVariable("rolledBack", false) - execution.setVariable("wasDeleted", true) - } - - statusMessage = statusMessage + rollbackDeactivateSDNCMessages + rollbackNetworkErrorMessages + rollbackSdncErrorMessages - utils.log("DEBUG", "Final DoDeleteNetworkInstanceRollback status message: " + statusMessage, isDebugEnabled) - String processKey = getProcessKey(execution); - WorkflowException exception = new WorkflowException(processKey, errorCode, statusMessage); - execution.setVariable("workflowException", exception); - - } else { - // rollback due to failures in Main flow (Macro or a-ala-carte) - Full rollback - if (rollbackDeactivateSDNCReturnCode == "200" && rollbackNetworkReturnCode == "200" && rollbackSDNCReturnCode == "200") { - execution.setVariable("rollbackSuccessful", true) - execution.setVariable("rollbackError", false) - } else { - String exceptionMessage = "Network Delete Rollback was not Successful. " - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - execution.setVariable("rollbackSuccessful", false) - execution.setVariable("rollbackError", true) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - throw new BpmnError("MSOWorkflowException") - } - } - - } catch (Exception ex) { - String errorMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." - String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstanceRollback flow. validateRollbackResponses() - " + errorMessage + ": " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - // ******************************* - // Build Error Section - // ******************************* - - - - public void processJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - try{ - utils.log("DEBUG", "Caught a Java Exception in " + Prefix, isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) - } - utils.log("DEBUG", "Completed processJavaException Method in " + Prefix, isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResources.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResources.groovy deleted file mode 100644 index dc4ce6878a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResources.groovy +++ /dev/null @@ -1,325 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.infrastructure.scripts - -import org.json.JSONArray; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.Resource -import org.openecomp.mso.bpmn.core.domain.ServiceInstance -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.List; -import java.util.UUID; -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.camunda.bpm.engine.runtime.Execution -import org.json.JSONObject; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource - -import com.fasterxml.jackson.jaxrs.json.annotation.JSONP.Def; - -/** - * This groovy class supports the DoDeleteResources.bpmn process. - * - * Inputs: - * @param - msoRequestId - * @param - globalSubscriberId - O - * @param - subscriptionServiceType - O - * @param - serviceInstanceId - * @param - serviceInstanceName - O - * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) - * @param - sdncVersion - * @param - failNotFound - TODO - * @param - serviceInputParams - TODO - * - * @param - delResourceList - * @param - serviceRelationShip - * - * Outputs: - * @param - WorkflowException - * - * Rollback - Deferred - */ -public class DoDeleteResources extends AbstractServiceTaskProcessor { - - String Prefix="DDELR_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled) - String msg = "" - - List realNSRessources = new ArrayList() - - // related ns from AAI - String serviceRelationShip = execution.getVariable("serviceRelationShip") - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - List nsSequence = new ArrayList() - List relationShipList = jsonSlurper.parseText(serviceRelationShip) - if (relationShipList != null) { - relationShipList.each { - String resourceType = it.resourceType - nsSequence.add(resourceType) - } - } - - execution.setVariable("currentNSIndex", 0) - execution.setVariable("nsSequence", nsSequence) - execution.setVariable("realNSRessources", realNSRessources) - utils.log("INFO", "nsSequence: " + nsSequence, isDebugEnabled) - - utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void getCurrentNS(execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start getCurrentNS Process ======== ", isDebugEnabled) - - def currentIndex = execution.getVariable("currentNSIndex") - List nsSequence = execution.getVariable("nsSequence") - String nsResourceType = nsSequence.get(currentIndex) - - // GET AAI by Name, not ID, for process convenient - execution.setVariable("GENGS_type", "service-instance") - execution.setVariable("GENGS_serviceInstanceId", "") - execution.setVariable("GENGS_serviceInstanceName", nsResourceType) - - utils.log("INFO", "======== COMPLETED getCurrentNS Process ======== ", isDebugEnabled) - } - - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIGET2 ***** ", isDebugEnabled) - String msg = "" - - try { - String nsResourceName = execution.getVariable("GENGS_serviceInstanceName") - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI in postProcessAAIGET", + nsResourceName, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - else - { - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI){ - String aaiService = execution.getVariable("GENGS_service") - if (!isBlank(aaiService)) { - String svcId = utils.getNodeText1(aaiService, "service-instance-id") - //String mn = utils.getNodeText1(aaiService, "model-name") - String mIuuid = utils.getNodeText1(aaiService, "model-invariant-id") - String muuid = utils.getNodeText1(aaiService, "model-version-id") - String mCuuid = utils.getNodeText1(aaiService, "model-customization-uuid") - ServiceInstance rc = new ServiceInstance() - ModelInfo modelInfo = new ModelInfo() - //modelInfo.setModelName(mn) - modelInfo.setModelUuid(muuid) - modelInfo.setModelInvariantUuid(mIuuid) - modelInfo.getModelCustomizationUuid(mCuuid) - rc.setModelInfo(modelInfo) - rc.setInstanceId(svcId) - rc.setInstanceName(nsResourceName) - - List realNSRessources = execution.getVariable("realNSRessources") - realNSRessources.add(rc) - execution.setVariable("realNSRessources", realNSRessources) - - utils.log("INFO","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled) - } - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteResources.postProcessAAIGET " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) - } - - public void parseNextNS(execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start parseNextNS Process ======== ", isDebugEnabled) - def currentIndex = execution.getVariable("currentNSIndex") - def nextIndex = currentIndex + 1 - execution.setVariable("currentNSIndex", nextIndex) - List nsSequence = execution.getVariable("nsSequence") - if(nextIndex >= nsSequence.size()){ - execution.setVariable("allNsFinished", "true") - }else{ - execution.setVariable("allNsFinished", "false") - } - utils.log("INFO", "======== COMPLETED parseNextNS Process ======== ", isDebugEnabled) - } - - - public void sequenceResource(execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - utils.log("INFO", " ======== STARTED sequenceResource Process ======== ", isDebugEnabled) - List nsResources = new ArrayList() - List wanResources = new ArrayList() - List resourceSequence = new ArrayList() - - // get delete resource list and order list - List delResourceList = execution.getVariable("delResourceList") - // existing resource list - List existResourceList = execution.getVariable("realNSRessources") - - for(ServiceInstance rc_e : existResourceList){ - - String muuid = rc_e.getModelInfo().getModelUuid() - String mIuuid = rc_e.getModelInfo().getModelInvariantUuid() - String mCuuid = rc_e.getModelInfo().getModelCustomizationUuid() - rcType = rc_e.getInstanceName() - - for(Resource rc_d : delResourceList){ - - if(rc_d.getModelInfo().getModelUuid() == muuid - && rc_d.getModelInfo().getModelInvariantUuid() == mIuuid - && rc_d.getModelInfo().getModelCustomizationUuid() == mCuuid) { - - if(StringUtils.containsIgnoreCase(rcType, "overlay") - || StringUtils.containsIgnoreCase(rcType, "underlay")){ - wanResources.add(rcType) - }else{ - nsResources.add(rcType) - } - - } - } - - } - - resourceSequence.addAll(wanResources) - resourceSequence.addAll(nsResources) - String isContainsWanResource = wanResources.isEmpty() ? "false" : "true" - execution.setVariable("isContainsWanResource", isContainsWanResource) - execution.setVariable("currentResourceIndex", 0) - execution.setVariable("resourceSequence", resourceSequence) - utils.log("INFO", "resourceSequence: " + resourceSequence, isDebugEnabled) - execution.setVariable("wanResources", wanResources) - utils.log("INFO", " ======== END sequenceResource Process ======== ", isDebugEnabled) - } - - public void getCurrentResource(execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start getCurrentResoure Process ======== ", isDebugEnabled) - def currentIndex = execution.getVariable("currentResourceIndex") - List resourceSequence = execution.getVariable("resourceSequence") - List wanResources = execution.getVariable("wanResources") - String resourceName = resourceSequence.get(currentIndex) - execution.setVariable("resourceType",resourceName) - if(wanResources.contains(resourceName)){ - execution.setVariable("controllerInfo", "SDN-C") - }else{ - execution.setVariable("controllerInfo", "VF-C") - } - utils.log("INFO", "======== COMPLETED getCurrentResoure Process ======== ", isDebugEnabled) - } - - /** - * prepare delete parameters - */ - public void preResourceDelete(execution, resourceName){ - - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - utils.log("INFO", " ======== STARTED preResourceDelete Process ======== ", isDebugEnabled) - - List existResourceList = execution.getVariable("realNSRessources") - - for(ServiceInstance rc_e : existResourceList){ - - if(StringUtils.containsIgnoreCase(rc_e.getInstanceName(), resourceName)) { - - String resourceInstanceUUID = rc_e.getInstanceId() - String resourceTemplateUUID = rc_e.getModelInfo().getModelUuid() - execution.setVariable("resourceInstanceId", resourceInstanceUUID) - execution.setVariable("resourceTemplateId", resourceTemplateUUID) - execution.setVariable("resourceType", resourceName) - utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " - + resourceInstanceUUID + " resourceType: " + resourceName, isDebugEnabled) - } - } - - utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled) - } - - public void parseNextResource(execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled) - def currentIndex = execution.getVariable("currentResourceIndex") - def nextIndex = currentIndex + 1 - execution.setVariable("currentResourceIndex", nextIndex) - List resourceSequence = execution.getVariable("resourceSequence") - if(nextIndex >= resourceSequence.size()){ - execution.setVariable("allResourceFinished", "true") - }else{ - execution.setVariable("allResourceFinished", "false") - } - utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled) - } - - /** - * post config request. - */ - public void postConfigRequest(execution){ - //to do - } - -} - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy deleted file mode 100644 index 1a36a4ea90..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ /dev/null @@ -1,393 +0,0 @@ - -/*- - * ============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.openecomp.mso.bpmn.infrastructure.scripts - -import groovy.json.JsonSlurper -import org.apache.commons.lang3.StringUtils -import org.apache.http.HttpResponse -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject -import org.openecomp.mso.bpmn.common.recipe.BpmnRestClient -import org.openecomp.mso.bpmn.common.recipe.ResourceInput -import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.domain.AllottedResource -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.NetworkResource -import org.openecomp.mso.bpmn.core.domain.Resource -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.ServiceInstance -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.infrastructure.properties.BPMNProperties - -import static org.apache.commons.lang3.StringUtils.isBlank - -/** - * input for script : - * msoRequestId - * isDebugLogEnabled - * globalSubscriberId - * serviceType - * serviceInstanceId - * URN_mso_workflow_sdncadapter_callback - * serviceInputParams - * deleteResourceList - * resourceInstanceIDs - * - * output from script: - * - */ - -public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { - - String Prefix="DDR_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - CatalogDbUtils cutils = new CatalogDbUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled) - String msg = "" - - try { - String requestId = execution.getVariable("msoRequestId") - execution.setVariable("prefix",Prefix) - - //Inputs - //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology - String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId - if (globalSubscriberId == null) - { - execution.setVariable("globalSubscriberId", "") - } - - //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology - String serviceType = execution.getVariable("serviceType") - if (serviceType == null) - { - execution.setVariable("serviceType", "") - } - - //Generated in parent for AAI PUT - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)){ - msg = "Input serviceInstanceId is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (isBlank(sdncCallbackUrl)) { - msg = "URN_mso_workflow_sdncadapter_callback is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) - - StringBuilder sbParams = new StringBuilder() - Map paramsMap = execution.getVariable("serviceInputParams") - if (paramsMap != null) - { - sbParams.append("") - for (Map.Entry entry : paramsMap.entrySet()) { - String paramsXml - String paramName = entry.getKey() - String paramValue = entry.getValue() - paramsXml = - """ - ${paramName} - ${paramValue} - - """ - sbParams.append(paramsXml) - } - sbParams.append("") - } - String siParamsXml = sbParams.toString() - if (siParamsXml == null) - siParamsXml = "" - execution.setVariable("siParamsXml", siParamsXml) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void sequenceResource(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - utils.log("INFO", " ======== STARTED sequenceResource Process ======== ", isDebugEnabled) - List sequencedResourceList = new ArrayList() - List wanResources = new ArrayList() - - // get delete resource list and order list - List delResourceList = execution.getVariable("deleteResourceList") - - def resourceSequence = BPMNProperties.getResourceSequenceProp() - - if(resourceSequence != null) { - for (resourceType in resourceSequence.reverse()) { - for (resource in delResourceList) { - if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) { - sequencedResourceList.add(resource) - - if (resource instanceof NetworkResource) { - wanResources.add(resource) - } - } - } - } - }else { - //define sequenced resource list, we deploy vf first and then network and then ar - //this is defaule sequence - List vnfResourceList = new ArrayList() - List arResourceList = new ArrayList() - for (Resource rc : delResourceList) { - if (rc instanceof VnfResource) { - vnfResourceList.add(rc) - } else if (rc instanceof NetworkResource) { - wanResources.add(rc) - } else if (rc instanceof AllottedResource) { - arResourceList.add(rc) - } - } - - sequencedResourceList.addAll(arResourceList) - sequencedResourceList.addAll(wanResources) - sequencedResourceList.addAll(vnfResourceList) - } - - String isContainsWanResource = wanResources.isEmpty() ? "false" : "true" - execution.setVariable("isContainsWanResource", isContainsWanResource) - execution.setVariable("currentResourceIndex", 0) - execution.setVariable("sequencedResourceList", sequencedResourceList) - utils.log("INFO", "resourceSequence: " + resourceSequence, isDebugEnabled) - utils.log("INFO", " ======== END sequenceResource Process ======== ", isDebugEnabled) - } - - /** - * prepare delete parameters - */ - public void preResourceDelete(DelegateExecution execution){ - - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - utils.log("INFO", " ======== STARTED preResourceDelete Process ======== ", isDebugEnabled) - - List sequencedResourceList = execution.getVariable("sequencedResourceList") - - int currentIndex = execution.getVariable("currentResourceIndex") - Resource curResource = sequencedResourceList.get(currentIndex); - - String resourceInstanceUUID = curResource.getResourceId() - String resourceTemplateUUID = curResource.getModelInfo().getModelUuid() - execution.setVariable("resourceInstanceId", resourceInstanceUUID) - execution.setVariable("currentResource", curResource) - utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " - + resourceInstanceUUID + " resourceModelName: " + curResource.getModelInfo().getModelName(), isDebugEnabled) - - utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled) - } - - - /** - * Execute delete workflow for resource - */ - public void executeResourceDelete(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start executeResourceDelete Process ======== ", isDebugEnabled) - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceType = execution.getVariable("serviceType") - - String resourceInstanceId = execution.getVariable("resourceInstanceId") - - Resource currentResource = execution.getVariable("currentResource") - String action = "deleteInstance" - JSONObject resourceRecipe = cutils.getResourceRecipe(execution, currentResource.getModelInfo().getModelUuid(), action) - String recipeUri = resourceRecipe.getString("orchestrationUri") - int recipeTimeout = resourceRecipe.getInt("recipeTimeout") - String recipeParamXsd = resourceRecipe.get("paramXSD") - - - ResourceInput resourceInput = new ResourceInput(); - resourceInput.setServiceInstanceId(serviceInstanceId) - resourceInput.setResourceInstanceName(currentResource.getResourceInstanceName()) - resourceInput.setResourceInstancenUuid(currentResource.getResourceId()) - resourceInput.setOperationId(execution.getVariable("operationId")) - resourceInput.setOperationType(execution.getVariable("operationType")) - String globalSubscriberId = execution.getVariable("globalSubscriberId") - resourceInput.setGlobalSubscriberId(globalSubscriberId) - resourceInput.setResourceModelInfo(currentResource.getModelInfo()); - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); - resourceInput.setServiceType(serviceType) - - String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + recipeUri - - HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeout, action, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) - utils.log("INFO", " ======== END executeResourceDelete Process ======== ", isDebugEnabled) - } - - - public void parseNextResource(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled) - def currentIndex = execution.getVariable("currentResourceIndex") - def nextIndex = currentIndex + 1 - execution.setVariable("currentResourceIndex", nextIndex) - List sequencedResourceList = execution.getVariable("sequencedResourceList") - if(nextIndex >= sequencedResourceList.size()){ - execution.setVariable("allResourceFinished", "true") - }else{ - execution.setVariable("allResourceFinished", "false") - } - utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled) - } - - public void prepareFinishedProgressForResource(DelegateExecution execution) { - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceType = execution.getVariable("serviceType") - String resourceInstanceId = execution.getVariable("resourceInstanceId") - Resource currentResource = execution.getVariable("currentResource") - String resourceCustomizationUuid = currentResource.getModelInfo().getModelCustomizationUuid() - String resourceModelName = currentResource.getModelInfo().getModelName() - String operationType = execution.getVariable("operationType") - String progress = "100" - String status = "finished" - String statusDescription = "The resource instance does not exist for " + resourceModelName - String operationId = execution.getVariable("operationId") - - String body = """ - - - - - ${operationType} - ${operationId} - ${progress} - ${resourceCustomizationUuid} - ${serviceInstanceId} - ${status} - ${statusDescription} - - - """; - - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - execution.setVariable("CVFMI_updateResOperStatusRequest", body) - } - - public void prepareSDNCServiceDeactivateRequest (DelegateExecution execution) { - prepareSDNCServiceRequest (execution, "deactivate") - } - - public void prepareSDNCServiceDeleteRequest (DelegateExecution execution) { - prepareSDNCServiceRequest (execution, "delete") - } - - public void prepareSDNCServiceRequest (DelegateExecution execution, String svcAction) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareSDNCServiceRequest for " + svcAction + "*****", isDebugEnabled) - - try { - // get variables - String sdnc_svcAction = svcAction - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String hdrRequestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String source = execution.getVariable("source") - String sdnc_service_id = serviceInstanceId - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - String serviceType = execution.getVariable("serviceType") - String globalCustomerId = execution.getVariable("globalSubscriberId") - String serviceModelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid() - String serviceModelUuid = serviceDecomposition.getModelInfo().getModelUuid() - String serviceModelVersion = serviceDecomposition.getModelInfo().getModelVersion() - String serviceModelName = serviceDecomposition.getModelInfo().getModelName() - - // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyDeleteRequest = - """ - - ${hdrRequestId} - ${serviceInstanceId} - ${sdnc_svcAction} - service-topology-operation - sdncCallback - generic-resource - - - - ${hdrRequestId} - DeleteServiceInstance - ${source} - - - - - - ${serviceInstanceId} - ${serviceType} - - ${serviceModelInvariantUuid} - ${serviceModelUuid} - ${serviceModelVersion} - ${serviceModelName} - - ${serviceInstanceId} - ${globalCustomerId} - - - - - """.trim() - - String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) - utils.logAudit(sndcTopologyDeleteRequesAsString) - execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) - utils.log("INFO","sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoDeleteResourcesV1 flow. prepareSDNCServiceRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - utils.log("INFO","***** Exit prepareSDNCServiceRequest for " + svcAction + "*****", isDebugEnabled) - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy deleted file mode 100644 index 802090b02a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy +++ /dev/null @@ -1,478 +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.bpmn.infrastructure.scripts; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.UUID; -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource - -/** - * This groovy class supports the DoDeleteServiceInstance.bpmn process. - * - * Inputs: - * @param - msoRequestId - * @param - globalSubscriberId - O - * @param - subscriptionServiceType - O - * @param - serviceInstanceId - * @param - serviceInstanceName - O - * @param - serviceModelInfo - O - * @param - productFamilyId - * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) - * @param - sdncVersion - * @param - failNotFound - TODO - * @param - serviceInputParams - TODO - * - * Outputs: - * @param - WorkflowException - * - * Rollback - Deferred - */ -public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { - - String Prefix="DDELSI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) - String msg = "" - - try { - String requestId = execution.getVariable("msoRequestId") - execution.setVariable("prefix",Prefix) - - //Inputs - //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology - String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId - if (globalSubscriberId == null) - { - execution.setVariable("globalSubscriberId", "") - } - - //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - if (subscriptionServiceType == null) - { - execution.setVariable("subscriptionServiceType", "") - } - - //Generated in parent for AAI PUT - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)){ - msg = "Input serviceInstanceId is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (isBlank(sdncCallbackUrl)) { - msg = "URN_mso_workflow_sdncadapter_callback is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) - - StringBuilder sbParams = new StringBuilder() - Map paramsMap = execution.getVariable("serviceInputParams") - if (paramsMap != null) - { - sbParams.append("") - for (Map.Entry entry : paramsMap.entrySet()) { - String paramsXml - String paramName = entry.getKey() - String paramValue = entry.getValue() - paramsXml = - """ - ${paramName} - ${paramValue} - - """ - sbParams.append(paramsXml) - } - sbParams.append("") - } - String siParamsXml = sbParams.toString() - if (siParamsXml == null) - siParamsXml = "" - execution.setVariable("siParamsXml", siParamsXml) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void preProcessSDNCDelete (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** preProcessSDNCDelete *****", isDebugEnabled) - String msg = "" - - try { - def serviceInstanceId = execution.getVariable("serviceInstanceId") ?: "" - def serviceInstanceName = execution.getVariable("serviceInstanceName") ?: "" - def callbackURL = execution.getVariable("sdncCallbackUrl") ?: "" - def requestId = execution.getVariable("msoRequestId") ?: "" - def serviceId = execution.getVariable("productFamilyId") ?: "" - def subscriptionServiceType = execution.getVariable("subscriptionServiceType") ?: "" - def globalSubscriberId = execution.getVariable("globalSubscriberId") ?: "" //globalCustomerId - - String serviceModelInfo = execution.getVariable("serviceModelInfo") ?: "" - def modelInvariantUuid = "" - def modelVersion = "" - def modelUuid = "" - def modelName = "" - if (!isBlank(serviceModelInfo)) - { - modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") ?: "" - modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") ?: "" - modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid") ?: "" - modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") ?: "" - - } - - def siParamsXml = execution.getVariable("siParamsXml") ?: "" - def msoAction = "" - // special URL for SDNW, msoAction helps set diff url in SDNCA - if("TRANSPORT".equalsIgnoreCase(execution.getVariable("serviceType"))) - { - msoAction = "TRANSPORT" - } - - def sdncRequestId = UUID.randomUUID().toString() - - String sdncDelete = - """ - - ${sdncRequestId} - ${serviceInstanceId} - delete - service-topology-operation - ${callbackURL} - ${msoAction} - - - - ${requestId} - MSO - - - - DeleteServiceInstance - - - ${serviceId} - ${subscriptionServiceType} - - ${modelInvariantUuid} - ${modelUuid} - ${modelVersion} - ${modelName} - - ${serviceInstanceId} - - ${globalSubscriberId} - - - ${serviceInstanceName} - ${siParamsXml} - - - """ - - sdncDelete = utils.formatXml(sdncDelete) - def sdncRequestId2 = UUID.randomUUID().toString() - String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") - execution.setVariable("sdncDelete", sdncDelete) - execution.setVariable("sdncDeactivate", sdncDeactivate) - utils.log("DEBUG","sdncDeactivate:\n" + sdncDeactivate, isDebugEnabled) - utils.log("DEBUG","sdncDelete:\n" + sdncDelete, isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage()) - } - utils.log("DEBUG"," *****Exit preProcessSDNCDelete *****", isDebugEnabled) - } - - public void postProcessSDNCDelete(DelegateExecution execution, String response, String method) { - - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** postProcessSDNC " + method + " *****", isDebugEnabled) - String msg = "" - - try { - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - utils.log("DEBUG", "SDNCResponse: " + response, isDebugEnabled) - utils.log("DEBUG", "workflowException: " + workflowException, isDebugEnabled) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - utils.log("DEBUG","Good response from SDNC Adapter for service-instance " + method + "response:\n" + response, isDebugEnabled) - - }else{ - msg = "Bad Response from SDNC Adapter for service-instance " + method - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg) - } - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in postProcessSDNC " + method + " Exception:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *** Exit postProcessSDNC " + method + " ***", isDebugEnabled) - } - - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** postProcessAAIGET ***** ", isDebugEnabled) - String msg = "" - - try { - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - String serviceType = "" - - if(foundInAAI){ - utils.log("DEBUG","Found Service-instance in AAI", isDebugEnabled) - - //Extract GlobalSubscriberId - String siRelatedLink = execution.getVariable("GENGS_siResourceLink") - if (isBlank(siRelatedLink)) - { - msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - else - { - utils.log("DEBUG","Found Service-instance in AAI. link: " + siRelatedLink, isDebugEnabled) - String globalSubscriberId = execution.getVariable("globalSubscriberId") - if(isBlank(globalSubscriberId)){ - int custStart = siRelatedLink.indexOf("customer/") - int custEnd = siRelatedLink.indexOf("/service-subscriptions") - globalSubscriberId = siRelatedLink.substring(custStart + 9, custEnd) - execution.setVariable("globalSubscriberId", globalSubscriberId) - } - - //Extract Service Type if not provided on request - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - if(isBlank(subscriptionServiceType)){ - int serviceStart = siRelatedLink.indexOf("service-subscription/") - int serviceEnd = siRelatedLink.indexOf("/service-instances/") - String serviceTypeEncoded = siRelatedLink.substring(serviceStart + 21, serviceEnd) - subscriptionServiceType = UriUtils.decode(serviceTypeEncoded, "UTF-8") - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - } - - if (isBlank(globalSubscriberId) || isBlank(subscriptionServiceType)) - { - msg = "Could not retrive global-customer-id & subscription-service-type from AAI to delete id:" + serviceInstanceId - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - } - - String siData = execution.getVariable("GENGS_service") - utils.log("DEBUG", "SI Data", isDebugEnabled) - if (isBlank(siData)) - { - msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - else - { - utils.log("DEBUG", "SI Data" + siData, isDebugEnabled) - serviceType = utils.getNodeText1(siData,"service-type") - execution.setVariable("serviceType", serviceType) - execution.setVariable("serviceRole", utils.getNodeText1(siData,"service-role")) - String orchestrationStatus = utils.getNodeText1(siData,"orchestration-status") - - //Confirm there are no related service instances (vnf/network or volume) - if (utils.nodeExists(siData, "relationship-list")) { - utils.log("DEBUG", "SI Data relationship-list exists:", isDebugEnabled) - InputSource source = new InputSource(new StringReader(siData)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document serviceXml = docBuilder.parse(source) - - NodeList nodeList = serviceXml.getElementsByTagName("relationship") - for (int x = 0; x < nodeList.getLength(); x++) { - Node node = nodeList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() - if(e.equals("generic-vnf") || e.equals("l3-network") || e.equals("allotted-resource") ){ - utils.log("DEBUG", "ServiceInstance still has relationship(s) to generic-vnfs, l3-networks or allotted-resources", isDebugEnabled) - execution.setVariable("siInUse", true) - //there are relationship dependencies to this Service Instance - msg = " Stopped deleting Service Instance, it has dependencies. Service instance id: " + serviceInstanceId - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - }else{ - utils.log("DEBUG", "Relationship NOT related to OpenStack", isDebugEnabled) - } - } - } - } - - if ("TRANSPORT".equalsIgnoreCase(serviceType)) - { - if ("PendingDelete".equals(orchestrationStatus)) - { - execution.setVariable("skipDeactivate", true) - } - else - { - msg = "ServiceInstance of type TRANSPORT must in PendingDelete status to allow Delete. Orchestration-status:" + orchestrationStatus - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - } - - //alacarte SIs are NOT sent to sdnc. exceptions are listed in config variable - String svcTypes = execution.getVariable("URN_sdnc_si_svc_types") ?: "" - utils.log("DEBUG", "SDNC SI serviceTypes:" + svcTypes, isDebugEnabled) - List svcList = Arrays.asList(svcTypes.split("\\s*,\\s*")); - boolean isSdncService= false - for (String listEntry : svcList){ - if (listEntry.equalsIgnoreCase(serviceType)){ - isSdncService = true - break; - } - } - - //All Macros are sent to SDNC, TRANSPORT(Macro) is sent to SDNW - //Alacartes are sent to SDNC if they are listed in config variable above - execution.setVariable("sendToSDNC", true) - if(execution.getVariable("sdncVersion").equals("1610")) //alacarte - { - if(!isSdncService){ - execution.setVariable("sendToSDNC", false) - } - } - - utils.log("DEBUG", "isSdncService: " + isSdncService, isDebugEnabled) - utils.log("DEBUG", "Send To SDNC: " + execution.getVariable("sendToSDNC"), isDebugEnabled) - utils.log("DEBUG", "Service Type: " + execution.getVariable("serviceType"), isDebugEnabled) - - } - }else{ - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("DEBUG","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - - utils.log("DEBUG","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteServiceInstance.postProcessAAIGET. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *** Exit postProcessAAIGET *** ", isDebugEnabled) - } - - public void postProcessAAIDEL(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** postProcessAAIDEL ***** ", isDebugEnabled) - String msg = "" - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator") - if(!succInAAI){ - msg = "Error deleting Service-instance in AAI" + serviceInstanceId - utils.log("DEBUG", msg, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteServiceInstance.postProcessAAIDEL. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *** Exit postProcessAAIDEL *** ", isDebugEnabled) - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy deleted file mode 100644 index d3e89df7bf..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy +++ /dev/null @@ -1,291 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - 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.bpmn.infrastructure.scripts; - -import static org.apache.commons.lang3.StringUtils.* -import groovy.xml.XmlUtil -import groovy.json.* -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.rest.RESTClient - - - -/** - * This groovy class supports the DoDeleteVFCNetworkServiceInstance.bpmn process. - * flow for E2E ServiceInstance Delete - */ -public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProcessor { - - - String vfcUrl = "/vfc/rest/v1/vfcadapter" - - String host = "http://mso.mso.testlab.openecomp.org:8080" - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - JsonUtils jsonUtil = new JsonUtils() - - /** - * Pre Process the BPMN Flow Request - * Inclouds: - * generate the nsOperationKey - */ - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("INFO", " *** preProcessRequest() *** ", isDebugEnabled) - try { - //deal with operation key - String globalSubscriberId = execution.getVariable("globalSubscriberId") - utils.log("INFO", "globalSubscriberId:" + globalSubscriberId, isDebugEnabled) - String serviceType = execution.getVariable("serviceType") - utils.log("INFO", "serviceType:" + serviceType, isDebugEnabled) - String serviceId = execution.getVariable("serviceId") - utils.log("INFO", "serviceId:" + serviceId, isDebugEnabled) - String operationId = execution.getVariable("operationId") - utils.log("INFO", "serviceType:" + serviceType, isDebugEnabled) - String nodeTemplateUUID = execution.getVariable("resourceTemplateId") - utils.log("INFO", "nodeTemplateUUID:" + nodeTemplateUUID, isDebugEnabled) - String nsInstanceId = execution.getVariable("resourceInstanceId") - utils.log("INFO", "nsInstanceId:" + nsInstanceId, isDebugEnabled) - execution.setVariable("nsInstanceId",nsInstanceId) - String nsOperationKey = """{ - "globalSubscriberId":"${globalSubscriberId}", - "serviceType":"${serviceType}", - "serviceId":"${serviceId}", - "operationId":"${operationId}", - "nodeTemplateUUID":"${nodeTemplateUUID}" - }""" - execution.setVariable("nsOperationKey", nsOperationKey); - utils.log("INFO", "nsOperationKey:" + nsOperationKey, isDebugEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - /** - * unwind NS from AAI relationship - */ - public void deleteNSRelationship(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** deleteNSRelationship *****", isDebugEnabled) - String nsInstanceId = execution.getVariable("resourceInstanceId") - if(nsInstanceId == null || nsInstanceId == ""){ - utils.log("INFO"," Delete NS failed", isDebugEnabled) - return - } - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String serviceType = execution.getVariable("serviceType") - String serviceId = execution.getVariable("serviceId") - String deleteRelationPayload = """ - service-instance - /aai/v11/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${nsInstanceId} - - customer.global-customer-id - ${globalSubscriberId} - - - service-subscription.service-type - ${serviceType} - - - service-instance.service-instance-id - ${nsInstanceId} - - """ - String endpoint = execution.getVariable("URN_aai_endpoint") - utils.log("INFO","Delete Relationship req:\n" + deleteRelationPayload, isDebugEnabled) - String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + serviceId + "/relationship-list/relationship" - - APIResponse aaiRsp = executeAAIDeleteCall(execution, url, deleteRelationPayload) - utils.log("INFO","aai response status code:" + aaiRsp.getStatusCode(), isDebugEnabled) - utils.log("INFO","aai response content:" + aaiRsp.getResponseBodyAsString(), isDebugEnabled) - utils.log("INFO"," *****Exit deleteNSRelationship *****", isDebugEnabled) - } - - public APIResponse executeAAIDeleteCall(DelegateExecution execution, String url, String payload){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled) - APIResponse apiResponse = null - try{ - String uuid = utils.getRequestID() - utils.log("INFO","Generated uuid is: " + uuid, isDebugEnabled) - utils.log("INFO","URL to be used is: " + url, isDebugEnabled) - String userName = execution.getVariable("URN_aai_auth") - String password = execution.getVariable("URN_mso_msoKey") - String basicAuthCred = utils.getBasicAuth(userName,password) - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - apiResponse = client.httpDelete(payload) - utils.log("INFO","======== Completed Execute AAI Delete Process ======== ", isDebugEnabled) - }catch(Exception e){ - utils.log("ERROR","Exception occured while executing AAI Put Call. Exception is: \n" + e, isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - return apiResponse - } - - /** - * delete NS task - */ - public void deleteNetworkService(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** deleteNetworkService start *** ", isDebugEnabled) - String nsOperationKey = execution.getVariable("nsOperationKey"); - String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId") - APIResponse apiResponse = deleteRequest(execution, url, nsOperationKey) - String returnCode = apiResponse.getStatusCode() - String apiResponseAsString = apiResponse.getResponseBodyAsString() - String operationStatus = "error"; - if(returnCode== "200" || returnCode== "202"){ - operationStatus = "finished" - } - execution.setVariable("operationStatus", operationStatus) - - utils.log("INFO", " *** deleteNetworkService end *** ", isDebugEnabled) - } - - /** - * instantiate NS task - */ - public void terminateNetworkService(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** terminateNetworkService start *** ", isDebugEnabled) - String nsOperationKey = execution.getVariable("nsOperationKey") - String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId") + "/terminate" - APIResponse apiResponse = postRequest(execution, url, nsOperationKey) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() - String jobId = ""; - if(returnCode== "200" || returnCode== "202"){ - jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") - } - execution.setVariable("jobId", jobId) - utils.log("INFO", " *** terminateNetworkService end *** ", isDebugEnabled) - } - - /** - * query NS task - */ - public void queryNSProgress(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** queryNSProgress start *** ", isDebugEnabled) - String jobId = execution.getVariable("jobId") - String nsOperationKey = execution.getVariable("nsOperationKey"); - String url = host + vfcUrl + "/jobs/" + execution.getVariable("jobId") - APIResponse apiResponse = postRequest(execution, url, nsOperationKey) - String returnCode = apiResponse.getStatusCode() - String apiResponseAsString = apiResponse.getResponseBodyAsString() - String operationProgress = "100" - if(returnCode== "200"){ - operationProgress = jsonUtil.getJsonValue(apiResponseAsString, "responseDescriptor.progress") - } - execution.setVariable("operationProgress", operationProgress) - utils.log("INFO", " *** queryNSProgress end *** ", isDebugEnabled) - } - - /** - * delay 5 sec - */ - public void timeDelay(DelegateExecution execution) { - try { - Thread.sleep(5000); - } catch(InterruptedException e) { - utils.log("INFO", "Time Delay exception" + e, isDebugEnabled) - } - } - - /** - * finish NS task - */ - public void finishNSDelete(DelegateExecution execution) { - //no need to do anything util now - } - - /** - * post request - * url: the url of the request - * requestBody: the body of the request - */ - private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " ======== Started Execute VFC adapter Post Process ======== ", isDebugEnabled) - utils.log("INFO", "url:"+url +"\nrequestBody:"+ requestBody, isDebugEnabled) - APIResponse apiResponse = null - try{ - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk");; - apiResponse = client.httpPost(requestBody) - utils.log("INFO", "response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString(), isDebugEnabled) - utils.log("INFO", "======== Completed Execute VF-C adapter Post Process ======== ", isDebugEnabled) - }catch(Exception e){ - utils.log("ERROR", "Exception occured while executing VF-C Post Call. Exception is: \n" + e, isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - return apiResponse - } - /** - * delete request - * url: the url of the request - * requestBody: the body of the request - */ - private APIResponse deleteRequest(DelegateExecution execution, String url, String requestBody){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " ======== Started Execute VFC adapter Delete Process ======== ", isDebugEnabled) - utils.log("INFO", "url:"+url +"\nrequestBody:"+ requestBody, isDebugEnabled) - APIResponse apiResponse = null - try{ - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); - apiResponse = client.httpDelete(requestBody) - utils.log("INFO", "response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString(), isDebugEnabled) - utils.log("INFO", "======== Completed Execute VF-C adapter Delete Process ======== ", isDebugEnabled) - }catch(Exception e){ - utils.log("ERROR", "Exception occured while executing VF-C Post Call. Exception is: \n" + e, isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - return apiResponse - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy deleted file mode 100644 index a5c39b6998..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy +++ /dev/null @@ -1,708 +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.bpmn.infrastructure.scripts -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.scripts.VfModule -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse -import org.springframework.web.util.UriUtils -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.xml.sax.InputSource -import org.w3c.dom.Node -import org.w3c.dom.NodeList; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - - -/* Subflow for Delete VF Module. When no DoDeleteVfModuleRequest is specified on input, - * functions as a building block subflow - -* Inputs for building block interface: -* @param - requestId -* @param - isDebugLogEnabled -* @param - vnfId -* @param - vfModuleId -* @param - serviceInstanceId -* @param - vfModuleName O -* @param - vfModuleModelInfo -* @param - cloudConfiguration* -* @param - sdncVersion ("1610") -* @param - retainResources -* @param - aLaCarte -* -* Outputs: -* @param - WorkflowException -* -*/ -public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ - - def Prefix="DoDVfMod_" - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable("prefix",Prefix) - execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", null) - execution.setVariable("DoDVfMod_oamManagementV4Address", null) - execution.setVariable("DoDVfMod_oamManagementV6Address", null) - - } - - // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids - // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - initProcessVariables(execution) - - try { - def xml = execution.getVariable("DoDeleteVfModuleRequest") - String vnfId = "" - String vfModuleId = "" - - if (xml == null || xml.isEmpty()) { - // Building Block-type request - - // Set mso-request-id to request-id for VNF Adapter interface - String requestId = execution.getVariable("requestId") - execution.setVariable("mso-request-id", requestId) - - String cloudConfiguration = execution.getVariable("cloudConfiguration") - String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo") - String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId") - execution.setVariable("tenantId", tenantId) - String cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId") - execution.setVariable("cloudSiteId", cloudSiteId) - // Source is HARDCODED - String source = "VID" - execution.setVariable("source", source) - // SrvInstId is hardcoded to empty - execution.setVariable("srvInstId", "") - // ServiceId is hardcoded to empty - execution.setVariable("serviceId", "") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - vnfId = execution.getVariable("vnfId") - vfModuleId = execution.getVariable("vfModuleId") - if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { - execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId) - } - else { - execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId) - } - //vfModuleModelName - def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName") - execution.setVariable("vfModuleModelName", vfModuleModelName) - // retainResources - def retainResources = execution.getVariable("retainResources") - if (retainResources == null) { - retainResources = false - } - execution.setVariable("retainResources", retainResources) - } - else { - - utils.logAudit("DoDeleteVfModule Request: " + xml) - - utils.log("DEBUG", "input request xml: " + xml, isDebugEnabled) - - vnfId = utils.getNodeText1(xml,"vnf-id") - execution.setVariable("vnfId", vnfId) - vfModuleId = utils.getNodeText1(xml,"vf-module-id") - execution.setVariable("vfModuleId", vfModuleId) - def srvInstId = execution.getVariable("mso-service-instance-id") - execution.setVariable("srvInstId", srvInstId) - String requestId = "" - try { - requestId = execution.getVariable("mso-request-id") - } catch (Exception ex) { - requestId = utils.getNodeText1(xml, "request-id") - } - execution.setVariable("requestId", requestId) - String source = utils.getNodeText1(xml, "source") - execution.setVariable("source", source) - String serviceId = utils.getNodeText1(xml, "service-id") - execution.setVariable("serviceId", serviceId) - String tenantId = utils.getNodeText1(xml, "tenant-id") - execution.setVariable("tenantId", tenantId) - - String serviceInstanceIdToSdnc = "" - if (xml.contains("service-instance-id")) { - serviceInstanceIdToSdnc = utils.getNodeText1(xml, "service-instance-id") - } else { - serviceInstanceIdToSdnc = vfModuleId - } - execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceIdToSdnc) - String vfModuleName = utils.getNodeText1(xml, "vf-module-name") - execution.setVariable("vfModuleName", vfModuleName) - String vfModuleModelName = utils.getNodeText1(xml, "vf-module-model-name") - execution.setVariable("vfModuleModelName", vfModuleModelName) - String cloudSiteId = utils.getNodeText1(xml, "aic-cloud-region") - execution.setVariable("cloudSiteId", cloudSiteId) - } - - // formulate the request for PrepareUpdateAAIVfModule - String request = """ - ${vnfId} - ${vfModuleId} - pending-delete - """ as String - utils.log("DEBUG", "PrepareUpdateAAIVfModuleRequest :" + request, isDebugEnabled) - utils.logAudit("UpdateAAIVfModule Request: " + request) - execution.setVariable("PrepareUpdateAAIVfModuleRequest", request) - execution.setVariable("vfModuleFromAAI", null) - }catch(BpmnError b){ - throw b - }catch(Exception e){ - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!") - } - } - - // build a SDNC vnf-topology-operation request for the specified action - // (note: the action passed is expected to be 'changedelete' or 'delete') - public void prepSDNCAdapterRequest(DelegateExecution execution, String action) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("requestId") + "-" + System.currentTimeMillis() - } - - def srvInstId = execution.getVariable("srvInstId") - def callbackUrl = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String requestId = execution.getVariable("requestId") - String source = execution.getVariable("source") - String serviceId = execution.getVariable("serviceId") - String vnfId = execution.getVariable("vnfId") - String tenantId = execution.getVariable("tenantId") - String vfModuleId = execution.getVariable("vfModuleId") - String serviceInstanceIdToSdnc = execution.getVariable(Prefix + "serviceInstanceIdToSdnc") - String vfModuleName = execution.getVariable("vfModuleName") - // Get vfModuleName from AAI response if it was not specified on the request - if (vfModuleName == null || vfModuleName.isEmpty()) { - if (execution.getVariable("vfModuleFromAAI") != null) { - VfModule vfModuleFromAAI = execution.getVariable("vfModuleFromAAI") - vfModuleName = vfModuleFromAAI.getElementText("vf-module-name") - } - } - String vfModuleModelName = execution.getVariable("vfModuleModelName") - String cloudSiteId = execution.getVariable("cloudSiteId") - boolean retainResources = execution.getVariable("retainResources") - String requestSubActionString = "" - if (retainResources) { - requestSubActionString = "RetainResource" - } - String request = """ - - ${uuid} - ${vfModuleId} - ${action} - vnf-topology-operation - ${callbackUrl} - - - - ${requestId} - DisconnectVNFRequest - ${requestSubActionString} - ${source} - - - - - - ${serviceId} - ${serviceId} - ${serviceInstanceIdToSdnc} - notsurewecare - - - ${vfModuleId} - ${vfModuleModelName} - ${vfModuleName} - ${vnfId} - - - ${cloudSiteId} - ${tenantId} - - - """ - - utils.log("DEBUG", "sdncAdapterWorkflowRequest: " + request, isDebugEnabled) - utils.logAudit("DoDeleteVfModule - SDNCAdapterWorkflowRequest: " + request) - execution.setVariable("sdncAdapterWorkflowRequest", request) - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing VnfAdapterDeleteV1 request - public void prepVNFAdapterRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def requestId = UUID.randomUUID().toString() - def origRequestId = execution.getVariable('requestId') - def srvInstId = execution.getVariable("serviceInstanceId") - def aicCloudRegion = execution.getVariable("cloudSiteId") - def vnfId = execution.getVariable("vnfId") - def vfModuleId = execution.getVariable("vfModuleId") - def vfModuleStackId = execution.getVariable('DoDVfMod_heatStackId') - def tenantId = execution.getVariable("tenantId") - def messageId = execution.getVariable('requestId') + '-' + - System.currentTimeMillis() - def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) - def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") - if ('true'.equals(useQualifiedHostName)) { - notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) - } - - String request = """ - - ${aicCloudRegion} - ${tenantId} - ${vnfId} - ${vfModuleId} - ${vfModuleStackId} - true - - ${origRequestId} - ${srvInstId} - - ${messageId} - ${notificationUrl} - - """ as String - - utils.log("DEBUG", "vnfAdapterRestV1Request: " + request, isDebugEnabled) - utils.logAudit("deleteVfModuleRequest: " + request) - execution.setVariable("vnfAdapterRestV1Request", request) - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing UpdateAAIVfModuleRequest request - public void prepUpdateAAIVfModule(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def vnfId = execution.getVariable("vnfId") - def vfModuleId = execution.getVariable("vfModuleId") - // formulate the request for UpdateAAIVfModule - String request = """ - ${vnfId} - ${vfModuleId} - DELETE - deleted - """ as String - utils.log("DEBUG", "UpdateAAIVfModuleRequest :" + request, isDebugEnabled) - utils.logAudit("UpdateAAIVfModuleRequest: " + request) - execution.setVariable("UpdateAAIVfModuleRequest", request) - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing DeleteAAIVfModuleRequest request - public void prepDeleteAAIVfModule(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - def vnfId = execution.getVariable("vnfId") - def vfModuleId = execution.getVariable("vfModuleId") - // formulate the request for UpdateAAIVfModule - String request = """ - ${vnfId} - ${vfModuleId} - """ as String - utils.log("DEBUG", "DeleteAAIVfModuleRequest :" + request, isDebugEnabled) - utils.logAudit("DeleteAAIVfModuleRequest: " + request) - execution.setVariable("DeleteAAIVfModuleRequest", request) - } - - // generates a WorkflowException if - // - - public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("ERROR", "AAI error occurred deleting the Generic Vnf: " - + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), isDebugEnabled) - String processKey = getProcessKey(execution); - WorkflowException exception = new WorkflowException(processKey, 5000, - execution.getVariable("DoDVfMod_deleteGenericVnfResponse")) - execution.setVariable("WorkflowException", exception) - } - - public void sdncValidateResponse(DelegateExecution execution, String response){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - utils.log("DEBUG", "Successfully Validated SDNC Response", isDebugEnabled) - }else{ - throw new BpmnError("MSOWorkflowException") - } - } - - public void postProcessVNFAdapterRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix",Prefix) - try{ - logDebug(" *** STARTED postProcessVNFAdapterRequest Process*** ", isDebugLogEnabled) - - String vnfResponse = execution.getVariable("DoDVfMod_doDeleteVfModuleResponse") - logDebug("VNF Adapter Response is: " + vnfResponse, isDebugLogEnabled) - utils.logAudit("deleteVnfAResponse is: \n" + vnfResponse) - - if(vnfResponse != null){ - - if(vnfResponse.contains("deleteVfModuleResponse")){ - logDebug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.", isDebugLogEnabled) - execution.setVariable("DoDVfMod_vnfVfModuleDeleteCompleted", true) - - // Parse vnfOutputs for contrail network polcy FQDNs - if (vnfResponse.contains("vfModuleOutputs")) { - def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs") - InputSource source = new InputSource(new StringReader(vfModuleOutputsXml)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docFactory.setNamespaceAware(true) - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document outputsXml = docBuilder.parse(source) - - NodeList entries = outputsXml.getElementsByTagNameNS("*", "entry") - List contrailNetworkPolicyFqdnList = [] - for (int i = 0; i< entries.getLength(); i++) { - Node node = entries.item(i) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element element = (Element) node - String key = element.getElementsByTagNameNS("*", "key").item(0).getTextContent() - if (key.endsWith("contrail_network_policy_fqdn")) { - String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - logDebug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn, isDebugLogEnabled) - contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn) - } - else if (key.equals("oam_management_v4_address")) { - String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - logDebug("Obtained oamManagementV4Address: " + oamManagementV4Address, isDebugLogEnabled) - execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address) - } - else if (key.equals("oam_management_v6_address")) { - String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - logDebug("Obtained oamManagementV6Address: " + oamManagementV6Address, isDebugLogEnabled) - execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address) - } - - } - } - if (!contrailNetworkPolicyFqdnList.isEmpty()) { - logDebug("Setting the fqdn list", isDebugLogEnabled) - execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList) - } - } - }else{ - logDebug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error") - } - }else{ - logDebug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter") - } - - }catch(BpmnError b){ - throw b - }catch(Exception e){ - logDebug("Internal Error Occured in PostProcess Method", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method") - } - logDebug(" *** COMPLETED postProcessVnfAdapterResponse Process*** ", isDebugLogEnabled) - } - - public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED deleteNetworkPoliciesFromAAI ======== ", isDebugLogEnabled) - - try { - // get variables - List fqdnList = execution.getVariable("DoDVfMod_contrailNetworkPolicyFqdnList") - if (fqdnList == null) { - logDebug("No network policies to delete", isDebugLogEnabled) - return - } - int fqdnCount = fqdnList.size() - - execution.setVariable("DoDVfMod_networkPolicyFqdnCount", fqdnCount) - logDebug("DoDVfMod_networkPolicyFqdnCount - " + fqdnCount, isDebugLogEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) - - if (fqdnCount > 0) { - // AII loop call over contrail network policy fqdn list - for (i in 0..fqdnCount-1) { - - int counting = i+1 - String fqdn = fqdnList[i] - - // Query AAI for this network policy FQDN - - String queryNetworkPolicyByFqdnAAIRequest = "${aai_endpoint}${aai_uri}?network-policy-fqdn=" + UriUtils.encode(fqdn, "UTF-8") - utils.logAudit("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest) - logDebug("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest, isDebugLogEnabled) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkPolicyByFqdnAAIRequest) - int returnCode = response.getStatusCode() - execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", returnCode) - logDebug(" ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode, isDebugLogEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (isOneOf(returnCode, 200, 201)) { - logDebug("The return code is: " + returnCode, isDebugLogEnabled) - // This network policy FQDN exists in AAI - need to delete it now - utils.logAudit(aaiResponseAsString) - execution.setVariable("DoDVfMod_queryNetworkPolicyByFqdnAAIResponse", aaiResponseAsString) - logDebug("QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString, isDebugLogEnabled) - // Retrieve the network policy id for this FQDN - def networkPolicyId = utils.getNodeText1(aaiResponseAsString, "network-policy-id") - logDebug("Deleting network-policy with network-policy-id " + networkPolicyId, isDebugLogEnabled) - - // Retrieve the resource version for this network policy - def resourceVersion = utils.getNodeText1(aaiResponseAsString, "resource-version") - logDebug("Deleting network-policy with resource-version " + resourceVersion, isDebugLogEnabled) - - String delNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(networkPolicyId, "UTF-8") + - "?resource-version=" + UriUtils.encode(resourceVersion, "UTF-8") - utils.logAudit("AAI request endpoint: " + delNetworkPolicyAAIRequest) - logDebug("AAI request endpoint: " + delNetworkPolicyAAIRequest, isDebugLogEnabled) - - logDebug("invoking DELETE call to AAI", isDebugLogEnabled) - utils.logAudit("Sending DELETE call to AAI with Endpoint /n" + delNetworkPolicyAAIRequest) - APIResponse responseDel = aaiUriUtil.executeAAIDeleteCall(execution, delNetworkPolicyAAIRequest) - int returnCodeDel = responseDel.getStatusCode() - execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", returnCodeDel) - logDebug(" ***** AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + returnCodeDel, isDebugLogEnabled) - - if (isOneOf(returnCodeDel, 200, 201, 204)) { - logDebug("The return code from deleting network policy is: " + returnCodeDel, isDebugLogEnabled) - // This network policy was deleted from AAI successfully - logDebug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ", isDebugLogEnabled) - - } else { - // aai all errors - String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + returnCodeDel - logDebug(delErrorMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage) - } - } else if (returnCode == 404) { - // This network policy FQDN is not in AAI. No need to delete. - logDebug("The return code is: " + returnCode, isDebugLogEnabled) - logDebug("This network policy FQDN is not in AAI: " + fqdn, isDebugLogEnabled) - utils.logAudit("Network policy FQDN is not in AAI") - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + returnCode - logDebug(dataErrorMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - - - - } // end loop - - - } else { - logDebug("No contrail network policies to query/create", isDebugLogEnabled) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() - logDebug(exceptionMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - } - - /** - * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. - * - * @param execution The flow's execution instance. - */ - public void prepUpdateAAIGenericVnf(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def vnfId = execution.getVariable('vnfId') - def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address') - def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address') - def ipv4OamAddressElement = '' - def managementV6AddressElement = '' - - if (oamManagementV4Address != null) { - ipv4OamAddressElement = '' + 'DELETE' + '' - } - - if (oamManagementV6Address != null) { - managementV6AddressElement = '' + 'DELETE' + '' - } - - - String updateAAIGenericVnfRequest = """ - - ${vnfId} - ${ipv4OamAddressElement} - ${managementV6AddressElement} - - """ - updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) - execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) - utils.logAudit("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) - logDebug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest, isDebugLogEnabled) - - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) - } - } - - /** - * Using the vnfId and vfModuleId provided in the inputs, - * query AAI to get the corresponding VF Module info. - * A 200 response is expected with the VF Module info in the response body, - * Will determine VF Module's orchestration status if one exists - * - * @param execution The flow's execution instance. - */ - public void queryAAIVfModuleForStatus(DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' + - 'execution=' + execution.getId() + - ')' - logDebug('Entered ' + method, isDebugLogEnabled) - - execution.setVariable(Prefix + 'orchestrationStatus', '') - - try { - def vnfId = execution.getVariable('vnfId') - def vfModuleId = execution.getVariable('vfModuleId') - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - - String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + - "/vf-modules/vf-module/" + UriUtils.encode(vfModuleId, "UTF-8") - utils.logAudit("AAI endPoint: " + endPoint) - - try { - RESTConfig config = new RESTConfig(endPoint); - def responseData = '' - def aaiRequestId = UUID.randomUUID().toString() - RESTClient client = new RESTClient(config). - addHeader('X-TransactionId', aaiRequestId). - addHeader('X-FromAppId', 'MSO'). - addHeader('Content-Type', 'application/xml'). - addHeader('Accept','application/xml'); - logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) - APIResponse response = client.httpGet() - utils.logAudit("createVfModule - invoking httpGet() to AAI") - - responseData = response.getResponseBodyAsString() - if (responseData != null) { - logDebug("Received generic VNF data: " + responseData, isDebugLogEnabled) - - } - - utils.logAudit("deleteVfModule - queryAAIVfModule Response: " + responseData) - utils.logAudit("deleteVfModule - queryAAIVfModule ResponseCode: " + response.getStatusCode()) - - execution.setVariable(Prefix + 'queryAAIVfModuleForStatusResponseCode', response.getStatusCode()) - execution.setVariable(Prefix + 'queryAAIVfModuleForStatusResponse', responseData) - logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) - logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) - // Retrieve VF Module info and its orchestration status; if not found, do nothing - if (response.getStatusCode() == 200) { - // Parse the VNF record from A&AI to find base module info - logDebug('Parsing the VNF data to find orchestration status', isDebugLogEnabled) - if (responseData != null) { - def vfModuleText = utils.getNodeXml(responseData, "vf-module") - //def xmlVfModule= new XmlSlurper().parseText(vfModuleText) - def orchestrationStatus = utils.getNodeText1(vfModuleText, "orchestration-status") - execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus) - logDebug("Received orchestration status from A&AI: " + orchestrationStatus, isDebugLogEnabled) - - } - } - } catch (Exception ex) { - ex.printStackTrace() - logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) - } - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage()) - } - } - - - - - -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy deleted file mode 100644 index 428f9aa1d9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy +++ /dev/null @@ -1,596 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.scripts.VfModule -import org.openecomp.mso.bpmn.common.scripts.VfModuleBase -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.springframework.web.util.UriUtils -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.xml.sax.InputSource -import static org.apache.commons.lang3.StringUtils.* - -public class DoDeleteVfModuleFromVnf extends VfModuleBase { - - def Prefix="DDVFMV_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable("prefix",Prefix) - execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", null) - } - - // parse the incoming request - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - initProcessVariables(execution) - - try { - - // Building Block-type request - - // Set mso-request-id to request-id for VNF Adapter interface - String requestId = execution.getVariable("msoRequestId") - execution.setVariable("mso-request-id", requestId) - execution.setVariable("requestId", requestId) - utils.log("DEBUG", "msoRequestId: " + requestId, isDebugEnabled) - String tenantId = execution.getVariable("tenantId") - utils.log("DEBUG", "tenantId: " + tenantId, isDebugEnabled) - String cloudSiteId = execution.getVariable("lcpCloudRegionId") - execution.setVariable("cloudSiteId", cloudSiteId) - utils.log("DEBUG", "cloudSiteId: " + cloudSiteId, isDebugEnabled) - // Source is HARDCODED - String source = "VID" - execution.setVariable("source", source) - // isVidRequest is hardcoded to "true" - execution.setVariable("isVidRequest", "true") - // SrvInstId is hardcoded to empty - execution.setVariable("srvInstId", "") - // ServiceId is hardcoded to empty - execution.setVariable("serviceId", "") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - utils.log("DEBUG", "serviceInstanceId: " + serviceInstanceId, isDebugEnabled) - String vnfId = execution.getVariable("vnfId") - utils.log("DEBUG", "vnfId: " + vnfId, isDebugEnabled) - String vfModuleId = execution.getVariable("vfModuleId") - utils.log("DEBUG", "vfModuleId: " + vfModuleId, isDebugEnabled) - if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { - execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId) - } - else { - execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId) - } - - String sdncVersion = execution.getVariable("sdncVersion") - if (sdncVersion == null) { - sdncVersion = "1707" - } - execution.setVariable(Prefix + "sdncVersion", sdncVersion) - utils.log("DEBUG", "Incoming Sdnc Version is: " + sdncVersion, isDebugEnabled) - - String sdncCallbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { - def msg = 'Required variable \'URN_mso_workflow_sdncadapter_callback\' is missing' - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - utils.logAudit("SDNC Callback URL: " + sdncCallbackUrl) - utils.log("DEBUG:", "SDNC Callback URL is: " + sdncCallbackUrl, isDebugEnabled) - - - - }catch(BpmnError b){ - throw b - }catch(Exception e){ - utils.log("DEBUG", "Exception is: " + e.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!") - } - } - - public void queryAAIForVfModule(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.queryAAIForVfModule(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def vnfId = execution.getVariable('vnfId') - - AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - - String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" - - utils.logAudit("DoDeleteVfModuleFromVnf: AAI endPoint : " + endPoint) - - try { - utils.logAudit("DoDeleteVfModuleFromVnf: - invoking httpGet to AAI") - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint) - - def responseData = response.getResponseBodyAsString() - execution.setVariable('DDVMFV_getVnfResponseCode', response.getStatusCode()) - execution.setVariable('DDVMFV_getVnfResponse', responseData) - - utils.logAudit("DoDeleteVfModuleFromVnf: AAI Response : " + responseData) - utils.logAudit("DoDeleteVfModuleFromVnf: AAI ResponseCode : " + response.getStatusCode()) - - logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) - logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) - - } catch (Exception ex) { - ex.printStackTrace() - logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(), isDebugLogEnabled) - execution.setVariable('DDVMFV_getVnfResponseCode', 500) - execution.setVariable('DDVFMV_getVnfResponse', 'AAI GET Failed:' + ex.getMessage()) - } - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage()) - } - } - - /** - * Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID - * exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module - * is the base VF Module and it's not the only VF Module for this Generic VNF, that we're not - * attempting to delete it. - * - * @param execution The flow's execution instance. - */ - public void validateVfModule(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.validateVfModule(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def genericVnf = execution.getVariable('DDVMFV_getVnfResponse') - def vnfId = execution.getVariable('_vnfId') - def vfModuleId = execution.getVariable('vfModuleId') - def VfModule vfModule = findVfModule(genericVnf, vfModuleId) - if (vfModule == null) { - def String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\'' - logDebug(msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, msg) - } else { - - if (isDebugLogEnabled) { - logDebug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.isBaseVfModule() + - ', isOnlyVfModule=' + vfModule.isOnlyVfModule(), - isDebugLogEnabled) - } - if (vfModule.isBaseVfModule() && !vfModule.isOnlyVfModule()) { - def String msg = 'Cannot delete VF Module \'' + vfModuleId + - '\'since it is the base VF Module and it\'s not the only VF Module in Generic VNF \'' + vnfId + '\'' - logDebug("Received a BAD Response from VNF Adapter for CREATE_VF_MODULE Call.", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error") - } - - def heatStackId = vfModule.getElementText('heat-stack-id') - execution.setVariable('DDVMFV_heatStackId', heatStackId) - logDebug('VF Module heatStackId retrieved from AAI: ' + heatStackId, isDebugLogEnabled) - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage()) - } - } - - - public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled) - - def serviceInstanceId = execution.getVariable("serviceInstanceId") - - try{ - //Build SDNC Request - - String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate") - - deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest) - execution.setVariable("DDVMFV_deactivateSDNCRequest", deactivateSDNCRequest) - logDebug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest, isDebugLogEnabled) - utils.logAudit("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled) - } - - public void preProcessSDNCUnassignRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessSDNCUnassignRequest Process ======== ", isDebugLogEnabled) - try{ - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign") - - execution.setVariable("DDVMFV_unassignSDNCRequest", unassignSDNCRequest) - logDebug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest, isDebugLogEnabled) - utils.logAudit("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) - - }catch(Exception e){ - log.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessSDNCUnassignRequest Process ======== ", isDebugLogEnabled) - } - - public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ - - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis() - } - def callbackURL = execution.getVariable("sdncCallbackUrl") - def requestId = execution.getVariable("msoRequestId") - def serviceId = execution.getVariable("serviceId") - def serviceInstanceId = execution.getVariable("serviceInstanceId") - def vfModuleId = execution.getVariable("vfModuleId") - def source = execution.getVariable("source") - def vnfId = execution.getVariable("vnfId") - - def sdncVersion = execution.getVariable(Prefix + "sdncVersion") - - String sdncRequest = - """ - - ${uuid} - ${svcInstId} - ${action} - vf-module-topology-operation - ${callbackURL} - generic-resource - - - - ${requestId} - DeleteVfModuleInstance - ${source} - - - - - - - - ${serviceInstanceId} - - - - ${vnfId} - - - - ${vfModuleId} - - - - """ - - utils.logAudit("sdncRequest: " + sdncRequest) - return sdncRequest - } - - public void validateSDNCResponse(DelegateExecution execution, String response, String method){ - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled) - - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - utils.logAudit("workflowException: " + workflowException) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - utils.logAudit("SDNCResponse: " + response) - - String sdncResponse = response - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - logDebug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse, isDebugLogEnabled) - }else{ - logDebug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) - throw new BpmnError("MSOWorkflowException") - } - logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled) - } - - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing VnfAdapterDeleteV1 request - public void prepVNFAdapterRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def requestId = UUID.randomUUID().toString() - def origRequestId = execution.getVariable('requestId') - def srvInstId = execution.getVariable("serviceInstanceId") - def aicCloudRegion = execution.getVariable("cloudSiteId") - def vnfId = execution.getVariable("vnfId") - def vfModuleId = execution.getVariable("vfModuleId") - def vfModuleStackId = execution.getVariable('DDVMFV_heatStackId') - def tenantId = execution.getVariable("tenantId") - def messageId = execution.getVariable('requestId') + '-' + - System.currentTimeMillis() - def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) - def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") - if ('true'.equals(useQualifiedHostName)) { - notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) - } - - String request = """ - - ${aicCloudRegion} - ${tenantId} - ${vnfId} - ${vfModuleId} - ${vfModuleStackId} - true - - ${origRequestId} - ${srvInstId} - - ${messageId} - ${notificationUrl} - - """ as String - - utils.log("DEBUG", "vnfAdapterRestV1Request: " + request, isDebugEnabled) - utils.logAudit("deleteVfModuleRequest: " + request) - execution.setVariable("vnfAdapterRestV1Request", request) - } - - - // generates a WorkflowException if - // - - public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("ERROR", "AAI error occurred deleting the Generic Vnf: " - + execution.getVariable("DDVFMV_deleteGenericVnfResponse"), isDebugEnabled) - String processKey = getProcessKey(execution); - WorkflowException exception = new WorkflowException(processKey, 5000, - execution.getVariable("DDVFMV_deleteGenericVnfResponse")) - execution.setVariable("WorkflowException", exception) - } - - public void postProcessVNFAdapterRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix",Prefix) - try{ - logDebug(" *** STARTED postProcessVNFAdapterRequest Process*** ", isDebugLogEnabled) - - String vnfResponse = execution.getVariable("DDVMFV_doDeleteVfModuleResponse") - logDebug("VNF Adapter Response is: " + vnfResponse, isDebugLogEnabled) - utils.logAudit("deleteVnfAResponse is: \n" + vnfResponse) - - if(vnfResponse != null){ - - if(vnfResponse.contains("deleteVfModuleResponse")){ - logDebug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.", isDebugLogEnabled) - execution.setVariable("DDVFMV_vnfVfModuleDeleteCompleted", true) - - // Parse vnfOutputs for contrail network polcy FQDNs - def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs") - if(!isBlank(vfModuleOutputsXml)) { - vfModuleOutputsXml = utils.removeXmlNamespaces(vfModuleOutputsXml) - List contrailNetworkPolicyFqdnList = [] - for(Node node: utils.getMultNodeObjects(vfModuleOutputsXml, "entry")) { - String key = utils.getChildNodeText(node, "key") - if(key == null) { - - } else if (key.endsWith("contrail_network_policy_fqdn")) { - String contrailNetworkPolicyFqdn = utils.getChildNodeText(node, "value") - logDebug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn, isDebugLogEnabled) - contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn) - } - else if (key.equals("oam_management_v4_address")) { - String oamManagementV4Address = utils.getChildNodeText(node, "value") - logDebug("Obtained oamManagementV4Address: " + oamManagementV4Address, isDebugLogEnabled) - execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address) - } - else if (key.equals("oam_management_v6_address")) { - String oamManagementV6Address = utils.getChildNodeText(node, "value") - logDebug("Obtained oamManagementV6Address: " + oamManagementV6Address, isDebugLogEnabled) - execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address) - } - } - if (!contrailNetworkPolicyFqdnList.isEmpty()) { - logDebug("Setting the fqdn list", isDebugLogEnabled) - execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList) - } - } - }else{ - logDebug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error") - } - }else{ - logDebug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter") - } - - }catch(BpmnError b){ - throw b - }catch(Exception e){ - logDebug("Internal Error Occured in PostProcess Method", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method") - } - logDebug(" *** COMPLETED postProcessVnfAdapterResponse Process*** ", isDebugLogEnabled) - } - - public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED deleteNetworkPoliciesFromAAI ======== ", isDebugLogEnabled) - - try { - // get variables - List fqdnList = execution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList") - if (fqdnList == null) { - logDebug("No network policies to delete", isDebugLogEnabled) - return - } - int fqdnCount = fqdnList.size() - - execution.setVariable("DDVFMV_networkPolicyFqdnCount", fqdnCount) - logDebug("DDVFMV_networkPolicyFqdnCount - " + fqdnCount, isDebugLogEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) - - if (fqdnCount > 0) { - // AII loop call over contrail network policy fqdn list - for (i in 0..fqdnCount-1) { - - int counting = i+1 - String fqdn = fqdnList[i] - - // Query AAI for this network policy FQDN - - String queryNetworkPolicyByFqdnAAIRequest = "${aai_endpoint}${aai_uri}?network-policy-fqdn=" + UriUtils.encode(fqdn, "UTF-8") - utils.logAudit("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest) - logDebug("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest, isDebugLogEnabled) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkPolicyByFqdnAAIRequest) - int returnCode = response.getStatusCode() - execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", returnCode) - logDebug(" ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode, isDebugLogEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (isOneOf(returnCode, 200, 201)) { - logDebug("The return code is: " + returnCode, isDebugLogEnabled) - // This network policy FQDN exists in AAI - need to delete it now - utils.logAudit(aaiResponseAsString) - execution.setVariable("DDVFMV_queryNetworkPolicyByFqdnAAIResponse", aaiResponseAsString) - logDebug("QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString, isDebugLogEnabled) - // Retrieve the network policy id for this FQDN - def networkPolicyId = utils.getNodeText1(aaiResponseAsString, "network-policy-id") - logDebug("Deleting network-policy with network-policy-id " + networkPolicyId, isDebugLogEnabled) - - // Retrieve the resource version for this network policy - def resourceVersion = utils.getNodeText1(aaiResponseAsString, "resource-version") - logDebug("Deleting network-policy with resource-version " + resourceVersion, isDebugLogEnabled) - - String delNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(networkPolicyId, "UTF-8") + - "?resource-version=" + UriUtils.encode(resourceVersion, "UTF-8") - utils.logAudit("AAI request endpoint: " + delNetworkPolicyAAIRequest) - logDebug("AAI request endpoint: " + delNetworkPolicyAAIRequest, isDebugLogEnabled) - - logDebug("invoking DELETE call to AAI", isDebugLogEnabled) - utils.logAudit("Sending DELETE call to AAI with Endpoint /n" + delNetworkPolicyAAIRequest) - APIResponse responseDel = aaiUriUtil.executeAAIDeleteCall(execution, delNetworkPolicyAAIRequest) - int returnCodeDel = responseDel.getStatusCode() - execution.setVariable("DDVFMV_aaiDeleteNetworkPolicyReturnCode", returnCodeDel) - logDebug(" ***** AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + returnCodeDel, isDebugLogEnabled) - - if (isOneOf(returnCodeDel, 200, 201, 204)) { - logDebug("The return code from deleting network policy is: " + returnCodeDel, isDebugLogEnabled) - // This network policy was deleted from AAI successfully - logDebug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ", isDebugLogEnabled) - - } else { - // aai all errors - String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + returnCodeDel - logDebug(delErrorMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage) - } - } else if (returnCode == 404) { - // This network policy FQDN is not in AAI. No need to delete. - logDebug("The return code is: " + returnCode, isDebugLogEnabled) - logDebug("This network policy FQDN is not in AAI: " + fqdn, isDebugLogEnabled) - utils.logAudit("Network policy FQDN is not in AAI") - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + returnCode - logDebug(dataErrorMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - - - - } // end loop - - - } else { - logDebug("No contrail network policies to query/create", isDebugLogEnabled) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() - logDebug(exceptionMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - } - - // and formulate the outgoing DeleteAAIVfModuleRequest request - public void prepDeleteAAIVfModule(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - def vnfId = execution.getVariable("vnfId") - def vfModuleId = execution.getVariable("vfModuleId") - // formulate the request for UpdateAAIVfModule - String request = """ - ${vnfId} - ${vfModuleId} - """ as String - utils.log("DEBUG", "DeleteAAIVfModuleRequest :" + request, isDebugEnabled) - utils.logAudit("DeleteAAIVfModuleRequest: " + request) - execution.setVariable("DeleteAAIVfModuleRequest", request) - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy deleted file mode 100644 index 7784e08958..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy +++ /dev/null @@ -1,358 +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.bpmn.infrastructure.scripts - -import groovy.json.JsonSlurper -import groovy.util.XmlParser; - -import java.util.concurrent.ExecutionException; - -import org.springframework.web.util.UriUtils -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse -import org.apache.commons.lang3.* - -class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor { - - String prefix="DDVMV_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - XmlParser xmlParser = new XmlParser() - JsonUtils jsonUtil = new JsonUtils() - - @Override - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - preProcessRequest(execution, isDebugEnabled) - } - - /** - * Set default variable values - * @param execution - * @param isDebugLogEnabled - */ - public void preProcessRequest (DelegateExecution execution, isDebugEnabled) { - - //Input: - // msoRequestId - // isDebugLogEnabled - // failIfNotFound (Optional) - // serviceInstanceId (Optional) - // vnfId (Optional) - // volumeGroupId - // vfModuleModelInfo (Optional) - // lcpCloudRegionId (Optional) @TODO: this is actually required - // tenantId (Optional) @TODO: this is actually required - // cloudConfiguration @TODO: temporary solution? this contains lcpCloudregion and tenantId - // - //Output: - // workflowException @TODO: actual variable name is WorkflowException - // rolledBack - // wasDeleted - - execution.setVariable('prefix', prefix) - execution.setVariable('wasDeleted', 'false') - - def tenantId = execution.getVariable("tenantId") - def cloudSiteId = execution.getVariable("lcpCloudRegionId") - - // if tenantId or lcpCloudregionId is not passed, get it from cloudRegionConfiguration variable - if(!tenantId || !cloudSiteId) { - def cloudConfiguration = execution.getVariable("cloudConfiguration") - utils.log("DEBUG", "Using cloudConfiguration variable to get tenantId and lcpCloudRegionId - " + cloudConfiguration, isDebugEnabled) - tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId") - execution.setVariable("tenantId", tenantId) - cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId") - execution.setVariable("lcpCloudRegionId", cloudSiteId) - } - } - - - /** - * Set out 'wasDeleted' variable to 'true' - * @param execution - * @param isDebugLogEnabled - */ - public void postProcess(DelegateExecution execution, isDebugLogEnabled) { - execution.setVariable('wasDeleted', 'true') - } - - - /** - * Query and set cloud region to use for AAI calls - * Output variables: prefix+'aicCloudRegion', prefix+'cloudRegion' - * @param execution - * @param isDebugEnabled - */ - public void callRESTQueryAAICloudRegion(DelegateExecution execution, isDebugEnabled) { - - String cloudRegion = execution.getVariable('lcpCloudRegionId') - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUtil = new AaiUtil(this) - String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) - String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion - utils.logAudit(queryCloudRegionRequest) - utils.log("DEBUG", "AAI query cloud region URI - " + queryCloudRegionRequest, isDebugEnabled) - - cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) - - if ((cloudRegion != "ERROR")) { - if(execution.getVariable(prefix+"queryCloudRegionReturnCode") == "404") { - execution.setVariable(prefix+"aicCloudRegion", "AAIAIC25") - } - else{ - execution.setVariable(prefix+"aicCloudRegion", cloudRegion) - } - } - else { - utils.log("DEBUG", "AAI Query Cloud Region Unsuccessful.", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")) - } - } - - - /** - * Query AAI Volume Group - * Output variables: prefix+'queryAAIVolGrpResponse'; prefix+'volumeGroupHeatStackId' - * @param execution - * @param isDebugLogEnabled - */ - public void callRESTQueryAAIForVolumeGroup(DelegateExecution execution, isDebugLogEnabled) { - - def tenantId = execution.getVariable('tenantId') - def volumeGroupId = execution.getVariable('volumeGroupId') - if(volumeGroupId == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, 'volumeGroupId is not provided in the request') - throw new Exception('volume-group-id is not provided in the request') - } - String cloudRegion = execution.getVariable(prefix+'aicCloudRegion') - - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) - String queryAAIVolumeGroupRequest = aaiEndpoint + '/' + URLEncoder.encode(cloudRegion, "UTF-8") + "/volume-groups/volume-group/" + UriUtils.encode(volumeGroupId, "UTF-8") - - utils.logAudit('Query AAI volume group by ID: ' + queryAAIVolumeGroupRequest) - logDebug('Query AAI volume group by ID: ' + queryAAIVolumeGroupRequest, isDebugLogEnabled) - - APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIVolumeGroupRequest) - - String returnCode = response.getStatusCode() - String aaiResponseAsString = response.getResponseBodyAsString() - aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) - - utils.logAudit("AAI query volume group by id return code: " + returnCode) - utils.logAudit("AAI query volume group by id response: " + aaiResponseAsString) - logDebug('AAI query volume group by id return code: ' + returnCode, isDebugLogEnabled) - logDebug('AAI query volume group by id response: ' + aaiResponseAsString, isDebugLogEnabled) - - execution.setVariable(prefix+"queryAAIVolGrpResponse", aaiResponseAsString) - - if (returnCode=='200' || returnCode == '204') { - - def heatStackId = getNodeTextForce(aaiResponseAsString, 'heat-stack-id') - execution.setVariable(prefix+'volumeGroupHeatStackId', heatStackId) - - logDebug('Heat stack id from AAI response: ' + heatStackId, isDebugLogEnabled) - - if(hasVfModuleRelationship(aaiResponseAsString)){ - utils.log("DEBUG", 'Volume Group ' + volumeGroupId + ' currently in use', isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} currently in use - found vf-module relationship.") - } - - def volumeGroupTenantId = getTenantIdFromVolumeGroup(aaiResponseAsString) - logDebug('Tenant ID from AAI response: ' + volumeGroupTenantId, isDebugLogEnabled) - - if (volumeGroupTenantId == null) { - utils.log("DEBUG", "Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}") - } - - if (volumeGroupTenantId != tenantId) { - def String errorMessage = 'TenantId ' + tenantId + ' in incoming request does not match Tenant Id ' + volumeGroupTenantId + ' retrieved from AAI for Volume Group Id ' + volumeGroupId - utils.log("DEBUG", "Error in DeleteVfModuleVolume: " + errorMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, errorMessage) - } - logDebug('Received Tenant Id ' + volumeGroupTenantId + ' from AAI for Volume Group with Volume Group Id ' + volumeGroupId , isDebugLogEnabled) - } - else { - if (returnCode=='404') { - utils.log("DEBUG", "Volume Group ${volumeGroupId} not found in AAI", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} not found in AAI. Response code: 404") - } - else { - WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - throw new BpmnError("MSOWorkflowException") - } - } - } - - /** - * Format VNF Adapter subflow request XML - * Variables: prefix+'deleteVnfARequest' - * @param execution - * @param isDebugLogEnabled - */ - public void prepareVnfAdapterDeleteRequest(DelegateExecution execution, isDebugLogEnabled) { - def cloudRegion = execution.getVariable(prefix+'aicCloudRegion') - def tenantId = execution.getVariable('tenantId') // input parameter (optional) - see preProcessRequest - def volumeGroupId = execution.getVariable('volumeGroupId') // input parameter (required) - def volumeGroupHeatStackId = execution.getVariable(prefix+'volumeGroupHeatStackId') // from AAI query volume group - def requestId = execution.getVariable('msoRequestId') // input parameter (required) - def serviceId = execution.getVariable('serviceInstanceId') // imput parameter (optional) - - def messageId = UUID.randomUUID().toString() - def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) - def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") - if ('true'.equals(useQualifiedHostName)) { - notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) - } - - String vnfAdapterRestRequest = """ - - ${cloudRegion} - ${tenantId} - ${volumeGroupId} - ${volumeGroupHeatStackId} - true - - ${requestId} - ${serviceId} - - ${messageId} - ${notificationUrl} - - """ - vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest) - execution.setVariable(prefix+'deleteVnfARequest', vnfAdapterRestRequest) - logDebug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest, isDebugLogEnabled) - } - - - /** - * Delete volume group in AAI - * @param execution - * @param isDebugEnabled - */ - public void callRESTDeleteAAIVolumeGroup(DelegateExecution execution, isDebugEnabled) { - - // get variables - String queryAAIVolGrpIdResponse = execution.getVariable(prefix+"queryAAIVolGrpResponse") - String groupId = utils.getNodeText(queryAAIVolGrpIdResponse, "volume-group-id") - String resourceVersion = utils.getNodeText(queryAAIVolGrpIdResponse, "resource-version") - - String messageId = UUID.randomUUID().toString() - String cloudRegion = execution.getVariable(prefix+'aicCloudRegion') - - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) - String deleteAAIVolumeGrpIdRequest = aaiEndpoint + '/' + URLEncoder.encode(cloudRegion, "UTF-8") + "/volume-groups/volume-group/" + UriUtils.encode(groupId, "UTF-8") - - if(resourceVersion !=null){ - deleteAAIVolumeGrpIdRequest = deleteAAIVolumeGrpIdRequest +'?resource-version=' + UriUtils.encode(resourceVersion, 'UTF-8') - } - - utils.logAudit('Delete AAI volume group : ' + deleteAAIVolumeGrpIdRequest) - utils.log("DEBUG", "Delete AAI volume group : " + deleteAAIVolumeGrpIdRequest, isDebugEnabled) - - APIResponse response = aaiUtil.executeAAIDeleteCall(execution, deleteAAIVolumeGrpIdRequest) - - String returnCode = response.getStatusCode() - String aaiResponseAsString = response.getResponseBodyAsString() - aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) - - utils.logAudit("AAI delete volume group return code: " + returnCode) - utils.logAudit("AAI delete volume group response: " + aaiResponseAsString) - utils.log("DEBUG", "AAI delete volume group return code: " + returnCode, isDebugEnabled) - utils.log("DEBUG", "AAI delete volume group response: " + aaiResponseAsString, isDebugEnabled) - - ExceptionUtil exceptionUtil = new ExceptionUtil() - if (returnCode=='200' || (returnCode == '204')) { - utils.log("DEBUG", "Volume group $groupId deleted.", isDebugEnabled) - } else { - if (returnCode=='404') { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume group $groupId not found for delete in AAI Response code: 404") - } else { - WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - throw new BpmnError("MSOWorkflowException") - } - } - } - - - /** - * Check if volume group has a relationship to vf-module - * @param volumeGroupXml - * @return - */ - private boolean hasVfModuleRelationship(String volumeGroupXml) { - def Node volumeGroupNode = xmlParser.parseText(volumeGroupXml) - def Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list') - if (relationshipList != null) { - def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') - for (Node relationship in relationships) { - def Node relatedTo = utils.getChildNode(relationship, 'related-to') - if ((relatedTo != null) && (relatedTo.text().equals('vf-module'))) { - def Node relatedLink = utils.getChildNode(relationship, 'related-link') - if (relatedLink !=null && relatedLink.text() != null){ - return true - } - } - } - } - return false - } - - - /** - * Extract the Tenant Id from the Volume Group information returned by AAI. - * @param volumeGroupXml Volume Group XML returned by AAI. - * @return the Tenant Id extracted from the Volume Group information. 'null' is returned if - * the Tenant Id is missing or could not otherwise be extracted. - */ - private String getTenantIdFromVolumeGroup(String volumeGroupXml) { - def Node volumeGroupNode = xmlParser.parseText(volumeGroupXml) - def Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list') - if (relationshipList != null) { - def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') - for (Node relationship in relationships) { - def Node relatedTo = utils.getChildNode(relationship, 'related-to') - if ((relatedTo != null) && (relatedTo.text().equals('tenant'))) { - def NodeList relationshipDataList = utils.getIdenticalChildren(relationship, 'relationship-data') - for (Node relationshipData in relationshipDataList) { - def Node relationshipKey = utils.getChildNode(relationshipData, 'relationship-key') - if ((relationshipKey != null) && (relationshipKey.text().equals('tenant.tenant-id'))) { - def Node relationshipValue = utils.getChildNode(relationshipData, 'relationship-value') - if (relationshipValue != null) { - return relationshipValue.text() - } - } - } - } - } - } - return null - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnf.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnf.groovy deleted file mode 100644 index 5e6fff2fd4..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnf.groovy +++ /dev/null @@ -1,136 +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.bpmn.infrastructure.scripts - - -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource - - -/** - * This class supports the DoDeleteVnf subFlow - * with the Deletion of a generic vnf for - * infrastructure. - * - */ -class DoDeleteVnf extends AbstractServiceTaskProcessor { - - String Prefix="DoDVNF_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - - /** - * This method gets and validates the incoming - * request. - * - * @param - execution - * - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED DoDeleteVnf PreProcessRequest Process*** ", isDebugEnabled) - - execution.setVariable("DoDVNF_SuccessIndicator", false) - execution.setVariable("DoDVNF_vnfInUse", false) - - try{ - // Get Variables - - String vnfId = execution.getVariable("vnfId") - execution.setVariable("DoDVNF_vnfId", vnfId) - utils.log("DEBUG", "Incoming Vnf(Instance) Id is: " + vnfId, isDebugEnabled) - - // Setting for sub flow calls - execution.setVariable("DoDVNF_type", "generic-vnf") - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", " Error Occured in DoDeleteVnf PreProcessRequest method!" + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoDeleteVnf PreProcessRequest") - - } - utils.log("DEBUG", "*** COMPLETED DoDeleteVnf PreProcessRequest Process ***", isDebugEnabled) - } - - - public void processGetVnfResponse(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED DoDeleteVnf processGetVnfResponse Process *** ", isDebugEnabled) - try { - String vnf = execution.getVariable("DoDVNF_genericVnf") - String resourceVersion = utils.getNodeText1(vnf, "resource-version") - execution.setVariable("DoDVNF_resourceVersion", resourceVersion) - - if(utils.nodeExists(vnf, "relationship")){ - InputSource source = new InputSource(new StringReader(vnf)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document vnfXml = docBuilder.parse(source) - - NodeList nodeList = vnfXml.getElementsByTagName("relationship") - for (int x = 0; x < nodeList.getLength(); x++) { - Node node = nodeList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() - if(e.equals("volume-group") || e.equals("l3-network")){ - utils.log("DEBUG", "Generic Vnf still has relationship to OpenStack.", isDebugEnabled) - execution.setVariable("DoDVNF_vnfInUse", true) - }else{ - utils.log("DEBUG", "Relationship NOT related to OpenStack", isDebugEnabled) - } - } - } - } - - if(utils.nodeExists(vnf, "vf-module")){ - execution.setVariable("DoDVNF_vnfInUse", true) - utils.log("DEBUG", "Generic Vnf still has vf-modules.", isDebugEnabled) - } - - - } catch (Exception ex) { - utils.log("DEBUG", "Error Occured in DoDeleteVnf processGetVnfResponse Process " + ex.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoDeleteVnf processGetVnfResponse Process") - - } - utils.log("DEBUG", "*** COMPLETED DoDeleteVnf processGetVnfResponse Process ***", isDebugEnabled) - } - - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy deleted file mode 100644 index 7074df5a91..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy +++ /dev/null @@ -1,539 +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.bpmn.infrastructure.scripts - -import java.awt.Component.BaselineResizeBehavior -import java.util.UUID; - -import org.json.JSONObject; -import org.json.JSONArray; -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution; - -import static org.apache.commons.lang3.StringUtils.*; - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.ModuleResource -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.springframework.web.util.UriUtils; - -/** - * This class supports the macro VID Flow - * with the deletion of a generic vnf and related VF modules. - */ -class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { - - String Prefix="DDVAM_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - - /** - * This method gets and validates the incoming - * request. - * - * @param - execution - * - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED DoDeleteVnfAndModules PreProcessRequest Process*** ", isDebugEnabled) - - try{ - // Get Variables - - String cloudConfiguration = execution.getVariable("cloudConfiguration") - utils.log("DEBUG", "Cloud Configuration: " + cloudConfiguration, isDebugEnabled) - - String requestId = execution.getVariable("msoRequestId") - execution.setVariable("requestId", requestId) - execution.setVariable("mso-request-id", requestId) - utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - - String vnfId = execution.getVariable("vnfId") - utils.log("DEBUG", "Incoming Vnf Id is: " + vnfId, isDebugEnabled) - - String source = "VID" - execution.setVariable("DDVAM_source", source) - utils.log("DEBUG", "Incoming Source is: " + source, isDebugEnabled) - - execution.setVariable("DDVAM_isVidRequest", "true") - - String sdncVersion = execution.getVariable("sdncVersion") - if (sdncVersion == null) { - sdncVersion = "1702" - } - execution.setVariable("DDVAM_sdncVersion", sdncVersion) - utils.log("DEBUG", "Incoming Sdnc Version is: " + sdncVersion, isDebugEnabled) - - // Set aLaCarte flag to false - execution.setVariable("aLaCarte", false) - - String sdncCallbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { - def msg = 'Required variable \'URN_mso_workflow_sdncadapter_callback\' is missing' - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - utils.logAudit("SDNC Callback URL: " + sdncCallbackUrl) - logDebug("SDNC Callback URL is: " + sdncCallbackUrl, isDebugEnabled) - - - if (!sdncVersion.equals("1702")) { - //String vnfModelInfo = execution.getVariable("vnfModelInfo") - //String serviceModelInfo = execution.getVariable("serviceModelInfo") - - String serviceId = execution.getVariable("productFamilyId") - execution.setVariable("DDVAM_serviceId", serviceId) - utils.log("DEBUG", "Incoming Service Id is: " + serviceId, isDebugEnabled) - - - //String modelInvariantId = jsonUtil.getJsonValue(vnfModelInfo, "modelInvariantId") - //execution.setVariable("DDVAM_modelInvariantId", modelInvariantId) - //utils.log("DEBUG", "Incoming Invariant Id is: " + modelInvariantId, isDebugEnabled) - - //String modelVersionId = jsonUtil.getJsonValue(vnfModelInfo, "modelVersionId") - //if (modelVersionId == null) { - // modelVersionId = "" - //} - //execution.setVariable("DDVAM_modelVersionId", modelVersionId) - //utils.log("DEBUG", "Incoming Version Id is: " + modelVersionId, isDebugEnabled) - - //String modelVersion = jsonUtil.getJsonValue(vnfModelInfo, "modelVersion") - //execution.setVariable("DDVAM_modelVersion", modelVersion) - //utils.log("DEBUG", "Incoming Model Version is: " + modelVersion, isDebugEnabled) - - //String modelName = jsonUtil.getJsonValue(vnfModelInfo, "modelName") - //execution.setVariable("DDVAM_modelName", modelName) - //utils.log("DEBUG", "Incoming Model Name is: " + modelName, isDebugEnabled) - - //String modelCustomizationId = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationId") - //if (modelCustomizationId == null) { - // modelCustomizationId = "" - //} - //execution.setVariable("DDVAM_modelCustomizationId", modelCustomizationId) - //utils.log("DEBUG", "Incoming Model Customization Id is: " + modelCustomizationId, isDebugEnabled) - - String cloudSiteId = execution.getVariable("lcpCloudRegionId") - execution.setVariable("DDVAM_cloudSiteId", cloudSiteId) - utils.log("DEBUG", "Incoming Cloud Site Id is: " + cloudSiteId, isDebugEnabled) - - String tenantId = execution.getVariable("tenantId") - execution.setVariable("DDVAM_tenantId", tenantId) - utils.log("DEBUG", "Incoming Tenant Id is: " + tenantId, isDebugEnabled) - - String globalSubscriberId = execution.getVariable("globalSubscriberId") - if (globalSubscriberId == null) { - globalSubscriberId = "" - } - execution.setVariable("DDVAM_globalSubscriberId", globalSubscriberId) - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - - } - execution.setVariable("DDVAM_vfModulesFromDecomposition", null) - // Retrieve serviceDecomposition if present - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - if (serviceDecomposition != null) { - utils.log("DEBUG", "Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString(), isDebugEnabled) - List vnfs = serviceDecomposition.getServiceVnfs() - utils.log("DEBUG", "Read vnfs", isDebugEnabled) - if (vnfs == null) { - utils.log("DEBUG", "Error - vnfs are empty in serviceDecomposition object", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in preProcessRequest - vnfs are empty") - } - VnfResource vnf = vnfs[0] - - if (vnf == null) { - utils.log("DEBUG", "Error - vnf is empty in serviceDecomposition object", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in preProcessRequest - vnf is empty") - } - - List vfModules = vnf.getAllVfModuleObjects() - - execution.setVariable("DDVAM_vfModulesFromDecomposition", vfModules) - } - - execution.setVariable("DDVAM_moduleCount", 0) - execution.setVariable("DDVAM_nextModule", 0) - - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", " Error Occured in DoCreateVnfAndModules PreProcessRequest method!" + e.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest") - - } - utils.log("DEBUG", "*** COMPLETED DoDeleteVnfAndModules PreProcessRequest Process ***", isDebugEnabled) - } - - - - public void preProcessAddOnModule(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessAddOnModule ======== ", isDebugLogEnabled) - - try { - JSONArray addOnModules = (JSONArray) execution.getVariable("addOnModules") - int addOnIndex = (int) execution.getVariable("addOnModulesDeployed") - - JSONObject addOnModule = addOnModules[addOnIndex] - - def newVfModuleId = UUID.randomUUID().toString() - execution.setVariable("addOnVfModuleId", newVfModuleId) - - execution.setVariable("instancesOfThisModelDeployed", 0) - - JSONObject addOnVfModuleModelInfoObject = jsonUtil.getJsonValueForKey(addOnModule, "modelInfo") - String addOnVfModuleModelInfo = addOnVfModuleModelInfoObject.toString() - execution.setVariable("addOnVfModuleModelInfo", addOnVfModuleModelInfo) - String addOnVfModuleLabel = jsonUtil.getJsonValueForKey(addOnModule, "vfModuleLabel") - execution.setVariable("addOnVfModuleLabel", addOnVfModuleLabel) - String addOnPersonaModelId = jsonUtil.getJsonValueForKey(addOnVfModuleModelInfoObject, "modelInvariantUuid") - execution.setVariable("addOnPersonaModelId", addOnPersonaModelId) - String addOnInitialCount = jsonUtil.getJsonValueForKey(addOnModule, "initialCount") - execution.setVariable("initialCount", addOnInitialCount) - - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) - } - - /** - * Using the received vnfId and vfModuleId, query AAI to get the corresponding VNF info. - * A 200 response is expected with the VNF info in the response body. Will find out the base module info. - * - * @param execution The flow's execution instance. - */ - public void queryAAIVfModule(DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - def method = getClass().getSimpleName() + '.queryAAIVfModule(' + - 'execution=' + execution.getId() + - ')' - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def vnfId = execution.getVariable('vnfId') - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - - String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" - utils.logAudit("AAI endPoint: " + endPoint) - - try { - utils.logAudit("createVfModule - invoking httpGet() to AAI") - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint) - - def responseData = response.getResponseBodyAsString() - if (responseData != null) { - logDebug("Received generic VNF data: " + responseData, isDebugLogEnabled) - - } - - utils.logAudit("createVfModule - queryAAIVfModule Response: " + responseData) - utils.logAudit("createVfModule - queryAAIVfModule ResponseCode: " + response.getStatusCode()) - - execution.setVariable('DCVFM_queryAAIVfModuleResponseCode', response.getStatusCode()) - execution.setVariable('DCVFM_queryAAIVfModuleResponse', responseData) - logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) - logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) - //Map[] vfModules = new HashMap[] - List vfModulesFromDecomposition = execution.getVariable("DDVAM_vfModulesFromDecomposition") - def vfModulesList = new ArrayList>() - def vfModules = null - def vfModuleBaseEntry = null - if (response.getStatusCode() == 200) { - // Parse the VNF record from A&AI to find base module info - logDebug('Parsing the VNF data to find base module info', isDebugLogEnabled) - if (responseData != null) { - def vfModulesText = utils.getNodeXml(responseData, "vf-modules") - logDebug("vModulesText: " + vfModulesText, isDebugLogEnabled) - if (vfModulesText != null && !vfModulesText.trim().isEmpty()) { - def xmlVfModules= new XmlSlurper().parseText(vfModulesText) - vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} - execution.setVariable("DDVAM_moduleCount", vfModules.size()) - int vfModulesSize = 0 - ModelInfo vfModuleModelInfo = null - for (i in 0..vfModules.size()-1) { - def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i]) - - Map vfModuleEntry = new HashMap() - def vfModuleId = utils.getNodeText1(vfModuleXml, "vf-module-id") - vfModuleEntry.put("vfModuleId", vfModuleId) - def vfModuleName = utils.getNodeText1(vfModuleXml, "vf-module-name") - vfModuleEntry.put("vfModuleName", vfModuleName) - - // Find the model for this vf module in decomposition if specified - if (vfModulesFromDecomposition != null) { - logDebug("vfModulesFromDecomposition is not null", isDebugLogEnabled) - def vfModuleUuid = utils.getNodeText1(vfModuleXml, "model-version-id") - if (vfModuleUuid == null) { - vfModuleUuid = utils.getNodeText1(vfModuleXml, "persona-model-version") - } - logDebug("vfModule UUID is: " + vfModuleUuid, isDebugLogEnabled) - for (j in 0..vfModulesFromDecomposition.size()-1) { - ModuleResource mr = vfModulesFromDecomposition[j] - if (mr.getModelInfo().getModelUuid() == vfModuleUuid) { - logDebug("Found modelInfo", isDebugLogEnabled) - vfModuleModelInfo = mr.getModelInfo() - break - } - - } - } - if (vfModuleModelInfo != null) { - String vfModuleModelInfoString = vfModuleModelInfo.toString() - def vfModuleModelInfoValue = jsonUtil.getJsonValue(vfModuleModelInfoString, "modelInfo") - vfModuleEntry.put("vfModuleModelInfo", vfModuleModelInfoValue) - } - else { - vfModuleEntry.put("vfModuleModelInfo", null) - } - - - def isBaseVfModule = utils.getNodeText(vfModuleXml, "is-base-vf-module") - // Save base vf module for last - if (isBaseVfModule == "true") { - vfModuleBaseEntry = vfModuleEntry - } - else { - vfModulesList.add(vfModuleEntry) - } - } - if (vfModuleBaseEntry != null) { - vfModulesList.add(vfModuleBaseEntry) - } - } - - } - } - execution.setVariable("DDVAM_vfModules", vfModulesList) - } catch (Exception ex) { - ex.printStackTrace() - logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) - } - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) - } - } - - public void prepareNextModuleToDelete(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED prepareNextModuleToDelete ======== ", isDebugLogEnabled) - - try { - int i = execution.getVariable("DDVAM_nextModule") - def vfModules = execution.getVariable("DDVAM_vfModules") - def vfModule = vfModules[i] - - def vfModuleId = vfModule.get("vfModuleId") - execution.setVariable("DDVAM_vfModuleId", vfModuleId) - - def vfModuleName = vfModule.get("vfModuleName") - execution.setVariable("DDVAM_vfModuleName", vfModuleName) - - def vfModuleModelInfo = vfModule.get("vfModuleModelInfo") - logDebug("vfModuleModelInfo for module delete: " + vfModuleModelInfo, isDebugLogEnabled) - execution.setVariable("DDVAM_vfModuleModelInfo", vfModuleModelInfo) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToDelete Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED prepareNextModuleToDelete ======== ", isDebugLogEnabled) - } - - public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled) - def vnfId = execution.getVariable("vnfId") - def serviceInstanceId = execution.getVariable("serviceInstanceId") - - try{ - //Build SDNC Request - - String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate") - - deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest) - execution.setVariable("DDVAM_deactivateSDNCRequest", deactivateSDNCRequest) - logDebug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest, isDebugLogEnabled) - utils.logAudit("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled) - } - - public void preProcessSDNCUnassignRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED preProcessSDNCUnassignRequest Process ======== ", isDebugLogEnabled) - try{ - String vnfId = execution.getVariable("vnfId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign") - - execution.setVariable("DDVAM_unassignSDNCRequest", unassignSDNCRequest) - logDebug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest, isDebugLogEnabled) - utils.logAudit("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) - - }catch(Exception e){ - log.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED preProcessSDNCUnassignRequest Process ======== ", isDebugLogEnabled) - } - - public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ - - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis() - } - def callbackURL = execution.getVariable("sdncCallbackUrl") - def requestId = execution.getVariable("msoRequestId") - def serviceId = execution.getVariable("DDVAM_serviceId") - def tenantId = execution.getVariable("DDVAM_tenantId") - def source = execution.getVariable("DDVAM_source") - def vnfId = execution.getVariable("vnfId") - def serviceInstanceId = execution.getVariable("serviceInstanceId") - def cloudSiteId = execution.getVariable("DDVAM_cloudSiteId") - def modelCustomizationId = execution.getVariable("DDVAM_modelCustomizationId") - //def serviceModelInfo = execution.getVariable("serviceModelInfo") - //def vnfModelInfo = execution.getVariable("vnfModelInfo") - //String serviceEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(serviceModelInfo) - //String vnfEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(vnfModelInfo) - def globalSubscriberId = execution.getVariable("DDVAM_globalSubscriberId") - def sdncVersion = execution.getVariable("DDVAM_sdncVersion") - - String sdncRequest = - """ - - ${uuid} - ${svcInstId} - ${action} - vnf-topology-operation - ${callbackURL} - generic-resource - - - - ${requestId} - DeleteVnfInstance - ${source} - - - - - - - - ${serviceInstanceId} - - - - ${vnfId} - - - - - ${tenantId} - ${cloudSiteId} - - - """ - - utils.logAudit("sdncRequest: " + sdncRequest) - return sdncRequest - } - - public void validateSDNCResponse(DelegateExecution execution, String response, String method){ - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled) - - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - utils.logAudit("workflowException: " + workflowException) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - utils.logAudit("SDNCResponse: " + response) - - String sdncResponse = response - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - logDebug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse, isDebugLogEnabled) - }else{ - logDebug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) - throw new BpmnError("MSOWorkflowException") - } - logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled) - } - - - - - - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy deleted file mode 100644 index b45a52b352..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy +++ /dev/null @@ -1,138 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC All rights reserved. * - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure.scripts - -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONArray; -import static org.apache.commons.lang3.StringUtils.*; -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution -import org.json.JSONObject; -import org.springframework.web.util.UriUtils; - -/** - * This groovy class supports the DoScaleServiceInstance.bpmn process. - * - */ -public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor { - - String Prefix = "DCRESI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - String msg = "" - utils.log("DEBUG", " ***** preProcessRequest *****", isDebugEnabled) - - try { - String requestId = execution.getVariable("msoRequestId") - execution.setVariable("prefix", Prefix) - - //Inputs - String globalSubscriberId = execution.getVariable("globalSubscriberId") - - String serviceType = execution.getVariable("serviceType") - String serviceInstanceName = execution.getVariable("serviceInstanceName") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - execution.setVariable("serviceType", serviceType) - - String resourceTemplateUUIDs = "" - String scaleNsRequest = execution.getVariable("bpmnRequest") - JSONObject jsonObject = new JSONObject(scaleNsRequest).getJSONObject("service") - JSONArray jsonArray = jsonObject.getJSONArray("resources") - - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject reqBodyJsonObj = jsonArray.getJSONObject(i) - String nsInstanceId = reqBodyJsonObj.getString("resourceInstanceId") - resourceTemplateUUIDs = resourceTemplateUUIDs + nsInstanceId + ":" - } - - execution.setVariable("resourceTemplateUUIDs", resourceTemplateUUIDs) - - if (serviceInstanceName == null) { - execution.setVariable("serviceInstanceName", "") - } - if (isBlank(serviceInstanceId)) { - msg = "Input serviceInstanceId is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG", " ***** Exit preProcessRequest *****", isDebugEnabled) - } - - - public void preInitResourcesOperStatus(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) - try{ - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String operationType = "SCALE" - - // resourceTemplateUUIDs should be created ?? - String resourceTemplateUUIDs = execution.getVariable("resourceTemplateUUIDs") - utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled) - serviceId = UriUtils.encode(serviceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceId) - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", operationType) - - execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - - String payload = - """ - - - - ${serviceId} - ${operationId} - ${operationType} - ${resourceTemplateUUIDs} - - - """ - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_initResOperStatusRequest", payload) - utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled) - utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled) - execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) - } - utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy deleted file mode 100644 index c1ffc5abef..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy +++ /dev/null @@ -1,328 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure.scripts - -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONArray -import org.json.JSONObject; - -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.json.JsonUtils - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution -import org.codehaus.jackson.map.ObjectMapper - -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.rest.APIResponse; - -import org.openecomp.mso.bpmn.infrastructure.vfcmodel.ScaleResource -import org.openecomp.mso.bpmn.infrastructure.vfcmodel.ScaleNsByStepsData -import org.openecomp.mso.bpmn.infrastructure.vfcmodel.ScaleNsData - -import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NSResourceInputParameter -import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NsOperationKey -import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NsScaleParameters -import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NsParameters -import org.openecomp.mso.bpmn.infrastructure.vfcmodel.LocationConstraint - - -/** - * This groovy class supports the DoScaleVFCNetworkServiceInstance.bpmn process. - * flow for VFC Network Service Scale - */ -public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcessor { - - String host = "http://mso.mso.testlab.openecomp.org:8080" - - String scaleUrl = "/vfc/rest/v1/vfcadapter/ns/{nsInstanceId}/scale" - - String queryJobUrl = "/vfc/rest/v1/vfcadapter/jobs/{jobId}" - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - JsonUtils jsonUtil = new JsonUtils() - - /** - * Pre Process the BPMN Flow Request - * Inclouds: - * generate the nsOperationKey - * generate the nsParameters - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled) - - List nsRIPList = convertScaleNsReq2NSResInputParamList(execution) - String requestJsonStr = "" - int size = nsRIPList.size() - for (int i = 0; i < size; i++) { - NSResourceInputParameter nsRIP = nsRIPList.get(i) - - if (i == size - 1) { - requestJsonStr += objectToJsonStr(nsRIP) - } else { - requestJsonStr += objectToJsonStr(nsRIP) + "|" - } - } - - execution.setVariable("reqBody", requestJsonStr) - - utils.log("DEBUG", " ***** Exit preProcessRequest *****", isDebugEnabled) - } - - /** - * scale NS task - */ - public void scaleNetworkService(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - String saleNsRequest = execution.getVariable("reqBody") - String[] nsReqStr = saleNsRequest.split("\\|") - - for (int i = 0; i < nsReqStr.length; i++) { - JSONObject reqBodyJsonObj = new JSONObject(nsReqStr[i]) - String nsInstanceId = reqBodyJsonObj.getJSONObject("nsScaleParameters").getString("nsInstanceId") - String nodeTemplateUUID = reqBodyJsonObj.getJSONObject("nsOperationKey").getString("nodeTemplateUUID") - reqBodyJsonObj.getJSONObject("nsScaleParameters").remove("nsInstanceId") - String reqBody = reqBodyJsonObj.toString() - - String url = host + scaleUrl.replaceAll("\\{nsInstanceId\\}", nsInstanceId) - - APIResponse apiResponse = postRequest(execution, url, reqBody) - - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() - String jobId = "" - if (returnCode == "200" || returnCode == "202") { - jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") - } - utils.log("INFO", "scaleNetworkService get a ns scale job Id:" + jobId, isDebugEnabled) - execution.setVariable("jobId", jobId) - execution.setVariable("nodeTemplateUUID", nodeTemplateUUID) - - String isScaleFinished = "" - - if(jobId =="" || jobId == null){ - continue - } - // query the requested network service scale status, if finished, then start the next one, otherwise, wait - while (isScaleFinished != "finished" && isScaleFinished != "error"){ - timeDelay() - queryNSProgress(execution) - isScaleFinished = execution.getVariable("operationStatus") - } - } - } - - /** - * query NS task - */ - private void queryNSProgress(DelegateExecution execution) { - String jobId = execution.getVariable("jobId") - String url = host + queryJobUrl.replaceAll("\\{jobId\\}", jobId) - - NsOperationKey nsOperationKey = new NsOperationKey() - // is this net work service ID or E2E service ID? - nsOperationKey.setServiceId(execution.getVariable("serviceId")) - nsOperationKey.setServiceType(execution.getVariable("serviceType")) - nsOperationKey.setGlobalSubscriberId(execution.getVariable("globalSubscriberId")) - nsOperationKey.setNodeTemplateUUID(execution.getVariable("nodeTemplateUUID")) - nsOperationKey.setOperationId(execution.getVariable("operationId")) - String queryReqBody = objectToJsonStr(nsOperationKey) - - APIResponse apiResponse = postRequest(execution,url, queryReqBody) - - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() - - String operationStatus = "error" - - if (returnCode == "200") { - operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status") - } - - execution.setVariable("operationStatus", operationStatus) - } - - /** - * delay 5 sec - * - */ - private void timeDelay() { - try { - Thread.sleep(5000) - } catch (InterruptedException e) { - taskProcessor.utils.log("ERROR", "Time Delay exception" + e, isDebugEnabled) - } - } - - /** - * finish NS task - */ - public void finishNSScale(DelegateExecution execution) { - //no need to do anything util now - System.out.println("Scale finished.") - } - - /** - * post request - * url: the url of the request - * requestBody: the body of the request - */ - private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started Execute VFC adapter Post Process *****", isDebugEnabled) - utils.log("INFO","url:"+url +"\nrequestBody:"+ requestBody, isDebugEnabled) - APIResponse apiResponse = null - try{ - RESTConfig config = new RESTConfig(url) - RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk") -// RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk") - apiResponse = client.httpPost(requestBody) - utils.log("INFO","response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString(), isDebugEnabled) - utils.log("INFO","======== Completed Execute VF-C adapter Post Process ======== ", isDebugEnabled) - }catch(Exception e){ - utils.log("ERROR","Exception occured while executing VFC Post Call. Exception is: \n" + e, isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - return apiResponse - } - - /** - * create a Scale Resource object list from a NSScaleRequestJso nString - * This method is for the specific request from Scale Network Service BPMN workflow - * @param nsScaleRequestJsonString , a specific request Json string which conform to ?? class - * @return List < ScaleResource > - */ - private List jsonGetNsResourceList(String nsScaleRequestJsonString) { - List list = new ArrayList() - JSONObject jsonObject = new JSONObject(nsScaleRequestJsonString) - - JSONObject jsonResource = jsonObject.getJSONObject("service") - JSONArray arr = jsonResource.getJSONArray("resources") - - for (int i = 0; i < arr.length(); i++) { - JSONObject tempResource = arr.getJSONObject(i) - ScaleResource resource = new ScaleResource() - resource.setResourceInstanceId(tempResource.getString("resourceInstanceId")) - resource.setScaleType(tempResource.getString("scaleType")) - - JSONObject jsonScaleNsData = tempResource.getJSONObject("scaleNsData") - JSONObject jsonScaleNsByStepData = jsonScaleNsData.getJSONObject("scaleNsByStepsData") - - ScaleNsData scaleNsData = new ScaleNsData() - ScaleNsByStepsData stepsData = new ScaleNsByStepsData() - - stepsData.setAspectId(jsonScaleNsByStepData.getString("aspectId")) - stepsData.setScalingDirection(jsonScaleNsByStepData.getString("scalingDirection")) - stepsData.setNumberOfSteps(Integer.parseInt(jsonScaleNsByStepData.getString("numberOfSteps"))) - - scaleNsData.setScaleNsByStepsData(stepsData) - resource.setScaleNsData(scaleNsData) - list.add(resource) - } - - return list - } - - /** - * Convert a java class to JSON string - * @param obj - * @return - */ - private String objectToJsonStr(Object obj) { - ObjectMapper mapper = new ObjectMapper() - String jsonStr = null - try { - jsonStr = mapper.writeValueAsString(obj) - } catch (IOException ioe) { - System.out.println(ioe.getMessage()) - } - return jsonStr - - } - - /** - * create a NSResourceInputParameter list from a Scale Network request Json string - * @return - */ - private List convertScaleNsReq2NSResInputParamList(DelegateExecution execution) { - String saleNsRequest = execution.getVariable("bpmnRequest") - - //String requestId = execution.getVariable("msoRequestId") - //String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceInstanceName = execution.getVariable("serviceInstanceName") - //String nodeTemplateUUID = execution.getVariable("nodeTemplateUUID") - String serviceType = execution.getVariable("serviceType") - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String operationId = execution.getVariable("operationId") - String serviceId = execution.getVariable("serviceId") - String nsServiceDescription = execution.getVariable("requestDescription") - - String resource = JsonUtils.getJsonValue(saleNsRequest, "service.resources") - - // set nsScaleParameters properties - List scaleResourcesList = jsonGetNsResourceList(saleNsRequest) - List nsResourceInputParameterList = new ArrayList() - - for (ScaleResource sr : scaleResourcesList) { - NSResourceInputParameter nsResourceInputParameter = new NSResourceInputParameter() - NsOperationKey nsOperationKey = new NsOperationKey() - NsParameters nsParameters = new NsParameters() - NsScaleParameters nsScaleParameters = new NsScaleParameters() - nsParameters.setLocationConstraints(new ArrayList()) - nsParameters.setAdditionalParamForNs(new HashMap()) - - // set NsOperationKey properties - nsOperationKey.setGlobalSubscriberId(globalSubscriberId) - nsOperationKey.setServiceId(serviceId) - nsOperationKey.setServiceType(serviceType) - // for ns scale the resourceInstanceId is the nodeTemplateUUID - nsOperationKey.setNodeTemplateUUID(sr.getResourceInstanceId()) - nsOperationKey.setOperationId(operationId) - - nsScaleParameters.setScaleType(sr.getScaleType()) - nsScaleParameters.setNsInstanceId(sr.getResourceInstanceId()) - - ScaleNsByStepsData scaleNsByStepsData = new ScaleNsByStepsData() - scaleNsByStepsData.setScalingDirection(sr.getScaleNsData().getScaleNsByStepsData().getScalingDirection()) - scaleNsByStepsData.setNumberOfSteps(sr.getScaleNsData().getScaleNsByStepsData().getNumberOfSteps()) - scaleNsByStepsData.setAspectId(sr.getScaleNsData().getScaleNsByStepsData().getAspectId()) - - List scaleNsByStepsDataList = new ArrayList() - scaleNsByStepsDataList.add(scaleNsByStepsData) - nsScaleParameters.setScaleNsByStepsData(scaleNsByStepsDataList) - - nsResourceInputParameter.setNsOperationKey(nsOperationKey) - nsResourceInputParameter.setNsServiceName(serviceInstanceName) - nsResourceInputParameter.setNsServiceDescription(nsServiceDescription) - nsResourceInputParameter.setNsParameters(nsParameters) - nsResourceInputParameter.setNsScaleParameters(nsScaleParameters) - - nsResourceInputParameterList.add(nsResourceInputParameter) - } - return nsResourceInputParameterList - } -} - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy deleted file mode 100644 index 74c991e637..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy +++ /dev/null @@ -1,465 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.infrastructure.scripts; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* -import groovy.util.XmlParser - -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.ServiceInstance -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.Resource -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.UUID; -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.json.JSONArray; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; - - -/** - * This groovy class supports the DoUpdateE2EServiceInstance.bpmn process. - * - * Inputs: - * @param - msoRequestId - * @param - globalSubscriberId - * @param - serviceType - * @param - serviceInstanceId - * @param - serviceInstanceName - * @param - serviceModelInfo - * @param - productFamilyId - * @param - uuiRequest - * @param - serviceDecomposition_Target - * @param - serviceDecomposition_Original - * @param - addResourceList - * @param - delResourceList - * - * Outputs: - * @param - rollbackData (localRB->null) - * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) - * @param - WorkflowException - */ -public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { - - String Prefix="DUPDSI_" - private static final String DebugFlag = "isDebugEnabled" - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Enter DoUpdateE2EServiceInstance preProcessRequest *****", isDebugEnabled) - - String msg = "" - - try { - execution.setVariable("prefix", Prefix) - //Inputs - //for AAI GET & PUT & SDNC assignToplology - String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId - utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled) - - //for AAI PUT & SDNC assignTopology - String serviceType = execution.getVariable("serviceType") - utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled) - - //for SDNC assignTopology - String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId - - if (isBlank(globalSubscriberId)) { - msg = "Input globalSubscriberId is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - if (isBlank(serviceType)) { - msg = "Input serviceType is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - //Generated in parent for AAI - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)){ - msg = "Input serviceInstanceId is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - String serviceInstanceName = execution.getVariable("serviceInstanceName") - - // user params - String uuiRequest = execution.getVariable("uuiRequest") - - // target model Invariant uuid - String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") - execution.setVariable("modelInvariantUuid", modelInvariantUuid) - utils.log("INFO", "modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled) - - // target model uuid - String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") - execution.setVariable("modelUuid", modelUuid) - utils.log("INFO", "modelUuid: " + modelUuid, isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO", "======== COMPLETED preProcessRequest Process ======== ", isDebugEnabled) - } - - - public void preInitResourcesOperStatus(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - - utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) - try{ - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String operationType = execution.getVariable("operationType") - String resourceTemplateUUIDs = "" - String result = "processing" - String progress = "0" - String reason = "" - String operationContent = "Prepare service updating" - utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled) - serviceId = UriUtils.encode(serviceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceId) - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", operationType) - - List resourceList = new ArrayList() - List addResourceList = execution.getVariable("addResourceList") - List delResourceList = execution.getVariable("delResourceList") - resourceList.addAll(addResourceList) - resourceList.addAll(delResourceList) - for(Resource resource : resourceList){ - resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" - } - - def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) - - String payload = - """ - - - - ${serviceId} - ${operationId} - ${operationType} - ${resourceTemplateUUIDs} - - - """ - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_initResOperStatusRequest", payload) - utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled) - utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled) - execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) - } - utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) - } - - - public void preProcessForAddResource(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** preProcessForAddResource ***** ", isDebugEnabled) - - execution.setVariable("operationType", "create") - - execution.setVariable("hasResourcetoAdd", false) - List addResourceList = execution.getVariable("addResourceList") - if(addResourceList != null && !addResourceList.isEmpty()) { - execution.setVariable("hasResourcetoAdd", true) - } - - utils.log("INFO"," *** Exit preProcessForAddResource *** ", isDebugEnabled) - } - - public void postProcessForAddResource(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessForAddResource ***** ", isDebugEnabled) - - execution.setVariable("operationType", "update") - - utils.log("INFO"," *** Exit postProcessForAddResource *** ", isDebugEnabled) - } - - public void preProcessForDeleteResource(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** preProcessForDeleteResource ***** ", isDebugEnabled) - - execution.setVariable("operationType", "delete") - - def hasResourcetoDelete = false - List delResourceList = execution.getVariable("delResourceList") - if(delResourceList != null && !delResourceList.isEmpty()) { - hasResourcetoDelete = true - } - execution.setVariable("hasResourcetoDelete", hasResourcetoDelete) - - if(hasResourcetoDelete) { - def jsonSlurper = new JsonSlurper() - String serviceRelationShip = execution.getVariable("serviceRelationShip") - List relationShipList = jsonSlurper.parseText(serviceRelationShip) - - //Set the real resource instance id to the decomosed resource list - for(Resource resource: delResourceList){ - //reset the resource instance id , because in the decompose flow ,its a random one. - resource.setResourceId(""); - //match the resource-instance-name and the model name - if (relationShipList != null) { - relationShipList.each { - if(StringUtils.containsIgnoreCase(it.resourceType, resource.getModelInfo().getModelName())){ - resource.setResourceId(it.resourceInstanceId); - } - } - } - } - } - - execution.setVariable("deleteResourceList", delResourceList) - - utils.log("INFO"," *** Exit preProcessForDeleteResource *** ", isDebugEnabled) - } - - public void postProcessForDeleteResource(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessForDeleteResource ***** ", isDebugEnabled) - - execution.setVariable("operationType", "update") - - utils.log("INFO"," *** Exit postProcessForDeleteResource *** ", isDebugEnabled) - } - - public void preProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - } - - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) - String msg = "" - - try { - String serviceInstanceName = execution.getVariable("serviceInstanceName") - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI in postProcessAAIGET", + serviceInstanceName, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - else - { - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI){ - String aaiService = execution.getVariable("GENGS_service") - if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "resource-version"))) { - execution.setVariable("serviceInstanceVersion", utils.getNodeText1(aaiService, "resource-version")) - utils.log("INFO","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled) - } - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoUpdateE2EServiceInstance.postProcessAAIGET " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) - } - - public void preProcessAAIPUT(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - String msg = "" - utils.log("INFO"," ***** preProcessAAIPUT *****", isDebugEnabled) - - - String serviceInstanceVersion = execution.getVariable("serviceInstanceVersion") - //execution.setVariable("GENPS_serviceResourceVersion", serviceInstanceVersion) - - //requestDetails.modelInfo.for AAI PUT servieInstanceData - //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData - String serviceInstanceName = execution.getVariable("serviceInstanceName") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - //aai serviceType and Role can be setted as fixed value now. - String aaiServiceType = "E2E Service" - String aaiServiceRole = "E2E Service" - String modelInvariantUuid = execution.getVariable("modelInvariantUuid") - String modelUuid = execution.getVariable("modelUuid") - - - AaiUtil aaiUriUtil = new AaiUtil(this) - utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled) - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled) - String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) - utils.log("INFO","namespace: " + namespace, isDebugEnabled) - - //update target model to aai - String serviceInstanceData = - """ - ${serviceInstanceId} - ${serviceInstanceName} - ${aaiServiceType} - ${aaiServiceRole} - ${serviceInstanceVersion} - ${modelInvariantUuid} - ${modelUuid} - """.trim() - - execution.setVariable("serviceInstanceData", serviceInstanceData) - utils.log("INFO","serviceInstanceData: " + serviceInstanceData, isDebugEnabled) - utils.logAudit(serviceInstanceData) - utils.log("INFO", " aai_uri " + aai_uri + " namespace:" + namespace, isDebugEnabled) - utils.log("INFO", " 'payload' to update Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled) - - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - - public void postProcessAAIPUT(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIPUT ***** ", isDebugEnabled) - String msg = "" - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - } - else - { - //start rollback set up - RollbackData rollbackData = new RollbackData() - def disableRollback = execution.getVariable("disableRollback") - rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) - rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") - rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId) - rollbackData.put("SERVICEINSTANCE", "serviceType", execution.getVariable("serviceType")) - rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) - execution.setVariable("rollbackData", rollbackData) - } - - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," *** Exit postProcessAAIPUT *** ", isDebugEnabled) - } - - public void preProcessRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** preProcessRollback ***** ", isDebugEnabled) - try { - - Object workflowException = execution.getVariable("WorkflowException"); - - if (workflowException instanceof WorkflowException) { - utils.log("INFO", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) - execution.setVariable("prevWorkflowException", workflowException); - //execution.setVariable("WorkflowException", null); - } - } catch (BpmnError e) { - utils.log("INFO", "BPMN Error during preProcessRollback", isDebugEnabled) - } catch(Exception ex) { - String msg = "Exception in preProcessRollback. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - } - utils.log("INFO"," *** Exit preProcessRollback *** ", isDebugEnabled) - } - - public void postProcessRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessRollback ***** ", isDebugEnabled) - String msg = "" - try { - Object workflowException = execution.getVariable("prevWorkflowException"); - if (workflowException instanceof WorkflowException) { - utils.log("INFO", "Setting prevException to WorkflowException: ", isDebugEnabled) - execution.setVariable("WorkflowException", workflowException); - } - execution.setVariable("rollbackData", null) - } catch (BpmnError b) { - utils.log("INFO", "BPMN Error during postProcessRollback", isDebugEnabled) - throw b; - } catch(Exception ex) { - msg = "Exception in postProcessRollback. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - } - utils.log("INFO"," *** Exit postProcessRollback *** ", isDebugEnabled) - } - - - public void postConfigRequest(execution){ - //now do noting - } - - -} - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy deleted file mode 100644 index a55ca0225a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy +++ /dev/null @@ -1,368 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.infrastructure.scripts - - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; -/** - * This groovy class supports the DoUpdateE2EServiceInstanceRollback.bpmn process. - * - * Inputs: - * @param - msoRequestId - * @param - rollbackData with - * globalCustomerId - * subscriptionServiceType - * serviceInstanceId - * disableRollback - * rollbackAAI - * rollbackAdded - * rollbackDeleted - * - * - * Outputs: - * @param - rollbackError - * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) - * - */ -public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProcessor{ - - String Prefix="DUPDSIRB_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - String msg = "" - utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) - execution.setVariable("rollbackAAI",false) - execution.setVariable("rollbackAdded",false) - execution.setVariable("rollbackDeleted",false) - - List addResourceList = execution.getVariable("addResourceList") - List delResourceList = execution.getVariable("delResourceList") - execution.setVariable("addResourceList_o", addResourceList) - execution.setVariable("delResourceList_o", delResourceList) - //exchange add and delete resource list - execution.setVariable("addResourceList", delResourceList) - execution.setVariable("delResourceList", addResourceList) - - try { - def rollbackData = execution.getVariable("rollbackData") - utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled) - - if (rollbackData != null) { - if (rollbackData.hasType("SERVICEINSTANCE")) { - - def serviceInstanceId = rollbackData.get("SERVICEINSTANCE", "serviceInstanceId") - execution.setVariable("serviceInstanceId", serviceInstanceId) - - def subscriptionServiceType = rollbackData.get("SERVICEINSTANCE", "subscriptionServiceType") - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - - def globalSubscriberId = rollbackData.get("SERVICEINSTANCE", "globalSubscriberId") - execution.setVariable("globalSubscriberId", globalSubscriberId) - - def rollbackAAI = rollbackData.get("SERVICEINSTANCE", "rollbackAAI") - if ("true".equals(rollbackAAI)) - { - execution.setVariable("rollbackAAI",true) - } - - def rollbackAdded = rollbackData.get("SERVICEINSTANCE", "rollbackAdded") - if ("true".equals(rollbackAdded)) - { - execution.setVariable("rollbackAdded", true) - } - - def rollbackDeleted = rollbackData.get("SERVICEINSTANCE", "rollbackDeleted") - if ("true".equals(rollbackDeleted)) - { - execution.setVariable("rollbackDeleted", true) - } - - if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackAdded") != true - && execution.getVariable("rollbackDeleted") != true) - { - execution.setVariable("skipRollback", true) - } - - } - else { - execution.setVariable("skipRollback", true) - } - } - else { - execution.setVariable("skipRollback", true) - } - if (execution.getVariable("disableRollback").equals("true" )) - { - execution.setVariable("skipRollback", true) - } - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in Update ServiceInstance Rollback preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void postProcessRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** postProcessRequest ***** ", isDebugEnabled) - String msg = "" - try { - execution.setVariable("rollbackData", null) - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean rollbackAAI = execution.getVariable("rollbackAAI") - boolean rollbackAdded = execution.getVariable("rollbackAdded") - boolean rollbackDeleted = execution.getVariable("rollbackDeleted") - - List addResourceList = execution.getVariable("addResourceList_o") - List delResourceList = execution.getVariable("delResourceList_o") - execution.setVariable("addResourceList", addResourceList) - execution.setVariable("delResourceList", delResourceList) - - if (rollbackAAI || rollbackAdded || rollbackDeleted) - { - execution.setVariable("rolledBack", true) - } - if (rollbackAAI) - { - boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator") - if(!succInAAI){ - execution.setVariable("rolledBack", false) //both sdnc and aai must be successful to declare rollback Succesful - execution.setVariable("rollbackError", "Error deleting service-instance in AAI for rollback") - utils.log("DEBUG","Error deleting service-instance in AAI for rollback", + serviceInstanceId, isDebugEnabled) - } - } - utils.log("DEBUG","*** Exit postProcessRequest ***", isDebugEnabled) - - } catch (BpmnError e) { - msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + e.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } catch (Exception ex) { - msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - } - - - public void preProcessForAddResource(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - } - - public void postProcessForAddResource(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - } - - public void preProcessForDeleteResource(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - } - - public void postProcessForDeleteResource(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - } - - public void preProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - } - - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) - String msg = "" - - try { - String serviceInstanceName = execution.getVariable("serviceInstanceName") - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI in postProcessAAIGET", + serviceInstanceName, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - else - { - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI){ - String aaiService = execution.getVariable("GENGS_service") - if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "resource-version"))) { - execution.setVariable("serviceInstanceVersion_n", utils.getNodeText1(aaiService, "resource-version")) - utils.log("INFO","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled) - } - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoCreateServiceInstance.postProcessAAIGET " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) - } - - public void preProcessAAIPUT(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - String msg = "" - utils.log("INFO"," ***** preProcessAAIPUT *****", isDebugEnabled) - - String serviceInstanceVersion = execution.getVariable("serviceInstanceVersion_n") -// execution.setVariable("GENPS_serviceResourceVersion", serviceInstanceVersion) - - //requestDetails.modelInfo.for AAI PUT servieInstanceData - //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData - String serviceInstanceName = execution.getVariable("serviceInstanceName") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - //aai serviceType and Role can be setted as fixed value now. - String aaiServiceType = "E2E Service" - String aaiServiceRole = "E2E Service" - String modelInvariantUuid = execution.getVariable("modelInvariantUuid") - String modelUuid = execution.getVariable("model-version-id-original") - - //AAI PUT - AaiUtil aaiUriUtil = new AaiUtil(this) - utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled) - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled) - String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) - utils.log("INFO","namespace: " + namespace, isDebugEnabled) - - String serviceInstanceData = - """ - ${serviceInstanceId} - ${serviceInstanceName} - ${aaiServiceType} - ${aaiServiceRole} - ${serviceInstanceVersion} - ${modelInvariantUuid} - ${modelUuid} - """.trim() - - execution.setVariable("serviceInstanceData", serviceInstanceData) - utils.log("INFO","serviceInstanceData: " + serviceInstanceData, isDebugEnabled) - utils.logAudit(serviceInstanceData) - utils.log("INFO", " aai_uri " + aai_uri + " namespace:" + namespace, isDebugEnabled) - utils.log("INFO", " 'payload' to update Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled) - - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - - public void postProcessAAIPUT(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIPUT ***** ", isDebugEnabled) - String msg = "" - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - } - else - { - - } - - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," *** Exit postProcessAAIPUT *** ", isDebugEnabled) - } - - public void processRollbackException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** processRollbackException ***** ", isDebugEnabled) - try{ - utils.log("DEBUG", "Caught an Exception in DoUpdateE2EServiceInstanceRollback", isDebugEnabled) - execution.setVariable("rollbackData", null) - execution.setVariable("rollbackError", "Caught exception in ServiceInstance Update Rollback") - execution.setVariable("WorkflowException", null) - - }catch(BpmnError b){ - utils.log("DEBUG", "BPMN Error during processRollbackExceptions Method: ", isDebugEnabled) - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processRollbackExceptions Method: " + e.getMessage(), isDebugEnabled) - } - - utils.log("DEBUG", " Exit processRollbackException", isDebugEnabled) - } - - public void processRollbackJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** processRollbackJavaException ***** ", isDebugEnabled) - try{ - execution.setVariable("rollbackData", null) - execution.setVariable("rollbackError", "Caught Java exception in ServiceInstance Update Rollback") - utils.log("DEBUG", "Caught Exception in processRollbackJavaException", isDebugEnabled) - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception in processRollbackJavaException " + e.getMessage(), isDebugEnabled) - } - utils.log("DEBUG", "***** Exit processRollbackJavaException *****", isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy deleted file mode 100644 index 829e4d9d4b..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy +++ /dev/null @@ -1,1403 +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.bpmn.infrastructure.scripts; - -import groovy.xml.XmlUtil -import groovy.json.* -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.NetworkUtils -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils - -/** - * This groovy class supports the DoUpdateNetworkInstance.bpmn process. - * - */ -public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { - String Prefix="UPDNETI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - NetworkUtils networkUtils = new NetworkUtils() - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - - /** - * This method is executed during the preProcessRequest task of the DoUpdateNetworkInstance.bpmn process. - * @param execution - */ - public InitializeProcessVariables(DelegateExecution execution){ - /* Initialize all the process variables in this block */ - - execution.setVariable(Prefix + "messageId", "") - execution.setVariable("BasicAuthHeaderValuePO", "") - execution.setVariable("BasicAuthHeaderValueSDNC", "") - execution.setVariable(Prefix + "networkRequest", "") - execution.setVariable(Prefix + "networkInputs", "") - execution.setVariable(Prefix + "networkOutputs", "") - execution.setVariable(Prefix + "requestId", "") - execution.setVariable(Prefix + "source", "") - execution.setVariable(Prefix + "networkId", "") - - execution.setVariable(Prefix + "isPONR", false) // Point-of-no-return, means, rollback is not needed - - // AAI query Cloud Region - execution.setVariable(Prefix + "queryCloudRegionRequest","") - execution.setVariable(Prefix + "queryCloudRegionReturnCode","") - execution.setVariable(Prefix + "queryCloudRegionResponse","") - execution.setVariable(Prefix + "cloudRegionPo","") - execution.setVariable(Prefix + "cloudRegionSdnc","") - execution.setVariable(Prefix + "isCloudRegionGood", false) - - // AAI query Id - execution.setVariable(Prefix + "queryIdAAIRequest","") - execution.setVariable(Prefix + "queryIdAAIResponse", "") - execution.setVariable(Prefix + "aaiIdReturnCode", "") - - // AAI query vpn binding - execution.setVariable(Prefix + "queryVpnBindingAAIRequest","") - execution.setVariable(Prefix + "queryVpnBindingAAIResponse", "") - execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "") - execution.setVariable(Prefix + "vpnBindings", null) - execution.setVariable(Prefix + "vpnCount", 0) - execution.setVariable(Prefix + "routeCollection", "") - - // AAI query network policy - execution.setVariable(Prefix + "queryNetworkPolicyAAIRequest","") - execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", "") - execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "") - execution.setVariable(Prefix + "networkPolicyUriList", null) - execution.setVariable(Prefix + "networkPolicyCount", 0) - execution.setVariable(Prefix + "networkCollection", "") - - // AAI query route table reference - execution.setVariable(Prefix + "queryNetworkTableRefAAIRequest","") - execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", "") - execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "") - execution.setVariable(Prefix + "networkTableRefUriList", null) - execution.setVariable(Prefix + "networkTableRefCount", 0) - execution.setVariable(Prefix + "tableRefCollection", "") - - // AAI requery Id - execution.setVariable(Prefix + "requeryIdAAIRequest","") - execution.setVariable(Prefix + "requeryIdAAIResponse", "") - execution.setVariable(Prefix + "aaiRequeryIdReturnCode", "") - - // AAI update contrail - execution.setVariable(Prefix + "updateContrailAAIUrlRequest","") - execution.setVariable(Prefix + "updateContrailAAIPayloadRequest","") - execution.setVariable(Prefix + "updateContrailAAIResponse", "") - execution.setVariable(Prefix + "aaiUpdateContrailReturnCode", "") - - execution.setVariable(Prefix + "updateNetworkRequest", "") - execution.setVariable(Prefix + "updateNetworkResponse", "") - execution.setVariable(Prefix + "rollbackNetworkRequest", "") - execution.setVariable(Prefix + "networkReturnCode", "") - execution.setVariable(Prefix + "isNetworkRollbackNeeded", false) - - execution.setVariable(Prefix + "changeAssignSDNCRequest", "") - execution.setVariable(Prefix + "changeAssignSDNCResponse", "") - execution.setVariable(Prefix + "rollbackSDNCRequest", "") - execution.setVariable(Prefix + "sdncReturnCode", "") - execution.setVariable(Prefix + "isSdncRollbackNeeded", false) - execution.setVariable(Prefix + "sdncResponseSuccess", false) - - execution.setVariable(Prefix + "isVnfBindingPresent", false) - execution.setVariable(Prefix + "Success", false) - execution.setVariable(Prefix + "serviceInstanceId", "") - - execution.setVariable(Prefix + "isException", false) - - } - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - /** - * This method is executed during the preProcessRequest task of the DoUpdateNetworkInstance.bpmn process. - * @param execution - */ - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest DoUpdateNetworkInstance Request ***** ", isDebugEnabled) - - try { - // initialize flow variables - InitializeProcessVariables(execution) - - // GET Incoming request & validate 3 kinds of format. - execution.setVariable("action", "UPDATE") - String networkRequest = execution.getVariable("bpmnRequest") - if (networkRequest != null) { - if (networkRequest.contains("requestDetails")) { - // JSON format request is sent, create xml - try { - def prettyJson = JsonOutput.prettyPrint(networkRequest.toString()) - utils.log("DEBUG", " Incoming message formatted . . . : " + '\n' + prettyJson, isDebugEnabled) - networkRequest = vidUtils.createXmlNetworkRequestInfra(execution, networkRequest) - - } catch (Exception ex) { - String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - } else { - // XML format request is sent - - } - } else { - // vIPR format request is sent, create xml from individual variables - networkRequest = vidUtils.createXmlNetworkRequestInstance(execution) - } - - networkRequest = utils.formatXml(networkRequest) - utils.logAudit(networkRequest) - execution.setVariable(Prefix + "networkRequest", networkRequest) - utils.log("DEBUG", " network-request - " + '\n' + networkRequest, isDebugEnabled) - - // validate 'disableRollback' (aka, 'suppressRollback') - boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, networkRequest) - execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled) - utils.log("DEBUG", Prefix + "rollbackEnabled - " + rollbackEnabled, isDebugEnabled) - - String networkInputs = utils.getNodeXml(networkRequest, "network-inputs", false).replace("tag0:","").replace(":tag0","") - execution.setVariable(Prefix + "networkInputs", networkInputs) - utils.log("DEBUG", Prefix + "networkInputs - " + '\n' + networkInputs, isDebugEnabled) - - // prepare messageId - String messageId = execution.getVariable(Prefix + "messageId") // for testing - if (messageId == null || messageId == "") { - messageId = UUID.randomUUID() - utils.log("DEBUG", " UPDNETI_messageId, random generated: " + messageId, isDebugEnabled) - } else { - utils.log("DEBUG", " UPDNETI_messageId, pre-assigned: " + messageId, isDebugEnabled) - } - execution.setVariable(Prefix + "messageId", messageId) - - String source = utils.getNodeText1(networkRequest, "source") - execution.setVariable(Prefix + "source", source) - utils.log("DEBUG", Prefix + "source - " + source, isDebugEnabled) - - String networkId = "" - if (utils.nodeExists(networkRequest, "network-id")) { - networkId = utils.getNodeText1(networkRequest, "network-id") - if (networkId == 'null' || networkId == "") { - sendSyncError(execution) - // missing value of networkId - String dataErrorMessage = "Variable 'network-id' value/element is missing." - utils.log("DEBUG", " Invalid Request - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - - String lcpCloudRegion = "" - if (utils.nodeExists(networkRequest, "aic-cloud-region")) { - lcpCloudRegion = utils.getNodeText1(networkRequest, "aic-cloud-region") - if ((lcpCloudRegion == 'null') || (lcpCloudRegion == "")) { - sendSyncError(execution) - String dataErrorMessage = "requestDetails has missing 'aic-cloud-region' value/element." - utils.log("DEBUG", " Invalid Request - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - } - - String serviceInstanceId = "" - if (utils.nodeExists(networkRequest, "service-instance-id")) { - serviceInstanceId = utils.getNodeText1(networkRequest, "service-instance-id") - if ((serviceInstanceId == 'null') || (lcpCloudRegion == "")) { - sendSyncError(execution) - String dataErrorMessage = "Variable 'serviceInstanceId' value/element is missing." - utils.log("DEBUG", " Invalid Request - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - } - - // PO Authorization Info / headers Authorization= - String basicAuthValuePO = execution.getVariable("URN_mso_adapters_po_auth") - utils.log("DEBUG", " Obtained BasicAuth userid password for PO/SDNC adapter: " + basicAuthValuePO, isDebugEnabled) - try { - def encodedString = utils.getBasicAuth(basicAuthValuePO, execution.getVariable("URN_mso_msoKey")) - execution.setVariable("BasicAuthHeaderValuePO",encodedString) - execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) - - } catch (IOException ex) { - String exceptionMessage = "Exception Encountered in DoUpdateNetworkInstance, PreProcessRequest() - " - String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() - utils.log("DEBUG", dataErrorMessage, , isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - // Set variables for Generic Get Sub Flow use - execution.setVariable(Prefix + "serviceInstanceId", serviceInstanceId) - utils.log("DEBUG", Prefix + "serviceInstanceId - " + serviceInstanceId, isDebugEnabled) - - execution.setVariable("GENGS_type", "service-instance") - utils.log("DEBUG", "GENGS_type - " + "service-instance", isDebugEnabled) - utils.log("DEBUG", " Url for SDNC adapter: " + execution.getVariable("URN_mso_adapters_sdnc_endpoint"), isDebugEnabled) - - String sdncVersion = execution.getVariable("sdncVersion") - utils.log("DEBUG", "sdncVersion? : " + sdncVersion, isDebugEnabled) - - // build 'networkOutputs' - networkId = utils.getNodeText1(networkRequest, "network-id") - if ((networkId == null) || (networkId == "null")) { - networkId = "" - } - String networkName = utils.getNodeText1(networkRequest, "network-name") - if ((networkName == null) || (networkName == "null")) { - networkName = "" - } - String networkOutputs = - """ - ${networkId} - ${networkName} - """ - execution.setVariable(Prefix + "networkOutputs", networkOutputs) - utils.log("DEBUG", Prefix + "networkOutputs - " + '\n' + networkOutputs, isDebugEnabled) - execution.setVariable(Prefix + "networkId", networkId) - execution.setVariable(Prefix + "networkName", networkName) - - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex){ - sendSyncError(execution) - // caught exception - String exceptionMessage = "Exception Encountered in DoUpdateNetworkInstance, PreProcessRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - } - - public void callRESTQueryAAICloudRegion (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAICloudRegion of DoUpdateNetworkInstance ***** " , isDebugEnabled) - - try { - String networkInputs = execution.getVariable(Prefix + "networkInputs") - String cloudRegion = utils.getNodeText1(networkInputs, "aic-cloud-region") - cloudRegion = UriUtils.encode(cloudRegion,"UTF-8") - - // Prepare AA&I url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUtil = new AaiUtil(this) - String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) - String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion - utils.logAudit(queryCloudRegionRequest) - execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest) - utils.log("DEBUG", " UPDNETI_queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest, isDebugEnabled) - - String cloudRegionPo = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) - String cloudRegionSdnc = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "SDNC", cloudRegion) - - if ((cloudRegionPo != "ERROR") && (cloudRegionSdnc != "ERROR")) { - execution.setVariable(Prefix + "cloudRegionPo", cloudRegionPo) - execution.setVariable(Prefix + "cloudRegionSdnc", cloudRegionSdnc) - execution.setVariable(Prefix + "isCloudRegionGood", true) - - } else { - String dataErrorMessage = "QueryAAICloudRegion Unsuccessful. Return Code: " + execution.getVariable(Prefix + "queryCloudRegionReturnCode") - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - - utils.log("DEBUG", " is Cloud Region Good: " + execution.getVariable(Prefix + "isCloudRegionGood"), isDebugEnabled) - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - // try error - String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow - callRESTQueryAAICloudRegion() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAINetworkId(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkId of DoUpdateNetworkInstance ***** " , isDebugEnabled) - - try { - // get variables - String networkRequest = execution.getVariable(Prefix + "networkRequest") - String networkId = utils.getNodeText1(networkRequest, "network-id") - networkId = UriUtils.encode(networkId,"UTF-8") - execution.setVariable(Prefix + "networkId", networkId) - - // Prepare AA&I url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String queryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" - utils.logAudit(queryIdAAIRequest) - execution.setVariable(Prefix + "queryIdAAIRequest", queryIdAAIRequest) - utils.log("DEBUG", Prefix + "queryIdAAIRequest - " + "\n" + queryIdAAIRequest, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryIdAAIRequest) - String returnCode = response.getStatusCode() - execution.setVariable(Prefix + "aaiIdReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI Response Code : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable(Prefix + "queryIdAAIResponse", aaiResponseAsString) - utils.log("DEBUG", " QueryAAINetworkId Success REST Response - " + "\n" + aaiResponseAsString, isDebugEnabled) - - } else { - if (returnCode=='404') { - String dataErrorMessage = "Response Error from QueryAAINetworkId is 404 (Not Found)." - utils.log("DEBUG", " AAI Query Failed. " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Response from QueryAAINetworkId - " + returnCode - utils.log("DEBUG", "Unexpected Response from QueryAAINetworkId - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkId() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTReQueryAAINetworkId(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTReQueryAAINetworkId of DoUpdateNetworkInstance ***** " , isDebugEnabled) - - try { - // get variables - String networkRequest = execution.getVariable(Prefix + "networkRequest") - String networkId = utils.getNodeText1(networkRequest, "network-id") - networkId = UriUtils.encode(networkId,"UTF-8") - - // Prepare AA&I url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String requeryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" - utils.logAudit(requeryIdAAIRequest) - execution.setVariable(Prefix + "requeryIdAAIRequest", requeryIdAAIRequest) - utils.log("DEBUG", " UPDNETI_requeryIdAAIRequest - " + "\n" + requeryIdAAIRequest, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, requeryIdAAIRequest) - String returnCode = response.getStatusCode() - execution.setVariable(Prefix + "aaiRequeryIdReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI ReQuery Response Code : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable(Prefix + "requeryIdAAIResponse", aaiResponseAsString) - utils.log("DEBUG", " ReQueryAAINetworkId Success REST Response - " + "\n" + aaiResponseAsString, isDebugEnabled) - - String netId = utils.getNodeText1(aaiResponseAsString, "network-id") - String netName = utils.getNodeText1(aaiResponseAsString, "network-name") - String networkOutputs = - """ - ${netId} - ${netName} - """ - execution.setVariable(Prefix + "networkOutputs", networkOutputs) - utils.log("DEBUG", " networkOutputs - " + '\n' + networkOutputs, isDebugEnabled) - - } else { - if (returnCode=='404') { - String dataErrorMessage = "Response Error from ReQueryAAINetworkId is 404 (Not Found)." - utils.log("DEBUG", " AAI ReQuery Failed. - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Response from ReQueryAAINetworkId - " + returnCode - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTReQueryAAINetworkId() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAINetworkVpnBinding(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkVpnBinding of DoUpdateNetworkInstance ***** " , isDebugEnabled) - - try { - - // get variables - String queryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse").replace('', "") - String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") - utils.log("DEBUG", " relationship - " + relationship, isDebugEnabled) - - // Check if Vnf Binding is present, then build a List of vnfBinding - List vpnBindingUri = networkUtils.getVnfBindingObject(relationship) - int vpnCount = vpnBindingUri.size() - execution.setVariable(Prefix + "vpnCount", vpnCount) - utils.log("DEBUG", " UPDNETI_vpnCount - " + vpnCount, isDebugEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - - if (vpnCount > 0) { - execution.setVariable(Prefix + "vpnBindings", vpnBindingUri) - utils.log("DEBUG", " vpnBindingUri List - " + vpnBindingUri, isDebugEnabled) - - String routeTargets = "" - // AII loop call using list vpnBindings - for (i in 0..vpnBindingUri.size()-1) { - - int counting = i+1 - - // prepare url using vpnBinding - String queryVpnBindingAAIRequest = "" - String aai_uri = aaiUriUtil.getNetworkVpnBindingUri(execution) - - // Note: By default, the vpnBinding url is found in 'related-link' of the response, - // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. - if (aai_uri == null || aai_uri == "") { - // using value of 'related-link' from response - if (vpnBindingUri[i].charAt(vpnBindingUri[i].length()-1) == '/') { - queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i].substring(0, vpnBindingUri[i].length()-1) + "?depth=all" - } else { - queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i] + "?depth=all" - } - - } else { - // using uri value in URN mapping - String vpnBindingId = vpnBindingUri[i].substring(vpnBindingUri[i].indexOf("/vpn-binding/")+13, vpnBindingUri[i].length()) - if (vpnBindingId.charAt(vpnBindingId.length()-1) == '/') { - vpnBindingId = vpnBindingId.substring(0, vpnBindingId.length()-1) - } - queryVpnBindingAAIRequest = "${aai_endpoint}${aai_uri}/" + vpnBindingId + "?depth=all" - } - - utils.logAudit(queryVpnBindingAAIRequest) - execution.setVariable(Prefix + "queryVpnBindingAAIRequest", queryVpnBindingAAIRequest) - utils.log("DEBUG", " UPDNETI_queryVpnBindingAAIRequest, , vpnBinding #" + counting + " : " + "\n" + queryVpnBindingAAIRequest, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryVpnBindingAAIRequest) - String returnCode = response.getStatusCode() - execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI query vpn binding Response Code, vpnBinding #" + counting + " : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable(Prefix + "queryVpnBindingAAIResponse", aaiResponseAsString) - utils.log("DEBUG", " AAI Query Vpn Binding Success REST Response, , vpnBinding #" + counting + " : " + "\n" + aaiResponseAsString, isDebugEnabled) - - String routeTarget = "" - String routeRole = "" - if (utils.nodeExists(aaiResponseAsString, "route-targets")) { - String aaiRouteTargets = utils.getNodeXml(aaiResponseAsString, "route-targets", false) - def aaiRouteTargetsXml = new XmlSlurper().parseText(aaiRouteTargets) - def aaiRouteTarget = aaiRouteTargetsXml.'**'.findAll {it.name() == "route-target"} - for (j in 0..aaiRouteTarget.size()-1) { - routeTarget = utils.getNodeText1(XmlUtil.serialize(aaiRouteTarget[j]), "global-route-target") - routeRole = utils.getNodeText1(XmlUtil.serialize(aaiRouteTarget[j]), "route-target-role") - routeTargets += "" + '\n' + - " " + routeTarget + "" + '\n' + - " " + routeRole + "" + '\n' + - "" + '\n' - } - } - - } else { - if (returnCode=='404') { - String dataErrorMessage = "Response Error from AAINetworkVpnBinding is 404 (Not Found)." - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = " Unexpected Response from AAINetworkVpnBinding - " + returnCode - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - } // end loop - - execution.setVariable(Prefix + "routeCollection", routeTargets) - utils.log("DEBUG", " UPDNETI_routeCollection - " + '\n' + routeTargets, isDebugEnabled) - - } else { - // reset return code to success - execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) - String aaiStubResponse = - """ - - - - """ - String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) - execution.setVariable(Prefix + "queryVpnBindingAAIResponse", aaiStubResponseAsXml) - execution.setVariable(Prefix + "routeCollection", "") - utils.log("DEBUG", " No vpnBinding, using this stub as response - " + '\n' + aaiStubResponseAsXml, isDebugEnabled) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkVpnBinding() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAINetworkPolicy(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkPolicy of DoUpdateNetworkInstance ***** " , isDebugEnabled) - - try { - // get variables - String queryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse").replace('', "") - String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") - utils.log("DEBUG", " relationship - " + relationship, isDebugEnabled) - - // Check if Network Policy is present, then build a List of network policy - List networkPolicyUriList = networkUtils.getNetworkPolicyObject(relationship) - int networkPolicyCount = networkPolicyUriList.size() - execution.setVariable(Prefix + "networkPolicyCount", networkPolicyCount) - utils.log("DEBUG", " UPDNETI_networkPolicyCount - " + networkPolicyCount, isDebugEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - - if (networkPolicyCount > 0) { - execution.setVariable(Prefix + "networkPolicyUriList", networkPolicyUriList) - utils.log("DEBUG", " networkPolicyUri List - " + networkPolicyUriList, isDebugEnabled) - - String networkPolicies = "" - // AII loop call using list vpnBindings - for (i in 0..networkPolicyUriList.size()-1) { - - int counting = i+1 - - // prepare url using vpnBinding - String queryNetworkPolicyAAIRequest = "" - - String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) - - // Note: By default, the network policy url is found in 'related-link' of the response, - // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. - if (aai_uri == null || aai_uri == "") { - // using value of 'related-link' from response - if (networkPolicyUriList[i].charAt(networkPolicyUriList[i].length()-1) == '/') { - queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i].substring(0, networkPolicyUriList[i].length()-1) + "?depth=all" - } else { - queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i] + "?depth=all" - } - } else { - // using uri value in URN mapping - String networkPolicyId = networkPolicyUriList[i].substring(networkPolicyUriList[i].indexOf("/network-policy/")+16, networkPolicyUriList[i].length()) - println " networkPolicyId - " + networkPolicyId - if (networkPolicyId.charAt(networkPolicyId.length()-1) == '/') { - networkPolicyId = networkPolicyId.substring(0, networkPolicyId.length()-1) - } - queryNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + networkPolicyId + "?depth=all" - - } - - - utils.logAudit(queryNetworkPolicyAAIRequest) - execution.setVariable(Prefix + "queryNetworkPolicyAAIRequest", queryNetworkPolicyAAIRequest) - utils.log("DEBUG", " UPDNETI_queryNetworkPolicyAAIRequest, , NetworkPolicy #" + counting + " : " + "\n" + queryNetworkPolicyAAIRequest, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkPolicyAAIRequest) - String returnCode = response.getStatusCode() - execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", aaiResponseAsString) - utils.log("DEBUG", " QueryAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString, isDebugEnabled) - - String networkPolicy = "" - if (utils.nodeExists(aaiResponseAsString, "network-policy-fqdn")) { - networkPolicy = utils.getNodeText1(aaiResponseAsString, "network-policy-fqdn") - networkPolicies += "" + networkPolicy + "" + '\n' - } - - } else { - if (returnCode=='404') { - String dataErrorMessage = "Response Error from QueryAAINetworkPolicy is 404 (Not Found)." - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Response from QueryAAINetworkPolicy - " + returnCode - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - } // end loop - - execution.setVariable(Prefix + "networkCollection", networkPolicies) - utils.log("DEBUG", " UPDNETI_networkCollection - " + '\n' + networkPolicies, isDebugEnabled) - - } else { - // reset return code to success - execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "200") - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) - String aaiStubResponse = - """ - - - - """ - String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) - execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", aaiStubResponseAsXml) - execution.setVariable(Prefix + "networkCollection", "") - utils.log("DEBUG", " No net policies, using this stub as response - " + '\n' + aaiStubResponseAsXml, isDebugEnabled) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkPolicy() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAINetworkTableRef(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkTableRef of DoUpdateNetworkInstance ***** " , isDebugEnabled) - - try { - // get variables - String queryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse").replace('', "") - String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") - utils.log("DEBUG", " relationship - " + relationship, isDebugEnabled) - - // Check if Network TableREf is present, then build a List of network policy - List networkTableRefUriList = networkUtils.getNetworkTableRefObject(relationship) - int networkTableRefCount = networkTableRefUriList.size() - execution.setVariable(Prefix + "networkTableRefCount", networkTableRefCount) - utils.log("DEBUG", " UPDNETI_networkTableRefCount - " + networkTableRefCount, isDebugEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - - if (networkTableRefCount > 0) { - execution.setVariable(Prefix + "networkTableRefUriList", networkTableRefUriList) - utils.log("DEBUG", " networkTableRefUri List - " + networkTableRefUriList, isDebugEnabled) - - // AII loop call using list vpnBindings - String networkTableRefs = "" - for (i in 0..networkTableRefUriList.size()-1) { - - int counting = i+1 - - // prepare url using tableRef - String queryNetworkTableRefAAIRequest = "" - - String aai_uri = aaiUriUtil.getNetworkTableReferencesUri(execution) - - // Note: By default, the network policy url is found in 'related-link' of the response, - // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. - if (aai_uri == null || aai_uri == "") { - // using value of 'related-link' from response - if (networkTableRefUriList[i].charAt(networkTableRefUriList[i].length()-1) == '/') { - queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i].substring(0, networkTableRefUriList[i].length()-1) + "?depth=all" - } else { - queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i] + "?depth=all" - } - } else { - // using uri value in URN mapping - String networkTableRefId = networkTableRefUriList[i].substring(networkTableRefUriList[i].indexOf("/route-table-reference/")+23, networkTableRefUriList[i].length()) - - if (networkTableRefId.charAt(networkTableRefId.length()-1) == '/') { - networkTableRefId = networkTableRefId.substring(0, networkTableRefId.length()-1) - } - queryNetworkTableRefAAIRequest = "${aai_endpoint}${aai_uri}/" + networkTableRefId + "?depth=all" - - } - - - utils.logAudit(queryNetworkTableRefAAIRequest) - execution.setVariable(Prefix + "queryNetworkTableRefAAIRequest", queryNetworkTableRefAAIRequest) - utils.log("DEBUG", " UPDNETI_queryNetworkTableRefAAIRequest, , NetworkTableRef #" + counting + " : " + "\n" + queryNetworkTableRefAAIRequest, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkTableRefAAIRequest) - String returnCode = response.getStatusCode() - execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI query network Table Reference Response Code, NetworkTableRef #" + counting + " : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", aaiResponseAsString) - utils.log("DEBUG", " QueryAAINetworkTableRef Success REST Response, , NetworkTableRef #" + counting + " : " + "\n" + aaiResponseAsString, isDebugEnabled) - - String networkTableRef = "" - if (utils.nodeExists(aaiResponseAsString, "route-table-reference-fqdn")) { - networkTableRef = utils.getNodeText1(aaiResponseAsString, "route-table-reference-fqdn") - networkTableRefs += "" + networkTableRef + "" + '\n' - } - - } else { - if (returnCode=='404') { - String dataErrorMessage = "Response Error from QueryAAINetworkTableRef is 404 (Not Found)." - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Response from QueryAAINetworkTableRef - " + returnCode - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - } // end loop - - execution.setVariable(Prefix + "tableRefCollection", networkTableRefs) - utils.log("DEBUG", " UPDNETI_tableRefCollection - " + '\n' + networkTableRefs, isDebugEnabled) - - } else { - // reset return code to success - execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200") - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) - String aaiStubResponse = - """ - - - - """ - String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) - execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", aaiStubResponseAsXml) - execution.setVariable(Prefix + "tableRefCollection", "") - utils.log("DEBUG", " No net table references, using this stub as response - " + '\n' + aaiStubResponseAsXml, isDebugEnabled) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkTableRef() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTUpdateContrailAAINetwork(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTUpdateContrailAAINetwork of DoUpdateNetworkInstance ***** " , isDebugEnabled) - - try { - // get variables - String networkRequest = execution.getVariable(Prefix + "networkRequest") - String networkId = utils.getNodeText1(networkRequest, "network-id") - networkId = UriUtils.encode(networkId,"UTF-8") - String requeryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") - String updateNetworkResponse = execution.getVariable(Prefix + "updateNetworkResponse") - - // Prepare url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String updateContrailAAIUrlRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" - - utils.logAudit(updateContrailAAIUrlRequest) - execution.setVariable(Prefix + "updateContrailAAIUrlRequest", updateContrailAAIUrlRequest) - utils.log("DEBUG", " UPDNETI_updateContrailAAIUrlRequest - " + "\n" + updateContrailAAIUrlRequest, isDebugEnabled) - - //Prepare payload (PUT) - String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) - String payload = networkUtils.ContrailNetworkCreatedUpdate(requeryIdAAIResponse, updateNetworkResponse, schemaVersion) - String payloadXml = utils.formatXml(payload) - utils.logAudit(payloadXml) - execution.setVariable(Prefix + "updateContrailAAIPayloadRequest", payloadXml) - utils.log("DEBUG", " 'payload' to Update Contrail - " + "\n" + payloadXml, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIPutCall(execution, updateContrailAAIUrlRequest, payload) - String returnCode = response.getStatusCode() - String aaiUpdateContrailResponseAsString = response.getResponseBodyAsString() - - execution.setVariable(Prefix + "aaiUpdateContrailReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI Update Contrail Response Code : " + returnCode, isDebugEnabled) - - - if (returnCode=='200') { - utils.logAudit(aaiUpdateContrailResponseAsString) - execution.setVariable(Prefix + "updateContrailAAIResponse", aaiUpdateContrailResponseAsString) - utils.log("DEBUG", " AAI Update Contrail Success REST Response - " + "\n" + aaiUpdateContrailResponseAsString, isDebugEnabled) - // Point-of-no-return is set to false, rollback not needed. - execution.setVariable(Prefix + "isPONR", true) - - } else { - if (returnCode=='404') { - String dataErrorMessage = " Response Error from UpdateContrailAAINetwork is 404 (Not Found)." - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiUpdateContrailResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiUpdateContrailResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String errorMessage = "Unexpected Response from UpdateContrailAAINetwork - " + returnCode - utils.log("DEBUG", errorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - } - } - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTUpdateContrailAAINetwork() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareUpdateNetworkRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside prepareUpdateNetworkRequest of DoUpdateNetworkInstance ***** ", isDebugEnabled) - - try { - - // get variables - String requestId = execution.getVariable(Prefix + "requestId") - String messageId = execution.getVariable(Prefix + "messageId") - String source = execution.getVariable(Prefix + "source") - - String requestInput = execution.getVariable(Prefix + "networkRequest") - String queryIdResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") - String cloudRegionId = execution.getVariable(Prefix + "cloudRegionPo") - String backoutOnFailure = execution.getVariable(Prefix + "rollbackEnabled") - - // Prepare Network request - String routeCollection = execution.getVariable(Prefix + "routeCollection") - String policyCollection = execution.getVariable(Prefix + "networkCollection") - String tableCollection = execution.getVariable(Prefix + "tableRefCollection") - String updateNetworkRequest = networkUtils.UpdateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyCollection, tableCollection, cloudRegionId, backoutOnFailure, source ) - // Format Response - String buildUpdateNetworkRequestAsString = utils.formatXml(updateNetworkRequest) - buildUpdateNetworkRequestAsString = buildUpdateNetworkRequestAsString.replace(":w1aac13n0", "").replace("w1aac13n0:", "") - utils.logAudit(buildUpdateNetworkRequestAsString) - - execution.setVariable(Prefix + "updateNetworkRequest", buildUpdateNetworkRequestAsString) - utils.log("DEBUG", " UPDNETI_updateNetworkRequest - " + "\n" + buildUpdateNetworkRequestAsString, isDebugEnabled) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareUpdateNetworkRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareSDNCRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside prepareSDNCRequest of DoUpdateNetworkInstance ***** ", isDebugEnabled) - - try { - // get variables - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String updateNetworkInput = execution.getVariable(Prefix + "networkRequest") - String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") - - String networkId = "" - if (utils.nodeExists(updateNetworkInput, "network-id")) { - networkId = utils.getNodeText1(updateNetworkInput, "network-id") - } - if (networkId == null) {networkId = ""} - - String serviceInstanceId = utils.getNodeText1(updateNetworkInput, "service-instance-id") - - // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, updateNetworkInput, serviceInstanceId, sdncCallback, "changeassign", "NetworkActivateRequest", cloudRegionId, networkId, null, null) - - String sndcTopologyUpdateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) - utils.logAudit(sndcTopologyUpdateRequesAsString) - execution.setVariable(Prefix + "changeAssignSDNCRequest", sndcTopologyUpdateRequesAsString) - utils.log("DEBUG", " UPDNETI_changeAssignSDNCRequest - " + "\n" + sndcTopologyUpdateRequesAsString, isDebugEnabled) - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareSDNCRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - - - // ************************************************** - // Post or Validate Response Section - // ************************************************** - - public void validateUpdateNetworkResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside validateUpdateNetworkResponse of DoUpdateNetworkInstance *****", isDebugEnabled) - - try { - String returnCode = execution.getVariable(Prefix + "networkReturnCode") - String networkResponse = execution.getVariable(Prefix + "updateNetworkResponse") - if (networkResponse==null) { - networkResponse="" // reset - } - - utils.log("DEBUG", " Network Adapter update responseCode: " + returnCode, isDebugEnabled) - - String errorMessage = "" - if (returnCode == "200") { - execution.setVariable(Prefix + "isNetworkRollbackNeeded", true) - utils.logAudit(networkResponse) - execution.setVariable(Prefix + "updateNetworkResponse", networkResponse) - utils.log("DEBUG", " Network Adapter update Success Response - " + "\n" + networkResponse, isDebugEnabled) - - // prepare rollback data - String rollbackData = utils.getNodeXml(networkResponse, "rollback", false).replace("tag0:","").replace(":tag0","") - rollbackData = rollbackData.replace("rollback>", "networkRollback>") - String rollbackNetwork = - """ - ${rollbackData} - """ - String rollbackNetworkXml = utils.formatXml(rollbackNetwork) - execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkXml) - utils.log("DEBUG", " Network Adapter rollback data - " + "\n" + rollbackNetworkXml, isDebugEnabled) - - } else { // network error - if (returnCode.toInteger() > 399 && returnCode.toInteger() < 600) { //4xx, 5xx - if (networkResponse.contains("updateNetworkError")) { - networkResponse = networkResponse.replace('', '') - errorMessage = utils.getNodeText1(networkResponse, "message") - errorMessage = "Received error from Network Adapter: " + errorMessage - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - - } else { // CatchAll exception - if (returnCode == "500") { - errorMessage = "JBWEB000065: HTTP Status 500." - } else { - errorMessage = "Return code is " + returnCode - } - errorMessage = "Received error from Network Adapter: " + errorMessage - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - - } - - } else { // CatchAll exception - String dataErrorMessage = "Received error from Network Adapter. Return code is: " + returnCode - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. validateUpdateNetworkResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - - } - - public void validateSDNCResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside validateSDNCResponse of DoUpdateNetworkInstance ***** ", isDebugEnabled) - - String response = execution.getVariable(Prefix + "changeAssignSDNCResponse") - WorkflowException workflowException = null - try { - workflowException = execution.getVariable(Prefix + "WorkflowException") - //execution.setVariable("WorkflowException", workflowException) - } catch (Exception ex) { - utils.log("DEBUG", " Sdnc 'WorkflowException' object is empty or null. ", isDebugEnabled) - } - - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - // reset variable - String changeAssignSDNCResponseDecodeXml = sdncAdapterUtils.decodeXML(execution.getVariable(Prefix + "changeAssignSDNCResponse")) - changeAssignSDNCResponseDecodeXml = changeAssignSDNCResponseDecodeXml.replace("&", "&").replace('', "") - execution.setVariable(Prefix + "changeAssignSDNCResponse", changeAssignSDNCResponseDecodeXml) - - if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, prefix+'sdncResponseSuccess' - execution.setVariable(Prefix + "isSdncRollbackNeeded", true) - utils.log("DEBUG", "Successfully Validated SDNC Response", isDebugEnabled) - - } else { - utils.log("DEBUG", "Did NOT Successfully Validated SDNC Response", isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - - } - - - public void postProcessResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside postProcessResponse of DoUpdateNetworkInstance ***** ", isDebugEnabled) - - try { - utils.log("DEBUG", " ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException"), isDebugEnabled) - if (execution.getVariable(Prefix + "isException") == false) { - // set rollback data - execution.setVariable("orchestrationStatus", "") - execution.setVariable("networkId", execution.getVariable(Prefix + "networkId")) - execution.setVariable("networkName", execution.getVariable(Prefix + "networkName")) - prepareSuccessRollbackData(execution) // populate rollbackData - execution.setVariable("WorkflowException", null) - execution.setVariable(Prefix + "Success", true) - utils.log("DEBUG", " ***** postProcessResponse(), GOOD !!!", isDebugEnabled) - } else { - execution.setVariable(Prefix + "Success", false) - execution.setVariable("rollbackData", null) - String exceptionMessage = " Exception encountered in MSO Bpmn. " - if (execution.getVariable("workflowException") != null) { // Output of Rollback flow. - utils.log("DEBUG", " ***** workflowException: " + execution.getVariable("workflowException"), isDebugEnabled) - WorkflowException wfex = execution.getVariable("workflowException") - exceptionMessage = wfex.getErrorMessage() - } else { - if (execution.getVariable(Prefix + "WorkflowException") != null) { - WorkflowException pwfex = execution.getVariable(Prefix + "WorkflowException") - exceptionMessage = pwfex.getErrorMessage() - } - } - // going to the Main flow: a-la-carte or macro - utils.log("DEBUG", " ***** postProcessResponse(), BAD !!!", isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - throw new BpmnError("MSOWorkflowException") - } - - } catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - - } - - public void prepareSDNCRollbackRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside prepareSDNCRollbackRequest of DoUpdateNetworkInstance ***** ", isDebugEnabled) - - try { - // for some reason the WorkflowException object is null after the sdnc rollback call task, need to save WorkflowException. - execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) - // get variables - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String updateNetworkInput = execution.getVariable(Prefix + "networkRequest") - String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") - String changeAssignSDNCResponse = execution.getVariable(Prefix + "changeAssignSDNCResponse") - String networkId = utils.getNodeText1(changeAssignSDNCResponse, "network-id") - - String serviceInstanceId = utils.getNodeText1(updateNetworkInput, "service-instance-id") - - // 2. prepare rollback topology via SDNC Adapter SUBFLOW call - String sndcTopologyRollbackRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, updateNetworkInput, serviceInstanceId, sdncCallback, "rollback", "NetworkActivateRequest", cloudRegionId, networkId, null, null) - String sndcTopologyRollbackRequestAsString = utils.formatXml(sndcTopologyRollbackRequest) - execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyRollbackRequestAsString) - utils.log("DEBUG", " Preparing request for SDNC Topology assign's rollback/compensation . . . - " + "\n" + sndcTopologyRollbackRequestAsString, isDebugEnabled) - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareSDNCRollbackRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareRollbackData(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareRollbackData() of DoUpdateNetworkInstance ***** ", isDebugEnabled) - - try { - - Map rollbackData = new HashMap(); - String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") - if (rollbackSDNCRequest != null) { - if (rollbackSDNCRequest != "") { - rollbackData.put("rollbackSDNCRequest", execution.getVariable(Prefix + "rollbackSDNCRequest")) - } - } - String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") - if (rollbackNetworkRequest != null) { - if (rollbackNetworkRequest != "") { - rollbackData.put("rollbackNetworkRequest", execution.getVariable(Prefix + "rollbackNetworkRequest")) - } - } - execution.setVariable("rollbackData", rollbackData) - utils.log("DEBUG", "** rollbackData : " + rollbackData, isDebugEnabled) - - execution.setVariable("WorkflowException", execution.getVariable(Prefix + "WorkflowException")) - utils.log("DEBUG", "** WorkflowException : " + execution.getVariable("WorkflowException"), isDebugEnabled) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareRollbackData() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareSuccessRollbackData(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareSuccessRollbackData() of DoUpdateNetworkInstance ***** ", isDebugEnabled) - - try { - - if (execution.getVariable("sdncVersion") != '1610') { - // skip: 1702 for 'changeassign' or equivalent not yet defined in SNDC, so no rollback. - } else { - prepareSDNCRollbackRequest(execution) - } - - Map rollbackData = new HashMap(); - String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") - if (rollbackSDNCRequest != null) { - if (rollbackSDNCRequest != "") { - rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) - } - } - String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") - if (rollbackNetworkRequest != null) { - if (rollbackNetworkRequest != "") { - rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) - } - } - execution.setVariable("rollbackData", rollbackData) - - utils.log("DEBUG", "** 'rollbackData' for Full Rollback : " + rollbackData, isDebugEnabled) - execution.setVariable("WorkflowException", null) - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void setExceptionFlag(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside setExceptionFlag() of DoUpdateNetworkInstance ***** ", isDebugEnabled) - - try { - - execution.setVariable(Prefix + "isException", true) - - if (execution.getVariable("SavedWorkflowException1") != null) { - execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) - } else { - execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) - } - utils.log("DEBUG", Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException"), isDebugEnabled) - - } catch(Exception ex){ - String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. setExceptionFlag(): " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - } - - } - - - // ******************************* - // Build Error Section - // ******************************* - - public void processJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - try{ - utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method") - } - utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy deleted file mode 100644 index 7d326382cb..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy +++ /dev/null @@ -1,304 +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.bpmn.infrastructure.scripts; - -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.NetworkUtils -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils - -/** - * This groovy class supports the DoCreateNetworkInstance.bpmn process. - * - */ -public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcessor { - String Prefix="UPDNETIR_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - NetworkUtils networkUtils = new NetworkUtils() - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - - def className = getClass().getSimpleName() - - /** - * This method is executed during the preProcessRequest task of the DoUpdateNetworkInstanceRollback.bpmn process. - * @param execution - */ - public InitializeProcessVariables(DelegateExecution execution){ - /* Initialize all the process variables in this block */ - - execution.setVariable(Prefix + "rollbackNetworkRequest", null) - execution.setVariable(Prefix + "rollbackSDNCRequest", null) - execution.setVariable(Prefix + "WorkflowException", null) - - execution.setVariable(Prefix + "rollbackNetworkRequest", "") - execution.setVariable(Prefix + "rollbackNetworkResponse", "") - execution.setVariable(Prefix + "rollbackNetworkReturnCode", "") - - execution.setVariable(Prefix + "rollbackSDNCRequest", "") - execution.setVariable(Prefix + "rollbackSDNCResponse", "") - execution.setVariable(Prefix + "rollbackSDNCReturnCode", "") - - execution.setVariable(Prefix + "Success", false) - execution.setVariable(Prefix + "fullRollback", false) - - } - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - /** - * This method is executed during the preProcessRequest task of the DoUpdateNetworkInstanceRollback.bpmn process. - * @param execution - */ - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest() of " + className + ".groovy ***** ", isDebugEnabled) - - try { - // initialize flow variables - InitializeProcessVariables(execution) - - // GET Incoming request/variables - String rollbackNetworkRequest = null - String rollbackSDNCRequest = null - - // Partial Rollback - Map rollbackData = execution.getVariable("rollbackData") - if (rollbackData != null && rollbackData instanceof Map) { - - if(rollbackData.containsKey("rollbackNetworkRequest")) { - rollbackNetworkRequest = rollbackData["rollbackNetworkRequest"] - } - - if(rollbackData.containsKey("rollbackSDNCRequest")) { - rollbackSDNCRequest = rollbackData["rollbackSDNCRequest"] - } - } - - execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkRequest) - execution.setVariable(Prefix + "rollbackSDNCRequest", rollbackSDNCRequest) - utils.log("DEBUG", "'rollbackData': " + '\n' + execution.getVariable("rollbackData"), isDebugEnabled) - - String sdncVersion = execution.getVariable("sdncVersion") - utils.log("DEBUG", "sdncVersion? : " + sdncVersion, isDebugEnabled) - - // PO Authorization Info / headers Authorization= - String basicAuthValuePO = execution.getVariable("URN_mso_adapters_po_auth") - utils.log("DEBUG", " Obtained BasicAuth userid password for PO/SDNC adapter: " + basicAuthValuePO, isDebugEnabled) - try { - def encodedString = utils.getBasicAuth(basicAuthValuePO, execution.getVariable("URN_mso_msoKey")) - execution.setVariable("BasicAuthHeaderValuePO",encodedString) - execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) - - } catch (IOException ex) { - String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " - String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() - utils.log("DEBUG", dataErrorMessage , isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - if (execution.getVariable("SavedWorkflowException1") != null) { - execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) - } else { - execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) - } - utils.log("DEBUG", "*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException"), isDebugEnabled) - if(execution.getVariable(Prefix + "WorkflowException") != null) { - // called by: DoCreateNetworkInstance, partial rollback - execution.setVariable(Prefix + "fullRollback", false) - - } else { - // called by: Macro - Full Rollback, WorkflowException = null - execution.setVariable(Prefix + "fullRollback", true) - - } - utils.log("DEBUG", "*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"), isDebugEnabled) - - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - sendSyncError(execution) - // caught exception - String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void validateRollbackResponses (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside validateRollbackResponses() of DoUpdateNetworkInstanceRollback ***** ", isDebugEnabled) - - try { - // validate PO network rollback response - String rollbackNetworkErrorMessages = "" - String rollbackNetworkReturnCode = "200" - if (execution.getVariable(Prefix + "rollbackNetworkRequest") != null) { - rollbackNetworkReturnCode = execution.getVariable(Prefix + "rollbackNetworkReturnCode") - String rollbackNetworkResponse = execution.getVariable(Prefix + "rollbackNetworkResponse") - utils.log("DEBUG", " NetworkRollback Code - " + rollbackNetworkReturnCode, isDebugEnabled) - utils.log("DEBUG", " NetworkRollback Response - " + rollbackNetworkResponse, isDebugEnabled) - if (rollbackNetworkReturnCode != "200") { - rollbackNetworkErrorMessages = " + PO Network rollback failed. " - } else { - rollbackNetworkErrorMessages = " + PO Network rollback completed." - } - } - - // validate SDNC rollback response - String rollbackSdncErrorMessages = "" - String rollbackSDNCReturnCode = "200" - if (execution.getVariable(Prefix + "rollbackSDNCRequest") != null) { - rollbackSDNCReturnCode = execution.getVariable(Prefix + "rollbackSDNCReturnCode") - String rollbackSDNCResponse = execution.getVariable(Prefix + "rollbackSDNCResponse") - String rollbackSDNCReturnInnerCode = "" - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - rollbackSDNCResponse = sdncAdapterUtils.decodeXML(rollbackSDNCResponse) - rollbackSDNCResponse = rollbackSDNCResponse.replace("&", "&").replace('$', '').replace('', "") - if (rollbackSDNCReturnCode == "200") { - if (utils.nodeExists(rollbackSDNCResponse, "response-code")) { - rollbackSDNCReturnInnerCode = utils.getNodeText1(rollbackSDNCResponse, "response-code") - if (rollbackSDNCReturnInnerCode == "200" || rollbackSDNCReturnInnerCode == "" || rollbackSDNCReturnInnerCode == "0") { - rollbackSdncErrorMessages = " + SNDC changeassign rollback completed." - } else { - rollbackSdncErrorMessages = " + SDNC changeassign rollback failed. " - } - } else { - rollbackSdncErrorMessages = " + SNDC changeassign rollback completed." - } - } else { - rollbackSdncErrorMessages = " + SDNC changeassign rollback failed. " - } - utils.log("DEBUG", " SDNC changeassign rollback Code - " + rollbackSDNCReturnCode, isDebugEnabled) - utils.log("DEBUG", " SDNC changeassign rollback Response - " + rollbackSDNCResponse, isDebugEnabled) - } - - String statusMessage = "" - int errorCode = 7000 - utils.log("DEBUG", "*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"), isDebugEnabled) - if (execution.getVariable(Prefix + "fullRollback") == false) { - // original WorkflowException, - WorkflowException wfe = execution.getVariable(Prefix + "WorkflowException") - if (wfe != null) { - // rollback due to failure in DoCreate - Partial rollback - statusMessage = wfe.getErrorMessage() - errorCode = wfe.getErrorCode() - } else { - statusMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." - errorCode = '7000' - } - - // set if all rolledbacks are successful - if (rollbackNetworkReturnCode == "200" && rollbackSDNCReturnCode == "200") { - execution.setVariable("rolledBack", true) - - } else { - execution.setVariable("rolledBack", false) - - } - - statusMessage = statusMessage + rollbackNetworkErrorMessages + rollbackSdncErrorMessages - utils.log("DEBUG", "Final DoUpdateNetworkInstanceRollback status message: " + statusMessage, isDebugEnabled) - String processKey = getProcessKey(execution); - WorkflowException exception = new WorkflowException(processKey, errorCode, statusMessage); - execution.setVariable("workflowException", exception); - - } else { - // rollback due to failures in Main flow (Macro) - Full rollback - // WorkflowException = null - if (rollbackNetworkReturnCode == "200" && rollbackSDNCReturnCode == "200") { - execution.setVariable("rollbackSuccessful", true) - execution.setVariable("rollbackError", false) - } else { - String exceptionMessage = "Network Update Rollback was not Successful. " - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - execution.setVariable("rollbackSuccessful", false) - execution.setVariable("rollbackError", true) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - throw new BpmnError("MSOWorkflowException") - } - - } - - - } catch (Exception ex) { - execution.setVariable("WorkflowException", null) - String errorMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." - String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstanceRollback flow. validateRollbackResponses() - " + errorMessage + ": " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - execution.setVariable("WorkflowException", execution.getVariable("WorkflowException")) - - } - - } - - // ******************************* - // Build Error Section - // ******************************* - - - - public void processJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - try{ - utils.log("DEBUG", "Caught a Java Exception in " + Prefix, isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) - } - utils.log("DEBUG", "Completed processJavaException Method in " + Prefix, isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy deleted file mode 100644 index a9a657eea1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy +++ /dev/null @@ -1,1038 +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.bpmn.infrastructure.scripts - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.NetworkUtils -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.common.scripts.VfModule -import org.openecomp.mso.bpmn.common.scripts.VfModuleBase -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.client.aai.AAIResourcesClient -import org.openecomp.mso.client.aai.entities.AAIResultWrapper -import org.openecomp.mso.client.aai.entities.uri.AAIUri -import org.openecomp.mso.rest.APIResponse -import org.springframework.web.util.UriUtils -import org.openecomp.mso.client.aai.AAIObjectType; -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; - - -public class DoUpdateVfModule extends VfModuleBase { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - CatalogDbUtils catalog = new CatalogDbUtils() - - /** - * Initialize the flow's variables. - * - * @param execution The flow's execution instance. - */ - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable('prefix', 'DOUPVfMod_') - execution.setVariable('DOUPVfMod_requestInfo', null) - execution.setVariable('DOUPVfMod_serviceInstanceId', null) - execution.setVariable('DOUPVfMod_requestId', null) - execution.setVariable('DOUPVfMod_vnfInputs', null) - execution.setVariable('DOUPVfMod_vnfId', null) - execution.setVariable('DOUPVfMod_vnfName', null) - execution.setVariable('DOUPVfMod_vnfNameFromAAI', null) - execution.setVariable('DOUPVfMod_vfModuleName', null) - execution.setVariable('DOUPVfMod_vfModuleId', null) - execution.setVariable('DOUPVfMod_vnfType', null) - execution.setVariable('DOUPVfMod_asdcServiceModelVersion', null) - execution.setVariable('DOUPVfMod_vfModuleModelName', null) - execution.setVariable('DOUPVfMod_modelCustomizationUuid', null) - execution.setVariable("DOUPVfMod_isBaseVfModule", "false") - execution.setVariable('DOUPVfMod_serviceId', null) - execution.setVariable('DOUPVfMod_aicCloudRegion', null) - execution.setVariable('DOUPVfMod_tenantId', null) - execution.setVariable('DOUPVfMod_volumeGroupId', null) - execution.setVariable("DOUPVfMod_volumeGroupStackId", "") - execution.setVariable('DOUPVfMod_vfModule', null) - execution.setVariable('DOUPVfMod_vnfParams', null) - execution.setVariable("DOUPVfMod_baseVfModuleId", "") - execution.setVariable("DOUPVfMod_baseVfModuleHeatStackId", "") - execution.setVariable('DOUPVfMod_prepareUpdateAAIVfModuleRequest', null) - execution.setVariable('DOUPVfMod_sdncChangeAssignRequest', null) - execution.setVariable('DOUPVfMod_sdncChangeAssignResponse', null) - execution.setVariable('DOUPVfMod_sdncActivateRequest', null) - execution.setVariable('DOUPVfMod_sdncActivateResponse', null) - execution.setVariable('DOUPVfMod_sdncTopologyRequest', null) - execution.setVariable('DOUPVfMod_sdncTopologyResponse', null) - execution.setVariable('DOUPVfMod_vnfAdapterRestRequest', null) - execution.setVariable('DOUPVfMod_updateAAIGenericVnfRequest', null) - execution.setVariable('DOUPVfMod_updateAAIVfModuleRequest', null) - execution.setVariable('DOUPVfMod_skipUpdateGenericVnf', false) - execution.setVariable('DoUpdateVfModuleSuccessIndicator', false) - } - - /** - * Check for missing elements in the received request. - * - * @param execution The flow's execution instance. - */ - public void preProcessRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - initProcessVariables(execution) - def xml = getVariable(execution, 'DoUpdateVfModuleRequest') - utils.logAudit("DoUpdateVfModule request: " + xml) - logDebug('Received request xml:\n' + xml, isDebugLogEnabled) - - if (xml == null || xml.isEmpty()) { - // Building Block-type request - - String cloudConfiguration = execution.getVariable("cloudConfiguration") - String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo") - - def serviceModelInfo = execution.getVariable("serviceModelInfo") - logDebug("serviceModelInfo: " + serviceModelInfo, isDebugLogEnabled) - String modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") - logDebug("modelInvariantUuid: " + modelInvariantUuid, isDebugLogEnabled) - def vnfModelInfo = execution.getVariable("vnfModelInfo") - - //tenantId - def tenantId = execution.getVariable("tenantId") - execution.setVariable("DOUPVfMod_tenantId", tenantId) - - //volumeGroupId - def volumeGroupId = execution.getVariable("volumeGroupId") - execution.setVariable("DOUPVfMod_volumeGroupId", volumeGroupId) - - //cloudSiteId - def cloudSiteId = execution.getVariable("lcpCloudRegionId") - execution.setVariable("DOUPVfMod_aicCloudRegion", cloudSiteId) - - logDebug("cloudSiteId: " + cloudSiteId, isDebugLogEnabled) - //vnfType - def vnfType = execution.getVariable("vnfType") - execution.setVariable("DOUPVfMod_vnfType", vnfType) - - logDebug("vnfType: " + vnfType, isDebugLogEnabled) - //vnfName - def vnfName = execution.getVariable("vnfName") - execution.setVariable("DOUPVfMod_vnfName", vnfName) - - logDebug("vnfName: " + vnfName, isDebugLogEnabled) - //vnfId - def vnfId = execution.getVariable("vnfId") - execution.setVariable("DOUPVfMod_vnfId", vnfId) - - logDebug("vnfId: " + vnfId, isDebugLogEnabled) - //vfModuleName - def vfModuleName = execution.getVariable("vfModuleName") - execution.setVariable("DOUPVfMod_vfModuleName", vfModuleName) - - logDebug("vfModuleName: " + vfModuleName, isDebugLogEnabled) - //vfModuleModelName - def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName") - execution.setVariable("DOUPVfMod_vfModuleModelName", vfModuleModelName) - - logDebug("vfModuleModelName: " + vfModuleModelName, isDebugLogEnabled) - //modelCustomizationUuid - def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid") - if (modelCustomizationUuid == null) { - modelCustomizationUuid = "" - } - execution.setVariable("DOUPVfMod_modelCustomizationUuid", modelCustomizationUuid) - - logDebug("modelCustomizationUuid: " + modelCustomizationUuid, isDebugLogEnabled) - //vfModuleId - def vfModuleId = execution.getVariable("vfModuleId") - execution.setVariable("DOUPVfMod_vfModuleId", vfModuleId) - logDebug("vfModuleId: " + vfModuleId, isDebugLogEnabled) - def requestId = execution.getVariable("msoRequestId") - execution.setVariable("DOUPVfMod_requestId", requestId) - logDebug("requestId: " + requestId, isDebugLogEnabled) - // Set mso-request-id to request-id for VNF Adapter interface - execution.setVariable("mso-request-id", requestId) - //serviceId - def serviceId = execution.getVariable("serviceId") - execution.setVariable("DOUPVfMod_serviceId", serviceId) - logDebug("serviceId: " + serviceId, isDebugLogEnabled) - //serviceInstanceId - def serviceInstanceId = execution.getVariable("serviceInstanceId") - execution.setVariable("DOUPVfMod_serviceInstanceId", serviceInstanceId) - - logDebug("serviceInstanceId: " + serviceInstanceId, isDebugLogEnabled) - //source - HARDCODED - def source = "VID" - execution.setVariable("DOUPVfMod_source", source) - - logDebug("source: " + source, isDebugLogEnabled) - //backoutOnFailure - def disableRollback = execution.getVariable("disableRollback") - def backoutOnFailure = true - if (disableRollback != null && disableRollback.equals("true")) { - backoutOnFailure = false - } - execution.setVariable("DOUPVfMod_backoutOnFailure", backoutOnFailure) - logDebug("backoutOnFailure: " + backoutOnFailure, isDebugLogEnabled) - //isBaseVfModule - def isBaseVfModule = execution.getVariable("isBaseVfModule") - execution.setVariable("DOUPVfMod_isBaseVfModule", isBaseVfModule) - logDebug("isBaseVfModule: " + isBaseVfModule, isDebugLogEnabled) - //asdcServiceModelVersion - def asdcServiceModelVersion = execution.getVariable("asdcServiceModelVersion") - execution.setVariable("DOUPVfMod_asdcServiceModelVersion", asdcServiceModelVersion) - logDebug("asdcServiceModelVersion: " + asdcServiceModelVersion, isDebugLogEnabled) - //personaModelId - execution.setVariable("DOUPVfMod_personaModelId", jsonUtil.getJsonValue(vfModuleModelInfo, "modelInvariantUuid")) - //personaModelVersion - execution.setVariable("DOUPVfMod_personaModelVersion", jsonUtil.getJsonValue(vfModuleModelInfo, "modelVersion")) - //Get or Generate UUID - String uuid = execution.getVariable("DOUPVfMod_uuid") - if(uuid == null){ - uuid = UUID.randomUUID() - logDebug("Generated messageId (UUID) is: " + uuid, isDebugLogEnabled) - }else{ - logDebug("Found messageId (UUID) is: " + uuid, isDebugLogEnabled) - } - //isVidRequest - String isVidRequest = execution.getVariable("isVidRequest") - // default to true - if (isVidRequest == null || isVidRequest.isEmpty()) { - execution.setVariable("isVidRequest", "true") - } - //usePreload - def usePreload = execution.getVariable("usePreload") - execution.setVariable("DOUPVfMod_usePreload", usePreload) - logDebug("usePreload: " + usePreload, isDebugLogEnabled) - //globalSubscriberId - String globalSubscriberId = execution.getVariable("globalSubscriberId") - execution.setVariable("DOUPVfMod_globalSubscriberId", globalSubscriberId) - logDebug("globalSubsrciberId: " + globalSubscriberId, isDebugLogEnabled) - //vnfQueryPath - String vnfQueryPath = execution.getVariable("vnfQueryPath") - execution.setVariable("DOUPVfMod_vnfQueryPath", vnfQueryPath) - logDebug("vnfQueryPath: " + vnfQueryPath, isDebugLogEnabled) - - Map vfModuleInputParams = execution.getVariable("vfModuleInputParams") - if (vfModuleInputParams != null) { - execution.setVariable("DOUPVfMod_vnfParamsMap", vfModuleInputParams) - } - //get workload and environment context from parent SI - String environmentContext = "" - String workloadContext ="" - String serviceType ="" - - try{ - String json = catalog.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) - serviceType = jsonUtil.getJsonValue(json, "serviceResources.serviceType") - }catch(BpmnError e){ - throw e - } catch (Exception ex){ - String msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - - try{ - AAIUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId) - AAIResourcesClient aaiRC = new AAIResourcesClient() - AAIResultWrapper aaiRW = aaiRC.get(serviceInstanceURI) - Map aaiJson = aaiRW.asMap() - environmentContext = aaiJson.getOrDefault("environment-context","") - workloadContext = aaiJson.getOrDefault("workload-context","") - - }catch (Exception ex) { - utils.log("DEBUG","Error retreiving parent service instance information", isDebugLogEnabled) - } - - execution.setVariable("DCVFM_environmentContext",environmentContext) - execution.setVariable("DCVFM_workloadContext",workloadContext) - } - else { - - def requestInfo = getRequiredNodeXml(execution, xml, 'request-info') - execution.setVariable('DOUPVfMod_requestInfo', requestInfo) - execution.setVariable('DOUPVfMod_requestId', getRequiredNodeText(execution, requestInfo, 'request-id')) - def serviceInstanceId = execution.getVariable('mso-service-instance-id') - if (serviceInstanceId == null) { - serviceInstanceId = '' - } - execution.setVariable('DOUPVfMod_serviceInstanceId', serviceInstanceId) - - def vnfInputs = getRequiredNodeXml(execution, xml, 'vnf-inputs') - execution.setVariable('DOUPVfMod_vnfInputs', vnfInputs) - execution.setVariable('DOUPVfMod_vnfId', getRequiredNodeText(execution, vnfInputs, 'vnf-id')) - execution.setVariable('DOUPVfMod_vfModuleId', getRequiredNodeText(execution, vnfInputs, 'vf-module-id')) - execution.setVariable('DOUPVfMod_vfModuleName', getNodeTextForce(vnfInputs, 'vf-module-name')) - execution.setVariable('DOUPVfMod_vnfType', getNodeTextForce(vnfInputs, 'vnf-type')) - execution.setVariable('DOUPVfMod_vnfName', getNodeTextForce(vnfInputs, 'vnf-name')) - execution.setVariable('DOUPVfMod_asdcServiceModelVersion', getNodeTextForce(vnfInputs, 'asdc-service-model-version')) - execution.setVariable('DOUPVfMod_vfModuleModelName', getRequiredNodeText(execution, vnfInputs, 'vf-module-model-name')) - execution.setVariable('DOUPVfMod_modelCustomizationUuid', getNodeTextForce(vnfInputs, 'model-customization-id')) - execution.setVariable('DOUPVfMod_serviceId', getRequiredNodeText(execution, vnfInputs, 'service-id')) - execution.setVariable('DOUPVfMod_aicCloudRegion', getRequiredNodeText(execution, vnfInputs, 'aic-cloud-region')) - execution.setVariable('DOUPVfMod_tenantId', getRequiredNodeText(execution, vnfInputs, 'tenant-id')) - //isBaseVfModule - def isBaseVfModule = "false" - if (utils.nodeExists(xml, "is-base-vf-module")) { - isBaseVfModule = utils.getNodeText(xml, "is-base-vf-module") - execution.setVariable("DOUPVfMod_isBaseVfModule", isBaseVfModule) - } - logDebug("isBaseVfModule: " + isBaseVfModule, isDebugLogEnabled) - - NetworkUtils networkUtils = new NetworkUtils() - def backoutOnFailure = networkUtils.isRollbackEnabled(execution, xml) - execution.setVariable("DOUPVfMod_backoutOnFailure", backoutOnFailure) - - def String vgi = getNodeTextForce(vnfInputs, 'volume-group-id') - execution.setVariable('DOUPVfMod_volumeGroupId', vgi) - - execution.setVariable('DOUPVfMod_vnfParams', utils.getNodeXml(xml, 'vnf-params', false)) - } - - def sdncCallbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { - def msg = 'Required variable \'URN_mso_workflow_sdncadapter_callback\' is missing' - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) - } - } - - /** - * Prepare a Request for invoking the PrepareUpdateAAIVfModule subflow. This will - * set the orchestration-status to 'pending-update'. - * - * @param execution The flow's execution instance. - */ - public void prepPrepareUpdateAAIVfModule(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preparePrepareUpdateAAIVfModule(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def vnfId = execution.getVariable('DOUPVfMod_vnfId') - def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId') - def orchestrationStatus = 'pending-update' - - String prepareUpdateAAIVfModuleRequest = """ - - ${vnfId} - ${vfModuleId} - ${orchestrationStatus} - - """ - prepareUpdateAAIVfModuleRequest = utils.formatXml(prepareUpdateAAIVfModuleRequest) - execution.setVariable('DOUPVfMod_prepareUpdateAAIVfModuleRequest', prepareUpdateAAIVfModuleRequest) - utils.logAudit("DoUpdateAAIVfModule request: " + prepareUpdateAAIVfModuleRequest) - logDebug('Request for PrepareUpdateAAIVfModule:\n' + prepareUpdateAAIVfModuleRequest, isDebugLogEnabled) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preparePrepareUpdateAAIVfModule(): ' + e.getMessage()) - } - } - - /** - * Prepare a Request for invoking the ConfirmVolumeGroupTenant subflow. - * Determine cloud region id for the volume group. - * - * @param execution The flow's execution instance. - */ - public void prepConfirmVolumeGroupTenant(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepConfirmVolumeGroupTenant(' + - 'execution=' + execution.getId() + - ')' - - def prefix = execution.getVariable("prefix") - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - String cloudRegion = execution.getVariable(prefix + "aicCloudRegion") - - // Prepare AA&I url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUtil = new AaiUtil(this) - String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) - String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion - utils.logAudit("CloudRegion Request: " + queryCloudRegionRequest) - - execution.setVariable(prefix + "queryCloudRegionRequest", queryCloudRegionRequest) - utils.log("DEBUG", prefix + "queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest, isDebugLogEnabled) - - cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "AAI", cloudRegion) - - if ((cloudRegion != "ERROR")) { - if(execution.getVariable(prefix + "queryCloudRegionReturnCode") == "404"){ - execution.setVariable(prefix + "cloudRegionForVolume", "AAIAIC25") - }else{ - execution.setVariable(prefix + "cloudRegionForVolume", cloudRegion) - } - execution.setVariable(prefix + "isCloudRegionGood", true) - } else { - String errorMessage = "AAI Query Cloud Region Unsuccessful. AAI Response Code: " + execution.getVariable(prefix + "queryCloudRegionReturnCode") - utils.log("DEBUG", errorMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - execution.setVariable(prefix + "isCloudRegionGood", false) - } - utils.log("DEBUG", " is Cloud Region Good: " + execution.getVariable(prefix + "isCloudRegionGood"), isDebugLogEnabled) - - } catch(BpmnError b){ - utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugLogEnabled) - throw b - }catch (Exception e) { - // try error - String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + e.getMessage() - utils.log("ERROR", " AAI Query Cloud Region Failed. Exception - " + "\n" + errorMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during prepConfirmVolumeGroupTenant(): " + e.getMessage()) - } - logDebug('Exited ' + method, isDebugLogEnabled) - - } - - /** - * Prepare a Request for invoking the SDNC Adapter subflow to perform - * a VNF topology 'changeassign' operation. - * - * @param execution The flow's execution instance. - */ - public void prepSDNCTopologyChg(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepSDNCTopologyChg(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def requestId = execution.getVariable('DOUPVfMod_requestId') - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("DOUPVfMod_requestId") + "-" + System.currentTimeMillis() - } - def serviceInstanceId = execution.getVariable('DOUPVfMod_serviceInstanceId') - def callbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') - def serviceId = execution.getVariable('DOUPVfMod_serviceId') - def vnfId = execution.getVariable('DOUPVfMod_vnfId') - def vnfType = execution.getVariable('DOUPVfMod_vnfType') - def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId') - def vfModuleModelName = execution.getVariable('DOUPVfMod_vfModuleModelName') - def VfModule vfModule = (VfModule) execution.getVariable('DOUPVfMod_vfModule') - def vfModuleName = vfModule.getElementText('vf-module-name') - def tenantId = execution.getVariable('DOUPVfMod_tenantId') - def aicCloudRegion = execution.getVariable('DOUPVfMod_aicCloudRegion') - boolean usePreload = execution.getVariable("DOUPVfMod_usePreload") - String usePreloadToSDNC = usePreload ? "Y" : "N" - def modelCustomizationUuid = execution.getVariable("DoUPVfMod_modelCustomizationUuid") - def modelCustomizationUuidString = "" - if (!usePreload) { - modelCustomizationUuidString = "" + modelCustomizationUuid + "" - } - - // Retrieve vnf name from AAI response - def vnfName = execution.getVariable('DOUPVfMod_vnfNameFromAAI') - execution.setVariable('DOUPVfMod_vnfName', vnfName) - - def vnfParamsXml = execution.getVariable('DOUPVfMod_vnfParams') - def vnfNetworks = transformNetworkParamsToVnfNetworks(vnfParamsXml) - - String sdncTopologyRequest = """ - - - ${uuid} - ${serviceInstanceId} - changeassign - vnf-topology-operation - ${callbackUrl} - - - - ${requestId} - ChangeVNFActivateRequest - PORTAL - - - - - - ${serviceId} - ${vnfId} - dontcare - - - ${vfModuleId} - ${vfModuleModelName} - ${vfModuleName} - ${vnfId} - ${vnfName} - ${vnfType} - ${tenantId} - ${aicCloudRegion} - ${modelCustomizationUuidString} - ${usePreloadToSDNC} - ${vnfNetworks} - - - - """ - sdncTopologyRequest = utils.formatXml(sdncTopologyRequest) - execution.setVariable('DOUPVfMod_sdncChangeAssignRequest', sdncTopologyRequest) - utils.logAudit("sdncChangeAssignRequest : " + sdncTopologyRequest) - logDebug('Request for SDNCAdapter topology/changeassign:\n' + sdncTopologyRequest, isDebugLogEnabled) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyChg(): ' + e.getMessage()) - } - } - - /** - * Prepare a Request for invoking the SDNC Adapter subflow to perform - * a VNF topology 'query' operation. - * - * @param execution The flow's execution instance. - */ - public void prepSDNCTopologyQuery(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepSDNCTopologyQuery(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("DOUPVfMod_requestId") + "-" + System.currentTimeMillis() - } - def requestId = execution.getVariable('DOUPVfMod_requestId') - def serviceInstanceId = execution.getVariable('DOUPVfMod_serviceInstanceId') - def callbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') - def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId') - - def svcInstId = "" - if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { - svcInstId = vfModuleId - } - else { - svcInstId = serviceInstanceId - } - - //!!!! TEMPORARY WORKAROUND FOR SDNC REPLICATION ISSUE - sleep(5000) - - String sdncTopologyRequest = """ - - - ${uuid} - ${svcInstId} - query - /VNF-API:vnfs/vnf-list/${vfModuleId} - ${callbackUrl} - mobility - - - """ - sdncTopologyRequest = utils.formatXml(sdncTopologyRequest) - execution.setVariable('DOUPVfMod_sdncTopologyRequest', sdncTopologyRequest) - utils.logAudit("sdncTopologyRequest : " + sdncTopologyRequest) - logDebug('Request for SDNCAdapter query:\n' + sdncTopologyRequest, isDebugLogEnabled) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyQuery(): ' + e.getMessage()) - } - } - - /** - * Prepare a Request for invoking the VnfAdapterRest subflow. - * - * @param execution The flow's execution instance. - */ - public void prepVnfAdapterRest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepVnfAdapterRest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def requestId = execution.getVariable('DOUPVfMod_requestId') - def serviceInstanceId = execution.getVariable('DOUPVfMod_serviceInstanceId') - def vnfId = execution.getVariable('DOUPVfMod_vnfId') - def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId') - def vfModuleName = execution.getVariable('DOUPVfMod_vfModuleName') - def vnfInputs = execution.getVariable('DOUPVfMod_vnfInputs') - def tenantId = execution.getVariable('DOUPVfMod_tenantId') - def volumeGroupId = execution.getVariable('DOUPVfMod_volumeGroupId') - def volumeGroupStackId = execution.getVariable('DOUPVfMod_volumeGroupStackId') - def VfModule vfModule = (VfModule) execution.getVariable('DOUPVfMod_vfModule') - def heatStackId = vfModule.getElementText('heat-stack-id') - def cloudId = execution.getVariable('DOUPVfMod_aicCloudRegion') - def vnfType = execution.getVariable('DOUPVfMod_vnfType') - def vnfName = execution.getVariable('DOUPVfMod_vnfName') - def vfModuleModelName = execution.getVariable('DOUPVfMod_vfModuleModelName') - def baseVfModuleId = execution.getVariable("DOUPVfMod_baseVfModuleId") - def baseVfModuleStackId = execution.getVariable("DOUPVfMod_baseVfModuleHeatStackId") - def asdcServiceModelVersion = execution.getVariable('DOUPVfMod_asdcServiceModelVersion') - def modelCustomizationUuid = execution.getVariable('DOUPVfMod_modelCustomizationUuid') - def backoutOnFailure = execution.getVariable("DOUPVfMod_backoutOnFailure") - - def messageId = execution.getVariable('mso-request-id') + '-' + System.currentTimeMillis() - def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) - def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") - if ('true'.equals(useQualifiedHostName)) { - notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) - } - - String environmentContext = execution.getVariable("DOUPVEnvironment_context") - String workloadContext = execution.getVariable("DOUPVWorkload_context") - logDebug("workloadContext: " + workloadContext, isDebugLogEnabled) - logDebug("environmentContext: " + environmentContext, isDebugLogEnabled) - - Map vnfParamsMap = execution.getVariable("DOUPVfMod_vnfParamsMap") - - String sdncGetResponse = execution.getVariable('DOUPVfMod_sdncTopologyResponse') - - String vfModuleParams = buildVfModuleParams(vnfParamsMap, sdncGetResponse, vnfId, vnfName, - vfModuleId, vfModuleName, null, environmentContext, workloadContext) - - - String vnfAdapterRestRequest = """ - - ${cloudId} - ${tenantId} - ${vnfId} - ${vfModuleId} - ${heatStackId} - ${vnfType} - ${asdcServiceModelVersion} - ${modelCustomizationUuid} - ${vfModuleModelName} - ${volumeGroupId} - ${volumeGroupStackId} - ${baseVfModuleId} - ${baseVfModuleStackId} - true - ${backoutOnFailure} - false - - ${vfModuleParams} - - - ${requestId} - ${serviceInstanceId} - - ${messageId} - ${notificationUrl} - - """ - vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest) - execution.setVariable('DOUPVfMod_vnfAdapterRestRequest', vnfAdapterRestRequest) - utils.logAudit("vnfAdapterRestRequest : " + vnfAdapterRestRequest) - logDebug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest, isDebugLogEnabled) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage()) - } - } - - /** - * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. - * - * @param execution The flow's execution instance. - */ - public void prepUpdateAAIGenericVnf(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def vnfId = execution.getVariable('DOUPVfMod_vnfId') - def vnfInputs = execution.getVariable('DOUPVfMod_vnfInputs') - - def personaModelId = utils.getNodeText1(vnfInputs, 'vnf-persona-model-id') - def personaModelVersion = utils.getNodeText1(vnfInputs, 'vnf-persona-model-version') - if ((personaModelId == null) || (personaModelVersion == null)) { - logDebug('Skipping update for Generic VNF ' + vnfId + - ' because either \'vnf-persona-model-id\' or \'vnf-persona-model-version\' is absent', isDebugLogEnabled) - execution.setVariable('DOUPVfMod_skipUpdateGenericVnf', true) - } else { - def personaModelIdElement = '' + personaModelId + '' - def personaModelVersionElement = '' + personaModelVersion + '' - - String updateAAIGenericVnfRequest = """ - - ${vnfId} - ${personaModelIdElement} - ${personaModelVersionElement} - - """ - updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) - execution.setVariable('DOUPVfMod_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) - utils.logAudit("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) - logDebug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest, isDebugLogEnabled) - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) - } - } - - /** - * Prepare a Request for invoking the UpdateAAIVfModule subflow. - * - * @param execution The flow's execution instance. - */ - public void prepUpdateAAIVfModule(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepUpdateAAIVfModule(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def vnfId = execution.getVariable('DOUPVfMod_vnfId') - def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId') - def orchestrationStatus = 'updated' - def vnfInputs = execution.getVariable('DOUPVfMod_vnfInputs') - - def volumeGroupIdElement = '' - def volumeGroupId = execution.getVariable('DOUPVfMod_volumeGroupId') - if (volumeGroupId != null) { - volumeGroupIdElement = '' + volumeGroupId + '' - } - def personaModelIdElement = '' - def personaModelId = utils.getNodeText1(vnfInputs, 'persona-model-id') - if (personaModelId != null) { - personaModelIdElement = '' + personaModelId + '' - } - def personaModelVersionElement = '' - def personaModelVersion = utils.getNodeText1(vnfInputs, 'persona-model-version') - if (personaModelVersion != null) { - personaModelVersionElement = '' + personaModelVersion + '' - } - def contrailServiceInstanceFqdnElement = '' - def contrailServiceInstanceFqdn = utils.getNodeText1(vnfInputs, 'contrail-service-instance-fqdn') - if (contrailServiceInstanceFqdn != null) { - contrailServiceInstanceFqdnElement = '' + contrailServiceInstanceFqdn + '' - } - def personaModelCustomizationIdElement = '' - def modelCustomizationId = execution.getVariable('DOUPVfMod_modelCustomizationUuid') - if (modelCustomizationId != null) { - personaModelCustomizationIdElement = '' + modelCustomizationId + '' - } - - String updateAAIVfModuleRequest = """ - - ${vnfId} - ${vfModuleId} - ${orchestrationStatus} - ${volumeGroupIdElement} - ${personaModelIdElement} - ${personaModelVersionElement} - ${contrailServiceInstanceFqdnElement} - ${personaModelCustomizationIdElement} - - """ - - logDebug('Unformatted updateAAIVfModuleRequest: ' + updateAAIVfModuleRequest, isDebugLogEnabled) - updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest) - execution.setVariable('DOUPVfMod_updateAAIVfModuleRequest', updateAAIVfModuleRequest) - utils.logAudit("updateAAIVfModuleRequest : " + updateAAIVfModuleRequest) - logDebug('Request for UpdateAAIVfModule:\n' + updateAAIVfModuleRequest, isDebugLogEnabled) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIVfModule(): ' + e.getMessage()) - } - } - - /** - * Prepare a Request for invoking the SDNC Adapter subflow to perform - * a VNF topology 'activate' operation. - * - * @param execution The flow's execution instance. - */ - public void prepSDNCTopologyAct(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepSDNCTopologyAct(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - String uuid = execution.getVariable('testReqId') // for junits - if(uuid==null){ - uuid = execution.getVariable("DOUPVfMod_requestId") + "-" + System.currentTimeMillis() - } - def requestId = execution.getVariable('DOUPVfMod_requestId') - def serviceInstanceId = execution.getVariable('DOUPVfMod_serviceInstanceId') - def callbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') - def serviceId = execution.getVariable('DOUPVfMod_serviceId') - def vnfId = execution.getVariable('DOUPVfMod_vnfId') - def vnfName = execution.getVariable('DOUPVfMod_vnfName') - def vnfType = execution.getVariable('DOUPVfMod_vnfType') - def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId') - def vfModuleModelName = execution.getVariable('DOUPVfMod_vfModuleModelName') - def VfModule vfModule = (VfModule) execution.getVariable('DOUPVfMod_vfModule') - def vfModuleName = vfModule.getElementText('vf-module-name') - def tenantId = execution.getVariable('DOUPVfMod_tenantId') - def aicCloudRegion = execution.getVariable('DOUPVfMod_aicCloudRegion') - - boolean usePreload = execution.getVariable("DOUPVfMod_usePreload") - String usePreloadToSDNC = usePreload ? "Y" : "N" - def modelCustomizationUuid = execution.getVariable("DoUPVfMod_modelCustomizationUuid") - def modelCustomizationUuidString = "" - if (!usePreload) { - modelCustomizationUuidString = "" + modelCustomizationUuid + "" - } - - def vnfParamsXml = execution.getVariable('DOUPVfMod_vnfParams') - def vnfNetworks = transformNetworkParamsToVnfNetworks(vnfParamsXml) - - String sdncTopologyRequest = """ - - - ${uuid} - ${serviceInstanceId} - activate - vnf-topology-operation - ${callbackUrl} - - - - ${requestId} - ChangeVNFActivateRequest - PORTAL - - - - - - ${serviceId} - ${vnfId} - dontcare - - - ${vfModuleId} - ${vfModuleModelName} - ${vfModuleName} - ${vnfId} - ${vnfName} - ${vnfType} - ${tenantId} - ${aicCloudRegion} - ${modelCustomizationUuidString} - ${usePreloadToSDNC} - - - - """ - sdncTopologyRequest = utils.formatXml(sdncTopologyRequest) - execution.setVariable('DOUPVfMod_sdncActivateRequest', sdncTopologyRequest) - utils.logAudit("sdncActivateRequest : " + sdncTopologyRequest) - logDebug('Request for SDNCAdapter topology/activate:\n' + sdncTopologyRequest, isDebugLogEnabled) - - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyAct(): ' + e.getMessage()) - } - } - - /** - * Log a WorkflowException that has been created. - * - * @param execution The flow's execution instance. - */ - public void handleWorkflowException(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.handleWorkflowException(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def WorkflowException workflowException = (WorkflowException) execution.getVariable('WorkflowException') - logError(method + ' caught WorkflowException: ' + workflowException.getErrorMessage()) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 1002, 'Error in handleWorkflowException(): ' + e.getMessage()) - } - } - - public void validateSDNCResponse(DelegateExecution execution, String response, String method){ - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - def prefix = execution.getVariable("prefix") - - logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled) - - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - utils.logAudit("workflowException: " + workflowException) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - utils.logAudit("SDNCResponse: " + response) - - String sdncResponse = response - if(execution.getVariable(prefix + 'sdncResponseSuccess') == true){ - logDebug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse, isDebugLogEnabled) - }else{ - logDebug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) - throw new BpmnError("MSOWorkflowException") - } - logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled) - } - - /** - * Using the received vnfId and vfModuleId, query AAI to get the corresponding VNF info. - * A 200 response is expected with the VNF info in the response body. Will find out the base module info. - * - * @param execution The flow's execution instance. - */ - public void queryAAIVfModule(DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - def method = getClass().getSimpleName() + '.getVfModule(' + - 'execution=' + execution.getId() + - ')' - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def vnfId = execution.getVariable('DOUPVfMod_vnfId') - def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId') - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - - String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" - utils.logAudit("AAI endPoint: " + endPoint) - - try { - def aaiRequestId = UUID.randomUUID().toString() - logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint) - utils.logAudit("createVfModule - invoking httpGet() to AAI") - - def responseData = response.getResponseBodyAsString() - if (responseData != null) { - logDebug("Received generic VNF data: " + responseData, isDebugLogEnabled) - - } - - utils.logAudit("createVfModule - queryAAIVfModule Response: " + responseData) - utils.logAudit("createVfModule - queryAAIVfModule ResponseCode: " + response.getStatusCode()) - - execution.setVariable('DOUPVfMod_queryAAIVfModuleResponseCode', response.getStatusCode()) - execution.setVariable('DOUPVfMod_queryAAIVfModuleResponse', responseData) - logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) - logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) - if (response.getStatusCode() == 200) { - // Parse the VNF record from A&AI to find base module info - logDebug('Parsing the VNF data to find base module info', isDebugLogEnabled) - if (responseData != null) { - def vfModulesText = utils.getNodeXml(responseData, "vf-modules") - def xmlVfModules= new XmlSlurper().parseText(vfModulesText) - def vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} - int vfModulesSize = 0 - for (i in 0..vfModules.size()-1) { - def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i]) - def isBaseVfModule = utils.getNodeText(vfModuleXml, "is-base-vf-module") - - if (isBaseVfModule == "true") { - String baseModuleId = utils.getNodeText1(vfModuleXml, "vf-module-id") - execution.setVariable("DOUPVfMod_baseVfModuleId", baseModuleId) - logDebug('Received baseVfModuleId: ' + baseModuleId, isDebugLogEnabled) - String baseModuleHeatStackId = utils.getNodeText1(vfModuleXml, "heat-stack-id") - execution.setVariable("DOUPVfMod_baseVfModuleHeatStackId", baseModuleHeatStackId) - logDebug('Received baseVfModuleHeatStackId: ' + baseModuleHeatStackId, isDebugLogEnabled) - } - } - } - } - } catch (Exception ex) { - ex.printStackTrace() - logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) - } - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) - } - } - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy deleted file mode 100644 index 5d1bc01f1e..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy +++ /dev/null @@ -1,416 +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.bpmn.infrastructure.scripts - -import java.io.ObjectInputStream.BlockDataInputStream -import java.util.UUID; - -import org.json.JSONObject; -import org.json.JSONArray; -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.hibernate.jpa.criteria.predicate.IsEmptyPredicate - -import static org.apache.commons.lang3.StringUtils.*; - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.ModuleResource -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.core.WorkflowException -import org.springframework.web.util.UriUtils; - -/** - * This class supports the VID Flow - * with the update of a generic vnf and related VF modules. - */ -class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { - - String Prefix="DUVAM_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - /** - * This method gets and validates the incoming - * request. - * - * @param - execution - * - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED DoUpdateVnfAndModules PreProcessRequest Process*** ", isDebugEnabled) - - try{ - // Get Variables - - String requestId = execution.getVariable("msoRequestId") - execution.setVariable("requestId", requestId) - execution.setVariable("mso-request-id", requestId) - utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - - String vnfId = execution.getVariable("vnfId") - utils.log("DEBUG", "Incoming Vnf Id is: " + vnfId, isDebugEnabled) - - String source = "VID" - execution.setVariable("DUVAM_source", source) - utils.log("DEBUG", "Incoming Source is: " + source, isDebugEnabled) - - String sdncVersion = execution.getVariable("sdncVersion") - if (sdncVersion == null) { - sdncVersion = "1702" - } - execution.setVariable("DUVAM_sdncVersion", sdncVersion) - utils.log("DEBUG", "Incoming Sdnc Version is: " + sdncVersion, isDebugEnabled) - - VnfResource vnfResource = (VnfResource) execution.getVariable("vnfResourceDecomposition") - - String vnfModelInfo = execution.getVariable("vnfModelInfo") - String serviceModelInfo = execution.getVariable("serviceModelInfo") - - String serviceId = execution.getVariable("productFamilyId") - execution.setVariable("DUVAM_serviceId", serviceId) - utils.log("DEBUG", "Incoming Service Id is: " + serviceId, isDebugEnabled) - - String modelUuid = jsonUtil.getJsonValue(vnfModelInfo, "modelUuid") - execution.setVariable("DUVAM_modelUuid", modelUuid) - utils.log("DEBUG", "Incoming modelUuid is: " + modelUuid, isDebugEnabled) - - String modelCustomizationUuid = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationUuid") - execution.setVariable("DUVAM_modelCustomizationUuid", modelCustomizationUuid) - utils.log("DEBUG", "Incoming Model Customization Uuid is: " + modelCustomizationUuid, isDebugEnabled) - - String cloudSiteId = execution.getVariable("lcpCloudRegionId") - execution.setVariable("DUVAM_cloudSiteId", cloudSiteId) - utils.log("DEBUG", "Incoming Cloud Site Id is: " + cloudSiteId, isDebugEnabled) - - String tenantId = execution.getVariable("tenantId") - execution.setVariable("DUVAM_tenantId", tenantId) - utils.log("DEBUG", "Incoming Tenant Id is: " + tenantId, isDebugEnabled) - - String globalSubscriberId = execution.getVariable("globalSubscriberId") - if (globalSubscriberId == null) { - globalSubscriberId = "" - } - execution.setVariable("DUVAM_globalSubscriberId", globalSubscriberId) - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - - execution.setVariable("DUVAM_moduleCount", 0) - execution.setVariable("DUVAM_nextModule", 0) - - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", " Error Occured in DoUpdateVnfAndModules PreProcessRequest method!" + e.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoUpdateVnfAndModules PreProcessRequest") - - } - utils.log("DEBUG", "*** COMPLETED DoUpdateVnfAndModules PreProcessRequest Process ***", isDebugEnabled) - } - - /** - * Using the received vnfId and vfModuleId, query AAI to get the corresponding VNF info. - * A 200 response is expected with the VNF info in the response body. Will find out the base module info. - * - * @param execution The flow's execution instance. - */ - public void queryAAIVfModule(DelegateExecution execution) { - def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") - def method = getClass().getSimpleName() + '.queryAAIVfModule(' + - 'execution=' + execution.getId() + - ')' - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def vnfId = execution.getVariable('vnfId') - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - - String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" - utils.logAudit("AAI endPoint: " + endPoint) - - try { - RESTConfig config = new RESTConfig(endPoint); - def responseData = '' - def aaiRequestId = UUID.randomUUID().toString() - RESTClient client = new RESTClient(config). - addHeader('X-TransactionId', aaiRequestId). - addHeader('X-FromAppId', 'MSO'). - addHeader('Content-Type', 'application/xml'). - addHeader('Accept','application/xml'); - logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) - APIResponse response = client.httpGet() - utils.logAudit("createVfModule - invoking httpGet() to AAI") - - responseData = response.getResponseBodyAsString() - if (responseData != null) { - logDebug("Received generic VNF data: " + responseData, isDebugLogEnabled) - - } - - utils.logAudit("createVfModule - queryAAIVfModule Response: " + responseData) - utils.logAudit("createVfModule - queryAAIVfModule ResponseCode: " + response.getStatusCode()) - - execution.setVariable('DUVAM_queryAAIVfModuleResponseCode', response.getStatusCode()) - execution.setVariable('DUVAM_queryAAIVfModuleResponse', responseData) - logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) - logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) - //Map[] vfModules = new HashMap[] - def vfModulesList = new ArrayList>() - def vfModules = null - def vfModuleBaseEntry = null - if (response.getStatusCode() == 200) { - // Parse the VNF record from A&AI to find base module info - logDebug('Parsing the VNF data to find base module info', isDebugLogEnabled) - if (responseData != null) { - def vfModulesText = utils.getNodeXml(responseData, "vf-modules") - logDebug("vModulesText: " + vfModulesText, isDebugLogEnabled) - if (vfModulesText != null && !vfModulesText.trim().isEmpty()) { - def xmlVfModules= new XmlSlurper().parseText(vfModulesText) - vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} - execution.setVariable("DUVAM_moduleCount", vfModules.size()) - int vfModulesSize = 0 - for (i in 0..vfModules.size()-1) { - def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i]) - - Map vfModuleEntry = new HashMap() - def vfModuleId = utils.getNodeText1(vfModuleXml, "vf-module-id") - vfModuleEntry.put("vfModuleId", vfModuleId) - def vfModuleName = utils.getNodeText1(vfModuleXml, "vf-module-name") - vfModuleEntry.put("vfModuleName", vfModuleName) - def modelInvariantUuid = utils.getNodeText1(vfModuleXml, "model-invariant-id") - vfModuleEntry.put("modelInvariantUuid", modelInvariantUuid) - def modelUuid = utils.getNodeText1(vfModuleXml, "model-version-id") - vfModuleEntry.put("modelUuid", modelUuid) - def modelCustomizationUuid = utils.getNodeText1(vfModuleXml, "model-customization-id") - vfModuleEntry.put("modelCustomizationUuid", modelCustomizationUuid) - - def isBaseVfModule = utils.getNodeText(vfModuleXml, "is-base-vf-module") - vfModuleEntry.put("isBaseVfModule", isBaseVfModule) - - String volumeGroupId = '' - - logDebug("Next module!", isDebugLogEnabled) - def vfModuleRelationships = vfModules[i].'**'.findAll {it.name() == 'relationship-data'} - if (vfModuleRelationships.size() > 0) { - for (j in 0..vfModuleRelationships.size()-1) { - if (vfModuleRelationships[j] != null) { - - def relationshipKey = vfModuleRelationships[j].'**'.findAll {it.name() == 'relationship-key'} - - if (relationshipKey[0] == 'volume-group.volume-group-id') { - def relationshipValue = vfModuleRelationships[j].'**'.findAll {it.name() == 'relationship-value'} - volumeGroupId = relationshipValue[0] - break - } - } - } - } - - vfModuleEntry.put("volumeGroupId", volumeGroupId) - logDebug("volumeGroupId is: " + volumeGroupId, isDebugLogEnabled) - - // Save base vf module to add it to the start of the list later - if (isBaseVfModule == "true") { - vfModuleBaseEntry = vfModuleEntry - } - else { - vfModulesList.add(vfModuleEntry) - } - } - // Start the list with the base module if any - if (vfModuleBaseEntry != null) { - vfModulesList.add(0, vfModuleBaseEntry) - } - } - - } - } - else { - logDebug('Response code from AAI GET is: ' + response.getStatusCode(), isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Response code from AAI GET is: ' + response.getStatusCode()) - } - execution.setVariable("DUVAM_vfModules", vfModulesList) - } catch (Exception ex) { - ex.printStackTrace() - logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) - } - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) - } - } - - public void prepareNextModuleToUpdate(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - logDebug(" ======== STARTED prepareNextModuleToUpdate ======== ", isDebugLogEnabled) - - try { - int i = execution.getVariable("DUVAM_nextModule") - def vfModules = execution.getVariable("DUVAM_vfModules") - def vfModule = vfModules[i] - - def vfModuleId = vfModule.get("vfModuleId") - execution.setVariable("DUVAM_vfModuleId", vfModuleId) - - def vfModuleName = vfModule.get("vfModuleName") - execution.setVariable("DUVAM_vfModuleName", vfModuleName) - - def isBaseVfModule = vfModule.get("isBaseVfModule") - execution.setVariable("DUVAM_isBaseVfModule", isBaseVfModule) - - String modelInvariantUuid = vfModule.get("modelInvariantUuid") - logDebug("ModelInvariantUuid: " + modelInvariantUuid, isDebugLogEnabled) - - def volumeGroupId = vfModule.get("volumeGroupId") - execution.setVariable("DUVAM_volumeGroupId", volumeGroupId) - - execution.setVariable("DUVAM_volumeGroupName", "") - - VnfResource vnfResource = (VnfResource) execution.getVariable("vnfResourceDecomposition") - List moduleResources = vnfResource.getVfModules() - - for (j in 0..moduleResources.size()-1) { - ModelInfo modelInfo = moduleResources[j].getModelInfo() - String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid() - logDebug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition, isDebugLogEnabled) - - if (modelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { - String vfModuleModelInfo = modelInfo.toJsonString() - String vfModuleModelInfoValue = jsonUtil.getJsonValue(vfModuleModelInfo, "modelInfo") - execution.setVariable("DUVAM_vfModuleModelInfo", vfModuleModelInfoValue) - logDebug("vfModuleModelInfo: " + vfModuleModelInfoValue, isDebugLogEnabled) - break - } - - } - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToUpdate Method:\n" + e.getMessage()) - } - logDebug("======== COMPLETED prepareNextModuleToUpdate ======== ", isDebugLogEnabled) - } - - - /** - * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. - * - * @param execution The flow's execution instance. - */ - public void prepUpdateAAIGenericVnf(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def vnfId = execution.getVariable('vnfId') - VnfResource vnfResource = (VnfResource) execution.getVariable("vnfResourceDecomposition") - ModelInfo vnfDecompModelInfo = vnfResource.getModelInfo() - String vnfModelInfo = execution.getVariable("vnfModelInfo") - String modelUuid = execution.getVariable("DUVAM_modelUuid") - if (modelUuid == null || modelUuid.isEmpty()) { - modelUuid = vnfDecompModelInfo.getModelUuid() - } - String modelCustomizationUuid = execution.getVariable("DUVAM_modelCustomizationUuid") - if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { - modelCustomizationUuid = vnfDecompModelInfo.getModelCustomizationUuid() - } - String nfType = vnfResource.getNfType() - String nfTypeString = '' - if (nfType != null && !nfType.isEmpty()) { - nfTypeString = "" + nfType + "" - } - String nfRole = vnfResource.getNfRole() - String nfRoleString = '' - if (nfRole != null && !nfRole.isEmpty()) { - nfRoleString = "" + nfRole + "" - } - String nfFunction = vnfResource.getNfFunction() - String nfFunctionString = '' - if (nfFunction != null && !nfFunction.isEmpty()) { - nfFunctionString = "" + nfFunction + "" - } - String nfNamingCode = vnfResource.getNfNamingCode() - String nfNamingCodeString = '' - if (nfNamingCode != null && !nfNamingCode.isEmpty()) { - nfNamingCodeString = "" + nfNamingCode + "" - } - - String updateAAIGenericVnfRequest = """ - - ${vnfId} - ${modelUuid} - ${modelCustomizationUuid} - ${nfTypeString} - ${nfRoleString} - ${nfFunctionString} - ${nfNamingCodeString} - - """ - updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) - execution.setVariable('DUVAM_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) - utils.logAudit("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) - logDebug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest, isDebugLogEnabled) - - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) - } - } - - /** - * APP-C Call - placeholder. - * - * @param execution The flow's execution instance. - */ - public void callAppCf(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.callAppC(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/HealchCheckActivate.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/HealchCheckActivate.groovy deleted file mode 100644 index 3ab1b17392..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/HealchCheckActivate.groovy +++ /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.bpmn.infrastructure.scripts; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.apache.commons.lang3.* - -public class HealthCheckActivate extends AbstractServiceTaskProcessor { - - - /** - * Validates the request message and sets up the workflow. - * @param execution the execution - */ - public void preProcessRequest(DelegateExecution execution) { - - } - - - /** - * Sends the synchronous response back to the API Handler. - * @param execution the execution - */ - public void sendResponse(DelegateExecution execution) { - def status = execution.getVariable("healthyStatus") - def healthcheckmessage = execution.getVariable("healthcheckmessage") - if (status == "true") { - sendWorkflowResponse(execution, 200, healthcheckmessage) - }else{ - sendWorkflowResponse(execution, 503, healthcheckmessage) - } - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy deleted file mode 100644 index a9cc776ab6..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy +++ /dev/null @@ -1,626 +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.bpmn.infrastructure.scripts - -import groovy.json.JsonOutput -import groovy.json.JsonSlurper -import groovy.util.Node -import groovy.util.XmlParser; -import groovy.xml.QName - -import java.io.Serializable; -import java.util.UUID; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.client.aai.* - -import org.openecomp.mso.client.appc.ApplicationControllerOrchestrator -import org.onap.appc.client.lcm.model.Action; -import org.onap.appc.client.lcm.model.ActionIdentifiers; -import org.onap.appc.client.lcm.model.LockInput -import org.onap.appc.client.lcm.model.UnlockInput -import org.onap.appc.client.lcm.model.HealthCheckInput -import org.onap.appc.client.lcm.model.StartInput -import org.onap.appc.client.lcm.model.Flags -import org.onap.appc.client.lcm.model.Status - - - -public class ReplaceVnfInfra extends VnfCmBase { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtils = new JsonUtils() - def prefix = "RPLVnfI_" - - /** - * Initialize the flow's variables. - * - * @param execution The flow's execution instance. - */ - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable('prefix', 'RPLVnfI_') - execution.setVariable('Request', null) - execution.setVariable('requestInfo', null) - execution.setVariable('source', null) - execution.setVariable('vnfInputs', null) - execution.setVariable('tenantId', null) - execution.setVariable('vnfParams', null) - execution.setVariable('controllerType', null) - execution.setVariable('cloudConfiguration', null) - execution.setVariable('ReplaceVnfSuccessIndicator', false) - execution.setVariable('serviceType', null) - execution.setVariable('nfRole', null) - execution.setVariable('currentActivity', 'RPLVnfI') - execution.setVariable('workStep', null) - execution.setVariable('failedActivity', null) - execution.setVariable('errorCode', "0") - execution.setVariable('errorText', null) - execution.setVariable('healthCheckIndex', 1) - execution.setVariable('retainResources', true) - execution.setVariable('productFamilyId', null) - execution.setVariable('healthCheckIndex0', 0) - execution.setVariable('healthCheckIndex1', 1) - execution.setVariable("rollbackSetClosedLoopDisabledFlag", false) - execution.setVariable("rollbackVnfStop", false) - execution.setVariable("rollbackVnfLock", false) - execution.setVariable("rollbackQuiesceTraffic", false) - execution.setVariable("rollbackSetVnfInMaintenanceFlag", false) - } - - /** - * Check for missing elements in the received request. - * - * @param execution The flow's execution instance. - */ - public void preProcessRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - initProcessVariables(execution) - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - initProcessVariables(execution) - - def incomingRequest = execution.getVariable('bpmnRequest') - - utils.log("DEBUG", "Incoming Infra Request: " + incomingRequest, isDebugLogEnabled) - try { - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - Map reqMap = jsonSlurper.parseText(incomingRequest) - utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled) - - def serviceInstanceId = execution.getVariable('serviceInstanceId') - def vnfId = execution.getVariable('vnfId') - - execution.setVariable('serviceInstanceId', serviceInstanceId) - execution.setVariable("isVidRequest", "true") - execution.setVariable('serviceType', 'Mobility') - execution.setVariable('retainResources', true) - execution.setVariable('disableRollback', true) - execution.setVariable('payload', "") - execution.setVariable('actionLock', Action.Lock) - execution.setVariable('actionUnlock', Action.Unlock) - execution.setVariable('actionHealthCheck', Action.HealthCheck) - execution.setVariable('actionStart', Action.Start) - execution.setVariable('actionStop', Action.Stop) - - def asdcServiceModelVersion = '' - def serviceModelInfo = null - - def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList - - if (relatedInstanceList != null) { - relatedInstanceList.each { - if (it.relatedInstance.modelInfo?.modelType == 'service') { - utils.log("DEBUG", "PROCESSING SERVICE INFO", isDebugLogEnabled) - asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion - serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) - utils.log("DEBUG", "ServiceModelInfo: " + serviceModelInfo, isDebugLogEnabled) - def modelInvariant = jsonUtils.getJsonValue(serviceModelInfo, "modelInvariantUuid") - utils.log("DEBUG", "modelInvariant: " + modelInvariant, isDebugLogEnabled) - } - - } - } - - execution.setVariable('asdcServiceModelVersion', asdcServiceModelVersion) - execution.setVariable('serviceModelInfo', serviceModelInfo) - def vnfModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo) - execution.setVariable('vnfModelInfo', vnfModelInfo) - def vnfModelInvariantUuid = jsonUtils.getJsonValue(vnfModelInfo, "modelInvariantUuid") - execution.setVariable('vnfModelInvariantUuid', vnfModelInvariantUuid) - logDebug("vnfModelInvariantUuid: " + vnfModelInvariantUuid, isDebugLogEnabled) - - def vnfType = execution.getVariable('vnfType') - execution.setVariable('vnfType', vnfType) - - def controllerType = reqMap.requestDetails?.requestParameters?.controllerType - execution.setVariable('controllerType', controllerType) - - utils.log("DEBUG", 'Controller Type: ' + controllerType, isDebugLogEnabled) - - def userParams = reqMap.requestDetails?.requestParameters?.userParams - - Map userParamsMap = [:] - if (userParams != null) { - userParams.each { userParam -> - userParamsMap.put(userParam.name, userParam.value.toString()) - } - } - - utils.log("DEBUG", 'Processed user params: ' + userParamsMap, isDebugLogEnabled) - - execution.setVariable('vfModuleInputParams', userParamsMap) - - def requestId = execution.getVariable("requestId") - execution.setVariable('msoRequestId', requestId) - utils.log("DEBUG", "requestId is: " + requestId, isDebugLogEnabled) - - def vnfName = reqMap.requestDetails?.requestInfo?.instanceName ?: null - execution.setVariable('vnfName', vnfName) - - def requestorId = reqMap.requestDetails?.requestInfo?.requestorId ?: null - execution.setVariable('requestorId', requestorId) - - def usePreload = reqMap.requestDetails?.requestParameters?.usePreload - execution.setVariable('usePreload', usePreload) - - def productFamilyId = reqMap.requestDetails?.requestInfo?.productFamilyId ?: null - execution.setVariable('productFamilyId', productFamilyId) - - def cloudConfiguration = jsonOutput.toJson(reqMap.requestDetails?.cloudConfiguration) - execution.setVariable('cloudConfiguration', cloudConfiguration) - def lcpCloudRegionId = jsonUtils.getJsonValue(cloudConfiguration, "lcpCloudRegionId") - execution.setVariable('lcpCloudRegionId', lcpCloudRegionId) - def tenantId = jsonUtils.getJsonValue(cloudConfiguration, "tenantId") - execution.setVariable('tenantId', tenantId) - - def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: '' - execution.setVariable('globalSubscriberId', globalSubscriberId) - - execution.setVariable('sdncVersion', '1702') - - execution.setVariable("ReplaceVnfInfraSuccessIndicator", false) - - execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) - - def source = reqMap.requestDetails?.requestInfo?.source - execution.setVariable("source", source) - - //For Completion Handler & Fallout Handler - String requestInfo = - """ - ${requestId} - REPLACE - ${source} - """ - - execution.setVariable("requestInfo", requestInfo) - - logDebug('RequestInfo: ' + execution.getVariable("requestInfo"), isDebugLogEnabled) - - logDebug('Exited ' + method, isDebugLogEnabled) - - } - catch(groovy.json.JsonException je) { - utils.log("DEBUG", " Request is not in JSON format.", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") - - } - catch(Exception e) { - String restFaultMessage = e.getMessage() - utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) - } - } - - /** - * Prepare and send the sychronous response for this flow. - * - * @param execution The flow's execution instance. - */ - public void sendSynchResponse(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sendSynchResponse(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - - try { - def requestInfo = execution.getVariable('requestInfo') - def requestId = execution.getVariable('requestId') - def source = execution.getVariable('source') - def progress = getNodeTextForce(requestInfo, 'progress') - if (progress.isEmpty()) { - progress = '0' - } - def startTime = getNodeTextForce(requestInfo, 'start-time') - if (startTime.isEmpty()) { - startTime = System.currentTimeMillis() - } - - // RESTResponse (for API Handler (APIH) Reply Task) - def vnfId = execution.getVariable("vnfId") - String synchResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() - - sendWorkflowResponse(execution, 200, synchResponse) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) - } - } - - - - /** - * Get VnfResource decomposition object for this VNF. - * - * - * @param execution The flow's execution instance. - */ - public void getVnfResourceDecomposition(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.getVnfResourceDecomposition(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid') - logDebug("vnfModelInvariantUuid: " + vnfModelInvariantUuid, isDebugLogEnabled) - List vnfResources = serviceDecomposition.getServiceVnfs() - - for (i in 0..vnfResources.size()-1) { - ModelInfo modelInfo = vnfResources[i].getModelInfo() - String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid() - logDebug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition, isDebugLogEnabled) - - if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { - VnfResource vnfResourceDecomposition = vnfResources[i] - execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition) - def nfRole = vnfResourceDecomposition.getNfRole() - execution.setVariable('nfRole', nfRole) - logDebug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString(), isDebugLogEnabled) - break - } - else { - //exception! - } - - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage()) - } - } - - /** - * Check if this VNF is already in maintenance in A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void checkIfVnfInMaintInAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - execution.setVariable("workStep", "checkIfVnfInMaintInAAI") - execution.setVariable("failedActivity", "AAI") - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - AAIRestClientImpl client = new AAIRestClientImpl() - AAIValidatorImpl aaiValidator = new AAIValidatorImpl() - aaiValidator.setClient(client) - def vnfId = execution.getVariable("vnfId") - boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid) - logDebug("isInMaint result: " + isInMaint, isDebugLogEnabled) - execution.setVariable('isVnfInMaintenance', isInMaint) - - if (isInMaint) { - execution.setVariable("errorCode", "1003") - execution.setVariable("errorText", "VNF is in maintenance in A&AI") - } - - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) - } - } - - - /** - * Check if this VNF's pservers are locked in A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void checkIfPserversInMaintInAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("workStep", "checkIfPserversInMaintInAAI") - execution.setVariable("failedActivity", "AAI") - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - AAIRestClientImpl client = new AAIRestClientImpl() - AAIValidatorImpl aaiValidator = new AAIValidatorImpl() - aaiValidator.setClient(client) - def vnfId = execution.getVariable("vnfId") - boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid) - logDebug("areLocked result: " + areLocked, isDebugLogEnabled) - execution.setVariable('arePserversLocked', areLocked) - - if (areLocked) { - execution.setVariable("errorCode", "1003") - execution.setVariable("errorText", "pServers are locked in A&AI") - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) - } - } - - /** - * Set inMaint flag for this VNF to the specified value in A&AI. - * - * - * @param execution The flow's execution instance. - * @param inMaint The boolean value of the flag to set - */ - public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) { - def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - if (inMaint) { - execution.setVariable("workStep", "setVnfInMaintFlagInAAI") - } - else { - execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI") - } - execution.setVariable("failedActivity", "AAI") - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - AAIRestClientImpl client = new AAIRestClientImpl() - AAIUpdatorImpl aaiUpdator = new AAIUpdatorImpl() - aaiUpdator.setClient(client) - def vnfId = execution.getVariable("vnfId") - if (inMaint) { - aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid) - execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) - } - else { - aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid) - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage()) - } - } - - /** - * Call APP-C client to execute specified APP-C command for this VNF. - * - * - * @param execution The flow's execution instance. - * @param action The action to take in APP-C. - */ - public void runAppcCommand(DelegateExecution execution, Action action) { - def method = getClass().getSimpleName() + '.runAppcCommand(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - logDebug("Running APP-C action: " + action.toString(), isDebugLogEnabled) - String vnfId = execution.getVariable('vnfId') - String msoRequestId = execution.getVariable('requestId') - execution.setVariable('msoRequestId', msoRequestId) - execution.setVariable("failedActivity", "APP-C") - execution.setVariable("workStep", action.toString() + "VNF") - - ApplicationControllerOrchestrator appcClient = new ApplicationControllerOrchestrator() - Status appcStatus = null - switch(action) { - case Action.Lock: - execution.setVariable('workStep', "LockVNF") - appcStatus = appcClient.runCommand(Action.Lock,msoRequestId,vnfId,null) - break - case Action.Unlock: - execution.setVariable('workStep', "UnlockVNF") - appcStatus = appcClient.runCommand(Action.Unlock,msoRequestId,vnfId,null) - break - case Action.HealthCheck: - def healthCheckIndex = execution.getVariable('healthCheckIndex') - execution.setVariable('workStep', "HealthCheckVNF" + healthCheckIndex) - execution.setVariable('healthCheckIndex', healthCheckIndex + 1) - appcStatus = appcClient.runCommand(Action.HealthCheck,msoRequestId,vnfId,null) - break - case Action.Start: - execution.setVariable('workStep', "StartVNF") - appcStatus = appcClient.runCommand(Action.Start,msoRequestId,vnfId,null) - break - case Action.Stop: - execution.setVariable('workStep', "StopVNF") - appcStatus = appcClient.runCommand(Action.Stop,msoRequestId,vnfId,null) - break - default: - break - } - logDebug("Completed AppC request", isDebugLogEnabled) - int appcCode = appcStatus.getCode() - logDebug("AppC status code is: " + appcCode, isDebugLogEnabled) - logDebug("AppC status message is: " + appcStatus.getMessage(), isDebugLogEnabled) - if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) { - execution.setVariable("errorCode", Integer.toString(appcCode)) - execution.setVariable("errorText", appcStatus.getMessage()) - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - } catch (java.lang.NoSuchMethodError e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - } - } - - - - /** - * Prepare DoDeleteVnfAndModules call. - * - * - * @param execution The flow's execution instance. - */ - public void prepDoDeleteVnfAndModules(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepDoDeleteVnfAndModules(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("workStep", "doDeleteVnfAndModules") - execution.setVariable("failedActivity", "MSO Delete VNF") - logDebug('Exited ' + method, isDebugLogEnabled) - - } - - /** - * Prepare DoCreateVnfAndModules call. - * - * - * @param execution The flow's execution instance. - */ - public void prepDoCreateVnfAndModules(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepDoReplaceVnfAndModules(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("workStep", "doCreateVnfAndModules") - execution.setVariable("failedActivity", "MSO Create VNF") - logDebug('Exited ' + method, isDebugLogEnabled) - - } - - - /** - * Handle Abort disposition from RainyDayHandler - * - * @param execution The flow's execution instance. - */ - public void abortProcessing(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.abortProcessing(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - def errorText = execution.getVariable("errorText") - def errorCode = execution.getVariable("errorCode") - - exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText) - } - - /** - * Handle Manual disposition from RainyDayHandler - * - * @param execution The flow's execution instance. - */ - public void manualProcessing(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.manualProcessing(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - def taskId = execution.getVariable("taskId") - - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Processing halted - manual task created: " + taskId) - } - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/RollbackVnf.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/RollbackVnf.groovy deleted file mode 100644 index 99248a92ad..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/RollbackVnf.groovy +++ /dev/null @@ -1,151 +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.bpmn.infrastructure.scripts - -import groovy.json.JsonOutput -import groovy.json.JsonSlurper -import groovy.util.Node -import groovy.util.XmlParser; -import groovy.xml.QName - -import java.io.Serializable; -import java.util.UUID; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.client.aai.* - -import org.openecomp.mso.client.appc.ApplicationControllerClient; -import org.openecomp.mso.client.appc.ApplicationControllerSupport; -import org.openecomp.mso.client.aai.AAIResourcesClient -import org.openecomp.mso.client.aai.entities.AAIResultWrapper -import org.openecomp.mso.client.aai.entities.uri.AAIUri -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory -import org.onap.appc.client.lcm.model.Action; -import org.onap.appc.client.lcm.model.ActionIdentifiers; -import org.onap.appc.client.lcm.model.LockInput -import org.onap.appc.client.lcm.model.UnlockInput -import org.onap.appc.client.lcm.model.HealthCheckInput -import org.onap.appc.client.lcm.model.StartInput -import org.onap.appc.client.lcm.model.StopInput -import org.onap.appc.client.lcm.model.Flags -import org.onap.appc.client.lcm.model.Status - - - -public class RollbackVnf extends VnfCmBase { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtils = new JsonUtils() - def prefix = "VnfIPU_" - - /** - * Initialize the flow's variables. - * - * @param execution The flow's execution instance. - */ - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable('prefix', 'RVnf_') - - execution.setVariable('rollbackSuccessful', false) - execution.setVariable('currentActivity', 'RVnf') - execution.setVariable('workStep', null) - execution.setVariable('failedActivity', null) - execution.setVariable('errorCode', "0") - execution.setVariable('actionUnlock', Action.Unlock) - execution.setVariable('actionStart', Action.Start) - execution.setVariable('actionResumeTraffic', Action.ResumeTraffic) - - } - - /** - * Check for missing elements in the received request. - * - * @param execution The flow's execution instance. - */ - public void preProcessRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - initProcessVariables(execution) - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - initProcessVariables(execution) - - try { - - execution.setVariable("rollbackErrorCode", "0") - - if (execution.getVariable("rollbackSetClosedLoopDisabledFlag") == true) { - logDebug("Will call setClosedLoopDisabledFlag", isDebugLogEnabled) - } - - - logDebug('Exited ' + method, isDebugLogEnabled) - - } - catch(Exception e) { - String restFaultMessage = e.getMessage() - utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled) - execution.setVariable("rollbackErrorCode", "1") - } - } - - /** - * Determine success of rollback execution. - * - * @param execution The flow's execution instance. - */ - public void setRollbackResult(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.setRollbackResult(' + - 'execution=' + execution.getId() + - ')' - initProcessVariables(execution) - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - def rollbackErrorCode = execution.getVariable('rollbackErrorCode') - if (rollbackErrorCode == "0") { - execution.setVariable('rollbackSuccessful', true) - logDebug("rollback successful", isDebugLogEnabled) - } - else { - execution.setVariable('rollbackSuccessful', false) - logDebug("rollback unsuccessful", isDebugLogEnabled) - } - - logDebug('Exited ' + method, isDebugLogEnabled) - - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy deleted file mode 100644 index 4eca37b304..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy +++ /dev/null @@ -1,302 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure.scripts - -import org.camunda.bpm.engine.delegate.DelegateExecution - -import static org.apache.commons.lang3.StringUtils.* -import org.openecomp.mso.logger.MsoLogger -import org.openecomp.mso.utils.UUIDChecker -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution - -import org.springframework.web.util.UriUtils - - -/** - * This groovy class supports the ScaleCustomE2EServiceInstance.bpmn process. - * - */ -public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor { - String Prefix = "CRESI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - private MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); - - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - String msg = "" - utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled) - - try { - - String siRequest = execution.getVariable("bpmnRequest") - utils.logAudit(siRequest) - - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("msoRequestId", requestId) - utils.log("DEBUG", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)) { - serviceInstanceId = "NULL".toString() - } - utils.log("DEBUG", "Generated new Service Instance:" + serviceInstanceId, isDebugEnabled) - serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8") - execution.setVariable("serviceInstanceId", serviceInstanceId) - - // service instance ID is also service ID - execution.setVariable("serviceId", serviceInstanceId) - // service instance name - String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "service.serviceInstanceName") - execution.setVariable("serviceInstanceName", serviceInstanceName) - - // service instance name - String serviceType = jsonUtil.getJsonValue(siRequest, "service.serviceType") - execution.setVariable("serviceType", serviceType) - - // operationa ID (key) - //String operationKey = UUIDChecker.generateUUID(msoLogger) - String operationId = jsonUtil.getJsonValue(siRequest, "operationId") - execution.setVariable("operationId", operationId) - utils.log("DEBUG", "Input Request:" + siRequest + " operationId:" + operationId, isDebugEnabled) - - - String resources = jsonUtil.getJsonValue(siRequest, "service.resources") - execution.setVariable("resources", resources) - - // node template UUID - String nodeTemplateUUID = UUIDChecker.generateUUID(msoLogger) - execution.setVariable("nodeTemplateUUID", nodeTemplateUUID) - - //subscriberInfo - String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "service.globalSubscriberId") - if (isBlank(globalSubscriberId)) { - msg = "Input globalSubscriberId' is null" - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("globalSubscriberId", globalSubscriberId) - } - - String requestDescription = "request description for test" - execution.setVariable("requestDescription", requestDescription) - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG", " ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void sendSyncResponse(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) - - try { - String operationId = execution.getVariable("operationId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - // RESTResponse for API Handler (APIH) Reply Task - String scaleServiceRestRequest = """{"operationId":"${operationId}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + scaleServiceRestRequest, isDebugEnabled) - sendWorkflowResponse(execution, 202, scaleServiceRestRequest) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG", " ***** Exit sendSyncResopnse *****", isDebugEnabled) - } - - - public void sendSyncError(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncError *** ", isDebugEnabled) - - try { - String errorMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """ - ${errorMessage} - 7000 - """ - - utils.logAudit(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - - } catch (Exception ex) { - utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) - } - - } - - public void prepareCompletionRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** prepareCompletion *** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String source = execution.getVariable("source") - - String msoCompletionRequest = - """ - - ${requestId} - SCALE - ${source} - - Service Instance was scaled successfully. - ${serviceInstanceId} - ScaleGenericALaCarteServiceInstance - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - execution.setVariable("CompleteMsoProcessRequest", xmlMsoCompletionRequest) - utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - - } catch (Exception ex) { - String msg = " Exception in prepareCompletion:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG", "*** Exit prepareCompletionRequest ***", isDebugEnabled) - } - - public void prepareFalloutRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** prepareFalloutRequest *** ", isDebugEnabled) - - try { - WorkflowException wfex = execution.getVariable("WorkflowException") - utils.log("DEBUG", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) - String requestId = execution.getVariable("msoRequestId") - String source = execution.getVariable("source") - String requestInfo = - """ - ${requestId} - SCALE - ${source} - """ - - String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) - execution.setVariable("falloutRequest", falloutRequest) - } catch (Exception ex) { - utils.log("DEBUG", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) - String errorException = " Bpmn error encountered in ScaleGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() - String requestId = execution.getVariable("msoRequestId") - String falloutRequest = - """ - - ${requestId} - SCALE - UUI - - - ${errorException} - 7000 - - """ - - execution.setVariable("falloutRequest", falloutRequest) - } - utils.log("DEBUG", "*** Exit prepareFalloutRequest ***", isDebugEnabled) - } - - - /** - * Init the service Operation Status - */ - public void prepareInitServiceOperationStatus(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) - try{ - String serviceId = execution.getVariable("serviceInstanceId") - //String serviceName = execution.getVariable("serviceInstanceName") - String operationId = execution.getVariable("operationId") - String operationType = "SCALE" - String userId = "" - String result = "processing" - String progress = "0" - String reason = "" - String operationContent = "Prepare service scaling" - execution.setVariable("serviceInstanceId", serviceId) - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", operationType) - - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) - - String payload = - """ - - - - ${serviceId} - ${operationId} - ${operationType} - ${userId} - ${result} - ${operationContent} - ${progress} - ${reason} - - - """ - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - utils.log("INFO", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) - utils.logAudit("Scale network service updateServiceOperStatusRequest Request: " + payload) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) - execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) - } - utils.log("INFO", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy deleted file mode 100644 index f3f1a96258..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy +++ /dev/null @@ -1,575 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.infrastructure.scripts; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil - -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.core.domain.Resource -import org.openecomp.mso.rest.APIResponse - -import java.util.List; -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject -import org.json.JSONArray -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils - -/** - * This groovy class supports the UpdateCustomE2EServiceInstance.bpmn process. - * AlaCarte flow for 1702 ServiceInstance Update - * - */ -public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor { - String Prefix="UPDSI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - String msg = "" - utils.log("INFO", " *** preProcessRequest() *** ", isDebugEnabled) - - try { - - String siRequest = execution.getVariable("bpmnRequest") - utils.logAudit(siRequest) - - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("msoRequestId", requestId) - utils.log("INFO", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)) { - msg = "Input serviceInstanceId' is null" - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - //subscriberInfo for aai - String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") - if (isBlank(globalSubscriberId)) { - msg = "Input globalSubscriberId' is null" - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("globalSubscriberId", globalSubscriberId) - } - - //requestDetails - execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")) - execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")) - execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback")) - String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") - if (isBlank(productFamilyId)) - { - msg = "Input productFamilyId is null" - utils.log("INFO", msg, isDebugEnabled) - } else { - execution.setVariable("productFamilyId", productFamilyId) - } - - //user params - String userParams = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams") - utils.log("INFO", "userParams:" + userParams, isDebugEnabled) - List paramList = jsonUtil.StringArrayToList(execution, userParams) - String uuiRequest = jsonUtil.getJsonValue(paramList.get(0), "UUIRequest") - if (isBlank(uuiRequest)) { - msg = "Input uuiRequest is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else - { - execution.setVariable("uuiRequest", uuiRequest) - } - - utils.log("INFO", "uuiRequest:\n" + uuiRequest, isDebugEnabled) - - //serviceType for aai - String serviceType = jsonUtil.getJsonValue(uuiRequest, "service.serviceType") - if (isBlank(serviceType)) { - msg = "Input serviceType is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("serviceType", serviceType) - } - - // target model info - String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") - utils.log("INFO","modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled) - execution.setVariable("modelInvariantUuid", modelInvariantUuid) - execution.setVariable("model-invariant-id-target", modelInvariantUuid) - - String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") - utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled) - execution.setVariable("modelUuid", modelUuid) - execution.setVariable("model-version-id-target", modelUuid) - - String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName") - utils.log("INFO","serviceModelName: " + serviceModelName, isDebugEnabled) - if(serviceModelName == null) { - serviceModelName = "" - } - execution.setVariable("serviceModelName", serviceModelName) - - //operationId - String operationId = jsonUtil.getJsonValue(siRequest, "operationId") - if (isBlank(operationId)) { - operationId = UUID.randomUUID().toString() - } - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", "update") - execution.setVariable("hasResourcetoUpdate", false) - - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) - String msg = "" - - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - String serviceType = "" - - if(foundInAAI){ - utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) - - String siData = execution.getVariable("GENGS_service") - utils.log("INFO", "SI Data", isDebugEnabled) - if (isBlank(siData)) - { - msg = "Could not retrive ServiceInstance data from AAI, Id:" + serviceInstanceId - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - utils.log("INFO", "SI Data" + siData, isDebugEnabled) - - // serviceInstanceName - String serviceInstanceName = execution.getVariable("serviceInstanceName") - if(isBlank(serviceInstanceName) && utils.nodeExists(siData, "service-instance-name")) { - serviceInstanceName = utils.getNodeText1(siData, "service-instance-name") - execution.setVariable("serviceInstanceName", serviceInstanceName) - } - - // Get Template uuid and version - if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) { - utils.log("INFO", "SI Data model-invariant-id and model-version-id exist:", isDebugEnabled) - - def modelInvariantId = utils.getNodeText1(siData, "model-invariant-id") - def modelVersionId = utils.getNodeText1(siData, "model-version-id") - - // Set Original Template info - execution.setVariable("model-invariant-id-original", modelInvariantId) - execution.setVariable("model-version-id-original", modelVersionId) - } - - //get related service instances (vnf/network or volume) for delete - if (utils.nodeExists(siData, "relationship-list")) { - utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled) - - JSONArray jArray = new JSONArray() - - XmlParser xmlParser = new XmlParser() - Node root = xmlParser.parseText(siData) - def relation_list = utils.getChildNode(root, 'relationship-list') - def relationships = utils.getIdenticalChildren(relation_list, 'relationship') - - for (def relation: relationships) { - def jObj = getRelationShipData(relation, isDebugEnabled) - jArray.put(jObj) - } - - execution.setVariable("serviceRelationShip", jArray.toString()) - } - }else{ - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - - utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) - } - }catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) - } - - private JSONObject getRelationShipData(node, isDebugEnabled){ - JSONObject jObj = new JSONObject() - - def relation = utils.nodeToString(node) - def rt = utils.getNodeText1(relation, "related-to") - - def rl = utils.getNodeText1(relation, "related-link") - utils.log("INFO", "ServiceInstance Related NS/Configuration :" + rl, isDebugEnabled) - - def rl_datas = utils.getIdenticalChildren(node, "relationship-data") - for(def rl_data : rl_datas) { - def eKey = utils.getChildNodeText(rl_data, "relationship-key") - def eValue = utils.getChildNodeText(rl_data, "relationship-value") - - if ((rt == "service-instance" && eKey.equals("service-instance.service-instance-id")) - //for overlay/underlay - || (rt == "configuration" && eKey.equals("configuration.configuration-id"))){ - jObj.put("resourceInstanceId", eValue) - } - } - - def rl_props = utils.getIdenticalChildren(node, "related-to-property") - for(def rl_prop : rl_props) { - def eKey = utils.getChildNodeText(rl_prop, "property-key") - def eValue = utils.getChildNodeText(rl_prop, "property-value") - if((rt == "service-instance" && eKey.equals("service-instance.service-instance-name")) - //for overlay/underlay - || (rt == "configuration" && eKey.equals("configuration.configuration-type"))){ - jObj.put("resourceType", eValue) - } - } - - utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) - - return jObj - } - - - public void preCompareModelVersions(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - } - - public void postCompareModelVersions(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ======== STARTED postCompareModelVersions Process ======== ", isDebugEnabled) - - def hasResourcetoUpdate = false - def hasResourcetoAdd = false - def hasResourcetoDelete = false - List addResourceList = execution.getVariable("addResourceList") - List delResourceList = execution.getVariable("delResourceList") - - if(addResourceList != null && !addResourceList.isEmpty()) { - hasResourcetoAdd = true - } - - if(delResourceList != null && !delResourceList.isEmpty()) { - hasResourcetoDelete = true - } - - hasResourcetoUpdate = hasResourcetoAdd || hasResourcetoDelete - execution.setVariable("hasResourcetoUpdate", hasResourcetoUpdate) - - utils.log("DEBUG", "======== COMPLETED postCompareModelVersions Process ======== ", isDebugEnabled) - } - - /** - * Init the service Operation Status - */ - public void prepareInitServiceOperationStatus(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) - try{ - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String operationType = execution.getVariable("operationType") - String userId = "" - String result = "processing" - String progress = "0" - String reason = "" - String operationContent = "Prepare service updating" - utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) - serviceId = UriUtils.encode(serviceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceId) - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", operationType) - - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) - - String payload = - """ - - - - ${serviceId} - ${operationId} - ${operationType} - ${userId} - ${result} - ${operationContent} - ${progress} - ${reason} - - - """ - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) - utils.logAudit("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) - execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) - } - utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) - } - - /** - * Update the service Operation Status - */ - public void preUpdateServiceOperationStatus(DelegateExecution execution){ - def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')' - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) - - try{ - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String operationType = execution.getVariable("operationType") - String serviceName = execution.getVariable("serviceInstanceName") - String result = execution.getVariable("operationResult") - String progress = execution.getVariable("progress") - String reason = execution.getVariable("operationReason") - String userId = "" - utils.log("INFO", "progress: " + progress , isDebugEnabled) - - String operationContent = "Prepare service : " + execution.getVariable("operationStatus") - - utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) - serviceId = UriUtils.encode(serviceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceId) - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", operationType) - - def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) - - execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - String payload = - """ - - - - ${serviceId} - ${operationId} - ${operationType} - ${userId} - ${result} - ${operationContent} - ${progress} - ${reason} - - - """ - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - utils.log("INFO", "Outgoing preUpdateServiceOperationStatus: \n" + payload, isDebugEnabled) - - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) - execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage()) - } - utils.log("INFO", "======== COMPLETED preUpdateServiceOperationStatus Process ======== ", isDebugEnabled) - utils.log("INFO", "Exited " + method, isDebugEnabled) - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** sendSyncResponse *** ", isDebugEnabled) - - try { - String operationId = execution.getVariable("operationId") - def hasResourcetoUpdate = execution.getVariable("hasResourcetoUpdate") - - String updateServiceResp = "" - if(hasResourcetoUpdate) { - // RESTResponse for API Handler (APIH) Reply Task - updateServiceResp = """{"operationId":"${operationId}"}""".trim() - } - else { - updateServiceResp = """{"OperationResult":"No Resource to Add or Delete or Service Instance not found in AAI."}""" - } - - utils.log("INFO", " sendSyncResponse to APIH:" + "\n" + updateServiceResp, isDebugEnabled) - sendWorkflowResponse(execution, 202, updateServiceResp) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," ***** Exit sendSyncResopnse *****", isDebugEnabled) - } - - public void sendSyncError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** sendSyncError *** ", isDebugEnabled) - - try { - String errorMessage = "" - int errorCode = 7000 - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - errorCode = wfe.getErrorCode() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """ - ${errorMessage} - ${errorCode} - """ - - utils.logAudit(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - - } catch (Exception ex) { - utils.log("INFO", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) - } - - } - - public void prepareCompletionRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** prepareCompletion *** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String source = execution.getVariable("source") - - String msoCompletionRequest = - """ - - ${requestId} - UPDATE - ${source} - - Service Instance was updated successfully. - ${serviceInstanceId} - UpdateCustomE2EServiceInstance - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - execution.setVariable("completionRequest", xmlMsoCompletionRequest) - utils.log("INFO", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - - } catch (Exception ex) { - String msg = " Exception in prepareCompletion:" + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO", "*** Exit prepareCompletionRequest ***", isDebugEnabled) - } - - public void prepareFalloutRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** prepareFalloutRequest *** ", isDebugEnabled) - - try { - WorkflowException wfex = execution.getVariable("WorkflowException") - utils.log("INFO", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) - String requestId = execution.getVariable("msoRequestId") - String source = execution.getVariable("source") - String requestInfo = - """ - ${requestId} - UPDATE - ${source} - """ - - String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) - execution.setVariable("falloutRequest", falloutRequest) - } catch (Exception ex) { - utils.log("INFO", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) - String errorException = " Bpmn error encountered in UpdateCustomE2EServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() - String requestId = execution.getVariable("msoRequestId") - String falloutRequest = - """ - - ${requestId} - UPDATE - UUI - - - ${errorException} - 7000 - - """ - - execution.setVariable("falloutRequest", falloutRequest) - } - utils.log("INFO", "*** Exit prepareFalloutRequest ***", isDebugEnabled) - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy deleted file mode 100644 index 33eb4f90bf..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy +++ /dev/null @@ -1,455 +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.bpmn.infrastructure.scripts; - -import groovy.xml.XmlUtil -import groovy.json.* -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils - -/** - * This groovy class supports the UpdateNetworkInstance.bpmn process. - * - */ -public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { - String Prefix="UPDNI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public InitializeProcessVariables(DelegateExecution execution){ - - execution.setVariable(Prefix + "source", "") - execution.setVariable(Prefix + "Success", false) - - execution.setVariable(Prefix + "CompleteMsoProcessRequest", "") - execution.setVariable(Prefix + "FalloutHandlerRequest", "") - - } - - - /** - * This method is executed during the preProcessRequest task of the UpdateNetworkInstance.bpmn process. - * @param execution - */ - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - /** - * This method is executed during the preProcessRequest task of the UpdateNetworkInstance.bpmn process. - * @param execution - */ - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest() of UpdateNetworkInstance Request ***** ", isDebugEnabled) - - try { - // initialize flow variables - InitializeProcessVariables(execution) - - String sdncVersion = execution.getVariable("sdncVersion") - if (sdncVersion == null || sdncVersion == "1610") { - // 'a-la-cart' default, sdncVersion = '1610' - execution.setVariable("sdncVersion", "1610") - String bpmnRequest = execution.getVariable("bpmnRequest") - if (bpmnRequest != null) { - String disableRollback = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.requestInfo.suppressRollback") - if (disableRollback != null) { - execution.setVariable("disableRollback", disableRollback) - utils.log("DEBUG", "Received 'suppressRollback': " + disableRollback , isDebugEnabled) - } else { - execution.setVariable("disableRollback", false) - } - utils.log("DEBUG", " Set 'disableRollback' : " + execution.getVariable("disableRollback") , isDebugEnabled) - } else { - String dataErrorMessage = " Invalid 'bpmnRequest' request." - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - } else { - // 'macro' TEST ONLY, sdncVersion = '1702' - utils.log("DEBUG", " 'disableRollback' : " + execution.getVariable("disableRollback") , isDebugEnabled) - } - - String requestId = execution.getVariable("msoRequestId") - if (requestId != null) { - execution.setVariable("mso-request-id", requestId) - } else { - requestId = execution.getVariable("mso-request-id") - } - execution.setVariable(Prefix + "requestId", requestId) - - // get/set 'requestId' - if (execution.getVariable("requestId") == null) { - execution.setVariable("requestId", requestId) - } - - //Place holder for additional code. - - // TODO ??? - // userParams??? 1) pre-loads indicator, 2) 'auto-activation' - // Tag/Value parameters - // - // Map: 'networkInputParams': 'auto-activation'' - // Sample format? - // "requestParameters": { - // "userParams": [ - // { - // "name": "someUserParam1", - // "value": "someValue1" - // } - // ] - // } - // - // String userParams = //use json util to extract "userParams"// - // execution.setVariable("networkInputParams", userParams) - // else: execution.setVariable("networkInputParams", null) - // - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex){ - sendSyncError(execution) - // caught exception - String exceptionMessage = "Exception Encountered in UpdateNetworkInstance, PreProcessRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside sendSyncResponse() of UpdateNetworkInstance ***** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("mso-request-id") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - // RESTResponse (for API Handler (APIH) Reply Task) - String updateNetworkRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - - utils.log("DEBUG", " sendSyncResponse to APIH - " + "\n" + updateNetworkRestRequest, isDebugEnabled) - sendWorkflowResponse(execution, 202, updateNetworkRestRequest) - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in UpdateNetworkInstance flow. sendSyncResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - } - - - public void getNetworkModelInfo (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside getNetworkModelInfo() of UpdateNetworkInstance ***** ", isDebugEnabled) - - try { - - // For Ala-Carte (sdnc = 1610): - // 1. the Network ModelInfo is expected to be sent - // via requestDetails.modelInfo (modelType = network), ex: modelCustomizationId - // 2. the Service ModelInfo is expected to be sent but will be IGNORE - // via requestDetails.relatedInstanceList.relatedInstance.modelInfo (modelType = service) - - } catch (Exception ex) { - sendSyncError(execution) - String exceptionMessage = "Bpmn error encountered in UpdateNetworkInstance flow. getNetworkModelInfo() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - public void sendSyncError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside sendSyncError() of UpdateNetworkInstance ***** ", isDebugEnabled) - - try { - - String requestId = execution.getVariable("mso-request-id") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - // REST Error (for API Handler (APIH) Reply Task) - String syncError = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - - sendWorkflowResponse(execution, 500, syncError) - - } catch (Exception ex) { - utils.log("DEBUG", " Bpmn error encountered in UpdateNetworkInstance flow. sendSyncError() - " + ex.getMessage(), isDebugEnabled) - } - - } - - public void prepareDBRequestError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - try { - utils.log("DEBUG", " ***** Inside prepareDBRequestError() of UpdateNetworkInstance ***** ", isDebugEnabled) - - // set DB Header Authorization - setBasicDBAuthHeader(execution, isDebugEnabled) - - String statusMessage = "" - WorkflowException wfe = null - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - wfe = execution.getVariable("WorkflowException") - statusMessage = wfe.getErrorMessage() - } - - String requestId = execution.getVariable(Prefix + "requestId") - String networkName = execution.getVariable("networkName") !=null ? execution.getVariable("networkName") : "" - String networkId = execution.getVariable("networkId") !=null ? execution.getVariable("networkId") : "" - String dbRequest = - """ - - - - ${requestId} - BPMN - ${statusMessage} - - FAILED - <network-id>${networkId}</network-id><network-name>${networkName}</network-names> - - - """ - - execution.setVariable(Prefix + "createDBRequest", dbRequest) - utils.log("DEBUG", " DB Adapter Request - " + "\n" + dbRequest, isDebugEnabled) - utils.logAudit(dbRequest) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in UpdateNetworkInstance flow. prepareDBRequestError() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareCompletion (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside prepareCompletion() of UpdateNetworkInstance ***** ", isDebugEnabled) - - try { - - String requestId = execution.getVariable("mso-request-id") - String source = execution.getVariable(Prefix + "source") - - String msoCompletionRequest = - """ - - ${requestId} - UPDATE - VID - - Network has been updated successfully. - BPMN Network action: UPDATE - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - // normal path - execution.setVariable(Prefix + "Success", true) - execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) - utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in UpdateNetworkInstance flow. prepareCompletion() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - - } - - - - - // ************************************************** - // Post or Validate Response Section - // ************************************************** - - public void postProcessResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside postProcessResponse() of UpdateNetworkInstance ***** ", isDebugEnabled) - - try { - - if (execution.getVariable("CMSO_ResponseCode") == "200") { - execution.setVariable(Prefix + "Success", true) - utils.log("DEBUG", " ***** UpdateNetworkInstance Success ***** ", isDebugEnabled) - // Place holder for additional code. - - } else { - execution.setVariable(Prefix + "Success", false) - utils.log("DEBUG", " ***** UpdateNetworkInstance Failed in CompletionMsoProces flow!. ***** ", isDebugEnabled) - - } - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in UpdateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - // ******************************* - // Build Error Section - // ******************************* - - public void processRollbackData (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside processRollbackData() of UpdateNetworkInstance ***** ", isDebugEnabled) - - try { - //execution.getVariable("orchestrationStatus") - //execution.getVariable("networkId") - //execution.getVariable("networkName") - //networkOutputParams - //rollbackData - //rolledBack - - } catch (Exception ex) { - utils.log("DEBUG", " Bpmn error encountered in UpdateNetworkInstance flow. callDBCatalog() - " + ex.getMessage(), isDebugEnabled) - } - - } - - // Prepare for FalloutHandler - public void buildErrorResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", "DB updateInfraRequest ResponseCode: " + execution.getVariable(Prefix + "dbReturnCode"), isDebugEnabled) - utils.log("DEBUG", "DB updateInfraRequest Response: " + execution.getVariable(Prefix + "createDBResponse"), isDebugEnabled) - - utils.log("DEBUG", " ***** Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler. *****", isDebugEnabled) - - String falloutHandlerRequest = "" - String requestId = execution.getVariable("mso-request-id") - - try { - - WorkflowException wfe = execution.getVariable("WorkflowException") - String errorCode = String.valueOf(wfe.getErrorCode()) - String errorMessage = wfe.getErrorMessage() - falloutHandlerRequest = - """ - - ${requestId} - UPDATE - VID - - - ${errorMessage} - ${errorCode} - - """ - - utils.logAudit(falloutHandlerRequest) - execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - utils.log("DEBUG", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) - - } catch (Exception ex) { - String errorException = " Bpmn error encountered in UpdateNetworkInstance flow. FalloutHandlerRequest, buildErrorResponse() - " - utils.log("DEBUG", "Exception error in UpdateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage(), isDebugEnabled) - falloutHandlerRequest = - """ - - ${requestId} - UPDATE - VID - - - ${errorException} - 7000 - - """ - - execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - utils.log("DEBUG", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) - - } - - } - - public void processJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - try{ - utils.log("DEBUG", "Caught a Java Exception in " + Prefix, isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) - } - utils.log("DEBUG", "Completed processJavaException Method in " + Prefix, isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModule.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModule.groovy deleted file mode 100644 index 2acc550318..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModule.groovy +++ /dev/null @@ -1,331 +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.bpmn.infrastructure.scripts - -import groovy.util.Node -import groovy.util.XmlParser; -import groovy.xml.QName - -import java.io.Serializable; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.core.RollbackData - - -public class UpdateVfModule extends AbstractServiceTaskProcessor { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - /** - * Initialize the flow's variables. - * - * @param execution The flow's execution instance. - */ - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable('prefix', 'UPDVfMod_') - execution.setVariable('UPDVfMod_Request', null) - execution.setVariable('UPDVfMod_requestInfo', null) - execution.setVariable('UPDVfMod_requestId', null) - execution.setVariable('UPDVfMod_source', null) - execution.setVariable('UPDVfMod_vnfInputs', null) - execution.setVariable('UPDVfMod_vnfId', null) - execution.setVariable('UPDVfMod_vfModuleId', null) - execution.setVariable('UPDVfMod_tenantId', null) - execution.setVariable('UPDVfMod_volumeGroupId', null) - execution.setVariable('UPDVfMod_vnfParams', null) - execution.setVariable('UPDVfMod_updateInfraRequest', null) - execution.setVariable('UpdateVfModuleSuccessIndicator', false) - } - - /** - * Check for missing elements in the received request. - * - * @param execution The flow's execution instance. - */ - public void preProcessRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - initProcessVariables(execution) - String request = validateRequest(execution) - - utils.logAudit("UpdateVfModule request: " + request) - def requestInfo = getRequiredNodeXml(execution, request, 'request-info') - execution.setVariable('UPDVfMod_requestInfo', requestInfo) - execution.setVariable('UPDVfMod_requestId', getRequiredNodeText(execution, requestInfo, 'request-id')) - execution.setVariable('UPDVfMod_source', getNodeTextForce(requestInfo, 'source')) - - def vnfInputs = getRequiredNodeXml(execution, request, 'vnf-inputs') - execution.setVariable('UPDVfMod_vnfInputs', vnfInputs) - execution.setVariable('UPDVfMod_vnfId', getRequiredNodeText(execution, vnfInputs, 'vnf-id')) - execution.setVariable('UPDVfMod_vfModuleId', getRequiredNodeText(execution, vnfInputs, 'vf-module-id')) - execution.setVariable('UPDVfMod_tenantId', getRequiredNodeText(execution, vnfInputs, 'tenant-id')) - execution.setVariable('UPDVfMod_volumeGroupId', getNodeTextForce(vnfInputs, 'volume-group-id')) - - def vnfParams = utils.getNodeXml(request, 'vnf-params') - execution.setVariable('UPDVfMod_vnfParams', vnfParams) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) - } - } - - /** - * Prepare and send the synchronous response for this flow. - * - * @param execution The flow's execution instance. - */ - public void sendSynchResponse(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sendSynchResponse(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def requestInfo = execution.getVariable('UPDVfMod_requestInfo') - def requestId = execution.getVariable('UPDVfMod_requestId') - def source = execution.getVariable('UPDVfMod_source') - def progress = getNodeTextForce(requestInfo, 'progress') - if (progress.isEmpty()) { - progress = '0' - } - def startTime = getNodeTextForce(requestInfo, 'start-time') - if (startTime.isEmpty()) { - startTime = System.currentTimeMillis() - } - def vnfInputs = execution.getVariable('UPDVfMod_vnfInputs') - - String synchResponse = """ - - - ${requestId} - UPDATE_VF_MODULE - IN_PROGRESS - ${progress} - ${startTime} - ${source} - - ${vnfInputs} - - """ - - synchResponse = utils.formatXml(synchResponse) - sendWorkflowResponse(execution, 200, synchResponse) - - utils.logAudit("UpdateVfModule Synch Response: " + synchResponse) - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage()) - } - } - - /** - * Prepare the Request for invoking the DoUpdateVfModule subflow. - * - * NOTE: Currently, the method just logs passing through as the - * incoming Request to this main flow is used as the Request to - * the DoUpdateVfModule subflow. No preparation processing is - * necessary. - * - * @param execution The flow's execution instance. - */ - public void prepDoUpdateVfModule(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepDoUpdateVfModule(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage()) - } - } - - /** - * Prepare the Request for updating the DB for this Infra Request. - * - * @param execution The flow's execution instance. - */ - public void prepUpdateInfraRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepUpdateInfraRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def requestId = execution.getVariable('UPDVfMod_requestId') - def vnfId = execution.getVariable('UPDVfMod_vnfId') - def vfModuleId = execution.getVariable('UPDVfMod_vfModuleId') - def tenantId = execution.getVariable('UPDVfMod_tenantId') - def volumeGroupId = execution.getVariable('UPDVfMod_volumeGroupId') - - String updateInfraRequest = """ - - - - - ${requestId} - BPEL - COMPLETE - 100 - - ${vnfId} - ${vfModuleId} - ${tenantId} - ${volumeGroupId} - - - - - """ - - updateInfraRequest = utils.formatXml(updateInfraRequest) - execution.setVariable('UPDVfMod_updateInfraRequest', updateInfraRequest) - logDebug('Request for Update Infra Request:\n' + updateInfraRequest, isDebugLogEnabled) - - utils.logAudit("UpdateVfModule Infra Request: " + updateInfraRequest) - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage()) - } - } - - /** - * Builds a "CompletionHandler" request and stores it in the specified execution variable. - * - * @param execution the execution - * @param resultVar the execution variable in which the result will be stored - */ - public void completionHandlerPrep(DelegateExecution execution, String resultVar) { - def method = getClass().getSimpleName() + '.completionHandlerPrep(' + - 'execution=' + execution.getId() + - ', resultVar=' + resultVar + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def requestInfo = getVariable(execution, 'UPDVfMod_requestInfo') - - String content = """ - - ${requestInfo} - MSO_ACTIVATE_BPEL - - """ - - content = utils.formatXml(content) - logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) - execution.setVariable(resultVar, content) - - utils.logAudit("UpdateVfModule CompletionHandler Request: " + content) - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') - } - } - - /** - * Builds a "FalloutHandler" request and stores it in the specified execution variable. - * - * @param execution the execution - * @param resultVar the execution variable in which the result will be stored - */ - public void falloutHandlerPrep(DelegateExecution execution, String resultVar) { - def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + - 'execution=' + execution.getId() + - ', resultVar=' + resultVar + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def prefix = execution.getVariable('prefix') - def request = getVariable(execution, prefix+'Request') - def requestInformation = utils.getNodeXml(request, 'request-information', false) - - def WorkflowException workflowException = execution.getVariable("WorkflowException") - def errorResponseCode = workflowException.getErrorCode() - def errorResponseMsg = workflowException.getErrorMessage() - def encErrorResponseMsg = "" - if (errorResponseMsg != null) { - encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">") - } - - String content = """ - - ${requestInformation} - - ${encErrorResponseMsg} - ${errorResponseCode} - - - """ - content = utils.formatXml(content) - logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) - execution.setVariable(resultVar, content) - - utils.logAudit("UpdateVfModule fallOutHandler Request: " + content) - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') - } - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy deleted file mode 100644 index 60e8ca4b88..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy +++ /dev/null @@ -1,510 +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.bpmn.infrastructure.scripts - -import groovy.json.JsonOutput -import groovy.json.JsonSlurper -import groovy.util.Node -import groovy.util.XmlParser; -import groovy.xml.QName - -import java.io.Serializable; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException - - -public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - /** - * Initialize the flow's variables. - * - * @param execution The flow's execution instance. - */ - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable('prefix', 'UPDVfModI_') - execution.setVariable('UPDVfModI_Request', null) - execution.setVariable('UPDVfModI_requestInfo', null) - execution.setVariable('UPDVfModI_requestId', null) - execution.setVariable('UPDVfModI_source', null) - execution.setVariable('UPDVfModI_vnfInputs', null) - execution.setVariable('UPDVfModI_vnfId', null) - execution.setVariable('UPDVfModI_vfModuleId', null) - execution.setVariable('UPDVfModI_tenantId', null) - execution.setVariable('UPDVfModI_volumeGroupId', null) - execution.setVariable('UPDVfModI_vnfParams', null) - execution.setVariable('UPDVfModI_updateInfraRequest', null) - execution.setVariable('UpdateVfModuleSuccessIndicator', false) - } - - /** - * Check for missing elements in the received request. - * - * @param execution The flow's execution instance. - */ - public void preProcessRequest(DelegateExecution execution) { - - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - initProcessVariables(execution) - - def prefix = "UPDVfModI_" - - def incomingRequest = execution.getVariable('bpmnRequest') - - utils.log("DEBUG", "Incoming Infra Request: " + incomingRequest, isDebugLogEnabled) - try { - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - Map reqMap = jsonSlurper.parseText(incomingRequest) - utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled) - - def serviceInstanceId = execution.getVariable('serviceInstanceId') - def vnfId = execution.getVariable('vnfId') - - execution.setVariable(prefix + 'serviceInstanceId', serviceInstanceId) - execution.setVariable(prefix+'vnfId', vnfId) - execution.setVariable("isVidRequest", "true") - - def vnfName = '' - def asdcServiceModelVersion = '' - def serviceModelInfo = null - def vnfModelInfo = null - - def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList - - if (relatedInstanceList != null) { - relatedInstanceList.each { - if (it.relatedInstance.modelInfo?.modelType == 'service') { - asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion - serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) - - } - if (it.relatedInstance.modelInfo.modelType == 'vnf') { - vnfName = it.relatedInstance.instanceName ?: '' - vnfModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) - } - } - } - - execution.setVariable(prefix + 'vnfName', vnfName) - execution.setVariable(prefix + 'asdcServiceModelVersion', asdcServiceModelVersion) - execution.setVariable(prefix + 'serviceModelInfo', serviceModelInfo) - execution.setVariable(prefix + 'vnfModelInfo', vnfModelInfo) - - def vnfType = execution.getVariable('vnfType') - execution.setVariable(prefix + 'vnfType', vnfType) - def vfModuleId = execution.getVariable('vfModuleId') - execution.setVariable(prefix + 'vfModuleId', vfModuleId) - def volumeGroupId = execution.getVariable('volumeGroupId') - execution.setVariable(prefix + 'volumeGroupId', volumeGroupId) - def userParams = reqMap.requestDetails?.requestParameters?.userParams - - Map userParamsMap = [:] - if (userParams != null) { - userParams.each { userParam -> - userParamsMap.put(userParam.name, userParam.value.toString()) - } - } - - utils.log("DEBUG", 'Processed user params: ' + userParamsMap, isDebugLogEnabled) - - execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap) - - def isBaseVfModule = "false" - if (execution.getVariable('isBaseVfModule') == true) { - isBaseVfModule = "true" - } - - execution.setVariable(prefix + 'isBaseVfModule', isBaseVfModule) - - def requestId = execution.getVariable("mso-request-id") - execution.setVariable(prefix + 'requestId', requestId) - - def vfModuleModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo) - execution.setVariable(prefix + 'vfModuleModelInfo', vfModuleModelInfo) - - def suppressRollback = reqMap.requestDetails?.requestInfo?.suppressRollback - - - def backoutOnFailure = "" - if(suppressRollback != null){ - if ( suppressRollback == true) { - backoutOnFailure = "false" - } else if ( suppressRollback == false) { - backoutOnFailure = "true" - } - } - - execution.setVariable('disableRollback', suppressRollback) - - def vfModuleName = reqMap.requestDetails?.requestInfo?.instanceName ?: null - execution.setVariable(prefix + 'vfModuleName', vfModuleName) - - def serviceId = reqMap.requestDetails?.requestParameters?.serviceId ?: '' - execution.setVariable(prefix + 'serviceId', serviceId) - - def usePreload = reqMap.requestDetails?.requestParameters?.usePreload - execution.setVariable(prefix + 'usePreload', usePreload) - - def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration - def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId - execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId) - def tenantId = cloudConfiguration.tenantId - execution.setVariable(prefix + 'tenantId', tenantId) - - def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: '' - execution.setVariable(prefix + 'globalSubscriberId', globalSubscriberId) - - execution.setVariable(prefix + 'sdncVersion', '1702') - - execution.setVariable("UpdateVfModuleInfraSuccessIndicator", false) - - execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) - - - def source = reqMap.requestDetails?.requestInfo?.source - execution.setVariable(prefix + "source", source) - - //For Completion Handler & Fallout Handler - String requestInfo = - """ - ${requestId} - UPDATE - ${source} - """ - - execution.setVariable(prefix + "requestInfo", requestInfo) - - //backoutOnFailure - - logDebug('RequestInfo: ' + execution.getVariable(prefix + "requestInfo"), isDebugLogEnabled) - - logDebug('Exited ' + method, isDebugLogEnabled) - - } - catch(groovy.json.JsonException je) { - utils.log("DEBUG", " Request is not in JSON format.", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") - - } - catch(Exception e) { - String restFaultMessage = e.getMessage() - utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) - } - } - - /** - * Prepare and send the sychronous response for this flow. - * - * @param execution The flow's execution instance. - */ - public void sendSynchResponse(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sendSynchResponse(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - - try { - def requestInfo = execution.getVariable('UPDVfModI_requestInfo') - def requestId = execution.getVariable('UPDVfModI_requestId') - def source = execution.getVariable('UPDVfModI_source') - def progress = getNodeTextForce(requestInfo, 'progress') - if (progress.isEmpty()) { - progress = '0' - } - def startTime = getNodeTextForce(requestInfo, 'start-time') - if (startTime.isEmpty()) { - startTime = System.currentTimeMillis() - } - - // RESTResponse (for API Handler (APIH) Reply Task) - def vfModuleId = execution.getVariable("vfModuleId") - String synchResponse = """{"requestReferences":{"instanceId":"${vfModuleId}","requestId":"${requestId}"}}""".trim() - - sendWorkflowResponse(execution, 200, synchResponse) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) - } - } - - /** - * Prepare the Request for invoking the DoUpdateVfModule subflow. - * - * NOTE: Currently, the method just logs passing through as the - * incoming Request to this main flow is used as the Request to - * the DoUpdateVfModule subflow. No preparation processing is - * necessary. - * - * @param execution The flow's execution instance. - */ - public void prepDoUpdateVfModule(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepDoUpdateVfModule(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage()) - } - } - - /** - * Prepare the Request for updating the DB for this Infra Request. - * - * @param execution The flow's execution instance. - */ - public void prepUpdateInfraRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepUpdateInfraRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def requestId = execution.getVariable('UPDVfModI_requestId') - def vnfId = execution.getVariable('UPDVfModI_vnfId') - def vfModuleId = execution.getVariable('UPDVfModI_vfModuleId') - def tenantId = execution.getVariable('UPDVfModI_tenantId') - def volumeGroupId = execution.getVariable('UPDVfModI_volumeGroupId') - - String updateInfraRequest = """ - - - - - ${requestId} - BPEL - COMPLETE - 100 - - ${vnfId} - ${vfModuleId} - ${tenantId} - ${volumeGroupId} - - - - - """ - - updateInfraRequest = utils.formatXml(updateInfraRequest) - execution.setVariable('UPDVfModI_updateInfraRequest', updateInfraRequest) - logDebug('Request for Update Infra Request:\n' + updateInfraRequest, isDebugLogEnabled) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage()) - } - } - - /** - * Builds a "CompletionHandler" request and stores it in the specified execution variable. - * - * @param execution the execution - * @param resultVar the execution variable in which the result will be stored - */ - public void completionHandlerPrep(DelegateExecution execution, String resultVar) { - def method = getClass().getSimpleName() + '.completionHandlerPrep(' + - 'execution=' + execution.getId() + - ', resultVar=' + resultVar + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def requestInfo = getVariable(execution, 'UPDVfModI_requestInfo') - - String content = """ - - ${requestInfo} - MSO_ACTIVATE_BPEL - - """ - - content = utils.formatXml(content) - logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) - execution.setVariable(resultVar, content) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') - } - } - - /** - * Builds a "FalloutHandler" request and stores it in the specified execution variable. - * - * @param execution the execution - * @param resultVar the execution variable in which the result will be stored - */ - public void falloutHandlerPrep(DelegateExecution execution, String resultVar) { - def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + - 'execution=' + execution.getId() + - ', resultVar=' + resultVar + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def prefix = execution.getVariable('prefix') - def request = getVariable(execution, prefix+'Request') - def requestInformation = execution.getVariable(prefix + "requestInfo") - - def WorkflowException workflowException = execution.getVariable("WorkflowException") - def errorResponseCode = workflowException.getErrorCode() - def errorResponseMsg = workflowException.getErrorMessage() - def encErrorResponseMsg = "" - if (errorResponseMsg != null) { - encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">") - } - - String content = """ - - ${requestInformation} - - ${encErrorResponseMsg} - ${errorResponseCode} - - - """ - content = utils.formatXml(content) - logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) - execution.setVariable(resultVar, content) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') - } - } - - /** - * Validates the request, request id and service instance id. If a problem is found, - * a WorkflowException is generated and an MSOWorkflowException event is thrown. This - * method also sets up the log context for the workflow. - * @param execution the execution - * @return the validated request - */ - public String validateInfraRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.validateInfraRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String processKey = getProcessKey(execution); - def prefix = execution.getVariable("prefix") - - if (prefix == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null") - } - - try { - def request = execution.getVariable(prefix + 'Request') - - if (request == null) { - request = execution.getVariable(processKey + 'Request') - - if (request == null) { - request = execution.getVariable('bpmnRequest') - } - - setVariable(execution, processKey + 'Request', null); - setVariable(execution, 'bpmnRequest', null); - setVariable(execution, prefix + 'Request', request); - } - - if (request == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null") - } - - /* - - def requestId = execution.getVariable("mso-request-id") - - if (requestId == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request has no mso-request-id") - } - - setVariable(execution, prefix + 'requestId', requestId) - - def serviceInstanceId = execution.getVariable("mso-service-instance-id") - - if (serviceInstanceId == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id") - } - - utils.logContext(requestId, serviceInstanceId) - */ - logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled) - logDebug('Exited ' + method, isDebugLogEnabled) - return request - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") - } - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy deleted file mode 100644 index 18f36b879b..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy +++ /dev/null @@ -1,470 +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.bpmn.infrastructure.scripts - - -import groovy.json.JsonOutput -import groovy.json.JsonSlurper -import groovy.util.Node -import groovy.util.XmlParser; -import groovy.xml.QName - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd -import org.camunda.bpm.engine.delegate.DelegateExecution - -import java.io.Serializable; -import java.util.List - -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.springframework.beans.factory.annotation.Autowired - -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.client.aai.AAIValidatorImpl -import org.openecomp.mso.client.aai.AAIUpdatorImpl -import org.openecomp.mso.client.appc.ApplicationControllerClient -import org.openecomp.mso.client.sdno.SDNOValidatorImpl - - - -public class UpdateVfModuleInfraV2 { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - boolean preProcessRequestCheck = true; - boolean sendSynchResponseCheck = true; - boolean checkPserverFlagCheck = true; - boolean vfFlagCheckSetCheck = true; - boolean lockAppCCheck = true; - boolean healthDiagnosticSDNOCheck = true; - boolean healthCheckAppCCheck = true; - boolean stopVfModuleControllerCheck = true; - boolean healthCheckControllerCheck = true; - boolean doUpdateVfModulePrepCheck = true; - boolean completionHandlerPrepCheck = true; - boolean startVfModuleControllerCheck = true; - boolean vFFlagUnsetCheck = true; - boolean unlockAppCCheck = true; - boolean postUpgradeHealthCheckControllerCheck = true; - - - - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable('prefix', 'UPDVfModI_') - execution.setVariable('UPDVfModI_Request', null) - execution.setVariable('UPDVfModI_requestInfo', null) - execution.setVariable('UPDVfModI_requestId', null) - execution.setVariable('UPDVfModI_source', null) - execution.setVariable('UPDVfModI_vnfInputs', null) - execution.setVariable('UPDVfModI_vnfId', null) - execution.setVariable('UPDVFModI_moduleUuid', null) - execution.setVariable('UPDVfModI_vfModuleId', null) - execution.setVariable('UPDVfModI_tenantId', null) - execution.setVariable('UPDVfModI_volumeGroupId', null) - execution.setVariable('UPDVfModI_vnfParams', null) - execution.setVariable('UPDVfModI_updateInfraRequest', null) - execution.setVariable('UpdateVfModuleSuccessIndicator', false) - } - - /** - * Check for missing elements in the received request. - * - * @param execution The flow's execution instance. - */ - public void preProcessRequest(DelegateExecution execution) { - System.out.print("*****************************PreProcessRequest**************************") - - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - //logDebug('Entered ' + method, isDebugLogEnabled) - - initProcessVariables(execution) - - def prefix = "UPDVfModI_" - - def incomingRequest = execution.getVariable('bpmnRequest') - - //utils.log("DEBUG", "Incoming Infra Request: " + incomingRequest, isDebugLogEnabled) - try { - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - Map reqMap = jsonSlurper.parseText(incomingRequest) - //utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled) - - def serviceInstanceId = execution.getVariable('serviceInstanceId') - def vnfId = execution.getVariable('vnfId') - def moduleUuid = execution.getVariable('moduleUuid') - execution.setVariable(prefix + 'moduleUuid',moduleUuid) - execution.setVariable(prefix + 'serviceInstanceId', serviceInstanceId) - execution.setVariable(prefix+'vnfId', vnfId) - execution.setVariable("isVidRequest", "true") - - def vnfName = '' - def asdcServiceModelVersion = '' - def serviceModelInfo = null - def vnfModelInfo = null - - def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList - - if (relatedInstanceList != null) { - relatedInstanceList.each { - if (it.relatedInstance.modelInfo?.modelType == 'service') { - asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion - serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) - } - if (it.relatedInstance.modelInfo.modelType == 'vnf') { - vnfName = it.relatedInstance.instanceName ?: '' - vnfModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) - } - } - } - - execution.setVariable(prefix + 'vnfName', vnfName) - execution.setVariable(prefix + 'asdcServiceModelVersion', asdcServiceModelVersion) - execution.setVariable(prefix + 'serviceModelInfo', serviceModelInfo) - execution.setVariable(prefix + 'vnfModelInfo', vnfModelInfo) - - def vnfType = execution.getVariable('vnfType') - execution.setVariable(prefix + 'vnfType', vnfType) - def vfModuleId = execution.getVariable('vfModuleId') - execution.setVariable(prefix + 'vfModuleId', vfModuleId) - def volumeGroupId = execution.getVariable('volumeGroupId') - execution.setVariable(prefix + 'volumeGroupId', volumeGroupId) - def userParams = reqMap.requestDetails?.requestParameters?.userParams - - Map userParamsMap = [:] - if (userParams != null) { - userParams.each { userParam -> - userParamsMap.put(userParam.name, userParam.value.toString()) - } - } - - //utils.log("DEBUG", 'Processed user params: ' + userParamsMap, isDebugLogEnabled) - - execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap) - - def isBaseVfModule = "false" - if (execution.getVariable('isBaseVfModule') == true) { - isBaseVfModule = "true" - } - - execution.setVariable(prefix + 'isBaseVfModule', isBaseVfModule) - - def requestId = execution.getVariable("mso-request-id") - execution.setVariable(prefix + 'requestId', requestId) - - def vfModuleModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo) - execution.setVariable(prefix + 'vfModuleModelInfo', vfModuleModelInfo) - - def suppressRollback = reqMap.requestDetails?.requestInfo?.suppressRollback - - - def backoutOnFailure = "" - if(suppressRollback != null){ - if ( suppressRollback == true) { - backoutOnFailure = "false" - } else if ( suppressRollback == false) { - backoutOnFailure = "true" - } - } - - execution.setVariable('disableRollback', suppressRollback) - - def vfModuleName = reqMap.requestDetails?.requestInfo?.instanceName ?: null - execution.setVariable(prefix + 'vfModuleName', vfModuleName) - - def serviceId = reqMap.requestDetails?.requestParameters?.serviceId ?: '' - execution.setVariable(prefix + 'serviceId', serviceId) - - def usePreload = reqMap.requestDetails?.requestParameters?.usePreload - execution.setVariable(prefix + 'usePreload', usePreload) - - def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration - def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId - execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId) - def tenantId = cloudConfiguration.tenantId - execution.setVariable(prefix + 'tenantId', tenantId) - - def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: '' - execution.setVariable(prefix + 'globalSubscriberId', globalSubscriberId) - - execution.setVariable(prefix + 'sdncVersion', '1702') - - execution.setVariable("UpdateVfModuleInfraSuccessIndicator", false) - - execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) - - - def source = reqMap.requestDetails?.requestInfo?.source - execution.setVariable(prefix + "source", source) - - //For Completion Handler & Fallout Handler - String requestInfo = - """ - ${requestId} - UPDATE - ${source} - """ - - execution.setVariable(prefix + "requestInfo", requestInfo) - - //backoutOnFailure - - //logDebug('RequestInfo: ' + execution.getVariable(prefix + "requestInfo"), isDebugLogEnabled) - - //logDebug('Exited ' + method, isDebugLogEnabled) - - } - catch(groovy.json.JsonException je) { - //utils.log("DEBUG", " Request is not in JSON format.", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") - } - catch(Exception e) { - String restFaultMessage = e.getMessage() - //utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) - } - } - - /** - * Prepare and send the synchronous response for this flow. - * - * @param execution The flow's execution instance. - */ - public void sendSynchResponse(DelegateExecution execution) { - System.out.print("*****************************SendSynchResponse**************************") - - def method = getClass().getSimpleName() + '.sendSynchResponse(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - //logDebug('Entered ' + method, isDebugLogEnabled) - - - try { - def requestInfo = execution.getVariable('UPDVfModI_requestInfo') - def requestId = execution.getVariable('UPDVfModI_requestId') - def source = execution.getVariable('UPDVfModI_source') - - def progress = getNodeTextForce(requestInfo, 'progress') - if (progress.isEmpty()) { - progress = '0' - } - def startTime = getNodeTextForce(requestInfo, 'start-time') - if (startTime.isEmpty()) { - startTime = System.currentTimeMillis() - } - // RESTResponse (for API Handler (APIH) Reply Task) - def vfModuleId = execution.getVariable("vfModuleId") - String synchResponse = """{"requestReferences":{"instanceId":"${vfModuleId}","requestId":"${requestId}"}}""".trim() - sendWorkflowResponse(execution, 200, synchResponse) - //logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - //logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) - } - } - - //check to see if the Pserver Flag is locked - public void checkPserverFlag(DelegateExecution execution) { - - System.out.println("*****************************CheckingPserverFlag*************************") - String vnfId = (String)execution.getVariable('vnfId') - String uuid = (String)execution.getVariable('moduleUuid') - AAIValidatorImpl aaiVI = new AAIValidatorImpl() - boolean flag = aaiVI.isPhysicalServerLocked(vnfId, uuid) - } - - //check to see if the VFFlag is locked - public void vfFlagCheck(DelegateExecution execution) { - - System.out.print("*****************************VfFlagCheck*************************") - String vnfId = (String)execution.getVariable('vnfId') - String uuid = (String)execution.getVariable('moduleUuid') - AAIValidatorImpl aaiVI = new AAIValidatorImpl() - boolean flag = aaiVI.isVNFLocked(vnfId, uuid) - - } - //lock the VF Flag - public void vfFlagSet(DelegateExecution execution) { - - System.out.print("*****************************VfFlagSet*************************") - String vnfId = (String)execution.getVariable('vnfId') - String uuid = (String)execution.getVariable('moduleUuid') - AAIValidatorImpl aaiVI = new AAIValidatorImpl() - aaiVI.updateVnfToLocked(vnfId,uuid); - - } - - //Lock AppC - public void lockAppC(DelegateExecution execution) { - - System.out.print("*****************************lockAppC*************************") - def vfModuleId = "" - ApplicationControllerClient aCC = new ApplicationControllerClient(); - def status = aCC.runCommand("Lock",vfModuleId) - - - } - //run health check - public void healthCheckAppC(DelegateExecution execution) { - - System.out.print("*****************************healthCheckAppC*************************") - def vfModuleId = "" - ApplicationControllerClient aCC = new ApplicationControllerClient(); - def status = aCC.runCommand("HealthCheck",vfModuleId) - - } - //SDNO health diagnostic - public void healthDiagnosticSDNO(DelegateExecution execution) { - - System.out.print("*****************************healthDiagnosticSDNO is currently ignored*************************") - //SDNOValidatorImpl.healthDiagnostic("",""); - - } - //stop VF module controller - public void stopVfModuleController(DelegateExecution execution) { - - System.out.print("*****************************stopVfModuleController*************************") - def vfModuleId = "" - ApplicationControllerClient aCC = new ApplicationControllerClient(); - def status = aCC.runCommand("Stop",vfModuleId) - - - } - - public void doUpdateVfModulePrep(DelegateExecution execution) { - - System.out.print("*****************************doUpdateVfModulePrep*************************") - def method = getClass().getSimpleName() + '.prepDoUpdateVfModule(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - //logDebug('Entered ' + method, isDebugLogEnabled) - - try { - - //logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - //logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage()) - - } - - } - - public void completionHandlerPrep(DelegateExecution execution,String resultVar) { - - System.out.print("*****************************completionHandlerPrep*************************") - def method = getClass().getSimpleName() + '.completionHandlerPrep(' + - 'execution=' + execution.getId() + - ', resultVar=' + resultVar + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - //logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def requestInfo = getVariable(execution, 'UPDVfModI_requestInfo') - - String content = """ - - ${requestInfo} - MSO_ACTIVATE_BPEL - - """ - - content = utils.formatXml(content) - //logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) - execution.setVariable(resultVar, content) - - //logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - //logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') - - } - - } - - public void healthCheckController(DelegateExecution execution) { - - System.out.print("*****************************healthCheckController*************************") - def vfModuleId = "" - ApplicationControllerClient aCC = new ApplicationControllerClient(); - def status = aCC.runCommand("HealthCheck",vfModuleId) - - } - - public void startVfModuleController(DelegateExecution execution) { - - System.out.print("*****************************startVfModuleController*************************") - def vfModuleId = "" - ApplicationControllerClient aCC = new ApplicationControllerClient(); - def status = aCC.runCommand("Start",vfModuleId) - - } - - public void vFFlagUnset(DelegateExecution execution) { - - System.out.print("*****************************vFFlagUnset*************************") - String vnfId = (String)execution.getVariable('vnfId') - String uuid = (String)execution.getVariable('moduleUuid') - AAIValidatorImpl aaiVI = new AAIValidatorImpl() - aaiVI.updateVnfToUnLocked(vnfId,uuid); - - - } - - public void unlockAppC(DelegateExecution execution) { - - System.out.print("*****************************unlockAppC*************************") - def vfModuleId = "" - ApplicationControllerClient aCC = new ApplicationControllerClient(); - def status = aCC.runCommand("Unlock",vfModuleId) - - } - - public void postUpgradeHealthCheckController(DelegateExecution execution) { - - System.out.print("*****************************postUpgradeHealthCheckController*************************") - def vfModuleId = "" - ApplicationControllerClient aCC = new ApplicationControllerClient(); - def status = aCC.runCommand("HealthCheck",vfModuleId) - - } - -} - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy deleted file mode 100644 index c68b04f3b1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy +++ /dev/null @@ -1,443 +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.bpmn.infrastructure.scripts - -import java.util.concurrent.ExecutionException; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.springframework.web.util.UriUtils -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.VfModuleBase -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil - -class UpdateVfModuleVolume extends VfModuleBase { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - /** - * Initialize the flow's variables. - * - * @param execution The flow's execution instance. - */ - private void initProcessVariables(DelegateExecution execution) { - execution.setVariable('prefix', 'UPDVfModVol_') - execution.setVariable('UPDVfModVol_Request', null) - execution.setVariable('UPDVfModVol_requestInfo', null) - execution.setVariable('UPDVfModVol_requestId', null) - execution.setVariable('UPDVfModVol_source', null) - execution.setVariable('UPDVfModVol_volumeInputs', null) - execution.setVariable('UPDVfModVol_volumeGroupId', null) - execution.setVariable('UPDVfModVol_vnfType', null) - execution.setVariable('UPDVfModVol_serviceId', null) - execution.setVariable('UPDVfModVol_aicCloudRegion', null) - execution.setVariable('UPDVfModVol_tenantId', null) - execution.setVariable('UPDVfModVol_volumeParams', null) - execution.setVariable('UPDVfModVol_volumeGroupHeatStackId', null) - execution.setVariable('UPDVfModVol_volumeGroupTenantId', null) - execution.setVariable('UpdateVfModuleVolumeSuccessIndicator', false) - } - - /** - * Check for missing elements in the received request. - * - * @param execution The flow's execution instance. - */ - @Override - public void preProcessRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - initProcessVariables(execution) - String request = validateRequest(execution) - - def requestInfo = getRequiredNodeXml(execution, request, 'request-info') - execution.setVariable('UPDVfModVol_requestInfo', requestInfo) - execution.setVariable('UPDVfModVol_requestId', getRequiredNodeText(execution, requestInfo, 'request-id')) - execution.setVariable('UPDVfModVol_source', getNodeTextForce(requestInfo, 'source')) - - def volumeInputs = getRequiredNodeXml(execution, request, 'volume-inputs') - execution.setVariable('UPDVfModVol_volumeInputs', volumeInputs) - execution.setVariable('UPDVfModVol_volumeGroupId', getRequiredNodeText(execution, volumeInputs, 'volume-group-id')) - execution.setVariable('UPDVfModVol_vnfType', getRequiredNodeText(execution, volumeInputs, 'vnf-type')) - execution.setVariable('UPDVfModVol_serviceId', getRequiredNodeText(execution, volumeInputs, 'service-id')) - execution.setVariable('UPDVfModVol_aicCloudRegion', getRequiredNodeText(execution, volumeInputs, 'aic-cloud-region')) - execution.setVariable('UPDVfModVol_tenantId', getRequiredNodeText(execution, volumeInputs, 'tenant-id')) - - def volumeParams = utils.getNodeXml(request, 'volume-params') - execution.setVariable('UPDVfModVol_volumeParams', volumeParams) - - logDebug('Exited ' + method, isDebugLogEnabled) - utils.logAudit("UpdateVfModuleVolume request: " + request) - } catch (BpmnError bpmnError) { - throw bpmnError - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) - } - } - - /** - * Prepare and send the synchronous response. - * - * @param execution The flow's execution instance. - */ - public void sendSynchResponse(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sendSynchResponse(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def requestInfo = execution.getVariable('UPDVfModVol_requestInfo') - def requestId = execution.getVariable('UPDVfModVol_requestId') - def source = execution.getVariable('UPDVfModVol_source') - def progress = getNodeTextForce(requestInfo, 'progress') - if (progress.isEmpty()) { - progress = '0' - } - def startTime = getNodeTextForce(requestInfo, 'start-time') - if (startTime.isEmpty()) { - startTime = System.currentTimeMillis() - } - def volumeInputs = execution.getVariable('UPDVfModVol_volumeInputs') - - String synchResponse = """ - - - ${requestId} - UPDATE_VF_MODULE_VOL - IN_PROGRESS - ${progress} - ${startTime} - ${source} - - ${volumeInputs} - - """ - - synchResponse = utils.formatXml(synchResponse) - sendWorkflowResponse(execution, 200, synchResponse) - utils.logAudit("UpdateVfModuleVolume Synch Response: " + synchResponse) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage()) - } - } - - /** - * Prepare a Request for querying AAI for Volume Group information using the - * Volume Group Id and Aic Cloud Region. - * - * @param execution The flow's execution instance. - */ - public void queryAAIForVolumeGroup(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.queryAAIForVolumeGroup(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') - def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') - def endPoint = execution.getVariable('URN_aai_endpoint') + - '/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/' + UriUtils.encode(aicCloudRegion, "UTF-8") + - '/volume-groups/volume-group/' + UriUtils.encode(volumeGroupId, "UTF-8") - - logDebug('Sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) - utils.logAudit("UpdateVfModuleVolume sending GET for quering AAI endpoint: " + endPoint) - - AaiUtil aaiUtil = new AaiUtil(this) - APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) - def int statusCode = response.getStatusCode() - def responseData = response.getResponseBodyAsString() - logDebug('Response code:' + statusCode, isDebugLogEnabled) - logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) - utils.logAudit("UpdateVfModuleVolume response data: " + responseData) - - def volumeGroup = responseData - def heatStackId = getNodeTextForce(volumeGroup, 'heat-stack-id') - execution.setVariable('UPDVfModVol_volumeGroupHeatStackId', heatStackId) - if ((statusCode == 200) || (statusCode == 204)) { - def volumeGroupTenantId = getTenantIdFromVolumeGroup(volumeGroup) - if (volumeGroupTenantId == null) { - throw new Exception('Could not find Tenant Id element in Volume Group with Volume Group Id \'' + volumeGroupId + '\'' - + '\', AIC Cloud Region \'' + aicCloudRegion + '\'') - } - execution.setVariable('UPDVfModVol_volumeGroupTenantId', volumeGroupTenantId) - logDebug('Received Tenant Id \'' + volumeGroupTenantId + '\' from AAI for Volume Group with Volume Group Id \'' + volumeGroupId + '\'' - + '\', AIC Cloud Region \'' + aicCloudRegion + '\'', isDebugLogEnabled) - } else if (statusCode == 404) { - throw new Exception('Volume Group \'' + volumeGroupId + '\' not found at AAI') - } else { - throw new Exception('Bad status code ' + statusCode + ' received from AAI; Response data: ' + responseData) - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVolumeGroup(): ' + e.getMessage()) - } - } - - /** - * Prepare a Request for invoking the VnfAdapterRest subflow to do - * a Volume Group update. - * - * @param execution The flow's execution instance. - */ - public void prepVnfAdapterRest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepVnfAdapterRest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') - def tenantId = execution.getVariable('UPDVfModVol_tenantId') - def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') - def volumeGroupHeatStackId = execution.getVariable('UPDVfModVol_volumeGroupHeatStackId') - def vnfType = execution.getVariable('UPDVfModVol_vnfType') - - def volumeParamsXml = execution.getVariable('UPDVfModVol_volumeParams') - def volumeGroupParams = transformParamsToEntries(volumeParamsXml) - - def requestId = execution.getVariable('UPDVfModVol_requestId') - def serviceId = execution.getVariable('UPDVfModVol_serviceId') - - def messageId = execution.getVariable('mso-request-id') + '-' + System.currentTimeMillis() - def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) - def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") - if ('true'.equals(useQualifiedHostName)) { - notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) - } - - String vnfAdapterRestRequest = """ - - ${aicCloudRegion} - ${tenantId} - ${volumeGroupId} - ${volumeGroupHeatStackId} - ${vnfType} - - - - ${volumeGroupParams} - - true - - ${requestId} - ${serviceId} - - ${messageId} - ${notificationUrl} - - """ - vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest) - execution.setVariable('UPDVfModVol_vnfAdapterRestRequest', vnfAdapterRestRequest) - logDebug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest, isDebugLogEnabled) - - utils.logAudit("UpdateVfModuleVolume Request for VNFAdapter Rest: " + vnfAdapterRestRequest) - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage()) - } - } - - /** - * Prepare a Request for updating the DB for this Infra request. - * - * @param execution The flow's execution instance. - */ - public void prepDbInfraDbRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepDbInfraDbRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def requestId = execution.getVariable('UPDVfMod_requestId') - - String updateInfraRequest = """ - - - - - ${requestId} - BPEL - COMPLETE - 100 - - - - """ - - updateInfraRequest = utils.formatXml(updateInfraRequest) - execution.setVariable('UPDVfModVol_updateInfraRequest', updateInfraRequest) - logDebug('Request for Update Infra Request:\n' + updateInfraRequest, isDebugLogEnabled) - - utils.logAudit("UpdateVfModuleVolume Request for Updating DB for Infra: " + updateInfraRequest) - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 1002, 'Error in prepDbInfraDbRequest(): ' + e.getMessage()) - } - } - - /** - * Build a "CompletionHandler" request. - * - * @param execution The flow's execution instance. - */ - public void prepCompletionHandlerRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepCompletionHandlerRequest(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def requestInfo = execution.getVariable('UPDVfModVol_requestInfo') - - String content = """ - - ${requestInfo} - MSO_ACTIVATE_BPEL - - """ - - content = utils.formatXml(content) - logDebug('Request for Completion Handler:\n' + content, isDebugLogEnabled) - utils.logAudit("UpdateVfModuleVolume Completion Handler request: " + content) - execution.setVariable('UPDVfModVol_CompletionHandlerRequest', content) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepCompletionHandlerRequest(): ' + e.getMessage()) - } - } - - /** - * Build a "FalloutHandler" request. - * - * @param execution The flow's execution instance. - */ - public void prepFalloutHandler(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepFalloutHandler(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def requestInfo = execution.getVariable('UPDVfModVol_requestInfo') - - def WorkflowException workflowException = execution.getVariable("WorkflowException") - def errorResponseCode = workflowException.getErrorCode() - def errorResponseMsg = workflowException.getErrorMessage() - def encErrorResponseMsg = "" - if (errorResponseMsg != null) { - encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">") - } - - String content = """ - - ${requestInfo} - - ${encErrorResponseMsg} - ${errorResponseCode} - - - """ - content = utils.formatXml(content) - logDebug('Request for Fallout Handler:\n' + content, isDebugLogEnabled) - utils.logAudit("UpdateVfModuleVolume Fallout request: " + content) - execution.setVariable('UPDVfModVol_FalloutHandlerRequest', content) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 1002, 'Error in prepFalloutHandler(): ' + e.getMessage()) - } - } - - /** - * Create a WorkflowException for the error case where the Tenant Id from - * AAI did not match the Tenant Id in the incoming request. - * - * @param execution The flow's execution instance. - */ - public void handleTenantIdMismatch(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.handleTenantIdMismatch(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String processKey = getProcessKey(execution); - def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') - def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') - def tenantId = execution.getVariable('UPDVfModVol_tenantId') - def volumeGroupTenantId = execution.getVariable('UPDVfModVol_volumeGroupTenantId') - - def String errorMessage = 'TenantId \'' + tenantId + '\' in incoming request does not match Tenant Id \'' + volumeGroupTenantId + - '\' retrieved from AAI for Volume Group Id \'' + volumeGroupId + '\', AIC Cloud Region \'' + aicCloudRegion + '\'' - - logError('Error in UpdateVfModuleVol: ' + errorMessage) - - WorkflowException exception = new WorkflowException(processKey, 5000, errorMessage); - execution.setVariable("WorkflowException", exception); - - logDebug('Exited ' + method, isDebugLogEnabled) - utils.logAudit("UpdateVfModuleVolume workflowException in Tenant Mismatch: " + errorMessage) - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy deleted file mode 100644 index 913046b247..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy +++ /dev/null @@ -1,563 +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.bpmn.infrastructure.scripts - -import groovy.json.JsonSlurper - -import java.util.concurrent.ExecutionException; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.springframework.web.util.UriUtils -import org.openecomp.mso.bpmn.common.scripts.AaiUtil; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.bpmn.common.scripts.VfModuleBase; -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { - - /** - * Initialize the flow's variables. - * - * @param execution The flow's execution instance. - */ - private void initProcessVariables(DelegateExecution execution) { - execution.setVariable('prefix', 'UPDVfModVol_') - execution.setVariable('UPDVfModVol_Request', null) - execution.setVariable('UPDVfModVol_requestInfo', null) - execution.setVariable('UPDVfModVol_requestId', null) - execution.setVariable('UPDVfModVol_source', null) - execution.setVariable('UPDVfModVol_volumeInputs', null) - execution.setVariable('UPDVfModVol_volumeGroupId', null) - execution.setVariable('UPDVfModVol_vnfType', null) - execution.setVariable('UPDVfModVol_serviceId', null) - execution.setVariable('UPDVfModVol_aicCloudRegion', null) - execution.setVariable('UPDVfModVol_tenantId', null) - execution.setVariable('UPDVfModVol_volumeParams', null) - execution.setVariable('UPDVfModVol_volumeGroupHeatStackId', null) - execution.setVariable('UPDVfModVol_volumeGroupTenantId', null) - execution.setVariable('UpdateVfModuleVolumeSuccessIndicator', false) - } - - - /** - * Perform initial processing, such as request validation, initialization of variables, etc. - * * @param execution - */ - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - preProcessRequest(execution, isDebugEnabled) - } - - public void preProcessRequest(DelegateExecution execution, isDebugLogEnabled) { - - initProcessVariables(execution) - String jsonRequest = validateRequest(execution) - - def request = "" - - try { - def jsonSlurper = new JsonSlurper() - Map reqMap = jsonSlurper.parseText(jsonRequest) - - def serviceInstanceId = execution.getVariable('serviceInstanceId') - def volumeGroupId = execution.getVariable('volumeGroupId') - //def vnfId = execution.getVariable('vnfId') - - def vidUtils = new VidUtils(this) - request = vidUtils.createXmlVolumeRequest(reqMap, 'UPDATE_VF_MODULE_VOL', serviceInstanceId, volumeGroupId) - - execution.setVariable('UPDVfModVol_Request', request) - execution.setVariable("UPDVfModVol_isVidRequest", true) - - //need to get persona-model-id aka model-invariantId to use later to validate vf-module relation in AAI - - def modelInvariantId = reqMap.requestDetails.modelInfo.modelInvariantUuid ?: '' - execution.setVariable('UPDVfModVol_modelInvariantId', modelInvariantId) - - utils.log("DEBUG", "modelInvariantId from request: " + modelInvariantId, isDebugLogEnabled) - utils.log("DEBUG", "XML request:\n" + request, isDebugLogEnabled) - } - catch(groovy.json.JsonException je) { - utils.log("DEBUG", " Request is in XML format.", isDebugLogEnabled) - // assume request is in XML format - proceed as usual to process XML request - } - - def requestId = execution.getVariable('mso-request-id') - - def requestInfo = getRequiredNodeXml(execution, request, 'request-info') - execution.setVariable('UPDVfModVol_requestInfo', requestInfo) - execution.setVariable('UPDVfModVol_requestId', requestId) - //execution.setVariable('UPDVfModVol_requestId', getRequiredNodeText(execution, requestInfo, 'request-id')) - execution.setVariable('UPDVfModVol_source', getNodeTextForce(requestInfo, 'source')) - - def volumeInputs = getRequiredNodeXml(execution, request, 'volume-inputs') - execution.setVariable('UPDVfModVol_volumeInputs', volumeInputs) - execution.setVariable('UPDVfModVol_volumeGroupId', getRequiredNodeText(execution, volumeInputs, 'volume-group-id')) - execution.setVariable('UPDVfModVol_vnfType', getRequiredNodeText(execution, volumeInputs, 'vnf-type')) - execution.setVariable('UPDVfModVol_vnfVersion', getRequiredNodeText(execution, volumeInputs, 'asdc-service-model-version')) - execution.setVariable('UPDVfModVol_serviceId', utils.getNodeText1(volumeInputs, 'service-id')) - execution.setVariable('UPDVfModVol_aicCloudRegion', getRequiredNodeText(execution, volumeInputs, 'aic-cloud-region')) - execution.setVariable('UPDVfModVol_tenantId', getRequiredNodeText(execution, volumeInputs, 'tenant-id')) - //execution.setVariable('UPDVfModVol_modelCustomizationId', getRequiredNodeText(execution, volumeInputs, 'model-customization-id')) - - setBasicDBAuthHeader(execution, isDebugLogEnabled) - - def volumeParams = utils.getNodeXml(request, 'volume-params') - execution.setVariable('UPDVfModVol_volumeParams', volumeParams) - } - - /** - * Prepare and send the synchronous response. - * - * @param execution The flow's execution instance. - */ - public void sendSynchResponse(DelegateExecution execution, isDebugLogEnabled) { - - def requestInfo = execution.getVariable('UPDVfModVol_requestInfo') - def requestId = execution.getVariable('UPDVfModVol_requestId') - def source = execution.getVariable('UPDVfModVol_source') - def progress = getNodeTextForce(requestInfo, 'progress') - if (progress.isEmpty()) { - progress = '0' - } - def startTime = getNodeTextForce(requestInfo, 'start-time') - if (startTime.isEmpty()) { - startTime = System.currentTimeMillis() - } - def volumeInputs = execution.getVariable('UPDVfModVol_volumeInputs') - - String xmlSyncResponse = """ - - - ${requestId} - UPDATE_VF_MODULE_VOL - IN_PROGRESS - ${progress} - ${startTime} - ${source} - - ${volumeInputs} - - """ - - def syncResponse = '' - def isVidRequest = execution.getVariable('UPDVfModVol_isVidRequest') - - if(isVidRequest) { - def volumeGroupId = execution.getVariable('volumeGroupId') - syncResponse = """{"requestReferences":{"instanceId":"${volumeGroupId}","requestId":"${requestId}"}}""".trim() - } - else { - syncResponse = utils.formatXml(xmlSyncResponse) - } - - logDebug('Sync response: ' + syncResponse, isDebugLogEnabled) - execution.setVariable('UPDVfModVol_syncResponseSent', true) - sendWorkflowResponse(execution, 200, syncResponse) - } - - /** - * Prepare a Request for querying AAI for Volume Group information using the - * Volume Group Id and Aic Cloud Region. - * @param execution The flow's execution instance. - */ - public void queryAAIForVolumeGroup(DelegateExecution execution, isDebugLogEnabled) { - - def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') - def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') - - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) - String queryAAIVolumeGroupRequest = aaiEndpoint + '/' + URLEncoder.encode(aicCloudRegion, "UTF-8") + "/volume-groups/volume-group/" + UriUtils.encode(volumeGroupId, "UTF-8") - - utils.logAudit('Query AAI volume group by ID: ' + queryAAIVolumeGroupRequest) - logDebug('Query AAI volume group by ID: ' + queryAAIVolumeGroupRequest, isDebugLogEnabled) - - APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIVolumeGroupRequest) - - String returnCode = response.getStatusCode() - String aaiResponseAsString = response.getResponseBodyAsString() - aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) - - utils.logAudit("AAI query volume group by id return code: " + returnCode) - utils.logAudit("AAI query volume group by id response: " + aaiResponseAsString) - - logDebug("AAI Volume Group return code: " + returnCode, isDebugLogEnabled) - logDebug("AAI Volume Group response: " + aaiResponseAsString, isDebugLogEnabled) - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - if ((returnCode == '200') || (returnCode == '204')) { - - execution.setVariable('UPDVfModVol_aaiVolumeGroupResponse', aaiResponseAsString) - //def heatStackId = getNodeTextForce(aaiResponseAsString, 'heat-stack-id') - //execution.setVariable('UPDVfModVol_volumeGroupHeatStackId', heatStackId) - - def volumeGroupTenantId = getTenantIdFromVolumeGroup(aaiResponseAsString) - if (volumeGroupTenantId == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id " + volumeGroupId - + ", AIC Cloud Region " + aicCloudRegion) - } - execution.setVariable('UPDVfModVol_volumeGroupTenantId', volumeGroupTenantId) - logDebug("Received Tenant Id " + volumeGroupTenantId + " from AAI for Volume Group with Volume Group Id " + volumeGroupId + ", AIC Cloud Region " + aicCloudRegion, isDebugLogEnabled) - - def relatedVfModuleLink = getRelatedVfModuleRelatedLink(aaiResponseAsString) - logDebug("Related VF Module link: " + relatedVfModuleLink, isDebugLogEnabled) - execution.setVariable('UPDVfModVol_relatedVfModuleLink', relatedVfModuleLink) - - } - else if (returnCode == '404') { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group " + volumeGroupId + " not found at AAI") - } - else { - WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - throw new BpmnError("MSOWorkflowException") - } - } - - /** - * Query AAI service instance - * @param execution - * @param isDebugEnabled - */ - public void queryAAIForGenericVnf(DelegateExecution execution, isDebugEnabled) { - - def vnfId = execution.getVariable('vnfId') - - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = aaiUtil.getNetworkGenericVnfEndpoint(execution) - def String queryAAIRequest = aaiEndpoint + "/" + UriUtils.encode(vnfId, "UTF-8") - - utils.logAudit("AAI query generic vnf request: " + queryAAIRequest) - - APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIRequest) - - String returnCode = response.getStatusCode() - String aaiResponseAsString = response.getResponseBodyAsString() - aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) - - utils.logAudit("AAI query generic vnf return code: " + returnCode) - utils.logAudit("AAI query generic vnf response: " + aaiResponseAsString) - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - if (returnCode=='200') { - utils.log("DEBUG", 'Generic vnf ' + vnfId + ' found in AAI.', isDebugEnabled) - execution.setVariable('UPDVfModVol_AAIQueryGenericVfnResponse', aaiResponseAsString) - } else { - if (returnCode=='404') { - def message = 'Generic vnf ' + vnfId + ' was not found in AAI. Return code: 404.' - utils.log("DEBUG", message, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, message) - } else { - WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - throw new BpmnError("MSOWorkflowException") - } - } - } - - /** - * Query AAI for VF Module using vf-module-id - * @param execution - * @param isDebugLogEnabled - */ - public void queryAAIForVfModule(DelegateExecution execution, isDebugLogEnabled) { - - AaiUtil aaiUtil = new AaiUtil(this) - String queryAAIVfModuleRequest = execution.getVariable('UPDVfModVol_relatedVfModuleLink') - execution.setVariable('UPDVfModVol_personaModelId', '') - - utils.logAudit('Query AAI VF Module: ' + queryAAIVfModuleRequest) - logDebug('Query AAI VF Module: ' + queryAAIVfModuleRequest, isDebugLogEnabled) - - def aaiUrl = execution.getVariable("URN_aai_endpoint") - logDebug('A&AI URL: ' + aaiUrl, isDebugLogEnabled) - - def requestEndpoint = aaiUrl + queryAAIVfModuleRequest - logDebug('A&AI request endpoint: ' + requestEndpoint, isDebugLogEnabled) - - APIResponse response = aaiUtil.executeAAIGetCall(execution, requestEndpoint) - - String returnCode = response.getStatusCode() - String aaiResponseAsString = response.getResponseBodyAsString() - aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) - - utils.logAudit("AAI query vf-module: " + returnCode) - utils.logAudit("AAI query vf-module response: " + aaiResponseAsString) - - logDebug("AAI query vf-module:: " + returnCode, isDebugLogEnabled) - logDebug("AAI query vf-module response: " + aaiResponseAsString, isDebugLogEnabled) - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - if ((returnCode == '200') || (returnCode == '204')) { - def personaModelId = utils.getNodeText1(aaiResponseAsString, 'model-invariant-id') - if(personaModelId == null) { - //check old attribute name - personaModelId = utils.getNodeText1(aaiResponseAsString, 'persona-model-id') - } - logDebug("vfModule personaModelId: " + personaModelId, isDebugLogEnabled) - execution.setVariable('UPDVfModVol_personaModelId', personaModelId) - } - else if (returnCode == '404') { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "VF Module not found at AAI") - } - else { - WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - throw new BpmnError("MSOWorkflowException") - } - } - /** - * - */ - public String getRelatedVfModuleRelatedLink(xml) { - def list = new XmlSlurper().parseText(xml) - def vfModuleRelationship = list.'**'.find { node -> node.'related-to'.text() == 'vf-module' } - return vfModuleRelationship?.'related-link'?.text() ?: '' - } - - /** - * Prepare a Request for invoking the VnfAdapterRest subflow to do - * a Volume Group update. - * - * @param execution The flow's execution instance. - */ - public void prepVnfAdapterRest(DelegateExecution execution, isDebugLogEnabled) { - - def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') - def tenantId = execution.getVariable('UPDVfModVol_tenantId') - def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') - - def aaiVolumeGroupResponse = execution.getVariable('UPDVfModVol_aaiVolumeGroupResponse') - def volumeGroupHeatStackId = getNodeTextForce(aaiVolumeGroupResponse, 'heat-stack-id') - def volumeGroupName = getNodeTextForce(aaiVolumeGroupResponse, 'volume-group-name') - def modelCustomizationId = getNodeTextForce(aaiVolumeGroupResponse, 'vf-module-model-customization-id') - if(modelCustomizationId == null) { - // Check old attribute name - modelCustomizationId = getNodeTextForce(aaiVolumeGroupResponse, 'vf-module-persona-model-customization-id') - } - - def vnfType = execution.getVariable('UPDVfModVol_vnfType') - def vnfVersion = execution.getVariable('UPDVfModVol_vnfVersion') - - def aaiGenericVnfResponse = execution.getVariable('UPDVfModVol_AAIQueryGenericVfnResponse') - def vnfId = utils.getNodeText1(aaiGenericVnfResponse, 'vnf-id') - def vnfName = utils.getNodeText1(aaiGenericVnfResponse, 'vnf-name') - - - def volumeParamsXml = execution.getVariable('UPDVfModVol_volumeParams') - def volumeGroupParams = transformVolumeParamsToEntries(volumeParamsXml) - - def requestId = execution.getVariable('UPDVfModVol_requestId') - def serviceId = execution.getVariable('UPDVfModVol_serviceId') - - def messageId = execution.getVariable('mso-request-id') + '-' + System.currentTimeMillis() - def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) - def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") - if ('true'.equals(useQualifiedHostName)) { - notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) - } - - String vnfAdapterRestRequest = """ - - ${aicCloudRegion} - ${tenantId} - ${vnfId} - ${vnfName} - ${volumeGroupId} - ${volumeGroupName} - ${volumeGroupHeatStackId} - ${vnfType} - ${vnfVersion} - - ${modelCustomizationId} - - - vnf_id - ${vnfId} - - - vnf_name - ${vnfName} - - - vf_module_id - ${volumeGroupId} - - - vf_module_name - ${volumeGroupName} - - ${volumeGroupParams} - - true - - ${requestId} - ${serviceId} - - ${messageId} - ${notificationUrl} - - """ - vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest) - execution.setVariable('UPDVfModVol_vnfAdapterRestRequest', vnfAdapterRestRequest) - logDebug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest, isDebugLogEnabled) - } - - /** - * Prepare a Request for updating the DB for this Infra request. - * - * @param execution The flow's execution instance. - */ - public void prepDbInfraDbRequest(DelegateExecution execution, isDebugLogEnabled) { - - def requestId = execution.getVariable('UPDVfModVol_requestId') - ExceptionUtil exceptionUtil = new ExceptionUtil(); - - String updateInfraRequest = """ - - - - - ${requestId} - BPEL - COMPLETE - 100 - - - - """ - - updateInfraRequest = utils.formatXml(updateInfraRequest) - execution.setVariable('UPDVfModVol_updateInfraRequest', updateInfraRequest) - logDebug('Request for Update Infra Request:\n' + updateInfraRequest, isDebugLogEnabled) - } - - /** - * Build a "CompletionHandler" request. - * @param execution The flow's execution instance. - */ - public void prepCompletionHandlerRequest(DelegateExecution execution, requestId, action, source, isDebugLogEnabled) { - - String content = """ - - - ${requestId} - UPDATE - ${source} - - BPMN VF Module Volume action: UPDATE - - """ - - content = utils.formatXml(content) - logDebug('Request for Completion Handler:\n' + content, isDebugLogEnabled) - execution.setVariable('UPDVfModVol_CompletionHandlerRequest', content) - } - - - /** - * Build a "FalloutHandler" request. - * @param execution The flow's execution instance. - */ - public void prepFalloutHandler(DelegateExecution execution, isDebugLogEnabled) { - def requestId = execution.getVariable('UPDVfModVol_requestId') - def source = execution.getVariable('UPDVfModVol_source') - - String requestInfo = """ - - ${requestId} - UPDATE - ${source} - """ - - def WorkflowException workflowException = execution.getVariable("WorkflowException") - def errorResponseCode = workflowException.getErrorCode() - def errorResponseMsg = workflowException.getErrorMessage() - def encErrorResponseMsg = "" - if (errorResponseMsg != null) { - encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">") - } - - String content = """ - - ${requestInfo} - - ${encErrorResponseMsg} - ${errorResponseCode} - - - """ - content = utils.formatXml(content) - logDebug('Request for Fallout Handler:\n' + content, isDebugLogEnabled) - execution.setVariable('UPDVfModVol_FalloutHandlerRequest', content) - } - - /** - * Create a WorkflowException for the error case where the Tenant Id from - * AAI did not match the Tenant Id in the incoming request. - * @param execution The flow's execution instance. - */ - public void handleTenantIdMismatch(DelegateExecution execution, isDebugLogEnabled) { - - def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') - def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') - def tenantId = execution.getVariable('UPDVfModVol_tenantId') - def volumeGroupTenantId = execution.getVariable('UPDVfModVol_volumeGroupTenantId') - - def String errorMessage = "TenantId " + tenantId + " in incoming request does not match Tenant Id " + volumeGroupTenantId + - " retrieved from AAI for Volume Group Id " + volumeGroupId + ", AIC Cloud Region " + aicCloudRegion - - ExceptionUtil exceptionUtil = new ExceptionUtil() - logError('Error in UpdateVfModuleVol: ' + errorMessage) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - } - - /** - * Create a WorkflowException for the error case where the Personal Model Id from - * AAI did not match the model invariant ID in the incoming request. - * @param execution The flow's execution instance. - */ - public void handlePersonaModelIdMismatch(DelegateExecution execution, isDebugLogEnabled) { - - def modelInvariantId = execution.getVariable('UPDVfModVol_modelInvariantId') - def personaModelId = execution.getVariable('UPDVfModVol_personaModelId') - - def String errorMessage = "Model Invariant ID " + modelInvariantId + " in incoming request does not match persona model ID " + personaModelId + - " retrieved from AAI for Volume Group Id " - - ExceptionUtil exceptionUtil = new ExceptionUtil() - logError('Error in UpdateVfModuleVol: ' + errorMessage) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy deleted file mode 100644 index 0b6ddb8ad2..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy +++ /dev/null @@ -1,501 +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.bpmn.infrastructure.scripts - -import groovy.json.JsonOutput -import groovy.json.JsonSlurper -import groovy.util.Node -import groovy.util.XmlParser; -import groovy.xml.QName - -import java.io.Serializable; -import java.util.UUID; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.client.aai.* - -import org.openecomp.mso.client.appc.ApplicationControllerOrchestrator -import org.onap.appc.client.lcm.model.Action; -import org.onap.appc.client.lcm.model.ActionIdentifiers; -import org.onap.appc.client.lcm.model.LockInput -import org.onap.appc.client.lcm.model.UnlockInput -import org.onap.appc.client.lcm.model.HealthCheckInput -import org.onap.appc.client.lcm.model.StartInput -import org.onap.appc.client.lcm.model.StopInput -import org.onap.appc.client.lcm.model.Flags -import org.onap.appc.client.lcm.model.Status - - - -public class UpdateVnfInfra extends VnfCmBase { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtils = new JsonUtils() - def prefix = "UPDVnfI_" - - /** - * Initialize the flow's variables. - * - * @param execution The flow's execution instance. - */ - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable('prefix', 'UPDVnfI_') - execution.setVariable('Request', null) - execution.setVariable('source', null) - execution.setVariable('vnfInputs', null) - execution.setVariable('tenantId', null) - execution.setVariable('vnfParams', null) - execution.setVariable('controllerType', null) - execution.setVariable('UpdateVnfSuccessIndicator', false) - execution.setVariable('serviceType', null) - execution.setVariable('nfRole', null) - execution.setVariable('currentActivity', 'UPDVnfI') - execution.setVariable('workStep', null) - execution.setVariable('failedActivity', null) - execution.setVariable('errorCode', "0") - execution.setVariable('errorText', null) - execution.setVariable('healthCheckIndex0', 0) - execution.setVariable('healthCheckIndex1', 1) - execution.setVariable("rollbackSetClosedLoopDisabledFlag", false) - execution.setVariable("rollbackVnfStop", false) - execution.setVariable("rollbackVnfLock", false) - execution.setVariable("rollbackQuiesceTraffic", false) - execution.setVariable("rollbackSetVnfInMaintenanceFlag", false) - } - - /** - * Check for missing elements in the received request. - * - * @param execution The flow's execution instance. - */ - public void preProcessRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - initProcessVariables(execution) - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - initProcessVariables(execution) - - def incomingRequest = execution.getVariable('bpmnRequest') - - utils.log("DEBUG", "Incoming Infra Request: " + incomingRequest, isDebugLogEnabled) - try { - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - Map reqMap = jsonSlurper.parseText(incomingRequest) - utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled) - - execution.setVariable("isVidRequest", "true") - execution.setVariable('serviceType', 'Mobility') - execution.setVariable('actionLock', Action.Lock) - execution.setVariable('actionUnlock', Action.Unlock) - execution.setVariable('actionHealthCheck', Action.HealthCheck) - execution.setVariable('actionStart', Action.Start) - execution.setVariable('actionStop', Action.Stop) - - def asdcServiceModelVersion = '' - def serviceModelInfo = null - - def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList - - if (relatedInstanceList != null) { - relatedInstanceList.each { - if (it.relatedInstance.modelInfo?.modelType == 'service') { - utils.log("DEBUG", "PROCESSING SERVICE INFO", isDebugLogEnabled) - asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion - serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) - utils.log("DEBUG", "ServiceModelInfo: " + serviceModelInfo, isDebugLogEnabled) - def modelInvariant = jsonUtils.getJsonValue(serviceModelInfo, "modelInvariantUuid") - utils.log("DEBUG", "modelInvariant: " + modelInvariant, isDebugLogEnabled) - } - - } - } - - execution.setVariable('asdcServiceModelVersion', asdcServiceModelVersion) - execution.setVariable('serviceModelInfo', serviceModelInfo) - def vnfModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo) - execution.setVariable('vnfModelInfo', vnfModelInfo) - def vnfModelInvariantUuid = jsonUtils.getJsonValue(vnfModelInfo, "modelInvariantUuid") - execution.setVariable('vnfModelInvariantUuid', vnfModelInvariantUuid) - logDebug("vnfModelInvariantUuid: " + vnfModelInvariantUuid, isDebugLogEnabled) - - def vnfType = execution.getVariable('vnfType') - execution.setVariable('vnfType', vnfType) - - def controllerType = reqMap.requestDetails?.requestParameters?.controllerType - execution.setVariable('controllerType', controllerType) - - utils.log("DEBUG", 'Controller Type: ' + controllerType, isDebugLogEnabled) - - def userParams = reqMap.requestDetails?.requestParameters?.userParams - - Map userParamsMap = [:] - if (userParams != null) { - userParams.each { userParam -> - userParamsMap.put(userParam.name, userParam.value.toString()) - } - } - - utils.log("DEBUG", 'Processed user params: ' + userParamsMap, isDebugLogEnabled) - - execution.setVariable('vfModuleInputParams', userParamsMap) - - def requestId = execution.getVariable("mso-request-id") - execution.setVariable('requestId', requestId) - execution.setVariable('msoRequestId', requestId) - - - def vnfName = reqMap.requestDetails?.requestInfo?.instanceName ?: null - execution.setVariable('vnfName', vnfName) - - def requestorId = reqMap.requestDetails?.requestInfo?.requestorId ?: null - execution.setVariable('requestorId', requestorId) - - def usePreload = reqMap.requestDetails?.requestParameters?.usePreload - execution.setVariable('usePreload', usePreload) - - def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration - def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId - execution.setVariable('lcpCloudRegionId', lcpCloudRegionId) - def tenantId = cloudConfiguration.tenantId - execution.setVariable('tenantId', tenantId) - - def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: '' - execution.setVariable('globalSubscriberId', globalSubscriberId) - - execution.setVariable('sdncVersion', '1702') - - execution.setVariable("UpdateVnfInfraSuccessIndicator", false) - - execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) - - def source = reqMap.requestDetails?.requestInfo?.source - execution.setVariable("source", source) - - //For Completion Handler & Fallout Handler - String requestInfo = - """ - ${requestId} - UPDATE - ${source} - """ - - execution.setVariable("requestInfo", requestInfo) - - logDebug('RequestInfo: ' + execution.getVariable("requestInfo"), isDebugLogEnabled) - - logDebug('Exited ' + method, isDebugLogEnabled) - - } - catch(groovy.json.JsonException je) { - utils.log("DEBUG", " Request is not in JSON format.", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") - - } - catch(Exception e) { - String restFaultMessage = e.getMessage() - utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) - } - } - - /** - * Prepare and send the sychronous response for this flow. - * - * @param execution The flow's execution instance. - */ - public void sendSynchResponse(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sendSynchResponse(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - - try { - def requestInfo = execution.getVariable('requestInfo') - def requestId = execution.getVariable('requestId') - def source = execution.getVariable('source') - def progress = getNodeTextForce(requestInfo, 'progress') - if (progress.isEmpty()) { - progress = '0' - } - def startTime = getNodeTextForce(requestInfo, 'start-time') - if (startTime.isEmpty()) { - startTime = System.currentTimeMillis() - } - - // RESTResponse (for API Handler (APIH) Reply Task) - def vnfId = execution.getVariable("vnfId") - String synchResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() - - sendWorkflowResponse(execution, 200, synchResponse) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) - } - } - - - - /** - * Get VnfResource decomposition object for this VNF. - * - * - * @param execution The flow's execution instance. - */ - public void getVnfResourceDecomposition(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.getVnfResourceDecomposition(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid') - logDebug("vnfModelInvariantUuid: " + vnfModelInvariantUuid, isDebugLogEnabled) - List vnfResources = serviceDecomposition.getServiceVnfs() - - for (i in 0..vnfResources.size()-1) { - ModelInfo modelInfo = vnfResources[i].getModelInfo() - String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid() - logDebug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition, isDebugLogEnabled) - - if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { - VnfResource vnfResourceDecomposition = vnfResources[i] - execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition) - def nfRole = vnfResourceDecomposition.getNfRole() - execution.setVariable('nfRole', nfRole) - logDebug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString(), isDebugLogEnabled) - break - } - else { - //exception! - } - - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage()) - } - } - - /** - * Check if this VNF is already in maintenance in A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void checkIfVnfInMaintInAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - execution.setVariable("workStep", "checkIfVnfInMaintInAAI") - execution.setVariable("failedActivity", "AAI") - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - AAIRestClientImpl client = new AAIRestClientImpl() - AAIValidatorImpl aaiValidator = new AAIValidatorImpl() - aaiValidator.setClient(client) - def vnfId = execution.getVariable("vnfId") - boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid) - logDebug("isInMaint result: " + isInMaint, isDebugLogEnabled) - execution.setVariable('isVnfInMaintenance', isInMaint) - - if (isInMaint) { - execution.setVariable("errorCode", "1003") - execution.setVariable("errorText", "VNF is in maintenance in A&AI") - } - - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) - } - } - - - /** - * Check if this VNF's pservers are locked in A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void checkIfPserversInMaintInAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("workStep", "checkIfPserversInMaintInAAI") - execution.setVariable("failedActivity", "AAI") - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - AAIRestClientImpl client = new AAIRestClientImpl() - AAIValidatorImpl aaiValidator = new AAIValidatorImpl() - aaiValidator.setClient(client) - def vnfId = execution.getVariable("vnfId") - boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid) - logDebug("areLocked result: " + areLocked, isDebugLogEnabled) - execution.setVariable('arePserversLocked', areLocked) - - if (areLocked) { - execution.setVariable("errorCode", "1003") - execution.setVariable("errorText", "pServers are locked in A&AI") - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) - } - } - - /** - * Set inMaint flag for this VNF to the specified value in A&AI. - * - * - * @param execution The flow's execution instance. - * @param inMaint The boolean value of the flag to set - */ - public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) { - def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - if (inMaint) { - execution.setVariable("workStep", "setVnfInMaintFlagInAAI") - } - else { - execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI") - } - execution.setVariable("failedActivity", "AAI") - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - AAIRestClientImpl client = new AAIRestClientImpl() - AAIUpdatorImpl aaiUpdator = new AAIUpdatorImpl() - aaiUpdator.setClient(client) - def vnfId = execution.getVariable("vnfId") - if (inMaint) { - aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid) - execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) - } - else { - aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid) - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage()) - } - } - - - - /** - * Prepare DoUpdateVnfAndModules call. - * - * - * @param execution The flow's execution instance. - */ - public void prepDoUpdateVnfAndModules(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepDoUpdateVnfAndModules(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("workStep", "doUpdateVnfAndModules") - execution.setVariable("failedActivity", "MSO Update VNF") - logDebug('Exited ' + method, isDebugLogEnabled) - - } - - - /** - * Handle Abort disposition from RainyDayHandler - * - * @param execution The flow's execution instance. - */ - public void abortProcessing(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.abortProcessing(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - def errorText = execution.getVariable("errorText") - def errorCode = execution.getVariable("errorCode") - - exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText) - } - - - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfCmBase.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfCmBase.groovy deleted file mode 100644 index d8405aa243..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfCmBase.groovy +++ /dev/null @@ -1,812 +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.bpmn.infrastructure.scripts - -import groovy.json.JsonOutput -import groovy.json.JsonSlurper -import groovy.util.Node -import groovy.util.XmlParser; -import groovy.xml.QName - -import org.json.JSONArray -import org.json.JSONObject - -import java.io.Serializable; -import java.util.List -import java.util.UUID; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.client.aai.* - -import org.openecomp.mso.client.appc.ApplicationControllerClient; -import org.openecomp.mso.client.appc.ApplicationControllerSupport; -import org.openecomp.mso.client.aai.entities.AAIResultWrapper -import org.openecomp.mso.client.aai.entities.Relationships -import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri -import org.openecomp.mso.client.aai.entities.uri.AAIUri -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory -import org.onap.appc.client.lcm.model.Action; -import org.onap.appc.client.lcm.model.ActionIdentifiers; -import org.onap.appc.client.lcm.model.LockInput -import org.onap.appc.client.lcm.model.UnlockInput -import org.onap.appc.client.lcm.model.HealthCheckInput -import org.onap.appc.client.lcm.model.StartInput -import org.onap.appc.client.lcm.model.StopInput -import org.onap.appc.client.lcm.model.Flags -import org.onap.appc.client.lcm.model.Status - - - -public abstract class VnfCmBase extends AbstractServiceTaskProcessor { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtils = new JsonUtils() - def prefix = "VnfIPU_" - - /** - * Initialize the flow's variables. - * - * @param execution The flow's execution instance. - */ - - /** - * Prepare and send the sychronous response for this flow. - * - * @param execution The flow's execution instance. - */ - public void sendSynchResponse(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sendSynchResponse(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - - try { - def requestInfo = execution.getVariable('requestInfo') - def requestId = execution.getVariable('requestId') - def source = execution.getVariable('source') - def progress = getNodeTextForce(requestInfo, 'progress') - if (progress.isEmpty()) { - progress = '0' - } - def startTime = getNodeTextForce(requestInfo, 'start-time') - if (startTime.isEmpty()) { - startTime = System.currentTimeMillis() - } - - // RESTResponse (for API Handler (APIH) Reply Task) - def vnfId = execution.getVariable("vnfId") - String synchResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() - - sendWorkflowResponse(execution, 200, synchResponse) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) - } - } - - - - /** - * Get VnfResource decomposition object for this VNF. - * - * - * @param execution The flow's execution instance. - */ - public void getVnfResourceDecomposition(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.getVnfResourceDecomposition(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid') - logDebug("vnfModelInvariantUuid: " + vnfModelInvariantUuid, isDebugLogEnabled) - List vnfResources = serviceDecomposition.getServiceVnfs() - - for (i in 0..vnfResources.size()-1) { - ModelInfo modelInfo = vnfResources[i].getModelInfo() - String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid() - logDebug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition, isDebugLogEnabled) - - if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { - VnfResource vnfResourceDecomposition = vnfResources[i] - execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition) - def nfRole = vnfResourceDecomposition.getNfRole() - execution.setVariable('nfRole', nfRole) - logDebug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString(), isDebugLogEnabled) - break - } - else { - //exception! - } - - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage()) - } - } - - /** - * Check if this VNF is already in maintenance in A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void checkIfVnfInMaintInAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - execution.setVariable("workStep", "checkIfVnfInMaintInAAI") - execution.setVariable("failedActivity", "AAI") - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - AAIRestClientImpl client = new AAIRestClientImpl() - AAIValidatorImpl aaiValidator = new AAIValidatorImpl() - aaiValidator.setClient(client) - def vnfId = execution.getVariable("vnfId") - boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid) - logDebug("isInMaint result: " + isInMaint, isDebugLogEnabled) - execution.setVariable('isVnfInMaintenance', isInMaint) - - if (isInMaint) { - execution.setVariable("errorCode", "1003") - execution.setVariable("errorText", "VNF is in maintenance in A&AI") - } - - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) - } - } - - /** - * Get VNF info from A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void queryAAIForVnf(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.queryAAIForVnf(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - def vnfId = execution.getVariable("vnfId") - logDebug("vnfId is: " + vnfId, isDebugLogEnabled) - def cloudRegionId = execution.getVariable("lcpCloudRegionId") - logDebug("cloudRegionId is: " + cloudRegionId, isDebugLogEnabled) - - AAIResourcesClient client = new AAIResourcesClient() - - AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) - // Check if this VNF exists - if (!client.exists(genericVnfUri)) { - logDebug("VNF with vnfId " + vnfId + " does not exist in A&AI", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 404, "VNF with vnfId " + vnfId + " does not exist in A&AI") - } - - AAIResultWrapper aaiRW = client.get(genericVnfUri) - - Map result = aaiRW.asMap() - - String vnfName = result.get("vnf-name") - logDebug("vnfName from A&AI is: " + vnfName, isDebugLogEnabled) - execution.setVariable("vnfName", vnfName) - String nfRole = result.get("nf-role") - logDebug("nfRole from A&AI is: " + nfRole, isDebugLogEnabled) - execution.setVariable("nfRole", nfRole) - String vnfHostIpAddress = result.get("ipv4-oam-address") - logDebug("vnfHostIpAddress from A&AI is: " + vnfHostIpAddress, isDebugLogEnabled) - execution.setVariable("vnfHostIpAddress", vnfHostIpAddress) - execution.setVariable("vmIdList", null) - if (aaiRW.getRelationships() != null) { - Relationships relationships = aaiRW.getRelationships().get() - if (relationships != null) { - - List vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER) - JSONArray vserverIds = new JSONArray() - - for (AAIResourceUri j in vserverUris) { - - String vserverId = j.getURIKeys().get('vserver-id') - vserverIds.put(vserverId) - } - - JSONObject vmidsArray = new JSONObject() - vmidsArray.put("vmIds", vserverIds.toString()) - - logDebug("vmidsArray is: " + vmidsArray.toString(), isDebugLogEnabled) - - execution.setVariable("vmIdList", vmidsArray.toString()) - } - } - - if (cloudRegionId != null) { - String cloudOwnerId = "att-aic"; - try { - cloudOwnerId = execution.getVariable("URN_mso_default_cloud_owner_id"); - if (cloudOwnerId == null) cloudOwnerId = "att-aic"; - } catch (RuntimeException e) { - cloudOwnerId = "att-aic"; - } - - AAIUri cloudRegionUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwnerId, cloudRegionId) - // Check if this client region exists - if (!client.exists(cloudRegionUri)) { - logDebug("Cloud Region with cloudOwner ID " + cloudOwnerId + " and cloudRegionId " + cloudRegionId + " does not exist in A&AI", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Cloud Region with cloudRegionId " + cloudRegionId + " does not exist in A&AI") - } - - AAIResultWrapper aaiRWCloud = client.get(cloudRegionUri) - - Map resultCloud = aaiRWCloud.asMap() - - String aicIdentity = resultCloud.get("identity-url") - logDebug("aicIdentity from A&AI is: " + aicIdentity, isDebugLogEnabled) - execution.setVariable("aicIdentity", aicIdentity) - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVnf(): ' + e.getMessage()) - } - } - - - - /** - * Check if this VNF's pservers are locked in A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void checkIfPserversInMaintInAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("workStep", "checkIfPserversInMaintInAAI") - execution.setVariable("failedActivity", "AAI") - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - AAIRestClientImpl client = new AAIRestClientImpl() - AAIValidatorImpl aaiValidator = new AAIValidatorImpl() - aaiValidator.setClient(client) - def vnfId = execution.getVariable("vnfId") - boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid) - logDebug("areLocked result: " + areLocked, isDebugLogEnabled) - execution.setVariable('arePserversLocked', areLocked) - - if (areLocked) { - execution.setVariable("errorCode", "1003") - execution.setVariable("errorText", "pServers are locked in A&AI") - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) - } - } - - /** - * Set inMaint flag for this VNF to the specified value in A&AI. - * - * - * @param execution The flow's execution instance. - * @param inMaint The boolean value of the flag to set - */ - public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) { - def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - if (inMaint) { - execution.setVariable("workStep", "setVnfInMaintFlagInAAI") - } - else { - execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI") - } - execution.setVariable("failedActivity", "AAI") - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - AAIRestClientImpl client = new AAIRestClientImpl() - AAIUpdatorImpl aaiUpdator = new AAIUpdatorImpl() - aaiUpdator.setClient(client) - def vnfId = execution.getVariable("vnfId") - if (inMaint) { - aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid) - execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) - } - else { - aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid) - execution.setVariable("rollbackSetVnfInMaintenanceFlag", false) - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage()) - } - } - - /** - * Check if VF Closed Loop Disabled in A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void checkIfClosedLoopDisabledInAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.checkIfClosedLoopDisabledInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - execution.setVariable("workStep", "checkClosedLoopDisabledFlagInAAI") - execution.setVariable("failedActivity", "AAI") - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - def vnfId = execution.getVariable("vnfId") - logDebug("vnfId is: " + vnfId, isDebugLogEnabled) - AAIResourcesClient client = new AAIResourcesClient() - AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) - AAIResultWrapper aaiRW = client.get(genericVnfUri) - Map result = aaiRW.asMap() - boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false) - - logDebug("isClosedLoopDisabled result: " + isClosedLoopDisabled, isDebugLogEnabled) - execution.setVariable('isClosedLoopDisabled', isClosedLoopDisabled) - - if (isClosedLoopDisabled) { - execution.setVariable("errorCode", "1004") - execution.setVariable("errorText", "closedLoop is disabled in A&AI") - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - } - } - - /** - * Set VF Closed Loop Disabled Flag in A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void setClosedLoopDisabledInAAI(DelegateExecution execution, boolean setDisabled) { - def method = getClass().getSimpleName() + '.setClosedLoopDisabledInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - if (setDisabled) { - execution.setVariable("workStep", "setClosedLoopDisabledFlagInAAI") - execution.setVariable("rollbackSetClosedLoopDisabledFlag", true) - } - else { - execution.setVariable("workStep", "unsetClosedLoopDisabledFlagInAAI") - execution.setVariable("rollbackSetClosedLoopDisabledFlag", false) - } - - execution.setVariable("failedActivity", "AAI") - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - def vnfId = execution.getVariable("vnfId") - AAIResourcesClient client = new AAIResourcesClient() - AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) - - Map request = new HashMap<>() - request.put("is-closed-loop-disabled", setDisabled) - client.update(genericVnfUri, request) - logDebug("set isClosedLoop to: " + setDisabled, isDebugLogEnabled) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - } - } - - - - - /** - * Call APP-C client to execute specified APP-C command for this VNF. - * - * - * @param execution The flow's execution instance. - * @param action The action to take in APP-C. - */ - public void runAppcCommand(DelegateExecution execution, Action action) { - def method = getClass().getSimpleName() + '.runAppcCommand(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - - ApplicationControllerClient appcClient = null - - try { - logDebug("Running APP-C action: " + action.toString(), isDebugLogEnabled) - String vnfId = execution.getVariable('vnfId') - String msoRequestId = execution.getVariable('requestId') - execution.setVariable('msoRequestId', msoRequestId) - execution.setVariable("failedActivity", "APP-C") - - appcClient = new ApplicationControllerClient() - ApplicationControllerSupport support = new ApplicationControllerSupport() - appcClient.appCSupport=support - org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage", "org.onap.appc.client.lcm.model"); - Flags flags = new Flags(); - ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); - actionIdentifiers.setVnfId(vnfId); - Status appcStatus - switch(action) { - case Action.Lock: - execution.setVariable('workStep', "LockVNF") - appcStatus = appcClient.runCommand(Action.Lock,actionIdentifiers,null,msoRequestId) - break - case Action.Unlock: - execution.setVariable('workStep', "UnlockVNF") - appcStatus = appcClient.runCommand(Action.Unlock,actionIdentifiers,null,msoRequestId) - break - case Action.HealthCheck: - def healthCheckIndex = execution.getVariable('healthCheckIndex') - execution.setVariable('workStep', "HealthCheckVNF" + healthCheckIndex) - execution.setVariable('healthCheckIndex', healthCheckIndex + 1) - appcStatus = appcClient.runCommand(Action.HealthCheck,actionIdentifiers,null,msoRequestId) - break - case Action.Start: - execution.setVariable('workStep', "StartVNF") - appcStatus = appcClient.runCommand(Action.Start,actionIdentifiers,null,msoRequestId) - break - case Action.Stop: - execution.setVariable('workStep', "StopVNF") - appcStatus = appcClient.runCommand(Action.Stop,actionIdentifiers,null,msoRequestId) - break - default: - break - } - logDebug("Completed AppC request", isDebugLogEnabled) - int appcCode = appcStatus.getCode() - logDebug("AppC status code is: " + appcCode, isDebugLogEnabled) - logDebug("AppC status message is: " + appcStatus.getMessage(), isDebugLogEnabled) - if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) { - execution.setVariable("errorCode", Integer.toString(appcCode)) - execution.setVariable("errorText", appcStatus.getMessage()) - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - - } catch (java.lang.NoSuchMethodError e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - - } - } - - /** - * Placeholder for a call to APP-C client to execute specified APP-C command for this VNF. - * - * - * @param execution The flow's execution instance. - * @param action The action to take in APP-C. - */ - public void runAppcCommandPlaceholder(DelegateExecution execution, String action) { - def method = getClass().getSimpleName() + '.runAppcCommandPlaceholder(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("failedActivity", "APP-C") - execution.setVariable("workStep", action) - } - - - - - - - - /** - * Builds a "CompletionHandler" request and stores it in the specified execution variable. - * - * @param execution the execution - * @param resultVar the execution variable in which the result will be stored - */ - public void completionHandlerPrep(DelegateExecution execution, String resultVar) { - def method = getClass().getSimpleName() + '.completionHandlerPrep(' + - 'execution=' + execution.getId() + - ', resultVar=' + resultVar + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - - def requestInfo = execution.getVariable('requestInfo') - - String content = """ - - ${requestInfo} - Vnf has been updated successfully. - MSO_ACTIVATE_BPEL - - """ - - content = utils.formatXml(content) - logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) - execution.setVariable(resultVar, content) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') - } - } - - /** - * Prepare DoUpdateVnfAndModules call. - * - * - * @param execution The flow's execution instance. - */ - public void prepDoUpdateVnfAndModules(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.prepDoUpdateVnfAndModules(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("workStep", "doUpdateVnfAndModules") - execution.setVariable("failedActivity", "MSO Update VNF") - logDebug('Exited ' + method, isDebugLogEnabled) - - } - - /** - * Builds a "FalloutHandler" request and stores it in the specified execution variable. - * - * @param execution the execution - * @param resultVar the execution variable in which the result will be stored - */ - public void falloutHandlerPrep(DelegateExecution execution, String resultVar) { - def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + - 'execution=' + execution.getId() + - ', resultVar=' + resultVar + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def prefix = execution.getVariable('prefix') - def requestInformation = execution.getVariable("requestInfo") - - def WorkflowException workflowException = execution.getVariable("WorkflowException") - def errorResponseCode = workflowException.getErrorCode() - def errorResponseMsg = workflowException.getErrorMessage() - def encErrorResponseMsg = "" - if (errorResponseMsg != null) { - encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">") - } - - String content = """ - - ${requestInformation} - - ${encErrorResponseMsg} - ${errorResponseCode} - - - """ - content = utils.formatXml(content) - logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) - execution.setVariable(resultVar, content) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') - } - } - - /** - * Handle Abort disposition from RainyDayHandler - * - * @param execution The flow's execution instance. - */ - public void abortProcessing(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.abortProcessing(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - def errorText = execution.getVariable("errorText") - def errorCode = execution.getVariable("errorCode") - - exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText) - } - - /** - * Increment Retry Count for Current Work Step - * - * @param execution The flow's execution instance. - */ - public void incrementRetryCount(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.incrementRetryCount(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String retryCountVariableName = execution.getVariable("workStep") + "RetryCount" - execution.setVariable("retryCountVariableName", retryCountVariableName) - - def retryCountVariable = execution.getVariable(retryCountVariableName) - int retryCount = 0 - - if (retryCountVariable != null) { - retryCount = (int) retryCountVariable - } - - retryCount += 1 - - execution.setVariable(retryCountVariableName, retryCount) - - logDebug("value of " + retryCountVariableName + " is " + retryCount, isDebugLogEnabled) - logDebug('Exited ' + method, isDebugLogEnabled) - - - } - - public void preProcessRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled) - try { - - Object workflowException = execution.getVariable("WorkflowException"); - - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) - execution.setVariable("prevWorkflowException", workflowException); - //execution.setVariable("WorkflowException", null); - } - } catch (BpmnError e) { - utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) - } catch(Exception ex) { - String msg = "Exception in preProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled) - } - - public void postProcessRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled) - String msg = "" - try { - Object workflowException = execution.getVariable("prevWorkflowException"); - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) - execution.setVariable("WorkflowException", workflowException); - } - - } catch (BpmnError b) { - utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) - throw b; - } catch(Exception ex) { - msg = "Exception in postProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugEnabled) - } - - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy deleted file mode 100644 index aa3320044d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy +++ /dev/null @@ -1,507 +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.bpmn.infrastructure.scripts - -import groovy.json.JsonOutput -import groovy.json.JsonSlurper -import groovy.util.Node -import groovy.util.XmlParser; -import groovy.xml.QName - -import java.io.Serializable; -import java.util.UUID; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.client.aai.* - -import org.openecomp.mso.client.appc.ApplicationControllerClient; -import org.openecomp.mso.client.appc.ApplicationControllerSupport; -import org.openecomp.mso.client.aai.AAIResourcesClient -import org.openecomp.mso.client.aai.entities.AAIResultWrapper -import org.openecomp.mso.client.aai.entities.uri.AAIUri -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory -import org.onap.appc.client.lcm.model.Action; -import org.onap.appc.client.lcm.model.ActionIdentifiers; -import org.onap.appc.client.lcm.model.LockInput -import org.onap.appc.client.lcm.model.UnlockInput -import org.onap.appc.client.lcm.model.HealthCheckInput -import org.onap.appc.client.lcm.model.StartInput -import org.onap.appc.client.lcm.model.StopInput -import org.onap.appc.client.lcm.model.Flags -import org.onap.appc.client.lcm.model.Status - - -public class VnfConfigUpdate extends VnfCmBase { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtils = new JsonUtils() - def prefix = "VnfIPU_" - - /** - * Initialize the flow's variables. - * - * @param execution The flow's execution instance. - */ - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable('prefix', 'VnfCU_') - execution.setVariable('Request', null) - execution.setVariable('source', null) - execution.setVariable('controllerType', null) - execution.setVariable('UpdateVnfSuccessIndicator', false) - execution.setVariable('serviceType', null) - execution.setVariable('nfRole', null) - execution.setVariable('currentActivity', 'VnfCU') - execution.setVariable('workStep', null) - execution.setVariable('failedActivity', null) - execution.setVariable('errorCode', "0") - execution.setVariable('errorText', null) - execution.setVariable('healthCheckIndex0', 0) - execution.setVariable('healthCheckIndex1', 1) - execution.setVariable('maxRetryCount', 3) - execution.setVariable('retryCount', 0) - execution.setVariable("lcpCloudRegionId", null) - execution.setVariable("rollbackSetClosedLoopDisabledFlag", false) - execution.setVariable("rollbackVnfStop", false) - execution.setVariable("rollbackVnfLock", false) - execution.setVariable("rollbackQuiesceTraffic", false) - execution.setVariable("rollbackSetVnfInMaintenanceFlag", false) - } - - /** - * Check for missing elements in the received request. - * - * @param execution The flow's execution instance. - */ - public void preProcessRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - initProcessVariables(execution) - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - initProcessVariables(execution) - - def incomingRequest = execution.getVariable('bpmnRequest') - - utils.log("DEBUG", "Incoming Infra Request: " + incomingRequest, isDebugLogEnabled) - try { - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - Map reqMap = jsonSlurper.parseText(incomingRequest) - utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled) - - def serviceInstanceId = execution.getVariable('serviceInstanceId') - def vnfId = execution.getVariable('vnfId') - - execution.setVariable('serviceInstanceId', serviceInstanceId) - execution.setVariable('vnfId', vnfId) - execution.setVariable('serviceType', 'Mobility') - execution.setVariable('payload', "") - execution.setVariable('actionHealthCheck', Action.HealthCheck) - execution.setVariable('actionConfigModify', Action.ConfigModify) - - def controllerType = reqMap.requestDetails?.requestParameters?.controllerType - execution.setVariable('controllerType', controllerType) - - utils.log("DEBUG", 'Controller Type: ' + controllerType, isDebugLogEnabled) - - def payload = reqMap.requestDetails?.requestParameters?.payload - execution.setVariable('payload', payload) - - utils.log("DEBUG", 'Processed payload: ' + payload, isDebugLogEnabled) - - def requestId = execution.getVariable("mso-request-id") - execution.setVariable('requestId', requestId) - execution.setVariable('msoRequestId', requestId) - - def requestorId = reqMap.requestDetails?.requestInfo?.requestorId ?: null - execution.setVariable('requestorId', requestorId) - - execution.setVariable('sdncVersion', '1702') - - execution.setVariable("UpdateVnfInfraSuccessIndicator", false) - - execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) - - def source = reqMap.requestDetails?.requestInfo?.source - execution.setVariable("source", source) - - //For Completion Handler & Fallout Handler - String requestInfo = - """ - ${requestId} - UPDATE - ${source} - """ - - execution.setVariable("requestInfo", requestInfo) - - logDebug('RequestInfo: ' + execution.getVariable("requestInfo"), isDebugLogEnabled) - - logDebug('Exited ' + method, isDebugLogEnabled) - - } - catch(groovy.json.JsonException je) { - utils.log("DEBUG", " Request is not in JSON format.", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") - - } - catch(Exception e) { - String restFaultMessage = e.getMessage() - utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) - } - } - - /** - * Prepare and send the sychronous response for this flow. - * - * @param execution The flow's execution instance. - */ - public void sendSynchResponse(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sendSynchResponse(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - - try { - def requestInfo = execution.getVariable('requestInfo') - def requestId = execution.getVariable('requestId') - def source = execution.getVariable('source') - def progress = getNodeTextForce(requestInfo, 'progress') - if (progress.isEmpty()) { - progress = '0' - } - def startTime = getNodeTextForce(requestInfo, 'start-time') - if (startTime.isEmpty()) { - startTime = System.currentTimeMillis() - } - - // RESTResponse (for API Handler (APIH) Reply Task) - def vnfId = execution.getVariable("vnfId") - String synchResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() - - sendWorkflowResponse(execution, 200, synchResponse) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) - } - } - - - /** - * Check if this VNF is already in maintenance in A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void checkIfVnfInMaintInAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - execution.setVariable("workStep", "checkIfVnfInMaintInAAI") - execution.setVariable("failedActivity", "AAI") - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - AAIRestClientImpl client = new AAIRestClientImpl() - AAIValidatorImpl aaiValidator = new AAIValidatorImpl() - aaiValidator.setClient(client) - def vnfId = execution.getVariable("vnfId") - boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid) - logDebug("isInMaint result: " + isInMaint, isDebugLogEnabled) - execution.setVariable('isVnfInMaintenance', isInMaint) - - if (isInMaint) { - execution.setVariable("errorCode", "1003") - execution.setVariable("errorText", "VNF is in maintenance in A&AI") - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) - } - } - - - /** - * Check if this VNF's pservers are locked in A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void checkIfPserversInMaintInAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("workStep", "checkIfPserversInMaintInAAI") - execution.setVariable("failedActivity", "AAI") - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - AAIRestClientImpl client = new AAIRestClientImpl() - AAIValidatorImpl aaiValidator = new AAIValidatorImpl() - aaiValidator.setClient(client) - def vnfId = execution.getVariable("vnfId") - boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid) - logDebug("areLocked result: " + areLocked, isDebugLogEnabled) - execution.setVariable('arePserversLocked', areLocked) - - if (areLocked) { - execution.setVariable("errorCode", "1003") - execution.setVariable("errorText", "pServers are locked in A&AI") - } - - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) - } - } - - /** - * Set inMaint flag for this VNF to the specified value in A&AI. - * - * - * @param execution The flow's execution instance. - * @param inMaint The boolean value of the flag to set - */ - public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) { - def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - if (inMaint) { - execution.setVariable("workStep", "setVnfInMaintFlagInAAI") - execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) - } - else { - execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI") - } - execution.setVariable("failedActivity", "AAI") - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - AAIRestClientImpl client = new AAIRestClientImpl() - AAIUpdatorImpl aaiUpdator = new AAIUpdatorImpl() - aaiUpdator.setClient(client) - def vnfId = execution.getVariable("vnfId") - if (inMaint) { - aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid) - execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) - } - else { - aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid) - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage()) - } - } - - /** - * Check if VF Closed Loop Disabled in A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void checkIfClosedLoopDisabledInAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.checkIfClosedLoopDisabledInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - execution.setVariable("workStep", "checkClosedLoopDisabledFlagInAAI") - execution.setVariable("failedActivity", "AAI") - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - def vnfId = execution.getVariable("vnfId") - logDebug("vnfId is: " + vnfId, isDebugLogEnabled) - AAIResourcesClient client = new AAIResourcesClient() - AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) - AAIResultWrapper aaiRW = client.get(genericVnfUri) - Map result = aaiRW.asMap() - boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false) - - logDebug("isClosedLoopDisabled result: " + isClosedLoopDisabled, isDebugLogEnabled) - execution.setVariable('isClosedLoopDisabled', isClosedLoopDisabled) - - if (isClosedLoopDisabled) { - execution.setVariable("errorCode", "1004") - execution.setVariable("errorText", "closedLoop is disabled in A&AI") - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) - } - } - - /** - * Set VF Closed Loop Disabled Flag in A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void setClosedLoopDisabledInAAI(DelegateExecution execution, boolean setDisabled) { - def method = getClass().getSimpleName() + '.setClosedLoopDisabledInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - if (setDisabled) { - execution.setVariable("workStep", "setClosedLoopDisabledFlagInAAI") - execution.setVariable("rollbackSetClosedLoopDisabledFlag", true) - } - else { - execution.setVariable("workStep", "unsetClosedLoopDisabledFlagInAAI") - } - - execution.setVariable("failedActivity", "AAI") - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - def vnfId = execution.getVariable("vnfId") - AAIResourcesClient client = new AAIResourcesClient() - AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) - - Map request = new HashMap<>() - request.put("is-closed-loop-disabled", setDisabled) - client.update(genericVnfUri, request) - logDebug("set isClosedLoop to: " + setDisabled, isDebugLogEnabled) - - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) - } - } - - - /** - * Handle Abort disposition from RainyDayHandler - * - * @param execution The flow's execution instance. - */ - public void abortProcessing(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.abortProcessing(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - def errorText = execution.getVariable("errorText") - def errorCode = execution.getVariable("errorCode") - - exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText) - } - - /** - * Increment Retry Count for Current Work Step - * - * @param execution The flow's execution instance. - */ - public void incrementRetryCount(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.incrementRetryCount(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String retryCountVariableName = execution.getVariable("workStep") + "RetryCount" - execution.setVariable("retryCountVariableName", retryCountVariableName) - - def retryCountVariable = execution.getVariable(retryCountVariableName) - int retryCount = 0 - - if (retryCountVariable != null) { - retryCount = (int) retryCountVariable - } - - retryCount += 1 - - execution.setVariable(retryCountVariableName, retryCount) - - logDebug("value of " + retryCountVariableName + " is " + retryCount, isDebugLogEnabled) - logDebug('Exited ' + method, isDebugLogEnabled) - - - } - - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy deleted file mode 100644 index 64894563bf..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy +++ /dev/null @@ -1,626 +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.bpmn.infrastructure.scripts - -import groovy.json.JsonOutput -import groovy.json.JsonSlurper -import groovy.util.Node -import groovy.util.XmlParser; -import groovy.xml.QName - -import java.io.Serializable; -import java.util.UUID; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.client.aai.* - -import org.openecomp.mso.client.appc.ApplicationControllerClient; -import org.openecomp.mso.client.appc.ApplicationControllerSupport; -import org.openecomp.mso.client.aai.AAIResourcesClient -import org.openecomp.mso.client.aai.entities.AAIResultWrapper -import org.openecomp.mso.client.aai.entities.uri.AAIUri -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory -import org.onap.appc.client.lcm.model.Action; -import org.onap.appc.client.lcm.model.ActionIdentifiers; -import org.onap.appc.client.lcm.model.LockInput -import org.onap.appc.client.lcm.model.UnlockInput -import org.onap.appc.client.lcm.model.HealthCheckInput -import org.onap.appc.client.lcm.model.StartInput -import org.onap.appc.client.lcm.model.StopInput -import org.onap.appc.client.lcm.model.Flags -import org.onap.appc.client.lcm.model.Status - - - -public class VnfInPlaceUpdate extends VnfCmBase { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtils = new JsonUtils() - def prefix = "VnfIPU_" - - /** - * Initialize the flow's variables. - * - * @param execution The flow's execution instance. - */ - public void initProcessVariables(DelegateExecution execution) { - execution.setVariable('prefix', 'VnfIPU_') - execution.setVariable('Request', null) - execution.setVariable('requestInfo', null) - execution.setVariable('source', null) - execution.setVariable('vnfInputs', null) - execution.setVariable('tenantId', null) - execution.setVariable('vnfParams', null) - execution.setVariable('controllerType', null) - execution.setVariable('UpdateVnfSuccessIndicator', false) - execution.setVariable('serviceType', null) - execution.setVariable('nfRole', null) - execution.setVariable('currentActivity', 'VnfIPU') - execution.setVariable('workStep', null) - execution.setVariable('failedActivity', null) - execution.setVariable('errorCode', "0") - execution.setVariable('errorText', null) - execution.setVariable('healthCheckIndex0', 0) - execution.setVariable('healthCheckIndex1', 1) - execution.setVariable('maxRetryCount', 3) - execution.setVariable("rollbackSetClosedLoopDisabledFlag", false) - execution.setVariable("rollbackVnfStop", false) - execution.setVariable("rollbackVnfLock", false) - execution.setVariable("rollbackQuiesceTraffic", false) - execution.setVariable("rollbackSetVnfInMaintenanceFlag", false) - } - - /** - * Check for missing elements in the received request. - * - * @param execution The flow's execution instance. - */ - public void preProcessRequest(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - initProcessVariables(execution) - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - initProcessVariables(execution) - - def incomingRequest = execution.getVariable('bpmnRequest') - - utils.log("DEBUG", "Incoming Infra Request: " + incomingRequest, isDebugLogEnabled) - try { - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - Map reqMap = jsonSlurper.parseText(incomingRequest) - utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled) - - def serviceInstanceId = execution.getVariable('serviceInstanceId') - def vnfId = execution.getVariable('vnfId') - - execution.setVariable('serviceInstanceId', serviceInstanceId) - execution.setVariable('vnfId', vnfId) - execution.setVariable("isVidRequest", "true") - execution.setVariable('serviceType', 'Mobility') - execution.setVariable('payload', "") - execution.setVariable('actionSnapshot', Action.Snapshot) - execution.setVariable('actionLock', Action.Lock) - execution.setVariable('actionUnlock', Action.Unlock) - execution.setVariable('actionUpgradePreCheck', Action.UpgradePreCheck) - execution.setVariable('actionUpgradePostCheck', Action.UpgradePostCheck) - execution.setVariable('actionQuiesceTraffic', Action.QuiesceTraffic) - execution.setVariable('actionUpgradeBackup', Action.UpgradeBackup) - execution.setVariable('actionUpgradeSoftware', Action.UpgradeSoftware) - execution.setVariable('actionResumeTraffic', Action.ResumeTraffic) - - def controllerType = reqMap.requestDetails?.requestParameters?.controllerType - execution.setVariable('controllerType', controllerType) - - utils.log("DEBUG", 'Controller Type: ' + controllerType, isDebugLogEnabled) - - def payload = reqMap.requestDetails?.requestParameters?.payload - execution.setVariable('payload', payload) - - utils.log("DEBUG", 'Processed payload: ' + payload, isDebugLogEnabled) - - - def requestId = execution.getVariable("mso-request-id") - execution.setVariable('requestId', requestId) - execution.setVariable('msoRequestId', requestId) - - def requestorId = reqMap.requestDetails?.requestInfo?.requestorId ?: null - execution.setVariable('requestorId', requestorId) - - def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration - def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId - execution.setVariable('lcpCloudRegionId', lcpCloudRegionId) - def tenantId = cloudConfiguration.tenantId - execution.setVariable('tenantId', tenantId) - - execution.setVariable("UpdateVnfInfraSuccessIndicator", false) - - execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) - - def source = reqMap.requestDetails?.requestInfo?.source - execution.setVariable("source", source) - - //For Completion Handler & Fallout Handler - String requestInfo = - """ - ${requestId} - UPDATE - ${source} - """ - - execution.setVariable("requestInfo", requestInfo) - - logDebug('RequestInfo: ' + execution.getVariable("requestInfo"), isDebugLogEnabled) - - logDebug('Exited ' + method, isDebugLogEnabled) - - } - catch(groovy.json.JsonException je) { - utils.log("DEBUG", " Request is not in JSON format.", isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") - - } - catch(Exception e) { - String restFaultMessage = e.getMessage() - utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) - } - } - - /** - * Prepare and send the sychronous response for this flow. - * - * @param execution The flow's execution instance. - */ - public void sendSynchResponse(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sendSynchResponse(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - - try { - def requestInfo = execution.getVariable('requestInfo') - def requestId = execution.getVariable('requestId') - def source = execution.getVariable('source') - def progress = getNodeTextForce(requestInfo, 'progress') - if (progress.isEmpty()) { - progress = '0' - } - def startTime = getNodeTextForce(requestInfo, 'start-time') - if (startTime.isEmpty()) { - startTime = System.currentTimeMillis() - } - - // RESTResponse (for API Handler (APIH) Reply Task) - def vnfId = execution.getVariable("vnfId") - String synchResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() - - sendWorkflowResponse(execution, 200, synchResponse) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) - } - } - - - /** - * Check if this VNF is already in maintenance in A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void checkIfVnfInMaintInAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - execution.setVariable("workStep", "checkIfVnfInMaintInAAI") - execution.setVariable("failedActivity", "AAI") - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - AAIRestClientImpl client = new AAIRestClientImpl() - AAIValidatorImpl aaiValidator = new AAIValidatorImpl() - aaiValidator.setClient(client) - def vnfId = execution.getVariable("vnfId") - boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid) - logDebug("isInMaint result: " + isInMaint, isDebugLogEnabled) - execution.setVariable('isVnfInMaintenance', isInMaint) - - if (isInMaint) { - execution.setVariable("errorCode", "1003") - execution.setVariable("errorText", "VNF is in maintenance in A&AI") - } - - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) - } - } - - - /** - * Check if this VNF's pservers are locked in A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void checkIfPserversInMaintInAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("workStep", "checkIfPserversInMaintInAAI") - execution.setVariable("failedActivity", "AAI") - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - AAIRestClientImpl client = new AAIRestClientImpl() - AAIValidatorImpl aaiValidator = new AAIValidatorImpl() - aaiValidator.setClient(client) - def vnfId = execution.getVariable("vnfId") - boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid) - logDebug("areLocked result: " + areLocked, isDebugLogEnabled) - execution.setVariable('arePserversLocked', areLocked) - - if (areLocked) { - execution.setVariable("errorCode", "1003") - execution.setVariable("errorText", "pServers are locked in A&AI") - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) - } - } - - /** - * Set inMaint flag for this VNF to the specified value in A&AI. - * - * - * @param execution The flow's execution instance. - * @param inMaint The boolean value of the flag to set - */ - public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) { - def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - if (inMaint) { - execution.setVariable("workStep", "setVnfInMaintFlagInAAI") - } - else { - execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI") - } - execution.setVariable("failedActivity", "AAI") - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - AAIRestClientImpl client = new AAIRestClientImpl() - AAIUpdatorImpl aaiUpdator = new AAIUpdatorImpl() - aaiUpdator.setClient(client) - def vnfId = execution.getVariable("vnfId") - if (inMaint) { - aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid) - execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) - } - else { - aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid) - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage()) - } - } - - /** - * Check if VF Closed Loop Disabled in A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void checkIfClosedLoopDisabledInAAI(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.checkIfClosedLoopDisabledInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - execution.setVariable("workStep", "checkClosedLoopDisabledFlagInAAI") - execution.setVariable("failedActivity", "AAI") - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - def vnfId = execution.getVariable("vnfId") - logDebug("vnfId is: " + vnfId, isDebugLogEnabled) - AAIResourcesClient client = new AAIResourcesClient() - AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) - AAIResultWrapper aaiRW = client.get(genericVnfUri) - Map result = aaiRW.asMap() - boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false) - - logDebug("isClosedLoopDisabled result: " + isClosedLoopDisabled, isDebugLogEnabled) - execution.setVariable('isClosedLoopDisabled', isClosedLoopDisabled) - - if (isClosedLoopDisabled) { - execution.setVariable("errorCode", "1004") - execution.setVariable("errorText", "closedLoop is disabled in A&AI") - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - } - } - - /** - * Set VF Closed Loop Disabled Flag in A&AI. - * - * - * @param execution The flow's execution instance. - */ - public void setClosedLoopDisabledInAAI(DelegateExecution execution, boolean setDisabled) { - def method = getClass().getSimpleName() + '.setClosedLoopDisabledInAAI(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - if (setDisabled) { - execution.setVariable("workStep", "setClosedLoopDisabledFlagInAAI") - execution.setVariable("rollbackSetClosedLoopDisabledFlag", true) - } - else { - execution.setVariable("workStep", "unsetClosedLoopDisabledFlagInAAI") - } - - execution.setVariable("failedActivity", "AAI") - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def transactionLoggingUuid = UUID.randomUUID().toString() - def vnfId = execution.getVariable("vnfId") - AAIResourcesClient client = new AAIResourcesClient() - AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) - - Map request = new HashMap<>() - request.put("is-closed-loop-disabled", setDisabled) - client.update(genericVnfUri, request) - logDebug("set isClosedLoop to: " + setDisabled, isDebugLogEnabled) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - } - } - - - - - /** - * Call APP-C client to execute specified APP-C command for this VNF. - * - * - * @param execution The flow's execution instance. - * @param action The action to take in APP-C. - */ - public void runAppcCommand(DelegateExecution execution, Action action) { - def method = getClass().getSimpleName() + '.runAppcCommand(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - - ApplicationControllerClient appcClient = null - - try { - logDebug("Running APP-C action: " + action.toString(), isDebugLogEnabled) - String vnfId = execution.getVariable('vnfId') - String msoRequestId = execution.getVariable('requestId') - execution.setVariable('msoRequestId', msoRequestId) - execution.setVariable("failedActivity", "APP-C") - - appcClient = new ApplicationControllerClient() - ApplicationControllerSupport support = new ApplicationControllerSupport() - appcClient.appCSupport=support - org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage", "org.onap.appc.client.lcm.model"); - Flags flags = new Flags(); - ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); - actionIdentifiers.setVnfId(vnfId); - Status appcStatus - switch(action) { - case Action.Lock: - execution.setVariable('workStep', "LockVNF") - appcStatus = appcClient.runCommand(Action.Lock,actionIdentifiers,null,msoRequestId) - break - case Action.Unlock: - execution.setVariable('workStep', "UnlockVNF") - appcStatus = appcClient.runCommand(Action.Unlock,actionIdentifiers,null,msoRequestId) - break - case Action.HealthCheck: - def healthCheckIndex = execution.getVariable('healthCheckIndex') - execution.setVariable('workStep', "HealthCheckVNF" + healthCheckIndex) - execution.setVariable('healthCheckIndex', healthCheckIndex + 1) - appcStatus = appcClient.runCommand(Action.HealthCheck,actionIdentifiers,null,msoRequestId) - break - case Action.Start: - execution.setVariable('workStep', "StartVNF") - appcStatus = appcClient.runCommand(Action.Start,actionIdentifiers,null,msoRequestId) - break - case Action.Stop: - execution.setVariable('workStep', "StopVNF") - appcStatus = appcClient.runCommand(Action.Stop,actionIdentifiers,null,msoRequestId) - break - default: - break - } - logDebug("Completed AppC request", isDebugLogEnabled) - int appcCode = appcStatus.getCode() - logDebug("AppC status code is: " + appcCode, isDebugLogEnabled) - logDebug("AppC status message is: " + appcStatus.getMessage(), isDebugLogEnabled) - if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) { - execution.setVariable("errorCode", Integer.toString(appcCode)) - execution.setVariable("errorText", appcStatus.getMessage()) - } - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - - } catch (java.lang.NoSuchMethodError e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) - - } - } - - /** - * Placeholder for a call to APP-C client to execute specified APP-C command for this VNF. - * - * - * @param execution The flow's execution instance. - * @param action The action to take in APP-C. - */ - public void runAppcCommandPlaceholder(DelegateExecution execution, String action) { - def method = getClass().getSimpleName() + '.runAppcCommandPlaceholder(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable('errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable("failedActivity", "APP-C") - execution.setVariable("workStep", action) - } - - - - /** - * Handle Abort disposition from RainyDayHandler - * - * @param execution The flow's execution instance. - */ - public void abortProcessing(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.abortProcessing(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - def errorText = execution.getVariable("errorText") - def errorCode = execution.getVariable("errorCode") - - exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText) - } - - /** - * Increment Retry Count for Current Work Step - * - * @param execution The flow's execution instance. - */ - public void incrementRetryCount(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.incrementRetryCount(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - String retryCountVariableName = execution.getVariable("workStep") + "RetryCount" - execution.setVariable("retryCountVariableName", retryCountVariableName) - - def retryCountVariable = execution.getVariable(retryCountVariableName) - int retryCount = 0 - - if (retryCountVariable != null) { - retryCount = (int) retryCountVariable - } - - retryCount += 1 - - execution.setVariable(retryCountVariableName, retryCount) - - logDebug("value of " + retryCountVariableName + " is " + retryCount, isDebugLogEnabled) - logDebug('Exited ' + method, isDebugLogEnabled) - - - } - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy deleted file mode 100644 index 68f50e033c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ /dev/null @@ -1,815 +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.bpmn.vcpe.scripts; - -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.VidUtils -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.domain.* - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.json.JSONArray; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; -import static org.apache.commons.lang3.StringUtils.* - -/** - * This groovy class supports the CreateVcpeResCustService.bpmn process. - * - * @author ek1439 - * - */ -public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { - - private static final String DebugFlag = "isDebugLogEnabled" - - String Prefix = "CVRCS_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils() - CatalogDbUtils catalogDbUtils = new CatalogDbUtils() - - /** - * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. - * @param execution - */ - public InitializeProcessVariables(DelegateExecution execution) { - /* Initialize all the process variables in this block */ - - execution.setVariable("createVcpeServiceRequest", "") - execution.setVariable("globalSubscriberId", "") - execution.setVariable("serviceInstanceName", "") - execution.setVariable("msoRequestId", "") - execution.setVariable(Prefix + "VnfsCreatedCount", 0) - execution.setVariable("productFamilyId", "") - execution.setVariable("brgWanMacAddress", "") - execution.setVariable("customerLocation", "") - execution.setVariable("homingService", "") - execution.setVariable("cloudOwner", "") - execution.setVariable("cloudRegionId", "") - execution.setVariable("homingModelIds", "") - - //TODO - execution.setVariable("sdncVersion", "1707") - } - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - /** - * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. - * @param execution - */ - public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable(DebugFlag) - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled) - - try { - // initialize flow variables - InitializeProcessVariables(execution) - - //Config Inputs - String aaiDistDelay = execution.getVariable('URN_mso_workflow_aai_distribution_delay') - if (isBlank(aaiDistDelay)) { - msg = "URN_mso_workflow_aai_distribution_delay is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - execution.setVariable("aaiDistDelay", aaiDistDelay) - utils.log("DEBUG", "AAI distribution delay: " + aaiDistDelay, isDebugEnabled) - - // check for incoming json message/input - String createVcpeServiceRequest = execution.getVariable("bpmnRequest") - utils.logAudit(createVcpeServiceRequest) - execution.setVariable("createVcpeServiceRequest", createVcpeServiceRequest); - println 'createVcpeServiceRequest - ' + createVcpeServiceRequest - - // extract requestId - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("msoRequestId", requestId) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) { - serviceInstanceId = UUID.randomUUID().toString() - utils.log("DEBUG", " Generated new Service Instance: " + serviceInstanceId, isDebugEnabled) - } else { - utils.log("DEBUG", "Using provided Service Instance ID: " + serviceInstanceId, isDebugEnabled) - } - - serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8") - execution.setVariable("serviceInstanceId", serviceInstanceId) - utils.log("DEBUG", "Incoming serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) - - String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.instanceName") - execution.setVariable("serviceInstanceName", serviceInstanceName) - utils.log("DEBUG", "Incoming serviceInstanceName is: " + serviceInstanceName, isDebugEnabled) - - String requestAction = execution.getVariable("requestAction") - execution.setVariable("requestAction", requestAction) - - setBasicDBAuthHeader(execution, isDebugEnabled) - - String source = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.source") - if ((source == null) || (source.isEmpty())) { - source = "VID" - } - execution.setVariable("source", source) - - // extract globalSubscriberId - String globalSubscriberId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId") - - // verify element global-customer-id is sent from JSON input, throw exception if missing - if ((globalSubscriberId == null) || (globalSubscriberId.isEmpty())) { - String dataErrorMessage = " Element 'globalSubscriberId' is missing. " - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - execution.setVariable("globalSubscriberId", globalSubscriberId) - execution.setVariable("globalCustomerId", globalSubscriberId) - } - - // extract subscriptionServiceType - String subscriptionServiceType = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters.subscriptionServiceType") - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled) - - String suppressRollback = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.suppressRollback") - execution.setVariable("disableRollback", suppressRollback) - utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled) - - String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId") - execution.setVariable("productFamilyId", productFamilyId) - utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled) - - String subscriberInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo") - execution.setVariable("subscriberInfo", subscriberInfo) - utils.log("DEBUG", "Incoming subscriberInfo is: " + subscriberInfo, isDebugEnabled) - - // extract cloud configuration, split vid_ID into cloudOwner and cloudRegionId - String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest, - "requestDetails.cloudConfiguration.lcpCloudRegionId") - def cloudRegion = vimId.split("_") - def cloudOwner = cloudRegion[0].toString() - def cloudRegionId = cloudRegion[1].toString() - execution.setVariable("cloudOwner", cloudOwner) - utils.log("DEBUG","cloudOwner: " + cloudOwner, isDebugEnabled) - execution.setVariable("cloudRegionId", cloudRegionId) - utils.log("DEBUG","cloudRegionId: " + cloudRegionId, isDebugEnabled) - - /* - * Extracting User Parameters from incoming Request and converting into a Map - */ - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - - Map reqMap = jsonSlurper.parseText(createVcpeServiceRequest) - - //InputParams - def userParams = reqMap.requestDetails?.requestParameters?.userParams - - Map inputMap = [:] - if (userParams) { - userParams.each { - userParam -> - if ("Customer_Location".equals(userParam?.name)) { - execution.setVariable("customerLocation", userParam.value) - userParam.value.each { - param -> - inputMap.put(param.key, param.value) - } - } - if ("Homing_Model_Ids".equals(userParam?.name)) { - utils.log("DEBUG", "Homing_Model_Ids: " + userParam.value.toString() + " ---- Type is:" + - userParam.value.getClass() , isDebugEnabled) - def modelIdLst = [] - userParam.value.each { - param -> - def valueMap = [:] - param.each { - entry -> - valueMap.put(entry.key, entry.value) - } - modelIdLst.add(valueMap) - utils.log("DEBUG", "Param: " + param.toString() + " ---- Type is:" + - param.getClass() , isDebugEnabled) - } - execution.setVariable("homingModelIds", modelIdLst) - } - if ("BRG_WAN_MAC_Address".equals(userParam?.name)) { - execution.setVariable("brgWanMacAddress", userParam.value) - inputMap.put("BRG_WAN_MAC_Address", userParam.value) - } - if ("Homing_Solution".equals(userParam?.name)) { - execution.setVariable("homingService", userParam.value) - inputMap.put("Homing_Solution", userParam.value) - } - } - } - - if (execution.getVariable("homingService") == "") { - // Set Default Homing to OOF if not set - execution.setVariable("homingService", "oof") - } - - utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) - execution.setVariable("serviceInputParams", inputMap) - - utils.log("DEBUG", "Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress'), isDebugEnabled) - - //For Completion Handler & Fallout Handler - String requestInfo = - """ - ${requestId} - CREATE - ${source} - """ - - execution.setVariable(Prefix + "requestInfo", requestInfo) - - utils.log("DEBUG", " ***** Completed preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled) - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void sendSyncResponse(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable(DebugFlag) - - utils.log("DEBUG", " ***** Inside sendSyncResponse of CreateVcpeResCustService ***** ", isDebugEnabled) - - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String requestId = execution.getVariable("mso-request-id") - - // RESTResponse (for API Handler (APIH) Reply Task) - String syncResponse = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${ - requestId - }"}}""".trim() - - utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) - sendWorkflowResponse(execution, 202, syncResponse) - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method sendSyncResponse() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - // ******************************* - // - // ******************************* - public void prepareDecomposeService(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", " ***** Inside prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled) - - String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") - - //serviceModelInfo JSON string will be used as-is for DoCreateServiceInstance BB - String serviceModelInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.modelInfo") - execution.setVariable("serviceModelInfo", serviceModelInfo) - - utils.log("DEBUG", " ***** Completed prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - // ******************************* - // - // ******************************* - public void prepareCreateServiceInstance(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", " ***** Inside prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled) - - /* - * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject - * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - * ModelInfo modelInfo = serviceDecomposition.getModelInfo() - * - */ - String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") -// String serviceInputParams = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters") -// execution.setVariable("serviceInputParams", serviceInputParams) - - - String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.instanceName") - execution.setVariable("serviceInstanceName", serviceInstanceName) - - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonStringNoRootName()) - - utils.log("DEBUG", " ***** Completed prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void postProcessServiceInstanceCreate(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' + 'execution=' + execution.getId() + ')' - def isDebugLogEnabled = execution.getVariable(DebugFlag) - logDebug('Entered ' + method, isDebugLogEnabled) - - String requestId = execution.getVariable("mso-request-id") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceInstanceName = execution.getVariable("serviceInstanceName") - - try { - - String payload = """ - - - - - ${requestId} - BPEL - ${serviceInstanceId} - ${serviceInstanceName} - - - - """ - execution.setVariable(Prefix + "setUpdateDbInstancePayload", payload) - utils.logAudit(Prefix + "setUpdateDbInstancePayload: " + payload) - logDebug('Exited ' + method, isDebugLogEnabled) - - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) - } - } - - - public void processDecomposition(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable(DebugFlag) - - utils.log("DEBUG", " ***** Inside processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled) - - try { - - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - // VNFs - List vnfList = serviceDecomposition.getServiceVnfs() - filterVnfs(vnfList) - serviceDecomposition.setServiceVnfs(vnfList) - - execution.setVariable("vnfList", vnfList) - execution.setVariable("vnfListString", vnfList.toString()) - - String vnfModelInfoString = "" - if (vnfList != null && vnfList.size() > 0) { - execution.setVariable(Prefix + "VNFsCount", vnfList.size()) - utils.log("DEBUG", "vnfs to create: " + vnfList.size(), isDebugEnabled) - ModelInfo vnfModelInfo = vnfList[0].getModelInfo() - - vnfModelInfoString = vnfModelInfo.toString() - String vnfModelInfoWithRoot = vnfModelInfo.toString() - vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo") - } else { - execution.setVariable(Prefix + "VNFsCount", 0) - utils.log("DEBUG", "no vnfs to create based upon serviceDecomposition content", isDebugEnabled) - } - - execution.setVariable("vnfModelInfo", vnfModelInfoString) - execution.setVariable("vnfModelInfoString", vnfModelInfoString) - utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) - - utils.log("DEBUG", " ***** Completed processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - sendSyncError(execution) - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. processDecomposition() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - private void filterVnfs(List vnfList) { - if (vnfList == null) { - return - } - - // remove BRG & TXC from VNF list - - Iterator it = vnfList.iterator() - while (it.hasNext()) { - VnfResource vr = it.next() - - String role = vr.getNfRole() - if (role == "BRG" || role == "TunnelXConn" || role == "Tunnel XConn") { - it.remove() - } - } - } - - - public void prepareCreateAllottedResourceTXC(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled) - - /* - * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject - * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - * ModelInfo modelInfo = serviceDecomposition.getModelInfo() - * - */ - String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - //allottedResourceModelInfo - //allottedResourceRole - //The model Info parameters are a JSON structure as defined in the Service Instantiation API. - //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB. - List allottedResources = serviceDecomposition.getServiceAllottedResources() - if (allottedResources != null) { - Iterator iter = allottedResources.iterator(); - while (iter.hasNext()) { - AllottedResource allottedResource = (AllottedResource) iter.next(); - - utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled) - utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled) - if ("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType()) || "Tunnel XConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())) { - //set create flag to true - execution.setVariable("createTXCAR", true) - ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() - execution.setVariable("allottedResourceModelInfoTXC", allottedResourceModelInfo.toJsonStringNoRootName()) - execution.setVariable("allottedResourceRoleTXC", allottedResource.getAllottedResourceRole()) - execution.setVariable("allottedResourceTypeTXC", allottedResource.getAllottedResourceType()) - //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the TXC, - //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in TXC Allotted Resource structure) (which the Homing BB would have populated). - execution.setVariable("parentServiceInstanceIdTXC", allottedResource.getHomingSolution().getServiceInstanceId()) - } - } - } - - //unit test only - String allottedResourceId = execution.getVariable("allottedResourceId") - execution.setVariable("allottedResourceIdTXC", allottedResourceId) - utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService " + allottedResourceId, isDebugEnabled) - - utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceTXC flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void prepareCreateAllottedResourceBRG(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled) - - /* - * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject - * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - * ModelInfo modelInfo = serviceDecomposition.getModelInfo() - * - */ - String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - //allottedResourceModelInfo - //allottedResourceRole - //The model Info parameters are a JSON structure as defined in the Service Instantiation API. - //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB. - List allottedResources = serviceDecomposition.getServiceAllottedResources() - if (allottedResources != null) { - Iterator iter = allottedResources.iterator(); - while (iter.hasNext()) { - AllottedResource allottedResource = (AllottedResource) iter.next(); - - utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled) - utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled) - if ("BRG".equalsIgnoreCase(allottedResource.getAllottedResourceType())) { - //set create flag to true - execution.setVariable("createBRGAR", true) - ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() - execution.setVariable("allottedResourceModelInfoBRG", allottedResourceModelInfo.toJsonStringNoRootName()) - execution.setVariable("allottedResourceRoleBRG", allottedResource.getAllottedResourceRole()) - execution.setVariable("allottedResourceTypeBRG", allottedResource.getAllottedResourceType()) - //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the BRG, - //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in BRG Allotted Resource structure) (which the Homing BB would have populated). - execution.setVariable("parentServiceInstanceIdBRG", allottedResource.getHomingSolution().getServiceInstanceId()) - } - } - } - - //unit test only - String allottedResourceId = execution.getVariable("allottedResourceId") - execution.setVariable("allottedResourceIdBRG", allottedResourceId) - utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService " + allottedResourceId, isDebugEnabled) - - utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceBRG flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - // ******************************* - // Generate Network request Section - // ******************************* - public void prepareVnfAndModulesCreate(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", " ***** Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled) - - // String disableRollback = execution.getVariable("disableRollback") - // def backoutOnFailure = "" - // if(disableRollback != null){ - // if ( disableRollback == true) { - // backoutOnFailure = "false" - // } else if ( disableRollback == false) { - // backoutOnFailure = "true" - // } - // } - //failIfExists - optional - - String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") - String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId") - execution.setVariable("productFamilyId", productFamilyId) - utils.log("DEBUG", "productFamilyId: " + productFamilyId, isDebugEnabled) - - List vnfList = execution.getVariable("vnfList") - - Integer vnfsCreatedCount = execution.getVariable(Prefix + "VnfsCreatedCount") - String vnfModelInfoString = null; - - if (vnfList != null && vnfList.size() > 0) { - utils.log("DEBUG", "getting model info for vnf # " + vnfsCreatedCount, isDebugEnabled) - ModelInfo vnfModelInfo1 = vnfList[0].getModelInfo() - utils.log("DEBUG", "got 0 ", isDebugEnabled) - ModelInfo vnfModelInfo = vnfList[vnfsCreatedCount.intValue()].getModelInfo() - vnfModelInfoString = vnfModelInfo.toString() - } else { - //TODO: vnfList does not contain data. Need to investigate why ... . Fro VCPE use model stored - vnfModelInfoString = execution.getVariable("vnfModelInfo") - } - - utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) - - // extract cloud configuration - String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest, - "requestDetails.cloudConfiguration.lcpCloudRegionId") - def cloudRegion = vimId.split("_") - execution.setVariable("cloudOwner", cloudRegion[0]) - utils.log("DEBUG","cloudOwner: "+ cloudRegion[0], isDebugEnabled) - execution.setVariable("cloudRegionId", cloudRegion[1]) - utils.log("DEBUG","cloudRegionId: "+ cloudRegion[1], isDebugEnabled) - execution.setVariable("lcpCloudRegionId", cloudRegion[1]) - utils.log("DEBUG","lcpCloudRegionId: "+ cloudRegion[1], isDebugEnabled) - String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, - "requestDetails.cloudConfiguration.tenantId") - execution.setVariable("tenantId", tenantId) - utils.log("DEBUG", "tenantId: " + tenantId, isDebugEnabled) - - String sdncVersion = execution.getVariable("sdncVersion") - utils.log("DEBUG", "sdncVersion: " + sdncVersion, isDebugEnabled) - - utils.log("DEBUG", " ***** Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - // ******************************* - // Validate Vnf request Section -> increment count - // ******************************* - public void validateVnfCreate(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", " ***** Inside validateVnfCreate of CreateVcpeResCustService ***** ", isDebugEnabled) - - Integer vnfsCreatedCount = execution.getVariable(Prefix + "VnfsCreatedCount") - vnfsCreatedCount++ - - execution.setVariable(Prefix + "VnfsCreatedCount", vnfsCreatedCount) - - utils.log("DEBUG", " ***** Completed validateVnfCreate of CreateVcpeResCustService ***** " + " vnf # " + vnfsCreatedCount, isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - // ***************************************** - // Prepare Completion request Section - // ***************************************** - public void postProcessResponse(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable(DebugFlag) - - utils.log("DEBUG", " ***** Inside postProcessResponse of CreateVcpeResCustService ***** ", isDebugEnabled) - - try { - String source = execution.getVariable("source") - String requestId = execution.getVariable("mso-request-id") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - String msoCompletionRequest = - """ - - ${requestId} - CREATE - ${source} - - Service Instance has been created successfully via macro orchestration - ${serviceInstanceId} - BPMN macro create - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - utils.logAudit(xmlMsoCompletionRequest) - execution.setVariable(Prefix + "Success", true) - execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) - utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void preProcessRollback(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable(DebugFlag) - utils.log("DEBUG", " ***** preProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled) - try { - - Object workflowException = execution.getVariable("WorkflowException"); - - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) - execution.setVariable("prevWorkflowException", workflowException); - //execution.setVariable("WorkflowException", null); - } - } catch (BpmnError e) { - utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) - } catch (Exception ex) { - String msg = "Exception in preProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG", " *** Exit preProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled) - } - - public void postProcessRollback(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable(DebugFlag) - utils.log("DEBUG", " ***** postProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled) - String msg = "" - try { - Object workflowException = execution.getVariable("prevWorkflowException"); - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) - execution.setVariable("WorkflowException", workflowException); - } - } catch (BpmnError b) { - utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) - throw b; - } catch (Exception ex) { - msg = "Exception in postProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG", " *** Exit postProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled) - } - - public void prepareFalloutRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable(DebugFlag) - - utils.log("DEBUG", " *** STARTED CreateVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled) - - try { - WorkflowException wfex = execution.getVariable("WorkflowException") - utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled) - String requestInfo = execution.getVariable(Prefix + "requestInfo") - utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled) - - //TODO. hmmm. there is no way to UPDATE error message. -// String errorMessage = wfex.getErrorMessage() -// boolean successIndicator = execution.getVariable("DCRESI_rolledBack") -// if (successIndicator){ -// errorMessage = errorMessage + ". Rollback successful." -// } else { -// errorMessage = errorMessage + ". Rollback not completed." -// } - - String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) - - execution.setVariable(Prefix + "falloutRequest", falloutRequest) - - } catch (Exception ex) { - utils.log("DEBUG", "Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVcpeResCustService prepareFalloutRequest Process") - } - utils.log("DEBUG", "*** COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ***", isDebugEnabled) - } - - - public void sendSyncError(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable(DebugFlag) - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside sendSyncError() of CreateVcpeResCustService ***** ", isDebugEnabled) - - try { - String errorMessage = "" - def wfe = execution.getVariable("WorkflowException") - if (wfe instanceof WorkflowException) { - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """ - ${errorMessage} - 7000 - """ - - utils.logAudit(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - } catch (Exception ex) { - utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) - } - } - - public void processJavaException(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable(DebugFlag) - execution.setVariable("prefix", Prefix) - try { - utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable(Prefix + "unexpectedError", "Caught a Java Lang Exception") - // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") - } catch (BpmnError b) { - utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - } catch (Exception e) { - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable(Prefix + "unexpectedError", "Exception in processJavaException method") - // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") - } - utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy deleted file mode 100644 index 08edb88c61..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy +++ /dev/null @@ -1,466 +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.bpmn.vcpe.scripts - -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.NetworkUtils; -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.AaiUtil - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.json.JSONArray; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; -import static org.apache.commons.lang3.StringUtils.* - -/** - * This groovy class supports the DeleteVcpeResCustService.bpmn process. - * - * @author dm4252 - * - */ -public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { - - private static final String DebugFlag = "isDebugLogEnabled" - - String Prefix = "DVRCS_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils() - CatalogDbUtils catalogDbUtils = new CatalogDbUtils() - NetworkUtils networkUtils = new NetworkUtils() - - /** - * This method is executed during the preProcessRequest task of the DeleteVcpeResCustService.bpmn process. - * @param execution - */ - public InitializeProcessVariables(DelegateExecution execution){ - /* Initialize all the process variables in this block */ - - execution.setVariable("DeleteVcpeResCustServiceRequest", "") - execution.setVariable("msoRequestId", "") - execution.setVariable(Prefix+"vnfsDeletedCount", 0) - execution.setVariable(Prefix+"vnfsCount", 0) - } - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - /** - * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. - * @param execution - */ - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest DeleteVcpeResCustService Request ***** ", isDebugEnabled) - - try { - // initialize flow variables - InitializeProcessVariables(execution) - - // check for incoming json message/input - String DeleteVcpeResCustServiceRequest = execution.getVariable("bpmnRequest") - utils.logAudit(DeleteVcpeResCustServiceRequest) - execution.setVariable("DeleteVcpeResCustServiceRequest", DeleteVcpeResCustServiceRequest); - println 'DeleteVcpeResCustServiceRequest - ' + DeleteVcpeResCustServiceRequest - - // extract requestId - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("msoRequestId", requestId) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) { - String dataErrorMessage = " Element 'serviceInstanceId' is missing. " - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - String requestAction = execution.getVariable("requestAction") - execution.setVariable("requestAction", requestAction) - - String source = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.source") - if ((source == null) || (source.isEmpty())) { - source = "VID" - } - execution.setVariable("source", source) - - // extract globalSubscriberId - String globalSubscriberId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId") - - // global-customer-id is optional on Delete - - execution.setVariable("globalSubscriberId", globalSubscriberId) - execution.setVariable("globalCustomerId", globalSubscriberId) - - String suppressRollback = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.suppressRollback") - execution.setVariable("disableRollback", suppressRollback) - utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled) - - String productFamilyId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.productFamilyId") - execution.setVariable("productFamilyId", productFamilyId) - utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled) - - // extract subscriptionServiceType - String subscriptionServiceType = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestParameters.subscriptionServiceType") - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled) - - // extract cloud configuration - String cloudConfiguration = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.cloudConfiguration") - execution.setVariable("cloudConfiguration", cloudConfiguration) - utils.log("DEBUG","cloudConfiguration: "+ cloudConfiguration, isDebugEnabled) - String lcpCloudRegionId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId") - execution.setVariable("lcpCloudRegionId", lcpCloudRegionId) - utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled) - String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId") - execution.setVariable("tenantId", tenantId) - utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled) - - String sdncVersion = "1707" - execution.setVariable("sdncVersion", sdncVersion) - utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled) - - //For Completion Handler & Fallout Handler - String requestInfo = - """ - ${requestId} - DELETE - ${source} - """ - - execution.setVariable(Prefix+"requestInfo", requestInfo) - - //Setting for Generic Sub Flows - execution.setVariable("GENGS_type", "service-instance") - - utils.log("DEBUG", " ***** Completed preProcessRequest DeleteVcpeResCustServiceRequest Request ***** ", isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void sendSyncResponse(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - utils.log("DEBUG", " ***** Inside sendSyncResponse of DeleteVcpeResCustService ***** ", isDebugEnabled) - - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String requestId = execution.getVariable("mso-request-id") - - // RESTResponse (for API Handler (APIH) Reply Task) - String syncResponse ="""{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - - utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) - sendWorkflowResponse(execution, 202, syncResponse) - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void prepareServiceDelete(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG", " ***** Inside prepareServiceDelete() of DeleteVcpeResCustService ***** ", isDebugEnabled) - - try { - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - // confirm if ServiceInstance was found - if ( !execution.getVariable("GENGS_FoundIndicator") ) - { - String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Service Instance was not found in AAI by id: " + serviceInstanceId - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - // get variable within incoming json - String DeleteVcpeResCustServiceRequest = execution.getVariable("DeleteVcpeResCustServiceRequest"); - - // get SI extracted by GenericGetService - String serviceInstanceAaiRecord = execution.getVariable("GENGS_service"); - - utils.log("DEBUG", "serviceInstanceAaiRecord: "+serviceInstanceAaiRecord, isDebugEnabled) - serviceInstanceAaiRecord = utils.removeXmlNamespaces(serviceInstanceAaiRecord) - - def (TXC_found, TXC_id) = new Tuple(false, null) - def (BRG_found, BRG_id) = new Tuple(false, null) - List relatedVnfIdList = [] - - for(Node rel: utils.getMultNodeObjects(serviceInstanceAaiRecord, "relationship")) { - def relto = utils.getChildNodeText(rel, "related-to") - def relink = utils.getChildNodeText(rel, "related-link") - utils.log("DEBUG", "check: "+relto+" link: "+relink, isDebugEnabled) - - if(isBlank(relto) || isBlank(relink)) { - - } else if(relto == "generic-vnf") { - def id = relink.substring(relink.indexOf("/generic-vnf/")+13) - if(id.endsWith("/")) { - id = id.substring(0, id.length()-1) - } - - relatedVnfIdList.add(id) - - } else if(relto == "allotted-resource") { - def (type, id) = getAaiAr(execution, relink) - - if(isBlank(type) || isBlank(id)) { - - } else if(type == "TunnelXConn" || type == "Tunnel XConn") { - utils.log("DEBUG","Tunnel XConn AR found", isDebugEnabled) - TXC_found = true - TXC_id = id - - } else if(type == "BRG") { - utils.log("DEBUG","BRG AR found", isDebugEnabled) - BRG_found = true - BRG_id = id - } - } - } - - execution.setVariable(Prefix+"TunnelXConn", TXC_found) - execution.setVariable("TXC_allottedResourceId", TXC_id) - utils.log("DEBUG", "TXC_allottedResourceId: " + TXC_id, isDebugEnabled) - - execution.setVariable(Prefix+"BRG", BRG_found) - execution.setVariable("BRG_allottedResourceId", BRG_id) - utils.log("DEBUG", "BRG_allottedResourceId: " + BRG_id, isDebugEnabled) - - int vnfsCount = relatedVnfIdList.size() - execution.setVariable(Prefix+"vnfsCount", vnfsCount) - utils.log("DEBUG", " "+Prefix+"vnfsCount : " + vnfsCount, isDebugEnabled) - if(vnfsCount > 0) { - execution.setVariable(Prefix+"relatedVnfIdList", relatedVnfIdList) - } - - utils.log("DEBUG", " ***** Completed prepareServiceDelete() of DeleteVcpeResCustService ***** ", isDebugEnabled) - } catch (BpmnError e){ - throw e; - } catch (Exception ex) { - sendSyncError(execution) - String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. prepareServiceDelete() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - private getAaiAr(DelegateExecution execution, String relink) { - def isDebugEnabled = execution.getVariable(DebugFlag) - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = execution.getVariable("URN_aai_endpoint") + relink - - utils.log("DEBUG", "get AR info " + aaiEndpoint, isDebugEnabled) - APIResponse response = aaiUtil.executeAAIGetCall(execution, aaiEndpoint) - - int responseCode = response.getStatusCode() - utils.log("DEBUG", "get AR info responseCode:" + responseCode, isDebugEnabled) - - String aaiResponse = response.getResponseBodyAsString() - utils.log("DEBUG", "get AR info " + aaiResponse, isDebugEnabled) - - if(responseCode < 200 || responseCode >= 300 || isBlank(aaiResponse)) { - return new Tuple2(null, null) - } - - def type = utils.getNodeText1(aaiResponse, "type") - def id = utils.getNodeText1(aaiResponse, "id") - - return new Tuple2(type, id) - } - - - // ******************************* - // - // ******************************* - public void prepareVnfAndModulesDelete (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG", " ***** Inside prepareVnfAndModulesDelete of DeleteVcpeResCustService ***** ", isDebugEnabled) - - try { - List vnfList = execution.getVariable(Prefix+"relatedVnfIdList") - int vnfsDeletedCount = execution.getVariable(Prefix+"vnfsDeletedCount") - String vnfModelInfoString = "" - String vnfId = "" - if (vnfList.size() > 0 ) { - vnfId = vnfList.get(vnfsDeletedCount.intValue()) - } - - execution.setVariable("vnfId", vnfId) - utils.log("DEBUG", "need to delete vnfId:" + vnfId, isDebugEnabled) - - utils.log("DEBUG", " ***** Completed prepareVnfAndModulesDelete of DeleteVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesDelete() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - // ******************************* - // Validate Vnf request Section -> increment count - // ******************************* - public void validateVnfDelete (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG", " ***** Inside validateVnfDelete of DeleteVcpeResCustService ***** ", isDebugEnabled) - - try { - int vnfsDeletedCount = execution.getVariable(Prefix+"vnfsDeletedCount") - vnfsDeletedCount++ - - execution.setVariable(Prefix+"vnfsDeletedCount", vnfsDeletedCount) - - utils.log("DEBUG", " ***** Completed validateVnfDelete of DeleteVcpeResCustService ***** "+" vnf # "+vnfsDeletedCount, isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected Error from method validateVnfDelete() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - - // ***************************************** - // Prepare Completion request Section - // ***************************************** - public void postProcessResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG", " ***** Inside postProcessResponse of DeleteVcpeResCustService ***** ", isDebugEnabled) - - try { - String source = execution.getVariable("source") - String requestId = execution.getVariable("msoRequestId") - - String msoCompletionRequest = - """ - - ${requestId} - DELETE - ${source} - - vCPE Res Cust Service Instance has been deleted successfully. - BPMN Service Instance macro action: DELETE - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - utils.logAudit(xmlMsoCompletionRequest) - execution.setVariable(Prefix+"Success", true) - execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest) - utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in DeleteServiceInstance flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void prepareFalloutRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG", " *** STARTED DeleteVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled) - - try { - WorkflowException wfex = execution.getVariable("WorkflowException") - utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled) - String requestInfo = execution.getVariable(Prefix+"requestInfo") - utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled) - - String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) - - execution.setVariable(Prefix+"falloutRequest", falloutRequest) - } catch (Exception ex) { - utils.log("DEBUG", "Error Occured in DeleteVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVcpeResCustService prepareFalloutRequest Process") - } - utils.log("DEBUG", "*** COMPLETED DeleteVcpeResCustService prepareFalloutRequest Process ***", isDebugEnabled) - } - - - public void sendSyncError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG", " ***** Inside sendSyncError() of DeleteVcpeResCustService ***** ", isDebugEnabled) - - try { - String errorMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """ - ${errorMessage} - 7000 - """ - - utils.logAudit(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - } catch (Exception ex) { - utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) - } - } - - public void processJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable(DebugFlag) - execution.setVariable("prefix",Prefix) - try{ - utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") - }catch(BpmnError b){ - utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") - } - utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) - } - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy deleted file mode 100644 index f04b7384a1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy +++ /dev/null @@ -1,678 +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.bpmn.vcpe.scripts; - -import org.openecomp.mso.bpmn.common.scripts.*; -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse - -import java.util.UUID; -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.springframework.web.util.UriUtils; -import static org.apache.commons.lang3.StringUtils.* - - -/** - * This groovy class supports the DoCreateAllottedResourceBRG.bpmn process. - * - * @author - * - * Inputs: - * @param - msoRequestId - * @param - isDEbugLogEnabled - * @param - disableRollback - * @param - failExists - O - * @param - serviceInstanceId - * @param - globalCustomerId - O - * @param - subscriptionServiceType - O - * @param - parentServiceInstanceId - * @param - allottedReourceId - O - * @param - allottedResourceModelInfo - * @param - allottedResourceRole - * @param - allottedResourceType - * @param - brgWanMacAddress - * @param - vni - * @param - vgmuxBearerIP - * - * Outputs: - * @param - rollbackData (localRB->null) - * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) - * @param - WorkflowException - O - * @param - allottedResourceId - * @param - allottedResourceName - * - */ -public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ - - private static final String DebugFlag = "isDebugLogEnabled" - - String Prefix="DCARBRG_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public void preProcessRequest (DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) - - try { - execution.setVariable("prefix", Prefix) - - //Config Inputs - String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (isBlank(sdncCallbackUrl)) { - msg = "URN_mso_workflow_sdncadapter_callback is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) - - String sdncReplDelay = execution.getVariable('URN_mso_workflow_sdnc_replication_delay') - if (isBlank(sdncReplDelay)) { - msg = "URN_mso_workflow_sdnc_replication_delay is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - execution.setVariable("sdncReplDelay", sdncReplDelay) - utils.log("DEBUG","SDNC replication delay: " + sdncReplDelay, isDebugEnabled) - - //Request Inputs - if (isBlank(execution.getVariable("serviceInstanceId"))){ - msg = "Input serviceInstanceId is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - if (isBlank(execution.getVariable("parentServiceInstanceId"))) { - msg = "Input parentServiceInstanceId is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - if (isBlank(execution.getVariable("allottedResourceModelInfo"))) { - msg = "Input allottedResourceModelInfo is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - if (isBlank(execution.getVariable("vni"))) { - msg = "Input vni is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - if (isBlank(execution.getVariable("vgmuxBearerIP"))) { - msg = "Input vgmuxBearerIP is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - if (isBlank(execution.getVariable("brgWanMacAddress"))) { - msg = "Input brgWanMacAddress is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - if (isBlank(execution.getVariable("allottedResourceRole"))) { - msg = "Input allottedResourceRole is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - if (isBlank(execution.getVariable("allottedResourceType"))) { - msg = "Input allottedResourceType is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void getAaiAR (DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** getAaiAR ***** ", isDebugEnabled) - - String arType = execution.getVariable("allottedResourceType") - String arRole = execution.getVariable("allottedResourceRole") - - AllottedResourceUtils arUtils = new AllottedResourceUtils(this) - String orchStatus = arUtils.getAROrchStatus(execution) - - String errorMsg = "" - - if (orchStatus != null) // AR was found - { - if ("true".equals(execution.getVariable("failExists"))) - { - errorMsg = "Allotted resource " + arType + " with Role " + arRole + " already exists" - } - else - { - if ("Active".equals(orchStatus)) - { - execution.setVariable("foundActiveAR", true) - } - else // blanks included - { - errorMsg = "Allotted Resource " + arType + " with Role " + arRole + " already exists in an incomplete state -" + orchStatus - } - } - } - if (!isBlank(errorMsg)) { - utils.log("DEBUG", errorMsg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) - } - utils.log("DEBUG"," *****Exit getAaiAR *****", isDebugEnabled) - } - - public void createAaiAR(DelegateExecution execution) { - - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** createAaiAR ***** ", isDebugEnabled) - String msg = "" - - String allottedResourceId = execution.getVariable("allottedResourceId") - if (isBlank(allottedResourceId)) - { - allottedResourceId = UUID.randomUUID().toString() - execution.setVariable("allottedResourceId", allottedResourceId) - } - String arUrl = "" - try { - - //AAI PUT - AaiUtil aaiUriUtil = new AaiUtil(this) - String aaiEndpoint = execution.getVariable("URN_aai_endpoint") - String siResourceLink= execution.getVariable("PSI_resourceLink") - - String siUri = "" - utils.log("DEBUG", "PSI_resourceLink:" + siResourceLink, isDebugEnabled) - - if(!isBlank(siResourceLink)) { - utils.log("DEBUG", "Incoming PSI Resource Link is: " + siResourceLink, isDebugEnabled) - String[] split = siResourceLink.split("/aai/") - siUri = "/aai/" + split[1] - } - else - { - msg = "Parent Service Link in AAI is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - arUrl = "${aaiEndpoint}${siUri}" + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") - execution.setVariable("aaiARPath", arUrl) - utils.log("DEBUG", "GET AllottedResource AAI URL is:\n" + arUrl, isDebugEnabled) - - String namespace = aaiUriUtil.getNamespaceFromUri(execution, arUrl) - - String arType = execution.getVariable("allottedResourceType") - String arRole = execution.getVariable("allottedResourceRole") - String CSI_resourceLink = execution.getVariable("CSI_resourceLink") - String arModelInfo = execution.getVariable("allottedResourceModelInfo") - String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid") - String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid") - String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid") - - if (modelInvariantId == null) { - modelInvariantId = "" - } - if (modelVersionId == null) { - modelVersionId = "" - } - if (modelCustomizationId == null) { - modelCustomizationId = "" - } - - String payload = - """ - ${allottedResourceId} - - ${arType} - ${arRole} - - ${modelInvariantId} - ${modelVersionId} - ${modelCustomizationId} - PendingCreate - - - - service-instance - ${CSI_resourceLink} - - - """.trim() - - execution.setVariable("AaiARPayload", payload) - utils.log("DEBUG", " payload to create AllottedResource in AAI:" + "\n" + payload, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIPutCall(execution, arUrl, payload) - int responseCode = response.getStatusCode() - utils.log("DEBUG", "AllottedResource AAI PUT responseCode:" + responseCode, isDebugEnabled) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - utils.log("DEBUG", "AllottedResource AAI PUT responseStr:" + aaiResponse, isDebugEnabled) - - //200 OK 201 CREATED 202 ACCEPTED - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) - { - utils.log("DEBUG", "AAI PUT AllottedResource received a Good Response", isDebugEnabled) - } - else{ - utils.log("DEBUG", "AAI Put AllottedResouce received a Bad Response Code: " + responseCode, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - } catch (Exception ex) { - msg = "Exception in createAaiAR " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - - //start rollback set up - RollbackData rollbackData = new RollbackData() - def disableRollback = execution.getVariable("disableRollback") - rollbackData.put(Prefix, "disableRollback", disableRollback.toString()) - rollbackData.put(Prefix, "rollbackAAI", "true") - rollbackData.put(Prefix, "allottedResourceId", allottedResourceId) - rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId")) - rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId")) - rollbackData.put(Prefix, "aaiARPath", arUrl) - execution.setVariable("rollbackData", rollbackData) - utils.log("DEBUG"," *** Exit createAaiAR*** ", isDebugEnabled) - } - - public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** buildSDNCRequest *****", isDebugEnabled) - String sdncReq = null - - try { - - String allottedResourceId = execution.getVariable("allottedResourceId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String globalCustomerId = execution.getVariable("globalCustomerId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") - String callbackUrl = execution.getVariable("sdncCallbackUrl") - String requestId = execution.getVariable("msoRequestId") - - String brgWanMacAddress = execution.getVariable("brgWanMacAddress") - String vni = execution.getVariable("vni") - String vgmuxBearerIP = execution.getVariable("vgmuxBearerIP") - - String arModelInfo = execution.getVariable("allottedResourceModelInfo") - String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid") - String modelVersion = jsonUtil.getJsonValue(arModelInfo, "modelVersion") - String modelUUId = jsonUtil.getJsonValue(arModelInfo, "modelUuid") - String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid") - String modelName = jsonUtil.getJsonValue(arModelInfo, "modelName") - - if (modelInvariantId == null) { - modelInvariantId = "" - } - if (modelVersion == null) { - modelVersion = "" - } - if (modelUUId == null) { - modelUUId = "" - } - if (modelName == null) { - modelName = "" - } - if (modelCustomizationId == null) { - modelCustomizationId = "" - } - - sdncReq = - """ - - ${sdncRequestId} - ${serviceInstanceId} - ${action} - brg-topology-operation - ${callbackUrl} - - - - ${requestId} - CreateBRGInstance - MSO - - - - - - - ${subscriptionServiceType} - - ${serviceInstanceId} - - ${globalCustomerId} - - - ${allottedResourceId} - brg - ${parentServiceInstanceId} - - ${modelInvariantId} - ${modelUUId} - ${modelCustomizationId} - ${modelVersion} - ${modelName} - - - - ${brgWanMacAddress} - ${vni} - ${vgmuxBearerIP} - - - """ - - utils.log("DEBUG","sdncRequest:\n" + sdncReq, isDebugEnabled) - sdncReq = utils.formatXml(sdncReq) - - } catch(Exception ex) { - msg = "Exception in buildSDNCRequest. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit buildSDNCRequest *****", isDebugEnabled) - return sdncReq - } - - public void preProcessSDNCAssign(DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessSDNCAssign *****", isDebugEnabled) - - try { - String sdncRequestId = UUID.randomUUID().toString() - String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId) - execution.setVariable("sdncAssignRequest", sdncAssignReq) - utils.logAudit("sdncAssignRequest: " + sdncAssignReq) - def sdncRequestId2 = UUID.randomUUID().toString() - String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") - def rollbackData = execution.getVariable("rollbackData") - rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq) - execution.setVariable("rollbackData", rollbackData) - - utils.log("DEBUG","sdncAssignRollbackReq:\n" + sdncAssignRollbackReq, isDebugEnabled) - utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in preProcessSDNCAssign. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit preProcessSDNCAssign *****", isDebugEnabled) - } - - public void preProcessSDNCCreate(DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessSDNCCreate *****", isDebugEnabled) - - try { - String sdncRequestId = UUID.randomUUID().toString() - String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId) - execution.setVariable("sdncCreateRequest", sdncCreateReq) - utils.logAudit("sdncCreateReq: " + sdncCreateReq) - def sdncRequestId2 = UUID.randomUUID().toString() - String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") - def rollbackData = execution.getVariable("rollbackData") - rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq) - execution.setVariable("rollbackData", rollbackData) - - utils.log("DEBUG","sdncCreateRollbackReq:\n" + sdncCreateRollbackReq, isDebugEnabled) - utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in preProcessSDNCCreate. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit preProcessSDNCCreate *****", isDebugEnabled) - } - - public void preProcessSDNCActivate(DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessSDNCActivate *****", isDebugEnabled) - - try { - String sdncRequestId = UUID.randomUUID().toString() - String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId) - execution.setVariable("sdncActivateRequest", sdncActivateReq) - utils.logAudit("sdncActivateReq: " + sdncActivateReq) - def sdncRequestId2 = UUID.randomUUID().toString() - String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") - def rollbackData = execution.getVariable("rollbackData") - rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq) - execution.setVariable("rollbackData", rollbackData) - - utils.log("DEBUG","sdncActivateRollbackReq:\n" + sdncActivateRollbackReq, isDebugEnabled) - utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in preProcessSDNCActivate. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit preProcessSDNCActivate *****", isDebugEnabled) - } - - public void validateSDNCResp(DelegateExecution execution, String response, String method){ - - def isDebugLogEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled) - String msg = "" - - try { - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - utils.logAudit("SDNCResponse: " + response) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - utils.log("DEBUG", "Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response, isDebugLogEnabled) - - if (!"get".equals(method)) - { - def rollbackData = execution.getVariable("rollbackData") - rollbackData.put(Prefix, "rollback" + "SDNC" + method, "true") - execution.setVariable("rollbackData", rollbackData) - } - - }else{ - utils.log("DEBUG", "Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) - throw new BpmnError("MSOWorkflowException") - } - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in validateSDNCResp. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled) - } - - public void preProcessSDNCGet(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable(DebugFlag) - utils.log("DEBUG", "*** preProcessSDNCGet *** ", isDebugLogEnabled) - try{ - - def callbackUrl = execution.getVariable("sdncCallbackUrl") - // serviceOperation (URI for topology GET) will be retrieved from "selflink" from AAI if active AR exists in AAI - // or from "object-path" in SDNC response for assign when AR does not exist in AA - - String serviceOperation = "" - - if (execution.getVariable("foundActiveAR")) { - def aaiQueryResponse = execution.getVariable("aaiARGetResponse") - serviceOperation = utils.getNodeText1(aaiQueryResponse, "selflink") - utils.log("DEBUG", "AR service operation/aaiARSelfLink: " + serviceOperation, isDebugLogEnabled) - } - else - { - String response = execution.getVariable("sdncAssignResponse") - String data = utils.getNodeXml(response, "response-data") - data = data.replaceAll("<", "<") - data = data.replaceAll(">", ">") - utils.log("DEBUG", "Assign responseData: " + data, isDebugLogEnabled) - serviceOperation = utils.getNodeText1(data, "object-path") - utils.log("DEBUG", "AR service operation:" + serviceOperation, isDebugLogEnabled) - } - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String sdncRequestId = UUID.randomUUID().toString() - - //neeed the same url as used by vfmodules - String SDNCGetRequest = - """ - - ${sdncRequestId} - ${serviceInstanceId} - query - ${serviceOperation} - ${callbackUrl} - vfmodule - - - """ - - execution.setVariable("sdncGetRequest", SDNCGetRequest) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occurred Processing preProcessSDNCGetRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage()) - } - utils.log("DEBUG", "*** Exit preProcessSDNCGet *** ", isDebugLogEnabled) - } - - public void updateAaiAROrchStatus(DelegateExecution execution, String status){ - def isDebugEnabled = execution.getVariable(DebugFlag) - utils.log("DEBUG", " *** updateAaiAROrchStatus *** ", isDebugEnabled) - String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create - AllottedResourceUtils arUtils = new AllottedResourceUtils(this) - String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", isDebugEnabled) - } - - public void generateOutputs(DelegateExecution execution) - { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** generateOutputs ***** ", isDebugEnabled) - try { - String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped - utils.log("DEBUG", "resp:" + sdncGetResponse, isDebugEnabled) - String arData = utils.getNodeXml(sdncGetResponse, "brg-topology") - arData = utils.removeXmlNamespaces(arData) - - String brga = utils.getNodeXml(arData, "brg-assignments") - String ari = utils.getNodeXml(arData, "allotted-resource-identifiers") - execution.setVariable("allotedResourceName", utils.getNodeText1(ari, "allotted-resource-name")) - } catch (BpmnError e) { - utils.log("DEBUG", "BPMN Error in generateOutputs ", isDebugEnabled) - } catch(Exception ex) { - String msg = "Exception in generateOutputs " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG"," *** Exit generateOutputs *** ", isDebugEnabled) - - } - - public void preProcessRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled) - try { - - Object workflowException = execution.getVariable("WorkflowException"); - - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) - execution.setVariable("prevWorkflowException", workflowException); - //execution.setVariable("WorkflowException", null); - } - } catch (BpmnError e) { - utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) - } catch(Exception ex) { - String msg = "Exception in preProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled) - } - - public void postProcessRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled) - String msg = "" - try { - Object workflowException = execution.getVariable("prevWorkflowException"); - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) - execution.setVariable("WorkflowException", workflowException); - } - execution.setVariable("rollbackData", null) - } catch (BpmnError b) { - utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) - throw b; - } catch(Exception ex) { - msg = "Exception in postProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy deleted file mode 100644 index 4d27b82287..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy +++ /dev/null @@ -1,276 +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.bpmn.vcpe.scripts; - -import org.openecomp.mso.bpmn.common.scripts.*; -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.rest.APIResponse - -import java.util.UUID; -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.springframework.web.util.UriUtils; -import static org.apache.commons.lang3.StringUtils.* - -/** - * This groovy class supports the CreateAllottedResourceBRGRollback.bpmn process. - * - * @author - * - * Inputs: - * @param - msoRequestId - * @param - isDebugLogEnabled - * @param - disableRollback - O - * @param - rollbackData - * - * Outputs: - * @param - rollbackError - * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) - * - */ -public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProcessor{ - - private static final String DebugFlag = "isDebugLogEnabled" - - String Prefix="DCARBRGRB_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - public void preProcessRequest (DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) - execution.setVariable("prefix", Prefix) - String rbType = "DCARBRG_" - try { - - def rollbackData = execution.getVariable("rollbackData") - utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled) - - if (rollbackData != null) { - if (rollbackData.hasType(rbType)) { - - execution.setVariable("serviceInstanceId", rollbackData.get(rbType, "serviceInstanceId")) - execution.setVariable("parentServiceInstanceId", rollbackData.get(rbType, "parentServiceInstanceId")) - execution.setVariable("allottedResourceId", rollbackData.get("SERVICEINSTANCE", "allottedResourceId")) - - - def rollbackAAI = rollbackData.get(rbType, "rollbackAAI") - if ("true".equals(rollbackAAI)) - { - execution.setVariable("rollbackAAI",true) - execution.setVariable("aaiARPath", rollbackData.get(rbType, "aaiARPath")) - - } - def rollbackSDNC = rollbackData.get(rbType, "rollbackSDNCassign") - if ("true".equals(rollbackSDNC)) - { - execution.setVariable("rollbackSDNC", true) - execution.setVariable("deactivateSdnc", rollbackData.get(rbType, "rollbackSDNCactivate")) - execution.setVariable("deleteSdnc", rollbackData.get(rbType, "rollbackSDNCcreate")) - execution.setVariable("unassignSdnc", rollbackData.get(rbType, "rollbackSDNCassign")) - - utils.log("DEBUG","sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") , isDebugEnabled) - utils.log("DEBUG","sdncDelete:\n" + execution.getVariable("deleteSdnc"), isDebugEnabled) - utils.log("DEBUG","sdncUnassign:\n" + execution.getVariable("unassignSdnc"), isDebugEnabled) - - execution.setVariable("sdncDeactivateRequest", rollbackData.get(rbType, "sdncActivateRollbackReq")) - execution.setVariable("sdncDeleteRequest", rollbackData.get(rbType, "sdncCreateRollbackReq")) - execution.setVariable("sdncUnassignRequest", rollbackData.get(rbType, "sdncAssignRollbackReq")) - } - - if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackSDNC") != true) - { - execution.setVariable("skipRollback", true) - } - } - else { - execution.setVariable("skipRollback", true) - } - } - else { - execution.setVariable("skipRollback", true) - } - if (execution.getVariable("disableRollback").equals("true" )) - { - execution.setVariable("skipRollback", true) - } - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - // aaiARPath set during query (existing AR) - public void updateAaiAROrchStatus(DelegateExecution execution, String status){ - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = null; - utils.log("DEBUG", " *** updateAaiAROrchStatus ***", isDebugEnabled) - AllottedResourceUtils arUtils = new AllottedResourceUtils(this) - String aaiARPath = execution.getVariable("aaiARPath") - utils.log("DEBUG", " aaiARPath:" + aaiARPath, isDebugEnabled) - String ar = null; //need this for getting resourceVersion for delete - if (!isBlank(aaiARPath)) - { - ar = arUtils.getARbyLink(execution, aaiARPath, "") - } - if (isBlank(ar)) - { - msg = "AR not found in AAI at:" + aaiARPath - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", isDebugEnabled) - } - - public void validateSDNCResp(DelegateExecution execution, String response, String method){ - - def isDebugLogEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled) - String msg = "" - - try { - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - utils.logAudit("SDNCResponse: " + response) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - utils.log("DEBUG", "Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response, isDebugLogEnabled) - - }else{ - - utils.log("DEBUG", "Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) - throw new BpmnError("MSOWorkflowException") - } - } catch (BpmnError e) { - if ("404".contentEquals(e.getErrorCode())) - { - msg = "SDNC rollback " + method + " returned a 404. Proceding with rollback" - utils.log("DEBUG", msg, isDebugLogEnabled) - } - else { - throw e; - } - } catch(Exception ex) { - msg = "Exception in validateSDNCResp. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled) - } - - public void deleteAaiAR(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable(DebugFlag) - try{ - utils.log("DEBUG", " *** deleteAaiAR *** ", isDebugLogEnabled) - AllottedResourceUtils arUtils = new AllottedResourceUtils(this) - String ar = null //need to get resource-version - String arLink = execution.getVariable("aaiARPath") - if (!isBlank(arLink)) - { - ar = arUtils.getARbyLink(execution, arLink, "") - } - arUtils.deleteAR(execution, arLink + '?resource-version=' + UriUtils.encode(execution.getVariable("aaiARResourceVersion"),"UTF-8")) - } catch (BpmnError e) { - throw e; - }catch(Exception ex){ - utils.log("ERROR", "Exception Occurred Processing preProcessSDNCGetRequest. Exception is:\n" + ex, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) - } - utils.log("DEBUG", " *** Exit deleteAaiAR *** ", isDebugLogEnabled) - } - - public void postProcessRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** postProcessRequest ***** ", isDebugEnabled) - String msg = "" - try { - execution.setVariable("rollbackData", null) - boolean skipRollback = execution.getVariable("skipRollback") - if (!skipRollback) - { - execution.setVariable("rolledBack", true) - utils.log("DEBUG","rolledBack", isDebugEnabled) - } - utils.log("DEBUG","*** Exit postProcessRequest ***", isDebugEnabled) - - } catch (BpmnError e) { - msg = "Bpmn Exception in postProcessRequest. " - utils.log("DEBUG", msg, isDebugEnabled) - } catch (Exception ex) { - msg = "Exception in postProcessRequest. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - - } - - public void processRollbackException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** processRollbackException ***** ", isDebugEnabled) - try{ - utils.log("DEBUG", "Caught an Exception in DoCreateAllottedResourceRollback", isDebugEnabled) - execution.setVariable("rollbackData", null) - execution.setVariable("rolledBack", false) - execution.setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback") - execution.setVariable("WorkflowException", null) - - }catch(BpmnError b){ - utils.log("DEBUG", "BPMN Error during processRollbackExceptions Method: ", isDebugEnabled) - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processRollbackExceptions Method: " + e.getMessage(), isDebugEnabled) - } - - utils.log("DEBUG", " Exit processRollbackException", isDebugEnabled) - } - - public void processRollbackJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** processRollbackJavaException ***** ", isDebugEnabled) - try{ - execution.setVariable("rollbackData", null) - execution.setVariable("rolledBack", false) - execution.setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback") - utils.log("DEBUG", "Caught Exception in processRollbackJavaException", isDebugEnabled) - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception in processRollbackJavaException " + e.getMessage(), isDebugEnabled) - } - utils.log("DEBUG", "***** Exit processRollbackJavaException *****", isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy deleted file mode 100644 index dc248845b9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy +++ /dev/null @@ -1,674 +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.bpmn.vcpe.scripts; - -import org.openecomp.mso.bpmn.common.scripts.*; -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse - -import java.util.UUID; -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.springframework.web.util.UriUtils; -import static org.apache.commons.lang3.StringUtils.* - - -/** - * This groovy class supports the DoCreateAllottedResourceTXC.bpmn process. - * - * @author - * - * Inputs: - * @param - msoRequestId - * @param - isDEbugLogEnabled - * @param - disableRollback - * @param - failExists - O - * @param - serviceInstanceId - * @param - globalCustomerId - O - * @param - subscriptionServiceType - O - * @param - parentServiceInstanceId - * @param - allottedReourceId - O - * @param - allottedResourceModelInfo - * @param - allottedResourceRole - * @param - allottedResourceType - * @param - brgWanMacAddress - * - * Outputs: - * @param - rollbackData (localRB->null) - * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) - * @param - WorkflowException - O - * @param - allottedResourceId - * @param - allottedResourceName - * @param - vni - * @param - vgmuxBearerIP - * @param - vgmuxLanIP - * - */ -public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ - - private static final String DebugFlag = "isDebugLogEnabled" - - String Prefix="DCARTXC_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - public void preProcessRequest (DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) - - try { - String msoRequestId = execution.getVariable("msoRequestId") - utils.log("DEBUG", " msoRequestId = " + msoRequestId, isDebugEnabled) - - execution.setVariable("prefix", Prefix) - - //Config Inputs - String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (isBlank(sdncCallbackUrl)) { - msg = "URN_mso_workflow_sdncadapter_callback is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) - - String sdncReplDelay = execution.getVariable('URN_mso_workflow_sdnc_replication_delay') - if (isBlank(sdncReplDelay)) { - msg = "URN_mso_workflow_sdnc_replication_delay is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - execution.setVariable("sdncReplDelay", sdncReplDelay) - utils.log("DEBUG","SDNC replication delay: " + sdncReplDelay, isDebugEnabled) - - //Request Inputs - if (isBlank(execution.getVariable("serviceInstanceId"))){ - msg = "Input serviceInstanceId is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - if (isBlank(execution.getVariable("parentServiceInstanceId"))) { - msg = "Input parentServiceInstanceId is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - if (isBlank(execution.getVariable("allottedResourceModelInfo"))) { - msg = "Input allottedResourceModelInfo is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - if (isBlank(execution.getVariable("brgWanMacAddress"))) { - msg = "Input brgWanMacAddress is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - if (isBlank(execution.getVariable("allottedResourceRole"))) { - msg = "Input allottedResourceRole is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - if (isBlank(execution.getVariable("allottedResourceType"))) { - msg = "Input allottedResourceType is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void getAaiAR (DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** getAaiAR ***** ", isDebugEnabled) - - String arType = execution.getVariable("allottedResourceType") - String arRole = execution.getVariable("allottedResourceRole") - - AllottedResourceUtils arUtils = new AllottedResourceUtils(this) - String orchStatus = arUtils.getAROrchStatus(execution) - - String errorMsg = "" - - if (orchStatus != null) // AR was found - { - if ("true".equals(execution.getVariable("failExists"))) - { - errorMsg = "Allotted resource " + arType + " with Role " + arRole + " already exists" - } - else - { - if ("Active".equals(orchStatus)) - { - execution.setVariable("foundActiveAR", true) - } - else // blanks included - { - errorMsg = "Allotted Resource " + arType + " with Role " + arRole + " already exists in an incomplete state -" + orchStatus - } - } - } - if (!isBlank(errorMsg)) { - utils.log("DEBUG", errorMsg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) - } - utils.log("DEBUG"," *****Exit getAaiAR *****", isDebugEnabled) - } - - public void createAaiAR(DelegateExecution execution) { - - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** createAaiAR ***** ", isDebugEnabled) - String msg = "" - - String allottedResourceId = execution.getVariable("allottedResourceId") - if (isBlank(allottedResourceId)) - { - allottedResourceId = UUID.randomUUID().toString() - execution.setVariable("allottedResourceId", allottedResourceId) - } - String arUrl = "" - try { - - //AAI PUT - AaiUtil aaiUriUtil = new AaiUtil(this) - String aaiEndpoint = execution.getVariable("URN_aai_endpoint") - String siResourceLink= execution.getVariable("PSI_resourceLink") - - String siUri = "" - utils.log("DEBUG", "PSI_resourceLink:" + siResourceLink, isDebugEnabled) - - if(!isBlank(siResourceLink)) { - utils.log("DEBUG", "Incoming PSI Resource Link is: " + siResourceLink, isDebugEnabled) - String[] split = siResourceLink.split("/aai/") - siUri = "/aai/" + split[1] - } - else - { - msg = "Parent Service Link in AAI is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - arUrl = "${aaiEndpoint}${siUri}" + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") - execution.setVariable("aaiARPath", arUrl) - utils.log("DEBUG", "GET AllottedResource AAI URL is:\n" + arUrl, isDebugEnabled) - - String namespace = aaiUriUtil.getNamespaceFromUri(execution, arUrl) - - String arType = execution.getVariable("allottedResourceType") - String arRole = execution.getVariable("allottedResourceRole") - String CSI_resourceLink = execution.getVariable("CSI_resourceLink") - String arModelInfo = execution.getVariable("allottedResourceModelInfo") - utils.log("DEBUG", "arModelInfo is:\n" + arModelInfo, isDebugEnabled) - String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid") - String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid") - String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid") - - if (modelInvariantId == null) { - modelInvariantId = "" - } - if (modelVersionId == null) { - modelVersionId = "" - } - if (modelCustomizationId == null) { - modelCustomizationId = "" - } - - String payload = - """ - ${allottedResourceId} - - ${arType} - ${arRole} - - ${modelInvariantId} - ${modelVersionId} - ${modelCustomizationId} - PendingCreate - - - - service-instance - ${CSI_resourceLink} - - - """.trim() - - execution.setVariable("AaiARPayload", payload) - utils.log("DEBUG", " payload to create AllottedResource in AAI:" + "\n" + payload, isDebugEnabled) - - APIResponse response = aaiUriUtil.executeAAIPutCall(execution, arUrl, payload) - int responseCode = response.getStatusCode() - utils.log("DEBUG", "AllottedResource AAI PUT responseCode:" + responseCode, isDebugEnabled) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - utils.log("DEBUG", "AllottedResource AAI PUT responseStr:" + aaiResponse, isDebugEnabled) - - //200 OK 201 CREATED 202 ACCEPTED - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) - { - utils.log("DEBUG", "AAI PUT AllottedResource received a Good Response", isDebugEnabled) - } - else{ - utils.log("DEBUG", "AAI Put AllottedResouce received a Bad Response Code: " + responseCode, isDebugEnabled) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - } catch (Exception ex) { - msg = "Exception in createAaiAR " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - - //start rollback set up - RollbackData rollbackData = new RollbackData() - def disableRollback = execution.getVariable("disableRollback") - rollbackData.put(Prefix, "disableRollback", disableRollback.toString()) - rollbackData.put(Prefix, "rollbackAAI", "true") - rollbackData.put(Prefix, "allottedResourceId", allottedResourceId) - rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId")) - rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId")) - rollbackData.put(Prefix, "aaiARPath", arUrl) - execution.setVariable("rollbackData", rollbackData) - utils.log("DEBUG"," *** Exit createAaiAR*** ", isDebugEnabled) - } - - public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** buildSDNCRequest *****", isDebugEnabled) - String sdncReq = null - - try { - - String allottedResourceId = execution.getVariable("allottedResourceId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String globalCustomerId = execution.getVariable("globalCustomerId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") - String serviceChainServiceInstanceId = execution.getVariable("serviceChainServiceInstanceId") - String callbackUrl = execution.getVariable("sdncCallbackUrl") - String requestId = execution.getVariable("msoRequestId") - - String brgWanMacAddress = execution.getVariable("brgWanMacAddress") - - String arModelInfo = execution.getVariable("allottedResourceModelInfo") - String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid") - String modelVersion = jsonUtil.getJsonValue(arModelInfo, "modelVersion") - String modelUUId = jsonUtil.getJsonValue(arModelInfo, "modelUuid") - String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid") - String modelName = jsonUtil.getJsonValue(arModelInfo, "modelName") - - if (modelInvariantId == null) { - modelInvariantId = "" - } - if (modelVersion == null) { - modelVersion = "" - } - if (modelUUId == null) { - modelUUId = "" - } - if (modelName == null) { - modelName = "" - } - if (modelCustomizationId == null) { - modelCustomizationId = "" - } - - sdncReq = - """ - - ${sdncRequestId} - ${serviceInstanceId} - ${action} - tunnelxconn-topology-operation - ${callbackUrl} - - - - ${requestId} - CreateTunnelXConnInstance - MSO - - - - - - - ${subscriptionServiceType} - - ${serviceInstanceId} - - ${globalCustomerId} - - - ${allottedResourceId} - tunnelxconn - ${parentServiceInstanceId} - - ${modelInvariantId} - ${modelUUId} - ${modelCustomizationId} - ${modelVersion} - ${modelName} - - - - ${brgWanMacAddress} - - - """ - - utils.log("DEBUG","sdncRequest:\n" + sdncReq, isDebugEnabled) - sdncReq = utils.formatXml(sdncReq) - - } catch(Exception ex) { - msg = "Exception in buildSDNCRequest. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit buildSDNCRequest *****", isDebugEnabled) - return sdncReq - } - - public void preProcessSDNCAssign(DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessSDNCAssign *****", isDebugEnabled) - - try { - String sdncRequestId = UUID.randomUUID().toString() - String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId) - execution.setVariable("sdncAssignRequest", sdncAssignReq) - utils.logAudit("sdncAssignRequest: " + sdncAssignReq) - def sdncRequestId2 = UUID.randomUUID().toString() - String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") - def rollbackData = execution.getVariable("rollbackData") - rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq) - execution.setVariable("rollbackData", rollbackData) - - utils.log("DEBUG","sdncAssignRollbackReq:\n" + sdncAssignRollbackReq, isDebugEnabled) - utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in preProcessSDNCAssign. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit preProcessSDNCAssign *****", isDebugEnabled) - } - - public void preProcessSDNCCreate(DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessSDNCCreate *****", isDebugEnabled) - - try { - String sdncRequestId = UUID.randomUUID().toString() - String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId) - execution.setVariable("sdncCreateRequest", sdncCreateReq) - utils.logAudit("sdncCreateReq: " + sdncCreateReq) - def sdncRequestId2 = UUID.randomUUID().toString() - String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") - def rollbackData = execution.getVariable("rollbackData") - rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq) - execution.setVariable("rollbackData", rollbackData) - - utils.log("DEBUG","sdncCreateRollbackReq:\n" + sdncCreateRollbackReq, isDebugEnabled) - utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in preProcessSDNCCreate. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit preProcessSDNCCreate *****", isDebugEnabled) - } - - public void preProcessSDNCActivate(DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessSDNCActivate *****", isDebugEnabled) - - try { - String sdncRequestId = UUID.randomUUID().toString() - String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId) - execution.setVariable("sdncActivateRequest", sdncActivateReq) - utils.logAudit("sdncActivateReq: " + sdncActivateReq) - def sdncRequestId2 = UUID.randomUUID().toString() - String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") - def rollbackData = execution.getVariable("rollbackData") - rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq) - execution.setVariable("rollbackData", rollbackData) - - utils.log("DEBUG","sdncActivateRollbackReq:\n" + sdncActivateRollbackReq, isDebugEnabled) - utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in preProcessSDNCActivate. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit preProcessSDNCActivate *****", isDebugEnabled) - } - - public void validateSDNCResp(DelegateExecution execution, String response, String method){ - - def isDebugLogEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled) - String msg = "" - - try { - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - utils.logAudit("SDNCResponse: " + response) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - utils.log("DEBUG", "Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response, isDebugLogEnabled) - - if (!"get".equals(method)) - { - def rollbackData = execution.getVariable("rollbackData") - rollbackData.put(Prefix, "rollback" + "SDNC" + method, "true") - execution.setVariable("rollbackData", rollbackData) - } - - }else{ - utils.log("DEBUG", "Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) - throw new BpmnError("MSOWorkflowException") - } - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in validateSDNCResp. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled) - } - - public void preProcessSDNCGet(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable(DebugFlag) - utils.log("DEBUG", "*** preProcessSDNCGet *** ", isDebugLogEnabled) - try{ - - def callbackUrl = execution.getVariable("sdncCallbackUrl") - // serviceOperation (URI for topology GET) will be retrieved from "selflink" from AAI if active AR exists in AAI - // or from "object-path" in SDNC response for assign when AR does not exist in AA - - String serviceOperation = "" - - if (execution.getVariable("foundActiveAR")) { - def aaiQueryResponse = execution.getVariable("aaiARGetResponse") - serviceOperation = utils.getNodeText1(aaiQueryResponse, "selflink") - utils.log("DEBUG", "AR service operation/aaiARSelfLink: " + serviceOperation, isDebugLogEnabled) - } - else - { - String response = execution.getVariable("sdncAssignResponse") - String data = utils.getNodeXml(response, "response-data") - data = data.replaceAll("<", "<") - data = data.replaceAll(">", ">") - utils.log("DEBUG", "Assign responseData: " + data, isDebugLogEnabled) - serviceOperation = utils.getNodeText1(data, "object-path") - utils.log("DEBUG", "AR service operation:" + serviceOperation, isDebugLogEnabled) - } - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String sdncRequestId = UUID.randomUUID().toString() - - //neeed the same url as used by vfmodules - String SDNCGetRequest = - """ - - ${sdncRequestId} - ${serviceInstanceId} - query - ${serviceOperation} - ${callbackUrl} - vfmodule - - - """ - - execution.setVariable("sdncGetRequest", SDNCGetRequest) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occurred Processing preProcessSDNCGetRequest. Exception is:\n" + e, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage()) - } - utils.log("DEBUG", "*** Exit preProcessSDNCGet *** ", isDebugLogEnabled) - } - - public void updateAaiAROrchStatus(DelegateExecution execution, String status){ - def isDebugEnabled = execution.getVariable(DebugFlag) - utils.log("DEBUG", " *** updateAaiAROrchStatus *** ", isDebugEnabled) - String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create - AllottedResourceUtils arUtils = new AllottedResourceUtils(this) - String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", isDebugEnabled) - } - - public void generateOutputs(DelegateExecution execution) - { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** generateOutputs ***** ", isDebugEnabled) - try { - String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped - utils.log("DEBUG", "resp:" + sdncGetResponse, isDebugEnabled) - String arData = utils.getNodeXml(sdncGetResponse, "tunnelxconn-topology") - arData = utils.removeXmlNamespaces(arData) - - String txca = utils.getNodeXml(arData, "tunnelxconn-assignments") - execution.setVariable("vni", utils.getNodeText1(txca, "vni")) - execution.setVariable("vgmuxBearerIP", utils.getNodeText1(txca, "vgmux-bearer-ip")) - execution.setVariable("vgmuxLanIP", utils.getNodeText1(txca, "vgmux-lan-ip")) - - String ari = utils.getNodeXml(arData, "allotted-resource-identifiers") - execution.setVariable("allotedResourceName", utils.getNodeText1(ari, "allotted-resource-name")) - } catch (BpmnError e) { - utils.log("DEBUG", "BPMN Error in generateOutputs ", isDebugEnabled) - } catch(Exception ex) { - String msg = "Exception in generateOutputs " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG"," *** Exit generateOutputs *** ", isDebugEnabled) - - } - - public void preProcessRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled) - try { - - Object workflowException = execution.getVariable("WorkflowException"); - - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) - execution.setVariable("prevWorkflowException", workflowException); - //execution.setVariable("WorkflowException", null); - } - } catch (BpmnError e) { - utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) - } catch(Exception ex) { - String msg = "Exception in preProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled) - } - - public void postProcessRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled) - String msg = "" - try { - Object workflowException = execution.getVariable("prevWorkflowException"); - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) - execution.setVariable("WorkflowException", workflowException); - } - execution.setVariable("rollbackData", null) - } catch (BpmnError b) { - utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) - throw b; - } catch(Exception ex) { - msg = "Exception in postProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy deleted file mode 100644 index b6efced8fe..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy +++ /dev/null @@ -1,276 +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.bpmn.vcpe.scripts; - -import org.openecomp.mso.bpmn.common.scripts.*; -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.rest.APIResponse - -import java.util.UUID; -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.springframework.web.util.UriUtils; -import static org.apache.commons.lang3.StringUtils.* - -/** - * This groovy class supports the CreateAllottedResourceTXCRollback.bpmn process. - * - * @author - * - * Inputs: - * @param - msoRequestId - * @param - isDebugLogEnabled - * @param - disableRollback - O - * @param - rollbackData - * - * Outputs: - * @param - rollbackError - * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) - * - */ -public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProcessor{ - - private static final String DebugFlag = "isDebugLogEnabled" - - String Prefix="DCARTXCRB_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - public void preProcessRequest (DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) - execution.setVariable("prefix", Prefix) - String rbType = "DCARTXC_" - try { - - def rollbackData = execution.getVariable("rollbackData") - utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled) - - if (rollbackData != null) { - if (rollbackData.hasType(rbType)) { - - execution.setVariable("serviceInstanceId", rollbackData.get(rbType, "serviceInstanceId")) - execution.setVariable("parentServiceInstanceId", rollbackData.get(rbType, "parentServiceInstanceId")) - execution.setVariable("allottedResourceId", rollbackData.get("SERVICEINSTANCE", "allottedResourceId")) - - - def rollbackAAI = rollbackData.get(rbType, "rollbackAAI") - if ("true".equals(rollbackAAI)) - { - execution.setVariable("rollbackAAI",true) - execution.setVariable("aaiARPath", rollbackData.get(rbType, "aaiARPath")) - - } - def rollbackSDNC = rollbackData.get(rbType, "rollbackSDNCassign") - if ("true".equals(rollbackSDNC)) - { - execution.setVariable("rollbackSDNC", true) - execution.setVariable("deactivateSdnc", rollbackData.get(rbType, "rollbackSDNCactivate")) - execution.setVariable("deleteSdnc", rollbackData.get(rbType, "rollbackSDNCcreate")) - execution.setVariable("unassignSdnc", rollbackData.get(rbType, "rollbackSDNCassign")) - - utils.log("DEBUG","sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") , isDebugEnabled) - utils.log("DEBUG","sdncDelete:\n" + execution.getVariable("deleteSdnc"), isDebugEnabled) - utils.log("DEBUG","sdncUnassign:\n" + execution.getVariable("unassignSdnc"), isDebugEnabled) - - execution.setVariable("sdncDeactivateRequest", rollbackData.get(rbType, "sdncActivateRollbackReq")) - execution.setVariable("sdncDeleteRequest", rollbackData.get(rbType, "sdncCreateRollbackReq")) - execution.setVariable("sdncUnassignRequest", rollbackData.get(rbType, "sdncAssignRollbackReq")) - } - - if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackSDNC") != true) - { - execution.setVariable("skipRollback", true) - } - } - else { - execution.setVariable("skipRollback", true) - } - } - else { - execution.setVariable("skipRollback", true) - } - if (execution.getVariable("disableRollback").equals("true" )) - { - execution.setVariable("skipRollback", true) - } - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - // aaiARPath set during query (existing AR) - public void updateAaiAROrchStatus(DelegateExecution execution, String status){ - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = null; - utils.log("DEBUG", " *** updateAaiAROrchStatus ***", isDebugEnabled) - AllottedResourceUtils arUtils = new AllottedResourceUtils(this) - String aaiARPath = execution.getVariable("aaiARPath") - utils.log("DEBUG", " aaiARPath:" + aaiARPath, isDebugEnabled) - String ar = null; //need this for getting resourceVersion for delete - if (!isBlank(aaiARPath)) - { - ar = arUtils.getARbyLink(execution, aaiARPath, "") - } - if (isBlank(ar)) - { - msg = "AR not found in AAI at:" + aaiARPath - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", isDebugEnabled) - } - - public void validateSDNCResp(DelegateExecution execution, String response, String method){ - - def isDebugLogEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled) - String msg = "" - - try { - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - utils.logAudit("SDNCResponse: " + response) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - utils.log("DEBUG", "Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response, isDebugLogEnabled) - - }else{ - - utils.log("DEBUG", "Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) - throw new BpmnError("MSOWorkflowException") - } - } catch (BpmnError e) { - if ("404".contentEquals(e.getErrorCode())) - { - msg = "SDNC rollback " + method + " returned a 404. Proceding with rollback" - utils.log("DEBUG", msg, isDebugLogEnabled) - } - else { - throw e; - } - } catch(Exception ex) { - msg = "Exception in validateSDNCResp. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled) - } - - public void deleteAaiAR(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable(DebugFlag) - try{ - utils.log("DEBUG", " *** deleteAaiAR *** ", isDebugLogEnabled) - AllottedResourceUtils arUtils = new AllottedResourceUtils(this) - String ar = null //need to get resource-version - String arLink = execution.getVariable("aaiARPath") - if (!isBlank(arLink)) - { - ar = arUtils.getARbyLink(execution, arLink, "") - } - arUtils.deleteAR(execution, arLink + '?resource-version=' + UriUtils.encode(execution.getVariable("aaiARResourceVersion"),"UTF-8")) - } catch (BpmnError e) { - throw e; - }catch(Exception ex){ - utils.log("ERROR", "Exception Occurred Processing preProcessSDNCGetRequest. Exception is:\n" + ex, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) - } - utils.log("DEBUG", " *** Exit deleteAaiAR *** ", isDebugLogEnabled) - } - - public void postProcessRequest(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** postProcessRequest ***** ", isDebugEnabled) - String msg = "" - try { - execution.setVariable("rollbackData", null) - boolean skipRollback = execution.getVariable("skipRollback") - if (!skipRollback) - { - execution.setVariable("rolledBack", true) - utils.log("DEBUG","rolledBack", isDebugEnabled) - } - utils.log("DEBUG","*** Exit postProcessRequest ***", isDebugEnabled) - - } catch (BpmnError e) { - msg = "Bpmn Exception in postProcessRequest. " - utils.log("DEBUG", msg, isDebugEnabled) - } catch (Exception ex) { - msg = "Exception in postProcessRequest. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - - } - - public void processRollbackException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** processRollbackException ***** ", isDebugEnabled) - try{ - utils.log("DEBUG", "Caught an Exception in DoCreateAllottedResourceRollback", isDebugEnabled) - execution.setVariable("rollbackData", null) - execution.setVariable("rolledBack", false) - execution.setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback") - execution.setVariable("WorkflowException", null) - - }catch(BpmnError b){ - utils.log("DEBUG", "BPMN Error during processRollbackExceptions Method: ", isDebugEnabled) - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processRollbackExceptions Method: " + e.getMessage(), isDebugEnabled) - } - - utils.log("DEBUG", " Exit processRollbackException", isDebugEnabled) - } - - public void processRollbackJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** processRollbackJavaException ***** ", isDebugEnabled) - try{ - execution.setVariable("rollbackData", null) - execution.setVariable("rolledBack", false) - execution.setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback") - utils.log("DEBUG", "Caught Exception in processRollbackJavaException", isDebugEnabled) - - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception in processRollbackJavaException " + e.getMessage(), isDebugEnabled) - } - utils.log("DEBUG", "***** Exit processRollbackJavaException *****", isDebugEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy deleted file mode 100644 index 83ef53d5dd..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy +++ /dev/null @@ -1,372 +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.bpmn.vcpe.scripts; - -import org.openecomp.mso.bpmn.common.scripts.*; -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.rest.APIResponse - -import java.util.UUID; -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.springframework.web.util.UriUtils; -import static org.apache.commons.lang3.StringUtils.* - -/** - * This groovy class supports the DoDeleteAllottedResourceBRG.bpmn process. - * - * @author - * - * Inputs: - * @param - msoRequestId - * @param - isDebugLogEnabled - * @param - disableRollback - O ignored - * @param - failNotfound - O - * @param - serviceInstanceId - * @param - globalCustomerId - O - * @param - subscriptionServiceType - O - * @param - parentServiceInstanceId - * @param - allottedResourceId - * - * Outputs: - * @param - rollbackData - N/A - * @param - rolledBack - true if no deletions performed - * @param - WorkflowException - O - * @param - wasDeleted - O (ie not silentSuccess) - * - */ -public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ - - private static final String DebugFlag = "isDebugLogEnabled" - - String Prefix="DDARBRG_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - public void preProcessRequest (DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) - - try { - execution.setVariable("prefix", Prefix) - - //Config Inputs - String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (isBlank(sdncCallbackUrl)) { - msg = "URN_mso_workflow_sdncadapter_callback is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) - - //Request Inputs - if (isBlank(execution.getVariable("serviceInstanceId"))){ - msg = "Input serviceInstanceId is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - if (isBlank(execution.getVariable("allottedResourceId"))){ - msg = "Input allottedResourceId is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void getAaiAR (DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** getAaiAR ***** ", isDebugEnabled) - - String allottedResourceId = execution.getVariable("allottedResourceId") - - AllottedResourceUtils arUtils = new AllottedResourceUtils(this) - String ar = arUtils.getARbyId(execution, allottedResourceId) - - String errorMsg = "" - if (isBlank(ar)) // AR was !found - { - errorMsg = "Allotted resource not found in AAI with AllottedResourceId:" + allottedResourceId - } - else - { - String aaiARPath = execution.getVariable("aaiARPath") - String parentServiceInstanceId = arUtils.getPSIFmARLink(execution, aaiARPath) - execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) - } - if (!isBlank(errorMsg)) { - utils.log("DEBUG", errorMsg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) - } - utils.log("DEBUG"," ***** getAaiAR *****", isDebugEnabled) - - } - - // aaiARPath set during query (existing AR) - public void updateAaiAROrchStatus(DelegateExecution execution, String status){ - def isDebugEnabled = execution.getVariable(DebugFlag) - utils.log("DEBUG", " *** updateAaiAROrchStatus *** ", isDebugEnabled) - AllottedResourceUtils arUtils = new AllottedResourceUtils(this) - String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) - String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", isDebugEnabled) - } - - public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** buildSDNCRequest *****", isDebugEnabled) - String sdncReq = null - - try { - - String allottedResourceId = execution.getVariable("allottedResourceId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") - String globalCustomerId = execution.getVariable("globalCustomerId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - - String callbackUrl = execution.getVariable("sdncCallbackUrl") - String requestId = execution.getVariable("msoRequestId") - - String serviceChainServiceInstanceId = "" - String sourceNetworkId = "" - String sourceNetworkRole = "" - String allottedResourceRole = "" - - String arModelInfo = "" - String modelInvariantId = "" - String modelVersion = "" - String modelUUId = "" - String modelCustomizationId = "" - String modelName = "" - - - sdncReq = - """ - - ${sdncRequestId} - ${serviceInstanceId} - ${action} - brg-topology-operation - ${callbackUrl} - - - - ${requestId} - DeleteBRGInstance - MSO - - - - - - - ${subscriptionServiceType} - - ${serviceInstanceId} - - ${globalCustomerId} - - - ${allottedResourceId} - brg - ${parentServiceInstanceId} - - ${modelInvariantId} - ${modelUUId} - ${modelCustomizationId} - ${modelVersion} - ${modelName} - - - - - - """ - - utils.log("DEBUG","sdncRequest:\n" + sdncReq, isDebugEnabled) - sdncReq = utils.formatXml(sdncReq) - - } catch(Exception ex) { - msg = "Exception in buildSDNCRequest. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit buildSDNCRequest *****", isDebugEnabled) - return sdncReq - } - - public void preProcessSDNCUnassign(DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessSDNCUnassign *****", isDebugEnabled) - - try { - String sdncRequestId = UUID.randomUUID().toString() - String sdncUnassignReq = buildSDNCRequest(execution, "unassign", sdncRequestId) - execution.setVariable("sdncUnassignRequest", sdncUnassignReq) - utils.logAudit("sdncUnassignRequest: " + sdncUnassignReq) - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in preProcessSDNCUnassign. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit preProcessSDNCUnassign *****", isDebugEnabled) - } - - public void preProcessSDNCDelete(DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessSDNCDelete *****", isDebugEnabled) - - try { - String sdncRequestId = UUID.randomUUID().toString() - String sdncDeleteReq = buildSDNCRequest(execution, "delete", sdncRequestId) - execution.setVariable("sdncDeleteRequest", sdncDeleteReq) - utils.logAudit("sdncDeleteReq: " + sdncDeleteReq) - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit preProcessSDNCDelete *****", isDebugEnabled) - } - - public void preProcessSDNCDeactivate(DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessSDNCDeactivate *****", isDebugEnabled) - - try { - String sdncRequestId = UUID.randomUUID().toString() - String sdncDeactivateReq = buildSDNCRequest(execution, "deactivate", sdncRequestId) - execution.setVariable("sdncDeactivateRequest", sdncDeactivateReq) - utils.logAudit("sdncDeactivateReq: " + sdncDeactivateReq) - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in preProcessSDNCDeactivate. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit preProcessSDNCDeactivate *****", isDebugEnabled) - } - - public void validateSDNCResp(DelegateExecution execution, String response, String method){ - - def isDebugLogEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled) - String msg = "" - - try { - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - utils.logAudit("SDNCResponse: " + response) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - utils.log("DEBUG", "Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response, isDebugLogEnabled) - - }else{ - String sdncRespCode = execution.getVariable(Prefix + 'sdncRequestDataResponseCode') - utils.log("DEBUG", method + " AllottedResource received error response from SDNC. ResponseCode:" + sdncRespCode, isDebugLogEnabled) - if (sdncRespCode.equals("404") && "deactivate".equals(method)) - { - execution.setVariable("ARNotFoundInSDNC", true) - if ("true".equals(execution.getVariable("failNotFound"))) - { - msg = "Allotted Resource Not found in SDNC" - utils.log("DEBUG", msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - else - { - execution.setVariable("wasDeleted", false) - } - } - else - { - throw new BpmnError("MSOWorkflowException") - } - } - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in validateSDNCResp. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled) - } - - public void deleteAaiAR(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable(DebugFlag) - try{ - utils.log("DEBUG", " *** deleteAaiAR *** ", isDebugLogEnabled) - AllottedResourceUtils arUtils = new AllottedResourceUtils(this) - String ar = null //need to get resource-version again - String arLink = execution.getVariable("aaiARPath") - if (!isBlank(arLink)) - { - ar = arUtils.getARbyLink(execution, arLink, "") - } - arUtils.deleteAR(execution, arLink + '?resource-version=' + UriUtils.encode(execution.getVariable("aaiARResourceVersion"),"UTF-8")) - } catch (BpmnError e) { - throw e; - }catch(Exception ex){ - utils.log("ERROR", "Exception Occurred Processing preProcessSDNCGetRequest. Exception is:\n" + ex, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) - } - utils.log("DEBUG", " *** Exit deleteAaiAR *** ", isDebugLogEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy deleted file mode 100644 index 2c531b4224..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy +++ /dev/null @@ -1,372 +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.bpmn.vcpe.scripts; - -import org.openecomp.mso.bpmn.common.scripts.*; -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.rest.APIResponse - -import java.util.UUID; -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.springframework.web.util.UriUtils; -import static org.apache.commons.lang3.StringUtils.* - -/** - * This groovy class supports the DoDeleteAllottedResourceTXC.bpmn process. - * - * @author - * - * Inputs: - * @param - msoRequestId - * @param - isDebugLogEnabled - * @param - disableRollback - O ignored - * @param - failNotfound - O - * @param - serviceInstanceId - * @param - globalCustomerId - O - * @param - subscriptionServiceType - O - * @param - parentServiceInstanceId - * @param - allottedResourceId - * - * Outputs: - * @param - rollbackData - N/A - * @param - rolledBack - true if no deletions performed - * @param - WorkflowException - O - * @param - wasDeleted - O (ie not silentSuccess) - * - */ -public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ - - private static final String DebugFlag = "isDebugLogEnabled" - - String Prefix="DDARTXC_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - public void preProcessRequest (DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) - - try { - execution.setVariable("prefix", Prefix) - - //Config Inputs - String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (isBlank(sdncCallbackUrl)) { - msg = "URN_mso_workflow_sdncadapter_callback is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) - - //Request Inputs - if (isBlank(execution.getVariable("serviceInstanceId"))){ - msg = "Input serviceInstanceId is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - if (isBlank(execution.getVariable("allottedResourceId"))){ - msg = "Input allottedResourceId is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void getAaiAR (DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** getAaiAR ***** ", isDebugEnabled) - - String allottedResourceId = execution.getVariable("allottedResourceId") - - AllottedResourceUtils arUtils = new AllottedResourceUtils(this) - String ar = arUtils.getARbyId(execution, allottedResourceId) - - String errorMsg = "" - if (isBlank(ar)) // AR was !found - { - errorMsg = "Allotted resource not found in AAI with AllottedResourceId:" + allottedResourceId - } - else - { - String aaiARPath = execution.getVariable("aaiARPath") - String parentServiceInstanceId = arUtils.getPSIFmARLink(execution, aaiARPath) - execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) - } - if (!isBlank(errorMsg)) { - utils.log("DEBUG", errorMsg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) - } - utils.log("DEBUG"," ***** getAaiAR *****", isDebugEnabled) - - } - - // aaiARPath set during query (existing AR) - public void updateAaiAROrchStatus(DelegateExecution execution, String status){ - def isDebugEnabled = execution.getVariable(DebugFlag) - utils.log("DEBUG", " *** updateAaiAROrchStatus *** ", isDebugEnabled) - AllottedResourceUtils arUtils = new AllottedResourceUtils(this) - String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) - String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", isDebugEnabled) - } - - public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** buildSDNCRequest *****", isDebugEnabled) - String sdncReq = null - - try { - - String allottedResourceId = execution.getVariable("allottedResourceId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") - String globalCustomerId = execution.getVariable("globalCustomerId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - - String callbackUrl = execution.getVariable("sdncCallbackUrl") - String requestId = execution.getVariable("msoRequestId") - - String serviceChainServiceInstanceId = "" - String sourceNetworkId = "" - String sourceNetworkRole = "" - String allottedResourceRole = "" - - String arModelInfo = "" - String modelInvariantId = "" - String modelVersion = "" - String modelUUId = "" - String modelCustomizationId = "" - String modelName = "" - - - sdncReq = - """ - - ${sdncRequestId} - ${serviceInstanceId} - ${action} - tunnelxconn-topology-operation - ${callbackUrl} - - - - ${requestId} - DeleteTunnelXConnInstance - MSO - - - - - - - ${subscriptionServiceType} - - ${serviceInstanceId} - - ${globalCustomerId} - - - ${allottedResourceId} - tunnelxconn - ${parentServiceInstanceId} - - ${modelInvariantId} - ${modelUUId} - ${modelCustomizationId} - ${modelVersion} - ${modelName} - - - - - - """ - - utils.log("DEBUG","sdncRequest:\n" + sdncReq, isDebugEnabled) - sdncReq = utils.formatXml(sdncReq) - - } catch(Exception ex) { - msg = "Exception in buildSDNCRequest. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit buildSDNCRequest *****", isDebugEnabled) - return sdncReq - } - - public void preProcessSDNCUnassign(DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessSDNCUnassign *****", isDebugEnabled) - - try { - String sdncRequestId = UUID.randomUUID().toString() - String sdncUnassignReq = buildSDNCRequest(execution, "unassign", sdncRequestId) - execution.setVariable("sdncUnassignRequest", sdncUnassignReq) - utils.logAudit("sdncUnassignRequest: " + sdncUnassignReq) - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in preProcessSDNCUnassign. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit preProcessSDNCUnassign *****", isDebugEnabled) - } - - public void preProcessSDNCDelete(DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessSDNCDelete *****", isDebugEnabled) - - try { - String sdncRequestId = UUID.randomUUID().toString() - String sdncDeleteReq = buildSDNCRequest(execution, "delete", sdncRequestId) - execution.setVariable("sdncDeleteRequest", sdncDeleteReq) - utils.logAudit("sdncDeleteReq: " + sdncDeleteReq) - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit preProcessSDNCDelete *****", isDebugEnabled) - } - - public void preProcessSDNCDeactivate(DelegateExecution execution) { - - def isDebugEnabled = execution.getVariable(DebugFlag) - String msg = "" - utils.log("DEBUG"," ***** preProcessSDNCDeactivate *****", isDebugEnabled) - - try { - String sdncRequestId = UUID.randomUUID().toString() - String sdncDeactivateReq = buildSDNCRequest(execution, "deactivate", sdncRequestId) - execution.setVariable("sdncDeactivateRequest", sdncDeactivateReq) - utils.logAudit("sdncDeactivateReq: " + sdncDeactivateReq) - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in preProcessSDNCDeactivate. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," *****Exit preProcessSDNCDeactivate *****", isDebugEnabled) - } - - public void validateSDNCResp(DelegateExecution execution, String response, String method){ - - def isDebugLogEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled) - String msg = "" - - try { - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - utils.logAudit("SDNCResponse: " + response) - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - utils.log("DEBUG", "Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response, isDebugLogEnabled) - - }else{ - String sdncRespCode = execution.getVariable(Prefix + 'sdncRequestDataResponseCode') - utils.log("DEBUG", method + " AllottedResource received error response from SDNC. ResponseCode:" + sdncRespCode, isDebugLogEnabled) - if (sdncRespCode.equals("404") && "deactivate".equals(method)) - { - execution.setVariable("ARNotFoundInSDNC", true) - if ("true".equals(execution.getVariable("failNotFound"))) - { - msg = "Allotted Resource Not found in SDNC" - utils.log("DEBUG", msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - else - { - execution.setVariable("wasDeleted", false) - } - } - else - { - throw new BpmnError("MSOWorkflowException") - } - } - } catch (BpmnError e) { - throw e; - } catch(Exception ex) { - msg = "Exception in validateSDNCResp. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled) - } - - public void deleteAaiAR(DelegateExecution execution){ - def isDebugLogEnabled = execution.getVariable(DebugFlag) - try{ - utils.log("DEBUG", " *** deleteAaiAR *** ", isDebugLogEnabled) - AllottedResourceUtils arUtils = new AllottedResourceUtils(this) - String ar = null //need to get resource-version again - String arLink = execution.getVariable("aaiARPath") - if (!isBlank(arLink)) - { - ar = arUtils.getARbyLink(execution, arLink, "") - } - arUtils.deleteAR(execution, arLink + '?resource-version=' + UriUtils.encode(execution.getVariable("aaiARResourceVersion"),"UTF-8")) - } catch (BpmnError e) { - throw e; - }catch(Exception ex){ - utils.log("ERROR", "Exception Occurred Processing preProcessSDNCGetRequest. Exception is:\n" + ex, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) - } - utils.log("DEBUG", " *** Exit deleteAaiAR *** ", isDebugLogEnabled) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntity.java deleted file mode 100644 index 8ba4589ebc..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntity.java +++ /dev/null @@ -1,50 +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.bpmn.infrastructure.AAITasks; - -import java.util.logging.Logger; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.client.orchestration.AAIOrchestrator; - -public class AAICreateOwningEntity implements JavaDelegate { - private static Logger LOGGER = Logger.getLogger("AAICreateOwningEntity"); - AAIOrchestrator aaiO = new AAIOrchestrator(); - ExceptionUtil exceptionUtil = new ExceptionUtil(); - - public void execute(DelegateExecution execution) throws Exception { - LOGGER.info("**** Started AAICreateOwningEntity ****"); - ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition"); - if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getOwningEntity() != null) { - try { - aaiO.createOwningEntityandConnectServiceInstance(serviceDecomp); - } catch (Exception ex) { - String msg = "Exception in AAICreateOwningEntity. " + ex.getMessage(); - LOGGER.info(msg); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); - } - } - LOGGER.info("**** Finished AAICreateOwningEntity ****"); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateProject.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateProject.java deleted file mode 100644 index fe7006f530..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateProject.java +++ /dev/null @@ -1,50 +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.bpmn.infrastructure.AAITasks; - -import java.util.logging.Logger; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.client.orchestration.AAIOrchestrator; - -public class AAICreateProject implements JavaDelegate { - private static Logger LOGGER = Logger.getLogger("AAICreateProject"); - AAIOrchestrator aaiO = new AAIOrchestrator(); - ExceptionUtil exceptionUtil = new ExceptionUtil(); - - public void execute(DelegateExecution execution) throws Exception { - LOGGER.info("**** Started AAICreateProject ****"); - ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition"); - if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getProject() != null) { - try { - aaiO.createProjectandConnectServiceInstance(serviceDecomp); - } catch (Exception ex) { - String msg = "Exception in AAICreateProject. " + ex.getMessage(); - LOGGER.info(msg); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); - } - } - LOGGER.info("**** Finished AAICreateProject ****"); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateServiceInstance.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateServiceInstance.java deleted file mode 100644 index b76675d0fc..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateServiceInstance.java +++ /dev/null @@ -1,50 +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.bpmn.infrastructure.AAITasks; - -import java.util.logging.Logger; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.client.orchestration.AAIOrchestrator; - -public class AAICreateServiceInstance implements JavaDelegate { - private static Logger LOGGER = Logger.getLogger("AAICreateServiceInstance"); - AAIOrchestrator aaiO = new AAIOrchestrator(); - ExceptionUtil exceptionUtil = new ExceptionUtil(); - - public void execute(DelegateExecution execution) throws Exception { - LOGGER.info("**** Started AAICreateServiceInstance ****"); - ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition"); - execution.setVariable("aaiServiceInstanceRollback", false); - try { - aaiO.createServiceInstance(serviceDecomp); - } catch (Exception ex) { - String msg = "Exception in AAICreateServiceInstance. " + ex.getMessage(); - LOGGER.info(msg); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); - } - execution.setVariable("aaiServiceInstanceRollback", true); - LOGGER.info("**** Finished AAICreateServiceInstance ****"); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackAAIServiceInstance.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackAAIServiceInstance.java deleted file mode 100644 index 496ad6a1ff..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackAAIServiceInstance.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.bpmn.infrastructure.DoCreateServiceInstance; - -import java.util.logging.Logger; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.client.orchestration.AAIOrchestrator; - -public class RollbackAAIServiceInstance implements JavaDelegate { - private static Logger LOGGER = Logger.getLogger("RollbackAAIServiceInstance"); - ExceptionUtil exceptionUtil = new ExceptionUtil(); - - public void execute(DelegateExecution execution) throws Exception { - boolean aaiServiceInstanceRollback = (boolean) execution.getVariable("aaiServiceInstanceRollback"); - if (aaiServiceInstanceRollback) { - LOGGER.info("**** Starting RollbackAAIServiceInstance ****"); - try { - ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("ServiceDecomposition"); - AAIOrchestrator aaiO = new AAIOrchestrator(); - aaiO.deleteServiceInstance(serviceDecomp); - } catch (Exception ex) { - String msg = "Error Response from AAI for aaiServiceInstanceRollback"; - execution.setVariable("rollbackError", msg); - LOGGER.info(msg); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); - } - LOGGER.info("**** Finished RollbackAAIServiceInstance ****"); - } else { - LOGGER.info("**** Skipping RollbackAAIServiceInstance ****"); - } - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackError.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackError.java deleted file mode 100644 index 68ea713963..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackError.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.bpmn.infrastructure.DoCreateServiceInstance; - -import java.util.logging.Logger; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.JavaDelegate; - -public class RollbackError implements JavaDelegate { - - private static Logger LOGGER = Logger.getLogger("RollbackError"); - - @Override - public void execute(DelegateExecution execution) throws Exception { - LOGGER.info("Caught an Exception in DoCreateServiceInstanceRollbackV3"); - LOGGER.info("Unable to rollback DoCreateServiceInstanceV3"); - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/SetupServiceDecomp.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/SetupServiceDecomp.java deleted file mode 100644 index 4edb4058e8..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/SetupServiceDecomp.java +++ /dev/null @@ -1,112 +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.bpmn.infrastructure.DoCreateServiceInstance; - -import java.util.logging.Logger; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.json.JSONObject; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.bpmn.core.domain.Customer; -import org.openecomp.mso.bpmn.core.domain.ModelInfo; -import org.openecomp.mso.bpmn.core.domain.OwningEntity; -import org.openecomp.mso.bpmn.core.domain.Project; -import org.openecomp.mso.bpmn.core.domain.Request; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.bpmn.core.domain.ServiceInstance; - -public class SetupServiceDecomp implements JavaDelegate { - - ExceptionUtil exceptionUtil = new ExceptionUtil(); - private static Logger LOGGER = Logger.getLogger("SetupServiceDecomp"); - - public void execute(DelegateExecution execution) throws Exception { - LOGGER.info("Starting SetupServiceDecomp"); - try { - String json = (String) execution.getVariable("bpmnRequest"); - JSONObject jsonObj = new JSONObject(json); - JSONObject jsonReq = jsonObj.getJSONObject("requestDetails"); - JSONObject jsonServ = jsonReq.getJSONObject("serviceInstance"); - String serviceInstanceId = jsonServ.getString("serviceInstanceId"); - System.out.println("servInstId: "+serviceInstanceId); - String serviceInstanceName = jsonServ.getString("serviceInstanceName"); - String serviceType = jsonServ.getString("serviceType"); - String serviceRole = jsonServ.getString("serviceRole"); - String modelInvariantUuid = jsonServ.getString("modelInvariantUuid"); - String modelUuid = jsonServ.getString("modelUuid"); - String modelVersion = jsonServ.getString("modelVersion"); - String modelName = jsonServ.getString("modelName"); - String environmentContext = jsonServ.getString("environmentContext"); - String workloadContext = jsonServ.getString("workloadContext"); - JSONObject jsonProject = jsonReq.getJSONObject("project"); - String projectName = jsonProject.getString("projectName"); - JSONObject jsonOwningEntity = jsonReq.getJSONObject("owningEntity"); - String owningEntityId = jsonOwningEntity.getString("owningEntityId"); - String owningEntityName = jsonOwningEntity.getString("owningEntityName"); - JSONObject jsonCustomer = jsonReq.getJSONObject("customer"); - String subscriptionServiceType = jsonCustomer.getString("subscriptionServiceType"); - String globalSubscriberId = jsonCustomer.getString("globalSubscriberId"); - JSONObject jsonRequest = jsonReq.getJSONObject("request"); - String sdncRequestId = jsonRequest.getString("sdncRequestId"); - String callbackURL = jsonRequest.getString("callbackURL"); - String requestId = jsonRequest.getString("requestId"); - String productFamilyId = jsonRequest.getString("productFamilyId"); - ServiceDecomposition serviceDecomp = new ServiceDecomposition("{}"); - serviceDecomp.setCallbackURN(callbackURL); - serviceDecomp.setServiceRole(serviceRole); - ModelInfo modelInfo = new ModelInfo(); - modelInfo.setModelInvariantUuid(modelInvariantUuid); - modelInfo.setModelName(modelName); - modelInfo.setModelVersion(modelVersion); - modelInfo.setModelUuid(modelUuid); - ServiceInstance serviceInstance = new ServiceInstance(); - serviceInstance.setInstanceId(serviceInstanceId); - serviceInstance.setInstanceName(serviceInstanceName); - serviceInstance.setServiceType(serviceType); - serviceInstance.setModelInfo(modelInfo); - serviceInstance.setEnvironmentContext(environmentContext); - serviceInstance.setWorkloadContext(workloadContext); - Project project = new Project(); - project.setProjectName(projectName); - OwningEntity owningEntity = new OwningEntity(); - owningEntity.setOwningEntityId(owningEntityId); - owningEntity.setOwningEntityName(owningEntityName); - Customer customer = new Customer(); - customer.setGlobalSubscriberId(globalSubscriberId); - customer.setSubscriptionServiceType(subscriptionServiceType); - Request request = new Request(); - request.setRequestId(requestId); - request.setSdncRequestId(sdncRequestId); - request.setProductFamilyId(productFamilyId); - serviceDecomp.setCustomer(customer); - serviceDecomp.setServiceInstance(serviceInstance); - serviceDecomp.setRequest(request); - serviceDecomp.setProject(project); - serviceDecomp.setOwningEntity(owningEntity); - execution.setVariable("ServiceDecomposition", serviceDecomp); - } catch (Exception ex) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "ERROR IN SET UP SERVICE DECOMP"); - } - LOGGER.info("Finished SetupServiceDecomp"); - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.java deleted file mode 100644 index c7420c3a03..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.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.bpmn.infrastructure; - -import java.util.List; - -import org.camunda.bpm.application.PostDeploy; -import org.camunda.bpm.application.PreUndeploy; -import org.camunda.bpm.application.ProcessApplication; -import org.camunda.bpm.application.ProcessApplicationInfo; -import org.camunda.bpm.application.impl.ServletProcessApplication; -import org.camunda.bpm.engine.ProcessEngine; - -import org.openecomp.mso.logger.MsoLogger; - -/** - * @since Version 1.0 - * - */ -@ProcessApplication("MSO Infrastructure Application") -public class MSOInfrastructureApplication extends ServletProcessApplication { - - private MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - @PostDeploy - public void postDeploy(ProcessEngine processEngineInstance) { - long startTime = System.currentTimeMillis(); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Post deployment complete..."); - } - - @PreUndeploy - public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo, List processEngines) { - long startTime = System.currentTimeMillis(); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Pre Undeploy complete..."); - - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/SDNCTasks/SDNCCreateServiceInstance.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/SDNCTasks/SDNCCreateServiceInstance.java deleted file mode 100644 index 549ae36612..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/SDNCTasks/SDNCCreateServiceInstance.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.bpmn.infrastructure.SDNCTasks; - -import java.util.logging.Logger; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.client.orchestration.SDNCOrchestrator; - -public class SDNCCreateServiceInstance implements JavaDelegate { - private static Logger LOGGER = Logger.getLogger("SDNCCreateServiceInstance"); - SDNCOrchestrator sdncO = new SDNCOrchestrator(); - ExceptionUtil exceptionUtil = new ExceptionUtil(); - - public void execute(DelegateExecution execution) throws Exception { - LOGGER.info("**** Started SDNCCreateServiceInstance ****"); - ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition"); - if (serviceDecomp != null) { - try { - sdncO.createServiceInstance(serviceDecomp); - } catch (Exception ex) { - String msg = "Exception in sdncCreateServiceInstance. " + ex.getMessage(); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); - } - } - LOGGER.info("**** Finished SDNCCreateServiceInstance ****"); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAICreateResources.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAICreateResources.java deleted file mode 100644 index 3d05f76b03..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAICreateResources.java +++ /dev/null @@ -1,98 +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.bpmn.infrastructure.aai; - -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; - -import org.onap.aai.domain.yang.v12.GenericVnf; -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; - -public class AAICreateResources { - - - public void createAAIProject (String projectName, String serviceInstance){ - AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - aaiRC.createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI); - - } - - public void createAAIOwningEntity(String owningEntityId, String owningEntityName,String serviceInstance){ - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); - Map hashMap= new HashMap<>(); - hashMap.put("owning-entity-name", owningEntityName); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - aaiRC.createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI, serviceInstanceURI); - } - - public boolean existsOwningEntity(String owningEntityId){ - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - return aaiRC.exists(owningEntityURI); - } - - public void connectOwningEntityandServiceInstance (String owningEntityId, String serviceInstance){ - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - aaiRC.connect(owningEntityURI, serviceInstanceURI); - } - - public void createAAIPlatform(String platformName,String vnfId){ - AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName); - AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - aaiRC.createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI); - } - - public void createAAILineOfBusiness(String lineOfBusiness,String vnfId){ - AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness); - AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - aaiRC.createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI); - } - public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId){ - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId,serviceType,serviceInstanceId); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - aaiRC.createIfNotExists(serviceInstanceURI, Optional.empty()); - } - - public Optional getVnfInstance(String vnfId){ - try{ - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - AAIResultWrapper aaiResponse = aaiRC.get(vnfURI); - Optional vnf = aaiResponse.asBean(GenericVnf.class); - return vnf; - } catch (Exception ex){ - return Optional.empty(); - } - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java deleted file mode 100644 index 483c057f3e..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIDeleteServiceInstance.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.bpmn.infrastructure.aai; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.client.aai.AAIObjectType; -import org.openecomp.mso.client.aai.AAIResourcesClient; -import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri; -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; - -public class AAIDeleteServiceInstance implements JavaDelegate{ - - ExceptionUtil exceptionUtil = new ExceptionUtil(); - public void execute(DelegateExecution execution) throws Exception { - try{ - String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - serviceInstanceId); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - aaiRC.delete(serviceInstanceURI); - execution.setVariable("GENDS_SuccessIndicator",true); - } catch(Exception ex){ - String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI." + ex.getMessage(); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); - } - - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstance.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstance.java deleted file mode 100644 index 7370208f5e..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstance.java +++ /dev/null @@ -1,94 +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.bpmn.infrastructure.aai; - -public class AAIServiceInstance { - String serviceInstanceName; - String serviceType; - String serviceRole; - String orchestrationStatus; - String modelInvariantUuid; - String modelVersionId; - String environmentContext; - String workloadContext; - public AAIServiceInstance(String serviceInstanceName, String serviceType, String serviceRole, - String orchestrationStatus, String modelInvariantUuid, String modelVersionId, String environmentContext, - String workloadContext) { - this.serviceInstanceName = serviceInstanceName; - this.serviceType = serviceType; - this.serviceRole = serviceRole; - this.orchestrationStatus = orchestrationStatus; - this.modelInvariantUuid = modelInvariantUuid; - this.modelVersionId = modelVersionId; - this.environmentContext = environmentContext; - this.workloadContext = workloadContext; - } - 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 getServiceRole() { - return serviceRole; - } - public void setServiceRole(String serviceRole) { - this.serviceRole = serviceRole; - } - public String getOrchestrationStatus() { - return orchestrationStatus; - } - public void setOrchestrationStatus(String orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - public String getModelInvariantUuid() { - return modelInvariantUuid; - } - public void setModelInvariantUuid(String modelInvariantUuid) { - this.modelInvariantUuid = modelInvariantUuid; - } - public String getModelVersionId() { - return modelVersionId; - } - public void setModelVersionId(String modelVersionId) { - this.modelVersionId = modelVersionId; - } - public String getEnvironmentContext() { - return environmentContext; - } - public void setEnvironmentContext(String environmentContext) { - this.environmentContext = environmentContext; - } - public String getWorkloadContext() { - return workloadContext; - } - public void setWorkloadContext(String workloadContext) { - this.workloadContext = workloadContext; - } - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java deleted file mode 100644 index 2be5ebdc5d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.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.bpmn.infrastructure.pnf.aai; - -import java.io.IOException; -import java.util.Optional; -import java.util.UUID; -import org.apache.commons.lang.NotImplementedException; -import org.onap.aai.domain.yang.Pnf; -import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiConnection; -import org.openecomp.mso.client.aai.AAIRestClientImpl; -import org.springframework.stereotype.Component; - -public class AaiConnectionImpl implements AaiConnection { - - @Override - public Optional getEntryFor(String correlationId) throws IOException { - AAIRestClientImpl restClient = new AAIRestClientImpl(); - return restClient.getPnfByName(correlationId, UUID.randomUUID().toString()); - } - - @Override - public void createEntry(String correlationId, Pnf entry) throws IOException { - AAIRestClientImpl restClient = new AAIRestClientImpl(); - restClient.createPnf(correlationId, UUID.randomUUID().toString(), entry); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java deleted file mode 100644 index 92169b202b..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.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.bpmn.infrastructure.pnf.delegate; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.openecomp.mso.bpmn.infrastructure.pnf.dmaap.DmaapClient; -import org.springframework.beans.factory.annotation.Autowired; - -public class CancelDmaapSubscription implements JavaDelegate { - - private DmaapClient dmaapClient; - - @Override - public void execute(DelegateExecution execution) throws Exception { - String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID); - dmaapClient.unregister(correlationId); - } - - @Autowired - public void setDmaapClient(DmaapClient dmaapClient) { - this.dmaapClient = dmaapClient; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java deleted file mode 100644 index 0e65dd7441..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.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.bpmn.infrastructure.pnf.delegate; - -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_IP; -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF; -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; - -import java.io.IOException; -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiConnection; -import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiResponse; -import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.CheckAaiForCorrelationIdImplementation; -import org.openecomp.mso.logger.MsoLogger; -import org.springframework.beans.factory.annotation.Autowired; - -/** - * Implementation of "Check AAI for correlation_id" task in CreateAndActivatePnfResource.bpmn - * - * Inputs: - * - correlationId - String - * - * Outputs: - * - AAI_CONTAINS_INFO_ABOUT_PNF - local Boolean - * - aaiContainsInfoAboutIp - local Boolean - */ - -public class CheckAaiForCorrelationIdDelegate implements JavaDelegate { - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); - private CheckAaiForCorrelationIdImplementation implementation = new CheckAaiForCorrelationIdImplementation(); - private AaiConnection aaiConnection; - - @Autowired - public void setAaiConnection(AaiConnection aaiConnection) { - this.aaiConnection = aaiConnection; - } - - @Override - public void execute(DelegateExecution execution) throws Exception { - String correlationId = (String) execution.getVariable(CORRELATION_ID); - if (correlationId == null) { - new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, CORRELATION_ID + " is not set"); - } - - try { - AaiResponse aaiResponse = implementation.check(correlationId, aaiConnection); - - execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, aaiResponse.getContainsInfoAboutPnf()); - execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, aaiResponse.getContainsInfoAboutIp()); - } catch (IOException e) { - LOGGER.error("IOException",e); - new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, e.getMessage()); - } - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java deleted file mode 100644 index 62b806eae8..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.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.bpmn.infrastructure.pnf.delegate; - -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.onap.aai.domain.yang.Pnf; -import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiConnection; -import org.springframework.beans.factory.annotation.Autowired; - -/** - * Implementation of "Create AAI entry with pnf-id = correlation_id" task in CreateAndActivatePnfResource.bpmn - * - * Inputs: - * - correlationId - String - */ -public class CreateAaiEntryWithPnfIdDelegate implements JavaDelegate { - - private AaiConnection aaiConnection; - - @Autowired - public void setAaiConnection(AaiConnection aaiConnection) { - this.aaiConnection = aaiConnection; - } - - @Override - public void execute(DelegateExecution execution) throws Exception { - String correlationId = (String) execution.getVariable(CORRELATION_ID); - Pnf pnf = new Pnf(); - pnf.setInMaint(true); - pnf.setPnfId(correlationId); - pnf.setPnfName(correlationId); - aaiConnection.createEntry(correlationId, pnf); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java deleted file mode 100644 index 361313e932..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java +++ /dev/null @@ -1,33 +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.bpmn.infrastructure.pnf.delegate; - -@SuppressWarnings("ALL") -public class ExecutionVariableNames { - - private ExecutionVariableNames() {} - - public final static String CORRELATION_ID = "correlationId"; - public final static String AAI_CONTAINS_INFO_ABOUT_PNF = "aaiContainsInfoAboutPnf"; - public final static String AAI_CONTAINS_INFO_ABOUT_IP = "aaiContainsInfoAboutIp"; - public final static String DMAAP_MESSAGE = "dmaapMessage"; - public final static String TIMEOUT_FOR_NOTIFICATION = "timeoutForPnfEntryNotification"; -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java deleted file mode 100644 index edff36fe68..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.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.bpmn.infrastructure.pnf.delegate; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.openecomp.mso.bpmn.infrastructure.pnf.dmaap.DmaapClient; -import org.springframework.beans.factory.annotation.Autowired; - -public class InformDmaapClient implements JavaDelegate { - - private DmaapClient dmaapClient; - - @Override - public void execute(DelegateExecution execution) throws Exception { - String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID); - dmaapClient.registerForUpdate(correlationId, () -> execution.getProcessEngineServices().getRuntimeService() - .createMessageCorrelation("WorkflowMessage") - .processInstanceBusinessKey(execution.getProcessBusinessKey()) - .correlateWithResult()); - } - - @Autowired - public void setDmaapClient(DmaapClient dmaapClient) { - this.dmaapClient = dmaapClient; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java deleted file mode 100644 index 268113d28f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.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.bpmn.infrastructure.pnf.delegate; - -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.logger.MsoLogger; - -public class PnfCheckInputs implements JavaDelegate { - - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); - - private String defaultTimeout; - - @Override - public void execute(DelegateExecution execution) throws Exception { - String correlationId = (String) execution.getVariable(CORRELATION_ID); - if (correlationId == null) { - new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "correlationId variable not defined"); - } - String timeout = (String) execution.getVariable(TIMEOUT_FOR_NOTIFICATION); - if (timeout == null) { - LOGGER.debug("timeoutForPnfEntryNotification variable not found, setting default"); - if (defaultTimeout == null) { - new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, - "default timeoutForPnfEntryNotification value not defined"); - } - execution.setVariable(TIMEOUT_FOR_NOTIFICATION, defaultTimeout); - } - } - - public void setDefaultTimeout(String defaultTimeout) { - this.defaultTimeout = defaultTimeout; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/DmaapClient.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/DmaapClient.java deleted file mode 100644 index 12a6c7c51f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/DmaapClient.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.bpmn.infrastructure.pnf.dmaap; - -public interface DmaapClient { - - void registerForUpdate(String correlationId, Runnable informConsumer); - - Runnable unregister(String correlationId); -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java deleted file mode 100644 index 2853899ae2..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.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.bpmn.infrastructure.pnf.dmaap; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.Spliterator; - -final class JsonUtilForCorrelationId { - - private static final String JSON_HEADER = "pnfRegistrationFields"; - private static final String JSON_CORRELATION_ID_FIELD_NAME = "correlationId"; - - static List parseJsonToGelAllCorrelationId(String json) { - List list = new ArrayList<>(); - JsonElement je = new JsonParser().parse(json); - if (je.isJsonObject()) { - getCorrelationIdFromJsonObject(je.getAsJsonObject()).ifPresent(corr -> list.add(corr)); - } else { - JsonArray array = je.getAsJsonArray(); - Spliterator spliterator = array.spliterator(); - spliterator.forEachRemaining(jsonElement -> { - parseJsonElementToJsonObject(jsonElement) - .ifPresent(jsonObject -> getCorrelationIdFromJsonObject(jsonObject) - .ifPresent(correlationId -> list.add(correlationId))); - }); - } - return list; - } - - private static Optional parseJsonElementToJsonObject(JsonElement jsonElement) { - if (jsonElement.isJsonObject()) { - return Optional.ofNullable(jsonElement.getAsJsonObject()); - } - return Optional.ofNullable(new JsonParser().parse(jsonElement.getAsString()).getAsJsonObject()); - } - - private static Optional getCorrelationIdFromJsonObject(JsonObject jsonObject) { - if (jsonObject.has(JSON_HEADER)) { - JsonObject jo = jsonObject.getAsJsonObject(JSON_HEADER); - if (jo.has(JSON_CORRELATION_ID_FIELD_NAME)) { - return Optional.ofNullable(jo.get(JSON_CORRELATION_ID_FIELD_NAME).getAsString()); - } - } - return Optional.empty(); - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java deleted file mode 100644 index 2b3a60fa20..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java +++ /dev/null @@ -1,170 +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.bpmn.infrastructure.pnf.dmaap; - -import java.io.IOException; -import java.net.URI; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import javax.ws.rs.core.UriBuilder; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.util.EntityUtils; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MsoLogger.Catalog; - -public class PnfEventReadyDmaapClient implements DmaapClient { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(Catalog.GENERAL); - - private HttpClient httpClient; - private String dmaapHost; - private int dmaapPort; - private String dmaapProtocol; - private String dmaapUriPathPrefix; - private String dmaapTopicName; - private String consumerId; - private String consumerGroup; - private Map pnfCorrelationIdToThreadMap; - private HttpGet getRequest; - private ScheduledExecutorService executor; - private int dmaapClientDelayInSeconds; - private volatile boolean dmaapThreadListenerIsRunning; - - public void init() { - httpClient = HttpClientBuilder.create().build(); - pnfCorrelationIdToThreadMap = new ConcurrentHashMap<>(); - dmaapHost = PropertyConfiguration.getInstance().getProperties(PropertyConfiguration.MSO_BPMN_URN_PROPERTIES) - .get("mso.dmaap.host"); - dmaapPort = Integer.parseInt(PropertyConfiguration.getInstance() - .getProperties(PropertyConfiguration.MSO_BPMN_URN_PROPERTIES).get("mso.dmaap.port")); - executor = null; - getRequest = new HttpGet(buildURI()); - } - - @Override - public synchronized void registerForUpdate(String correlationId, Runnable informConsumer) { - LOGGER.debug("registering for pnf ready dmaap event for correlation id: " + correlationId); - pnfCorrelationIdToThreadMap.put(correlationId, informConsumer); - if (!dmaapThreadListenerIsRunning) { - startDmaapThreadListener(); - } - } - - @Override - public synchronized Runnable unregister(String correlationId) { - LOGGER.debug("unregistering from pnf ready dmaap event for correlation id: " + correlationId); - Runnable runnable = pnfCorrelationIdToThreadMap.remove(correlationId); - if (pnfCorrelationIdToThreadMap.isEmpty()) { - stopDmaapThreadListener(); - } - return runnable; - } - - private synchronized void startDmaapThreadListener() { - if (!dmaapThreadListenerIsRunning) { - executor = Executors.newScheduledThreadPool(1); - executor.scheduleWithFixedDelay(new DmaapTopicListenerThread(), 0, - dmaapClientDelayInSeconds, TimeUnit.SECONDS); - dmaapThreadListenerIsRunning = true; - } - } - - private synchronized void stopDmaapThreadListener() { - if (dmaapThreadListenerIsRunning) { - executor.shutdownNow(); - dmaapThreadListenerIsRunning = false; - executor = null; - } - } - - private URI buildURI() { - return UriBuilder.fromUri(dmaapUriPathPrefix) - .scheme(dmaapProtocol) - .host(dmaapHost) - .port(dmaapPort).path(dmaapTopicName) - .path(consumerGroup).path(consumerId).build(); - } - - public void setDmaapProtocol(String dmaapProtocol) { - this.dmaapProtocol = dmaapProtocol; - } - - public void setDmaapUriPathPrefix(String dmaapUriPathPrefix) { - this.dmaapUriPathPrefix = dmaapUriPathPrefix; - } - - public void setDmaapTopicName(String dmaapTopicName) { - this.dmaapTopicName = dmaapTopicName; - } - - public void setConsumerId(String consumerId) { - this.consumerId = consumerId; - } - - public void setConsumerGroup(String consumerGroup) { - this.consumerGroup = consumerGroup; - } - - public void setDmaapClientDelayInSeconds(int dmaapClientDelayInSeconds) { - this.dmaapClientDelayInSeconds = dmaapClientDelayInSeconds; - } - - class DmaapTopicListenerThread implements Runnable { - - @Override - public void run() { - try { - HttpResponse response = httpClient.execute(getRequest); - getCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfCorrelationIdFound); - } catch (IOException e) { - LOGGER.error("Exception caught during sending rest request to dmaap for listening event topic", e); - } - } - - private List getCorrelationIdListFromResponse(HttpResponse response) throws IOException { - if (response.getStatusLine().getStatusCode() == 200) { - String responseString = EntityUtils.toString(response.getEntity(), "UTF-8"); - if (responseString != null) { - return JsonUtilForCorrelationId.parseJsonToGelAllCorrelationId(responseString); - } - } - return Collections.emptyList(); - } - - private synchronized void informAboutPnfReadyIfCorrelationIdFound(String correlationId) { - Runnable runnable = unregister(correlationId); - if (runnable != null) { - LOGGER.debug("pnf ready event got from dmaap for correlationId: " + correlationId); - runnable.run(); - } - } - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiConnection.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiConnection.java deleted file mode 100644 index 0bb63d5e68..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiConnection.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.bpmn.infrastructure.pnf.implementation; - -import java.io.IOException; -import java.util.Optional; -import org.onap.aai.domain.yang.Pnf; - -public interface AaiConnection { - - Optional getEntryFor(String correlationId) throws IOException; - - void createEntry(String correlationId, Pnf entry) throws IOException; -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java deleted file mode 100644 index 5fb7a43e00..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.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.bpmn.infrastructure.pnf.implementation; - -import java.util.Optional; -import javax.annotation.Nullable; -import javax.validation.constraints.NotNull; - -public enum AaiResponse { - NO_ENTRY(false, false), - ENTRY_NO_IP(true, false), - ENTRY_WITH_IP(true, true); - - private boolean containsInfoAboutPnf; - private boolean containsInfoAboutIp; - - AaiResponse(boolean containsInfoAboutPnf, boolean containsInfoAboutIp) { - this.containsInfoAboutPnf = containsInfoAboutPnf; - this.containsInfoAboutIp = containsInfoAboutIp; - } - - public boolean getContainsInfoAboutPnf() { - return containsInfoAboutPnf; - } - - public boolean getContainsInfoAboutIp() { - return containsInfoAboutIp; - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java deleted file mode 100644 index b982a693da..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java +++ /dev/null @@ -1,50 +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.bpmn.infrastructure.pnf.implementation; - -import java.io.IOException; -import java.util.Optional; -import org.onap.aai.domain.yang.Pnf; - -public class CheckAaiForCorrelationIdImplementation { - - public AaiResponse check(String correlationId, AaiConnection aaiConnection) throws IOException { - Optional pnf = aaiConnection.getEntryFor(correlationId); - if (!pnf.isPresent()) { - return AaiResponse.NO_ENTRY; - } - - if(extractIp(pnf.get()).isPresent()) { - return AaiResponse.ENTRY_WITH_IP; - } else { - return AaiResponse.ENTRY_NO_IP; - } - } - - private Optional extractIp(Pnf pnf) { - if (pnf.getIpaddressV4Oam() != null) { - return Optional.of(pnf.getIpaddressV4Oam()); - } else { - return Optional.ofNullable(pnf.getIpaddressV6Oam()); - } - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java deleted file mode 100644 index 64d8530df1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java +++ /dev/null @@ -1,57 +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.bpmn.infrastructure.properties; - -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -import java.util.Arrays; -import java.util.List; - -public class BPMNProperties { - - public static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - public static String getProperty(String key, String defaultValue) { - String value; - try { - value = new MsoPropertiesFactory().getMsoJavaProperties(MSO_PROP_APIHANDLER_INFRA).getProperty(key, defaultValue); - } catch (MsoPropertiesException e) { - msoLogger.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: " - + MSO_PROP_APIHANDLER_INFRA, "BPMN", "", MsoLogger.ErrorCode.DataError, - "Exception - Mso Properties ID not found in cache", e); - return null; - } - msoLogger.debug("Config read for " + MSO_PROP_APIHANDLER_INFRA + " - key:" + key + " value:" + value); - return value; - } - - public static List getResourceSequenceProp(String input) { - String resourceSequence = getProperty("mso.workflow.custom." + input + ".resource.sequence", null); - if (resourceSequence != null) { - return Arrays.asList(resourceSequence.split(",")); - } - return null; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/LocationConstraint.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/LocationConstraint.java deleted file mode 100644 index 4185808b91..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/LocationConstraint.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure.vfcmodel; - - -/** - *
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-9-6 - */ -public class LocationConstraint { - - /** - * vnf profile id - */ - private String vnfProfileId; - - /** - * location constraints: vimId - */ - 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/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java deleted file mode 100644 index 272f3fb71a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java +++ /dev/null @@ -1,118 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure.vfcmodel; - - -import org.openecomp.mso.logger.MsoLogger; - - -/** - * NS Create Input Parameter For VFC Adapter
- *

- *

- * - * @version ONAP Beijing Release 2018/2/5 - */ -public class NSResourceInputParameter { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - private NsOperationKey nsOperationKey; - - private String nsServiceName; - - private String nsServiceDescription; - - private NsParameters nsParameters; - - private NsScaleParameters nsScaleParameters; - - - - - /** - * @return Returns the nsServiceName. - */ - public String getNsServiceName() { - return nsServiceName; - } - - - /** - * @param nsServiceName The nsServiceName to set. - */ - public void setNsServiceName(String nsServiceName) { - this.nsServiceName = nsServiceName; - } - - - /** - * @return Returns the nsServiceDescription. - */ - public String getNsServiceDescription() { - return nsServiceDescription; - } - - - /** - * @param nsServiceDescription The nsServiceDescription to set. - */ - public void setNsServiceDescription(String nsServiceDescription) { - this.nsServiceDescription = nsServiceDescription; - } - - /** - * @return Returns the nsParameters. - */ - public NsParameters getNsParameters() { - return nsParameters; - } - - /** - * @param nsParameters The nsParameters to set. - */ - public void setNsParameters(NsParameters nsParameters) { - this.nsParameters = nsParameters; - } - - public NsOperationKey getNsOperationKey() { - return nsOperationKey; - } - - public void setNsOperationKey(NsOperationKey nsOperationKey) { - this.nsOperationKey = nsOperationKey; - } - - /** - * @return Returns the nsScaleParameters. - */ - public NsScaleParameters getNsScaleParameters() { - return nsScaleParameters; - } - - /** - * @param nsScaleParameters The nsScaleParameters to set. - */ - public void setNsScaleParameters(NsScaleParameters nsScaleParameters) { - this.nsScaleParameters = nsScaleParameters; - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsOperationKey.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsOperationKey.java deleted file mode 100644 index 7783d7ab92..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsOperationKey.java +++ /dev/null @@ -1,141 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure.vfcmodel; - - -/** - * The operation key object for NS - *
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-09-15 - */ -public class NsOperationKey { - - /** - * The subscriber id - */ - private String globalSubscriberId; - - /** - * The serviceType - */ - private String serviceType; - - /** - * The service ID - */ - private String serviceId; - - /** - * The Operation ID - */ - private String operationId; - - /** - * the NS template uuid - */ - private String nodeTemplateUUID; - - /** - * @return Returns the globalSubscriberId. - */ - public String getGlobalSubscriberId() { - return globalSubscriberId; - } - - /** - * @param globalSubscriberId The globalSubscriberId to set. - */ - public void setGlobalSubscriberId(String globalSubscriberId) { - this.globalSubscriberId = globalSubscriberId; - } - - /** - * @return Returns the serviceType. - */ - public String getServiceType() { - return serviceType; - } - - /** - * @param serviceType The serviceType to set. - */ - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - - /** - *
- * - * @return - * @since ONAP Amsterdam Release - */ - public String getServiceId() { - return serviceId; - } - - /** - *
- * - * @param serviceId - * @since ONAP Amsterdam Release - */ - public void setServiceId(String serviceId) { - this.serviceId = serviceId; - } - - /** - *
- * - * @return - * @since ONAP Amsterdam Release - */ - public String getOperationId() { - return operationId; - } - - /** - *
- * - * @param operationId - * @since ONAP Amsterdam Release - */ - public void setOperationId(String operationId) { - this.operationId = operationId; - } - - /** - * @return Returns the nodeTemplateUUID. - */ - public String getNodeTemplateUUID() { - return nodeTemplateUUID; - } - - /** - * @param nodeTemplateUUID The nodeTemplateUUID to set. - */ - public void setNodeTemplateUUID(String nodeTemplateUUID) { - this.nodeTemplateUUID = nodeTemplateUUID; - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsParameters.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsParameters.java deleted file mode 100644 index 9d38feeef9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsParameters.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure.vfcmodel; - - -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/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsScaleParameters.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsScaleParameters.java deleted file mode 100644 index bdc16195b5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsScaleParameters.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure.vfcmodel; - -import java.util.List; - -/** - *
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-9-26 - */ -public class NsScaleParameters { - - private List scaleNsByStepsData; - - private String scaleType; - - - private String nsInstanceId; - - /** - * @return Returns the scaleNsByStepsData. - */ - public List getScaleNsByStepsData() { - return scaleNsByStepsData; - } - - /** - * @param scaleNsByStepsData The scaleNsByStepsData to set. - */ - public void setScaleNsByStepsData(List scaleNsByStepsData) { - this.scaleNsByStepsData = scaleNsByStepsData; - } - - /** - * @return Returns the scale Type. - */ - public String getScaleType() { - return scaleType; - } - - /** - * @param scaleType The scaleType to set. - */ - public void setScaleType(String scaleType) { - this.scaleType = scaleType; - } - - public String getNsInstanceId() { - return nsInstanceId; - } - - public void setNsInstanceId(String nsInstanceId) { - this.nsInstanceId = nsInstanceId; - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java deleted file mode 100644 index a0798c8e4f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure.vfcmodel; - - - -/** - *
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-9-26 - */ -public class ScaleNsByStepsData { - - /** - * scaling Direction - */ - private String scalingDirection; - - /** - * aspect ID - */ - private String aspectId; - - /** - * number of Steps - */ - private int numberOfSteps; - - /** - * @return Returns the scalingDirection. - */ - public String getScalingDirection() { - return scalingDirection; - } - - /** - * @param scalingDirection The scalingDirection to set. - */ - public void setScalingDirection(String scalingDirection) { - this.scalingDirection = scalingDirection; - } - - /** - * @return Returns the aspectId. - */ - public String getAspectId() { - return aspectId; - } - - /** - * @param aspectId The aspectId to set. - */ - public void setAspectId(String aspectId) { - this.aspectId = aspectId; - } - - /** - * @return Returns the numberofSteps. - */ - public int getNumberOfSteps() { - return numberOfSteps; - } - - /** - * @param numberOfSteps The numberofSteps to set. - */ - public void setNumberOfSteps(int numberOfSteps) { - this.numberOfSteps = numberOfSteps; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsData.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsData.java deleted file mode 100644 index 02e42ea994..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsData.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure.vfcmodel; - - -public class ScaleNsData { - - private ScaleNsByStepsData scaleNsByStepsData; - - public ScaleNsByStepsData getScaleNsByStepsData() { - return scaleNsByStepsData; - } - - public void setScaleNsByStepsData(ScaleNsByStepsData scaleNsByStepsData) { - this.scaleNsByStepsData = scaleNsByStepsData; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleResource.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleResource.java deleted file mode 100644 index 1f49b02569..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleResource.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure.vfcmodel; - - -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/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/VimLocation.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/VimLocation.java deleted file mode 100644 index 67252b4b96..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/VimLocation.java +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure.vfcmodel; - - -/** - * - *
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-10-18 - */ -public class VimLocation { - 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/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/ServicePluginFactory.java deleted file mode 100644 index 96768bace8..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/ServicePluginFactory.java +++ /dev/null @@ -1,443 +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.bpmn.infrastructure.workflow.service; - -import java.io.IOException; -import java.net.SocketTimeoutException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.http.HttpResponse; -import org.apache.http.ParseException; -import org.apache.http.client.HttpClient; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.conn.ConnectTimeoutException; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.util.EntityUtils; -import org.camunda.bpm.engine.runtime.Execution; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -public class ServicePluginFactory { - - // SOTN calculate route - public static final String OOF_Default_EndPoint = "http://192.168.1.223:8443/oof/sotncalc"; - - public static final String Third_SP_Default_EndPoint = "http://192.168.1.223:8443/sp/resourcemgr/querytps"; - - private static final int DEFAULT_TIME_OUT = 60000; - - static JsonUtils jsonUtil = new JsonUtils(); - - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - private static ServicePluginFactory instance; - - - public static synchronized ServicePluginFactory getInstance() { - if (null == instance) { - instance = new ServicePluginFactory(); - } - return instance; - } - - private ServicePluginFactory() { - - } - - public String test() - { - return ""; - } - - private String getThirdSPEndPoint(){ - Map properties = PropertyConfiguration.getInstance().getProperties("topology.properties"); - if (properties != null) { - String thirdSPEndPoint = properties.get("third-sp-endpoint"); - if(null != thirdSPEndPoint && !thirdSPEndPoint.isEmpty()){ - return thirdSPEndPoint; - } - } - return Third_SP_Default_EndPoint; - } - - private String getOOFCalcEndPoint(){ - Map properties = PropertyConfiguration.getInstance().getProperties("topology.properties"); - if (properties != null) { - String oofCalcEndPoint = properties.get("oof-calc-endpoint"); - if(null != oofCalcEndPoint && !oofCalcEndPoint.isEmpty()){ - return oofCalcEndPoint; - } - } - return OOF_Default_EndPoint; - } - - - public String preProcessService(ServiceDecomposition serviceDecomposition, String uuiRequest) { - - // now only for sotn - if (isSOTN(serviceDecomposition, uuiRequest)) { - // We Need to query the terminalpoint of the VPN by site location - // info - return preProcessSOTNService(serviceDecomposition, uuiRequest); - } - return uuiRequest; - } - - public String doServiceHoming(ServiceDecomposition serviceDecomposition, String uuiRequest) { - // now only for sotn - if (isSOTN(serviceDecomposition, uuiRequest)) { - return doSOTNServiceHoming(serviceDecomposition, uuiRequest); - } - return uuiRequest; - } - - private boolean isSOTN(ServiceDecomposition serviceDecomposition, String uuiRequest) { - // there should be a register platform , we check it very simple here. - return uuiRequest.contains("clientSignal") && uuiRequest.contains("vpnType"); - } - - private String preProcessSOTNService(ServiceDecomposition serviceDecomposition, String uuiRequest) { - Map uuiObject = getJsonObject(uuiRequest, Map.class); - Map serviceObject = (Map) uuiObject.get("service"); - Map serviceParametersObject = (Map) serviceObject.get("parameters"); - Map serviceRequestInputs = (Map) serviceParametersObject.get("requestInputs"); - List resources = (List) serviceParametersObject.get("resources"); - // This is a logic for demo , it could not be finalized to community. - String srcLocation = ""; - String dstLocation = ""; - String srcClientSignal = ""; - String dstClientSignal = ""; - // support R2 uuiReq and R1 uuiReq - // logic for R2 uuiRequest params in service level - for (Entry entry : serviceRequestInputs.entrySet()) { - if (entry.getKey().toLowerCase().contains("location")) { - if ("".equals(srcLocation)) { - srcLocation = (String) entry.getValue(); - } else if ("".equals(dstLocation)) { - dstLocation = (String) entry.getValue(); - } - } - if (entry.getKey().toLowerCase().contains("clientsignal")) { - if ("".equals(srcClientSignal)) { - srcClientSignal = (String) entry.getValue(); - } else if ("".equals(dstClientSignal)) { - dstClientSignal = (String) entry.getValue(); - } - } - } - - // logic for R1 uuiRequest, params in resource level - for (Object resource : resources) { - Map resourceObject = (Map) resource; - Map resourceParametersObject = (Map) resourceObject.get("parameters"); - Map resourceRequestInputs = (Map) resourceParametersObject - .get("requestInputs"); - for (Entry entry : resourceRequestInputs.entrySet()) { - if (entry.getKey().toLowerCase().contains("location")) { - if ("".equals(srcLocation)) { - srcLocation = (String) entry.getValue(); - } else if ("".equals(dstLocation)) { - dstLocation = (String) entry.getValue(); - } - } - if (entry.getKey().toLowerCase().contains("clientsignal")) { - if ("".equals(srcClientSignal)) { - srcClientSignal = (String) entry.getValue(); - } else if ("".equals(dstClientSignal)) { - dstClientSignal = (String) entry.getValue(); - } - } - } - } - - Map vpnRequestInputs = getVPNResourceRequestInputs(resources); - // here we put client signal to vpn resource inputs - vpnRequestInputs.put("src-client-signal", srcClientSignal); - vpnRequestInputs.put("dst-client-signal", dstClientSignal); - - // Now we need to query terminal points from SP resourcemgr system. - List locationTerminalPointList = queryTerminalPointsFromServiceProviderSystem(srcLocation, dstLocation); - Map tpInfoMap = (Map) locationTerminalPointList.get(0); - - serviceRequestInputs.put("inner-src-access-provider-id", tpInfoMap.get("access-provider-id")); - serviceRequestInputs.put("inner-src-access-client-id", tpInfoMap.get("access-client-id")); - serviceRequestInputs.put("inner-src-access-topology-id", tpInfoMap.get("access-topology-id")); - serviceRequestInputs.put("inner-src-access-node-id", tpInfoMap.get("access-node-id")); - serviceRequestInputs.put("inner-src-access-ltp-id", tpInfoMap.get("access-ltp-id")); - tpInfoMap = (Map) locationTerminalPointList.get(1); - - serviceRequestInputs.put("inner-dst-access-provider-id", tpInfoMap.get("access-provider-id")); - serviceRequestInputs.put("inner-dst-access-client-id", tpInfoMap.get("access-client-id")); - serviceRequestInputs.put("inner-dst-access-topology-id", tpInfoMap.get("access-topology-id")); - serviceRequestInputs.put("inner-dst-access-node-id", tpInfoMap.get("access-node-id")); - serviceRequestInputs.put("inner-dst-access-ltp-id", tpInfoMap.get("access-ltp-id")); - - String newRequest = getJsonString(uuiObject); - return newRequest; - } - - private List queryTerminalPointsFromServiceProviderSystem(String srcLocation, String dstLocation) { - Map locationSrc = new HashMap<>(); - locationSrc.put("location", srcLocation); - Map locationDst = new HashMap<>(); - locationDst.put("location", dstLocation); - List> locations = new ArrayList<>(); - locations.add(locationSrc); - locations.add(locationDst); - List returnList = new ArrayList<>(); - String reqContent = getJsonString(locations); - String url = getThirdSPEndPoint(); - String responseContent = sendRequest(url, "POST", reqContent); - if (null != responseContent) { - returnList = getJsonObject(responseContent, List.class); - } - return returnList; - } - - private Map getVPNResourceRequestInputs(List resources) { - for (Object resource : resources) { - Map resourceObject = (Map) resource; - Map resourceParametersObject = (Map) resourceObject.get("parameters"); - Map resourceRequestInputs = (Map) resourceParametersObject - .get("requestInputs"); - for (Entry entry : resourceRequestInputs.entrySet()) { - if (entry.getKey().toLowerCase().contains("vpntype")) { - return resourceRequestInputs; - } - } - } - return null; - } - - public static void main(String args[]){ - String str = "restconf/config/GENERIC-RESOURCE-API:services/service/eca7e542-12ba-48de-8544-fac59303b14e/service-data/networks/network/aec07806-1671-4af2-b722-53c8e320a633/network-data/"; - - int index1 = str.indexOf("/network/"); - int index2 = str.indexOf("/network-data"); - - String str1 = str.substring(index1 + "/network/".length(), index2); - System.out.println(str1); - - } - - private String doSOTNServiceHoming(ServiceDecomposition serviceDecomposition, String uuiRequest) { - // query the route for the service. - Map uuiObject = getJsonObject(uuiRequest, Map.class); - Map serviceObject = (Map) uuiObject.get("service"); - Map serviceParametersObject = (Map) serviceObject.get("parameters"); - Map serviceRequestInputs = (Map) serviceParametersObject.get("requestInputs"); - Map oofQueryObject = new HashMap<>(); - List resources = (List) serviceParametersObject.get("resources"); - oofQueryObject.put("src-access-provider-id", serviceRequestInputs.get("inner-src-access-provider-id")); - oofQueryObject.put("src-access-client-id", serviceRequestInputs.get("inner-src-access-client-id")); - oofQueryObject.put("src-access-topology-id", serviceRequestInputs.get("inner-src-access-topology-id")); - oofQueryObject.put("src-access-node-id", serviceRequestInputs.get("inner-src-access-node-id")); - oofQueryObject.put("src-access-ltp-id", serviceRequestInputs.get("inner-src-access-ltp-id")); - oofQueryObject.put("dst-access-provider-id", serviceRequestInputs.get("inner-dst-access-provider-id")); - oofQueryObject.put("dst-access-client-id", serviceRequestInputs.get("inner-dst-access-client-id")); - oofQueryObject.put("dst-access-topology-id", serviceRequestInputs.get("inner-dst-access-topology-id")); - oofQueryObject.put("dst-access-node-id", serviceRequestInputs.get("inner-dst-access-node-id")); - oofQueryObject.put("dst-access-ltp-id", serviceRequestInputs.get("inner-dst-access-ltp-id")); - String oofRequestReq = getJsonString(oofQueryObject); - String url = getOOFCalcEndPoint(); - String responseContent = sendRequest(url, "POST", oofRequestReq); - - List returnList = new ArrayList<>(); - if (null != responseContent) { - returnList = getJsonObject(responseContent, List.class); - } - // in demo we have only one VPN. no cross VPNs, so get first item. - Map returnRoute = getReturnRoute(returnList); - Map vpnRequestInputs = getVPNResourceRequestInputs(resources); - vpnRequestInputs.putAll(returnRoute); - String newRequest = getJsonString(uuiObject); - return newRequest; - } - - private Map getReturnRoute(List returnList){ - Map returnRoute = new HashMap<>(); - for(Object returnVpn :returnList){ - Map returnVpnInfo = (Map) returnVpn; - String accessTopoId = (String)returnVpnInfo.get("access-topology-id"); - if("100".equals(accessTopoId)){ - returnRoute.putAll(returnVpnInfo); - } - else if("101".equals(accessTopoId)){ - for(String key : returnVpnInfo.keySet()){ - returnRoute.put("domain1-" + key, returnVpnInfo.get(key)); - } - } - else if("102".equals(accessTopoId)){ - for(String key : returnVpnInfo.keySet()){ - returnRoute.put("domain2-" + key, returnVpnInfo.get(key)); - } - } - else{ - for(String key : returnVpnInfo.keySet()){ - returnRoute.put("domain" + accessTopoId +"-" + key, returnVpnInfo.get(key)); - } - } - } - return returnRoute; - } - - private Map getResourceParams(Execution execution, String resourceCustomizationUuid, - String serviceParameters) { - List resourceList = jsonUtil.StringArrayToList(execution, - (String) JsonUtils.getJsonValue(serviceParameters, "resources")); - // Get the right location str for resource. default is an empty array. - String resourceInputsFromUui = ""; - for (String resource : resourceList) { - String resCusUuid = (String) JsonUtils.getJsonValue(resource, "resourceCustomizationUuid"); - if (resourceCustomizationUuid.equals(resCusUuid)) { - String resourceParameters = JsonUtils.getJsonValue(resource, "parameters"); - resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs"); - } - } - Map resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class); - return resourceInputsFromUuiMap; - } - - public static T getJsonObject(String jsonstr, Class type) { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - try { - return mapper.readValue(jsonstr, type); - } catch (IOException e) { - LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError, - "fail to unMarshal json", e); - } - return null; - } - - public static String getJsonString(Object srcObj) { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); - String jsonStr = null; - try { - jsonStr = mapper.writeValueAsString(srcObj); - } catch (JsonProcessingException e) { - LOGGER.debug("SdcToscaParserException", e); - e.printStackTrace(); - } - return jsonStr; - } - - private static String sendRequest(String url, String methodType, String content) { - - String msbUrl = url; - HttpRequestBase method = null; - HttpResponse httpResponse = null; - - try { - int timeout = DEFAULT_TIME_OUT; - - RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout) - .setConnectionRequestTimeout(timeout).build(); - - HttpClient client = HttpClientBuilder.create().build(); - - if ("POST".equals(methodType.toUpperCase())) { - HttpPost httpPost = new HttpPost(msbUrl); - httpPost.setConfig(requestConfig); - httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); - method = httpPost; - } else if ("PUT".equals(methodType.toUpperCase())) { - HttpPut httpPut = new HttpPut(msbUrl); - httpPut.setConfig(requestConfig); - httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); - method = httpPut; - } else if ("GET".equals(methodType.toUpperCase())) { - HttpGet httpGet = new HttpGet(msbUrl); - httpGet.setConfig(requestConfig); - method = httpGet; - } else if ("DELETE".equals(methodType.toUpperCase())) { - HttpDelete httpDelete = new HttpDelete(msbUrl); - httpDelete.setConfig(requestConfig); - method = httpDelete; - } - - // now have no auth - // String userCredentials = - // SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP, - // Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY); - // String authorization = "Basic " + - // DatatypeConverter.printBase64Binary(userCredentials.getBytes()); - // method.setHeader("Authorization", authorization); - - httpResponse = client.execute(method); - String responseContent = null; - if (null != httpResponse && httpResponse.getEntity() != null) { - try { - responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); - } catch (ParseException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - if (null != method) { - method.reset(); - } - method = null; - return responseContent; - - } catch (SocketTimeoutException | ConnectTimeoutException e) { - return null; - - } catch (Exception e) { - return null; - - } finally { - if (httpResponse != null) { - try { - EntityUtils.consume(httpResponse.getEntity()); - } catch (Exception e) { - } - } - if (method != null) { - try { - method.reset(); - } catch (Exception e) { - - } - } - } - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplication.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplication.java deleted file mode 100644 index dbf5a57f33..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplication.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.bpmn.infrastructure.workflow.service; - -import java.util.HashSet; -import java.util.Set; - -import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; - -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowMessageResource; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource; - -@ApplicationPath("/") -public class WorkflowResourceApplication extends Application { - private Set singletons = new HashSet<>(); - private Set> classes = new HashSet<>(); - - public WorkflowResourceApplication() { - singletons.add(new WorkflowResource()); - singletons.add(new WorkflowAsyncResource()); - singletons.add(new WorkflowMessageResource()); - } - - @Override - public Set> getClasses() { - return classes; - } - - @Override - public Set getSingletons() { - return singletons; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java deleted file mode 100644 index ee047c9dd5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java +++ /dev/null @@ -1,370 +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.bpmn.infrastructure.workflow.serviceTask; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.apache.commons.lang3.StringUtils; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.json.JSONObject; -import org.onap.msb.sdk.discovery.common.RouteException; -import org.onap.msb.sdk.httpclient.RestServiceCreater; -import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; -import org.openecomp.mso.bpmn.core.BaseTask; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.requestsdb.RequestsDbConstant; -import org.openecomp.mso.requestsdb.ResourceOperationStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -public abstract class AbstractSdncOperationTask extends BaseTask { - - private static final Logger logger = LoggerFactory.getLogger(AbstractSdncOperationTask.class); - - private static final String DEFAULT_MSB_IP = "127.0.0.1"; - private static final int DEFAULT_MSB_PORT = 80; - private static final String SDCADAPTOR_INPUTS = "resourceParameters"; - private static final String TOPOLOGY_PROPERTIES = "topology.properties"; - public static final String ONAP_IP = "ONAP_IP"; - - private static final String POST_BODY_TEMPLATE = "\n"+ - " \n"+ - " $errorCode\n"+ - " $jobId\n"+ - " $operType\n"+ - " $operationId\n"+ - " $progress\n"+ - " $resourceTemplateUUID\n"+ - " $serviceId\n"+ - " $status\n"+ - " $statusDescription\n"+ - " "; - - private static final String GET_BODY_TEMPLATE = " \n" + - " \n" + - " $operationId\n" + - " $resourceTemplateUUID\n" + - " $serviceId\n" + - " "; - - - private void updateResOperStatus(ResourceOperationStatus resourceOperationStatus) throws RouteException { - logger.info("AbstractSdncOperationTask.updateResOperStatus begin!"); - Map properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - String requestsdbEndPoint = properties.get("mso.adapters.openecomp.db.endpoint"); - HttpPost httpPost = new HttpPost(requestsdbEndPoint); - httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); - httpPost.addHeader("Content-type", "application/soap+xml"); - String postBody = getPostStringBody(resourceOperationStatus); - httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); - httpPost(requestsdbEndPoint, httpPost); - logger.info("AbstractSdncOperationTask.updateResOperStatus end!"); - } - - protected String getPostbody(Object inputEntity) { - ObjectMapper objectMapper = new ObjectMapper(); - String postBody = null; - try { - objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); - postBody = objectMapper.writeValueAsString(inputEntity); - } catch (JsonProcessingException e) { - logger.error(e.getStackTrace().toString()); - } - return postBody; - } - - protected String httpPost(String url, HttpPost httpPost) throws RouteException { - logger.info("AbstractSdncOperationTask.httpPost begin!"); - String result = null; - - String errorMsg; - try(CloseableHttpClient httpClient = HttpClients.createDefault()) { - CloseableHttpResponse closeableHttpResponse = httpClient.execute(httpPost); - result = EntityUtils.toString(closeableHttpResponse.getEntity()); - logger.info("result = {}", result); - if(closeableHttpResponse.getStatusLine().getStatusCode() != 200) { - logger.info("exception: fail for status code = {}", closeableHttpResponse.getStatusLine().getStatusCode()); - throw new RouteException(result, "SERVICE_GET_ERR"); - } - - closeableHttpResponse.close(); - } catch (IOException e) { - errorMsg = url + ":httpPostWithJSON connect faild"; - logger.info("exception: POST_CONNECT_FAILD : {}", errorMsg); - throwsRouteException(errorMsg, e, "POST_CONNECT_FAILD"); - } - - logger.info("AbstractSdncOperationTask.httpPost end!"); - return result; - } - - private static void throwsRouteException(String errorMsg, Exception e, String errorCode) throws RouteException { - String msg = errorMsg + ".errorMsg:" + e.getMessage(); - logger.info("exception: {}", msg); - throw new RouteException(errorMsg, errorCode); - } - - private String getPostStringBody(ResourceOperationStatus resourceOperationStatus) { - logger.info("AbstractSdncOperationTask.getPostStringBody begin!"); - String postBody = POST_BODY_TEMPLATE; - postBody = postBody.replace("$errorCode", resourceOperationStatus.getErrorCode()); - postBody = postBody.replace("$jobId", resourceOperationStatus.getJobId()); - postBody = postBody.replace("$operType", resourceOperationStatus.getOperType()); - postBody = postBody.replace("$operationId", resourceOperationStatus.getOperationId()); - postBody = postBody.replace("$progress", resourceOperationStatus.getProgress()); - postBody = postBody.replace("$resourceTemplateUUID", resourceOperationStatus.getResourceTemplateUUID()); - postBody = postBody.replace("$serviceId", resourceOperationStatus.getServiceId()); - postBody = postBody.replace("$status", resourceOperationStatus.getStatus()); - postBody = postBody.replace("$statusDescription", resourceOperationStatus.getStatusDescription()); - logger.info("AbstractSdncOperationTask.getPostStringBody end!"); - return postBody; - } - - private String getGetStringBody(String serviceId, String operationId, String resourceTemplateUUID) { - logger.info("AbstractSdncOperationTask.getGetStringBody begin!"); - String getBody = GET_BODY_TEMPLATE; - getBody = getBody.replace("$operationId", operationId); - getBody = getBody.replace("$resourceTemplateUUID", resourceTemplateUUID); - getBody = getBody.replace("$serviceId", serviceId); - logger.info("AbstractSdncOperationTask.getGetStringBody end!"); - return getBody; - } - - private ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID) throws RouteException { - logger.info("AbstractSdncOperationTask.getResourceOperationStatus begin!"); - Map properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - String requestsdbEndPoint = properties.get("mso.adapters.openecomp.db.endpoint"); - HttpPost httpPost = new HttpPost(requestsdbEndPoint); - httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); - httpPost.addHeader("Content-type", "application/soap+xml"); - String getBody = getGetStringBody(serviceId, operationId, resourceTemplateUUID); - httpPost.setEntity(new StringEntity(getBody, ContentType.APPLICATION_XML)); - String result = httpPost(requestsdbEndPoint, httpPost); - ResourceOperationStatus resourceOperationStatus = getResourceOperationStatusFromXmlString(result); - logger.info("AbstractSdncOperationTask.getResourceOperationStatus end!"); - return resourceOperationStatus; - } - - private ResourceOperationStatus getResourceOperationStatusFromXmlString(String result) { - logger.info("AbstractSdncOperationTask.getResourceOperationStatusFromXmlString begin!"); - ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus(); - resourceOperationStatus.setErrorCode(getValueByName("errorCode", result)); - resourceOperationStatus.setJobId(getValueByName("jobId", result)); - resourceOperationStatus.setOperType(getValueByName("operType", result)); - resourceOperationStatus.setOperationId(getValueByName("operationId", result)); - resourceOperationStatus.setProgress(getValueByName("progress", result)); - resourceOperationStatus.setResourceTemplateUUID(getValueByName("resourceTemplateUUID", result)); - resourceOperationStatus.setServiceId(getValueByName("serviceId", result)); - resourceOperationStatus.setStatus(getValueByName("status", result)); - resourceOperationStatus.setStatusDescription(getValueByName("statusDescription", result)); - logger.info("AbstractSdncOperationTask.getResourceOperationStatusFromXmlString end!"); - return resourceOperationStatus; - } - - private String getValueByName(String name, String xml) { - if (!StringUtils.isBlank(xml) && xml.contains(name)) { - String start = "<" + name + ">"; - String end = ""; - return xml.substring(xml.indexOf(start), xml.indexOf(end)).replace(start, ""); - } - return ""; - } - - protected static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - @Override - public void execute(DelegateExecution execution) { - logger.info("AbstractSdncOperationTask.execute begin!"); - GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(); - try { - Map inputs = getInputs(execution); - - sendRestrequestAndHandleResponse(execution, inputs, genericResourceApiClient); - execution.setVariable("SDNCA_SuccessIndicator", true); - } catch (Exception e) { - logger.info("exception: AbstractSdncOperationTask.fail!"); - logger.error("exception: AbstractSdncOperationTask.fail!:", e); - logger.error(e.getStackTrace().toString()); - execution.setVariable("SDNCA_SuccessIndicator", false); - updateProgress(execution, RequestsDbConstant.Status.ERROR, null, "100", "sendRestrequestAndHandleResponse finished!"); - - } - logger.info("AbstractSdncOperationTask.execute end!"); - } - - protected Map getInputs(DelegateExecution execution) { - logger.info("AbstractSdncOperationTask.getInputs begin!"); - Map inputs = new HashMap<>(); - String json = (String) execution.getVariable(SDCADAPTOR_INPUTS); - if (!StringUtils.isBlank(json)) { - JSONObject jsonObject = new JSONObject(json); - JSONObject paras = jsonObject.getJSONObject("additionalParamForNs"); - Iterator iterator = paras.keys(); - while (iterator.hasNext()) { - String key = iterator.next(); - inputs.put(key, paras.getString(key)); - } - } - logger.info("AbstractSdncOperationTask.getInputs end!"); - return inputs; - } - - public abstract void sendRestrequestAndHandleResponse(DelegateExecution execution, - Map inputs, - GenericResourceApi genericResourceApiClient) throws Exception; - - public void updateProgress(DelegateExecution execution, - String status, - String errorCode, - String progress, - String statusDescription) { - logger.info("AbstractSdncOperationTask.updateProgress begin!"); - String serviceId = (String) execution.getVariable("serviceId"); - serviceId = StringUtils.isBlank(serviceId) ? (String) execution.getVariable("serviceInstanceId") : serviceId; - String operationId = (String) execution.getVariable("operationId"); - String resourceTemplateUUID = (String) execution.getVariable("resourceUUID"); - String resourceTemplateId = (String) execution.getVariable("resourceTemplateId"); - resourceTemplateId = StringUtils.isBlank(resourceTemplateId) ? "" : resourceTemplateUUID; - resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? resourceTemplateId : resourceTemplateUUID; - try { - ResourceOperationStatus resourceOperationStatus = getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); - if (!StringUtils.isBlank(status)) { - resourceOperationStatus.setStatus(status); - } - if (!StringUtils.isBlank(errorCode)) { - resourceOperationStatus.setErrorCode(errorCode); - } - if (!StringUtils.isBlank(progress)) { - resourceOperationStatus.setProgress(progress); - } - if (!StringUtils.isBlank(statusDescription)) { - resourceOperationStatus.setStatusDescription(statusDescription); - } - updateResOperStatus(resourceOperationStatus); - logger.info("AbstractSdncOperationTask.updateProgress end!"); - } catch (Exception exception) { - logger.info("exception: AbstractSdncOperationTask.updateProgress fail!"); - logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception); - msoLogger.error(MessageEnum.GENERAL_EXCEPTION, " updateProgress catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, exception.getClass().toString()); - } - } - - - protected boolean isSend2SdncDirectly() { - logger.info("AbstractSdncOperationTask.isSend2SdncDirectly begin!"); - Map properties = PropertyConfiguration.getInstance().getProperties(TOPOLOGY_PROPERTIES); - if (properties != null) { - String sdncIp = properties.get("sdnc-ip"); - String sdncPort = properties.get("sdnc-port"); - if (!StringUtils.isBlank(sdncIp) && isIp(sdncIp) && !StringUtils.isBlank(sdncPort)) { - logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = true."); - return true; - } - } - logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = false."); - return false; - } - - protected String getSdncIp() { - logger.info("AbstractSdncOperationTask.getSdncIp begin."); - String sdncIp = null; - Map properties = PropertyConfiguration.getInstance().getProperties("topology.properties"); - if (properties != null) { - sdncIp = properties.get("sdnc-ip"); - } - String returnIp = StringUtils.isBlank(sdncIp) || !isIp(sdncIp) ? null : sdncIp; - logger.info("AbstractSdncOperationTask.getSdncIp: sdncIp = {}", returnIp); - return returnIp; - } - - protected String getSdncPort() { - logger.info("AbstractSdncOperationTask.getSdncPort begin."); - String sdncPort = null; - Map properties = PropertyConfiguration.getInstance().getProperties("topology.properties"); - if (properties != null) { - sdncPort = properties.get("sdnc-port"); - } - String returnPort = StringUtils.isBlank(sdncPort) ? null : sdncPort; - logger.info("AbstractSdncOperationTask.getSdncPort: returnPort = {}", sdncPort); - return returnPort; - } - - private GenericResourceApi getGenericResourceApiClient() { - logger.info("AbstractSdncOperationTask.getGenericResourceApiClient begin!"); - String msbIp = System.getenv().get(ONAP_IP); - int msbPort = DEFAULT_MSB_PORT; - Map properties = PropertyConfiguration.getInstance().getProperties("topology.properties"); - if (properties != null) { - if (StringUtils.isBlank(msbIp) || !isIp(msbIp)) { - msbIp = properties.get("msb-ip"); - if (StringUtils.isBlank(msbIp)) { - msbIp = getString(properties, "msb.address", DEFAULT_MSB_IP); - } - } - String strMsbPort = properties.get("msb-port"); - if (StringUtils.isBlank(strMsbPort)) { - strMsbPort = getString(properties, "msb.port", String.valueOf(DEFAULT_MSB_PORT)); - } - msbPort = Integer.valueOf(strMsbPort); - } - logger.info("AbstractSdncOperationTask.getGenericResourceApiClient msbIp = " + msbIp + " msbPort = " + msbPort); - MSBServiceClient msbClient = new MSBServiceClient(msbIp, msbPort); - RestServiceCreater restServiceCreater = new RestServiceCreater(msbClient); - logger.info("AbstractSdncOperationTask.getGenericResourceApiClient end!"); - return restServiceCreater.createService(GenericResourceApi.class); - } - - protected boolean isIp(String msbIp) { - return !StringUtils.isBlank(msbIp) && msbIp.split("\\.").length == 4; - } - - private String getString(Map properties, String name, String defaultValue) { - String vlaue = properties.get(name); - try { - if (!StringUtils.isBlank(vlaue)) { - return vlaue; - } - } catch (Exception e) { - msoLogger.error(MessageEnum.GENERAL_EXCEPTION, " getMsbIp catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, e.getClass().toString(),e); - } - return defaultValue; - } - - public String getProcessKey(DelegateExecution execution) { - return execution.getProcessEngineServices().getRepositoryService().getProcessDefinition(execution.getProcessDefinitionId()).getKey(); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java deleted file mode 100644 index 46a45883ef..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java +++ /dev/null @@ -1,100 +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.bpmn.infrastructure.workflow.serviceTask; - -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.onap.msb.sdk.discovery.common.RouteException; -import org.openecomp.mso.bpmn.core.WorkflowException; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder.NetworkRpcInputEntityBuilder; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationOutputEntity; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.requestsdb.RequestsDbConstant; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Map; - -public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask { - private static final Logger sdncLogger = LoggerFactory.getLogger(SdncNetworkTopologyOperationTask.class); - - - private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation"; - - @Override - public void sendRestrequestAndHandleResponse(DelegateExecution execution, - Map inputs, - GenericResourceApi genericResourceApiClient) throws Exception { - sdncLogger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); - updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "40", "sendRestrequestAndHandleResponse begin!"); - NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder(); - RpcNetworkTopologyOperationInputEntity inputEntity = builder.build(execution, inputs); - updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "50", "RequestBody build finished!"); - RpcNetworkTopologyOperationOutputEntity outputEntity; - if (!isSend2SdncDirectly()) { - outputEntity = genericResourceApiClient.postNetworkTopologyOperation - (HeaderUtil.DefaulAuth, inputEntity).execute().body(); - updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); - saveOutput(execution, outputEntity); - } else { - send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); - } - updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); - sdncLogger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse end!"); - } - - private void send2SdncDirectly(String defaulAuth, - RpcNetworkTopologyOperationInputEntity inputEntity) throws RouteException { - sdncLogger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly begin!"); - String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL; - HttpPost httpPost = new HttpPost(url); - httpPost.addHeader("Authorization", defaulAuth); - httpPost.addHeader("Content-type", "application/json"); - String postBody = getPostbody(inputEntity); - msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC", ""); - httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); - httpPost(url, httpPost); - sdncLogger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly end!"); - } - - private void saveOutput(DelegateExecution execution, RpcNetworkTopologyOperationOutputEntity output) throws RouteException { - sdncLogger.info("SdncNetworkTopologyOperationTask.saveOutput begin!"); - String responseCode = output.getOutput().getResponseCode(); - if (!"200".equals(responseCode)) { - String processKey = getProcessKey(execution); - int errorCode = Integer.parseInt(responseCode); - String errorMessage = output.getOutput().getResponseMessage(); - WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage); - execution.setVariable("SDNCA_SuccessIndicator", workflowException); - updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), "100", errorMessage); - sdncLogger.info("exception: SdncNetworkTopologyOperationTask.saveOutput fail!"); - throw new RouteException(); - } - - sdncLogger.info("SdncNetworkTopologyOperationTask.saveOutput end!"); - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java deleted file mode 100644 index 28fe802012..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java +++ /dev/null @@ -1,99 +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.bpmn.infrastructure.workflow.serviceTask; - - -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.onap.msb.sdk.discovery.common.RouteException; -import org.openecomp.mso.bpmn.core.WorkflowException; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder.ServiceRpcInputEntityBuilder; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationInputEntity; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationOutputEntity; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.requestsdb.RequestsDbConstant; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Map; - -public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask { - private static final Logger sdncLogger = LoggerFactory.getLogger(SdncServiceTopologyOperationTask.class); - - - private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation"; - - @Override - public void sendRestrequestAndHandleResponse(DelegateExecution execution, - Map inputs, - GenericResourceApi genericResourceApiClient) throws Exception { - sdncLogger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); - updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!"); - ServiceRpcInputEntityBuilder builder = new ServiceRpcInputEntityBuilder(); - RpcServiceTopologyOperationInputEntity inputEntity = builder.build(execution, inputs); - updateProgress(execution, null, null, "50", "RequestBody build finished!"); - RpcServiceTopologyOperationOutputEntity outputEntity; - if (!isSend2SdncDirectly()) { - outputEntity = genericResourceApiClient.postServiceTopologyOperation - (HeaderUtil.DefaulAuth, inputEntity).execute().body(); - updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); - saveOutput(execution, outputEntity); - } else { - send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); - } - sdncLogger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse end!"); - - } - - private void send2SdncDirectly(String defaulAuth, - RpcServiceTopologyOperationInputEntity inputEntity) throws RouteException { - sdncLogger.info("SdncServiceTopologyOperationTask.send2SdncDirectly begin!"); - String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL; - HttpPost httpPost = new HttpPost(url); - httpPost.addHeader("Authorization", defaulAuth); - httpPost.addHeader("Content-type", "application/json"); - String postBody = getPostbody(inputEntity); - msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC", ""); - httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); - httpPost(url, httpPost); - sdncLogger.info("SdncServiceTopologyOperationTask.send2SdncDirectly end!"); - } - - private void saveOutput(DelegateExecution execution, RpcServiceTopologyOperationOutputEntity output) throws Exception { - sdncLogger.info("SdncServiceTopologyOperationTask.saveOutput begin!"); - String responseCode = output.getOutput().getResponseCode(); - if (!"200".equals(responseCode)) { - String processKey = getProcessKey(execution); - int errorCode = Integer.parseInt(responseCode); - String errorMessage = output.getOutput().getResponseMessage(); - WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage); - execution.setVariable("SDNCA_SuccessIndicator", workflowException); - updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage); - sdncLogger.info("exception: SdncServiceTopologyOperationTask.saveOutput fail!"); - throw new RouteException(); - } - sdncLogger.info("SdncServiceTopologyOperationTask.saveOutput end!"); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java deleted file mode 100644 index 0e7904c87c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.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.bpmn.infrastructure.workflow.serviceTask; - -import org.apache.commons.lang3.StringUtils; -import org.onap.msb.sdk.httpclient.RestServiceCreater; -import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder.NetworkRpcInputEntityBuilder; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationOutputEntity; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.requestsdb.RequestsDatabase; -import org.openecomp.mso.requestsdb.RequestsDbConstant; -import org.openecomp.mso.requestsdb.ResourceOperationStatus; - -import java.util.Map; - -public class SdncUnderlayVpnOperationClient { - - private static final String DEFAULT_MSB_IP = "127.0.0.1"; - private static final int DEFAULT_MSB_PORT = 10081; - private RequestsDatabase requestsDB = RequestsDatabase.getInstance(); - - private String serviceId; - private String operationId; - private String resourceTemplateUUID; - - - private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); - - public boolean excute(String msbIp, - int msbPort, - Map inputs, - String iServiceID, - String iOperationID, - String resourceTemplateUUID_i){ - serviceId = iServiceID; - operationId = iOperationID; - resourceTemplateUUID = resourceTemplateUUID_i; - GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(msbIp, msbPort); - updateProgress(RequestsDbConstant.Status.PROCESSING, null, "10", "execute begin!"); - return sendRestrequestAndHandleResponse(inputs, genericResourceApiClient); - } - - public boolean sendRestrequestAndHandleResponse(Map inputs, GenericResourceApi genericResourceApiClient){ - updateProgress(null, null, "40", "sendRestrequestAndHandleResponse begin!"); - NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder(); - RpcNetworkTopologyOperationInputEntity body = builder.build(null, inputs); - updateProgress(null, null, "50", "RequestBody build finished!"); - //RpcNetworkTopologyOperationOutputEntity networkRpcOutputEntiy = null; - try { - genericResourceApiClient.postNetworkTopologyOperation(HeaderUtil.DefaulAuth ,body).execute().body(); - } catch (Exception e) { - logger.debug("Exception: ", e); - updateProgress(RequestsDbConstant.Status.ERROR, null, null, "sendRestrequestAndHandleResponse exception:" + e.getMessage()); - return false; - } - updateProgress(null, null, "90", "sendRestrequestAndHandleResponse finished!"); - updateProgress(RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); - return true; - } - - private GenericResourceApi getGenericResourceApiClient(String msbIp, int msbPort) { - if (StringUtils.isBlank(msbIp)) { - msbIp = DEFAULT_MSB_IP; - } - if (msbPort <= 0) { - msbPort = DEFAULT_MSB_PORT; - } - MSBServiceClient msbClient = new MSBServiceClient(msbIp, msbPort); - RestServiceCreater restServiceCreater = new RestServiceCreater(msbClient); - return restServiceCreater.createService(GenericResourceApi.class); - } - - public void updateProgress(String status, - String errorCode, - String progress, - String statusDescription) { - ResourceOperationStatus resourceOperationStatus = requestsDB.getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); - if (!StringUtils.isBlank(status)) { - resourceOperationStatus.setStatus(status); - } - if (!StringUtils.isBlank(errorCode)) { - resourceOperationStatus.setErrorCode(errorCode); - } - if (!StringUtils.isBlank(progress)) { - resourceOperationStatus.setProgress(progress); - } - if (!StringUtils.isBlank(statusDescription)) { - resourceOperationStatus.setStatusDescription(statusDescription); - } - requestsDB.updateResOperStatus(resourceOperationStatus); - } - - private void saveOutput() { - // Not implemented. - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java deleted file mode 100644 index 3989bad482..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.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.bpmn.infrastructure.workflow.serviceTask; - -import org.apache.commons.lang3.StringUtils; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.openecomp.mso.bpmn.core.BaseTask; -import org.openecomp.mso.requestsdb.RequestsDatabase; -import org.openecomp.mso.requestsdb.ResourceOperationStatus; - -public class SdncUnderlayVpnPreprocessTask extends BaseTask { - public static final String RESOURCE_OPER_TYPE = "resourceOperType"; - private RequestsDatabase requestsDB = RequestsDatabase.getInstance(); - - @Override - public void execute(DelegateExecution execution) { - String operType = getOperType(execution); - execution.setVariable(RESOURCE_OPER_TYPE, operType); - } - - private String getOperType(DelegateExecution execution) { - String serviceId = (String) execution.getVariable("serviceId"); - serviceId = StringUtils.isBlank(serviceId) ? (String) execution.getVariable("serviceInstanceId") : serviceId; - String operationId = (String) execution.getVariable("operationId"); - String resourceTemplateUUID = (String) execution.getVariable("resourceTemplateUUID"); - resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? (String) execution.getVariable("resourceTemplateId") : resourceTemplateUUID; - ResourceOperationStatus resourceOperationStatus = requestsDB.getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); - return resourceOperationStatus.getOperType(); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java deleted file mode 100644 index 8544051bcb..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.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.bpmn.infrastructure.workflow.serviceTask.client; - -import okhttp3.RequestBody; -import okhttp3.ResponseBody; -import org.onap.msb.sdk.httpclient.annotaion.ServiceHttpEndPoint; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.*; -import retrofit2.Call; -import retrofit2.http.Body; -import retrofit2.http.Header; -import retrofit2.http.POST; - -@ServiceHttpEndPoint(serviceName = "sdnc", serviceVersion = "v1") -public interface GenericResourceApi { - - @POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation") - Call postNetworkTopologyOperation(@Header("Authorization") String authorization, - @Body RequestBody input); - - @POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation") - Call postNetworkTopologyOperation(@Header("Authorization") String authorization, - @Body RpcNetworkTopologyOperationInputEntity input); - - @POST("/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation") - Call postServiceTopologyOperation(@Header("Authorization") String authorization, - @Body RpcServiceTopologyOperationInputEntity input); - -} - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java deleted file mode 100644 index a43eb526a6..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.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.bpmn.infrastructure.workflow.serviceTask.client; - -import java.util.Base64; - -public class HeaderUtil { - - public static final String USER = "admin"; - public static final String PASS = "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"; - public static final String DefaulAuth = getAuthorization(USER, PASS); - - public static String getAuthorization(String usr, String pwd) { - - return "Basic " + base64Encode(usr + ":" + pwd); - } - - private static String base64Encode(String str) { - String base64 = str; - try { - base64 = Base64.getEncoder() - .encodeToString(str.getBytes("utf-8")); - } catch (Exception ex) { - } - return base64; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java deleted file mode 100644 index 2f5bda6f46..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java +++ /dev/null @@ -1,245 +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.bpmn.infrastructure.workflow.serviceTask.client.builder; - -import org.apache.commons.lang3.StringUtils; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.OnapModelInformationEntity; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.ParamEntity; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RequestInformationEntity; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceInformationEntity; -import org.openecomp.mso.requestsdb.RequestsDbConstant; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -public abstract class AbstractBuilder { - - public static final String OPERATION_TYPE = "operationType"; - public static final String RESOURCE_TYPE = "resourceType"; - - public static enum RequestAction { - CreateNetworkInstance(0, "CreateNetworkInstance"), - ActivateNetworkInstance(1, "ActivateNetworkInstance"), - CreateServiceInstance(2, "CreateServiceInstance"), - DeleteServiceInstance(3, "DeleteServiceInstance"), - DeleteNetworkInstance(4, "DeleteNetworkInstance"), - CreateVnfInstance(5, "CreateVnfInstance"), - ActivateVnfInstance(6, "ActivateVnfInstance"), - DeleteVnfInstance(7, "DeleteVnfInstance"), - CreateVfModuleInstance(8, "CreateVfModuleInstance"), - ActivateVfModuleInstance(9, "ActivateVfModuleInstance"), - DeleteVfModuleInstance(10, "DeleteVfModuleInstance"), - CreateContrailRouteInstance(11, "CreateContrailRouteInstance"), - DeleteContrailRouteInstance(12, "DeleteContrailRouteInstance"), - CreateSecurityZoneInstance(13, "CreateSecurityZoneInstance"), - DeleteSecurityZoneInstance(14, "DeleteSecurityZoneInstance"), - ActivateDCINetworkInstance(15, "ActivateDCINetworkInstance"), - DeActivateDCINetworkInstance(16, "DeActivateDCINetworkInstance"); - - String name; - int value; - - private RequestAction(int value, String name) { - this.value = value; - this.name = name; - } - - public String getName() { - return this.name; - } - - public int getIntValue() { - return this.value; - } - } - - public enum SvcAction { - Reserve(0, "reserve"), - Assign(1, "assign"), - Activate(2, "activate"), - Delete(3, "delete"), - Changeassign(4, "changeassign"), - Changedelete(5, "changedelete"), - Rollback(6, "rollback"), - Deactivate(7, "deactivate"), - Unassign(8, "unassign"), - Create(9, "create"); - - String name; - int value; - - private SvcAction(int value, String name) { - this.value = value; - this.name = name; - } - - public String getName() { - return this.name; - } - - public int getIntValue() { - return this.value; - } - } - - protected String requestId = null; - - abstract OUT build(DelegateExecution execution, IN input) throws Exception; - - protected String getRequestActoin(DelegateExecution execution) { - String action = /*RequestInformation.*/RequestAction.CreateNetworkInstance.getName(); - String operType = (String) execution.getVariable(OPERATION_TYPE); - String resourceType = (String)execution.getVariable(RESOURCE_TYPE); - if (!StringUtils.isBlank(operType)) { - if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) { - if (isOverlay(resourceType)) { - action = /*RequestInformation.*/RequestAction.DeActivateDCINetworkInstance.getName(); - } else if (isUnderlay(resourceType)) { - action = /*RequestInformation.*/RequestAction.DeleteNetworkInstance.getName(); - } else { - action = /*RequestInformation.*/RequestAction.DeleteServiceInstance.getName(); - } - } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) { - if (isOverlay(resourceType)) { - action = /*RequestInformation.*/RequestAction.ActivateDCINetworkInstance.getName(); - } else if (isUnderlay(resourceType)) { - action = /*RequestInformation.*/RequestAction.CreateNetworkInstance.getName(); - } else { - action = /*RequestInformation.*/RequestAction.CreateServiceInstance.getName(); - } - } - } - return action; - } - - private boolean isOverlay(String resourceType) { - return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("overlay"); - } - - private boolean isUnderlay(String resourceType) { - return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("underlay"); - } - - protected String getSvcAction(DelegateExecution execution) { - String action = /*SdncRequestHeader.*/SvcAction.Create.getName(); - String operType = (String) execution.getVariable(OPERATION_TYPE); - String resourceType = (String)execution.getVariable(RESOURCE_TYPE); - if (!StringUtils.isBlank(operType)) { - if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) { - if (isOverlay(resourceType)) { - action = /*SdncRequestHeader.*/SvcAction.Deactivate.getName(); - } else if (isUnderlay(resourceType)) { - action = /*SdncRequestHeader.*/SvcAction.Delete.getName(); - } else { - action = /*SdncRequestHeader.*/SvcAction.Unassign.getName(); - } - } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) { - if (isOverlay(resourceType)) { - action = /*SdncRequestHeader.*/SvcAction.Activate.getName(); - } else if (isUnderlay(resourceType)) { - action = /*SdncRequestHeader.*/SvcAction.Create.getName(); - } else { - action = /*SdncRequestHeader.*/SvcAction.Assign.getName(); - } - } - } - return action; - } - - protected synchronized String getRequestId(DelegateExecution execution) { - if (StringUtils.isBlank(requestId)) { - requestId = (String) execution.getVariable("msoRequestId"); - if (StringUtils.isBlank(requestId)) { - requestId = UUID.randomUUID().toString(); - } - } - return requestId; - } - - protected OnapModelInformationEntity getOnapServiceModelInformationEntity(DelegateExecution execution) { - OnapModelInformationEntity onapModelInformationEntity = new OnapModelInformationEntity(); - { - String modelInvariantUuid = (String) execution.getVariable("modelInvariantUuid"); - String modelVersion = (String) execution.getVariable("modelVersion"); - String modelUuid = (String) execution.getVariable("modelUuid"); - String modelName = (String) execution.getVariable("serviceModelName"); - onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid); - onapModelInformationEntity.setModelVersion(modelVersion); - onapModelInformationEntity.setModelUuid(modelUuid); - onapModelInformationEntity.setModelName(modelName); - } - return onapModelInformationEntity; - } - - protected OnapModelInformationEntity getOnapNetworkModelInformationEntity(DelegateExecution execution) { - OnapModelInformationEntity onapModelInformationEntity = new OnapModelInformationEntity(); - { - String modelInvariantUuid = (String) execution.getVariable("resourceInvariantUUID"); - String modelVersion = (String) execution.getVariable("modelVersion"); - String modelUuid = (String) execution.getVariable("resourceUUID"); - String modelName = (String) execution.getVariable("resourceType"); - onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid); - onapModelInformationEntity.setModelVersion(modelVersion); - onapModelInformationEntity.setModelUuid(modelUuid); - onapModelInformationEntity.setModelName(modelName); - } - return onapModelInformationEntity; - } - - protected List getParamEntities(Map inputs) { - List paramEntityList = new ArrayList<>(); - if (inputs != null && !inputs.isEmpty()) { - inputs.keySet().forEach(key -> { - ParamEntity paramEntity = new ParamEntity(); - paramEntity.setName(key); - paramEntity.setValue(inputs.get(key)); - paramEntityList.add(paramEntity); - }); - } - return paramEntityList; - } - - protected RequestInformationEntity getRequestInformationEntity(DelegateExecution execution) { - RequestInformationEntity requestInformationEntity = new RequestInformationEntity(); - { - requestInformationEntity.setRequestId(getRequestId(execution)); - requestInformationEntity.setRequestAction(getRequestActoin(execution)); - } - return requestInformationEntity; - } - - protected ServiceInformationEntity getServiceInformationEntity(DelegateExecution execution) { - ServiceInformationEntity serviceInformationEntity = new ServiceInformationEntity(); - serviceInformationEntity.setServiceId((String) execution.getVariable("serviceInstanceId")); - serviceInformationEntity.setSubscriptionServiceType((String) execution.getVariable("serviceType")); - serviceInformationEntity.setOnapModelInformation(getOnapServiceModelInformationEntity(execution)); - serviceInformationEntity.setServiceInstanceId((String) execution.getVariable("serviceInstanceId")); - serviceInformationEntity.setGlobalCustomerId((String) execution.getVariable("globalSubscriberId")); - return serviceInformationEntity; - } - - protected String getServiceInstanceName(DelegateExecution execution) { - return (String) execution.getVariable("serviceInstanceName"); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java deleted file mode 100644 index c558247dea..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java +++ /dev/null @@ -1,91 +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.bpmn.infrastructure.workflow.serviceTask.client.builder; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.*; - -import java.util.List; -import java.util.Map; - -public class NetworkRpcInputEntityBuilder extends AbstractBuilder, RpcNetworkTopologyOperationInputEntity> { - - @Override - public RpcNetworkTopologyOperationInputEntity build(DelegateExecution execution, Map inputs) { - RpcNetworkTopologyOperationInputEntity rpcNetworkTopologyOperationInputEntity = new RpcNetworkTopologyOperationInputEntity(); - NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = getNetworkTopologyOperationInputEntity(execution, inputs); - rpcNetworkTopologyOperationInputEntity.setInput(networkTopologyOperationInputEntity); - return rpcNetworkTopologyOperationInputEntity; - } - - private void loadNetwrokRequestInputEntity(Map inputs, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) { - NetworkRequestInputEntity networkRequestInputEntity = new NetworkRequestInputEntity(); - { - NetworkInputPaarametersEntity networkInputPaarametersEntity = new NetworkInputPaarametersEntity(); - { - List paramEntityList = getParamEntities(inputs); - networkInputPaarametersEntity.setParamList(paramEntityList); - } - networkRequestInputEntity.setNetworkInputPaarameters(networkInputPaarametersEntity); - } - networkTopologyOperationInputEntity.setNetworkRequestInput(networkRequestInputEntity); - } - - private void loadRequestInformationEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) { - RequestInformationEntity requestInformationEntity = getRequestInformationEntity(execution); - networkTopologyOperationInputEntity.setRequestInformation(requestInformationEntity); - } - - private void loadSdncRequestHeaderEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) { - SdncRequestHeaderEntity sdncRequestHeaderEntity = new SdncRequestHeaderEntity(); - { - sdncRequestHeaderEntity.setSvcRequestId(getRequestId(execution)); - sdncRequestHeaderEntity.setSvcAction(getSvcAction(execution)); - } - networkTopologyOperationInputEntity.setSdncRequestHeader(sdncRequestHeaderEntity); - } - - private void loadServiceInformation(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) { - ServiceInformationEntity serviceInformationEntity = getServiceInformationEntity(execution); - networkTopologyOperationInputEntity.setServiceInformation(serviceInformationEntity); - } - - private NetworkTopologyOperationInputEntity getNetworkTopologyOperationInputEntity(DelegateExecution execution, Map inputs) { - NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = new NetworkTopologyOperationInputEntity(); - { - loadSdncRequestHeaderEntity(networkTopologyOperationInputEntity, execution); - loadRequestInformationEntity(networkTopologyOperationInputEntity, execution); - loadServiceInformation(networkTopologyOperationInputEntity, execution); - loadNetworkInformationEntity(execution, networkTopologyOperationInputEntity); - loadNetwrokRequestInputEntity(inputs, networkTopologyOperationInputEntity); - } - return networkTopologyOperationInputEntity; - } - - private void loadNetworkInformationEntity(DelegateExecution execution, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) { - NetworkInformationEntity networkInformationEntity = new NetworkInformationEntity(); - { - OnapModelInformationEntity onapModelInformationEntity = getOnapNetworkModelInformationEntity(execution); - networkInformationEntity.setOnapModelInformation(onapModelInformationEntity); - } - networkTopologyOperationInputEntity.setNetworkInformation(networkInformationEntity); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.java deleted file mode 100644 index d451c3ef02..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.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========================================================= - */ - -package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.*; - -import java.util.List; -import java.util.Map; - -public class ServiceRpcInputEntityBuilder extends AbstractBuilder, RpcServiceTopologyOperationInputEntity> { - @Override - public RpcServiceTopologyOperationInputEntity build(DelegateExecution execution, Map inputs) throws Exception { - RpcServiceTopologyOperationInputEntity rpcServiceTopologyOperationInputEntity = new RpcServiceTopologyOperationInputEntity(); - ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity = new ServiceTopologyOperationInputEntity(); - { - loadSdncRequestHeaderEntity(serviceTopologyOperationInputEntity, execution); - loadRequestInformationEntity(serviceTopologyOperationInputEntity, execution); - loadServiceInformation(serviceTopologyOperationInputEntity, execution); - loadServiceRequestInputEntity(serviceTopologyOperationInputEntity, execution); - } - rpcServiceTopologyOperationInputEntity.setServiceTopologyOperationInputEntity(serviceTopologyOperationInputEntity); - return rpcServiceTopologyOperationInputEntity; - } - - private void loadServiceRequestInputEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) { - ServiceRequestInputEntity serviceRequestInputEntity = getServiceRequestInputEntity(execution); - serviceTopologyOperationInputEntity.setServiceRequestInput(serviceRequestInputEntity); - } - - private ServiceRequestInputEntity getServiceRequestInputEntity(DelegateExecution execution) { - ServiceRequestInputEntity serviceRequestInputEntity = new ServiceRequestInputEntity(); - serviceRequestInputEntity.setServiceInstanceName(getServiceInstanceName(execution)); - return serviceRequestInputEntity; - } - - private ServiceInputParametersEntity getServiceInputParametersEntity(Map inputs) { - List paramEntityList = getParamEntities(inputs); - ServiceInputParametersEntity serviceInputParametersEntity = new ServiceInputParametersEntity(); - serviceInputParametersEntity.setParamList(paramEntityList); - return serviceInputParametersEntity; - } - - private void loadServiceInformation(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) { - ServiceInformationEntity serviceInformationEntity = getServiceInformationEntity(execution); - serviceTopologyOperationInputEntity.setServiceInformation(serviceInformationEntity); - } - - private void loadRequestInformationEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) { - RequestInformationEntity requestInformationEntity = getRequestInformationEntity(execution); - serviceTopologyOperationInputEntity.setRequestInformation(requestInformationEntity); - } - - private void loadSdncRequestHeaderEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) { - SdncRequestHeaderEntity sdncRequestHeaderEntity = new SdncRequestHeaderEntity(); - { - sdncRequestHeaderEntity.setSvcRequestId(getRequestId(execution)); - sdncRequestHeaderEntity.setSvcAction(getSvcAction(execution)); - } - serviceTopologyOperationInputEntity.setSdncRequestHeader(sdncRequestHeaderEntity); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java deleted file mode 100644 index ce92e31003..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class NetworkInformationEntity { - @JsonProperty("GENERIC-RESOURCE-API:network-id") - private String networkId; - - @JsonProperty("GENERIC-RESOURCE-API:network-type") - private String networkType; - - @JsonProperty("GENERIC-RESOURCE-API:onap-model-information") - private OnapModelInformationEntity onapModelInformation; - - public String getNetworkId() { - return networkId; - } - - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - - public String getNetworkType() { - return networkType; - } - - public void setNetworkType(String networkType) { - this.networkType = networkType; - } - - public OnapModelInformationEntity getOnapModelInformation() { - return onapModelInformation; - } - - public void setOnapModelInformation(OnapModelInformationEntity onapModelInformation) { - this.onapModelInformation = onapModelInformation; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputPaarametersEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputPaarametersEntity.java deleted file mode 100644 index e455bdb4c8..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputPaarametersEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.List; - -public class NetworkInputPaarametersEntity { - public List getParamList() { - return paramList; - } - - public void setParamList(List paramList) { - this.paramList = paramList; - } - - @JsonProperty("GENERIC-RESOURCE-API:param") - private List paramList; -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java deleted file mode 100644 index b0733f70c4..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.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========================================================= - */ - -package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class NetworkRequestInputEntity { - @JsonProperty("GENERIC-RESOURCE-API:network-name") - private String networkName; - - @JsonProperty("GENERIC-RESOURCE-API:tenant") - private String tenant; - - @JsonProperty("GENERIC-RESOURCE-API:aic-cloud-region") - private String aicCloudRegion; - - @JsonProperty("GENERIC-RESOURCE-API:aic-clli") - private String aicClli; - - @JsonProperty("GENERIC-RESOURCE-API:network-input-parameters") - private NetworkInputPaarametersEntity networkInputPaarameters; - - public String getNetworkName() { - return networkName; - } - - public void setNetworkName(String networkName) { - this.networkName = networkName; - } - - public String getTenant() { - return tenant; - } - - public void setTenant(String tenant) { - this.tenant = tenant; - } - - public String getAicCloudRegion() { - return aicCloudRegion; - } - - public void setAicCloudRegion(String aicCloudRegion) { - this.aicCloudRegion = aicCloudRegion; - } - - public String getAicClli() { - return aicClli; - } - - public void setAicClli(String aicClli) { - this.aicClli = aicClli; - } - - public NetworkInputPaarametersEntity getNetworkInputPaarameters() { - return networkInputPaarameters; - } - - public void setNetworkInputPaarameters(NetworkInputPaarametersEntity networkInputPaarameters) { - this.networkInputPaarameters = networkInputPaarameters; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java deleted file mode 100644 index c8b2a2d182..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java +++ /dev/null @@ -1,47 +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.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class NetworkResponseInformationEntity { - @JsonProperty("GENERIC-RESOURCE-API:instance-id") - private String instanceId; - - @JsonProperty("GENERIC-RESOURCE-API:object-path") - private String objectPath; - - public String getInstanceId() { - return instanceId; - } - - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - - public String getObjectPath() { - return objectPath; - } - - public void setObjectPath(String objectPath) { - this.objectPath = objectPath; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java deleted file mode 100644 index 3c776ebec3..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.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========================================================= - */ - -package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class NetworkTopologyOperationInputEntity { - @JsonProperty("GENERIC-RESOURCE-API:sdnc-request-header") - private SdncRequestHeaderEntity sdncRequestHeader; - - @JsonProperty("GENERIC-RESOURCE-API:request-information") - private RequestInformationEntity requestInformation; - - @JsonProperty("GENERIC-RESOURCE-API:service-information") - private ServiceInformationEntity serviceInformation; - - @JsonProperty("GENERIC-RESOURCE-API:network-information") - private NetworkInformationEntity networkInformation; - - @JsonProperty("GENERIC-RESOURCE-API:network-request-input") - private NetworkRequestInputEntity networkRequestInput; - - public SdncRequestHeaderEntity getSdncRequestHeader() { - return sdncRequestHeader; - } - - public void setSdncRequestHeader(SdncRequestHeaderEntity sdncRequestHeader) { - this.sdncRequestHeader = sdncRequestHeader; - } - - public RequestInformationEntity getRequestInformation() { - return requestInformation; - } - - public void setRequestInformation(RequestInformationEntity requestInformation) { - this.requestInformation = requestInformation; - } - - public ServiceInformationEntity getServiceInformation() { - return serviceInformation; - } - - public void setServiceInformation(ServiceInformationEntity serviceInformation) { - this.serviceInformation = serviceInformation; - } - - public NetworkInformationEntity getNetworkInformation() { - return networkInformation; - } - - public void setNetworkInformation(NetworkInformationEntity networkInformation) { - this.networkInformation = networkInformation; - } - - public NetworkRequestInputEntity getNetworkRequestInput() { - return networkRequestInput; - } - - public void setNetworkRequestInput(NetworkRequestInputEntity networkRequestInput) { - this.networkRequestInput = networkRequestInput; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java deleted file mode 100644 index b13df33291..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java +++ /dev/null @@ -1,91 +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.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class NetworkTopologyOperationOutputEntity { - @JsonProperty("GENERIC-RESOURCE-API:svc-request-id") - private String svcRequestId; - - @JsonProperty("GENERIC-RESOURCE-API:response-code") - private String responseCode; - - @JsonProperty("GENERIC-RESOURCE-API:response-message") - private String responseMessage; - - @JsonProperty("GENERIC-RESOURCE-API:ack-final-indicator") - private String ackFinalIndicator; - - @JsonProperty("GENERIC-RESOURCE-API:network-response-information") - private NetworkResponseInformationEntity networkResponseInformation; - - @JsonProperty("GENERIC-RESOURCE-API:service-response-information") - private ServiceResponseInformationEntity serviceResponseInformation; - - public String getSvcRequestId() { - return svcRequestId; - } - - public void setSvcRequestId(String svcRequestId) { - this.svcRequestId = svcRequestId; - } - - public String getResponseCode() { - return responseCode; - } - - public void setResponseCode(String responseCode) { - this.responseCode = responseCode; - } - - public String getResponseMessage() { - return responseMessage; - } - - public void setResponseMessage(String responseMessage) { - this.responseMessage = responseMessage; - } - - public String getAckFinalIndicator() { - return ackFinalIndicator; - } - - public void setAckFinalIndicator(String ackFinalIndicator) { - this.ackFinalIndicator = ackFinalIndicator; - } - - public NetworkResponseInformationEntity getNetworkResponseInformation() { - return networkResponseInformation; - } - - public void setNetworkResponseInformation(NetworkResponseInformationEntity networkResponseInformation) { - this.networkResponseInformation = networkResponseInformation; - } - - public ServiceResponseInformationEntity getServiceResponseInformation() { - return serviceResponseInformation; - } - - public void setServiceResponseInformation(ServiceResponseInformationEntity serviceResponseInformation) { - this.serviceResponseInformation = serviceResponseInformation; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java deleted file mode 100644 index 6580efea4d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.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========================================================= - */ - -package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class OnapModelInformationEntity { - @JsonProperty("GENERIC-RESOURCE-API:model-invariant-uuid") - private String modelInvariantUuid; - - @JsonProperty("GENERIC-RESOURCE-API:model-customization-uuid") - private String modelCustomizationUuid; - - @JsonProperty("GENERIC-RESOURCE-API:model-uuid") - private String modelUuid; - - @JsonProperty("GENERIC-RESOURCE-API:model-version") - private String modelVersion; - - @JsonProperty("GENERIC-RESOURCE-API:model-name") - private String modelName; - - public String getModelInvariantUuid() { - return modelInvariantUuid; - } - - public void setModelInvariantUuid(String modelInvariantUuid) { - this.modelInvariantUuid = modelInvariantUuid; - } - - public String getModelCustomizationUuid() { - return modelCustomizationUuid; - } - - public void setModelCustomizationUuid(String modelCustomizationUuid) { - this.modelCustomizationUuid = modelCustomizationUuid; - } - - public String getModelUuid() { - return modelUuid; - } - - public void setModelUuid(String modelUuid) { - this.modelUuid = modelUuid; - } - - public String getModelVersion() { - return modelVersion; - } - - public void setModelVersion(String modelVersion) { - this.modelVersion = modelVersion; - } - - public String getModelName() { - return modelName; - } - - public void setModelName(String modelName) { - this.modelName = modelName; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java deleted file mode 100644 index 3b9241b93d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java +++ /dev/null @@ -1,47 +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.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class ParamEntity { - @JsonProperty("GENERIC-RESOURCE-API:name") - private String name; - - @JsonProperty("GENERIC-RESOURCE-API:value") - private String value; - - 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; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java deleted file mode 100644 index 934a1978b4..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java +++ /dev/null @@ -1,91 +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.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class RequestInformationEntity { - public String getRequestId() { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public String getRequestAction() { - return requestAction; - } - - public void setRequestAction(String requestAction) { - this.requestAction = requestAction; - } - - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - - public String getNotificationUrl() { - return notificationUrl; - } - - public void setNotificationUrl(String notificationUrl) { - this.notificationUrl = notificationUrl; - } - - public String getOrderUnmber() { - return orderUnmber; - } - - public void setOrderUnmber(String orderUnmber) { - this.orderUnmber = orderUnmber; - } - - public String getOrerVersion() { - return orerVersion; - } - - public void setOrerVersion(String orerVersion) { - this.orerVersion = orerVersion; - } - - @JsonProperty("GENERIC-RESOURCE-API:request-id") - private String requestId; - - @JsonProperty("GENERIC-RESOURCE-API:request-action") - private String requestAction; - - @JsonProperty("GENERIC-RESOURCE-API:source") - private String source; - - @JsonProperty("GENERIC-RESOURCE-API:notification-url") - private String notificationUrl; - - @JsonProperty("GENERIC-RESOURCE-API:order-number") - private String orderUnmber; - - @JsonProperty("GENERIC-RESOURCE-API:order-version") - private String orerVersion; -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java deleted file mode 100644 index 914bbf5dbe..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class RpcNetworkTopologyOperationInputEntity { - public NetworkTopologyOperationInputEntity getInput() { - return input; - } - - public void setInput(NetworkTopologyOperationInputEntity input) { - this.input = input; - } - - @JsonProperty("GENERIC-RESOURCE-API:input") - private NetworkTopologyOperationInputEntity input = null; -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java deleted file mode 100644 index 92312db24a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class RpcNetworkTopologyOperationOutputEntity { - public NetworkTopologyOperationOutputEntity getOutput() { - return output; - } - - public void setOutput(NetworkTopologyOperationOutputEntity output) { - this.output = output; - } - - @JsonProperty("GENERIC-RESOURCE-API:output") - private NetworkTopologyOperationOutputEntity output; -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java deleted file mode 100644 index 05eedc79b1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class RpcServiceTopologyOperationInputEntity { - public ServiceTopologyOperationInputEntity getServiceTopologyOperationInputEntity() { - return serviceTopologyOperationInputEntity; - } - - public void setServiceTopologyOperationInputEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity) { - this.serviceTopologyOperationInputEntity = serviceTopologyOperationInputEntity; - } - - @JsonProperty("GENERIC-RESOURCE-API:input") - private ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity; -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java deleted file mode 100644 index 2e0362bdd2..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class RpcServiceTopologyOperationOutputEntity { - @JsonProperty("GENERIC-RESOURCE-API:output") - private ServiceTopologyOperationOutputEntity output; - - public ServiceTopologyOperationOutputEntity getOutput() { - return output; - } - - public void setOutput(ServiceTopologyOperationOutputEntity output) { - this.output = output; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java deleted file mode 100644 index 49d3d52911..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class SdncRequestHeaderEntity { - @JsonProperty("GENERIC-RESOURCE-API:svc-request-id") - private String svcRequestId; - - @JsonProperty("GENERIC-RESOURCE-API:svc-action") - private String svcAction; - - @JsonProperty("GENERIC-RESOURCE-API:svc-notification-url") - private String svcNotificationUrl; - - public String getSvcRequestId() { - return svcRequestId; - } - - public void setSvcRequestId(String svcRequestId) { - this.svcRequestId = svcRequestId; - } - - public String getSvcAction() { - return svcAction; - } - - public void setSvcAction(String svcAction) { - this.svcAction = svcAction; - } - - public String getSvcNotificationUrl() { - return svcNotificationUrl; - } - - public void setSvcNotificationUrl(String svcNotificationUrl) { - this.svcNotificationUrl = svcNotificationUrl; - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java deleted file mode 100644 index f1b1561a4f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java +++ /dev/null @@ -1,91 +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.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class ServiceInformationEntity { - @JsonProperty("GENERIC-RESOURCE-API:service-id") - private String serviceId; - - @JsonProperty("GENERIC-RESOURCE-API:subscription-service-type") - private String subscriptionServiceType; - - @JsonProperty("GENERIC-RESOURCE-API:onap-model-information") - private OnapModelInformationEntity onapModelInformation; - - @JsonProperty("GENERIC-RESOURCE-API:service-instance-id") - private String serviceInstanceId; - - @JsonProperty("GENERIC-RESOURCE-API:global-customer-id") - private String globalCustomerId; - - @JsonProperty("GENERIC-RESOURCE-API:subscriber-name") - private String subscriberName; - - public String getServiceId() { - return serviceId; - } - - public void setServiceId(String serviceId) { - this.serviceId = serviceId; - } - - public String getSubscriptionServiceType() { - return subscriptionServiceType; - } - - public void setSubscriptionServiceType(String subscriptionServiceType) { - this.subscriptionServiceType = subscriptionServiceType; - } - - public OnapModelInformationEntity getOnapModelInformation() { - return onapModelInformation; - } - - public void setOnapModelInformation(OnapModelInformationEntity onapModelInformation) { - this.onapModelInformation = onapModelInformation; - } - - public String getServiceInstanceId() { - return serviceInstanceId; - } - - public void setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } - - public String getGlobalCustomerId() { - return globalCustomerId; - } - - public void setGlobalCustomerId(String globalCustomerId) { - this.globalCustomerId = globalCustomerId; - } - - public String getSubscriberName() { - return subscriberName; - } - - public void setSubscriberName(String subscriberName) { - this.subscriberName = subscriberName; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java deleted file mode 100644 index f708aa6b18..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.List; - -public class ServiceInputParametersEntity { - public List getParamList() { - return paramList; - } - - public void setParamList(List paramList) { - this.paramList = paramList; - } - - @JsonProperty("GENERIC-RESOURCE-API:param") - private List paramList; -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java deleted file mode 100644 index bf88fb9f20..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class ServiceRequestInputEntity { - - @JsonProperty("GENERIC-RESOURCE-API:service-instance-name") - private String serviceInstanceName; - - @JsonProperty("GENERIC-RESOURCE-API:service-input-parameters") - private ServiceInputParametersEntity serviceInputParametersEntity; - - public String getServiceInstanceName() { - return serviceInstanceName; - } - - public void setServiceInstanceName(String serviceInstanceName) { - this.serviceInstanceName = serviceInstanceName; - } - - public ServiceInputParametersEntity getServiceInputParametersEntity() { - return serviceInputParametersEntity; - } - - public void setServiceInputParametersEntity(ServiceInputParametersEntity serviceInputParametersEntity) { - this.serviceInputParametersEntity = serviceInputParametersEntity; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java deleted file mode 100644 index 090aaf6ed1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java +++ /dev/null @@ -1,47 +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.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class ServiceResponseInformationEntity { - @JsonProperty("GENERIC-RESOURCE-API:instance-id") - private String instanceId; - - @JsonProperty("GENERIC-RESOURCE-API:object-path") - private String objectPath; - - public String getInstanceId() { - return instanceId; - } - - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - - public String getObjectPath() { - return objectPath; - } - - public void setObjectPath(String objectPath) { - this.objectPath = objectPath; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java deleted file mode 100644 index 6e399dc43d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class ServiceTopologyOperationInputEntity { - @JsonProperty("GENERIC-RESOURCE-API:sdnc-request-header") - private SdncRequestHeaderEntity sdncRequestHeader; - - @JsonProperty("GENERIC-RESOURCE-API:request-information") - private RequestInformationEntity requestInformation; - - @JsonProperty("GENERIC-RESOURCE-API:service-information") - private ServiceInformationEntity serviceInformation; - - @JsonProperty("GENERIC-RESOURCE-API:service-request-input") - private ServiceRequestInputEntity serviceRequestInput; - - public SdncRequestHeaderEntity getSdncRequestHeader() { - return sdncRequestHeader; - } - - public void setSdncRequestHeader(SdncRequestHeaderEntity sdncRequestHeader) { - this.sdncRequestHeader = sdncRequestHeader; - } - - public RequestInformationEntity getRequestInformation() { - return requestInformation; - } - - public void setRequestInformation(RequestInformationEntity requestInformation) { - this.requestInformation = requestInformation; - } - - public ServiceInformationEntity getServiceInformation() { - return serviceInformation; - } - - public void setServiceInformation(ServiceInformationEntity serviceInformation) { - this.serviceInformation = serviceInformation; - } - - public ServiceRequestInputEntity getServiceRequestInput() { - return serviceRequestInput; - } - - public void setServiceRequestInput(ServiceRequestInputEntity serviceRequestInput) { - this.serviceRequestInput = serviceRequestInput; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java deleted file mode 100644 index 8ad6a5347f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.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========================================================= - */ - -package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class ServiceTopologyOperationOutputEntity { - @JsonProperty("GENERIC-RESOURCE-API:svc-request-id") - private String svcRequestId; - - @JsonProperty("GENERIC-RESOURCE-API:response-code") - private String responseCode; - - @JsonProperty("GENERIC-RESOURCE-API:response-message") - private String responseMessage; - - @JsonProperty("GENERIC-RESOURCE-API:ack-final-indicator") - private String ackFinalIndicator; - - @JsonProperty("GENERIC-RESOURCE-API:service-response-information") - private ServiceResponseInformationEntity serviceResponseInformation; - - public String getSvcRequestId() { - return svcRequestId; - } - - public void setSvcRequestId(String svcRequestId) { - this.svcRequestId = svcRequestId; - } - - public String getResponseCode() { - return responseCode; - } - - public void setResponseCode(String responseCode) { - this.responseCode = responseCode; - } - - public String getResponseMessage() { - return responseMessage; - } - - public void setResponseMessage(String responseMessage) { - this.responseMessage = responseMessage; - } - - public String getAckFinalIndicator() { - return ackFinalIndicator; - } - - public void setAckFinalIndicator(String ackFinalIndicator) { - this.ackFinalIndicator = ackFinalIndicator; - } - - public ServiceResponseInformationEntity getServiceResponseInformation() { - return serviceResponseInformation; - } - - public void setServiceResponseInformation(ServiceResponseInformationEntity serviceResponseInformation) { - this.serviceResponseInformation = serviceResponseInformation; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/persistence.xml b/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index 8e87f47ddc..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - java:jboss/datasources/ProcessEngine - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/processes.xml b/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/processes.xml deleted file mode 100644 index 3e81a6a136..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/processes.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration - java:jboss/datasources/ProcessEngine - - full - true - true - true - true - - - - - - org.camunda.bpm.application.impl.event.ProcessApplicationEventListenerPlugin - - - - - org.camunda.spin.plugin.impl.SpinProcessEnginePlugin - - - - - org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin - - - - org.openecomp.mso.bpmn.core.plugins.LoggingAndURNMappingPlugin - - - - - org.openecomp.mso.bpmn.core.plugins.WorkflowExceptionPlugin - - - - - - - - - - default - - false - true - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/dmaap.properties b/bpmn/MSOInfrastructureBPMN/src/main/resources/dmaap.properties deleted file mode 100644 index a1286b056c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/dmaap.properties +++ /dev/null @@ -1,8 +0,0 @@ -protocol=http -uriPathPrefix = events -eventReadyTopicName=unauthenticated.PNF_READY -consumerId=consumerId -consumerGroup=group -clientThreadDelayInSeconds=5 - -pnfDefaultTimeout=P14D diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/logback.xml b/bpmn/MSOInfrastructureBPMN/src/main/resources/logback.xml deleted file mode 100644 index 7c9e0282d4..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/logback.xml +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${logDirectory}/${auditLogName}${jboss.server.name}.log - - ${logDirectory}/${auditLogName}${jboss.server.name}.log.%d - - - - ${auditPattern} - - - - 256 - - - - - ${logDirectory}/${metricsLogName}${jboss.server.name}.log - - ${logDirectory}/${metricsLogName}${jboss.server.name}.log.%d - - - - - ${metricPattern} - - - - - - 256 - - - - - ${logDirectory}/${errorLogName}${jboss.server.name}.log - - ${logDirectory}/${errorLogName}${jboss.server.name}.log.%d - - - - INFO - - - ${errorPattern} - - - - - 256 - - - - - ${debugLogDirectory}/${debugLogName}${jboss.server.name}.log - - ${debugLogDirectory}/${debugLogName}${jboss.server.name}.log.%d - - - - ${debugPattern} - - - - - 256 - - true - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CompareModelofE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CompareModelofE2EServiceInstance.bpmn deleted file mode 100644 index 7aecd23cb2..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CompareModelofE2EServiceInstance.bpmn +++ /dev/null @@ -1,335 +0,0 @@ - - - - - SequenceFlow_0s2spoq - - - - SequenceFlow_1dsbjjb - SequenceFlow_1yay321 - - - - SequenceFlow_1dsbjjb - - - - SequenceFlow_1yay321 - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0tm7z1o - SequenceFlow_0klbpxx - - - SequenceFlow_0yayvrf - - - SequenceFlow_0s2spoq - SequenceFlow_0tm7z1o - - - - - SequenceFlow_0e1r62n - - - - SequenceFlow_1ysapam - - - SequenceFlow_0n9pexp - SequenceFlow_01umodj - - - - - - - - - - - - SequenceFlow_01umodj - SequenceFlow_1ysapam - - - SequenceFlow_0e1r62n - SequenceFlow_0n9pexp - - - - - - - - - SequenceFlow_0klbpxx - SequenceFlow_12jdmq5 - - - - SequenceFlow_12jdmq5 - SequenceFlow_1fueo69 - SequenceFlow_0y8s0kd - - - SequenceFlow_1fueo69 - - - - - - - - - - - - - - - - - - SequenceFlow_0a01ez6 - SequenceFlow_0yayvrf - - - - - SequenceFlow_0y8s0kd - SequenceFlow_0a01ez6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateActivateSDNCResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateActivateSDNCResource.bpmn deleted file mode 100644 index f3c629f9db..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateActivateSDNCResource.bpmn +++ /dev/null @@ -1,393 +0,0 @@ - - - - - SequenceFlow_1qo2pln - - - - - SequenceFlow_18l3crb - SequenceFlow_0khtova - - - - SequenceFlow_17md60u - - - - - - - - - - - - - SequenceFlow_15mvedq - SequenceFlow_1xk5xed - - - - - SequenceFlow_1afu5al - SequenceFlow_0ow44q0 - - - - - - SequenceFlow_1qo2pln - SequenceFlow_0w2es8j - - - - SequenceFlow_0w2es8j - SequenceFlow_18l3crb - - - - - - SequenceFlow_0khtova - SequenceFlow_1mz0vdx - - - - SequenceFlow_0ruppyi - SequenceFlow_1jr6zi0 - - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1mz0vdx - SequenceFlow_15mvedq - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1jr6zi0 - SequenceFlow_10cy2nu - - - - SequenceFlow_0ow44q0 - SequenceFlow_17md60u - - - - - SequenceFlow_10cy2nu - SequenceFlow_0rp0tdn - - - - - SequenceFlow_0s3vc50 - SequenceFlow_05adaey - - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_05adaey - SequenceFlow_1afu5al - - - - - - - - - - - - - - - SequenceFlow_0rp0tdn - SequenceFlow_1efgf9m - - - - - SequenceFlow_1xk5xed - SequenceFlow_0ruppyi - - - - SequenceFlow_1efgf9m - SequenceFlow_0s3vc50 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn deleted file mode 100644 index 8f2bf67b71..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn +++ /dev/null @@ -1,325 +0,0 @@ - - - - - - - - - - - - - - - - - - #{!aaiContainsInfoAboutPnf} - - - - - - - - - #{!aaiContainsInfoAboutIp} - - - #{aaiContainsInfoAboutPnf} - - - #{aaiContainsInfoAboutIp} - - - SequenceFlow_0p09qgm - - - SequenceFlow_1miyzfe - - - - SequenceFlow_1h6yz62 - - - SequenceFlow_0j5ksz1 - - - - SequenceFlow_0967g8p - SequenceFlow_1j4r3zt - - - SequenceFlow_1j4r3zt - SequenceFlow_1l1t6ak - SequenceFlow_0v5ffpe - - - SequenceFlow_0v5ffpe - SequenceFlow_1qr6cmf - - - SequenceFlow_1l1t6ak - SequenceFlow_1h6yz62 - SequenceFlow_1ls8pua - - - SequenceFlow_1qr6cmf - SequenceFlow_1ls8pua - SequenceFlow_17s9025 - - - SequenceFlow_17s9025 - SequenceFlow_1o8od8e - - - SequenceFlow_1o8od8e - SequenceFlow_0p09qgm - - - SequenceFlow_1kc34bc - - #{timeoutForPnfEntryNotification} - - - - SequenceFlow_1kc34bc - SequenceFlow_1miyzfe - - - SequenceFlow_0j5ksz1 - SequenceFlow_0967g8p - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustom3rdONAPServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustom3rdONAPServiceInstance.bpmn deleted file mode 100644 index 7bc2a404f0..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustom3rdONAPServiceInstance.bpmn +++ /dev/null @@ -1,389 +0,0 @@ - - - - - SequenceFlow_0s2spoq - - - - SequenceFlow_1dsbjjb - SequenceFlow_1yay321 - import org.openecomp.mso.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() ex.processJavaException(execution) - - - SequenceFlow_1dsbjjb - - - - SequenceFlow_1yay321 - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_19eilro - SequenceFlow_0klbpxx - - - SequenceFlow_0yayvrf - - - SequenceFlow_0s2spoq - SequenceFlow_0z4faf9 - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi= new CreateCustomE2EServiceInstance() -csi.preProcessRequest(execution) - - - SequenceFlow_14zu6wr - SequenceFlow_0je30si - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new CreateCustomE2EServiceInstance() -csi.prepareCompletionRequest(execution) - - - - - - - - - - - SequenceFlow_0je30si - SequenceFlow_0yayvrf - - - - SequenceFlow_0e1r62n - - - - SequenceFlow_1ysapam - - - SequenceFlow_0n9pexp - SequenceFlow_01umodj - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new CreateCustomE2EServiceInstance() -csi.prepareFalloutRequest(execution) - - - - - - - - - - - SequenceFlow_01umodj - SequenceFlow_1ysapam - - - SequenceFlow_0e1r62n - SequenceFlow_0n9pexp - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new CreateCustomE2EServiceInstance() -csi.sendSyncError(execution) - - - - - - - - SequenceFlow_081z8l2 - SequenceFlow_19eilro - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new CreateCustomE2EServiceInstance() -csi.sendSyncResponse(execution) - - - SequenceFlow_0klbpxx - SequenceFlow_14zu6wr - SequenceFlow_1fueo69 - - - SequenceFlow_1fueo69 - - - - - - - - - #{execution.getVariable("WorkflowException") == null} - - - - #{execution.getVariable("WorkflowException") != null} - - - - SequenceFlow_0z4faf9 - SequenceFlow_1euqjsp - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi= new CreateCustomE2EServiceInstance() -csi.prepareInitServiceOperationStatus(execution) - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1euqjsp - SequenceFlow_081z8l2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn deleted file mode 100644 index 71f4a28c88..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn +++ /dev/null @@ -1,391 +0,0 @@ - - - - - SequenceFlow_0s2spoq - - - - SequenceFlow_1dsbjjb - SequenceFlow_1yay321 - - - - SequenceFlow_1dsbjjb - - - - SequenceFlow_1yay321 - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_19eilro - SequenceFlow_0klbpxx - - - SequenceFlow_0yayvrf - - - SequenceFlow_0s2spoq - SequenceFlow_0z4faf9 - - - - SequenceFlow_14zu6wr - SequenceFlow_0je30si - - - - - - - - - - - - SequenceFlow_0je30si - SequenceFlow_0yayvrf - - - - SequenceFlow_0e1r62n - - - - SequenceFlow_1ysapam - - - SequenceFlow_0n9pexp - SequenceFlow_01umodj - - - - - - - - - - - - SequenceFlow_01umodj - SequenceFlow_1ysapam - - - SequenceFlow_0e1r62n - SequenceFlow_0n9pexp - - - - - - - - - SequenceFlow_081z8l2 - SequenceFlow_19eilro - - - - SequenceFlow_0klbpxx - SequenceFlow_14zu6wr - SequenceFlow_1fueo69 - - - SequenceFlow_1fueo69 - - - - - - - - - - - - - - - - - SequenceFlow_0z4faf9 - SequenceFlow_1euqjsp - - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1euqjsp - SequenceFlow_081z8l2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn deleted file mode 100644 index 6088fda4a3..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn +++ /dev/null @@ -1,452 +0,0 @@ - - - - - SequenceFlow_0lp2z7l - - - - SequenceFlow_10 - SequenceFlow_14 - - - - - SequenceFlow_10 - - - - - SequenceFlow_14 - - - - - - - - - - - - - - - - - - - - SequenceFlow_1hjh5zy - SequenceFlow_1lj31zp - - - SequenceFlow_095crcd - - - - SequenceFlow_0lp2z7l - SequenceFlow_0ktadna - - - - - SequenceFlow_1o4wwba - SequenceFlow_0xxvjxq - - - - - - - - - - - - SequenceFlow_0xxvjxq - SequenceFlow_095crcd - - - - - SequenceFlow_0n4umjf - - - - SequenceFlow_1ghqolv - - - SequenceFlow_14eadeb - SequenceFlow_1reso2f - - - - - - - - - - - - SequenceFlow_1reso2f - SequenceFlow_1ghqolv - - - - - - SequenceFlow_0n4umjf - SequenceFlow_14eadeb - - - - - - - SequenceFlow_0ktadna - SequenceFlow_16vhtu8 - - - - - SequenceFlow_1lj31zp - SequenceFlow_1o4wwba - SequenceFlow_1mdnv3l - - - SequenceFlow_1mdnv3l - - - - - - - - - - SequenceFlow_16vhtu8 - - - - - SequenceFlow_1tfe975 - - - - SequenceFlow_1hjh5zy - - - - SequenceFlow_14ajbme - - - - SequenceFlow_1tfe975 - SequenceFlow_0xhu1k3 - - - - - - - - - - - - SequenceFlow_0xhu1k3 - SequenceFlow_1o3ihrh - - - SequenceFlow_1o3ihrh - SequenceFlow_14ajbme - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateNetworkInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateNetworkInstance.bpmn deleted file mode 100644 index c9d4720628..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateNetworkInstance.bpmn +++ /dev/null @@ -1,340 +0,0 @@ - - - - - SequenceFlow_0lp2z7l - - - - SequenceFlow_10 - SequenceFlow_14 - - - - - SequenceFlow_10 - - - - - SequenceFlow_14 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0eto8sn - SequenceFlow_1lj31zp - - - SequenceFlow_0x3znm5 - - - SequenceFlow_095crcd - SequenceFlow_0x3znm5 - - - - - - SequenceFlow_0lp2z7l - SequenceFlow_1ablr60 - - - - - - SequenceFlow_1lj31zp - SequenceFlow_0xxvjxq - - - - - - - - - - - - SequenceFlow_0xxvjxq - SequenceFlow_095crcd - - - - - SequenceFlow_0n4umjf - - - - SequenceFlow_1ghqolv - - - SequenceFlow_0n4umjf - SequenceFlow_1s5niqb - - - - SequenceFlow_1s5niqb - SequenceFlow_1reso2f - - - - - - - - - - - - SequenceFlow_1reso2f - SequenceFlow_1ghqolv - - - - - - - - - - - SequenceFlow_1ablr60 - SequenceFlow_0rt8wax - - - - SequenceFlow_0rt8wax - SequenceFlow_0eto8sn - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateSDNCNetworkResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateSDNCNetworkResource.bpmn deleted file mode 100644 index 87248045a1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateSDNCNetworkResource.bpmn +++ /dev/null @@ -1,287 +0,0 @@ - - - - - SequenceFlow_1qo2pln - - - - - SequenceFlow_18l3crb - SequenceFlow_0khtova - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new CreateSDNCNetworkResource() -dcsi.prepareSDNCRequest(execution) - - - SequenceFlow_0auvfvm - - - - - - - - - - - - - SequenceFlow_15mvedq - SequenceFlow_1ex9ov6 - - - SequenceFlow_1ex9ov6 - SequenceFlow_1kzj1j5 - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new CreateSDNCNetworkResource() -dcsi.postCreateSDNCCall(execution) - - - - - SequenceFlow_1qo2pln - SequenceFlow_0w2es8j - String recipeParamXsdDemo="""{"operationType":"GRE"}""" -String recipeParamXsd="" -execution.setVariable("recipeParamXsd", recipeParamXsd) - - - SequenceFlow_0w2es8j - SequenceFlow_18l3crb - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new CreateSDNCNetworkResource() -dcsi.preProcessRequest(execution) - - - - - SequenceFlow_0khtova - SequenceFlow_1mz0vdx - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new CreateSDNCNetworkResource() -dcsi.prepareUpdateBeforeCreateSDNCResource(execution) - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1mz0vdx - SequenceFlow_15mvedq - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1kzj1j5 - SequenceFlow_0o7h0ag - - - SequenceFlow_1cd8ujq - SequenceFlow_0auvfvm - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new CreateSDNCNetworkResource() -csi.sendSyncResponse(execution) - - - SequenceFlow_0o7h0ag - SequenceFlow_1dww8ye - SequenceFlow_05m2j56 - - - #{(execution.getVariable("isActivateRequired") == "true")} - - - - - - SequenceFlow_05m2j56 - SequenceFlow_05niqbf - SequenceFlow_1cd8ujq - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new CreateSDNCNetworkResource() -dcsi.prepareUpdateAfterCreateSDNCResource(execution) - - - - - - - SequenceFlow_1dww8ye - SequenceFlow_05niqbf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVFCNSResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVFCNSResource.bpmn deleted file mode 100644 index 2370165354..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVFCNSResource.bpmn +++ /dev/null @@ -1,277 +0,0 @@ - - - - - SequenceFlow_1qo2pln - - - - - - SequenceFlow_0khtova - SequenceFlow_1uiz85h - - - - SequenceFlow_1qo2pln - SequenceFlow_0khtova - - - - createNSSuccess_SequenceFlow - SequenceFlow_1ywe21t - - - - SequenceFlow_1uiz85h - createNSSuccess_SequenceFlow - createNSFailed_SequenceFlow - - - - - - - - - SequenceFlow_1ywe21t - instantiateFailed_SequenceFlow - instantiateSuccess_SequenceFlow - - - - - - - - - - SequenceFlow_0xqo13p - operationFinished_SequenceFlow - operationProcessing_SequenceFlow - - - - - - - - - - createNSFailed_SequenceFlow - - - instantiateFailed_SequenceFlow - - - SequenceFlow_1lwqmo9 - - - instantiateSuccess_SequenceFlow - SequenceFlow_1gsbpxj - SequenceFlow_0xqo13p - - - - operationFinished_SequenceFlow - SequenceFlow_0cq2q6g - - - - - operationProcessing_SequenceFlow - SequenceFlow_1gsbpxj - - - - - SequenceFlow_0cq2q6g - SequenceFlow_1lwqmo9 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn deleted file mode 100644 index 876f91ff42..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn +++ /dev/null @@ -1,1538 +0,0 @@ - - - - - SequenceFlow_7 - SequenceFlow_3 - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_7 - - - - - SequenceFlow_1eu60rt - - - - SequenceFlow_0afe2pg - SequenceFlow_29 - - - - - - - - - - - - - - - SequenceFlow_29 - SequenceFlow_8 - - - - SequenceFlow_8 - SequenceFlow_6 - - - - - SequenceFlow_6 - - - - - SequenceFlow_2 - - - - SequenceFlow_5 - - - - SequenceFlow_2 - SequenceFlow_5 - - - - - - SequenceFlow_12ilko1 - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0j6sjye - SequenceFlow_1ky2sv9 - - - SequenceFlow_3 - - - - - SequenceFlow_0zq7i3q - SequenceFlow_0zpbskl - SequenceFlow_0dhf2js - - - SequenceFlow_0zq7i3q - - - - SequenceFlow_0zpbskl - SequenceFlow_1sx5llu - SequenceFlow_02o4yqx - - - SequenceFlow_0t3mtod - SequenceFlow_19mxskt - SequenceFlow_1sl79hn - - - - - - - - - - - SequenceFlow_0807ukc - SequenceFlow_19yywk8 - - - SequenceFlow_19yywk8 - - - SequenceFlow_0jg47xm - SequenceFlow_0807ukc - - - - - - - - - - - - - - - - - - - - SequenceFlow_1a7e8l1 - SequenceFlow_1f1hd3l - - - SequenceFlow_1sx5llu - SequenceFlow_0dhf2js - SequenceFlow_1rabks0 - SequenceFlow_0jg47xm - - - - - - - SequenceFlow_19mxskt - SequenceFlow_17cz98f - SequenceFlow_0sezboq - SequenceFlow_1a7e8l1 - - - - - SequenceFlow_1f1hd3l - SequenceFlow_0sezboq - SequenceFlow_1mbymcu - SequenceFlow_00by7l7 - SequenceFlow_1lv5ld6 - - - SequenceFlow_02o4yqx - SequenceFlow_0ftzjjm - - - - SequenceFlow_0dvsqpp - SequenceFlow_1rabks0 - - - - - SequenceFlow_12dakwh - SequenceFlow_0orpdrl - SequenceFlow_0ya1cr3 - - - - - - - - - - SequenceFlow_0orpdrl - SequenceFlow_1t3cnnx - - - SequenceFlow_0ya1cr3 - SequenceFlow_1sim44y - SequenceFlow_027lz43 - - - - - - - - SequenceFlow_027lz43 - SequenceFlow_1kpdu1j - SequenceFlow_007p8k3 - - - SequenceFlow_1kpdu1j - SequenceFlow_1quvahv - SequenceFlow_0t3mtod - - - - SequenceFlow_1t3cnnx - SequenceFlow_1sim44y - SequenceFlow_0dr2fem - - - - - - - SequenceFlow_1mpsdaj - SequenceFlow_1quvahv - SequenceFlow_1mbymcu - - - - - - - SequenceFlow_0ftzjjm - SequenceFlow_12dakwh - SequenceFlow_09nn9a9 - - - - - SequenceFlow_1lv5ld6 - SequenceFlow_09nn9a9 - SequenceFlow_0dr2fem - SequenceFlow_0dvsqpp - - - - - - - - - - - - - - - - - SequenceFlow_1sl79hn - SequenceFlow_0ne9n0g - - - - - - SequenceFlow_0ne9n0g - SequenceFlow_00by7l7 - SequenceFlow_17cz98f - - - - - - - - - - - - - - - - - - SequenceFlow_007p8k3 - SequenceFlow_1mpsdaj - - - - - - - - SequenceFlow_15odbkz - SequenceFlow_0j6sjye - - - - SequenceFlow_12ilko1 - SequenceFlow_0afe2pg - - - - - - SequenceFlow_1jbuf1t - - - - - - - - ${URN_mso_adapters_db_endpoint} - - - - application/soap+xml - #{BasicAuthHeaderValueDB} - - - POST - - soap-http-connector - - - SequenceFlow_0vj46ej - SequenceFlow_0sjpja4 - - - SequenceFlow_1ky2sv9 - SequenceFlow_0vj46ej - - - - - - - - - - - - - - SequenceFlow_00h6hmd - SequenceFlow_17g05fd - - - SequenceFlow_1eu60rt - SequenceFlow_00h6hmd - - - - - - SequenceFlow_0x9pjgm - SequenceFlow_1kgaq0j - - - - SequenceFlow_0x9pjgm - - - - - SequenceFlow_1kgaq0j - SequenceFlow_0ofjahh - SequenceFlow_16qob4p - - - SequenceFlow_0ofjahh - SequenceFlow_1cgpklo - SequenceFlow_0o6tf9p - - - - - - - - SequenceFlow_15odbkz - - - - SequenceFlow_1db0ri1 - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_11efpvh - SequenceFlow_1jbuf1t - - - - - SequenceFlow_15vce9o - - - - SequenceFlow_0hwsm6n - - - - SequenceFlow_0yecpl2 - SequenceFlow_0loks1u - SequenceFlow_0b5ztoe - - - SequenceFlow_0loks1u - SequenceFlow_0e9e6fo - SequenceFlow_0hwsm6n - - - - - - - - SequenceFlow_15vce9o - SequenceFlow_0yecpl2 - - - - - - SequenceFlow_0o6tf9p - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0ws7fjn - SequenceFlow_1mkdhw9 - - - SequenceFlow_0p75l97 - SequenceFlow_0ws7fjn - - - - SequenceFlow_1ufio7c - - - - SequenceFlow_0aza7xq - - - - SequenceFlow_0aza7xq - SequenceFlow_0p75l97 - SequenceFlow_13iuk3s - - - SequenceFlow_13iuk3s - SequenceFlow_0k5vcuu - SequenceFlow_1ufio7c - - - - in 1702 scope only one VNF will be created - - - 0}]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_16qob4p - SequenceFlow_1cgpklo - - - - SequenceFlow_17g05fd - SequenceFlow_11efpvh - - - - - SequenceFlow_1mkdhw9 - SequenceFlow_0k5vcuu - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0b5ztoe - SequenceFlow_0e9e6fo - - - - SequenceFlow_0sjpja4 - SequenceFlow_1db0ri1 - - ${aaiDistDelay} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn deleted file mode 100644 index 99b1ff51e9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn +++ /dev/null @@ -1,1443 +0,0 @@ - - - - - SequenceFlow_7 - SequenceFlow_3 - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_7 - - - - - SequenceFlow_1eu60rt - - - - SequenceFlow_0afe2pg - SequenceFlow_29 - - - - - - - - - - - - - - - SequenceFlow_29 - SequenceFlow_8 - - - - SequenceFlow_8 - SequenceFlow_6 - - - - - SequenceFlow_6 - - - - - SequenceFlow_2 - - - - SequenceFlow_5 - - - - SequenceFlow_2 - SequenceFlow_5 - - - - - - SequenceFlow_12ilko1 - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0j6sjye - SequenceFlow_1ky2sv9 - - - SequenceFlow_3 - - - - - SequenceFlow_0zq7i3q - SequenceFlow_0zpbskl - SequenceFlow_0dhf2js - - - SequenceFlow_0zq7i3q - - - - SequenceFlow_0zpbskl - SequenceFlow_1sx5llu - SequenceFlow_02o4yqx - - - SequenceFlow_0t3mtod - SequenceFlow_19mxskt - SequenceFlow_1sl79hn - - - - - - - - - - - SequenceFlow_0807ukc - SequenceFlow_19yywk8 - - - SequenceFlow_19yywk8 - - - SequenceFlow_0jg47xm - SequenceFlow_0807ukc - - - - - - - - - - - - - - - - - - - - SequenceFlow_1a7e8l1 - SequenceFlow_1f1hd3l - - - SequenceFlow_1sx5llu - SequenceFlow_0dhf2js - SequenceFlow_1rabks0 - SequenceFlow_0jg47xm - - - - - - - SequenceFlow_19mxskt - SequenceFlow_17cz98f - SequenceFlow_0sezboq - SequenceFlow_1a7e8l1 - - - - - SequenceFlow_1f1hd3l - SequenceFlow_0sezboq - SequenceFlow_1mbymcu - SequenceFlow_00by7l7 - SequenceFlow_1lv5ld6 - - - SequenceFlow_02o4yqx - SequenceFlow_0ftzjjm - - - - SequenceFlow_0dvsqpp - SequenceFlow_1rabks0 - - - - - SequenceFlow_12dakwh - SequenceFlow_0orpdrl - SequenceFlow_0ya1cr3 - - - - - - - - - - SequenceFlow_0orpdrl - SequenceFlow_1t3cnnx - - - SequenceFlow_0ya1cr3 - SequenceFlow_1sim44y - SequenceFlow_027lz43 - - - - - - - - SequenceFlow_027lz43 - SequenceFlow_1kpdu1j - SequenceFlow_007p8k3 - - - SequenceFlow_1kpdu1j - SequenceFlow_1quvahv - SequenceFlow_0t3mtod - - - - SequenceFlow_1t3cnnx - SequenceFlow_1sim44y - SequenceFlow_0dr2fem - - - - - - - SequenceFlow_1mpsdaj - SequenceFlow_1quvahv - SequenceFlow_1mbymcu - - - - - - - SequenceFlow_0ftzjjm - SequenceFlow_12dakwh - SequenceFlow_09nn9a9 - - - - - SequenceFlow_1lv5ld6 - SequenceFlow_09nn9a9 - SequenceFlow_0dr2fem - SequenceFlow_0dvsqpp - - - - - - - - - - - - - - - - - SequenceFlow_1sl79hn - SequenceFlow_0ne9n0g - - - - - - SequenceFlow_0ne9n0g - SequenceFlow_00by7l7 - SequenceFlow_17cz98f - - - - - - - - - - - - - - - - - - SequenceFlow_007p8k3 - SequenceFlow_1mpsdaj - - - - - - - - SequenceFlow_15odbkz - SequenceFlow_0j6sjye - - - - SequenceFlow_12ilko1 - SequenceFlow_0afe2pg - - - - - - SequenceFlow_1jbuf1t - - - - - - - - ${URN_mso_adapters_db_endpoint} - - - - application/soap+xml - #{BasicAuthHeaderValueDB} - - - POST - - soap-http-connector - - - SequenceFlow_0vj46ej - SequenceFlow_0sjpja4 - - - SequenceFlow_1ky2sv9 - SequenceFlow_0vj46ej - - - - - - - - - - - - - - SequenceFlow_00h6hmd - SequenceFlow_17g05fd - - - SequenceFlow_1eu60rt - SequenceFlow_00h6hmd - - - - - - SequenceFlow_0x9pjgm - SequenceFlow_1kgaq0j - - - - SequenceFlow_0x9pjgm - - - - - SequenceFlow_1kgaq0j - SequenceFlow_0ofjahh - SequenceFlow_16qob4p - - - SequenceFlow_0ofjahh - SequenceFlow_1cgpklo - SequenceFlow_0o6tf9p - - - - - - - - SequenceFlow_15odbkz - - - - SequenceFlow_1db0ri1 - - - - - - - - - - - - - - - - - - SequenceFlow_11efpvh - SequenceFlow_1jbuf1t - - - - - SequenceFlow_0gj4vud - - - - SequenceFlow_0clhseq - - - - SequenceFlow_0o6tf9p - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0ws7fjn - SequenceFlow_1mkdhw9 - - - SequenceFlow_0p75l97 - SequenceFlow_0ws7fjn - - - - SequenceFlow_1ufio7c - - - - SequenceFlow_0aza7xq - - - - SequenceFlow_0aza7xq - SequenceFlow_0p75l97 - SequenceFlow_13iuk3s - - - SequenceFlow_13iuk3s - SequenceFlow_0k5vcuu - SequenceFlow_1ufio7c - - - - in 1702 scope only one VNF will be created - - - 0}]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_16qob4p - SequenceFlow_1cgpklo - - - - SequenceFlow_17g05fd - SequenceFlow_11efpvh - - - - - SequenceFlow_1mkdhw9 - SequenceFlow_0k5vcuu - - - - - SequenceFlow_0sjpja4 - SequenceFlow_1db0ri1 - - ${aaiDistDelay} - - - - - - - - - - - - - SequenceFlow_0gj4vud - SequenceFlow_0clhseq - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn deleted file mode 100644 index c0c2f26035..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn +++ /dev/null @@ -1,699 +0,0 @@ - - - - - SequenceFlow_1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_1y7d5qk - SequenceFlow_1vx081s - SequenceFlow_4 - - - SequenceFlow_3 - SequenceFlow_0e2ta6w - - - - SequenceFlow_4 - - - - - SequenceFlow_5 - - - - - SequenceFlow_5 - SequenceFlow_6 - - - - - - - ${URN_mso_adapters_openecomp_db_endpoint} - - - application/soap+xml - #{BasicAuthHeaderValueDB} - - - ${CVFMI_updateInfraRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_6 - SequenceFlow_1crl7uf - - - - SequenceFlow_0td7d9m - SequenceFlow_0u8zesf - SequenceFlow_12 - - - - - - - - - - - - - SequenceFlow_12 - SequenceFlow_14 - - - SequenceFlow_1crl7uf - updateInfraRequestResponseBad - updateInfraRequestResponseGood - - - - - - - updateInfraRequestResponseBad - - - - - SequenceFlow_0wsgnab - - - - - - - - - - SequenceFlow_10 - SequenceFlow_11 - - - - SequenceFlow_11 - - - - SequenceFlow_018p5wf - SequenceFlow_10 - - - - - - - SequenceFlow_0wsgnab - SequenceFlow_018p5wf - - - - - SequenceFlow_14 - SequenceFlow_16 - - - - SequenceFlow_16 - - - - - - SequenceFlow_15 - - - - - SequenceFlow_15 - - - - SequenceFlow_1 - SequenceFlow_3 - - - - - - SequenceFlow_1qvgrvq - SequenceFlow_1jqizzo - - - - SequenceFlow_1jqizzo - - - SequenceFlow_1qvgrvq - - - - - - - - - - - - - - - - - - - - SequenceFlow_1xggje5 - SequenceFlow_07llpjo - - - - SequenceFlow_07llpjo - SequenceFlow_1vx081s - SequenceFlow_0nszq2o - - - - - SequenceFlow_0nszq2o - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_09i6f7t - SequenceFlow_1tk5ru7 - - - - SequenceFlow_1tk5ru7 - SequenceFlow_0td7d9m - SequenceFlow_0h5cld9 - - - - - SequenceFlow_0h5cld9 - - - - - - - SequenceFlow_1b7348f - SequenceFlow_1xggje5 - SequenceFlow_1y7d5qk - - - - - - - updateInfraRequestResponseGood - SequenceFlow_020dbkp - SequenceFlow_0u8zesf - - - - - - - - SequenceFlow_0e2ta6w - SequenceFlow_1b7348f - - - - - SequenceFlow_020dbkp - SequenceFlow_09i6f7t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleVolumeInfraV1.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleVolumeInfraV1.bpmn deleted file mode 100644 index 111b6c7032..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleVolumeInfraV1.bpmn +++ /dev/null @@ -1,514 +0,0 @@ - - - - - SequenceFlow_1 - - - - - SequenceFlow_1tfi3sp - - - - SequenceFlow_1tfi3sp - SequenceFlow_0x34g02 - SequenceFlow_1q9kksk - - - SequenceFlow_0x34g02 - SequenceFlow_22 - - - - - SequenceFlow_1v1jx7y - SequenceFlow_18 - - - - - - - - - - - - - - SequenceFlow_18 - SequenceFlow_19 - - - - SequenceFlow_19 - - - - SequenceFlow_1q9kksk - SequenceFlow_1cu5t8k - SequenceFlow_1tfh1vm - - - SequenceFlow_1tfh1vm - SequenceFlow_0b1nrfk - - - - - - - - - - - - - - SequenceFlow_0b1nrfk - SequenceFlow_08vm13o - - - SequenceFlow_08vm13o - SequenceFlow_097zy8w - - - - SequenceFlow_22 - SequenceFlow_1cu5t8k - SequenceFlow_097zy8w - SequenceFlow_1v1jx7y - - - - - - - - - - - - - - - - - SequenceFlow_1 - SequenceFlow_4 - - - - - SequenceFlow_4 - SequenceFlow_3 - - - - - SequenceFlow_3 - SequenceFlow_volGrpNamePresent - SequenceFlow_volGrpNameMissing - - - - - - - SequenceFlow_volGrpNameMissing - SequenceFlow_7 - - - - - SequenceFlow_7 - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_volGrpNamePresent - SequenceFlow_0djjra2 - - - SequenceFlow_12 - SequenceFlow_13 - - - - - - - - - - - - - SequenceFlow_11 - SequenceFlow_12 - - - - SequenceFlow_8 - SequenceFlow_11 - - - - - - - - ${URN_mso_adapters_openecomp_db_endpoint} - ${CVMVINFRAV1_createDBRequest} - - - application/soap+xml - #{BasicAuthHeaderValueDB} - - - POST - ${response} - ${statusCode} - - http-connector - - - SequenceFlow_6 - SequenceFlow_8 - - - - SequenceFlow_13 - - - - SequenceFlow_0djjra2 - SequenceFlow_6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVnfInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVnfInfra.bpmn deleted file mode 100644 index 441e684b89..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVnfInfra.bpmn +++ /dev/null @@ -1,340 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_2 - - - - - SequenceFlow_2 - SequenceFlow_3 - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0ed0uiq - SequenceFlow_0w0m5fr - - - - SequenceFlow_8 - SequenceFlow_9 - - - - - SequenceFlow_9 - - - SequenceFlow_8 - - - - - - - - - - - - SequenceFlow_13 - SequenceFlow_14 - - - - SequenceFlow_15 - SequenceFlow_13 - - - - - SequenceFlow_14 - - - - SequenceFlow_12 - SequenceFlow_15 - - - - - SequenceFlow_12 - - - - - - SequenceFlow_01mjjk3 - SequenceFlow_16 - - - - - SequenceFlow_17 - - - - - - - - - - SequenceFlow_16 - SequenceFlow_17 - - - - - SequenceFlow_3 - SequenceFlow_0ed0uiq - - - - - - - SequenceFlow_0w0m5fr - SequenceFlow_0s4i7px - - - - SequenceFlow_0s4i7px - SequenceFlow_01mjjk3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustom3rdONAPServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustom3rdONAPServiceInstance.bpmn deleted file mode 100644 index d33cb3edff..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustom3rdONAPServiceInstance.bpmn +++ /dev/null @@ -1,381 +0,0 @@ - - - - - SequenceFlow_1wxumid - - - - SequenceFlow_0guajy5 - SequenceFlow_0dbt753 - import org.openecomp.mso.bpmn.common.scripts.* -ExceptionUtil ex = new ExceptionUtil() -ex.processJavaException(execution) - - - SequenceFlow_0guajy5 - - - - SequenceFlow_0dbt753 - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0zf2qyk - SequenceFlow_07hrbs0 - - - SequenceFlow_1ab5l2q - - - SequenceFlow_1wxumid - SequenceFlow_0yowshs - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi= new DeleteCustomE2EServiceInstance() -csi.preProcessRequest(execution) - - - SequenceFlow_04urx2e - SequenceFlow_1ii935p - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new DeleteCustomE2EServiceInstance() -csi.prepareCompletionRequest(execution) - - - - - - - - - - - SequenceFlow_1ii935p - SequenceFlow_1ab5l2q - - - - SequenceFlow_0for83z - - - - SequenceFlow_0hrazlh - - - SequenceFlow_1s1cbgf - SequenceFlow_1py6yqz - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new DeleteCustomE2EServiceInstance() -csi.prepareFalloutRequest(execution) - - - - - - - - - - - SequenceFlow_1py6yqz - SequenceFlow_0hrazlh - - - SequenceFlow_0for83z - SequenceFlow_1s1cbgf - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new DeleteCustomE2EServiceInstance() -csi.sendSyncError(execution) - - - - - - - - SequenceFlow_1dkcu9o - SequenceFlow_0zf2qyk - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new DeleteCustomE2EServiceInstance() -csi.sendSyncResponse(execution) - - - SequenceFlow_07hrbs0 - SequenceFlow_04urx2e - SequenceFlow_1t6ekab - - - SequenceFlow_1t6ekab - - - - - - - - - #{execution.getVariable("WorkflowException") == null} - - - - - - SequenceFlow_0yowshs - SequenceFlow_0c4t26p - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi= new DeleteCustomE2EServiceInstance() -csi.prepareInitServiceOperationStatus(execution) - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_0c4t26p - SequenceFlow_1dkcu9o - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn deleted file mode 100644 index e0747eb32e..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn +++ /dev/null @@ -1,381 +0,0 @@ - - - - - SequenceFlow_1wxumid - - - - SequenceFlow_0guajy5 - SequenceFlow_0dbt753 - - - - SequenceFlow_0guajy5 - - - - SequenceFlow_0dbt753 - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0zf2qyk - SequenceFlow_07hrbs0 - - - SequenceFlow_1ab5l2q - - - SequenceFlow_1wxumid - SequenceFlow_0yowshs - - - - SequenceFlow_04urx2e - SequenceFlow_1ii935p - - - - - - - - - - - - SequenceFlow_1ii935p - SequenceFlow_1ab5l2q - - - - SequenceFlow_0for83z - - - - SequenceFlow_0hrazlh - - - SequenceFlow_1s1cbgf - SequenceFlow_1py6yqz - - - - - - - - - - - - SequenceFlow_1py6yqz - SequenceFlow_0hrazlh - - - SequenceFlow_0for83z - SequenceFlow_1s1cbgf - - - - - - - - - SequenceFlow_1dkcu9o - SequenceFlow_0zf2qyk - - - - SequenceFlow_07hrbs0 - SequenceFlow_04urx2e - SequenceFlow_1t6ekab - - - SequenceFlow_1t6ekab - - - - - - - - - - - - - - - SequenceFlow_0yowshs - SequenceFlow_0c4t26p - - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_0c4t26p - SequenceFlow_1dkcu9o - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteGenericALaCarteServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteGenericALaCarteServiceInstance.bpmn deleted file mode 100644 index ceb0c72218..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteGenericALaCarteServiceInstance.bpmn +++ /dev/null @@ -1,331 +0,0 @@ - - - - - SequenceFlow_0lp2z7l - - - - SequenceFlow_10 - SequenceFlow_14 - - - - - SequenceFlow_10 - - - - - SequenceFlow_14 - - - - - - - - - - - - - - - - - - SequenceFlow_0eto8sn - SequenceFlow_1lj31zp - - - SequenceFlow_095crcd - - - - SequenceFlow_0lp2z7l - SequenceFlow_0ktadna - - - - - SequenceFlow_1qjygj5 - SequenceFlow_0xxvjxq - - - - - - - - - - - - SequenceFlow_0xxvjxq - SequenceFlow_095crcd - - - - - SequenceFlow_0n4umjf - - - - SequenceFlow_1ghqolv - - - SequenceFlow_14eadeb - SequenceFlow_1reso2f - - - - - - - - - - - - SequenceFlow_1reso2f - SequenceFlow_1ghqolv - - - - - - SequenceFlow_0n4umjf - SequenceFlow_14eadeb - - - - - - - - SequenceFlow_0ktadna - SequenceFlow_0eto8sn - - - - - SequenceFlow_1lj31zp - SequenceFlow_1qjygj5 - SequenceFlow_0hgiouk - - - - - - SequenceFlow_0hgiouk - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteNetworkInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteNetworkInstance.bpmn deleted file mode 100644 index 1e868def58..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteNetworkInstance.bpmn +++ /dev/null @@ -1,371 +0,0 @@ - - - - - SequenceFlow_0lp2z7l - - - - SequenceFlow_10 - SequenceFlow_14 - - - - - SequenceFlow_10 - - - - - SequenceFlow_14 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0eto8sn - SequenceFlow_1lj31zp - - - SequenceFlow_0x3znm5 - - - SequenceFlow_095crcd - SequenceFlow_0x3znm5 - - - - - - SequenceFlow_0lp2z7l - SequenceFlow_1ablr60 - - - - - - SequenceFlow_1lj31zp - SequenceFlow_0xxvjxq - - - - - - - - - - - - SequenceFlow_0xxvjxq - SequenceFlow_095crcd - - - - - SequenceFlow_0n4umjf - - - - SequenceFlow_1ghqolv - - - SequenceFlow_0n4umjf - SequenceFlow_1s5niqb - - - - - - - ${URN_mso_adapters_openecomp_db_endpoint} - ${DELNI_deleteDBRequest} - - - application/soap+xml - #{BasicAuthHeaderValueDB} - - - POST - ${response} - ${statusCode} - - http-connector - - - SequenceFlow_1s5niqb - SequenceFlow_06s5eu4 - - - SequenceFlow_06s5eu4 - SequenceFlow_1reso2f - - - - - - - - - - - - SequenceFlow_1reso2f - SequenceFlow_1ghqolv - - - - - - - - - - - - SequenceFlow_1ablr60 - SequenceFlow_0rt8wax - - - - SequenceFlow_0rt8wax - SequenceFlow_0eto8sn - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn deleted file mode 100644 index 216b67a8bb..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn +++ /dev/null @@ -1,258 +0,0 @@ - - - - - SequenceFlow_1qo2pln - - - - - SequenceFlow_18l3crb - SequenceFlow_0khtova - - - - SequenceFlow_15wux6a - - - - - - - - - - - - - SequenceFlow_15mvedq - SequenceFlow_1xk5xed - - - - - SequenceFlow_1vnx1pp - SequenceFlow_0ow44q0 - - - - - - SequenceFlow_1qo2pln - SequenceFlow_0w2es8j - - - - SequenceFlow_0w2es8j - SequenceFlow_18l3crb - - - - - - SequenceFlow_0khtova - SequenceFlow_1mz0vdx - - - - SequenceFlow_1xk5xed - SequenceFlow_1jr6zi0 - - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1mz0vdx - SequenceFlow_15mvedq - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1jr6zi0 - SequenceFlow_1vnx1pp - - - - - SequenceFlow_0ow44q0 - SequenceFlow_15wux6a - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVFCNSResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVFCNSResource.bpmn deleted file mode 100644 index 280ee85128..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVFCNSResource.bpmn +++ /dev/null @@ -1,166 +0,0 @@ - - - - - SequenceFlow_0x2e9we - - - - - - SequenceFlow_0jvtdhv - - - - SequenceFlow_0x2e9we - SequenceFlow_00vpfm3 - - - - SequenceFlow_1s4cyms - SequenceFlow_152xb4z - - - - - - - - - - - - - - - - SequenceFlow_00vpfm3 - SequenceFlow_1s4cyms - - - - SequenceFlow_0yro7o2 - - - - SequenceFlow_0p0ayci - - - SequenceFlow_0yro7o2 - SequenceFlow_0p0ayci - - - - - - - SequenceFlow_152xb4z - SequenceFlow_0jvtdhv - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn deleted file mode 100644 index e8b18e6dca..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn +++ /dev/null @@ -1,812 +0,0 @@ - - - - - SequenceFlow_7 - SequenceFlow_3 - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_7 - - - - - SequenceFlow_10o22u2 - - - - SequenceFlow_12ilko1 - SequenceFlow_29 - - - - - - - - - - - - - - - SequenceFlow_29 - SequenceFlow_8 - - - - SequenceFlow_8 - SequenceFlow_6 - - - - - SequenceFlow_6 - - - - - SequenceFlow_2 - - - - SequenceFlow_5 - - - - SequenceFlow_2 - SequenceFlow_5 - - - - - - SequenceFlow_12ilko1 - - - - - - - - - - - - - - - SequenceFlow_10o22u2 - SequenceFlow_04ao07f - - - SequenceFlow_3 - - - - - SequenceFlow_06llof4 - - - - - - - - - - - - SequenceFlow_0807ukc - SequenceFlow_19yywk8 - - - SequenceFlow_19yywk8 - - - SequenceFlow_06llof4 - SequenceFlow_0807ukc - - - - - - - - - - SequenceFlow_04ao07f - - - - - - - - - - - - - - SequenceFlow_0jek18q - SequenceFlow_1ttswdr - - - SequenceFlow_1ttswdr - SequenceFlow_18103ca - - - - SequenceFlow_0jek18q - - - - SequenceFlow_18103ca - - - - - - - - - - - - - - - - - - - - SequenceFlow_05cjs89 - SequenceFlow_0snq0kw - - - SequenceFlow_0zaircn - - - - SequenceFlow_09i2jj0 - - - - SequenceFlow_09i2jj0 - SequenceFlow_05cjs89 - SequenceFlow_03n4wb1 - - - SequenceFlow_0snq0kw - SequenceFlow_03n4wb1 - SequenceFlow_1jjh8rv - - - SequenceFlow_0xgpd0u - SequenceFlow_0nk8vsb - SequenceFlow_0npvfo3 - - - SequenceFlow_0nk8vsb - SequenceFlow_0et9p0i - SequenceFlow_0zaircn - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0npvfo3 - SequenceFlow_0et9p0i - - - - - - - - - - - - - - - - - - SequenceFlow_128485i - SequenceFlow_04fys47 - - - SequenceFlow_1yamcyn - SequenceFlow_19cxgtm - SequenceFlow_128485i - - - - SequenceFlow_1lfph6u - - - - SequenceFlow_1ofw0fi - - - - SequenceFlow_1ofw0fi - SequenceFlow_1yamcyn - SequenceFlow_0vq7f6b - - - SequenceFlow_0vq7f6b - SequenceFlow_10scc5r - SequenceFlow_1lfph6u - - - SequenceFlow_04fys47 - SequenceFlow_1o5cutr - - - - SequenceFlow_1o5cutr - SequenceFlow_19cxgtm - SequenceFlow_10scc5r - - - - - 0}]]> - - - - - - - - - - - SequenceFlow_1jjh8rv - - - - SequenceFlow_0xgpd0u - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleInfra.bpmn deleted file mode 100644 index 81e759b8a9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleInfra.bpmn +++ /dev/null @@ -1,331 +0,0 @@ - - - - - SequenceFlow_5 - SequenceFlow_2 - - - - - SequenceFlow_4 - SequenceFlow_5 - - - - - SequenceFlow_2 - SequenceFlow_9 - - - - - - - - - - - - - - - - - - SequenceFlow_9 - SequenceFlow_8 - - - - - - - - - - SequenceFlow_17 - SequenceFlow_14 - - - - SequenceFlow_6 - - - - SequenceFlow_14 - SequenceFlow_6 - - - - - SequenceFlow_13 - SequenceFlow_17 - - - - - - - - - ${URN_mso_adapters_openecomp_db_endpoint} - POST - - - application/soap+xml - #{BasicAuthHeaderValueDB} - - - ${DELVfModI_updateInfraRequest} - ${response} - ${statusCode} - - soap-http-connector - - - SequenceFlow_10 - SequenceFlow_13 - - - - SequenceFlow_8 - SequenceFlow_10 - - - - - - SequenceFlow_1 - - - - - SequenceFlow_1 - SequenceFlow_7 - - - - - - - - - - - SequenceFlow_7 - SequenceFlow_19 - - - SequenceFlow_19 - - - - - - SequenceFlow_12 - - - - SequenceFlow_12 - - - - - SequenceFlow_4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn deleted file mode 100644 index c7092ffb30..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn +++ /dev/null @@ -1,568 +0,0 @@ - - - - - SequenceFlow_1 - SequenceFlow_7 - - - - - SequenceFlow_1 - - - - SequenceFlow_7 - SequenceFlow_12 - - - - - SequenceFlow_12 - SequenceFlow_6 - - - - SequenceFlow_15 - SequenceFlow_2 - - - - - SequenceFlow_22 - - - - SequenceFlow_13 - SequenceFlow_15 - SequenceFlow_21 - - - - - - - - - - - - - - - - SequenceFlow_2 - SequenceFlow_5 - - - - SequenceFlow_8 - SequenceFlow_13 - - - - - SequenceFlow_21 - SequenceFlow_22 - - - - - - SequenceFlow_6 - SequenceFlow_4 - SequenceFlow_8 - - - - - - - SequenceFlow_4 - - - - - SequenceFlow_23 - - - - - SequenceFlow_23 - SequenceFlow_responseNotSent - SequenceFlow_responseSent - - - SequenceFlow_responseNotSent - SequenceFlow_14 - - - - - #{DELVfModVol_syncResponseSent == true} - - - SequenceFlow_responseSent - SequenceFlow_14 - SequenceFlow_25 - - - - - - - - - - - - - - - SequenceFlow_25 - SequenceFlow_19 - - - - SequenceFlow_19 - - - - - - SequenceFlow_35 - SequenceFlow_37 - - - - - SequenceFlow_27 - SequenceFlow_29 - - - - - SequenceFlow_10 - SequenceFlow_24 - - - - - - - - - - - - - - - SequenceFlow_29 - SequenceFlow_10 - - - - SequenceFlow_24 - - - - - - - ${URN_mso_adapters_openecomp_db_endpoint} - ${DELVfModVol_updateInfraRequest} - - - application/soap+xml - #{BasicAuthHeaderValueDB} - - - POST - ${response} - ${statusCode} - - http-connector - - - SequenceFlow_37 - SequenceFlow_27 - - - - SequenceFlow_vnfAdapterCallOK - SequenceFlow_35 - - - - - SequenceFlow_5 - SequenceFlow_vnfAdapterCallOK - SequenceFlow_vnfAdapterCallNotOK - - - #{VNFREST_SuccessIndicator == true} - - - SequenceFlow_vnfAdapterCallNotOK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVnfInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVnfInfra.bpmn deleted file mode 100644 index 95c0a727ce..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVnfInfra.bpmn +++ /dev/null @@ -1,353 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_2 - SequenceFlow_16ikne0 - - - - SequenceFlow_1 - SequenceFlow_2 - - - - - - SequenceFlow_15 - SequenceFlow_16 - - - - - - - - - - SequenceFlow_16 - SequenceFlow_17 - - - - SequenceFlow_17 - - - - SequenceFlow_14 - - - - - SequenceFlow_14 - SequenceFlow_15 - - - - - - - SequenceFlow_19 - - - SequenceFlow_18 - - - - - SequenceFlow_18 - SequenceFlow_19 - - - - - - SequenceFlow_0slfgmy - SequenceFlow_6 - - - - - - - - - - - SequenceFlow_6 - SequenceFlow_7 - - - - SequenceFlow_7 - - - - - - - - - SequenceFlow_00bhxtl - SequenceFlow_1f56g06 - - - SequenceFlow_16ikne0 - SequenceFlow_00o02cv - SequenceFlow_00bhxtl - - - - SequenceFlow_1f56g06 - SequenceFlow_0dy2xw0 - SequenceFlow_0slfgmy - - - - - - - - - - - - - - - SequenceFlow_00o02cv - SequenceFlow_0dy2xw0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ReplaceVnfInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ReplaceVnfInfra.bpmn deleted file mode 100644 index 0e849a8a7b..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ReplaceVnfInfra.bpmn +++ /dev/null @@ -1,1813 +0,0 @@ - - - - - SequenceFlow_5 - SequenceFlow_0y0jt4l - - - - - SequenceFlow_4 - SequenceFlow_5 - - - - - - - - - - - SequenceFlow_17 - SequenceFlow_14 - - - - SequenceFlow_6 - - - - SequenceFlow_14 - SequenceFlow_6 - - - - - SequenceFlow_3 - SequenceFlow_19rrss6 - SequenceFlow_17 - - - - - - SequenceFlow_1 - - - - - SequenceFlow_0ph6862 - SequenceFlow_7 - - - - - - - - - - - SequenceFlow_7 - SequenceFlow_19 - - - SequenceFlow_19 - - - - - - - - SequenceFlow_1 - SequenceFlow_0msgw6c - - - - SequenceFlow_0uhssvq - SequenceFlow_0ph6862 - - - - - - - - - - - - - - - - - SequenceFlow_0msgw6c - SequenceFlow_0uhssvq - - - - SequenceFlow_12 - - - - SequenceFlow_12 - - - - - SequenceFlow_4 - - - - - - - - - - - - - - - SequenceFlow_19ba94v - SequenceFlow_0gzzeru - - - - - - - - - - - - - SequenceFlow_0y0jt4l - SequenceFlow_1w35ov3 - - - - SequenceFlow_1w35ov3 - SequenceFlow_053qjfy - - - - - SequenceFlow_16mo99z - SequenceFlow_0jph3mt - SequenceFlow_2 - - - - - - - SequenceFlow_0baosqi - SequenceFlow_1nodcf9 - SequenceFlow_0k3fx7p - - - - SequenceFlow_19lg15d - SequenceFlow_0usoiza - SequenceFlow_12mfil6 - - - - SequenceFlow_14yy8v4 - SequenceFlow_0usxnlk - - - - - - - - - - SequenceFlow_0usxnlk - SequenceFlow_16mo99z - SequenceFlow_12hm1ks - - - - SequenceFlow_2 - SequenceFlow_0baosqi - SequenceFlow_0etr76r - - - - - - - - - - - - - - - - - - - - SequenceFlow_1cezgw4 - SequenceFlow_0v0u7mf - - - - SequenceFlow_1qr8msw - - - - - - - - - SequenceFlow_0k3fx7p - SequenceFlow_1bkhs8m - SequenceFlow_11b00u2 - - - - SequenceFlow_0xx8y1s - SequenceFlow_0qy68ib - SequenceFlow_1ck3v34 - - - - SequenceFlow_0a6pdza - SequenceFlow_0q0qan8 - SequenceFlow_079nix0 - - - - SequenceFlow_13h26h9 - SequenceFlow_1c0vdki - SequenceFlow_032i8t0 - - - - SequenceFlow_0gzzeru - SequenceFlow_0bxgny0 - SequenceFlow_1f0c5lj - - - - SequenceFlow_1uno5rs - SequenceFlow_162mm0m - SequenceFlow_17vwb2h - - - - SequenceFlow_1c79909 - SequenceFlow_197t3qk - SequenceFlow_0ba08lt - - - - SequenceFlow_1xfbwpi - SequenceFlow_19lg15d - SequenceFlow_1akvi72 - - - - SequenceFlow_12mfil6 - SequenceFlow_3 - SequenceFlow_1sdol24 - - - - SequenceFlow_0vpd06n - SequenceFlow_051zp79 - - - - SequenceFlow_0v0u7mf - SequenceFlow_0vpd06n - SequenceFlow_1qr8msw - SequenceFlow_05gpym3 - - - SequenceFlow_05gpym3 - SequenceFlow_051zp79 - SequenceFlow_1ei7at5 - SequenceFlow_0kg02xg - SequenceFlow_1i6p53b - SequenceFlow_1yy7o24 - SequenceFlow_0sqmtpl - SequenceFlow_1shdmrj - SequenceFlow_1v1i5w4 - SequenceFlow_1h8rscx - SequenceFlow_1xzq6jb - SequenceFlow_165q14c - SequenceFlow_0wp1a6g - SequenceFlow_0vymfh9 - - - - - - - SequenceFlow_1c0vdki - SequenceFlow_0aldwvz - SequenceFlow_19ba94v - - - - SequenceFlow_0bxgny0 - SequenceFlow_111z6w4 - SequenceFlow_1qm0ygo - - - - - - - - - - - - - - - - - - - - - SequenceFlow_1qm0ygo - SequenceFlow_0he2w4b - - - SequenceFlow_0he2w4b - SequenceFlow_04zwhw4 - SequenceFlow_0pfvulx - - - - - - - - - - - - - - - - - - - SequenceFlow_1bkhs8m - SequenceFlow_1qfjlt7 - SequenceFlow_0xx8y1s - - - - - - - - - - - - - - - - - - SequenceFlow_0qy68ib - SequenceFlow_0x7iupc - SequenceFlow_0a6pdza - - - - - - - - - - - - - - - - SequenceFlow_0q0qan8 - SequenceFlow_0hp0w6k - SequenceFlow_13h26h9 - - - - - - - - - - - - - - - - SequenceFlow_04zwhw4 - SequenceFlow_1lrbndo - SequenceFlow_1uno5rs - - - - - - - - - - - - - - - - - - SequenceFlow_162mm0m - SequenceFlow_14mblvp - SequenceFlow_1c79909 - - - SequenceFlow_12hm1ks - - - - SequenceFlow_0jph3mt - - - - SequenceFlow_0etr76r - - - - SequenceFlow_1nodcf9 - - - - SequenceFlow_11b00u2 - - - - - - - - - - - - - - - SequenceFlow_1qfjlt7 - - - - SequenceFlow_1ck3v34 - - - - SequenceFlow_0x7iupc - - - - SequenceFlow_079nix0 - - - - SequenceFlow_0hp0w6k - - - - SequenceFlow_032i8t0 - - - - - - - - - - - - - - - - SequenceFlow_0aldwvz - - - - SequenceFlow_1f0c5lj - - - - SequenceFlow_111z6w4 - - - - SequenceFlow_0pfvulx - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_197t3qk - SequenceFlow_18e0jz0 - SequenceFlow_1xfbwpi - - - SequenceFlow_1lrbndo - - - - SequenceFlow_17vwb2h - - - - SequenceFlow_14mblvp - - - - SequenceFlow_0ba08lt - - - - SequenceFlow_18e0jz0 - - - - SequenceFlow_1akvi72 - - - - SequenceFlow_0usoiza - - - - SequenceFlow_1sdol24 - - - - - - - - - - - - - - - - - - - - SequenceFlow_19rrss6 - - - - - SequenceFlow_1cezgw4 - - - - - SequenceFlow_1ei7at5 - - - - SequenceFlow_0kg02xg - - - - SequenceFlow_1i6p53b - - - - SequenceFlow_1yy7o24 - - - - SequenceFlow_0sqmtpl - - - - SequenceFlow_1shdmrj - - - - SequenceFlow_1v1i5w4 - - - - SequenceFlow_1h8rscx - - - - SequenceFlow_1xzq6jb - - - - SequenceFlow_165q14c - - - - SequenceFlow_0wp1a6g - - - - SequenceFlow_0vymfh9 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_053qjfy - SequenceFlow_14yy8v4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn deleted file mode 100644 index 4ce646273c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn +++ /dev/null @@ -1,379 +0,0 @@ - - - - - SequenceFlow_0c2denm - - - SequenceFlow_0c2denm - SequenceFlow_1ntnafv - - - - SequenceFlow_14zd9we - SequenceFlow_0er6ddi - - - - SequenceFlow_1fis1j1 - SequenceFlow_06f0dx5 - SequenceFlow_19b0pmt - - - SequenceFlow_06f0dx5 - SequenceFlow_1q6spfu - - - - - - - - - - - - SequenceFlow_1q6spfu - SequenceFlow_0mm4eqd - - - SequenceFlow_0mm4eqd - - - - - - - - - - - - - SequenceFlow_19b0pmt - - - - - SequenceFlow_04f826i - - - - SequenceFlow_1t2ijcu - - - SequenceFlow_09z92mf - SequenceFlow_1sooz22 - - - - SequenceFlow_04f826i - SequenceFlow_09z92mf - - - - - - - - - - - - - - - - SequenceFlow_1sooz22 - SequenceFlow_1t2ijcu - - - - - SequenceFlow_0gna7ys - SequenceFlow_0re5dm7 - - - - SequenceFlow_0gna7ys - - - - SequenceFlow_0re5dm7 - - - - - - - - - - - - - - - - - - - - SequenceFlow_0er6ddi - SequenceFlow_1fis1j1 - - - - - - SequenceFlow_1ntnafv - SequenceFlow_030pfun - - - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_030pfun - SequenceFlow_14zd9we - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/TestHelloWorld.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/TestHelloWorld.bpmn deleted file mode 100644 index 15399f4488..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/TestHelloWorld.bpmn +++ /dev/null @@ -1,52 +0,0 @@ - - - - - SequenceFlow_0bav304 - - - - SequenceFlow_02tq5ta - - - - SequenceFlow_0bav304 - SequenceFlow_02tq5ta - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn deleted file mode 100644 index b33187852f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn +++ /dev/null @@ -1,693 +0,0 @@ - - - - - SequenceFlow_0s2spoq - - - - SequenceFlow_1dsbjjb - SequenceFlow_1yay321 - - - - SequenceFlow_1dsbjjb - - - - SequenceFlow_1yay321 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_04qwbbf - SequenceFlow_0klbpxx - - - SequenceFlow_0yayvrf - - - SequenceFlow_0s2spoq - SequenceFlow_0az1n4y - - - - SequenceFlow_14zu6wr - SequenceFlow_0je30si - - - - - - - - - - - - SequenceFlow_0je30si - SequenceFlow_0yayvrf - - - - SequenceFlow_0e1r62n - - - - SequenceFlow_1ysapam - - - SequenceFlow_0n9pexp - SequenceFlow_01umodj - - - - - - - - - - - - SequenceFlow_01umodj - SequenceFlow_1ysapam - - - SequenceFlow_06o383f - SequenceFlow_0n9pexp - - - - - - - - SequenceFlow_0e1r62n - SequenceFlow_0t4nds2 - - - - - - - - ${URN_mso_openecomp_adapters_db_endpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_0t4nds2 - SequenceFlow_06o383f - - - - - SequenceFlow_12dou7o - SequenceFlow_0secadm - - - - SequenceFlow_0klbpxx - SequenceFlow_14zu6wr - SequenceFlow_1fueo69 - - - SequenceFlow_1fueo69 - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0az1n4y - SequenceFlow_1bd4711 - - - SequenceFlow_1bd4711 - SequenceFlow_03i6zhx - - - - - SequenceFlow_0xhbobd - SequenceFlow_0t7zinj - - - - SequenceFlow_03i6zhx - SequenceFlow_1pdv4qj - - - - - - - - - - - - - - - - SequenceFlow_1pdv4qj - SequenceFlow_0xhbobd - - - - - - SequenceFlow_0secadm - SequenceFlow_0zmd4rt - SequenceFlow_1n8h3zt - - - - SequenceFlow_04qwbbf - - - - - - SequenceFlow_0kvl23y - - - SequenceFlow_1bddzne - SequenceFlow_1e3vtyq - - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1e3vtyq - SequenceFlow_12dou7o - - - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1wzk6tu - SequenceFlow_0kvl23y - - - SequenceFlow_0t7zinj - - - - - SequenceFlow_1bddzne - - - - - SequenceFlow_1n8h3zt - SequenceFlow_1wzk6tu - - - - - SequenceFlow_0zmd4rt - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateNetworkInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateNetworkInstance.bpmn deleted file mode 100644 index a9d81d05bc..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateNetworkInstance.bpmn +++ /dev/null @@ -1,373 +0,0 @@ - - - - - SequenceFlow_0lp2z7l - - - - SequenceFlow_10 - SequenceFlow_14 - - - - - SequenceFlow_10 - - - - - SequenceFlow_14 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0eto8sn - SequenceFlow_1lj31zp - - - SequenceFlow_0x3znm5 - - - SequenceFlow_095crcd - SequenceFlow_0x3znm5 - - - - - - SequenceFlow_0lp2z7l - SequenceFlow_1ablr60 - - - - - - SequenceFlow_1lj31zp - SequenceFlow_0xxvjxq - - - - - - - - - - - - SequenceFlow_0xxvjxq - SequenceFlow_095crcd - - - - - SequenceFlow_0n4umjf - - - - SequenceFlow_1ghqolv - - - SequenceFlow_0n4umjf - SequenceFlow_1s5niqb - - - - - - - ${URN_mso_adapters_openecomp_db_endpoint} - ${UPDNI_createDBRequest} - - - application/soap+xml - #{BasicAuthHeaderValueDB} - - - POST - ${response} - ${statusCode} - - http-connector - - - SequenceFlow_1s5niqb - SequenceFlow_06s5eu4 - - - SequenceFlow_06s5eu4 - SequenceFlow_1reso2f - - - - - - - - - - - - SequenceFlow_1reso2f - SequenceFlow_1ghqolv - - - - - - - - - - - - SequenceFlow_1ablr60 - SequenceFlow_0rt8wax - - - - SequenceFlow_0rt8wax - SequenceFlow_0eto8sn - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleInfra.bpmn deleted file mode 100644 index fd554e0729..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleInfra.bpmn +++ /dev/null @@ -1,297 +0,0 @@ - - - - - SequenceFlow_5 - SequenceFlow_2 - - - - - SequenceFlow_4 - SequenceFlow_5 - - - - - SequenceFlow_2 - SequenceFlow_9 - - - - - - - - - - - SequenceFlow_17 - SequenceFlow_14 - - - - SequenceFlow_6 - - - - SequenceFlow_14 - SequenceFlow_6 - - - - - SequenceFlow_3 - SequenceFlow_17 - - - - - - SequenceFlow_1 - - - - - SequenceFlow_1 - SequenceFlow_7 - - - - - - - - - - - SequenceFlow_7 - SequenceFlow_19 - - - SequenceFlow_19 - - - - - - SequenceFlow_12 - - - - SequenceFlow_12 - - - - - SequenceFlow_4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_9 - SequenceFlow_3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleInfraV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleInfraV2.bpmn deleted file mode 100644 index ebdd459288..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleInfraV2.bpmn +++ /dev/null @@ -1,412 +0,0 @@ - - - - - SequenceFlow_07r1tup - - - - SequenceFlow_09izs9b - SequenceFlow_0gyzpu9 - - - - SequenceFlow_07r1tup - SequenceFlow_04cyigk - - - - SequenceFlow_04cyigk - SequenceFlow_09izs9b - - - - SequenceFlow_0gyzpu9 - SequenceFlow_16xzdgi - - - - SequenceFlow_1oa0jsk - SequenceFlow_1ozbxok - - - - SequenceFlow_1ozbxok - SequenceFlow_17c5hhe - - - - SequenceFlow_17c5hhe - SequenceFlow_1pqikpt - - - - SequenceFlow_1pqikpt - SequenceFlow_0m6q3pf - - - - SequenceFlow_0vj0wfl - SequenceFlow_0cskhwy - - - - SequenceFlow_0cskhwy - SequenceFlow_067f4jv - - - - SequenceFlow_067f4jv - SequenceFlow_1trqy93 - - - - SequenceFlow_1trqy93 - SequenceFlow_0fc550l - - - - SequenceFlow_0fc550l - SequenceFlow_1uquo5r - - - - - - - - - - - - - SequenceFlow_0m6q3pf - SequenceFlow_1ykv4yr - - - - SequenceFlow_1x3xeba - SequenceFlow_01yr04k - - - - SequenceFlow_1rfmnuo - SequenceFlow_0vj0wfl - - - - - - - - SequenceFlow_1uquo5r - - - - - - SequenceFlow_16xzdgi - SequenceFlow_1oa0jsk - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_1ykv4yr - SequenceFlow_1x3xeba - - - - - - - - - - - SequenceFlow_01yr04k - SequenceFlow_1rfmnuo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn deleted file mode 100644 index 7e5f41ba26..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn +++ /dev/null @@ -1,517 +0,0 @@ - - - - - SequenceFlow_1 - - - - - - - - - - - SequenceFlow_13 - SequenceFlow_14 - - - - - - - ${URN_mso_adapters_openecomp_db_endpoint} - ${UPDVfModVol_updateInfraRequest} - - - aapplication/soap+xml - #{BasicAuthHeaderValueDB} - - - POST - ${response} - ${statusCode} - - http-connector - - - SequenceFlow_11 - SequenceFlow_12 - - - - SequenceFlow_22 - SequenceFlow_21 - - - - - SequenceFlow_12 - SequenceFlow_13 - - - - - - - - - - - - - SequenceFlow_21 - SequenceFlow_19 - - - - SequenceFlow_19 - SequenceFlow_11 - - - - - SequenceFlow_14 - SequenceFlow_1 - - - - - SequenceFlow_noVfModuleRelation - SequenceFlow_personaModelIdMatchYes - SequenceFlow_22 - - - - SequenceFlow_7 - - - - SequenceFlow_6 - - - - - SequenceFlow_7 - SequenceFlow_4 - - - - - - - - - - - - - - SequenceFlow_4 - SequenceFlow_6 - - - - - - SequenceFlow_8 - SequenceFlow_personaModelIdMatchYes - SequenceFlow_personaModelidMatchNo - - - #{UPDVfModVol_modelInvariantId == UPDVfModVol_personaModelId} - - - - SequenceFlow_YesVfModuleRelation - SequenceFlow_8 - - - - - SequenceFlow_personaModelidMatchNo - SequenceFlow_18 - - - - - SequenceFlow_18 - - - - SequenceFlow_3 - SequenceFlow_2 - - - - - SequenceFlow_3 - - - - SequenceFlow_2 - SequenceFlow_20 - - - - - SequenceFlow_tenantIsMatch - SequenceFlow_YesVfModuleRelation - SequenceFlow_noVfModuleRelation - - - - - - - SequenceFlow_15 - SequenceFlow_NoTenantMatch - SequenceFlow_tenantIsMatch - - - - #{UPDVfModVol_tenantId == UPDVfModVol_volumeGroupTenantId} - - - SequenceFlow_NoTenantMatch - SequenceFlow_17 - - - - - SequenceFlow_17 - - - - SequenceFlow_5 - SequenceFlow_15 - - - - - SequenceFlow_20 - SequenceFlow_5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVnfInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVnfInfra.bpmn deleted file mode 100644 index 4b805f87ab..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVnfInfra.bpmn +++ /dev/null @@ -1,1685 +0,0 @@ - - - - - SequenceFlow_5 - SequenceFlow_0y0jt4l - - - - - SequenceFlow_4 - SequenceFlow_5 - - - - - - - - - - - SequenceFlow_17 - SequenceFlow_14 - - - - SequenceFlow_6 - - - - SequenceFlow_14 - SequenceFlow_6 - - - - - SequenceFlow_3 - SequenceFlow_1dqbqqx - SequenceFlow_17 - - - - - - SequenceFlow_1 - - - - - SequenceFlow_0slcwxc - SequenceFlow_7 - - - - - - - - - - - SequenceFlow_7 - SequenceFlow_19 - - - SequenceFlow_19 - - - - - - - - SequenceFlow_1 - SequenceFlow_0a0lfh8 - - - - SequenceFlow_0r0o5yt - SequenceFlow_0slcwxc - - - - - - - - - - - - - - - - - SequenceFlow_0a0lfh8 - SequenceFlow_0r0o5yt - - - - SequenceFlow_12 - - - - SequenceFlow_12 - - - - - SequenceFlow_4 - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_19ba94v - SequenceFlow_0gzzeru - - - - - - - - - - - - - SequenceFlow_0y0jt4l - SequenceFlow_1w35ov3 - - - - SequenceFlow_1w35ov3 - SequenceFlow_053qjfy - - - - - SequenceFlow_16mo99z - SequenceFlow_1pj72fw - SequenceFlow_2 - - - - - - - SequenceFlow_0baosqi - SequenceFlow_1lmijmb - SequenceFlow_0k3fx7p - - - - SequenceFlow_19lg15d - SequenceFlow_11p8elx - SequenceFlow_12mfil6 - - - - SequenceFlow_178fxkj - SequenceFlow_0usxnlk - - - - - - - - - - SequenceFlow_0usxnlk - SequenceFlow_16mo99z - SequenceFlow_1esmtgy - - - - SequenceFlow_2 - SequenceFlow_0baosqi - SequenceFlow_1jmzl1j - - - - - - - - - - - - - - - - - - - - SequenceFlow_1nplvhi - SequenceFlow_0v0u7mf - - - - SequenceFlow_1qr8msw - - - - - - - - - SequenceFlow_0k3fx7p - SequenceFlow_1bkhs8m - SequenceFlow_010ynjs - - - - SequenceFlow_0xx8y1s - SequenceFlow_0qy68ib - SequenceFlow_1qsxbp4 - - - - SequenceFlow_0a6pdza - SequenceFlow_0q0qan8 - SequenceFlow_15bl7wd - - - - SequenceFlow_13h26h9 - SequenceFlow_1c0vdki - SequenceFlow_1m84lq5 - - - - SequenceFlow_0gzzeru - SequenceFlow_04zwhw4 - SequenceFlow_0fog99f - - - - SequenceFlow_1uno5rs - SequenceFlow_162mm0m - SequenceFlow_12g63pl - - - - SequenceFlow_1c79909 - SequenceFlow_197t3qk - SequenceFlow_0l83v2k - - - - SequenceFlow_1xfbwpi - SequenceFlow_19lg15d - SequenceFlow_07fhkt4 - - - - SequenceFlow_12mfil6 - SequenceFlow_3 - SequenceFlow_0p94lgv - - - - SequenceFlow_0vpd06n - SequenceFlow_1c022sy - - - - SequenceFlow_0v0u7mf - SequenceFlow_0vpd06n - SequenceFlow_1qr8msw - SequenceFlow_05gpym3 - - - SequenceFlow_05gpym3 - SequenceFlow_1c022sy - SequenceFlow_0tqrgop - SequenceFlow_126nlmw - SequenceFlow_0mw3mwl - SequenceFlow_13md9cw - SequenceFlow_0xylem3 - SequenceFlow_1c5mxd5 - SequenceFlow_0u8hiu2 - SequenceFlow_0fs7ay9 - SequenceFlow_00qwx4v - SequenceFlow_14s8ji9 - SequenceFlow_0kricor - - - - - - - SequenceFlow_1c0vdki - SequenceFlow_1hldqvv - SequenceFlow_19ba94v - - - - - - - - - - - - - - - - - SequenceFlow_1bkhs8m - SequenceFlow_0qmpjgv - SequenceFlow_0xx8y1s - - - - - - - - - - - - - - - - - - SequenceFlow_0qy68ib - SequenceFlow_0tld38t - SequenceFlow_0a6pdza - - - - - - - - - - - - - - - - SequenceFlow_0q0qan8 - SequenceFlow_08dyt3l - SequenceFlow_13h26h9 - - - - - - - - - - - - - - - - SequenceFlow_04zwhw4 - SequenceFlow_0ye8oij - SequenceFlow_1uno5rs - - - - - - - - - - - - - - - - - - SequenceFlow_162mm0m - SequenceFlow_08kn9ok - SequenceFlow_1c79909 - - - - - - - - - - - - - - - SequenceFlow_197t3qk - SequenceFlow_02uiht9 - SequenceFlow_1xfbwpi - - - SequenceFlow_1esmtgy - - - - SequenceFlow_1jmzl1j - - - - - - - - - - SequenceFlow_1pj72fw - - - - - SequenceFlow_1lmijmb - - - - - SequenceFlow_010ynjs - - - - - - - SequenceFlow_0qmpjgv - - - - SequenceFlow_1qsxbp4 - - - - SequenceFlow_15bl7wd - - - - SequenceFlow_1m84lq5 - - - - SequenceFlow_0tld38t - - - - SequenceFlow_08dyt3l - - - - - - - - - - - - - - - - SequenceFlow_1hldqvv - - - - SequenceFlow_0fog99f - - - - SequenceFlow_0ye8oij - - - - SequenceFlow_12g63pl - - - - - - - - - - - - SequenceFlow_08kn9ok - - - - SequenceFlow_0l83v2k - - - - SequenceFlow_02uiht9 - - - - SequenceFlow_07fhkt4 - - - - SequenceFlow_11p8elx - - - - SequenceFlow_0p94lgv - - - - - - - - - - - - - - - - - SequenceFlow_1dqbqqx - - - - SequenceFlow_1nplvhi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0tqrgop - - - - SequenceFlow_126nlmw - - - - SequenceFlow_0mw3mwl - - - - SequenceFlow_13md9cw - - - - SequenceFlow_0xylem3 - - - - SequenceFlow_1c5mxd5 - - - - SequenceFlow_0u8hiu2 - - - - SequenceFlow_0fs7ay9 - - - - SequenceFlow_00qwx4v - - - - SequenceFlow_14s8ji9 - - - - SequenceFlow_0kricor - - - - - SequenceFlow_053qjfy - SequenceFlow_178fxkj - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/VnfConfigUpdate.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/VnfConfigUpdate.bpmn deleted file mode 100644 index 01307b35b7..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/VnfConfigUpdate.bpmn +++ /dev/null @@ -1,1636 +0,0 @@ - - - - - SequenceFlow_5 - SequenceFlow_0y0jt4l - - - - - SequenceFlow_4 - SequenceFlow_5 - - - - - - - - - - - SequenceFlow_17 - SequenceFlow_14 - - - - SequenceFlow_6 - - - - SequenceFlow_14 - SequenceFlow_6 - - - - - SequenceFlow_3 - SequenceFlow_07uuj2d - SequenceFlow_17 - - - - - - SequenceFlow_1 - - - - - SequenceFlow_0xt2xvx - SequenceFlow_7 - - - - - - - - - - - SequenceFlow_7 - SequenceFlow_19 - - - SequenceFlow_19 - - - - - - - - SequenceFlow_1 - SequenceFlow_1vxpbd0 - - - - SequenceFlow_03ayqeh - SequenceFlow_0xt2xvx - - - - - - - - - - - - - - - - - SequenceFlow_1vxpbd0 - SequenceFlow_03ayqeh - - - - SequenceFlow_12 - - - - SequenceFlow_12 - - - - - SequenceFlow_4 - - - - - - SequenceFlow_0y0jt4l - SequenceFlow_053qjfy - - - - - SequenceFlow_16mo99z - SequenceFlow_09lrk4q - SequenceFlow_2 - - - - - SequenceFlow_0baosqi - SequenceFlow_1eezqx8 - SequenceFlow_0k3fx7p - - - - SequenceFlow_16ff86u - SequenceFlow_08m0j98 - SequenceFlow_12mfil6 - - - - SequenceFlow_053qjfy - SequenceFlow_179tyul - SequenceFlow_0usxnlk - - - - SequenceFlow_0usxnlk - SequenceFlow_16mo99z - SequenceFlow_06ev8or - - - - SequenceFlow_2 - SequenceFlow_0baosqi - SequenceFlow_1cdfjed - - - - - - - - - - - - - - - - - - - - SequenceFlow_0nob5cp - SequenceFlow_0v0u7mf - - - - - - - - - - SequenceFlow_0k3fx7p - SequenceFlow_17g62fl - SequenceFlow_06ajc11 - - - - SequenceFlow_1c79909 - SequenceFlow_1urpp94 - SequenceFlow_08m0j98 - - - SequenceFlow_12mfil6 - SequenceFlow_0u6ho2p - SequenceFlow_0k3zxpd - - - - SequenceFlow_0vpd06n - SequenceFlow_1c022sy - SequenceFlow_05omwbu - SequenceFlow_18lemf9 - - - - SequenceFlow_0v0u7mf - SequenceFlow_1qr8msw - SequenceFlow_05gpym3 - SequenceFlow_0vpd06n - SequenceFlow_0rlmex7 - - - SequenceFlow_05gpym3 - SequenceFlow_19myx3o - SequenceFlow_1c022sy - SequenceFlow_0ueoglv - SequenceFlow_15fqlwe - SequenceFlow_0yuj0l5 - SequenceFlow_1abb030 - SequenceFlow_0ls3ej5 - SequenceFlow_1ar6ikk - SequenceFlow_0t53vux - SequenceFlow_11ck4qe - SequenceFlow_16d2ln4 - SequenceFlow_1quapjx - SequenceFlow_101n488 - - - - - - - - - - SequenceFlow_06ev8or - - - - - - SequenceFlow_0zzwdwf - SequenceFlow_06ajc11 - SequenceFlow_076leae - - - - SequenceFlow_076leae - SequenceFlow_0du9273 - SequenceFlow_0zh8r6j - - - - SequenceFlow_0nob5cp - - - - SequenceFlow_1cdfjed - - - - - - - SequenceFlow_17g62fl - - - - - - - SequenceFlow_0zh8r6j - - - - - - - SequenceFlow_09lrk4q - - - - - - SequenceFlow_1eezqx8 - - - - SequenceFlow_0zzwdwf - - - - - - - SequenceFlow_0du9273 - SequenceFlow_032tm9y - SequenceFlow_179z9vl - - - - - SequenceFlow_032tm9y - - - - SequenceFlow_179z9vl - SequenceFlow_1cjiv6i - SequenceFlow_1q3oxtf - - - - SequenceFlow_1q3oxtf - - - - - - - SequenceFlow_1wqinjh - - - - - - - SequenceFlow_1urpp94 - - - - SequenceFlow_1colra4 - - - - SequenceFlow_1tzax6l - SequenceFlow_3 - SequenceFlow_0w8mkkn - - - - SequenceFlow_0u6ho2p - SequenceFlow_09xxorv - SequenceFlow_1tzax6l - - - - - SequenceFlow_16ff86u - - - - - - - - SequenceFlow_0k3zxpd - - - - SequenceFlow_09xxorv - - - - - - - - SequenceFlow_0w8mkkn - - - - SequenceFlow_07uuj2d - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0ueoglv - - - - SequenceFlow_15fqlwe - - - - SequenceFlow_0yuj0l5 - - - - SequenceFlow_1abb030 - - - - SequenceFlow_0ls3ej5 - - - - SequenceFlow_1quapjx - - - - - - - SequenceFlow_1ar6ikk - - - - SequenceFlow_0t53vux - - - - SequenceFlow_11ck4qe - - - - SequenceFlow_16d2ln4 - - - - SequenceFlow_179tyul - - - - - - - - SequenceFlow_101n488 - - - - - SequenceFlow_16igl7b - - - - - - SequenceFlow_0wfzjs1 - SequenceFlow_188a7lk - SequenceFlow_12konw1 - - - SequenceFlow_0lpreg4 - SequenceFlow_0q1skau - SequenceFlow_1s3pbww - - - - - - - - - SequenceFlow_12konw1 - - - - - - - SequenceFlow_1s3pbww - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_1cjiv6i - SequenceFlow_1colra4 - SequenceFlow_0wfzjs1 - - - - - - - - - - - - - - - - - - SequenceFlow_16igl7b - SequenceFlow_0q1skau - SequenceFlow_1c79909 - - - - - - - - - - - - - - - SequenceFlow_188a7lk - SequenceFlow_1wqinjh - SequenceFlow_0lpreg4 - - - - - - SequenceFlow_0rlmex7 - SequenceFlow_1xwgemy - - - - SequenceFlow_1nm4wr1 - SequenceFlow_19myx3o - SequenceFlow_05omwbu - - - - - - - SequenceFlow_1xwgemy - SequenceFlow_1nm4wr1 - - PT1M - - - - - - - - - - - - - - - - - - SequenceFlow_1qr8msw - SequenceFlow_18lemf9 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/VnfInPlaceUpdate.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/VnfInPlaceUpdate.bpmn deleted file mode 100644 index 362eb1ac05..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/VnfInPlaceUpdate.bpmn +++ /dev/null @@ -1,2301 +0,0 @@ - - - - - SequenceFlow_5 - SequenceFlow_0y0jt4l - - - - - SequenceFlow_4 - SequenceFlow_5 - - - - - - - - - - - SequenceFlow_17 - SequenceFlow_14 - - - - SequenceFlow_6 - - - - SequenceFlow_14 - SequenceFlow_6 - - - - - SequenceFlow_3 - SequenceFlow_07uuj2d - SequenceFlow_17 - - - - - - SequenceFlow_1 - - - - - SequenceFlow_0ib8gb8 - SequenceFlow_7 - - - - - - - - - - - SequenceFlow_7 - SequenceFlow_19 - - - SequenceFlow_19 - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0hvg70o - SequenceFlow_1qnzi6i - - - - SequenceFlow_1 - SequenceFlow_0hvg70o - - - - - SequenceFlow_1qnzi6i - SequenceFlow_0ib8gb8 - - - - - SequenceFlow_12 - - - - SequenceFlow_12 - - - - - SequenceFlow_4 - - - - - - SequenceFlow_0y0jt4l - SequenceFlow_053qjfy - - - - - SequenceFlow_16mo99z - SequenceFlow_09lrk4q - SequenceFlow_2 - - - - - SequenceFlow_0baosqi - SequenceFlow_1eezqx8 - SequenceFlow_0k3fx7p - - - - SequenceFlow_1nr9o85 - SequenceFlow_16ff86u - SequenceFlow_12mfil6 - - - - SequenceFlow_053qjfy - SequenceFlow_179tyul - SequenceFlow_0usxnlk - - - - - - - - - - SequenceFlow_0usxnlk - SequenceFlow_16mo99z - SequenceFlow_06ev8or - - - - SequenceFlow_2 - SequenceFlow_0baosqi - SequenceFlow_1cdfjed - - - - - - - - - - - - - - - - - - - - SequenceFlow_0nob5cp - SequenceFlow_0v0u7mf - - - - - - - - - - SequenceFlow_0k3fx7p - SequenceFlow_17g62fl - SequenceFlow_06ajc11 - - - - - SequenceFlow_0a6pdza - SequenceFlow_0q0qan8 - SequenceFlow_02mk8vs - - - - SequenceFlow_13h26h9 - SequenceFlow_1c0vdki - SequenceFlow_11o5j55 - - - - SequenceFlow_1uno5rs - SequenceFlow_162mm0m - SequenceFlow_1gagrha - - - - SequenceFlow_1c79909 - SequenceFlow_1urpp94 - SequenceFlow_1c2xyhk - - - SequenceFlow_12mfil6 - SequenceFlow_0u6ho2p - SequenceFlow_0k3zxpd - - - - SequenceFlow_0vpd06n - SequenceFlow_1c022sy - SequenceFlow_0h64c4o - SequenceFlow_0syfgbo - - - - SequenceFlow_0v0u7mf - SequenceFlow_1qr8msw - SequenceFlow_05gpym3 - SequenceFlow_0vpd06n - SequenceFlow_1ijc733 - - - SequenceFlow_05gpym3 - SequenceFlow_1kntfys - SequenceFlow_1nlqlwn - SequenceFlow_1c022sy - SequenceFlow_0ueoglv - SequenceFlow_15fqlwe - SequenceFlow_0yuj0l5 - SequenceFlow_1abb030 - SequenceFlow_0ls3ej5 - SequenceFlow_1ar6ikk - SequenceFlow_171iq7e - SequenceFlow_1553o9f - SequenceFlow_0dmxwel - SequenceFlow_1id2p8y - SequenceFlow_0t53vux - SequenceFlow_11ck4qe - SequenceFlow_16d2ln4 - SequenceFlow_1quapjx - SequenceFlow_101n488 - SequenceFlow_021ah63 - - - - - - - - - - - - - - SequenceFlow_06ev8or - - - - - - SequenceFlow_0zzwdwf - SequenceFlow_06ajc11 - SequenceFlow_076leae - - - - SequenceFlow_076leae - SequenceFlow_0du9273 - SequenceFlow_0zh8r6j - - - - SequenceFlow_0nob5cp - - - - SequenceFlow_1cdfjed - - - - - - - SequenceFlow_17g62fl - - - - - - - SequenceFlow_0zh8r6j - - - - - - - SequenceFlow_09lrk4q - - - - - - SequenceFlow_1eezqx8 - - - - SequenceFlow_0zzwdwf - - - - - - - SequenceFlow_0du9273 - SequenceFlow_032tm9y - SequenceFlow_179z9vl - - - - - SequenceFlow_032tm9y - - - - SequenceFlow_179z9vl - SequenceFlow_1cjiv6i - SequenceFlow_1q3oxtf - - - - SequenceFlow_1q3oxtf - - - - - - - SequenceFlow_1j81s6b - - - - - - - SequenceFlow_16t9vai - - - - - SequenceFlow_02mk8vs - - - - - - - SequenceFlow_1urt6le - - - - - SequenceFlow_11o5j55 - - - - - - - SequenceFlow_19ba94v - SequenceFlow_1fuaq5k - SequenceFlow_04gth9f - - - - SequenceFlow_0if6xj4 - - - - - - - - SequenceFlow_04gth9f - - - - - SequenceFlow_1v59be9 - - - - SequenceFlow_04rprct - SequenceFlow_1uceq96 - SequenceFlow_0txgesu - - - - SequenceFlow_1uceq96 - - - - - - - - - SequenceFlow_0trguug - SequenceFlow_1q3bwlt - SequenceFlow_1xg6pwh - - - - SequenceFlow_1xfbwpi - SequenceFlow_1nr9o85 - SequenceFlow_0ttowkv - - - - SequenceFlow_1gagrha - - - - - - - - SequenceFlow_16igl7b - - - - - - - SequenceFlow_1urpp94 - - - - - SequenceFlow_0yja56j - - - - - - - - SequenceFlow_1xg6pwh - - - - SequenceFlow_1hwtq9x - - - - - - - - SequenceFlow_0ttowkv - - - - SequenceFlow_1colra4 - - - - - SequenceFlow_1tzax6l - SequenceFlow_3 - SequenceFlow_0w8mkkn - - - - SequenceFlow_0u6ho2p - SequenceFlow_09xxorv - SequenceFlow_1tzax6l - - - - - SequenceFlow_16ff86u - - - - - - - - SequenceFlow_0k3zxpd - - - - SequenceFlow_09xxorv - - - - - - - - SequenceFlow_0w8mkkn - - - - SequenceFlow_07uuj2d - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0ueoglv - - - - SequenceFlow_15fqlwe - - - - SequenceFlow_0yuj0l5 - - - - SequenceFlow_1abb030 - - - - SequenceFlow_0ls3ej5 - - - - SequenceFlow_1quapjx - - - - - - - SequenceFlow_1ar6ikk - - - - SequenceFlow_1nlqlwn - - - - SequenceFlow_171iq7e - - - - SequenceFlow_1553o9f - - - - SequenceFlow_0dmxwel - - - - SequenceFlow_1id2p8y - - - - SequenceFlow_0t53vux - - - - SequenceFlow_11ck4qe - - - - SequenceFlow_16d2ln4 - - - - SequenceFlow_179tyul - - - - - - - - SequenceFlow_101n488 - - - - SequenceFlow_1ood2pr - - - - - - - - - - - - - - - - - - - SequenceFlow_1c0vdki - SequenceFlow_0if6xj4 - SequenceFlow_19ba94v - - - - - - - - - - - - - - - SequenceFlow_1cjiv6i - SequenceFlow_1ood2pr - SequenceFlow_0xx8y1s - - - - - - - - - - - - - - - SequenceFlow_1q3bwlt - SequenceFlow_1hwtq9x - SequenceFlow_1xfbwpi - - - - - - - - - - - - - - - - SequenceFlow_0qy68ib - SequenceFlow_16t9vai - SequenceFlow_0a6pdza - - - - - - - - - - - - - - - - SequenceFlow_162mm0m - SequenceFlow_16igl7b - SequenceFlow_1c79909 - - - SequenceFlow_021ah63 - - - - - - - SequenceFlow_1ijc733 - SequenceFlow_0ai205d - - - - SequenceFlow_0a2cv6d - SequenceFlow_1kntfys - SequenceFlow_0h64c4o - - - SequenceFlow_0ai205d - SequenceFlow_0a2cv6d - - PT1M - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_1qr8msw - SequenceFlow_0syfgbo - - - - - - - - - - - - - - - - - - SequenceFlow_0q0qan8 - SequenceFlow_1urt6le - SequenceFlow_13h26h9 - - - - - - - - - - - - - - - - SequenceFlow_1fuaq5k - SequenceFlow_1v59be9 - SequenceFlow_04rprct - - - - - - - - - - - - - - - - SequenceFlow_0txgesu - SequenceFlow_1colra4 - SequenceFlow_1uno5rs - - - - - - - - - - - - - - - - - SequenceFlow_1c2xyhk - SequenceFlow_0yja56j - SequenceFlow_0trguug - - - SequenceFlow_0xx8y1s - SequenceFlow_1j81s6b - SequenceFlow_0qy68ib - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn deleted file mode 100644 index 257771fcb8..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn +++ /dev/null @@ -1,162 +0,0 @@ - - - - - SequenceFlow_1c92ks3 - - - SequenceFlow_17md60u - - - - - - - - - - - - - SequenceFlow_18l3crb - SequenceFlow_1xk5xed - - - - - SequenceFlow_1vnx1pp - SequenceFlow_0ow44q0 - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new ActivateSDNCNetworkResource() -dcsi.postCreateSDNCCall(execution) - - - - SequenceFlow_1c92ks3 - SequenceFlow_18l3crb - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new ActivateSDNCNetworkResource() -dcsi.preProcessRequest(execution) - - - SequenceFlow_1xk5xed - SequenceFlow_1jr6zi0 - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new ActivateSDNCNetworkResource() -dcsi.prepareUpdateAfterActivateSDNCResource(execution) - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1jr6zi0 - SequenceFlow_1vnx1pp - - - - - SequenceFlow_0ow44q0 - SequenceFlow_17md60u - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new ActivateSDNCNetworkResource() -csi.sendSyncResponse(execution) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/CreateServiceInstanceV3.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/CreateServiceInstanceV3.bpmn deleted file mode 100644 index dcb5323fa5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/CreateServiceInstanceV3.bpmn +++ /dev/null @@ -1,146 +0,0 @@ - - - - - SequenceFlow_055igqy - - - - SequenceFlow_055igqy - SequenceFlow_0n3aqvm - - - SequenceFlow_011vkoq - - - - SequenceFlow_0n3aqvm - SequenceFlow_1knhaka - - - - - - SequenceFlow_1knhaka - SequenceFlow_1wvh54c - - - SequenceFlow_1wvh54c - SequenceFlow_011vkoq - - - - - SequenceFlow_1lli2e6 - - - - SequenceFlow_1hm0qrs - - - - - - - - SequenceFlow_1hm0qrs - SequenceFlow_1lli2e6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/CreateServiceInstanceV3Rollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/CreateServiceInstanceV3Rollback.bpmn deleted file mode 100644 index 392ebd7ac8..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/CreateServiceInstanceV3Rollback.bpmn +++ /dev/null @@ -1,97 +0,0 @@ - - - - - SequenceFlow_15a3kpo - - - - SequenceFlow_0dqe5xo - - - - SequenceFlow_15a3kpo - SequenceFlow_0dqe5xo - - - - SequenceFlow_10szwpv - - - - - SequenceFlow_05g9m3e - - - - SequenceFlow_10szwpv - SequenceFlow_05g9m3e - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DeActivateNetworkResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DeActivateNetworkResource.bpmn deleted file mode 100644 index 216b67a8bb..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DeActivateNetworkResource.bpmn +++ /dev/null @@ -1,258 +0,0 @@ - - - - - SequenceFlow_1qo2pln - - - - - SequenceFlow_18l3crb - SequenceFlow_0khtova - - - - SequenceFlow_15wux6a - - - - - - - - - - - - - SequenceFlow_15mvedq - SequenceFlow_1xk5xed - - - - - SequenceFlow_1vnx1pp - SequenceFlow_0ow44q0 - - - - - - SequenceFlow_1qo2pln - SequenceFlow_0w2es8j - - - - SequenceFlow_0w2es8j - SequenceFlow_18l3crb - - - - - - SequenceFlow_0khtova - SequenceFlow_1mz0vdx - - - - SequenceFlow_1xk5xed - SequenceFlow_1jr6zi0 - - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1mz0vdx - SequenceFlow_15mvedq - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1jr6zi0 - SequenceFlow_1vnx1pp - - - - - SequenceFlow_0ow44q0 - SequenceFlow_15wux6a - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCompareModelVersions.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCompareModelVersions.bpmn deleted file mode 100644 index 3833e646c5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCompareModelVersions.bpmn +++ /dev/null @@ -1,330 +0,0 @@ - - - - - SequenceFlow_1rebkae - SequenceFlow_1lkpfe2 - - - - - SequenceFlow_1rebkae - - - - SequenceFlow_1lkpfe2 - - - - - SequenceFlow_19sogyb - - - - SequenceFlow_17mr4jl - - - SequenceFlow_19sogyb - SequenceFlow_17mr4jl - - - - - - - SequenceFlow_0enm2cg - - - - SequenceFlow_1pe6r93 - SequenceFlow_0enm2cg - - - - - - - - - - - - SequenceFlow_1lta49u - SequenceFlow_1pe6r93 - - - SequenceFlow_0frea3k - SequenceFlow_1lta49u - - - - SequenceFlow_0frea3k - - - - - - - - SequenceFlow_08zjjzw - - - - SequenceFlow_1wudpuj - SequenceFlow_08zjjzw - - - - - - - - - - - - SequenceFlow_04ciw70 - SequenceFlow_1wudpuj - - - SequenceFlow_1fgkvpr - SequenceFlow_04ciw70 - - - - SequenceFlow_1fgkvpr - - - - - - - - SequenceFlow_1chfao3 - - - SequenceFlow_1chfao3 - SequenceFlow_164yb3r - - - - SequenceFlow_164yb3r - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn deleted file mode 100644 index df9ef116e4..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - SequenceFlow_1rebkae - - - - SequenceFlow_1lkpfe2 - - - - - SequenceFlow_19sogyb - - - - SequenceFlow_17mr4jl - - - SequenceFlow_19sogyb - SequenceFlow_17mr4jl - - - - - - - SequenceFlow_1chfao3 - - - SequenceFlow_1cpg3ku - - - - - - - - - - - - - - - - - - - SequenceFlow_1rebkae - SequenceFlow_1pe6r93 - - - SequenceFlow_1pe6r93 - SequenceFlow_1lkpfe2 - - - - - SequenceFlow_1chfao3 - SequenceFlow_1xzphe4 - - - - - - - - - - - - - - - SequenceFlow_1xzphe4 - SequenceFlow_0b6eqin - - - SequenceFlow_0b6eqin - SequenceFlow_1cpg3ku - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn deleted file mode 100644 index b925b007cd..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn +++ /dev/null @@ -1,755 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_2 - - - - - notFound - SequenceFlow_6 - - - - - - - - - - - - - - - SequenceFlow_2 - SequenceFlow_4 - - - - SequenceFlow_4 - notFound - found - - - - found - SequenceFlow_0gbsa12 - - - - SequenceFlow_6 - - - - SequenceFlow_17p4ohs - SequenceFlow_11 - - - - - SequenceFlow_09xwplc - - - - - - - - - - SequenceFlow_0gd64w9 - SequenceFlow_1q6udwm - - - - - - - - - - - - SequenceFlow_1q6udwm - SequenceFlow_15knw0q - - - SequenceFlow_15knw0q - SequenceFlow_0c5h00o - - - - SequenceFlow_0c5h00o - SequenceFlow_1lalmvp - - - - - - - - - - - - SequenceFlow_1lalmvp - SequenceFlow_0eb41vb - - - SequenceFlow_0eb41vb - SequenceFlow_15z3gpq - - - - SequenceFlow_04t1zc2 - SequenceFlow_06w33tk - - - - - - - - - - - - SequenceFlow_06w33tk - SequenceFlow_1s7yieq - - - SequenceFlow_1s7yieq - SequenceFlow_00i7x43 - - - - - - - - - - - - - - - - - SequenceFlow_030mhcm - SequenceFlow_0q1hz2p - - - - - - - - - - - - - - - SequenceFlow_1m8u8dl - SequenceFlow_1vg5rfa - - - - SequenceFlow_1vg5rfa - SequenceFlow_17p4ohs - SequenceFlow_0f7u5pu - - - - - - SequenceFlow_0f7u5pu - SequenceFlow_16o7col - - - - SequenceFlow_16o7col - - - - - - - SequenceFlow_1h61pqs - - - - SequenceFlow_0t4ut76 - - - SequenceFlow_1h61pqs - SequenceFlow_1kbzr5v - - - - SequenceFlow_1cxj4yz - SequenceFlow_0t4ut76 - - - - - - - - - - - - - - SequenceFlow_1kbzr5v - SequenceFlow_1cxj4yz - - - - - SequenceFlow_00i7x43 - SequenceFlow_1dgzhsm - - - - SequenceFlow_15z3gpq - SequenceFlow_04t1zc2 - - - - SequenceFlow_0z8luou - SequenceFlow_0ec9eiq - SequenceFlow_030mhcm - - - - SequenceFlow_0q1hz2p - SequenceFlow_1iy3cqb - - - - - - SequenceFlow_0gbsa12 - SequenceFlow_1m8u8dl - SequenceFlow_0z8luou - - - - - - - SequenceFlow_0gd64w9 - - - - - SequenceFlow_11 - - - - - - - - SequenceFlow_1iy3cqb - SequenceFlow_09xwplc - - - - - SequenceFlow_1dgzhsm - SequenceFlow_0ec9eiq - - ${sdncReplDelay} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRGRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRGRollback.bpmn deleted file mode 100644 index 698c7b76f6..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRGRollback.bpmn +++ /dev/null @@ -1,575 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_0bfuk6l - - - - SequenceFlow_0ymy62j - - - - - - - - - - - - - - - SequenceFlow_1fvfplx - SequenceFlow_15knw0q - - - SequenceFlow_15knw0q - SequenceFlow_0c5h00o - - - - - - - - - - - - SequenceFlow_0m483rd - SequenceFlow_0eb41vb - - - SequenceFlow_0eb41vb - SequenceFlow_0sh1u69 - - - - - - - - - - - - SequenceFlow_04hdt5s - SequenceFlow_1s7yieq - - - SequenceFlow_1s7yieq - SequenceFlow_00i7x43 - - - - - - - SequenceFlow_1h61pqs - - - - SequenceFlow_1kbzr5v - - - SequenceFlow_1h61pqs - SequenceFlow_1kbzr5v - - - - - - - SequenceFlow_00i7x43 - SequenceFlow_13mhe5h - SequenceFlow_0m483td - SequenceFlow_03bkrg4 - - - - SequenceFlow_0c5h00o - SequenceFlow_0dzz8fp - SequenceFlow_0m483rd - SequenceFlow_0m483st - - - SequenceFlow_0gd64w9 - - - - - SequenceFlow_144pxkp - SequenceFlow_0g4cl5f - - - - SequenceFlow_0g4cl5f - - - - - - - - - - - - - SequenceFlow_0ebobc7 - - - - SequenceFlow_0ebobc7 - SequenceFlow_1ugqw84 - - - - SequenceFlow_1ugqw84 - - - - - - - SequenceFlow_03bkrg4 - SequenceFlow_0oe57h4 - SequenceFlow_0ymy62j - - - - SequenceFlow_0sh1u69 - SequenceFlow_0m483st - SequenceFlow_04hdt5s - SequenceFlow_0m483td - - - - - - - - SequenceFlow_1c07scr - SequenceFlow_0xm9g9s - SequenceFlow_144pxkp - - - - - - SequenceFlow_0xm9g9s - - - - - SequenceFlow_13mhe5h - - - - - SequenceFlow_0bfuk6l - SequenceFlow_1c07scr - SequenceFlow_0oe57h4 - - - - - - - SequenceFlow_0gd64w9 - SequenceFlow_1fvfplx - SequenceFlow_0dzz8fp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn deleted file mode 100644 index a240bb5ffa..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn +++ /dev/null @@ -1,755 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_2 - - - - - notFound - SequenceFlow_6 - - - - - - - - - - - - - - - SequenceFlow_2 - SequenceFlow_4 - - - - SequenceFlow_4 - notFound - found - - - - found - SequenceFlow_0gbsa12 - - - - SequenceFlow_6 - - - - SequenceFlow_17p4ohs - SequenceFlow_11 - - - - - SequenceFlow_09xwplc - - - - - - - - - - SequenceFlow_0gd64w9 - SequenceFlow_1q6udwm - - - - - - - - - - - - SequenceFlow_1q6udwm - SequenceFlow_15knw0q - - - SequenceFlow_15knw0q - SequenceFlow_0c5h00o - - - - SequenceFlow_0c5h00o - SequenceFlow_1lalmvp - - - - - - - - - - - - SequenceFlow_1lalmvp - SequenceFlow_0eb41vb - - - SequenceFlow_0eb41vb - SequenceFlow_15z3gpq - - - - SequenceFlow_04t1zc2 - SequenceFlow_06w33tk - - - - - - - - - - - - SequenceFlow_06w33tk - SequenceFlow_1s7yieq - - - SequenceFlow_1s7yieq - SequenceFlow_00i7x43 - - - - - - - - - - - - - - - - - SequenceFlow_030mhcm - SequenceFlow_0q1hz2p - - - - - - - - - - - - - - SequenceFlow_1m8u8dl - SequenceFlow_1vg5rfa - - - - SequenceFlow_1vg5rfa - SequenceFlow_17p4ohs - SequenceFlow_0f7u5pu - - - - - - SequenceFlow_0f7u5pu - SequenceFlow_16o7col - - - - SequenceFlow_16o7col - - - - - - - SequenceFlow_1h61pqs - - - - SequenceFlow_0t4ut76 - - - SequenceFlow_1h61pqs - SequenceFlow_1kbzr5v - - - - SequenceFlow_1cxj4yz - SequenceFlow_0t4ut76 - - - - - - - - - - - - - - SequenceFlow_1kbzr5v - SequenceFlow_1cxj4yz - - - - - SequenceFlow_00i7x43 - SequenceFlow_07kxd8t - - - - SequenceFlow_15z3gpq - SequenceFlow_04t1zc2 - - - - SequenceFlow_0z8luou - SequenceFlow_08hhqb2 - SequenceFlow_030mhcm - - - - SequenceFlow_0q1hz2p - SequenceFlow_1iy3cqb - - - - - - SequenceFlow_0gbsa12 - SequenceFlow_1m8u8dl - SequenceFlow_0z8luou - - - - - - - SequenceFlow_0gd64w9 - - - - - SequenceFlow_11 - - - - - - - - SequenceFlow_1iy3cqb - SequenceFlow_09xwplc - - - - - - SequenceFlow_07kxd8t - SequenceFlow_08hhqb2 - - ${sdncReplDelay} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXCRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXCRollback.bpmn deleted file mode 100644 index 595d7f5628..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXCRollback.bpmn +++ /dev/null @@ -1,575 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_0bfuk6l - - - - SequenceFlow_0ymy62j - - - - - - - - - - - - - - - SequenceFlow_1fvfplx - SequenceFlow_15knw0q - - - SequenceFlow_15knw0q - SequenceFlow_0c5h00o - - - - - - - - - - - - SequenceFlow_0m483rd - SequenceFlow_0eb41vb - - - SequenceFlow_0eb41vb - SequenceFlow_0sh1u69 - - - - - - - - - - - - SequenceFlow_04hdt5s - SequenceFlow_1s7yieq - - - SequenceFlow_1s7yieq - SequenceFlow_00i7x43 - - - - - - - SequenceFlow_1h61pqs - - - - SequenceFlow_1kbzr5v - - - SequenceFlow_1h61pqs - SequenceFlow_1kbzr5v - - - - - - - SequenceFlow_00i7x43 - SequenceFlow_13mhe5h - SequenceFlow_0m483td - SequenceFlow_03bkrg4 - - - - SequenceFlow_0c5h00o - SequenceFlow_0dzz8fp - SequenceFlow_0m483rd - SequenceFlow_0m483st - - - SequenceFlow_0gd64w9 - - - - - SequenceFlow_144pxkp - SequenceFlow_0g4cl5f - - - - SequenceFlow_0g4cl5f - - - - - - - - - - - - - SequenceFlow_0ebobc7 - - - - SequenceFlow_0ebobc7 - SequenceFlow_1ugqw84 - - - - SequenceFlow_1ugqw84 - - - - - - - SequenceFlow_03bkrg4 - SequenceFlow_0oe57h4 - SequenceFlow_0ymy62j - - - - SequenceFlow_0sh1u69 - SequenceFlow_0m483st - SequenceFlow_04hdt5s - SequenceFlow_0m483td - - - - - - - - SequenceFlow_1c07scr - SequenceFlow_0xm9g9s - SequenceFlow_144pxkp - - - - - - SequenceFlow_0xm9g9s - - - - - SequenceFlow_13mhe5h - - - - - SequenceFlow_0bfuk6l - SequenceFlow_1c07scr - SequenceFlow_0oe57h4 - - - - - - - SequenceFlow_0gd64w9 - SequenceFlow_1fvfplx - SequenceFlow_0dzz8fp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2ENetworkInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2ENetworkInstance.bpmn deleted file mode 100644 index 758b98c218..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2ENetworkInstance.bpmn +++ /dev/null @@ -1,136 +0,0 @@ - - - - - SequenceFlow_1gomb9n - - - SequenceFlow_1gomb9n - SequenceFlow_0s7w7gp - - - - SequenceFlow_1wtx8gj - SequenceFlow_0k06cqp - - - - - - - - - - - - SequenceFlow_0s7w7gp - SequenceFlow_1wtx8gj - - - SequenceFlow_0o6bjmn - - - - - - - - - - - - - SequenceFlow_0k06cqp - SequenceFlow_1oql7zl - - - SequenceFlow_1oql7zl - SequenceFlow_0o6bjmn - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn deleted file mode 100644 index 0475a6a963..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ /dev/null @@ -1,544 +0,0 @@ - - - - - SequenceFlow_1qiiycn - - - SequenceFlow_1qiiycn - SequenceFlow_0w9t6tc - - - - - - - - - - - - - - - SequenceFlow_1i7t9hq - SequenceFlow_4 - - - - - - - - - - - - - SequenceFlow_1w01tqs - SequenceFlow_129ih1g - - - - - SequenceFlow_0tgrn11 - - - - SequenceFlow_1xzgv5k - - - - - - - - - - SequenceFlow_1lqktwf - SequenceFlow_0eumzpf - - - - - SequenceFlow_0tgrn11 - SequenceFlow_1lqktwf - - - - - SequenceFlow_0eumzpf - SequenceFlow_1xzgv5k - - - - - - SequenceFlow_4 - SequenceFlow_1w01tqs - - - - - SequenceFlow_129ih1g - SequenceFlow_1tkgqu3 - - - - - SequenceFlow_03ebqhf - SequenceFlow_1qctzm0 - - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_initResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1qctzm0 - SequenceFlow_13xfsff - - - SequenceFlow_0w9t6tc - - - - SequenceFlow_012h7yx - - - - SequenceFlow_0xjwb45 - SequenceFlow_012h7yx - - - - - - - - - - - - SequenceFlow_0qxzgvq - SequenceFlow_0xjwb45 - - - SequenceFlow_166w91p - SequenceFlow_0qxzgvq - - - - SequenceFlow_166w91p - - - - - - - - SequenceFlow_1tkgqu3 - - - - - - SequenceFlow_1i7t9hq - - - - - SequenceFlow_1hbesp9 - - - - - SequenceFlow_01s0ef2 - SequenceFlow_03ebqhf - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0bf6bzp - SequenceFlow_0d0c20n - - - SequenceFlow_13xfsff - SequenceFlow_0bf6bzp - - - - SequenceFlow_0d0c20n - SequenceFlow_0a6vgsu - - - - - - - SequenceFlow_0a6vgsu - - - - - - - SequenceFlow_1hbesp9 - SequenceFlow_01s0ef2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstanceRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstanceRollback.bpmn deleted file mode 100644 index 9e9045c144..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstanceRollback.bpmn +++ /dev/null @@ -1,379 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_2 - - - - SequenceFlow_01l4ssl - - - - SequenceFlow_8 - - - - SequenceFlow_7 - - - - SequenceFlow_8 - SequenceFlow_7 - - - - - - - - - - - - - - - - - SequenceFlow_1x9eh33 - SequenceFlow_05wu9i7 - - - SequenceFlow_06aasqh - SequenceFlow_11fnnkb - SequenceFlow_1uw2p9a - - - - - - - rollback AAI - SequenceFlow_1uw2p9a - SequenceFlow_1njogr1 - SequenceFlow_1n7wade - SequenceFlow_1x9eh33 - - - - - - - - - - - - - - - - - SequenceFlow_11fnnkb - SequenceFlow_0k28xib - - - SequenceFlow_0k28xib - SequenceFlow_0khjo7l - - - - - SequenceFlow_2 - SequenceFlow_06aasqh - SequenceFlow_1rzlaoy - - - SequenceFlow_05wu9i7 - SequenceFlow_1n7wade - SequenceFlow_1rzlaoy - SequenceFlow_01l4ssl - - - - - - - - - - SequenceFlow_1ch4xrf - - - - SequenceFlow_1ch4xrf - SequenceFlow_1pjk2ff - - - - SequenceFlow_1pjk2ff - - - - - - - SequenceFlow_006g9e8 - SequenceFlow_1njogr1 - - - - - - - - - - - - SequenceFlow_0khjo7l - SequenceFlow_006g9e8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn deleted file mode 100644 index 90636f61fb..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn +++ /dev/null @@ -1,1051 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_2 - - - - - - - - - - - - - - - SequenceFlow_2 - SequenceFlow_4 - - - - - - - - - - - - - SequenceFlow_0zmz5am - SequenceFlow_129ih1g - - - - - SequenceFlow_0tgrn11 - - - - SequenceFlow_1xzgv5k - - - - - - - - - - SequenceFlow_1lqktwf - SequenceFlow_0eumzpf - - - - - SequenceFlow_0tgrn11 - SequenceFlow_1lqktwf - - - - - SequenceFlow_0eumzpf - SequenceFlow_1xzgv5k - - - - - - SequenceFlow_4 - SequenceFlow_10aubhh - - - - SequenceFlow_129ih1g - SequenceFlow_03fabby - - - - - - SequenceFlow_13l7ffp - SequenceFlow_0gorww6 - - - - SequenceFlow_1wf52w6 - SequenceFlow_1t9tmp4 - SequenceFlow_14ef6wp - SequenceFlow_163tmnq - - - - - - - SequenceFlow_1t9tmp4 - SequenceFlow_1t4cc7w - - - - - - - - - - - - - - - - - SequenceFlow_1a1du22 - SequenceFlow_1p99k36 - - - - SequenceFlow_0cyffv0 - SequenceFlow_07q8ra0 - - - - SequenceFlow_06byir6 - SequenceFlow_0ylmq2b - - - - SequenceFlow_0vey6x4 - SequenceFlow_0br9juy - - - - SequenceFlow_0ylmq2b - SequenceFlow_07q8ra0 - SequenceFlow_0gxsqsa - SequenceFlow_1yhd9dp - - - - - SequenceFlow_1rhn48b - SequenceFlow_1mbrbsc - SequenceFlow_13l7ffp - SequenceFlow_1fq4qzy - - - - SequenceFlow_1r1hl23 - SequenceFlow_1ct6u3o - - - - SequenceFlow_1vio1tn - SequenceFlow_07pkpa0 - - - SequenceFlow_0br9juy - SequenceFlow_06byir6 - - - SequenceFlow_0cnuo36 - SequenceFlow_1lkpfe2 - - - - SequenceFlow_1t4cc7w - SequenceFlow_1a1du22 - SequenceFlow_14jy44g - - - - SequenceFlow_1p99k36 - SequenceFlow_14jy44g - SequenceFlow_0cyffv0 - - - - - - - - - - SequenceFlow_14ef6wp - SequenceFlow_0gxsqsa - - - - - - SequenceFlow_10aubhh - - - - SequenceFlow_0zmz5am - - - - - - SequenceFlow_1rhn48b - - - - - SequenceFlow_1ct6u3o - - - - - SequenceFlow_1rebkae - - - - SequenceFlow_1lkpfe2 - - - - - - - SequenceFlow_1fq4qzy - - - - SequenceFlow_10jgs3j - SequenceFlow_1wf52w6 - - - - - SequenceFlow_1yhd9dp - SequenceFlow_0uj9myy - - - - - - SequenceFlow_03fabby - - - - SequenceFlow_0e8oxe4 - - - - - SequenceFlow_07pkpa0 - SequenceFlow_01zluif - SequenceFlow_0vey6x4 - - - - - - - - SequenceFlow_163tmnq - SequenceFlow_01zluif - SequenceFlow_1vio1tn - - - - - - - SequenceFlow_0e8oxe4 - SequenceFlow_1sata7n - - - - - - - ${URN_mso_openecomp_adapters_db_endpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1sata7n - SequenceFlow_0x0jvs1 - - - - - SequenceFlow_1rebkae - SequenceFlow_0gr3l25 - - - - - - - ${URN_mso_openecomp_adapters_db_endpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_0gr3l25 - SequenceFlow_0cnuo36 - - - - - SequenceFlow_0uj9myy - SequenceFlow_037rvnb - - - - - - - - ${URN_mso_openecomp_adapters_db_endpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_037rvnb - SequenceFlow_1mbrbsc - - - - SequenceFlow_0x0jvs1 - SequenceFlow_0aylb6e - - - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_initResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_0aylb6e - SequenceFlow_1r1hl23 - - - - - - - ${URN_mso_openecomp_adapters_db_endpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_01oo8ar - SequenceFlow_10jgs3j - - - - SequenceFlow_0gorww6 - SequenceFlow_01oo8ar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn deleted file mode 100644 index 24ccc4d514..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn +++ /dev/null @@ -1,1362 +0,0 @@ - - - - - SequenceFlow_1n61wit - - - isReturnCode404_No_SequenceFlow - - - - isNetworkActiveNo_SequenceFlow - isReturnCode404_Yes_SequenceFlow - SequenceFlow_21 - - - - SequenceFlow_21 - isNameSentNo_SequenceFlow - SequenceFlow_32 - - - - - isSdncRpc1No_SequenceFlow1 - SequenceFlow_11 - - - - - SequenceFlow_12 - SequenceFlow_0d93bqw - SequenceFlow_5 - - - - SequenceFlow_5 - sdncTopoNo_SequenceFlow - sdncTopoYes_SequenceFlow - - - - - - - - SequenceFlow_34 - - - - - sdncTopoNo_SequenceFlow - SequenceFlow_34 - - - - sdncTopoYes_SequenceFlow - SequenceFlow_16 - - - - - - - - - - - - - - SequenceFlow_11 - SequenceFlow_12 - - - - SequenceFlow_59 - SequenceFlow_13 - - - - isAAIQueryNameYes_SequenceFlow - isNetworkActiveYes_SequenceFlow - isNetworkActiveNo_SequenceFlow - - - - - - - SequenceFlow_6 - isAAIQueryNameNo_SequenceFlow - isAAIQueryNameYes_SequenceFlow - - - - - - - isAAIQueryNameNo_SequenceFlow - isReturnCode404_No_SequenceFlow - isReturnCode404_Yes_SequenceFlow - - - - - - - - SequenceFlow_23 - - - - - isRollbackOn_SequenceFlow_Yes - isPONR_Yes_SequenceFlow - isPONR_No_SequenceFlow - - - - - - - SequenceFlow_0k7y7b5 - sdncOk_Yeso_ExclusiveGateway - sdncOk_No_ExclusiveGateway - - - - - - - isSdncRpc4No_SequenceFlow4 - SequenceFlow_0lndbvr - - - - isPONR_No_SequenceFlow - SequenceFlow_0cly7z2 - SequenceFlow_12tlymf - - - - - - - sdncOk_Yeso_ExclusiveGateway - isSdncRpc4Yes_SequenceFlow4 - isSdncRpc4No_SequenceFlow4 - - - - - - - isSdncRpc4Yes_SequenceFlow4 - SequenceFlow_0bwpkkb - - - - SequenceFlow_1qwubew - - - SequenceFlow_15sffxc - SequenceFlow_096tad6 - - - - - SequenceFlow_0cly7z2 - SequenceFlow_0b8j5rw - - - - - - - - - - - - - - - - - - SequenceFlow_096tad6 - SequenceFlow_0vzsyrd - - - - - - - SequenceFlow_0vzsyrd - SequenceFlow_17nx822 - SequenceFlow_1qwubew - - - - - SequenceFlow_10ttvwn - isRollbackOn_SequenceFlow_Yes - isRollbackOn_SequenceFlow_No - - - - - - - SequenceFlow_0lndbvr - sdncOk_No_ExclusiveGateway - SequenceFlow_0bwpkkb - SequenceFlow_15sffxc - - - - SequenceFlow_0b8j5rw - SequenceFlow_12tlymf - SequenceFlow_0k7y7b5 - - - - isPONR_Yes_SequenceFlow - isRollbackOn_SequenceFlow_No - SequenceFlow_17nx822 - - - - SequenceFlow_23 - SequenceFlow_10ttvwn - - - - - - - PO Network Rollback is created in validation. - - - - - - - - ${CRENWKI_createNetworkRequest} - ${URN_mso_adapters_network_rest_endpoint} - - - #{BasicAuthHeaderValuePO} - application/xml - - - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_61 - SequenceFlow_59 - - - - - SequenceFlow_13 - SequenceFlow_35 - - - - - SequenceFlow_35 - SequenceFlow_1ipz2ze - - - - - SequenceFlow_10 - SequenceFlow_14 - - - - - SequenceFlow_10 - - - - - SequenceFlow_14 - - - - - - - - - - - - - SequenceFlow_0ftylq3 - SequenceFlow_3 - - - isNameSentYes_SequenceFlow - SequenceFlow_6 - - - - - - SequenceFlow_3 - siFoundYes - siFoundNo - - - - - - - siFoundNo - - - - SequenceFlow_16 - SequenceFlow_15 - - - - - SequenceFlow_15 - SequenceFlow_38 - - - - - SequenceFlow_20 - SequenceFlow_61 - - - - - SequenceFlow_38 - SequenceFlow_20 - - - - - - SequenceFlow_1n61wit - SequenceFlow_0ftylq3 - - - - - siFoundYes - isNameSentYes_SequenceFlow - isNameSentNo_SequenceFlow - - - - - - - - - - - - - - - - SequenceFlow_13deudk - SequenceFlow_08qibb9 - - - isSdncRpc2Yes_SequenceFlow2 - SequenceFlow_13deudk - - - - SequenceFlow_1t03rs2 - SequenceFlow_1jia57e - SequenceFlow_18ybfu5 - - - - - - - - - - SequenceFlow_08qibb9 - SequenceFlow_1t03rs2 - - - - SequenceFlow_0s51ns0 - - - - - SequenceFlow_18ybfu5 - SequenceFlow_0s51ns0 - - - - SequenceFlow_32 - isSdncRpc1No_SequenceFlow1 - isSdncRpc1Yes_SequenceFlow1 - - - - - - - - - - - - - - - - SequenceFlow_0j8bxnb - SequenceFlow_0d93bqw - - - - - SequenceFlow_1ipz2ze - isSdncRpc2Yes_SequenceFlow2 - isSdncRpc2No_SequenceFlow2 - - - - - - - isSdncRpc1Yes_SequenceFlow1 - SequenceFlow_0j8bxnb - - - - SequenceFlow_1s8b1m1 - - - SequenceFlow_18ylufb - - - - SequenceFlow_1jia57e - isSdncRpc2No_SequenceFlow2 - SequenceFlow_1s8b1m1 - - - - - isNetworkActiveYes_SequenceFlow - SequenceFlow_18ylufb - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateNetworkInstanceRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateNetworkInstanceRollback.bpmn deleted file mode 100644 index eb60d42c2b..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateNetworkInstanceRollback.bpmn +++ /dev/null @@ -1,517 +0,0 @@ - - - - - SequenceFlow_1krl2dg - - - SequenceFlow_1krl2dg - SequenceFlow_0u41iz2 - - - - - - - - - - - - - - - SequenceFlow_1mxbdps - SequenceFlow_07s5r14 - - - - - - - - - - - - SequenceFlow_0mw0dgd - SequenceFlow_1rrutp3 - - - SequenceFlow_0u41iz2 - SequenceFlow_1bb7zpp - SequenceFlow_1mxbdps - - - SequenceFlow_1bb7zpp - SequenceFlow_07s5r14 - SequenceFlow_0e1uixp - SequenceFlow_1lteduj - - - - - - - - - - - - SequenceFlow_101y57s - SequenceFlow_0790olb - - - SequenceFlow_0virkpu - SequenceFlow_101y57s - SequenceFlow_0mw0dgd - - - SequenceFlow_0qc4v9t - SequenceFlow_0el8yzs - SequenceFlow_0yto4gz - - - - SequenceFlow_1lteduj - SequenceFlow_17o4w67 - SequenceFlow_0virkpu - SequenceFlow_0qc4v9t - - - - - - - - - - - - - - - - - - - - SequenceFlow_0yto4gz - - - - - - - SequenceFlow_0xktw7v - SequenceFlow_0soe5t3 - - - - SequenceFlow_0xktw7v - - - - SequenceFlow_0soe5t3 - - - - - - SequenceFlow_1rrutp3 - SequenceFlow_0790olb - SequenceFlow_0el8yzs - - - - - - SequenceFlow_0lomcvn - - - SequenceFlow_0q0te67 - SequenceFlow_0lomcvn - - - - - - SequenceFlow_0q0te67 - - - - - SequenceFlow_0ctlrql - - - - - SequenceFlow_0ctlrql - - - - SequenceFlow_1j55a94 - - - - SequenceFlow_1yn24xq - - - - SequenceFlow_1j55a94 - SequenceFlow_1yn24xq - - - - - - SequenceFlow_0e1uixp - SequenceFlow_17o4w67 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateResources.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateResources.bpmn deleted file mode 100644 index 5bb3d315b0..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateResources.bpmn +++ /dev/null @@ -1,370 +0,0 @@ - - - - - SequenceFlow_1qiiycn - - - SequenceFlow_1qiiycn - SequenceFlow_0w9t6tc - - - - SequenceFlow_16nxl6h - SequenceFlow_0epxs3b - - - - SequenceFlow_0k0f7lm - SequenceFlow_11f2zuu - - - - SequenceFlow_1hbesp9 - SequenceFlow_13d9g1n - - - - - SequenceFlow_1jenxlp - SequenceFlow_0q6uy30 - SequenceFlow_16nxl6h - - - - SequenceFlow_13c7bhn - SequenceFlow_1jenxlp - - - - - SequenceFlow_0q6uy30 - SequenceFlow_1qozd66 - SequenceFlow_0uiygod - - - - SequenceFlow_13d9g1n - SequenceFlow_18wj44x - SequenceFlow_1vprtt9 - - - - SequenceFlow_0uiygod - SequenceFlow_1u9k0dm - - - - SequenceFlow_1u9k0dm - SequenceFlow_13c7bhn - - - - SequenceFlow_0w9t6tc - - - - - - SequenceFlow_18wj44x - SequenceFlow_11f2zuu - - - - - - - SequenceFlow_1hbesp9 - - - - - SequenceFlow_1qozd66 - - - - - - - - - - - SequenceFlow_0epxs3b - - - - - SequenceFlow_0gr9xqj - - - - SequenceFlow_0a6l29p - - - SequenceFlow_0gr9xqj - SequenceFlow_0a6l29p - - - - - - - SequenceFlow_1vprtt9 - SequenceFlow_0k0f7lm - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstance.bpmn deleted file mode 100644 index 7b2ededb6f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstance.bpmn +++ /dev/null @@ -1,515 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_2 - SequenceFlow_3 - - - - - SequenceFlow_1 - SequenceFlow_2 - - - - - SequenceFlow_156ih25 - SequenceFlow_14 - - - - SequenceFlow_9 - SequenceFlow_10 - - - - - - - - - - - - SequenceFlow_14 - SequenceFlow_9 - - - SequenceFlow_01q6pl4 - - - - - - - - - - - - - - - SequenceFlow_11fnnkb - SequenceFlow_4 - - - - - - - - - - - - - SequenceFlow_1uw2p9a - SequenceFlow_1w01tqs - SequenceFlow_1jhzmzn - - - SequenceFlow_3 - SequenceFlow_11fnnkb - SequenceFlow_1uw2p9a - - - - - - - - SequenceFlow_0tgrn11 - - - - SequenceFlow_1xzgv5k - - - - - - - - - - SequenceFlow_1lqktwf - SequenceFlow_0eumzpf - - - - - SequenceFlow_0tgrn11 - SequenceFlow_1lqktwf - - - - - SequenceFlow_0eumzpf - SequenceFlow_1xzgv5k - - - - - - SequenceFlow_0w5i6vf - SequenceFlow_156ih25 - SequenceFlow_00v4npo - - - - SequenceFlow_00v4npo - - - - - - SequenceFlow_4 - SequenceFlow_1w01tqs - - - - - - - - - - - - - - - SequenceFlow_10 - SequenceFlow_0tx5frq - - - - - SequenceFlow_0tx5frq - SequenceFlow_01q6pl4 - - - - SequenceFlow_1jhzmzn - SequenceFlow_16sdyz9 - - - - - SequenceFlow_16sdyz9 - SequenceFlow_0k0wn03 - - - - SequenceFlow_0k0wn03 - SequenceFlow_0w5i6vf - - - - - - - - SequenceFlow_0x48any - SequenceFlow_052o4xc - - - - SequenceFlow_0x48any - - - - SequenceFlow_052o4xc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollback.bpmn deleted file mode 100644 index ef5ce351d2..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollback.bpmn +++ /dev/null @@ -1,373 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_2 - - - - SequenceFlow_01l4ssl - - - - SequenceFlow_8 - - - - SequenceFlow_7 - - - - SequenceFlow_8 - SequenceFlow_7 - - - - - - - SequenceFlow_06aasqh - SequenceFlow_11fnnkb - SequenceFlow_1uw2p9a - - - - - - - rollback AAI - SequenceFlow_1uw2p9a - SequenceFlow_1njogr1 - SequenceFlow_1n7wade - SequenceFlow_1x9eh33 - - - - - - - - - - - - - SequenceFlow_11fnnkb - SequenceFlow_0k28xib - - - SequenceFlow_0k28xib - SequenceFlow_0khjo7l - - - - - SequenceFlow_2 - SequenceFlow_06aasqh - SequenceFlow_1rzlaoy - - - SequenceFlow_1n7wade - SequenceFlow_1rzlaoy - SequenceFlow_0h3wkj4 - SequenceFlow_01l4ssl - - - - - - - - - - SequenceFlow_1ch4xrf - - - - SequenceFlow_1ch4xrf - SequenceFlow_1pjk2ff - - - - SequenceFlow_1pjk2ff - - - - - - - SequenceFlow_006g9e8 - SequenceFlow_1njogr1 - - - - - - - - - - - - SequenceFlow_0khjo7l - SequenceFlow_006g9e8 - - - - - SequenceFlow_1x9eh33 - SequenceFlow_0h3wkj4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollbackV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollbackV2.bpmn deleted file mode 100644 index 7853aa9586..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollbackV2.bpmn +++ /dev/null @@ -1,103 +0,0 @@ - - - - - SequenceFlow_0r35zfs - - - - SequenceFlow_1f949uf - - - - SequenceFlow_0r35zfs - SequenceFlow_1f949uf - - - - - SequenceFlow_1tnfu1n - - - - - SequenceFlow_0hi9120 - - - - SequenceFlow_1tnfu1n - SequenceFlow_0hi9120 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceV2.bpmn deleted file mode 100644 index 251af54305..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceV2.bpmn +++ /dev/null @@ -1,197 +0,0 @@ - - - - - SequenceFlow_0g8qp84 - - - - - SequenceFlow_0ekno6w - SequenceFlow_1t50vt9 - SequenceFlow_0xhy3o1 - - - - - - - SequenceFlow_0xhy3o1 - - - - SequenceFlow_0eryvle - - - - SequenceFlow_0g8qp84 - SequenceFlow_0651nnp - - - - SequenceFlow_0651nnp - SequenceFlow_0u0ptz7 - - - - SequenceFlow_0u0ptz7 - SequenceFlow_0ekno6w - - - - SequenceFlow_1t50vt9 - SequenceFlow_0eryvle - - - - - SequenceFlow_0mk8fd7 - - - - SequenceFlow_14mdxgk - - - - - - - - - - SequenceFlow_0mk8fd7 - SequenceFlow_14mdxgk - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModule.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModule.bpmn deleted file mode 100644 index e6d25a4b9f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModule.bpmn +++ /dev/null @@ -1,1701 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_15 - - - - - SequenceFlow_15 - SequenceFlow_11 - SequenceFlow_40 - - - - - - - - - - - - - - SequenceFlow_43 - SequenceFlow_17 - - - - SequenceFlow_17 - SequenceFlow_19 - SequenceFlow_21 - - - - - - - - - - - - - - - SequenceFlow_19 - SequenceFlow_35 - - - - SequenceFlow_11 - SequenceFlow_21 - SequenceFlow_35 - SequenceFlow_6 - - - - - - - - - - - - - SequenceFlow_18 - SequenceFlow_20 - - - SequenceFlow_20 - SequenceFlow_1nh92s8 - - - - SequenceFlow_8 - SequenceFlow_18 - - - - - - SequenceFlow_0p61zug - SequenceFlow_0aegg0r - SequenceFlow_23 - - - - - - - - - - - - - SequenceFlow_23 - SequenceFlow_24 - - - - - SequenceFlow_24 - SequenceFlow_31 - - - - - - - - - - SequenceFlow_5 - SequenceFlow_10 - - - SequenceFlow_1avfxsz - SequenceFlow_5 - - - - SequenceFlow_10 - SequenceFlow_12 - - - - - - - - - - - - - SequenceFlow_12 - SequenceFlow_13 - - - SequenceFlow_13 - SequenceFlow_14 - - - - SequenceFlow_14 - SequenceFlow_30 - SequenceFlow_28 - - - - - - - - - SequenceFlow_0363dz7 - - - - SequenceFlow_8 - - - - - SequenceFlow_28 - SequenceFlow_3 - - - - - - - - - - SequenceFlow_3 - SequenceFlow_29 - - - - - SequenceFlow_30 - SequenceFlow_29 - SequenceFlow_16 - - - - SequenceFlow_31 - SequenceFlow_32 - - - - - - - - - - - - SequenceFlow_32 - SequenceFlow_33 - - - SequenceFlow_33 - SequenceFlow_1ushk1d - - - - SequenceFlow_0xfanpi - SequenceFlow_0abffyj - - - - - - - SequenceFlow_0zcfn2x - SequenceFlow_170kw7h - - - - SequenceFlow_39 - SequenceFlow_37 - SequenceFlow_0zcfn2x - SequenceFlow_0m382su - - - SequenceFlow_25 - SequenceFlow_27 - - - - - SequenceFlow_27 - SequenceFlow_36 - SequenceFlow_39 - - - - - - - SequenceFlow_36 - SequenceFlow_37 - - - - - SequenceFlow_16 - SequenceFlow_7 - - - - - SequenceFlow_7 - - - - SequenceFlow_40 - SequenceFlow_43 - - - - - - - - SequenceFlow_1 - SequenceFlow_4 - - - - - SequenceFlow_1f53tby - SequenceFlow_0270n5c - - - - - - - - - - - - - - - - - - - - - SequenceFlow_6 - SequenceFlow_25 - - - - SequenceFlow_1ushk1d - SequenceFlow_0ery1pk - SequenceFlow_0xfanpi - - - - - - - - - SequenceFlow_0ery1pk - SequenceFlow_0abffyj - - - - SequenceFlow_0363dz7 - SequenceFlow_0bi38s7 - SequenceFlow_1k5uku2 - - - SequenceFlow_112los9 - SequenceFlow_1k5uku2 - SequenceFlow_1avfxsz - - - - - - - - - - - SequenceFlow_0bi38s7 - SequenceFlow_1qm81ym - - - - - - - - - - - SequenceFlow_1qm81ym - SequenceFlow_112los9 - - - - - - - - - SequenceFlow_0d00zqi - SequenceFlow_0g270u0 - - - - - - - - - - - - - SequenceFlow_0g270u0 - SequenceFlow_1yrlvgb - - - SequenceFlow_1yrlvgb - SequenceFlow_170kw7h - - - - - - - - - - - - - SequenceFlow_0m382su - SequenceFlow_0d00zqi - - - - SequenceFlow_1y1ttqe - SequenceFlow_0lilmm3 - SequenceFlow_0270n5c - SequenceFlow_05og7iw - - - - - - - - - - - - - - - - SequenceFlow_05og7iw - SequenceFlow_1f53tby - - - - SequenceFlow_02lc25j - - - - SequenceFlow_0z2rczk - SequenceFlow_1pgo10r - - - - - - - - - - - - - SequenceFlow_1i1q78e - SequenceFlow_0112l2c - - - SequenceFlow_04bd5in - SequenceFlow_1i1q78e - - - - SequenceFlow_0112l2c - SequenceFlow_0z2rczk - - - - - - - - SequenceFlow_02lc25j - SequenceFlow_04bd5in - SequenceFlow_1nh7m8d - - - - - - - SequenceFlow_1nh7m8d - SequenceFlow_1pgo10r - - - - - - SequenceFlow_0cc17yk - SequenceFlow_17cp3tn - SequenceFlow_006rnym - - - - - - SequenceFlow_4 - SequenceFlow_1y1ttqe - SequenceFlow_1y8q87e - - - - SequenceFlow_1sf1091 - SequenceFlow_0lilmm3 - SequenceFlow_15i583d - - - - - - - - - - - SequenceFlow_00bh7m7 - - - - - - - SequenceFlow_1nh92s8 - SequenceFlow_16mgvsd - SequenceFlow_1iyt5i4 - - - - - - - - - - - - - - - - - - - SequenceFlow_0ynd0iy - SequenceFlow_1mnipp8 - - - SequenceFlow_17cp3tn - SequenceFlow_0ynd0iy - - - - SequenceFlow_16mgvsd - SequenceFlow_0cc17yk - - - - SequenceFlow_1y8q87e - SequenceFlow_1sf1091 - - - - SequenceFlow_1mnipp8 - SequenceFlow_00bh7m7 - - - - SequenceFlow_15i583d - SequenceFlow_0tfrcnc - SequenceFlow_0oadvvx - - - - - - - SequenceFlow_0tfrcnc - SequenceFlow_0c6p4aa - SequenceFlow_1qzw172 - - - - - - SequenceFlow_1qzw172 - SequenceFlow_0xed5sn - SequenceFlow_0p3cspl - - - - - - - SequenceFlow_0xed5sn - SequenceFlow_1k7xbcu - SequenceFlow_0p61zug - - - - - SequenceFlow_0oadvvx - SequenceFlow_03batve - - - - - - - - - - - - - - SequenceFlow_03batve - SequenceFlow_0c6p4aa - - - SequenceFlow_0p3cspl - SequenceFlow_1k7xbcu - - - - SequenceFlow_006rnym - SequenceFlow_1iyt5i4 - SequenceFlow_0thm33s - - - - - - - - - - SequenceFlow_0thm33s - SequenceFlow_0aegg0r - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn deleted file mode 100644 index d9f1dc71fb..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn +++ /dev/null @@ -1,978 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_11er1t8 - SequenceFlow_6 - SequenceFlow_9 - - - - - - - - - SequenceFlow_6 - SequenceFlow_8 - - - - - - - - SequenceFlow_8 - SequenceFlow_9 - SequenceFlow_10 - SequenceFlow_15 - - - SequenceFlow_1p0v6yk - SequenceFlow_16 - - - - - - - - - - - - - SequenceFlow_16 - SequenceFlow_08aruzz - - - - - - - SequenceFlow_13 - SequenceFlow_14 - - - - - - - - - - SequenceFlow_14 - SequenceFlow_18 - - - - SequenceFlow_1gcfdej - SequenceFlow_13 - SequenceFlow_17 - - - - - - - SequenceFlow_17 - SequenceFlow_18 - SequenceFlow_19 - SequenceFlow_20 - - - - - - - SequenceFlow_1rpg6ac - SequenceFlow_32 - - - - - - - - - - - - - - SequenceFlow_32 - SequenceFlow_2 - - - SequenceFlow_20 - SequenceFlow_4 - SequenceFlow_12otwa4 - SequenceFlow_21 - SequenceFlow_24 - - - - - - - - - - - - - SequenceFlow_34 - SequenceFlow_35 - - - - SequenceFlow_0ggp8wz - SequenceFlow_1h8ve60 - - - SequenceFlow_24 - SequenceFlow_34 - - - - - - SequenceFlow_2 - SequenceFlow_4 - - - - - - SequenceFlow_12 - - - - SequenceFlow_22 - - - - - SequenceFlow_02fx6z6 - SequenceFlow_22 - - - - - SequenceFlow_12 - SequenceFlow_02fx6z6 - - - - - SequenceFlow_23 - - - - SequenceFlow_23 - - - - SequenceFlow_1 - SequenceFlow_5 - - - - - SequenceFlow_0djpj3r - SequenceFlow_0n58kg1 - SequenceFlow_185bo77 - SequenceFlow_111l1he - - - SequenceFlow_0unumxv - SequenceFlow_0djpj3r - - - - SequenceFlow_111l1he - SequenceFlow_0ca4brn - - - - - - - - - - - SequenceFlow_0ca4brn - SequenceFlow_19r2uus - - - - SequenceFlow_185bo77 - SequenceFlow_19r2uus - SequenceFlow_1p0v6yk - SequenceFlow_03i4czf - - - - - - - - - - - - - SequenceFlow_5 - SequenceFlow_11er1t8 - SequenceFlow_0ggp8wz - - - - - - - SequenceFlow_06rm0hg - SequenceFlow_15 - SequenceFlow_0n58kg1 - SequenceFlow_0unumxv - - - SequenceFlow_10 - SequenceFlow_0ugalf8 - - - - - - - - - - - - - SequenceFlow_0ugalf8 - SequenceFlow_0n78x37 - - - SequenceFlow_0n78x37 - SequenceFlow_06rm0hg - - - - - - - - - - - - - SequenceFlow_16ghmax - SequenceFlow_1iufuuu - - - - - - - - - - - - - SequenceFlow_1iufuuu - SequenceFlow_1l4n37b - - - SequenceFlow_1l4n37b - SequenceFlow_12otwa4 - - - - SequenceFlow_19 - SequenceFlow_1rpg6ac - SequenceFlow_16ghmax - - - - - - - - - SequenceFlow_21 - SequenceFlow_35 - SequenceFlow_17it51d - SequenceFlow_1h8ve60 - - - - SequenceFlow_03i4czf - SequenceFlow_08aruzz - SequenceFlow_1gcfdej - SequenceFlow_17ne2iz - - - - - - - - - - - - - - SequenceFlow_0fvuowt - SequenceFlow_17it51d - - - SequenceFlow_17ne2iz - SequenceFlow_0fvuowt - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn deleted file mode 100644 index fd2889f642..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - SequenceFlow_0xktw7v - SequenceFlow_0soe5t3 - - - - SequenceFlow_0xktw7v - - - - SequenceFlow_0soe5t3 - - - - - - SequenceFlow_0qreiaa - - - - SequenceFlow_1xah9es - SequenceFlow_11y7faf - SequenceFlow_1wberw3 - - - SequenceFlow_11y7faf - SequenceFlow_0h7k68j - SequenceFlow_10dawse - - - - - - - - - - SequenceFlow_0h7k68j - SequenceFlow_0bv04qn - - - - - - SequenceFlow_0bv04qn - SequenceFlow_17k6oyz - SequenceFlow_13nb3n0 - - - - - - - SequenceFlow_10dawse - SequenceFlow_17k6oyz - SequenceFlow_1do0853 - - - - - - - SequenceFlow_1do0853 - SequenceFlow_1wberw3 - - - SequenceFlow_13nb3n0 - - - - - - SequenceFlow_0qreiaa - SequenceFlow_1xah9es - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn deleted file mode 100644 index 18e972c0a9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn +++ /dev/null @@ -1,362 +0,0 @@ - - - - - SequenceFlow_1 - SequenceFlow_1wi1cf9 - - - - SequenceFlow_1dpt7ul - SequenceFlow_23 - - - - - SequenceFlow_volGrpName404No - SequenceFlow_7 - - - - - SequenceFlow_19 - SequenceFlow_6 - SequenceFlow_volGrpName404Yes - SequenceFlow_volGrpName404No - - - - - - - SequenceFlow_23 - SequenceFlow_14 - - - - - SequenceFlow_19 - - - - - SequenceFlow_14 - SequenceFlow_6 - - - - - SequenceFlow_volGrpName404Yes - SequenceFlow_9 - - - - - - - - - - - - - - - SequenceFlow_10 - SequenceFlow_1qwurc5 - - - SequenceFlow_1gbt2n5 - SequenceFlow_28 - - - - - SequenceFlow_5 - SequenceFlow_8 - - - - - SequenceFlow_28 - SequenceFlow_5 - - - - - SequenceFlow_8 - - - SequenceFlow_9 - SequenceFlow_10 - - - - - SequenceFlow_1 - - - - SequenceFlow_7 - - - SequenceFlow_1qwurc5 - SequenceFlow_1gbt2n5 - - - - - - - - - - - - - SequenceFlow_1wi1cf9 - SequenceFlow_1vmbvy8 - - - SequenceFlow_1vmbvy8 - SequenceFlow_1dpt7ul - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnf.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnf.bpmn deleted file mode 100644 index 9bf3972523..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnf.bpmn +++ /dev/null @@ -1,658 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_2 - - - - - notFound - SequenceFlow_6 - - - - - - - - - - - - - - - - SequenceFlow_2 - SequenceFlow_4 - - - - SequenceFlow_4 - notFound - found - - - - - - - SequenceFlow_7 - vnfExistYes - vnfExistNo - - - - - - - - - - - - - - - - VnfNameSpecified1 - SequenceFlow_7 - - - - vnfExistYes - SequenceFlow_10 - - - - - SequenceFlow_6 - - - - SequenceFlow_10 - - - - vnfExistNo - VnfNameNotSpecified1 - SequenceFlow_11 - - - - - - - - - - - - - SequenceFlow_11 - SequenceFlow_0seif8n - - - - SequenceFlow_8 - SequenceFlow_9 - - - - - SequenceFlow_9 - - - SequenceFlow_8 - - - - - - SdncInteractionNotEnabled - SequenceFlow_0bj7c4s - - - - - - - - - SdncInteractionEnabled - SequenceFlow_1q6udwm - - - - - - - - - - - - - SequenceFlow_1q6udwm - SequenceFlow_15knw0q - - - SequenceFlow_15knw0q - SequenceFlow_0lnh79j - - - - SequenceFlow_1q1poly - VnfNameSpecified2 - SequenceFlow_1lalmvp - - - - - - - - - - - - - SequenceFlow_1lalmvp - SequenceFlow_0eb41vb - - - SequenceFlow_0eb41vb - SequenceFlow_15z3gpq - - - - SequenceFlow_1gc18ih - SdncInteractionEnabled - SdncInteractionNotEnabled - - - - - - - - - SequenceFlow_0seif8n - SequenceFlow_1gc18ih - - - - found - VnfNameNotSpecified1 - VnfNameSpecified1 - - - - - - - - - - SequenceFlow_0lnh79j - VnfNameNotSpecified2 - VnfNameSpecified2 - - - - - - - - VnfNameNotSpecified2 - SequenceFlow_1h9jdgr - - - - - - - - - - - - - SequenceFlow_1h9jdgr - SequenceFlow_14xac2y - - - SequenceFlow_14xac2y - SequenceFlow_1q1poly - - - - - - - - - - - - SequenceFlow_0nhsdmj - SequenceFlow_0bj7c4s - - - - SequenceFlow_15z3gpq - SequenceFlow_0nhsdmj - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn deleted file mode 100644 index 8cbc7e97cd..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn +++ /dev/null @@ -1,491 +0,0 @@ - - - - - SequenceFlow_0o4vuzt - - - SequenceFlow_0o4vuzt - SequenceFlow_1xd3ri5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_1hf7k7q - SequenceFlow_1ixcnb6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_1lh21yl - SequenceFlow_1llbx0k - - - SequenceFlow_1llbx0k - SequenceFlow_1mguf2m - - - - SequenceFlow_132bohl - - - - - - - - - - SequenceFlow_1a6wyuu - SequenceFlow_0j52dxv - SequenceFlow_132bohl - SequenceFlow_0jz6bqn - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_19ohb1a - SequenceFlow_07u8e3l - - - SequenceFlow_0jz6bqn - SequenceFlow_12x4dvf - - - - SequenceFlow_1xd3ri5 - SequenceFlow_19ohb1a - - - - SequenceFlow_1mguf2m - SequenceFlow_12x4dvf - SequenceFlow_0kld3qt - SequenceFlow_1vrogpr - - - - - - - - - - - - - - - - - - - - - SequenceFlow_07u8e3l - SequenceFlow_1hf7k7q - - - - - - - - - - - - SequenceFlow_0kld3qt - SequenceFlow_1lh21yl - - - - - - - SequenceFlow_1ixcnb6 - SequenceFlow_1a6wyuu - - - - - SequenceFlow_1h74w1v - - - - - - - - - - - SequenceFlow_03v8mmc - SequenceFlow_0yu0im2 - - - SequenceFlow_1l0rxnh - SequenceFlow_03v8mmc - - - - SequenceFlow_0yu0im2 - SequenceFlow_1h74w1v - - - - - - - - SequenceFlow_1l0rxnh - - - - - - - - SequenceFlow_1vrogpr - SequenceFlow_0j52dxv - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModulesRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModulesRollback.bpmn deleted file mode 100644 index 57baf6ebe5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModulesRollback.bpmn +++ /dev/null @@ -1,541 +0,0 @@ - - - - - - SequenceFlow_12 - - - - SequenceFlow_22 - - - - SequenceFlow_1wch84s - SequenceFlow_22 - - - - - - SequenceFlow_12 - SequenceFlow_1wch84s - - - - - SequenceFlow_23 - - - - SequenceFlow_23 - - - - SequenceFlow_1537b7m - - - SequenceFlow_1srw52v - SequenceFlow_0zjzorm - SequenceFlow_19xaddm - SequenceFlow_1r6wyy6 - SequenceFlow_0v85t87 - - - SequenceFlow_1g6psjt - SequenceFlow_152tazp - SequenceFlow_1kr0r4a - SequenceFlow_1yas9ol - - - SequenceFlow_0mk9lrj - SequenceFlow_03cc9y6 - - - - SequenceFlow_1537b7m - SequenceFlow_0bmsi5h - - - - - - SequenceFlow_0v85t87 - SequenceFlow_1ycq005 - - - - - - - - - - - - - - - - SequenceFlow_1ycq005 - SequenceFlow_181hb2a - - - - 0}]]> - - - - - - - - - - - - - SequenceFlow_1kr0r4a - SequenceFlow_04yd2yr - - - - SequenceFlow_181hb2a - SequenceFlow_1srw52v - - - - - SDNCDeactivateYes - SequenceFlow_0nysmc9 - - - - SequenceFlow_1hc04x2 - SequenceFlow_19xaddm - - - - - - - - - - - - - SequenceFlow_0nysmc9 - SequenceFlow_1hc04x2 - - - - - SequenceFlow_1rezswi - SequenceFlow_0zjzorm - SDNCDeactivateYes - - - - - - - - SequenceFlow_1r6wyy6 - SequenceFlow_1g6psjt - SequenceFlow_01am36p - - - - SequenceFlow_01am36p - SequenceFlow_0a5ecvu - - - - - - - - - - - - - SequenceFlow_0a5ecvu - SequenceFlow_1ilok6u - - - SequenceFlow_1ilok6u - SequenceFlow_152tazp - - - - - - - - - - SequenceFlow_0bmsi5h - SequenceFlow_1rezswi - SequenceFlow_0mk9lrj - - - - - - - - SequenceFlow_1yas9ol - SequenceFlow_04yd2yr - SequenceFlow_03cc9y6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn deleted file mode 100644 index 561a84b7c4..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn +++ /dev/null @@ -1,497 +0,0 @@ - - - - - SequenceFlow_0vz7cd9 - - - SequenceFlow_0vz7cd9 - SequenceFlow_11e6bfy - - - - SequenceFlow_0e7inkl - - - - - - - - - - - - - SequenceFlow_1ev7z6q - SequenceFlow_0oj2anh - SequenceFlow_0g6bxqw - - - SequenceFlow_188ejvu - SequenceFlow_0vi0sv6 - - - - SequenceFlow_0g6bxqw - SequenceFlow_0e7inkl - - - - - SequenceFlow_1921mo3 - - - - SequenceFlow_18vlzfo - - - SequenceFlow_1921mo3 - SequenceFlow_18vlzfo - - - - - - - - - - - - SequenceFlow_1ubor5z - SequenceFlow_1dza4q4 - - - - - - SequenceFlow_1x3lehs - SequenceFlow_1wnkgpx - - - - - - - - - - - - - - SequenceFlow_1wnkgpx - SequenceFlow_0phwem2 - - - SequenceFlow_1dza4q4 - SequenceFlow_1lxqjmp - - - SequenceFlow_1icwpye - SequenceFlow_1ev7z6q - - - SequenceFlow_0vi0sv6 - SequenceFlow_1ym9otf - - - - - - - ${URN_mso_adapters_openecomp_db_endpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_initResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1ym9otf - SequenceFlow_1j08ko3 - - - - - - - - - - - - - - - SequenceFlow_11e6bfy - SequenceFlow_188ejvu - - - - SequenceFlow_1j08ko3 - SequenceFlow_03c0zlq - - - - - SequenceFlow_1htjmkv - SequenceFlow_1ubor5z - SequenceFlow_1x3lehs - - - SequenceFlow_03c0zlq - SequenceFlow_0s1lswk - SequenceFlow_1htjmkv - - - - - - - - - - - - SequenceFlow_1lxqjmp - SequenceFlow_0phwem2 - SequenceFlow_0l5r96s - - - - - - SequenceFlow_0l5r96s - SequenceFlow_0talboa - SequenceFlow_0s1lswk - - - - SequenceFlow_0talboa - SequenceFlow_1icwpye - SequenceFlow_0oj2anh - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn deleted file mode 100644 index f66a3c6a42..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn +++ /dev/null @@ -1,956 +0,0 @@ - - - - - SequenceFlow_0vz7cd9 - - - SequenceFlow_0vz7cd9 - SequenceFlow_11e6bfy - - - - SequenceFlow_06tonva - - - - - - - - - - - - - SequenceFlow_0t5f2dt - SequenceFlow_0g6bxqw - - - SequenceFlow_188ejvu - SequenceFlow_00a3ijv - - - - SequenceFlow_0g6bxqw - SequenceFlow_0e7inkl - - - - - SequenceFlow_1921mo3 - - - - SequenceFlow_18vlzfo - - - SequenceFlow_1921mo3 - SequenceFlow_18vlzfo - - - - - - - - - - - SequenceFlow_1931m8u - SequenceFlow_17b01zs - - - - SequenceFlow_1w2n8dn - SequenceFlow_09z6zl7 - - - - SequenceFlow_1jfyo1x - SequenceFlow_1t1mg6y - - - - - - - SequenceFlow_1bx4es4 - SequenceFlow_1wnkgpx - - - - - - - - - - - - - - SequenceFlow_1wnkgpx - SequenceFlow_1931m8u - - - SequenceFlow_0a1q5fw - SequenceFlow_0rpu756 - - - - - SequenceFlow_1lv9vmb - SequenceFlow_16r9z75 - - - - SequenceFlow_0m7ks9t - SequenceFlow_1g4djgh - - - SequenceFlow_0akcnw7 - SequenceFlow_0uc2beq - - - - - - - - - - - - - - SequenceFlow_11e6bfy - SequenceFlow_188ejvu - - - - SequenceFlow_1qzxy2i - - - - SequenceFlow_1jfyo1x - - - - - - SequenceFlow_09z6zl7 - - - - - SequenceFlow_0homduu - - - - - SequenceFlow_0t5f2dt - - - - - SequenceFlow_0homduu - SequenceFlow_0eoibq3 - SequenceFlow_0n7qeqt - SequenceFlow_13c2v9z - - - - SequenceFlow_0n7qeqt - SequenceFlow_1a5ki3p - - - - - SequenceFlow_17b01zs - SequenceFlow_0gxv0wp - - - - - SequenceFlow_13c2v9z - - - - - - - SequenceFlow_1t1mg6y - SequenceFlow_0a1q5fw - SequenceFlow_1fac57w - - - - - - - SequenceFlow_0rpu756 - SequenceFlow_1fac57w - SequenceFlow_1lv9vmb - - - - - SequenceFlow_16r9z75 - SequenceFlow_0m7ks9t - SequenceFlow_00knko8 - - - - - - - SequenceFlow_1g4djgh - SequenceFlow_00knko8 - SequenceFlow_0akcnw7 - SequenceFlow_15pzf5n - - - - - - - SequenceFlow_033eqeg - - - - - SequenceFlow_00a3ijv - - - - - SequenceFlow_18wibmi - SequenceFlow_11405m9 - - - - - SequenceFlow_033eqeg - SequenceFlow_1sm5x5e - - - - - - - ${URN_mso_openecomp_adapters_db_endpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1sm5x5e - SequenceFlow_18wibmi - - - - - SequenceFlow_0e7inkl - SequenceFlow_0l4qcge - - - - - - - ${URN_mso_openecomp_adapters_db_endpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_0l4qcge - SequenceFlow_06tonva - - - - - SequenceFlow_0gxv0wp - SequenceFlow_1i96ytk - - - - - - - - ${URN_mso_openecomp_adapters_db_endpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1i96ytk - SequenceFlow_0eoibq3 - - - - SequenceFlow_1a5ki3p - SequenceFlow_1oo4g4h - - - - - SequenceFlow_0uc2beq - SequenceFlow_15pzf5n - SequenceFlow_1w2n8dn - - - - - - - - ${URN_mso_openecomp_adapters_db_endpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1oo4g4h - SequenceFlow_1bx4es4 - - - - SequenceFlow_11405m9 - SequenceFlow_15d5odq - - - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_initResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_15d5odq - SequenceFlow_1qzxy2i - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteAllottedResourceBRG.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteAllottedResourceBRG.bpmn deleted file mode 100644 index 82524a1507..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteAllottedResourceBRG.bpmn +++ /dev/null @@ -1,422 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_0bfuk6l - - - - SequenceFlow_0bfuk6l - SequenceFlow_0xm9g9s - - - - SequenceFlow_0ymy62j - - - - - - - - - - SequenceFlow_0gd64w9 - SequenceFlow_1q6udwm - - - - - - - - - - - - SequenceFlow_1q6udwm - SequenceFlow_15knw0q - - - SequenceFlow_15knw0q - SequenceFlow_0c5h00o - - - - foundInSDNC - SequenceFlow_1lalmvp - - - - - - - - - - - - SequenceFlow_1lalmvp - SequenceFlow_0eb41vb - - - SequenceFlow_0eb41vb - SequenceFlow_15z3gpq - - - - SequenceFlow_15z3gpq - SequenceFlow_06w33tk - - - - - - - - - - - - SequenceFlow_06w33tk - SequenceFlow_1s7yieq - - - SequenceFlow_1s7yieq - SequenceFlow_00i7x43 - - - - - - - - SequenceFlow_1h61pqs - - - - SequenceFlow_1kbzr5v - - - SequenceFlow_1h61pqs - SequenceFlow_1kbzr5v - - - - - - - SequenceFlow_00i7x43 - notFoundInSDNC - SequenceFlow_0ymy62j - - - - SequenceFlow_0c5h00o - foundInSDNC - notFoundInSDNC - - - SequenceFlow_0gd64w9 - - - - - SequenceFlow_0xm9g9s - SequenceFlow_0g4cl5f - - - - SequenceFlow_0g4cl5f - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteAllottedResourceTXC.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteAllottedResourceTXC.bpmn deleted file mode 100644 index cac6c241a5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteAllottedResourceTXC.bpmn +++ /dev/null @@ -1,422 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_0bfuk6l - - - - SequenceFlow_0bfuk6l - SequenceFlow_0xm9g9s - - - - SequenceFlow_0ymy62j - - - - - - - - - - SequenceFlow_0gd64w9 - SequenceFlow_1q6udwm - - - - - - - - - - - - SequenceFlow_1q6udwm - SequenceFlow_15knw0q - - - SequenceFlow_15knw0q - SequenceFlow_0c5h00o - - - - foundInSDNC - SequenceFlow_1lalmvp - - - - - - - - - - - - SequenceFlow_1lalmvp - SequenceFlow_0eb41vb - - - SequenceFlow_0eb41vb - SequenceFlow_15z3gpq - - - - SequenceFlow_15z3gpq - SequenceFlow_06w33tk - - - - - - - - - - - - SequenceFlow_06w33tk - SequenceFlow_1s7yieq - - - SequenceFlow_1s7yieq - SequenceFlow_00i7x43 - - - - - - - - SequenceFlow_1h61pqs - - - - SequenceFlow_1kbzr5v - - - SequenceFlow_1h61pqs - SequenceFlow_1kbzr5v - - - - - - - SequenceFlow_00i7x43 - notFoundInSDNC - SequenceFlow_0ymy62j - - - - SequenceFlow_0c5h00o - foundInSDNC - notFoundInSDNC - - - SequenceFlow_0gd64w9 - - - - - SequenceFlow_0xm9g9s - SequenceFlow_0g4cl5f - - - - SequenceFlow_0g4cl5f - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn deleted file mode 100644 index 78eabb99de..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn +++ /dev/null @@ -1,405 +0,0 @@ - - - - - SequenceFlow_0vz7cd9 - - - SequenceFlow_0vz7cd9 - SequenceFlow_11e6bfy - - - - SequenceFlow_0e7inkl - - - - - - - - - - - - - SequenceFlow_1cevtpy - SequenceFlow_0g6bxqw - - - SequenceFlow_188ejvu - SequenceFlow_0vi0sv6 - - - - SequenceFlow_0g6bxqw - SequenceFlow_0e7inkl - - - - - SequenceFlow_1921mo3 - - - - SequenceFlow_18vlzfo - - - SequenceFlow_1921mo3 - SequenceFlow_18vlzfo - - - - - - - - - - - SequenceFlow_1961633 - SequenceFlow_1ym9otf - - - - - - - ${URN_mso_adapters_openecomp_db_endpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_initResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1ym9otf - SequenceFlow_1j08ko3 - - - - - - - - - - - - - - - SequenceFlow_11e6bfy - SequenceFlow_188ejvu - - - - - - - - SequenceFlow_0ha8ix9 - - - - SequenceFlow_1961633 - - - - - SequenceFlow_1q2mqnm - SequenceFlow_0fo5vw5 - - - - - - - - - - - - - - - SequenceFlow_0fo5vw5 - SequenceFlow_0orw2f8 - - - SequenceFlow_0orw2f8 - SequenceFlow_0ha8ix9 - - - - - - - - - - - - - - - - - - SequenceFlow_1j08ko3 - SequenceFlow_1cevtpy - - - - SequenceFlow_1q2mqnm - - - - - SequenceFlow_0vi0sv6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteNetworkInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteNetworkInstance.bpmn deleted file mode 100644 index 6f58f62476..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteNetworkInstance.bpmn +++ /dev/null @@ -1,933 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_0msqfwu - SequenceFlow_6 - - - - - - - - - - - - - - SequenceFlow_1pdp4d2 - SequenceFlow_12 - - - - SequenceFlow_12 - SequenceFlow_1jnva78 - SequenceFlow_5 - - - - - SequenceFlow_8 - - - - - SequenceFlow_5 - sdncTopoDeleteNo_SequenceFlow - sdncTopoDeleteYes_SequenceFlow - - - SequenceFlow_8 - sdncTopoDeleteNo_SequenceFlow - - - - - - - - - SequenceFlow_1a51h25 - - - - SequenceFlow_1yvnovn - - - SequenceFlow_1nl99y6 - SequenceFlow_1yvnovn - - - - - - SequenceFlow_1wif0e5 - - - - SequenceFlow_021b0sz - SequenceFlow_0tiz0kk - SequenceFlow_1suj1nc - - - - - - - - - - - - - - - - - - - - - SequenceFlow_147vc14 - - - SequenceFlow_0tiz0kk - SequenceFlow_0jb7rws - SequenceFlow_1raa09h - - - - - - SequenceFlow_1suj1nc - SequenceFlow_1raa09h - SequenceFlow_0jb7rws - SequenceFlow_1nl99y6 - - - - - SequenceFlow_1wif0e5 - SequenceFlow_147vc14 - - - - - - - SequenceFlow_1a51h25 - SequenceFlow_021b0sz - - - Rollback Not Needed for Delete. - - - - - isRelationshipExistNo_SequenceFlow - querySuccessYes_SequenceFlow - querySuccessNo_SequenceFlow - - - - - - - querySuccessNo_SequenceFlow - isReturnCode404_No_SequenceFlow - isReturnCode404_Yes_SequenceFlow - - - - - - - isReturnCode404_No_SequenceFlow - - - - querySuccessYes_SequenceFlow - isResponseEmptyNo_SequenceFlow - isResponseEmptyYes_SequenceFlow - - - - - - - isReturnCode404_Yes_SequenceFlow - isResponseEmptyYes_SequenceFlow - silentSuccess_SequenceFlow - - - - SequenceFlow_0f25bme - - - isResponseEmptyNo_SequenceFlow - SequenceFlow_30 - - - - - SequenceFlow_6 - isRelationshipExistNo_SequenceFlow - isRelationshipExistYes_SequenceFlow - - - - - - - isRelationshipExistYes_SequenceFlow - - - - SequenceFlow_1pbgnr2 - - - SequenceFlow_0r3pvf8 - SequenceFlow_1pdp4d2 - - - - SequenceFlow_2 - SequenceFlow_20 - - - - - SequenceFlow_30 - SequenceFlow_15 - - - - - SequenceFlow_15 - SequenceFlow_2 - - - - - - SequenceFlow_13 - - - - SequenceFlow_17 - - - SequenceFlow_13 - SequenceFlow_17 - - - - - - - sdncTopoDeleteYes_SequenceFlow - SequenceFlow_1pbgnr2 - - - - - - SequenceFlow_20 - SequenceFlow_0r3pvf8 - SequenceFlow_0kqnddy - - - - SequenceFlow_0f13b17 - SequenceFlow_0zlbzad - - - - - - - - - - - - - SequenceFlow_0zlbzad - SequenceFlow_1jnva78 - - - - - - - - SequenceFlow_1 - SequenceFlow_0msqfwu - - - - - silentSuccess_SequenceFlow - SequenceFlow_0f25bme - - - - - - - - - - - - - - SequenceFlow_1o088sy - SequenceFlow_1i3193l - - - SequenceFlow_0kqnddy - SequenceFlow_1o088sy - - - - - SequenceFlow_0n8sf23 - SequenceFlow_1qyo7ot - SequenceFlow_0f13b17 - - - SequenceFlow_1i3193l - SequenceFlow_0n8sf23 - - - - SequenceFlow_08hus4u - - - - - - - - - - - SequenceFlow_08hus4u - SequenceFlow_1qyo7ot - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteNetworkInstanceRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteNetworkInstanceRollback.bpmn deleted file mode 100644 index fabcb5e2e5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteNetworkInstanceRollback.bpmn +++ /dev/null @@ -1,546 +0,0 @@ - - - - - SequenceFlow_1krl2dg - - - SequenceFlow_1krl2dg - SequenceFlow_0u41iz2 - - - - - - - - - - - - - - - SequenceFlow_1mxbdps - SequenceFlow_07s5r14 - - - SequenceFlow_0u41iz2 - SequenceFlow_1bb7zpp - SequenceFlow_1mxbdps - - - SequenceFlow_1xokvq6 - SequenceFlow_1xs882r - SequenceFlow_1ucaagl - - - - - - - - - SequenceFlow_1ucaagl - - - - - SequenceFlow_0xktw7v - SequenceFlow_0soe5t3 - - - - SequenceFlow_0xktw7v - - - - SequenceFlow_0soe5t3 - - - - - - SequenceFlow_1hcmrh9 - SequenceFlow_1pi168e - SequenceFlow_1xs882r - - - - SequenceFlow_1bb7zpp - SequenceFlow_07s5r14 - SequenceFlow_1yj3542 - SequenceFlow_18e00sw - - - - - - - ${DELNWKIR_rollbackNetworkRequest} - ${URN_mso_adapters_network_rest_endpoint} - - - #{BasicAuthHeaderValuePO} - application/xml - - - POST - ${response} - ${statusCode} - - http-connector - - - SequenceFlow_18e00sw - SequenceFlow_1eyt8z2 - - - - - - SequenceFlow_1yj3542 - SequenceFlow_1eyt8z2 - SequenceFlow_1xokvq6 - SequenceFlow_172safw - - - SequenceFlow_172safw - SequenceFlow_1wy1aba - SequenceFlow_1yltkyg - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_1yltkyg - SequenceFlow_1hcmrh9 - - - - - - - - - - - - SequenceFlow_1wy1aba - SequenceFlow_1pi168e - - - - - SequenceFlow_1s5yjuu - - - SequenceFlow_01hh1wq - SequenceFlow_1s5yjuu - - - - SequenceFlow_01hh1wq - - - - - - - SequenceFlow_0b0m3o7 - - - - SequenceFlow_141226w - - - - - - SequenceFlow_141226w - SequenceFlow_0b0m3o7 - - - - SequenceFlow_1lr1613 - - - - SequenceFlow_0np0b8p - - - - SequenceFlow_1lr1613 - SequenceFlow_0np0b8p - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResources.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResources.bpmn deleted file mode 100644 index 678d242c0c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResources.bpmn +++ /dev/null @@ -1,486 +0,0 @@ - - - - - SequenceFlow_0vz7cd9 - - - SequenceFlow_1r5306k - - - - SequenceFlow_1921mo3 - - - - SequenceFlow_18vlzfo - - - SequenceFlow_1921mo3 - SequenceFlow_18vlzfo - - - - - - - - SequenceFlow_1ubor5z - SequenceFlow_1dza4q4 - - - - - - SequenceFlow_1x3lehs - SequenceFlow_1wnkgpx - - - - - - - - - - - - - - SequenceFlow_1wnkgpx - SequenceFlow_0phwem2 - - - SequenceFlow_1dza4q4 - SequenceFlow_1lxqjmp - - - SequenceFlow_1icwpye - SequenceFlow_1yujjwx - - - SequenceFlow_0xqdf1z - SequenceFlow_03c0zlq - - - - SequenceFlow_1htjmkv - SequenceFlow_1ubor5z - SequenceFlow_1x3lehs - - - SequenceFlow_03c0zlq - SequenceFlow_0s1lswk - SequenceFlow_1htjmkv - - - - - - - - - - SequenceFlow_1lxqjmp - SequenceFlow_0phwem2 - SequenceFlow_0l5r96s - - - - - - SequenceFlow_0l5r96s - SequenceFlow_0talboa - SequenceFlow_0s1lswk - - - - SequenceFlow_0talboa - SequenceFlow_1icwpye - SequenceFlow_12avhgx - - - - - - - - - - - SequenceFlow_1yujjwx - SequenceFlow_12avhgx - SequenceFlow_1r5306k - - - - - SequenceFlow_042d7oc - SequenceFlow_1t2hfv0 - SequenceFlow_1t8hf8m - - - - - - - - - - - - - - - SequenceFlow_1t8hf8m - SequenceFlow_0p5gr4z - - - SequenceFlow_0p5gr4z - SequenceFlow_131imj8 - - - - - - - - - - - - SequenceFlow_1n85wxv - SequenceFlow_0xqdf1z - SequenceFlow_042d7oc - - - - - - - SequenceFlow_0vz7cd9 - SequenceFlow_1t2hfv0 - - - - - SequenceFlow_131imj8 - SequenceFlow_1n85wxv - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn deleted file mode 100644 index 24f16817c4..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn +++ /dev/null @@ -1,455 +0,0 @@ - - - - - SequenceFlow_0stqur4 - - - SequenceFlow_1oil1t3 - SequenceFlow_13nyd1j - SequenceFlow_1qm7owo - - - - SequenceFlow_098gain - SequenceFlow_1ly5jrs - - - - SequenceFlow_1ly5jrs - SequenceFlow_0djplpd - SequenceFlow_0i1gez5 - - - - SequenceFlow_0i1gez5 - SequenceFlow_1oil1t3 - SequenceFlow_1d5mzit - - - - - - - - - - - SequenceFlow_0rkycoj - - - - SequenceFlow_117fiux - - - SequenceFlow_0rkycoj - SequenceFlow_117fiux - - - - - - - SequenceFlow_1yrkxjm - SequenceFlow_1s1nnmj - SequenceFlow_0lk19rm - - - - SequenceFlow_0o21fg8 - - - - - - - - - - SequenceFlow_1d5mzit - - - - SequenceFlow_1yrkxjm - - - - SequenceFlow_0lk19rm - SequenceFlow_14fx6hv - SequenceFlow_0o21fg8 - - - - SequenceFlow_14dezx8 - SequenceFlow_13nyd1j - - - - - - SequenceFlow_0stqur4 - SequenceFlow_14dezx8 - - - - SequenceFlow_1qm7owo - SequenceFlow_098gain - SequenceFlow_19ccmqv - - - - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_11bgbsh - SequenceFlow_0djplpd - - - SequenceFlow_19ccmqv - SequenceFlow_11bgbsh - - - - - - - - SequenceFlow_1s1nnmj - SequenceFlow_11h5pba - - - - - - - - - - - - - SequenceFlow_11h5pba - SequenceFlow_0gqlayv - - - - - - - - - - - - - SequenceFlow_0etaubw - SequenceFlow_14fx6hv - - - - SequenceFlow_0gqlayv - SequenceFlow_0etaubw - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn deleted file mode 100644 index e5b18a1303..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn +++ /dev/null @@ -1,398 +0,0 @@ - - - - - SequenceFlow_0jfgn05 - - - SequenceFlow_0jfgn05 - SequenceFlow_1jqc16k - - - - SequenceFlow_1wyvxwi - - - - - - - - - - - - - SequenceFlow_0riudmc - SequenceFlow_0znbzxu - SequenceFlow_05wu9i7 - - - - - - - - - - - - - SequenceFlow_0yohjl7 - SequenceFlow_0k28xib - - - SequenceFlow_0k28xib - SequenceFlow_1w8ao21 - - - - - SequenceFlow_1dwch0k - SequenceFlow_1ju26o1 - - - - SequenceFlow_1up0j5r - SequenceFlow_1hcfvcj - SequenceFlow_05jfuko - - - - - - SequenceFlow_05jfuko - - - - - SequenceFlow_1hcfvcj - SequenceFlow_0riudmc - SequenceFlow_1dwch0k - - - - - - - - - - - - - - - - SequenceFlow_1jqc16k - SequenceFlow_1grea1r - - - - SequenceFlow_1grea1r - SequenceFlow_1up0j5r - - - - - - SequenceFlow_05wu9i7 - SequenceFlow_1wyvxwi - - - - - - SequenceFlow_0u33vy6 - - - - SequenceFlow_0hevfee - - - SequenceFlow_0u33vy6 - SequenceFlow_0hevfee - - - - - - - - - - - - - - - SequenceFlow_1w8ao21 - SequenceFlow_1swzrij - SequenceFlow_14x55db - - - SequenceFlow_14x55db - SequenceFlow_0znbzxu - - - - - - SequenceFlow_1ju26o1 - SequenceFlow_0yohjl7 - SequenceFlow_1swzrij - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVFCNetworkServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVFCNetworkServiceInstance.bpmn deleted file mode 100644 index 41b8d2e7aa..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVFCNetworkServiceInstance.bpmn +++ /dev/null @@ -1,275 +0,0 @@ - - - - - SequenceFlow_1qo2pln - - - - terminateFinished_SequenceFlow - SequenceFlow_1sjop71 - - - - SequenceFlow_1qo2pln - SequenceFlow_150q0fo - - - - SequenceFlow_1h1c24p - SequenceFlow_1ywe21t - - - - SequenceFlow_1sjop71 - deleteNSFailed_SequenceFlow - deleteNSSuccess_SequenceFlow - - - - - - SequenceFlow_1ywe21t - terminateFailed_SequenceFlow - terminateSuccess_SequenceFlow - - - - - - - - - - SequenceFlow_0xqo13p - terminateFinished_SequenceFlow - terminateProcessing_SequenceFlow - - - - - - - - - - deleteNSFailed_SequenceFlow - - - terminateFailed_SequenceFlow - - - SequenceFlow_0cq2q6g - - - terminateSuccess_SequenceFlow - SequenceFlow_1gsbpxj - SequenceFlow_0xqo13p - - - - deleteNSSuccess_SequenceFlow - SequenceFlow_0cq2q6g - - - - - terminateProcessing_SequenceFlow - SequenceFlow_1gsbpxj - - - - - - - - - - - SequenceFlow_150q0fo - SequenceFlow_1h1c24p - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModule.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModule.bpmn deleted file mode 100644 index f147639a59..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModule.bpmn +++ /dev/null @@ -1,433 +0,0 @@ - - - - - SequenceFlow_0fp1wqz - SequenceFlow_28 - - - - - - - - - - SequenceFlow_28 - SequenceFlow_31 - - - - - - - - - - - SequenceFlow_029ioyr - SequenceFlow_14xn858 - - - - - - - - - - - - - SequenceFlow_32 - SequenceFlow_33 - - - - SequenceFlow_14xn858 - SequenceFlow_4 - - - - SequenceFlow_31 - SequenceFlow_32 - - - - - - - - - - - - - SequenceFlow_4 - SequenceFlow_1xruki1 - - - SequenceFlow_35 - - - - - - - - - SequenceFlow_34 - SequenceFlow_35 - - - - SequenceFlow_2 - SequenceFlow_34 - - - - - SequenceFlow_33 - SequenceFlow_2 - - - - - SequenceFlow_1 - SequenceFlow_12 - - - - - SequenceFlow_12 - SequenceFlow_42 - - - - - SequenceFlow_1 - - - - - SequenceFlow_0coa90m - SequenceFlow_08g02ch - - - - SequenceFlow_1xruki1 - SequenceFlow_0coa90m - - - - - SequenceFlow_08g02ch - SequenceFlow_1yehsyc - SequenceFlow_0ep3hjm - - - - - - - - SequenceFlow_0ep3hjm - SequenceFlow_14l7olw - SequenceFlow_0fp1wqz - - - - - - SequenceFlow_1yehsyc - SequenceFlow_1a7lzhz - - - - - - - - - - - SequenceFlow_1a7lzhz - SequenceFlow_14l7olw - - - - SequenceFlow_42 - SequenceFlow_029ioyr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn deleted file mode 100644 index bc42e6094b..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn +++ /dev/null @@ -1,396 +0,0 @@ - - - - - - - - - - - - - - - SequenceFlow_32 - SequenceFlow_33 - - - - SequenceFlow_0kx9e3s - SequenceFlow_4 - - - - SequenceFlow_0ltm4jt - SequenceFlow_32 - - - - - - - - - - - - - SequenceFlow_4 - SequenceFlow_0hia88a - - - SequenceFlow_1eemrjp - - - SequenceFlow_33 - SequenceFlow_2 - - - - - SequenceFlow_1 - SequenceFlow_0qbjihn - - - - - SequenceFlow_0coa90m - SequenceFlow_0ltm4jt - - - - SequenceFlow_0hia88a - SequenceFlow_0coa90m - - - - - SequenceFlow_1 - - - - - - - - SequenceFlow_1igsfgk - SequenceFlow_0y4td40 - - - - - - - - - - - - - SequenceFlow_0y4td40 - SequenceFlow_12q2r4i - - - SequenceFlow_12q2r4i - SequenceFlow_0kx9e3s - - - - - - SequenceFlow_0qbjihn - SequenceFlow_1c2lvlc - - - - - SequenceFlow_1c2lvlc - SequenceFlow_1igsfgk - - - - - SequenceFlow_095634c - - - - SequenceFlow_0yvjvhu - - - SequenceFlow_095634c - SequenceFlow_0yvjvhu - - - - - - - - - - - - - SequenceFlow_092kvy3 - SequenceFlow_1eemrjp - - - SequenceFlow_2 - SequenceFlow_092kvy3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn deleted file mode 100644 index fec3f93521..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn +++ /dev/null @@ -1,208 +0,0 @@ - - - - - SequenceFlow_1gvfdp4 - - - SequenceFlow_1vy2ojp - SequenceFlow_1dlcqmc - - - - SequenceFlow_1dlcqmc - SequenceFlow_1kjccf1 - - - - SequenceFlow_1kjccf1 - SequenceFlow_1tgngf7 - - - - - - - - - - - - - SequenceFlow_1tgngf7 - SequenceFlow_1x3luyj - - - SequenceFlow_0cy0y9t - SequenceFlow_13c3cv2 - - - - SequenceFlow_1sgtwr2 - - - - - - SequenceFlow_1gvfdp4 - SequenceFlow_1vy2ojp - - - - - - SequenceFlow_1x3luyj - SequenceFlow_0cy0y9t - SequenceFlow_1rgd8dg - - - - #{VNFREST_SuccessIndicator == true} - - - SequenceFlow_1rgd8dg - - - - - SequenceFlow_13c3cv2 - SequenceFlow_1sgtwr2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVnf.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVnf.bpmn deleted file mode 100644 index 2e9d860ac9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVnf.bpmn +++ /dev/null @@ -1,308 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_2 - - - - - - - - - - - - - - SequenceFlow_2 - SequenceFlow_5 - - - - SequenceFlow_5 - vnfFound - notFound - - - - - - - vnfFound - SequenceFlow_4 - - - - - notFound - - - - SequenceFlow_4 - inUse - notInUse - - - - - - - inUse - SequenceFlow_8 - - - - - - - - - - - - - notInUse - SequenceFlow_9 - - - SequenceFlow_8 - - - - - - SequenceFlow_19 - - - SequenceFlow_18 - - - - - SequenceFlow_18 - SequenceFlow_19 - - - - - - SequenceFlow_9 - SequenceFlow_12 - SequenceFlow_10 - - - - SequenceFlow_12 - - - - - SequenceFlow_10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVnfAndModules.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVnfAndModules.bpmn deleted file mode 100644 index d066d1e2e9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVnfAndModules.bpmn +++ /dev/null @@ -1,490 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_08nd69s - - - - - SequenceFlow_19 - - - SequenceFlow_18 - - - - - SequenceFlow_18 - SequenceFlow_19 - - - - - - SequenceFlow_1uqlr6b - - - - SequenceFlow_0t4yszi - SequenceFlow_1tt31qu - SequenceFlow_1fccvli - SequenceFlow_1qrkdn3 - SequenceFlow_1936oc0 - - - - - - - - SequenceFlow_05ujwz8 - SequenceFlow_1x25m7t - SequenceFlow_1uqlr6b - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_1xujrk5 - SequenceFlow_1p4ycii - - - SequenceFlow_1936oc0 - SequenceFlow_05ujwz8 - SDNCInteractionEnabled2 - - - - - - - - SequenceFlow_08nd69s - SequenceFlow_0lu7b1v - - - - SequenceFlow_1qrkdn3 - SequenceFlow_1qoor0l - - - - - - SequenceFlow_1p4ycii - SequenceFlow_0xl033m - SequenceFlow_0t4yszi - - - - SequenceFlow_0lu7b1v - SequenceFlow_1tt31qu - SDNCInteractionEnabled1 - - - - - - - - - - SDNCInteractionEnabled1 - SequenceFlow_0fhhsyo - - - - SequenceFlow_0qdn8k4 - SequenceFlow_1fccvli - - - - - - - - - - - - - SequenceFlow_0fhhsyo - SequenceFlow_0qdn8k4 - - - - - - - - - SDNCInteractionEnabled2 - SequenceFlow_001uxa1 - - - - - - - - - - - - - SequenceFlow_001uxa1 - SequenceFlow_1x29mht - - - SequenceFlow_1x29mht - SequenceFlow_1x25m7t - - - - SequenceFlow_1qoor0l - SequenceFlow_1xujrk5 - SequenceFlow_1laeenc - - - - - - - - - - - - - - SequenceFlow_1laeenc - SequenceFlow_0xl033m - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn deleted file mode 100644 index fbb52a9cdf..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn +++ /dev/null @@ -1,187 +0,0 @@ - - - - - SequenceFlow_1fhno84 - - - SequenceFlow_1fhno84 - SequenceFlow_194bhkx - - - - SequenceFlow_1yee730 - - - SequenceFlow_194bhkx - SequenceFlow_0b5p6gy - - - - - - - ${URN_mso_openecomp_adapters_db_endpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_initResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_0b5p6gy - SequenceFlow_0nqrq1k - - - - - - - - - - - - - - - - - - - - SequenceFlow_0nqrq1k - SequenceFlow_1yee730 - - - - - - - - - SequenceFlow_0yyws1p - - - - SequenceFlow_0i814ke - - - SequenceFlow_0yyws1p - SequenceFlow_0i814ke - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn deleted file mode 100644 index 7e8b63e719..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - SequenceFlow_00w1ntj - - - SequenceFlow_00w1ntj - SequenceFlow_0izumqq - - - - SequenceFlow_0izumqq - SequenceFlow_0hzy01n - - - - - - SequenceFlow_18hdal9 - - - - SequenceFlow_0hzy01n - SequenceFlow_18hdal9 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUnderlayVpnOperation.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUnderlayVpnOperation.bpmn deleted file mode 100644 index cbcde69185..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUnderlayVpnOperation.bpmn +++ /dev/null @@ -1,293 +0,0 @@ - - - - - SequenceFlow_0trm4dk - - - SequenceFlow_1vncx6p - SequenceFlow_1amfirn - SequenceFlow_083crve - - - SequenceFlow_10j9lbs - - - SequenceFlow_083crve - SequenceFlow_0al8gdl - - - - - - - - - SequenceFlow_0h35z1p - SequenceFlow_07bp14s - - - SequenceFlow_0trm4dk - SequenceFlow_199ig0b - - - SequenceFlow_199ig0b - SequenceFlow_1rj6k5t - SequenceFlow_0h35z1p - - - - SequenceFlow_1rj6k5t - SequenceFlow_1vncx6p - - - - - - - - SequenceFlow_1amfirn - SequenceFlow_0bsmh51 - - - - SequenceFlow_0bsmh51 - SequenceFlow_10j9lbs - SequenceFlow_0al8gdl - - - - - - SequenceFlow_07bp14s - SequenceFlow_1oz5grh - SequenceFlow_19glon5 - - - SequenceFlow_1oz5grh - SequenceFlow_06e7qr6 - - - SequenceFlow_06e7qr6 - SequenceFlow_0koi1ia - SequenceFlow_1q83qn9 - - - SequenceFlow_0koi1ia - - - SequenceFlow_19glon5 - SequenceFlow_1q83qn9 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn deleted file mode 100644 index 41c9a674ed..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn +++ /dev/null @@ -1,648 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_04xlw7s - - - - SequenceFlow_115mdln - SequenceFlow_0yztz2p - - - - SequenceFlow_1wwjugw - SequenceFlow_177wo8z - - - - SequenceFlow_115mdln - - - - - - SequenceFlow_1qn0865 - SequenceFlow_1s799cp - - - - SequenceFlow_0w4t4ao - SequenceFlow_1uu6uiu - - - - SequenceFlow_1qn0865 - - - - - SequenceFlow_04xlw7s - SequenceFlow_0r6c0ci - - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_initResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_0r6c0ci - SequenceFlow_1muxopq - - - - - SequenceFlow_177wo8z - - - - - - - - - - - - - - - SequenceFlow_1kx5ke9 - SequenceFlow_0f76thv - - - SequenceFlow_0f76thv - SequenceFlow_0x0mhlj - - - - SequenceFlow_1demy08 - - - - - - SequenceFlow_0ku36oy - SequenceFlow_07aa121 - - - - SequenceFlow_0ku36oy - - - - SequenceFlow_07aa121 - - - - - SequenceFlow_1uu6uiu - - - - SequenceFlow_0x0mhlj - - - - - SequenceFlow_1muxopq - - - - - - SequenceFlow_05j3sat - - - - SequenceFlow_02znk15 - - - SequenceFlow_05j3sat - SequenceFlow_19ly8h7 - - - - SequenceFlow_19ly8h7 - SequenceFlow_02znk15 - - - - - - - - SequenceFlow_1demy08 - SequenceFlow_1cy5gq2 - - - - - - - - - - - - - - - - SequenceFlow_1cy5gq2 - SequenceFlow_1vy856f - - - SequenceFlow_1vy856f - SequenceFlow_14ggluy - - - - - - SequenceFlow_14ggluy - SequenceFlow_1kx5ke9 - - - - - - SequenceFlow_0yztz2p - SequenceFlow_0ttlte0 - SequenceFlow_01po987 - - - - - - SequenceFlow_01po987 - - - - - SequenceFlow_070o30v - - - - - - - - - - - - - - - - - SequenceFlow_0ur34hv - SequenceFlow_0w4t4ao - - - - - - - - - - - - - - - - - SequenceFlow_0ttlte0 - SequenceFlow_1wwjugw - - - - SequenceFlow_1s799cp - SequenceFlow_0ur34hv - SequenceFlow_070o30v - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstanceRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstanceRollback.bpmn deleted file mode 100644 index 2cbac2689c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstanceRollback.bpmn +++ /dev/null @@ -1,799 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_2 - - - - SequenceFlow_01l4ssl - - - - SequenceFlow_8 - - - - SequenceFlow_7 - - - - SequenceFlow_8 - SequenceFlow_7 - - - - - - - SequenceFlow_1rzlaoy - SequenceFlow_0a83f6m - SequenceFlow_01l4ssl - - - - - - SequenceFlow_1ch4xrf - - - - SequenceFlow_1ch4xrf - SequenceFlow_1pjk2ff - - - - SequenceFlow_1pjk2ff - - - - - - - SequenceFlow_2 - SequenceFlow_1rzlaoy - SequenceFlow_06aasqh - - - - - - rollback Deleted Resources - SequenceFlow_1uw2p9a - SequenceFlow_0drjj7b - SequenceFlow_055b52t - - - SequenceFlow_06aasqh - SequenceFlow_1uw2p9a - SequenceFlow_11fnnkb - - - - - - - - - - - - - - - - - - - - SequenceFlow_1fih4h0 - SequenceFlow_0pwixhh - - - - SequenceFlow_06xv7b2 - SequenceFlow_0b73i9r - - - - SequenceFlow_0pwixhh - SequenceFlow_08p4pkv - - - - SequenceFlow_1g4qm2l - SequenceFlow_1fih4h0 - - - - - - - - - - - - - - - - SequenceFlow_0b73i9r - SequenceFlow_0q9ws1s - - - SequenceFlow_0q9ws1s - SequenceFlow_1bp5oce - - - - rollback AAI - SequenceFlow_055b52t - SequenceFlow_0a83f6m - SequenceFlow_0zijz16 - - - - - - SequenceFlow_06xv7b2 - - - - SequenceFlow_1g4qm2l - - - - SequenceFlow_11fnnkb - - - - SequenceFlow_0drjj7b - - - - - - - - - - SequenceFlow_1a65s3k - - - - SequenceFlow_1ixphei - SequenceFlow_1lppnhy - - - - - - - - - - - - - - - SequenceFlow_1lppnhy - SequenceFlow_0kbisn8 - - - SequenceFlow_0kbisn8 - SequenceFlow_1azhgda - - - - - - - rollback AAI - SequenceFlow_08p4pkv - SequenceFlow_0cbnwwi - SequenceFlow_161uzhj - - - - SequenceFlow_0cbnwwi - - - - - - - SequenceFlow_161uzhj - SequenceFlow_13r4lij - - - - - SequenceFlow_13r4lij - - - - rollback AAI - SequenceFlow_1bp5oce - SequenceFlow_0bkvqao - SequenceFlow_1isdxh1 - - - SequenceFlow_0bkvqao - - - - SequenceFlow_1isdxh1 - SequenceFlow_0a9xori - - - - SequenceFlow_0a9xori - - - - - - - - SequenceFlow_0zijz16 - - - - - - - - SequenceFlow_1azhgda - SequenceFlow_1n6foyw - - - - SequenceFlow_1n6foyw - - - - - - SequenceFlow_1a65s3k - SequenceFlow_0870pzc - - - - - - - - - - - - - - - SequenceFlow_0870pzc - SequenceFlow_1f31l5s - - - - SequenceFlow_1f31l5s - SequenceFlow_1ixphei - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateNetworkInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateNetworkInstance.bpmn deleted file mode 100644 index 53c419e6a6..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateNetworkInstance.bpmn +++ /dev/null @@ -1,828 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_32 - SequenceFlow_11 - - - - - SequenceFlow_12 - SequenceFlow_5 - - - - SequenceFlow_5 - sdncTopoNo_SequenceFlow - sdncTopoYes_SequenceFlow - - - - - - - - SequenceFlow_34 - - - - - sdncTopoNo_SequenceFlow - SequenceFlow_34 - - - - - - - - - - - - - - SequenceFlow_11 - SequenceFlow_12 - - - - SequenceFlow_46 - SequenceFlow_29 - - - - - - SequenceFlow_053re4q - isRollbackOn_YesNetwork_SequenceFlow - isRollbackOn_NoNetwork_SequenceFlow - - - - - - - SequenceFlow_23 - - - - - isRollbackOn_YesNetwork_SequenceFlow - isPONR_Yes_SequenceFlow - isPONR_No_SequenceFlow - - - - - - - SequenceFlow_0nrc66n - sdncOk_Yeso_ExclusiveGateway - sdncOk_No_ExclusiveGateway - - - - - - - sdncOk_Yeso_ExclusiveGateway - SequenceFlow_53 - - - - - SequenceFlow_04rdjfi - - - SequenceFlow_53 - sdncOk_No_ExclusiveGateway - SequenceFlow_0srdlf3 - SequenceFlow_47 - - - - SequenceFlow_47 - SequenceFlow_0qr4es6 - - - - - - - - - - - - - - - - - - - SequenceFlow_0qr4es6 - - - SequenceFlow_0ze5k6c - SequenceFlow_04rdjfi - - - - - - SequenceFlow_0nrc66n - SequenceFlow_0srdlf3 - - - - - - - SequenceFlow_23 - SequenceFlow_053re4q - - - - - isPONR_Yes_SequenceFlow - isRollbackOn_NoNetwork_SequenceFlow - isPONR_No_SequenceFlow - SequenceFlow_0ze5k6c - - - Note: Rollback is not needed for UpdateNetwork, - - - - - SequenceFlow_13 - SequenceFlow_35 - - - - - SequenceFlow_35 - SequenceFlow_46 - - - - - SequenceFlow_29 - - - - SequenceFlow_10 - SequenceFlow_14 - - - - - SequenceFlow_10 - - - - - SequenceFlow_14 - - - - SequenceFlow_1 - SequenceFlow_7 - - - - - SequenceFlow_24 - SequenceFlow_32 - - - - - siFoundYes - SequenceFlow_24 - - - - - siFoundNo - - - - SequenceFlow_3 - siFoundYes - siFoundNo - - - - - - - - - - - - - - - - SequenceFlow_7 - SequenceFlow_3 - - - - SequenceFlow_59 - SequenceFlow_13 - - - - - - - - ${UPDNETI_updateNetworkRequest} - ${URN_mso_adapters_network_rest_endpoint}/${UPDNETI_networkId} - - - #{BasicAuthHeaderValuePO} - application/xml - - - PUT - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_61 - SequenceFlow_59 - - - - SequenceFlow_2 - SequenceFlow_61 - - - - - SequenceFlow_38 - SequenceFlow_2 - - - - - sdncTopoYes_SequenceFlow - SequenceFlow_6 - - - - - SequenceFlow_6 - SequenceFlow_15 - - - - - SequenceFlow_15 - SequenceFlow_38 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateNetworkInstanceRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateNetworkInstanceRollback.bpmn deleted file mode 100644 index a8ea29b15c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateNetworkInstanceRollback.bpmn +++ /dev/null @@ -1,373 +0,0 @@ - - - - - SequenceFlow_1krl2dg - - - SequenceFlow_1krl2dg - SequenceFlow_0u41iz2 - - - - - - - - - ${UPDNETIR_rollbackNetworkRequest} - ${URN_mso_adapters_network_rest_endpoint} - - - #{BasicAuthHeaderValuePO} - application/xml - - - PUT - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_0e1uixp - SequenceFlow_17o4w67 - - - SequenceFlow_0u41iz2 - SequenceFlow_0e1uixp - SequenceFlow_1lteduj - - - - - - - - - - - - SequenceFlow_101y57s - SequenceFlow_0790olb - - - SequenceFlow_0virkpu - SequenceFlow_101y57s - SequenceFlow_0mw0dgd - - - SequenceFlow_0qc4v9t - SequenceFlow_0el8yzs - SequenceFlow_0yto4gz - - - - SequenceFlow_1lteduj - SequenceFlow_17o4w67 - SequenceFlow_0virkpu - SequenceFlow_0qc4v9t - - - - - - - - - - - - - - - SequenceFlow_0yto4gz - - - - - - SequenceFlow_0xktw7v - SequenceFlow_0soe5t3 - - - - SequenceFlow_0xktw7v - - - - SequenceFlow_0soe5t3 - - - - - - SequenceFlow_0790olb - SequenceFlow_0mw0dgd - SequenceFlow_0el8yzs - - - - - - SequenceFlow_07kf49j - SequenceFlow_01syg1x - - - - SequenceFlow_07kf49j - - - - SequenceFlow_01syg1x - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateVfModule.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateVfModule.bpmn deleted file mode 100644 index ce96a3593a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateVfModule.bpmn +++ /dev/null @@ -1,671 +0,0 @@ - - - - - - SequenceFlow_38 - SequenceFlow_2 - - - - - - - - - - - - - - SequenceFlow_2 - SequenceFlow_15 - - - SequenceFlow_1 - SequenceFlow_38 - - - - - - SequenceFlow_6 - SequenceFlow_35 - - - - SequenceFlow_35 - - - - - SequenceFlow_6 - - - - - - SequenceFlow_36 - - - - SequenceFlow_36 - - - - - SequenceFlow_9 - SequenceFlow_18 - SequenceFlow_25 - - - - - - - - - - - - SequenceFlow_25 - SequenceFlow_26 - - - - SequenceFlow_26 - SequenceFlow_27 - - - - - - - - - - - - - - SequenceFlow_27 - SequenceFlow_7 - - - SequenceFlow_24 - SequenceFlow_13 - - - - - - - - - - - - SequenceFlow_14 - SequenceFlow_9 - - - - SequenceFlow_13 - SequenceFlow_14 - SequenceFlow_18 - - - - - - - SequenceFlow_1 - - - - SequenceFlow_16 - SequenceFlow_17 - SequenceFlow_12 - - - - - - - - - - - - - - SequenceFlow_12 - SequenceFlow_3 - - - - - - - - - - - SequenceFlow_21 - SequenceFlow_24 - - - - SequenceFlow_23 - SequenceFlow_21 - - - - - SequenceFlow_22 - SequenceFlow_23 - - - - - - - - - - - - - SequenceFlow_19 - SequenceFlow_22 - - - SequenceFlow_3 - SequenceFlow_5 - - - - - - SequenceFlow_5 - SequenceFlow_19 - - - - - - - SequenceFlow_15 - SequenceFlow_28 - SequenceFlow_30 - - - - - - - - - - - - - - SequenceFlow_11 - SequenceFlow_17 - - - - SequenceFlow_10 - SequenceFlow_11 - - - - - SequenceFlow_29 - SequenceFlow_10 - SequenceFlow_16 - - - - - - - - - - SequenceFlow_30 - SequenceFlow_34 - - - - - - SequenceFlow_28 - SequenceFlow_34 - SequenceFlow_29 - - - - - SequenceFlow_7 - SequenceFlow_20 - - - - SequenceFlow_20 - SequenceFlow_4 - - - - - SequenceFlow_4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateVnfAndModules.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateVnfAndModules.bpmn deleted file mode 100644 index 609d630429..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateVnfAndModules.bpmn +++ /dev/null @@ -1,275 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_08nd69s - - - - - SequenceFlow_19 - - - SequenceFlow_18 - - - - - SequenceFlow_18 - SequenceFlow_19 - - - - - - SequenceFlow_0of4kmm - - - - SequenceFlow_0t4yszi - SequenceFlow_1f4mbkc - SequenceFlow_1qrkdn3 - SequenceFlow_19c7hcw - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_04o61yk - SequenceFlow_1p4ycii - - - - - SequenceFlow_08nd69s - SequenceFlow_1f4mbkc - - - - SequenceFlow_1qrkdn3 - SequenceFlow_04o61yk - - - - SequenceFlow_1p4ycii - SequenceFlow_0t4yszi - - - - - - - - - - - - - - - SequenceFlow_1ltycz6 - SequenceFlow_0of4kmm - - - SequenceFlow_19c7hcw - SequenceFlow_1ltycz6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/RollbackVnf.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/RollbackVnf.bpmn deleted file mode 100644 index 4d1ccf9c8d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/RollbackVnf.bpmn +++ /dev/null @@ -1,346 +0,0 @@ - - - - - SequenceFlow_0bie3cu - - - SequenceFlow_0mpoa26 - SequenceFlow_1pirwg0 - SequenceFlow_1lne8je - SequenceFlow_0tj5bkd - - - SequenceFlow_0tj5bkd - SequenceFlow_1ney8l6 - SequenceFlow_0gsro0z - SequenceFlow_0b2y2dw - - - SequenceFlow_0b2y2dw - SequenceFlow_11556y3 - SequenceFlow_0skjb2u - SequenceFlow_0c5ovtd - - - SequenceFlow_0g18wrd - SequenceFlow_0c5ovtd - SequenceFlow_12bz15k - SequenceFlow_03qkk4e - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0bie3cu - SequenceFlow_1ix4dpf - - - - - - - - - - - - - SequenceFlow_1lne8je - SequenceFlow_1ney8l6 - - - - - - - - - - - SequenceFlow_0gsro0z - SequenceFlow_11556y3 - - - SequenceFlow_0skjb2u - SequenceFlow_0g18wrd - - - - SequenceFlow_12bz15k - SequenceFlow_0tkvd6f - - - - SequenceFlow_1p3pyal - - - - - SequenceFlow_03qkk4e - SequenceFlow_0tkvd6f - SequenceFlow_1p3pyal - - - - - SequenceFlow_1ix4dpf - SequenceFlow_0mpoa26 - SequenceFlow_05ihl7f - - - - - - - - - - - - - - - - - - SequenceFlow_05ihl7f - SequenceFlow_1pirwg0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/SetRefactorServiceDecomp.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/SetRefactorServiceDecomp.bpmn deleted file mode 100644 index c4f107b0b5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/SetRefactorServiceDecomp.bpmn +++ /dev/null @@ -1,68 +0,0 @@ - - - - - SequenceFlow_1aizx5q - - - - SequenceFlow_1fypndb - - - - SequenceFlow_1aizx5q - SequenceFlow_1ipdcwj - - - - - - SequenceFlow_1ipdcwj - SequenceFlow_1fypndb - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/urn.properties b/bpmn/MSOInfrastructureBPMN/src/main/resources/urn.properties deleted file mode 100644 index ccbeaa6e38..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/urn.properties +++ /dev/null @@ -1,29 +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========================================================= -### - -# URN mappings for this project. - -# TODO: Remove all the non-URN stuff that's in here. -# TODO: Implement a real URN mapping capability. - -#AAIEndPoint= http://localhost:8080/SoapUIMocks -AAIEndPoint= http://localhost:28090/ -SDNCEndPoint=http://localhost:28090/SDNCAdapter/ -msoRollback = true diff --git a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml deleted file mode 100644 index 1753ba1919..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml deleted file mode 100644 index fa35eadba8..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/jboss-web.xml b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/jboss-web.xml deleted file mode 100644 index a39a02178a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/jboss-web.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - other - /mso - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/web.xml b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index fb5fc66309..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - MSO Infrastructure BPMN Workflow Servlet - - resteasy-servlet - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - javax.ws.rs.Application - org.openecomp.mso.bpmn.infrastructure.workflow.service.WorkflowResourceApplication - - - - resteasy-servlet - /* - - - contextConfigLocation - /WEB-INF/applicationContext.xml - - - mso.configuration - MSO_PROP_TOPOLOGY=topology.properties,MSO_PROP_APIHANDLER_INFRA=mso.apihandler-infra.properties - - - log.configuration - logback.bpmn.xml - - - resteasy.resources - org.openecomp.mso.logger.MsoLoggingServlet,org.openecomp.mso.bpmn.core.HealthCheckHandler - - - org.springframework.web.context.ContextLoaderListener - - - org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap - - - - resteasy.jndi.resources - java:module/MsoPropertiesFactory - - - LogFilter - org.openecomp.mso.logger.LogFilter - - - LogFilter - /* - - - - HTTPBasicAuth - Authentication for Client Apps - /workflow/* - GET - POST - - - BPMN-Client - - - - BASIC - ApplicationRealm - - - BPMN-Client - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericAlaCarteServiceInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericAlaCarteServiceInstanceTest.groovy deleted file mode 100644 index adab1bf739..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericAlaCarteServiceInstanceTest.groovy +++ /dev/null @@ -1,215 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.junit.Before -import org.junit.Rule -import org.junit.Test -import org.mockito.MockitoAnnotations -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.VidUtils - -import static org.junit.Assert.*; -import static org.mockito.Mockito.* - -import com.github.tomakehurst.wiremock.junit.WireMockRule - -class CreateGenericAlaCarteServiceInstanceTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(8090); - - String Prefix="CRESI_" - def utils = new MsoUtils() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils() - - String createDBRequestError = -""" - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - BPMN - Received error from SDN-C: No availability zone available - - FAILED - <network-id></network-id><network-name></network-names> - - - """ - - String falloutHandlerRequest = - """ - - b69c9054-da09-4a2c-adf5-51042b62bfac - CREATE - VID - - - Received error from SDN-C: No availability zone available. - 5300 - - """ - - String completeMsoProcessRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - CREATE - VID - - Network has been created successfully. - BPMN Network action: CREATE -""" - - String jsonIncomingRequest = - """{ - "requestDetails": { - "modelInfo": { - "modelType": "service", - "modelInvariantId": "1de901ed-17af-4b03-bc1f-41659cfa27cb", - "modelVersionId": "ace39141-09ec-4068-b06d-ac6b23bdc6e0", - "modelName": "demoVLB", - "modelVersion": "1.0" - }, - "cloudConfiguration" : { - "lcpCloudRegionId": "RegionOne", - "tenantId": "onap" - }, - "subscriberInfo": { - "globalSubscriberId": "Demonstration", - "subscriberName": "Demonstration" - }, - "requestInfo": { - "instanceName": "sample-instance-2", - "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", - "source": "VID", - "requestorId":"1234", - "suppressRollback": "false" - }, - "requestParameters": { - "subscriptionServiceType": "vLB" - } - } - }""" - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - - } - - public void initializeVariables(DelegateExecution mockExecution) { - - //verify(mockExecution).setVariable(Prefix + "Success", false) - - //verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", "") - //verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", "") - //verify(mockExecution).setVariable(Prefix + "isSilentSuccess", false) - - } - - @Test - //@Ignore - public void preProcessRequest() { - - println "************ preProcessRequest() ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) - try{ - - // preProcessRequest(DelegateExecution execution) - CreateGenericALaCarteServiceInstance createGenericALaCarteServiceInstance = new CreateGenericALaCarteServiceInstance() - createGenericALaCarteServiceInstance.preProcessRequest(mockExecution) - - //verify(mockExecution).getVariable("isDebugLogEnabled") - //verify(mockExecution).setVariable("prefix", Prefix) - - initializeVariables(mockExecution) - //verify(mockExecution).setVariable(Prefix + "Success", false) - }catch(Exception e){ - //ignore - } - } - - @Test - //@Ignore - public void sendSyncResponse() { - - println "************ sendSyncResponse ************* " - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) - when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - try{ - // preProcessRequest(DelegateExecution execution) - CreateGenericALaCarteServiceInstance createGenericALaCarteServiceInstance = new CreateGenericALaCarteServiceInstance() - createGenericALaCarteServiceInstance.sendSyncResponse(mockExecution) - - //verify(mockExecution).setVariable("prefix", Prefix) - //verify(mockExecution).setVariable("createServiceRestRequest", "202") - }catch(Exception e){ - //ignore - } - } - - @Test - //@Ignore - public void sendSyncError() { - - println "************ sendSyncError ************* " - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) - when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - try{ - CreateGenericALaCarteServiceInstance createGenericALaCarteServiceInstance = new CreateGenericALaCarteServiceInstance() - createGenericALaCarteServiceInstance.sendSyncError(mockExecution) - - //verify(mockExecution).setVariable("prefix", Prefix) - //verify(mockExecution).setVariable("createServiceRestRequest", "500") - }catch(Exception e){ - //ignore - } - } - - private ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("CreateGenericALaCarteSeviceInstance") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("CreateGenericALaCarteSeviceInstance") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("CreateGenericALaCarteSeviceInstance") - when(mockExecution.getProcessInstanceId()).thenReturn("CreateGenericALaCarteSeviceInstance") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - - return mockExecution - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy deleted file mode 100644 index 7c5aec3641..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy +++ /dev/null @@ -1,360 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.junit.Before -import org.junit.Rule -import org.junit.Test -import org.mockito.MockitoAnnotations -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.core.WorkflowException - -import static org.junit.Assert.*; -import static org.mockito.Mockito.* - -import com.github.tomakehurst.wiremock.junit.WireMockRule - -class CreateNetworkInstanceTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(8090); - - String Prefix="CRENI_" - def utils = new MsoUtils() - - String createDBRequestError = -""" - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - BPMN - Received error from SDN-C: No availability zone available - - FAILED - <network-id></network-id><network-name></network-names> - - - """ - - String falloutHandlerRequest = - """ - - b69c9054-da09-4a2c-adf5-51042b62bfac - CREATE - VID - - - Received error from SDN-C: No availability zone available. - 5300 - - """ - - String completeMsoProcessRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - CREATE - VID - - Network has been created successfully. - BPMN Network action: CREATE -""" - - -String jsonIncomingRequest = -"""{ "requestDetails": { - "modelInfo": { - "modelType": "networkTyp", - "modelId": "modelId", - "modelNameVersionId": "modelNameVersionId", - "modelName": "CONTRAIL_EXTERNAL", - "modelVersion": "1" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "RDM2WAGPLCP", - "tenantId": "7dd5365547234ee8937416c65507d266" - }, - "requestInfo": { - "instanceName": "MNS-25180-L-01-dmz_direct_net_1", - "source": "VID", - "callbackUrl": "", - "suppressRollback": true, - "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", - "modelInfo": { - "modelType": "serviceT", - "modelId": "modelI", - "modelNameVersionId": "modelNameVersionI", - "modelName": "modleNam", - "modelVersion": "1" - } - } - } - ], - "requestParameters": { - "userParams": [ - { - "name": "someUserParam1", - "value": "someValue1" - } - ] - } - }}""" - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - - } - - public void initializeVariables(DelegateExecution mockExecution) { - - verify(mockExecution).setVariable(Prefix + "Success", false) - - verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", "") - verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", "") - verify(mockExecution).setVariable(Prefix + "isSilentSuccess", false) - - } - - @Test - //@Ignore - public void preProcessRequest() { - - println "************ preProcessRequest() ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) - - - // preProcessRequest(DelegateExecution execution) - CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() - CreateNetworkInstance.preProcessRequest(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - initializeVariables(mockExecution) - //verify(mockExecution).setVariable(Prefix + "Success", false) - - } - - - @Test - //@Ignore - public void getNetworkModelInfo() { - - println "************ getNetworkModelInfo() ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - - // preProcessRequest(DelegateExecution execution) - CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() - CreateNetworkInstance.getNetworkModelInfo(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - } - - @Test - //@Ignore - public void sendSyncResponse() { - - println "************ sendSyncResponse ************* " - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) - when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - // preProcessRequest(DelegateExecution execution) - CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() - CreateNetworkInstance.sendSyncResponse(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable("CreateNetworkInstanceResponseCode", "202") - - } - - @Test - //@Ignore - public void sendSyncError() { - - println "************ sendSyncError ************* " - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) - when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() - CreateNetworkInstance.sendSyncError(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable("CreateNetworkInstanceResponseCode", "500") - - } - - @Test - //@Ignore - public void prepareDBRequestError() { - - println "************ prepareDBRequestError ************* " - - WorkflowException sndcWorkflowException = new WorkflowException("CreateNetworkInstance", 500, "Received error from SDN-C: No availability zone available") - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowException) - //when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("networkId")).thenReturn("") - when(mockExecution.getVariable("networkName")).thenReturn("") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - - // preProcessRequest(DelegateExecution execution) - CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() - CreateNetworkInstance.prepareDBRequestError(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "createDBRequest", createDBRequestError) - - } - - - @Test - //@Ignore - public void prepareCompletion() { - - println "************ postProcessResponse ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable(Prefix + "dbReturnCode")).thenReturn("200") - - // postProcessResponse(DelegateExecution execution) - CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() - CreateNetworkInstance.prepareCompletion(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "Success", true) - verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", completeMsoProcessRequest) - - } - - @Test - //@Ignore - public void buildErrorResponse() { - - println "************ buildErrorResponse ************* " - - - WorkflowException sndcWorkflowException = new WorkflowException("CreateNetworkInstance", 5300, "Received error from SDN-C: No availability zone available.") - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso-request-id")).thenReturn("b69c9054-da09-4a2c-adf5-51042b62bfac") - //when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowException) - when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowException) - - // buildErrorResponse(DelegateExecution execution) - CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() - CreateNetworkInstance.buildErrorResponse(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", "CRENI_") - verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - - //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - } - - @Test - //@Ignore - public void postProcessResponse() { - - println "************ postProcessResponse() ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("CMSO_ResponseCode")).thenReturn("200") - - // postProcessResponse(DelegateExecution execution) - CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() - CreateNetworkInstance.postProcessResponse(mockExecution) - - //verify(mockExecution).getVariable("isDebugLogEnabled") - //verify(mockExecution).setVariable("prefix", Prefix) - - verify(mockExecution).setVariable(Prefix + "Success", true) - - } - - @Test - //@Ignore - public void processRollbackData() { - - println "************ callDBCatalog() ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - - // preProcessRequest(DelegateExecution execution) - CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() - CreateNetworkInstance.processRollbackData(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - } - - private ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("CreateNetworkInstance") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("CreateNetworkInstance") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("CreateNetworkInstance") - when(mockExecution.getProcessInstanceId()).thenReturn("CreateNetworkInstance") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - - return mockExecution - } - -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy deleted file mode 100644 index df0613185f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy +++ /dev/null @@ -1,212 +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.bpmn.infrastructure.scripts; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.* - -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.mockito.ArgumentCaptor -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.openecomp.mso.bpmn.common.scripts.MsoGroovyTest -import org.junit.Before -import org.junit.Ignore; -import org.junit.Test -import org.junit.runner.RunWith - - -@RunWith(MockitoJUnitRunner.class) -import org.apache.commons.lang3.* - - -class CreateVfModuleVolumeInfraV1Test extends MsoGroovyTest { - - def jsonRequest = """ -{ - "requestDetails": { - "modelInfo": { - "modelType": "volumeGroup", - "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12::base::module-0", - "modelVersion": "1" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "mdt1", - "tenantId": "88a6ca3ee0394ade9403f075db23167e" - }, - "requestInfo": { - "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", - "source": "VID", - "suppressRollback": false - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "{service-instance-id}", - "modelInfo": { - "modelType": "service", - "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "Test", - "modelVersion": "2.0" - } - } - }, { - "relatedInstance": { - "instanceId": "{vnf-instance-id}", - "modelInfo": { - "modelType": "vnf", - "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", - "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12", - "modelVersion": "1", - "modelInstanceName": "vSAMP12" - } - } - } - ], - "requestParameters": { - "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", - "userParams": [ - {"name": "vnfName", "value": "STMTN5MMSC20" }, - {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, - {"name": "vnfNmInformation", "value": "" }, - {"name": "vnfType", "value": "pcrf-capacity" }, - {"name": "vnfId", "value": "skask" }, - {"name": "vnfStackId", "value": "slowburn" }, - {"name": "vnfStatus", "value": "created" }, - {"name": "aicCloudRegion", "value": "MDTWNJ21" }, - {"name": "availabilityZone", "value": "slcp3-esx-az01" }, - {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, - {"name": "vmName", "value": "slcp34246vbc246ceb" }, - {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, - {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" } - ] - } - } -} -""" - - def volumeRequestXml = """ - - CREATE_VF_MODULE_VOL - VID - - - - - MSOTESTVOL101a-vSAMP12_base_vol_module-0 - Test/vSAMP12 - vSAMP12::base::module-0 - 2.0 - mdt1 - 88a6ca3ee0394ade9403f075db23167e - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - true - - - - STMTN5MMSC20 - US1117MTSNJVBR0246 - - pcrf-capacity - skask - slowburn - created - MDTWNJ21 - slcp3-esx-az01 - VLAN-OAM-1323 - slcp34246vbc246ceb - 970cd2b9-7f09-4a12-af47-182ea38ba1f0 - 545cc2c3-1930-4100-b534-5d82d0e12bb6 - -""" - - def completeMsoRequestXml = """ - - 1234 - CREATE - VID - - Volume Group has been created successfully. - BPMN VF Module Volume action: CREATE -""" - - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - - @Test - @Ignore - public void testPreProcessRequest() { - - ExecutionEntity mockExecution = setupMock('CreateVfModuleVolumeInfraV1') - - when(mockExecution.getVariable("prefix")).thenReturn('CVMVINFRAV1_') - when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonRequest) - when(mockExecution.getVariable("serviceInstanceId")).thenReturn('') - when(mockExecution.getVariable("vnfId")).thenReturn('test-vnf-id') - when(mockExecution.getVariable("mso-request-id")).thenReturn('1234') - when(mockExecution.getVariable("URN_mso_rollback")).thenReturn('true') - - CreateVfModuleVolumeInfraV1 createVfModuleVolumeInfraV1 = new CreateVfModuleVolumeInfraV1() - createVfModuleVolumeInfraV1.preProcessRequest(mockExecution, 'true') - - // Capture the arguments to setVariable - ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); - ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); - - verify(mockExecution, times(15)).setVariable(captor1.capture(), captor2.capture()) - - List arg2List = captor2.getAllValues() - String volumeRequestActual = arg2List.get(6) - String isVidRequestActual = arg2List.get(8) - - assertEquals(volumeRequestXml, volumeRequestActual.trim()) - assertEquals('true', isVidRequestActual) - } - - @Test - public void testPostProcessResponse() { - - ExecutionEntity mockExecution = setupMock('CreateVfModuleVolumeInfraV1') - when(mockExecution.getVariable("dbReturnCode")).thenReturn('000') - when(mockExecution.getVariable("CVMVINFRAV1_createDBResponse")).thenReturn('') - when(mockExecution.getVariable("mso-request-id")).thenReturn('1234') - when(mockExecution.getVariable("CVMVINFRAV1_source")).thenReturn('VID') - - CreateVfModuleVolumeInfraV1 createVfModuleVolumeInfraV1 = new CreateVfModuleVolumeInfraV1() - createVfModuleVolumeInfraV1.postProcessResponse(mockExecution, 'true') - - verify(mockExecution).setVariable('CVMVINFRAV1_Success', true) - verify(mockExecution).setVariable('CVMVINFRAV1_CompleteMsoProcessRequest', completeMsoRequestXml) - } - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstanceTest.groovy deleted file mode 100644 index e2175216c0..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstanceTest.groovy +++ /dev/null @@ -1,161 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Before -import org.junit.BeforeClass -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import org.mockito.MockitoAnnotations -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.infrastructure.scripts.DeleteCustomE2EServiceInstance -import org.openecomp.mso.bpmn.mock.FileUtil -import org.openecomp.mso.bpmn.vcpe.scripts.GroovyTestBase - -import static org.junit.Assert.assertTrue -import static org.junit.Assert.assertTrue -import static org.junit.Assert.assertTrue -import static org.mockito.Mockito.mock -import static org.mockito.Mockito.mock -import static org.mockito.Mockito.mock -import static org.mockito.Mockito.mock -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when - -class DeleteCustomE2EServiceInstanceTest extends GroovyTestBase { - - private static String request - - @Rule - public WireMockRule wireMockRule = new WireMockRule(GroovyTestBase.PORT) - - String Prefix = "CVRCS_" - String RbType = "DCRENI_" - - @BeforeClass - public static void setUpBeforeClass() { - request = FileUtil.readResourceFile("__files/InfrastructureFlows/DeleteCustomE2EService.json") - } - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - public DeleteCustomE2EServiceInstanceTest(){ - super("DeleteCustomE2EServiceInstance") - } - @Test - @Ignore // 1802 merge - public void preProcessRequestTest () { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() - mex.setVariable("isDebugLogEnabled","true") - instance.preProcessRequest(mex); - - verify(mex).getVariable(GroovyTestBase.DBGFLAG) - - verify(mex).setVariable("globalSubscriberId", "38829939920000") - verify(mex).setVariable("operationId", "59960003992") - verify(mex).setVariable("URN_mso_adapters_openecomp_db_endpoint", "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - } - - @Test - public void sendSyncResponseTest() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() - instance.sendSyncResponse(mex) - verify(mex).setVariable("DeleteCustomE2EServiceInstanceWorkflowResponseSent", "true") - } - - @Test - public void prepareCompletionRequestTest(){ - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() - instance.prepareCompletionRequest(mex) - String msoComplitionRequest = FileUtil.readResourceFile("__files/GenericFlows/MsoCompletionRequest.xml") - //verify(mex).setVariable("completionRequest", msoComplitionRequest) - } - - @Test - public void sendSyncErrorTest(){ - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() - instance.sendSyncError(mex) - - } - - @Test - public void prepareFalloutRequest(){ - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() - instance.prepareFalloutRequest(mex) - String requestInfo = - """ - null - DELETE - null - """ - //verify(mex).setVariable("falloutRequest", requestInfo) - } - - @Test - public void processJavaExceptionTest(){ - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() - instance.processJavaException() - } - - - private void initPreProcess(ExecutionEntity mex) { - when(mex.getVariable(GroovyTestBase.DBGFLAG)).thenReturn("true") - when(mex.getVariable("bpmnRequest")).thenReturn(request) - when(mex.getVariable("mso-request-id")).thenReturn("mri") - when(mex.getVariable("serviceType")).thenReturn("VoLTE") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("requestAction")).thenReturn("ra") - when(mex.getVariable("operationId")).thenReturn("59960003992") - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericAlaCarteServiceInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericAlaCarteServiceInstanceTest.groovy deleted file mode 100644 index 3b0e43957c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericAlaCarteServiceInstanceTest.groovy +++ /dev/null @@ -1,105 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.junit.Before -import org.junit.Rule -import org.junit.Test -import org.mockito.MockitoAnnotations -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.VidUtils - -import static org.junit.Assert.*; -import static org.mockito.Mockito.* - -import com.github.tomakehurst.wiremock.junit.WireMockRule - -class DeleteGenericAlaCarteServiceInstanceTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(8090); - - String Prefix="DELSI_" - def utils = new MsoUtils() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils() - - String jsonIncomingRequest = - """{ - "requestDetails": { - "modelInfo": { - "modelType": "service", - "modelInvariantId": "1de901ed-17af-4b03-bc1f-41659cfa27cb", - "modelVersionId": "ace39141-09ec-4068-b06d-ac6b23bdc6e0", - "modelName": "demoVLB", - "modelVersion": "1.0" - }, - "cloudConfiguration" : { - "lcpCloudRegionId": "RegionOne", - "tenantId": "onap" - }, - "subscriberInfo": { - "globalSubscriberId": "Demonstration", - "subscriberName": "Demonstration" - }, - "requestInfo": { - "instanceName": "sample-instance-2", - "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", - "source": "VID", - "requestorId":"1234", - "suppressRollback": "false" - }, - "requestParameters": { - "subscriptionServiceType": "vLB" - } - } - }""" - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - - } - - public void initializeVariables(DelegateExecution mockExecution) { - - verify(mockExecution).setVariable(Prefix + "Success", false) - - verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", "") - verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", "") - verify(mockExecution).setVariable(Prefix + "isSilentSuccess", false) - - } - - @Test - //@Ignore - public void preProcessRequest() { - - println "************ preProcessRequest() ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) - - try { - // preProcessRequest(DelegateExecution execution) - DeleteGenericALaCarteServiceInstance deleteGenericALaCarteServiceInstance = new DeleteGenericALaCarteServiceInstance() - deleteGenericALaCarteServiceInstance.preProcessRequest(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - initializeVariables(mockExecution) - //verify(mockExecution).setVariable(Prefix + "Success", false) - }catch(Exception e){ - //ignore - } - - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstanceTest.groovy deleted file mode 100644 index 46a737f3e1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstanceTest.groovy +++ /dev/null @@ -1,397 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import static org.mockito.Mockito.* - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.junit.Before -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.core.WorkflowException - -import com.github.tomakehurst.wiremock.junit.WireMockRule - - -@RunWith(MockitoJUnitRunner.class) -class DeleteNetworkInstanceTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(8090); - - String Prefix="DELNI_" - def utils = new MsoUtils() - - String falloutHandlerRequest = - """ - - b69c9054-da09-4a2c-adf5-51042b62bfac - DELETE - PORTAL - - - Received error from SDN-C: No availability zone available - 5300 - 200 - - """ - - String falloutHandlerRequestObj = - """ - - b69c9054-da09-4a2c-adf5-51042b62bfac - DELETE - PORTAL - - - Received error from SDN-C: No availability zone available - 7000 - - """ - - String completeMsoProcessRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - DELETE - VID - - Network has been deleted successfully. - BPMN Network action: DELETE -""" - -String deleteDBRequest = -""" - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - BPMN - Network successfully deleted. - - COMPLETED - 100 - <network-outputs xmlns="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:aetgt="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"/> - - -""" - -String deleteDBRequestErrorObj = -""" - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - BPMN - Received error from SDN-C: No availability zone available - - FAILED - - <network-outputs xmlns="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:aetgt="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"/> - - - """ - -String deleteDBRequestErrorString = -""" - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - BPMN - Received error from SDN-C: No availability zone available - - FAILED - - <network-outputs xmlns="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:aetgt="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"/> - - - """ - - String jsonIncomingRequest = - """{ "requestDetails": { - "modelInfo": { - "modelType": "networkTyp", - "modelId": "modelId", - "modelNameVersionId": "modelNameVersionId", - "modelName": "CONTRAIL_EXTERNAL", - "modelVersion": "1" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "RDM2WAGPLCP", - "tenantId": "7dd5365547234ee8937416c65507d266" - }, - "requestInfo": { - "instanceName": "MNS-25180-L-01-dmz_direct_net_1", - "source": "VID", - "callbackUrl": "", - "suppressRollback": true, - "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", - "modelInfo": { - "modelType": "serviceT", - "modelId": "modelI", - "modelNameVersionId": "modelNameVersionI", - "modelName": "modleNam", - "modelVersion": "1" - } - } - } - ], - "requestParameters": { - "userParams": [ - { - "name": "someUserParam1", - "value": "someValue1" - } - ] - } - }}""" - -// - - - - - - - - - - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - @Test - //@Ignore - public void preProcessRequest() { - - println "************ preProcessRequest_Payload ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) - - DeleteNetworkInstance DeleteNetworkInstance = new DeleteNetworkInstance() - DeleteNetworkInstance.preProcessRequest(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - //verify variable initialization - initializeVariables(mockExecution) - - - } - - public void initializeVariables (DelegateExecution mockExecution) { - - - verify(mockExecution).setVariable(Prefix + "Success", false) - - verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", "") - verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", "") - verify(mockExecution).setVariable(Prefix + "isSilentSuccess", false) - - } - - - @Test - //@Ignore - public void getNetworkModelInfo() { - - println "************ getNetworkModelInfo() ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - - // preProcessRequest(DelegateExecution execution) - DeleteNetworkInstance DeleteNetworkInstance = new DeleteNetworkInstance() - DeleteNetworkInstance.getNetworkModelInfo(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - } - - @Test - //@Ignore - public void sendSyncResponse() { - - println "************ sendSyncResponse ************* " - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) - when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - // preProcessRequest(DelegateExecution execution) - DeleteNetworkInstance DeleteNetworkInstance = new DeleteNetworkInstance() - DeleteNetworkInstance.sendSyncResponse(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable("DeleteNetworkInstanceResponseCode", "202") - - } - - - @Test - //@Ignore - public void sendSyncError() { - - println "************ sendSyncError ************* " - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) - when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - DeleteNetworkInstance DeleteNetworkInstance = new DeleteNetworkInstance() - DeleteNetworkInstance.sendSyncError(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable("DeleteNetworkInstanceResponseCode", "500") - - } - - - @Test - //@Ignore - public void prepareCompletion() { - - println "************ postProcessResponse ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "source")).thenReturn("PORTAL") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - - // postProcessResponse(DelegateExecution execution) - DeleteNetworkInstance DeleteNetworkInstance = new DeleteNetworkInstance() - DeleteNetworkInstance.prepareCompletion(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", completeMsoProcessRequest) - - } - - - @Test - //@Ignore - public void prepareDBRequestError() { - - println "************ prepareDBRequestError ************* " - - WorkflowException sndcWorkflowExceptionObj = new WorkflowException("CreateNetworkV2", 500, "Received error from SDN-C: No availability zone available") - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowExceptionObj) - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - - // preProcessRequest(DelegateExecution execution) - DeleteNetworkInstance DeleteNetworkInstance = new DeleteNetworkInstance() - DeleteNetworkInstance.prepareDBRequestError(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "deleteDBRequest", deleteDBRequestErrorObj) - - } - - - @Test - //@Ignore - public void postProcessResponse() { - - println "************ postProcessResponse ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("CMSO_ResponseCode")).thenReturn("200") - - // postProcessResponse(DelegateExecution execution) - DeleteNetworkInstance DeleteNetworkInstance = new DeleteNetworkInstance() - DeleteNetworkInstance.postProcessResponse(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "Success", true) - - - } - - - @Test - //@Ignore - public void buildErrorResponse_FalloutHandlerRequest() { - - println "************ buildErrorResponse ************* " - - WorkflowException sndcWorkflowExceptionObj = new WorkflowException("DeleteNetworkInstance", 7000, "Received error from SDN-C: No availability zone available") - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso-request-id")).thenReturn("b69c9054-da09-4a2c-adf5-51042b62bfac") - when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowExceptionObj) - when(mockExecution.getVariable(Prefix + "source")).thenReturn("PORTAL") - - // buildErrorResponse(DelegateExecution execution) - DeleteNetworkInstance DeleteNetworkInstance = new DeleteNetworkInstance() - DeleteNetworkInstance.buildErrorResponse(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "Success", false) - verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequestObj) - - } - - - private ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("DeleteNetworkInstance") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DeleteNetworkInstance") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("DeleteNetworkInstance") - when(mockExecution.getProcessInstanceId()).thenReturn("DeleteNetworkInstance") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - - return mockExecution - - } - -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy deleted file mode 100644 index 19c72fd7c6..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy +++ /dev/null @@ -1,170 +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.bpmn.infrastructure.scripts; - -import static org.junit.Assert.* -import static org.mockito.Mockito.* - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.junit.Before -import org.junit.Ignore -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.openecomp.mso.bpmn.common.scripts.MsoGroovyTest -import org.openecomp.mso.bpmn.core.WorkflowException - - -@RunWith(MockitoJUnitRunner.class) -class DeleteVfModuleVolumeInfraV1Test extends MsoGroovyTest { - - def deleteVnfAdapterRequestXml = """ - RDM2WAGPLCP - fba1bd1e195a404cacb9ce17a9b2b421 - 78987 - - true - - TEST-REQUEST-ID-0123 - 1234 - - ebb9ef7b-a6a5-40e6-953e-f868f1767677 - http://localhost:28080/mso/WorkflowMessage/VNFAResponse/ebb9ef7b-a6a5-40e6-953e-f868f1767677 -""" - - def dbRequestXml = """ - - - - TEST-REQUEST-ID-0123 - BPMN - VolumeGroup successfully deleted - COMPLETE - 100 - - - -""" - - def completionRequestXml = """ - - TEST-REQUEST-ID-0123 - DELETE - VID - - Volume Group has been deleted successfully. - BPMN VF Module Volume action: DELETE -""" - - def falloutHandlerRequestXml = """ - - TEST-REQUEST-ID-0123 - DELETE - VID - - - Unexpected Error - 5000 - -""" - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - - @Test - public void testPrepareVnfAdapterDeleteRequest() { - - ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') - when(mockExecution.getVariable("DELVfModVol_cloudRegion")).thenReturn('RDM2WAGPLCP') - when(mockExecution.getVariable("DELVfModVol_tenantId")).thenReturn('fba1bd1e195a404cacb9ce17a9b2b421') - when(mockExecution.getVariable("DELVfModVol_volumeGroupId")).thenReturn('78987') - when(mockExecution.getVariable("DELVfModVol_volumeGroupHeatStackId")).thenReturn('') - when(mockExecution.getVariable("DELVfModVol_requestId")).thenReturn('TEST-REQUEST-ID-0123') - when(mockExecution.getVariable("DELVfModVol_serviceId")).thenReturn('1234') - when(mockExecution.getVariable("DELVfModVol_messageId")).thenReturn('ebb9ef7b-a6a5-40e6-953e-f868f1767677') - when(mockExecution.getVariable("URN_mso_workflow_message_endpoint")).thenReturn('http://localhost:28080/mso/WorkflowMessage') - when(mockExecution.getVariable("URN_mso_use_qualified_host")).thenReturn('') - - DeleteVfModuleVolumeInfraV1 myproc = new DeleteVfModuleVolumeInfraV1() - myproc.prepareVnfAdapterDeleteRequest(mockExecution, 'true') - - verify(mockExecution).setVariable("DELVfModVol_deleteVnfARequest", deleteVnfAdapterRequestXml) - - } - - @Test - //@Ignore - public void testPrepareDbRequest() { - - ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') - when(mockExecution.getVariable("DELVfModVol_requestId")).thenReturn('TEST-REQUEST-ID-0123') - when(mockExecution.getVariable("DELVfModVol_volumeOutputs")).thenReturn('') - when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - - DeleteVfModuleVolumeInfraV1 myproc = new DeleteVfModuleVolumeInfraV1() - myproc.prepareDBRequest(mockExecution, 'true') - - verify(mockExecution).setVariable("DELVfModVol_updateInfraRequest", dbRequestXml) - } - - @Test - public void testPrepareCompletionHandlerRequest() { - - ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') - when(mockExecution.getVariable("mso-request-id")).thenReturn('TEST-REQUEST-ID-0123') - when(mockExecution.getVariable("DELVfModVol_source")).thenReturn('VID') - - DeleteVfModuleVolumeInfraV1 myproc = new DeleteVfModuleVolumeInfraV1() - myproc.prepareCompletionHandlerRequest(mockExecution, 'true') - - verify(mockExecution).setVariable("DELVfModVol_CompleteMsoProcessRequest", completionRequestXml) - } - - @Test - public void testPrepareFalloutHandler() { - - WorkflowException workflowException = new WorkflowException('DeleteVfModuleVolumeInfraV1', 5000, 'Unexpected Error') - - ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') - - when(mockExecution.getVariable("DELVfModVol_requestId")).thenReturn('TEST-REQUEST-ID-0123') - when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) - when(mockExecution.getVariable("DELVfModVol_source")).thenReturn('VID') - - DeleteVfModuleVolumeInfraV1 myproc = new DeleteVfModuleVolumeInfraV1() - myproc.prepareFalloutHandler(mockExecution, 'true') - - verify(mockExecution).setVariable("DELVfModVol_Success", false) - verify(mockExecution).setVariable("DELVfModVol_FalloutHandlerRequest", falloutHandlerRequestXml) - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy deleted file mode 100644 index 157e7db234..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy +++ /dev/null @@ -1,349 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import static org.mockito.Mockito.* - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.junit.Before -import org.junit.Rule; -import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith - -import static org.openecomp.mso.bpmn.mock.StubResponseNetworkAdapter.MockNetworkAdapterRestRollbackDelete; -import static org.junit.Assert.*; - -import com.github.tomakehurst.wiremock.client.WireMock; -import com.github.tomakehurst.wiremock.junit.WireMockRule; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import org.apache.commons.lang3.* - - -@RunWith(MockitoJUnitRunner.class) -class DoCreateNetworkInstanceRollbackTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - - def utils = new MsoUtils() - String Prefix="CRENWKIR_" - - - String rollbackNetworkRequest = - """ - - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - - CONTRAIL_EXTERNAL - true - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - - - -""" - - String rollbackActivateSDNCRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - rollback - network-topology-operation - sdncCallback - generic-resource - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - CreateNetworkInstance - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - MSO_1610_dev - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - - invariant-uuid - customization-uuid - uuid - version - CONTRAIL_EXTERNAL - - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - -""" - - String rollbackSDNCRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - rollback - network-topology-operation - sdncCallback - generic-resource - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - CreateNetworkInstance - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - MSO_1610_dev - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - - invariant-uuid - customization-uuid - uuid - version - CONTRAIL_EXTERNAL - - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - -""" - -// - - - - - - - - - - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - - } - - public void initializeVariables (DelegateExecution mockExecution) { - - verify(mockExecution).setVariable(Prefix + "WorkflowException", null) - - verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", null) - verify(mockExecution).setVariable(Prefix + "rollbackNetworkResponse", "") - verify(mockExecution).setVariable(Prefix + "rollbackNetworkReturnCode", "") - - verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", null) - verify(mockExecution).setVariable(Prefix + "rollbackSDNCResponse", "") - verify(mockExecution).setVariable(Prefix + "rollbackSDNCReturnCode", "") - - verify(mockExecution).setVariable(Prefix + "rollbackActivateSDNCRequest", null) - verify(mockExecution).setVariable(Prefix + "rollbackActivateSDNCResponse", "") - verify(mockExecution).setVariable(Prefix + "rollbackActivateSDNCReturnCode", "") - - verify(mockExecution).setVariable(Prefix + "Success", false) - verify(mockExecution).setVariable(Prefix + "fullRollback", false) - verify(mockExecution).setVariable(Prefix + "networkId", "") - verify(mockExecution).setVariable(Prefix + "urlRollbackPoNetwork", "") - - } - - @Test - //@Ignore - public void preProcessRequest() { - - println "************ preProcessRequest ************* " - - WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") - Map rollbackData = new HashMap(); - rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) - rollbackData.put("rollbackActivateSDNCRequest", rollbackActivateSDNCRequest) - rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) - when(mockExecution.getVariable("rollbackData")).thenReturn(rollbackData) - when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") - - when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - - when(mockExecution.getVariable("URN_mso_adapters_sdnc_endpoint")).thenReturn("http://localhost:28090/SDNCAdapter") - when(mockExecution.getVariable("URN_mso_adapters_network_rest_endpoint")).thenReturn("http://localhost:28090/networks/NetworkAdapter") - when(mockExecution.getVariable("URN_mso_adapters_sdnc_resource_endpoint")).thenReturn("http://localhost:28090/SDNCAdapterRpc") - - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstanceRollback DoCreateNetworkInstanceRollback = new DoCreateNetworkInstanceRollback() - DoCreateNetworkInstanceRollback.preProcessRequest(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - //verify variable initialization - initializeVariables(mockExecution) - - } - - @Test - //@Ignore - public void callPONetworkAdapter() { - - MockNetworkAdapterRestRollbackDelete("deleteNetworkResponse_Success.xml","8abc633a-810b-4ca5-8b3a-09511d13a2ce"); - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn( rollbackNetworkRequest) - when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn(rollbackSDNCRequest) - when(mockExecution.getVariable("URN_mso_adapters_network_rest_endpoint")).thenReturn("http://localhost:28090/networks/NetworkAdapter") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstanceRollback DoCreateNetworkInstanceRollback = new DoCreateNetworkInstanceRollback() - DoCreateNetworkInstanceRollback.callPONetworkAdapter(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable(Prefix + "urlRollbackPoNetwork", "http://localhost:28090/networks/NetworkAdapter/8abc633a-810b-4ca5-8b3a-09511d13a2ce/rollback") - - } - - @Test - //@Ignore - public void validateRollbackResponses_Good() { - - WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstanceRollback", 2500, "AAI Update Contrail Failed. Error 404.") - WorkflowException expectedWorkflowException = new WorkflowException("DoCreateNetworkInstanceRollback", 2500, "AAI Update Contrail Failed. Error 404. + SNDC activate rollback completed. + PO Network rollback completed. + SNDC assign rollback completed.") - - println "************ validateRollbackResponses_Good() ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn("Good") - when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn("Good") - when(mockExecution.getVariable(Prefix + "rollbackActivateSDNCRequest")).thenReturn("Good") - when(mockExecution.getVariable(Prefix + "rollbackNetworkReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "rollbackNetworkResponse")).thenReturn("GoodResponse") - when(mockExecution.getVariable(Prefix + "rollbackSDNCReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "rollbackSDNCResponse")).thenReturn("GoodResponse") - when(mockExecution.getVariable(Prefix + "rollbackActivateSDNCReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "rollbackActivateSDNCResponse")).thenReturn("GoodResponse") - when(mockExecution.getVariable(Prefix + "WorkflowException")).thenReturn(workflowException) - when(mockExecution.getVariable(Prefix + "fullRollback")).thenReturn(false) - - DoCreateNetworkInstanceRollback DoCreateNetworkInstanceRollback = new DoCreateNetworkInstanceRollback() - DoCreateNetworkInstanceRollback.validateRollbackResponses(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) - verify(mockExecution, atLeast(1)).setVariable("rolledBack", true) - verify(mockExecution, atLeast(1)).setVariable("wasDeleted", true) - verify(mockExecution).setVariable("WorkflowException", refEq(expectedWorkflowException, any(WorkflowException.class))) - //verify(mockExecution).setVariable("WorkflowException", expectedWorkflowException) - } - - @Test - //@Ignore - public void validateRollbackResponses_FullRollback() { - - Map rollbackData = new HashMap(); - rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) - rollbackData.put("rollbackActivateSDNCRequest", rollbackActivateSDNCRequest) - rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) - - println "************ validateRollbackResponses_FullRollback() ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn("Good") - when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn("Good") - when(mockExecution.getVariable(Prefix + "rollbackActivateSDNCRequest")).thenReturn("Good") - when(mockExecution.getVariable(Prefix + "rollbackNetworkReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "rollbackNetworkResponse")).thenReturn("GoodResponse") - when(mockExecution.getVariable(Prefix + "rollbackSDNCReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "rollbackSDNCResponse")).thenReturn("GoodResponse") - when(mockExecution.getVariable(Prefix + "rollbackActivateSDNCReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "rollbackActivateSDNCResponse")).thenReturn("GoodResponse") - when(mockExecution.getVariable(Prefix + "workflowException")).thenReturn(null) - when(mockExecution.getVariable(Prefix + "fullRollback")).thenReturn(true) - when(mockExecution.getVariable("rollbackData")).thenReturn(rollbackData) - - DoCreateNetworkInstanceRollback DoCreateNetworkInstanceRollback = new DoCreateNetworkInstanceRollback() - DoCreateNetworkInstanceRollback.validateRollbackResponses(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) - verify(mockExecution, atLeast(1)).setVariable("rollbackSuccessful", true) - verify(mockExecution, atLeast(1)).setVariable("rollbackError", false) - - } - - - private ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("DoCreateNetworkInstanceRollback") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateNetworkInstanceRollback") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateNetworkInstanceRollback") - when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateNetworkInstanceRollback") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - - return mockExecution - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy deleted file mode 100644 index dafbe3c8ac..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy +++ /dev/null @@ -1,4305 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import static org.mockito.Mockito.* -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkByName; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkByName_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutNetworkIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkPolicy; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkTableReference; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkVpnBinding; -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.junit.Before -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.core.WorkflowException - -import com.github.tomakehurst.wiremock.client.WireMock -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.apache.commons.lang3.* - -@RunWith(MockitoJUnitRunner.class) -class DoCreateNetworkInstanceTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(8090); - - def utils = new MsoUtils() - String Prefix="CRENWKI_" - -// ---- Start XML Zone ---- - String xmlIncomingRequest = - """ - - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - CREATE - PORTAL - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - dvs-slcp3-01 - 3008 - MNS-25180-L-01-dmz_direct_net_1 - true - - - 1 - 0 - - - """ - - String expectedXMLNetworkRequest = -""" - - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - CREATE - PORTAL - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - dvs-slcp3-01 - 3008 - MNS-25180-L-01-dmz_direct_net_1 - true - - - 1 - 0 - - -""" - - String expectedXMLNetworkInputs = -""" - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - dvs-slcp3-01 - 3008 - MNS-25180-L-01-dmz_direct_net_1 - true -""" - - String networkXMLOutputs = -"""""" - -// ---- End XML Zone ---- - -// ---- Start JSON Zone ---- - // JSON format Input - String jsonIncomingRequest = - """{ "requestDetails": { - "modelInfo": { - "modelType": "network", - "modelCustomizationId": "f21df226-8093-48c3-be7e-0408fcda0422", - "modelName": "CONTRAIL_EXTERNAL", - "modelVersion": "1.0" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "RDM2WAGPLCP", - "tenantId": "7dd5365547234ee8937416c65507d266" - }, - "requestInfo": { - "instanceName": "MNS-25180-L-01-dmz_direct_net_1", - "source": "VID", - "callbackUrl": "", - "suppressRollback": true, - "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", - "modelInfo": { - "modelType": "serviceT", - "modelId": "modelI", - "modelNameVersionId": "modelNameVersionI", - "modelName": "modleNam", - "modelVersion": "1" - } - } - } - ], - "requestParameters": { - "userParams": [ - { - "name": "someUserParam1", - "value": "someValue1" - } - ] - } - }}""" - - String expectedJSONNetworkRequest = - """ - - null - CREATE - VID - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - - networkId - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - f21df226-8093-48c3-be7e-0408fcda0422 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - 1610 - - - someValue1 - -""" - - String expectedJSONNetworkInputs = -""" - networkId - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - f21df226-8093-48c3-be7e-0408fcda0422 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - 1610 -""" - - String networkJSONOutputs = -""" - networkId - MNS-25180-L-01-dmz_direct_net_1 - """ - -// ---- End JSON Zone ---- - -// ---- Start vPIR Zone ---- - // expectedNetworkRequest - String expectedvIPRNetworkRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - CREATE - VID - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - - networkId - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - MSO-dev-service-type - globalId_45678905678 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - false - - CONTRAIL_EXTERNAL - sn5256d1-5a33-55df-13ab-12abad84e111 - sn5256d1-5a33-55df-13ab-12abad84e764 - 1 - sn5256d1-5a33-55df-13ab-12abad84e222 - - - HNGW Protected OAM - 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 - fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 - 1.0 - - - 1702 - - -""" - - String expectedvIPRNetworkInputs = -""" - networkId - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - MSO-dev-service-type - globalId_45678905678 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - false - - CONTRAIL_EXTERNAL - sn5256d1-5a33-55df-13ab-12abad84e111 - sn5256d1-5a33-55df-13ab-12abad84e764 - 1 - sn5256d1-5a33-55df-13ab-12abad84e222 - - - HNGW Protected OAM - 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 - fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 - 1.0 - - - 1702 -""" - - String networkvIPROutputs = -""" - networkId - MNS-25180-L-01-dmz_direct_net_1 - """ - -// ---- End vPIR Zone ---- - - String vnfRequestFakeRegion = - """ - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - CREATE - PORTAL - - - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - MSO-dev-service-type - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MDTWNJ21 - 7dd5365547234ee8937416c65507d266 - - - 1 - 0 - -""" - - // expectedNetworkRequest - String expectedNetworkRequest_Outputs = - """ - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - CREATE - PORTAL - - - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - MSO-dev-service-type - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - - - MNS-25180-L-01-dmz_direct_net_1 - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - - - 1 - 0 - -""" - - - // expectedNetworkRequest - String networkInputs_404 = - """ - myOwn_Network - CONTRAIL_EXTERNAL - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - RDM2WAGPLCP - e81d842d3e8b45c5a59f57cd76af3aaf - """ - - String networkInputs = - """ - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - RDM2WAGPLCP - e81d842d3e8b45c5a59f57cd76af3aaf -""" - - - - String queryAAIResponse = - """ - - - - - - - - - - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_EXTERNAL - dmz_direct - contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - pending-create - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-create - true - - - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - - -""" - - String queryIdAIIResponse = - """ - - - - - - - - - - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - Contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - l3-version - pending-create - networkName - false - true - false - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-create - true - subnetName - true - - - string - 192.10.16.0/24 - 192.10.16.100/24 - ip-address - 1505857301954 - - - string - 192.110.17.0/24 - 192.110.17.110/24 - ip-address - 1505857301954 - - - - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-create - true - subnetName - true - - - string - 192.10.16.0/24 - 192.10.16.100/24 - ip-address - 1505857301954 - - - - - - - 414 - 4132176 - - - 415 - 4132176 - - - - inner - ctag-version - - - tenant - https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ - - tenant.tenant-id - 897deadc2b954a6bac6d3c197fb3525e - - - tenant.tenant-name - MSOTest1 - - - - vpn-binding - https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ - - vpn-binding.vpn-id - a290b841-f672-44dd-b9cd-6f8c20d7d8c8 - - - vpn-binding.vpn-name - oam_protected_net_6_MTN5_msotest2 - - - - vpn-binding - https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ - - vpn-binding.vpn-id - 24a4b507-853a-4a38-99aa-05fcc54be24d - - - vpn-binding.vpn-name - oam_protected_net_6_MTN5_msotest1 - - - - - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - network-policy - https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg - - network-policy.network-policy-id - cee6d136-e378-4678-a024-2cd15f0ee0cg - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - - -""" - -String queryIdAIIResponse_AlaCarte = -""" - - - - - - - - - - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - Contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - l3-version - pending-create - networkName - false - true - false - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-create - true - subnetName - - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-create - true - subnetName - - - - - 414 - 4132176 - - - 415 - 4132176 - - - - inner - ctag-version - - - tenant - https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ - - tenant.tenant-id - 897deadc2b954a6bac6d3c197fb3525e - - - tenant.tenant-name - MSOTest1 - - - - vpn-binding - https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ - - vpn-binding.vpn-id - a290b841-f672-44dd-b9cd-6f8c20d7d8c8 - - - vpn-binding.vpn-name - oam_protected_net_6_MTN5_msotest2 - - - - vpn-binding - https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ - - vpn-binding.vpn-id - 24a4b507-853a-4a38-99aa-05fcc54be24d - - - vpn-binding.vpn-name - oam_protected_net_6_MTN5_msotest1 - - - - - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - network-policy - https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg - - network-policy.network-policy-id - cee6d136-e378-4678-a024-2cd15f0ee0cg - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - - -""" - -String queryIdAIIResponse_segmentation = -""" - - - - - - - - - - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - Contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - l3-version - pending-create - networkName - false - true - false - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-create - true - subnetName - - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-create - true - subnetName - - - - - - 1 - 1498507569188 - - - - - inner - ctag-version - - - tenant - https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ - - tenant.tenant-id - 897deadc2b954a6bac6d3c197fb3525e - - - tenant.tenant-name - MSOTest1 - - - - vpn-binding - https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ - - vpn-binding.vpn-id - a290b841-f672-44dd-b9cd-6f8c20d7d8c8 - - - vpn-binding.vpn-name - oam_protected_net_6_MTN5_msotest2 - - - - vpn-binding - https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ - - vpn-binding.vpn-id - 24a4b507-853a-4a38-99aa-05fcc54be24d - - - vpn-binding.vpn-name - oam_protected_net_6_MTN5_msotest1 - - - - - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - network-policy - https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg - - network-policy.network-policy-id - cee6d136-e378-4678-a024-2cd15f0ee0cg - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - - -""" - -String queryIdAIIResponse_Ipv4 = -""" - - - - - - - - - - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - Contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - l3-version - pending-create - networkName - false - true - false - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - ipv4 - pending-create - true - subnetName - - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - ipv4 - pending-create - true - subnetName - - - - - 414 - 4132176 - - - 415 - 4132176 - - - - inner - ctag-version - - - tenant - https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ - - tenant.tenant-id - 897deadc2b954a6bac6d3c197fb3525e - - - tenant.tenant-name - MSOTest1 - - - - vpn-binding - https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ - - vpn-binding.vpn-id - a290b841-f672-44dd-b9cd-6f8c20d7d8c8 - - - vpn-binding.vpn-name - oam_protected_net_6_MTN5_msotest2 - - - - vpn-binding - https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ - - vpn-binding.vpn-id - 24a4b507-853a-4a38-99aa-05fcc54be24d - - - vpn-binding.vpn-name - oam_protected_net_6_MTN5_msotest1 - - - - - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - network-policy - https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg - - network-policy.network-policy-id - cee6d136-e378-4678-a024-2cd15f0ee0cg - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - - -""" - -String queryIdAIIResponse_SRIOV = -""" - - 6cb1ae5a-d2db-4eb6-97bf-d52a506a53d8 - MSO_TEST_1702_A_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_17 - SR_IOV_Provider2_1 - HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1 - AIC_SR_IOV - false - - 1487336177672 - PendingCreate - f70d7a32-0ac8-4bd5-a0fb-3c9336540d78 - 1.0 - Physnet21 - true - false - false - - - 10437 - MSO_TEST_1702_A_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_17_S0 - 192.168.6.1 - 192.168.6.0 - 26 - 4 - PendingCreate - true - 192.168.6.3 - 192.168.6.62 - 1487336177359 - - - - - tenant - https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn16/tenants/tenant/6accefef3cb442ff9e644d589fb04107 - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - mtn16 - - - tenant.tenant-id - 6accefef3cb442ff9e644d589fb04107 - - - tenant.tenant-name - MSO_TEST_1702_A - - - - cloud-region - https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn16 - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - mtn16 - - - cloud-region.owner-defined-type - lcp - - - - service-instance - https://aai-ext1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/51d8336b-a993-4afe-a5fc-10b3afbd6560 - - customer.global-customer-id - MSO_1610_ST - - - service-subscription.service-type - MSO-dev-service-type - - - service-instance.service-instance-id - 51d8336b-a993-4afe-a5fc-10b3afbd6560 - - - service-instance.service-instance-name - HnportalProviderNetwork_17 - - - -""" - - String queryIdAIIResponseTestScenario01 = - """ - - 4da55fe4-7a9e-478c-a434-8a98d62265ab - GN_EVPN_direct_net_0_ST1 - CONTRAIL30_BASIC - GN_EVPN_direct - contrail - false - 9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - 1465398611 - pending-create - networkName - false - true - false - - - cb1a7b47-5428-44c9-89c2-8b17541c3228 - 108.239.40.1 - 108.239.40.0 - 28 - 4 - pending-create - true - 108.239.40.0 - 108.239.40.0 - 1465398611 - subnetName - - - - e2cc7c14-90f0-4205-840d-b4e07f04e621 - 2606:ae00:2e01:604::1 - 2606:ae00:2e01:604:: - 64 - 6 - pending-create - true - 2606:ae00:2e01:604:: - 2606:ae00:2e01:604:: - 1465398611 - subnetName - - - - - - 416 - 4132176 - - - - cloud-region - https://mtanjv9aaas03.aic.cip.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/ - - - cloud-region.cloud-region-id - AAIAIC25 - - - cloud-region.cloud-owner - att-aic - - - cloud-region.owner-defined-type - - - - - tenant - https://mtanjv9aaas03.aic.cip.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/4ae1d3446a4c48b2bec44b6cfba06d68/ - - tenant.tenant-id - 4ae1d3446a4c48b2bec44b6cfba06d68 - - - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - AAIAIC25 - - - tenant.tenant-name - Ruchira Contrail 3.0 test - - - - vpn-binding - https://mtanjv9aaas03.aic.cip.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 9a7b327d9-287aa00-82c4b0-100001 - - - vpn-binding.vpn-name - GN_EVPN_direct_net_0_ST1 - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - -""" - - String queryIdAIIResponseVpnNotPresent = - """ - - - - - - - - - - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - pending-create - networkName - false - true - false - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-create - true - subnetName - - - - - - -""" - - String queryNameAIIResponse = - """ - - - - - - - - - - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - pending-create - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-create - true - - - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - - - """ - - String queryNameAIIResponseVpnNotPresent = - """ - - - - - - - - - - - - - - -""" - - String queryVpnBindingAAIResponse = - """ - - - - - - - - - - - - 9a7b327d9-287aa00-82c4b0-105757 - GN_EVPN_Test - 13979:105757 - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ - - l3-network.network-id - 689ec39e-c5fc-4462-8db2-4f760763ad28 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ - - l3-network.network-id - 1a49396b-19b3-40a4-8792-aa2fbd0f0704 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ - - l3-network.network-id - 774f3329-3c83-4771-86c7-9e6207cd50fd - - - - - -""" - - String createDBRequestError01 = - """ - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - BPMN - Received error unexpectedly from SDN-C. - - FAILED - <network-id></network-id><network-name></network-names> - - - """ - - String createDBRequest_Outputs = - """ - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - BPMN - Network successfully created. - - COMPLETED - 100 - <network-id>networkId</network-id><network-name>MNS-25180-L-01-dmz_direct_net_1</network-names> - networkId - - -""" - - String createNetworkRequest = - """ - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - sn5256d1-5a33-55df-13ab-12abad84e222 - CONTRAIL - - networkName - 414,415 - - - true - false - 13979:105757 - 13979:105757 - GN_EVPN_Test - refFQDN1 - refFQDN2 - - - - - - - 107.239.52.0/24 - true - 107.239.52.1 - 4 - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - subnetName - true - - 192.10.16.0/24 - 192.10.16.100/24 - - - 192.110.17.0/24 - 192.110.17.110/24 - - - - - - - - 107.239.52.0/24 - true - 107.239.52.1 - 4 - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - subnetName - true - - 192.10.16.0/24 - 192.10.16.100/24 - - - true - true - false - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - messageId_generated - -""" - -String createNetworkRequest_Ipv4 = -""" - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - sn5256d1-5a33-55df-13ab-12abad84e222 - CONTRAIL - - networkName - 414,415 - - - true - false - 13979:105757 - 13979:105757 - GN_EVPN_Test - refFQDN1 - refFQDN2 - - - - - - - 107.239.52.0/24 - true - 107.239.52.1 - 4 - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - subnetName - - - - - - - 107.239.52.0/24 - true - 107.239.52.1 - 4 - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - subnetName - - true - true - false - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - messageId_generated - -""" - -String createNetworkRequestAlaCarte = -""" - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - f21df226-8093-48c3-be7e-0408fcda0422 - CONTRAIL - - networkName - 414,415 - - - true - false - 13979:105757 - 13979:105757 - GN_EVPN_Test - refFQDN1 - refFQDN2 - - - - - - - 107.239.52.0/24 - true - 107.239.52.1 - 4 - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - subnetName - - - - - - - 107.239.52.0/24 - true - 107.239.52.1 - 4 - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - subnetName - - true - true - false - - someValue1 - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - messageId_generated - -""" - -String createNetworkRequest_SRIOV = -""" - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - 6cb1ae5a-d2db-4eb6-97bf-d52a506a53d8 - MSO_TEST_1702_A_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_17 - CONTRAIL_EXTERNAL - sn5256d1-5a33-55df-13ab-12abad84e222 - AIC_SR_IOV - - Physnet21 - - - - - 192.168.6.3 - 192.168.6.62 - - 192.168.6.0/26 - true - 192.168.6.1 - 4 - 10437 - MSO_TEST_1702_A_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_17_S0 - - true - true - false - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - messageId_generated - -""" - - String createNetworkRequest_noPhysicalName = - """ - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - CONTRAIL - - networkName - 414,415 - - - true - false - 13979:105757 - 13979:105757 - GN_EVPN_Test - - - - - - - 107.239.52.0/24 - true - 107.239.52.1 - 4 - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - subnetName - - - - - - - 107.239.52.0/24 - true - 107.239.52.1 - 4 - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - subnetName - - true - true - false - - true - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - true - true - 10.10.125.1 - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - null - - messageId_generated - -""" - - String createNetworkResponseREST = - """ - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 - - true - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 - - - - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - - CONTRAIL_EXTERNAL - true - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - - - - messageId_generated -""" - - String createRollbackNetworkRequest = - """ - - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - - CONTRAIL_EXTERNAL - true - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - - - -""" - - String createNetworkResponse = - """ - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 - - - - RDM2WAGPLCP - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - - - true - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - CONTRAIL_EXTERNAL - false - c4f4e878-cde0-4b15-ae9a-bda857759cea - 7dd5365547234ee8937416c65507d266 - -""" - - String updateContrailAAIPayloadRequest = - """ - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - Contrail - c4f4e878-cde0-4b15-ae9a-bda857759cea - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - l3-version - Created - default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 - networkName - false - true - false - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 - 107.239.52.1 - 107.239.52.0 - 24 - 4 - Created - true - 1505857301954 - subnetName - true - - - string - 192.10.16.0/24 - 192.10.16.100/24 - ip-address - 1505857301954 - - - string - 192.110.17.0/24 - 192.110.17.110/24 - ip-address - 1505857301954 - - - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 - 107.239.52.1 - 107.239.52.0 - 24 - 4 - Created - true - 1505857301954 - subnetName - true - - - string - 192.10.16.0/24 - 192.10.16.100/24 - ip-address - 1505857301954 - - - - - - 414 - 4132176 - - - 415 - 4132176 - - - - inner - ctag-version - - - tenant - https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ - - tenant.tenant-id - 897deadc2b954a6bac6d3c197fb3525e - - - tenant.tenant-name - MSOTest1 - - - - vpn-binding - https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ - - vpn-binding.vpn-id - a290b841-f672-44dd-b9cd-6f8c20d7d8c8 - - - vpn-binding.vpn-name - oam_protected_net_6_MTN5_msotest2 - - - - vpn-binding - https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ - - vpn-binding.vpn-id - 24a4b507-853a-4a38-99aa-05fcc54be24d - - - vpn-binding.vpn-name - oam_protected_net_6_MTN5_msotest1 - - - - - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - network-policy - https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg - - network-policy.network-policy-id - cee6d136-e378-4678-a024-2cd15f0ee0cg - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - -""" - -String updateContrailAAIPayloadRequest_segmentation = -""" - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - Contrail - c4f4e878-cde0-4b15-ae9a-bda857759cea - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - l3-version - Created - default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 - networkName - false - true - false - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 - 107.239.52.1 - 107.239.52.0 - 24 - 4 - Created - true - subnetName - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 - 107.239.52.1 - 107.239.52.0 - 24 - 4 - Created - true - subnetName - - - - - 1 - 1498507569188 - - - - - inner - ctag-version - - - tenant - https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ - - tenant.tenant-id - 897deadc2b954a6bac6d3c197fb3525e - - - tenant.tenant-name - MSOTest1 - - - - vpn-binding - https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ - - vpn-binding.vpn-id - a290b841-f672-44dd-b9cd-6f8c20d7d8c8 - - - vpn-binding.vpn-name - oam_protected_net_6_MTN5_msotest2 - - - - vpn-binding - https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ - - vpn-binding.vpn-id - 24a4b507-853a-4a38-99aa-05fcc54be24d - - - vpn-binding.vpn-name - oam_protected_net_6_MTN5_msotest1 - - - - - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - network-policy - https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg - - network-policy.network-policy-id - cee6d136-e378-4678-a024-2cd15f0ee0cg - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - -""" - - String updateContrailAAIResponse = - """ - - - - - - - - -""" - - String createNetworkErrorResponse = - """ - 680bd458-5ec1-4a16-b77c-509022e53450INTERNAL - 400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data - true - """ - - - String networkException500 = - """soap:VersionMismatch"http://org.openecomp.mso/network", the namespace on the "createNetworkContrail" element, is not a valid SOAP version.""" - - String aaiResponse = - """ - - - - - - - - - - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_BASIC - HSL_direct - contrail - 8bbd3edf-b835-4610-96a2-a5cafa029042 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - active - HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 - - - ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a - 5a77fdc2-7789-4649-a1b9-6eaf1db1813a - 172.16.34.1 - 172.16.34.0 - 28 - 4 - active - true - - - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v3/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ - - tenant.tenant-id - e81d842d3e8b45c5a59f57cd76af3aaf - - - - - - """ - - String assignSDNCRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - assign - network-topology-operation - sdncCallback - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - NetworkActivateRequest - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - MSO_1610_dev - - - networkId - CONTRAIL_EXTERNAL - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - -""" - -String assignSDNCRequest_decodeUrlLink = -""" - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - assign - network-topology-operation - sdncCallback - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - NetworkActivateRequest - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - VIRTUAL USP - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - MSO_1610_dev - - - networkId - CONTRAIL_EXTERNAL - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - -""" - -String assignRpcSDNCRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - assign - network-topology-operation - sdncCallback - generic-resource - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - CreateNetworkInstance - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - - fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 - 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 - 1.0 - HNGW Protected OAM - - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - globalId_45678905678 - MSO_1610_dev - - - networkId - CONTRAIL_EXTERNAL - - sn5256d1-5a33-55df-13ab-12abad84e764 - sn5256d1-5a33-55df-13ab-12abad84e222 - sn5256d1-5a33-55df-13ab-12abad84e111 - 1 - CONTRAIL_EXTERNAL - - - - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - - - -""" - -String activateSDNCRequest = -""" - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - activate - network-topology-operation - sdncCallback - generic-resource - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - CreateNetworkInstance - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - - fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 - 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 - 1.0 - HNGW Protected OAM - - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - globalId_45678905678 - MSO_1610_dev - - - networkId - CONTRAIL_EXTERNAL - - sn5256d1-5a33-55df-13ab-12abad84e764 - sn5256d1-5a33-55df-13ab-12abad84e222 - sn5256d1-5a33-55df-13ab-12abad84e111 - 1 - CONTRAIL_EXTERNAL - - - - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - - - -""" - -String assignResponse = -""" 006927ca-f5a3-47fd-880c-dfcbcd81a093 200 OK 200006927ca-f5a3-47fd-880c-dfcbcd81a093Ynotsurewecarea9a77d5a-123e-4ca2-9eb9-0b015d2ee0fbGN_EVPN_direct_net_0_ST_noGW8abc633a-810b-4ca5-8b3a-09511d13a2ce """ - - String sdncRollbackRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - rollback - network-topology-operation - sdncCallback - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - NetworkActivateRequest - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - MSO_1610_dev - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - -""" - -String sdncRpcRollbackRequest = -""" - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - unassign - network-topology-operation - sdncCallback - generic-resource - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - DeleteNetworkInstance - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - - fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 - 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 - 1.0 - HNGW Protected OAM - - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - globalId_45678905678 - MSO_1610_dev - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - - sn5256d1-5a33-55df-13ab-12abad84e764 - sn5256d1-5a33-55df-13ab-12abad84e222 - sn5256d1-5a33-55df-13ab-12abad84e111 - 1 - CONTRAIL_EXTERNAL - - - - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - - - -""" - -String sdncActivateRollbackRequest = -""" - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - deactivate - network-topology-operation - sdncCallback - generic-resource - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - DeleteNetworkInstance - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - - fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 - 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 - 1.0 - HNGW Protected OAM - - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - globalId_45678905678 - MSO_1610_dev - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - - sn5256d1-5a33-55df-13ab-12abad84e764 - sn5256d1-5a33-55df-13ab-12abad84e222 - sn5256d1-5a33-55df-13ab-12abad84e111 - 1 - CONTRAIL_EXTERNAL - - - - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - - - -""" - - String sdncAdapterWorkflowResponse = - """ - - - 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 - 200 - OK - - <output xmlns="com:att:sdnctl:vnf"><svc-request-id>00703dc8-71ff-442d-a4a8-3adc5beef6a9</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>MNS-25180-L-01-dmz_direct_net_1</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> - -""" - - - String sdncAdapterWorkflowResponse_Error = - """ - - - - 400 - Error writing to l3-netework - Y - c79240d8-34b5-4853-af69-2021928dba00 - - - -""" - - String expected_sdncAdapterWorkflowResponse_Error = - """ - - - - 400 - Error writing to l3-netework - Y - c79240d8-34b5-4853-af69-2021928dba00 - - - -""" - - String sdncAdapterWorkflowFormattedResponse = - """ - - - 00703dc8-71ff-442d-a4a8-3adc5beef6a9 - 200 - Y - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - notsurewecare - - - -""" - -String sdncAdapterWorkflowAssignResponse = -""" - - - 79ec9006-3695-4fcc-93a8-be6f9e248beb - 200 - OK - - - - - 79ec9006-3695-4fcc-93a8-be6f9e248beb - - f805ec2b-b4d8-473e-8325-67f110139e5d - - 200 - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - restconf/config/GENERIC-RESOURCE-API:services/service/f805ec2b-b4d8-473e-8325-67f110139e5d/service-data/networks/network/f7e4db56-aab5-4065-8e65-cec1cd1de24f - - Y - - - -""" - - String rollbackNetworkRequest = -""" - - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - - CONTRAIL_EXTERNAL - true - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - - - -""" - - String rollbackActivateSDNCRequest = -""" - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - rollback - network-topology-operation - sdncCallback - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - CreateNetworkInstance - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - MSO_1610_dev - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - - invariant-uuid - customization-uuid - uuid - version - CONTRAIL_EXTERNAL - - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - -""" - - String rollbackSDNCRequest = -""" - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - rollback - network-topology-operation - sdncCallback - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - CreateNetworkInstance - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - MSO_1610_dev - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - - invariant-uuid - customization-uuid - uuid - version - CONTRAIL_EXTERNAL - - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - -""" - -// - - - - - - - - - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - - } - - public void initializeVariables (DelegateExecution mockExecution) { - - verify(mockExecution).setVariable(Prefix + "networkRequest", "") - verify(mockExecution).setVariable(Prefix + "rollbackEnabled", null) - verify(mockExecution).setVariable(Prefix + "networkInputs", "") - //verify(mockExecution).setVariable(Prefix + "requestId", "") - verify(mockExecution).setVariable(Prefix + "messageId", "") - verify(mockExecution).setVariable(Prefix + "source", "") - verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "") - verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "") - verify(mockExecution).setVariable(Prefix + "serviceInstanceId","") - verify(mockExecution).setVariable("GENGS_type","") - verify(mockExecution).setVariable(Prefix + "rsrc_endpoint", null) - verify(mockExecution).setVariable(Prefix + "networkOutputs", "") - verify(mockExecution).setVariable(Prefix + "networkId","") - verify(mockExecution).setVariable(Prefix + "networkName","") - - // AAI query Name - verify(mockExecution).setVariable(Prefix + "queryNameAAIRequest","") - verify(mockExecution).setVariable(Prefix + "queryNameAAIResponse", "") - verify(mockExecution).setVariable(Prefix + "aaiNameReturnCode", "") - verify(mockExecution).setVariable(Prefix + "isAAIqueryNameGood", false) - - // AAI query Cloud Region - verify(mockExecution).setVariable(Prefix + "queryCloudRegionRequest","") - verify(mockExecution).setVariable(Prefix + "queryCloudRegionReturnCode","") - verify(mockExecution).setVariable(Prefix + "queryCloudRegionResponse","") - verify(mockExecution).setVariable(Prefix + "cloudRegionPo","") - verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc","") - verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", false) - - // AAI query Id - verify(mockExecution).setVariable(Prefix + "queryIdAAIRequest","") - verify(mockExecution).setVariable(Prefix + "queryIdAAIResponse", "") - verify(mockExecution).setVariable(Prefix + "aaiIdReturnCode", "") - - // AAI query vpn binding - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest","") - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIResponse", "") - verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "") - verify(mockExecution).setVariable(Prefix + "vpnBindings", null) - verify(mockExecution).setVariable(Prefix + "vpnCount", 0) - verify(mockExecution).setVariable(Prefix + "routeCollection", "") - - // AAI query network policy - verify(mockExecution).setVariable(Prefix + "queryNetworkPolicyAAIRequest","") - verify(mockExecution).setVariable(Prefix + "queryNetworkPolicyAAIResponse", "") - verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "") - verify(mockExecution).setVariable(Prefix + "networkPolicyUriList", null) - verify(mockExecution).setVariable(Prefix + "networkPolicyCount", 0) - verify(mockExecution).setVariable(Prefix + "networkCollection", "") - - // AAI query route table reference - verify(mockExecution).setVariable(Prefix + "queryNetworkTableRefAAIRequest","") - verify(mockExecution).setVariable(Prefix + "queryNetworkTableRefAAIResponse", "") - verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "") - verify(mockExecution).setVariable(Prefix + "networkTableRefUriList", null) - verify(mockExecution).setVariable(Prefix + "networkTableRefCount", 0) - verify(mockExecution).setVariable(Prefix + "tableRefCollection", "") - - // AAI requery Id - verify(mockExecution).setVariable(Prefix + "requeryIdAAIRequest","") - verify(mockExecution).setVariable(Prefix + "requeryIdAAIResponse", "") - verify(mockExecution).setVariable(Prefix + "aaiRequeryIdReturnCode", "") - - // AAI update contrail - verify(mockExecution).setVariable(Prefix + "updateContrailAAIUrlRequest","") - verify(mockExecution).setVariable(Prefix + "updateContrailAAIPayloadRequest","") - verify(mockExecution).setVariable(Prefix + "updateContrailAAIResponse", "") - verify(mockExecution).setVariable(Prefix + "aaiUpdateContrailReturnCode", "") - - verify(mockExecution).setVariable(Prefix + "createNetworkRequest", "") - verify(mockExecution).setVariable(Prefix + "createNetworkResponse", "") - verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", "") - //verify(mockExecution).setVariable(Prefix + "rollbackNetworkResponse", "") - verify(mockExecution).setVariable(Prefix + "networkReturnCode", "") - //verify(mockExecution).setVariable(Prefix + "rollbackNetworkReturnCode", "") - verify(mockExecution).setVariable(Prefix + "isNetworkRollbackNeeded", false) - - verify(mockExecution).setVariable(Prefix + "assignSDNCRequest", "") - verify(mockExecution).setVariable(Prefix + "assignSDNCResponse", "") - verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", "") - //verify(mockExecution).setVariable(Prefix + "rollbackSDNCResponse", "") - verify(mockExecution).setVariable(Prefix + "sdncReturnCode", "") - //verify(mockExecution).setVariable(Prefix + "rollbackSDNCReturnCode", "") - verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", false) - verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false) - - verify(mockExecution).setVariable(Prefix + "activateSDNCRequest", "") - verify(mockExecution).setVariable(Prefix + "activateSDNCResponse", "") - verify(mockExecution).setVariable(Prefix + "rollbackActivateSDNCRequest", "") - //verify(mockExecution).setVariable(Prefix + "rollbackActivateSDNCResponse", "") - verify(mockExecution).setVariable(Prefix + "sdncActivateReturnCode", "") - //verify(mockExecution).setVariable(Prefix + "rollbackActivateSDNCReturnCode", "") - verify(mockExecution).setVariable(Prefix + "isSdncActivateRollbackNeeded", false) - verify(mockExecution).setVariable(Prefix + "sdncActivateResponseSuccess", false) - - verify(mockExecution).setVariable(Prefix + "orchestrationStatus", "") - verify(mockExecution).setVariable(Prefix + "isVnfBindingPresent", false) - verify(mockExecution).setVariable(Prefix + "Success", false) - - verify(mockExecution).setVariable(Prefix + "isException", false) - - } - - @Test - //@Ignore - public void preProcessRequest_vIPR_NetworkRequest() { - - println "************ preProcessRequest_Payload ************* " - - def networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111", - "modelName": "CONTRAIL_EXTERNAL", - "modelType": "CONTRAIL_EXTERNAL", - "modelVersion": "1", - "modelCustomizationUuid": "sn5256d1-5a33-55df-13ab-12abad84e222", - "modelInvariantUuid": "sn5256d1-5a33-55df-13ab-12abad84e764" - }""".trim() - - def serviceModelInfo = """{"modelUuid": "36a3a8ea-49a6-4ac8-b06c-89a54544b9b6", - "modelName": "HNGW Protected OAM", - "modelType": "service", - "modelVersion": "1.0", - "modelInvariantUuid": "fcc85cb0-ad74-45d7-a5a1-17c8744fdb71" - }""".trim() - - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - - // Pre-defined value, testing Only - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - // Inputs: - when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("disableRollback")).thenReturn("true") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("networkId")).thenReturn("networkId") // optional - when(mockExecution.getVariable("networkName")).thenReturn("MNS-25180-L-01-dmz_direct_net_1") // optional - when(mockExecution.getVariable("productFamilyId")).thenReturn("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") - when(mockExecution.getVariable("networkModelInfo")).thenReturn("CONTRAIL_EXTERNAL") - when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable("tenantId")).thenReturn("7dd5365547234ee8937416c65507d266") - when(mockExecution.getVariable("failIfExists")).thenReturn("false") - when(mockExecution.getVariable("networkModelInfo")).thenReturn(networkModelInfo) - when(mockExecution.getVariable("serviceModelInfo")).thenReturn(serviceModelInfo) - when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") - when(mockExecution.getVariable("action")).thenReturn("CREATE") - when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("MSO-dev-service-type") - when(mockExecution.getVariable("globalSubscriberId")).thenReturn("globalId_45678905678") - - when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - - when(mockExecution.getVariable("URN_mso_rollback")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_adapters_sdnc_endpoint")).thenReturn("http://localhost:8090/SDNCAdapter") - when(mockExecution.getVariable("URN_mso_adapters_network_rest_endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter") - when(mockExecution.getVariable("URN_mso_adapters_sdnc_resource_endpoint")).thenReturn("http://localhost:8090/SDNCAdapterRpc") - - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.preProcessRequest(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - //verify variable initialization - initializeVariables(mockExecution) - - verify(mockExecution).setVariable("action", "CREATE") - verify(mockExecution).setVariable(Prefix + "networkId","") - verify(mockExecution).setVariable(Prefix + "networkRequest", expectedvIPRNetworkRequest) - verify(mockExecution, atLeast(1)).setVariable(Prefix + "rollbackEnabled", false) - verify(mockExecution).setVariable(Prefix + "networkInputs", expectedvIPRNetworkInputs) - //verify(mockExecution).setVariable(Prefix + "requestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //verify(mockExecution).setVariable("mso-service-instance-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - verify(mockExecution).setVariable(Prefix + "messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - verify(mockExecution).setVariable(Prefix + "source", "VID") - verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable(Prefix + "serviceInstanceId","f70e927b-6087-4974-9ef8-c5e4d5847ca4") - verify(mockExecution, atLeast(1)).setVariable("GENGS_type", "service-instance") - //verify(mockExecution, atLeast(1)).setVariable("mso-request-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //verify(mockExecution, atLeast(1)).setVariable("msoRequestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //verify(mockExecution).setVariable("mso-service-instance-id","88f65519-9a38-4c4b-8445-9eb4a5a5af56") - verify(mockExecution).setVariable(Prefix + "networkId","") - verify(mockExecution).setVariable(Prefix + "networkOutputs", networkvIPROutputs) - verify(mockExecution).setVariable(Prefix + "networkName","") - - } - - @Test - //@Ignore - public void preProcessRequest_JSON_NetworkRequest() { - - println "************ preProcessRequest_Payload ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - - // Pre-defined value, testing Only - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - // Inputs: - // when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("requestAction")).thenReturn("CREATE") - when(mockExecution.getVariable("networkId")).thenReturn("networkId") // optional - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) // JSON format - when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") // 1610 default - when(mockExecution.getVariable("disableRollback")).thenReturn(true) - - when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - - when(mockExecution.getVariable("URN_mso_rollback")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_adapters_sdnc_endpoint")).thenReturn("http://localhost:8090/SDNCAdapter") - when(mockExecution.getVariable("URN_mso_adapters_network_rest_endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter") - when(mockExecution.getVariable("URN_mso_adapters_sdnc_resource_endpoint")).thenReturn("http://localhost:8090/SDNCAdapterRpc") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.preProcessRequest(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - //verify variable initialization - initializeVariables(mockExecution) - - verify(mockExecution).setVariable("action", "CREATE") - verify(mockExecution).setVariable(Prefix + "networkRequest", expectedJSONNetworkRequest) - verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) - verify(mockExecution).setVariable(Prefix + "networkInputs", expectedJSONNetworkInputs) - //verify(mockExecution).setVariable(Prefix + "requestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //verify(mockExecution).setVariable(Prefix + "messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - verify(mockExecution).setVariable(Prefix + "source", "VID") - verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable(Prefix + "serviceInstanceId","f70e927b-6087-4974-9ef8-c5e4d5847ca4") - verify(mockExecution, atLeast(1)).setVariable("GENGS_type", "service-instance") - //verify(mockExecution, atLeast(1)).setVariable("msoRequestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //verify(mockExecution).setVariable("mso-service-instance-id","88f65519-9a38-4c4b-8445-9eb4a5a5af56") - verify(mockExecution).setVariable(Prefix + "networkId","") - verify(mockExecution).setVariable(Prefix + "networkOutputs", networkJSONOutputs) - verify(mockExecution).setVariable(Prefix + "networkName","") - - - } - - @Test - @Ignore // 1802 merge - public void preProcessRequest_XML_NetworkRequest() { - - println "************ preProcessRequest_Payload ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - - // Pre-defined value, testing Only - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - // Inputs: - // when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("bpmnRequest")).thenReturn(xmlIncomingRequest) // XML format - - when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - - when(mockExecution.getVariable("URN_mso_rollback")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_adapters_sdnc_endpoint")).thenReturn("http://localhost:8090/SDNCAdapter") - when(mockExecution.getVariable("URN_mso_adapters_network_rest_endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter") - when(mockExecution.getVariable("URN_mso_adapters_sdnc_resource_endpoint")).thenReturn("http://localhost:8090/SDNCAdapterRpc") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.preProcessRequest(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - //verify variable initialization - initializeVariables(mockExecution) - - verify(mockExecution).setVariable(Prefix + "networkRequest", expectedXMLNetworkRequest) - verify(mockExecution).setVariable("action", "CREATE") - verify(mockExecution).setVariable(Prefix + "rollbackEnabled", true) - verify(mockExecution).setVariable(Prefix + "networkInputs", expectedXMLNetworkInputs) - //verify(mockExecution).setVariable(Prefix + "requestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - verify(mockExecution).setVariable(Prefix + "messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - verify(mockExecution).setVariable(Prefix + "source", "PORTAL") - verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable(Prefix + "serviceInstanceId","MNS-25180-L-01-dmz_direct_net_1") - verify(mockExecution, atLeast(1)).setVariable("GENGS_type", "service-instance") - //verify(mockExecution).setVariable("mso-service-instance-id","88f65519-9a38-4c4b-8445-9eb4a5a5af56") - verify(mockExecution, atLeast(1)).setVariable(Prefix + "networkId","") - verify(mockExecution).setVariable(Prefix + "networkOutputs", networkXMLOutputs) - verify(mockExecution).setVariable(Prefix + "networkName","") - - } - - - - @Test - //@Ignore - public void prepareCreateNetworkRequest() { - - println "************ prepareNetworkRequest ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) - when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") - when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") - //when(mockExecution.getVariable(Prefix + "queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) - when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("13979:10575713979:105757") - when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("GN_EVPN_Test") - when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("refFQDN1refFQDN2") - when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.prepareCreateNetworkRequest(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix) - - verify(mockExecution).setVariable(Prefix + "createNetworkRequest", createNetworkRequest) - - } - - - @Test - //@Ignore - public void prepareCreateNetworkRequest_Ipv4() { - - println "************ prepareNetworkRequest ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) - when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse_Ipv4) - when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") - when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") - //when(mockExecution.getVariable(Prefix + "queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) - when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("13979:10575713979:105757") - when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("GN_EVPN_Test") - when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("refFQDN1refFQDN2") - when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.prepareCreateNetworkRequest(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix) - - verify(mockExecution).setVariable(Prefix + "createNetworkRequest", createNetworkRequest_Ipv4) - - } - - @Test - //@Ignore - public void prepareCreateNetworkRequest_AlaCarte() { - - println "************ prepareNetworkRequest ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedJSONNetworkRequest) - when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse_AlaCarte) - when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") - when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") - //when(mockExecution.getVariable(Prefix + "queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) - when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("13979:10575713979:105757") - when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("GN_EVPN_Test") - when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("refFQDN1refFQDN2") - when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.prepareCreateNetworkRequest(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix) - - verify(mockExecution).setVariable(Prefix + "createNetworkRequest", createNetworkRequestAlaCarte) - - } - - @Test - //@Ignore - public void prepareCreateNetworkRequest_SRIOV() { - - println "************ prepareNetworkRequest ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) - when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse_SRIOV) - when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") - when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") - //when(mockExecution.getVariable(Prefix + "queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) - when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("13979:10575713979:105757") - when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("GN_EVPN_Test") - when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("refFQDN1refFQDN2") - when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.prepareCreateNetworkRequest(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix) - - verify(mockExecution).setVariable(Prefix + "createNetworkRequest", createNetworkRequest_SRIOV) - - } - - - @Test - //@Ignore - public void prepareSDNCRequest() { - - println "************ prepareSDNCRequest ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) - when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("networkId") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") - - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.prepareSDNCRequest(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "assignSDNCRequest", assignSDNCRequest) - - } - - @Test - //@Ignore - public void prepareSDNCRequest_decodeUrlLink() { - - println "************ prepareSDNCRequest ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) - when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("networkId") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/VIRTUAL%20USP/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") - - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.prepareSDNCRequest(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "assignSDNCRequest", assignSDNCRequest_decodeUrlLink) - - } - - @Test - //@Ignore - public void prepareRpcSDNCRequest() { - - println "************ prepareRpcSDNCRequest ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) - when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") // test ONLY - when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("networkId") - when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.prepareRpcSDNCRequest(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "assignSDNCRequest", assignRpcSDNCRequest) - - } - - @Test - //@Ignore - public void prepareSDNCRollbackRequest() { - - println "************ prepareSDNCRollbackRequest ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) - when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable(Prefix + "assignSDNCResponse")).thenReturn(assignResponse) - when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("8abc633a-810b-4ca5-8b3a-09511d13a2ce") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.prepareSDNCRollbackRequest(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", sdncRollbackRequest) - - } - - @Test - //@Ignore - public void prepareRpcSDNCActivateRequest() { - - println "************ prepareRpcSDNCActivateRequest ************* " - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) - when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("networkId") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") // test ONLY - when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.prepareRpcSDNCActivateRequest(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "activateSDNCRequest", activateSDNCRequest) - - } - - - @Test - //@Ignore - public void prepareRpcSDNCRollbackRequest() { - - println "************ prepareRpcSDNCRollbackRequest ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) - when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable(Prefix + "assignSDNCResponse")).thenReturn(assignResponse) - when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("8abc633a-810b-4ca5-8b3a-09511d13a2ce") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") // test ONLY - when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.prepareRpcSDNCRollbackRequest(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", sdncRpcRollbackRequest) - - } - - @Test - //@Ignore - public void prepareRpcSDNCActivateRollback() { - - println "************ prepareRpcSDNCActivateRollback ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) - when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable(Prefix + "activateSDNCResponse")).thenReturn(assignResponse) - when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("8abc633a-810b-4ca5-8b3a-09511d13a2ce") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") // test ONLY - when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.prepareRpcSDNCActivateRollback(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix) - //verify(mockExecution).setVariable("mso-request-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //verify(mockExecution).setVariable(Prefix + "requestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //verify(mockExecution).setVariable("mso-service-instance-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - verify(mockExecution).setVariable(Prefix + "rollbackActivateSDNCRequest", sdncActivateRollbackRequest) - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkName_200() { - - println "************ callRESTQueryAAINetworkName ************* " - - WireMock.reset(); - MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(networkInputs) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_network_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") - when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.callRESTQueryAAINetworkName(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "queryNameAAIRequest", "http://localhost:8090/aai/v8/network/l3-networks/l3-network?network-name=MNS-25180-L-01-dmz_direct_net_1") - - verify(mockExecution).setVariable(Prefix + "aaiNameReturnCode", "200") - verify(mockExecution).setVariable(Prefix + "orchestrationStatus", "PENDING-CREATE") - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkName_404() { - - println "************ callRESTQueryAAINetworkName ************* " - - WireMock.reset(); - MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(networkInputs_404) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_network_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") - when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.callRESTQueryAAINetworkName(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "queryNameAAIRequest", "http://localhost:8090/aai/v8/network/l3-networks/l3-network?network-name=myOwn_Network") - verify(mockExecution).setVariable(Prefix + "aaiNameReturnCode", "404") - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkId_200() { - - println "************ callRESTQueryAAINetworkId ************* " - - WireMock.reset(); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "assignSDNCResponse")).thenReturn(sdncAdapterWorkflowAssignResponse) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_network_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") - when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_l3_network_uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.callRESTQueryAAINetworkId(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "queryIdAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") - verify(mockExecution).setVariable(Prefix + "aaiIdReturnCode", "200") - - } - - @Test - //@Ignore - public void callRESTQueryAAICloudRegion30_200() { - - println "************ callRESTQueryAAICloudRegion30_200 ************* " - - WireMock.reset(); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn(Prefix) - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedvIPRNetworkRequest) - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("URN_mso_workflow_default_aai_cloud_infrastructure_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") - // - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "queryCloudRegionRequest", "http://localhost:8090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200") - verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) - - } - - @Test - //@Ignore - public void callRESTQueryAAICloudRegion25_200() { - - println "************ callRESTQueryAAICloudRegion25_200 ************* " - - WireMock.reset(); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn(Prefix) - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedvIPRNetworkRequest) - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("URN_mso_workflow_default_aai_cloud_infrastructure_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") - // - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "queryCloudRegionRequest", "http://localhost:8090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200") - verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) - - } - - @Test - //@Ignore - public void callRESTQueryAAICloudRegion_NotFound() { - - println "************ callRESTQueryAAICloudRegionFake ************* " - - WireMock.reset(); - MockGetNetworkCloudRegion_404("MDTWNJ21") - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn(Prefix) - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestFakeRegion) - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - //old: when(mockExecution.getVariable("URN_mso_workflow_default_aai_cloud_infrastructure_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") - // - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "queryCloudRegionRequest", "http://localhost:8090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/MDTWNJ21") - verify(mockExecution, atLeast(1)).setVariable(Prefix + "queryCloudRegionReturnCode", "404") - verify(mockExecution).setVariable(Prefix + "cloudRegionPo", "MDTWNJ21") - verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc", "AAIAIC25") - verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBinding_200() { - - println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " - - WireMock.reset(); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse) // v6 - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("URN_mso_workflow_default_aai_network_vpn-binding_uri")).thenReturn("") - // old: when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_network_vpn-binding_uri")).thenReturn("") - when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_vpn_binding_uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "vpnCount", 2) - verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBindingList_200() { - - println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " - - WireMock.reset(); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBindingList_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBindingList_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse) // v6 - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_vpn_binding_uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "vpnCount", 2) - verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBinding_TestScenario01_200() { - - println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " - - WireMock.reset(); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponseTestScenario01) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("URN_mso_workflow_default_aai_network_vpn-binding_uri")).thenReturn("") - // old: when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_network_vpn-binding_uri")).thenReturn("") - when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_vpn_binding_uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "vpnCount", 1) - verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") - verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBinding_200_URN_Uri() { - - println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " - - WireMock.reset(); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - //when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_network_vpn_binding_uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - //when(mockExecution.getVariable("URN_mso_workflow_default_aai_network_vpn_binding_uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vpn_binding_uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "vpnCount", 2) - verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBinding_NotPresent() { - - println "************ callRESTQueryAAINetworkVpnBinding_NotPresent ************* " - - WireMock.reset(); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - - when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponseVpnNotPresent) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - //when(mockExecution.getVariable("URN_mso_workflow_default_aai_network_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") - verify(mockExecution).setVariable(Prefix + "vpnCount", 0) - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIResponse", aaiVpnResponseStub) - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkPolicy_200() { - - println "************ callRESTQueryAAINetworkPolicy_200 ************* " - - WireMock.reset(); - MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - //when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_network_policy_uri")).thenReturn("") - // old: when(mockExecution.getVariable("URN_mso_workflow_default_aai_network_policy_uri")).thenReturn("/aai/v8/network/network-policies/network-policy") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_network_policy_uri")).thenReturn("/aai/v8/network/network-policies/network-policy") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.callRESTQueryAAINetworkPolicy(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "networkPolicyCount", 1) - verify(mockExecution).setVariable(Prefix + "networkPolicyUriList", ['/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryNetworkPolicyAAIRequest", "http://localhost:8090/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg?depth=all") - verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "200") - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkTableRef_200() { - - println "************ callRESTQueryAAINetworkTableRef_200 ************* " - - WireMock.reset(); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_network_table_reference_uri")).thenReturn("") - // old: when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_network_table_reference_uri")).thenReturn("") - when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_route_table_reference_uri")).thenReturn("/aai/v8/network/route-table-references/route-table-reference") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.callRESTQueryAAINetworkTableRef(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "networkTableRefCount", 2) - verify(mockExecution).setVariable(Prefix + "networkTableRefUriList", ['/aai/v8/network/route-table-references/route-table-reference/refFQDN1','/aai/v8/network/route-table-references/route-table-reference/refFQDN2']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryNetworkTableRefAAIRequest", "http://localhost:8090/aai/v8/network/route-table-references/route-table-reference/refFQDN1?depth=all") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200") - - } - - @Test - //@Ignore - public void callRESTReQueryAAINetworkId_200() { - - println "************ callRESTReQueryAAINetworkId ************* " - - WireMock.reset(); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - //when(mockExecution.getVariable("URN_mso_workflow_default_aai_l3_network_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_l3_network_uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - //old: when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_network_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.callRESTReQueryAAINetworkId(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "requeryIdAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") - verify(mockExecution).setVariable(Prefix + "aaiRequeryIdReturnCode", "200") - - } - - @Test - //@Ignore - public void callRESTUpdateContrailAAINetworkREST_200() { - - println "************ callRESTUpdateContrailAAINetwork ************* " - - WireMock.reset(); - MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "createNetworkResponse")).thenReturn(createNetworkResponseREST) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_network_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") - when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_l3_network_uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("false") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.callRESTUpdateContrailAAINetwork(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "updateContrailAAIUrlRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") - verify(mockExecution).setVariable(Prefix + "updateContrailAAIPayloadRequest", updateContrailAAIPayloadRequest) - verify(mockExecution).setVariable(Prefix + "aaiUpdateContrailReturnCode", "200") - //verify(mockExecution).setVariable(Prefix + "updateContrailAAIResponse", updateContrailAAIResponse) - verify(mockExecution).setVariable(Prefix + "isPONR", true) - - } - - @Test - //@Ignore - public void callRESTUpdateContrailAAINetworkREST_200_segmentation() { - - println "************ callRESTUpdateContrailAAINetwork ************* " - - WireMock.reset(); - MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse_segmentation) - when(mockExecution.getVariable(Prefix + "createNetworkResponse")).thenReturn(createNetworkResponseREST) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_network_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") - when(mockExecution.getVariable("URN_mso_workflow_DoCreateNetworkInstance_aai_l3_network_uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("false") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.callRESTUpdateContrailAAINetwork(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "updateContrailAAIUrlRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") - verify(mockExecution).setVariable(Prefix + "updateContrailAAIPayloadRequest", updateContrailAAIPayloadRequest_segmentation) - verify(mockExecution).setVariable(Prefix + "aaiUpdateContrailReturnCode", "200") - //verify(mockExecution).setVariable(Prefix + "updateContrailAAIResponse", updateContrailAAIResponse) - verify(mockExecution).setVariable(Prefix + "isPONR", true) - - } - - - - @Test - //@Ignore - public void validateCreateNetworkResponseREST() { - - println "************ validateNetworkResponse ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "createNetworkResponse")).thenReturn(createNetworkResponseREST) - when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('200') - - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.validateCreateNetworkResponse(mockExecution) - - //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "createNetworkResponse", createNetworkResponseREST) - verify(mockExecution).setVariable(Prefix + "isNetworkRollbackNeeded", true) - verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", createRollbackNetworkRequest) - - } - - @Test - //@Ignore - public void validateCreateNetworkResponseREST_Error() { - - println "************ validateNetworkResponse ************* " - - WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "createNetworkResponse")).thenReturn(networkException500) - when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('500') - - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - try { - DoCreateNetworkInstance.validateCreateNetworkResponse(mockExecution) - } catch (Exception ex) { - println " Test End - Handle catch-throw BpmnError()! " - } - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution, atLeast(1)).setVariable("WorkflowException", refEq(workflowException, any(WorkflowException.class))) - - } - - @Test - //@Ignore - public void validateSDNCResponse() { - - println "************ validateSDNCResponse ************* " - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "assignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse) - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) - when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "isResponseGood")).thenReturn(true) - - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - try { - DoCreateNetworkInstance.validateSDNCResponse(mockExecution) - verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) - - } catch (Exception ex) { - println " Graceful Exit - " + ex.getMessage() - } - //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - //verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) - - } - - @Test - //@Ignore - public void validateSDNCResponse_Error() { - - println "************ validateSDNCResponse ************* " - - WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstance", 2500, "Received error from SNDC Adapter: HTTP Status 500.") - - //ExecutionEntity mockExecution = mock(ExecutionEntity.class) - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "assignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse_Error) - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(false) - when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") - when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) - - - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - try { - DoCreateNetworkInstance.validateSDNCResponse(mockExecution) - } catch (Exception ex) { - println " Graceful Exit! - " + ex.getMessage() - } - //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - // verify set prefix = Prefix + "" - //verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false) - - } - - @Test - //@Ignore - public void validateRpcSDNCActivateResponse() { - - println "************ validateRpcSDNCActivateResponse ************* " - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "activateSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse) - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) - when(mockExecution.getVariable(Prefix + "sdncActivateReturnCode")).thenReturn("200") - - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - try { - DoCreateNetworkInstance.validateRpcSDNCActivateResponse(mockExecution) - verify(mockExecution).setVariable(Prefix + "isSdncActivateRollbackNeeded", true) - - } catch (Exception ex) { - println " Graceful Exit - " + ex.getMessage() - } - //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - //verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) - - } - - @Test - //@Ignore - public void prepareRollbackData() { - - println "************ prepareRollbackData() ************* " - - - - WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn(rollbackSDNCRequest) - when(mockExecution.getVariable(Prefix + "rollbackActivateSDNCRequest")).thenReturn(rollbackActivateSDNCRequest) - when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(rollbackNetworkRequest) - when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.prepareRollbackData(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - } - - @Test - @Ignore - public void postProcessResponse() { - - println "************ postProcessResponse() ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "isException")).thenReturn(false) - when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") - when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn(sdncRpcRollbackRequest) - when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(rollbackSDNCRequest) - when(mockExecution.getVariable(Prefix + "rollbackActivateSDNCRequest")).thenReturn(sdncActivateRollbackRequest) - - - // preProcessRequest(DelegateExecution execution) - DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() - DoCreateNetworkInstance.postProcessResponse(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "Success", true) - - } - - private ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("DoCreateNetworkInstance") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateNetworkInstance") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateNetworkInstance") - when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateNetworkInstance") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - - return mockExecution - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy deleted file mode 100644 index 2d58c7af69..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy +++ /dev/null @@ -1,93 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import static org.junit.Assert.*; -import static org.mockito.Mockito.* - -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.mockito.ArgumentCaptor -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.openecomp.mso.bpmn.common.scripts.MsoGroovyTest -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.junit.Before -import org.junit.Ignore; -import org.junit.Test -import org.junit.runner.RunWith - - -@RunWith(MockitoJUnitRunner.class) -class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest { - - def String volumeRollbackRequest = """ - - - 171907d6-cdf0-4e08-953d-81ee104005a7 - {{VOLUMEGROUPSTACKID}} - mtwnj1a - c2141e3fcae940fcb4797ec9115e5a7a - true - - 230fd6ac-2a39-4be4-9b1e-7b7e1cc039b5 - 88c871d6-be09-4982-8490-96b1d243fb34 - - 9a5a91e8-3b79-463c-81c3-874a78f5b567 - - true - 9a5a91e8-3b79-463c-81c3-874a78f5b567 - http://msobpel-app-e2e.ecomp.cci.att.com:8080/mso/WorkflowMessage/VNFAResponse/9a5a91e8-3b79-463c-81c3-874a78f5b567 - - """ - - def String volumeRollbackRequestWithStackId = """ - - - 171907d6-cdf0-4e08-953d-81ee104005a7 - mdt22avrr_volume01/0f1aaae8-efe3-45ce-83e1-bfad01db58d8 - mtwnj1a - c2141e3fcae940fcb4797ec9115e5a7a - true - - 230fd6ac-2a39-4be4-9b1e-7b7e1cc039b5 - 88c871d6-be09-4982-8490-96b1d243fb34 - - 9a5a91e8-3b79-463c-81c3-874a78f5b567 - - true - 9a5a91e8-3b79-463c-81c3-874a78f5b567 - http://msobpel-app-e2e.ecomp.cci.att.com:8080/mso/WorkflowMessage/VNFAResponse/9a5a91e8-3b79-463c-81c3-874a78f5b567 - - """ - - - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - @Test - @Ignore // 1802 merge - public void testBuildRollbackVolumeGroupRequestXml() { - DoCreateVfModuleVolumeV2 process = new DoCreateVfModuleVolumeV2() - String xml = process.buildRollbackVolumeGroupRequestXml( - "171907d6-cdf0-4e08-953d-81ee104005a7", // volumeGroupId - "mtwnj1a", // cloudSiteId - "c2141e3fcae940fcb4797ec9115e5a7a", // tenantId - "230fd6ac-2a39-4be4-9b1e-7b7e1cc039b5", // requestId - "88c871d6-be09-4982-8490-96b1d243fb34", // serviceInstanceId - "9a5a91e8-3b79-463c-81c3-874a78f5b567", // messageId - "http://msobpel-app-e2e.ecomp.cci.att.com:8080/mso/WorkflowMessage/VNFAResponse/9a5a91e8-3b79-463c-81c3-874a78f5b567") // notificationUrl - - assertEquals(volumeRollbackRequest.replaceAll("\\s", ""), xml.replaceAll("\\s", "")) - } - - - @Test - public void testUpdateRollbackVolumeGroupRequestXml() { - DoCreateVfModuleVolumeV2 process = new DoCreateVfModuleVolumeV2() - String updatedXml = process.updateRollbackVolumeGroupRequestXml(volumeRollbackRequest, "mdt22avrr_volume01/0f1aaae8-efe3-45ce-83e1-bfad01db58d8") - assertEquals(volumeRollbackRequestWithStackId.replaceAll("\\s", ""), updatedXml.replaceAll("\\s", "")) - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy deleted file mode 100644 index c301b65c41..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy +++ /dev/null @@ -1,148 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.junit.Before -import org.junit.BeforeClass -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import org.mockito.MockitoAnnotations -import org.openecomp.mso.bpmn.mock.FileUtil -import org.openecomp.mso.bpmn.vcpe.scripts.GroovyTestBase - -import static org.assertj.core.api.Assertions.assertThatThrownBy -import static org.mockito.Matchers.anyString -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.when -import static org.mockito.Mockito.eq - -class DoCustomDeleteE2EServiceInstanceTest extends GroovyTestBase { - - private static String request - - @Rule - public WireMockRule wireMockRule = new WireMockRule(GroovyTestBase.PORT) - - String Prefix = "CVRCS_" - String RbType = "DCRENI_" - - @BeforeClass - public static void setUpBeforeClass() { - request = FileUtil.readResourceFile("__files/InfrastructureFlows/DeleteCustomE2EService.json") - } - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - public DoCustomDeleteE2EServiceInstanceTest(){ - super("DoCustomDeleteE2EServiceInstance") - } - - @Test - public void preProcessRequestTest(){ - - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - - DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() - instance.preProcessRequest(mex) - verify(mex).setVariable("sdncCallbackUrl", "/mso/sdncadapter/") - verify(mex).setVariable("siParamsXml", "") - } - - @Test - public void postProcessAAIGETSuccessTest(){ - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - when(mex.getVariable("GENGS_SuccessIndicator")).thenReturn(true) - - String aaiGetResponse = FileUtil.readResourceFile("__files/GenericFlows/aaiGetResponse.xml") - when(mex.getVariable("GENGS_service")).thenReturn(aaiGetResponse) - DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() - instance.postProcessAAIGET(mex) - - verify(mex).setVariable(eq("serviceRelationShip"), anyString()) - } - - @Test - public void postProcessAAIGETFailureTest(){ - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - when(mex.getVariable("GENGS_FoundIndicator")).thenReturn(false) - when(mex.getVariable("GENGS_SuccessIndicator")).thenReturn(false) - - DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() - assertThatThrownBy { instance.postProcessAAIGET(mex) } isInstanceOf BpmnError.class - } - - @Test - public void preInitResourcesOperStatusTest(){ - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - when(mex.getVariable("serviceRelationShip")).thenReturn("[{\"resourceInstanceId\":\"3333\",\"resourceType\":\"overlay\"},{\"resourceInstanceId\":\"4444\",\"resourceType\":\"underlay\"},{\"resourceInstanceId\":\"1111\",\"resourceType\":\"vIMS\"},{\"resourceInstanceId\":\"222\",\"resourceType\":\"vEPC\"}]") - DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() - instance.preInitResourcesOperStatus(mex) - - verify(mex).setVariable(eq("CVFMI_initResOperStatusRequest"), anyString()) - } - - @Test - public void preResourceDeleteTest() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - when(mex.getVariable("serviceRelationShip")).thenReturn("[{\"resourceInstanceId\":\"3333\",\"resourceType\":\"overlay\"},{\"resourceInstanceId\":\"4444\",\"resourceType\":\"underlay\"},{\"resourceInstanceId\":\"1111\",\"resourceType\":\"vIMS\"},{\"resourceInstanceId\":\"222\",\"resourceType\":\"vEPC\"}]") - DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() - instance.preResourceDelete(mex,"overlay") - verify(mex).setVariable("resourceType", "overlay") - } - - @Test - public void postProcessSDNCDeleteTest(){ - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn("true") - when(mex.getVariable("DDELSI_sdncResponseSuccess")).thenReturn("true") - when(mex.getVariable("prefix")).thenReturn("DDELSI_") - DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() - String response = FileUtil.readResourceFile("__files/GenericFlows/SDNCDeleteResponse.xml") - String method = "deleteE2E"; - instance.postProcessSDNCDelete(mex, response, method) - // following method doesn't do anything currently -> nothing to check - } - - @Test - public void postProcessAAIDELTest() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - when(mex.getVariable("GENDS_SuccessIndicator")).thenReturn("true") - DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() - instance.postProcessAAIDEL(mex) - } - - private void initPreProcess(ExecutionEntity mex) { - when(mex.getVariable(GroovyTestBase.DBGFLAG)).thenReturn("true") - when(mex.getVariable("bpmnRequest")).thenReturn(request) - when(mex.getVariable("mso-request-id")).thenReturn("mri") - when(mex.getVariable("serviceType")).thenReturn("VoLTE") - when(mex.getVariable("serviceInstanceId")).thenReturn("e151059a-d924-4629-845f-264db19e50b4") - when(mex.getVariable("requestAction")).thenReturn("ra") - when(mex.getVariable("operationId")).thenReturn("59960003992") - when(mex.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("/mso/sdncadapter/") - when(mex.getVariable("GENGS_FoundIndicator")).thenReturn("true") - when(mex.getVariable("GENGS_siResourceLink")).thenReturn("/service-subscription/e2eserviceInstance/delete/service-instances/") - when(mex.getVariable("globalSubscriberId")).thenReturn("4993921112123") - when(mex.getVariable("GENGS_service")).thenReturn("test3434") - when(mex.getVariable("URN_mso_adapters_openecomp_db_endpoint")).thenReturn("http://localhost:8080/mso") - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollbackTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollbackTest.groovy deleted file mode 100644 index 345ca1bc2c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollbackTest.groovy +++ /dev/null @@ -1,323 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import static org.mockito.Mockito.* - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.junit.Before -import org.junit.Rule; -import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith - -import static org.junit.Assert.*; - -import com.github.tomakehurst.wiremock.client.WireMock; -import com.github.tomakehurst.wiremock.junit.WireMockRule; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.apache.commons.lang3.* - - -@RunWith(MockitoJUnitRunner.class) -class DoDeleteNetworkInstanceRollbackTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(8090); - - def utils = new MsoUtils() - String Prefix="DELNWKIR_" - - - String rollbackNetworkRequest = - """ - - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - - CONTRAIL_EXTERNAL - true - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - - - -""" - - String rollbackDeActivateSDNCRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - activate - network-topology-operation - sdncCallback - generic-resource - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - CreateNetworkInstance - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - MSO_1610_dev - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - - invariant-uuid - customization-uuid - uuid - version - CONTRAIL_EXTERNAL - - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - -""" - - String rollbackSDNCRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - rollback - network-topology-operation - sdncCallback - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - CreateNetworkInstance - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - MSO_1610_dev - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - - invariant-uuid - customization-uuid - uuid - version - CONTRAIL_EXTERNAL - - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - -""" - -// - - - - - - - - - - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - - } - - public void initializeVariables (DelegateExecution mockExecution) { - - verify(mockExecution).setVariable(Prefix + "WorkflowException", null) - - verify(mockExecution).setVariable(Prefix + "rollbackDeactivateSDNCRequest", null) - verify(mockExecution).setVariable(Prefix + "rollbackDeactivateSDNCResponse", "") - verify(mockExecution).setVariable(Prefix + "rollbackDeactivateSDNCReturnCode", "") - - verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", null) - verify(mockExecution).setVariable(Prefix + "rollbackNetworkResponse", "") - verify(mockExecution).setVariable(Prefix + "rollbackNetworkReturnCode", "") - - verify(mockExecution).setVariable(Prefix + "Success", false) - verify(mockExecution).setVariable(Prefix + "fullRollback", false) - - } - - @Test - //@Ignore - public void preProcessRequest() { - - println "************ preProcessRequest ************* " - - WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") - Map rollbackData = new HashMap(); - rollbackData.put("rollbackDeactivateSDNCRequest", rollbackDeActivateSDNCRequest) - rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) - rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) - when(mockExecution.getVariable("rollbackData")).thenReturn(rollbackData) - when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") - - when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - - when(mockExecution.getVariable("URN_mso_adapters_sdnc_endpoint")).thenReturn("http://localhost:8090/SDNCAdapter") - when(mockExecution.getVariable("URN_mso_adapters_network_rest_endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter") - when(mockExecution.getVariable("URN_mso_adapters_sdnc_resource_endpoint")).thenReturn("http://localhost:8090/SDNCAdapterRpc") - - - // preProcessRequest(DelegateExecution execution) - DoDeleteNetworkInstanceRollback DoDeleteNetworkInstanceRollback = new DoDeleteNetworkInstanceRollback() - DoDeleteNetworkInstanceRollback.preProcessRequest(mockExecution) - - //verify variable initialization - initializeVariables(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - } - - - @Test - //@Ignore - public void validateRollbackResponses_Good() { - - WorkflowException workflowException = new WorkflowException("DoDeleteNetworkInstanceRollback", 2500, "AAI Update Contrail Failed. Error 404.") - WorkflowException expectedWorkflowException = new WorkflowException("DoDeleteNetworkInstanceRollback", 2500, "AAI Update Contrail Failed. Error 404. + SNDC deactivate rollback completed. + PO Network rollback completed. + SNDC unassign rollback completed.") - - println "************ validateRollbackResponses_Good() ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - - when(mockExecution.getVariable(Prefix + "rollbackDeactivateSDNCRequest")).thenReturn("Good") - when(mockExecution.getVariable(Prefix + "rollbackDeactivateSDNCReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "rollbackDeactivateSDNCResponse")).thenReturn("GoodResponse") - when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn("Good") - when(mockExecution.getVariable(Prefix + "rollbackNetworkReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "rollbackNetworkResponse")).thenReturn("GoodResponse") - when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn("Good") - when(mockExecution.getVariable(Prefix + "rollbackSDNCReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "rollbackSDNCResponse")).thenReturn("GoodResponse") - when(mockExecution.getVariable(Prefix + "WorkflowException")).thenReturn(workflowException) - when(mockExecution.getVariable(Prefix + "fullRollback")).thenReturn(false) - - DoDeleteNetworkInstanceRollback DoDeleteNetworkInstanceRollback = new DoDeleteNetworkInstanceRollback() - DoDeleteNetworkInstanceRollback.validateRollbackResponses(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) - verify(mockExecution, atLeast(1)).setVariable("rolledBack", true) - verify(mockExecution, atLeast(1)).setVariable("wasDeleted", true) - verify(mockExecution).setVariable("WorkflowException", refEq(expectedWorkflowException, any(WorkflowException.class))) - //verify(mockExecution).setVariable("WorkflowException", expectedWorkflowException) - } - - @Test - //@Ignore - public void validateRollbackResponses_FullRollback() { - - Map rollbackData = new HashMap(); - rollbackData.put("rollbackDeactivateSDNCRequest", rollbackDeActivateSDNCRequest) - rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) - rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) - - println "************ validateRollbackResponses_FullRollback() ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - - when(mockExecution.getVariable(Prefix + "rollbackDeactivateSDNCRequest")).thenReturn("Good") - when(mockExecution.getVariable(Prefix + "rollbackDeactivateSDNCReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "rollbackDeactivateSDNCResponse")).thenReturn("GoodResponse") - when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn("Good") - when(mockExecution.getVariable(Prefix + "rollbackNetworkReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "rollbackNetworkResponse")).thenReturn("GoodResponse") - when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn("Good") - when(mockExecution.getVariable(Prefix + "rollbackSDNCReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "rollbackSDNCResponse")).thenReturn("GoodResponse") - when(mockExecution.getVariable(Prefix + "WorkflowException")).thenReturn(null) - when(mockExecution.getVariable(Prefix + "fullRollback")).thenReturn(true) - when(mockExecution.getVariable("rollbackData")).thenReturn(rollbackData) - - DoDeleteNetworkInstanceRollback DoDeleteNetworkInstanceRollback = new DoDeleteNetworkInstanceRollback() - DoDeleteNetworkInstanceRollback.validateRollbackResponses(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) - verify(mockExecution, atLeast(1)).setVariable("rollbackSuccessful", true) - verify(mockExecution, atLeast(1)).setVariable("rollbackError", false) - - } - - - private ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("DoDeleteNetworkInstanceRollback") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoDeleteNetworkInstanceRollback") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("DoDeleteNetworkInstanceRollback") - when(mockExecution.getProcessInstanceId()).thenReturn("DoDeleteNetworkInstanceRollback") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - - return mockExecution - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy deleted file mode 100644 index d357444cfc..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy +++ /dev/null @@ -1,1929 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import static org.mockito.Mockito.* - -import static org.openecomp.mso.bpmn.mock.StubResponseNetworkAdapter.MockNetworkAdapter; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion_404; -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.junit.Before -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.core.WorkflowException - -import com.github.tomakehurst.wiremock.client.WireMock -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.apache.commons.lang3.* - - -@RunWith(MockitoJUnitRunner.class) -class DoDeleteNetworkInstanceTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(8090); - - def utils = new MsoUtils() - String Prefix="DELNWKI_" - - String incomingJsonRequest = - """{ "requestDetails": { - "modelInfo": { - "modelType": "network", - "modelCustomizationId": "f21df226-8093-48c3-be7e-0408fcda0422", - "modelName": "CONTRAIL_EXTERNAL", - "modelVersion": "1.0" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "RDM2WAGPLCP", - "tenantId": "7dd5365547234ee8937416c65507d266" - }, - "requestInfo": { - "instanceName": "HSL_direct_net_2", - "source": "VID", - "callbackUrl": "", - "suppressRollback": true, - "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", - "modelInfo": { - "modelType": "serviceT", - "modelId": "modelI", - "modelNameVersionId": "modelNameVersionI", - "modelName": "modleNam", - "modelVersion": "1" - } - } - } - ], - "requestParameters": { - "userParams": [] - } - }""" - - String expectedDoDeleteNetworkInstanceRequest = - """{ "requestDetails": { - "modelInfo": { - "modelType": "networkTyp", - "modelId": "modelId", - "modelNameVersionId": "modelNameVersionId", - "modelName": "CONTRAIL_EXTERNAL", - "modelVersion": "1" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "RDM2WAGPLCP", - "tenantId": "7dd5365547234ee8937416c65507d266" - }, - "requestInfo": { - "instanceName": "HSL_direct_net_2", - "source": "VID", - "callbackUrl": "", - "suppressRollback": true, - "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", - "modelInfo": { - "modelType": "serviceT", - "modelId": "modelI", - "modelNameVersionId": "modelNameVersionI", - "modelName": "modleNam", - "modelVersion": "1" - } - } - } - ], - "requestParameters": { - "userParams": [] - } - }""" - - // expectedVnfRequest - String expectedNetworkRequest = -""" - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - DELETE - VID - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_EXTERNAL - f21df226-8093-48c3-be7e-0408fcda0422 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - 1610 - - -""" - - String expectedVperNetworkRequest = -""" - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - DELETE - VID - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - MSO-dev-service-type - globalId_45678905678 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - false - - CONTRAIL_EXTERNAL - sn5256d1-5a33-55df-13ab-12abad84e111 - sn5256d1-5a33-55df-13ab-12abad84e764 - 1 - sn5256d1-5a33-55df-13ab-12abad84e222 - - - - - - - - - 1702 - - -""" - - String expected_networkInput = - """ - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_EXTERNAL - f21df226-8093-48c3-be7e-0408fcda0422 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - 1610 -""" - - String expectedVper_networkInput = -""" - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - MSO-dev-service-type - globalId_45678905678 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - false - - CONTRAIL_EXTERNAL - sn5256d1-5a33-55df-13ab-12abad84e111 - sn5256d1-5a33-55df-13ab-12abad84e764 - 1 - sn5256d1-5a33-55df-13ab-12abad84e222 - - - - - - - - - 1702 -""" - -// emptyRegionVnfRequest -String emptyRegionVnfRequest = -""" - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - DELETE - PORTAL - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_BASIC - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - - e81d842d3e8b45c5a59f57cd76af3aaf - - - 0 - -""" - -String vnfRequestCloudRegionNotFound = -""" - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - DELETE - PORTAL - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_BASIC - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MDTWNJ21 - e81d842d3e8b45c5a59f57cd76af3aaf - - - 0 - -""" - - String vnfPayload = - """ - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - DELETE - PORTAL - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_BASIC - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - RDM2WAGPLCP - e81d842d3e8b45c5a59f57cd76af3aaf - - - 0 - - -""" - - String vnfPayload_MissingId = -""" - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - DELETE - PORTAL - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - - CONTRAIL_BASIC - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - RDM2WAGPLCP - e81d842d3e8b45c5a59f57cd76af3aaf - - - 0 - - -""" - - String vnfRequestRESTPayload = -""" - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - DELETE - PORTAL - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_BASIC - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - RDM2WAGPLCP - e81d842d3e8b45c5a59f57cd76af3aaf - - - id - name - - - 0 - - """ - - -String incomingRequestMissingCloudRegion = -"""{ "requestDetails": { - "modelInfo": { - "modelType": "network", - "modelCustomizationId": "f21df226-8093-48c3-be7e-0408fcda0422", - "modelName": "CONTRAIL_EXTERNAL", - "modelVersion": "1.0" - }, - "cloudConfiguration": { - "tenantId": "7dd5365547234ee8937416c65507d266" - }, - "requestInfo": { - "instanceName": "HSL_direct_net_2", - "source": "VID", - "callbackUrl": "", - "suppressRollback": true, - "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", - "modelInfo": { - "modelType": "serviceT", - "modelId": "modelI", - "modelNameVersionId": "modelNameVersionI", - "modelName": "modleNam", - "modelVersion": "1" - } - } - } - ], - "requestParameters": { - "userParams": [] - } - }""" - - String expectedNetworkRequestMissingId = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - DELETE - VID - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - - - HSL_direct_net_2 - CONTRAIL_EXTERNAL - f21df226-8093-48c3-be7e-0408fcda0422 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - 1610 - - -""" - -String expectedNetworkRequestMissingCloudRegion = -""" - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - DELETE - VID - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_EXTERNAL - f21df226-8093-48c3-be7e-0408fcda0422 - null - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - 1610 - - -""" - - // vnfRESTRequest - String vnfRESTRequest = -""" - - - - DELETE - VID - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_EXTERNAL - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - true - - - - - - -""" - - String networkInputs = - """ - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_BASIC - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - RDM2WAGPLCP - e81d842d3e8b45c5a59f57cd76af3aaf -""" - -String networkInputsNoType = -""" - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - RDM2WAGPLCP - e81d842d3e8b45c5a59f57cd76af3aaf -""" - - String networkInputsMissingId = - """ - - HSL_direct_net_2 - CONTRAIL_EXTERNAL - f21df226-8093-48c3-be7e-0408fcda0422 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - 1610 -""" - -String networkInputsMissingCloudRegion = -""" - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_EXTERNAL - f21df226-8093-48c3-be7e-0408fcda0422 - null - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - 1610 -""" - - String MissingIdFault = "Invalid value or missing network-id element" - String MissingRegionFault = "Invalid value or missing 'aic-cloud-region' element" - - String invalidWorkflowException = """ - Invalid value of network-id element - 2500 - """ - - - String queryAAIResponse = - """ - - - - - - - - - - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_BASIC - HSL_direct - contrail - 8bbd3edf-b835-4610-96a2-a5cafa029042 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - active - HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 - - - ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a - 5a77fdc2-7789-4649-a1b9-6eaf1db1813a - 172.16.34.1 - 172.16.34.0 - 28 - 4 - active - true - - - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v3/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ - - tenant.tenant-id - e81d842d3e8b45c5a59f57cd76af3aaf - - - - - -""" - - String deleteNetworkRequest = - """ - - - - RDM2WAGPLCP - e81d842d3e8b45c5a59f57cd76af3aaf - CONTRAIL_BASIC - HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - 0 - - - -""" - -String deleteNetworkRESTRequest = -""" - RDM2WAGPLCP - e81d842d3e8b45c5a59f57cd76af3aaf - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 - CONTRAIL_BASIC - sn5256d1-5a33-55df-13ab-12abad84e222 - true - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - messageId_value - -""" - -String deleteNetworkRESTRequestAlaCarte = -""" - RDM2WAGPLCP - e81d842d3e8b45c5a59f57cd76af3aaf - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 - CONTRAIL_BASIC - f21df226-8093-48c3-be7e-0408fcda0422 - true - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - messageId_value - -""" - - String deleteNetworkResponse_noRollback = -""" - true - -""" - - String deleteNetworkResponse = - """ - true - - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - - CONTRAIL_EXTERNAL - true - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - - - - """ - - String deleteRollbackNetworkRequest = - """ - - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - - CONTRAIL_EXTERNAL - true - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - - - -""" - - String deleteNetworkResponseFalseCompletion = - """ - false - """ - - String deleteNetworkErrorResponse = - """ - -680bd458-5ec1-4a16-b77c-509022e53450INTERNAL -400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data -true - -""" - - String deleteNetworkWorkflowException = - """ - Received error from Network Adapter: 400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data - 7020 - """ - -String aaiWorkflowException = -""" - Bpmn error encountered in DoDeleteNetworkInstance flow. Unexpected Response from AAI Adapter - org.apache.http.conn.HttpHostConnectException: Connect to localhost:8090 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect - 2500 - """ - - String aaiResponse = - """ - - - - - - - - - - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_BASIC - HSL_direct - contrail - 8bbd3edf-b835-4610-96a2-a5cafa029042 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - active - HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 - - - ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a - 5a77fdc2-7789-4649-a1b9-6eaf1db1813a - 172.16.34.1 - 172.16.34.0 - 28 - 4 - active - true - - - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ - - tenant.tenant-id - e81d842d3e8b45c5a59f57cd76af3aaf - - - - cloud-region - cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP/ - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - RDM2WAGPLCP - - - - - -""" - -String aaiResponseWithRelationship = -""" - - - - - - - - - - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_BASIC - HSL_direct - contrail - 8bbd3edf-b835-4610-96a2-a5cafa029042 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - active - HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 - - - ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a - 5a77fdc2-7789-4649-a1b9-6eaf1db1813a - 172.16.34.1 - 172.16.34.0 - 28 - 4 - active - true - - - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ - - tenant.tenant-id - e81d842d3e8b45c5a59f57cd76af3aaf - - - - vf-module - https://aai-app-e2e.ecomp.cci.com:8443/aai/v8/network/generic-vnfs/generic-vnf/105df7e5-0b3b-49f7-a837-4864b62827c4/vf-modules/vf-module/d9217058-95a0-49ee-b9a9-949259e89349/ - - generic-vnf.vnf-id - 105df7e5-0b3b-49f7-a837-4864b62827c4 - - - vf-module.vf-module-id - d9217058-95a0-49ee-b9a9-949259e89349 - - - - generic-vnf - https://aai-app-e2e.test.com:8443/aai/v8/network/generic-vnfs/generic-vnf/45f822d9-73ca-4255-9844-7cef401bbf47/ - - generic-vnf.vnf-id - 45f822d9-73ca-4255-9844-7cef401bbf47 - - - generic-vnf.vnf-name - zrdm1scpx05 - - - - - -""" - - String deleteSDNCRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - delete - network-topology-operation - sdncCallback - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - DisconnectNetworkRequest - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - CONTRAIL_BASIC - HSL_direct_net_2 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - -""" - - String deleteRpcSDNCRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - unassign - network-topology-operation - sdncCallback - generic-resource - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - DeleteNetworkInstance - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - - fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 - 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 - 1.0 - HNGW Protected OAM - - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - globalId_45678905678 - - - - networkId - CONTRAIL_EXTERNAL - - sn5256d1-5a33-55df-13ab-12abad84e764 - sn5256d1-5a33-55df-13ab-12abad84e222 - sn5256d1-5a33-55df-13ab-12abad84e111 - 1 - CONTRAIL_EXTERNAL - - - - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - - - -""" - - String sdncAdapaterDeactivateRollback = -""" - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - activate - network-topology-operation - sdncCallback - generic-resource - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - CreateNetworkInstance - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - - fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 - 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 - 1.0 - HNGW Protected OAM - - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - globalId_45678905678 - - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - CONTRAIL_EXTERNAL - - sn5256d1-5a33-55df-13ab-12abad84e764 - sn5256d1-5a33-55df-13ab-12abad84e222 - sn5256d1-5a33-55df-13ab-12abad84e111 - 1 - CONTRAIL_EXTERNAL - - - - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - - - -""" - String sdncAdapterWorkflowResponse = - """ - - - 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 - 200 - OK - - <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> - - """ - - String sdncAdapterWorkflowResponse_404 = - """ - <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>00703dc8-71ff-442d-a4a8-3adc5beef6a9</svc-request-id><response-code>404</response-code><response-message>Service instance not found in config tree</response-message><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>MNS-25180-L-01-dmz_direct_net_1</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> -""" - - String expected_sdncAdapterWorkflowFormattedResponse_404 = -""" - - - 00703dc8-71ff-442d-a4a8-3adc5beef6a9 - 404 - Service instance not found in config tree - Y - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MNS-25180-L-01-dmz_direct_net_1 - notsurewecare - - - -""" - - String sdncAdapterWorkflowFormattedResponse = - """ - - - 19174929-3809-49ca-89eb-17f84a035389 - 200 - Y - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - HSL_direct_net_2 - notsurewecare - - - -""" - -String sdncAdapterWorkflowFormattedResponse_404 = -""" - - - 00703dc8-71ff-442d-a4a8-3adc5beef6a9 - 404 - Service instance not found in config tree - Y - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MNS-25180-L-01-dmz_direct_net_1 - notsurewecare - - - -""" - - String invalidRequest = "Invalid value of network-id element" - - - - String sndcWorkflowException = - """ - Received error from SDN-C: No availability zone available - 5300 - 200 -""" - - String sndcWorkflowErrorResponse = - """ - Received error from SDN-C: - <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>00703dc8-71ff-442d-a4a8-3adc5beef6a9</svc-request-id><response-code>404</response-code><response-message>Service instance not found in config tree</response-message><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>MNS-25180-L-01-dmz_direct_net_1</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> - - 5300 - """ - - String unexpectedErrorEncountered = - """ - bpel error deleting network - 5300 - """ - - - // expectedVnfRequest - String inputViprSDC_NetworkRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - DELETE - VID - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - - networkId - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - MSO-dev-service-type - globalId_45678905678 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - false - - CONTRAIL_EXTERNAL - sn5256d1-5a33-55df-13ab-12abad84e111 - sn5256d1-5a33-55df-13ab-12abad84e764 - 1 - sn5256d1-5a33-55df-13ab-12abad84e222 - CONTRAIL_EXTERNAL - - - HNGW Protected OAM - 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 - fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 - 1.0 - - service - - 1702 - - -""" -// - - - - - - - - - - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - @Test - //@Ignore - public void preProcessRequest_Json() { - - println "************ preProcessRequest_Payload ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) - when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) - when(mockExecution.getVariable("requestAction")).thenReturn("DELETE") - when(mockExecution.getVariable("networkId")).thenReturn("bdc5efe8-404a-409b-85f6-0dcc9eebae30") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("vnfId")).thenReturn("") - when(mockExecution.getVariable("volumeGroupId")).thenReturn("") - //when(mockExecution.getVariable("networkId")).thenReturn("") - when(mockExecution.getVariable("serviceType")).thenReturn("MOG") - when(mockExecution.getVariable("networkType")).thenReturn("modelName") - when(mockExecution.getVariable("bpmnRequest")).thenReturn(incomingJsonRequest) - when(mockExecution.getVariable("disableRollback")).thenReturn(true) - when(mockExecution.getVariable("testMessageId")).thenReturn("7df689f9-7b93-430b-9b9e-28140d70cc7ad") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("mso-service-instance-id")).thenReturn("FH/VLXM/003717//SW_INTERNET") - when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_rollback")).thenReturn("true") - when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") - - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.preProcessRequest(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - //verify variable initialization - initializeVariables(mockExecution) - - verify(mockExecution).setVariable("action", "DELETE") - verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequest) - - verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) - - verify(mockExecution).setVariable(Prefix + "networkInputs", expected_networkInput) - verify(mockExecution).setVariable(Prefix + "messageId", "7df689f9-7b93-430b-9b9e-28140d70cc7ad") - verify(mockExecution).setVariable(Prefix + "source", "VID") - - // Authentications - verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") - - - } - - @Test - //@Ignore - public void preProcessRequest_vPER() { - - def networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111", - "modelName": "CONTRAIL_EXTERNAL", - "modelType": "CONTRAIL_EXTERNAL", - "modelVersion": "1", - "modelCustomizationUuid": "sn5256d1-5a33-55df-13ab-12abad84e222", - "modelInvariantUuid": "sn5256d1-5a33-55df-13ab-12abad84e764" - }""".trim() - - println "************ preProcessRequest_Payload ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - // Inputs: - when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("disableRollback")).thenReturn("true") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("networkId")).thenReturn("bdc5efe8-404a-409b-85f6-0dcc9eebae30") // optional - when(mockExecution.getVariable("networkName")).thenReturn("MNS-25180-L-01-dmz_direct_net_1") // optional - when(mockExecution.getVariable("productFamilyId")).thenReturn("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") - when(mockExecution.getVariable("networkModelInfo")).thenReturn("CONTRAIL_EXTERNAL") - when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable("tenantId")).thenReturn("7dd5365547234ee8937416c65507d266") - when(mockExecution.getVariable("failIfExists")).thenReturn("false") - when(mockExecution.getVariable("networkModelInfo")).thenReturn(networkModelInfo) - when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") - when(mockExecution.getVariable("action")).thenReturn("DELETE") - when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("MSO-dev-service-type") - when(mockExecution.getVariable("globalSubscriberId")).thenReturn("globalId_45678905678") - when(mockExecution.getVariable("testMessageId")).thenReturn("7df689f9-7b93-430b-9b9e-28140d70cc7ad") - - when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.preProcessRequest(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - //verify variable initialization - initializeVariables(mockExecution) - - verify(mockExecution).setVariable("action", "DELETE") - verify(mockExecution).setVariable(Prefix + "networkRequest", expectedVperNetworkRequest) - - verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) - - verify(mockExecution).setVariable(Prefix + "networkInputs", expectedVper_networkInput) - verify(mockExecution).setVariable(Prefix + "messageId", "7df689f9-7b93-430b-9b9e-28140d70cc7ad") - verify(mockExecution).setVariable(Prefix + "source", "VID") - - // Authentications - verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") - - - } - - public void initializeVariables (DelegateExecution mockExecution) { - - verify(mockExecution).setVariable(Prefix + "networkRequest", "") - verify(mockExecution).setVariable(Prefix + "isSilentSuccess", false) - verify(mockExecution).setVariable(Prefix + "Success", false) - - verify(mockExecution).setVariable(Prefix + "requestId", "") - verify(mockExecution).setVariable(Prefix + "source", "") - verify(mockExecution).setVariable(Prefix + "lcpCloudRegion", "") - verify(mockExecution).setVariable(Prefix + "networkInputs", "") - verify(mockExecution).setVariable(Prefix + "tenantId", "") - - verify(mockExecution).setVariable(Prefix + "queryAAIRequest","") - verify(mockExecution).setVariable(Prefix + "queryAAIResponse", "") - verify(mockExecution).setVariable(Prefix + "aaiReturnCode", "") - verify(mockExecution).setVariable(Prefix + "isAAIGood", false) - verify(mockExecution).setVariable(Prefix + "isVfRelationshipExist", false) - - // AAI query Cloud Region - verify(mockExecution).setVariable(Prefix + "queryCloudRegionRequest","") - verify(mockExecution).setVariable(Prefix + "queryCloudRegionReturnCode","") - verify(mockExecution).setVariable(Prefix + "queryCloudRegionResponse","") - verify(mockExecution).setVariable(Prefix + "cloudRegionPo","") - verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc","") - - verify(mockExecution).setVariable(Prefix + "deleteNetworkRequest", "") - verify(mockExecution).setVariable(Prefix + "deleteNetworkResponse", "") - verify(mockExecution).setVariable(Prefix + "networkReturnCode", "") - verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", "") - - verify(mockExecution).setVariable(Prefix + "deleteSDNCRequest", "") - verify(mockExecution).setVariable(Prefix + "deleteSDNCResponse", "") - verify(mockExecution).setVariable(Prefix + "sdncReturnCode", "") - verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false) - - verify(mockExecution).setVariable(Prefix + "deactivateSDNCRequest", "") - verify(mockExecution).setVariable(Prefix + "deactivateSDNCResponse", "") - verify(mockExecution).setVariable(Prefix + "deactivateSdncReturnCode", "") - verify(mockExecution).setVariable(Prefix + "isSdncDeactivateRollbackNeeded", "") - - verify(mockExecution).setVariable(Prefix + "rollbackDeactivateSDNCRequest", "") - verify(mockExecution).setVariable(Prefix + "isException", false) - - } - - @Test - //@Ignore - public void preProcessRequest_Json_MissingId() { - - println "************ preProcessRequest_MissingId() ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) - when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) - when(mockExecution.getVariable("requestAction")).thenReturn("DELETE") - //when(mockExecution.getVariable("networkId")).thenReturn("") // missing Id - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("vnfId")).thenReturn("") - when(mockExecution.getVariable("volumeGroupId")).thenReturn("") - //when(mockExecution.getVariable("networkId")).thenReturn("") - when(mockExecution.getVariable("serviceType")).thenReturn("MOG") - when(mockExecution.getVariable("networkType")).thenReturn("modelName") - when(mockExecution.getVariable("bpmnRequest")).thenReturn(incomingJsonRequest) - when(mockExecution.getVariable("disableRollback")).thenReturn(true) - - when(mockExecution.getVariable("testMessageId")).thenReturn("7df689f9-7b93-430b-9b9e-28140d70cc7ad") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("mso-service-instance-id")).thenReturn("FH/VLXM/003717//SW_INTERNET") - when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_rollback")).thenReturn("true") - when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") - - // preProcessRequest(DelegateExecution execution) - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - try { - DoDeleteNetworkInstance.preProcessRequest(mockExecution) - } catch (Exception ex) { - println " Test End - Handle catch-throw BpmnError()! " - } - - //verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - //verify variable initialization - initializeVariables(mockExecution) - - verify(mockExecution).setVariable("action", "DELETE") - verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequestMissingId) - verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) - - verify(mockExecution).setVariable(Prefix + "networkInputs", networkInputsMissingId) - verify(mockExecution).setVariable(Prefix + "messageId", "7df689f9-7b93-430b-9b9e-28140d70cc7ad") - verify(mockExecution).setVariable(Prefix + "source", "VID") - - } - - @Test - //@Ignore - public void preProcessRequest_Json_MissingCloudRegion() { - - def networkModelInfo = """{"modelVersionId": "sn5256d1-5a33-55df-13ab-12abad84e111", - "modelName": "CONTRAIL_EXTERNAL", - "modelType": "CONTRAIL_EXTERNAL", - "modelVersion": "1", - "modelCustomizationId": "sn5256d1-5a33-55df-13ab-12abad84e222", - "modelInvariantId": "sn5256d1-5a33-55df-13ab-12abad84e764" - }""".trim() - - println "************ preProcessRequest_MissingCloudRegion() ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("networkModelInfo")).thenReturn(networkModelInfo) - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) - when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) - when(mockExecution.getVariable("requestAction")).thenReturn("DELETE") - when(mockExecution.getVariable("networkId")).thenReturn("bdc5efe8-404a-409b-85f6-0dcc9eebae30") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("vnfId")).thenReturn("") - when(mockExecution.getVariable("volumeGroupId")).thenReturn("") - //when(mockExecution.getVariable("networkId")).thenReturn("") - when(mockExecution.getVariable("serviceType")).thenReturn("MOG") - when(mockExecution.getVariable("networkType")).thenReturn("modelName") - when(mockExecution.getVariable("bpmnRequest")).thenReturn(incomingRequestMissingCloudRegion) - when(mockExecution.getVariable("disableRollback")).thenReturn(true) - - when(mockExecution.getVariable("testMessageId")).thenReturn("7df689f9-7b93-430b-9b9e-28140d70cc7ad") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("mso-service-instance-id")).thenReturn("FH/VLXM/003717//SW_INTERNET") - when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_rollback")).thenReturn("true") - when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") - - // preProcessRequest(DelegateExecution execution) - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.preProcessRequest(mockExecution) - - //verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - //verify variable initialization - initializeVariables(mockExecution) - - verify(mockExecution).setVariable("action", "DELETE") - verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequestMissingCloudRegion) - verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) - - verify(mockExecution).setVariable(Prefix + "networkInputs", networkInputsMissingCloudRegion) - verify(mockExecution).setVariable(Prefix + "messageId", "7df689f9-7b93-430b-9b9e-28140d70cc7ad") - verify(mockExecution).setVariable(Prefix + "lcpCloudRegion", null) - - verify(mockExecution).setVariable("BasicAuthHeaderValuePO","Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") - - } - - - - @Test - //@Ignore - public void prepareNetworkRequest() { - - println "************ prepareNetworkRequest ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedVperNetworkRequest) - when(mockExecution.getVariable(Prefix + "queryAAIResponse")).thenReturn(queryAAIResponse) - when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "tenantId")).thenReturn("e81d842d3e8b45c5a59f57cd76af3aaf") - - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("URN_mso_adapters_network_rest_endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter") - when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_value") - //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? - when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.prepareNetworkRequest(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable("URN_mso_adapters_network_rest_endpoint", "http://localhost:8090/networks/NetworkAdapter/bdc5efe8-404a-409b-85f6-0dcc9eebae30") - //verify(mockExecution).setVariable(Prefix + "deleteNetworkRequest", deleteNetworkRequest) - verify(mockExecution).setVariable(Prefix + "deleteNetworkRequest", deleteNetworkRESTRequest) - - } - - @Test - //@Ignore - public void prepareNetworkRequest_AlaCarte() { - - println "************ prepareNetworkRequest ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "queryAAIResponse")).thenReturn(queryAAIResponse) - when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "tenantId")).thenReturn("e81d842d3e8b45c5a59f57cd76af3aaf") - - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("URN_mso_adapters_network_rest_endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter") - when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_value") - //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? - when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.prepareNetworkRequest(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable("URN_mso_adapters_network_rest_endpoint", "http://localhost:8090/networks/NetworkAdapter/bdc5efe8-404a-409b-85f6-0dcc9eebae30") - //verify(mockExecution).setVariable(Prefix + "deleteNetworkRequest", deleteNetworkRequest) - verify(mockExecution).setVariable("mso-request-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - verify(mockExecution).setVariable(Prefix + "deleteNetworkRequest", deleteNetworkRESTRequestAlaCarte) - - } - - @Test - //@Ignore - public void sendRequestToVnfAdapter() { - - println "************ sendRequestToVnfAdapter ************* " - - WireMock.reset(); - MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "deleteNetworkRequest")).thenReturn(deleteNetworkRESTRequest) - when(mockExecution.getVariable("URN_mso_adapters_network_rest_endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter/bdc5efe8-404a-409b-85f6-0dcc9eebae30") - when(mockExecution.getVariable("BasicAuthHeaderValuePO")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.sendRequestToVnfAdapter(mockExecution) - - verify(mockExecution).setVariable(Prefix + "networkReturnCode", 200) - //verify(mockExecution).setVariable(Prefix + "deleteNetworkResponse", deleteNetworkResponse_noRollback) - - } - - - @Test - //@Ignore - public void prepareSDNCRequest() { - - println "************ prepareSDNCRequest ************* " - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "queryAAIResponse")).thenReturn(aaiResponse) - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.prepareSDNCRequest(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "deleteSDNCRequest", deleteSDNCRequest) - - } - - @Test - //@Ignore - public void prepareRpcSDNCRequest() { - - println "************ prepareRpcSDNCRequest ************* " - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(inputViprSDC_NetworkRequest) - when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") // test ONLY - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.prepareRpcSDNCRequest(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "deleteSDNCRequest", deleteRpcSDNCRequest) - - } - - @Test - //@Ignore - public void prepareRpcSDNCActivateRollback() { - - println "************ prepareRpcSDNCActivateRollback ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(inputViprSDC_NetworkRequest) - when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("8abc633a-810b-4ca5-8b3a-09511d13a2ce") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") // test ONLY - when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn(null) - when(mockExecution.getVariable(Prefix + "deactivateSDNCResponse")).thenReturn(sdncAdapterWorkflowFormattedResponse) - - // preProcessRequest(DelegateExecution execution) - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.prepareRpcSDNCDeactivateRollback(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix) - //verify(mockExecution).setVariable("mso-request-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //verify(mockExecution).setVariable(Prefix + "requestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //verify(mockExecution).setVariable("mso-service-instance-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - verify(mockExecution).setVariable(Prefix + "rollbackDeactivateSDNCRequest", sdncAdapaterDeactivateRollback) - - } - - - @Test - //@Ignore - public void callRESTQueryAAI_200() { - - println "************ callRESTQueryAAI ************* " - - WireMock.reset(); - MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "all"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_network_l3_network_uri")).thenReturn("") - // old: when(mockExecution.getVariable("URN_mso_workflow_DoDeleteNetworkInstance_aai_network_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") - when(mockExecution.getVariable("URN_mso_workflow_DoDeleteNetworkInstance_aai_l3_network_uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.callRESTQueryAAI(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "queryAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/bdc5efe8-404a-409b-85f6-0dcc9eebae30"+"?depth=all") - - verify(mockExecution).setVariable(Prefix + "aaiReturnCode", "200") - //verify(mockExecution).setVariable(Prefix + "queryAAIResponse", aaiResponse) - verify(mockExecution).setVariable(Prefix + "isAAIGood", true) - verify(mockExecution).setVariable(Prefix + "isVfRelationshipExist", false) - - } - - @Test - //@Ignore - public void callRESTQueryAAI_withRelationship_200() { - - println "************ callRESTQueryAAI ************* " - - WireMock.reset(); - MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml", "all"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_network_l3_network_uri")).thenReturn("") - // old: when(mockExecution.getVariable("URN_mso_workflow_DoDeleteNetworkInstance_aai_network_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") - when(mockExecution.getVariable("URN_mso_workflow_DoDeleteNetworkInstance_aai_l3_network_uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.callRESTQueryAAI(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "queryAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/bdc5efe8-404a-409b-85f6-0dcc9eebae30"+"?depth=all") - - verify(mockExecution).setVariable(Prefix + "aaiReturnCode", "200") - //verify(mockExecution).setVariable(Prefix + "queryAAIResponse", aaiResponseWithRelationship) - verify(mockExecution).setVariable(Prefix + "isAAIGood", true) - verify(mockExecution).setVariable(Prefix + "isVfRelationshipExist", true) - - } - - @Test - //@Ignore - public void callRESTQueryAAI_200_DefaultUri() { - - println "************ callRESTQueryAAI ************* " - - WireMock.reset(); - MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "all"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("URN_mso_workflow_default_aai_network_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.callRESTQueryAAI(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "queryAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/bdc5efe8-404a-409b-85f6-0dcc9eebae30"+ "?depth=all") - - verify(mockExecution).setVariable(Prefix + "aaiReturnCode", "200") - //verify(mockExecution).setVariable(Prefix + "queryAAIResponse", aaiResponse) - verify(mockExecution).setVariable(Prefix + "isAAIGood", true) - - } - - @Test - //@Ignore - public void callRESTQueryAAICloudRegion30_200() { - - println "************ callRESTQueryAAICloudRegion30_200 ************* " - - WireMock.reset(); - MockGetNetworkCloudRegion("DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml", "RDM2WAGPLCP"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn(Prefix) - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("URN_mso_workflow_default_aai_cloud_infrastructure_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "queryCloudRegionRequest", "http://localhost:8090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200") - - } - - @Test - //@Ignore - public void callRESTQueryAAICloudRegion_NotFound() { - - println "************ callRESTQueryAAICloudRegion_NotFound ************* " - - WireMock.reset(); - MockGetNetworkCloudRegion_404("MDTWNJ21"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn(Prefix) - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestCloudRegionNotFound) - when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn("MDTWNJ21") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("URN_mso_workflow_default_aai_cloud_infrastructure_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "cloudRegionPo", "MDTWNJ21") - verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc", "AAIAIC25") - - } - - @Test - //@Ignore - public void callRESTQueryAAICloudRegion25_200() { - - println "************ callRESTQueryAAICloudRegion25_200 ************* " - - WireMock.reset(); - MockGetNetworkCloudRegion("DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn(Prefix) - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("URN_mso_workflow_default_aai_cloud_infrastructure_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") - // - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "queryCloudRegionRequest", "http://localhost:8090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200") - - } - - - @Test - //@Ignore - public void validateNetworkResponse() { - - println "************ validateNetworkResponse ************* " - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "deleteNetworkResponse")).thenReturn(deleteNetworkResponse) - when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('200') - - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.validateNetworkResponse(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - //verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", null) - - } - - - @Test - //@Ignore - public void validateSDNCResponse_200() { - - println "************ validateSDNCResponse ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") - when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) - - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - try { - DoDeleteNetworkInstance.validateSDNCResponse(mockExecution, sdncAdapterWorkflowResponse) - } catch (Exception ex) { - println " Graceful Exit - " + ex.getMessage() - } - - } - - @Test - //@Ignore - public void validateSDNCResponse_404() { - - println "************ validateSDNCResponse ************* " - - WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstance", 2500, "Received error from SNDC Adapter: HTTP Status 404.") - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("404") - when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(false) - when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) - - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - try { - DoDeleteNetworkInstance.validateSDNCResponse(mockExecution) - } catch (Exception ex) { - println " Graceful Exit - " + ex.getMessage() - } - - } - - @Test - //@Ignore - public void validateRpcSDNCDeactivateResponse() { - - println "************ validateRpcSDNCDeactivateResponse ************* " - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "deactivateSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse) - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) - when(mockExecution.getVariable(Prefix + "deactivateSDNCReturnCode")).thenReturn("200") - - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - try { - DoDeleteNetworkInstance.validateRpcSDNCDeactivateResponse(mockExecution) - verify(mockExecution).setVariable(Prefix + "isSdncDeactivateRollbackNeeded", true) - - } catch (Exception ex) { - println " Graceful Exit - " + ex.getMessage() - } - //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - //verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) - - } - - @Test - @Ignore - public void postProcessResponse() { - - println "************ postProcessResponse ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "source")).thenReturn("PORTAL") - when(mockExecution.getVariable(Prefix + "isException")).thenReturn(false) - - // postProcessResponse(DelegateExecution execution) - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.postProcessResponse(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "Success", true) - - } - - @Test - //@Ignore - public void prepareRollbackData() { - - println "************ prepareRollbackData() ************* " - - - - WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(deleteRollbackNetworkRequest) - //when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(null) - //when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn("") - when(mockExecution.getVariable(Prefix + "rollbackDeactivateSDNCRequest")).thenReturn(sdncAdapaterDeactivateRollback) - when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) - - // preProcessRequest(DelegateExecution execution) - DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() - DoDeleteNetworkInstance.prepareRollbackData(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - } - - - private ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("DoDeleteNetworkInstance") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoDeleteNetworkInstance") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("DoDeleteNetworkInstance") - when(mockExecution.getProcessInstanceId()).thenReturn("DoDeleteNetworkInstance") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - - return mockExecution - - } - -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy deleted file mode 100644 index 2dc3157e57..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy +++ /dev/null @@ -1,110 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC All rights reserved. * - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure.scripts - -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.junit.Before -import org.junit.BeforeClass -import org.junit.Rule -import org.junit.Test -import org.mockito.MockitoAnnotations -import org.openecomp.mso.bpmn.mock.FileUtil -import org.openecomp.mso.bpmn.vcpe.scripts.GroovyTestBase - -import static org.mockito.Mockito.verify -import static org.mockito.Mockito.when - -class DoScaleE2EServiceInstanceTest extends GroovyTestBase { - - private static String request - - @Rule - public WireMockRule wireMockRule = new WireMockRule(GroovyTestBase.PORT) - - String Prefix = "CVRCS_" - - @BeforeClass - public static void setUpBeforeClass() { - request = FileUtil.readResourceFile("__files/InfrastructureFlows/DoScaleE2EServiceInstance.json") - } - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - public DoScaleE2EServiceInstanceTest(){ - super("DoScaleE2EServiceInstance") - } - - @Test - public void preProcessRequestTest(){ - - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - - DoScaleE2EServiceInstance instance = new DoScaleE2EServiceInstance() - instance.preProcessRequest(mex) - verify(mex).setVariable("resourceTemplateUUIDs", "ns111:ns333:") - } - - @Test - public void preInitResourcesOperStatusTest(){ - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - DoScaleE2EServiceInstance instance = new DoScaleE2EServiceInstance() - instance.preInitResourcesOperStatus(mex) - - verify(mex).setVariable("serviceInstanceId","e151059a-d924-4629-845f-264db19e50b4") - verify(mex).setVariable("operationId", "59960003992") - verify(mex).setVariable("operationType", "SCALE") - verify(mex).setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - - String payload = - """ - - - - e151059a-d924-4629-845f-264db19e50b4 - 59960003992 - SCALE - ns111:ns333: - - -""" - verify(mex).setVariable("CVFMI_initResOperStatusRequest", payload) - } - - private void initPreProcess(ExecutionEntity mex) { - when(mex.getVariable(GroovyTestBase.DBGFLAG)).thenReturn("true") - when(mex.getVariable("bpmnRequest")).thenReturn(request) - when(mex.getVariable("msoRequestId")).thenReturn("mri") - when(mex.getVariable("serviceType")).thenReturn("VoLTE") - when(mex.getVariable("serviceInstanceId")).thenReturn("e151059a-d924-4629-845f-264db19e50b4") - when(mex.getVariable("serviceInstanceName")).thenReturn("ra") - when(mex.getVariable("operationId")).thenReturn("59960003992") - when(mex.getVariable("globalSubscriberId")).thenReturn("4993921112123") - when(mex.getVariable("resourceTemplateUUIDs")).thenReturn("ns111:ns333:") - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy deleted file mode 100644 index a4d57d265d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy +++ /dev/null @@ -1,315 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import static org.mockito.Mockito.* - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.junit.Before -import org.junit.Rule; -import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith - -import static org.junit.Assert.*; - -import com.github.tomakehurst.wiremock.client.WireMock; -import com.github.tomakehurst.wiremock.junit.WireMockRule; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import org.apache.commons.lang3.* - - -@RunWith(MockitoJUnitRunner.class) -class DoUpdateNetworkInstanceRollbackTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - - def utils = new MsoUtils() - String Prefix="UPDNETIR_" - - - String rollbackNetworkRequest = - """ - - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - - CONTRAIL_EXTERNAL - true - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - - - -""" - - String rollbackActivateSDNCRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - rollback - network-topology-operation - sdncCallback - generic-resource - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - CreateNetworkInstance - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - MSO_1610_dev - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - - invariant-uuid - customization-uuid - uuid - version - CONTRAIL_EXTERNAL - - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - -""" - - String rollbackSDNCRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - rollback - network-topology-operation - sdncCallback - generic-resource - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - CreateNetworkInstance - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - MSO_1610_dev - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - - invariant-uuid - customization-uuid - uuid - version - CONTRAIL_EXTERNAL - - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - -""" - -// - - - - - - - - - - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - - } - - public void initializeVariables (DelegateExecution mockExecution) { - - verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", null) - verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", null) - verify(mockExecution).setVariable(Prefix + "WorkflowException", null) - - verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", "") - verify(mockExecution).setVariable(Prefix + "rollbackNetworkResponse", "") - verify(mockExecution).setVariable(Prefix + "rollbackNetworkReturnCode", "") - - verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", "") - verify(mockExecution).setVariable(Prefix + "rollbackSDNCResponse", "") - verify(mockExecution).setVariable(Prefix + "rollbackSDNCReturnCode", "") - - verify(mockExecution).setVariable(Prefix + "Success", false) - verify(mockExecution).setVariable(Prefix + "fullRollback", false) - - - } - - @Test - //@Ignore - public void preProcessRequest() { - - println "************ preProcessRequest ************* " - - WorkflowException workflowException = new WorkflowException("DoUpdateNetworkInstanceRollback", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") - Map rollbackData = new HashMap(); - rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) - rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) - when(mockExecution.getVariable("rollbackData")).thenReturn(rollbackData) - when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") - when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - - when(mockExecution.getVariable("URN_mso_adapters_sdnc_endpoint")).thenReturn("http://localhost:28090/SDNCAdapter") - when(mockExecution.getVariable("URN_mso_adapters_network_rest_endpoint")).thenReturn("http://localhost:28090/networks/NetworkAdapter") - when(mockExecution.getVariable("URN_mso_adapters_sdnc_resource_endpoint")).thenReturn("http://localhost:28090/SDNCAdapterRpc") - - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstanceRollback DoUpdateNetworkInstanceRollback = new DoUpdateNetworkInstanceRollback() - DoUpdateNetworkInstanceRollback.preProcessRequest(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - //verify variable initialization - initializeVariables(mockExecution) - - } - - - @Test - @Ignore - public void validateRollbackResponses_Good() { - - WorkflowException workflowException = new WorkflowException("DoUpdateNetworkInstanceRollback", 2500, "AAI Update Contrail Failed. Error 404.") - WorkflowException expectedWorkflowException = new WorkflowException("DoUpdateNetworkInstanceRollback", 2500, "AAI Update Contrail Failed. Error 404. + SNDC activate rollback completed. + PO Network rollback completed. + SNDC assign rollback completed.") - - println "************ validateRollbackResponses_Good() ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn("Good") - when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn("Good") - when(mockExecution.getVariable(Prefix + "rollbackNetworkReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "rollbackNetworkResponse")).thenReturn("GoodResponse") - when(mockExecution.getVariable(Prefix + "rollbackSDNCReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "rollbackSDNCResponse")).thenReturn("GoodResponse") - when(mockExecution.getVariable(Prefix + "WorkflowException")).thenReturn(workflowException) - when(mockExecution.getVariable(Prefix + "fullRollback")).thenReturn(false) - - DoUpdateNetworkInstanceRollback DoUpdateNetworkInstanceRollback = new DoUpdateNetworkInstanceRollback() - DoUpdateNetworkInstanceRollback.validateRollbackResponses(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) - verify(mockExecution, atLeast(1)).setVariable("rolledBack", true) - verify(mockExecution, atLeast(1)).setVariable("wasDeleted", true) - verify(mockExecution).setVariable("WorkflowException", refEq(expectedWorkflowException, any(WorkflowException.class))) - //verify(mockExecution).setVariable("WorkflowException", expectedWorkflowException) - } - - @Test - //@Ignore - public void validateRollbackResponses_FullRollback() { - - Map rollbackData = new HashMap(); - rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) - rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) - - println "************ validateRollbackResponses_FullRollback() ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("prefix")).thenReturn(Prefix) - when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn("Good") - when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn("Good") - when(mockExecution.getVariable(Prefix + "rollbackNetworkReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "rollbackNetworkResponse")).thenReturn("GoodResponse") - when(mockExecution.getVariable(Prefix + "rollbackSDNCReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "rollbackSDNCResponse")).thenReturn("GoodResponse") - when(mockExecution.getVariable(Prefix + "WorkflowException")).thenReturn(null) - when(mockExecution.getVariable(Prefix + "fullRollback")).thenReturn(true) - when(mockExecution.getVariable("rollbackData")).thenReturn(rollbackData) - - DoUpdateNetworkInstanceRollback DoUpdateNetworkInstanceRollback = new DoUpdateNetworkInstanceRollback() - DoUpdateNetworkInstanceRollback.validateRollbackResponses(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) - verify(mockExecution, atLeast(1)).setVariable("rollbackSuccessful", true) - verify(mockExecution, atLeast(1)).setVariable("rollbackError", false) - - } - - - private ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("DoUpdateNetworkInstanceRollback") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoUpdateNetworkInstanceRollback") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("DoUpdateNetworkInstanceRollback") - when(mockExecution.getProcessInstanceId()).thenReturn("DoUpdateNetworkInstanceRollback") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - - return mockExecution - } - -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy deleted file mode 100644 index 8390ac3f6b..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy +++ /dev/null @@ -1,2743 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import static org.mockito.Mockito.* -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkVpnBinding; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkTableReference; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkPolicy; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutNetworkIdWithDepth; -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.junit.Before -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.core.WorkflowException - -import com.github.tomakehurst.wiremock.client.WireMock -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.apache.commons.lang3.* - - -@RunWith(MockitoJUnitRunner.class) -class DoUpdateNetworkInstanceTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(8090); - - def utils = new MsoUtils() - String Prefix="UPDNETI_" - - String jsonIncomingRequest = - """{ "requestDetails": { - "modelInfo": { - "modelType": "network", - "modelCustomizationId": "f21df226-8093-48c3-be7e-0408fcda0422", - "modelName": "CONTRAIL_EXTERNAL", - "modelVersion": "1.0" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "RDM2WAGPLCP", - "tenantId": "7dd5365547234ee8937416c65507d266" - }, - "requestInfo": { - "instanceName": "MNS-25180-L-01-dmz_direct_net_1", - "source": "VID", - "callbackUrl": "", - "suppressRollback": true, - "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", - "modelInfo": { - "modelType": "serviceT", - "modelId": "modelI", - "modelNameVersionId": "modelNameVersionI", - "modelName": "modleNam", - "modelVersion": "1" - } - } - } - ], - "requestParameters": { - "userParams": [ - { - "name": "someUserParam1", - "value": "someValue1" - } - ] - } - }}""" - - - String jsonIncomingRequest_MissingCloudRegion = - """{ "requestDetails": { - "modelInfo": { - "modelType": "network", - "modelCustomizationId": "f21df226-8093-48c3-be7e-0408fcda0422", - "modelName": "CONTRAIL_EXTERNAL", - "modelVersion": "1.0" - }, - "cloudConfiguration": { - "tenantId": "7dd5365547234ee8937416c65507d266" - }, - "requestInfo": { - "instanceName": "MNS-25180-L-01-dmz_direct_net_1", - "source": "VID", - "callbackUrl": "", - "suppressRollback": true, - "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", - "modelInfo": { - "modelType": "serviceT", - "modelId": "modelI", - "modelNameVersionId": "modelNameVersionI", - "modelName": "modleNam", - "modelVersion": "1" - } - } - } - ], - "requestParameters": { - "userParams": [] - } - }}""" - - - - String expectedNetworkRequestMissingNetworkId = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - UPDATE - VID - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - - - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - f21df226-8093-48c3-be7e-0408fcda0422 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - 1610 - - - someValue1 - -""" - - -String expectedNetworkRequestMissingCloudRegion = -""" - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - UPDATE - VID - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - - networkId - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - f21df226-8093-48c3-be7e-0408fcda0422 - null - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - null - - -""" - -String expectedNetworkInputMissingCloudRegion = -""" - networkId - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - f21df226-8093-48c3-be7e-0408fcda0422 - null - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - null -""" - - String networkInputsMissingName = - """ - - CONTRAIL_EXTERNAL - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - RDM2WAGPLCP - e81d842d3e8b45c5a59f57cd76af3aaf - """ - -String networkInputsMissingCloudRegion = -""" - HSL_direct_net_2 - CONTRAIL_EXTERNAL - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - - e81d842d3e8b45c5a59f57cd76af3aaf -""" - - // expectedNetworkRequest - String expectedNetworkRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - UPDATE - VID - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - f21df226-8093-48c3-be7e-0408fcda0422 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - 1610 - - - someValue1 - -""" - -String expectedNetworkInputs = -""" - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - f21df226-8093-48c3-be7e-0408fcda0422 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - 1610 -""" - -String expectedVperNetworkRequest = -""" - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - UPDATE - VID - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - MSO-dev-service-type - globalId_45678905678 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - false - - CONTRAIL_EXTERNAL - sn5256d1-5a33-55df-13ab-12abad84e111 - sn5256d1-5a33-55df-13ab-12abad84e764 - 1 - sn5256d1-5a33-55df-13ab-12abad84e222 - - - - - - - - - 1702 - - -""" - -String expectedVperNetworkInputs = -""" - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - MSO-dev-service-type - globalId_45678905678 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - false - - CONTRAIL_EXTERNAL - sn5256d1-5a33-55df-13ab-12abad84e111 - sn5256d1-5a33-55df-13ab-12abad84e764 - 1 - sn5256d1-5a33-55df-13ab-12abad84e222 - - - - - - - - - 1702 -""" - -String expectedNetworkInputsMissingNetworkId = -""" - - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - f21df226-8093-48c3-be7e-0408fcda0422 - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - false - 1610 -""" - - - String NetworkRequest_noPhysicalName = - """ - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - UPDATE - PORTAL - - - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - 3008 - - - - true - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - true - true - 10.10.125.1 - - -""" - - String vnfRequestFakeRegion = - """ - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - UPDATE - PORTAL - - - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MDTWNJ21 - 7dd5365547234ee8937416c65507d266 - - - 1 - 0 - -""" - - // expectedNetworkRequest - String expectedNetworkRequest_Outputs = - """ - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - UPDATE - PORTAL - - - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - - - MNS-25180-L-01-dmz_direct_net_1 - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - - - 1 - 0 - -""" - - - String networkInputs = - """ - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - RDM2WAGPLCP - e81d842d3e8b45c5a59f57cd76af3aaf -""" - - String networkOutputs = - """ - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - """ - - String queryAAIResponse = - """ - - - - - - - - - - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_EXTERNAL - dmz_direct - contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - pending-delete - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-delete - true - - - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - - -""" - - String queryIdAIIResponse = - """ - - - - - - - - - - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - l3-version - pending-delete - ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326 - networkName - false - true - false - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-update - true - subnetName - true - - - 400d286b-7e44-4514-b9b3-f70f7360ff32 - 172.20.1.0/24 - 10.102.200.1 - ip-address - 1505857300987 - - - 6f038013-8b15-4eb8-914b-507489fbc8ee - 10.102.0.0/16 - 10.102.200.1 - ip-address - 1505857301151 - - - 8811c5f8-f1ed-4fa0-a505-e1be60396e28 - 192.168.2.0/25 - 10.102.200.1 - 1505857301954 - - - - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-delete - true - subnetName - true - - - 400d286b-7e44-4514-b9b3-f70f7360ff32 - 172.20.1.0/24 - 10.102.200.1 - 1505857300987 - - - - - - - 414 - 4132176 - - - 415 - 4132176 - - - - inner - ctag-version - - - tenant - https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ - - tenant.tenant-id - 897deadc2b954a6bac6d3c197fb3525e - - - tenant.tenant-name - MSOTest1 - - - - vpn-binding - https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ - - vpn-binding.vpn-id - a290b841-f672-44dd-b9cd-6f8c20d7d8c8 - - - vpn-binding.vpn-name - oam_protected_net_6_MTN5_msotest2 - - - - vpn-binding - https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ - - vpn-binding.vpn-id - 24a4b507-853a-4a38-99aa-05fcc54be24d - - - vpn-binding.vpn-name - oam_protected_net_6_MTN5_msotest1 - - - - - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - network-policy - https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg - - network-policy.network-policy-id - cee6d136-e378-4678-a024-2cd15f0ee0cg - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - - -""" - - String queryIdAIIResponseTestScenario01 = - """ - - 4da55fe4-7a9e-478c-a434-8a98d62265ab - GN_EVPN_direct_net_0_ST1 - CONTRAIL30_BASIC - GN_EVPN_direct - contrail - false - 9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - 1465398611 - pending-delete - networkName - false - true - false - - - cb1a7b47-5428-44c9-89c2-8b17541c3228 - 108.239.40.1 - 108.239.40.0 - 28 - 4 - pending-delete - true - 108.239.40.0 - 108.239.40.0 - 1465398611 - subnetName - - - - e2cc7c14-90f0-4205-840d-b4e07f04e621 - 2606:ae00:2e01:604::1 - 2606:ae00:2e01:604:: - 64 - 6 - pending-delete - true - 2606:ae00:2e01:604:: - 2606:ae00:2e01:604:: - 1465398611 - subnetName - - - - - - 416 - 4132176 - - - - cloud-region - https://mtanjv9aaas03.aic.cip.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/ - - - cloud-region.cloud-region-id - AAIAIC25 - - - cloud-region.cloud-owner - att-aic - - - cloud-region.owner-defined-type - - - - - tenant - https://mtanjv9aaas03.aic.cip.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/4ae1d3446a4c48b2bec44b6cfba06d68/ - - tenant.tenant-id - 4ae1d3446a4c48b2bec44b6cfba06d68 - - - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - AAIAIC25 - - - tenant.tenant-name - Ruchira Contrail 3.0 test - - - - vpn-binding - https://mtanjv9aaas03.aic.cip.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 9a7b327d9-287aa00-82c4b0-100001 - - - vpn-binding.vpn-name - GN_EVPN_direct_net_0_ST1 - - - - route-table-reference - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - -""" - - String queryIdAIIResponseVpnNotPresent = - """ - - - - - - - - - - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - pending-delete - networkName - false - true - false - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-delete - true - subnetName - - - - - - -""" - - String queryNameAIIResponse = - """ - - - - - - - - - - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - pending-delete - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-delete - true - - - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - - - """ - - String queryNameAIIResponseVpnNotPresent = - """ - - - - - - - - - - - - - - -""" - - String queryVpnBindingAAIResponse = - """ - - - - - - - - - - - - 9a7b327d9-287aa00-82c4b0-105757 - GN_EVPN_Test - 13979:105757 - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ - - l3-network.network-id - 689ec39e-c5fc-4462-8db2-4f760763ad28 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ - - l3-network.network-id - 1a49396b-19b3-40a4-8792-aa2fbd0f0704 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ - - l3-network.network-id - 774f3329-3c83-4771-86c7-9e6207cd50fd - - - - - -""" - - - String updateNetworkRequest = - """ - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - sn5256d1-5a33-55df-13ab-12abad84e222 - - CONTRAIL - - networkName - 414,415 - - - true - false - 13979:105757 - 13979:105757 - GN_EVPN_Test - refFQDN1 - refFQDN2 - - - - - - - 107.239.52.0/24 - true - 107.239.52.1 - 4 - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - subnetName - true - - 172.20.1.0/24 - 10.102.200.1 - - - 10.102.0.0/16 - 10.102.200.1 - - - 192.168.2.0/25 - 10.102.200.1 - - - true - true - false - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - - messageId_generated - -""" - -String updateNetworkRequest_noPhysicalName = -""" - RDM2WAGPLCP - 7dd5365547234ee8937416c65507d266 - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - - - CONTRAIL - - networkName - 414,415 - - - true - false - 13979:105757 - 13979:105757 - GN_EVPN_Test - - - - - - - 107.239.52.0/24 - true - 107.239.52.1 - 4 - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - subnetName - true - - 172.20.1.0/24 - 10.102.200.1 - - - 10.102.0.0/16 - 10.102.200.1 - - - 192.168.2.0/25 - 10.102.200.1 - - - true - true - false - - true - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - true - true - 10.10.125.1 - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - null - - messageId_generated - -""" - - String updateNetworkResponseREST = - """ - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 - - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 - - - - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - - CONTRAIL_EXTERNAL - true - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - - - - messageId_generated -""" - - String updateRollbackNetworkRequest = - """ - - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - - CONTRAIL_EXTERNAL - true - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - - - -""" - - String updateNetworkResponse = - """ - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 - - - - RDM2WAGPLCP - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - - - true - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - CONTRAIL_EXTERNAL - false - c4f4e878-cde0-4b15-ae9a-bda857759cea - 7dd5365547234ee8937416c65507d266 - -""" - - String updateContrailAAIPayloadRequest = - """ - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - contrail - c4f4e878-cde0-4b15-ae9a-bda857759cea - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - l3-version - Active - ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326 - default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 - networkName - false - true - false - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 - 107.239.52.1 - 107.239.52.0 - 24 - 4 - Active - true - 1505857300987 - subnetName - true - - - 400d286b-7e44-4514-b9b3-f70f7360ff32 - 172.20.1.0/24 - 10.102.200.1 - ip-address - 1505857300987 - - - 6f038013-8b15-4eb8-914b-507489fbc8ee - 10.102.0.0/16 - 10.102.200.1 - ip-address - 1505857301151 - - - 8811c5f8-f1ed-4fa0-a505-e1be60396e28 - 192.168.2.0/25 - 10.102.200.1 - - 1505857301954 - - - - - - 414 - 4132176 - - - 415 - 4132176 - - - - inner - ctag-version - - - tenant - https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ - - tenant.tenant-id - 897deadc2b954a6bac6d3c197fb3525e - - - tenant.tenant-name - MSOTest1 - - - - vpn-binding - https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ - - vpn-binding.vpn-id - a290b841-f672-44dd-b9cd-6f8c20d7d8c8 - - - vpn-binding.vpn-name - oam_protected_net_6_MTN5_msotest2 - - - - vpn-binding - https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ - - vpn-binding.vpn-id - 24a4b507-853a-4a38-99aa-05fcc54be24d - - - vpn-binding.vpn-name - oam_protected_net_6_MTN5_msotest1 - - - - - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - network-policy - https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg - - network-policy.network-policy-id - cee6d136-e378-4678-a024-2cd15f0ee0cg - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - -""" - - - String updateContrailAAIResponse = - """ - - - - - - - - -""" - - String updateNetworkErrorResponse = - """ - 680bd458-5ec1-4a16-b77c-509022e53450INTERNAL - 400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data - true - """ - - - String networkException500 = - """soap:VersionMismatch"http://org.openecomp.mso/network", the namespace on the "updateNetworkContrail" element, is not a valid SOAP version.""" - - String aaiResponse = - """ - - - - - - - - - - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_BASIC - HSL_direct - contrail - 8bbd3edf-b835-4610-96a2-a5cafa029042 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - active - HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 - - - ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a - 5a77fdc2-7789-4649-a1b9-6eaf1db1813a - 172.16.34.1 - 172.16.34.0 - 28 - 4 - active - true - - - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v3/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ - - tenant.tenant-id - e81d842d3e8b45c5a59f57cd76af3aaf - - - - - - """ - - String changeAssignSDNCRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - changeassign - network-topology-operation - sdncCallback - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - NetworkActivateRequest - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - MSO_1610_dev - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - CONTRAIL_EXTERNAL - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - -""" - -String assignResponse = -""" 006927ca-f5a3-47fd-880c-dfcbcd81a093 200 OK 200006927ca-f5a3-47fd-880c-dfcbcd81a093Ynotsurewecarea9a77d5a-123e-4ca2-9eb9-0b015d2ee0fbGN_EVPN_direct_net_0_ST_noGW8abc633a-810b-4ca5-8b3a-09511d13a2ce """ - - String sdncRollbackRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - rollback - network-topology-operation - sdncCallback - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - NetworkActivateRequest - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - MSO_1610_dev - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - -""" - - String sdncAdapterWorkflowResponse = - """ - - - 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 - 200 - OK - - <output xmlns="com:att:sdnctl:vnf"><svc-request-id>00703dc8-71ff-442d-a4a8-3adc5beef6a9</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>MNS-25180-L-01-dmz_direct_net_1</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> - -""" - - - String sdncAdapterWorkflowResponse_Error = - """ - - - - 400 - Error writing to l3-netework - Y - c79240d8-34b5-4853-af69-2021928dba00 - - - -""" - - String expected_sdncAdapterWorkflowResponse_Error = - """ - - - - 400 - Error writing to l3-netework - Y - c79240d8-34b5-4853-af69-2021928dba00 - - - -""" - - String sdncAdapterWorkflowFormattedResponse = - """ - - - 00703dc8-71ff-442d-a4a8-3adc5beef6a9 - 200 - Y - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - notsurewecare - - - -""" - -String rollbackSDNCRequest = -""" - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - rollback - network-topology-operation - sdncCallback - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - CreateNetworkInstance - VID - - - - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MSO-dev-service-type - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - MSO_1610_dev - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - - invariant-uuid - customization-uuid - uuid - version - CONTRAIL_EXTERNAL - - - - 8abc633a-810b-4ca5-8b3a-09511d13a2ce - CONTRAIL_EXTERNAL - MNS-25180-L-01-dmz_direct_net_1 - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - -""" - -String rollbackNetworkRequest = -""" - - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - - CONTRAIL_EXTERNAL - true - 7dd5365547234ee8937416c65507d266 - RDM2WAGPLCP - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - - - -""" - -// - - - - - - - - - - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - - } - - public void initializeVariables (DelegateExecution mockExecution) { - - verify(mockExecution).setVariable(Prefix + "messageId", "") - verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "") - verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "") - verify(mockExecution).setVariable(Prefix + "networkRequest", "") - verify(mockExecution).setVariable(Prefix + "networkInputs", "") - verify(mockExecution).setVariable(Prefix + "networkOutputs", "") - verify(mockExecution).setVariable(Prefix + "requestId", "") - verify(mockExecution).setVariable(Prefix + "source", "") - verify(mockExecution).setVariable(Prefix + "networkId", "") - - verify(mockExecution).setVariable(Prefix + "isPONR", false) - - // AAI query Cloud Region - verify(mockExecution).setVariable(Prefix + "queryCloudRegionRequest","") - verify(mockExecution).setVariable(Prefix + "queryCloudRegionReturnCode","") - verify(mockExecution).setVariable(Prefix + "queryCloudRegionResponse","") - verify(mockExecution).setVariable(Prefix + "cloudRegionPo","") - verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc","") - verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", false) - - // AAI query Id - verify(mockExecution).setVariable(Prefix + "queryIdAAIRequest","") - verify(mockExecution).setVariable(Prefix + "queryIdAAIResponse", "") - verify(mockExecution).setVariable(Prefix + "aaiIdReturnCode", "") - - // AAI query vpn binding - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest","") - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIResponse", "") - verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "") - verify(mockExecution).setVariable(Prefix + "vpnBindings", null) - verify(mockExecution).setVariable(Prefix + "vpnCount", 0) - verify(mockExecution).setVariable(Prefix + "routeCollection", "") - - // AAI query network policy - verify(mockExecution).setVariable(Prefix + "queryNetworkPolicyAAIRequest","") - verify(mockExecution).setVariable(Prefix + "queryNetworkPolicyAAIResponse", "") - verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "") - verify(mockExecution).setVariable(Prefix + "networkPolicyUriList", null) - verify(mockExecution).setVariable(Prefix + "networkPolicyCount", 0) - verify(mockExecution).setVariable(Prefix + "networkCollection", "") - - // AAI query route table reference - verify(mockExecution).setVariable(Prefix + "queryNetworkTableRefAAIRequest","") - verify(mockExecution).setVariable(Prefix + "queryNetworkTableRefAAIResponse", "") - verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "") - verify(mockExecution).setVariable(Prefix + "networkTableRefUriList", null) - verify(mockExecution).setVariable(Prefix + "networkTableRefCount", 0) - verify(mockExecution).setVariable(Prefix + "tableRefCollection", "") - - - // AAI requery Id - verify(mockExecution).setVariable(Prefix + "requeryIdAAIRequest","") - verify(mockExecution).setVariable(Prefix + "requeryIdAAIResponse", "") - verify(mockExecution).setVariable(Prefix + "aaiRequeryIdReturnCode", "") - - // AAI update contrail - verify(mockExecution).setVariable(Prefix + "updateContrailAAIUrlRequest","") - verify(mockExecution).setVariable(Prefix + "updateContrailAAIPayloadRequest","") - verify(mockExecution).setVariable(Prefix + "updateContrailAAIResponse", "") - verify(mockExecution).setVariable(Prefix + "aaiUpdateContrailReturnCode", "") - - verify(mockExecution).setVariable(Prefix + "updateNetworkRequest", "") - verify(mockExecution).setVariable(Prefix + "updateNetworkResponse", "") - verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", "") - //verify(mockExecution).setVariable(Prefix + "rollbackNetworkResponse", "") - verify(mockExecution).setVariable(Prefix + "networkReturnCode", "") - //verify(mockExecution).setVariable(Prefix + "rollbackNetworkReturnCode", "") - verify(mockExecution).setVariable(Prefix + "isNetworkRollbackNeeded", false) - - verify(mockExecution).setVariable(Prefix + "changeAssignSDNCRequest", "") - verify(mockExecution).setVariable(Prefix + "changeAssignSDNCResponse", "") - verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", "") - //verify(mockExecution).setVariable(Prefix + "rollbackSDNCResponse", "") - verify(mockExecution).setVariable(Prefix + "sdncReturnCode", "") - //verify(mockExecution).setVariable(Prefix + "rollbackSDNCReturnCode", "") - verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", false) - verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false) - - verify(mockExecution).setVariable(Prefix + "isVnfBindingPresent", false) - verify(mockExecution).setVariable(Prefix + "Success", false) - verify(mockExecution).setVariable(Prefix + "serviceInstanceId", "") - - verify(mockExecution).setVariable(Prefix + "isException", false) - - } - - @Test - //@Ignore - public void preProcessRequest_NetworkRequest() { - - println "************ preProcessRequest_Payload ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) - when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) - when(mockExecution.getVariable("requestAction")).thenReturn("UPDATE") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("vnfId")).thenReturn("") - when(mockExecution.getVariable("volumeGroupId")).thenReturn("") - when(mockExecution.getVariable("networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") - when(mockExecution.getVariable("serviceType")).thenReturn("MOG") - when(mockExecution.getVariable("networkType")).thenReturn("modelName") - when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) - when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_rollback")).thenReturn("true") - when(mockExecution.getVariable("disableRollback")).thenReturn("true") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.preProcessRequest(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix + "") - - //verify variable initialization - initializeVariables(mockExecution) - - // Authentications - verify(mockExecution).setVariable("action", "UPDATE") - verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequest) - verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) - verify(mockExecution).setVariable(Prefix + "networkInputs", expectedNetworkInputs) - verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable(Prefix + "networkOutputs", "") - - } - - @Test - //@Ignore - public void preProcessRequest_vPERNetworkRequest() { - - def networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111", - "modelName": "CONTRAIL_EXTERNAL", - "modelType": "CONTRAIL_EXTERNAL", - "modelVersion": "1", - "modelCustomizationUuid": "sn5256d1-5a33-55df-13ab-12abad84e222", - "modelInvariantUuid": "sn5256d1-5a33-55df-13ab-12abad84e764" - }""".trim() - - println "************ preProcessRequest_Payload ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("disableRollback")).thenReturn("true") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") // optional - when(mockExecution.getVariable("networkName")).thenReturn("MNS-25180-L-01-dmz_direct_net_1") // optional - when(mockExecution.getVariable("productFamilyId")).thenReturn("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") - when(mockExecution.getVariable("networkModelInfo")).thenReturn("CONTRAIL_EXTERNAL") - when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable("tenantId")).thenReturn("7dd5365547234ee8937416c65507d266") - when(mockExecution.getVariable("failIfExists")).thenReturn("false") - when(mockExecution.getVariable("networkModelInfo")).thenReturn(networkModelInfo) - when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") - when(mockExecution.getVariable("action")).thenReturn("UPDATE") - when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("MSO-dev-service-type") - when(mockExecution.getVariable("globalSubscriberId")).thenReturn("globalId_45678905678") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - - when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - - when(mockExecution.getVariable("URN_mso_rollback")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_adapters_sdnc_endpoint")).thenReturn("http://localhost:8090/SDNCAdapter") - when(mockExecution.getVariable("URN_mso_adapters_network_rest_endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter") - when(mockExecution.getVariable("URN_mso_adapters_sdnc_resource_endpoint")).thenReturn("http://localhost:8090/SDNCAdapterRpc") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.preProcessRequest(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix + "") - - //verify variable initialization - initializeVariables(mockExecution) - - // Authentications - verify(mockExecution).setVariable("action", "UPDATE") - verify(mockExecution).setVariable(Prefix + "networkRequest", expectedVperNetworkRequest) - verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) - verify(mockExecution).setVariable(Prefix + "networkInputs", expectedVperNetworkInputs) - verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable(Prefix + "networkOutputs", "") - - } - - @Test - //@Ignore - public void preProcessRequest_MissingNetworkId() { - - println "************ preProcessRequest_MissingName() ************* " - - WorkflowException missingNameWorkflowException = new WorkflowException("DoUpdateNetworkInstance", 2500, "Variable 'network-id' value/element is missing.") - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) - when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) - when(mockExecution.getVariable("requestAction")).thenReturn("UPDATE") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("vnfId")).thenReturn("") - when(mockExecution.getVariable("volumeGroupId")).thenReturn("") - //when(mockExecution.getVariable("networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") - when(mockExecution.getVariable("serviceType")).thenReturn("MOG") - when(mockExecution.getVariable("networkType")).thenReturn("modelName") - when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) - when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") - - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_rollback")).thenReturn("true") - when(mockExecution.getVariable("disableRollback")).thenReturn("true") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - try { - DoUpdateNetworkInstance.preProcessRequest(mockExecution) - } catch (Exception ex) { - println " Test End - Handle catch-throw BpmnError()! " - } - - verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") - - //verify variable initialization - initializeVariables(mockExecution) - - verify(mockExecution).setVariable("action", "UPDATE") - verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequestMissingNetworkId) - verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) - verify(mockExecution).setVariable(Prefix + "networkInputs", expectedNetworkInputsMissingNetworkId) - verify(mockExecution).setVariable(Prefix + "messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - verify(mockExecution).setVariable(Prefix + "source", "VID") - verify(mockExecution).setVariable(Prefix + "networkOutputs", "") - - verify(mockExecution).setVariable(eq("WorkflowException"), refEq(missingNameWorkflowException)) - - } - - @Test - //@Ignore - public void preProcessRequest_MissingCloudRegion() { - - println "************ preProcessRequest_MissingCloudRegion() ************* " - - WorkflowException missingCloudRegionWorkflowException = new WorkflowException("DoUpdateNetworkInstance", 2500, "requestDetails has missing 'aic-cloud-region' value/element.") - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) - when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) - when(mockExecution.getVariable("requestAction")).thenReturn("UPDATE") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("vnfId")).thenReturn("") - when(mockExecution.getVariable("volumeGroupId")).thenReturn("") - when(mockExecution.getVariable("networkId")).thenReturn("networkId") - when(mockExecution.getVariable("serviceType")).thenReturn("MOG") - when(mockExecution.getVariable("networkType")).thenReturn("modelName") - - when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest_MissingCloudRegion) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_rollback")).thenReturn("true") - when(mockExecution.getVariable("disableRollback")).thenReturn("true") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - try { - DoUpdateNetworkInstance.preProcessRequest(mockExecution) - } catch (Exception ex) { - println " Test End - Handle catch-throw BpmnError()! " - } - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") - - //verify variable initialization - initializeVariables(mockExecution) - - verify(mockExecution).setVariable("action", "UPDATE") - verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequestMissingCloudRegion) - verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) - verify(mockExecution).setVariable(Prefix + "networkInputs", expectedNetworkInputMissingCloudRegion) - verify(mockExecution).setVariable(Prefix + "messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") - verify(mockExecution).setVariable(Prefix + "source", "VID") - - verify(mockExecution).setVariable(eq("WorkflowException"), refEq(missingCloudRegionWorkflowException)) - - } - - @Test - //@Ignore - public void prepareUpdateNetworkRequest() { - - println "************ prepareNetworkRequest ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedVperNetworkRequest) - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") - when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") - //when(mockExecution.getVariable(Prefix + "queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) - when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("13979:10575713979:105757") - when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("GN_EVPN_Test") - when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("refFQDN1refFQDN2") - when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.prepareUpdateNetworkRequest(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix + "") - - verify(mockExecution).setVariable(Prefix + "updateNetworkRequest", updateNetworkRequest) - - } - - - @Test - //@Ignore - public void prepareUpdateNetworkRequest_NoPhysicalname() { - - println "************ prepareNetworkRequest ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(NetworkRequest_noPhysicalName) - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") - when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") - //when(mockExecution.getVariable(Prefix + "queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) - when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("13979:10575713979:105757") - when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("GN_EVPN_Test") - when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("") - when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.prepareUpdateNetworkRequest(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix + "") - - verify(mockExecution).setVariable(Prefix + "updateNetworkRequest", updateNetworkRequest_noPhysicalName) - - } - - @Test - //@Ignore - public void prepareSDNCRequest() { - - println "************ prepareSDNCRequest ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") - - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.prepareSDNCRequest(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "changeAssignSDNCRequest", changeAssignSDNCRequest) - - } - - @Test - //@Ignore - public void prepareSDNCRollbackRequest() { - - println "************ prepareSDNCRollbackRequest ************* " - - - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(assignResponse) - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.prepareSDNCRollbackRequest(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", sdncRollbackRequest) - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkId_200() { - - println "************ callRESTQueryAAINetworkId ************* " - - WireMock.reset(); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_DoUpdateNetworkInstance_aai_l3_network_uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkId(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "queryIdAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") - verify(mockExecution).setVariable(Prefix + "aaiIdReturnCode", "200") - - } - - @Test - //@Ignore - public void callRESTQueryAAICloudRegion30_200() { - - println "************ callRESTQueryAAICloudRegion30_200 ************* " - - WireMock.reset(); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml", "RDM2WAGPLCP"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "queryCloudRegionRequest", "http://localhost:8090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200") - verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) - - } - - @Test - //@Ignore - public void callRESTQueryAAICloudRegion25_200() { - - println "************ callRESTQueryAAICloudRegion25_200 ************* " - - WireMock.reset(); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "queryCloudRegionRequest", "http://localhost:8090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200") - verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) - - } - - @Test - //@Ignore - public void callRESTQueryAAICloudRegion_NotFound() { - - println "************ callRESTQueryAAICloudRegionFake ************* " - - WireMock.reset(); - MockGetNetworkCloudRegion_404("MDTWNJ21"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestFakeRegion) - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "queryCloudRegionRequest", "http://localhost:8090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/MDTWNJ21") - verify(mockExecution, atLeast(1)).setVariable(Prefix + "queryCloudRegionReturnCode", "404") - verify(mockExecution).setVariable(Prefix + "cloudRegionPo", "MDTWNJ21") - verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc", "AAIAIC25") - verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBinding_200() { - - println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " - - WireMock.reset(); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) // v6 - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vpn_binding_uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "vpnCount", 2) - verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBindingList_200() { - - println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " - - WireMock.reset(); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) // v6 - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vpn_binding_uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "vpnCount", 2) - verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") - - } - - - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBinding_TestScenario01_200() { - - println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " - - WireMock.reset(); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponseTestScenario01) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vpn_binding_uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "vpnCount", 1) - verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") - verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBinding_200_URN_Uri() { - - println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " - - WireMock.reset(); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vpn_binding_uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "vpnCount", 2) - verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBinding_NotPresent() { - - println "************ callRESTQueryAAINetworkVpnBinding_NotPresent ************* " - - WireMock.reset(); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponseVpnNotPresent) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") - verify(mockExecution).setVariable(Prefix + "vpnCount", 0) - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIResponse", aaiVpnResponseStub) - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkTableRef_200() { - - println "************ callRESTQueryAAINetworkTableRef_200 ************* " - - WireMock.reset(); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_network_table_reference_uri")).thenReturn("") - when(mockExecution.getVariable("URN_mso_workflow_DoUpdateNetworkInstance_aai_route_table_reference_uri")).thenReturn("/aai/v8/network/route-table-references/route-table-reference") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkTableRef(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "networkTableRefCount", 2) - verify(mockExecution).setVariable(Prefix + "networkTableRefUriList", ['/aai/v8/network/route-table-references/route-table-reference/refFQDN1','/aai/v8/network/route-table-references/route-table-reference/refFQDN2']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryNetworkTableRefAAIRequest", "http://localhost:8090/aai/v8/network/route-table-references/route-table-reference/refFQDN1?depth=all") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200") - - } - - @Test - //@Ignore - public void callRESTQueryAAINetworkPolicy_200() { - - println "************ callRESTQueryAAINetworkPolicy_200 ************* " - - WireMock.reset(); - MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_network_policy_uri")).thenReturn("/aai/v8/network/network-policies/network-policy") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkPolicy(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "networkPolicyCount", 1) - verify(mockExecution).setVariable(Prefix + "networkPolicyUriList", ['/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryNetworkPolicyAAIRequest", "http://localhost:8090/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg?depth=all") - verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "200") - - } - - - @Test - //@Ignore - public void callRESTReQueryAAINetworkId_200() { - - println "************ callRESTReQueryAAINetworkId ************* " - - WireMock.reset(); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowFormattedResponse) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_DoUpdateNetworkInstance_aai_l3_network_uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTReQueryAAINetworkId(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "requeryIdAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") - verify(mockExecution).setVariable(Prefix + "aaiRequeryIdReturnCode", "200") - - } - - - @Test - //@Ignore - public void callRESTUpdateContrailAAINetworkREST_200() { - - println "************ callRESTUpdateContrailAAINetwork ************* " - - WireMock.reset(); - MockPutNetworkIdWithDepth("UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowFormattedResponse) - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(updateNetworkResponseREST) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("URN_mso_workflow_DoUpdateNetworkInstance_aai_l3_network_uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTUpdateContrailAAINetwork(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "updateContrailAAIUrlRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") - verify(mockExecution).setVariable(Prefix + "updateContrailAAIPayloadRequest", updateContrailAAIPayloadRequest) - verify(mockExecution).setVariable(Prefix + "aaiUpdateContrailReturnCode", "200") - //verify(mockExecution).setVariable(Prefix + "updateContrailAAIResponse", updateContrailAAIResponse) - verify(mockExecution).setVariable(Prefix + "isPONR", true) - - } - - - - @Test - //@Ignore - public void validateUpdateNetworkResponseREST() { - - println "************ validateNetworkResponse ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(updateNetworkResponseREST) - when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('200') - - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.validateUpdateNetworkResponse(mockExecution) - - //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "updateNetworkResponse", updateNetworkResponseREST) - verify(mockExecution).setVariable(Prefix + "isNetworkRollbackNeeded", true) - verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", updateRollbackNetworkRequest) - - } - - @Test - //@Ignore - public void validateUpdateNetworkResponseREST_Error() { - - println "************ validateNetworkResponse ************* " - - WorkflowException workflowException = new WorkflowException("DoUpdateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(networkException500) - when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('500') - - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - try { - DoUpdateNetworkInstance.validateUpdateNetworkResponse(mockExecution) - } catch (Exception ex) { - println " Test End - Handle catch-throw BpmnError()! " - } - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution, atLeast(1)).setVariable("WorkflowException", refEq(workflowException, any(WorkflowException.class))) - - } - - @Test - //@Ignore - public void validateSDNCResponse() { - - println "************ validateSDNCResponse ************* " - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse) - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) - when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "isResponseGood")).thenReturn(true) - - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - try { - DoUpdateNetworkInstance.validateSDNCResponse(mockExecution) - verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) - verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", "") - - } catch (Exception ex) { - println " Graceful Exit - " + ex.getMessage() - } - //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - //verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) - - } - - @Test - //@Ignore - public void validateSDNCResponse_Error() { - - println "************ validateSDNCResponse ************* " - //ExecutionEntity mockExecution = mock(ExecutionEntity.class) - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse_Error) - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(false) - when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "isResponseGood")).thenReturn(true) - - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - try { - DoUpdateNetworkInstance.validateSDNCResponse(mockExecution) - } catch (Exception ex) { - println " Graceful Exit! - " + ex.getMessage() - } - //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - // verify set prefix = Prefix + "" - //verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false) - - } - - @Test - //@Ignore - public void prepareRollbackData() { - - println "************ prepareRollbackData() ************* " - - - - WorkflowException workflowException = new WorkflowException("DoUpdateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn(rollbackSDNCRequest) - when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(rollbackNetworkRequest) - when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.prepareRollbackData(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - } - - @Test - //@Ignore - public void postProcessResponse() { - - println "************ postProcessResponse() ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "isException")).thenReturn(false) - when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") - when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn(rollbackSDNCRequest) - when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(rollbackSDNCRequest) - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable("mso-request-id")).thenReturn("requestId") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.postProcessResponse(mockExecution) - - verify(mockExecution, atLeast(3)).getVariable("isDebugLogEnabled") - verify(mockExecution, atLeast(3)).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "Success", true) - - } - - private ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("DoUpdateNetworkInstance") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoUpdateNetworkInstance") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("DoUpdateNetworkInstance") - when(mockExecution.getProcessInstanceId()).thenReturn("DoUpdateNetworkInstance") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - - return mockExecution - } - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy deleted file mode 100644 index 063f4b571b..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy +++ /dev/null @@ -1,175 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import static org.mockito.Mockito.* - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.camunda.bpm.engine.runtime.Execution -import org.junit.Before -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil - - -import com.github.tomakehurst.wiremock.junit.WireMockRule - -@RunWith(MockitoJUnitRunner.class) -class SacleCustomE2EServiceInstanceTest{ - @Rule - public WireMockRule wireMockRule = new WireMockRule(8090); - - String Prefix="CRESI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - String globalSubscriberId="test_custormer" - String requestDescription = "request description for test" - def utils = new MsoUtils() - - String jsonIncomingRequest = """{"service":{ - "serviceType":"example-service-type", - "globalSubscriberId":"test_custormer", - "resources":[ - { - "resourceInstanceId":"ns111", - "scaleType":"SCALE_NS", - "scaleNsData":{ - "scaleNsByStepsData":{ - "numberOfSteps":"4", - "aspectId":"TIC_EDGE_HW", - "scalingDirection":"UP" - } - } - }, - { - "resourceInstanceId":"ns333", - "scaleType":"SCALE_NS", - "scaleNsData":{ - "scaleNsByStepsData":{ - "numberOfSteps":"4", - "aspectId":"TIC_EDGE_HW", - "scalingDirection":"UP" - } - } - }], - "serviceInstanceName":"XXXX" - }, - "operationId":"0a5b1651-c56e-4263-8c26-c8f8a6ef72d8" - }""" - - String xmlMsoCompletionRequest = """ - - 56c881ad-6c9d-4b79-aacc-401e5640b47f - SCALE - null - - Service Instance was scaled successfully. - 56c881ad-6c9d-4b79-aacc-401e5640b47f - ScaleGenericALaCarteServiceInstance -""" - - String requestInfo = """ - 56c881ad-6c9d-4b79-aacc-401e5640b47f - SCALE - null - """ - - String payload =""" - - - - 56c881ad-6c9d-4b79-aacc-401e5640b47f - 0a5b1651-c56e-4263-8c26-c8f8a6ef72d8 - SCALE - - processing - Prepare service scaling - 0 - - - - """ - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - @Test - public void preProcessRequestTest() { - println "************ preProcessRequest_Payload ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) - - when(mockExecution.getVariable("mso-request-id")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") - - ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() - scaleCustomE2EServiceInstance.preProcessRequest(mockExecution) - - verify(mockExecution).setVariable("globalSubscriberId", globalSubscriberId) - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable("requestDescription", requestDescription) - } - - @Test - public void sendSyncResponseTest() { - println "************ sendSyncResponse ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("operationId")).thenReturn("3338b250-e995-4782-8936-081b66ba4dbf") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") - - ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() - scaleCustomE2EServiceInstance.sendSyncResponse(mockExecution) - - verify(mockExecution).setVariable("sentSyncResponse", true) - } - - @Test - public void prepareCompletionRequestTest() { - println "************ prepareCompletionRequest ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("msoRequestId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") - - ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() - scaleCustomE2EServiceInstance.prepareCompletionRequest(mockExecution) - - verify(mockExecution).setVariable("CompleteMsoProcessRequest", xmlMsoCompletionRequest) - - } - - @Test - public void prepareInitServiceOperationStatusTest() { - println "************ prepareInitServiceOperationStatus ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") - //when(mockExecution.getVariable("serviceInstanceName")).thenReturn("XXXX") - when(mockExecution.getVariable("operationId")).thenReturn("0a5b1651-c56e-4263-8c26-c8f8a6ef72d8") - - ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() - scaleCustomE2EServiceInstance.prepareInitServiceOperationStatus(mockExecution) - - payload = utils.formatXml(payload) - verify(mockExecution).setVariable("CVFMI_updateServiceOperStatusRequest", payload) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstanceTest.groovy deleted file mode 100644 index 4c77a04701..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstanceTest.groovy +++ /dev/null @@ -1,368 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts - -import static org.mockito.Mockito.* - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.junit.Before -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.core.WorkflowException - -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.apache.commons.lang3.* - - -@RunWith(MockitoJUnitRunner.class) -class UpdateNetworkInstanceTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(8090); - - String Prefix="UPDNI_" - def utils = new MsoUtils() - - String createDBRequestError = -""" - - - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - BPMN - Received error from SDN-C: No availability zone available - - FAILED - <network-id></network-id><network-name></network-names> - - - """ - - String falloutHandlerRequest = - """ - - b69c9054-da09-4a2c-adf5-51042b62bfac - UPDATE - VID - - - Received error from SDN-C: No availability zone available. - 5300 - - """ - - String completeMsoProcessRequest = - """ - - 88f65519-9a38-4c4b-8445-9eb4a5a5af56 - UPDATE - VID - - Network has been updated successfully. - BPMN Network action: UPDATE -""" - - -String jsonIncomingRequest = -"""{ "requestDetails": { - "modelInfo": { - "modelType": "networkTyp", - "modelId": "modelId", - "modelNameVersionId": "modelNameVersionId", - "modelName": "CONTRAIL_EXTERNAL", - "modelVersion": "1" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "RDM2WAGPLCP", - "tenantId": "7dd5365547234ee8937416c65507d266" - }, - "requestInfo": { - "instanceName": "MNS-25180-L-01-dmz_direct_net_1", - "source": "VID", - "callbackUrl": "", - "suppressRollback": true, - "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", - "modelInfo": { - "modelType": "serviceT", - "modelId": "modelI", - "modelNameVersionId": "modelNameVersionI", - "modelName": "modleNam", - "modelVersion": "1" - } - } - } - ], - "requestParameters": { - "userParams": [ - { - "name": "someUserParam1", - "value": "someValue1" - } - ] - } - }}""" - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - - } - - public void initializeVariables(DelegateExecution mockExecution) { - - verify(mockExecution).setVariable(Prefix + "source", "") - verify(mockExecution).setVariable(Prefix + "Success", false) - - verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", "") - verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", "") - - } - - @Test - //@Ignore - public void preProcessRequest() { - - println "************ preProcessRequest() ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) - - when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - - // preProcessRequest(DelegateExecution execution) - UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() - UpdateNetworkInstance.preProcessRequest(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - initializeVariables(mockExecution) - //verify(mockExecution).setVariable(Prefix + "Success", false) - - } - - - @Test - //@Ignore - public void getNetworkModelInfo() { - - println "************ getNetworkModelInfo() ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - - // preProcessRequest(DelegateExecution execution) - UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() - UpdateNetworkInstance.getNetworkModelInfo(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - } - - @Test - //@Ignore - public void sendSyncResponse() { - - println "************ sendSyncResponse ************* " - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) - when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - // preProcessRequest(DelegateExecution execution) - UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() - UpdateNetworkInstance.sendSyncResponse(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable("UpdateNetworkInstanceResponseCode", "202") - - } - - @Test - //@Ignore - public void sendSyncError() { - - println "************ sendSyncError ************* " - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) - when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() - UpdateNetworkInstance.sendSyncError(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable("UpdateNetworkInstanceResponseCode", "500") - - } - - @Test - //@Ignore - public void prepareDBRequestError() { - - println "************ prepareDBRequestError ************* " - - WorkflowException sndcWorkflowException = new WorkflowException("UpdateNetworkInstance", 500, "Received error from SDN-C: No availability zone available") - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowException) - //when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("networkId")).thenReturn("") - when(mockExecution.getVariable("networkName")).thenReturn("") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - - when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - - // preProcessRequest(DelegateExecution execution) - UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() - UpdateNetworkInstance.prepareDBRequestError(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "createDBRequest", createDBRequestError) - - } - - - @Test - //@Ignore - public void prepareCompletion() { - - println "************ postProcessResponse ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable(Prefix + "dbReturnCode")).thenReturn("200") - - // postProcessResponse(DelegateExecution execution) - UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() - UpdateNetworkInstance.prepareCompletion(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "Success", true) - verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", completeMsoProcessRequest) - - } - - @Test - //@Ignore - public void buildErrorResponse() { - - println "************ buildErrorResponse ************* " - - - WorkflowException sndcWorkflowException = new WorkflowException("UpdateNetworkInstance", 5300, "Received error from SDN-C: No availability zone available.") - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso-request-id")).thenReturn("b69c9054-da09-4a2c-adf5-51042b62bfac") - //when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowException) - when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowException) - - // buildErrorResponse(DelegateExecution execution) - UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() - UpdateNetworkInstance.buildErrorResponse(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) - verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - - //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - } - - @Test - //@Ignore - public void postProcessResponse() { - - println "************ postProcessResponse() ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("CMSO_ResponseCode")).thenReturn("200") - - // postProcessResponse(DelegateExecution execution) - UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() - UpdateNetworkInstance.postProcessResponse(mockExecution) - - //verify(mockExecution).getVariable("isDebugLogEnabled") - //verify(mockExecution).setVariable("prefix", Prefix) - - verify(mockExecution).setVariable(Prefix + "Success", true) - - } - - @Test - //@Ignore - public void processRollbackData() { - - println "************ callDBCatalog() ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - - // preProcessRequest(DelegateExecution execution) - UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() - UpdateNetworkInstance.processRollbackData(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - } - - private ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("UpdateNetworkInstance") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("UpdateNetworkInstance") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("UpdateNetworkInstance") - when(mockExecution.getProcessInstanceId()).thenReturn("UpdateNetworkInstance") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - - return mockExecution - } - -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy deleted file mode 100644 index 9459cd4a7d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy +++ /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.bpmn.infrastructure.scripts; - -import static org.junit.Assert.* -import static org.mockito.Mockito.* - -import org.junit.Before -import org.junit.Ignore -import org.junit.Rule -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner - -import com.github.tomakehurst.wiremock.junit.WireMockRule - -@RunWith(MockitoJUnitRunner.class) -@Ignore // No Junits exists in this class to run -class UpdateVfModuleVolumeInfraV1Test { - - String xml = """ - - - tenant - https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ - - tenant.tenant-id - fba1bd1e195a404cacb9ce17a9b2b421 - - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - mdt1 - - - tenant.tenant-name - ECOMP_MDT1 - - - - vf-module - https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ - - vf-module.vf-module-ids - fba1bd1e195a404cacb9ce17a9b2b421 - - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - mdt1 - - - vf-module.vf-module-name - ECOMP_MDT1 - - - -""" - - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy deleted file mode 100644 index a8401d7a02..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy +++ /dev/null @@ -1,1269 +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.bpmn.vcpe.scripts - - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Before -import org.junit.BeforeClass -import org.junit.Rule -import org.junit.Test -import org.junit.Ignore -import org.mockito.MockitoAnnotations -import org.camunda.bpm.engine.delegate.BpmnError -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.domain.HomingSolution -import org.openecomp.mso.bpmn.mock.FileUtil - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse -import static com.github.tomakehurst.wiremock.client.WireMock.get -import static com.github.tomakehurst.wiremock.client.WireMock.patch -import static com.github.tomakehurst.wiremock.client.WireMock.put -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching -import static org.junit.Assert.*; -import static org.mockito.Mockito.* -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.core.domain.AllottedResource -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.HomingSolution -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.vcpe.scripts.MapGetter -import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter - -import com.github.tomakehurst.wiremock.junit.WireMockRule - -class CreateVcpeResCustServiceTest extends GroovyTestBase { - - private static String request - - @Rule - public WireMockRule wireMockRule = new WireMockRule(PORT) - - String Prefix = "CVRCS_" - String RbType = "DCRENI_" - - @BeforeClass - public static void setUpBeforeClass() { - request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/request.json") - } - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - public CreateVcpeResCustServiceTest() { - super("CreateVcpeResCustService") - } - - - // ***** preProcessRequest ***** - - @Test - @Ignore // 1802 merge - public void preProcessRequest() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.preProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("prefix", Prefix) - verify(mex).setVariable("aaiDistDelay", "aaidelay") - verify(mex).setVariable("createVcpeServiceRequest", request) - verify(mex).setVariable("msoRequestId", "mri") - assertEquals("sii", map.get("serviceInstanceId")) - verify(mex).setVariable("requestAction", "ra") - verify(mex).setVariable("source", "VID") - verify(mex).setVariable("globalSubscriberId", CUST) - verify(mex).setVariable("globalCustomerId", CUST) - verify(mex).setVariable("subscriptionServiceType", SVC) - verify(mex).setVariable("disableRollback", "false") - verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") - assertTrue(map.containsKey("subscriberInfo")) - - verify(mex).setVariable("brgWanMacAddress", "brgmac") - verify(mex).setVariable("customerLocation", ["customerLatitude":"32.897480", "customerLongitude":"-97.040443", "customerName":"some_company"]) - verify(mex).setVariable("homingService", "sniro") - assertTrue(map.containsKey("serviceInputParams")) - assertTrue(map.containsKey(Prefix+"requestInfo")) - - def reqinfo = map.get(Prefix+"requestInfo") - assertTrue(reqinfo.indexOf("mri= 0) - assertTrue(reqinfo.indexOf("VID= 0) - } - - @Test - // @Ignore - public void preProcessRequest_MissingAaiDistDelay() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - - when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn(null) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) })) - } - - @Test - @Ignore // 1802 merge - public void preProcessRequest_EmptyParts() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - - def req = request - .replace('"source"', '"sourceXXX"') - .replace('"BRG_WAN_MAC_Address"', '"BRG_WAN_MAC_AddressXXX"') - .replace('"Customer_Location"', '"Customer_LocationXXX"') - - when(mex.getVariable("bpmnRequest")).thenReturn(req) - when(mex.getVariable("serviceInstanceId")).thenReturn(null) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.preProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("prefix", Prefix) - verify(mex).setVariable("createVcpeServiceRequest", req) - verify(mex).setVariable("msoRequestId", "mri") - assertNotNull(map.get("serviceInstanceId")) - assertFalse(map.get("serviceInstanceId").isEmpty()) - verify(mex).setVariable("requestAction", "ra") - verify(mex).setVariable("source", "VID") - verify(mex).setVariable("globalSubscriberId", CUST) - verify(mex).setVariable("globalCustomerId", CUST) - verify(mex).setVariable("subscriptionServiceType", SVC) - verify(mex).setVariable("disableRollback", "false") - verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") - assertTrue(map.containsKey("subscriberInfo")) - - assertEquals("", map.get("brgWanMacAddress")) - assertEquals("", map.get("customerLocation")) - assertEquals("oof", map.get("homingService")) - assertTrue(map.containsKey("serviceInputParams")) - assertTrue(map.containsKey(Prefix+"requestInfo")) - - def reqinfo = map.get(Prefix+"requestInfo") - println reqinfo - assertTrue(reqinfo.indexOf("mri= 0) - assertTrue(reqinfo.indexOf("VID= 0) - } - - @Test - // @Ignore - public void preProcessRequest_MissingSubscriberId() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - - def req = request - .replace('"globalSubscriberId"', '"globalSubscriberIdXXX"') - - when(mex.getVariable("bpmnRequest")).thenReturn(req) - when(mex.getVariable("serviceInstanceId")).thenReturn(null) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) })) - } - - @Test - // @Ignore - public void preProcessRequest_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("bpmnRequest")).thenThrow(new BpmnError("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) })) - } - - @Test - // @Ignore - public void preProcessRequest_Ex() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("bpmnRequest")).thenThrow(new RuntimeException("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) })) - } - - // ***** sendSyncResponse ***** - - @Test - // @Ignore - public void sendSyncResponse() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initSendSyncResponse(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.sendSyncResponse(mex) - - verify(mex, times(2)).getVariable(DBGFLAG) - - verify(mex).setVariable(processName+"WorkflowResponseSent", "true") - - assertEquals("202", map.get(processName+"ResponseCode")) - assertEquals("Success", map.get(processName+"Status")) - - def resp = map.get(processName+"Response") - - assertTrue(resp.indexOf('"instanceId":"sii"') >= 0) - assertTrue(resp.indexOf('"requestId":"mri"') >= 0) - } - - @Test - // @Ignore - public void sendSyncResponse_Ex() { - ExecutionEntity mex = setupMock() - initSendSyncResponse(mex) - - when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.sendSyncResponse(mex) })) - } - - - // ***** prepareDecomposeService ***** - - @Test - // @Ignore - public void prepareDecomposeService() { - ExecutionEntity mex = setupMock() - initPrepareDecomposeService(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.prepareDecomposeService(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("serviceModelInfo", "mi") - } - - @Test - // @Ignore - public void prepareDecomposeService_Ex() { - ExecutionEntity mex = setupMock() - initPrepareDecomposeService(mex) - - when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareDecomposeService(mex) })) - } - - - // ***** prepareCreateServiceInstance ***** - - @Test - // @Ignore - public void prepareCreateServiceInstance() { - ExecutionEntity mex = setupMock() - initPrepareCreateServiceInstance(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.prepareCreateServiceInstance(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("serviceInstanceName", "VCPE1") - verify(mex).setVariable("serviceDecompositionString", "mydecomp") - } - - @Test - // @Ignore - public void prepareCreateServiceInstance_Ex() { - ExecutionEntity mex = setupMock() - initPrepareCreateServiceInstance(mex) - - when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareCreateServiceInstance(mex) })) - } - - - // ***** postProcessServiceInstanceCreate ***** - - @Test - // @Ignore - public void postProcessServiceInstanceCreate() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPostProcessServiceInstanceCreate(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.postProcessServiceInstanceCreate(mex) - - verify(mex).getVariable(DBGFLAG) - - def reqinfo = map.get(Prefix+"setUpdateDbInstancePayload") - - assertTrue(reqinfo.indexOf("mri= 0) - assertTrue(reqinfo.indexOf("sii= 0) - assertTrue(reqinfo.indexOf("sin= 0) - } - - @Test - // @Ignore - public void postProcessServiceInstanceCreate_BpmnError() { - ExecutionEntity mex = setupMock() - initPostProcessServiceInstanceCreate(mex) - - doThrow(new BpmnError("expected exception")).when(mex).setVariable(endsWith("setUpdateDbInstancePayload"), any()) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessServiceInstanceCreate(mex) })) - } - - @Test - // @Ignore - public void postProcessServiceInstanceCreate_Ex() { - ExecutionEntity mex = setupMock() - initPostProcessServiceInstanceCreate(mex) - - doThrow(new RuntimeException("expected exception")).when(mex).setVariable(endsWith("setUpdateDbInstancePayload"), any()) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessServiceInstanceCreate(mex) })) - } - - - // ***** processDecomposition ***** - - @Test - // @Ignore - public void processDecomposition() { - ExecutionEntity mex = setupMock() - def svcdecomp = initProcessDecomposition(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.processDecomposition(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex).setVariable("vnfList", svcdecomp.getServiceVnfs()) - verify(mex).setVariable("vnfListString", '[myvnf]') - verify(mex).setVariable(Prefix+"VNFsCount", 1) - - verify(mex).setVariable("vnfModelInfo", "mymodel") - verify(mex).setVariable("vnfModelInfoString", "mymodel") - } - - @Test - // @Ignore - public void processDecomposition_EmptyNet_EmptyVnf() { - ExecutionEntity mex = setupMock() - def svcdecomp = initProcessDecomposition(mex) - - when(svcdecomp.getServiceVnfs()).thenReturn(new LinkedList()) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.processDecomposition(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex).setVariable("vnfList", svcdecomp.getServiceVnfs()) - verify(mex).setVariable("vnfListString", '[]') - verify(mex).setVariable(Prefix+"VNFsCount", 0) - - verify(mex).setVariable("vnfModelInfo", "") - verify(mex).setVariable("vnfModelInfoString", "") - } - - @Test - // @Ignore - public void processDecomposition_Ex() { - ExecutionEntity mex = setupMock() - def svcdecomp = initProcessDecomposition(mex) - - when(svcdecomp.getServiceVnfs()).thenThrow(new RuntimeException("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.processDecomposition(mex) })) - } - - - // ***** filterVnfs ***** - - @Test - // @Ignore - public void filterVnfs() { - ExecutionEntity mex = setupMock() - def svcdecomp = initFilterVnfs(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.processDecomposition(mex) - - verify(mex).setVariable("vnfListString", '[myvnf3, myvnf5]') - } - - @Test - // @Ignore - public void filterVnfs_Null() { - ExecutionEntity mex = setupMock() - def svcdecomp = initFilterVnfs(mex) - - when(svcdecomp.getServiceVnfs()).thenReturn(null) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.processDecomposition(mex) - - // nothing more to check, as long as it didn't throw an exception - } - - - // ***** prepareCreateAllottedResourceTXC ***** - - @Test - // @Ignore - public void prepareCreateAllottedResourceTXC() { - ExecutionEntity mex = setupMock() - initPrepareCreateAllottedResourceTXC(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.prepareCreateAllottedResourceTXC(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex).setVariable("createTXCAR", true) - verify(mex).setVariable("allottedResourceModelInfoTXC", "modelB") - verify(mex).setVariable("allottedResourceRoleTXC", "TXCr") - verify(mex).setVariable("allottedResourceTypeTXC", "Tunnel XConn") - verify(mex).setVariable("parentServiceInstanceIdTXC", "homeB") - } - - @Test - // @Ignore - public void prepareCreateAllottedResourceTXC_NullArList() { - ExecutionEntity mex = setupMock() - def svcdecomp = initPrepareCreateAllottedResourceTXC(mex) - - when(svcdecomp.getServiceAllottedResources()).thenReturn(null) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.prepareCreateAllottedResourceTXC(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex, never()).setVariable("createTXCAR", true) - verify(mex, never()).setVariable("allottedResourceModelInfoTXC", "modelB") - verify(mex, never()).setVariable("allottedResourceRoleTXC", "TXCr") - verify(mex, never()).setVariable("allottedResourceTypeTXC", "Tunnel XConn") - verify(mex, never()).setVariable("parentServiceInstanceIdTXC", "homeB") - } - - @Test - // @Ignore - public void prepareCreateAllottedResourceTXC_Ex() { - ExecutionEntity mex = setupMock() - initPrepareCreateAllottedResourceTXC(mex) - - when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareCreateAllottedResourceTXC(mex) })) - } - - - // ***** prepareCreateAllottedResourceBRG ***** - - @Test - // @Ignore - public void prepareCreateAllottedResourceBRG() { - ExecutionEntity mex = setupMock() - initPrepareCreateAllottedResourceBRG(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.prepareCreateAllottedResourceBRG(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex).setVariable("createBRGAR", true) - verify(mex).setVariable("allottedResourceModelInfoBRG", "modelB") - verify(mex).setVariable("allottedResourceRoleBRG", "BRGr") - verify(mex).setVariable("allottedResourceTypeBRG", "BRG") - verify(mex).setVariable("parentServiceInstanceIdBRG", "homeB") - } - - @Test - // @Ignore - public void prepareCreateAllottedResourceBRG_NullArList() { - ExecutionEntity mex = setupMock() - def svcdecomp = initPrepareCreateAllottedResourceBRG(mex) - - when(svcdecomp.getServiceAllottedResources()).thenReturn(null) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.prepareCreateAllottedResourceBRG(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex, never()).setVariable("createBRGAR", true) - verify(mex, never()).setVariable("allottedResourceModelInfoBRG", "modelB") - verify(mex, never()).setVariable("allottedResourceRoleBRG", "BRGr") - verify(mex, never()).setVariable("allottedResourceTypeBRG", "BRG") - verify(mex, never()).setVariable("parentServiceInstanceIdBRG", "homeB") - } - - @Test - // @Ignore - public void prepareCreateAllottedResourceBRG_Ex() { - ExecutionEntity mex = setupMock() - initPrepareCreateAllottedResourceBRG(mex) - - when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareCreateAllottedResourceBRG(mex) })) - } - - - // ***** prepareVnfAndModulesCreate ***** - - @Test - // @Ignore - public void prepareVnfAndModulesCreate() { - ExecutionEntity mex = setupMock() - initPrepareVnfAndModulesCreate(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.prepareVnfAndModulesCreate(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") - verify(mex).setVariable("lcpCloudRegionId", "mdt1") - verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba") - } - - @Test - // @Ignore - public void prepareVnfAndModulesCreate_EmptyList() { - ExecutionEntity mex = setupMock() - initPrepareVnfAndModulesCreate(mex) - - when(mex.getVariable("vnfList")).thenReturn(new LinkedList()) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.prepareVnfAndModulesCreate(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") - verify(mex).setVariable("lcpCloudRegionId", "mdt1") - verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba") - } - - @Test - // @Ignore - public void prepareVnfAndModulesCreate_NullList() { - ExecutionEntity mex = setupMock() - initPrepareVnfAndModulesCreate(mex) - - when(mex.getVariable("vnfList")).thenReturn(null) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.prepareVnfAndModulesCreate(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") - verify(mex).setVariable("lcpCloudRegionId", "mdt1") - verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba") - } - - @Test - // @Ignore - public void prepareVnfAndModulesCreate_Ex() { - ExecutionEntity mex = setupMock() - initPrepareVnfAndModulesCreate(mex) - - when(mex.getVariable("vnfList")).thenThrow(new RuntimeException("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareVnfAndModulesCreate(mex) })) - } - - - // ***** validateVnfCreate ***** - - @Test - // @Ignore - public void validateVnfCreate() { - ExecutionEntity mex = setupMock() - initValidateVnfCreate(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.validateVnfCreate(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex).setVariable(Prefix+"VnfsCreatedCount", 3) - } - - @Test - // @Ignore - public void validateVnfCreate_Ex() { - ExecutionEntity mex = setupMock() - initValidateVnfCreate(mex) - - when(mex.getVariable(Prefix+"VnfsCreatedCount")).thenThrow(new RuntimeException("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.validateVnfCreate(mex) })) - } - - - // ***** postProcessResponse ***** - - @Test - // @Ignore - public void postProcessResponse() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPostProcessResponse(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.postProcessResponse(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex).setVariable(Prefix+"Success", true) - - def reqinfo = map.get(Prefix+"CompleteMsoProcessRequest") - - assertTrue(reqinfo.indexOf("request-id>mri= 0) - assertTrue(reqinfo.indexOf("source>mysrc= 0) - assertTrue(reqinfo.indexOf("serviceInstanceId>sii= 0) - } - - @Test - // @Ignore - public void postProcessResponse_BpmnError() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPostProcessResponse(mex) - - when(mex.getVariable("source")).thenThrow(new BpmnError("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessResponse(mex) })) - } - - @Test - // @Ignore - public void postProcessResponse_Ex() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPostProcessResponse(mex) - - when(mex.getVariable("source")).thenThrow(new RuntimeException("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessResponse(mex) })) - } - - - // ***** preProcessRollback ***** - - @Test - // @Ignore - public void preProcessRollback() { - ExecutionEntity mex = setupMock() - def wfe = initPreProcessRollback(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.preProcessRollback(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex).setVariable("prevWorkflowException", wfe) - } - - @Test - // @Ignore - public void preProcessRollback_NullWfe() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - def wfe = initPreProcessRollback(mex) - - when(mex.getVariable("WorkflowException")).thenReturn(null) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.preProcessRollback(mex) - - verify(mex).getVariable(DBGFLAG) - - assertFalse(map.containsKey("prevWorkflowException")) - } - - @Test - // @Ignore - public void preProcessRollback_BpmnError() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - def wfe = initPreProcessRollback(mex) - - when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.preProcessRollback(mex) - - verify(mex).getVariable(DBGFLAG) - - assertFalse(map.containsKey("prevWorkflowException")) - } - - @Test - // @Ignore - public void preProcessRollback_Ex() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - def wfe = initPreProcessRollback(mex) - - when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.preProcessRollback(mex) - - verify(mex).getVariable(DBGFLAG) - - assertFalse(map.containsKey("prevWorkflowException")) - } - - - // ***** postProcessRollback ***** - - @Test - // @Ignore - public void postProcessRollback() { - ExecutionEntity mex = setupMock() - def wfe = initPostProcessRollback(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.postProcessRollback(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex).setVariable("WorkflowException", wfe) - } - - @Test - // @Ignore - public void postProcessRollback_NullWfe() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - def wfe = initPostProcessRollback(mex) - - when(mex.getVariable("prevWorkflowException")).thenReturn(null) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.postProcessRollback(mex) - - verify(mex).getVariable(DBGFLAG) - - assertFalse(map.containsKey("WorkflowException")) - } - - @Test - // @Ignore - public void postProcessRollback_BpmnError() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - def wfe = initPostProcessRollback(mex) - - when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessRollback(mex) })) - } - - @Test - // @Ignore - public void postProcessRollback_Ex() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - def wfe = initPostProcessRollback(mex) - - when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.postProcessRollback(mex) - - verify(mex).getVariable(DBGFLAG) - - assertFalse(map.containsKey("WorkflowException")) - } - - - // ***** prepareFalloutRequest ***** - - @Test - // @Ignore - public void prepareFalloutRequest() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPrepareFalloutRequest(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.prepareFalloutRequest(mex) - - verify(mex, times(2)).getVariable(DBGFLAG) - - def fo = map.get(Prefix+"falloutRequest") - - assertTrue(fo.indexOf("world= 0) - assertTrue(fo.indexOf("ErrorMessage>mymsg= 0) - assertTrue(fo.indexOf("ErrorCode>999= 0) - } - - @Test - // @Ignore - public void prepareFalloutRequest_Ex() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPrepareFalloutRequest(mex) - - when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareFalloutRequest(mex) })) - } - - // ***** sendSyncError ***** - - @Test - // @Ignore - public void sendSyncError() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initSendSyncError(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.sendSyncError(mex) - - verify(mex, times(2)).getVariable(DBGFLAG) - - verify(mex).setVariable(processName+"WorkflowResponseSent", "true") - - assertEquals("500", map.get(processName+"ResponseCode")) - assertEquals("Fail", map.get(processName+"Status")) - - def resp = map.get(processName+"Response") - - assertTrue(resp.indexOf("ErrorMessage>mymsg= 0) - - verify(mex).setVariable("WorkflowResponse", resp) - } - - @Test - // @Ignore - public void sendSyncError_NotWfe() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initSendSyncError(mex) - - when(mex.getVariable("WorkflowException")).thenReturn("not a WFE") - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.sendSyncError(mex) - - verify(mex, times(2)).getVariable(DBGFLAG) - - verify(mex).setVariable(processName+"WorkflowResponseSent", "true") - - assertEquals("500", map.get(processName+"ResponseCode")) - assertEquals("Fail", map.get(processName+"Status")) - - def resp = map.get(processName+"Response") - - assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.= 0) - - verify(mex).setVariable("WorkflowResponse", resp) - } - - @Test - // @Ignore - public void sendSyncError_NullWfe() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initSendSyncError(mex) - - when(mex.getVariable("WorkflowException")).thenReturn(null) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - CreateVcpeResCustService.sendSyncError(mex) - - verify(mex, times(2)).getVariable(DBGFLAG) - - verify(mex).setVariable(processName+"WorkflowResponseSent", "true") - - assertEquals("500", map.get(processName+"ResponseCode")) - assertEquals("Fail", map.get(processName+"Status")) - - def resp = map.get(processName+"Response") - - assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.= 0) - - verify(mex).setVariable("WorkflowResponse", resp) - } - - @Test - // @Ignore - public void sendSyncError_Ex() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initSendSyncError(mex) - - when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - CreateVcpeResCustService.sendSyncError(mex) - - assertFalse(map.containsKey(processName+"ResponseCode")) - } - - - // ***** processJavaException ***** - - @Test - // @Ignore - public void processJavaException() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initProcessJavaException(mex) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.processJavaException(mex) })) - - verify(mex, times(2)).getVariable(DBGFLAG) - - verify(mex).setVariable("prefix", Prefix) - - def wfe = map.get("WorkflowException") - - assertEquals("Caught a Java Lang Exception", wfe.getErrorMessage()) - } - - @Test - // @Ignore - public void processJavaException_BpmnError() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initProcessJavaException(mex) - - when(mex.getVariables()).thenThrow(new BpmnError("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.processJavaException(mex) })) - - assertFalse(map.containsKey("WorkflowException")) - } - - @Test - // @Ignore - public void processJavaException_Ex() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initProcessJavaException(mex) - - when(mex.getVariables()).thenThrow(new RuntimeException("expected exception")) - - CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() - - assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.processJavaException(mex) })) - - def wfe = map.get("WorkflowException") - - assertEquals("Exception in processJavaException method", wfe.getErrorMessage()) - } - - - private void initPreProcess(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("bpmnRequest")).thenReturn(request) - when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("aaidelay") - when(mex.getVariable("mso-request-id")).thenReturn("mri") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("requestAction")).thenReturn("ra") - } - - private initSendSyncResponse(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("mso-request-id")).thenReturn("mri") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - } - - private void initPrepareDecomposeService(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("createVcpeServiceRequest")).thenReturn('{"requestDetails":{"modelInfo":"mi"}}') - } - - private void initPrepareCreateServiceInstance(ExecutionEntity mex) { - ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class) - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request) - when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp) - - when(svcdecomp.toJsonStringNoRootName()).thenReturn("mydecomp") - } - - private void initPostProcessServiceInstanceCreate(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("mso-request-id")).thenReturn("mri") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("serviceInstanceName")).thenReturn("sin") - } - - private ServiceDecomposition initProcessDecomposition(ExecutionEntity mex) { - List vnflst = new LinkedList<>() - vnflst.add(makeVnf("", "")) - vnflst.add(makeVnf("2", "BRG")) - vnflst.add(makeVnf("3", "BRG")) - - ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class) - when(svcdecomp.getServiceVnfs()).thenReturn(vnflst) - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp) - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("serviceInstanceName")).thenReturn("sin") - - return svcdecomp - } - - private ServiceDecomposition initFilterVnfs(ExecutionEntity mex) { - List vnflst = new LinkedList<>() - vnflst.add(makeVnf("", "BRG")) - vnflst.add(makeVnf("2", "Tunnel XConn")) - vnflst.add(makeVnf("3", "")) - vnflst.add(makeVnf("4", "BRG")) - vnflst.add(makeVnf("5", "other")) - - ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class) - when(svcdecomp.getServiceVnfs()).thenReturn(vnflst) - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp) - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("serviceInstanceName")).thenReturn("sin") - - return svcdecomp - } - - private initAwaitAaiDistribution(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - } - - private ServiceDecomposition initPrepareCreateAllottedResourceTXC(ExecutionEntity mex) { - ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class) - List arlst = new LinkedList<>() - - arlst.add(makeArBRG("A")) - arlst.add(makeArTXC("B")) - arlst.add(makeArBRG("C")) - - when(svcdecomp.getServiceAllottedResources()).thenReturn(arlst) - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request) - when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp) - when(mex.getVariable("allottedResourceId")).thenReturn(ARID) - - return svcdecomp - } - - private ServiceDecomposition initPrepareCreateAllottedResourceBRG(ExecutionEntity mex) { - ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class) - List arlst = new LinkedList<>() - - arlst.add(makeArTXC("A")) - arlst.add(makeArBRG("B")) - arlst.add(makeArTXC("C")) - - when(svcdecomp.getServiceAllottedResources()).thenReturn(arlst) - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request) - when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp) - when(mex.getVariable("allottedResourceId")).thenReturn(ARID) - - return svcdecomp - } - - private AllottedResource makeArTXC(String id) { - AllottedResource ar = mock(AllottedResource.class) - ModelInfo mod = mock(ModelInfo.class) - HomingSolution home = mock(HomingSolution.class) - - when(ar.toJsonStringNoRootName()).thenReturn("json"+id) - when(ar.getAllottedResourceType()).thenReturn("Tunnel XConn") - when(ar.getModelInfo()).thenReturn(mod) - when(ar.getAllottedResourceRole()).thenReturn("TXCr") - when(ar.getHomingSolution()).thenReturn(home) - - when(mod.toJsonStringNoRootName()).thenReturn("model"+id) - - when(home.getServiceInstanceId()).thenReturn("home"+id) - - return ar - } - - private AllottedResource makeArBRG(String id) { - AllottedResource ar = mock(AllottedResource.class) - ModelInfo mod = mock(ModelInfo.class) - HomingSolution home = mock(HomingSolution.class) - - when(ar.toJsonStringNoRootName()).thenReturn("json"+id) - when(ar.getAllottedResourceType()).thenReturn("BRG") - when(ar.getModelInfo()).thenReturn(mod) - when(ar.getAllottedResourceRole()).thenReturn("BRGr") - when(ar.getHomingSolution()).thenReturn(home) - - when(mod.toJsonStringNoRootName()).thenReturn("model"+id) - - when(home.getServiceInstanceId()).thenReturn("home"+id) - - return ar - } - - private initPrepareVnfAndModulesCreate(ExecutionEntity mex) { - - List vnflst = new LinkedList<>() - - vnflst.add(makeVnf("A", "BRG")) - vnflst.add(makeVnf("B", "")) - vnflst.add(makeVnf("C", "")) - vnflst.add(makeVnf("D", "Tunnel XConn")) - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request) - when(mex.getVariable("vnfList")).thenReturn(vnflst) - when(mex.getVariable(Prefix+"VnfsCreatedCount")).thenReturn(2) - when(mex.getVariable("vnfModelInfo")).thenReturn("nomodel") - when(mex.getVariable("sdncVersion")).thenReturn("myvers") - } - - private VnfResource makeVnf(String id, String role) { - ModelInfo mod = mock(ModelInfo.class) - VnfResource vnf = mock(VnfResource.class) - - when(mod.toString()).thenReturn('{"modelInfo":"mymodel'+id+'"}') - - when(vnf.toString()).thenReturn("myvnf"+id) - when(vnf.getModelInfo()).thenReturn(mod) - when(vnf.getNfRole()).thenReturn(role) - - return vnf - } - - private initValidateVnfCreate(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable(Prefix+"VnfsCreatedCount")).thenReturn(2) - } - - private initPostProcessResponse(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("source")).thenReturn("mysrc") - when(mex.getVariable("mso-request-id")).thenReturn("mri") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - } - - private WorkflowException initPreProcessRollback(ExecutionEntity mex) { - WorkflowException wfe = mock(WorkflowException.class) - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("WorkflowException")).thenReturn(wfe) - - return wfe - } - - private WorkflowException initPostProcessRollback(ExecutionEntity mex) { - WorkflowException wfe = mock(WorkflowException.class) - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("prevWorkflowException")).thenReturn(wfe) - - return wfe - } - - private initPrepareFalloutRequest(ExecutionEntity mex) { - WorkflowException wfe = mock(WorkflowException.class) - - when(wfe.getErrorMessage()).thenReturn("mymsg") - when(wfe.getErrorCode()).thenReturn(999) - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("WorkflowException")).thenReturn(wfe) - when(mex.getVariable(Prefix+"requestInfo")).thenReturn("world") - - return wfe - } - - private initSendSyncError(ExecutionEntity mex) { - WorkflowException wfe = mock(WorkflowException.class) - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("mso-request-id")).thenReturn("mri") - when(mex.getVariable("WorkflowException")).thenReturn(wfe) - - when(wfe.getErrorMessage()).thenReturn("mymsg") - } - - private initProcessJavaException(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy deleted file mode 100644 index b904a3f2d9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy +++ /dev/null @@ -1,773 +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.bpmn.vcpe.scripts - - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Before -import org.junit.BeforeClass -import org.junit.Rule -import org.junit.Test -import org.junit.Ignore -import org.mockito.MockitoAnnotations -import org.camunda.bpm.engine.delegate.BpmnError -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.mock.FileUtil - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse -import static com.github.tomakehurst.wiremock.client.WireMock.get -import static com.github.tomakehurst.wiremock.client.WireMock.patch -import static com.github.tomakehurst.wiremock.client.WireMock.put -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching -import static org.junit.Assert.*; -import static org.mockito.Mockito.* -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.core.domain.AllottedResource -import org.openecomp.mso.bpmn.core.domain.ModelInfo - -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.vcpe.scripts.MapGetter -import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter - -import com.github.tomakehurst.wiremock.junit.WireMockRule - -class DeleteVcpeResCustServiceTest extends GroovyTestBase { - - private static String request - - @Rule - public WireMockRule wireMockRule = new WireMockRule(PORT) - - String Prefix = "DVRCS_" - String RbType = "DCRENI_" - - @BeforeClass - public static void setUpBeforeClass() { - request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json") - } - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - public DeleteVcpeResCustServiceTest() { - super("DeleteVcpeResCustService") - } - - - // ***** preProcessRequest ***** - - @Test -// @Ignore - public void preProcessRequest() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - DeleteVcpeResCustService.preProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - - assertEquals(Prefix, map.get("prefix")) - assertEquals(request, map.get("DeleteVcpeResCustServiceRequest")) - assertEquals("mri", map.get("msoRequestId")) - assertEquals("ra", map.get("requestAction")) - assertEquals("VID", map.get("source")) - assertEquals(CUST, map.get("globalSubscriberId")) - assertEquals(CUST, map.get("globalCustomerId")) - assertEquals("false", map.get("disableRollback")) - assertEquals("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", map.get("productFamilyId")) - assertEquals(SVC, map.get("subscriptionServiceType")) - - assertEquals("mdt1", map.get("lcpCloudRegionId")) - assertEquals("8b1df54faa3b49078e3416e21370a3ba", map.get("tenantId")) - assertEquals("1707", map.get("sdncVersion")) - assertEquals("service-instance", map.get("GENGS_type")) - assertEquals("""{"tenantId":"8b1df54faa3b49078e3416e21370a3ba","lcpCloudRegionId":"mdt1"}""", map.get("cloudConfiguration")) - assertTrue(map.containsKey(Prefix+"requestInfo")) - - def reqinfo = map.get(Prefix+"requestInfo") - assertTrue(reqinfo.indexOf("mri= 0) - assertTrue(reqinfo.indexOf("VID= 0) - } - - @Test -// @Ignore - public void preProcessRequest_EmptyParts() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcess(mex) - - def req = request - .replace('"source"', '"sourceXXX"') - - when(mex.getVariable("bpmnRequest")).thenReturn(req) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - DeleteVcpeResCustService.preProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("prefix", Prefix) - verify(mex).setVariable("DeleteVcpeResCustServiceRequest", req) - verify(mex).setVariable("msoRequestId", "mri") - verify(mex).setVariable("requestAction", "ra") - verify(mex).setVariable("source", "VID") - verify(mex).setVariable("globalSubscriberId", CUST) - verify(mex).setVariable("globalCustomerId", CUST) - verify(mex).setVariable("disableRollback", "false") - verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") - verify(mex).setVariable("subscriptionServiceType", SVC) - - verify(mex).setVariable("lcpCloudRegionId", "mdt1") - verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba") - assertEquals("""{"tenantId":"8b1df54faa3b49078e3416e21370a3ba","lcpCloudRegionId":"mdt1"}""", map.get("cloudConfiguration")) - verify(mex).setVariable("sdncVersion", "1707") - verify(mex).setVariable("GENGS_type", "service-instance") - assertTrue(map.containsKey(Prefix+"requestInfo")) - - def reqinfo = map.get(Prefix+"requestInfo") - println reqinfo - assertTrue(reqinfo.indexOf("mri= 0) - assertTrue(reqinfo.indexOf("VID= 0) - } - - @Test -// @Ignore - public void preProcessRequest_MissingServiceInstanceId() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("serviceInstanceId")).thenReturn(null) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - - assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.preProcessRequest(mex) })) - } - - @Test -// @Ignore - public void preProcessRequest_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("bpmnRequest")).thenThrow(new BpmnError("expected exception")) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - - assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.preProcessRequest(mex) })) - } - - @Test -// @Ignore - public void preProcessRequest_Ex() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("bpmnRequest")).thenThrow(new RuntimeException("expected exception")) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - - assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.preProcessRequest(mex) })) - } - - private void initPreProcess(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("bpmnRequest")).thenReturn(request) - when(mex.getVariable("mso-request-id")).thenReturn("mri") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("requestAction")).thenReturn("ra") - } - - // ***** sendSyncResponse ***** - - @Test -// @Ignore - public void sendSyncResponse() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initSendSyncResponse(mex) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - DeleteVcpeResCustService.sendSyncResponse(mex) - - verify(mex, times(2)).getVariable(DBGFLAG) - - verify(mex).setVariable(processName+"WorkflowResponseSent", "true") - - assertEquals("202", map.get(processName+"ResponseCode")) - assertEquals("Success", map.get(processName+"Status")) - - def resp = map.get(processName+"Response") - - assertTrue(resp.indexOf('"instanceId":"sii"') >= 0) - assertTrue(resp.indexOf('"requestId":"mri"') >= 0) - } - - @Test -// @Ignore - public void sendSyncResponse_Ex() { - ExecutionEntity mex = setupMock() - initSendSyncResponse(mex) - - when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception")) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - - assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.sendSyncResponse(mex) })) - } - - private initSendSyncResponse(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("mso-request-id")).thenReturn("mri") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - } - - // ***** prepareServiceDelete ***** - - @Test -// @Ignore - public void prepareServiceDelete() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPrepareServiceDelete(mex) - - myMockGetAr("/aai/v11/anytxc", 200, "arGetTXCById.xml"); - myMockGetAr("/aai/v11/anybrg", 200, "arGetBRGById.xml"); - myMockGetAr("/aai/v11/other", 200, "arGetOtherById.xml"); - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - DeleteVcpeResCustService.prepareServiceDelete(mex) - - verify(mex).setVariable(Prefix+"TunnelXConn", true) - assertEquals("ar-txcA", map.get("TXC_allottedResourceId")) - - verify(mex).setVariable(Prefix+"BRG", true) - assertEquals("ar-brgB", map.get("BRG_allottedResourceId")) - - verify(mex).setVariable(Prefix+"vnfsCount", 2) - assertNotNull(map.get(Prefix+"relatedVnfIdList")) - assertEquals("[vnfX, vnfY]", map.get(Prefix+"relatedVnfIdList").toString()) - - verify(mex, never()).setVariable(processName+"WorkflowResponseSent", "true") - } - - @Test -// @Ignore - public void prepareServiceDelete_NotFound() { - ExecutionEntity mex = setupMock() - initPrepareServiceDelete(mex) - - when(mex.getVariable("GENGS_FoundIndicator")).thenReturn(false) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - - assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareServiceDelete(mex) })) - - verify(mex, never()).setVariable(processName+"WorkflowResponseSent", "true") - } - - @Test -// @Ignore - public void prepareServiceDelete_Empty() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPrepareServiceDelete(mex) - - when(mex.getVariable("GENGS_service")).thenReturn("") - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - DeleteVcpeResCustService.prepareServiceDelete(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex).setVariable(Prefix+"TunnelXConn", false) - assertNull(map.get("TXC_allottedResourceId")) - - verify(mex).setVariable(Prefix+"BRG", false) - assertNull(map.get("BRG_allottedResourceId")) - - assertEquals(0, map.get(Prefix+"vnfsCount")) - assertFalse(map.containsKey(Prefix+"relatedVnfIdList")) - - verify(mex, never()).setVariable(processName+"WorkflowResponseSent", "true") - } - - @Test -// @Ignore - public void prepareServiceDelete_BpmnError() { - ExecutionEntity mex = setupMock() - initPrepareServiceDelete(mex) - - when(mex.getVariable("GENGS_FoundIndicator")).thenThrow(new BpmnError("expected exception")) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - - assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareServiceDelete(mex) })) - - verify(mex, never()).setVariable(processName+"WorkflowResponseSent", "true") - } - - @Test -// @Ignore - public void prepareServiceDelete_Ex() { - ExecutionEntity mex = setupMock() - initPrepareServiceDelete(mex) - - when(mex.getVariable("GENGS_FoundIndicator")).thenThrow(new RuntimeException("expected exception")) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - - assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareServiceDelete(mex) })) - - verify(mex).setVariable(processName+"WorkflowResponseSent", "true") - } - - private initPrepareServiceDelete(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("GENGS_FoundIndicator")).thenReturn(true) - when(mex.getVariable("mso-request-id")).thenReturn("mri") - when(mex.getVariable("DeleteVcpeResCustServiceRequest")).thenReturn(request) - when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) - when(mex.getVariable("GENGS_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml")) - } - - // ***** getAaiAr ***** - - @Test -// @Ignore - public void getAaiAr() { - myMockGetAr("/myurl/ar1", 200, "arGetBRGById.xml"); - - ExecutionEntity mex = setupMock() - initGetAaiAr(mex) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - def (type, id) = DeleteVcpeResCustService.getAaiAr(mex, "/myurl/ar1") - - assertEquals("BRG", type) - assertEquals("ar-brgB", id) - } - - @Test -// @Ignore - public void getAaiAr_401() { - myMockGetAr("/myurl/ar1", 401, "arGetBRGById.xml"); - - ExecutionEntity mex = setupMock() - initGetAaiAr(mex) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - def (type, id) = DeleteVcpeResCustService.getAaiAr(mex, "/myurl/ar1") - - assertEquals(null, type) - assertEquals(null, id) - } - - @Test -// @Ignore - public void getAaiAr_EmptyResponse() { - myMockGetAr("/myurl/ar1", 200, "empty.txt"); - - ExecutionEntity mex = setupMock() - initGetAaiAr(mex) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - def (type, id) = DeleteVcpeResCustService.getAaiAr(mex, "/myurl/ar1") - - assertEquals(null, type) - assertEquals(null, id) - } - - private void initGetAaiAr(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) - } - - // ***** prepareVnfAndModulesDelete ***** - - @Test -// @Ignore - public void prepareVnfAndModulesDelete() { - ExecutionEntity mex = setupMock() - initPrepareVnfAndModulesDelete(mex) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - DeleteVcpeResCustService.prepareVnfAndModulesDelete(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex).setVariable("vnfId", "vnfB") - } - - @Test -// @Ignore - public void prepareVnfAndModulesDelete_Empty() { - ExecutionEntity mex = setupMock() - initPrepareVnfAndModulesDelete(mex) - - when(mex.getVariable(Prefix+"relatedVnfIdList")).thenReturn(new LinkedList()) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - DeleteVcpeResCustService.prepareVnfAndModulesDelete(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex).setVariable("vnfId", "") - } - - @Test -// @Ignore - public void prepareVnfAndModulesDelete_Ex() { - ExecutionEntity mex = setupMock() - initPrepareVnfAndModulesDelete(mex) - - when(mex.getVariable(Prefix+"relatedVnfIdList")).thenThrow(new RuntimeException("expected exception")) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - - assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareVnfAndModulesDelete(mex) })) - } - - private initPrepareVnfAndModulesDelete(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable(Prefix+"relatedVnfIdList")).thenReturn(Arrays.asList("vnfA", "vnfB", "vnfC")) - when(mex.getVariable(Prefix+"vnfsDeletedCount")).thenReturn(1) - } - - // ***** validateVnfDelete ***** - - @Test -// @Ignore - public void validateVnfDelete() { - ExecutionEntity mex = setupMock() - initValidateVnfDelete(mex) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - DeleteVcpeResCustService.validateVnfDelete(mex) - - verify(mex).getVariable(DBGFLAG) - - verify(mex).setVariable(Prefix+"vnfsDeletedCount", 3) - } - - @Test -// @Ignore - public void validateVnfDelete_Ex() { - ExecutionEntity mex = setupMock() - initValidateVnfDelete(mex) - - when(mex.getVariable(Prefix+"vnfsDeletedCount")).thenThrow(new RuntimeException("expected exception")) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - - assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.validateVnfDelete(mex) })) - } - - private initValidateVnfDelete(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable(Prefix+"vnfsDeletedCount")).thenReturn(2) - } - - // ***** postProcessResponse ***** - - @Test -// @Ignore - public void postProcessResponse() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPostProcessResponse(mex) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - DeleteVcpeResCustService.postProcessResponse(mex) - - verify(mex).getVariable(DBGFLAG) - - assertEquals(true, map.get(Prefix+"Success")) - - def req = map.get(Prefix+"CompleteMsoProcessRequest") - - assertTrue(req.indexOf("mri= 0) - assertTrue(req.indexOf("mysrc= 0) - } - - @Test -// @Ignore - public void postProcessResponse_BpmnError() { - ExecutionEntity mex = setupMock() - initPostProcessResponse(mex) - - when(mex.getVariable("source")).thenThrow(new BpmnError("expected exception")) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - - assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.postProcessResponse(mex) })) - } - - @Test -// @Ignore - public void postProcessResponse_Ex() { - ExecutionEntity mex = setupMock() - initPostProcessResponse(mex) - - when(mex.getVariable("source")).thenThrow(new RuntimeException("expected exception")) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - - assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.postProcessResponse(mex) })) - } - - private initPostProcessResponse(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("source")).thenReturn("mysrc") - when(mex.getVariable("msoRequestId")).thenReturn("mri") - } - - - // ***** prepareFalloutRequest ***** - - @Test -// @Ignore - public void prepareFalloutRequest() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPrepareFalloutRequest(mex) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - DeleteVcpeResCustService.prepareFalloutRequest(mex) - - verify(mex, times(2)).getVariable(DBGFLAG) - - def fo = map.get(Prefix+"falloutRequest") - - assertTrue(fo.indexOf("world= 0) - assertTrue(fo.indexOf("ErrorMessage>mymsg= 0) - assertTrue(fo.indexOf("ErrorCode>999= 0) - } - - @Test -// @Ignore - public void prepareFalloutRequest_Ex() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPrepareFalloutRequest(mex) - - when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - - assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.prepareFalloutRequest(mex) })) - } - - private initPrepareFalloutRequest(ExecutionEntity mex) { - WorkflowException wfe = mock(WorkflowException.class) - - when(wfe.getErrorMessage()).thenReturn("mymsg") - when(wfe.getErrorCode()).thenReturn(999) - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("WorkflowException")).thenReturn(wfe) - when(mex.getVariable(Prefix+"requestInfo")).thenReturn("world") - - return wfe - } - - // ***** sendSyncError ***** - - @Test -// @Ignore - public void sendSyncError() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initSendSyncError(mex) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - DeleteVcpeResCustService.sendSyncError(mex) - - verify(mex, times(2)).getVariable(DBGFLAG) - - verify(mex).setVariable(processName+"WorkflowResponseSent", "true") - - assertEquals("500", map.get(processName+"ResponseCode")) - assertEquals("Fail", map.get(processName+"Status")) - - def resp = map.get(processName+"Response") - - assertTrue(resp.indexOf("ErrorMessage>mymsg= 0) - - verify(mex).setVariable("WorkflowResponse", resp) - } - - @Test -// @Ignore - public void sendSyncError_NotWfe() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initSendSyncError(mex) - - when(mex.getVariable("WorkflowException")).thenReturn("not a WFE") - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - DeleteVcpeResCustService.sendSyncError(mex) - - verify(mex, times(2)).getVariable(DBGFLAG) - - verify(mex).setVariable(processName+"WorkflowResponseSent", "true") - - assertEquals("500", map.get(processName+"ResponseCode")) - assertEquals("Fail", map.get(processName+"Status")) - - def resp = map.get(processName+"Response") - - assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.= 0) - - verify(mex).setVariable("WorkflowResponse", resp) - } - - @Test -// @Ignore - public void sendSyncError_NullWfe() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initSendSyncError(mex) - - when(mex.getVariable("WorkflowException")).thenReturn(null) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - DeleteVcpeResCustService.sendSyncError(mex) - - verify(mex, times(2)).getVariable(DBGFLAG) - - verify(mex).setVariable(processName+"WorkflowResponseSent", "true") - - assertEquals("500", map.get(processName+"ResponseCode")) - assertEquals("Fail", map.get(processName+"Status")) - - def resp = map.get(processName+"Response") - - assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.= 0) - - verify(mex).setVariable("WorkflowResponse", resp) - } - - @Test -// @Ignore - public void sendSyncError_Ex() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initSendSyncError(mex) - - when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - - DeleteVcpeResCustService.sendSyncError(mex) - - assertFalse(map.containsKey(processName+"ResponseCode")) - } - - private initSendSyncError(ExecutionEntity mex) { - WorkflowException wfe = mock(WorkflowException.class) - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("mso-request-id")).thenReturn("mri") - when(mex.getVariable("WorkflowException")).thenReturn(wfe) - - when(wfe.getErrorMessage()).thenReturn("mymsg") - } - - - // ***** processJavaException ***** - - @Test -// @Ignore - public void processJavaException() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initProcessJavaException(mex) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - - assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.processJavaException(mex) })) - - verify(mex, times(2)).getVariable(DBGFLAG) - - verify(mex).setVariable("prefix", Prefix) - - def wfe = map.get("WorkflowException") - - assertEquals("Caught a Java Lang Exception", wfe.getErrorMessage()) - } - - @Test -// @Ignore - public void processJavaException_BpmnError() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initProcessJavaException(mex) - - when(mex.getVariables()).thenThrow(new BpmnError("expected exception")) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - - assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.processJavaException(mex) })) - - assertFalse(map.containsKey("WorkflowException")) - } - - @Test -// @Ignore - public void processJavaException_Ex() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initProcessJavaException(mex) - - when(mex.getVariables()).thenThrow(new RuntimeException("expected exception")) - - DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() - - assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.processJavaException(mex) })) - - def wfe = map.get("WorkflowException") - - assertEquals("Exception in processJavaException method", wfe.getErrorMessage()) - } - - private initProcessJavaException(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - } - - private void myMockGetAr(String url, int status, String fileResp) { - stubFor(get(urlMatching(url)) - .willReturn(aResponse() - .withStatus(status) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VCPE/DeleteVcpeResCustService/" + fileResp))); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy deleted file mode 100644 index 71c0f8b511..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy +++ /dev/null @@ -1,652 +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.bpmn.vcpe.scripts - - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Before -import org.junit.BeforeClass -import org.junit.Rule -import org.junit.Test -import org.junit.Ignore -import org.mockito.MockitoAnnotations -import org.camunda.bpm.engine.delegate.BpmnError -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.mock.FileUtil - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse -import static com.github.tomakehurst.wiremock.client.WireMock.get -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching -import static org.junit.Assert.*; -import static org.mockito.Mockito.* -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource - -import org.openecomp.mso.bpmn.core.RollbackData - -import com.github.tomakehurst.wiremock.junit.WireMockRule - -class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(PORT) - - String Prefix = "DCARBRGRB_" - String RbType = "DCARBRG_" - - @BeforeClass - public static void setUpBeforeClass() { - // nothing for now - } - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - public DoCreateAllottedResourceBRGRollbackTest() { - super("DoCreateAllottedResourceBRGRollback") - } - - - // ***** preProcessRequest ***** - - @Test -// @Ignore - public void preProcessRequest() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("prefix", Prefix) - verify(mex).setVariable("serviceInstanceId", "sii") - verify(mex).setVariable("parentServiceInstanceId", "psii") - verify(mex).setVariable("allottedResourceId", "myid") - verify(mex).setVariable("rollbackAAI", true) - verify(mex).setVariable("aaiARPath", "mypath") - verify(mex).setVariable("rollbackSDNC", true) - verify(mex).setVariable("deactivateSdnc", "myactivate") - verify(mex).setVariable("deleteSdnc", "mycreate") - verify(mex).setVariable("unassignSdnc", "true") - verify(mex).setVariable("sdncDeactivateRequest", "activatereq") - verify(mex).setVariable("sdncDeleteRequest", "createreq") - verify(mex).setVariable("sdncUnassignRequest", "assignreq") - - verify(mex, never()).setVariable("skipRollback", true) - } - - @Test -// @Ignore - public void preProcessRequest_RollbackDisabled() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("disableRollback")).thenReturn("true") - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("prefix", Prefix) - verify(mex).setVariable("serviceInstanceId", "sii") - verify(mex).setVariable("parentServiceInstanceId", "psii") - verify(mex).setVariable("allottedResourceId", "myid") - verify(mex).setVariable("rollbackAAI", true) - verify(mex).setVariable("aaiARPath", "mypath") - verify(mex).setVariable("rollbackSDNC", true) - verify(mex).setVariable("deactivateSdnc", "myactivate") - verify(mex).setVariable("deleteSdnc", "mycreate") - verify(mex).setVariable("unassignSdnc", "true") - verify(mex).setVariable("sdncDeactivateRequest", "activatereq") - verify(mex).setVariable("sdncDeleteRequest", "createreq") - verify(mex).setVariable("sdncUnassignRequest", "assignreq") - - verify(mex).setVariable("skipRollback", true) - } - - @Test -// @Ignore - public void preProcessRequest_NoAAI() { - ExecutionEntity mex = setupMock() - def data = initPreProcess(mex) - - when(mex.getVariable("rollbackAAI")).thenReturn(false) - data.put(RbType, "rollbackAAI", "false") - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("prefix", Prefix) - verify(mex).setVariable("serviceInstanceId", "sii") - verify(mex).setVariable("parentServiceInstanceId", "psii") - verify(mex).setVariable("allottedResourceId", "myid") - verify(mex, never()).setVariable("rollbackAAI", true) - verify(mex, never()).setVariable("aaiARPath", "mypath") - verify(mex).setVariable("rollbackSDNC", true) - verify(mex).setVariable("deactivateSdnc", "myactivate") - verify(mex).setVariable("deleteSdnc", "mycreate") - verify(mex).setVariable("unassignSdnc", "true") - verify(mex).setVariable("sdncDeactivateRequest", "activatereq") - verify(mex).setVariable("sdncDeleteRequest", "createreq") - verify(mex).setVariable("sdncUnassignRequest", "assignreq") - - verify(mex, never()).setVariable("skipRollback", true) - } - - @Test -// @Ignore - public void preProcessRequest_NoAssign() { - ExecutionEntity mex = setupMock() - def data = initPreProcess(mex) - - when(mex.getVariable("rollbackSDNC")).thenReturn(false) - data.put(RbType, "rollbackSDNCassign", "false") - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("prefix", Prefix) - verify(mex).setVariable("serviceInstanceId", "sii") - verify(mex).setVariable("parentServiceInstanceId", "psii") - verify(mex).setVariable("allottedResourceId", "myid") - verify(mex).setVariable("rollbackAAI", true) - verify(mex).setVariable("aaiARPath", "mypath") - verify(mex, never()).setVariable("rollbackSDNC", true) - verify(mex, never()).setVariable("deactivateSdnc", "myactivate") - verify(mex, never()).setVariable("deleteSdnc", "mycreate") - verify(mex, never()).setVariable("unassignSdnc", "true") - verify(mex, never()).setVariable("sdncDeactivateRequest", "activatereq") - verify(mex, never()).setVariable("sdncDeleteRequest", "createreq") - verify(mex, never()).setVariable("sdncUnassignRequest", "assignreq") - - verify(mex, never()).setVariable("skipRollback", true) - } - - @Test -// @Ignore - public void preProcessRequest_NoAAI_NoAssign() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("rollbackAAI")).thenReturn(false) - when(mex.getVariable("rollbackSDNC")).thenReturn(false) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) - - verify(mex).setVariable("skipRollback", true) - } - - @Test -// @Ignore - public void preProcessRequest_NoRbStructure() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("rollbackData")).thenReturn(new RollbackData()) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) - - verify(mex).setVariable("skipRollback", true) - } - - @Test -// @Ignore - public void preProcessRequest_NullRb() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("rollbackData")).thenReturn(null) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) - - verify(mex).setVariable("skipRollback", true) - } - - @Test -// @Ignore - public void preProcessRequest_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) })) - } - - @Test -// @Ignore - public void preProcessRequest_Ex() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) })) - } - - @Test -// @Ignore - public void updateAaiAROrchStatus() { - ExecutionEntity mex = setupMock() - initUpdateAaiAROrchStatus(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockPatchAllottedResource(CUST, SVC, INST, ARID) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success") - } - - @Test -// @Ignore - public void updateAaiAROrchStatus_EmptyResponse() { - ExecutionEntity mex = setupMock() - initUpdateAaiAROrchStatus(mex) - - wireMockRule - .stubFor(get(urlMatching("/aai/v[0-9]+/.*")) - .willReturn(aResponse() - .withStatus(200))) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success") })) - } - - @Test -// @Ignore - public void updateAaiAROrchStatus_NoArPath() { - ExecutionEntity mex = setupMock() - initUpdateAaiAROrchStatus(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockPatchAllottedResource(CUST, SVC, INST, ARID) - - when(mex.getVariable("aaiARPath")).thenReturn(null) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success") })) - } - - - // ***** validateSDNCResp ***** - - @Test -// @Ignore - public void validateSDNCResp() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - - DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") - - verify(mex).getVariable("WorkflowException") - verify(mex).getVariable("SDNCA_SuccessIndicator") - } - - @Test -// @Ignore - public void validateSDNCResp_Unsuccessful() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") })) - } - - @Test -// @Ignore - public void validateSDNCResp_BpmnError404() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) - - when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("404", "expected exception")) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - - DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") - } - - @Test -// @Ignore - public void validateSDNCResp_BpmnError() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) - - when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") })) - } - - @Test -// @Ignore - public void validateSDNCResp_Ex() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) - - when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") })) - } - - @Test -// @Ignore - public void deleteAaiAR() { - ExecutionEntity mex = setupMock() - initDeleteAaiAR(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) - } - - @Test -// @Ignore - public void deleteAaiAR_NoArPath() { - ExecutionEntity mex = setupMock() - initDeleteAaiAR(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) - - when(mex.getVariable("aaiARPath")).thenReturn("") - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) })) - } - - @Test -// @Ignore - public void deleteAaiAR_BpmnError() { - ExecutionEntity mex = setupMock() - initDeleteAaiAR(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) - - when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) })) - } - - @Test -// @Ignore - public void deleteAaiAR_Ex() { - ExecutionEntity mex = setupMock() - initDeleteAaiAR(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) - - when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) })) - } - - @Test -// @Ignore - public void postProcessRequest() { - ExecutionEntity mex = setupMock() - initPostProcessRequest(mex) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.postProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("rollbackData", null) - verify(mex).setVariable("rolledBack", true) - } - - @Test -// @Ignore - public void postProcessRequest_RolledBack() { - ExecutionEntity mex = setupMock() - initPostProcessRequest(mex) - - when(mex.getVariable("skipRollback")).thenReturn(true) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.postProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("rollbackData", null) - verify(mex, never()).setVariable("rolledBack", true) - } - - @Test -// @Ignore - public void postProcessRequest_BpmnError() { - ExecutionEntity mex = setupMock() - initPostProcessRequest(mex) - - when(mex.getVariable("skipRollback")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.postProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("rollbackData", null) - verify(mex, never()).setVariable("rolledBack", true) - } - - @Test -// @Ignore - public void postProcessRequest_Ex() { - ExecutionEntity mex = setupMock() - initPostProcessRequest(mex) - - when(mex.getVariable("skipRollback")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.postProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("rollbackData", null) - verify(mex, never()).setVariable("rolledBack", true) - } - - @Test -// @Ignore - public void processRollbackException() { - ExecutionEntity mex = setupMock() - initProcessRollbackException(mex) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.processRollbackException(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("rollbackData", null) - verify(mex).setVariable("rolledBack", false) - verify(mex).setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback") - verify(mex).setVariable("WorkflowException", null) - } - - @Test -// @Ignore - public void processRollbackException_BpmnError() { - ExecutionEntity mex = setupMock() - initProcessRollbackException(mex) - - doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.processRollbackException(mex) - } - - @Test -// @Ignore - public void processRollbackException_Ex() { - ExecutionEntity mex = setupMock() - initProcessRollbackException(mex) - - doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.processRollbackException(mex) - } - - @Test -// @Ignore - public void processRollbackJavaException() { - ExecutionEntity mex = setupMock() - initProcessRollbackException(mex) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.processRollbackJavaException(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("rollbackData", null) - verify(mex).setVariable("rolledBack", false) - verify(mex).setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback") - verify(mex, never()).setVariable("WorkflowException", null) - } - - @Test -// @Ignore - public void processRollbackJavaException_BpmnError() { - ExecutionEntity mex = setupMock() - initProcessRollbackException(mex) - - doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.processRollbackJavaException(mex) - } - - @Test -// @Ignore - public void processRollbackJavaException_Ex() { - ExecutionEntity mex = setupMock() - initProcessRollbackException(mex) - - doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null) - - DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() - DoCreateAllottedResourceBRGRollback.processRollbackJavaException(mex) - } - - private RollbackData initPreProcess(ExecutionEntity mex) { - def data = new RollbackData() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("rollbackData")).thenReturn(data) - when(mex.getVariable("rollbackAAI")).thenReturn(true) - when(mex.getVariable("rollbackSDNC")).thenReturn(true) - when(mex.getVariable("disableRollback")).thenReturn("false") - - data.put("SERVICEINSTANCE", "allottedResourceId", "myid") - - data.put(RbType, "serviceInstanceId", "sii") - data.put(RbType, "parentServiceInstanceId", "psii") - - data.put(RbType, "rollbackAAI", "true") - data.put(RbType, "aaiARPath", "mypath") - - data.put(RbType, "rollbackSDNCassign", "true") - data.put(RbType, "rollbackSDNCactivate", "myactivate") - data.put(RbType, "rollbackSDNCcreate", "mycreate") - data.put(RbType, "sdncActivateRollbackReq", "activatereq") - data.put(RbType, "sdncCreateRollbackReq", "createreq") - data.put(RbType, "sdncAssignRollbackReq", "assignreq") - - return data - } - - private initUpdateAaiAROrchStatus(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) - when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) - } - - private initValidateSDNCResp(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("prefix")).thenReturn(Prefix) - when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) - } - - private String initValidateSDNCResp_Resp() { - return "<response-code>200</response-code>" - } - - private initDeleteAaiAR(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("aaiARResourceVersion")).thenReturn(VERS) - when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) - when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) - } - - private initPostProcessRequest(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("skipRollback")).thenReturn(false) - } - - private initProcessRollbackException(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - } - - private initProcessRollbackJavaException(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy deleted file mode 100644 index c8afb228a9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy +++ /dev/null @@ -1,996 +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.bpmn.vcpe.scripts - - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Before -import org.junit.BeforeClass -import org.junit.Rule -import org.junit.Test -import org.junit.Ignore -import org.mockito.MockitoAnnotations -import org.camunda.bpm.engine.delegate.BpmnError -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.mock.FileUtil - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse -import static com.github.tomakehurst.wiremock.client.WireMock.put -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching -import static org.junit.Assert.*; -import static org.mockito.Mockito.* -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource_500 - -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter - -import com.github.tomakehurst.wiremock.junit.WireMockRule - -class DoCreateAllottedResourceBRGTest extends GroovyTestBase { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(PORT) - - String Prefix = "DCARBRG_" - - @BeforeClass - public static void setUpBeforeClass() { - // nothing for now - } - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - public DoCreateAllottedResourceBRGTest() { - super("DoCreateAllottedResourceBRG") - } - - - // ***** preProcessRequest ***** - - @Test -// @Ignore - public void preProcessRequest() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.preProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("prefix", Prefix) - - assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdncadapter_callback")) - assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdnc_replication_delay")) - assertTrue(checkMissingPreProcessRequest("serviceInstanceId")) - assertTrue(checkMissingPreProcessRequest("parentServiceInstanceId")) - assertTrue(checkMissingPreProcessRequest("allottedResourceModelInfo")) - assertTrue(checkMissingPreProcessRequest("vni")) - assertTrue(checkMissingPreProcessRequest("vgmuxBearerIP")) - assertTrue(checkMissingPreProcessRequest("brgWanMacAddress")) - assertTrue(checkMissingPreProcessRequest("allottedResourceRole")) - assertTrue(checkMissingPreProcessRequest("allottedResourceType")) - } - - - // ***** getAaiAR ***** - - @Test -// @Ignore - public void getAaiAR() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") - - ExecutionEntity mex = setupMock() - initGetAaiAR(mex) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.getAaiAR(mex) - - verify(mex).setVariable("foundActiveAR", true) - } - - @Test -// @Ignore - public void getAaiAR_Duplicate() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") - - ExecutionEntity mex = setupMock() - initGetAaiAR(mex) - - // fail if duplicate - when(mex.getVariable("failExists")).thenReturn("true") - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRG.getAaiAR(mex) })) - } - - @Test -// @Ignore - public void getAaiAR_NotActive() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") - - ExecutionEntity mex = setupMock() - initGetAaiAR(mex) - - // not active - when(mex.getVariable("aaiAROrchStatus")).thenReturn("not-active") - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRG.getAaiAR(mex) })) - } - - @Test -// @Ignore - public void getAaiAR_NoStatus() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") - - ExecutionEntity mex = setupMock() - initGetAaiAR(mex) - - when(mex.getVariable("aaiAROrchStatus")).thenReturn(null) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.getAaiAR(mex) - - verify(mex, never()).setVariable("foundActiveAR", true) - } - - - // ***** createAaiAR ***** - - @Test -// @Ignore - public void createAaiAR() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initCreateAaiAr(mex) - - MockPutAllottedResource(CUST, SVC, INST, ARID) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.createAaiAR(mex) - - def data = map.get("rollbackData") - assertNotNull(data) - assertTrue(data instanceof RollbackData) - - assertEquals("45", data.get(Prefix, "disableRollback")) - assertEquals("true", data.get(Prefix, "rollbackAAI")) - assertEquals(ARID, data.get(Prefix, "allottedResourceId")) - assertEquals("sii", data.get(Prefix, "serviceInstanceId")) - assertEquals("psii", data.get(Prefix, "parentServiceInstanceId")) - assertEquals(mex.getVariable("PSI_resourceLink")+"/allotted-resources/allotted-resource/"+ARID, data.get(Prefix, "aaiARPath")) - } - - @Test -// @Ignore - public void createAaiAR_NoArid_NoModelUuids() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initCreateAaiAr(mex) - - // no allottedResourceId - will be generated - - when(mex.getVariable("allottedResourceId")).thenReturn(null) - - wireMockRule - .stubFor(put(urlMatching("/aai/.*/allotted-resource/.*")) - .willReturn(aResponse() - .withStatus(200))) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.createAaiAR(mex) - - def arid = map.get("allottedResourceId") - assertNotNull(arid) - assertFalse(arid.isEmpty()) - - def data = map.get("rollbackData") - assertNotNull(data) - assertTrue(data instanceof RollbackData) - - assertEquals(arid, data.get(Prefix, "allottedResourceId")) - } - - @Test -// @Ignore - public void createAaiAR_MissingPsiLink() { - ExecutionEntity mex = setupMock() - initCreateAaiAr(mex) - - when(mex.getVariable("PSI_resourceLink")).thenReturn(null) - - MockPutAllottedResource(CUST, SVC, INST, ARID) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) })) - } - - @Test -// @Ignore - public void createAaiAR_HttpFailed() { - ExecutionEntity mex = setupMock() - initCreateAaiAr(mex) - - MockPutAllottedResource_500(CUST, SVC, INST, ARID) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) })) - } - - @Test -// @Ignore - public void createAaiAR_BpmnError() { - ExecutionEntity mex = setupMock() - initCreateAaiAr(mex) - - when(mex.getVariable("URN_aai_endpoint")).thenThrow(new BpmnError("expected exception")) - - MockPutAllottedResource(CUST, SVC, INST, ARID) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) })) - } - - @Test -// @Ignore - public void createAaiAR_Ex() { - ExecutionEntity mex = setupMock() - initCreateAaiAr(mex) - - when(mex.getVariable("URN_aai_endpoint")).thenThrow(new RuntimeException("expected exception")) - - MockPutAllottedResource(CUST, SVC, INST, ARID) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) })) - } - - - // ***** buildSDNCRequest ***** - - @Test -// @Ignore - public void buildSDNCRequest() { - ExecutionEntity mex = setupMock() - initBuildSDNCRequest(mex) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - String result = DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") - - assertTrue(result.indexOf("myreq= 0) - assertTrue(result.indexOf("myact= 0) - assertTrue(result.indexOf("ari= 0) - assertTrue(result.indexOf("sii= 0) - assertTrue(result.indexOf("sii= 0) - assertTrue(result.indexOf("psii= 0) - assertTrue(result.indexOf("sst= 0) - assertTrue(result.indexOf("gci= 0) - assertTrue(result.indexOf("scu= 0) - assertTrue(result.indexOf("mri= 0) - assertTrue(result.indexOf("bwma= 0) - assertTrue(result.indexOf("myvni= 0) - assertTrue(result.indexOf("vbi= 0) - assertTrue(result.indexOf("miu= 0) - assertTrue(result.indexOf("mu= 0) - assertTrue(result.indexOf("mcu= 0) - assertTrue(result.indexOf("mv= 0) - assertTrue(result.indexOf("mn= 0) - } - - @Test -// @Ignore - public void buildSDNCRequest_EmptyModelInfo() { - ExecutionEntity mex = setupMock() - initBuildSDNCRequest(mex) - - when(mex.getVariable("allottedResourceModelInfo")).thenReturn("{}") - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - String result = DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") - - assertTrue(result.indexOf("myreq= 0) - assertTrue(result.indexOf("myact= 0) - assertTrue(result.indexOf("ari= 0) - assertTrue(result.indexOf("sii= 0) - assertTrue(result.indexOf("sii= 0) - assertTrue(result.indexOf("psii= 0) - assertTrue(result.indexOf("sst= 0) - assertTrue(result.indexOf("gci= 0) - assertTrue(result.indexOf("scu= 0) - assertTrue(result.indexOf("mri= 0) - assertTrue(result.indexOf("bwma= 0) - assertTrue(result.indexOf("myvni= 0) - assertTrue(result.indexOf("vbi= 0) - assertTrue(result.indexOf("") >= 0) - assertTrue(result.indexOf("") >= 0) - assertTrue(result.indexOf("") >= 0) - assertTrue(result.indexOf("") >= 0) - assertTrue(result.indexOf("") >= 0) - } - - @Test -// @Ignore - public void buildSDNCRequest_Ex() { - ExecutionEntity mex = setupMock() - initBuildSDNCRequest(mex) - - when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") })) - } - - - // ***** preProcessSDNCAssign ***** - - @Test -// @Ignore - public void preProcessSDNCAssign() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - def data = initPreProcessSDNC(mex) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) - - def req = map.get("sdncAssignRequest") - assertNotNull(req) - - assertEquals(data, map.get("rollbackData")) - - def rbreq = data.get(Prefix, "sdncAssignRollbackReq") - - assertTrue(req.indexOf("assign= 0) - assertTrue(req.indexOf("CreateBRGInstance= 0) - assertTrue(req.indexOf("") >= 0) - - assertTrue(rbreq.indexOf("unassign= 0) - assertTrue(rbreq.indexOf("DeleteBRGInstance= 0) - assertTrue(rbreq.indexOf("") >= 0) - } - - @Test -// @Ignore - public void preProcessSDNCAssign_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) })) - } - - @Test -// @Ignore - public void preProcessSDNCAssign_Ex() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) })) - } - - - // ***** preProcessSDNCCreate ***** - - @Test -// @Ignore - public void preProcessSDNCCreate() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - def data = initPreProcessSDNC(mex) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) - - def req = map.get("sdncCreateRequest") - assertNotNull(req) - - assertEquals(data, map.get("rollbackData")) - - def rbreq = data.get(Prefix, "sdncCreateRollbackReq") - - assertTrue(req.indexOf("create= 0) - assertTrue(req.indexOf("CreateBRGInstance= 0) - assertTrue(req.indexOf("") >= 0) - - assertTrue(rbreq.indexOf("delete= 0) - assertTrue(rbreq.indexOf("DeleteBRGInstance= 0) - assertTrue(rbreq.indexOf("") >= 0) - - } - - @Test -// @Ignore - public void preProcessSDNCCreate_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) })) - } - - @Test -// @Ignore - public void preProcessSDNCCreate_Ex() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) })) - } - - - // ***** preProcessSDNCActivate ***** - - @Test -// @Ignore - public void preProcessSDNCActivate() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - def data = initPreProcessSDNC(mex) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) - - def req = map.get("sdncActivateRequest") - assertNotNull(req) - - assertEquals(data, map.get("rollbackData")) - - def rbreq = data.get(Prefix, "sdncActivateRollbackReq") - - assertTrue(req.indexOf("activate= 0) - assertTrue(req.indexOf("CreateBRGInstance= 0) - assertTrue(req.indexOf("") >= 0) - - assertTrue(rbreq.indexOf("deactivate= 0) - assertTrue(rbreq.indexOf("DeleteBRGInstance= 0) - assertTrue(rbreq.indexOf("") >= 0) - - } - - @Test -// @Ignore - public void preProcessSDNCActivate_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) })) - } - - @Test -// @Ignore - public void preProcessSDNCActivate_Ex() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) })) - } - - - // ***** validateSDNCResp ***** - - @Test -// @Ignore - public void validateSDNCResp() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - def data = initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") - - verify(mex).getVariable("WorkflowException") - verify(mex).getVariable("SDNCA_SuccessIndicator") - verify(mex).getVariable("rollbackData") - - assertEquals(data, map.get("rollbackData")) - - assertEquals("true", data.get(Prefix, "rollback" + "SDNCcreate")) - - } - - @Test -// @Ignore - public void validateSDNCResp_Get() { - ExecutionEntity mex = setupMock() - def data = initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "get") - - verify(mex).getVariable("WorkflowException") - verify(mex).getVariable("SDNCA_SuccessIndicator") - - verify(mex, never()).getVariable("rollbackData") - } - - @Test -// @Ignore - public void validateSDNCResp_Unsuccessful() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - - // unsuccessful - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") })) - } - - @Test -// @Ignore - public void validateSDNCResp_BpmnError() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - - when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") })) - } - - @Test -// @Ignore - public void validateSDNCResp_Ex() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - - when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") })) - } - - - // ***** preProcessSDNCGet ***** - - @Test -// @Ignore - public void preProcessSDNCGet_FoundAR() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcessSDNCGet(mex) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.preProcessSDNCGet(mex) - - String req = map.get("sdncGetRequest") - - assertTrue(req.indexOf("") >= 0) - assertTrue(req.indexOf("sii= 0) - assertTrue(req.indexOf("arlink= 0) - assertTrue(req.indexOf("myurl= 0) - - } - - @Test -// @Ignore - public void preProcessSDNCGet_NotFoundAR() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcessSDNCGet(mex) - - when(mex.getVariable("foundActiveAR")).thenReturn(false) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.preProcessSDNCGet(mex) - - String req = map.get("sdncGetRequest") - - assertTrue(req.indexOf("") >= 0) - assertTrue(req.indexOf("sii= 0) - assertTrue(req.indexOf("assignlink= 0) - assertTrue(req.indexOf("myurl= 0) - - } - - @Test -// @Ignore - public void preProcessSDNCGet_Ex() { - ExecutionEntity mex = setupMock() - initPreProcessSDNCGet(mex) - - when(mex.getVariable("foundActiveAR")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCGet(mex) })) - } - - - // ***** updateAaiAROrchStatus ***** - - @Test -// @Ignore - public void updateAaiAROrchStatus() { - MockPatchAllottedResource(CUST, SVC, INST, ARID) - - ExecutionEntity mex = setupMock() - initUpdateAaiAROrchStatus(mex) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.updateAaiAROrchStatus(mex, "success") - } - - - // ***** generateOutputs ***** - - @Test -// @Ignore - public void generateOutputs() { - ExecutionEntity mex = setupMock() - def brgtop = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml") - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("enhancedCallbackRequestData")).thenReturn(brgtop) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.generateOutputs(mex) - - verify(mex).setVariable("allotedResourceName", "namefromrequest") - - } - - @Test -// @Ignore - public void generateOutputs_BadXml() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("enhancedCallbackRequestData")).thenReturn("invalid xml") - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.generateOutputs(mex) - - verify(mex, never()).setVariable(anyString(), anyString()) - - } - - @Test -// @Ignore - public void generateOutputs_BpmnError() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - DoCreateAllottedResourceBRG.generateOutputs(mex) - verify(mex, never()).setVariable(anyString(), anyString()) - - } - - @Test -// @Ignore - public void generateOutputs_Ex() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - DoCreateAllottedResourceBRG.generateOutputs(mex) - verify(mex, never()).setVariable(anyString(), anyString()) - - } - - - // ***** preProcessRollback ***** - - @Test -// @Ignore - public void preProcessRollback() { - ExecutionEntity mex = setupMock() - WorkflowException wfe = mock(WorkflowException.class) - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("WorkflowException")).thenReturn(wfe) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.preProcessRollback(mex) - - verify(mex).setVariable("prevWorkflowException", wfe) - - } - - @Test -// @Ignore - public void preProcessRollback_NotWFE() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("WorkflowException")).thenReturn("I'm not a WFE") - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.preProcessRollback(mex) - -// verify(mex, never()).setVariable("prevWorkflowException", any()) - - } - - @Test -// @Ignore - public void preProcessRollback_BpmnError() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - DoCreateAllottedResourceBRG.preProcessRollback(mex) - - } - - @Test -// @Ignore - public void preProcessRollback_Ex() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - DoCreateAllottedResourceBRG.preProcessRollback(mex) - - } - - - // ***** postProcessRollback ***** - - @Test -// @Ignore - public void postProcessRollback() { - ExecutionEntity mex = setupMock() - WorkflowException wfe = mock(WorkflowException.class) - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("prevWorkflowException")).thenReturn(wfe) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.postProcessRollback(mex) - - verify(mex).setVariable("WorkflowException", wfe) - verify(mex).setVariable("rollbackData", null) - - } - - @Test -// @Ignore - public void postProcessRollback_NotWFE() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("prevWorkflowException")).thenReturn("I'm not a WFE") - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - DoCreateAllottedResourceBRG.postProcessRollback(mex) - -// verify(mex, never()).setVariable("WorkflowException", any()) - verify(mex).setVariable("rollbackData", null) - - } - - @Test -// @Ignore - public void postProcessRollback_BpmnError() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.postProcessRollback(mex) })) - verify(mex, never()).setVariable("rollbackData", null) - - } - - @Test -// @Ignore - public void postProcessRollback_Ex() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - DoCreateAllottedResourceBRG.postProcessRollback(mex) - verify(mex, never()).setVariable("rollbackData", null) - - } - - private boolean checkMissingPreProcessRequest(String fieldnm) { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() - - when(mex.getVariable(fieldnm)).thenReturn("") - - return doBpmnError( { _ -> DoCreateAllottedResourceBRG.preProcessRequest(mex) }) - } - - private void initPreProcess(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("sdncurn") - when(mex.getVariable("URN_mso_workflow_sdnc_replication_delay")).thenReturn("sdncdelay") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") - when(mex.getVariable("allottedResourceModelInfo")).thenReturn("armi") - when(mex.getVariable("vni")).thenReturn("myvni") - when(mex.getVariable("vgmuxBearerIP")).thenReturn("vbi") - when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma") - when(mex.getVariable("allottedResourceRole")).thenReturn("arr") - when(mex.getVariable("allottedResourceType")).thenReturn("art") - } - - private void initGetAaiAR(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("allottedResourceType")).thenReturn("BRGt") - when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr") - when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml")) - when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) - when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active") - } - - private initCreateAaiAr(ExecutionEntity mex) { - when(mex.getVariable("disableRollback")).thenReturn(45) - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("allottedResourceId")).thenReturn(ARID) - when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) - when(mex.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn(urnProps.get("mso.workflow.global.default.aai.namespace")) - when(mex.getVariable("PSI_resourceLink")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST) - when(mex.getVariable("allottedResourceType")).thenReturn("BRGt") - when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr") - when(mex.getVariable("CSI_resourceLink")).thenReturn(aaiUriPfx+"/aai/v9/mycsi") - when(mex.getVariable("allottedResourceModelInfo")).thenReturn(""" - { - "modelInvariantUuid":"modelinvuuid", - "modelUuid":"modeluuid", - "modelCustomizationUuid":"modelcustuuid" - } - """) - } - - private initBuildSDNCRequest(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("allottedResourceId")).thenReturn("ari") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") - when(mex.getVariable("subscriptionServiceType")).thenReturn("sst") - when(mex.getVariable("globalCustomerId")).thenReturn("gci") - when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu") - when(mex.getVariable("msoRequestId")).thenReturn("mri") - when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma") - when(mex.getVariable("vni")).thenReturn("myvni") - when(mex.getVariable("vgmuxBearerIP")).thenReturn("vbi") - when(mex.getVariable("allottedResourceModelInfo")).thenReturn(""" - { - "modelInvariantUuid":"miu", - "modelUuid":"mu", - "modelCustomizationUuid":"mcu", - "modelVersion":"mv", - "modelName":"mn" - } - """) - } - - private RollbackData initPreProcessSDNC(ExecutionEntity mex) { - def data = new RollbackData() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("rollbackData")).thenReturn(data) - - return data - } - - private initPreProcessSDNCGet(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl") - when(mex.getVariable("foundActiveAR")).thenReturn(true) - when(mex.getVariable("aaiARGetResponse")).thenReturn("arlink") - when(mex.getVariable("sdncAssignResponse")).thenReturn("<object-path>assignlink</object-path>") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl") - } - - private RollbackData initValidateSDNCResp(ExecutionEntity mex) { - def data = new RollbackData() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("prefix")).thenReturn(Prefix) - when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) - when(mex.getVariable("rollbackData")).thenReturn(data) - - return data - } - - private String initValidateSDNCResp_Resp() { - return "<response-code>200</response-code>" - } - - private initUpdateAaiAROrchStatus(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy deleted file mode 100644 index 9b4283bb82..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy +++ /dev/null @@ -1,652 +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.bpmn.vcpe.scripts - - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Before -import org.junit.BeforeClass -import org.junit.Rule -import org.junit.Test -import org.junit.Ignore -import org.mockito.MockitoAnnotations -import org.camunda.bpm.engine.delegate.BpmnError -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.mock.FileUtil - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse -import static com.github.tomakehurst.wiremock.client.WireMock.get -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching -import static org.junit.Assert.*; -import static org.mockito.Mockito.* -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource - -import org.openecomp.mso.bpmn.core.RollbackData - -import com.github.tomakehurst.wiremock.junit.WireMockRule - -class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(PORT) - - String Prefix = "DCARTXCRB_" - String RbType = "DCARTXC_" - - @BeforeClass - public static void setUpBeforeClass() { - // nothing for now - } - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - public DoCreateAllottedResourceTXCRollbackTest() { - super("DoCreateAllottedResourceTXCRollback") - } - - - // ***** preProcessRequest ***** - - @Test -// @Ignore - public void preProcessRequest() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("prefix", Prefix) - verify(mex).setVariable("serviceInstanceId", "sii") - verify(mex).setVariable("parentServiceInstanceId", "psii") - verify(mex).setVariable("allottedResourceId", "myid") - verify(mex).setVariable("rollbackAAI", true) - verify(mex).setVariable("aaiARPath", "mypath") - verify(mex).setVariable("rollbackSDNC", true) - verify(mex).setVariable("deactivateSdnc", "myactivate") - verify(mex).setVariable("deleteSdnc", "mycreate") - verify(mex).setVariable("unassignSdnc", "true") - verify(mex).setVariable("sdncDeactivateRequest", "activatereq") - verify(mex).setVariable("sdncDeleteRequest", "createreq") - verify(mex).setVariable("sdncUnassignRequest", "assignreq") - - verify(mex, never()).setVariable("skipRollback", true) - } - - @Test -// @Ignore - public void preProcessRequest_RollbackDisabled() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("disableRollback")).thenReturn("true") - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("prefix", Prefix) - verify(mex).setVariable("serviceInstanceId", "sii") - verify(mex).setVariable("parentServiceInstanceId", "psii") - verify(mex).setVariable("allottedResourceId", "myid") - verify(mex).setVariable("rollbackAAI", true) - verify(mex).setVariable("aaiARPath", "mypath") - verify(mex).setVariable("rollbackSDNC", true) - verify(mex).setVariable("deactivateSdnc", "myactivate") - verify(mex).setVariable("deleteSdnc", "mycreate") - verify(mex).setVariable("unassignSdnc", "true") - verify(mex).setVariable("sdncDeactivateRequest", "activatereq") - verify(mex).setVariable("sdncDeleteRequest", "createreq") - verify(mex).setVariable("sdncUnassignRequest", "assignreq") - - verify(mex).setVariable("skipRollback", true) - } - - @Test -// @Ignore - public void preProcessRequest_NoAAI() { - ExecutionEntity mex = setupMock() - def data = initPreProcess(mex) - - when(mex.getVariable("rollbackAAI")).thenReturn(false) - data.put(RbType, "rollbackAAI", "false") - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("prefix", Prefix) - verify(mex).setVariable("serviceInstanceId", "sii") - verify(mex).setVariable("parentServiceInstanceId", "psii") - verify(mex).setVariable("allottedResourceId", "myid") - verify(mex, never()).setVariable("rollbackAAI", true) - verify(mex, never()).setVariable("aaiARPath", "mypath") - verify(mex).setVariable("rollbackSDNC", true) - verify(mex).setVariable("deactivateSdnc", "myactivate") - verify(mex).setVariable("deleteSdnc", "mycreate") - verify(mex).setVariable("unassignSdnc", "true") - verify(mex).setVariable("sdncDeactivateRequest", "activatereq") - verify(mex).setVariable("sdncDeleteRequest", "createreq") - verify(mex).setVariable("sdncUnassignRequest", "assignreq") - - verify(mex, never()).setVariable("skipRollback", true) - } - - @Test -// @Ignore - public void preProcessRequest_NoAssign() { - ExecutionEntity mex = setupMock() - def data = initPreProcess(mex) - - when(mex.getVariable("rollbackSDNC")).thenReturn(false) - data.put(RbType, "rollbackSDNCassign", "false") - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("prefix", Prefix) - verify(mex).setVariable("serviceInstanceId", "sii") - verify(mex).setVariable("parentServiceInstanceId", "psii") - verify(mex).setVariable("allottedResourceId", "myid") - verify(mex).setVariable("rollbackAAI", true) - verify(mex).setVariable("aaiARPath", "mypath") - verify(mex, never()).setVariable("rollbackSDNC", true) - verify(mex, never()).setVariable("deactivateSdnc", "myactivate") - verify(mex, never()).setVariable("deleteSdnc", "mycreate") - verify(mex, never()).setVariable("unassignSdnc", "true") - verify(mex, never()).setVariable("sdncDeactivateRequest", "activatereq") - verify(mex, never()).setVariable("sdncDeleteRequest", "createreq") - verify(mex, never()).setVariable("sdncUnassignRequest", "assignreq") - - verify(mex, never()).setVariable("skipRollback", true) - } - - @Test -// @Ignore - public void preProcessRequest_NoAAI_NoAssign() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("rollbackAAI")).thenReturn(false) - when(mex.getVariable("rollbackSDNC")).thenReturn(false) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) - - verify(mex).setVariable("skipRollback", true) - } - - @Test -// @Ignore - public void preProcessRequest_NoRbStructure() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("rollbackData")).thenReturn(new RollbackData()) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) - - verify(mex).setVariable("skipRollback", true) - } - - @Test -// @Ignore - public void preProcessRequest_NullRb() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("rollbackData")).thenReturn(null) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) - - verify(mex).setVariable("skipRollback", true) - } - - @Test -// @Ignore - public void preProcessRequest_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) })) - } - - @Test -// @Ignore - public void preProcessRequest_Ex() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) })) - } - - @Test -// @Ignore - public void updateAaiAROrchStatus() { - ExecutionEntity mex = setupMock() - initUpdateAaiAROrchStatus(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockPatchAllottedResource(CUST, SVC, INST, ARID) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success") - } - - @Test -// @Ignore - public void updateAaiAROrchStatus_EmptyResponse() { - ExecutionEntity mex = setupMock() - initUpdateAaiAROrchStatus(mex) - - wireMockRule - .stubFor(get(urlMatching("/aai/v[0-9]+/.*")) - .willReturn(aResponse() - .withStatus(200))) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success") })) - } - - @Test -// @Ignore - public void updateAaiAROrchStatus_NoArPath() { - ExecutionEntity mex = setupMock() - initUpdateAaiAROrchStatus(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockPatchAllottedResource(CUST, SVC, INST, ARID) - - when(mex.getVariable("aaiARPath")).thenReturn(null) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success") })) - } - - - // ***** validateSDNCResp ***** - - @Test -// @Ignore - public void validateSDNCResp() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - - DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") - - verify(mex).getVariable("WorkflowException") - verify(mex).getVariable("SDNCA_SuccessIndicator") - } - - @Test -// @Ignore - public void validateSDNCResp_Unsuccessful() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") })) - } - - @Test -// @Ignore - public void validateSDNCResp_BpmnError404() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) - - when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("404", "expected exception")) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - - DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") - } - - @Test -// @Ignore - public void validateSDNCResp_BpmnError() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) - - when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") })) - } - - @Test -// @Ignore - public void validateSDNCResp_Ex() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) - - when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") })) - } - - @Test -// @Ignore - public void deleteAaiAR() { - ExecutionEntity mex = setupMock() - initDeleteAaiAR(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) - } - - @Test -// @Ignore - public void deleteAaiAR_NoArPath() { - ExecutionEntity mex = setupMock() - initDeleteAaiAR(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) - - when(mex.getVariable("aaiARPath")).thenReturn("") - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) })) - } - - @Test -// @Ignore - public void deleteAaiAR_BpmnError() { - ExecutionEntity mex = setupMock() - initDeleteAaiAR(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) - - when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) })) - } - - @Test -// @Ignore - public void deleteAaiAR_Ex() { - ExecutionEntity mex = setupMock() - initDeleteAaiAR(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) - - when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) })) - } - - @Test -// @Ignore - public void postProcessRequest() { - ExecutionEntity mex = setupMock() - initPostProcessRequest(mex) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.postProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("rollbackData", null) - verify(mex).setVariable("rolledBack", true) - } - - @Test -// @Ignore - public void postProcessRequest_RolledBack() { - ExecutionEntity mex = setupMock() - initPostProcessRequest(mex) - - when(mex.getVariable("skipRollback")).thenReturn(true) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.postProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("rollbackData", null) - verify(mex, never()).setVariable("rolledBack", true) - } - - @Test -// @Ignore - public void postProcessRequest_BpmnError() { - ExecutionEntity mex = setupMock() - initPostProcessRequest(mex) - - when(mex.getVariable("skipRollback")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.postProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("rollbackData", null) - verify(mex, never()).setVariable("rolledBack", true) - } - - @Test -// @Ignore - public void postProcessRequest_Ex() { - ExecutionEntity mex = setupMock() - initPostProcessRequest(mex) - - when(mex.getVariable("skipRollback")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.postProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("rollbackData", null) - verify(mex, never()).setVariable("rolledBack", true) - } - - @Test -// @Ignore - public void processRollbackException() { - ExecutionEntity mex = setupMock() - initProcessRollbackException(mex) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.processRollbackException(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("rollbackData", null) - verify(mex).setVariable("rolledBack", false) - verify(mex).setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback") - verify(mex).setVariable("WorkflowException", null) - } - - @Test -// @Ignore - public void processRollbackException_BpmnError() { - ExecutionEntity mex = setupMock() - initProcessRollbackException(mex) - - doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.processRollbackException(mex) - } - - @Test -// @Ignore - public void processRollbackException_Ex() { - ExecutionEntity mex = setupMock() - initProcessRollbackException(mex) - - doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.processRollbackException(mex) - } - - @Test -// @Ignore - public void processRollbackJavaException() { - ExecutionEntity mex = setupMock() - initProcessRollbackException(mex) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.processRollbackJavaException(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("rollbackData", null) - verify(mex).setVariable("rolledBack", false) - verify(mex).setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback") - verify(mex, never()).setVariable("WorkflowException", null) - } - - @Test -// @Ignore - public void processRollbackJavaException_BpmnError() { - ExecutionEntity mex = setupMock() - initProcessRollbackException(mex) - - doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.processRollbackJavaException(mex) - } - - @Test -// @Ignore - public void processRollbackJavaException_Ex() { - ExecutionEntity mex = setupMock() - initProcessRollbackException(mex) - - doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null) - - DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() - DoCreateAllottedResourceTXCRollback.processRollbackJavaException(mex) - } - - private RollbackData initPreProcess(ExecutionEntity mex) { - def data = new RollbackData() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("rollbackData")).thenReturn(data) - when(mex.getVariable("rollbackAAI")).thenReturn(true) - when(mex.getVariable("rollbackSDNC")).thenReturn(true) - when(mex.getVariable("disableRollback")).thenReturn("false") - - data.put("SERVICEINSTANCE", "allottedResourceId", "myid") - - data.put(RbType, "serviceInstanceId", "sii") - data.put(RbType, "parentServiceInstanceId", "psii") - - data.put(RbType, "rollbackAAI", "true") - data.put(RbType, "aaiARPath", "mypath") - - data.put(RbType, "rollbackSDNCassign", "true") - data.put(RbType, "rollbackSDNCactivate", "myactivate") - data.put(RbType, "rollbackSDNCcreate", "mycreate") - data.put(RbType, "sdncActivateRollbackReq", "activatereq") - data.put(RbType, "sdncCreateRollbackReq", "createreq") - data.put(RbType, "sdncAssignRollbackReq", "assignreq") - - return data - } - - private initUpdateAaiAROrchStatus(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) - when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) - } - - private initValidateSDNCResp(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("prefix")).thenReturn(Prefix) - when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) - } - - private String initValidateSDNCResp_Resp() { - return "<response-code>200</response-code>" - } - - private initDeleteAaiAR(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("aaiARResourceVersion")).thenReturn(VERS) - when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) - when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) - } - - private initPostProcessRequest(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("skipRollback")).thenReturn(false) - } - - private initProcessRollbackException(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - } - - private initProcessRollbackJavaException(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy deleted file mode 100644 index e1fc143576..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy +++ /dev/null @@ -1,950 +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.bpmn.vcpe.scripts - - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Before -import org.junit.BeforeClass -import org.junit.Rule -import org.junit.Test -import org.junit.Ignore -import org.mockito.MockitoAnnotations -import org.camunda.bpm.engine.delegate.BpmnError -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.mock.FileUtil - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse -import static com.github.tomakehurst.wiremock.client.WireMock.put -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching -import static org.junit.Assert.*; -import static org.mockito.Mockito.* -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource_500 - -import java.util.Map - -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter - -import com.github.tomakehurst.wiremock.junit.WireMockRule - -class DoCreateAllottedResourceTXCTest extends GroovyTestBase { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(PORT) - - String Prefix = "DCARTXC_" - - @BeforeClass - public static void setUpBeforeClass() { - // nothing for now - } - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - public DoCreateAllottedResourceTXCTest() { - super("DoCreateAllottedResourceTXC") - } - - - // ***** preProcessRequest ***** - - @Test - // @Ignore - public void preProcessRequest() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.preProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("prefix", Prefix) - - assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdncadapter_callback")) - assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdnc_replication_delay")) - assertTrue(checkMissingPreProcessRequest("serviceInstanceId")) - assertTrue(checkMissingPreProcessRequest("parentServiceInstanceId")) - assertTrue(checkMissingPreProcessRequest("allottedResourceModelInfo")) - assertTrue(checkMissingPreProcessRequest("brgWanMacAddress")) - assertTrue(checkMissingPreProcessRequest("allottedResourceRole")) - assertTrue(checkMissingPreProcessRequest("allottedResourceType")) - } - - - // ***** getAaiAR ***** - - @Test - // @Ignore - public void getAaiAR() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") - - ExecutionEntity mex = setupMock() - initGetAaiAR(mex) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.getAaiAR(mex) - - verify(mex).setVariable("foundActiveAR", true) - } - - @Test - // @Ignore - public void getAaiAR_Duplicate() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") - - ExecutionEntity mex = setupMock() - initGetAaiAR(mex) - - // fail if duplicate - when(mex.getVariable("failExists")).thenReturn("true") - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXC.getAaiAR(mex) })) - } - - @Test - // @Ignore - public void getAaiAR_NotActive() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") - - ExecutionEntity mex = setupMock() - initGetAaiAR(mex) - - // not active - when(mex.getVariable("aaiAROrchStatus")).thenReturn("not-active") - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXC.getAaiAR(mex) })) - } - - @Test - // @Ignore - public void getAaiAR_NoStatus() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") - - ExecutionEntity mex = setupMock() - initGetAaiAR(mex) - - when(mex.getVariable("aaiAROrchStatus")).thenReturn(null) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.getAaiAR(mex) - - verify(mex, never()).setVariable("foundActiveAR", true) - } - - - // ***** createAaiAR ***** - - @Test - // @Ignore - public void createAaiAR() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initCreateAaiAr(mex) - - MockPutAllottedResource(CUST, SVC, INST, ARID) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.createAaiAR(mex) - - def data = map.get("rollbackData") - assertNotNull(data) - assertTrue(data instanceof RollbackData) - - assertEquals("45", data.get(Prefix, "disableRollback")) - assertEquals("true", data.get(Prefix, "rollbackAAI")) - assertEquals(ARID, data.get(Prefix, "allottedResourceId")) - assertEquals("sii", data.get(Prefix, "serviceInstanceId")) - assertEquals("psii", data.get(Prefix, "parentServiceInstanceId")) - assertEquals(mex.getVariable("PSI_resourceLink")+"/allotted-resources/allotted-resource/"+ARID, data.get(Prefix, "aaiARPath")) - } - - @Test - // @Ignore - public void createAaiAR_NoArid_NoModelUuids() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initCreateAaiAr(mex) - - // no allottedResourceId - will be generated - - when(mex.getVariable("allottedResourceId")).thenReturn(null) - - wireMockRule - .stubFor(put(urlMatching("/aai/.*/allotted-resource/.*")) - .willReturn(aResponse() - .withStatus(200))) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.createAaiAR(mex) - - def arid = map.get("allottedResourceId") - assertNotNull(arid) - assertFalse(arid.isEmpty()) - - def data = map.get("rollbackData") - assertNotNull(data) - assertTrue(data instanceof RollbackData) - - assertEquals(arid, data.get(Prefix, "allottedResourceId")) - } - - @Test - // @Ignore - public void createAaiAR_MissingPsiLink() { - ExecutionEntity mex = setupMock() - initCreateAaiAr(mex) - - when(mex.getVariable("PSI_resourceLink")).thenReturn(null) - - MockPutAllottedResource(CUST, SVC, INST, ARID) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) })) - } - - @Test - // @Ignore - public void createAaiAR_HttpFailed() { - ExecutionEntity mex = setupMock() - initCreateAaiAr(mex) - - MockPutAllottedResource_500(CUST, SVC, INST, ARID) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) })) - } - - @Test - // @Ignore - public void createAaiAR_BpmnError() { - ExecutionEntity mex = setupMock() - initCreateAaiAr(mex) - - when(mex.getVariable("URN_aai_endpoint")).thenThrow(new BpmnError("expected exception")) - - MockPutAllottedResource(CUST, SVC, INST, ARID) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) })) - } - - @Test - // @Ignore - public void createAaiAR_Ex() { - ExecutionEntity mex = setupMock() - initCreateAaiAr(mex) - - when(mex.getVariable("URN_aai_endpoint")).thenThrow(new RuntimeException("expected exception")) - - MockPutAllottedResource(CUST, SVC, INST, ARID) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) })) - } - - - // ***** buildSDNCRequest ***** - - @Test - // @Ignore - public void buildSDNCRequest() { - ExecutionEntity mex = setupMock() - initBuildSDNCRequest(mex) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - String result = DoCreateAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq") - - assertTrue(result.indexOf("myreq= 0) - assertTrue(result.indexOf("myact= 0) - assertTrue(result.indexOf("ari= 0) - assertTrue(result.indexOf("sii= 0) - assertTrue(result.indexOf("sii= 0) - assertTrue(result.indexOf("psii= 0) - assertTrue(result.indexOf("sst= 0) - assertTrue(result.indexOf("gci= 0) - assertTrue(result.indexOf("scu= 0) - assertTrue(result.indexOf("mri= 0) - assertTrue(result.indexOf("") >= 0) - assertTrue(result.indexOf("") >= 0) - assertTrue(result.indexOf("") >= 0) - assertTrue(result.indexOf("") >= 0) - assertTrue(result.indexOf("") >= 0) - } - - @Test - // @Ignore - public void buildSDNCRequest_Ex() { - ExecutionEntity mex = setupMock() - initBuildSDNCRequest(mex) - - when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq") })) - } - - - // ***** preProcessSDNCAssign ***** - - @Test - // @Ignore - public void preProcessSDNCAssign() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - def data = initPreProcessSDNC(mex) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.preProcessSDNCAssign(mex) - - def req = map.get("sdncAssignRequest") - assertNotNull(req) - - assertEquals(data, map.get("rollbackData")) - - def rbreq = data.get(Prefix, "sdncAssignRollbackReq") - - assertTrue(req.indexOf("assign= 0) - assertTrue(req.indexOf("CreateTunnelXConnInstance= 0) - assertTrue(req.indexOf("") >= 0) - - assertTrue(rbreq.indexOf("unassign= 0) - assertTrue(rbreq.indexOf("DeleteTunnelXConnInstance= 0) - assertTrue(rbreq.indexOf("") >= 0) - } - - @Test - // @Ignore - public void preProcessSDNCAssign_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCAssign(mex) })) - } - - @Test - // @Ignore - public void preProcessSDNCAssign_Ex() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCAssign(mex) })) - } - - - // ***** preProcessSDNCCreate ***** - - @Test - // @Ignore - public void preProcessSDNCCreate() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - def data = initPreProcessSDNC(mex) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.preProcessSDNCCreate(mex) - - def req = map.get("sdncCreateRequest") - assertNotNull(req) - - assertEquals(data, map.get("rollbackData")) - - def rbreq = data.get(Prefix, "sdncCreateRollbackReq") - - assertTrue(req.indexOf("create= 0) - assertTrue(req.indexOf("CreateTunnelXConnInstance= 0) - assertTrue(req.indexOf("") >= 0) - - assertTrue(rbreq.indexOf("delete= 0) - assertTrue(rbreq.indexOf("DeleteTunnelXConnInstance= 0) - assertTrue(rbreq.indexOf("") >= 0) - - } - - @Test - // @Ignore - public void preProcessSDNCCreate_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCCreate(mex) })) - } - - @Test - // @Ignore - public void preProcessSDNCCreate_Ex() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCCreate(mex) })) - } - - - // ***** preProcessSDNCActivate ***** - - @Test - // @Ignore - public void preProcessSDNCActivate() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - def data = initPreProcessSDNC(mex) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.preProcessSDNCActivate(mex) - - def req = map.get("sdncActivateRequest") - assertNotNull(req) - - assertEquals(data, map.get("rollbackData")) - - def rbreq = data.get(Prefix, "sdncActivateRollbackReq") - - assertTrue(req.indexOf("activate= 0) - assertTrue(req.indexOf("CreateTunnelXConnInstance= 0) - assertTrue(req.indexOf("") >= 0) - - assertTrue(rbreq.indexOf("deactivate= 0) - assertTrue(rbreq.indexOf("DeleteTunnelXConnInstance= 0) - assertTrue(rbreq.indexOf("") >= 0) - - } - - @Test - // @Ignore - public void preProcessSDNCActivate_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCActivate(mex) })) - } - - @Test - // @Ignore - public void preProcessSDNCActivate_Ex() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCActivate(mex) })) - } - - - // ***** validateSDNCResp ***** - - @Test - // @Ignore - public void validateSDNCResp() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - def data = initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") - - verify(mex).getVariable("WorkflowException") - verify(mex).getVariable("SDNCA_SuccessIndicator") - verify(mex).getVariable("rollbackData") - - assertEquals(data, map.get("rollbackData")) - - assertEquals("true", data.get(Prefix, "rollback" + "SDNCcreate")) - - } - - @Test - // @Ignore - public void validateSDNCResp_Get() { - ExecutionEntity mex = setupMock() - def data = initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "get") - - verify(mex).getVariable("WorkflowException") - verify(mex).getVariable("SDNCA_SuccessIndicator") - - verify(mex, never()).getVariable("rollbackData") - } - - @Test - // @Ignore - public void validateSDNCResp_Unsuccessful() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - - // unsuccessful - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") })) - } - - @Test - // @Ignore - public void validateSDNCResp_BpmnError() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - - when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") })) - } - - @Test - // @Ignore - public void validateSDNCResp_Ex() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp() - - when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") })) - } - - - // ***** preProcessSDNCGet ***** - - @Test - // @Ignore - public void preProcessSDNCGet_FoundAR() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcessSDNCGet(mex) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.preProcessSDNCGet(mex) - - String req = map.get("sdncGetRequest") - - assertTrue(req.indexOf("") >= 0) - assertTrue(req.indexOf("sii= 0) - assertTrue(req.indexOf("arlink= 0) - assertTrue(req.indexOf("myurl= 0) - - } - - @Test - // @Ignore - public void preProcessSDNCGet_NotFoundAR() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcessSDNCGet(mex) - - when(mex.getVariable("foundActiveAR")).thenReturn(false) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.preProcessSDNCGet(mex) - - String req = map.get("sdncGetRequest") - - assertTrue(req.indexOf("") >= 0) - assertTrue(req.indexOf("sii= 0) - assertTrue(req.indexOf("assignlink= 0) - assertTrue(req.indexOf("myurl= 0) - - } - - @Test - // @Ignore - public void preProcessSDNCGet_Ex() { - ExecutionEntity mex = setupMock() - initPreProcessSDNCGet(mex) - - when(mex.getVariable("foundActiveAR")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCGet(mex) })) - } - - - // ***** updateAaiAROrchStatus ***** - - @Test - // @Ignore - public void updateAaiAROrchStatus() { - MockPatchAllottedResource(CUST, SVC, INST, ARID) - - ExecutionEntity mex = setupMock() - initUpdateAaiAROrchStatus(mex) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.updateAaiAROrchStatus(mex, "success") - } - - - // ***** generateOutputs ***** - - @Test - // @Ignore - public void generateOutputs() { - ExecutionEntity mex = setupMock() - def txctop = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml") - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("enhancedCallbackRequestData")).thenReturn(txctop) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.generateOutputs(mex) - - verify(mex).setVariable("allotedResourceName", "namefromrequest") - verify(mex).setVariable("vni", "my-vni") - verify(mex).setVariable("vgmuxBearerIP", "my-bearer-ip") - verify(mex).setVariable("vgmuxLanIP", "my-lan-ip") - - } - - @Test - // @Ignore - public void generateOutputs_BadXml() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("enhancedCallbackRequestData")).thenReturn("invalid xml") - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.generateOutputs(mex) - - verify(mex, never()).setVariable(anyString(), anyString()) - - } - - @Test - // @Ignore - public void generateOutputs_BpmnError() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - DoCreateAllottedResourceTXC.generateOutputs(mex) - verify(mex, never()).setVariable(anyString(), anyString()) - - } - - @Test - // @Ignore - public void generateOutputs_Ex() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - DoCreateAllottedResourceTXC.generateOutputs(mex) - verify(mex, never()).setVariable(anyString(), anyString()) - - } - - - // ***** preProcessRollback ***** - - @Test - // @Ignore - public void preProcessRollback() { - ExecutionEntity mex = setupMock() - WorkflowException wfe = mock(WorkflowException.class) - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("WorkflowException")).thenReturn(wfe) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.preProcessRollback(mex) - - verify(mex).setVariable("prevWorkflowException", wfe) - - } - - @Test - // @Ignore - public void preProcessRollback_NotWFE() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("WorkflowException")).thenReturn("I'm not a WFE") - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.preProcessRollback(mex) - -// verify(mex, never()).setVariable("prevWorkflowException", any()) - - } - - @Test - // @Ignore - public void preProcessRollback_BpmnError() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - DoCreateAllottedResourceTXC.preProcessRollback(mex) - - } - - @Test - // @Ignore - public void preProcessRollback_Ex() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - DoCreateAllottedResourceTXC.preProcessRollback(mex) - - } - - - // ***** postProcessRollback ***** - - @Test - // @Ignore - public void postProcessRollback() { - ExecutionEntity mex = setupMock() - WorkflowException wfe = mock(WorkflowException.class) - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("prevWorkflowException")).thenReturn(wfe) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.postProcessRollback(mex) - - verify(mex).setVariable("WorkflowException", wfe) - verify(mex).setVariable("rollbackData", null) - - } - - @Test - // @Ignore - public void postProcessRollback_NotWFE() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("prevWorkflowException")).thenReturn("I'm not a WFE") - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - DoCreateAllottedResourceTXC.postProcessRollback(mex) - -// verify(mex, never()).setVariable("WorkflowException", any()) - verify(mex).setVariable("rollbackData", null) - - } - - @Test - // @Ignore - public void postProcessRollback_BpmnError() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception")) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.postProcessRollback(mex) })) - verify(mex, never()).setVariable("rollbackData", null) - - } - - @Test - // @Ignore - public void postProcessRollback_Ex() { - ExecutionEntity mex = setupMock() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception")) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - DoCreateAllottedResourceTXC.postProcessRollback(mex) - verify(mex, never()).setVariable("rollbackData", null) - - } - - private boolean checkMissingPreProcessRequest(String fieldnm) { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() - - when(mex.getVariable(fieldnm)).thenReturn("") - - return doBpmnError( { _ -> DoCreateAllottedResourceTXC.preProcessRequest(mex) }) - } - - private void initPreProcess(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("sdncurn") - when(mex.getVariable("URN_mso_workflow_sdnc_replication_delay")).thenReturn("sdncdelay") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") - when(mex.getVariable("allottedResourceModelInfo")).thenReturn("armi") - when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma") - when(mex.getVariable("allottedResourceRole")).thenReturn("arr") - when(mex.getVariable("allottedResourceType")).thenReturn("art") - } - - private void initGetAaiAR(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("allottedResourceType")).thenReturn("TXCt") - when(mex.getVariable("allottedResourceRole")).thenReturn("TXCr") - when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml")) - when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) - when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active") - } - - private initCreateAaiAr(ExecutionEntity mex) { - when(mex.getVariable("disableRollback")).thenReturn(45) - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("allottedResourceId")).thenReturn(ARID) - when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) - when(mex.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn(urnProps.get("mso.workflow.global.default.aai.namespace")) - when(mex.getVariable("PSI_resourceLink")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST) - when(mex.getVariable("allottedResourceType")).thenReturn("TXCt") - when(mex.getVariable("allottedResourceRole")).thenReturn("TXCr") - when(mex.getVariable("CSI_resourceLink")).thenReturn(aaiUriPfx+"/aai/v9/mycsi") - when(mex.getVariable("allottedResourceModelInfo")).thenReturn(""" - { - "modelInvariantUuid":"modelinvuuid", - "modelUuid":"modeluuid", - "modelCustomizationUuid":"modelcustuuid" - } - """) - } - - private initBuildSDNCRequest(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("allottedResourceId")).thenReturn("ari") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") - when(mex.getVariable("subscriptionServiceType")).thenReturn("sst") - when(mex.getVariable("globalCustomerId")).thenReturn("gci") - when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu") - when(mex.getVariable("msoRequestId")).thenReturn("mri") - } - - private RollbackData initPreProcessSDNC(ExecutionEntity mex) { - def data = new RollbackData() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("rollbackData")).thenReturn(data) - - return data - } - - private initPreProcessSDNCGet(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl") - when(mex.getVariable("foundActiveAR")).thenReturn(true) - when(mex.getVariable("aaiARGetResponse")).thenReturn("arlink") - when(mex.getVariable("sdncAssignResponse")).thenReturn("<object-path>assignlink</object-path>") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl") - } - - private RollbackData initValidateSDNCResp(ExecutionEntity mex) { - def data = new RollbackData() - - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("prefix")).thenReturn(Prefix) - when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) - when(mex.getVariable("rollbackData")).thenReturn(data) - - return data - } - - private String initValidateSDNCResp_Resp() { - return "<response-code>200</response-code>" - } - - private initUpdateAaiAROrchStatus(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy deleted file mode 100644 index 14c382eb39..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy +++ /dev/null @@ -1,603 +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.bpmn.vcpe.scripts - - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Before -import org.junit.BeforeClass -import org.junit.Rule -import org.junit.Test -import org.junit.Ignore -import org.mockito.MockitoAnnotations -import org.camunda.bpm.engine.delegate.BpmnError -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.mock.FileUtil - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse -import static com.github.tomakehurst.wiremock.client.WireMock.delete -import static com.github.tomakehurst.wiremock.client.WireMock.get -import static com.github.tomakehurst.wiremock.client.WireMock.patch -import static com.github.tomakehurst.wiremock.client.WireMock.put -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching -import static org.junit.Assert.*; -import static org.mockito.Mockito.* -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById - -import java.util.Map - -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter - -import com.github.tomakehurst.wiremock.junit.WireMockRule - -class DoDeleteAllottedResourceBRGTest extends GroovyTestBase { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(PORT) - - String Prefix = "DDARBRG_" - - @BeforeClass - public static void setUpBeforeClass() { - // nothing for now - } - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - public DoDeleteAllottedResourceBRGTest() { - super("DoDeleteAllottedResourceBRG") - } - - - // ***** preProcessRequest ***** - - @Test -// @Ignore - public void preProcessRequest() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - DoDeleteAllottedResourceBRG.preProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("prefix", Prefix) - verify(mex).setVariable("sdncCallbackUrl", "sdncurn") - - assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdncadapter_callback")) - assertTrue(checkMissingPreProcessRequest("serviceInstanceId")) - assertTrue(checkMissingPreProcessRequest("allottedResourceId")) - } - - @Test -// @Ignore - public void preProcessRequest_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("serviceInstanceId")).thenThrow(new BpmnError("expected exception")) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.preProcessRequest(mex) })) - } - - @Test -// @Ignore - public void preProcessRequest_Ex() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception")) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.preProcessRequest(mex) })) - } - - - // ***** getAaiAR ***** - - @Test -// @Ignore - public void getAaiAR() { - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml") - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") - - ExecutionEntity mex = setupMock() - initGetAaiAR(mex) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - DoDeleteAllottedResourceBRG.getAaiAR(mex) - - verify(mex).setVariable("parentServiceInstanceId", INST) - } - - @Test -// @Ignore - public void getAaiAR_EmptyResponse() { - - // note: empty result-link - wireMockRule - .stubFor(get(urlMatching("/aai/.*/search/.*")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(""))) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") - - ExecutionEntity mex = setupMock() - initGetAaiAR(mex) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.getAaiAR(mex) })) - } - - - // ***** updateAaiAROrchStatus ***** - - @Test -// @Ignore - public void updateAaiAROrchStatus() { - ExecutionEntity mex = setupMock() - initUpdateAaiAROrchStatus(mex) - - MockPatchAllottedResource(CUST, SVC, INST, ARID) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - DoDeleteAllottedResourceBRG.updateAaiAROrchStatus(mex, "success") - } - - - // ***** buildSDNCRequest ***** - - @Test -// @Ignore - public void buildSDNCRequest() { - ExecutionEntity mex = setupMock() - initBuildSDNCRequest(mex) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - String result = DoDeleteAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") - - assertTrue(result.indexOf("myreq= 0) - assertTrue(result.indexOf("myact= 0) - assertTrue(result.indexOf("ari= 0) - assertTrue(result.indexOf("sii= 0) - assertTrue(result.indexOf("sii= 0) - assertTrue(result.indexOf("psii= 0) - assertTrue(result.indexOf("sst= 0) - assertTrue(result.indexOf("gci= 0) - assertTrue(result.indexOf("scu= 0) - assertTrue(result.indexOf("mri= 0) - assertTrue(result.indexOf("") >= 0) - assertTrue(result.indexOf("") >= 0) - assertTrue(result.indexOf("") >= 0) - assertTrue(result.indexOf("") >= 0) - assertTrue(result.indexOf("") >= 0) - } - - @Test -// @Ignore - public void buildSDNCRequest_Ex() { - ExecutionEntity mex = setupMock() - initBuildSDNCRequest(mex) - - when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") })) - } - - - // ***** preProcessSDNCUnassign ***** - - @Test -// @Ignore - public void preProcessSDNCUnassign() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcessSDNC(mex) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - DoDeleteAllottedResourceBRG.preProcessSDNCUnassign(mex) - - def req = map.get("sdncUnassignRequest") - - assertTrue(req.indexOf("unassign= 0) - assertTrue(req.indexOf("DeleteBRGInstance= 0) - assertTrue(req.indexOf("") >= 0) - } - - @Test -// @Ignore - public void preProcessSDNCUnassign_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception")) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCUnassign(mex) })) - } - - @Test -// @Ignore - public void preProcessSDNCUnassign_Ex() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCUnassign(mex) })) - } - - - // ***** preProcessSDNCDelete ***** - - @Test -// @Ignore - public void preProcessSDNCDelete() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcessSDNC(mex) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - DoDeleteAllottedResourceBRG.preProcessSDNCDelete(mex) - - def req = map.get("sdncDeleteRequest") - - assertTrue(req.indexOf("delete= 0) - assertTrue(req.indexOf("DeleteBRGInstance= 0) - assertTrue(req.indexOf("") >= 0) - } - - @Test -// @Ignore - public void preProcessSDNCDelete_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception")) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDelete(mex) })) - } - - @Test -// @Ignore - public void preProcessSDNCDelete_Ex() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDelete(mex) })) - } - - - // ***** preProcessSDNCDeactivate ***** - - @Test -// @Ignore - public void preProcessSDNCDeactivate() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcessSDNC(mex) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - DoDeleteAllottedResourceBRG.preProcessSDNCDeactivate(mex) - - def req = map.get("sdncDeactivateRequest") - - assertTrue(req.indexOf("deactivate= 0) - assertTrue(req.indexOf("DeleteBRGInstance= 0) - assertTrue(req.indexOf("") >= 0) - } - - @Test -// @Ignore - public void preProcessSDNCDeactivate_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception")) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDeactivate(mex) })) - } - - @Test -// @Ignore - public void preProcessSDNCDeactivate_Ex() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDeactivate(mex) })) - } - - - // ***** validateSDNCResp ***** - - @Test -// @Ignore - public void validateSDNCResp() { - ExecutionEntity mex = setupMock() - def data = initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp(200) - - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create") - - verify(mex).getVariable("WorkflowException") - verify(mex).getVariable("SDNCA_SuccessIndicator") - verify(mex).getVariable(Prefix+"sdncResponseSuccess") - - verify(mex, never()).getVariable(Prefix + "sdncRequestDataResponseCode") - verify(mex, never()).setVariable("wasDeleted", false) - } - - @Test -// @Ignore - public void validateSDNCResp_Fail404_Deactivate_FailNotFound() { - ExecutionEntity mex = setupMock() - def data = initValidateSDNCResp(mex) - - def resp = initValidateSDNCResp_Resp(404) - when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404") - when(mex.getVariable("failNotFound")).thenReturn("true") - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "deactivate")})) - } - - @Test -// @Ignore - public void validateSDNCResp_Fail404_Deactivate() { - ExecutionEntity mex = setupMock() - def data = initValidateSDNCResp(mex) - - def resp = initValidateSDNCResp_Resp(404) - when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404") - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "deactivate") - - verify(mex).setVariable("ARNotFoundInSDNC", true) - verify(mex).setVariable("wasDeleted", false) - } - - @Test -// @Ignore - public void validateSDNCResp_Fail404() { - ExecutionEntity mex = setupMock() - def data = initValidateSDNCResp(mex) - - def resp = initValidateSDNCResp_Resp(404) - when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404") - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create")})) - } - - @Test -// @Ignore - public void validateSDNCResp_Deactivate() { - ExecutionEntity mex = setupMock() - def data = initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp(200) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "deactivate")})) - } - - @Test -// @Ignore - public void validateSDNCResp_BpmnError() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp(200) - - when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create") })) - } - - @Test -// @Ignore - public void validateSDNCResp_Ex() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp(200) - - when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create") })) - } - - @Test -// @Ignore - public void deleteAaiAR() { - ExecutionEntity mex = setupMock() - initDeleteAaiAR(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - DoDeleteAllottedResourceBRG.deleteAaiAR(mex) - } - - @Test -// @Ignore - public void deleteAaiAR_NoArPath() { - ExecutionEntity mex = setupMock() - initDeleteAaiAR(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) - - when(mex.getVariable("aaiARPath")).thenReturn("") - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.deleteAaiAR(mex) })) - } - - @Test -// @Ignore - public void deleteAaiAR_BpmnError() { - ExecutionEntity mex = setupMock() - initDeleteAaiAR(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) - - when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception")) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.deleteAaiAR(mex) })) - } - - @Test -// @Ignore - public void deleteAaiAR_Ex() { - ExecutionEntity mex = setupMock() - initDeleteAaiAR(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) - - when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception")) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.deleteAaiAR(mex) })) - } - - private boolean checkMissingPreProcessRequest(String fieldnm) { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() - - when(mex.getVariable(fieldnm)).thenReturn("") - - return doBpmnError( { _ -> DoDeleteAllottedResourceBRG.preProcessRequest(mex) }) - } - - private void initPreProcess(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("sdncurn") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("allottedResourceId")).thenReturn("ari") - } - - private void initGetAaiAR(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("allottedResourceType")).thenReturn("BRG") - when(mex.getVariable("allottedResourceRole")).thenReturn("BRG") - when(mex.getVariable("allottedResourceId")).thenReturn(ARID) - when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoDeleteAllottedResourceBRG/getAR.xml")) - when(mex.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn(urnProps.get("mso.workflow.global.default.aai.namespace")) - when(mex.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn(urnProps.get("mso.workflow.global.default.aai.version")) - when(mex.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn(urnProps.get("mso.workflow.default.aai.v8.nodes-query.uri")) - when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) - when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) - when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active") - } - - private initUpdateAaiAROrchStatus(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) - } - - private initBuildSDNCRequest(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("allottedResourceId")).thenReturn("ari") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") - when(mex.getVariable("subscriptionServiceType")).thenReturn("sst") - when(mex.getVariable("globalCustomerId")).thenReturn("gci") - when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu") - when(mex.getVariable("msoRequestId")).thenReturn("mri") - } - - private initPreProcessSDNC(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - } - - private initValidateSDNCResp(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("prefix")).thenReturn(Prefix) - when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) - } - - private String initValidateSDNCResp_Resp(int code) { - return "<response-code>${code}</response-code>" - } - - private initDeleteAaiAR(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) - when(mex.getVariable("aaiARResourceVersion")).thenReturn("myvers") - when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy deleted file mode 100644 index 115f298062..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy +++ /dev/null @@ -1,603 +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.bpmn.vcpe.scripts - - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Before -import org.junit.BeforeClass -import org.junit.Rule -import org.junit.Test -import org.junit.Ignore -import org.mockito.MockitoAnnotations -import org.camunda.bpm.engine.delegate.BpmnError -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.mock.FileUtil - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse -import static com.github.tomakehurst.wiremock.client.WireMock.delete -import static com.github.tomakehurst.wiremock.client.WireMock.get -import static com.github.tomakehurst.wiremock.client.WireMock.patch -import static com.github.tomakehurst.wiremock.client.WireMock.put -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching -import static org.junit.Assert.*; -import static org.mockito.Mockito.* -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById - -import java.util.Map - -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter - -import com.github.tomakehurst.wiremock.junit.WireMockRule - -class DoDeleteAllottedResourceTXCTest extends GroovyTestBase { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(PORT) - - String Prefix = "DDARTXC_" - - @BeforeClass - public static void setUpBeforeClass() { - // nothing for now - } - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - public DoDeleteAllottedResourceTXCTest() { - super("DoDeleteAllottedResourceTXC") - } - - - // ***** preProcessRequest ***** - - @Test -// @Ignore - public void preProcessRequest() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - DoDeleteAllottedResourceTXC.preProcessRequest(mex) - - verify(mex).getVariable(DBGFLAG) - verify(mex).setVariable("prefix", Prefix) - verify(mex).setVariable("sdncCallbackUrl", "sdncurn") - - assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdncadapter_callback")) - assertTrue(checkMissingPreProcessRequest("serviceInstanceId")) - assertTrue(checkMissingPreProcessRequest("allottedResourceId")) - } - - @Test -// @Ignore - public void preProcessRequest_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("serviceInstanceId")).thenThrow(new BpmnError("expected exception")) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) })) - } - - @Test -// @Ignore - public void preProcessRequest_Ex() { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception")) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) })) - } - - - // ***** getAaiAR ***** - - @Test -// @Ignore - public void getAaiAR() { - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml") - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") - - ExecutionEntity mex = setupMock() - initGetAaiAR(mex) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - DoDeleteAllottedResourceTXC.getAaiAR(mex) - - verify(mex).setVariable("parentServiceInstanceId", INST) - } - - @Test -// @Ignore - public void getAaiAR_EmptyResponse() { - - // note: empty result-link - wireMockRule - .stubFor(get(urlMatching("/aai/.*/search/.*")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(""))) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") - - ExecutionEntity mex = setupMock() - initGetAaiAR(mex) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.getAaiAR(mex) })) - } - - - // ***** updateAaiAROrchStatus ***** - - @Test -// @Ignore - public void updateAaiAROrchStatus() { - ExecutionEntity mex = setupMock() - initUpdateAaiAROrchStatus(mex) - - MockPatchAllottedResource(CUST, SVC, INST, ARID) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - DoDeleteAllottedResourceTXC.updateAaiAROrchStatus(mex, "success") - } - - - // ***** buildSDNCRequest ***** - - @Test -// @Ignore - public void buildSDNCRequest() { - ExecutionEntity mex = setupMock() - initBuildSDNCRequest(mex) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - String result = DoDeleteAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq") - - assertTrue(result.indexOf("myreq= 0) - assertTrue(result.indexOf("myact= 0) - assertTrue(result.indexOf("ari= 0) - assertTrue(result.indexOf("sii= 0) - assertTrue(result.indexOf("sii= 0) - assertTrue(result.indexOf("psii= 0) - assertTrue(result.indexOf("sst= 0) - assertTrue(result.indexOf("gci= 0) - assertTrue(result.indexOf("scu= 0) - assertTrue(result.indexOf("mri= 0) - assertTrue(result.indexOf("") >= 0) - assertTrue(result.indexOf("") >= 0) - assertTrue(result.indexOf("") >= 0) - assertTrue(result.indexOf("") >= 0) - assertTrue(result.indexOf("") >= 0) - } - - @Test -// @Ignore - public void buildSDNCRequest_Ex() { - ExecutionEntity mex = setupMock() - initBuildSDNCRequest(mex) - - when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq") })) - } - - - // ***** preProcessSDNCUnassign ***** - - @Test -// @Ignore - public void preProcessSDNCUnassign() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcessSDNC(mex) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex) - - def req = map.get("sdncUnassignRequest") - - assertTrue(req.indexOf("unassign= 0) - assertTrue(req.indexOf("DeleteTunnelXConnInstance= 0) - assertTrue(req.indexOf("") >= 0) - } - - @Test -// @Ignore - public void preProcessSDNCUnassign_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception")) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex) })) - } - - @Test -// @Ignore - public void preProcessSDNCUnassign_Ex() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex) })) - } - - - // ***** preProcessSDNCDelete ***** - - @Test -// @Ignore - public void preProcessSDNCDelete() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcessSDNC(mex) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex) - - def req = map.get("sdncDeleteRequest") - - assertTrue(req.indexOf("delete= 0) - assertTrue(req.indexOf("DeleteTunnelXConnInstance= 0) - assertTrue(req.indexOf("") >= 0) - } - - @Test -// @Ignore - public void preProcessSDNCDelete_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception")) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex) })) - } - - @Test -// @Ignore - public void preProcessSDNCDelete_Ex() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex) })) - } - - - // ***** preProcessSDNCDeactivate ***** - - @Test -// @Ignore - public void preProcessSDNCDeactivate() { - ExecutionEntity mex = setupMock() - def map = setupMap(mex) - initPreProcessSDNC(mex) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex) - - def req = map.get("sdncDeactivateRequest") - - assertTrue(req.indexOf("deactivate= 0) - assertTrue(req.indexOf("DeleteTunnelXConnInstance= 0) - assertTrue(req.indexOf("") >= 0) - } - - @Test -// @Ignore - public void preProcessSDNCDeactivate_BpmnError() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception")) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex) })) - } - - @Test -// @Ignore - public void preProcessSDNCDeactivate_Ex() { - ExecutionEntity mex = setupMock() - initPreProcessSDNC(mex) - - when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex) })) - } - - - // ***** validateSDNCResp ***** - - @Test -// @Ignore - public void validateSDNCResp() { - ExecutionEntity mex = setupMock() - def data = initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp(200) - - when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create") - - verify(mex).getVariable("WorkflowException") - verify(mex).getVariable("SDNCA_SuccessIndicator") - verify(mex).getVariable(Prefix+"sdncResponseSuccess") - - verify(mex, never()).getVariable(Prefix + "sdncRequestDataResponseCode") - verify(mex, never()).setVariable("wasDeleted", false) - } - - @Test -// @Ignore - public void validateSDNCResp_Fail404_Deactivate_FailNotFound() { - ExecutionEntity mex = setupMock() - def data = initValidateSDNCResp(mex) - - def resp = initValidateSDNCResp_Resp(404) - when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404") - when(mex.getVariable("failNotFound")).thenReturn("true") - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate")})) - } - - @Test -// @Ignore - public void validateSDNCResp_Fail404_Deactivate() { - ExecutionEntity mex = setupMock() - def data = initValidateSDNCResp(mex) - - def resp = initValidateSDNCResp_Resp(404) - when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404") - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate") - - verify(mex).setVariable("ARNotFoundInSDNC", true) - verify(mex).setVariable("wasDeleted", false) - } - - @Test -// @Ignore - public void validateSDNCResp_Fail404() { - ExecutionEntity mex = setupMock() - def data = initValidateSDNCResp(mex) - - def resp = initValidateSDNCResp_Resp(404) - when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404") - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create")})) - } - - @Test -// @Ignore - public void validateSDNCResp_Deactivate() { - ExecutionEntity mex = setupMock() - def data = initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp(200) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate")})) - } - - @Test -// @Ignore - public void validateSDNCResp_BpmnError() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp(200) - - when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create") })) - } - - @Test -// @Ignore - public void validateSDNCResp_Ex() { - ExecutionEntity mex = setupMock() - initValidateSDNCResp(mex) - def resp = initValidateSDNCResp_Resp(200) - - when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create") })) - } - - @Test -// @Ignore - public void deleteAaiAR() { - ExecutionEntity mex = setupMock() - initDeleteAaiAR(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - DoDeleteAllottedResourceTXC.deleteAaiAR(mex) - } - - @Test -// @Ignore - public void deleteAaiAR_NoArPath() { - ExecutionEntity mex = setupMock() - initDeleteAaiAR(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) - - when(mex.getVariable("aaiARPath")).thenReturn("") - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) })) - } - - @Test -// @Ignore - public void deleteAaiAR_BpmnError() { - ExecutionEntity mex = setupMock() - initDeleteAaiAR(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) - - when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception")) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) })) - } - - @Test -// @Ignore - public void deleteAaiAR_Ex() { - ExecutionEntity mex = setupMock() - initDeleteAaiAR(mex) - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) - - when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception")) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) })) - } - - private boolean checkMissingPreProcessRequest(String fieldnm) { - ExecutionEntity mex = setupMock() - initPreProcess(mex) - - DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() - - when(mex.getVariable(fieldnm)).thenReturn("") - - return doBpmnError( { _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) }) - } - - private void initPreProcess(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("sdncurn") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("allottedResourceId")).thenReturn("ari") - } - - private void initGetAaiAR(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("allottedResourceType")).thenReturn("TXC") - when(mex.getVariable("allottedResourceRole")).thenReturn("TXC") - when(mex.getVariable("allottedResourceId")).thenReturn(ARID) - when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoDeleteAllottedResourceTXC/getAR.xml")) - when(mex.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn(urnProps.get("mso.workflow.global.default.aai.namespace")) - when(mex.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn(urnProps.get("mso.workflow.global.default.aai.version")) - when(mex.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn(urnProps.get("mso.workflow.default.aai.v8.nodes-query.uri")) - when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) - when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) - when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active") - } - - private initUpdateAaiAROrchStatus(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) - } - - private initBuildSDNCRequest(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("allottedResourceId")).thenReturn("ari") - when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") - when(mex.getVariable("subscriptionServiceType")).thenReturn("sst") - when(mex.getVariable("globalCustomerId")).thenReturn("gci") - when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu") - when(mex.getVariable("msoRequestId")).thenReturn("mri") - } - - private initPreProcessSDNC(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - } - - private initValidateSDNCResp(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("prefix")).thenReturn(Prefix) - when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) - } - - private String initValidateSDNCResp_Resp(int code) { - return "<response-code>${code}</response-code>" - } - - private initDeleteAaiAR(ExecutionEntity mex) { - when(mex.getVariable(DBGFLAG)).thenReturn("true") - when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) - when(mex.getVariable("aaiARResourceVersion")).thenReturn("myvers") - when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/GroovyTestBase.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/GroovyTestBase.groovy deleted file mode 100644 index ef67a75d10..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/GroovyTestBase.groovy +++ /dev/null @@ -1,127 +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.bpmn.vcpe.scripts - - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Before -import org.junit.BeforeClass -import org.junit.Rule -import org.junit.Test -import org.junit.Ignore -import org.mockito.MockitoAnnotations -import org.camunda.bpm.engine.delegate.BpmnError -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.mock.FileUtil - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse -import static com.github.tomakehurst.wiremock.client.WireMock.get -import static com.github.tomakehurst.wiremock.client.WireMock.patch -import static com.github.tomakehurst.wiremock.client.WireMock.put -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching -import static org.junit.Assert.*; -import static org.mockito.Mockito.* -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter - -import com.github.tomakehurst.wiremock.junit.WireMockRule - -class GroovyTestBase { - - static final int PORT = 28090 - static final String LOCAL_URI = "http://localhost:" + PORT - - static final String CUST = "SDN-ETHERNET-INTERNET" - static final String SVC = "123456789" - static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET" - static final String ARID = "arId-1" - static final String VERS = "myvers" - - static final String DBGFLAG = "isDebugLogEnabled" - - static Properties urnProps = new Properties() - static String aaiUriPfx - - String processName - - static { - def fr = new FileReader("src/test/resources/mso.bpmn.urn.properties") - urnProps.load(fr) - fr.close() - - aaiUriPfx = urnProps.get("aai.endpoint") - } - - public static void setUpBeforeClass() { - // moved to the above static block to get the static aaiUriPfx assignment correctly. - } - - public GroovyTestBase(String processName) { - this.processName = processName - } - - public boolean doBpmnError(def func) { - - try { - func() - return false; - - } catch(BpmnError e) { - return true; - } - } - - public ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn(processName) - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(processName) - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mex = mock(ExecutionEntity.class) - - when(mex.getId()).thenReturn("100") - when(mex.getProcessDefinitionId()).thenReturn(processName) - when(mex.getProcessInstanceId()).thenReturn(processName) - when(mex.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mex.getProcessEngineServices().getRepositoryService().getProcessDefinition(mex.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - - when(mex.getVariable("isAsyncProcess")).thenReturn("true") - when(mex.getVariable(processName+"WorkflowResponseSent")).thenReturn("false") - - return mex - } - - public Map setupMap(ExecutionEntity mex) { - MapSetter mapset = new MapSetter(); - doAnswer(mapset).when(mex).setVariable(any(), any()) - return mapset.getMap(); - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapGetter.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapGetter.groovy deleted file mode 100644 index 062cc0697e..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapGetter.groovy +++ /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.bpmn.vcpe.scripts; - -import java.util.HashMap; -import java.util.Map; - -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -class MapGetter implements Answer { - final Map map; - - public MapGetter() { - map = new HashMap<>(); - } - - public MapGetter(Map map) { - this.map = map; - } - - public Map getMap() { - return map; - } - - @Override - public Object answer(InvocationOnMock invocation) throws Throwable { - return map.get(invocation.getArgumentAt(0, String.class)); - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapSetter.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapSetter.groovy deleted file mode 100644 index e3395323d7..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapSetter.groovy +++ /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.bpmn.vcpe.scripts; - -import java.util.HashMap; -import java.util.Map; - -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -class MapSetter implements Answer { - final Map map; - - public MapSetter() { - map = new HashMap<>(); - } - - public MapSetter(Map map) { - this.map = map; - } - - public Map getMap() { - return map; - } - - @Override - public Void answer(InvocationOnMock invocation) throws Throwable { - map.put(invocation.getArgumentAt(0, String.class), invocation.getArgumentAt(1, Object.class)); - return null; - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntityTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntityTest.java deleted file mode 100644 index 4f643e1119..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntityTest.java +++ /dev/null @@ -1,35 +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.bpmn.infrastructure.AAITasks; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; -import org.junit.Test; - -public class AAICreateOwningEntityTest { - - DelegateExecution delegateExecution = new ExecutionImpl(); - - @Test(expected = UnsupportedOperationException.class) - public void executeTest() throws Exception { - new AAICreateServiceInstance().execute(delegateExecution); - } - -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/BeansTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/BeansTest.java deleted file mode 100644 index 723639c505..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/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.bpmn.infrastructure; - -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; - - -public class BeansTest { - - - private PojoClassFilter filterTestClasses = new FilterTestClasses(); - - private PojoClassFilter enumFilter = new FilterEnum(); - - - @Test - public void pojoStructure() { - test("org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity"); - } - - private void test(String pojoPackage) { - Validator validator = ValidatorBuilder.create() - .with(new GetterMustExistRule()) - .with(new SetterMustExistRule()) - - .with(new SetterTester()) - .with(new GetterTester()) - .with(new SetterTester()) - .with(new GetterTester()) - - .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/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java deleted file mode 100644 index a1a9e35865..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.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.bpmn.infrastructure; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetCustomer; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit test cases for CreateGenericALaCarteServiceInstance.bpmn - */ -public class CreateGenericALaCarteServiceInstanceTest extends WorkflowTest { - - private final CallbackSet callbacks = new CallbackSet(); - - public CreateGenericALaCarteServiceInstanceTest() throws IOException { - callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCSITopologyAssignCallback.xml")); - } - - /** - * Sunny day VID scenario. - * - * @throws Exception - */ - //@Ignore // File not found - unable to run the test. Also, Stubs need updating.. - @Test - @Ignore // 1802 merge - @Deployment(resources = { - "process/CreateGenericALaCarteServiceInstance.bpmn", - "subprocess/BuildingBlock/DecomposeService.bpmn", - "subprocess/DoCreateServiceInstance.bpmn", - "subprocess/DoCreateServiceInstanceRollback.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericPutService.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/FalloutHandler.bpmn" }) - public void sunnyDayAlaCarte() throws Exception { - - logStart(); - - //AAI - MockGetCustomer("MCBH-1610", "CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml"); - MockPutServiceInstance("MCBH-1610", "viprsvc", "RaaTest-1-id", ""); - MockGetServiceInstance("MCBH-1610", "viprsvc", "RaaTest-1-id", "GenericFlows/getServiceInstance.xml"); - MockNodeQueryServiceInstanceByName("RAATest-1", null); - MockNodeQueryServiceInstanceById("RaaTest-1-id", null); - //SDNC - mockSDNCAdapter(200); - //DB - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef","2","/VIPR/getCatalogServiceResourcesData.json"); - mockUpdateRequestDB(200, "DBUpdateResponse.xml"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef","InfrastructureFlows/DoCreateServiceInstance_request.json"); - - - String businessKey = UUID.randomUUID().toString(); - - //String createVfModuleRequest = FileUtil.readResourceFile("__files/SIRequest.json"); - - Map variables = setupVariables(); - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateGenericALaCarteServiceInstance", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "WorkflowResponse"); - //assertNotNull(workflowResp); - System.out.println("Workflow (Synch) Response:\n" + workflowResp); - String workflowException = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "WorkflowException"); - String completionReq = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "completionRequest"); - System.out.println("completionReq:\n" + completionReq); - System.out.println("workflowException:\n" + workflowException); - assertNotNull(completionReq); - assertEquals(null, workflowException); - - - //injectSDNCCallbacks(callbacks, "assign"); - - logEnd(); - } - - // Success Scenario - private Map setupVariables() { - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled", "true"); - variables.put("bpmnRequest", getRequest()); - variables.put("mso-request-id", "RaaCSIRequestId-1"); - variables.put("serviceInstanceId","RaaTest-1-id"); - variables.put("sdncVersion", "1802"); - variables.put("serviceInstanceName", "some-junk-name"); - return variables; - } - - public String getRequest() { - String request = "{\"requestDetails\":{\"project\": {\"projectName\": \"projectName\"},\"owningEntity\": {\"owningEntityId\": \"randomStrings\",\"owningEntityName\": \"randomStrings\"},\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelVersionUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"},\"subscriberInfo\":{\"globalSubscriberId\":\"MCBH-1610\",\"subscriberName\":\"Kaneohe\"},\"requestInfo\":{\"instanceName\":\"RAATest-1\",\"source\":\"VID\",\"suppressRollback\":\"true\",\"productFamilyId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"mdt1\",\"tenantId\":\"8b1df54faa3b49078e3416e21370a3ba\"},\"requestParameters\":{\"subscriptionServiceType\":\"viprsvc\",\"aLaCarte\":\"false\",\"userParams\":[]}}}"; - return request; - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java deleted file mode 100644 index f993d066e4..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java +++ /dev/null @@ -1,665 +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.bpmn.infrastructure; - -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.*; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseNetworkAdapter.MockNetworkAdapterPost; -import static org.openecomp.mso.bpmn.mock.StubResponseNetworkAdapter.MockNetworkAdapterRestRollbackDelete; -// new mock methods -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapterTopology; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter_500; -import org.openecomp.mso.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer; - -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeAsyncWorkflow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.getVariable; -import static org.junit.Assert.assertEquals; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Rule; -import org.junit.Test; - -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.WorkflowTestTransformer; -import org.openecomp.mso.bpmn.common.SDNCAdapterCallbackRule; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; - -/** - * Unit test cases for CreateNetworkInstance.bpmn - * - */ -public class CreateNetworkInstanceTest extends WorkflowTest { - @WorkflowTestTransformer - public static final ResponseTransformer sdncAdapterMockTransformer = - new SDNCAdapterNetworkTopologyMockTransformer(); - - @Rule - public final SDNCAdapterCallbackRule sdncAdapterCallbackRule = - new SDNCAdapterCallbackRule(processEngineRule); - - /** - * End-to-End flow - Unit test for CreateNetworkInstance.bpmn - * - String input & String response - */ - - - @Test - //@Ignore - @Deployment(resources = {"process/CreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstanceRollback.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceCreateNetworkInstance_vIPER_Success1() throws Exception { - - System.out.println("-----------------------------------------------------------------"); - System.out.println(" Success vIPER 1 - CreateNetworkInstance flow Started! "); - System.out.println("-----------------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign"); - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate"); - MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest"); - MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); - - Map variables = setupVariables1(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - System.out.println("----------------------------------------------------------"); - System.out.println("- got workflow response -"); - System.out.println("----------------------------------------------------------"); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); - assertEquals("true", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); - Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest")); - - String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateNetworkInstance", "WorkflowResponse"); - Assert.assertNotNull(workflowResp); - - System.out.println("----------------------------------------------------------"); - System.out.println(" Success vIPER 1 - CreateNetworkInstance flow Completed "); - System.out.println("----------------------------------------------------------"); - - } - - @Test - //@Ignore - @Deployment(resources = {"process/CreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstanceRollback.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceCreateNetworkInstance_vIPER_Success2() throws Exception { - - System.out.println("----------------------------------------------------------------"); - System.out.println(" Success viPER 2 - CreateNetworkInstance flow Started! "); - System.out.println("----------------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign"); - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate"); - MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest"); - MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); - - Map variables = setupVariables2(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); - assertEquals("true", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); - Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest")); - - String completeMsoProcessRequest = - "" + '\n' - + " " + '\n' - + " testRequestId" + '\n' - + " CREATE" + '\n' - + " VID" + '\n' - + " " + '\n' - + " Network has been created successfully." + '\n' - + " BPMN Network action: CREATE" + '\n' - + ""; - - Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest")); - - System.out.println("---------------------------------------------------------"); - System.out.println(" Success viPER 2 - CreateNetworkInstance flow Completed "); - System.out.println("---------------------------------------------------------"); - - } - - @Test - //@Ignore - @Deployment(resources = {"process/CreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstanceRollback.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceCreateNetworkInstance_VID_1610_Network_SDNC_Rollback() throws Exception { - - System.out.println("--------------------------------------------------------------------------"); - System.out.println(" Network and SDNC Rollback - CreateNetworkInstance flow Started! "); - System.out.println("--------------------------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>assign"); - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>rollback"); - MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest"); - MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); - MockNetworkAdapterRestRollbackDelete("deleteNetworkResponse_Success.xml","49c86598-f766-46f8-84f8-8d1c1b10f9b4"); - - Map variables = setupVariablesVID1(); - executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); - assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); - Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest")); - - System.out.println("--------------------------------------------------------------------"); - System.out.println(" Network and SCNC Rollback - CreateNetworkInstance flow Completed "); - System.out.println("--------------------------------------------------------------------"); - - } - - @Test - //@Ignore - @Deployment(resources = {"process/CreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstanceRollback.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceCreateNetworkInstance_vIPER_1702_Network_SDNC_Rollback() throws Exception { - - System.out.println("--------------------------------------------------------------------------"); - System.out.println(" Network and SDNC Rollback - CreateNetworkInstance flow Started! "); - System.out.println("--------------------------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign"); - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>unassign"); - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate"); - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>deactivate"); - MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest"); - MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); - MockNetworkAdapterRestRollbackDelete("deleteNetworkResponse_Success.xml","49c86598-f766-46f8-84f8-8d1c1b10f9b4"); - - Map variables = setupVariables1(); - executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); - assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); - Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest")); - - System.out.println("--------------------------------------------------------------------"); - System.out.println(" Network and SCNC Rollback - CreateNetworkInstance flow Completed "); - System.out.println("--------------------------------------------------------------------"); - - } - - @Test - //@Ignore - @Deployment(resources = {"process/CreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstanceRollback.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceCreateNetworkInstance_sdncFailure() throws Exception { - - System.out.println("----------------------------------------------------------------"); - System.out.println(" SNDC Failure - CreateNetworkInstance flow Started! "); - System.out.println("----------------------------------------------------------------"); - - // setup simulators - mockSDNCAdapter_500("SvcAction>query"); - MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); - - Map variables = setupVariables2(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); - assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); - Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest")); - - System.out.println("---------------------------------------------------------"); - System.out.println(" SNDC Failure - CreateNetworkInstance flow Completed "); - System.out.println("---------------------------------------------------------"); - - } - - @Test - //@Ignore - @Deployment(resources = {"process/CreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstanceRollback.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceCreateNetworkInstance_queryServiceInstance404() throws Exception { - - System.out.println("----------------------------------------------------------------------------------"); - System.out.println(" Query ServiceIntance Not found - CreateNetworkInstance flow Started! "); - System.out.println("----------------------------------------------------------------------------------"); - - //setup simulators - mockSDNCAdapter_500("SvcAction>query"); - MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - MockNodeQueryServiceInstanceById_404("f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - - Map variables = setupVariables2(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); - assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); - Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest")); - - System.out.println("---------------------------------------------------------------------------------"); - System.out.println(" Query ServiceIntance Not found - CreateNetworkInstance flow Completed "); - System.out.println("---------------------------------------------------------------------------------"); - - } - - @Test - //@Ignore - @Deployment(resources = {"process/CreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstanceRollback.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceCreateNetworkInstance_VID_Success1() throws Exception { - - System.out.println("----------------------------------------------------------"); - System.out.println(" Success VID1 - CreateNetworkInstance flow Started! "); - System.out.println("----------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>assign"); - MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest"); - MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); - - Map variables = setupVariablesVID1(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - System.out.println("----------------------------------------------------------"); - System.out.println("- got workflow response -"); - System.out.println("----------------------------------------------------------"); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); - Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest")); - - String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateNetworkInstance", "WorkflowResponse"); - Assert.assertNotNull(workflowResp); - - System.out.println("-----------------------------------------------------------"); - System.out.println(" Success VID1 - CreateNetworkInstanceInfra flow Completed "); - System.out.println("-----------------------------------------------------------"); - - } - - // ***************** - // Utility Section - // ***************** - - String networkModelInfo = - " {\"modelUuid\": \"mod-inst-uuid-123\", " + '\n' + - " \"modelName\": \"mod_inst_z_123\", " + '\n' + - " \"modelVersion\": \"mod-inst-uuid-123\", " + '\n' + - " \"modelCustomizationUuid\": \"z_network_123\", " + '\n' + - " \"modelInvariantUuid\": \"mod-invar-uuid-123\" " + '\n' + - " }"; - - String serviceModelInfo = - " {\"modelUuid\": \"36a3a8ea-49a6-4ac8-b06c-89a54544b9b6\", " + '\n' + - " \"modelName\": \"HNGW Protected OAM\", " + '\n' + - " \"modelVersion\": \"1.0\", " + '\n' + - " \"modelInvariantUuid\": \"fcc85cb0-ad74-45d7-a5a1-17c8744fdb71\" " + '\n' + - " }"; - - // Success Scenario - private Map setupVariables1() { - Map variables = new HashMap<>(); - variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); - variables.put("msoRequestId", "testRequestId"); - variables.put("requestId", "testRequestId"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("networkId", "networkId"); - variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_1"); - variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); - variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("disableRollback", "false"); // macro - variables.put("failIfExists", "false"); - variables.put("sdncVersion", "1702"); - variables.put("subscriptionServiceType", "MSO-dev-service-type"); - variables.put("globalSubscriberId", "globalId_45678905678"); - variables.put("networkModelInfo", networkModelInfo); - variables.put("serviceModelInfo", serviceModelInfo); - - - return variables; - - } - - // Success Scenario 2 - private Map setupVariables2() { - Map variables = new HashMap<>(); - variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("networkId", "networkId"); - variables.put("networkName", "myOwn_Network"); // Name Not found in AA&I - variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); - variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("disableRollback", "false"); // 1702 - variables.put("failIfExists", "false"); - //variables.put("sdncVersion", "1702"); - variables.put("sdncVersion", "1707"); - variables.put("subscriptionServiceType", "MSO-dev-service-type"); - variables.put("globalSubscriberId", "globalId_45678905678"); - variables.put("networkModelInfo", networkModelInfo); - variables.put("serviceModelInfo", serviceModelInfo); - - return variables; - - } - - // Active Scenario - private Map setupVariablesActive() { - Map variables = new HashMap<>(); - variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("networkId", "networkId"); - variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_2"); // Unique name for Active - variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); - variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("suppressRollback", "false"); - variables.put("disableRollback", "false"); - variables.put("failIfExists", "false"); - variables.put("sdncVersion", "1702"); - variables.put("subscriptionServiceType", "MSO-dev-service-type"); - variables.put("globalSubscriberId", "globalId_45678905678"); - variables.put("networkModelInfo", networkModelInfo); - variables.put("serviceModelInfo", serviceModelInfo); - - return variables; - - } - - // Missing Name Scenario - private Map setupVariablesMissingName() { - Map variables = new HashMap<>(); - //variables.put("bpmnRequest", getCreateNetworkRequestMissingName()); - variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("networkId", "networkId"); - // variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_2"); // Missing 'name' variable - // variables.put("networkName", ""); // Missing 'value' of name variable - variables.put("modelName", "CONTRAIL_EXTERNAL"); - variables.put("cloudConfiguration", "RDM2WAGPLCP"); - variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("suppressRollback", "true"); - variables.put("failIfExists", "false"); - - return variables; - - } - - // SDNC Rollback Scenario - private Map setupVariablesSDNCRollback() { - Map variables = new HashMap<>(); - variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("networkId", "networkId"); - variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_3"); // Unique name for Rollback - variables.put("modelName", "CONTRAIL_EXTERNAL"); - variables.put("cloudConfiguration", "RDM2WAGPLCP"); - variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("suppressRollback", "true"); - variables.put("disableRollback", "false"); - - return variables; - - } - - // old - public String getCreateNetworkRequestActive() { - - String request = - "{ \"requestDetails\": { " + '\n' + - " \"modelInfo\": { " + '\n' + - " \"modelType\": \"modelType\", " + '\n' + - " \"modelId\": \"modelId\", " + '\n' + - " \"modelCustomizationUuid\": \"modelCustUuid\", " + '\n' + - " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + - " \"modelVersion\": \"1\" " + '\n' + - " }, " + '\n' + - " \"cloudConfiguration\": { " + '\n' + - " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + - " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + - " }, " + '\n' + - " \"requestInfo\": { " + '\n' + - " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_2\", " + '\n' + - " \"source\": \"VID\", " + '\n' + - " \"callbackUrl\": \"\", " + '\n' + - " \"suppressRollback\": \"false\" ," + '\n' + - " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + - " }, " + '\n' + - " \"requestParameters\": { " + '\n' + - " \"userParams\": [] " + '\n' + - " } " + '\n' + - " } " + '\n' + - "}"; - - return request; - - } - - public String getCreateNetworkRequestSDNCRollback() { - - String request = - "{ \"requestDetails\": { " + '\n' + - " \"modelInfo\": { " + '\n' + - " \"modelType\": \"modelType\", " + '\n' + - " \"modelId\": \"modelId\", " + '\n' + - " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' + - " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + - " \"modelVersion\": \"1\" " + '\n' + - " }, " + '\n' + - " \"cloudConfiguration\": { " + '\n' + - " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + - " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + - " }, " + '\n' + - " \"requestInfo\": { " + '\n' + - " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_3\", " + '\n' + - " \"source\": \"VID\", " + '\n' + - " \"callbackUrl\": \"\", " + '\n' + - " \"suppressRollback\": \"true\" ," + '\n' + - " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + - " }, " + '\n' + - " \"requestParameters\": { " + '\n' + - " \"userParams\": [] " + '\n' + - " } " + '\n' + - " } " + '\n' + - "}"; - - - return request; - } - - - // VID json input - private Map setupVariablesVID1() { - Map variables = new HashMap<>(); - variables.put("bpmnRequest", getCreateNetworkRequestVID1()); - variables.put("mso-request-id", "testRequestId"); - //variables.put("msoRequestId", "testRequestId"); - variables.put("requestId", "testRequestId"); - variables.put("isBaseVfModule", "true"); - variables.put("recipeTimeout", "0"); - variables.put("requestAction", "CREATE"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", ""); - variables.put("vfModuleId", ""); - variables.put("volumeGroupId", ""); - //variables.put("networkId", "networkId"); - variables.put("serviceType", "vMOG"); - variables.put("vfModuleType", ""); - variables.put("networkType", "modelName"); - - return variables; - - } - - public String getCreateNetworkRequestVID1() { - - String request = - "{ \"requestDetails\": { " + '\n' + - " \"modelInfo\": { " + '\n' + - " \"modelType\": \"modelType\", " + '\n' + - " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' + - " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + - " \"modelVersion\": \"1.0\" " + '\n' + - " }, " + '\n' + - " \"cloudConfiguration\": { " + '\n' + - " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + - " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + - " }, " + '\n' + - " \"requestInfo\": { " + '\n' + - " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_1\", " + '\n' + - " \"source\": \"VID\", " + '\n' + - " \"callbackUrl\": \"\", " + '\n' + - " \"suppressRollback\": \"false\" ," + '\n' + - " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + - " }, " + '\n' + - " \"requestParameters\": { " + '\n' + - " \"backoutOnFailure\": false, " + '\n' + - " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' + - " \"userParams\": [] " + '\n' + - " } " + '\n' + - " } " + '\n' + - "}"; - - return request; - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java deleted file mode 100644 index 1e865dfd14..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java +++ /dev/null @@ -1,367 +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.bpmn.infrastructure; - -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfsByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSDNCAdapterVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAPPC.MockAppcError; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import org.junit.Ignore; -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit test cases for CreateVfModuleInfra.bpmn - */ -@Ignore -public class CreateVfModuleInfraTest extends WorkflowTest { - - private final CallbackSet callbacks = new CallbackSet(); - - public CreateVfModuleInfraTest() throws IOException { - callbacks.put("assign", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyAssignCallback.xml")); - callbacks.put("query", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml")); - callbacks.put("activate", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("vnfCreate", FileUtil.readResourceFile( - "__files/VfModularity/VNFAdapterRestCreateCallback.xml")); - } - - - /** - * Sunny day VID scenario with preloads. - * - * @throws Exception - */ - @Test - @Deployment(resources = { - "process/CreateVfModuleInfra.bpmn", - "subprocess/BuildingBlock/AppCClient.bpmn", - "subprocess/DoCreateVfModule.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericNotificationService.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/ConfirmVolumeGroupName.bpmn", - "subprocess/CreateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/BuildingBlock/AppCClient.bpmn" - }) - public void sunnyDayVIDWithPreloads() throws Exception { - - logStart(); - - MockAAIVfModule(); - MockGetGenericVnfsByVnfId("skask","__files/AAI/AAI_genericVnfGet.json",200); - MockPatchGenericVnf("skask"); - MockPatchVfModuleId("skask", ".*"); - MockSDNCAdapterVfModule(); - MockVNFAdapterRestVfModule(); - MockDBUpdateVfModule(); - MockAppcError(); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleRequest = - FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"); - - Map variables = setupVariablesSunnyDayVID(); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra", - "v1", businessKey, createVfModuleRequest, variables); - - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - injectSDNCCallbacks(callbacks, "assign, query"); - injectVNFRestCallbacks(callbacks, "vnfCreate"); - injectSDNCCallbacks(callbacks, "activate"); - - // TODO add appropriate assertions - - waitForProcessEnd(businessKey, 10000); - checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true); - - logEnd(); - } - - /** - * Sunny day VID scenario with no preloads. - * - * @throws Exception - */ - @Test - @Deployment(resources = { - "process/CreateVfModuleInfra.bpmn", - "subprocess/BuildingBlock/AppCClient.bpmn", - "subprocess/DoCreateVfModule.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/GenericNotificationService.bpmn", - "subprocess/ConfirmVolumeGroupName.bpmn", - "subprocess/CreateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/BuildingBlock/AppCClient.bpmn" - }) - public void sunnyDayVIDNoPreloads() throws Exception { - - logStart(); - - MockAAIVfModule(); - MockGetGenericVnfsByVnfId("skask","__files/AAI/AAI_genericVnfGet.json",200); - MockPatchGenericVnf("skask"); - MockPatchVfModuleId("skask", ".*"); - MockSDNCAdapterVfModule(); - MockVNFAdapterRestVfModule(); - MockDBUpdateVfModule(); - MockAppcError(); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleRequest = - FileUtil.readResourceFile("__files/CreateVfModule_VID_request_noPreloads.json"); - - Map variables = setupVariablesSunnyDayVID(); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra", - "v1", businessKey, createVfModuleRequest, variables); - - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - injectSDNCCallbacks(callbacks, "assign, query"); - injectVNFRestCallbacks(callbacks, "vnfCreate"); - injectSDNCCallbacks(callbacks, "activate"); - - // TODO add appropriate assertions - - waitForProcessEnd(businessKey, 10000); - checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true); - - logEnd(); - } - - // Active Scenario - private Map setupVariablesSunnyDayVID() { - Map variables = new HashMap<>(); - //try { - //variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json")); - //} - //catch (Exception e) { - - //} - //variables.put("mso-request-id", "testRequestId"); - variables.put("requestId", "testRequestId"); - variables.put("isBaseVfModule", false); - variables.put("isDebugLogEnabled", "true"); - variables.put("recipeTimeout", "0"); - variables.put("requestAction", "CREATE_VF_MODULE"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", "skask"); - variables.put("vnfType", "vSAMP12"); - variables.put("vfModuleId", ""); - variables.put("volumeGroupId", ""); - variables.put("serviceType", "MOG"); - variables.put("vfModuleType", ""); - return variables; - - } - - /** - * Sunny day VID with volume attach scenario. - * - * @throws Exception - */ - @Test - @Ignore - @Deployment(resources = { - "process/CreateVfModuleInfra.bpmn", - "subprocess/BuildingBlock/AppCClient.bpmn", - "subprocess/DoCreateVfModule.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/ConfirmVolumeGroupName.bpmn", - "subprocess/CreateAAIVfModule.bpmn", - "subprocess/CreateAAIVfModuleVolumeGroup.bpmn", - "subprocess/GenericNotificationService.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/BuildingBlock/AppCClient.bpmn" - }) - - public void sunnyDayVIDWithVolumeGroupAttach() throws Exception { - - logStart(); - - - MockAAIVfModule(); - MockGetGenericVnfsByVnfId("skask","__files/AAI/AAI_genericVnfGet.json",200); - MockPatchGenericVnf("skask"); - MockPatchVfModuleId("skask", ".*"); - MockSDNCAdapterVfModule(); - MockVNFAdapterRestVfModule(); - MockDBUpdateVfModule(); - MockAppcError(); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleRequest = - FileUtil.readResourceFile("__files/CreateVfModuleVolumeGroup_VID_request.json"); - - Map variables = setupVariablesSunnyDayVIDWVolumeAttach(); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra", - "v1", businessKey, createVfModuleRequest, variables); - - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - injectSDNCCallbacks(callbacks, "assign, query"); - injectVNFRestCallbacks(callbacks, "vnfCreate"); - injectSDNCCallbacks(callbacks, "activate"); - - // TODO add appropriate assertions - - waitForProcessEnd(businessKey, 10000); - checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true); - - logEnd(); - } - - // Active Scenario - private Map setupVariablesSunnyDayVIDWVolumeAttach() { - Map variables = new HashMap<>(); - //try { - // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json")); - //} - //catch (Exception e) { - - //} - //variables.put("mso-request-id", "testRequestId"); - variables.put("requestId", "testRequestId"); - variables.put("isBaseVfModule", false); - variables.put("isDebugLogEnabled", "true"); - variables.put("recipeTimeout", "0"); - variables.put("requestAction", "CREATE_VF_MODULE"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", "skask"); - variables.put("vnfType", "vSAMP12"); - variables.put("vfModuleId", ""); - variables.put("volumeGroupId", "78987"); - variables.put("serviceType", "MOG"); - variables.put("vfModuleType", ""); - return variables; - - } - /** - * Sunny day VID scenario with no preloads. - * - * @throws Exception - */ - @Test - @Deployment(resources = { - "process/CreateVfModuleInfra.bpmn", - "subprocess/BuildingBlock/AppCClient.bpmn", - "subprocess/DoCreateVfModule.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/GenericNotificationService.bpmn", - "subprocess/ConfirmVolumeGroupName.bpmn", - "subprocess/CreateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/BuildingBlock/AppCClient.bpmn" - }) - public void sunnyDayVIDMultipleUserParamValues() throws Exception { - - logStart(); - - MockAAIVfModule(); - MockGetGenericVnfsByVnfId("skask","__files/AAI/AAI_genericVnfGet.json",200); - MockPatchGenericVnf("skask"); - MockPatchVfModuleId("skask", ".*"); - MockSDNCAdapterVfModule(); - MockVNFAdapterRestVfModule(); - MockDBUpdateVfModule(); - MockAppcError(); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleRequest = - FileUtil.readResourceFile("__files/CreateVfModule_VID_request_userParam.json"); - - Map variables = setupVariablesSunnyDayVID(); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra", - "v1", businessKey, createVfModuleRequest, variables); - - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - injectSDNCCallbacks(callbacks, "assign, query"); - injectVNFRestCallbacks(callbacks, "vnfCreate"); - injectSDNCCallbacks(callbacks, "activate"); - - // TODO add appropriate assertions - - waitForProcessEnd(businessKey, 10000); - checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true); - - logEnd(); - } - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java deleted file mode 100644 index 2e5a7a418a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java +++ /dev/null @@ -1,368 +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.bpmn.infrastructure; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteVolumeGroupById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupByName; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVolumeGroupById; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockPostVNFVolumeGroup; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockPutVNFVolumeGroupRollback; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.mock.FileUtil; -import org.openecomp.mso.bpmn.mock.StubResponseAAI; - -public class CreateVfModuleVolumeInfraV1Test extends WorkflowTest { - - public static final String _prefix = "CVFMODVOL2_"; - - private final CallbackSet callbacks = new CallbackSet(); - - public CreateVfModuleVolumeInfraV1Test() throws IOException { - callbacks.put("volumeGroupCreate", FileUtil.readResourceFile( - "__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml")); - callbacks.put("volumeGroupDelete", FileUtil.readResourceFile( - "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml")); - callbacks.put("volumeGroupException", FileUtil.readResourceFile( - "__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml")); - callbacks.put("volumeGroupRollback", FileUtil.readResourceFile( - "__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml")); - } - - /** - * Happy path scenario for VID - *****************************/ - @Test - //@Ignore - @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/DoCreateVfModuleVolumeV2.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestSuccess() throws Exception { - - logStart(); - - MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); - MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200); - MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201); - MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200); - MockPutVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml", 200); - mockPostVNFVolumeGroup(202); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); - - Map testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("serviceInstanceId", "test-service-instance-id"); - testVariables.put("vnfId", "TEST-VNF-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", true); - - logEnd(); - } - - /** - * Fail - trigger rollback - *****************************/ - @Test - //@Ignore - @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/DoCreateVfModuleVolumeV2.bpmn", - "subprocess/DoCreateVfModuleVolumeRollback.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestRollback() throws Exception { - - logStart(); - - MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); - MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200); - MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201); - mockPostVNFVolumeGroup(202); - mockPutVNFVolumeGroupRollback("TEST-VOLUME-GROUP-ID-0123", 202); - MockDeleteVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360", 202); - StubResponseAAI.MockGetVolumeGroupByName_404("AAIAIC25", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - StubResponseAAI.MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200); - StubResponseAAI.MockDeleteVolumeGroup("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360"); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); - - Map testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("serviceInstanceId", "test-service-instance-id"); - testVariables.put("vnfId", "TEST-VNF-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); - injectVNFRestCallbacks(callbacks, "volumeGroupDelete"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); - - logEnd(); - } - - /** - * Happy path scenario for VID - *****************************/ - @Test - @Ignore - @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/DoCreateVfModuleVolumeV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestVolumeGroupAlreadyExists() throws Exception { - - logStart(); - - MockGetVolumeGroupByName("AAIAIC25", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200); - MockGetGenericVnfById("TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200); - MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); - - Map testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("serviceInstanceId", "test-service-instance-id"); - testVariables.put("vnfId", "TEST-VNF-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - //injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); - - logEnd(); - } - - /** - *Vnf Create fail - *****************************/ - @Test - @Ignore - @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/DoCreateVfModuleVolumeV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestVNfCreateFail() throws Exception { - - logStart(); - - MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); - MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200); - MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201); - MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200); - MockPutVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml", 200); - mockPostVNFVolumeGroup(202); - MockDeleteVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360", 204); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); - - Map testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("serviceInstanceId", "test-service-instance-id"); - testVariables.put("vnfId", "TEST-VNF-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - injectVNFRestCallbacks(callbacks, "volumeGroupException"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); - - logEnd(); - } - - - /** - * Error scenario - vnf not found - ********************************/ - @Test - @Ignore - @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/DoCreateVfModuleVolumeV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestFailVnfNotFound() throws Exception { - - logStart(); - - MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json"); - - Map testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("serviceInstanceId", "test-service-instance-id"); - testVariables.put("vnfId", "TEST-VNF-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - //injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); - - logEnd(); - } - - /** - * Error scenario - error in validation - **************************************/ - @Test - @Ignore - @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/DoCreateVfModuleVolumeV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestFailNoVnfPassed() throws Exception { - - logStart(); - - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); - - Map testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("serviceInstanceId", "test-service-instance-id"); - //testVariables.put("vnfId", "TEST-VNF-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); - - logEnd(); - } - - /** - * Error scenario - service instance not found - *********************************************/ - @Test - @Ignore - @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/DoCreateVfModuleVolumeV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestFailServiceInstanceNotFound() throws Exception { - - logStart(); - - MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); - - Map testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("serviceInstanceId", "test-service-instance-id"); - //testVariables.put("vnfId", "TEST-VNF-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); - - logEnd(); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java deleted file mode 100644 index db43de7f14..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByName_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetVnfCatalogDataCustomizationUuid; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit Test for the CreateVnfInfra Flow - */ -public class CreateVnfInfraTest extends WorkflowTest { - - private String createVnfInfraRequest; - private final CallbackSet callbacks = new CallbackSet(); - - - public CreateVnfInfraTest() throws IOException { - createVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json"); - callbacks.put("assign", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyAssignCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - } - - @Test - @Deployment(resources = {"subprocess/DoCreateVnf.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/GenericPutVnf.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "process/CreateVnfInfra.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn"}) - public void testCreateVnfInfra_success() throws Exception{ - - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - MockGetGenericVnfByName_404(); - MockPutGenericVnf(); - MockGetVnfCatalogDataCustomizationUuid("customizationId123", "VIPR/getCatalogVnfData.json"); - mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVnfInfra", - "v1", businessKey, createVnfInfraRequest, variables); - - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - //injectSDNCCallbacks(callbacks, "assign, query"); - //injectSDNCCallbacks(callbacks, "activate"); - - // TODO add appropriate assertions - - waitForProcessEnd(businessKey, 10000); - String status = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "CreateVnfInfraStatus"); - assertEquals("Success", status); - - logEnd(); - - //WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables); - // injectSDNCCallbacks(callbacks, "assign"); - // injectSDNCCallbacks(callbacks, "activate"); - //waitForProcessEnd(businessKey, 10000); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - //assertVariables("true", "true", "false", "true", "Success", null); - - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "process/CreateVnfInfra.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn"}) - public void testCreateVnfInfra_error_badRequest() throws Exception{ - - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map variables = new HashMap<>(); - setVariables(variables, null, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables(null, null, null, null, null, "WorkflowException[processKey=CreateVnfInfra,errorCode=2500,errorMessage=Internal Error - WorkflowException Object and/or RequestInfo is null! CreateVnfInfra]"); - - } - - @Test - @Ignore - @Deployment(resources = {"subprocess/DoCreateVnf.bpmn", "subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "process/CreateVnfInfra.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn"}) - public void testCreateVnfInfra_error_siNotFound() throws Exception{ - - MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map variables = new HashMap<>(); - setVariables(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables(null, null, null, null, null, "WorkflowException[processKey=DoCreateVnf,errorCode=404,errorMessage=Service Instance Not Found]"); - - } - - @Test - @Ignore - @Deployment(resources = {"subprocess/DoCreateVnf.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/GenericPutVnf.bpmn", - "process/CreateVnfInfra.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn"}) - public void testCreateVnfInfra_error_vnfExist() throws Exception{ - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123&depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericFlows/getGenericVnfResponse.xml"))); - - MockPutGenericVnf(); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map variables = new HashMap<>(); - setVariables(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables(null, null, null, null, null, "WorkflowException[processKey=DoCreateVnf,errorCode=5000,errorMessage=Generic Vnf Already Exist.]"); - - } - - private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) { - - String siFound = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGS_FoundIndicator"); - String siSucc = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGS_SuccessIndicator"); - String vnfFound = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGV_FoundIndicator"); - String vnfSucc = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGV_SuccessIndicator"); - String response = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "SavedWorkflowException1"); - - assertEquals(exSIFound, siFound); - assertEquals(exSISucc, siSucc); - assertEquals(exVnfFound, vnfFound); - assertEquals(exVnfSucc, vnfSucc); - assertEquals(exResponse, response); - assertEquals(exWorkflowException, workflowException); - } - - private void setVariables(Map variables, String request, String requestId, String siId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("bpmnRequest", request); - variables.put("mso-request-id", requestId); - variables.put("serviceInstanceId",siId); - variables.put("testVnfId","testVnfId123"); - variables.put("vnfType", "STMTN"); - } - - private void setVariablesSuccess(Map variables, String request, String requestId, String siId) { - variables.put("isDebugLogEnabled", "true"); - //variables.put("bpmnRequest", request); - //variables.put("mso-request-id", requestId); - variables.put("serviceInstanceId",siId); - variables.put("requestId", requestId); - variables.put("testVnfId","testVnfId123"); - variables.put("vnfType", "STMTN"); - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java deleted file mode 100644 index 1a52041bd7..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java +++ /dev/null @@ -1,111 +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.bpmn.infrastructure; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; - -/** - * Unit test cases for DelServiceInstance.bpmn - */ -public class DeleteGenericALaCarteServiceInstanceTest extends WorkflowTest { - - public DeleteGenericALaCarteServiceInstanceTest() throws IOException { - } - - /** - * Sunny day VID scenario. - * - * @throws Exception - */ - @Ignore // IGNORED FOR 1710 MERGE TO ONAP - @Test - @Deployment(resources = { - "process/DeleteGenericALaCarteServiceInstance.bpmn", - "subprocess/DoDeleteServiceInstance.bpmn", - "subprocess/GenericDeleteService.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/FalloutHandler.bpmn" }) - public void sunnyDayAlaCarte() throws Exception { - - logStart(); - - //AAI - MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", ""); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml"); - MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); - //DB - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - - Map variables = setupVariables(); - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteGenericALaCarteServiceInstance", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "WorkflowResponse"); - //assertNotNull(workflowResp); - System.out.println("Workflow (Synch) Response:\n" + workflowResp); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "WorkflowException"); - String completionReq = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "completionRequest"); - System.out.println("completionReq:\n" + completionReq); - System.out.println("workflowException:\n" + workflowException); - assertNotNull(completionReq); - assertEquals(null, workflowException); - - logEnd(); - } - - // Success Scenario - private Map setupVariables() { - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled", "true"); - variables.put("bpmnRequest", getRequest()); - variables.put("mso-request-id", "RaaTestRequestId-1"); - variables.put("serviceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET"); - return variables; - } - - public String getRequest() { - String request = "{\"requestDetails\":{\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SDN-ETHERNET-INTERNET\",\"subscriberName\":\"\"},\"requestInfo\":{\"instanceName\":\"1604-MVM-26\",\"source\":\"VID\",\"suppressRollback\":\"true\",\"productFamilyId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"mdt1\",\"tenantId\":\"8b1df54faa3b49078e3416e21370a3ba\"},\"requestParameters\":{\"subscriptionServiceType\":\"123456789\",\"aLaCarte\":\"false\",\"userParams\":\"somep\"}}}"; - return request; - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java deleted file mode 100644 index 9c32abe373..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java +++ /dev/null @@ -1,341 +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.bpmn.infrastructure; - -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeAsyncWorkflow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.getVariable; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetCloudRegion; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseNetworkAdapter.MockNetworkAdapter; -import static org.openecomp.mso.bpmn.mock.StubResponseNetworkAdapter.MockNetworkAdapterContainingRequest; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapterTopology; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Rule; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.common.SDNCAdapterCallbackRule; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.WorkflowTestTransformer; -import org.openecomp.mso.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer; - -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; - - -/** - * Unit test cases for DeleteNetworkInstance.bpmn - * - */ -//@Ignore -public class DeleteNetworkInstanceTest extends WorkflowTest { - @WorkflowTestTransformer - public static final ResponseTransformer sdncAdapterMockTransformer = - new SDNCAdapterNetworkTopologyMockTransformer(); - - @Rule - public final SDNCAdapterCallbackRule sdncAdapterCallbackRule = - new SDNCAdapterCallbackRule(processEngineRule); - - /** - * End-to-End flow - Unit test for DeleteNetworkInstance.bpmn - * - String input & String response - */ - - @Test - //@Ignore - @Deployment(resources = {"process/DeleteNetworkInstance.bpmn", - "subprocess/DoDeleteNetworkInstance.bpmn", - "subprocess/DoDeleteNetworkInstanceRollback.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceDeleteNetworkInstance_VID_Success() throws Exception { - - System.out.println("----------------------------------------------------------"); - System.out.println(" Success VID - DeleteNetworkInstance flow Started! "); - System.out.println("----------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>delete"); - MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml"); - MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "all"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml"); - - Map variables = new HashMap<>(); - variables.put("mso-request-id", "testRequestId"); - variables.put("requestId", "testRequestId"); - variables.put("isBaseVfModule", "true"); - variables.put("recipeTimeout", "0"); - variables.put("requestAction", "DELETE"); - variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("vnfId", ""); - variables.put("vfModuleId", ""); - variables.put("volumeGroupId", ""); - variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30"); - variables.put("serviceType", "MOG"); - variables.put("vfModuleType", ""); - variables.put("networkType", "modelName"); - variables.put("bpmnRequest", getDeleteNetworkInstanceInfraRequest()); - - executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables); - - Assert.assertNotNull("DELNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest")); - Assert.assertEquals("true", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success")); - - String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse"); - Assert.assertNotNull(workflowResp); - System.out.println("DeleteNetworkInstanceTest.shouldInvokeServiceDeleteNetworkInstance_Success() WorkflowResponse:\n" + workflowResp); - - String completeMsoProcessRequest = - "" + '\n' - + " " + '\n' - + " testRequestId" + '\n' - + " DELETE" + '\n' - + " VID" + '\n' - + " " + '\n' - + " Network has been deleted successfully." + '\n' - + " BPMN Network action: DELETE" + '\n' - + ""; - - Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest")); - - System.out.println("----------------------------------------------------------"); - System.out.println(" Success VID - DeleteNetworkInstance flow Completed "); - System.out.println("----------------------------------------------------------"); - - - } - - @Test - //@Ignore - @Deployment(resources = {"process/DeleteNetworkInstance.bpmn", - "subprocess/DoDeleteNetworkInstance.bpmn", - //"subprocess/DoDeleteNetworkInstanceRollback.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceDeleteNetworkInstance_vIPER_Success() throws Exception { - - System.out.println("----------------------------------------------------------"); - System.out.println(" Success vIPER - DeleteNetworkInstance flow Started! "); - System.out.println("----------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>unassign"); - mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>deactivate"); - MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml"); - MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "all"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml"); - - String networkModelInfo = " {\"modelName\": \"modelName\", " + '\n' + - " \"networkType\": \"modelName\" }"; - - Map variables = new HashMap<>(); - variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); - variables.put("msoRequestId", "testRequestId"); - variables.put("requestId", "testRequestId"); - variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30"); - variables.put("networkName", "HSL_direct_net_2"); - variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); - variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("disableRollback", "false"); // 1702 - variables.put("failIfExists", "false"); - //variables.put("sdncVersion", "1702"); - variables.put("sdncVersion", "1707"); - variables.put("subscriptionServiceType", "MSO-dev-service-type"); - variables.put("networkModelInfo", networkModelInfo); - - executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables); - - Assert.assertNotNull("DELNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest")); - Assert.assertEquals("true", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success")); - - String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse"); - Assert.assertNotNull(workflowResp); - System.out.println("DeleteNetworkInstanceTest.shouldInvokeServiceDeleteNetworkInstance_vIPER_Success() WorkflowResponse:\n" + workflowResp); - - String completeMsoProcessRequest = - "" + '\n' - + " " + '\n' - + " testRequestId" + '\n' - + " DELETE" + '\n' - + " VID" + '\n' - + " " + '\n' - + " Network has been deleted successfully." + '\n' - + " BPMN Network action: DELETE" + '\n' - + ""; - - Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest")); - - System.out.println("----------------------------------------------------------"); - System.out.println(" Success VID - DeleteNetworkInstance flow Completed "); - System.out.println("----------------------------------------------------------"); - - - } - - @Test - //@Ignore - @Deployment(resources = {"process/DeleteNetworkInstance.bpmn", - "subprocess/DoDeleteNetworkInstance.bpmn", - "subprocess/DoDeleteNetworkInstanceRollback.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceDeleteNetworkInstanceInfra_vIPER_Rollback() throws Exception { - // Rollback is not Applicable for DeleteNetwork (no requirements). Rollback should not be invoked. - System.out.println("----------------------------------------------------------"); - System.out.println(" Rollback - DeleteNetworkInstance flow Started! "); - System.out.println("----------------------------------------------------------"); - - // setup simulatores - mockSDNCAdapter("/SDNCAdapter", "SvcAction>unassign", 500, ""); - mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>deactivate"); - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate"); - MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml"); - MockNetworkAdapterContainingRequest("createNetworkRequest", 200, "CreateNetworkV2/createNetworkResponse_Success.xml"); - MockGetNetworkByIdWithDepth ("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "all"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml"); - - String networkModelInfo = " {\"modelCustomizationId\": \"uuid-nrc-001-1234\", " + '\n' + - " \"modelInvariantId\": \"was-ist-das-001-1234\" }"; - - Map variables = new HashMap<>(); - variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); - variables.put("msoRequestId", "testRequestId"); - variables.put("requestId", "testRequestId"); - variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30"); - variables.put("networkName", "HSL_direct_net_2"); - variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); - variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("disableRollback", "false"); // 1702 - variables.put("failIfExists", "false"); - variables.put("sdncVersion", "1702"); - variables.put("subscriptionServiceType", "MSO-dev-service-type"); - variables.put("networkModelInfo", networkModelInfo); - - executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse"); - Assert.assertNotNull(workflowResp); - - Assert.assertNotNull("DELNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_FalloutHandlerRequest")); - Assert.assertEquals("false", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success")); - Assert.assertEquals("false", BPMNUtil.getVariable(processEngineRule, "DoDeleteNetworkInstance", "DELNWKI_Success")); - - System.out.println("----------------------------------------------------------"); - System.out.println(" Rollback - DeleteNetworkInstanceModular flow Completed "); - System.out.println("----------------------------------------------------------"); - - - } - - - // ***************** - // Utility Section - // ***************** - - public String getDeleteNetworkInstanceInfraRequest() { - - String request = - "{ \"requestDetails\": { " + '\n' + - " \"modelInfo\": { " + '\n' + - " \"modelType\": \"modelType\", " + '\n' + - " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' + - " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + - " \"modelVersion\": \"1.0\" " + '\n' + - " }, " + '\n' + - " \"cloudConfiguration\": { " + '\n' + - " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + - " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + - " }, " + '\n' + - " \"requestInfo\": { " + '\n' + - " \"instanceName\": \"HSL_direct_net_2\", " + '\n' + - " \"source\": \"VID\", " + '\n' + - " \"suppressRollback\": \"false\", " + '\n' + - " \"callbackUrl\": \"\" " + '\n' + - " }, " + '\n' + - " \"requestParameters\": { " + '\n' + - " \"backoutOnFailure\": true, " + '\n' + - " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' + - " \"userParams\": {} " + '\n' + - " } " + '\n' + - " } " + '\n' + - "}"; - return request; - - } - - - public String getDeleteNetworkInstanceInfraRequest_MissingId() { - - String request = - "{ \"requestDetails\": { " + '\n' + - " \"modelInfo\": { " + '\n' + - " \"modelType\": \"modelType\", " + '\n' + - " \"modelId\": \"modelId\", " + '\n' + - " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' + - " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + - " \"modelVersion\": \"1\" " + '\n' + - " }, " + '\n' + - " \"cloudConfiguration\": { " + '\n' + - " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + - " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + - " }, " + '\n' + - " \"requestInfo\": { " + '\n' + - " \"instanceName\": \"HSL_direct_net_2\", " + '\n' + - " \"source\": \"VID\", " + '\n' + - " \"callbackUrl\": \"\" " + '\n' + - " }, " + '\n' + - " \"requestParameters\": { " + '\n' + - " \"backoutOnFailure\": true, " + '\n' + - " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' + - " \"userParams\": [] " + '\n' + - " } " + '\n' + - " } " + '\n' + - "}"; - return request; - - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java deleted file mode 100644 index ba375f5d78..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java +++ /dev/null @@ -1,605 +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.bpmn.infrastructure; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.core.WorkflowException; -import org.openecomp.mso.bpmn.mock.FileUtil; - -import com.github.tomakehurst.wiremock.client.WireMock; -/** - * Unit test for DoDeleteVfModule.bpmn. - */ -public class DeleteVfModuleInfraTest extends WorkflowTest { - private final CallbackSet callbacks = new CallbackSet(); - - private static final String EOL = "\n"; - - private final String vnfAdapterDeleteCallback = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " true" + EOL + - " {{MESSAGE-ID}}" + EOL + - "" + EOL; - - //private final String vnfAdapterDeleteCallback = - // "" + EOL + - // " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - // " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - // " true" + EOL + - // " {{MESSAGE-ID}}" + EOL + - // " " + EOL + - // " " + EOL + - // " policyKey1_contrail_network_policy_fqdn" + EOL + - // " MSOTest:DefaultPolicyFQDN1" + EOL + - // "" + EOL + - // "" + EOL + - // "policyKey2_contrail_network_policy_fqdn" + EOL + - // "MSOTest:DefaultPolicyFQDN2" + EOL + - // "" + EOL + - // " " + EOL + - // " oam_management_v4_address" + EOL + - // " 1234" + EOL + - // "" + EOL + - // " " + EOL + - // " oam_management_v6_address" + EOL + - // " 1234" + EOL + - // "" + EOL + - // "" + EOL + - // "" + EOL; - - private final String vnfAdapterDeleteCallbackFail = - "" + EOL + - " Error processing request to VNF-Async. Not Found." + EOL + - " INTERNAL" + EOL + - " false" + EOL + - " {{MESSAGE-ID}}" + EOL + - "" + EOL; - - private final String sdncAdapterDeleteCallback = - "" + EOL + - " {{REQUEST-ID}}" + EOL + - " Y" + EOL + - "" + EOL; - - public DeleteVfModuleInfraTest() throws IOException { - callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback); - callbacks.put("sdncDelete", sdncAdapterDeleteCallback); - callbacks.put("vnfDelete", FileUtil.readResourceFile( - "__files/DeleteVfModuleCallbackResponse.xml")); - //callbacks.put("vnfDelete", vnfAdapterDeleteCallback); - callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail); - } - - @Test - @Ignore // 1802 merge - @Deployment(resources = { - "process/DeleteVfModuleInfra.bpmn", - "subprocess/DoDeleteVfModule.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/DeleteAAIVfModule.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/FalloutHandler.bpmn" - }) - - public void TestDeleteVfModuleSuccess() throws Exception { - // delete the Base Module - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73 - String request = - "" + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " asc_heat-int" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 00000000-0000-0000-0000-000000000000" + EOL + - " SDN-ETHERNET-INTERNET" + EOL + - " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + - " pending-delete" + EOL + - " RDM2WAGPLCP" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - logStart(); - WireMock.reset(); - - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing("SvcAction>changedelete")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml"))); - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing("SvcAction>delete")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml"))); - - //mockVNFDelete("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", 202); - MockDoDeleteVfModule_DeleteVNFSuccess(); - MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - // MockVNFAdapterRestVfModule(); -// MockAAIGenericVnfSearch(); -// MockAAIVfModulePUT(false); -// MockAAIDeleteGenericVnf(); -// MockAAIDeleteVfModule(); - mockUpdateRequestDB(200, "VfModularity/DBUpdateResponse.xml"); - - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073")) - .willReturn(aResponse() - .withStatus(200))); - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075")) - .willReturn(aResponse() - .withStatus(200))); - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078")) - .willReturn(aResponse() - .withStatus(200))); - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile("aaiFault.xml"))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml"))); - - stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*")) - .willReturn(aResponse() - .withStatus(200))); - - - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021")) - .willReturn(aResponse() - .withStatus(200))); - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile("aaiFault.xml"))); - - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*")) - .withRequestBody(containing("MMSC")) - .willReturn(aResponse() - .withStatus(200))); - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*")) - .withRequestBody(containing("PCRF")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile("aaiFault.xml"))); - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721")) - .willReturn(aResponse() - .withStatus(200))); - - String body; - - // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule - - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile("aaiFault.xml"))); - - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1")) - .willReturn(aResponse() - .withStatus(404) - .withHeader("Content-Type", "text/xml") - .withBody("Generic VNF Not Found"))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1")) - .willReturn(aResponse() - .withStatus(404) - .withHeader("Content-Type", "text/xml") - .withBody("Generic VNF Not Found"))); - - body = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " mmsc-capacity" + EOL + - " SDN-MOBILITY" + EOL + - " vMMSC" + EOL + - " pending-create" + EOL + - " false" + EOL + - " false" + EOL + - " 1508691" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " 1.0" + EOL + - " true" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 1508692" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - - body = - "" + EOL + - " 2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4" + EOL + - " STMTN5MMSC20" + EOL + - " mmsc-capacity" + EOL + - " SDN-MOBILITY" + EOL + - " vMMSC" + EOL + - " pending-create" + EOL + - " false" + EOL + - " false" + EOL + - " 1508691" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC20-MMSC::module-0-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " 1.0" + EOL + - " true" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 1508692" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + - " STMTN5MMSC20-MMSC::module-1-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + - " 1.0" + EOL + - " false" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 1508692" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - - // The following stubs are for DeleteAAIVfModule - - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile("aaiFault.xml"))); - - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1")) - .willReturn(aResponse() - .withStatus(404) - .withHeader("Content-Type", "text/xml") - .withBody("Generic VNF Not Found"))); - - body = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " mmsc-capacity" + EOL + - " SDN-MOBILITY" + EOL + - " vMMSC" + EOL + - " pending-create" + EOL + - " false" + EOL + - " false" + EOL + - " 0000021" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " 1.0" + EOL + - " true" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 0000073" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - - body = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c720" + EOL + - " STMTN5MMSC20" + EOL + - " mmsc-capacity" + EOL + - " SDN-MOBILITY" + EOL + - " vMMSC" + EOL + - " pending-create" + EOL + - " false" + EOL + - " false" + EOL + - " 0000020" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + - " STMTN5MMSC20-MMSC::module-0-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + - " 1.0" + EOL + - " true" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 0000074" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL + - " STMTN5MMSC20-MMSC::module-1-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL + - " 1.0" + EOL + - " false" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 0000075" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - - body = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c719" + EOL + - " STMTN5MMSC19" + EOL + - " mmsc-capacity" + EOL + - " SDN-MOBILITY" + EOL + - " vMMSC" + EOL + - " pending-create" + EOL + - " false" + EOL + - " false" + EOL + - " 0000019" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a76" + EOL + - " STMTN5MMSC19-MMSC::module-0-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a76" + EOL + - " 1.0" + EOL + - " true" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 0000076" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL + - " STMTN5MMSC19-MMSC::module-1-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL + - " 1.0" + EOL + - " false" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 0000077" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - - body = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c718" + EOL + - " STMTN5MMSC18" + EOL + - " mmsc-capacity" + EOL + - " SDN-MOBILITY" + EOL + - " vMMSC" + EOL + - " pending-create" + EOL + - " false" + EOL + - " false" + EOL + - " 0000018" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL + - " STMTN5MMSC18-MMSC::module-0-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL + - " 1.0" + EOL + - " true" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 0000078" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - - body = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " mmsc-capacity" + EOL + - " SDN-MOBILITY" + EOL + - " vMMSC" + EOL + - " pending-create" + EOL + - " false" + EOL + - " false" + EOL + - " 0000021" + EOL + - " " + EOL + - " " + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " 1.0" + EOL + - " true" + EOL + - " FILLED-IN-BY-MSO" + EOL + - " pending-create" + EOL + - " 0000073" + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBody(body))); - - String businessKey = UUID.randomUUID().toString(); - String deleteVfModuleRequest = - FileUtil.readResourceFile("__files/DeleteVfModule_VID_request.json"); - //Map variables = new HashMap<>(); - - //variables.put("isDebugLogEnabled","true"); -// variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); -// variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - - Map variables = setupVariablesSunnyDayVID(); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleInfra", - "v1", businessKey, deleteVfModuleRequest, variables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - // "changedelete" operation not required for deleting a Vf Module -// injectSDNCCallbacks(callbacks, "sdncChangeDelete"); - injectVNFRestCallbacks(callbacks, "vnfDelete"); - waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000); - injectSDNCCallbacks(callbacks, "sdncDelete"); - - waitForProcessEnd(businessKey, 10000); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - checkVariable(businessKey, "DeleteVfModuleInfraSuccessIndicator", true); - checkVariable(businessKey, "WorkflowException", null); - if (wfe != null) { - System.out.println("TestDeleteVfModuleInfraSuccess: ErrorCode=" + wfe.getErrorCode() + - ", ErrorMessage=" + wfe.getErrorMessage()); - } - logEnd(); - } - - // Active Scenario - private Map setupVariablesSunnyDayVID() { - Map variables = new HashMap<>(); - //try { - // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json")); - //} - //catch (Exception e) { - - //} - //variables.put("mso-request-id", "testRequestId"); - variables.put("requestId", "testRequestId"); - variables.put("isBaseVfModule", "true"); - variables.put("isDebugLogEnabled", "true"); - variables.put("recipeTimeout", "0"); - variables.put("requestAction", "DELETE_VF_MODULE"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - variables.put("volumeGroupId", ""); - variables.put("serviceType", "MOG"); - variables.put("vfModuleType", ""); - return variables; - - } - - public static void MockDoDeleteVfModule_DeleteVNFSuccess() { - stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java deleted file mode 100644 index 0e2cf1b6b3..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java +++ /dev/null @@ -1,166 +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.bpmn.infrastructure; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit test cases for UpdateVfModuleVolume.bpmn - */ -public class DeleteVfModuleVolumeInfraV1Test extends WorkflowTest { - - private final CallbackSet callbacks = new CallbackSet(); - - public DeleteVfModuleVolumeInfraV1Test() throws IOException { - callbacks.put("volumeGroupDelete", FileUtil.readResourceFile( - "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml")); - } - - /** - * Happy path scenario. - * - * @throws Exception - */ - @Test - @Ignore // BROKEN TEST - @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/VnfAdapterRestV1.bpmn"}) - public void happyPath() throws Exception { - - logStart(); - -// DeleteVfModuleVolumeInfraV1_success(); - - String businessKey = UUID.randomUUID().toString(); - String deleteVfModuleVolRequest = - FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json"); - - Map testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("volumeGroupId", "78987"); - testVariables.put("serviceInstanceId", "test-service-instance-id-0123"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1", - "v1", businessKey, deleteVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - injectVNFRestCallbacks(callbacks, "volumeGroupDelete"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", true); - - logEnd(); - } - - /** - * Test fails - vf module in use - * - * @throws Exception - */ - @Test - @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestVfModuleInUseError() throws Exception { - - logStart(); - -// DeleteVfModuleVolumeInfraV1_inUseError(); // no assertions to check - - String businessKey = UUID.randomUUID().toString(); - String deleteVfModuleVolRequest = - FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json"); - - Map testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("volumeGroupId", "78987"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1", - "v1", businessKey, deleteVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - //injectVNFRestCallbacks(callbacks, "volumeGroupDelete"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", false); - - logEnd(); - } - - /** - * Test fails on vnf adapter call - * - * @throws Exception - */ - @Test - @Ignore // BROKEN TEST - @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestVnfAdapterCallfail() throws Exception { - - logStart(); - -// DeleteVfModuleVolumeInfraV1_fail(); - - String businessKey = UUID.randomUUID().toString(); - String deleteVfModuleVolRequest = - FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json"); - - Map testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("volumeGroupId", "78987"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1", - "v1", businessKey, deleteVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - //injectVNFRestCallbacks(callbacks, "volumeGroupDelete"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", false); - - logEnd(); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java deleted file mode 100644 index 3ab3f713f4..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Please describe the DeleteVnfInfra.java class - * - */ -public class DeleteVnfInfraTest extends WorkflowTest { - - private String deleteVnfInfraRequest; - private String deleteVnfInfraRequestCascadeDelete; - - public DeleteVnfInfraTest () throws IOException { - deleteVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json"); - deleteVnfInfraRequestCascadeDelete = FileUtil.readResourceFile("__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json"); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", - "subprocess/GenericDeleteVnf.bpmn", - "subprocess/DoDeleteVnf.bpmn", - "process/DeleteVnfInfra.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn"}) - public void testDeleteVnfInfra_success() throws Exception{ - - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml"))); - - MockDeleteGenericVnf(); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map variables = new HashMap<>(); - setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - Object cascadeDelete = BPMNUtil.getRawVariable(processEngineRule, "DeleteVnfInfra", "DELVI_cascadeDelete"); - String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; - String inUse = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "DELVI_vnfInUse"); - String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowException"); - - assertEquals(false, cascadeDelete); - assertEquals("true", found); - assertEquals("false", inUse); - assertEquals("Success", response); - assertEquals(null, workflowException); - } - - @Test - @Ignore // DoDeleteVnfAndModules not complete yet - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", - "subprocess/GenericDeleteVnf.bpmn", - "subprocess/DoDeleteVnfAndModules.bpmn", - "process/DeleteVnfInfra.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn"}) - public void testDeleteVnfInfra_cascadeDelete() throws Exception{ - MockGetGenericVnfById(); - MockDeleteGenericVnf(); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map variables = new HashMap<>(); - setVariables(variables, deleteVnfInfraRequestCascadeDelete, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; - String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); - String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowException"); - Object cascadeDelete = BPMNUtil.getRawVariable(processEngineRule, "DeleteVnfInfra", "DELVI_cascadeDelete"); - - assertEquals(true, cascadeDelete); - assertEquals("true", found); - assertEquals("false", inUse); - assertEquals("Success", response); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", - "subprocess/GenericDeleteVnf.bpmn", - "subprocess/DoDeleteVnf.bpmn", - "process/DeleteVnfInfra.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn"}) - public void testDeleteVnfInfra_success_vnfNotFound() throws Exception{ - - MockDeleteGenericVnf_404(); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map variables = new HashMap<>(); - setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; - String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); - String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException"); - - assertEquals("false", found); - assertEquals("false", inUse); - assertEquals("Success", response); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", - "subprocess/GenericDeleteVnf.bpmn", - "subprocess/DoDeleteVnf.bpmn", - "process/DeleteVnfInfra.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn"}) - public void testDeleteVnfInfra_error_vnfInUse() throws Exception{ - - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml"))); - MockDeleteGenericVnf(); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map variables = new HashMap<>(); - setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; - String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "SavedWorkflowException1"); - - String exWfex = "WorkflowException[processKey=DoDeleteVnf,errorCode=5000,errorMessage=Can't Delete Generic Vnf. Generic Vnf is still in use.]"; - - assertEquals("true", found); - assertEquals("true", inUse); - assertEquals(exWfex, workflowException); - } - - private void setVariables(Map variables, String request, String requestId, String siId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("bpmnRequest", request); - variables.put("mso-request-id", requestId); - variables.put("serviceInstanceId",siId); - variables.put("vnfId","testVnfId123"); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java deleted file mode 100644 index 8a6c61c89c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java +++ /dev/null @@ -1,199 +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.bpmn.infrastructure; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.core.RollbackData; - -/** - * Unit test cases for DoCreateServiceInstanceRollback.bpmn - */ -public class DoCreateSIRollbackTest extends WorkflowTest { - private static final String EOL = "\n"; - private final CallbackSet callbacks = new CallbackSet(); - private final String sdncAdapterCallback = - "" + EOL + - " ((REQUEST-ID))" + EOL + - " Y" + EOL + - "" + EOL; - - public DoCreateSIRollbackTest() throws IOException { - callbacks.put("deactivate", sdncAdapterCallback); - callbacks.put("delete", sdncAdapterCallback); - } - - /** - * Sunny day VID scenario. - * - * @throws Exception - */ - //@Ignore // File not found - unable to run the test. Also, Stubs need updating.. - @Test - @Deployment(resources = { - "subprocess/DoCreateServiceInstanceRollback.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericDeleteService.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/FalloutHandler.bpmn" }) - public void sunnyDay() throws Exception { - - logStart(); - - //AAI - MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", ""); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml"); - MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); - //SDNC - mockSDNCAdapter(200); - //DB - mockUpdateRequestDB(200, "DBUpdateResponse.xml"); - String businessKey = UUID.randomUUID().toString(); - - Map variables = new HashMap<>(); - setupVariables(variables); - invokeSubProcess("DoCreateServiceInstanceRollback", businessKey, variables); - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - waitForProcessEnd(businessKey, 10000); - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateServiceInstanceRollback", "WorkflowException"); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - - logEnd(); - } - - // Success Scenario - private void setupVariables(Map variables) { - variables.put("isDebugLogEnabled", "true"); - variables.put("msoRequestId", "RaaTestRequestId-1"); - variables.put("mso-request-id", "RaaTestRequestId-1"); - variables.put("serviceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET"); - - RollbackData rollbackData = new RollbackData(); - - rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET"); - rollbackData.put("SERVICEINSTANCE", "globalCustomerId", "SDN-ETHERNET-INTERNET"); - rollbackData.put("SERVICEINSTANCE", "serviceSubscriptionType", "123456789"); - rollbackData.put("SERVICEINSTANCE", "disablerollback", "false"); - rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true"); - rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true"); - - String req = "" + EOL + - "" + EOL + - "b043d290-140d-4a38-a9b6-95d3b8bd27d4" + EOL + - "MIS%252F1604%252F0026%252FSW_INTERNET" + EOL + - "deactivate" + EOL + - "service-topology-operation" + EOL + - "http://localhost:8080/mso/SDNCAdapterCallbackService" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "RaaTestRequestId-1" + EOL + - "MSO" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "DeleteServiceInstance" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "123456789" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "MIS%252F1604%252F0026%252FSW_INTERNET" + EOL + - "" + EOL + - "SDN-ETHERNET-INTERNET" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - ""; - - String req1 = "" + EOL + - "" + EOL + - "bca4fede-0804-4c13-af69-9e80b378150f" + EOL + - "MIS%252F1604%252F0026%252FSW_INTERNET" + EOL + - "delete" + EOL + - "service-topology-operation" + EOL + - "http://localhost:8080/mso/SDNCAdapterCallbackService" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "RaaTestRequestId-1" + EOL + - "MSO" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "DeleteServiceInstance" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "123456789" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "MIS%252F1604%252F0026%252FSW_INTERNET" + EOL + - "" + EOL + - "SDN-ETHERNET-INTERNET" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - "" + EOL + - ""; - - rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", req); - - rollbackData.put("SERVICEINSTANCE", "sdncDelete",req1); - variables.put("rollbackData",rollbackData); - - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java deleted file mode 100644 index 4619d33ac5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java +++ /dev/null @@ -1,130 +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.bpmn.infrastructure; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetCustomer; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit test cases for DoCreateServiceInstance.bpmn - */ -public class DoCreateServiceInstanceTest extends WorkflowTest { - private static final String EOL = "\n"; - private final CallbackSet callbacks = new CallbackSet(); - private final String sdncAdapterCallback = - "" + EOL + - " ((REQUEST-ID))" + EOL + - " Y" + EOL + - "" + EOL; - private final String input = FileUtil.readResourceFile("__files/CreateServiceInstance/DoCreateServiceInstanceInput.json"); - - - public DoCreateServiceInstanceTest() throws IOException { - callbacks.put("assign", sdncAdapterCallback); - } - - /** - * Sunny day VID scenario. - * - * @throws Exception - */ - @Test - @Ignore // 1802 merge - @Deployment(resources = { - "subprocess/DoCreateServiceInstance.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericPutService.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/DoCreateServiceInstanceRollback.bpmn", - "subprocess/FalloutHandler.bpmn" }) - public void sunnyDay() throws Exception { - - logStart(); - - //AAI - MockGetCustomer("MCBH-1610", "CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml"); - MockPutServiceInstance("MCBH-1610", "viprsvc", "RaaTest-si-id", ""); - MockGetServiceInstance("MCBH-1610", "viprsvc", "RaaTest-si-id", "GenericFlows/getServiceInstance.xml"); - MockNodeQueryServiceInstanceByName("RAATest-si", ""); - - MockNodeQueryServiceInstanceById("RaaTest-si-id", ""); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml"); - MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); - //SDNC - mockSDNCAdapter(200); - //DB - mockUpdateRequestDB(200, "DBUpdateResponse.xml"); - //Catalog DB - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef","InfrastructureFlows/DoCreateServiceInstance_request.json"); - - String businessKey = UUID.randomUUID().toString(); - - Map variables = new HashMap<>(); - setupVariables(variables); - invokeSubProcess("DoCreateServiceInstance", businessKey, variables); - injectSDNCCallbacks(callbacks, "assign"); - waitForProcessEnd(businessKey, 10000); - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateServiceInstance", "WorkflowException"); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - - logEnd(); - } - - // Success Scenario - private void setupVariables(Map variables) { - variables.put("mso-request-id", "RaaDSITest1"); - variables.put("isDebugLogEnabled", "true"); - variables.put("msoRequestId", "RaaDSITestRequestId-1"); - variables.put("serviceInstanceId","RaaTest-si-id"); - variables.put("serviceModelInfo", "{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelVersionUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\",\"projectName\":\"proj123\",\"owningEntityId\":\"id123\",\"owningEntityName\":\"name123\"}"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("globalSubscriberId", "MCBH-1610"); - variables.put("subscriptionServiceType", "viprsvc"); - variables.put("instanceName", "RAATest-1"); - variables.put("serviceInstanceName", "RAT-123"); - variables.put("sdncVersion", "1611"); - variables.put("serviceType", "PORT-MIRROR"); - variables.put("requestJson", input); - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceV2Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceV2Test.java deleted file mode 100644 index a61c8298bc..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceV2Test.java +++ /dev/null @@ -1,109 +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.bpmn.infrastructure; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.bpmn.mock.FileUtil; -/** - * Unit test cases for DoCreateServiceInstanceV2.bpmn - */ -public class DoCreateServiceInstanceV2Test extends WorkflowTest { - - private final String input = FileUtil.readResourceFile("__files/CreateServiceInstance/DoCreateServiceInstanceInput.json"); - ServiceDecomposition serviceDecomposition = new ServiceDecomposition("{\"serviceResources\":{\"project\": {\"projectName\": \"projectName\"},\"owningEntity\": {\"owningEntityId\": \"id123\",\"owningEntityName\": \"name123\"}}}","abc123"); - - public DoCreateServiceInstanceV2Test() throws IOException { - - - } - - /** - * Sunny day VID scenario. - * - * @throws Exception - */ - @Ignore // 1802 merge - @Test - @Deployment(resources = { - "subprocess/DoCreateServiceInstanceV2.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/DoCreateServiceInstanceRollback.bpmn", - "subprocess/DoCreateServiceInstanceRollbackV2.bpmn", - "subprocess/FalloutHandler.bpmn" }) - - public void sunnyDay() throws Exception { - - logStart(); - - //SDNC - mockSDNCAdapter(200); - //DB - mockUpdateRequestDB(200, "DBUpdateResponse.xml"); - //Catalog DB - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef","InfrastructureFlows/DoCreateServiceInstance_request.json"); - - String businessKey = UUID.randomUUID().toString(); - - Map variables = new HashMap(); - setupVariables(variables); - invokeSubProcess("DoCreateServiceInstanceV2", businessKey, variables); - waitForProcessEnd(businessKey, 10000); - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateServiceInstanceV2", "WorkflowException"); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - - logEnd(); - } - - // Success Scenario - private void setupVariables(Map variables) { - variables.put("isDebugLogEnabled", "true"); - variables.put("msoRequestId", "RaaDSITestRequestId-1"); - variables.put("serviceInstanceId","RaaTest-si-id"); - //variables.put("serviceModelInfo", "{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelVersionUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\",\"projectName\":\"proj123\",\"owningEntityId\":\"id123\",\"owningEntityName\":\"name123\"}"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("globalSubscriberId", "MCBH-1610"); - variables.put("subscriptionServiceType", "viprsvc"); - variables.put("serviceInstanceName", "RAT-123"); - variables.put("sdncVersion", "1611"); - variables.put("serviceModelInfo", input); - variables.put("serviceDecomposition", serviceDecomposition); - variables.put("serviceType", "12e"); - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceV3Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceV3Test.java deleted file mode 100644 index 88a329b027..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceV3Test.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.bpmn.infrastructure; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.bpmn.core.json.JsonDecomposingException; - -/** - * Unit test cases for DoCreateServiceInstanceV3.bpmn - */ -public class DoCreateServiceInstanceV3Test extends WorkflowTest { - - public DoCreateServiceInstanceV3Test() throws IOException { - - } - - @Test - @Deployment(resources = { "subprocess/DoCreateServiceInstanceV3.bpmn", - "subprocess/DoCreateServiceInstanceV3Rollback.bpmn" - }) - @Ignore // 1802 merge - public void sunnyDay() throws Exception { - logStart(); - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap(); - setupVariables(variables); - invokeSubProcess("DoCreateServiceInstanceV3", businessKey, variables); - waitForProcessEnd(businessKey, 10000); - Assert.assertTrue(isProcessEnded(businessKey)); - logEnd(); - } - - // Success Scenario - private void setupVariables(Map variables) throws JsonDecomposingException { - variables.put("abc", "thevalueisabc"); - variables.put("mso-request-id", "213"); - ServiceDecomposition serviceDecomp = new ServiceDecomposition("{\"serviceResources\":{}}", "123"); - serviceDecomp.setServiceType("PORT-MIRRO"); - serviceDecomp.setSdncVersion("1610"); - variables.put("serviceDecomposition", serviceDecomp); - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java deleted file mode 100644 index 25787c79b6..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java +++ /dev/null @@ -1,161 +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.bpmn.infrastructure; - -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.core.RollbackData; -import org.openecomp.mso.bpmn.core.WorkflowException; - -/** - * Unit test for DoDeleteVfModule.bpmn. - */ -public class DoCreateVfModuleRollbackTest extends WorkflowTest { - private final CallbackSet callbacks = new CallbackSet(); - - private static final String EOL = "\n"; - - private final String vnfAdapterDeleteCallback = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " true" + EOL + - " {{MESSAGE-ID}}" + EOL + - "" + EOL; - - private final String vnfAdapterDeleteCallbackFail = - "" + EOL + - " Error processing request to VNF-Async. Not Found." + EOL + - " INTERNAL" + EOL + - " false" + EOL + - " {{MESSAGE-ID}}" + EOL + - "" + EOL; - - private final String sdncAdapterDeleteCallback = - "" + EOL + - " {{REQUEST-ID}}" + EOL + - " Y" + EOL + - "" + EOL; - - public DoCreateVfModuleRollbackTest() throws IOException { - callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback); - callbacks.put("sdncDelete", sdncAdapterDeleteCallback); - callbacks.put("vnfDelete", vnfAdapterDeleteCallback); - callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail); - } - - @Test - - @Deployment(resources = { - "subprocess/DoCreateVfModuleRollback.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/DeleteAAIVfModule.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn" - }) - public void TestCreateVfModuleRollbackSuccess() { - logStart(); - - mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml"); - mockVNFDelete("a27ce5a9-29c4-4c22-a017-6615ac73c721", "/973ed047-d251-4fb9-bf1a-65b8949e0a73", 202); - MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021", 200); - MockDeleteVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "0000073", 200); - MockPutVfModuleIdNoResponse("a27ce5a9-29c4-4c22-a017-6615ac73c721", "MMSC", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - MockPutGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721"); - MockGetGenericVnfByIdWithDepth("a27ce5a9-29c4-4c22-a017-6615ac73c721", 1, "DoCreateVfModuleRollback/GenericVnf.xml"); - MockGetVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "DoCreateVfModuleRollback/GenericVnfVfModule.xml", 200); - MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721"); - MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - RollbackData rollbackData = new RollbackData(); - rollbackData.put("VFMODULE", "source", "PORTAL"); - rollbackData.put("VFMODULE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - rollbackData.put("VFMODULE", "vnfname", "STMTN5MMSC21"); - rollbackData.put("VFMODULE", "vnftype", "asc_heat-int"); - rollbackData.put("VFMODULE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - rollbackData.put("VFMODULE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0"); - rollbackData.put("VFMODULE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421"); - rollbackData.put("VFMODULE", "aiccloudregion", "RDM2WAGPLCP"); - rollbackData.put("VFMODULE", "heatstackid", "thisisaheatstack"); - rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1"); - rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2"); - rollbackData.put("VFMODULE", "oamManagementV6Address", "2000:abc:bce:1111"); - rollbackData.put("VFMODULE", "oamManagementV4Address", "127.0.0.1"); - - rollbackData.put("VFMODULE", "rollbackPrepareUpdateVfModule", "true"); - rollbackData.put("VFMODULE", "rollbackVnfAdapterCreate", "true"); - rollbackData.put("VFMODULE", "rollbackUpdateAAIVfModule", "true"); - rollbackData.put("VFMODULE", "rollbackSDNCRequestActivate", "true"); - rollbackData.put("VFMODULE", "rollbackCreateAAIVfModule", "true"); - rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "true"); - rollbackData.put("VFMODULE", "rollbackUpdateVnfAAI", "true"); - - - - variables.put("isDebugLogEnabled","true"); - variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - rollbackData.put("VFMODULE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - rollbackData.put("VFMODULE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("rollbackData", rollbackData); - variables.put("sdncVersion", "1702"); - invokeSubProcess("DoCreateVfModuleRollback", businessKey, variables); - - // "changedelete" operation not required for deleting a Vf Module -// injectSDNCCallbacks(callbacks, "sdncChangeDelete"); - injectVNFRestCallbacks(callbacks, "vnfDelete"); - waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000); - injectSDNCCallbacks(callbacks, "sdncDelete"); - - waitForProcessEnd(businessKey, 10000); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - checkVariable(businessKey, "WorkflowException", null); - if (wfe != null) { - System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() + - ", ErrorMessage=" + wfe.getErrorMessage()); - } - logEnd(); - } - - -} - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java deleted file mode 100644 index 490d31023b..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java +++ /dev/null @@ -1,477 +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.bpmn.infrastructure; - - -import static org.openecomp.mso.bpmn.common.BPMNUtil.getRawVariable; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVfModuleByName; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutNetwork; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetVnfCatalogDataCustomizationUuid; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPost; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit tests for DoCreateVfModuleTest.bpmn. - */ -public class DoCreateVfModuleTest extends WorkflowTest { - - private final CallbackSet callbacks = new CallbackSet(); - - public DoCreateVfModuleTest() throws IOException { - callbacks.put("assign", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyAssignCallback.xml")); - callbacks.put("query", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyQueryCallback.xml")); - callbacks.put("queryVnf", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml")); - callbacks.put("queryModuleNoVnf", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml")); - callbacks.put("queryModule", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml")); - callbacks.put("activate", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("vnfCreate", FileUtil.readResourceFile( - "__files/VfModularity/VNFAdapterRestCreateCallback.xml")); - } - - /** - * Test the sunny day scenario. - */ - @Test - - @Deployment(resources = { - "subprocess/DoCreateVfModule.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/ConfirmVolumeGroupName.bpmn", - "subprocess/CreateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/CreateAAIVfModuleVolumeGroup.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn" - }) - public void sunnyDay() throws IOException { - - logStart(); - - MockAAIVfModule(); - MockPatchGenericVnf("skask"); - MockPatchVfModuleId("skask", ".*"); - mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml"); - mockVNFPost("", 202, "skask"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - //Catalog DB - MockGetServiceResourcesCatalogData("aa5256d2-5a33-55df-13ab-12abad84e7ff","InfrastructureFlows/DoCreateServiceInstance_request.json"); - - String businessKey = UUID.randomUUID().toString(); - //RuntimeService runtimeService = processEngineRule.getRuntimeService(); - - Map variables = setupVariablesSunnyDayBuildingBlocks(); - //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables); - invokeSubProcess("DoCreateVfModule", businessKey, variables); - - injectSDNCCallbacks(callbacks, "queryVnf"); - injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf"); - injectVNFRestCallbacks(callbacks, "vnfCreate"); - injectSDNCCallbacks(callbacks, "activate"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator")); - - logEnd(); - } - - /** - * Test the sunny day scenario with 1702 SDNC interaction. - */ - @Test - - @Deployment(resources = { - "subprocess/DoCreateVfModule.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/ConfirmVolumeGroupName.bpmn", - "subprocess/CreateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/CreateAAIVfModuleVolumeGroup.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn" - }) - public void sunnyDay_1702() throws IOException { - - logStart(); - - MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockPutVfModuleIdNoResponse("skask", "PCRF", ".*"); - MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200); - MockPutGenericVnf("skask"); - mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockVNFPost("", 202, "skask"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - MockPatchGenericVnf("skask"); - MockPatchVfModuleId("skask", ".*"); - //Catalog DB - MockGetServiceResourcesCatalogData("aa5256d2-5a33-55df-13ab-12abad84e7ff","InfrastructureFlows/DoCreateServiceInstance_request.json"); - - - String businessKey = UUID.randomUUID().toString(); - //RuntimeService runtimeService = processEngineRule.getRuntimeService(); - - Map variables = setupVariablesSunnyDayBuildingBlocks(); - variables.put("sdncVersion", "1702"); - //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables); - invokeSubProcess("DoCreateVfModule", businessKey, variables); - - - injectSDNCCallbacks(callbacks, "assign, queryModule"); - injectVNFRestCallbacks(callbacks, "vnfCreate"); - injectSDNCCallbacks(callbacks, "activate"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator")); - - logEnd(); - } - - /** - * Test the sunny day scenario. - */ - @Test - - @Deployment(resources = { - "subprocess/DoCreateVfModule.bpmn", - "subprocess/GenerateVfModuleName.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/ConfirmVolumeGroupName.bpmn", - "subprocess/CreateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/CreateAAIVfModuleVolumeGroup.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn" - }) - public void sunnyDay_withVfModuleNameGeneration() throws IOException { - - logStart(); - - MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockPutVfModuleIdNoResponse("skask", "PCRF", ".*"); - MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200); - MockPutGenericVnf("skask"); - MockAAIVfModule(); - mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockVNFPost("", 202, "skask"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - MockPatchGenericVnf("skask"); - MockPatchVfModuleId("skask", ".*"); - //Catalog DB - MockGetServiceResourcesCatalogData("aa5256d2-5a33-55df-13ab-12abad84e7ff","InfrastructureFlows/DoCreateServiceInstance_request.json"); - - String businessKey = UUID.randomUUID().toString(); - //RuntimeService runtimeService = processEngineRule.getRuntimeService(); - - Map variables = setupVariablesSunnyDayBuildingBlocks(); - variables.put("vfModuleName", null); - variables.put("vfModuleLabel", "MODULELABEL"); - variables.put("sdncVersion", "1702"); - //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables); - invokeSubProcess("DoCreateVfModule", businessKey, variables); - - injectSDNCCallbacks(callbacks, "assign, query"); - injectVNFRestCallbacks(callbacks, "vnfCreate"); - injectSDNCCallbacks(callbacks, "activate"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator")); - - logEnd(); - } - - /** - * Test the sunny day scenario for the aLaCarte request with no multiStageDesign - */ - @Test - - @Deployment(resources = { - "subprocess/DoCreateVfModule.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/ConfirmVolumeGroupName.bpmn", - "subprocess/CreateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/CreateAAIVfModuleVolumeGroup.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn" - }) - public void sunnyDay_aLaCarte_noMultistage() throws IOException { - - logStart(); - - MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockPutVfModuleIdNoResponse("skask", "PCRF", ".*"); - MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200); - MockPutGenericVnf("skask"); - mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockVNFPost("", 202, "skask"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - MockPatchGenericVnf("skask"); - MockPatchVfModuleId("skask", ".*"); - //Catalog DB - MockGetServiceResourcesCatalogData("aa5256d2-5a33-55df-13ab-12abad84e7ff","InfrastructureFlows/DoCreateServiceInstance_request.json"); - MockGetVnfCatalogDataCustomizationUuid("VNF-MODEL-123", "VIPR/getCatalogVnfNoTwoPhasedForVfModule.json"); - - String businessKey = UUID.randomUUID().toString(); - //RuntimeService runtimeService = processEngineRule.getRuntimeService(); - - Map variables = setupVariablesSunnyDayBuildingBlocks(); - variables.put("sdncVersion", "1702"); - variables.put("aLaCarte", true); - //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables); - invokeSubProcess("DoCreateVfModule", businessKey, variables); - - - injectSDNCCallbacks(callbacks, "assign, queryModule"); - injectVNFRestCallbacks(callbacks, "vnfCreate"); - injectSDNCCallbacks(callbacks, "activate"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator")); - - logEnd(); - } - - /** - * Test the sunny day scenario for the first stage of multistage design. - */ - @Test - - @Deployment(resources = { - "subprocess/DoCreateVfModule.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/ConfirmVolumeGroupName.bpmn", - "subprocess/CreateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/CreateAAIVfModuleVolumeGroup.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn" - }) - public void sunnyDay_1st_of_multistage() throws IOException { - - logStart(); - - MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockPutVfModuleIdNoResponse("skask", "PCRF", ".*"); - MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200); - MockPutGenericVnf("skask"); - mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockVNFPost("", 202, "skask"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - MockPatchGenericVnf("skask"); - MockPatchVfModuleId("skask", ".*"); - //Catalog DB - MockGetServiceResourcesCatalogData("aa5256d2-5a33-55df-13ab-12abad84e7ff","InfrastructureFlows/DoCreateServiceInstance_request.json"); - MockGetVnfCatalogDataCustomizationUuid("VNF-MODEL-123", "VIPR/getCatalogVnfYesTwoPhasedForVfModule.json"); - - String businessKey = UUID.randomUUID().toString(); - //RuntimeService runtimeService = processEngineRule.getRuntimeService(); - - Map variables = setupVariablesSunnyDayBuildingBlocks(); - variables.put("sdncVersion", "1702"); - variables.put("aLaCarte", true); - //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables); - invokeSubProcess("DoCreateVfModule", businessKey, variables); - - injectSDNCCallbacks(callbacks, "assign"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator")); - - logEnd(); - } - - /** - * Test the sunny day scenario for the second stage of multiStageDesign - */ - @Test - - @Deployment(resources = { - "subprocess/DoCreateVfModule.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/ConfirmVolumeGroupName.bpmn", - "subprocess/CreateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/CreateAAIVfModuleVolumeGroup.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn" - }) - public void sunnyDay_2nd_of_multistage() throws IOException { - - logStart(); - - MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5); - MockGetVfModuleByName("skask", "PCRF%3A%3Amodule-0-2","VfModularity/VfModule-new-PendingActivation.xml", 200); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockPutVfModuleIdNoResponse("skask", "PCRF", ".*"); - MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200); - MockPutGenericVnf("skask"); - mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockVNFPost("", 202, "skask"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - MockPatchGenericVnf("skask"); - MockPatchVfModuleId("skask", ".*"); - //Catalog DB - MockGetServiceResourcesCatalogData("aa5256d2-5a33-55df-13ab-12abad84e7ff","InfrastructureFlows/DoCreateServiceInstance_request.json"); - - - String businessKey = UUID.randomUUID().toString(); - //RuntimeService runtimeService = processEngineRule.getRuntimeService(); - - Map variables = setupVariablesSunnyDayBuildingBlocks(); - variables.put("sdncVersion", "1702"); - variables.put("aLaCarte", true); - //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables); - invokeSubProcess("DoCreateVfModule", businessKey, variables); - - injectSDNCCallbacks(callbacks, "queryModule"); - injectVNFRestCallbacks(callbacks, "vnfCreate"); - injectSDNCCallbacks(callbacks, "activate"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator")); - - logEnd(); - } - - - private Map setupVariablesSunnyDayBuildingBlocks() { - Map variables = new HashMap<>(); - //try { - // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json")); - //} - //catch (Exception e) { - - //} - - variables.put("mso-request-id", "testRequestId"); - - variables.put("msoRequestId", "testRequestId"); - variables.put("isBaseVfModule", false); - variables.put("isDebugLogEnabled", "true"); - variables.put("disableRollback", "true"); - //variables.put("recipeTimeout", "0"); - //variables.put("requestAction", "CREATE_VF_MODULE"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", "skask"); - variables.put("vnfName", "vnfname"); - variables.put("vfModuleName", "PCRF::module-0-2"); - variables.put("vnfType", "vSAMP12"); - variables.put("vfModuleId", ""); - variables.put("volumeGroupId", ""); - variables.put("serviceType", "MOG"); - variables.put("vfModuleType", ""); - variables.put("isVidRequest", "true"); - variables.put("asdcServiceModelVersion", "1.0"); - variables.put("usePreload", true); - - String vfModuleModelInfo = "{ "+ "\"modelType\": \"vfModule\"," + - "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"STMTN5MMSC21-MMSC::model-1-0\"," + - "\"modelVersion\": \"1\"," + - "\"modelCustomizationUuid\": \"MODEL-123\"" + "}"; - variables.put("vfModuleModelInfo", vfModuleModelInfo); - - variables.put("sdncVersion", "1707"); - - variables.put("lcpCloudRegionId", "MDTWNJ21"); - variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421"); - - String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," + - "\"modelInvariantUuid\": \"aa5256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"bb6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"SVC-STMTN5MMSC21-MMSC::model-1-0\"," + - "\"modelVersion\": \"1\"," + - "}"; - variables.put("serviceModelInfo", serviceModelInfo); - - String vnfModelInfo = "{ "+ "\"modelType\": \"vnf\"," + - "\"modelInvariantUuid\": \"445256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"f26478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"VNF-STMTN5MMSC21-MMSC::model-1-0\"," + - "\"modelVersion\": \"1\"," + - "\"modelCustomizationUuid\": \"VNF-MODEL-123\"" + "}"; - variables.put("vnfModelInfo", vnfModelInfo); - - variables.put("vnfQueryPath", "/restconf/vnfQueryPath"); - - return variables; - - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java deleted file mode 100644 index e9082d9d65..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java +++ /dev/null @@ -1,240 +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.bpmn.infrastructure; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.core.WorkflowException; -import org.openecomp.mso.bpmn.mock.FileUtil; - -@Ignore -public class DoCreateVfModuleVolumeV2Test extends WorkflowTest { - - public static final String _prefix = "CVFMODVOL2_"; - - private final CallbackSet callbacks = new CallbackSet(); - - public DoCreateVfModuleVolumeV2Test() throws IOException { - callbacks.put("volumeGroupCreate", FileUtil.readResourceFile( - "__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml")); - callbacks.put("volumeGroupRollback", FileUtil.readResourceFile( - "__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml")); - } - - /** - * Happy Path - * @throws Exception - */ - @Test - //@Ignore - @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/vnfAdapterRestV1.bpmn", - "subprocess/DoCreateVfModuleVolumeRollback.bpmn"}) - public void TestHappyPath() throws Exception { - - logStart(); - -// DoCreateVfModuleVolume_Success(); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml"); - - Map testVariables = new HashMap<>(); - testVariables.put("volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123"); - testVariables.put("vnfId", "TEST-VNF-ID-0123"); - testVariables.put("lcpCloudRegionId", "AAIAIC25"); - testVariables.put("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-01"); - testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); - //testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest); - TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables); - - injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", true); - - logEnd(); - } - - @Test -// @Ignore - @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/vnfAdapterRestV1.bpmn", - "subprocess/DoCreateVfModuleVolumeRollback.bpmn"}) - public void TestVolumeGroupExistError() throws Exception { - - logStart(); - -// DoCreateVfModuleVolume_VolumeGroupExistsFail(); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml"); - - Map testVariables = new HashMap<>(); - testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123"); - testVariables.put("vnf-id", "TEST-VNF-ID-0123"); - testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest); - TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables); - - //injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); - - waitForProcessEnd(businessKey, 100000); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1"); - Assert.assertTrue(wfe.getErrorCode() == 2500); - Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404.")); - checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false); - - logEnd(); - } - - /** - * Will trigger AAI create rollback - * @throws Exception - */ - @Test -// @Ignore - @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/vnfAdapterRestV1.bpmn", - "subprocess/DoCreateVfModuleVolumeRollback.bpmn"}) - public void TestVnfVolumeGroupCreateError() throws Exception { - - logStart(); - -// DoCreateVfModuleVolume_VnfCreateVolumeGroupFail(); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml"); - - Map testVariables = new HashMap<>(); - testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123"); - testVariables.put("vnf-id", "TEST-VNF-ID-0123"); - testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); - testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest); - TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables); - - //injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false); - - logEnd(); - } - - /** - * Will trigger AAI create rollback - * @throws Exception - */ - @Test -// @Ignore - @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/vnfAdapterRestV1.bpmn", - "subprocess/DoCreateVfModuleVolumeRollback.bpmn"}) - public void TestUpdateAaiVolumeGroupError() throws Exception { - - logStart(); - -// DoCreateVfModuleVolume_AaiVolumeGroupUpdateFail(); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml"); - - Map testVariables = new HashMap<>(); - testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123"); - testVariables.put("vnf-id", "TEST-VNF-ID-0123"); - testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); - testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest); - TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables); - - // VNF callback not needed fort this failure scenario -// injectVNFRestCallbacks(callbacks, "volumeGroupCreate,volumeGroupRollback"); - - waitForProcessEnd(businessKey, 100000); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1"); - Assert.assertTrue(wfe.getErrorCode() == 2500); - Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404.")); - checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false); - - logEnd(); - } - - /** - * Will trigger not trigger rollback - * @throws Exception - */ - @Test -// @Ignore - @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/vnfAdapterRestV1.bpmn", - "subprocess/DoCreateVfModuleVolumeRollback.bpmn"}) - public void TestUpdateAaiVolumeGroupErrorNoRollback() throws Exception { - - logStart(); - -// DoCreateVfModuleVolume_AaiVolumeGroupUpdateFail(); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml"); - - Map testVariables = new HashMap<>(); - testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123"); - testVariables.put("vnf-id", "TEST-VNF-ID-0123"); - testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); - testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest); - TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables); - - // VNF callback not needed fort this failure scenario -// injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); - - waitForProcessEnd(businessKey, 100000); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1"); - Assert.assertTrue(wfe.getErrorCode() == 2500); - Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404.")); - checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false); - - logEnd(); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java deleted file mode 100644 index fb2160d970..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java +++ /dev/null @@ -1,425 +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.bpmn.infrastructure; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByName; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVfModuleDelete; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.core.RollbackData; -import org.openecomp.mso.bpmn.core.WorkflowException; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit test for DoCreateVnfAndModulesRollback.bpmn. - */ -public class DoCreateVnfAndModulesRollbackTest extends WorkflowTest { - private final CallbackSet callbacks = new CallbackSet(); - - private static final String EOL = "\n"; - - - - private final String vnfAdapterDeleteCallback = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " true" + EOL + - " {{MESSAGE-ID}}" + EOL + - "" + EOL; - - private final String vnfAdapterDeleteCallbackFail = - "" + EOL + - " Error processing request to VNF-Async. Not Found." + EOL + - " INTERNAL" + EOL + - " false" + EOL + - " {{MESSAGE-ID}}" + EOL + - "" + EOL; - - private final String sdncAdapterDeleteCallback = - "" + EOL + - " {{REQUEST-ID}}" + EOL + - " Y" + EOL + - "" + EOL; - - public DoCreateVnfAndModulesRollbackTest() throws IOException { - callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback); - callbacks.put("sdncDelete", sdncAdapterDeleteCallback); - callbacks.put("vnfDelete", vnfAdapterDeleteCallback); - callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail); - callbacks.put("deactivate", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("unassign", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - } - - @Test - @Ignore - @Deployment(resources = { - "subprocess/DoCreateVnfAndModulesRollback.bpmn", - "subprocess/DoCreateVfModuleRollback.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/DeleteAAIVfModule.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/GenericDeleteVnf.bpmn", - "subprocess/DoDeleteVnf.bpmn" - }) - public void TestDoCreateVnfAndModulesRollbackSuccess_BaseOnly() { - // delete the Base Module and Generic Vnf - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73 - String request = - "" + EOL + - " " + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " asc_heat-int" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 00000000-0000-0000-0000-000000000000" + EOL + - " SDN-ETHERNET-INTERNET" + EOL + - " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + - " pending-delete" + EOL + - " RDM2WAGPLCP" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - logStart(); - mockSDNCAdapter("/SDNCAdapter", "SvcAction>changedelete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml"); - mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml"); - mockVNFDelete(".*", "/.*", 202); - mockVfModuleDelete("78987"); - MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721"); - MockGetGenericVnfByName("STMTN5MMSC21", "DoCreateVfModule_getVnfResponse.xml"); - MockGetGenericVnfById("/a27ce5a9-29c4-4c22-a017-6615ac73c721.*", "DoCreateVfModule_getVnfResponse.xml", 200); - MockPutVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021"); - MockDeleteVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "0000073", 200); - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - RollbackData rollbackData = new RollbackData(); - - rollbackData.put("VFMODULE_BASE", "source", "PORTAL"); - rollbackData.put("VFMODULE_BASE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - rollbackData.put("VFMODULE_BASE", "vnfname", "STMTN5MMSC21"); - rollbackData.put("VFMODULE_BASE", "vnftype", "asc_heat-int"); - rollbackData.put("VFMODULE_BASE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - rollbackData.put("VFMODULE_BASE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0"); - rollbackData.put("VFMODULE_BASE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421"); - rollbackData.put("VFMODULE_BASE", "aiccloudregion", "RDM2WAGPLCP"); - rollbackData.put("VFMODULE_BASE", "heatstackid", "thisisaheatstack"); - rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1"); - rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2"); - rollbackData.put("VFMODULE_BASE", "oamManagementV6Address", "2000:abc:bce:1111"); - rollbackData.put("VFMODULE_BASE", "oamManagementV4Address", "127.0.0.1"); - - rollbackData.put("VFMODULE_BASE", "rollbackPrepareUpdateVfModule", "true"); - rollbackData.put("VFMODULE_BASE", "rollbackVnfAdapterCreate", "true"); - rollbackData.put("VFMODULE_BASE", "rollbackUpdateAAIVfModule", "true"); - rollbackData.put("VFMODULE_BASE", "rollbackSDNCRequestActivate", "true"); - rollbackData.put("VFMODULE_BASE", "rollbackCreateAAIVfModule", "true"); - rollbackData.put("VFMODULE_BASE", "rollbackCreateNetworkPoliciesAAI", "true"); - rollbackData.put("VFMODULE_BASE", "rollbackUpdateVnfAAI", "true"); - - rollbackData.put("VNF", "vnfId", "testVnfId123"); - - rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0"); - - variables.put("isDebugLogEnabled","true"); - variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - rollbackData.put("VFMODULE_BASE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - rollbackData.put("VFMODULE_BASE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - - variables.put("rollbackData", rollbackData); - invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables); - - // "changedelete" operation not required for deleting a Vf Module -// injectSDNCCallbacks(callbacks, "sdncChangeDelete"); - injectVNFRestCallbacks(callbacks, "vnfDelete"); - //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000); - injectSDNCCallbacks(callbacks, "sdncDelete"); - - waitForProcessEnd(businessKey, 10000); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - checkVariable(businessKey, "WorkflowException", null); - if (wfe != null) { - System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() + - ", ErrorMessage=" + wfe.getErrorMessage()); - } - logEnd(); - } - - @Test - @Deployment(resources = { - "subprocess/DoCreateVnfAndModulesRollback.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/DeleteAAIVfModule.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/GenericDeleteVnf.bpmn", - "subprocess/DoDeleteVnf.bpmn" - }) - public void TestDoCreateVnfAndModulesRollbackSuccess_vnfOnly() { - // delete the Base Module and Generic Vnf - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73 - String request = - "" + EOL + - " " + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " asc_heat-int" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 00000000-0000-0000-0000-000000000000" + EOL + - " SDN-ETHERNET-INTERNET" + EOL + - " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + - " pending-delete" + EOL + - " RDM2WAGPLCP" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - logStart(); - MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml"); - MockDeleteGenericVnf("testVnfId123", "testReVer123"); - MockDoDeleteVfModule_SDNCSuccess(); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - RollbackData rollbackData = new RollbackData(); - - rollbackData.put("VNF", "vnfId", "testVnfId123"); - rollbackData.put("VNF", "rollbackVnfCreate", "true"); - rollbackData.put("VNF", "rollbackSDNCAssign", "true"); - rollbackData.put("VNF", "rollbackSDNCActivate", "true"); - rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0"); - - - variables.put("isDebugLogEnabled","true"); - variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - - - variables.put("rollbackData", rollbackData); - variables.put("sdncVersion", "1707"); - invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables); - - // "changedelete" operation not required for deleting a Vf Module -// injectSDNCCallbacks(callbacks, "sdncChangeDelete"); - - //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000); - // injectSDNCCallbacks(callbacks, "sdncDelete"); - - waitForProcessEnd(businessKey, 10000); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - checkVariable(businessKey, "WorkflowException", null); - if (wfe != null) { - System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() + - ", ErrorMessage=" + wfe.getErrorMessage()); - } - logEnd(); - } - - @Test - @Ignore - @Deployment(resources = { - "subprocess/DoCreateVnfAndModulesRollback.bpmn", - "subprocess/DoCreateVfModuleRollback.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/DeleteAAIVfModule.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/GenericDeleteVnf.bpmn", - "subprocess/DoDeleteVnf.bpmn" - }) - public void TestDoCreateVnfAndModulesRollbackSuccess_AddOn() { - // delete the Base Module and Generic Vnf - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73 - String request = - "" + EOL + - " " + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " asc_heat-int" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 00000000-0000-0000-0000-000000000000" + EOL + - " SDN-ETHERNET-INTERNET" + EOL + - " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + - " pending-delete" + EOL + - " RDM2WAGPLCP" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - logStart(); - mockSDNCAdapter("/SDNCAdapter", "SvcAction>changedelete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml"); - mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml"); - mockVNFDelete(".*", "/.*", 202); - mockVfModuleDelete("78987"); - MockGetGenericVnfByName("STMTN5MMSC21", "DoCreateVfModule_getVnfResponse.xml"); - MockGetGenericVnfById("/a27ce5a9-29c4-4c22-a017-6615ac73c721", "DoCreateVfModule_getVnfResponse.xml", 200); - MockGetGenericVnfByIdWithDepth("a27ce5a9-29c4-4c22-a017-6615ac73c721", 1, "DoCreateVfModuleRollback/GenericVnf.xml"); - MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721"); - MockPutVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021"); - MockDeleteVfModuleId("", "", "", 200); - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - RollbackData rollbackData = new RollbackData(); - - rollbackData.put("VFMODULE_BASE", "source", "PORTAL"); - rollbackData.put("VFMODULE_BASE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - rollbackData.put("VFMODULE_BASE", "vnfname", "STMTN5MMSC21"); - rollbackData.put("VFMODULE_BASE", "vnftype", "asc_heat-int"); - rollbackData.put("VFMODULE_BASE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - rollbackData.put("VFMODULE_BASE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0"); - rollbackData.put("VFMODULE_BASE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421"); - rollbackData.put("VFMODULE_BASE", "aiccloudregion", "RDM2WAGPLCP"); - rollbackData.put("VFMODULE_BASE", "heatstackid", "thisisaheatstack"); - rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1"); - rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2"); - rollbackData.put("VFMODULE_BASE", "oamManagementV6Address", "2000:abc:bce:1111"); - rollbackData.put("VFMODULE_BASE", "oamManagementV4Address", "127.0.0.1"); - rollbackData.put("VFMODULE_BASE", "rollbackPrepareUpdateVfModule", "true"); - rollbackData.put("VFMODULE_BASE", "rollbackVnfAdapterCreate", "true"); - rollbackData.put("VFMODULE_BASE", "rollbackUpdateAAIVfModule", "true"); - rollbackData.put("VFMODULE_BASE", "rollbackSDNCRequestActivate", "true"); - rollbackData.put("VFMODULE_BASE", "rollbackCreateAAIVfModule", "true"); - rollbackData.put("VFMODULE_BASE", "rollbackCreateNetworkPoliciesAAI", "true"); - rollbackData.put("VFMODULE_BASE", "rollbackUpdateVnfAAI", "true"); - rollbackData.put("VFMODULE_BASE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - rollbackData.put("VFMODULE_BASE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - - - rollbackData.put("VFMODULE_ADDON_1", "source", "PORTAL"); - rollbackData.put("VFMODULE_ADDON_1", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - rollbackData.put("VFMODULE_ADDON_1", "vnfname", "STMTN5MMSC21"); - rollbackData.put("VFMODULE_ADDON_1", "vnftype", "asc_heat-int"); - rollbackData.put("VFMODULE_ADDON_1", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - rollbackData.put("VFMODULE_ADDON_1", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0"); - rollbackData.put("VFMODULE_ADDON_1", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421"); - rollbackData.put("VFMODULE_ADDON_1", "aiccloudregion", "RDM2WAGPLCP"); - rollbackData.put("VFMODULE_ADDON_1", "heatstackid", "thisisaheatstack"); - rollbackData.put("VFMODULE_ADDON_1", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1"); - rollbackData.put("VFMODULE_ADDON_1", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2"); - rollbackData.put("VFMODULE_ADDON_1", "oamManagementV6Address", "2000:abc:bce:1111"); - rollbackData.put("VFMODULE_ADDON_1", "oamManagementV4Address", "127.0.0.1"); - rollbackData.put("VFMODULE_ADDON_1", "rollbackPrepareUpdateVfModule", "true"); - rollbackData.put("VFMODULE_ADDON_1", "rollbackVnfAdapterCreate", "true"); - rollbackData.put("VFMODULE_ADDON_1", "rollbackUpdateAAIVfModule", "true"); - rollbackData.put("VFMODULE_ADDON_1", "rollbackSDNCRequestActivate", "true"); - rollbackData.put("VFMODULE_ADDON_1", "rollbackCreateAAIVfModule", "true"); - rollbackData.put("VFMODULE_ADDON_1", "rollbackCreateNetworkPoliciesAAI", "true"); - rollbackData.put("VFMODULE_ADDON_1", "rollbackUpdateVnfAAI", "true"); - rollbackData.put("VFMODULE_ADDON_1", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - rollbackData.put("VFMODULE_ADDON_1", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - - rollbackData.put("VNF", "vnfId", "testVnfId123"); - - rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "1"); - - variables.put("isDebugLogEnabled","true"); - variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - - - variables.put("rollbackData", rollbackData); - invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables); - - // "changedelete" operation not required for deleting a Vf Module - // injectSDNCCallbacks(callbacks, "sdncChangeDelete"); - injectVNFRestCallbacks(callbacks, "vnfDelete"); - injectVNFRestCallbacks(callbacks, "vnfDelete"); - //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000); - injectSDNCCallbacks(callbacks, "sdncDelete"); - - waitForProcessEnd(businessKey, 10000); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - checkVariable(businessKey, "WorkflowException", null); - if (wfe != null) { - System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() + - ", ErrorMessage=" + wfe.getErrorMessage()); - } - logEnd(); - } - - public static void MockDoDeleteVfModule_SDNCSuccess() { - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing("SvcAction>deactivate")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml"))); - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing("SvcAction>unassign")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml"))); - } - - -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java deleted file mode 100644 index dc0af4186e..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java +++ /dev/null @@ -1,374 +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.bpmn.infrastructure; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSDNCAdapterVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.core.domain.ModelInfo; -import org.openecomp.mso.bpmn.core.domain.ModuleResource; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.bpmn.core.domain.VnfResource; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit Test for the DoCreateVnfAndModules Flow - * - */ -public class DoCreateVnfAndModulesTest extends WorkflowTest { - - private final CallbackSet callbacks = new CallbackSet(); - - public DoCreateVnfAndModulesTest() throws IOException { - - callbacks.put("assign", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyAssignCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("query", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyQueryCallback.xml")); - callbacks.put("queryVnf", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml")); - callbacks.put("queryModuleNoVnf", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml")); - callbacks.put("queryModule", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml")); - callbacks.put("vnfCreate", FileUtil.readResourceFile( - "__files/VfModularity/VNFAdapterRestCreateCallback.xml")); - } - - @Test - - @Deployment(resources = {"subprocess/GenericGetService.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/GenericPutVnf.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/DoCreateVnf.bpmn", - "subprocess/GenerateVfModuleName.bpmn", - "subprocess/DoCreateVfModule.bpmn", - "subprocess/DoCreateVnfAndModules.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/ConfirmVolumeGroupName.bpmn", - "subprocess/CreateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/CreateAAIVfModuleVolumeGroup.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/DoCreateVnfAndModulesRollback.bpmn"}) - public void testDoCreateVnfAndModulesBaseOnly_success() throws Exception{ - - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - MockGetGenericVnfById_404("testVnfId"); - MockPutGenericVnf(".*"); - MockAAIVfModule(); - MockPatchGenericVnf("skask"); - MockPatchVfModuleId("skask", ".*"); - mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml"); - MockVNFAdapterRestVfModule(); - MockDBUpdateVfModule(); - - mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - invokeSubProcess("DoCreateVnfAndModules", businessKey, variables); - - injectSDNCCallbacks(callbacks, "assign"); - injectSDNCCallbacks(callbacks, "query"); - injectSDNCCallbacks(callbacks, "activate"); - injectSDNCCallbacks(callbacks, "queryVnf"); - injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf"); - injectVNFRestCallbacks(callbacks, "vnfCreate"); - injectSDNCCallbacks(callbacks, "activate"); - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - assertVariables("true", "true", "false", "true", "Success", null); - - } - - @Test - - @Deployment(resources = {"subprocess/GenericGetService.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/GenericPutVnf.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/DoCreateVnf.bpmn", - "subprocess/GenerateVfModuleName.bpmn", - "subprocess/DoCreateVfModule.bpmn", - "subprocess/DoCreateVnfAndModules.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/ConfirmVolumeGroupName.bpmn", - "subprocess/CreateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/CreateAAIVfModuleVolumeGroup.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/DoCreateVnfAndModulesRollback.bpmn"}) - public void testDoCreateVnfAndModulesWithAddon_success() throws Exception{ - - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - MockGetGenericVnfById_404("testVnfId"); - MockPutGenericVnf(".*"); - MockAAIVfModule(); - MockPatchGenericVnf("skask"); - MockPatchVfModuleId("skask", ".*"); - mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml"); - MockVNFAdapterRestVfModule(); - MockDBUpdateVfModule(); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesAddonSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - invokeSubProcess("DoCreateVnfAndModules", businessKey, variables); - - injectSDNCCallbacks(callbacks, "assign"); - injectSDNCCallbacks(callbacks, "query"); - injectSDNCCallbacks(callbacks, "activate"); - injectSDNCCallbacks(callbacks, "queryVnf"); - injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf"); - injectVNFRestCallbacks(callbacks, "vnfCreate"); - injectSDNCCallbacks(callbacks, "activate"); - injectSDNCCallbacks(callbacks, "queryVnf"); - injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf"); - injectVNFRestCallbacks(callbacks, "vnfCreate"); - injectSDNCCallbacks(callbacks, "activate"); - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - assertVariables("true", "true", "false", "true", "Success", null); - - } - - private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) { - - String siFound = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGS_FoundIndicator"); - String siSucc = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGS_SuccessIndicator"); - String vnfFound = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGV_FoundIndicator"); - String vnfSucc = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGV_SuccessIndicator"); - String response = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "SavedWorkflowException1"); - - //assertEquals(exSIFound, siFound); - //assertEquals(exSISucc, siSucc); - //assertEquals(exVnfFound, vnfFound); - //assertEquals(exVnfSucc, vnfSucc); - //assertEquals(exResponse, response); - assertEquals(exWorkflowException, workflowException); - } - - private void setVariables(Map variables, String request, String requestId, String siId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("bpmnRequest", request); - variables.put("mso-request-id", requestId); - variables.put("serviceInstanceId",siId); - variables.put("testVnfId","testVnfId123"); - variables.put("vnfType", "STMTN"); - } - - private void setVariablesSuccess(Map variables, String request, String requestId, String siId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("mso-request-id", requestId); - variables.put("requestId", requestId); - variables.put("msoRequestId", requestId); - variables.put("serviceInstanceId",siId); - variables.put("disableRollback", "true"); - //variables.put("testVnfId","testVnfId123"); - variables.put("vnfType", "STMTN"); - - String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," + - "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"ServicevSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "}"; - variables.put("serviceModelInfo", serviceModelInfo); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," + - "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"vSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}"; - variables.put("vnfModelInfo", vnfModelInfo); - - String cloudConfiguration = "{" + "\"cloudConfiguration\": { " + - "\"lcpCloudRegionId\": \"mdt1\"," + - "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}"; - variables.put("cloudConfiguration", cloudConfiguration); - variables.put("sdncVersion", "1707"); - variables.put("globalSubscriberId", "subscriber123"); - - try { - String serviceDecomposition = FileUtil.readResourceFile("__files/VIPR/serviceDecompositionATMFW.json"); - ServiceDecomposition sd = new ServiceDecomposition(); - ModelInfo serviceModel = new ModelInfo(); - serviceModel.setModelName("servicewithVNFs"); - sd.setModelInfo(serviceModel); - VnfResource vr = new VnfResource(); - ModelInfo mvr = new ModelInfo(); - mvr.setModelName("vSAMP12"); - mvr.setModelInstanceName("v123"); - mvr.setModelInvariantUuid(""); - mvr.setModelVersion("1.0"); - mvr.setModelCustomizationUuid("MODEL-ID-1234"); - vr.setModelInfo(mvr); - vr.constructVnfType("vnf1"); - vr.setNfType("somenftype"); - vr.setNfRole("somenfrole"); - vr.setNfFunction("somenffunction"); - vr.setNfNamingCode("somenamingcode"); - ModuleResource mr = new ModuleResource(); - ModelInfo mvmr = new ModelInfo(); - mvmr.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff"); - mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0"); - mvmr.setModelVersion("1"); - mvmr.setModelCustomizationUuid("MODEL-123"); - mr.setModelInfo(mvmr); - mr.setIsBase(true); - mr.setVfModuleLabel("MODULELABEL"); - vr.addVfModule(mr); - sd.addVnfResource(vr); - - variables.put("serviceDecomposition", sd); - variables.put("isTest", true); - } catch(Exception e) { - - } - - } - - private void setVariablesAddonSuccess(Map variables, String request, String requestId, String siId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("mso-request-id", requestId); - variables.put("requestId", requestId); - variables.put("msoRequestId", requestId); - variables.put("serviceInstanceId",siId); - variables.put("disableRollback", "true"); - //variables.put("testVnfId","testVnfId123"); - variables.put("vnfType", "STMTN"); - - String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," + - "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"ServicevSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "}"; - variables.put("serviceModelInfo", serviceModelInfo); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," + - "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"vSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}"; - variables.put("vnfModelInfo", vnfModelInfo); - - String cloudConfiguration = "{" + "\"cloudConfiguration\": { " + - "\"lcpCloudRegionId\": \"mdt1\"," + - "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}"; - variables.put("cloudConfiguration", cloudConfiguration); - variables.put("sdncVersion", "1707"); - variables.put("globalSubscriberId", "subscriber123"); - - try { - String serviceDecomposition = FileUtil.readResourceFile("__files/VIPR/serviceDecompositionATMFW.json"); - ServiceDecomposition sd = new ServiceDecomposition(); - ModelInfo serviceModel = new ModelInfo(); - serviceModel.setModelName("servicewithVNFs"); - sd.setModelInfo(serviceModel); - VnfResource vr = new VnfResource(); - ModelInfo mvr = new ModelInfo(); - mvr.setModelName("vSAMP12"); - mvr.setModelInstanceName("v123"); - mvr.setModelInvariantUuid(""); - mvr.setModelVersion("1.0"); - mvr.setModelCustomizationUuid("MODEL-ID-1234"); - vr.setModelInfo(mvr); - vr.setNfType("somenftype"); - vr.setNfRole("somenfrole"); - vr.setNfFunction("somenffunction"); - vr.setNfNamingCode("somenamingcode"); - ModuleResource mr = new ModuleResource(); - ModelInfo mvmr = new ModelInfo(); - mvmr.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff"); - mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0"); - mvmr.setModelVersion("1"); - mvmr.setModelCustomizationUuid("MODEL-123"); - mr.setModelInfo(mvmr); - mr.setIsBase(true); - mr.setVfModuleLabel("MODULELABEL"); - vr.addVfModule(mr); - ModuleResource mr1 = new ModuleResource(); - ModelInfo mvmr1 = new ModelInfo(); - mvmr1.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff"); - mvmr1.setModelName("STMTN5MMSC21-MMSC::model-1-0"); - mvmr1.setModelVersion("1"); - mvmr1.setModelCustomizationUuid("MODEL-123"); - mr1.setModelInfo(mvmr1); - mr1.setIsBase(false); - mr1.setVfModuleLabel("MODULELABEL"); - mr1.setInitialCount(1); - vr.addVfModule(mr1); - - sd.addVnfResource(vr); - - variables.put("serviceDecomposition", sd); - variables.put("isTest", true); - } catch(Exception e) { - - - - } - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java deleted file mode 100644 index 7537ffa4c0..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByName_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.WorkflowTest.CallbackSet; -import org.openecomp.mso.bpmn.core.domain.VnfResource; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit Test for the DoCreateVnf Flow - * - */ -public class DoCreateVnfTest extends WorkflowTest { - - private String createVnfInfraRequest; - private final CallbackSet callbacks = new CallbackSet(); - - - public DoCreateVnfTest() throws IOException { - createVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json"); - callbacks.put("assign", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyAssignCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/DoCreateVnf.bpmn"}) - public void testDoCreateVnfInfra_success() throws Exception{ - - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - MockGetGenericVnfByName_404("testVnfName123"); - MockPutGenericVnf("testVnfId123"); - mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - invokeSubProcess("DoCreateVnf", businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - assertVariables("true", "true", "false", "true", "Success", null); - } - - private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) { - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "SavedWorkflowException1"); - - assertEquals(exWorkflowException, workflowException); - } - - private void setVariablesSuccess(Map variables, String request, String requestId, String siId) { - variables.put("isDebugLogEnabled", "true"); - //variables.put("bpmnRequest", request); - variables.put("mso-request-id", requestId); - variables.put("serviceInstanceId",siId); - variables.put("vnfName", "testVnfName123"); - variables.put("disableRollback", "true"); - variables.put("requestId", requestId); - variables.put("testVnfId","testVnfId123"); - variables.put("vnfType", "STMTN"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - String vnfModelInfo = "{ "+ "\"modelType\": \"vnf\"," + - "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"vSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + - "}"; - variables.put("vnfModelInfo", vnfModelInfo); - - String cloudConfiguration = "{ " + - "\"lcpCloudRegionId\": \"mdt1\"," + - "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}"; - variables.put("cloudConfiguration", cloudConfiguration); - - String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," + - "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"ServicevSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "}"; - variables.put("serviceModelInfo", serviceModelInfo); - variables.put("globalSubscriberId", "MSO-1610"); - VnfResource vnfResource = new VnfResource(); - variables.put("vnfResourceDecomposition", vnfResource); - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java deleted file mode 100644 index 37814999ba..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java +++ /dev/null @@ -1,108 +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.bpmn.infrastructure; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.common.WorkflowTest; - -/** - * Unit test cases for DoDeleteServiceInstance.bpmn - */ -public class DoDeleteServiceInstanceTest extends WorkflowTest { - - private final CallbackSet callbacks = new CallbackSet(); - private static final String EOL = "\n"; - private final String sdncAdapterCallback = - "" + EOL + - " ((REQUEST-ID))" + EOL + - " Y" + EOL + - "" + EOL; - - public DoDeleteServiceInstanceTest() throws IOException { - callbacks.put("deactivate", sdncAdapterCallback); - callbacks.put("delete", sdncAdapterCallback); - } - - /** - * Sunny day VID scenario. - * - * @throws Exception - */ - //@Ignore // File not found - unable to run the test. Also, Stubs need updating.. - @Test - @Deployment(resources = { - "subprocess/DoDeleteServiceInstance.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericDeleteService.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/FalloutHandler.bpmn" }) - public void sunnyDay() throws Exception { - - logStart(); - - //AAI - MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "", 204); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml"); - MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); - //SDNC - mockSDNCAdapter(200); - //DB - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - String businessKey = UUID.randomUUID().toString(); - - Map variables = new HashMap<>(); - setupVariables(variables); - invokeSubProcess("DoDeleteServiceInstance", businessKey, variables); - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - waitForProcessEnd(businessKey, 10000); - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteServiceInstance", "WorkflowException"); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - - logEnd(); - } - - // Success Scenario - private void setupVariables(Map variables) { - variables.put("isDebugLogEnabled", "true"); - variables.put("msoRequestId", "RaaDDSIRequestId-1"); - variables.put("mso-request-id", "RaaDDSIRequestId-1"); - variables.put("serviceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET"); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java deleted file mode 100644 index 13b2f5432d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java +++ /dev/null @@ -1,177 +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.bpmn.infrastructure; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIDeleteVfModule; -import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIGenericVnfSearch; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.core.WorkflowException; - -public class DoDeleteVfModuleFromVnfTest extends WorkflowTest { - private final CallbackSet callbacks = new CallbackSet(); - - private static final String EOL = "\n"; - - private final String vnfAdapterDeleteCallback = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " true" + EOL + - " {{MESSAGE-ID}}" + EOL + - "" + EOL; - - private final String vnfAdapterDeleteCallbackFail = - "" + EOL + - " Error processing request to VNF-Async. Not Found." + EOL + - " INTERNAL" + EOL + - " false" + EOL + - " {{MESSAGE-ID}}" + EOL + - "" + EOL; - - private final String sdncAdapterDeleteCallback = - "" + EOL + - " {{REQUEST-ID}}" + EOL + - " Y" + EOL + - "" + EOL; - - public DoDeleteVfModuleFromVnfTest() throws IOException { - callbacks.put("deactivate", sdncAdapterDeleteCallback); - callbacks.put("unassign", sdncAdapterDeleteCallback); - callbacks.put("vnfDelete", vnfAdapterDeleteCallback); - callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail); - } - - private final String wfeString = "WorkflowException"; - - @Test - @Deployment(resources = { - "subprocess/DoDeleteVfModuleFromVnf.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/DeleteAAIVfModule.bpmn" - }) - public void TestDoDeleteVfModuleFromVnfSuccess() { - // delete the Base Module and Generic Vnf - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73 - String request = - "" + EOL + - " " + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " asc_heat-int" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 00000000-0000-0000-0000-000000000000" + EOL + - " SDN-ETHERNET-INTERNET" + EOL + - " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + - " pending-delete" + EOL + - " RDM2WAGPLCP" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - logStart(); - MockDoDeleteVfModule_SDNCSuccess(); - MockDoDeleteVfModule_DeleteVNFSuccess(); - MockAAIGenericVnfSearch(); - MockAAIDeleteVfModule(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("msoRequestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); - variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421"); - variables.put("sdncVersion", "1707"); - - invokeSubProcess("DoDeleteVfModuleFromVnf", businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivate"); - injectVNFRestCallbacks(callbacks, "vnfDelete"); - //waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString); - checkVariable(businessKey, wfeString, null); - if (wfe != null) { - System.out.println("TestDoDeleteVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() + - ", ErrorMessage=" + wfe.getErrorMessage()); - } - logEnd(); - } - - - // start of mocks used locally and by other VF Module unit tests - - - - public static void MockDoDeleteVfModule_SDNCSuccess() { - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing("SvcAction>deactivate")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml"))); - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing("SvcAction>unassign")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml"))); - } - - - public static void MockDoDeleteVfModule_DeleteVNFSuccess() { - stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - } - - -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java deleted file mode 100644 index 8f5f63d4c4..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java +++ /dev/null @@ -1,631 +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.bpmn.infrastructure; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIDeleteGenericVnf; -import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIDeleteVfModule; -import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIGenericVnfSearch; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.core.WorkflowException; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit test for DoDeleteVfModule.bpmn. - */ -public class DoDeleteVfModuleTest extends WorkflowTest { - private final CallbackSet callbacks = new CallbackSet(); - - private static final String EOL = "\n"; - - private final String vnfAdapterDeleteCallback = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " true" + EOL + - " {{MESSAGE-ID}}" + EOL + - "" + EOL; - - private final String vnfAdapterDeleteCallbackFail = - "" + EOL + - " Error processing request to VNF-Async. Not Found." + EOL + - " INTERNAL" + EOL + - " false" + EOL + - " {{MESSAGE-ID}}" + EOL + - "" + EOL; - - private final String sdncAdapterDeleteCallback = - "" + EOL + - " {{REQUEST-ID}}" + EOL + - " Y" + EOL + - "" + EOL; - - public DoDeleteVfModuleTest() throws IOException { - callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback); - callbacks.put("sdncDelete", sdncAdapterDeleteCallback); - callbacks.put("vnfDelete", FileUtil.readResourceFile( - "__files/DeleteVfModuleCallbackResponse.xml")); - callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail); - } - - private final String wfeString = "WorkflowException"; - - @Test - @Deployment(resources = { - "subprocess/DoDeleteVfModule.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/DeleteAAIVfModule.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn" - }) - public void TestDoDeleteVfModuleSuccess() { - // delete the Base Module and Generic Vnf - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73 - String request = - "" + EOL + - " " + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " asc_heat-int" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 00000000-0000-0000-0000-000000000000" + EOL + - " SDN-ETHERNET-INTERNET" + EOL + - " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + - " pending-delete" + EOL + - " RDM2WAGPLCP" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - logStart(); - MockDoDeleteVfModule_SDNCSuccess(); - MockDoDeleteVfModule_DeleteVNFSuccess(); - MockAAIGenericVnfSearch(); - MockAAIVfModulePUT(false); - MockAAIDeleteGenericVnf(); - MockAAIDeleteVfModule(); - MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("DoDeleteVfModuleRequest",request); - variables.put("isVidRequest", "true"); - invokeSubProcess("DoDeleteVfModule", businessKey, variables); - - // "changedelete" operation not required for deleting a Vf Module -// injectSDNCCallbacks(callbacks, "sdncChangeDelete"); - injectVNFRestCallbacks(callbacks, "vnfDelete"); - waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000); - injectSDNCCallbacks(callbacks, "sdncDelete"); - - waitForProcessEnd(businessKey, 10000); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString); - checkVariable(businessKey, wfeString, null); - if (wfe != null) { - System.out.println("TestDoDeleteVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() + - ", ErrorMessage=" + wfe.getErrorMessage()); - } - logEnd(); - } - - @Test - @Deployment(resources = { - "subprocess/DoDeleteVfModule.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/DeleteAAIVfModule.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn" - }) - public void TestDoDeleteVfModule_Building_Block_Success() { - logStart(); - MockDoDeleteVfModule_SDNCSuccess(); - MockDoDeleteVfModule_DeleteVNFSuccess(); - MockAAIGenericVnfSearch(); - MockAAIVfModulePUT(false); - MockAAIDeleteGenericVnf(); - MockAAIDeleteVfModule(); - MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - - variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("requestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("isDebugLogEnabled","true"); - variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0"); - variables.put("sdncVersion", "1610"); - variables.put("isVidRequest", "true"); - variables.put("retainResources", false); - String vfModuleModelInfo = "{" + "\"modelType\": \"vnf\"," + - "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"vSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + - "}"; - variables.put("vfModuleModelInfo", vfModuleModelInfo); - - String cloudConfiguration = "{" + - "\"lcpCloudRegionId\": \"RDM2WAGPLCP\"," + - "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}"; - variables.put("cloudConfiguration", cloudConfiguration); - - - invokeSubProcess("DoDeleteVfModule", businessKey, variables); - - // "changedelete" operation not required for deleting a Vf Module -// injectSDNCCallbacks(callbacks, "sdncChangeDelete"); - injectVNFRestCallbacks(callbacks, "vnfDelete"); - waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000); - injectSDNCCallbacks(callbacks, "sdncDelete"); - - waitForProcessEnd(businessKey, 10000); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString); - checkVariable(businessKey, wfeString, null); - if (wfe != null) { - System.out.println("TestDoDeleteVfModule_Building_Block_Success: ErrorCode=" + wfe.getErrorCode() + - ", ErrorMessage=" + wfe.getErrorMessage()); - } - logEnd(); - } - - @Test - @Deployment(resources = { - "subprocess/DoDeleteVfModule.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/DeleteAAIVfModule.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn" - }) - public void TestDoDeleteVfModule_Building_Block_ModuleInAssignedState() { - logStart(); - MockDoDeleteVfModule_SDNCSuccess(); - MockDoDeleteVfModule_DeleteVNFSuccess(); - MockAAIGenericVnfSearch(); - MockAAIVfModulePUT(false); - MockAAIDeleteGenericVnf(); - MockAAIDeleteVfModule(); - MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - - variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("requestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("isDebugLogEnabled","true"); - variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0"); - variables.put("sdncVersion", "1610"); - variables.put("isVidRequest", "true"); - variables.put("retainResources", false); - variables.put("aLaCarte", true); - String vfModuleModelInfo = "{" + "\"modelType\": \"vnf\"," + - "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"vSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + - "}"; - variables.put("vfModuleModelInfo", vfModuleModelInfo); - - String cloudConfiguration = "{" + - "\"lcpCloudRegionId\": \"RDM2WAGPLCP\"," + - "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}"; - variables.put("cloudConfiguration", cloudConfiguration); - - - invokeSubProcess("DoDeleteVfModule", businessKey, variables); - - // "changedelete" operation not required for deleting a Vf Module -// injectSDNCCallbacks(callbacks, "sdncChangeDelete"); - injectVNFRestCallbacks(callbacks, "vnfDelete"); - waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000); - injectSDNCCallbacks(callbacks, "sdncDelete"); - - waitForProcessEnd(businessKey, 10000); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString); - checkVariable(businessKey, wfeString, null); - if (wfe != null) { - System.out.println("TestDoDeleteVfModule_Building_Block_Success: ErrorCode=" + wfe.getErrorCode() + - ", ErrorMessage=" + wfe.getErrorMessage()); - } - logEnd(); - } - - - @Test - @Deployment(resources = { - "subprocess/DoDeleteVfModule.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/DeleteAAIVfModule.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn" - }) - public void TestDoDeleteVfModuleSDNCFailure() { - // delete the Base Module and Generic Vnf - SDNCAdapter failure - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73 - String request = - "" + EOL + - " " + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " asc_heat-int" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 00000000-0000-0000-0000-000000000000" + EOL + - " SDN-ETHERNET-INTERNET" + EOL + - " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + - " pending-delete" + EOL + - " RDM2WAGPLCP" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - - logStart(); - MockDoDeleteVfModule_SDNCFailure(); - MockDoDeleteVfModule_DeleteVNFSuccess(); - MockAAIGenericVnfSearch(); - MockAAIVfModulePUT(false); - MockAAIDeleteGenericVnf(); - MockAAIDeleteVfModule(); - MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("DoDeleteVfModuleRequest", request); - variables.put("isVidRequest", "true"); - invokeSubProcess("DoDeleteVfModule", businessKey, variables); - - // "changedelete" operation not required for deleting a Vf Module -// injectSDNCCallbacks(callbacks, "sdncChangeDelete"); - injectVNFRestCallbacks(callbacks, "vnfDelete"); - waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000); - // cause a failure by not injecting a callback -// injectSDNCCallbacks(callbacks, "sdncDelete"); - - waitForProcessEnd(businessKey, 10000); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString); - Assert.assertNotNull(wfe); - if (wfe != null) { - System.out.println("TestDoDeleteVfModuleSDNCFailure: ErrorCode=" + wfe.getErrorCode() + - ", ErrorMessage=" + wfe.getErrorMessage()); - Assert.assertTrue(wfe.getErrorCode() == 7000); - Assert.assertTrue(wfe.getErrorMessage().startsWith("Could not communicate")); - } - logEnd(); - } - - @Test - @Deployment(resources = { - "subprocess/DoDeleteVfModule.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/DeleteAAIVfModule.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn" - }) - public void TestDoDeleteVfModuleSDNCCallbackFailure() { - // delete the Base Module and Generic Vnf - SDNCAdapter Callback failure - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73 - String request = - "" + EOL + - " " + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " asc_heat-int" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 00000000-0000-0000-0000-000000000000" + EOL + - " SDN-ETHERNET-INTERNET" + EOL + - " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + - " pending-delete" + EOL + - " RDM2WAGPLCP" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - - logStart(); - MockDoDeleteVfModule_SDNCSuccess(); - MockDoDeleteVfModule_DeleteVNFSuccess(); - MockAAIGenericVnfSearch(); - MockAAIVfModulePUT(false); - MockAAIDeleteGenericVnf(); - MockAAIDeleteVfModule(); - MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("DoDeleteVfModuleRequest",request); - variables.put("isVidRequest", "true"); - invokeSubProcess("DoDeleteVfModule", businessKey, variables); - - // "changedelete" operation not required for deleting a Vf Module -// injectSDNCCallbacks(callbacks, "sdncChangeDelete:ERR"); - injectVNFRestCallbacks(callbacks, "vnfDelete"); - waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000); - // return a failure in the callback - injectSDNCCallbacks(callbacks, "sdncDelete:ERR"); - - waitForProcessEnd(businessKey, 10000); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString); - Assert.assertNotNull(wfe); - if (wfe != null) { - System.out.println("TestDoDeleteVfModuleSDNCCallbackFailure: ErrorCode=" + wfe.getErrorCode() + - ", ErrorMessage=" + wfe.getErrorMessage()); - Assert.assertTrue(wfe.getErrorCode() == 5310); - Assert.assertTrue(wfe.getErrorMessage().startsWith("Received error from SDN-C")); - } - logEnd(); - } - - @Test - @Deployment(resources = { - "subprocess/DoDeleteVfModule.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/DeleteAAIVfModule.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn" - }) - public void TestDoDeleteVfModuleVNFFailure() { - // delete the Base Module and Generic Vnf - VNFAdapter failure - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73 - String request = - "" + EOL + - " " + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " asc_heat-int" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 00000000-0000-0000-0000-000000000000" + EOL + - " SDN-ETHERNET-INTERNET" + EOL + - " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + - " pending-delete" + EOL + - " RDM2WAGPLCP" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - - logStart(); - MockDoDeleteVfModule_SDNCSuccess(); - MockDoDeleteVfModule_DeleteVNFFailure(); - MockAAIGenericVnfSearch(); - MockAAIVfModulePUT(false); - MockAAIDeleteGenericVnf(); - MockAAIDeleteVfModule(); - MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("DoDeleteVfModuleRequest",request); - invokeSubProcess("DoDeleteVfModule", businessKey, variables); - - // "changedelete" operation not required for deleting a Vf Module -// injectSDNCCallbacks(callbacks, "sdncChangeDelete"); - // cause a failure by not injecting a callback -// injectVNFRestCallbacks(callbacks, "vnfDelete"); -// waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000); -// injectSDNCCallbacks(callbacks, "sdncDelete"); - - waitForProcessEnd(businessKey, 10000); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString); - Assert.assertNotNull(wfe); - if (wfe != null) { - System.out.println("TestDoDeleteVfModuleVNFFailure: ErrorCode=" + wfe.getErrorCode() + - ", ErrorMessage=" + wfe.getErrorMessage()); - Assert.assertTrue(wfe.getErrorCode() == 7020); - Assert.assertTrue(wfe.getErrorMessage().startsWith("Received error from VnfAdapter")); - } - logEnd(); - } - - @Test - @Deployment(resources = { - "subprocess/DoDeleteVfModule.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/DeleteAAIVfModule.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn" - }) - public void TestDoDeleteVfModuleVNFCallbackFailure() { - // delete the Base Module and Generic Vnf - VNFAdapter Callback failure - // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73 - String request = - "" + EOL + - " " + EOL + - " DELETE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " asc_heat-int" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " 00000000-0000-0000-0000-000000000000" + EOL + - " SDN-ETHERNET-INTERNET" + EOL + - " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + - " pending-delete" + EOL + - " RDM2WAGPLCP" + EOL + - " " + EOL + - " " + EOL + - "" + EOL; - - logStart(); - MockDoDeleteVfModule_SDNCSuccess(); - MockDoDeleteVfModule_DeleteVNFSuccess(); - MockAAIGenericVnfSearch(); - MockAAIVfModulePUT(false); - MockAAIDeleteGenericVnf(); - MockAAIDeleteVfModule(); - MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled","true"); - variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("DoDeleteVfModuleRequest",request); - invokeSubProcess("DoDeleteVfModule", businessKey, variables); - - // "changedelete" operation not required for deleting a Vf Module -// injectSDNCCallbacks(callbacks, "sdncChangeDelete"); - injectVNFRestCallbacks(callbacks, "vnfDeleteFail"); - waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000); -// injectSDNCCallbacks(callbacks, "sdncDelete"); - - waitForProcessEnd(businessKey, 10000); - WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString); - Assert.assertNotNull(wfe); - if (wfe != null) { - System.out.println("TestDoDeleteVfModuleVNFCallbackFailure: ErrorCode=" + wfe.getErrorCode() + - ", ErrorMessage=" + wfe.getErrorMessage()); - Assert.assertTrue(wfe.getErrorCode() == 7020); - Assert.assertTrue(wfe.getErrorMessage().startsWith("Received vfModuleException from VnfAdapter")); - } - logEnd(); - } - - // start of mocks used locally and by other VF Module unit tests - public static void MockAAIVfModulePUT(boolean isCreate){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*")) - .withRequestBody(containing("MMSC")) - .willReturn(aResponse() - .withStatus(isCreate ? 201 : 200))); - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*")) - .withRequestBody(containing("PCRF")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile("aaiFault.xml"))); - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721")) - .willReturn(aResponse() - .withStatus(200))); - } - - public static void MockDoDeleteVfModule_SDNCSuccess() { - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing("SvcAction>changedelete")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml"))); - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing("SvcAction>delete")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml"))); - } - - public static void MockDoDeleteVfModule_SDNCFailure() { - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing("SvcAction>changedelete")) - .willReturn(aResponse() - .withStatus(500))); - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing("SvcAction>delete")) - .willReturn(aResponse() - .withStatus(500))); - } - - public static void MockDoDeleteVfModule_DeleteVNFSuccess() { - stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - } - - public static void MockDoDeleteVfModule_DeleteVNFFailure() { - stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "application/xml"))); - } -} - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java deleted file mode 100644 index 165debe7f1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java +++ /dev/null @@ -1,198 +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.bpmn.infrastructure; - -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteVolumeGroupById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockPutVNFVolumeGroup; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVfModuleDelete; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.core.WorkflowException; -import org.openecomp.mso.bpmn.mock.FileUtil; - -public class DoDeleteVfModuleVolumeV2Test extends WorkflowTest { - - private final CallbackSet callbacks = new CallbackSet(); - - public DoDeleteVfModuleVolumeV2Test() throws IOException { - callbacks.put("volumeGroupDelete", FileUtil.readResourceFile( - "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml")); - } - - @Test - //@Ignore - @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"}) - public void happyPath() throws Exception { - - logStart(); - - MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml"); - MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml"); - MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200); - mockPutVNFVolumeGroup("78987", 202); - mockVfModuleDelete("78987"); - MockDeleteVolumeGroupById("AAIAIC25", "78987", "0000020", 200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - MockGetVolumeGroupById("AAIAIC25", "78987", "VfModularity/VolumeGroup.xml"); - String businessKey = UUID.randomUUID().toString(); - - Map testVariables = new HashMap<>(); - testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123"); - testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123"); - testVariables.put("isDebugLogEnabled", "true"); - //testVariables.put("lcpCloudRegionId", "MDTWNJ21"); - //testVariables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421"); - testVariables.put("volumeGroupId", "78987"); - testVariables.put("serviceInstanceId", "test-service-instance-id-0123"); - - String cloudConfiguration = "{" + - "\"lcpCloudRegionId\": \"MDTWNJ21\"," + - "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}"; - testVariables.put("cloudConfiguration", cloudConfiguration); - - invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables); - - injectVNFRestCallbacks(callbacks, "volumeGroupDelete"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "wasDeleted", "true"); - - logEnd(); - } - - - @Test - //@Ignore - @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"}) - public void testVolumeGroupInUse() throws Exception { - - logStart(); - MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml"); - MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml"); - MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200); - mockVfModuleDelete("78987"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - String businessKey = UUID.randomUUID().toString(); - - Map testVariables = new HashMap<>(); - testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123"); - testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123"); - testVariables.put("isDebugLogEnabled", "true"); - testVariables.put("volumeGroupId", "78987"); - testVariables.put("serviceInstanceId", "test-service-instance-id-0123"); - - String cloudConfiguration = "{" + - "\"lcpCloudRegionId\": \"MDTWNJ21\"," + - "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}"; - testVariables.put("cloudConfiguration", cloudConfiguration); - - invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "wasDeleted", "false"); - WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage()); - - - logEnd(); - } - - @Test - //@Ignore - @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"}) - public void testTenantIdMismatch() throws Exception { - - logStart(); - MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml"); - MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml"); - MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200); - mockVfModuleDelete("78987", 404); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - String businessKey = UUID.randomUUID().toString(); - - Map testVariables = new HashMap<>(); - testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123"); - testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123"); - testVariables.put("isDebugLogEnabled", "true"); - testVariables.put("volumeGroupId", "78987"); - testVariables.put("serviceInstanceId", "test-service-instance-id-0123"); - - String cloudConfiguration = "{" + - "\"lcpCloudRegionId\": \"MDTWNJ21\"," + - "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421xxx\"" + "}"; - testVariables.put("cloudConfiguration", cloudConfiguration); - - invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "wasDeleted", "false"); - WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage()); - - - logEnd(); - } - - @Test - //@Ignore - @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"}) - public void testVnfAdapterCallfail() throws Exception { - - logStart(); - MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml"); - MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml"); - MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200); - mockVfModuleDelete("78987", 404); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - String businessKey = UUID.randomUUID().toString(); - - Map testVariables = new HashMap<>(); - testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123"); - testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123"); - testVariables.put("isDebugLogEnabled", "true"); - testVariables.put("volumeGroupId", "78987"); - testVariables.put("serviceInstanceId", "test-service-instance-id-0123"); - - String cloudConfiguration = "{" + - "\"lcpCloudRegionId\": \"MDTWNJ21\"," + - "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}"; - testVariables.put("cloudConfiguration", cloudConfiguration); - - invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "wasDeleted", "false"); - WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage()); - - logEnd(); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java deleted file mode 100644 index c53beb1446..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java +++ /dev/null @@ -1,352 +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.bpmn.infrastructure; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIDeleteGenericVnf; -import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIDeleteVfModule; -import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIGenericVnfSearch; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.mock.FileUtil; -import org.openecomp.mso.bpmn.core.domain.ModelInfo; -import org.openecomp.mso.bpmn.core.domain.ModuleResource; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.bpmn.core.domain.VnfResource; - -public class DoDeleteVnfAndModulesTest extends WorkflowTest { - private final CallbackSet callbacks = new CallbackSet(); - private static final String EOL = "\n"; - private final String vnfAdapterDeleteCallback = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " true" + EOL + - " {{MESSAGE-ID}}" + EOL + - "" + EOL; - private final String sdncAdapterDeleteCallback = - "" + EOL + - " {{REQUEST-ID}}" + EOL + - " Y" + EOL + - "" + EOL; - - public DoDeleteVnfAndModulesTest () throws IOException { - callbacks.put("deactivate", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("unassign", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("vnfDelete", vnfAdapterDeleteCallback); - callbacks.put("sdncDelete", sdncAdapterDeleteCallback); - - } - - @Test - @Deployment(resources = {"subprocess/DoDeleteVnfAndModules.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn", "subprocess/DoDeleteVfModule.bpmn"}) - public void testDoDeleteVnfAndModules_successVnfOnly() throws Exception{ - MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml"); - MockDeleteGenericVnf("testVnfId123", "testReVer123"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - mockSDNCAdapter(200); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesVnfOnly(variables); - invokeSubProcess("DoDeleteVnfAndModules", businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnfAndModules", "WorkflowException"); - - assertEquals(null, workflowException); - } - - - private void setVariablesVnfOnly(Map variables) { - variables.put("mso-request-id", "testRequestId123"); - variables.put("isDebugLogEnabled", "true"); - variables.put("vnfId","testVnfId123"); - variables.put("serviceInstanceId", "MIS%2F1604%2F0026%2FSW_INTERNET"); - //variables.put("vnfName", "testVnfName123"); - variables.put("disableRollback", "true"); - variables.put("msoRequestId", "testVnfId123"); - variables.put("testVnfId","testVnfId123"); - //variables.put("vnfType", "STMTN"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - String vnfModelInfo = "{ "+ "\"modelType\": \"vnf\"," + - "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"vSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + - "}"; - //variables.put("vnfModelInfo", vnfModelInfo); - - variables.put("lcpCloudRegionId", "mdt1"); - variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e"); - - String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," + - "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"ServicevSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "}"; - //variables.put("serviceModelInfo", serviceModelInfo); - variables.put("globalSubscriberId", "MSO-1610"); - variables.put("sdncVersion", "1707"); - - } - - @Test - @Deployment(resources = {"subprocess/DoDeleteVnfAndModules.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn", "subprocess/DoDeleteVfModuleFromVnf.bpmn", "subprocess/VnfAdapterRestV1.bpmn", "subprocess/DeleteAAIVfModule.bpmn"}) - public void testDoDeleteVnfAndModules_successVnfAndModules() throws Exception{ - MockAAIGenericVnfSearch(); - MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml"); - MockDeleteGenericVnf("testVnfId123", "testReVer123"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - mockSDNCAdapter(200); - MockDoDeleteVfModule_SDNCSuccess(); - MockDoDeleteVfModule_DeleteVNFSuccess(); - MockAAIDeleteVfModule(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesVnfAndModules(variables); - invokeSubProcess("DoDeleteVnfAndModules", businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "deactivate"); - injectVNFRestCallbacks(callbacks, "vnfDelete"); - injectSDNCCallbacks(callbacks, "unassign"); - MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml"); - injectSDNCCallbacks(callbacks, "unassign"); - //MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnfAndModules", "WorkflowException"); - - assertEquals(null, workflowException); - } - - - private void setVariablesVnfAndModules(Map variables) { - variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("isDebugLogEnabled", "true"); - variables.put("vnfId","a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - - variables.put("msoRequestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - //variables.put("testVnfId","testVnfId123"); - - variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); - variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421"); - - variables.put("sdncVersion", "1707"); - - - ServiceDecomposition sd = new ServiceDecomposition(); - ModelInfo serviceModel = new ModelInfo(); - serviceModel.setModelName("servicewithVNFs"); - sd.setModelInfo(serviceModel); - VnfResource vr = new VnfResource(); - ModelInfo mvr = new ModelInfo(); - mvr.setModelName("vSAMP12"); - mvr.setModelInstanceName("v123"); - mvr.setModelInvariantUuid(""); - mvr.setModelVersion("1.0"); - mvr.setModelCustomizationUuid("MODEL-ID-1234"); - vr.setModelInfo(mvr); - vr.constructVnfType("vnf1"); - vr.setNfType("somenftype"); - vr.setNfRole("somenfrole"); - vr.setNfFunction("somenffunction"); - vr.setNfNamingCode("somenamingcode"); - ModuleResource mr = new ModuleResource(); - ModelInfo mvmr = new ModelInfo(); - mvmr.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff"); - mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0"); - mvmr.setModelUuid("1.0"); - mvmr.setModelCustomizationUuid("MODEL-123"); - mr.setModelInfo(mvmr); - mr.setIsBase(true); - mr.setVfModuleLabel("MODULELABEL"); - vr.addVfModule(mr); - sd.addVnfResource(vr); - variables.put("serviceDecomposition", sd); - - } - - @Test - @Deployment(resources = {"subprocess/DoDeleteVnfAndModules.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn", "subprocess/DoDeleteVfModule.bpmn", "subprocess/UpdateAAIVfModule.bpmn", "subprocess/PrepareUpdateAAIVfModule.bpmn", "subprocess/DoDeleteVfModuleFromVnf.bpmn", "subprocess/VnfAdapterRestV1.bpmn", "subprocess/DeleteAAIVfModule.bpmn"}) - public void testDoDeleteVnfAndModulesDirectDelete_successVnfAndModules() throws Exception{ - MockDoDeleteVfModule_SDNCSuccess(); - MockDoDeleteVfModule_DeleteVNFSuccess(); - mockSDNCAdapter(200); - MockAAIGenericVnfSearch(); - MockAAIVfModulePUT(false); - MockAAIDeleteGenericVnf(); - MockAAIDeleteVfModule(); - MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesVnfAndModulesDirectDelete(variables); - invokeSubProcess("DoDeleteVnfAndModules", businessKey, variables); - - injectVNFRestCallbacks(callbacks, "vnfDelete"); - injectSDNCCallbacks(callbacks, "sdncDelete"); - MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnfAndModules", "WorkflowException"); - - // WorkflowException is expected here, since empty VNF cannot be simulated here - assertNotEquals(null, workflowException); - } - - - private void setVariablesVnfAndModulesDirectDelete(Map variables) { - variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("isDebugLogEnabled", "true"); - variables.put("vnfId","a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - - variables.put("msoRequestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - //variables.put("testVnfId","testVnfId123"); - - variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); - variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421"); - - variables.put("sdncVersion", "1702"); - - - ServiceDecomposition sd = new ServiceDecomposition(); - ModelInfo serviceModel = new ModelInfo(); - serviceModel.setModelName("servicewithVNFs"); - sd.setModelInfo(serviceModel); - VnfResource vr = new VnfResource(); - ModelInfo mvr = new ModelInfo(); - mvr.setModelName("vSAMP12"); - mvr.setModelInstanceName("v123"); - mvr.setModelInvariantUuid(""); - mvr.setModelVersion("1.0"); - mvr.setModelCustomizationUuid("MODEL-ID-1234"); - vr.setModelInfo(mvr); - vr.constructVnfType("vnf1"); - vr.setNfType("somenftype"); - vr.setNfRole("somenfrole"); - vr.setNfFunction("somenffunction"); - vr.setNfNamingCode("somenamingcode"); - ModuleResource mr = new ModuleResource(); - ModelInfo mvmr = new ModelInfo(); - mvmr.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff"); - mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0"); - mvmr.setModelUuid("1.0"); - mvmr.setModelCustomizationUuid("MODEL-123"); - mr.setModelInfo(mvmr); - mr.setIsBase(true); - mr.setVfModuleLabel("MODULELABEL"); - vr.addVfModule(mr); - sd.addVnfResource(vr); - variables.put("serviceDecomposition", sd); - - } - - public static void MockAAIVfModulePUT(boolean isCreate){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*")) - .withRequestBody(containing("MMSC")) - .willReturn(aResponse() - .withStatus(isCreate ? 201 : 200))); - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*")) - .withRequestBody(containing("PCRF")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile("aaiFault.xml"))); - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721")) - .willReturn(aResponse() - .withStatus(200))); - } - - - - - public static void MockDoDeleteVfModule_SDNCSuccess() { - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing("SvcAction>deactivate")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml"))); - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing("SvcAction>unassign")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml"))); - } - - - public static void MockDoDeleteVfModule_DeleteVNFSuccess() { - stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java deleted file mode 100644 index 8caa9f22a2..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.common.WorkflowTest; - -/** - * Please describe the DeleteVnfInfra.java class - * - */ -public class DoDeleteVnfTest extends WorkflowTest { - - - @Test - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"}) - public void testDoDeleteVnf_success() throws Exception{ - - MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfByNameResponse.xml"); - MockDeleteGenericVnf("testVnfId123", "testReVer123"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables(variables); - invokeSubProcess("DoDeleteVnf", businessKey, variables); - // Disabled until SDNC support is there -// injectSDNCCallbacks(callbacks, "assign"); -// injectSDNCCallbacks(callbacks, "activate"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; - String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException"); - - assertEquals("true", found); - assertEquals("false", inUse); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"}) - public void testDeleteVnfInfra_success_vnfNotFound() throws Exception{ - - MockDeleteGenericVnf("testVnfId123", "testReVer123", 404); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("DoDeleteVnf", businessKey, variables); - // Disabled until SDNC support is there -// injectSDNCCallbacks(callbacks, "assign"); -// injectSDNCCallbacks(callbacks, "activate"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; - String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException"); - - assertEquals("false", found); - assertEquals("false", inUse); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"}) - public void testDeleteVnfInfra_error_vnfInUse() throws Exception{ - - MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfResponse_hasRelationships.xml"); - MockDeleteGenericVnf("testVnfId123", "testReVer123"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("DoDeleteVnf", businessKey, variables); -// Disabled until SDNC support is there -// injectSDNCCallbacks(callbacks, "assign"); -// injectSDNCCallbacks(callbacks, "activate"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - - String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; - String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException"); - String exWfex = "WorkflowException[processKey=DoDeleteVnf,errorCode=5000,errorMessage=Can't Delete Generic Vnf. Generic Vnf is still in use.]"; - - assertEquals("true", found); - assertEquals("true", inUse); - assertEquals(exWfex, workflowException); - } - - private void setVariables(Map variables) { - variables.put("mso-request-id", "123"); - variables.put("isDebugLogEnabled", "true"); - variables.put("vnfId","testVnfId123"); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java deleted file mode 100644 index a955c4eb86..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java +++ /dev/null @@ -1,257 +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.bpmn.infrastructure; - - - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVfModuleIdNoResponse; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit tests for DoUpdateVfModule.bpmn. - */ -public class DoUpdateVfModuleTest extends WorkflowTest { - - private final CallbackSet callbacks = new CallbackSet(); - - public DoUpdateVfModuleTest() throws IOException { - callbacks.put("changeassign", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml")); - callbacks.put("query", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyQueryCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("vnfUpdate", FileUtil.readResourceFile( - "__files/VfModularity/VNFAdapterRestUpdateCallback.xml")); - } - - /** - * Test the happy path through the flow. - */ - @Test - @Ignore - @Deployment(resources = { - "subprocess/DoUpdateVfModule.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/UpdateAAIVfModule.bpmn" - }) - public void happyPath() throws IOException { - - logStart(); - - String doUpdateVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/DoUpdateVfModuleRequest.xml"); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockGetVfModuleIdNoResponse("skask", "PCRF", "supercool"); - MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool"); - MockGetVolumeGroupById("MDTWNJ21", "78987", "VfModularity/VolumeGroup.xml"); - mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockVNFPut("skask", "/supercool", 202); - MockPutGenericVnf("skask"); - MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1); - //Catalog DB - MockGetServiceResourcesCatalogData("aa5256d2-5a33-55df-13ab-12abad84e7ff","InfrastructureFlows/DoCreateServiceInstance_request.json"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "DEV-VF-0011"); - variables.put("isDebugLogEnabled","true"); - variables.put("DoUpdateVfModuleRequest", doUpdateVfModuleRequest); - invokeSubProcess("DoUpdateVfModule", businessKey, variables); - - injectSDNCCallbacks(callbacks, "changeassign, query"); - injectVNFRestCallbacks(callbacks, "vnfUpdate"); - injectSDNCCallbacks(callbacks, "activate"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - checkVariable(businessKey, "DoUpdateVfModuleSuccessIndicator", true); - - String heatStackId = (String) getVariableFromHistory(businessKey, "DOUPVfMod_heatStackId"); - System.out.println("Heat stack Id from AAI: " + heatStackId); - - logEnd(); - } - - /** - * Test the happy path through the flow with Building Blocks interface. - */ - @Test - - @Deployment(resources = { - "subprocess/DoUpdateVfModule.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/UpdateAAIVfModule.bpmn" - }) - public void happyPathBB() throws IOException { - - logStart(); - - MockAAIVfModule(); - MockPatchGenericVnf("skask"); - MockPatchVfModuleId("skask", ".*"); - MockSDNCAdapterVfModule(); - MockVNFAdapterRestVfModule(); - //Catalog DB - MockGetServiceResourcesCatalogData("aa5256d2-5a33-55df-13ab-12abad84e7ff","InfrastructureFlows/DoCreateServiceInstance_request.json"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - variables.put("mso-request-id", "DEV-VF-0011"); - variables.put("isDebugLogEnabled","true"); - variables.put("msoRequestId", "DEV-VF-0011"); - variables.put("isBaseVfModule", "false"); - variables.put("isDebugLogEnabled", "true"); - variables.put("disableRollback", "true"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", "skask"); - variables.put("vfModuleId", "supercool"); - variables.put("vnfType", "pcrf-capacity"); - variables.put("isVidRequest", "true"); - variables.put("volumeGroupId", "78987"); - variables.put("usePreload", true); - - variables.put("sdncVersion", "1702"); - - variables.put("lcpCloudRegionId", "MDTWNJ21"); - variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421"); - - String vfModuleModelInfo = "{ "+ "\"modelType\": \"vfModule\"," + - "\"modelInvariantUuid\": \"introvert\"," + - "\"modelUuid\": \"3.14\"," + - "\"modelName\": \"STMTN5MMSC21-MMSC::model-1-0\"," + - "\"modelVersion\": \"1\"," + - "\"modelCustomizationUuid\": \"MODEL-123\"" + "}"; - variables.put("vfModuleModelInfo", vfModuleModelInfo); - - String vnfModelInfo = "{ "+ "\"modelType\": \"vnf\"," + - "\"modelInvariantUuid\": \"introvert\"," + - "\"modelUuid\": \"3.14\"," + - "\"modelName\": \"VNF-STMTN5MMSC21-MMSC::model-1-0\"," + - "\"modelVersion\": \"1\"," + - "\"modelCustomizationUuid\": \"VNF-MODEL-123\"" + "}"; - variables.put("vnfModelInfo", vnfModelInfo); - - String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," + - "\"modelInvariantUuid\": \"aa5256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"bb6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"SVC-STMTN5MMSC21-MMSC::model-1-0\"," + - "\"modelVersion\": \"1\"," + - "}"; - variables.put("serviceModelInfo", serviceModelInfo); - - invokeSubProcess("DoUpdateVfModule", businessKey, variables); - - injectSDNCCallbacks(callbacks, "changeassign, query"); - injectVNFRestCallbacks(callbacks, "vnfUpdate"); - injectSDNCCallbacks(callbacks, "activate"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - checkVariable(businessKey, "DoUpdateVfModuleSuccessIndicator", true); - - String heatStackId = (String) getVariableFromHistory(businessKey, "DOUPVfMod_heatStackId"); - System.out.println("Heat stack Id from AAI: " + heatStackId); - - logEnd(); - } - - // start of mocks used locally and by other VF Module unit tests - public static void MockSDNCAdapterVfModule() { - // simplified the implementation to return "success" for all requests - stubFor(post(urlEqualTo("/SDNCAdapter")) -// .withRequestBody(containing("SvcInstanceId><")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml"))); -// stubFor(post(urlEqualTo("/SDNCAdapter")) -// .withRequestBody(containing("vnf-type>STMTN")) -// .willReturn(aResponse() -// .withStatus(200) -// .withHeader("Content-Type", "text/xml") -// .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml"))); -// stubFor(post(urlEqualTo("/SDNCAdapter")) -// .withRequestBody(containing("SvcAction>query")) -// .willReturn(aResponse() -// .withStatus(200) -// .withHeader("Content-Type", "text/xml") -// .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml"))); - } - - public static void MockVNFAdapterRestVfModule() { - stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - } -} - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java deleted file mode 100644 index 2a5a646fb2..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java +++ /dev/null @@ -1,226 +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.bpmn.infrastructure; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSDNCAdapterVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.core.domain.ModelInfo; -import org.openecomp.mso.bpmn.core.domain.ModuleResource; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.bpmn.core.domain.VnfResource; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit Test for the DoUpdateVnfAndModules Flow - * - */ -public class DoUpdateVnfAndModulesTest extends WorkflowTest { - - private final CallbackSet callbacks = new CallbackSet(); - - public DoUpdateVnfAndModulesTest() throws IOException { - - callbacks.put("changeassign", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("query", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyQueryCallback.xml")); - callbacks.put("vnfUpdate", FileUtil.readResourceFile( - "__files/VfModularity/VNFAdapterRestUpdateCallback.xml")); - } - - @Test - - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/DoUpdateVfModule.bpmn", - "subprocess/DoUpdateVnfAndModules.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn"}) - public void testDoUpdateVnfAndModules_success() throws Exception{ - - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - //MockGetGenericVnfById_404("testVnfId"); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockPutGenericVnf(".*"); - MockAAIVfModule(); - MockPatchGenericVnf("skask"); - MockPatchVfModuleId("skask", ".*"); - mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml"); - mockVNFPut("skask", "/supercool", 202); - mockVNFPut("skask", "/lukewarm", 202); - MockVNFAdapterRestVfModule(); - MockDBUpdateVfModule(); - - mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - invokeSubProcess("DoUpdateVnfAndModules", businessKey, variables); - - injectSDNCCallbacks(callbacks, "changeassign, query"); - injectVNFRestCallbacks(callbacks, "vnfUpdate"); - injectSDNCCallbacks(callbacks, "activate"); - injectSDNCCallbacks(callbacks, "changeassign, query"); - injectVNFRestCallbacks(callbacks, "vnfUpdate"); - injectSDNCCallbacks(callbacks, "activate"); - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - assertVariables("2", "200", null); - - } - - - - private void assertVariables(String exModuleCount, String exVnfFound, String exWorkflowException) { - - String moduleCount = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "DUVAM_moduleCount"); - String vnfFound = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "DUVAM_queryAAIVfModuleResponseCode"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "SavedWorkflowException1"); - - assertEquals(exModuleCount, moduleCount); - assertEquals(exVnfFound, vnfFound); - assertEquals(exWorkflowException, workflowException); - } - - private void setVariables(Map variables, String request, String requestId, String siId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("bpmnRequest", request); - variables.put("msoRequestUdid", requestId); - variables.put("serviceInstanceId",siId); - variables.put("testVnfId","testVnfId123"); - variables.put("vnfType", "STMTN"); - - } - - private void setVariablesSuccess(Map variables, String request, String requestId, String siId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("requestId", requestId); - variables.put("msoRequestId", requestId); - variables.put("serviceInstanceId",siId); - variables.put("disableRollback", "true"); - //variables.put("testVnfId","testVnfId123"); - variables.put("vnfType", "STMTN"); - variables.put("vnfId", "skask"); - variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421"); - variables.put("lcpCloudRegionId", "mdt1"); - - String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," + - "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"ServicevSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "}"; - variables.put("serviceModelInfo", serviceModelInfo); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," + - "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"vSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}"; - variables.put("vnfModelInfo", vnfModelInfo); - - String cloudConfiguration = "{" + "\"cloudConfiguration\": { " + - "\"lcpCloudRegionId\": \"mdt1\"," + - "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}"; - variables.put("cloudConfiguration", cloudConfiguration); - variables.put("sdncVersion", "1702"); - variables.put("globalSubscriberId", "subscriber123"); - variables.put("asdcServiceModelVersion", "serviceVersion01"); - - try { - VnfResource vr = new VnfResource(); - ModelInfo mvr = new ModelInfo(); - mvr.setModelName("vSAMP12"); - mvr.setModelInstanceName("v123"); - mvr.setModelInvariantUuid("extrovert"); - mvr.setModelVersion("1.0"); - mvr.setModelCustomizationUuid("MODEL-ID-1234"); - vr.setModelInfo(mvr); - vr.constructVnfType("vnf1"); - vr.setNfType("somenftype"); - vr.setNfRole("somenfrole"); - vr.setNfFunction("somenffunction"); - vr.setNfNamingCode("somenamingcode"); - ModuleResource mr = new ModuleResource(); - ModelInfo mvmr = new ModelInfo(); - mvmr.setModelInvariantUuid("introvert"); - mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0"); - mvmr.setModelVersion("1"); - mvmr.setModelCustomizationUuid("MODEL-123"); - mr.setModelInfo(mvmr); - mr.setIsBase(true); - mr.setVfModuleLabel("MODULELABEL"); - vr.addVfModule(mr); - ModuleResource mr1 = new ModuleResource(); - ModelInfo mvmr1 = new ModelInfo(); - mvmr1.setModelInvariantUuid("extrovert"); - mvmr1.setModelName("SECONDMODELNAME"); - mvmr1.setModelVersion("1"); - mvmr1.setModelCustomizationUuid("MODEL-123"); - mr1.setModelInfo(mvmr1); - mr1.setIsBase(false); - mr1.setVfModuleLabel("MODULELABEL1"); - vr.addVfModule(mr1); - variables.put("vnfResourceDecomposition", vr); - variables.put("isTest", true); - } catch(Exception e) { - - } - - } - - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java deleted file mode 100644 index 4161431297..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java +++ /dev/null @@ -1,264 +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.bpmn.infrastructure; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIDeleteVfModule; -import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIGenericVnfSearch; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetDefaultCloudRegionByCloudRegionId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetPserverByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfsByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSetInMaintFlagByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponsePolicy.MockPolicyAbort; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut; -import static org.openecomp.mso.bpmn.mock.StubResponsePolicy.MockPolicySkip; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit test cases for UpdateVnfInfra.bpmn - */ -public class ReplaceVnfInfraTest extends WorkflowTest { - - private final CallbackSet callbacks = new CallbackSet(); - private static final String EOL = "\n"; - private final String vnfAdapterDeleteCallback = - "" + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + - " true" + EOL + - " {{MESSAGE-ID}}" + EOL + - "" + EOL; - - public ReplaceVnfInfraTest() throws IOException { - callbacks.put("deactivate", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("unassign", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("vnfDelete", vnfAdapterDeleteCallback); - callbacks.put("changeassign", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("query", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyQueryCallback.xml")); - callbacks.put("vnfUpdate", FileUtil.readResourceFile( - "__files/VfModularity/VNFAdapterRestUpdateCallback.xml")); - } - - /** - * Sunny day scenario. - * - * @throws Exception - */ - @Test - @Ignore // 1802 merge - @Deployment(resources = { - "process/ReplaceVnfInfra.bpmn", - "subprocess/RollbackVnf.bpmn", - "subprocess/DoDeleteVfModule.bpmn", - "subprocess/DoDeleteVnfAndModules.bpmn", - "subprocess/DeleteAAIVfModule.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/DoDeleteVnfAndModules.bpmn", - "subprocess/GenericDeleteVnf.bpmn", - "subprocess/DoDeleteVnf.bpmn", - "subprocess/DoDeleteVfModule.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/GenericPutVnf.bpmn", - "subprocess/DoCreateVnf.bpmn", - "subprocess/GenerateVfModuleName.bpmn", - "subprocess/DoCreateVfModule.bpmn", - "subprocess/DoCreateVnfAndModules.bpmn", - "subprocess/ConfirmVolumeGroupName.bpmn", - "subprocess/CreateAAIVfModule.bpmn", - "subprocess/CreateAAIVfModuleVolumeGroup.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateVnfAndModulesRollback.bpmn", - "subprocess/BuildingBlock/DecomposeService.bpmn", - "subprocess/BuildingBlock/RainyDayHandler.bpmn", - "subprocess/BuildingBlock/ManualHandling.bpmn", - "subprocess/BuildingBlock/AppCClient.bpmn" - - }) - public void sunnyDay() throws Exception { - - logStart(); - MockAAIGenericVnfSearch(); - MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml"); - MockDeleteGenericVnf("testVnfId123", "testReVer123"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - mockSDNCAdapter(200); - MockDoDeleteVfModule_SDNCSuccess(); - MockDoDeleteVfModule_DeleteVNFSuccess(); - MockAAIDeleteVfModule(); - - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - //MockGetGenericVnfById_404("testVnfId"); - MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "1.0", "VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json"); - MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json"); - //MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - //MockPutGenericVnf(".*"); - MockGetDefaultCloudRegionByCloudRegionId("mdt1", "AAI/AAI_defaultCloudRegionByCloudRegionId.json", 200); - MockAAIVfModule(); - MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721"); - MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", ".*"); - mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml"); - mockVNFPut("skask", "/supercool", 202); - mockVNFPut("skask", "/lukewarm", 202); - MockVNFAdapterRestVfModule(); - MockDBUpdateVfModule(); - MockGetPserverByVnfId("skask", "AAI/AAI_pserverByVnfId.json", 200); - MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200); - MockSetInMaintFlagByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200); - MockPolicySkip(); - - //mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml"); - //mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - String updaetVnfRequest = - FileUtil.readResourceFile("__files/InfrastructureFlows/ReplaceVnf_VID_request.json"); - - Map variables = setupVariablesSunnyDayVID(); - - - TestAsyncResponse asyncResponse = invokeAsyncProcess("ReplaceVnfInfra", - "v1", businessKey, updaetVnfRequest, variables); - - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - //injectSDNCCallbacks(callbacks, "deactivate"); - //injectSDNCCallbacks(callbacks, "deactivate"); - injectVNFRestCallbacks(callbacks, "vnfDelete"); - //injectSDNCCallbacks(callbacks, "unassign"); - MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml"); - injectSDNCCallbacks(callbacks, "unassign"); - - - injectSDNCCallbacks(callbacks, "changeassign, query"); - injectVNFRestCallbacks(callbacks, "vnfUpdate"); - injectSDNCCallbacks(callbacks, "activate"); - injectSDNCCallbacks(callbacks, "changeassign, query"); - injectVNFRestCallbacks(callbacks, "vnfUpdate"); - injectSDNCCallbacks(callbacks, "activate"); - - // TODO add appropriate assertions - - waitForProcessEnd(businessKey, 10000); - checkVariable(businessKey, "ReplaceVfModuleInfraSuccessIndicator", true); - - logEnd(); - } - - // Active Scenario - private Map setupVariablesSunnyDayVID() { - Map variables = new HashMap<>(); - //try { - // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json")); - //} - //catch (Exception e) { - - //} - //variables.put("mso-request-id", "testRequestId"); - variables.put("requestId", "testRequestId"); - variables.put("isDebugLogEnabled", "true"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); - variables.put("vnfType", "vSAMP12"); - variables.put("serviceType", "MOG"); - - return variables; - - } - - public static void MockDoDeleteVfModule_SDNCSuccess() { - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing("SvcAction>deactivate")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml"))); - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing("SvcAction>unassign")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml"))); - } - - - public static void MockDoDeleteVfModule_DeleteVNFSuccess() { - stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", "application/xml"))); - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/RollbackVnfTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/RollbackVnfTest.java deleted file mode 100644 index 598e783c52..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/RollbackVnfTest.java +++ /dev/null @@ -1,134 +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.bpmn.infrastructure; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetPserverByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfsByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSetInMaintFlagByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponsePolicy.MockPolicySkip; -import static org.openecomp.mso.bpmn.mock.StubResponseAPPC.MockAppcError; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.mock.FileUtil; -import org.openecomp.mso.client.aai.AAIObjectType; -import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri; -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; - -/** - * Unit test cases for RollbackVnf.bpmn - */ -public class RollbackVnfTest extends WorkflowTest { - - public RollbackVnfTest() throws IOException { - - } - - /** - * Sunny day scenario. - * - * @throws Exception - */ - @Test - - - @Deployment(resources = { - "subprocess/RollbackVnf.bpmn", - "subprocess/BuildingBlock/AppCClient.bpmn" - - }) - public void sunnyDay() throws Exception { - - //logStart(); - System.setProperty("mso.config.path", "src/test/resources"); - AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "skask"); - wireMockRule.stubFor(get( - urlPathEqualTo("/aai/v11" + path.build())) - .willReturn( - aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile("AAI/mockObject.json") - .withStatus(200))); - - - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml"); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockAAIVfModule(); - MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200); - MockSetInMaintFlagByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200); - MockAppcError(); - - String businessKey = UUID.randomUUID().toString(); - Map variables = setupVariablesSunnyDayVID(); - - invokeSubProcess("RollbackVnf", businessKey, variables); - - // TODO add appropriate assertions - - waitForProcessEnd(businessKey, 10000); - Assert.assertTrue(isProcessEnded(businessKey)); - // assertVariables("true", "true", "false", "true", "Success", null); - - //logEnd(); - } - - // Active Scenario - private Map setupVariablesSunnyDayVID() { - Map variables = new HashMap(); - - variables.put("msoRequestId", "testRequestId"); - variables.put("isDebugLogEnabled", "true"); - variables.put("vnfId", "skask"); - variables.put("rollbackVnfStop", true); - variables.put("rollbackVnfLock", true); - variables.put("rollbackQuiesceTraffic", false); - variables.put("rollbackSetClosedLoopDisabledFlag", true); - variables.put("rollbackSetVnfInMaintenanceFlag", true); - variables.put("errorCode", "1005"); - - return variables; - - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/SetupServiceDecompTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/SetupServiceDecompTest.java deleted file mode 100644 index 264bf6e2be..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/SetupServiceDecompTest.java +++ /dev/null @@ -1,65 +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.bpmn.infrastructure; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.mock.FileUtil; - -public class SetupServiceDecompTest extends WorkflowTest { - - private String input = FileUtil.readResourceFile("__files/CreateServiceInstance/SetupServiceDecompJson.json"); - - public SetupServiceDecompTest() throws IOException { - } - - @Test - @Deployment(resources = { - "subprocess/CreateServiceInstanceV3.bpmn", - "subprocess/CreateServiceInstanceV3Rollback.bpmn", - "subprocess/SetRefactorServiceDecomp.bpmn" - }) - public void sunnyDay() throws Exception { - - logStart(); - - String businessKey = UUID.randomUUID().toString(); - - Map variables = new HashMap(); - setupVariables(variables); - invokeSubProcess("SetRefactorServiceDecomp", businessKey, variables); - waitForProcessEnd(businessKey, 10000); - logEnd(); - } - - // Success Scenario - private void setupVariables(Map variables) { - variables.put("bpmnRequest", input); - variables.put("msoRequestId", "RaaDSITestRequestId-1"); - variables.put("isDebugLogEnabled", "true"); - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java deleted file mode 100644 index 8f16ed3b1e..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java +++ /dev/null @@ -1,168 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 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.bpmn.infrastructure; - -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.mock.StubResponseAAI; - -public class StubResponseAAITest extends WorkflowTest{ - - @Test - public void testStubResponseAAIforNullAndDefaultInputs() - { - try{ - StubResponseAAI.MockPutTunnelXConnect(null, null, null, null, null); - StubResponseAAI.MockGetAllottedResource(null, null, null, null, null); - StubResponseAAI.MockPutAllottedResource(null, null, null, null); - StubResponseAAI.MockPutAllottedResource_500(null, null, null, null); - StubResponseAAI.MockDeleteAllottedResource(null, null, null, null, null); - StubResponseAAI.MockPatchAllottedResource(null, null, null, null); - StubResponseAAI.MockQueryAllottedResourceById(null, null); - StubResponseAAI.MockGetServiceInstance(null, null, null, null); - StubResponseAAI.MockGetServiceInstance_404(null, null, null); - StubResponseAAI.MockGetServiceInstance_500(null, null, null); - StubResponseAAI.MockGetServiceInstance_500(null, null, null, null); - StubResponseAAI.MockNodeQueryServiceInstanceByName(null, null); - StubResponseAAI.MockNodeQueryServiceInstanceByName_404(null); - StubResponseAAI.MockNodeQueryServiceInstanceByName_500(null); - StubResponseAAI.MockNodeQueryServiceInstanceById(null, null); - StubResponseAAI.MockNodeQueryServiceInstanceById_404(null); - StubResponseAAI.MockNodeQueryServiceInstanceById_500(null); - StubResponseAAI.MockDeleteServiceInstance(null, null, null, null); - StubResponseAAI.MockGetServiceInstance(null, null, null, null, 0); - StubResponseAAI.MockGetServiceInstance(null, null, null, 0); - StubResponseAAI.MockDeleteServiceInstance(null, null, null, null, 0); - StubResponseAAI.MockDeleteServiceInstance(null, null, null, 0); - StubResponseAAI.MockDeleteServiceInstance_404(null, null, null, null); - StubResponseAAI.MockDeleteServiceInstance_500(null, null, null, null); - StubResponseAAI.MockPutServiceInstance(null, null, null, null); - StubResponseAAI.MockPutServiceInstance_500(null, null, null); - StubResponseAAI.MockGetServiceSubscription(null, null, null); - StubResponseAAI.MockDeleteServiceSubscription(null, null, 0); - StubResponseAAI.MockDeleteServiceInstanceId(null, null, null); - StubResponseAAI.MockPutServiceSubscription(null, null); - StubResponseAAI.MockGetServiceSubscription(null, null, 0); - StubResponseAAI.MockGetCustomer(null, null); - StubResponseAAI.MockDeleteCustomer(null); - StubResponseAAI.MockPutCustomer(null); - StubResponseAAI.MockPutCustomer_500(null); - StubResponseAAI.MockGetGenericVnfById(null, null); - StubResponseAAI.MockGetGenericVnfById(null, null, 0); - StubResponseAAI.MockGetGenericVnfByIdWithPriority(null, 0, null); - StubResponseAAI.MockGetGenericVnfByIdWithPriority(null, null, 0, null, 0); - StubResponseAAI.MockGetGenericVnfByIdWithDepth(null, 0, null); - StubResponseAAI.MockGetGenericVnfById_404(null); - StubResponseAAI.MockGetGenericVnfById_500(null); - StubResponseAAI.MockGetGenericVnfByName(null, null); - StubResponseAAI.MockGetGenericVnfByNameWithDepth(null, 0, null); - StubResponseAAI.MockGetGenericVnfByName_404(null); - StubResponseAAI.MockDeleteGenericVnf(null, null); - StubResponseAAI.MockDeleteGenericVnf(null, null, 0); - StubResponseAAI.MockDeleteGenericVnf_500(null, null); - StubResponseAAI.MockPutGenericVnf(null); - StubResponseAAI.MockPutGenericVnf(null, null, 0); - StubResponseAAI.MockPutGenericVnf(null, 0); - StubResponseAAI.MockPutGenericVnf_Bad(null, 0); - StubResponseAAI.MockPatchGenericVnf(null); - StubResponseAAI.MockGetVceById(null, null); - StubResponseAAI.MockGetVceByName(null, null); - StubResponseAAI.MockDeleteVce(null, null, 0); - StubResponseAAI.MockPutVce(null); - StubResponseAAI.MockGetGenericVceByNameWithDepth(null, 0, null); - StubResponseAAI.MockGetVceGenericQuery(null, 0, 0, null); - StubResponseAAI.MockGetTenantGenericQuery(null, null, null); - StubResponseAAI.MockGetTenant(null, null); - StubResponseAAI.MockGetNetwork(null, null, 0); - StubResponseAAI.MockGetNetworkByIdWithDepth(null, null, null); - StubResponseAAI.MockGetNetworkCloudRegion(null, null); - StubResponseAAI.MockGetNetworkByName(null, null); - StubResponseAAI.MockGetNetworkByName_404(null, null); - StubResponseAAI.MockGetNetworkCloudRegion_404(null); - StubResponseAAI.MockPutNetwork(null, 0, null); - StubResponseAAI.MockPutNetwork(null, null, 0); - StubResponseAAI.MockGetNetworkName(null, null, 0); - StubResponseAAI.MockGetNetworkVpnBinding(null, null); - StubResponseAAI.MockGetNetworkPolicy(null, null); - StubResponseAAI.MockGetNetworkVpnBinding(null, null, 0); - StubResponseAAI.MockGetNetworkPolicy(null, null, 0); - StubResponseAAI.MockGetNetworkTableReference(null, null); - StubResponseAAI.MockPutNetworkIdWithDepth(null, null, null); - StubResponseAAI.MockGetNetworkPolicyfqdn(null, null, 0); - StubResponseAAI.MockGetNetworkRouteTable(null, null, 0); - StubResponseAAI.MockPatchVfModuleId(null, null); - StubResponseAAI.MockVNFAdapterRestVfModule(); - StubResponseAAI.MockDBUpdateVfModule(); - StubResponseAAI.MockSDNCAdapterVfModule(); - StubResponseAAI.MockAAIVfModule(); - StubResponseAAI.MockGetCloudRegion(null, 0, null); - StubResponseAAI.MockGetVolumeGroupById(null, null, null); - StubResponseAAI.MockPutVolumeGroupById(null, null, null, 0); - StubResponseAAI.MockGetVolumeGroupByName(null, null, null, 0); - StubResponseAAI.MockDeleteVolumeGroupById(null, null, null, 0); - StubResponseAAI.MockGetVolumeGroupByName_404(null, null); - StubResponseAAI.MockDeleteVolumeGroup(null, null, null); - StubResponseAAI.MockGetVfModuleId(null, null, null, 0); - StubResponseAAI.MockGetVfModuleByNameWithDepth(null, null, 0, null, 0); - StubResponseAAI.MockGetVfModuleIdNoResponse(null, null, null); - StubResponseAAI.MockPutVfModuleIdNoResponse(null, null, null); - StubResponseAAI.MockPutVfModuleId(null, null); - StubResponseAAI.MockPutVfModuleId(null, null, 0); - StubResponseAAI.MockDeleteVfModuleId(null, null, null, 0); - StubResponseAAI.MockAAIVfModuleBadPatch(null, 0); - StubResponseAAI.MockGetPserverByVnfId(null, null, 0); - StubResponseAAI.MockGetGenericVnfsByVnfId(null, null, 0); - StubResponseAAI.MockSetInMaintFlagByVnfId(null, 0); - StubResponseAAI.MockGetVceById(); - StubResponseAAI.MockGetVceByName(); - StubResponseAAI.MockPutVce(); - StubResponseAAI.MockDeleteVce(); - StubResponseAAI.MockDeleteVce_404(); - StubResponseAAI.MockDeleteServiceSubscription(); - StubResponseAAI.MockGetServiceSubscription(); - StubResponseAAI.MockGetServiceSubscription_200Empty(); - StubResponseAAI.MockGetServiceSubscription_404(); - StubResponseAAI.MockGENPSIPutServiceInstance(); - StubResponseAAI.MockGENPSIPutServiceSubscription(); - StubResponseAAI.MockGENPSIPutServiceInstance_get500(); - StubResponseAAI.MockGetGenericVnfById(); - StubResponseAAI.MockGetGenericVnfById_404(); - StubResponseAAI.MockGetGenericVnfByName(); - StubResponseAAI.MockGetGenericVnfByName_hasRelationships(); - StubResponseAAI.MockGetGenericVnfById_hasRelationships(); - StubResponseAAI.MockGetGenericVnfById_500(); - StubResponseAAI.MockGetGenericVnfByName_404(); - StubResponseAAI.MockPutGenericVnf(); - StubResponseAAI.MockPutGenericVnf_400(); - StubResponseAAI.MockDeleteGenericVnf(); - StubResponseAAI.MockDeleteGenericVnf_404(); - StubResponseAAI.MockDeleteGenericVnf_500(); - StubResponseAAI.MockDeleteGenericVnf_412(); - } - catch(Exception ex) - { - - System.err.println(ex); - } - - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java deleted file mode 100644 index 80a4518599..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java +++ /dev/null @@ -1,489 +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.bpmn.infrastructure; - -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.*; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseNetworkAdapter.MockNetworkAdapterRestPut; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapterTopology; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeAsyncWorkflow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.getVariable; -import static org.junit.Assert.assertEquals; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; - -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.WorkflowTestTransformer; -import org.openecomp.mso.bpmn.common.SDNCAdapterCallbackRule; -import org.openecomp.mso.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer; - -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; - -/** - * Unit test cases for DoUpdateNetworkInstance.bpmn - * - */ -public class UpdateNetworkInstanceTest extends WorkflowTest { - @WorkflowTestTransformer - public static final ResponseTransformer sdncAdapterMockTransformer = - new SDNCAdapterNetworkTopologyMockTransformer(); - - @Rule - public final SDNCAdapterCallbackRule sdncAdapterCallbackRule = - new SDNCAdapterCallbackRule(processEngineRule); - - /** - * End-to-End flow - Unit test for DoUpdateNetworkInstance.bpmn - * - String input & String response - */ - - @Test - @Ignore // 1802 merge - @Deployment(resources = {"process/UpdateNetworkInstance.bpmn", - "subprocess/DoUpdateNetworkInstance.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceUpdateNetworkInstance_SuccessVID1() throws Exception { - - System.out.println("----------------------------------------------------------"); - System.out.println(" Success1 - UpdateNetworkInstance flow Started! "); - System.out.println("----------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); - MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); - MockPutNetworkIdWithDepth("UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); - - Map variables = setupVariablesVID1(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - System.out.println("----------------------------------------------------------"); - System.out.println("- got workflow response -"); - System.out.println("----------------------------------------------------------"); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertEquals("true", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success")); - Assert.assertNotNull("UPDNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest")); - - String workflowResp = BPMNUtil.getVariable(processEngineRule, "UpdateNetworkInstance", "WorkflowResponse"); - Assert.assertNotNull(workflowResp); - - System.out.println("----------------------------------------------------------"); - System.out.println(" Success1 - UpdateNetworkInstance flow Completed "); - System.out.println("----------------------------------------------------------"); - - } - - @Test - @Ignore // 1802 merge - @Deployment(resources = {"process/UpdateNetworkInstance.bpmn", - "subprocess/DoUpdateNetworkInstance.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceUpdateNetworkInstance_SuccessVIPER1() throws Exception { - - System.out.println("----------------------------------------------------------"); - System.out.println(" Success2 - UpdateNetworkInstance flow Started! "); - System.out.println("----------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); - MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); - MockPutNetworkIdWithDepth("UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); - - Map variables = setupVariablesVIPER1(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertEquals("true", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success")); - Assert.assertNotNull("UPDNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest")); - - String completeMsoProcessRequest = - "" + '\n' - + " " + '\n' - + " testRequestId" + '\n' - + " UPDATE" + '\n' - + " VID" + '\n' - + " " + '\n' - + " Network has been updated successfully." + '\n' - + " BPMN Network action: UPDATE" + '\n' - + ""; - - Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest")); - - System.out.println("----------------------------------------------------------"); - System.out.println(" Success2 - UpdateNetworkInstance flow Completed "); - System.out.println("----------------------------------------------------------"); - - } - - - @Test - //@Ignore - @Deployment(resources = {"process/UpdateNetworkInstance.bpmn", - "subprocess/DoUpdateNetworkInstance.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceUpdateNetworkInstance_MissingNetworkId() throws Exception { - - System.out.println("--------------------------------------------------------------------"); - System.out.println(" Missing networkId - UpdateNetworkInstance flow Started! "); - System.out.println("--------------------------------------------------------------------"); - - // setup simulators - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); - - Map variables = setupVariablesMissingNetworkId(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success")); - Assert.assertNotNull("UPDNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest")); - - String falloutHandlerActual = getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest"); - String falloutHandlerExpected = -"" + "\n" + -" " + "\n" + -" 88f65519-9a38-4c4b-8445-9eb4a5a5af56" + "\n" + -" UPDATE" + "\n" + -" VID" + "\n" + -" " + "\n" + -" " + "\n" + -" Variable 'network-id' value/element is missing." + "\n" + -" 7000" + "\n" + -" " + "\n" + -" "; - - assertEquals("Response", falloutHandlerExpected, falloutHandlerActual); - - System.out.println("------------------------------------------------------------------"); - System.out.println(" Missing networkId - UpdateNetworkInstance flow Completed "); - System.out.println("------------------------------------------------------------------"); - - } - - - @Test - //@Ignore - @Deployment(resources = {"process/UpdateNetworkInstance.bpmn", - "subprocess/DoUpdateNetworkInstance.bpmn", - "subprocess/DoUpdateNetworkInstanceRollback.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceUpdateNetworkInstance_Network_SDNC_Rollback() throws Exception { - - System.out.println("---------------------------------------------------------------"); - System.out.println(" Network and SDNC Rollback - UpdateNetworkInstance flow Started! "); - System.out.println("---------------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); - mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>rollback"); - MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); - - Map variables = setupVariablesVID1(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success")); - Assert.assertNotNull("UPDNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest")); - - System.out.println("---------------------------------------------------------------------"); - System.out.println(" Network and SCNC Rollback - UpdateNetworkInstance flow Completed "); - System.out.println("---------------------------------------------------------------------"); - - } - - // ***************** - // Utility Section - // ***************** - - String networkModelInfo = - " {\"modelUuid\": \"mod-inst-uuid-123\", " + '\n' + - " \"modelName\": \"mod_inst_z_123\", " + '\n' + - " \"modelVersion\": \"1.0\", " + '\n' + - " \"modelCustomizationUuid\": \"mod-inst-uuid-123\", " + '\n' + - " \"modelInvariantUuid\": \"mod-invar-uuid-123\" " + '\n' + - " }"; - - String serviceModelInfo = - " {\"modelUuid\": \"36a3a8ea-49a6-4ac8-b06c-89a54544b9b6\", " + '\n' + - " \"modelName\": \"HNGW Protected OAM\", " + '\n' + - " \"modelVersion\": \"1.0\", " + '\n' + - " \"modelInvariantUuid\": \"fcc85cb0-ad74-45d7-a5a1-17c8744fdb71\" " + '\n' + - " }"; - - // Success Scenario - private Map setupVariablesVID1() { - Map variables = new HashMap<>(); - variables.put("bpmnRequest", getCreateNetworkRequest1()); - variables.put("mso-request-id", "testRequestId"); - variables.put("requestId", "testRequestId"); - variables.put("isBaseVfModule", "true"); - variables.put("recipeTimeout", "0"); - variables.put("requestAction", "UPDATE"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", ""); - variables.put("vfModuleId", ""); - variables.put("volumeGroupId", ""); - variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); - variables.put("serviceType", "vMOG"); - variables.put("vfModuleType", ""); - variables.put("networkType", "modelName"); - return variables; - - } - - public String getCreateNetworkRequest1() { - - String request = - "{ \"requestDetails\": { " + '\n' + - " \"modelInfo\": { " + '\n' + - " \"modelType\": \"modelType\", " + '\n' + - " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' + - " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + - " \"modelVersion\": \"1.0\" " + '\n' + - " }, " + '\n' + - " \"cloudConfiguration\": { " + '\n' + - " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + - " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + - " }, " + '\n' + - " \"requestInfo\": { " + '\n' + - " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_1\", " + '\n' + - " \"source\": \"VID\", " + '\n' + - " \"callbackUrl\": \"\", " + '\n' + - " \"suppressRollback\": \"false\" ," + '\n' + - " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + - " }, " + '\n' + - " \"requestParameters\": { " + '\n' + - " \"backoutOnFailure\": true, " + '\n' + - " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' + - " \"userParams\": [] " + '\n' + - " } " + '\n' + - " } " + '\n' + - "}"; - - return request; - } - - public String getCreateNetworkRequest2() { - - String request = - "{ \"requestDetails\": { " + '\n' + - " \"modelInfo\": { " + '\n' + - " \"modelType\": \"modelType\", " + '\n' + - " \"modelId\": \"modelId\", " + '\n' + - " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' + - " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + - " \"modelVersion\": \"1\" " + '\n' + - " }, " + '\n' + - " \"cloudConfiguration\": { " + '\n' + - " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + - " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + - " }, " + '\n' + - " \"requestInfo\": { " + '\n' + - " \"instanceName\": \"myOwn_Network\", " + '\n' + - " \"source\": \"VID\", " + '\n' + - " \"callbackUrl\": \"\", " + '\n' + - " \"suppressRollback\": \"true\" ," + '\n' + - " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + - " }, " + '\n' + - " \"requestParameters\": { " + '\n' + - " \"backoutOnFailure\": true, " + '\n' + - " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' + - " \"userParams\": [] " + '\n' + - " } " + '\n' + - " } " + '\n' + - "}"; - - return request; - - } - - // Success Scenario - private Map setupVariablesVIPER1() { - Map variables = new HashMap<>(); - variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); - variables.put("msoRequestId", "testRequestId"); - variables.put("requestId", "testRequestId"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); - variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_1"); - variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); - variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("disableRollback", "false"); // macro - variables.put("failIfExists", "false"); - //variables.put("sdncVersion", "1702"); - variables.put("sdncVersion", "1707"); - variables.put("subscriptionServiceType", "MSO-dev-service-type"); - variables.put("globalSubscriberId", "globalId_45678905678"); - variables.put("networkModelInfo", networkModelInfo); - variables.put("serviceModelInfo", serviceModelInfo); - return variables; - - } - - // Missing Name Scenario - private Map setupVariablesMissingNetworkId() { - Map variables = new HashMap<>(); - variables.put("mso-request-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); - variables.put("bpmnRequest", getCreateNetworkRequestNetworkId()); - variables.put("requestId", "testRequestId"); - variables.put("isBaseVfModule", "true"); - variables.put("recipeTimeout", "0"); - variables.put("requestAction", "UPDATE"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", ""); - variables.put("vfModuleId", ""); - variables.put("volumeGroupId", ""); - //variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); // missing, ok - variables.put("serviceType", "vMOG"); - variables.put("vfModuleType", ""); - variables.put("networkType", "modelName"); - - return variables; - - } - - public String getCreateNetworkRequestNetworkId() { - - String request = - "{ \"requestDetails\": { " + '\n' + - " \"modelInfo\": { " + '\n' + - " \"modelType\": \"modelType\", " + '\n' + - " \"modelId\": \"modelId\", " + '\n' + - " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' + - " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + - " \"modelVersion\": \"1\" " + '\n' + - " }, " + '\n' + - " \"cloudConfiguration\": { " + '\n' + - " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + - " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + - " }, " + '\n' + - " \"requestInfo\": { " + '\n' + - " \"source\": \"VID\", " + '\n' + - " \"callbackUrl\": \"\", " + '\n' + - " \"suppressRollback\": \"true\" ," + '\n' + - " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + - " }, " + '\n' + - " \"requestParameters\": { " + '\n' + - " \"userParams\": [] " + '\n' + - " } " + '\n' + - " } " + '\n' + - "}"; - - return request; - - } - - public String getCreateNetworkRequestSDNCRollback() { - - String request = - "{ \"requestDetails\": { " + '\n' + - " \"modelInfo\": { " + '\n' + - " \"modelType\": \"modelType\", " + '\n' + - " \"modelId\": \"modelId\", " + '\n' + - " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' + - " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + - " \"modelVersion\": \"1\" " + '\n' + - " }, " + '\n' + - " \"cloudConfiguration\": { " + '\n' + - " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + - " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + - " }, " + '\n' + - " \"requestInfo\": { " + '\n' + - " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_3\", " + '\n' + - " \"source\": \"VID\", " + '\n' + - " \"callbackUrl\": \"\", " + '\n' + - " \"suppressRollback\": \"true\" ," + '\n' + - " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + - " }, " + '\n' + - " \"requestParameters\": { " + '\n' + - " \"userParams\": [] " + '\n' + - " } " + '\n' + - " } " + '\n' + - "}"; - - - return request; - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java deleted file mode 100644 index 63cf62d17d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.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.bpmn.infrastructure; - -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit test cases for UpdateVfModule.bpmn - */ -public class UpdateVfModuleInfraTest extends WorkflowTest { - - private final CallbackSet callbacks = new CallbackSet(); - - public UpdateVfModuleInfraTest() throws IOException { - callbacks.put("changeassign", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml")); - callbacks.put("query", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyQueryCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("vnfUpdate", FileUtil.readResourceFile( - "__files/VfModularity/VNFAdapterRestUpdateCallback.xml")); - } - - /** - * Sunny day scenario. - * - * @throws Exception - */ - @Test - @Ignore - @Deployment(resources = { - "process/UpdateVfModuleInfra.bpmn", - "subprocess/DoUpdateVfModule.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/FalloutHandler.bpmn" - }) - public void sunnyDay() throws Exception { - - logStart(); - - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool"); - MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1); - mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockVNFPut("skask", "/supercool", 202); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - String updaetVfModuleRequest = - FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVfModule_VID_request.json"); - - Map variables = setupVariablesSunnyDayVID(); - - - TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleInfra", - "v1", businessKey, updaetVfModuleRequest, variables); - - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - injectSDNCCallbacks(callbacks, "changeassign, query"); - injectVNFRestCallbacks(callbacks, "vnfUpdate"); - injectSDNCCallbacks(callbacks, "activate"); - - // TODO add appropriate assertions - - waitForProcessEnd(businessKey, 10000); - checkVariable(businessKey, "UpdateVfModuleInfraSuccessIndicator", true); - - logEnd(); - } - - // Active Scenario - private Map setupVariablesSunnyDayVID() { - Map variables = new HashMap<>(); - //try { - // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json")); - //} - //catch (Exception e) { - - //} - //variables.put("mso-request-id", "testRequestId"); - variables.put("requestId", "testRequestId"); - variables.put("isBaseVfModule", false); - variables.put("isDebugLogEnabled", "true"); - variables.put("recipeTimeout", "0"); - variables.put("requestAction", "UPDATE_VF_MODULE"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", "skask"); - variables.put("vnfType", "vSAMP12"); - variables.put("vfModuleId", "supercool"); - variables.put("volumeGroupId", ""); - variables.put("serviceType", "MOG"); - variables.put("vfModuleType", ""); - return variables; - - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.java deleted file mode 100644 index 65a514c804..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.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.bpmn.infrastructure; - -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.WorkflowTest.CallbackSet; -import org.openecomp.mso.bpmn.common.WorkflowTest.TestAsyncResponse; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit test cases for UpdateVfModuleV2.bpmn - */ -public class UpdateVfModuleInfraV2Test extends WorkflowTest { - - private final CallbackSet callbacks = new CallbackSet(); - - public UpdateVfModuleInfraV2Test() throws IOException { - /*callbacks.put("changeassign", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml")); - callbacks.put("query", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyQueryCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("vnfUpdate", FileUtil.readResourceFile( - "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));*/ - } - - @Test - @Ignore // IGNORED FOR 1710 MERGE TO ONAP - @Deployment(resources = { - "process/UpdateVfModuleInfraV2.bpmn", - "subprocess/DoUpdateVfModule.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - }) - - public void sunnyDay() throws Exception { - //logStart(); - - - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool"); - MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1); - mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockVNFPut("skask", "/supercool", 202); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = setupVariablesSunnyDayVID(); - - String updateVfModuleRequest = - FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVfModule_VID_request.json"); - TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleInfraV2", - "v1", businessKey, updateVfModuleRequest, variables); - - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - - //String responseBody = response.getResponse(); - //System.out.println("Workflow (Synch) Response:\n" + responseBody); - - //logEnd(); - } - - // Active Scenario - private Map setupVariablesSunnyDayVID() { - Map variables = new HashMap<>(); - variables.put("requestId", "testRequestId"); - variables.put("isBaseVfModule", false); - variables.put("isDebugLogEnabled", "true"); - variables.put("recipeTimeout", "0"); - variables.put("requestAction", "UPDATE_VF_MODULE"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", "skask"); - variables.put("vnfType", "vSAMP12"); - variables.put("vfModuleId", "supercool"); - variables.put("volumeGroupId", ""); - variables.put("serviceType", "MOG"); - variables.put("vfModuleType", ""); - variables.put("moduleUuid", "fe6985cd-ea33-3346-ac12-ab121484a3fe"); - return variables; - - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java deleted file mode 100644 index 91327b087e..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java +++ /dev/null @@ -1,143 +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.bpmn.infrastructure; - -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockPutVNFVolumeGroup; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit test cases for UpdateVfModuleVolume.bpmn - */ -public class UpdateVfModuleVolumeInfraV1Test extends WorkflowTest { - - private final CallbackSet callbacks = new CallbackSet(); - - public UpdateVfModuleVolumeInfraV1Test() throws IOException { - callbacks.put("volumeGroupUpdate", FileUtil.readResourceFile( - "__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml")); - } - - /** - * Happy path scenario. - * - * @throws Exception - */ - @Test - @Deployment(resources = { - "process/UpdateVfModuleVolumeInfraV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericNotificationService.bpmn", - "subprocess/FalloutHandler.bpmn" - }) - public void happyPath() throws Exception { - - logStart(); - - MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200); - MockGetVolumeGroupById("mdt1", "78987", "UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml"); - MockGetVfModuleId("9e48f6ea-f786-46de-800a-d480e5ccc846", "6a1dc898-b590-47b9-bbf0-34424a7a2ec3/", "UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml", 200); - mockPutVNFVolumeGroup("78987", 202); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - String updaetVfModuleVolRequest = - FileUtil.readResourceFile("__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json"); - - Map testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("serviceInstanceId", "test-service-instance-id"); - testVariables.put("volumeGroupId", "78987"); - testVariables.put("vnfId", "TEST-VNF-ID-0123"); - TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleVolumeInfraV1", "v1", businessKey, updaetVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - injectVNFRestCallbacks(callbacks, "volumeGroupUpdate"); - - waitForProcessEnd(businessKey, 10000); - checkVariable(businessKey, "UpdateVfModuleVolumeSuccessIndicator", true); - - logEnd(); - } - - /** - * VF Module Personal model id does not match request model invariant id - * @throws Exception - */ - @Test - //@Ignore - @Deployment(resources = { - "process/UpdateVfModuleVolumeInfraV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericNotificationService.bpmn", - "subprocess/FalloutHandler.bpmn" - }) - public void testPersonaModelIdNotMatch() throws Exception { - - logStart(); - - MockGetVolumeGroupById("mdt1", "78987", "UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml"); - MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200); - MockGetVfModuleId("9e48f6ea-f786-46de-800a-d480e5ccc846", "6a1dc898-b590-47b9-bbf0-34424a7a2ec3/", "UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml", 200); - mockPutVNFVolumeGroup("78987", 202); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - String updaetVfModuleVolRequest = - FileUtil.readResourceFile("__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json"); - - Map testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("serviceInstanceId", "test-service-instance-id"); - testVariables.put("volumeGroupId", "78987"); - testVariables.put("vnfId", "TEST-VNF-ID-0123"); - TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleVolumeInfraV1", "v1", businessKey, updaetVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - injectVNFRestCallbacks(callbacks, "volumeGroupUpdate"); - - waitForProcessEnd(businessKey, 10000); - checkVariable(businessKey, "UpdateVfModuleVolumeSuccessIndicator", true); - - logEnd(); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java deleted file mode 100644 index 5ab1a04809..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java +++ /dev/null @@ -1,173 +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.bpmn.infrastructure; - -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetDefaultCloudRegionByCloudRegionId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetPserverByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfsByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSetInMaintFlagByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut; -import static org.openecomp.mso.bpmn.mock.StubResponsePolicy.MockPolicySkip; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.mock.FileUtil; - -/** - * Unit test cases for UpdateVnfInfra.bpmn - */ -public class UpdateVnfInfraTest extends WorkflowTest { - - private final CallbackSet callbacks = new CallbackSet(); - - public UpdateVnfInfraTest() throws IOException { - callbacks.put("changeassign", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("query", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyQueryCallback.xml")); - callbacks.put("vnfUpdate", FileUtil.readResourceFile( - "__files/VfModularity/VNFAdapterRestUpdateCallback.xml")); - } - - /** - * Sunny day scenario. - * - * @throws Exception - */ - @Test - @Ignore // 1802 merge - @Deployment(resources = { - "process/UpdateVnfInfra.bpmn", - "subprocess/RollbackVnf.bpmn", - "subprocess/DoUpdateVfModule.bpmn", - "subprocess/DoUpdateVnfAndModules.bpmn", - "subprocess/PrepareUpdateAAIVfModule.bpmn", - "subprocess/ConfirmVolumeGroupTenant.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/VnfAdapterRestV1.bpmn", - "subprocess/UpdateAAIGenericVnf.bpmn", - "subprocess/UpdateAAIVfModule.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/BuildingBlock/DecomposeService.bpmn", - "subprocess/BuildingBlock/RainyDayHandler.bpmn", - "subprocess/BuildingBlock/ManualHandling.bpmn", - "subprocess/BuildingBlock/AppCClient.bpmn" - - }) - public void sunnyDay() throws Exception { - - logStart(); - - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - //MockGetGenericVnfById_404("testVnfId"); - MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "1.0", "VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json"); - MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json"); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockGetDefaultCloudRegionByCloudRegionId("mdt1", "AAI/AAI_defaultCloudRegionByCloudRegionId.json", 200); - MockPutGenericVnf(".*"); - MockAAIVfModule(); - MockPatchGenericVnf("skask"); - MockPatchVfModuleId("skask", ".*"); - mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml"); - mockVNFPut("skask", "/supercool", 202); - mockVNFPut("skask", "/lukewarm", 202); - MockVNFAdapterRestVfModule(); - MockDBUpdateVfModule(); - MockGetPserverByVnfId("skask", "AAI/AAI_pserverByVnfId.json", 200); - MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200); - MockSetInMaintFlagByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200); - MockPolicySkip(); - - mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - String updaetVnfRequest = - FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVnf_VID_request.json"); - - Map variables = setupVariablesSunnyDayVID(); - - - TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVnfInfra", - "v1", businessKey, updaetVnfRequest, variables); - - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - injectSDNCCallbacks(callbacks, "changeassign, query"); - injectVNFRestCallbacks(callbacks, "vnfUpdate"); - injectSDNCCallbacks(callbacks, "activate"); - injectSDNCCallbacks(callbacks, "changeassign, query"); - injectVNFRestCallbacks(callbacks, "vnfUpdate"); - injectSDNCCallbacks(callbacks, "activate"); - - // TODO add appropriate assertions - - waitForProcessEnd(businessKey, 10000); - checkVariable(businessKey, "UpdateVfModuleInfraSuccessIndicator", true); - - logEnd(); - } - - // Active Scenario - private Map setupVariablesSunnyDayVID() { - Map variables = new HashMap<>(); - - variables.put("requestId", "testRequestId"); - variables.put("isDebugLogEnabled", "true"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", "skask"); - variables.put("vnfType", "vSAMP12"); - variables.put("serviceType", "MOG"); - - return variables; - - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfConfigUpdateTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfConfigUpdateTest.java deleted file mode 100644 index aca60026dc..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfConfigUpdateTest.java +++ /dev/null @@ -1,146 +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.bpmn.infrastructure; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetPserverByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfsByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSetInMaintFlagByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponsePolicy.MockPolicySkip; -import static org.openecomp.mso.bpmn.mock.StubResponseAPPC.MockAppcError; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.mock.FileUtil; -import org.openecomp.mso.client.aai.AAIObjectType; -import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri; -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; - -/** - * Unit test cases for VnfConfigUpdate.bpmn - */ -public class VnfConfigUpdateTest extends WorkflowTest { - - public VnfConfigUpdateTest() throws IOException { - - } - - /** - * Sunny day scenario. - * - * @throws Exception - */ - @Test - @Ignore // 1802 merge - @Deployment(resources = { - "process/VnfConfigUpdate.bpmn", - "subprocess/RollbackVnf.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/BuildingBlock/RainyDayHandler.bpmn", - "subprocess/BuildingBlock/ManualHandling.bpmn", - "subprocess/BuildingBlock/AppCClient.bpmn" - - }) - public void sunnyDay() throws Exception { - - logStart(); - - System.setProperty("mso.config.path", "src/test/resources"); - AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "comx9906v"); - wireMockRule.stubFor(get( - urlPathEqualTo("/aai/v11" + path.build())) - .willReturn( - aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile("AAI/mockObject.json") - .withStatus(200))); - - - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - //MockGetGenericVnfById_404("testVnfId"); - MockGetGenericVnfByIdWithDepth("comx9906v", 1, "AAI/AAI_genericVnfsByVnfIdVnfConfig.json"); - MockAAIVfModule(); - MockDBUpdateVfModule(); - MockGetPserverByVnfId("comx9906v", "AAI/AAI_pserverByVnfId.json", 200); - MockGetGenericVnfsByVnfId("comx9906v", "AAI/AAI_genericVnfsByVnfIdVnfConfig.json", 200); - MockSetInMaintFlagByVnfId("comx9906v", "AAI/AAI_genericVnfsByVnfIdVnfConfig.json", 200); - MockPolicySkip(); - MockAppcError(); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - String updaetVnfRequest = - FileUtil.readResourceFile("__files/InfrastructureFlows/ConfigVnf_VID_request.json"); - - Map variables = setupVariablesSunnyDayVID(); - - - TestAsyncResponse asyncResponse = invokeAsyncProcess("VnfConfigUpdate", - "v1", businessKey, updaetVnfRequest, variables); - - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - // TODO add appropriate assertions - - waitForProcessEnd(businessKey, 1000000); - checkVariable(businessKey, "VnfConfigUpdateSuccessIndicator", true); - - logEnd(); - } - - // Active Scenario - private Map setupVariablesSunnyDayVID() { - Map variables = new HashMap(); - - variables.put("requestId", "testRequestId"); - variables.put("isDebugLogEnabled", "true"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", "comx9906v"); - variables.put("vnfType", "vSAMP12"); - variables.put("serviceType", "MOG"); - - return variables; - - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfInPlaceUpdateTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfInPlaceUpdateTest.java deleted file mode 100644 index 7d8a7e1856..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfInPlaceUpdateTest.java +++ /dev/null @@ -1,159 +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.bpmn.infrastructure; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetPserverByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfsByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSetInMaintFlagByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetDefaultCloudRegionByCloudRegionId; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponsePolicy.MockPolicySkip; -import static org.openecomp.mso.bpmn.mock.StubResponseAPPC.MockAppcError; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -import org.openecomp.mso.bpmn.mock.FileUtil; -import org.openecomp.mso.client.aai.AAIObjectType; -import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri; -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; - -/** - * Unit test cases for VnfInPlaceUpdate.bpmn - */ -public class VnfInPlaceUpdateTest extends WorkflowTest { - - public VnfInPlaceUpdateTest() throws IOException { - - } - - /** - * Sunny day scenario. - * - * @throws Exception - */ - @Test - - - @Deployment(resources = { - "process/VnfInPlaceUpdate.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/BuildingBlock/RainyDayHandler.bpmn", - "subprocess/BuildingBlock/ManualHandling.bpmn", - "subprocess/BuildingBlock/AppCClient.bpmn" - - }) - public void sunnyDay() throws Exception { - - logStart(); - System.setProperty("mso.config.path", "src/test/resources"); - AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "skask"); - wireMockRule.stubFor(get( - urlPathEqualTo("/aai/v11" + path.build())) - .willReturn( - aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile("AAI/mockObject.json") - .withStatus(200))); - - // - - //AAIResourceUri path1 = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY).queryParam("format", "RESOURCE"); - //wireMockRule.stubFor(put( - // urlMatching("/aai/v10/query/pservers-fromVnf")) - // .willReturn( - // aResponse() - // .withHeader("Content-Type", "application/json") - // .withBodyFile("AAI/AAI_pserversByVnfId.json") - // .withStatus(200))); - - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - //MockGetGenericVnfById_404("testVnfId"); - MockGetGenericVnfByIdWithDepth("skask", 1, "AAI/AAI_genericVnfsByVnfId.json"); - MockAAIVfModule(); - MockDBUpdateVfModule(); - MockGetPserverByVnfId("skask", "AAI/AAI_pserverByVnfId.json", 200); - MockSetInMaintFlagByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200); - MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200); - MockGetDefaultCloudRegionByCloudRegionId("mdt1", "AAI/AAI_defaultCloudRegionByCloudRegionId.json", 200); - MockPolicySkip(); - MockAppcError(); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - String updaetVnfRequest = - FileUtil.readResourceFile("__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json"); - - Map variables = setupVariablesSunnyDayVID(); - - - TestAsyncResponse asyncResponse = invokeAsyncProcess("VnfInPlaceUpdate", - "v1", businessKey, updaetVnfRequest, variables); - - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000); - - String responseBody = response.getContent(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - // TODO add appropriate assertions - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "VnfInPlaceUpdateSuccessIndicator", true); - - logEnd(); - } - - // Active Scenario - private Map setupVariablesSunnyDayVID() { - Map variables = new HashMap(); - - variables.put("requestId", "testRequestId"); - variables.put("isDebugLogEnabled", "true"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", "skask"); - - return variables; - - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstanceTest.java deleted file mode 100644 index b9f339921d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstanceTest.java +++ /dev/null @@ -1,114 +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.bpmn.infrastructure.aai; - -import org.junit.Test; - - -public class AAIServiceInstanceTest { - - AAIServiceInstance test = new AAIServiceInstance("serviceInstanceName","serviceType","serviceRole","orchestrationStatus","modelInvariantUuid","modelVersionId","environmentContext","workloadContext"); - - @Test - public void getServiceInstanceNameTest() throws Exception { - test.getServiceInstanceName(); - } - - @Test - public void setServiceInstanceNameTest() throws Exception { - test.setServiceInstanceName("serviceInstanceName"); - } - - @Test - public void getServiceTypeTest() throws Exception { - test.getServiceType(); - } - - @Test - public void setServiceTypeTest() throws Exception { - test.setServiceType("serviceType"); - } - - - @Test - public void getServiceRoleTest() throws Exception { - test.getServiceRole(); - } - - @Test - public void setServiceRoleTest() throws Exception { - test.setServiceRole("serviceRole"); - } - - @Test - public void getOrchestrationStatusTest() throws Exception { - test.getOrchestrationStatus(); - } - - @Test - public void setOrchestrationStatusTest() throws Exception { - test.setOrchestrationStatus("status"); - } - - @Test - public void getModelInvariantUuidTest() throws Exception { - test.getModelInvariantUuid(); - } - - @Test - public void setModelInvariantUuidTest() throws Exception { - test.setModelInvariantUuid("uuid"); - } - - @Test - public void getModelVersionIdTest() throws Exception { - test.getModelVersionId(); - } - - @Test - public void setModelVersionIdTest() throws Exception { - test.setModelVersionId("versionId"); - } - - @Test - public void getEnvironmentContextTest() throws Exception { - test.getEnvironmentContext(); - } - - @Test - public void setEnvironmentContextTest() throws Exception { - test.setEnvironmentContext("context"); - } - - @Test - public void getWorkloadContextTest() throws Exception { - test.getWorkloadContext(); - } - - @Test - public void setWorkloadContextTest() throws Exception { - test.setWorkloadContext("context"); - } - -} - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java deleted file mode 100644 index bffae8d892..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.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.bpmn.infrastructure.pnf.delegate; - -import java.io.IOException; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.onap.aai.domain.yang.Pnf; -import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiConnection; - -public class AaiConnectionTestImpl implements AaiConnection { - - public static final String ID_WITH_ENTRY_AND_IP = "idWithEntryAndIp"; - public static final String ID_WITH_IP_V6 = "idWithIpV6"; - public static final String ID_WITHOUT_ENTRY = "IdWithoutEntry"; - public static final String ID_WITH_ENTRY_NO_IP = "idWithEntryNoIp"; - public static final String DEFAULT_IP = "1.2.3.4"; - public static final String DEFAULT_IP_V6 = "2001:db8::ff00:42:8329"; - - private Map created = new HashMap<>(); - - @Override - public Optional getEntryFor(String correlationId) throws IOException { - if (Objects.equals(correlationId, ID_WITH_ENTRY_AND_IP)) { - Pnf pnf = new Pnf(); - pnf.setIpaddressV4Oam(DEFAULT_IP); - return Optional.of(pnf); - } else if (Objects.equals(correlationId, ID_WITH_IP_V6)) { - Pnf pnf = new Pnf(); - pnf.setIpaddressV6Oam(DEFAULT_IP_V6); - return Optional.of(pnf); - } else if (Objects.equals(correlationId, ID_WITH_ENTRY_NO_IP)) { - return Optional.of(new Pnf()); - } else { - return Optional.empty(); - } - } - - @Override - public void createEntry(String correlationId, Pnf entry) throws IOException { - created.put(correlationId, entry); - } - - public Map getCreated() { - return created; - } - - public void reset() { - created.clear(); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java deleted file mode 100644 index 9a8dd5df24..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.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.bpmn.infrastructure.pnf.delegate; - -import java.io.IOException; -import java.util.Optional; -import org.onap.aai.domain.yang.Pnf; -import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiConnection; - -public class AaiConnectionThrowingException implements AaiConnection { - - @Override - public Optional getEntryFor(String correlationId) throws IOException { - throw new IOException(); - } - - @Override - public void createEntry(String correlationId, Pnf entry) throws IOException { - throw new IOException(); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java deleted file mode 100644 index d27cf44342..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.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.bpmn.infrastructure.pnf.delegate; - -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.when; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = {CancelDmaapSubscription.class, DmaapClientTestImpl.class}) -public class CancelDmaapSubscriptionTest { - - @Autowired - public CancelDmaapSubscription delegate; - - @Autowired - private DmaapClientTestImpl dmaapClientTest; - - @Test - public void shouldCancelSubscription() throws Exception { - // given - DelegateExecution delegateExecution = mock(DelegateExecution.class); - when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId"); - when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey"); - dmaapClientTest.registerForUpdate("testCorrelationId", () -> {}); - // when - delegate.execute(delegateExecution); - // then - assertThat(dmaapClientTest.haveRegisteredConsumer()).isFalse(); - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java deleted file mode 100644 index 75a7450434..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.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.bpmn.infrastructure.pnf.delegate; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.Matchers.any; -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 static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY; -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP; -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP; -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_IP_V6; -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_IP; -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF; -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.junit.Test; -import org.junit.experimental.runners.Enclosed; -import org.junit.runner.RunWith; -import org.openecomp.mso.bpmn.core.WorkflowException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(Enclosed.class) -public class CheckAaiForCorrelationIdDelegateTest { - - @RunWith(SpringRunner.class) - @SpringBootTest(classes = {CheckAaiForCorrelationIdDelegate.class, AaiConnectionTestImpl.class}) - public static class ConnectionOkTests { - - @Autowired - private CheckAaiForCorrelationIdDelegate delegate; - - @Test - public void shouldThrowExceptionWhenCorrelationIdIsNotSet() throws Exception { - // given - DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(CORRELATION_ID)).thenReturn(null); - when(execution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue"); - // when, then - assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class); - verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class)); - } - - @Test - public void shouldSetCorrectVariablesWhenAaiDoesNotContainInfoAboutPnf() throws Exception { - // given - DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITHOUT_ENTRY); - // when - delegate.execute(execution); - // then - verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, false); - } - - @Test - public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf() throws Exception { - shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(ID_WITH_ENTRY_AND_IP); - } - - @Test - public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithIpV6() throws Exception { - shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(ID_WITH_IP_V6); - } - - private void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(String id) throws Exception { - // given - DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(CORRELATION_ID)).thenReturn(id); - // when - delegate.execute(execution); - // then - verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, true); - verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, true); - } - - @Test - public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithoutIp() throws Exception { - // given - DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP); - // when - delegate.execute(execution); - // then - verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, true); - verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, false); - } - } - - - @RunWith(SpringRunner.class) - @SpringBootTest(classes = {CheckAaiForCorrelationIdDelegate.class, AaiConnectionThrowingException.class}) - public static class NoConnectionTests { - - @Autowired - private CheckAaiForCorrelationIdDelegate delegate; - - @Test - public void shouldThrowExceptionWhenIoExceptionOnConnectionToAai() throws Exception { - // given - DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP); - when(execution.getVariable("testProcessKey")).thenReturn("testProcessKey"); - // when, then - assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class); - verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class)); - } - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java deleted file mode 100644 index bc70a09880..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java +++ /dev/null @@ -1,50 +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.bpmn.infrastructure.pnf.delegate; - -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.when; -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.junit.Test; -import org.onap.aai.domain.yang.Pnf; - -public class CreateAaiEntryWithPnfIdDelegateTest { - - @Test - public void shouldSetPnfIdAndPnfName() throws Exception { - // given - CreateAaiEntryWithPnfIdDelegate delegate = new CreateAaiEntryWithPnfIdDelegate(); - AaiConnectionTestImpl aaiConnection = new AaiConnectionTestImpl(); - delegate.setAaiConnection(aaiConnection); - DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(eq(CORRELATION_ID))).thenReturn("testCorrelationId"); - // when - delegate.execute(execution); - // then - Pnf createdEntry = aaiConnection.getCreated().get("testCorrelationId"); - assertThat(createdEntry.getPnfId()).isEqualTo("testCorrelationId"); - assertThat(createdEntry.getPnfName()).isEqualTo("testCorrelationId"); - assertThat(createdEntry.isInMaint()).isTrue(); - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java deleted file mode 100644 index 8d35f9f8e0..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.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.bpmn.infrastructure.pnf.delegate; - -import org.openecomp.mso.bpmn.infrastructure.pnf.dmaap.DmaapClient; -import java.util.Objects; - -public class DmaapClientTestImpl implements DmaapClient { - - private String correlationId; - private Runnable informConsumer; - - @Override - public void registerForUpdate(String correlationId, Runnable informConsumer) { - this.correlationId = correlationId; - this.informConsumer = informConsumer; - } - - @Override - public Runnable unregister(String correlationId) { - if (Objects.equals(this.correlationId, correlationId)) { - this.correlationId = null; - Runnable informConsumer = this.informConsumer; - this.informConsumer = null; - return informConsumer; - } - return null; - } - - public String getCorrelationId() { - return correlationId; - } - - public Runnable getInformConsumer() { - return informConsumer; - } - - public boolean haveRegisteredConsumer() { - return correlationId != null; - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java deleted file mode 100644 index 2bfae461be..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java +++ /dev/null @@ -1,94 +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.bpmn.infrastructure.pnf.delegate; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; - -import org.camunda.bpm.engine.ProcessEngineServices; -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InOrder; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = {InformDmaapClient.class, DmaapClientTestImpl.class}) -public class InformDmaapClientTest { - - @Autowired - private InformDmaapClient informDmaapClient; - - @Autowired - private DmaapClientTestImpl dmaapClientTest; - - private DelegateExecution delegateExecution; - - private MessageCorrelationBuilder messageCorrelationBuilder; - - @Test - public void shouldSendListenerToDmaapClient() throws Exception { - // given - mockDelegateExecution(); - // when - informDmaapClient.execute(delegateExecution); - // then - assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId"); - assertThat(dmaapClientTest.getInformConsumer()).isNotNull(); - verifyZeroInteractions(messageCorrelationBuilder); - } - - @Test - public void shouldSendListenerToDmaapClientAndSendMessageToCamunda() throws Exception { - // given - mockDelegateExecution(); - // when - informDmaapClient.execute(delegateExecution); - dmaapClientTest.getInformConsumer().run(); - // then - assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId"); - InOrder inOrder = inOrder(messageCorrelationBuilder); - inOrder.verify(messageCorrelationBuilder).processInstanceBusinessKey("testBusinessKey"); - inOrder.verify(messageCorrelationBuilder).correlateWithResult(); - } - - private void mockDelegateExecution() { - delegateExecution = mock(DelegateExecution.class); - when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId"); - when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey"); - ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class); - when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices); - RuntimeService runtimeService = mock(RuntimeService.class); - when(processEngineServices.getRuntimeService()).thenReturn(runtimeService); - messageCorrelationBuilder = mock(MessageCorrelationBuilder.class); - when(runtimeService.createMessageCorrelation(any())).thenReturn(messageCorrelationBuilder); - when(messageCorrelationBuilder.processInstanceBusinessKey(any())).thenReturn(messageCorrelationBuilder); - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java deleted file mode 100644 index 1799e7fcbc..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.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.bpmn.infrastructure.pnf.delegate; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -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 static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.junit.Before; -import org.junit.Test; - -public class PnfCheckInputsTest { - - private PnfCheckInputs delegate; - - @Before - public void setUp() throws Exception { - delegate = new PnfCheckInputs(); - } - - private DelegateExecution mockDelegateExecution() { - DelegateExecution delegateExecution = mock(DelegateExecution.class); - when(delegateExecution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue"); - return delegateExecution; - } - - @Test - public void shouldThrowException_whenPnfIdNotSet() throws Exception { - // given - DelegateExecution delegateExecution = mockDelegateExecution(); - // when, then - assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class); - } - - private DelegateExecution mockDelegateExecutionWithCorrelationId() { - DelegateExecution delegateExecution = mockDelegateExecution(); - when(delegateExecution.getVariable(CORRELATION_ID)).thenReturn("testCorrelationId"); - return delegateExecution; - } - - @Test - public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() throws Exception { - // given - DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId(); - // when, then - assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class); - } - - @Test - public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() throws Exception { - // given - String defaultTimeout = "T1D"; - delegate.setDefaultTimeout(defaultTimeout); - DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId(); - // when - delegate.execute(delegateExecution); - // then - verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(defaultTimeout)); - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java deleted file mode 100644 index ada5a902a7..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java +++ /dev/null @@ -1,146 +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.bpmn.infrastructure.pnf.delegate.bpmn; - -import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY; -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP; -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP; -import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.history.HistoricVariableInstance; -import org.camunda.bpm.engine.runtime.ProcessInstance; -import org.camunda.bpm.engine.test.Deployment; -import org.camunda.bpm.engine.test.ProcessEngineRule; -import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@ContextConfiguration(locations = "/applicationContext_forPnfTesting.xml") -public class CreateAndActivatePnfResourceTest { - - private static final String TIMEOUT_10_S = "PT10S"; - @Autowired - private RuntimeService runtimeService; - - @Autowired - @Rule - public ProcessEngineRule processEngineRule; - - @Autowired - private AaiConnectionTestImpl aaiConnection; - - @Test - @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"}) - public void shouldSaveCurrentIpToVariableIfItAlreadyExistsInAai() throws Exception { - // given - aaiConnection.reset(); - BpmnAwareTests.init(processEngineRule.getProcessEngine()); - Map variables = new HashMap<>(); - variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S); - variables.put(CORRELATION_ID, ID_WITH_ENTRY_AND_IP); - // when - ProcessInstance instance = runtimeService - .startProcessInstanceByKey("CreateAndActivatePnfResource", variables); - // then - assertThat(instance).isEnded().hasPassedInOrder( - "CreateAndActivatePnf_StartEvent", - "CheckAiiForCorrelationId", - "DoesAaiContainInfoAboutPnf", - "DoesAaiContainInfoAboutIp", - "AaiEntryAlreadyUpToDate" - ); - } - - @Test - @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"}) - public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenIpIsMissingInAaiEntry() throws Exception { - // given - aaiConnection.reset(); - BpmnAwareTests.init(processEngineRule.getProcessEngine()); - Map variables = new HashMap<>(); - variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S); - variables.put(CORRELATION_ID, ID_WITH_ENTRY_NO_IP); - // when - ProcessInstance instance = runtimeService - .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); - assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage"); - runtimeService.createMessageCorrelation("WorkflowMessage") - .processInstanceBusinessKey("businessKey") - .correlateWithResult(); - // then - assertThat(instance).isEnded().hasPassedInOrder( - "CreateAndActivatePnf_StartEvent", - "CheckAiiForCorrelationId", - "DoesAaiContainInfoAboutPnf", - "DoesAaiContainInfoAboutIp", - "AaiEntryExists", - "InformDmaapClient", - "WaitForDmaapPnfReadyNotification", - "AaiEntryUpdated" - ); - } - - @Test - @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"}) - public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntry() throws Exception { - // given - aaiConnection.reset(); - BpmnAwareTests.init(processEngineRule.getProcessEngine()); - Map variables = new HashMap<>(); - variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S); - variables.put(CORRELATION_ID, ID_WITHOUT_ENTRY); - // when - ProcessInstance instance = runtimeService - .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); - assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage"); - runtimeService.createMessageCorrelation("WorkflowMessage") - .processInstanceBusinessKey("businessKey") - .correlateWithResult(); - // then - assertThat(instance).isEnded().hasPassedInOrder( - "CreateAndActivatePnf_StartEvent", - "CheckAiiForCorrelationId", - "DoesAaiContainInfoAboutPnf", - "CreateAndActivatePnf_CreateAaiEntry", - "AaiEntryExists", - "InformDmaapClient", - "WaitForDmaapPnfReadyNotification", - "AaiEntryUpdated" - ); - assertThat(aaiConnection.getCreated()).containsOnlyKeys(ID_WITHOUT_ENTRY); - } - - private List getVariables(ProcessInstance instance) { - return processEngineRule.getHistoryService().createHistoricVariableInstanceQuery() - .processInstanceId(instance.getProcessInstanceId()).taskIdIn().list(); - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java deleted file mode 100644 index 95de883dab..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.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.bpmn.infrastructure.pnf.dmaap; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.List; -import org.junit.Test; - -public class JsonUtilForCorrelationIdTest { - - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[\n" - + " {\n" - + " \"pnfRegistrationFields\" : {\n" - + " \"correlationId\" : \"corrTest1\",\n" - + " \"value\" : \"value1\"\n" - + " }\n" - + " },\n" - + " {\n" - + " \"pnfRegistrationFields\" : {\n" - + " \"correlationId\" : \"corrTest2\",\n" - + " \"value\" : \"value2\"\n" - + " }\n" - + " }\n" - + "]"; - - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID2 = "{\"pnfRegistrationFields\":{\"correlationId\":\"corrTest3\"}}"; - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID3 = "[\"\\{\\\"pnfRegistrationFields\\\":" - + "{\\\"correlationId\\\":\\\"corrTest4\\\"}}\", \"\\{\\\"pnfRegistrationFields\\\":" - + "{\\\"correlationId\\\":\\\"corrTest5\\\"}}\"]"; - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID4 = "{\"header\":{\"key\":\"value\"}}"; - - @Test - public void parseJsonSuccessful() { - List expectedResult = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID); - assertThat(expectedResult).containsExactly("corrTest1", "corrTest2"); - - List expectedResult2 = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID2); - assertThat(expectedResult2).containsExactly("corrTest3"); - } - - @Test - public void parseJsonWithEscapeCharacters_Successful() { - List expectedResult = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID3); - assertThat(expectedResult).containsExactly("corrTest4", "corrTest5"); - } - - @Test - public void parseJson_emptyListReturnedWhenNothingFound() { - List expectedResult = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID4); - assertThat(expectedResult).isEmpty(); - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java deleted file mode 100644 index c4d2570adb..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java +++ /dev/null @@ -1,208 +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.bpmn.infrastructure.pnf.dmaap; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledExecutorService; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.ProtocolVersion; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.entity.StringEntity; -import org.apache.http.message.BasicHttpResponse; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.bpmn.infrastructure.pnf.dmaap.PnfEventReadyDmaapClient.DmaapTopicListenerThread; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({PropertyConfiguration.class}) -@PowerMockIgnore("javax.net.ssl.*") -public class PnfEventReadyDmaapClientTest { - - private static final String CORRELATION_ID = "corrTestId"; - private static final String CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId"; - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[\n" - + " {\n" - + " \"pnfRegistrationFields\" : {\n" - + " \"correlationId\" : \"%s\",\n" - + " \"value\" : \"value1\"\n" - + " }\n" - + " },\n" - + " {\n" - + " \"pnfRegistrationFields\" : {\n" - + " \"correlationId\" : \"corr\",\n" - + " \"value\" : \"value2\"\n" - + " }\n" - + " }\n" - + "]"; - private static final String JSON_EXAMPLE_WITH_NO_CORRELATION_ID = - "{\"pnfRegistrationFields\":{\"field\":\"value\"}}"; - - private static final String HOST = "hostTest"; - private static final int PORT = 1234; - private static final String PROTOCOL = "http"; - private static final String URI_PATH_PREFIX = "eventsForTesting"; - private static final String EVENT_TOPIC_TEST = "eventTopicTest"; - private static final String CONSUMER_ID = "consumerTestId"; - private static final String CONSUMER_GROUP = "consumerGroupTest"; - - private PnfEventReadyDmaapClient testedObject; - private DmaapTopicListenerThread testedObjectInnerClassThread; - private HttpClient httpClientMock; - private Runnable threadMockToNotifyCamundaFlow; - private ScheduledExecutorService executorMock; - - @Before - public void init() throws NoSuchFieldException, IllegalAccessException { - PowerMockito.mockStatic(PropertyConfiguration.class); - PropertyConfiguration propertyConfigurationMock = mock(PropertyConfiguration.class); - PowerMockito.when(PropertyConfiguration.getInstance()).thenReturn(propertyConfigurationMock); - when(propertyConfigurationMock.getProperties(PropertyConfiguration.MSO_BPMN_URN_PROPERTIES)).thenReturn( - createProperties()); - testedObject = new PnfEventReadyDmaapClient(); - testedObject.setDmaapProtocol(PROTOCOL); - testedObject.setDmaapUriPathPrefix(URI_PATH_PREFIX); - testedObject.setDmaapTopicName(EVENT_TOPIC_TEST); - testedObject.setConsumerId(CONSUMER_ID); - testedObject.setConsumerGroup(CONSUMER_GROUP); - testedObject.setDmaapClientDelayInSeconds(1); - testedObject.init(); - testedObjectInnerClassThread = testedObject.new DmaapTopicListenerThread(); - httpClientMock = mock(HttpClient.class); - threadMockToNotifyCamundaFlow = mock(Runnable.class); - executorMock = mock(ScheduledExecutorService.class); - setPrivateField(); - } - - /** - * Test run method, where the are following conditions: - *

- DmaapThreadListener is running, flag is set to true - *

- map is filled with one entry with the key that we get from response - *

run method should invoke thread from map to notify camunda process, remove element from the map (map is - * empty) and shutdown the executor because of empty map - */ - @Test - public void correlationIdIsFoundInHttpResponse_notifyAboutPnfReady() - throws IOException { - when(httpClientMock.execute(any(HttpGet.class))). - thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID))); - testedObjectInnerClassThread.run(); - ArgumentCaptor captor1 = ArgumentCaptor.forClass(HttpGet.class); - verify(httpClientMock).execute(captor1.capture()); - assertThat(captor1.getValue().getURI()).hasHost(HOST).hasPort(PORT).hasScheme(PROTOCOL) - .hasPath( - "/" + URI_PATH_PREFIX + "/" + EVENT_TOPIC_TEST + "/" + CONSUMER_GROUP + "/" + CONSUMER_ID + ""); - verify(threadMockToNotifyCamundaFlow).run(); - verify(executorMock).shutdownNow(); - } - - /** - * Test run method, where the are following conditions: - *

- DmaapThreadListener is running, flag is set to true - *

- map is filled with one entry with the correlationId that does not match to correlationId - * taken from http response. run method should not do anything with the map not run any thread to notify camunda - * process - */ - @Test - public void correlationIdIsFoundInHttpResponse_NotFoundInMap() - throws IOException { - when(httpClientMock.execute(any(HttpGet.class))). - thenReturn(createResponse( - String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID_NOT_FOUND_IN_MAP))); - testedObjectInnerClassThread.run(); - verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock); - } - - /** - * Test run method, where the are following conditions: - *

- DmaapThreadListener is running, flag is set to true - *

- map is filled with one entry with the correlationId but no correlation id is taken from HttpResponse - * run method should not do anything with the map and not run any thread to notify camunda process - */ - @Test - public void correlationIdIsNotFoundInHttpResponse() throws IOException { - when(httpClientMock.execute(any(HttpGet.class))). - thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_CORRELATION_ID)); - testedObjectInnerClassThread.run(); - verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock); - } - - private void setPrivateField() throws NoSuchFieldException, IllegalAccessException { - Field httpClientField = testedObject.getClass().getDeclaredField("httpClient"); - httpClientField.setAccessible(true); - httpClientField.set(testedObject, httpClientMock); - httpClientField.setAccessible(false); - - Field executorField = testedObject.getClass().getDeclaredField("executor"); - executorField.setAccessible(true); - executorField.set(testedObject, executorMock); - executorField.setAccessible(false); - - Field pnfCorrelationToThreadMapField = testedObject.getClass() - .getDeclaredField("pnfCorrelationIdToThreadMap"); - pnfCorrelationToThreadMapField.setAccessible(true); - Map pnfCorrelationToThreadMap = new ConcurrentHashMap<>(); - pnfCorrelationToThreadMap.put(CORRELATION_ID, threadMockToNotifyCamundaFlow); - pnfCorrelationToThreadMapField.set(testedObject, pnfCorrelationToThreadMap); - - Field threadRunFlag = testedObject.getClass().getDeclaredField("dmaapThreadListenerIsRunning"); - threadRunFlag.setAccessible(true); - threadRunFlag.set(testedObject, true); - threadRunFlag.setAccessible(false); - } - - private Map createProperties() { - Map map = new HashMap<>(); - map.put("mso.dmaap.host", HOST); - map.put("mso.dmaap.port", String.valueOf(PORT)); - return map; - } - - private HttpResponse createResponse(String json) throws UnsupportedEncodingException { - HttpEntity entity = new StringEntity(json); - ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1); - HttpResponse response = new BasicHttpResponse(protocolVersion, 1, ""); - response.setEntity(entity); - response.setStatusCode(200); - return response; - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplicationTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplicationTest.java deleted file mode 100644 index c667dbf4bb..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplicationTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.infrastructure.workflow.service; - -import static org.junit.Assert.assertEquals; - -import java.util.Set; - -import org.junit.Test; - -public class WorkflowResourceApplicationTest { - - @Test - public void test() throws Exception { - WorkflowResourceApplication workflowResourceApp = new WorkflowResourceApplication(); - Set> classes = workflowResourceApp.getClasses(); - assertEquals(0, classes.size()); - Set singleton = workflowResourceApp.getSingletons(); - assertEquals(3, singleton.size()); - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java deleted file mode 100644 index b861a79feb..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============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.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -public class HeaderUtilTest { - - @Test - public void getAuthorizationTest() throws Exception { - String authorization = HeaderUtil.getAuthorization(HeaderUtil.USER, HeaderUtil.PASS); - assertEquals("Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==", authorization); - } - -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java deleted file mode 100644 index 99a87def80..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java +++ /dev/null @@ -1,358 +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.bpmn.infrastructure.workflow.serviceTask.client.builder; - -import org.camunda.bpm.engine.ProcessEngineServices; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.runtime.Incident; -import org.camunda.bpm.engine.variable.VariableMap; -import org.camunda.bpm.engine.variable.value.TypedValue; -import org.camunda.bpm.model.bpmn.BpmnModelInstance; -import org.camunda.bpm.model.bpmn.instance.FlowElement; -import org.junit.Test; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -public class AbstractBuilderTest { - - AbstractBuilder abstractBuilder = new AbstractBuilder() { - @Override - Object build(DelegateExecution execution, Object input) throws Exception { - return null; - } - }; - - DelegateExecution delegateExecution = new DelegateExecution() { - @Override - public String getProcessInstanceId() { - return null; - } - - @Override - public String getProcessBusinessKey() { - return null; - } - - @Override - public String getProcessDefinitionId() { - return null; - } - - @Override - public String getParentId() { - return null; - } - - @Override - public String getCurrentActivityId() { - return null; - } - - @Override - public String getCurrentActivityName() { - return null; - } - - @Override - public String getActivityInstanceId() { - return null; - } - - @Override - public String getParentActivityInstanceId() { - return null; - } - - @Override - public String getCurrentTransitionId() { - return null; - } - - @Override - public DelegateExecution getProcessInstance() { - return null; - } - - @Override - public DelegateExecution getSuperExecution() { - return null; - } - - @Override - public boolean isCanceled() { - return false; - } - - @Override - public String getTenantId() { - return null; - } - - @Override - public void setVariable(String s, Object o, String s1) { - - } - - @Override - public Incident createIncident(String s, String s1) { - return null; - } - - @Override - public Incident createIncident(String s, String s1, String s2) { - return null; - } - - @Override - public void resolveIncident(String s) { - - } - - @Override - public String getId() { - return null; - } - - @Override - public String getEventName() { - return null; - } - - @Override - public String getBusinessKey() { - return null; - } - - @Override - public BpmnModelInstance getBpmnModelInstance() { - return null; - } - - @Override - public FlowElement getBpmnModelElementInstance() { - return null; - } - - @Override - public ProcessEngineServices getProcessEngineServices() { - return null; - } - - @Override - public String getVariableScopeKey() { - return null; - } - - @Override - public Map getVariables() { - return null; - } - - @Override - public VariableMap getVariablesTyped() { - return null; - } - - @Override - public VariableMap getVariablesTyped(boolean b) { - return null; - } - - @Override - public Map getVariablesLocal() { - return null; - } - - @Override - public VariableMap getVariablesLocalTyped() { - return null; - } - - @Override - public VariableMap getVariablesLocalTyped(boolean b) { - return null; - } - - @Override - public Object getVariable(String s) { - return null; - } - - @Override - public Object getVariableLocal(String s) { - return null; - } - - @Override - public T getVariableTyped(String s) { - return null; - } - - @Override - public T getVariableTyped(String s, boolean b) { - return null; - } - - @Override - public T getVariableLocalTyped(String s) { - return null; - } - - @Override - public T getVariableLocalTyped(String s, boolean b) { - return null; - } - - @Override - public Set getVariableNames() { - return null; - } - - @Override - public Set getVariableNamesLocal() { - return null; - } - - @Override - public void setVariable(String s, Object o) { - - } - - @Override - public void setVariableLocal(String s, Object o) { - - } - - @Override - public void setVariables(Map map) { - - } - - @Override - public void setVariablesLocal(Map map) { - - } - - @Override - public boolean hasVariables() { - return false; - } - - @Override - public boolean hasVariablesLocal() { - return false; - } - - @Override - public boolean hasVariable(String s) { - return false; - } - - @Override - public boolean hasVariableLocal(String s) { - return false; - } - - @Override - public void removeVariable(String s) { - - } - - @Override - public void removeVariableLocal(String s) { - - } - - @Override - public void removeVariables(Collection collection) { - - } - - @Override - public void removeVariablesLocal(Collection collection) { - - } - - @Override - public void removeVariables() { - - } - - @Override - public void removeVariablesLocal() { - - } - }; - - - @Test - public void buildTest() throws Exception { - abstractBuilder.build(null, null); - } - - @Test - public void getRequestActoinTest() throws Exception { - abstractBuilder.getRequestActoin(delegateExecution); - } - - @Test - public void getSvcActionTest() throws Exception { - abstractBuilder.getSvcAction(delegateExecution); - } - - @Test - public void getRequestIdTest() throws Exception { - abstractBuilder.getRequestId(delegateExecution); - } - - @Test - public void getOnapServiceModelInformationEntityTest() throws Exception { - abstractBuilder.getOnapServiceModelInformationEntity(delegateExecution); - } - - @Test - public void getOnapNetworkModelInformationEntityTest() throws Exception { - abstractBuilder.getOnapNetworkModelInformationEntity(delegateExecution); - } - - @Test - public void getParamEntitiesTest() throws Exception { - abstractBuilder.getParamEntities(new HashMap<>()); - } - - @Test - public void getRequestInformationEntityTest() throws Exception { - abstractBuilder.getRequestInformationEntity(delegateExecution); - } - - @Test - public void getServiceInformationEntityTest() throws Exception { - abstractBuilder.getServiceInformationEntity(delegateExecution); - } - - @Test - public void getServiceInstanceNameTest() throws Exception { - abstractBuilder.getServiceInstanceName(delegateExecution); - } - -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java deleted file mode 100644 index e7b80f12ab..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java +++ /dev/null @@ -1,41 +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.bpmn.vcpe; - -import org.openecomp.mso.bpmn.common.WorkflowTest; - -public class AbstractTestBase extends WorkflowTest { - - - public static final String CUST = "SDN-ETHERNET-INTERNET"; - public static final String SVC = "123456789"; - public static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET"; - public static final String PARENT_INST = "MIS%252F1604%252F0027%252FSW_INTERNET"; - public static final String ARID = "arId-1"; - public static final String ARVERS = "1490627351232"; - - public static final String DEC_INST = "MIS%2F1604%2F0026%2FSW_INTERNET"; - public static final String DEC_PARENT_INST = "MIS%2F1604%2F0027%2FSW_INTERNET"; - - public static final String VAR_SUCCESS_IND = "SuccessIndicator"; - public static final String VAR_WFEX = "SavedWorkflowException1"; - public static final String VAR_RESP_CODE = "CMSO_ResponseCode"; - public static final String VAR_COMP_REQ = "CompleteMsoProcessRequest"; -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java deleted file mode 100644 index d9534f325f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java +++ /dev/null @@ -1,382 +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.bpmn.vcpe; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetCustomer; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.mock.FileUtil; - -public class CreateVcpeResCustServiceTest extends AbstractTestBase { - - private static final String PROCNAME = "CreateVcpeResCustService"; - private static final String Prefix = "CVRCS_"; - - private final CallbackSet callbacks = new CallbackSet(); - private final String request; - - public CreateVcpeResCustServiceTest() throws IOException { - callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml")); - callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("queryTXC", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml")); - callbacks.put("queryBRG", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml")); - callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); - callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); - callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); - - request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSIName.json"); - } - - @Test - @Ignore // 1802 merge - @Deployment(resources = { - "process/CreateVcpeResCustService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericPutService.bpmn", - "subprocess/BuildingBlock/DecomposeService.bpmn", - "subprocess/DoCreateServiceInstance.bpmn", - "subprocess/DoCreateAllottedResourceTXC.bpmn", - "subprocess/DoCreateAllottedResourceBRG.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - - // stubs - "VCPE/stubprocess/Homing.bpmn", - "VCPE/stubprocess/DoCreateVnfAndModules.bpmn"}) - - public void testCreateVcpeResCustService_Success() throws Exception { - - System.out.println("starting: testCreateVcpeResCustService_Success\n"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); - - // TODO: the SI should NOT have to be URL-encoded yet again! - MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map variables = setupVariables(); - - String businessKey = UUID.randomUUID().toString(); - invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); - - // for SI - injectSDNCCallbacks(callbacks, "assign"); - - // for TXC - injectSDNCCallbacks(callbacks, "assign"); - injectSDNCCallbacks(callbacks, "create"); - injectSDNCCallbacks(callbacks, "activate"); - injectSDNCCallbacks(callbacks, "queryTXC"); - - // for BRG - injectSDNCCallbacks(callbacks, "assign"); - injectSDNCCallbacks(callbacks, "create"); - injectSDNCCallbacks(callbacks, "activate"); - injectSDNCCallbacks(callbacks, "queryBRG"); - - waitForProcessEnd(businessKey, 10000); - - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - - String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ); - System.out.println("completionReq:\n" + completionReq); - - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); - assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); - assertEquals(null, workflowException); - assertTrue(completionReq.contains("request-id>testRequestId<")); - assertTrue(completionReq.contains("action>CREATE<")); - assertTrue(completionReq.contains("source>VID<")); - - assertEquals("1", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"VnfsCreatedCount")); - } - - @Test - @Ignore // 1802 merge - @Deployment(resources = { - "process/CreateVcpeResCustService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericPutService.bpmn", - "subprocess/BuildingBlock/DecomposeService.bpmn", - "subprocess/DoCreateServiceInstance.bpmn", - "subprocess/DoCreateAllottedResourceTXC.bpmn", - "subprocess/DoCreateAllottedResourceBRG.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - - // stubs - "VCPE/stubprocess/Homing.bpmn", - "VCPE/stubprocess/DoCreateVnfAndModules.bpmn"}) - - public void testCreateVcpeResCustService_NoParts() throws Exception { - - System.out.println("starting: testCreateVcpeResCustService_NoParts\n" ); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json"); - MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); - - // TODO: the SI should NOT have to be URL-encoded yet again! - MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - - // TODO: should these really be PARENT_INST, or should they be INST? - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map variables = setupVariables(); - - String businessKey = UUID.randomUUID().toString(); - invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); - - // for SI - injectSDNCCallbacks(callbacks, "assign"); - - waitForProcessEnd(businessKey, 10000); - - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - - String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ); - System.out.println("completionReq:\n" + completionReq); - - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); - assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); - assertEquals(null, workflowException); - assertTrue(completionReq.contains("request-id>testRequestId<")); - assertTrue(completionReq.contains("action>CREATE<")); - assertTrue(completionReq.contains("source>VID<")); - - assertEquals("0", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"VnfsCreatedCount")); - } - - @Test - @Ignore // 1802 merge - @Deployment(resources = { - "process/CreateVcpeResCustService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericPutService.bpmn", - "subprocess/BuildingBlock/DecomposeService.bpmn", - "subprocess/DoCreateServiceInstance.bpmn", - "subprocess/DoCreateAllottedResourceBRG.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - - // this stub will trigger a fault - "VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn", - - // stubs - "VCPE/stubprocess/Homing.bpmn", - "VCPE/stubprocess/DoCreateVnfAndModules.bpmn"}) - - public void testCreateVcpeResCustService_Fault_NoRollback() throws Exception { - - System.out.println("starting: testCreateVcpeResCustService_Fault_NoRollback\n"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); - - // TODO: the SI should NOT have to be URL-encoded yet again! - MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map variables = setupVariables(); - - String req = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json"); - - String businessKey = UUID.randomUUID().toString(); - invokeAsyncProcess(PROCNAME, "v1", businessKey, req, variables); - - // for SI - injectSDNCCallbacks(callbacks, "assign"); - - waitForProcessEnd(businessKey, 10000); - - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - - String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ); - System.out.println("completionReq:\n" + completionReq); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); - assertNotNull(workflowException); - - BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateAllottedResourceBRGRollback"); - BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateVnfAndModulesRollback"); - BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateAllottedResourceTXCRollback"); - } - - @Test - @Ignore // 1802 merge - @Deployment(resources = { - "process/CreateVcpeResCustService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericPutService.bpmn", - "subprocess/BuildingBlock/DecomposeService.bpmn", - "subprocess/DoCreateServiceInstance.bpmn", - "subprocess/DoCreateAllottedResourceTXC.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - - // this stub will trigger a fault - "VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn", - - // stubs - "VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn", - "VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn", - "VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn", - "VCPE/stubprocess/Homing.bpmn", - "VCPE/stubprocess/DoCreateVnfAndModules.bpmn"}) - - public void testCreateVcpeResCustService_Fault_Rollback() throws Exception { - - System.out.println("starting: testCreateVcpeResCustService_Fault_Rollback\n"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); - - // TODO: the SI should NOT have to be URL-encoded yet again! - MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml"); - MockGetAllottedResource(CUST, SVC, PARENT_INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockDeleteAllottedResource(CUST, SVC, PARENT_INST, ARID, ARVERS); - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map variables = setupVariables(); - - String businessKey = UUID.randomUUID().toString(); - invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); - - // for SI - injectSDNCCallbacks(callbacks, "assign"); - - // for TXC - injectSDNCCallbacks(callbacks, "assign"); - injectSDNCCallbacks(callbacks, "create"); - injectSDNCCallbacks(callbacks, "activate"); - injectSDNCCallbacks(callbacks, "queryTXC"); - - // BRG is a stub so don't need SDNC callbacks - - // for TXC rollback - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - - String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ); - System.out.println("completionReq:\n" + completionReq); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); - assertEquals(null, completionReq); - assertNotNull(workflowException); - - BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateAllottedResourceBRGRollback"); - BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateVnfAndModulesRollback"); - BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateAllottedResourceTXCRollback"); - } - - // ***************** - // Utility Section - // ***************** - - // Success Scenario - private Map setupVariables() { - Map variables = new HashMap<>(); - variables.put("requestId", "testRequestId"); - variables.put("request-id", "testRequestId"); - variables.put("serviceInstanceId", DEC_INST); - variables.put("allottedResourceId", ARID); - return variables; - - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java deleted file mode 100644 index d026b7a949..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java +++ /dev/null @@ -1,297 +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.bpmn.vcpe; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.mock.FileUtil; - -import com.github.tomakehurst.wiremock.stubbing.Scenario; - -public class DeleteVcpeResCustServiceTest extends AbstractTestBase { - - private static final String PROCNAME = "DeleteVcpeResCustService"; - private static final String Prefix = "DVRCS_"; - private static final String AR_BRG_ID = "ar-brgB"; - private static final String AR_TXC_ID = "ar-txcA"; - - private final CallbackSet callbacks = new CallbackSet(); - private final String request; - - public DeleteVcpeResCustServiceTest() throws IOException { - callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); - callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); - callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); - - request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json"); - } - - @Test - @Deployment(resources = { - "process/DeleteVcpeResCustService.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericDeleteService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoDeleteServiceInstance.bpmn", - "subprocess/DoDeleteAllottedResourceBRG.bpmn", - "subprocess/DoDeleteAllottedResourceTXC.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - - // stubs - "VCPE/stubprocess/DoDeleteVnfAndModules.bpmn"}) - - public void testDeleteVcpeResCustService_Success() throws Exception { - - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - - // TODO: use INST instead of DEC_INST - /* - * Seems to be a bug in GenericDeleteService (or its subflows) as they - * fail to URL-encode the SI id before performing the query so we'll - * add a stub for that case, too. - */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - - /* - * cannot use MockGetServiceInstance(), because we need to return - * different responses as we traverse through the flow - */ - - // initially, the SI includes the ARs - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST)) - .inScenario("SI retrieval") - .whenScenarioStateIs(Scenario.STARTED) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VCPE/DeleteVcpeResCustService/getSI.xml")) - .willSetStateTo("ARs Deleted")); - - // once the ARs have been deleted, the SI should be empty - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST)) - .inScenario("SI retrieval") - .whenScenarioStateIs("ARs Deleted") - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"))); - - // for BRG - MockQueryAllottedResourceById(AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/arGetBRGById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, AR_BRG_ID); - MockDeleteAllottedResource(CUST, SVC, INST, AR_BRG_ID, ARVERS); - - // for TXC - MockQueryAllottedResourceById(AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/arGetTXCById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, AR_TXC_ID); - MockDeleteAllottedResource(CUST, SVC, INST, AR_TXC_ID, ARVERS); - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map variables = setupVariables(); - - String businessKey = UUID.randomUUID().toString(); - invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); - - // for BRG - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - // for TXC - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - // for SI - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - - waitForProcessEnd(businessKey, 10000); - - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - - String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ); - System.out.println("completionReq:\n" + completionReq); - - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); - assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); - assertEquals(null, workflowException); - assertTrue(completionReq.contains("testRequestId<")); - assertTrue(completionReq.contains("DELETE<")); - assertTrue(completionReq.contains("VID<")); - - assertEquals("2", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"vnfsDeletedCount")); - - BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoDeleteVnfAndModules"); - } - - @Test - @Deployment(resources = { - "process/DeleteVcpeResCustService.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericDeleteService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoDeleteServiceInstance.bpmn", - "subprocess/DoDeleteAllottedResourceBRG.bpmn", - "subprocess/DoDeleteAllottedResourceTXC.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - - // stubs - "VCPE/stubprocess/DoDeleteVnfAndModules.bpmn"}) - - public void testDeleteVcpeResCustService_NoBRG_NoTXC_NoVNF() throws Exception { - - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - - // TODO: use INST instead of DEC_INST - /* - * Seems to be a bug in GenericDeleteService (or its subflows) as they - * fail to URL-encode the SI id before performing the query so we'll - * add a stub for that case, too. - */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"); - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map variables = setupVariables(); - - String businessKey = UUID.randomUUID().toString(); - invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); - - // for SI - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - - waitForProcessEnd(businessKey, 10000); - - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - - String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ); - System.out.println("completionReq:\n" + completionReq); - - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); - assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); - assertEquals(null, workflowException); - assertTrue(completionReq.contains("testRequestId<")); - assertTrue(completionReq.contains("DELETE<")); - assertTrue(completionReq.contains("VID<")); - - assertEquals("0", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"vnfsDeletedCount")); - - BPMNUtil.assertNoProcessInstance(processEngineRule, "DoDeleteVnfAndModules"); - } - - @Test - @Deployment(resources = { - "process/DeleteVcpeResCustService.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericDeleteService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoDeleteServiceInstance.bpmn", - "subprocess/DoDeleteAllottedResourceBRG.bpmn", - "subprocess/DoDeleteAllottedResourceTXC.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - - // stubs - "VCPE/stubprocess/DoDeleteVnfAndModules.bpmn"}) - - public void testDeleteVcpeResCustService_Fault() throws Exception { - - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - - // TODO: use INST instead of DEC_INST - /* - * Seems to be a bug in GenericDeleteService (or its subflows) as they - * fail to URL-encode the SI id before performing the query so we'll - * add a stub for that case, too. - */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"); - - // generate failure - mockSDNCAdapter(404); - - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map variables = setupVariables(); - - String businessKey = UUID.randomUUID().toString(); - invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); - - waitForProcessEnd(businessKey, 10000); - - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - - String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ); - System.out.println("completionReq:\n" + completionReq); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); - assertNotNull(workflowException); - } - - private Map setupVariables() throws UnsupportedEncodingException { - Map variables = new HashMap<>(); - variables.put("isDebugLogEnabled", "true"); - variables.put("requestId", "testRequestId"); - variables.put("serviceInstanceId", DEC_INST); - variables.put("sdncVersion", "1802"); - variables.put("serviceInstanceName", "some-junk-name"); - return variables; - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java deleted file mode 100644 index 0407e172e2..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java +++ /dev/null @@ -1,345 +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.bpmn.vcpe; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.core.RollbackData; -import org.openecomp.mso.bpmn.mock.FileUtil; - - -public class DoCreateAllottedResourceBRGRollbackTest extends AbstractTestBase { - - private static final String PROCNAME = "DoCreateAllottedResourceBRGRollback"; - private static final String RbType = "DCARBRG_"; - private final CallbackSet callbacks = new CallbackSet(); - - public DoCreateAllottedResourceBRGRollbackTest() throws IOException { - callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); - callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); - callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRGRollback_Success() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRGRollback_skipRollback() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - rollbackData.put(RbType, "rollbackAAI", "false"); - rollbackData.put(RbType, "rollbackSDNCassign", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRGRollback_DoNotRollBack() throws Exception { - - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - // this will cause "rollbackSDNC" to be set to false - rollbackData.put(RbType, "rollbackSDNCassign", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRGRollback_NoDeactivate() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - rollbackData.put(RbType, "rollbackSDNCactivate", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRGRollback_NoDelete() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - rollbackData.put(RbType, "rollbackSDNCcreate", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRGRollback_NoUnassign() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - rollbackData.put(RbType, "rollbackSDNCassign", "false"); - - /* - * Note: if assign == false then the flow/script will set - * "skipRollback" to false, which will cause ALL of the SDNC steps - * to be skipped, not just the unassign step. - */ - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRGRollback_SubProcessError() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - mockSDNCAdapter(404); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRGRollback_JavaException() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - variables.put("rollbackData", "string instead of rollback data"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - private RollbackData setVariablesSuccess(Map variables, String requestId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("failNotFound", "true"); - variables.put("msoRequestId", requestId); - variables.put("mso-request-id", "requestId"); - variables.put("allottedResourceId", ARID); - - variables.put("serviceInstanceId", DEC_INST); - variables.put("parentServiceInstanceId", DEC_PARENT_INST); - - RollbackData rollbackData = new RollbackData(); - - rollbackData.put(RbType, "serviceInstanceId", DEC_INST); - rollbackData.put(RbType, "serviceSubscriptionType", SVC); - rollbackData.put(RbType, "disablerollback", "false"); - rollbackData.put(RbType, "rollbackAAI", "true"); - rollbackData.put(RbType, "rollbackSDNCassign", "true"); - rollbackData.put(RbType, "rollbackSDNCactivate", "true"); - rollbackData.put(RbType, "rollbackSDNCcreate", "true"); - rollbackData.put(RbType, "aaiARPath", "http://localhost:28090/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID); - - rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml")); - rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml")); - rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml")); - - variables.put("rollbackData",rollbackData); - - return rollbackData; - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java deleted file mode 100644 index 0373266ce1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java +++ /dev/null @@ -1,296 +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.bpmn.vcpe; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.mock.FileUtil; - - -public class DoCreateAllottedResourceBRGTest extends AbstractTestBase { - - private static final String PROCNAME = "DoCreateAllottedResourceBRG"; - private final CallbackSet callbacks = new CallbackSet(); - - public DoCreateAllottedResourceBRGTest() throws IOException { - callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml")); - callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRG.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRG_Success() throws Exception{ - - // TODO: use INST instead of DEC_INST - /* - * should be INST instead of DEC_INST, but AAI utilities appear to - * have a bug in that they don't URL-encode the SI id before using - * it in the query - */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "assign"); - injectSDNCCallbacks(callbacks, "create"); - injectSDNCCallbacks(callbacks, "activate"); - injectSDNCCallbacks(callbacks, "query"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertEquals(null, workflowException); - - assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRG.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRG_NoSI() throws Exception{ - - // TODO: use INST instead of DEC_INST - /* - * should be INST instead of DEC_INST, but AAI utilities appear to - * have a bug in that they don't URL-encode the SI id before using - * it in the query - */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertNotNull(workflowException); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRG.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRG_ActiveAr() throws Exception{ - - // TODO: use INST instead of DEC_INST - /* - * should be INST instead of DEC_INST, but AAI utilities appear to - * have a bug in that they don't URL-encode the SI id before using - * it in the query - */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - variables.put("failExists", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "query"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertEquals(null, workflowException); - - assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRG.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRG_NoParentSI() throws Exception{ - - // TODO: use INST instead of DEC_INST - /* - * should be INST instead of DEC_INST, but AAI utilities appear to - * have a bug in that they don't URL-encode the SI id before using - * it in the query - */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertNotNull(workflowException); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRG.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRG_SubProcessError() throws Exception{ - - // TODO: use INST instead of DEC_INST - /* - * should be INST instead of DEC_INST, but AAI utilities appear to - * have a bug in that they don't URL-encode the SI id before using - * it in the query - */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(404); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertNotNull(workflowException); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - } - - private void setVariablesSuccess(Map variables, String requestId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("failExists", "true"); - variables.put("disableRollback", "true"); - variables.put("msoRequestId", requestId); - variables.put("mso-request-id", "requestId"); - variables.put("sourceNetworkId", "snId"); - variables.put("sourceNetworkRole", "snRole"); - variables.put("allottedResourceRole", "txc"); - variables.put("allottedResourceType", "BRG"); - variables.put("allottedResourceId", ARID); - variables.put("vni", "BRG"); - variables.put("vgmuxBearerIP", "bearerip"); - variables.put("brgWanMacAddress", "wanmac"); - - variables.put("serviceInstanceId", DEC_INST); - variables.put("parentServiceInstanceId", DEC_PARENT_INST); - - variables.put("serviceChainServiceInstanceId", "scsiId"); - - String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," + - "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"vSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + - "}"; - variables.put("allottedResourceModelInfo", arModelInfo); - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java deleted file mode 100644 index cdce56ee63..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java +++ /dev/null @@ -1,345 +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.bpmn.vcpe; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.core.RollbackData; -import org.openecomp.mso.bpmn.mock.FileUtil; - - -public class DoCreateAllottedResourceTXCRollbackTest extends AbstractTestBase { - - private static final String PROCNAME = "DoCreateAllottedResourceTXCRollback"; - private static final String RbType = "DCARTXC_"; - private final CallbackSet callbacks = new CallbackSet(); - - public DoCreateAllottedResourceTXCRollbackTest() throws IOException { - callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); - callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); - callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXCRollback_Success() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXCRollback_skipRollback() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - rollbackData.put(RbType, "rollbackAAI", "false"); - rollbackData.put(RbType, "rollbackSDNCassign", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXCRollback_DoNotRollBack() throws Exception { - - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - // this will cause "rollbackSDNC" to be set to false - rollbackData.put(RbType, "rollbackSDNCassign", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXCRollback_NoDeactivate() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - rollbackData.put(RbType, "rollbackSDNCactivate", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXCRollback_NoDelete() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - rollbackData.put(RbType, "rollbackSDNCcreate", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXCRollback_NoUnassign() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - rollbackData.put(RbType, "rollbackSDNCassign", "false"); - - /* - * Note: if assign == false then the flow/script will set - * "skipRollback" to false, which will cause ALL of the SDNC steps - * to be skipped, not just the unassign step. - */ - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXCRollback_SubProcessError() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - mockSDNCAdapter(404); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXCRollback_JavaException() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - variables.put("rollbackData", "string instead of rollback data"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - private RollbackData setVariablesSuccess(Map variables, String requestId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("failNotFound", "true"); - variables.put("msoRequestId", requestId); - variables.put("mso-request-id", "requestId"); - variables.put("allottedResourceId", ARID); - - variables.put("serviceInstanceId", DEC_INST); - variables.put("parentServiceInstanceId", DEC_PARENT_INST); - - RollbackData rollbackData = new RollbackData(); - - rollbackData.put(RbType, "serviceInstanceId", DEC_INST); - rollbackData.put(RbType, "serviceSubscriptionType", SVC); - rollbackData.put(RbType, "disablerollback", "false"); - rollbackData.put(RbType, "rollbackAAI", "true"); - rollbackData.put(RbType, "rollbackSDNCassign", "true"); - rollbackData.put(RbType, "rollbackSDNCactivate", "true"); - rollbackData.put(RbType, "rollbackSDNCcreate", "true"); - rollbackData.put(RbType, "aaiARPath", "http://localhost:28090/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID); - - rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml")); - rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml")); - rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml")); - - variables.put("rollbackData",rollbackData); - - return rollbackData; - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java deleted file mode 100644 index 9cf059c24c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java +++ /dev/null @@ -1,302 +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.bpmn.vcpe; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.mock.FileUtil; - - -public class DoCreateAllottedResourceTXCTest extends AbstractTestBase { - - private static final String PROCNAME = "DoCreateAllottedResourceTXC"; - private final CallbackSet callbacks = new CallbackSet(); - - public DoCreateAllottedResourceTXCTest() throws IOException { - callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml")); - callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXC.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXC_Success() throws Exception{ - - // TODO: use INST instead of DEC_INST - /* - * should be INST instead of DEC_INST, but AAI utilities appear to - * have a bug in that they don't URL-encode the SI id before using - * it in the query - */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "assign"); - injectSDNCCallbacks(callbacks, "create"); - injectSDNCCallbacks(callbacks, "activate"); - injectSDNCCallbacks(callbacks, "query"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertEquals(null, workflowException); - - assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - assertEquals("my-vni", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vni")); - assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxBearerIP")); - assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxLanIP")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXC.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXC_NoSI() throws Exception{ - - // TODO: use INST instead of DEC_INST - /* - * should be INST instead of DEC_INST, but AAI utilities appear to - * have a bug in that they don't URL-encode the SI id before using - * it in the query - */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertNotNull(workflowException); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXC.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXC_ActiveAr() throws Exception{ - - // TODO: use INST instead of DEC_INST - /* - * should be INST instead of DEC_INST, but AAI utilities appear to - * have a bug in that they don't URL-encode the SI id before using - * it in the query - */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - variables.put("failExists", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "query"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertEquals(null, workflowException); - - assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - assertEquals("my-vni", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vni")); - assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxBearerIP")); - assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxLanIP")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXC.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXC_NoParentSI() throws Exception{ - - // TODO: use INST instead of DEC_INST - /* - * should be INST instead of DEC_INST, but AAI utilities appear to - * have a bug in that they don't URL-encode the SI id before using - * it in the query - */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertNotNull(workflowException); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXC.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXC_SubProcessError() throws Exception{ - - // TODO: use INST instead of DEC_INST - /* - * should be INST instead of DEC_INST, but AAI utilities appear to - * have a bug in that they don't URL-encode the SI id before using - * it in the query - */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(404); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertNotNull(workflowException); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - } - - private void setVariablesSuccess(Map variables, String requestId) { - // TODO: need all of these? - variables.put("isDebugLogEnabled", "true"); - variables.put("failExists", "true"); - variables.put("disableRollback", "true"); - variables.put("msoRequestId", requestId); - variables.put("mso-request-id", "requestId"); - variables.put("sourceNetworkId", "snId"); - variables.put("sourceNetworkRole", "snRole"); - variables.put("allottedResourceRole", "brg"); - variables.put("allottedResourceType", "TXC"); - variables.put("allottedResourceId", ARID); - variables.put("brgWanMacAddress", "wanmac"); - - variables.put("serviceInstanceId", DEC_INST); - variables.put("parentServiceInstanceId", DEC_PARENT_INST); - - variables.put("serviceChainServiceInstanceId", "scsiId"); - - String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," + - "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"vSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + - "}"; - variables.put("allottedResourceModelInfo", arModelInfo); - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java deleted file mode 100644 index 03972da789..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java +++ /dev/null @@ -1,162 +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.bpmn.vcpe; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.mock.FileUtil; - - -public class DoDeleteAllottedResourceBRGTest extends AbstractTestBase { - - private static final String PROCNAME = "DoDeleteAllottedResourceBRG"; - private final CallbackSet callbacks = new CallbackSet(); - - public DoDeleteAllottedResourceBRGTest() throws IOException { - callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); - callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml")); - callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); - callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoDeleteAllottedResourceBRG.bpmn"}) - public void testDoDeleteAllottedResourceBRG_Success() throws Exception { - - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoDeleteAllottedResourceBRG.bpmn"}) - public void testDoDeleteAllottedResourceBRG_ARNotInSDNC() throws Exception { - - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - variables.put("failNotFound", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivateNF"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - } - - // TODO - exception is not caught - @Test - @Ignore - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoDeleteAllottedResourceBRG.bpmn"}) - public void testDoDeleteAllottedResourceBRG_SubProcessError() throws Exception { - - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - mockSDNCAdapter(500); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertNotNull(workflowException); - } - - private void setVariablesSuccess(Map variables, String requestId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("failNotFound", "true"); - variables.put("msoRequestId", requestId); - variables.put("mso-request-id", "requestId"); - variables.put("allottedResourceId", ARID); - - variables.put("serviceInstanceId", DEC_INST); - variables.put("parentServiceInstanceId", DEC_PARENT_INST); - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java deleted file mode 100644 index 2b0364c3c9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java +++ /dev/null @@ -1,162 +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.bpmn.vcpe; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.BPMNUtil; -import org.openecomp.mso.bpmn.mock.FileUtil; - - -public class DoDeleteAllottedResourceTXCTest extends AbstractTestBase { - - private static final String PROCNAME = "DoDeleteAllottedResourceTXC"; - private final CallbackSet callbacks = new CallbackSet(); - - public DoDeleteAllottedResourceTXCTest() throws IOException { - callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); - callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml")); - callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); - callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoDeleteAllottedResourceTXC.bpmn"}) - public void testDoDeleteAllottedResourceTXC_Success() throws Exception { - - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoDeleteAllottedResourceTXC.bpmn"}) - public void testDoDeleteAllottedResourceTXC_ARNotInSDNC() throws Exception { - - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - variables.put("failNotFound", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivateNF"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - } - - // TODO - exception is not caught - @Test - @Ignore - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoDeleteAllottedResourceTXC.bpmn"}) - public void testDoDeleteAllottedResourceTXC_SubProcessError() throws Exception { - - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - mockSDNCAdapter(500); - - String businessKey = UUID.randomUUID().toString(); - Map variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertNotNull(workflowException); - } - - private void setVariablesSuccess(Map variables, String requestId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("failNotFound", "true"); - variables.put("msoRequestId", requestId); - variables.put("mso-request-id", "requestId"); - variables.put("allottedResourceId", ARID); - - variables.put("serviceInstanceId", DEC_INST); - variables.put("parentServiceInstanceId", DEC_PARENT_INST); - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn deleted file mode 100644 index b33aad7443..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn +++ /dev/null @@ -1,54 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_1v2f9n5 - - - - SequenceFlow_1v2f9n5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn deleted file mode 100644 index 807efae1af..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn +++ /dev/null @@ -1,55 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1epm19d - - - SequenceFlow_1 - SequenceFlow_1epm19d - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn deleted file mode 100644 index b2f280d7e9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn +++ /dev/null @@ -1,38 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn deleted file mode 100644 index 532ca867bb..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn +++ /dev/null @@ -1,53 +0,0 @@ - - - - - SequenceFlow_1ipu8um - - - SequenceFlow_1l4c4k0 - - - SequenceFlow_1ipu8um - SequenceFlow_1l4c4k0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn deleted file mode 100644 index 5e4400e9bd..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn +++ /dev/null @@ -1,53 +0,0 @@ - - - - - SequenceFlow_11sp3s9 - - - - SequenceFlow_11sp3s9 - SequenceFlow_0q1lfmf - - - - - SequenceFlow_0q1lfmf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn deleted file mode 100644 index 2867a671b6..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn +++ /dev/null @@ -1,53 +0,0 @@ - - - - - SequenceFlow_1537b7m - - - SequenceFlow_1mz2mgf - - - - SequenceFlow_1537b7m - SequenceFlow_1mz2mgf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn deleted file mode 100644 index 517df36c74..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn +++ /dev/null @@ -1,37 +0,0 @@ - - - - - SequenceFlow_0qi7pl3 - - - - SequenceFlow_0qi7pl3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/Homing.bpmn b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/Homing.bpmn deleted file mode 100644 index ad4c3c816d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/Homing.bpmn +++ /dev/null @@ -1,35 +0,0 @@ - - - - - SequenceFlow_0tyavm9 - - - SequenceFlow_0tyavm9 - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json deleted file mode 100644 index 364afed8ce..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "cloud-owner": "att-aic", - "cloud-region-id": "mdt1", - "cloud-type": "openstack", - "owner-defined-type": "lcp", - "cloud-region-version": "aic3.0", - "identity-url": "https://identity-aic.mdt1.cci.att.com:5000/v2.0", - "cloud-zone": "z1", - "complex-name": "c1", - "sriov-automation": false, - "resource-version": "1503072127235" -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_genericVnfGet.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_genericVnfGet.json deleted file mode 100644 index 09d7758f04..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_genericVnfGet.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "vnf-id": "msoVnf123", - "vnf-name": "MSO-Test-VNF-123", - "vnf-type": "vnf-type", - "orchestration-status": "active", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1525360206136" -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json deleted file mode 100644 index dd352fa480..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json +++ /dev/null @@ -1,435 +0,0 @@ -{ - "vnf-id": "example-vnf-id-val-90603", - "vnf-name": "example-vnf-name-val-56838", - "vnf-name2": "example-vnf-name2-val-56319", - "vnf-type": "example-vnf-type-val-30533", - "service-id": "example-service-id-val-28290", - "regional-resource-zone": "example-regional-resource-zone-val-11059", - "prov-status": "example-prov-status-val-59777", - "operational-status": "example-operational-status-val-22513", - "in-maint": true, - - "equipment-role": "example-equipment-role-val-23396", - "orchestration-status": "example-orchestration-status-val-59435", - "heat-stack-id": "example-heat-stack-id-val-96869", - "mso-catalog-key": "example-mso-catalog-key-val-30721", - "management-option": "example-management-option-val-61927", - "ipv4-oam-address": "135.25.10.14", - "ipv4-loopback0-address": "example-ipv4-loopback0-address-val-87072", - "nm-lan-v6-address": "example-nm-lan-v6-address-val-91063", - "management-v6-address": "example-management-v6-address-val-80466", - "vcpu": 45837298, - "vcpu-units": "example-vcpu-units-val-86249", - "vmemory": 57288956, - "vmemory-units": "example-vmemory-units-val-13291", - "vdisk": 16937143, - "vdisk-units": "example-vdisk-units-val-73197", - - "is-closed-loop-disabled": true, - "summary-status": "example-summary-status-val-86438", - "encrypted-access-flag": true, - - - - - "model-invariant-id": "example-model-invariant-id-val-14704", - "model-version-id": "example-model-version-id-val-47847", - "model-customization-id": "example-model-customization-id-val-52688", - "widget-model-id": "example-widget-model-id-val-20939", - "widget-model-version": "example-widget-model-version-val-72210", - "as-number": "example-as-number-val-68358", - "regional-resource-subzone": "example-regional-resource-subzone-val-34391", - "nf-type": "example-nf-type-val-54866", - "nf-function": "example-nf-function-val-24790", - "nf-role": "example-nf-role-val-4780", - "nf-naming-code": "example-nf-naming-code-val-25118", - "selflink": "example-selflink-val-68404", - - "relationship-list": {"relationship": [ - { - "related-to": "service-instance", - "relationship-label": "org.onap.relationships.inventory.ComposedOf", - "related-link": "/aai/v12/business/customers/customer/e433710f-9217-458d-a79d-1c7aff376d89/service-subscriptions/service-subscription/VIRTUAL%20USP/service-instances/service-instance/2c323333-af4f-4849-af03-c862c0e93e3b", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "e433710f-9217-458d-a79d-1c7aff376d89" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "VIRTUAL USP" - }, - { - "relationship-key": "service-instance.service-instance-id", - "relationship-value": "2c323333-af4f-4849-af03-c862c0e93e3b" - } - ], - "related-to-property": [ { - "property-key": "service-instance.service-instance-name", - "property-value": "kjhgfd1" - }] - }, - { - "related-to": "vserver", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5", - "relationship-data": [ - { - "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" - }, - { - "relationship-key": "cloud-region.cloud-region-id", - "relationship-value": "mtn23a" - }, - { - "relationship-key": "tenant.tenant-id", - "relationship-value": "e6beab145f6b49098277ac163ac1b4f3" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5" - } - ], - "related-to-property": [ { - "property-key": "vserver.vserver-name", - "property-value": "comx5000vm003" - }] - }, - { - "related-to": "vserver", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/14551849-1e70-45cd-bc5d-a256d49548a2", - "relationship-data": [ - { - "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" - }, - { - "relationship-key": "cloud-region.cloud-region-id", - "relationship-value": "mtn23a" - }, - { - "relationship-key": "tenant.tenant-id", - "relationship-value": "e6beab145f6b49098277ac163ac1b4f3" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "14551849-1e70-45cd-bc5d-a256d49548a2" - } - ], - "related-to-property": [ { - "property-key": "vserver.vserver-name", - "property-value": "comx5000vm002" - }] - }, - { - "related-to": "vserver", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/48bd7f11-408f-417c-b834-b41c1b98f7d7", - "relationship-data": [ - { - "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" - }, - { - "relationship-key": "cloud-region.cloud-region-id", - "relationship-value": "mtn23a" - }, - { - "relationship-key": "tenant.tenant-id", - "relationship-value": "e6beab145f6b49098277ac163ac1b4f3" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "48bd7f11-408f-417c-b834-b41c1b98f7d7" - } - ], - "related-to-property": [ { - "property-key": "vserver.vserver-name", - "property-value": "comx5000vm001" - }] - } - ]}, - - - - "l-interfaces": { - "l-interface": [ - { - "interface-name": "example-interface-name-val-50593", - "interface-role": "example-interface-role-val-23375", - "v6-wan-link-ip": "example-v6-wan-link-ip-val-5921", - "selflink": "example-selflink-val-75663", - "interface-id": "example-interface-id-val-37465", - "macaddr": "example-macaddr-val-62657", - "network-name": "example-network-name-val-7252", - "management-option": "example-management-option-val-32963", - "interface-description": "example-interface-description-val-89453", - "is-port-mirrored": true, - "vlans": { - "vlan": [ - { - "vlan-interface": "example-vlan-interface-val-16684", - "vlan-id-inner": 8602916, - "vlan-id-outer": 97348542, - "speed-value": "example-speed-value-val-90330", - "speed-units": "example-speed-units-val-15849", - "vlan-description": "example-vlan-description-val-46942", - "backdoor-connection": "example-backdoor-connection-val-78445", - - "orchestration-status": "example-orchestration-status-val-44994", - - - - "l3-interface-ipv4-address-list": [ - { - "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-90277", - "l3-interface-ipv4-prefix-length": 3364150, - "vlan-id-inner": 44021171, - "vlan-id-outer": 55708677, - "is-floating": true, - "neutron-network-id": "example-neutron-network-id-val-43267", - "neutron-subnet-id": "example-neutron-subnet-id-val-62870" - } - ], - "l3-interface-ipv6-address-list": [ - { - "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-45323", - "l3-interface-ipv6-prefix-length": 56688923, - "vlan-id-inner": 5703071, - "vlan-id-outer": 86682265, - "is-floating": true, - "neutron-network-id": "example-neutron-network-id-val-28366", - "neutron-subnet-id": "example-neutron-subnet-id-val-53034" - } - ] - } - ] - }, - "sriov-vfs": { - "sriov-vf": [ - { - "pci-id": "example-pci-id-val-4720", - "vf-vlan-filter": "example-vf-vlan-filter-val-42594", - "vf-mac-filter": "example-vf-mac-filter-val-13375", - "vf-vlan-strip": true, - "vf-vlan-anti-spoof-check": true, - "vf-mac-anti-spoof-check": true, - "vf-mirrors": "example-vf-mirrors-val-6057", - "vf-broadcast-allow": true, - "vf-unknown-multicast-allow": true, - "vf-unknown-unicast-allow": true, - "vf-insert-stag": true, - "vf-link-status": "example-vf-link-status-val-81448", - "neutron-network-id": "example-neutron-network-id-val-9504" - } - ] - }, - "l-interfaces": { - "l-interface": [ - { - "interface-name": "example-interface-name-val-16738", - "interface-role": "example-interface-role-val-13943", - "v6-wan-link-ip": "example-v6-wan-link-ip-val-63173", - "selflink": "example-selflink-val-43085", - "interface-id": "example-interface-id-val-51379", - "macaddr": "example-macaddr-val-16195", - "network-name": "example-network-name-val-45683", - "management-option": "example-management-option-val-78983", - "interface-description": "example-interface-description-val-34414", - "is-port-mirrored": true - } - ] - }, - "l3-interface-ipv4-address-list": [ - { - "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-99078", - "l3-interface-ipv4-prefix-length": 55755841, - "vlan-id-inner": 81525473, - "vlan-id-outer": 90908072, - "is-floating": true, - "neutron-network-id": "example-neutron-network-id-val-47919", - "neutron-subnet-id": "example-neutron-subnet-id-val-84236" - } - ], - "l3-interface-ipv6-address-list": [ - { - "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-21939", - "l3-interface-ipv6-prefix-length": 50057584, - "vlan-id-inner": 75774660, - "vlan-id-outer": 4421090, - "is-floating": true, - "neutron-network-id": "example-neutron-network-id-val-46377", - "neutron-subnet-id": "example-neutron-subnet-id-val-16585" - } - ] - } - ] - }, - "lag-interfaces": { - "lag-interface": [ - { - "interface-name": "example-interface-name-val-39234", - "interface-description": "example-interface-description-val-1037", - "speed-value": "example-speed-value-val-1929", - "speed-units": "example-speed-units-val-74937", - "interface-id": "example-interface-id-val-91265", - "interface-role": "example-interface-role-val-19613", - - - "l-interfaces": { - "l-interface": [ - { - "interface-name": "example-interface-name-val-10722", - "interface-role": "example-interface-role-val-95194", - "v6-wan-link-ip": "example-v6-wan-link-ip-val-24328", - "selflink": "example-selflink-val-24987", - "interface-id": "example-interface-id-val-75726", - "macaddr": "example-macaddr-val-36940", - "network-name": "example-network-name-val-65359", - "management-option": "example-management-option-val-49521", - "interface-description": "example-interface-description-val-70528", - "is-port-mirrored": true, - "vlans": { - "vlan": [ - { - "vlan-interface": "example-vlan-interface-val-70827", - "vlan-id-inner": 55659612, - "vlan-id-outer": 90335612, - "speed-value": "example-speed-value-val-54761", - "speed-units": "example-speed-units-val-91398", - "vlan-description": "example-vlan-description-val-17018", - "backdoor-connection": "example-backdoor-connection-val-4021", - - "orchestration-status": "example-orchestration-status-val-18315", - - - "l3-interface-ipv4-address-list": [ - { - "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-59336", - "l3-interface-ipv4-prefix-length": 57636053, - "vlan-id-inner": 34068397, - "vlan-id-outer": 48570286, - "is-floating": true, - "neutron-network-id": "example-neutron-network-id-val-69862", - "neutron-subnet-id": "example-neutron-subnet-id-val-75795" - } - ], - "l3-interface-ipv6-address-list": [ - { - "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-15038", - "l3-interface-ipv6-prefix-length": 42694503, - "vlan-id-inner": 15929806, - "vlan-id-outer": 87413856, - "is-floating": true, - "neutron-network-id": "example-neutron-network-id-val-52519", - "neutron-subnet-id": "example-neutron-subnet-id-val-24471" - } - ] - } - ] - }, - "sriov-vfs": { - "sriov-vf": [ - { - "pci-id": "example-pci-id-val-44669", - "vf-vlan-filter": "example-vf-vlan-filter-val-53436", - "vf-mac-filter": "example-vf-mac-filter-val-71902", - "vf-vlan-strip": true, - "vf-vlan-anti-spoof-check": true, - "vf-mac-anti-spoof-check": true, - "vf-mirrors": "example-vf-mirrors-val-54963", - "vf-broadcast-allow": true, - "vf-unknown-multicast-allow": true, - "vf-unknown-unicast-allow": true, - "vf-insert-stag": true, - "vf-link-status": "example-vf-link-status-val-1546", - "neutron-network-id": "example-neutron-network-id-val-92159" - } - ] - }, - "l-interfaces": { - "l-interface": [ - { - "interface-name": "example-interface-name-val-9327", - "interface-role": "example-interface-role-val-21859", - "v6-wan-link-ip": "example-v6-wan-link-ip-val-21445", - "selflink": "example-selflink-val-6085", - "interface-id": "example-interface-id-val-39854", - "macaddr": "example-macaddr-val-14433", - "network-name": "example-network-name-val-3722", - "management-option": "example-management-option-val-64739", - "interface-description": "example-interface-description-val-5814", - "is-port-mirrored": true - - - - } - ] - }, - "l3-interface-ipv4-address-list": [ - { - "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-64531", - "l3-interface-ipv4-prefix-length": 66545882, - "vlan-id-inner": 12194134, - "vlan-id-outer": 29589286, - "is-floating": true, - "neutron-network-id": "example-neutron-network-id-val-91108", - "neutron-subnet-id": "example-neutron-subnet-id-val-56984" - } - ], - "l3-interface-ipv6-address-list": [ - { - "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-37408", - "l3-interface-ipv6-prefix-length": 5116459, - "vlan-id-inner": 39229896, - "vlan-id-outer": 15091934, - "is-floating": true, - "neutron-network-id": "example-neutron-network-id-val-87700", - "neutron-subnet-id": "example-neutron-subnet-id-val-37352" - } - ] - } - ] - } - } - ] - }, - "vf-modules": { - "vf-module": [ - { - "vf-module-id": "example-vf-module-id-val-56249", - "vf-module-name": "example-vf-module-name-val-18987", - "heat-stack-id": "example-heat-stack-id-val-80110", - "orchestration-status": "example-orchestration-status-val-8226", - "is-base-vf-module": true, - "model-invariant-id": "example-model-invariant-id-val-5071", - "model-version-id": "example-model-version-id-val-80793", - "model-customization-id": "example-model-customization-id-val-83277", - "widget-model-id": "example-widget-model-id-val-99814", - "widget-model-version": "example-widget-model-version-val-22799", - "contrail-service-instance-fqdn": "example-contrail-service-instance-fqdn-val-52133", - "module-index": 1933, - "selflink": "example-selflink-val-69992" - } - ] - }, - "licenses": { - "license": [ - { - "group-uuid": "example-group-uuid-val-73012", - "resource-uuid": "example-resource-uuid-val-80045" - } - ] - }, - "entitlements": { - "entitlement": [ - { - "group-uuid": "example-group-uuid-val-14874", - "resource-uuid": "example-resource-uuid-val-49146" - } - ] - } - -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_pserverByVnfId.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_pserverByVnfId.json deleted file mode 100644 index 1059d8c9a9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/AAI_pserverByVnfId.json +++ /dev/null @@ -1,72 +0,0 @@ - { - - "result": [{ - - "hostname": "8862-PserverHOSTNAME-LB1113", - "equipType": "JUNIPER UCPE", - "equipVendor": "JUNIPER", - "equipModel": "QFX51010-PNF", - "ipv4OamAddress": "190.8.5.199", - "serialNumber": "VX986001PNF", - "pserverId": "5715CE4F-8600-58E103FE60C79", - "internetTopology": "WAN", - "inMaint": false, - "resourceVersion": "1500495668780", - "pserverName2": "test81600", - "relationshipList": { - "relationship": [ - { - "relatedTo": "vserver", - "relatedLink": "/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/8862-tenantl-LB1113/vservers/vserver/8862-Lvserver-LB1113", - "relationshipData": [ - { - "relationshipKey": "cloud-region.cloud-owner", - "relationshipValue": "att-aic" - }, - { - "relationshipKey": "cloud-region.cloud-region-id", - "relationshipValue": "AAIAIC25" - }, - { - "relationshipKey": "tenant.tenant-id", - "relationshipValue": "8862-tenantl-LB1113" - }, - { - "relationshipKey": "vserver.vserver-id", - "relationshipValue": "8862-Lvserver-LB1113" - } - ], - "relatedToProperty": [ - { - "propertyKey": "vserver.vserver-name", - "propertyValue": "hjZAYKyl5LO" - } - ] - } - ] - }, - "pinterfaces": { - "pinterface": [ - { - "interfaceName": "ge-0/5/8", - "speedValue": "1", - "speedUnits": "GBPS", - "resourceVersion": "1500495668784", - "inMaint": false - }, - { - "interfaceName": "ge-1/5/8", - "speedValue": "1", - "speedUnits": "GBPS", - "resourceVersion": "1500495668788", - "inMaint": false - } - ] - } - } - - - - ] -} - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/mockObject.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/mockObject.json deleted file mode 100644 index 2f97b47dd3..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/AAI/mockObject.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "id" : "something", - "resource-version" : "1234", - "plural" : { - "singular" : [{ - "id" : "something2", - "resource-version" : "5678" - }] - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/APPC/appc_error.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/APPC/appc_error.json deleted file mode 100644 index e28878d1aa..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/APPC/appc_error.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "output": { - "status": { - "code": 200, - "message": "RESULT_MESSAGE" - }, - "common-header": { - "api-ver": "API_VERSION", - "request-id": "ECOMP_REQUEST_ID", - "originator-id": "ECOMP_SYSTEM_ID", - "sub-request-id": "ECOMP_SUBREQUEST_ID", - "timestamp": "2016-08-08T23:09:00.11Z", - "flags": { - "ttl": 1000, - "force": "TRUE", - "mode": "EXCLUSIVE" - } - }, - "locked": "TRUE" - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf deleted file mode 100644 index 19f18cce52..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf +++ /dev/null @@ -1,107 +0,0 @@ -{ - "transactionId": "testRequestId", - "requestId": "testRequestId", - "requestState": "complete", - "statusMessage": "", - "solutionInfo": { - "licenseInfo": [ - { - "entitlementPoolList": [ - "f1d563e8-e714-4393-8f99-cc480144a05e", - "j1d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupList": [ - "s1d563e8-e714-4393-8f99-cc480144a05e", - "b1d563e8-e714-4393-8f99-cc480144a05e" - ], - "resourceModuleName": "vHNPortalaaS_primary_1", - "serviceResourceId": "testResourceIdAR" - }, - { - "entitlementPoolList": [ - "91d563e8-e714-4393-8f99-cc480144a05e", - "21d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupList": [ - "31d563e8-e714-4393-8f99-cc480144a05e", - "71d563e8-e714-4393-8f99-cc480144a05e" - ], - "resourceModuleName": "vHNPortalaaS_secondary_1", - "serviceResourceId": "testResourceIdVNF" - } - ], - "placement": [ - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "MDTNJ01" - }, - { - "variableName": "aicClli", - "variableValue": "KDTNJ01" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "dfwtx", - "inventoryType": "service", - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceInstanceId": "testSIID1", - "serviceResourceId": "testResourceIdAR" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "testVnfHostname2" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClli2" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionId2", - "inventoryType": "service", - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceInstanceId": "testSIID2", - "serviceResourceId": "testResourceIdAR2" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClli3" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionId3", - "inventoryType": "cloud", - "resourceModuleName": "VNF", - "serviceInstanceId": "", - "serviceResourceId": "testResourceIdVNF" - } - ] - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net deleted file mode 100644 index 5a9ef4b4f9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net +++ /dev/null @@ -1,165 +0,0 @@ -{ - "transactionId": "testRequestId", - "requestId": "testRequestId", - "requestState": "complete", - "statusMessage": "", - "solutionInfo": { - "licenseInfo": [ - { - "entitlementPoolList": [ - "f1d563e8-e714-4393-8f99-cc480144a05e", - "j1d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupList": [ - "s1d563e8-e714-4393-8f99-cc480144a05e", - "b1d563e8-e714-4393-8f99-cc480144a05e" - ], - "resourceModuleName": "vHNPortalaaS_primary_1", - "serviceResourceId": "testResourceIdAR" - }, - { - "entitlementPoolList": [ - "f1d563e8-e714-4393-8f99-cc480144a05n", - "j1d563e8-e714-4393-8f99-cc480144a05n" - ], - "licenseKeyGroupList": [ - "s1d563e8-e714-4393-8f99-cc480144a05n", - "b1d563e8-e714-4393-8f99-cc480144a05n" - ], - "resourceModuleName": "net", - "serviceResourceId": "testResourceIdNet2" - }, - { - "entitlementPoolList": [ - "91d563e8-e714-4393-8f99-cc480144a05e", - "21d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupList": [ - "31d563e8-e714-4393-8f99-cc480144a05e", - "71d563e8-e714-4393-8f99-cc480144a05e" - ], - "resourceModuleName": "vHNPortalaaS_secondary_1", - "serviceResourceId": "testResourceIdVNF" - } - ], - "placement": [ - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "MDTNJ01" - }, - { - "variableName": "aicClli", - "variableValue": "KDTNJ01" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "dfwtx", - "inventoryType": "service", - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceInstanceId": "testSIID1", - "serviceResourceId": "testResourceIdAR" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "testVnfHostname2" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClli2" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionId2", - "inventoryType": "service", - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceInstanceId": "testSIID2", - "serviceResourceId": "testResourceIdAR2" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "testVnfHostNameNet" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClliNet" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionIdNet", - "inventoryType": "service", - "resourceModuleName": "NETWORK", - "serviceInstanceId": "testServiceInstanceIdNet", - "serviceResourceId": "testResourceIdNet" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClliNet2" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionIdNet2", - "inventoryType": "cloud", - "resourceModuleName": "NETWORK", - "serviceInstanceId": "", - "serviceResourceId": "testResourceIdNet2" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClli3" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionId3", - "inventoryType": "cloud", - "resourceModuleName": "VNF", - "serviceInstanceId": "", - "serviceResourceId": "testResourceIdVNF" - } - ] - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound deleted file mode 100644 index 5cb748ae9d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound +++ /dev/null @@ -1,15 +0,0 @@ -{ - "requestState": "", - "responseTime": "", - "solutionInfo": { - "placement": [], - "licenseInfo": { - "featureGroupId": "" - } - }, - "percentProgress": "", - "requestId": "02c2e322-5839-4c97-9d46-0a5fa6bb642e", - "startTime": "", - "statusMessage": "No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8", - "requestType": "" -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException deleted file mode 100644 index b82688428e..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException +++ /dev/null @@ -1,9 +0,0 @@ -{ - "requestError": { - "policyException": { - "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", - "text": "Message content size exceeds the allowable limit", - "messageId": "SVC0001" - } - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException deleted file mode 100644 index 6cc78a7cdb..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException +++ /dev/null @@ -1,12 +0,0 @@ -{ - "requestError": { - "serviceException": { - "variables": [ - "severity", 400 - ], - "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", - "text": "SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8", - "messageId": "SVC0001" - } - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml deleted file mode 100644 index 40eca5a038..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - att-aic - RDM2WAGPLCP - 2.5 - RDM2WAGPLCP - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml deleted file mode 100644 index 1bf6df0d1f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - att-aic - RDM2WAGPLCP - 3.0 - RDM2WAGPLCP - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_400.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_400.xml deleted file mode 100644 index a5640b2b26..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_400.xml +++ /dev/null @@ -1,6 +0,0 @@ - - -680bd458-5ec1-4a16-b77c-509022e53450INTERNAL -400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data -true - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_500.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_500.xml deleted file mode 100644 index 07730e2df9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_500.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - JBoss Web/7.2.2.Final-redhat-1 - JBWEB000064: Error report - - - - -

JBWEB000065: HTTP Status 500 - java.lang.NullPointerException

-
-

- JBWEB000309: type - JBWEB000066: Exception report -

-

- JBWEB000068: message - java.lang.NullPointerException -

-

- JBWEB000069: description - JBWEB000145: The server encountered an internal error that - prevented it from fulfilling this request. - -

-

- JBWEB000070: exception -

org.jboss.resteasy.spi.UnhandledException:
-				java.lang.NullPointerException
-				org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365)
-				org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233)
-				org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209)
-				org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557)
-				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
-				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
-				org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
-				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
-				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
-				javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
-				org.openecomp.mso.logger.LogFilter.doFilter(LogFilter.java:35)
-			
-

-

- JBWEB000071: root cause -

java.lang.NullPointerException
-				org.openecomp.mso.adapters.network.NetworkAdapterRest$CreateNetworkVolumesTask.run(NetworkAdapterRest.java:128)
-				org.openecomp.mso.adapters.network.NetworkAdapterRest.createNetwork(NetworkAdapterRest.java:64)
-				sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
-				sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
-				sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
-				java.lang.reflect.Method.invoke(Method.java:606)
-				org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
-				org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
-				org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
-				org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
-				org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
-				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
-				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
-				org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
-				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
-				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
-				javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
-				org.openecomp.mso.logger.LogFilter.doFilter(LogFilter.java:35)
-			
-

-

- JBWEB000072: note - JBWEB000073: The full stack trace of the root cause is available - in the JBoss Web/7.2.2.Final-redhat-1 logs. - -

-
-

JBoss Web/7.2.2.Final-redhat-1

- - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_Success.xml deleted file mode 100644 index b40bd07a9d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_Success.xml +++ /dev/null @@ -1,24 +0,0 @@ - - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 - - - - RDM2WAGPLCP - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - - - true - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - CONTRAIL_EXTERNAL - false - c4f4e878-cde0-4b15-ae9a-bda857759cea - 7dd5365547234ee8937416c65507d266 - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryInstance_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryInstance_Success.xml deleted file mode 100644 index 09f01fb7ca..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryInstance_Success.xml +++ /dev/null @@ -1,4 +0,0 @@ - - service-instance - https://aai-conexus-e2e.test.com:8443/aai/v8/business/customers/customer/8310000058863/service-subscriptions/service-subscription/vMOG/service-instances/service-instance/f70e927b-6087-4974-9ef8-c5e4d5847ca4 - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName2_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName2_AAIResponse_Success.xml deleted file mode 100644 index b2d9ce2c5d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName2_AAIResponse_Success.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4_3 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - pending-create - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-create - true - - - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNameActive_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNameActive_AAIResponse_Success.xml deleted file mode 100644 index 4dfd8d3f12..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNameActive_AAIResponse_Success.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_2 - CONTRAIL_EXTERNAL - dmz_direct - contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - active - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - active - true - subnetName - - - - - 413 - 4132176 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - route-table-reference - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_404.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_404.xml deleted file mode 100644 index 5cda12da2f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_404.xml +++ /dev/null @@ -1,19 +0,0 @@ - - 404 - HTTP method: GET Not Found - <Fault> - <requestError> - <serviceException> - <messageId>SVC3001</messageId> - <text>Resource not found for %1 using id %2 (msg=%3) (ec=%4)</text> - <variables> - <variable>GETl3Networks</variable> - <variable xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/> - <variable>Node Not Found:No Node of type l3Network found for properties: (network-id = null)</variable> - <variable>ERR.5.4.6114</variable> - </variables> - </serviceException> - </requestError> -</Fault> - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml deleted file mode 100644 index 77e3a649fb..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - pending-create - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-create - true - - - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_404.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_404.xml deleted file mode 100644 index 5cda12da2f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_404.xml +++ /dev/null @@ -1,19 +0,0 @@ - - 404 - HTTP method: GET Not Found - <Fault> - <requestError> - <serviceException> - <messageId>SVC3001</messageId> - <text>Resource not found for %1 using id %2 (msg=%3) (ec=%4)</text> - <variables> - <variable>GETl3Networks</variable> - <variable xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/> - <variable>Node Not Found:No Node of type l3Network found for properties: (network-id = null)</variable> - <variable>ERR.5.4.6114</variable> - </variables> - </serviceException> - </requestError> -</Fault> - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml deleted file mode 100644 index fb8c365844..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - pending-create - networkName - false - true - false - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-create - true - subnetName - - - - - 413 - 4132176 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - network-policy - https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg - - network-policy.network-policy-id - cee6d136-e378-4678-a024-2cd15f0ee0cg - - - - route-table-reference - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml deleted file mode 100644 index 6e33a532af..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - pending-create - networkName - false - true - false - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-create - true - subnetName - true - - - string - 192.10.16.0/24 - 192.10.16.100/24 - ip-address - - - string - 192.110.17.0/24 - 192.110.17.110/24 - ip-address - - - - - - - 413 - 4132176 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - network-policy - https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg - - network-policy.network-policy-id - cee6d136-e378-4678-a024-2cd15f0ee0cg - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml deleted file mode 100644 index 02a280da58..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - 9a7b327d9-287aa00-82c4b0-105757 - GN_EVPN_Test - 13979:105757 - 13979:105757 - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml deleted file mode 100644 index 52e9692b4d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - 5938baec-03ca-2bd5-a3f1-d54x123e253a - refFQDN1 - 12345 - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml deleted file mode 100644 index ddae6b1182..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - 5938baec-03ca-2bd5-a3f1-d54x123e253a - refFQDN2 - 12345 - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBindingList_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBindingList_AAIResponse_Success.xml deleted file mode 100644 index d1b7ea7cdf..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBindingList_AAIResponse_Success.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - 9a7b327d9-287aa00-82c4b0-105757 - GN_EVPN_Test - - - 13979:105708 - EXPORT - 1504025599510 - - - 13979:105707 - IMPORT - 1504025599519 - - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ - - l3-network.network-id - 689ec39e-c5fc-4462-8db2-4f760763ad28 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ - - l3-network.network-id - 1a49396b-19b3-40a4-8792-aa2fbd0f0704 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ - - l3-network.network-id - 774f3329-3c83-4771-86c7-9e6207cd50fd - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml deleted file mode 100644 index 19aac50ee4..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - 9a7b327d9-287aa00-82c4b0-105757 - GN_EVPN_Test - 13979:105757 - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ - - l3-network.network-id - 689ec39e-c5fc-4462-8db2-4f760763ad28 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ - - l3-network.network-id - 1a49396b-19b3-40a4-8792-aa2fbd0f0704 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ - - l3-network.network-id - 774f3329-3c83-4771-86c7-9e6207cd50fd - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml deleted file mode 100644 index eedbda9343..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml deleted file mode 100644 index e6af14123e..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - 79ec9006-3695-4fcc-93a8-be6f9e248beb - 200 - OK - - <output xmlns="com:att:sdnctl:generic-resource"><response-message></response-message><svc-request-id>79ec9006-3695-4fcc-93a8-be6f9e248beb</svc-request-id><service-response-information><instance-id>f805ec2b-b4d8-473e-8325-67f110139e5d</instance-id></service-response-information><response-code>200</response-code><network-response-information><instance-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</instance-id><object-path>restconf/config/GENERIC-RESOURCE-API:services/service/f805ec2b-b4d8-473e-8325-67f110139e5d/service-data/networks/network/f7e4db56-aab5-4065-8e65-cec1cd1de24f</object-path></network-response-information><ack-final-indicator>Y</ack-final-indicator></output> - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml deleted file mode 100644 index 40bb93bda0..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - testRequestId - 200 - OK - - <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/DoCreateServiceInstanceInput.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/DoCreateServiceInstanceInput.json deleted file mode 100644 index 0d8a22c920..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/DoCreateServiceInstanceInput.json +++ /dev/null @@ -1,42 +0,0 @@ -{ -"requestDetails": { -"modelInfo": { -"modelType": "service", -"modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", -"modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", -"modelName": "Test", -"modelVersion": "1.0" -}, -"cloudConfiguration": { -"lcpCloudRegionId": "mdt1", -"tenantId": "88a6ca3ee0394ade9403f075db23167e" -}, -"owningEntity": { -"owningEntityId": "a", -"owningEntityName": "a" -}, -"project": { -"projectName": "temp project" -}, -"subscriberInfo": { -"globalSubscriberId": "some subscriber id", -"subscriberName": "some subscriber name" -}, -"requestInfo": { -"productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", -"source": "VID", -"suppressRollback": true, -"requestorId": "az2016" -}, -"requestParameters": { -"subscriptionServiceType": "MOG", -"aLaCarte": false, -"userParams": [ -{ -"name": "someUserParam", -"value": "someValue" -} -] -} -} -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/SetupServiceDecompJson.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/SetupServiceDecompJson.json deleted file mode 100644 index c2cc687066..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/SetupServiceDecompJson.json +++ /dev/null @@ -1,33 +0,0 @@ -{ -"requestDetails": { - "serviceInstance":{ - "serviceInstanceId": "MSORefactorTest1", - "serviceInstanceName": "bensServiceInstance", - "serviceType": "refactorServiceType", - "serviceRole": "abc", - "modelInvariantUuid": "9647dfc4-2083-11e7-93ae-92361f002671", - "modelUuid": "5df8b6de-2083-11e7-93ae-92361f002671", - "modelVersion": "1.0", - "modelName": "MSOTADevInfra_vSAMP10a_Service", - "environmentContext": "a", - "workloadContext": "b" - }, - "project":{ - "projectName": "MSORefactorTest1" - }, - "owningEntity":{ - "owningEntityId": "MSORefactorTestId123", - "owningEntityName": "MSORefactorTest1" - }, - "customer":{ - "subscriptionServiceType": "refactorServiceType", - "globalSubscriberId": "MSO_1806_Refactor" - }, - "request":{ - "sdncRequestId": "abc", - "callbackURL": "abc", - "requestId": "md5621", - "productFamilyId": "abc" - } -} -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_createServiceInstance_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_createServiceInstance_AAIResponse_Success.xml deleted file mode 100644 index eedbda9343..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_createServiceInstance_AAIResponse_Success.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml deleted file mode 100644 index be820b83b1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - 8310000058863 - Mobility - INFRA - 1452288058 - - - vMOG - 1452288058 - - - f70e927b-6087-4974-9ef8-c5e4d5847ca4 - gg0e927b-6087-5574-9ef8-c5e4d5847db5 - V1.0 - vMOG-AKRON-1234 - 1462561835 - - - - - - - tenant - https://aai-conexus-e2e.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/396d61752cf04c3b8ca2afcb4ee049e9/ - - tenant.tenant-id - 396d61752cf04c3b8ca2afcb4ee049e9 - - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - AAIAIC25 - - - tenant.tenant-name - vMOG-AKRON-PROD - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml deleted file mode 100644 index 1ede44427a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - {{MESSAGE-ID}} - INTERNAL - Exception during create VF Create VF Module: Unable to determine specific VF Module Type: Nimbus_LU2_PXMC_Svc/PXMC_09_20_2016_v2 3::Pxmc09202016V2..pxmc_base.yaml..module-2 with version = 3.0 - true - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml deleted file mode 100644 index a421355aba..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - {{MESSAGE-ID}} - true - d485ecee-957c-4a0a-8b95-27a22b90103f - - - mmsc_vol_1 - a73e0fe9-1ce8-49c2-8fef-e2788605be29 - - - mmsc_vol_2 - 37b6455a-5ea8-463a-89e3-0efeaf7b7c6d - - - nemsfe_vol_1 - b7ff1c21-d138-49a3-bf13-4cfd91efaf48 - - - nemsbe_vol_1 - a5988471-cd42-44d8-b078-64f2f13d3d4c - - - mmsc_vol_5 - f7b91c1e-ab8c-413a-a850-ba80a246c7e0 - - - nemsfe_vol_2 - 957ea3f3-2d4a-4707-bfd2-ba66f42037c2 - - - mmsc_vol_3 - de6fccfe-d61a-48b0-b03b-87bf1bf749b3 - - - mmsc_vol_4 - 76162310-2c38-4c32-981c-5c2880190077 - - - - RDM2WAGPLCP - e585e4f4-9452-437a-b294-45a2d6d3b7a3 - - c30b9453-4b68-4c2e-aacf-58a5ba648bf5 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - - 1bbab536a19b4756926e7d0ec1eb543c - true - 78987 - ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef - - ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeRequest.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeRequest.xml deleted file mode 100644 index 458426660e..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeRequest.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - 123abc - d8d4fcfa-fd7e-4413-b19d-c95aa67291b8 - CREATE_VF_MODULE_VOL - SoapUI-bns-create-base-vol-1001-1 - - - Test/vSAMP12 - vSAMP12::base::module-0 - - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MDTWNJ21 - 897deadc2b954a6bac6d3c197fb3525e - MSOTESTVOL101a-vSAMP12_base_vol_module-0 - - - - value1" - value2" - value3" - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/GenericVnf.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/GenericVnf.xml deleted file mode 100644 index 4c18356bf9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/GenericVnf.xml +++ /dev/null @@ -1,38 +0,0 @@ - - TEST-VNF-ID-0123 - STMTN5MMSC20 - pcrf-capacity - SDN-MOBILITY - vPCRF - pending-create - false - false - introvert - 2.0 - 0000020 - - - lukewarm - PCRF::module-0-0 - introvert - 2.0 - true - fastburn - pending-create - 0000074 - - - supercool - PCRF::module-1-0 - extrovert - 2.0 - false - slowburn - pending-create - 0000075 - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml deleted file mode 100644 index 6ab9416617..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - {{MESSAGE-ID}} - true - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json deleted file mode 100644 index 1af452143e..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "requestDetails": { - "modelInfo": { - "modelType": "volumeGroup", - "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12::base::module-0", - "modelVersion": "1", - "modelCustomizationUuid": "ee6478e5-ea33-3346-ac12-ab121484a3fe" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "mdt1", - "tenantId": "88a6ca3ee0394ade9403f075db23167e" - }, - "requestInfo": { - "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", - "source": "VID", - "suppressRollback": false - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "{service-instance-id}", - "modelInfo": { - "modelType": "service", - "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "Test", - "modelVersion": "2.0" - } - } - }, { - "relatedInstance": { - "instanceId": "{vnf-instance-id}", - "modelInfo": { - "modelType": "vnf", - "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12", - "modelVersion": "1", - "modelInstanceName": "vSAMP12" - } - } - } - ], - "requestParameters": { - "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", - "userParams": [ - {"name": "vnfName", "value": "STMTN5MMSC20" }, - {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, - {"name": "vnfNmInformation", "value": "" }, - {"name": "vnfType", "value": "pcrf-capacity" }, - {"name": "vnfId", "value": "skask" }, - {"name": "vnfStackId", "value": "slowburn" }, - {"name": "vnfStatus", "value": "created" }, - {"name": "aicCloudRegion", "value": "MDTWNJ21" }, - {"name": "availabilityZone", "value": "slcp3-esx-az01" }, - {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, - {"name": "vmName", "value": "slcp34246vbc246ceb" }, - {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, - {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" }, - { - "name": "vlc_sctp_b_route_prefixes", - "value": [ - { "interface_route_table_routes_route_prefix": "107.239.41.163/32" }, - { "interface_route_table_routes_route_prefix": "107.239.41.164/32" }, - { "interface_route_table_routes_route_prefix": "107.239.41.165/32" } - ]} - ] - } - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json deleted file mode 100644 index de99a6da56..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "requestDetails": { - "modelInfo": { - "modelType": "volumeGroup", - "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12::base::module-0", - "modelVersion": "1" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "mdt1", - "tenantId": "88a6ca3ee0394ade9403f075db23167e" - }, - "requestInfo": { - "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", - "source": "VID", - "suppressRollback": false - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "{service-instance-id}", - "modelInfo": { - "modelType": "service", - "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "{parent service model name}", - "modelVersion": "1" - } - } - }, { - "relatedInstance": { - "instanceId": "{vnf-instance-id}", - "modelInfo": { - "modelType": "vnf", - "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "Test/vSAMP12", - "modelVersion": "1" - } - } - } - ] - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml deleted file mode 100644 index bff26fa78a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - simpleCinderVolume_201604071 - simpleCinderVolume_201604071 - simpleCinderVolume_201604071 - simple_cinder_master - Pending - 1460134360 - - - tenant - https://aai-ext1.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ - - tenant.tenant-id - 897deadc2b954a6bac6d3c197fb3525e - - - tenant.tenant-name - MSOTest1 - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml deleted file mode 100644 index 1574310474..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml deleted file mode 100644 index 152bafc0eb..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - 94f0f72f-4be1-49ed-8410-702396797163 - MSOTESTVOL103H-vSAMP12_base_vol_module-0 - - Test/vSAMP12 - Pending - 1469203133 - - - tenant - https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/e444c311b27a45dc9522f2370d70f90f/ - - tenant.tenant-id - e444c311b27a45dc9522f2370d70f90f - - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - mtn6 - - - tenant.tenant-name - MSOCustomer1 - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml deleted file mode 100644 index 8d9efb3b39..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - 8424bb3c-c3e7-4553-9662-469649ed9379 - MSOTESTVOL103W-vSAMP12_base_vol_module-0 - - simple_cinder_master - Pending - ee6478e5-ea33-3346-ac12-ab121484a3fe - 1460134360 - - - tenant - https://aai-ext1.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ - - tenant.tenant-id - 897deadc2b954a6bac6d3c197fb3525e - - - tenant.tenant-name - MSOTest1 - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml deleted file mode 100644 index 1574310474..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/getSIUrlById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/getSIUrlById.xml deleted file mode 100644 index 55fdedb66c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/getSIUrlById.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - service-instance - https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml deleted file mode 100644 index 8d9c5c0a43..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml +++ /dev/null @@ -1,62 +0,0 @@ - - 78987 - MSOTESTVOL102a-vSAMP12_base_vol_module-0 - - Test/vSAMP12 - Pending - 0000020 - - - generic-vnf - https://aai-ext1.test.att.com:8443/aai/v8/network/generic-vnfs/generic-vnf/9e48f6ea-f786-46de-800a-d480e5ccc846/ - - generic-vnf.vnf-id - 9e48f6ea-f786-46de-800a-d480e5ccc846 - - - generic-vnf.vnf-name - MSOSTSAMP12-10601 - - - - tenant - https://aai-ext1.test.att.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ - - tenant.tenant-id - fba1bd1e195a404cacb9ce17a9b2b421 - - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - mdt1 - - - tenant.tenant-name - ECOMP_MDT1 - - - - vf-module - https://aai-ext1.test.att.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ - - vf-module.vf-module-id - fba1bd1e195a404cacb9ce17a9b2b421 - - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - mdt1 - - - vf-module.vf-module-name - ECOMP_MDT1 - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModule_VID_request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModule_VID_request.json deleted file mode 100644 index 3b41ff359c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModule_VID_request.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "requestDetails": { - "modelInfo": { - "modelType": "vfModule", - "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "STMTN5MMSC21-MMSC::model-1-0", - "modelVersion": "1", - "modelCustomizationUuid": "ee6478e5-ea33-3346-ac12-ab121484a3fe" - }, - "subscriberInfo": { - "globalSubscriberId": "MSO_1610_dev_id", - "subscriberName": "MSO_1610_dev_name" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "MDTWNJ21", - "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" - }, - "requestInfo": { - "instanceName": "PCRF::module-0-2", - "source": "VID", - "suppressRollback": true - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", - "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", - "modelInfo": { - "modelType": "volumeGroup", - "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12..base..module-0", - "modelVersion": "1" - } - } - }, - { - "relatedInstance": { - "instanceId": "123456", - "modelInfo": { - "modelType": "service", - "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "SERVICE_MODEL_NAME", - "modelVersion": "1.0" - } - } - }, - { - "relatedInstance": { - "instanceId": "skask", - "instanceName": "skask-test", - "modelInfo": { - "modelType": "vnf", - "modelInvariantUuid": "skask", - "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12", - "modelVersion": "1.0", - "modelInstanceName": "vSAMP12 1" - } - } - } - ], - "requestParameters": { - "usePreload": true, - "aLaCarte": false, - "userParams": { - } - } - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModule_VID_request_noPreloads.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModule_VID_request_noPreloads.json deleted file mode 100644 index e6d126eca2..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModule_VID_request_noPreloads.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "requestDetails": { - "modelInfo": { - "modelType": "vfModule", - "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "STMTN5MMSC21-MMSC::model-1-0", - "modelVersion": "1", - "modelCustomizationUuid": "ee6478e5-ea33-3346-ac12-ab121484a3fe" - }, - "subscriberInfo": { - "globalSubscriberId": "MSO_1610_dev_id", - "subscriberName": "MSO_1610_dev_name" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "MDTWNJ21", - "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" - }, - "requestInfo": { - "instanceName": "PCRF::module-0-2", - "source": "VID", - "suppressRollback": true - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", - "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", - "modelInfo": { - "modelType": "volumeGroup", - "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12..base..module-0", - "modelVersion": "1" - } - } - }, - { - "relatedInstance": { - "instanceId": "123456", - "modelInfo": { - "modelType": "service", - "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "SERVICE_MODEL_NAME", - "modelVersion": "1.0" - } - } - }, - { - "relatedInstance": { - "instanceId": "skask", - "instanceName": "skask-test", - "modelInfo": { - "modelType": "vnf", - "modelInvariantUuid": "skask", - "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12", - "modelVersion": "1.0", - "modelInstanceName": "vSAMP12 1" - } - } - } - ], - "requestParameters": { - "usePreload": false, - "userParams": [ - { - "name": "someUserParam", - "value": "someValue" - }, - { - "name": "sgi_protected_subnet_id", - "value": "thisissomefakevalue" - } - ] - } - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModule_VID_request_userParam.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModule_VID_request_userParam.json deleted file mode 100644 index 68de099c16..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModule_VID_request_userParam.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "requestDetails": { - "modelInfo": { - "modelType": "vfModule", - "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "STMTN5MMSC21-MMSC::model-1-0", - "modelVersion": "1", - "modelCustomizationUuid": "ee6478e5-ea33-3346-ac12-ab121484a3fe" - }, - "subscriberInfo": { - "globalSubscriberId": "MSO_1610_dev_id", - "subscriberName": "MSO_1610_dev_name" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "MDTWNJ21", - "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" - }, - "requestInfo": { - "instanceName": "PCRF::module-0-2", - "source": "VID", - "suppressRollback": true - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", - "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", - "modelInfo": { - "modelType": "volumeGroup", - "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12..base..module-0", - "modelVersion": "1" - } - } - }, - { - "relatedInstance": { - "instanceId": "123456", - "modelInfo": { - "modelType": "service", - "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "SERVICE_MODEL_NAME", - "modelVersion": "1.0" - } - } - }, - { - "relatedInstance": { - "instanceId": "skask", - "instanceName": "skask-test", - "modelInfo": { - "modelType": "vnf", - "modelInvariantUuid": "skask", - "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12", - "modelVersion": "1.0", - "modelInstanceName": "vSAMP12 1" - } - } - } - ], - "requestParameters": { - "usePreload": true, - "aLaCarte": false, - "userParams": [{ - "name": "vlc_sctp_b_route_prefixes", - "value": [ - { "interface_route_table_routes_route_prefix": "107.239.41.163/32" }, - { "interface_route_table_routes_route_prefix": "107.239.41.164/32" }, - { "interface_route_table_routes_route_prefix": "107.239.41.165/32" } - ]} - ]} - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DBUpdateResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DBUpdateResponse.xml deleted file mode 100644 index 40e2344f36..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DBUpdateResponse.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Database/DBAdapter.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Database/DBAdapter.xml deleted file mode 100644 index 5a36d741d0..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Database/DBAdapter.xml +++ /dev/null @@ -1 +0,0 @@ -Notified \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml deleted file mode 100644 index 7c30f75497..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml deleted file mode 100644 index 5e0b8c6c54..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - <output xmlns="org:onap:sdnctl:vnf"><svc-request-id>1660b8da-0a94-442d-8ed5-ea079e3c67c8</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><vnf-information><vnf-id>8925b50d-de67-44c1-b984-e7ce7b0f4dae</vnf-id></vnf-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>8925b50d-de67-44c1-b984-e7ce7b0f4dae</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml deleted file mode 100644 index 90c668c576..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - att-aic - RDM2WAGPLCP - 2.5 - RDM2WAGPLCP - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml deleted file mode 100644 index 9b651f25e3..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - att-aic - RDM2WAGPLCP - 3.0 - RDM2WAGPLCP - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteAAIResponse_Failure500_RESTFault.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteAAIResponse_Failure500_RESTFault.xml deleted file mode 100644 index 4ce7048950..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteAAIResponse_Failure500_RESTFault.xml +++ /dev/null @@ -1,19 +0,0 @@ - - 500 - HTTP method: GET Internal Server Error - <Fault> - <requestError> - <serviceException> - <messageId>SVC3002</messageId> - <text>Error writing output performing %1 on %2 (msg=%3) (ec=%4)</text> - <variables> - <variable>PUT customer</variable> - <variable>SubName32</variable> - <variable>Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [12312442454112] violates a uniqueness constraint [service-instance-id]</variable> - <variable>ERR.5.4.5105</variable> - </variables> - </serviceException> - </requestError> -</Fault> - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml deleted file mode 100644 index a740caacc4..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_BASIC - HSL_direct - contrail - 8bbd3edf-b835-4610-96a2-a5cafa029042 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - active - HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 - - - ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a - 5a77fdc2-7789-4649-a1b9-6eaf1db1813a - 172.16.34.1 - 172.16.34.0 - 28 - 4 - active - true - - - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ - - tenant.tenant-id - e81d842d3e8b45c5a59f57cd76af3aaf - - - - cloud-region - cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP/ - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - RDM2WAGPLCP - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml deleted file mode 100644 index 841cae0a2b..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - bdc5efe8-404a-409b-85f6-0dcc9eebae30 - HSL_direct_net_2 - CONTRAIL_BASIC - HSL_direct - contrail - 8bbd3edf-b835-4610-96a2-a5cafa029042 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - active - HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 - - - ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a - 5a77fdc2-7789-4649-a1b9-6eaf1db1813a - 172.16.34.1 - 172.16.34.0 - 28 - 4 - active - true - - - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ - - tenant.tenant-id - e81d842d3e8b45c5a59f57cd76af3aaf - - - - vf-module - https://aai-app-e2e.ecomp.cci.com:8443/aai/v8/network/generic-vnfs/generic-vnf/105df7e5-0b3b-49f7-a837-4864b62827c4/vf-modules/vf-module/d9217058-95a0-49ee-b9a9-949259e89349/ - - generic-vnf.vnf-id - 105df7e5-0b3b-49f7-a837-4864b62827c4 - - - vf-module.vf-module-id - d9217058-95a0-49ee-b9a9-949259e89349 - - - - generic-vnf - https://aai-app-e2e.test.com:8443/aai/v8/network/generic-vnfs/generic-vnf/45f822d9-73ca-4255-9844-7cef401bbf47/ - - generic-vnf.vnf-id - 45f822d9-73ca-4255-9844-7cef401bbf47 - - - generic-vnf.vnf-name - zrdm1scpx05 - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml deleted file mode 100644 index 8ec4f520c1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - 19174929-3809-49ca-89eb-17f84a035389 - 200 - OK - - <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse_noExtraTag.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse_noExtraTag.xml deleted file mode 100644 index f180e61366..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse_noExtraTag.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - 19174929-3809-49ca-89eb-17f84a035389 - 200 - OK - - <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleCallbackResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleCallbackResponse.xml deleted file mode 100644 index 74a3beb221..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleCallbackResponse.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - 86651f79-057e-4245-8f5f-174db3cef553-1502888133261 - true - 20928949-5230-495d-86a6-f3690b9b5d60 - - - shared_private_network_id - bcd04543-b3d7-4c64-a910-1735b875ebb2 - - - server1_port - d1605e82-50ba-4544-9f8d-a8a37b678046 - - - vnf_id - 7da56895-6be1-4bec-856b-525e0e573199 - - - 7da56895-6be1-4bec-856b-525e0e573199 - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml deleted file mode 100644 index 25aa45afd9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - {{MESSAGE-ID}} - true - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json deleted file mode 100644 index 52ead5f77f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "requestDetails": { - "modelInfo": { - "modelType": "volumeGroup", - "modelInvariantUuid": "0b01b8c2-8416-11e6-ae22-56b6b6499611", - "modelName": "vSAMP12::base::module-0", - "modelVersion": "1.0" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "cloudowner_MDTWNJ21", - "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" - }, - "requestInfo": { - "source": "VID" - } - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml deleted file mode 100644 index c02c35f9c9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml +++ /dev/null @@ -1,42 +0,0 @@ - - 78987 - MSOTESTVOL102a-vSAMP12_base_vol_module-0 - - Test/vSAMP12 - Pending - 0000020 - - - generic-vnf - https://aai-ext1.test.com:8443/aai/v8/network/generic-vnfs/generic-vnf/9e48f6ea-f786-46de-800a-d480e5ccc846/ - - generic-vnf.vnf-id - 9e48f6ea-f786-46de-800a-d480e5ccc846 - - - generic-vnf.vnf-name - MSOSTSAMP12-10601 - - - - tenant - https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ - - tenant.tenant-id - fba1bd1e195a404cacb9ce17a9b2b421 - - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - mdt1 - - - tenant.tenant-name - ECOMP_MDT1 - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnf.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnf.xml deleted file mode 100644 index 5e8a62b25b..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnf.xml +++ /dev/null @@ -1,26 +0,0 @@ - - a27ce5a9-29c4-4c22-a017-6615ac73c721 - STMTN5MMSC21 - mmsc-capacity - SDN-MOBILITY - vMMSC - pending-create - false - false - 1508691 - - - 973ed047-d251-4fb9-bf1a-65b8949e0a73 - STMTN5MMSC21-MMSC::module-0-0 - 973ed047-d251-4fb9-bf1a-65b8949e0a73 - 1.0 - true - FILLED-IN-BY-MSO - pending-create - 1508692 - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnfVfModule.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnfVfModule.xml deleted file mode 100644 index 586e0a620a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnfVfModule.xml +++ /dev/null @@ -1,26 +0,0 @@ - - a27ce5a9-29c4-4c22-a017-6615ac73c721 - STMTN5MMSC21 - mmsc-capacity - SDN-MOBILITY - vMMSC - pending-create - false - false - 0000021 - - - 973ed047-d251-4fb9-bf1a-65b8949e0a73 - STMTN5MMSC21-MMSC::module-0-0 - 973ed047-d251-4fb9-bf1a-65b8949e0a73 - 1.0 - true - FILLED-IN-BY-MSO - pending-create - 0000073 - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml deleted file mode 100644 index a421355aba..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - {{MESSAGE-ID}} - true - d485ecee-957c-4a0a-8b95-27a22b90103f - - - mmsc_vol_1 - a73e0fe9-1ce8-49c2-8fef-e2788605be29 - - - mmsc_vol_2 - 37b6455a-5ea8-463a-89e3-0efeaf7b7c6d - - - nemsfe_vol_1 - b7ff1c21-d138-49a3-bf13-4cfd91efaf48 - - - nemsbe_vol_1 - a5988471-cd42-44d8-b078-64f2f13d3d4c - - - mmsc_vol_5 - f7b91c1e-ab8c-413a-a850-ba80a246c7e0 - - - nemsfe_vol_2 - 957ea3f3-2d4a-4707-bfd2-ba66f42037c2 - - - mmsc_vol_3 - de6fccfe-d61a-48b0-b03b-87bf1bf749b3 - - - mmsc_vol_4 - 76162310-2c38-4c32-981c-5c2880190077 - - - - RDM2WAGPLCP - e585e4f4-9452-437a-b294-45a2d6d3b7a3 - - c30b9453-4b68-4c2e-aacf-58a5ba648bf5 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - - 1bbab536a19b4756926e7d0ec1eb543c - true - 78987 - ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef - - ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml deleted file mode 100644 index 803a847bbc..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - 123abc - d8d4fcfa-fd7e-4413-b19d-c95aa67291b8 - CREATE_VF_MODULE_VOL - SoapUI-bns-create-base-vol-1001-1 - - - Test/vSAMP12 - vSAMP12::base::module-0 - false - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MDTWNJ21 - 897deadc2b954a6bac6d3c197fb3525e - MSOTESTVOL101a-vSAMP12_base_vol_module-0 - - - - value1" - value2" - value3" - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml deleted file mode 100644 index e6ada9c826..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - 123abc - d8d4fcfa-fd7e-4413-b19d-c95aa67291b8 - CREATE_VF_MODULE_VOL - SoapUI-bns-create-base-vol-1001-1 - - - Test/vSAMP12 - vSAMP12::base::module-0 - true - - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - MDTWNJ21 - 897deadc2b954a6bac6d3c197fb3525e - MSOTESTVOL101a-vSAMP12_base_vol_module-0 - - - - value1" - value2" - value3" - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/GenericVnf.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/GenericVnf.xml deleted file mode 100644 index 4c18356bf9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/GenericVnf.xml +++ /dev/null @@ -1,38 +0,0 @@ - - TEST-VNF-ID-0123 - STMTN5MMSC20 - pcrf-capacity - SDN-MOBILITY - vPCRF - pending-create - false - false - introvert - 2.0 - 0000020 - - - lukewarm - PCRF::module-0-0 - introvert - 2.0 - true - fastburn - pending-create - 0000074 - - - supercool - PCRF::module-1-0 - extrovert - 2.0 - false - slowburn - pending-create - 0000075 - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml deleted file mode 100644 index 6ab9416617..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - {{MESSAGE-ID}} - true - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_VID_request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_VID_request.json deleted file mode 100644 index 6cc84c79b6..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_VID_request.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "requestDetails": { - "modelInfo": { - "modelType": "volumeGroup", - "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12::base::module-0", - "modelVersion": "1" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "mdt1", - "tenantId": "88a6ca3ee0394ade9403f075db23167e" - }, - "requestInfo": { - "instanceName": "MSOTESTVOL103W-vSAMP12_base_vol_module-0", - "source": "VID", - "callbackUrl": "{do we support this???}" - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "{service-instance-id}", - "modelInfo": { - "modelType": "service", - "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "{parent service model name}", - "modelVersion": "1" - } - } - }, - { - "relatedInstance": { - "instanceId": "{vnf-instance-id}", - "modelInfo": { - "modelType": "vnf", - "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "Test/vSAMP12", - "modelVersion": "1" - } - } - } - ], - "requestParameters": { - "backoutOnFailure": true, - "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", - "userParams": [ - { - "name": "vnfName", - "value": "STMTN5MMSC20" - }, - { - "name": "vnfName2", - "value": "US1117MTSNJVBR0246" - }, - { - "name": "vnfNmInformation", - "value": "" - }, - { - "name": "vnfType", - "value": "pcrf-capacity" - }, - { - "name": "vnfId", - "value": "skask" - }, - { - "name": "vnfStackId", - "value": "slowburn" - }, - { - "name": "vnfStatus", - "value": "created" - }, - { - "name": "aicCloudRegion", - "value": "MDTWNJ21" - }, - { - "name": "availabilityZone", - "value": "slcp3-esx-az01" - }, - { - "name": "oamNetworkName", - "value": "VLAN-OAM-1323" - }, - { - "name": "vmName", - "value": "slcp34246vbc246ceb" - }, - { - "name": "ipagNetworkId", - "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" - }, - { - "name": "vpeNetworkId", - "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" - } - ] - } - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml deleted file mode 100644 index bff26fa78a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - simpleCinderVolume_201604071 - simpleCinderVolume_201604071 - simpleCinderVolume_201604071 - simple_cinder_master - Pending - 1460134360 - - - tenant - https://aai-ext1.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ - - tenant.tenant-id - 897deadc2b954a6bac6d3c197fb3525e - - - tenant.tenant-name - MSOTest1 - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml deleted file mode 100644 index 1574310474..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml deleted file mode 100644 index cb20a41ca0..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - 8424bb3c-c3e7-4553-9662-469649ed9379 - MSOTESTVOL103W-vSAMP12_base_vol_module-0 - - simple_cinder_master - Pending - 1460134360 - - - tenant - https://aai-ext1.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ - - tenant.tenant-id - 897deadc2b954a6bac6d3c197fb3525e - - - tenant.tenant-name - MSOTest1 - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml deleted file mode 100644 index 1574310474..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModule_getVnfResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModule_getVnfResponse.xml deleted file mode 100644 index 021a8a73d1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModule_getVnfResponse.xml +++ /dev/null @@ -1,26 +0,0 @@ - - a27ce5a9-29c4-4c22-a017-6615ac73c721 - STMTN5MMSC21 - mmsc-capacity - SDN-MOBILITY - vMMSC - pending-create - false - false - 1508691 - - - 973ed047-d251-4fb9-bf1a-65b8949e0a73 - STMTN5MMSC21-MMSC::module-0-0 - 973ed047-d251-4fb9-bf1a-65b8949e0a73 - 1.0 - true - FILLED-IN-BY-MSO - pending-create - 1508692 - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/MsoCompletionRequest.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/MsoCompletionRequest.xml deleted file mode 100644 index 37b17121ae..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/MsoCompletionRequest.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - null - DELETE - null - - E2E Service Instance was deleted successfully. - DeleteCustomE2EServiceInstance - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/SDNCDeleteResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/SDNCDeleteResponse.xml deleted file mode 100644 index fd719ff443..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/SDNCDeleteResponse.xml +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - Y - SK-2016-10-22-001 - - - SUCCESS - ERROR - - - 15001417 - - ALPRTR2 - 1.1.1.2 - - 1255.ae81 - VDBE - VIRTUAL - - ALPVDBE1 - 3.1.1.0/22 - ae81 - 3:1:1::0/22 - - - 1995.ae81 - ASBG - VIRTUAL - - ALPASBG1 - 3.1.1.0/22 - ae81 - 3:1:1::0/22 - - - 85.xe-10/0/2 - BGF2 - PHYSICAL - xe-10/0/2 - ALPBGF2 - 3.1.2.0/22 - - 3:1:2::0/22 - - - 85.xe-10/0/1 - BGF1 - PHYSICAL - xe-10/0/1 - ALPBGF1 - 3.1.2.0/22 - - 3:1:2::0/22 - - 2 - - - ALPRTR1 - 1.1.1.1 - - 1255.ae81 - VDBE - VIRTUAL - - ALPVDBE1 - 3.1.1.0/22 - ae81 - 3:1:1::0/22 - - - 1995.ae81 - ASBG - VIRTUAL - - ALPASBG1 - 3.1.1.0/22 - ae81 - 3:1:1::0/22 - - - 85.xe-10/0/2 - BGF2 - PHYSICAL - xe-10/0/2 - ALPBGF2 - 3.1.2.0/22 - - 3:1:2::0/22 - - - 85.xe-10/0/1 - BGF1 - PHYSICAL - xe-10/0/1 - ALPBGF1 - 3.1.2.0/22 - - 3:1:2::0/22 - - 1 - - - - 15001418 - - SANRTR1 - 2.1.1.1 - - 1255.ae81 - VDBE - VIRTUAL - - SANVDBE1 - 4.1.1.0/22 - ae81 - 4:1:1::0/22 - - - 1995.ae81 - ASBG - VIRTUAL - - SANASBG1 - 4.1.1.0/22 - ae81 - 4:1:1::0/22 - - - 85.xe-10/0/2 - BGF2 - PHYSICAL - xe-10/0/2 - SANBGF2 - 4.1.2.0/22 - - 4:1:2::0/22 - - - 85.xe-10/0/1 - BGF1 - PHYSICAL - xe-10/0/1 - SANBGF1 - 4.1.2.0/22 - - 4:1:2::0/22 - - 1 - - - SANRTR2 - 2.1.1.2 - - 1255.ae81 - VDBE - VIRTUAL - - SANVDBE1 - 4.1.1.0/22 - ae81 - 4:1:1::0/22 - - - 1995.ae81 - ASBG - VIRTUAL - - SANASBG1 - 4.1.1.0/22 - ae81 - 4:1:1::0/22 - - - 85.xe-10/0/2 - BGF2 - PHYSICAL - xe-10/0/2 - SANBGF2 - 4.1.2.0/22 - - 4:1:2::0/22 - - - 85.xe-10/0/1 - BGF1 - PHYSICAL - xe-10/0/1 - SANBGF1 - 4.1.2.0/22 - - 4:1:2::0/22 - - 2 - - - COLLABORATE - DISABLE - custid-888 - SII-2016-10-22-001 - CUSTOMER - 100668 - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/aaiGetResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/aaiGetResponse.xml deleted file mode 100644 index c367b5c959..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/aaiGetResponse.xml +++ /dev/null @@ -1,33 +0,0 @@ - - 1234 - volte-service - testservicetype - testservicerole - volte service - c1d4305f-cdbd-4bbe-9069-a2f4978fd89e - d4df5c27-98a1-4812-a8aa-c17f055b7a3f - 1508838121849 - create - - - service-instance - /aai/v11/business/customers/customer/test_customer/service-subscription/example-service-type/service-instance/1234_1 - - customer.global-customer-id - test_customer - - - service-subscription.service-type - test_customer - - - service-instance.service-instance-id - 1234_1 - - - service-instance.service-instance-name - volte-service_vEPC - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getARUrlById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getARUrlById.xml deleted file mode 100644 index e178583a34..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getARUrlById.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - allotted-resource - https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml deleted file mode 100644 index a472996121..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - 2f1cc940-455f-4ee2-9411-a7899cd4f124 - testVnfName123 - mmsc-capacity - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - vMMSC - pending-create - testReVer123 - - - nothing - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ - - l3-network.network-id - c597ab81-fece-49f4-a4f5-710cebb13c29 - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml deleted file mode 100644 index 8ba178cc1c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - 2f1cc940-455f-4ee2-9411-a7899cd4f124 - testVnfName123 - mmsc-capacity - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - vMMSC - pending-create - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ - - l3-network.network-id - c597ab81-fece-49f4-a4f5-710cebb13c29 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ - - l3-network.network-id - 53956c91-6e5e-49aa-88dd-535f57e66e70 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ - - l3-network.network-id - 44e0d9e0-9334-4ec6-9344-07a96dac629f - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ - - l3-network.network-id - ac49d99b-5daf-4624-9f8e-188b126ea166 - - - - - - - - 802767b3-18a6-4432-96db-25522786aee0 - ZRDM1MMSC03 - mmsc-capacity - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - vMMSC - pending-create - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ - - l3-network.network-id - c597ab81-fece-49f4-a4f5-710cebb13c29 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ - - l3-network.network-id - 53956c91-6e5e-49aa-88dd-535f57e66e70 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ - - l3-network.network-id - 44e0d9e0-9334-4ec6-9344-07a96dac629f - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ - - l3-network.network-id - ac49d99b-5daf-4624-9f8e-188b126ea166 - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml deleted file mode 100644 index 8ba178cc1c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - 2f1cc940-455f-4ee2-9411-a7899cd4f124 - testVnfName123 - mmsc-capacity - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - vMMSC - pending-create - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ - - l3-network.network-id - c597ab81-fece-49f4-a4f5-710cebb13c29 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ - - l3-network.network-id - 53956c91-6e5e-49aa-88dd-535f57e66e70 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ - - l3-network.network-id - 44e0d9e0-9334-4ec6-9344-07a96dac629f - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ - - l3-network.network-id - ac49d99b-5daf-4624-9f8e-188b126ea166 - - - - - - - - 802767b3-18a6-4432-96db-25522786aee0 - ZRDM1MMSC03 - mmsc-capacity - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - vMMSC - pending-create - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ - - l3-network.network-id - c597ab81-fece-49f4-a4f5-710cebb13c29 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ - - l3-network.network-id - 53956c91-6e5e-49aa-88dd-535f57e66e70 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ - - l3-network.network-id - 44e0d9e0-9334-4ec6-9344-07a96dac629f - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ - - l3-network.network-id - ac49d99b-5daf-4624-9f8e-188b126ea166 - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getNotFound.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getNotFound.xml deleted file mode 100644 index f66c9c4fb8..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getNotFound.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getParentSIUrlById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getParentSIUrlById.xml deleted file mode 100644 index c29133e539..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getParentSIUrlById.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - service-instance - https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0027%252FSW_INTERNET - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getParentServiceInstance.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getParentServiceInstance.xml deleted file mode 100644 index bc810c6014..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getParentServiceInstance.xml +++ /dev/null @@ -1,30 +0,0 @@ - - MIS/1604/0027/SW_INTERNET - 123456789 - - - cvlan-tag - https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ - - cvlan-tag.cvlan-tag - 2003 - - - port-group.interface-id - slcp1447vbc.ipag - - - vce.vnf-id - 832bace2-3fb0-49e0-a6a4-07c47223c535 - - - - vce - https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ - - vce.vnf-id - 832bace2-3fb0-49e0-a6a4-07c47223c535 - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getSINoRelations.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getSINoRelations.xml deleted file mode 100644 index adb7aab35f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getSINoRelations.xml +++ /dev/null @@ -1,6 +0,0 @@ - - MIS/1604/0026/SW_INTERNET - 123456789 - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml deleted file mode 100644 index 416689e10c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - service-instance - https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getSIUrlByIdVipr.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getSIUrlByIdVipr.xml deleted file mode 100644 index 80b035979a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getSIUrlByIdVipr.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - service-instance - https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/aa8428ac-7dd2-441f-aa3e-e175802574fb - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml deleted file mode 100644 index e377c70474..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml +++ /dev/null @@ -1,30 +0,0 @@ - - MIS/1604/0026/SW_INTERNET - 123456789 - - - cvlan-tag - https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ - - cvlan-tag.cvlan-tag - 2003 - - - port-group.interface-id - slcp1447vbc.ipag - - - vce.vnf-id - 832bace2-3fb0-49e0-a6a4-07c47223c535 - - - - vce - https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ - - vce.vnf-id - 832bace2-3fb0-49e0-a6a4-07c47223c535 - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/ConfigVnf_VID_request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/ConfigVnf_VID_request.json deleted file mode 100644 index 3fc25944f2..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/ConfigVnf_VID_request.json +++ /dev/null @@ -1,40 +0,0 @@ -{ -"requestDetails": { -"modelInfo": { -"modelType": "vnf", -"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", -"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", -"modelName": "vSAMP12", -"modelVersion": "1.0", -"modelCustomizationUuid": "MODEL-ID-1234" -}, -"cloudConfiguration": { -"lcpCloudRegionId": "mdt1", -"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" -}, -"requestInfo": { -"instanceName": "STMTN", -"instanceId": "skask", -"source": "VID", -"suppressRollback": true -}, -"relatedInstanceList": [ -{ -"relatedInstance": { -"instanceId": "MIS%2F1604%2F0026%2FSW_INTERNET", -"modelInfo": { -"modelType": "service", -"modelInvariantUuid": "995256d2-5a33-55df-13ab-12abad84e7ff", -"modelUuid": "ab6478e5-ea33-3346-ac12-ab121484a3fe", -"modelName": "ServicevSAMP12", -"modelVersion": "1.0" -} -} -} -], -"requestParameters": { -"controllerType" : "appc", -"payload": "{\"request-parameters\":{\"host-ip-address\":\"10.10.10.10\"},\"configuration- parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}" -} -} -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/CreateVnfInfraRequest.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/CreateVnfInfraRequest.json deleted file mode 100644 index c1491d128b..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/CreateVnfInfraRequest.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "requestDetails": { - "modelInfo": { - "modelType": "vnf", - "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12", - "modelVersion": "1.0", - "modelInstanceName": "vSAMP12 1", - "modelCustomizationUuid": "customizationId123" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "mdt1", - "tenantId": "88a6ca3ee0394ade9403f075db23167e" - }, - "requestInfo": { - "instanceName": "testVnfName123", - "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", - "source": "VID", - "suppressRollback": false - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "{serviceInstanceId}", - "modelInfo": { - "modelType": "service", - "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "{parent service model name}", - "modelVersion": "1.0" - } - } - } - ], - "requestParameters": { - }, - "platform": { - "platformName": "platform name" - }, - "lineOfBusiness": { - "lineOfBusinessName": "line of business names" - } - } - -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DeleteCustomE2EService.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DeleteCustomE2EService.json deleted file mode 100644 index 00663fddc5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DeleteCustomE2EService.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "globalSubscriberId" : "38829939920000", - "operationId" : "59960003992", - "serviceType" : "VoLTE" -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json deleted file mode 100644 index e8d9fc29b1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "requestDetails": { - "modelInfo": { - "modelType": "vnf", - "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12", - "modelVersion": "1.0", - "modelInstanceName": "vSAMP12 1" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "mdt1", - "tenantId": "88a6ca3ee0394ade9403f075db23167e" - }, - "requestInfo": { - "instanceName": "testVnfName123", - "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", - "source": "VID", - "suppressRollback": false - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "{serviceInstanceId}", - "modelInfo": { - "modelType": "service", - "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "{parent service model name}", - "modelVersion": "1.0" - } - } - } - ], - "requestParameters": { - "cascadeDelete": true - } - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DoCreateServiceInstance_request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DoCreateServiceInstance_request.json deleted file mode 100644 index 640e16b634..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DoCreateServiceInstance_request.json +++ /dev/null @@ -1,186 +0,0 @@ -{ "serviceResources" : { - "modelInfo" : { - "modelName" : "MSOTADevInfra_vSAMP10a_Service", - "modelUuid" : "5df8b6de-2083-11e7-93ae-92361f002671", - "modelInvariantUuid" : "9647dfc4-2083-11e7-93ae-92361f002671", - "modelVersion" : "1.0" - }, - "serviceType" : "PortMirroring", - "serviceRole" : "InfraRole", - "environmentContext" : "Luna", - "workloadContext" : "Oxygen", - "serviceVnfs": [ - - { "modelInfo" : { - "modelName" : "vSAMP10a", - "modelUuid" : "ff2ae348-214a-11e7-93ae-92361f002671", - "modelInvariantUuid" : "2fff5b20-214b-11e7-93ae-92361f002671", - "modelVersion" : "1.0", - "modelCustomizationUuid" : "68dc9a92-214c-11e7-93ae-92361f002671", - "modelInstanceName" : "vSAMP10a 1" - }, - "toscaNodeType" : "VF", - "nfFunction" : null, - "nfType" : null, - "nfRole" : null, - "nfNamingCode" : null, - "multiStageDesign" : null, - "vfModules": [ - { - "modelInfo" : { - "modelName" : "NetworkFqdnTest4", - "modelUuid" : "025606c1-4223-11e7-9252-005056850d2e", - "modelInvariantUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba01a", - "modelVersion" : "2.0", - "modelCustomizationUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba01a" - }, "isBase" : true, - "vfModuleLabel" : "label", - "initialCount" : 0, - "hasVolumeGroup" : true - }, - { - "modelInfo" : { - "modelName" : "NetworkFqdnTest3", - "modelUuid" : "02560575-4223-11e7-9252-005056850d2e", - "modelInvariantUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba0bb", - "modelVersion" : "1.0", - "modelCustomizationUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba0bb" - }, "isBase" : true, - "vfModuleLabel" : "label", - "initialCount" : 0, - "hasVolumeGroup" : false - }, - { - "modelInfo" : { - "modelName" : "NetworkFqdnTest5", - "modelUuid" : "025607e4-4223-11e7-9252-005056850d2e", - "modelInvariantUuid" : "06bd0a18-65c0-4418-83c7-5b0d14cba01a", - "modelVersion" : "1.0", - "modelCustomizationUuid" : "06bd0a18-65c0-4418-83c7-5b0d14cba01a" - }, "isBase" : false, - "vfModuleLabel" : "label", - "initialCount" : 0, - "hasVolumeGroup" : false - }, - { - "modelInfo" : { - "modelName" : "vSAMP10aDEV::PCM::module-2", - "modelUuid" : "7774b4e4-7d37-11e7-bb31-be2e44b06b34", - "modelInvariantUuid" : "93e9c1d2-7d37-11e7-bb31-be2e44b06b34", - "modelVersion" : "2", - "modelCustomizationUuid" : "6728bee8-7d3a-11e7-bb31-be2e44b06b34" - }, "isBase" : false, - "vfModuleLabel" : "PCM", - "initialCount" : 0, - "hasVolumeGroup" : true - }, - { - "modelInfo" : { - "modelName" : "vSAMP10aDEV::PCM::module-1", - "modelUuid" : "066de97e-253e-11e7-93ae-92361f002671", - "modelInvariantUuid" : "64efd51a-2544-11e7-93ae-92361f002671", - "modelVersion" : "2", - "modelCustomizationUuid" : "b4ea86b4-253f-11e7-93ae-92361f002671" - }, "isBase" : false, - "vfModuleLabel" : "PCM", - "initialCount" : 0, - "hasVolumeGroup" : true - }, - { - "modelInfo" : { - "modelName" : "vSAMP10aDEV::base::module-0", - "modelUuid" : "20c4431c-246d-11e7-93ae-92361f002671", - "modelInvariantUuid" : "78ca26d0-246d-11e7-93ae-92361f002671", - "modelVersion" : "2", - "modelCustomizationUuid" : "cb82ffd8-252a-11e7-93ae-92361f002671" - }, "isBase" : true, - "vfModuleLabel" : "base", - "initialCount" : 1, - "hasVolumeGroup" : true - }, - { - "modelInfo" : { - "modelName" : "vSAMP10a::base::module-0", - "modelUuid" : "02560de2-4223-11e7-9252-005056850d2e", - "modelInvariantUuid" : null, - "modelVersion" : "2", - "modelCustomizationUuid" : "MIGRATED_36e76920-ef30-4793-9979-cbd7d4b2bfc4" - }, "isBase" : true, - "vfModuleLabel" : "base", - "initialCount" : 1, - "hasVolumeGroup" : true - }, - { - "modelInfo" : { - "modelName" : "base::module-0", - "modelUuid" : "02561381-4223-11e7-9252-005056850d2e", - "modelInvariantUuid" : null, - "modelVersion" : "1", - "modelCustomizationUuid" : "MIGRATED_51baae4c-b7c7-4f57-b77e-6e01acca89e5" - }, "isBase" : true, - "vfModuleLabel" : "module-0", - "initialCount" : 1, - "hasVolumeGroup" : false - }, - { - "modelInfo" : { - "modelName" : "vSAMP10a::PCM::module-1", - "modelUuid" : "02560f1b-4223-11e7-9252-005056850d2e", - "modelInvariantUuid" : null, - "modelVersion" : "1", - "modelCustomizationUuid" : "MIGRATED_e9be2ed7-45b6-479c-b06e-9093899f8ce8" - }, "isBase" : true, - "vfModuleLabel" : "PCM", - "initialCount" : 1, - "hasVolumeGroup" : true - } - ] - } - ], - "serviceNetworks": [], - "serviceAllottedResources": [ - { - "modelInfo" : { - "modelName" : "Tunnel_Xconn", - "modelUuid" : "f6b7d4c6-e8a4-46e2-81bc-31cad5072842", - "modelInvariantUuid" : "b7a1b78e-6b6b-4b36-9698-8c9530da14af", - "modelVersion" : "1.0", - "modelCustomizationUuid" : "5b9bee43-f537-4fb3-9e8b-4de9f714d28a", - "modelInstanceName" : "Pri_Tunnel_Xconn 9" - }, - "toscaNodeType" : null, - "allottedResourceType" : null, - "allottedResourceRole" : null, - "providingServiceModelInvariantUuid" : null, - "nfFunction" : null, - "nfType" : null, - "nfRole" : null, - "nfNamingCode" : null - } - ], - "serviceConfigs": [ - { - "modelInfo" : { - "modelName" : "Mulder", - "modelUuid" : "025606c1-4fff-11e7-9252-005056850d2e", - "modelInvariantUuid" : "025606c1-4eee-11e7-9252-005056850d2e", - "modelVersion" : "1.0", - "modelCustomizationUuid" : "025606c1-4ddd-11e7-9252-005056850d2e", - "modelInstanceName" : "X_FILES_001" - }, - "toscaNodeType" : "Scully" - }, - { - "modelInfo" : { - "modelName" : "Krychuk", - "modelUuid" : "025606c1-5fff-11e7-9252-005056850d2e", - "modelInvariantUuid" : "025606c1-5eee-11e7-9252-005056850d2e", - "modelVersion" : "1.0", - "modelCustomizationUuid" : "025606c1-5ddd-11e7-9252-005056850d2e", - "modelInstanceName" : "X_FILES_002" - }, - "toscaNodeType" : "Skinner" - } - ] - }} - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json deleted file mode 100644 index dd3ff6841e..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "service": - { - "serviceType":"example-service-type", - "globalSubscriberId":"test_custormer", - "resources": - [ - { - "resourceInstanceId":"ns111", - "scaleType":"SCALE_NS", - "scaleNsData": - { - "scaleNsByStepsData": - { - "numberOfSteps":"4", - "aspectId":"TIC_EDGE_HW", - "scalingDirection":"UP" - } - } - }, - { - "resourceInstanceId":"ns333", - "scaleType":"SCALE_NS", - "scaleNsData": - { - "scaleNsByStepsData": - { - "numberOfSteps":"4", - "aspectId":"TIC_EDGE_HW", - "scalingDirection":"UP" - } - } - } - ], - "serviceInstanceName":"service1" - }, - "operationId":"15c01683-4f15-45e7-b213-dcbfe6f42a1b" - } \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/ReplaceVnf_VID_request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/ReplaceVnf_VID_request.json deleted file mode 100644 index a018f50355..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/ReplaceVnf_VID_request.json +++ /dev/null @@ -1,50 +0,0 @@ -{ -"requestDetails": { -"modelInfo": { -"modelType": "vnf", -"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", -"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", -"modelName": "vSAMP12", -"modelVersion": "1.0", -"modelCustomizationUuid": "MODEL-ID-1234" -}, -"cloudConfiguration": { -"lcpCloudRegionId": "mdt1", -"tenantId": "88a6ca3ee0394ade9403f075db23167e" -}, -"requestInfo": { -"instanceName": "STMTN", -"instanceId": "a27ce5a9-29c4-4c22-a017-6615ac73c721", -"source": "VID", -"suppressRollback": true -}, -"relatedInstanceList": [ -{ -"relatedInstance": { -"instanceId": "MIS%2F1604%2F0026%2FSW_INTERNET", -"modelInfo": { -"modelType": "service", -"modelInvariantUuid": "995256d2-5a33-55df-13ab-12abad84e7ff", -"modelUuid": "ab6478e5-ea33-3346-ac12-ab121484a3fe", -"modelName": "ServicevSAMP12", -"modelVersion": "1.0" -} -} -} -], -"requestParameters": { -"usePreload": false, -"controllerType" : "appc", -"userParams" : [ - { - "name" : "someUserParam", - "value" : "someValue" - }, - { - "name": "sgi_protected_subnet_id", - "value": "thisissomefakevalue" - } -] -} -} -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/UpdateVfModule_VID_request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/UpdateVfModule_VID_request.json deleted file mode 100644 index 9564f705ae..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/UpdateVfModule_VID_request.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "requestDetails": { - "modelInfo": { - "modelType": "vfModule", - "modelInvariantUuid": "introvert", - "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "STMTN5MMSC21-MMSC::model-1-0", - "modelVersion": "1", - "modelCustomizationUuid": "MODEL12345" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "MDTWNJ21", - "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" - }, - "requestInfo": { - "instanceName": "PCRF::module-0", - "instanceId": "supercool", - "source": "VID", - "suppressRollback": true - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "123456", - "modelInfo": { - "modelType": "service", - "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "SERVICE_MODEL_NAME", - "modelVersion": "1.0" - } - } - }, - { - "relatedInstance": { - "instanceId": "skask", - "modelInfo": { - "modelType": "vnf", - "modelInvariantUuid": "skask", - "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12", - "modelVersion": "1.0", - "modelInstanceName": "vSAMP12 1" - } - } - } - ], - "requestParameters": { - "usePreload": false, - "userParams": [ - { - "name": "someUserParam", - "value": "someValue" - }, - { - "name": "sgi_protected_subnet_id", - "value": "thisissomefakevalue" - } - ] - } - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/UpdateVnf_VID_request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/UpdateVnf_VID_request.json deleted file mode 100644 index e6d3e97a5c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/UpdateVnf_VID_request.json +++ /dev/null @@ -1,58 +0,0 @@ -{ -"requestDetails": { -"modelInfo": { -"modelType": "vnf", -"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", -"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", -"modelName": "vSAMP12", -"modelVersion": "1.0", -"modelCustomizationUuid": "MODEL-ID-1234" -}, -"cloudConfiguration": { -"lcpCloudRegionId": "mdt1", -"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" -}, -"requestInfo": { -"instanceName": "STMTN", -"instanceId": "skask", -"source": "VID", -"suppressRollback": true -}, -"relatedInstanceList": [ -{ -"relatedInstance": { -"instanceId": "MIS%2F1604%2F0026%2FSW_INTERNET", -"modelInfo": { -"modelType": "service", -"modelInvariantUuid": "995256d2-5a33-55df-13ab-12abad84e7ff", -"modelUuid": "ab6478e5-ea33-3346-ac12-ab121484a3fe", -"modelName": "ServicevSAMP12", -"modelVersion": "1.0" -} -} -} -], -"requestParameters": { -"usePreload": false, -"controllerType" : "appc", -"userParams" : [ - { - "name" : "someUserParam", - "value" : "someValue" - }, - { - "name": "sgi_protected_subnet_id", - "value": "thisissomefakevalue" - }, - { - "name": "vlc_sctp_b_route_prefixes", - "value": [ - { "interface_route_table_routes_route_prefix": "107.239.41.163/32" }, - { "interface_route_table_routes_route_prefix": "107.239.41.164/32" }, - { "interface_route_table_routes_route_prefix": "107.239.41.165/32" } - ] - } -] -} -} -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json deleted file mode 100644 index 588ef1cbec..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json +++ /dev/null @@ -1,17 +0,0 @@ -{ -"requestDetails": { -"cloudConfiguration": { -"lcpCloudRegionId": "mdt1", -"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" -}, -"requestInfo": { -"source": "VID", -"requestorId": "ab1234" -}, -"requestParameters": { -"controllerType": "", -"payload": -"{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" -} -} -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Policy/policyAbortResponse.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Policy/policyAbortResponse.json deleted file mode 100644 index c315b1ed1d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Policy/policyAbortResponse.json +++ /dev/null @@ -1 +0,0 @@ -{"decision":"PERMIT","details":"Abort"} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Policy/policySkipResponse.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Policy/policySkipResponse.json deleted file mode 100644 index 7cbdebb6b3..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Policy/policySkipResponse.json +++ /dev/null @@ -1 +0,0 @@ -{"decision":"PERMIT","details":"Skip"} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml deleted file mode 100644 index a5640b2b26..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml +++ /dev/null @@ -1,6 +0,0 @@ - - -680bd458-5ec1-4a16-b77c-509022e53450INTERNAL -400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data -true - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml deleted file mode 100644 index 07730e2df9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - JBoss Web/7.2.2.Final-redhat-1 - JBWEB000064: Error report - - - - -

JBWEB000065: HTTP Status 500 - java.lang.NullPointerException

-
-

- JBWEB000309: type - JBWEB000066: Exception report -

-

- JBWEB000068: message - java.lang.NullPointerException -

-

- JBWEB000069: description - JBWEB000145: The server encountered an internal error that - prevented it from fulfilling this request. - -

-

- JBWEB000070: exception -

org.jboss.resteasy.spi.UnhandledException:
-				java.lang.NullPointerException
-				org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365)
-				org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233)
-				org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209)
-				org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557)
-				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
-				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
-				org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
-				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
-				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
-				javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
-				org.openecomp.mso.logger.LogFilter.doFilter(LogFilter.java:35)
-			
-

-

- JBWEB000071: root cause -

java.lang.NullPointerException
-				org.openecomp.mso.adapters.network.NetworkAdapterRest$CreateNetworkVolumesTask.run(NetworkAdapterRest.java:128)
-				org.openecomp.mso.adapters.network.NetworkAdapterRest.createNetwork(NetworkAdapterRest.java:64)
-				sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
-				sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
-				sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
-				java.lang.reflect.Method.invoke(Method.java:606)
-				org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
-				org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
-				org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
-				org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
-				org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
-				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
-				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
-				org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
-				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
-				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
-				javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
-				org.openecomp.mso.logger.LogFilter.doFilter(LogFilter.java:35)
-			
-

-

- JBWEB000072: note - JBWEB000073: The full stack trace of the root cause is available - in the JBoss Web/7.2.2.Final-redhat-1 logs. - -

-
-

JBoss Web/7.2.2.Final-redhat-1

- - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml deleted file mode 100644 index 7a00744103..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml +++ /dev/null @@ -1,24 +0,0 @@ - - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - c4f4e878-cde0-4b15-ae9a-bda857759cea - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 - - - - RDM2WAGPLCP - - 1ef47428-cade-45bd-a103-0751e8b2deb0 - - - true - MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 - CONTRAIL_EXTERNAL - false - c4f4e878-cde0-4b15-ae9a-bda857759cea - 7dd5365547234ee8937416c65507d266 - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml deleted file mode 100644 index ca5145c226..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml +++ /dev/null @@ -1,4 +0,0 @@ - - service-instance - https://aai-conexus-e2e.test.com:8443/aai/v8/business/customers/customer/8310000058863/service-subscriptions/service-subscription/vMOG/service-instances/service-instance/f70e927b-6087-4974-9ef8-c5e4d5847ca4 - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml deleted file mode 100644 index e06d27ea88..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - pending-create - networkName - false - true - false - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-create - true - subnetName - - - - - 413 - 4132176 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - network-policy - https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg - - network-policy.network-policy-id - cee6d136-e378-4678-a024-2cd15f0ee0cg - - - - route-table-reference - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml deleted file mode 100644 index 24ee1df9c8..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - 49c86598-f766-46f8-84f8-8d1c1b10f9b4 - MNS-25180-L-01-dmz_direct_net_1 - CONTRAIL_EXTERNAL - dmz_direct - contrail - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - 0 - pending-create - networkName - false - true - false - - - 57e9a1ff-d14f-4071-a828-b19ae98eb2fc - 107.239.52.1 - 107.239.52.0 - 24 - 4 - pending-create - true - subnetName - - - - - 413 - 4132176 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ - - vpn-binding.vpn-id - 85f015d0-2e32-4c30-96d2-87a1a27f8017 - - - - vpn-binding - https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ - - vpn-binding.vpn-id - c980a6ef-3b88-49f0-9751-dbad8608d0a6 - - - - tenant - https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ - - tenant.tenant-id - 7dd5365547234ee8937416c65507d266 - - - - network-policy - https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg - - network-policy.network-policy-id - cee6d136-e378-4678-a024-2cd15f0ee0cg - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - route-table-reference - https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 - - route-table-reference.route-table-reference-id - cee6d136-e378-4678-a024-2cd15f0ee0hi - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml deleted file mode 100644 index 686ac1667f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - 9a7b327d9-287aa00-82c4b0-105757 - GN_EVPN_Test - 13979:105757 - 13979:105757 - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml deleted file mode 100644 index b01e469cbf..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - 5938baec-03ca-2bd5-a3f1-d54x123e253a - refFQDN1 - 12345 - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml deleted file mode 100644 index a19f9412c8..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - 5938baec-03ca-2bd5-a3f1-d54x123e253a - refFQDN2 - 12345 - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml deleted file mode 100644 index 671da0c9e2..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - 9a7b327d9-287aa00-82c4b0-105757 - GN_EVPN_Test - - - 13979:105708 - EXPORT - 1504025599510 - - - 13979:105707 - IMPORT - 1504025599519 - - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ - - l3-network.network-id - 689ec39e-c5fc-4462-8db2-4f760763ad28 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ - - l3-network.network-id - 1a49396b-19b3-40a4-8792-aa2fbd0f0704 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ - - l3-network.network-id - 774f3329-3c83-4771-86c7-9e6207cd50fd - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml deleted file mode 100644 index c35faef27f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - 9a7b327d9-287aa00-82c4b0-105757 - GN_EVPN_Test - 13979:105757 - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ - - l3-network.network-id - 689ec39e-c5fc-4462-8db2-4f760763ad28 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ - - l3-network.network-id - 1a49396b-19b3-40a4-8792-aa2fbd0f0704 - - - - l3-network - https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ - - l3-network.network-id - 774f3329-3c83-4771-86c7-9e6207cd50fd - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml deleted file mode 100644 index eedbda9343..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml deleted file mode 100644 index c48c6a661f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - 78987 - MSOTESTVOL102a-vSAMP12_base_vol_module-0 - - Test/vSAMP12 - Pending - 0000020 - - - tenant - /aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ - - tenant.tenant-id - fba1bd1e195a404cacb9ce17a9b2b421 - - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - mdt1 - - - tenant.tenant-name - ECOMP_MDT1 - - - - vf-module - /aai/v8/network/generic-vnfs/generic-vnf/9e48f6ea-f786-46de-800a-d480e5ccc846/vf-modules/vf-module/6a1dc898-b590-47b9-bbf0-34424a7a2ec3/ - - generic-vnf.vnf-id - 9e48f6ea-f786-46de-800a-d480e5ccc846 - - - vf-module.vf-module-id - 6a1dc898-b590-47b9-bbf0-34424a7a2ec3 - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json deleted file mode 100644 index 603c1f452f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "requestDetails": { - "modelInfo": { - "modelType": "volumeGroup", - "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12::base::module-0", - "modelVersion": "1" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "mdt1", - "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" - }, - "requestInfo": { - "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", - "source": "VID", - "suppressRollback": false - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "{service-instance-id}", - "modelInfo": { - "modelType": "service", - "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "Test", - "modelVersion": "2.0" - } - } - }, { - "relatedInstance": { - "instanceId": "{vnf-instance-id}", - "modelInfo": { - "modelType": "vnf", - "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "Test/vSAMP12", - "modelVersion": "1", - "modelInstanceName": "vSAMP12" - } - } - } - ], - "requestParameters": { - "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", - "userParams": [ - {"name": "vnfName", "value": "STMTN5MMSC20" }, - {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, - {"name": "vnfNmInformation", "value": "" }, - {"name": "vnfType", "value": "pcrf-capacity" }, - {"name": "vnfId", "value": "skask" }, - {"name": "vnfStackId", "value": "slowburn" }, - {"name": "vnfStatus", "value": "created" }, - {"name": "aicCloudRegion", "value": "MDTWNJ21" }, - {"name": "availabilityZone", "value": "slcp3-esx-az01" }, - {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, - {"name": "vmName", "value": "slcp34246vbc246ceb" }, - {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, - {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" } - ] - } - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json deleted file mode 100644 index f32ba2994b..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "requestDetails": { - "modelInfo": { - "modelType": "volumeGroup", - "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelName": "vSAMP12::base::module-0", - "modelVersion": "1" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "mdt1", - "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" - }, - "requestInfo": { - "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", - "source": "VID", - "suppressRollback": false - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "{service-instance-id}", - "modelInfo": { - "modelType": "service", - "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff-x", - "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", - "modelName": "Test", - "modelVersion": "2.0" - } - } - }, { - "relatedInstance": { - "instanceId": "{vnf-instance-id}", - "modelInfo": { - "modelType": "vnf", - "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", - "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "Test/vSAMP12", - "modelVersion": "1", - "modelInstanceName": "vSAMP12" - } - } - } - ], - "requestParameters": { - "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", - "userParams": [ - {"name": "vnfName", "value": "STMTN5MMSC20" }, - {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, - {"name": "vnfNmInformation", "value": "" }, - {"name": "vnfType", "value": "pcrf-capacity" }, - {"name": "vnfId", "value": "skask" }, - {"name": "vnfStackId", "value": "slowburn" }, - {"name": "vnfStatus", "value": "created" }, - {"name": "aicCloudRegion", "value": "MDTWNJ21" }, - {"name": "availabilityZone", "value": "slcp3-esx-az01" }, - {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, - {"name": "vmName", "value": "slcp34246vbc246ceb" }, - {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, - {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" } - ] - } - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml deleted file mode 100644 index 85773cdb07..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml +++ /dev/null @@ -1,29 +0,0 @@ - - 6a1dc898-b590-47b9-bbf0-34424a7a2ec3 - MSOST10606-vSAMP12_MTN6_base_module-0 - MSOST10606-vSAMP12_MTN6_base_module-0/81b01583-690c-4ec3-9c58-0eafa7a90be7 - active - true - 1475077639 - ff5256d2-5a33-55df-13ab-12abad84e7ff - 1.0 - - - volume-group - https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/volume-groups/volume-group/064bd1c6-e377-4009-a744-e958eec6e727/ - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - mtn6 - - - volume-group.volume-group-id - 064bd1c6-e377-4009-a744-e958eec6e727 - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml deleted file mode 100644 index d81b7e8f50..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - 36e20198-c67a-464b-96d0-aaa99eb2639e - 5b9b15d0-5dd7-47dc-95b9-0440c340a3ba - 1.0 - BRGmodelname - 013bd784-9bca-4919-ae2f-ae57af27bad9 - - - parent-service-instance-id - consuming-service-instance-id - namefromrequest - brg - allottedresourceidfromrequest - - - fq-name - - d1 - drole - - vlan-tag - - s2 - srole - - txc-id - - 1 - 123 - a.b.c.d - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml deleted file mode 100644 index f74e51e9d5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - 36e20198-c67a-464b-96d0-aaa99eb2639e - 5b9b15d0-5dd7-47dc-95b9-0440c340a3ba - 1.0 - TXCmodelname - 013bd784-9bca-4919-ae2f-ae57af27bad9 - - - parent-service-instance-id - consuming-service-instance-id - namefromrequest - tunnelxconn - allottedresourceidfromrequest - - - my-vni - my-bearer-ip - my-lan-ip - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml deleted file mode 100644 index f2063442d6..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml +++ /dev/null @@ -1,31 +0,0 @@ - - ar-1 - Active - Tunnel XConn - Tunnel XConn - Tunnel XConn - - 1490627351232 - - - service-instance - http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 - - customer.global-customer-id - SDN-ETHERNET-INTERNET - - - service-subscription.service-type - 123456789 - - - service-instance.service-instance-id - 88819355-9a71-4ddc-9e22-373f0644b40b - - - service-instance.service-instance-name - vcpe-1702-m010904-name4 - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json deleted file mode 100644 index e99dd9ccda..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json +++ /dev/null @@ -1,127 +0,0 @@ -{ "serviceResources" : { - "modelInfo" : { - "modelName" : "MSO Test Network", - "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", - "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", - "modelVersion" : null - }, - "serviceVnfs": [ - { "modelInfo" : { - "modelName" : "vHNF for DHV Test", - "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", - "modelInvariantUuid" : "6ea0b528-e303-4686-aa77-aa2fcbdccb96", - "modelVersion" : "2.0", - "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5", - "modelInstanceName" : "vHNF for DHV Test 17" - }, - "toscaNodeType" : null, - "nfFunction" : null, - "nfType" : null, - "nfRole" : null, - "nfNamingCode" : null, - "vfModules": [ - { - "modelInfo" : { - "modelName" : "VhnfForDhvTest..base_TEST..module-0", - "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", - "modelInvariantUuid" : "f5696ec0-ec71-4916-bf3b-93a654efcba4", - "modelVersion" : "1", - "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" - }, "isBase" : true, - "vfModuleLabel" : "base_TEST", - "initialCount" : 1, - "hasVolumeGroup" : true - } - ] - } - ], - "serviceNetworks": [ - { - "modelInfo" : { - "modelName" : "CONTRAIL_BASIC", - "modelUuid" : "fe5be3a6-dbe0-46d6-bcac-44dc841a7edc", - "modelInvariantUuid" : "ab07fbd8-185a-45ac-be45-db3eb02e98d5", - "modelVersion" : null, - "modelCustomizationUuid" : "0cb9b26a-9820-48a7-86e5-16c510e993d9", - "modelInstanceName" : "CONTRAIL_BASIC 5" - }, - "toscaNodeType" : null, - "networkType" : null, - "networkTechnology" : null, - "networkRole" : null, - "networkScope" : null - } - ], - "serviceAllottedResources": [ - { - "modelInfo" : { - "modelName" : "IP_MUX_Demux", - "modelUuid" : "64a1a718-556b-48ce-b3b7-ed3237ccc94f", - "modelInvariantUuid" : "f110ef53-a0a6-4d72-ab91-fd88a835e8c4", - "modelVersion" : "2.0", - "modelCustomizationUuid" : "4bab0880-2f06-4aeb-87cb-3734c8e8bf93", - "modelInstanceName" : "Pri_IP_MUX_Demux 1" - }, - "toscaNodeType" : null, - "allottedResourceType" : "Tunnel XConn", - "allottedResourceRole" : "Tunnel XConn", - "providingServiceModelInvariantUuid" : null, - "nfFunction" : null, - "nfType" : null, - "nfRole" : null, - "nfNamingCode" : null, - "homingSolution": { - "inventoryType": "service", - "serviceInstanceId": "MIS%252F1604%252F0027%252FSW_INTERNET", - "vnfHostname": "MDTNJ01", - "cloudOwner": "aic", - "cloudRegionId": "dfwtx", - "aicClli": "KDTNJ01", - "aicVersion": "3.0", - "entitlementPoolList": [ - "f1d563e8-e714-4393-8f99-cc480144a05e", - "j1d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupList": [ - "s1d563e8-e714-4393-8f99-cc480144a05e", - "b1d563e8-e714-4393-8f99-cc480144a05e" - ] - } - }, - { - "modelInfo" : { - "modelName" : "Service_Admin", - "modelUuid" : "73501e03-ee76-4509-a8ce-96d2a9f33ee9", - "modelInvariantUuid" : "462edf71-1a3c-487b-bf55-497460ab7de3", - "modelVersion" : "2.0", - "modelCustomizationUuid" : "a896ffad-c8f9-404e-a527-7a8d0cc99ce6", - "modelInstanceName" : "Pri_Service_Admin 5" - }, - "toscaNodeType" : null, - "allottedResourceType" : "BRG", - "allottedResourceRole" : "BRG", - "providingServiceModelInvariantUuid" : null, - "nfFunction" : null, - "nfType" : null, - "nfRole" : null, - "nfNamingCode" : null, - "homingSolution": { - "inventoryType": "service", - "serviceInstanceId": "MIS%252F1604%252F0027%252FSW_INTERNET", - "vnfHostname": "MDTNJ01", - "cloudOwner": "aic", - "cloudRegionId": "dfwtx", - "aicClli": "KDTNJ01", - "aicVersion": "3.0", - "entitlementPoolList": [ - "f1d563e8-e714-4393-8f99-cc480144a05e", - "j1d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupList": [ - "s1d563e8-e714-4393-8f99-cc480144a05e", - "b1d563e8-e714-4393-8f99-cc480144a05e" - ] - } - } - ] - }} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json deleted file mode 100644 index 80692b27f5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json +++ /dev/null @@ -1,11 +0,0 @@ -{ "serviceResources" : { - "modelInfo" : { - "modelName" : "MSO Test Network", - "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", - "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", - "modelVersion" : null - }, - "serviceVnfs": [], - "serviceNetworks": [], - "serviceAllottedResources": [] - }} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml deleted file mode 100644 index b9d88d15db..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml +++ /dev/null @@ -1,7 +0,0 @@ - - SDN-ETHERNET-INTERNET - SDN-ETHERNET-INTERNET - 1490627351232 - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json deleted file mode 100644 index bc0a1ef491..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "requestDetails": - { - "modelInfo": - { - "modelType":"service", - "modelInvariantUuid":"uuid-miu-svc-011-abcdef", - "modelVersionId":"ASDC_TOSCA_UUID", - "modelName":"SIModelName1", - "modelVersion":"2" - }, - "subscriberInfo": - { - "globalSubscriberId":"SDN-ETHERNET-INTERNET", - "subscriberName":"Kaneohe" - }, - "requestInfo": - { - "instanceName":"VCPE1", - "source":"VID", - "suppressRollback":"false", - "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" - }, - "cloudConfiguration": - { - "lcpCloudRegionId":"cloudowner_mdt1", - "tenantId":"8b1df54faa3b49078e3416e21370a3ba" - }, - "requestParameters": - { - "subscriptionServiceType":"123456789", - "aLaCarte":"false", - "userParams": - [ - { - "name":"BRG_WAN_MAC_Address", - "value":"brgmac" - }, - { - "name": "Customer_Location", - "value": { - "customerLatitude": "32.897480", - "customerLongitude": "-97.040443", - "customerName": "some_company" - } - }, - { - "name":"Homing_Solution", - "value":"sniro" - } - ] - } - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json deleted file mode 100644 index 4100ec76de..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "requestDetails": - { - "modelInfo": - { - "modelType":"service", - "modelInvariantUuid":"uuid-miu-svc-011-abcdef", - "modelVersionId":"ASDC_TOSCA_UUID", - "modelName":"SIModelName1", - "modelVersion":"2" - }, - "subscriberInfo": - { - "globalSubscriberId":"SDN-ETHERNET-INTERNET", - "subscriberName":"Kaneohe" - }, - "requestInfo": - { - "source":"VID", - "suppressRollback":"false", - "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" - }, - "cloudConfiguration": - { - "lcpCloudRegionId":"cloudowner_mdt1", - "tenantId":"8b1df54faa3b49078e3416e21370a3ba" - }, - "requestParameters": - { - "subscriptionServiceType":"123456789", - "aLaCarte":"false", - "userParams": - [ - { - "name":"BRG_WAN_MAC_Address", - "value":"brgmac" - }, - { - "name": "Customer_Location", - "value": { - "customerLatitude": "32.897480", - "customerLongitude": "-97.040443", - "customerName": "some_company" - } - }, - { - "name":"Homing_Solution", - "value":"sniro" - } - ] - } - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json deleted file mode 100644 index 5fc0b04180..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "requestDetails": - { - "modelInfo": - { - "modelType":"service", - "modelInvariantUuid":"uuid-miu-svc-011-abcdef", - "modelVersionId":"ASDC_TOSCA_UUID", - "modelName":"SIModelName1", - "modelVersion":"2" - }, - "subscriberInfo": - { - "globalSubscriberId":"SDN-ETHERNET-INTERNET", - "subscriberName":"Kaneohe" - }, - "requestInfo": - { - "source":"VID", - "suppressRollback":"true", - "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" - }, - "cloudConfiguration": - { - "lcpCloudRegionId":"cloudowner_mdt1", - "tenantId":"8b1df54faa3b49078e3416e21370a3ba" - }, - "requestParameters": - { - "subscriptionServiceType":"123456789", - "aLaCarte":"false", - "userParams": - [ - { - "name":"BRG_WAN_MAC_Address", - "value":"brgmac" - }, - { - "name": "Customer_Location", - "value": { - "customerLatitude": "32.897480", - "customerLongitude": "-97.040443", - "customerName": "some_company" - } - }, - { - "name":"Homing_Solution", - "value":"sniro" - } - ] - } - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml deleted file mode 100644 index 3cb31464d5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml +++ /dev/null @@ -1,31 +0,0 @@ - - ar-brgB - Active - BRG - BRG - BRG - - 1490627351232 - - - service-instance - http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 - - customer.global-customer-id - SDN-ETHERNET-INTERNET - - - service-subscription.service-type - 123456789 - - - service-instance.service-instance-id - 88819355-9a71-4ddc-9e22-373f0644b40b - - - service-instance.service-instance-name - vcpe-1702-m010904-name4 - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml deleted file mode 100644 index 97992fc00b..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml +++ /dev/null @@ -1,31 +0,0 @@ - - ar-txcA - Active - Tunnel XConn - Tunnel XConn - Tunnel XConn - - 1490627351232 - - - service-instance - http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 - - customer.global-customer-id - SDN-ETHERNET-INTERNET - - - service-subscription.service-type - 123456789 - - - service-instance.service-instance-id - 88819355-9a71-4ddc-9e22-373f0644b40b - - - service-instance.service-instance-name - vcpe-1702-m010904-name4 - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml deleted file mode 100644 index 932dbfb2ca..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - allotted-resource - https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/ar-brgB - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml deleted file mode 100644 index e0511873b6..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - MIS/1604/0026/SW_INTERNET - 123456789 - - - generic-vnf - /aai/v7/generic-vnf/vnfX - - - l3-network - /aai/v7/l3-network/netA - - - generic-vnf - /aai/v7/generic-vnf/vnfY - - - l3-network - /aai/v7/l3-network/netB - - - l3-network - /aai/v7/l3-network/netC - - - allotted-resource - /aai/v11/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/ar-txcA - - - allotted-resource - /aai/v11/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/ar-brgB - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml deleted file mode 100644 index feb535c238..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml +++ /dev/null @@ -1,8 +0,0 @@ - - MIS/1604/0026/SW_INTERNET - SDN-MOBILITY - 123456789 - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml deleted file mode 100644 index 1c4f13d642..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - allotted-resource - https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/ar-txcA - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json deleted file mode 100644 index dc4669e8d9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "requestDetails": - { - "modelInfo": - { - "modelType":"service", - "modelInvariantUuid":"uuid-miu-svc-011-abcdef", - "modelVersionId":"ASDC_TOSCA_UUID", - "modelName":"SIModelName1", - "modelVersion":"2" - }, - "subscriberInfo": - { - "globalSubscriberId":"SDN-ETHERNET-INTERNET", - "subscriberName":"Kaneohe" - }, - "requestInfo": - { - "instanceName":"VCPE1", - "source":"VID", - "suppressRollback":"false", - "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" - }, - "cloudConfiguration": - { - "lcpCloudRegionId":"mdt1", - "tenantId":"8b1df54faa3b49078e3416e21370a3ba" - }, - "requestParameters": - { - "subscriptionServiceType":"123456789", - "aLaCarte":"false", - "userParams": - { - "BRG_WAN_MAC_Address" : "brgmac" - } - } - - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml deleted file mode 100644 index 8b8863e29c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - generic-vnf - /aai/v7/generic-vnf/vnfX - - - l3-network - /aai/v7/l3-network/netA - - - generic-vnf - /aai/v7/generic-vnf/vnfY/ - - - l3-network - /aai/v7/l3-network/netB - - - l3-network - /aai/v7/l3-network/netC - - - allotted-resource - /aai/v11/anytxc - - - allotted-resource - /aai/v11/anybrg - - - allotted-resource - /aai/v11/other - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml deleted file mode 100644 index d81b7e8f50..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - 36e20198-c67a-464b-96d0-aaa99eb2639e - 5b9b15d0-5dd7-47dc-95b9-0440c340a3ba - 1.0 - BRGmodelname - 013bd784-9bca-4919-ae2f-ae57af27bad9 - - - parent-service-instance-id - consuming-service-instance-id - namefromrequest - brg - allottedresourceidfromrequest - - - fq-name - - d1 - drole - - vlan-tag - - s2 - srole - - txc-id - - 1 - 123 - a.b.c.d - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml deleted file mode 100644 index e352ff8f1f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - allotted-resource - https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml deleted file mode 100644 index 8c3976b828..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml +++ /dev/null @@ -1,31 +0,0 @@ - - ar-1 - Active - BRGr - BRGt - BRG - - 1490627351232 - - - service-instance - http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 - - customer.global-customer-id - SDN-ETHERNET-INTERNET - - - service-subscription.service-type - 123456789 - - - service-instance.service-instance-id - 88819355-9a71-4ddc-9e22-373f0644b40b - - - service-instance.service-instance-name - vcpe-1702-m010904-name4 - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml deleted file mode 100644 index 650d608fb0..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml +++ /dev/null @@ -1,31 +0,0 @@ - - ar-1 - Active - txc - BRG - BRG - - 1490627351232 - - - service-instance - http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 - - customer.global-customer-id - SDN-ETHERNET-INTERNET - - - service-subscription.service-type - 123456789 - - - service-instance.service-instance-id - 88819355-9a71-4ddc-9e22-373f0644b40b - - - service-instance.service-instance-name - vcpe-1702-m010904-name4 - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml deleted file mode 100644 index 14c7410995..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml +++ /dev/null @@ -1,38 +0,0 @@ - - MIS/1604/0026/SW_INTERNET - 123456789 - - Active - - - - allotted-resource - https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 - - - - cvlan-tag - https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ - - cvlan-tag.cvlan-tag - 2003 - - - port-group.interface-id - slcp1447vbc.ipag - - - vce.vnf-id - 832bace2-3fb0-49e0-a6a4-07c47223c535 - - - - vce - https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ - - vce.vnf-id - 832bace2-3fb0-49e0-a6a4-07c47223c535 - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml deleted file mode 100644 index 8ed991608a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml +++ /dev/null @@ -1,31 +0,0 @@ - - ar-1 - Active - BRG - BRG - BRG - - 1490627351232 - - - service-instance - http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 - - customer.global-customer-id - SDN-ETHERNET-INTERNET - - - service-subscription.service-type - 123456789 - - - service-instance.service-instance-id - 88819355-9a71-4ddc-9e22-373f0644b40b - - - service-instance.service-instance-name - vcpe-1702-m010904-name4 - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml deleted file mode 100644 index 6f86e0fb86..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - b043d290-140d-4a38-a9b6-95d3b8bd27d1 - MIS%252F1604%252F0026%252FSW_INTERNET - deactvate - brg-topology-operation - http://localhost:28090/mso/SDNCAdapterCallbackService - - - - RaaTestRequestId1 - DeleteBRGInstance - MSO - - - - - - - - - MIS%252F1604%252F0026%252FSW_INTERNET - - - - - arId-1 - brg - MIS%252F1604%252F0026%252FSW_INTERNET - - - - - - - - - - - ${sourceNetworkId} - ${sourceNetworkRole} - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml deleted file mode 100644 index 30d4c7ae49..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - b043d290-140d-4a38-a9b6-95d3b8bd27d3 - MIS%252F1604%252F0026%252FSW_INTERNET - unassign - brg-topology-operation - http://localhost:28090/mso/SDNCAdapterCallbackService - - - - RaaTestRequestId1 - DeleteBRGInstance - MSO - - - - - - - - - MIS%252F1604%252F0026%252FSW_INTERNET - - - - - arId-1 - brg - MIS%252F1604%252F0026%252FSW_INTERNET - - - - - - - - - - - ${sourceNetworkId} - ${sourceNetworkRole} - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml deleted file mode 100644 index e20850a7b9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - b043d290-140d-4a38-a9b6-95d3b8bd27d2 - MIS%252F1604%252F0026%252FSW_INTERNET - delete - brg-topology-operation - http://localhost:28090/mso/SDNCAdapterCallbackService - - - - RaaTestRequestId1 - DeleteBRGInstance - MSO - - - - - - - - - MIS%252F1604%252F0026%252FSW_INTERNET - - - - - arId-1 - brg - MIS%252F1604%252F0026%252FSW_INTERNET - - - - - - - - - - - ${sourceNetworkId} - ${sourceNetworkRole} - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml deleted file mode 100644 index f74e51e9d5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - 36e20198-c67a-464b-96d0-aaa99eb2639e - 5b9b15d0-5dd7-47dc-95b9-0440c340a3ba - 1.0 - TXCmodelname - 013bd784-9bca-4919-ae2f-ae57af27bad9 - - - parent-service-instance-id - consuming-service-instance-id - namefromrequest - tunnelxconn - allottedresourceidfromrequest - - - my-vni - my-bearer-ip - my-lan-ip - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml deleted file mode 100644 index e352ff8f1f..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - allotted-resource - https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml deleted file mode 100644 index dfb7d46a68..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml +++ /dev/null @@ -1,31 +0,0 @@ - - ar-1 - Active - TXCr - TXCt - TXC - - 1490627351232 - - - service-instance - http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 - - customer.global-customer-id - SDN-ETHERNET-INTERNET - - - service-subscription.service-type - 123456789 - - - service-instance.service-instance-id - 88819355-9a71-4ddc-9e22-373f0644b40b - - - service-instance.service-instance-name - vcpe-1702-m010904-name4 - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml deleted file mode 100644 index 59c503036a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml +++ /dev/null @@ -1,31 +0,0 @@ - - ar-1 - Active - brg - TXC - TXC - - 1490627351232 - - - service-instance - http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 - - customer.global-customer-id - SDN-ETHERNET-INTERNET - - - service-subscription.service-type - 123456789 - - - service-instance.service-instance-id - 88819355-9a71-4ddc-9e22-373f0644b40b - - - service-instance.service-instance-name - vcpe-1702-m010904-name4 - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml deleted file mode 100644 index 14c7410995..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml +++ /dev/null @@ -1,38 +0,0 @@ - - MIS/1604/0026/SW_INTERNET - 123456789 - - Active - - - - allotted-resource - https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 - - - - cvlan-tag - https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ - - cvlan-tag.cvlan-tag - 2003 - - - port-group.interface-id - slcp1447vbc.ipag - - - vce.vnf-id - 832bace2-3fb0-49e0-a6a4-07c47223c535 - - - - vce - https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ - - vce.vnf-id - 832bace2-3fb0-49e0-a6a4-07c47223c535 - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml deleted file mode 100644 index f2063442d6..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml +++ /dev/null @@ -1,31 +0,0 @@ - - ar-1 - Active - Tunnel XConn - Tunnel XConn - Tunnel XConn - - 1490627351232 - - - service-instance - http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 - - customer.global-customer-id - SDN-ETHERNET-INTERNET - - - service-subscription.service-type - 123456789 - - - service-instance.service-instance-id - 88819355-9a71-4ddc-9e22-373f0644b40b - - - service-instance.service-instance-name - vcpe-1702-m010904-name4 - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml deleted file mode 100644 index efec7eb001..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - b043d290-140d-4a38-a9b6-95d3b8bd27d1 - MIS%252F1604%252F0026%252FSW_INTERNET - deactvate - tunnelxconn-topology-operation - http://localhost:8080/mso/SDNCAdapterCallbackService - - - - RaaTestRequestId1 - DeleteTunnelXConnInstance - MSO - - - - - - - - - MIS%252F1604%252F0026%252FSW_INTERNET - - - - - arId-1 - tunnelxconn - MIS%252F1604%252F0026%252FSW_INTERNET - - - - - - - - - - - ${sourceNetworkId} - ${sourceNetworkRole} - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml deleted file mode 100644 index 9f52758750..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - b043d290-140d-4a38-a9b6-95d3b8bd27d3 - MIS%252F1604%252F0026%252FSW_INTERNET - unassign - tunnelxconn-topology-operation - http://localhost:8080/mso/SDNCAdapterCallbackService - - - - RaaTestRequestId1 - DeleteTunnelXConnInstance - MSO - - - - - - - - - MIS%252F1604%252F0026%252FSW_INTERNET - - - - - arId-1 - tunnelxconn - MIS%252F1604%252F0026%252FSW_INTERNET - - - - - - - - - - - ${sourceNetworkId} - ${sourceNetworkRole} - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml deleted file mode 100644 index 025195e326..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - b043d290-140d-4a38-a9b6-95d3b8bd27d2 - MIS%252F1604%252F0026%252FSW_INTERNET - delete - tunnelxconn-topology-operation - http://localhost:8080/mso/SDNCAdapterCallbackService - - - - RaaTestRequestId1 - DeleteTunnelXConnInstance - MSO - - - - - - - - - MIS%252F1604%252F0026%252FSW_INTERNET - - - - - arId-1 - tunnelxconn - MIS%252F1604%252F0026%252FSW_INTERNET - - - - - - - - - - - ${sourceNetworkId} - ${sourceNetworkRole} - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml deleted file mode 100644 index 8ed991608a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml +++ /dev/null @@ -1,31 +0,0 @@ - - ar-1 - Active - BRG - BRG - BRG - - 1490627351232 - - - service-instance - http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 - - customer.global-customer-id - SDN-ETHERNET-INTERNET - - - service-subscription.service-type - 123456789 - - - service-instance.service-instance-id - 88819355-9a71-4ddc-9e22-373f0644b40b - - - service-instance.service-instance-name - vcpe-1702-m010904-name4 - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml deleted file mode 100644 index f2063442d6..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml +++ /dev/null @@ -1,31 +0,0 @@ - - ar-1 - Active - Tunnel XConn - Tunnel XConn - Tunnel XConn - - 1490627351232 - - - service-instance - http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 - - customer.global-customer-id - SDN-ETHERNET-INTERNET - - - service-subscription.service-type - 123456789 - - - service-instance.service-instance-id - 88819355-9a71-4ddc-9e22-373f0644b40b - - - service-instance.service-instance-name - vcpe-1702-m010904-name4 - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogServiceResourcesData.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogServiceResourcesData.json deleted file mode 100644 index d05fccf98a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogServiceResourcesData.json +++ /dev/null @@ -1,94 +0,0 @@ -{ "serviceResources" : { - "modelInfo" : { - "modelName" : "MSO Test Network", - "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", - "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", - "modelVersion" : null - }, - "serviceVnfs": [ - { "modelInfo" : { - "modelName" : "vHNF for DHV Test", - "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", - "modelInvariantUuid" : "6ea0b528-e303-4686-aa77-aa2fcbdccb96", - "modelVersion" : "2.0", - "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5", - "modelInstanceName" : "vHNF for DHV Test 17" - }, - "toscaNodeType" : null, - "nfFunction" : null, - "nfType" : null, - "nfRole" : null, - "nfNamingCode" : null, - "multiStageDesign" : null, - "vfModules": [ - { - "modelInfo" : { - "modelName" : "VhnfForDhvTest..base_TEST..module-0", - "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", - "modelInvariantUuid" : "f5696ec0-ec71-4916-bf3b-93a654efcba4", - "modelVersion" : "1", - "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" - }, "isBase" : true, - "vfModuleLabel" : "base_TEST", - "initialCount" : 1, - "hasVolumeGroup" : true - } - ] - } - ], - "serviceNetworks": [ - { - "modelInfo" : { - "modelName" : "CONTRAIL_BASIC", - "modelUuid" : "fe5be3a6-dbe0-46d6-bcac-44dc841a7edc", - "modelInvariantUuid" : "ab07fbd8-185a-45ac-be45-db3eb02e98d5", - "modelVersion" : null, - "modelCustomizationUuid" : "0cb9b26a-9820-48a7-86e5-16c510e993d9", - "modelInstanceName" : "CONTRAIL_BASIC 5" - }, - "toscaNodeType" : null, - "networkType" : null, - "networkTechnology" : null, - "networkRole" : null, - "networkScope" : null - } - ], - "serviceAllottedResources": [ - { - "modelInfo" : { - "modelName" : "IP_MUX_Demux", - "modelUuid" : "64a1a718-556b-48ce-b3b7-ed3237ccc94f", - "modelInvariantUuid" : "f110ef53-a0a6-4d72-ab91-fd88a835e8c4", - "modelVersion" : "2.0", - "modelCustomizationUuid" : "4bab0880-2f06-4aeb-87cb-3734c8e8bf93", - "modelInstanceName" : "Pri_IP_MUX_Demux 1" - }, - "toscaNodeType" : null, - "allottedResourceType" : "ContrailRoute", - "allottedResourceRole" : null, - "providingServiceModelInvariantUuid" : null, - "nfFunction" : null, - "nfType" : null, - "nfRole" : null, - "nfNamingCode" : null - }, - { - "modelInfo" : { - "modelName" : "Service_Admin", - "modelUuid" : "73501e03-ee76-4509-a8ce-96d2a9f33ee9", - "modelInvariantUuid" : "462edf71-1a3c-487b-bf55-497460ab7de3", - "modelVersion" : "2.0", - "modelCustomizationUuid" : "a896ffad-c8f9-404e-a527-7a8d0cc99ce6", - "modelInstanceName" : "Pri_Service_Admin 5" - }, - "toscaNodeType" : null, - "allottedResourceType" : "SecurityZone", - "allottedResourceRole" : null, - "providingServiceModelInvariantUuid" : null, - "nfFunction" : null, - "nfType" : null, - "nfRole" : null, - "nfNamingCode" : null - } - ] - }} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json deleted file mode 100644 index b6e8a94888..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json +++ /dev/null @@ -1,98 +0,0 @@ -{ "serviceResources" : { - "serviceType" : "PortMirroring", - "serviceRole" : "InfraRole", - "environmentContext" : "Luna", - "workloadContext" : "Oxygen", - "modelInfo" : { - "modelName" : "MSO Test Network", - "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", - "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", - "modelVersion" : null - }, - "serviceVnfs": [ - { "modelInfo" : { - "modelName" : "vHNF for DHV Test", - "modelUuid" : "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelInvariantUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelVersion" : "1.0", - "modelCustomizationUuid" : "MODEL-ID-1234", - "modelInstanceName" : "vHNF for DHV Test 17" - }, - "toscaNodeType" : null, - "nfFunction" : null, - "nfType" : null, - "nfRole" : "vSCP", - "nfNamingCode" : null, - "multiStageDesign" : null, - "vfModules": [ - { - "modelInfo" : { - "modelName" : "VhnfForDhvTest..base_TEST..module-0", - "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", - "modelInvariantUuid" : "introvert", - "modelVersion" : "1", - "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" - }, "isBase" : true, - "vfModuleLabel" : "base_TEST", - "initialCount" : 1, - "hasVolumeGroup" : true - } - ] - } - ], - "serviceNetworks": [ - { - "modelInfo" : { - "modelName" : "CONTRAIL_BASIC", - "modelUuid" : "fe5be3a6-dbe0-46d6-bcac-44dc841a7edc", - "modelInvariantUuid" : "ab07fbd8-185a-45ac-be45-db3eb02e98d5", - "modelVersion" : null, - "modelCustomizationUuid" : "0cb9b26a-9820-48a7-86e5-16c510e993d9", - "modelInstanceName" : "CONTRAIL_BASIC 5" - }, - "toscaNodeType" : null, - "networkType" : null, - "networkTechnology" : null, - "networkRole" : null, - "networkScope" : null - } - ], - "serviceAllottedResources": [ - { - "modelInfo" : { - "modelName" : "IP_MUX_Demux", - "modelUuid" : "64a1a718-556b-48ce-b3b7-ed3237ccc94f", - "modelInvariantUuid" : "f110ef53-a0a6-4d72-ab91-fd88a835e8c4", - "modelVersion" : "2.0", - "modelCustomizationUuid" : "4bab0880-2f06-4aeb-87cb-3734c8e8bf93", - "modelInstanceName" : "Pri_IP_MUX_Demux 1" - }, - "toscaNodeType" : null, - "allottedResourceType" : "ContrailRoute", - "allottedResourceRole" : null, - "providingServiceModelInvariantUuid" : null, - "nfFunction" : null, - "nfType" : null, - "nfRole" : null, - "nfNamingCode" : null - }, - { - "modelInfo" : { - "modelName" : "Service_Admin", - "modelUuid" : "73501e03-ee76-4509-a8ce-96d2a9f33ee9", - "modelInvariantUuid" : "462edf71-1a3c-487b-bf55-497460ab7de3", - "modelVersion" : "2.0", - "modelCustomizationUuid" : "a896ffad-c8f9-404e-a527-7a8d0cc99ce6", - "modelInstanceName" : "Pri_Service_Admin 5" - }, - "toscaNodeType" : null, - "allottedResourceType" : "SecurityZone", - "allottedResourceRole" : null, - "providingServiceModelInvariantUuid" : null, - "nfFunction" : null, - "nfType" : null, - "nfRole" : null, - "nfNamingCode" : null - } - ] - }} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json deleted file mode 100644 index 5597abbc78..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json +++ /dev/null @@ -1,110 +0,0 @@ -{ "serviceResources" : { - "serviceType" : "PortMirroring", - "serviceRole" : "InfraRole", - "environmentContext" : "Luna", - "workloadContext" : "Oxygen", - "modelInfo" : { - "modelName" : "MSO Test Network", - "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", - "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", - "modelVersion" : null - }, - "serviceVnfs": [ - { "modelInfo" : { - "modelName" : "vHNF for DHV Test", - "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", - "modelInvariantUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelVersion" : "2.0", - "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5", - "modelInstanceName" : "vHNF for DHV Test 17" - }, - "toscaNodeType" : null, - "nfFunction" : null, - "nfType" : null, - "nfRole" : "vSCP", - "nfNamingCode" : null, - "multiStageDesign" : null, - "vfModules": [ - { - "modelInfo" : { - "modelName" : "VhnfForDhvTest..base_TEST..module-0", - "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", - "modelInvariantUuid" : "introvert", - "modelVersion" : "1", - "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" - }, "isBase" : true, - "vfModuleLabel" : "base_TEST", - "initialCount" : 1, - "hasVolumeGroup" : true - }, - { - "modelInfo" : { - "modelName" : "VhnfForDhvTest..base_TEST..module-1", - "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0b", - "modelInvariantUuid" : "extrovert", - "modelVersion" : "1", - "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a788" - }, "isBase" : false, - "vfModuleLabel" : "addon_TEST", - "initialCount" : 1, - "hasVolumeGroup" : true - } - ] - } - ], - "serviceNetworks": [ - { - "modelInfo" : { - "modelName" : "CONTRAIL_BASIC", - "modelUuid" : "fe5be3a6-dbe0-46d6-bcac-44dc841a7edc", - "modelInvariantUuid" : "ab07fbd8-185a-45ac-be45-db3eb02e98d5", - "modelVersion" : null, - "modelCustomizationUuid" : "0cb9b26a-9820-48a7-86e5-16c510e993d9", - "modelInstanceName" : "CONTRAIL_BASIC 5" - }, - "toscaNodeType" : null, - "networkType" : null, - "networkTechnology" : null, - "networkRole" : null, - "networkScope" : null - } - ], - "serviceAllottedResources": [ - { - "modelInfo" : { - "modelName" : "IP_MUX_Demux", - "modelUuid" : "64a1a718-556b-48ce-b3b7-ed3237ccc94f", - "modelInvariantUuid" : "f110ef53-a0a6-4d72-ab91-fd88a835e8c4", - "modelVersion" : "2.0", - "modelCustomizationUuid" : "4bab0880-2f06-4aeb-87cb-3734c8e8bf93", - "modelInstanceName" : "Pri_IP_MUX_Demux 1" - }, - "toscaNodeType" : null, - "allottedResourceType" : "ContrailRoute", - "allottedResourceRole" : null, - "providingServiceModelInvariantUuid" : null, - "nfFunction" : null, - "nfType" : null, - "nfRole" : null, - "nfNamingCode" : null - }, - { - "modelInfo" : { - "modelName" : "Service_Admin", - "modelUuid" : "73501e03-ee76-4509-a8ce-96d2a9f33ee9", - "modelInvariantUuid" : "462edf71-1a3c-487b-bf55-497460ab7de3", - "modelVersion" : "2.0", - "modelCustomizationUuid" : "a896ffad-c8f9-404e-a527-7a8d0cc99ce6", - "modelInstanceName" : "Pri_Service_Admin 5" - }, - "toscaNodeType" : null, - "allottedResourceType" : "SecurityZone", - "allottedResourceRole" : null, - "providingServiceModelInvariantUuid" : null, - "nfFunction" : null, - "nfType" : null, - "nfRole" : null, - "nfNamingCode" : null - } - ] - }} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogVnfData.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogVnfData.json deleted file mode 100644 index c7938d1af6..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogVnfData.json +++ /dev/null @@ -1,44 +0,0 @@ -{"serviceVnfs": [ - { "modelInfo" : { - "modelName" : "vHNF for DHV Test", - "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", - "modelInvariantUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelVersion" : "2.0", - "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5", - "modelInstanceName" : "vHNF for DHV Test 17" - }, - "toscaNodeType" : null, - "nfFunction" : null, - "nfType" : null, - "nfRole" : "vSCP", - "nfNamingCode" : null, - "multiStageDesign" : null, - "vfModules": [ - { - "modelInfo" : { - "modelName" : "VhnfForDhvTest..base_TEST..module-0", - "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", - "modelInvariantUuid" : "introvert", - "modelVersion" : "1", - "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" - }, "isBase" : true, - "vfModuleLabel" : "base_TEST", - "initialCount" : 1, - "hasVolumeGroup" : true - }, - { - "modelInfo" : { - "modelName" : "VhnfForDhvTest..base_TEST..module-1", - "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0b", - "modelInvariantUuid" : "extrovert", - "modelVersion" : "1", - "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a788" - }, "isBase" : false, - "vfModuleLabel" : "addon_TEST", - "initialCount" : 1, - "hasVolumeGroup" : true - } - ] - } - ] -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogVnfNoTwoPhasedForVfModule.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogVnfNoTwoPhasedForVfModule.json deleted file mode 100644 index 3067d124c3..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogVnfNoTwoPhasedForVfModule.json +++ /dev/null @@ -1,44 +0,0 @@ -{"serviceVnfs": [ - { "modelInfo" : { - "modelName" : "vSAMP12", - "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", - "modelInvariantUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelVersion" : "2.0", - "modelCustomizationUuid" : "MODEL-123", - "modelInstanceName" : "VNF for VF Module Create Test Two Phased" - }, - "toscaNodeType" : null, - "nfFunction" : null, - "nfType" : null, - "nfRole" : "vSCP", - "nfNamingCode" : null, - "multiStageDesign" : null, - "vfModules": [ - { - "modelInfo" : { - "modelName" : "STMTN5MMSC21-MMSC::model-1-0", - "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", - "modelInvariantUuid" : "introvert", - "modelVersion" : "1", - "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" - }, "isBase" : true, - "vfModuleLabel" : "base_TEST", - "initialCount" : 1, - "hasVolumeGroup" : true - }, - { - "modelInfo" : { - "modelName" : "VhnfForDhvTest..base_TEST..module-1", - "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0b", - "modelInvariantUuid" : "extrovert", - "modelVersion" : "1", - "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a788" - }, "isBase" : false, - "vfModuleLabel" : "addon_TEST", - "initialCount" : 1, - "hasVolumeGroup" : true - } - ] - } - ] -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogVnfYesTwoPhasedForVfModule.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogVnfYesTwoPhasedForVfModule.json deleted file mode 100644 index a9b3226483..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/getCatalogVnfYesTwoPhasedForVfModule.json +++ /dev/null @@ -1,44 +0,0 @@ -{"serviceVnfs": [ - { "modelInfo" : { - "modelName" : "vSAMP12", - "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", - "modelInvariantUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelVersion" : "2.0", - "modelCustomizationUuid" : "MODEL-123", - "modelInstanceName" : "VNF for VF Module Create Test Two Phased" - }, - "toscaNodeType" : null, - "nfFunction" : null, - "nfType" : null, - "nfRole" : "vSCP", - "nfNamingCode" : null, - "multiStageDesign" : "true", - "vfModules": [ - { - "modelInfo" : { - "modelName" : "STMTN5MMSC21-MMSC::model-1-0", - "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", - "modelInvariantUuid" : "introvert", - "modelVersion" : "1", - "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" - }, "isBase" : true, - "vfModuleLabel" : "base_TEST", - "initialCount" : 1, - "hasVolumeGroup" : true - }, - { - "modelInfo" : { - "modelName" : "VhnfForDhvTest..base_TEST..module-1", - "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0b", - "modelInvariantUuid" : "extrovert", - "modelVersion" : "1", - "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a788" - }, "isBase" : false, - "vfModuleLabel" : "addon_TEST", - "initialCount" : 1, - "hasVolumeGroup" : true - } - ] - } - ] -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/serviceDecompositionATMFW.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/serviceDecompositionATMFW.json deleted file mode 100644 index 94c1152204..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VIPR/serviceDecompositionATMFW.json +++ /dev/null @@ -1,110 +0,0 @@ -{ -"serviceResources" : { - "modelInfo" : { - "modelName" : "CMW_Service", - "modelUuid" : "", - "modelInvariantId" : "cmw-123-456-789", - "modelVersion" : "", - "modelCustomizationUuid" : "", - "modelInstanceName" : "", - "modelCustomizationName" : "", - "modelVersionId" : "Cmw_123", - "modelType" : "" - }, - "serviceInstanceData" : { - "instanceId" : "ff5256d2-5a33-55df-13ab-12abad84e7ff" - }, - "serviceNetworks" : [ { - "modelInfo" : { - "modelName" : "CONTRAIL30_BASIC", - "modelUuid" : "", - "modelInvariantId" : "not yet implemented", - "modelVersion" : "1.0", - "modelCustomizationUuid" : "z_network_123", - "modelInstanceName" : "", - "modelCustomizationName" : "", - "modelVersionId" : "mod-inst-uuid-123", - "modelType" : "network" - }, - "instanceData" : { }, - "networkType" : "CONTRAIL30_BASIC" - } ], - "serviceVnfs" : [ { - "modelInfo" : { - "modelName" : "vSAMP12", - "modelUuid" : "", - "modelInvariantId" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelVersion" : "1.0", - "modelCustomizationUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "modelInstanceName" : "", - "modelCustomizationName" : "", - "modelVersionId" : "fe6478e5-ea33-3346-ac12-ab121484a3fe", - "modelType" : "vnf" - }, - "instanceData" : { }, - "vfModules" : [ { - "modelInfo" : { - "modelName" : "vSAMP12::base::module-0", - "modelUuid" : "", - "modelInvariantId" : "miu-1001", - "modelVersion" : "1", - "modelCustomizationUuid" : "1001", - "modelInstanceName" : "", - "modelCustomizationName" : "", - "modelVersionId" : "", - "modelType" : "vfModule" - }, - "instanceData" : { }, - "hasVolumeGroup" : false, - "isBase" : true, - "initialCount" : 1 - }, { - "modelInfo" : { - "modelName" : "base::module-0", - "modelUuid" : "", - "modelInvariantId" : "miu-1002", - "modelVersion" : "1", - "modelCustomizationUuid" : "1002", - "modelInstanceName" : "", - "modelCustomizationName" : "", - "modelVersionId" : "", - "modelType" : "vfModule" - }, - "instanceData" : { }, - "hasVolumeGroup" : false, - "isBase" : true, - "initialCount" : 1 - }, { - "modelInfo" : { - "modelName" : "vSAMP12DEV::base::module-0", - "modelUuid" : "", - "modelInvariantId" : "miu-1003", - "modelVersion" : "1", - "modelCustomizationUuid" : "f86e8800-7629-427f-b284-3dbfd04db01f", - "modelInstanceName" : "", - "modelCustomizationName" : "", - "modelVersionId" : "", - "modelType" : "vfModule" - }, - "instanceData" : { }, - "hasVolumeGroup" : false, - "isBase" : true, - "initialCount" : 0 - } ] - } ], - "serviceAllottedResources" : [ { - "modelInfo" : { - "modelName" : "Bruce Wayne", - "modelUuid" : "", - "modelInvariantId" : "not yet implemented", - "modelVersion" : "1.0", - "modelCustomizationUuid" : "ar-mod-custid-456-456", - "modelInstanceName" : "Clark Kent", - "modelCustomizationName" : "", - "modelVersionId" : "123-123", - "modelType" : "allottedResource" - }, - "instanceData" : { } - } ] - } -} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml deleted file mode 100644 index 0ec1e30022..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - 9a7b327d9-287aa00-82c4b0-105757 - fqdn123 - slowburn - 145878989 - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/DBUpdateResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/DBUpdateResponse.xml deleted file mode 100644 index 7c30f75497..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/DBUpdateResponse.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml deleted file mode 100644 index d041565ac7..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - DEV-VF-0011 - UPDATE_VF_MODULE - PORTAL - - - skask - supercool - pcrf-capacity - PCRF::module-0 - - serviceIdUUID - MDTWNJ21 - fba1bd1e195a404cacb9ce17a9b2b421 - 78987 - introvert - 3.14 - myhost.appl.edu - introvert - 3.14 - - - VLAN-OAM-1323 - slcp34246vbc246ceb - 970cd2b9-7f09-4a12-af47-182ea38ba1f0 - 545cc2c3-1930-4100-b534-5d82d0e12bb6 - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/GenerateVfModuleName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/GenerateVfModuleName_AAIResponse_Success.xml deleted file mode 100644 index fe874717a8..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/GenerateVfModuleName_AAIResponse_Success.xml +++ /dev/null @@ -1,51 +0,0 @@ - - 12345678-f41f-4822-9323-b75962763d74 - STMTN5MMSC20 - pcrf-capacity - SDN-MOBILITY - vPCRF - pending-create - false - false - introvert - 2.0 - 0000020 - - - lukewarm - PCRF::module-0-0 - extrovert - 2.0 - true - fastburn - 2 - pending-create - 0000074 - - - supercool - PCRF::module-1-0 - extrovert - 2.0 - false - slowburn - 0 - pending-create - 0000075 - - - supercool - PCRF::module-1-0 - introvert - 2.0 - false - slowburn - 1 - pending-create - 0000075 - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml deleted file mode 100644 index 4712a5a464..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml +++ /dev/null @@ -1,38 +0,0 @@ - - skask - STMTN5MMSC20 - pcrf-capacity - SDN-MOBILITY - vPCRF - pending-create - false - false - introvert - 2.0 - 0000020 - - - lukewarm - PCRF::module-0-0 - introvert - 2.0 - true - fastburn - pending-create - 0000074 - - - supercool - PCRF::module-1-0 - extrovert - 2.0 - false - slowburn - pending-create - 0000075 - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml deleted file mode 100644 index d7bbb15b8c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - 9a7b327d9-287aa00-82c4b0-105757 - GN_EVPN_Test - 195159195 - 14567890 - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCSITopologyAssignCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCSITopologyAssignCallback.xml deleted file mode 100644 index f6314e55b3..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCSITopologyAssignCallback.xml +++ /dev/null @@ -1,11 +0,0 @@ - - 094d311c-40bc-4ff1-9617-37c4226efcc3 - 200 - - Y - - 8462db9b-3e91-4e90-a2c8-6471313f87bf - restconf/config/GENERIC-RESOURCE-API:services/service/8462db9b-3e91-4e90-a2c8-6471313f87bf/service-data/service-topology/ - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml deleted file mode 100644 index 5fa58e9c03..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - skask - - 200 - {{REQUEST-ID}} - Y - - dontcare - 0 - SDN-MOBILITY - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml deleted file mode 100644 index 2b732f952d..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - skask - - 200 - {{REQUEST-ID}} - Y - - dontcare - 0 - SDN-MOBILITY - - - restconf/SDNCObjectPath - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml deleted file mode 100644 index 3e138775d4..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - skask - - 200 - {{REQUEST-ID}} - Y - - dontcare - 0 - SDN-MOBILITY - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml deleted file mode 100644 index b579f232b1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - skask - - 200 - {{REQUEST-ID}} - Y - - dontcare - 0 - SDN-MOBILITY - - - restconf/SDNCObjectPath - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml deleted file mode 100644 index 3cf0c81c72..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - skask - - 200 - {{REQUEST-ID}} - Y - - dontcare - 0 - SDN-MOBILITY - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml deleted file mode 100644 index df5004edf5..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - skask - - 404 - {{REQUEST-ID}} - Y - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml deleted file mode 100644 index b579f232b1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - skask - - 200 - {{REQUEST-ID}} - Y - - dontcare - 0 - SDN-MOBILITY - - - restconf/SDNCObjectPath - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml deleted file mode 100644 index 10af29a210..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml +++ /dev/null @@ -1,315 +0,0 @@ - - - bd1b3789-6474-4935-94b2-90b656e035d0 - - bd1b3789-6474-4935-94b2-90b656e035d0 - - 9ddf628a-9eca-430e-8974-22d520a31be1 - assign - https://msojra.infra.aic.net:8443/adapters/rest/SDNCNotify - - - notsurewecare - bd1b3789-6474-4935-94b2-90b656e035d0 - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - - - PendingCreate - - - VNN1CA52LCP - skask - afd0f02a-1ddb-43bb-aded-5113e46e82ae - ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 - ZVNN1MOGX01 - 33d209df14ac4c08ad60747185d2f3e0 - bd1b3789-6474-4935-94b2-90b656e035d0 - ZVNN1MOGX01 - VF AUG 1::module-0 - - - - - mog_exn - 03dbd833-785c-40c0-bf32-37594b5334bc - MNS-25180-P-VNNYCA01_exn_protected_net_1 - - - 6f82d234-41a4-48e9-a9e8-415667a72929 - - filter1 - - - filter2 - - - - mog_oam - 3f181cde-9380-4c20-9d3a-e1a4ee74f994 - MNS-25180-P-VNNYCA01_oam_protected_net_1 - - - 713b6770-13fa-4949-8dbb-a1288c5e5932 - - - mog_cor_B - 821a550a-3f50-4725-995b-f212d5caec7c - MNS-25180-P-VNNYCA01_cor_direct_net_1 - - - 18926e56-12b6-4a4d-98b6-37e0c05626ee - - - mog_cor_A - 3dabf5c0-cffb-420c-8960-8499c74eb25f - MNS-25180-P-VNNYCA01_cor_direct_net_2 - - - 35530b29-a4de-48ff-a014-111110ccc652 - - - mog_gn - 3ce97321-6e7f-49af-bd12-f833e377c310 - MNS-25180-P-VNNYCA01_gn_direct_net_1 - - - 32bfdd2c-28e1-4895-87a6-373bf12c3129 - - - mog_dmz - d43ca910-02a5-47dc-8510-100a68a3c9e0 - MNS-25180-P-VNNYCA01_dmz_protected_net_1 - - - cb9500fb-943f-412e-aea6-458711564a75 - - - nova - - - ps - - ZVNN1MOGX01MPS001 - - - ZVNN1MOGX01MPS002 - - - ZVNN1MOGX01MPS003 - - - ZVNN1MOGX01MPS004 - - 4 - - mog_cor_B - - 107.224.36.251 - - - 107.224.36.252 - - - 107.224.36.253 - - - 107.224.36.254 - - N - - - - cm - - ZVNN1MOGX01MCM001 - - - ZVNN1MOGX01OAM002 - - 1 - - mog_cor_B - - 107.224.36.249 - - - 107.224.36.250 - - N - - - mog_oam - - 107.239.167.250 - - - 107.239.167.251 - - N - - - - oam - - ZVNN1MOGX01OAM001 - - - ZVNN1MOGX01OAM002 - - 2 - - mog_oam - - 107.239.167.252 - - - 107.239.167.251 - - N - - - mog_cor_B - - 107.224.36.249 - - - 107.224.36.250 - - N - - - - pd - - ZVNN1MOGX01MPD001 - - - ZVNN1MOGX01MPD002 - - 2 - - mog_dmz - - 107.225.25.253 - - - 107.225.25.254 - - N - 107.225.254.253 - - - mog_oam - - 107.239.167.254 - - - 107.239.167.253 - - N - 107.239.167.249 - - - mog_exn - - 107.224.46.253 - - - 107.224.46.254 - - N - 107.224.46.252 - - - mog_cor_B - - 107.224.36.247 - - - 107.224.36.248 - - N - 107.224.41.252 - - - mog_gn - - 107.224.41.253 - - - 107.224.41.254 - - N - 107.224.41.252 - - - mog_cor_A - - 107.224.38.253 - - - 107.224.38.254 - - N - - - - sm - - ZVNN1MOGX01MSM001 - - - ZVNN1MOGX01MSM002 - - - ZVNN1MOGX01MSM003 - - - ZVNN1MOGX01MSM004 - - 4 - - mog_cor_B - - 107.224.36.243 - - - 107.224.36.244 - - - 107.224.36.245 - - - 107.224.36.246 - - N - - - - - ZVNNMOGX01_base - SDN-MOBILITY - ZVNN1MOGX01 - VF AUG 1::module-0 - ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 - ZVNN1MOGX01 - - - - 9ddf628a-9eca-430e-8974-22d520a31be1 - - PORTAL - VNFActivateRequest - - - - 200 - Y - synccomplete - 2016-08-05T16:15:19.398Z - vnf-topology-operation - VNFActivateRequest - assign - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml deleted file mode 100644 index f96a073ef6..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - 28455973-1ee5-4ad1-8d35-c4732679743a - - 200 - Y - synccomplete - 2016-06-08T19:44:59.138Z - vnf-topology-operation - VNFActivateRequest - assign - - - 28455973-1ee5-4ad1-8d35-c4732679743 - - notsurewecare - 28455973-1ee5-4ad1-8d35-c4732679743a - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - - - 5e168556-a5c6-4813-bff3-cc03007afbbc - http://mtanjv9moja01-eth1-0.aic.cip.com:8080/adapters/rest/SDNCNotify - assign - - - AAIAIC25 - MSOTEST06-vSAMP3::base::module-0 - 91ad7ab0-9ffd-471d-971c-3eb913a2cc75 - Test/vSAMP3 1 - MSOTEST06 - 4ae1d3446a4c48b2bec44b6cfba06d68 - 28455973-1ee5-4ad1-8d35-c4732679743a - vSAMP3::base::module-0 - - - PendingCreate - - - - image - Ubuntu_Perf - - - flavor - m1.small - - - - int_imbl - 680b7453-0ec4-4d96-b355-280d981d418f - Nimbus-25193-T-Willows2_int_imbl_net_1 - default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_int_imbl_net_1 - - 775607fb-e16a-45ef-94a7-82fba0d16eec - 640d07fb-e16a-45ef-94a7-82fba0d169bf - - filter1 - - - filter2 - - - - sgi_protected - f9039ce9-e3cf-4716-b2d1-ec7912178ea4 - Nimbus-25193-T-Willows2_sgi_protected_net_1 - default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_sgi_protected_net_1 - b9999ce9-e3cf-4716-b2d1-ec791217678c - - bf11bba8-b971-4ab5-8281-215b3fedcd3c - - - cm - - ZVNN1MOGX01MCM001 - - - ZVNN1MOGX01OAM002 - - 1 - - mog_cor_B - - 107.224.36.249 - - - 107.224.36.250 - - - 2606:ae00:2e01:800::67 - - N - 107.224.41.252 - 2001:1890:1001:2B32::29:C - - - mog_oam - - 107.239.167.250 - - - 107.239.167.251 - - - aa::aa::aa::aa::aa::aa - - - bb::bb::bb::bb::bb::bb - - - 1.2.3.4/26 - - - 2002::/64 - - N - 1111:1890:1001:2B32::29:D - - - - nova - - - - MSOTEST06-vSAMP3::base::module-0 - SDN-MOBILITY - vSAMP3::base::module-0 - Test/vSAMP3 1 - MSOTEST06 - - - - 5e168556-a5c6-4813-bff3-cc03007afbbc - - SoapUI-bns-vf-base-vSAMP3-9001 - VNFActivateRequest - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml deleted file mode 100644 index 689c214cba..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - 0725b072-b854-4705-bf8e-c1a1eb08651e - vSAMP10aDEV::base::module-0 - zmtn6nf-code-111_base_0 - - - vSAMP10aDEV::base::module-0 - 819ef122-ca19-4141-a61e-62922f8fc279 - ff2ae348-214a-11e7-93ae-92361f002673 - 3a97db99-c4bb-498a-a13a-38f65f1ced3d - ff2ae348-214a-11e7-93ae-92361f002673 - - 19123c2924c648eb8e42a3c1f14b7682 - mtn6 - AUSTTXGR - - - image - Ubuntu_Perf - - - flavor - m1.small - - - - - - cm - - ZVNN1MOGX01MCM001 - - - ZVNN1MOGX01OAM002 - - 1 - - mog_cor_B - hhh - - 107.224.36.249 - - - 107.224.36.250 - - - 2606:ae00:2e01:800::67 - - N - 107.224.41.252 - 2001:1890:1001:2B32::29:C - - - mog_oam - - 107.239.167.250 - - - 107.239.167.251 - - - aa::aa::aa::aa::aa::aa - - - bb::bb::bb::bb::bb::bb - - - 1.2.3.4/26 - - - 2002::/64 - - N - 1111:1890:1001:2B32::29:D - - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml deleted file mode 100644 index bc2c7b9e63..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - nf-type-1 - zmtn6nf-code-111 - nf-role-1 - nf-function-1 - nf-code-1 - eac30f85-f61f-4c5f-862e-2c62f9e135de - null - - - vSAMP10a_macro - 819ef122-ca19-4141-a61e-62922f8fc279 - 1.0 - ef176121-f02c-4dd3-927c-22131d48446b - ff2ae348-214a-11e7-93ae-92361f002672 - - - - mog_exn - 03dbd833-785c-40c0-bf32-37594b5334bc - MNS-25180-P-VNNYCA01_exn_protected_net_1 - - - 6f82d234-41a4-48e9-a9e8-415667a72929 - - filter1 - - - filter2 - - - - mog_oam - 3f181cde-9380-4c20-9d3a-e1a4ee74f994 - MNS-25180-P-VNNYCA01_oam_protected_net_1 - - - 713b6770-13fa-4949-8dbb-a1288c5e5932 - - - mog_cor_B - 821a550a-3f50-4725-995b-f212d5caec7c - MNS-25180-P-VNNYCA01_cor_direct_net_1 - - - 18926e56-12b6-4a4d-98b6-37e0c05626ee - - - mog_cor_A - 3dabf5c0-cffb-420c-8960-8499c74eb25f - MNS-25180-P-VNNYCA01_cor_direct_net_2 - - - 35530b29-a4de-48ff-a014-111110ccc652 - - - mog_gn - 3ce97321-6e7f-49af-bd12-f833e377c310 - MNS-25180-P-VNNYCA01_gn_direct_net_1 - - - 32bfdd2c-28e1-4895-87a6-373bf12c3129 - - - mog_dmz - d43ca910-02a5-47dc-8510-100a68a3c9e0 - MNS-25180-P-VNNYCA01_dmz_protected_net_1 - - - cb9500fb-943f-412e-aea6-458711564a75 - - - nova - - - 19123c2924c648eb8e42a3c1f14b7682 - mtn6 - AUSTTXGR - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml deleted file mode 100644 index b579f232b1..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - skask - - 200 - {{REQUEST-ID}} - Y - - dontcare - 0 - SDN-MOBILITY - - - restconf/SDNCObjectPath - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml deleted file mode 100644 index 919ff2c36b..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml deleted file mode 100644 index 3afcb3f21c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml +++ /dev/null @@ -1,55 +0,0 @@ - - skask - supercool - slowburn - true - - - key1 - value1 - - - key2 - value2 - - -server1_private_ip -192.168.28.3 - - -contrail-service-instance-fqdn -default-domain:MSOTest:MsoNW-RA - - -policyKey1_contrail_network_policy_fqdn -MSOTest:DefaultPolicyFQDN1 - - -policyKey2_contrail_network_policy_fqdn -MSOTest:DefaultPolicyFQDN2 - - -oam_management_v6_address -2000:abc:bce:1111 - - -oam_management_v4_address -127.0.0.1 - - - - skask - supercool - slowburn - true - tenantId - cloudSiteId - - requestId - serviceInstanceId - - {{MESSAGE-ID}} - - {{MESSAGE-ID}} - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml deleted file mode 100644 index 2d3ebebccd..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml +++ /dev/null @@ -1,16 +0,0 @@ - - skask - supercool - slowburn - - - key1 - value1 - - - key2 - value2 - - - {{MESSAGE-ID}} - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml deleted file mode 100644 index af2bd7abfd..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml +++ /dev/null @@ -1,15 +0,0 @@ - - 78987 - slowburn - - - key1 - value1 - - - key2 - value2 - - - {{MESSAGE-ID}} - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml deleted file mode 100644 index 8db8610501..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml +++ /dev/null @@ -1,10 +0,0 @@ - - lukewarm - PCRF::module-1 - slowburn - pending-create - true - 330-90 - introvert - 2.0 - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-new-PendingActivation.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-new-PendingActivation.xml deleted file mode 100644 index 2ccba7d056..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-new-PendingActivation.xml +++ /dev/null @@ -1,9 +0,0 @@ - - b37d96db-7d2c-47ce-bf61-a6c7b82fe161 - PCRF::module-0-2 - 00000000-0000-0000-0000-000000000000 - 1.0 - false - PendingActivation - 330-90 - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml deleted file mode 100644 index 10e85c0568..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml +++ /dev/null @@ -1,9 +0,0 @@ - - b37d96db-7d2c-47ce-bf61-a6c7b82fe161 - PCRF::module-0-2 - 00000000-0000-0000-0000-000000000000 - 1.0 - false - pending-create - 330-90 - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml deleted file mode 100644 index 4e7d567564..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml +++ /dev/null @@ -1,27 +0,0 @@ - - supercool - PCRF::module-2 - fastburn - pending-create - false - 330-89 - introvert - 2.0 - - - volume-group - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - pdk1 - - - volume-group.volume-group-id - 78987 - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml deleted file mode 100644 index 354ebb7160..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml +++ /dev/null @@ -1,25 +0,0 @@ - - 78987 - Volume_2 - slowburn - pcrf-capacity - Active - 0000020 - - - tenant - - cloud-region.cloud-owner - att-aic - - - cloud-region.cloud-region-id - MDTWNJ21 - - - tenant.tenant-id - fba1bd1e195a404cacb9ce17a9b2b421 - - - - \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/deleteNetworkResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/deleteNetworkResponse_Success.xml deleted file mode 100644 index 902c0837d9..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/deleteNetworkResponse_Success.xml +++ /dev/null @@ -1,3 +0,0 @@ - - true - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml deleted file mode 100644 index 980a0b1186..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/camunda.cfg.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/camunda.cfg.xml deleted file mode 100644 index e4e8ae5176..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/camunda.cfg.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/log4j.properties b/bpmn/MSOInfrastructureBPMN/src/test/resources/log4j.properties deleted file mode 100644 index 393e0877ec..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/log4j.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Root logger option -log4j.rootLogger=INFO, stdout - -# Direct log messages to stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/logging.properties b/bpmn/MSOInfrastructureBPMN/src/test/resources/logging.properties deleted file mode 100644 index 4941c55971..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/logging.properties +++ /dev/null @@ -1,2 +0,0 @@ -#register SLF4JBridgeHandler as handler for the j.u.l. root logger -handlers = org.slf4j.bridge.SLF4JBridgeHandler diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.properties b/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.properties deleted file mode 100644 index f800d00245..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.properties +++ /dev/null @@ -1,3 +0,0 @@ -# Default BPMN properties for unit tests - -URNMapping.FileSystemLoading.Enabled=true \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties b/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties deleted file mode 100644 index 6dac08dc56..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties +++ /dev/null @@ -1,130 +0,0 @@ -# Default URN Mappings for unit tests - -mso.rollback=true - -canopi.auth=757A94191D685FD2092AC1490730A4FC -csi.aots.addincidentmanagement.endpoint=http://localhost:28090/AddIncidentManagementTicketRequest -csi.networkstatus.endpoint=http://localhost:28090/SendManagedNetworkStatusNotification -mso.csi.pwd=4EA237303511EFBBC37F17A351562131 -mso.csi.usrname=mso -mso.msoKey=07a7159d3bf51a0e53be7a8f89699be7 - -mso.healthcheck.log.debug=false - -mso.adapters.completemsoprocess.endpoint=http://localhost:28090/CompleteMsoProcess -mso.workflow.message.endpoint=http://localhost:8080/mso/WorkflowMessage -mso.adapters.db.endpoint=http://localhost:28090/dbadapters/MsoRequestsDbAdapter -mso.openecomp.adapters.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter -mso.adapters.openecomp.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter -mso.adapters.db.auth=757A94191D685FD2092AC1490730A4FC - -mso.adapters.network.endpoint=http://localhost:28090/networks/NetworkAdapter -mso.adapters.network.rest.endpoint=http://localhost:28090/networks/NetworkAdapter - -mso.adapters.po.auth=757A94191D685FD2092AC1490730A4FC -mso.adapters.po.password=3141634BF7E070AA289CF2892C986C0B -mso.po.timeout=PT60S - -aai.auth=757A94191D685FD2092AC1490730A4FC - -mso.default.adapter.namespace=http://org.openecomp.mso -mso.adapters.sdnc.endpoint=http://localhost:28090/SDNCAdapter -mso.adapters.sdnc.rest.endpoint=http://localhost:28090/SDNCAdapter/v1/sdnc -mso.adapters.sdnc.timeout=PT60S -mso.sdnc.firewall.yang.model=http://com/openecomp/svc/mis/firewall-lite-gui -mso.sdnc.firewall.yang.model.version=2015-05-15 -mso.sdnc.password=3141634BF7E070AA289CF2892C986C0B -mso.sdnc.timeout.firewall.minutes=20 -mso.callbackRetryAttempts=5 -mso.sdnc.timeout=PT10S -mso.sdnc.timeout.ucpe.async.hours=120 -mso.sdnc.timeout.ucpe.async.minutes=5 -mso.workflow.message.endpoint=http://localhost:28080/mso/WorkflowMesssage -mso.workflow.sdncadapter.callback=http://localhost:28080/mso/SDNCAdapterCallbackService -mso.workflow.sdnc.replication.delay=PT0.01S -mso.workflow.aai.distribution.delay=PT0.01S - -mso.catalog.db.endpoint=http://localhost:28090 - -mso.adapters.tenant.endpoint=http://localhost:28090/tenantAdapterMock -mso.adapters.vnf-async.endpoint=http://localhost:28090/vnfs/VnfAdapterAsync -mso.adapters.vnf.endpoint=http://localhost:28090/vnfs/VnfAdapter -mso.adapters.vnf.rest.endpoint=http://localhost:28090/vnfs/v1/vnfs -mso.workflow.vnfadapter.create.callback=http://localhost:28080/mso/vnfAdapterNotify -mso.workflow.vnfadapter.delete.callback=http://localhost:28080/mso/vnfAdapterNotify -mso.workflow.vnfadapter.query.callback=http://localhost:28080/mso/services/VNFAdapterQuerCallbackV1 -mso.workflow.vnfadapter.rollback.callback=http://localhost:28080/mso/vnfAdapterNotify -mso.workflow.createvce.delay.seconds=1 -mso.infra.customer.id=testCustIdInfra - -aai.endpoint=http://localhost:28090 - -# AAI version mappings - -# Example to override default version for a resource: -#mso.workflow.default.aai.vce.version=6 -#mso.workflow.default.aai.v6.vce.uri=/aai/v6/network/vces/vce -mso.workflow.global.default.aai.namespace=http://org.openecomp.aai.inventory/ -mso.workflow.global.default.aai.version=8 -mso.workflow.default.aai.cloud-region.version=9 -mso.workflow.default.aai.generic-vnf.version=9 - -mso.workflow.default.aai.v9.cloud-region.uri=/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic -mso.workflow.default.aai.v8.customer.uri=/aai/v8/business/customers/customer -mso.workflow.default.aai.v8.generic-query.uri=/aai/v8/search/generic-query -mso.workflow.default.aai.v9.generic-vnf.uri=/aai/v9/network/generic-vnfs/generic-vnf -mso.workflow.default.aai.v8.l3-network.uri=/aai/v8/network/l3-networks/l3-network -mso.workflow.default.aai.v8.network-policy.uri=/aai/v8/network/network-policies/network-policy -mso.workflow.default.aai.v8.nodes-query.uri=/aai/v8/search/nodes-query -mso.workflow.default.aai.v8.route-table-reference.uri=/aai/v8/network/route-table-references/route-table-reference -mso.workflow.default.aai.v8.tenant.uri=/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant -mso.workflow.default.aai.v8.vce.uri=/aai/v8/network/vces/vce -mso.workflow.default.aai.v8.vpn-binding.uri=/aai/v8/network/vpn-bindings/vpn-binding -mso.workflow.notification.name=GenericNotificationService - -log.debug.CompleteMsoProcess=true -log.debug.CreateNetworkInstanceInfra=true -log.debug.CreateServiceInstanceInfra=true -log.debug.DeleteNetworkInstanceInfra=true -log.debug.FalloutHandler=true -log.debug.GenericGetService=true -log.debug.sdncAdapter=true -log.debug.UpdateNetworkInstanceInfra=true -log.debug.VnfAdapterRestV1=true -log.debug.CreateNetworkInstance=true -log.debug.DoCreateNetworkInstance=true -log.debug.DoCreateNetworkInstanceRollback=true -log.debug.DeleteNetworkInstance=true -log.debug.DoDeleteNetworkInstance=true -log.debug.DoDeleteNetworkInstanceRollback=true -log.debug.UpdateNetworkInstance=true -log.debug.DoUpdateNetworkInstance=true -log.debug.DoUpdateNetworkInstanceRollback=true -log.debug.CreateVnfInfra=true -log.debug.DoCreateVnf=true -log.debug.CreateGenericALaCarteServiceInstance=true -log.debug.DecomposeService=true -log.debug.DoCreateServiceInstance=true -log.debug.DoDeleteServiceInstance=true -log.debug.VnfInPlaceUpdate=true - -policy.client.auth=Basic bTAzNzQzOnBvbGljeVIwY2sk -policy.auth=Basic dGVzdHBkcDphbHBoYTEyMw== -policy.environment=TEST -policy.endpoint=http://localhost:28090/pdp/api/ -policy.default.disposition=Skip - -appc.client.topic.read=APPC-LCM-WRITE -appc.client.topic.write=APPC-LCM-READ -appc.client.topic.sdnc.read=SDNC-LCM-WRITE -appc.client.topic.sdnc.write=SDNC-LCM-READ -appc.client.topic.read.timeout=100 -appc.client.response.timeout=300 -appc.client.poolMembers=localhost:28090 -appc.client.key=iaEMAfjsVsZnraBP -appc.client.secret=wcivUjsjXzmGFBfxMmyJu9dz -#appc.client.service=ueb - -sdnc.si.sv.types=PORT-MIRROR,PPROBES -mso.bpmn.optimisticlockingexception.retrycount=3 - diff --git a/bpmn/MSORESTClient/pom.xml b/bpmn/MSORESTClient/pom.xml index 6f2f007e5f..ee5bdff485 100644 --- a/bpmn/MSORESTClient/pom.xml +++ b/bpmn/MSORESTClient/pom.xml @@ -6,7 +6,7 @@ org.onap.so bpmn - 1.2.0-SNAPSHOT + 1.3.0-SNAPSHOT MSORESTClient diff --git a/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/APIResponse.java b/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/APIResponse.java new file mode 100644 index 0000000000..b77c90b215 --- /dev/null +++ b/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/APIResponse.java @@ -0,0 +1,145 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.rest; + +import java.io.IOException; +import java.util.Arrays; + +import org.apache.http.Header; +import org.apache.http.HttpResponse; +import org.apache.http.util.EntityUtils; + +/** + * An immutable class that encapsulates an API response. + * + * @version 1.0 + * @since 1.0 + */ +public class APIResponse { + private final int statusCode; + private final byte[] responseBody; + private final HttpHeader[] headers; + + /** + * Internal method used to create http headers using the specified + * HttpResponse object. + * + * @param httpResponse used to create headers + * @return http headers + */ + private static HttpHeader[] buildHeaders(final HttpResponse httpResponse) { + final Header[] headers = httpResponse.getAllHeaders(); + + HttpHeader[] httpHeaders = new HttpHeader[headers.length]; + for (int i = 0; i < headers.length; ++i) { + final Header header = headers[i]; + final String name = header.getName(); + final String value = header.getValue(); + final HttpHeader httpHeader = new HttpHeader(name, value); + httpHeaders[i] = httpHeader; + } + + return httpHeaders; + } + + /** + * Create an APIResponse object using the specified HttpResponse object. + * + * @param httpResponse used to create the APIResponse + * + * @throws RESTException if unable to read from the HttpResponse object + */ + public APIResponse(final HttpResponse httpResponse) throws RESTException { + try { + this.statusCode = httpResponse.getStatusLine().getStatusCode(); + + if (httpResponse.getEntity() == null) + { + this.responseBody = null; + } + else + { + this.responseBody = EntityUtils.toByteArray(httpResponse.getEntity()); + } + + this.headers = buildHeaders(httpResponse); + } catch (IOException ioe) { + throw new RESTException(ioe); + } + } + + /** + * Gets the http status code returned by the api server. + *

+ * For example, status code 200 represents 'OK.' + * + * @return status code + */ + public int getStatusCode() { + return this.statusCode; + } + + /** + * Gets the http response body as a byte array. + * + * @return http response body + */ + public byte[] getResponseBodyAsByteArray() { + // avoid exposing internals, create copy + if (this.responseBody != null) { + return Arrays.copyOf(this.responseBody, this.responseBody.length); + } else { + return null; + } + } + + /** + * Gets the http response body as a string. + * + * @return http response body + */ + public String getResponseBodyAsString() { + if (this.responseBody != null) { + return new String(this.responseBody); + } else { + return ""; + } + } + + /** + * Gets a list of all the headers returned by the API response. + * + * @return an array of all the HttpHeaders + */ + public HttpHeader[] getAllHeaders() { + // avoid exposing internals, create copy + return Arrays.copyOf(this.headers, this.headers.length); + } + + public String getFirstHeader(String name) { + for (HttpHeader header : headers) { + if (header.getName().equals(name)) { + return header.getValue(); + } + } + return null; + } +} diff --git a/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/HostNameVerifier.java b/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/HostNameVerifier.java new file mode 100644 index 0000000000..3d10c0391d --- /dev/null +++ b/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/HostNameVerifier.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.rest; + +import javax.net.ssl.SSLException; + +import org.apache.http.conn.ssl.AbstractVerifier; +import org.onap.so.logger.MsoLogger; + +/** + * @version 1.0 + * Place holder to validate host name, for now just invokes the super class method + * + */ +public class HostNameVerifier extends AbstractVerifier { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, HostNameVerifier.class); + + public final void verify( + final String host, + final String[] cns, + final String[] subjectAlts) throws SSLException { + try { + verify(host, cns, subjectAlts, true); + } catch (SSLException sex) { + LOGGER.debug("Exception:", sex); + } + } + +} diff --git a/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/HttpHeader.java b/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/HttpHeader.java new file mode 100644 index 0000000000..a96793334d --- /dev/null +++ b/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/HttpHeader.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.rest; + +/** + * An immutable class used to wrap an http header. + * + * @version 1.0 + * @since 1.0 + */ +public class HttpHeader { + private final String name; + private final String value; + + /** + * Create an http header using the specified name and value + * + * @param name name of http header + * @param value value of http header + */ + public HttpHeader(final String name, final String value) { + if (name == null) { + throw new IllegalArgumentException("Name may not be null."); + } + + this.name = name; + this.value = value; + } + + /** + * Gets the header name. + * + * @return header name + */ + public String getName() { + return this.name; + } + + /** + * Gets the header value. + * + * @return header value + */ + public String getValue() { + return this.value; + } +} diff --git a/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/RESTClient.java b/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/RESTClient.java new file mode 100644 index 0000000000..fc6266d917 --- /dev/null +++ b/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/RESTClient.java @@ -0,0 +1,623 @@ +/*- + * ============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.rest; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.net.ssl.SSLSocketFactory; + +import org.apache.http.HttpEntity; +import org.apache.http.HttpHost; +import org.apache.http.HttpResponse; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPatch; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.config.Registry; +import org.apache.http.config.RegistryBuilder; +import org.apache.http.conn.socket.ConnectionSocketFactory; +import org.apache.http.conn.socket.PlainConnectionSocketFactory; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.message.AbstractHttpMessage; +import org.apache.http.util.EntityUtils; +import org.onap.so.logger.MsoLogger; +/** + * Client used to send RESTFul requests. + *

+ * Many of the methods return a reference to the 'this,' thereby allowing + * method chaining. + *
+ * An example of usage can be found below: + *

+ * RESTClient client;
+ * try {
+ *     client = new RESTClient("http://www.openecomp.org");
+ *     APIResponse response = client
+ *         .setHeader("Accept", "application/json")
+ *         .setHeader("Clientid", "clientid")
+ *         .setHeader("header", "value")
+ *         .httpPost("postbody");
+ *     if (response.getStatusCode() == 200) {
+ *         System.out.println("Success!");
+ *     }
+ *  } catch (RESTException re) {
+ *      // Handle Exception
+ *  }
+ * 
+ * + * @version 1.0 + * @since 1.0 + */ +public class RESTClient { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,RESTClient.class); + private final String proxyHost; + private final int proxyPort; + + private final String url; + + private final Map> headers; + private final Map> parameters; + + + + private HttpEntity httpEntity; + + /** + * Internal method used to build an APIResponse using the specified + * HttpResponse object. + * + * @param response response wrapped inside an APIResponse object + * @return api response + */ + private APIResponse buildResponse(HttpResponse response) + throws RESTException { + + return new APIResponse(response); + } + + /** + * Used to release any resources used by the connection. + * @param response HttpResponse object used for releasing the connection + * @throws RESTException if unable to release connection + * + */ + private void releaseConnection(HttpResponse response) throws RESTException { + try { + EntityUtils.consume(response.getEntity()); + } catch (IOException ioe) { + throw new RESTException(ioe); + } + } + + /** + * Sets headers to the http message. + * + * @param httpMsg http message to set headers for + */ + private void addInternalHeaders(AbstractHttpMessage httpMsg) { + if (headers.isEmpty()) { + return; + } + + final Set keySet = headers.keySet(); + for (final String key : keySet) { + final List values = headers.get(key); + for (final String value : values) { + httpMsg.addHeader(key, value); + } + } + } + + /** + * Builds the query part of a URL. + * + * @return query + */ + private String buildQuery() { + if (this.parameters.size() == 0) { + return ""; + } + + StringBuilder sb = new StringBuilder(); + String charSet = "UTF-8"; + try { + Iterator keyitr = this.parameters.keySet().iterator(); + for (int i = 0; keyitr.hasNext(); ++i) { + if (i > 0) { + sb.append("&"); + } + + final String name = keyitr.next(); + final List values = this.parameters.get(name); + for(final String value : values) { + sb.append(URLEncoder.encode(name, charSet)); + sb.append("="); + sb.append(URLEncoder.encode(value, charSet)); + } + } + } catch (UnsupportedEncodingException e) { + LOGGER.debug("Exception :", e); + } + return sb.toString(); + } + + /** + * Creates an http client that can be used for sending http requests. + * + * @return created http client + * + * @throws RESTException if unable to create http client. + */ + private CloseableHttpClient createClient() throws RESTException { + HttpClientBuilder clientBuilder; + try { + SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory( + (SSLSocketFactory) SSLSocketFactory.getDefault(), + new HostNameVerifier()); + Registry registry = RegistryBuilder + . create() + .register("http", PlainConnectionSocketFactory.getSocketFactory()) + .register("https", sslSocketFactory).build(); + PoolingHttpClientConnectionManager manager = new PoolingHttpClientConnectionManager(registry); + clientBuilder = HttpClientBuilder.create().setConnectionManager(manager); + } catch (Exception ex) { + LOGGER.debug("Exception :", ex); + throw new RESTException(ex.getMessage()); + } + clientBuilder.disableRedirectHandling(); + + if ((this.proxyHost != null) && (this.proxyPort != -1)) { + HttpHost proxy = new HttpHost(this.proxyHost, this.proxyPort); + clientBuilder.setProxy(proxy); + } + int timeoutInSeconds = 300; + RequestConfig requestConfig = RequestConfig.custom() + .setConnectTimeout(timeoutInSeconds * 1000) + .setConnectionRequestTimeout(timeoutInSeconds * 1000) + .setSocketTimeout(timeoutInSeconds * 1000).build(); + return clientBuilder.setDefaultRequestConfig(requestConfig).build(); + } + + + + + + /** + * Creates a RESTClient with the specified URL, proxy host, and proxy port. + * + * @param url URL to send request to + * @param proxyHost proxy host to use for sending request + * @param proxyPort proxy port to use for sendin request + * + * @throws RESTException if unable to create a RESTClient + */ + public RESTClient(String url, String proxyHost, int proxyPort) { + this(new RESTConfig(url, proxyHost, proxyPort)); + } + + /** + * Creates a RESTClient with the specified URL. No proxy host nor port will + * be used. + * + * @param url URL to send request to + * + * @throws RESTException if unable to create a RESTClient + */ + public RESTClient(String url) { + this(new RESTConfig(url)); + } + + /** + * Creates a RESTClient with the RESTConfig object. + * + * @param restConfig config to use for sending request + * + * @throws RESTException if unable to create a RESTClient + */ + public RESTClient(RESTConfig restConfig) { + this.headers = new LinkedHashMap<>(); + this.parameters = new LinkedHashMap<>(); + this.url = restConfig.getURL(); + this.proxyHost = restConfig.getProxyHost(); + this.proxyPort = restConfig.getProxyPort(); + } + + /** + * Adds parameter to be sent during http request. + *

+ * Does not remove any parameters with the same name, thus allowing + * duplicates. + * + * @param name name of parameter + * @param value value of parametr + * @return a reference to 'this', which can be used for method chaining + */ + public RESTClient addParameter(String name, String value) { + if (!parameters.containsKey(name)) { + parameters.put(name, new ArrayList<>()); + } + + List values = parameters.get(name); + values.add(value); + + return this; + } + + /** + * Sets parameter to be sent during http request. + *

+ * Removes any parameters with the same name, thus disallowing duplicates. + * + * @param name name of parameter + * @param value value of parametr + * @return a reference to 'this', which can be used for method chaining + */ + public RESTClient setParameter(String name, String value) { + if (parameters.containsKey(name)) { + parameters.get(name).clear(); + } + + addParameter(name, value); + + return this; + } + + /** + * Adds http header to be sent during http request. + *

+ * Does not remove any headers with the same name, thus allowing + * duplicates. + * + * @param name name of header + * @param value value of header + * @return a reference to 'this', which can be used for method chaining + */ + public RESTClient addHeader(String name, String value) { + if (!headers.containsKey(name)) { + headers.put(name, new ArrayList<>()); + } + + List values = headers.get(name); + values.add(value); + + return this; + } + + /** + * Sets http header to be sent during http request. + *

+ * Does not remove any headers with the same name, thus allowing + * duplicates. + * + * @param name name of header + * @param value value of header + * @return a reference to 'this', which can be used for method chaining + */ + public RESTClient setHeader(String name, String value) { + if (headers.containsKey(name)) { + headers.get(name).clear(); + } + + addHeader(name, value); + + return this; + } + + /** + * Convenience method for adding the authorization header using the + * specified OAuthToken object. + * + * @param token token to use for setting authorization + * @return a reference to 'this,' which can be used for method chaining + */ + public RESTClient addAuthorizationHeader(String token) { + this.addHeader("Authorization", token); + return this; + } + + /** + * Alias for httpGet(). + * + * @see RESTClient#httpGet() + */ + public APIResponse get() throws RESTException { + return httpGet(); + } + + /** + * Sends an http GET request using the parameters and headers previously + * set. + * + * @return api response + * + * @throws RESTException if request was unsuccessful + */ + public APIResponse httpGet() throws RESTException { + HttpResponse response = null; + + try (CloseableHttpClient httpClient = createClient()) { + String query = ""; + if (!buildQuery().equals("")) { + query = "?" + buildQuery(); + } + HttpGet httpGet = new HttpGet(this.getURL() + query); + addInternalHeaders(httpGet); + + LOGGER.debug("Executing GET to url: " + this.getURL() + query); + + response = httpClient.execute(httpGet); + + return buildResponse(response); + } catch (IOException ioe) { + throw new RESTException(ioe); + } finally { + if (response != null) { + this.releaseConnection(response); + } + } + } + + /** + * Alias for httpPost() + * + * @see RESTClient#httpPost() + */ + public APIResponse post() throws RESTException { + return httpPost(); + } + + /** + * Sends an http POST request. + *

+ * POST body will be set to the values set using add/setParameter() + * + * @return api response + * + * @throws RESTException if POST was unsuccessful + */ + public APIResponse httpPost() throws RESTException { + return httpPost(buildQuery()); + } + + /** + * Sends an http POST request using the specified body. + * + * @return api response + * + * @throws RESTException if POST was unsuccessful + */ + public APIResponse httpPost(String body) throws RESTException { + HttpResponse response = null; + try (CloseableHttpClient httpClient = createClient()) { + HttpPost httpPost = new HttpPost(this.getURL()); + addInternalHeaders(httpPost); + if (body != null && !body.equals("")) { + httpEntity = new StringEntity(body); + httpPost.setEntity(new StringEntity(body)); + } + LOGGER.debug("Executing POST to url: " + this.getURL()); + + response = httpClient.execute(httpPost); + + return buildResponse(response); + + } catch (IOException e) { + throw new RESTException(e); + } finally { + if (response != null) { + this.releaseConnection(response); + } + } + } + + /** + * + * @param body Data to PUT + * @return API response + * @throws RESTException + */ + public APIResponse httpPut(String body) throws RESTException { + HttpResponse response = null; + try (CloseableHttpClient httpClient = createClient()) { + + String query = ""; + if (!buildQuery().equals("")) { + query = "?" + buildQuery(); + } + HttpPut httpPut = new HttpPut(this.getURL() + query); + addInternalHeaders(httpPut); + if (body != null && !body.equals("")) { + httpEntity = new StringEntity(body); + httpPut.setEntity(httpEntity); + } + LOGGER.debug("Executing PUT to url: " + this.getURL() + query); + + response = httpClient.execute(httpPut); + + return buildResponse(response); + } catch (IOException e) { + throw new RESTException(e); + } finally { + if (response != null) { + this.releaseConnection(response); + } + } + } + + /** + * Alias for httpPatch(). + * + * @see RESTClient#httpPatch() + */ + public APIResponse patch(String body) throws RESTException { + return httpPatch(body); + } + + /** + * + * @param body Data to PATCH + * @return API response + * @throws RESTException + */ + public APIResponse httpPatch(String body) throws RESTException { + HttpResponse response = null; + try (CloseableHttpClient httpClient = createClient()) { + String query = ""; + if (!buildQuery().equals("")) { + query = "?" + buildQuery(); + } + HttpPatch httpPatch = new HttpPatch(this.getURL() + query); + addInternalHeaders(httpPatch); + if (body != null && !body.equals("")) { + httpEntity = new StringEntity(body); + httpPatch.setEntity(httpEntity); + } + LOGGER.debug("Executing PATCH to url: " + this.getURL() + query); + + response = httpClient.execute(httpPatch); + + return buildResponse(response); + } catch (IOException e) { + throw new RESTException(e); + } finally { + if (response != null) { + this.releaseConnection(response); + } + } + } + + /** + * Alias for httpDelete(). + * + * @see RESTClient#httpDelete() + */ + public APIResponse delete() throws RESTException { + return httpDelete(); + } + + /** + * Sends an http DELETE request using the parameters and headers previously + * set. + * + * @return api response + * + * @throws RESTException if request was unsuccessful + */ + public APIResponse httpDelete() throws RESTException { + return httpDelete(null); + } + + /** + * Sends an http DELETE request with a body, using the parameters and headers + * previously set. + * + * @return api response + * + * @throws RESTException if request was unsuccessful + */ + public APIResponse httpDelete(String body) throws RESTException { + HttpResponse response = null; + + try (CloseableHttpClient httpClient = createClient()){ + + String query = ""; + if (!buildQuery().equals("")) { + query = "?" + buildQuery(); + } + HttpDeleteWithBody httpDelete = new HttpDeleteWithBody(this.getURL() + query); + addInternalHeaders(httpDelete); + + if (body != null && !body.equals("")) { + httpEntity = new StringEntity(body); + httpDelete.setEntity(httpEntity); + } + + LOGGER.debug("Executing DELETE to url: " + this.getURL() + query); + + response = httpClient.execute(httpDelete); + + return buildResponse(response); + } catch (IOException ioe) { + throw new RESTException(ioe); + } finally { + if (response != null) { + this.releaseConnection(response); + } + } + } + + public String getURL() { + return url; + } + public Map> getHeaders() { + return headers; + } + public Map> getParameters() { + return parameters; + } + public HttpEntity getHttpEntity() { + return httpEntity; + } + + + /** + * Allows inclusion of a request body with DELETE. + */ + private class HttpDeleteWithBody extends HttpEntityEnclosingRequestBase { + public static final String METHOD_NAME = "DELETE"; + + @Override + public String getMethod() { + return METHOD_NAME; + } + + public HttpDeleteWithBody(final String uri) { + super(); + setURI(URI.create(uri)); + } + + public HttpDeleteWithBody(final URI uri) { + super(); + setURI(uri); + } + + public HttpDeleteWithBody() { + super(); + } + } +} diff --git a/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/RESTConfig.java b/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/RESTConfig.java new file mode 100644 index 0000000000..b5fecbdb87 --- /dev/null +++ b/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/RESTConfig.java @@ -0,0 +1,131 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.rest; + +/** + * Configuration values to be used by the RESTClient. + * + * @version 1.0 + * + */ +public class RESTConfig { + private final String URL; + + private final boolean trustAllCerts; + private final String proxyHost; + private final int proxyPort; + + /** + * Creates a RESTConfig with the specified URL. + *

+ * By default, no proxy will be used, and only valid certificates will + * be used. + * + * @param URL url to set + */ + public RESTConfig(final String URL) { + this(URL, null, -1, false); + } + + /** + * Creates a RESTConfig with the specified URL and whether to trust all + * certificates. + *

+ * Trusting all certificates is useful for testing self-signed + * certificates. By default, no proxy will be used. + * + * @param URL url to set + * @param trustAllCerts whether to trust all certificates + */ + public RESTConfig(final String URL, final boolean trustAllCerts) { + this(URL, null, -1, trustAllCerts); + } + + /** + * Creates a RESTConfig with the specified URL and proxy. + *

+ * By default, only valid certificates will be allowed. + * + * @param URL url to set + * @param proxyHost proxy host to set + * @param proxyPort proxy port to set + */ + public RESTConfig(final String URL, final String proxyHost, + final int proxyPort) { + + this(URL, proxyHost, proxyPort, false); + } + + /** + * Creates a RESTConfig object with the specified URL, proxy host, proxy + * port, and whether to trust all certificates. Allowing all certificates + * is useful for testing self-signed certificates. + * + * @param URL url to set + * @param proxyHost proxy host to set + * @param proxyPort porxy port to set + * @param trustAllCerts whether to trust all certificates + */ + public RESTConfig(final String URL, final String proxyHost, + final int proxyPort, boolean trustAllCerts) { + + this.URL = URL; + this.proxyHost = proxyHost; + this.proxyPort = proxyPort; + this.trustAllCerts = trustAllCerts; + } + + /** + * Gets the URL to use. + * + * @return URL to use + */ + public String getURL() { + return this.URL; + } + + /** + * Gets whether to trust all certificates. + * + * @return true if to trust all certificates, false otherwise + */ + public boolean trustAllCerts() { + return this.trustAllCerts; + } + + /** + * Gets proxy host or null if proxy host has not been set. + * + * @return proxy host + */ + public String getProxyHost() { + return this.proxyHost; + } + + /** + * Gets proxy port or -1 if no proxy port has been set. + * + * @return proxy port + */ + public int getProxyPort() { + return this.proxyPort; + } +} diff --git a/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/RESTException.java b/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/RESTException.java new file mode 100644 index 0000000000..579927c2ce --- /dev/null +++ b/bpmn/MSORESTClient/src/main/java/org/onap/so/rest/RESTException.java @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.rest; + +/** + * A custom exception class. + * + * @version 1.0 + * + */ +public class RESTException extends Exception { + private static final long serialVersionUID = -6874042744590915838L; + // http status code + private final int statusCode; + + // error message + private final String errorMessage; + + /** + * {@inheritDoc} + * @see Exception#RESTException(String) + */ + public RESTException(final String errorMessage) { + this(-1, errorMessage); + } + + /** + * {@inheritDoc} + * @see Exception#RESTException(Throwable) + */ + public RESTException(final Throwable cause) { + super(cause); + this.statusCode = -1; + this.errorMessage = cause.getMessage(); + } + + /** + * Creates a RESTException with the specified status code and error + * message. + * + * @param statusCode http status code + * @param errorMessage http error message + */ + public RESTException(final int statusCode, final String errorMessage) { + super(statusCode + ":" + errorMessage); + this.statusCode = statusCode; + this.errorMessage = errorMessage; + } + + /** + * Gets the status code or -1 if none has been set. + * + * @return status code + */ + public int getStatusCode() { + return this.statusCode; + } + + /** + * Gets the error message. + * + * @return error message + */ + public String getErrorMessage() { + return this.errorMessage; + } +} diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java deleted file mode 100644 index d85a790841..0000000000 --- a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.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.rest; - -import java.io.IOException; -import java.util.Arrays; - -import org.apache.http.Header; -import org.apache.http.HttpResponse; -import org.apache.http.util.EntityUtils; - -/** - * An immutable class that encapsulates an API response. - * - * @version 1.0 - * @since 1.0 - */ -public class APIResponse { - private final int statusCode; - private final byte[] responseBody; - private final HttpHeader[] headers; - - /** - * Internal method used to create http headers using the specified - * HttpResponse object. - * - * @param httpResponse used to create headers - * @return http headers - */ - private static HttpHeader[] buildHeaders(final HttpResponse httpResponse) { - final Header[] headers = httpResponse.getAllHeaders(); - - HttpHeader[] httpHeaders = new HttpHeader[headers.length]; - for (int i = 0; i < headers.length; ++i) { - final Header header = headers[i]; - final String name = header.getName(); - final String value = header.getValue(); - final HttpHeader httpHeader = new HttpHeader(name, value); - httpHeaders[i] = httpHeader; - } - - return httpHeaders; - } - - /** - * Create an APIResponse object using the specified HttpResponse object. - * - * @param httpResponse used to create the APIResponse - * - * @throws RESTException if unable to read from the HttpResponse object - */ - public APIResponse(final HttpResponse httpResponse) throws RESTException { - try { - this.statusCode = httpResponse.getStatusLine().getStatusCode(); - - if (httpResponse.getEntity() == null) - { - this.responseBody = null; - } - else - { - this.responseBody = EntityUtils.toByteArray(httpResponse.getEntity()); - } - - this.headers = buildHeaders(httpResponse); - } catch (IOException ioe) { - throw new RESTException(ioe); - } - } - - /** - * Gets the http status code returned by the api server. - *

- * For example, status code 200 represents 'OK.' - * - * @return status code - */ - public int getStatusCode() { - return this.statusCode; - } - - /** - * Gets the http response body as a byte array. - * - * @return http response body - */ - public byte[] getResponseBodyAsByteArray() { - // avoid exposing internals, create copy - if (this.responseBody != null) { - return Arrays.copyOf(this.responseBody, this.responseBody.length); - } else { - return null; - } - } - - /** - * Gets the http response body as a string. - * - * @return http response body - */ - public String getResponseBodyAsString() { - if (this.responseBody != null) { - return new String(this.responseBody); - } else { - return ""; - } - } - - /** - * Gets a list of all the headers returned by the API response. - * - * @return an array of all the HttpHeaders - */ - public HttpHeader[] getAllHeaders() { - // avoid exposing internals, create copy - return Arrays.copyOf(this.headers, this.headers.length); - } - - public String getFirstHeader(String name) { - for (HttpHeader header : headers) { - if (header.getName().equals(name)) { - return header.getValue(); - } - } - return null; - } -} diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HostNameVerifier.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HostNameVerifier.java deleted file mode 100644 index ffef5f9385..0000000000 --- a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HostNameVerifier.java +++ /dev/null @@ -1,49 +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.rest; - -import javax.net.ssl.SSLException; - -import org.apache.http.conn.ssl.AbstractVerifier; -import org.openecomp.mso.logger.MsoLogger; - -/** - * @version 1.0 - * Place holder to validate host name, for now just invokes the super class method - * - */ -public class HostNameVerifier extends AbstractVerifier { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - public final void verify( - final String host, - final String[] cns, - final String[] subjectAlts) throws SSLException { - try { - verify(host, cns, subjectAlts, true); - } catch (SSLException sex) { - LOGGER.debug("Exception:", sex); - } - } - -} diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HttpHeader.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HttpHeader.java deleted file mode 100644 index 79eea08dac..0000000000 --- a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/HttpHeader.java +++ /dev/null @@ -1,65 +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.rest; - -/** - * An immutable class used to wrap an http header. - * - * @version 1.0 - * @since 1.0 - */ -public class HttpHeader { - private final String name; - private final String value; - - /** - * Create an http header using the specified name and value - * - * @param name name of http header - * @param value value of http header - */ - public HttpHeader(final String name, final String value) { - if (name == null) { - throw new IllegalArgumentException("Name may not be null."); - } - - this.name = name; - this.value = value; - } - - /** - * Gets the header name. - * - * @return header name - */ - public String getName() { - return this.name; - } - - /** - * Gets the header value. - * - * @return header value - */ - public String getValue() { - return this.value; - } -} diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java deleted file mode 100644 index 3170e49371..0000000000 --- a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java +++ /dev/null @@ -1,614 +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.rest; - -import java.io.Closeable; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Set; - -import javax.net.ssl.SSLSocketFactory; - -import org.apache.http.HttpEntity; -import org.apache.http.HttpHost; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPatch; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.config.Registry; -import org.apache.http.config.RegistryBuilder; -import org.apache.http.conn.socket.ConnectionSocketFactory; -import org.apache.http.conn.socket.PlainConnectionSocketFactory; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.apache.http.message.AbstractHttpMessage; -import org.apache.http.util.EntityUtils; - -import org.openecomp.mso.logger.MsoLogger; -/** - * Client used to send RESTFul requests. - *

- * Many of the methods return a reference to the 'this,' thereby allowing - * method chaining. - *
- * An example of usage can be found below: - *

- * RESTClient client;
- * try {
- *     client = new RESTClient("http://www.openecomp.org");
- *     APIResponse response = client
- *         .setHeader("Accept", "application/json")
- *         .setHeader("Clientid", "clientid")
- *         .setHeader("header", "value")
- *         .httpPost("postbody");
- *     if (response.getStatusCode() == 200) {
- *         System.out.println("Success!");
- *     }
- *  } catch (RESTException re) {
- *      // Handle Exception
- *  }
- * 
- * - * @version 1.0 - * @since 1.0 - */ -public class RESTClient { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - private final String proxyHost; - private final int proxyPort; - - private final String URL; - - private final LinkedHashMap> headers; - private final LinkedHashMap> parameters; - - private HttpEntity httpEntity; - - /** - * Internal method used to build an APIResponse using the specified - * HttpResponse object. - * - * @param response response wrapped inside an APIResponse object - * @return api response - */ - private APIResponse buildResponse(HttpResponse response) - throws RESTException { - - return new APIResponse(response); - } - - /** - * Used to release any resources used by the connection. - * @param response HttpResponse object used for releasing the connection - * @throws RESTException if unable to release connection - * - */ - private void releaseConnection(HttpResponse response) throws RESTException { - try { - EntityUtils.consume(response.getEntity()); - } catch (IOException ioe) { - throw new RESTException(ioe); - } - } - - /** - * Sets headers to the http message. - * - * @param httpMsg http message to set headers for - */ - private void addInternalHeaders(AbstractHttpMessage httpMsg) { - if (headers.isEmpty()) { - return; - } - - final Set keySet = headers.keySet(); - for (final String key : keySet) { - final List values = headers.get(key); - for (final String value : values) { - httpMsg.addHeader(key, value); - } - } - } - - /** - * Builds the query part of a URL. - * - * @return query - */ - private String buildQuery() { - if (this.parameters.size() == 0) { - return ""; - } - - StringBuilder sb = new StringBuilder(); - String charSet = "UTF-8"; - try { - Iterator keyitr = this.parameters.keySet().iterator(); - for (int i = 0; keyitr.hasNext(); ++i) { - if (i > 0) { - sb.append("&"); - } - - final String name = keyitr.next(); - final List values = this.parameters.get(name); - for(final String value : values) { - sb.append(URLEncoder.encode(name, charSet)); - sb.append("="); - sb.append(URLEncoder.encode(value, charSet)); - } - } - } catch (UnsupportedEncodingException e) { - LOGGER.debug("Exception :", e); - } - return sb.toString(); - } - - /** - * Creates an http client that can be used for sending http requests. - * - * @return created http client - * - * @throws RESTException if unable to create http client. - */ - private CloseableHttpClient createClient() throws RESTException { - //TODO - we may want to trust self signed certificate at some point - add implementation here - HttpClientBuilder clientBuilder; - - try { - SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory( - (SSLSocketFactory) SSLSocketFactory.getDefault(), - new HostNameVerifier()); - Registry registry = RegistryBuilder - . create() - .register("http", - PlainConnectionSocketFactory.getSocketFactory()) - .register("https", sslSocketFactory).build(); - PoolingHttpClientConnectionManager manager = new PoolingHttpClientConnectionManager( - registry); - clientBuilder = HttpClientBuilder.create().setConnectionManager( - manager); - } catch (Exception ex) { - LOGGER.debug("Exception :", ex); - throw new RESTException(ex.getMessage()); - } - clientBuilder.disableRedirectHandling(); - - if ((this.proxyHost != null) && (this.proxyPort != -1)) { - HttpHost proxy = new HttpHost(this.proxyHost, this.proxyPort); - clientBuilder.setProxy(proxy); - } - - return clientBuilder.build(); - } - - /** - * Creates a RESTClient with the specified URL, proxy host, and proxy port. - * - * @param URL URL to send request to - * @param proxyHost proxy host to use for sending request - * @param proxyPort proxy port to use for sendin request - * - * @throws RESTException if unable to create a RESTClient - */ - public RESTClient(String URL, String proxyHost, int proxyPort) - throws RESTException { - this(new RESTConfig(URL, proxyHost, proxyPort)); - } - - /** - * Creates a RESTClient with the specified URL. No proxy host nor port will - * be used. - * - * @param URL URL to send request to - * - * @throws RESTException if unable to create a RESTClient - */ - public RESTClient(String URL) throws RESTException { - this(new RESTConfig(URL)); - } - - /** - * Creates a RESTClient with the RESTConfig object. - * - * @param restConfig config to use for sending request - * - * @throws RESTException if unable to create a RESTClient - */ - public RESTClient(RESTConfig restConfig) throws RESTException { - this.headers = new LinkedHashMap<>(); - this.parameters = new LinkedHashMap<>(); - this.URL = restConfig.getURL(); - this.proxyHost = restConfig.getProxyHost(); - this.proxyPort = restConfig.getProxyPort(); - } - - /** - * Adds parameter to be sent during http request. - *

- * Does not remove any parameters with the same name, thus allowing - * duplicates. - * - * @param name name of parameter - * @param value value of parametr - * @return a reference to 'this', which can be used for method chaining - */ - public RESTClient addParameter(String name, String value) { - if (!parameters.containsKey(name)) { - parameters.put(name, new ArrayList<>()); - } - - List values = parameters.get(name); - values.add(value); - - return this; - } - - /** - * Sets parameter to be sent during http request. - *

- * Removes any parameters with the same name, thus disallowing duplicates. - * - * @param name name of parameter - * @param value value of parametr - * @return a reference to 'this', which can be used for method chaining - */ - public RESTClient setParameter(String name, String value) { - if (parameters.containsKey(name)) { - parameters.get(name).clear(); - } - - addParameter(name, value); - - return this; - } - - /** - * Adds http header to be sent during http request. - *

- * Does not remove any headers with the same name, thus allowing - * duplicates. - * - * @param name name of header - * @param value value of header - * @return a reference to 'this', which can be used for method chaining - */ - public RESTClient addHeader(String name, String value) { - if (!headers.containsKey(name)) { - headers.put(name, new ArrayList<>()); - } - - List values = headers.get(name); - values.add(value); - - return this; - } - - /** - * Sets http header to be sent during http request. - *

- * Does not remove any headers with the same name, thus allowing - * duplicates. - * - * @param name name of header - * @param value value of header - * @return a reference to 'this', which can be used for method chaining - */ - public RESTClient setHeader(String name, String value) { - if (headers.containsKey(name)) { - headers.get(name).clear(); - } - - addHeader(name, value); - - return this; - } - - /** - * Convenience method for adding the authorization header using the - * specified OAuthToken object. - * - * @param token token to use for setting authorization - * @return a reference to 'this,' which can be used for method chaining - */ - public RESTClient addAuthorizationHeader(String token) { - this.addHeader("Authorization", token); - return this; - } - - /** - * Alias for httpGet(). - * - * @see RESTClient#httpGet() - */ - public APIResponse get() throws RESTException { - return httpGet(); - } - - /** - * Sends an http GET request using the parameters and headers previously - * set. - * - * @return api response - * - * @throws RESTException if request was unsuccessful - */ - public APIResponse httpGet() throws RESTException { - HttpResponse response = null; - - try (CloseableHttpClient httpClient = createClient()) { - String query = ""; - if (!buildQuery().equals("")) { - query = "?" + buildQuery(); - } - HttpGet httpGet = new HttpGet(this.getURL() + query); - addInternalHeaders(httpGet); - - response = httpClient.execute(httpGet); - - APIResponse apiResponse = buildResponse(response); - return apiResponse; - } catch (IOException ioe) { - throw new RESTException(ioe); - } finally { - if (response != null) { - this.releaseConnection(response); - } - } - } - - /** - * Alias for httpPost() - * - * @see RESTClient#httpPost() - */ - public APIResponse post() throws RESTException { - return httpPost(); - } - - /** - * Sends an http POST request. - *

- * POST body will be set to the values set using add/setParameter() - * - * @return api response - * - * @throws RESTException if POST was unsuccessful - */ - public APIResponse httpPost() throws RESTException { - APIResponse response = httpPost(buildQuery()); - return response; - } - - /** - * Sends an http POST request using the specified body. - * - * @return api response - * - * @throws RESTException if POST was unsuccessful - */ - public APIResponse httpPost(String body) throws RESTException { - HttpResponse response = null; - try (CloseableHttpClient httpClient = createClient()) { - HttpPost httpPost = new HttpPost(this.getURL()); - addInternalHeaders(httpPost); - if (body != null && !body.equals("")) { - httpEntity = new StringEntity(body); - httpPost.setEntity(new StringEntity(body)); - } - - response = httpClient.execute(httpPost); - - return buildResponse(response); - } catch (IOException e) { - throw new RESTException(e); - } finally { - if (response != null) { - this.releaseConnection(response); - } - } - } - - /** - * - * @param body Data to PUT - * @return API response - * @throws RESTException - */ - public APIResponse httpPut(String body) throws RESTException { - HttpResponse response = null; - try (CloseableHttpClient httpClient = createClient()) { - - String query = ""; - if (!buildQuery().equals("")) { - query = "?" + buildQuery(); - } - HttpPut httpPut = new HttpPut(this.getURL() + query); - addInternalHeaders(httpPut); - if (body != null && !body.equals("")) { - httpEntity = new StringEntity(body); - httpPut.setEntity(httpEntity); - } - - response = httpClient.execute(httpPut); - - return buildResponse(response); - } catch (IOException e) { - throw new RESTException(e); - } finally { - if (response != null) { - this.releaseConnection(response); - } - } - } - - /** - * Alias for httpPatch(). - * - * @see RESTClient#httpPatch() - */ - public APIResponse patch(String body) throws RESTException { - return httpPatch(body); - } - - /** - * - * @param body Data to PATCH - * @return API response - * @throws RESTException - */ - public APIResponse httpPatch(String body) throws RESTException { - HttpResponse response = null; - try (CloseableHttpClient httpClient = createClient()) { - String query = ""; - if (!buildQuery().equals("")) { - query = "?" + buildQuery(); - } - HttpPatch httpPatch = new HttpPatch(this.getURL() + query); - addInternalHeaders(httpPatch); - if (body != null && !body.equals("")) { - httpEntity = new StringEntity(body); - httpPatch.setEntity(httpEntity); - } - - response = httpClient.execute(httpPatch); - - return buildResponse(response); - } catch (IOException e) { - throw new RESTException(e); - } finally { - if (response != null) { - this.releaseConnection(response); - } - } - } - - /** - * Alias for httpDelete(). - * - * @see RESTClient#httpDelete() - */ - public APIResponse delete() throws RESTException { - return httpDelete(); - } - - /** - * Sends an http DELETE request using the parameters and headers previously - * set. - * - * @return api response - * - * @throws RESTException if request was unsuccessful - */ - public APIResponse httpDelete() throws RESTException { - return httpDelete(null); - } - - /** - * Sends an http DELETE request with a body, using the parameters and headers - * previously set. - * - * @return api response - * - * @throws RESTException if request was unsuccessful - */ - public APIResponse httpDelete(String body) throws RESTException { - HttpResponse response = null; - - try (CloseableHttpClient httpClient = createClient()){ - - String query = ""; - if (!buildQuery().equals("")) { - query = "?" + buildQuery(); - } - HttpDeleteWithBody httpDelete = new HttpDeleteWithBody(this.getURL() + query); - addInternalHeaders(httpDelete); - - if (body != null && !body.equals("")) { - httpEntity = new StringEntity(body); - httpDelete.setEntity(httpEntity); - } - - response = httpClient.execute(httpDelete); - - APIResponse apiResponse = buildResponse(response); - return apiResponse; - } catch (IOException ioe) { - throw new RESTException(ioe); - } finally { - if (response != null) { - this.releaseConnection(response); - } - } - } - - public String getURL() { - return URL; - } - public LinkedHashMap> getHeaders() { - return headers; - } - public LinkedHashMap> getParameters() { - return parameters; - } - public HttpEntity getHttpEntity() { - return httpEntity; - } - - - /** - * Allows inclusion of a request body with DELETE. - */ - private class HttpDeleteWithBody extends HttpEntityEnclosingRequestBase { - public static final String METHOD_NAME = "DELETE"; - - public String getMethod() { - return METHOD_NAME; - } - - public HttpDeleteWithBody(final String uri) { - super(); - setURI(URI.create(uri)); - } - - public HttpDeleteWithBody(final URI uri) { - super(); - setURI(uri); - } - - public HttpDeleteWithBody() { - super(); - } - } -} diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTConfig.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTConfig.java deleted file mode 100644 index 0e4681824a..0000000000 --- a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTConfig.java +++ /dev/null @@ -1,131 +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.rest; - -/** - * Configuration values to be used by the RESTClient. - * - * @version 1.0 - * - */ -public class RESTConfig { - private final String URL; - - private final boolean trustAllCerts; - private final String proxyHost; - private final int proxyPort; - - /** - * Creates a RESTConfig with the specified URL. - *

- * By default, no proxy will be used, and only valid certificates will - * be used. - * - * @param URL url to set - */ - public RESTConfig(final String URL) { - this(URL, null, -1, false); - } - - /** - * Creates a RESTConfig with the specified URL and whether to trust all - * certificates. - *

- * Trusting all certificates is useful for testing self-signed - * certificates. By default, no proxy will be used. - * - * @param URL url to set - * @param trustAllCerts whether to trust all certificates - */ - public RESTConfig(final String URL, final boolean trustAllCerts) { - this(URL, null, -1, trustAllCerts); - } - - /** - * Creates a RESTConfig with the specified URL and proxy. - *

- * By default, only valid certificates will be allowed. - * - * @param URL url to set - * @param proxyHost proxy host to set - * @param proxyPort proxy port to set - */ - public RESTConfig(final String URL, final String proxyHost, - final int proxyPort) { - - this(URL, proxyHost, proxyPort, false); - } - - /** - * Creates a RESTConfig object with the specified URL, proxy host, proxy - * port, and whether to trust all certificates. Allowing all certificates - * is useful for testing self-signed certificates. - * - * @param URL url to set - * @param proxyHost proxy host to set - * @param proxyPort porxy port to set - * @param trustAllCerts whether to trust all certificates - */ - public RESTConfig(final String URL, final String proxyHost, - final int proxyPort, boolean trustAllCerts) { - - this.URL = URL; - this.proxyHost = proxyHost; - this.proxyPort = proxyPort; - this.trustAllCerts = trustAllCerts; - } - - /** - * Gets the URL to use. - * - * @return URL to use - */ - public String getURL() { - return this.URL; - } - - /** - * Gets whether to trust all certificates. - * - * @return true if to trust all certificates, false otherwise - */ - public boolean trustAllCerts() { - return this.trustAllCerts; - } - - /** - * Gets proxy host or null if proxy host has not been set. - * - * @return proxy host - */ - public String getProxyHost() { - return this.proxyHost; - } - - /** - * Gets proxy port or -1 if no proxy port has been set. - * - * @return proxy port - */ - public int getProxyPort() { - return this.proxyPort; - } -} diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTException.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTException.java deleted file mode 100644 index 88fa16f736..0000000000 --- a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTException.java +++ /dev/null @@ -1,85 +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.rest; - -/** - * A custom exception class. - * - * @version 1.0 - * - */ -public class RESTException extends Exception { - private static final long serialVersionUID = -6874042744590915838L; - // http status code - private final int statusCode; - - // error message - private final String errorMessage; - - /** - * {@inheritDoc} - * @see Exception#RESTException(String) - */ - public RESTException(final String errorMessage) { - this(-1, errorMessage); - } - - /** - * {@inheritDoc} - * @see Exception#RESTException(Throwable) - */ - public RESTException(final Throwable cause) { - super(cause); - this.statusCode = -1; - this.errorMessage = cause.getMessage(); - } - - /** - * Creates a RESTException with the specified status code and error - * message. - * - * @param statusCode http status code - * @param errorMessage http error message - */ - public RESTException(final int statusCode, final String errorMessage) { - super(statusCode + ":" + errorMessage); - this.statusCode = statusCode; - this.errorMessage = errorMessage; - } - - /** - * Gets the status code or -1 if none has been set. - * - * @return status code - */ - public int getStatusCode() { - return this.statusCode; - } - - /** - * Gets the error message. - * - * @return error message - */ - public String getErrorMessage() { - return this.errorMessage; - } -} diff --git a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/APIResponseTest.java b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/APIResponseTest.java new file mode 100644 index 0000000000..2c81fda32b --- /dev/null +++ b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/APIResponseTest.java @@ -0,0 +1,57 @@ +/* +* ============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.rest; + +import static org.junit.Assert.assertEquals; + +import org.json.JSONObject; +import org.junit.Test; + +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.HttpEntity; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.message.BasicHttpResponse; + +public class APIResponseTest { + + @Test + public void test() throws Exception { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("firstName", "firstName1"); + jsonObject.put("lastName", "lastName1"); + String jsonObjectAsString= jsonObject.toString(); + HttpEntity entity = new StringEntity(jsonObjectAsString, ContentType.APPLICATION_JSON); + ProtocolVersion ver = new ProtocolVersion("HTTP", 1, 1); + HttpResponse response = new BasicHttpResponse(ver, 1, "Ok"); + response.setStatusLine(ver, 200); + response.setEntity(entity); + response.setHeader("name", "value"); + response.setStatusCode(200); + APIResponse apiResponse = new APIResponse(response); + assertEquals(200, apiResponse.getStatusCode()); + assertEquals(jsonObject.toString(), apiResponse.getResponseBodyAsString()); + assertEquals("value", apiResponse.getFirstHeader("name")); + assertEquals(1, apiResponse.getAllHeaders().length); + assertEquals(49, apiResponse.getResponseBodyAsByteArray().length); + } +} diff --git a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/HttpHeaderTest.java b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/HttpHeaderTest.java new file mode 100644 index 0000000000..bc096687b7 --- /dev/null +++ b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/HttpHeaderTest.java @@ -0,0 +1,40 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ + +package org.onap.so.rest; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class HttpHeaderTest { + + @Test + public void test() { + HttpHeader hth= new HttpHeader("name", "value"); + assertEquals("name", hth.getName()); + assertEquals("value", hth.getValue()); + } + + @Test (expected = IllegalArgumentException.class) + public void testException() { + HttpHeader httpHeader = new HttpHeader(null, "value"); //null + } +} diff --git a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java new file mode 100644 index 0000000000..bbdaa94581 --- /dev/null +++ b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java @@ -0,0 +1,195 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ + +package org.onap.so.rest; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.patch; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.spy; + +import org.json.JSONObject; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.springframework.http.HttpStatus; + +import com.github.tomakehurst.wiremock.junit.WireMockRule; + +public class RESTClientTest { + + private RESTClient restClient; + private JSONObject jsonPayload; + private JSONObject jsonResponse; + private String jsonObjectAsString; + private String jsonResponseAsString; + + @Rule + public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(28090)); + + @Before + public void before() throws Exception { + jsonPayload = new JSONObject(); + jsonPayload.put("firstName", "firstName1"); + jsonPayload.put("lastName", "lastName1"); + jsonObjectAsString = jsonPayload.toString(); + jsonResponse = new JSONObject(); + jsonResponse.put("response", "responseValue"); + jsonResponseAsString = jsonResponse.toString(); + restClient = new RESTClient("http://localhost:28090/example", "localhost", 28090); + } + + @Test + public void testHeadersParameters() throws Exception { + restClient.setHeader("name", "value"); + restClient.setParameter("name", "value"); + assertEquals("[value]", restClient.getParameters().get("name").toString()); + assertEquals("[value]", restClient.getHeaders().get("name").toString()); + restClient.setHeader("name", "value2"); + assertEquals("[value2]", restClient.getHeaders().get("name").toString()); + restClient.setParameter("name", "value2"); + assertEquals("[value2]", restClient.getParameters().get("name").toString()); + restClient.addParameter("name", "value"); + assertEquals(1, restClient.getParameters().size()); + restClient.addAuthorizationHeader("token"); + assertEquals("[token]", restClient.getHeaders().get("Authorization").toString()); + assertEquals("http://localhost:28090/example", restClient.getURL()); + restClient = new RESTClient("http://localhost:28090/example1"); + assertEquals("http://localhost:28090/example1", restClient.getURL()); + } + + @Test + public void testHttpPost() throws Exception { + RESTClient restClientMock = mock(RESTClient.class); + restClientMock = spy(restClient); + wireMockRule.stubFor(post(urlPathMatching("/example/*")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString))); + APIResponse apiResponse = restClientMock.httpPost(jsonObjectAsString); + assertEquals(200, apiResponse.getStatusCode()); + assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString()); + assertEquals("application/json", apiResponse.getFirstHeader("Content-Type")); + verify(restClientMock, times(2)).getURL(); + } + + @Test + public void testPost() throws Exception { + wireMockRule.stubFor(post(urlPathMatching("/example/*")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString))); + APIResponse apiResponse = restClient.post(); + assertEquals(200, apiResponse.getStatusCode()); + assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString()); + assertEquals("application/json", apiResponse.getFirstHeader("Content-Type")); + } + + @Test + public void testHttpPut() throws Exception { + wireMockRule.stubFor(put(urlPathMatching("/example/*")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString))); + restClient.setParameter("name", "value"); + APIResponse apiResponse = restClient.httpPut(jsonObjectAsString); + assertEquals(200, apiResponse.getStatusCode()); + assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString()); + assertEquals("application/json", apiResponse.getFirstHeader("Content-Type")); + + } + + @Test + public void testHttpPatch() throws Exception { + wireMockRule.stubFor(patch(urlPathMatching("/example/*")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString))); + APIResponse apiResponse = restClient.httpPatch(jsonObjectAsString); + assertEquals(200, apiResponse.getStatusCode()); + assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString()); + assertEquals("application/json", apiResponse.getFirstHeader("Content-Type")); + } + + @Test + public void testPatch_withParameter() throws Exception { + wireMockRule.stubFor(patch(urlPathMatching("/example/*")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString))); + restClient.setParameter("name", "value"); + APIResponse apiResponse = restClient.patch(jsonObjectAsString); + assertEquals(200, apiResponse.getStatusCode()); + assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString()); + assertEquals("application/json", apiResponse.getFirstHeader("Content-Type")); + } + + @Test + public void testHttpDelete_withPayload() throws Exception { + wireMockRule.stubFor(delete(urlPathMatching("/example/*")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString))); + APIResponse apiResponse = restClient.httpDelete(jsonObjectAsString); + assertEquals(200, apiResponse.getStatusCode()); + assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString()); + assertEquals("application/json", apiResponse.getFirstHeader("Content-Type")); + } + + @Test + public void testHttpDelete() throws Exception { + wireMockRule.stubFor(delete(urlPathMatching("/example/*")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString))); + APIResponse apiResponse = restClient.httpDelete(); + assertEquals(200, apiResponse.getStatusCode()); + assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString()); + assertEquals("application/json", apiResponse.getFirstHeader("Content-Type")); + } + + @Test + public void testDelete() throws Exception { + wireMockRule.stubFor(delete(urlPathMatching("/example/*")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString))); + APIResponse apiResponse = restClient.delete(); + assertEquals(200, apiResponse.getStatusCode()); + assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString()); + assertEquals("application/json", apiResponse.getFirstHeader("Content-Type")); + } + + @Test + public void testHttpGet() throws Exception { + wireMockRule.stubFor(get(urlPathMatching("/example/*")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString))); + APIResponse apiResponse = restClient.httpGet(); + assertEquals(200, apiResponse.getStatusCode()); + assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString()); + assertEquals("application/json", apiResponse.getFirstHeader("Content-Type")); + } + + @Test + public void testGet_withParameter() throws Exception { + wireMockRule.stubFor(get(urlPathMatching("/example/*")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString))); + restClient.setParameter("name", "value"); + restClient.setParameter("type", "valueType"); + APIResponse apiResponse = restClient.get(); + assertEquals(200, apiResponse.getStatusCode()); + assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString()); + assertEquals("application/json", apiResponse.getFirstHeader("Content-Type")); + } + +} diff --git a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTConfigTest.java b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTConfigTest.java new file mode 100644 index 0000000000..82c3c37be0 --- /dev/null +++ b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTConfigTest.java @@ -0,0 +1,42 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ + +package org.onap.so.rest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import org.junit.Test; + +public class RESTConfigTest { + + @Test + public void test() { + RESTConfig rcfg=mock(RESTConfig.class); + RESTConfig rcf=new RESTConfig("URL"); + RESTConfig rcfi=new RESTConfig("URL", true); + RESTConfig rcfo=new RESTConfig("URL", "10.2.3.101", 5020); + RESTConfig rcfn=new RESTConfig("URL", "10.2.3.101", 5020, true); + assert(rcfo.getProxyHost().equals("10.2.3.101")); + assertEquals(5020,rcfn.getProxyPort()); + assert(rcf.getURL().equals("URL")); + assertTrue(rcfn.trustAllCerts()); + } +} diff --git a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTExceptionTest.java b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTExceptionTest.java new file mode 100644 index 0000000000..19339a187d --- /dev/null +++ b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTExceptionTest.java @@ -0,0 +1,40 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ + +package org.onap.so.rest; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import org.junit.Test; + +public class RESTExceptionTest { + + @Test + public void test() { + RESTException rexm=mock(RESTException.class); + RESTException rex=new RESTException("Error"); + RESTException recpt=new RESTException(200, "Error"); + assert(rex.getErrorMessage().equals("Error")); + assertEquals(200,recpt.getStatusCode()); + Throwable throwable = mock(Throwable.class); + RESTException restException = new RESTException(throwable); + assertEquals(-1, restException.getStatusCode()); + } +} diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseTest.java deleted file mode 100644 index 166a2ff52f..0000000000 --- a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* -* ============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.openecomp.mso.rest; - -import static org.junit.Assert.assertEquals; - -import org.json.JSONObject; -import org.junit.Test; - -import org.apache.http.HttpResponse; -import org.apache.http.ProtocolVersion; -import org.apache.http.HttpEntity; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.message.BasicHttpResponse; - -public class APIResponseTest { - - @Test - public void test() throws Exception { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("firstName", "firstName1"); - jsonObject.put("lastName", "lastName1"); - String jsonObjectAsString= jsonObject.toString(); - HttpEntity entity = new StringEntity(jsonObjectAsString, ContentType.APPLICATION_JSON); - ProtocolVersion ver = new ProtocolVersion("HTTP", 1, 1); - HttpResponse response = new BasicHttpResponse(ver, 1, "Ok"); - response.setStatusLine(ver, 200); - response.setEntity(entity); - response.setHeader("name", "value"); - response.setStatusCode(200); - APIResponse apiResponse = new APIResponse(response); - assertEquals(200, apiResponse.getStatusCode()); - assertEquals(jsonObject.toString(), apiResponse.getResponseBodyAsString()); - assertEquals("value", apiResponse.getFirstHeader("name")); - assertEquals(1, apiResponse.getAllHeaders().length); - assertEquals(49, apiResponse.getResponseBodyAsByteArray().length); - } -} \ No newline at end of file diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderTest.java deleted file mode 100644 index 29b7e15364..0000000000 --- a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.rest; - -import static org.junit.Assert.assertEquals; -import org.junit.Test; - -public class HttpHeaderTest { - - @Test - public void test() { - HttpHeader hth= new HttpHeader("name", "value"); - assertEquals("name", hth.getName()); - assertEquals("value", hth.getValue()); - } -} diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientTest.java deleted file mode 100644 index d3fd4f9ea5..0000000000 --- a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.rest; - -import static org.mockito.Mockito.mock; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import org.apache.http.HttpResponse; -import org.apache.http.message.AbstractHttpMessage; -import org.junit.Test; - -public class RESTClientTest { - - @Test - public void test()throws Exception{ - APIResponse apr=mock(APIResponse.class); - HttpResponse response=mock(HttpResponse.class); - AbstractHttpMessage httpMsg=mock(AbstractHttpMessage.class); - RESTClient cle=mock(RESTClient.class); - RESTClient rcl=new RESTClient("URL"); - RESTClient rcle=new RESTClient("URL", "10.5.3.126", 5020); - LinkedHashMap> headers=new LinkedHashMap<>() ; - Listlist=new ArrayList<>(); - list.add("value"); - headers.put("name", list); - rcle.setHeader("name", "value"); - rcle.setParameter("name", "value"); - assert(rcle.getHeaders()!=null); - assert(rcle.getParameters()!=null); - } -} diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigTest.java deleted file mode 100644 index a64f112234..0000000000 --- a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.rest; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import org.junit.Test; - -public class RESTConfigTest { - - @Test - public void test() { - RESTConfig rcfg=mock(RESTConfig.class); - RESTConfig rcf=new RESTConfig("URL"); - RESTConfig rcfi=new RESTConfig("URL", true); - RESTConfig rcfo=new RESTConfig("URL", "10.2.3.101", 5020); - RESTConfig rcfn=new RESTConfig("URL", "10.2.3.101", 5020, true); - assert(rcfo.getProxyHost().equals("10.2.3.101")); - assertEquals(5020,rcfn.getProxyPort()); - assert(rcf.getURL().equals("URL")); - assertTrue(rcfn.trustAllCerts()); - } -} diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionTest.java deleted file mode 100644 index de2cd0f608..0000000000 --- a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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.rest; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import org.junit.Test; - -public class RESTExceptionTest { - - @Test - public void test() { - RESTException rexm=mock(RESTException.class); - RESTException rex=new RESTException("Error"); - RESTException recpt=new RESTException(200, "Error"); - assert(rex.getErrorMessage().equals("Error")); - assertEquals(200,recpt.getStatusCode()); - } -} diff --git a/bpmn/MSOURN-plugin/build.properties b/bpmn/MSOURN-plugin/build.properties deleted file mode 100644 index 7e5fb9f22f..0000000000 --- a/bpmn/MSOURN-plugin/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Copy this file to 'build.properties' and modify it to match your system -# Alternatively, you can also copy it to '${user.home}/.camunda/build.properties' -# to have a central configuration that works with all camunda BPM projects - -# Defines the deployment folder in a camunda BPM installation (backslashes need to be escaped or replaced by forward slashes). -#deploy.jboss.dir=C:/camunda/camunda-bpm-jboss-7.3.0/server/jboss-as-${jboss-version}/standalone/deployments -deploy.jboss.dir=C:/D2/jboss-ee/server/jboss-as-7.2.0.Final/standalone/deployments \ No newline at end of file diff --git a/bpmn/MSOURN-plugin/build.xml b/bpmn/MSOURN-plugin/build.xml deleted file mode 100644 index f2dbc55e52..0000000000 --- a/bpmn/MSOURN-plugin/build.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/MSOURN-plugin/pom.xml b/bpmn/MSOURN-plugin/pom.xml deleted file mode 100644 index b2db869f13..0000000000 --- a/bpmn/MSOURN-plugin/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - 4.0.0 - - - org.onap.so - bpmn - 1.2.0-SNAPSHOT - - - org.onap.so - cockpit-urnmap-plugin - - jar - - MSO URN Mapping Cockpit Plugin - - - - org.camunda.bpm.webapp - camunda-webapp - classes - ${camunda.version} - - - commons-fileupload - commons-fileupload - - - - - commons-fileupload - commons-fileupload - 1.3.3 - - - javax.ws.rs - javax.ws.rs-api - 2.0 - - - - org.camunda.bpm - camunda-engine - ${camunda.version} - - - com.h2database - h2 - test - - - javax.servlet - javax.servlet-api - 3.0.1 - provided - - - org.onap.so - common - ${project.version} - compile - - - diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPlugin.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPlugin.java deleted file mode 100644 index a7a6354bc8..0000000000 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPlugin.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.camunda.bpmn.plugin.urnmap; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.camunda.bpm.cockpit.plugin.spi.impl.AbstractCockpitPlugin; -import org.openecomp.camunda.bpmn.plugin.urnmap.resources.URNMapPluginRootResource; - - - -public class URNMapPlugin extends AbstractCockpitPlugin{ - public static final String ID = "urnMap-plugin"; - - public String getId() { - return ID; - } - - @Override - public Set> getResourceClasses() { - Set> classes = new HashSet>(); - - classes.add(URNMapPluginRootResource.class); - - return classes; - } - - @Override - public List getMappingFiles() { - return Arrays.asList("org/openecomp/camunda/bpm/plugin/urnmap/queries/urnMap.xml"); - } -} diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java deleted file mode 100644 index 9e43ee3512..0000000000 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java +++ /dev/null @@ -1,89 +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.camunda.bpmn.plugin.urnmap.db; - -import org.camunda.bpm.engine.ProcessEngineConfiguration; -import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; -import org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration; -import org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor; -import org.camunda.bpm.engine.impl.interceptor.CommandInterceptor; -import org.camunda.bpm.engine.impl.interceptor.LogInterceptor; -import org.camunda.bpm.engine.impl.util.ReflectUtil; - -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class MyBatisExtendedSessionFactory extends StandaloneProcessEngineConfiguration { - - private String resourceName; - - protected void init() { - throw new IllegalArgumentException( - "Normal 'init' on process engine only used for extended MyBatis mappings is not allowed, please use 'initFromProcessEngineConfiguration'. You cannot construct a process engine with this configuration."); - } - - /** - * initialize the {@link ProcessEngineConfiguration} from an existing one, - * just using the database settings and initialize the database / MyBatis - * stuff. - */ - public void initFromProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration, String resourceName) { - this.resourceName = resourceName; - - setDatabaseType(processEngineConfiguration.getDatabaseType()); - setDataSource(processEngineConfiguration.getDataSource()); - setDatabaseTablePrefix(processEngineConfiguration.getDatabaseTablePrefix()); - - initDataSource(); - //initVariableTypes(); - initCommandContextFactory(); - initTransactionFactory(); - initTransactionContextFactory(); - initCommandExecutors(); - initSqlSessionFactory(); - initIncidentHandlers(); - initIdentityProviderSessionFactory(); - initSessionFactories(); - } - - /** - * In order to always open a new command context set the property - * "alwaysOpenNew" to true inside the CommandContextInterceptor. - * - * If you execute the custom queries inside the process engine - * (for example in a service task), you have to do this. - */ - @Override - protected Collection getDefaultCommandInterceptorsTxRequired() { - List defaultCommandInterceptorsTxRequired = new ArrayList(); - defaultCommandInterceptorsTxRequired.add(new LogInterceptor()); - defaultCommandInterceptorsTxRequired.add(new CommandContextInterceptor(commandContextFactory, this, true)); - return defaultCommandInterceptorsTxRequired; - } - - @Override - protected InputStream getMyBatisXmlConfigurationSteam() { - return ReflectUtil.getResourceAsStream(resourceName); - } - -} diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisQueryCommandExecutor.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisQueryCommandExecutor.java deleted file mode 100644 index f81d8c604d..0000000000 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisQueryCommandExecutor.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.camunda.bpmn.plugin.urnmap.db; - -import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; -import org.camunda.bpm.engine.impl.interceptor.Command; - -/** - * Helper to initialize a minimized process engine which does all the transaction and MyBatis mapping stuff for us - * and can be used to execute queries. - */ -public class MyBatisQueryCommandExecutor { - - private MyBatisExtendedSessionFactory myBatisExtendedSessionFactory; - - public MyBatisQueryCommandExecutor(ProcessEngineConfigurationImpl processEngineConfiguration, String mappingResourceName) { - myBatisExtendedSessionFactory = new MyBatisExtendedSessionFactory(); - myBatisExtendedSessionFactory.initFromProcessEngineConfiguration(processEngineConfiguration, mappingResourceName); - } - - public T executeQueryCommand(Command command) { - return myBatisExtendedSessionFactory.getCommandExecutorTxRequired().execute(command); - } - - -} diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNData.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNData.java deleted file mode 100644 index b2dcefb304..0000000000 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNData.java +++ /dev/null @@ -1,47 +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.camunda.bpmn.plugin.urnmap.db; - -public class URNData { - - private String URNName; - private String URNValue; - private String Ver_; - public String getURNName() { - return URNName; - } - public void setURNName(String uRNName) { - URNName = uRNName; - } - public String getURNValue() { - return URNValue; - } - public void setURNValue(String uRNValue) { - URNValue = uRNValue; - } - public String getVer_() { - return Ver_; - } - public void setVer_(String ver_) { - Ver_ = ver_; - } - -} diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNService.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNService.java deleted file mode 100644 index 31b2e62b53..0000000000 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNService.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.camunda.bpmn.plugin.urnmap.db; - -import java.util.List; - -import org.camunda.bpm.engine.ProcessEngines; -import org.camunda.bpm.engine.impl.ProcessEngineImpl; -import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; -import org.camunda.bpm.engine.impl.interceptor.Command; -import org.camunda.bpm.engine.impl.interceptor.CommandContext; - -public class URNService { - - - public List getProperties() { - ProcessEngineImpl processEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine(); - ProcessEngineConfigurationImpl processEngineConfiguration = processEngine.getProcessEngineConfiguration(); - - MyBatisQueryCommandExecutor commandExecutor = new MyBatisQueryCommandExecutor(processEngineConfiguration, "mappings.xml"); - return commandExecutor.executeQueryCommand(new Command>() { - - @SuppressWarnings("unchecked") - public List execute(CommandContext commandContext) { - return (List) commandContext.getDbSqlSession().selectList("retrieveUrnKeyValuePair", null); - } - }); - } - -} diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResource.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResource.java deleted file mode 100644 index 8cd187bb2c..0000000000 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResource.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.camunda.bpmn.plugin.urnmap.resources; - -import java.util.List; -import java.util.StringTokenizer; - -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; - -import org.camunda.bpm.cockpit.db.QueryParameters; -import org.camunda.bpm.cockpit.plugin.resource.AbstractPluginResource; -import org.openecomp.camunda.bpmn.plugin.urnmap.db.*; - -public class ProcessInstanceResource extends AbstractPluginResource { - - public ProcessInstanceResource(String engineName) { - super(engineName); - } - - @GET - public List getUrnDataMap() { - List list = getQueryService() - .executeQuery( - "cockpit.urnMap.retrieveUrnKeyValuePair", - new QueryParameters()); - - System.out.println("urnmap-plugin project - Results Retrieved: "); - System.out.println("URNName: " + " " + "URNValue: " ); - for(URNData d: list) - { - System.out.println( d.getURNName() + " " + d.getURNValue()); - } - - return list; - } - - @PUT - //public void insertNewRow(String key_, String value_) - public void insertNewRow(String temp) - { - System.out.println("AddNewRow: XXXXXXXXXXXXXXXXX ---> " + temp); - StringTokenizer st = new StringTokenizer(temp, "|"); - String key_ = ""; - String value_ = ""; - - while(st.hasMoreTokens()) { - key_ = st.nextToken(); - value_ = st.nextToken(); - System.out.println(key_ + "\t" + value_); - } - - System.out.println("AddNewRow: XXXXXXXXXXXXXXXXX ---> key: " + key_ + " , Value: " + value_); - URNData nRow = new URNData(); - nRow.setVer_("1"); - nRow.setURNName(key_); - nRow.setURNValue(value_); - - getQueryService().executeQuery("cockpit.urnMap.insertNewRow", nRow, URNData.class); - - System.out.println("AddNewRow: XXXXXX END XXXXXXXXXXX"); - } - - @POST - // public void getPersistData(List myList) { - public void getPersistData(URNData d) { - - System.out.println("getPersistData: UrnName: " + d.getURNName() + " , URNValue: " + d.getURNValue() ); - - getQueryService().executeQuery("cockpit.urnMap.persistURNData", d, URNData.class); - //getQueryService().executeQuery("cockpit.sample.persistURNData", d, ProcessInstanceCountDto.class); - - - System.out.println("XXXXXXXXXX - END - XXXXXXXXXXXXXXX"); - } -} diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResource.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResource.java deleted file mode 100644 index 539df0e319..0000000000 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResource.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.camunda.bpmn.plugin.urnmap.resources; - -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; - -import org.camunda.bpm.cockpit.plugin.resource.AbstractPluginRootResource; -import org.openecomp.camunda.bpmn.plugin.urnmap.URNMapPlugin; - -@SuppressWarnings("deprecation") -@Path("plugin/" + URNMapPlugin.ID) -public class URNMapPluginRootResource extends AbstractPluginRootResource -{ - public URNMapPluginRootResource() { - super(URNMapPlugin.ID); - //super(""); - } - - @Path("{engineName}/process-instance") - public URNResource getProcessInstanceResource(@PathParam("engineName") String engineName) { - return subResource(new URNResource(engineName), engineName); - } -} diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java deleted file mode 100644 index 5fc80ab5c4..0000000000 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java +++ /dev/null @@ -1,206 +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.camunda.bpmn.plugin.urnmap.resources; -/*** -import java.beans.Statement; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -*/ -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.sql.DataSource; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; - -import org.camunda.bpm.cockpit.db.QueryParameters; -import org.camunda.bpm.cockpit.plugin.resource.AbstractCockpitPluginResource; - - -//import org.camunda.bpm.cockpit.plugin.resource.AbstractPluginResource; -import org.openecomp.camunda.bpmn.plugin.urnmap.db.URNData; -import org.openecomp.mso.logger.MsoLogger; - - -//public class ProcessInstanceResource extends AbstractPluginResource { -public class URNResource extends AbstractCockpitPluginResource{ - public URNResource(String engineName) { - super(engineName); - } - - private Connection conn; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - @GET - public List getUrnDataMap() - { - List list = new ArrayList(); - PreparedStatement psData = null; - ResultSet r = null; - try { - - conn = getDBConnection(); - psData = conn - .prepareStatement("select * from MSO_URN_MAPPING order by NAME_"); - - r = psData.executeQuery(); - - while(r.next()) - { - URNData d = new URNData(); - d.setURNName(r.getString("NAME_")); - d.setURNValue(r.getString("VALUE_")); - d.setVer_( r.getString("REV_")); - - list.add(d); - } - - } catch (Exception e) - { - msoLogger.error("Exception while executing query", e); - } finally { - try { r.close(); } catch (Exception e) { /* ignored */ } - try { psData.close(); } catch (Exception e) { /* ignored */ } - try { conn.close(); } catch (Exception e) { /* ignored */ } - } - - for(URNData d: list) - { - msoLogger.debug( d.getURNName() + " " + d.getURNValue()); - //msoLogger.debug("Started Executing " + getTaskName()); - msoLogger.debug("Started Executing " + d.getURNName() + " " + d.getURNValue()); - } - - return list; - } - - public List getUrnDataMapOLD() - { - - List list = getQueryService() - .executeQuery("cockpit.urnMap.retrieveUrnKeyValuePair", new QueryParameters()); - - msoLogger.debug("urnmap-plugin project - Results Retrieved: "); - msoLogger.debug("URNName: " + " " + "URNValue: " ); - - for(URNData d: list) - { - //msoLogger.debug( d.getURNName() + " " + d.getURNValue()); - msoLogger.debug( d.getURNName() + " " + d.getURNValue()); - } - - return list; - } - - public Connection getDBConnection() - { - try { - - if(conn == null) - { - Context ctx = new InitialContext(); - DataSource ds = (DataSource)ctx.lookup("java:jboss/datasources/ProcessEngine");//jboss - conn = ds.getConnection(); - - } - - } catch (Exception e) - { - msoLogger.error("Exception while performing JNDI lookup", e); - } - - return conn; - } - - @PUT - public void insertNewRow(String temp) - { - msoLogger.debug("AddNewRow: XXXXXXXXXXXXXXXXX ---> " + temp); - msoLogger.debug("AddNewRow: EngineName ---> " + engineName); - - StringTokenizer st = new StringTokenizer(temp, "|"); - String key_ = ""; - String value_ = ""; - - while(st.hasMoreTokens()) { - key_ = st.nextToken(); - value_ = st.nextToken(); - msoLogger.debug(key_ + "\t" + value_); - } - - msoLogger.debug("AddNewRow: XXXXXXXXXXXXXXXXX ---> key: " + key_ + " , Value: " + value_); - final URNData nRow = new URNData(); - nRow.setVer_("1"); - final String myKey = key_; - final String myValue = value_; - - PreparedStatement psData = null; - msoLogger.debug("----------- START ----------------------"); - try { - - conn = getDBConnection(); - psData = conn - .prepareStatement("Insert into MSO_URN_MAPPING values ('" + key_ + "', '" + value_ + "', '1')"); - - psData.executeUpdate(); - - //} - - } catch (Exception e) - { - msoLogger.error("Exception while executing query", e); - } finally { - try { psData.close(); } catch (Exception e) { /* ignored */ } - try { conn.close(); } catch (Exception e) { /* ignored */ } - } - // getQueryService().executeQuery("cockpit.urnMap.insertNewRow", nRow, URNData.class); - } - - @POST - public void getPersistData(URNData d) { - - //getQueryService().executeQuery("cockpit.urnMap.persistURNData", d, URNData.class); - PreparedStatement psData = null; - try { - - conn = getDBConnection(); - psData = conn - .prepareStatement("UPDATE MSO_URN_MAPPING set VALUE_ ='"+ d.getURNValue() + "' WHERE NAME_='" + d.getURNName() + "'"); - - psData.executeUpdate(); - - } catch (Exception e) - { - msoLogger.error("Exception while executing query", e); - } finally { - try { psData.close(); } catch (Exception e) { /* ignored */ } - try { conn.close(); } catch (Exception e) { /* ignored */ } - } - - } -} diff --git a/bpmn/MSOURN-plugin/src/main/resources/META-INF/services/org.camunda.bpm.cockpit.plugin.spi.CockpitPlugin b/bpmn/MSOURN-plugin/src/main/resources/META-INF/services/org.camunda.bpm.cockpit.plugin.spi.CockpitPlugin deleted file mode 100644 index 9a5055af22..0000000000 --- a/bpmn/MSOURN-plugin/src/main/resources/META-INF/services/org.camunda.bpm.cockpit.plugin.spi.CockpitPlugin +++ /dev/null @@ -1 +0,0 @@ -org.openecomp.camunda.bpm.plugin.urnmap.URNMapPlugin \ No newline at end of file diff --git a/bpmn/MSOURN-plugin/src/main/resources/mappings.xml b/bpmn/MSOURN-plugin/src/main/resources/mappings.xml deleted file mode 100644 index c66704ed15..0000000000 --- a/bpmn/MSOURN-plugin/src/main/resources/mappings.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - diff --git a/bpmn/MSOURN-plugin/src/main/resources/org/openecomp/camunda/bpm/plugin/urnmap/queries/urnMap.xml b/bpmn/MSOURN-plugin/src/main/resources/org/openecomp/camunda/bpm/plugin/urnmap/queries/urnMap.xml deleted file mode 100644 index d0b58618e4..0000000000 --- a/bpmn/MSOURN-plugin/src/main/resources/org/openecomp/camunda/bpm/plugin/urnmap/queries/urnMap.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - insert into MSO_URN_MAPPING (NAME_, VALUE_, REV_) - values ( - #{URNName}, #{URNValue}, 1 - ) - - - - - - - - - - - update MSO_URN_MAPPING set - NAME_ = #{URNName}, - VALUE_ = #{URNValue}, - REV_ = 1 - where NAME_=#{URNName} - - diff --git a/bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/app/dashboard.html b/bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/app/dashboard.html deleted file mode 100644 index cc794e5518..0000000000 --- a/bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/app/dashboard.html +++ /dev/null @@ -1,63 +0,0 @@ - - -

-
-
-

Process Engine - URN Mapping

-
-
-
- - - - - - - -
-
- - - - - - - -
-
- - - - - - -
-
-
-
-
-
-
-
diff --git a/bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/app/plugin.js b/bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/app/plugin.js deleted file mode 100644 index 702f6cd3f5..0000000000 --- a/bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/app/plugin.js +++ /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========================================================= - */ - -define(['angular'], function(angular) { - - var DashboardController = ["$scope", "$http", "Uri", function($scope, $http, Uri) { - - $http.get(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance")) - .success(function(data) { - $scope.UrnDataMap = data; - }); - - //enable saveRow button - $scope.enableButton=function(urnData) - { - document.getElementById("btn_" + urnData.urnname + "_key").disabled = false; - }; - - $scope.enableAddRowBtn=function() - { - if(document.getElementById("new_key").value.trim().length >0) - document.getElementById("addRow_BTN").disabled = false; - else - document.getElementById("addRow_BTN").disabled = true; - }; - - - $scope.addNewRow = function() - { - var newKey = document.getElementById("new_key").value.trim(); - var newValue = document.getElementById("new_value").value.trim(); - var x; - - for (var i=0;i<$scope.UrnDataMap.length;i++) - { - var n = $scope.UrnDataMap[i].urnname.localeCompare(newKey); - if(n == 0){ - x = "match"; - } - } - - if(Boolean(x)) - { - alert("URN Name already exists, please check the KEY!"); - } - else - { - if(newKey.length >0 ) - { - - var temp = newKey + "|" + newValue; - - $http.put(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance"), temp); - - document.getElementById("new_key").value = ""; - document.getElementById("new_value").value = ""; - - } - - } - //this.enableAddRowBtn; - document.getElementById("addRow_BTN").disabled = true; - - $http.get(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance")) - .success(function(data) { - $scope.UrnDataMap = data; - }); - - - } - - $scope.retrieveData = function() { - - $http.get(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance")) - .success(function(data) { - $scope.UrnDataMap = data; - }); - } - - $scope.SaveRow = function(user) - { - $http.post(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance"), user); - - document.getElementById("btn_" + user.urnname + "_key").disabled = true; - document.getElementById(user.urnname + "_status").style.display = ""; - this.enableAddRowBtn; - - $http.get(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance")) - .success(function(data) { - $scope.UrnDataMap = data; - }); - - }; - }]; - - var Configuration = ['ViewsProvider', function(ViewsProvider) { - - ViewsProvider.registerDefaultView('cockpit.dashboard', { - id: 'process-definitions', - label: 'Deployed Processes', - url: 'plugin://urnMap-plugin/static/app/dashboard.html', - controller: DashboardController, - // make sure we have a higher priority than the default plugin - priority: 12 - }); - }]; -//START -//END - - var ngModule = angular.module('cockpit.plugin.urnMap-plugin', []); - - ngModule.config(Configuration); - - return ngModule; -}); diff --git a/bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/info.txt b/bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/info.txt deleted file mode 100644 index 09b62620e6..0000000000 --- a/bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/info.txt +++ /dev/null @@ -1 +0,0 @@ -# Client side assets of the urnMap-plugin \ No newline at end of file diff --git a/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterface.json b/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterface.json new file mode 100644 index 0000000000..b8c123eb15 --- /dev/null +++ b/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterface.json @@ -0,0 +1,19 @@ +{ + "interface-name": "Xe-7/1/10", + "port-description": "VVIG EGRESS", + "resource-version": "1494002035673", + "relationship-list": { + "relationship": [ + { + "related-to": "physical-link", + "related-link": "/aai/v11/network/physical-links/physical-link/testPhysicalLinkUcpe", + "relationship-data": [ + { + "relationship-key": "physical-link.link-name", + "relationship-value": "L4YS.999964..ATI_EGRESS" + } + ] + } + ] + } +} diff --git a/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterfaces.json b/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterfaces.json new file mode 100644 index 0000000000..9ea3869121 --- /dev/null +++ b/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterfaces.json @@ -0,0 +1,42 @@ +{ + "p-interface": [ + { + "interface-name": "Xe-7/1/10", + "port-description": "VVIG EGRESS", + "resource-version": "1494002035673", + "relationship-list": { + "relationship": [ + { + "related-to": "physical-link", + "related-link": "/aai/v11/network/physical-links/physical-link/testPhysicalLinkUcpe", + "relationship-data": [ + { + "relationship-key": "physical-link.link-name", + "relationship-value": "L4YS.999964..ATI_EGRESS" + } + ] + } + ] + } + }, + { + "interface-name": "Xe-8/2/11", + "port-description": "VVIG EGRESS", + "resource-version": "1494002035673", + "relationship-list": { + "relationship": [ + { + "related-to": "physical-link", + "related-link": "/aai/v11/network/physical-links/physical-link/testPhysicalLinkUcpe2", + "relationship-data": [ + { + "relationship-key": "physical-link.link-name", + "relationship-value": "L4YS.999964..ATI_EGRESS" + } + ] + } + ] + } + } + ] +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml new file mode 100644 index 0000000000..fbfe831fd2 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/pom.xml @@ -0,0 +1,207 @@ + + + org.onap.so + bpmn + 1.3.0-SNAPSHOT + + 4.0.0 + mso-infrastructure-bpmn + jar + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + + unpack + + + + + org.onap.so + MSOCommonBPMN + ${project.version} + jar + false + ${project.build.outputDirectory} + **/*.bpmn + + + org.onap.so + so-bpmn-building-blocks + ${project.version} + jar + false + ${project.build.outputDirectory} + **/*.bpmn + + + org.onap.so + so-bpmn-infrastructure-flows + ${project.version} + jar + false + ${project.build.outputDirectory} + **/*.bpmn + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + test-compile + compile + + testCompile + + + false + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + tests + + + original + + + + + org.springframework.boot + spring-boot-maven-plugin + ${springboot.version} + + org.onap.so.adapters.requestsdb.application.MSOInfrastructureApplication + + + + + repackage + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + extract-docker-file + + + + + io.fabric8 + fabric8-maven-plugin + + + start + + + + + + + + + + org.springframework.boot + spring-boot-dependencies + ${springboot.version} + pom + import + + + + + + org.camunda.bpm.springboot + camunda-bpm-spring-boot-starter + 2.3.0 + + + org.camunda.bpm.extension + camunda-bpm-assert + 2.0-alpha2 + test + + + org.camunda.bpm.springboot + camunda-bpm-spring-boot-starter-rest + 2.3.0 + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-data-jpa + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.onap.so + so-bpmn-infrastructure-common + ${project.version} + + + org.onap.so + MSOCommonBPMN + ${project.version} + + + org.onap.so + MSOCommonBPMN + ${project.version} + test-jar + test + + + com.h2database + h2 + test + + + org.springframework.cloud + spring-cloud-contract-wiremock + 1.2.4.RELEASE + test + + + ch.vorburger.mariaDB4j + mariaDB4j + 2.2.3 + test + + + io.micrometer + micrometer-spring-legacy + 1.0.5 + + + io.micrometer + micrometer-registry-prometheus + 1.0.5 + + + diff --git a/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy new file mode 100644 index 0000000000..9262954917 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - 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.openecomp.mso.bpmn.infrastructure.scripts + +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils + +/** + * This groovy class supports the ActivateSDNCCNetworkResource.bpmn process. + * flow for SDNC Network Resource Activate + */ +public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { + + String Prefix = "ACTSDNCRES_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + public void preProcessRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started preProcessRequest *****", isDebugEnabled) + } + + public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** started prepareUpdateAfterActivateSDNCResource *****", isDebugEnabled) + } + + public void postCreateSDNCCall(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** started postCreateSDNCCall *****", isDebugEnabled) + } + + public void sendSyncResponse(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** started sendSyncResponse *****", isDebugEnabled) + } +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy b/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy new file mode 100644 index 0000000000..bb58030683 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy @@ -0,0 +1,425 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - 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.bpmn.infrastructure.scripts + +import org.json.JSONObject +import org.json.XML; + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.recipe.ResourceInput; +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder +import org.onap.so.rest.APIResponse +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory +import java.util.UUID; + +import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig + +/** + * This groovy class supports the CreateActivateSDNCResource.bpmn process. + * flow for SDNC Network Resource Create + */ +public class CreateActivateSDNCResource extends AbstractServiceTaskProcessor { + + String Prefix="CRESDNCRES_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + public void preProcessRequest(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started preProcessRequest *****", isDebugEnabled) + try { + + //get bpmn inputs from resource request. + String requestId = execution.getVariable("mso-request-id") + String requestAction = execution.getVariable("requestAction") + utils.log("INFO","The requestAction is: " + requestAction, isDebugEnabled) + String recipeParamsFromRequest = execution.getVariable("recipeParams") + utils.log("INFO","The recipeParams is: " + recipeParamsFromRequest, isDebugEnabled) + String resourceInput = execution.getVariable("resourceInput") + utils.log("INFO","The resourceInput is: " + resourceInput, isDebugEnabled) + //Get ResourceInput Object + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) + execution.setVariable(Prefix + "resourceInput", resourceInputObj) + + //Deal with recipeParams + String recipeParamsFromWf = execution.getVariable("recipeParamXsd") + String resourceName = resourceInputObj.getResourceInstanceName() + //For sdnc requestAction default is "createNetworkInstance" + String operationType = "Network" + String apiType = "network" + if(!StringUtils.isBlank(recipeParamsFromRequest)){ + //the operationType from worflow(first node) is second priority. + operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") + apiType = jsonUtil.getJsonValue(recipeParamsFromRequest, "apiType") + } + if(!StringUtils.isBlank(recipeParamsFromWf)){ + //the operationType from worflow(first node) is highest priority. + operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") + apiType = jsonUtil.getJsonValue(recipeParamsFromRequest, "apiType") + } + + execution.setVariable(Prefix + "operationType", operationType) + execution.setVariable(Prefix + "apiType", apiType) + execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) + execution.setVariable("mso-request-id", requestId) + execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) + //TODO Here build networkrequest + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + String msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + String customizeResourceParam(String netowrkInputParametersJson) { + List> paramList = new ArrayList(); + JSONObject jsonObject = new JSONObject(netowrkInputParametersJson); + Iterator iterator = jsonObject.keys(); + while (iterator.hasNext()) { + String key = iterator.next(); + HashMap hashMap = new HashMap(); + hashMap.put("name", key); + hashMap.put("value", jsonObject.get(key)) + paramList.add(hashMap) + } + Map>> paramMap = new HashMap(); + paramMap.put("param", paramList); + + return new JSONObject(paramMap).toString(); + } + + public void prepareSDNCRequest (DelegateExecution execution) { + String svcAction = "create" + prepareSDNCRequestReq(execution, svcAction, "") + } + + + public void prepareSDNCActivateRequest (DelegateExecution execution) { + String svcAction = "activate" + String sndcResourceId = execution.getVariable(Prefix + "sdncResourceId") + prepareSDNCRequestReq(execution, svcAction, sndcResourceId) + } + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + public void prepareSDNCRequestReq (DelegateExecution execution, String svcAction, String sdncResourceId) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled) + + try { + // get variables + String operationType = execution.getVariable(Prefix + "operationType") + String sdnc_apiType = execution.getVariable(Prefix + "apiType") + String sdnc_svcAction = svcAction + String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" + + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + + String hdrRequestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + String source = execution.getVariable("source") + String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String serviceType = resourceInputObj.getServiceType() + String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() + String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() + String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion() + String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName() + String globalCustomerId = resourceInputObj.getGlobalSubscriberId() + String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid(); + String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() + String resourceInputPrameters = resourceInputObj.getResourceParameters() + String netowrkInputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") + //here convert json string to xml string + String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(netowrkInputParametersJson))) + + // 1. prepare assign topology via SDNC Adapter SUBFLOW call + String sndcTopologyCreateRequest = + """ + + ${hdrRequestId} + ${serviceInstanceId} + ${sdnc_svcAction} + ${sdnc_apiType}-topology-operation + sdncCallback + generic-resource + + + + ${hdrRequestId} + ${sdnc_requestAction} + ${source} + + + + + + ${serviceInstanceId} + ${serviceType} + + ${serviceModelInvariantUuid} + ${serviceModelUuid} + ${serviceModelVersion} + ${serviceModelName} + + ${serviceInstanceId} + ${globalCustomerId} + + <${sdnc_apiType}-information> + <${sdnc_apiType}-id>${sdncResourceId} + + ${modelInvariantUuid} + ${modelCustomizationUuid} + ${modelUuid} + ${modelVersion} + ${modelName} + + + <${sdnc_apiType}-request-input> + <${sdnc_apiType}-input-parameters>${netowrkInputParameters} + + + """.trim() + + String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) + utils.logAudit(sndcTopologyCreateRequesAsString) + execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString) + utils.log("INFO","sdncAdapterWorkflowRequest :" + sndcTopologyCreateRequesAsString, isDebugEnabled) + utils.log("DEBUG","sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString, isDebugEnabled) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) + } + + private void setProgressUpdateVariables(DelegateExecution execution, String body) { + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } + + public void prepareUpdateBeforeCreateSDNCResource(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareUpdateBeforeCreateSDNCResource *****", isDebugEnabled) + + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String operType = resourceInputObj.getOperationType() + String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String ServiceInstanceId = resourceInputObj.getServiceInstanceId() + String operationId = resourceInputObj.getOperationId() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String progress = "20" + String status = "processing" + String statusDescription = "Create " + modelName + + execution.getVariable("operationId") + + String body = """ + + + + + ${operType} + ${operationId} + ${progress} + ${resourceCustomizationUuid} + ${ServiceInstanceId} + ${status} + ${statusDescription} + + + """; + + setProgressUpdateVariables(execution, body) + utils.log("INFO"," ***** End prepareUpdateBeforeCreateSDNCResource *****", isDebugEnabled) + } + + public void postCreateSDNC(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + ServicePluginFactory.getInstance().test() + utils.log("INFO"," ***** Started postCreateSDNC *****", isDebugEnabled) + String sdnc_apiType = execution.getVariable(Prefix + "apiType") + String sdncAdapterResponse = execution.getVariable("sdncAdapterResponse") + utils.log("INFO","sdncAdapterResponse for create:" + sdncAdapterResponse , isDebugEnabled) + sdncAdapterResponse = sdncAdapterResponse.replace("\n", "") + sdncAdapterResponse = sdncAdapterResponse.replaceAll('tag0:', '').replaceAll(':tag0', '') + utils.log("INFO","sdncAdapterResponse for create after replace:" + sdncAdapterResponse , isDebugEnabled) + //if it is vnf we need to query the vnf-id,if it is network , we need to query the network-id + String sdncRespData = utils.getNodeText1(sdncAdapterResponse, "RequestData") + utils.log("INFO","sdncRespData:" + sdncRespData , isDebugEnabled) + String objectKey = "/" + sdnc_apiType + "/" + String objectDataKey = "/" + sdnc_apiType + "-data/" + String objectPath = utils.getNodeText1(sdncRespData, "object-path") + + String resourceObjId = objectPath.substring(objectPath.indexOf(objectKey) + objectKey.length(), objectPath.indexOf(objectDataKey)) + utils.log("INFO", "resourceObjId:" + resourceObjId, isDebugEnabled) + execution.setVariable(Prefix + "sdncResourceId", resourceObjId) + + utils.log("INFO"," ***** End postCreateSDNC *****", isDebugEnabled) + + } + + public void postActivateSDNC(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started postActivateSDNC *****", isDebugEnabled) + String sdncAdapterResponse = execution.getVariable("sdncAdapterResponse") + utils.log("INFO","sdncAdapterResponse for activate:" + sdncAdapterResponse , isDebugEnabled) + utils.log("INFO"," ***** End postActivateSDNC *****", isDebugEnabled) + } + + public void prepareUpdateAfterCreateSDNCResource(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareUpdateAfterCreateSDNCResource *****", isDebugEnabled) + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String operType = resourceInputObj.getOperationType() + String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String ServiceInstanceId = resourceInputObj.getServiceInstanceId() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String operationId = resourceInputObj.getOperationId() + String progress = "50" + String status = "processing" + String statusDescription = "Instantiate " + modelName + + execution.getVariable("operationId") + + String body = """ + + + + + ${operType} + ${operationId} + ${progress} + ${resourceCustomizationUuid} + ${ServiceInstanceId} + ${status} + ${statusDescription} + + + """; + + setProgressUpdateVariables(execution, body) + utils.log("INFO"," ***** End prepareUpdateAfterCreateSDNCResource *****", isDebugEnabled) + } + + public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareUpdateAfterActivateSDNCResource *****", isDebugEnabled) + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String operType = resourceInputObj.getOperationType() + String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String ServiceInstanceId = resourceInputObj.getServiceInstanceId() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String operationId = resourceInputObj.getOperationId() + String progress = "100" + String status = "finished" + String statusDescription = "Instantiate " + modelName + " finished" + + execution.getVariable("operationId") + + String body = """ + + + + + ${operType} + ${operationId} + ${progress} + ${resourceCustomizationUuid} + ${ServiceInstanceId} + ${status} + ${statusDescription} + + + """; + + setProgressUpdateVariables(execution, body) + utils.log("INFO"," ***** End prepareUpdateAfterActivateSDNCResource *****", isDebugEnabled) + } + + public void postCreateSDNCCall(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled) + String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode") + String responseObj = execution.getVariable(Prefix + "SuccessIndicator") + + utils.log("INFO","response from sdnc, response code :" + responseCode + " response object :" + responseObj, isDebugEnabled) + utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + String operationStatus = "finished" + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.java new file mode 100644 index 0000000000..bf4c59ca09 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.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.bpmn.common.adapter.sdnc; + +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="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="ResponseCode" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="ResponseMessage" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "requestId", + "responseCode", + "responseMessage" +}, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1") +@XmlRootElement(name = "CallbackHeader") +public class CallbackHeader { + + @XmlElement(name = "RequestId", required = true, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1") + protected String requestId; + @XmlElement(name = "ResponseCode", required = true,namespace="http://org.onap/workflow/sdnc/adapter/schema/v1") + protected String responseCode; + @XmlElement(name = "ResponseMessage", required = true,namespace="http://org.onap/workflow/sdnc/adapter/schema/v1") + protected String responseMessage; + + /** + * 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 responseCode property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResponseCode() { + return responseCode; + } + + /** + * Sets the value of the responseCode property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResponseCode(String value) { + this.responseCode = value; + } + + /** + * Gets the value of the responseMessage property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResponseMessage() { + return responseMessage; + } + + /** + * Sets the value of the responseMessage property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResponseMessage(String value) { + this.responseMessage = value; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java new file mode 100644 index 0000000000..a72e23e57f --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.adapter.sdnc; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.openecomp.domain2.workflow.sdnc.adapter.schema.v1 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 { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.domain2.workflow.sdnc.adapter.schema.v1 + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link RequestHeader } + * + */ + public RequestHeader createRequestHeader() { + return new RequestHeader(); + } + + /** + * Create an instance of {@link SDNCAdapterResponse } + * + */ + public SDNCAdapterResponse createSDNCAdapterResponse() { + return new SDNCAdapterResponse(); + } + + /** + * Create an instance of {@link SDNCAdapterCallbackRequest } + * + */ + public SDNCAdapterCallbackRequest createSDNCAdapterCallbackRequest() { + return new SDNCAdapterCallbackRequest(); + } + + /** + * Create an instance of {@link CallbackHeader } + * + */ + public CallbackHeader createCallbackHeader() { + return new CallbackHeader(); + } + + /** + * Create an instance of {@link SDNCAdapterRequest } + * + */ + public SDNCAdapterRequest createSDNCAdapterRequest() { + return new SDNCAdapterRequest(); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java new file mode 100644 index 0000000000..2c56a110db --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java @@ -0,0 +1,223 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.adapter.sdnc; + +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="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="SvcInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="SvcAction" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="SvcOperation" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="CallbackUrl" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="MsoAction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "requestId", + "svcInstanceId", + "svcAction", + "svcOperation", + "callbackUrl", + "msoAction" +}) +@XmlRootElement(name = "RequestHeader") +public class RequestHeader { + + @XmlElement(name = "RequestId", required = true) + protected String requestId; + @XmlElement(name = "SvcInstanceId") + protected String svcInstanceId; + @XmlElement(name = "SvcAction", required = true) + protected String svcAction; + @XmlElement(name = "SvcOperation", required = true) + protected String svcOperation; + @XmlElement(name = "CallbackUrl", required = true) + protected String callbackUrl; + @XmlElement(name = "MsoAction") + protected String msoAction; + + /** + * 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 svcInstanceId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSvcInstanceId() { + return svcInstanceId; + } + + /** + * Sets the value of the svcInstanceId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSvcInstanceId(String value) { + this.svcInstanceId = value; + } + + /** + * Gets the value of the svcAction property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSvcAction() { + return svcAction; + } + + /** + * Sets the value of the svcAction property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSvcAction(String value) { + this.svcAction = value; + } + + /** + * Gets the value of the svcOperation property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSvcOperation() { + return svcOperation; + } + + /** + * Sets the value of the svcOperation property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSvcOperation(String value) { + this.svcOperation = value; + } + + /** + * Gets the value of the callbackUrl property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCallbackUrl() { + return callbackUrl; + } + + /** + * Sets the value of the callbackUrl property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCallbackUrl(String value) { + this.callbackUrl = value; + } + + /** + * Gets the value of the msoAction property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMsoAction() { + return msoAction; + } + + /** + * Sets the value of the msoAction property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMsoAction(String value) { + this.msoAction = value; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java new file mode 100644 index 0000000000..e77232510a --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java @@ -0,0 +1,130 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.adapter.sdnc; + +import java.io.StringWriter; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +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/workflow/sdnc/adapter/schema/v1}CallbackHeader"/>
+ *         <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", namespace="http://org.onap/workflow/sdnc/adapter/schema/v1", propOrder = { + "callbackHeader", + "requestData" +}) +@XmlRootElement(name = "SDNCAdapterCallbackRequest", namespace="http://org.onap/workflow/sdnc/adapter/schema/v1") +public class SDNCAdapterCallbackRequest { + + @XmlElement(name = "CallbackHeader", required = true, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1") + protected CallbackHeader callbackHeader; + @XmlElement(name = "RequestData", required=false, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1") + protected Object requestData; + + /** + * Gets the value of the callbackHeader property. + * + * @return + * possible object is + * {@link CallbackHeader } + * + */ + public CallbackHeader getCallbackHeader() { + return callbackHeader; + } + + /** + * Sets the value of the callbackHeader property. + * + * @param value + * allowed object is + * {@link CallbackHeader } + * + */ + public void setCallbackHeader(CallbackHeader value) { + this.callbackHeader = value; + } + + /** + * Gets the value of the requestData property. + * + * @return + * possible object is + * {@link Object } + * + */ + public Object getRequestData() { + return requestData; + } + + /** + * Sets the value of the requestData property. + * + * @param value + * allowed object is + * {@link Object } + * + */ + public void setRequestData(Object value) { + this.requestData = value; + } + + @Override + public String toString() { + StringWriter writer = new StringWriter(); + try { + JAXBContext context = JAXBContext + .newInstance(SDNCAdapterCallbackRequest.class); + Marshaller m = context.createMarshaller(); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + m.marshal(this, writer); + return writer.getBuffer().toString(); + } catch (JAXBException e) { + return ""; + } + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java new file mode 100644 index 0000000000..179776d95d --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.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.bpmn.common.adapter.sdnc; + +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/workflow/sdnc/adapter/schema/v1}RequestHeader"/>
+ *         <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "requestHeader", + "requestData" +}) +@XmlRootElement(name = "SDNCAdapterRequest") +public class SDNCAdapterRequest { + + @XmlElement(name = "RequestHeader", required = true) + protected RequestHeader requestHeader; + @XmlElement(name = "RequestData", required = true) + protected Object requestData; + + /** + * Gets the value of the requestHeader property. + * + * @return + * possible object is + * {@link RequestHeader } + * + */ + public RequestHeader getRequestHeader() { + return requestHeader; + } + + /** + * Sets the value of the requestHeader property. + * + * @param value + * allowed object is + * {@link RequestHeader } + * + */ + public void setRequestHeader(RequestHeader value) { + this.requestHeader = value; + } + + /** + * Gets the value of the requestData property. + * + * @return + * possible object is + * {@link Object } + * + */ + public Object getRequestData() { + return requestData; + } + + /** + * Sets the value of the requestData property. + * + * @param value + * allowed object is + * {@link Object } + * + */ + public void setRequestData(Object value) { + this.requestData = value; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java new file mode 100644 index 0000000000..3666cb56a6 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.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.bpmn.common.adapter.sdnc; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +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">
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "SDNCAdapterResponse") +public class SDNCAdapterResponse { + + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java new file mode 100644 index 0000000000..eff70f5b12 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.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.bpmn.common.adapter.sdnc; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.4-b01 + * Generated source version: 2.2 + * + */ +@WebService(name = "SDNCCallbackAdapterPortType", targetNamespace = "http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1") +@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) +public interface SDNCCallbackAdapterPortType { + + + /** + * + * @param sdncAdapterCallbackRequest + * @return + * returns org.openecomp.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterResponse + */ + @WebMethod(operationName = "SDNCAdapterCallback") + @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") + public SDNCAdapterResponse sdncAdapterCallback( + @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest") + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest); + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java new file mode 100644 index 0000000000..ec341d82b5 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java @@ -0,0 +1,22 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package org.onap.so.bpmn.common.adapter.sdnc; diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java new file mode 100644 index 0000000000..aa348c7765 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java @@ -0,0 +1,462 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.adapter.vnf; + +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.XmlType; + + +/** + *

Java class for createVnfNotification complex type. + * + *

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

+ * <complexType name="createVnfNotification">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="exception" type="{http://org.onap.so/vnfNotify}msoExceptionCategory" minOccurs="0"/>
+ *         <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="outputs" minOccurs="0">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="entry" maxOccurs="unbounded" minOccurs="0">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *                             <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *                           </sequence>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                 </sequence>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element name="rollback" type="{http://org.onap.so/vnfNotify}vnfRollback" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "createVnfNotification1", propOrder = { + "messageId", + "completed", + "exception", + "errorMessage", + "vnfId", + "outputs", + "rollback" +}) +public class CreateVnfNotification { + + @XmlElement(required = true) + protected String messageId; + protected boolean completed; + protected MsoExceptionCategory exception; + protected String errorMessage; + protected String vnfId; + protected Outputs outputs; + protected VnfRollback rollback; + + /** + * Gets the value of the messageId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageId() { + return messageId; + } + + /** + * Sets the value of the messageId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageId(String value) { + this.messageId = value; + } + + /** + * Gets the value of the completed property. + * + */ + public boolean isCompleted() { + return completed; + } + + /** + * Sets the value of the completed property. + * + */ + public void setCompleted(boolean value) { + this.completed = value; + } + + /** + * Gets the value of the exception property. + * + * @return + * possible object is + * {@link MsoExceptionCategory } + * + */ + public MsoExceptionCategory getException() { + return exception; + } + + /** + * Sets the value of the exception property. + * + * @param value + * allowed object is + * {@link MsoExceptionCategory } + * + */ + public void setException(MsoExceptionCategory value) { + this.exception = 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 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 outputs property. + * + * @return + * possible object is + * {@link CreateVnfNotification.Outputs } + * + */ + public CreateVnfNotification.Outputs getOutputs() { + return outputs; + } + + /** + * Sets the value of the outputs property. + * + * @param value + * allowed object is + * {@link CreateVnfNotification.Outputs } + * + */ + public void setOutputs(CreateVnfNotification.Outputs value) { + this.outputs = value; + } + + /** + * Gets the value of the rollback property. + * + * @return + * possible object is + * {@link VnfRollback } + * + */ + public VnfRollback getRollback() { + return rollback; + } + + /** + * Sets the value of the rollback property. + * + * @param value + * allowed object is + * {@link VnfRollback } + * + */ + public void setRollback(VnfRollback value) { + this.rollback = value; + } + + + /** + *

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="entry" maxOccurs="unbounded" minOccurs="0">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+     *                   <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+     *                 </sequence>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *       </sequence>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "entry" + }) + public static class Outputs { + + protected List entry; + + /** + * Gets the value of the entry 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 entry property. + * + *

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

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

+ * Objects of the following type(s) are allowed in the list + * {@link CreateVnfNotification.Outputs.Entry } + * + * + */ + public List getEntry() { + if (entry == null) { + entry = new ArrayList<>(); + } + return this.entry; + } + + // Not a generated method + @Override + public String toString() { + StringBuilder out = new StringBuilder(); + out.append("\n"); + if (entry != null) { + for (Entry e : entry) { + out.append(e.toString()); + out.append('\n'); + } + } + out.append(""); + return out.toString(); + } + + /** + *

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="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+         *         <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+         *       </sequence>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "key", + "value" + }) + public static class Entry { + + protected String key; + protected String value; + + /** + * Gets the value of the key property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getKey() { + return key; + } + + /** + * Sets the value of the key property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setKey(String value) { + this.key = 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; + + } + + // Not a generated method + @Override + public String toString() { + String entrystr; + entrystr = + ""+ '\n' + + " "+key+"" + '\n' + + " "+value+"" + '\n' + + ""; + return entrystr; + } + + } + + } + + // Not a generated method + @Override + public String toString() { + String createVnfNotification; + if (exception==null) { + createVnfNotification = "" + '\n' + + " "+messageId+"" + '\n' + + " "+completed+"" + '\n' + + " "+vnfId+"" + '\n' + + (outputs == null ? "" : outputs.toString() + '\n') + + " "+rollback+"" + '\n' + + ""; + } else { + createVnfNotification = "" + '\n' + + " "+messageId+"" + '\n' + + " "+completed+"" + '\n' + + (outputs == null ? "" : outputs.toString() + '\n') + + " "+exception+"" + '\n' + + " "+errorMessage+"" + '\n' + + ""; + } + return createVnfNotification; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java new file mode 100644 index 0000000000..3ad217306d --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java @@ -0,0 +1,198 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.adapter.vnf; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for deleteVnfNotification complex type. + * + *

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

+ * <complexType name="deleteVnfNotification">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="exception" type="{http://org.onap.so/vnfNotify}msoExceptionCategory" minOccurs="0"/>
+ *         <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "deleteVnfNotification1", propOrder = { + "messageId", + "completed", + "exception", + "errorMessage" +}) +public class DeleteVnfNotification { + + @XmlElement(required = true) + protected String messageId; + protected boolean completed; + protected MsoExceptionCategory exception; + protected String errorMessage; + + /** + * Gets the value of the messageId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageId() { + return messageId; + } + + /** + * Sets the value of the messageId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageId(String value) { + this.messageId = value; + } + + /** + * Gets the value of the completed property. + * + */ + public boolean isCompleted() { + return completed; + } + + /** + * Sets the value of the completed property. + * + */ + public void setCompleted(boolean value) { + this.completed = value; + } + + /** + * Gets the value of the exception property. + * + * @return + * possible object is + * {@link MsoExceptionCategory } + * + */ + public MsoExceptionCategory getException() { + return exception; + } + + /** + * Sets the value of the exception property. + * + * @param value + * allowed object is + * {@link MsoExceptionCategory } + * + */ + public void setException(MsoExceptionCategory value) { + this.exception = 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; + } + + /** + * Overrides toString() method + * @return String type (deleteVnfNotification) + */ + + @Override + public String toString() { + String deleteVnfNotification; + if (exception == null) { + deleteVnfNotification = "" + '\n' + + " "+messageId+"" + '\n' + + " "+completed+"" + '\n' + + ""; + } else { + deleteVnfNotification = "" + '\n' + + " "+messageId+"" + '\n' + + " "+completed+"" + '\n' + + " "+exception+"" + '\n' + + " "+errorMessage+"" + '\n' + + ""; + } + return deleteVnfNotification; + } + +/* + public String toString() { + StringWriter writer = new StringWriter(); + try { + JAXBContext context = JAXBContext + .newInstance(DeleteVnfNotification.class); + Marshaller m = context.createMarshaller(); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + m.marshal(this, writer); + //System.out.println("toString() - " + writer.getBuffer().toString()); + return writer.getBuffer().toString(); + } catch (JAXBException e) { + //System.out.println("JAXBException - " + e.getStackTrace()); + return ""; + } + } +*/ + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.java new file mode 100644 index 0000000000..e4c95e82cd --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.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.bpmn.common.adapter.vnf; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for msoExceptionCategory. + * + *

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

+ *

+ * <simpleType name="msoExceptionCategory">
+ *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     <enumeration value="OPENSTACK"/>
+ *     <enumeration value="IO"/>
+ *     <enumeration value="INTERNAL"/>
+ *     <enumeration value="USERDATA"/>
+ *   </restriction>
+ * </simpleType>
+ * 
+ * + */ +@XmlType(name = "msoExceptionCategory") +@XmlEnum +public enum MsoExceptionCategory { + + OPENSTACK, + IO, + INTERNAL, + USERDATA; + + public String value() { + return name(); + } + + public static MsoExceptionCategory fromValue(String v) { + return valueOf(v); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java new file mode 100644 index 0000000000..6830109097 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java @@ -0,0 +1,112 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.adapter.vnf; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for msoRequest complex type. + * + *

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

+ * <complexType name="msoRequest">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="requestId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="serviceInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "msoRequest", propOrder = { + "requestId", + "serviceInstanceId" +}) +public class MsoRequest { + + protected String requestId; + protected String serviceInstanceId; + + /** + * 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 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; + } + + @Override + public String toString() { + return "" + requestId + "" + '\n' + "" + serviceInstanceId + + ""; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java new file mode 100644 index 0000000000..21bd08fae7 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java @@ -0,0 +1,208 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.adapter.vnf; + +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.adapters.vnf.async.client 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 static final String VNF_NOTIFY = "http://org.onap.so/vnfNotify"; + private static final QName _RollbackVnfNotification_QNAME = new QName(VNF_NOTIFY, "rollbackVnfNotification"); + private static final QName _DeleteVnfNotification_QNAME = new QName(VNF_NOTIFY, "deleteVnfNotification"); + private static final QName _CreateVnfNotification_QNAME = new QName(VNF_NOTIFY, "createVnfNotification"); + private static final QName _UpdateVnfNotification_QNAME = new QName(VNF_NOTIFY, "updateVnfNotification"); + private static final QName _QueryVnfNotification_QNAME = new QName(VNF_NOTIFY, "queryVnfNotification"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.onap.so.adapters.vnf.async.client + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link UpdateVnfNotification } + * + */ + public UpdateVnfNotification createUpdateVnfNotification() { + return new UpdateVnfNotification(); + } + + /** + * Create an instance of {@link UpdateVnfNotification.Outputs } + * + */ + public UpdateVnfNotification.Outputs createUpdateVnfNotificationOutputs() { + return new UpdateVnfNotification.Outputs(); + } + + /** + * Create an instance of {@link QueryVnfNotification } + * + */ + public QueryVnfNotification createQueryVnfNotification() { + return new QueryVnfNotification(); + } + + /** + * Create an instance of {@link QueryVnfNotification.Outputs } + * + */ + public QueryVnfNotification.Outputs createQueryVnfNotificationOutputs() { + return new QueryVnfNotification.Outputs(); + } + + /** + * Create an instance of {@link CreateVnfNotification } + * + */ + public CreateVnfNotification createCreateVnfNotification() { + return new CreateVnfNotification(); + } + + /** + * Create an instance of {@link CreateVnfNotification.Outputs } + * + */ + public CreateVnfNotification.Outputs createCreateVnfNotificationOutputs() { + return new CreateVnfNotification.Outputs(); + } + + /** + * Create an instance of {@link DeleteVnfNotification } + * + */ + public DeleteVnfNotification createDeleteVnfNotification() { + return new DeleteVnfNotification(); + } + + /** + * Create an instance of {@link RollbackVnfNotification } + * + */ + public RollbackVnfNotification createRollbackVnfNotification() { + return new RollbackVnfNotification(); + } + + /** + * Create an instance of {@link MsoRequest } + * + */ + public MsoRequest createMsoRequest() { + return new MsoRequest(); + } + + /** + * Create an instance of {@link VnfRollback } + * + */ + public VnfRollback createVnfRollback() { + return new VnfRollback(); + } + + /** + * Create an instance of {@link UpdateVnfNotification.Outputs.Entry } + * + */ + public UpdateVnfNotification.Outputs.Entry createUpdateVnfNotificationOutputsEntry() { + return new UpdateVnfNotification.Outputs.Entry(); + } + + /** + * Create an instance of {@link QueryVnfNotification.Outputs.Entry } + * + */ + public QueryVnfNotification.Outputs.Entry createQueryVnfNotificationOutputsEntry() { + return new QueryVnfNotification.Outputs.Entry(); + } + + /** + * Create an instance of {@link CreateVnfNotification.Outputs.Entry } + * + */ + public CreateVnfNotification.Outputs.Entry createCreateVnfNotificationOutputsEntry() { + return new CreateVnfNotification.Outputs.Entry(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link RollbackVnfNotification }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://org.onap.so/vnfNotify", name = "rollbackVnfNotification") + public JAXBElement createRollbackVnfNotification(RollbackVnfNotification value) { + return new JAXBElement<>(_RollbackVnfNotification_QNAME, RollbackVnfNotification.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link DeleteVnfNotification }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://org.onap.so/vnfNotify", name = "deleteVnfNotification") + public JAXBElement createDeleteVnfNotification(DeleteVnfNotification value) { + return new JAXBElement<>(_DeleteVnfNotification_QNAME, DeleteVnfNotification.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CreateVnfNotification }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://org.onap.so/vnfNotify", name = "createVnfNotification") + public JAXBElement createCreateVnfNotification(CreateVnfNotification value) { + return new JAXBElement<>(_CreateVnfNotification_QNAME, CreateVnfNotification.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link UpdateVnfNotification }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://org.onap.so/vnfNotify", name = "updateVnfNotification") + public JAXBElement createUpdateVnfNotification(UpdateVnfNotification value) { + return new JAXBElement<>(_UpdateVnfNotification_QNAME, UpdateVnfNotification.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link QueryVnfNotification }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://org.onap.so/vnfNotify", name = "queryVnfNotification") + public JAXBElement createQueryVnfNotification(QueryVnfNotification value) { + return new JAXBElement<>(_QueryVnfNotification_QNAME, QueryVnfNotification.class, null, value); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java new file mode 100644 index 0000000000..e7496b8028 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java @@ -0,0 +1,488 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.adapter.vnf; + +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.XmlType; + + +/** + *

Java class for queryVnfNotification complex type. + * + *

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

+ * <complexType name="queryVnfNotification">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="exception" type="{http://org.onap.so/vnfNotify}msoExceptionCategory" minOccurs="0"/>
+ *         <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="vnfExists" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *         <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="status" type="{http://org.onap.so/vnfNotify}vnfStatus" minOccurs="0"/>
+ *         <element name="outputs" minOccurs="0">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="entry" maxOccurs="unbounded" minOccurs="0">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *                             <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *                           </sequence>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                 </sequence>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "queryVnfNotification1", propOrder = { + "messageId", + "completed", + "exception", + "errorMessage", + "vnfExists", + "vnfId", + "status", + "outputs" +}) +public class QueryVnfNotification { + + @XmlElement(required = true) + protected String messageId; + protected boolean completed; + protected MsoExceptionCategory exception; + protected String errorMessage; + protected Boolean vnfExists; + protected String vnfId; + protected VnfStatus status; + protected QueryVnfNotification.Outputs outputs; + + /** + * Gets the value of the messageId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageId() { + return messageId; + } + + /** + * Sets the value of the messageId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageId(String value) { + this.messageId = value; + } + + /** + * Gets the value of the completed property. + * + */ + public boolean isCompleted() { + return completed; + } + + /** + * Sets the value of the completed property. + * + */ + public void setCompleted(boolean value) { + this.completed = value; + } + + /** + * Gets the value of the exception property. + * + * @return + * possible object is + * {@link MsoExceptionCategory } + * + */ + public MsoExceptionCategory getException() { + return exception; + } + + /** + * Sets the value of the exception property. + * + * @param value + * allowed object is + * {@link MsoExceptionCategory } + * + */ + public void setException(MsoExceptionCategory value) { + this.exception = 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 vnfExists property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isVnfExists() { + return vnfExists; + } + + /** + * Sets the value of the vnfExists property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setVnfExists(Boolean value) { + this.vnfExists = value; + } + + /** + * 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 status property. + * + * @return + * possible object is + * {@link VnfStatus } + * + */ + public VnfStatus getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link VnfStatus } + * + */ + public void setStatus(VnfStatus value) { + this.status = value; + } + + /** + * Gets the value of the outputs property. + * + * @return + * possible object is + * {@link QueryVnfNotification.Outputs } + * + */ + public QueryVnfNotification.Outputs getOutputs() { + return outputs; + } + + /** + * Sets the value of the outputs property. + * + * @param value + * allowed object is + * {@link QueryVnfNotification.Outputs } + * + */ + public void setOutputs(QueryVnfNotification.Outputs value) { + this.outputs = value; + } + + + /** + *

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="entry" maxOccurs="unbounded" minOccurs="0">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+     *                   <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+     *                 </sequence>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *       </sequence>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "entry" + }) + public static class Outputs { + + protected List entry; + + /** + * Gets the value of the entry 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 entry property. + * + *

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

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

+ * Objects of the following type(s) are allowed in the list + * {@link QueryVnfNotification.Outputs.Entry } + * + * + */ + public List getEntry() { + if (entry == null) { + entry = new ArrayList<>(); + } + return this.entry; + } + + // Not a generated method + public String toString() { + StringBuilder out = new StringBuilder(); + out.append("\n"); + if (entry != null) { + for (Entry e : entry) { + out.append(e.toString()); + out.append('\n'); + } + } + out.append(""); + return out.toString(); + } + + + /** + *

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="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+         *         <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+         *       </sequence>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "key", + "value" + }) + public static class Entry { + + protected String key; + protected String value; + + /** + * Gets the value of the key property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getKey() { + return key; + } + + /** + * Sets the value of the key property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setKey(String value) { + this.key = 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; + } + + // Not a generated method + public String toString() { + String entry = ""; + entry = + ""+ '\n' + + " "+key+"" + '\n' + + " "+value+"" + '\n' + + ""; + return entry; + } + + } + + } + + // Not a generated method + public String toString() { + String queryVnfNotification = ""; + if (exception==null) { + queryVnfNotification = "" + '\n' + + " "+messageId+"" + '\n' + + " "+completed+"" + '\n' + + " "+vnfExists+"" + '\n' + + " "+vnfId+"" + '\n' + + " "+status+"" + '\n' + + (outputs == null ? "" : outputs.toString() + '\n') + + ""; + } else { + queryVnfNotification = "" + '\n' + + " "+messageId+"" + '\n' + + " "+completed+"" + '\n' + + (outputs == null ? "" : outputs.toString() + '\n') + + " "+exception+"" + '\n' + + " "+errorMessage+"" + '\n' + + ""; + } + return queryVnfNotification; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java new file mode 100644 index 0000000000..6b143a2494 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java @@ -0,0 +1,175 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.adapter.vnf; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for rollbackVnfNotification complex type. + * + *

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

+ * <complexType name="rollbackVnfNotification">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="exception" type="{http://org.onap.so/vnfNotify}msoExceptionCategory" minOccurs="0"/>
+ *         <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "rollbackVnfNotification1", propOrder = { + "messageId", + "completed", + "exception", + "errorMessage" +}) +public class RollbackVnfNotification { + + @XmlElement(required = true) + protected String messageId; + protected boolean completed; + protected MsoExceptionCategory exception; + protected String errorMessage; + + /** + * Gets the value of the messageId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageId() { + return messageId; + } + + /** + * Sets the value of the messageId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageId(String value) { + this.messageId = value; + } + + /** + * Gets the value of the completed property. + * + */ + public boolean isCompleted() { + return completed; + } + + /** + * Sets the value of the completed property. + * + */ + public void setCompleted(boolean value) { + this.completed = value; + } + + /** + * Gets the value of the exception property. + * + * @return + * possible object is + * {@link MsoExceptionCategory } + * + */ + public MsoExceptionCategory getException() { + return exception; + } + + /** + * Sets the value of the exception property. + * + * @param value + * allowed object is + * {@link MsoExceptionCategory } + * + */ + public void setException(MsoExceptionCategory value) { + this.exception = 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; + } + + public String toString() { + String rollbackVnfNotification = ""; + if (exception==null) { + rollbackVnfNotification = "" + '\n' + + " "+messageId+"" + '\n' + + " "+completed+"" + '\n' + + ""; + } else { + rollbackVnfNotification = "" + '\n' + + " "+messageId+"" + '\n' + + " "+completed+"" + '\n' + + " "+exception+"" + '\n' + + " "+errorMessage+"" + '\n' + + ""; + } + return rollbackVnfNotification; + + } + + } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java new file mode 100644 index 0000000000..b89135b865 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java @@ -0,0 +1,412 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.adapter.vnf; + +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.XmlType; + + +/** + *

Java class for updateVnfNotification complex type. + * + *

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

+ * <complexType name="updateVnfNotification">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="exception" type="{http://org.onap.so/vnfNotify}msoExceptionCategory" minOccurs="0"/>
+ *         <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="outputs" minOccurs="0">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="entry" maxOccurs="unbounded" minOccurs="0">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *                             <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *                           </sequence>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                 </sequence>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element name="rollback" type="{http://org.onap.so/vnfNotify}vnfRollback" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "updateVnfNotification1", propOrder = { + "messageId", + "completed", + "exception", + "errorMessage", + "outputs", + "rollback" +}) +public class UpdateVnfNotification { + + @XmlElement(required = true) + protected String messageId; + protected boolean completed; + protected MsoExceptionCategory exception; + protected String errorMessage; + protected UpdateVnfNotification.Outputs outputs; + protected VnfRollback rollback; + + /** + * Gets the value of the messageId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageId() { + return messageId; + } + + /** + * Sets the value of the messageId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageId(String value) { + this.messageId = value; + } + + /** + * Gets the value of the completed property. + * + */ + public boolean isCompleted() { + return completed; + } + + /** + * Sets the value of the completed property. + * + */ + public void setCompleted(boolean value) { + this.completed = value; + } + + /** + * Gets the value of the exception property. + * + * @return + * possible object is + * {@link MsoExceptionCategory } + * + */ + public MsoExceptionCategory getException() { + return exception; + } + + /** + * Sets the value of the exception property. + * + * @param value + * allowed object is + * {@link MsoExceptionCategory } + * + */ + public void setException(MsoExceptionCategory value) { + this.exception = 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 outputs property. + * + * @return + * possible object is + * {@link UpdateVnfNotification.Outputs } + * + */ + public UpdateVnfNotification.Outputs getOutputs() { + return outputs; + } + + /** + * Sets the value of the outputs property. + * + * @param value + * allowed object is + * {@link UpdateVnfNotification.Outputs } + * + */ + public void setOutputs(UpdateVnfNotification.Outputs value) { + this.outputs = value; + } + + /** + * Gets the value of the rollback property. + * + * @return + * possible object is + * {@link VnfRollback } + * + */ + public VnfRollback getRollback() { + return rollback; + } + + /** + * Sets the value of the rollback property. + * + * @param value + * allowed object is + * {@link VnfRollback } + * + */ + public void setRollback(VnfRollback value) { + this.rollback = value; + } + + + /** + *

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="entry" maxOccurs="unbounded" minOccurs="0">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+     *                   <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+     *                 </sequence>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *       </sequence>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "entry" + }) + public static class Outputs { + + protected List entry; + + /** + * Gets the value of the entry 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 entry property. + * + *

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

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

+ * Objects of the following type(s) are allowed in the list + * {@link UpdateVnfNotification.Outputs.Entry } + * + * + */ + public List getEntry() { + if (entry == null) { + entry = new ArrayList<>(); + } + return this.entry; + } + + + /** + *

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="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+         *         <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+         *       </sequence>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "key", + "value" + }) + public static class Entry { + + protected String key; + protected String value; + + /** + * Gets the value of the key property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getKey() { + return key; + } + + /** + * Sets the value of the key property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setKey(String value) { + this.key = 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; + } + + public String toString() { + String entry = ""; + entry = + " "+key+"" + '\n' + + " "+value+""; + return entry; + } + } + + } + + public String toString(){ + String updateVnfNotification = ""; + if (exception==null) { + updateVnfNotification = "" + '\n' + + " "+messageId+"" + '\n' + + " "+completed+"" + '\n' + + " "+rollback+"" + '\n' + + ""; + } else { + updateVnfNotification = "" + '\n' + + " "+messageId+"" + '\n' + + " "+completed+"" + '\n' + + " "+exception+"" + '\n' + + " "+errorMessage+"" + '\n' + + ""; + } + + return updateVnfNotification; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java new file mode 100644 index 0000000000..adedca9ac5 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java @@ -0,0 +1,177 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.adapter.vnf; + +import javax.jws.Oneway; +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.Action; +import javax.xml.ws.RequestWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.8 + * Generated source version: 2.2 + * + */ +@WebService(name = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface VnfAdapterNotify { + + + /** + * + * @param errorMessage + * @param exception + * @param messageId + * @param completed + */ + @WebMethod + @Oneway + @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.RollbackVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/rollbackVnfNotificationRequest") + public void rollbackVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage); + + /** + * + * @param errorMessage + * @param vnfExists + * @param status + * @param exception + * @param outputs + * @param messageId + * @param vnfId + * @param completed + */ + @WebMethod + @Oneway + @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.QueryVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/queryVnfNotificationRequest") + public void queryVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage, + @WebParam(name = "vnfExists", targetNamespace = "") + Boolean vnfExists, + @WebParam(name = "vnfId", targetNamespace = "") + String vnfId, + @WebParam(name = "status", targetNamespace = "") + VnfStatus status, + @WebParam(name = "outputs", targetNamespace = "") + org.onap.so.bpmn.common.adapter.vnf.QueryVnfNotification.Outputs outputs); + + /** + * + * @param errorMessage + * @param exception + * @param rollback + * @param outputs + * @param messageId + * @param vnfId + * @param completed + */ + @WebMethod + @Oneway + @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/createVnfNotificationRequest") + public void createVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage, + @WebParam(name = "vnfId", targetNamespace = "") + String vnfId, + @WebParam(name = "outputs", targetNamespace = "") + org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs outputs, + @WebParam(name = "rollback", targetNamespace = "") + VnfRollback rollback); + + /** + * + * @param errorMessage + * @param exception + * @param rollback + * @param outputs + * @param messageId + * @param completed + */ + @WebMethod + @Oneway + @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.UpdateVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest") + public void updateVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage, + @WebParam(name = "outputs", targetNamespace = "") + org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs outputs, + @WebParam(name = "rollback", targetNamespace = "") + VnfRollback rollback); + + /** + * + * @param errorMessage + * @param exception + * @param messageId + * @param completed + */ + @WebMethod + @Oneway + @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.DeleteVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/deleteVnfNotificationRequest") + public void deleteVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage); + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java new file mode 100644 index 0000000000..667545d855 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java @@ -0,0 +1,108 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.adapter.vnf; + +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.8 + * Generated source version: 2.2 + * + */ +@WebServiceClient(name = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify", wsdlLocation = "/VnfAdapterNotify.wsdl") +public class VnfAdapterNotify_Service extends Service +{ + + private final static URL VNFADAPTERNOTIFY_WSDL_LOCATION; + private final static WebServiceException VNFADAPTERNOTIFY_EXCEPTION; + private final static QName VNFADAPTERNOTIFY_QNAME = new QName("http://org.onap.so/vnfNotify", "vnfAdapterNotify"); + + static { + VNFADAPTERNOTIFY_WSDL_LOCATION = org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify_Service.class.getResource("/VnfAdapterNotify.wsdl"); + WebServiceException e = null; + if (VNFADAPTERNOTIFY_WSDL_LOCATION == null) { + e = new WebServiceException("Cannot find '/VnfAdapterNotify.wsdl' wsdl. Place the resource correctly in the classpath."); + } + VNFADAPTERNOTIFY_EXCEPTION = e; + } + + public VnfAdapterNotify_Service() { + super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME); + } + + public VnfAdapterNotify_Service(WebServiceFeature... features) { + super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME, features); + } + + public VnfAdapterNotify_Service(URL wsdlLocation) { + super(wsdlLocation, VNFADAPTERNOTIFY_QNAME); + } + + public VnfAdapterNotify_Service(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, VNFADAPTERNOTIFY_QNAME, features); + } + + public VnfAdapterNotify_Service(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public VnfAdapterNotify_Service(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns VnfAdapterNotify + */ + @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort") + public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort() { + return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns VnfAdapterNotify + */ + @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort") + public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort(WebServiceFeature... features) { + return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class, features); + } + + private static URL __getWsdlLocation() { + if (VNFADAPTERNOTIFY_EXCEPTION!= null) { + throw VNFADAPTERNOTIFY_EXCEPTION; + } + return VNFADAPTERNOTIFY_WSDL_LOCATION; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java new file mode 100644 index 0000000000..194ce58fe9 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java @@ -0,0 +1,210 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.adapter.vnf; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for vnfRollback complex type. + * + *

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

+ * <complexType name="vnfRollback">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="cloudSiteId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="msoRequest" type="{http://org.onap.so/vnfNotify}msoRequest" minOccurs="0"/>
+ *         <element name="tenantCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="tenantId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="vnfCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "vnfRollback", propOrder = { + "cloudSiteId", + "msoRequest", + "tenantCreated", + "tenantId", + "vnfCreated", + "vnfId" +}) +public class VnfRollback { + + protected String cloudSiteId; + protected MsoRequest msoRequest; + protected boolean tenantCreated; + protected String tenantId; + protected boolean vnfCreated; + protected String vnfId; + + /** + * Gets the value of the cloudSiteId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCloudSiteId() { + return cloudSiteId; + } + + /** + * Sets the value of the cloudSiteId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCloudSiteId(String value) { + this.cloudSiteId = value; + } + + /** + * Gets the value of the msoRequest property. + * + * @return + * possible object is + * {@link MsoRequest } + * + */ + public MsoRequest getMsoRequest() { + return msoRequest; + } + + /** + * Sets the value of the msoRequest property. + * + * @param value + * allowed object is + * {@link MsoRequest } + * + */ + public void setMsoRequest(MsoRequest value) { + this.msoRequest = value; + } + + /** + * Gets the value of the tenantCreated property. + * + */ + public boolean isTenantCreated() { + return tenantCreated; + } + + /** + * Sets the value of the tenantCreated property. + * + */ + public void setTenantCreated(boolean value) { + this.tenantCreated = 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 vnfCreated property. + * + */ + public boolean isVnfCreated() { + return vnfCreated; + } + + /** + * Sets the value of the vnfCreated property. + * + */ + public void setVnfCreated(boolean value) { + this.vnfCreated = value; + } + + /** + * 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; + } + + public String toString() { + String msoRequestElement = msoRequest == null ? "" + : ""+msoRequest+"" + '\n'; + + return + ""+cloudSiteId+"" + '\n' + + msoRequestElement + + ""+tenantCreated+"" + '\n' + + ""+tenantId+"" + '\n' + + ""+vnfCreated+"" + '\n' + + ""+vnfId+""; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.java new file mode 100644 index 0000000000..d093f79e03 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.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.bpmn.common.adapter.vnf; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for vnfStatus. + * + *

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

+ *

+ * <simpleType name="vnfStatus">
+ *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     <enumeration value="ACTIVE"/>
+ *     <enumeration value="FAILED"/>
+ *     <enumeration value="NOTFOUND"/>
+ *     <enumeration value="UNKNOWN"/>
+ *   </restriction>
+ * </simpleType>
+ * 
+ * + */ +@XmlType(name = "vnfStatus") +@XmlEnum +public enum VnfStatus { + + ACTIVE, + FAILED, + NOTFOUND, + UNKNOWN; + + public String value() { + return name(); + } + + public static VnfStatus fromValue(String v) { + return valueOf(v); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/package-info.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/package-info.java new file mode 100644 index 0000000000..654673ad4a --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/package-info.java @@ -0,0 +1,22 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.onap.so/vnfNotify") +package org.onap.so.bpmn.common.adapter.vnf; diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java new file mode 100644 index 0000000000..f274850b8d --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java @@ -0,0 +1,425 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.workflow.service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.camunda.bpm.engine.MismatchingMessageCorrelationException; +import org.camunda.bpm.engine.OptimisticLockingException; +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.runtime.Execution; +import org.camunda.bpm.engine.runtime.MessageCorrelationResult; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +/** + * Abstract base class for callback services. + */ +@Service +public class CallbackHandlerService { + public static final long DEFAULT_TIMEOUT_SECONDS = 60; + public static final long FAST_POLL_DUR_SECONDS = 5; + public static final long FAST_POLL_INT_MS = 100; + public static final long SLOW_POLL_INT_MS = 1000; + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CallbackHandlerService.class); + + @Autowired + RuntimeService runtimeService; + + /** + * Parameterized callback handler. + */ + @Async + protected CallbackResult handleCallback(String method, Object message, + String messageEventName, String messageVariable, + String correlationVariable, String correlationValue, + String logMarker) { + + return handleCallback(method, message, messageEventName, messageVariable, + correlationVariable, correlationValue, logMarker, null); + } + + /** + * Parameterized callback handler. + */ + protected CallbackResult handleCallback(String method, Object message, + String messageEventName, String messageVariable, + String correlationVariable, String correlationValue, + String logMarker, Map injectedVariables) { + + long startTime = System.currentTimeMillis(); + + LOGGER.debug(logMarker + " " + method + " received message: " + + (message == null ? "" : System.lineSeparator()) + message); + + try { + Map variables = new HashMap<>(); + + if (injectedVariables != null) { + variables.putAll(injectedVariables); + } + + variables.put(correlationVariable, correlationValue); + variables.put(messageVariable, message == null ? null : message.toString()); + + boolean ok = correlate(messageEventName, correlationVariable, + correlationValue, variables, logMarker); + + if (!ok) { + String msg = "No process is waiting for " + messageEventName + + " with " + correlationVariable + " = '" + correlationValue + "'"; + logCallbackError(method, startTime, msg); + return new CallbackError(msg); + } + + logCallbackSuccess(method, startTime); + return new CallbackSuccess(); + } catch (Exception e) { + LOGGER.debug("Exception :",e); + String msg = "Caught " + e.getClass().getSimpleName() + + " processing " + messageEventName + " with " + correlationVariable + + " = '" + correlationValue + "'"; + logCallbackError(method, startTime, msg); + return new CallbackError(msg); + } + } + + /** + * Performs message correlation. Waits a limited amount of time for + * a process to become ready for correlation. The return value indicates + * whether or not a process was found to receive the message. Due to the + * synchronous nature of message injection in Camunda, by the time this + * method returns, one of 3 things will have happened: (1) the process + * received the message and ended, (2) the process received the message + * and reached an activity that suspended, or (3) an exception occurred + * during correlation or while the process was executing. Correlation + * exceptions are handled differently from process execution exceptions. + * Correlation exceptions are thrown so the client knows something went + * wrong with the delivery of the message. Process execution exceptions + * are logged but not thrown. + * @param messageEventName the message event name + * @param correlationVariable the process variable used as the correlator + * @param correlationValue the correlation value + * @param variables variables to inject into the process + * @param logMarker a marker for debug logging + * @return true if a process could be found, false if not + * @throws Exception for correlation errors + */ + protected boolean correlate(String messageEventName, String correlationVariable, + String correlationValue, Map variables, String logMarker) + throws Exception { + try{ + LOGGER.debug(logMarker + " Attempting to find process waiting" + + " for " + messageEventName + " with " + correlationVariable + + " = '" + correlationValue + "'"); + + + + long timeout = DEFAULT_TIMEOUT_SECONDS; + + // The code is here in case we ever need to change the default. + String correlationTimemout = UrnPropertiesReader.getVariable("mso.correlation.timeout"); + if (correlationTimemout != null) { + try { + timeout = Long.parseLong(correlationTimemout); + } catch (NumberFormatException e) { + // Ignore + } + } + + long now = System.currentTimeMillis(); + long fastPollEndTime = now + (FAST_POLL_DUR_SECONDS * 1000); + long endTime = now + (timeout * 1000); + long sleep = FAST_POLL_INT_MS; + + List waitingProcesses = null; + Exception queryException = null; + int queryCount = 0; + int queryFailCount = 0; + + while (true) { + try { + ++queryCount; + waitingProcesses = runtimeService.createExecutionQuery() + .messageEventSubscriptionName(messageEventName) + .processVariableValueEquals(correlationVariable, correlationValue) + .list(); + } catch (Exception e) { + ++queryFailCount; + queryException = e; + } + + if (waitingProcesses != null && waitingProcesses.size() > 0) { + break; + } + + if (now > endTime - sleep) { + break; + } + + Thread.sleep(sleep); + now = System.currentTimeMillis(); + + if (now > fastPollEndTime) { + sleep = SLOW_POLL_INT_MS; + } + } + + if (waitingProcesses == null) { + waitingProcesses = new ArrayList(0); + } + + int count = waitingProcesses.size(); + + List execInfoList = new ArrayList<>(count); + for (Execution execution : waitingProcesses) { + execInfoList.add(new ExecInfo(execution)); + } + + LOGGER.debug(logMarker + " Found " + count + " process(es) waiting" + + " for " + messageEventName + " with " + correlationVariable + + " = '" + correlationValue + "': " + execInfoList); + + if (count == 0) { + if (queryFailCount > 0) { + String msg = queryFailCount + "/" + queryCount + + " execution queries failed attempting to correlate " + + messageEventName + " with " + correlationVariable + + " = '" + correlationValue + "'; last exception was:" + + queryException; + LOGGER.debug(msg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg, queryException); + } + + return false; + } + + if (count > 1) { + // Only one process should be waiting. Throw an exception back to the client. + throw new MismatchingMessageCorrelationException(messageEventName, + "more than 1 process is waiting with " + correlationVariable + + " = '" + correlationValue + "'"); + } + + // We prototyped an asynchronous solution, i.e. resuming the process + // flow in a separate thread, but this affected too many existing tests, + // and we went back to the synchronous solution. The synchronous solution + // has some troublesome characteristics though. For example, the + // resumed flow may send request #2 to a remote system before MSO has + // acknowledged the notification associated with request #1. + + try { + LOGGER.debug(logMarker + " Running " + execInfoList.get(0) + " to receive " + + messageEventName + " with " + correlationVariable + " = '" + + correlationValue + "'"); + + @SuppressWarnings("unused") + MessageCorrelationResult result = runtimeService + .createMessageCorrelation(messageEventName) + .setVariables(variables) + .processInstanceVariableEquals(correlationVariable, correlationValue) + .correlateWithResult(); + + } catch (MismatchingMessageCorrelationException e) { + // A correlation exception occurred even after we identified + // one waiting process. Throw it back to the client. + throw e; + } catch (OptimisticLockingException ole) { + + String msg = "Caught " + ole.getClass().getSimpleName() + " after receiving " + messageEventName + + " with " + correlationVariable + " = '" + correlationValue + + "': " + ole; + LOGGER.debug(msg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg, ole); + + //Retry for OptimisticLocking Exceptions + int retryCount = 0; + String retryStr = UrnPropertiesReader.getVariable("mso.bpmn.optimisticlockingexception.retrycount"); + if (retryStr != null) { + try { + retryCount = Integer.parseInt(retryStr); + } catch (NumberFormatException e) { + // Ignore + } + } + + LOGGER.debug("Retry correlate for OptimisticLockingException, retryCount:" + retryCount); + + for (; retryCount >0 ; retryCount--) { + + try{ + Thread.sleep(SLOW_POLL_INT_MS); + + @SuppressWarnings("unused") + MessageCorrelationResult result = runtimeService + .createMessageCorrelation(messageEventName) + .setVariables(variables) + .processInstanceVariableEquals(correlationVariable, correlationValue) + .correlateWithResult(); + retryCount = 0; + LOGGER.debug("OptimisticLockingException retry was successful, seting retryCount: " + retryCount); + } catch (OptimisticLockingException olex) { + //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException; + String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex; + LOGGER.debug(strMsg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, strMsg, olex); + } catch (Exception excep) { + retryCount = 0; + //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException; + String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + excep; + LOGGER.debug(strMsg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, strMsg, excep); + } + + } + + }catch (Exception e) { + // This must be an exception from the flow itself. Log it, but don't + // report it back to the client. + String msg = "Caught " + e.getClass().getSimpleName() + " running " + + execInfoList.get(0) + " after receiving " + messageEventName + + " with " + correlationVariable + " = '" + correlationValue + + "': " + e; + LOGGER.debug(msg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg, e); + } + } catch (Exception e) { + // This must be an exception from the flow itself. Log it, but don't + // report it back to the client. + String msg = "Caught " + e.getClass().getSimpleName() + " after receiving " + messageEventName + + " with " + correlationVariable + " = '" + correlationValue + + "': " + e; + LOGGER.debug(msg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg, e); + } + + return true; + } + + /** + * Records audit and metric events in the log for a callback success. + * @param method the method name + * @param startTime the request start time + */ + protected void logCallbackSuccess(String method, long startTime) { + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, + MsoLogger.ResponseCode.Suc, "Completed " + method); + + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, + MsoLogger.ResponseCode.Suc, "Completed " + method, + "BPMN", MsoLogger.getServiceName(), null); + } + + /** + * Records error, audit and metric events in the log for a callback + * internal error. + * @param method the method name + * @param startTime the request start time + * @param msg the error message + */ + protected void logCallbackError(String method, long startTime, String msg) { + logCallbackError(method, startTime, msg, null); + } + + /** + * Records error, audit and metric events in the log for a callback + * internal error. + * @param method the method name + * @param startTime the request start time + * @param msg the error message + * @param e the exception + */ + protected void logCallbackError(String method, long startTime, String msg, Exception e) { + if (e == null) { + LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg); + } else { + LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg, e); + } + + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, + MsoLogger.ResponseCode.InternalError, "Completed " + method); + + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, + MsoLogger.ResponseCode.InternalError, "Completed " + method, + "BPMN", MsoLogger.getServiceName(), null); + } + + /** + * Abstract callback result object. + */ + protected abstract class CallbackResult { + } + + /** + * Indicates that callback handling was successful. + */ + protected class CallbackSuccess extends CallbackResult { + } + + /** + * Indicates that callback handling failed. + */ + protected class CallbackError extends CallbackResult { + private final String errorMessage; + + public CallbackError(String errorMessage) { + this.errorMessage = errorMessage; + } + + /** + * Gets the error message. + */ + public String getErrorMessage() { + return errorMessage; + } + } + + private static class ExecInfo { + private final Execution execution; + + public ExecInfo(Execution execution) { + this.execution = execution; + } + + @Override + public String toString() { + return "Process[" + execution.getProcessInstanceId() + + ":" + execution.getId() + "]"; + } + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java new file mode 100644 index 0000000000..0e9e1425a6 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java @@ -0,0 +1,68 @@ +/*- + * ============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.bpmn.common.workflow.service; + +import java.util.Optional; + +import javax.ws.rs.ext.Provider; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.ProcessEngines; +import org.springframework.stereotype.Service; + +/** + * Base class for services that must be process-engine aware. The only + * process engine currently supported is the "default" process engine. + */ +@Service +public class ProcessEngineAwareService { + + private final String processEngineName = "default"; + private volatile Optional pes4junit = Optional.empty(); + + /** + * Gets the process engine name. + * @return the process engine name + */ + public String getProcessEngineName() { + return processEngineName; + } + + /** + * Gets process engine services. + * @return process engine services + */ + public ProcessEngineServices getProcessEngineServices() { + return pes4junit.orElse(ProcessEngines.getProcessEngine( + getProcessEngineName())); + } + + /** + * Allows a particular process engine to be specified, overriding the + * usual process engine lookup by name. Intended primarily for the + * unit test environment. + * @param pes process engine services + */ + public void setProcessEngineServices4junit(ProcessEngineServices pes) { + pes4junit = Optional.ofNullable(pes); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java new file mode 100644 index 0000000000..710144dbb9 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.workflow.service; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.ws.rs.core.Context; +import javax.xml.ws.WebServiceContext; + +import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest; +import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterResponse; +import org.onap.so.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType; +import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError; +import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * Implementation of SDNCAdapterCallbackService. + */ +@WebService(serviceName="SDNCAdapterCallbackService", targetNamespace="http://org.onap/workflow/sdnc/adapter/schema/v1") +@Service +public class SDNCAdapterCallbackServiceImpl extends ProcessEngineAwareService implements SDNCCallbackAdapterPortType { + + private final static String logMarker = "[SDNC-CALLBACK]"; + + @Context WebServiceContext wsContext; + + @Autowired + CallbackHandlerService callback; + + @WebMethod(operationName = "SDNCAdapterCallback") + @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") + public SDNCAdapterResponse sdncAdapterCallback( + @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest") + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest) { + + String method = "sdncAdapterCallback"; + Object message = sdncAdapterCallbackRequest; + String messageEventName = "sdncAdapterCallbackRequest"; + String messageVariable = "sdncAdapterCallbackRequest"; + String correlationVariable = "SDNCA_requestId"; + String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId(); + + MsoLogger.setServiceName("MSO." + method); + MsoLogger.setLogContext(correlationValue, "N/A"); + + CallbackResult result = callback.handleCallback(method, message, messageEventName, + messageVariable, correlationVariable, correlationValue, logMarker); + + if (result instanceof CallbackError) { + return new SDNCAdapterErrorResponse(((CallbackError)result).getErrorMessage()); + } else { + return new SDNCAdapterResponse(); + } + } + + // This subclass allows unit tests to extract the error + public class SDNCAdapterErrorResponse extends SDNCAdapterResponse { + private String error; + + public SDNCAdapterErrorResponse(String error) { + this.error = error; + } + + public String getError() { + return error; + } + } +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java new file mode 100644 index 0000000000..ae9cec9476 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java @@ -0,0 +1,255 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.workflow.service; + +import javax.jws.Oneway; +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; +import javax.ws.rs.core.Context; +import javax.xml.ws.Action; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.WebServiceContext; + +import org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification; +import org.onap.so.bpmn.common.adapter.vnf.DeleteVnfNotification; +import org.onap.so.bpmn.common.adapter.vnf.MsoExceptionCategory; +import org.onap.so.bpmn.common.adapter.vnf.QueryVnfNotification; +import org.onap.so.bpmn.common.adapter.vnf.RollbackVnfNotification; +import org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification; +import org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify; +import org.onap.so.bpmn.common.adapter.vnf.VnfRollback; +import org.onap.so.bpmn.common.adapter.vnf.VnfStatus; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * Implementation of the VnfAdapterNotify service. + */ +@WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify") +@Service +public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService implements VnfAdapterNotify{ + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterNotifyServiceImpl.class); + + private final String logMarker = "[VNF-NOTIFY]"; + + @Autowired + CallbackHandlerService callback; + + @Context WebServiceContext wsContext; + + @WebMethod(operationName = "rollbackVnfNotification") + @Oneway + @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.RollbackVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/rollbackVnfNotificationRequest") + public void rollbackVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage) { + + RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification(); + + rollbackVnfNotification.setMessageId(messageId); + rollbackVnfNotification.setCompleted(completed); + rollbackVnfNotification.setException(exception); + rollbackVnfNotification.setErrorMessage(errorMessage); + + String method = "rollbackVnfNotification"; + Object message = rollbackVnfNotification; + String messageEventName = "rollbackVnfNotificationCallback"; + String messageVariable = "rollbackVnfNotificationCallback"; + String correlationVariable = "VNFRB_messageId"; + String correlationValue = messageId; + + callback.handleCallback(method, message, messageEventName, messageVariable, + correlationVariable, correlationValue, logMarker); + } + + @WebMethod(operationName = "queryVnfNotification") + @Oneway + @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.QueryVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/queryVnfNotificationRequest") + public void queryVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage, + @WebParam(name = "vnfExists", targetNamespace = "") + Boolean vnfExists, + @WebParam(name = "vnfId", targetNamespace = "") + String vnfId, + @WebParam(name = "status", targetNamespace = "") + VnfStatus status, + @WebParam(name = "outputs", targetNamespace = "") + QueryVnfNotification.Outputs outputs){ + + String method = "queryVnfNotification"; + String messageEventName = "queryVnfNotificationCallback"; + String messageVariable = "queryVnfNotificationCallback"; + String correlationVariable = "VNFQ_messageId"; + String correlationValue = messageId; + + MsoLogger.setServiceName("MSO." + method); + MsoLogger.setLogContext(correlationValue, "N/A"); + + QueryVnfNotification message = new QueryVnfNotification(); + + message.setMessageId(messageId); + message.setCompleted(completed); + message.setException(exception); + message.setErrorMessage(errorMessage); + message.setVnfExists(vnfExists); + message.setVnfId(vnfId); + message.setStatus(status); + message.setOutputs(outputs); + + callback.handleCallback(method, message, messageEventName, messageVariable, + correlationVariable, correlationValue, logMarker); + } + + @WebMethod(operationName = "createVnfNotification") + @Oneway + @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/createVnfNotificationRequest") + public void createVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage, + @WebParam(name = "vnfId", targetNamespace = "") + String vnfId, + @WebParam(name = "outputs", targetNamespace = "") + CreateVnfNotification.Outputs outputs, + @WebParam(name = "rollback", targetNamespace = "") + VnfRollback rollback){ + + String method = "createVnfNotification"; + String messageEventName = "createVnfNotificationCallback"; + String messageVariable = "createVnfNotificationCallback"; + String correlationVariable = "VNFC_messageId"; + String correlationValue = messageId; + + MsoLogger.setServiceName("MSO." + method); + MsoLogger.setLogContext(correlationValue, "N/A"); + + CreateVnfNotification message = new CreateVnfNotification(); + + message.setMessageId(messageId); + message.setCompleted(completed); + message.setException(exception); + message.setErrorMessage(errorMessage); + message.setVnfId(vnfId); + message.setOutputs(outputs); + message.setRollback(rollback); + + callback.handleCallback(method, message, messageEventName, messageVariable, + correlationVariable, correlationValue, logMarker); + } + + @WebMethod(operationName = "updateVnfNotification") + @Oneway + @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.UpdateVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest") + public void updateVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage, + @WebParam(name = "outputs", targetNamespace = "") + UpdateVnfNotification.Outputs outputs, + @WebParam(name = "rollback", targetNamespace = "") + VnfRollback rollback){ + + String method = "updateVnfNotification"; + String messageEventName = "updateVnfNotificationCallback"; + String messageVariable = "updateVnfNotificationCallback"; + String correlationVariable = "VNFU_messageId"; + String correlationValue = messageId; + + MsoLogger.setServiceName("MSO." + method); + MsoLogger.setLogContext(correlationValue, "N/A"); + + UpdateVnfNotification message = new UpdateVnfNotification(); + + message.setMessageId(messageId); + message.setCompleted(completed); + message.setException(exception); + message.setErrorMessage(errorMessage); + message.setOutputs(outputs); + message.setRollback(rollback); + + callback.handleCallback(method, message, messageEventName, messageVariable, + correlationVariable, correlationValue, logMarker); + } + + @WebMethod(operationName = "deleteVnfNotification") + @Oneway + @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.DeleteVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/deleteVnfNotificationRequest") + public void deleteVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage) { + + String method = "deleteVnfNotification"; + String messageEventName = "deleteVnfACallback"; + String messageVariable = "deleteVnfACallback"; + String correlationVariable = "VNFDEL_uuid"; + String correlationValue = messageId; + + MsoLogger.setServiceName("MSO." + method); + MsoLogger.setLogContext(correlationValue, "N/A"); + + DeleteVnfNotification message = new DeleteVnfNotification(); + + message.setMessageId(messageId); + message.setCompleted(completed); + message.setException(exception); + message.setErrorMessage(errorMessage); + + callback.handleCallback(method, message, messageEventName, messageVariable, + correlationVariable, correlationValue, logMarker); + } +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java new file mode 100644 index 0000000000..a9a3a63f2f --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.workflow.service; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.ProcessEngines; + + +public class WorkflowAsyncCommonResource extends WorkflowAsyncResource { + + @Override + public String getProcessEngineName() { + return "default"; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java new file mode 100644 index 0000000000..cfd07d8c39 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java @@ -0,0 +1,244 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.workflow.service; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.UUID; + +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.Response; +import javax.ws.rs.ext.Provider; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.onap.so.bpmn.common.workflow.context.WorkflowContext; +import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder; +import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; +import org.onap.so.logger.MsoLogger; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + + +/** + * + * @version 1.0 + * Asynchronous Workflow processing using JAX RS RESTeasy implementation + * Both Synchronous and Asynchronous BPMN process can benefit from this implementation since the workflow gets executed in the background + * and the server thread is freed up, server scales better to process more incoming requests + * + * Usage: For synchronous process, when you are ready to send the response invoke the callback to write the response + * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process + */ +@Path("/async") +@Api(value = "/async", description = "Provides asynchronous starting of a bpmn process") +@Provider +@Component +public class WorkflowAsyncResource extends ProcessEngineAwareService { + + private static final WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); + + + protected Optional pes4junit = Optional.empty(); + + long workflowPollInterval=1000; + + @Autowired + private WorkflowProcessor processor; + + @Autowired + private WorkflowContextHolder workflowContext; + + public WorkflowProcessor getProcessor() { + return processor; + } + + + + public void setProcessor(WorkflowProcessor processor) { + this.processor = processor; + } + + protected static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,WorkflowAsyncResource.class); + protected static final long DEFAULT_WAIT_TIME = 60000; //default wait time + + /** + * Asynchronous JAX-RS method that starts a process instance. + * @param asyncResponse an object that will receive the asynchronous response + * @param processKey the process key + * @param variableMap input variables to the process + * @return + */ + + @POST + @Path("/services/{processKey}") + @ApiOperation( + value = "Starts a new process with the appropriate process Key", + notes = "Aysnc fall outs are only logged" + ) + @Produces("application/json") + @Consumes("application/json") + public Response startProcessInstanceByKey ( + @PathParam("processKey") String processKey, VariableMapImpl variableMap){ + Map inputVariables = getInputVariables(variableMap); + try { + MDC.put(MsoLogger.REQUEST_ID, getRequestId(inputVariables)); + processor.startProcess(processKey, variableMap); + WorkflowResponse response = waitForResponse(getRequestId(inputVariables)); + return Response.status(202).entity(response).build(); + } catch (Exception e) { + WorkflowResponse response = buildUnkownError(getRequestId(inputVariables),e.getMessage()); + return Response.status(500).entity(response).build(); + } + } + + private WorkflowResponse waitForResponse(String requestId) throws Exception { + long currentWaitTime = 0; + while (DEFAULT_WAIT_TIME > currentWaitTime ) { + Thread.sleep(workflowPollInterval); + currentWaitTime = currentWaitTime + workflowPollInterval; + WorkflowContext foundContext = contextHolder.getWorkflowContext(requestId); + if(foundContext!=null){ + contextHolder.remove(foundContext); + return buildResponse(foundContext); + } + } + throw new Exception("TimeOutOccured"); + } + + private WorkflowResponse buildTimeoutResponse(String requestId) { + WorkflowResponse response = new WorkflowResponse(); + response.setMessage("Fail"); + response.setResponse("Request timedout, request id:" + requestId); + response.setMessageCode(500); + return response; + } + + private WorkflowResponse buildUnkownError(String requestId,String error) { + WorkflowResponse response = new WorkflowResponse(); + response.setMessage(error); + response.setResponse("UnknownError, request id:" + requestId); + response.setMessageCode(500); + return response; + } + + private WorkflowResponse buildResponse(WorkflowContext foundContext) { + return foundContext.getWorkflowResponse(); + } + + protected static String getOrCreate(Map inputVariables, String key) { + String value = Objects.toString(inputVariables.get(key), null); + if (value == null) { + value = UUID.randomUUID().toString(); + inputVariables.put(key, value); + } + return value; + } + + // Note: the business key is used to identify the process in unit tests + protected static String getBusinessKey(Map inputVariables) { + return getOrCreate(inputVariables, "mso-business-key"); + } + + protected static String getRequestId(Map inputVariables) { + return getOrCreate(inputVariables, "mso-request-id"); + } + + + + protected void recordEvents(String processKey, WorkflowResponse response, + long startTime) { + + msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + response.getMessage() + " for processKey: " + + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null); + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + response.getMessage() + "for processKey: " + processKey + " with response: " + response.getResponse()); + + } + + protected static void setLogContext(String processKey, + Map inputVariables) { + MsoLogger.setServiceName("MSO." + processKey); + if (inputVariables != null) { + MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"serviceInstanceId")); + } + } + + protected static String getKeyValueFromInputVariables(Map inputVariables, String key) { + if (inputVariables == null) { + return ""; + } + + return Objects.toString(inputVariables.get(key), "N/A"); + } + + protected boolean isProcessEnded(String processInstanceId) { + ProcessEngineServices pes = getProcessEngineServices(); + return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null; + } + + protected static Map getInputVariables(VariableMapImpl variableMap) { + Map inputVariables = new HashMap<>(); + @SuppressWarnings("unchecked") + Map vMap = (Map) variableMap.get("variables"); + for (Map.Entry entry : vMap.entrySet()) { + String vName = entry.getKey(); + Object value = entry.getValue(); + @SuppressWarnings("unchecked") + Map valueMap = (Map)value; // value, type + inputVariables.put(vName, valueMap.get("value")); + } + return inputVariables; + } + + + protected long getWaitTime(Map inputVariables) + { + + String timeout = Objects.toString(inputVariables.get("mso-service-request-timeout"), null); + + if (timeout != null) { + try { + return Long.parseLong(timeout)*1000; + } catch (NumberFormatException nex) { + msoLogger.debug("Invalid input for mso-service-request-timeout"); + } + } + + return DEFAULT_WAIT_TIME; + } + + + + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java new file mode 100644 index 0000000000..02cda8009f --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java @@ -0,0 +1,124 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.workflow.service; + +import java.util.HashMap; +import java.util.Map; + +import javax.ws.rs.Consumes; +import javax.ws.rs.HeaderParam; +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.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError; +import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult; +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 io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * Generalized REST interface that injects a message event into a waiting BPMN process. + * Examples: + *
+ *     /WorkflowMessage/SDNCAResponse/6d10d075-100c-42d0-9d84-a52432681cae-1478486185286
+ *     /WorkflowMessage/SDNCAEvent/USOSTCDALTX0101UJZZ01
+ * 
+ */ +@Path("/") +@Api(description = "Provides a generic service to inject messages into a waiting BPMN Proccess") +@Component +public class WorkflowMessageResource{ + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowMessageResource.class); + private static final String LOGMARKER = "[WORKFLOW-MESSAGE]"; + + @Autowired + CallbackHandlerService callback; + + @POST + @Path("/WorkflowMessage/{messageType}/{correlator}") + @ApiOperation( + value = "Workflow message correlator", + notes = "" + ) + @Consumes("*/*") + @Produces(MediaType.TEXT_PLAIN) + public Response deliver( + @HeaderParam("Content-Type") String contentType, + @PathParam("messageType") String messageType, + @PathParam("correlator") String correlator, + String message) { + + String method = "receiveWorkflowMessage"; + MsoLogger.setServiceName("MSO." + method); + MsoLogger.setLogContext(correlator, "N/A"); + + LOGGER.debug(LOGMARKER + " Received workflow message" + + " type='" + messageType + "'" + + " correlator='" + correlator + "'" + + (contentType == null ? "" : " contentType='" + contentType + "'") + + " message=" + System.lineSeparator() + message); + + if (messageType == null || messageType.isEmpty()) { + String msg = "Missing message type"; + LOGGER.debug(LOGMARKER + " " + msg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg); + return Response.status(400).entity(msg).build(); + } + + if (correlator == null || correlator.isEmpty()) { + String msg = "Missing correlator"; + LOGGER.debug(LOGMARKER + " " + msg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg); + return Response.status(400).entity(msg).build(); + } + + String messageEventName = "WorkflowMessage"; + String messageVariable = messageType + "_MESSAGE"; + String correlationVariable = messageType + "_CORRELATOR"; + String correlationValue = correlator; + String contentTypeVariable = messageType + "_CONTENT_TYPE"; + + Map variables = new HashMap<>(); + + if (contentType != null) { + variables.put(contentTypeVariable, contentType); + } + + CallbackResult result = callback.handleCallback(method, message, messageEventName, + messageVariable, correlationVariable, correlationValue, LOGMARKER, variables); + + if (result instanceof CallbackError) { + return Response.status(500).entity(((CallbackError)result).getErrorMessage()).build(); + } else { + return Response.status(204).build(); + } + } +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java new file mode 100644 index 0000000000..edc05afba2 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java @@ -0,0 +1,155 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.workflow.service; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse; +import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder; +import org.onap.so.logger.MsoLogger; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +@Service +public class WorkflowProcessor extends ProcessEngineAwareService { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowProcessor.class); + + protected static final String logMarker = "[WRKFLOW-RESOURCE]"; + protected static final long DEFAULT_WAIT_TIME = 30000; //default wait time + + @Async + public void startProcess( String processKey, VariableMapImpl variableMap) throws InterruptedException + { + MDC.getCopyOfContextMap(); + long startTime = System.currentTimeMillis(); + Map inputVariables = null; + String processInstanceId = null; + try { + inputVariables = getInputVariables(variableMap); + setLogContext(processKey, inputVariables); + + // This variable indicates that the flow was invoked asynchronously + inputVariables.put("isAsyncProcess", "true"); + + + setLogContext(processKey, inputVariables); + + // Note: this creates a random businessKey if it wasn't specified. + String businessKey = getBusinessKey(inputVariables); + + msoLogger.debug("***Received MSO startProcessInstanceByKey with processKey: " + processKey + + " and variables: " + inputVariables); + + RuntimeService runtimeService = getProcessEngineServices().getRuntimeService(); + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processKey, businessKey, + inputVariables); + processInstanceId = processInstance.getId(); + + msoLogger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " " + + (processInstance.isEnded() ? "ENDED" : "RUNNING")); + } catch (Exception e) { + + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, + logMarker + "Error in starting the process: " + e.getMessage()); + + WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse(); + callbackResponse.setStatusCode(500); + callbackResponse.setMessage("Fail"); + callbackResponse.setResponse("Error occurred while executing the process: " + e); + + WorkflowContextHolder.getInstance().processCallback(processKey, processInstanceId, + getRequestId(inputVariables), callbackResponse); + } + } + + protected static void setLogContext(String processKey, + Map inputVariables) { + MsoLogger.setServiceName("MSO." + processKey); + if (inputVariables != null) { + MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"mso-service-instance-id")); + } + } + + protected static String getKeyValueFromInputVariables(Map inputVariables, String key) { + if (inputVariables == null) { + return ""; + } + + return Objects.toString(inputVariables.get(key), "N/A"); + } + + // Note: the business key is used to identify the process in unit tests + protected static String getBusinessKey(Map inputVariables) { + return getOrCreate(inputVariables, "mso-business-key"); + } + + protected static String getRequestId(Map inputVariables) { + return getOrCreate(inputVariables, "mso-request-id"); + } + + protected static Map getInputVariables(VariableMapImpl variableMap) { + Map inputVariables = new HashMap<>(); + @SuppressWarnings("unchecked") + Map vMap = (Map) variableMap.get("variables"); + for (Map.Entry entry : vMap.entrySet()) { + String vName = entry.getKey(); + Object value = entry.getValue(); + @SuppressWarnings("unchecked") + Map valueMap = (Map)value; // value, type + inputVariables.put(vName, valueMap.get("value")); + } + return inputVariables; + } + + protected static String getOrCreate(Map inputVariables, String key) { + String value = Objects.toString(inputVariables.get(key), null); + if (value == null) { + value = UUID.randomUUID().toString(); + inputVariables.put(key, value); + } + return value; + } + + protected long getWaitTime(Map inputVariables) + { + + String timeout = Objects.toString(inputVariables.get("mso-service-request-timeout"), null); + + if (timeout != null) { + try { + return Long.parseLong(timeout)*1000; + } catch (NumberFormatException nex) { + msoLogger.debug("Invalid input for mso-service-request-timeout"); + } + } + + return DEFAULT_WAIT_TIME; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java new file mode 100644 index 0000000000..c2a7f41140 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java @@ -0,0 +1,630 @@ +/*- + * ============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.bpmn.common.workflow.service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicLong; + +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.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +import org.camunda.bpm.engine.HistoryService; +import org.camunda.bpm.engine.ProcessEngineException; +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.history.HistoricVariableInstance; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.variable.VariableMap; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.slf4j.MDC; +import org.springframework.stereotype.Component; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +@Path("/workflow") +@Api(value = "/workflow", description = "Root of workflow services") +@Component +public class WorkflowResource extends ProcessEngineAwareService { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowResource.class); + private static final String LOGMARKER = "[WRKFLOW-RESOURCE]"; + + private static final int DEFAULT_WAIT_TIME = 30000; + + @Context + private UriInfo uriInfo = null; + + /** + * Starts the process instance and responds to client synchronously + * If the request does not contain mso-service-request-timeout then it waits for the value specified in DEFAULT_WAIT_TIME + * Note: value specified in mso-service-request-timeout is in seconds + * During polling time, if there is an exception encountered in the process execution then polling is stopped and the error response is + * returned to the client + * @param processKey + * @param variableMap + * @return + */ + @POST + @Path("/services/{processKey}") + @ApiOperation( + value = "Starts a new process with the appropriate process synchronously", + notes = "d" + ) + @Produces("application/json") + @Consumes("application/json") + public Response startProcessInstanceByKey(@PathParam("processKey") String processKey, + VariableMapImpl variableMap) { + + Map inputVariables = getInputVariables(variableMap); + setLogContext(processKey, inputVariables); + + WorkflowResponse workflowResponse = new WorkflowResponse(); + long startTime = System.currentTimeMillis(); + ProcessInstance processInstance = null; + + try { + //Kickoff the process + ProcessThread thread = new ProcessThread(inputVariables,processKey,msoLogger); + thread.start(); + + Map responseMap = null; + + //wait for process to be completed + long waitTime = getWaitTime(inputVariables); + long now = System.currentTimeMillis(); + long start = now; + long endTime = start + waitTime; + long pollingInterval = 500; + + // TEMPORARY LOGIC FOR UNIT TEST REFACTORING + // If this is a unit test (method is invoked directly), wait a max + // of 5 seconds after process ended for a result. In production, + // wait up to 60 seconds. + long timeToWaitAfterProcessEnded = uriInfo == null ? 5000 : 60000; + AtomicLong timeProcessEnded = new AtomicLong(0); + boolean endedWithNoResponse = false; + + while (now <= endTime) { + Thread.sleep(pollingInterval); + + now = System.currentTimeMillis(); + + // Increase the polling interval over time + + long elapsed = now - start; + + if (elapsed > 60000) { + pollingInterval = 5000; + } else if (elapsed > 10000) { + pollingInterval = 1000; + } + Exception exception = thread.getException(); + if (exception != null) { + throw new Exception(exception); + } + + processInstance = thread.getProcessInstance(); + + if (processInstance == null) { + msoLogger.debug(LOGMARKER + processKey + " process has not been created yet"); + continue; + } + + String processInstanceId = processInstance.getId(); + workflowResponse.setProcessInstanceID(processInstanceId); + + responseMap = getResponseMap(processInstance, processKey, timeProcessEnded); + + if (responseMap == null) { + msoLogger.debug(LOGMARKER + processKey + " has not produced a response yet"); + + if (timeProcessEnded.longValue() != 0) { + long elapsedSinceEnded = System.currentTimeMillis() - timeProcessEnded.longValue(); + + if (elapsedSinceEnded > timeToWaitAfterProcessEnded) { + endedWithNoResponse = true; + break; + } + } + } else { + processResponseMap(workflowResponse, responseMap); + recordEvents(processKey, workflowResponse, startTime); + return Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build(); + } + } + + //if we dont get response after waiting then send timeout response + + String state; + String processInstanceId; + + if (processInstance == null) { + processInstanceId = "N/A"; + state = "NOT STARTED"; + } else { + processInstanceId = processInstance.getProcessInstanceId(); + state = isProcessEnded(processInstanceId) ? "ENDED" : "NOT ENDED"; + } + + workflowResponse.setMessage("Fail"); + if (endedWithNoResponse) { + workflowResponse.setResponse("Process ended without producing a response"); + } else { + workflowResponse.setResponse("Request timed out, process state: " + state); + } + workflowResponse.setProcessInstanceID(processInstanceId); + recordEvents(processKey, workflowResponse, startTime); + workflowResponse.setMessageCode(500); + return Response.status(500).entity(workflowResponse).build(); + } catch (Exception ex) { + msoLogger.debug(LOGMARKER + "Exception in startProcessInstance by key",ex); + workflowResponse.setMessage("Fail" ); + workflowResponse.setResponse("Error occurred while executing the process: " + ex.getMessage()); + if (processInstance != null) workflowResponse.setProcessInstanceID(processInstance.getId()); + + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), + MsoLogger.ErrorCode.UnknownError, LOGMARKER + workflowResponse.getMessage() + + " for processKey: " + processKey + " with response: " + workflowResponse.getResponse()); + + workflowResponse.setMessageCode(500); + recordEvents(processKey, workflowResponse, startTime); + return Response.status(500).entity(workflowResponse).build(); + } + } + + /** + * Returns the wait time, this is used by the resource on how long it should wait to send a response + * If none specified DEFAULT_WAIT_TIME is used + * @param inputVariables + * @return + */ + private int getWaitTime(Map inputVariables) + { + String timeout = inputVariables.get("mso-service-request-timeout") == null + ? null : inputVariables.get("mso-service-request-timeout").toString(); + + if (timeout != null) { + try { + return Integer.parseInt(timeout)*1000; + } catch (NumberFormatException nex) { + msoLogger.debug("Invalid input for mso-service-request-timeout"); + } + } + return DEFAULT_WAIT_TIME; + } + + private void recordEvents(String processKey, WorkflowResponse response, long startTime) { + + msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + LOGMARKER + response.getMessage() + " for processKey: " + + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null); + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + LOGMARKER + response.getMessage() + " for processKey: " + + processKey + " with response: " + response.getResponse()); + } + + private void setLogContext(String processKey, Map inputVariables) { + MsoLogger.setServiceName("MSO." + processKey); + if (inputVariables != null) { + MsoLogger.setLogContext(getValueFromInputVariables(inputVariables, "mso-request-id"), + getValueFromInputVariables(inputVariables, "mso-service-instance-id")); + } + } + + private String getValueFromInputVariables(Map inputVariables, String key) { + Object value = inputVariables.get(key); + if (value == null) { + return "N/A"; + } else { + return value.toString(); + } + } + + /** + * Checks to see if the specified process is ended. + * @param processInstanceId the process instance ID + * @return true if the process is ended + */ + private boolean isProcessEnded(String processInstanceId) { + ProcessEngineServices pes = getProcessEngineServices(); + try { + return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ; + } catch (Exception e) { + msoLogger.debug("Exception :",e); + return true; + } + } + + private void processResponseMap(WorkflowResponse workflowResponse, Map responseMap) { + Object object = responseMap.get("Response"); + String response = object == null ? null : String.valueOf(object); + if(response == null){ + object = responseMap.get("WorkflowResponse"); + response = object == null ? null : String.valueOf(object); + } + + workflowResponse.setResponse(response); + + object = responseMap.get("ResponseCode"); + String responseCode = object == null ? null : String.valueOf(object); + + try { + workflowResponse.setMessageCode(Integer.parseInt(responseCode)); + } catch(NumberFormatException nex) { + msoLogger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode); + workflowResponse.setMessageCode(-1); + } + + Object status = responseMap.get("Status"); + + if ("Success".equalsIgnoreCase(String.valueOf(status))) { + workflowResponse.setMessage("Success"); + } else if ("Fail".equalsIgnoreCase(String.valueOf(status))) { + workflowResponse.setMessage("Fail"); + } else { + msoLogger.debug(LOGMARKER + "Unrecognized Status: " + responseCode); + workflowResponse.setMessage("Fail"); + } + } + + /** + * @version 1.0 + * Triggers the workflow in a separate thread + */ + private class ProcessThread extends Thread { + private final Map inputVariables; + private final String processKey; + private final MsoLogger msoLogger; + private final String businessKey; + private ProcessInstance processInstance = null; + private Exception exception = null; + + public ProcessThread(Map inputVariables, String processKey, MsoLogger msoLogger) { + this.inputVariables = inputVariables; + this.processKey = processKey; + this.msoLogger = msoLogger; + this.businessKey = UUID.randomUUID().toString(); + } + + /** + * If an exception occurs when starting the process instance, it may + * be obtained by calling this method. Note that exceptions are only + * recorded while the process is executing in its original thread. + * Once a process is suspended, exception recording stops. + * @return the exception, or null if none has occurred + */ + public Exception getException() { + return exception; + } + + + public ProcessInstance getProcessInstance() { + return this.processInstance; + } + + /** + * Sets the process instance exception. + * @param exception the exception + */ + private void setException(Exception exception) { + this.exception = exception; + } + + public void run() { + setLogContext(processKey, inputVariables); + + long startTime = System.currentTimeMillis(); + + try { + msoLogger.debug(LOGMARKER + "***Received MSO startProcessInstanceByKey with processKey:" + + processKey + " and variables: " + inputVariables); + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER + + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with" + + " processKey:" + processKey + + " businessKey:" + businessKey + + " variables: " + inputVariables); + + RuntimeService runtimeService = getProcessEngineServices().getRuntimeService(); + + // Note that this method doesn't return until the process suspends + // itself or finishes. We provide a business key so we can identify + // the process instance immediately. + processInstance = runtimeService.startProcessInstanceByKey( + processKey, inputVariables); + + } catch (Exception e) { + msoLogger.debug(LOGMARKER + "ProcessThread caught an exception executing " + + processKey + ": " + e); + setException(e); + } + } + + } + + private Map getInputVariables(VariableMapImpl variableMap) { + VariableMap inputVariables = Variables.createVariables(); + @SuppressWarnings("unchecked") + Map vMap = (Map) variableMap.get("variables"); + for (String key : vMap.keySet()) { //variabe name vn + @SuppressWarnings("unchecked") + Map valueMap = (Map)vMap.get(key); //value, type + inputVariables.putValueTyped(key, Variables + .objectValue(valueMap.get("value")) + .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value + .create()); + } + return inputVariables; + } + + /** + * Attempts to get a response map from the specified process instance. + * @return the response map, or null if it is unavailable + */ + private Map getResponseMap(ProcessInstance processInstance, + String processKey, AtomicLong timeProcessEnded) { + + String responseMapVariable = processKey + "ResponseMap"; + String processInstanceId = processInstance.getId(); + + // Query the runtime service to see if a response map is ready. + +/* RuntimeService runtimeService = getProcessEngineServices().getRuntimeService(); + List executions = runtimeService.createExecutionQuery() + .processInstanceId(processInstanceId).list(); + + for (Execution execution : executions) { + @SuppressWarnings("unchecked") + Map responseMap = (Map) + getVariableFromExecution(runtimeService, execution.getId(), + responseMapVariable); + + if (responseMap != null) { + msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable + + " from process " + processInstanceId + " execution " + + execution.getId()); + return responseMap; + } + } +*/ + //Querying history seem to return consistent results compared to querying the runtime service + + boolean alreadyEnded = timeProcessEnded.longValue() != 0; + + if (alreadyEnded || isProcessEnded(processInstance.getId())) { + if (!alreadyEnded) { + timeProcessEnded.set(System.currentTimeMillis()); + } + + // Query the history service to see if a response map exists. + + HistoryService historyService = getProcessEngineServices().getHistoryService(); + @SuppressWarnings("unchecked") + Map responseMap = (Map) + getVariableFromHistory(historyService, processInstance.getId(), + responseMapVariable); + + if (responseMap != null) { + msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable + + " from process " + processInstanceId + " history"); + return responseMap; + } + + // Query the history service for old-style response variables. + + String prefix = (String) getVariableFromHistory(historyService, processInstanceId, "prefix"); + + if (prefix != null) { + + // Check for 'WorkflowResponse' variable + Object workflowResponseObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowResponse"); + String workflowResponse = workflowResponseObject == null ? null : String.valueOf(workflowResponseObject); + msoLogger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse); + + if (workflowResponse != null) { + Object responseCodeObject = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); + String responseCode = responseCodeObject == null ? null : String.valueOf(responseCodeObject); + msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); + responseMap = new HashMap<>(); + responseMap.put("WorkflowResponse", workflowResponse); + responseMap.put("ResponseCode", responseCode); + responseMap.put("Status", "Success"); + return responseMap; + } + + + // Check for 'WorkflowException' variable + WorkflowException workflowException = null; + String workflowExceptionText = null; + + Object workflowExceptionObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowException"); + if(workflowExceptionObject != null) { + if(workflowExceptionObject instanceof WorkflowException) { + workflowException = (WorkflowException) workflowExceptionObject; + workflowExceptionText = workflowException.toString(); + responseMap = new HashMap<>(); + responseMap.put("WorkflowException", workflowExceptionText); + responseMap.put("ResponseCode", workflowException.getErrorCode()); + responseMap.put("Status", "Fail"); + return responseMap; + } + else if (workflowExceptionObject instanceof String) { + Object object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); + String responseCode = object == null ? null : String.valueOf(object); + workflowExceptionText = (String) workflowExceptionObject; + responseMap = new HashMap<>(); + responseMap.put("WorkflowException", workflowExceptionText); + responseMap.put("ResponseCode", responseCode); + responseMap.put("Status", "Fail"); + return responseMap; + } + + } + msoLogger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText); + + // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE + Object object = getVariableFromHistory(historyService, processInstanceId, processKey + "Response"); + String response = object == null ? null : String.valueOf(object); + msoLogger.debug(LOGMARKER + processKey + "Response: " + response); + + if (response != null) { + object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); + String responseCode = object == null ? null : String.valueOf(object); + msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); + responseMap = new HashMap<>(); + responseMap.put("Response", response); + responseMap.put("ResponseCode", responseCode); + responseMap.put("Status", "Success"); + return responseMap; + } + + object = getVariableFromHistory(historyService, processInstanceId, prefix + "ErrorResponse"); + String errorResponse = object == null ? null : String.valueOf(object); + msoLogger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse); + + if (errorResponse != null) { + object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); + String responseCode = object == null ? null : String.valueOf(object); + msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); + responseMap = new HashMap<>(); + responseMap.put("Response", errorResponse); + responseMap.put("ResponseCode", responseCode); + responseMap.put("Status", "Fail"); + return responseMap; + } + // END LEGACY SUPPORT. TODO: REMOVE THIS CODE + } + } + return null; + } + + /** + * Gets a variable value from the specified execution. + * @return the variable value, or null if the variable could not be + * obtained + */ + private Object getVariableFromExecution(RuntimeService runtimeService, + String executionId, String variableName) { + try { + return runtimeService.getVariable(executionId, variableName); + } catch (ProcessEngineException e) { + // Most likely cause is that the execution no longer exists. + msoLogger.debug("Error retrieving execution " + executionId + + " variable " + variableName + ": " + e); + return null; + } + } + /** + * Gets a variable value from specified historical process instance. + * @return the variable value, or null if the variable could not be + * obtained + */ + private Object getVariableFromHistory(HistoryService historyService, + String processInstanceId, String variableName) { + try { + HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery() + .processInstanceId(processInstanceId).variableName(variableName).singleResult(); + return v == null ? null : v.getValue(); + } catch (Exception e) { + msoLogger.debug("Error retrieving process " + processInstanceId + + " variable " + variableName + " from history: " + e); + return null; + } + } + + @POST + @Path("/services/{processKey}/{processInstanceId}") + @Produces("application/json") + @Consumes("application/json") + @ApiOperation( + value = "Allows for retrieval of the variables for a given process", + notes = "" + ) + public WorkflowResponse getProcessVariables(@PathParam("processKey") String processKey, @PathParam("processInstanceId") String processInstanceId) { + //TODO filter only set of variables + WorkflowResponse response = new WorkflowResponse(); + + long startTime = System.currentTimeMillis(); + try { + ProcessEngineServices engine = getProcessEngineServices(); + List variables = engine.getHistoryService().createHistoricVariableInstanceQuery().processInstanceId(processInstanceId).list(); + Map variablesMap = new HashMap<>(); + for (HistoricVariableInstance variableInstance: variables) { + variablesMap.put(variableInstance.getName(), variableInstance.getValue().toString()); + } + + msoLogger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey + " and variables: " + variablesMap.toString()); + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER + + "Call to MSO workflow/services in Camunda. Received MSO getProcessVariables with processKey:" + + processKey + " and variables: " + + variablesMap.toString()); + + + response.setVariables(variablesMap); + response.setMessage("Success"); + response.setResponse("Successfully retrieved the variables"); + response.setProcessInstanceID(processInstanceId); + + msoLogger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response.getResponse()); + } catch (Exception ex) { + response.setMessage("Fail"); + response.setResponse("Failed to retrieve the variables," + ex.getMessage()); + response.setProcessInstanceID(processInstanceId); + + msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), MsoLogger.ErrorCode.UnknownError, LOGMARKER + + response.getMessage() + + " for processKey: " + + processKey + + " with response: " + + response.getResponse()); + msoLogger.debug("Exception :",ex); + } + + msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + LOGMARKER + response.getMessage() + " for processKey: " + + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null); + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + LOGMARKER + response.getMessage() + " for processKey: " + + processKey + " with response: " + response.getResponse()); + + return response; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java new file mode 100644 index 0000000000..00ee6eb235 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java @@ -0,0 +1,353 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.plugins; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.concurrent.ConcurrentHashMap; + +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.ExecutionListener; +import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener; +import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener; +import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.camunda.bpm.engine.impl.context.Context; +import org.camunda.bpm.engine.impl.interceptor.Command; +import org.camunda.bpm.engine.impl.interceptor.CommandContext; +import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity; +import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl; +import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl; +import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl; +import org.camunda.bpm.engine.impl.util.xml.Element; +import org.camunda.bpm.engine.impl.variable.VariableDeclaration; +import org.camunda.bpm.model.bpmn.impl.instance.FlowNodeImpl; +import org.camunda.bpm.model.bpmn.instance.EndEvent; +import org.camunda.bpm.model.bpmn.instance.FlowNode; +import org.camunda.bpm.model.bpmn.instance.StartEvent; +import org.onap.so.bpmn.core.BPMNLogger; + + +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.AbstractEnvironment; +import org.springframework.core.env.Environment; +import org.springframework.core.env.MapPropertySource; +import org.springframework.core.env.PropertySource; +import org.springframework.stereotype.Component; + + + +/** + * Plugin for MSO logging and URN mapping. + */ +@Component +public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { + private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, LoggingAndURNMappingPlugin.class); + private static final String FSPROPKEY = "URNMapping.FileSystemLoading.Enabled"; + + @Autowired + private LoggingParseListener loggingParseListener; + + @Override + public void preInit( + ProcessEngineConfigurationImpl processEngineConfiguration) { + List preParseListeners = processEngineConfiguration + .getCustomPreBPMNParseListeners(); + if (preParseListeners == null) { + preParseListeners = new ArrayList<>(); + processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners); + } + preParseListeners.add(loggingParseListener); + } + + /** + * Called when a process flow is parsed so we can inject listeners. + */ + @Component + public class LoggingParseListener extends AbstractBpmnParseListener { + + + private void injectLogExecutionListener(ActivityImpl activity) { + activity.addListener( + ExecutionListener.EVENTNAME_END, + new LoggingExecutionListener("END")); + + activity.addListener( + ExecutionListener.EVENTNAME_START, + new LoggingExecutionListener("START")); + + activity.addListener( + ExecutionListener.EVENTNAME_TAKE, + new LoggingExecutionListener("TAKE")); + } + + @Override + public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) { + } + + @Override + public void parseStartEvent(Element startEventElement, ScopeImpl scope, ActivityImpl startEventActivity) { + // Inject these listeners only on the main start event for the flow, not on any embedded subflow start events + + injectLogExecutionListener(startEventActivity); + } + + @Override + public void parseServiceTask(Element serviceTaskElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseExclusiveGateway(Element exclusiveGwElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseInclusiveGateway(Element inclusiveGwElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseParallelGateway(Element parallelGwElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseScriptTask(Element scriptTaskElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseBusinessRuleTask(Element businessRuleTaskElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseTask(Element taskElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseManualTask(Element manualTaskElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseEndEvent(Element endEventElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseBoundaryTimerEventDefinition(Element timerEventDefinition, boolean interrupting, ActivityImpl timerActivity) { + injectLogExecutionListener(timerActivity); + } + + @Override + public void parseBoundaryErrorEventDefinition(Element errorEventDefinition, boolean interrupting, ActivityImpl activity, ActivityImpl nestedErrorEventActivity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseSubProcess(Element subProcessElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseCallActivity(Element callActivityElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseProperty(Element propertyElement, VariableDeclaration variableDeclaration, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseSequenceFlow(Element sequenceFlowElement, ScopeImpl scopeElement, TransitionImpl transition) { + //injectLogExecutionListener(activity); + } + + @Override + public void parseSendTask(Element sendTaskElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseMultiInstanceLoopCharacteristics(Element activityElement, Element multiInstanceLoopCharacteristicsElement, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseIntermediateTimerEventDefinition(Element timerEventDefinition, ActivityImpl timerActivity) { + injectLogExecutionListener(timerActivity); + } + + @Override + public void parseRootElement(Element rootElement, List processDefinitions) { + //injectLogExecutionListener(activity); + } + + @Override + public void parseReceiveTask(Element receiveTaskElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseIntermediateSignalCatchEventDefinition(Element signalEventDefinition, ActivityImpl signalActivity) { + injectLogExecutionListener(signalActivity); + } + + @Override + public void parseBoundarySignalEventDefinition(Element signalEventDefinition, boolean interrupting, ActivityImpl signalActivity) { + injectLogExecutionListener(signalActivity); + } + + @Override + public void parseEventBasedGateway(Element eventBasedGwElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseTransaction(Element transactionElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseCompensateEventDefinition(Element compensateEventDefinition, ActivityImpl compensationActivity) { + injectLogExecutionListener(compensationActivity); + } + + @Override + public void parseIntermediateThrowEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseIntermediateCatchEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseBoundaryEvent(Element boundaryEventElement, ScopeImpl scopeElement, ActivityImpl nestedActivity) { + injectLogExecutionListener(nestedActivity); + } + + @Override + public void parseIntermediateMessageCatchEventDefinition(Element messageEventDefinition, ActivityImpl nestedActivity) { + injectLogExecutionListener(nestedActivity); + } + + @Override + public void parseBoundaryMessageEventDefinition(Element element, boolean interrupting, ActivityImpl messageActivity) { + injectLogExecutionListener(messageActivity); + } + } + + /** + * Logs details about the current activity. + */ + public class LoggingExecutionListener implements ExecutionListener { + private final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,LoggingExecutionListener.class); + + private String event; + + public LoggingExecutionListener() { + this.event = ""; + } + + public LoggingExecutionListener(String event) { + this.event = event; + } + + public String getEvent() { + return event; + } + + @Override + public void notify(DelegateExecution execution) throws Exception { + logger.trace("Logging for activity---------------:" + event + ":" + + execution.getCurrentActivityName() + + ", processDefinitionId=" + + execution.getProcessDefinitionId() + ", activtyId=" + + execution.getCurrentActivityId() + ", activtyName='" + + execution.getCurrentActivityName() + "'" + + ", processInstanceId=" + + execution.getProcessInstanceId() + ", businessKey=" + + execution.getProcessBusinessKey() + ", executionId=" + + execution.getId()); + //required for legacy groovy processing in camunda + execution.setVariable("isDebugLogEnabled", "true"); + if (!isBlank(execution.getCurrentActivityName())) { + try { + + String id = execution.getId(); + if (id != null ) { + RepositoryService repositoryService = execution.getProcessEngineServices().getRepositoryService(); + String processName = repositoryService.createProcessDefinitionQuery() + .processDefinitionId(execution.getProcessDefinitionId()) + .singleResult() + .getName(); + + if (execution.getBpmnModelElementInstance() instanceof StartEvent) { + logger.debug("Starting process: " + processName); + } + if (execution.getBpmnModelElementInstance() instanceof EndEvent) { + logger.debug("Ending process: " + processName); + } + + String serviceName = MDC.get(MsoLogger.SERVICE_NAME); + + if(serviceName != null && !serviceName.contains(processName)) + MsoLogger.setServiceName( serviceName + "." + processName); + else if(serviceName == null) + MsoLogger.setServiceName(processName); + + String requestId = (String) execution.getVariable("mso-request-id"); + String svcid = (String) execution.getVariable("mso-service-instance-id"); + MsoLogger.setLogContext(requestId, svcid); + } + } catch(Exception e) { + logger.error(e); + } + } + } + + private boolean isBlank(Object object) { + return object == null || "".equals(object.toString().trim()); + } + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java new file mode 100644 index 0000000000..9b8f6cd5cc --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java @@ -0,0 +1,172 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.plugins; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.ExecutionListener; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.camunda.bpm.engine.impl.bpmn.behavior.ClassDelegateActivityBehavior; +import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener; +import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener; +import org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration; +import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity; +import org.camunda.bpm.engine.impl.pvm.PvmTransition; +import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl; +import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl; +import org.camunda.bpm.engine.impl.util.xml.Element; + +import org.onap.so.bpmn.core.BPMNLogger; +import org.onap.so.bpmn.core.WorkflowException; +import org.springframework.stereotype.Component; + +/** + * This plugin does the following: + *
    + *
  1. + * Adds logic at the start of every Call Activity to remove any existing + * WorkflowException object from the execution (saving a copy of it in a + * different variable). + *
  2. + *
  3. + * Adds logic at the end of every Call Activity to generate a MSOWorkflowException + * event if there is a WorkflowException object in the execution. + *
  4. + *
+ */ +@Component +public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { + + @Override + public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) { + List preParseListeners = + processEngineConfiguration.getCustomPreBPMNParseListeners(); + + if (preParseListeners == null) { + preParseListeners = new ArrayList<>(); + processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners); + } + + preParseListeners.add(new WorkflowExceptionParseListener()); + } + + public static class WorkflowExceptionParseListener extends AbstractBpmnParseListener { + @Override + public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) { + AtomicInteger triggerTaskIndex = new AtomicInteger(1); + List activities = new ArrayList<>(processDefinition.getActivities()); + recurse(activities, triggerTaskIndex); + } + + /** + * Helper method that recurses (into subprocesses) over all the listed activities. + * @param activities a list of workflow activities + * @param triggerTaskIndex the index of the next trigger task (mutable) + */ + private void recurse(List activities, AtomicInteger triggerTaskIndex) { + for (ActivityImpl activity : activities) { + String type = (String) activity.getProperty("type"); + + if ("callActivity".equals(type)) { + // Add a WorkflowExceptionResetListener to clear the WorkflowException + // variable when each Call Activity starts. + + activity.addListener( + ExecutionListener.EVENTNAME_START, + new WorkflowExceptionResetListener()); + + // Add a WorkflowExceptionTriggerTask after the call activity. + // It must be a task because a listener cannot be used to generate + // an event. Throwing BpmnError from an execution listener will + // cause the process to die. + + List outTransitions = + new ArrayList<>(activity.getOutgoingTransitions()); + + for (PvmTransition transition : outTransitions) { + String triggerTaskId = "WorkflowExceptionTriggerTask_" + triggerTaskIndex; + + ActivityImpl triggerTask = activity.getFlowScope().createActivity(triggerTaskId); + + ClassDelegateActivityBehavior behavior = new ClassDelegateActivityBehavior( + WorkflowExceptionTriggerTask.class.getName(), + new ArrayList<>(0)); + + triggerTask.setActivityBehavior(behavior); + triggerTask.setName("Workflow Exception Trigger Task " + triggerTaskIndex); + triggerTaskIndex.getAndIncrement(); + + TransitionImpl transitionImpl = (TransitionImpl) transition; + TransitionImpl triggerTaskOutTransition = triggerTask.createOutgoingTransition(); + triggerTaskOutTransition.setDestination((ActivityImpl)transitionImpl.getDestination()); + transitionImpl.setDestination(triggerTask); + } + } else if ("subProcess".equals(type)) { + recurse(new ArrayList<>(activity.getActivities()), triggerTaskIndex); + } + } + } + } + + /** + * If there is a WorkflowException object in the execution, this method + * removes it (saving a copy of it in a different variable). + */ + public static class WorkflowExceptionResetListener implements ExecutionListener { + public void notify(DelegateExecution execution) throws Exception { + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + int index = 1; + String saveName = "SavedWorkflowException" + index; + while (execution.getVariable(saveName) != null) { + saveName = "SavedWorkflowException" + (++index); + } + + BPMNLogger.debug((String)execution.getVariable("isDebugLogEnabled"), + "WorkflowExceptionResetTask is moving WorkflowException to " + saveName); + + execution.setVariable(saveName, workflowException); + execution.setVariable("WorkflowException", null); + } + } + } + + /** + * Generates an MSOWorkflowException event if there is a WorkflowException + * object in the execution. + */ + public static class WorkflowExceptionTriggerTask implements JavaDelegate { + public void execute(DelegateExecution execution) throws Exception { + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + BPMNLogger.debug((String)execution.getVariable("isDebugLogEnabled"), + "WorkflowExceptionTriggerTask is generating a MSOWorkflowException event"); + throw new BpmnError("MSOWorkflowException"); + } + } + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java new file mode 100644 index 0000000000..8fe7ebe93a --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java @@ -0,0 +1,122 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure; + +import java.util.Arrays; + +import javax.xml.ws.Endpoint; + +import org.apache.cxf.Bus; +import org.apache.cxf.endpoint.Server; +import org.apache.cxf.feature.LoggingFeature; +import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; +import org.apache.cxf.jaxrs.swagger.Swagger2Feature; +import org.apache.cxf.jaxws.EndpointImpl; +import org.apache.cxf.transport.servlet.CXFServlet; +import org.onap.so.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType; +import org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify; +import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource; +import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource; +import org.onap.so.bpmn.common.workflow.service.WorkflowResource; +import org.onap.so.logger.MsoLogger; +import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + + +@Configuration +public class CXFConfiguration { + + private static final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CXFConfiguration.class); + + @Autowired + private Bus bus; + + @Autowired + private WorkflowMessageResource wmr; + + @Autowired + private WorkflowResource workflowResource; + + @Autowired + private WorkflowAsyncResource workflowAsyncResource; + + @Autowired + private JaxRsFilterLogging jaxRsFilterLogging; + + @Autowired + private ObjectMapper mapper; + + @Autowired + private SDNCCallbackAdapterPortType sdncAdapterCallbackServiceImpl; + + @Autowired + private VnfAdapterNotify vnfAdapterNotifyServiceImpl; + + @Bean + public ServletRegistrationBean cxfServlet() { + return new ServletRegistrationBean(new CXFServlet(), "/mso/*"); + } + + @Bean + public Endpoint vnfAdapterCallback() { + EndpointImpl endpoint = new EndpointImpl(bus, vnfAdapterNotifyServiceImpl); + endpoint.publish("/VNFAdaptercallback"); + return endpoint; + } + + @Bean + public Endpoint sndcAdapterCallback() { + EndpointImpl endpoint = new EndpointImpl(bus, sdncAdapterCallbackServiceImpl); + endpoint.publish("/SDNCAdapterCallbackService"); + return endpoint; + } + + @Bean + public Server rsServer() { + JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); + endpoint.setBus(bus); + endpoint.setServiceBeans(Arrays.asList(wmr, workflowResource, workflowAsyncResource)); + endpoint.setAddress("/"); + endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature())); + endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper),jaxRsFilterLogging)); + + return endpoint.create(); + } + + @Bean + public Swagger2Feature createSwaggerFeature() { + Swagger2Feature swagger2Feature= new Swagger2Feature(); + swagger2Feature.setPrettyPrint(true); + swagger2Feature.setTitle("SO Orchestration Application"); + swagger2Feature.setContact("The ONAP SO team"); + swagger2Feature.setDescription("This project is the SO Orchestration Engine"); + swagger2Feature.setVersion("1.0.0"); + swagger2Feature.setResourcePackage("org.onap.so.bpmn.common.workflow.service"); + swagger2Feature.setScan(true); + return swagger2Feature; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java new file mode 100644 index 0000000000..c263fe636c --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -0,0 +1,117 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure; + +import java.util.List; +import java.util.concurrent.Executor; + +import org.camunda.bpm.application.PostDeploy; +import org.camunda.bpm.application.PreUndeploy; +import org.camunda.bpm.application.ProcessApplicationInfo; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; +import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; +import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; +import org.onap.so.logger.MsoLogger; +import org.onap.so.requestsdb.RequestsDBHelper; +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.context.annotation.ComponentScan; +import org.springframework.context.annotation.ComponentScan.Filter; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.Primary; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +/** + * @since Version 1.0 + * + */ + +@SpringBootApplication +@EnableProcessApplication("MSO Infrastructure Application") +@EnableAsync +@ComponentScan(basePackages = { "org.onap" }, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) +public class MSOInfrastructureApplication { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, + MSOInfrastructureApplication.class); + + @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/bpmn/"); + } + } + + public static void main(String... args) { + SpringApplication.run(MSOInfrastructureApplication.class, args); + System.getProperties().setProperty("mso.config.path", "."); + setLogsDir(); + } + + @PostDeploy + public void postDeploy(ProcessEngine processEngineInstance) { + long startTime = System.currentTimeMillis(); + + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Post deployment complete..."); + } + + @PreUndeploy + public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo, + List processEngines) { + long startTime = System.currentTimeMillis(); + + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Pre Undeploy complete..."); + + } + + @Bean + @Primary + public Executor asyncExecutor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + + executor.setCorePoolSize(corePoolSize); + executor.setMaxPoolSize(maxPoolSize); + executor.setQueueCapacity(queueCapacity); + executor.setThreadNamePrefix("Camunda-"); + executor.initialize(); + return executor; + } +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java new file mode 100644 index 0000000000..ad9e210452 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java @@ -0,0 +1,52 @@ +/*- + * ============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.bpmn.infrastructure; + +import org.onap.so.security.MSOSpringFirewall; +import org.onap.so.security.WebSecurityConfig; +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 +public class WebSecurityConfigImpl extends WebSecurityConfig { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.csrf().disable() + .authorizeRequests() + .antMatchers("/manage/health","/manage/info").permitAll() + .antMatchers("/async/services/**", "/workflow/services/*", "/SDNCAdapterCallbackService", "/WorkflowMessage", "/vnfAdapterNotify", "/vnfAdapterRestNotify") + .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/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java new file mode 100644 index 0000000000..e4866f5334 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate; + +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.logger.MsoLogger; + +public class PnfCheckInputs implements JavaDelegate { + + private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, PnfCheckInputs.class); + + private String defaultTimeout; + + @Override + public void execute(DelegateExecution execution) throws Exception { + String correlationId = (String) execution.getVariable(CORRELATION_ID); + if (correlationId == null) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "correlationId variable not defined"); + } + String timeout = (String) execution.getVariable(TIMEOUT_FOR_NOTIFICATION); + if (timeout == null) { + LOGGER.debug("timeoutForPnfEntryNotification variable not found, setting default"); + if (defaultTimeout == null) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, + "default timeoutForPnfEntryNotification value not defined"); + } + execution.setVariable(TIMEOUT_FOR_NOTIFICATION, defaultTimeout); + } + } + + public void setDefaultTimeout(String defaultTimeout) { + this.defaultTimeout = defaultTimeout; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java new file mode 100644 index 0000000000..bd781756a5 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java @@ -0,0 +1,422 @@ +/*- + * ============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.bpmn.infrastructure.workflow.service; + +import java.io.IOException; +import java.net.SocketTimeoutException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.http.HttpResponse; +import org.apache.http.ParseException; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.conn.ConnectTimeoutException; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.camunda.bpm.engine.runtime.Execution; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.core.domain.ServiceDecomposition; +import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +public class ServicePluginFactory { + + // SOTN calculate route + public static final String OOF_Default_EndPoint = "http://192.168.1.223:8443/oof/sotncalc"; + + public static final String Third_SP_Default_EndPoint = "http://192.168.1.223:8443/sp/resourcemgr/querytps"; + + private static final int DEFAULT_TIME_OUT = 60000; + + static JsonUtils jsonUtil = new JsonUtils(); + + private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ServicePluginFactory.class); + + private static ServicePluginFactory instance; + + + public static synchronized ServicePluginFactory getInstance() { + if (null == instance) { + instance = new ServicePluginFactory(); + } + return instance; + } + + private String getThirdSPEndPoint(){ + return UrnPropertiesReader.getVariable("mso.service-plugin.third-sp-endpoint", Third_SP_Default_EndPoint); + } + + private String getOOFCalcEndPoint(){ + return UrnPropertiesReader.getVariable("mso.service-plugin.oof-calc-endpoint", OOF_Default_EndPoint); + } + + + public String preProcessService(ServiceDecomposition serviceDecomposition, String uuiRequest) { + + // now only for sotn + if (isSOTN(serviceDecomposition, uuiRequest)) { + // We Need to query the terminalpoint of the VPN by site location + // info + return preProcessSOTNService(serviceDecomposition, uuiRequest); + } + return uuiRequest; + } + + public String doServiceHoming(ServiceDecomposition serviceDecomposition, String uuiRequest) { + // now only for sotn + if (isSOTN(serviceDecomposition, uuiRequest)) { + return doSOTNServiceHoming(serviceDecomposition, uuiRequest); + } + return uuiRequest; + } + + private boolean isSOTN(ServiceDecomposition serviceDecomposition, String uuiRequest) { + // there should be a register platform , we check it very simple here. + return uuiRequest.contains("clientSignal") && uuiRequest.contains("vpnType"); + } + + private String preProcessSOTNService(ServiceDecomposition serviceDecomposition, String uuiRequest) { + Map uuiObject = getJsonObject(uuiRequest, Map.class); + Map serviceObject = (Map) uuiObject.get("service"); + Map serviceParametersObject = (Map) serviceObject.get("parameters"); + Map serviceRequestInputs = (Map) serviceParametersObject.get("requestInputs"); + List resources = (List) serviceParametersObject.get("resources"); + // This is a logic for demo , it could not be finalized to community. + String srcLocation = ""; + String dstLocation = ""; + String srcClientSignal = ""; + String dstClientSignal = ""; + // support R2 uuiReq and R1 uuiReq + // logic for R2 uuiRequest params in service level + for (Entry entry : serviceRequestInputs.entrySet()) { + if (entry.getKey().toLowerCase().contains("location")) { + if ("".equals(srcLocation)) { + srcLocation = (String) entry.getValue(); + } else if ("".equals(dstLocation)) { + dstLocation = (String) entry.getValue(); + } + } + if (entry.getKey().toLowerCase().contains("clientsignal")) { + if ("".equals(srcClientSignal)) { + srcClientSignal = (String) entry.getValue(); + } else if ("".equals(dstClientSignal)) { + dstClientSignal = (String) entry.getValue(); + } + } + } + + // logic for R1 uuiRequest, params in resource level + for (Object resource : resources) { + Map resourceObject = (Map) resource; + Map resourceParametersObject = (Map) resourceObject.get("parameters"); + Map resourceRequestInputs = (Map) resourceParametersObject + .get("requestInputs"); + for (Entry entry : resourceRequestInputs.entrySet()) { + if (entry.getKey().toLowerCase().contains("location")) { + if ("".equals(srcLocation)) { + srcLocation = (String) entry.getValue(); + } else if ("".equals(dstLocation)) { + dstLocation = (String) entry.getValue(); + } + } + if (entry.getKey().toLowerCase().contains("clientsignal")) { + if ("".equals(srcClientSignal)) { + srcClientSignal = (String) entry.getValue(); + } else if ("".equals(dstClientSignal)) { + dstClientSignal = (String) entry.getValue(); + } + } + } + } + + Map vpnRequestInputs = getVPNResourceRequestInputs(resources); + // here we put client signal to vpn resource inputs + vpnRequestInputs.put("src-client-signal", srcClientSignal); + vpnRequestInputs.put("dst-client-signal", dstClientSignal); + + // Now we need to query terminal points from SP resourcemgr system. + List locationTerminalPointList = queryTerminalPointsFromServiceProviderSystem(srcLocation, dstLocation); + Map tpInfoMap = (Map) locationTerminalPointList.get(0); + + serviceRequestInputs.put("inner-src-access-provider-id", tpInfoMap.get("access-provider-id")); + serviceRequestInputs.put("inner-src-access-client-id", tpInfoMap.get("access-client-id")); + serviceRequestInputs.put("inner-src-access-topology-id", tpInfoMap.get("access-topology-id")); + serviceRequestInputs.put("inner-src-access-node-id", tpInfoMap.get("access-node-id")); + serviceRequestInputs.put("inner-src-access-ltp-id", tpInfoMap.get("access-ltp-id")); + tpInfoMap = (Map) locationTerminalPointList.get(1); + + serviceRequestInputs.put("inner-dst-access-provider-id", tpInfoMap.get("access-provider-id")); + serviceRequestInputs.put("inner-dst-access-client-id", tpInfoMap.get("access-client-id")); + serviceRequestInputs.put("inner-dst-access-topology-id", tpInfoMap.get("access-topology-id")); + serviceRequestInputs.put("inner-dst-access-node-id", tpInfoMap.get("access-node-id")); + serviceRequestInputs.put("inner-dst-access-ltp-id", tpInfoMap.get("access-ltp-id")); + + String newRequest = getJsonString(uuiObject); + return newRequest; + } + + private List queryTerminalPointsFromServiceProviderSystem(String srcLocation, String dstLocation) { + Map locationSrc = new HashMap<>(); + locationSrc.put("location", srcLocation); + Map locationDst = new HashMap<>(); + locationDst.put("location", dstLocation); + List> locations = new ArrayList<>(); + locations.add(locationSrc); + locations.add(locationDst); + List returnList = new ArrayList<>(); + String reqContent = getJsonString(locations); + String url = getThirdSPEndPoint(); + String responseContent = sendRequest(url, "POST", reqContent); + if (null != responseContent) { + returnList = getJsonObject(responseContent, List.class); + } + return returnList; + } + + private Map getVPNResourceRequestInputs(List resources) { + for (Object resource : resources) { + Map resourceObject = (Map) resource; + Map resourceParametersObject = (Map) resourceObject.get("parameters"); + Map resourceRequestInputs = (Map) resourceParametersObject + .get("requestInputs"); + for (Entry entry : resourceRequestInputs.entrySet()) { + if (entry.getKey().toLowerCase().contains("vpntype")) { + return resourceRequestInputs; + } + } + } + return null; + } + + public static void main(String args[]){ + String str = "restconf/config/GENERIC-RESOURCE-API:services/service/eca7e542-12ba-48de-8544-fac59303b14e/service-data/networks/network/aec07806-1671-4af2-b722-53c8e320a633/network-data/"; + + int index1 = str.indexOf("/network/"); + int index2 = str.indexOf("/network-data"); + + String str1 = str.substring(index1 + "/network/".length(), index2); + System.out.println(str1); + + } + + private String doSOTNServiceHoming(ServiceDecomposition serviceDecomposition, String uuiRequest) { + // query the route for the service. + Map uuiObject = getJsonObject(uuiRequest, Map.class); + Map serviceObject = (Map) uuiObject.get("service"); + Map serviceParametersObject = (Map) serviceObject.get("parameters"); + Map serviceRequestInputs = (Map) serviceParametersObject.get("requestInputs"); + Map oofQueryObject = new HashMap<>(); + List resources = (List) serviceParametersObject.get("resources"); + oofQueryObject.put("src-access-provider-id", serviceRequestInputs.get("inner-src-access-provider-id")); + oofQueryObject.put("src-access-client-id", serviceRequestInputs.get("inner-src-access-client-id")); + oofQueryObject.put("src-access-topology-id", serviceRequestInputs.get("inner-src-access-topology-id")); + oofQueryObject.put("src-access-node-id", serviceRequestInputs.get("inner-src-access-node-id")); + oofQueryObject.put("src-access-ltp-id", serviceRequestInputs.get("inner-src-access-ltp-id")); + oofQueryObject.put("dst-access-provider-id", serviceRequestInputs.get("inner-dst-access-provider-id")); + oofQueryObject.put("dst-access-client-id", serviceRequestInputs.get("inner-dst-access-client-id")); + oofQueryObject.put("dst-access-topology-id", serviceRequestInputs.get("inner-dst-access-topology-id")); + oofQueryObject.put("dst-access-node-id", serviceRequestInputs.get("inner-dst-access-node-id")); + oofQueryObject.put("dst-access-ltp-id", serviceRequestInputs.get("inner-dst-access-ltp-id")); + String oofRequestReq = getJsonString(oofQueryObject); + String url = getOOFCalcEndPoint(); + String responseContent = sendRequest(url, "POST", oofRequestReq); + + List returnList = new ArrayList<>(); + if (null != responseContent) { + returnList = getJsonObject(responseContent, List.class); + } + // in demo we have only one VPN. no cross VPNs, so get first item. + Map returnRoute = getReturnRoute(returnList); + Map vpnRequestInputs = getVPNResourceRequestInputs(resources); + vpnRequestInputs.putAll(returnRoute); + String newRequest = getJsonString(uuiObject); + return newRequest; + } + + private Map getReturnRoute(List returnList){ + Map returnRoute = new HashMap<>(); + for(Object returnVpn :returnList){ + Map returnVpnInfo = (Map) returnVpn; + String accessTopoId = (String)returnVpnInfo.get("access-topology-id"); + if("100".equals(accessTopoId)){ + returnRoute.putAll(returnVpnInfo); + } + else if("101".equals(accessTopoId)){ + for(String key : returnVpnInfo.keySet()){ + returnRoute.put("domain1-" + key, returnVpnInfo.get(key)); + } + } + else if("102".equals(accessTopoId)){ + for(String key : returnVpnInfo.keySet()){ + returnRoute.put("domain2-" + key, returnVpnInfo.get(key)); + } + } + else{ + for(String key : returnVpnInfo.keySet()){ + returnRoute.put("domain" + accessTopoId +"-" + key, returnVpnInfo.get(key)); + } + } + } + return returnRoute; + } + + private Map getResourceParams(Execution execution, String resourceCustomizationUuid, + String serviceParameters) { + List resourceList = jsonUtil.StringArrayToList(execution, + (String) JsonUtils.getJsonValue(serviceParameters, "resources")); + // Get the right location str for resource. default is an empty array. + String resourceInputsFromUui = ""; + for (String resource : resourceList) { + String resCusUuid = (String) JsonUtils.getJsonValue(resource, "resourceCustomizationUuid"); + if (resourceCustomizationUuid.equals(resCusUuid)) { + String resourceParameters = JsonUtils.getJsonValue(resource, "parameters"); + resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs"); + } + } + Map resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class); + return resourceInputsFromUuiMap; + } + + public static T getJsonObject(String jsonstr, Class type) { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + try { + return mapper.readValue(jsonstr, type); + } catch (IOException e) { + LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError, + "fail to unMarshal json", e); + } + return null; + } + + public static String getJsonString(Object srcObj) { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); + String jsonStr = null; + try { + jsonStr = mapper.writeValueAsString(srcObj); + } catch (JsonProcessingException e) { + LOGGER.debug("SdcToscaParserException", e); + e.printStackTrace(); + } + return jsonStr; + } + + private static String sendRequest(String url, String methodType, String content) { + + String msbUrl = url; + HttpRequestBase method = null; + HttpResponse httpResponse = null; + + try { + int timeout = DEFAULT_TIME_OUT; + + RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout) + .setConnectionRequestTimeout(timeout).build(); + + HttpClient client = HttpClientBuilder.create().build(); + + if ("POST".equals(methodType.toUpperCase())) { + HttpPost httpPost = new HttpPost(msbUrl); + httpPost.setConfig(requestConfig); + httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); + method = httpPost; + } else if ("PUT".equals(methodType.toUpperCase())) { + HttpPut httpPut = new HttpPut(msbUrl); + httpPut.setConfig(requestConfig); + httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); + method = httpPut; + } else if ("GET".equals(methodType.toUpperCase())) { + HttpGet httpGet = new HttpGet(msbUrl); + httpGet.setConfig(requestConfig); + method = httpGet; + } else if ("DELETE".equals(methodType.toUpperCase())) { + HttpDelete httpDelete = new HttpDelete(msbUrl); + httpDelete.setConfig(requestConfig); + method = httpDelete; + } + + // now have no auth + // String userCredentials = + // SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP, + // Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY); + // String authorization = "Basic " + + // DatatypeConverter.printBase64Binary(userCredentials.getBytes()); + // method.setHeader("Authorization", authorization); + + httpResponse = client.execute(method); + String responseContent = null; + if (null != httpResponse && httpResponse.getEntity() != null) { + try { + responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); + } catch (ParseException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != method) { + method.reset(); + } + method = null; + return responseContent; + + } catch (SocketTimeoutException | ConnectTimeoutException e) { + return null; + + } catch (Exception e) { + return null; + + } finally { + if (httpResponse != null) { + try { + EntityUtils.consume(httpResponse.getEntity()); + } catch (Exception e) { + } + } + if (method != null) { + try { + method.reset(); + } catch (Exception e) { + + } + } + } + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/META-INF/processes.xml b/bpmn/mso-infrastructure-bpmn/src/main/resources/META-INF/processes.xml new file mode 100644 index 0000000000..35235b8539 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/META-INF/processes.xml @@ -0,0 +1,31 @@ + + + + + + + + false + true + + + + diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml new file mode 100644 index 0000000000..92e8f588a6 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml @@ -0,0 +1,275 @@ +aai: + auth: asdf + dme2: + timeout: '30000' + endpoint: http://localhost:8443 +camunda: + bpm: + admin-user: + id: admin + password: admin + history-level: full + job-execution: + max-pool-size: 30 + core-pool-size: 3 +entitymanager: + packagesToScan: com + +mso: + correlation: + timeout: 60 + logPath: logs + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + adapters: + completemsoprocess: + endpoint: http://localhost:30253/CompleteMsoProcess + db: + auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764 + password: wLg4sjrAFUS8rfVfdvTXeQ== + endpoint: http://localhost:30257/services/RequestsDbAdapter + spring: + endpoint: http://localhost:30257 + network: + endpoint: http://localhost:30253/services/NetworkAdapter + rest: + endpoint: http://localhost:30253/services/rest/v1/networks + openecomp: + db: + endpoint: http://localhost:30257/services/RequestsDbAdapter + po: + auth: 757A94191D685FD2092AC1490730A4FC + password: 3141634BF7E070AA289CF2892C986C0B + sdnc: + endpoint: http://localhost:30254/adapters/SDNCAdapter + rest: + endpoint: http://localhost:30254/adapters/rest/v1/sdnc + timeout: PT60S + tenant: + endpoint: http://localhost:30253/services/TenantAdapter + vnf: + endpoint: http://localhost:30253/services/VnfAdapter + rest: + endpoint: http://localhost:30253/services/rest/vnfs/v1/vnfs + volume-groups: + rest: + endpoint: http://localhost:30253/services/rest/v1/volume-groups + vnf-async: + endpoint: http://localhost:30253/services/VnfAdapterAsync + bpmn: + process: + historyTimeToLive: '30' + callbackRetryAttempts: '5' + catalog: + db: + endpoint: http://localhost:30258/ecomp/mso/catalog + spring: + endpoint: http://localhost:30258 + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + default: + adapter: + namespace: http://com.att.mso + healthcheck: + log: + debug: 'false' + infra: + customer: + id: testCustIdInfra + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + po: + timeout: PT60S + request: + db: + endpoint: http://localhost:28090/ + rollback: 'true' + sdnc: + password: 3141634BF7E070AA289CF2892C986C0B + service: + agnostic: + sniro: + endpoint: /sniro/api/v2/placement + host: http://localhost:30253 + site-name: CamundaEngine + sniro: + auth: test:testpwd + callback: http://localhost:28090/adapters/rest/SDNCNotify + endpoint: http://localhost:28090/optimizationInstance/V1/create + timeout: PT30M + workflow: + CreateGenericVNFV1: + aai: + volume-group: + uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group + default: + aai: + version: '8' + cloud-region: + version: '9' + generic-vnf: + version: '9' + v11: + customer: + uri: /aai/v11/business/customers/customer + generic-query: + uri: /aai/v11/search/generic-query + generic-vnf: + uri: /aai/v11/network/generic-vnfs/generic-vnf + l3-network: + uri: /aai/v11/network/l3-networks/l3-network + network-policy: + uri: /aai/v11/network/network-policies/network-policy + nodes-query: + uri: /aai/v11/search/nodes-query + route-table-reference: + uri: /aai/v11/network/route-table-references/route-table-reference + tenant: + uri: /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + vce: + uri: /aai/v11/network/vces/vce + vpn-binding: + uri: /aai/v11/network/vpn-bindings/vpn-binding + v8: + configuration: + uri: /aai/v11/network/configurations/configuration + customer: + uri: /aai/v8/business/customers/customer + generic-query: + uri: /aai/v8/search/generic-query + l3-network: + uri: /aai/v8/network/l3-networks/l3-network + network-policy: + uri: /aai/v8/network/network-policies/network-policy + nodes-query: + uri: /aai/v8/search/nodes-query + route-table-reference: + uri: /aai/v8/network/route-table-references/route-table-reference + tenant: + uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + vce: + uri: /aai/v8/network/vces/vce + vpn-binding: + uri: /aai/v8/network/vpn-bindings/vpn-binding + v9: + cloud-region: + uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic + generic-vnf: + uri: /aai/v9/network/generic-vnfs/generic-vnf + retry: + attempts: '1' + deleteCinderVolumeV1: + aai: + volume-group: + uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group + global: + default: + aai: + namespace: http://org.openecomp.aai.inventory/ + message: + endpoint: http://localhost:30252/mso/WorkflowMessage + notification: + name: GenericNotificationServiceATT + sdncadapter: + callback: http://localhost:30254/mso/SDNCAdapterCallbackService + vnfadapter: + create: + callback: http://localhost:30253/mso/vnfAdapterNotify + delete: + callback: http://localhost:30253/mso/vnfAdapterNotify + query: + callback: http://localhost:30253/mso/vnfAdapterNotify + rollback: + callback: http://localhost:30253/mso/vnfAdapterNotify + global: + dmaap: + username: testuser + password: alRyMzJ3NUNeakxl + host: http://localhost:3904 + publisher: + topic: com.att.mso.dev.25239-asyncStatusUpdate-v1 +policy: + auth: Basic dGVzdHBkcDphbHBoYTEyMw== + client: + auth: Basic bTAzNzQzOnBvbGljeVIwY2sk + endpoint: https://localhost:8081/pdp/api/ + environment: TEST +sdnc: + auth: Basic YWRtaW46YWRtaW4= + host: https://localhost:8443 + path: /restconf/operations/GENERIC-RESOURCE-API + +appc: + client: + topic: + read: + name: APPC-TEST-AMDOCS2 + timeout: 360000 + write: APPC-TEST-AMDOCS1-IST + response: + timeout: 360000 + key: LSl8QKolmKcC0yJR + secret: lgjXraD1HutKxv8jEN6tVouu + service: ueb + poolMembers: localhost:3904 +server: + port: 8080 + tomcat: + max-threads: 50 +spring: + h2: + console: + enabled: true + path: /h2 + datasource: + url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + username: sa + password: sa + driverClassName: org.h2.Driver + security: + usercredentials: + - + username: apihBpmn + password: '$2a$12$chgDUKcdlf1t41CtS/kjIOwRuq0zWdvCcYYXtyL5TqNdPW0GhN4e6' + role: BPMN-Client + - + username: sdncaBpmn + password: '$2a$12$1TeeS2hAXtqXgdL7f2jCWeF5on7/lrrVZqRmqUqYijOTfrlS2CZae' + role: BPMN-Client + - + username: poBpmn + password: '$2a$12$TixZE5fK3YkTzWcpktm.Uuk5ePFOD2n9sj2ugGRybfsz0QQ0TKLAS' + role: BPMN-Client + - + username: wmaBpmn + password: '$2a$12$WucJSJD5iUD9MuEzhfuSmeF1W/zPMbcu.384Lh8gCkB7SPtKqZQna' + role: BPMN-Client + - + username: sniro + password: '$2a$12$lbOQWS1iDmdQPxW2Mb6OiuTzGaPUrkrvoKVn2zwpFWb6n5Y86Lf1y' + role: SNIRO-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 + +# Hibernate +hibernate: + dialect: org.hibernate.dialect.MySQL5Dialect + show_sql: true + hbm2ddl: + auto: create + +#Actuator +management: + context-path: /manage + + diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml new file mode 100644 index 0000000000..c1f58e9db0 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml @@ -0,0 +1,30 @@ +server: + port: 8080 + tomcat: + max-threads: 50 + +spring: + datasource: + driver-class-name: org.mariadb.jdbc.Driver + url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn + username: ${DB_USERNAME} + password: ${DB_PASSWORD} + dbcp2: + initial-size: 5 + max-total: 20 + validation-query: select 1 + test-on-borrow: true + http: + multipart: + enabled: false + jersey: + application-path: /sobpmnengine +#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. \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateActivateSDNCResource.bpmn b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateActivateSDNCResource.bpmn new file mode 100644 index 0000000000..29d7a11175 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateActivateSDNCResource.bpmn @@ -0,0 +1,393 @@ + + + + + SequenceFlow_1qo2pln + + + + + SequenceFlow_18l3crb + SequenceFlow_0khtova + + + + SequenceFlow_17md60u + + + + + + + + + + + + + SequenceFlow_15mvedq + SequenceFlow_1xk5xed + + + + + SequenceFlow_1afu5al + SequenceFlow_0ow44q0 + + + + + + SequenceFlow_1qo2pln + SequenceFlow_0w2es8j + + + + SequenceFlow_0w2es8j + SequenceFlow_18l3crb + + + + + + SequenceFlow_0khtova + SequenceFlow_1mz0vdx + + + + SequenceFlow_0ruppyi + SequenceFlow_1jr6zi0 + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1mz0vdx + SequenceFlow_15mvedq + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1jr6zi0 + SequenceFlow_10cy2nu + + + + SequenceFlow_0ow44q0 + SequenceFlow_17md60u + + + + + SequenceFlow_10cy2nu + SequenceFlow_0rp0tdn + + + + + SequenceFlow_0s3vc50 + SequenceFlow_05adaey + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_05adaey + SequenceFlow_1afu5al + + + + + + + + + + + + + + + SequenceFlow_0rp0tdn + SequenceFlow_1efgf9m + + + + + SequenceFlow_1xk5xed + SequenceFlow_0ruppyi + + + + SequenceFlow_1efgf9m + SequenceFlow_0s3vc50 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateCustom3rdONAPServiceInstance.bpmn b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateCustom3rdONAPServiceInstance.bpmn new file mode 100644 index 0000000000..a8bd33ca69 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateCustom3rdONAPServiceInstance.bpmn @@ -0,0 +1,389 @@ + + + + + SequenceFlow_0s2spoq + + + + SequenceFlow_1dsbjjb + SequenceFlow_1yay321 + import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() ex.processJavaException(execution) + + + SequenceFlow_1dsbjjb + + + + SequenceFlow_1yay321 + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_19eilro + SequenceFlow_0klbpxx + + + SequenceFlow_0yayvrf + + + SequenceFlow_0s2spoq + SequenceFlow_0z4faf9 + import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCustomE2EServiceInstance() +csi.preProcessRequest(execution) + + + SequenceFlow_14zu6wr + SequenceFlow_0je30si + import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new CreateCustomE2EServiceInstance() +csi.prepareCompletionRequest(execution) + + + + + + + + + + + SequenceFlow_0je30si + SequenceFlow_0yayvrf + + + + SequenceFlow_0e1r62n + + + + SequenceFlow_1ysapam + + + SequenceFlow_0n9pexp + SequenceFlow_01umodj + import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new CreateCustomE2EServiceInstance() +csi.prepareFalloutRequest(execution) + + + + + + + + + + + SequenceFlow_01umodj + SequenceFlow_1ysapam + + + SequenceFlow_0e1r62n + SequenceFlow_0n9pexp + import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new CreateCustomE2EServiceInstance() +csi.sendSyncError(execution) + + + + + + + + SequenceFlow_081z8l2 + SequenceFlow_19eilro + import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new CreateCustomE2EServiceInstance() +csi.sendSyncResponse(execution) + + + SequenceFlow_0klbpxx + SequenceFlow_14zu6wr + SequenceFlow_1fueo69 + + + SequenceFlow_1fueo69 + + + + + + + + + #{execution.getVariable("WorkflowException") == null} + + + + #{execution.getVariable("WorkflowException") != null} + + + + SequenceFlow_0z4faf9 + SequenceFlow_1euqjsp + import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCustomE2EServiceInstance() +csi.prepareInitServiceOperationStatus(execution) + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1euqjsp + SequenceFlow_081z8l2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/process/DeleteCustom3rdONAPServiceInstance.bpmn b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/DeleteCustom3rdONAPServiceInstance.bpmn new file mode 100644 index 0000000000..9ca0b06645 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/DeleteCustom3rdONAPServiceInstance.bpmn @@ -0,0 +1,381 @@ + + + + + SequenceFlow_1wxumid + + + + SequenceFlow_0guajy5 + SequenceFlow_0dbt753 + import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution) + + + SequenceFlow_0guajy5 + + + + SequenceFlow_0dbt753 + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0zf2qyk + SequenceFlow_07hrbs0 + + + SequenceFlow_1ab5l2q + + + SequenceFlow_1wxumid + SequenceFlow_0yowshs + import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DeleteCustomE2EServiceInstance() +csi.preProcessRequest(execution) + + + SequenceFlow_04urx2e + SequenceFlow_1ii935p + import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new DeleteCustomE2EServiceInstance() +csi.prepareCompletionRequest(execution) + + + + + + + + + + + SequenceFlow_1ii935p + SequenceFlow_1ab5l2q + + + + SequenceFlow_0for83z + + + + SequenceFlow_0hrazlh + + + SequenceFlow_1s1cbgf + SequenceFlow_1py6yqz + import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new DeleteCustomE2EServiceInstance() +csi.prepareFalloutRequest(execution) + + + + + + + + + + + SequenceFlow_1py6yqz + SequenceFlow_0hrazlh + + + SequenceFlow_0for83z + SequenceFlow_1s1cbgf + import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new DeleteCustomE2EServiceInstance() +csi.sendSyncError(execution) + + + + + + + + SequenceFlow_1dkcu9o + SequenceFlow_0zf2qyk + import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new DeleteCustomE2EServiceInstance() +csi.sendSyncResponse(execution) + + + SequenceFlow_07hrbs0 + SequenceFlow_04urx2e + SequenceFlow_1t6ekab + + + SequenceFlow_1t6ekab + + + + + + + + + #{execution.getVariable("WorkflowException") == null} + + + + + + SequenceFlow_0yowshs + SequenceFlow_0c4t26p + import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DeleteCustomE2EServiceInstance() +csi.prepareInitServiceOperationStatus(execution) + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_0c4t26p + SequenceFlow_1dkcu9o + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn b/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn new file mode 100644 index 0000000000..e44804a822 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn @@ -0,0 +1,162 @@ + + + + + SequenceFlow_1c92ks3 + + + SequenceFlow_17md60u + + + + + + + + + + + + + SequenceFlow_18l3crb + SequenceFlow_1xk5xed + + + + + SequenceFlow_1vnx1pp + SequenceFlow_0ow44q0 + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new ActivateSDNCNetworkResource() +dcsi.postCreateSDNCCall(execution) + + + + SequenceFlow_1c92ks3 + SequenceFlow_18l3crb + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new ActivateSDNCNetworkResource() +dcsi.preProcessRequest(execution) + + + SequenceFlow_1xk5xed + SequenceFlow_1jr6zi0 + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new ActivateSDNCNetworkResource() +dcsi.prepareUpdateAfterActivateSDNCResource(execution) + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1jr6zi0 + SequenceFlow_1vnx1pp + + + + + SequenceFlow_0ow44q0 + SequenceFlow_17md60u + import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new ActivateSDNCNetworkResource() +csi.sendSyncResponse(execution) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/DeActivateNetworkResource.bpmn b/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/DeActivateNetworkResource.bpmn new file mode 100644 index 0000000000..31604fd689 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/DeActivateNetworkResource.bpmn @@ -0,0 +1,258 @@ + + + + + SequenceFlow_1qo2pln + + + + + SequenceFlow_18l3crb + SequenceFlow_0khtova + + + + SequenceFlow_15wux6a + + + + + + + + + + + + + SequenceFlow_15mvedq + SequenceFlow_1xk5xed + + + + + SequenceFlow_1vnx1pp + SequenceFlow_0ow44q0 + + + + + + SequenceFlow_1qo2pln + SequenceFlow_0w2es8j + + + + SequenceFlow_0w2es8j + SequenceFlow_18l3crb + + + + + + SequenceFlow_0khtova + SequenceFlow_1mz0vdx + + + + SequenceFlow_1xk5xed + SequenceFlow_1jr6zi0 + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1mz0vdx + SequenceFlow_15mvedq + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1jr6zi0 + SequenceFlow_1vnx1pp + + + + + SequenceFlow_0ow44q0 + SequenceFlow_15wux6a + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java new file mode 100644 index 0000000000..e56b45f19d --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java @@ -0,0 +1,46 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ + + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.so.bpmn.common.adapter.sdnc.RequestHeader; + +public class RequestHeaderTest{ + RequestHeader rh = new RequestHeader(); + + @Test + public void testRequestHeader() { + rh.setRequestId("requestId"); + rh.setSvcInstanceId("svcInstanceId"); + rh.setSvcAction("svcAction"); + rh.setSvcOperation("svcOperation"); + rh.setCallbackUrl("callbackUrl"); + rh.setMsoAction("msoAction"); + assertEquals(rh.getRequestId(), "requestId"); + assertEquals(rh.getSvcInstanceId(), "svcInstanceId"); + assertEquals(rh.getSvcAction(), "svcAction"); + assertEquals(rh.getSvcOperation(), "svcOperation"); + assertEquals(rh.getCallbackUrl(), "callbackUrl"); + assertEquals(rh.getMsoAction(), "msoAction"); + assert(rh.toString()!=null); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java new file mode 100644 index 0000000000..9843a95342 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java @@ -0,0 +1,45 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ + + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.bpmn.common.adapter.sdnc.CallbackHeader; +import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest; + +public class SDNCAdapterCallbackRequestTest{ + + SDNCAdapterCallbackRequest sdnccall = new SDNCAdapterCallbackRequest(); + CallbackHeader cbh = new CallbackHeader(); + String o = "test"; + + @Test + public void testSDNCAdapterCallbackRequest() { + sdnccall.setCallbackHeader(cbh); + sdnccall.setRequestData(o); + assertEquals(sdnccall.getCallbackHeader(), cbh); + assertEquals(sdnccall.getRequestData(), o); + assertNotNull(sdnccall.toString()); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java new file mode 100644 index 0000000000..79bffe40d0 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java @@ -0,0 +1,41 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ + + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.so.bpmn.common.adapter.sdnc.RequestHeader; +import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterRequest; + +public class SDNCAdapterRequestTest { + + SDNCAdapterRequest adapter = new SDNCAdapterRequest(); + RequestHeader rh = new RequestHeader(); + Object o = new Object(); + + @Test + public void testSDNCAdapterRequest() { + adapter.setRequestHeader(rh); + adapter.setRequestData(o); + assertEquals(adapter.getRequestHeader(), rh); + assertEquals(adapter.getRequestData(), o); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java new file mode 100644 index 0000000000..b5511f67e3 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java @@ -0,0 +1,54 @@ +/*- + * ============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; + +import org.junit.After; +import org.junit.runner.RunWith; +import org.onap.so.bpmn.common.BPMNUtil; +import org.onap.so.bpmn.common.WorkflowTest; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import com.github.tomakehurst.wiremock.client.WireMock; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +@ContextConfiguration +@AutoConfigureWireMock(port = 0) +public abstract class BaseIntegrationTest extends WorkflowTest { + @Autowired + BPMNUtil bpmnUtil; + + @Value("${wiremock.server.port}") + protected String wiremockPort; + + @After + public void baseAfterTest() { + WireMock.reset(); + } +} + diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java new file mode 100644 index 0000000000..eee2810125 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java @@ -0,0 +1,72 @@ +/*- + * ============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.bpmn; +import ch.vorburger.exec.ManagedProcessException; +import ch.vorburger.mariadb4j.DBConfigurationBuilder; +import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; +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; + +import javax.persistence.EntityManagerFactory; +import javax.sql.DataSource; + +@Configuration +@EnableTransactionManagement +@EnableJpaRepositories( + entityManagerFactoryRef = "requestEntityManagerFactory",transactionManagerRef = "requestTransactionManager", + basePackages = { "org.onap.so.db.request.data.repository"} +) +@Profile({"test"}) +public class InfraEmbeddedMariaDbConfig { + + @Primary + @Bean(name = "requestEntityManagerFactory") + public LocalContainerEntityManagerFactoryBean + entityManagerFactory( + EntityManagerFactoryBuilder builder, + 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/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java new file mode 100644 index 0000000000..f65cadae3c --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java @@ -0,0 +1,32 @@ +/*- + * ============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.bpmn; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; +import org.junit.runner.RunWith; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses({"**/*IT.class"}) +public class IntegrationTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java new file mode 100644 index 0000000000..5f0722aa3d --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java @@ -0,0 +1,357 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.core.Response; + +import org.camunda.bpm.engine.HistoryService; +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.history.HistoricProcessInstance; +import org.camunda.bpm.engine.history.HistoricVariableInstance; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; +import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource; +import org.onap.so.bpmn.common.workflow.service.WorkflowResource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Set of utility methods used for Unit testing + * + */ +@Component +public class BPMNUtil { + + private static WorkflowAsyncResource workflowResource; + + @Autowired + public void setWorkflowResource(WorkflowAsyncResource workflowResource) { + BPMNUtil.workflowResource = workflowResource; + } + + public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) { + String pID = getProcessInstanceId(processEngineServices, + processDefinitionID); + return getVariable( processEngineServices, processDefinitionID, name, pID); + } + + public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name, String processInstanceId) { + assertProcessInstanceFinished(processEngineServices, processInstanceId); + HistoricVariableInstance responseData = processEngineServices.getHistoryService() + .createHistoricVariableInstanceQuery().processInstanceId(processInstanceId) + .variableName(name) + .singleResult(); + + if (responseData != null) { + return (responseData.getValue() != null ? responseData.getValue().toString(): null); + } + return null; + } + + /* + @SuppressWarnings("unchecked") + public static T getRawVariable(HistoryService historyService, String processDefinitionID, String name) { + //String pID = getProcessInstanceId(processEngineServices, + // processDefinitionID); + assertProcessInstanceFinished(historyService, pID); + Object responseData = historyService + .createHistoricVariableInstanceQuery().processInstanceId(pID) + .variableName(name) + .singleResult() + .getValue(); + return (T) responseData; + } + */ + + @SuppressWarnings("unchecked") + public static T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) { + String pID = getProcessInstanceId(processEngineServices, + processDefinitionID); + return getRawVariable( processEngineServices, processDefinitionID, name, pID); + } + + @SuppressWarnings("unchecked") + public static T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name, String processInstanceId) { + assertProcessInstanceFinished(processEngineServices, processInstanceId); + Object responseData = processEngineServices.getHistoryService() + .createHistoricVariableInstanceQuery().processInstanceId(processInstanceId) + .variableName(name) + .singleResult() + .getValue(); + return (T) responseData; + } + + + public static void assertAnyProcessInstanceFinished(ProcessEngineServices processEngineServices, String processDefinitionID) { + String pID = getProcessInstanceId(processEngineServices, + processDefinitionID); + assertNotNull(pID); + assertTrue(processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count() > 0); + } + + public static void assertNoProcessInstance(ProcessEngineServices processEngineServices, String processDefinitionID) { + assertNull(getProcessInstanceId(processEngineServices, processDefinitionID)); + } + + public static void assertProcessInstanceFinished(HistoryService historyService, String pid) { + assertEquals(1, historyService.createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count()); + } + + public static void assertProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) { + assertEquals(1, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count()); + } + + public static void assertProcessInstanceNotFinished(ProcessEngineServices processEngineServices, String processDefinitionID) { + String pID = getProcessInstanceId(processEngineServices, + processDefinitionID); + assertEquals(0, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count()); + } + + private static String getProcessInstanceId( + ProcessEngineServices processEngineServices, String processDefinitionID) { + List historyList = processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list(); + String pID = null; + for (HistoricProcessInstance hInstance: historyList) { + if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) { + pID = hInstance.getId(); + break; + } + } + return pID; + } + + public static void cleanHistory(ProcessEngineServices processEngineServices) { + List historyList = processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list(); + List pidList = new ArrayList<>(); + for (HistoricProcessInstance hInstance : historyList) { + pidList.add(hInstance.getId()); + } + if (pidList.size() > 0) { + processEngineServices.getHistoryService().deleteHistoricProcessInstances(pidList); + } + } + + private static String getProcessInstanceId( + HistoryService historyService, String processDefinitionID) { + List historyList = historyService.createHistoricProcessInstanceQuery().list(); + String pID = null; + for (HistoricProcessInstance hInstance: historyList) { + if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) { + pID = hInstance.getId(); + break; + } + } + return pID; + } + + public static boolean isProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) { + return processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count() == 1 ? true: false; + } + + + private static void buildVariable(String key, String value, Map variableValueType) { + Map host = new HashMap<>(); + host.put("value", value); + host.put("type", "String"); + variableValueType.put(key, host); + } + + public static WorkflowResponse executeWorkFlow(ProcessEngineServices processEngineServices, String processKey, Map variables) { + VariableMapImpl variableMap = new VariableMapImpl(); + + Map variableValueType = new HashMap<>(); + for (String key : variables.keySet()) { + buildVariable(key, variables.get(key), variableValueType); + } + buildVariable("mso-service-request-timeout","600", variableValueType); + variableMap.put("variables", variableValueType); + + workflowResource.setProcessEngineServices4junit(processEngineServices); + Response response = workflowResource.startProcessInstanceByKey( + processKey, variableMap); + WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity(); + return workflowResponse; + } + + public static WorkflowResponse executeWorkFlow(RuntimeService runtimeService, String processKey, Map variables, WorkflowResource workflowResource) { + + VariableMapImpl variableMap = new VariableMapImpl(); + + Map variableValueType = new HashMap(); + for (String key : variables.keySet()) { + buildVariable(key, variables.get(key), variableValueType); + } + buildVariable("mso-service-request-timeout","600", variableValueType); + variableMap.put("variables", variableValueType); + + + Response response = workflowResource.startProcessInstanceByKey( + processKey, variableMap); + WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity(); + return workflowResponse; + } + + //Check the runtime service to see whether the process is completed + public static void waitForWorkflowToFinish(ProcessEngineServices processEngineServices, String pid) throws InterruptedException { + // Don't wait forever + long waitTime = 120000; + long endTime = System.currentTimeMillis() + waitTime; + + while (true) { + if (processEngineServices.getRuntimeService().createProcessInstanceQuery().processInstanceId(pid).singleResult() == null) { + break; + } + + if (System.currentTimeMillis() >= endTime) { + fail("Process " + pid + " did not finish in " + waitTime + "ms"); + } + + Thread.sleep(200); + } + } + + + //Check the runtime service to see whether the process is completed + public static void waitForWorkflowToFinish(RuntimeService runtimeService, String pid) throws InterruptedException { + // Don't wait forever + long waitTime = 120000; + long endTime = System.currentTimeMillis() + waitTime; + + while (true) { + if (runtimeService.createProcessInstanceQuery().processInstanceId(pid).singleResult() == null) { + break; + } + + if (System.currentTimeMillis() >= endTime) { + fail("Process " + pid + " did not finish in " + waitTime + "ms"); + } + + Thread.sleep(200); + } + } + + + /** + * Executes the Asynchronous workflow in synchronous fashion and returns the WorkflowResponse object + * @param processEngineServices + * @param processKey + * @param variables + * @return + * @throws InterruptedException + */ + public static WorkflowResponse executeAsyncWorkflow(ProcessEngineServices processEngineServices, String processKey, Map variables) throws InterruptedException { + ProcessThread pthread = new ProcessThread(processKey, processEngineServices, variables); + pthread.start(); + BPMNUtil.assertProcessInstanceNotFinished(processEngineServices, processKey); + String pid = getProcessInstanceId(processEngineServices, processKey); + //Caution: If there is a problem with workflow, this may wait for ever + while (true) { + pid = getProcessInstanceId(processEngineServices, processKey); + if (!isProcessInstanceFinished(processEngineServices,pid)) { + Thread.sleep(200); + } else{ + break; + } + } + //need to retrieve for second time ? + pid = getProcessInstanceId(processEngineServices, processKey); + waitForWorkflowToFinish(processEngineServices, pid); + return pthread.workflowResponse; + } + + /** + * Execute workflow using async resource + * @param processEngineServices + * @param processKey + * @param asyncResponse + * @param variables + * @throws InterruptedException + */ + private static void executeAsyncFlow(ProcessEngineServices processEngineServices, String processKey, Map variables) throws InterruptedException { + VariableMapImpl variableMap = new VariableMapImpl(); + + Map variableValueType = new HashMap<>(); + for (String key : variables.keySet()) { + buildVariable(key, variables.get(key), variableValueType); + } + buildVariable("mso-service-request-timeout","600", variableValueType); + variableMap.put("variables", variableValueType); + + workflowResource.setProcessEngineServices4junit(processEngineServices); + workflowResource.startProcessInstanceByKey(processKey, variableMap); + } + + /** + * Helper class which executes workflow in a thread + * + */ + static class ProcessThread extends Thread { + + public WorkflowResponse workflowResponse = null; + public String processKey; + public boolean started; + public ProcessEngineServices processEngineServices; + public Map variables; + + public ProcessThread(String processKey, ProcessEngineServices processEngineServices, Map variables) { + this.processKey = processKey; + this.processEngineServices = processEngineServices; + this.variables = variables; + } + + public void run() { + started = true; + /*doAnswer(new Answer() { + public Void answer(InvocationOnMock invocation) { + Response response = (Response) invocation.getArguments()[0]; + try { + workflowResponse = (WorkflowResponse) response.getEntity(); + } catch (ClassCastException e) { + String workflowResponseString = (String)response.getEntity(); + workflowResponse = new WorkflowResponse(); + workflowResponse.setResponse(workflowResponseString); + workflowResponse.setMessageCode(200); + } + return null; + } + }).when(asyncResponse).setResponse(any(Response.class)); + */ + try { + executeAsyncFlow(processEngineServices, processKey, variables); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java new file mode 100644 index 0000000000..470cc2220d --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.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.bpmn.common; + +import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish; +import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; + +/** + * Unit test for CompleteMsoProcess.bpmn. + */ + +public class CompleteMsoProcessIT extends BaseIntegrationTest { + + private void executeFlow(String inputRequestFile) throws InterruptedException { + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + Map variables = new HashMap<>(); + variables.put("CompleteMsoProcessRequest",inputRequestFile); + variables.put("mso-request-id", UUID.randomUUID().toString()); + String processId = invokeSubProcess( "CompleteMsoProcess", variables); + waitForWorkflowToFinish(processEngine,processId); + logEnd(); + } + + @Test + public void msoCompletionRequestWithNotificationUrl_200() throws Exception { + logStart(); + + //Execute Flow + executeFlow(gMsoCompletionRequestWithNotificationurl()); + + //Verify Error + String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode"); + Assert.assertEquals("200", CMSO_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator")); + logEnd(); + } + + @Test + public void msoCompletionRequestWithNoNotificationurl() throws Exception { + logStart(); + + //Execute Flow + executeFlow(gMsoCompletionRequestWithNoNotificationurl()); + + //Verify Error + String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode"); + Assert.assertEquals("200", CMSO_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator")); + logEnd(); + } + + @Test + public void msoCompletionRequestWithNotificationurlNoRequestId() throws Exception { + logStart(); + + //Execute Flow + executeFlow(gMsoCompletionRequestWithNotificationurlNoRequestId()); + + //Verify Error + String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode"); + Assert.assertEquals("200", CMSO_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator")); + logEnd(); + } + + @Test + public void msoCompletionRequestWithNoNotificationurlNoRequestId() throws Exception { + logStart(); + + //Execute Flow + executeFlow(gMsoCompletionRequestWithNoNotificationurlNoRequestId()); + + //Verify Error + String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode"); + Assert.assertEquals("200", CMSO_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator")); + logEnd(); + } + + public String gMsoCompletionRequestWithNotificationurl() { + String xml = "" + + "" + + " " + + " STUW105_5002" + + " RequestAction" + + " COMPLETE" + + " SOURCE" + + " https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl" + + " 10205000" + + " 1" + + " " + + " BPELNAME" + + ""; + + return xml; + } + + + + public String gMsoCompletionRequestWithNoNotificationurl() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " STUW105_5002" + + " RequestAction" + + " COMPLETE" + + " SOURCE" + + " " + + " 10205000" + + " 1" + + " " + + " BPELNAME" + + ""; + + return xml; + } + + public String gMsoCompletionRequestWithNoNotificationurlNoRequestId() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " " + + " RequestAction" + + " COMPLETE" + + " SOURCE" + + " " + + " 10205000" + + " 1" + + " " + + " BPELNAME" + + ""; + + return xml; + } + + public String gMsoCompletionRequestWithNotificationurlNoRequestId() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " " + + " RequestAction" + + " COMPLETE" + + " SOURCE" + + " https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl" + + " 10205000" + + " 1" + + " " + + " BPELNAME" + + ""; + + return xml; + } +} + diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java new file mode 100644 index 0000000000..0ef856bb9d --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; + +/** + * Unit test cases for ConfirmVolumeGroupName.bpmn + */ + +public class ConfirmVolumeGroupNameIT extends BaseIntegrationTest { + /** + * Sunny day scenario. + * + * @throws Exception + */ + @Test + public void sunnyDay() throws Exception { + logStart(); + MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml"); + + Map variables = new HashMap<>(); + variables.put("isDebugLogEnabled","true"); + variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1"); + variables.put("ConfirmVolumeGroupName_volumeGroupName", "VOLUME_GROUP_ID_1_NAME"); + variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + String processId = invokeSubProcess("ConfirmVolumeGroupName", variables); + String responseCode = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode",processId); + + assertEquals("200", responseCode); + + logEnd(); + } + + /** + * Rainy day scenario - nonexisting volume group id. + * + * @throws Exception + */ + @Test + public void rainyDayNoVolumeGroupId() throws Exception { + logStart(); + + // does not exist would return a 404 from AAI + MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST", "aai-volume-group-id-info.xml", 404); + + Map variables = new HashMap<>(); + variables.put("isDebugLogEnabled","true"); + variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21"); + variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST"); + variables.put("ConfirmVolumeGroupName_volumeGroupName", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + String processId = invokeSubProcess("ConfirmVolumeGroupName", variables); + String responseCode = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode",processId); + + assertEquals("404", responseCode); + + logEnd(); + } + + /** + * Rainy day scenario - volume group name does not match the name in AAI + * + * + * @throws Exception + */ + @Test + public void rainyDayNameDoesNotMatch() throws Exception { + logStart(); + + MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml", 200); + + Map variables = new HashMap<>(); + variables.put("isDebugLogEnabled","true"); + variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1"); + variables.put("ConfirmVolumeGroupName_volumeGroupName", "BAD_VOLUME_GROUP_NAME"); + variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + String processId = invokeSubProcess("ConfirmVolumeGroupName", variables); + String volumeGroupNameMatches = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName", "CVGN_volumeGroupNameMatches",processId); + + assertEquals("false", volumeGroupNameMatches); + + logEnd(); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java new file mode 100644 index 0000000000..af9ab7d3e4 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java @@ -0,0 +1,88 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; + +/** + * Please describe the ConfirmVolumeGroupTenantTest.java class + * + */ + +public class ConfirmVolumeGroupTenantIT extends BaseIntegrationTest { + + @Test + public void testRemoveLayer3Service_success() throws Exception{ + MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume.xml"); + + Map variables = new HashMap<>(); + setVariables(variables); + + String processId = invokeSubProcess("ConfirmVolumeGroupTenant", variables); + + String actualNameMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "groupNamesMatch",processId); + String actualIdMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "tenantIdsMatch",processId); + String actualResponse = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "volumeHeatStackId",processId); + + assertEquals("Response", "true", actualNameMatch); + assertEquals("Response", "true", actualIdMatch); + assertEquals("Response", "MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845", actualResponse); + } + + @Test + public void testRemoveLayer3Service_idsNotMatch() throws Exception{ + MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml"); + + Map variables = new HashMap<>(); + setVariables(variables); + + String processId = invokeSubProcess("ConfirmVolumeGroupTenant", variables); + + + String actualNameMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "groupNamesMatch",processId); + String actualIdMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "tenantIdsMatch",processId); + String actualResponse = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "WorkflowException",processId); + + assertEquals("Response", "true", actualNameMatch); + assertEquals("Response", "false", actualIdMatch); + assertEquals("Response", "WorkflowException[processKey=ConfirmVolumeGroupTenant,errorCode=1,errorMessage=Volume Group a8399879-31b3-4973-be26-0a0cbe776b58 does not belong to your tenant,workStep=*]", actualResponse); + + } + + private void setVariables(Map variables) { + variables.put("isDebugLogEnabled", "true"); + variables.put("volumeGroupId","a8399879-31b3-4973-be26-0a0cbe776b58"); + variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); + variables.put("aicCloudRegion", "MDTWNJ21"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java new file mode 100644 index 0000000000..fd38ff024d --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java @@ -0,0 +1,267 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.logger.MsoLogger; + +/** + * Unit test for CreateAAIVfModule.bpmn. + */ + +public class CreateAAIVfModuleIT extends BaseIntegrationTest { + + MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class); + + @Test + public void TestCreateGenericVnfSuccess_200() { + + new MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfName", "STMTN5MMSC22"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC22-MMSC::module-0-0"); + variables.put("vfModuleModelName", "MMSC::module-0"); + + String processId = invokeSubProcess("CreateAAIVfModule", variables); + String response = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode",processId); + String responseCode = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode",processId); + Assert.assertEquals("201", responseCode); + logger.debug(response); + } + + @Test + public void TestCreateVfModuleSuccess_200() { + // create Add-on VF Module for existing Generic VNF + new MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-1-0"); + variables.put("vfModuleModelName", "STMTN5MMSC21-MMSC::model-1-0"); + String processId = invokeSubProcess("CreateAAIVfModule", variables); + String response = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode",processId); + String responseCode = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode",processId); + Assert.assertEquals("201", responseCode); + logger.debug(response); + } + + @Test + public void TestQueryGenericVnfFailure_5000() { + new MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfName", "STMTN5MMSC23"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC23-MMSC::module-0-0"); + variables.put("vfModuleModelName", "MMSC::module-0"); + String processId = invokeSubProcess("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId); + Assert.assertEquals(500, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("Error occurred attempting to query AAI")); + logger.debug(exception.getErrorMessage()); + } + + @Test + public void TestCreateDupGenericVnfFailure_1002() { + new MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfName", "STMTN5MMSC21"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0"); + variables.put("vfModuleModelName", "MMSC::module-0"); + String processId = invokeSubProcess("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("Invalid request for new Generic VNF which already exists")); + logger.debug(exception.getErrorMessage()); + } + + @Test + public void TestCreateDupVfModuleFailure_1002() { + new MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfId", "2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC20-MMSC::module-1-0"); + variables.put("vfModuleModelName", "STMTN5MMSC20-MMSC::model-1-0"); + String processId = invokeSubProcess("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("already exists for Generic VNF")); + logger.debug(exception.getErrorMessage()); + } + + @Test + public void TestCreateGenericVnfFailure_5000() { + new MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfName", "STMTN5MMSC22"); + variables.put("serviceId", "99999999-9999-9999-9999-999999999999"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0"); + variables.put("vfModuleModelName", "PCRF::module-0"); + String processId = invokeSubProcess("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + logger.debug(exception.getErrorMessage()); + } + + @Test + public void TestCreateGenericVnfFailure_1002() { + new MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfId", "768073c7-f41f-4822-9323-b75962763d74"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0"); + variables.put("vfModuleModelName", "PCRF::module-0"); + String processId = invokeSubProcess("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found")); + logger.debug(exception.getErrorMessage()); + } + + @Test + public void TestCreateVfModuleFailure_5000() { + new MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + + Map variables = new HashMap<>(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); + variables.put("serviceId", "99999999-9999-9999-9999-999999999999"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC21-PCRF::module-1-0"); + variables.put("vfModuleModelName", "STMTN5MMSC21-PCRF::model-1-0"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + String processId = invokeSubProcess("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + logger.debug(exception.getErrorMessage()); + } + + public static void MockAAICreateGenericVnf(){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) + .withRequestBody(containing("00000000-0000-0000-0000-000000000000")) + .willReturn(aResponse() + .withStatus(201))); + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) + .withRequestBody(containing("99999999-9999-9999-9999-999999999999")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + } + + // start of mocks used locally and by other VF Module unit tests + public static void MockAAIVfModulePUT(boolean isCreate){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*")) + .withRequestBody(containing("MMSC")) + .willReturn(aResponse() + .withStatus(isCreate ? 201 : 200))); + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*")) + .withRequestBody(containing("PCRF")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721")) + .willReturn(aResponse() + .withStatus(200))); + } + +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java new file mode 100644 index 0000000000..6af705fd54 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java @@ -0,0 +1,132 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetVfModuleId; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutVfModuleId; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; +import org.onap.so.bpmn.mock.FileUtil; +import org.onap.so.logger.MsoLogger; + +/** + * Unit tests for CreateAAIVfModuleVolumeGroup.bpmn. + */ + +public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest { + + MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleVolumeGroupIT.class); + + /** + * Test the happy path through the flow. + */ + @Test + public void happyPath() throws IOException { + + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml"); + MockGetGenericVnfByIdWithPriority("skask", "lukewarm", 200, "VfModularity/VfModule-lukewarm.xml", 2); + MockPutVfModuleIdNoResponse("skask", "PCRF", "lukewarm"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest); + invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode"); + logger.debug("Subflow response code: " + responseCode); + logger.debug("Subflow response: " + response); + Assert.assertEquals(200, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the case where the GET to AAI returns a 404. + */ + @Test + public void badGet() throws IOException { + + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml"); + MockGetVfModuleId("skask", ".*", "VfModularity/VfModule-supercool.xml", 404); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest); + invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables); + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponseCode"); + logger.debug("Subflow response code: " + responseCode); + logger.debug("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404. + */ + @Test + public void badPatch() throws IOException { + + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml"); + MockGetVfModuleId("skask", "lukewarm", "VfModularity/VfModule-lukewarm.xml", 200); + MockPutVfModuleId("skask", "lukewarm", 404); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest); + invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode"); + logger.debug("Subflow response code: " + responseCode); + logger.debug("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } +} + diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java new file mode 100644 index 0000000000..7acaf449e3 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.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.bpmn.common; + +import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; + +/** + * Unit Test for the DecomposeService Flow + * + */ + +public class DecomposeServiceIT extends BaseIntegrationTest { + + + public DecomposeServiceIT() throws IOException { + + } + + @Test + public void testDecomposeService_success() throws Exception{ + MockGetServiceResourcesCatalogData("cmw-123-456-789", "1.0", "/getCatalogServiceResourcesDataWithConfig.json"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff"); + invokeSubProcess("DecomposeService", businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + + } + + //@Test + @Test + public void testDecomposeService_success_partial() throws Exception{ + MockGetServiceResourcesCatalogData("cmw-123-456-789", "1.0", "/getCatalogServiceResourcesDataNoNetwork.json"); + + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff"); + invokeSubProcess("DecomposeService", businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + + } + + private void setVariablesSuccess(Map variables, String requestId, String siId) { + variables.put("isDebugLogEnabled", "true"); + variables.put("mso-request-id", requestId); + variables.put("msoRequestId", requestId); + variables.put("serviceInstanceId",siId); + + String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," + + "\"modelInvariantUuid\": \"cmw-123-456-789\"," + + "\"modelVersionId\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," + + "\"modelName\": \"ServicevSAMP12\"," + + "\"modelVersion\": \"1.0\"," + + "}"; + variables.put("serviceModelInfo", serviceModelInfo); + + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java new file mode 100644 index 0000000000..27b39aec64 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java @@ -0,0 +1,288 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.logger.MsoLogger; + +/** + * Unit test for DeleteAAIVfModule.bpmn. + */ + +public class DeleteAAIVfModuleIT extends BaseIntegrationTest { + private static final String EOL = "\n"; + + MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,DeleteAAIVfModuleIT.class); + + @Test + public void TestDeleteGenericVnfSuccess_200() { + // delete the Base Module and Generic Vnf + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73 + new MockAAIGenericVnfSearch(); + new MockAAIDeleteGenericVnf(); + new MockAAIDeleteVfModule(); + + Map variables = new HashMap<>(); + variables.put("isDebugLogEnabled","true"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("DeleteAAIVfModuleRequest"," DELETE_VF_MODULE PORTAL a27ce5a9-29c4-4c22-a017-6615ac73c721 STMTN5MMSC21 973ed047-d251-4fb9-bf1a-65b8949e0a73 STMTN5MMSC21-MMSC::module-0-0 "); + String processId = invokeSubProcess("DeleteAAIVfModule", variables); + String response = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode",processId); + String responseCode = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode",processId); + Assert.assertEquals("200", responseCode); + logger.debug(response); + } + + @Test + public void TestDeleteVfModuleSuccess_200() { + // delete Add-on Vf Module for existing Generic Vnf + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a75 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c720" + EOL + + " STMTN5MMSC20" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL + + " STMTN5MMSC20-MMSC::module-1-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + + new MockAAIGenericVnfSearch(); + new MockAAIDeleteGenericVnf(); + new MockAAIDeleteVfModule(); + + Map variables = new HashMap<>(); + variables.put("isDebugLogEnabled","true"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("DeleteAAIVfModuleRequest",request); + String processId = invokeSubProcess("DeleteAAIVfModule", variables); + String response = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode",processId); + String responseCode = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode",processId); + Assert.assertEquals("200", responseCode); + logger.debug(response); + } + + @Test + public void TestQueryGenericVnfFailure_5000() { + // query Generic Vnf failure (non-404) with A&AI + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c723, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a71 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c723" + EOL + + " STMTN5MMSC23" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a71" + EOL + + " STMTN5MMSC20-MMSC::module-1-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + new MockAAIGenericVnfSearch(); + new MockAAIDeleteGenericVnf(); + new MockAAIDeleteVfModule(); + + Map variables = new HashMap<>(); + variables.put("isDebugLogEnabled","true"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("DeleteAAIVfModuleRequest",request); + String processId = invokeSubProcess("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + logger.debug(exception.getErrorMessage()); + } + + @Test + public void TestQueryGenericVnfFailure_1002() { + // attempt to delete Vf Module for Generic Vnf that does not exist (A&AI returns 404) + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c722, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a72 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c722" + EOL + + " STMTN5MMSC22" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a72" + EOL + + " STMTN5MMSC22-MMSC::module-1-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + new MockAAIGenericVnfSearch(); + new MockAAIDeleteGenericVnf(); + new MockAAIDeleteVfModule(); + + Map variables = new HashMap<>(); + variables.put("isDebugLogEnabled","true"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("DeleteAAIVfModuleRequest",request); + String processId = invokeSubProcess("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found")); + logger.debug(exception.getErrorMessage()); + } + + @Test + public void TestDeleteGenericVnfFailure_5000() { + // A&AI failure (non-200) when attempting to delete a Generic Vnf + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c718, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a78 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c718" + EOL + + " STMTN5MMSC18" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL + + " STMTN5MMSC18-MMSC::module-0-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + new MockAAIGenericVnfSearch(); + new MockAAIDeleteGenericVnf(); + new MockAAIDeleteVfModule(); + + Map variables = new HashMap<>(); + variables.put("isDebugLogEnabled","true"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("DeleteAAIVfModuleRequest",request); + String processId = invokeSubProcess("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + logger.debug(exception.getErrorMessage()); + } + + @Test + public void TestDeleteVfModuleFailure_5000() { + // A&AI failure (non-200) when attempting to delete a Vf Module + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c719, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a77 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c719" + EOL + + " STMTN5MMSC19" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL + + " STMTN5MMSC19-MMSC::module-1-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + new MockAAIGenericVnfSearch(); + new MockAAIDeleteGenericVnf(); + new MockAAIDeleteVfModule(); + + Map variables = new HashMap<>(); + variables.put("isDebugLogEnabled","true"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("DeleteAAIVfModuleRequest",request); + String processId = invokeSubProcess("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + logger.debug(exception.getErrorMessage()); + } + + @Test + public void TestDeleteVfModuleFailure_1002_1() { + // failure attempting to delete Base Module when not the last Vf Module + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a74 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c720" + EOL + + " STMTN5MMSC20" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " STMTN5MMSC20-MMSC::module-0-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + new MockAAIGenericVnfSearch(); + new MockAAIDeleteGenericVnf(); + new MockAAIDeleteVfModule(); + + Map variables = new HashMap<>(); + variables.put("isDebugLogEnabled","true"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("DeleteAAIVfModuleRequest",request); + String processId = invokeSubProcess("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("is Base Module, not Last Module")); + logger.debug(exception.getErrorMessage()); + } + + @Test + public void TestDeleteVfModuleFailure_1002_2() { + // failure attempting to delete a Vf Module that does not exist (A&AI returns 404) + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a76 + new MockAAIGenericVnfSearch(); + new MockAAIDeleteGenericVnf(); + new MockAAIDeleteVfModule(); + + Map variables = new HashMap<>(); + variables.put("isDebugLogEnabled","true"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("DeleteAAIVfModuleRequest"," DELETE_VF_MODULE PORTAL a27ce5a9-29c4-4c22-a017-6615ac73c720 STMTN5MMSC20 973ed047-d251-4fb9-bf1a-65b8949e0a76 STMTN5MMSC20-MMSC::module-2-0 "); + String processId = invokeSubProcess("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("does not exist for Generic Vnf Id")); + logger.debug(exception.getErrorMessage()); + } +} + diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java new file mode 100644 index 0000000000..a6d26540dc --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java @@ -0,0 +1,224 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; +import org.onap.so.logger.MsoLogger; + +/** + * Unit test for FalloutHandler.bpmn. + */ + +public class FalloutHandlerIT extends BaseIntegrationTest { + + MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,FalloutHandlerIT.class); + + + private void setupMocks() { + stubFor(post(urlEqualTo("/dbadapters/AttRequestsDbAdapter")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody("Notified"))); + stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody("Notified"))); + } + + private String executeFlow(String inputRequestFile) throws InterruptedException { + + Map variables = new HashMap<>(); + variables.put("FalloutHandlerRequest",inputRequestFile); variables.put("mso-request-id", UUID.randomUUID().toString()); + String processId = invokeSubProcess( "FalloutHandler", variables); + waitForWorkflowToFinish(processEngine,processId); + logEnd(); + return processId; + } + + @Test + public void msoFalloutHandlerWithNotificationurl_200() throws Exception{ + //Setup Mocks + setupMocks(); + //Execute Flow + String processId = executeFlow(gMsoFalloutHandlerWithNotificationurl()); + //Verify Error + String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode",processId); + Assert.assertEquals("200", FH_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator",processId)); + } + + public String gMsoFalloutHandlerWithNotificationurl() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " 1020_STUW105_5002" + + " requestAction" + + " CANCEL" + + " source" + + " http://localhost:28090/CCD/StatusNotification" + + " 10205000" + + " 1" + + " " + + " " + + " Some Error Message - Fallout Handler" + + " Some Error Code - Fallout Handler" + + " Some Source System Error Code- Fallout Handler" + + " " + + ""; + + return xml; + + } + + + + + @Test + public void msoFalloutHandlerWithNoNotificationurl() throws Exception{ + + //Setup Mocks + setupMocks(); + //Execute Flow + executeFlow(gMsoFalloutHandlerWithNoNotificationurl()); + //Verify Error + String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode"); + Assert.assertEquals("200", FH_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator")); + } + + public String gMsoFalloutHandlerWithNoNotificationurl() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " 1020_STUW105_5002" + + " requestAction" + + " CANCEL" + + " source" + + " " + + " 10205000" + + " 1" + + " " + + " " + + " Some Error Message - Fallout Handler" + + " Some Error Code - Fallout Handler" + + " Some Source System Error Code- Fallout Handler" + + " " + + ""; + + return xml; + } + + @Test + + public void msoFalloutHandlerWithNotificationurlNoRequestId() throws Exception{ + String method = getClass().getSimpleName() + "." + new Object() { + }.getClass().getEnclosingMethod().getName(); + logger.debug("STARTED TEST: " + method); + //Setup Mocks + setupMocks(); + //Execute Flow + executeFlow(gMsoFalloutHandlerWithNotificationurlNoRequestId()); + //Verify Error + String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode"); + Assert.assertEquals("200", FH_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator")); + } + + public String gMsoFalloutHandlerWithNotificationurlNoRequestId() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " " + + " requestAction" + + " CANCEL" + + " source" + + " www.test.com" + + " 10205000" + + " 1" + + " " + + " " + + " Some Error Message - Fallout Handler" + + " Some Error Code - Fallout Handler" + + " Some Source System Error Code- Fallout Handler" + + " " + + ""; + + return xml; + } + + @Test + + public void msoFalloutHandlerWithNoNotificationurlNoRequestId() throws Exception{ + String method = getClass().getSimpleName() + "." + new Object() { + }.getClass().getEnclosingMethod().getName(); + logger.debug("STARTED TEST: " + method); + //Setup Mocks + setupMocks(); + //Execute Flow + executeFlow(gMsoFalloutHandlerWithNoNotificationurlNoRequestId()); + //Verify Error + String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode"); + Assert.assertEquals("200", FH_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator")); + } + + public String gMsoFalloutHandlerWithNoNotificationurlNoRequestId() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " " + + " requestAction" + + " CANCEL" + + " source" + + " " + + " 10205000" + + " 1" + + " " + + " " + + " Some Error Message - Fallout Handler" + + " Some Error Code - Fallout Handler" + + " Some Source System Error Code- Fallout Handler" + + " " + + ""; + + return xml; + } + +} + diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java new file mode 100644 index 0000000000..fa8823a5b4 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.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.bpmn.common; + +import static org.junit.Assert.assertNotNull; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; + +/** + * Unit test for GenerateVfModuleName.bpmn. + */ + +public class GenerateVfModuleNameIT extends BaseIntegrationTest { + private static final String EOL = "\n"; + + @Test + public void TestGenerateVfModuleNameSuvvess() { + // + String request = + "" + EOL + + " " + EOL + + " CREATE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " STMTN5MMSC22" + EOL + + " STMTN5MMSC22-MMSC::module-0-0" + EOL + + " MMSC::module-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " 00000000-0000-0000-0000-000000000000" + EOL + + " MDTWNJ21" + EOL + + " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + + MockGetGenericVnfById(".*", "GenericFlows/getGenericVnfByNameResponse.xml"); + RuntimeService runtimeService = processEngine.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("vnfName", "STMTN5MMSC20"); + variables.put("vfModuleLabel", "ModuleLabel1"); + variables.put("personaModelId", "extrovert"); + variables.put("vnfId", "12345678-f41f-4822-9323-b75962763d74"); + + runtimeService.startProcessInstanceByKey("GenerateVfModuleName", variables); + String response = BPMNUtil.getVariable(processEngine, "GenerateVfModuleName", "vfModuleName"); + + assertNotNull(response); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetServiceIT.java new file mode 100644 index 0000000000..38d05fe28e --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetServiceIT.java @@ -0,0 +1,560 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance_404; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceSubscription; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_404; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_500; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_404; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_500; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; + + +/** + * Unit Test for the GenericGetService Sub Flow + */ + +public class GenericGetServiceIT extends BaseIntegrationTest { + + + @Test + public void testGenericGetService_success_serviceInstance() throws Exception{ + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + Map variables = new HashMap<>(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789"); + String processId = invokeSubProcess( "GenericGetService", variables); + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); + String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertNotNull(response); + assertEquals(null, workflowException); + } + + + @Test + + public void testGenericGetService_success_serviceSubscription() throws Exception{ + + MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", "GenericFlows/getServiceSubscription.xml"); + + Map variables = new HashMap<>(); + setVariablesSubscription(variables, "", null , "1604-MVM-26", "SDN-ETHERNET-INTERNET"); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); + String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertNotNull(response); + assertEquals(null, workflowException); + } + + @Test + + public void testGenericGetService_success_serviceInstance_byName() throws Exception{ + + MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByName.xml"); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + + Map variables = new HashMap<>(); + setVariablesInstance(variables, null, "1604-MVM-26", null, null); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); + String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("true", obtainUrl); + assertEquals("true", byName); + assertNotNull(response); + assertEquals("200", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + + public void testGenericGetService_success_serviceInstance_byId() throws Exception{ + + MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + + Map variables = new HashMap<>(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); + String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("true", obtainUrl); + assertEquals("false", byName); + assertNotNull(response); + assertEquals("200", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + + public void testGenericGetService_success_serviceInstance_404Response() throws Exception{ + + MockGetServiceInstance_404("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET"); + + Map variables = new HashMap<>(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789"); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertEquals(null, workflowException); + } + + @Test + + public void testGenericGetService_success_serviceSubscription404() throws Exception{ + MockGetServiceSubscription("SDN-ETHERNET-INTERNET", "1604-MVM-26", 404); + + Map variables = new HashMap<>(); + setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", "1604-MVM-26"); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); + String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertNotNull(response); + assertEquals(null, workflowException); + } + + @Test + + public void testGenericGetService_success_serviceInstanceByName404() throws Exception{ + + MockNodeQueryServiceInstanceByName_404("1604-MVM-26"); + + Map variables = new HashMap<>(); + setVariablesInstance(variables, "", "1604-MVM-26", null, null); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("true", byName); + assertEquals("404", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + + public void testGenericGetService_success_serviceInstanceById404() throws Exception{ + + MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET"); + + Map variables = new HashMap<>(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("false", byName); + assertEquals("404", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + + public void testGenericGetService_success_serviceInstanceEmptyResponse() throws Exception{ + + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET"); + + Map variables = new HashMap<>(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789"); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertEquals(null, workflowException); + } + + @Test + + public void testGenericGetService_success_serviceInstanceByNameEmpty() throws Exception{ + MockNodeQueryServiceInstanceByName("1604-MVM-26", ""); + + Map variables = new HashMap<>(); + setVariablesInstance(variables, "", "1604-MVM-26", null, null); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("true", byName); + assertEquals("200", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + + public void testGenericGetService_success_serviceInstanceByIdEmpty() throws Exception{ + + MockNodeQueryServiceInstanceById("MIS[%]2F1604[%]2F0026[%]2FSW_INTERNET", ""); + + Map variables = new HashMap<>(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("false", byName); + assertEquals("200", siUrlResponseCode); + assertEquals(null, workflowException); + } + + + @Test + + public void testGenericGetService_error_serviceInstanceInvalidVariables() throws Exception{ + + Map variables = new HashMap<>(); + setVariablesInstance(variables, null, null, "SDN-ETHERNET-INTERNET", null); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.,workStep=*]"; + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertEquals(expectedWorkflowException, workflowException); + } + + @Test + + public void testGenericGetService_success_serviceSubscriptionInvalidVariables() throws Exception{ + + Map variables = new HashMap<>(); + setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", null); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.,workStep=*]"; + + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertEquals(expectedWorkflowException, workflowException); + } + + @Test + + public void testGenericGetService_error_serviceInstance_getSIBadResponse() throws Exception{ + + MockGetServiceInstance_500("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET"); + + Map variables = new HashMap<>(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "123456789"); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]"; + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertEquals(expectedWorkflowException, workflowException); + } + + @Test + + public void testGenericGetService_error_serviceInstance_getUrlByIdBadResponse() throws Exception{ + + MockNodeQueryServiceInstanceById_500("MIS%2F1604%2F0026%2FSW_INTERNET"); + + Map variables = new HashMap<>(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); + String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]"; + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("false", byName); + assertEquals("500", siUrlResponseCode); + assertEquals(expectedWorkflowException, workflowException); + } + + @Test + + public void testGenericGetService_error_serviceInstance_getUrlByNameBadResponse() throws Exception{ + + MockNodeQueryServiceInstanceByName_500("1604-MVM-26"); + + Map variables = new HashMap<>(); + setVariablesInstance(variables, null, "1604-MVM-26", null, null); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); + String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]"; + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("true", byName); + assertEquals("500", siUrlResponseCode); + assertEquals(expectedWorkflowException, workflowException); + } + + @Test + + public void testGenericGetService_success_serviceInstance_byNameServicePresent() throws Exception{ + + MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml"); + MockGetServiceInstance("AbcBank", "ABC-ST", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + + Map variables = new HashMap<>(); + setVariablesInstance(variables, null, "1604-MVM-26", "XyCorporation", null); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String resourceLink = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_resourceLink",processId); + String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertNotNull(resourceLink); + assertNotNull(response); + assertEquals("200", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + + public void testGenericGetService_success_serviceInstance_byNameServiceNotPresent() throws Exception{ + + MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml"); + MockGetServiceInstance("CorporationNotPresent", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + + Map variables = new HashMap<>(); + setVariablesInstance(variables, null, "1604-MVM-26", "CorporationNotPresent", null); + + String processId = invokeSubProcess( "GenericGetService", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); + String resourceLink = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_resourceLink",processId); + String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); + String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals(null, resourceLink); + assertEquals(" ", response); + assertEquals("200", siUrlResponseCode); + assertEquals(null, workflowException); + } + + private void setVariablesInstance(Map variables, String siId, String siName, String globalCustId, String serviceType) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENGS_serviceInstanceId", siId); + variables.put("GENGS_serviceInstanceName", siName); + variables.put("GENGS_globalCustomerId",globalCustId); + variables.put("GENGS_serviceType", serviceType); + variables.put("GENGS_type", "service-instance"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + } + + private void setVariablesSubscription(Map variables, String siId, String siName, String globalCustId, String serviceType) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENGS_serviceInstanceId", siId); + variables.put("GENGS_serviceInstanceName", siName); + variables.put("GENGS_globalCustomerId",globalCustId); + variables.put("GENGS_serviceType", serviceType); + variables.put("GENGS_type", "service-subscription"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + } + + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetVnfIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetVnfIT.java new file mode 100644 index 0000000000..10c0640b17 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetVnfIT.java @@ -0,0 +1,190 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVceByNameWithDepth; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_500; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByNameWithDepth; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetVceById; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; + +/** + * Please describe the GenericGetVnfTest.java class + * + */ + +public class GenericGetVnfIT extends BaseIntegrationTest { + + @Test + + public void testGenericGetVnf_success_genericVnf() throws Exception{ + MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfByNameResponse.xml"); + + Map variables = new HashMap<>(); + setVariables(variables, "testVnfId123", "testVnfName123", "generic-vnf"); + + String processId = invokeSubProcess( "GenericGetVnf", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_FoundIndicator",processId); + String vnf = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_vnf",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_getVnfByName",processId); + String response = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowResponse",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowException",processId); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("false", byName); + assertNotNull(response); + assertNotNull(vnf); + assertEquals(null, workflowException); + + } + + @Test + + public void testGenericGetVnf_success_vce() throws Exception{ + MockGetVceById("testVnfId123[?]depth=1", "GenericFlows/getVceResponse.xml"); + + Map variables = new HashMap<>(); + setVariables(variables, "testVnfId123", "testVnfName123", "vce"); + + String processId = invokeSubProcess( "GenericGetVnf", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_FoundIndicator",processId); + String vnf = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_vnf",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_getVnfByName",processId); + String response = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowResponse",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowException",processId); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("false", byName); + assertNotNull(response); + assertNotNull(vnf); + assertEquals(null, workflowException); + + } + + @Test + + public void testGenericGetVnf_success_genericVnfByName() throws Exception{ + MockGetGenericVnfByNameWithDepth("testVnfName123", 1, "GenericFlows/getGenericVnfResponse.xml"); + + Map variables = new HashMap<>(); + setVariables(variables, "", "testVnfName123", "generic-vnf"); + + String processId = invokeSubProcess( "GenericGetVnf", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_FoundIndicator",processId); + String vnf = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_vnf",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_getVnfByName",processId); + String response = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowResponse",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowException",processId); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("true", byName); + assertNotNull(response); + assertNotNull(vnf); + assertEquals(null, workflowException); + + } + + @Test + + public void testGenericGetVnf_success_vceByName() throws Exception{ + MockGetGenericVceByNameWithDepth("testVnfName123", 1, "GenericFlows/getVceByNameResponse.xml"); + + Map variables = new HashMap<>(); + setVariables(variables, null, "testVnfName123", "vce"); + + String processId = invokeSubProcess( "GenericGetVnf", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_FoundIndicator",processId); + String vnf = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_vnf",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_getVnfByName",processId); + String response = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowResponse",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowException",processId); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("true", byName); + assertNotNull(response); + assertNotNull(vnf); + assertEquals(null, workflowException); + + } + + + + @Test + public void testGenericGetVnf_error_genericVnf500() throws Exception{ + + MockGetGenericVnfById_500("testVnfId123_500"); + + Map variables = new HashMap<>(); + setVariables(variables, "testVnfId123_500", "testVnfId123_500", "generic-vnf"); + + String processId = invokeSubProcess( "GenericGetVnf", variables); + + + String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_SuccessIndicator",processId); + String found = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_FoundIndicator",processId); + String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowException",processId); + String byName = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_getVnfByName",processId); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetVnf,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]"; + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("false", byName); + + assertEquals(expectedWorkflowException, workflowException); + } + + private void setVariables(Map variables, String vnfId, String vnfName, String type) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENGV_vnfId", vnfId); + variables.put("GENGV_vnfName",vnfName); + variables.put("GENGV_type", type); + variables.put("mso-request-id", UUID.randomUUID().toString()); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java new file mode 100644 index 0000000000..744ef9bea5 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.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.bpmn.common; + +import static org.onap.so.bpmn.mock.StubResponseDatabase.MockPostRequestDB; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.TaskService; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.engine.task.TaskQuery; +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; +import org.onap.so.logger.MsoLogger; + +/** + * Unit test for RainyDayHandler.bpmn. + */ +public class ManualHandlingIT extends BaseIntegrationTest { + MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,ManualHandlingIT.class); + + @Test + public void TestManualHandlingSuccess() { + MockPostRequestDB(); + + Map variables = new HashMap<>(); + variables.put("isDebugLogEnabled","true"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceType", "X"); + variables.put("vnfType", "Y"); + variables.put("currentActivity", "BB1"); + variables.put("workStep", "1"); + variables.put("failedActivity", "AAI"); + variables.put("vnfName", "vSAMP12"); + variables.put("errorCode", "123"); + variables.put("errorText", "update failed"); + variables.put("validResponses", "Rollback"); + variables.put("vnfName", "vSAMP1"); + + + String businessKey = UUID.randomUUID().toString(); + invokeSubProcess("ManualHandling", businessKey, variables); + + try { + Thread.sleep(5); + } catch (Exception e) { + + } + + TaskService taskService = processEngine.getTaskService(); + + TaskQuery q = taskService.createTaskQuery(); + + List tasks = q.orderByTaskCreateTime().asc().list(); + + for (Task task : tasks) { + logger.debug("TASK ID: " + task.getId()); + logger.debug("TASK NAME: " + task.getName()); + + try { + logger.debug("Completing the task"); + Map completeVariables = new HashMap<>(); + completeVariables.put("responseValue", "skip"); + taskService.complete(task.getId(), completeVariables); + } catch(Exception e) { + logger.debug("GOT EXCEPTION: " + e.getMessage()); + } + } + + waitForProcessEnd(businessKey, 100000); + + Assert.assertTrue(isProcessEnded(businessKey)); + } +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java new file mode 100644 index 0000000000..819962f16c --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java @@ -0,0 +1,39 @@ +/*- + * ============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.bpmn.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +public class MockAAIDeleteGenericVnf { + public MockAAIDeleteGenericVnf(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021")) + .willReturn(aResponse() + .withStatus(200))); + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java new file mode 100644 index 0000000000..9cb10a0494 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java @@ -0,0 +1,53 @@ +/*- + * ============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.bpmn.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +public class MockAAIDeleteVfModule { + + public MockAAIDeleteVfModule() + { + stubFor(delete(urlMatching( + "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073")) + .willReturn(aResponse().withStatus(200))); + stubFor(delete(urlMatching( + "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075")) + .willReturn(aResponse().withStatus(200))); + stubFor(delete(urlMatching( + "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078")) + .willReturn(aResponse().withStatus(200))); + stubFor(delete(urlMatching( + "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077")) + .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*")) + .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml"))); + + stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*")) + .willReturn(aResponse().withStatus(200))); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java new file mode 100644 index 0000000000..b46d528cc5 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java @@ -0,0 +1,340 @@ +/*- + * ============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.bpmn.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +public class MockAAIGenericVnfSearch { + + private static final String EOL = "\n"; + + public MockAAIGenericVnfSearch(){ + String body; + + // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule + + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1")) + .willReturn(aResponse() + .withStatus(404) + .withHeader("Content-Type", "text/xml") + .withBody("Generic VNF Not Found"))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1")) + .willReturn(aResponse() + .withStatus(404) + .withHeader("Content-Type", "text/xml") + .withBody("Generic VNF Not Found"))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 1508691" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 1508692" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + body = + "" + EOL + + " 2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4" + EOL + + " STMTN5MMSC20" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 1508691" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC20-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 1508692" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " STMTN5MMSC20-MMSC::module-1-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " 1.0" + EOL + + " false" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 1508692" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + // The following stubs are for DeleteAAIVfModule + + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1")) + .willReturn(aResponse() + .withStatus(404) + .withHeader("Content-Type", "text/xml") + .withBody("Generic VNF Not Found"))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000021" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000073" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c720" + EOL + + " STMTN5MMSC20" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000020" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " STMTN5MMSC20-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000074" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL + + " STMTN5MMSC20-MMSC::module-1-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL + + " 1.0" + EOL + + " false" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000075" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c719" + EOL + + " STMTN5MMSC19" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000019" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a76" + EOL + + " STMTN5MMSC19-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a76" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000076" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL + + " STMTN5MMSC19-MMSC::module-1-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL + + " 1.0" + EOL + + " false" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000077" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c718" + EOL + + " STMTN5MMSC18" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000018" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL + + " STMTN5MMSC18-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000078" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000021" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000073" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java new file mode 100644 index 0000000000..6a9ff2a4a8 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java @@ -0,0 +1,35 @@ +/*- + * ============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.bpmn.common; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +public class MockLoggerDelegate implements JavaDelegate { + @Override + public void execute(DelegateExecution execution) throws Exception { + System.out.println("\n\n ..." + MockLoggerDelegate.class.getName() + " invoked by " + "processDefinitionId=" + + execution.getProcessDefinitionId() + ", activtyId=" + execution.getCurrentActivityId() + + ", activtyName='" + execution.getCurrentActivityName() + "'" + ", processInstanceId=" + + execution.getProcessInstanceId() + ", businessKey=" + execution.getProcessBusinessKey() + + ", executionId=" + execution.getId() + " \n\n"); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java new file mode 100644 index 0000000000..9bcc5593e2 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java @@ -0,0 +1,761 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid; +import static org.onap.so.bpmn.mock.StubResponseOof.mockOof; +import static org.onap.so.bpmn.mock.StubResponseOof.mockOof_500; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.core.domain.AllottedResource; +import org.onap.so.bpmn.core.domain.CloudFlavor; +import org.onap.so.bpmn.core.domain.HomingSolution; +import org.onap.so.bpmn.core.domain.ModelInfo; +import org.onap.so.bpmn.core.domain.NetworkResource; +import org.onap.so.bpmn.core.domain.Resource; +import org.onap.so.bpmn.core.domain.ServiceDecomposition; +import org.onap.so.bpmn.core.domain.ServiceInstance; +import org.onap.so.bpmn.core.domain.VnfResource; +import org.onap.so.bpmn.mock.FileUtil; + + +/** + * Test the OOF Homing subflow building block. + */ +@Ignore +public class OofHomingIT extends BaseIntegrationTest { + + ServiceDecomposition serviceDecomposition = new ServiceDecomposition(); + String subscriber = ""; + String subscriber2 = ""; + + private final CallbackSet callbacks = new CallbackSet(); + + public OofHomingIT() throws IOException { + String oofCallback = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackInfraVnf.json"); + String oofCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf.json"); + String oofCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf2Net.json"); + + String oofCallbackNoSolution = FileUtil. + readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound.json"); + String oofCallbackPolicyException = FileUtil. + readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException.json"); + String oofCallbackServiceException = FileUtil. + readResourceFile("__files/BuildingBlocks/oofCallbackServiceException.json"); + + callbacks.put("oof", JSON, "oofResponse", oofCallback); + callbacks.put("oof2", JSON, "oofResponse", oofCallback2); + callbacks.put("oof3", JSON, "oofResponse", oofCallback3); + callbacks.put("oofNoSol", JSON, "oofResponse", oofCallbackNoSolution); + callbacks.put("oofPolicyEx", JSON, "oofResponse", oofCallbackPolicyException); + callbacks.put("oofServiceEx", JSON, "oofResponse", oofCallbackServiceException); + + // Service Model + ModelInfo sModel = new ModelInfo(); + sModel.setModelCustomizationName("testModelCustomizationName"); + sModel.setModelInstanceName("testModelInstanceName"); + sModel.setModelInvariantUuid("testModelInvariantId"); + sModel.setModelName("testModelName"); + sModel.setModelUuid("testModelUuid"); + sModel.setModelVersion("testModelVersion"); + // Service Instance + ServiceInstance si = new ServiceInstance(); + si.setInstanceId("testServiceInstanceId123"); + // Allotted Resources + List arList = new ArrayList(); + AllottedResource ar = new AllottedResource(); + ar.setResourceId("testResourceIdAR"); + ar.setNfFunction("testARFunctionName"); + ModelInfo arModel = new ModelInfo(); + arModel.setModelCustomizationUuid("testModelCustomizationUuidAR"); + arModel.setModelInvariantUuid("testModelInvariantIdAR"); + arModel.setModelName("testModelNameAR"); + arModel.setModelVersion("testModelVersionAR"); + arModel.setModelUuid("testARModelUuid"); + arModel.setModelType("testModelTypeAR"); + ar.setModelInfo(arModel); + AllottedResource ar2 = new AllottedResource(); + ar2.setResourceId("testResourceIdAR2"); + ar2.setNfFunction("testAR2FunctionName"); + ModelInfo arModel2 = new ModelInfo(); + arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2"); + arModel2.setModelInvariantUuid("testModelInvariantIdAR2"); + arModel2.setModelName("testModelNameAR2"); + arModel2.setModelVersion("testModelVersionAR2"); + arModel2.setModelUuid("testAr2ModelUuid"); + arModel2.setModelType("testModelTypeAR2"); + ar2.setModelInfo(arModel2); + arList.add(ar); + arList.add(ar2); + // Vnfs + List vnfList = new ArrayList(); + VnfResource vnf = new VnfResource(); + vnf.setResourceId("testResourceIdVNF"); + vnf.setNfFunction("testVnfFunctionName"); + ArrayList flavors = new ArrayList<>(); + CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx"); + CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx"); + flavors.add(flavor1); + flavors.add(flavor2); + vnf.getHomingSolution().setFlavors(flavors); + ModelInfo vnfModel = new ModelInfo(); + vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF"); + vnfModel.setModelInvariantUuid("testModelInvariantIdVNF"); + vnfModel.setModelName("testModelNameVNF"); + vnfModel.setModelVersion("testModelVersionVNF"); + vnfModel.setModelUuid("testVnfModelUuid"); + vnfModel.setModelType("testModelTypeVNF"); + vnf.setModelInfo(vnfModel); + vnfList.add(vnf); + System.out.println("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString()); + serviceDecomposition.setModelInfo(sModel); + serviceDecomposition.setAllottedResources(arList); + serviceDecomposition.setVnfResources(vnfList); + serviceDecomposition.setServiceInstance(si); + + // Subscriber + subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}"; + subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}"; + } + + @Test + public void testHoming_success_2AR1Vnf() throws Exception { + + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "oof2"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, + "serviceDecomposition"); + String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); + + Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); + HomingSolution resourceARHoming = resourceAR.getHomingSolution(); + Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); + HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution(); + Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); + HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution(); + String resourceARHomingString = resourceARHoming.toString(); + resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); + String resourceARHoming2String = resourceARHoming2.toString(); + resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); + String resourceVNFHomingString = resourceVNFHoming.toString(); + resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); + expectedOofRequest = expectedOofRequest.replaceAll("\\s+", ""); + + assertNull(workflowException); + assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", + resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx", + "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", + "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), + resourceARHomingString); + assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", + resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2", + null, null), resourceARHoming2String); + assertEquals(homingSolutionCloud("cloud","aic", "testCloudRegionId3", + true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", + "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), + resourceVNFHomingString); + assertEquals(verifyOofRequest(), expectedOofRequest); + } + + @Test + public void testHoming_success_2AR1Vnf2Net() throws Exception { + + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables2(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "oof3"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, + "serviceDecomposition"); + String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); + + Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); + HomingSolution resourceARHoming = resourceAR.getHomingSolution(); + Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); + HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution(); + Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); + HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution(); + Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet"); + HomingSolution resourceNetHoming = resourceNet.getHomingSolution(); + Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2"); + HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution(); + + String resourceARHomingString = resourceARHoming.toString(); + resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); + String resourceARHoming2String = resourceARHoming2.toString(); + resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); + String resourceVNFHomingString = resourceVNFHoming.toString(); + resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); + String resourceNetHomingString = resourceNetHoming.toString(); + resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " "); + String resourceNetHoming2String = resourceNetHoming2.toString(); + resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " "); + expectedOofRequest = expectedOofRequest.replaceAll("\\s+", ""); + + + assertNull(workflowException); + assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", + resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx", + "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", + "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), + resourceARHomingString); + assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", + resourceARHoming2.getVnf().getResourceId(), + "aic", "testCloudRegionId2", + null, null), resourceARHoming2String); + assertEquals(homingSolutionCloud("cloud","aic", + "testCloudRegionId3", + true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", + "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), + resourceVNFHomingString); + assertEquals(homingSolutionService("service", "testServiceInstanceIdNet", + "testVnfHostNameNet", resourceNetHoming.getVnf().getResourceId(),"aic", + "testCloudRegionIdNet", + null, null), resourceNetHomingString); + assertEquals(homingSolutionCloud("cloud", "aic", + "testCloudRegionIdNet2", + false, "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"", + "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""), + resourceNetHoming2String); + assertEquals(verifyOofRequest(), expectedOofRequest); + + } + + @Test + public void testHoming_success_vnfResourceList() throws Exception { + + // Create a Service Decomposition + MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4", + "/BuildingBlocks/oofCatalogResp.json"); + String busKey = UUID.randomUUID().toString(); + Map vars = new HashMap<>(); + setVariablesForServiceDecomposition(vars, "testRequestId123", + "ff5256d2-5a33-55df-13ab-12abad84e7ff"); + invokeSubProcess("DecomposeService", busKey, vars); + + ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition"); + System.out.println("In testHoming_success_vnfResourceList, ServiceDecomposition = " + sd); + List vnfResourceList = sd.getVnfResources(); + vnfResourceList.get(0).setResourceId("test-resource-id-000"); + + // Invoke Homing + + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("homingService", "oof"); + variables.put("isDebugLogEnabled", "true"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", sd); + variables.put("subscriberInfo", subscriber2); + HashMap customerLocation = new HashMap(); + customerLocation.put("customerLatitude", "32.89748"); + customerLocation.put("customerLongitude", "-97.040443"); + customerLocation.put("customerName", "xyz"); + variables.put("customerLatitude", "32.89748"); + variables.put("customerLongitude", "-97.040443"); + variables.put("customerName", "xyz"); + variables.put("customerLocation", customerLocation); + variables.put("cloudOwner", "amazon"); + variables.put("cloudRegionId", "TNZED"); + + invokeSubProcess("Homing", businessKey, variables); + injectWorkflowMessages(callbacks, "oof3"); + waitForProcessEnd(businessKey, 10000); + + //Get Variables + + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, + "serviceDecomposition"); + System.out.println("serviceDecompositionExp is: " + serviceDecompositionExp); + + Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000"); + System.out.println("resourceVnf is: " + resourceVnf); + HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution(); + + String resourceVnfHomingString = resourceVnfHoming.toString(); + System.out.println("resourceVnfHomingString is: " + resourceVnfHomingString); + resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " "); + System.out.println("Now resourceVnfHomingString is: " + resourceVnfHomingString); + + assertNull(workflowException); + + //Verify request + String oofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); + System.out.println("oofRequest is: " + oofRequest); + assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf"). + replaceAll("\n", "").replaceAll("\r", ""). + replaceAll("\t", ""), oofRequest.replaceAll("\n", ""). + replaceAll("\r", "").replaceAll("\t", "")); + + //System.out.println("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId()); + + assertEquals(homingSolutionService("service", "service-instance-01234", + "MDTNJ01", "test-resource-id-000","att-aic", + "mtmnj1a", + "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," + + " \"j1d563e8-e714-4393-8f99-cc480144a05e\"", + "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," + + " \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString); + } + + @Test + public void testHoming_success_existingLicense() throws Exception { + + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + setVariablesExistingLicense(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "sniro"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition"); + String oofRequest = (String) getVariableFromHistory(businessKey, "sniroRequest"); + + Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); + HomingSolution resourceARHoming = (HomingSolution) resourceAR.getHomingSolution(); + Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); + HomingSolution resourceARHoming2 = (HomingSolution) resourceAR2.getHomingSolution(); + Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); + HomingSolution resourceVNFHoming = (HomingSolution) resourceVNF.getHomingSolution(); + String resourceARHomingString = resourceARHoming.toString(); + resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); + String resourceARHoming2String = resourceARHoming2.toString(); + resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); + String resourceVNFHomingString = resourceVNFHoming.toString(); + resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); + oofRequest = oofRequest.replaceAll("\\s+", ""); + + assertNull(workflowException); + assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", + "aic", "dfwtx", "KDTNJ01", + "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", + "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), + resourceARHomingString); + assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", + resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2", + null, null), resourceARHoming2String); + assertEquals(homingSolutionCloud("cloud", "aic", + "testCloudRegionId3", + false, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", + "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), + resourceVNFHomingString); + assertEquals(verifyOofRequestExistingLicense(), oofRequest); + + } + + @Test + public void testHoming_error_inputVariable() throws Exception { + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables3(variables); + + invokeSubProcess("Homing", businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required " + + "input variable is missing or null,workStep=*]", workflowException.toString()); + } + + @Test + public void testHoming_error_badResponse() throws Exception { + mockOof_500(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=401,errorMessage=Internal Error - BasicAuth value null,workStep=*]", workflowException.toString()); + } + + @Test + public void testHoming_error_oofNoSolution() throws Exception { + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "oofNoSol"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + Boolean errorMatch = workflowException.toString().contains("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " + + "Response contains error: Unable to find any candidate for demand *** Response:"); + assert(errorMatch); + } + + @Test + public void testHoming_error_oofPolicyException() throws Exception { + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "oofPolicyEx"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " + + "Response contains a Request Error Policy Exception: Message content size exceeds the allowable " + + "limit]", workflowException.toString()); + } + + @Test + public void testHoming_error_oofServiceException() throws Exception { + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + injectWorkflowMessages(callbacks, "oofServiceEx"); + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " + + "Response contains a Request Error Service Exception: OOF PlacementError: " + + "requests.exceptions.HTTPError: 404 Client Error: Not Found for " + + "url: http://192.168.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]", + workflowException.toString()); + } + + + private void setVariables(Map variables) { + variables.put("homingService", "oof"); + HashMap customerLocation = new HashMap(); + customerLocation.put("customerLatitude", "32.89748"); + customerLocation.put("customerLongitude", "-97.040443"); + customerLocation.put("customerName", "xyz"); + variables.put("customerLatitude", "32.89748"); + variables.put("customerLongitude", "-97.040443"); + variables.put("customerName", "xyz"); + variables.put("customerLocation", customerLocation); + variables.put("cloudOwner", "amazon"); + variables.put("cloudRegionId", "TNZED"); + variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR"); + variables.put("vgMuxInfraModelId", "testArModelUuid"); + // variables.put("mso-request-id", "testRequestId"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId123"); + variables.put("serviceInstanceName", "testServiceName"); + variables.put("serviceDecomposition", serviceDecomposition); + variables.put("subscriberInfo", subscriber2); + } + + private void setVariables2(Map variables) { + List netList = new ArrayList(); + NetworkResource net = new NetworkResource(); + net.setResourceId("testResourceIdNet"); + ModelInfo netModel = new ModelInfo(); + netModel.setModelCustomizationUuid("testModelCustomizationUuidNet"); + netModel.setModelInvariantUuid("testModelInvariantIdNet"); + netModel.setModelName("testModelNameNet"); + netModel.setModelVersion("testModelVersionNet"); + net.setModelInfo(netModel); + netList.add(net); + NetworkResource net2 = new NetworkResource(); + net2.setResourceId("testResourceIdNet2"); + ModelInfo netModel2 = new ModelInfo(); + netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2"); + netModel2.setModelCustomizationName("testModelCustomizationNameNet2"); + netModel2.setModelInvariantUuid("testModelInvariantIdNet2"); + netModel2.setModelName("testModelNameNet2"); + netModel2.setModelVersion("testModelVersionNet2"); + net2.setModelInfo(netModel2); + netList.add(net2); + serviceDecomposition.setNetworkResources(netList); + + variables.put("homingService", "oof"); + HashMap customerLocation = new HashMap(); + customerLocation.put("customerLatitude", "32.89748"); + customerLocation.put("customerLongitude", "-97.040443"); + customerLocation.put("customerName", "xyz"); + variables.put("customerLatitude", "32.89748"); + variables.put("customerLongitude", "-97.040443"); + variables.put("customerName", "xyz"); + variables.put("customerLocation", customerLocation); + variables.put("cloudOwner", "amazon"); + variables.put("cloudRegionId", "TNZED"); + variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR"); + variables.put("vgMuxInfraModelId", "testArModelUuid"); + variables.put("isDebugLogEnabled", "true"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId123"); + variables.put("serviceInstanceName", "testServiceName"); + variables.put("serviceDecomposition", serviceDecomposition); + variables.put("subscriberInfo", subscriber2); + } + + private void setVariables3(Map variables) { + variables.put("homingService", "oof"); + HashMap customerLocation = new HashMap(); + customerLocation.put("customerLatitude", "32.89748"); + customerLocation.put("customerLongitude", "-97.040443"); + customerLocation.put("customerName", "xyz"); + variables.put("customerLatitude", "32.89748"); + variables.put("customerLongitude", "-97.040443"); + variables.put("customerName", "xyz"); + variables.put("customerLocation", customerLocation); + variables.put("cloudOwner", "amazon"); + variables.put("cloudRegionId", "TNZED"); + variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR"); + variables.put("vgMuxInfraModelId", "testArModelUuid"); + variables.put("isDebugLogEnabled", "true"); + // variables.put("mso-request-id", "testRequestId"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId123"); + variables.put("serviceInstanceName", "testServiceName"); + variables.put("serviceDecomposition", null); + variables.put("subscriberInfo", subscriber2); + } + + private void setVariablesExistingLicense(Map variables) { + HomingSolution currentHomingSolution = new HomingSolution(); + serviceDecomposition.getVnfResources().get(0).setCurrentHomingSolution(currentHomingSolution); + serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1"); + serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2"); + + serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1"); + serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2"); + + variables.put("isDebugLogEnabled", "true"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", serviceDecomposition); + variables.put("subscriberInfo", subscriber2); + + } + + private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname, + String vnfResourceId, String cloudOwner, + String cloudRegionId, String enList, + String licenseList){ + + String solution = ""; + if(enList == null){ + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + + serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + + cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId + + "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :" + + " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { }," + + " \"rehome\" : false } }"; + }else{ + //language=JSON + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + + serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + + cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :" + + " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :" + + " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :" + + " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }"; + } + return solution; + } + + private String homingSolutionCloud(String type, String cloudOwner, + String cloudRegionId, Boolean flavors, String enList, + String licenseList){ + String solution = ""; + if(enList == null){ + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + + "\", \"license\" : { }, \"rehome\" : false } }"; + } else if (flavors && enList == null){ + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + + "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " + + "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " + + "\"license\" : { }, \"rehome\" : false } }"; + } else if (flavors) { + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + + "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " + + "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " + + "\"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + + licenseList + " ] }, \"rehome\" : false } }"; + } else { + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + + "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + + licenseList + " ] }, \"rehome\" : false } }"; + } + return solution; + } + + private void setVariablesForServiceDecomposition(Map variables, String requestId, String siId) { + variables.put("homingService", "oof"); + variables.put("isDebugLogEnabled", "true"); + variables.put("mso-request-id", requestId); + variables.put("msoRequestId", requestId); + variables.put("serviceInstanceId", siId); + HashMap customerLocation = new HashMap(); + customerLocation.put("customerLatitude", "32.89748"); + customerLocation.put("customerLongitude", "-97.040443"); + customerLocation.put("customerName", "xyz"); + variables.put("customerLatitude", "32.89748"); + variables.put("customerLongitude", "-97.040443"); + variables.put("customerName", "xyz"); + variables.put("customerLocation", customerLocation); + variables.put("cloudOwner", "amazon"); + variables.put("cloudRegionId", "TNZED"); + + + String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":" + + "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}"; + variables.put("serviceModelInfo", serviceModelInfo); + } + + private String verifyOofRequest() { + String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," + + "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\"," + + "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"]," + + "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":" + + "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":" + + "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," + + "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"testARFunctionName\"" + + ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":" + + "\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\"," + + "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\",\"modelType\":" + + "\"\",\"modelVersion\":\"\",\"modelCustomizationName\":\"\"}}," + + "{\"resourceModuleName\":\"testAR2FunctionName\",\"serviceResourceId\":\"testResourceIdAR2\"," + + "\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\"," + + "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\"," + + "\"modelType\":\"\",\"modelVersion\":\"\"," + + "\"modelCustomizationName\":\"\"}},{\"resourceModuleName\":\"testVnfFunctionName\",\"serviceResourceId\":\"" + + "testResourceIdVNF\",\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\"" + + ":\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":\"" + + "testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\"" + + ",\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":" + + "{\"serviceInstanceId\":\"testServiceInstanceId123\"," + + "\"serviceName\":\"testServiceName\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" + + "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\"," + + "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" + + "\"}}}"; + return request; + } + + private String verifyOofRequestExistingLicense(){ + String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," + + "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\"," + + "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"]," + + "\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\"," + + "\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":" + + "\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":" + + "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," + + "\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":" + + "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\"," + + "\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\"," + + "\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\"," + + "\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":" + + "\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":" + + "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":" + + "\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\"," + + "\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\"," + + "\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\"," + + "\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":" + + "[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\"," + + "\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":" + + "\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\"," + + "\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\"," + + "\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}," + + "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\"," + + "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\"," + + "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":" + + "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}"; + return request; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java new file mode 100644 index 0000000000..33e444310f --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java @@ -0,0 +1,771 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + + +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.core.domain.AllottedResource; +import org.onap.so.bpmn.core.domain.CloudFlavor; +import org.onap.so.bpmn.core.domain.HomingSolution; +import org.onap.so.bpmn.core.domain.ModelInfo; +import org.onap.so.bpmn.core.domain.NetworkResource; +import org.onap.so.bpmn.core.domain.Resource; +import org.onap.so.bpmn.core.domain.ServiceDecomposition; +import org.onap.so.bpmn.core.domain.ServiceInstance; +import org.onap.so.bpmn.core.domain.VnfResource; +import org.onap.so.bpmn.mock.FileUtil; +import org.onap.so.logger.MsoLogger; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid; +import static org.onap.so.bpmn.mock.StubResponseOof.mockOof; +import static org.onap.so.bpmn.mock.StubResponseOof.mockOof_500; + + +/** + * Test the OOF Homing subflow building block. + */ +@Ignore +public class OofHomingTestIT extends BaseIntegrationTest { + + MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class); + + ServiceDecomposition serviceDecomposition = new ServiceDecomposition(); + String subscriber = ""; + String subscriber2 = ""; + + private final CallbackSet callbacks = new CallbackSet(); + + public OofHomingTestIT() throws IOException { + String oofCallback = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackInfraVnf"); + String oofCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf"); + String oofCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf2Net"); + + String oofCallbackNoSolution = FileUtil. + readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound"); + String oofCallbackPolicyException = FileUtil. + readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException"); + String oofCallbackServiceException = FileUtil. + readResourceFile("__files/BuildingBlocks/oofCallbackServiceException"); + + callbacks.put("oof", JSON, "oofResponse", oofCallback); + callbacks.put("oof2", JSON, "oofResponse", oofCallback2); + callbacks.put("oof3", JSON, "oofResponse", oofCallback3); + callbacks.put("oofNoSol", JSON, "oofResponse", oofCallbackNoSolution); + callbacks.put("oofPolicyEx", JSON, "oofResponse", oofCallbackPolicyException); + callbacks.put("oofServiceEx", JSON, "oofResponse", oofCallbackServiceException); + + // Service Model + ModelInfo sModel = new ModelInfo(); + sModel.setModelCustomizationName("testModelCustomizationName"); + sModel.setModelInstanceName("testModelInstanceName"); + sModel.setModelInvariantUuid("testModelInvariantId"); + sModel.setModelName("testModelName"); + sModel.setModelUuid("testModelUuid"); + sModel.setModelVersion("testModelVersion"); + // Service Instance + ServiceInstance si = new ServiceInstance(); + si.setInstanceId("testServiceInstanceId123"); + // Allotted Resources + List arList = new ArrayList(); + AllottedResource ar = new AllottedResource(); + ar.setResourceId("testResourceIdAR"); + ar.setResourceInstanceName("testARInstanceName"); + ModelInfo arModel = new ModelInfo(); + arModel.setModelCustomizationUuid("testModelCustomizationUuidAR"); + arModel.setModelInvariantUuid("testModelInvariantIdAR"); + arModel.setModelName("testModelNameAR"); + arModel.setModelVersion("testModelVersionAR"); + arModel.setModelUuid("testARModelUuid"); + arModel.setModelType("testModelTypeAR"); + ar.setModelInfo(arModel); + AllottedResource ar2 = new AllottedResource(); + ar2.setResourceId("testResourceIdAR2"); + ar2.setResourceInstanceName("testAR2InstanceName"); + ModelInfo arModel2 = new ModelInfo(); + arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2"); + arModel2.setModelInvariantUuid("testModelInvariantIdAR2"); + arModel2.setModelName("testModelNameAR2"); + arModel2.setModelVersion("testModelVersionAR2"); + arModel2.setModelUuid("testAr2ModelUuid"); + arModel2.setModelType("testModelTypeAR2"); + ar2.setModelInfo(arModel2); + arList.add(ar); + arList.add(ar2); + // Vnfs + List vnfList = new ArrayList(); + VnfResource vnf = new VnfResource(); + vnf.setResourceId("testResourceIdVNF"); + vnf.setResourceInstanceName("testVnfInstanceName"); + ArrayList flavors = new ArrayList<>(); + CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx"); + CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx"); + flavors.add(flavor1); + flavors.add(flavor2); + vnf.getHomingSolution().setFlavors(flavors); + ModelInfo vnfModel = new ModelInfo(); + vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF"); + vnfModel.setModelInvariantUuid("testModelInvariantIdVNF"); + vnfModel.setModelName("testModelNameVNF"); + vnfModel.setModelVersion("testModelVersionVNF"); + vnfModel.setModelUuid("testVnfModelUuid"); + vnfModel.setModelType("testModelTypeVNF"); + vnf.setModelInfo(vnfModel); + vnfList.add(vnf); + logger.debug("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString()); + serviceDecomposition.setModelInfo(sModel); + serviceDecomposition.setAllottedResources(arList); + serviceDecomposition.setVnfResources(vnfList); + serviceDecomposition.setServiceInstance(si); + + // Subscriber + subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}"; + subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}"; + } + + @Test + + public void testHoming_success_2AR1Vnf() throws Exception { + + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "oof2"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, + "serviceDecomposition"); + String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); + + Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); + HomingSolution resourceARHoming = resourceAR.getHomingSolution(); + Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); + HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution(); + Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); + HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution(); + String resourceARHomingString = resourceARHoming.toString(); + resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); + String resourceARHoming2String = resourceARHoming2.toString(); + resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); + String resourceVNFHomingString = resourceVNFHoming.toString(); + resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); + expectedOofRequest = expectedOofRequest.replaceAll("\\s+", ""); + + assertNull(workflowException); + assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", + resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx", + "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", + "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), + resourceARHomingString); + assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", + resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2", + null, null), resourceARHoming2String); + assertEquals(homingSolutionCloud("cloud","aic", "testCloudRegionId3", + true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", + "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), + resourceVNFHomingString); + assertEquals(verifyOofRequest(), expectedOofRequest); + } + + @Test + + public void testHoming_success_2AR1Vnf2Net() throws Exception { + + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables2(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "oof3"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, + "serviceDecomposition"); + String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); + + Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); + HomingSolution resourceARHoming = resourceAR.getHomingSolution(); + Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); + HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution(); + Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); + HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution(); + Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet"); + HomingSolution resourceNetHoming = resourceNet.getHomingSolution(); + Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2"); + HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution(); + + String resourceARHomingString = resourceARHoming.toString(); + resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); + String resourceARHoming2String = resourceARHoming2.toString(); + resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); + String resourceVNFHomingString = resourceVNFHoming.toString(); + resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); + String resourceNetHomingString = resourceNetHoming.toString(); + resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " "); + String resourceNetHoming2String = resourceNetHoming2.toString(); + resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " "); + expectedOofRequest = expectedOofRequest.replaceAll("\\s+", ""); + + + assertNull(workflowException); + assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", + resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx", + "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", + "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), + resourceARHomingString); + assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", + resourceARHoming2.getVnf().getResourceId(), + "aic", "testCloudRegionId2", + null, null), resourceARHoming2String); + assertEquals(homingSolutionCloud("cloud","aic", + "testCloudRegionId3", + true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", + "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), + resourceVNFHomingString); + assertEquals(homingSolutionService("service", "testServiceInstanceIdNet", + "testVnfHostNameNet", resourceNetHoming.getVnf().getResourceId(),"aic", + "testCloudRegionIdNet", + null, null), resourceNetHomingString); + assertEquals(homingSolutionCloud("cloud", "aic", + "testCloudRegionIdNet2", + false, "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"", + "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""), + resourceNetHoming2String); + assertEquals(verifyOofRequest(), expectedOofRequest); + + } + + @Test + + + public void testHoming_success_vnfResourceList() throws Exception { + + // Create a Service Decomposition + MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4", + "/BuildingBlocks/oofCatalogResp.json"); + String busKey = UUID.randomUUID().toString(); + Map vars = new HashMap<>(); + setVariablesForServiceDecomposition(vars, "testRequestId123", + "ff5256d2-5a33-55df-13ab-12abad84e7ff"); + invokeSubProcess("DecomposeService", busKey, vars); + + ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, + "serviceDecomposition"); + logger.debug("In testHoming_success_vnfResourceList, ServiceDecomposition = " + sd); + List vnfResourceList = sd.getVnfResources(); +//logger.debug(" vnfResourceList = " + vnfResourceList); + vnfResourceList.get(0).setResourceId("test-resource-id-000"); + + // Invoke Homing + + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("homingService", "oof"); + variables.put("isDebugLogEnabled", "true"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", sd); + variables.put("subscriberInfo", subscriber2); + HashMap customerLocation = new HashMap(); + customerLocation.put("customerLatitude", "32.89748"); + customerLocation.put("customerLongitude", "-97.040443"); + customerLocation.put("customerName", "xyz"); + variables.put("customerLatitude", "32.89748"); + variables.put("customerLongitude", "-97.040443"); + variables.put("customerName", "xyz"); + variables.put("customerLocation", customerLocation); + variables.put("cloudOwner", "amazon"); + variables.put("cloudRegionId", "TNZED"); + + invokeSubProcess("Homing", businessKey, variables); + injectWorkflowMessages(callbacks, "oof3"); + waitForProcessEnd(businessKey, 10000); + + //Get Variables + + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, + "serviceDecomposition"); + logger.debug("serviceDecompositionExp is: " + serviceDecompositionExp); + + Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000"); + logger.debug("resourceVnf is: " + resourceVnf); + HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution(); + + String resourceVnfHomingString = resourceVnfHoming.toString(); + logger.debug("resourceVnfHomingString is: " + resourceVnfHomingString); + resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " "); + logger.debug("Now resourceVnfHomingString is: " + resourceVnfHomingString); + + assertNull(workflowException); + + //Verify request + String oofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); + logger.debug("oofRequest is: " + oofRequest); + assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf"). + replaceAll("\n", "").replaceAll("\r", ""). + replaceAll("\t", ""), oofRequest.replaceAll("\n", ""). + replaceAll("\r", "").replaceAll("\t", "")); + + //logger.debug("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId()); + + assertEquals(homingSolutionService("service", "service-instance-01234", + "MDTNJ01", "test-resource-id-000","att-aic", + "mtmnj1a", + "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," + + " \"j1d563e8-e714-4393-8f99-cc480144a05e\"", + "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," + + " \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString); + } + + @Test + public void testHoming_success_existingLicense() throws Exception { + + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + setVariablesExistingLicense(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "sniro"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition"); + String oofRequest = (String) getVariableFromHistory(businessKey, "sniroRequest"); + + Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); + HomingSolution resourceARHoming = (HomingSolution) resourceAR.getHomingSolution(); + Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); + HomingSolution resourceARHoming2 = (HomingSolution) resourceAR2.getHomingSolution(); + Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); + HomingSolution resourceVNFHoming = (HomingSolution) resourceVNF.getHomingSolution(); + String resourceARHomingString = resourceARHoming.toString(); + resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); + String resourceARHoming2String = resourceARHoming2.toString(); + resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); + String resourceVNFHomingString = resourceVNFHoming.toString(); + resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); + oofRequest = oofRequest.replaceAll("\\s+", ""); + + assertNull(workflowException); + assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", + "aic", "dfwtx", "KDTNJ01", + "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", + "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), + resourceARHomingString); + assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", + resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2", + null, null), resourceARHoming2String); + assertEquals(homingSolutionCloud("cloud", "aic", + "testCloudRegionId3", + false, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", + "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), + resourceVNFHomingString); + assertEquals(verifyOofRequestExistingLicense(), oofRequest); + + } + + @Test + + public void testHoming_error_inputVariable() throws Exception { + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables3(variables); + + invokeSubProcess("Homing", businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required " + + "input variable is missing or null]", workflowException.toString()); + } + + @Test + + public void testHoming_error_badResponse() throws Exception { + mockOof_500(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a " + + "Bad Sync Response from Sniro/OOF.]", workflowException.toString()); + } + + @Test + + public void testHoming_error_oofNoSolution() throws Exception { + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "oofNoSol"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found " + + "for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString()); + } + + @Test + + public void testHoming_error_oofPolicyException() throws Exception { + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "oofPolicyEx"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " + + "Response contains a Request Error Policy Exception: Message content size exceeds the allowable " + + "limit]", workflowException.toString()); + } + + @Test + + public void testHoming_error_oofServiceException() throws Exception { + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "oofServiceEx"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " + + "Response contains a Request Error Service Exception: OOF PlacementError: " + + "requests.exceptions.HTTPError: 404 Client Error: Not Found for " + + "url: http://192.168.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]", + workflowException.toString()); + } + + + private void setVariables(Map variables) { + variables.put("homingService", "oof"); + HashMap customerLocation = new HashMap(); + customerLocation.put("customerLatitude", "32.89748"); + customerLocation.put("customerLongitude", "-97.040443"); + customerLocation.put("customerName", "xyz"); + variables.put("customerLatitude", "32.89748"); + variables.put("customerLongitude", "-97.040443"); + variables.put("customerName", "xyz"); + variables.put("customerLocation", customerLocation); + variables.put("cloudOwner", "amazon"); + variables.put("cloudRegionId", "TNZED"); + variables.put("isDebugLogEnabled", "true"); + // variables.put("mso-request-id", "testRequestId"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", serviceDecomposition); + variables.put("subscriberInfo", subscriber2); + } + + private void setVariables2(Map variables) { + List netList = new ArrayList(); + NetworkResource net = new NetworkResource(); + net.setResourceId("testResourceIdNet"); + ModelInfo netModel = new ModelInfo(); + netModel.setModelCustomizationUuid("testModelCustomizationUuidNet"); + netModel.setModelInvariantUuid("testModelInvariantIdNet"); + netModel.setModelName("testModelNameNet"); + netModel.setModelVersion("testModelVersionNet"); + net.setModelInfo(netModel); + netList.add(net); + NetworkResource net2 = new NetworkResource(); + net2.setResourceId("testResourceIdNet2"); + ModelInfo netModel2 = new ModelInfo(); + netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2"); + netModel2.setModelCustomizationName("testModelCustomizationNameNet2"); + netModel2.setModelInvariantUuid("testModelInvariantIdNet2"); + netModel2.setModelName("testModelNameNet2"); + netModel2.setModelVersion("testModelVersionNet2"); + net2.setModelInfo(netModel2); + netList.add(net2); + serviceDecomposition.setNetworkResources(netList); + + variables.put("homingService", "oof"); + HashMap customerLocation = new HashMap(); + customerLocation.put("customerLatitude", "32.89748"); + customerLocation.put("customerLongitude", "-97.040443"); + customerLocation.put("customerName", "xyz"); + variables.put("customerLatitude", "32.89748"); + variables.put("customerLongitude", "-97.040443"); + variables.put("customerName", "xyz"); + variables.put("customerLocation", customerLocation); + variables.put("cloudOwner", "amazon"); + variables.put("cloudRegionId", "TNZED"); + variables.put("isDebugLogEnabled", "true"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", serviceDecomposition); + variables.put("subscriberInfo", subscriber2); + } + + private void setVariables3(Map variables) { + variables.put("homingService", "oof"); + HashMap customerLocation = new HashMap(); + customerLocation.put("customerLatitude", "32.89748"); + customerLocation.put("customerLongitude", "-97.040443"); + customerLocation.put("customerName", "xyz"); + variables.put("customerLatitude", "32.89748"); + variables.put("customerLongitude", "-97.040443"); + variables.put("customerName", "xyz"); + variables.put("customerLocation", customerLocation); + variables.put("cloudOwner", "amazon"); + variables.put("cloudRegionId", "TNZED"); + variables.put("isDebugLogEnabled", "true"); + // variables.put("mso-request-id", "testRequestId"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", null); + variables.put("subscriberInfo", subscriber2); + } + + private void setVariablesExistingLicense(Map variables) { + HomingSolution currentHomingSolution = new HomingSolution(); + serviceDecomposition.getVnfResources().get(0).setCurrentHomingSolution(currentHomingSolution); + serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1"); + serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2"); + + serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1"); + serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2"); + + variables.put("isDebugLogEnabled", "true"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", serviceDecomposition); + variables.put("subscriberInfo", subscriber2); + + } + + private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname, + String vnfResourceId, String cloudOwner, + String cloudRegionId, String enList, + String licenseList){ + + String solution = ""; + if(enList == null){ + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + + serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + + cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId + + "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :" + + " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { }," + + " \"rehome\" : false } }"; + }else{ + //language=JSON + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + + serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + + cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :" + + " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :" + + " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :" + + " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }"; + } + return solution; + } + + private String homingSolutionCloud(String type, String cloudOwner, + String cloudRegionId, Boolean flavors, String enList, + String licenseList){ + String solution = ""; + if(enList == null){ + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + + "\", \"license\" : { }, \"rehome\" : false } }"; + } else if (flavors && enList == null){ + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + + "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " + + "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " + + "\"license\" : { }, \"rehome\" : false } }"; + } else if (flavors) { + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + + "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " + + "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " + + "\"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + + licenseList + " ] }, \"rehome\" : false } }"; + } else { + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + + "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + + licenseList + " ] }, \"rehome\" : false } }"; + } + return solution; + } + + private void setVariablesForServiceDecomposition(Map variables, String requestId, String siId) { + variables.put("homingService", "oof"); + variables.put("isDebugLogEnabled", "true"); + variables.put("mso-request-id", requestId); + variables.put("msoRequestId", requestId); + variables.put("serviceInstanceId", siId); + HashMap customerLocation = new HashMap(); + customerLocation.put("customerLatitude", "32.89748"); + customerLocation.put("customerLongitude", "-97.040443"); + customerLocation.put("customerName", "xyz"); + variables.put("customerLatitude", "32.89748"); + variables.put("customerLongitude", "-97.040443"); + variables.put("customerName", "xyz"); + variables.put("customerLocation", customerLocation); + variables.put("cloudOwner", "amazon"); + variables.put("cloudRegionId", "TNZED"); + + + String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":" + + "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}"; + variables.put("serviceModelInfo", serviceModelInfo); + } + + private String verifyOofRequest() { + String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," + + "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\"," + + "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"]," + + "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":" + + "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":" + + "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," + + "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"ALLOTTED_RESOURCE\"" + + ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":" + + "\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR\"," + + "\"modelVersionId\":\"testARModelUuid\",\"modelName\":\"testModelNameAR\",\"modelType\":" + + "\"testModelTypeAR\",\"modelVersion\":\"testModelVersionAR\",\"modelCustomizationName\":\"\"}}," + + "{\"resourceModuleName\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\"," + + "\"tenantId\":\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR2\"," + + "\"modelVersionId\":\"testAr2ModelUuid\",\"modelName\":\"testModelNameAR2\"," + + "\"modelType\":\"testModelTypeAR2\",\"modelVersion\":\"testModelVersionAR2\"," + + "\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":" + + "{\"serviceInstanceId\":\"testServiceInstanceId123\"," + + "\"serviceName\":\"null\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" + + "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\"," + + "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" + + "\"}},\"licenseInfo\":{\"licenseDemands\":[{\"resourceModuleName\":\"VNF\",\"serviceResourceId\":" + + "\"testResourceIdVNF\",\"resourceInstanceType\":\"VNF\",\"resourceModelInfo\":{\"modelInvariantId\":" + + "\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":" + + "\"testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\"," + + "\"modelCustomizationName\":\"\"}}]}}"; + return request; + } + + private String verifyOofRequestExistingLicense(){ + String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," + + "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\"," + + "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"]," + + "\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\"," + + "\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":" + + "\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":" + + "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," + + "\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":" + + "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\"," + + "\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\"," + + "\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\"," + + "\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":" + + "\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":" + + "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":" + + "\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\"," + + "\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\"," + + "\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\"," + + "\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":" + + "[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\"," + + "\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":" + + "\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\"," + + "\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\"," + + "\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}," + + "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\"," + + "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\"," + + "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":" + + "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}"; + return request; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java new file mode 100644 index 0000000000..b8ae341361 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java @@ -0,0 +1,208 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.onap.so.bpmn.mock.StubResponseAAI.MockAAIVfModuleBadPatch; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.mock.FileUtil; +import org.onap.so.logger.MsoLogger; + +/** + * Unit tests for PrepareUpdateAAIVfModule.bpmn. + */ + +public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { + + MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,PrepareUpdateAAIVfModuleIT.class); + + /** + * Test the happy path through the flow. + */ + @Test + + public void happyPath() throws IOException { + + logStart(); + + String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200); + MockPatchVfModuleId("skask", "supercool"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); + invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode"); + logger.debug("Subflow response code: " + responseCode); + logger.debug("Subflow response: " + response); + Assert.assertEquals(200, responseCode.intValue()); + String heatStackId = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_heatStackId"); + logger.debug("Ouput heat-stack-id:" + heatStackId); + Assert.assertEquals("slowburn", heatStackId); + + logEnd(); + } + + /** + * Test the case where the GET to AAI returns a 404. + */ + @Test + + public void badGet() throws IOException { + + logStart(); + + String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); + MockGetGenericVnfById_404("skask[?]depth=1"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); + invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponseCode"); + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + logger.debug("Subflow response code: " + responseCode); + logger.debug("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + Assert.assertNotNull(workflowException); + logger.debug("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + + logEnd(); + } + + /** + * Test the case where the validation of the VF Module fails. + */ + @Test + + public void failValidation1() throws IOException { + + logStart(); + + String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "lukewarm"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); + invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); + + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + Assert.assertNotNull(workflowException); + logger.debug("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: Orchestration")); + + logEnd(); + } + + /** + * Test the case where the validation of the VF Module fails. + */ + @Test + + public void failValidation2() throws IOException { + + logStart(); + + String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "notsocool"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); + invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); + + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + Assert.assertNotNull(workflowException); + logger.debug("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: VF Module")); + + logEnd(); + } + + /** + * Test the case where the GET to AAI is successful, but the subsequent PUT returns 404. + */ + @Test + + public void badPatch() throws IOException { + + logStart(); + + String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); + invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode"); + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + logger.debug("Subflow response code: " + responseCode); + logger.debug("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + Assert.assertNotNull(workflowException); + logger.debug("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + + logEnd(); + } +} + diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java new file mode 100644 index 0000000000..7b85edf49a --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.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.bpmn.common; + +import static org.onap.so.bpmn.mock.StubResponsePolicy.MockPolicyAbort; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; + +/** + * Unit test for RainyDayHandler.bpmn. + */ + +public class RainyDayHandlerIT extends BaseIntegrationTest { + + @Test + + public void TestRainyDayHandlingSuccess() { + + Map variables = new HashMap<>(); + variables.put("isDebugLogEnabled","true"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceType", "X"); + variables.put("vnfType", "Y"); + variables.put("currentActivity", "BB1"); + variables.put("workStep", "1"); + variables.put("failedActivity", ""); + variables.put("errorCode", "123"); + variables.put("errorText", "update failed"); + variables.put("vnfName", "vSAMP1"); + + MockPolicyAbort(); + + + String businessKey = UUID.randomUUID().toString(); + invokeSubProcess("RainyDayHandler", businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + + } + + + +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java new file mode 100644 index 0000000000..7f3e884601 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java @@ -0,0 +1,145 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.bpmn.common.WorkflowTest; +import org.onap.so.bpmn.common.WorkflowTest.CallbackSet; +import org.onap.so.bpmn.core.WorkflowException; + +/** + * Unit tests for SDNCAdapterRestV1. + */ +@Ignore +public class ReceiveWorkflowMessageTest extends WorkflowTest { + + private static final String EOL = "\n"; + + private final CallbackSet callbacks = new CallbackSet(); + + public ReceiveWorkflowMessageTest() throws IOException { + callbacks.put("sdnc-event-success", JSON, "SDNCAEvent", + "{" + EOL + + " \"SDNCEvent\": {" + EOL + + " \"eventType\": \"evenType\"," + EOL + + " \"eventCorrelatorType\": \"HOST-NAME\"," + EOL + + " \"eventCorrelator\": \"((CORRELATOR))\"," + EOL + + " \"params\": {" + EOL + + " \"success-indicator\":\"Y\"" + EOL + + " }" +EOL + + " }" + EOL + + "}" + EOL); + + callbacks.put("sdnc-event-fail", JSON, "SDNCAEvent", + "{" + EOL + + " \"SDNCEvent\": {" + EOL + + " \"eventType\": \"evenType\"," + EOL + + " \"eventCorrelatorType\": \"HOST-NAME\"," + EOL + + " \"eventCorrelator\": \"((CORRELATOR))\"," + EOL + + " \"params\": {" + EOL + + " \"success-indicator\":\"N\"," + EOL + + " \"error-message\":\"SOMETHING BAD HAPPENED\"" + EOL + + " }" +EOL + + " }" + EOL + + "}" + EOL); + } + + /** + * Test the happy path. + */ + @Test + @Deployment(resources = { + "subprocess/ReceiveWorkflowMessage.bpmn" + }) + public void happyPath() throws Exception { + + logStart(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312"); + variables.put("isDebugLogEnabled", "true"); + variables.put("RCVWFMSG_timeout", "PT1M"); + variables.put("RCVWFMSG_messageType", "SDNCAEvent"); + variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31"); + + invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables); + injectWorkflowMessages(callbacks, "sdnc-event-success"); + waitForProcessEnd(businessKey, 10000); + + String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse"); + System.out.println("Response:\n" + response); + assertTrue(response.contains("\"SDNCEvent\"")); + assertTrue((boolean)getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator")); + + logEnd(); + } + + /** + * Test the timeout scenario. + */ + @Test + @Deployment(resources = { + "subprocess/ReceiveWorkflowMessage.bpmn" + }) + public void timeout() throws Exception { + + logStart(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312"); + variables.put("isDebugLogEnabled", "true"); + variables.put("RCVWFMSG_timeout", "PT5S"); + variables.put("RCVWFMSG_messageType", "SDNCAEvent"); + variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31"); + + invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables); + + // No injection + + waitForProcessEnd(businessKey, 10000); + + // There is no response from SDNC, so the flow doesn't set WorkflowResponse. + String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse"); + assertNull(response); + WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + assertNotNull(wfe); + System.out.println(wfe.toString()); + assertEquals("Receive Workflow Message Timeout Error", wfe.getErrorMessage()); + assertFalse((boolean)getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator")); + + logEnd(); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java new file mode 100644 index 0000000000..dc5c36f5a7 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.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.bpmn.common; + +import javax.xml.ws.Endpoint; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; +import org.onap.so.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl; + +/** + * A JUnit rule that starts the SDNC Adapter Callback Service before + * every test, and tears it down after every test. Example: + *
+ *     @Rule
+ *     public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
+ *         new SDNCAdapterCallbackRule(processEngineRule);
+ * 
+ */ +public class SDNCAdapterCallbackRule implements TestRule { + public static final String DEFAULT_ENDPOINT_URL = + "http://localhost:28080/mso/SDNCAdapterCallbackService"; + + private final ProcessEngineServices processEngineServices; + private final String endpointUrl; + + public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices) { + this(processEngineServices, DEFAULT_ENDPOINT_URL); + } + + public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices, + String endpointUrl) { + this.processEngineServices = processEngineServices; + this.endpointUrl = endpointUrl; + } + + @Override + public Statement apply(final Statement baseStmt, Description description) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + Endpoint endpoint = null; + + try { + SDNCAdapterCallbackServiceImpl sdncCallbackService = new SDNCAdapterCallbackServiceImpl(); + sdncCallbackService.setProcessEngineServices4junit(processEngineServices); + + System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true"); + System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true"); + + System.out.println("Publishing Endpoint - " + endpointUrl); + endpoint = Endpoint.publish(endpointUrl, sdncCallbackService); + + baseStmt.evaluate(); + } finally { + if (endpoint != null) { + System.out.println("Stopping Endpoint - " + endpointUrl); + endpoint.stop(); + } + } + } + }; + } +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java new file mode 100644 index 0000000000..baf41d120b --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.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.bpmn.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; +import org.onap.so.bpmn.mock.FileUtil; +import org.onap.so.logger.MsoLogger; + +/** + * Unit tests for SDNCAdapterRestV2.bpmn. + * + * This version of SDNCAdapterRest allows for interim notifications to be sent for + * any non-final response received from SDNC. + */ + +public class SDNCAdapterRestV2IT extends BaseIntegrationTest { + + private final CallbackSet callbacks = new CallbackSet(); + + MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,SDNCAdapterRestV2IT.class); + + + /** + * Constructor. Insert callbacks. + * + * @throws IOException + */ + public SDNCAdapterRestV2IT() throws IOException { + String sdncCallbackFinal = FileUtil.readResourceFile("__files/SDNCAdapterRestCallbackFinal.json"); + String sdncCallbackNonFinal = FileUtil.readResourceFile("__files/SDNCAdapterRestCallbackNonFinal.json"); + callbacks.put("nonfinal", sdncCallbackNonFinal); + callbacks.put("final", sdncCallbackFinal); + } + + /** + * Test the success path through the subflow. + */ + @Test + @Ignore + public void success() throws IOException { + logStart(); + mocks(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "a4383a52-b9de-4bc4-bedf-02f3f9466535"); + variables.put("mso-service-instance-id", "fd8bcdbb-b799-43ce-a7ff-ed8f2965a3b5"); + variables.put("isDebugLogEnabled", "true"); + variables.put("SDNCREST_Request", + FileUtil.readResourceFile("__files/SDNCAdapterRestV2Request.json")); + variables.put("SDNCREST_InterimNotification1", + FileUtil.readResourceFile("__files/SDNCInterimNotification1.json")); + + invokeSubProcess("SDNCAdapterRestV2", businessKey, variables); + + injectSDNCRestCallbacks(callbacks, "nonfinal"); + + // First non-final response will have done a notification + Object interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification"); + Assert.assertNotNull(interimNotification); + + injectSDNCRestCallbacks(callbacks, "nonfinal"); + + // Second non-final response will not have done a notification + interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification"); + Assert.assertNull(interimNotification); + + injectSDNCRestCallbacks(callbacks, "final"); + + interimNotification = this.getVariableFromHistory(businessKey, "SDNCREST_interimNotification"); + Assert.assertNull(interimNotification); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + + logEnd(); + } + + /** + * Defines WireMock stubs needed by these tests. + */ + private void mocks() { + stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/json"))); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java new file mode 100644 index 0000000000..9239889f28 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.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.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + +import java.io.FileNotFoundException; +import java.io.IOException; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.so.client.RestPropertiesLoader; +import org.onap.so.client.aai.AAIProperties; +import org.onap.so.client.dmaap.DmaapProperties; +import org.onap.so.client.dmaap.DmaapPropertiesLoader; +import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer; + +public class SPIPropertiesTest { + + @BeforeClass + public static void beforeClass() { + System.setProperty("mso.config.path", "src/test/resources"); + } + + @Test + public void notEqual() { + DmaapProperties one = DmaapPropertiesLoader.getInstance().getNewImpl(); + DmaapProperties two = DmaapPropertiesLoader.getInstance().getNewImpl(); + assertNotEquals(one, two); + } + @Test + public void equal() { + DmaapProperties one = DmaapPropertiesLoader.getInstance().getImpl(); + DmaapProperties two = DmaapPropertiesLoader.getInstance().getImpl(); + assertEquals(one, two); + } + @Test + public void restNotEqual() { + AAIProperties one = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class); + AAIProperties two = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class); + assertNotEquals(one, two); + } + @Test + public void restEqual() { + AAIProperties one = RestPropertiesLoader.getInstance().getImpl(AAIProperties.class); + AAIProperties two = RestPropertiesLoader.getInstance().getImpl(AAIProperties.class); + assertEquals(one, two); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java new file mode 100644 index 0000000000..f780b694aa --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java @@ -0,0 +1,549 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid; +import static org.onap.so.bpmn.mock.StubResponseSNIRO.*; +import static org.junit.Assert.*; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.core.domain.*; +import org.onap.so.bpmn.mock.FileUtil; +import org.onap.so.logger.MsoLogger; + + +/** + * Test the SNIRO Homing subflow building block. + */ +@Ignore +public class SniroHomingV1IT extends BaseIntegrationTest { + + MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,SniroHomingV1IT.class); + + + ServiceDecomposition serviceDecomposition = new ServiceDecomposition(); + String subscriber = ""; + String subscriber2 = ""; + + private final CallbackSet callbacks = new CallbackSet(); + + public SniroHomingV1IT() throws IOException { + String sniroCallback = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf"); + String sniroCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf2Net"); + String sniroCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackInfraVnf"); + String sniroCallbackNoSolution = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackNoSolutionFound"); + String sniroCallbackPolicyException = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackPolicyException"); + String sniroCallbackServiceException = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackServiceException"); + callbacks.put("sniro", JSON, "SNIROResponse", sniroCallback); + callbacks.put("sniro2", JSON, "SNIROResponse", sniroCallback2); + callbacks.put("sniro3", JSON, "SNIROResponse", sniroCallback3); + callbacks.put("sniroNoSol", JSON, "SNIROResponse", sniroCallbackNoSolution); + callbacks.put("sniroPolicyEx", JSON, "SNIROResponse", sniroCallbackPolicyException); + callbacks.put("sniroServiceEx", JSON, "SNIROResponse", sniroCallbackServiceException); + + // Service Model + ModelInfo sModel = new ModelInfo(); + sModel.setModelCustomizationUuid("testModelCustomizationUuid"); + sModel.setModelInstanceName("testModelInstanceName"); + sModel.setModelInvariantUuid("testModelInvariantId"); + sModel.setModelName("testModelName"); + sModel.setModelUuid("testModelUuid"); + sModel.setModelVersion("testModelVersion"); + // Service Instance + ServiceInstance si = new ServiceInstance(); + si.setInstanceId("testServiceInstanceId123"); + // Allotted Resources + List arList = new ArrayList(); + AllottedResource ar = new AllottedResource(); + ar.setResourceId("testResourceIdAR"); + ar.setResourceInstanceName("testARInstanceName"); + ModelInfo arModel = new ModelInfo(); + arModel.setModelCustomizationUuid("testModelCustomizationUuidAR"); + arModel.setModelInvariantUuid("testModelInvariantIdAR"); + arModel.setModelName("testModelNameAR"); + arModel.setModelVersion("testModelVersionAR"); + arModel.setModelUuid("testARModelUuid"); + arModel.setModelType("testModelTypeAR"); + ar.setModelInfo(arModel); + AllottedResource ar2 = new AllottedResource(); + ar2.setResourceId("testResourceIdAR2"); + ar2.setResourceInstanceName("testAR2InstanceName"); + ModelInfo arModel2 = new ModelInfo(); + arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2"); + arModel2.setModelInvariantUuid("testModelInvariantIdAR2"); + arModel2.setModelName("testModelNameAR2"); + arModel2.setModelVersion("testModelVersionAR2"); + arModel2.setModelUuid("testAr2ModelUuid"); + arModel2.setModelType("testModelTypeAR2"); + ar2.setModelInfo(arModel2); + arList.add(ar); + arList.add(ar2); + // Vnfs + List vnfList = new ArrayList(); + VnfResource vnf = new VnfResource(); + vnf.setResourceId("testResourceIdVNF"); + vnf.setResourceInstanceName("testVnfInstanceName"); + ModelInfo vnfModel = new ModelInfo(); + vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF"); + vnfModel.setModelInvariantUuid("testModelInvariantIdVNF"); + vnfModel.setModelName("testModelNameVNF"); + vnfModel.setModelVersion("testModelVersionVNF"); + vnfModel.setModelUuid("testVnfModelUuid"); + vnfModel.setModelType("testModelTypeVNF"); + vnf.setModelInfo(vnfModel); + vnfList.add(vnf); + logger.debug("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString()); + serviceDecomposition.setModelInfo(sModel); + serviceDecomposition.setAllottedResources(arList); + serviceDecomposition.setVnfResources(vnfList); + serviceDecomposition.setServiceInstance(si); + + // Subscriber + subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}"; + subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}"; + } + + @Test + // 1802 merge + + public void testHoming_success_2AR1Vnf() throws Exception { + + mockSNIRO(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "sniro"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition"); + String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest"); + + Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); + HomingSolution resourceARHoming = resourceAR.getHomingSolution(); + Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); + HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution(); + Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); + HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution(); + String resourceARHomingString = resourceARHoming.toString(); + resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); + String resourceARHoming2String = resourceARHoming2.toString(); + resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); + String resourceVNFHomingString = resourceVNFHoming.toString(); + resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); + expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", ""); + + assertNull(workflowException); + assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString); + assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String); + assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString); + assertEquals(verifySniroRequest(), expectedSniroRequest); + + } + + @Test + // 1802 merge + + public void testHoming_success_2AR1Vnf2Net() throws Exception { + + mockSNIRO(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables2(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "sniro2"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition"); + String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest"); + + Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); + HomingSolution resourceARHoming = resourceAR.getHomingSolution(); + Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); + HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution(); + Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); + HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution(); + Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet"); + HomingSolution resourceNetHoming = resourceNet.getHomingSolution(); + Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2"); + HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution(); + + String resourceARHomingString = resourceARHoming.toString(); + resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); + String resourceARHoming2String = resourceARHoming2.toString(); + resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); + String resourceVNFHomingString = resourceVNFHoming.toString(); + resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); + String resourceNetHomingString = resourceNetHoming.toString(); + resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " "); + String resourceNetHoming2String = resourceNetHoming2.toString(); + resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " "); + expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", ""); + + assertNull(workflowException); + assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString); + assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String); + assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString); + assertEquals(homingSolutionService("service", "testServiceInstanceIdNet", "testVnfHostNameNet", "aic", "testCloudRegionIdNet", "testAicClliNet", "3.0", null, null), resourceNetHomingString); + assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionIdNet2", "testAicClliNet2", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"", "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""), resourceNetHoming2String); + assertEquals(verifySniroRequest(), expectedSniroRequest); + } + + @Test + // 1802 merge + + public void testHoming_success_vnfResourceList() throws Exception { + + // Create a Service Decomposition + MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4", "/BuildingBlocks/catalogResp.json"); + String busKey = UUID.randomUUID().toString(); + Map vars = new HashMap<>(); + setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff"); + invokeSubProcess("DecomposeService", busKey, vars); + + ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition"); + List vnfResourceList = sd.getVnfResources(); + vnfResourceList.get(0).setResourceId("test-resource-id-000"); + + // Invoke Homing + + mockSNIRO(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("homingService", "sniro"); + variables.put("isDebugLogEnabled", "true"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", sd); + variables.put("subscriberInfo", subscriber2); + + invokeSubProcess("Homing", businessKey, variables); + injectWorkflowMessages(callbacks, "sniro3"); + waitForProcessEnd(businessKey, 10000); + + //Get Variables + + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition"); + + Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000"); + HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution(); + + String resourceVnfHomingString = resourceVnfHoming.toString(); + resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " "); + + assertNull(workflowException); + + //Verify request + String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest"); + assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/sniroRequest_infravnf").replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""), sniroRequest.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", "")); + + assertEquals(homingSolutionService("service", "service-instance-01234", "MDTNJ01", "att-aic", "mtmnj1a", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString); + } + + @Test + + public void testHoming_success_existingLicense() throws Exception { + + mockSNIRO(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + setVariablesExistingLicense(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "sniro"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition"); + String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest"); + + Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); + HomingSolution resourceARHoming = resourceAR.getHomingSolution(); + Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); + HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution(); + Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); + HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution(); + String resourceARHomingString = resourceARHoming.toString(); + resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); + String resourceARHoming2String = resourceARHoming2.toString(); + resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); + String resourceVNFHomingString = resourceVNFHoming.toString(); + resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); + sniroRequest = sniroRequest.replaceAll("\\s+", ""); + + assertNull(workflowException); + assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString); + assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String); + assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString); + assertEquals(verifySniroRequest_existingLicense(), sniroRequest); + + } + + + @Test + + public void testHoming_error_inputVariable() throws Exception { + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables3(variables); + + invokeSubProcess("Homing", businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required input variable is missing or null]", workflowException.toString()); + } + + @Test + + public void testHoming_error_badResponse() throws Exception { + mockSNIRO_500(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a Bad Sync Response from Sniro/OOF.]", workflowException.toString()); + } + + @Test + // 1802 merge + + public void testHoming_error_sniroNoSolution() throws Exception { + mockSNIRO(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "sniroNoSol"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString()); + } + + @Test + + public void testHoming_error_sniroPolicyException() throws Exception { + mockSNIRO(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "sniroPolicyEx"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Policy Exception: Message content size exceeds the allowable limit]", workflowException.toString()); + } + + @Test + + public void testHoming_error_sniroServiceException() throws Exception { + mockSNIRO(); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "sniroServiceEx"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Service Exception: SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]", workflowException.toString()); + } + + + + private void setVariables(Map variables) { + variables.put("homingService", "sniro"); + variables.put("isDebugLogEnabled", "true"); + // variables.put("mso-request-id", "testRequestId"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", serviceDecomposition); + variables.put("subscriberInfo", subscriber2); + + } + + private void setVariables2(Map variables) { + List netList = new ArrayList(); + NetworkResource net = new NetworkResource(); + net.setResourceId("testResourceIdNet"); + ModelInfo netModel = new ModelInfo(); + netModel.setModelCustomizationUuid("testModelCustomizationUuidNet"); + netModel.setModelInvariantUuid("testModelInvariantIdNet"); + netModel.setModelName("testModelNameNet"); + netModel.setModelVersion("testModelVersionNet"); + net.setModelInfo(netModel); + netList.add(net); + NetworkResource net2 = new NetworkResource(); + net2.setResourceId("testResourceIdNet2"); + ModelInfo netModel2 = new ModelInfo(); + netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2"); + netModel2.setModelInvariantUuid("testModelInvariantIdNet2"); + netModel2.setModelName("testModelNameNet2"); + netModel2.setModelVersion("testModelVersionNet2"); + net2.setModelInfo(netModel2); + netList.add(net2); + serviceDecomposition.setNetworkResources(netList); + + variables.put("homingService", "sniro"); + variables.put("isDebugLogEnabled", "true"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", serviceDecomposition); + variables.put("subscriberInfo", subscriber2); + } + + private void setVariables3(Map variables) { + variables.put("homingService", "sniro"); + variables.put("isDebugLogEnabled", "true"); + // variables.put("mso-request-id", "testRequestId"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", null); + variables.put("subscriberInfo", subscriber2); + + } + + private void setVariablesExistingLicense(Map variables) { + HomingSolution currentHomingSolution = new HomingSolution(); + serviceDecomposition.getVnfResources().get(0).setCurrentHomingSolution(currentHomingSolution); + serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1"); + serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2"); + + serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1"); + serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2"); + + variables.put("isDebugLogEnabled", "true"); + // variables.put("mso-request-id", "testRequestId"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", serviceDecomposition); + variables.put("subscriberInfo", subscriber2); + + } + + private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname, String cloudOwner, String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList){ + String solution = ""; + if(enList == null){ + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { }, \"rehome\" : false } }"; + }else{ + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }"; + } + return solution; + } + + private String homingSolutionCloud(String type, String serviceInstanceId, String vnfHostname, String cloudOwner, String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList){ + String solution = ""; + if(enList == null){ + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { }, \"rehome\" : false } }"; + }else{ + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }"; + } + return solution; + } + + private void setVariablesForServiceDecomposition(Map variables, String requestId, String siId) { + variables.put("homingService", "sniro"); + variables.put("isDebugLogEnabled", "true"); + variables.put("mso-request-id", requestId); + variables.put("msoRequestId", requestId); + variables.put("serviceInstanceId",siId); + + String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," + + "\"modelInvariantUuid\": \"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\"," + + "\"modelUuid\": \"2f7f309d-c842-4644-a2e4-34167be5eeb4\"," + + "\"modelName\": \"ADIOD vRouter vCE 011017 Service\"," + + "\"modelVersion\": \"5.0\"," + + "}"; + variables.put("serviceModelInfo", serviceModelInfo); + } + + private String verifySniroRequest(){ + String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"initial\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}"; + return request; + } + + private String verifySniroRequest_existingLicense(){ + String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"},\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\",\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\",\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}"; + return request; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java new file mode 100644 index 0000000000..e1a265b274 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java @@ -0,0 +1,174 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.onap.so.bpmn.mock.StubResponseAAI.MockAAIVfModuleBadPatch; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchGenericVnf; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf_Bad; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.mock.FileUtil; +import org.onap.so.logger.MsoLogger; + +/** + * Unit tests for UpdateAAIGenericVnf bpmn. + */ + +public class UpdateAAIGenericVnfIT extends BaseIntegrationTest { + + MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class); + + + /** + * Test the happy path through the flow. + */ + @Test + + public void happyPath() throws IOException { + logStart(); + + String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + MockPutGenericVnf("/skask", 200); + MockPatchGenericVnf("skask"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest); + invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode"); + logger.debug("Subflow response code: " + responseCode); + logger.debug("Subflow response: " + response); + Assert.assertEquals(200, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the happy path through the flow. + */ + @Test + + public void personaMismatch() throws IOException { + + logStart(); + + String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); + updateAAIGenericVnfRequest = updateAAIGenericVnfRequest.replaceFirst("introvert", "extrovert"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest); + invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + logger.debug("Workflow Exception: " + workflowException); + Assert.assertNotNull(workflowException); + + logEnd(); + } + + /** + * Test the case where the GET to AAI returns a 404. + */ + @Test + + public void badGet() throws IOException { + + logStart(); + + String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); + + MockGetGenericVnfById_404("skask[?]depth=1"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest); + invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponseCode"); + logger.debug("Subflow response code: " + responseCode); + logger.debug("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404. + */ + @Test + + public void badPatch() throws IOException { + + logStart(); + + String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + MockPutGenericVnf_Bad("skask", 404); + MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask", 404); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest); + invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode"); + logger.debug("Subflow response code: " + responseCode); + logger.debug("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } +} + diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java new file mode 100644 index 0000000000..3ff2657193 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java @@ -0,0 +1,142 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.onap.so.bpmn.mock.StubResponseAAI.MockAAIVfModuleBadPatch; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; +import org.onap.so.bpmn.mock.FileUtil; +import org.onap.so.logger.MsoLogger; + +/** + * Unit tests for UpdateAAIVfModuleTest.bpmn. + */ + +public class UpdateAAIVfModuleIT extends BaseIntegrationTest { + + MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class); + + + /** + * Test the happy path through the flow. + */ + @Test + + public void happyPath() throws IOException { + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); + MockGetGenericVnfByIdWithPriority("/skask/vf-modules/vf-module/supercool", 200, "VfModularity/VfModule-supercool.xml"); + MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200); + MockPatchVfModuleId("skask", "supercool"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest); + invokeSubProcess("UpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode"); + logger.debug("Subflow response code: " + responseCode); + logger.debug("Subflow response: " + response); + Assert.assertEquals(200, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the case where the GET to AAI returns a 404. + */ + @Test + + public void badGet() throws IOException { + + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); + MockGetGenericVnfById("/skask/vf-modules/vf-module/.*", "VfModularity/VfModule-supercool.xml", 404); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest); + invokeSubProcess("UpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponseCode"); + logger.debug("Subflow response code: " + responseCode); + logger.debug("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404. + */ + @Test + + public void badPatch() throws IOException { + + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); + MockGetGenericVnfById_404("/skask/vf-modules/vf-module/supercool"); + MockGetGenericVnfById("/skask/vf-modules/vf-module/supercool", "VfModularity/VfModule-supercool.xml", 200); + MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest); + invokeSubProcess("UpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode"); + logger.debug("Subflow response code: " + responseCode); + logger.debug("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } +} + diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java new file mode 100644 index 0000000000..fc15e92bca --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java @@ -0,0 +1,386 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete; +import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFPost; +import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFPut; +import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFRollbackDelete; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseIntegrationTest; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.logger.MsoLogger; + +/** + * Unit tests for VnfAdapterRestV1. + */ + +public class VnfAdapterRestV1IT extends BaseIntegrationTest { + + MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,VnfAdapterRestV1IT.class); + + + private static final String EOL = "\n"; + + private final CallbackSet callbacks = new CallbackSet(); + + private final String CREATE_VF_MODULE_REQUEST = + "" + EOL + + " cloudSiteId" + EOL + + " tenantId" + EOL + + " vnfId" + EOL + + " vfModuleName" + EOL + + " vfModuleId" + EOL + + " vnfType" + EOL + + " vnfVersion" + EOL + + " vfModuleType" + EOL + + " volumeGroupId" + EOL + + " volumeGroupStackId" + EOL + + " baseVfModuleId" + EOL + + " baseVfModuleStackId" + EOL + + " true" + EOL + + " false" + EOL + + " true" + EOL + + " " + EOL + + " " + EOL + + " key1" + EOL + + " value1" + EOL + + " " + EOL + + " " + EOL + + " key2" + EOL + + " value2" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " requestId" + EOL + + " serviceInstanceId" + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + " http://localhost:28080/mso/WorkflowMessage" + EOL + + "" + EOL; + + private final String UPDATE_VF_MODULE_REQUEST = + "" + EOL + + " cloudSiteId" + EOL + + " tenantId" + EOL + + " vnfId" + EOL + + " vfModuleName" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " vnfType" + EOL + + " vnfVersion" + EOL + + " vfModuleType" + EOL + + " volumeGroupId" + EOL + + " volumeGroupStackId" + EOL + + " baseVfModuleId" + EOL + + " baseVfModuleStackId" + EOL + + " true" + EOL + + " false" + EOL + + " true" + EOL + + " " + EOL + + " " + EOL + + " key1" + EOL + + " value1" + EOL + + " " + EOL + + " " + EOL + + " key2" + EOL + + " value2" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " requestId" + EOL + + " serviceInstanceId" + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + " http://localhost:28080/mso/WorkflowMessage" + EOL + + "" + EOL; + + private final String DELETE_VF_MODULE_REQUEST = + "" + EOL + + " cloudSiteId" + EOL + + " tenantId" + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " true" + EOL + + " " + EOL + + " requestId" + EOL + + " serviceInstanceId" + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + " http://localhost:28080/mso/WorkflowMessage" + EOL + + "" + EOL; + + private final String ROLLBACK_VF_MODULE_REQUEST = + "" + EOL + + " {{MESSAGE-ID}}" + EOL + + " http://localhost:28080/mso/WorkflowMessage" + EOL + + " true" + EOL + + " " + EOL + + " cloudSiteId" + EOL + + " tenantId" + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " " + EOL + + " requestId" + EOL + + " serviceInstanceId" + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + " true" + EOL + + " " + EOL + + "" + EOL; + + public VnfAdapterRestV1IT() throws IOException { + callbacks.put("createVfModule", + "" + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " true" + EOL + + " " + EOL + + " " + EOL + + " key1" + EOL + + " value1" + EOL + + " " + EOL + + " " + EOL + + " key2" + EOL + + " value2" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " true" + EOL + + " tenantId" + EOL + + " cloudSiteId" + EOL + + " " + EOL + + " requestId" + EOL + + " serviceInstanceId" + EOL + + " " + EOL + + " messageId" + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL); + + callbacks.put("updateVfModule", + "" + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " " + EOL + + " " + EOL + + " key1" + EOL + + " value1" + EOL + + " " + EOL + + " " + EOL + + " key2" + EOL + + " value2" + EOL + + " " + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL); + + callbacks.put("deleteVfModule", + "" + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " true" + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL); + + callbacks.put("rollbackVfModule", + "" + EOL + + " {{MESSAGE-ID}}" + EOL + + " true" + EOL + + "" + EOL); + + callbacks.put("vfModuleException", + "" + EOL + + " message" + EOL + + " category" + EOL + + " false" + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL); + } + + @Test + + public void testCreateVfModuleSuccess() throws Exception { + logStart(); + + mockVNFPost("", 202, "vnfId"); + + String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; + String messageId = requestId + "-" + System.currentTimeMillis(); + String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", requestId); + variables.put("isDebugLogEnabled", "true"); + variables.put("vnfAdapterRestV1Request", request); + + invokeSubProcess("vnfAdapterRestV1", businessKey, variables); + injectVNFRestCallbacks(callbacks, "createVfModule"); + waitForProcessEnd(businessKey, 10000); + + String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); + logger.debug("Response:\n" + response); + assertTrue(response!=null && response.contains("")); + assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); + + logEnd(); + } + + @Test + + public void testUpdateVfModuleSuccess() throws Exception { + logStart(); + + mockVNFPut("/vfModuleId", 202); + + String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; + String messageId = requestId + "-" + System.currentTimeMillis(); + String request = UPDATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", requestId); + variables.put("isDebugLogEnabled", "true"); + variables.put("vnfAdapterRestV1Request", request); + + invokeSubProcess("vnfAdapterRestV1", businessKey, variables); + injectVNFRestCallbacks(callbacks, "updateVfModule"); + waitForProcessEnd(businessKey, 10000); + + String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); + logger.debug("Response:\n" + response); + assertTrue(response.contains("")); + assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); + + logEnd(); + } + + @Test + + public void testDeleteVfModuleSuccess() throws Exception { + logStart(); + + mockVNFDelete("vnfId", "/vfModuleId", 202); + + String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; + String messageId = requestId + "-" + System.currentTimeMillis(); + String request = DELETE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", requestId); + variables.put("isDebugLogEnabled", "true"); + variables.put("vnfAdapterRestV1Request", request); + + invokeSubProcess("vnfAdapterRestV1", businessKey, variables); + injectVNFRestCallbacks(callbacks, "deleteVfModule"); + waitForProcessEnd(businessKey, 10000); + + String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); + logger.debug("Response:\n" + response); + assertTrue(response.contains("")); + assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); + + logEnd(); + } + + @Test + + public void testRollbackVfModuleSuccess() throws Exception { + logStart(); + + mockVNFRollbackDelete("/vfModuleId", 202); + + String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; + String messageId = requestId + "-" + System.currentTimeMillis(); + String request = ROLLBACK_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", requestId); + variables.put("isDebugLogEnabled", "true"); + variables.put("vnfAdapterRestV1Request", request); + + invokeSubProcess("vnfAdapterRestV1", businessKey, variables); + injectVNFRestCallbacks(callbacks, "rollbackVfModule"); + waitForProcessEnd(businessKey, 10000); + + String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); + logger.debug("Response:\n" + response); + assertTrue(response.contains("")); + assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); + + logEnd(); + } + + @Test + + public void testCreateVfModuleException() throws Exception { + logStart(); + + mockVNFPost("", 202, "vnfId"); + + String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; + String messageId = requestId + "-" + System.currentTimeMillis(); + String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + variables.put("mso-request-id", requestId); + variables.put("isDebugLogEnabled", "true"); + variables.put("vnfAdapterRestV1Request", request); + + invokeSubProcess("vnfAdapterRestV1", businessKey, variables); + injectVNFRestCallbacks(callbacks, "vfModuleException"); + waitForProcessEnd(businessKey, 10000); + + WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + assertNotNull(wfe); + logger.debug(wfe.toString()); + + String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse"); + logger.debug("Response:\n" + response); + assertTrue(response.contains("")); + assertFalse((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); + + logEnd(); + } +} + diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java new file mode 100644 index 0000000000..a746bbb48e --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.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.bpmn.common; + +import static org.junit.Assert.assertEquals; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; +import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource; + +@Ignore +public class WorkflowAsyncResourceTest extends WorkflowTest { + + @Test + @Deployment(resources = { "testAsyncResource.bpmn" }) + public void asyncRequestSuccess() throws InterruptedException { + //it can be any request which asynchronously processed by the workflow + String request = " SDN-ETHERNET-INTERNET HI/VLXM/950604//SW_INTERNET SubName01 "; + + Map variables = new HashMap<>(); + variables.put("testAsyncRequestMsg", request); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("mso-service-request-timeout", "5"); + + WorkflowResponse workflowResponse = BPMNUtil.executeAsyncWorkflow(processEngineRule, "testAsyncProcess", variables); + assertEquals("Received the request, the process is getting executed, request message SDN-ETHERNET-INTERNET HI/VLXM/950604//SW_INTERNET SubName01 ", workflowResponse.getResponse()); + assertEquals(200, workflowResponse.getMessageCode()); + } + + private void executeWorkflow(String request, String requestId, String processKey) throws InterruptedException { + WorkflowAsyncResource workflowResource = new WorkflowAsyncResource(); + VariableMapImpl variableMap = new VariableMapImpl(); + + Map variableValueType = new HashMap<>(); + + Map requestMsg = new HashMap<>(); + requestMsg.put("value", request); + requestMsg.put("type", "String"); + + Map msorequestId = new HashMap<>(); + msorequestId.put("type", "String"); + msorequestId.put("value",requestId); + + Map timeout = new HashMap<>(); + timeout.put("type", "String"); + timeout.put("value","5"); + + variableValueType.put("testAsyncRequestMsg", requestMsg); + variableValueType.put("mso-request-id", msorequestId); + variableValueType.put("mso-service-request-timeout", timeout); + + variableMap.put("variables", variableValueType); + + workflowResource.setProcessEngineServices4junit(processEngineRule); + workflowResource.startProcessInstanceByKey( processKey, variableMap); + } + + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java new file mode 100644 index 0000000000..0efecac254 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.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.bpmn.common; + + + +import java.util.UUID; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse; +import org.onap.so.bpmn.common.workflow.context.WorkflowContext; +import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder; +import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; + + +public class WorkflowContextHolderTest { + + + @Test + public void testProcessCallback() throws Exception { + String requestId = UUID.randomUUID().toString(); + String message = "TEST MESSATGE"; + String responseMessage = "Successfully processed request"; + int testCode = 200; + + + WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); + + WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse(); + callbackResponse.setMessage(message); + callbackResponse.setResponse(responseMessage); + callbackResponse.setStatusCode(testCode); + + contextHolder.processCallback("testAsyncProcess","process-instance-id",requestId,callbackResponse); + + //same object returned + WorkflowContext contextFound = contextHolder.getWorkflowContext(requestId); + if(contextFound == null) + throw new Exception("Expected to find Context Object"); + + WorkflowResponse testResponse = contextFound.getWorkflowResponse(); + Assert.assertEquals(200,testResponse.getMessageCode()); + Assert.assertEquals(message, testResponse.getMessage()); + Assert.assertEquals(responseMessage, testResponse.getResponse()); + + + + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java new file mode 100644 index 0000000000..8ebc80c4c2 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java @@ -0,0 +1,2215 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.onap.so.bpmn.core.json.JsonUtils.getJsonValue; +import static org.onap.so.bpmn.core.json.JsonUtils.updJsonValue; + +import java.io.IOException; +import java.io.StringReader; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.ws.rs.core.Response; +import javax.xml.bind.JAXBException; +import javax.xml.namespace.NamespaceContext; +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpression; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; + +import org.camunda.bpm.engine.HistoryService; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.ProcessEngineException; +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.history.HistoricProcessInstance; +import org.camunda.bpm.engine.history.HistoricVariableInstance; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.test.ProcessEngineRule; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.custommonkey.xmlunit.DetailedDiff; +import org.custommonkey.xmlunit.XMLUnit; +import org.json.JSONArray; +import org.json.JSONObject; +import org.junit.Rule; +import org.onap.so.bpmn.common.adapter.sdnc.CallbackHeader; +import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest; +import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterResponse; +import org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification; +import org.onap.so.bpmn.common.adapter.vnf.DeleteVnfNotification; +import org.onap.so.bpmn.common.adapter.vnf.MsoExceptionCategory; +import org.onap.so.bpmn.common.adapter.vnf.MsoRequest; +import org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification; +import org.onap.so.bpmn.common.adapter.vnf.VnfRollback; +import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; +import org.onap.so.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl; +import org.onap.so.bpmn.common.workflow.service.VnfAdapterNotifyServiceImpl; +import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource; +import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource; +import org.onap.so.bpmn.common.workflow.service.WorkflowResource; +import org.onap.so.bpmn.core.domain.Resource; +import org.onap.so.bpmn.core.domain.ServiceDecomposition; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + + + +/** + * A base class for Workflow tests. + *

+ * WireMock response transformers may be specified by declaring public + * static fields with the @WorkflowTestTransformer annotation. For example: + *

+ *     @WorkflowTestTransformer
+ *     public static final ResponseTransformer sdncAdapterMockTransformer =
+ *         new SDNCAdapterMockTransformer();
+ * 
+ */ + +public abstract class WorkflowTest { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowTest.class); + + //TODO this is not used anymore, can maybe be removed + @Rule + public ProcessEngineRule processEngineRule; + + @Autowired + protected WorkflowResource workflowResourceSync; + + @Autowired + protected ProcessEngine processEngine; + + @Autowired + protected RuntimeService runtimeService; + + @Autowired + protected HistoryService historyService; + + @Autowired + private WorkflowAsyncResource workflowResource; + + @Autowired + private WorkflowMessageResource workflowMessageResource; + + @Autowired + SDNCAdapterCallbackServiceImpl callbackService; + /** + * Content-Type for XML. + */ + protected static final String XML = "application/xml"; + + /** + * Content-Type for JSON. + */ + protected static final String JSON = "application/json; charset=UTF-8"; + + + /** + * Constructor. + */ + public WorkflowTest() throws RuntimeException { + } + + /** + * The current request ID. Normally set when an "invoke" method is called. + */ + protected volatile String msoRequestId = null; + + /** + * The current service instance ID. Normally set when an "invoke" method + * is called. + */ + protected volatile String msoServiceInstanceId = null; + + /** + * Logs a test start method. + */ + protected void logStart() { + msoLogger.debug("STARTED TEST"); + } + + /** + * Logs a test end method. + */ + protected void logEnd() { + msoLogger.debug("ENDED TEST"); + } + + /** + * Invokes a subprocess. + * @param processKey the process key + * @param businessKey a unique key that will identify the process instance + * @param injectedVariables variables to inject into the process + */ + protected void invokeSubProcess(String processKey, String businessKey, Map injectedVariables) { + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); + List arguments = runtimeMxBean.getInputArguments(); + msoLogger.debug("JVM args = " + arguments); + + msoRequestId = (String) injectedVariables.get("mso-request-id"); + String requestId = (String) injectedVariables.get("msoRequestId"); + + if (msoRequestId == null && requestId == null) { + String msg = "mso-request-id variable was not provided"; + msoLogger.debug(msg); + fail(msg); + } + + // Note: some scenarios don't have a service-instance-id, may be null + msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id"); + + + runtimeService.startProcessInstanceByKey(processKey, businessKey, injectedVariables); + } + + protected String invokeSubProcess(String processKey, Map injectedVariables) { + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); + List arguments = runtimeMxBean.getInputArguments(); + msoLogger.debug("JVM args = " + arguments); + + msoRequestId = (String) injectedVariables.get("mso-request-id"); + String requestId = (String) injectedVariables.get("msoRequestId"); + + if (msoRequestId == null && requestId == null) { + String msg = "mso-request-id variable was not provided"; + msoLogger.debug(msg); + fail(msg); + } + + // Note: some scenarios don't have a service-instance-id, may be null + msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id"); + + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processKey, msoRequestId, injectedVariables); + return processInstance.getId(); + } + + /** + * Invokes an asynchronous process. + * Errors are handled with junit assertions and will cause the test to fail. + * @param processKey the process key + * @param schemaVersion the API schema version, e.g. "v1" + * @param businessKey a unique key that will identify the process instance + * @param request the request + * @return a TestAsyncResponse object associated with the test + * @throws InterruptedException + */ + protected TestAsyncResponse invokeAsyncProcess(String processKey, + String schemaVersion, String businessKey, String request) throws InterruptedException { + return invokeAsyncProcess(processKey, schemaVersion, businessKey, request, null); + } + + /** + * Invokes an asynchronous process. + * Errors are handled with junit assertions and will cause the test to fail. + * @param processKey the process key + * @param schemaVersion the API schema version, e.g. "v1" + * @param businessKey a unique key that will identify the process instance + * @param request the request + * @param injectedVariables optional variables to inject into the process + * @return a TestAsyncResponse object associated with the test + * @throws InterruptedException + */ + protected TestAsyncResponse invokeAsyncProcess(String processKey, + String schemaVersion, String businessKey, String request, + Map injectedVariables) { + + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); + List arguments = runtimeMxBean.getInputArguments(); + msoLogger.debug("JVM args = " + arguments); + + Map variables = createVariables(schemaVersion, businessKey, + request, injectedVariables, false); + VariableMapImpl variableMapImpl = createVariableMapImpl(variables); + + msoLogger.debug("Sending " + request + " to " + processKey + " process"); + + TestAsyncResponse asyncResponse = new TestAsyncResponse(); + + asyncResponse.setResponse(workflowResource.startProcessInstanceByKey( processKey, variableMapImpl)); + + return asyncResponse; + } + + /** + * Invokes an asynchronous process. + * Errors are handled with junit assertions and will cause the test to fail. + * @param processKey the process key + * @param schemaVersion the API schema version, e.g. "v1" + * @param businessKey a unique key that will identify the process instance + * @param request the request + * @param injectedVariables optional variables to inject into the process + * @param serviceInstantiationModel indicates whether this method is being + * invoked for a flow that is designed using the service instantiation model + * @return a TestAsyncResponse object associated with the test + * @throws InterruptedException + */ + protected Response invokeAsyncProcess(String processKey, + String schemaVersion, String businessKey, String request, + Map injectedVariables, boolean serviceInstantiationModel) { + + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); + List arguments = runtimeMxBean.getInputArguments(); + msoLogger.debug("JVM args = " + arguments); + + Map variables = createVariables(schemaVersion, businessKey, + request, injectedVariables, serviceInstantiationModel); + VariableMapImpl variableMapImpl = createVariableMapImpl(variables); + + msoLogger.debug("Sending " + request + " to " + processKey + " process"); + + return workflowResource.startProcessInstanceByKey( processKey, variableMapImpl); + + } + + /** + * Private helper method that creates a variable map for a request. + * Errors are handled with junit assertions and will cause the test to fail. + * @param schemaVersion the API schema version, e.g. "v1" + * @param businessKey a unique key that will identify the process instance + * @param request the request + * @param injectedVariables optional variables to inject into the process + * @param serviceInstantiationModel indicates whether this method is being + * invoked for a flow that is designed using the service instantiation model + * @return a variable map + */ + private Map createVariables(String schemaVersion, + String businessKey, String request, Map injectedVariables, + boolean serviceInstantiationModel) { + + Map variables = new HashMap<>(); + + // These variables may be overridded by injected variables. + variables.put("mso-service-request-timeout", "180"); + variables.put("isDebugLogEnabled", "true"); + + // These variables may not be overridded by injected variables. + String[] notAllowed = new String[] { + "mso-schema-version", + "mso-business-key", + "bpmnRequest", + "mso-request-id", + "mso-service-instance-id" + }; + + if (injectedVariables != null) { + for (String key : injectedVariables.keySet()) { + for (String var : notAllowed) { + if (var.equals(key)) { + String msg = "Cannot specify " + var + " in injected variables"; + msoLogger.debug(msg); + fail(msg); + } + } + + variables.put(key, injectedVariables.get(key)); + } + } + + variables.put("mso-schema-version", schemaVersion); + variables.put("mso-business-key", businessKey); + variables.put("bpmnRequest", request); + + if (serviceInstantiationModel) { + + /* + * The request ID and the service instance ID are generated for flows + * that follow the service instantiation model unless "requestId" and + * "serviceInstanceId" are injected variables. + */ + + try { + msoRequestId = (String) injectedVariables.get("requestId"); + variables.put("mso-request-id", msoRequestId); + msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId"); + variables.put("mso-service-instance-id", msoServiceInstanceId); + } + catch(Exception e) { + } + if (msoRequestId == null || msoRequestId.trim().equals("")) { + msoLogger.debug("No requestId element in injectedVariables"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + } + if (msoServiceInstanceId == null || msoServiceInstanceId.trim().equals("")) { + msoLogger.debug("No seviceInstanceId element in injectedVariables"); + variables.put("mso-service-instance-id", UUID.randomUUID().toString()); + } + + } else { + msoRequestId = getXMLTextElement(request, "request-id"); + + if (msoRequestId == null) { + //check in injected variables + try { + msoRequestId = (String) injectedVariables.get("requestId"); + } + catch(Exception e) { + } + if (msoRequestId == null || msoRequestId.trim().equals("")) { + String msg = "No request-id element in " + request; + msoLogger.debug(msg); + fail(msg); + } + } + + variables.put("mso-request-id", msoRequestId); + + // Note: some request types don't have a service-instance-id + msoServiceInstanceId = getXMLTextElement(request, "service-instance-id"); + + if (msoServiceInstanceId != null) { + variables.put("mso-service-instance-id", msoServiceInstanceId); + } + } + + return variables; + } + + /** + * Private helper method that creates a camunda VariableMapImpl from a simple + * variable map. + * @param variables the simple variable map + * @return a VariableMap + */ + private VariableMapImpl createVariableMapImpl(Map variables) { + Map wrappedVariables = new HashMap<>(); + + for (String key : variables.keySet()) { + Object value = variables.get(key); + wrappedVariables.put(key, wrapVariableValue(value)); + } + + VariableMapImpl variableMapImpl = new VariableMapImpl(); + variableMapImpl.put("variables", wrappedVariables); + return variableMapImpl; + } + + /** + * Private helper method that wraps a variable value for inclusion in a + * camunda VariableMapImpl. + * @param value the variable value + * @return the wrapped variable + */ + private Map wrapVariableValue(Object value) { + HashMap valueMap = new HashMap<>(); + valueMap.put("value", value); + return valueMap; + } + + /** + * Receives a response from an asynchronous process. + * Errors are handled with junit assertions and will cause the test to fail. + * @param businessKey the process business key + * @param asyncResponse the TestAsyncResponse object associated with the test + * @param timeout the timeout in milliseconds + * @return the WorkflowResponse + */ + protected WorkflowResponse receiveResponse(String businessKey, + TestAsyncResponse asyncResponse, long timeout) { + msoLogger.debug("Waiting " + timeout + "ms for process with business key " + businessKey + + " to send a response"); + + long now = System.currentTimeMillis() + timeout; + long endTime = now + timeout; + + while (now <= endTime) { + Response response = asyncResponse.getResponse(); + + if (response != null) { + msoLogger.debug("Received a response from process with business key " + businessKey); + + Object entity = response.getEntity(); + + if (!(entity instanceof WorkflowResponse)) { + String msg = "Response entity is " + + (entity == null ? "null" : entity.getClass().getName()) + + ", expected WorkflowResponse"; + msoLogger.debug(msg); + fail(msg); + return null; // unreachable + } + + return (WorkflowResponse) entity; + } + + try { + Thread.sleep(200); + } catch (InterruptedException e) { + String msg = "Interrupted waiting for a response from process with business key " + + businessKey; + msoLogger.debug(msg); + fail(msg); + return null; // unreachable + } + + now = System.currentTimeMillis(); + } + + String msg = "No response received from process with business key " + businessKey + + " within " + timeout + "ms"; + msoLogger.debug(msg); + fail("Process with business key " + businessKey + " did not end within 10000ms"); + return null; // unreachable + } + + /** + * Runs a program to inject SDNC callback data into the test environment. + * A program is essentially just a list of keys that identify callback data + * to be injected, in sequence. An example program: + *
+	 *     reserve, assign, delete:ERR
+	 * 
+ * Errors are handled with junit assertions and will cause the test to fail. + * @param callbacks an object containing callback data for the program + * @param program the program to execute + */ + protected void injectSDNCRestCallbacks(CallbackSet callbacks, String program) { + + String[] cmds = program.replaceAll("\\s+", "").split(","); + + for (String cmd : cmds) { + String action = cmd; + String modifier = "STD"; + + if (cmd.contains(":")) { + String[] parts = cmd.split(":"); + action = parts[0]; + modifier = parts[1]; + } + + String content = null; + String contentType = null; + + if ("STD".equals(modifier)) { + CallbackData callbackData = callbacks.get(action); + + if (callbackData == null) { + String msg = "No callback defined for '" + action + "' SDNC request"; + msoLogger.debug(msg); + fail(msg); + } + + content = callbackData.getContent(); + contentType = callbackData.getContentType(); + } else if ("ERR".equals(modifier)) { + content = "{\"SDNCServiceError\":{\"sdncRequestId\":\"((REQUEST-ID))\",\"responseCode\":\"500\",\"responseMessage\":\"SIMULATED ERROR FROM SDNC ADAPTER\",\"ackFinalIndicator\":\"Y\"}}"; + contentType = JSON; + } else { + String msg = "Invalid SDNC program modifier: '" + modifier + "'"; + msoLogger.debug(msg); + fail(msg); + } + + if (contentType == null) { + // Default for backward compatibility with existing tests. + contentType = JSON; + } + + if (!injectSDNCRestCallback(contentType, content, 10000)) { + fail("Failed to inject SDNC '" + action + "' callback"); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + fail("Interrupted after injection of SDNC '" + action + "' callback"); + } + } + } + + /** + * Runs a program to inject SDNC events into the test environment. + * A program is essentially just a list of keys that identify event data + * to be injected, in sequence. An example program: + *
+	 *     event1, event2
+	 * 
+ * NOTE: Each callback must have a message type associated with it, e.g. + * "SDNCAEvent". + * Errors are handled with junit assertions and will cause the test to fail. + * @param callbacks an object containing event data for the program + * @param program the program to execute + */ + protected void injectSDNCEvents(CallbackSet callbacks, String program) { + injectWorkflowMessages(callbacks, program); + } + + /** + * Runs a program to inject SDNC callback data into the test environment. + * A program is essentially just a list of keys that identify callback data + * to be injected, in sequence. An example program: + *
+	 *     reserve, assign, delete:ERR
+	 * 
+ * Errors are handled with junit assertions and will cause the test to fail. + * @param callbacks an object containing callback data for the program + * @param program the program to execute + */ + protected void injectSDNCCallbacks(CallbackSet callbacks, String program) { + + String[] cmds = program.replaceAll("\\s+", "").split(","); + + for (String cmd : cmds) { + String action = cmd; + String modifier = "STD"; + + if (cmd.contains(":")) { + String[] parts = cmd.split(":"); + action = parts[0]; + modifier = parts[1]; + } + + String content = null; + int respCode = 200; + String respMsg = "OK"; + + if ("STD".equals(modifier)) { + CallbackData callbackData = callbacks.get(action); + + if (callbackData == null) { + String msg = "No callback defined for '" + action + "' SDNC request"; + msoLogger.debug(msg); + fail(msg); + } + + content = callbackData.getContent(); + respCode = 200; + respMsg = "OK"; + } else if ("CREATED".equals(modifier)) { + CallbackData callbackData = callbacks.get(action); + + if (callbackData == null) { + String msg = "No callback defined for '" + action + "' SDNC request"; + msoLogger.debug(msg); + fail(msg); + } + + content = callbackData.getContent(); + respCode = 201; + respMsg = "Created"; + } else if ("ERR".equals(modifier)) { + content = "((REQUEST-ID))500SIMULATED ERROR FROM SDNC ADAPTER"; + respCode = 500; + respMsg = "SERVER ERROR"; + } else { + String msg = "Invalid SDNC program modifier: '" + modifier + "'"; + msoLogger.debug(msg); + fail(msg); + } + + if (!injectSDNCCallback(respCode, respMsg, content, 10000)) { + fail("Failed to inject SDNC '" + action + "' callback"); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + fail("Interrupted after injection of SDNC '" + action + "' callback"); + } + } + } + + /** + * Runs a program to inject VNF adapter REST callback data into the test environment. + * A program is essentially just a list of keys that identify callback data + * to be injected, in sequence. An example program: + *
+	 *     create, rollback
+	 * 
+ * Errors are handled with junit assertions and will cause the test to fail. + * @param callbacks an object containing callback data for the program + * @param program the program to execute + */ + protected void injectVNFRestCallbacks(CallbackSet callbacks, String program) { + + String[] cmds = program.replaceAll("\\s+", "").split(","); + + for (String cmd : cmds) { + String action = cmd; + String modifier = "STD"; + + if (cmd.contains(":")) { + String[] parts = cmd.split(":"); + action = parts[0]; + modifier = parts[1]; + } + + String content = null; + String contentType = null; + + if ("STD".equals(modifier)) { + CallbackData callbackData = callbacks.get(action); + + if (callbackData == null) { + String msg = "No callback defined for '" + action + "' VNF REST request"; + msoLogger.debug(msg); + fail(msg); + } + + content = callbackData.getContent(); + contentType = callbackData.getContentType(); + } else if ("ERR".equals(modifier)) { + content = "SIMULATED ERROR FROM VNF ADAPTER"; + contentType = "text/plain"; + } else { + String msg = "Invalid VNF REST program modifier: '" + modifier + "'"; + msoLogger.debug(msg); + fail(msg); + } + + if (contentType == null) { + // Default for backward compatibility with existing tests. + contentType = XML; + } + + if (!injectVnfAdapterRestCallback(contentType, content, 10000)) { + fail("Failed to inject VNF REST '" + action + "' callback"); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + fail("Interrupted after injection of VNF REST '" + action + "' callback"); + } + } + } + + /** + * Runs a program to inject VNF callback data into the test environment. + * A program is essentially just a list of keys that identify callback data + * to be injected, in sequence. An example program: + *
+	 *     createVnf, deleteVnf
+	 * 
+ * Errors are handled with junit assertions and will cause the test to fail. + * @param callbacks an object containing callback data for the program + * @param program the program to execute + */ + protected void injectVNFCallbacks(CallbackSet callbacks, String program) { + + String[] cmds = program.replaceAll("\\s+", "").split(","); + + for (String cmd : cmds) { + String action = cmd; + String modifier = "STD"; + + if (cmd.contains(":")) { + String[] parts = cmd.split(":"); + action = parts[0]; + modifier = parts[1]; + } + + String content = null; + + if ("STD".equals(modifier)) { + CallbackData callbackData = callbacks.get(action); + + if (callbackData == null) { + String msg = "No callback defined for '" + action + "' VNF request"; + msoLogger.debug(msg); + fail(msg); + } + + content = callbackData.getContent(); + } else if ("ERR".equals(modifier)) { + String msg = "Currently unsupported VNF program modifier: '" + modifier + "'"; + msoLogger.debug(msg); + fail(msg); + } else { + String msg = "Invalid VNF program modifier: '" + modifier + "'"; + msoLogger.debug(msg); + fail(msg); + } + + boolean injected = false; + + if (content.contains("createVnfNotification")) { + injected = injectCreateVNFCallback(content, 10000); + } else if (content.contains("deleteVnfNotification")) { + injected = injectDeleteVNFCallback(content, 10000); + } else if (content.contains("updateVnfNotification")) { + injected = injectUpdateVNFCallback(content, 10000); + } + + if (!injected) { + String msg = "Failed to inject VNF '" + action + "' callback"; + msoLogger.debug(msg); + fail(msg); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + fail("Interrupted after injection of VNF '" + action + "' callback"); + } + } + } + + /** + * Waits for the number of running processes with the specified process + * definition key to equal a particular count. + * @param processKey the process definition key + * @param count the desired count + * @param timeout the timeout in milliseconds + */ + protected void waitForRunningProcessCount(String processKey, int count, long timeout) { + msoLogger.debug("Waiting " + timeout + "ms for there to be " + count + " " + + processKey + " instances"); + + long now = System.currentTimeMillis() + timeout; + long endTime = now + timeout; + int last = -1; + + while (now <= endTime) { + int actual = runtimeService + .createProcessInstanceQuery() + .processDefinitionKey(processKey) + .list().size(); + + if (actual != last) { + msoLogger.debug("There are now " + actual + " " + + processKey + " instances"); + last = actual; + } + + if (actual == count) { + return; + } + + try { + Thread.sleep(200); + } catch (InterruptedException e) { + String msg = "Interrupted waiting for there to be " + count + " " + + processKey + " instances"; + msoLogger.debug(msg); + fail(msg); + } + + now = System.currentTimeMillis(); + } + + String msg = "Timed out waiting for there to be " + count + " " + + processKey + " instances"; + msoLogger.debug(msg); + fail(msg); + } + + /** + * Waits for the specified process variable to be set. + * @param processKey the process definition key + * @param variable the variable name + * @param timeout the timeout in milliseconds + * @return the variable value, or null if it cannot be obtained + * in the specified time + */ + protected Object getProcessVariable(String processKey, String variable, + long timeout) { + + msoLogger.debug("Waiting " + timeout + "ms for " + + processKey + "." + variable + " to be set"); + + long now = System.currentTimeMillis() + timeout; + long endTime = now + timeout; + + ProcessInstance processInstance = null; + Object value = null; + + while (value == null) { + if (now > endTime) { + if (processInstance == null) { + msoLogger.debug("Timed out waiting for " + + processKey + " to start"); + } else { + msoLogger.debug("Timed out waiting for " + + processKey + "[" + processInstance.getId() + + "]." + variable + " to be set"); + } + + return null; + } + + if (processInstance == null) { + processInstance = runtimeService + .createProcessInstanceQuery() + .processDefinitionKey(processKey) + .singleResult(); + } + + if (processInstance != null) { + value = runtimeService + .getVariable(processInstance.getId(), variable); + } + + try { + Thread.sleep(200); + } catch (InterruptedException e) { + msoLogger.debug("Interrupted waiting for " + + processKey + "." + variable + " to be set"); + return null; + } + + now = System.currentTimeMillis(); + } + + msoLogger.debug(processKey + "[" + + processInstance.getId() + "]." + variable + "=" + + value); + + return value; + } + + /** + * Injects a single SDNC adapter callback request. The specified callback data + * may contain the placeholder string ((REQUEST-ID)) which is replaced with + * the actual SDNC request ID. Note: this is not the requestId in the original + * MSO request. + * @param contentType the HTTP content type for the callback + * @param content the content of the callback + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + */ + protected boolean injectSDNCRestCallback(String contentType, String content, long timeout) { + String sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV1", + "SDNCAResponse_CORRELATOR", timeout); + + if (sdncRequestId == null) { + return false; + } + + content = content.replace("((REQUEST-ID))", sdncRequestId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{REQUEST-ID}}", sdncRequestId); + + msoLogger.debug("Injecting SDNC adapter callback"); + + Response response = workflowMessageResource.deliver(contentType, "SDNCAResponse", sdncRequestId, content); + msoLogger.debug("Workflow response to SDNC adapter callback: " + response); + return true; + } + + /** + * Injects a single SDNC adapter callback request. The specified callback data + * may contain the placeholder string ((REQUEST-ID)) which is replaced with + * the actual SDNC request ID. Note: this is not the requestId in the original + * MSO request. + * @param content the content of the callback + * @param respCode the response code (normally 200) + * @param respMsg the response message (normally "OK") + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + */ + protected boolean injectSDNCCallback(int respCode, String respMsg, + String content, long timeout) { + + String sdncRequestId = (String) getProcessVariable("sdncAdapter", + "SDNCA_requestId", timeout); + + if (sdncRequestId == null) { + return false; + } + + content = content.replace("((REQUEST-ID))", sdncRequestId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{REQUEST-ID}}", sdncRequestId); + + // TODO this needs to be fixed. It is causing double tags and content + // Need to parse content before setting below since content includes not just RequestData or modify callback files to only contain RequestData contents. + + msoLogger.debug("Injecting SDNC adapter callback"); + CallbackHeader callbackHeader = new CallbackHeader(); + callbackHeader.setRequestId(sdncRequestId); + callbackHeader.setResponseCode(String.valueOf(respCode)); + callbackHeader.setResponseMessage(respMsg); + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); + sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); + sdncAdapterCallbackRequest.setRequestData(content); + SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); + msoLogger.debug("Workflow response to SDNC adapter callback: " + sdncAdapterResponse); + + return true; + } + + /** + * Injects a single VNF adapter callback request. The specified callback data + * may contain the placeholder string ((MESSAGE-ID)) which is replaced with + * the actual message ID. Note: this is not the requestId in the original + * MSO request. + * @param contentType the HTTP content type for the callback + * @param content the content of the callback + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + */ + protected boolean injectVnfAdapterRestCallback(String contentType, String content, long timeout) { + String messageId = (String) getProcessVariable("vnfAdapterRestV1", + "VNFAResponse_CORRELATOR", timeout); + + if (messageId == null) { + return false; + } + + content = content.replace("((MESSAGE-ID))", messageId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{MESSAGE-ID}}", messageId); + + msoLogger.debug("Injecting VNF adapter callback"); + + Response response = workflowMessageResource.deliver(contentType, "VNFAResponse", messageId, content); + msoLogger.debug("Workflow response to VNF adapter callback: " + response); + return true; + } + + /** + * Injects a Create VNF adapter callback request. The specified callback data + * may contain the placeholder string ((MESSAGE-ID)) which is replaced with + * the actual message ID. It may also contain the placeholder string + * ((REQUEST-ID)) which is replaced request ID of the original MSO request. + * @param content the content of the callback + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + * @throws JAXBException if the content does not adhere to the schema + */ + protected boolean injectCreateVNFCallback(String content, long timeout) { + + String messageId = (String) getProcessVariable("vnfAdapterCreateV1", + "VNFC_messageId", timeout); + + if (messageId == null) { + return false; + } + + content = content.replace("((MESSAGE-ID))", messageId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{MESSAGE-ID}}", messageId); + + if(content.contains("((REQUEST-ID))")){ + content = content.replace("((REQUEST-ID))", msoRequestId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{REQUEST-ID}}", msoRequestId); + } + + msoLogger.debug("Injecting VNF adapter callback"); + + // Is it possible to unmarshal this with JAXB? I couldn't. + + CreateVnfNotification createVnfNotification = new CreateVnfNotification(); + XPathTool xpathTool = new VnfNotifyXPathTool(); + xpathTool.setXML(content); + + try { + String completed = xpathTool.evaluate( + "/tns:createVnfNotification/tns:completed/text()"); + createVnfNotification.setCompleted("true".equals(completed)); + + String vnfId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:vnfId/text()"); + createVnfNotification.setVnfId(vnfId); + + NodeList entries = (NodeList) xpathTool.evaluate( + "/tns:createVnfNotification/tns:outputs/tns:entry", + XPathConstants.NODESET); + + CreateVnfNotificationOutputs outputs = new CreateVnfNotificationOutputs(); + + for (int i = 0; i < entries.getLength(); i++) { + Node node = entries.item(i); + + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element entry = (Element) node; + String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent(); + String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent(); + outputs.add(key, value); + } + } + + createVnfNotification.setOutputs(outputs); + + VnfRollback rollback = new VnfRollback(); + + String cloudSiteId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:cloudSiteId/text()"); + rollback.setCloudSiteId(cloudSiteId); + + String requestId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()"); + String serviceInstanceId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()"); + + if (requestId != null || serviceInstanceId != null) { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestId); + msoRequest.setServiceInstanceId(serviceInstanceId); + rollback.setMsoRequest(msoRequest); + } + + String tenantCreated = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:tenantCreated/text()"); + rollback.setTenantCreated("true".equals(tenantCreated)); + + String tenantId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:tenantId/text()"); + rollback.setTenantId(tenantId); + + String vnfCreated = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:vnfCreated/text()"); + rollback.setVnfCreated("true".equals(vnfCreated)); + + String rollbackVnfId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:vnfId/text()"); + rollback.setVnfId(rollbackVnfId); + + createVnfNotification.setRollback(rollback); + + } catch (Exception e) { + msoLogger.debug("Failed to unmarshal VNF callback content:"); + msoLogger.debug(content); + return false; + } + + VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl(); + + + notifyService.createVnfNotification( + messageId, + createVnfNotification.isCompleted(), + createVnfNotification.getException(), + createVnfNotification.getErrorMessage(), + createVnfNotification.getVnfId(), + createVnfNotification.getOutputs(), + createVnfNotification.getRollback()); + + return true; + } + + /** + * Injects a Delete VNF adapter callback request. The specified callback data + * may contain the placeholder string ((MESSAGE-ID)) which is replaced with + * the actual message ID. It may also contain the placeholder string + * ((REQUEST-ID)) which is replaced request ID of the original MSO request. + * @param content the content of the callback + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + * @throws JAXBException if the content does not adhere to the schema + */ + protected boolean injectDeleteVNFCallback(String content, long timeout) { + + String messageId = (String) getProcessVariable("vnfAdapterDeleteV1", + "VNFDEL_uuid", timeout); + + if (messageId == null) { + return false; + } + + content = content.replace("((MESSAGE-ID))", messageId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{MESSAGE-ID}}", messageId); + + msoLogger.debug("Injecting VNF adapter delete callback"); + + // Is it possible to unmarshal this with JAXB? I couldn't. + + DeleteVnfNotification deleteVnfNotification = new DeleteVnfNotification(); + XPathTool xpathTool = new VnfNotifyXPathTool(); + xpathTool.setXML(content); + + try { + String completed = xpathTool.evaluate( + "/tns:deleteVnfNotification/tns:completed/text()"); + deleteVnfNotification.setCompleted("true".equals(completed)); + // if notification failure, set the exception and error message + if (deleteVnfNotification.isCompleted() == false) { + deleteVnfNotification.setException(MsoExceptionCategory.INTERNAL); + deleteVnfNotification.setErrorMessage(xpathTool.evaluate( + "/tns:deleteVnfNotification/tns:errorMessage/text()")) ; + } + + } catch (Exception e) { + msoLogger.debug("Failed to unmarshal VNF Delete callback content:"); + msoLogger.debug(content); + return false; + } + + VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl(); + + + notifyService.deleteVnfNotification( + messageId, + deleteVnfNotification.isCompleted(), + deleteVnfNotification.getException(), + deleteVnfNotification.getErrorMessage()); + + return true; + } + + /** + * Injects a Update VNF adapter callback request. The specified callback data + * may contain the placeholder string ((MESSAGE-ID)) which is replaced with + * the actual message ID. It may also contain the placeholder string + * ((REQUEST-ID)) which is replaced request ID of the original MSO request. + * @param content the content of the callback + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + * @throws JAXBException if the content does not adhere to the schema + */ + protected boolean injectUpdateVNFCallback(String content, long timeout) { + + String messageId = (String) getProcessVariable("vnfAdapterUpdate", + "VNFU_messageId", timeout); + + if (messageId == null) { + return false; + } + + content = content.replace("((MESSAGE-ID))", messageId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{MESSAGE-ID}}", messageId); + + content = content.replace("((REQUEST-ID))", msoRequestId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{REQUEST-ID}}", msoRequestId); + + msoLogger.debug("Injecting VNF adapter callback"); + + // Is it possible to unmarshal this with JAXB? I couldn't. + + UpdateVnfNotification updateVnfNotification = new UpdateVnfNotification(); + XPathTool xpathTool = new VnfNotifyXPathTool(); + xpathTool.setXML(content); + + try { + String completed = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:completed/text()"); + updateVnfNotification.setCompleted("true".equals(completed)); + + NodeList entries = (NodeList) xpathTool.evaluate( + "/tns:updateVnfNotification/tns:outputs/tns:entry", + XPathConstants.NODESET); + + UpdateVnfNotificationOutputs outputs = new UpdateVnfNotificationOutputs(); + + for (int i = 0; i < entries.getLength(); i++) { + Node node = entries.item(i); + + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element entry = (Element) node; + String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent(); + String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent(); + outputs.add(key, value); + } + } + + updateVnfNotification.setOutputs(outputs); + + VnfRollback rollback = new VnfRollback(); + + String cloudSiteId = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()"); + rollback.setCloudSiteId(cloudSiteId); + + String requestId = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()"); + String serviceInstanceId = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()"); + + if (requestId != null || serviceInstanceId != null) { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestId); + msoRequest.setServiceInstanceId(serviceInstanceId); + rollback.setMsoRequest(msoRequest); + } + + String tenantCreated = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:tenantCreated/text()"); + rollback.setTenantCreated("true".equals(tenantCreated)); + + String tenantId = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:tenantId/text()"); + rollback.setTenantId(tenantId); + + String vnfCreated = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:vnfCreated/text()"); + rollback.setVnfCreated("true".equals(vnfCreated)); + + String rollbackVnfId = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:vnfId/text()"); + rollback.setVnfId(rollbackVnfId); + + updateVnfNotification.setRollback(rollback); + + } catch (Exception e) { + msoLogger.debug("Failed to unmarshal VNF callback content:"); + msoLogger.debug(content); + return false; + } + + VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl(); + + + notifyService.updateVnfNotification( + messageId, + updateVnfNotification.isCompleted(), + updateVnfNotification.getException(), + updateVnfNotification.getErrorMessage(), + updateVnfNotification.getOutputs(), + updateVnfNotification.getRollback()); + + return true; + } + + /** + * Runs a program to inject workflow messages into the test environment. + * A program is essentially just a list of keys that identify event data + * to be injected, in sequence. An example program: + *
+	 *     event1, event2
+	 * 
+ * Errors are handled with junit assertions and will cause the test to fail. + * NOTE: Each callback must have a workflow message type associated with it. + * @param callbacks an object containing event data for the program + * @param program the program to execute + */ + protected void injectWorkflowMessages(CallbackSet callbacks, String program) { + + String[] cmds = program.replaceAll("\\s+", "").split(","); + + for (String cmd : cmds) { + String action = cmd; + String modifier = "STD"; + + if (cmd.contains(":")) { + String[] parts = cmd.split(":"); + action = parts[0]; + modifier = parts[1]; + } + + String messageType = null; + String content = null; + String contentType = null; + + if ("STD".equals(modifier)) { + CallbackData callbackData = callbacks.get(action); + + if (callbackData == null) { + String msg = "No '" + action + "' workflow message callback is defined"; + msoLogger.debug(msg); + fail(msg); + } + + messageType = callbackData.getMessageType(); + + if (messageType == null || messageType.trim().equals("")) { + String msg = "No workflow message type is defined in the '" + action + "' callback"; + msoLogger.debug(msg); + fail(msg); + } + + content = callbackData.getContent(); + contentType = callbackData.getContentType(); + } else { + String msg = "Invalid workflow message program modifier: '" + modifier + "'"; + msoLogger.debug(msg); + fail(msg); + } + + if (!injectWorkflowMessage(contentType, messageType, content, 10000)) { + fail("Failed to inject '" + action + "' workflow message"); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + fail("Interrupted after injection of '" + action + "' workflow message"); + } + } + } + + /** + * Injects a workflow message. The specified callback data may contain the + * placeholder string ((CORRELATOR)) which is replaced with the actual + * correlator value. + * @param contentType the HTTP contentType for the message (possibly null) + * @param messageType the message type + * @param content the message content (possibly null) + * @param timeout the timeout in milliseconds + * @return true if the message could be injected, false otherwise + */ + protected boolean injectWorkflowMessage(String contentType, String messageType, String content, long timeout) { + String correlator = (String) getProcessVariable("ReceiveWorkflowMessage", + messageType + "_CORRELATOR", timeout); + + if (correlator == null) { + return false; + } + + if (content != null) { + content = content.replace("((CORRELATOR))", correlator); + } + + msoLogger.debug("Injecting " + messageType + " message"); + + Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content); + msoLogger.debug("Workflow response to " + messageType + " message: " + response); + return true; + } + + /** + * Runs a program to inject sniro workflow messages into the test environment. + * A program is essentially just a list of keys that identify event data + * to be injected, in sequence. For more details, see + * injectSNIROCallbacks(String contentType, String messageType, String content, long timeout) + * + * Errors are handled with junit assertions and will cause the test to fail. + * NOTE: Each callback must have a workflow message type associated with it. + * + * @param callbacks an object containing event data for the program + * @param program the program to execute + */ + protected void injectSNIROCallbacks(CallbackSet callbacks, String program) { + + String[] cmds = program.replaceAll("\\s+", "").split(","); + + for (String cmd : cmds) { + String action = cmd; + String modifier = "STD"; + + if (cmd.contains(":")) { + String[] parts = cmd.split(":"); + action = parts[0]; + modifier = parts[1]; + } + + String messageType = null; + String content = null; + String contentType = null; + + if ("STD".equals(modifier)) { + CallbackData callbackData = callbacks.get(action); + + if (callbackData == null) { + String msg = "No '" + action + "' workflow message callback is defined"; + msoLogger.debug(msg); + fail(msg); + } + + messageType = callbackData.getMessageType(); + + if (messageType == null || messageType.trim().equals("")) { + String msg = "No workflow message type is defined in the '" + action + "' callback"; + msoLogger.debug(msg); + fail(msg); + } + + content = callbackData.getContent(); + contentType = callbackData.getContentType(); + } else { + String msg = "Invalid workflow message program modifier: '" + modifier + "'"; + msoLogger.debug(msg); + fail(msg); + } + + if (!injectSNIROCallbacks(contentType, messageType, content, 10000)) { + fail("Failed to inject '" + action + "' workflow message"); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + fail("Interrupted after injection of '" + action + "' workflow message"); + } + } + } + + /** + * Injects a sniro workflow message. The specified callback response may + * contain the placeholder strings ((CORRELATOR)) and ((SERVICE_RESOURCE_ID)) + * The ((CORRELATOR)) is replaced with the actual correlator value from the + * request. The ((SERVICE_RESOURCE_ID)) is replaced with the actual serviceResourceId + * value from the sniro request. Currently this only works with sniro request + * that contain only 1 resource. + * + * @param contentType the HTTP contentType for the message (possibly null) + * @param messageType the message type + * @param content the message content (possibly null) + * @param timeout the timeout in milliseconds + * @return true if the message could be injected, false otherwise + */ + protected boolean injectSNIROCallbacks(String contentType, String messageType, String content, long timeout) { + String correlator = (String) getProcessVariable("ReceiveWorkflowMessage", + messageType + "_CORRELATOR", timeout); + + if (correlator == null) { + return false; + } + if (content != null) { + content = content.replace("((CORRELATOR))", correlator); + if(messageType.equalsIgnoreCase("SNIROResponse")){ + ServiceDecomposition decomp = (ServiceDecomposition) getProcessVariable("Homing", "serviceDecomposition", timeout); + List resourceList = decomp.getServiceResources(); + if(resourceList.size() == 1){ + String resourceId = ""; + for(Resource resource:resourceList){ + resourceId = resource.getResourceId(); + } + String homingList = getJsonValue(content, "solutionInfo.placement"); + JSONArray placementArr = null; + try { + placementArr = new JSONArray(homingList); + } + catch (Exception e) { + return false; + } + if(placementArr.length() == 1){ + content = content.replace("((SERVICE_RESOURCE_ID))", resourceId); + } + String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo"); + JSONArray licenseArr = null; + try { + licenseArr = new JSONArray(licenseInfoList); + } + catch (Exception e) { + return false; + } + if(licenseArr.length() == 1){ + content = content.replace("((SERVICE_RESOURCE_ID))", resourceId); + } + } + else { + try { + String homingList = getJsonValue(content, "solutionInfo.placementInfo"); + String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo"); + JSONArray placementArr = new JSONArray(homingList); + JSONArray licenseArr = new JSONArray(licenseInfoList); + for (Resource resource: resourceList) { + String resourceModuleName = resource.getModelInfo().getModelInstanceName(); + String resourceId = resource.getResourceId(); + + for (int i=0; i>>>>>> origin/release/1806.51:bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java + * @author cb645j + */ + //TODO combine into 1 + private boolean isProcessEnded(String businessKey, String processName) { + HistoricProcessInstance processInstance = historyService + .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).processDefinitionName(processName).singleResult(); + return processInstance != null && processInstance.getEndTime() != null; + } + + /** + * Gets a variable value from a historical process instance. The business key must be unique. + * + * @param businessKey the process business key + * @param variableName the variable name + * @return the variable value or null if the variable does not exist + */ + protected Object getVariableFromHistory(String businessKey, String variableName) { + try { + HistoricProcessInstance processInstance = historyService + .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult(); + + if (processInstance == null) { + return null; + } + + HistoricVariableInstance v = historyService + .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()) + .variableName(variableName).singleResult(); + return v == null ? null : v.getValue(); + } catch (Exception e) { + msoLogger.debug("Error retrieving variable " + variableName + + " from historical process with business key " + businessKey + ": " + e); + return null; + } + } + + /** + * Gets a variable value from a process instance based on businessKey and process name. + * Must be used when multiple instances exist with the same business key such as when + * business key is passed to subflows or shared across multiple processes. This method + * can obtain variables from mainflows and from subflows. + * + * @param businessKey the process business key + * @param processName the process definition name + * @param variableName the variable name + * @return the variable value or null if the variable does not exist + * @author cb645j + */ + protected Object getVariableFromHistory(String businessKey, String processName, String variableName){ + try{ + HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).processDefinitionName(processName) + .singleResult(); + + if(processInstance == null){ + return null; + } + HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).variableName(variableName).singleResult(); + + return variable == null ? null : variable.getValue(); + }catch(ProcessEngineException e){ + msoLogger.debug("Multiple proccess instances exist with process name " + processName + " and business key " + businessKey + ". Must pass instance index as a parameter."); + return null; + }catch(Exception e){ + msoLogger.debug("Error retrieving variable " + variableName + " from historical process for process " + processName + " with business key " + businessKey + ": " + e); + return null; + } + } + + /** + * Gets the value of a process variable from x instance of y process. Must be used when + * multiple instances exist with the same business key AND process name. This method + * shall be used primarily for obtaining subflow variables when the business key is + * passed to the subflow AND the subflow is called multiple times in a given flow. + * + * @param businessKey the process business key + * @param processName the name of the subflow that contains the variable + * @param variableName the variable name + * @param processInstanceIndex the instance in which the subprocess was called + * @return the variable value or null if the variable does not exist + * @author cb645j + */ + protected Object getVariableFromHistory(String businessKey, int subflowInstanceIndex, String processName, String variableName){ + try{ + List processInstanceList = historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).processDefinitionName(processName) + .list(); + + if(processInstanceList == null){ + return null; + } + processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime())); + + HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex); + HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()) + .variableName(variableName).singleResult(); + + return variable == null ? null : variable.getValue(); + }catch(Exception e) { + msoLogger.debug("Error retrieving variable " + variableName + " from historical process for process " + processName + " with business key " + businessKey + ": " + e); + return null; + } + } + + + /** + * Gets the value of a subflow variable from the specified subflow's + * historical process instance. + * + * DEPRECATED - Use method getVariableFromHistory(businessKey, processName, variableName) instead + * + * @param subflowName - the name of the subflow that contains the variable + * @param variableName the variable name + * + * @return the variable value, or null if the variable could not be obtained + * + */ + @Deprecated + protected Object getVariableFromSubflowHistory(String subflowName, String variableName) { + try { + List processInstanceList = historyService + .createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list(); + + if (processInstanceList == null) { + return null; + } + + processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime())); + + HistoricProcessInstance processInstance = processInstanceList.get(0); + + HistoricVariableInstance v = historyService + .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()) + .variableName(variableName).singleResult(); + return v == null ? null : v.getValue(); + } catch (Exception e) { + msoLogger.debug("Error retrieving variable " + variableName + + " from sub flow: " + subflowName + ", Exception is: " + e); + return null; + } + } + + /** + * Gets the value of a subflow variable from the subflow's + * historical process x instance. + * + * DEPRECATED: Use method getVariableFromHistory(businessKey, processInstanceIndex, processName, variableName) instead + * + * @param subflowName - the name of the subflow that contains the variable + * @param variableName the variable name + * @param subflowInstanceIndex - the instance of the subflow (use when same subflow is called more than once from mainflow) + * + * @return the variable value, or null if the variable could not be obtained + */ + @Deprecated + protected Object getVariableFromSubflowHistory(int subflowInstanceIndex, String subflowName, String variableName) { + try { + List processInstanceList = historyService.createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list(); + + if (processInstanceList == null) { + return null; + } + + processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime())); + + HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex); + + HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()) + .variableName(variableName).singleResult(); + return v == null ? null : v.getValue(); + } catch (Exception e) { + msoLogger.debug("Error retrieving variable " + variableName + + " from " + subflowInstanceIndex + " instance index of sub flow: " + subflowName + ", Exception is: " + e); + return null; + } + } + + /** + * Extracts text from an XML element. This method is not namespace aware + * (namespaces are ignored). The first matching element is selected. + * @param xml the XML document or fragment + * @param tag the desired element, e.g. "" + * @return the element text, or null if the element was not found + */ + protected String getXMLTextElement(String xml, String tag) { + xml = removeXMLNamespaces(xml); + + if (!tag.startsWith("<")) { + tag = "<" + tag + ">"; + } + + int start = xml.indexOf(tag); + + if (start == -1) { + return null; + } + + int end = xml.indexOf('<', start + tag.length()); + + if (end == -1) { + return null; + } + + return xml.substring(start + tag.length(), end); + } + + /** + * Removes namespace definitions and prefixes from XML, if any. + */ + private String removeXMLNamespaces(String xml) { + // remove xmlns declaration + xml = xml.replaceAll("xmlns.*?(\"|\').*?(\"|\')", ""); + + // remove opening tag prefix + xml = xml.replaceAll("(<)(\\w+:)(.*?>)", "$1$3"); + + // remove closing tags prefix + xml = xml.replaceAll("()", "$1$3"); + + // remove extra spaces left when xmlns declarations are removed + xml = xml.replaceAll("\\s+>", ">"); + + return xml; + } + + /** + * Asserts that two XML documents are semantically equivalent. Differences + * in whitespace or in namespace usage do not affect the comparison. + * @param expected the expected XML + * @param actual the XML to test + * @throws SAXException + * @throws IOException + */ + public static void assertXMLEquals(String expected, String actual) + throws SAXException, IOException { + XMLUnit.setIgnoreWhitespace(true); + XMLUnit.setIgnoreAttributeOrder(true); + DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expected, actual)); + List allDifferences = diff.getAllDifferences(); + assertEquals("Differences found: " + diff.toString(), 0, allDifferences.size()); + } + + /** + * A test implementation of AsynchronousResponse. + */ + public class TestAsyncResponse { + Response response = null; + + /** + * {@inheritDoc} + */ + public synchronized void setResponse(Response response) { + this.response = response; + } + + /** + * Gets the response. + * @return the response, or null if none has been produced yet + */ + public synchronized Response getResponse() { + return response; + } + } + + /** + * An object that contains callback data for a "program". + */ + public class CallbackSet { + private final Map map = new HashMap<>(); + + /** + * Add untyped callback data to the set. + * @param action the action with which the data is associated + * @param content the callback data + */ + public void put(String action, String content) { + map.put(action, new CallbackData(null, null, content)); + } + + /** + * Add callback data to the set. + * @param action the action with which the data is associated + * @param messageType the callback message type + * @param content the callback data + */ + public void put(String action, String messageType, String content) { + map.put(action, new CallbackData(null, messageType, content)); + } + + /** + * Add callback data to the set. + * @param action the action with which the data is associated + * @param contentType the callback HTTP content type + * @param messageType the callback message type + * @param content the callback data + */ + public void put(String action, String contentType, String messageType, String content) { + map.put(action, new CallbackData(contentType, messageType, content)); + } + + /** + * Retrieve callback data from the set. + * @param action the action with which the data is associated + * @return the callback data, or null if there is none for the specified operation + */ + public CallbackData get(String action) { + return map.get(action); + } + } + + /** + * Represents a callback data item. + */ + public class CallbackData { + private final String contentType; + private final String messageType; + private final String content; + + /** + * Constructor + * @param contentType the HTTP content type (optional) + * @param messageType the callback message type (optional) + * @param content the content + */ + public CallbackData(String contentType, String messageType, String content) { + this.contentType = contentType; + this.messageType = messageType; + this.content = content; + } + + /** + * Gets the callback HTTP content type, possibly null. + */ + public String getContentType() { + return contentType; + } + + /** + * Gets the callback message type, possibly null. + */ + public String getMessageType() { + return messageType; + } + + /** + * Gets the callback content. + */ + public String getContent() { + return content; + } + } + + /** + * A tool for evaluating XPath expressions. + */ + protected class XPathTool { + private final DocumentBuilderFactory factory; + private final SimpleNamespaceContext context = new SimpleNamespaceContext(); + private final XPath xpath = XPathFactory.newInstance().newXPath(); + private String xml = null; + private Document doc = null; + + /** + * Constructor. + */ + public XPathTool() { + factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + xpath.setNamespaceContext(context); + } + + /** + * Adds a namespace. + * @param prefix the namespace prefix + * @param uri the namespace uri + */ + public synchronized void addNamespace(String prefix, String uri) { + context.add(prefix, uri); + } + + /** + * Sets the XML content to be operated on. + * @param xml the XML content + */ + public synchronized void setXML(String xml) { + this.xml = xml; + this.doc = null; + } + + /** + * Returns the document object. + * @return the document object, or null if XML has not been set + * @throws SAXException + * @throws IOException + * @throws ParserConfigurationException + */ + public synchronized Document getDocument() + throws ParserConfigurationException, IOException, SAXException { + if (xml == null) { + return null; + } + + buildDocument(); + return doc; + } + + /** + * Evaluates the specified XPath expression and returns a string result. + * This method throws exceptions on error. + * @param expression the expression + * @return the result object + * @throws ParserConfigurationException + * @throws IOException + * @throws SAXException + * @throws XPathExpressionException on error + */ + public synchronized String evaluate(String expression) + throws ParserConfigurationException, SAXException, + IOException, XPathExpressionException { + return (String) evaluate(expression, XPathConstants.STRING); + } + + /** + * Evaluates the specified XPath expression. + * This method throws exceptions on error. + * @param expression the expression + * @param returnType the return type + * @return the result object + * @throws ParserConfigurationException + * @throws IOException + * @throws SAXException + * @throws XPathExpressionException on error + */ + public synchronized Object evaluate(String expression, QName returnType) + throws ParserConfigurationException, SAXException, + IOException, XPathExpressionException { + + buildDocument(); + XPathExpression expr = xpath.compile(expression); + return expr.evaluate(doc, returnType); + } + + /** + * Private helper method that builds the document object. + * Assumes the calling method is synchronized. + * @throws ParserConfigurationException + * @throws IOException + * @throws SAXException + */ + private void buildDocument() throws ParserConfigurationException, + IOException, SAXException { + if (doc == null) { + if (xml == null) { + throw new IOException("XML input is null"); + } + + DocumentBuilder builder = factory.newDocumentBuilder(); + InputSource source = new InputSource(new StringReader(xml)); + doc = builder.parse(source); + } + } + } + + /** + * A NamespaceContext class based on a Map. + */ + private class SimpleNamespaceContext implements NamespaceContext { + private Map prefixMap = new HashMap<>(); + private Map uriMap = new HashMap<>(); + + public synchronized void add(String prefix, String uri) { + prefixMap.put(prefix, uri); + uriMap.put(uri, prefix); + } + + @Override + public synchronized String getNamespaceURI(String prefix) { + return prefixMap.get(prefix); + } + + @Override + public Iterator getPrefixes(String uri) { + List list = new ArrayList<>(); + String prefix = uriMap.get(uri); + if (prefix != null) { + list.add(prefix); + } + return list.iterator(); + } + + @Override + public String getPrefix(String uri) { + return uriMap.get(uri); + } + } + + /** + * A VnfNotify XPathTool. + */ + protected class VnfNotifyXPathTool extends XPathTool { + public VnfNotifyXPathTool() { + addNamespace("tns", "http://org.onap.so/vnfNotify"); + } + } + + /** + * Helper class to make it easier to create this type. + */ + private static class CreateVnfNotificationOutputs + extends CreateVnfNotification.Outputs { + public void add(String key, String value) { + Entry entry = new Entry(); + entry.setKey(key); + entry.setValue(value); + getEntry().add(entry); + } + } + + /** + * Helper class to make it easier to create this type. + */ + private static class UpdateVnfNotificationOutputs + extends UpdateVnfNotification.Outputs { + public void add(String key, String value) { + Entry entry = new Entry(); + entry.setKey(key); + entry.setValue(value); + getEntry().add(entry); + } + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java new file mode 100644 index 0000000000..dbad35a6a4 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.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.bpmn.common; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Allows a subclass of WorkflowTest to specify one or more WireMock + * response transformers. A transformer must be declared as a public + * static field in the subclass. For example: + *
+ *     @WorkflowTestTransformer
+ *     public static final ResponseTransformer sdncAdapterMockTransformer =
+ *         new SDNCAdapterMockTransformer();
+ * 
+ */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface WorkflowTestTransformer { +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java new file mode 100644 index 0000000000..5b5e17c5fc --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.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.bpmn.infrastructure; + +public interface FlakyTests { + /* category marker */ +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java new file mode 100644 index 0000000000..7cb649d66e --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.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.bpmn.infrastructure.pnf.delegate; + +import java.io.IOException; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.onap.aai.domain.yang.Pnf; +import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; + +public class AaiConnectionTestImpl implements AaiConnection { + + public static final String ID_WITH_ENTRY_AND_IP = "idWithEntryAndIp"; + public static final String ID_WITH_IP_V6 = "idWithIpV6"; + public static final String ID_WITHOUT_ENTRY = "IdWithoutEntry"; + public static final String ID_WITH_ENTRY_NO_IP = "idWithEntryNoIp"; + public static final String DEFAULT_IP = "1.2.3.4"; + public static final String DEFAULT_IP_V6 = "2001:db8::ff00:42:8329"; + + private Map created = new HashMap<>(); + + @Override + public Optional getEntryFor(String correlationId) throws IOException { + if (Objects.equals(correlationId, ID_WITH_ENTRY_AND_IP)) { + Pnf pnf = new Pnf(); + pnf.setIpaddressV4Oam(DEFAULT_IP); + return Optional.of(pnf); + } else if (Objects.equals(correlationId, ID_WITH_IP_V6)) { + Pnf pnf = new Pnf(); + pnf.setIpaddressV6Oam(DEFAULT_IP_V6); + return Optional.of(pnf); + } else if (Objects.equals(correlationId, ID_WITH_ENTRY_NO_IP)) { + return Optional.of(new Pnf()); + } else { + return Optional.empty(); + } + } + + @Override + public void createEntry(String correlationId, Pnf entry) throws IOException { + created.put(correlationId, entry); + } + + public Map getCreated() { + return created; + } + + public void reset() { + created.clear(); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java new file mode 100644 index 0000000000..7df6757817 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.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.bpmn.infrastructure.pnf.delegate; + +import java.io.IOException; +import java.util.Optional; +import org.onap.aai.domain.yang.Pnf; +import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; + +public class AaiConnectionThrowingException implements AaiConnection { + + @Override + public Optional getEntryFor(String correlationId) throws IOException { + throw new IOException(); + } + + @Override + public void createEntry(String correlationId, Pnf entry) throws IOException { + throw new IOException(); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java new file mode 100644 index 0000000000..f5d212f61c --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate; + +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.when; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {CancelDmaapSubscription.class, DmaapClientTestImpl.class}) +public class CancelDmaapSubscriptionTest { + + @Autowired + public CancelDmaapSubscription delegate; + + @Autowired + private DmaapClientTestImpl dmaapClientTest; + + @Test + public void shouldCancelSubscription() throws Exception { + // given + DelegateExecution delegateExecution = mock(DelegateExecution.class); + when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId"); + when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey"); + dmaapClientTest.registerForUpdate("testCorrelationId", () -> {}); + // when + delegate.execute(delegateExecution); + // then + assertThat(dmaapClientTest.haveRegisteredConsumer()).isFalse(); + } +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java new file mode 100644 index 0000000000..301e5d9f6d --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java @@ -0,0 +1,132 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.Matchers.any; +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 static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_IP_V6; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_IP; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.junit.Test; +import org.junit.experimental.runners.Enclosed; +import org.junit.runner.RunWith; +import org.onap.so.bpmn.core.WorkflowException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(Enclosed.class) +public class CheckAaiForCorrelationIdDelegateTest { + + @RunWith(SpringRunner.class) + @SpringBootTest(classes = {CheckAaiForCorrelationIdDelegate.class, AaiConnectionTestImpl.class}) + public static class ConnectionOkTests { + + @Autowired + private CheckAaiForCorrelationIdDelegate delegate; + + @Test + public void shouldThrowExceptionWhenCorrelationIdIsNotSet() throws Exception { + // given + DelegateExecution execution = mock(DelegateExecution.class); + when(execution.getVariable(CORRELATION_ID)).thenReturn(null); + when(execution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue"); + // when, then + assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class); + verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class)); + } + + @Test + public void shouldSetCorrectVariablesWhenAaiDoesNotContainInfoAboutPnf() throws Exception { + // given + DelegateExecution execution = mock(DelegateExecution.class); + when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITHOUT_ENTRY); + // when + delegate.execute(execution); + // then + verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, false); + } + + @Test + public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf() throws Exception { + shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(ID_WITH_ENTRY_AND_IP); + } + + @Test + public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithIpV6() throws Exception { + shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(ID_WITH_IP_V6); + } + + private void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(String id) throws Exception { + // given + DelegateExecution execution = mock(DelegateExecution.class); + when(execution.getVariable(CORRELATION_ID)).thenReturn(id); + // when + delegate.execute(execution); + // then + verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, true); + verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, true); + } + + @Test + public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithoutIp() throws Exception { + // given + DelegateExecution execution = mock(DelegateExecution.class); + when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP); + // when + delegate.execute(execution); + // then + verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, true); + verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, false); + } + } + + + @RunWith(SpringRunner.class) + @SpringBootTest(classes = {CheckAaiForCorrelationIdDelegate.class, AaiConnectionThrowingException.class}) + public static class NoConnectionTests { + + @Autowired + private CheckAaiForCorrelationIdDelegate delegate; + + @Test + public void shouldThrowExceptionWhenIoExceptionOnConnectionToAai() throws Exception { + // given + DelegateExecution execution = mock(DelegateExecution.class); + when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP); + when(execution.getVariable("testProcessKey")).thenReturn("testProcessKey"); + // when, then + assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class); + verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class)); + } + } +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java new file mode 100644 index 0000000000..465dc085fc --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.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.bpmn.infrastructure.pnf.delegate; + +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.when; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.junit.Test; +import org.onap.aai.domain.yang.Pnf; + +public class CreateAaiEntryWithPnfIdDelegateTest { + + @Test + public void shouldSetPnfIdAndPnfName() throws Exception { + // given + CreateAaiEntryWithPnfIdDelegate delegate = new CreateAaiEntryWithPnfIdDelegate(); + AaiConnectionTestImpl aaiConnection = new AaiConnectionTestImpl(); + delegate.setAaiConnection(aaiConnection); + DelegateExecution execution = mock(DelegateExecution.class); + when(execution.getVariable(eq(CORRELATION_ID))).thenReturn("testCorrelationId"); + // when + delegate.execute(execution); + // then + Pnf createdEntry = aaiConnection.getCreated().get("testCorrelationId"); + assertThat(createdEntry.getPnfId()).isEqualTo("testCorrelationId"); + assertThat(createdEntry.getPnfName()).isEqualTo("testCorrelationId"); + assertThat(createdEntry.isInMaint()).isTrue(); + } +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java new file mode 100644 index 0000000000..9c8f19f102 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.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.bpmn.infrastructure.pnf.delegate; + +import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; +import java.util.Objects; + +public class DmaapClientTestImpl implements DmaapClient { + + private String correlationId; + private Runnable informConsumer; + + @Override + public void registerForUpdate(String correlationId, Runnable informConsumer) { + this.correlationId = correlationId; + this.informConsumer = informConsumer; + } + + @Override + public Runnable unregister(String correlationId) { + if (Objects.equals(this.correlationId, correlationId)) { + this.correlationId = null; + Runnable informConsumer = this.informConsumer; + this.informConsumer = null; + return informConsumer; + } + return null; + } + + public String getCorrelationId() { + return correlationId; + } + + public Runnable getInformConsumer() { + return informConsumer; + } + + public boolean haveRegisteredConsumer() { + return correlationId != null; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java new file mode 100644 index 0000000000..168cd69436 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InOrder; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {InformDmaapClient.class, DmaapClientTestImpl.class}) +public class InformDmaapClientTest { + + @Autowired + private InformDmaapClient informDmaapClient; + + @Autowired + private DmaapClientTestImpl dmaapClientTest; + + private DelegateExecution delegateExecution; + + private MessageCorrelationBuilder messageCorrelationBuilder; + + @Test + public void shouldSendListenerToDmaapClient() throws Exception { + // given + mockDelegateExecution(); + // when + informDmaapClient.execute(delegateExecution); + // then + assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId"); + assertThat(dmaapClientTest.getInformConsumer()).isNotNull(); + verifyZeroInteractions(messageCorrelationBuilder); + } + + @Test + public void shouldSendListenerToDmaapClientAndSendMessageToCamunda() throws Exception { + // given + mockDelegateExecution(); + // when + informDmaapClient.execute(delegateExecution); + dmaapClientTest.getInformConsumer().run(); + // then + assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId"); + InOrder inOrder = inOrder(messageCorrelationBuilder); + inOrder.verify(messageCorrelationBuilder).processInstanceBusinessKey("testBusinessKey"); + inOrder.verify(messageCorrelationBuilder).correlateWithResult(); + } + + private void mockDelegateExecution() { + delegateExecution = mock(DelegateExecution.class); + when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId"); + when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey"); + ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class); + when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices); + RuntimeService runtimeService = mock(RuntimeService.class); + when(processEngineServices.getRuntimeService()).thenReturn(runtimeService); + messageCorrelationBuilder = mock(MessageCorrelationBuilder.class); + when(runtimeService.createMessageCorrelation(any())).thenReturn(messageCorrelationBuilder); + when(messageCorrelationBuilder.processInstanceBusinessKey(any())).thenReturn(messageCorrelationBuilder); + } +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java new file mode 100644 index 0000000000..aab289fd90 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.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.bpmn.infrastructure.pnf.delegate; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +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 static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.junit.Before; +import org.junit.Test; + +public class PnfCheckInputsTest { + + private PnfCheckInputs delegate; + + @Before + public void setUp() throws Exception { + delegate = new PnfCheckInputs(); + } + + private DelegateExecution mockDelegateExecution() { + DelegateExecution delegateExecution = mock(DelegateExecution.class); + when(delegateExecution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue"); + return delegateExecution; + } + + @Test + public void shouldThrowException_whenPnfIdNotSet() throws Exception { + // given + DelegateExecution delegateExecution = mockDelegateExecution(); + // when, then + assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class); + } + + private DelegateExecution mockDelegateExecutionWithCorrelationId() { + DelegateExecution delegateExecution = mockDelegateExecution(); + when(delegateExecution.getVariable(CORRELATION_ID)).thenReturn("testCorrelationId"); + return delegateExecution; + } + + @Test + public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() throws Exception { + // given + DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId(); + // when, then + assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class); + } + + @Test + public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() throws Exception { + // given + String defaultTimeout = "T1D"; + delegate.setDefaultTimeout(defaultTimeout); + DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId(); + // when + delegate.execute(delegateExecution); + // then + verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(defaultTimeout)); + } +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java new file mode 100644 index 0000000000..7c4c8201ea --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.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========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate.bpmn; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.history.HistoricVariableInstance; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.test.Deployment; +import org.camunda.bpm.engine.test.ProcessEngineRule; +import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@ContextConfiguration(locations = "/applicationContext_forPnfTesting.xml") +@Ignore +public class CreateAndActivatePnfResourceTest { + + private static final String TIMEOUT_10_S = "PT10S"; + @Autowired + private RuntimeService runtimeService; + + @Autowired + @Rule + public ProcessEngineRule processEngineRule; + + @Autowired + private AaiConnectionTestImpl aaiConnection; + + @Test + @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"}) + public void shouldSaveCurrentIpToVariableIfItAlreadyExistsInAai() throws Exception { + // given + aaiConnection.reset(); + BpmnAwareTests.init(processEngineRule.getProcessEngine()); + Map variables = new HashMap<>(); + variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S); + variables.put(CORRELATION_ID, ID_WITH_ENTRY_AND_IP); + // when + ProcessInstance instance = runtimeService + .startProcessInstanceByKey("CreateAndActivatePnfResource", variables); + // then + assertThat(instance).isEnded().hasPassedInOrder( + "CreateAndActivatePnf_StartEvent", + "CheckAiiForCorrelationId", + "DoesAaiContainInfoAboutPnf", + "DoesAaiContainInfoAboutIp", + "AaiEntryAlreadyUpToDate" + ); + } + + @Test + @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"}) + public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenIpIsMissingInAaiEntry() throws Exception { + // given + aaiConnection.reset(); + BpmnAwareTests.init(processEngineRule.getProcessEngine()); + Map variables = new HashMap<>(); + variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S); + variables.put(CORRELATION_ID, ID_WITH_ENTRY_NO_IP); + // when + ProcessInstance instance = runtimeService + .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); + assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage"); + runtimeService.createMessageCorrelation("WorkflowMessage") + .processInstanceBusinessKey("businessKey") + .correlateWithResult(); + // then + assertThat(instance).isEnded().hasPassedInOrder( + "CreateAndActivatePnf_StartEvent", + "CheckAiiForCorrelationId", + "DoesAaiContainInfoAboutPnf", + "DoesAaiContainInfoAboutIp", + "AaiEntryExists", + "InformDmaapClient", + "WaitForDmaapPnfReadyNotification", + "AaiEntryUpdated" + ); + } + + @Test + @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"}) + public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntry() throws Exception { + // given + aaiConnection.reset(); + BpmnAwareTests.init(processEngineRule.getProcessEngine()); + Map variables = new HashMap<>(); + variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S); + variables.put(CORRELATION_ID, ID_WITHOUT_ENTRY); + // when + ProcessInstance instance = runtimeService + .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); + assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage"); + runtimeService.createMessageCorrelation("WorkflowMessage") + .processInstanceBusinessKey("businessKey") + .correlateWithResult(); + // then + assertThat(instance).isEnded().hasPassedInOrder( + "CreateAndActivatePnf_StartEvent", + "CheckAiiForCorrelationId", + "DoesAaiContainInfoAboutPnf", + "CreateAndActivatePnf_CreateAaiEntry", + "AaiEntryExists", + "InformDmaapClient", + "WaitForDmaapPnfReadyNotification", + "AaiEntryUpdated" + ); + assertThat(aaiConnection.getCreated()).containsOnlyKeys(ID_WITHOUT_ENTRY); + } + + private List getVariables(ProcessInstance instance) { + return processEngineRule.getHistoryService().createHistoricVariableInstanceQuery() + .processInstanceId(instance.getProcessInstanceId()).taskIdIn().list(); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java new file mode 100644 index 0000000000..08ac9b6948 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java @@ -0,0 +1,197 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.dmaap; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Field; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ScheduledExecutorService; + +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.entity.StringEntity; +import org.apache.http.message.BasicHttpResponse; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.infrastructure.pnf.dmaap.PnfEventReadyDmaapClient.DmaapTopicListenerThread; +import org.springframework.core.env.Environment; +@RunWith(MockitoJUnitRunner.class) +public class PnfEventReadyDmaapClientTest { + + private static final String CORRELATION_ID = "corrTestId"; + private static final String CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId"; + private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[\n" + + " {\n" + + " \"pnfRegistrationFields\" : {\n" + + " \"correlationId\" : \"%s\",\n" + + " \"value\" : \"value1\"\n" + + " }\n" + + " },\n" + + " {\n" + + " \"pnfRegistrationFields\" : {\n" + + " \"correlationId\" : \"corr\",\n" + + " \"value\" : \"value2\"\n" + + " }\n" + + " }\n" + + "]"; + private static final String JSON_EXAMPLE_WITH_NO_CORRELATION_ID = + "{\"pnfRegistrationFields\":{\"field\":\"value\"}}"; + + private static final String HOST = "hostTest"; + private static final int PORT = 1234; + private static final String PROTOCOL = "http"; + private static final String URI_PATH_PREFIX = "eventsForTesting"; + private static final String EVENT_TOPIC_TEST = "eventTopicTest"; + private static final String CONSUMER_ID = "consumerTestId"; + private static final String CONSUMER_GROUP = "consumerGroupTest"; + @Mock + private Environment env; + @InjectMocks + private PnfEventReadyDmaapClient testedObject = new PnfEventReadyDmaapClient(); +; + private DmaapTopicListenerThread testedObjectInnerClassThread; + private HttpClient httpClientMock; + private Runnable threadMockToNotifyCamundaFlow; + private ScheduledExecutorService executorMock; + + @Before + public void init() throws NoSuchFieldException, IllegalAccessException { + when(env.getProperty(eq("pnf.dmaap.port"), eq(Integer.class))).thenReturn(PORT); + when(env.getProperty(eq("pnf.dmaap.host"))).thenReturn(HOST); + testedObject.setDmaapProtocol(PROTOCOL); + testedObject.setDmaapUriPathPrefix(URI_PATH_PREFIX); + testedObject.setDmaapTopicName(EVENT_TOPIC_TEST); + testedObject.setConsumerId(CONSUMER_ID); + testedObject.setConsumerGroup(CONSUMER_GROUP); + testedObject.setDmaapClientDelayInSeconds(1); + testedObject.init(); + testedObjectInnerClassThread = testedObject.new DmaapTopicListenerThread(); + httpClientMock = mock(HttpClient.class); + threadMockToNotifyCamundaFlow = mock(Runnable.class); + executorMock = mock(ScheduledExecutorService.class); + setPrivateField(); + } + + /** + * Test run method, where the are following conditions: + *

- DmaapThreadListener is running, flag is set to true + *

- map is filled with one entry with the key that we get from response + *

run method should invoke thread from map to notify camunda process, remove element from the map (map is + * empty) and shutdown the executor because of empty map + */ + @Test + public void correlationIdIsFoundInHttpResponse_notifyAboutPnfReady() + throws IOException { + when(httpClientMock.execute(any(HttpGet.class))). + thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID))); + testedObjectInnerClassThread.run(); + ArgumentCaptor captor1 = ArgumentCaptor.forClass(HttpGet.class); + verify(httpClientMock).execute(captor1.capture()); + assertThat(captor1.getValue().getURI()).hasHost(HOST).hasPort(PORT).hasScheme(PROTOCOL) + .hasPath( + "/" + URI_PATH_PREFIX + "/" + EVENT_TOPIC_TEST + "/" + CONSUMER_GROUP + "/" + CONSUMER_ID + ""); + verify(threadMockToNotifyCamundaFlow).run(); + verify(executorMock).shutdownNow(); + } + + /** + * Test run method, where the are following conditions: + *

- DmaapThreadListener is running, flag is set to true + *

- map is filled with one entry with the correlationId that does not match to correlationId + * taken from http response. run method should not do anything with the map not run any thread to notify camunda + * process + */ + @Test + public void correlationIdIsFoundInHttpResponse_NotFoundInMap() + throws IOException { + when(httpClientMock.execute(any(HttpGet.class))). + thenReturn(createResponse( + String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID_NOT_FOUND_IN_MAP))); + testedObjectInnerClassThread.run(); + verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock); + } + + /** + * Test run method, where the are following conditions: + *

- DmaapThreadListener is running, flag is set to true + *

- map is filled with one entry with the correlationId but no correlation id is taken from HttpResponse + * run method should not do anything with the map and not run any thread to notify camunda process + */ + @Test + public void correlationIdIsNotFoundInHttpResponse() throws IOException { + when(httpClientMock.execute(any(HttpGet.class))). + thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_CORRELATION_ID)); + testedObjectInnerClassThread.run(); + verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock); + } + + private void setPrivateField() throws NoSuchFieldException, IllegalAccessException { + Field httpClientField = testedObject.getClass().getDeclaredField("httpClient"); + httpClientField.setAccessible(true); + httpClientField.set(testedObject, httpClientMock); + httpClientField.setAccessible(false); + + Field executorField = testedObject.getClass().getDeclaredField("executor"); + executorField.setAccessible(true); + executorField.set(testedObject, executorMock); + executorField.setAccessible(false); + + Field pnfCorrelationToThreadMapField = testedObject.getClass() + .getDeclaredField("pnfCorrelationIdToThreadMap"); + pnfCorrelationToThreadMapField.setAccessible(true); + Map pnfCorrelationToThreadMap = new ConcurrentHashMap<>(); + pnfCorrelationToThreadMap.put(CORRELATION_ID, threadMockToNotifyCamundaFlow); + pnfCorrelationToThreadMapField.set(testedObject, pnfCorrelationToThreadMap); + + Field threadRunFlag = testedObject.getClass().getDeclaredField("dmaapThreadListenerIsRunning"); + threadRunFlag.setAccessible(true); + threadRunFlag.set(testedObject, true); + threadRunFlag.setAccessible(false); + } + + private HttpResponse createResponse(String json) throws UnsupportedEncodingException { + HttpEntity entity = new StringEntity(json); + ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1); + HttpResponse response = new BasicHttpResponse(protocolVersion, 1, ""); + response.setEntity(entity); + response.setStatusCode(200); + return response; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java new file mode 100644 index 0000000000..8c31a021ae --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.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.bpmn.vcpe; + +import org.onap.so.BaseIntegrationTest; +import org.onap.so.bpmn.infrastructure.FlakyTests; + +import groovy.lang.Category; + + +@Category(FlakyTests.class) +public class AbstractTestBase extends BaseIntegrationTest { + + + public static final String CUST = "SDN-ETHERNET-INTERNET"; + public static final String SVC = "123456789"; + public static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET"; + public static final String PARENT_INST = "MIS%252F1604%252F0027%252FSW_INTERNET"; + public static final String ARID = "arId-1"; + public static final String ARVERS = "1490627351232"; + + public static final String DEC_INST = "MIS%2F1604%2F0026%2FSW_INTERNET"; + public static final String DEC_PARENT_INST = "MIS%2F1604%2F0027%2FSW_INTERNET"; + + public static final String VAR_SUCCESS_IND = "SuccessIndicator"; + public static final String VAR_WFEX = "SavedWorkflowException1"; + public static final String VAR_RESP_CODE = "CMSO_ResponseCode"; + public static final String VAR_COMP_REQ = "CompleteMsoProcessRequest"; +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java new file mode 100644 index 0000000000..610930665c --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java @@ -0,0 +1,381 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetCustomer; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkPolicyfqdn; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_404; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchGenericVnf; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutNetwork; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutServiceInstance; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; +import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; +import static org.onap.so.bpmn.mock.StubResponseDatabase.MockPostRequestDB; +import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; +import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFPost; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.common.BPMNUtil; +import org.onap.so.bpmn.mock.FileUtil; +import org.onap.so.bpmn.mock.StubResponseOof; + + +public class CreateVcpeResCustServiceIT extends AbstractTestBase { + + private static final String PROCNAME = "CreateVcpeResCustService"; + private static final String Prefix = "CVRCS_"; + + private final CallbackSet callbacks = new CallbackSet(); + private final String request; + + @Before + public void init(){ + BPMNUtil.cleanHistory(processEngine); + } + + public CreateVcpeResCustServiceIT() throws IOException { + + callbacks.put("oof", JSON, "oofResponse", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/oofCallbackInfraVnf.json")); + callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml")); + callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml")); + callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml")); + callbacks.put("queryTXC", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml")); + callbacks.put("queryBRG", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml")); + callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); + callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); + callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); + + callbacks.put("query", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallback.xml")); + callbacks.put("queryVnf", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml")); + callbacks.put("queryModuleNoVnf", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml")); + callbacks.put("queryModule", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml")); + callbacks.put("vnfCreate", FileUtil.readResourceFile("__files/VfModularity/VNFAdapterRestCreateCallback.xml")); + + request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSIName.json"); + } + + @Test + public void testCreateVcpeResCustService_Success() throws Exception { + System.out.println("starting: testCreateVcpeResCustService_Success\n"); + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2","VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); + StubResponseOof.mockOof(); + // TODO: the SI should NOT have to be URL-encoded yet again! + MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + + MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockGetGenericVnfByIdWithDepth(".*", 1, "VCPE/CreateVcpeResCustService/GenericVnf.xml"); + + MockPutGenericVnf(".*"); + MockPatchGenericVnf(".*"); + + MockGetGenericVnfByIdWithPriority(".*", ".*", 200, "VfModularity/VfModule-new.xml", 5); + // MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + MockPutVfModuleIdNoResponse(".*", "PCRF", ".*"); + MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200); + + MockGetNetworkPolicyfqdn(".*","CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml",200); + MockNodeQueryServiceInstanceByName_404(".*"); + + mockVNFPost("", 202, ".*"); + + stubFor(post(urlMatching("/services/rest/v1/vnfs" + ".*" + "/vf-modules" )).willReturn(aResponse().withStatus(202))); + stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404))); + stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200))); + stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200))); + stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200))); + MockPostRequestDB(); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + mockSDNCAdapter(200); + + Map variables = setupVariables(); + + String businessKey = UUID.randomUUID().toString(); + invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); + + injectWorkflowMessages(callbacks, "oof"); + // for SI + injectSDNCCallbacks(callbacks, "assign"); + // for TXC + injectSDNCCallbacks(callbacks, "assign"); + injectSDNCCallbacks(callbacks, "create"); + injectSDNCCallbacks(callbacks, "activate"); + injectSDNCCallbacks(callbacks, "queryTXC"); + + // For VNF + injectSDNCCallbacks(callbacks, "assign"); + injectSDNCCallbacks(callbacks, "assign"); + injectSDNCCallbacks(callbacks, "queryModule"); + injectSDNCCallbacks(callbacks, "activate"); + //VF Module + injectSDNCCallbacks(callbacks, "queryModule"); + injectSDNCCallbacks(callbacks, "assign"); + injectSDNCCallbacks(callbacks, "queryModule"); + injectSDNCCallbacks(callbacks, "queryModule"); + injectSDNCCallbacks(callbacks, "assign"); + injectSDNCCallbacks(callbacks, "queryModuleNoVnf"); + injectVNFRestCallbacks(callbacks, "vnfCreate"); + injectSDNCCallbacks(callbacks, "activate"); + + // for BRG + injectSDNCCallbacks(callbacks, "assign"); + injectSDNCCallbacks(callbacks, "create"); + injectSDNCCallbacks(callbacks, "activate"); + injectSDNCCallbacks(callbacks, "queryBRG"); + + waitForProcessEnd(businessKey, 10000); + + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + + String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ); + System.out.println("completionReq:\n" + completionReq); + + assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); + assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE)); + assertEquals(null, workflowException); + assertTrue(completionReq.indexOf("request-id>testRequestId<") >= 0); + assertTrue(completionReq.indexOf("action>CREATE<") >= 0); + assertTrue(completionReq.indexOf("source>VID<") >= 0); + + assertEquals("1", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"VnfsCreatedCount")); + } + + @Test + public void testCreateVcpeResCustService_NoParts() throws Exception { + System.out.println("starting: testCreateVcpeResCustService_NoParts\n" ); + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json"); + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json"); + MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); + + // TODO: the SI should NOT have to be URL-encoded yet again! + MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + + MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + + // TODO: should these really be PARENT_INST, or should they be INST? + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + StubResponseOof.mockOof(); + stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404))); + stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200))); + stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200))); + stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200))); + MockPostRequestDB(); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map variables = setupVariables(); + + String businessKey = UUID.randomUUID().toString(); + invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); + + injectWorkflowMessages(callbacks, "oof"); + // for SI + injectSDNCCallbacks(callbacks, "assign"); + + waitForProcessEnd(businessKey, 10000); + + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + + String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ); + System.out.println("completionReq:\n" + completionReq); + + assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); + assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE)); + assertEquals(null, workflowException); + assertTrue(completionReq.indexOf("request-id>testRequestId<") >= 0); + assertTrue(completionReq.indexOf("action>CREATE<") >= 0); + assertTrue(completionReq.indexOf("source>VID<") >= 0); + + assertEquals("0", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"VnfsCreatedCount")); + } + + @Test + public void testCreateVcpeResCustService_Fault_NoRollback() throws Exception { + System.out.println("starting: testCreateVcpeResCustService_Fault_NoRollback\n"); + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); + + // TODO: the SI should NOT have to be URL-encoded yet again! + MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + + MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance_500(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + + mockSDNCAdapter(404); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + StubResponseOof.mockOof(); + stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404))); + stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200))); + stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200))); + stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200))); + MockPostRequestDB(); + + Map variables = setupVariables(); + + String businessKey = UUID.randomUUID().toString(); + invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); + + injectWorkflowMessages(callbacks, "oof"); + + waitForProcessEnd(businessKey, 100000); + + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + + String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ); + System.out.println("completionReq:\n" + completionReq); + + assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); + assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE)); + assertNotNull(workflowException); + + BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateAllottedResourceBRGRollback"); + BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateVnfAndModulesRollback"); + BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateAllottedResourceTXCRollback"); + } + + @Test + public void testCreateVcpeResCustService_Fault_Rollback() throws Exception { + System.out.println("starting: testCreateVcpeResCustService_Fault_Rollback\n"); + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); + + // TODO: the SI should NOT have to be URL-encoded yet again! + MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + + MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml"); + MockGetAllottedResource(CUST, SVC, PARENT_INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockDeleteAllottedResource(CUST, SVC, PARENT_INST, ARID, ARVERS); + + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + StubResponseOof.mockOof(); + stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404))); + stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200))); + stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200))); + stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200))); + MockPostRequestDB(); + String req = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestRollback.json"); + + Map variables = setupVariables(); + + String businessKey = UUID.randomUUID().toString(); + invokeAsyncProcess(PROCNAME, "v1", businessKey, req, variables); + + injectWorkflowMessages(callbacks, "oof"); + // for SI + injectSDNCCallbacks(callbacks, "assign"); + + // for TXC + injectSDNCCallbacks(callbacks, "assign"); + injectSDNCCallbacks(callbacks, "create"); + + waitForProcessEnd(businessKey, 10000); + + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + + String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ); + System.out.println("completionReq:\n" + completionReq); + + assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); + assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE)); + assertEquals(null, completionReq); + assertNotNull(workflowException); + + BPMNUtil.assertAnyProcessInstanceFinished(processEngine, "DoCreateServiceInstanceRollback"); + } + + // ***************** + // Utility Section + // ***************** + + // Success Scenario + private Map setupVariables() { + Map variables = new HashMap<>(); + variables.put("requestId", "testRequestId"); + variables.put("request-id", "testRequestId"); + variables.put("serviceInstanceId", DEC_INST); + variables.put("allottedResourceId", ARID); + variables.put("URN_mso_workflow_aai_distribution_delay", "PT5S"); + return variables; + + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java new file mode 100644 index 0000000000..ca81d99832 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.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========================================================= + */ + +package org.onap.so.bpmn.vcpe; + +import com.github.tomakehurst.wiremock.stubbing.Scenario; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.common.BPMNUtil; +import org.onap.so.bpmn.mock.FileUtil; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteServiceInstance; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById; +import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; + +public class DeleteVcpeResCustServiceIT extends AbstractTestBase { + + private static final String PROCNAME = "DeleteVcpeResCustService"; + private static final String Prefix = "DVRCS_"; + private static final String AR_BRG_ID = "ar-brgB"; + private static final String AR_TXC_ID = "ar-txcA"; + + private final CallbackSet callbacks = new CallbackSet(); + private final String request; + + public DeleteVcpeResCustServiceIT() throws IOException { + callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); + callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); + callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); + + request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json"); + } + + @Before + public void init(){ + BPMNUtil.cleanHistory(processEngine); + } + + @Test + public void testDeleteVcpeResCustService_Success() throws Exception { + logStart(); + MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); + + // TODO: use INST instead of DEC_INST + /* + * Seems to be a bug as they + * fail to URL-encode the SI id before performing the query so we'll + * add a stub for that case, too. + */ + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + + /* + * cannot use MockGetServiceInstance(), because we need to return + * different responses as we traverse through the flow + */ + + // initially, the SI includes the ARs + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST)) + .inScenario("SI retrieval") + .whenScenarioStateIs(Scenario.STARTED) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VCPE/DeleteVcpeResCustService/getSI.xml")) + .willSetStateTo("ARs Deleted")); + + // once the ARs have been deleted, the SI should be empty + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST)) + .inScenario("SI retrieval") + .whenScenarioStateIs("ARs Deleted") + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"))); + + // for BRG + MockQueryAllottedResourceById(AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml"); + MockGetAllottedResource(CUST, SVC, INST, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/arGetBRGById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, AR_BRG_ID); + MockDeleteAllottedResource(CUST, SVC, INST, AR_BRG_ID, ARVERS); + + // for TXC + MockQueryAllottedResourceById(AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml"); + MockGetAllottedResource(CUST, SVC, INST, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/arGetTXCById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, AR_TXC_ID); + MockDeleteAllottedResource(CUST, SVC, INST, AR_TXC_ID, ARVERS); + + //MockGetGenericVnfById("vnfX.*", "GenericFlows/getGenericVnfByNameResponse.xml"); + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml"))); + + + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) + .willReturn(aResponse() + .withStatus(204) + .withHeader("Content-Type", "text/xml"))); + + MockDeleteServiceInstance(CUST,SVC,INST,SVC); + + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = setupVariables(businessKey); + + invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); + + // for BRG + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + // for VNF1 + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "unassign"); + + // for VNF2 + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "unassign"); + + // for TXC + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + // for SI + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + + waitForProcessEnd(businessKey, 70000); + assertTrue(isProcessEnded(businessKey)); + + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + + String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ); + System.out.println("completionReq:\n" + completionReq); + + assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); + assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE)); + assertNull(workflowException); + assertTrue(completionReq.contains(""+businessKey+"<")); + assertTrue(completionReq.contains("DELETE<")); + assertTrue(completionReq.contains("VID<")); + + assertEquals("2", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"vnfsDeletedCount")); + + BPMNUtil.assertAnyProcessInstanceFinished(processEngine, "DoDeleteVnfAndModules"); + logEnd(); + } + + @Test + public void testDeleteVcpeResCustService_NoBRG_NoTXC_NoVNF() throws Exception { + logStart(); + MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); + + // TODO: use INST instead of DEC_INST + /* + * Seems to be a bug as they + * fail to URL-encode the SI id before performing the query so we'll + * add a stub for that case, too. + */ + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"); + + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = setupVariables(businessKey); + + + invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); + + // for SI + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + + waitForProcessEnd(businessKey, 70000); + + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + + String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ); + System.out.println("completionReq:\n" + completionReq); + + assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); + assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE)); + assertNull( workflowException); + assertTrue(completionReq.contains(""+businessKey+"<")); + assertTrue(completionReq.contains("DELETE<")); + assertTrue(completionReq.contains("VID<")); + + assertEquals("0", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"vnfsDeletedCount")); + + BPMNUtil.assertNoProcessInstance(processEngine, "DoDeleteVnfAndModules"); + logEnd(); + } + + @Test + public void testDeleteVcpeResCustService_Fault() throws Exception { + logStart(); + MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); + + // TODO: use INST instead of DEC_INST + /* + * Seems to be a bug as they + * fail to URL-encode the SI id before performing the query so we'll + * add a stub for that case, too. + */ + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"); + + // generate failure + mockSDNCAdapter(404); + + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = setupVariables(businessKey); + + invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); + + waitForProcessEnd(businessKey, 70000); + + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + + String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ); + System.out.println("completionReq:\n" + completionReq); + + assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); + assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE)); + assertNotNull(workflowException); + logEnd(); + } + + private Map setupVariables(String requestId) throws UnsupportedEncodingException { + Map variables = new HashMap<>(); + variables.put("isDebugLogEnabled", "true"); + variables.put("requestId", requestId); + variables.put("serviceInstanceId", DEC_INST); + variables.put("sdncVersion", "1802"); + variables.put("serviceInstanceName", "some-junk-name"); + return variables; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java new file mode 100644 index 0000000000..2b1b5a3bd0 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java @@ -0,0 +1,266 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe; + +import static org.junit.Assert.*; +import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.onap.so.bpmn.common.BPMNUtil; +import org.onap.so.bpmn.mock.FileUtil; + + +public class DoCreateAllottedResourceBRGIT extends AbstractTestBase { + + private static final String PROCNAME = "DoCreateAllottedResourceBRG"; + private final CallbackSet callbacks = new CallbackSet(); + + public DoCreateAllottedResourceBRGIT() { + callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml")); + callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml")); + callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml")); + callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml")); + } + + @Test + public void testDoCreateAllottedResourceBRG_Success() throws InterruptedException { + logStart(); + + // TODO: use INST instead of DEC_INST + /* + * should be INST instead of DEC_INST, but AAI utilities appear to + * have a bug in that they don't URL-encode the SI id before using + * it in the query + */ + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map variables = new HashMap<>(); + setVariablesSuccess(variables,"testRequestId123"); + + String processId = invokeSubProcess(PROCNAME, variables); + + injectSDNCCallbacks(callbacks, "assign"); + injectSDNCCallbacks(callbacks, "create"); + injectSDNCCallbacks(callbacks, "activate"); + injectSDNCCallbacks(callbacks, "query"); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + assertNull(workflowException); + + assertEquals("namefromrequest", BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceBRG_NoSI() throws Exception{ + logStart(); + // TODO: use INST instead of DEC_INST + /* + * should be INST instead of DEC_INST, but AAI utilities appear to + * have a bug in that they don't URL-encode the SI id before using + * it in the query + */ + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map variables = new HashMap<>(); + setVariablesSuccess(variables,"testRequestId124"); + + String processId = invokeSubProcess(PROCNAME, variables); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + assertNotNull(workflowException); + + assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceBRG_ActiveAr() throws Exception{ + logStart(); + // TODO: use INST instead of DEC_INST + /* + * should be INST instead of DEC_INST, but AAI utilities appear to + * have a bug in that they don't URL-encode the SI id before using + * it in the query + */ + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map variables = new HashMap<>(); + setVariablesSuccess(variables,"testRequestId125"); + + variables.put("failExists", "false"); + + String processId = invokeSubProcess(PROCNAME, variables); + + + + injectSDNCCallbacks(callbacks, "query"); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + assertNull( workflowException); + + assertEquals("namefromrequest", BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceBRG_NoParentSI() throws Exception{ + logStart(); + // TODO: use INST instead of DEC_INST + /* + * should be INST instead of DEC_INST, but AAI utilities appear to + * have a bug in that they don't URL-encode the SI id before using + * it in the query + */ + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map variables = new HashMap<>(); + setVariablesSuccess(variables,"testRequestId126"); + + String processId = invokeSubProcess(PROCNAME, variables); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + assertNotNull(workflowException); + + assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceBRG_SubProcessError() throws Exception{ + logStart(); + // TODO: use INST instead of DEC_INST + /* + * should be INST instead of DEC_INST, but AAI utilities appear to + * have a bug in that they don't URL-encode the SI id before using + * it in the query + */ + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(404); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map variables = new HashMap<>(); + setVariablesSuccess(variables,"testRequestId127"); + + String processId = invokeSubProcess(PROCNAME, variables); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + assertNotNull(workflowException); + + assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId)); + logEnd(); + } + + private void setVariablesSuccess(Map variables, String requestId) { + variables.put("isDebugLogEnabled", "true"); + variables.put("failExists", "true"); + variables.put("disableRollback", "true"); + variables.put("msoRequestId", requestId); + variables.put("mso-request-id", "requestId"); + variables.put("sourceNetworkId", "snId"); + variables.put("sourceNetworkRole", "snRole"); + variables.put("allottedResourceRole", "txc"); + variables.put("allottedResourceType", "BRG"); + variables.put("allottedResourceId", ARID); + variables.put("vni", "BRG"); + variables.put("vgmuxBearerIP", "bearerip"); + variables.put("brgWanMacAddress", "wanmac"); + + variables.put("serviceInstanceId", DEC_INST); + variables.put("parentServiceInstanceId", DEC_PARENT_INST); + + variables.put("serviceChainServiceInstanceId", "scsiId"); + + String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," + + "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + + "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + + "\"modelName\": \"vSAMP12\"," + + "\"modelVersion\": \"1.0\"," + + "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + + "}"; + variables.put("allottedResourceModelInfo", arModelInfo); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java new file mode 100644 index 0000000000..5b78b485a9 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java @@ -0,0 +1,323 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe; + +import org.junit.Test; +import org.onap.so.bpmn.common.BPMNUtil; +import org.onap.so.bpmn.core.RollbackData; +import org.onap.so.bpmn.mock.FileUtil; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; + +public class DoCreateAllottedResourceBRGRollbackIT extends AbstractTestBase { + + private static final String PROCNAME = "DoCreateAllottedResourceBRGRollback"; + private static final String RbType = "DCARBRG_"; + private final CallbackSet callbacks = new CallbackSet(); + + public DoCreateAllottedResourceBRGRollbackIT() throws IOException { + callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); + callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); + callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); + } + + @Test + public void testDoCreateAllottedResourceBRGRollback_Success() throws Exception { + logStart(); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariablesSuccess(variables, businessKey); + + String processId = invokeSubProcess(PROCNAME, variables); + + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId)); + assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceBRGRollback_skipRollback() throws Exception { + logStart(); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, businessKey); + + rollbackData.put(RbType, "rollbackAAI", "false"); + rollbackData.put(RbType, "rollbackSDNCassign", "false"); + + String processId = invokeSubProcess(PROCNAME, variables); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId)); + assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceBRGRollback_DoNotRollBack() throws Exception { + logStart(); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, businessKey); + + // this will cause "rollbackSDNC" to be set to false + rollbackData.put(RbType, "rollbackSDNCassign", "false"); + + String processId = invokeSubProcess(PROCNAME, variables); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId)); + assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceBRGRollback_NoDeactivate() throws Exception { + logStart(); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, businessKey); + + rollbackData.put(RbType, "rollbackSDNCactivate", "false"); + + String processId = invokeSubProcess(PROCNAME, variables); + + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId)); + assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceBRGRollback_NoDelete() throws Exception { + logStart(); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, businessKey); + + rollbackData.put(RbType, "rollbackSDNCcreate", "false"); + + String processId = invokeSubProcess(PROCNAME, variables); + + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId)); + assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceBRGRollback_NoUnassign() throws Exception { + logStart(); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, businessKey); + + rollbackData.put(RbType, "rollbackSDNCassign", "false"); + + /* + * Note: if assign == false then the flow/script will set + * "skipRollback" to false, which will cause ALL of the SDNC steps + * to be skipped, not just the unassign step. + */ + + String processId = invokeSubProcess(PROCNAME, variables); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId)); + assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceBRGRollback_SubProcessError() throws Exception { + logStart(); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + mockSDNCAdapter(404); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariablesSuccess(variables, businessKey); + + String processId = invokeSubProcess(PROCNAME, variables); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId)); + assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceBRGRollback_JavaException() throws Exception { + logStart(); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariablesSuccess(variables, businessKey); + + variables.put("rollbackData", "string instead of rollback data"); + + String processId = invokeSubProcess(PROCNAME, variables); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId)); + assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId)); + logEnd(); + } + + private RollbackData setVariablesSuccess(Map variables, String requestId) { + variables.put("isDebugLogEnabled", "true"); + variables.put("failNotFound", "true"); + variables.put("msoRequestId", requestId); + variables.put("mso-request-id", "requestId"); + variables.put("allottedResourceId", ARID); + + variables.put("serviceInstanceId", DEC_INST); + variables.put("parentServiceInstanceId", DEC_PARENT_INST); + + RollbackData rollbackData = new RollbackData(); + + rollbackData.put(RbType, "serviceInstanceId", DEC_INST); + rollbackData.put(RbType, "serviceSubscriptionType", SVC); + rollbackData.put(RbType, "disablerollback", "false"); + rollbackData.put(RbType, "rollbackAAI", "true"); + rollbackData.put(RbType, "rollbackSDNCassign", "true"); + rollbackData.put(RbType, "rollbackSDNCactivate", "true"); + rollbackData.put(RbType, "rollbackSDNCcreate", "true"); + rollbackData.put(RbType, "aaiARPath", "http://localhost:"+wiremockPort+"/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID); + + rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml")); + rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml")); + rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml")); + + variables.put("rollbackData",rollbackData); + + return rollbackData; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java new file mode 100644 index 0000000000..473661c860 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java @@ -0,0 +1,276 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.bpmn.common.BPMNUtil; +import org.onap.so.bpmn.mock.FileUtil; + +public class DoCreateAllottedResourceTXCIT extends AbstractTestBase { + + private static final String PROCNAME = "DoCreateAllottedResourceTXC"; + private final CallbackSet callbacks = new CallbackSet(); + + public DoCreateAllottedResourceTXCIT() throws IOException { + callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml")); + callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml")); + callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml")); + callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml")); + } + + @Test + public void testDoCreateAllottedResourceTXC_Success() throws Exception{ + logStart(); + // TODO: use INST instead of DEC_INST + /* + * should be INST instead of DEC_INST, but AAI utilities appear to + * have a bug in that they don't URL-encode the SI id before using + * it in the query + */ + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123"); + + String processId = invokeSubProcess(PROCNAME, variables); + + injectSDNCCallbacks(callbacks, "assign"); + injectSDNCCallbacks(callbacks, "create"); + injectSDNCCallbacks(callbacks, "activate"); + injectSDNCCallbacks(callbacks, "query"); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + assertEquals(null, workflowException); + + assertEquals("namefromrequest", BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId)); + assertEquals("my-vni", BPMNUtil.getVariable(processEngine, PROCNAME, "vni",processId)); + assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxBearerIP",processId)); + assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxLanIP",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceTXC_NoSI() throws Exception{ + logStart(); + // TODO: use INST instead of DEC_INST + /* + * should be INST instead of DEC_INST, but AAI utilities appear to + * have a bug in that they don't URL-encode the SI id before using + * it in the query + */ + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123"); + + String processId = invokeSubProcess(PROCNAME, variables); + + waitForWorkflowToFinish(processEngine,processId); + + Assert.assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + assertNotNull(workflowException); + + assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceTXC_ActiveAr() throws Exception{ + logStart(); + // TODO: use INST instead of DEC_INST + /* + * should be INST instead of DEC_INST, but AAI utilities appear to + * have a bug in that they don't URL-encode the SI id before using + * it in the query + */ + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123"); + + variables.put("failExists", "false"); + + String processId = invokeSubProcess(PROCNAME, variables); + + injectSDNCCallbacks(callbacks, "query"); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX); + assertEquals(null, workflowException); + + assertEquals("namefromrequest", BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId)); + assertEquals("my-vni", BPMNUtil.getVariable(processEngine, PROCNAME, "vni",processId)); + assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxBearerIP",processId)); + assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxLanIP",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceTXC_NoParentSI() throws Exception{ + logStart(); + // TODO: use INST instead of DEC_INST + /* + * should be INST instead of DEC_INST, but AAI utilities appear to + * have a bug in that they don't URL-encode the SI id before using + * it in the query + */ + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123"); + + String processId = invokeSubProcess(PROCNAME, variables); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + assertNotNull(workflowException); + + assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceTXC_SubProcessError() throws Exception{ + logStart(); + // TODO: use INST instead of DEC_INST + /* + * should be INST instead of DEC_INST, but AAI utilities appear to + * have a bug in that they don't URL-encode the SI id before using + * it in the query + */ + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(404); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123"); + + String processId = invokeSubProcess(PROCNAME, variables); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + assertNotNull(workflowException); + + assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId)); + logEnd(); + } + + private void setVariablesSuccess(Map variables, String requestId) { + // TODO: need all of these? + variables.put("isDebugLogEnabled", "true"); + variables.put("failExists", "true"); + variables.put("disableRollback", "true"); + variables.put("msoRequestId", requestId); + variables.put("mso-request-id", "requestId"); + variables.put("sourceNetworkId", "snId"); + variables.put("sourceNetworkRole", "snRole"); + variables.put("allottedResourceRole", "brg"); + variables.put("allottedResourceType", "TXC"); + variables.put("allottedResourceId", ARID); + variables.put("brgWanMacAddress", "wanmac"); + + variables.put("serviceInstanceId", DEC_INST); + variables.put("parentServiceInstanceId", DEC_PARENT_INST); + + variables.put("serviceChainServiceInstanceId", "scsiId"); + + String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," + + "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + + "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + + "\"modelName\": \"vSAMP12\"," + + "\"modelVersion\": \"1.0\"," + + "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + + "}"; + variables.put("allottedResourceModelInfo", arModelInfo); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java new file mode 100644 index 0000000000..3720f1d840 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java @@ -0,0 +1,323 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe; + +import org.junit.Test; +import org.onap.so.bpmn.common.BPMNUtil; +import org.onap.so.bpmn.core.RollbackData; +import org.onap.so.bpmn.mock.FileUtil; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; +import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; + +public class DoCreateAllottedResourceTXCRollbackIT extends AbstractTestBase { + + private static final String PROCNAME = "DoCreateAllottedResourceTXCRollback"; + private static final String RbType = "DCARTXC_"; + private final CallbackSet callbacks = new CallbackSet(); + + public DoCreateAllottedResourceTXCRollbackIT() throws IOException { + callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); + callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); + callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); + } + + @Test + public void testDoCreateAllottedResourceTXCRollback_Success() throws Exception { + logStart(); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariablesSuccess(variables, businessKey); + + String processId = invokeSubProcess(PROCNAME, variables); + + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId)); + assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceTXCRollback_skipRollback() throws Exception { + logStart(); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, businessKey); + + rollbackData.put(RbType, "rollbackAAI", "false"); + rollbackData.put(RbType, "rollbackSDNCassign", "false"); + + String processId = invokeSubProcess(PROCNAME, variables); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId)); + assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceTXCRollback_DoNotRollBack() throws Exception { + logStart(); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, businessKey); + + // this will cause "rollbackSDNC" to be set to false + rollbackData.put(RbType, "rollbackSDNCassign", "false"); + + String processId = invokeSubProcess(PROCNAME, variables); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId)); + assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceTXCRollback_NoDeactivate() throws Exception { + logStart(); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, businessKey); + + rollbackData.put(RbType, "rollbackSDNCactivate", "false"); + + String processId = invokeSubProcess(PROCNAME, variables); + + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId)); + assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceTXCRollback_NoDelete() throws Exception { + logStart(); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, businessKey); + + rollbackData.put(RbType, "rollbackSDNCcreate", "false"); + + String processId = invokeSubProcess(PROCNAME, variables); + + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId)); + assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceTXCRollback_NoUnassign() throws Exception { + logStart(); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, businessKey); + + rollbackData.put(RbType, "rollbackSDNCassign", "false"); + + /* + * Note: if assign == false then the flow/script will set + * "skipRollback" to false, which will cause ALL of the SDNC steps + * to be skipped, not just the unassign step. + */ + + String processId = invokeSubProcess(PROCNAME, variables); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId)); + assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceTXCRollback_SubProcessError() throws Exception { + logStart(); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + mockSDNCAdapter(404); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariablesSuccess(variables, businessKey); + + String processId = invokeSubProcess(PROCNAME, variables); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId)); + assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId)); + logEnd(); + } + + @Test + public void testDoCreateAllottedResourceTXCRollback_JavaException() throws Exception { + logStart(); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariablesSuccess(variables, businessKey); + + variables.put("rollbackData", "string instead of rollback data"); + + String processId = invokeSubProcess(PROCNAME, variables); + + waitForWorkflowToFinish(processEngine,processId); + + assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId)); + assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId)); + logEnd(); + } + + private RollbackData setVariablesSuccess(Map variables, String requestId) { + variables.put("isDebugLogEnabled", "true"); + variables.put("failNotFound", "true"); + variables.put("msoRequestId", requestId); + variables.put("mso-request-id", "requestId"); + variables.put("allottedResourceId", ARID); + + variables.put("serviceInstanceId", DEC_INST); + variables.put("parentServiceInstanceId", DEC_PARENT_INST); + + RollbackData rollbackData = new RollbackData(); + + rollbackData.put(RbType, "serviceInstanceId", DEC_INST); + rollbackData.put(RbType, "serviceSubscriptionType", SVC); + rollbackData.put(RbType, "disablerollback", "false"); + rollbackData.put(RbType, "rollbackAAI", "true"); + rollbackData.put(RbType, "rollbackSDNCassign", "true"); + rollbackData.put(RbType, "rollbackSDNCactivate", "true"); + rollbackData.put(RbType, "rollbackSDNCcreate", "true"); + rollbackData.put(RbType, "aaiARPath", "http://localhost:"+wiremockPort+"/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID); + + rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml")); + rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml")); + rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml")); + + variables.put("rollbackData",rollbackData); + + return rollbackData; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java new file mode 100644 index 0000000000..4edaf7d21f --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java @@ -0,0 +1,145 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.bpmn.common.BPMNUtil; +import org.onap.so.bpmn.mock.FileUtil; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import static org.junit.Assert.*; +import static org.onap.so.bpmn.mock.StubResponseAAI.*; +import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; + + +public class DoDeleteAllottedResourceBRGIT extends AbstractTestBase { + + private static final String PROCNAME = "DoDeleteAllottedResourceBRG"; + private final CallbackSet callbacks = new CallbackSet(); + + public DoDeleteAllottedResourceBRGIT() { + callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); + callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml")); + callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); + callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); + } + + @Test + public void testDoDeleteAllottedResourceBRG_Success() { + logStart(); + MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariablesSuccess(variables); + + invokeSubProcess(PROCNAME, businessKey, variables); + + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertNull(workflowException); + logEnd(); + } + + @Test + public void testDoDeleteAllottedResourceBRG_ARNotInSDNC() { + logStart(); + MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariablesSuccess(variables); + + variables.put("failNotFound", "false"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + injectSDNCCallbacks(callbacks, "deactivateNF"); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertNull(workflowException); + logEnd(); + } + + + @Test + public void testDoDeleteAllottedResourceBRG_SubProcessError() throws Exception { + logStart(); + MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + mockSDNCAdapter(500); + + Map variables = new HashMap<>(); + setVariablesSuccess(variables); + + String processId = invokeSubProcess(PROCNAME, variables); + + + BPMNUtil.waitForWorkflowToFinish(processEngine,processId); + + Assert.assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException",processId); + System.out.println("workflowException:\n" + workflowException); + assertNotNull(workflowException); + logEnd(); + } + + private void setVariablesSuccess(Map variables) { + variables.put("isDebugLogEnabled", "true"); + variables.put("failNotFound", "true"); + variables.put("msoRequestId", "testRequestId1"); + variables.put("mso-request-id", "requestId"); + variables.put("allottedResourceId", ARID); + variables.put("serviceInstanceId", DEC_INST); + variables.put("parentServiceInstanceId", DEC_PARENT_INST); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java new file mode 100644 index 0000000000..520beaf07b --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java @@ -0,0 +1,140 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.bpmn.common.BPMNUtil; +import org.onap.so.bpmn.mock.FileUtil; + +import java.util.HashMap; +import java.util.Map; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.onap.so.bpmn.mock.StubResponseAAI.*; +import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; + + +public class DoDeleteAllottedResourceTXCIT extends AbstractTestBase { + + private static final String PROCNAME = "DoDeleteAllottedResourceTXC"; + private final CallbackSet callbacks = new CallbackSet(); + + public DoDeleteAllottedResourceTXCIT() { + callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); + callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml")); + callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); + callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); + } + + @Test + public void testDoDeleteAllottedResourceTXC_Success() throws Exception { + logStart(); + MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map variables = new HashMap<>(); + setVariablesSuccess(variables); + + String processId = invokeSubProcess(PROCNAME, variables); + + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + BPMNUtil.waitForWorkflowToFinish(processEngine,processId); + + Assert.assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException",processId); + System.out.println("workflowException:\n" + workflowException); + assertNull(workflowException); + logEnd(); + } + + @Test + public void testDoDeleteAllottedResourceTXC_ARNotInSDNC() throws Exception { + logStart(); + MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map variables = new HashMap<>(); + setVariablesSuccess(variables); + + variables.put("failNotFound", "false"); + + String processId = invokeSubProcess(PROCNAME, variables); + + injectSDNCCallbacks(callbacks, "deactivateNF"); + + BPMNUtil.waitForWorkflowToFinish(processEngine,processId); + + Assert.assertTrue(isProcessEndedByProcessInstanceId(processId)); + logEnd(); + } + + + @Test + public void testDoDeleteAllottedResourceTXC_SubProcessError() throws Exception { + logStart(); + MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + mockSDNCAdapter(500); + + Map variables = new HashMap<>(); + setVariablesSuccess(variables); + + String processId = invokeSubProcess(PROCNAME, variables); + + BPMNUtil.waitForWorkflowToFinish(processEngine,processId); + + Assert.assertTrue(isProcessEndedByProcessInstanceId(processId)); + String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException",processId); + System.out.println("workflowException:\n" + workflowException); + assertNotNull(workflowException); + logEnd(); + } + + private void setVariablesSuccess(Map variables) { + variables.put("isDebugLogEnabled", "true"); + variables.put("failNotFound", "true"); + variables.put("msoRequestId", "testRequestId1"); + variables.put("mso-request-id", "requestId"); + variables.put("allottedResourceId", ARID); + + variables.put("serviceInstanceId", DEC_INST); + variables.put("parentServiceInstanceId", DEC_PARENT_INST); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/GenericVnf.xml b/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/GenericVnf.xml new file mode 100644 index 0000000000..aaac6c1ec7 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/GenericVnf.xml @@ -0,0 +1,16 @@ + + VCPE-123456 + VCPE + VCPE + SDN-MOBILITY + vPCRF + pending-create + false + false + introvert + 2.0 + 0000020 + + + + diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/oofCallbackInfraVnf.json b/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/oofCallbackInfraVnf.json new file mode 100644 index 0000000000..15e601bae8 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/oofCallbackInfraVnf.json @@ -0,0 +1,50 @@ +{ + "transactionId": "xxx-xxx-xxxx", + "requestId": "yyy-yyy-yyyy", + "requestStatus": "completed", + "statusMessage": "success", + "solutions": { + "placementSolutions": [ + [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "some_resource_id", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["gjhd-098-fhd-987"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "amazon" }, + { "key": "vnfHostName", "value": "ahr344gh" }, + { "key": "isRehome", "value": "False" }, + { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" } + ] + }, + { + "resourceModuleName": "vG", + "serviceResourceId": "some_resource_id", + "solution": { + "identifierType": "cloudRegionId", + "cloudOwner": "amazon", + "identifiers": ["gjhd-098-fhd-987"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "amazon" }, + { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" }, + { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}} + ] + } + ] + ], + "licenseSolutions": [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "some_resource_id", + "entitlementPoolUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] + } + ] + } +} \ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestRollback.json b/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestRollback.json new file mode 100644 index 0000000000..a7b5c1be95 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestRollback.json @@ -0,0 +1,60 @@ +{ + "requestDetails": + { + "modelInfo": + { + "modelType":"service", + "modelInvariantUuid":"uuid-miu-svc-011-abcdef", + "modelVersionId":"ASDC_TOSCA_UUID", + "modelName":"SIModelName1", + "modelVersion":"2" + }, + "subscriberInfo": + { + "globalSubscriberId":"SDN-ETHERNET-INTERNET", + "subscriberName":"Kaneohe" + }, + "requestInfo": + { + "source":"VID", + "suppressRollback":"false", + "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName":"serviceInstanceName" + }, + "cloudConfiguration": + { + "lcpCloudRegionId":"mdt1_123", + "tenantId":"8b1df54faa3b49078e3416e21370a3ba" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "requestParameters": + { + "subscriptionServiceType":"123456789", + "aLaCarte":"false", + "userParams": [ + { + "name": "BRG_WAN_MAC_Address" + }, + { + "name": "Customer_Location", + "value": + { + "customerLatitude" : "32.89748", + "customerLongitude" : "-97.040443" + } + }, + { + "name": "Homing_Model_Ids", + "value": + { + "resourceModuleName" : "test" + } + } + ] + } + + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml b/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml new file mode 100644 index 0000000000..8a5ade6fb6 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml @@ -0,0 +1,208 @@ +aai: + auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764 + endpoint: http://localhost:${wiremock.server.port} +appc: + client: + key: iaEMAfjsVsZnraBP + response: + timeout: '120000' + secret: wcivUjsjXzmGFBfxMmyJu9dz + poolMembers: localhost:3904 + service: ueb + topic: + read: + name: APPC-TEST-AMDOCS2 + timeout: '120000' + write: APPC-TEST-AMDOCS1-DEV3 + sdnc: + read: SDNC-LCM-READ + write: SDNC-LCM-WRITE +mso: + adapters: + completemsoprocess: + endpoint: http://localhost:${wiremock.server.port}/CompleteMsoProcess + db: + auth: 757A94191D685FD2092AC1490730A4FC + endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter + spring: + endpoint: http://localhost:${wiremock.server.port} + network: + endpoint: http://localhost:${wiremock.server.port}/networks/NetworkAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/networks/rest/v1/networks + openecomp: + db: + endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter + po: + auth: 757A94191D685FD2092AC1490730A4FC + password: 3141634BF7E070AA289CF2892C986C0B + sdnc: + endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter/v1/sdnc + timeout: PT60S + tenant: + endpoint: http://localhost:${wiremock.server.port}/tenantAdapterMock + vnf: + endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/vnfs + volume-groups: + rest: + endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/volume-groups + vnf-async: + endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapterAsync + workflow: + message: + endpoint: http://localhost:${wiremock.server.port}/workflows/messages/message + + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + + bpmn: + optimisticlockingexception: + retrycount: '3' + callbackRetryAttempts: '5' + catalog: + db: + endpoint: http://localhost:${wiremock.server.port}/ + spring: + endpoint: http://localhost:${wiremock.server.port} + correlation: + timeout: 60 + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + default: + adapter: + namespace: http://org.onap.so + healthcheck: + log: + debug: 'false' + infra: + customer: + id: testCustIdInfra + logPath: logs + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + po: + timeout: PT60S + request: + db: + endpoint: http://localhost:${wiremock.server.port}/ + rollback: 'true' + sdnc: + password: 3141634BF7E070AA289CF2892C986C0B + site-name: localDevEnv + workflow: + default: + aai: + cloud-region: + version: '9' + generic-vnf: + version: '9' + v8: + customer: + uri: /aai/v8/business/customers/customer + generic-query: + uri: /aai/v8/search/generic-query + l3-network: + uri: /aai/v8/network/l3-networks/l3-network + network-policy: + uri: /aai/v8/network/network-policies/network-policy + nodes-query: + uri: /aai/v8/search/nodes-query + route-table-reference: + uri: /aai/v8/network/route-table-references/route-table-reference + tenant: + uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + vce: + uri: /aai/v8/network/vces/vce + vpn-binding: + uri: /aai/v8/network/vpn-bindings/vpn-binding + v9: + cloud-region: + uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic + generic-vnf: + uri: /aai/v9/network/generic-vnfs/generic-vnf + global: + default: + aai: + namespace: http://org.openecomp.aai.inventory/ + version: '8' + message: + endpoint: http://localhost:${wiremock.server.port}/mso/WorkflowMesssage + notification: + name: GenericNotificationService + sdncadapter: + callback: http://localhost:${wiremock.server.port}/mso/SDNCAdapterCallbackService + vnfadapter: + create: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + delete: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + query: + callback: http://localhost:${wiremock.server.port}/mso/services/VNFAdapterQuerCallbackV1 + rollback: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + global: + dmaap: + username: dmaapUsername + password: dmaapPassword + host: http://localhost:28090 + publisher: + topic: com.att.mso.asyncStatusUpdate + service-plugin: + third-sp-endpoint: + oof-calc-endpoint: +policy: + auth: Basic dGVzdHBkcDphbHBoYTEyMw== + client: + auth: Basic bTAzNzQzOnBvbGljeVIwY2sk + endpoint: https://localhost:8081/pdp/api/ + environment: TEST +sniro: + conductor: + enabled: true + host: http://localhost:${wiremock.server.port} + uri: /v1/release-orders + headers.auth: Basic dGVzdDp0ZXN0cHdk + manager: + timeout: PT30M + host: http://localhost:${wiremock.server.port} + uri.v1: /sniro/api/v2/placement + uri.v2: /sniro/api/placement/v2 + headers.auth: Basic dGVzdDp0ZXN0cHdk + headers.patchVersion: 1 + headers.minorVersion: 1 + headers.latestVersion: 2 +spring: + datasource: + url: jdbc:mariadb://localhost:3307/camundabpmn + username: root + password: password + driver-class-name: org.mariadb.jdbc.Driver + initialize: true + jpa: + generate-ddl: false + show-sql: false + hibernate: + ddl-auto: none + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + security: + usercredentials: + - + username: test + password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu' + role: BPEL-Client +mariaDB4j: + dataDir: + port: 3307 + databaseName: camundabpmn +camunda: + bpm: + metrics: + enabled: false + db-reporter-activate: false \ No newline at end of file diff --git a/bpmn/pom.xml b/bpmn/pom.xml index d7e26f9d85..9f004afe89 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -1,118 +1,95 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - + org.onap.so so - 1.2.0-SNAPSHOT - + 1.3.0-SNAPSHOT + - bpmn - BPMN Subsystem - BPMN Subsystem for MSO - pom + bpmn + BPMN Subsystem + BPMN Subsystem for MSO + pom - - 7.8.0 - 1.2 - camunda-webapp-jboss-standalone - 1.3.173 - 2.4.7 - 9.5.1-8 - 1.6 + + 7.8.0 + 1.2 + camunda-webapp-jboss-standalone + 1.4.196 + 2.4.7 + 9.5.1-8 + 2.4.0 - UTF-8 - UTF-8 + UTF-8 + UTF-8 - + - - MSOCoreBPMN - MSORESTClient - MSOCommonBPMN - MSOInfrastructureBPMN - MSOURN-plugin - MSOCockpit - + + MSOCoreBPMN + MSORESTClient + MSOCommonBPMN + so-bpmn-infrastructure-common + so-bpmn-tasks + so-bpmn-building-blocks + so-bpmn-infrastructure-flows + mso-infrastructure-bpmn + - - - - - org.camunda.bpm - camunda-bom - ${camunda.version} - import - pom - - - org.camunda.bpm.extension - camunda-bpm-assert - ${camunda.bpm.assert.version} - - - com.h2database - h2 - ${h2.version} - - - org.codehaus.groovy - groovy-all - ${groovy.version} - - - net.sf.saxon - Saxon-HE - ${saxon.version} - - - xmlunit - xmlunit - ${xmlunit.version} - - - javax.activation - activation - 1.1.1 - compile - - - org.springframework - spring-beans - 3.2.4.RELEASE - - - + + + + + com.h2database + h2 + ${h2.version} + + + org.codehaus.groovy + groovy-all + ${groovy.version} + + + net.sf.saxon + Saxon-HE + ${saxon.version} + + + org.xmlunit + xmlunit-core + ${xmlunit.version} + + + javax.activation + activation + 1.1.1 + compile + + + org.springframework + spring-beans + 4.3.12.RELEASE + + + - - - org.apache.httpcomponents - httpcore - - - org.apache.httpcomponents - httpclient - - + + + commons-beanutils + commons-beanutils + 1.9.3 + + + org.apache.httpcomponents + httpcore + + + org.apache.httpcomponents + httpclient + + - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - true - false - ${surefireArgLine} -Xss1m - 1 - true - - - - - diff --git a/bpmn/so-bpmn-building-blocks/pom.xml b/bpmn/so-bpmn-building-blocks/pom.xml new file mode 100644 index 0000000000..cc6e19d446 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/pom.xml @@ -0,0 +1,224 @@ + + + org.onap.so + bpmn + 1.3.0-SNAPSHOT + + 4.0.0 + so-bpmn-building-blocks + jar + + 2.0.1 + 3.1 + 1.2 + 1.4.196 + 2.4.7 + 9.5.1-8 + 1.6 + UTF-8 + UTF-8 + 7.8.0 + + + + + org.apache.cxf + cxf-codegen-plugin + 2.5.2 + + + org.apache.maven.plugins + maven-surefire-plugin + + + default-test + + test + + + + **/AllTasksTestsTestSuite.java + + + + + bpmn-tests + + test + + + + **/AllBPMNTestSuites.java + + + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.apache.maven.plugins + + + maven-antrun-plugin + + + [1.3,) + + + run + + + + + + + + + + + + + + + + + org.camunda.bpm + camunda-bom + ${camunda-os.version} + import + pom + + + + + + org.camunda.bpm + camunda-engine + + + org.camunda.bpm.springboot + camunda-bpm-spring-boot-starter + 2.3.0-alpha2 + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-web + + + com.h2database + h2 + test + + + com.fasterxml.uuid + java-uuid-generator + + + org.apache.commons + commons-lang3 + 3.4 + + + javax.ws.rs + javax.ws.rs-api + 2.0 + + + org.springframework + spring-web + + + org.camunda.bpm + camunda-engine-spring + + + org.springframework + spring-beans + + + org.onap.so + MSOCommonBPMN + ${project.version} + + + org.slf4j + slf4j-log4j12 + + + + + org.onap.so + MSOCommonBPMN + ${project.version} + + + org.slf4j + slf4j-log4j12 + + + test-jar + test + + + org.onap.so + MSOCoreBPMN + ${project.version} + test-jar + test + + + com.google.guava + guava + + + org.apache.commons + commons-lang3 + + + + + org.onap.so + so-bpmn-tasks + ${project.version} + + + org.onap.so + so-bpmn-infrastructure-common + ${project.version} + + + commons-net + commons-net + 3.6 + + + ch.vorburger.mariaDB4j + mariaDB4j + 2.2.3 + test + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/META-INF/processes.xml b/bpmn/so-bpmn-building-blocks/src/main/resources/META-INF/processes.xml new file mode 100644 index 0000000000..33c8cb1ac0 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/META-INF/processes.xml @@ -0,0 +1,31 @@ + + + + + + + + false + true + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/META-INF/services/org.onap.so.client.RestProperties b/bpmn/so-bpmn-building-blocks/src/main/resources/META-INF/services/org.onap.so.client.RestProperties new file mode 100644 index 0000000000..bdc72c86a4 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/META-INF/services/org.onap.so.client.RestProperties @@ -0,0 +1,2 @@ +org.onap.so.client.restproperties.AAIPropertiesImpl +org.onap.so.client.restproperties.PolicyRestPropertiesImpl \ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/META-INF/services/org.onap.so.client.dmaap.DmaapProperties b/bpmn/so-bpmn-building-blocks/src/main/resources/META-INF/services/org.onap.so.client.dmaap.DmaapProperties new file mode 100644 index 0000000000..939d5cdc1b --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/META-INF/services/org.onap.so.client.dmaap.DmaapProperties @@ -0,0 +1,2 @@ +org.onap.so.client.dmaapproperties.GlobalDmaapPropertiesImpl +org.onap.so.client.dmaapproperties.DefaultDmaapPropertiesImpl \ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAICheckVnfInMaintBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAICheckVnfInMaintBB.bpmn new file mode 100644 index 0000000000..de0f450624 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAICheckVnfInMaintBB.bpmn @@ -0,0 +1,50 @@ + + + + + SequenceFlow_0zaz9o2 + + + SequenceFlow_1jwsja5 + + + SequenceFlow_0zaz9o2 + SequenceFlow_1jwsja5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAISetVnfInMaintBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAISetVnfInMaintBB.bpmn new file mode 100644 index 0000000000..b2e100061d --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAISetVnfInMaintBB.bpmn @@ -0,0 +1,50 @@ + + + + + SequenceFlow_0zaz9o2 + + + SequenceFlow_1jwsja5 + + + SequenceFlow_0zaz9o2 + SequenceFlow_1jwsja5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAIUnsetVnfInMaintBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAIUnsetVnfInMaintBB.bpmn new file mode 100644 index 0000000000..7335f8677c --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAIUnsetVnfInMaintBB.bpmn @@ -0,0 +1,50 @@ + + + + + SequenceFlow_0zaz9o2 + + + SequenceFlow_1jwsja5 + + + + SequenceFlow_0zaz9o2 + SequenceFlow_1jwsja5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkBB.bpmn new file mode 100644 index 0000000000..6ca3745f43 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkBB.bpmn @@ -0,0 +1,71 @@ + + + + + SequenceFlow_05elmhj + + + SequenceFlow_18atf08 + + + SequenceFlow_05elmhj + SequenceFlow_0xbvwsu + + + SequenceFlow_0xbvwsu + SequenceFlow_18atf08 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkCollectionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkCollectionBB.bpmn new file mode 100644 index 0000000000..87a1dae090 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkCollectionBB.bpmn @@ -0,0 +1,52 @@ + + + + + SequenceFlow_05elmhj + + + SequenceFlow_18atf08 + + + SequenceFlow_05elmhj + SequenceFlow_18atf08 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateServiceInstanceBB.bpmn new file mode 100644 index 0000000000..3d55ecd8f6 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateServiceInstanceBB.bpmn @@ -0,0 +1,65 @@ + + + + + SequenceFlow_1byfr8v + + + SequenceFlow_0pioehv + + + + SequenceFlow_1byfr8v + SequenceFlow_00q7fsg + + + + SequenceFlow_00q7fsg + SequenceFlow_0pioehv + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn new file mode 100644 index 0000000000..b118d9b71c --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn @@ -0,0 +1,66 @@ + + + + + SequenceFlow_0ieafii + + + + SequenceFlow_0xsp0pv + + + SequenceFlow_0ieafii + SequenceFlow_14kvrbe + + + + SequenceFlow_14kvrbe + SequenceFlow_0xsp0pv + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVnfBB.bpmn new file mode 100644 index 0000000000..61d8f6eb44 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVnfBB.bpmn @@ -0,0 +1,65 @@ + + + + + SequenceFlow_0k9qnoi + + + + + SequenceFlow_0vnitwg + + + + SequenceFlow_0k9qnoi + SequenceFlow_0r6pzwt + + + SequenceFlow_0r6pzwt + SequenceFlow_0vnitwg + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVolumeGroupBB.bpmn new file mode 100644 index 0000000000..03ba8bbe43 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVolumeGroupBB.bpmn @@ -0,0 +1,52 @@ + + + + + SequenceFlow_1wz1rfg + + + + SequenceFlow_0mh0v9h + + + SequenceFlow_1wz1rfg + SequenceFlow_0mh0v9h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetwork1802BB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetwork1802BB.bpmn new file mode 100644 index 0000000000..cb4be0279e --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetwork1802BB.bpmn @@ -0,0 +1,92 @@ + + + + + SequenceFlow_11op1ih + + + SequenceFlow_11op1ih + SequenceFlow_32 + + + SequenceFlow_32 + SequenceFlow_0do51t8 + + + + + SequenceFlow_0do51t8 + SequenceFlow_0ln3hj3 + + + SequenceFlow_0ln3hj3 + + + + sets Cloud Region on BB execution for SDNC assign + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn new file mode 100644 index 0000000000..79cbe68a3a --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn @@ -0,0 +1,208 @@ + + + + + SequenceFlow_11op1ih + + + SequenceFlow_0mxc4ri + SequenceFlow_017131q + SequenceFlow_32 + + + SequenceFlow_32 + SequenceFlow_0do51t8 + + + + + SequenceFlow_0gkr871 + SequenceFlow_1ctpnpe + + + SequenceFlow_0do51t8 + SequenceFlow_0ln3hj3 + + + SequenceFlow_11op1ih + SequenceFlow_017131q + SequenceFlow_0gkr871 + + + + + + + SequenceFlow_0ln3hj3 + + + + + SequenceFlow_07z7hcu + SequenceFlow_0e08b9t + + + SequenceFlow_0e08b9t + SequenceFlow_0mxc4ri + + + + + + SequenceFlow_1ctpnpe + SequenceFlow_0fwcvep + + + SequenceFlow_0fwcvep + SequenceFlow_07z7hcu + + + + sets Cloud Region on BB execution for SDNC assign + + + conditionally executed if Network Collection Instance Group exists + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignServiceInstanceBB.bpmn new file mode 100644 index 0000000000..f68fc91584 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignServiceInstanceBB.bpmn @@ -0,0 +1,126 @@ + + + + + SequenceFlow_1xr6chl + + + SequenceFlow_1h6t7yr + SequenceFlow_0czewtx + + + SequenceFlow_0czewtx + SequenceFlow_1t55i01 + + + SequenceFlow_1t55i01 + SequenceFlow_0aef1l8 + + + SequenceFlow_0aef1l8 + SequenceFlow_07ea5ui + + + + + + + SequenceFlow_14xl505 + + + + SequenceFlow_07ea5ui + SequenceFlow_14xl505 + + + + SequenceFlow_1xr6chl + SequenceFlow_1h6t7yr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn new file mode 100644 index 0000000000..b7ce68eace --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn @@ -0,0 +1,95 @@ + + + + + SequenceFlow_1xr6chl + + + SequenceFlow_1xr6chl + SequenceFlow_0czewtx + + + SequenceFlow_0574gaa + SequenceFlow_15hn8si + + + + + SequenceFlow_14xl505 + + + + SequenceFlow_15hn8si + SequenceFlow_14xl505 + + + + + SequenceFlow_0czewtx + SequenceFlow_0574gaa + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn new file mode 100644 index 0000000000..f1a023910b --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn @@ -0,0 +1,177 @@ + + + + + SequenceFlow_0zaz9o2 + + + SequenceFlow_11jum90 + SequenceFlow_0v8d14a + SequenceFlow_1ks8kmt + + + SequenceFlow_0csh9dc + + + SequenceFlow_0zaz9o2 + SequenceFlow_1jwsja5 + + + + + + SequenceFlow_1ks8kmt + SequenceFlow_0csh9dc + + + SequenceFlow_1lppa2m + SequenceFlow_1nle8kc + + + + + SequenceFlow_1nle8kc + SequenceFlow_11jum90 + SequenceFlow_1uiok7v + + + + + + + + + + + + + SequenceFlow_1uiok7v + SequenceFlow_0v8d14a + + + + + SequenceFlow_1jwsja5 + SequenceFlow_169g0ir + + + SequenceFlow_169g0ir + SequenceFlow_1lppa2m + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVolumeGroupBB.bpmn new file mode 100644 index 0000000000..b1626c8a53 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVolumeGroupBB.bpmn @@ -0,0 +1,52 @@ + + + + + SequenceFlow_1wz1rfg + + + + SequenceFlow_0mh0v9h + + + SequenceFlow_1wz1rfg + SequenceFlow_0mh0v9h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelServiceInstanceBB.bpmn new file mode 100644 index 0000000000..6641516bfa --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelServiceInstanceBB.bpmn @@ -0,0 +1,68 @@ + + + + + SequenceFlow_18i4a05 + + + SequenceFlow_0g502yj + + + + + + SequenceFlow_18i4a05 + SequenceFlow_19kfk17 + + + SequenceFlow_19kfk17 + SequenceFlow_0g502yj + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVfModuleBB.bpmn new file mode 100644 index 0000000000..a48abe25a1 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVfModuleBB.bpmn @@ -0,0 +1,66 @@ + + + + + SequenceFlow_0ieafii + + + + SequenceFlow_0xsp0pv + + + SequenceFlow_0ieafii + SequenceFlow_14kvrbe + + + + SequenceFlow_14kvrbe + SequenceFlow_0xsp0pv + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVnfBB.bpmn new file mode 100644 index 0000000000..68f491e1f0 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVnfBB.bpmn @@ -0,0 +1,68 @@ + + + + + SequenceFlow_18i4a05 + + + SequenceFlow_0g502yj + + + + + + SequenceFlow_18i4a05 + SequenceFlow_19kfk17 + + + SequenceFlow_19kfk17 + SequenceFlow_0g502yj + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateCustomerBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateCustomerBB.bpmn new file mode 100644 index 0000000000..1e88963c21 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateCustomerBB.bpmn @@ -0,0 +1,53 @@ + + + + + SequenceFlow_1wz1rfg + + + + SequenceFlow_0kfkpbh + + + SequenceFlow_1wz1rfg + SequenceFlow_0kfkpbh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn new file mode 100644 index 0000000000..b91e2df8f7 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn @@ -0,0 +1,198 @@ + + + + + SequenceFlow_1maepy7 + + + SequenceFlow_0sissul + + + SequenceFlow_1oc7wcr + SequenceFlow_0n42zi5 + + + SequenceFlow_1eqfh23 + SequenceFlow_0innva6 + + + SequenceFlow_0n42zi5 + SequenceFlow_1yy4aik + + + SequenceFlow_1yy4aik + SequenceFlow_1h9kkhb + + + SequenceFlow_0innva6 + SequenceFlow_0sissul + + + + + + + SequenceFlow_1maepy7 + SequenceFlow_06rq9pi + + + + SequenceFlow_03ebe6c + + + + SequenceFlow_1oc7wcr + + + + SequenceFlow_1eqfh23 + + + + SequenceFlow_1h9kkhb + + + + + + + SequenceFlow_06rq9pi + SequenceFlow_03ebe6c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkCollectionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkCollectionBB.bpmn new file mode 100644 index 0000000000..c6c3599449 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkCollectionBB.bpmn @@ -0,0 +1,112 @@ + + + + + SequenceFlow_1maepy7 + + + SequenceFlow_0hhklb4 + + + SequenceFlow_1maepy7 + SequenceFlow_06rq9pi + + + + SequenceFlow_06rq9pi + SequenceFlow_05yxpu5 + + + + SequenceFlow_05yxpu5 + SequenceFlow_0z4c30j + + + SequenceFlow_0z4c30j + SequenceFlow_1hij1px + + + + + SequenceFlow_1hij1px + SequenceFlow_0hhklb4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn new file mode 100644 index 0000000000..7691498bd0 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn @@ -0,0 +1,115 @@ + + + + + SequenceFlow_1xr6chl + + + SequenceFlow_1s4rpyp + SequenceFlow_15hn8si + + + + SequenceFlow_1stomxq + + + SequenceFlow_15hn8si + SequenceFlow_16g4dz0 + + + + + SequenceFlow_1xr6chl + SequenceFlow_1s4rpyp + + + + + + + + + + SequenceFlow_16g4dz0 + SequenceFlow_0ecr393 + + + + SequenceFlow_0ecr393 + SequenceFlow_1stomxq + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn new file mode 100644 index 0000000000..58a429dcc5 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn @@ -0,0 +1,102 @@ + + + + + SequenceFlow_1wz1rfg + + + + SequenceFlow_0mh0v9h + + + SequenceFlow_06q6g74 + SequenceFlow_0kfkpbh + + + + SequenceFlow_06flg6h + SequenceFlow_0mh0v9h + + + + SequenceFlow_1wz1rfg + SequenceFlow_06q6g74 + + + + + + + + + SequenceFlow_0kfkpbh + SequenceFlow_06flg6h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateNetworkBB.bpmn new file mode 100644 index 0000000000..836f52b9be --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateNetworkBB.bpmn @@ -0,0 +1,72 @@ + + + + + SequenceFlow_05elmhj + + + SequenceFlow_18atf08 + + + SequenceFlow_05elmhj + SequenceFlow_0xbvwsu + + + SequenceFlow_0xbvwsu + SequenceFlow_18atf08 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateServiceInstanceBB.bpmn new file mode 100644 index 0000000000..80faf1378c --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateServiceInstanceBB.bpmn @@ -0,0 +1,66 @@ + + + + + SequenceFlow_101w1ck + + + SequenceFlow_0pioehv + + + + + SequenceFlow_00q7fsg + SequenceFlow_0pioehv + + + SequenceFlow_101w1ck + SequenceFlow_00q7fsg + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVfModuleBB.bpmn new file mode 100644 index 0000000000..85cde2aca7 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVfModuleBB.bpmn @@ -0,0 +1,70 @@ + + + + + SequenceFlow_0m379r2 + + + SequenceFlow_0m379r2 + SequenceFlow_01bdpek + + + + SequenceFlow_01bdpek + SequenceFlow_1y1c7fh + + + + SequenceFlow_1y1c7fh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVnfBB.bpmn new file mode 100644 index 0000000000..d6b7dd6534 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVnfBB.bpmn @@ -0,0 +1,65 @@ + + + + + SequenceFlow_0k9qnoi + + + + + SequenceFlow_0vnitwg + + + + SequenceFlow_0k9qnoi + SequenceFlow_0r6pzwt + + + SequenceFlow_0r6pzwt + SequenceFlow_0vnitwg + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVolumeGroupBB.bpmn new file mode 100644 index 0000000000..2b2e30b773 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVolumeGroupBB.bpmn @@ -0,0 +1,52 @@ + + + + + SequenceFlow_1wz1rfg + + + + SequenceFlow_0mh0v9h + + + SequenceFlow_1wz1rfg + SequenceFlow_0mh0v9h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkBB.bpmn new file mode 100644 index 0000000000..faa40600a5 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkBB.bpmn @@ -0,0 +1,75 @@ + + + + + SequenceFlow_1mc3d3f + + + SequenceFlow_1c906im + SequenceFlow_0nhd7b7 + + + + + SequenceFlow_1mc3d3f + SequenceFlow_1c906im + + + SequenceFlow_0nhd7b7 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkCollectionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkCollectionBB.bpmn new file mode 100644 index 0000000000..f6d028585a --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkCollectionBB.bpmn @@ -0,0 +1,67 @@ + + + + + SequenceFlow_1maepy7 + + + SequenceFlow_0lju8aw + + + + SequenceFlow_1maepy7 + SequenceFlow_0v9bqr9 + + + SequenceFlow_0v9bqr9 + SequenceFlow_0lju8aw + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn new file mode 100644 index 0000000000..408e378bcf --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn @@ -0,0 +1,85 @@ + + + + + SequenceFlow_1537yw5 + + + SequenceFlow_1537yw5 + SequenceFlow_08tvhtf + + + + SequenceFlow_02lpx87 + SequenceFlow_1mxrfqv + + + + SequenceFlow_1mxrfqv + + + + + + + + + SequenceFlow_08tvhtf + SequenceFlow_02lpx87 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn new file mode 100644 index 0000000000..6fd7773714 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn @@ -0,0 +1,67 @@ + + + + + SequenceFlow_1wz1rfg + + + + SequenceFlow_0mh0v9h + + + SequenceFlow_13ngwev + SequenceFlow_0mh0v9h + + + + + SequenceFlow_1wz1rfg + SequenceFlow_13ngwev + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn new file mode 100644 index 0000000000..8640f7e069 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn @@ -0,0 +1,310 @@ + + + + + SequenceFlow_0rq4c5r + + + + + + + + Continue + SequenceFlow_01h9qmz + + + + + SequenceFlow_0rq4c5r + SequenceFlow_0uzwjrq + + + SequenceFlow_01h9qmz + SequenceFlow_1ryv9sh + + + + + SequenceFlow_0uzwjrq + SequenceFlow_0je0y25 + + + + + + SequenceFlow_0je0y25 + Continue + SequenceFlow_1ryv9sh + + + + SequenceFlow_0yeaaxu + + + + SequenceFlow_0yeaaxu + SequenceFlow_1b5op07 + SequenceFlow_030qtgc + SequenceFlow_0a62t4c + + + SequenceFlow_0h8v45y + SequenceFlow_1db2c7t + + + SequenceFlow_0a62t4c + SequenceFlow_0fwsjva + SequenceFlow_0h8v45y + + + SequenceFlow_0ndt8ft + SequenceFlow_07a1ytc + + + + + + SequenceFlow_0fwsjva + SequenceFlow_1wbevp0 + SequenceFlow_1db2c7t + + + SequenceFlow_07a1ytc + + + SequenceFlow_1wbevp0 + SequenceFlow_0ndt8ft + + + + + + + + + + + + + + + + + SequenceFlow_030qtgc + + + + SequenceFlow_1b5op07 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/SDNOVnfHealthCheckBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/SDNOVnfHealthCheckBB.bpmn new file mode 100644 index 0000000000..8cc682ce7f --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/SDNOVnfHealthCheckBB.bpmn @@ -0,0 +1,51 @@ + + + + + SequenceFlow_0zaz9o2 + + + SequenceFlow_1jwsja5 + + + SequenceFlow_0zaz9o2 + SequenceFlow_1jwsja5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetwork1802BB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetwork1802BB.bpmn new file mode 100644 index 0000000000..bd6b124175 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetwork1802BB.bpmn @@ -0,0 +1,95 @@ + + + + + SequenceFlow_0zaz9o2 + + + SequenceFlow_0le4vrj + SequenceFlow_1ks8kmt + + + SequenceFlow_1ks8kmt + + + + + SequenceFlow_1gd5h4c + SequenceFlow_0mxe1a7 + + + + + SequenceFlow_0zaz9o2 + SequenceFlow_1gd5h4c + + + + SequenceFlow_0mxe1a7 + SequenceFlow_0le4vrj + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn new file mode 100644 index 0000000000..208e41f174 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn @@ -0,0 +1,110 @@ + + + + + SequenceFlow_0zaz9o2 + + + SequenceFlow_0le4vrj + SequenceFlow_1ks8kmt + + + SequenceFlow_0csh9dc + + + + + + SequenceFlow_1ks8kmt + SequenceFlow_0csh9dc + + + SequenceFlow_1gd5h4c + SequenceFlow_0mxe1a7 + + + + + SequenceFlow_0zaz9o2 + SequenceFlow_1gd5h4c + + + + SequenceFlow_0mxe1a7 + SequenceFlow_0le4vrj + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignServiceInstanceBB.bpmn new file mode 100644 index 0000000000..235c7c9eac --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignServiceInstanceBB.bpmn @@ -0,0 +1,67 @@ + + + + + SequenceFlow_0fzrhkc + + + SequenceFlow_0pu9j6i + SequenceFlow_0sfeg65 + + + + SequenceFlow_0fzrhkc + SequenceFlow_0pu9j6i + + + + SequenceFlow_0sfeg65 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVfModuleBB.bpmn new file mode 100644 index 0000000000..2b9edbc3d5 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVfModuleBB.bpmn @@ -0,0 +1,65 @@ + + + + + SequenceFlow_1kfxl04 + + + SequenceFlow_1p2r4og + SequenceFlow_0qa6sxx + + + SequenceFlow_1kfxl04 + SequenceFlow_1p2r4og + + + SequenceFlow_0qa6sxx + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVnfBB.bpmn new file mode 100644 index 0000000000..83ba0a9155 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVnfBB.bpmn @@ -0,0 +1,80 @@ + + + + + SequenceFlow_1kfxl04 + + + SequenceFlow_0w3s09a + SequenceFlow_0qa6sxx + + + SequenceFlow_1kfxl04 + SequenceFlow_02st1i1 + + + SequenceFlow_0qa6sxx + + + + + SequenceFlow_02st1i1 + SequenceFlow_0w3s09a + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVolumeGroupBB.bpmn new file mode 100644 index 0000000000..12af246153 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVolumeGroupBB.bpmn @@ -0,0 +1,52 @@ + + + + + SequenceFlow_1kfxl04 + + + SequenceFlow_1kfxl04 + SequenceFlow_0qa6sxx + + + SequenceFlow_0qa6sxx + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn new file mode 100644 index 0000000000..9f431212b1 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn @@ -0,0 +1,232 @@ + + + + + SequenceFlow_074w2et + + + SequenceFlow_074w2et + SequenceFlow_04yezm3 + + + + SequenceFlow_04yezm3 + + + + + SequenceFlow_1trqq6d + SequenceFlow_03janqs + + + SequenceFlow_1trqq6d + + + + + SequenceFlow_03janqs + SequenceFlow_1io4cl7 + + + + SequenceFlow_1io4cl7 + SequenceFlow_16fm47t + + + + + SequenceFlow_16fm47t + SequenceFlow_00xbxe7 + + + SequenceFlow_00xbxe7 + + + + + SequenceFlow_196cgux + + + + + SequenceFlow_196cgux + SequenceFlow_0hsvgje + + + + SequenceFlow_0hsvgje + SequenceFlow_0fhfitm + + + SequenceFlow_0fhfitm + + + + + SequenceFlow_1vfwv05 + + + + SequenceFlow_1vfwv05 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn new file mode 100644 index 0000000000..04f3684ee4 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn @@ -0,0 +1,122 @@ + + + + + SequenceFlow_1xr6chl + + + + SequenceFlow_1abat8l + + + SequenceFlow_1abat8l + + + + + + + SequenceFlow_1ivhukd + + + SequenceFlow_1xr6chl + SequenceFlow_0qaaf5k + + + SequenceFlow_0j1zvis + SequenceFlow_1ivhukd + + + + + + + + + + + + SequenceFlow_0qaaf5k + SequenceFlow_0j1zvis + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn new file mode 100644 index 0000000000..6544387775 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn @@ -0,0 +1,550 @@ + + + + + SequenceFlow_15s0okp + + + SequenceFlow_1rscv7d + SequenceFlow_0x4urgp + + + + + + + + + + + + SequenceFlow_0mqrkxv + SequenceFlow_07h9d4y + + + + SequenceFlow_1atzsgn + SequenceFlow_1wb59ic + SequenceFlow_005hi8o + SequenceFlow_0unbew4 + SequenceFlow_0mqrkxv + + + SequenceFlow_07h9d4y + SequenceFlow_1m2eezj + SequenceFlow_0v588sm + SequenceFlow_11530ei + SequenceFlow_01j184u + SequenceFlow_0l7kaba + + + + + + + SequenceFlow_15s0okp + SequenceFlow_0vc9go9 + + + SequenceFlow_0sckerv + SequenceFlow_1wb59ic + + + SequenceFlow_0kf5sen + SequenceFlow_1pz6edz + + + + + + + + + + + SequenceFlow_1pz6edz + SequenceFlow_1rscv7d + + + + + + SequenceFlow_1edjl5x + + + + SequenceFlow_0wvzfgf + + + SequenceFlow_024g0d1 + SequenceFlow_0eana0l + SequenceFlow_0wvzfgf + + + + + SequenceFlow_1edjl5x + SequenceFlow_024g0d1 + SequenceFlow_0vi883o + + + + + + + + SequenceFlow_0vi883o + SequenceFlow_0eana0l + + + + + + + + + + SequenceFlow_0v588sm + SequenceFlow_1atzsgn + SequenceFlow_11dlyzt + + + + + + + SequenceFlow_02ksbt0 + SequenceFlow_1p8yxu6 + + + SequenceFlow_1p8yxu6 + SequenceFlow_1r570x3 + + + + + + + SequenceFlow_01j184u + SequenceFlow_005hi8o + + + SequenceFlow_0vc9go9 + SequenceFlow_0sckerv + SequenceFlow_0unbew4 + + + + + + + SequenceFlow_11530ei + SequenceFlow_02ksbt0 + SequenceFlow_1r570x3 + + + + + + + SequenceFlow_1m2eezj + SequenceFlow_0kf5sen + SequenceFlow_0x4urgp + + + + + + + SequenceFlow_1ui67mc + + + + + + SequenceFlow_11dlyzt + SequenceFlow_0l7kaba + SequenceFlow_1ui67mc + + + + + + + + SequenceFlow_11d126w + + + + SequenceFlow_11d126w + SequenceFlow_0w4sx88 + + + SequenceFlow_0w4sx88 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/AllBaseTaskTestSuite.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/AllBaseTaskTestSuite.java new file mode 100644 index 0000000000..18081878a8 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/AllBaseTaskTestSuite.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; + +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses({"**/common/aai/tasks/*Test.class", "**/bpmn/sdno/tasks/*Test.class", "**/buildingblock/SniroHomingTest.class"}) +public class AllBaseTaskTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/AllTestSuites.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/AllTestSuites.java new file mode 100644 index 0000000000..98e613efe6 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/AllTestSuites.java @@ -0,0 +1,32 @@ +/*- + * ============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; +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses({"**/*Test.class"}) +public class AllTestSuites { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseTest.java new file mode 100644 index 0000000000..2bec24e44b --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseTest.java @@ -0,0 +1,209 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.model.bpmn.Bpmn; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.junit.Before; +import org.junit.runner.RunWith; +import org.onap.so.bpmn.buildingblock.SniroHomingV2; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.common.MockLoggerDelegate; +import org.onap.so.bpmn.infrastructure.aai.tasks.AAIFlagTasks; +import org.onap.so.bpmn.sdno.tasks.SDNOHealthCheckTasks; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupMapperLayer; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.client.adapter.network.NetworkAdapterClientImpl; +import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIVnfResources; +import org.onap.so.client.orchestration.SDNOHealthCheckResources; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.client.sniro.SniroClient; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.embedded.LocalServerPort; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.boot.test.mock.mockito.SpyBean; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; +import org.springframework.http.HttpHeaders; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +@ContextConfiguration +@AutoConfigureWireMock(port = 0) +public abstract class BaseTest extends BuildingBlockTestDataSetup { + + + protected Map variables = new HashMap<>(); + + protected TestRestTemplate restTemplate = new TestRestTemplate(); + + protected HttpHeaders headers = new HttpHeaders(); + + @Value("${wiremock.server.port") + protected String wireMockPort; + + @Autowired + protected RuntimeService runtimeService; + + @Autowired + private RepositoryService repositoryService; + /* + * Mocked for injection via autowiring + */ + + @Value("${mso.catalog.db.spring.endpoint}") + protected String endpoint; + + @MockBean + protected CatalogDbClient MOCK_catalogDbClient; + + @SpyBean + protected InjectionHelper MOCK_injectionHelper; + + @SpyBean + protected NetworkAdapterObjectMapper MOCK_networkAdapterObjectMapper; + + @SpyBean + protected AAIObjectMapper MOCK_aaiObjectMapper; + @SpyBean + protected NetworkAdapterClientImpl MOCK_networkAdapterClient; + @SpyBean + protected SDNCClient MOCK_sdncClient; + + @SpyBean + protected AAIFlagTasks aaiFlagTasks; + + @SpyBean + protected AAIVnfResources aaiVnfResources; + + @SpyBean + protected ExceptionBuilder exceptionUtil; + + @SpyBean + protected SDNOHealthCheckResources MOCK_sdnoHealthCheckResources; + + + + + + + + /* + * Classes that cannot be simply mocked because they are both + * needed for testing another class, and must be autowired when + * being tested themselves....or classes with private methods that + * must be stubbed during testing + */ + + + + + @SpyBean + protected BBInputSetupMapperLayer SPY_bbInputSetupMapperLayer; + @SpyBean + protected BBInputSetupUtils SPY_bbInputSetupUtils; + @SpyBean + protected BBInputSetup SPY_bbInputSetup; + @SpyBean + protected SniroHomingV2 sniroHoming; + + @SpyBean + protected SniroClient sniroClient; + + @SpyBean + protected SDNOHealthCheckTasks sdnoHealthCheckTasks; + + /* + * Mocked for injection via the IntectionHelper + */ + + + + @Before + public void baseTestBefore() { + variables.put("gBuildingBlockExecution", new DelegateExecutionImpl(new HashMap<>())); + + + } + + @LocalServerPort + private int port; + + protected String readFile(String path) throws IOException { + return readFile(path, Charset.defaultCharset()); + } + + protected String readFile(String path, Charset encoding) throws IOException { + byte[] encoded = Files.readAllBytes(Paths.get(path)); + return new String(encoded, encoding); + } + + protected String readJsonFileAsString(String fileLocation) throws IOException{ + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(new File(fileLocation)); + return jsonNode.asText(); + } + + protected String createURLWithPort(String uri) { + return "http://localhost:" + port + uri; + } + /** + * Create and deploy a process model with one logger delegate as service task. + * + * @param origProcessKey + * key to call + * @param mockProcessName + * process name + * @param fileName + * file name without extension + */ + protected void mockSubprocess(String origProcessKey, String mockProcessName, String fileName) { + BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(origProcessKey).name(mockProcessName) + .startEvent().name("Start Point").serviceTask().name("Log Something for Test") + .camundaClass(MockLoggerDelegate.class.getName()).endEvent().name("End Point").done(); + repositoryService.createDeployment().addModelInstance(fileName + ".bpmn", modelInstance).deploy(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseUnitTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseUnitTest.java new file mode 100644 index 0000000000..5719ce15e2 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseUnitTest.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; + +public abstract class BaseUnitTest extends BuildingBlockTestDataSetup{ + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java new file mode 100644 index 0000000000..9e6cfdb686 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java @@ -0,0 +1,665 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.assertj.core.util.Arrays; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; +import org.junit.Before; +import org.junit.Rule; +import org.junit.rules.ExpectedException; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoAllottedResource; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy; + +public class BuildingBlockTestDataSetup{ + private int collectionCounter; + private int configurationCounter; + private int customerCounter; + private int genericVnfCounter; + private int instanceGroupCounter; + private int l3NetworkCounter; + private int owningEntityCounter; + private int pnfCounter; + private int projectCounter; + private int serviceInstanceCounter; + private int serviceProxyCounter; + private int serviceSubscriptionCounter; + private int vfModuleCounter; + private int volumeGroupCounter; + private int vpnBindingCounter; + private int vpnBondingLinkCounter; + + protected BuildingBlockExecution execution; + + protected GeneralBuildingBlock gBBInput; + + protected HashMap lookupKeyMap; + + protected ExtractPojosForBB extractPojosForBB = new ExtractPojosForBB(); + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + protected DelegateExecution delegateExecution; + + @Before + public void buildingBlockTestDataSetupBefore() { + collectionCounter = 0; + configurationCounter = 0; + customerCounter = 0; + genericVnfCounter = 0; + instanceGroupCounter = 0; + l3NetworkCounter = 0; + owningEntityCounter = 0; + pnfCounter = 0; + projectCounter = 0; + serviceInstanceCounter = 0; + serviceProxyCounter = 0; + serviceSubscriptionCounter = 0; + vfModuleCounter = 0; + volumeGroupCounter = 0; + vpnBindingCounter = 0; + vpnBondingLinkCounter = 0; + + execution = new DelegateExecutionImpl(new ExecutionImpl()); + execution.setVariable("testProcessKey", "testProcessKeyValue"); + + gBBInput = new GeneralBuildingBlock(); + execution.setVariable("gBBInput", gBBInput); + + lookupKeyMap = new HashMap(); + execution.setVariable("lookupKeyMap", lookupKeyMap); + + ExecutionImpl mockExecutionImpl = mock(ExecutionImpl.class); + doReturn("test").when(mockExecutionImpl).getProcessInstanceId(); + + ExecutionImpl executionImpl = new ExecutionImpl(); + executionImpl.setProcessInstance(mockExecutionImpl); + + delegateExecution = (DelegateExecution) executionImpl; + delegateExecution.setVariable("testProcessKey", "testProcessKeyValue"); + } + + public Map buildUserInput() { + Map userInput = new HashMap<>(); + userInput.put("testUserInputKey", "testUserInputValue"); + + return userInput; + } + + public Map setUserInput() { + Map userInput = buildUserInput(); + + gBBInput.setUserInput(userInput); + + return userInput; + } + + public RequestContext buildRequestContext() { + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId(UUID.randomUUID().toString()); + requestContext.setProductFamilyId("testProductFamilyId"); + requestContext.setRequestorId("testRequestorId"); + + requestContext.setUserParams(new HashMap<>()); + + Map dataMap = new HashMap<>(); + dataMap.put("vpnId","testVpnId"); + dataMap.put("vpnRegion","testVpnRegion"); + dataMap.put("vpnRt","testVpnRt"); + dataMap.put("vpnName","vpnName"); + dataMap.put("vpnRegion", Arrays.asList(new String[] {"USA", "EMEA", "APAC"})); + + HashMap userParams = new HashMap<>(); + userParams.put("vpnData",dataMap); + + List> userParamsList = new ArrayList<>(); + userParamsList.add(userParams); + + RequestParameters requestParameters = new RequestParameters(); + requestParameters.setUserParams(userParamsList); + requestContext.setRequestParameters(requestParameters); + + return requestContext; + } + + public RequestContext setRequestContext() { + RequestContext requestContext = buildRequestContext(); + + gBBInput.setRequestContext(requestContext); + + return requestContext; + } + + public CloudRegion buildCloudRegion() { + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("testLcpCloudRegionId"); + cloudRegion.setTenantId("testTenantId"); + cloudRegion.setCloudOwner("testCloudOwner"); + + return cloudRegion; + } + + public CloudRegion setCloudRegion() { + CloudRegion cloudRegion = buildCloudRegion(); + + gBBInput.setCloudRegion(cloudRegion); + + return cloudRegion; + } + + public OrchestrationContext buildOrchestrationContext() { + OrchestrationContext orchestrationContext = new OrchestrationContext(); + + return orchestrationContext; + } + + public OrchestrationContext setOrchestrationContext() { + OrchestrationContext orchestrationContext = buildOrchestrationContext(); + + gBBInput.setOrchContext(orchestrationContext); + + return orchestrationContext; + } + + public Collection buildCollection() { + collectionCounter++; + + Collection collection = new Collection(); + collection.setId("testId" + collectionCounter); + collection.setInstanceGroup(buildInstanceGroup()); + + return collection; + } + + public Configuration buildConfiguration() { + configurationCounter++; + + Configuration configuration = new Configuration(); + configuration.setConfigurationId("testConfigurationId" + configurationCounter); + configuration.setConfigurationName("testConfigurationName" + configurationCounter); + + ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); + modelInfoConfiguration.setModelVersionId("testModelVersionId" + configurationCounter); + modelInfoConfiguration.setModelInvariantId("testModelInvariantId" + configurationCounter); + modelInfoConfiguration.setModelCustomizationId("testModelCustomizationId" + configurationCounter); + + configuration.setModelInfoConfiguration(modelInfoConfiguration); + + return configuration; + } + + public OwningEntity buildOwningEntity() { + owningEntityCounter++; + + OwningEntity owningEntity = new OwningEntity(); + owningEntity.setOwningEntityId("testOwningEntityId" + owningEntityCounter); + owningEntity.setOwningEntityName("testOwningEntityName" + owningEntityCounter); + + return owningEntity; + } + + public Project buildProject() { + projectCounter++; + + Project project = new Project(); + project.setProjectName("testProjectName" + projectCounter); + + return project; + } + + public ServiceSubscription buildServiceSubscription() { + serviceSubscriptionCounter++; + + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setTempUbSubAccountId("testTempUbSubAccountId" + serviceSubscriptionCounter); + serviceSubscription.setServiceType("testServiceType" + serviceSubscriptionCounter); + + return serviceSubscription; + } + + public Customer buildCustomer() { + customerCounter++; + + Customer customer = new Customer(); + customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter); + customer.setSubscriberType("testSubscriberType" + customerCounter); + + customer.setServiceSubscription(buildServiceSubscription()); + + return customer; + } + + public ServiceInstance buildServiceInstance() { + serviceInstanceCounter++; + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("testServiceInstanceId" + serviceInstanceCounter); + serviceInstance.setServiceInstanceName("testServiceInstanceName" + serviceInstanceCounter); + + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("testModelInvariantUUID" + serviceInstanceCounter); + modelInfoServiceInstance.setModelUuid("testModelUUID" + serviceInstanceCounter); + modelInfoServiceInstance.setModelVersion("testModelVersion" + serviceInstanceCounter); + modelInfoServiceInstance.setModelName("testModelName" + serviceInstanceCounter); + modelInfoServiceInstance.setServiceType("testServiceType" + serviceInstanceCounter); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + serviceInstance.setProject(buildProject()); + + serviceInstance.setOwningEntity(buildOwningEntity()); + + serviceInstance.setCollection(buildCollection()); + + serviceInstance.getConfigurations().add(buildConfiguration()); + + return serviceInstance; + } + + public ServiceInstance setServiceInstance() { + ServiceInstance serviceInstance = buildServiceInstance(); + + if(gBBInput.getCustomer() == null) { + gBBInput.setCustomer(buildCustomer()); + } + gBBInput.getCustomer().getServiceSubscription().getServiceInstances().add(serviceInstance); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId()); + + return serviceInstance; + } + + public Customer setCustomer() { + if(gBBInput.getCustomer() != null) return gBBInput.getCustomer(); + Customer customer = new Customer(); + customer.setGlobalCustomerId("testGlobalCustomerId"); + customer.setSubscriberType("testSubscriberType"); + + customer.setServiceSubscription(buildServiceSubscription()); + + gBBInput.setCustomer(customer); + + return customer; + } + + public Collection setCollection() { + Collection collection = new Collection(); + collection.setId("testId"); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.setCollection(collection); + + return collection; + } + + public InstanceGroup setInstanceGroup() { + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId("testId"); + instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction"); + + Collection collection = null; + + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + collection = serviceInstance.getCollection(); + + if (collection == null) { + collection = setCollection(); + } + } catch(BBObjectNotFoundException e) { + collection = setCollection(); + } + + collection.setInstanceGroup(instanceGroup); + + return instanceGroup; + } + + public VpnBinding buildVpnBinding() { + vpnBindingCounter++; + + VpnBinding vpnBinding = new VpnBinding(); + vpnBinding.setVpnId("testVpnId" + vpnBindingCounter); + vpnBinding.setVpnName("testVpnName" + vpnBindingCounter); + vpnBinding.setCustomerVpnId("testCustomerVpnId" + vpnBindingCounter); + + return vpnBinding; + } + + public VpnBinding setVpnBinding() { + VpnBinding vpnBinding = buildVpnBinding(); + + Customer customer = gBBInput.getCustomer(); + + if(customer == null){ + customer = buildCustomer(); + } + + customer.getVpnBindings().add(vpnBinding); + lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId()); + + return vpnBinding; + } + + public InstanceGroup buildInstanceGroup() { + instanceGroupCounter++; + + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId("testId" + instanceGroupCounter); + instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter); + + return instanceGroup; + } + + public L3Network buildL3Network() { + l3NetworkCounter++; + + L3Network network = new L3Network(); + network.setNetworkId("testNetworkId" + l3NetworkCounter); + network.setNetworkName("testNetworkName" + l3NetworkCounter); + network.setNetworkType("testNetworkType" + l3NetworkCounter); + + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + modelInfoNetwork.setModelInvariantUUID("testModelInvariantUUID" + l3NetworkCounter); + modelInfoNetwork.setModelName("testModelName" + l3NetworkCounter); + modelInfoNetwork.setModelVersion("testModelVersion" + l3NetworkCounter); + modelInfoNetwork.setModelUUID("testModelUUID" + l3NetworkCounter); + network.setModelInfoNetwork(modelInfoNetwork); + + return network; + } + + public L3Network setL3Network() { + L3Network network = buildL3Network(); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.getNetworks().add(network); + lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId()); + + return network; + } + + public GenericVnf buildGenericVnf() { + genericVnfCounter++; + + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId("testVnfId" + genericVnfCounter); + genericVnf.setVnfName("testVnfName" + genericVnfCounter); + genericVnf.setVnfType("testVnfType" + genericVnfCounter); + + Platform platform = new Platform(); + platform.setPlatformName("testPlatformName"); + genericVnf.setPlatform(platform); + + LineOfBusiness lob = new LineOfBusiness(); + lob.setLineOfBusinessName("testLineOfBusinessName"); + genericVnf.setLineOfBusiness(lob); + + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelName("testModelName" + genericVnfCounter); + modelInfoGenericVnf.setModelCustomizationUuid("testModelCustomizationUUID" + genericVnfCounter); + modelInfoGenericVnf.setModelInvariantUuid("testModelInvariantUUID" + genericVnfCounter); + modelInfoGenericVnf.setModelVersion("testModelVersion" + genericVnfCounter); + modelInfoGenericVnf.setModelUuid("testModelUUID" + genericVnfCounter); + genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + return genericVnf; + } + + public GenericVnf setGenericVnf() { + GenericVnf genericVnf = buildGenericVnf(); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.getVnfs().add(genericVnf); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId()); + + return genericVnf; + } + + public VfModule buildVfModule() { + vfModuleCounter++; + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter); + vfModule.setVfModuleName("testVfModuleName" + vfModuleCounter); + + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID" + vfModuleCounter); + modelInfoVfModule.setModelVersion("testModelVersion" + vfModuleCounter); + modelInfoVfModule.setModelUUID("testModelUUID" + vfModuleCounter); + modelInfoVfModule.setModelName("testModelName" + vfModuleCounter); + modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID" + vfModuleCounter); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + return vfModule; + } + + public VfModule setVfModule() { + VfModule vfModule = buildVfModule(); + + GenericVnf genericVnf = null; + + try { + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + } catch(BBObjectNotFoundException e) { + genericVnf = setGenericVnf(); + } + + genericVnf.getVfModules().add(vfModule); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId()); + + return vfModule; + } + + public VolumeGroup buildVolumeGroup() { + volumeGroupCounter++; + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("testVolumeGroupId" + volumeGroupCounter); + volumeGroup.setVolumeGroupName("testVolumeGroupName" + volumeGroupCounter); + volumeGroup.setHeatStackId("testHeatStackId" + volumeGroupCounter); + + return volumeGroup; + } + + public VolumeGroup setVolumeGroup() { + VolumeGroup volumeGroup = buildVolumeGroup(); + + GenericVnf genericVnf = null; + + try { + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + } catch(BBObjectNotFoundException e) { + genericVnf = setGenericVnf(); + } + + genericVnf.getVolumeGroups().add(volumeGroup); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); + + return volumeGroup; + } + + public Pnf buildPnf() { + pnfCounter++; + + Pnf pnf = new Pnf(); + pnf.setPnfId("testPnfId" + pnfCounter); + pnf.setPnfName("testPnfName" + pnfCounter); + + return pnf; + } + + public ServiceProxy buildServiceProxy() { + serviceProxyCounter++; + + ServiceProxy serviceProxy = new ServiceProxy(); + serviceProxy.setServiceInstance(buildServiceInstance()); + serviceProxy.getServiceInstance().getVnfs().add(buildGenericVnf()); + + Pnf primaryPnf = buildPnf(); + primaryPnf.setRole("Primary"); + serviceProxy.getServiceInstance().getPnfs().add(primaryPnf); + + Pnf secondaryPnf = buildPnf(); + secondaryPnf.setRole("Secondary"); + serviceProxy.getServiceInstance().getPnfs().add(secondaryPnf); + + return serviceProxy; + } + + public VpnBondingLink buildVpnBondingLink() { + vpnBondingLinkCounter++; + + VpnBondingLink vpnBondingLink = new VpnBondingLink(); + vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter); + + Configuration vnrConfiguration = buildConfiguration(); + vnrConfiguration.setNetwork(buildL3Network()); + vpnBondingLink.setVnrConfiguration(vnrConfiguration); + + vpnBondingLink.setVrfConfiguration(buildConfiguration()); + + vpnBondingLink.setInfrastructureServiceProxy(buildServiceProxy()); + + vpnBondingLink.setTransportServiceProxy(buildServiceProxy()); + + return vpnBondingLink; + } + + public VpnBondingLink setVpnBondingLink() { + VpnBondingLink vpnBondingLink = buildVpnBondingLink(); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.getVpnBondingLinks().add(vpnBondingLink); + lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId()); + + + return vpnBondingLink; + } + + public Customer setAvpnCustomer() { + Customer customer = buildCustomer(); + + gBBInput.setCustomer(customer); + + return customer; + } + + public ServiceProxy setServiceProxy(String uniqueIdentifier, String type) { + ServiceProxy serviceProxy = new ServiceProxy(); + serviceProxy.setId("testProxyId" + uniqueIdentifier); + serviceProxy.setType(type); + + ModelInfoServiceProxy modelInfo = new ModelInfoServiceProxy(); + modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier); + modelInfo.setModelName("testProxyModelName" + uniqueIdentifier); + modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier); + modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier); + + serviceProxy.setModelInfoServiceProxy(modelInfo); + + return serviceProxy; + } + + public AllottedResource setAllottedResource(String uniqueIdentifier) { + AllottedResource ar = new AllottedResource(); + ar.setId("testAllottedResourceId" + uniqueIdentifier); + + ModelInfoAllottedResource modelInfo = new ModelInfoAllottedResource(); + modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier); + modelInfo.setModelName("testProxyModelName" + uniqueIdentifier); + modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier); + modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier); + + ar.setModelInfoAllottedResource(modelInfo); + + return ar; + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java new file mode 100644 index 0000000000..a29df9cbcf --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java @@ -0,0 +1,64 @@ +/*- + * ============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; +import ch.vorburger.exec.ManagedProcessException; +import ch.vorburger.mariadb4j.DBConfigurationBuilder; +import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import javax.sql.DataSource; + +@Configuration +@Profile({"test"}) +public class EmbeddedMariaDbConfig { + + @Bean + MariaDB4jSpringService mariaDB4jSpringService() { + MariaDB4jSpringService service = new MariaDB4jSpringService(); + + + service.getConfiguration().addArg("--lower_case_table_names=1"); + return service; + } + + @Bean + DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService, + @Value("${mariaDB4j.databaseName}") String databaseName, + @Value("${spring.datasource.username}") String datasourceUsername, + @Value("${spring.datasource.password}") String datasourcePassword, + @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException { + //Create our database with default root user and no password + mariaDB4jSpringService.getDB().createDB(databaseName); + + DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration(); + + return DataSourceBuilder + .create() + .username(datasourceUsername) + .password(datasourcePassword) + .url(config.getURL(databaseName)) + .driverClassName(datasourceDriver) + .build(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/IntegrationTestSuite.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/IntegrationTestSuite.java new file mode 100644 index 0000000000..265b6615c0 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/IntegrationTestSuite.java @@ -0,0 +1,32 @@ +/*- + * ============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; +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses({"**/*IT.class"}) +public class IntegrationTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/SerializableChecker.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/SerializableChecker.java new file mode 100644 index 0000000000..97c17d5238 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/SerializableChecker.java @@ -0,0 +1,181 @@ +/*- + * ============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; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public final class SerializableChecker +{ + public static class SerializationFailure + { + private final String mContainingClass; + private final String mMemberName; + + public SerializationFailure(String inNonSerializableClass, String inMemberName) + { + mContainingClass = inNonSerializableClass; + mMemberName = inMemberName; + } + + public String getContainingClass() + { + return mContainingClass; + } + + public String getMemberName() + { + return mMemberName; + } + + public String getBadMemberString() + { + if (mMemberName == null) + return mContainingClass; + return mContainingClass + "." + mMemberName; + } + + @Override + public String toString() + { + return "SerializationFailure [mNonSerializableClass=" + mContainingClass + ", mMemberName=" + mMemberName + "]"; + } + } + + private static class SerializationCheckerData + { + private Set> mSerializableClasses; + + SerializationCheckerData() + { + mSerializableClasses = new HashSet>(); + } + + boolean isAlreadyChecked(Class inClass) + { + return mSerializableClasses.contains(inClass); + } + + void addSerializableClass(Class inClass) + { + mSerializableClasses.add(inClass); + } + } + + private SerializableChecker() + { } + + public static SerializationFailure isFullySerializable(Class inClass) + { + if (!isSerializable(inClass)) + return new SerializationFailure(inClass.getName(), null); + + return isFullySerializable(inClass, new SerializationCheckerData()); + } + + private static SerializationFailure isFullySerializable(Class inClass, SerializationCheckerData inSerializationCheckerData) + { + for (Field field : declaredFields(inClass)) + { + Class fieldDeclaringClass = field.getType(); + + if (field.getType() == Object.class) + continue; + + if (Modifier.isStatic(field.getModifiers())) + continue; + + if (field.isSynthetic()) + continue; + + if (fieldDeclaringClass.isInterface() || fieldDeclaringClass.isPrimitive()) + continue; + + if (Modifier.isAbstract(field.getType().getModifiers())) + continue; + + if (inSerializationCheckerData.isAlreadyChecked(fieldDeclaringClass)) + continue; + + if (isSerializable(fieldDeclaringClass)) + { + inSerializationCheckerData.addSerializableClass(inClass); + + SerializationFailure failure = isFullySerializable(field.getType(), inSerializationCheckerData); + if (failure != null) + return failure; + else + continue; + } + + if (Modifier.isTransient(field.getModifiers())) + continue; + + return new SerializationFailure(field.getDeclaringClass().getName(), field.getName()); + } + return null; + } + + private static boolean isSerializable(Class inClass) + { + Set> interfaces = getInterfaces(inClass); + if (interfaces == null) + return false; + boolean isSerializable = interfaces.contains(Serializable.class); + if (isSerializable) + return true; + + for (Class classInterface : interfaces) + { + if (isSerializable(classInterface)) + return true; + } + + if (inClass.getSuperclass() != null && isSerializable(inClass.getSuperclass())) + return true; + + return false; + } + + private static Set> getInterfaces(Class inFieldDeclaringClass) + { + return new HashSet>(Arrays.asList(inFieldDeclaringClass.getInterfaces())); + } + + private static List declaredFields(Class inClass) + { + List fields = new ArrayList(Arrays.asList(inClass.getDeclaredFields())); + + Class parentClasses = inClass.getSuperclass(); + + if (parentClasses == null) + return fields; + fields.addAll(declaredFields(parentClasses)); + + return fields; + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java new file mode 100644 index 0000000000..314cc0b2de --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.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; + +import java.io.IOException; + +import javax.annotation.PreDestroy; + +import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; +import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; +import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; +import org.onap.so.requestsdb.RequestsDBHelper; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.ComponentScan.Filter; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.Profile; + +import ch.vorburger.mariadb4j.MariaDB4jService; + +@SpringBootApplication +@Profile("test") +@EnableProcessApplication("MSO CommonBPMN Test Application") +@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) +public class TestApplication { + public static void main(String... args) { + SpringApplication.run(TestApplication.class, args); + System.getProperties().setProperty("mso.db", "MARIADB"); + System.getProperties().setProperty("server.name", "Springboot"); + + + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java new file mode 100644 index 0000000000..f6d81ba771 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java @@ -0,0 +1,245 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.extension.mockito.mock.FluentJavaDelegateMock; +import org.camunda.bpm.model.bpmn.Bpmn; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.camunda.bpm.model.bpmn.builder.ServiceTaskBuilder; +import org.junit.After; +import org.junit.Before; +import org.junit.runner.RunWith; +import org.onap.so.TestApplication; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.infrastructure.aai.tasks.AAICommonTasks; +import org.onap.so.bpmn.infrastructure.aai.tasks.AAICreateTasks; +import org.onap.so.bpmn.infrastructure.aai.tasks.AAIDeleteTasks; +import org.onap.so.bpmn.infrastructure.aai.tasks.AAIQueryTasks; +import org.onap.so.bpmn.infrastructure.aai.tasks.AAIUpdateTasks; +import org.onap.so.bpmn.infrastructure.adapter.network.tasks.NetworkAdapterCreateTasks; +import org.onap.so.bpmn.infrastructure.adapter.network.tasks.NetworkAdapterDeleteTasks; +import org.onap.so.bpmn.infrastructure.adapter.network.tasks.NetworkAdapterUpdateTasks; +import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterCreateTasks; +import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterDeleteTasks; +import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterImpl; +import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetwork; +import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils; +import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignVnf; +import org.onap.so.bpmn.infrastructure.flowspecific.tasks.CreateNetwork; +import org.onap.so.bpmn.infrastructure.flowspecific.tasks.CreateNetworkCollection; +import org.onap.so.bpmn.infrastructure.flowspecific.tasks.UnassignNetworkBB; +import org.onap.so.bpmn.infrastructure.flowspecific.tasks.UnassignVnf; +import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCActivateTasks; +import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCAssignTasks; +import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCChangeAssignTasks; +import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCDeactivateTasks; +import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCQueryTasks; +import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCUnassignTasks; +import org.onap.so.bpmn.infrastructure.workflow.tasks.OrchestrationStatusValidator; +import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowAction; +import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBTasks; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; +import org.onap.so.bpmn.servicedecomposition.tasks.ExecuteBuildingBlockRainyDay; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.embedded.LocalServerPort; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.HttpHeaders; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public abstract class BaseBPMNTest { + @Autowired + protected RuntimeService runtimeService; + + @Autowired + private RepositoryService repositoryService; + + protected Map variables = new HashMap<>(); + + protected List mockedSubprocessList = new ArrayList<>(); + + protected TestRestTemplate restTemplate = new TestRestTemplate(); + + protected HttpHeaders headers = new HttpHeaders(); + + @MockBean + protected AAIUpdateTasks aaiUpdateTasks; + + @MockBean + protected AAICreateTasks aaiCreateTasks; + + @MockBean + protected AAIQueryTasks aaiQueryTasks; + + @MockBean + protected AAIDeleteTasks aaiDeleteTasks; + + @MockBean + protected SDNCActivateTasks sdncActivateTasks; + + @MockBean + protected SDNCAssignTasks sdncAssignTasks; + + @MockBean + protected SDNCUnassignTasks sdncUnassignTasks; + + @MockBean + protected SDNCDeactivateTasks sdncDeactivateTasks; + + @MockBean + protected SDNCQueryTasks sdncQueryTasks; + + @MockBean + protected SDNCChangeAssignTasks sdncChangeAssignTasks; + + @MockBean + protected NetworkAdapterDeleteTasks networkAdapterDeleteTasks; + + @MockBean + protected NetworkAdapterUpdateTasks networkAdapterUpdateTasks; + + @MockBean + protected VnfAdapterCreateTasks vnfAdapterCreateTasks; + + @MockBean + protected NetworkAdapterCreateTasks networkAdapterCreateTasks; + + @MockBean + protected CreateNetwork createNetwork; + + @MockBean + protected AssignNetworkBBUtils assignNetworkBBUtils; + + @MockBean + protected AssignNetwork assignNetwork; + + @MockBean + protected CreateNetworkCollection createNetworkCollection; + + @MockBean + protected VnfAdapterDeleteTasks vnfAdapterDeleteTasks; + + @MockBean + protected AAICommonTasks aaiCommonTasks; + + @MockBean + protected AssignVnf assignVnf; + + @MockBean + protected UnassignVnf unassignVnf; + + @MockBean + protected VnfAdapterImpl vnfAdapterImpl; + + @MockBean + protected UnassignNetworkBB unassignNetworkBB; + + @MockBean + protected OrchestrationStatusValidator orchestrationStatusValidator; + + @MockBean + protected BBInputSetup bbInputSetup; + + @MockBean + protected BBInputSetupUtils bbInputSetupUtils; + + @MockBean + protected ExecuteBuildingBlockRainyDay executeBuildingBlockRainyDay; + + @MockBean + protected WorkflowAction workflowAction; + + @MockBean + protected WorkflowActionBBTasks workflowActionBBTasks; + + @LocalServerPort + private int port; + + protected String createURLWithPort(String uri) { + return "http://localhost:" + port + uri; + } + + @Before + public void baseBefore() { + variables.put("gBuildingBlockExecution", new DelegateExecutionImpl(new HashMap<>())); + } + + @After + public void baseAfter() { + for (String deploymentId : mockedSubprocessList) { + repositoryService.deleteDeployment(deploymentId); + } + mockedSubprocessList.clear(); + } + + /** + * Create and deploy a process model with one logger delegate as service task. + * + * @param origProcessKey + * key to call + * @param mockProcessName + * process name + * @param fileName + * file name without extension + */ + protected void mockSubprocess(String origProcessKey, String mockProcessName, String fileName) { + mockSubprocess(origProcessKey, mockProcessName, fileName, new HashMap()); + } + + /** + * Create and deploy a process model with one logger delegate as service task. + * + * @param origProcessKey + * key to call + * @param mockProcessName + * process name + * @param fileName + * file name without extension + * @param outParam + * output parameters + */ + protected void mockSubprocess(String origProcessKey, String mockProcessName, String fileName, Map outParam) { + ServiceTaskBuilder builder = Bpmn + .createExecutableProcess(origProcessKey).name(mockProcessName) + .startEvent().name("Start_Event") + .serviceTask().name("Mock_Delegate") + .camundaClass(FluentJavaDelegateMock.class); + + for (String key : outParam.keySet()) { + builder.camundaOutputParameter(key, outParam.get(key)); + } + + BpmnModelInstance modelInstance = builder.endEvent().name("End_Event").done(); + mockedSubprocessList.add(repositoryService.createDeployment().addModelInstance(fileName + ".bpmn", modelInstance).deploy().getId()); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2BBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2BBTest.java new file mode 100644 index 0000000000..c05d42c420 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2BBTest.java @@ -0,0 +1,74 @@ +/*- + * ============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.bpmn.buildingblock; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.bpmn.buildingblock.SniroHomingV2; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.springframework.boot.test.mock.mockito.MockBean; + + +@Ignore //these test run locally but fail when ran in conjunction with others in jenkins +public class SniroHomingV2BBTest extends BaseTest{ + + @MockBean + protected SniroHomingV2 sniroHoming; + + @Test + public void testHomingV2_success(){ + mockSubprocess("ReceiveWorkflowMessage", "Mock ReceiveWorkflowMessage", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("HomingV2", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("start", "callSniro", "callReceiveAsync", "processSolution", "end"); + assertThat(pi).isEnded(); + } + + @Test + public void testHomingV2_error_bpmnError(){ + doThrow(new BpmnError("MSOWorkflowException")).when(sniroHoming).callSniro(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("HomingV2", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("start", "catchBpmnError", "processBpmnError", "endBpmnError") + .hasNotPassed("callReceiveAsync"); + assertThat(pi).isEnded(); + } + + @Test + public void testHomingV2_error_javaException(){ + doThrow(new RuntimeException("Test")).when(sniroHoming).callSniro(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("HomingV2", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("start", "catchJavaException", "processJavaException", "endJavaException") + .hasNotPassed("callReceiveAsync"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2Test.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2Test.java new file mode 100644 index 0000000000..bed591500a --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2Test.java @@ -0,0 +1,498 @@ +/*- + * ============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.bpmn.buildingblock; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.json.JSONArray; +import org.json.JSONObject; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.onap.so.BaseTest; +import org.onap.so.bpmn.mock.FileUtil; +import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.bpmn.servicedecomposition.homingobjects.Candidate; +import org.onap.so.bpmn.servicedecomposition.homingobjects.CandidateType; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.sniro.beans.SniroManagerRequest; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + + +public class SniroHomingV2Test extends BaseTest{ + + private ServiceInstance serviceInstance; + + private RequestContext requestContext; + + private Customer customer; + ObjectMapper mapper = new ObjectMapper(); + + private static final String RESOURCE_PATH = "__files/BuildingBlocks/SniroHoming/"; + + + String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"corys cool\", \"requestStatus\": \"accepted\"}"; + + @Before + public void before() { + serviceInstance = setServiceInstance(); + customer = setCustomer(); + customer.setGlobalCustomerId("testCustomerId"); + customer.setSubscriberName("testCustomerName"); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + requestContext = setRequestContext(); + requestContext.setMsoRequestId("testRequestId"); + RequestParameters params = new RequestParameters(); + params.setaLaCarte(false); + params.setSubscriptionServiceType("iptollfree"); + requestContext.setRequestParameters(params); + } + + public void beforeVpnBondingLink(String id){ + VpnBondingLink bondingLink = new VpnBondingLink(); + bondingLink.setVpnBondingLinkId("testVpnBondingId" + id); + bondingLink.getServiceProxies().add(setServiceProxy("1", "transport")); + ServiceProxy sp2 = setServiceProxy("2", "infrastructure"); + Candidate requiredCandidate = new Candidate(); + requiredCandidate.setCandidateType(CandidateType.VNF_ID); + List c = new ArrayList(); + c.add("testVnfId"); + requiredCandidate.setCandidates(c); + sp2.addRequiredCandidates(requiredCandidate); + bondingLink.getServiceProxies().add(sp2); + serviceInstance.getVpnBondingLinks().add(bondingLink); + + } + + public void beforeAllottedResource(){ + serviceInstance.getAllottedResources().add(setAllottedResource("1")); + serviceInstance.getAllottedResources().add(setAllottedResource("2")); + serviceInstance.getAllottedResources().add(setAllottedResource("3")); + } + + public void beforeVnf(){ + setGenericVnf(); + } + + @Test(expected = Test.None.class) + public void testCallSniro_success_1VpnLink() throws BadResponseException, IOException{ + beforeVpnBondingLink("1"); + + stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + sniroHoming.callSniro(execution); + + String request = FileUtil.readResourceFile(RESOURCE_PATH + "SniroManagerRequest1Vpn.json"); + request = request.replace("28080", wireMockPort); + + ArgumentCaptor argument = ArgumentCaptor.forClass(SniroManagerRequest.class); + verify(sniroClient, times(1)).postDemands(argument.capture()); + assertEquals(request, argument.getValue().toJsonString()); + } + + @Test + public void testCallSniro_success_3VpnLink() throws JsonProcessingException, BadResponseException{ + beforeVpnBondingLink("1"); + beforeVpnBondingLink("2"); + beforeVpnBondingLink("3"); + + stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + sniroHoming.callSniro(execution); + + String request = FileUtil.readResourceFile(RESOURCE_PATH + "SniroManagerRequest3Vpn.json"); + request = request.replace("28080", wireMockPort); + + ArgumentCaptor argument = ArgumentCaptor.forClass(SniroManagerRequest.class); + verify(sniroClient, times(1)).postDemands(argument.capture()); + assertEquals(request, argument.getValue().toJsonString()); + } + + @Test + public void testCallSniro_success_3Allotteds() throws BadResponseException, JsonProcessingException{ + beforeAllottedResource(); + + stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + sniroHoming.callSniro(execution); + + String request = FileUtil.readResourceFile(RESOURCE_PATH + "SniroManagerRequest3AR.json"); + request = request.replace("28080", wireMockPort); + + ArgumentCaptor argument = ArgumentCaptor.forClass(SniroManagerRequest.class); + verify(sniroClient, times(1)).postDemands(argument.capture()); + assertEquals(request, argument.getValue().toJsonString()); + } + + @Test + public void testCallSniro_success_1Vnf() throws JsonProcessingException, BadResponseException{ + beforeVnf(); + + stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + sniroHoming.callSniro(execution); + + ArgumentCaptor argument = ArgumentCaptor.forClass(SniroManagerRequest.class); + verify(sniroClient, times(1)).postDemands(argument.capture()); + //TODO assertEquals(request, argument.getValue().toJsonString()); + } + + @Test + public void testCallSniro_success_3Allotteds1Vnf() throws JsonProcessingException, BadResponseException{ + beforeAllottedResource(); + beforeVnf(); + + stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + sniroHoming.callSniro(execution); + + verify(sniroClient, times(1)).postDemands(isA(SniroManagerRequest.class)); + } + + @Test(expected = Test.None.class) + public void testProcessSolution_success_1VpnLink_1Solution(){ + beforeVpnBondingLink("1"); + + JSONObject asyncResponse = new JSONObject(); + asyncResponse.put("transactionId", "testRequestId").put("requestId", "testRequestId").put("requestState", "completed"); + JSONArray solution1 = new JSONArray(); + solution1.put(new JSONObject().put("serviceResourceId", "testProxyId1").put("inventoryType", "service").put("solution", new JSONObject() + .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId1"))) + .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")) + .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName1")) + .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli1")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) + .put(new JSONObject().put("key", "vnfId").put("value", "testVnfId1")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testSloudRegionId1")))); + solution1.put(new JSONObject().put("serviceResourceId", "testProxyId2").put("inventoryType", "service").put("solution", new JSONObject() + .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId2"))) + .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")) + .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "primaryPnfName").put("value", "testPrimaryPnfName2")) + .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli2")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) + .put(new JSONObject().put("key", "secondaryPnfName").put("value", "testSecondaryPnfName2")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testSloudRegionId2")))); + + asyncResponse.put("solutions", new JSONObject().put("placementSolutions", new JSONArray().put(solution1)).put("licenseSolutions", new JSONArray())); + + sniroHoming.processSolution(execution, asyncResponse.toString()); + + ServiceInstance si = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0); + + assertFalse(si.getVpnBondingLinks().isEmpty()); + VpnBondingLink link = si.getVpnBondingLinks().get(0); + assertNotNull(link); + assertFalse(link.getServiceProxies().isEmpty()); + + assertEquals("testServiceInstanceId1", link.getServiceProxy("testProxyId1").getServiceInstance().getServiceInstanceId()); + assertNotNull(link.getServiceProxy("testProxyId1").getServiceInstance().getSolutionInfo()); + assertEquals("testVnfHostName1", link.getServiceProxy("testProxyId1").getServiceInstance().getVnfs().get(0).getVnfName()); + + assertEquals("testServiceInstanceId2", link.getServiceProxy("testProxyId2").getServiceInstance().getServiceInstanceId()); + assertNotNull(link.getServiceProxy("testProxyId2").getServiceInstance().getSolutionInfo()); + assertFalse(link.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().isEmpty()); + assertEquals("testPrimaryPnfName2", link.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(0).getPnfName()); + assertEquals("primary", link.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(0).getRole()); + assertEquals("testSecondaryPnfName2", link.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(1).getPnfName()); + assertEquals("secondary", link.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(1).getRole()); + } + + @Test + public void testProcessSolution_success_1VpnLink_2Solutions(){ + beforeVpnBondingLink("1"); + + JSONObject asyncResponse = new JSONObject(); + asyncResponse.put("transactionId", "testRequestId").put("requestId", "testRequestId").put("requestState", "completed"); + JSONArray solution1 = new JSONArray(); + solution1.put(new JSONObject().put("serviceResourceId", "testProxyId1").put("inventoryType", "service").put("solution", new JSONObject() + .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId1"))) + .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")) + .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName1")) + .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli1")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) + .put(new JSONObject().put("key", "vnfId").put("value", "testVnfId1")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testSloudRegionId1")))); + solution1.put(new JSONObject().put("serviceResourceId", "testProxyId2").put("inventoryType", "service").put("solution", new JSONObject() + .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId2"))) + .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")) + .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "primaryPnfName").put("value", "testPrimaryPnfName2")) + .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli2")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) + .put(new JSONObject().put("key", "secondaryPnfName").put("value", "testSecondaryPnfName2")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testSloudRegionId2")))); + + JSONArray solution2 = new JSONArray(); + solution2.put(new JSONObject().put("serviceResourceId", "testProxyId1").put("inventoryType", "service").put("solution", new JSONObject() + .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId3"))) + .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")) + .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName3")) + .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli3")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) + .put(new JSONObject().put("key", "vnfId").put("value", "testVnfId3")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testSloudRegionId3")))); + solution2.put(new JSONObject().put("serviceResourceId", "testProxyId2").put("inventoryType", "service").put("solution", new JSONObject() + .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId4"))) + .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")) + .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "primaryPnfName").put("value", "testPrimaryPnfName4")) + .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli4")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) + .put(new JSONObject().put("key", "secondaryPnfName").put("value", "testSecondaryPnfName4")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testSloudRegionId4")))); + + asyncResponse.put("solutions", new JSONObject().put("placementSolutions", new JSONArray().put(solution1).put(solution2)).put("licenseSolutions", new JSONArray())); + + sniroHoming.processSolution(execution, asyncResponse.toString()); + + ServiceInstance si = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0); + + assertFalse(si.getVpnBondingLinks().isEmpty()); + VpnBondingLink link = si.getVpnBondingLinks().get(0); + VpnBondingLink link2 = si.getVpnBondingLinks().get(1); + assertNotNull(link); + assertFalse(link.getServiceProxies().isEmpty()); + + assertEquals("testServiceInstanceId1", link.getServiceProxy("testProxyId1").getServiceInstance().getServiceInstanceId()); + assertNotNull(link.getServiceProxy("testProxyId1").getServiceInstance().getSolutionInfo()); + assertEquals("testVnfHostName1", link.getServiceProxy("testProxyId1").getServiceInstance().getVnfs().get(0).getVnfName()); + + assertEquals("testServiceInstanceId2", link.getServiceProxy("testProxyId2").getServiceInstance().getServiceInstanceId()); + assertNotNull(link.getServiceProxy("testProxyId2").getServiceInstance().getSolutionInfo()); + assertFalse(link.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().isEmpty()); + assertEquals("testPrimaryPnfName2", link.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(0).getPnfName()); + assertEquals("primary", link.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(0).getRole()); + assertEquals("testSecondaryPnfName2", link.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(1).getPnfName()); + assertEquals("secondary", link.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(1).getRole()); + + assertNotNull(link2); + assertFalse(link2.getServiceProxies().isEmpty()); + + assertEquals("testServiceInstanceId3", link2.getServiceProxy("testProxyId1").getServiceInstance().getServiceInstanceId()); + assertNotNull(link2.getServiceProxy("testProxyId1").getServiceInstance().getSolutionInfo()); + assertEquals("testVnfHostName3", link2.getServiceProxy("testProxyId1").getServiceInstance().getVnfs().get(0).getVnfName()); + + assertEquals("testServiceInstanceId4", link2.getServiceProxy("testProxyId2").getServiceInstance().getServiceInstanceId()); + assertNotNull(link2.getServiceProxy("testProxyId2").getServiceInstance().getSolutionInfo()); + assertFalse(link2.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().isEmpty()); + assertEquals("testPrimaryPnfName4", link2.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(0).getPnfName()); + assertEquals("primary", link2.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(0).getRole()); + assertEquals("testSecondaryPnfName4", link2.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(1).getPnfName()); + assertEquals("secondary", link2.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(1).getRole()); + + } + + @Test + public void testProcessSolution_success_3VpnLink_2Solutions(){ + //TODO + } + + @Test + public void testProcessSolution_success_3Allotteds_1Solution(){ + beforeAllottedResource(); + + JSONObject asyncResponse = new JSONObject(); + asyncResponse.put("transactionId", "testRequestId").put("requestId", "testRequestId").put("requestState", "completed"); + JSONArray solution1 = new JSONArray(); + solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId1").put("inventoryType", "service").put("solution", new JSONObject() + .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId1"))) + .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "True")) + .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName1")) + .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli1")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) + .put(new JSONObject().put("key", "vnfId").put("value", "testVnfId1")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testCloudRegionId1")))); + solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId2").put("inventoryType", "service").put("solution", new JSONObject() + .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId2"))) + .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "True")) + .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName2")) + .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli2")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) + .put(new JSONObject().put("key", "vnfId").put("value", "testVnfId1")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testCloudRegionId2")))); + solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId3").put("inventoryType", "cloud").put("solution", new JSONObject() + .put("identifierType", "cloudRegionId").put("identifiers", new JSONArray().put("testCloudRegionId3"))) + .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "True")) + .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")) + .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli2")).put(new JSONObject().put("key", "aicVersion").put("value", "3")))); + + asyncResponse.put("solutions", new JSONObject().put("placementSolutions", new JSONArray().put(solution1)).put("licenseSolutions", new JSONArray())); + + sniroHoming.processSolution(execution, asyncResponse.toString()); + + ServiceInstance si = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0); + + assertFalse(si.getAllottedResources().isEmpty()); + AllottedResource ar = si.getAllottedResources().get(0); + assertNotNull(ar); + assertEquals("testServiceInstanceId1", ar.getParentServiceInstance().getServiceInstanceId()); + assertNotNull(ar.getParentServiceInstance().getSolutionInfo()); + assertEquals("testVnfHostName1", ar.getParentServiceInstance().getVnfs().get(0).getVnfName()); + + AllottedResource ar2 = si.getAllottedResources().get(1); + assertNotNull(ar2); + assertEquals("testServiceInstanceId2", ar2.getParentServiceInstance().getServiceInstanceId()); + assertNotNull(ar2.getParentServiceInstance().getSolutionInfo()); + assertEquals("testVnfHostName2", ar2.getParentServiceInstance().getVnfs().get(0).getVnfName()); + + AllottedResource ar3 = si.getAllottedResources().get(2); + assertNotNull(ar3); + assertNotNull(ar3.getParentServiceInstance().getSolutionInfo()); + assertEquals("testCloudRegionId3", ar3.getParentServiceInstance().getSolutionInfo().getTargetedCloudRegion().getLcpCloudRegionId()); + } + + @Test + public void testProcessSolution_success_3Allotteds1Vnf_1Solution(){ + beforeVnf(); + beforeAllottedResource(); + + JSONObject asyncResponse = new JSONObject(); + asyncResponse.put("transactionId", "testRequestId").put("requestId", "testRequestId").put("requestState", "completed"); + JSONArray solution1 = new JSONArray(); + JSONArray licenseSolution = new JSONArray(); + solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId1").put("inventoryType", "service").put("solution", new JSONObject() + .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId1"))) + .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "True")) + .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName1")) + .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli1")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) + .put(new JSONObject().put("key", "vnfId").put("value", "testVnfId1")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testCloudRegionId1")))); + solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId2").put("inventoryType", "service").put("solution", new JSONObject() + .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId2"))) + .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "True")) + .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName2")) + .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli2")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) + .put(new JSONObject().put("key", "vnfId").put("value", "testVnfId1")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testCloudRegionId2")))); + solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId3").put("inventoryType", "cloud").put("solution", new JSONObject() + .put("identifierType", "cloudRegionId").put("identifiers", new JSONArray().put("testCloudRegionId3"))) + .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "True")) + .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "aicClli").put("value", "testAicClli2")) + .put(new JSONObject().put("key", "aicVersion").put("value", "3")))); + + licenseSolution.put( + new JSONObject().put("serviceResourceId", "testVnfId1").put("entitlementPoolUUID", new JSONArray().put("f1d563e8-e714-4393-8f99-cc480144a05e").put("j1d563e8-e714-4393-8f99-cc480144a05e")) + .put("licenseKeyGroupUUID", new JSONArray().put("s1d563e8-e714-4393-8f99-cc480144a05e").put("b1d563e8-e714-4393-8f99-cc480144a05e"))); + + asyncResponse.put("solutions", new JSONObject().put("placementSolutions", new JSONArray().put(solution1)).put("licenseSolutions", licenseSolution)); + + sniroHoming.processSolution(execution, asyncResponse.toString()); + + ServiceInstance si = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0); + + assertFalse(si.getAllottedResources().isEmpty()); + AllottedResource ar = si.getAllottedResources().get(0); + assertNotNull(ar); + assertEquals("testServiceInstanceId1", ar.getParentServiceInstance().getServiceInstanceId()); + assertNotNull(ar.getParentServiceInstance().getSolutionInfo()); + assertEquals("testVnfHostName1", ar.getParentServiceInstance().getVnfs().get(0).getVnfName()); + + AllottedResource ar2 = si.getAllottedResources().get(1); + assertNotNull(ar2); + assertEquals("testServiceInstanceId2", ar2.getParentServiceInstance().getServiceInstanceId()); + assertNotNull(ar2.getParentServiceInstance().getSolutionInfo()); + assertEquals("testVnfHostName2", ar2.getParentServiceInstance().getVnfs().get(0).getVnfName()); + + AllottedResource ar3 = si.getAllottedResources().get(2); + assertNotNull(ar3); + assertNotNull(ar3.getParentServiceInstance().getSolutionInfo()); + assertEquals("testCloudRegionId3", ar3.getParentServiceInstance().getSolutionInfo().getTargetedCloudRegion().getLcpCloudRegionId()); + + GenericVnf vnf = si.getVnfs().get(0); + assertNotNull(vnf); + assertNotNull(vnf.getLicense()); + assertEquals(2, vnf.getLicense().getEntitlementPoolUuids().size()); + assertEquals("s1d563e8-e714-4393-8f99-cc480144a05e", vnf.getLicense().getLicenseKeyGroupUuids().get(0)); + + } + + @Test + public void testProcessSolution_success_1Vnf_1Solution(){ + beforeVnf(); + + JSONObject asyncResponse = new JSONObject(); + asyncResponse.put("transactionId", "testRequestId").put("requestId", "testRequestId").put("requestState", "completed"); + JSONArray licenseSolution = new JSONArray(); + + licenseSolution.put( + new JSONObject().put("serviceResourceId", "testVnfId1").put("entitlementPoolUUID", new JSONArray().put("f1d563e8-e714-4393-8f99-cc480144a05e").put("j1d563e8-e714-4393-8f99-cc480144a05e")) + .put("licenseKeyGroupUUID", new JSONArray().put("s1d563e8-e714-4393-8f99-cc480144a05e").put("b1d563e8-e714-4393-8f99-cc480144a05e"))); + + asyncResponse.put("solutions", new JSONObject().put("licenseSolutions", licenseSolution)); + + sniroHoming.processSolution(execution, asyncResponse.toString()); + + ServiceInstance si = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0); + + GenericVnf vnf = si.getVnfs().get(0); + assertNotNull(vnf); + assertNotNull(vnf.getLicense()); + assertEquals(2, vnf.getLicense().getEntitlementPoolUuids().size()); + assertEquals(2, vnf.getLicense().getLicenseKeyGroupUuids().size()); + assertEquals("f1d563e8-e714-4393-8f99-cc480144a05e", vnf.getLicense().getEntitlementPoolUuids().get(0)); + assertEquals("s1d563e8-e714-4393-8f99-cc480144a05e", vnf.getLicense().getLicenseKeyGroupUuids().get(0)); + + + } + + @Test(expected = BpmnError.class) + public void testCallSniro_error_0Resources() throws BadResponseException, JsonProcessingException{ + + sniroHoming.callSniro(execution); + + verify(sniroClient, times(0)).postDemands(isA(SniroManagerRequest.class)); + } + + @Test(expected = BpmnError.class) + public void testCallSniro_error_badResponse() throws BadResponseException, JsonProcessingException{ + beforeAllottedResource(); + + mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"\", \"requestStatus\": \"failed\"}"; + stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + sniroHoming.callSniro(execution); + + verify(sniroClient, times(1)).postDemands(isA(SniroManagerRequest.class)); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java new file mode 100644 index 0000000000..793a8c04e3 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.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.bpmn.common; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import java.io.IOException; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseTest; + +public class AAICheckVnfInMaintBBTest extends BaseTest{ + + @Ignore + @Test + public void sunnyDayAAICheckVnfInMaintBBTest() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AAICheckVnfInMaintBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_AAICheckVnfInMaintBB", "Task_CheckVnfInMaint", "End_AAICheckVnfInMaintBB"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayAAISetVnfInMaintBBTest() { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks).checkVnfInMaintFlag(any(BuildingBlockExecution.class)); + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("AAICheckVnfInMaintBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted() + .hasPassedInOrder("Start_AAICheckVnfInMaintBB", "Task_CheckVnfInMaint") + .hasNotPassed("End_AAICheckVnfInMaintBB"); + assertThat(processInstance).isEnded(); + } + + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.java new file mode 100644 index 0000000000..890fd6b224 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.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.bpmn.common; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import java.io.IOException; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseTest; + +public class AAISetVnfInMaintBBTest extends BaseTest { + + @Ignore + @Test + public void sunnyDayAAISetVnfInMaintBBTest() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AAISetVnfInMaintBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_AAISetVnfInMaintBB", "Task_SetInMaint", "End_AAISetVnfInMaintBB"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayAAISetVnfInMaintBBTest() { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks).modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class)); + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("AAISetVnfInMaintBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted() + .hasPassedInOrder("Start_AAISetVnfInMaintBB", "Task_SetInMaint") + .hasNotPassed("End_AAISetVnfInMaintBB"); + assertThat(processInstance).isEnded(); + } + + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.java new file mode 100644 index 0000000000..c19919601d --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.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.bpmn.common; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import java.io.IOException; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseTest; + +public class AAIUnsetVnfInMaintBBTest extends BaseTest { + + @Test + @Ignore + public void sunnyDayAAISetVnftInMaintBBTest() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AAIUnsetVnfInMaintBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_AAIUnsetVnfInMaintBB", "Task_UnsetInMaint", "End_AAIUnsetVnfInMaintBB"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayAAISetVnfInMaintBBTest() { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks).modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class)); + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("AAIUnsetVnfInMaintBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted() + .hasPassedInOrder("Start_AAIUnsetVnfInMaintBB", "Task_UnsetInMaint") + .hasNotPassed("End_AAIUnsetVnfInMaintBB"); + assertThat(processInstance).isEnded(); + } + + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.java new file mode 100644 index 0000000000..f7c6852228 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.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.bpmn.common; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import java.io.IOException; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseTest; + +public class SDNOHealthCheckBBTest extends BaseTest { + + @Test + @Ignore + public void sunnyDaySDNOHealthCheckTest() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("SDNOVnfHealthCheckBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_SDNOHealthCheckBB", "Task_SDNOHealthCheck", "End_SDNOHealthCheckBB"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDaySDNOHealthCheckTest() { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdnoHealthCheckTasks).sdnoHealthCheck(any(BuildingBlockExecution.class)); + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("SDNOVnfHealthCheckBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted() + .hasPassedInOrder("Start_SDNOHealthCheckBB", "Task_SDNOHealthCheck") + .hasNotPassed("End_SDNOHealthCheckBB"); + assertThat(processInstance).isEnded(); + } + + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java new file mode 100644 index 0000000000..ee02f293f7 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java @@ -0,0 +1,143 @@ +/*- + * ============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.bpmn.infrastructure.bpmn.process; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; + +@Ignore +public class WorkflowActionBBTest extends BaseBPMNTest { + + @Test + public void sunnyDaySuccessIsTopLevelFlow() throws InterruptedException, IOException { + variables.put("isTopLevelFlow", true); + variables.put("completed", true); + + Map map = new HashMap<>(); + map.put("handlingCode", "Success"); + mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map); + mockSubprocess("CompleteMsoProcess", "Mocked CompleteMsoProcess", "GenericStub"); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SendSync", + "Task_SelectBB", "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowCompleted", "Task_SetupCompleteMsoProcess", "Call_CompleteMsoProcess", + "End_WorkflowActionBB"); + assertThat(pi).isEnded(); + } + + @Test + public void sunnyDaySuccessNotTopLevelFlow() throws InterruptedException, IOException { + variables.put("isTopLevelFlow", false); + variables.put("completed", true); + + Map map = new HashMap<>(); + map.put("handlingCode", "Success"); + mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", + "Task_SelectBB", "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowCompleted", "End_WorkflowActionBB"); + assertThat(pi).isEnded(); + } + + @Test + public void sunnyDayRollback() throws InterruptedException, IOException { + variables.put("isTopLevelFlow", false); + variables.put("isRollbackNeeded", false); + + Map map = new HashMap<>(); + map.put("handlingCode", "Rollback"); + mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", + "Task_SelectBB", "Call_ExecuteBB", "ExclusiveGateway_Finished", "Task_RollbackExecutionPath", "Task_UpdateRequestToFailed", "End_RollbackFailed"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayAbort() throws Exception { + variables.put("isTopLevelFlow", true); + variables.put("completed", false); + + Map map = new HashMap<>(); + map.put("handlingCode", "Abort"); + + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowActionBBTasks).abortCallErrorHandling(any(DelegateExecution.class)); + mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SendSync", + "Task_SelectBB", "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowAbort", "Task_AbortAndCallErrorHandling", "ErrorStart", + "Task_UpdateDb", "ErrorEnd"); + assertThat(pi).isEnded(); + } + + @Test + public void retrieveBBExecutionListerrorHandling() throws Exception { + variables.put("isTopLevelFlow", true); + variables.put("sentSyncResponse", false); + doThrow(new IllegalStateException("TESTING ERRORS")).when(workflowAction).selectExecutionList(any(DelegateExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "StartEvent_runtimeError", "ServiceTask_HandleRuntimeError", "EndEvent__runtimeError", "SubProcess_0rze15o"); + assertThat(pi).isEnded(); + } + + @Test + public void errorCatchSubprocessHandlingTest() throws Exception { + variables.put("isTopLevelFlow", true); + variables.put("sentSyncResponse", false); + doThrow(new IllegalStateException("TESTING ERRORS")).when(workflowAction).selectExecutionList(any(DelegateExecution.class)); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowAction).handleRuntimeException(any(DelegateExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "StartEvent_runtimeError", "ServiceTask_HandleRuntimeError", "SubProcess_0fuugr9", "ErrorStart", "ExclusiveGateway_10q79b6", "Task_SendSyncAckError", "Task_UpdateDb", "ErrorEnd", "SubProcess_18226x4"); + assertThat(pi).isEnded(); + } + + @Test + public void errorCatchBpmnSubprocessHandlingTest() throws Exception { + variables.put("isTopLevelFlow", true); + variables.put("sentSyncResponse", false); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowActionBBTasks).selectBB(any(DelegateExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList","ExclusiveGateway_isTopLevelFlow","Task_SendSync","Task_SelectBB", "ErrorStart", "ExclusiveGateway_10q79b6", "Task_SendSyncAckError", "Task_UpdateDb", "ErrorEnd", "SubProcess_18226x4"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java new file mode 100644 index 0000000000..da26b6e6a0 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class ActivateNetworkBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayActivateNetwork_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("activateNetwork_startEvent","Activate_Network_SDNC_ServiceTask","Activate_Network_AAI_ServiceTask","activateNetwork_EndEvent"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayActivateNetwork_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusActiveNetwork(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("activateNetwork_startEvent","Activate_Network_SDNC_ServiceTask","Activate_Network_AAI_ServiceTask") + .hasNotPassed("activateNetwork_EndEvent"); + assertThat(pi).isEnded().hasVariables("gBuildingBlockExecution"); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkCollectionBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkCollectionBBTest.java new file mode 100644 index 0000000000..00eaabbfc5 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkCollectionBBTest.java @@ -0,0 +1,52 @@ +/*- + * ============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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class ActivateNetworkCollectionBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayActivateNetworkCollection_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkCollectionBB",variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("activateNetworkCollection_startEvent","Activate_Network_Collection_AAI_ServiceTask","activateNetworkCollection_EndEvent"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayActivateNetworkCollection_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusActiveNetworkCollection(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkCollectionBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("activateNetworkCollection_startEvent") + .hasNotPassed("activateNetworkCollection_EndEvent"); + assertThat(pi).isEnded().hasVariables("gBuildingBlockExecution"); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateServiceInstanceBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateServiceInstanceBBTest.java new file mode 100644 index 0000000000..4739a56f07 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateServiceInstanceBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; + +import java.io.IOException; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; + +public class ActivateServiceInstanceBBTest extends BaseBPMNTest{ + + @Test + public void sunnyDaySDNC() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateServiceInstanceBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_ActivateServiceInstanceBB", "Task_NoOpServiceInstance", + "Task_UpdateServiceOrchestrationStatusToActive", "End_ActivateServiceInstanceBB"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java new file mode 100644 index 0000000000..dcf9d7f228 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import java.io.IOException; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class ActivateVfModuleBBTest extends BaseBPMNTest{ + @Test + public void sunnyDay() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("ActivateVfModuleBB_Start", "ActivateVfModule", + "UpdateVfModuleActiveStatus", "ActivateVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDay() throws Exception { + doThrow(BpmnError.class).when(aaiUpdateTasks).updateOrchestrationStatusActivateVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("ActivateVfModuleBB_Start", "ActivateVfModule", "UpdateVfModuleActiveStatus") + .hasNotPassed("ActivateVfModuleBB_End"); + assertThat(pi).isEnded().hasVariables("gBuildingBlockExecution"); + + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVnfBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVnfBBTest.java new file mode 100644 index 0000000000..0578286153 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVnfBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; + +import java.io.IOException; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; + +public class ActivateVnfBBTest extends BaseBPMNTest{ + @Test + public void sunnyDay() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_ActivateVnfBB", "Task_SDNCAdapterVnfTopologyActivate", + "Task_ActivateOrchestrationStatusVnf", "End_ActivateVnfBB"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVolumeGroupBBTest.java new file mode 100644 index 0000000000..7673652f48 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVolumeGroupBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class ActivateVolumeGroupBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayAssignVolumeGroup_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("ActivateVolumeGroupBB_Start", "ActivateVolumeGroup", "ActivateVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayAssignVolumeGroup_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusActiveVolumeGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("ActivateVolumeGroupBB_Start", "ActivateVolumeGroup") + .hasNotPassed("ActivateVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetwork1802BBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetwork1802BBTest.java new file mode 100644 index 0000000000..14cac8343e --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetwork1802BBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + + +public class AssignNetwork1802BBTest extends BaseBPMNTest{ + @Test + @Deployment(resources = { "subprocess/AssignNetworkRollbackBB.bpmn"}) + public void sunnyDayAssignNetwork_Test() throws InterruptedException { + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignNetwork1802BB",variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("AssignNetworkBB_start","ServiceTask_get_cloud_region","ServiceTask_assign_network_sdnc","ServiceTask_assign_network_aai","AssignNetworkBB_end"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayAssignNetwork_Test() throws Exception { + + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusAssignedNetwork(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignNetwork1802BB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("AssignNetworkBB_start", "ServiceTask_get_cloud_region", "ServiceTask_assign_network_sdnc", "ServiceTask_assign_network_aai") + .hasNotPassed("AssignNetworkBB_end"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetworkBBTest.java new file mode 100644 index 0000000000..1e66c55cb2 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetworkBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class AssignNetworkBBTest extends BaseBPMNTest{ + @Test + @Deployment(resources = { "subprocess/AssignNetworkRollbackBB.bpmn"}) + public void sunnyDayAssignNetwork_Test() throws InterruptedException { + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignNetworkBB",variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("AssignNetworkBB_start","networkFoundByName_ExclusiveGateway","ServiceTask_put_network_in_AAI","ServiceTask_connect_to_Tenant","ServiceTask_connect_to_CloudRegion","ServiceTask_connect_to_NCIG","ServiceTask_connect_to_NCSI","ServiceTask_get_cloud_region","ServiceTask_assign_network_sdnc","ServiceTask_assign_network_aai","AssignNetworkBB_end"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayAssignNetwork_Test() throws Exception { + + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusAssignedNetwork(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignNetworkBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("AssignNetworkBB_start", "networkFoundByName_ExclusiveGateway", "ServiceTask_put_network_in_AAI","ServiceTask_connect_to_Tenant","ServiceTask_connect_to_CloudRegion","ServiceTask_connect_to_NCIG","ServiceTask_connect_to_NCSI", "ServiceTask_get_cloud_region", "ServiceTask_assign_network_sdnc", "ServiceTask_assign_network_aai") + .hasNotPassed("AssignNetworkBB_end"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignServiceInstanceBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignServiceInstanceBBTest.java new file mode 100644 index 0000000000..e7551415f9 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignServiceInstanceBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; + +import java.io.IOException; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; + +public class AssignServiceInstanceBBTest extends BaseBPMNTest{ + + @Test + public void sunnyDaySDNC() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignServiceInstanceBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_AssignServiceInstanceBB", "Task_CreateServiceInstance", + "Task_CreateProject", "Task_CreateOwningEntity", "Task_AssignServiceInstance", + "Task_UpdateServiceOstatusToAssigned", "End_AssignServiceInstanceBB"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVfModuleBBTest.java new file mode 100644 index 0000000000..2645c794a7 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVfModuleBBTest.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class AssignVfModuleBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayAssignVfModule_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("AssignVfModuleBB_Start", + "CreateVfModule", + "ConnectVfModuleToVolumeGroup", + "AssignVfModule", + "UpdateVfModuleStatus", + "AssignVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayAssignVfModule_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiCreateTasks).createVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("AssignVfModuleBB_Start", "CreateVfModule") + .hasNotPassed("ConnectVfModuleToVolumeGroup", "AssignVfModule", "UpdateVfModuleStatus", "AssignVfModuleBB_End"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.java new file mode 100644 index 0000000000..8dc23eba0f --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import java.io.IOException; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class AssignVnfBBTest extends BaseBPMNTest { + @Test + public void sunnyDayAssignVnfBBTest() throws InterruptedException, IOException { + variables.put("callHoming", true); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_AssignVnfBB", "Task_CreateVnf", "Task_createPlatform", "Task_createLineOfBusiness", "Task_createInstanceGroups", + "Task_callHoming", "Task_SDNCAdapterVnfTopologyAssign", "Task_UpdateVnfOrchestrationStatusAssigned", + "End_AssignVnfBB"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayAssignVnfBBTest() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiCreateTasks) + .createVnf(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_AssignVnfBB", "Task_CreateVnf").hasNotPassed( + "Task_createPlatform", "Task_createLineOfBusiness", "Task_createInstanceGroups", "Task_SDNCAdapterVnfTopologyAssign", + "Task_UpdateVnfOrchestrationStatusAssigned", "End_AssignVnfBB"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVolumeGroupBBTest.java new file mode 100644 index 0000000000..32a803e44e --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVolumeGroupBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class AssignVolumeGroupBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayAssignVolumeGroup_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("AssignVolumeGroupBB_Start", "AssignVolumeGroup", "AssignVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayAssignVolumeGroup_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiCreateTasks).createVolumeGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("AssignVolumeGroupBB_Start", "AssignVolumeGroup") + .hasNotPassed("AssignVolumeGroupBB_End"); + assertThat(pi).isEnded();; + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelServiceInstanceBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelServiceInstanceBBTest.java new file mode 100644 index 0000000000..5af503e001 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelServiceInstanceBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class ChangeModelServiceInstanceBBTest extends BaseBPMNTest{ + @Test + public void changeModelVnfBBTest() { + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ChangeModelServiceInstanceBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted().hasPassedInOrder("ChangeModelServiceInstance_Start" ,"SDNCChangeModelServiceInstance", "AAIUpdateModelServiceInstance", "ChangeModelServiceInstance_End"); + assertThat(processInstance).isEnded(); + } + + @Test + public void changeModelVnfBBExceptionTest() { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncChangeAssignTasks).changeModelServiceInstance(any(BuildingBlockExecution.class)); + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ChangeModelServiceInstanceBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted() + .hasPassedInOrder("ChangeModelServiceInstance_Start", "SDNCChangeModelServiceInstance") + .hasNotPassed("AAIUpdateModel", "ChangeModelServiceInstance_End"); + assertThat(processInstance).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVfModuleBBTest.java new file mode 100644 index 0000000000..4720fc019c --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVfModuleBBTest.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class ChangeModelVfModuleBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayChangeModelVfModuleTest() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ChangeModelVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("ChangeModelVfModuleBB_Start", "ChangeModelVfModule", "UpdateVfModuleModel", "ChangeModelVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayChangeModelVfModuleTest() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncChangeAssignTasks).changeAssignModelVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ChangeModelVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("ChangeModelVfModuleBB_Start", "ChangeModelVfModule") + .hasNotPassed("ChangeModelVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVnfBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVnfBBTest.java new file mode 100644 index 0000000000..78bf15febe --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVnfBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class ChangeModelVnfBBTest extends BaseBPMNTest{ + @Test + public void changeModelVnfBBTest() { + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ChangeModelVnfBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted().hasPassedInOrder("ChangeModelVnf_Start" ,"SDNCChangeModel", "AAIUpdateModel", "ChangeModelVnf_End"); + assertThat(processInstance).isEnded(); + } + + @Test + public void changeModelVnfBBExceptionTest() { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncChangeAssignTasks).changeModelVnf(any(BuildingBlockExecution.class)); + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ChangeModelVnfBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted() + .hasPassedInOrder("ChangeModelVnf_Start", "SDNCChangeModel") + .hasNotPassed("AAIUpdateModel", "ChangeModelVnf_End"); + assertThat(processInstance).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateCustomerBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateCustomerBBTest.java new file mode 100644 index 0000000000..7cefd5861e --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateCustomerBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class CreateCustomerBBTest extends BaseBPMNTest{ + @Test + public void createCustomerBBTest() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateCustomerBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("CreateCustomerBB_Start", "CreateCustomerAAI", "CreateCustomerBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void createCustomerBBExceptionTest() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiCreateTasks).createCustomer(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateCustomerBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("CreateCustomerBB_Start", "CreateCustomerAAI") + .hasNotPassed("CreateCustomer_End"); + assertThat(pi).isEnded(); + } +} + diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java new file mode 100644 index 0000000000..cb3ab32884 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class CreateNetworkBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayCreateNetwork_Test() throws InterruptedException { + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkBB",variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("createNetwork_startEvent", "QueryNetworkById_ServiceTask", "ServiceTask_get_cloud_region", "QueryVpnBinding_ServiceTask", "QueryNetworkPolicy_ServiceTask", "QueryNetworkTableRef_ServiceTask", "Create_Network_ServiceTask", "Update_Network_AAI_ServiceTask", "createNetwork_EndEvent"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayCreateNetwork_Test() throws Exception { + + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(createNetwork).buildCreateNetworkRequest(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("createNetwork_startEvent","QueryNetworkById_ServiceTask") + .hasNotPassed("End Flow"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkCollectionBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkCollectionBBTest.java new file mode 100644 index 0000000000..bd285f11e1 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkCollectionBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class CreateNetworkCollectionBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayCreateNetworkCollection_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkCollectionBB",variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("createNetworkCollection_startEvent", "BuildName_ServiceTask", "ServiceTask_create_NetworkCollection", "ServiceTask_create_NetworkCollectionInstanceGroup", "ServiceTask_Connect_Collection_to_InstanceGroup", "ServiceTask_Connect_Collection_to_ServiceInstance", "createNetworkCollection_EndEvent"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayCreateNetworkCollection_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiCreateTasks).createNetworkCollectionInstanceGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkCollectionBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("createNetworkCollection_startEvent", "BuildName_ServiceTask", "ServiceTask_create_NetworkCollection") + .hasNotPassed("createNetworkCollection_EndEvent"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java new file mode 100644 index 0000000000..a3c6a820bd --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class CreateVfModuleBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayCreateVfModule_Test() throws InterruptedException { + mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("CreateVfModuleBB_Start", + "QueryVnf", + "QueryVfModule", + "CreateVfModule", + "VnfAdapter", + "UpdateVfModuleStatus", + "CreateVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayCreateVfModuleSDNCQueryVnfError_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncQueryTasks).queryVnf(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf") + .hasNotPassed("QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayCreateVfModuleSDNCQueryVnfModuleError_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncQueryTasks).queryVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule") + .hasNotPassed("CreateVfModule", "VnfAdapter", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayCreateVfModuleVnfAdapterCreateError_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(vnfAdapterCreateTasks).createVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule") + .hasNotPassed("VnfAdapter", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayCreateVfModuleUpdateVfModuleStatusError_Test() throws Exception { + mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusCreatedVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleStatus") + .hasNotPassed("CreateVfModuleBB_End"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java new file mode 100644 index 0000000000..980e609e97 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class CreateVolumeGroupBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayCreateVolumeGroup_Test() throws InterruptedException { + mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted(); + assertThat(pi).isEnded(); + assertThat(pi).hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter", "Vnf_Adapter","UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); + } + + @Test + public void rainyDayCreateVolumeGroup_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(vnfAdapterCreateTasks).createVolumeGroupRequest(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted(); + assertThat(pi).isEnded(); + assertThat(pi).hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter") + .hasNotPassed("Vnf_Adapter", "UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); + } +} + diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateNetworkBBTest.java new file mode 100644 index 0000000000..fd8cb9f15d --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateNetworkBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class DeactivateNetworkBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayDeactivateNetworkBB_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateNetworkBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("DeactivateNetworkBB_Start", "DeactivateNetworkSDNC", "DeactivateNetworkAAI", "DeactivateNetworkBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayDeactivateNetworkBB_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncDeactivateTasks).deactivateNetwork(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateNetworkBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("DeactivateNetworkBB_Start", "DeactivateNetworkSDNC") + .hasNotPassed("DeactivateNetworkAAI", "DeactivateNetworkBB_End"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java new file mode 100644 index 0000000000..6c7aedf48a --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +/** + * Unit test cases for DeActivateServiceInstanceTest.bpmn + */ +public class DeactivateServiceInstanceBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayDeactivateServiceInstanceSDNC() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateServiceInstanceBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_DeactivateServiceInstanceBB", "Task_DeactivateServiceInstance_SDNC", "Task_DeactivateServiceInstance_AAI", "End_DeactivateServiceInstanceBB"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVfModuleBBTest.java new file mode 100644 index 0000000000..b6e0812dd7 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVfModuleBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import java.io.IOException; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class DeactivateVfModuleBBTest extends BaseBPMNTest{ + @Test + public void sunnyDay() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("DeactivateVfModuleBB_Start", "DeactivateVfModule", + "UpdateVfModuleDeactivateStatus", "DeactivateVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDay() throws Exception { + doThrow(BpmnError.class).when(aaiUpdateTasks).updateOrchestrationStatusDeactivateVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("DeactivateVfModuleBB_Start", "DeactivateVfModule", "UpdateVfModuleDeactivateStatus") + .hasNotPassed("DeActivateVfModuleBB_End"); + assertThat(pi).isEnded(); + + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVnfBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVnfBBTest.java new file mode 100644 index 0000000000..20edc62b64 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVnfBBTest.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import java.io.IOException; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class DeactivateVnfBBTest extends BaseBPMNTest{ + @Test + public void sunnyDay() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_DeactivateVnfBB","Task_SDNCAdapterVnfTopologyDeactivate", + "Task_DeactivateOrchestrationStatusVnf", "End_DeactivateVnfBB"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayDeactivateVnfSDNCError_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncDeactivateTasks).deactivateVnf(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("Start_DeactivateVnfBB", "Task_SDNCAdapterVnfTopologyDeactivate") + .hasNotPassed("Task_DeactivateOrchestrationStatusVnf", "End_DeactivateVnfBB"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayDeactivateVnfAAIError_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusAssignedVnf(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("Start_DeactivateVnfBB", "Task_SDNCAdapterVnfTopologyDeactivate","Task_DeactivateOrchestrationStatusVnf") + .hasNotPassed("End_DeactivateVnfBB"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVolumeGroupBBTest.java new file mode 100644 index 0000000000..e0f3cb2c48 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVolumeGroupBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class DeactivateVolumeGroupBBTest extends BaseBPMNTest { + @Test + public void sunnyDayAssignVolumeGroup_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("DeactivateVolumeGroupBB_Start", "DeactivateVolumeGroup", "DeactivateVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayAssignVolumeGroup_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusCreatedVolumeGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("DeactivateVolumeGroupBB_Start", "DeactivateVolumeGroup") + .hasNotPassed("DeactivateVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkBBTest.java new file mode 100644 index 0000000000..b6b58eb3eb --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class DeleteNetworkBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayDeleteNetwork_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteNetworkBB",variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("deleteNetwork_startEvent", "deleteNetworkAIC", "updateNetworkAAI", "deleteNetwork_endEvent"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayDeleteNetwork_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(networkAdapterDeleteTasks).deleteNetwork(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteNetworkBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("deleteNetwork_startEvent", "deleteNetworkAIC") + .hasNotPassed("updateNetworkAAI", "deleteNetwork_endEvent"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkCollectionBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkCollectionBBTest.java new file mode 100644 index 0000000000..c8f81c1057 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkCollectionBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class DeleteNetworkCollectionBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayCreateNetworkCollection_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteNetworkCollectionBB",variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("deleteNetworkCollection_startEvent", "ServiceTask_delete_NetworkCollectionInstanceGroup", "ServiceTask_delete_NetworkCollection", "deleteNetworkCollection_EndEvent"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayCreateNetworkCollection_Test() throws Exception { + + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiDeleteTasks).deleteInstanceGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteNetworkCollectionBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("deleteNetworkCollection_startEvent") + .hasNotPassed("deleteNetworkCollection_EndEvent"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java new file mode 100644 index 0000000000..098d9a5c05 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import java.io.IOException; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class DeleteVfModuleBBTest extends BaseBPMNTest{ + @Test + public void sunnyDay() throws InterruptedException, IOException { + mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter", "VnfAdapter", + "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDay() throws Exception { + doThrow(BpmnError.class).when(vnfAdapterDeleteTasks).deleteVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter") + .hasNotPassed("VnfAdapter", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java new file mode 100644 index 0000000000..d2f4db5d5c --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class DeleteVolumeGroupBBTest extends BaseBPMNTest { + @Test + public void sunnyDayDeleteVolumeGroup_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "UpdateVolumeGroupAAI", "DeleteVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayDeleteVolumeGroup_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusAssignedVolumeGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "UpdateVolumeGroupAAI") + .hasNotPassed("DeleteVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ExecuteBuildingBlockTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ExecuteBuildingBlockTest.java new file mode 100644 index 0000000000..51f5f723ad --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ExecuteBuildingBlockTest.java @@ -0,0 +1,113 @@ +/*- + * ============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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doThrow; + +import java.util.List; + +import org.camunda.bpm.engine.ManagementService; +import org.camunda.bpm.engine.TaskService; +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.management.JobDefinition; +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.engine.test.ProcessEngineRule; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective; +import org.springframework.beans.factory.annotation.Autowired; + +public class ExecuteBuildingBlockTest extends BaseBPMNTest { + @Autowired + private TaskService taskService; + @Autowired + private ManagementService managementService; + + @Test + public void test_sunnyDayExecuteBuildingBlock_silentSuccess() throws Exception { + variables.put("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "StatusPolicy", "CheckOrchestrationStatusValidationResults", "End_ExecuteBuildingBlock") + .hasNotPassed("Call_BBToExecute", "ErrorStart", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "ExclusiveGateway_1aonzik", "ErrorEnd2", "Task_SetRetryTimer"); + assertThat(pi).isEnded(); + } + + @Test + public void test_rainyDayExecuteBuildingBlock_rollbackOrAbort() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(bbInputSetup).execute(any(DelegateExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "BoundaryEvent_0i3q236", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "ErrorEnd2") + .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", "Call_BBToExecute", "End_ExecuteBuildingBlock", "ExclusiveGateway_0ey4zpt", "Task_SetRetryTimer"); + assertThat(pi).isEnded(); + } + + @Test + public void test_rainyDayExecuteBuildingBlock_retryNoRetriesLeft() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(bbInputSetup).execute(any(DelegateExecution.class)); + + variables.put("handlingCode", "Retry"); + variables.put("RetryCount", 5); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "BoundaryEvent_0i3q236", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "ExclusiveGateway_0ey4zpt", "ErrorEnd2") + .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", "Call_BBToExecute", "End_ExecuteBuildingBlock", "Task_SetRetryTimer"); + assertThat(pi).isEnded(); + } + + @Test + @Ignore + public void test_rainyDayExecuteBuildingBlock_retryRetriesLeft() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(bbInputSetup).execute(any(DelegateExecution.class)); + + variables.put("handlingCode", "Retry"); + variables.put("RetryCount", 4); + variables.put("RetryDuration", "PT1S"); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted(); + assertThat(pi).isWaitingAt("IntermediateCatchEvent_RetryTimer"); + Job job = managementService.createJobQuery().activityId("IntermediateCatchEvent_RetryTimer").singleResult(); + assertNotNull(job); + managementService.executeJob(job.getId()); + assertThat(pi).isEnded() + .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "BoundaryEvent_0i3q236", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "ExclusiveGateway_0ey4zpt", "Task_SetRetryTimer", "EndEvent_1sez2lh") + .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", "Call_BBToExecute", "End_ExecuteBuildingBlock", "ErrorEnd2"); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java new file mode 100644 index 0000000000..ad374e3304 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java @@ -0,0 +1,53 @@ +/*- + * ============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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class UnassignNetwork1802BBTest extends BaseBPMNTest { + @Test + public void sunnyDayAssignNetwork_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetwork1802BB",variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB","Task_GetL3NetworkById","Task_VfModuleRelatioship","Task_GetCloudRegionVersion","Task_SNDCUnAssign","End_UnassignNetworkBB"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayAssignNetwork_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(unassignNetworkBB).checkRelationshipRelatedTo(any(BuildingBlockExecution.class), eq("vf-module")); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetwork1802BB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("Start_UnassignNetworkBB", "Task_GetL3NetworkById", "Task_VfModuleRelatioship") + .hasNotPassed("End_UnassignNetworkBB"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java new file mode 100644 index 0000000000..fd95e00031 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java @@ -0,0 +1,53 @@ +/*- + * ============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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class UnassignNetworkBBTest extends BaseBPMNTest { + @Test + public void sunnyDayAssignNetwork_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetworkBB",variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB","Task_GetL3NetworkById","Task_VfModuleRelatioship","Task_GetCloudRegionVersion","Task_SNDCUnAssign","Task_DeleteNetwork","End_UnassignNetworkBB"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayAssignNetwork_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(unassignNetworkBB).checkRelationshipRelatedTo(any(BuildingBlockExecution.class), eq("vf-module")); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetworkBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("Start_UnassignNetworkBB", "Task_GetL3NetworkById", "Task_VfModuleRelatioship") + .hasNotPassed("End_UnassignNetworkBB"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignServiceInstanceBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignServiceInstanceBBTest.java new file mode 100644 index 0000000000..2145cc7a14 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignServiceInstanceBBTest.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; + +import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; + +public class UnassignServiceInstanceBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayUnassignServiceInstanceSDNC() throws InterruptedException { + BuildingBlockExecution bbe = new DelegateExecutionImpl(new ExecutionImpl()); + + variables.put("gBuildingBlockExecution", bbe); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignServiceInstanceBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignServiceInstanceBB", "Task_SdncUnassignServiceInstance", "Task_AAIDeleteServiceInstance", "End_UnassignServiceInstanceBB"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVfModuleBBTest.java new file mode 100644 index 0000000000..59fcd32367 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVfModuleBBTest.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class UnassignVfModuleBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayUnassignVfModule_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("UnassignVfModuleBB_Start", + "UnassignVfModule", + "DeleteVfModule", + "UnassignVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayUnassignVfModuleAAIDeleteFailed_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiDeleteTasks).deleteVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("UnassignVfModuleBB_Start", "UnassignVfModule", "DeleteVfModule") + .hasNotPassed("UnassignVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayUnassignVfModuleSDNCUnassignFailed_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncUnassignTasks).unassignVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("UnassignVfModuleBB_Start", "UnassignVfModule") + .hasNotPassed("DeleteVfModule", "UnassignVfModuleBB_End"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVnfBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVnfBBTest.java new file mode 100644 index 0000000000..666cd87273 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVnfBBTest.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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class UnassignVnfBBTest extends BaseBPMNTest{ + @Test + public void sunnyDayUnassignVnf_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("UnassignVnfBB_Start", + "UnassignVnf", + "DeleteVnfInstanceGroups", + "DeleteVnf", + "UnassignVnfBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayUnassignVnfInstanceGroupsDeleteFailed_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(unassignVnf).deleteInstanceGroups(any(BuildingBlockExecution.class)); //.deleteVnf(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf", "DeleteVnfInstanceGroups") + .hasNotPassed("DeleteVnf","UnassignVnfBB_End"); + assertThat(pi).isEnded().hasVariables("gBuildingBlockExecution"); + } + + @Test + public void rainyDayUnassignVnfAAIDeleteFailed_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiDeleteTasks).deleteVnf(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf", "DeleteVnfInstanceGroups","DeleteVnf") + .hasNotPassed("UnassignVnfBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayUnassignVnfSDNCUnassignFailed_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncUnassignTasks).unassignVnf(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf") + .hasNotPassed("DeleteVnfInstanceGroups","DeleteVnf", "UnassignVnfBB_End"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVolumeGroupBBTest.java new file mode 100644 index 0000000000..46c25c13ac --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVolumeGroupBBTest.java @@ -0,0 +1,53 @@ +/*- + * ============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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class UnassignVolumeGroupBBTest extends BaseBPMNTest { + @Test + public void sunnyDayUnassignVolumeGroup_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("UnassignVolumeGroupBB_Start", "UnassignVolumeGroup", "UnassignVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayUnassignVolumeGroup_Test() throws InterruptedException { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiDeleteTasks).deleteVolumeGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("UnassignVolumeGroupBB_Start", "UnassignVolumeGroup") + .hasNotPassed("UnassignVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java new file mode 100644 index 0000000000..853f713bd1 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java @@ -0,0 +1,58 @@ +/*- + * ============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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + + +public class UpdateNetworkBBTest extends BaseBPMNTest { + @Test + public void updateNetworkBBTest() throws InterruptedException { + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("UpdateNetworkBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted().hasPassedInOrder( + "UpdateNetworkBB_Start", "SDNCChangeAssignNetwork", + "QueryNetworkAAI", "QueryVpnBindingAAI", "QueryNetworkPolicyAAI", "QueryNetworkTableRefAAI", + "UpdateNetworkAdapter", "UpdateNetworkAAI", "UpdateNetworkBB_End"); + assertThat(processInstance).isEnded(); + } + + @Test + public void updateNetworkBBExceptionTest() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiQueryTasks).queryNetworkVpnBinding(any(BuildingBlockExecution.class)); + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("UpdateNetworkBB", variables); + assertThat(processInstance).isStarted().hasPassedInOrder( + "UpdateNetworkBB_Start", "SDNCChangeAssignNetwork", + "QueryNetworkAAI", "QueryVpnBindingAAI") + .hasNotPassed("QueryNetworkPolicyAAI", "QueryNetworkTableRefAAI", + "UpdateNetworkAdapter", "UpdateNetworkAAI", "UpdateNetworkBB_End"); + assertThat(processInstance).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java new file mode 100644 index 0000000000..3a41bcac55 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java @@ -0,0 +1,51 @@ +/*- + * ============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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + + +public class VnfAdapterTest extends BaseBPMNTest { + @Test + public void vnfAdapterCreatedTest() { + mockSubprocess("vnfAdapterRestV1", "Mocked vnfAdapterRestV1", "GenericStub"); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VnfAdapter", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VnfAdapter_Start", "PreProcessRequest", "Call_vnfAdapterRestV1","PostProcessResponse", "VnfAdapter_End"); + assertThat(pi).isEnded(); + } + + @Test + public void vnfAdapterErrorTest() { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(vnfAdapterImpl).preProcessVnfAdapter(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VnfAdapter", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VnfAdapter_Start", "PreProcessRequest").hasNotPassed("VnfAdapter_End"); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml b/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml new file mode 100644 index 0000000000..0b998c7268 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml @@ -0,0 +1,220 @@ +aai: + auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764 + endpoint: http://localhost:28090 +appc: + client: + key: iaEMAfjsVsZnraBP + response: + timeout: '120000' + secret: wcivUjsjXzmGFBfxMmyJu9dz + poolMembers: localhost:3904,http://localhost:3904 + service: ueb + topic: + read: + name: APPC-TEST-AMDOCS2 + timeout: '120000' + write: APPC-TEST-AMDOCS1-DEV3 + sdnc: + read: SDNC-LCM-READ + write: SDNC-LCM-WRITE +log: + debug: + CompleteMsoProcess: 'true' + CreateNetworkInstanceInfra: 'true' + CreateServiceInstanceInfra: 'true' + DeleteNetworkInstanceInfra: 'true' + FalloutHandler: 'true' + UpdateNetworkInstanceInfra: 'true' + VnfAdapterRestV1: 'true' + sdncAdapter: 'true' + vnfAdapterCreateV1: 'true' + vnfAdapterRestV1: 'true' +mso: + adapters: + completemsoprocess: + endpoint: http://localhost:28090/CompleteMsoProcess + db: + auth: 757A94191D685FD2092AC1490730A4FC + endpoint: http://localhost:28090/dbadapters/RequestsDbAdapter + spring: + endpoint: http://localhost:28090 + network: + endpoint: http://localhost:28090/networks/NetworkAdapter + rest: + endpoint: http://localhost:28090/networks/rest/v1/networks + openecomp: + db: + endpoint: http://localhost:28090/dbadapters/RequestsDbAdapter + po: + auth: 757A94191D685FD2092AC1490730A4FC + password: 3141634BF7E070AA289CF2892C986C0B + sdnc: + endpoint: http://localhost:28090/SDNCAdapter + rest: + endpoint: http://localhost:28090/SDNCAdapter/v1/sdnc + timeout: PT60S + tenant: + endpoint: http://localhost:28090/tenantAdapterMock + vnf: + endpoint: http://localhost:28090/vnfs/VnfAdapter + rest: + endpoint: http://localhost:28090/services/rest/v1/vnfs + volume-groups: + rest: + endpoint: http://localhost:28090/services/rest/v1/volume-groups + vnf-async: + endpoint: http://localhost:28090/vnfs/VnfAdapterAsync + workflow: + message: + endpoint: http://localhost:28090/workflows/messages/message + + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + + bpmn: + optimisticlockingexception: + retrycount: '3' + callbackRetryAttempts: '5' + catalog: + db: + endpoint: http://localhost:28090/ + spring: + endpoint: http://localhost:28090 + correlation: + timeout: 60 + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + default: + adapter: + namespace: http://org.onap.so + healthcheck: + log: + debug: 'false' + infra: + customer: + id: testCustIdInfra + logPath: logs + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + po: + timeout: PT60S + request: + db: + endpoint: http://localhost:28090/ + rollback: 'true' + service: + agnostic: + sniro: + endpoint: /sniro/api/v2/placement + host: http://localhost:28090 + site-name: localDevEnv + sniro: + auth: test:testpwd + policies: + dhv: + 2vvig: SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1 + 4vvig: SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.VNFPolicy_vvigprimary2_v1,SNIRO.VNFPolicy_vvigsecondary2_v1,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1 + timeout: PT30M + workflow: + default: + aai: + cloud-region: + version: '9' + generic-vnf: + version: '9' + v8: + customer: + uri: /aai/v8/business/customers/customer + generic-query: + uri: /aai/v8/search/generic-query + l3-network: + uri: /aai/v8/network/l3-networks/l3-network + network-policy: + uri: /aai/v8/network/network-policies/network-policy + nodes-query: + uri: /aai/v8/search/nodes-query + route-table-reference: + uri: /aai/v8/network/route-table-references/route-table-reference + tenant: + uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + vce: + uri: /aai/v8/network/vces/vce + vpn-binding: + uri: /aai/v8/network/vpn-bindings/vpn-binding + v9: + cloud-region: + uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic + generic-vnf: + uri: /aai/v9/network/generic-vnfs/generic-vnf + global: + default: + aai: + namespace: http://org.openecomp.aai.inventory/ + version: '8' + message: + endpoint: http://localhost:28080/mso/WorkflowMesssage + notification: + name: GenericNotificationService + sdncadapter: + callback: http://localhost:28080/mso/SDNCAdapterCallbackService + vnfadapter: + create: + callback: http://localhost:28080/mso/vnfAdapterNotify + delete: + callback: http://localhost:28080/mso/vnfAdapterNotify + query: + callback: http://localhost:28080/mso/services/VNFAdapterQuerCallbackV1 + rollback: + callback: http://localhost:28080/mso/vnfAdapterNotify + global: + dmaap: + username: dmaapUsername + password: dmaapPassword + host: http://localhost:28090 + publisher: + topic: com.att.mso.asyncStatusUpdate +policy: + auth: Basic dGVzdHBkcDphbHBoYTEyMw== + client: + auth: Basic bTAzNzQzOnBvbGljeVIwY2sk + endpoint: https://localhost:8081/pdp/api/ + environment: TEST +sniro: + conductor: + enabled: true + host: http://localhost:8446 + uri: /v1/release-orders + headers.auth: Basic dGVzdDp0ZXN0cHdk + manager: + host: http://localhost:8446 + uri: /sniro/api/placement/v2 + headers.auth: Basic dGVzdDp0ZXN0cHdk + headers.patchVersion: 1 + headers.minorVersion: 1 + headers.latestVersion: 2 +spring: + datasource: + url: jdbc:mariadb://localhost:3307/camundabpmn + username: root + password: password + driver-class-name: org.mariadb.jdbc.Driver + initialize: true + jpa: + generate-ddl: false + show-sql: false + hibernate: + ddl-auto: none + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + +mariaDB4j: + dataDir: + port: 3307 + databaseName: camundabpmn +camunda: + bpm: + metrics: + enabled: false + db-reporter-activate: false \ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml b/bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..d8f6ba3930 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml @@ -0,0 +1,30 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/.gitignore b/bpmn/so-bpmn-infrastructure-common/.gitignore new file mode 100644 index 0000000000..82f0c3ac6d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/.gitignore @@ -0,0 +1 @@ +/data/ diff --git a/bpmn/so-bpmn-infrastructure-common/.maven-dockerignore b/bpmn/so-bpmn-infrastructure-common/.maven-dockerignore new file mode 100644 index 0000000000..18bb2a12d0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/.maven-dockerignore @@ -0,0 +1 @@ +target/docker/** \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml new file mode 100644 index 0000000000..aa7f118673 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/pom.xml @@ -0,0 +1,269 @@ + + + org.onap.so + bpmn + 1.3.0-SNAPSHOT + + 4.0.0 + so-bpmn-infrastructure-common + jar + + 7.8.0 + + + + + org.apache.cxf + cxf-codegen-plugin + 2.5.2 + + + org.apache.maven.plugins + maven-dependency-plugin + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.apache.maven.plugins + + + maven-antrun-plugin + + + [1.3,) + + + run + + + + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + default-test + + test + + + + **/AllTestsTestSuite.java + + + + + tasks-test + + test + + + + **/AllTasksTestsTestSuite.java + + + + + + + + ${project.artifactId}-${project.version} + + + + + + org.camunda.bpm + camunda-bom + ${camunda.version} + import + pom + + + + + + + org.camunda.bpm.springboot + camunda-bpm-spring-boot-starter + 2.3.0 + test + + + org.springframework.boot + spring-boot-starter-web + test + + + org.springframework.boot + spring-boot-starter-data-jpa + true + + + org.apache.cxf + cxf-spring-boot-starter-jaxws + 3.1.12 + + + org.apache.cxf + cxf-spring-boot-starter-jaxrs + 3.1.12 + + + org.apache.cxf + cxf-rt-rs-service-description-swagger + 3.1.11 + + + com.h2database + h2 + test + + + com.google.guava + guava + 22.0 + + + com.fasterxml.uuid + java-uuid-generator + + + org.codehaus.groovy + groovy-all + + + org.apache.commons + commons-lang3 + 3.4 + + + org.onap.so + MSOCoreBPMN + ${project.version} + + + org.onap.so + MSOCommonBPMN + ${project.version} + + + org.onap.so + MSOCoreBPMN + ${project.version} + tests + test + + + javax.ws.rs + javax.ws.rs-api + 2.0 + + + org.onap.so + MSORESTClient + ${project.version} + + + org.camunda.spin + camunda-spin-core + test + + + org.camunda.spin + camunda-spin-dataformat-all + test + + + camunda-spin-dataformat-all + org.camunda.spin + test + + + org.camunda.bpm + camunda-engine-plugin-spin + + + + org.camunda.bpm + camunda-engine-plugin-connect + test + + + javax.annotation + javax.annotation-api + 1.3 + + + org.onap.msb.java-sdk + msb-java-sdk + 1.0.0 + + + com.eclipsesource.jaxrs + jersey-all + + + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + ch.qos.logback + logback-classic + + + ch.qos.logback + logback-core + + + org.slf4j + slf4j-api + + + org.mariadb.jdbc + mariadb-java-client + + + ch.vorburger.mariaDB4j + mariaDB4j + 2.2.3 + test + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java new file mode 100644 index 0000000000..a47b16fc33 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.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.bpmn.infrastructure.aai; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +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; + +public class AAICreateResources extends AAIResource { + + + public void createAAIProject (String projectName, String serviceInstance){ + AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + getAaiClient().createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI); + + } + + public void createAAIOwningEntity(String owningEntityId, String owningEntityName,String serviceInstance){ + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + Map hashMap= new HashMap<>(); + hashMap.put("owning-entity-name", owningEntityName); + getAaiClient().createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI, serviceInstanceURI); + } + + public boolean existsOwningEntity(String owningEntityId){ + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + return getAaiClient().exists(owningEntityURI); + } + + public void connectOwningEntityandServiceInstance (String owningEntityId, String serviceInstance){ + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + getAaiClient().connect(owningEntityURI, serviceInstanceURI); + } + + public void createAAIPlatform(String platformName,String vnfId){ + AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName); + AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId); + getAaiClient().createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI); + } + + public void createAAILineOfBusiness(String lineOfBusiness,String vnfId){ + AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness); + AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId); + getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI); + } + public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId){ + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId,serviceType,serviceInstanceId); + getAaiClient().createIfNotExists(serviceInstanceURI, Optional.empty()); + } + + public Optional getVnfInstance(String vnfId){ + try{ + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIResultWrapper aaiResponse = getAaiClient().get(vnfURI); + Optional vnf = aaiResponse.asBean(GenericVnf.class); + return vnf; + } catch (Exception ex){ + return Optional.empty(); + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java new file mode 100644 index 0000000000..cea6fe740d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.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.bpmn.infrastructure.aai; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.springframework.stereotype.Component; + +public class AAIDeleteServiceInstance extends AAIResource implements JavaDelegate{ + + ExceptionUtil exceptionUtil = new ExceptionUtil(); + public void execute(DelegateExecution execution) throws Exception { + try{ + String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + serviceInstanceId); + getAaiClient().delete(serviceInstanceURI); + execution.setVariable("GENDS_SuccessIndicator",true); + } catch(Exception ex){ + String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI." + ex.getMessage(); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java new file mode 100644 index 0000000000..3bc02be476 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java @@ -0,0 +1,40 @@ +/*- + * ============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.bpmn.infrastructure.aai; + +import org.onap.so.client.aai.AAIResourcesClient; +import org.springframework.stereotype.Component; + +@Component +public abstract class AAIResource { + private AAIResourcesClient aaiClient; + + public AAIResourcesClient getAaiClient() { + if(aaiClient == null) + return new AAIResourcesClient(); + else + return aaiClient; + } + + public void setAaiClient(AAIResourcesClient aaiClient) { + this.aaiClient = aaiClient; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java new file mode 100644 index 0000000000..67ba155336 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.aai; + +public class AAIServiceInstance { + String serviceInstanceName; + String serviceType; + String serviceRole; + String orchestrationStatus; + String modelInvariantUuid; + String modelVersionId; + String environmentContext; + String workloadContext; + public AAIServiceInstance(String serviceInstanceName, String serviceType, String serviceRole, + String orchestrationStatus, String modelInvariantUuid, String modelVersionId, String environmentContext, + String workloadContext) { + this.serviceInstanceName = serviceInstanceName; + this.serviceType = serviceType; + this.serviceRole = serviceRole; + this.orchestrationStatus = orchestrationStatus; + this.modelInvariantUuid = modelInvariantUuid; + this.modelVersionId = modelVersionId; + this.environmentContext = environmentContext; + this.workloadContext = workloadContext; + } + 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 getServiceRole() { + return serviceRole; + } + public void setServiceRole(String serviceRole) { + this.serviceRole = serviceRole; + } + public String getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(String orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public String getModelInvariantUuid() { + return modelInvariantUuid; + } + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + public String getModelVersionId() { + return modelVersionId; + } + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + public String getEnvironmentContext() { + return environmentContext; + } + public void setEnvironmentContext(String environmentContext) { + this.environmentContext = environmentContext; + } + public String getWorkloadContext() { + return workloadContext; + } + public void setWorkloadContext(String workloadContext) { + this.workloadContext = workloadContext; + } + + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java new file mode 100644 index 0000000000..c04c2dc15b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java @@ -0,0 +1,123 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.aai.groovyflows; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +import javax.ws.rs.NotFoundException; + +import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.ServiceInstances; +import org.onap.aai.domain.yang.OwningEntities; +import org.onap.aai.domain.yang.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; +import org.onap.so.client.aai.AAIObjectPlurals; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.logger.MsoLogger; + +public class AAICreateResources { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAICreateResources.class); + + public void createAAIProject (String projectName, String serviceInstance){ + AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI); + + } + + public void createAAIOwningEntity(String owningEntityId, String owningEntityName,String serviceInstance){ + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + Map hashMap= new HashMap<>(); + hashMap.put("owning-entity-name", owningEntityName); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI, serviceInstanceURI); + } + + public boolean existsOwningEntity(String owningEntityId){ + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + return aaiRC.exists(owningEntityURI); + } + + protected OwningEntities getOwningEntityName(String owningEntityName){ + + AAIResourcesClient aaiRC = new AAIResourcesClient(); + return aaiRC.get(OwningEntities.class, + AAIUriFactory + .createResourceUri(AAIObjectPlurals.OWNING_ENTITIES) + .queryParam("owning-entity-name", owningEntityName)) + .orElseGet(() -> { + msoLogger.debug("No Owning Entity matched by name"); + return null; + }); + + } + + public Optional getOwningEntityNames(String owningEntityName) throws Exception{ + OwningEntity owningEntity = null; + OwningEntities owningEntities = null; + owningEntities = getOwningEntityName(owningEntityName); + + if (owningEntities == null) { + return Optional.empty(); + } else if (owningEntities.getOwningEntity().size() > 1) { + throw new Exception("Multiple OwningEntities Returned"); + } else { + owningEntity = owningEntities.getOwningEntity().get(0); + } + return Optional.of(owningEntity); + } + + public void connectOwningEntityandServiceInstance (String owningEntityId, String serviceInstance){ + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.connect(owningEntityURI, serviceInstanceURI); + } + + public void createAAIPlatform(String platformName,String vnfId){ + AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName); + AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI); + } + + public void createAAILineOfBusiness(String lineOfBusiness,String vnfId){ + AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness); + AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI); + } + public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId){ + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId,serviceType,serviceInstanceId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(serviceInstanceURI, Optional.empty()); + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java new file mode 100644 index 0000000000..495c77255d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.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.bpmn.infrastructure.aai.groovyflows; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; + +public class AAIDeleteServiceInstance implements JavaDelegate{ + + ExceptionUtil exceptionUtil = new ExceptionUtil(); + public void execute(DelegateExecution execution) throws Exception { + try{ + String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + serviceInstanceId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.delete(serviceInstanceURI); + execution.setVariable("GENDS_SuccessIndicator",true); + } catch(Exception ex){ + String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI." + ex.getMessage(); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java new file mode 100644 index 0000000000..805ece9de8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.aai.groovyflows; + +public class AAIServiceInstance { + String serviceInstanceName; + String serviceType; + String serviceRole; + String orchestrationStatus; + String modelInvariantUuid; + String modelVersionId; + String environmentContext; + String workloadContext; + public AAIServiceInstance(String serviceInstanceName, String serviceType, String serviceRole, + String orchestrationStatus, String modelInvariantUuid, String modelVersionId, String environmentContext, + String workloadContext) { + this.serviceInstanceName = serviceInstanceName; + this.serviceType = serviceType; + this.serviceRole = serviceRole; + this.orchestrationStatus = orchestrationStatus; + this.modelInvariantUuid = modelInvariantUuid; + this.modelVersionId = modelVersionId; + this.environmentContext = environmentContext; + this.workloadContext = workloadContext; + } + 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 getServiceRole() { + return serviceRole; + } + public void setServiceRole(String serviceRole) { + this.serviceRole = serviceRole; + } + public String getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(String orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public String getModelInvariantUuid() { + return modelInvariantUuid; + } + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + public String getModelVersionId() { + return modelVersionId; + } + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + public String getEnvironmentContext() { + return environmentContext; + } + public void setEnvironmentContext(String environmentContext) { + this.environmentContext = environmentContext; + } + public String getWorkloadContext() { + return workloadContext; + } + public void setWorkloadContext(String workloadContext) { + this.workloadContext = workloadContext; + } + + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java new file mode 100644 index 0000000000..3b443cbaf2 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java @@ -0,0 +1,40 @@ +/*- + * ============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.bpmn.infrastructure.common.name.generation; + +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.springframework.stereotype.Component; + +@Component +public class AAIObjectInstanceNameGenerator { + + public String generateInstanceGroupName(InstanceGroup instanceGroup, GenericVnf vnf) { + if(vnf.getVnfName() != null && instanceGroup.getModelInfoInstanceGroup().getFunction() != null) { + return vnf.getVnfName() + "_" + instanceGroup.getModelInfoInstanceGroup().getFunction(); + } else { + throw new IllegalArgumentException("Cannot generate instance group name because either one or both fields are null: " + + " Vnf Instance Name: " + vnf.getVnfName() + + ", Instance Group Function: " + instanceGroup.getModelInfoInstanceGroup().getFunction()); + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java new file mode 100644 index 0000000000..fa40e860c5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.aai; + +import java.io.IOException; +import java.util.Optional; +import java.util.UUID; + +import org.onap.aai.domain.yang.Pnf; +import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; +import org.onap.so.client.aai.AAIRestClientImpl; + +public class AaiConnectionImpl implements AaiConnection { + + @Override + public Optional getEntryFor(String correlationId) throws IOException { + AAIRestClientImpl restClient = new AAIRestClientImpl(); + return restClient.getPnfByName(correlationId, UUID.randomUUID().toString()); + } + + @Override + public void createEntry(String correlationId, Pnf entry) throws IOException { + AAIRestClientImpl restClient = new AAIRestClientImpl(); + restClient.createPnf(correlationId, UUID.randomUUID().toString(), entry); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java new file mode 100644 index 0000000000..85cbe2b024 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.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.bpmn.infrastructure.pnf.delegate; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; +import org.springframework.beans.factory.annotation.Autowired; + +public class CancelDmaapSubscription implements JavaDelegate { + + private DmaapClient dmaapClient; + + @Override + public void execute(DelegateExecution execution) throws Exception { + String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID); + dmaapClient.unregister(correlationId); + } + + @Autowired + public void setDmaapClient(DmaapClient dmaapClient) { + this.dmaapClient = dmaapClient; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java new file mode 100644 index 0000000000..63db293a2e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.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.bpmn.infrastructure.pnf.delegate; + +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_IP; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; + +import java.io.IOException; +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; +import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiResponse; +import org.onap.so.bpmn.infrastructure.pnf.implementation.CheckAaiForCorrelationIdImplementation; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * Implementation of "Check AAI for correlation_id" task in CreateAndActivatePnfResource.bpmn + * + * Inputs: + * - correlationId - String + * + * Outputs: + * - AAI_CONTAINS_INFO_ABOUT_PNF - local Boolean + * - aaiContainsInfoAboutIp - local Boolean + */ + +public class CheckAaiForCorrelationIdDelegate implements JavaDelegate { + private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, CheckAaiForCorrelationIdDelegate.class); + private CheckAaiForCorrelationIdImplementation implementation = new CheckAaiForCorrelationIdImplementation(); + private AaiConnection aaiConnection; + + @Autowired + public void setAaiConnection(AaiConnection aaiConnection) { + this.aaiConnection = aaiConnection; + } + + @Override + public void execute(DelegateExecution execution) throws Exception { + String correlationId = (String) execution.getVariable(CORRELATION_ID); + if (correlationId == null) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, CORRELATION_ID + " is not set"); + } + + try { + AaiResponse aaiResponse = implementation.check(correlationId, aaiConnection); + + execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, aaiResponse.getContainsInfoAboutPnf()); + execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, aaiResponse.getContainsInfoAboutIp()); + } catch (IOException e) { + LOGGER.error("IOException",e); + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, e.getMessage()); + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java new file mode 100644 index 0000000000..ec1ef21028 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.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.bpmn.infrastructure.pnf.delegate; + +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.onap.aai.domain.yang.Pnf; +import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * Implementation of "Create AAI entry with pnf-id = correlation_id" task in CreateAndActivatePnfResource.bpmn + * + * Inputs: + * - correlationId - String + */ +public class CreateAaiEntryWithPnfIdDelegate implements JavaDelegate { + + private AaiConnection aaiConnection; + + @Autowired + public void setAaiConnection(AaiConnection aaiConnection) { + this.aaiConnection = aaiConnection; + } + + @Override + public void execute(DelegateExecution execution) throws Exception { + String correlationId = (String) execution.getVariable(CORRELATION_ID); + Pnf pnf = new Pnf(); + pnf.setInMaint(true); + pnf.setPnfId(correlationId); + pnf.setPnfName(correlationId); + aaiConnection.createEntry(correlationId, pnf); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java new file mode 100644 index 0000000000..b3f2f726a0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate; + +@SuppressWarnings("ALL") +public class ExecutionVariableNames { + + private ExecutionVariableNames() {} + + public final static String CORRELATION_ID = "correlationId"; + public final static String AAI_CONTAINS_INFO_ABOUT_PNF = "aaiContainsInfoAboutPnf"; + public final static String AAI_CONTAINS_INFO_ABOUT_IP = "aaiContainsInfoAboutIp"; + public final static String DMAAP_MESSAGE = "dmaapMessage"; + public final static String TIMEOUT_FOR_NOTIFICATION = "timeoutForPnfEntryNotification"; +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java new file mode 100644 index 0000000000..bb490a06e4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.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.bpmn.infrastructure.pnf.delegate; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; +import org.springframework.beans.factory.annotation.Autowired; + +public class InformDmaapClient implements JavaDelegate { + + private DmaapClient dmaapClient; + + @Override + public void execute(DelegateExecution execution) throws Exception { + String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID); + dmaapClient.registerForUpdate(correlationId, () -> execution.getProcessEngineServices().getRuntimeService() + .createMessageCorrelation("WorkflowMessage") + .processInstanceBusinessKey(execution.getProcessBusinessKey()) + .correlateWithResult()); + } + + @Autowired + public void setDmaapClient(DmaapClient dmaapClient) { + this.dmaapClient = dmaapClient; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java new file mode 100644 index 0000000000..c7e7c7848c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.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.bpmn.infrastructure.pnf.dmaap; + +public interface DmaapClient { + + void registerForUpdate(String correlationId, Runnable informConsumer); + + Runnable unregister(String correlationId); +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java new file mode 100644 index 0000000000..90b48ab2c1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.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.bpmn.infrastructure.pnf.dmaap; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.Spliterator; + +public final class JsonUtilForCorrelationId { + + private static final String JSON_HEADER = "pnfRegistrationFields"; + private static final String JSON_CORRELATION_ID_FIELD_NAME = "correlationId"; + + static List parseJsonToGelAllCorrelationId(String json) { + List list = new ArrayList<>(); + JsonElement je = new JsonParser().parse(json); + if (je.isJsonObject()) { + getCorrelationIdFromJsonObject(je.getAsJsonObject()).ifPresent(corr -> list.add(corr)); + } else { + JsonArray array = je.getAsJsonArray(); + Spliterator spliterator = array.spliterator(); + spliterator.forEachRemaining(jsonElement -> { + parseJsonElementToJsonObject(jsonElement) + .ifPresent(jsonObject -> getCorrelationIdFromJsonObject(jsonObject) + .ifPresent(correlationId -> list.add(correlationId))); + }); + } + return list; + } + + private static Optional parseJsonElementToJsonObject(JsonElement jsonElement) { + if (jsonElement.isJsonObject()) { + return Optional.ofNullable(jsonElement.getAsJsonObject()); + } + return Optional.ofNullable(new JsonParser().parse(jsonElement.getAsString()).getAsJsonObject()); + } + + private static Optional getCorrelationIdFromJsonObject(JsonObject jsonObject) { + if (jsonObject.has(JSON_HEADER)) { + JsonObject jo = jsonObject.getAsJsonObject(JSON_HEADER); + if (jo.has(JSON_CORRELATION_ID_FIELD_NAME)) { + return Optional.ofNullable(jo.get(JSON_CORRELATION_ID_FIELD_NAME).getAsString()); + } + } + return Optional.empty(); + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java new file mode 100644 index 0000000000..353b4e32c5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java @@ -0,0 +1,178 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.dmaap; + +import java.io.IOException; +import java.net.URI; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import javax.ws.rs.core.UriBuilder; + +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +@Scope("prototype") +public class PnfEventReadyDmaapClient implements DmaapClient { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, PnfEventReadyDmaapClient.class); + + private static final String JSON_PATH_CORRELATION_ID = "$.pnfRegistrationFields.correlationId"; + + @Autowired + private Environment env; + private HttpClient httpClient; + private String dmaapHost; + private int dmaapPort; + private String dmaapProtocol; + private String dmaapUriPathPrefix; + private String dmaapTopicName; + private String consumerId; + private String consumerGroup; + private Map pnfCorrelationIdToThreadMap; + private HttpGet getRequest; + private ScheduledExecutorService executor; + private int dmaapClientDelayInSeconds; + private volatile boolean dmaapThreadListenerIsRunning; + + public void init() { + httpClient = HttpClientBuilder.create().build(); + pnfCorrelationIdToThreadMap = new ConcurrentHashMap<>(); + dmaapHost = env.getProperty("pnf.dmaap.host"); + dmaapPort = env.getProperty("pnf.dmaap.port", Integer.class); + executor = null; + getRequest = new HttpGet(buildURI()); + } + + @Override + public synchronized void registerForUpdate(String correlationId, Runnable informConsumer) { + LOGGER.debug("registering for pnf ready dmaap event for correlation id: " + correlationId); + pnfCorrelationIdToThreadMap.put(correlationId, informConsumer); + if (!dmaapThreadListenerIsRunning) { + startDmaapThreadListener(); + } + } + + @Override + public synchronized Runnable unregister(String correlationId) { + LOGGER.debug("unregistering from pnf ready dmaap event for correlation id: " + correlationId); + Runnable runnable = pnfCorrelationIdToThreadMap.remove(correlationId); + if (pnfCorrelationIdToThreadMap.isEmpty()) { + stopDmaapThreadListener(); + } + return runnable; + } + + private synchronized void startDmaapThreadListener() { + if (!dmaapThreadListenerIsRunning) { + executor = Executors.newScheduledThreadPool(1); + executor.scheduleWithFixedDelay(new DmaapTopicListenerThread(), 0, + dmaapClientDelayInSeconds, TimeUnit.SECONDS); + dmaapThreadListenerIsRunning = true; + } + } + + private synchronized void stopDmaapThreadListener() { + if (dmaapThreadListenerIsRunning) { + executor.shutdownNow(); + dmaapThreadListenerIsRunning = false; + executor = null; + } + } + + private URI buildURI() { + return UriBuilder.fromUri(dmaapUriPathPrefix) + .scheme(dmaapProtocol) + .host(dmaapHost) + .port(dmaapPort).path(dmaapTopicName) + .path(consumerGroup).path(consumerId).build(); + } + + public void setDmaapProtocol(String dmaapProtocol) { + this.dmaapProtocol = dmaapProtocol; + } + + public void setDmaapUriPathPrefix(String dmaapUriPathPrefix) { + this.dmaapUriPathPrefix = dmaapUriPathPrefix; + } + + public void setDmaapTopicName(String dmaapTopicName) { + this.dmaapTopicName = dmaapTopicName; + } + + public void setConsumerId(String consumerId) { + this.consumerId = consumerId; + } + + public void setConsumerGroup(String consumerGroup) { + this.consumerGroup = consumerGroup; + } + + public void setDmaapClientDelayInSeconds(int dmaapClientDelayInSeconds) { + this.dmaapClientDelayInSeconds = dmaapClientDelayInSeconds; + } + + class DmaapTopicListenerThread implements Runnable { + + @Override + public void run() { + try { + HttpResponse response = httpClient.execute(getRequest); + getCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfCorrelationIdFound); + } catch (IOException e) { + LOGGER.error("Exception caught during sending rest request to dmaap for listening event topic", e); + } + } + + private List getCorrelationIdListFromResponse(HttpResponse response) throws IOException { + if (response.getStatusLine().getStatusCode() == 200) { + String responseString = EntityUtils.toString(response.getEntity(), "UTF-8"); + if (responseString != null) { + return JsonUtilForCorrelationId.parseJsonToGelAllCorrelationId(responseString); + } + } + return Collections.emptyList(); + } + + private synchronized void informAboutPnfReadyIfCorrelationIdFound(String correlationId) { + Runnable runnable = unregister(correlationId); + if (runnable != null) { + LOGGER.debug("pnf ready event got from dmaap for correlationId: " + correlationId); + runnable.run(); + } + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java new file mode 100644 index 0000000000..5165912653 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.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.bpmn.infrastructure.pnf.implementation; + +import java.io.IOException; +import java.util.Optional; +import org.onap.aai.domain.yang.Pnf; + +public interface AaiConnection { + + Optional getEntryFor(String correlationId) throws IOException; + + void createEntry(String correlationId, Pnf entry) throws IOException; +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiResponse.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiResponse.java new file mode 100644 index 0000000000..32ecff102f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiResponse.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.implementation; + +import java.util.Optional; +import javax.annotation.Nullable; +import javax.validation.constraints.NotNull; + +public enum AaiResponse { + NO_ENTRY(false, false), + ENTRY_NO_IP(true, false), + ENTRY_WITH_IP(true, true); + + private boolean containsInfoAboutPnf; + private boolean containsInfoAboutIp; + + AaiResponse(boolean containsInfoAboutPnf, boolean containsInfoAboutIp) { + this.containsInfoAboutPnf = containsInfoAboutPnf; + this.containsInfoAboutIp = containsInfoAboutIp; + } + + public boolean getContainsInfoAboutPnf() { + return containsInfoAboutPnf; + } + + public boolean getContainsInfoAboutIp() { + return containsInfoAboutIp; + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java new file mode 100644 index 0000000000..e5fc87db91 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.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.bpmn.infrastructure.pnf.implementation; + +import java.io.IOException; +import java.util.Optional; +import org.onap.aai.domain.yang.Pnf; + +public class CheckAaiForCorrelationIdImplementation { + + public AaiResponse check(String correlationId, AaiConnection aaiConnection) throws IOException { + Optional pnf = aaiConnection.getEntryFor(correlationId); + if (!pnf.isPresent()) { + return AaiResponse.NO_ENTRY; + } + + if(extractIp(pnf.get()).isPresent()) { + return AaiResponse.ENTRY_WITH_IP; + } else { + return AaiResponse.ENTRY_NO_IP; + } + } + + private Optional extractIp(Pnf pnf) { + if (pnf.getIpaddressV4Oam() != null) { + return Optional.of(pnf.getIpaddressV4Oam()); + } else { + return Optional.ofNullable(pnf.getIpaddressV6Oam()); + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java new file mode 100644 index 0000000000..60f109a81f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java @@ -0,0 +1,46 @@ +/*- + * ============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.bpmn.infrastructure.properties; + +import java.util.Arrays; +import java.util.List; + +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.logger.MsoLogger; + +public class BPMNProperties { + + public static String getProperty(String key, String defaultValue) { + String value = UrnPropertiesReader.getVariable(key); + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + public static List getResourceSequenceProp(String input) { + String resourceSequence = getProperty("mso.workflow.custom." + input + ".resource.sequence", null); + if (resourceSequence != null) { + return Arrays.asList(resourceSequence.split(",")); + } + return null; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/LocationConstraint.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/LocationConstraint.java new file mode 100644 index 0000000000..e3c6dce2af --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/LocationConstraint.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.vfcmodel; + + +/** + *
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-9-6 + */ +public class LocationConstraint { + + /** + * vnf profile id + */ + private String vnfProfileId; + + /** + * location constraints: vimId + */ + 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/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java new file mode 100644 index 0000000000..ae320bdfb0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.vfcmodel; + + +import org.onap.so.logger.MsoLogger; + + +/** + * NS Create Input Parameter For VFC Adapter
+ *

+ *

+ * + * @version ONAP Beijing Release 2018/2/5 + */ +public class NSResourceInputParameter { + + private NsOperationKey nsOperationKey; + + private String nsServiceName; + + private String nsServiceDescription; + + private NsParameters nsParameters; + + private NsScaleParameters nsScaleParameters; + + + + + /** + * @return Returns the nsServiceName. + */ + public String getNsServiceName() { + return nsServiceName; + } + + + /** + * @param nsServiceName The nsServiceName to set. + */ + public void setNsServiceName(String nsServiceName) { + this.nsServiceName = nsServiceName; + } + + + /** + * @return Returns the nsServiceDescription. + */ + public String getNsServiceDescription() { + return nsServiceDescription; + } + + + /** + * @param nsServiceDescription The nsServiceDescription to set. + */ + public void setNsServiceDescription(String nsServiceDescription) { + this.nsServiceDescription = nsServiceDescription; + } + + /** + * @return Returns the nsParameters. + */ + public NsParameters getNsParameters() { + return nsParameters; + } + + /** + * @param nsParameters The nsParameters to set. + */ + public void setNsParameters(NsParameters nsParameters) { + this.nsParameters = nsParameters; + } + + public NsOperationKey getNsOperationKey() { + return nsOperationKey; + } + + public void setNsOperationKey(NsOperationKey nsOperationKey) { + this.nsOperationKey = nsOperationKey; + } + + /** + * @return Returns the nsScaleParameters. + */ + public NsScaleParameters getNsScaleParameters() { + return nsScaleParameters; + } + + /** + * @param nsScaleParameters The nsScaleParameters to set. + */ + public void setNsScaleParameters(NsScaleParameters nsScaleParameters) { + this.nsScaleParameters = nsScaleParameters; + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java new file mode 100644 index 0000000000..81826a27eb --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java @@ -0,0 +1,141 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.vfcmodel; + + +/** + * The operation key object for NS + *
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-09-15 + */ +public class NsOperationKey { + + /** + * The subscriber id + */ + private String globalSubscriberId; + + /** + * The serviceType + */ + private String serviceType; + + /** + * The service ID + */ + private String serviceId; + + /** + * The Operation ID + */ + private String operationId; + + /** + * the NS template uuid + */ + private String nodeTemplateUUID; + + /** + * @return Returns the globalSubscriberId. + */ + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + + /** + * @param globalSubscriberId The globalSubscriberId to set. + */ + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + + /** + * @return Returns the serviceType. + */ + public String getServiceType() { + return serviceType; + } + + /** + * @param serviceType The serviceType to set. + */ + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + /** + *
+ * + * @return + * @since ONAP Amsterdam Release + */ + public String getServiceId() { + return serviceId; + } + + /** + *
+ * + * @param serviceId + * @since ONAP Amsterdam Release + */ + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + /** + *
+ * + * @return + * @since ONAP Amsterdam Release + */ + public String getOperationId() { + return operationId; + } + + /** + *
+ * + * @param operationId + * @since ONAP Amsterdam Release + */ + public void setOperationId(String operationId) { + this.operationId = operationId; + } + + /** + * @return Returns the nodeTemplateUUID. + */ + public String getNodeTemplateUUID() { + return nodeTemplateUUID; + } + + /** + * @param nodeTemplateUUID The nodeTemplateUUID to set. + */ + public void setNodeTemplateUUID(String nodeTemplateUUID) { + this.nodeTemplateUUID = nodeTemplateUUID; + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java new file mode 100644 index 0000000000..0d8f2fcbd7 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.vfcmodel; + + +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/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsScaleParameters.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsScaleParameters.java new file mode 100644 index 0000000000..3340176646 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsScaleParameters.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.vfcmodel; + +import java.util.List; + +/** + *
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-9-26 + */ +public class NsScaleParameters { + + private List scaleNsByStepsData; + + private String scaleType; + + + private String nsInstanceId; + + /** + * @return Returns the scaleNsByStepsData. + */ + public List getScaleNsByStepsData() { + return scaleNsByStepsData; + } + + /** + * @param scaleNsByStepsData The scaleNsByStepsData to set. + */ + public void setScaleNsByStepsData(List scaleNsByStepsData) { + this.scaleNsByStepsData = scaleNsByStepsData; + } + + /** + * @return Returns the scale Type. + */ + public String getScaleType() { + return scaleType; + } + + /** + * @param scaleType The scaleType to set. + */ + public void setScaleType(String scaleType) { + this.scaleType = scaleType; + } + + public String getNsInstanceId() { + return nsInstanceId; + } + + public void setNsInstanceId(String nsInstanceId) { + this.nsInstanceId = nsInstanceId; + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java new file mode 100644 index 0000000000..bbf189ac7a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.vfcmodel; + + + +/** + *
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-9-26 + */ +public class ScaleNsByStepsData { + + /** + * scaling Direction + */ + private String scalingDirection; + + /** + * aspect ID + */ + private String aspectId; + + /** + * number of Steps + */ + private int numberOfSteps; + + /** + * @return Returns the scalingDirection. + */ + public String getScalingDirection() { + return scalingDirection; + } + + /** + * @param scalingDirection The scalingDirection to set. + */ + public void setScalingDirection(String scalingDirection) { + this.scalingDirection = scalingDirection; + } + + /** + * @return Returns the aspectId. + */ + public String getAspectId() { + return aspectId; + } + + /** + * @param aspectId The aspectId to set. + */ + public void setAspectId(String aspectId) { + this.aspectId = aspectId; + } + + /** + * @return Returns the numberofSteps. + */ + public int getNumberOfSteps() { + return numberOfSteps; + } + + /** + * @param numberOfSteps The numberofSteps to set. + */ + public void setNumberOfSteps(int numberOfSteps) { + this.numberOfSteps = numberOfSteps; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleNsData.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleNsData.java new file mode 100644 index 0000000000..0f72045f4e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleNsData.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.vfcmodel; + + +public class ScaleNsData { + + private ScaleNsByStepsData scaleNsByStepsData; + + public ScaleNsByStepsData getScaleNsByStepsData() { + return scaleNsByStepsData; + } + + public void setScaleNsByStepsData(ScaleNsByStepsData scaleNsByStepsData) { + this.scaleNsByStepsData = scaleNsByStepsData; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleResource.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleResource.java new file mode 100644 index 0000000000..4791338aab --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleResource.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.vfcmodel; + + +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/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java new file mode 100644 index 0000000000..970fa43d9f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.vfcmodel; + + +/** + * + *
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-10-18 + */ +public class VimLocation { + 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/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java new file mode 100644 index 0000000000..3c4a35737b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java @@ -0,0 +1,350 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask; + +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.json.JSONObject; +import org.onap.msb.sdk.discovery.common.RouteException; +import org.onap.msb.sdk.httpclient.RestServiceCreater; +import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; +import org.onap.so.bpmn.core.BaseTask; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; +import org.onap.so.db.request.beans.ResourceOperationStatus; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.onap.so.requestsdb.RequestsDbConstant; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public abstract class AbstractSdncOperationTask extends BaseTask { + + private static final Logger logger = LoggerFactory.getLogger(AbstractSdncOperationTask.class); + protected static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, AbstractSdncOperationTask.class); + + @Autowired + private Environment env; + private static final String DEFAULT_MSB_IP = "127.0.0.1"; + private static final int DEFAULT_MSB_PORT = 80; + private static final String SDCADAPTOR_INPUTS = "resourceParameters"; + private static final String TOPOLOGY_PROPERTIES = "topology.properties"; + public static final String ONAP_IP = "ONAP_IP"; + + private static final String POST_BODY_TEMPLATE = "\n"+ + " \n"+ + " $errorCode\n"+ + " $jobId\n"+ + " $operType\n"+ + " $operationId\n"+ + " $progress\n"+ + " $resourceTemplateUUID\n"+ + " $serviceId\n"+ + " $status\n"+ + " $statusDescription\n"+ + " "; + + private static final String GET_BODY_TEMPLATE = " \n" + + " \n" + + " $operationId\n" + + " $resourceTemplateUUID\n" + + " $serviceId\n" + + " "; + + + private void updateResOperStatus(ResourceOperationStatus resourceOperationStatus) throws RouteException { + logger.info("AbstractSdncOperationTask.updateResOperStatus begin!"); + String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint"); + HttpPost httpPost = new HttpPost(requestsdbEndPoint); + httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); + httpPost.addHeader("Content-type", "application/soap+xml"); + String postBody = getPostStringBody(resourceOperationStatus); + httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); + httpPost(requestsdbEndPoint, httpPost); + logger.info("AbstractSdncOperationTask.updateResOperStatus end!"); + } + + protected String getPostbody(Object inputEntity) { + ObjectMapper objectMapper = new ObjectMapper(); + String postBody = null; + try { + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); + postBody = objectMapper.writeValueAsString(inputEntity); + } catch (JsonProcessingException e) { + logger.error(Arrays.toString(e.getStackTrace())); + } + return postBody; + } + + protected String httpPost(String url, HttpPost httpPost) throws RouteException { + logger.info("AbstractSdncOperationTask.httpPost begin!"); + String result = null; + + String errorMsg; + try(CloseableHttpClient httpClient = HttpClients.createDefault()) { + CloseableHttpResponse closeableHttpResponse = httpClient.execute(httpPost); + result = EntityUtils.toString(closeableHttpResponse.getEntity()); + logger.info("result = {}", result); + if(closeableHttpResponse.getStatusLine().getStatusCode() != 200) { + logger.info("exception: fail for status code = {}", closeableHttpResponse.getStatusLine().getStatusCode()); + throw new RouteException(result, "SERVICE_GET_ERR"); + } + + closeableHttpResponse.close(); + } catch (IOException e) { + errorMsg = url + ":httpPostWithJSON connect faild"; + logger.info("exception: POST_CONNECT_FAILD : {}", errorMsg); + throwsRouteException(errorMsg, e, "POST_CONNECT_FAILD"); + } + + logger.info("AbstractSdncOperationTask.httpPost end!"); + return result; + } + + private static void throwsRouteException(String errorMsg, Exception e, String errorCode) throws RouteException { + String msg = errorMsg + ".errorMsg:" + e.getMessage(); + logger.info("exception: {}", msg); + throw new RouteException(errorMsg, errorCode); + } + + private String getPostStringBody(ResourceOperationStatus resourceOperationStatus) { + logger.info("AbstractSdncOperationTask.getPostStringBody begin!"); + String postBody = POST_BODY_TEMPLATE; + postBody = postBody.replace("$errorCode", resourceOperationStatus.getErrorCode()); + postBody = postBody.replace("$jobId", resourceOperationStatus.getJobId()); + postBody = postBody.replace("$operType", resourceOperationStatus.getOperType()); + postBody = postBody.replace("$operationId", resourceOperationStatus.getOperationId()); + postBody = postBody.replace("$progress", resourceOperationStatus.getProgress()); + postBody = postBody.replace("$resourceTemplateUUID", resourceOperationStatus.getResourceTemplateUUID()); + postBody = postBody.replace("$serviceId", resourceOperationStatus.getServiceId()); + postBody = postBody.replace("$status", resourceOperationStatus.getStatus()); + postBody = postBody.replace("$statusDescription", resourceOperationStatus.getStatusDescription()); + logger.info("AbstractSdncOperationTask.getPostStringBody end!"); + return postBody; + } + + private String getGetStringBody(String serviceId, String operationId, String resourceTemplateUUID) { + logger.info("AbstractSdncOperationTask.getGetStringBody begin!"); + String getBody = GET_BODY_TEMPLATE; + getBody = getBody.replace("$operationId", operationId); + getBody = getBody.replace("$resourceTemplateUUID", resourceTemplateUUID); + getBody = getBody.replace("$serviceId", serviceId); + logger.info("AbstractSdncOperationTask.getGetStringBody end!"); + return getBody; + } + + private ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID) throws RouteException { + logger.info("AbstractSdncOperationTask.getResourceOperationStatus begin!"); + String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint"); + HttpPost httpPost = new HttpPost(requestsdbEndPoint); + httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); + httpPost.addHeader("Content-type", "application/soap+xml"); + String getBody = getGetStringBody(serviceId, operationId, resourceTemplateUUID); + httpPost.setEntity(new StringEntity(getBody, ContentType.APPLICATION_XML)); + String result = httpPost(requestsdbEndPoint, httpPost); + ResourceOperationStatus resourceOperationStatus = getResourceOperationStatusFromXmlString(result); + logger.info("AbstractSdncOperationTask.getResourceOperationStatus end!"); + return resourceOperationStatus; + } + + private ResourceOperationStatus getResourceOperationStatusFromXmlString(String result) { + logger.info("AbstractSdncOperationTask.getResourceOperationStatusFromXmlString begin!"); + ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus(); + resourceOperationStatus.setErrorCode(getValueByName("errorCode", result)); + resourceOperationStatus.setJobId(getValueByName("jobId", result)); + resourceOperationStatus.setOperType(getValueByName("operType", result)); + resourceOperationStatus.setOperationId(getValueByName("operationId", result)); + resourceOperationStatus.setProgress(getValueByName("progress", result)); + resourceOperationStatus.setResourceTemplateUUID(getValueByName("resourceTemplateUUID", result)); + resourceOperationStatus.setServiceId(getValueByName("serviceId", result)); + resourceOperationStatus.setStatus(getValueByName("status", result)); + resourceOperationStatus.setStatusDescription(getValueByName("statusDescription", result)); + logger.info("AbstractSdncOperationTask.getResourceOperationStatusFromXmlString end!"); + return resourceOperationStatus; + } + + private String getValueByName(String name, String xml) { + if (!StringUtils.isBlank(xml) && xml.contains(name)) { + String start = "<" + name + ">"; + String end = ""; + return xml.substring(xml.indexOf(start), xml.indexOf(end)).replace(start, ""); + } + return ""; + } + + @Override + public void execute(DelegateExecution execution) { + logger.info("AbstractSdncOperationTask.execute begin!"); + GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(); + try { + Map inputs = getInputs(execution); + + sendRestrequestAndHandleResponse(execution, inputs, genericResourceApiClient); + execution.setVariable("SDNCA_SuccessIndicator", true); + } catch (Exception e) { + logger.info("exception: AbstractSdncOperationTask.fail!"); + logger.error("exception: AbstractSdncOperationTask.fail!:", e); + logger.error(Arrays.toString(e.getStackTrace())); + execution.setVariable("SDNCA_SuccessIndicator", false); + updateProgress(execution, RequestsDbConstant.Status.ERROR, null, "100", "sendRestrequestAndHandleResponse finished!"); + + } + logger.info("AbstractSdncOperationTask.execute end!"); + } + + protected Map getInputs(DelegateExecution execution) { + logger.info("AbstractSdncOperationTask.getInputs begin!"); + Map inputs = new HashMap<>(); + String json = (String) execution.getVariable(SDCADAPTOR_INPUTS); + if (!StringUtils.isBlank(json)) { + JSONObject jsonObject = new JSONObject(json); + JSONObject paras = jsonObject.getJSONObject("additionalParamForNs"); + Iterator iterator = paras.keys(); + while (iterator.hasNext()) { + String key = iterator.next(); + inputs.put(key, paras.getString(key)); + } + } + logger.info("AbstractSdncOperationTask.getInputs end!"); + return inputs; + } + + public abstract void sendRestrequestAndHandleResponse(DelegateExecution execution, + Map inputs, + GenericResourceApi genericResourceApiClient) throws Exception; + + public void updateProgress(DelegateExecution execution, + String status, + String errorCode, + String progress, + String statusDescription) { + logger.info("AbstractSdncOperationTask.updateProgress begin!"); + String serviceId = (String) execution.getVariable("serviceId"); + serviceId = StringUtils.isBlank(serviceId) ? (String) execution.getVariable("serviceInstanceId") : serviceId; + String operationId = (String) execution.getVariable("operationId"); + String resourceTemplateUUID = (String) execution.getVariable("resourceUUID"); + String resourceTemplateId = (String) execution.getVariable("resourceTemplateId"); + resourceTemplateId = StringUtils.isBlank(resourceTemplateId) ? "" : resourceTemplateUUID; + resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? resourceTemplateId : resourceTemplateUUID; + try { + ResourceOperationStatus resourceOperationStatus = getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); + if (!StringUtils.isBlank(status)) { + resourceOperationStatus.setStatus(status); + } + if (!StringUtils.isBlank(errorCode)) { + resourceOperationStatus.setErrorCode(errorCode); + } + if (!StringUtils.isBlank(progress)) { + resourceOperationStatus.setProgress(progress); + } + if (!StringUtils.isBlank(statusDescription)) { + resourceOperationStatus.setStatusDescription(statusDescription); + } + updateResOperStatus(resourceOperationStatus); + logger.info("AbstractSdncOperationTask.updateProgress end!"); + } catch (Exception exception) { + logger.info("exception: AbstractSdncOperationTask.updateProgress fail!"); + logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception); + msoLogger.error(MessageEnum.GENERAL_EXCEPTION, " updateProgress catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, exception.getClass().toString()); + } + } + + + protected boolean isSend2SdncDirectly() { + logger.info("AbstractSdncOperationTask.isSend2SdncDirectly begin!"); + String sdncIp = UrnPropertiesReader.getVariable("sdnc-ip"); + String sdncPort = UrnPropertiesReader.getVariable("sdnc-port"); + if (!StringUtils.isBlank(sdncIp) && isIp(sdncIp) && !StringUtils.isBlank(sdncPort)) { + logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = true."); + return true; + } + + logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = false."); + return false; + } + + protected String getSdncIp() { + logger.info("AbstractSdncOperationTask.getSdncIp begin."); + String sdncIp = null; + sdncIp = UrnPropertiesReader.getVariable("sdnc-ip"); + String returnIp = StringUtils.isBlank(sdncIp) || !isIp(sdncIp) ? null : sdncIp; + logger.info("AbstractSdncOperationTask.getSdncIp: sdncIp = {}", returnIp); + return returnIp; + } + + protected String getSdncPort() { + logger.info("AbstractSdncOperationTask.getSdncPort begin."); + String sdncPort = UrnPropertiesReader.getVariable("sdnc-port"); + String returnPort = StringUtils.isBlank(sdncPort) ? null : sdncPort; + logger.info("AbstractSdncOperationTask.getSdncPort: returnPort = {}", sdncPort); + return returnPort; + } + + private GenericResourceApi getGenericResourceApiClient() { + logger.info("AbstractSdncOperationTask.getGenericResourceApiClient begin!"); + String msbIp = System.getenv().get(ONAP_IP); + int msbPort = DEFAULT_MSB_PORT; + if (StringUtils.isBlank(msbIp) || !isIp(msbIp)) { + msbIp = env.getProperty("msb-ip"); + if (StringUtils.isBlank(msbIp)) { + msbIp = env.getProperty("msb.address", DEFAULT_MSB_IP); + } + } + String strMsbPort = env.getProperty("msb-port"); + if (StringUtils.isBlank(strMsbPort)) { + strMsbPort = env.getProperty("msb.port", String.valueOf(DEFAULT_MSB_PORT)); + } + msbPort = Integer.valueOf(strMsbPort); + + logger.info("AbstractSdncOperationTask.getGenericResourceApiClient msbIp = " + msbIp + " msbPort = " + msbPort); + MSBServiceClient msbClient = new MSBServiceClient(msbIp, msbPort); + RestServiceCreater restServiceCreater = new RestServiceCreater(msbClient); + logger.info("AbstractSdncOperationTask.getGenericResourceApiClient end!"); + return restServiceCreater.createService(GenericResourceApi.class); + } + + protected boolean isIp(String msbIp) { + return !StringUtils.isBlank(msbIp) && msbIp.split("\\.").length == 4; + } + + public String getProcessKey(DelegateExecution execution) { + return execution.getProcessEngineServices().getRepositoryService().getProcessDefinition(execution.getProcessDefinitionId()).getKey(); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java new file mode 100644 index 0000000000..3ef1410425 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.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.bpmn.infrastructure.workflow.serviceTask; + +import java.util.Map; + +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.msb.sdk.discovery.common.RouteException; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.NetworkRpcInputEntityBuilder; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationOutputEntity; +import org.onap.so.logger.MessageEnum; +import org.onap.so.requestsdb.RequestsDbConstant; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +@Component +public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask { + private static final Logger sdncLogger = LoggerFactory.getLogger(SdncNetworkTopologyOperationTask.class); + + + private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation"; + + @Override + public void sendRestrequestAndHandleResponse(DelegateExecution execution, + Map inputs, + GenericResourceApi genericResourceApiClient) throws Exception { + sdncLogger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); + updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "40", "sendRestrequestAndHandleResponse begin!"); + NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder(); + RpcNetworkTopologyOperationInputEntity inputEntity = builder.build(execution, inputs); + updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "50", "RequestBody build finished!"); + RpcNetworkTopologyOperationOutputEntity outputEntity; + if (!isSend2SdncDirectly()) { + outputEntity = genericResourceApiClient.postNetworkTopologyOperation + (HeaderUtil.DefaulAuth, inputEntity).execute().body(); + updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); + saveOutput(execution, outputEntity); + } else { + send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); + } + updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); + sdncLogger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse end!"); + } + + private void send2SdncDirectly(String defaulAuth, + RpcNetworkTopologyOperationInputEntity inputEntity) throws RouteException { + sdncLogger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly begin!"); + String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL; + HttpPost httpPost = new HttpPost(url); + httpPost.addHeader("Authorization", defaulAuth); + httpPost.addHeader("Content-type", "application/json"); + String postBody = getPostbody(inputEntity); + msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC", ""); + httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); + httpPost(url, httpPost); + sdncLogger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly end!"); + } + + private void saveOutput(DelegateExecution execution, RpcNetworkTopologyOperationOutputEntity output) throws RouteException { + sdncLogger.info("SdncNetworkTopologyOperationTask.saveOutput begin!"); + String responseCode = output.getOutput().getResponseCode(); + if (!"200".equals(responseCode)) { + String processKey = getProcessKey(execution); + int errorCode = Integer.parseInt(responseCode); + String errorMessage = output.getOutput().getResponseMessage(); + WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage); + execution.setVariable("SDNCA_SuccessIndicator", workflowException); + updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), "100", errorMessage); + sdncLogger.info("exception: SdncNetworkTopologyOperationTask.saveOutput fail!"); + throw new RouteException(); + } + + sdncLogger.info("SdncNetworkTopologyOperationTask.saveOutput end!"); + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java new file mode 100644 index 0000000000..8e41d0d88e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java @@ -0,0 +1,101 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask; + + +import java.util.Map; + +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.msb.sdk.discovery.common.RouteException; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.ServiceRpcInputEntityBuilder; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationInputEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationOutputEntity; +import org.onap.so.logger.MessageEnum; +import org.onap.so.requestsdb.RequestsDbConstant; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +@Component +public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask { + private static final Logger sdncLogger = LoggerFactory.getLogger(SdncServiceTopologyOperationTask.class); + + + private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation"; + + @Override + public void sendRestrequestAndHandleResponse(DelegateExecution execution, + Map inputs, + GenericResourceApi genericResourceApiClient) throws Exception { + sdncLogger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); + updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!"); + ServiceRpcInputEntityBuilder builder = new ServiceRpcInputEntityBuilder(); + RpcServiceTopologyOperationInputEntity inputEntity = builder.build(execution, inputs); + updateProgress(execution, null, null, "50", "RequestBody build finished!"); + RpcServiceTopologyOperationOutputEntity outputEntity; + if (!isSend2SdncDirectly()) { + outputEntity = genericResourceApiClient.postServiceTopologyOperation + (HeaderUtil.DefaulAuth, inputEntity).execute().body(); + updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); + saveOutput(execution, outputEntity); + } else { + send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); + } + sdncLogger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse end!"); + + } + + private void send2SdncDirectly(String defaulAuth, + RpcServiceTopologyOperationInputEntity inputEntity) throws RouteException { + sdncLogger.info("SdncServiceTopologyOperationTask.send2SdncDirectly begin!"); + String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL; + HttpPost httpPost = new HttpPost(url); + httpPost.addHeader("Authorization", defaulAuth); + httpPost.addHeader("Content-type", "application/json"); + String postBody = getPostbody(inputEntity); + msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC", ""); + httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); + httpPost(url, httpPost); + sdncLogger.info("SdncServiceTopologyOperationTask.send2SdncDirectly end!"); + } + + private void saveOutput(DelegateExecution execution, RpcServiceTopologyOperationOutputEntity output) throws Exception { + sdncLogger.info("SdncServiceTopologyOperationTask.saveOutput begin!"); + String responseCode = output.getOutput().getResponseCode(); + if (!"200".equals(responseCode)) { + String processKey = getProcessKey(execution); + int errorCode = Integer.parseInt(responseCode); + String errorMessage = output.getOutput().getResponseMessage(); + WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage); + execution.setVariable("SDNCA_SuccessIndicator", workflowException); + updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage); + sdncLogger.info("exception: SdncServiceTopologyOperationTask.saveOutput fail!"); + throw new RouteException(); + } + sdncLogger.info("SdncServiceTopologyOperationTask.saveOutput end!"); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java new file mode 100644 index 0000000000..fd844648fa --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask; + +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; +import org.onap.msb.sdk.httpclient.RestServiceCreater; +import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.NetworkRpcInputEntityBuilder; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationOutputEntity; +import org.onap.so.db.request.beans.ResourceOperationStatus; +import org.onap.so.db.request.beans.ResourceOperationStatusId; +import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; +import org.onap.so.logger.MsoLogger; +import org.onap.so.requestsdb.RequestsDbConstant; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class SdncUnderlayVpnOperationClient { + + private static final String DEFAULT_MSB_IP = "127.0.0.1"; + private static final int DEFAULT_MSB_PORT = 10081; + + private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, SdncUnderlayVpnOperationClient.class); + + public boolean excute(String msbIp, + int msbPort, + Map inputs, + String iServiceID, + String iOperationID, + String resourceTemplateUUID_i){ + ResourceOperationStatusId id = new ResourceOperationStatusId(iServiceID, iOperationID, resourceTemplateUUID_i); + GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(msbIp, msbPort); + updateProgress(id, RequestsDbConstant.Status.PROCESSING, null, "10", "execute begin!"); + return sendRestrequestAndHandleResponse(id, inputs, genericResourceApiClient); + } + + public boolean sendRestrequestAndHandleResponse(ResourceOperationStatusId id, Map inputs, GenericResourceApi genericResourceApiClient){ + updateProgress(id, null, null, "40", "sendRestrequestAndHandleResponse begin!"); + NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder(); + RpcNetworkTopologyOperationInputEntity body = builder.build(null, inputs); + updateProgress(id, null, null, "50", "RequestBody build finished!"); + //RpcNetworkTopologyOperationOutputEntity networkRpcOutputEntiy = null; + try { + genericResourceApiClient.postNetworkTopologyOperation(HeaderUtil.DefaulAuth ,body).execute().body(); + } catch (Exception e) { + logger.debug("Exception: ", e); + updateProgress(id, RequestsDbConstant.Status.ERROR, null, null, "sendRestrequestAndHandleResponse exception:" + e.getMessage()); + return false; + } + updateProgress(id, null, null, "90", "sendRestrequestAndHandleResponse finished!"); + updateProgress(id, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); + return true; + } + + private GenericResourceApi getGenericResourceApiClient(String msbIp, int msbPort) { + if (StringUtils.isBlank(msbIp)) { + msbIp = DEFAULT_MSB_IP; + } + if (msbPort <= 0) { + msbPort = DEFAULT_MSB_PORT; + } + MSBServiceClient msbClient = new MSBServiceClient(msbIp, msbPort); + RestServiceCreater restServiceCreater = new RestServiceCreater(msbClient); + return restServiceCreater.createService(GenericResourceApi.class); + } + + public void updateProgress(ResourceOperationStatusId id, String status, + String errorCode, + String progress, + String statusDescription) { + + + ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus();//rosRepo.getOne(id); + if (!StringUtils.isBlank(status)) { + resourceOperationStatus.setStatus(status); + } + if (!StringUtils.isBlank(errorCode)) { + resourceOperationStatus.setErrorCode(errorCode); + } + if (!StringUtils.isBlank(progress)) { + resourceOperationStatus.setProgress(progress); + } + if (!StringUtils.isBlank(statusDescription)) { + resourceOperationStatus.setStatusDescription(statusDescription); + } + //rosRepo.save(resourceOperationStatus); + } + + private void saveOutput() { + // Not implemented. + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java new file mode 100644 index 0000000000..5bd3297c20 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.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.bpmn.infrastructure.workflow.serviceTask; + +import org.apache.commons.lang3.StringUtils; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.core.BaseTask; +import org.onap.so.db.request.beans.ResourceOperationStatus; +import org.onap.so.db.request.beans.ResourceOperationStatusId; +import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class SdncUnderlayVpnPreprocessTask extends BaseTask { + public static final String RESOURCE_OPER_TYPE = "resourceOperType"; + + @Override + public void execute(DelegateExecution execution) { + String operType = getOperType(execution); + execution.setVariable(RESOURCE_OPER_TYPE, operType); + } + + private String getOperType(DelegateExecution execution) { + String serviceId = (String) execution.getVariable("serviceId"); + serviceId = StringUtils.isBlank(serviceId) ? (String) execution.getVariable("serviceInstanceId") : serviceId; + String operationId = (String) execution.getVariable("operationId"); + String resourceTemplateUUID = (String) execution.getVariable("resourceTemplateUUID"); + resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? (String) execution.getVariable("resourceTemplateId") : resourceTemplateUUID; + ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus();//rosRepo.getOne(new ResourceOperationStatusId(serviceId, operationId, resourceTemplateUUID)); + return resourceOperationStatus.getOperType(); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java new file mode 100644 index 0000000000..a837782a2c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client; + +import okhttp3.RequestBody; +import okhttp3.ResponseBody; +import org.onap.msb.sdk.httpclient.annotaion.ServiceHttpEndPoint; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.*; +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.POST; + +@ServiceHttpEndPoint(serviceName = "sdnc", serviceVersion = "v1") +public interface GenericResourceApi { + + @POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation") + Call postNetworkTopologyOperation(@Header("Authorization") String authorization, + @Body RequestBody input); + + @POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation") + Call postNetworkTopologyOperation(@Header("Authorization") String authorization, + @Body RpcNetworkTopologyOperationInputEntity input); + + @POST("/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation") + Call postServiceTopologyOperation(@Header("Authorization") String authorization, + @Body RpcServiceTopologyOperationInputEntity input); + +} + diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java new file mode 100644 index 0000000000..696be02809 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.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.bpmn.infrastructure.workflow.serviceTask.client; + +import java.util.Base64; + +public class HeaderUtil { + + public static final String USER = "admin"; + public static final String PASS = "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"; + public static final String DefaulAuth = getAuthorization(USER, PASS); + + public static String getAuthorization(String usr, String pwd) { + + return "Basic " + base64Encode(usr + ":" + pwd); + } + + private static String base64Encode(String str) { + String base64 = str; + try { + base64 = Base64.getEncoder() + .encodeToString(str.getBytes("utf-8")); + } catch (Exception ex) { + } + return base64; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java new file mode 100644 index 0000000000..961b846ace --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java @@ -0,0 +1,239 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.apache.commons.lang3.StringUtils; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.OnapModelInformationEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ParamEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RequestInformationEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceInformationEntity; +import org.onap.so.requestsdb.RequestsDbConstant; + +public abstract class AbstractBuilder { + + public static final String OPERATION_TYPE = "operationType"; + public static final String RESOURCE_TYPE = "resourceType"; + + public enum RequestAction { + CREATE_NETWORK_INSTANCE(0, "CreateNetworkInstance"), + ACTIVATE_NETWORK_INSTANCE(1, "ActivateNetworkInstance"), + CREATE_SERVICE_INSTANCE(2, "CreateServiceInstance"), + DELETE_SERVICE_INSTANCE(3, "DeleteServiceInstance"), + DELETE_NETWORK_INSTANCE(4, "DeleteNetworkInstance"), + CREATE_VNF_INSTANCE(5, "CreateVnfInstance"), + ACTIVATE_VNF_INSTANCE(6, "ActivateVnfInstance"), + DELETE_VNF_INSTANCE(7, "DeleteVnfInstance"), + CREATE_VF_MODULE_INSTANCE(8, "CreateVfModuleInstance"), + ACTIVATE_VF_MODULE_INSTANCE(9, "ActivateVfModuleInstance"), + DELETE_VF_MODULE_INSTANCE(10, "DeleteVfModuleInstance"), + CREATE_CONTRAIL_ROUTE_INSTANCE(11, "CreateContrailRouteInstance"), + DELETE_CONTRAIL_ROUTE_INSTANCE(12, "DeleteContrailRouteInstance"), + CREATE_SECURITY_ZONE_INSTANCE(13, "CreateSecurityZoneInstance"), + DELETE_SECURITY_ZONE_INSTANCE(14, "DeleteSecurityZoneInstance"), + ACTIVATE_DCI_NETWORK_INSTANCE(15, "ActivateDCINetworkInstance"), + DEACTIVATE_DCI_NETWORK_INSTANCE(16, "DeActivateDCINetworkInstance"); + + String name; + int value; + + private RequestAction(int value, String name) { + this.value = value; + this.name = name; + } + + public String getName() { + return this.name; + } + + public int getIntValue() { + return this.value; + } + } + + public enum SvcAction { + RESERVE(0, "reserve"), + ASSIGN(1, "assign"), + ACTIVATE(2, "activate"), + DELETE(3, "delete"), + CHANGEASSIGN(4, "changeassign"), + CHANGEDELETE(5, "changedelete"), + ROLLBACK(6, "rollback"), + DEACTIVATE(7, "deactivate"), + UNASSIGN(8, "unassign"), + CREATE(9, "create"); + + String name; + int value; + + private SvcAction(int value, String name) { + this.value = value; + this.name = name; + } + + public String getName() { + return this.name; + } + + public int getIntValue() { + return this.value; + } + } + + protected String requestId = null; + + abstract O build(DelegateExecution execution, I input) throws Exception; + + protected String getRequestAction(DelegateExecution execution) { + String action = /*RequestInformation.*/RequestAction.CREATE_NETWORK_INSTANCE.getName(); + String operType = (String) execution.getVariable(OPERATION_TYPE); + String resourceType = (String)execution.getVariable(RESOURCE_TYPE); + if (!StringUtils.isBlank(operType)) { + if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) { + if (isOverlay(resourceType)) { + action = /*RequestInformation.*/RequestAction.DEACTIVATE_DCI_NETWORK_INSTANCE.getName(); + } else if (isUnderlay(resourceType)) { + action = /*RequestInformation.*/RequestAction.DELETE_NETWORK_INSTANCE.getName(); + } else { + action = /*RequestInformation.*/RequestAction.DELETE_SERVICE_INSTANCE.getName(); + } + } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) { + if (isOverlay(resourceType)) { + action = /*RequestInformation.*/RequestAction.ACTIVATE_DCI_NETWORK_INSTANCE.getName(); + } else if (isUnderlay(resourceType)) { + action = /*RequestInformation.*/RequestAction.CREATE_NETWORK_INSTANCE.getName(); + } else { + action = /*RequestInformation.*/RequestAction.CREATE_SERVICE_INSTANCE.getName(); + } + } + } + return action; + } + + private boolean isOverlay(String resourceType) { + return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("overlay"); + } + + private boolean isUnderlay(String resourceType) { + return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("underlay"); + } + + protected String getSvcAction(DelegateExecution execution) { + String action = /*SdncRequestHeader.*/SvcAction.CREATE.getName(); + String operType = (String) execution.getVariable(OPERATION_TYPE); + String resourceType = (String)execution.getVariable(RESOURCE_TYPE); + if (!StringUtils.isBlank(operType)) { + if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) { + if (isOverlay(resourceType)) { + action = /*SdncRequestHeader.*/SvcAction.DEACTIVATE.getName(); + } else if (isUnderlay(resourceType)) { + action = /*SdncRequestHeader.*/SvcAction.DELETE.getName(); + } else { + action = /*SdncRequestHeader.*/SvcAction.UNASSIGN.getName(); + } + } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) { + if (isOverlay(resourceType)) { + action = /*SdncRequestHeader.*/SvcAction.ACTIVATE.getName(); + } else if (isUnderlay(resourceType)) { + action = /*SdncRequestHeader.*/SvcAction.CREATE.getName(); + } else { + action = /*SdncRequestHeader.*/SvcAction.ASSIGN.getName(); + } + } + } + return action; + } + + protected synchronized String getRequestId(DelegateExecution execution) { + if (StringUtils.isBlank(requestId)) { + requestId = (String) execution.getVariable("msoRequestId"); + if (StringUtils.isBlank(requestId)) { + requestId = UUID.randomUUID().toString(); + } + } + return requestId; + } + + protected OnapModelInformationEntity getOnapServiceModelInformationEntity(DelegateExecution execution) { + OnapModelInformationEntity onapModelInformationEntity = new OnapModelInformationEntity(); + String modelInvariantUuid = (String) execution.getVariable("modelInvariantUuid"); + String modelVersion = (String) execution.getVariable("modelVersion"); + String modelUuid = (String) execution.getVariable("modelUuid"); + String modelName = (String) execution.getVariable("serviceModelName"); + onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid); + onapModelInformationEntity.setModelVersion(modelVersion); + onapModelInformationEntity.setModelUuid(modelUuid); + onapModelInformationEntity.setModelName(modelName); + return onapModelInformationEntity; + } + + protected OnapModelInformationEntity getOnapNetworkModelInformationEntity(DelegateExecution execution) { + OnapModelInformationEntity onapModelInformationEntity = new OnapModelInformationEntity(); + String modelInvariantUuid = (String) execution.getVariable("resourceInvariantUUID"); + String modelVersion = (String) execution.getVariable("modelVersion"); + String modelUuid = (String) execution.getVariable("resourceUUID"); + String modelName = (String) execution.getVariable(RESOURCE_TYPE); + onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid); + onapModelInformationEntity.setModelVersion(modelVersion); + onapModelInformationEntity.setModelUuid(modelUuid); + onapModelInformationEntity.setModelName(modelName); + return onapModelInformationEntity; + } + + protected List getParamEntities(Map inputs) { + List paramEntityList = new ArrayList<>(); + if (inputs != null && !inputs.isEmpty()) { + inputs.keySet().forEach(key -> { + ParamEntity paramEntity = new ParamEntity(); + paramEntity.setName(key); + paramEntity.setValue(inputs.get(key)); + paramEntityList.add(paramEntity); + }); + } + return paramEntityList; + } + + protected RequestInformationEntity getRequestInformationEntity(DelegateExecution execution) { + RequestInformationEntity requestInformationEntity = new RequestInformationEntity(); + requestInformationEntity.setRequestId(getRequestId(execution)); + requestInformationEntity.setRequestAction(getRequestAction(execution)); + return requestInformationEntity; + } + + protected ServiceInformationEntity getServiceInformationEntity(DelegateExecution execution) { + ServiceInformationEntity serviceInformationEntity = new ServiceInformationEntity(); + serviceInformationEntity.setServiceId((String) execution.getVariable("serviceInstanceId")); + serviceInformationEntity.setSubscriptionServiceType((String) execution.getVariable("serviceType")); + serviceInformationEntity.setOnapModelInformation(getOnapServiceModelInformationEntity(execution)); + serviceInformationEntity.setServiceInstanceId((String) execution.getVariable("serviceInstanceId")); + serviceInformationEntity.setGlobalCustomerId((String) execution.getVariable("globalSubscriberId")); + return serviceInformationEntity; + } + + protected String getServiceInstanceName(DelegateExecution execution) { + return (String) execution.getVariable("serviceInstanceName"); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java new file mode 100644 index 0000000000..547df2bb3a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.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.bpmn.infrastructure.workflow.serviceTask.client.builder; + +import java.util.List; +import java.util.Map; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkInformationEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkInputParametersEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkRequestInputEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkTopologyOperationInputEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.OnapModelInformationEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ParamEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RequestInformationEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.SdncRequestHeaderEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceInformationEntity; + +public class NetworkRpcInputEntityBuilder extends AbstractBuilder, RpcNetworkTopologyOperationInputEntity> { + + @Override + public RpcNetworkTopologyOperationInputEntity build(DelegateExecution execution, Map inputs) { + RpcNetworkTopologyOperationInputEntity rpcNetworkTopologyOperationInputEntity = new RpcNetworkTopologyOperationInputEntity(); + NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = getNetworkTopologyOperationInputEntity(execution, inputs); + rpcNetworkTopologyOperationInputEntity.setInput(networkTopologyOperationInputEntity); + return rpcNetworkTopologyOperationInputEntity; + } + + private void loadNetwrokRequestInputEntity(Map inputs, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) { + NetworkRequestInputEntity networkRequestInputEntity = new NetworkRequestInputEntity(); + NetworkInputParametersEntity networkInputParametersEntity = new NetworkInputParametersEntity(); + List paramEntityList = getParamEntities(inputs); + networkInputParametersEntity.setParamList(paramEntityList); + networkRequestInputEntity.setNetworkInputPaarameters(networkInputParametersEntity); + networkTopologyOperationInputEntity.setNetworkRequestInput(networkRequestInputEntity); + } + + private void loadRequestInformationEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) { + RequestInformationEntity requestInformationEntity = getRequestInformationEntity(execution); + networkTopologyOperationInputEntity.setRequestInformation(requestInformationEntity); + } + + private void loadSdncRequestHeaderEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) { + SdncRequestHeaderEntity sdncRequestHeaderEntity = new SdncRequestHeaderEntity(); + sdncRequestHeaderEntity.setSvcRequestId(getRequestId(execution)); + sdncRequestHeaderEntity.setSvcAction(getSvcAction(execution)); + networkTopologyOperationInputEntity.setSdncRequestHeader(sdncRequestHeaderEntity); + } + + private void loadServiceInformation(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) { + ServiceInformationEntity serviceInformationEntity = getServiceInformationEntity(execution); + networkTopologyOperationInputEntity.setServiceInformation(serviceInformationEntity); + } + + private NetworkTopologyOperationInputEntity getNetworkTopologyOperationInputEntity(DelegateExecution execution, Map inputs) { + NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = new NetworkTopologyOperationInputEntity(); + loadSdncRequestHeaderEntity(networkTopologyOperationInputEntity, execution); + loadRequestInformationEntity(networkTopologyOperationInputEntity, execution); + loadServiceInformation(networkTopologyOperationInputEntity, execution); + loadNetworkInformationEntity(execution, networkTopologyOperationInputEntity); + loadNetwrokRequestInputEntity(inputs, networkTopologyOperationInputEntity); + return networkTopologyOperationInputEntity; + } + + private void loadNetworkInformationEntity(DelegateExecution execution, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) { + NetworkInformationEntity networkInformationEntity = new NetworkInformationEntity(); + OnapModelInformationEntity onapModelInformationEntity = getOnapNetworkModelInformationEntity(execution); + networkInformationEntity.setOnapModelInformation(onapModelInformationEntity); + networkTopologyOperationInputEntity.setNetworkInformation(networkInformationEntity); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.java new file mode 100644 index 0000000000..466652edff --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.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.bpmn.infrastructure.workflow.serviceTask.client.builder; + +import java.util.Map; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RequestInformationEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationInputEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.SdncRequestHeaderEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceInformationEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceRequestInputEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceTopologyOperationInputEntity; + +public class ServiceRpcInputEntityBuilder extends AbstractBuilder, RpcServiceTopologyOperationInputEntity> { + @Override + public RpcServiceTopologyOperationInputEntity build(DelegateExecution execution, Map inputs) throws Exception { + RpcServiceTopologyOperationInputEntity rpcServiceTopologyOperationInputEntity = new RpcServiceTopologyOperationInputEntity(); + ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity = new ServiceTopologyOperationInputEntity(); + loadSdncRequestHeaderEntity(serviceTopologyOperationInputEntity, execution); + loadRequestInformationEntity(serviceTopologyOperationInputEntity, execution); + loadServiceInformation(serviceTopologyOperationInputEntity, execution); + loadServiceRequestInputEntity(serviceTopologyOperationInputEntity, execution); + rpcServiceTopologyOperationInputEntity.setServiceTopologyOperationInputEntity(serviceTopologyOperationInputEntity); + return rpcServiceTopologyOperationInputEntity; + } + + private void loadServiceRequestInputEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) { + ServiceRequestInputEntity serviceRequestInputEntity = getServiceRequestInputEntity(execution); + serviceTopologyOperationInputEntity.setServiceRequestInput(serviceRequestInputEntity); + } + + private ServiceRequestInputEntity getServiceRequestInputEntity(DelegateExecution execution) { + ServiceRequestInputEntity serviceRequestInputEntity = new ServiceRequestInputEntity(); + serviceRequestInputEntity.setServiceInstanceName(getServiceInstanceName(execution)); + return serviceRequestInputEntity; + } + + private void loadServiceInformation(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) { + ServiceInformationEntity serviceInformationEntity = getServiceInformationEntity(execution); + serviceTopologyOperationInputEntity.setServiceInformation(serviceInformationEntity); + } + + private void loadRequestInformationEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) { + RequestInformationEntity requestInformationEntity = getRequestInformationEntity(execution); + serviceTopologyOperationInputEntity.setRequestInformation(requestInformationEntity); + } + + private void loadSdncRequestHeaderEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) { + SdncRequestHeaderEntity sdncRequestHeaderEntity = new SdncRequestHeaderEntity(); + sdncRequestHeaderEntity.setSvcRequestId(getRequestId(execution)); + sdncRequestHeaderEntity.setSvcAction(getSvcAction(execution)); + serviceTopologyOperationInputEntity.setSdncRequestHeader(sdncRequestHeaderEntity); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java new file mode 100644 index 0000000000..6ef9676ebb --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class NetworkInformationEntity { + @JsonProperty("GENERIC-RESOURCE-API:network-id") + private String networkId; + + @JsonProperty("GENERIC-RESOURCE-API:network-type") + private String networkType; + + @JsonProperty("GENERIC-RESOURCE-API:onap-model-information") + private OnapModelInformationEntity onapModelInformation; + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getNetworkType() { + return networkType; + } + + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + + public OnapModelInformationEntity getOnapModelInformation() { + return onapModelInformation; + } + + public void setOnapModelInformation(OnapModelInformationEntity onapModelInformation) { + this.onapModelInformation = onapModelInformation; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputParametersEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputParametersEntity.java new file mode 100644 index 0000000000..0863917f21 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputParametersEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public class NetworkInputParametersEntity { + @JsonProperty("GENERIC-RESOURCE-API:param") + private List paramList; + + public List getParamList() { + return paramList; + } + + public void setParamList(List paramList) { + this.paramList = paramList; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java new file mode 100644 index 0000000000..e43291cf0c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class NetworkRequestInputEntity { + @JsonProperty("GENERIC-RESOURCE-API:network-name") + private String networkName; + + @JsonProperty("GENERIC-RESOURCE-API:tenant") + private String tenant; + + @JsonProperty("GENERIC-RESOURCE-API:aic-cloud-region") + private String aicCloudRegion; + + @JsonProperty("GENERIC-RESOURCE-API:aic-clli") + private String aicClli; + + @JsonProperty("GENERIC-RESOURCE-API:network-input-parameters") + private NetworkInputParametersEntity networkInputPaarameters; + + public String getNetworkName() { + return networkName; + } + + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + + public String getTenant() { + return tenant; + } + + public void setTenant(String tenant) { + this.tenant = tenant; + } + + public String getAicCloudRegion() { + return aicCloudRegion; + } + + public void setAicCloudRegion(String aicCloudRegion) { + this.aicCloudRegion = aicCloudRegion; + } + + public String getAicClli() { + return aicClli; + } + + public void setAicClli(String aicClli) { + this.aicClli = aicClli; + } + + public NetworkInputParametersEntity getNetworkInputPaarameters() { + return networkInputPaarameters; + } + + public void setNetworkInputPaarameters(NetworkInputParametersEntity networkInputPaarameters) { + this.networkInputPaarameters = networkInputPaarameters; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java new file mode 100644 index 0000000000..3094ea26c3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class NetworkResponseInformationEntity { + @JsonProperty("GENERIC-RESOURCE-API:instance-id") + private String instanceId; + + @JsonProperty("GENERIC-RESOURCE-API:object-path") + private String objectPath; + + public String getInstanceId() { + return instanceId; + } + + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + public String getObjectPath() { + return objectPath; + } + + public void setObjectPath(String objectPath) { + this.objectPath = objectPath; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java new file mode 100644 index 0000000000..e4e37476e5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class NetworkTopologyOperationInputEntity { + @JsonProperty("GENERIC-RESOURCE-API:sdnc-request-header") + private SdncRequestHeaderEntity sdncRequestHeader; + + @JsonProperty("GENERIC-RESOURCE-API:request-information") + private RequestInformationEntity requestInformation; + + @JsonProperty("GENERIC-RESOURCE-API:service-information") + private ServiceInformationEntity serviceInformation; + + @JsonProperty("GENERIC-RESOURCE-API:network-information") + private NetworkInformationEntity networkInformation; + + @JsonProperty("GENERIC-RESOURCE-API:network-request-input") + private NetworkRequestInputEntity networkRequestInput; + + public SdncRequestHeaderEntity getSdncRequestHeader() { + return sdncRequestHeader; + } + + public void setSdncRequestHeader(SdncRequestHeaderEntity sdncRequestHeader) { + this.sdncRequestHeader = sdncRequestHeader; + } + + public RequestInformationEntity getRequestInformation() { + return requestInformation; + } + + public void setRequestInformation(RequestInformationEntity requestInformation) { + this.requestInformation = requestInformation; + } + + public ServiceInformationEntity getServiceInformation() { + return serviceInformation; + } + + public void setServiceInformation(ServiceInformationEntity serviceInformation) { + this.serviceInformation = serviceInformation; + } + + public NetworkInformationEntity getNetworkInformation() { + return networkInformation; + } + + public void setNetworkInformation(NetworkInformationEntity networkInformation) { + this.networkInformation = networkInformation; + } + + public NetworkRequestInputEntity getNetworkRequestInput() { + return networkRequestInput; + } + + public void setNetworkRequestInput(NetworkRequestInputEntity networkRequestInput) { + this.networkRequestInput = networkRequestInput; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java new file mode 100644 index 0000000000..19fca650bd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class NetworkTopologyOperationOutputEntity { + @JsonProperty("GENERIC-RESOURCE-API:svc-request-id") + private String svcRequestId; + + @JsonProperty("GENERIC-RESOURCE-API:response-code") + private String responseCode; + + @JsonProperty("GENERIC-RESOURCE-API:response-message") + private String responseMessage; + + @JsonProperty("GENERIC-RESOURCE-API:ack-final-indicator") + private String ackFinalIndicator; + + @JsonProperty("GENERIC-RESOURCE-API:network-response-information") + private NetworkResponseInformationEntity networkResponseInformation; + + @JsonProperty("GENERIC-RESOURCE-API:service-response-information") + private ServiceResponseInformationEntity serviceResponseInformation; + + public String getSvcRequestId() { + return svcRequestId; + } + + public void setSvcRequestId(String svcRequestId) { + this.svcRequestId = svcRequestId; + } + + public String getResponseCode() { + return responseCode; + } + + public void setResponseCode(String responseCode) { + this.responseCode = responseCode; + } + + public String getResponseMessage() { + return responseMessage; + } + + public void setResponseMessage(String responseMessage) { + this.responseMessage = responseMessage; + } + + public String getAckFinalIndicator() { + return ackFinalIndicator; + } + + public void setAckFinalIndicator(String ackFinalIndicator) { + this.ackFinalIndicator = ackFinalIndicator; + } + + public NetworkResponseInformationEntity getNetworkResponseInformation() { + return networkResponseInformation; + } + + public void setNetworkResponseInformation(NetworkResponseInformationEntity networkResponseInformation) { + this.networkResponseInformation = networkResponseInformation; + } + + public ServiceResponseInformationEntity getServiceResponseInformation() { + return serviceResponseInformation; + } + + public void setServiceResponseInformation(ServiceResponseInformationEntity serviceResponseInformation) { + this.serviceResponseInformation = serviceResponseInformation; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java new file mode 100644 index 0000000000..c5e9f5e61c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class OnapModelInformationEntity { + @JsonProperty("GENERIC-RESOURCE-API:model-invariant-uuid") + private String modelInvariantUuid; + + @JsonProperty("GENERIC-RESOURCE-API:model-customization-uuid") + private String modelCustomizationUuid; + + @JsonProperty("GENERIC-RESOURCE-API:model-uuid") + private String modelUuid; + + @JsonProperty("GENERIC-RESOURCE-API:model-version") + private String modelVersion; + + @JsonProperty("GENERIC-RESOURCE-API:model-name") + private String modelName; + + public String getModelInvariantUuid() { + return modelInvariantUuid; + } + + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + + public String getModelCustomizationUuid() { + return modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public String getModelUuid() { + return modelUuid; + } + + public void setModelUuid(String modelUuid) { + this.modelUuid = modelUuid; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java new file mode 100644 index 0000000000..05f8d40dcb --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ParamEntity { + @JsonProperty("GENERIC-RESOURCE-API:name") + private String name; + + @JsonProperty("GENERIC-RESOURCE-API:value") + private String value; + + 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; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java new file mode 100644 index 0000000000..af448942cc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class RequestInformationEntity { + @JsonProperty("GENERIC-RESOURCE-API:request-id") + private String requestId; + + @JsonProperty("GENERIC-RESOURCE-API:request-action") + private String requestAction; + + @JsonProperty("GENERIC-RESOURCE-API:source") + private String source; + + @JsonProperty("GENERIC-RESOURCE-API:notification-url") + private String notificationUrl; + + @JsonProperty("GENERIC-RESOURCE-API:order-number") + private String orderUnmber; + + @JsonProperty("GENERIC-RESOURCE-API:order-version") + private String orerVersion; + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public String getRequestAction() { + return requestAction; + } + + public void setRequestAction(String requestAction) { + this.requestAction = requestAction; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getNotificationUrl() { + return notificationUrl; + } + + public void setNotificationUrl(String notificationUrl) { + this.notificationUrl = notificationUrl; + } + + public String getOrderUnmber() { + return orderUnmber; + } + + public void setOrderUnmber(String orderUnmber) { + this.orderUnmber = orderUnmber; + } + + public String getOrerVersion() { + return orerVersion; + } + + public void setOrerVersion(String orerVersion) { + this.orerVersion = orerVersion; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java new file mode 100644 index 0000000000..4e58a61750 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class RpcNetworkTopologyOperationInputEntity { + @JsonProperty("GENERIC-RESOURCE-API:input") + private NetworkTopologyOperationInputEntity input = null; + + public NetworkTopologyOperationInputEntity getInput() { + return input; + } + + public void setInput(NetworkTopologyOperationInputEntity input) { + this.input = input; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java new file mode 100644 index 0000000000..915a8a5e39 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class RpcNetworkTopologyOperationOutputEntity { + @JsonProperty("GENERIC-RESOURCE-API:output") + private NetworkTopologyOperationOutputEntity output; + + public NetworkTopologyOperationOutputEntity getOutput() { + return output; + } + + public void setOutput(NetworkTopologyOperationOutputEntity output) { + this.output = output; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java new file mode 100644 index 0000000000..145759e190 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class RpcServiceTopologyOperationInputEntity { + @JsonProperty("GENERIC-RESOURCE-API:input") + private ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity; + + public ServiceTopologyOperationInputEntity getServiceTopologyOperationInputEntity() { + return serviceTopologyOperationInputEntity; + } + + public void setServiceTopologyOperationInputEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity) { + this.serviceTopologyOperationInputEntity = serviceTopologyOperationInputEntity; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java new file mode 100644 index 0000000000..bccd8c3d50 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class RpcServiceTopologyOperationOutputEntity { + @JsonProperty("GENERIC-RESOURCE-API:output") + private ServiceTopologyOperationOutputEntity output; + + public ServiceTopologyOperationOutputEntity getOutput() { + return output; + } + + public void setOutput(ServiceTopologyOperationOutputEntity output) { + this.output = output; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java new file mode 100644 index 0000000000..a5d806a2dc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class SdncRequestHeaderEntity { + @JsonProperty("GENERIC-RESOURCE-API:svc-request-id") + private String svcRequestId; + + @JsonProperty("GENERIC-RESOURCE-API:svc-action") + private String svcAction; + + @JsonProperty("GENERIC-RESOURCE-API:svc-notification-url") + private String svcNotificationUrl; + + public String getSvcRequestId() { + return svcRequestId; + } + + public void setSvcRequestId(String svcRequestId) { + this.svcRequestId = svcRequestId; + } + + public String getSvcAction() { + return svcAction; + } + + public void setSvcAction(String svcAction) { + this.svcAction = svcAction; + } + + public String getSvcNotificationUrl() { + return svcNotificationUrl; + } + + public void setSvcNotificationUrl(String svcNotificationUrl) { + this.svcNotificationUrl = svcNotificationUrl; + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java new file mode 100644 index 0000000000..1b6ac4939b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ServiceInformationEntity { + @JsonProperty("GENERIC-RESOURCE-API:service-id") + private String serviceId; + + @JsonProperty("GENERIC-RESOURCE-API:subscription-service-type") + private String subscriptionServiceType; + + @JsonProperty("GENERIC-RESOURCE-API:onap-model-information") + private OnapModelInformationEntity onapModelInformation; + + @JsonProperty("GENERIC-RESOURCE-API:service-instance-id") + private String serviceInstanceId; + + @JsonProperty("GENERIC-RESOURCE-API:global-customer-id") + private String globalCustomerId; + + @JsonProperty("GENERIC-RESOURCE-API:subscriber-name") + private String subscriberName; + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + + public OnapModelInformationEntity getOnapModelInformation() { + return onapModelInformation; + } + + public void setOnapModelInformation(OnapModelInformationEntity onapModelInformation) { + this.onapModelInformation = onapModelInformation; + } + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + public String getGlobalCustomerId() { + return globalCustomerId; + } + + public void setGlobalCustomerId(String globalCustomerId) { + this.globalCustomerId = globalCustomerId; + } + + public String getSubscriberName() { + return subscriberName; + } + + public void setSubscriberName(String subscriberName) { + this.subscriberName = subscriberName; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java new file mode 100644 index 0000000000..c1ba7dc614 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public class ServiceInputParametersEntity { + @JsonProperty("GENERIC-RESOURCE-API:param") + private List paramList; + + public List getParamList() { + return paramList; + } + + public void setParamList(List paramList) { + this.paramList = paramList; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java new file mode 100644 index 0000000000..0bdb9cf565 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ServiceRequestInputEntity { + + @JsonProperty("GENERIC-RESOURCE-API:service-instance-name") + private String serviceInstanceName; + + @JsonProperty("GENERIC-RESOURCE-API:service-input-parameters") + private ServiceInputParametersEntity serviceInputParametersEntity; + + public String getServiceInstanceName() { + return serviceInstanceName; + } + + public void setServiceInstanceName(String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + } + + public ServiceInputParametersEntity getServiceInputParametersEntity() { + return serviceInputParametersEntity; + } + + public void setServiceInputParametersEntity(ServiceInputParametersEntity serviceInputParametersEntity) { + this.serviceInputParametersEntity = serviceInputParametersEntity; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java new file mode 100644 index 0000000000..8a50f909f9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ServiceResponseInformationEntity { + @JsonProperty("GENERIC-RESOURCE-API:instance-id") + private String instanceId; + + @JsonProperty("GENERIC-RESOURCE-API:object-path") + private String objectPath; + + public String getInstanceId() { + return instanceId; + } + + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + public String getObjectPath() { + return objectPath; + } + + public void setObjectPath(String objectPath) { + this.objectPath = objectPath; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java new file mode 100644 index 0000000000..ff3d3943e6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ServiceTopologyOperationInputEntity { + @JsonProperty("GENERIC-RESOURCE-API:sdnc-request-header") + private SdncRequestHeaderEntity sdncRequestHeader; + + @JsonProperty("GENERIC-RESOURCE-API:request-information") + private RequestInformationEntity requestInformation; + + @JsonProperty("GENERIC-RESOURCE-API:service-information") + private ServiceInformationEntity serviceInformation; + + @JsonProperty("GENERIC-RESOURCE-API:service-request-input") + private ServiceRequestInputEntity serviceRequestInput; + + public SdncRequestHeaderEntity getSdncRequestHeader() { + return sdncRequestHeader; + } + + public void setSdncRequestHeader(SdncRequestHeaderEntity sdncRequestHeader) { + this.sdncRequestHeader = sdncRequestHeader; + } + + public RequestInformationEntity getRequestInformation() { + return requestInformation; + } + + public void setRequestInformation(RequestInformationEntity requestInformation) { + this.requestInformation = requestInformation; + } + + public ServiceInformationEntity getServiceInformation() { + return serviceInformation; + } + + public void setServiceInformation(ServiceInformationEntity serviceInformation) { + this.serviceInformation = serviceInformation; + } + + public ServiceRequestInputEntity getServiceRequestInput() { + return serviceRequestInput; + } + + public void setServiceRequestInput(ServiceRequestInputEntity serviceRequestInput) { + this.serviceRequestInput = serviceRequestInput; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java new file mode 100644 index 0000000000..502b897def --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ServiceTopologyOperationOutputEntity { + @JsonProperty("GENERIC-RESOURCE-API:svc-request-id") + private String svcRequestId; + + @JsonProperty("GENERIC-RESOURCE-API:response-code") + private String responseCode; + + @JsonProperty("GENERIC-RESOURCE-API:response-message") + private String responseMessage; + + @JsonProperty("GENERIC-RESOURCE-API:ack-final-indicator") + private String ackFinalIndicator; + + @JsonProperty("GENERIC-RESOURCE-API:service-response-information") + private ServiceResponseInformationEntity serviceResponseInformation; + + public String getSvcRequestId() { + return svcRequestId; + } + + public void setSvcRequestId(String svcRequestId) { + this.svcRequestId = svcRequestId; + } + + public String getResponseCode() { + return responseCode; + } + + public void setResponseCode(String responseCode) { + this.responseCode = responseCode; + } + + public String getResponseMessage() { + return responseMessage; + } + + public void setResponseMessage(String responseMessage) { + this.responseMessage = responseMessage; + } + + public String getAckFinalIndicator() { + return ackFinalIndicator; + } + + public void setAckFinalIndicator(String ackFinalIndicator) { + this.ackFinalIndicator = ackFinalIndicator; + } + + public ServiceResponseInformationEntity getServiceResponseInformation() { + return serviceResponseInformation; + } + + public void setServiceResponseInformation(ServiceResponseInformationEntity serviceResponseInformation) { + this.serviceResponseInformation = serviceResponseInformation; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/resources/dmaap.properties b/bpmn/so-bpmn-infrastructure-common/src/main/resources/dmaap.properties new file mode 100644 index 0000000000..a1286b056c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/resources/dmaap.properties @@ -0,0 +1,8 @@ +protocol=http +uriPathPrefix = events +eventReadyTopicName=unauthenticated.PNF_READY +consumerId=consumerId +consumerGroup=group +clientThreadDelayInSeconds=5 + +pnfDefaultTimeout=P14D diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllBPMNTestSuites.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllBPMNTestSuites.java new file mode 100644 index 0000000000..0f77e41120 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllBPMNTestSuites.java @@ -0,0 +1,32 @@ +/*- + * ============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.bpmn; +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses({"**/service/*Test.class", "**/process/*Test.class", "**/subprocess/*Test.class"}) +public class AllBPMNTestSuites { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTasksTestsTestSuite.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTasksTestsTestSuite.java new file mode 100644 index 0000000000..57d842f8b5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTasksTestsTestSuite.java @@ -0,0 +1,32 @@ +/*- + * ============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.bpmn; +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses({"**/tasks/*Test.class","**/infrastructure/aai/*Test.class"}) +public class AllTasksTestsTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java new file mode 100644 index 0000000000..0c0f38c0f9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java @@ -0,0 +1,35 @@ +/*- + * ============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.bpmn; + +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses({"!**/service/*Test.class", "!**/subprocess/*Test.class", "!**/process/*Test.class", + "!**/tasks/*Test.class", "!**/infrastructure/aai/*Test.class", + "!**/scripts/*Test.class", "**/*Test.class"}) +public class AllTestsTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/BeansTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/BeansTest.java new file mode 100644 index 0000000000..f69521fd76 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/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.bpmn.infrastructure; + +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; + + +public class BeansTest { + + + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + private PojoClassFilter enumFilter = new FilterEnum(); + + + @Test + public void pojoStructure() { + test("org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create() + .with(new GetterMustExistRule()) + .with(new SetterMustExistRule()) + + .with(new SetterTester()) + .with(new GetterTester()) + .with(new SetterTester()) + .with(new GetterTester()) + + .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/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java new file mode 100644 index 0000000000..ad9e210452 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java @@ -0,0 +1,52 @@ +/*- + * ============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.bpmn.infrastructure; + +import org.onap.so.security.MSOSpringFirewall; +import org.onap.so.security.WebSecurityConfig; +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 +public class WebSecurityConfigImpl extends WebSecurityConfig { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.csrf().disable() + .authorizeRequests() + .antMatchers("/manage/health","/manage/info").permitAll() + .antMatchers("/async/services/**", "/workflow/services/*", "/SDNCAdapterCallbackService", "/WorkflowMessage", "/vnfAdapterNotify", "/vnfAdapterRestNotify") + .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/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java new file mode 100644 index 0000000000..7d3d298c68 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java @@ -0,0 +1,197 @@ +/*- + * ============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.bpmn.infrastructure.aai; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.HashMap; +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.mockito.Spy; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +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; + +@RunWith(MockitoJUnitRunner.class) +public class AAICreateResourcesTest { + + private AAICreateResources aaiCreateResources; + + private String projectName; + private String serviceInstanceId; + private String owningEntityId; + private String owningEntityName; + private String platformName; + private String vnfId; + private String lineOfBusiness; + private String globalCustomerId; + private String serviceType; + + @Spy + private AAIResourcesClient aaiResourcesClient; + + @Before + public void before() { + + + aaiCreateResources = new AAICreateResources(); + aaiCreateResources.setAaiClient(aaiResourcesClient); + + projectName = "projectName"; + serviceInstanceId = "serviceInstanceId"; + owningEntityId = "owningEntityId"; + owningEntityName = "owningEntityName"; + platformName = "platformName"; + vnfId = "vnfId"; + lineOfBusiness = "lineOfBusiness"; + globalCustomerId = "globalCustomerId"; + serviceType = "serviceType"; + } + + @Test + public void createAAIProjectTest() { + doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), isA(Optional.class)); + doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + + aaiCreateResources.createAAIProject(projectName, serviceInstanceId); + + AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); + + verify(aaiResourcesClient, times(1)).createIfNotExists(projectURI, Optional.empty()); + verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + } + + @Test + public void createAAIOwningEntityTest() { + doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), isA(Optional.class)); + doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + + aaiCreateResources.createAAIOwningEntity(owningEntityId, owningEntityName, serviceInstanceId); + + HashMap owningEntityMap = new HashMap<>(); + owningEntityMap.put("owning-entity-name", owningEntityName); + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + + verify(aaiResourcesClient, times(1)).createIfNotExists(owningEntityURI, Optional.of(owningEntityMap)); + verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + } + + @Test + public void existsOwningEntityTest() { + doReturn(true).when(aaiResourcesClient).exists(isA(AAIResourceUri.class)); + + boolean expectedBoolean = aaiCreateResources.existsOwningEntity(owningEntityId); + + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + + verify(aaiResourcesClient, times(1)).exists(owningEntityURI); + assertTrue(expectedBoolean); + } + + @Test + public void connectOwningEntityandServiceInstanceTest() { + doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + + aaiCreateResources.connectOwningEntityandServiceInstance(owningEntityId, serviceInstanceId); + + verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + } + + @Test + public void createAAIPlatformTest() { + doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), isA(Optional.class)); + doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + + aaiCreateResources.createAAIPlatform(platformName, vnfId); + + AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName); + + verify(aaiResourcesClient, times(1)).createIfNotExists(platformURI, Optional.empty()); + verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + } + + @Test + public void createAAILineOfBusinessTest() { + doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), isA(Optional.class)); + doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + + aaiCreateResources.createAAILineOfBusiness(lineOfBusiness, vnfId); + + AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness); + + verify(aaiResourcesClient, times(1)).createIfNotExists(lineOfBusinessURI, Optional.empty()); + verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + } + + @Test + public void createAAIServiceInstanceTest() { + doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), isA(Optional.class)); + + aaiCreateResources.createAAIServiceInstance(globalCustomerId, serviceType, serviceInstanceId); + + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId,serviceType,serviceInstanceId); + + verify(aaiResourcesClient, times(1)).createIfNotExists(serviceInstanceURI, Optional.empty()); + } + + @Test + public void getVnfInstanceTest() { + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper("vnfUriAaiResponse"); + + doReturn(aaiResultWrapper).when(aaiResourcesClient).get(isA(AAIResourceUri.class)); + + Optional actualVnf = aaiCreateResources.getVnfInstance(vnfId); + + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + + verify(aaiResourcesClient, times(1)).get(vnfURI); + assertEquals(actualVnf, aaiResultWrapper.asBean(GenericVnf.class)); + } + + @Test + public void getVnfInstanceExceptionTest() { + doThrow(Exception.class).when(aaiResourcesClient).get(isA(AAIResourceUri.class)); + + Optional actualVnf = aaiCreateResources.getVnfInstance(vnfId); + + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + + verify(aaiResourcesClient, times(1)).get(vnfURI); + assertEquals(actualVnf, Optional.empty()); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java new file mode 100644 index 0000000000..5808a330a3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java @@ -0,0 +1,84 @@ +/*- + * ============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.bpmn.infrastructure.aai; + +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; + +public class AAIDeleteServiceInstanceTest { + private AAIDeleteServiceInstance aaiDeleteServiceInstance; + @Mock + private DelegateExecution execution; + + @Mock + private AAIResourcesClient aaiResourcesClient; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + + @Before + public void before() { + MockitoAnnotations.initMocks(this); + + aaiDeleteServiceInstance = new AAIDeleteServiceInstance(); + aaiDeleteServiceInstance.setAaiClient(aaiResourcesClient); + } + + @Test + public void executeTest() throws Exception { + doReturn("serviceInstanceId").when(execution).getVariable("serviceInstanceId"); + doNothing().when(aaiResourcesClient).delete(isA(AAIResourceUri.class)); + doNothing().when(execution).setVariable(isA(String.class), isA(Boolean.class)); + + aaiDeleteServiceInstance.execute(execution); + + verify(execution, times(1)).getVariable("serviceInstanceId"); + verify(aaiResourcesClient, times(1)).delete(isA(AAIResourceUri.class)); + verify(execution, times(1)).setVariable("GENDS_SuccessIndicator", true); + } + + @Test + public void executeExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doReturn("testProcessKey").when(execution).getVariable("testProcessKey"); + doReturn("serviceInstanceId").when(execution).getVariable("serviceInstanceId"); + doThrow(Exception.class).when(aaiResourcesClient).delete(isA(AAIResourceUri.class)); + + aaiDeleteServiceInstance.execute(execution); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstanceTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstanceTest.java new file mode 100644 index 0000000000..e17d3f8fb5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstanceTest.java @@ -0,0 +1,114 @@ +/*- + * ============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.bpmn.infrastructure.aai; + +import org.junit.Test; + + +public class AAIServiceInstanceTest { + + AAIServiceInstance test = new AAIServiceInstance("serviceInstanceName","serviceType","serviceRole","orchestrationStatus","modelInvariantUuid","modelVersionId","environmentContext","workloadContext"); + + @Test + public void getServiceInstanceNameTest() throws Exception { + test.getServiceInstanceName(); + } + + @Test + public void setServiceInstanceNameTest() throws Exception { + test.setServiceInstanceName("serviceInstanceName"); + } + + @Test + public void getServiceTypeTest() throws Exception { + test.getServiceType(); + } + + @Test + public void setServiceTypeTest() throws Exception { + test.setServiceType("serviceType"); + } + + + @Test + public void getServiceRoleTest() throws Exception { + test.getServiceRole(); + } + + @Test + public void setServiceRoleTest() throws Exception { + test.setServiceRole("serviceRole"); + } + + @Test + public void getOrchestrationStatusTest() throws Exception { + test.getOrchestrationStatus(); + } + + @Test + public void setOrchestrationStatusTest() throws Exception { + test.setOrchestrationStatus("status"); + } + + @Test + public void getModelInvariantUuidTest() throws Exception { + test.getModelInvariantUuid(); + } + + @Test + public void setModelInvariantUuidTest() throws Exception { + test.setModelInvariantUuid("uuid"); + } + + @Test + public void getModelVersionIdTest() throws Exception { + test.getModelVersionId(); + } + + @Test + public void setModelVersionIdTest() throws Exception { + test.setModelVersionId("versionId"); + } + + @Test + public void getEnvironmentContextTest() throws Exception { + test.getEnvironmentContext(); + } + + @Test + public void setEnvironmentContextTest() throws Exception { + test.setEnvironmentContext("context"); + } + + @Test + public void getWorkloadContextTest() throws Exception { + test.getWorkloadContext(); + } + + @Test + public void setWorkloadContextTest() throws Exception { + test.setWorkloadContext("context"); + } + +} + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGeneratorTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGeneratorTest.java new file mode 100644 index 0000000000..ebcce191e9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGeneratorTest.java @@ -0,0 +1,58 @@ +/*- + * ============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.bpmn.infrastructure.common.name.generation; + + +import static org.junit.Assert.assertEquals; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.MockitoAnnotations; +import org.onap.so.bpmn.infrastructure.common.name.generation.AAIObjectInstanceNameGenerator; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; + + +public class AAIObjectInstanceNameGeneratorTest { + + @Before + public void before() { + } + + @Test + public void generateInstanceGroupNameTest() throws Exception { + + ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup(); + modelVnfc.setFunction("vre"); + modelVnfc.setType("VNFC"); + + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId("test-001"); + instanceGroup.setModelInfoInstanceGroup(modelVnfc); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnf-123"); + vnf.setVnfName("test-vnf"); + + assertEquals("test-vnf_vre", new AAIObjectInstanceNameGenerator().generateInstanceGroupName(instanceGroup, vnf)); + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java new file mode 100644 index 0000000000..24d1810ac6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.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.bpmn.infrastructure.pnf.dmaap; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.List; +import org.junit.Test; +import org.onap.so.bpmn.infrastructure.pnf.dmaap.JsonUtilForCorrelationId; + +public class JsonUtilForCorrelationIdTest { + + private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[\n" + + " {\n" + + " \"pnfRegistrationFields\" : {\n" + + " \"correlationId\" : \"corrTest1\",\n" + + " \"value\" : \"value1\"\n" + + " }\n" + + " },\n" + + " {\n" + + " \"pnfRegistrationFields\" : {\n" + + " \"correlationId\" : \"corrTest2\",\n" + + " \"value\" : \"value2\"\n" + + " }\n" + + " }\n" + + "]"; + + private static final String JSON_EXAMPLE_WITH_CORRELATION_ID2 = "{\"pnfRegistrationFields\":{\"correlationId\":\"corrTest3\"}}"; + private static final String JSON_EXAMPLE_WITH_CORRELATION_ID3 = "[\"{\\\"pnfRegistrationFields\\\":" + + "{\\\"correlationId\\\":\\\"corrTest4\\\"}}\", \"{\\\"pnfRegistrationFields\\\":" + + "{\\\"correlationId\\\":\\\"corrTest5\\\"}}\"]"; + private static final String JSON_EXAMPLE_WITH_CORRELATION_ID4 = "{\"header\":{\"key\":\"value\"}}"; + + @Test + public void parseJsonSuccessful() { + List expectedResult = JsonUtilForCorrelationId + .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID); + assertThat(expectedResult).containsExactly("corrTest1", "corrTest2"); + + List expectedResult2 = JsonUtilForCorrelationId + .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID2); + assertThat(expectedResult2).containsExactly("corrTest3"); + } + + @Test + public void parseJsonWithEscapeCharacters_Successful() { + List expectedResult = JsonUtilForCorrelationId + .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID3); + assertThat(expectedResult).containsExactly("corrTest4", "corrTest5"); + } + + @Test + public void parseJson_emptyListReturnedWhenNothingFound() { + List expectedResult = JsonUtilForCorrelationId + .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID4); + assertThat(expectedResult).isEmpty(); + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/vfcmodel/VfcModelPojoTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/vfcmodel/VfcModelPojoTest.java new file mode 100644 index 0000000000..239361d306 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/vfcmodel/VfcModelPojoTest.java @@ -0,0 +1,45 @@ +/*- + * ============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.bpmn.infrastructure.vfcmodel; + +import org.junit.Test; + +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.NoNestedClassRule; +import com.openpojo.validation.rule.impl.NoPublicFieldsRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + +public class VfcModelPojoTest { + private String packageName = "org.onap.so.bpmn.infrastructure.vfcmodel"; + + @Test + public void validate() { + Validator validator = ValidatorBuilder.create() + .with(new NoNestedClassRule()) + .with(new NoPublicFieldsRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .build(); + validator.validate(packageName); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java new file mode 100644 index 0000000000..ca8ec22088 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java @@ -0,0 +1,34 @@ +/*- + * ============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.bpmn.infrastructure.workflow.serviceTask.client; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class HeaderUtilTest { + + @Test + public void getAuthorizationTest() throws Exception { + String authorization = HeaderUtil.getAuthorization(HeaderUtil.USER, HeaderUtil.PASS); + assertEquals("Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==", authorization); + } + +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java new file mode 100644 index 0000000000..828e3fca47 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java @@ -0,0 +1,570 @@ +/*- + * ============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.bpmn.infrastructure.workflow.serviceTask.client.builder; + +import static org.junit.Assert.assertEquals; + +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.runtime.Incident; +import org.camunda.bpm.engine.variable.VariableMap; +import org.camunda.bpm.engine.variable.value.TypedValue; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.camunda.bpm.model.bpmn.instance.FlowElement; +import org.junit.Test; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder.RequestAction; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder.SvcAction; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ParamEntity; +import org.onap.so.requestsdb.RequestsDbConstant; + +public class AbstractBuilderTest { + + AbstractBuilder abstractBuilder = new AbstractBuilder() { + @Override + Object build(DelegateExecution execution, Object input) throws Exception { + return null; + } + }; + + DelegateExecution delegateExecution = new DelegateExecution() { + private String operType; + private String resourceType; + private String requestId; + + @Override + public String getProcessInstanceId() { + return null; + } + + @Override + public String getProcessBusinessKey() { + return null; + } + + @Override + public String getProcessDefinitionId() { + return null; + } + + @Override + public String getParentId() { + return null; + } + + @Override + public String getCurrentActivityId() { + return null; + } + + @Override + public String getCurrentActivityName() { + return null; + } + + @Override + public String getActivityInstanceId() { + return null; + } + + @Override + public String getParentActivityInstanceId() { + return null; + } + + @Override + public String getCurrentTransitionId() { + return null; + } + + @Override + public DelegateExecution getProcessInstance() { + return null; + } + + @Override + public DelegateExecution getSuperExecution() { + return null; + } + + @Override + public boolean isCanceled() { + return false; + } + + @Override + public String getTenantId() { + return null; + } + + @Override + public void setVariable(String s, Object o, String s1) { + + } + + @Override + public Incident createIncident(String s, String s1) { + return null; + } + + @Override + public Incident createIncident(String s, String s1, String s2) { + return null; + } + + @Override + public void resolveIncident(String s) { + + } + + @Override + public String getId() { + return null; + } + + @Override + public String getEventName() { + return null; + } + + @Override + public String getBusinessKey() { + return null; + } + + @Override + public BpmnModelInstance getBpmnModelInstance() { + return null; + } + + @Override + public FlowElement getBpmnModelElementInstance() { + return null; + } + + @Override + public ProcessEngineServices getProcessEngineServices() { + return null; + } + + @Override + public String getVariableScopeKey() { + return null; + } + + @Override + public Map getVariables() { + return null; + } + + @Override + public VariableMap getVariablesTyped() { + return null; + } + + @Override + public VariableMap getVariablesTyped(boolean b) { + return null; + } + + @Override + public Map getVariablesLocal() { + return null; + } + + @Override + public VariableMap getVariablesLocalTyped() { + return null; + } + + @Override + public VariableMap getVariablesLocalTyped(boolean b) { + return null; + } + + @Override + public Object getVariable(String s) { + if (AbstractBuilder.OPERATION_TYPE.equals(s)) { + return operType; + } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { + return resourceType; + } else if ("msoRequestId".equals(s)) { + return requestId; + } + return null; + } + + @Override + public Object getVariableLocal(String s) { + return null; + } + + @Override + public T getVariableTyped(String s) { + return null; + } + + @Override + public T getVariableTyped(String s, boolean b) { + return null; + } + + @Override + public T getVariableLocalTyped(String s) { + return null; + } + + @Override + public T getVariableLocalTyped(String s, boolean b) { + return null; + } + + @Override + public Set getVariableNames() { + return null; + } + + @Override + public Set getVariableNamesLocal() { + return null; + } + + @Override + public void setVariable(String s, Object o) { + if (AbstractBuilder.OPERATION_TYPE.equals(s)) { + operType = (String) o; + } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { + resourceType = (String) o; + } else if ("msoRequestId".equals(s)) { + requestId = (String) o; + } + } + + @Override + public void setVariableLocal(String s, Object o) { + + } + + @Override + public void setVariables(Map map) { + + } + + @Override + public void setVariablesLocal(Map map) { + + } + + @Override + public boolean hasVariables() { + return false; + } + + @Override + public boolean hasVariablesLocal() { + return false; + } + + @Override + public boolean hasVariable(String s) { + return false; + } + + @Override + public boolean hasVariableLocal(String s) { + return false; + } + + @Override + public void removeVariable(String s) { + + } + + @Override + public void removeVariableLocal(String s) { + + } + + @Override + public void removeVariables(Collection collection) { + + } + + @Override + public void removeVariablesLocal(Collection collection) { + + } + + @Override + public void removeVariables() { + + } + + @Override + public void removeVariablesLocal() { + + } + }; + + @Test + public void requestActionGetIntValueTest() { + assertEquals(0, RequestAction.CREATE_NETWORK_INSTANCE.getIntValue()); + } + + @Test + public void svcActionGetIntValueTest() { + assertEquals(0, SvcAction.RESERVE.getIntValue()); + } + + @Test + public void buildTest() throws Exception { + abstractBuilder.build(null, null); + } + + @Test + public void getRequestActionBlankOperationTypeTest() throws Exception { + assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + } + + @Test + public void getRequestActionDeleteOperationTypeBlankResourceTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, ""); + assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + } + + @Test + public void getRequestActionDeleteOperationTypeBadResourceTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad"); + assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + } + + @Test + public void getRequestActionDeleteOperationTypeOverlayResourceTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay"); + assertEquals(AbstractBuilder.RequestAction.DEACTIVATE_DCI_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + } + + @Test + public void getRequestActionDeleteOperationTypeUnderlayResourceTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay"); + assertEquals(AbstractBuilder.RequestAction.DELETE_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + } + + @Test + public void getRequestActionDeleteOperationTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + } + + @Test + public void getRequestActionCreateOperationTypeBlankResourceTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, ""); + assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + } + + @Test + public void getRequestActionCreateOperationTypeBadResourceTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad"); + assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + } + + @Test + public void getRequestActionCreateOperationTypeOverlayResourceTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay"); + assertEquals(AbstractBuilder.RequestAction.ACTIVATE_DCI_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + } + + @Test + public void getRequestActionCreateOperationTypeUnderlayResourceTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay"); + assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + } + + @Test + public void getRequestActionCreateOperationTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + } + + @Test + public void getRequestActionBadOperationType() { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, "bad"); + assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + } + + @Test + public void getSvcActionBlankOperationTypeTest() throws Exception { + assertEquals(AbstractBuilder.SvcAction.CREATE.getName(), abstractBuilder.getSvcAction(delegateExecution)); + } + + @Test + public void getSvcActionDeleteOperationTypeBlankResourceTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, ""); + assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); + } + + @Test + public void getSvcActionDeleteOperationTypeBadResourceTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad"); + assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); + } + + @Test + public void getSvcActionDeleteOperationTypeOverlayResourceTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay"); + assertEquals(AbstractBuilder.SvcAction.DEACTIVATE.getName(), abstractBuilder.getSvcAction(delegateExecution)); + } + + @Test + public void getSvcActionDeleteOperationTypeUnderlayResourceTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay"); + assertEquals(AbstractBuilder.SvcAction.DELETE.getName(), abstractBuilder.getSvcAction(delegateExecution)); + } + + @Test + public void getSvcActionDeleteOperationTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); + } + + @Test + public void getSvcActionCreateOperationTypeBlankResourceTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, ""); + assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); + } + + @Test + public void getSvcActionCreateOperationTypeBadResourceTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad"); + assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); + } + + @Test + public void getSvcActionCreateOperationTypeOverlayResourceTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay"); + assertEquals(AbstractBuilder.SvcAction.ACTIVATE.getName(), abstractBuilder.getSvcAction(delegateExecution)); + } + + @Test + public void getSvcActionCreateOperationTypeUnderlayResourceTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay"); + assertEquals(AbstractBuilder.SvcAction.CREATE.getName(), abstractBuilder.getSvcAction(delegateExecution)); + } + + @Test + public void getSvcActionCreateOperationTypeTest() throws Exception { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); + } + + @Test + public void getSvcActionBadOperationType() { + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, "bad"); + assertEquals(AbstractBuilder.SvcAction.CREATE.getName(), abstractBuilder.getSvcAction(delegateExecution)); + } + + @Test + public void getRequestIdBlankNotOnExecutionTest() { + abstractBuilder.getRequestId(delegateExecution); + } + + @Test + public void getRequestIdBlankOnExecutionTest() { + String expected = "requestId"; + delegateExecution.setVariable("msoRequestId", expected); + assertEquals(expected, abstractBuilder.getRequestId(delegateExecution)); + } + + @Test + public void getRequestIdTest() { + String expected = "requestId"; + abstractBuilder.requestId = expected; + assertEquals(expected, abstractBuilder.getRequestId(delegateExecution)); + } + + @Test + public void getOnapServiceModelInformationEntityTest() throws Exception { + abstractBuilder.getOnapServiceModelInformationEntity(delegateExecution); + } + + @Test + public void getOnapNetworkModelInformationEntityTest() throws Exception { + abstractBuilder.getOnapNetworkModelInformationEntity(delegateExecution); + } + + @Test + public void getParamEntitiesTest() throws Exception { + Map inputs = new HashMap<>(); + inputs.put("foo", "bar"); + List list = abstractBuilder.getParamEntities(inputs); + assertEquals(1, list.size()); + assertEquals("foo", list.get(0).getName()); + assertEquals("bar", list.get(0).getValue()); + } + + @Test + public void getParamEntitiesNullInputsTest() { + List list = abstractBuilder.getParamEntities(null); + assertEquals(0, list.size()); + } + + @Test + public void getParamEntitiesEmptyInputsTest() { + List list = abstractBuilder.getParamEntities(new HashMap<>()); + assertEquals(0, list.size()); + } + + @Test + public void getRequestInformationEntityTest() throws Exception { + abstractBuilder.getRequestInformationEntity(delegateExecution); + } + + @Test + public void getServiceInformationEntityTest() throws Exception { + abstractBuilder.getServiceInformationEntity(delegateExecution); + } + + @Test + public void getServiceInstanceNameTest() throws Exception { + abstractBuilder.getServiceInstanceName(delegateExecution); + } + +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilderTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilderTest.java new file mode 100644 index 0000000000..f7d73a33e1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilderTest.java @@ -0,0 +1,323 @@ +/*- + * ============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.bpmn.infrastructure.workflow.serviceTask.client.builder; + +import java.util.Collection; +import java.util.Map; +import java.util.Set; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.runtime.Incident; +import org.camunda.bpm.engine.variable.VariableMap; +import org.camunda.bpm.engine.variable.value.TypedValue; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.camunda.bpm.model.bpmn.instance.FlowElement; +import org.junit.Test; + +public class NetworkRpcInputEntityBuilderTest { + NetworkRpcInputEntityBuilder networRpcInputEntityBuilder = new NetworkRpcInputEntityBuilder(); + + DelegateExecution delegateExecution = new DelegateExecution() { + private String operType; + private String resourceType; + private String requestId; + + @Override + public String getProcessInstanceId() { + return null; + } + + @Override + public String getProcessBusinessKey() { + return null; + } + + @Override + public String getProcessDefinitionId() { + return null; + } + + @Override + public String getParentId() { + return null; + } + + @Override + public String getCurrentActivityId() { + return null; + } + + @Override + public String getCurrentActivityName() { + return null; + } + + @Override + public String getActivityInstanceId() { + return null; + } + + @Override + public String getParentActivityInstanceId() { + return null; + } + + @Override + public String getCurrentTransitionId() { + return null; + } + + @Override + public DelegateExecution getProcessInstance() { + return null; + } + + @Override + public DelegateExecution getSuperExecution() { + return null; + } + + @Override + public boolean isCanceled() { + return false; + } + + @Override + public String getTenantId() { + return null; + } + + @Override + public void setVariable(String s, Object o, String s1) { + + } + + @Override + public Incident createIncident(String s, String s1) { + return null; + } + + @Override + public Incident createIncident(String s, String s1, String s2) { + return null; + } + + @Override + public void resolveIncident(String s) { + + } + + @Override + public String getId() { + return null; + } + + @Override + public String getEventName() { + return null; + } + + @Override + public String getBusinessKey() { + return null; + } + + @Override + public BpmnModelInstance getBpmnModelInstance() { + return null; + } + + @Override + public FlowElement getBpmnModelElementInstance() { + return null; + } + + @Override + public ProcessEngineServices getProcessEngineServices() { + return null; + } + + @Override + public String getVariableScopeKey() { + return null; + } + + @Override + public Map getVariables() { + return null; + } + + @Override + public VariableMap getVariablesTyped() { + return null; + } + + @Override + public VariableMap getVariablesTyped(boolean b) { + return null; + } + + @Override + public Map getVariablesLocal() { + return null; + } + + @Override + public VariableMap getVariablesLocalTyped() { + return null; + } + + @Override + public VariableMap getVariablesLocalTyped(boolean b) { + return null; + } + + @Override + public Object getVariable(String s) { + if (AbstractBuilder.OPERATION_TYPE.equals(s)) { + return operType; + } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { + return resourceType; + } else if ("msoRequestId".equals(s)) { + return requestId; + } + return null; + } + + @Override + public Object getVariableLocal(String s) { + return null; + } + + @Override + public T getVariableTyped(String s) { + return null; + } + + @Override + public T getVariableTyped(String s, boolean b) { + return null; + } + + @Override + public T getVariableLocalTyped(String s) { + return null; + } + + @Override + public T getVariableLocalTyped(String s, boolean b) { + return null; + } + + @Override + public Set getVariableNames() { + return null; + } + + @Override + public Set getVariableNamesLocal() { + return null; + } + + @Override + public void setVariable(String s, Object o) { + if (AbstractBuilder.OPERATION_TYPE.equals(s)) { + operType = (String) o; + } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { + resourceType = (String) o; + } else if ("msoRequestId".equals(s)) { + requestId = (String) o; + } + } + + @Override + public void setVariableLocal(String s, Object o) { + + } + + @Override + public void setVariables(Map map) { + + } + + @Override + public void setVariablesLocal(Map map) { + + } + + @Override + public boolean hasVariables() { + return false; + } + + @Override + public boolean hasVariablesLocal() { + return false; + } + + @Override + public boolean hasVariable(String s) { + return false; + } + + @Override + public boolean hasVariableLocal(String s) { + return false; + } + + @Override + public void removeVariable(String s) { + + } + + @Override + public void removeVariableLocal(String s) { + + } + + @Override + public void removeVariables(Collection collection) { + + } + + @Override + public void removeVariablesLocal(Collection collection) { + + } + + @Override + public void removeVariables() { + + } + + @Override + public void removeVariablesLocal() { + + } + }; + + @Test + public void buildTest() { + networRpcInputEntityBuilder.build(delegateExecution, null); + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilderTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilderTest.java new file mode 100644 index 0000000000..4db0421936 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilderTest.java @@ -0,0 +1,323 @@ +/*- + * ============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.bpmn.infrastructure.workflow.serviceTask.client.builder; + +import java.util.Collection; +import java.util.Map; +import java.util.Set; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.runtime.Incident; +import org.camunda.bpm.engine.variable.VariableMap; +import org.camunda.bpm.engine.variable.value.TypedValue; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.camunda.bpm.model.bpmn.instance.FlowElement; +import org.junit.Test; + +public class ServiceRpcInputEntityBuilderTest { + ServiceRpcInputEntityBuilder serviceRpcInputEntityBuilder = new ServiceRpcInputEntityBuilder(); + + DelegateExecution delegateExecution = new DelegateExecution() { + private String operType; + private String resourceType; + private String requestId; + + @Override + public String getProcessInstanceId() { + return null; + } + + @Override + public String getProcessBusinessKey() { + return null; + } + + @Override + public String getProcessDefinitionId() { + return null; + } + + @Override + public String getParentId() { + return null; + } + + @Override + public String getCurrentActivityId() { + return null; + } + + @Override + public String getCurrentActivityName() { + return null; + } + + @Override + public String getActivityInstanceId() { + return null; + } + + @Override + public String getParentActivityInstanceId() { + return null; + } + + @Override + public String getCurrentTransitionId() { + return null; + } + + @Override + public DelegateExecution getProcessInstance() { + return null; + } + + @Override + public DelegateExecution getSuperExecution() { + return null; + } + + @Override + public boolean isCanceled() { + return false; + } + + @Override + public String getTenantId() { + return null; + } + + @Override + public void setVariable(String s, Object o, String s1) { + + } + + @Override + public Incident createIncident(String s, String s1) { + return null; + } + + @Override + public Incident createIncident(String s, String s1, String s2) { + return null; + } + + @Override + public void resolveIncident(String s) { + + } + + @Override + public String getId() { + return null; + } + + @Override + public String getEventName() { + return null; + } + + @Override + public String getBusinessKey() { + return null; + } + + @Override + public BpmnModelInstance getBpmnModelInstance() { + return null; + } + + @Override + public FlowElement getBpmnModelElementInstance() { + return null; + } + + @Override + public ProcessEngineServices getProcessEngineServices() { + return null; + } + + @Override + public String getVariableScopeKey() { + return null; + } + + @Override + public Map getVariables() { + return null; + } + + @Override + public VariableMap getVariablesTyped() { + return null; + } + + @Override + public VariableMap getVariablesTyped(boolean b) { + return null; + } + + @Override + public Map getVariablesLocal() { + return null; + } + + @Override + public VariableMap getVariablesLocalTyped() { + return null; + } + + @Override + public VariableMap getVariablesLocalTyped(boolean b) { + return null; + } + + @Override + public Object getVariable(String s) { + if (AbstractBuilder.OPERATION_TYPE.equals(s)) { + return operType; + } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { + return resourceType; + } else if ("msoRequestId".equals(s)) { + return requestId; + } + return null; + } + + @Override + public Object getVariableLocal(String s) { + return null; + } + + @Override + public T getVariableTyped(String s) { + return null; + } + + @Override + public T getVariableTyped(String s, boolean b) { + return null; + } + + @Override + public T getVariableLocalTyped(String s) { + return null; + } + + @Override + public T getVariableLocalTyped(String s, boolean b) { + return null; + } + + @Override + public Set getVariableNames() { + return null; + } + + @Override + public Set getVariableNamesLocal() { + return null; + } + + @Override + public void setVariable(String s, Object o) { + if (AbstractBuilder.OPERATION_TYPE.equals(s)) { + operType = (String) o; + } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { + resourceType = (String) o; + } else if ("msoRequestId".equals(s)) { + requestId = (String) o; + } + } + + @Override + public void setVariableLocal(String s, Object o) { + + } + + @Override + public void setVariables(Map map) { + + } + + @Override + public void setVariablesLocal(Map map) { + + } + + @Override + public boolean hasVariables() { + return false; + } + + @Override + public boolean hasVariablesLocal() { + return false; + } + + @Override + public boolean hasVariable(String s) { + return false; + } + + @Override + public boolean hasVariableLocal(String s) { + return false; + } + + @Override + public void removeVariable(String s) { + + } + + @Override + public void removeVariableLocal(String s) { + + } + + @Override + public void removeVariables(Collection collection) { + + } + + @Override + public void removeVariablesLocal(Collection collection) { + + } + + @Override + public void removeVariables() { + + } + + @Override + public void removeVariablesLocal() { + + } + }; + + @Test + public void buildTest() throws Exception { + serviceRpcInputEntityBuilder.build(delegateExecution, null); + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ClientEntityPojoTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ClientEntityPojoTest.java new file mode 100644 index 0000000000..c8949cee0f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ClientEntityPojoTest.java @@ -0,0 +1,76 @@ +/*- + * ============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.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import org.junit.Test; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.impl.PojoClassFactory; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.rule.impl.NoNestedClassRule; +import com.openpojo.validation.rule.impl.NoPrimitivesRule; +import com.openpojo.validation.rule.impl.NoPublicFieldsRule; +import com.openpojo.validation.rule.impl.SetterMustExistRule; +import com.openpojo.validation.test.impl.DefaultValuesNullTester; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + +public class ClientEntityPojoTest { + @Test + public void pojoStructure() { + test(PojoClassFactory.getPojoClass(NetworkInformationEntity.class)); + test(PojoClassFactory.getPojoClass(NetworkInputParametersEntity.class)); + test(PojoClassFactory.getPojoClass(NetworkRequestInputEntity.class)); + test(PojoClassFactory.getPojoClass(NetworkResponseInformationEntity.class)); + test(PojoClassFactory.getPojoClass(NetworkTopologyOperationInputEntity.class)); + test(PojoClassFactory.getPojoClass(NetworkTopologyOperationOutputEntity.class)); + test(PojoClassFactory.getPojoClass(OnapModelInformationEntity.class)); + test(PojoClassFactory.getPojoClass(ParamEntity.class)); + test(PojoClassFactory.getPojoClass(RequestInformationEntity.class)); + test(PojoClassFactory.getPojoClass(RpcNetworkTopologyOperationInputEntity.class)); + test(PojoClassFactory.getPojoClass(SdncRequestHeaderEntity.class)); + test(PojoClassFactory.getPojoClass(RpcServiceTopologyOperationInputEntity.class)); + test(PojoClassFactory.getPojoClass(RpcServiceTopologyOperationOutputEntity.class)); + test(PojoClassFactory.getPojoClass(ServiceInformationEntity.class)); + test(PojoClassFactory.getPojoClass(ServiceInputParametersEntity.class)); + test(PojoClassFactory.getPojoClass(ServiceRequestInputEntity.class)); + test(PojoClassFactory.getPojoClass(ServiceResponseInformationEntity.class)); + test(PojoClassFactory.getPojoClass(ServiceTopologyOperationInputEntity.class)); + test(PojoClassFactory.getPojoClass(ServiceTopologyOperationOutputEntity.class)); + test(PojoClassFactory.getPojoClass(RpcNetworkTopologyOperationOutputEntity.class)); + } + + private void test(PojoClass pojoClass) { + Validator validator = ValidatorBuilder.create() + .with(new GetterMustExistRule()) + .with(new SetterMustExistRule()) + .with(new NoNestedClassRule()) + .with(new NoPrimitivesRule()) + .with(new NoPublicFieldsRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .with(new DefaultValuesNullTester()) + .build(); + validator.validate(pojoClass); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/CreateSiSample.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/CreateSiSample.json new file mode 100644 index 0000000000..c824213423 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/CreateSiSample.json @@ -0,0 +1,72 @@ +{ + "variables": { + "bpmnRequest": { + "value": "{\n \"requestDetails\": {\n \"cloudConfiguration\": {\n \"lcpCloudRegionId\": \"mtn6\", \n \"tenantId\": \"0422ffb57ba042c0800a29dc85ca70f8\"\n }, \n \"modelInfo\": {\n \"modelInvariantUuid\": \"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f\", \n \"modelName\": \"MSO Test Network\", \n \"modelType\": \"service\", \n \"modelUuid\": \"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e\", \n \"modelVersion\": \"1.0\"\n }, \n \"owningEntity\": {\n \"owningEntityId\": \"123459af-0427-42c2-9d15-971b99b12345\", \n \"owningEntityName\": \"vSAMP10a Entity-200\"\n }, \n \"project\": {\n \"projectName\": \"vSAMP10a Project-3\"\n }, \n \"requestInfo\": {\n \"instanceName\": \"MSO-DEV-SI-1802-v6-2-19-10\", \n \"requestorId\": \"xxxxxx\", \n \"source\": \"VID\", \n \"suppressRollback\": false\n }, \n \"requestParameters\": {\n \"aLaCarte\": true, \n \"subscriptionServiceType\": \"MSO-dev-service-type\", \n \"userParams\": [\n {\n \"name\": \"someUserParam\", \n \"value\": \"someValue\"\n }\n ]\n }, \n \"subscriberInfo\": {\n \"globalSubscriberId\": \"MSO_1610_dev\", \n \"subscriberName\": \"MSO_1610_dev\"\n }\n }\n}\n", + "type": "String" + }, + "requestId": { + "value": "6dd20050-76ee-418f-a153-50720a8f3286", + "type": "String" + }, + "mso-request-id": { + "value": "6dd20050-76ee-418f-a153-50720a8f3286", + "type": "String" + }, + "isBaseVfModule": { + "value": false, + "type": "Boolean" + }, + "recipeTimeout": { + "value": 180, + "type": "Integer" + }, + "requestAction": { + "value": "createInstance", + "type": "String" + }, + "serviceInstanceId": { + "value": "", + "type": "String" + }, + "vnfId": { + "value": "", + "type": "String" + }, + "vfModuleId": { + "value": "", + "type": "String" + }, + "volumeGroupId": { + "value": "", + "type": "String" + }, + "networkId": { + "value": "", + "type": "String" + }, + "configurationId": { + "value": "", + "type": "String" + }, + "serviceType": { + "value": "", + "type": "String" + }, + "vnfType": { + "value": "", + "type": "String" + }, + "vfModuleType": { + "value": "", + "type": "String" + }, + "networkType": { + "value": "", + "type": "String" + }, + "host": { + "value": "localhost", + "type": "String" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn b/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn new file mode 100644 index 0000000000..b33aad7443 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn @@ -0,0 +1,54 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_1v2f9n5 + + + + SequenceFlow_1v2f9n5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn b/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn new file mode 100644 index 0000000000..807efae1af --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn @@ -0,0 +1,55 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1epm19d + + + SequenceFlow_1 + SequenceFlow_1epm19d + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn b/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn new file mode 100644 index 0000000000..b2f280d7e9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn @@ -0,0 +1,38 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn b/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn new file mode 100644 index 0000000000..532ca867bb --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn @@ -0,0 +1,53 @@ + + + + + SequenceFlow_1ipu8um + + + SequenceFlow_1l4c4k0 + + + SequenceFlow_1ipu8um + SequenceFlow_1l4c4k0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn b/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn new file mode 100644 index 0000000000..5e4400e9bd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn @@ -0,0 +1,53 @@ + + + + + SequenceFlow_11sp3s9 + + + + SequenceFlow_11sp3s9 + SequenceFlow_0q1lfmf + + + + + SequenceFlow_0q1lfmf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn b/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn new file mode 100644 index 0000000000..2867a671b6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn @@ -0,0 +1,53 @@ + + + + + SequenceFlow_1537b7m + + + SequenceFlow_1mz2mgf + + + + SequenceFlow_1537b7m + SequenceFlow_1mz2mgf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn b/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn new file mode 100644 index 0000000000..517df36c74 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn @@ -0,0 +1,37 @@ + + + + + SequenceFlow_0qi7pl3 + + + + SequenceFlow_0qi7pl3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/Homing.bpmn b/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/Homing.bpmn new file mode 100644 index 0000000000..ad4c3c816d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/VCPE/stubprocess/Homing.bpmn @@ -0,0 +1,35 @@ + + + + + SequenceFlow_0tyavm9 + + + SequenceFlow_0tyavm9 + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json new file mode 100644 index 0000000000..a4190a76ee --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json @@ -0,0 +1,12 @@ +{ + "cloud-owner": "att-aic", + "cloud-region-id": "mdt1", + "cloud-type": "openstack", + "owner-defined-type": "lcp", + "cloud-region-version": "aic3.0", + "identity-url": "https://localhost:5000/v2.0", + "cloud-zone": "z1", + "complex-name": "c1", + "sriov-automation": false, + "resource-version": "1503072127235" +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_genericVnfGet.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_genericVnfGet.json new file mode 100644 index 0000000000..921918f267 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_genericVnfGet.json @@ -0,0 +1,9 @@ +{ + "vnf-id": "msoVnf123", + "vnf-name": "MSO-Test-VNF-123", + "vnf-type": "vnf-type", + "orchestration-status": "active", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1525360206136" +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json new file mode 100644 index 0000000000..f0936d6648 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json @@ -0,0 +1,434 @@ +{ + "vnf-id": "example-vnf-id-val-90603", + "vnf-name": "example-vnf-name-val-56838", + "vnf-name2": "example-vnf-name2-val-56319", + "vnf-type": "example-vnf-type-val-30533", + "service-id": "example-service-id-val-28290", + "regional-resource-zone": "example-regional-resource-zone-val-11059", + "prov-status": "example-prov-status-val-59777", + "operational-status": "example-operational-status-val-22513", + "in-maint": true, + + "equipment-role": "example-equipment-role-val-23396", + "orchestration-status": "example-orchestration-status-val-59435", + "heat-stack-id": "example-heat-stack-id-val-96869", + "mso-catalog-key": "example-mso-catalog-key-val-30721", + "management-option": "example-management-option-val-61927", + "ipv4-oam-address": "192.168.10.14", + "ipv4-loopback0-address": "example-ipv4-loopback0-address-val-87072", + "nm-lan-v6-address": "example-nm-lan-v6-address-val-91063", + "management-v6-address": "example-management-v6-address-val-80466", + "vcpu": 45837298, + "vcpu-units": "example-vcpu-units-val-86249", + "vmemory": 57288956, + "vmemory-units": "example-vmemory-units-val-13291", + "vdisk": 16937143, + "vdisk-units": "example-vdisk-units-val-73197", + + "is-closed-loop-disabled": true, + "summary-status": "example-summary-status-val-86438", + "encrypted-access-flag": true, + + + + + "model-invariant-id": "example-model-invariant-id-val-14704", + "model-version-id": "example-model-version-id-val-47847", + "model-customization-id": "example-model-customization-id-val-52688", + "widget-model-id": "example-widget-model-id-val-20939", + "widget-model-version": "example-widget-model-version-val-72210", + "as-number": "example-as-number-val-68358", + "regional-resource-subzone": "example-regional-resource-subzone-val-34391", + "nf-type": "example-nf-type-val-54866", + "nf-function": "example-nf-function-val-24790", + "nf-role": "example-nf-role-val-4780", + "nf-naming-code": "example-nf-naming-code-val-25118", + "selflink": "example-selflink-val-68404", + + "relationship-list": {"relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v12/business/customers/customer/e433710f-9217-458d-a79d-1c7aff376d89/service-subscriptions/service-subscription/VIRTUAL%20USP/service-instances/service-instance/2c323333-af4f-4849-af03-c862c0e93e3b", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "e433710f-9217-458d-a79d-1c7aff376d89" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "VIRTUAL USP" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "2c323333-af4f-4849-af03-c862c0e93e3b" + } + ], + "related-to-property": [ { + "property-key": "service-instance.service-instance-name", + "property-value": "kjhgfd1" + }] + }, + { + "related-to": "vserver", + "relationship-label": "tosca.relationships.HostedOn", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn23a" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "e6beab145f6b49098277ac163ac1b4f3" + }, + { + "relationship-key": "vserver.vserver-id", + "relationship-value": "1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5" + } + ], + "related-to-property": [ { + "property-key": "vserver.vserver-name", + "property-value": "comx5000vm003" + }] + }, + { + "related-to": "vserver", + "relationship-label": "tosca.relationships.HostedOn", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/14551849-1e70-45cd-bc5d-a256d49548a2", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn23a" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "e6beab145f6b49098277ac163ac1b4f3" + }, + { + "relationship-key": "vserver.vserver-id", + "relationship-value": "14551849-1e70-45cd-bc5d-a256d49548a2" + } + ], + "related-to-property": [ { + "property-key": "vserver.vserver-name", + "property-value": "comx5000vm002" + }] + }, + { + "related-to": "vserver", + "relationship-label": "tosca.relationships.HostedOn", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/48bd7f11-408f-417c-b834-b41c1b98f7d7", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn23a" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "e6beab145f6b49098277ac163ac1b4f3" + }, + { + "relationship-key": "vserver.vserver-id", + "relationship-value": "48bd7f11-408f-417c-b834-b41c1b98f7d7" + } + ], + "related-to-property": [ { + "property-key": "vserver.vserver-name", + "property-value": "comx5000vm001" + }] + } + ]}, + + + "l-interfaces": { + "l-interface": [ + { + "interface-name": "example-interface-name-val-50593", + "interface-role": "example-interface-role-val-23375", + "v6-wan-link-ip": "example-v6-wan-link-ip-val-5921", + "selflink": "example-selflink-val-75663", + "interface-id": "example-interface-id-val-37465", + "macaddr": "example-macaddr-val-62657", + "network-name": "example-network-name-val-7252", + "management-option": "example-management-option-val-32963", + "interface-description": "example-interface-description-val-89453", + "is-port-mirrored": true, + "vlans": { + "vlan": [ + { + "vlan-interface": "example-vlan-interface-val-16684", + "vlan-id-inner": 8602916, + "vlan-id-outer": 97348542, + "speed-value": "example-speed-value-val-90330", + "speed-units": "example-speed-units-val-15849", + "vlan-description": "example-vlan-description-val-46942", + "backdoor-connection": "example-backdoor-connection-val-78445", + + "orchestration-status": "example-orchestration-status-val-44994", + + + + "l3-interface-ipv4-address-list": [ + { + "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-90277", + "l3-interface-ipv4-prefix-length": 3364150, + "vlan-id-inner": 44021171, + "vlan-id-outer": 55708677, + "is-floating": true, + "neutron-network-id": "example-neutron-network-id-val-43267", + "neutron-subnet-id": "example-neutron-subnet-id-val-62870" + } + ], + "l3-interface-ipv6-address-list": [ + { + "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-45323", + "l3-interface-ipv6-prefix-length": 56688923, + "vlan-id-inner": 5703071, + "vlan-id-outer": 86682265, + "is-floating": true, + "neutron-network-id": "example-neutron-network-id-val-28366", + "neutron-subnet-id": "example-neutron-subnet-id-val-53034" + } + ] + } + ] + }, + "sriov-vfs": { + "sriov-vf": [ + { + "pci-id": "example-pci-id-val-4720", + "vf-vlan-filter": "example-vf-vlan-filter-val-42594", + "vf-mac-filter": "example-vf-mac-filter-val-13375", + "vf-vlan-strip": true, + "vf-vlan-anti-spoof-check": true, + "vf-mac-anti-spoof-check": true, + "vf-mirrors": "example-vf-mirrors-val-6057", + "vf-broadcast-allow": true, + "vf-unknown-multicast-allow": true, + "vf-unknown-unicast-allow": true, + "vf-insert-stag": true, + "vf-link-status": "example-vf-link-status-val-81448", + "neutron-network-id": "example-neutron-network-id-val-9504" + } + ] + }, + "l-interfaces": { + "l-interface": [ + { + "interface-name": "example-interface-name-val-16738", + "interface-role": "example-interface-role-val-13943", + "v6-wan-link-ip": "example-v6-wan-link-ip-val-63173", + "selflink": "example-selflink-val-43085", + "interface-id": "example-interface-id-val-51379", + "macaddr": "example-macaddr-val-16195", + "network-name": "example-network-name-val-45683", + "management-option": "example-management-option-val-78983", + "interface-description": "example-interface-description-val-34414", + "is-port-mirrored": true + } + ] + }, + "l3-interface-ipv4-address-list": [ + { + "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-99078", + "l3-interface-ipv4-prefix-length": 55755841, + "vlan-id-inner": 81525473, + "vlan-id-outer": 90908072, + "is-floating": true, + "neutron-network-id": "example-neutron-network-id-val-47919", + "neutron-subnet-id": "example-neutron-subnet-id-val-84236" + } + ], + "l3-interface-ipv6-address-list": [ + { + "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-21939", + "l3-interface-ipv6-prefix-length": 50057584, + "vlan-id-inner": 75774660, + "vlan-id-outer": 4421090, + "is-floating": true, + "neutron-network-id": "example-neutron-network-id-val-46377", + "neutron-subnet-id": "example-neutron-subnet-id-val-16585" + } + ] + } + ] + }, + "lag-interfaces": { + "lag-interface": [ + { + "interface-name": "example-interface-name-val-39234", + "interface-description": "example-interface-description-val-1037", + "speed-value": "example-speed-value-val-1929", + "speed-units": "example-speed-units-val-74937", + "interface-id": "example-interface-id-val-91265", + "interface-role": "example-interface-role-val-19613", + + + "l-interfaces": { + "l-interface": [ + { + "interface-name": "example-interface-name-val-10722", + "interface-role": "example-interface-role-val-95194", + "v6-wan-link-ip": "example-v6-wan-link-ip-val-24328", + "selflink": "example-selflink-val-24987", + "interface-id": "example-interface-id-val-75726", + "macaddr": "example-macaddr-val-36940", + "network-name": "example-network-name-val-65359", + "management-option": "example-management-option-val-49521", + "interface-description": "example-interface-description-val-70528", + "is-port-mirrored": true, + "vlans": { + "vlan": [ + { + "vlan-interface": "example-vlan-interface-val-70827", + "vlan-id-inner": 55659612, + "vlan-id-outer": 90335612, + "speed-value": "example-speed-value-val-54761", + "speed-units": "example-speed-units-val-91398", + "vlan-description": "example-vlan-description-val-17018", + "backdoor-connection": "example-backdoor-connection-val-4021", + + "orchestration-status": "example-orchestration-status-val-18315", + + + "l3-interface-ipv4-address-list": [ + { + "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-59336", + "l3-interface-ipv4-prefix-length": 57636053, + "vlan-id-inner": 34068397, + "vlan-id-outer": 48570286, + "is-floating": true, + "neutron-network-id": "example-neutron-network-id-val-69862", + "neutron-subnet-id": "example-neutron-subnet-id-val-75795" + } + ], + "l3-interface-ipv6-address-list": [ + { + "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-15038", + "l3-interface-ipv6-prefix-length": 42694503, + "vlan-id-inner": 15929806, + "vlan-id-outer": 87413856, + "is-floating": true, + "neutron-network-id": "example-neutron-network-id-val-52519", + "neutron-subnet-id": "example-neutron-subnet-id-val-24471" + } + ] + } + ] + }, + "sriov-vfs": { + "sriov-vf": [ + { + "pci-id": "example-pci-id-val-44669", + "vf-vlan-filter": "example-vf-vlan-filter-val-53436", + "vf-mac-filter": "example-vf-mac-filter-val-71902", + "vf-vlan-strip": true, + "vf-vlan-anti-spoof-check": true, + "vf-mac-anti-spoof-check": true, + "vf-mirrors": "example-vf-mirrors-val-54963", + "vf-broadcast-allow": true, + "vf-unknown-multicast-allow": true, + "vf-unknown-unicast-allow": true, + "vf-insert-stag": true, + "vf-link-status": "example-vf-link-status-val-1546", + "neutron-network-id": "example-neutron-network-id-val-92159" + } + ] + }, + "l-interfaces": { + "l-interface": [ + { + "interface-name": "example-interface-name-val-9327", + "interface-role": "example-interface-role-val-21859", + "v6-wan-link-ip": "example-v6-wan-link-ip-val-21445", + "selflink": "example-selflink-val-6085", + "interface-id": "example-interface-id-val-39854", + "macaddr": "example-macaddr-val-14433", + "network-name": "example-network-name-val-3722", + "management-option": "example-management-option-val-64739", + "interface-description": "example-interface-description-val-5814", + "is-port-mirrored": true + + + + } + ] + }, + "l3-interface-ipv4-address-list": [ + { + "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-64531", + "l3-interface-ipv4-prefix-length": 66545882, + "vlan-id-inner": 12194134, + "vlan-id-outer": 29589286, + "is-floating": true, + "neutron-network-id": "example-neutron-network-id-val-91108", + "neutron-subnet-id": "example-neutron-subnet-id-val-56984" + } + ], + "l3-interface-ipv6-address-list": [ + { + "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-37408", + "l3-interface-ipv6-prefix-length": 5116459, + "vlan-id-inner": 39229896, + "vlan-id-outer": 15091934, + "is-floating": true, + "neutron-network-id": "example-neutron-network-id-val-87700", + "neutron-subnet-id": "example-neutron-subnet-id-val-37352" + } + ] + } + ] + } + } + ] + }, + "vf-modules": { + "vf-module": [ + { + "vf-module-id": "example-vf-module-id-val-56249", + "vf-module-name": "example-vf-module-name-val-18987", + "heat-stack-id": "example-heat-stack-id-val-80110", + "orchestration-status": "example-orchestration-status-val-8226", + "is-base-vf-module": true, + "model-invariant-id": "example-model-invariant-id-val-5071", + "model-version-id": "example-model-version-id-val-80793", + "model-customization-id": "example-model-customization-id-val-83277", + "widget-model-id": "example-widget-model-id-val-99814", + "widget-model-version": "example-widget-model-version-val-22799", + "contrail-service-instance-fqdn": "example-contrail-service-instance-fqdn-val-52133", + "module-index": 1933, + "selflink": "example-selflink-val-69992" + } + ] + }, + "licenses": { + "license": [ + { + "group-uuid": "example-group-uuid-val-73012", + "resource-uuid": "example-resource-uuid-val-80045" + } + ] + }, + "entitlements": { + "entitlement": [ + { + "group-uuid": "example-group-uuid-val-14874", + "resource-uuid": "example-resource-uuid-val-49146" + } + ] + } + +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_pserverByVnfId.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_pserverByVnfId.json new file mode 100644 index 0000000000..4b1f69aacf --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_pserverByVnfId.json @@ -0,0 +1,72 @@ + { + + "result": [{ + + "hostname": "8862-PserverHOSTNAME-LB1113", + "equipType": "JUNIPER UCPE", + "equipVendor": "JUNIPER", + "equipModel": "QFX51010-PNF", + "ipv4OamAddress": "192.168.5.199", + "serialNumber": "VX986001PNF", + "pserverId": "5715CE4F-8600-58E103FE60C79", + "internetTopology": "WAN", + "inMaint": false, + "resourceVersion": "1500495668780", + "pserverName2": "test81600", + "relationshipList": { + "relationship": [ + { + "relatedTo": "vserver", + "relatedLink": "/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/8862-tenantl-LB1113/vservers/vserver/8862-Lvserver-LB1113", + "relationshipData": [ + { + "relationshipKey": "cloud-region.cloud-owner", + "relationshipValue": "att-aic" + }, + { + "relationshipKey": "cloud-region.cloud-region-id", + "relationshipValue": "AAIAIC25" + }, + { + "relationshipKey": "tenant.tenant-id", + "relationshipValue": "8862-tenantl-LB1113" + }, + { + "relationshipKey": "vserver.vserver-id", + "relationshipValue": "8862-Lvserver-LB1113" + } + ], + "relatedToProperty": [ + { + "propertyKey": "vserver.vserver-name", + "propertyValue": "hjZAYKyl5LO" + } + ] + } + ] + }, + "pinterfaces": { + "pinterface": [ + { + "interfaceName": "ge-0/5/8", + "speedValue": "1", + "speedUnits": "GBPS", + "resourceVersion": "1500495668784", + "inMaint": false + }, + { + "interfaceName": "ge-1/5/8", + "speedValue": "1", + "speedUnits": "GBPS", + "resourceVersion": "1500495668788", + "inMaint": false + } + ] + } + } + + + + ] +} + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_vfModuleByVfModuleId.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_vfModuleByVfModuleId.json new file mode 100644 index 0000000000..d79137b0cd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_vfModuleByVfModuleId.json @@ -0,0 +1,27 @@ +{ + "vf-module-id": "example-vnf-id-val-90603", + "vf-module-name": "example-vnf-name-val-56838", + "vnf-name2": "example-vnf-name2-val-56319", + "vnf-type": "example-vnf-type-val-30533", + "service-id": "example-service-id-val-28290", + "regional-resource-zone": "example-regional-resource-zone-val-11059", + "prov-status": "example-prov-status-val-59777", + "operational-status": "example-operational-status-val-22513", + "in-maint": true, + + "equipment-role": "example-equipment-role-val-23396", + "orchestration-status": "example-orchestration-status-val-59435", + "heat-stack-id": "example-heat-stack-id-val-96869", + "mso-catalog-key": "example-mso-catalog-key-val-30721", + "management-option": "example-management-option-val-61927", + "ipv4-oam-address": "192.168.10.14", + "ipv4-loopback0-address": "example-ipv4-loopback0-address-val-87072", + "nm-lan-v6-address": "example-nm-lan-v6-address-val-91063", + "management-v6-address": "example-management-v6-address-val-80466", + "vcpu": 45837298, + "vcpu-units": "example-vcpu-units-val-86249", + "vmemory": 57288956, + "vmemory-units": "example-vmemory-units-val-13291", + "vdisk": 16937143, + "vdisk-units": "example-vdisk-units-val-73197" +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/mockObject.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/mockObject.json new file mode 100644 index 0000000000..2f97b47dd3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/mockObject.json @@ -0,0 +1,10 @@ +{ + "id" : "something", + "resource-version" : "1234", + "plural" : { + "singular" : [{ + "id" : "something2", + "resource-version" : "5678" + }] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/APPC/appc_error.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/APPC/appc_error.json new file mode 100644 index 0000000000..e28878d1aa --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/APPC/appc_error.json @@ -0,0 +1,21 @@ +{ + "output": { + "status": { + "code": 200, + "message": "RESULT_MESSAGE" + }, + "common-header": { + "api-ver": "API_VERSION", + "request-id": "ECOMP_REQUEST_ID", + "originator-id": "ECOMP_SYSTEM_ID", + "sub-request-id": "ECOMP_SUBREQUEST_ID", + "timestamp": "2016-08-08T23:09:00.11Z", + "flags": { + "ttl": 1000, + "force": "TRUE", + "mode": "EXCLUSIVE" + } + }, + "locked": "TRUE" + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml new file mode 100644 index 0000000000..34079bd23f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml @@ -0,0 +1,75 @@ + + mtn6 + 0422ffb57ba042c0800a29dc85ca70f8 + 8d35a433-c1db-4d54-a611-6de10aeb76f9 + Dev_Bindings_1802_1311 + CONTRAIL30_BASIC + f1fc12e8-afe4-4716-954d-ed4d21a480ad + CONTRAIL + + tbd + + + + true + false + + 2001:051111 + EXPORT + + + 1000:051113 + IMPORT + + + 1000:051112 + BOTH + + + 1000:051115 + EXPORT + + + 1000:051114 + IMPORT + + default-domain:ECOMP_MSO_DND:MSOPolicyD + default-domain:ECOMP_MSO_DND:MSOPolicyC + + + + + 107.118.41.3 + 107.118.41.45 + + 107.118.41.0/24 + true + 107.118.41.1 + 4 + 9dbb9e7e-fe18-421f-bad6-2305bd282471 + + true + + + + 107.118.42.3 + 107.118.42.45 + + 107.118.42.0/24 + true + 107.118.42.1 + 4 + 1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab + + true + + true + true + false + + 3d35ca0c-2da5-4f60-84d9-3e005de335c0 + f1d1c7da-fc42-4c31-866e-cfe963e55723 + + d4515ea9-2852-4d3a-b424-9d7b6cf69d8e + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml new file mode 100644 index 0000000000..607dd5af92 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml @@ -0,0 +1,31 @@ + + d4515ea9-2852-4d3a-b424-9d7b6cf69d8e + true + default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_1311 + 8d35a433-c1db-4d54-a611-6de10aeb76f9 + Dev_Bindings_1802_1311/ecf7e197-72db-452e-9eda-253cb642c9b7 + b6a7820c-4734-4ef2-8a73-a22c824423fa + + mtn6 + f1fc12e8-afe4-4716-954d-ed4d21a480ad + + 3d35ca0c-2da5-4f60-84d9-3e005de335c0 + f1d1c7da-fc42-4c31-866e-cfe963e55723 + + true + Dev_Bindings_1802_1311/ecf7e197-72db-452e-9eda-253cb642c9b7 + CONTRAIL30_BASIC + b6a7820c-4734-4ef2-8a73-a22c824423fa + 0422ffb57ba042c0800a29dc85ca70f8 + + + + 9dbb9e7e-fe18-421f-bad6-2305bd282471 + 27d414c7-1076-4595-aa45-4717ee992cef + + + 1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab + db64710c-fbbc-4dc9-8109-3925b87268fa + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json new file mode 100644 index 0000000000..dda149a560 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json @@ -0,0 +1,10 @@ +{ + "networkTechnology": "NEUTRON", + "failIfExists": false, + "backout": true, + "networkParams": [], + "msoRequest": {}, + "contrailRequest": false, + "skipAAI": false, + "synchronous": true +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json new file mode 100644 index 0000000000..d5d234cbf6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json @@ -0,0 +1,226 @@ +{ + "sharedNetwork": false, + "boundToVpn": false, + "externalNetwork": false, + "providerNetwork": false, + "network-id": "TEST_NETWORK_ID", + "cascaded": false, + "cloud-params": null, + "network-name": "TEST_NETWORK_NAME", + "is-bound-to-vpn": false, + "service-id": null, + "network-role-instance": null, + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "widget-model-id": null, + "widget-model-version": null, + "physical-network-name": null, + "is-provider-network": false, + "is-shared-network": false, + "is-external-network": false, + "self-link": null, + "operational-status": null, + "subnets": { + "subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497", + "host-routes": { + "host-route": [ + { + "host-route-id": "400d286b-7e44-4514-b9b3-f70f7360ff32", + "route-prefix": "172.20.1.0/24", + "next-hop": "10.102.200.1", + "next-hop-type": "ip-address", + "resource-version": "1505857300987" + }, + { + "host-route-id": "6f038013-8b15-4eb8-914b-507489fbc8ee", + "route-prefix": "10.102.0.0/16", + "next-hop": "10.102.200.1", + "next-hop-type": "ip-address", + "resource-version": "1505857301151" + }, + { + "host-route-id": "8811c5f8-f1ed-4fa0-a505-e1be60396e28", + "route-prefix": "192.168.2.0/25", + "next-hop": "10.102.200.1", + "resource-version": "1505857301954" + } + ] + } + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + } + ] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + } + ] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + } + ] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ + { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + } + ], + "related-to-property": [ + { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + } + ] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ + { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + } + ], + "related-to-property": [ + { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + } + ] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ + { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + } + ], + "related-to-property": [ + { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + } + ] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ + { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + } + ], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + { + "property-key": "vpn-binding.vpn-type" + } + ] + } + ] + }, + "ctag-assignments": [ + ], + "segmentation-assignments": [ + ], + "model-info-network": null +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json new file mode 100644 index 0000000000..aa6320801e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json @@ -0,0 +1,216 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": { + "subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497", + "host-routes": { + "host-route": [ + { + "host-route-id": "400d286b-7e44-4514-b9b3-f70f7360ff32", + "route-prefix": "172.20.1.0/24", + "next-hop": "10.102.200.1", + "next-hop-type": "ip-address", + "resource-version": "1505857300987" + }, + { + "host-route-id": "6f038013-8b15-4eb8-914b-507489fbc8ee", + "route-prefix": "10.102.0.0/16", + "next-hop": "10.102.200.1", + "next-hop-type": "ip-address", + "resource-version": "1505857301151" + }, + { + "host-route-id": "8811c5f8-f1ed-4fa0-a505-e1be60396e28", + "route-prefix": "192.168.2.0/25", + "next-hop": "10.102.200.1", + "resource-version": "1505857301954" + } + ] + } + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + } + ] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + } + ] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + } + ] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ + { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + } + ], + "related-to-property": [ + { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + } + ] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ + { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + } + ], + "related-to-property": [ + { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + } + ] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ + { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + } + ], + "related-to-property": [ + { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + } + ] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ + { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + } + ], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + { + "property-key": "vpn-binding.vpn-type" + } + ] + } + ] + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json new file mode 100644 index 0000000000..5addff2d70 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json @@ -0,0 +1,596 @@ +{ + "cloud-owner": "att-aic", + "cloud-region-id": "mtn6", + "cloud-type": "openstack", + "owner-defined-type": "LCP", + "cloud-region-version": "3.0", + "cloud-zone": "AUS1", + "complex-name": "mtn6", + "resource-version": "1485202577", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-125" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2002" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-126" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0509A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0511C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_1Bindings_324_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-155" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "ST-MTN6-NoBinding-1707-18-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1710-4001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-119" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "aaaa-bbbb-cccc-dddd-eeee" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "direct_dhcp_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512B" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-1Binding-1710-0814-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-MTN6-NoBinding-1707-20-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1111-2222-3333-4444-5555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "dev_Bindings_full_1710_0907A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "wwww-xxxx-yyyy-zzzz" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-1002" + }] + }, + { + "related-to": "complex", + "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR", + "relationship-data": [ { + "relationship-key": "complex.physical-location-id", + "relationship-value": "AUSTTXGR" + }] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json new file mode 100644 index 0000000000..fadbf9c244 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json @@ -0,0 +1,596 @@ +{ + "cloud-owner": "att-aic", + "cloud-region-id": "mtn6", + "cloud-type": "openstack", + "owner-defined-type": "LCP", + "cloud-region-version": "2.5", + "cloud-zone": "AUS1", + "complex-name": "mtn6", + "resource-version": "1485202577", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-125" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2002" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-126" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0509A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0511C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_1Bindings_324_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-155" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "ST-MTN6-NoBinding-1707-18-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1710-4001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-119" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "aaaa-bbbb-cccc-dddd-eeee" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "direct_dhcp_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512B" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-1Binding-1710-0814-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-MTN6-NoBinding-1707-20-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1111-2222-3333-4444-5555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "dev_Bindings_full_1710_0907A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "wwww-xxxx-yyyy-zzzz" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-1002" + }] + }, + { + "related-to": "complex", + "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR", + "relationship-data": [ { + "relationship-key": "complex.physical-location-id", + "relationship-value": "AUSTTXGR" + }] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json new file mode 100644 index 0000000000..97611c1d62 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json @@ -0,0 +1,596 @@ +{ + "cloud-owner": "att-aic", + "cloud-region-id": "ERROR", + "cloud-type": "openstack", + "owner-defined-type": "LCP", + "cloud-region-version": "3.0", + "cloud-zone": "AUS1", + "complex-name": "mtn6", + "resource-version": "1485202577", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-125" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2002" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-126" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0509A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0511C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_1Bindings_324_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-155" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "ST-MTN6-NoBinding-1707-18-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1710-4001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-119" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "aaaa-bbbb-cccc-dddd-eeee" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "direct_dhcp_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512B" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-1Binding-1710-0814-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-MTN6-NoBinding-1707-20-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1111-2222-3333-4444-5555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "dev_Bindings_full_1710_0907A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "wwww-xxxx-yyyy-zzzz" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-1002" + }] + }, + { + "related-to": "complex", + "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR", + "relationship-data": [ { + "relationship-key": "complex.physical-location-id", + "relationship-value": "AUSTTXGR" + }] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json new file mode 100644 index 0000000000..181494dff2 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json @@ -0,0 +1,141 @@ +{ + "network-id": "467e3349-bec1-4922-bcb1-d0bb041bce30", + "network-name": "vprobes_pktinternal_net_4_1806", + "network-type": "CONTRAIL30_BASIC", + "network-role": "NetworkPktinternalInt2.pktinternal_int", + "network-technology": "", + "is-bound-to-vpn": false, + "service-id": "eb68dedb-840d-4bd4-a745-d9fcd8fc8468", + "network-role-instance": 0, + "resource-version": "1527285069624", + "orchestration-status": "Assigned", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": false, + "is-external-network": false, + "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/eb68dedb-840d-4bd4-a745-d9fcd8fc8468/service-data/networks/network/467e3349-bec1-4922-bcb1-d0bb041bce30/network-data/network-topology/", + "subnets": { + "subnet": [ + { + "subnet-id": "46aee427-3aa0-4c1f-beb6-edf6caae2dc1", + "subnet-name": "vprobes_pktinternal_net_4_1806_subnet_1", + "gateway-address": "192.168.224.1", + "network-start-address": "192.168.224.0", + "cidr-mask": "21", + "ip-version": "4", + "orchestration-status": "PendingCreate", + "dhcp-enabled": false, + "dhcp-start": "192.168.224.3", + "dhcp-end": "192.168.224.5", + "subnet-role": "DHCP", + "ip-assignment-direction": "true", + "resource-version": "1527285068387", + "host-routes": { + "host-route": [ + { + "host-route-id": "1de02743-580a-4f99-8285-3ba6eadb0892", + "route-prefix": "", + "next-hop": "", + "resource-version": "1527285059650" + } + ] + } + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Mobility/service-instances/service-instance/eb68dedb-840d-4bd4-a745-d9fcd8fc8468", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "Mobility" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "eb68dedb-840d-4bd4-a745-d9fcd8fc8468" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "eb68dedb-840d-4bd4-a745-d9fcd8fc8468" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "DYH1A" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type", + "property-value": "lcp" + } + ] + }, + { + "related-to": "tenant", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A/tenants/tenant/2871503957144f72b3cf481b379828ec", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "DYH1A" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "2871503957144f72b3cf481b379828ec" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "APP-C-24595-T-IST-04A" + } + ] + }, + { + "related-to": "vpn-binding", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/vpn-bindings/vpn-binding/13e94b71-3ce1-4988-ab0e-61208fc91f1c", + "relationship-data": [ + { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "13e94b71-3ce1-4988-ab0e-61208fc91f1c" + } + ], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "vMDNS" + }, + { + "property-key": "vpn-binding.vpn-type" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json new file mode 100644 index 0000000000..b22f389c40 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json @@ -0,0 +1,166 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": {"subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497" + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ]}, + "relationship-list": {"relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + }] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + }] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8" + } + ], + "related-to-property": [ { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + }] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + }], + "related-to-property": [ { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + }] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + }], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + {"property-key": "vpn-binding.vpn-type"} + ] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json new file mode 100644 index 0000000000..c581e54ef0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json @@ -0,0 +1,53 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": {"subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497" + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ]}, + "relationship-list": {"relationship": [] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json new file mode 100644 index 0000000000..5d9231d4c6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json @@ -0,0 +1,891 @@ +{ + "vpn-id": "13e94b71-3ce1-4988-ab0e-61208fc91f1c", + "vpn-name": "vMDNS", + "resource-version": "1510956324462", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/b3376949-5487-4a74-9029-332c07720c07", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b3376949-5487-4a74-9029-332c07720c07" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_hsl_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/d0b8ecd3-aee4-48ba-8bc5-222d3fb08162", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d0b8ecd3-aee4-48ba-8bc5-222d3fb08162" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/34305bd0-ad54-4349-8567-6f65ea09e750", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "34305bd0-ad54-4349-8567-6f65ea09e750" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vEPDG-FN_swu_direct_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/dfa4972a-ed82-43cd-98be-ed73bb3406a9", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "dfa4972a-ed82-43cd-98be-ed73bb3406a9" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_EXN_INTERNET_NET_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/93556256-aa23-449d-a2fd-3a9c034f232a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "93556256-aa23-449d-a2fd-3a9c034f232a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_CORE-NSD-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/7ce01c3a-5998-4908-85f6-ab29bc507a92", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7ce01c3a-5998-4908-85f6-ab29bc507a92" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKEN_CORE-NSD-TOAM0_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/016d3722-999b-4133-b4e6-8a1088bab664", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "016d3722-999b-4133-b4e6-8a1088bab664" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND-vepdg-FN-Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/80038196-9eae-452c-ad06-1f3fef1bef9f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "80038196-9eae-452c-ad06-1f3fef1bef9f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VPMS-FN-26071-T-BE-01_cdr_direct_net420" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f5f38447-dc62-4969-90a3-c60474f9c0ac", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f5f38447-dc62-4969-90a3-c60474f9c0ac" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_3" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/58b374aa-01ca-4a39-99b9-889c2f7ae908", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "58b374aa-01ca-4a39-99b9-889c2f7ae908" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_OAM_MGMT_NET_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/efe0dfca-18e7-4992-a63a-041b9f8271e0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "efe0dfca-18e7-4992-a63a-041b9f8271e0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_APN-dns_int_apn_dns_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/dab7e704-6a6e-4c53-9a80-fb5857a43b6f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "dab7e704-6a6e-4c53-9a80-fb5857a43b6f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKEN_CORE-NSD-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/634653b3-9084-41d9-ad6a-40863a3d666f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "634653b3-9084-41d9-ad6a-40863a3d666f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-01A_int_fw_dns_trusted_net_5" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6117b35e-c029-4308-85e6-007c24014484", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6117b35e-c029-4308-85e6-007c24014484" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-D-T001_vprobes_int_mgmt_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/eb1ce51b-d10f-4b08-9166-345335b9f73b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "eb1ce51b-d10f-4b08-9166-345335b9f73b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_OAMP_NSD_ISBC0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/468f83be-4abb-4901-950b-e399b77a09a0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "468f83be-4abb-4901-950b-e399b77a09a0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_IRPR-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/103d17dc-6575-427c-a2c1-301493e08ec0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "103d17dc-6575-427c-a2c1-301493e08ec0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_segw_hsl_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/305214f8-64be-4209-8a0d-10b6dfb77dd1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "305214f8-64be-4209-8a0d-10b6dfb77dd1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vMDS_FN_int_fw_dns_trusted_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/7989a6d2-ba10-4a5d-8f15-4520bc833090", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7989a6d2-ba10-4a5d-8f15-4520bc833090" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02AShared_cor_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f040ebf4-76ad-4b05-a766-1deec26549ae", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f040ebf4-76ad-4b05-a766-1deec26549ae" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_gn_untrusted_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/26d6038b-4b9e-4fe5-bcff-9af7586651cc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "26d6038b-4b9e-4fe5-bcff-9af7586651cc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-D-T001_vprobes_pktinternal_net_10" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/9e78d3f4-85b5-40b8-803e-c3a0ab6d6165", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9e78d3f4-85b5-40b8-803e-c3a0ab6d6165" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_MNS_Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/a2de22f9-eb91-452e-aff5-e81a1a679ef6", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "a2de22f9-eb91-452e-aff5-e81a1a679ef6" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_GN_DIRECT_NET_01" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6d6b7254-72d2-4731-80d6-8e8375d959e9", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6d6b7254-72d2-4731-80d6-8e8375d959e9" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_VDBE-PED-DMZ0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/21819ac4-95c4-490f-ba7c-0ad92920f805", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "21819ac4-95c4-490f-ba7c-0ad92920f805" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_FN_int_pktinternal_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/98ff6827-320a-4b71-bd2b-df2bd20b6855", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "98ff6827-320a-4b71-bd2b-df2bd20b6855" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_oam_protected_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/e229ab86-279c-4505-a08a-91e373293e20", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e229ab86-279c-4505-a08a-91e373293e20" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_OAM_DIRECT_NET_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/bb722f93-2d1a-42a5-bd11-57ad30ff1085", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "bb722f93-2d1a-42a5-bd11-57ad30ff1085" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_segw_hsl_direct_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0399443d-1fc6-42a6-934c-77030d751916", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0399443d-1fc6-42a6-934c-77030d751916" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VDBE-PED-DMZ0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/d259ec74-304d-4bd2-bbd6-93c201acba42", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d259ec74-304d-4bd2-bbd6-93c201acba42" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A__vprobes_int_mgmt_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f69fb458-e2bd-4d0f-9a47-430d18cbebfd", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f69fb458-e2bd-4d0f-9a47-430d18cbebfd" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VPMS-FN-26071-T-BE-01_cdr_direct_net4" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0f18b91f-ee79-403b-a081-8c0a89650641", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0f18b91f-ee79-403b-a081-8c0a89650641" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VPMS-FN_int_pktinternal_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/90fdbbbb-42bb-41ff-9356-db245466a4fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "90fdbbbb-42bb-41ff-9356-db245466a4fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_oam_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0e66adce-d5dd-4968-bcb2-83f0281424db", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0e66adce-d5dd-4968-bcb2-83f0281424db" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKEN_VDBF-MIS-UDAT0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/db572383-dbd7-4d5e-93cb-8c7c1d209a90", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "db572383-dbd7-4d5e-93cb-8c7c1d209a90" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_TRST_VIF_ISBC0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/478b7f86-8544-48e5-95f1-568dfd18730d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "478b7f86-8544-48e5-95f1-568dfd18730d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_GN_DIRECT_NET_01" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0f725895-5224-4016-b49a-d9d016eaafff", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0f725895-5224-4016-b49a-d9d016eaafff" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/9cd47b0c-ee58-46f0-9ec5-b4db504dd59b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9cd47b0c-ee58-46f0-9ec5-b4db504dd59b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-FN-25180-T-01Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f95259c9-f5c6-4861-a9f4-b6eec199b33f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f95259c9-f5c6-4861-a9f4-b6eec199b33f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/caf98ee4-2496-4c92-a41c-b6a50efcc29f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "caf98ee4-2496-4c92-a41c-b6a50efcc29f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_MGM-CORE-NSD-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/754739cb-5371-4d5b-a02a-489587d17443", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "754739cb-5371-4d5b-a02a-489587d17443" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_4" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8cd7add8-0cfc-4f65-bbf8-d0f25a0dbc70", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8cd7add8-0cfc-4f65-bbf8-d0f25a0dbc70" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VDBE-MIS-UDAT0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/7093921f-bed8-4866-bb3c-a2b8c376ca69", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7093921f-bed8-4866-bb3c-a2b8c376ca69" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_VIRPR-TDAT0_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/691da8b2-805e-4dd1-aaf5-b0e37414c662", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "691da8b2-805e-4dd1-aaf5-b0e37414c662" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_int_pktmirror_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/00eaa0b3-90df-4b43-a850-9d30abb7fded", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "00eaa0b3-90df-4b43-a850-9d30abb7fded" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-01AShared_oam_protected_net_5" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6ba57200-c61a-46be-821b-88b3fa169b66", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ba57200-c61a-46be-821b-88b3fa169b66" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_3" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8e32ec2c-47a1-4514-b21a-2806e23f0437", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8e32ec2c-47a1-4514-b21a-2806e23f0437" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKENb_VDBF-PSD-DMZ0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/a755ddd0-512a-444d-9f38-97b3eff70f85", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "a755ddd0-512a-444d-9f38-97b3eff70f85" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_UNTR_VSE_ISBC0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c7bde85d-1c12-467c-ae6f-57bdf5c1d380", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7bde85d-1c12-467c-ae6f-57bdf5c1d380" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKENb_VDBF-PSD-DMZ0_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0933fcec-9e78-4045-a21a-8258e18cb78e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0933fcec-9e78-4045-a21a-8258e18cb78e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vdbe_oam_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6a26a729-d9ce-4619-a20e-38597205ba7d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6a26a729-d9ce-4619-a20e-38597205ba7d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_swu_direct_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c1a06665-518b-408b-bfe0-8f393204baf6", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1a06665-518b-408b-bfe0-8f393204baf6" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/fb51398b-7622-4570-9bd6-e29c82621d44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb51398b-7622-4570-9bd6-e29c82621d44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_4" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/92072731-1c40-45c2-a218-5e75b713b312", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92072731-1c40-45c2-a218-5e75b713b312" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_TRST_VIF_ISBC0_net_0001" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c6d94632-fd6b-4bfe-993e-377b0368476b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c6d94632-fd6b-4bfe-993e-377b0368476b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-01AShared_int_ha_net_5" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/84516ef3-e371-4039-908e-83cd2b55a4a1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "84516ef3-e371-4039-908e-83cd2b55a4a1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "VPMS-FN-26071-T-BE-01_vprobes_int_mgmt_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/2c4f3adc-1a45-4484-8fb6-9eeac99eb922", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "2c4f3adc-1a45-4484-8fb6-9eeac99eb922" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_VDBE-MIS-UDAT0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/1fea0624-dac2-4997-904d-34ca1bc12fa9", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1fea0624-dac2-4997-904d-34ca1bc12fa9" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02AShared_cps_internal_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8ab98982-05b7-45b2-828d-648da3d6cc0f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8ab98982-05b7-45b2-828d-648da3d6cc0f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_swu_direct_fn_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c8934d59-24a8-41cc-af9d-2026ef261843", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c8934d59-24a8-41cc-af9d-2026ef261843" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_oam_protected_net_vrar_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c741fe5b-bf27-4ad9-b30d-20518e115495", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c741fe5b-bf27-4ad9-b30d-20518e115495" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_int_apn_dns_fn_net_PB_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8285fbae-ec25-44f7-ac52-89a968d45a2b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8285fbae-ec25-44f7-ac52-89a968d45a2b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-T2B_vEPDG-FN_swu_direct_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/65e6d4b0-0c96-4bfa-bdd6-2baa16df322a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65e6d4b0-0c96-4bfa-bdd6-2baa16df322a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vEPDG-FN_gn_untrusted_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/38e51c7b-adc2-491a-a036-3189645b007c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "38e51c7b-adc2-491a-a036-3189645b007c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vprobes_pktinternal_net_2_1806" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/4d210b09-b6ce-41b3-95a6-5e4dffea9ca2", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4d210b09-b6ce-41b3-95a6-5e4dffea9ca2" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vprobes_pktinternal_net_3_1806" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c5df1c57-3c85-4abc-973f-a1ffb13e391a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c5df1c57-3c85-4abc-973f-a1ffb13e391a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/467e3349-bec1-4922-bcb1-d0bb041bce30", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "467e3349-bec1-4922-bcb1-d0bb041bce30" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vprobes_pktinternal_net_4_1806" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/1596f4d2-66b5-4627-96f2-c26794154530", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1596f4d2-66b5-4627-96f2-c26794154530" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_2" + }] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml new file mode 100644 index 0000000000..6dd91c64c9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml @@ -0,0 +1,145 @@ + + 8d35a433-c1db-4d54-a611-6de10aeb76f9 + Dev_Bindings_1802_1311 + CONTRAIL30_BASIC + GN_EVPN_direct + contrail + true + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + 1517430804756 + pending-create + tbd + true + true + false + + + 9dbb9e7e-fe18-421f-bad6-2305bd282471 + + 107.118.41.1 + 107.118.41.0 + 24 + 4 + pending-create + true + 107.118.41.3 + 107.118.41.45 + + true + 1517430804770 + + + 1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab + + 107.118.42.1 + 107.118.42.0 + 24 + 4 + pending-create + true + 107.118.42.3 + 107.118.42.45 + + true + 1517430804782 + + + + + service-instance + /aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/f1d1c7da-fc42-4c31-866e-cfe963e55723 + + customer.global-customer-id + MSO_1610_dev + + + service-subscription.service-type + MSO-dev-service-type + + + service-instance.service-instance-id + f1d1c7da-fc42-4c31-866e-cfe963e55723 + + + service-instance.service-instance-name + MSO-DEV-SI-1802-v6-1-31-nwk1 + + + + cloud-region + /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6 + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + cloud-region.owner-defined-type + LCP + + + + tenant + /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8 + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + tenant.tenant-id + 0422ffb57ba042c0800a29dc85ca70f8 + + + tenant.tenant-name + ECOMP_MSO_DND + + + + network-policy + /aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc + + network-policy.network-policy-id + 0219d83f-7c4a-48e2-b8fc-9b20459356bc + + + network-policy.network-policy-fqdn + default-domain:ECOMP_MSO_DND:MSOPolicyD + + + + network-policy + /aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64 + + network-policy.network-policy-id + e7a3560c-8b29-4611-a404-83af0b31ce64 + + + network-policy.network-policy-fqdn + default-domain:ECOMP_MSO_DND:MSOPolicyC + + + + vpn-binding + /aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001 + + vpn-binding.vpn-id + 9a7b327d9-287aa00-82c4b0-100001 + + + vpn-binding.vpn-name + MSO_VPN_TEST + + + vpn-binding.vpn-type + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json new file mode 100644 index 0000000000..f076c9044c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json @@ -0,0 +1,162 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": {"subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497" + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ]}, + "relationship-list": {"relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + }] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + }] + }, + { + "related-to": "vf-module", + "related-link": "aai/v11/network/generic-vnfs/generic-vnf/105df7e5-0b3b-49f7-a837-4864b62827c4/vf-modules/vf-module/d9217058-95a0-49ee-b9a9-949259e89349", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "105df7e5-0b3b-49f7-a837-4864b62827c4" + }, + { + "relationship-key": "vf-module.vf-module-id", + "relationship-value": "d9217058-95a0-49ee-b9a9-949259e89349" + } + ], + "related-to-property": [ { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + }] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + }], + "related-to-property": [ { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + }] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + }], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + {"property-key": "vpn-binding.vpn-type"} + ] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml new file mode 100644 index 0000000000..92fec2dc64 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml @@ -0,0 +1,149 @@ + + 8d35a433-c1db-4d54-a611-6de10aeb76f9 + Dev_Bindings_1802_1311 + CONTRAIL30_BASIC + GN_EVPN_direct + contrail + b6a7820c-4734-4ef2-8a73-a22c824423fa + true + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + 1517430804756 + Created + Dev_Bindings_1802_1311/ecf7e197-72db-452e-9eda-253cb642c9b7 + default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_1311 + tbd + true + true + false + + + 9dbb9e7e-fe18-421f-bad6-2305bd282471 + 27d414c7-1076-4595-aa45-4717ee992cef + 107.118.41.1 + 107.118.41.0 + 24 + 4 + Created + true + 107.118.41.3 + 107.118.41.45 + 1517430804770 + + true + + + 1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab + db64710c-fbbc-4dc9-8109-3925b87268fa + 107.118.42.1 + 107.118.42.0 + 24 + 4 + Created + true + 107.118.42.3 + 107.118.42.45 + 1517430804782 + + true + + + + + service-instance + /aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/f1d1c7da-fc42-4c31-866e-cfe963e55723 + + customer.global-customer-id + MSO_1610_dev + + + service-subscription.service-type + MSO-dev-service-type + + + service-instance.service-instance-id + f1d1c7da-fc42-4c31-866e-cfe963e55723 + + + service-instance.service-instance-name + MSO-DEV-SI-1802-v6-1-31-nwk1 + + + + cloud-region + /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6 + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + cloud-region.owner-defined-type + LCP + + + + tenant + /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8 + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + tenant.tenant-id + 0422ffb57ba042c0800a29dc85ca70f8 + + + tenant.tenant-name + ECOMP_MSO_DND + + + + network-policy + /aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc + + network-policy.network-policy-id + 0219d83f-7c4a-48e2-b8fc-9b20459356bc + + + network-policy.network-policy-fqdn + default-domain:ECOMP_MSO_DND:MSOPolicyD + + + + network-policy + /aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64 + + network-policy.network-policy-id + e7a3560c-8b29-4611-a404-83af0b31ce64 + + + network-policy.network-policy-fqdn + default-domain:ECOMP_MSO_DND:MSOPolicyC + + + + vpn-binding + /aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001 + + vpn-binding.vpn-id + 9a7b327d9-287aa00-82c4b0-100001 + + + vpn-binding.vpn-name + MSO_VPN_TEST + + + vpn-binding.vpn-type + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf new file mode 100644 index 0000000000..09634c199b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf @@ -0,0 +1,107 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "complete", + "statusMessage": "", + "solutionInfo": { + "licenseInfo": [ + { + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_primary_1", + "serviceResourceId": "testResourceIdAR" + }, + { + "entitlementPoolList": [ + "91d563e8-e714-4393-8f99-cc480144a05e", + "21d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "31d563e8-e714-4393-8f99-cc480144a05e", + "71d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_secondary_1", + "serviceResourceId": "testResourceIdVNF" + } + ], + "placementInfo": [ + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "MDTNJ01" + }, + { + "variableName": "aicClli", + "variableValue": "KDTNJ01" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "dfwtx", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID1", + "serviceResourceId": "testResourceIdAR" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "testVnfHostname2" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli2" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId2", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID2", + "serviceResourceId": "testResourceIdAR2" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli3" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId3", + "inventoryType": "cloud", + "resourceModuleName": "VNF", + "serviceInstanceId": "", + "serviceResourceId": "testResourceIdVNF" + } + ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net new file mode 100644 index 0000000000..ac9b466ab7 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net @@ -0,0 +1,165 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "complete", + "statusMessage": "", + "solutionInfo": { + "licenseInfo": [ + { + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_primary_1", + "serviceResourceId": "testResourceIdAR" + }, + { + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05n", + "j1d563e8-e714-4393-8f99-cc480144a05n" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05n", + "b1d563e8-e714-4393-8f99-cc480144a05n" + ], + "resourceModuleName": "net", + "serviceResourceId": "testResourceIdNet2" + }, + { + "entitlementPoolList": [ + "91d563e8-e714-4393-8f99-cc480144a05e", + "21d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "31d563e8-e714-4393-8f99-cc480144a05e", + "71d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_secondary_1", + "serviceResourceId": "testResourceIdVNF" + } + ], + "placementInfo": [ + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "MDTNJ01" + }, + { + "variableName": "aicClli", + "variableValue": "KDTNJ01" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "dfwtx", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID1", + "serviceResourceId": "testResourceIdAR" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "testVnfHostname2" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli2" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId2", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID2", + "serviceResourceId": "testResourceIdAR2" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "testVnfHostNameNet" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClliNet" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionIdNet", + "inventoryType": "service", + "resourceModuleName": "NETWORK", + "serviceInstanceId": "testServiceInstanceIdNet", + "serviceResourceId": "testResourceIdNet" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClliNet2" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionIdNet2", + "inventoryType": "cloud", + "resourceModuleName": "NETWORK", + "serviceInstanceId": "", + "serviceResourceId": "testResourceIdNet2" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli3" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId3", + "inventoryType": "cloud", + "resourceModuleName": "VNF", + "serviceInstanceId": "", + "serviceResourceId": "testResourceIdVNF" + } + ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound new file mode 100644 index 0000000000..2150a053fb --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound @@ -0,0 +1,15 @@ +{ + "requestState": "", + "responseTime": "", + "solutionInfo": { + "placementInfo": [], + "licenseInfo": { + "featureGroupId": "" + } + }, + "percentProgress": "", + "requestId": "02c2e322-5839-4c97-9d46-0a5fa6bb642e", + "startTime": "", + "statusMessage": "No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8", + "requestType": "" +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException new file mode 100644 index 0000000000..b82688428e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException @@ -0,0 +1,9 @@ +{ + "requestError": { + "policyException": { + "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", + "text": "Message content size exceeds the allowable limit", + "messageId": "SVC0001" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException new file mode 100644 index 0000000000..6cc78a7cdb --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException @@ -0,0 +1,12 @@ +{ + "requestError": { + "serviceException": { + "variables": [ + "severity", 400 + ], + "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", + "text": "SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8", + "messageId": "SVC0001" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml new file mode 100644 index 0000000000..90c668c576 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 2.5 + RDM2WAGPLCP + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml new file mode 100644 index 0000000000..9b651f25e3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 3.0 + RDM2WAGPLCP + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_400.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_400.xml new file mode 100644 index 0000000000..a5640b2b26 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_400.xml @@ -0,0 +1,6 @@ + + +680bd458-5ec1-4a16-b77c-509022e53450INTERNAL +400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data +true + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_500.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_500.xml new file mode 100644 index 0000000000..02996a13ea --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_500.xml @@ -0,0 +1,80 @@ + + + JBoss Web/7.2.2.Final-redhat-1 - JBWEB000064: Error report + + + + +

JBWEB000065: HTTP Status 500 - java.lang.NullPointerException

+
+

+ JBWEB000309: type + JBWEB000066: Exception report +

+

+ JBWEB000068: message + java.lang.NullPointerException +

+

+ JBWEB000069: description + JBWEB000145: The server encountered an internal error that + prevented it from fulfilling this request. + +

+

+ JBWEB000070: exception +

org.jboss.resteasy.spi.UnhandledException:
+				java.lang.NullPointerException
+				org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365)
+				org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233)
+				org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209)
+				org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557)
+				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
+				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
+				org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
+				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
+				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
+				javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
+				org.onap.so.logger.LogFilter.doFilter(LogFilter.java:35)
+			
+

+

+ JBWEB000071: root cause +

java.lang.NullPointerException
+				org.onap.so.adapters.network.NetworkAdapterRest$CreateNetworkVolumesTask.run(NetworkAdapterRest.java:128)
+				org.onap.so.adapters.network.NetworkAdapterRest.createNetwork(NetworkAdapterRest.java:64)
+				sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+				sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+				sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+				java.lang.reflect.Method.invoke(Method.java:606)
+				org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
+				org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
+				org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
+				org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
+				org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
+				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
+				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
+				org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
+				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
+				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
+				javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
+				org.onap.so.logger.LogFilter.doFilter(LogFilter.java:35)
+			
+

+

+ JBWEB000072: note + JBWEB000073: The full stack trace of the root cause is available + in the JBoss Web/7.2.2.Final-redhat-1 logs. + +

+
+

JBoss Web/7.2.2.Final-redhat-1

+ + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_Success.xml new file mode 100644 index 0000000000..90177f1c6d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_Success.xml @@ -0,0 +1,24 @@ + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + + + + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + true + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + CONTRAIL_EXTERNAL + false + c4f4e878-cde0-4b15-ae9a-bda857759cea + 7dd5365547234ee8937416c65507d266 + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryInstance_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryInstance_Success.xml new file mode 100644 index 0000000000..ca5145c226 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryInstance_Success.xml @@ -0,0 +1,4 @@ + + service-instance + https://aai-conexus-e2e.test.com:8443/aai/v8/business/customers/customer/8310000058863/service-subscriptions/service-subscription/vMOG/service-instances/service-instance/f70e927b-6087-4974-9ef8-c5e4d5847ca4 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName2_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName2_AAIResponse_Success.xml new file mode 100644 index 0000000000..d6f7737a2a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName2_AAIResponse_Success.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4_3 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNameActive_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNameActive_AAIResponse_Success.xml new file mode 100644 index 0000000000..03b37814b1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNameActive_AAIResponse_Success.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_2 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + active + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + active + true + subnetName + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + route-table-reference + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_404.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_404.xml new file mode 100644 index 0000000000..5cda12da2f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_404.xml @@ -0,0 +1,19 @@ + + 404 + HTTP method: GET Not Found + <Fault> + <requestError> + <serviceException> + <messageId>SVC3001</messageId> + <text>Resource not found for %1 using id %2 (msg=%3) (ec=%4)</text> + <variables> + <variable>GETl3Networks</variable> + <variable xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/> + <variable>Node Not Found:No Node of type l3Network found for properties: (network-id = null)</variable> + <variable>ERR.5.4.6114</variable> + </variables> + </serviceException> + </requestError> +</Fault> + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml new file mode 100644 index 0000000000..4eadb1061e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_404.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_404.xml new file mode 100644 index 0000000000..5cda12da2f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_404.xml @@ -0,0 +1,19 @@ + + 404 + HTTP method: GET Not Found + <Fault> + <requestError> + <serviceException> + <messageId>SVC3001</messageId> + <text>Resource not found for %1 using id %2 (msg=%3) (ec=%4)</text> + <variables> + <variable>GETl3Networks</variable> + <variable xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/> + <variable>Node Not Found:No Node of type l3Network found for properties: (network-id = null)</variable> + <variable>ERR.5.4.6114</variable> + </variables> + </serviceException> + </requestError> +</Fault> + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml new file mode 100644 index 0000000000..e06d27ea88 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml @@ -0,0 +1,73 @@ + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml new file mode 100644 index 0000000000..6e319c4c73 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + true + + + string + 192.10.16.0/24 + 192.10.16.100/24 + ip-address + + + string + 192.110.17.0/24 + 192.110.17.110/24 + ip-address + + + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..79cc14ada3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 13979:105757 + 13979:105757 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml new file mode 100644 index 0000000000..db134a1127 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + 5938baec-03ca-2bd5-a3f1-d54x123e253a + refFQDN1 + 12345 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml new file mode 100644 index 0000000000..34b4a036c4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + 5938baec-03ca-2bd5-a3f1-d54x123e253a + refFQDN2 + 12345 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBindingList_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBindingList_AAIResponse_Success.xml new file mode 100644 index 0000000000..c01d0a4f61 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBindingList_AAIResponse_Success.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + + + 13979:105708 + EXPORT + 1504025599510 + + + 13979:105707 + IMPORT + 1504025599519 + + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ + + l3-network.network-id + 689ec39e-c5fc-4462-8db2-4f760763ad28 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ + + l3-network.network-id + 1a49396b-19b3-40a4-8792-aa2fbd0f0704 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ + + l3-network.network-id + 774f3329-3c83-4771-86c7-9e6207cd50fd + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml new file mode 100644 index 0000000000..5f1c2cafa5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 13979:105757 + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ + + l3-network.network-id + 689ec39e-c5fc-4462-8db2-4f760763ad28 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ + + l3-network.network-id + 1a49396b-19b3-40a4-8792-aa2fbd0f0704 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ + + l3-network.network-id + 774f3329-3c83-4771-86c7-9e6207cd50fd + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml new file mode 100644 index 0000000000..eedbda9343 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml new file mode 100644 index 0000000000..4f87e1a1da --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml @@ -0,0 +1,15 @@ + + + + + + + 79ec9006-3695-4fcc-93a8-be6f9e248beb + 200 + OK + + <output xmlns="org:onap:sdnc:northbound:generic-resource"><response-message></response-message><svc-request-id>79ec9006-3695-4fcc-93a8-be6f9e248beb</svc-request-id><service-response-information><instance-id>f805ec2b-b4d8-473e-8325-67f110139e5d</instance-id></service-response-information><response-code>200</response-code><network-response-information><instance-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</instance-id><object-path>restconf/config/GENERIC-RESOURCE-API:services/service/f805ec2b-b4d8-473e-8325-67f110139e5d/service-data/networks/network/f7e4db56-aab5-4065-8e65-cec1cd1de24f</object-path></network-response-information><ack-final-indicator>Y</ack-final-indicator></output> + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml new file mode 100644 index 0000000000..836b3c8055 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml @@ -0,0 +1,17 @@ + + + + + + + testRequestId + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/DoCreateServiceInstanceInput.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/DoCreateServiceInstanceInput.json new file mode 100644 index 0000000000..45b09a1f59 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/DoCreateServiceInstanceInput.json @@ -0,0 +1,42 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "service", +"modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", +"modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", +"modelName": "Test", +"modelVersion": "1.0" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "mdt1", +"tenantId": "88a6ca3ee0394ade9403f075db23167e" +}, +"owningEntity": { +"owningEntityId": "a", +"owningEntityName": "a" +}, +"project": { +"projectName": "temp project" +}, +"subscriberInfo": { +"globalSubscriberId": "some subscriber id", +"subscriberName": "some subscriber name" +}, +"requestInfo": { +"productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", +"source": "VID", +"suppressRollback": true, +"requestorId": "xxxxxx" +}, +"requestParameters": { +"subscriptionServiceType": "MOG", +"aLaCarte": false, +"userParams": [ +{ +"name": "someUserParam", +"value": "someValue" +} +] +} +} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/SetupServiceDecompJson.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/SetupServiceDecompJson.json new file mode 100644 index 0000000000..e7960b7273 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/SetupServiceDecompJson.json @@ -0,0 +1,36 @@ +{ + "requestDetails": { + "serviceInstance": { + "serviceInstanceId": "MSORefactorTest3", + "serviceInstanceName": "bensServiceInstance3", + "serviceType": "MSO-dev-service-type", + "serviceRole": "abc", + "modelInvariantUuid": "d214abcc-2083-11e7-93ae-92361f002671", + "modelUuid": "c4503baa-2083-11e7-93ae-92361f002671", + "modelVersion": "1.0", + "modelName": "MSOTADevInfra_vSAMP12_Service", + "environmentContext": "Luna", + "workloadContext": "Oxygen", + "orchestrationStatus": "ACTIVE" + }, + "project": { + "projectName": "vSAMP12 Project" + }, + "owningEntity": { + "owningEntityId": "MSO-Test-OE", + "owningEntityName": "MSO-Test123" + }, + "customer": { + "subscriptionServiceType": "MSO-dev-service-type", + "globalSubscriberId": "MSO_1610_dev" + }, + "request": { + "sdncRequestId": "736c7370-640b-4f7a-975d-320f73340dd3", + "callbackURL": "abc", + "requestId": "223c2e74-a23a-4ab8-bddb-2c2431dcb67f", + "productFamilyId": "abc", + "callbackUrl": "http://localhost:8080/adapters/rest/SDNCNotify", + "serviceId": "123" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/createServiceInstance_createServiceInstance_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/createServiceInstance_createServiceInstance_AAIResponse_Success.xml new file mode 100644 index 0000000000..eedbda9343 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/createServiceInstance_createServiceInstance_AAIResponse_Success.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml new file mode 100644 index 0000000000..be820b83b1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + 8310000058863 + Mobility + INFRA + 1452288058 + + + vMOG + 1452288058 + + + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + gg0e927b-6087-5574-9ef8-c5e4d5847db5 + V1.0 + vMOG-AKRON-1234 + 1462561835 + + + + + + + tenant + https://aai-conexus-e2e.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/396d61752cf04c3b8ca2afcb4ee049e9/ + + tenant.tenant-id + 396d61752cf04c3b8ca2afcb4ee049e9 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + AAIAIC25 + + + tenant.tenant-name + vMOG-AKRON-PROD + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml new file mode 100644 index 0000000000..1ede44427a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml @@ -0,0 +1,7 @@ + + + {{MESSAGE-ID}} + INTERNAL + Exception during create VF Create VF Module: Unable to determine specific VF Module Type: Nimbus_LU2_PXMC_Svc/PXMC_09_20_2016_v2 3::Pxmc09202016V2..pxmc_base.yaml..module-2 with version = 3.0 + true + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..a421355aba --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,53 @@ + + + {{MESSAGE-ID}} + true + d485ecee-957c-4a0a-8b95-27a22b90103f + + + mmsc_vol_1 + a73e0fe9-1ce8-49c2-8fef-e2788605be29 + + + mmsc_vol_2 + 37b6455a-5ea8-463a-89e3-0efeaf7b7c6d + + + nemsfe_vol_1 + b7ff1c21-d138-49a3-bf13-4cfd91efaf48 + + + nemsbe_vol_1 + a5988471-cd42-44d8-b078-64f2f13d3d4c + + + mmsc_vol_5 + f7b91c1e-ab8c-413a-a850-ba80a246c7e0 + + + nemsfe_vol_2 + 957ea3f3-2d4a-4707-bfd2-ba66f42037c2 + + + mmsc_vol_3 + de6fccfe-d61a-48b0-b03b-87bf1bf749b3 + + + mmsc_vol_4 + 76162310-2c38-4c32-981c-5c2880190077 + + + + RDM2WAGPLCP + e585e4f4-9452-437a-b294-45a2d6d3b7a3 + + c30b9453-4b68-4c2e-aacf-58a5ba648bf5 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + 1bbab536a19b4756926e7d0ec1eb543c + true + 78987 + ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef + + ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeRequest.xml new file mode 100644 index 0000000000..34604f1edd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeRequest.xml @@ -0,0 +1,24 @@ + + + 123abc + d8d4fcfa-fd7e-4413-b19d-c95aa67291b8 + CREATE_VF_MODULE_VOL + SoapUI-bns-create-base-vol-1001-1 + + + Test/vSAMP12 + vSAMP12::base::module-0 + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MDTWNJ21 + 897deadc2b954a6bac6d3c197fb3525e + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + + + + value1" + value2" + value3" + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/GenericVnf.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/GenericVnf.xml new file mode 100644 index 0000000000..aea1a46017 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/GenericVnf.xml @@ -0,0 +1,38 @@ + + TEST-VNF-ID-0123 + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + pending-create + false + false + introvert + 2.0 + 0000020 + + + lukewarm + PCRF::module-0-0 + introvert + 2.0 + true + fastburn + pending-create + 0000074 + + + supercool + PCRF::module-1-0 + extrovert + 2.0 + false + slowburn + pending-create + 0000075 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..6ab9416617 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,5 @@ + + + {{MESSAGE-ID}} + true + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json new file mode 100644 index 0000000000..6853daa4b1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json @@ -0,0 +1,71 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1", + "modelCustomizationUuid": "ee6478e5-ea33-3346-ac12-ab121484a3fe" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1", + "modelInstanceName": "vSAMP12" + } + } + } + ], + "requestParameters": { + "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "userParams": [ + {"name": "vnfName", "value": "STMTN5MMSC20" }, + {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, + {"name": "vnfNmInformation", "value": "" }, + {"name": "vnfType", "value": "pcrf-capacity" }, + {"name": "vnfId", "value": "skask" }, + {"name": "vnfStackId", "value": "slowburn" }, + {"name": "vnfStatus", "value": "created" }, + {"name": "aicCloudRegion", "value": "MDTWNJ21" }, + {"name": "availabilityZone", "value": "slcp3-esx-az01" }, + {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, + {"name": "vmName", "value": "slcp34246vbc246ceb" }, + {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, + {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" }, + {"name": "vlc_sctp_b_route_prefixes", + "value": [ + { "interface_route_table_routes_route_prefix": "107.239.41.163/32" }, + { "interface_route_table_routes_route_prefix": "107.239.41.164/32" }, + { "interface_route_table_routes_route_prefix": "107.239.41.165/32" } + ]} + ] + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json new file mode 100644 index 0000000000..de99a6da56 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json @@ -0,0 +1,45 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "{parent service model name}", + "modelVersion": "1" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test/vSAMP12", + "modelVersion": "1" + } + } + } + ] + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..02b43ff186 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + simpleCinderVolume_201604071 + simpleCinderVolume_201604071 + simpleCinderVolume_201604071 + simple_cinder_master + Pending + 1460134360 + + + tenant + https://aai-ext1.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..1574310474 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml new file mode 100644 index 0000000000..96e906f9bf --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml @@ -0,0 +1,31 @@ + + + 94f0f72f-4be1-49ed-8410-702396797163 + MSOTESTVOL103H-vSAMP12_base_vol_module-0 + + Test/vSAMP12 + Pending + 1469203133 + + + tenant + https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/e444c311b27a45dc9522f2370d70f90f/ + + tenant.tenant-id + e444c311b27a45dc9522f2370d70f90f + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + tenant.tenant-name + MSOCustomer1 + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..7aa9c3e8ac --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + 8424bb3c-c3e7-4553-9662-469649ed9379 + MSOTESTVOL103W-vSAMP12_base_vol_module-0 + + simple_cinder_master + Pending + ee6478e5-ea33-3346-ac12-ab121484a3fe + 1460134360 + + + tenant + https://aai-ext1.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..1574310474 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/getSIUrlById.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/getSIUrlById.xml new file mode 100644 index 0000000000..416689e10c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/getSIUrlById.xml @@ -0,0 +1,6 @@ + + + service-instance + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml new file mode 100644 index 0000000000..7e2a676283 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml @@ -0,0 +1,62 @@ + + 78987 + MSOTESTVOL102a-vSAMP12_base_vol_module-0 + + Test/vSAMP12 + Pending + 0000020 + + + generic-vnf + https://localhost:8443/aai/v8/network/generic-vnfs/generic-vnf/9e48f6ea-f786-46de-800a-d480e5ccc846/ + + generic-vnf.vnf-id + 9e48f6ea-f786-46de-800a-d480e5ccc846 + + + generic-vnf.vnf-name + MSOSTSAMP12-10601 + + + + tenant + https://localhost:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ + + tenant.tenant-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mdt1 + + + tenant.tenant-name + ECOMP_MDT1 + + + + vf-module + https://localhost:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ + + vf-module.vf-module-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mdt1 + + + vf-module.vf-module-name + ECOMP_MDT1 + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModule_VID_request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModule_VID_request.json new file mode 100644 index 0000000000..808e371191 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModule_VID_request.json @@ -0,0 +1,77 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "STMTN5MMSC21-MMSC::model-1-0", + "modelVersion": "1", + "modelCustomizationUuid": "ee6478e5-ea33-3346-ac12-ab121484a3fe" + }, + "subscriberInfo": { + "globalSubscriberId": "MSO_1610_dev_id", + "subscriberName": "MSO_1610_dev_name" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "MDTWNJ21", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "PCRF::module-0-2", + "source": "VID", + "suppressRollback": true + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", + "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12..base..module-0", + "modelVersion": "1" + } + } + }, + { + "relatedInstance": { + "instanceId": "123456", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "SERVICE_MODEL_NAME", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "skask", + "instanceName": "skask-test", + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "skask", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelInstanceName": "vSAMP12 1" + } + } + } + ], + "requestParameters": { + "usePreload": true, + "aLaCarte": false, + "userParams": [{ + "name": "vlc_sctp_b_route_prefixes", + "value": [ + { "interface_route_table_routes_route_prefix": "107.239.41.163/32" }, + { "interface_route_table_routes_route_prefix": "107.239.41.164/32" }, + { "interface_route_table_routes_route_prefix": "107.239.41.165/32" } + ]}] + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModule_VID_request_noPreloads.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModule_VID_request_noPreloads.json new file mode 100644 index 0000000000..b51741f879 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModule_VID_request_noPreloads.json @@ -0,0 +1,79 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "STMTN5MMSC21-MMSC::model-1-0", + "modelVersion": "1", + "modelCustomizationUuid": "ee6478e5-ea33-3346-ac12-ab121484a3fe" + }, + "subscriberInfo": { + "globalSubscriberId": "MSO_1610_dev_id", + "subscriberName": "MSO_1610_dev_name" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "MDTWNJ21", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "PCRF::module-0-2", + "source": "VID", + "suppressRollback": true + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", + "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12..base..module-0", + "modelVersion": "1" + } + } + }, + { + "relatedInstance": { + "instanceId": "123456", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "SERVICE_MODEL_NAME", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "skask", + "instanceName": "skask-test", + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "skask", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelInstanceName": "vSAMP12 1" + } + } + } + ], + "requestParameters": { + "usePreload": false, + "userParams": [ + { + "name": "someUserParam", + "value": "someValue" + }, + { + "name": "sgi_protected_subnet_id", + "value": "thisissomefakevalue" + } + ] + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModule_VID_request_userParam.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModule_VID_request_userParam.json new file mode 100644 index 0000000000..68de099c16 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModule_VID_request_userParam.json @@ -0,0 +1,77 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "STMTN5MMSC21-MMSC::model-1-0", + "modelVersion": "1", + "modelCustomizationUuid": "ee6478e5-ea33-3346-ac12-ab121484a3fe" + }, + "subscriberInfo": { + "globalSubscriberId": "MSO_1610_dev_id", + "subscriberName": "MSO_1610_dev_name" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "MDTWNJ21", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "PCRF::module-0-2", + "source": "VID", + "suppressRollback": true + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", + "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12..base..module-0", + "modelVersion": "1" + } + } + }, + { + "relatedInstance": { + "instanceId": "123456", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "SERVICE_MODEL_NAME", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "skask", + "instanceName": "skask-test", + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "skask", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelInstanceName": "vSAMP12 1" + } + } + } + ], + "requestParameters": { + "usePreload": true, + "aLaCarte": false, + "userParams": [{ + "name": "vlc_sctp_b_route_prefixes", + "value": [ + { "interface_route_table_routes_route_prefix": "107.239.41.163/32" }, + { "interface_route_table_routes_route_prefix": "107.239.41.164/32" }, + { "interface_route_table_routes_route_prefix": "107.239.41.165/32" } + ]} + ]} + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DBUpdateResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DBUpdateResponse.xml new file mode 100644 index 0000000000..0942e09e31 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DBUpdateResponse.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Database/DBAdapter.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Database/DBAdapter.xml new file mode 100644 index 0000000000..5a36d741d0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Database/DBAdapter.xml @@ -0,0 +1 @@ +Notified \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Database/DBUpdateResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Database/DBUpdateResponse.xml new file mode 100644 index 0000000000..0ae5b79484 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Database/DBUpdateResponse.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml new file mode 100644 index 0000000000..ca195324d3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml @@ -0,0 +1,7 @@ + + + + <output xmlns="org:onap:sdnctl:vnf"><svc-request-id>1660b8da-0a94-442d-8ed5-ea079e3c67c8</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><vnf-information><vnf-id>8925b50d-de67-44c1-b984-e7ce7b0f4dae</vnf-id></vnf-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>8925b50d-de67-44c1-b984-e7ce7b0f4dae</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml new file mode 100644 index 0000000000..90c668c576 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 2.5 + RDM2WAGPLCP + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml new file mode 100644 index 0000000000..9b651f25e3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 3.0 + RDM2WAGPLCP + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteAAIResponse_Failure500_RESTFault.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteAAIResponse_Failure500_RESTFault.xml new file mode 100644 index 0000000000..4ce7048950 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteAAIResponse_Failure500_RESTFault.xml @@ -0,0 +1,19 @@ + + 500 + HTTP method: GET Internal Server Error + <Fault> + <requestError> + <serviceException> + <messageId>SVC3002</messageId> + <text>Error writing output performing %1 on %2 (msg=%3) (ec=%4)</text> + <variables> + <variable>PUT customer</variable> + <variable>SubName32</variable> + <variable>Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [12312442454112] violates a uniqueness constraint [service-instance-id]</variable> + <variable>ERR.5.4.5105</variable> + </variables> + </serviceException> + </requestError> +</Fault> + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml new file mode 100644 index 0000000000..c12bcd49c9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_BASIC + HSL_direct + contrail + 8bbd3edf-b835-4610-96a2-a5cafa029042 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + active + HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 + + + ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a + 5a77fdc2-7789-4649-a1b9-6eaf1db1813a + 172.16.34.1 + 172.16.34.0 + 28 + 4 + active + true + + + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ + + tenant.tenant-id + e81d842d3e8b45c5a59f57cd76af3aaf + + + + cloud-region + cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP/ + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + RDM2WAGPLCP + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml new file mode 100644 index 0000000000..b108fb25ab --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_BASIC + HSL_direct + contrail + 8bbd3edf-b835-4610-96a2-a5cafa029042 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + active + HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 + + + ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a + 5a77fdc2-7789-4649-a1b9-6eaf1db1813a + 172.16.34.1 + 172.16.34.0 + 28 + 4 + active + true + + + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ + + tenant.tenant-id + e81d842d3e8b45c5a59f57cd76af3aaf + + + + vf-module + https://aai-app-e2e.ecomp.cci.com:8443/aai/v8/network/generic-vnfs/generic-vnf/105df7e5-0b3b-49f7-a837-4864b62827c4/vf-modules/vf-module/d9217058-95a0-49ee-b9a9-949259e89349/ + + generic-vnf.vnf-id + 105df7e5-0b3b-49f7-a837-4864b62827c4 + + + vf-module.vf-module-id + d9217058-95a0-49ee-b9a9-949259e89349 + + + + generic-vnf + https://aai-app-e2e.test.com:8443/aai/v8/network/generic-vnfs/generic-vnf/45f822d9-73ca-4255-9844-7cef401bbf47/ + + generic-vnf.vnf-id + 45f822d9-73ca-4255-9844-7cef401bbf47 + + + generic-vnf.vnf-name + zrdm1scpx05 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml new file mode 100644 index 0000000000..1d198caf5d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml @@ -0,0 +1,17 @@ + + + + + + + 19174929-3809-49ca-89eb-17f84a035389 + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse_noExtraTag.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse_noExtraTag.xml new file mode 100644 index 0000000000..bc0eab88a7 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse_noExtraTag.xml @@ -0,0 +1,17 @@ + + + + + + + 19174929-3809-49ca-89eb-17f84a035389 + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleCallbackResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleCallbackResponse.xml new file mode 100644 index 0000000000..74a3beb221 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleCallbackResponse.xml @@ -0,0 +1,21 @@ + + + 86651f79-057e-4245-8f5f-174db3cef553-1502888133261 + true + 20928949-5230-495d-86a6-f3690b9b5d60 + + + shared_private_network_id + bcd04543-b3d7-4c64-a910-1735b875ebb2 + + + server1_port + d1605e82-50ba-4544-9f8d-a8a37b678046 + + + vnf_id + 7da56895-6be1-4bec-856b-525e0e573199 + + + 7da56895-6be1-4bec-856b-525e0e573199 + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..25aa45afd9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,5 @@ + + + {{MESSAGE-ID}} + true + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json new file mode 100644 index 0000000000..c6cc1ca428 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json @@ -0,0 +1,17 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantUuid": "0b01b8c2-8416-11e6-ae22-56b6b6499611", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1.0" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "MDTWNJ21", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "source": "VID" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml new file mode 100644 index 0000000000..fd10548cef --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml @@ -0,0 +1,42 @@ + + 78987 + MSOTESTVOL102a-vSAMP12_base_vol_module-0 + + Test/vSAMP12 + Pending + 0000020 + + + generic-vnf + https://aai-ext1.test.com:8443/aai/v8/network/generic-vnfs/generic-vnf/9e48f6ea-f786-46de-800a-d480e5ccc846/ + + generic-vnf.vnf-id + 9e48f6ea-f786-46de-800a-d480e5ccc846 + + + generic-vnf.vnf-name + MSOSTSAMP12-10601 + + + + tenant + https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ + + tenant.tenant-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mdt1 + + + tenant.tenant-name + ECOMP_MDT1 + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModule_VID_request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModule_VID_request.json new file mode 100644 index 0000000000..c75c32d498 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModule_VID_request.json @@ -0,0 +1,50 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantId": "973ed047-d251-4fb9-bf1a-65b8949e0a73", +"modelNameVersionId": "973ed047-d251-4fb9-bf1a-65b8949e0a73", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceId": "973ed047-d251-4fb9-bf1a-65b8949e0a73", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "00000000-0000-0000-0000-000000000000", +"modelInfo": { +"modelType": "service", +"modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", +"modelName": "SERVICE_MODEL_NAME", +"modelVersion": "1.0" +} +} +}, +{ +"relatedInstance": { +"instanceId": "a27ce5a9-29c4-4c22-a017-6615ac73c721", +"modelInfo": { +"modelType": "vnf", +"modelInvariantId": "skask", +"modelNameVersionId": "a27ce5a9-29c4-4c22-a017-6615ac73c721", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationName": "vSAMP12 1" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/DoCreateVfModuleRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/DoCreateVfModuleRequest.xml new file mode 100644 index 0000000000..4aaa56f79a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/DoCreateVfModuleRequest.xml @@ -0,0 +1,31 @@ + + + test-VF-0011 + CREATE_VF_MODULE + VID + MIS/1604/0026/SW_INTERNET + + + skask + STMTN5MMSC20 + myvnftype + PCRF::module-0-2 + STMTN5MMSC21-MMSC::model-1-0 + 00000000-0000-0000-0000-000000000000 + 1.0 + 00000000-0000-0000-0000-000000000000 + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + 78987 + + + STMTN5MMSC20 + vpe-tenant-123 + MDTWNJ21 + false + asn-1234 + release-for-aero-something + MTJWNJA4LCP + svc-provide-number-1234 + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml new file mode 100644 index 0000000000..90c668c576 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 2.5 + RDM2WAGPLCP + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml new file mode 100644 index 0000000000..f78d38f802 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml @@ -0,0 +1,169 @@ + + RDM2WAGPLCP + fba1bd1e195a404cacb9ce17a9b2b421 + skask + skask-test + PCRF::module-0-2 + cb510af0-5b21-4bc7-86d9-323cb396ce32 + vRRaas + PCRF::module-0-2 + 1.0 + cb510af0-5b21-4bc7-86d9-323cb396ced3 + + 12345 + null + null + 12345 + true + 12345 + true + + + vf_module_id + cb510af0-5b21-4bc7-86d9-323cb396ce32 + + + vrra_Internal-Network1_ips + null + + + ADIG_SRIOV_2_subnet_id + + + + vrra_ADIGOam.OAM_v6_ips + null + + + vnf_name + skask-test + + + ADIGOam.OAM_v6_subnet_id + + + + workload_context + null + + + vf_module_name + PCRF::module-0-2 + + + vnf_id + skask + + + ADIG_SRIOV_2_v6_subnet_id + + + + vrra_ADIG_SRIOV_1_ips + null + + + ADIG_SRIOV_1_v6_subnet_id + + + + ADIG_SRIOV_1_subnet_id + + + + ADIG_SRIOV_2_net_name + ADIG_SRIOV_2 + + + ADIGOam.OAM_subnet_id + + + + ADIGOam.OAM_net_id + 491c7cef-a3f4-4990-883e-b0af397466d0 + + + environment_context + null + + + ADIG_SRIOV_1_net_fqdn + + + + ADIGOam.OAM_net_name + ADIGOAM.OAM + + + vrra_name_0 + frkdevRvrra24 + + + vrra_ADIG_SRIOV_2_ips + null + + + ADIG_SRIOV_2_net_fqdn + + + + vrra_Internal-Network2_ips + null + + + ADIG_SRIOV_1_net_name + ADIG_SRIOV_1 + + + vrra_ADIG_SRIOV_1_v6_ips + null + + + vrra_ADIGOam.OAM_ips + null + + + vrra_Internal-Network1_v6_ips + null + + + ADIGOam.OAM_net_fqdn + + + + vrra_names + frkdevRvrra24 + + + ADIG_SRIOV_1_net_id + 491c7cef-a3f4-4990-883e-b0af397466d0 + + + vrra_Internal-Network2_v6_ips + null + + + vrra_ADIG_SRIOV_2_v6_ips + null + + + ADIG_SRIOV_2_net_id + 491c7cef-a3f4-4990-883e-b0af397466d0 + + + vf_module_index + index + + + availability_zone_0 + frkde-esx-az01 + + + + + testRequestId + MIS/1604/0026/SW_INTERNET + + testRequestId-1503410089303-1513204371234 + http://localhost:28080/mso/WorkflowMesssage/VNFAResponse/testRequestId-1503410089303-1513204371234 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/getGenericVnfResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/getGenericVnfResponse.xml new file mode 100644 index 0000000000..be5130ead8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/getGenericVnfResponse.xml @@ -0,0 +1,28 @@ + + 6d2e2469-8708-47c3-a0d4-73fa28a8a50b + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + created + false + false + introvert + 2.0 + 0000020 + + + baseVfModuleId + PCRF::module-0-0 + introvert + 2.0 + false + baseVfModuleHeatStackId + Created + 0000074 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml new file mode 100644 index 0000000000..20b5462729 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml @@ -0,0 +1,195 @@ + + + 2681784d-118e-4485-929f-2ae3212f5c07-1507707098467 + 200 + OK + + + + vnfID-1712_26 + + 200 + synccomplete + 2017-09-19T143942.327Z + Y + activate-vnf-request + + + + vRRaaS + vnfID-1712_26 + + + ae322537-d081-4a01-95a5-c1448116d0c5 + + + + + + frkde-esx-az01 + + + vrra + 1 + + ADIGOam.OAM + ADIGOAM.OAM + + NMLAN + 10.66.132.113 + 10.66.132.115 + 32 + EIPAM + + VPEADIG1d77c-1086-41ec-b7f3-94bb30936807 + + + ADIG_SRIOV_1 + ADIG_SRIOV_1 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936808 + [,] + + + ADIG_SRIOV_2 + ADIG_SRIOV_2 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936809 + [,] + + + Internal-Network1 + + INTERNAL + 24 + OTHER + 128.0.0.1 + 128.0.0.0 + + VRR-STMTN5MMSC20-INT1 + 12 + VMX-INT1 + + + Internal-Network2 + + INTERNAL + 24 + OTHER + 128.0.0.1 + 128.0.0.0 + + VRR-STMTN5MMSC20-INT2 + 12 + VMX-INT2 + + + frkdevRvrra24 + b05a42c3-28ea-4d18-8653-6515125acc1a + + + Activated + + ADIGOam.OAM + ADIGOAM.OAM + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936807 + + + ADIG_SRIOV_2 + ADIG_SRIOV_2 + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936809 + + + ADIG_SRIOV_1 + ADIG_SRIOV_1 + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936808 + + + + + FRN1 + 4027 + att-aic + + b73c6911-be64-448a-bb4b-7b7a7006507a + 5.0 + MOW AVPN vMX AV vPE Service + d48764b1-043d-4783-89e3-8817602dc833 + + 65001 + wl3900-1712-46db-99be-de9eb963a6cf26 + DE + vnfID-1712_26 + 26VRR_mtrnj151rv2 + + + 778c2ed5-77a8-426e-94fe-51a4d40199c4 + + + + cb510af0-5b21-4bc7-86d9-323cb396ced4 + + + c91330e5-8e1a-459b-95ee-d682046cbeca + 3 + MowAvpnVmxAvVpe..base_vRE_AV..module-0 + f9f41064-cbe7-4e94-ac4c-93d9c54af317 + + Activated + RR + FRNKGEFF + PROV + + NMLAN + 10.66.132.113 + 10.66.132.115 + 32 + EIPAM + + + 07bc0630-11d2-4c08-9c8f-75b036db1f4d + 3.0 + MOW AVPN vMX AV vPE + 31d077f6-356f-436e-b447-1997faff4c68 + + 31d077f6-356f-436e-b447-1997faff4c68 + + + ADIGOam.OAM + ADIGOAM.OAM + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936807 + + + ADIG_SRIOV_2 + ADIG_SRIOV_2 + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936809 + + + ADIG_SRIOV_1 + ADIG_SRIOV_1 + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936808 + + 1710vPEPROJECTS297135PROJECT + 26VRR_mtrnj151rv2-affinity + + + Completed + + + VNN1CA52LCP + skask + afd0f02a-1ddb-43bb-aded-5113e46e82ae + ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 + ZVNN1MOGX01 + 33d209df14ac4c08ad60747185d2f3e0 + bd1b3789-6474-4935-94b2-90b656e035d0 + ZVNN1MOGX01 - VF AUG 1module-0 + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnf.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnf.xml new file mode 100644 index 0000000000..50e4347e5f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnf.xml @@ -0,0 +1,26 @@ + + a27ce5a9-29c4-4c22-a017-6615ac73c721 + STMTN5MMSC21 + mmsc-capacity + SDN-MOBILITY + vMMSC + pending-create + false + false + 1508691 + + + 973ed047-d251-4fb9-bf1a-65b8949e0a73 + STMTN5MMSC21-MMSC::module-0-0 + 973ed047-d251-4fb9-bf1a-65b8949e0a73 + 1.0 + true + FILLED-IN-BY-MSO + pending-create + 1508692 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnfVfModule.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnfVfModule.xml new file mode 100644 index 0000000000..f60260d85b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnfVfModule.xml @@ -0,0 +1,26 @@ + + a27ce5a9-29c4-4c22-a017-6615ac73c721 + STMTN5MMSC21 + mmsc-capacity + SDN-MOBILITY + vMMSC + pending-create + false + false + 0000021 + + + 973ed047-d251-4fb9-bf1a-65b8949e0a73 + STMTN5MMSC21-MMSC::module-0-0 + 973ed047-d251-4fb9-bf1a-65b8949e0a73 + 1.0 + true + FILLED-IN-BY-MSO + pending-create + 0000073 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/deactivateSDNCRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/deactivateSDNCRequest.xml new file mode 100644 index 0000000000..69884c5534 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/deactivateSDNCRequest.xml @@ -0,0 +1,36 @@ + + + testReqId + svcInstId_test + deactivate + vf-module-topology-operation + http://localhost:28080/mso/SDNCAdapterCallbackService + generic-resource + + + + testRequestId + DeleteVfModuleInstance + VID + + + + + + + + 12345 + + + + skask + + + + cb510af0-5b21-4bc7-86d9-323cb396ce32 + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/sdncAdapterWorkflowRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/sdncAdapterWorkflowRequest.xml new file mode 100644 index 0000000000..a03c28c91e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/sdncAdapterWorkflowRequest.xml @@ -0,0 +1,37 @@ + + + testReqId + cb510af0-5b21-4bc7-86d9-323cb396ce32 + delete + vnf-topology-operation + http://localhost:28080/mso/SDNCAdapterCallbackService + + + + testRequestId + DisconnectVNFRequest + VID + + + + + + 12345 + 12345 + 12345 + notsurewecare + + + cb510af0-5b21-4bc7-86d9-323cb396ce32 + PCRF::module-0-2 + PCRF::module-0-2 + skask + skask-test + vRRaas + RDM2WAGPLCP + fba1bd1e195a404cacb9ce17a9b2b421 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/vnfAdapterRestV1Request.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/vnfAdapterRestV1Request.xml new file mode 100644 index 0000000000..abb30b3c2c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleRollback/vnfAdapterRestV1Request.xml @@ -0,0 +1,14 @@ + + null + null + skask + cb510af0-5b21-4bc7-86d9-323cb396ce32 + null + true + + testRequestId + 12345 + + 12345-1513795852327 + http://localhost:18080/mso/WorkflowMessage/VNFAResponse/null-1513795852327 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..a421355aba --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,53 @@ + + + {{MESSAGE-ID}} + true + d485ecee-957c-4a0a-8b95-27a22b90103f + + + mmsc_vol_1 + a73e0fe9-1ce8-49c2-8fef-e2788605be29 + + + mmsc_vol_2 + 37b6455a-5ea8-463a-89e3-0efeaf7b7c6d + + + nemsfe_vol_1 + b7ff1c21-d138-49a3-bf13-4cfd91efaf48 + + + nemsbe_vol_1 + a5988471-cd42-44d8-b078-64f2f13d3d4c + + + mmsc_vol_5 + f7b91c1e-ab8c-413a-a850-ba80a246c7e0 + + + nemsfe_vol_2 + 957ea3f3-2d4a-4707-bfd2-ba66f42037c2 + + + mmsc_vol_3 + de6fccfe-d61a-48b0-b03b-87bf1bf749b3 + + + mmsc_vol_4 + 76162310-2c38-4c32-981c-5c2880190077 + + + + RDM2WAGPLCP + e585e4f4-9452-437a-b294-45a2d6d3b7a3 + + c30b9453-4b68-4c2e-aacf-58a5ba648bf5 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + 1bbab536a19b4756926e7d0ec1eb543c + true + 78987 + ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef + + ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml new file mode 100644 index 0000000000..38e8662787 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml @@ -0,0 +1,24 @@ + + + 123abc + d8d4fcfa-fd7e-4413-b19d-c95aa67291b8 + CREATE_VF_MODULE_VOL + SoapUI-bns-create-base-vol-1001-1 + + + Test/vSAMP12 + vSAMP12::base::module-0 + false + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MDTWNJ21 + 897deadc2b954a6bac6d3c197fb3525e + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + + + + value1" + value2" + value3" + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml new file mode 100644 index 0000000000..62d1aba771 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml @@ -0,0 +1,24 @@ + + + 123abc + d8d4fcfa-fd7e-4413-b19d-c95aa67291b8 + CREATE_VF_MODULE_VOL + SoapUI-bns-create-base-vol-1001-1 + + + Test/vSAMP12 + vSAMP12::base::module-0 + true + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MDTWNJ21 + 897deadc2b954a6bac6d3c197fb3525e + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + + + + value1" + value2" + value3" + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/GenericVnf.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/GenericVnf.xml new file mode 100644 index 0000000000..aea1a46017 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/GenericVnf.xml @@ -0,0 +1,38 @@ + + TEST-VNF-ID-0123 + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + pending-create + false + false + introvert + 2.0 + 0000020 + + + lukewarm + PCRF::module-0-0 + introvert + 2.0 + true + fastburn + pending-create + 0000074 + + + supercool + PCRF::module-1-0 + extrovert + 2.0 + false + slowburn + pending-create + 0000075 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..6ab9416617 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,5 @@ + + + {{MESSAGE-ID}} + true + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_VID_request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_VID_request.json new file mode 100644 index 0000000000..6cc84c79b6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_VID_request.json @@ -0,0 +1,104 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL103W-vSAMP12_base_vol_module-0", + "source": "VID", + "callbackUrl": "{do we support this???}" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "{parent service model name}", + "modelVersion": "1" + } + } + }, + { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test/vSAMP12", + "modelVersion": "1" + } + } + } + ], + "requestParameters": { + "backoutOnFailure": true, + "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "userParams": [ + { + "name": "vnfName", + "value": "STMTN5MMSC20" + }, + { + "name": "vnfName2", + "value": "US1117MTSNJVBR0246" + }, + { + "name": "vnfNmInformation", + "value": "" + }, + { + "name": "vnfType", + "value": "pcrf-capacity" + }, + { + "name": "vnfId", + "value": "skask" + }, + { + "name": "vnfStackId", + "value": "slowburn" + }, + { + "name": "vnfStatus", + "value": "created" + }, + { + "name": "aicCloudRegion", + "value": "MDTWNJ21" + }, + { + "name": "availabilityZone", + "value": "slcp3-esx-az01" + }, + { + "name": "oamNetworkName", + "value": "VLAN-OAM-1323" + }, + { + "name": "vmName", + "value": "slcp34246vbc246ceb" + }, + { + "name": "ipagNetworkId", + "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" + }, + { + "name": "vpeNetworkId", + "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" + } + ] + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..02b43ff186 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + simpleCinderVolume_201604071 + simpleCinderVolume_201604071 + simpleCinderVolume_201604071 + simple_cinder_master + Pending + 1460134360 + + + tenant + https://aai-ext1.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..1574310474 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..5e8913f335 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + 8424bb3c-c3e7-4553-9662-469649ed9379 + MSOTESTVOL103W-vSAMP12_base_vol_module-0 + + simple_cinder_master + Pending + 1460134360 + + + tenant + https://aai-ext1.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..1574310474 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml new file mode 100644 index 0000000000..90c668c576 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 2.5 + RDM2WAGPLCP + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml new file mode 100644 index 0000000000..fd6c228cba --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml @@ -0,0 +1,13 @@ + + null + 12345 + 12345 + null + true + + 12345 + 12345 + + 580b5601-9260-4d19-abed-e671ac42c429 + http://localhost:18080/mso/WorkflowMessage/VNFAResponse/580b5601-9260-4d19-abed-e671ac42c429 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule_getVnfResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule_getVnfResponse.xml new file mode 100644 index 0000000000..b8c2cfdad0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule_getVnfResponse.xml @@ -0,0 +1,26 @@ + + a27ce5a9-29c4-4c22-a017-6615ac73c721 + STMTN5MMSC21 + mmsc-capacity + SDN-MOBILITY + vMMSC + pending-create + false + false + 1508691 + + + 973ed047-d251-4fb9-bf1a-65b8949e0a73 + STMTN5MMSC21-MMSC::module-0-0 + 973ed047-d251-4fb9-bf1a-65b8949e0a73 + 1.0 + true + FILLED-IN-BY-MSO + pending-create + 1508692 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoDeleteVfModule/getGenericVnfResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoDeleteVfModule/getGenericVnfResponse.xml new file mode 100644 index 0000000000..be5130ead8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoDeleteVfModule/getGenericVnfResponse.xml @@ -0,0 +1,28 @@ + + 6d2e2469-8708-47c3-a0d4-73fa28a8a50b + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + created + false + false + introvert + 2.0 + 0000020 + + + baseVfModuleId + PCRF::module-0-0 + introvert + 2.0 + false + baseVfModuleHeatStackId + Created + 0000074 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoDeleteVfModule/sdncAdapterWorkflowRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoDeleteVfModule/sdncAdapterWorkflowRequest.xml new file mode 100644 index 0000000000..9829fd2dbf --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoDeleteVfModule/sdncAdapterWorkflowRequest.xml @@ -0,0 +1,36 @@ + + + + testReqId + 12345 + release + vnf-topology-operation + http://localhost:8090/SDNCAdapterCallback + + + + 12345 + DisconnectVNFRequest + VID + + + + + + 12345 + 12345 + 123456789 + notsurewecare + + + 12345 + null + vfModuleName_test + 12345 + + + null + 19123c2924c648eb8e42a3c1f14b7682 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml new file mode 100644 index 0000000000..90c668c576 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 2.5 + RDM2WAGPLCP + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/getGenericVnfResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/getGenericVnfResponse.xml new file mode 100644 index 0000000000..be5130ead8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/getGenericVnfResponse.xml @@ -0,0 +1,28 @@ + + 6d2e2469-8708-47c3-a0d4-73fa28a8a50b + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + created + false + false + introvert + 2.0 + 0000020 + + + baseVfModuleId + PCRF::module-0-0 + introvert + 2.0 + false + baseVfModuleHeatStackId + Created + 0000074 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncActivateRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncActivateRequest.xml new file mode 100644 index 0000000000..6fa8bfedc9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncActivateRequest.xml @@ -0,0 +1,36 @@ + + + testReqId + MIS/1604/0026/SW_INTERNET + activate + vnf-topology-operation + http://localhost:8090/SDNCAdapter + + + + testRequestId + ChangeVNFActivateRequest + PORTAL + + + + + + 12345 + skask + dontcare + + + cb510af0-5b21-4bc7-86d9-323cb396ce32 + PCRF::module-0-2 + abc + skask + skask-test + vRRaas + fba1bd1e195a404cacb9ce17a9b2b421 + RDM2WAGPLCP + Y + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncChangeAssignRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncChangeAssignRequest.xml new file mode 100644 index 0000000000..c57dec4d86 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncChangeAssignRequest.xml @@ -0,0 +1,36 @@ + + + testReqId + MIS/1604/0026/SW_INTERNET + changeassign + vnf-topology-operation + http://localhost:8090/SDNCAdapter + + + + testRequestId + ChangeVNFActivateRequest + PORTAL + + + + + + 12345 + skask + dontcare + + + cb510af0-5b21-4bc7-86d9-323cb396ce32 + PCRF::module-0-2 + abc + skask + skask-test + vRRaas + fba1bd1e195a404cacb9ce17a9b2b421 + MDTWNJ21 + Y + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml new file mode 100644 index 0000000000..20b5462729 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml @@ -0,0 +1,195 @@ + + + 2681784d-118e-4485-929f-2ae3212f5c07-1507707098467 + 200 + OK + + + + vnfID-1712_26 + + 200 + synccomplete + 2017-09-19T143942.327Z + Y + activate-vnf-request + + + + vRRaaS + vnfID-1712_26 + + + ae322537-d081-4a01-95a5-c1448116d0c5 + + + + + + frkde-esx-az01 + + + vrra + 1 + + ADIGOam.OAM + ADIGOAM.OAM + + NMLAN + 10.66.132.113 + 10.66.132.115 + 32 + EIPAM + + VPEADIG1d77c-1086-41ec-b7f3-94bb30936807 + + + ADIG_SRIOV_1 + ADIG_SRIOV_1 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936808 + [,] + + + ADIG_SRIOV_2 + ADIG_SRIOV_2 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936809 + [,] + + + Internal-Network1 + + INTERNAL + 24 + OTHER + 128.0.0.1 + 128.0.0.0 + + VRR-STMTN5MMSC20-INT1 + 12 + VMX-INT1 + + + Internal-Network2 + + INTERNAL + 24 + OTHER + 128.0.0.1 + 128.0.0.0 + + VRR-STMTN5MMSC20-INT2 + 12 + VMX-INT2 + + + frkdevRvrra24 + b05a42c3-28ea-4d18-8653-6515125acc1a + + + Activated + + ADIGOam.OAM + ADIGOAM.OAM + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936807 + + + ADIG_SRIOV_2 + ADIG_SRIOV_2 + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936809 + + + ADIG_SRIOV_1 + ADIG_SRIOV_1 + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936808 + + + + + FRN1 + 4027 + att-aic + + b73c6911-be64-448a-bb4b-7b7a7006507a + 5.0 + MOW AVPN vMX AV vPE Service + d48764b1-043d-4783-89e3-8817602dc833 + + 65001 + wl3900-1712-46db-99be-de9eb963a6cf26 + DE + vnfID-1712_26 + 26VRR_mtrnj151rv2 + + + 778c2ed5-77a8-426e-94fe-51a4d40199c4 + + + + cb510af0-5b21-4bc7-86d9-323cb396ced4 + + + c91330e5-8e1a-459b-95ee-d682046cbeca + 3 + MowAvpnVmxAvVpe..base_vRE_AV..module-0 + f9f41064-cbe7-4e94-ac4c-93d9c54af317 + + Activated + RR + FRNKGEFF + PROV + + NMLAN + 10.66.132.113 + 10.66.132.115 + 32 + EIPAM + + + 07bc0630-11d2-4c08-9c8f-75b036db1f4d + 3.0 + MOW AVPN vMX AV vPE + 31d077f6-356f-436e-b447-1997faff4c68 + + 31d077f6-356f-436e-b447-1997faff4c68 + + + ADIGOam.OAM + ADIGOAM.OAM + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936807 + + + ADIG_SRIOV_2 + ADIG_SRIOV_2 + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936809 + + + ADIG_SRIOV_1 + ADIG_SRIOV_1 + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936808 + + 1710vPEPROJECTS297135PROJECT + 26VRR_mtrnj151rv2-affinity + + + Completed + + + VNN1CA52LCP + skask + afd0f02a-1ddb-43bb-aded-5113e46e82ae + ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 + ZVNN1MOGX01 + 33d209df14ac4c08ad60747185d2f3e0 + bd1b3789-6474-4935-94b2-90b656e035d0 + ZVNN1MOGX01 - VF AUG 1module-0 + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncTopologyRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncTopologyRequest.xml new file mode 100644 index 0000000000..79ab33d45c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncTopologyRequest.xml @@ -0,0 +1,11 @@ + + + testReqId + MIS/1604/0026/SW_INTERNET + query + /VNF-API:vnfs/vnf-list/12345 + http://localhost:8090/SDNCAdapter + mobility + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/vnfAdapterRestRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/vnfAdapterRestRequest.xml new file mode 100644 index 0000000000..d9268872b3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/vnfAdapterRestRequest.xml @@ -0,0 +1,170 @@ + + RDM2WAGPLCP + fba1bd1e195a404cacb9ce17a9b2b421 + skask + cb510af0-5b21-4bc7-86d9-323cb396ce32 + abc + vRRaas + 1.0 + cb510af0-5b21-4bc7-86d9-323cb396ced3 + PCRF::module-0-2 + 12345 + 12345 + 12345 + 12345 + true + 12345 + false + + + vf_module_id + cb510af0-5b21-4bc7-86d9-323cb396ce32 + + + vrra_Internal-Network1_ips + null + + + ADIG_SRIOV_2_subnet_id + + + + vrra_ADIGOam.OAM_v6_ips + null + + + vnf_name + skask-test + + + ADIGOam.OAM_v6_subnet_id + + + + workload_context + null + + + vf_module_name + PCRF::module-0-2 + + + vnf_id + skask + + + ADIG_SRIOV_2_v6_subnet_id + + + + vrra_ADIG_SRIOV_1_ips + null + + + ADIG_SRIOV_1_v6_subnet_id + + + + ADIG_SRIOV_1_subnet_id + + + + vrr_flavor_name + ns.c16r32d128.v1 + + + ADIG_SRIOV_2_net_name + ADIG_SRIOV_2 + + + ADIGOam.OAM_subnet_id + + + + ADIGOam.OAM_net_id + 491c7cef-a3f4-4990-883e-b0af397466d0 + + + environment_context + null + + + ADIG_SRIOV_1_net_fqdn + + + + ADIGOam.OAM_net_name + ADIGOAM.OAM + + + vrra_name_0 + frkdevRvrra24 + + + vrra_ADIG_SRIOV_2_ips + null + + + ADIG_SRIOV_2_net_fqdn + + + + vrra_Internal-Network2_ips + null + + + ADIG_SRIOV_1_net_name + ADIG_SRIOV_1 + + + vrra_ADIG_SRIOV_1_v6_ips + null + + + vrra_ADIGOam.OAM_ips + null + + + vrra_Internal-Network1_v6_ips + null + + + vrr_image_name + MDT17 + + + ADIGOam.OAM_net_fqdn + + + + vrra_names + frkdevRvrra24 + + + ADIG_SRIOV_1_net_id + 491c7cef-a3f4-4990-883e-b0af397466d0 + + + vrra_Internal-Network2_v6_ips + null + + + vrra_ADIG_SRIOV_2_v6_ips + null + + + ADIG_SRIOV_2_net_id + 491c7cef-a3f4-4990-883e-b0af397466d0 + + + availability_zone_0 + nova + + + + testRequestId + MIS/1604/0026/SW_INTERNET + + testRequestId-1503410089303-1513287018300 + http://localhost:28080/mso/WorkflowMesssage/VNFAResponse/testRequestId-1503410089303-1513287018300 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/MsoCompletionRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/MsoCompletionRequest.xml new file mode 100644 index 0000000000..d5175f4dc9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/MsoCompletionRequest.xml @@ -0,0 +1,11 @@ + + + null + DELETE + null + + E2E Service Instance was deleted successfully. + DeleteCustomE2EServiceInstance + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/SDNCDeleteResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/SDNCDeleteResponse.xml new file mode 100644 index 0000000000..e380ce7ed2 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/SDNCDeleteResponse.xml @@ -0,0 +1,212 @@ + + + + + + Y + SK-2016-10-22-001 + + + SUCCESS + ERROR + + + 15001417 + + ALPRTR2 + 1.1.1.2 + + 1255.ae81 + VDBE + VIRTUAL + + ALPVDBE1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + ALPASBG1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + ALPBGF2 + 3.1.2.0/22 + + 3:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + ALPBGF1 + 3.1.2.0/22 + + 3:1:2::0/22 + + 2 + + + ALPRTR1 + 1.1.1.1 + + 1255.ae81 + VDBE + VIRTUAL + + ALPVDBE1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + ALPASBG1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + ALPBGF2 + 3.1.2.0/22 + + 3:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + ALPBGF1 + 3.1.2.0/22 + + 3:1:2::0/22 + + 1 + + + + 15001418 + + SANRTR1 + 2.1.1.1 + + 1255.ae81 + VDBE + VIRTUAL + + SANVDBE1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + SANASBG1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + SANBGF2 + 4.1.2.0/22 + + 4:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + SANBGF1 + 4.1.2.0/22 + + 4:1:2::0/22 + + 1 + + + SANRTR2 + 2.1.1.2 + + 1255.ae81 + VDBE + VIRTUAL + + SANVDBE1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + SANASBG1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + SANBGF2 + 4.1.2.0/22 + + 4:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + SANBGF1 + 4.1.2.0/22 + + 4:1:2::0/22 + + 2 + + + COLLABORATE + DISABLE + custid-888 + SII-2016-10-22-001 + CUSTOMER + 100668 + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/aaiGetResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/aaiGetResponse.xml new file mode 100644 index 0000000000..c367b5c959 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/aaiGetResponse.xml @@ -0,0 +1,33 @@ + + 1234 + volte-service + testservicetype + testservicerole + volte service + c1d4305f-cdbd-4bbe-9069-a2f4978fd89e + d4df5c27-98a1-4812-a8aa-c17f055b7a3f + 1508838121849 + create + + + service-instance + /aai/v11/business/customers/customer/test_customer/service-subscription/example-service-type/service-instance/1234_1 + + customer.global-customer-id + test_customer + + + service-subscription.service-type + test_customer + + + service-instance.service-instance-id + 1234_1 + + + service-instance.service-instance-name + volte-service_vEPC + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getARUrlById.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getARUrlById.xml new file mode 100644 index 0000000000..e178583a34 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getARUrlById.xml @@ -0,0 +1,6 @@ + + + allotted-resource + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml new file mode 100644 index 0000000000..a472996121 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml @@ -0,0 +1,23 @@ + + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + testReVer123 + + + nothing + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml new file mode 100644 index 0000000000..8ba178cc1c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml @@ -0,0 +1,90 @@ + + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + + 802767b3-18a6-4432-96db-25522786aee0 + ZRDM1MMSC03 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml new file mode 100644 index 0000000000..8ba178cc1c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml @@ -0,0 +1,90 @@ + + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + + 802767b3-18a6-4432-96db-25522786aee0 + ZRDM1MMSC03 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getNotFound.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getNotFound.xml new file mode 100644 index 0000000000..f66c9c4fb8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getNotFound.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getParentSIUrlById.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getParentSIUrlById.xml new file mode 100644 index 0000000000..c29133e539 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getParentSIUrlById.xml @@ -0,0 +1,6 @@ + + + service-instance + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0027%252FSW_INTERNET + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getParentServiceInstance.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getParentServiceInstance.xml new file mode 100644 index 0000000000..bc810c6014 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getParentServiceInstance.xml @@ -0,0 +1,30 @@ + + MIS/1604/0027/SW_INTERNET + 123456789 + + + cvlan-tag + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getSINoRelations.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getSINoRelations.xml new file mode 100644 index 0000000000..e52b26ac00 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getSINoRelations.xml @@ -0,0 +1,6 @@ + + MIS/1604/0026/SW_INTERNET + 123456789 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getSIUrlById.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getSIUrlById.xml new file mode 100644 index 0000000000..416689e10c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getSIUrlById.xml @@ -0,0 +1,6 @@ + + + service-instance + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getSIUrlByIdVipr.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getSIUrlByIdVipr.xml new file mode 100644 index 0000000000..28c739a0af --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getSIUrlByIdVipr.xml @@ -0,0 +1,7 @@ + + + + service-instance + https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/aa8428ac-7dd2-441f-aa3e-e175802574fb + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getServiceInstance.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getServiceInstance.xml new file mode 100644 index 0000000000..e377c70474 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/GenericFlows/getServiceInstance.xml @@ -0,0 +1,30 @@ + + MIS/1604/0026/SW_INTERNET + 123456789 + + + cvlan-tag + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/ConfigVnf_VID_request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/ConfigVnf_VID_request.json new file mode 100644 index 0000000000..04040028c3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/ConfigVnf_VID_request.json @@ -0,0 +1,39 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vnf", +"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationUuid": "MODEL-ID-1234" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "mdt1", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "STMTN", +"instanceId": "skask", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "MIS%2F1604%2F0026%2FSW_INTERNET", +"modelInfo": { +"modelType": "service", +"modelInvariantUuid": "995256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "ab6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "ServicevSAMP12", +"modelVersion": "1.0" +} +} +} +], +"requestParameters": { +"payload": "{\"request-parameters\":{\"host-ip-address\":\"10.10.10.10\"},\"configuration- parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}" +} +} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/CreateVnfInfraRequest.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/CreateVnfInfraRequest.json new file mode 100644 index 0000000000..c1491d128b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/CreateVnfInfraRequest.json @@ -0,0 +1,46 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelInstanceName": "vSAMP12 1", + "modelCustomizationUuid": "customizationId123" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "testVnfName123", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{serviceInstanceId}", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "{parent service model name}", + "modelVersion": "1.0" + } + } + } + ], + "requestParameters": { + }, + "platform": { + "platformName": "platform name" + }, + "lineOfBusiness": { + "lineOfBusinessName": "line of business names" + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/DeleteCustomE2EService.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/DeleteCustomE2EService.json new file mode 100644 index 0000000000..661a89ec99 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/DeleteCustomE2EService.json @@ -0,0 +1,21 @@ +{ + "requestDetails": { + "requestInfo": { + "callbackUrl": "http://localhost:28080/simulada/CCD/AsyncRequestStatus", + "source": "CCD", + "instanceName": "USOSTCDALTX0101VFHN31" + }, + "subscriberInfo": { + "globalSubscriberId": "38829939920000", + "subscriberName": "Fern Hill Real Estate LLC 31" + }, + "requestParameters": { + "userParams": [ + { + "name": "someUserParam", + "value": "someValue" + } + ] + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json new file mode 100644 index 0000000000..e8d9fc29b1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json @@ -0,0 +1,39 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelInstanceName": "vSAMP12 1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "testVnfName123", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{serviceInstanceId}", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "{parent service model name}", + "modelVersion": "1.0" + } + } + } + ], + "requestParameters": { + "cascadeDelete": true + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/DoCreateServiceInstance_request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/DoCreateServiceInstance_request.json new file mode 100644 index 0000000000..640e16b634 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/DoCreateServiceInstance_request.json @@ -0,0 +1,186 @@ +{ "serviceResources" : { + "modelInfo" : { + "modelName" : "MSOTADevInfra_vSAMP10a_Service", + "modelUuid" : "5df8b6de-2083-11e7-93ae-92361f002671", + "modelInvariantUuid" : "9647dfc4-2083-11e7-93ae-92361f002671", + "modelVersion" : "1.0" + }, + "serviceType" : "PortMirroring", + "serviceRole" : "InfraRole", + "environmentContext" : "Luna", + "workloadContext" : "Oxygen", + "serviceVnfs": [ + + { "modelInfo" : { + "modelName" : "vSAMP10a", + "modelUuid" : "ff2ae348-214a-11e7-93ae-92361f002671", + "modelInvariantUuid" : "2fff5b20-214b-11e7-93ae-92361f002671", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "68dc9a92-214c-11e7-93ae-92361f002671", + "modelInstanceName" : "vSAMP10a 1" + }, + "toscaNodeType" : "VF", + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null, + "multiStageDesign" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "NetworkFqdnTest4", + "modelUuid" : "025606c1-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba01a", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba01a" + }, "isBase" : true, + "vfModuleLabel" : "label", + "initialCount" : 0, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "NetworkFqdnTest3", + "modelUuid" : "02560575-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba0bb", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba0bb" + }, "isBase" : true, + "vfModuleLabel" : "label", + "initialCount" : 0, + "hasVolumeGroup" : false + }, + { + "modelInfo" : { + "modelName" : "NetworkFqdnTest5", + "modelUuid" : "025607e4-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : "06bd0a18-65c0-4418-83c7-5b0d14cba01a", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "06bd0a18-65c0-4418-83c7-5b0d14cba01a" + }, "isBase" : false, + "vfModuleLabel" : "label", + "initialCount" : 0, + "hasVolumeGroup" : false + }, + { + "modelInfo" : { + "modelName" : "vSAMP10aDEV::PCM::module-2", + "modelUuid" : "7774b4e4-7d37-11e7-bb31-be2e44b06b34", + "modelInvariantUuid" : "93e9c1d2-7d37-11e7-bb31-be2e44b06b34", + "modelVersion" : "2", + "modelCustomizationUuid" : "6728bee8-7d3a-11e7-bb31-be2e44b06b34" + }, "isBase" : false, + "vfModuleLabel" : "PCM", + "initialCount" : 0, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "vSAMP10aDEV::PCM::module-1", + "modelUuid" : "066de97e-253e-11e7-93ae-92361f002671", + "modelInvariantUuid" : "64efd51a-2544-11e7-93ae-92361f002671", + "modelVersion" : "2", + "modelCustomizationUuid" : "b4ea86b4-253f-11e7-93ae-92361f002671" + }, "isBase" : false, + "vfModuleLabel" : "PCM", + "initialCount" : 0, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "vSAMP10aDEV::base::module-0", + "modelUuid" : "20c4431c-246d-11e7-93ae-92361f002671", + "modelInvariantUuid" : "78ca26d0-246d-11e7-93ae-92361f002671", + "modelVersion" : "2", + "modelCustomizationUuid" : "cb82ffd8-252a-11e7-93ae-92361f002671" + }, "isBase" : true, + "vfModuleLabel" : "base", + "initialCount" : 1, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "vSAMP10a::base::module-0", + "modelUuid" : "02560de2-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : null, + "modelVersion" : "2", + "modelCustomizationUuid" : "MIGRATED_36e76920-ef30-4793-9979-cbd7d4b2bfc4" + }, "isBase" : true, + "vfModuleLabel" : "base", + "initialCount" : 1, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "base::module-0", + "modelUuid" : "02561381-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : null, + "modelVersion" : "1", + "modelCustomizationUuid" : "MIGRATED_51baae4c-b7c7-4f57-b77e-6e01acca89e5" + }, "isBase" : true, + "vfModuleLabel" : "module-0", + "initialCount" : 1, + "hasVolumeGroup" : false + }, + { + "modelInfo" : { + "modelName" : "vSAMP10a::PCM::module-1", + "modelUuid" : "02560f1b-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : null, + "modelVersion" : "1", + "modelCustomizationUuid" : "MIGRATED_e9be2ed7-45b6-479c-b06e-9093899f8ce8" + }, "isBase" : true, + "vfModuleLabel" : "PCM", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ], + "serviceNetworks": [], + "serviceAllottedResources": [ + { + "modelInfo" : { + "modelName" : "Tunnel_Xconn", + "modelUuid" : "f6b7d4c6-e8a4-46e2-81bc-31cad5072842", + "modelInvariantUuid" : "b7a1b78e-6b6b-4b36-9698-8c9530da14af", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "5b9bee43-f537-4fb3-9e8b-4de9f714d28a", + "modelInstanceName" : "Pri_Tunnel_Xconn 9" + }, + "toscaNodeType" : null, + "allottedResourceType" : null, + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + } + ], + "serviceConfigs": [ + { + "modelInfo" : { + "modelName" : "Mulder", + "modelUuid" : "025606c1-4fff-11e7-9252-005056850d2e", + "modelInvariantUuid" : "025606c1-4eee-11e7-9252-005056850d2e", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "025606c1-4ddd-11e7-9252-005056850d2e", + "modelInstanceName" : "X_FILES_001" + }, + "toscaNodeType" : "Scully" + }, + { + "modelInfo" : { + "modelName" : "Krychuk", + "modelUuid" : "025606c1-5fff-11e7-9252-005056850d2e", + "modelInvariantUuid" : "025606c1-5eee-11e7-9252-005056850d2e", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "025606c1-5ddd-11e7-9252-005056850d2e", + "modelInstanceName" : "X_FILES_002" + }, + "toscaNodeType" : "Skinner" + } + ] + }} + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json new file mode 100644 index 0000000000..dd3ff6841e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json @@ -0,0 +1,38 @@ +{ + "service": + { + "serviceType":"example-service-type", + "globalSubscriberId":"test_custormer", + "resources": + [ + { + "resourceInstanceId":"ns111", + "scaleType":"SCALE_NS", + "scaleNsData": + { + "scaleNsByStepsData": + { + "numberOfSteps":"4", + "aspectId":"TIC_EDGE_HW", + "scalingDirection":"UP" + } + } + }, + { + "resourceInstanceId":"ns333", + "scaleType":"SCALE_NS", + "scaleNsData": + { + "scaleNsByStepsData": + { + "numberOfSteps":"4", + "aspectId":"TIC_EDGE_HW", + "scalingDirection":"UP" + } + } + } + ], + "serviceInstanceName":"service1" + }, + "operationId":"15c01683-4f15-45e7-b213-dcbfe6f42a1b" + } \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/ReplaceVnf_VID_request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/ReplaceVnf_VID_request.json new file mode 100644 index 0000000000..7c9717244b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/ReplaceVnf_VID_request.json @@ -0,0 +1,49 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vnf", +"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationUuid": "MODEL-ID-1234" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "mdt1", +"tenantId": "88a6ca3ee0394ade9403f075db23167e" +}, +"requestInfo": { +"instanceName": "STMTN", +"instanceId": "a27ce5a9-29c4-4c22-a017-6615ac73c721", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "MIS%2F1604%2F0026%2FSW_INTERNET", +"modelInfo": { +"modelType": "service", +"modelInvariantUuid": "995256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "ab6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "ServicevSAMP12", +"modelVersion": "1.0" +} +} +} +], +"requestParameters": { +"usePreload": false, +"userParams" : [ + { + "name" : "someUserParam", + "value" : "someValue" + }, + { + "name": "sgi_protected_subnet_id", + "value": "thisissomefakevalue" + } +] +} +} +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/UpdateVfModule_VID_request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/UpdateVfModule_VID_request.json new file mode 100644 index 0000000000..9564f705ae --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/UpdateVfModule_VID_request.json @@ -0,0 +1,62 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelInvariantUuid": "introvert", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "STMTN5MMSC21-MMSC::model-1-0", + "modelVersion": "1", + "modelCustomizationUuid": "MODEL12345" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "MDTWNJ21", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "PCRF::module-0", + "instanceId": "supercool", + "source": "VID", + "suppressRollback": true + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "123456", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "SERVICE_MODEL_NAME", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "skask", + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "skask", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelInstanceName": "vSAMP12 1" + } + } + } + ], + "requestParameters": { + "usePreload": false, + "userParams": [ + { + "name": "someUserParam", + "value": "someValue" + }, + { + "name": "sgi_protected_subnet_id", + "value": "thisissomefakevalue" + } + ] + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/UpdateVnf_VID_request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/UpdateVnf_VID_request.json new file mode 100644 index 0000000000..5ce8546a41 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/UpdateVnf_VID_request.json @@ -0,0 +1,56 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vnf", +"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationUuid": "MODEL-ID-1234" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "mdt1", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "STMTN", +"instanceId": "skask", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "MIS%2F1604%2F0026%2FSW_INTERNET", +"modelInfo": { +"modelType": "service", +"modelInvariantUuid": "995256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "ab6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "ServicevSAMP12", +"modelVersion": "1.0" +} +} +} +], +"requestParameters": { +"usePreload": false, +"userParams" : [ + { + "name" : "someUserParam", + "value" : "someValue" + }, + { + "name": "sgi_protected_subnet_id", + "value": "thisissomefakevalue" + }, + { + "name": "vlc_sctp_b_route_prefixes", + "value": [ + { "interface_route_table_routes_route_prefix": "107.239.41.163/32" }, + { "interface_route_table_routes_route_prefix": "107.239.41.164/32" }, + { "interface_route_table_routes_route_prefix": "107.239.41.165/32" } + ]} +] +} +} +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json new file mode 100644 index 0000000000..eb2d9faa2a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json @@ -0,0 +1,16 @@ +{ +"requestDetails": { +"cloudConfiguration": { +"lcpCloudRegionId": "mdt1", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"source": "VID", +"requestorId": "xxxxxx" +}, +"requestParameters": { +"payload": +"{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" +} +} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/CreateNetworkCollection.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/CreateNetworkCollection.json new file mode 100644 index 0000000000..7b369ab97e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/CreateNetworkCollection.json @@ -0,0 +1,70 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersion": "10" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "project": { + "projectName": "{some project name}" + }, + "subscriberInfo": { + "globalSubscriberId": "{some subscriber id}" + }, + "requestInfo": { + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": true, + "requestorId": "xxxxxx" + }, + "requestParameters": { + "subscriptionServiceType": "VMX", + "aLaCarte": false, + "userParams": [ + { + "service": { + "modelInfo": { + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceParams": [], + "resources": { + "networks": [ + { + "modelInfo": { + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf970" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + } + }, + { + "modelInfo": { + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf970" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + } + } + ] + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/ServiceMacroAssign.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/ServiceMacroAssign.json new file mode 100644 index 0000000000..51caddd48a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/ServiceMacroAssign.json @@ -0,0 +1,125 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersion": "10.0" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "project": { + "projectName": "{some project name}" + }, + "subscriberInfo": { + "globalSubscriberId": "{some subscriber id}" + }, + "requestInfo": { + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": true, + "requestorId": "xxxxxx" + }, + "requestParameters": { + "subscriptionServiceType": "VMX", + "aLaCarte": false, + "userParams": [ + { + "service": { + "modelInfo": { + "modelType": "service", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceParams": [], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelType": "vnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceParams": [], + "vfModules": [ + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", + "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79", + "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f" + }, + "instanceParams": [ + { + "vmx_int_net_len": "24" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "100" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "50" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-2", + "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969" + }, + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vmx_vpfe_int_ip_0": "192.168.0.16" + } + ] + } + ] + } + ] + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Policy/policyAbortResponse.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Policy/policyAbortResponse.json new file mode 100644 index 0000000000..c315b1ed1d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Policy/policyAbortResponse.json @@ -0,0 +1 @@ +{"decision":"PERMIT","details":"Abort"} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Policy/policySkipResponse.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Policy/policySkipResponse.json new file mode 100644 index 0000000000..7cbdebb6b3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Policy/policySkipResponse.json @@ -0,0 +1 @@ +{"decision":"PERMIT","details":"Skip"} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Schemas/ActivateServiceInstance.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Schemas/ActivateServiceInstance.json new file mode 100644 index 0000000000..5a6460b62d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Schemas/ActivateServiceInstance.json @@ -0,0 +1,7 @@ +{ + "ActivateServiceInstance": { + "serviceInstance": { + "@class": "inventory.aai.onap.org.v12.ServiceInstance" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Schemas/ActivateVnfSchema.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Schemas/ActivateVnfSchema.json new file mode 100644 index 0000000000..57ab9c2799 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Schemas/ActivateVnfSchema.json @@ -0,0 +1,13 @@ +{ + "ActivateVnf": { + "serviceInstance": { + "@class": "inventory.aai.onap.org.v12.ServiceInstance" + }, + "customer": { + "@class": "inventory.aai.onap.org.v12.Customer" + }, + "genericVnf": { + "@class": "inventory.aai.onap.org.v12.GenericVnf" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Schemas/AssignServiceInstanceSchema.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Schemas/AssignServiceInstanceSchema.json new file mode 100644 index 0000000000..7c35761461 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Schemas/AssignServiceInstanceSchema.json @@ -0,0 +1,16 @@ +{ + "AssignServiceInstance": { + "serviceInstance": { + "@class": "inventory.aai.onap.org.v12.ServiceInstance" + }, + "project": { + "@class": "inventory.aai.onap.org.v12.Project" + }, + "owningEntity": { + "@class": "inventory.aai.onap.org.v12.OwningEntity" + }, + "customer": { + "@class": "inventory.aai.onap.org.v12.Customer" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Schemas/AssignVnfSchema.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Schemas/AssignVnfSchema.json new file mode 100644 index 0000000000..7fff5ca3ce --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Schemas/AssignVnfSchema.json @@ -0,0 +1,13 @@ +{ + "AssignVnf": { + "serviceInstance": { + "@class": "inventory.aai.onap.org.v12.ServiceInstance" + }, + "customer": { + "@class": "inventory.aai.onap.org.v12.Customer" + }, + "genericVnf": { + "@class": "inventory.aai.onap.org.v12.GenericVnf" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/sdncUpdateNetworkTopologySimResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/sdncUpdateNetworkTopologySimResponse.xml new file mode 100644 index 0000000000..836b3c8055 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/sdncUpdateNetworkTopologySimResponse.xml @@ -0,0 +1,17 @@ + + + + + + + testRequestId + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml new file mode 100644 index 0000000000..a5640b2b26 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml @@ -0,0 +1,6 @@ + + +680bd458-5ec1-4a16-b77c-509022e53450INTERNAL +400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data +true + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml new file mode 100644 index 0000000000..02996a13ea --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml @@ -0,0 +1,80 @@ + + + JBoss Web/7.2.2.Final-redhat-1 - JBWEB000064: Error report + + + + +

JBWEB000065: HTTP Status 500 - java.lang.NullPointerException

+
+

+ JBWEB000309: type + JBWEB000066: Exception report +

+

+ JBWEB000068: message + java.lang.NullPointerException +

+

+ JBWEB000069: description + JBWEB000145: The server encountered an internal error that + prevented it from fulfilling this request. + +

+

+ JBWEB000070: exception +

org.jboss.resteasy.spi.UnhandledException:
+				java.lang.NullPointerException
+				org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365)
+				org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233)
+				org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209)
+				org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557)
+				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
+				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
+				org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
+				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
+				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
+				javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
+				org.onap.so.logger.LogFilter.doFilter(LogFilter.java:35)
+			
+

+

+ JBWEB000071: root cause +

java.lang.NullPointerException
+				org.onap.so.adapters.network.NetworkAdapterRest$CreateNetworkVolumesTask.run(NetworkAdapterRest.java:128)
+				org.onap.so.adapters.network.NetworkAdapterRest.createNetwork(NetworkAdapterRest.java:64)
+				sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+				sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+				sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+				java.lang.reflect.Method.invoke(Method.java:606)
+				org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
+				org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
+				org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
+				org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
+				org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
+				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
+				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
+				org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
+				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
+				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
+				javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
+				org.onap.so.logger.LogFilter.doFilter(LogFilter.java:35)
+			
+

+

+ JBWEB000072: note + JBWEB000073: The full stack trace of the root cause is available + in the JBoss Web/7.2.2.Final-redhat-1 logs. + +

+
+

JBoss Web/7.2.2.Final-redhat-1

+ + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml new file mode 100644 index 0000000000..0faec794b0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml @@ -0,0 +1,24 @@ + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + + + + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + true + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + CONTRAIL_EXTERNAL + false + c4f4e878-cde0-4b15-ae9a-bda857759cea + 7dd5365547234ee8937416c65507d266 + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml new file mode 100644 index 0000000000..ca5145c226 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml @@ -0,0 +1,4 @@ + + service-instance + https://aai-conexus-e2e.test.com:8443/aai/v8/business/customers/customer/8310000058863/service-subscriptions/service-subscription/vMOG/service-instances/service-instance/f70e927b-6087-4974-9ef8-c5e4d5847ca4 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml new file mode 100644 index 0000000000..e06d27ea88 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml @@ -0,0 +1,73 @@ + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml new file mode 100644 index 0000000000..24ee1df9c8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..79cc14ada3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 13979:105757 + 13979:105757 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml new file mode 100644 index 0000000000..db134a1127 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + 5938baec-03ca-2bd5-a3f1-d54x123e253a + refFQDN1 + 12345 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml new file mode 100644 index 0000000000..34b4a036c4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + 5938baec-03ca-2bd5-a3f1-d54x123e253a + refFQDN2 + 12345 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml new file mode 100644 index 0000000000..c01d0a4f61 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + + + 13979:105708 + EXPORT + 1504025599510 + + + 13979:105707 + IMPORT + 1504025599519 + + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ + + l3-network.network-id + 689ec39e-c5fc-4462-8db2-4f760763ad28 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ + + l3-network.network-id + 1a49396b-19b3-40a4-8792-aa2fbd0f0704 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ + + l3-network.network-id + 774f3329-3c83-4771-86c7-9e6207cd50fd + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml new file mode 100644 index 0000000000..5f1c2cafa5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 13979:105757 + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ + + l3-network.network-id + 689ec39e-c5fc-4462-8db2-4f760763ad28 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ + + l3-network.network-id + 1a49396b-19b3-40a4-8792-aa2fbd0f0704 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ + + l3-network.network-id + 774f3329-3c83-4771-86c7-9e6207cd50fd + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml new file mode 100644 index 0000000000..eedbda9343 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml new file mode 100644 index 0000000000..03d63f9f05 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml @@ -0,0 +1,44 @@ + + + 78987 + MSOTESTVOL102a-vSAMP12_base_vol_module-0 + + Test/vSAMP12 + Pending + 0000020 + + + tenant + /aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ + + tenant.tenant-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mdt1 + + + tenant.tenant-name + ECOMP_MDT1 + + + + vf-module + /aai/v8/network/generic-vnfs/generic-vnf/9e48f6ea-f786-46de-800a-d480e5ccc846/vf-modules/vf-module/6a1dc898-b590-47b9-bbf0-34424a7a2ec3/ + + generic-vnf.vnf-id + 9e48f6ea-f786-46de-800a-d480e5ccc846 + + + vf-module.vf-module-id + 6a1dc898-b590-47b9-bbf0-34424a7a2ec3 + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json new file mode 100644 index 0000000000..603c1f452f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json @@ -0,0 +1,64 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test/vSAMP12", + "modelVersion": "1", + "modelInstanceName": "vSAMP12" + } + } + } + ], + "requestParameters": { + "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "userParams": [ + {"name": "vnfName", "value": "STMTN5MMSC20" }, + {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, + {"name": "vnfNmInformation", "value": "" }, + {"name": "vnfType", "value": "pcrf-capacity" }, + {"name": "vnfId", "value": "skask" }, + {"name": "vnfStackId", "value": "slowburn" }, + {"name": "vnfStatus", "value": "created" }, + {"name": "aicCloudRegion", "value": "MDTWNJ21" }, + {"name": "availabilityZone", "value": "slcp3-esx-az01" }, + {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, + {"name": "vmName", "value": "slcp34246vbc246ceb" }, + {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, + {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" } + ] + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json new file mode 100644 index 0000000000..f32ba2994b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json @@ -0,0 +1,64 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff-x", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test/vSAMP12", + "modelVersion": "1", + "modelInstanceName": "vSAMP12" + } + } + } + ], + "requestParameters": { + "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "userParams": [ + {"name": "vnfName", "value": "STMTN5MMSC20" }, + {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, + {"name": "vnfNmInformation", "value": "" }, + {"name": "vnfType", "value": "pcrf-capacity" }, + {"name": "vnfId", "value": "skask" }, + {"name": "vnfStackId", "value": "slowburn" }, + {"name": "vnfStatus", "value": "created" }, + {"name": "aicCloudRegion", "value": "MDTWNJ21" }, + {"name": "availabilityZone", "value": "slcp3-esx-az01" }, + {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, + {"name": "vmName", "value": "slcp34246vbc246ceb" }, + {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, + {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" } + ] + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVolumeGroupRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVolumeGroupRequest.xml new file mode 100644 index 0000000000..8f8d150970 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVolumeGroupRequest.xml @@ -0,0 +1,38 @@ + + RDM2WAGPLCP + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + null + MSOTESTVOL102a-vSAMP12_base_vol_module-0 + + vnf1 + 1 + + + + + vnf_id + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + + + vnf_name + testVnfName123 + + + vf_module_id + null + + + vf_module_name + MSOTESTVOL102a-vSAMP12_base_vol_module-0 + + + true + + 12345 + 12345 + + 12345-1513275871414 + http://localhost:28080/mso/WorkflowMessage/VNFAResponse/12345-1513275871414 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml new file mode 100644 index 0000000000..4087ab8f5f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml @@ -0,0 +1,29 @@ + + 6a1dc898-b590-47b9-bbf0-34424a7a2ec3 + MSOST10606-vSAMP12_MTN6_base_module-0 + MSOST10606-vSAMP12_MTN6_base_module-0/81b01583-690c-4ec3-9c58-0eafa7a90be7 + active + true + 1475077639 + ff5256d2-5a33-55df-13ab-12abad84e7ff + 1.0 + + + volume-group + https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/volume-groups/volume-group/064bd1c6-e377-4009-a744-e958eec6e727/ + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + volume-group.volume-group-id + 064bd1c6-e377-4009-a744-e958eec6e727 + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml new file mode 100644 index 0000000000..2be546162f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml @@ -0,0 +1,37 @@ + + + + 36e20198-c67a-464b-96d0-aaa99eb2639e + 5b9b15d0-5dd7-47dc-95b9-0440c340a3ba + 1.0 + BRGmodelname + 013bd784-9bca-4919-ae2f-ae57af27bad9 + + + parent-service-instance-id + consuming-service-instance-id + namefromrequest + brg + allottedresourceidfromrequest + + + fq-name + + d1 + drole + + vlan-tag + + s2 + srole + + txc-id + + 1 + 123 + a.b.c.d + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml new file mode 100644 index 0000000000..c2d197a2d8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml @@ -0,0 +1,24 @@ + + + + 36e20198-c67a-464b-96d0-aaa99eb2639e + 5b9b15d0-5dd7-47dc-95b9-0440c340a3ba + 1.0 + TXCmodelname + 013bd784-9bca-4919-ae2f-ae57af27bad9 + + + parent-service-instance-id + consuming-service-instance-id + namefromrequest + tunnelxconn + allottedresourceidfromrequest + + + my-vni + my-bearer-ip + my-lan-ip + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml new file mode 100644 index 0000000000..f2063442d6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + Tunnel XConn + Tunnel XConn + Tunnel XConn + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json new file mode 100644 index 0000000000..cf2d5e977d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json @@ -0,0 +1,127 @@ +{ "serviceResources" : { + "modelInfo" : { + "modelName" : "MSO Test Network", + "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", + "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", + "modelVersion" : null + }, + "serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vHNF for DHV Test", + "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", + "modelInvariantUuid" : "6ea0b528-e303-4686-aa77-aa2fcbdccb96", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5", + "modelInstanceName" : "vHNF for DHV Test 17" + }, + "toscaNodeType" : null, + "nfFunction" : "testNfFunction", + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "f5696ec0-ec71-4916-bf3b-93a654efcba4", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ], + "networkResource": [ + { + "modelInfo" : { + "modelName" : "CONTRAIL_BASIC", + "modelUuid" : "fe5be3a6-dbe0-46d6-bcac-44dc841a7edc", + "modelInvariantUuid" : "ab07fbd8-185a-45ac-be45-db3eb02e98d5", + "modelVersion" : null, + "modelCustomizationUuid" : "0cb9b26a-9820-48a7-86e5-16c510e993d9", + "modelInstanceName" : "CONTRAIL_BASIC 5" + }, + "toscaNodeType" : null, + "networkType" : null, + "networkTechnology" : null, + "networkRole" : null, + "networkScope" : null + } + ], + "serviceAllottedResources": [ + { + "modelInfo" : { + "modelName" : "IP_MUX_Demux", + "modelUuid" : "64a1a718-556b-48ce-b3b7-ed3237ccc94f", + "modelInvariantUuid" : "f110ef53-a0a6-4d72-ab91-fd88a835e8c4", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "4bab0880-2f06-4aeb-87cb-3734c8e8bf93", + "modelInstanceName" : "Pri_IP_MUX_Demux 1" + }, + "toscaNodeType" : null, + "allottedResourceType" : "Tunnel XConn", + "allottedResourceRole" : "Tunnel XConn", + "providingServiceModelInvariantUuid" : null, + "nfFunction" : "testNfFunction", + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null, + "homingSolution": { + "inventoryType": "service", + "serviceInstanceId": "MIS%252F1604%252F0027%252FSW_INTERNET", + "vnfHostname": "MDTNJ01", + "cloudOwner": "aic", + "cloudRegionId": "dfwtx", + "aicClli": "KDTNJ01", + "aicVersion": "3.0", + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ] + } + }, + { + "modelInfo" : { + "modelName" : "Service_Admin", + "modelUuid" : "73501e03-ee76-4509-a8ce-96d2a9f33ee9", + "modelInvariantUuid" : "462edf71-1a3c-487b-bf55-497460ab7de3", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "a896ffad-c8f9-404e-a527-7a8d0cc99ce6", + "modelInstanceName" : "Pri_Service_Admin 5" + }, + "toscaNodeType" : null, + "allottedResourceType" : "BRG", + "allottedResourceRole" : "BRG", + "providingServiceModelInvariantUuid" : null, + "nfFunction" : "testNfFunction", + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null, + "homingSolution": { + "inventoryType": "service", + "serviceInstanceId": "MIS%252F1604%252F0027%252FSW_INTERNET", + "vnfHostname": "MDTNJ01", + "cloudOwner": "aic", + "cloudRegionId": "dfwtx", + "aicClli": "KDTNJ01", + "aicVersion": "3.0", + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ] + } + } + ] + }} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json new file mode 100644 index 0000000000..80692b27f5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json @@ -0,0 +1,11 @@ +{ "serviceResources" : { + "modelInfo" : { + "modelName" : "MSO Test Network", + "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", + "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", + "modelVersion" : null + }, + "serviceVnfs": [], + "serviceNetworks": [], + "serviceAllottedResources": [] + }} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml new file mode 100644 index 0000000000..b9d88d15db --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml @@ -0,0 +1,7 @@ + + SDN-ETHERNET-INTERNET + SDN-ETHERNET-INTERNET + 1490627351232 + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json new file mode 100644 index 0000000000..dc4669e8d9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json @@ -0,0 +1,40 @@ +{ + "requestDetails": + { + "modelInfo": + { + "modelType":"service", + "modelInvariantUuid":"uuid-miu-svc-011-abcdef", + "modelVersionId":"ASDC_TOSCA_UUID", + "modelName":"SIModelName1", + "modelVersion":"2" + }, + "subscriberInfo": + { + "globalSubscriberId":"SDN-ETHERNET-INTERNET", + "subscriberName":"Kaneohe" + }, + "requestInfo": + { + "instanceName":"VCPE1", + "source":"VID", + "suppressRollback":"false", + "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "cloudConfiguration": + { + "lcpCloudRegionId":"mdt1", + "tenantId":"8b1df54faa3b49078e3416e21370a3ba" + }, + "requestParameters": + { + "subscriptionServiceType":"123456789", + "aLaCarte":"false", + "userParams": + { + "BRG_WAN_MAC_Address" : "brgmac" + } + } + + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json new file mode 100644 index 0000000000..947933cbb6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json @@ -0,0 +1,61 @@ +{ + "requestDetails": + { + "modelInfo": + { + "modelType":"service", + "modelInvariantUuid":"uuid-miu-svc-011-abcdef", + "modelVersionId":"ASDC_TOSCA_UUID", + "modelName":"SIModelName1", + "modelVersion":"2" + }, + "subscriberInfo": + { + "globalSubscriberId":"SDN-ETHERNET-INTERNET", + "subscriberName":"Kaneohe" + }, + "requestInfo": + { + "source":"VID", + "suppressRollback":"false", + "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName":"serviceInstanceName" + }, + "cloudConfiguration": + { + "lcpCloudRegionId":"mdt1_123", + "tenantId":"8b1df54faa3b49078e3416e21370a3ba" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "requestParameters": + { + "subscriptionServiceType":"123456789", + "aLaCarte":"false", + "userParams": [ + { + "name": "BRG_WAN_MAC_Address", + "value": "brgmac" + }, + { + "name": "Customer_Location", + "value": + { + "customerLatitude" : "32.89748", + "customerLongitude" : "-97.040443" + } + }, + { + "name": "Homing_Model_Ids", + "value": + { + "resourceModuleName" : "test" + } + } + ] + } + + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json new file mode 100644 index 0000000000..d5b0713d9f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json @@ -0,0 +1,39 @@ +{ + "requestDetails": + { + "modelInfo": + { + "modelType":"service", + "modelInvariantUuid":"uuid-miu-svc-011-abcdef", + "modelVersionId":"ASDC_TOSCA_UUID", + "modelName":"SIModelName1", + "modelVersion":"2" + }, + "subscriberInfo": + { + "globalSubscriberId":"SDN-ETHERNET-INTERNET", + "subscriberName":"Kaneohe" + }, + "requestInfo": + { + "source":"VID", + "suppressRollback":"true", + "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "cloudConfiguration": + { + "lcpCloudRegionId":"mdt1", + "tenantId":"8b1df54faa3b49078e3416e21370a3ba" + }, + "requestParameters": + { + "subscriptionServiceType":"123456789", + "aLaCarte":"false", + "userParams": + { + "BRG_WAN_MAC_Address" : "brgmac" + } + } + + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml new file mode 100644 index 0000000000..3cb31464d5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml @@ -0,0 +1,31 @@ + + ar-brgB + Active + BRG + BRG + BRG + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml new file mode 100644 index 0000000000..97992fc00b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml @@ -0,0 +1,31 @@ + + ar-txcA + Active + Tunnel XConn + Tunnel XConn + Tunnel XConn + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml new file mode 100644 index 0000000000..932dbfb2ca --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml @@ -0,0 +1,6 @@ + + + allotted-resource + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/ar-brgB + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml new file mode 100644 index 0000000000..e0511873b6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml @@ -0,0 +1,35 @@ + + + MIS/1604/0026/SW_INTERNET + 123456789 + + + generic-vnf + /aai/v7/generic-vnf/vnfX + + + l3-network + /aai/v7/l3-network/netA + + + generic-vnf + /aai/v7/generic-vnf/vnfY + + + l3-network + /aai/v7/l3-network/netB + + + l3-network + /aai/v7/l3-network/netC + + + allotted-resource + /aai/v11/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/ar-txcA + + + allotted-resource + /aai/v11/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/ar-brgB + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml new file mode 100644 index 0000000000..feb535c238 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml @@ -0,0 +1,8 @@ + + MIS/1604/0026/SW_INTERNET + SDN-MOBILITY + 123456789 + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml new file mode 100644 index 0000000000..1c4f13d642 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml @@ -0,0 +1,6 @@ + + + allotted-resource + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/ar-txcA + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json new file mode 100644 index 0000000000..dc4669e8d9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json @@ -0,0 +1,40 @@ +{ + "requestDetails": + { + "modelInfo": + { + "modelType":"service", + "modelInvariantUuid":"uuid-miu-svc-011-abcdef", + "modelVersionId":"ASDC_TOSCA_UUID", + "modelName":"SIModelName1", + "modelVersion":"2" + }, + "subscriberInfo": + { + "globalSubscriberId":"SDN-ETHERNET-INTERNET", + "subscriberName":"Kaneohe" + }, + "requestInfo": + { + "instanceName":"VCPE1", + "source":"VID", + "suppressRollback":"false", + "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "cloudConfiguration": + { + "lcpCloudRegionId":"mdt1", + "tenantId":"8b1df54faa3b49078e3416e21370a3ba" + }, + "requestParameters": + { + "subscriptionServiceType":"123456789", + "aLaCarte":"false", + "userParams": + { + "BRG_WAN_MAC_Address" : "brgmac" + } + } + + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml new file mode 100644 index 0000000000..8b8863e29c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml @@ -0,0 +1,36 @@ + + + + generic-vnf + /aai/v7/generic-vnf/vnfX + + + l3-network + /aai/v7/l3-network/netA + + + generic-vnf + /aai/v7/generic-vnf/vnfY/ + + + l3-network + /aai/v7/l3-network/netB + + + l3-network + /aai/v7/l3-network/netC + + + allotted-resource + /aai/v11/anytxc + + + allotted-resource + /aai/v11/anybrg + + + allotted-resource + /aai/v11/other + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml new file mode 100644 index 0000000000..2be546162f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml @@ -0,0 +1,37 @@ + + + + 36e20198-c67a-464b-96d0-aaa99eb2639e + 5b9b15d0-5dd7-47dc-95b9-0440c340a3ba + 1.0 + BRGmodelname + 013bd784-9bca-4919-ae2f-ae57af27bad9 + + + parent-service-instance-id + consuming-service-instance-id + namefromrequest + brg + allottedresourceidfromrequest + + + fq-name + + d1 + drole + + vlan-tag + + s2 + srole + + txc-id + + 1 + 123 + a.b.c.d + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml new file mode 100644 index 0000000000..e352ff8f1f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml @@ -0,0 +1,8 @@ + + + + allotted-resource + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml new file mode 100644 index 0000000000..8c3976b828 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + BRGr + BRGt + BRG + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml new file mode 100644 index 0000000000..650d608fb0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + txc + BRG + BRG + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml new file mode 100644 index 0000000000..14c7410995 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml @@ -0,0 +1,38 @@ + + MIS/1604/0026/SW_INTERNET + 123456789 + + Active + + + + allotted-resource + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + + + cvlan-tag + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml new file mode 100644 index 0000000000..8ed991608a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + BRG + BRG + BRG + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml new file mode 100644 index 0000000000..713c5e7ad5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d1 + MIS%252F1604%252F0026%252FSW_INTERNET + deactvate + brg-topology-operation + http://localhost:28090/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteBRGInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + brg + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml new file mode 100644 index 0000000000..df61910355 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d3 + MIS%252F1604%252F0026%252FSW_INTERNET + unassign + brg-topology-operation + http://localhost:28090/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteBRGInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + brg + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml new file mode 100644 index 0000000000..35c783539c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d2 + MIS%252F1604%252F0026%252FSW_INTERNET + delete + brg-topology-operation + http://localhost:28090/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteBRGInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + brg + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml new file mode 100644 index 0000000000..c2d197a2d8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml @@ -0,0 +1,24 @@ + + + + 36e20198-c67a-464b-96d0-aaa99eb2639e + 5b9b15d0-5dd7-47dc-95b9-0440c340a3ba + 1.0 + TXCmodelname + 013bd784-9bca-4919-ae2f-ae57af27bad9 + + + parent-service-instance-id + consuming-service-instance-id + namefromrequest + tunnelxconn + allottedresourceidfromrequest + + + my-vni + my-bearer-ip + my-lan-ip + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml new file mode 100644 index 0000000000..e352ff8f1f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml @@ -0,0 +1,8 @@ + + + + allotted-resource + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml new file mode 100644 index 0000000000..dfb7d46a68 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + TXCr + TXCt + TXC + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml new file mode 100644 index 0000000000..59c503036a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + brg + TXC + TXC + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml new file mode 100644 index 0000000000..14c7410995 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml @@ -0,0 +1,38 @@ + + MIS/1604/0026/SW_INTERNET + 123456789 + + Active + + + + allotted-resource + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + + + cvlan-tag + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml new file mode 100644 index 0000000000..f2063442d6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + Tunnel XConn + Tunnel XConn + Tunnel XConn + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml new file mode 100644 index 0000000000..35630b79a8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d1 + MIS%252F1604%252F0026%252FSW_INTERNET + deactvate + tunnelxconn-topology-operation + http://localhost:8080/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteTunnelXConnInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + tunnelxconn + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml new file mode 100644 index 0000000000..f6c9cc4626 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d3 + MIS%252F1604%252F0026%252FSW_INTERNET + unassign + tunnelxconn-topology-operation + http://localhost:8080/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteTunnelXConnInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + tunnelxconn + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml new file mode 100644 index 0000000000..2a5597ca77 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d2 + MIS%252F1604%252F0026%252FSW_INTERNET + delete + tunnelxconn-topology-operation + http://localhost:8080/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteTunnelXConnInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + tunnelxconn + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml new file mode 100644 index 0000000000..8ed991608a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + BRG + BRG + BRG + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml new file mode 100644 index 0000000000..f2063442d6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + Tunnel XConn + Tunnel XConn + Tunnel XConn + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogServiceResourcesData.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogServiceResourcesData.json new file mode 100644 index 0000000000..d05fccf98a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogServiceResourcesData.json @@ -0,0 +1,94 @@ +{ "serviceResources" : { + "modelInfo" : { + "modelName" : "MSO Test Network", + "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", + "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", + "modelVersion" : null + }, + "serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vHNF for DHV Test", + "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", + "modelInvariantUuid" : "6ea0b528-e303-4686-aa77-aa2fcbdccb96", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5", + "modelInstanceName" : "vHNF for DHV Test 17" + }, + "toscaNodeType" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null, + "multiStageDesign" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "f5696ec0-ec71-4916-bf3b-93a654efcba4", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ], + "serviceNetworks": [ + { + "modelInfo" : { + "modelName" : "CONTRAIL_BASIC", + "modelUuid" : "fe5be3a6-dbe0-46d6-bcac-44dc841a7edc", + "modelInvariantUuid" : "ab07fbd8-185a-45ac-be45-db3eb02e98d5", + "modelVersion" : null, + "modelCustomizationUuid" : "0cb9b26a-9820-48a7-86e5-16c510e993d9", + "modelInstanceName" : "CONTRAIL_BASIC 5" + }, + "toscaNodeType" : null, + "networkType" : null, + "networkTechnology" : null, + "networkRole" : null, + "networkScope" : null + } + ], + "serviceAllottedResources": [ + { + "modelInfo" : { + "modelName" : "IP_MUX_Demux", + "modelUuid" : "64a1a718-556b-48ce-b3b7-ed3237ccc94f", + "modelInvariantUuid" : "f110ef53-a0a6-4d72-ab91-fd88a835e8c4", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "4bab0880-2f06-4aeb-87cb-3734c8e8bf93", + "modelInstanceName" : "Pri_IP_MUX_Demux 1" + }, + "toscaNodeType" : null, + "allottedResourceType" : "ContrailRoute", + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + }, + { + "modelInfo" : { + "modelName" : "Service_Admin", + "modelUuid" : "73501e03-ee76-4509-a8ce-96d2a9f33ee9", + "modelInvariantUuid" : "462edf71-1a3c-487b-bf55-497460ab7de3", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "a896ffad-c8f9-404e-a527-7a8d0cc99ce6", + "modelInstanceName" : "Pri_Service_Admin 5" + }, + "toscaNodeType" : null, + "allottedResourceType" : "SecurityZone", + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + } + ] + }} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json new file mode 100644 index 0000000000..b6e8a94888 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json @@ -0,0 +1,98 @@ +{ "serviceResources" : { + "serviceType" : "PortMirroring", + "serviceRole" : "InfraRole", + "environmentContext" : "Luna", + "workloadContext" : "Oxygen", + "modelInfo" : { + "modelName" : "MSO Test Network", + "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", + "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", + "modelVersion" : null + }, + "serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vHNF for DHV Test", + "modelUuid" : "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelInvariantUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "MODEL-ID-1234", + "modelInstanceName" : "vHNF for DHV Test 17" + }, + "toscaNodeType" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : "vSCP", + "nfNamingCode" : null, + "multiStageDesign" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "introvert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ], + "serviceNetworks": [ + { + "modelInfo" : { + "modelName" : "CONTRAIL_BASIC", + "modelUuid" : "fe5be3a6-dbe0-46d6-bcac-44dc841a7edc", + "modelInvariantUuid" : "ab07fbd8-185a-45ac-be45-db3eb02e98d5", + "modelVersion" : null, + "modelCustomizationUuid" : "0cb9b26a-9820-48a7-86e5-16c510e993d9", + "modelInstanceName" : "CONTRAIL_BASIC 5" + }, + "toscaNodeType" : null, + "networkType" : null, + "networkTechnology" : null, + "networkRole" : null, + "networkScope" : null + } + ], + "serviceAllottedResources": [ + { + "modelInfo" : { + "modelName" : "IP_MUX_Demux", + "modelUuid" : "64a1a718-556b-48ce-b3b7-ed3237ccc94f", + "modelInvariantUuid" : "f110ef53-a0a6-4d72-ab91-fd88a835e8c4", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "4bab0880-2f06-4aeb-87cb-3734c8e8bf93", + "modelInstanceName" : "Pri_IP_MUX_Demux 1" + }, + "toscaNodeType" : null, + "allottedResourceType" : "ContrailRoute", + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + }, + { + "modelInfo" : { + "modelName" : "Service_Admin", + "modelUuid" : "73501e03-ee76-4509-a8ce-96d2a9f33ee9", + "modelInvariantUuid" : "462edf71-1a3c-487b-bf55-497460ab7de3", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "a896ffad-c8f9-404e-a527-7a8d0cc99ce6", + "modelInstanceName" : "Pri_Service_Admin 5" + }, + "toscaNodeType" : null, + "allottedResourceType" : "SecurityZone", + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + } + ] + }} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json new file mode 100644 index 0000000000..e1d3118537 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json @@ -0,0 +1,110 @@ +{ "serviceResources" : { + "serviceType" : "PortMirroring", + "serviceRole" : "InfraRole", + "environmentContext" : "Luna", + "workloadContext" : "Oxygen", + "modelInfo" : { + "modelName" : "MSO Test Network", + "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", + "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", + "modelVersion" : null + }, + "serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vHNF for DHV Test", + "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", + "modelInvariantUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5", + "modelInstanceName" : "vHNF for DHV Test 17" + }, + "toscaNodeType" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : "vSCP", + "nfNamingCode" : null, + "multiStageDesign" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "introvert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-1", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0b", + "modelInvariantUuid" : "extrovert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a788" + }, "isBase" : false, + "vfModuleLabel" : "addon_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ], + "serviceNetworks": [ + { + "modelInfo" : { + "modelName" : "CONTRAIL_BASIC", + "modelUuid" : "fe5be3a6-dbe0-46d6-bcac-44dc841a7edc", + "modelInvariantUuid" : "ab07fbd8-185a-45ac-be45-db3eb02e98d5", + "modelVersion" : null, + "modelCustomizationUuid" : "0cb9b26a-9820-48a7-86e5-16c510e993d9", + "modelInstanceName" : "CONTRAIL_BASIC 5" + }, + "toscaNodeType" : null, + "networkType" : null, + "networkTechnology" : null, + "networkRole" : null, + "networkScope" : null + } + ], + "serviceAllottedResources": [ + { + "modelInfo" : { + "modelName" : "IP_MUX_Demux", + "modelUuid" : "64a1a718-556b-48ce-b3b7-ed3237ccc94f", + "modelInvariantUuid" : "f110ef53-a0a6-4d72-ab91-fd88a835e8c4", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "4bab0880-2f06-4aeb-87cb-3734c8e8bf93", + "modelInstanceName" : "Pri_IP_MUX_Demux 1" + }, + "toscaNodeType" : null, + "allottedResourceType" : "ContrailRoute", + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + }, + { + "modelInfo" : { + "modelName" : "Service_Admin", + "modelUuid" : "73501e03-ee76-4509-a8ce-96d2a9f33ee9", + "modelInvariantUuid" : "462edf71-1a3c-487b-bf55-497460ab7de3", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "a896ffad-c8f9-404e-a527-7a8d0cc99ce6", + "modelInstanceName" : "Pri_Service_Admin 5" + }, + "toscaNodeType" : null, + "allottedResourceType" : "SecurityZone", + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + } + ] + }} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogVnfData.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogVnfData.json new file mode 100644 index 0000000000..c7938d1af6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogVnfData.json @@ -0,0 +1,44 @@ +{"serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vHNF for DHV Test", + "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", + "modelInvariantUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5", + "modelInstanceName" : "vHNF for DHV Test 17" + }, + "toscaNodeType" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : "vSCP", + "nfNamingCode" : null, + "multiStageDesign" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "introvert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-1", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0b", + "modelInvariantUuid" : "extrovert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a788" + }, "isBase" : false, + "vfModuleLabel" : "addon_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ] +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogVnfNoTwoPhasedForVfModule.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogVnfNoTwoPhasedForVfModule.json new file mode 100644 index 0000000000..3067d124c3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogVnfNoTwoPhasedForVfModule.json @@ -0,0 +1,44 @@ +{"serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vSAMP12", + "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", + "modelInvariantUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "MODEL-123", + "modelInstanceName" : "VNF for VF Module Create Test Two Phased" + }, + "toscaNodeType" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : "vSCP", + "nfNamingCode" : null, + "multiStageDesign" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "STMTN5MMSC21-MMSC::model-1-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "introvert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-1", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0b", + "modelInvariantUuid" : "extrovert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a788" + }, "isBase" : false, + "vfModuleLabel" : "addon_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ] +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogVnfYesTwoPhasedForVfModule.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogVnfYesTwoPhasedForVfModule.json new file mode 100644 index 0000000000..a9b3226483 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/getCatalogVnfYesTwoPhasedForVfModule.json @@ -0,0 +1,44 @@ +{"serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vSAMP12", + "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", + "modelInvariantUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "MODEL-123", + "modelInstanceName" : "VNF for VF Module Create Test Two Phased" + }, + "toscaNodeType" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : "vSCP", + "nfNamingCode" : null, + "multiStageDesign" : "true", + "vfModules": [ + { + "modelInfo" : { + "modelName" : "STMTN5MMSC21-MMSC::model-1-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "introvert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-1", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0b", + "modelInvariantUuid" : "extrovert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a788" + }, "isBase" : false, + "vfModuleLabel" : "addon_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ] +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/serviceDecompositionATMFW.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/serviceDecompositionATMFW.json new file mode 100644 index 0000000000..bc54c557e1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VIPR/serviceDecompositionATMFW.json @@ -0,0 +1,110 @@ +{ +"serviceResources" : { + "modelInfo" : { + "modelName" : "CMW_Service", + "modelUuid" : "", + "modelInvariantId" : "cmw-123-456-789", + "modelVersion" : "", + "modelCustomizationUuid" : "", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "Cmw_123", + "modelType" : "" + }, + "serviceInstanceData" : { + "instanceId" : "ff5256d2-5a33-55df-13ab-12abad84e7ff" + }, + "serviceNetworks" : [ { + "modelInfo" : { + "modelName" : "CONTRAIL30_BASIC", + "modelUuid" : "", + "modelInvariantId" : "not yet implemented", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "z_network_123", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "mod-inst-uuid-123", + "modelType" : "network" + }, + "instanceData" : { }, + "networkType" : "CONTRAIL30_BASIC" + } ], + "serviceVnfs" : [ { + "modelInfo" : { + "modelName" : "vSAMP12", + "modelUuid" : "", + "modelInvariantId" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelType" : "vnf" + }, + "instanceData" : { }, + "vfModules" : [ { + "modelInfo" : { + "modelName" : "vSAMP12::base::module-0", + "modelUuid" : "", + "modelInvariantId" : "miu-1001", + "modelVersion" : "1", + "modelCustomizationUuid" : "1001", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "", + "modelType" : "vfModule" + }, + "instanceData" : { }, + "hasVolumeGroup" : false, + "isBase" : true, + "initialCount" : 1 + }, { + "modelInfo" : { + "modelName" : "base::module-0", + "modelUuid" : "", + "modelInvariantId" : "miu-1002", + "modelVersion" : "1", + "modelCustomizationUuid" : "1002", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "", + "modelType" : "vfModule" + }, + "instanceData" : { }, + "hasVolumeGroup" : false, + "isBase" : true, + "initialCount" : 1 + }, { + "modelInfo" : { + "modelName" : "vSAMP12DEV::base::module-0", + "modelUuid" : "", + "modelInvariantId" : "miu-1003", + "modelVersion" : "1", + "modelCustomizationUuid" : "f86e8800-7629-427f-b284-3dbfd04db01f", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "", + "modelType" : "vfModule" + }, + "instanceData" : { }, + "hasVolumeGroup" : false, + "isBase" : true, + "initialCount" : 0 + } ] + } ], + "serviceAllottedResources" : [ { + "modelInfo" : { + "modelName" : "Bruce Wayne", + "modelUuid" : "", + "modelInvariantId" : "not yet implemented", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "ar-mod-custid-456-456", + "modelInstanceName" : "Clark Kent", + "modelCustomizationName" : "", + "modelVersionId" : "123-123", + "modelType" : "allottedResource" + }, + "instanceData" : { } + } ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..0688ea51e4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + fqdn123 + slowburn + 145878989 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..a421355aba --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,53 @@ + + + {{MESSAGE-ID}} + true + d485ecee-957c-4a0a-8b95-27a22b90103f + + + mmsc_vol_1 + a73e0fe9-1ce8-49c2-8fef-e2788605be29 + + + mmsc_vol_2 + 37b6455a-5ea8-463a-89e3-0efeaf7b7c6d + + + nemsfe_vol_1 + b7ff1c21-d138-49a3-bf13-4cfd91efaf48 + + + nemsbe_vol_1 + a5988471-cd42-44d8-b078-64f2f13d3d4c + + + mmsc_vol_5 + f7b91c1e-ab8c-413a-a850-ba80a246c7e0 + + + nemsfe_vol_2 + 957ea3f3-2d4a-4707-bfd2-ba66f42037c2 + + + mmsc_vol_3 + de6fccfe-d61a-48b0-b03b-87bf1bf749b3 + + + mmsc_vol_4 + 76162310-2c38-4c32-981c-5c2880190077 + + + + RDM2WAGPLCP + e585e4f4-9452-437a-b294-45a2d6d3b7a3 + + c30b9453-4b68-4c2e-aacf-58a5ba648bf5 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + 1bbab536a19b4756926e7d0ec1eb543c + true + 78987 + ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef + + ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/DBUpdateResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/DBUpdateResponse.xml new file mode 100644 index 0000000000..0ae5b79484 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/DBUpdateResponse.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml new file mode 100644 index 0000000000..5232e530e9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml @@ -0,0 +1,29 @@ + + + DEV-VF-0011 + UPDATE_VF_MODULE + PORTAL + + + skask + supercool + pcrf-capacity + PCRF::module-0 + + serviceIdUUID + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + 78987 + introvert + 3.14 + myhost.appl.edu + introvert + 3.14 + + + VLAN-OAM-1323 + slcp34246vbc246ceb + 970cd2b9-7f09-4a12-af47-182ea38ba1f0 + 545cc2c3-1930-4100-b534-5d82d0e12bb6 + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/GenerateVfModuleName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/GenerateVfModuleName_AAIResponse_Success.xml new file mode 100644 index 0000000000..1c736453bc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/GenerateVfModuleName_AAIResponse_Success.xml @@ -0,0 +1,51 @@ + + 12345678-f41f-4822-9323-b75962763d74 + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + pending-create + false + false + introvert + 2.0 + 0000020 + + + lukewarm + PCRF::module-0-0 + extrovert + 2.0 + true + fastburn + 2 + pending-create + 0000074 + + + supercool + PCRF::module-1-0 + extrovert + 2.0 + false + slowburn + 0 + pending-create + 0000075 + + + supercool + PCRF::module-1-0 + introvert + 2.0 + false + slowburn + 1 + pending-create + 0000075 + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/GenericVnf.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/GenericVnf.xml new file mode 100644 index 0000000000..ed96028908 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/GenericVnf.xml @@ -0,0 +1,38 @@ + + skask + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + pending-create + false + false + introvert + 2.0 + 0000020 + + + lukewarm + PCRF::module-0-0 + introvert + 2.0 + true + fastburn + pending-create + 0000074 + + + supercool + PCRF::module-1-0 + extrovert + 2.0 + false + slowburn + pending-create + 0000075 + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..f3009e0f4c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 195159195 + 14567890 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCSITopologyAssignCallback.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCSITopologyAssignCallback.xml new file mode 100644 index 0000000000..d476b728bd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCSITopologyAssignCallback.xml @@ -0,0 +1,11 @@ + + 094d311c-40bc-4ff1-9617-37c4226efcc3 + 200 + + Y + + 8462db9b-3e91-4e90-a2c8-6471313f87bf + restconf/config/GENERIC-RESOURCE-API:services/service/8462db9b-3e91-4e90-a2c8-6471313f87bf/service-data/service-topology/ + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml new file mode 100644 index 0000000000..4cab6c6615 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml @@ -0,0 +1,13 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml new file mode 100644 index 0000000000..7512435415 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml @@ -0,0 +1,16 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + + restconf/SDNCObjectPath + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml new file mode 100644 index 0000000000..7d3d0e54d1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml @@ -0,0 +1,13 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml new file mode 100644 index 0000000000..c1a03539cc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml @@ -0,0 +1,16 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + + restconf/SDNCObjectPath + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml new file mode 100644 index 0000000000..e43a1319ca --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml @@ -0,0 +1,13 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml new file mode 100644 index 0000000000..d061cda9e0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml @@ -0,0 +1,8 @@ + + + skask + + 404 + {{REQUEST-ID}} + Y + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml new file mode 100644 index 0000000000..c1a03539cc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml @@ -0,0 +1,16 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + + restconf/SDNCObjectPath + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml new file mode 100644 index 0000000000..0ee3f2827d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml @@ -0,0 +1,315 @@ + + + bd1b3789-6474-4935-94b2-90b656e035d0 + + bd1b3789-6474-4935-94b2-90b656e035d0 + + 9ddf628a-9eca-430e-8974-22d520a31be1 + assign + https://localhost:8443/adapters/rest/SDNCNotify + + + notsurewecare + bd1b3789-6474-4935-94b2-90b656e035d0 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + + PendingCreate + + + VNN1CA52LCP + skask + afd0f02a-1ddb-43bb-aded-5113e46e82ae + ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 + ZVNN1MOGX01 + 33d209df14ac4c08ad60747185d2f3e0 + bd1b3789-6474-4935-94b2-90b656e035d0 + ZVNN1MOGX01 - VF AUG 1::module-0 + + + + + mog_exn + 03dbd833-785c-40c0-bf32-37594b5334bc + MNS-25180-P-VNNYCA01_exn_protected_net_1 + + + 6f82d234-41a4-48e9-a9e8-415667a72929 + + filter1 + + + filter2 + + + + mog_oam + 3f181cde-9380-4c20-9d3a-e1a4ee74f994 + MNS-25180-P-VNNYCA01_oam_protected_net_1 + + + 713b6770-13fa-4949-8dbb-a1288c5e5932 + + + mog_cor_B + 821a550a-3f50-4725-995b-f212d5caec7c + MNS-25180-P-VNNYCA01_cor_direct_net_1 + + + 18926e56-12b6-4a4d-98b6-37e0c05626ee + + + mog_cor_A + 3dabf5c0-cffb-420c-8960-8499c74eb25f + MNS-25180-P-VNNYCA01_cor_direct_net_2 + + + 35530b29-a4de-48ff-a014-111110ccc652 + + + mog_gn + 3ce97321-6e7f-49af-bd12-f833e377c310 + MNS-25180-P-VNNYCA01_gn_direct_net_1 + + + 32bfdd2c-28e1-4895-87a6-373bf12c3129 + + + mog_dmz + d43ca910-02a5-47dc-8510-100a68a3c9e0 + MNS-25180-P-VNNYCA01_dmz_protected_net_1 + + + cb9500fb-943f-412e-aea6-458711564a75 + + + nova + + + ps + + ZVNN1MOGX01MPS001 + + + ZVNN1MOGX01MPS002 + + + ZVNN1MOGX01MPS003 + + + ZVNN1MOGX01MPS004 + + 4 + + mog_cor_B + + 107.224.36.251 + + + 107.224.36.252 + + + 107.224.36.253 + + + 107.224.36.254 + + N + + + + cm + + ZVNN1MOGX01MCM001 + + + ZVNN1MOGX01OAM002 + + 1 + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + N + + + mog_oam + + 107.239.167.250 + + + 107.239.167.251 + + N + + + + oam + + ZVNN1MOGX01OAM001 + + + ZVNN1MOGX01OAM002 + + 2 + + mog_oam + + 107.239.167.252 + + + 107.239.167.251 + + N + + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + N + + + + pd + + ZVNN1MOGX01MPD001 + + + ZVNN1MOGX01MPD002 + + 2 + + mog_dmz + + 107.225.25.253 + + + 107.225.25.254 + + N + 107.225.254.253 + + + mog_oam + + 107.239.167.254 + + + 107.239.167.253 + + N + 107.239.167.249 + + + mog_exn + + 107.224.46.253 + + + 107.224.46.254 + + N + 107.224.46.252 + + + mog_cor_B + + 107.224.36.247 + + + 107.224.36.248 + + N + 107.224.41.252 + + + mog_gn + + 107.224.41.253 + + + 107.224.41.254 + + N + 107.224.41.252 + + + mog_cor_A + + 107.224.38.253 + + + 107.224.38.254 + + N + + + + sm + + ZVNN1MOGX01MSM001 + + + ZVNN1MOGX01MSM002 + + + ZVNN1MOGX01MSM003 + + + ZVNN1MOGX01MSM004 + + 4 + + mog_cor_B + + 107.224.36.243 + + + 107.224.36.244 + + + 107.224.36.245 + + + 107.224.36.246 + + N + + + + + ZVNNMOGX01_base + SDN-MOBILITY + ZVNN1MOGX01 - VF AUG 1::module-0 + ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 + ZVNN1MOGX01 + + + + 9ddf628a-9eca-430e-8974-22d520a31be1 + + PORTAL + VNFActivateRequest + + + + 200 + Y + synccomplete + 2016-08-05T16:15:19.398Z + vnf-topology-operation + VNFActivateRequest + assign + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml new file mode 100644 index 0000000000..677ecb7444 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml @@ -0,0 +1,141 @@ + + + 28455973-1ee5-4ad1-8d35-c4732679743a + + 200 + Y + synccomplete + 2016-06-08T19:44:59.138Z + vnf-topology-operation + VNFActivateRequest + assign + + + 28455973-1ee5-4ad1-8d35-c4732679743 + + notsurewecare + 28455973-1ee5-4ad1-8d35-c4732679743a + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + + 5e168556-a5c6-4813-bff3-cc03007afbbc + http://localhost:8080/adapters/rest/SDNCNotify + assign + + + AAIAIC25 + MSOTEST06-vSAMP3::base::module-0 + 91ad7ab0-9ffd-471d-971c-3eb913a2cc75 + Test/vSAMP3 1 + MSOTEST06 + 4ae1d3446a4c48b2bec44b6cfba06d68 + 28455973-1ee5-4ad1-8d35-c4732679743a + vSAMP3::base::module-0 + + + PendingCreate + + + + image + Ubuntu_Perf + + + flavor + m1.small + + + + int_imbl + 680b7453-0ec4-4d96-b355-280d981d418f + Nimbus-25193-T-Willows2_int_imbl_net_1 + default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_int_imbl_net_1 + + 775607fb-e16a-45ef-94a7-82fba0d16eec + 640d07fb-e16a-45ef-94a7-82fba0d169bf + + filter1 + + + filter2 + + + + sgi_protected + f9039ce9-e3cf-4716-b2d1-ec7912178ea4 + Nimbus-25193-T-Willows2_sgi_protected_net_1 + default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_sgi_protected_net_1 + b9999ce9-e3cf-4716-b2d1-ec791217678c + + bf11bba8-b971-4ab5-8281-215b3fedcd3c + + + cm + + ZVNN1MOGX01MCM001 + + + ZVNN1MOGX01OAM002 + + 1 + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + + 2606:ae00:2e01:800::67 + + N + 107.224.41.252 + 2001:1890:1001:2B32::29:C + + + mog_oam + + 107.239.167.250 + + + 107.239.167.251 + + + aa::aa::aa::aa::aa::aa + + + bb::bb::bb::bb::bb::bb + + + 1.2.3.4/26 + + + 2002::/64 + + N + 1111:1890:1001:2B32::29:D + + + + nova + + + + MSOTEST06-vSAMP3::base::module-0 + SDN-MOBILITY + vSAMP3::base::module-0 + Test/vSAMP3 1 + MSOTEST06 + + + + 5e168556-a5c6-4813-bff3-cc03007afbbc + + SoapUI-bns-vf-base-vSAMP3-9001 + VNFActivateRequest + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml new file mode 100644 index 0000000000..c50c25671b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml @@ -0,0 +1,81 @@ + + + + 0725b072-b854-4705-bf8e-c1a1eb08651e + vSAMP10aDEV::base::module-0 + zmtn6nf-code-111_base_0 + + + vSAMP10aDEV::base::module-0 + 819ef122-ca19-4141-a61e-62922f8fc279 + ff2ae348-214a-11e7-93ae-92361f002673 + 3a97db99-c4bb-498a-a13a-38f65f1ced3d + ff2ae348-214a-11e7-93ae-92361f002673 + + 19123c2924c648eb8e42a3c1f14b7682 + mtn6 + AUSTTXGR + + + image + Ubuntu_Perf + + + flavor + m1.small + + + + + + cm + + ZVNN1MOGX01MCM001 + + + ZVNN1MOGX01OAM002 + + 1 + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + + 2606:ae00:2e01:800::67 + + N + 107.224.41.252 + 2001:1890:1001:2B32::29:C + + + mog_oam + + 107.239.167.250 + + + 107.239.167.251 + + + aa::aa::aa::aa::aa::aa + + + bb::bb::bb::bb::bb::bb + + + 1.2.3.4/26 + + + 2002::/64 + + N + 1111:1890:1001:2B32::29:D + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml new file mode 100644 index 0000000000..ba98ef8838 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml @@ -0,0 +1,82 @@ + + + + nf-type-1 + zmtn6nf-code-111 + nf-role-1 + nf-function-1 + nf-code-1 + eac30f85-f61f-4c5f-862e-2c62f9e135de + null + + + vSAMP10a_macro + 819ef122-ca19-4141-a61e-62922f8fc279 + 1.0 + ef176121-f02c-4dd3-927c-22131d48446b + ff2ae348-214a-11e7-93ae-92361f002672 + + + + mog_exn + 03dbd833-785c-40c0-bf32-37594b5334bc + MNS-25180-P-VNNYCA01_exn_protected_net_1 + + + 6f82d234-41a4-48e9-a9e8-415667a72929 + + filter1 + + + filter2 + + + + mog_oam + 3f181cde-9380-4c20-9d3a-e1a4ee74f994 + MNS-25180-P-VNNYCA01_oam_protected_net_1 + + + 713b6770-13fa-4949-8dbb-a1288c5e5932 + + + mog_cor_B + 821a550a-3f50-4725-995b-f212d5caec7c + MNS-25180-P-VNNYCA01_cor_direct_net_1 + + + 18926e56-12b6-4a4d-98b6-37e0c05626ee + + + mog_cor_A + 3dabf5c0-cffb-420c-8960-8499c74eb25f + MNS-25180-P-VNNYCA01_cor_direct_net_2 + + + 35530b29-a4de-48ff-a014-111110ccc652 + + + mog_gn + 3ce97321-6e7f-49af-bd12-f833e377c310 + MNS-25180-P-VNNYCA01_gn_direct_net_1 + + + 32bfdd2c-28e1-4895-87a6-373bf12c3129 + + + mog_dmz + d43ca910-02a5-47dc-8510-100a68a3c9e0 + MNS-25180-P-VNNYCA01_dmz_protected_net_1 + + + cb9500fb-943f-412e-aea6-458711564a75 + + + nova + + + 19123c2924c648eb8e42a3c1f14b7682 + mtn6 + AUSTTXGR + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml new file mode 100644 index 0000000000..c1a03539cc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml @@ -0,0 +1,16 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + + restconf/SDNCObjectPath + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml new file mode 100644 index 0000000000..77528ccf61 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml new file mode 100644 index 0000000000..49ecd0bf3f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml @@ -0,0 +1,55 @@ + + skask + supercool + slowburn + true + + + key1 + value1 + + + key2 + value2 + + +server1_private_ip +192.168.28.3 + + +contrail-service-instance-fqdn +default-domain:MSOTest:MsoNW-RA + + +policyKey1_contrail_network_policy_fqdn +MSOTest:DefaultPolicyFQDN1 + + +policyKey2_contrail_network_policy_fqdn +MSOTest:DefaultPolicyFQDN2 + + +oam_management_v6_address +2000:abc:bce:1111 + + +oam_management_v4_address +127.0.0.1 + + + + skask + supercool + slowburn + true + tenantId + cloudSiteId + + requestId + serviceInstanceId + + {{MESSAGE-ID}} + + {{MESSAGE-ID}} + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteRequest.xml new file mode 100644 index 0000000000..61aeaa7d66 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteRequest.xml @@ -0,0 +1,15 @@ + + testMessageId + true + testNotificationUrl + testAicCloudRegion} + testTenantId + testVnfId + testVfModuleId + testVfModuleStackId + + testRequestId + testServiceInstanceId + false + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteResponse.xml new file mode 100644 index 0000000000..b5b61192f7 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteResponse.xml @@ -0,0 +1,56 @@ + + testMessageId + true + testVfModuleId + + + key1 + value1 + + + key2 + value2 + + + server1_private_ip + 192.168.28.3 + + + contrail-service-instance-fqdn + default-domain:MSOTest:MsoNW-RA + + + policyKey1_contrail_network_policy_fqdn + MSOTest:DefaultPolicyFQDN1 + + + policyKey2_contrail_network_policy_fqdn + MSOTest:DefaultPolicyFQDN2 + + + oam_management_v6_address + 2000:abc:bce:1111 + + + oam_management_v4_address + 127.0.0.1 + + + internal_security_group + test_internal_security_group + + + int_internal_net_id + test_int_internal_net_id + + + dsx_server_group_id + test_dsx_server_group_id + + + mcas_host_key + test_mcas_host_key + + + testVnfId + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml new file mode 100644 index 0000000000..c602dd9667 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml @@ -0,0 +1,16 @@ + + skask + supercool + slowburn + + + key1 + value1 + + + key2 + value2 + + + {{MESSAGE-ID}} + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml new file mode 100644 index 0000000000..830d2e2237 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml @@ -0,0 +1,15 @@ + + 78987 + slowburn + + + key1 + value1 + + + key2 + value2 + + + {{MESSAGE-ID}} + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml new file mode 100644 index 0000000000..ba0b4e4609 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml @@ -0,0 +1,10 @@ + + lukewarm + PCRF::module-1 + slowburn + pending-create + true + 330-90 + introvert + 2.0 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-new-PendingActivation.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-new-PendingActivation.xml new file mode 100644 index 0000000000..2ccba7d056 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-new-PendingActivation.xml @@ -0,0 +1,9 @@ + + b37d96db-7d2c-47ce-bf61-a6c7b82fe161 + PCRF::module-0-2 + 00000000-0000-0000-0000-000000000000 + 1.0 + false + PendingActivation + 330-90 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-new.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-new.xml new file mode 100644 index 0000000000..481410c3f6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-new.xml @@ -0,0 +1,9 @@ + + b37d96db-7d2c-47ce-bf61-a6c7b82fe161 + PCRF::module-0-2 + 00000000-0000-0000-0000-000000000000 + 1.0 + false + pending-create + 330-90 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-supercool.xml new file mode 100644 index 0000000000..49513f1eac --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-supercool.xml @@ -0,0 +1,27 @@ + + supercool + PCRF::module-2 + fastburn + pending-create + false + 330-89 + introvert + 2.0 + + + volume-group + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + pdk1 + + + volume-group.volume-group-id + 78987 + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VolumeGroup.xml new file mode 100644 index 0000000000..df84706ec5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VolumeGroup.xml @@ -0,0 +1,25 @@ + + 78987 + Volume_2 + slowburn + pcrf-capacity + Active + 0000020 + + + tenant + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + MDTWNJ21 + + + tenant.tenant-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/deleteNetworkResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/deleteNetworkResponse_Success.xml new file mode 100644 index 0000000000..b8b8a4ff20 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/deleteNetworkResponse_Success.xml @@ -0,0 +1,3 @@ + + true + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/requestDetails.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/requestDetails.json new file mode 100644 index 0000000000..76616e14a5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/requestDetails.json @@ -0,0 +1,37 @@ +{ + "requestDetails": { + "project": { + "projectName": "vSAMP12 Project" + }, + "owningEntity": { + "owningEntityId": "MSO-Test-OE", + "owningEntityName": "MSO-Test123" + }, + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "d214abcc-2083-11e7-93ae-92361f002671", + "modelUuid": "c4503baa-2083-11e7-93ae-92361f002671", + "modelName": "MSOTADevInfra_vSAMP12_Service", + "modelVersion": "1.0" + }, + "subscriberInfo": { + "globalSubscriberId": "MSO_1610_dev", + "subscriberName": "MSO_1610_dev" + }, + "requestInfo": { + "instanceName": "bensServiceInstance3", + "source": "VID", + "suppressRollback": "true", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "8b1df54faa3b49078e3416e21370a3ba" + }, + "requestParameters": { + "subscriptionServiceType": "MSO-dev-service-type", + "aLaCarte": "false", + "userParams": [] + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/schema.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/schema.json new file mode 100644 index 0000000000..36b51e9575 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/schema.json @@ -0,0 +1,16 @@ +{ + "CreateServiceInstanceV3": { + "serviceInstance": { + "@class": "inventory.aai.onap.org.v12.ServiceInstance" + }, + "project": { + "@class": "inventory.aai.onap.org.v12.Project" + }, + "owningEntity": { + "@class": "inventory.aai.onap.org.v12.OwningEntity" + }, + "customer": { + "@class": "inventory.aai.onap.org.v12.Customer" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/application-test.yml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/application-test.yml new file mode 100644 index 0000000000..96cdebcc1e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/application-test.yml @@ -0,0 +1,334 @@ +aai: + auth: 757A94191D685FD2092AC1490730A4FC + dme2: + timeout: '30000' + endpoint: http://localhost:${wiremock.server.port} +camunda: + bpm: + admin-user: + id: admin + password: admin + database: + type: h2 + history-level: FULL + metrics: + enabled: false + db-reporter-activate: false +canopi: + auth: 757A94191D685FD2092AC1490730A4FC +csi: + aots: + addincidentmanagement: + endpoint: http://localhost:${wiremock.server.port}/AddIncidentManagementTicketRequest + networkstatus: + endpoint: http://localhost:${wiremock.server.port}/SendManagedNetworkStatusNotification +entitymanager: + packagesToScan: com +mso: + correlation: + timeout: PT60S + logPath: logs + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + adapters: + completemsoprocess: + endpoint: http://localhost:30253/CompleteMsoProcess + db: + auth: 757A94191D685FD2092AC1490730A4FC + password: wLg4sjrAFUS8rfVfdvTXeQ== + endpoint: http://localhost:${wiremock.server.port}/services/RequestsDbAdapter + spring: + endpoint: http://localhost:${wiremock.server.port} + network: + endpoint: http://localhost:30253/services/NetworkAdapter + rest: + endpoint: http://localhost:30253/services/rest/v1/networks + openecomp: + db: + endpoint: http://localhost:${wiremock.server.port}/services/RequestsDbAdapter + po: + auth: 757A94191D685FD2092AC1490730A4FC + password: 3141634BF7E070AA289CF2892C986C0B + sdnc: + endpoint: http://localhost:${wiremock.server.port}/adapters/SDNCAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/adapters/rest/v1/sdnc + timeout: PT150S + tenant: + endpoint: http://localhost:30253/services/TenantAdapter + vnf: + endpoint: http://localhost:${wiremock.server.port}/services/VnfAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/vnfs + volume-groups: + rest: + endpoint: http://localhost:30253/services/rest/v1/volume-groups + vnf-async: + endpoint: http://localhost:30253/services/VnfAdapterAsync + adiod: + vce: + service: + model: + invariant: + uuid: 1cc4e2e4-eb6e-404d-a66f-c8733cedcce8 + version: '5.0' + bpmn: + process: + historyTimeToLive: '30' + callbackRetryAttempts: '5' + catalog: + db: + endpoint: http://localhost:${wiremock.server.port}/ecomp/mso/catalog + spring: + endpoint: http://localhost:30258 + csi: + pwd: 4EA237303511EFBBC37F17A351562131 + sendmanagednetworkstatusnotification: + applicationname: NetworkManagementEthernetOverFiber + version: '212' + usrname: mso + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + default: + adapter: + namespace: http://com.att.mso + gateway: + service: + model: + name: HNGWaaS for DHV Test + healthcheck: + log: + debug: 'false' + infra: + customer: + id: testCustIdInfra + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + oam: + network: + role: + gateway: HngwOamNetVto.OAM + portal: HnportalOamNetVto.OAM + po: + timeout: PT60S + portal: + service: + model: + name: HNPortalaaS for DHV Test + request: + db: + endpoint: http://localhost:${wiremock.server.port}/ + rollback: 'true' + sdnc: + firewall: + yang: + model: + version: '2015-05-15' + password: 3141634BF7E070AA289CF2892C986C0B + timeout: + firewall: + minutes: '20' + ucpe: + async: + hours: '120' + minutes: '5' + site-name: CamundaEngine + sriov: + network: + role: + gateway1: HngwSriovProviderNet.SR_IOV_Provider2_1 + gateway2: HngwSriovProviderNet.SR_IOV_Provider2_2 + portal1: HnportalSriovProviderNet3.SR_IOV_Provider2_1 + portal2: HnportalSriovProviderNet3.SR_IOV_Provider2_2 + workflow: + sdnc: + replication: + delay: PT5S + aai: + distribution: + delay: PT5S + CreateGenericVNFV1: + aai: + volume-group: + uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group + DHVCreateService: + aai: + customer: + uri: /aai/v9/business/customers/customer + createvce: + delay: + seconds: '1' + default: + aai: + version: '8' + cloud-region: + version: '9' + generic-vnf: + version: '9' + v11: + customer: + uri: /aai/v11/business/customers/customer + generic-query: + uri: /aai/v11/search/generic-query + generic-vnf: + uri: /aai/v11/network/generic-vnfs/generic-vnf + l3-network: + uri: /aai/v11/network/l3-networks/l3-network + network-policy: + uri: /aai/v11/network/network-policies/network-policy + nodes-query: + uri: /aai/v11/search/nodes-query + route-table-reference: + uri: /aai/v11/network/route-table-references/route-table-reference + tenant: + uri: /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + vce: + uri: /aai/v11/network/vces/vce + vpn-binding: + uri: /aai/v11/network/vpn-bindings/vpn-binding + v8: + configuration: + uri: /aai/v11/network/configurations/configuration + customer: + uri: /aai/v8/business/customers/customer + generic-query: + uri: /aai/v8/search/generic-query + l3-network: + uri: /aai/v8/network/l3-networks/l3-network + network-policy: + uri: /aai/v8/network/network-policies/network-policy + nodes-query: + uri: /aai/v8/search/nodes-query + route-table-reference: + uri: /aai/v8/network/route-table-references/route-table-reference + tenant: + uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + vce: + uri: /aai/v8/network/vces/vce + vpn-binding: + uri: /aai/v8/network/vpn-bindings/vpn-binding + v9: + cloud-region: + uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic + generic-vnf: + uri: /aai/v9/network/generic-vnfs/generic-vnf + retry: + attempts: '1' + deleteCinderVolumeV1: + aai: + volume-group: + uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group + global: + default: + aai: + namespace: http://org.openecomp.aai.inventory/ + l3ToHigherLayerAddBonding: + model: + invariantid: 50359538-066f-4a8d-807f-f2bc8eaa79dc + name: WAN Bonding v0.1 + version: '0.1' + versionid: 52dbec20-47aa-42e4-936c-331d8e350d44 + message: + endpoint: http://localhost:30252/mso/WorkflowMessage + notification: + name: GenericNotificationServiceATT + sdncadapter: + callback: http://localhost:${wiremock.server.port}/mso/SDNCAdapterCallbackService + vnfadapter: + create: + callback: http://localhost:30253/mso/vnfAdapterNotify + delete: + callback: http://localhost:30253/mso/vnfAdapterNotify + query: + callback: http://localhost:30253/mso/vnfAdapterNotify + rollback: + callback: http://localhost:30253/mso/vnfAdapterNotify +policy: + auth: Basic dGVzdHBkcDphbHBoYTEyMw== + client: + auth: Basic bTAzNzQzOnBvbGljeVIwY2sk + endpoint: https://localhost:8081/pdp/api/ + environment: TEST +sdnc: + auth: Basic YWRtaW46YWRtaW4= + host: https://localhost:8443 + path: /restconf/operations/GENERIC-RESOURCE-API +sdno: + health-check: + dmaap: + password: eHQ1cUJrOUc + publisher: + topic: com.att.sdno.test-health-diagnostic-v02 + subscriber: + topic: com.att.sdno.test-health-diagnostic-v02 + username: testuser +pnf: + dmaap: + host: + port: +sniro: + conductor: + host: http://localhost:30253 + uri: /release + manager: + timeout: PT30M + host: http://localhost:${wiremock.server.port} + uri.v1: /sniro/api/v2/placement + uri.v2: /sniro/api/placement/v2 + headers.auth: Basic dGVzdDp0ZXN0cHdk + headers.patchVersion: 1 + headers.minorVersion: 1 + headers.latestVersion: 2 +server: + port: 8080 + tomcat: + max-threads: 50 + # ssl: + # key-store: /app/msoClientKeyStore.jks + # key-store-password: mso4you + # key-store-type: JKS + # trust-store: /app/msoTrustStore.jks + # trust-store-password: mso_Domain2.0_4you +spring: + h2: + console: + enabled: true + path: /h2 + datasource: + url: jdbc:h2:mem:AZ;;DB_CLOSE_ON_EXIT=FALSE + username: sa + password: sa + driverClassName: org.h2.Driver + security: + usercredentials: + - + username: test + password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu' + role: BPMN-Client +# Hibernate +hibernate: + dialect: org.hibernate.dialect.MySQL5Dialect + show_sql: false + +management: + security: + enabled: false + +security: + basic: + enabled: false + +appc: + client: + topic: + read: + name: APPC-TEST-AMDOCS2 + timeout: 360000 + write: APPC-TEST-AMDOCS1-IST + response: + timeout: 360000 + key: LSl8QKolmKcC0yJR + secret: lgjXraD1HutKxv8jEN6tVouu + service: ueb + poolMembers: localhost:3904,localhost:3904,localhost:3904 \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/applicationContext_forPnfTesting.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/applicationContext_forPnfTesting.xml new file mode 100644 index 0000000000..72462bd092 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/applicationContext_forPnfTesting.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/catalogDBClientProps.properties b/bpmn/so-bpmn-infrastructure-common/src/test/resources/catalogDBClientProps.properties new file mode 100644 index 0000000000..bca529f960 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/catalogDBClientProps.properties @@ -0,0 +1 @@ +catalog.db.endpoint= http://localhost: \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/logback-test.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..38a2ef6ef5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/logback-test.xml @@ -0,0 +1,44 @@ + + + + + + + %d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level + %logger{1024} - %msg%n + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/requestsDBClientProps.properties b/bpmn/so-bpmn-infrastructure-common/src/test/resources/requestsDBClientProps.properties new file mode 100644 index 0000000000..758a6edd97 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/requestsDBClientProps.properties @@ -0,0 +1 @@ +requests.db.endpoint= http://localhost: \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/stubprocess/GenericStub.bpmn b/bpmn/so-bpmn-infrastructure-common/src/test/resources/stubprocess/GenericStub.bpmn new file mode 100644 index 0000000000..66f458425e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/stubprocess/GenericStub.bpmn @@ -0,0 +1,35 @@ + + + + + SequenceFlow_0tyavm9 + + + SequenceFlow_0tyavm9 + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml new file mode 100644 index 0000000000..ee51ecd66e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml @@ -0,0 +1,286 @@ + + + org.onap.so + bpmn + 1.3.0-SNAPSHOT + + 4.0.0 + so-bpmn-infrastructure-flows + jar + + 7.8.0 + + + + + org.apache.cxf + cxf-codegen-plugin + 2.5.2 + + + org.apache.maven.plugins + maven-dependency-plugin + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.apache.maven.plugins + + + maven-antrun-plugin + + + [1.3,) + + + run + + + + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + default-test + + test + + + + **/AllTestsTestSuite.java + + + + + tasks-test + + test + + + + **/AllTasksTestsTestSuite.java + + + + + bpmn-test + + test + + + + **/AllBPMNTestSuites.java + + + + + + + + ${project.artifactId}-${project.version} + + + + + + org.camunda.bpm + camunda-bom + ${camunda.version} + import + pom + + + + + + + org.camunda.bpm.springboot + camunda-bpm-spring-boot-starter + 2.3.0 + test + + + org.springframework.boot + spring-boot-starter-web + test + + + org.springframework.boot + spring-boot-starter-data-jpa + true + + + org.apache.cxf + cxf-spring-boot-starter-jaxws + 3.1.12 + + + org.apache.cxf + cxf-spring-boot-starter-jaxrs + 3.1.12 + + + org.apache.cxf + cxf-rt-rs-service-description-swagger + 3.1.11 + + + com.h2database + h2 + test + + + com.google.guava + guava + 22.0 + + + org.mockito + mockito-core + 1.10.19 + test + + + com.fasterxml.uuid + java-uuid-generator + + + org.codehaus.groovy + groovy-all + + + org.apache.commons + commons-lang3 + 3.4 + + + org.onap.so + MSOCoreBPMN + ${project.version} + + + org.onap.so + MSOCommonBPMN + ${project.version} + + + org.onap.so + MSOCoreBPMN + ${project.version} + tests + test + + + javax.ws.rs + javax.ws.rs-api + 2.0 + + + org.onap.so + MSORESTClient + ${project.version} + + + org.camunda.spin + camunda-spin-core + test + + + org.camunda.spin + camunda-spin-dataformat-all + test + + + camunda-spin-dataformat-all + org.camunda.spin + test + + + org.camunda.bpm + camunda-engine-plugin-spin + + + + org.camunda.bpm + camunda-engine-plugin-connect + test + + + javax.annotation + javax.annotation-api + 1.3 + + + org.onap.msb.java-sdk + msb-java-sdk + 1.0.0 + + + com.eclipsesource.jaxrs + jersey-all + + + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + ch.qos.logback + logback-classic + + + ch.qos.logback + logback-core + + + org.slf4j + slf4j-api + + + org.mariadb.jdbc + mariadb-java-client + + + ch.vorburger.mariaDB4j + mariaDB4j + 2.2.3 + test + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy new file mode 100644 index 0000000000..880a44c1b2 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy @@ -0,0 +1,256 @@ +/*- + * ============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.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.CompareModelsResult +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger + +import groovy.json.* + + +/** + * This groovy class supports the CompareModelofE2EServiceInstance.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId + * @param - subscriptionServiceType + * @param - serviceInstanceId + * @param - modelInvariantIdTarget + * @param - modelVersionIdTarget + + * + * Outputs: + * @param - WorkflowException + */ +public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CompareModelofE2EServiceInstance.class); + + String Prefix="CMPMDSI_" + private static final String DebugFlag = "isDebugEnabled" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + + public void preProcessRequest (DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + String msg = "" + + msoLogger.trace("preProcessRequest Request ") + + try { + // check for incoming json message/input + String siRequest = execution.getVariable("bpmnRequest") + msoLogger.debug(siRequest) + + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + msoLogger.info("Input Request:" + siRequest + " reqId:" + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + msg = "Input serviceInstanceId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + utils.log("INFO", msg, isDebugEnabled) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //subscriptionServiceType + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("serviceType", subscriptionServiceType) + } + + //modelInvariantIdTarget + String modelInvariantIdTarget = jsonUtil.getJsonValue(siRequest, "modelInvariantIdTarget") + if (isBlank(modelInvariantIdTarget)) { + msg = "Input modelInvariantIdTarget' is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("modelInvariantIdTarget", modelInvariantIdTarget) + } + + //modelVersionIdTarget + String modelVersionIdTarget = jsonUtil.getJsonValue(siRequest, "modelVersionIdTarget") + if (isBlank(modelVersionIdTarget)) { + msg = "Input modelVersionIdTarget is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("modelVersionIdTarget", modelVersionIdTarget) + } + + execution.setVariable("operationType", "CompareModel") + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest ") + } + + public void sendSyncResponse (DelegateExecution execution) { + msoLogger.trace("sendSyncResponse ") + + try { + CompareModelsResult compareModelsResult = execution.getVariable("compareModelsResult") + + // RESTResponse (for API Handler(APIH) Reply Task) + String syncResponse = compareModelsResult.toJsonStringNoRootName() + msoLogger.info(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String msg = "Exception in sendSyncResponse: " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit sendSyncResopnse ") + } + + public void sendSyncError (DelegateExecution execution) { + msoLogger.trace("sendSyncError ") + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${MsoUtils.xmlEscape(errorMessage)} + 7000 + """ + + msoLogger.debug(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + msoLogger.info(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + + } + + public void prepareCompletionRequest (DelegateExecution execution) { + msoLogger.trace("prepareCompletion ") + + try { + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String msoCompletionRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + COMPAREMODEL + ${MsoUtils.xmlEscape(source)} + + E2E Service Instance Compare model successfully. + CompareModelofE2EServiceInstance + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("completionRequest", xmlMsoCompletionRequest) + msoLogger.info(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit prepareCompletionRequest ") + } + + public void prepareFalloutRequest(DelegateExecution execution){ + msoLogger.trace("prepareFalloutRequest ") + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + msoLogger.info(" Input Workflow Exception: " + wfex.toString()) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + COMPAREMODEL + ${MsoUtils.xmlEscape(source)} + """ + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + msoLogger.info("Exception prepareFalloutRequest:" + ex.getMessage()) + String errorException = " Bpmn error encountered in CompareModelofE2EServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + COMPAREMODEL + UUI + + + ${MsoUtils.xmlEscape(errorException)} + 7000 + + """ + + execution.setVariable("falloutRequest", falloutRequest) + } + msoLogger.trace("Exit prepareFalloutRequest ") + } + +} + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy new file mode 100644 index 0000000000..1034fa2d4d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy @@ -0,0 +1,331 @@ +/*- + * ============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.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.springframework.web.util.UriUtils + +import groovy.json.* + +/** + * This groovy class supports the CreateServiceInstance.bpmn process. + * AlaCarte flow for 1702 ServiceInstance Create + * + */ +public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor { + String Prefix="CRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateCustomE2EServiceInstance.class); + + + public void preProcessRequest (DelegateExecution execution) { + msoLogger.trace("start preProcessRequest") + execution.setVariable("prefix",Prefix) + String msg = "" + + try { + String siRequest = execution.getVariable("bpmnRequest") + msoLogger.debug(siRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + serviceInstanceId = UUID.randomUUID().toString() + } + msoLogger.debug("Generated new Service Instance:" + serviceInstanceId) + serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestInfo + execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")) + execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")) + execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback")) + String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") + if (isBlank(productFamilyId)) + { + msg = "Input productFamilyId is null" + msoLogger.debug(msg) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("productFamilyId", productFamilyId) + } + + //modelInfo + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else + { + execution.setVariable("serviceModelInfo", serviceModelInfo) + } + + msoLogger.debug("modelInfo: " + serviceModelInfo) + + //requestParameters + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } + + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(siRequest) + + //InputParams + def userParamsList = reqMap.requestDetails?.requestParameters?.userParams + + Map inputMap = [:] + if (userParamsList) { + for (def i=0; i inputMap.put(param.key, param.value)} + } + } + + msoLogger.debug("User Input Parameters map: " + inputMap.toString()) + execution.setVariable("serviceInputParams", inputMap) + execution.setVariable("uuiRequest", inputMap.get("UUIRequest")) + execution.setVariable("mso.adapters.openecomp.db.endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + //TODO + //execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams")) + //execution.setVariable("failExists", true) + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("finished preProcessRequest") + } + + public void sendSyncResponse (DelegateExecution execution) { + msoLogger.trace("start sendSyncResponse") + try { + String operationId = execution.getVariable("operationId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + // RESTResponse for API Handler (APIH) Reply Task + String createServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim() + msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) + sendWorkflowResponse(execution, 202, createServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("finished sendSyncResponse") + } + + + public void sendSyncError (DelegateExecution execution) { + msoLogger.trace("start sendSyncError") + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${MsoUtils.xmlEscape(errorMessage)} + 7000 + """ + + msoLogger.debug(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + msoLogger.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + msoLogger.trace("finished sendSyncError") + } + + public void prepareCompletionRequest (DelegateExecution execution) { + msoLogger.trace("start prepareCompletionRequest") + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String source = execution.getVariable("source") + + String msoCompletionRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + CREATE + ${MsoUtils.xmlEscape(source)} + + Service Instance was created successfully. + ${MsoUtils.xmlEscape(serviceInstanceId)} + CreateGenericALaCarteServiceInstance + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("completionRequest", xmlMsoCompletionRequest) + msoLogger.debug("Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("finished prepareCompletionRequest") + } + + public void prepareFalloutRequest(DelegateExecution execution){ + msoLogger.trace("start prepareFalloutRequest") + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + msoLogger.debug("Input Workflow Exception: " + wfex.toString()) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + CREATE + ${MsoUtils.xmlEscape(source)} + """ + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) + String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + CREATE + UUI + + + ${MsoUtils.xmlEscape(errorException)} + 7000 + + """ + + execution.setVariable("falloutRequest", falloutRequest) + } + msoLogger.trace("finished prepareFalloutRequest") + } + + /** + * Init the service Operation Status + */ + public void prepareInitServiceOperationStatus(DelegateExecution execution){ + msoLogger.trace("start prepareInitServiceOperationStatus") + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = UUID.randomUUID().toString() + String operationType = "CREATE" + String userId = "" + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service creation" + msoLogger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution) + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + msoLogger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) + + String payload = + """ + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(operationId)} + ${MsoUtils.xmlEscape(operationType)} + ${MsoUtils.xmlEscape(userId)} + ${MsoUtils.xmlEscape(result)} + ${MsoUtils.xmlEscape(operationContent)} + ${MsoUtils.xmlEscape(progress)} + ${MsoUtils.xmlEscape(reason)} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) + msoLogger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload) + msoLogger.debug("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) + } + msoLogger.trace("finished prepareInitServiceOperationStatus") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy new file mode 100644 index 0000000000..4405718c57 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy @@ -0,0 +1,357 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONException; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger +import org.springframework.web.util.UriUtils + +import groovy.json.* + +/** + * This groovy class supports the CreateGenericALaCarteServiceInstance.bpmn process. + * AlaCarte flow for 1702 ServiceInstance Create + * + */ +public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskProcessor { + String Prefix="CRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateGenericALaCarteServiceInstance.class); + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + + try { + + String siRequest = execution.getVariable("bpmnRequest") + msoLogger.debug(siRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + serviceInstanceId = UUID.randomUUID().toString() + msoLogger.debug("Generated new Service Instance ID:" + serviceInstanceId) + } else { + msoLogger.debug("Using provided Service Instance ID:" + serviceInstanceId) + } + + serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestInfo + execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")) + execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")) + execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback")) + String productFamilyId = null; + try { + productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") + } catch (JSONException e) { + productFamilyId = null; + } + if (isBlank(productFamilyId)) + { + msg = "Input productFamilyId is null" + msoLogger.debug(msg) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("productFamilyId", productFamilyId) + } + + //modelInfo + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else + { + execution.setVariable("serviceModelInfo", serviceModelInfo) + } + + msoLogger.debug("modelInfo" + serviceModelInfo) + + //requestParameters + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } + + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(siRequest) + + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map inputMap = [:] + if (userParams) { + userParams.each { + userParam -> inputMap.put(userParam.name, userParam.value.toString()) + } + } + + msoLogger.debug("User Input Parameters map: " + userParams.toString()) + execution.setVariable("serviceInputParams", inputMap) + + //TODO + //execution.setVariable("failExists", true) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest") + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Start sendSyncResponse") + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + // RESTResponse for API Handler (APIH) Reply Task + String createServiceRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) + sendWorkflowResponse(execution, 202, createServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit sendSyncResopnse") + } + + + public void sendSyncError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Start sendSyncError") + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${MsoUtils.xmlEscape(errorMessage)} + 7000 + """ + + msoLogger.debug(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + + } + + // ******************************* + // + // ******************************* + public void prepareDecomposeService(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Inside prepareDecomposeService of CreateGenericALaCarteServiceInstance ") + try { + String siRequest = execution.getVariable("bpmnRequest") + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + execution.setVariable("serviceModelInfo", serviceModelInfo) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + msoLogger.trace("Completed prepareDecomposeService of CreateGenericALaCarteServiceInstance") + } + + + // ******************************* + // + // ******************************* + public void prepareCreateServiceInstance(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + msoLogger.trace("Inside prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance") + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + def siRequest = execution.getVariable("bpmnRequest") + Map reqMap = jsonSlurper.parseText(siRequest) + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + Map inputMap = [:] + if (userParams != null) { + userParams.each { + userParam -> inputMap.put(userParam.name, userParam.value) + } + } + + msoLogger.debug("User Input Parameters map: " + userParams.toString()) + execution.setVariable("serviceInputParams", inputMap) + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + serviceDecomposition.getServiceInstance().setInstanceId(serviceInstanceId) + + String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName") + serviceDecomposition.getServiceInstance().setInstanceName(serviceInstanceName) + execution.setVariable("serviceInstanceName", serviceInstanceName) + execution.setVariable("serviceDecomposition", serviceDecomposition) + execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString()) + msoLogger.debug("serviceDecomposition.serviceInstanceName: " + serviceDecomposition.getServiceInstance().getInstanceName()) + + msoLogger.trace("Completed prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ") + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + + public void prepareCompletionRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("prepareCompletion *** ") + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String source = execution.getVariable("source") + + String msoCompletionRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + CREATE + ${MsoUtils.xmlEscape(source)} + + Service Instance was created successfully. + ${MsoUtils.xmlEscape(serviceInstanceId)} + CreateGenericALaCarteServiceInstance + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("completionRequest", xmlMsoCompletionRequest) + msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit prepareCompletionRequest") + } + + public void prepareFalloutRequest(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("prepareFalloutRequest") + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + msoLogger.debug(" Input Workflow Exception: " + wfex.toString()) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + CREATE + ${MsoUtils.xmlEscape(source)} + """ + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) + String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + CREATE + VID + + + ${MsoUtils.xmlEscape(errorException)} + 7000 + + """ + + execution.setVariable("falloutRequest", falloutRequest) + } + msoLogger.trace("Exit prepareFalloutRequest") + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy new file mode 100644 index 0000000000..d665de2ba7 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy @@ -0,0 +1,455 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger + +import groovy.json.* + +/** + * This groovy class supports the CreateNetworkInstance.bpmn process. + * + */ +public class CreateNetworkInstance extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateNetworkInstance.class); + + String Prefix="CRENI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public InitializeProcessVariables(DelegateExecution execution){ + + execution.setVariable(Prefix + "source", "") + execution.setVariable(Prefix + "Success", false) + + execution.setVariable(Prefix + "CompleteMsoProcessRequest", "") + execution.setVariable(Prefix + "FalloutHandlerRequest", "") + execution.setVariable(Prefix + "isSilentSuccess", false) + + } + + + /** + * This method is executed during the preProcessRequest task of the CreateNetworkInstance.bpmn process. + * @param execution + */ + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the CreateNetworkInstance.bpmn process. + * @param execution + */ + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Start preProcessRequest") + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + String sdncVersion = execution.getVariable("sdncVersion") + if (sdncVersion == null || sdncVersion == '1610') { + // 'a-la-cart' default, sdncVersion = '1610' + execution.setVariable("sdncVersion", "1610") + String bpmnRequest = execution.getVariable("bpmnRequest") + // set 'disableRollback' + if (bpmnRequest != null) { + String disableRollback = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.requestInfo.suppressRollback") + if (disableRollback != null) { + execution.setVariable("disableRollback", disableRollback) + msoLogger.debug("Received 'suppressRollback': " + disableRollback ) + } else { + execution.setVariable("disableRollback", false) + } + msoLogger.debug(" Set 'disableRollback' : " + execution.getVariable("disableRollback") ) + } else { + String dataErrorMessage = " Invalid 'bpmnRequest' request." + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + } else { + // 'macro' TEST ONLY, sdncVersion = '1702' + msoLogger.debug(" 'disableRollback' : " + execution.getVariable("disableRollback") ) + } + + // get/set 'msoRequestId' and 'mso-request-id' + String requestId = execution.getVariable("msoRequestId") + if (requestId != null) { + execution.setVariable("mso-request-id", requestId) + } else { + requestId = execution.getVariable("mso-request-id") + } + execution.setVariable(Prefix + "requestId", requestId) + + // get/set 'requestId' + if (execution.getVariable("requestId") == null) { + execution.setVariable("requestId", requestId) + } + + //Place holder for additional code. + + // TODO ??? + // userParams??? 1) pre-loads indicator, 2) 'auto-activation' + // Tag/Value parameters + // + // Map: 'networkInputParams': 'auto-activation'' + // Sample format? + // "requestParameters": { + // "userParams": [ + // { + // "name": "someUserParam1", + // "value": "someValue1" + // } + // ] + // } + // + // String userParams = //use json util to extract "userParams"// + // execution.setVariable("networkInputParams", userParams) + // else: execution.setVariable("networkInputParams", null) + // + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex){ + sendSyncError(execution) + // caught exception + String exceptionMessage = "Exception Encountered in CreateNetworkInstance, PreProcessRequest() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Start sendSyncResponse") + + try { + String requestId = execution.getVariable("mso-request-id") + + // RESTResponse (for API Handler (APIH) Reply Task) + String createNetworkRestRequest = """{"requestReferences":{"instanceId":"","requestId":"${requestId}"}}""".trim() + + msoLogger.debug(" sendSyncResponse to APIH - " + "\n" + createNetworkRestRequest) + sendWorkflowResponse(execution, 202, createNetworkRestRequest) + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in CreateNetworkInstance flow. sendSyncResponse() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + } + + + public void getNetworkModelInfo (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Start getNetworkModelInfo") + + try { + + // For Ala-Carte (sdnc = 1610): + // 1. the Network ModelInfo is expected to be sent + // via requestDetails.modelInfo (modelType = network). + // 2. the Service ModelInfo is expected to be sent but will be IGNORE + // via requestDetails.relatedInstanceList.relatedInstance.modelInfo (modelType = service) + + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in CreateNetworkInstance flow. getNetworkModelInfo() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + public void sendSyncError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Start sendSyncError") + + try { + + String requestId = execution.getVariable("mso-request-id") + + // REST Error (for API Handler (APIH) Reply Task) + String syncError = """{"requestReferences":{"instanceId":"","requestId":"${requestId}"}}""".trim() + + sendWorkflowResponse(execution, 500, syncError) + + } catch (Exception ex) { + msoLogger.debug(" Bpmn error encountered in CreateNetworkInstance flow. sendSyncError() - " + ex.getMessage()) + } + + } + + public void prepareDBRequestError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + try { + msoLogger.trace("Start prepareDBRequestError") + + // set DB Header Authorization + setBasicDBAuthHeader(execution, isDebugEnabled) + + String statusMessage = "" + WorkflowException wfe = null + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + wfe = execution.getVariable("WorkflowException") + statusMessage = wfe.getErrorMessage() + } + + String requestId = execution.getVariable(Prefix + "requestId") + String networkName = execution.getVariable("networkName") !=null ? execution.getVariable("networkName") : "" + String networkId = execution.getVariable("networkId") !=null ? execution.getVariable("networkId") : "" + String dbRequest = + """ + + + + ${MsoUtils.xmlEscape(requestId)} + BPMN + ${MsoUtils.xmlEscape(statusMessage)} + + FAILED + <network-id>${MsoUtils.xmlEscape(networkId)}</network-id><network-name>${MsoUtils.xmlEscape(networkName)}</network-names> + + + """ + + execution.setVariable(Prefix + "createDBRequest", dbRequest) + msoLogger.debug(" DB Adapter Request - " + "\n" + dbRequest) + msoLogger.debug(dbRequest) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. prepareDBRequestError() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareCompletion (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Start prepareCompletion") + + try { + + String requestId = execution.getVariable("mso-request-id") + String source = execution.getVariable(Prefix + "source") + + String msoCompletionRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + CREATE + VID + + Network has been created successfully. + BPMN Network action: CREATE + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + // normal path + execution.setVariable(Prefix + "Success", true) + execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) + msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. prepareCompletion() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + + } + + + + + // ************************************************** + // Post or Validate Response Section + // ************************************************** + + public void postProcessResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Start postProcessResponse") + + try { + + if (execution.getVariable("CMSO_ResponseCode") == "200") { + execution.setVariable(Prefix + "Success", true) + msoLogger.trace("CreateNetworkInstance Success ****") + // Place holder for additional code. + + } else { + execution.setVariable(Prefix + "Success", false) + msoLogger.trace("CreateNetworkInstance Failed in CompletionMsoProces flow!. ****") + + } + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + // ******************************* + // Build Error Section + // ******************************* + + public void processRollbackData (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Start processRollbackData") + + try { + //execution.getVariable("orchestrationStatus") + //execution.getVariable("networkId") + //execution.getVariable("networkName") + //networkOutputParams + //rollbackData + //rolledBack + + } catch (Exception ex) { + msoLogger.debug(" Bpmn error encountered in CreateNetworkInstance flow. callDBCatalog() - " + ex.getMessage()) + } + + } + + // Prepare for FalloutHandler + public void buildErrorResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + msoLogger.debug("DB updateInfraRequest ResponseCode: " + execution.getVariable(Prefix + "dbReturnCode")) + msoLogger.debug("DB updateInfraRequest Response: " + execution.getVariable(Prefix + "createDBResponse")) + + msoLogger.trace("Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler.") + + String falloutHandlerRequest = "" + String requestId = execution.getVariable("mso-request-id") + + try { + + WorkflowException wfe = execution.getVariable("WorkflowException") + String errorCode = String.valueOf(wfe.getErrorCode()) + String errorMessage = wfe.getErrorMessage() + falloutHandlerRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + CREATE + VID + + + ${MsoUtils.xmlEscape(errorMessage)} + ${MsoUtils.xmlEscape(errorCode)} + + """ + + msoLogger.debug(falloutHandlerRequest) + execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) + msoLogger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest) + + } catch (Exception ex) { + String errorException = " Bpmn error encountered in CreateNetworkInstance flow. FalloutHandlerRequest, buildErrorResponse()" + msoLogger.debug("Exception error in CreateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage()) + falloutHandlerRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + CREATE + VID + + + ${MsoUtils.xmlEscape(errorException)} + 7000 + + """ + + execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) + msoLogger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest) + + } + + } + + public void processJavaException(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + try{ + msoLogger.debug("Caught a Java Exception in " + Prefix) + msoLogger.debug("Started processJavaException Method") + msoLogger.debug("Variables List: " + execution.getVariables()) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + + }catch(Exception e){ + msoLogger.debug("Caught Exception during processJavaException Method: " + e) + execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) + } + msoLogger.debug("Completed processJavaException Method in " + Prefix) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy new file mode 100644 index 0000000000..1c0975f8c4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -0,0 +1,327 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - 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.bpmn.infrastructure.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject +import org.json.XML; +import org.onap.so.bpmn.common.recipe.ResourceInput; +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger + +import groovy.json.* + +/** + * This groovy class supports the CreateSDNCCNetworkResource.bpmn process. + * flow for SDNC Network Resource Create + */ +public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateSDNCNetworkResource.class); + + String Prefix="CRESDNCRES_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest(DelegateExecution execution){ + msoLogger.trace("Started preProcessRequest ") + try { + + //get bpmn inputs from resource request. + String requestId = execution.getVariable("mso-request-id") + String requestAction = execution.getVariable("requestAction") + msoLogger.info("The requestAction is: " + requestAction) + String recipeParamsFromRequest = execution.getVariable("recipeParams") + msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) + String resourceInput = execution.getVariable("resourceInput") + msoLogger.info("The resourceInput is: " + resourceInput) + //Get ResourceInput Object + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) + execution.setVariable(Prefix + "resourceInput", resourceInputObj) + + //Deal with recipeParams + String recipeParamsFromWf = execution.getVariable("recipeParamXsd") + String resourceName = resourceInputObj.getResourceInstanceName() + //For sdnc requestAction default is "createNetworkInstance" + String operationType = "Network" + if(!StringUtils.isBlank(recipeParamsFromRequest)){ + //the operationType from worflow(first node) is second priority. + operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") + } + if(!StringUtils.isBlank(recipeParamsFromWf)){ + //the operationType from worflow(first node) is highest priority. + operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") + } + + + //For sdnc, generate svc_action and request_action + String sdnc_svcAction = "create" + if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "overlay")){ + //This will be resolved in R3. + sdnc_svcAction ="activate" + operationType = "NCINetwork" + } + if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "underlay")){ + //This will be resolved in R3. + operationType ="Network" + } + String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" + execution.setVariable(Prefix + "svcAction", sdnc_svcAction) + execution.setVariable(Prefix + "requestAction", sdnc_requestAction) + execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) + execution.setVariable("mso-request-id", requestId) + execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) + //TODO Here build networkrequest + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + String customizeResourceParam(String netowrkInputParametersJson) { + List> paramList = new ArrayList(); + JSONObject jsonObject = new JSONObject(netowrkInputParametersJson); + Iterator iterator = jsonObject.keys(); + while (iterator.hasNext()) { + String key = iterator.next(); + HashMap hashMap = new HashMap(); + hashMap.put("name", key); + hashMap.put("value", jsonObject.get(key)) + paramList.add(hashMap) + } + Map>> paramMap = new HashMap(); + paramMap.put("param", paramList); + + return new JSONObject(paramMap).toString(); + } + + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + public void prepareSDNCRequest (DelegateExecution execution) { + msoLogger.trace("Started prepareSDNCRequest ") + + try { + // get variables + String sdnc_svcAction = execution.getVariable(Prefix + "svcAction") + String sdnc_requestAction = execution.getVariable(Prefix + "requestAction") + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + + String hdrRequestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + String source = execution.getVariable("source") + String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String serviceType = resourceInputObj.getServiceType() + String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() + String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() + String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion() + String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName() + String globalCustomerId = resourceInputObj.getGlobalSubscriberId() + String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid(); + String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() + String resourceInputPrameters = resourceInputObj.getResourceParameters() + String netowrkInputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") + //here convert json string to xml string + String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(netowrkInputParametersJson))) + // 1. prepare assign topology via SDNC Adapter SUBFLOW call + String sndcTopologyCreateRequest = + """ + + ${MsoUtils.xmlEscape(hdrRequestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(sdnc_svcAction)} + network-topology-operation + sdncCallback + generic-resource + + + + ${MsoUtils.xmlEscape(hdrRequestId)} + ${MsoUtils.xmlEscape(sdnc_requestAction)} + ${MsoUtils.xmlEscape(source)} + + + + + + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(serviceType)} + + ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} + ${MsoUtils.xmlEscape(serviceModelUuid)} + ${MsoUtils.xmlEscape(serviceModelVersion)} + ${MsoUtils.xmlEscape(serviceModelName)} + + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(globalCustomerId)} + + + + ${MsoUtils.xmlEscape(modelInvariantUuid)} + ${MsoUtils.xmlEscape(modelCustomizationUuid)} + ${MsoUtils.xmlEscape(modelUuid)} + ${MsoUtils.xmlEscape(modelVersion)} + ${MsoUtils.xmlEscape(modelName)} + + + + ${MsoUtils.xmlEscape(netowrkInputParameters)} + + + """.trim() + + String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) + msoLogger.debug(sndcTopologyCreateRequesAsString) + execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString) + msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + msoLogger.trace("Exit prepareSDNCRequest ") + } + + private void setProgressUpdateVariables(DelegateExecution execution, String body) { + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } + + public void prepareUpdateBeforeCreateSDNCResource(DelegateExecution execution) { + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String operType = resourceInputObj.getOperationType() + String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String ServiceInstanceId = resourceInputObj.getServiceInstanceId() + String operationId = resourceInputObj.getOperationId() + String progress = "20" + String status = "processing" + String statusDescription = "SDCN resource creation invoked" + + execution.getVariable("operationId") + + String body = """ + + + + + ${MsoUtils.xmlEscape(operType)} + ${MsoUtils.xmlEscape(operationId)} + ${MsoUtils.xmlEscape(progress)} + ${MsoUtils.xmlEscape(resourceCustomizationUuid)} + ${MsoUtils.xmlEscape(ServiceInstanceId)} + ${MsoUtils.xmlEscape(status)} + ${MsoUtils.xmlEscape(statusDescription)} + + + """; + + setProgressUpdateVariables(execution, body) + + } + + public void prepareUpdateAfterCreateSDNCResource(execution) { + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String operType = resourceInputObj.getOperationType() + String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String ServiceInstanceId = resourceInputObj.getServiceInstanceId() + String operationId = resourceInputObj.getOperationId() + String progress = "100" + String status = "finished" + String statusDescription = "SDCN resource creation completed" + + execution.getVariable("operationId") + + String body = """ + + + + + ${MsoUtils.xmlEscape(operType)} + ${MsoUtils.xmlEscape(operationId)} + ${MsoUtils.xmlEscape(progress)} + ${MsoUtils.xmlEscape(resourceCustomizationUuid)} + ${MsoUtils.xmlEscape(ServiceInstanceId)} + ${MsoUtils.xmlEscape(status)} + ${MsoUtils.xmlEscape(statusDescription)} + + + """; + + setProgressUpdateVariables(execution, body) + } + + public void postCreateSDNCCall(DelegateExecution execution){ + msoLogger.trace("Started prepareSDNCRequest ") + String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode") + String responseObj = execution.getVariable(Prefix + "SuccessIndicator") + + msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) + msoLogger.trace("Exit prepareSDNCRequest ") + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + String operationStatus = "finished" + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy new file mode 100644 index 0000000000..26f12831bd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy @@ -0,0 +1,326 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - 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.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.json.JsonUtils +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 groovy.json.* + +/** + * This groovy class supports the DoCreateVFCNetworkServiceInstance.bpmn process. + * flow for VFC Network Service Create + */ +public class CreateVFCNSResource extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVFCNSResource.class); + + + String vfcUrl = "/vfc/rest/v1/vfcadapter" + + String host = "http://mso.mso.testlab.openecomp.org:8080" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + /** + * CreateVFCNSResource + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + public void preProcessRequest (DelegateExecution execution) { + JsonUtils jsonUtil = new JsonUtils() + + String msg = "" + msoLogger.trace("preProcessRequest() ") + try { + //deal with nsName and Description + String resourceInput = execution.getVariable("resourceInput") + + String resourceParameters = jsonUtil.getJsonValue(resourceInput, "resourceParameters") + // get service name + String resourceName = jsonUtil.getJsonValue(resourceInput, "resourceInstanceName") + execution.setVariable("nsServiceName", resourceName) + + String nsServiceDescription = execution.getVariable("nsServiceDescription") + msoLogger.info("nsServiceName:" + resourceName + " nsServiceDescription:" + nsServiceDescription) + //deal with operation key + String globalSubscriberId = jsonUtil.getJsonValue(resourceInput, "globalSubscriberId") + msoLogger.info("globalSubscriberId:" + globalSubscriberId) + //set local globalSubscriberId variable + execution.setVariable("globalSubscriberId", globalSubscriberId); + String serviceType = execution.getVariable("serviceType") + msoLogger.info("serviceType:" + serviceType) + + String serviceId = execution.getVariable("serviceInstanceId") + msoLogger.info("serviceId:" + serviceId) + + String operationId = jsonUtil.getJsonValue(resourceInput, "operationId") + msoLogger.info("serviceType:" + serviceType) + + String nodeTemplateUUID = jsonUtil.getJsonValue(resourceInput, "resourceModelInfo.modelCustomizationUuid") + String nsServiceModelUUID = jsonUtil.getJsonValue(resourceParameters, "requestInputs.nsd0_providing_service_uuid") + msoLogger.info("nodeTemplateUUID:" + nodeTemplateUUID) + /* + * segmentInformation needed as a object of segment + * { + * "domain":"", + * "nodeTemplateName":"", + * "nodeType":"", + * "nsParameters":{ + * //this is the nsParameters sent to VF-C + * } + * } + */ + String nsParameters = jsonUtil.getJsonValue(resourceInput, "resourceParameters") + msoLogger.info("nsParameters:" + nsParameters) + String nsOperationKey = """{ + "globalSubscriberId":"${globalSubscriberId}", + "serviceType":"${serviceType}", + "serviceId":"${serviceId}", + "operationId":"${operationId}", + "nodeTemplateUUID":"${nodeTemplateUUID}" + }""" + execution.setVariable("nsOperationKey", nsOperationKey); + execution.setVariable("nsParameters", nsParameters) + execution.setVariable("nsServiceModelUUID", nsServiceModelUUID); + + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest ") + } + + /** + * create NS task + */ + public void createNetworkService(DelegateExecution execution) { + msoLogger.trace("createNetworkService ") + String nsOperationKey = execution.getVariable("nsOperationKey"); + String nsServiceModelUUID = execution.getVariable("nsServiceModelUUID"); + String nsParameters = execution.getVariable("nsParameters"); + String nsServiceName = execution.getVariable("nsServiceName") + String nsServiceDescription = execution.getVariable("nsServiceDescription") + String locationConstraints = jsonUtil.getJsonValue(nsParameters, "locationConstraints") + String requestInputs = jsonUtil.getJsonValue(nsParameters, "requestInputs") + String reqBody ="""{ + "nsServiceName":"${nsServiceName}", + "nsServiceDescription":"${nsServiceDescription}", + "nsServiceModelUUID":"${nsServiceModelUUID}", + "nsOperationKey":${nsOperationKey}, + "nsParameters":{ + "locationConstraints":${locationConstraints}, + "additionalParamForNs":${requestInputs} + } + }""" + APIResponse apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody) + String returnCode = apiResponse.getStatusCode() + String aaiResponseAsString = apiResponse.getResponseBodyAsString() + String nsInstanceId = ""; + if(returnCode== "200" || returnCode == "201"){ + nsInstanceId = jsonUtil.getJsonValue(aaiResponseAsString, "nsInstanceId") + } + execution.setVariable("nsInstanceId", nsInstanceId) + msoLogger.info(" *****Exit createNetworkService *****") + } + + /** + * instantiate NS task + */ + public void instantiateNetworkService(DelegateExecution execution) { + msoLogger.trace("instantiateNetworkService ") + String nsOperationKey = execution.getVariable("nsOperationKey"); + String nsParameters = execution.getVariable("nsParameters"); + String nsServiceName = execution.getVariable("nsServiceName") + String nsServiceDescription = execution.getVariable("nsServiceDescription") + String reqBody ="""{ + "nsServiceName":"${nsServiceName}", + "nsServiceDescription":"${nsServiceDescription}", + "nsOperationKey":${nsOperationKey}, + "nsParameters":${nsParameters} + }""" + String nsInstanceId = execution.getVariable("nsInstanceId") + String url = host + vfcUrl + "/ns/" +nsInstanceId + "/instantiate" + APIResponse apiResponse = postRequest(execution, url, reqBody) + String returnCode = apiResponse.getStatusCode() + String aaiResponseAsString = apiResponse.getResponseBodyAsString() + String jobId = ""; + if(returnCode== "200"|| returnCode == "201"){ + jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") + } + execution.setVariable("jobId", jobId) + msoLogger.info(" *****Exit instantiateNetworkService *****") + } + + /** + * query NS task + */ + public void queryNSProgress(DelegateExecution execution) { + msoLogger.trace("queryNSProgress ") + String jobId = execution.getVariable("jobId") + String nsOperationKey = execution.getVariable("nsOperationKey"); + String url = host + vfcUrl + "/jobs/" + jobId + APIResponse apiResponse = postRequest(execution, url, nsOperationKey) + String returnCode = apiResponse.getStatusCode() + String aaiResponseAsString = apiResponse.getResponseBodyAsString() + String operationStatus = "error" + if(returnCode== "200"|| returnCode == "201"){ + operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status") + } + execution.setVariable("operationStatus", operationStatus) + msoLogger.info(" *****Exit queryNSProgress *****") + } + + /** + * delay 5 sec + */ + public void timeDelay(DelegateExecution execution) { + try { + Thread.sleep(5000); + } catch(InterruptedException e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Time Delay exception" + e , "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + } + } + + /** + * finish NS task + */ + public void addNSRelationship(DelegateExecution execution) { + msoLogger.trace("addNSRelationship ") + String nsInstanceId = execution.getVariable("nsInstanceId") + if(nsInstanceId == null || nsInstanceId == ""){ + msoLogger.info(" create NS failed, so do not need to add relationship") + return + } + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String serviceId = execution.getVariable("serviceInstanceId") + String addRelationPayload = """ + service-instance + /aai/v11/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${nsInstanceId} + + customer.global-customer-id + ${MsoUtils.xmlEscape(globalSubscriberId)} + + + service-subscription.service-type + ${MsoUtils.xmlEscape(serviceType)} + + + service-instance.service-instance-id + ${MsoUtils.xmlEscape(nsInstanceId)} + + """ + String endpoint = execution.getVariable("URN_aai_endpoint") + msoLogger.info("Add Relationship req:\n" + addRelationPayload) + String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + serviceId + "/relationship-list/relationship" + APIResponse aaiRsp = executeAAIPutCall(execution, url, addRelationPayload) + msoLogger.info("aai response status code:" + aaiRsp.getStatusCode()) + msoLogger.info("aai response content:" + aaiRsp.getResponseBodyAsString()) + msoLogger.info(" *****Exit addNSRelationship *****") + } + + public APIResponse executeAAIPutCall(DelegateExecution execution, String url, String payload){ + msoLogger.trace("Started Execute AAI Put Process ") + APIResponse apiResponse = null + try{ + String uuid = utils.getRequestID() + msoLogger.info("Generated uuid is: " + uuid) + msoLogger.info("URL to be used is: " + url) + String userName = execution.getVariable("URN_aai_auth") + String password = execution.getVariable("URN_mso_msoKey") + String basicAuthCred = utils.getBasicAuth(userName,password) + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml"); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.httpPut(payload) + msoLogger.trace("Completed Execute AAI Put Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Put Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + throw new BpmnError("MSOWorkflowException") + } + return apiResponse + } + + /** + * post request + * url: the url of the request + * requestBody: the body of the request + */ + private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ + msoLogger.trace("Started Execute VFC adapter Post Process ") + msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody) + APIResponse apiResponse = null + try{ + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); + apiResponse = client.httpPost(requestBody) + msoLogger.info("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString()) + msoLogger.trace("Completed Execute VF-C adapter Post Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + throw new BpmnError("MSOWorkflowException") + } + return apiResponse + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + String operationStatus = execution.getVariable("operationStatus") + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy new file mode 100644 index 0000000000..308c93540f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy @@ -0,0 +1,620 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.v12.GenericVnf; +import org.onap.appc.client.lcm.model.Action +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils; +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.infrastructure.aai.AAICreateResources; +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +import groovy.json.JsonOutput +import groovy.json.JsonSlurper + +public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVfModuleInfra.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + private AbstractServiceTaskProcessor taskProcessor + + public SDNCAdapterUtils(AbstractServiceTaskProcessor taskProcessor) { + this.taskProcessor = taskProcessor + } + + /** + * Validates the request message and sets up the workflow. + * @param execution the execution + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.debug('Started ' + method) + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + + execution.setVariable("CVFMI_sentSyncResponse", false) + + def prefix = 'CVFMI_' + execution.setVariable('prefix', prefix) + execution.setVariable("isVidRequest", "false") + + def rollbackData = execution.getVariable("RollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData() + } + execution.setVariable("RollbackData", rollbackData) + + def incomingRequest = execution.getVariable('bpmnRequest') + msoLogger.debug("Incoming Infra Request: " + incomingRequest) + msoLogger.debug("CreateVfModule Infra incoming Request: " + incomingRequest) + + setBasicDBAuthHeader(execution, isDebugLogEnabled) + + // check if request is xml or json + try { + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + Map reqMap = jsonSlurper.parseText(incomingRequest) + msoLogger.debug(" Request is in JSON format.") + + def serviceInstanceId = execution.getVariable('serviceInstanceId') + def vnfId = execution.getVariable('vnfId') + + execution.setVariable(prefix + 'serviceInstanceId', serviceInstanceId) + execution.setVariable(prefix+'vnfId', vnfId) + execution.setVariable("isVidRequest", "true") + + def vnfName = '' + def asdcServiceModelVersion = '' + def serviceModelInfo = null + def vnfModelInfo = null + + def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList + + if (relatedInstanceList != null) { + relatedInstanceList.each { + if (it.relatedInstance.modelInfo?.modelType == 'service') { + asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion + serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) + + } + if (it.relatedInstance.modelInfo.modelType == 'vnf') { + vnfName = it.relatedInstance.instanceName ?: '' + vnfModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) + } + } + } + + execution.setVariable(prefix + 'vnfName', vnfName) + execution.setVariable(prefix + 'asdcServiceModelVersion', asdcServiceModelVersion) + execution.setVariable(prefix + 'serviceModelInfo', serviceModelInfo) + execution.setVariable(prefix + 'vnfModelInfo', vnfModelInfo) + + + def vnfType = execution.getVariable('vnfType') + execution.setVariable(prefix + 'vnfType', vnfType) + def vfModuleId = execution.getVariable('vfModuleId') + execution.setVariable(prefix + 'vfModuleId', vfModuleId) + def volumeGroupId = execution.getVariable('volumeGroupId') + execution.setVariable(prefix + 'volumeGroupId', volumeGroupId) + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map userParamsMap = [:] + if (userParams != null) { + userParams.each { userParam -> + userParamsMap.put(userParam.name, userParam.value.toString()) + } + } + + msoLogger.debug('Processed user params: ' + userParamsMap) + + execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap) + + def isBaseVfModule = "false" + if (execution.getVariable('isBaseVfModule') == true) { + isBaseVfModule = "true" + } + + execution.setVariable(prefix + 'isBaseVfModule', isBaseVfModule) + + def requestId = execution.getVariable("mso-request-id") + execution.setVariable(prefix + 'requestId', requestId) + + def vfModuleModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo) + execution.setVariable(prefix + 'vfModuleModelInfo', vfModuleModelInfo) + + def suppressRollback = reqMap.requestDetails?.requestInfo?.suppressRollback + + + def backoutOnFailure = "" + if(suppressRollback != null){ + if ( suppressRollback == true) { + backoutOnFailure = "false" + } else if ( suppressRollback == false) { + backoutOnFailure = "true" + } + } + + execution.setVariable('disableRollback', suppressRollback) + + def vfModuleName = reqMap.requestDetails?.requestInfo?.instanceName ?: null + execution.setVariable(prefix + 'vfModuleName', vfModuleName) + + def serviceId = reqMap.requestDetails?.requestParameters?.serviceId ?: '' + execution.setVariable(prefix + 'serviceId', serviceId) + + def usePreload = reqMap.requestDetails?.requestParameters?.usePreload + execution.setVariable(prefix + 'usePreload', usePreload) + + // This is aLaCarte flow, so aLaCarte flag is always on + execution.setVariable(prefix + 'aLaCarte', true) + + def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration + def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId + execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId) + def tenantId = cloudConfiguration.tenantId + execution.setVariable(prefix + 'tenantId', tenantId) + + def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: '' + execution.setVariable(prefix + 'globalSubscriberId', globalSubscriberId) + + execution.setVariable(prefix + 'sdncVersion', '1702') + + execution.setVariable("CreateVfModuleInfraSuccessIndicator", false) + execution.setVariable("RollbackCompleted", false) + + execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) + + + def source = reqMap.requestDetails?.requestInfo?.source + execution.setVariable("CVFMI_source", source) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + CREATE + ${MsoUtils.xmlEscape(source)} + """ + + execution.setVariable("CVFMI_requestInfo", requestInfo) + + //backoutOnFailure + + execution.setVariable("CVFMI_originalWorkflowException", null) + + + def newVfModuleId = UUID.randomUUID().toString() + execution.setVariable("newVfModuleId", newVfModuleId) + execution.setVariable(prefix + 'vfModuleId', newVfModuleId) + execution.setVariable('actionHealthCheck', Action.HealthCheck) + execution.setVariable('actionConfigScaleOut', Action.ConfigScaleOut) + execution.setVariable('controllerType', "APPC") + def controllerType = execution.getVariable('controllerType') + execution.setVariable(prefix + 'controllerType', controllerType) + execution.setVariable('healthCheckIndex0', 0) + + msoLogger.debug('RequestInfo: ' + execution.getVariable("CVFMI_requestInfo")) + + msoLogger.debug('rollbackEnabled: ' + execution.getVariable("CVFMI_rollbackEnabled")) + + msoLogger.trace('Finished ' + method) + } catch (BpmnError bpmnError) { + throw bpmnError + } + catch(groovy.json.JsonException je) { + msoLogger.debug("Request is not in JSON format.") + exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest") + } + catch(Exception e) { + String restFaultMessage = e.getMessage() + //execution.setVariable("CVFMODVOL2_RESTFault", restFaultMessage) + //execution.setVariable("CVFMODVOL2_isDataOk", false) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest") + } + + } + + /** + * Validates a workflow response. + * @param execution the execution + * @param responseVar the execution variable in which the response is stored + * @param responseCodeVar the execution variable in which the response code is stored + * @param errorResponseVar the execution variable in which the error response is stored + */ + public void validateWorkflowResponse(DelegateExecution execution, String responseVar, + String responseCodeVar, String errorResponseVar) { + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, responseVar, responseCodeVar, errorResponseVar) + } + + + /** + * Sends the empty, synchronous response back to the API Handler. + * @param execution the execution + */ + public void sendResponse(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendResponse(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Started ' + method) + + try { + def requestInfo = execution.getVariable('CVFMI_requestInfo') + def requestId = execution.getVariable('CVFMI_requestId') + def source = execution.getVariable('CVFMI_source') + + // RESTResponse (for API Handler (APIH) Reply Task) + def newVfModuleId = execution.getVariable("newVfModuleId") + String synchResponse = """{"requestReferences":{"instanceId":"${newVfModuleId}","requestId":"${requestId}"}}""".trim() + + sendWorkflowResponse(execution, 200, synchResponse) + + execution.setVariable("CVFMI_sentSyncResponse", true) + msoLogger.debug("CreateVfModule Infra Response: " + synchResponse) + msoLogger.trace('Finished ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered ", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) + } + } + + /** + * Query AAI for vnf orchestration status to determine if health check and config scaling should be run + */ + public void queryAAIForVnfOrchestrationStatus(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + def vnfId = execution.getVariable("CVFMI_vnfId") + execution.setVariable("runHealthCheck", false); + execution.setVariable("runConfigScaleOut", false); + AAICreateResources aaiCreateResources = new AAICreateResources(); + Optional vnf = aaiCreateResources.getVnfInstance(vnfId); + if(vnf.isPresent()){ + def vnfOrchestrationStatus = vnf.get().getOrchestrationStatus(); + if("active".equalsIgnoreCase(vnfOrchestrationStatus)){ + execution.setVariable("runHealthCheck", false); + execution.setVariable("runConfigScaleOut", true); + } + } + } + + /** + * Retrieve data for ConfigScaleOut from SDNC topology + */ + + public void retreiveConfigScaleOutData(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + def vfModuleId = execution.getVariable("CVFMI_vfModuleId") + String ipAddress = ""; + String oamIpAddress = ""; + String vnfHostIpAddress = ""; + + String vnfGetSDNC = execution.getVariable("DCVFM_getSDNCAdapterResponse"); + + String data = utils.getNodeXml(vnfGetSDNC, "response-data") + data = data.replaceAll("<", "<") + data = data.replaceAll(">", ">") + + InputSource source = new InputSource(new StringReader(data)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document responseXml = docBuilder.parse(source) + + NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters") + for (int z = 0; z < paramsList.getLength(); z++) { + Node node = paramsList.item(z) + Element eElement = (Element) node + String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name") + String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value") + if (vnfParameterName.equals("vlb_private_ip_1")) { + vnfHostIpAddress = vnfParameterValue + } + else if (vnfParameterName.equals("vdns_private_ip_0")) { + ipAddress = vnfParameterValue + } + else if (vnfParameterName.equals("vdns_private_ip_1")) { + oamIpAddress = vnfParameterValue + } + } + + String payload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"" + vnfHostIpAddress + "\",\"vf-module-id\":\"" + vfModuleId + "\"},\"configuration-parameters\":{\"ip-addr\":\"" + ipAddress +"\", \"oam-ip-addr\":\""+ oamIpAddress +"\",\"enabled\":\"true\"}}" + execution.setVariable("payload", payload); + } + + /** + * + * @param execution the execution + */ + public void postProcessResponse(DelegateExecution execution){ + msoLogger.trace("STARTED PostProcessResponse Process") + try{ + def requestInfo = execution.getVariable("CVFMI_requestInfo") + def action = utils.getNodeText(requestInfo, "action") + + msoLogger.debug("requestInfo is: " + requestInfo) + msoLogger.debug("action is: " + action) + + String payload = + """ + + ${requestInfo} + + Vf Module has been created successfully. + BPMN + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_SuccessFlag", true) + execution.setVariable("CVFMI_msoCompletionRequest", payload) + msoLogger.debug("CreateVfModuleInfra completion request: " + payload) + msoLogger.debug("Outgoing MsoCompletionRequest: \n" + payload) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Occured Processing PostProcessResponse - " + "\n", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("CVFMI_ErrorResponse", "Error Occured during PostProcessResponse Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED PostProcessResponse Process") + } + + + + + + /** + * Validates the request, request id and service instance id. If a problem is found, + * a WorkflowException is generated and an MSOWorkflowException event is thrown. This + * method also sets up the log context for the workflow. + * @param execution the execution + * @return the validated request + */ + public String validateInfraRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.validateInfraRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Started ' + method) + + String processKey = getProcessKey(execution); + def prefix = execution.getVariable("prefix") + + if (prefix == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null") + } + + try { + def request = execution.getVariable(prefix + 'Request') + + if (request == null) { + request = execution.getVariable(processKey + 'Request') + + if (request == null) { + request = execution.getVariable('bpmnRequest') + } + + setVariable(execution, processKey + 'Request', null); + setVariable(execution, 'bpmnRequest', null); + setVariable(execution, prefix + 'Request', request); + } + + if (request == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null") + } + + /* + + def requestId = execution.getVariable("mso-request-id") + + if (requestId == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request has no mso-request-id") + } + + setVariable(execution, prefix + 'requestId', requestId) + + def serviceInstanceId = execution.getVariable("mso-service-instance-id") + + if (serviceInstanceId == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id") + } + + utils.logContext(requestId, serviceInstanceId) + */ + msoLogger.debug("CreateVfModule incoming request: " + request) + msoLogger.debug('Incoming message: ' + System.lineSeparator() + request) + msoLogger.trace('Finished ' + method) + return request + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") + } + } + + public void prepareUpdateInfraRequest(DelegateExecution execution){ + msoLogger.trace("STARTED prepareUpdateInfraRequest Process") + try{ + + String requestInfo = execution.getVariable("CVFMI_requestInfo") + def aicCloudRegion = execution.getVariable("CVFMI_lcpCloudRegionId") + def tenantId = execution.getVariable("CVFMI_tenantId") + def requestId = utils.getNodeText(requestInfo, "request-id") + def vnfId = execution.getVariable("CVFMI_vnfId") + def vfModuleId = execution.getVariable("CVFMI_vfModuleId") + // vfModuleName may be generated by DoCreateVfModule subprocess if it is not specified on the input + def vfModuleName = execution.getVariable("CVFMI_vfModuleName") + + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution) + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + msoLogger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) + + String payload = + """ + + + + ${MsoUtils.xmlEscape(requestId)} + BPMN + VF Module successfully created + + COMPLETE + 100 + <vnf-outputs xmlns="http://org.onap/so/infra/vnf-request/v1" xmlns:aetgt="http://org.onap/so/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"><vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id><vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id></vnf-outputs> + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(vfModuleName)} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateInfraRequest", payload) + msoLogger.debug("Outgoing UpdateInfraRequest: \n" + payload) + msoLogger.debug("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing prepareUpdateInfraRequest.", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED prepareUpdateInfraRequest Process") + } + + /** + * Builds a "FalloutHandler" request and stores it in the specified execution variable. + * + * @param execution the execution + * @param resultVar the execution variable in which the result will be stored + */ + public void falloutHandlerPrep(DelegateExecution execution, String resultVar) { + def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + + 'execution=' + execution.getId() + + ', resultVar=' + resultVar + + ')' + + msoLogger.trace("Started " + method) + + + try { + def WorkflowException workflowException = execution.getVariable("WorkflowException") + def requestInformation = execution.getVariable("CVFMI_requestInfo") + def errorResponseCode = workflowException.getErrorCode() + def errorResponseMsg = workflowException.getErrorMessage() + def encErrorResponseMsg = "" + if (errorResponseMsg != null) { + encErrorResponseMsg = errorResponseMsg + } + + String content = """ + + ${requestInformation} + + ${MsoUtils.xmlEscape(encErrorResponseMsg)} + ${MsoUtils.xmlEscape(errorResponseCode)} + + + """ + + msoLogger.debug("CONTENT before translation: " + content) + content = utils.formatXml(content) + msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + msoLogger.debug("CreateVfModuleInfra FallOutHander Request: " + content) + execution.setVariable(resultVar, content) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') + } + } + + public void logAndSaveOriginalException(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.validateRollbackResponse(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + logWorkflowException(execution, 'CreateVfModuleInfra caught an event') + saveWorkflowException(execution, 'CVFMI_originalWorkflowException') + } + + public void validateRollbackResponse(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.validateRollbackResponse(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + def originalException = execution.getVariable("CVFMI_originalWorkflowException") + execution.setVariable("WorkflowException", originalException) + + execution.setVariable("RollbackCompleted", true) + + } + + public void sendErrorResponse(DelegateExecution execution){ + msoLogger.trace("STARTED CreateVfModulenfra sendErrorResponse Process") + try { + def sentSyncResponse = execution.getVariable("CVFMI_sentSyncResponse") + if(sentSyncResponse == false){ + WorkflowException wfex = execution.getVariable("WorkflowException") + String response = exceptionUtil.buildErrorResponseXml(wfex) + msoLogger.debug(response) + sendWorkflowResponse(execution, 500, response) + }else{ + msoLogger.debug("Not Sending Error Response. Sync Response Already Sent") + } + + } catch (Exception ex) { + msoLogger.debug("Error Occured in CreateVfModuleInfra sendErrorResponse Process " + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVfModuleInfra sendErrorResponse Process") + } + msoLogger.trace("COMPLETED CreateVfModuleInfra sendErrorResponse Process") + } + + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy new file mode 100644 index 0000000000..aa569655f4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy @@ -0,0 +1,356 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.common.scripts.AaiUtil; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse + +import groovy.json.JsonOutput +import groovy.json.JsonSlurper + +class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVfModuleVolumeInfraV1.class); + public static final String prefix='CVMVINFRAV1_' + + /** + * Perform initial processing, such as request validation, initialization of variables, etc. + * * @param execution + */ + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + setBasicDBAuthHeader(execution, isDebugEnabled) + preProcessRequest(execution, isDebugEnabled) + } + + + /** + * Perform initial processing, such as request validation, initialization of variables, etc. + * @param execution + * @param isDebugEnabled + */ + public void preProcessRequest (DelegateExecution execution, isDebugEnabled) { + + execution.setVariable("prefix",prefix) + setSuccessIndicator(execution, false) + execution.setVariable(prefix+'syncResponseSent', false) + + String createVolumeIncoming = validateRequest(execution, 'vnfId') + msoLogger.debug(createVolumeIncoming) + + try { + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(createVolumeIncoming) + setupVariables(execution, reqMap, isDebugEnabled) + msoLogger.debug("XML request:\n" + createVolumeIncoming) + } + catch(groovy.json.JsonException je) { + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, 'Request is not a valid JSON document') + } + + // For rollback in this flow + setBasicDBAuthHeader(execution, isDebugEnabled) + setRollbackEnabled(execution, isDebugEnabled) + } + + + /** + * Set up variables that will be passed to the BB DoCreatevfModuleVolume flow + * @param execution + * @param requestMap + * @param serviceInstanceId + * @param isDebugLogEnabled + */ + public void setupVariables(DelegateExecution execution, Map requestMap, isDebugLogEnabled) { + + def jsonOutput = new JsonOutput() + + // volumeGroupId - is generated + String volumeGroupId = UUID.randomUUID() + execution.setVariable('volumeGroupId', volumeGroupId) + msoLogger.debug("Generated volumeGroupId: " + volumeGroupId) + + // volumeGroupName + def volGrpName = requestMap.requestDetails.requestInfo?.instanceName ?: '' + execution.setVariable('volumeGroupName', volGrpName) + + // vfModuleModelInfo + def vfModuleModelInfo = jsonOutput.toJson(requestMap.requestDetails?.modelInfo) + execution.setVariable('vfModuleModelInfo', vfModuleModelInfo) + + // lcpCloudRegonId + def lcpCloudRegionId = requestMap.requestDetails.cloudConfiguration.lcpCloudRegionId + execution.setVariable('lcpCloudRegionId', lcpCloudRegionId) + + // tenant + def tenantId = requestMap.requestDetails.cloudConfiguration.tenantId + execution.setVariable('tenantId', tenantId) + + // source + def source = requestMap.requestDetails.requestInfo.source + execution.setVariable(prefix+'source', source) + + // vnfType and asdcServiceModelVersion + + def serviceName = '' + def asdcServiceModelVersion = '' + def modelCustomizationName = '' + + def relatedInstanceList = requestMap.requestDetails.relatedInstanceList + relatedInstanceList.each { + if (it.relatedInstance.modelInfo?.modelType == 'service') { + serviceName = it.relatedInstance.modelInfo?.modelName + asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion + } + if (it.relatedInstance.modelInfo?.modelType == 'vnf') { + modelCustomizationName = it.relatedInstance.modelInfo?.modelCustomizationName + } + } + + def vnfType = serviceName + '/' + modelCustomizationName + execution.setVariable('vnfType', vnfType) + execution.setVariable('asdcServiceModelVersion', asdcServiceModelVersion) + + // vfModuleInputParams + def userParams = requestMap.requestDetails?.requestParameters?.userParams + Map vfModuleInputMap = [:] + + userParams.each { userParam -> + vfModuleInputMap.put(userParam.name, userParam.value.toString()) + } + execution.setVariable('vfModuleInputParams', vfModuleInputMap) + + // disableRollback (true or false) + def disableRollback = requestMap.requestDetails.requestInfo.suppressRollback + execution.setVariable('disableRollback', disableRollback) + msoLogger.debug('disableRollback (suppressRollback) from request: ' + disableRollback) + + } + + + + public void sendSyncResponse (DelegateExecution execution, isDebugEnabled) { + def volumeGroupId = execution.getVariable('volumeGroupId') + def requestId = execution.getVariable("mso-request-id") + def serviceInstanceId = execution.getVariable("serviceInstanceId") + + String syncResponse = """{"requestReferences":{"instanceId":"${volumeGroupId}","requestId":"${requestId}"}}""".trim() + + msoLogger.debug("Sync Response: " + "\n" + syncResponse) + sendWorkflowResponse(execution, 200, syncResponse) + + execution.setVariable(prefix+'syncResponseSent', true) + } + + + public void sendSyncError (DelegateExecution execution, isDebugEnabled) { + WorkflowException we = execution.getVariable('WorkflowException') + def errorCode = we?.getErrorCode() + def errorMessage = we?.getErrorMessage() + //default to 400 since only invalid request will trigger this method + sendWorkflowResponse(execution, 400, errorMessage) + } + + + /** + * Create a WorkflowException + * @param execution + * @param isDebugEnabled + */ + public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage, isDebugEnabled) { + msoLogger.debug(errorMessage) + (new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage) + } + + + /** + * Build Infra DB Request + * @param execution + * @param isDebugEnabled + */ + public void prepareDbInfraSuccessRequest(DelegateExecution execution, isDebugEnabled) { + def dbVnfOutputs = execution.getVariable(prefix+'volumeOutputs') + def requestId = execution.getVariable('mso-request-id') + def statusMessage = "VolumeGroup successfully created." + def requestStatus = "COMPLETED" + def progress = "100" + + /* + from: $gVolumeGroup/aai:volume-group-id/text() + to: vnfreq:volume-outputs/vnfreq:volume-group-id + */ + // for now assume, generated volumeGroupId is accepted + def volumeGroupId = execution.getVariable(prefix+'volumeGroupId') + + String dbRequest = + """ + + + + ${MsoUtils.xmlEscape(requestId)} + BPMN + ${MsoUtils.xmlEscape(statusMessage)} + + ${MsoUtils.xmlEscape(requestStatus)} + ${MsoUtils.xmlEscape(progress)} + ${MsoUtils.xmlEscape(dbVnfOutputs)} + ${MsoUtils.xmlEscape(volumeGroupId)} + + + """ + + String buildDBRequestAsString = utils.formatXml(dbRequest) + execution.setVariable(prefix+"createDBRequest", buildDBRequestAsString) + msoLogger.debug("DB Infra Request: " + buildDBRequestAsString) + } + + + /** + * Build CommpleteMsoProcess request + * @param execution + * @param isDebugEnabled + */ + public void postProcessResponse (DelegateExecution execution, isDebugEnabled) { + + def dbReturnCode = execution.getVariable(prefix+'dbReturnCode') + def createDBResponse = execution.getVariable(prefix+'createDBResponse') + + msoLogger.debug('DB return code: ' + dbReturnCode) + msoLogger.debug('DB response: ' + createDBResponse) + + def requestId = execution.getVariable("mso-request-id") + def source = execution.getVariable(prefix+'source') + + String msoCompletionRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + CREATE + ${MsoUtils.xmlEscape(source)} + + Volume Group has been created successfully. + BPMN VF Module Volume action: CREATE + """ + + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable(prefix+'Success', true) + execution.setVariable(prefix+'CompleteMsoProcessRequest', xmlMsoCompletionRequest) + msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + + } + + public void prepareFalloutHandlerRequest(DelegateExecution execution, isDebugEnabled) { + + WorkflowException we = execution.getVariable('WorkflowException') + def errorCode = we?.getErrorCode() + def errorMessage = we?.getErrorMessage() + + def requestId = execution.getVariable("mso-request-id") + def source = execution.getVariable(prefix+'source') + + String falloutHandlerRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + CREATE + ${MsoUtils.xmlEscape(source)} + + + ${MsoUtils.xmlEscape(errorMessage)} + ${MsoUtils.xmlEscape(errorCode)} + + + """ + + // Format Response + String xmlHandlerRequest = utils.formatXml(falloutHandlerRequest) + + execution.setVariable(prefix+'FalloutHandlerRequest', xmlHandlerRequest) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Overall Error Response going to FalloutHandler", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "\n" + xmlHandlerRequest); + } + + + /** + * Query AAI service instance + * @param execution + * @param isDebugEnabled + */ + public void callRESTQueryAAIServiceInstance(DelegateExecution execution, isDebugEnabled) { + + def request = execution.getVariable(prefix+"Request") + def serviceInstanceId = utils.getNodeText(request, "service-instance-id") + + AaiUtil aaiUtil = new AaiUtil(this) + String aaiEndpoint = aaiUtil.getSearchNodesQueryEndpoint(execution) + + def String queryAAIRequest = aaiEndpoint + "?search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId + msoLogger.debug("AAI query service instance request: " + queryAAIRequest) + + APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIRequest) + + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msoLogger.debug("AAI query service instance return code: " + returnCode) + msoLogger.debug("AAI query service instance response: " + aaiResponseAsString) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + if (returnCode=='200') { + msoLogger.debug('Service instance ' + serviceInstanceId + ' found in AAI.') + } else { + if (returnCode=='404') { + def message = 'Service instance ' + serviceInstanceId + ' was not found in AAI. Return code: 404.' + msoLogger.debug(message) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, message) + } else { + WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + throw new BpmnError("MSOWorkflowException") + } + } + } + + public void logAndSaveOriginalException(DelegateExecution execution, isDebugLogEnabled) { + logWorkflowException(execution, 'CreateVfModuleVolumeInfraV1 caught an event') + saveWorkflowException(execution, 'CVMVINFRAV1_originalWorkflowException') + } + + public void validateRollbackResponse(DelegateExecution execution, isDebugLogEnabled) { + + def originalException = execution.getVariable("CVMVINFRAV1_originalWorkflowException") + execution.setVariable("WorkflowException", originalException) + execution.setVariable("RollbackCompleted", true) + + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy new file mode 100644 index 0000000000..9c25a57adc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy @@ -0,0 +1,542 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.json.JSONArray; +import org.json.JSONObject; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.onap.so.bpmn.common.scripts.CatalogDbUtils; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils; +import org.onap.so.bpmn.common.scripts.VidUtils; +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources; +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + +/** + * This class supports the CreateVnfInfra Flow + * with the creation of a generic vnf for + * infrastructure. + */ +class CreateVnfInfra extends AbstractServiceTaskProcessor { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVnfInfra.class); + + + String Prefix="CREVI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + CatalogDbUtils cutils = new CatalogDbUtils() + AAICreateResources aaiCR = new AAICreateResources() + + /** + * This method gets and validates the incoming + * request. + * + * @param - execution + * + */ + public void preProcessRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED CreateVnfInfra PreProcessRequest Process") + + setBasicDBAuthHeader(execution, isDebugEnabled) + execution.setVariable("CREVI_sentSyncResponse", false) + + try{ + // Get Variables + String createVnfRequest = execution.getVariable("bpmnRequest") + execution.setVariable("CREVI_createVnfRequest", createVnfRequest) + msoLogger.debug("Incoming CreateVnfInfra Request is: \n" + createVnfRequest) + + if(createVnfRequest != null){ + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("CREVI_requestId", requestId) + msoLogger.debug("Incoming Request Id is: " + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + execution.setVariable("CREVI_serviceInstanceId", serviceInstanceId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + + String vnfType = execution.getVariable("vnfType") + execution.setVariable("CREVI_vnfType", vnfType) + msoLogger.debug("Incoming Vnf Type is: " + vnfType) + + String vnfName = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.instanceName") + execution.setVariable("CREVI_vnfName", vnfName) + msoLogger.debug("Incoming Vnf Name is: " + vnfName) + + String serviceId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.productFamilyId") + execution.setVariable("CREVI_serviceId", serviceId) + msoLogger.debug("Incoming Service Id is: " + serviceId) + + String source = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.source") + execution.setVariable("CREVI_source", source) + msoLogger.debug("Incoming Source is: " + source) + + String suppressRollback = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.suppressRollback") + execution.setVariable("CREVI_suppressRollback", suppressRollback) + msoLogger.debug("Incoming Suppress Rollback is: " + suppressRollback) + + def vnfModelInfo = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo") + execution.setVariable("CREVI_vnfModelInfo", vnfModelInfo) + + String modelInvariantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelInvariantUuid") + execution.setVariable("CREVI_modelInvariantId", modelInvariantId) + msoLogger.debug("Incoming Invariant Id is: " + modelInvariantId) + + String modelVersion = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelVersion") + execution.setVariable("CREVI_modelVersion", modelVersion) + msoLogger.debug("Incoming Model Version is: " + modelVersion) + + def cloudConfiguration = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration") + execution.setVariable("CREVI_cloudConfiguration", cloudConfiguration) + + String cloudSiteId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId") + execution.setVariable("CREVI_cloudSiteId", cloudSiteId) + msoLogger.debug("Incoming Cloud Site Id is: " + cloudSiteId) + + String tenantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.tenantId") + execution.setVariable("CREVI_tenantId", tenantId) + msoLogger.debug("Incoming Tenant Id is: " + tenantId) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + CREATE + ${MsoUtils.xmlEscape(source)} + """ + + execution.setVariable("CREVI_requestInfo", requestInfo) + + //TODO: Orch Status - TBD, will come from SDN-C Response in 1702 + String orchStatus = "Created" + execution.setVariable("CREVI_orchStatus", orchStatus) + + //TODO: Equipment Role - Should come from SDN-C Response in 1702 + String equipmentRole = " " + execution.setVariable("CREVI_equipmentRole", equipmentRole) + + String vnfId = execution.getVariable("testVnfId") // for junits + if(isBlank(vnfId)){ + vnfId = UUID.randomUUID().toString() + msoLogger.debug("Generated Vnf Id is: " + vnfId) + } + execution.setVariable("CREVI_vnfId", vnfId) + + // Setting for Sub Flow Calls + execution.setVariable("CREVI_type", "generic-vnf") + execution.setVariable("GENGS_type", "service-instance") + + String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { + def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError); + + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + execution.setVariable("CREVI_sdncCallbackUrl", sdncCallbackUrl) + + def vnfInputParameters = null + try { + vnfInputParameters = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestParameters.userParams") + } + catch (Exception e) { + msoLogger.debug("userParams are not present in the request") + } + execution.setVariable("CREVI_vnfInputParameters", vnfInputParameters) + + + msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Bpmn Request is Null.") + } + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error Occurred in CreateVnfInfra PreProcessRequest method", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra PreProcessRequest") + + } + msoLogger.trace("COMPLETED CreateVnfInfra PreProcessRequest Process") + } + + public void sendSyncResponse (DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + + msoLogger.trace("STARTED CreateVnfInfra SendSyncResponse Process") + + try { + String requestId = execution.getVariable("CREVI_requestId") + String vnfId = execution.getVariable("CREVI_vnfId") + + String createVnfResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() + + msoLogger.debug("CreateVnfInfra Sync Response is: \n" + createVnfResponse) + + sendWorkflowResponse(execution, 202, createVnfResponse) + + execution.setVariable("CREVI_sentSyncResponse", true) + + } catch (Exception ex) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra SendSyncResponse Process") + + } + msoLogger.trace("COMPLETED CreateVnfInfra SendSyncResponse Process") + } + + + public void preProcessSDNCAssignRequest(DelegateExecution execution){ + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessSDNCAssignRequest") + def vnfId = execution.getVariable("CREVI_vnfId") + def serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId") + msoLogger.debug("NEW VNF ID: " + vnfId) + + try{ + //Build SDNC Request + + String assignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "assign") + + assignSDNCRequest = utils.formatXml(assignSDNCRequest) + execution.setVariable("CREVI_assignSDNCRequest", assignSDNCRequest) + msoLogger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCAssignRequest") + } + + public void preProcessSDNCActivateRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessSDNCActivateRequest Process") + try{ + String vnfId = execution.getVariable("CREVI_vnfId") + String serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId") + + String activateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "activate") + + execution.setVariable("CREVI_activateSDNCRequest", activateSDNCRequest) + msoLogger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCActivateRequest", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCActivateRequest Process") + } + + public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + def callbackURL = execution.getVariable("CREVI_sdncCallbackUrl") + def requestId = execution.getVariable("CREVI_requestId") + def serviceId = execution.getVariable("CREVI_serviceId") + def vnfType = execution.getVariable("CREVI_vnfType") + def vnfName = execution.getVariable("CREVI_vnfName") + def tenantId = execution.getVariable("CREVI_tenantId") + def source = execution.getVariable("CREVI_source") + def vnfId = execution.getVariable("CREVI_vnfId") + def cloudSiteId = execution.getVariable("CREVI_cloudSiteId") + + String sdncVNFParamsXml = "" + + if(execution.getVariable("CREVI_vnfParamsExistFlag") == true){ + sdncVNFParamsXml = buildSDNCParamsXml(execution) + }else{ + sdncVNFParamsXml = "" + } + + String sdncRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(svcInstId)} + ${MsoUtils.xmlEscape(action)} + vnf-topology-operation + ${MsoUtils.xmlEscape(callbackURL)} + + + + ${MsoUtils.xmlEscape(requestId)} + VNFActivateRequest + ${MsoUtils.xmlEscape(source)} + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(svcInstId)} + notsurewecare + + + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vnfName)} + ${MsoUtils.xmlEscape(vnfType)} + ${MsoUtils.xmlEscape(cloudSiteId)} + ${MsoUtils.xmlEscape(tenantId)} + ${sdncVNFParamsXml} + + + """ + + msoLogger.debug("sdncRequest: " + sdncRequest) + return sdncRequest + } + + public void validateSDNCResponse(DelegateExecution execution, String response, String method){ + execution.setVariable("prefix",Prefix) + msoLogger.debug("STARTED ValidateSDNCResponse Process") + + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + msoLogger.debug("workflowException: " + workflowException) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + msoLogger.debug("SDNCResponse: " + response) + + String sdncResponse = response + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msoLogger.trace("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) + + }else{ + msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + throw new BpmnError("MSOWorkflowException") + } + msoLogger.trace("COMPLETED ValidateSDNCResponse Process") + } + + public void prepareCompletionHandlerRequest(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + + msoLogger.trace("STARTED CreateVnfInfra PrepareCompletionHandlerRequest Process") + + try { + String requestInfo = execution.getVariable("CREVI_requestInfo") + String vnfId = execution.getVariable("CREVI_vnfId") + requestInfo = utils.removeXmlPreamble(requestInfo) + + String request = + """ + ${requestInfo} + Vnf has been created successfully. + ${MsoUtils.xmlEscape(vnfId)} + CreateVnfInfra + """ + + execution.setVariable("CREVI_completionHandlerRequest", request) + msoLogger.debug("Completion Handler Request is: " + request) + + execution.setVariable("WorkflowResponse", "Success") // for junits + + } catch (Exception ex) { + msoLogger.debug("Error Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process " + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process") + + } + msoLogger.trace("COMPLETED CreateVnfInfra PrepareCompletionHandlerRequest Process") + } + + public void sendErrorResponse(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + + msoLogger.trace("STARTED CreateVnfInfra sendErrorResponse Process") + try { + def sentSyncResponse = execution.getVariable("CREVI_sentSyncResponse") + if(sentSyncResponse == false){ + WorkflowException wfex = execution.getVariable("WorkflowException") + String response = exceptionUtil.buildErrorResponseXml(wfex) + + msoLogger.debug(response) + sendWorkflowResponse(execution, 500, response) + }else{ + msoLogger.debug("Not Sending Error Response. Sync Response Already Sent") + } + + } catch (Exception ex) { + msoLogger.debug("Error Occured in CreateVnfInfra sendErrorResponse Process " + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra sendErrorResponse Process") + + } + msoLogger.trace("COMPLETED CreateVnfInfra sendErrorResponse Process") + } + + public void prepareFalloutRequest(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + + msoLogger.trace("STARTED CreateVnfInfra prepareFalloutRequest Process") + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + msoLogger.debug(" Incoming Workflow Exception: " + wfex.toString()) + String requestInfo = execution.getVariable("CREVI_requestInfo") + msoLogger.debug(" Incoming Request Info: " + requestInfo) + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + + execution.setVariable("CREVI_falloutRequest", falloutRequest) + + + } catch (Exception ex) { + msoLogger.debug("Error Occured in CreateVnfInfra prepareFalloutRequest Process " + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra prepareFalloutRequest Process") + + } + msoLogger.trace("COMPLETED CreateVnfInfra prepareFalloutRequest Process") + } + + + public void queryCatalogDB (DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + + msoLogger.trace("STARTED CreateVnfInfra QueryCatalogDB Process") + try { + //Get Vnf Info + String vnfModelInfo = execution.getVariable("CREVI_vnfModelInfo") + String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationUuid") + msoLogger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid) + + JSONArray vnfs = cutils.getAllVnfsByVnfModelCustomizationUuid(execution, + vnfModelCustomizationUuid, "v2") + msoLogger.debug("obtained VNF list: " + vnfs) + + if (vnfs == null) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid) + } + + // Only one match here + JSONObject vnf = vnfs.get(0) + + if (vnf == null) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid) + } + + VnfResource vnfResource = new VnfResource() + String nfType = jsonUtil.getJsonValueForKey(vnf, "nfType") + vnfResource.setNfType(nfType) + String nfRole = jsonUtil.getJsonValueForKey(vnf, "nfRole") + vnfResource.setNfRole(nfRole) + String nfFunction = jsonUtil.getJsonValueForKey(vnf, "nfFunction") + vnfResource.setNfFunction(nfFunction) + String nfNamingCode = jsonUtil.getJsonValueForKey(vnf, "nfNamingCode") + vnfResource.setNfNamingCode(nfNamingCode) + + execution.setVariable("CREVI_vnfResourceDecomposition", vnfResource) + + }catch(BpmnError e) { + throw e; + }catch(Exception ex) { + msoLogger.debug("Error Occurred in CreateVnfInfra QueryCatalogDB Process " + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra QueryCatalogDB Process") + } + + + msoLogger.trace("COMPLETED CreateVnfInfra QueryCatalogDb Process") + } + public void createPlatform (DelegateExecution execution) { + msoLogger.trace("START createPlatform") + + String request = execution.getVariable("bpmnRequest") + String platformName = jsonUtil.getJsonValue(request, "requestDetails.platform.platformName") + String vnfId = execution.getVariable("CREVI_vnfId") + + msoLogger.debug("Platform NAME: " + platformName) + msoLogger.debug("VnfID: " + vnfId) + + if(platformName == null||platformName.equals("")){ + String msg = "Exception in createPlatform. platformName was not found in the request."; + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + }else{ + msoLogger.debug("platformName was found.") + try{ + AAICreateResources aaiCR = new AAICreateResources() + aaiCR.createAAIPlatform(platformName, vnfId) + }catch(Exception ex){ + String msg = "Exception in createPlatform. " + ex.getMessage(); + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + msoLogger.trace("Exit createPlatform") + } + public void createLineOfBusiness (DelegateExecution execution) { + msoLogger.trace("START createLineOfBusiness") + + String request = execution.getVariable("bpmnRequest") + String lineOfBusiness = jsonUtil.getJsonValue(request, "requestDetails.lineOfBusiness.lineOfBusinessName") + String vnfId = execution.getVariable("CREVI_vnfId") + + msoLogger.debug("LineOfBusiness NAME: " + lineOfBusiness) + msoLogger.debug("VnfID: " + vnfId) + + if(lineOfBusiness == null || lineOfBusiness.equals("")){ + msoLogger.debug("LineOfBusiness was not found. Continuing on with flow...") + }else{ + msoLogger.debug("LineOfBusiness was found.") + try{ + AAICreateResources aaiCR = new AAICreateResources() + aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId) + }catch(Exception ex){ + String msg = "Exception in LineOfBusiness. " + ex.getMessage(); + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + msoLogger.trace("Exit createLineOfBusiness") + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy new file mode 100644 index 0000000000..cbbc5189f4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy @@ -0,0 +1,386 @@ +/*- + + * ============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.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger +import org.springframework.web.util.UriUtils; + +import groovy.json.* + +/** + * This groovy class supports the DelE2EServiceInstance.bpmn process. + * + */ +public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor { + + String Prefix="DELSI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteCustomE2EServiceInstance.class); + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + + msoLogger.info("Starting preProcessRequest") + + try { + // check for incoming json message/input + String siRequest = execution.getVariable("bpmnRequest") + msoLogger.debug(siRequest) + + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + msoLogger.info("Input Request:" + siRequest + " reqId:" + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + msg = "Input serviceInstanceId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + + //requestInfo +// String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") +// if (isBlank(productFamilyId)) +// { +// msg = "Input productFamilyId is null" +// utils.log("INFO", msg, isDebugEnabled) +// //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) +// } else { +// execution.setVariable("productFamilyId", productFamilyId) +// } + String source = jsonUtil.getJsonValue(siRequest, "source") + execution.setVariable("source", source) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + msoLogger.info(msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestParameters + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + msoLogger.debug(msg) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } + String operationId = jsonUtil.getJsonValue(siRequest, "operationId") + execution.setVariable("operationId", operationId) + + execution.setVariable("operationType", "DELETE") + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest") + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Staring sendSyncResponse") + + try { + String operationId = execution.getVariable("operationId") + String syncResponse = """{"operationId":"${operationId}"}""".trim() + msoLogger.info("sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String msg = "Exception in sendSyncResponse: " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + msoLogger.trace("Exit sendSyncResopnse") + } + + public void sendSyncError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.info("Starting sendSyncError") + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${MsoUtils.xmlEscape(errorMessage)} + 7000 + """ + + msoLogger.info(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + msoLogger.info("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + + } + + public void prepareCompletionRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Starting prepareCompletion") + + try { + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String msoCompletionRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + DELETE + ${MsoUtils.xmlEscape(source)} + + E2E Service Instance was deleted successfully. + DeleteCustomE2EServiceInstance + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("completionRequest", xmlMsoCompletionRequest) + msoLogger.info(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit prepareCompletionRequest") + } + + public void prepareFalloutRequest(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Starting prepareFalloutRequest ") + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + msoLogger.info(" Input Workflow Exception: " + wfex.toString()) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + DELETE + ${MsoUtils.xmlEscape(source)} + """ + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + msoLogger.info("Exception prepareFalloutRequest:" + ex.getMessage()) + String errorException = " Bpmn error encountered in CreateServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + DELETE + VID + + + ${MsoUtils.xmlEscape(errorException)} + 7000 + + """ + + execution.setVariable("falloutRequest", falloutRequest) + } + msoLogger.trace("Exit prepareFalloutRequest") + } + + + // ******************************* + // Build DB request Section + // ******************************* + public void prepareDBRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + try { + msoLogger.info("Starting prepareDBRequest") + + String requestId = execution.getVariable("DELSI_requestId") + String statusMessage = "E2E Service Instance successfully deleted." + + //TODO - verify the format for Service Instance Delete, + String dbRequest = + """ + + + + ${MsoUtils.xmlEscape(requestId)} + BPMN + ${MsoUtils.xmlEscape(statusMessage)} + + COMPLETED + 100 + + + """ + + String buildDeleteDBRequestAsString = utils.formatXml(dbRequest) + execution.setVariable("DELSI_createDBRequest", buildDeleteDBRequestAsString) + msoLogger.info(buildDeleteDBRequestAsString) + + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteCustomE2EServiceInstance flow. Unexpected Error from method prepareDBRequest() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + // ******************************* + // Build Error Section + // ******************************* + public void prepareDBRequestError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Start prepareDBRequestError") + + try { + String requestId = execution.getVariable("DELSI_requestId") + String statusMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + statusMessage = wfe.getErrorMessage() + + } else { + statusMessage = "Encountered Error during DeleteCustomE2EServiceInstance proccessing. " + } + + //TODO - verify the format for Service Instance Create, + String dbRequest = + """ + + + + ${MsoUtils.xmlEscape(requestId)} + BPMN + ${MsoUtils.xmlEscape(statusMessage)} + + FAILED + + + """ + + String buildDBRequestAsString = utils.formatXml(dbRequest) + execution.setVariable("DELSI_createDBInfraErrorRequest", buildDBRequestAsString) + msoLogger.info(buildDBRequestAsString) + + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteCustomE2EServiceInstance flow. Unexpected Error from method prepareDBRequestError() - " + ex.getMessage() + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void processJavaException(DelegateExecution execution) { + //TODO: + } + + /** + * Init the service Operation Status + */ + public void prepareInitServiceOperationStatus(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String userId = "" + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service creation" + utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) + serviceId = UriUtils.encode(serviceId,"UTF-8") + + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + + String payload = + """ + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(operationId)} + DELETE + ${MsoUtils.xmlEscape(userId)} + ${MsoUtils.xmlEscape(result)} + ${MsoUtils.xmlEscape(operationContent)} + ${MsoUtils.xmlEscape(progress)} + ${MsoUtils.xmlEscape(reason)} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) + utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) + } + utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy new file mode 100644 index 0000000000..b43a96bdb0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy @@ -0,0 +1,362 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger + +import groovy.json.* + +/** + * This groovy class supports the DelServiceInstance.bpmn process. + * + */ +public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskProcessor { + + String Prefix="DELSI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteGenericALaCarteServiceInstance.class); + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + + msoLogger.trace("Start preProcessRequest") + + try { + // check for incoming json message/input + String siRequest = execution.getVariable("bpmnRequest") + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + msg = "Input serviceInstanceId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + //String xmlRequestDetails = vidUtils.getJsonRequestDetailstoXml(siRequest) + //execution.setVariable("requestDetails", xmlRequestDetails) + + //modelInfo + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + msoLogger.debug(msg) + } else + { + execution.setVariable("serviceModelInfo", serviceModelInfo) + //msoLogger.debug("modelInfo" + serviceModelInfo) + } + + //requestInfo + String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") + if (isBlank(productFamilyId)) + { + msg = "Input productFamilyId is null" + msoLogger.debug(msg) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("productFamilyId", productFamilyId) + } + String source = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source") + execution.setVariable("source", source) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + msoLogger.debug(msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestParameters + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + msoLogger.debug(msg) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(siRequest) + + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map inputMap = [:] + if (userParams) { + userParams.each { + userParam -> inputMap.put(userParam.name, userParam.value.toString()) + } + } + + msoLogger.debug("User Input Parameters map: " + userParams.toString()) + execution.setVariable("serviceInputParams", inputMap) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest") + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Start sendSyncResponse") + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + // RESTResponse (for API Handler (APIH) Reply Task) + String syncResponse = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + msoLogger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String msg = "Exception in sendSyncResponse: " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + msoLogger.trace("Exit sendSyncResopnse") + } + + public void sendSyncError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Start sendSyncError") + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${MsoUtils.xmlEscape(errorMessage)} + 7000 + """ + + MsoLogger.info(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + + } + + public void prepareCompletionRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Start prepareCompletion") + + try { + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String msoCompletionRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + DELETE + ${MsoUtils.xmlEscape(source)} + + Service Instance was deleted successfully. + DeleteGenericALaCarteServiceInstance + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("completionRequest", xmlMsoCompletionRequest) + msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit prepareCompletionRequest") + } + + public void prepareFalloutRequest(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Start prepareFalloutRequest") + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + msoLogger.debug(" Input Workflow Exception: " + wfex.toString()) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + DELETE + ${MsoUtils.xmlEscape(source)} + """ + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) + String errorException = " Bpmn error encountered in CreateServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + DELETE + VID + + + ${MsoUtils.xmlEscape(errorException)} + 7000 + + """ + + execution.setVariable("falloutRequest", falloutRequest) + } + msoLogger.trace("Exit prepareFalloutRequest ") + } + + + // ******************************* + // Build DB request Section + // ******************************* + public void prepareDBRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + try { + msoLogger.trace("Inside prepareDBRequest of DeleteGenericALaCarteServiceInstance ") + + String requestId = execution.getVariable("DELSI_requestId") + String statusMessage = "Service Instance successfully deleted." + + //TODO - verify the format for Service Instance Delete, + String dbRequest = + """ + + + + ${MsoUtils.xmlEscape(requestId)} + BPMN + ${MsoUtils.xmlEscape(statusMessage)} + + COMPLETED + 100 + + + """ + + String buildDeleteDBRequestAsString = utils.formatXml(dbRequest) + execution.setVariable("DELSI_createDBRequest", buildDeleteDBRequestAsString) + msoLogger.info(buildDeleteDBRequestAsString) + + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDBRequest() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + // ******************************* + // Build Error Section + // ******************************* + public void prepareDBRequestError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside prepareDBRequestError of DeleteGenericALaCarteServiceInstance ") + + try { + String requestId = execution.getVariable("DELSI_requestId") + String statusMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + statusMessage = wfe.getErrorMessage() + + } else { + statusMessage = "Encountered Error during DeleteGenericALaCarteServiceInstance proccessing. " + } + + //TODO - verify the format for Service Instance Create, + String dbRequest = + """ + + + + ${MsoUtils.xmlEscape(requestId)} + BPMN + ${MsoUtils.xmlEscape(statusMessage)} + + FAILED + + + """ + + String buildDBRequestAsString = utils.formatXml(dbRequest) + execution.setVariable("DELSI_createDBInfraErrorRequest", buildDBRequestAsString) + msoLogger.info(buildDBRequestAsString) + + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDBRequestError() - " + ex.getMessage() + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy new file mode 100644 index 0000000000..816ba859ee --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy @@ -0,0 +1,420 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.NetworkUtils +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +import groovy.json.* + +public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { + String Prefix="DELNI_" + String groovyClassName = "DeleteNetworkInstance" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + NetworkUtils networkUtils = new NetworkUtils() + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteNetworkInstance.class); + + + public InitializeProcessVariables(DelegateExecution execution){ + + execution.setVariable(Prefix + "Success", false) + + execution.setVariable(Prefix + "CompleteMsoProcessRequest", "") + execution.setVariable(Prefix + "FalloutHandlerRequest", "") + execution.setVariable(Prefix + "isSilentSuccess", false) + + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside preProcessRequest() of " + groovyClassName + "") + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + String sdncVersion = execution.getVariable("sdncVersion") + if (sdncVersion == null || sdncVersion == '1610') { + // 'a-la-cart' default, sdncVersion = '1610' + execution.setVariable("sdncVersion", "1610") + String bpmnRequest = execution.getVariable("bpmnRequest") + // set 'disableRollback' + if (bpmnRequest != null) { + String disableRollback = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.requestInfo.suppressRollback") + if (disableRollback != null) { + execution.setVariable("disableRollback", disableRollback) + msoLogger.debug("Received 'suppressRollback': " + disableRollback ) + } else { + execution.setVariable("disableRollback", false) + } + msoLogger.debug(" Set 'disableRollback' : " + execution.getVariable("disableRollback") ) + } else { + String dataErrorMessage = " Invalid 'bpmnRequest' request." + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + } else { + // 'macro' test ONLY, sdncVersion = '1702' + msoLogger.debug(" 'disableRollback' : " + execution.getVariable("disableRollback") ) + } + + // get/set 'msoRequestId' and 'mso-request-id' + String requestId = execution.getVariable("msoRequestId") + if (requestId != null) { + execution.setVariable("mso-request-id", requestId) + } else { + requestId = execution.getVariable("mso-request-id") + } + execution.setVariable(Prefix + "requestId", requestId) + + // get/set 'requestId' + if (execution.getVariable("requestId") == null) { + execution.setVariable("requestId", requestId) + } + + // set action to "DELETE" + execution.setVariable("action", "DELETE") + + //Place holder for additional code. + + // TODO ??? + // userParams??? 1) pre-loads indicator, 2) 'auto-activation' + // Tag/Value parameters + // + // Map: 'networkInputParams': 'auto-activation'' + // Sample format? + // "requestParameters": { + // "userParams": [ + // { + // "name": "someUserParam1", + // "value": "someValue1" + // } + // ] + // } + // + // String userParams = //use json util to extract "userParams"// + // execution.setVariable("networkInputParams", userParams) + // else: execution.setVariable("networkInputParams", null) + // + + + } catch (Exception ex){ + sendSyncError(execution) + String exceptionMessage = "Exception Encountered in " + groovyClassName + ", PreProcessRequest() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void getNetworkModelInfo (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside getNetworkModelInfo() of DeleteNetworkInstance") + + try { + + // For Ala-Carte (sdnc = 1610): + // 1. the Network ModelInfo is expected to be sent + // via requestDetails.modelInfo (modelType = network), ex: modelCustomizationId. + // 2. the Service ModelInfo is expected to be sent but will be IGNORE + // via requestDetails.relatedInstanceList.relatedInstance.modelInfo (modelType = service) + + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstance flow. getNetworkModelInfo() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside sendSyncResponse() of DeleteNetworkInstance") + + try { + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + // RESTResponse (for API Handler (APIH) Reply Task) + String deleteNetworkRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + + msoLogger.debug(" sendSyncResponse to APIH - " + "\n" + deleteNetworkRestRequest) + + sendWorkflowResponse(execution, 202, deleteNetworkRestRequest) + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Exception Encountered in DeleteNetworkInstance, sendSyncResponse() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareCompletion (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareCompletion() of CreateNetworkInstance") + + try { + + String requestId = execution.getVariable("mso-request-id") + String source = execution.getVariable(Prefix + "source") + + String msoCompletionRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + DELETE + VID + + Network has been deleted successfully. + BPMN Network action: DELETE + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + // normal path + execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) + msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. prepareCompletion() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + + } + + public void prepareDBRequestError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + try { + msoLogger.trace("Inside prepareDBRequestError of DeleteNetworkInstance") + + // set DB Header Authorization + setBasicDBAuthHeader(execution, isDebugEnabled) + + WorkflowException wfe = execution.getVariable("WorkflowException") + String statusMessage = wfe.getErrorMessage() + String requestId = execution.getVariable(Prefix +"requestId") + + String dbRequest = + """ + + + + ${MsoUtils.xmlEscape(requestId)} + BPMN + ${MsoUtils.xmlEscape(statusMessage)} + + FAILED + + <network-outputs xmlns="http://org.onap/so/infra/vnf-request/v1" xmlns:aetgt="http://org.onap/so/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"/> + + + """ + + execution.setVariable(Prefix + "deleteDBRequest", dbRequest) + msoLogger.debug(" DB Adapter Request - " + "\n" + dbRequest) + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstance, prepareDBRequestError() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + // ************************************************** + // Post or Validate Response Section + // ************************************************** + + public void postProcessResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside postProcessResponse() of DeleteNetworkInstance") + + try { + if (execution.getVariable("CMSO_ResponseCode") == "200") { + execution.setVariable(Prefix + "Success", true) + msoLogger.trace("DeleteNetworkInstance Success") + // Place holder for additional code. + + } else { + execution.setVariable(Prefix + "Success", false) + msoLogger.trace("DeleteNetworkInstance Failed in CompletionMsoProces flow!.") + + } + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DeleteNetworkInstance flow. postProcessResponse() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + // ******************************* + // Build Error Section + // ******************************* + + // Prepare for FalloutHandler + public void buildErrorResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler.") + + String dbReturnCode = execution.getVariable(Prefix + "dbReturnCode") + msoLogger.debug("DB Update Response Code : " + dbReturnCode) + msoLogger.debug("DB Update Response String: " + '\n' + execution.getVariable(Prefix + "deleteDBResponse")) + + String falloutHandlerRequest = "" + String requestId = execution.getVariable("mso-request-id") + String source = execution.getVariable(Prefix + "source") + execution.setVariable(Prefix + "Success", false) + try { + WorkflowException wfe = execution.getVariable("WorkflowException") + String errorCode = String.valueOf(wfe.getErrorCode()) + String errorMessage = wfe.getErrorMessage() + + falloutHandlerRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + DELETE + ${MsoUtils.xmlEscape(source)} + + + ${MsoUtils.xmlEscape(errorMessage)} + ${MsoUtils.xmlEscape(errorCode)} + + """ + + msoLogger.debug(falloutHandlerRequest) + execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG,"Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest,"BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "") + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstance, buildErrorResponse() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + falloutHandlerRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + DELEtE + ${MsoUtils.xmlEscape(source)} + + + ${MsoUtils.xmlEscape(exceptionMessage)} + 9999 + + """ + execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG,"Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest,"BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex) + } + } + + + public void sendSyncError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + try { + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + // RESTResponse (for API Handler (APIH) Reply Task) + String deleteNetworkRestError = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + + msoLogger.debug(" sendSyncResponse to APIH - " + "\n" + deleteNetworkRestError) + + sendWorkflowResponse(execution, 500, deleteNetworkRestError) + + } catch (Exception ex) { + msoLogger.debug(" Sending Sync Error Activity Failed - DeleteNetworkInstance, sendSyncError(): " + "\n" + ex.getMessage()) + } + } + + public void processJavaException(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + try{ + msoLogger.debug("Caught a Java Exception") + msoLogger.debug("Started processJavaException Method") + msoLogger.debug("Variables List: " + execution.getVariables()) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + + }catch(Exception e){ + msoLogger.debug("Caught Exception during processJavaException Method: " + e) + execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method") + } + msoLogger.debug("Completed processJavaException Method of " + Prefix) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy new file mode 100644 index 0000000000..ab5500602f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -0,0 +1,308 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - 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.bpmn.infrastructure.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.recipe.ResourceInput; +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.json.JsonUtils + +import groovy.json.* + +/** + * This groovy class supports the DeleteSDNCCNetworkResource.bpmn process. + * flow for SDNC Network Resource + */ +public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { + + String Prefix="DELSDNCRES_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + public void preProcessRequest(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started preProcessRequest *****", isDebugEnabled) + try { + + //get bpmn inputs from resource request. + String requestId = execution.getVariable("mso-request-id") + String requestAction = execution.getVariable("requestAction") + utils.log("INFO","The requestAction is: " + requestAction, isDebugEnabled) + String recipeParamsFromRequest = execution.getVariable("recipeParams") + utils.log("INFO","The recipeParams is: " + recipeParamsFromRequest, isDebugEnabled) + String resourceInput = execution.getVariable("resourceInput") + utils.log("INFO","The resourceInput is: " + resourceInput, isDebugEnabled) + //Get ResourceInput Object + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) + execution.setVariable(Prefix + "resourceInput", resourceInputObj) + + //Deal with recipeParams + String recipeParamsFromWf = execution.getVariable("recipeParamXsd") + String resourceModelName = resourceInputObj.getResourceModelInfo().getModelName() + //For sdnc requestAction default is "NetworkInstance" + String operationType = "Network" + if(!StringUtils.isBlank(recipeParamsFromRequest) && "null" != recipeParamsFromRequest){ + //the operationType from worflow(first node) is second priority. + operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") + } + if(!StringUtils.isBlank(recipeParamsFromWf)){ + //the operationType from worflow(first node) is highest priority. + operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") + } + + + //For sdnc, generate svc_action and request_action + String sdnc_svcAction = "delete" + if(StringUtils.containsIgnoreCase(resourceModelName, "overlay")){ + //This will be resolved in R3. + sdnc_svcAction ="deactivate" + operationType = "NCINetwork" + } + if(StringUtils.containsIgnoreCase(resourceModelName, "underlay")){ + //This will be resolved in R3. + operationType ="Network" + } + String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" + execution.setVariable(Prefix + "svcAction", sdnc_svcAction) + execution.setVariable(Prefix + "requestAction", sdnc_requestAction) + execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) + execution.setVariable("mso-request-id", requestId) + execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) + //TODO Here build networkrequest + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + public void prepareSDNCRequest (DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled) + + try { + // get variables + String sdnc_svcAction = execution.getVariable(Prefix + "svcAction") + String sdnc_requestAction = execution.getVariable(Prefix + "requestAction") + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") + + String hdrRequestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + String source = execution.getVariable("source") + String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String serviceType = resourceInputObj.getServiceType() + String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() + String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() + String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion() + String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName() + String globalCustomerId = resourceInputObj.getGlobalSubscriberId() + String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid(); + String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() + // 1. prepare assign topology via SDNC Adapter SUBFLOW call + String sndcTopologyDeleteRequest = + """ + + ${MsoUtils.xmlEscape(hdrRequestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(sdnc_svcAction)} + network-topology-operation + sdncCallback + generic-resource + + + + ${MsoUtils.xmlEscape(hdrRequestId)} + ${MsoUtils.xmlEscape(sdnc_requestAction)} + ${MsoUtils.xmlEscape(source)} + + + + + + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(serviceType)} + + ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} + ${MsoUtils.xmlEscape(serviceModelUuid)} + ${MsoUtils.xmlEscape(serviceModelVersion)} + ${MsoUtils.xmlEscape(serviceModelName)} + + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(globalCustomerId)} + + + + ${MsoUtils.xmlEscape(modelInvariantUuid)} + ${MsoUtils.xmlEscape(modelCustomizationUuid)} + ${MsoUtils.xmlEscape(modelUuid)} + ${MsoUtils.xmlEscape(modelVersion)} + ${MsoUtils.xmlEscape(modelName)} + + + + + + + """.trim() + + String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) + utils.logAudit(sndcTopologyDeleteRequesAsString) + execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) + utils.log("INFO","sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DeleteSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) + } + + private void setProgressUpdateVariables(DelegateExecution execution, String body) { + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } + + public void prepareUpdateBeforeDeleteSDNCResource(DelegateExecution execution) { + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String operType = resourceInputObj.getOperationType() + String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String serviceInstanceId = resourceInputObj.getServiceInstanceId() + String operationId = resourceInputObj.getOperationId() + String progress = "20" + String status = "processing" + String statusDescription = "SDCN resource delete invoked" + + //String operationId = execution.getVariable("operationId") + + String body = """ + + + + + ${MsoUtils.xmlEscape(operType)} + ${MsoUtils.xmlEscape(operationId)} + ${MsoUtils.xmlEscape(progress)} + ${MsoUtils.xmlEscape(resourceCustomizationUuid)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(status)} + ${MsoUtils.xmlEscape(statusDescription)} + + + """; + + setProgressUpdateVariables(execution, body) + + } + + public void prepareUpdateAfterDeleteSDNCResource(DelegateExecution execution) { + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String operType = resourceInputObj.getOperationType() + String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String serviceInstanceId = resourceInputObj.getServiceInstanceId() + String operationId = resourceInputObj.getOperationId() + String progress = "100" + String status = "finished" + String statusDescription = "SDCN resource delete completed" + + //String operationId = execution.getVariable("operationId") + + String body = """ + + + + + ${MsoUtils.xmlEscape(operType)} + ${MsoUtils.xmlEscape(operationId)} + ${MsoUtils.xmlEscape(progress)} + ${MsoUtils.xmlEscape(resourceCustomizationUuid)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(status)} + ${MsoUtils.xmlEscape(statusDescription)} + + + """; + + setProgressUpdateVariables(execution, body) + } + + public void postDeleteSDNCCall(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled) + String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") + String responseObj = execution.getVariable(Prefix + "SuccessIndicator") + + utils.log("INFO","response from sdnc, response code :" + responseCode + " response object :" + responseObj, isDebugEnabled) + utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + String operationStatus = "finished" + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy new file mode 100644 index 0000000000..536783bc33 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy @@ -0,0 +1,87 @@ + +/*- + * ============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.bpmn.infrastructure.scripts + +import com.fasterxml.jackson.databind.ObjectMapper +import org.onap.so.bpmn.common.recipe.ResourceInput +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.ExceptionUtil + + +public class DeleteVFCNSResource extends AbstractServiceTaskProcessor { + + String Prefix = "DCUSE_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** start preProcessRequest *****", isDebugEnabled) + + String resourceInputStr = execution.getVariable("resourceInput") + ResourceInput resourceInput = new ObjectMapper().readValue(resourceInputStr, ResourceInput.class) + + String globalSubscriberId = resourceInput.getGlobalSubscriberId() + String serviceType = execution.getVariable("serviceType") + String operationId = resourceInput.getOperationId() + String resourceModeluuid = resourceInput.getResourceModelInfo().getModelCustomizationUuid() + String resourceInstanceId = resourceInput.getResourceInstancenUuid() + + + execution.setVariable("globalSubscriberId",globalSubscriberId) + execution.setVariable("serviceType", serviceType) + execution.setVariable("operationId", operationId) + execution.setVariable("resourceTemplateId", resourceModeluuid) + execution.setVariable("resourceInstanceId", resourceInstanceId) + + utils.log("INFO"," ***** end preProcessRequest *****", isDebugEnabled) + } + + public void postProcessRequest (DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** start postProcessRequest *****", isDebugEnabled) + + utils.log("INFO"," ***** end postProcessRequest *****", isDebugEnabled) + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + String nsInstanceId = execution.getVariable("nsInstanceId") + String operationStatus = execution.getVariable("operationStatus") + // RESTResponse for main flow + String createVFCResourceRestRsp = """{"nsInstanceId":"${nsInstanceId}","operationStatus":"${operationStatus}"}""".trim() + utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + createVFCResourceRestRsp, isDebugEnabled) + sendWorkflowResponse(execution, 202, createVFCResourceRestRsp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy new file mode 100644 index 0000000000..682421e806 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy @@ -0,0 +1,367 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.VidUtils; +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +import groovy.json.JsonSlurper + + + +public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteVfModuleInfra.class); + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'DELVfModI_') + execution.setVariable('DELVfModI_requestInfo', null) + execution.setVariable('DELVfModI_requestId', null) + execution.setVariable('DELVfModI_source', null) + execution.setVariable('DELVfModI_vnfInputs', null) + execution.setVariable('DELVfModI_vnfId', null) + execution.setVariable('DELVfModI_vfModuleId', null) + execution.setVariable('DELVfModI_tenantId', null) + execution.setVariable('DELVfModI_volumeGroupId', null) + execution.setVariable('DELVfModI_vnfParams', null) + execution.setVariable('DELVfModI_updateInfraRequest', null) + execution.setVariable('DeleteVfModuleRequest', null) + execution.setVariable('DeleteVfModuleSuccessIndicator', false) + } + + /** + * Process the incoming DELETE_VF_MODULE vnf-request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + execution.setVariable("isVidRequest", "false") + initProcessVariables(execution) + + def prefix = execution.getVariable('prefix') + + def incomingRequest = execution.getVariable('bpmnRequest') + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + + msoLogger.debug("Incoming Infra Request: " + incomingRequest) + + // check if request is xml or json + try { + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(incomingRequest) + msoLogger.debug(" Request is in JSON format.") + + def serviceInstanceId = execution.getVariable('serviceInstanceId') + msoLogger.debug("serviceInstanceId is: " + serviceInstanceId) + def vnfId = execution.getVariable('vnfId') + msoLogger.debug("vnfId is: " + vnfId) + def cloudConfiguration = jsonUtil.getJsonValue(incomingRequest, "requestDetails.cloudConfiguration") + execution.setVariable("cloudConfiguration", cloudConfiguration) + msoLogger.debug("CloudConfiguration is: " + cloudConfiguration) + def vfModuleModelInfo = jsonUtil.getJsonValue(incomingRequest, "requestDetails.modelInfo") + + execution.setVariable("vfModuleModelInfo", vfModuleModelInfo) + msoLogger.debug("VfModuleModelInfo is: " + vfModuleModelInfo) + + // This is aLaCarte flow, so aLaCarte flag is always on + execution.setVariable('aLaCarte', true) + + def vidUtils = new VidUtils(this) + + String requestInXmlFormat = vidUtils.createXmlVfModuleRequest(execution, reqMap, 'DELETE_VF_MODULE', serviceInstanceId) + + msoLogger.debug(" Request in XML format: " + requestInXmlFormat) + + setBasicDBAuthHeader(execution, isDebugLogEnabled) + + execution.setVariable(prefix + 'Request', requestInXmlFormat) + execution.setVariable(prefix+'vnfId', vnfId) + execution.setVariable("isVidRequest", "true") + + } + catch(groovy.json.JsonException je) { + msoLogger.debug(" Request is not in JSON format.") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request") + + } + catch(Exception e) { + String restFaultMessage = e.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG,"Caught exception", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request") + } + + + try { + + String request = validateRequest(execution) + execution.setVariable('DeleteVfModuleRequest', request) + msoLogger.debug("DeleteVfModuleInfra Request: " + request) + + def requestInfo = getRequiredNodeXml(execution, request, 'request-info') + execution.setVariable('DELVfModI_requestInfo', requestInfo) + execution.setVariable('DELVfModI_requestId', getRequiredNodeText(execution, requestInfo, 'request-id')) + execution.setVariable('DELVfModI_source', getNodeTextForce(requestInfo, 'source')) + + def vnfInputs = getRequiredNodeXml(execution, request, 'vnf-inputs') + execution.setVariable('DELVfModI_vnfInputs', vnfInputs) + execution.setVariable('DELVfModI_vnfId', getRequiredNodeText(execution, vnfInputs, 'vnf-id')) + execution.setVariable('DELVfModI_vfModuleId', getRequiredNodeText(execution, vnfInputs, 'vf-module-id')) + execution.setVariable('DELVfModI_vfModuleName', getNodeTextForce(vnfInputs, 'vf-module-name')) + execution.setVariable('DELVfModI_tenantId', getRequiredNodeText(execution, vnfInputs, 'tenant-id')) + execution.setVariable('DELVfModI_volumeGroupId', getNodeTextForce(vnfInputs, 'volume-group-id')) + + def vnfParams = utils.getNodeXml(request, 'vnf-params') + execution.setVariable('DELVfModI_vnfParams', vnfParams) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG,"Caught exception in "+method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) + } + } + + /** + * Sends the 'IN_PROGRESS' synchronous response. + * + * @param execution The flow's execution instance. + */ + public void sendSynchResponse(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendResponse(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + msoLogger.trace('Entered ' + method) + + try { + def requestInfo = execution.getVariable('DELVfModI_requestInfo') + def requestId = execution.getVariable('DELVfModI_requestId') + def source = execution.getVariable('DELVfModI_source') + def progress = getNodeTextForce(requestInfo, 'progress') + if (progress.isEmpty()) { + progress = '0' + } + def startTime = getNodeTextForce(requestInfo, 'start-time') + if (startTime.isEmpty()) { + startTime = System.currentTimeMillis() + } + + // RESTResponse (for API Handler (APIH) Reply Task) + def vfModuleId = execution.getVariable('DELVfModI_vfModuleId') + String synchResponse = """{"requestReferences":{"instanceId":"${vfModuleId}","requestId":"${requestId}"}}""".trim() + + msoLogger.debug("DeleteVfModuleInfra Synch Response: " + synchResponse) + sendWorkflowResponse(execution, 200, synchResponse) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG,"Caught exception in "+method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) + } + } + + /** + * Currently passing the entire DELETE_VF_MODULE vnf-request to DoDeleteVfModule. + * 'DeleteVfModuleRequest' is now being set in preProcessRequest(). + * TBD: may want to eventually create a specific request that only contains the needed fields. + * + * @param execution The flow's execution instance. + */ + public void prepDoDeleteVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepDoDeleteVfModule(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + msoLogger.trace('Entered ' + method) + + try { + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoDeleteVfModule(): ' + e.getMessage()) + } + } + + /** + * Prepare the DB update to add an entry for the Vf Module request. + * + * @param execution The flow's execution instance. + */ + public void prepUpdateInfraRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepUpdateInfraRequest(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + msoLogger.trace('Entered ' + method) + + try { + def requestId = execution.getVariable('DELVfModI_requestId') + def vnfId = execution.getVariable('DELVfModI_vnfId') + def vfModuleId = execution.getVariable('DELVfModI_vfModuleId') + def tenantId = execution.getVariable('DELVfModI_tenantId') + def volumeGroupId = execution.getVariable('DELVfModI_volumeGroupId') + + String updateInfraRequest = """ + + + + + ${MsoUtils.xmlEscape(requestId)} + BPMN + COMPLETED + 100 + + + + """ + + updateInfraRequest = utils.formatXml(updateInfraRequest) + execution.setVariable('DELVfModI_updateInfraRequest', updateInfraRequest) + msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepInfraRequest(): ' + e.getMessage()) + } + } + + /** + * Builds a "CompletionHandler" request and stores it in the specified execution variable. + * + * @param execution the execution + * @param resultVar the execution variable in which the result will be stored + */ + public void completionHandlerPrep(DelegateExecution execution, String resultVar) { + def method = getClass().getSimpleName() + '.completionHandlerPrep(' + + 'execution=' + execution.getId() + + ', resultVar=' + resultVar + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + msoLogger.trace('Entered ' + method) + + try { + def request = execution.getVariable("DeleteVfModuleRequest") + def requestInfo = utils.getNodeXml(request, 'request-info', false) + def action = utils.getNodeText(requestInfo, "action") + + String content = + """ + + ${requestInfo} + + Vf Module has been deleted successfully. + BPMN + """ + + content = utils.formatXml(content) + msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + execution.setVariable(resultVar, content) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') + } + } + + /** + * Builds a "FalloutHandler" request and stores it in the specified execution variable. + * + * @param execution the execution + * @param resultVar the execution variable in which the result will be stored + */ + public void falloutHandlerPrep(DelegateExecution execution, String resultVar) { + def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + + 'execution=' + execution.getId() + + ', resultVar=' + resultVar + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + msoLogger.trace('Entered ' + method) + + try { + def prefix = execution.getVariable('prefix') + def request = execution.getVariable("DeleteVfModuleRequest") + def requestInfo = utils.getNodeXml(request, 'request-info', false) + def WorkflowException workflowException = execution.getVariable("WorkflowException") + def errorResponseCode = workflowException.getErrorCode() + def errorResponseMsg = workflowException.getErrorMessage() + def encErrorResponseMsg = "" + if (errorResponseMsg != null) { + encErrorResponseMsg = errorResponseMsg + } + + String content = """ + + ${requestInfo} + + ${MsoUtils.xmlEscape(encErrorResponseMsg)} + ${MsoUtils.xmlEscape(errorResponseCode)} + + + """ + content = utils.formatXml(content) + msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + execution.setVariable(resultVar, content) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy new file mode 100644 index 0000000000..2cbfeac239 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy @@ -0,0 +1,545 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AaiUtil; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.VidUtils; +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils + +import groovy.json.JsonSlurper + +/** + * This groovy class supports the DeleteVfModuleVolume.bpmn process. + */ +public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteVfModuleVolumeInfraV1.class); + + private XmlParser xmlParser = new XmlParser() + /** + * This method is executed during the preProcessRequest task of the DeleteVfModuleVolume.bpmn process. + * @param execution + */ + public InitializeProcessVariables(DelegateExecution execution){ + execution.setVariable('prefix', 'DELVfModVol_') + execution.setVariable("DELVfModVol_volumeRequest", null) + execution.setVariable('DELVfModVol_requestInfo', null) + execution.setVariable('DELVfModVol_requestId', null) + execution.setVariable('DELVfModVol_source', null) + execution.setVariable('DELVfModVol_volumeInputs', null) + execution.setVariable('DELVfModVol_volumeOutputs', null) + execution.setVariable('DELVfModVol_volumeGroupId', null) + execution.setVariable('DELVfModVol_vnfType', null) + execution.setVariable('DELVfModVol_serviceId', null) + execution.setVariable('DELVfModVol_cloudRegion', null) + execution.setVariable('DELVfModVol_tenantId', null) + execution.setVariable('DELVfModVol_volumeParams', null) + execution.setVariable('DELVfModVol_volumeGroupHeatStackId', null) + execution.setVariable('DELVfModVol_volumeGroupTenantId', null) + execution.setVariable("DELVfModVol_queryAAIVolGrpResponse", null) + execution.setVariable('DELVfModVol_messageId', null) + execution.setVariable('DELVfModVol_deleteVnfARequest', null) + execution.setVariable('DELVfModVol_updateInfraRequest', null) + execution.setVariable('DELVfModVol_CompleteMsoProcessRequest', null) + execution.setVariable('DELVfModVol_WorkflowException', null) + execution.setVariable('DELVfModVol_TransactionSuccessIndicator', false) + execution.setVariable("DELVfModVol_isErrorMessageException", false) + execution.setVariable('DELVfModVol_syncResponseSent', false) + } + + /** + * Perform initial processing, such as request validation, initialization of variables, etc. + * * @param execution + */ + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + preProcessRequest(execution, isDebugEnabled) + } + + /** + * This method is executed during the preProcessRequest task of the DeleteVfModuleVolume.bpmn process. + * @param execution + */ + public void preProcessRequest (DelegateExecution execution, isDebugLogEnabled) { + + InitializeProcessVariables(execution) + + String createVolumeIncoming = validateRequest(execution) + + // check if request is xml or json + try { + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(createVolumeIncoming) + msoLogger.debug(" Request is in JSON format.") + + def serviceInstanceId = execution.getVariable('serviceInstanceId') + def volumeGroupId = execution.getVariable('volumeGroupId') + def vidUtils = new VidUtils(this) + createVolumeIncoming = vidUtils.createXmlVolumeRequest(reqMap, 'DELETE_VF_MODULE_VOL', serviceInstanceId, volumeGroupId) + execution.setVariable("DELVfModVol_isVidRequest", true) + } + catch(groovy.json.JsonException je) { + msoLogger.debug(" Request is in XML format.") + // assume request is in XML format - proceed as usual to process XML request + } + + String request = utils.getNodeXml(createVolumeIncoming, "volume-request").drop(38).trim().replace("tag0:","").replace(":tag0","") + execution.setVariable("DELVfModVol_volumeRequest", request) + + def requestInfo = getRequiredNodeXml(execution, request, 'request-info') + execution.setVariable('DELVfModVol_requestInfo', requestInfo) + String requestId = execution.getVariable("mso-request-id") + if (requestId == null || requestId == "") { + requestId = getRequiredNodeText(execution, requestInfo, 'request-id') + } + execution.setVariable('DELVfModVol_requestId', requestId) + execution.setVariable('DELVfModVol_source', getNodeTextForce(requestInfo, 'source')) + + def volumeInputs = getRequiredNodeXml(execution, request, 'volume-inputs') + execution.setVariable('DELVfModVol_volumeInputs', volumeInputs) + execution.setVariable('DELVfModVol_volumeGroupId', getRequiredNodeText(execution, volumeInputs, 'volume-group-id')) + execution.setVariable('DELVfModVol_vnfType', getRequiredNodeText(execution, volumeInputs, 'vnf-type')) + execution.setVariable('DELVfModVol_serviceId', utils.getNodeText(volumeInputs, 'service-id')) + execution.setVariable('DELVfModVol_tenantId', getRequiredNodeText(execution, volumeInputs, 'tenant-id')) + execution.setVariable('DELVfModVol_messageId', UUID.randomUUID().toString()) + execution.setVariable('DELVfModVol_volumeOutputs', utils.getNodeXml(request, 'volume-outputs', false)) + execution.setVariable('DELVfModVol_volumeParams', utils.getNodeXml(request, 'volume-params')) + execution.setVariable('DELVfModVol_cloudRegion', utils.getNodeText(request, 'aic-cloud-region')) + + setBasicDBAuthHeader(execution, isDebugLogEnabled) + + msoLogger.debug('Request: ' + createVolumeIncoming) + } + + public void sendSyncResponse (DelegateExecution execution, isDebugEnabled) { + + String volumeRequest = execution.getVariable("DELVfModVol_volumeRequest") + msoLogger.debug(" DELVfModVol_volumeRequest - " + "\n" + volumeRequest) + // RESTResponse (for API Handler (APIH) Reply Task) + String deleteVolumeRequest = + """ + + ${volumeRequest} + + """.trim() + + def isVidRequest = execution.getVariable('DELVfModVol_isVidRequest') + def syncResponse = '' + + if(isVidRequest) { + def serviceInstanceId = execution.getVariable('serviceInstanceId') + def volumeGroupId = execution.getVariable('volumeGroupId') + def requestId = execution.getVariable('DELVfModVol_requestId') + syncResponse = """{"requestReferences":{"instanceId":"${volumeGroupId}","requestId":"${requestId}"}}""".trim() + } + else { + syncResponse = utils.formatXml(deleteVolumeRequest) + } + + execution.setVariable('DELVfModVol_syncResponseSent', true) + + sendWorkflowResponse(execution, 200, syncResponse) + } + + + public void sendSyncError (DelegateExecution execution, isDebugEnabled) { + WorkflowException we = execution.getVariable('WorkflowException') + def errorCode = we?.getErrorCode() + def errorMessage = we?.getErrorMessage() + //default to 400 since only invalid request will trigger this method + sendWorkflowResponse(execution, 400, errorMessage) + } + + + public void callRESTQueryAAICloudRegion (DelegateExecution execution, isDebugEnabled) { + + String cloudRegion = execution.getVariable('DELVfModVol_cloudRegion') + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUtil = new AaiUtil(this) + String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) + String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion + execution.setVariable("DELVfModVol_queryCloudRegionRequest", queryCloudRegionRequest) + msoLogger.debug(" DELVfModVol_queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest) + + cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + if ((cloudRegion != "ERROR")) { + if(execution.getVariable("DELVfModVol_queryCloudRegionReturnCode") == "404"){ + execution.setVariable("DELVfModVol_aicCloudRegion", "AAIAIC25") + }else{ + execution.setVariable("DELVfModVol_aicCloudRegion", cloudRegion) + } + execution.setVariable("DELVfModVol_cloudRegion", cloudRegion) + execution.setVariable("DELVfModVol_isCloudRegionGood", true) + + } else { + msoLogger.debug("AAI Query Cloud Region Unsuccessful.") + execution.setVariable("DELVfModVol_isCloudRegionGood", false) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable("DELVfModVol_queryCloudRegionReturnCode")) + } + + msoLogger.debug(" is Cloud Region Good: " + execution.getVariable("DELVfModVol_isCloudRegionGood")) + } + + /** + * Query volume group by id + * @param execution + */ + public void queryAAIForVolumeGroup(DelegateExecution execution, isDebugLogEnabled) { + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + def volumeGroupId = execution.getVariable('DELVfModVol_volumeGroupId') + if(volumeGroupId == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, 'volume-group-id is not provided in the request') + throw new Exception('volume-group-id is not provided in the request') + } + String cloudRegion = execution.getVariable('DELVfModVol_aicCloudRegion') + + AaiUtil aaiUtil = new AaiUtil(this) + String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) + String queryAAIVolumeGroupRequest = aaiEndpoint + '/' + URLEncoder.encode(cloudRegion, "UTF-8") + "/volume-groups/volume-group/" + UriUtils.encode(volumeGroupId, "UTF-8") + + msoLogger.debug('Query AAI volume group by ID: ' + queryAAIVolumeGroupRequest) + + APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIVolumeGroupRequest) + + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msoLogger.debug("AAI query volume group by id return code: " + returnCode) + msoLogger.debug("AAI query volume group by id response: " + aaiResponseAsString) + + execution.setVariable("DELVfModVol_queryAAIVolGrpResponse", aaiResponseAsString) + + if (returnCode=='200' || returnCode == '204') { + + def heatStackId = getNodeTextForce(aaiResponseAsString, 'heat-stack-id') + execution.setVariable('DELVfModVol_volumeGroupHeatStackId', heatStackId) + + if(hasVfModuleRelationship(aaiResponseAsString)){ + msoLogger.debug('Volume Group ' + volumeGroupId + ' currently in use') + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} currently in use - found vf-module relationship.") + } + + def volumeGroupTenantId = getTenantIdFromVolumeGroup(aaiResponseAsString) + if (volumeGroupTenantId == null) { + msoLogger.debug("Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}") + } + + execution.setVariable('DELVfModVol_volumeGroupTenantId', volumeGroupTenantId) + msoLogger.debug('Received Tenant Id ' + volumeGroupTenantId + ' from AAI for Volume Group with Volume Group Id ' + volumeGroupId ) + } + else { + if (returnCode=='404') { + msoLogger.debug("Volume Group ${volumeGroupId} not found in AAI") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} not found in AAI. Response code: 404") + } + else { + WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + throw new BpmnError("MSOWorkflowException") + } + } + } + + /** + * Extract the Tenant Id from the Volume Group information returned by AAI. + * + * @param volumeGroupXml Volume Group XML returned by AAI. + * @return the Tenant Id extracted from the Volume Group information. 'null' is returned if + * the Tenant Id is missing or could not otherwise be extracted. + */ + private String getTenantIdFromVolumeGroup(String volumeGroupXml) { + def Node volumeGroupNode = xmlParser.parseText(volumeGroupXml) + def Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list') + if (relationshipList != null) { + def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') + for (Node relationship in relationships) { + def Node relatedTo = utils.getChildNode(relationship, 'related-to') + if ((relatedTo != null) && (relatedTo.text().equals('tenant'))) { + def NodeList relationshipDataList = utils.getIdenticalChildren(relationship, 'relationship-data') + for (Node relationshipData in relationshipDataList) { + def Node relationshipKey = utils.getChildNode(relationshipData, 'relationship-key') + if ((relationshipKey != null) && (relationshipKey.text().equals('tenant.tenant-id'))) { + def Node relationshipValue = utils.getChildNode(relationshipData, 'relationship-value') + if (relationshipValue != null) { + return relationshipValue.text() + } + } + } + } + } + } + return null + } + + private boolean hasVnfRelationship(String volumeGroupXml) { + def Node volumeGroupNode = xmlParser.parseText(volumeGroupXml) + def Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list') + if (relationshipList != null) { + def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') + for (Node relationship in relationships) { + def Node relatedTo = utils.getChildNode(relationship, 'related-to') + if ((relatedTo != null) && (relatedTo.text().equals('generic-vnf'))) { + def Node relatedLink = utils.getChildNode(relationship, 'related-link') + if (relatedLink !=null && relatedLink.text() != null){ + return true + } + } + } + } + return false + } + + private boolean hasVfModuleRelationship(String volumeGroupXml) { + def Node volumeGroupNode = xmlParser.parseText(volumeGroupXml) + def Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list') + if (relationshipList != null) { + def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') + for (Node relationship in relationships) { + def Node relatedTo = utils.getChildNode(relationship, 'related-to') + if ((relatedTo != null) && (relatedTo.text().equals('vf-module'))) { + def Node relatedLink = utils.getChildNode(relationship, 'related-link') + if (relatedLink !=null && relatedLink.text() != null){ + return true + } + } + } + } + return false + } + + public void prepareVnfAdapterDeleteRequest(DelegateExecution execution, isDebugLogEnabled) { + def cloudRegion = execution.getVariable('DELVfModVol_cloudRegion') + def tenantId = execution.getVariable('DELVfModVol_tenantId') + def volumeGroupId = execution.getVariable('DELVfModVol_volumeGroupId') + def volumeGroupHeatStackId = execution.getVariable('DELVfModVol_volumeGroupHeatStackId') + def requestId = execution.getVariable('DELVfModVol_requestId') + def serviceId = execution.getVariable('DELVfModVol_serviceId') + + def messageId = execution.getVariable('DELVfModVol_messageId') + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) + def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host", execution) + if ('true'.equals(useQualifiedHostName)) { + notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) + } + + String vnfAdapterRestRequest = """ + + ${MsoUtils.xmlEscape(cloudRegion)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(volumeGroupId)} + ${MsoUtils.xmlEscape(volumeGroupHeatStackId)} + true + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(serviceId)} + + ${MsoUtils.xmlEscape(messageId)} + ${MsoUtils.xmlEscape(notificationUrl)} + + """ + vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest) + execution.setVariable('DELVfModVol_deleteVnfARequest', vnfAdapterRestRequest) + msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest) + } + + + public void deleteVolGrpId(DelegateExecution execution, isDebugEnabled) { + + // get variables + String queryAAIVolGrpIdResponse = execution.getVariable("DELVfModVol_queryAAIVolGrpResponse") + String groupId = utils.getNodeText(queryAAIVolGrpIdResponse, "volume-group-id") + String resourceVersion = utils.getNodeText(queryAAIVolGrpIdResponse, "resource-version") + String messageId = execution.getVariable('DELVfModVol_messageId') + String cloudRegion = execution.getVariable('DELVfModVol_aicCloudRegion') + + AaiUtil aaiUtil = new AaiUtil(this) + String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) + String deleteAAIVolumeGrpIdRequest = aaiEndpoint + '/' + URLEncoder.encode(cloudRegion, "UTF-8") + "/volume-groups/volume-group/" + UriUtils.encode(groupId, "UTF-8") + + if(resourceVersion !=null){ + deleteAAIVolumeGrpIdRequest = deleteAAIVolumeGrpIdRequest +'?resource-version=' + UriUtils.encode(resourceVersion, 'UTF-8') + } + + msoLogger.debug("Delete AAI volume group : " + deleteAAIVolumeGrpIdRequest) + + APIResponse response = aaiUtil.executeAAIDeleteCall(execution, deleteAAIVolumeGrpIdRequest) + + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msoLogger.debug("AAI delete volume group return code: " + returnCode) + msoLogger.debug("AAI delete volume group response: " + aaiResponseAsString) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + if (returnCode=='200' || (returnCode == '204')) { + msoLogger.debug("Volume group $groupId deleted.") + } else { + if (returnCode=='404') { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume group $groupId not found for delete in AAI Response code: 404") + } else { + WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + throw new BpmnError("MSOWorkflowException") + } + } + } + + + public void prepareDBRequest (DelegateExecution execution, isDebugLogEnabled) { + + WorkflowException workflowExceptionObj = execution.getVariable("WorkflowException") + ExceptionUtil exceptionUtil = new ExceptionUtil(); + def requestId = execution.getVariable('DELVfModVol_requestId') + def volOutputs = execution.getVariable('DELVfModVol_volumeOutputs') + def statusMessage = "VolumeGroup successfully deleted" + def progress = "100" + def requestStatus = "COMPLETE" + + if (workflowExceptionObj != null) { + statusMessage = (workflowExceptionObj.getErrorMessage()) + execution.setVariable("DELVfModVol_WorkflowExceptionMessage", statusMessage) + execution.setVariable("DELVfModVol_WorkflowExceptionCode", workflowExceptionObj.getErrorCode()) + requestStatus = "FAILURE" + progress = "" + } + + String updateInfraRequest = """ + + + + + ${MsoUtils.xmlEscape(requestId)} + BPMN + ${MsoUtils.xmlEscape(statusMessage)} + ${MsoUtils.xmlEscape(requestStatus)} + ${MsoUtils.xmlEscape(progress)} + ${MsoUtils.xmlEscape(volOutputs)} + + + + """ + + updateInfraRequest = utils.formatXml(updateInfraRequest) + execution.setVariable('DELVfModVol_updateInfraRequest', updateInfraRequest) + msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest) + + } + + + public void prepareCompletionHandlerRequest (DelegateExecution execution, isDebugLogEnabled) { + def requestId = execution.getVariable("mso-request-id") + def source = execution.getVariable("DELVfModVol_source") + + String msoCompletionRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + DELETE + ${MsoUtils.xmlEscape(source)} + + Volume Group has been deleted successfully. + BPMN VF Module Volume action: DELETE + """ + + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + execution.setVariable('DELVfModVol_CompleteMsoProcessRequest', xmlMsoCompletionRequest) + msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + + } + + + + public void prepareFalloutHandler (DelegateExecution execution, isDebugEnabled) { + + execution.setVariable("DELVfModVol_Success", false) + String requestId = execution.getVariable("DELVfModVol_requestId") + String source = execution.getVariable("DELVfModVol_source") + + WorkflowException workflowExceptionObj = execution.getVariable("WorkflowException") + def errorMessage = workflowExceptionObj.getErrorMessage() + def errorCode = workflowExceptionObj.getErrorCode() + + String falloutHandlerRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + DELETE + ${MsoUtils.xmlEscape(source)} + + + ${MsoUtils.xmlEscape(errorMessage)} + ${MsoUtils.xmlEscape(errorCode)} + + """ + + // Format Response + String xmlHandlerRequest = utils.formatXml(falloutHandlerRequest) + msoLogger.debug(xmlHandlerRequest) + + execution.setVariable("DELVfModVol_FalloutHandlerRequest", xmlHandlerRequest) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Overall Error Response going to FalloutHandler", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "\n" + xmlHandlerRequest); + + } + + + /** + * Create a WorkflowException for the error case where the Tenant Id from + * AAI did not match the Tenant Id in the incoming request. + * + * @param execution The flow's execution instance. + */ + public void handleTenantIdMismatch(DelegateExecution execution, isDebugLogEnabled) { + + def volumeGroupId = execution.getVariable('DELVfModVol_volumeGroupId') + def aicCloudRegion = execution.getVariable('DELVfModVol_aicCloudRegion') + def tenantId = execution.getVariable('DELVfModVol_tenantId') + def volumeGroupTenantId = execution.getVariable('DELVfModVol_volumeGroupTenantId') + + def String errorMessage = 'TenantId ' + tenantId + ' in incoming request does not match Tenant Id ' + volumeGroupTenantId + + ' retrieved from AAI for Volume Group Id ' + volumeGroupId + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error in DeleteVfModuleVolume: " + "\n" + errorMessage, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + exceptionUtil.buildWorkflowException(execution, 5000, errorMessage) + + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy new file mode 100644 index 0000000000..9dfb9107b2 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy @@ -0,0 +1,207 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.VidUtils; +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.logger.MsoLogger + + +/** + * This class supports the DeleteVnfInfra Flow + * with the Deletion of a generic vnf for + * infrastructure. + */ +class DeleteVnfInfra extends AbstractServiceTaskProcessor { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteVnfInfra.class); + + String Prefix="DELVI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + + /** + * This method gets and validates the incoming + * request. + * + * @param - execution + */ + public void preProcessRequest(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED DeleteVnfInfra PreProcessRequest Process") + + execution.setVariable("DELVI_SuccessIndicator", false) + execution.setVariable("DELVI_vnfInUse", false) + + try{ + // Get Variables + String deleteVnfRequest = execution.getVariable("bpmnRequest") + execution.setVariable("DELVI_DeleteVnfRequest", deleteVnfRequest) + msoLogger.debug("Incoming DeleteVnfInfra Request is: \n" + deleteVnfRequest) + + if(deleteVnfRequest != null){ + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("DELVI_requestId", requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + execution.setVariable("DELVI_serviceInstanceId", serviceInstanceId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + + String vnfId = execution.getVariable("vnfId") + execution.setVariable("DELVI_vnfId", vnfId) + msoLogger.debug("Incoming Vnf(Instance) Id is: " + vnfId) + + String source = jsonUtil.getJsonValue(deleteVnfRequest, "requestDetails.requestInfo.source") + execution.setVariable("DELVI_source", source) + msoLogger.debug("Incoming Source is: " + source) + + def cloudConfiguration = jsonUtil.getJsonValue(deleteVnfRequest, "requestDetails.cloudConfiguration") + execution.setVariable("DELVI_cloudConfiguration", cloudConfiguration) + + boolean cascadeDelete = false + Boolean cascadeDeleteObj = jsonUtil.getJsonRawValue(deleteVnfRequest, "requestDetails.requestParameters.cascadeDelete") + if(cascadeDeleteObj!=null){ + cascadeDelete = cascadeDeleteObj.booleanValue() + } + execution.setVariable("DELVI_cascadeDelete", cascadeDelete) + msoLogger.debug("Incoming cascadeDelete is: " + cascadeDelete) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + DELETE + ${MsoUtils.xmlEscape(source)} + """ + + execution.setVariable("DELVI_requestInfo", requestInfo) + + // Setting for sub flow calls + execution.setVariable("DELVI_type", "generic-vnf") + + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Bpmn Request is Null.") + } + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug(" Error Occured in DeleteVnfInfra PreProcessRequest method!" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra PreProcessRequest") + + } + msoLogger.trace("COMPLETED DeleteVnfInfra PreProcessRequest Process") + } + + public void sendSyncResponse (DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + + msoLogger.trace("STARTED DeleteVnfInfra SendSyncResponse Process") + + try { + String requestId = execution.getVariable("DELVI_requestId") + String vnfId = execution.getVariable("DELVI_vnfId") + + String DeleteVnfResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() + + msoLogger.debug("DeleteVnfInfra Sync Response is: \n" + DeleteVnfResponse) + execution.setVariable("DELVI_sentSyncResponse", true) + + sendWorkflowResponse(execution, 202, DeleteVnfResponse) + + } catch (Exception ex) { + msoLogger.debug("Error Occured in DeleteVnfInfra SendSyncResponse Process " + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra SendSyncResponse Process") + + } + msoLogger.trace("COMPLETED DeleteVnfInfra SendSyncResponse Process") + } + + public void prepareCompletionHandlerRequest(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + + msoLogger.trace("STARTED DeleteVnfInfra PrepareCompletionHandlerRequest Process") + + try { + String requestInfo = execution.getVariable("DELVI_requestInfo") + requestInfo = utils.removeXmlPreamble(requestInfo) + String vnfId = execution.getVariable("DELVI_vnfId") + + String request = + """ + ${requestInfo} + Vnf has been deleted successfully. + ${MsoUtils.xmlEscape(vnfId)} + DeleteVnfInfra + """ + + execution.setVariable("DELVI_completionHandlerRequest", request) + msoLogger.debug("Completion Handler Request is: " + request) + + execution.setVariable("WorkflowResponse", "Success") // for junits + + } catch (Exception ex) { + msoLogger.debug("Error Occured in DeleteVnfInfra PrepareCompletionHandlerRequest Process " + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra PrepareCompletionHandlerRequest Process") + + } + msoLogger.trace("COMPLETED DeleteVnfInfra PrepareCompletionHandlerRequest Process") + } + + public void sendErrorResponse(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + + msoLogger.trace("STARTED DeleteVnfInfra sendErrorResponse Process") + try { + def sentSyncResponse = execution.getVariable("DELVI_sentSyncResponse") + if(sentSyncResponse == false){ + msoLogger.debug("Sending a Sync Error Response") + WorkflowException wfex = execution.getVariable("WorkflowException") + String response = exceptionUtil.buildErrorResponseXml(wfex) + + msoLogger.debug(response) + sendWorkflowResponse(execution, 500, response) + }else{ + msoLogger.debug("A Sync Response has already been sent. Skipping Send Sync Error Response.") + } + + } catch(Exception ex) { + msoLogger.debug("Error Occured in DeleteVnfInfra sendErrorResponse Process " + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra sendErrorResponse Process") + } + msoLogger.trace("COMPLETED DeleteVnfInfra sendErrorResponse Process") + } + + + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy new file mode 100644 index 0000000000..98605fea8b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy @@ -0,0 +1,258 @@ +/*- + * ============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.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* + +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInstance +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.domain.AllottedResource +import org.onap.so.bpmn.core.domain.NetworkResource +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.common.recipe.ResourceInput +import org.onap.so.bpmn.common.recipe.BpmnRestClient +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.CatalogDbUtils; +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.rest.APIResponse; +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig + +import java.util.List; +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject; +import org.json.JSONArray; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +/** + * This groovy class supports the DoCompareModelVersions.bpmn process. + * + * Inputs: + * @param - model-invariant-id-target + * @param - model-version-id-target + * @param - model-invariant-id-original + * @param - model-version-id-original + * + * Outputs: + * @param - addResourceList + * @param - delResourceList + * + */ +public class DoCompareModelVersions extends AbstractServiceTaskProcessor { + + String Prefix="DCMPMDV_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + CatalogDbUtils cutils = new CatalogDbUtils() + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled) + + try { + execution.setVariable("prefix", Prefix) + + //Inputs + String modelInvariantUuid_target = execution.getVariable("model-invariant-id-target") + if (isBlank(modelInvariantUuid_target)) { + msg = "Input model-invariant-id-target is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String modelUuid_target = execution.getVariable("model-version-id-target") + if (isBlank(modelUuid_target)) { + msg = "Input model-version-id-target is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String modelInvariantUuid_original = execution.getVariable("model-invariant-id-original") + if (isBlank(modelInvariantUuid_original)) { + msg = "Input model-invariant-id-original is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String modelUuid_original = execution.getVariable("model-version-id-original") + if (isBlank(modelUuid_original)) { + msg = "Input model-version-id-original is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + // Target and original modelInvariantUuid must to be the same + if(modelInvariantUuid_target != modelInvariantUuid_original){ + msg = "Input model-invariant-id-target and model-invariant-id-original must to be the same" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + // Target and original modelUuid must not to be the same + if(modelUuid_target == modelUuid_original){ + msg = "Input model-version-id-target and model-version-id-original must not to be the same" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void prepareDecomposeService_Target(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside prepareDecomposeService_Target of update generic e2e service ***** ", isDebugEnabled) + String modelInvariantUuid = execution.getVariable("model-invariant-id-target") + String modelUuid = execution.getVariable("model-version-id-target") + //here modelVersion is not set, we use modelUuid to decompose the service. + String serviceModelInfo = """{ + "modelInvariantUuid":"${modelInvariantUuid}", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + + execution.setVariable("serviceModelInfo_Target", serviceModelInfo) + + utils.log("DEBUG", " ***** Completed prepareDecomposeService_Target of update generic e2e service ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. Unexpected Error from method prepareDecomposeService_Target() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void processDecomposition_Target(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + utils.log("DEBUG", " ***** Inside processDecomposition_Target() of update generic e2e service flow ***** ", isDebugEnabled) + try { + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + execution.setVariable("serviceDecomposition_Target", serviceDecomposition) + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. Unexpected Error from method processDecomposition_Target() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void prepareDecomposeService_Original(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside prepareDecomposeService_Original of update generic e2e service ***** ", isDebugEnabled) + String modelInvariantUuid = execution.getVariable("model-invariant-id-original") + String modelUuid = execution.getVariable("model-version-id-original") + //here modelVersion is not set, we use modelUuid to decompose the service. + String serviceModelInfo = """{ + "modelInvariantUuid":"${modelInvariantUuid}", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + + execution.setVariable("serviceModelInfo_Original", serviceModelInfo) + + utils.log("DEBUG", " ***** Completed prepareDecomposeService_Original of update generic e2e service ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. Unexpected Error from method prepareDecomposeService_Original() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void processDecomposition_Original(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + utils.log("DEBUG", " ***** Inside processDecomposition_Original() of update generic e2e service flow ***** ", isDebugEnabled) + try { + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + execution.setVariable("serviceDecomposition_Original", serviceDecomposition) + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. processDecomposition_Original() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void doCompareModelVersions(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", "======== Start doCompareModelVersions Process ======== ", isDebugEnabled) + + ServiceDecomposition serviceDecomposition_Target = execution.getVariable("serviceDecomposition_Target") + ServiceDecomposition serviceDecomposition_Original = execution.getVariable("serviceDecomposition_Original") + + List allSR_target = serviceDecomposition_Target.getServiceResources(); + List allSR_original = serviceDecomposition_Original.getServiceResources(); + + List addResourceList = new ArrayList() + List delResourceList = new ArrayList() + + addResourceList.addAll(allSR_target) + delResourceList.addAll(allSR_original) + + //Compare + for (Resource rc_t : allSR_target){ + String muuid = rc_t.getModelInfo().getModelUuid() + String mIuuid = rc_t.getModelInfo().getModelInvariantUuid() + String mCuuid = rc_t.getModelInfo().getModelCustomizationUuid() + for (Resource rc_o : allSR_original){ + if(rc_o.getModelInfo().getModelUuid() == muuid + && rc_o.getModelInfo().getModelInvariantUuid() == mIuuid + && rc_o.getModelInfo().getModelCustomizationUuid() == mCuuid) { + addResourceList.remove(rc_t); + delResourceList.remove(rc_o); + } + } + } + + execution.setVariable("addResourceList", addResourceList) + execution.setVariable("delResourceList", delResourceList) + utils.log("INFO", "addResourceList: " + addResourceList, isDebugEnabled) + utils.log("INFO", "delResourceList: " + delResourceList, isDebugEnabled) + + utils.log("INFO", "======== COMPLETED doCompareModelVersions Process ======== ", isDebugEnabled) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy new file mode 100644 index 0000000000..eceba5abe3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy @@ -0,0 +1,260 @@ +/*- + * ============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.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* + +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInstance +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.domain.CompareModelsResult +import org.onap.so.bpmn.core.domain.ResourceModelInfo +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.rest.APIResponse; +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig + + +import java.util.List +import java.util.Map +import java.util.UUID; +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject; +import org.json.JSONArray; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; + +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource +/** + * This groovy class supports the DoCompareModelofE2EServiceInstance.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId + * @param - subscriptionServiceType + * @param - serviceInstanceId + * @param - modelInvariantIdTarget + * @param - modelVersionIdTarget + * + * Outputs: + * @param - compareModelsResult CompareModelsResult + + */ +public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProcessor { + + String Prefix="DCMPMDSI_" + private static final String DebugFlag = "isDebugEnabled" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + + def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO","Entered " + method, isDebugEnabled) + String msg = "" + utils.log("INFO"," ***** Enter DoCompareModelofE2EServiceInstance preProcessRequest *****", isDebugEnabled) + + execution.setVariable("prefix", Prefix) + //Inputs + + //subscriberInfo. for AAI GET + String globalSubscriberId = execution.getVariable("globalSubscriberId") + utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled) + + String serviceType = execution.getVariable("serviceType") + utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled) + + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + if (isBlank(serviceType)) { + msg = "Input serviceType is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)){ + msg = "Input serviceInstanceId is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String modelInvariantUuid = execution.getVariable("modelInvariantIdTarget") + if (isBlank(modelInvariantUuid)){ + msg = "Input modelInvariantUuid is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String modelUuid = execution.getVariable("modelVersionIdTarget") + if (isBlank(modelUuid)){ + msg = "Input modelUuid is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + // Set Target Template info + execution.setVariable("model-invariant-id-target", modelInvariantUuid) + execution.setVariable("model-version-id-target", modelUuid) + + + utils.log("INFO", "Exited " + method, isDebugEnabled) + } + + public void postProcessAAIGET(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) + String msg = "" + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + String serviceType = "" + + if(foundInAAI){ + utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) + + String siData = execution.getVariable("GENGS_service") + utils.log("INFO", "SI Data", isDebugEnabled) + if (isBlank(siData)) + { + msg = "Could not retrive ServiceInstance data from AAI, Id:" + serviceInstanceId + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + else + { + utils.log("INFO", "SI Data" + siData, isDebugEnabled) + + // Get Template uuid and version + if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) { + utils.log("INFO", "SI Data model-invariant-id and model-version-id exist", isDebugEnabled) + + def modelInvariantId = utils.getNodeText(siData, "model-invariant-id") + def modelVersionId = utils.getNodeText(siData, "model-version-id") + + // Set Original Template info + execution.setVariable("model-invariant-id-original", modelInvariantId) + execution.setVariable("model-version-id-original", modelVersionId) + } + } + }else{ + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(!succInAAI){ + utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + + utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) + } + }catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit postProcessAAIGET ") + } + + public void postCompareModelVersions(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + + List addResourceList = execution.getVariable("addResourceList") + List delResourceList = execution.getVariable("delResourceList") + + CompareModelsResult cmpResult = new CompareModelsResult() + List addedResourceList = new ArrayList() + List deletedResourceList = new ArrayList() + + + String serviceModelUuid = execution.getVariable("model-version-id-target") + List requestInputs = new ArrayList() + ModelInfo mi = null; + for(Resource rc : addResourceList) { + mi = rc.getModelInfo() + String resourceCustomizationUuid = mi.getModelCustomizationUuid() + ResourceModelInfo rmodel = new ResourceModelInfo() + rmodel.setResourceName(mi.getModelName()) + rmodel.setResourceInvariantUuid(mi.getModelInvariantUuid()) + rmodel.setResourceUuid(mi.getModelUuid()) + rmodel.setResourceCustomizationUuid(resourceCustomizationUuid) + addedResourceList.add(rmodel) + + Map resourceParameters = ResourceRequestBuilder.buildResouceRequest(serviceModelUuid, resourceCustomizationUuid, null) + requestInputs.addAll(resourceParameters.keySet()) + } + + for(Resource rc : delResourceList) { + mi = rc.getModelInfo() + String resourceCustomizationUuid = mi.getModelCustomizationUuid() + ResourceModelInfo rmodel = new ResourceModelInfo() + rmodel.setResourceName(mi.getModelName()) + rmodel.setResourceInvariantUuid(mi.getModelInvariantUuid()) + rmodel.setResourceUuid(mi.getModelUuid()) + rmodel.setResourceCustomizationUuid(resourceCustomizationUuid) + deletedResourceList.add(rmodel) + } + + cmpResult.setAddedResourceList(addedResourceList) + cmpResult.setDeletedResourceList(deletedResourceList) + cmpResult.setRequestInputs(requestInputs) + + execution.setVariable("compareModelsResult", cmpResult) + } + +} + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy new file mode 100644 index 0000000000..bb48671e73 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -0,0 +1,451 @@ +/*- + * ============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.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.CatalogDbUtils; +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.springframework.web.util.UriUtils; + +import groovy.json.* + + + +/** + * This groovy class supports the DoCreateServiceInstance.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId + * @param - subscriptionServiceType + * @param - serviceInstanceId + * @param - serviceInstanceName - O + * @param - serviceModelInfo + * @param - productFamilyId + * @param - disableRollback + * @param - failExists - TODO + * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) + * @param - sdncVersion ("1610") + * @param - serviceDecomposition - Decomposition for R1710 + * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored) + * + * Outputs: + * @param - rollbackData (localRB->null) + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * @param - WorkflowException + * @param - serviceInstanceName - (GET from AAI if null in input) + * + */ +public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateE2EServiceInstance.class); + + + String Prefix="DCRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + CatalogDbUtils cutils = new CatalogDbUtils() + + public void preProcessRequest (DelegateExecution execution) { + String msg = "" + msoLogger.trace("preProcessRequest ") + + try { + execution.setVariable("prefix", Prefix) + //Inputs + //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology + String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + msoLogger.info(" ***** globalSubscriberId *****" + globalSubscriberId) + //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology + String serviceType = execution.getVariable("serviceType") + msoLogger.info(" ***** serviceType *****" + serviceType) + //requestDetails.requestParameters. for SDNC assignTopology + String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId + + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId is null" + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + if (isBlank(serviceType)) { + msg = "Input serviceType is null" + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + if (productFamilyId == null) { + execution.setVariable("productFamilyId", "") + } + + String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') + if (isBlank(sdncCallbackUrl)) { + msg = "URN_mso_workflow_sdncadapter_callback is null" + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + msoLogger.info("SDNC Callback URL: " + sdncCallbackUrl) + + //requestDetails.modelInfo.for AAI PUT servieInstanceData + //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String uuiRequest = execution.getVariable("uuiRequest") + String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") + String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") + String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName") + execution.setVariable("serviceModelName", serviceModelName) + //aai serviceType and Role can be setted as fixed value now. + String aaiServiceType = "E2E Service" + String aaiServiceRole = "E2E Service" + + execution.setVariable("modelInvariantUuid", modelInvariantUuid) + execution.setVariable("modelUuid", modelUuid) + + //AAI PUT + String oStatus = execution.getVariable("initialStatus") ?: "" + if ("TRANSPORT".equalsIgnoreCase(serviceType)) + { + oStatus = "Created" + } + + String statusLine = isBlank(oStatus) ? "" : "${MsoUtils.xmlEscape(oStatus)}" + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) + String serviceInstanceData = + """ + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(serviceInstanceName)} + ${MsoUtils.xmlEscape(aaiServiceType)} + ${MsoUtils.xmlEscape(aaiServiceRole)} + ${statusLine} + ${MsoUtils.xmlEscape(modelInvariantUuid)} + ${MsoUtils.xmlEscape(modelUuid)} + """.trim() + execution.setVariable("serviceInstanceData", serviceInstanceData) + msoLogger.debug(serviceInstanceData) + msoLogger.info(" aai_uri " + aai_uri + " namespace:" + namespace) + msoLogger.info(" 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest ") + } + + public void prepareDecomposeService(DelegateExecution execution) { + try { + msoLogger.trace("Inside prepareDecomposeService of create generic e2e service ") + String modelInvariantUuid = execution.getVariable("modelInvariantUuid") + String modelUuid = execution.getVariable("modelUuid") + //here modelVersion is not set, we use modelUuid to decompose the service. + String serviceModelInfo = """{ + "modelInvariantUuid":"${modelInvariantUuid}", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + execution.setVariable("serviceModelInfo", serviceModelInfo) + + msoLogger.trace("Completed prepareDecomposeService of create generic e2e service ") + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void processDecomposition(DelegateExecution execution) { + msoLogger.trace("Inside processDecomposition() of create generic e2e service flow ") + try { + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void doServicePreOperation(DelegateExecution execution){ + //we need a service plugin platform here. + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + String uuiRequest = execution.getVariable("uuiRequest") + String newUuiRequest = ServicePluginFactory.getInstance().preProcessService(serviceDecomposition, uuiRequest); + execution.setVariable("uuiRequest", newUuiRequest) + } + + public void doServiceHoming(DelegateExecution execution) { + //we need a service plugin platform here. + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + String uuiRequest = execution.getVariable("uuiRequest") + String newUuiRequest = ServicePluginFactory.getInstance().doServiceHoming(serviceDecomposition, uuiRequest); + execution.setVariable("uuiRequest", newUuiRequest) + } + + public void postProcessAAIGET(DelegateExecution execution) { + msoLogger.trace("postProcessAAIGET ") + String msg = "" + + try { + String serviceInstanceName = execution.getVariable("serviceInstanceName") + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(!succInAAI){ + msoLogger.info("Error getting Service-instance from AAI", + serviceInstanceName) + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + else + { + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + if(foundInAAI){ + msoLogger.info("Found Service-instance in AAI") + msg = "ServiceInstance already exists in AAI:" + serviceInstanceName + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit postProcessAAIGET ") + } + + public void postProcessAAIPUT(DelegateExecution execution) { + msoLogger.trace("postProcessAAIPUT ") + String msg = "" + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator") + if(!succInAAI){ + msoLogger.info("Error putting Service-instance in AAI", + serviceInstanceId) + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + } + else + { + //start rollback set up + RollbackData rollbackData = new RollbackData() + def disableRollback = execution.getVariable("disableRollback") + rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) + rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") + rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId) + rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType")) + rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) + execution.setVariable("rollbackData", rollbackData) + } + + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit postProcessAAIPUT ") + } + + public void postProcessAAIGET2(DelegateExecution execution) { + msoLogger.trace("postProcessAAIGET2 ") + String msg = "" + + try { + String serviceInstanceName = execution.getVariable("serviceInstanceName") + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(!succInAAI){ + msoLogger.info("Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName) + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + else + { + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + if(foundInAAI){ + String aaiService = execution.getVariable("GENGS_service") + if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) { + execution.setVariable("serviceInstanceName", utils.getNodeText(aaiService, "service-instance-name")) + msoLogger.info("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName")) + } + } + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit postProcessAAIGET2 ") + } + + public void preProcessRollback (DelegateExecution execution) { + msoLogger.trace("preProcessRollback ") + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + msoLogger.info("Prev workflowException: " + workflowException.getErrorMessage()) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + msoLogger.info("BPMN Error during preProcessRollback") + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + msoLogger.info(msg) + } + msoLogger.trace("Exit preProcessRollback ") + } + + public void postProcessRollback (DelegateExecution execution) { + msoLogger.trace("postProcessRollback ") + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + msoLogger.info("Setting prevException to WorkflowException: ") + execution.setVariable("WorkflowException", workflowException); + } + execution.setVariable("rollbackData", null) + } catch (BpmnError b) { + msoLogger.info("BPMN Error during postProcessRollback") + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + msoLogger.info(msg) + } + msoLogger.trace("Exit postProcessRollback ") + } + + public void preInitResourcesOperStatus(DelegateExecution execution){ + msoLogger.trace("STARTED preInitResourcesOperStatus Process ") + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = execution.getVariable("operationType") + String resourceTemplateUUIDs = "" + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service creation" + msoLogger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + List resourceList = serviceDecomposition.getServiceResources() + + for(Resource resource : resourceList){ + resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" + } + + def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) + + String payload = + """ + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(operationId)} + ${MsoUtils.xmlEscape(operationType)} + ${MsoUtils.xmlEscape(resourceTemplateUUIDs)} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_initResOperStatusRequest", payload) + msoLogger.info("Outgoing initResourceOperationStatus: \n" + payload) + msoLogger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preInitResourcesOperStatus Process ") + } + + // prepare input param for using DoCreateResources.bpmn + public void preProcessForAddResource(DelegateExecution execution) { + msoLogger.trace("STARTED preProcessForAddResource Process ") + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + List addResourceList = serviceDecomposition.getServiceResources() + execution.setVariable("addResourceList", addResourceList) + + msoLogger.trace("COMPLETED preProcessForAddResource Process ") + } + + public void postProcessForAddResource(DelegateExecution execution) { + // do nothing now + + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy new file mode 100644 index 0000000000..05a0ea86d3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy @@ -0,0 +1,268 @@ +/*- + * ============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.bpmn.infrastructure.scripts + + +import static org.apache.commons.lang3.StringUtils.*; + +import groovy.xml.XmlUtil +import groovy.json.* + +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.rest.APIResponse; +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.logger.MsoLogger +import org.onap.so.logger.MessageEnum + +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; +/** + * This groovy class supports the DoCreateServiceInstanceRollback.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - rollbackData with + * globalCustomerId + * subscriptionServiceType + * serviceInstanceId + * disableRollback + * rollbackAAI + * rollbackSDNC + * sdncRollbackRequest + * + * + * Outputs: + * @param - rollbackError + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * + */ +public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProcessor{ + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateE2EServiceInstanceRollback.class); + String Prefix="DCRESIRB_" + + public void preProcessRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + msoLogger.trace("Start preProcessRequest") + execution.setVariable("rollbackAAI",false) + execution.setVariable("rollbackSDNC",false) + + try { + def rollbackData = execution.getVariable("rollbackData") + msoLogger.debug("RollbackData:" + rollbackData) + + if (rollbackData != null) { + if (rollbackData.hasType("SERVICEINSTANCE")) { + + def serviceInstanceId = rollbackData.get("SERVICEINSTANCE", "serviceInstanceId") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + def subscriptionServiceType = rollbackData.get("SERVICEINSTANCE", "subscriptionServiceType") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + + def globalSubscriberId = rollbackData.get("SERVICEINSTANCE", "globalSubscriberId") + execution.setVariable("globalSubscriberId", globalSubscriberId) + + def rollbackAAI = rollbackData.get("SERVICEINSTANCE", "rollbackAAI") + if ("true".equals(rollbackAAI)) + { + execution.setVariable("rollbackAAI",true) + } + + def rollbackSDNC = rollbackData.get("SERVICEINSTANCE", "rollbackSDNC") + if ("true".equals(rollbackSDNC)) + { + execution.setVariable("rollbackSDNC", true) + } + + if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackSDNC") != true) + { + execution.setVariable("skipRollback", true) + } + + def sdncDelete = rollbackData.get("SERVICEINSTANCE", "sdncDelete") + execution.setVariable("sdncDelete", sdncDelete) + def sdncDeactivate = rollbackData.get("SERVICEINSTANCE", "sdncDeactivate") + execution.setVariable("sdncDeactivate", sdncDeactivate) + msoLogger.debug("sdncDeactivate:\n" + sdncDeactivate) + msoLogger.debug("sdncDelete:\n" + sdncDelete) + } + else { + execution.setVariable("skipRollback", true) + } + } + else { + execution.setVariable("skipRollback", true) + } + if (execution.getVariable("disableRollback").equals("true" )) + { + execution.setVariable("skipRollback", true) + } + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in Create ServiceInstance Rollback preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) //TODO how does this even compile without exceptionUtil being declared + } + msoLogger.trace("Exit preProcessRequest ") + } + + public void validateSDNCResponse(DelegateExecution execution, String response, String method) { + + msoLogger.trace("validateSDNCResponse") + String msg = "" + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + msoLogger.debug("SDNCResponse: " + response) + msoLogger.debug("workflowException: " + workflowException) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msg = "SDNC Adapter service-instance rollback successful for " + method + msoLogger.debug(msg) + }else{ + execution.setVariable("rolledBack", false) + msg = "Error Response from SDNC Adapter service-instance rollback for " + method + execution.setVariable("rollbackError", msg) + msoLogger.debug(msg) + throw new BpmnError("MSOWorkflowException") + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in Create ServiceInstance rollback for " + method + " Exception:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit validateSDNCResponse ") + } + + /** + * Deletes the service instance in aai + */ + public void deleteServiceInstance(DelegateExecution execution) { + msoLogger.trace("Started Delete Service Instance") + try { + String globalCustId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("subscriptionServiceType") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + AAIResourcesClient resourceClient = new AAIResourcesClient(); + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId) + resourceClient.delete(serviceInstanceUri) + + msoLogger.trace("Completed Delete Service Instance") + }catch(Exception e){ + msoLogger.debug("Error occured within deleteServiceInstance method: " + e) + } + } + + public void postProcessRequest(DelegateExecution execution) { + + msoLogger.trace("postProcessRequest") + String msg = "" + try { + execution.setVariable("rollbackData", null) + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean rollbackAAI = execution.getVariable("rollbackAAI") + boolean rollbackSDNC = execution.getVariable("rollbackSDNC") + if (rollbackAAI || rollbackSDNC) + { + execution.setVariable("rolledBack", true) + } + if (rollbackAAI) + { + boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator") + if(!succInAAI){ + execution.setVariable("rolledBack", false) //both sdnc and aai must be successful to declare rollback Succesful + execution.setVariable("rollbackError", "Error deleting service-instance in AAI for rollback") + msoLogger.debug("Error deleting service-instance in AAI for rollback", + serviceInstanceId) + } + } + msoLogger.trace("Exit postProcessRequest ") + + } catch (BpmnError e) { + msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + e.getMessage() + msoLogger.debug(msg) + } catch (Exception ex) { + msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + ex.getMessage() + msoLogger.debug(msg) + } + + } + + public void processRollbackException(DelegateExecution execution){ + + msoLogger.trace("processRollbackException") + try{ + msoLogger.debug("Caught an Exception in DoCreateServiceInstanceRollback") + execution.setVariable("rollbackData", null) + execution.setVariable("rollbackError", "Caught exception in ServiceInstance Create Rollback") + execution.setVariable("WorkflowException", null) + + }catch(BpmnError b){ + msoLogger.debug("BPMN Error during processRollbackExceptions Method: ") + }catch(Exception e){ + msoLogger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage()) + } + + msoLogger.trace(" Exit processRollbackException") + } + + public void processRollbackJavaException(DelegateExecution execution){ + + msoLogger.trace("processRollbackJavaException") + try{ + execution.setVariable("rollbackData", null) + execution.setVariable("rollbackError", "Caught Java exception in ServiceInstance Create Rollback") + msoLogger.debug("Caught Exception in processRollbackJavaException") + + }catch(Exception e){ + msoLogger.debug("Caught Exception in processRollbackJavaException " + e.getMessage()) + } + msoLogger.trace("Exit processRollbackJavaException") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy new file mode 100644 index 0000000000..4bbaef8ecb --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy @@ -0,0 +1,1680 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.NetworkUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse; +import org.springframework.web.util.UriUtils + +import groovy.json.* +import groovy.xml.XmlUtil + + +/** + * This groovy class supports the DoCreateNetworkInstance.bpmn process. + * + */ +public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateNetworkInstance.class); + + String Prefix="CRENWKI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + NetworkUtils networkUtils = new NetworkUtils() + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + def className = getClass().getSimpleName() + + /** + * This method is executed during the preProcessRequest task of the DoCreateNetworkInstance.bpmn process. + * @param execution + */ + public InitializeProcessVariables(DelegateExecution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable(Prefix + "networkRequest", "") + execution.setVariable(Prefix + "rollbackEnabled", null) + execution.setVariable(Prefix + "networkInputs", "") + //execution.setVariable(Prefix + "requestId", "") + execution.setVariable(Prefix + "messageId", "") + execution.setVariable(Prefix + "source", "") + execution.setVariable("BasicAuthHeaderValuePO", "") + execution.setVariable("BasicAuthHeaderValueSDNC", "") + execution.setVariable(Prefix + "serviceInstanceId","") + execution.setVariable("GENGS_type", "") + execution.setVariable(Prefix + "rsrc_endpoint", null) + execution.setVariable(Prefix + "networkOutputs", "") + execution.setVariable(Prefix + "networkId","") + execution.setVariable(Prefix + "networkName","") + + // AAI query Name + execution.setVariable(Prefix + "queryNameAAIRequest","") + execution.setVariable(Prefix + "queryNameAAIResponse", "") + execution.setVariable(Prefix + "aaiNameReturnCode", "") + execution.setVariable(Prefix + "isAAIqueryNameGood", false) + + // AAI query Cloud Region + execution.setVariable(Prefix + "queryCloudRegionRequest","") + execution.setVariable(Prefix + "queryCloudRegionReturnCode","") + execution.setVariable(Prefix + "queryCloudRegionResponse","") + execution.setVariable(Prefix + "cloudRegionPo","") + execution.setVariable(Prefix + "cloudRegionSdnc","") + execution.setVariable(Prefix + "isCloudRegionGood", false) + + // AAI query Id + execution.setVariable(Prefix + "queryIdAAIRequest","") + execution.setVariable(Prefix + "queryIdAAIResponse", "") + execution.setVariable(Prefix + "aaiIdReturnCode", "") + + // AAI query vpn binding + execution.setVariable(Prefix + "queryVpnBindingAAIRequest","") + execution.setVariable(Prefix + "queryVpnBindingAAIResponse", "") + execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "") + execution.setVariable(Prefix + "vpnBindings", null) + execution.setVariable(Prefix + "vpnCount", 0) + execution.setVariable(Prefix + "routeCollection", "") + + // AAI query network policy + execution.setVariable(Prefix + "queryNetworkPolicyAAIRequest","") + execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", "") + execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "") + execution.setVariable(Prefix + "networkPolicyUriList", null) + execution.setVariable(Prefix + "networkPolicyCount", 0) + execution.setVariable(Prefix + "networkCollection", "") + + // AAI query route table reference + execution.setVariable(Prefix + "queryNetworkTableRefAAIRequest","") + execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", "") + execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "") + execution.setVariable(Prefix + "networkTableRefUriList", null) + execution.setVariable(Prefix + "networkTableRefCount", 0) + execution.setVariable(Prefix + "tableRefCollection", "") + + // AAI requery Id + execution.setVariable(Prefix + "requeryIdAAIRequest","") + execution.setVariable(Prefix + "requeryIdAAIResponse", "") + execution.setVariable(Prefix + "aaiRequeryIdReturnCode", "") + + // AAI update contrail + execution.setVariable(Prefix + "updateContrailAAIUrlRequest","") + execution.setVariable(Prefix + "updateContrailAAIPayloadRequest","") + execution.setVariable(Prefix + "updateContrailAAIResponse", "") + execution.setVariable(Prefix + "aaiUpdateContrailReturnCode", "") + + execution.setVariable(Prefix + "createNetworkRequest", "") + execution.setVariable(Prefix + "createNetworkResponse", "") + execution.setVariable(Prefix + "rollbackNetworkRequest", "") + //execution.setVariable(Prefix + "rollbackNetworkResponse", "") + execution.setVariable(Prefix + "networkReturnCode", "") + //execution.setVariable(Prefix + "rollbackNetworkReturnCode", "") + execution.setVariable(Prefix + "isNetworkRollbackNeeded", false) + + execution.setVariable(Prefix + "assignSDNCRequest", "") + execution.setVariable(Prefix + "assignSDNCResponse", "") + execution.setVariable(Prefix + "rollbackSDNCRequest", "") + //execution.setVariable(Prefix + "rollbackSDNCResponse", "") + execution.setVariable(Prefix + "sdncReturnCode", "") + //execution.setVariable(Prefix + "rollbackSDNCReturnCode", "") + execution.setVariable(Prefix + "isSdncRollbackNeeded", false) + execution.setVariable(Prefix + "sdncResponseSuccess", false) + + execution.setVariable(Prefix + "activateSDNCRequest", "") + execution.setVariable(Prefix + "activateSDNCResponse", "") + execution.setVariable(Prefix + "rollbackActivateSDNCRequest", "") + //execution.setVariable(Prefix + "rollbackActivateSDNCResponse", "") + execution.setVariable(Prefix + "sdncActivateReturnCode", "") + //execution.setVariable(Prefix + "rollbackActivateSDNCReturnCode", "") + execution.setVariable(Prefix + "isSdncActivateRollbackNeeded", false) + execution.setVariable(Prefix + "sdncActivateResponseSuccess", false) + + execution.setVariable(Prefix + "orchestrationStatus", "") + execution.setVariable(Prefix + "isVnfBindingPresent", false) + execution.setVariable(Prefix + "Success", false) + + execution.setVariable(Prefix + "isException", false) + + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the DoCreateNetworkInstance.bpmn process. + * @param execution + */ + public void preProcessRequest (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + msoLogger.trace("Inside preProcessRequest() of " + className + ".groovy") + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + // GET Incoming request & validate 3 kinds of format. + execution.setVariable("action", "CREATE") + String networkRequest = execution.getVariable("bpmnRequest") + if (networkRequest != null) { + if (networkRequest.contains("requestDetails")) { + // JSON format request is sent, create xml + try { + def prettyJson = JsonOutput.prettyPrint(networkRequest.toString()) + msoLogger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson) + networkRequest = vidUtils.createXmlNetworkRequestInfra(execution, networkRequest) + + } catch (Exception ex) { + String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + } else { + // XML format request is sent + + } + } else { + // vIPR format request is sent, create xml from individual variables + networkRequest = vidUtils.createXmlNetworkRequestInstance(execution) + } + + networkRequest = utils.formatXml(networkRequest) + execution.setVariable(Prefix + "networkRequest", networkRequest) + msoLogger.debug(Prefix + "networkRequest - " + '\n' + networkRequest) + + // validate 'backout-on-failure' to override 'mso.rollback' + boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, networkRequest) + execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled) + msoLogger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled) + + String networkInputs = utils.getNodeXml(networkRequest, "network-inputs", false).replace("tag0:","").replace(":tag0","") + execution.setVariable(Prefix + "networkInputs", networkInputs) + msoLogger.debug(Prefix + "networkInputs - " + '\n' + networkInputs) + + // prepare messageId + String messageId = execution.getVariable("testMessageId") // for testing + if (messageId == null || messageId == "") { + messageId = UUID.randomUUID() + msoLogger.debug(Prefix + "messageId, random generated: " + messageId) + } else { + msoLogger.debug(Prefix + "messageId, pre-assigned: " + messageId) + } + execution.setVariable(Prefix + "messageId", messageId) + + String source = utils.getNodeText(networkRequest, "source") + execution.setVariable(Prefix + "source", source) + msoLogger.debug(Prefix + "source - " + source) + + // validate cloud region + String lcpCloudRegionId = utils.getNodeText(networkRequest, "aic-cloud-region") + if ((lcpCloudRegionId == null) || (lcpCloudRegionId == "") || (lcpCloudRegionId == "null")) { + String dataErrorMessage = "Missing value/element: 'lcpCloudRegionId' or 'cloudConfiguration' or 'aic-cloud-region'." + msoLogger.debug(" Invalid Request - " + dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + // validate service instance id + String serviceInstanceId = utils.getNodeText(networkRequest, "service-instance-id") + if ((serviceInstanceId == null) || (serviceInstanceId == "") || (serviceInstanceId == "null")) { + String dataErrorMessage = "Missing value/element: 'serviceInstanceId'." + msoLogger.debug(" Invalid Request - " + dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + // PO Authorization Info / headers Authorization= + String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution) + + try { + def encodedString = utils.getBasicAuth(basicAuthValuePO, UrnPropertiesReader.getVariable("mso.msoKey",execution)) + execution.setVariable("BasicAuthHeaderValuePO",encodedString) + execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) + + } catch (IOException ex) { + String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " + String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + // Set variables for Generic Get Sub Flow use + execution.setVariable(Prefix + "serviceInstanceId", serviceInstanceId) + msoLogger.debug(Prefix + "serviceInstanceId - " + serviceInstanceId) + + execution.setVariable("GENGS_type", "service-instance") + msoLogger.debug("GENGS_type - " + "service-instance") + msoLogger.debug(" Url for SDNC adapter: " + UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint",execution)) + + String sdncVersion = execution.getVariable("sdncVersion") + msoLogger.debug("sdncVersion? : " + sdncVersion) + + // build 'networkOutputs' + String networkId = utils.getNodeText(networkRequest, "network-id") + if ((networkId == null) || (networkId == "null")) { + networkId = "" + } + String networkName = utils.getNodeText(networkRequest, "network-name") + if ((networkName == null) || (networkName == "null")) { + networkName = "" + } + String networkOutputs = + """ + ${MsoUtils.xmlEscape(networkId)} + ${MsoUtils.xmlEscape(networkName)} + """ + execution.setVariable(Prefix + "networkOutputs", networkOutputs) + msoLogger.debug(Prefix + "networkOutputs - " + '\n' + networkOutputs) + execution.setVariable(Prefix + "networkId", networkId) + execution.setVariable(Prefix + "networkName", networkName) + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + sendSyncError(execution) + // caught exception + String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAINetworkName (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.debug(" ***** Inside callRESTQueryAAINetworkName() of DoCreateNetworkInstance ***** " ) + + // get variables + String networkInputs = execution.getVariable(Prefix + "networkInputs") + String networkName = utils.getNodeText(networkInputs, "network-name") + networkName = UriUtils.encode(networkName,"UTF-8") + + // Prepare AA&I url with network-name + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String queryAAINameRequest = "${aai_endpoint}${aai_uri}" + "?network-name=" + networkName + execution.setVariable(Prefix + "queryNameAAIRequest", queryAAINameRequest) + msoLogger.debug(Prefix + "queryNameAAIRequest - " + "\n" + queryAAINameRequest) + + try { + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryAAINameRequest) + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiNameReturnCode", returnCode) + msoLogger.debug(" ***** AAI Query Name Response Code : " + returnCode) + + String aaiResponseAsString = response.getResponseBodyAsString() + msoLogger.debug(" ***** AAI Query Name Response : " +'\n'+ aaiResponseAsString) + + if (returnCode=='200') { + execution.setVariable(Prefix + "queryNameAAIResponse", aaiResponseAsString) + execution.setVariable(Prefix + "isAAIqueryNameGood", true) + String orchestrationStatus = "" + try { + // response is NOT empty + orchestrationStatus = utils.getNodeText(aaiResponseAsString, "orchestration-status") + execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus.toUpperCase()) + msoLogger.debug(Prefix + "orchestrationStatus - " + orchestrationStatus.toUpperCase()) + execution.setVariable("orchestrationStatus", orchestrationStatus) + + } catch (Exception ex) { + // response is empty + execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus) + msoLogger.debug(Prefix + "orchestrationStatus - " + orchestrationStatus) + } + + } else { + if (returnCode=='404') { + msoLogger.debug(" QueryAAINetworkName return code = '404' (Not Found). Proceed with the Create !!! ") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Error Response from QueryAAINetworkName - " + returnCode + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildWorkflowException(execution, 2500, dataErrorMessage) + + } + + } + + msoLogger.debug(Prefix + "isAAIqueryNameGood? : " + execution.getVariable(Prefix + "isAAIqueryNameGood")) + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + // try error + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow - callRESTQueryAAINetworkName() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAICloudRegion (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.debug(" ***** Inside callRESTQueryAAICloudRegion() of DoCreateNetworkInstance ***** " ) + + try { + String networkInputs = execution.getVariable(Prefix + "networkInputs") + String cloudRegion = utils.getNodeText(networkInputs, "aic-cloud-region") + cloudRegion = UriUtils.encode(cloudRegion,"UTF-8") + + // Prepare AA&I url + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUtil = new AaiUtil(this) + String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) + String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion + execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest) + msoLogger.debug(Prefix + "queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest) + + String cloudRegionPo = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) + String cloudRegionSdnc = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "SDNC", cloudRegion) + + if ((cloudRegionPo != "ERROR") && (cloudRegionSdnc != "ERROR")) { + execution.setVariable(Prefix + "cloudRegionPo", cloudRegionPo) + execution.setVariable(Prefix + "cloudRegionSdnc", cloudRegionSdnc) + execution.setVariable(Prefix + "isCloudRegionGood", true) + + } else { + String dataErrorMessage = "QueryAAICloudRegion Unsuccessful. Return Code: " + execution.getVariable(Prefix + "queryCloudRegionReturnCode") + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + + msoLogger.debug(" is Cloud Region Good: " + execution.getVariable(Prefix + "isCloudRegionGood")) + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + // try error + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow - callRESTQueryAAICloudRegion() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAINetworkId(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.debug(" ***** Inside callRESTQueryAAINetworkId() of DoCreateNetworkInstance ***** " ) + + try { + // get variables + String networkId = "" + String assignSDNCResponse = execution.getVariable(Prefix + "assignSDNCResponse") + if (execution.getVariable("sdncVersion") != "1610") { + String networkResponseInformation = "" + try { + networkResponseInformation = utils.getNodeXml(assignSDNCResponse, "network-response-information", false).replace("tag0:","").replace(":tag0","") + networkId = utils.getNodeText(networkResponseInformation, "instance-id") + } catch (Exception ex) { + String dataErrorMessage = " SNDC Response network validation for 'instance-id' (network-id) failed: Empty " + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + } else { + networkId = utils.getNodeText(assignSDNCResponse, "network-id") + } + if (networkId == null || networkId == "null") { + String dataErrorMessage = "SNDC Response did not contains 'instance-id' or 'network-id' element, or the value is null." + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } else { + msoLogger.debug(" SNDC Response network validation for 'instance-id' (network-id)' is good: " + networkId) + } + + + execution.setVariable(Prefix + "networkId", networkId) + String networkName = utils.getNodeText(assignSDNCResponse, "network-name") + execution.setVariable(Prefix + "networkName", networkName) + + networkId = UriUtils.encode(networkId,"UTF-8") + + // Prepare AA&I url + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String queryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" + execution.setVariable(Prefix + "queryIdAAIRequest", queryIdAAIRequest) + msoLogger.debug(Prefix + "queryIdAAIRequest - " + "\n" + queryIdAAIRequest) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryIdAAIRequest) + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiIdReturnCode", returnCode) + + msoLogger.debug(" ***** AAI Response Code : " + returnCode) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (returnCode=='200') { + execution.setVariable(Prefix + "queryIdAAIResponse", aaiResponseAsString) + msoLogger.debug(" QueryAAINetworkId Success REST Response - " + "\n" + aaiResponseAsString) + + String netId = utils.getNodeText(aaiResponseAsString, "network-id") + execution.setVariable(Prefix + "networkId", netId) + String netName = utils.getNodeText(aaiResponseAsString, "network-name") + execution.setVariable(Prefix + "networkName", netName) + + } else { + if (returnCode=='404') { + String dataErrorMessage = "Response Error from QueryAAINetworkId is 404 (Not Found)." + msoLogger.debug(" AAI Query Failed. " + dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from QueryAAINetworkId - " + returnCode + msoLogger.debug("Unexpected Response from QueryAAINetworkId - " + dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkId() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTReQueryAAINetworkId(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.debug(" ***** Inside callRESTReQueryAAINetworkId() of DoCreateNetworkInstance ***** " ) + + try { + // get variables + String networkId = execution.getVariable(Prefix + "networkId") + String netId = networkId + networkId = UriUtils.encode(networkId,"UTF-8") + + // Prepare AA&I url + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String requeryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" + execution.setVariable(Prefix + "requeryIdAAIRequest", requeryIdAAIRequest) + msoLogger.debug(Prefix + "requeryIdAAIRequest - " + "\n" + requeryIdAAIRequest) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, requeryIdAAIRequest) + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiRequeryIdReturnCode", returnCode) + msoLogger.debug(" ***** AAI ReQuery Response Code : " + returnCode) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (returnCode=='200') { + execution.setVariable(Prefix + "requeryIdAAIResponse", aaiResponseAsString) + msoLogger.debug(" ReQueryAAINetworkId Success REST Response - " + "\n" + aaiResponseAsString) + + String netName = utils.getNodeText(aaiResponseAsString, "network-name") + String networkOutputs = + """ + ${MsoUtils.xmlEscape(netId)} + ${MsoUtils.xmlEscape(netName)} + """ + execution.setVariable(Prefix + "networkOutputs", networkOutputs) + msoLogger.debug(" networkOutputs - " + '\n' + networkOutputs) + + } else { + if (returnCode=='404') { + String dataErrorMessage = "Response Error from ReQueryAAINetworkId is 404 (Not Found)." + msoLogger.debug(" AAI ReQuery Failed. - " + dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from ReQueryAAINetworkId - " + returnCode + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTReQueryAAINetworkId() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAINetworkVpnBinding(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.debug(" ***** Inside callRESTQueryAAINetworkVpnBinding() of DoCreateNetworkInstance ***** " ) + + try { + + // get variables + String queryIdAAIResponse = execution.getVariable(Prefix + "queryIdAAIResponse").replace('', "") + String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") + msoLogger.debug(" relationship - " + relationship) + + // Check if Vnf Binding is present, then build a List of vnfBinding + List vpnBindingUri = networkUtils.getVnfBindingObject(relationship) + int vpnCount = vpnBindingUri.size() + execution.setVariable(Prefix + "vpnCount", vpnCount) + msoLogger.debug(Prefix + "vpnCount - " + vpnCount) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + + if (vpnCount > 0) { + execution.setVariable(Prefix + "vpnBindings", vpnBindingUri) + msoLogger.debug(" vpnBindingUri List - " + vpnBindingUri) + + String routeTargets = "" + // AII loop call using list vpnBindings + for (i in 0..vpnBindingUri.size()-1) { + + int counting = i+1 + + // prepare url using vpnBinding + String queryVpnBindingAAIRequest = "" + String aai_uri = aaiUriUtil.getNetworkVpnBindingUri(execution) + + // Note: By default, the vpnBinding url is found in 'related-link' of the response, + // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. + if (aai_uri == null || aai_uri == "") { + // using value of 'related-link' from response + if (vpnBindingUri[i].charAt(vpnBindingUri[i].length()-1) == '/') { + queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i].substring(0, vpnBindingUri[i].length()-1) + "?depth=all" + } else { + queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i] + "?depth=all" + } + + } else { + // using uri value in URN mapping + String vpnBindingId = vpnBindingUri[i].substring(vpnBindingUri[i].indexOf("/vpn-binding/")+13, vpnBindingUri[i].length()) + if (vpnBindingId.charAt(vpnBindingId.length()-1) == '/') { + vpnBindingId = vpnBindingId.substring(0, vpnBindingId.length()-1) + } + queryVpnBindingAAIRequest = "${aai_endpoint}${aai_uri}/" + vpnBindingId + "?depth=all" + } + + execution.setVariable(Prefix + "queryVpnBindingAAIRequest", queryVpnBindingAAIRequest) + msoLogger.debug(Prefix + "queryVpnBindingAAIRequest, , vpnBinding #" + counting + " : " + "\n" + queryVpnBindingAAIRequest) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryVpnBindingAAIRequest) + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", returnCode) + msoLogger.debug(" ***** AAI query vpn binding Response Code, vpnBinding #" + counting + " : " + returnCode) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (returnCode=='200') { + execution.setVariable(Prefix + "queryVpnBindingAAIResponse", aaiResponseAsString) + msoLogger.debug(" AAI Query Vpn Binding Success REST Response, , vpnBinding #" + counting + " : " + "\n" + aaiResponseAsString) + + String routeTarget = "" + String routeRole = "" + if (utils.nodeExists(aaiResponseAsString, "route-targets")) { + String aaiRouteTargets = utils.getNodeXml(aaiResponseAsString, "route-targets", false) + def aaiRouteTargetsXml = new XmlSlurper().parseText(aaiRouteTargets) + def aaiRouteTarget = aaiRouteTargetsXml.'**'.findAll {it.name() == "route-target"} + for (j in 0..aaiRouteTarget.size()-1) { + routeTarget = utils.getNodeText(XmlUtil.serialize(aaiRouteTarget[j]), "global-route-target") + routeRole = utils.getNodeText(XmlUtil.serialize(aaiRouteTarget[j]), "route-target-role") + routeTargets += "" + '\n' + + " " + routeTarget + "" + '\n' + + " " + routeRole + "" + '\n' + + "" + '\n' + } + } + + } else { + if (returnCode=='404') { + String dataErrorMessage = "Response Error from AAINetworkVpnBinding is 404 (Not Found)." + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = " Unexpected Response from AAINetworkVpnBinding - " + returnCode + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } // end loop + + execution.setVariable(Prefix + "routeCollection", routeTargets) + msoLogger.debug(Prefix + "routeCollection - " + '\n' + routeTargets) + + } else { + // reset return code to success + execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) + String aaiStubResponse = + """ + + + + """ + String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) + execution.setVariable(Prefix + "queryVpnBindingAAIResponse", aaiStubResponseAsXml) + execution.setVariable(Prefix + "routeCollection", "") + msoLogger.debug(" No vpnBinding, using this stub as response - " + '\n' + aaiStubResponseAsXml) + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkVpnBinding() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAINetworkPolicy(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.debug(" ***** Inside callRESTQueryAAINetworkPolicy() of DoCreateNetworkInstance ***** " ) + + try { + // get variables + String queryIdAAIResponse = execution.getVariable(Prefix + "queryIdAAIResponse").replace('', "") + String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") + msoLogger.debug(" relationship - " + relationship) + + // Check if Network Policy is present, then build a List of network policy + List networkPolicyUriList = networkUtils.getNetworkPolicyObject(relationship) + int networkPolicyCount = networkPolicyUriList.size() + execution.setVariable(Prefix + "networkPolicyCount", networkPolicyCount) + msoLogger.debug(Prefix + "networkPolicyCount - " + networkPolicyCount) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + + if (networkPolicyCount > 0) { + execution.setVariable(Prefix + "networkPolicyUriList", networkPolicyUriList) + msoLogger.debug(" networkPolicyUri List - " + networkPolicyUriList) + + String networkPolicies = "" + // AII loop call using list vpnBindings + for (i in 0..networkPolicyUriList.size()-1) { + + int counting = i+1 + + // prepare url using vpnBinding + String queryNetworkPolicyAAIRequest = "" + + String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) + + // Note: By default, the network policy url is found in 'related-link' of the response, + // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. + if (aai_uri == null || aai_uri == "") { + // using value of 'related-link' from response + if (networkPolicyUriList[i].charAt(networkPolicyUriList[i].length()-1) == '/') { + queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i].substring(0, networkPolicyUriList[i].length()-1) + "?depth=all" + } else { + queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i] + "?depth=all" + } + } else { + // using uri value in URN mapping + String networkPolicyId = networkPolicyUriList[i].substring(networkPolicyUriList[i].indexOf("/network-policy/")+16, networkPolicyUriList[i].length()) + println " networkPolicyId - " + networkPolicyId + if (networkPolicyId.charAt(networkPolicyId.length()-1) == '/') { + networkPolicyId = networkPolicyId.substring(0, networkPolicyId.length()-1) + } + queryNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + networkPolicyId + "?depth=all" + + } + + + execution.setVariable(Prefix + "queryNetworkPolicyAAIRequest", queryNetworkPolicyAAIRequest) + msoLogger.debug(Prefix + "queryNetworkPolicyAAIRequest, , NetworkPolicy #" + counting + " : " + "\n" + queryNetworkPolicyAAIRequest) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkPolicyAAIRequest) + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", returnCode) + msoLogger.debug(" ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (returnCode=='200') { + execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", aaiResponseAsString) + msoLogger.debug(" QueryAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString) + + String networkPolicy = "" + if (utils.nodeExists(aaiResponseAsString, "network-policy-fqdn")) { + networkPolicy = utils.getNodeText(aaiResponseAsString, "network-policy-fqdn") + networkPolicies += "" + networkPolicy + "" + '\n' + } + + } else { + if (returnCode=='404') { + String dataErrorMessage = "Response Error from QueryAAINetworkPolicy is 404 (Not Found)." + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from QueryAAINetworkPolicy - " + returnCode + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } // end loop + + execution.setVariable(Prefix + "networkCollection", networkPolicies) + msoLogger.debug(Prefix + "networkCollection - " + '\n' + networkPolicies) + + } else { + // reset return code to success + execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "200") + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) + String aaiStubResponse = + """ + + + + """ + String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) + execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", aaiStubResponseAsXml) + execution.setVariable(Prefix + "networkCollection", "") + msoLogger.debug(" No net policies, using this stub as response - " + '\n' + aaiStubResponseAsXml) + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkPolicy() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAINetworkTableRef(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.debug(" ***** Inside callRESTQueryAAINetworkTableRef() of DoCreateNetworkInstance ***** " ) + + try { + // get variables + String queryIdAAIResponse = execution.getVariable(Prefix + "queryIdAAIResponse").replace('', "") + String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") + msoLogger.debug(" relationship - " + relationship) + + // Check if Network TableREf is present, then build a List of network policy + List networkTableRefUriList = networkUtils.getNetworkTableRefObject(relationship) + int networkTableRefCount = networkTableRefUriList.size() + execution.setVariable(Prefix + "networkTableRefCount", networkTableRefCount) + msoLogger.debug(Prefix + "networkTableRefCount - " + networkTableRefCount) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + + if (networkTableRefCount > 0) { + execution.setVariable(Prefix + "networkTableRefUriList", networkTableRefUriList) + msoLogger.debug(" networkTableRefUri List - " + networkTableRefUriList) + + // AII loop call using list vpnBindings + String networkTableRefs = "" + for (i in 0..networkTableRefUriList.size()-1) { + + int counting = i+1 + + // prepare url using tableRef + String queryNetworkTableRefAAIRequest = "" + + String aai_uri = aaiUriUtil.getNetworkTableReferencesUri(execution) + + // Note: By default, the network policy url is found in 'related-link' of the response, + // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. + if (aai_uri == null || aai_uri == "") { + // using value of 'related-link' from response + if (networkTableRefUriList[i].charAt(networkTableRefUriList[i].length()-1) == '/') { + queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i].substring(0, networkTableRefUriList[i].length()-1) + "?depth=all" + } else { + queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i] + "?depth=all" + } + } else { + // using uri value in URN mapping + String networkTableRefId = networkTableRefUriList[i].substring(networkTableRefUriList[i].indexOf("/route-table-reference/")+23, networkTableRefUriList[i].length()) + + if (networkTableRefId.charAt(networkTableRefId.length()-1) == '/') { + networkTableRefId = networkTableRefId.substring(0, networkTableRefId.length()-1) + } + queryNetworkTableRefAAIRequest = "${aai_endpoint}${aai_uri}/" + networkTableRefId + "?depth=all" + + } + + + execution.setVariable(Prefix + "queryNetworkTableRefAAIRequest", queryNetworkTableRefAAIRequest) + msoLogger.debug(Prefix + "queryNetworkTableRefAAIRequest, , NetworkTableRef #" + counting + " : " + "\n" + queryNetworkTableRefAAIRequest) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkTableRefAAIRequest) + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", returnCode) + msoLogger.debug(" ***** AAI query network Table Reference Response Code, NetworkTableRef #" + counting + " : " + returnCode) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (returnCode=='200') { + execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", aaiResponseAsString) + msoLogger.debug(" QueryAAINetworkTableRef Success REST Response, , NetworkTableRef #" + counting + " : " + "\n" + aaiResponseAsString) + + String networkTableRef = "" + if (utils.nodeExists(aaiResponseAsString, "route-table-reference-fqdn")) { + networkTableRef = utils.getNodeText(aaiResponseAsString, "route-table-reference-fqdn") + networkTableRefs += "" + networkTableRef + "" + '\n' + } + + } else { + if (returnCode=='404') { + String dataErrorMessage = "Response Error from QueryAAINetworkTableRef is 404 (Not Found)." + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from QueryAAINetworkTableRef - " + returnCode + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } // end loop + + execution.setVariable(Prefix + "tableRefCollection", networkTableRefs) + msoLogger.debug(Prefix + "tableRefCollection - " + '\n' + networkTableRefs) + + } else { + // reset return code to success + execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200") + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) + String aaiStubResponse = + """ + + + + """ + String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) + execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", aaiStubResponseAsXml) + execution.setVariable(Prefix + "tableRefCollection", "") + msoLogger.debug(" No net table references, using this stub as response - " + '\n' + aaiStubResponseAsXml) + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkTableRef() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + public void callRESTUpdateContrailAAINetwork(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.debug(" ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " ) + + try { + // get variables + String networkId = execution.getVariable(Prefix + "networkId") + networkId = UriUtils.encode(networkId,"UTF-8") + String requeryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") + String createNetworkResponse = execution.getVariable(Prefix + "createNetworkResponse") + + // Prepare url + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String updateContrailAAIUrlRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" + + execution.setVariable(Prefix + "updateContrailAAIUrlRequest", updateContrailAAIUrlRequest) + msoLogger.debug(Prefix + "updateContrailAAIUrlRequest - " + "\n" + updateContrailAAIUrlRequest) + + //Prepare payload (PUT) + String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) + String payload = networkUtils.ContrailNetworkCreatedUpdate(requeryIdAAIResponse, createNetworkResponse, schemaVersion) + String payloadXml = utils.formatXml(payload) + execution.setVariable(Prefix + "updateContrailAAIPayloadRequest", payloadXml) + msoLogger.debug(" 'payload' to Update Contrail - " + "\n" + payloadXml) + + APIResponse response = aaiUriUtil.executeAAIPutCall(execution, updateContrailAAIUrlRequest, payloadXml) + + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiUpdateContrailReturnCode", returnCode) + msoLogger.debug(" ***** AAI Update Contrail Response Code : " + returnCode) + String aaiUpdateContrailResponseAsString = response.getResponseBodyAsString() + if (returnCode=='200') { + execution.setVariable(Prefix + "updateContrailAAIResponse", aaiUpdateContrailResponseAsString) + msoLogger.debug(" AAI Update Contrail Success REST Response - " + "\n" + aaiUpdateContrailResponseAsString) + // Point-of-no-return is set to false, rollback not needed. + String rollbackEnabled = execution.getVariable(Prefix + "rollbackEnabled") + if (rollbackEnabled == "true") { + execution.setVariable(Prefix + "isPONR", false) + } else { + execution.setVariable(Prefix + "isPONR", true) + } + msoLogger.debug(Prefix + "isPONR" + ": " + execution.getVariable(Prefix + "isPONR")) + } else { + if (returnCode=='404') { + String dataErrorMessage = " Response Error from UpdateContrailAAINetwork is 404 (Not Found)." + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiUpdateContrailResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiUpdateContrailResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String errorMessage = "Unexpected Response from UpdateContrailAAINetwork - " + returnCode + msoLogger.debug(errorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) + } + } + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTUpdateContrailAAINetwork() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareCreateNetworkRequest (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareCreateNetworkRequest() of DoCreateNetworkInstance") + + try { + + // get variables + String requestId = execution.getVariable("msoRequestId") + if (requestId == null) { + requestId = execution.getVariable("mso-request-id") + } + String messageId = execution.getVariable(Prefix + "messageId") + String source = execution.getVariable(Prefix + "source") + + String requestInput = execution.getVariable(Prefix + "networkRequest") + String queryIdResponse = execution.getVariable(Prefix + "queryIdAAIResponse") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionPo") + String backoutOnFailure = execution.getVariable(Prefix + "rollbackEnabled") + + // Prepare Network request + String routeCollection = execution.getVariable(Prefix + "routeCollection") + String policyCollection = execution.getVariable(Prefix + "networkCollection") + String tableCollection = execution.getVariable(Prefix + "tableRefCollection") + String createNetworkRequest = networkUtils.CreateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyCollection, tableCollection, cloudRegionId, backoutOnFailure, source ) + // Format Response + String buildDeleteNetworkRequestAsString = utils.formatXml(createNetworkRequest) + buildDeleteNetworkRequestAsString = buildDeleteNetworkRequestAsString.replace(":w1aac13n0", "").replace("w1aac13n0:", "") + + execution.setVariable(Prefix + "createNetworkRequest", buildDeleteNetworkRequestAsString) + msoLogger.debug(Prefix + "createNetworkRequest - " + "\n" + buildDeleteNetworkRequestAsString) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareCreateNetworkRequest() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareSDNCRequest (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareSDNCRequest() of DoCreateNetworkInstance") + + try { + // get variables + String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + + String networkId = execution.getVariable(Prefix + "networkId") + String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + + // get/set 'msoRequestId' and 'mso-request-id' + String requestId = execution.getVariable("msoRequestId") + if (requestId != null) { + execution.setVariable("mso-request-id", requestId) + } else { + requestId = execution.getVariable("mso-request-id") + } + execution.setVariable(Prefix + "requestId", requestId) + + // 1. prepare assign topology via SDNC Adapter SUBFLOW call + String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, createNetworkInput, serviceInstanceId, sdncCallback, "assign", "NetworkActivateRequest", cloudRegionId, networkId, null, null) + + String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) + execution.setVariable(Prefix + "assignSDNCRequest", sndcTopologyCreateRequesAsString) + msoLogger.debug(Prefix + "assignSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSDNCRequest() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRpcSDNCRequest (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareRpcSDNCRequest() of DoCreateNetworkInstance") + + try { + // get variables + + String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + + String networkId = execution.getVariable(Prefix + "networkId") + String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + + // 1. prepare assign topology via SDNC Adapter SUBFLOW call + String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "assign", "CreateNetworkInstance", cloudRegionId, networkId, null) + + String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) + execution.setVariable(Prefix + "assignSDNCRequest", sndcTopologyCreateRequesAsString) + msoLogger.debug(Prefix + "assignSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCRequest() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRpcSDNCActivateRequest (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareRpcSDNCActivateRequest() of DoCreateNetworkInstance") + + try { + // get variables + String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + String networkId = execution.getVariable(Prefix + "networkId") + String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + + // 1. prepare assign topology via SDNC Adapter SUBFLOW call + String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "activate", "CreateNetworkInstance", cloudRegionId, networkId, null) + + String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) + execution.setVariable(Prefix + "activateSDNCRequest", sndcTopologyCreateRequesAsString) + msoLogger.debug(Prefix + "activateSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCActivateRequest() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + + + // ************************************************** + // Post or Validate Response Section + // ************************************************** + + public void validateCreateNetworkResponse (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside validateNetworkResponse() of DoCreateNetworkInstance") + + try { + String returnCode = execution.getVariable(Prefix + "networkReturnCode") + String networkResponse = execution.getVariable(Prefix + "createNetworkResponse") + if (networkResponse==null) { + networkResponse="" // reset + } + + msoLogger.debug(" Network Adapter create responseCode: " + returnCode) + + String errorMessage = "" + if (returnCode == "200") { + execution.setVariable(Prefix + "isNetworkRollbackNeeded", true) + execution.setVariable(Prefix + "createNetworkResponse", networkResponse) + msoLogger.debug(" Network Adapter create Success Response - " + "\n" + networkResponse) + + // prepare rollback data + String rollbackData = utils.getNodeXml(networkResponse, "rollback", false).replace("tag0:","").replace(":tag0","") + rollbackData = rollbackData.replace("rollback>", "networkRollback>") + String rollbackNetwork = + """ + ${rollbackData} + """ + String rollbackNetworkXml = utils.formatXml(rollbackNetwork) + execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkXml) + msoLogger.debug(" Network Adapter rollback data - " + "\n" + rollbackNetworkXml) + + } else { // network error + if (returnCode.toInteger() > 399 && returnCode.toInteger() < 600) { //4xx, 5xx + if (networkResponse.contains("createNetworkError")) { + networkResponse = networkResponse.replace('', '') + errorMessage = utils.getNodeText(networkResponse, "message") + errorMessage = "Received error from Network Adapter: " + errorMessage + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) + + } else { // CatchAll exception + if (returnCode == "500") { + errorMessage = "JBWEB000065: HTTP Status 500." + } else { + errorMessage = "Return code is " + returnCode + } + errorMessage = "Received error from Network Adapter: " + errorMessage + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) + + } + + } else { // CatchAll exception + String dataErrorMessage = "Received error from Network Adapter. Return code is: " + returnCode + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. validateCreateNetworkResponse() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + + } + + public void validateSDNCResponse (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside validateSDNCResponse() of DoCreateNetworkInstance") + + String response = execution.getVariable(Prefix + "assignSDNCResponse") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + WorkflowException workflowException = execution.getVariable("WorkflowException") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + // reset variable + String assignSDNCResponseDecodeXml = execution.getVariable(Prefix + "assignSDNCResponse") + assignSDNCResponseDecodeXml = assignSDNCResponseDecodeXml.replace('', "") + execution.setVariable(Prefix + "assignSDNCResponse", assignSDNCResponseDecodeXml) + + if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, Prefix+'sdncResponseSuccess' + execution.setVariable(Prefix + "isSdncRollbackNeeded", true) + msoLogger.debug("Successfully Validated SDNC Response") + + } else { + msoLogger.debug("Did NOT Successfully Validated SDNC Response") + throw new BpmnError("MSOWorkflowException") + } + + } + + public void validateRpcSDNCActivateResponse (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside validateRpcSDNCActivateResponse() of DoCreateNetworkInstance") + + String response = execution.getVariable(Prefix + "activateSDNCResponse") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + WorkflowException workflowException = execution.getVariable("WorkflowException") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + // reset variable + String assignSDNCResponseDecodeXml = execution.getVariable(Prefix + "activateSDNCResponse") + assignSDNCResponseDecodeXml = assignSDNCResponseDecodeXml.replace('', "") + execution.setVariable(Prefix + "activateSDNCResponse", assignSDNCResponseDecodeXml) + + if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, Prefix+'sdncResponseSuccess' + execution.setVariable(Prefix + "isSdncActivateRollbackNeeded", true) + msoLogger.debug("Successfully Validated Rpc SDNC Activate Response") + + } else { + msoLogger.debug("Did NOT Successfully Validated Rpc SDNC Activate Response") + throw new BpmnError("MSOWorkflowException") + } + + } + + + public void prepareSDNCRollbackRequest (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareSDNCRollbackRequest() of DoCreateNetworkInstance") + + try { + // get variables + String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + String assignSDNCResponse = execution.getVariable(Prefix + "assignSDNCResponse") + String networkId = execution.getVariable(Prefix + "networkId") + if (networkId == 'null') {networkId = ""} + String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + + // 2. prepare rollback topology via SDNC Adapter SUBFLOW call + String sndcTopologyRollbackRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, createNetworkInput, serviceInstanceId, sdncCallback, "rollback", "NetworkActivateRequest", cloudRegionId, networkId, null, null) + String sndcTopologyRollbackRequestAsString = utils.formatXml(sndcTopologyRollbackRequest) + execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyRollbackRequestAsString) + msoLogger.debug(" Preparing request for SDNC Topology 'rollback-NetworkActivateRequest' rollback . . . - " + "\n" + sndcTopologyRollbackRequestAsString) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSDNCRollbackRequest() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRpcSDNCRollbackRequest (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareRpcSDNCRollbackRequest() of DoCreateNetworkInstance") + + try { + // get variables + String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + String assignSDNCResponse = execution.getVariable(Prefix + "assignSDNCResponse") + String networkId = execution.getVariable(Prefix + "networkId") + if (networkId == 'null') {networkId = ""} + String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + + // 2. prepare rollback topology via SDNC Adapter SUBFLOW call + String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "unassign", "DeleteNetworkInstance", cloudRegionId, networkId, null) + String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) + execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyRollbackRpcRequestAsString) + msoLogger.debug(" Preparing request for SDNC Topology 'unassign-DeleteNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCRollbackRequest() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRpcSDNCActivateRollback(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareRpcSDNCActivateRollback() of DoCreateNetworkInstance") + + try { + + // get variables + String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + String activateSDNCResponse = execution.getVariable(Prefix + "activateSDNCResponse") + String networkId = execution.getVariable(Prefix + "networkId") + if (networkId == 'null') {networkId = ""} + String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + + // 2. prepare rollback topology via SDNC Adapter SUBFLOW call + String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "deactivate", "DeleteNetworkInstance", cloudRegionId, networkId, null) + String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) + execution.setVariable(Prefix + "rollbackActivateSDNCRequest", sndcTopologyRollbackRpcRequestAsString) + msoLogger.debug(" Preparing request for RPC SDNC Topology 'deactivate-DeleteNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCActivateRollback() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRollbackData(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareRollbackData() of DoCreateNetworkInstance") + + try { + + Map rollbackData = new HashMap(); + String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") + if (rollbackSDNCRequest != null) { + if (rollbackSDNCRequest != "") { + rollbackData.put("rollbackSDNCRequest", execution.getVariable(Prefix + "rollbackSDNCRequest")) + } + } + String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") + if (rollbackNetworkRequest != null) { + if (rollbackNetworkRequest != "") { + rollbackData.put("rollbackNetworkRequest", execution.getVariable(Prefix + "rollbackNetworkRequest")) + } + } + String rollbackActivateSDNCRequest = execution.getVariable(Prefix + "rollbackActivateSDNCRequest") + if (rollbackActivateSDNCRequest != null) { + if (rollbackActivateSDNCRequest != "") { + rollbackData.put("rollbackActivateSDNCRequest", execution.getVariable(Prefix + "rollbackActivateSDNCRequest")) + } + } + execution.setVariable("rollbackData", rollbackData) + msoLogger.debug("** rollbackData : " + rollbackData) + + execution.setVariable("WorkflowException", execution.getVariable(Prefix + "WorkflowException")) + msoLogger.debug("** WorkflowException : " + execution.getVariable("WorkflowException")) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRollbackData() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void postProcessResponse(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside postProcessResponse() of DoCreateNetworkInstance") + + try { + + //Conditions: + // 1. Silent Success: execution.getVariable("CRENWKI_orchestrationStatus") == "ACTIVE" + // 2. Success: execution.getVariable("WorkflowException") == null (NULL) + // 3. WorkflowException: execution.getVariable("WorkflowException") != null (NOT NULL) + + msoLogger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException")) + // successful flow + if (execution.getVariable(Prefix + "isException") == false) { + // set rollback data + execution.setVariable("orchestrationStatus", "") + execution.setVariable("networkId", execution.getVariable(Prefix + "networkId")) + execution.setVariable("networkName", execution.getVariable(Prefix + "networkName")) + prepareSuccessRollbackData(execution) // populate rollbackData + execution.setVariable("WorkflowException", null) + execution.setVariable(Prefix + "Success", true) + msoLogger.debug(" ***** postProcessResponse(), GOOD !!!") + } else { + // inside sub-flow logic + execution.setVariable(Prefix + "Success", false) + execution.setVariable("rollbackData", null) + String exceptionMessage = " Exception encountered in MSO Bpmn. " + if (execution.getVariable("workflowException") != null) { // Output of Rollback flow. + msoLogger.debug(" ***** workflowException: " + execution.getVariable("workflowException")) + WorkflowException wfex = execution.getVariable("workflowException") + exceptionMessage = wfex.getErrorMessage() + } else { + if (execution.getVariable(Prefix + "WorkflowException") != null) { + WorkflowException pwfex = execution.getVariable(Prefix + "WorkflowException") + exceptionMessage = pwfex.getErrorMessage() + } + } + // going to the Main flow: a-la-carte or macro + msoLogger.debug(" ***** postProcessResponse(), BAD !!!") + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + throw new BpmnError("MSOWorkflowException") + } + + } catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + throw new BpmnError("MSOWorkflowException") + + } + + + + } + + public void prepareSuccessRollbackData(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareSuccessRollbackData() of DoCreateNetworkInstance") + + try { + + if (execution.getVariable("sdncVersion") != '1610') { + prepareRpcSDNCRollbackRequest(execution) + prepareRpcSDNCActivateRollback(execution) + } else { + prepareSDNCRollbackRequest(execution) + } + + Map rollbackData = new HashMap(); + String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") + if (rollbackSDNCRequest != null) { + if (rollbackSDNCRequest != "") { + rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) + } + } + String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") + if (rollbackNetworkRequest != null) { + if (rollbackNetworkRequest != "") { + rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) + } + } + String rollbackActivateSDNCRequest = execution.getVariable(Prefix + "rollbackActivateSDNCRequest") + if (rollbackActivateSDNCRequest != null) { + if (rollbackActivateSDNCRequest != "") { + rollbackData.put("rollbackActivateSDNCRequest", rollbackActivateSDNCRequest) + } + } + execution.setVariable("rollbackData", rollbackData) + + msoLogger.debug("** 'rollbackData' for Full Rollback : " + rollbackData) + execution.setVariable("WorkflowException", null) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void setExceptionFlag(DelegateExecution execution){ + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside setExceptionFlag() of DoCreateNetworkInstance") + + try { + + execution.setVariable(Prefix + "isException", true) + + if (execution.getVariable("SavedWorkflowException1") != null) { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) + } else { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) + } + msoLogger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException")) + + } catch(Exception ex){ + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. setExceptionFlag(): " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + } + + } + + + // ******************************* + // Build Error Section + // ******************************* + + + + public void processJavaException(DelegateExecution execution){ + + execution.setVariable("prefix",Prefix) + + try{ + msoLogger.debug( "Caught a Java Exception in " + Prefix) + msoLogger.debug("Started processJavaException Method") + msoLogger.debug("Variables List: " + execution.getVariables()) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + + }catch(Exception e){ + msoLogger.debug("Caught Exception during processJavaException Method: " + e) + execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) + } + msoLogger.debug( "Completed processJavaException Method in " + Prefix) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy new file mode 100644 index 0000000000..7e00f05b90 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy @@ -0,0 +1,393 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts; + +import groovy.xml.XmlUtil + +import groovy.json.* +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger +import org.onap.so.logger.MessageEnum + +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.NetworkUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.rest.APIResponse; +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils + +/** + * This groovy class supports the DoCreateNetworkInstance.bpmn process. + * + */ +public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateNetworkInstanceRollback.class); + + String Prefix="CRENWKIR_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + NetworkUtils networkUtils = new NetworkUtils() + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + def className = getClass().getSimpleName() + + /** + * This method is executed during the preProcessRequest task of the DoCreateNetworkInstanceRollback.bpmn process. + * @param execution + */ + public InitializeProcessVariables(DelegateExecution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable(Prefix + "rollbackNetworkRequest", null) + execution.setVariable(Prefix + "rollbackSDNCRequest", null) + execution.setVariable(Prefix + "rollbackActivateSDNCRequest", null) + execution.setVariable(Prefix + "WorkflowException", null) + + execution.setVariable(Prefix + "rollbackNetworkRequest", "") + execution.setVariable(Prefix + "rollbackNetworkResponse", "") + execution.setVariable(Prefix + "rollbackNetworkReturnCode", "") + + execution.setVariable(Prefix + "rollbackSDNCRequest", "") + execution.setVariable(Prefix + "rollbackSDNCResponse", "") + execution.setVariable(Prefix + "rollbackSDNCReturnCode", "") + + execution.setVariable(Prefix + "rollbackActivateSDNCRequest", "") + execution.setVariable(Prefix + "rollbackActivateSDNCResponse", "") + execution.setVariable(Prefix + "rollbackActivateSDNCReturnCode", "") + + execution.setVariable(Prefix + "Success", false) + execution.setVariable(Prefix + "fullRollback", false) + execution.setVariable(Prefix + "networkId", "") + execution.setVariable(Prefix + "urlRollbackPoNetwork", "") + + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the DoCreateNetworkInstanceRollback.bpmn process. + * @param execution + */ + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside preProcessRequest() of " + className + ".groovy") + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + // GET Incoming request/variables + String rollbackNetworkRequest = null + String rollbackSDNCRequest = null + String rollbackActivateSDNCRequest = null + + // Partial Rollback + Map rollbackData = execution.getVariable("rollbackData") + if (rollbackData != null && rollbackData instanceof Map) { + + if(rollbackData.containsKey("rollbackSDNCRequest")) { + rollbackSDNCRequest = rollbackData["rollbackSDNCRequest"] + } + + if(rollbackData.containsKey("rollbackNetworkRequest")) { + rollbackNetworkRequest = rollbackData["rollbackNetworkRequest"] + } + + if(rollbackData.containsKey("rollbackActivateSDNCRequest")) { + rollbackActivateSDNCRequest = rollbackData["rollbackActivateSDNCRequest"] + } + + } + + execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkRequest) + execution.setVariable(Prefix + "rollbackSDNCRequest", rollbackSDNCRequest) + execution.setVariable(Prefix + "rollbackActivateSDNCRequest", rollbackActivateSDNCRequest) + msoLogger.debug("'rollbackData': " + '\n' + execution.getVariable("rollbackData")) + + String sdncVersion = execution.getVariable("sdncVersion") + msoLogger.debug("sdncVersion? : " + sdncVersion) + + // PO Authorization Info / headers Authorization= + String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution) + try { + def encodedString = utils.getBasicAuth(basicAuthValuePO, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable("BasicAuthHeaderValuePO",encodedString) + execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) + + } catch (IOException ex) { + String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " + String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() + msoLogger.debug(dataErrorMessage ) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + if (execution.getVariable("SavedWorkflowException1") != null) { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) + } else { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) + } + msoLogger.debug("*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException")) + if(execution.getVariable(Prefix + "WorkflowException") != null) { + // called by: DoCreateNetworkInstance, partial rollback + execution.setVariable(Prefix + "fullRollback", false) + + } else { + // called by: Macro - Full Rollback, WorkflowException = null + execution.setVariable(Prefix + "fullRollback", true) + + } + msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) + + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callPONetworkAdapter (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside callPONetworkAdapter() of " + className + "") + + try { + String poUrl = UrnPropertiesReader.getVariable("mso.adapters.network.rest.endpoint",execution) + String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") + String networkId = utils.getNodeText(rollbackSDNCRequest, "network-id") + + String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") + + String urlRollbackPoNetwork = poUrl+ "/" + networkId + "/rollback" + msoLogger.debug("'urlRollbackPoNetwork': " + urlRollbackPoNetwork) + execution.setVariable(Prefix + "urlRollbackPoNetwork", urlRollbackPoNetwork) + + RESTConfig config = new RESTConfig(urlRollbackPoNetwork) + RESTClient client = new RESTClient(config). + addHeader("Content-Type", "application/xml"). + addAuthorizationHeader(execution.getVariable("BasicAuthHeaderValuePO")); + + APIResponse response = client.httpDelete(rollbackNetworkRequest) + String responseCode = response.getStatusCode() + String responseBody = response.getResponseBodyAsString() + + execution.setVariable(Prefix + "rollbackNetworkReturnCode", responseCode) + execution.setVariable(Prefix + "rollbackNetworkResponse", responseBody) + + msoLogger.debug(" Network Adapter rollback responseCode: " + responseCode) + msoLogger.debug(" Network Adapter rollback responseBody: " + responseBody) + + + } catch (Exception ex) { + String exceptionMessage = "Exception Encountered in callPONetworkAdapter() of DoCreateNetworkInstanceRollback flow - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + } + + + public void validateRollbackResponses (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside validateRollbackResponses() of DoCreateNetworkInstanceRollback") + + try { + // validate PO network rollback response + String rollbackNetworkErrorMessages = "" + String rollbackNetworkReturnCode = "200" + if (execution.getVariable(Prefix + "rollbackNetworkRequest") != null) { + rollbackNetworkReturnCode = execution.getVariable(Prefix + "rollbackNetworkReturnCode") + String rollbackNetworkResponse = execution.getVariable(Prefix + "rollbackNetworkResponse") + msoLogger.debug(" NetworkRollback Code - " + rollbackNetworkReturnCode) + msoLogger.debug(" NetworkRollback Response - " + rollbackNetworkResponse) + if (rollbackNetworkReturnCode != "200") { + rollbackNetworkErrorMessages = " + PO Network rollback failed. " + } else { + rollbackNetworkErrorMessages = " + PO Network rollback completed." + } + } + + // validate SDNC rollback response + String rollbackSdncErrorMessages = "" + String rollbackSDNCReturnCode = "200" + if (execution.getVariable(Prefix + "rollbackSDNCRequest") != null) { + rollbackSDNCReturnCode = execution.getVariable(Prefix + "rollbackSDNCReturnCode") + String rollbackSDNCResponse = execution.getVariable(Prefix + "rollbackSDNCResponse") + String rollbackSDNCReturnInnerCode = "" + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + rollbackSDNCResponse = rollbackSDNCResponse + rollbackSDNCResponse = rollbackSDNCResponse.replace('$', '').replace('', "") + if (rollbackSDNCReturnCode == "200") { + if (utils.nodeExists(rollbackSDNCResponse, "response-code")) { + rollbackSDNCReturnInnerCode = utils.getNodeText(rollbackSDNCResponse, "response-code") + if (rollbackSDNCReturnInnerCode == "200" || rollbackSDNCReturnInnerCode == "" || rollbackSDNCReturnInnerCode == "0") { + rollbackSdncErrorMessages = " + SNDC assign rollback completed." + } else { + rollbackSdncErrorMessages = " + SDNC assign rollback failed. " + } + } else { + rollbackSdncErrorMessages = " + SNDC assign rollback completed." + } + } else { + rollbackSdncErrorMessages = " + SDNC assign rollback failed. " + } + msoLogger.debug(" SDNC assign rollback Code - " + rollbackSDNCReturnCode) + msoLogger.debug(" SDNC assign rollback Response - " + rollbackSDNCResponse) + } + + // validate SDNC activate rollback response + String rollbackActivateSdncErrorMessages = "" + String rollbackActivateSDNCReturnCode = "200" + if (execution.getVariable(Prefix + "rollbackActivateSDNCRequest") != null) { + rollbackActivateSDNCReturnCode = execution.getVariable(Prefix + "rollbackActivateSDNCReturnCode") + String rollbackActivateSDNCResponse = execution.getVariable(Prefix + "rollbackActivateSDNCResponse") + String rollbackActivateSDNCReturnInnerCode = "" + rollbackActivateSDNCResponse = rollbackActivateSDNCResponse + rollbackActivateSDNCResponse = rollbackActivateSDNCResponse.replace('$', '').replace('', "") + if (rollbackActivateSDNCReturnCode == "200") { + if (utils.nodeExists(rollbackActivateSDNCResponse, "response-code")) { + rollbackActivateSDNCReturnInnerCode = utils.getNodeText(rollbackActivateSDNCResponse, "response-code") + if (rollbackActivateSDNCReturnInnerCode == "200" || rollbackActivateSDNCReturnInnerCode == "" || rollbackActivateSDNCReturnInnerCode == "0") { + rollbackActivateSdncErrorMessages = " + SNDC activate rollback completed." + } else { + rollbackActivateSdncErrorMessages = " + SDNC activate rollback failed. " + } + } else { + rollbackActivateSdncErrorMessages = " + SNDC activate rollback completed." + } + } else { + rollbackActivateSdncErrorMessages = " + SDNC activate rollback failed. " + } + msoLogger.debug(" SDNC activate rollback Code - " + rollbackActivateSDNCReturnCode) + msoLogger.debug(" SDNC activate rollback Response - " + rollbackActivateSDNCResponse) + } + + + String statusMessage = "" + int errorCode = 7000 + msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) + if (execution.getVariable(Prefix + "fullRollback") == false) { + // original WorkflowException, + WorkflowException wfe = execution.getVariable(Prefix + "WorkflowException") + if (wfe != null) { + // rollback due to failure in DoCreate - Partial rollback + statusMessage = wfe.getErrorMessage() + errorCode = wfe.getErrorCode() + } else { + statusMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." + errorCode = '7000' + } + + // set if all rolledbacks are successful + if (rollbackNetworkReturnCode == "200" && rollbackSDNCReturnCode == "200" && rollbackActivateSDNCReturnCode == "200") { + execution.setVariable("rolledBack", true) + execution.setVariable("wasDeleted", true) + + } else { + execution.setVariable("rolledBack", false) + execution.setVariable("wasDeleted", true) + } + + statusMessage = statusMessage + rollbackActivateSdncErrorMessages + rollbackNetworkErrorMessages + rollbackSdncErrorMessages + msoLogger.debug("Final DoCreateNetworkInstanceRollback status message: " + statusMessage) + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, errorCode, statusMessage); + execution.setVariable("workflowException", exception); + + } else { + // rollback due to failures in Main flow (Macro) - Full rollback + // WorkflowException = null + if (rollbackNetworkReturnCode == "200" && rollbackSDNCReturnCode == "200" && rollbackActivateSDNCReturnCode == "200") { + execution.setVariable("rollbackSuccessful", true) + execution.setVariable("rollbackError", false) + } else { + String exceptionMessage = "Network Create Rollback was not Successful. " + msoLogger.debug(exceptionMessage) + execution.setVariable("rollbackSuccessful", false) + execution.setVariable("rollbackError", true) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + throw new BpmnError("MSOWorkflowException") + } + + } + + + } catch (Exception ex) { + String errorMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstanceRollback flow. validateRollbackResponses() - " + errorMessage + ": " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + // ******************************* + // Build Error Section + // ******************************* + + + + public void processJavaException(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + try{ + msoLogger.debug("Caught a Java Exception in " + Prefix) + msoLogger.debug("Started processJavaException Method") + msoLogger.debug("Variables List: " + execution.getVariables()) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + + }catch(Exception e){ + msoLogger.debug("Caught Exception during processJavaException Method: " + e) + execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) + } + msoLogger.debug("Completed processJavaException Method in " + Prefix) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy new file mode 100644 index 0000000000..f7c5c1b83d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy @@ -0,0 +1,279 @@ +/*- + * ============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.bpmn.infrastructure.scripts + +import org.codehaus.jackson.map.ObjectMapper +import org.onap.so.bpmn.infrastructure.properties.BPMNProperties + +import java.util.ArrayList +import java.util.Iterator +import java.util.List +import org.apache.commons.lang3.StringUtils +import org.apache.http.HttpResponse +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.codehaus.groovy.runtime.ArrayUtil +import org.codehaus.groovy.runtime.ScriptBytecodeAdapter +import org.codehaus.groovy.runtime.callsite.CallSite +import org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation +import org.codehaus.groovy.runtime.typehandling.ShortTypeHandling +import org.json.JSONArray +import org.json.JSONObject +import org.onap.so.bpmn.common.recipe.BpmnRestClient +import org.onap.so.bpmn.common.recipe.ResourceInput +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.CatalogDbUtils +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.domain.AllottedResource +import org.onap.so.bpmn.core.domain.NetworkResource +import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +/** + * This groovy class supports the DoCreateResources.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId - O + * @param - subscriptionServiceType - O + * @param - serviceInstanceId + * @param - serviceInstanceName - O + * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) + * @param - sdncVersion + * + * @param - addResourceList + * + * Outputs: + * @param - WorkflowException + + */ +public class DoCreateResources extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateResources.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + CatalogDbUtils cutils = new CatalogDbUtils() + + public void preProcessRequest(DelegateExecution execution) + { + msoLogger.trace("preProcessRequest ") + String msg = "" + + List addResourceList = execution.getVariable("addResourceList") + if (addResourceList == null) + { + msg = "Input addResourceList is null" + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + else if (addResourceList.size() == 0) + { + msg = "No resource in addResourceList" + msoLogger.info(msg) + } + msoLogger.trace("Exit preProcessRequest ") + } + + public void sequenceResoure(DelegateExecution execution) + { + msoLogger.trace("Start sequenceResoure Process ") + + String serviceModelUUID = execution.getVariable("modelUuid") + + List addResourceList = execution.getVariable("addResourceList") + + List networkResourceList = new ArrayList() + + List sequencedResourceList = new ArrayList() + + String serviceDecompose = execution.getVariable("serviceDecomposition") + String serviceModelName = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelName") + def resourceSequence = BPMNProperties.getResourceSequenceProp(serviceModelName) + + if(resourceSequence != null) { + // sequence is defined in config file + for (resourceType in resourceSequence) { + for (resource in addResourceList) { + if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) { + sequencedResourceList.add(resource) + + if (resource instanceof NetworkResource) { + networkResourceList.add(resource) + } + } + } + } + } else { + + //define sequenced resource list, we deploy vf first and then network and then ar + //this is defaule sequence + List vnfResourceList = new ArrayList() + List arResourceList = new ArrayList() + + for (Resource rc : addResourceList){ + if (rc instanceof VnfResource) { + vnfResourceList.add(rc) + } else if (rc instanceof NetworkResource) { + networkResourceList.add(rc) + } else if (rc instanceof AllottedResource) { + arResourceList.add(rc) + } + } + sequencedResourceList.addAll(vnfResourceList) + sequencedResourceList.addAll(networkResourceList) + sequencedResourceList.addAll(arResourceList) + } + + String isContainsWanResource = networkResourceList.isEmpty() ? "false" : "true" + execution.setVariable("isContainsWanResource", isContainsWanResource) + execution.setVariable("currentResourceIndex", 0) + execution.setVariable("sequencedResourceList", sequencedResourceList) + msoLogger.info("sequencedResourceList: " + sequencedResourceList) + msoLogger.trace("COMPLETED sequenceResoure Process ") + } + + public prepareServiceTopologyRequest(DelegateExecution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO", "======== Start prepareServiceTopologyRequest Process ======== ", isDebugEnabled) + + String serviceDecompose = execution.getVariable("serviceDecomposition") + + execution.setVariable("operationType", "create") + execution.setVariable("resourceType", "") + + String serviceInvariantUuid = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelInvariantUuid") + String serviceUuid = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelUuid") + String serviceModelName = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelName") + + execution.setVariable("modelInvariantUuid", serviceInvariantUuid) + execution.setVariable("modelUuid", serviceUuid) + execution.setVariable("serviceModelName", serviceModelName) + + utils.log("INFO", "======== End prepareServiceTopologyRequest Process ======== ", isDebugEnabled) + } + + public void getCurrentResoure(DelegateExecution execution){ + msoLogger.trace("Start getCurrentResoure Process ") + def currentIndex = execution.getVariable("currentResourceIndex") + List sequencedResourceList = execution.getVariable("sequencedResourceList") + Resource currentResource = sequencedResourceList.get(currentIndex) + execution.setVariable("resourceType", currentResource.getModelInfo().getModelName()) + msoLogger.info("Now we deal with resouce:" + currentResource.getModelInfo().getModelName()) + msoLogger.trace("COMPLETED getCurrentResoure Process ") + } + + public void parseNextResource(DelegateExecution execution){ + msoLogger.trace("Start parseNextResource Process ") + def currentIndex = execution.getVariable("currentResourceIndex") + def nextIndex = currentIndex + 1 + execution.setVariable("currentResourceIndex", nextIndex) + List sequencedResourceList = execution.getVariable("sequencedResourceList") + if(nextIndex >= sequencedResourceList.size()){ + execution.setVariable("allResourceFinished", "true") + }else{ + execution.setVariable("allResourceFinished", "false") + } + msoLogger.trace("COMPLETED parseNextResource Process ") + } + + public void prepareResourceRecipeRequest(DelegateExecution execution){ + msoLogger.trace("Start prepareResourceRecipeRequest Process ") + ResourceInput resourceInput = new ResourceInput() + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String resourceType = execution.getVariable("resourceType") + String resourceInstanceName = resourceType + "_" + serviceInstanceName + resourceInput.setResourceInstanceName(resourceInstanceName) + msoLogger.info("Prepare Resource Request resourceInstanceName:" + resourceInstanceName) + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = "createInstance" + resourceInput.setGlobalSubscriberId(globalSubscriberId) + resourceInput.setServiceType(serviceType) + resourceInput.setServiceInstanceId(serviceInstanceId) + resourceInput.setOperationId(operationId) + resourceInput.setOperationType(operationType); + def currentIndex = execution.getVariable("currentResourceIndex") + List sequencedResourceList = execution.getVariable("sequencedResourceList") + Resource currentResource = sequencedResourceList.get(currentIndex) + resourceInput.setResourceModelInfo(currentResource.getModelInfo()); + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); + + String incomingRequest = execution.getVariable("uuiRequest") + //set the requestInputs from tempalte To Be Done + String serviceModelUuid = jsonUtil.getJsonValue(incomingRequest,"service.serviceUuid") + String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters") + String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters) + resourceInput.setResourceParameters(resourceParameters) + execution.setVariable("resourceInput", resourceInput) + msoLogger.trace("COMPLETED prepareResourceRecipeRequest Process ") + } + + public void executeResourceRecipe(DelegateExecution execution){ + msoLogger.trace("Start executeResourceRecipe Process ") + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceType = execution.getVariable("serviceType") + ResourceInput resourceInput = execution.getVariable("resourceInput") + + // requestAction is action, not opertiontype + //String requestAction = resourceInput.getOperationType() + String requestAction = "createInstance" + JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction) + + if (resourceRecipe != null) { + String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri") + int recipeTimeOut = resourceRecipe.getInt("recipeTimeout") + String recipeParamXsd = resourceRecipe.get("paramXSD") + HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) + } else { + String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + + resourceInput.getResourceModelInfo().getModelUuid() + utils.log("ERROR", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, exceptionMessage) + } + + msoLogger.trace("======== end executeResourceRecipe Process ======== ") + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug("Error occured within DoCreateResources executeResourceRecipe method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured during DoCreateResources executeResourceRecipe Catalog") + } + } + + public void postConfigRequest(DelegateExecution execution){ + //now do noting + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy new file mode 100644 index 0000000000..93a260a544 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy @@ -0,0 +1,795 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.OwningEntity +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.CatalogDbUtils +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInstance +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils + +import groovy.json.* + +/** + * This groovy class supports the DoCreateServiceInstance.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId + * @param - subscriptionServiceType + * @param - serviceInstanceId + * @param - serviceInstanceName - O + * @param - serviceModelInfo + * @param - productFamilyId + * @param - disableRollback + * @param - failExists - TODO + * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) + * @param - sdncVersion ("1610") + * @param - serviceDecomposition - Decomposition for R1710 + * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored) + * + * Outputs: + * @param - rollbackData (localRB->null) + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * @param - WorkflowException + * @param - serviceInstanceName - (GET from AAI if null in input) + * + * This BB processes Macros(except TRANSPORT all sent to sdnc) and Alacartes(sdncSvcs && nonSdncSvcs) + */ +public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateServiceInstance.class); + String Prefix="DCRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + CatalogDbUtils cutils = new CatalogDbUtils() + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + msoLogger.trace("preProcessRequest") + + try { + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("prefix", Prefix) + + setBasicDBAuthHeader(execution, isDebugEnabled) + //Inputs + //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology + String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + + //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + //requestDetails.requestParameters. for SDNC assignTopology + String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId + + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + if (productFamilyId == null) { + execution.setVariable("productFamilyId", "") + } + + String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + if (isBlank(sdncCallbackUrl)) { + msg = "mso.workflow.sdncadapter.callback is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + + //requestDetails.modelInfo.for AAI PUT servieInstanceData & SDNC assignTopology + String modelInvariantUuid = "" + String modelVersion = "" + String modelUuid = "" + String modelName = "" + String serviceInstanceName = "" + //Generated in parent.for AAI PUT + String serviceInstanceId = "" + String serviceType = "" + String serviceRole = "" + + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") + if (serviceDecomp != null) + { + serviceType = serviceDecomp.getServiceType() ?: "" + msoLogger.debug("serviceType:" + serviceType) + serviceRole = serviceDecomp.getServiceRole() ?: "" + + ServiceInstance serviceInstance = serviceDecomp.getServiceInstance() + if (serviceInstance != null) + { + serviceInstanceId = serviceInstance.getInstanceId() ?: "" + serviceInstanceName = serviceInstance.getInstanceName() ?: "" + execution.setVariable("serviceInstanceId", serviceInstanceId) + execution.setVariable("serviceInstanceName", serviceInstanceName) + } + + ModelInfo modelInfo = serviceDecomp.getModelInfo() + if (modelInfo != null) + { + modelInvariantUuid = modelInfo.getModelInvariantUuid() ?: "" + modelVersion = modelInfo.getModelVersion() ?: "" + modelUuid = modelInfo.getModelUuid() ?: "" + modelName = modelInfo.getModelName() ?: "" + } + else + { + msg = "Input serviceModelInfo is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + } + else + { + //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData & SDNC assignToplology + serviceInstanceName = execution.getVariable("serviceInstanceName") ?: "" + serviceInstanceId = execution.getVariable("serviceInstanceId") ?: "" + + String serviceModelInfo = execution.getVariable("serviceModelInfo") + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") ?: "" + modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") ?: "" + modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid") ?: "" + modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") ?: "" + //modelCustomizationUuid NA for SI + + } + + execution.setVariable("serviceType", serviceType) + execution.setVariable("serviceRole", serviceRole) + execution.setVariable("serviceInstanceName", serviceInstanceName) + + execution.setVariable("modelInvariantUuid", modelInvariantUuid) + execution.setVariable("modelVersion", modelVersion) + execution.setVariable("modelUuid", modelUuid) + execution.setVariable("modelName", modelName) + + //alacarte SIs are NOT sent to sdnc. exceptions are listed in config variable + String svcTypes = UrnPropertiesReader.getVariable("sdnc.si.svc.types",execution) ?: "" + msoLogger.debug("SDNC SI serviceTypes:" + svcTypes) + List svcList = Arrays.asList(svcTypes.split("\\s*,\\s*")); + boolean isSdncService= false + for (String listEntry : svcList){ + if (listEntry.equalsIgnoreCase(serviceType)){ + isSdncService = true + break; + } + } + + //All Macros are sent to SDNC, TRANSPORT(Macro) is sent to SDNW + //Alacartes are sent to SDNC if they are listed in config variable above + execution.setVariable("sendToSDNC", true) + if(execution.getVariable("sdncVersion").equals("1610")) //alacarte + { + if(!isSdncService){ + execution.setVariable("sendToSDNC", false) + //alacarte non-sdnc svcs must provide name (sdnc provides name for rest) + if (isBlank(execution.getVariable("serviceInstanceName" ))) + { + msg = "Input serviceInstanceName must be provided for alacarte" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + } + } + + msoLogger.debug("isSdncService: " + isSdncService) + msoLogger.debug("Send To SDNC: " + execution.getVariable("sendToSDNC")) + msoLogger.debug("Service Type: " + execution.getVariable("serviceType")) + + //macro may provide name and alacarte-portm may provide name + execution.setVariable("checkAAI", false) + if (!isBlank(execution.getVariable("serviceInstanceName" ))) + { + execution.setVariable("checkAAI", true) + } + + if (isBlank(serviceInstanceId)){ + msg = "Input serviceInstanceId is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + + StringBuilder sbParams = new StringBuilder() + Map paramsMap = execution.getVariable("serviceInputParams") + if (paramsMap != null) + { + sbParams.append("") + for (Map.Entry entry : paramsMap.entrySet()) { + String paramsXml + String paramName = entry.getKey() + String paramValue = entry.getValue() + paramsXml = + """ + ${MsoUtils.xmlEscape(paramName)} + ${MsoUtils.xmlEscape(paramValue)} + + """ + sbParams.append(paramsXml) + } + sbParams.append("") + } + String siParamsXml = sbParams.toString() + if (siParamsXml == null) + siParamsXml = "" + execution.setVariable("siParamsXml", siParamsXml) + + //AAI PUT + String oStatus = execution.getVariable("initialStatus") ?: "Active" + if ("TRANSPORT".equalsIgnoreCase(serviceType)) + { + oStatus = "Created" + } + + String statusLine = isBlank(oStatus) ? "" : "${MsoUtils.xmlEscape(oStatus)}" + String serviceTypeLine = isBlank(serviceType) ? "" : "${MsoUtils.xmlEscape(serviceType)}" + String serviceRoleLine = isBlank(serviceRole) ? "" : "${MsoUtils.xmlEscape(serviceRole)}" + + //QUERY CATALOG DB AND GET WORKLOAD / ENVIRONMENT CONTEXT + String environmentContext = "" + String workloadContext ="" + + try{ + String json = cutils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) + + msoLogger.debug("JSON IS: "+json) + + environmentContext = jsonUtil.getJsonValue(json, "serviceResources.environmentContext") ?: "" + workloadContext = jsonUtil.getJsonValue(json, "serviceResources.workloadContext") ?: "" + msoLogger.debug("Env Context is: "+ environmentContext) + msoLogger.debug("Workload Context is: "+ workloadContext) + }catch(BpmnError e){ + throw e + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + //Create AAI Payload + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) + String serviceInstanceData = + """ + ${MsoUtils.xmlEscape(serviceInstanceName)} + ${serviceTypeLine} + ${serviceRoleLine} + ${statusLine} + ${MsoUtils.xmlEscape(modelInvariantUuid)} + ${MsoUtils.xmlEscape(modelUuid)} + ${MsoUtils.xmlEscape(environmentContext)} + ${MsoUtils.xmlEscape(workloadContext)} + """.trim() + + execution.setVariable("serviceInstanceData", serviceInstanceData) + msoLogger.debug(" 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest") + } + + //TODO: Will be able to replace with call to GenericGetService + public void getAAICustomerById (DelegateExecution execution) { + // https://{aaiEP}/aai/v8/business/customers/customer/{globalCustomerId} + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + try { + + String globalCustomerId = execution.getVariable("globalSubscriberId") //VID to AAI name map + msoLogger.debug(" ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + if (isBlank(aai_endpoint) || isBlank(aai_uri)) + { + msg = "AAI URL is invalid. Endpoint:" + aai_endpoint + aai_uri + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + String getAAICustomerUrl = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + + msoLogger.debug("getAAICustomerById Url:" + getAAICustomerUrl) + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getAAICustomerUrl) + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msg = "getAAICustomerById ResponseCode:" + returnCode + " ResponseString:" + aaiResponseAsString + msoLogger.debug(msg) + + if (returnCode=='200') { + // Customer found by ID. FLow to proceed. + msoLogger.debug(msg) + + //TODO Deferred + //we might verify that service-subscription with matching name exists + //and throw error if not. If not checked, we will get exception in subsequent step on Create call + //in 1610 we assume both customer & service subscription were pre-created + + } else { + if (returnCode=='404') { + msg = "GlobalCustomerId:" + globalCustomerId + " not found (404) in AAI" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, aaiResponseAsString, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", workflowException) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + msg = "Error in getAAICustomerById ResponseCode:" + returnCode + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + } + + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in getAAICustomerById. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit getAAICustomerById") + + } + + public void postProcessAAIGET(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("postProcessAAIGET") + String msg = "" + + try { + String serviceInstanceName = execution.getVariable("serviceInstanceName") + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(!succInAAI){ + msoLogger.debug("Error getting Service-instance from AAI", + serviceInstanceName) + WorkflowException workflowException = execution.getVariable("WorkflowException") + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + else + { + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + if(foundInAAI){ + msoLogger.debug("Found Service-instance in AAI") + msg = "ServiceInstance already exists in AAI:" + serviceInstanceName + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit postProcessAAIGET") + } + + public void postProcessAAIPUT(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("postProcessAAIPUT") + String msg = "" + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator") + if(!succInAAI){ + msoLogger.debug("Error putting Service-instance in AAI", + serviceInstanceId) + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + } + else + { + //start rollback set up + RollbackData rollbackData = new RollbackData() + def disableRollback = execution.getVariable("disableRollback") + rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) + rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") + rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId) + rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType")) + rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) + execution.setVariable("rollbackData", rollbackData) + } + + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit postProcessAAIPUT") + } + + public void preProcessSDNCAssignRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + msoLogger.trace("preProcessSDNCAssignRequest") + + try { + def serviceInstanceId = execution.getVariable("serviceInstanceId") + def serviceInstanceName = execution.getVariable("serviceInstanceName") + def callbackURL = execution.getVariable("sdncCallbackUrl") + def requestId = execution.getVariable("msoRequestId") + def serviceId = execution.getVariable("productFamilyId") + def subscriptionServiceType = execution.getVariable("subscriptionServiceType") + def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + def msoAction = "" + + def modelInvariantUuid = execution.getVariable("modelInvariantUuid") + def modelVersion = execution.getVariable("modelVersion") + def modelUuid = execution.getVariable("modelUuid") + def modelName = execution.getVariable("modelName") + + def sdncRequestId = UUID.randomUUID().toString() + + def siParamsXml = execution.getVariable("siParamsXml") + + // special URL for SDNW, msoAction helps set diff url in SDNCA + if("TRANSPORT".equalsIgnoreCase(execution.getVariable("serviceType"))) + { + msoAction = "TRANSPORT" + } + + String sdncAssignRequest = + """ + + ${MsoUtils.xmlEscape(sdncRequestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + assign + service-topology-operation + ${MsoUtils.xmlEscape(callbackURL)} + ${MsoUtils.xmlEscape(msoAction)} + + + + ${MsoUtils.xmlEscape(requestId)} + MSO + + + + CreateServiceInstance + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(subscriptionServiceType)} + + ${MsoUtils.xmlEscape(modelInvariantUuid)} + ${MsoUtils.xmlEscape(modelUuid)} + ${MsoUtils.xmlEscape(modelVersion)} + ${MsoUtils.xmlEscape(modelName)} + + ${MsoUtils.xmlEscape(serviceInstanceId)} + + ${MsoUtils.xmlEscape(globalSubscriberId)} + + + ${MsoUtils.xmlEscape(serviceInstanceName)} + ${siParamsXml} + + + """ + + msoLogger.debug("sdncAssignRequest:\n" + sdncAssignRequest) + sdncAssignRequest = utils.formatXml(sdncAssignRequest) + execution.setVariable("sdncAssignRequest", sdncAssignRequest) + msoLogger.debug("sdncAssignRequest: " + sdncAssignRequest) + + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncDelete = sdncAssignRequest.replace(">assign<", ">delete<").replace(">CreateServiceInstance<", ">DeleteServiceInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + def sdncRequestId3 = UUID.randomUUID().toString() + String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId2}<", ">${sdncRequestId3}<") + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", sdncDeactivate) + rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete) + execution.setVariable("rollbackData", rollbackData) + + msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCAssignRequest. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessSDNCAssignRequest") + } + + public void postProcessSDNCAssign (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("postProcessSDNCAssign") + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + String response = execution.getVariable("sdncAdapterResponse") + msoLogger.debug("SDNCResponse: " + response) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msoLogger.debug("Good response from SDNC Adapter for service-instance topology assign: \n" + response) + + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true") + execution.setVariable("rollbackData", rollbackData) + + }else{ + msoLogger.debug("Bad Response from SDNC Adapter for service-instance assign") + throw new BpmnError("MSOWorkflowException") + } + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in postProcessSDNCAssign. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit postProcessSDNCAssign") + } + + public void postProcessAAIGET2(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("postProcessAAIGET2") + String msg = "" + + try { + String serviceInstanceName = execution.getVariable("serviceInstanceName") + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(!succInAAI){ + msoLogger.debug("Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName) + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + else + { + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + if(foundInAAI){ + String aaiService = execution.getVariable("GENGS_service") + if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) { + execution.setVariable("serviceInstanceName", utils.getNodeText(aaiService, "service-instance-name")) + msoLogger.debug("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName")) + } + } + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit postProcessAAIGET2") + } + + public void preProcessRollback (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("preProcessRollback") + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage()) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + msoLogger.debug("BPMN Error during preProcessRollback") + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + msoLogger.debug(msg) + } + msoLogger.trace("Exit preProcessRollback") + } + + public void postProcessRollback (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("postProcessRollback") + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + msoLogger.debug("Setting prevException to WorkflowException: ") + execution.setVariable("WorkflowException", workflowException); + } + execution.setVariable("rollbackData", null) + } catch (BpmnError b) { + msoLogger.debug("BPMN Error during postProcessRollback") + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + msoLogger.debug(msg) + } + msoLogger.trace("Exit postProcessRollback") + } + + public void createProject(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("createProject") + + String bpmnRequest = execution.getVariable("requestJson") + String projectName = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.project.projectName") + String serviceInstance = execution.getVariable("serviceInstanceId") + + msoLogger.debug("BPMN REQUEST IS: "+ bpmnRequest) + msoLogger.debug("PROJECT NAME: " + projectName) + msoLogger.debug("Service Instance: " + serviceInstance) + + if(projectName == null||projectName.equals("")){ + msoLogger.debug("Project Name was not found in input. Skipping task...") + }else{ + try{ + AAICreateResources aaiCR = new AAICreateResources() + aaiCR.createAAIProject(projectName, serviceInstance) + }catch(Exception ex){ + String msg = "Exception in createProject. " + ex.getMessage(); + msoLogger.debug(msg) + msoLogger.error(ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + msoLogger.trace("Exit createProject") + } + + public void createOwningEntity(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("createOwningEntity") + String msg = ""; + String bpmnRequest = execution.getVariable("requestJson") + String owningEntityId = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.owningEntity.owningEntityId") + String owningEntityName = jsonUtil.getJsonValue(bpmnRequest,"requestDetails.owningEntity.owningEntityName"); + String serviceInstance = execution.getVariable("serviceInstanceId") + + msoLogger.debug("owningEntity: " + owningEntityId) + msoLogger.debug("OwningEntityName: "+ owningEntityName) + msoLogger.debug("Service Instance: " + serviceInstance) + + try{ + AAICreateResources aaiCR = new AAICreateResources() + if(owningEntityId==null||owningEntityId.equals("")){ + msg = "Exception in createOwningEntity. OwningEntityId is null in input."; + throw new IllegalStateException(); + }else{ + if(aaiCR.existsOwningEntity(owningEntityId)){ + aaiCR.connectOwningEntityandServiceInstance(owningEntityId,serviceInstance) + }else{ + if(owningEntityName==null||owningEntityName.equals("")){ + msg = "Exception in createOwningEntity. Can't create an owningEntity without an owningEntityName in input."; + throw new IllegalStateException(); + }else{ + Optional owningEntity = aaiCR.getOwningEntityNames(owningEntityName); + if(owningEntity.isPresent()){ + msg = "Exception in createOwningEntity. Can't create OwningEntity as name already exists in AAI associated with a different owning-entity-id (name must be unique)."; + throw new IllegalStateException(); + } else { + aaiCR.createAAIOwningEntity(owningEntityId, owningEntityName, serviceInstance) + } + } + } + } + }catch(Exception ex){ + msoLogger.debug(msg) + msoLogger.error(ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit createOwningEntity") + } + + // ******************************* + // Build Error Section + // ******************************* + + public void processJavaException(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try{ + msoLogger.debug("Caught a Java Exception in DoCreateServiceInstance") + msoLogger.debug("Started processJavaException Method") + msoLogger.debug("Variables List: " + execution.getVariables()) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception in DoCreateServiceInstance") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception in DoCreateServiceInstance") + + }catch(Exception e){ + msoLogger.debug("Caught Exception during processJavaException Method: " + e) + execution.setVariable("UnexpectedError", "Exception in processJavaException") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method") + } + msoLogger.trace("Completed processJavaException Method in DoCreateServiceInstance") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy new file mode 100644 index 0000000000..dd56b8f2cc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy @@ -0,0 +1,242 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* + +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.rest.APIResponse; +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.logger.MsoLogger +import org.onap.so.logger.MessageEnum + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; +/** + * This groovy class supports the DoCreateServiceInstanceRollback.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - rollbackData with + * globalCustomerId + * subscriptionServiceType + * serviceInstanceId + * disableRollback + * rollbackAAI + * rollbackSDNC + * sdncRollbackRequest + * + * + * Outputs: + * @param - rollbackError + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * + */ +public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateServiceInstanceRollback.class); + + + String Prefix="DCRESIRB_" + + public void preProcessRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + msoLogger.trace("preProcessRequest") + execution.setVariable("rollbackAAI",false) + execution.setVariable("rollbackSDNC",false) + + try { + def rollbackData = execution.getVariable("rollbackData") + msoLogger.debug("RollbackData:" + rollbackData) + + if (rollbackData != null) { + if (rollbackData.hasType("SERVICEINSTANCE")) { + + def serviceInstanceId = rollbackData.get("SERVICEINSTANCE", "serviceInstanceId") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + def subscriptionServiceType = rollbackData.get("SERVICEINSTANCE", "subscriptionServiceType") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + + def globalSubscriberId = rollbackData.get("SERVICEINSTANCE", "globalSubscriberId") + execution.setVariable("globalSubscriberId", globalSubscriberId) + + def rollbackAAI = rollbackData.get("SERVICEINSTANCE", "rollbackAAI") + if ("true".equals(rollbackAAI)) + { + execution.setVariable("rollbackAAI",true) + } + + def rollbackSDNC = rollbackData.get("SERVICEINSTANCE", "rollbackSDNC") + if ("true".equals(rollbackSDNC)) + { + execution.setVariable("rollbackSDNC", true) + } + + if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackSDNC") != true) + { + execution.setVariable("skipRollback", true) + } + + def sdncDelete = rollbackData.get("SERVICEINSTANCE", "sdncDelete") + execution.setVariable("sdncDelete", sdncDelete) + def sdncDeactivate = rollbackData.get("SERVICEINSTANCE", "sdncDeactivate") + execution.setVariable("sdncDeactivate", sdncDeactivate) + msoLogger.debug("sdncDeactivate:\n" + sdncDeactivate) + msoLogger.debug("sdncDelete:\n" + sdncDelete) + } + else { + execution.setVariable("skipRollback", true) + } + } + else { + execution.setVariable("skipRollback", true) + } + if (execution.getVariable("disableRollback").equals("true" )) + { + execution.setVariable("skipRollback", true) + } + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in Create ServiceInstance Rollback preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest") + } + + public void validateSDNCResponse(DelegateExecution execution, String response, String method) { + + msoLogger.trace("validateSDNCResponse") + String msg = "" + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + msoLogger.debug("SDNCResponse: " + response) + msoLogger.debug("workflowException: " + workflowException) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msg = "SDNC Adapter service-instance rollback successful for " + method + msoLogger.debug(msg) + }else{ + execution.setVariable("rolledBack", false) + msg = "Error Response from SDNC Adapter service-instance rollback for " + method + execution.setVariable("rollbackError", msg) + msoLogger.debug(msg) + throw new BpmnError("MSOWorkflowException") + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in Create ServiceInstance rollback for " + method + " Exception:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit validateSDNCResponse") + } + + public void postProcessRequest(DelegateExecution execution) { + + msoLogger.trace("postProcessRequest") + String msg = "" + try { + execution.setVariable("rollbackData", null) + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean rollbackAAI = execution.getVariable("rollbackAAI") + boolean rollbackSDNC = execution.getVariable("rollbackSDNC") + if (rollbackAAI || rollbackSDNC) + { + execution.setVariable("rolledBack", true) + } + if (rollbackAAI) + { + boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator") + if(!succInAAI){ + execution.setVariable("rolledBack", false) //both sdnc and aai must be successful to declare rollback Succesful + execution.setVariable("rollbackError", "Error deleting service-instance in AAI for rollback") + msoLogger.debug("Error deleting service-instance in AAI for rollback", + serviceInstanceId) + } + } + msoLogger.trace("Exit postProcessRequest") + + } catch (BpmnError e) { + msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + e.getMessage() + msoLogger.debug(msg) + } catch (Exception ex) { + msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + ex.getMessage() + msoLogger.debug(msg) + } + + } + + public void processRollbackException(DelegateExecution execution){ + + msoLogger.trace("processRollbackException") + try{ + msoLogger.debug("Caught an Exception in DoCreateServiceInstanceRollback") + execution.setVariable("rollbackData", null) + execution.setVariable("rollbackError", "Caught exception in ServiceInstance Create Rollback") + execution.setVariable("WorkflowException", null) + + }catch(BpmnError b){ + msoLogger.debug("BPMN Error during processRollbackExceptions Method: ") + }catch(Exception e){ + msoLogger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage()) + } + + msoLogger.debug("Exit processRollbackException") + } + + public void processRollbackJavaException(DelegateExecution execution){ + + msoLogger.trace("processRollbackJavaException") + try{ + execution.setVariable("rollbackData", null) + execution.setVariable("rollbackError", "Caught Java exception in ServiceInstance Create Rollback") + msoLogger.debug("Caught Exception in processRollbackJavaException") + + }catch(Exception e){ + msoLogger.debug("Caught Exception in processRollbackJavaException " + e.getMessage()) + } + msoLogger.trace("Exit processRollbackJavaException") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollbackV2.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollbackV2.groovy new file mode 100644 index 0000000000..6e1a5dcb55 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollbackV2.groovy @@ -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.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.camunda.bpm.engine.runtime.Execution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.client.orchestration.AAIServiceInstanceResources +import org.onap.so.logger.MsoLogger + + +public class DoCreateServiceInstanceRollbackV2 extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateServiceInstanceRollbackV2.class); + + @Override + public void preProcessRequest(DelegateExecution execution) { + + } + + public void aaiServiceInstanceRollback (DelegateExecution execution) { + def aaiServiceInstanceRollback = execution.getVariable("aaiServiceInstanceRollback") + if(aaiServiceInstanceRollback){ + msoLogger.trace("Started aaiServiceInstanceRollback") + try{ + ServiceDecomposition serviceDecomp = execution.getVariable("ServiceDecomposition") + AAIServiceInstanceResources aaiO = new AAIServiceInstanceResources() + aaiO.deleteServiceInstance(serviceDecomp) + }catch (Exception ex) { + String msg = "Error Response from AAI for aaiServiceInstanceRollback" + execution.setVariable("rollbackError", msg) + msoLogger.debug(msg) + throw new BpmnError("MSOWorkflowException") + } + msoLogger.trace("Completed aaiServiceInstanceRollback") + }else{ + msoLogger.trace("SKIPPING A&AI ROLLBACK") + } + } + + public void rollbackError (DelegateExecution execution) { + msoLogger.trace("rollbackError") + try{ + msoLogger.debug("Caught an Exception in DoCreateServiceInstanceRollbackV2") + }catch(BpmnError b){ + msoLogger.debug("BPMN Error during rollbackError: " + b.getMessage()) + }catch(Exception e){ + msoLogger.debug("Caught Exception during rollbackError: " + e.getMessage()) + } + msoLogger.debug(" Exit processRollbackException") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceV2.groovy new file mode 100644 index 0000000000..8af8e6ba1b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceV2.groovy @@ -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.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.client.orchestration.AAIServiceInstanceResources +import org.onap.so.client.orchestration.SDNCServiceInstanceResources +import org.onap.so.logger.MsoLogger +import org.onap.so.logger.MessageEnum + +import groovy.json.* + +/** + * This groovy class supports the DoCreateServiceInstanceV2.bpmn process. + * +*/ + +public class DoCreateServiceInstanceV2 extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateServiceInstanceV2.class); + AAIServiceInstanceResources aaiO = new AAIServiceInstanceResources() + SDNCServiceInstanceResources sdncO = new SDNCServiceInstanceResources() + + @Override + public void preProcessRequest(DelegateExecution execution) { + } + + public void createServiceInstance(DelegateExecution execution) { + execution.setVariable("callSDNC",true) + if(execution.getVariable("serviceType").equalsIgnoreCase("PORT-MIRROR")== false){ + if(execution.getVariable("sdncVersion").equals("1610")){ + execution.setVariable("callSDNC",false); + } + } + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") + try{ + aaiO.createServiceInstance(serviceDecomp) + } catch (BpmnError e) { + throw e + } + } + + public void createProject(DelegateExecution execution) { + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") + if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getProject() != null) { + try{ + aaiO.createProjectandConnectServiceInstance(serviceDecomp) + } catch (BpmnError e) { + throw e + } + } + } + + public void createOwningEntity(DelegateExecution execution) { + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") + if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getOwningEntity() != null) { + try{ + aaiO.createOwningEntityandConnectServiceInstance(serviceDecomp) + } catch (BpmnError e) { + throw e + } + } + } + + public void sdncAssignRequest(DelegateExecution execution) { + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") + if (serviceDecomp != null) { + try { + sdncO.sendSyncResponse(serviceDecomp) + } catch (BpmnError e) { + throw e + } + } + + } + + public void rollback(DelegateExecution execution) { + //TODO + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy new file mode 100644 index 0000000000..10f6acd403 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy @@ -0,0 +1,282 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - 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.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.core.json.JsonUtils +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 groovy.json.* + +/** + * This groovy class supports the DoCreateVFCNetworkServiceInstance.bpmn process. + * flow for VFC Network Service Create + */ +public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVFCNetworkServiceInstance.class); + + String vfcUrl = "/vfc/rest/v1/vfcadapter" + + String host = "http://mso.mso.testlab.openecomp.org:8080" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + public void preProcessRequest (DelegateExecution execution) { + String msg = "" + msoLogger.trace("preProcessRequest()") + try { + //deal with nsName and Description + String nsServiceName = execution.getVariable("nsServiceName") + String nsServiceDescription = execution.getVariable("nsServiceDescription") + msoLogger.debug("nsServiceName:" + nsServiceName + " nsServiceDescription:" + nsServiceDescription) + //deal with operation key + String globalSubscriberId = execution.getVariable("globalSubscriberId") + msoLogger.debug("globalSubscriberId:" + globalSubscriberId) + String serviceType = execution.getVariable("serviceType") + msoLogger.debug("serviceType:" + serviceType) + String serviceId = execution.getVariable("serviceId") + msoLogger.debug("serviceId:" + serviceId) + String operationId = execution.getVariable("operationId") + msoLogger.debug("serviceType:" + serviceType) + String nodeTemplateUUID = execution.getVariable("resourceUUID") + msoLogger.debug("nodeTemplateUUID:" + nodeTemplateUUID) + /* + * segmentInformation needed as a object of segment + * { + * "domain":"", + * "nodeTemplateName":"", + * "nodeType":"", + * "nsParameters":{ + * //this is the nsParameters sent to VF-C + * } + * } + */ + String nsParameters = execution.getVariable("resourceParameters") + msoLogger.debug("nsParameters:" + nsParameters) + String nsOperationKey = """{ + "globalSubscriberId":"${globalSubscriberId}", + "serviceType":"${serviceType}", + "serviceId":"${serviceId}", + "operationId":"${operationId}", + "nodeTemplateUUID":"${nodeTemplateUUID}" + }""" + execution.setVariable("nsOperationKey", nsOperationKey); + execution.setVariable("nsParameters", nsParameters) + + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest") + } + + /** + * create NS task + */ + public void createNetworkService(DelegateExecution execution) { + msoLogger.trace("createNetworkService") + String nsOperationKey = execution.getVariable("nsOperationKey"); + String nsParameters = execution.getVariable("nsParameters"); + String nsServiceName = execution.getVariable("nsServiceName") + String nsServiceDescription = execution.getVariable("nsServiceDescription") + String reqBody ="""{ + "nsServiceName":"${nsServiceName}", + "nsServiceDescription":"${nsServiceDescription}", + "nsOperationKey":${nsOperationKey}, + "nsParameters":${nsParameters} + }""" + APIResponse apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody) + String returnCode = apiResponse.getStatusCode() + String aaiResponseAsString = apiResponse.getResponseBodyAsString() + String nsInstanceId = ""; + if(returnCode== "200" || returnCode == "201"){ + nsInstanceId = jsonUtil.getJsonValue(aaiResponseAsString, "nsInstanceId") + } + execution.setVariable("nsInstanceId", nsInstanceId) + msoLogger.trace("Exit createNetworkService") + } + + /** + * instantiate NS task + */ + public void instantiateNetworkService(DelegateExecution execution) { + msoLogger.trace("instantiateNetworkService") + String nsOperationKey = execution.getVariable("nsOperationKey"); + String nsParameters = execution.getVariable("nsParameters"); + String nsServiceName = execution.getVariable("nsServiceName") + String nsServiceDescription = execution.getVariable("nsServiceDescription") + String reqBody ="""{ + "nsServiceName":"${nsServiceName}", + "nsServiceDescription":"${nsServiceDescription}", + "nsOperationKey":${nsOperationKey}, + "nsParameters":${nsParameters} + }""" + String nsInstanceId = execution.getVariable("nsInstanceId") + String url = host + vfcUrl + "/ns/" +nsInstanceId + "/instantiate" + APIResponse apiResponse = postRequest(execution, url, reqBody) + String returnCode = apiResponse.getStatusCode() + String aaiResponseAsString = apiResponse.getResponseBodyAsString() + String jobId = ""; + if(returnCode== "200"|| returnCode == "201"){ + jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") + } + execution.setVariable("jobId", jobId) + msoLogger.trace("Exit instantiateNetworkService") + } + + /** + * query NS task + */ + public void queryNSProgress(DelegateExecution execution) { + msoLogger.trace("queryNSProgress") + String jobId = execution.getVariable("jobId") + String nsOperationKey = execution.getVariable("nsOperationKey"); + String url = host + vfcUrl + "/jobs/" + jobId + APIResponse apiResponse = postRequest(execution, url, nsOperationKey) + String returnCode = apiResponse.getStatusCode() + String aaiResponseAsString = apiResponse.getResponseBodyAsString() + String operationStatus = "error" + if(returnCode== "200"|| returnCode == "201"){ + operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status") + } + execution.setVariable("operationStatus", operationStatus) + msoLogger.trace("Exit queryNSProgress") + } + + /** + * delay 5 sec + */ + public void timeDelay(DelegateExecution execution) { + try { + Thread.sleep(5000); + } catch(InterruptedException e) { + msoLogger.debug("Time Delay exception" + e ) + } + } + + /** + * finish NS task + */ + public void addNSRelationship(DelegateExecution execution) { + msoLogger.trace("addNSRelationship") + String nsInstanceId = execution.getVariable("nsInstanceId") + if(nsInstanceId == null || nsInstanceId == ""){ + msoLogger.debug(" create NS failed, so do not need to add relationship") + return + } + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String serviceId = execution.getVariable("serviceId") + String addRelationPayload = """ + service-instance + /aai/v11/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${nsInstanceId} + + customer.global-customer-id + ${MsoUtils.xmlEscape(globalSubscriberId)} + + + service-subscription.service-type + ${MsoUtils.xmlEscape(serviceType)} + + + service-instance.service-instance-id + ${MsoUtils.xmlEscape(nsInstanceId)} + + """ + String endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + msoLogger.debug("Add Relationship req:\n" + addRelationPayload) + String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + serviceId + "/relationship-list/relationship" + APIResponse aaiRsp = executeAAIPutCall(execution, url, addRelationPayload) + msoLogger.debug("aai response status code:" + aaiRsp.getStatusCode()) + msoLogger.debug("aai response content:" + aaiRsp.getResponseBodyAsString()) + msoLogger.trace("Exit addNSRelationship") + } + + public APIResponse executeAAIPutCall(DelegateExecution execution, String url, String payload){ + msoLogger.trace("Started Execute AAI Put Process") + APIResponse apiResponse = null + try{ + String uuid = utils.getRequestID() + msoLogger.debug("Generated uuid is: " + uuid) + msoLogger.debug("URL to be used is: " + url) + String userName = UrnPropertiesReader.getVariable("aai.auth", execution) + String password = UrnPropertiesReader.getVariable("mso.msoKey", execution) + String basicAuthCred = utils.getBasicAuth(userName,password) + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml"); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.httpPut(payload) + msoLogger.trace("Completed Execute AAI Put Process") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Put Call", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + throw new BpmnError("MSOWorkflowException") + } + return apiResponse + } + + /** + * post request + * url: the url of the request + * requestBody: the body of the request + */ + private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ + msoLogger.trace("Started Execute VFC adapter Post Process") + msoLogger.debug("url:"+url +"\nrequestBody:"+ requestBody) + APIResponse apiResponse = null + try{ + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); + apiResponse = client.httpPost(requestBody) + msoLogger.debug("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString()) + msoLogger.trace("Completed Execute VF-C adapter Post Process") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Post Call", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + throw new BpmnError("MSOWorkflowException") + } + return apiResponse + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy new file mode 100644 index 0000000000..59d38bfe86 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -0,0 +1,2133 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray +import org.json.JSONObject +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.CatalogDbUtils +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.NetworkUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.VfModuleBase +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.CloudFlavor +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.DecomposeJsonUtil +import org.onap.so.bpmn.core.json.JsonUtils +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.AAIUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +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.springframework.web.util.UriUtils +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.NamedNodeMap +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource + +import com.fasterxml.jackson.databind.ObjectMapper + + + +public class DoCreateVfModule extends VfModuleBase { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVfModule.class); + + String Prefix="DCVFM_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + CatalogDbUtils catalog = new CatalogDbUtils() + DecomposeJsonUtil decomposeJsonUtils = new DecomposeJsonUtil() + + /** + * Validates the request message and sets up the workflow. + * @param execution the execution + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + execution.setVariable('prefix', Prefix) + try{ + def rollbackData = execution.getVariable("rollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData() + } + + execution.setVariable("DCVFM_vnfParamsExistFlag", false) + execution.setVariable("DCVFM_oamManagementV4Address", "") + execution.setVariable("DCVFM_oamManagementV6Address", "") + + String request = execution.getVariable("DoCreateVfModuleRequest") + + if (request == null || request.isEmpty()) { + // Building Block-type request + + String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo") + + def serviceModelInfo = execution.getVariable("serviceModelInfo") + msoLogger.debug("serviceModelInfo: " + serviceModelInfo) + String modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") + msoLogger.debug("modelInvariantUuid: " + modelInvariantUuid) + + def vnfModelInfo = execution.getVariable("vnfModelInfo") + + //tenantId + def tenantId = execution.getVariable("tenantId") + execution.setVariable("DCVFM_tenantId", tenantId) + rollbackData.put("VFMODULE", "tenantid", tenantId) + //volumeGroupId + def volumeGroupId = execution.getVariable("volumeGroupId") + execution.setVariable("DCVFM_volumeGroupId", volumeGroupId) + //volumeGroupName + def volumeGroupName = execution.getVariable("volumeGroupName") + execution.setVariable("DCVFM_volumeGroupName", volumeGroupName) + //cloudSiteId + def cloudSiteId = execution.getVariable("lcpCloudRegionId") + execution.setVariable("DCVFM_cloudSiteId", cloudSiteId) + rollbackData.put("VFMODULE", "aiccloudregion", cloudSiteId) + msoLogger.debug("cloudSiteId: " + cloudSiteId) + //vnfType + def vnfType = execution.getVariable("vnfType") + execution.setVariable("DCVFM_vnfType", vnfType) + rollbackData.put("VFMODULE", "vnftype", vnfType) + msoLogger.debug("vnfType: " + vnfType) + //vnfName + def vnfName = execution.getVariable("vnfName") + execution.setVariable("DCVFM_vnfName", vnfName) + rollbackData.put("VFMODULE", "vnfname", vnfName) + msoLogger.debug("vnfName: " + vnfName) + //vnfId + def vnfId = execution.getVariable("vnfId") + execution.setVariable("DCVFM_vnfId", vnfId) + rollbackData.put("VFMODULE", "vnfid", vnfId) + msoLogger.debug("vnfId: " + vnfId) + //vfModuleName + def vfModuleName = execution.getVariable("vfModuleName") + execution.setVariable("DCVFM_vfModuleName", vfModuleName) + rollbackData.put("VFMODULE", "vfmodulename", vfModuleName) + msoLogger.debug("vfModuleName: " + vfModuleName) + //vfModuleModelName + def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName") + execution.setVariable("DCVFM_vfModuleModelName", vfModuleModelName) + rollbackData.put("VFMODULE", "vfmodulemodelname", vfModuleModelName) + msoLogger.debug("vfModuleModelName: " + vfModuleModelName) + //modelCustomizationUuid + def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid") + execution.setVariable("DCVFM_modelCustomizationUuid", modelCustomizationUuid) + rollbackData.put("VFMODULE", "modelcustomizationuuid", modelCustomizationUuid) + msoLogger.debug("modelCustomizationUuid: " + modelCustomizationUuid) + //vfModuleId + def vfModuleId = execution.getVariable("vfModuleId") + execution.setVariable("DCVFM_vfModuleId", vfModuleId) + msoLogger.debug("vfModuleId: " + vfModuleId) + def requestId = execution.getVariable("msoRequestId") + execution.setVariable("DCVFM_requestId", requestId) + msoLogger.debug("requestId: " + requestId) + rollbackData.put("VFMODULE", "msorequestid", requestId) + // Set mso-request-id to request-id for VNF Adapter interface + execution.setVariable("mso-request-id", requestId) + //serviceId + def serviceId = execution.getVariable("serviceId") + execution.setVariable("DCVFM_serviceId", serviceId) + msoLogger.debug("serviceId: " + serviceId) + //serviceInstanceId + def serviceInstanceId = execution.getVariable("serviceInstanceId") + execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId) + rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId) + msoLogger.debug("serviceInstanceId: " + serviceInstanceId) + //flavorList + ArrayList flavorList = execution.getVariable(cloudSiteId + "_flavorList") + if (flavorList != null) { + execution.setVariable("DCVFM_flavorList", flavorList) + logDebug("flavorList is: " + flavorList, isDebugLogEnabled) + } + //source - HARDCODED + def source = "VID" + execution.setVariable("DCVFM_source", source) + rollbackData.put("VFMODULE", "source", source) + msoLogger.debug("source: " + source) + //backoutOnFailure + def disableRollback = execution.getVariable("disableRollback") + def backoutOnFailure = true + if (disableRollback != null && disableRollback == true) { + backoutOnFailure = false + } + execution.setVariable("DCVFM_backoutOnFailure", backoutOnFailure) + msoLogger.debug("backoutOnFailure: " + backoutOnFailure) + //isBaseVfModule + def isBaseVfModule = execution.getVariable("isBaseVfModule") + execution.setVariable("DCVFM_isBaseVfModule", isBaseVfModule) + msoLogger.debug("isBaseVfModule: " + isBaseVfModule) + //asdcServiceModelVersion + def asdcServiceModelVersion = execution.getVariable("asdcServiceModelVersion") + execution.setVariable("DCVFM_asdcServiceModelVersion", asdcServiceModelVersion) + msoLogger.debug("asdcServiceModelVersion: " + asdcServiceModelVersion) + //personaModelId + execution.setVariable("DCVFM_personaModelId", jsonUtil.getJsonValue(vfModuleModelInfo, "modelInvariantUuid")) + //personaModelVersion + execution.setVariable("DCVFM_personaModelVersion", jsonUtil.getJsonValue(vfModuleModelInfo, "modelUuid")) + //vfModuleLabel + def vfModuleLabel = execution.getVariable("vfModuleLabel") + if (vfModuleLabel != null) { + execution.setVariable("DCVFM_vfModuleLabel", vfModuleLabel) + msoLogger.debug("vfModuleLabel: " + vfModuleLabel) + } + //Get or Generate UUID + String uuid = execution.getVariable("DCVFM_uuid") + if(uuid == null){ + uuid = UUID.randomUUID() + msoLogger.debug("Generated messageId (UUID) is: " + uuid) + }else{ + msoLogger.debug("Found messageId (UUID) is: " + uuid) + } + //isVidRequest + String isVidRequest = execution.getVariable("isVidRequest") + // default to true + if (isVidRequest == null || isVidRequest.isEmpty()) { + execution.setVariable("isVidRequest", "true") + } + //globalSubscriberId + String globalSubscriberId = execution.getVariable("globalSubscriberId") + execution.setVariable("DCVFM_globalSubscriberId", globalSubscriberId) + msoLogger.debug("globalSubsrciberId: " + globalSubscriberId) + Map vfModuleInputParams = execution.getVariable("vfModuleInputParams") + if (vfModuleInputParams != null) { + execution.setVariable("DCVFM_vnfParamsMap", vfModuleInputParams) + execution.setVariable("DCVFM_vnfParamsExistFlag", true) + } + //usePreload + def usePreload = execution.getVariable("usePreload") + execution.setVariable("DCVFM_usePreload", usePreload) + msoLogger.debug("usePreload: " + usePreload) + //aLaCarte + def aLaCarte = execution.getVariable("aLaCarte") + execution.setVariable("DCVFM_aLaCarte", aLaCarte) + msoLogger.debug("aLaCarte: " + aLaCarte) + + //get workload and environment context from parent SI + String environmentContext = "" + String workloadContext ="" + String serviceType ="" + + try{ + String json = catalog.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) + serviceType = jsonUtil.getJsonValue(json, "serviceResources.serviceType") + }catch(BpmnError e){ + throw e + } catch (Exception ex){ + String msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + try{ + AAIUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId) + AAIResourcesClient aaiRC = new AAIResourcesClient() + AAIResultWrapper aaiRW = aaiRC.get(serviceInstanceURI) + Map aaiJson = aaiRW.asMap() + environmentContext = aaiJson.getOrDefault("environment-context","") + workloadContext = aaiJson.getOrDefault("workload-context","") + + }catch (Exception ex) { + msoLogger.debug("Error retreiving parent service instance information") + } + + execution.setVariable("DCVFM_environmentContext",environmentContext) + execution.setVariable("DCVFM_workloadContext",workloadContext) + + } + else { + // The info is inside the request - DEAD CODE + msoLogger.debug("DoCreateVfModule request: " + request) + + //tenantId + def tenantId = "" + if (utils.nodeExists(request, "tenant-id")) { + tenantId = utils.getNodeText(request, "tenant-id") + } + execution.setVariable("DCVFM_tenantId", tenantId) + rollbackData.put("VFMODULE", "tenantid", tenantId) + //volumeGroupId + def volumeGroupId = "" + if (utils.nodeExists(request, "volume-group-id")) { + volumeGroupId = utils.getNodeText(request, "volume-group-id") + } + execution.setVariable("DCVFM_volumeGroupId", volumeGroupId) + //volumeGroupId + def volumeGroupName = "" + if (utils.nodeExists(request, "volume-group-name")) { + volumeGroupName = utils.getNodeText(request, "volume-group-name") + } + execution.setVariable("DCVFM_volumeGroupName", volumeGroupName) + //cloudSiteId + def cloudSiteId = "" + if (utils.nodeExists(request, "aic-cloud-region")) { + cloudSiteId = utils.getNodeText(request, "aic-cloud-region") + } + execution.setVariable("DCVFM_cloudSiteId", cloudSiteId) + rollbackData.put("VFMODULE", "aiccloudregion", cloudSiteId) + msoLogger.debug("cloudSiteId: " + cloudSiteId) + //vnfType + def vnfType = "" + if (utils.nodeExists(request, "vnf-type")) { + vnfType = utils.getNodeText(request, "vnf-type") + } + execution.setVariable("DCVFM_vnfType", vnfType) + rollbackData.put("VFMODULE", "vnftype", vnfType) + msoLogger.debug("vnfType: " + vnfType) + //vnfName + def vnfName = "" + if (utils.nodeExists(request, "vnf-name")) { + vnfName = utils.getNodeText(request, "vnf-name") + } + execution.setVariable("DCVFM_vnfName", vnfName) + rollbackData.put("VFMODULE", "vnfname", vnfName) + msoLogger.debug("vnfName: " + vnfName) + //vnfId + def vnfId = "" + if (utils.nodeExists(request, "vnf-id")) { + vnfId = utils.getNodeText(request, "vnf-id") + } + execution.setVariable("DCVFM_vnfId", vnfId) + rollbackData.put("VFMODULE", "vnfid", vnfId) + msoLogger.debug("vnfId: " + vnfId) + //vfModuleName + def vfModuleName = "" + if (utils.nodeExists(request, "vf-module-name")) { + vfModuleName = utils.getNodeText(request, "vf-module-name") + } + execution.setVariable("DCVFM_vfModuleName", vfModuleName) + rollbackData.put("VFMODULE", "vfmodulename", vfModuleName) + msoLogger.debug("vfModuleName: " + vfModuleName) + //vfModuleModelName + def vfModuleModelName = "" + if (utils.nodeExists(request, "vf-module-model-name")) { + vfModuleModelName = utils.getNodeText(request, "vf-module-model-name") + } + execution.setVariable("DCVFM_vfModuleModelName", vfModuleModelName) + rollbackData.put("VFMODULE", "vfmodulemodelname", vfModuleModelName) + msoLogger.debug("vfModuleModelName: " + vfModuleModelName) + //modelCustomizationUuid + def modelCustomizationUuid = "" + if (utils.nodeExists(request, "model-customization-id")) { + modelCustomizationUuid = utils.getNodeText(request, "model-customization-id") + } + execution.setVariable("DCVFM_modelCustomizationUuid", modelCustomizationUuid) + rollbackData.put("VFMODULE", "modelcustomizationuuid", modelCustomizationUuid) + msoLogger.debug("modelCustomizationUuid: " + modelCustomizationUuid) + //vfModuleId + def vfModuleId = "" + if (utils.nodeExists(request, "vf-module-id")) { + vfModuleId = utils.getNodeText(request, "vf-module-id") + } + execution.setVariable("DCVFM_vfModuleId", vfModuleId) + msoLogger.debug("vfModuleId: " + vfModuleId) + def requestId = "" + if (utils.nodeExists(request, "request-id")) { + requestId = utils.getNodeText(request, "request-id") + } + execution.setVariable("DCVFM_requestId", requestId) + msoLogger.debug("requestId: " + requestId) + //serviceId + def serviceId = "" + if (utils.nodeExists(request, "service-id")) { + serviceId = utils.getNodeText(request, "service-id") + } + execution.setVariable("DCVFM_serviceId", serviceId) + msoLogger.debug("serviceId: " + serviceId) + //serviceInstanceId + def serviceInstanceId = "" + if (utils.nodeExists(request, "service-instance-id")) { + serviceInstanceId = utils.getNodeText(request, "service-instance-id") + } + execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId) + rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId) + msoLogger.debug("serviceInstanceId: " + serviceInstanceId) + //source + def source = "" + if (utils.nodeExists(request, "source")) { + source = utils.getNodeText(request, "source") + } + execution.setVariable("DCVFM_source", source) + rollbackData.put("VFMODULE", "source", source) + msoLogger.debug("source: " + source) + //backoutOnFailure + NetworkUtils networkUtils = new NetworkUtils() + def backoutOnFailure = networkUtils.isRollbackEnabled(execution,request) + execution.setVariable("DCVFM_backoutOnFailure", backoutOnFailure) + msoLogger.debug("backoutOnFailure: " + backoutOnFailure) + //isBaseVfModule + def isBaseVfModule = "false" + if (utils.nodeExists(request, "is-base-vf-module")) { + isBaseVfModule = utils.getNodeText(request, "is-base-vf-module") + } + execution.setVariable("DCVFM_isBaseVfModule", isBaseVfModule) + msoLogger.debug("isBaseVfModule: " + isBaseVfModule) + //asdcServiceModelVersion + def asdcServiceModelVersion = "" + if (utils.nodeExists(request, "asdc-service-model-version")) { + asdcServiceModelVersion = utils.getNodeText(request, "asdc-service-model-version") + } + execution.setVariable("DCVFM_asdcServiceModelVersion", asdcServiceModelVersion) + msoLogger.debug("asdcServiceModelVersion: " + asdcServiceModelVersion) + + //personaModelId + def personaModelId = "" + if (utils.nodeExists(request, "persona-model-id")) { + personaModelId = utils.getNodeText(request, "persona-model-id") + } + execution.setVariable("DCVFM_personaModelId", personaModelId) + msoLogger.debug("personaModelId: " + personaModelId) + + //personaModelVersion + def personaModelVersion = "" + if (utils.nodeExists(request, "persona-model-version")) { + personaModelVersion = utils.getNodeText(request, "persona-model-version") + } + execution.setVariable("DCVFM_personaModelVersion", personaModelVersion) + msoLogger.debug("personaModelVersion: " + personaModelVersion) + + // Process the parameters + + String vnfParamsChildNodes = utils.getChildNodes(request, "vnf-params") + if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ + msoLogger.debug("Request contains NO VNF Params") + }else{ + msoLogger.debug("Request does contain VNF Params") + execution.setVariable("DCVFM_vnfParamsExistFlag", true) + + InputSource xmlSource = new InputSource(new StringReader(request)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document xml = docBuilder.parse(xmlSource) + //Get params, build map + Map paramsMap = new HashMap() + NodeList paramsList = xml.getElementsByTagNameNS("*", "param") + + for (int z = 0; z < paramsList.getLength(); z++) { + Node node = paramsList.item(z) + String paramValue = node.getTextContent() + NamedNodeMap e = node.getAttributes() + String paramName = e.getNamedItem("name").getTextContent() + paramsMap.put(paramName, paramValue) + } + execution.setVariable("DCVFM_vnfParamsMap", paramsMap) + } + } + + //Get or Generate UUID + String uuid = execution.getVariable("DCVFM_uuid") + if(uuid == null){ + uuid = UUID.randomUUID() + msoLogger.debug("Generated messageId (UUID) is: " + uuid) + }else{ + msoLogger.debug("Found messageId (UUID) is: " + uuid) + } + // Get sdncVersion, default to empty + String sdncVersion = execution.getVariable("sdncVersion") + if (sdncVersion == null) { + sdncVersion = "" + } + msoLogger.debug("sdncVersion: " + sdncVersion) + execution.setVariable("DCVFM_sdncVersion", sdncVersion) + + execution.setVariable("DCVFM_uuid", uuid) + execution.setVariable("DCVFM_baseVfModuleId", "") + execution.setVariable("DCVFM_baseVfModuleHeatStackId", "") + execution.setVariable("DCVFM_heatStackId", "") + execution.setVariable("DCVFM_contrailServiceInstanceFqdn", "") + execution.setVariable("DCVFM_volumeGroupStackId", "") + execution.setVariable("DCVFM_cloudRegionForVolume", "") + execution.setVariable("DCVFM_contrailNetworkPolicyFqdnList", "") + execution.setVariable("DCVFM_vnfTypeToQuery", "generic-vnf") + rollbackData.put("VFMODULE", "rollbackPrepareUpdateVfModule", "false") + rollbackData.put("VFMODULE", "rollbackUpdateAAIVfModule", "false") + rollbackData.put("VFMODULE", "rollbackVnfAdapterCreate", "false") + rollbackData.put("VFMODULE", "rollbackSDNCRequestActivate", "false") + rollbackData.put("VFMODULE", "rollbackSDNCRequestAssign", "false") + rollbackData.put("VFMODULE", "rollbackCreateAAIVfModule", "false") + rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "false") + rollbackData.put("VFMODULE", "rollbackUpdateVnfAAI", "false") + rollbackData.put("VFMODULE", "heatstackid", "") + + String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { + def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, msg); + + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + execution.setVariable("DCVFM_sdncCallbackUrl", sdncCallbackUrl) + msoLogger.debug("SDNC Callback URL is: " + sdncCallbackUrl) + + + execution.setVariable("rollbackData", rollbackData) + }catch(BpmnError b){ + throw b + }catch(Exception e){ + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!") + } + + msoLogger.trace('Exited ' + method) + } + + /** + * Validates a workflow response. + * @param execution the execution + * @param responseVar the execution variable in which the response is stored + * @param responseCodeVar the execution variable in which the response code is stored + * @param errorResponseVar the execution variable in which the error response is stored + */ + public void validateWorkflowResponse(DelegateExecution execution, String responseVar, + String responseCodeVar, String errorResponseVar) { + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, responseVar, responseCodeVar, errorResponseVar) + } + + + /** + * Sends the empty, synchronous response back to the API Handler. + * @param execution the execution + */ + public void sendResponse(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendResponse(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + sendWorkflowResponse(execution, 200, "") + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Internal Error') + } + } + + /** + * Using the received vnfId and vfModuleId, query AAI to get the corresponding VNF info. + * A 200 response is expected with the VNF info in the response body. Will find out the base module info + * and existing VNF's name for add-on modules + * + * @param execution The flow's execution instance. + */ + public void postProcessCreateAAIVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.getVfModule(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def createResponse = execution.getVariable('DCVFM_createVfModuleResponse') + msoLogger.debug("createVfModule Response: " + createResponse) + + def rollbackData = execution.getVariable("rollbackData") + String vnfName = utils.getNodeText(createResponse, 'vnf-name') + if (vnfName != null) { + execution.setVariable('DCVFM_vnfName', vnfName) + msoLogger.debug("vnfName retrieved from AAI is: " + vnfName) + rollbackData.put("VFMODULE", "vnfname", vnfName) + } + String vnfId = utils.getNodeText(createResponse, 'vnf-id') + execution.setVariable('DCVFM_vnfId', vnfId) + msoLogger.debug("vnfId is: " + vnfId) + String vfModuleId = utils.getNodeText(createResponse, 'vf-module-id') + execution.setVariable('DCVFM_vfModuleId', vfModuleId) + msoLogger.debug("vfModuleId is: " + vfModuleId) + String vfModuleIndex= utils.getNodeText(createResponse, 'vf-module-index') + execution.setVariable('DCVFM_vfModuleIndex', vfModuleIndex) + msoLogger.debug("vfModuleIndex is: " + vfModuleIndex) + rollbackData.put("VFMODULE", "vnfid", vnfId) + rollbackData.put("VFMODULE", "vfmoduleid", vfModuleId) + rollbackData.put("VFMODULE", "rollbackCreateAAIVfModule", "true") + rollbackData.put("VFMODULE", "rollbackPrepareUpdateVfModule", "true") + execution.setVariable("rollbackData", rollbackData) + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while postProcessing CreateAAIVfModule request:' + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Bad response from CreateAAIVfModule' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } + + + /** + * Using the received vnfId and vfModuleId, query AAI to get the corresponding VNF info. + * A 200 response is expected with the VNF info in the response body. Will find out the base module info. + * + * @param execution The flow's execution instance. + */ + public void queryAAIVfModule(DelegateExecution execution) { + + def method = getClass().getSimpleName() + '.getVfModule(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('DCVFM_vnfId') + def vfModuleId = execution.getVariable('DCVFM_vfModuleId') + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" + + try { + RESTConfig config = new RESTConfig(endPoint); + def responseData = '' + def aaiRequestId = UUID.randomUUID().toString() + RESTClient client = new RESTClient(config). + addHeader('X-TransactionId', aaiRequestId). + addHeader('X-FromAppId', 'MSO'). + addHeader('Content-Type', 'application/xml'). + addHeader('Accept','application/xml'); + msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') + APIResponse response = client.httpGet() + + responseData = response.getResponseBodyAsString() + if (responseData != null) { + msoLogger.debug("Received generic VNF data: " + responseData) + + } + + execution.setVariable('DCVFM_queryAAIVfModuleResponseCode', response.getStatusCode()) + execution.setVariable('DCVFM_queryAAIVfModuleResponse', responseData) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + if (response.getStatusCode() == 200) { + // Parse the VNF record from A&AI to find base module info + msoLogger.debug('Parsing the VNF data to find base module info') + if (responseData != null) { + def vfModulesText = utils.getNodeXml(responseData, "vf-modules") + def xmlVfModules= new XmlSlurper().parseText(vfModulesText) + def vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} + int vfModulesSize = 0 + for (i in 0..vfModules.size()-1) { + def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i]) + def isBaseVfModule = utils.getNodeText(vfModuleXml, "is-base-vf-module") + + if (isBaseVfModule == "true") { + String baseModuleId = utils.getNodeText(vfModuleXml, "vf-module-id") + execution.setVariable("DCVFM_baseVfModuleId", baseModuleId) + msoLogger.debug('Received baseVfModuleId: ' + baseModuleId) + String baseModuleHeatStackId = utils.getNodeText(vfModuleXml, "heat-stack-id") + execution.setVariable("DCVFM_baseVfModuleHeatStackId", baseModuleHeatStackId) + msoLogger.debug('Received baseVfModuleHeatStackId: ' + baseModuleHeatStackId) + } + } + } + } + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) + } + } + + /** + * Using the vnfId and vfModuleName provided in the inputs, + * query AAI to get the corresponding VF Module info. + * A 200 response is expected with the VF Module info in the response body, + * or a 404 response if the module does not exist yet. Will determine VF Module's + * orchestration status if one exists + * + * @param execution The flow's execution instance. + */ + public void queryAAIVfModuleForStatus(DelegateExecution execution) { + + def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + execution.setVariable('DCVFM_orchestrationStatus', '') + + try { + def vnfId = execution.getVariable('DCVFM_vnfId') + def vfModuleName = execution.getVariable('DCVFM_vfModuleName') + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + + "/vf-modules/vf-module?vf-module-name=" + UriUtils.encode(vfModuleName, "UTF-8") + msoLogger.debug("AAI endPoint: " + endPoint) + + try { + RESTConfig config = new RESTConfig(endPoint); + def responseData = '' + def aaiRequestId = UUID.randomUUID().toString() + RESTClient client = new RESTClient(config). + addHeader('X-TransactionId', aaiRequestId). + addHeader('X-FromAppId', 'MSO'). + addHeader('Content-Type', 'application/xml'). + addHeader('Accept','application/xml'); + msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') + APIResponse response = client.httpGet() + msoLogger.debug("createVfModule - invoking httpGet() to AAI") + + responseData = response.getResponseBodyAsString() + if (responseData != null) { + msoLogger.debug("Received generic VNF data: " + responseData) + + } + + execution.setVariable('DCVFM_queryAAIVfModuleForStatusResponseCode', response.getStatusCode()) + execution.setVariable('DCVFM_queryAAIVfModuleForStatusResponse', responseData) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + // Retrieve VF Module info and its orchestration status; if not found, do nothing + if (response.getStatusCode() == 200) { + // Parse the VNF record from A&AI to find base module info + msoLogger.debug('Parsing the VNF data to find orchestration status') + if (responseData != null) { + def vfModuleText = utils.getNodeXml(responseData, "vf-module") + //def xmlVfModule= new XmlSlurper().parseText(vfModuleText) + def orchestrationStatus = utils.getNodeText(vfModuleText, "orchestration-status") + execution.setVariable("DCVFM_orchestrationStatus", orchestrationStatus) + // Also retrieve vfModuleId + def vfModuleId = utils.getNodeText(vfModuleText, "vf-module-id") + execution.setVariable("DCVFM_vfModuleId", vfModuleId) + msoLogger.debug("Received orchestration status from A&AI: " + orchestrationStatus) + + } + } + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage()) + } + } + + + public void preProcessSDNCAssignRequest(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessSDNCAssignRequest") + def vnfId = execution.getVariable("DCVFM_vnfId") + def vfModuleId = execution.getVariable("DCVFM_vfModuleId") + def serviceInstanceId = execution.getVariable("DCVFM_serviceInstanceId") + msoLogger.debug("NEW VNF ID: " + vnfId) + + try{ + + //Build SDNC Request + + def svcInstId = "" + if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { + svcInstId = vfModuleId + } + else { + svcInstId = serviceInstanceId + } + + String assignSDNCRequest = buildSDNCRequest(execution, svcInstId, "assign") + + assignSDNCRequest = utils.formatXml(assignSDNCRequest) + execution.setVariable("DCVFM_assignSDNCRequest", assignSDNCRequest) + msoLogger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCAssignRequest") + } + + public void preProcessSDNCGetRequest(DelegateExecution execution, String element){ + + String sdncVersion = execution.getVariable("DCVFM_sdncVersion") + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessSDNCGetRequest Process") + try{ + def serviceInstanceId = execution.getVariable('DCVFM_serviceInstanceId') + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + + def callbackUrl = execution.getVariable("DCVFM_sdncCallbackUrl") + msoLogger.debug("callbackUrl:" + callbackUrl) + + def vfModuleId = execution.getVariable('DCVFM_vfModuleId') + + def svcInstId = "" + if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { + svcInstId = vfModuleId + } + else { + svcInstId = serviceInstanceId + } + + def msoAction = "" + if (!sdncVersion.equals("1707")) { + msoAction = "mobility" + } + else { + msoAction = "vfmodule" + } + // For VNF, serviceOperation (URI for topology GET) will be retrieved from "selflink" element + // in the response from GenericGetVnf + // For VF Module, in 1707 serviceOperation will be retrieved from "object-path" element + // in SDNC Assign Response + // For VF Module for older versions, serviceOperation is constructed using vfModuleId + + String serviceOperation = "" + if (element.equals("vnf")) { + def vnfQueryResponse = execution.getVariable("DCVFM_vnfQueryResponse") + serviceOperation = utils.getNodeText(vnfQueryResponse, "selflink") + msoLogger.debug("VNF - service operation: " + serviceOperation) + } + else if (element.equals("vfmodule")) { + String response = execution.getVariable("DCVFM_assignSDNCAdapterResponse") + msoLogger.debug("DCVFM_assignSDNCAdapterResponse is: \n" + response) + + if (!sdncVersion.equals("1707")) { + serviceOperation = "/VNF-API:vnfs/vnf-list/" + vfModuleId + msoLogger.debug("VF Module with sdncVersion before 1707 - service operation: " + serviceOperation) + } + else { + String data = utils.getNodeXml(response, "response-data") + msoLogger.debug("responseData: " + data) + serviceOperation = utils.getNodeText(data, "object-path") + msoLogger.debug("VF Module with sdncVersion of 1707 - service operation: " + serviceOperation) + } + } + + //!!!! TEMPORARY WORKAROUND FOR SDNC REPLICATION ISSUE + sleep(5000) + + String SDNCGetRequest = + """ + + ${MsoUtils.xmlEscape(uuid)} + ${MsoUtils.xmlEscape(svcInstId)} + query + ${MsoUtils.xmlEscape(serviceOperation)} + ${MsoUtils.xmlEscape(callbackUrl)} + ${MsoUtils.xmlEscape(msoAction)} + + + """ + + execution.setVariable("DCVFM_getSDNCRequest", SDNCGetRequest) + msoLogger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCGetRequest Process") + } + + + public void preProcessVNFAdapterRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.VNFAdapterCreateVfModule(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + //def xml = execution.getVariable("DoCreateVfModuleRequest") + //msoLogger.debug('VNF REQUEST is: ' + xml) + + //Get variables + //cloudSiteId + def cloudSiteId = execution.getVariable("DCVFM_cloudSiteId") + //tenantId + def tenantId = execution.getVariable("DCVFM_tenantId") + //vnfType + def vnfType = execution.getVariable("DCVFM_vnfType") + //vnfName + def vnfName = execution.getVariable("DCVFM_vnfName") + //vnfId + def vnfId = execution.getVariable("DCVFM_vnfId") + //vfModuleName + def vfModuleName = execution.getVariable("DCVFM_vfModuleName") + //vfModuleModelName + def vfModuleModelName = execution.getVariable("DCVFM_vfModuleModelName") + //vfModuleId + def vfModuleId = execution.getVariable("DCVFM_vfModuleId") + //vfModuleIndex + def vfModuleIndex = execution.getVariable("DCVFM_vfModuleIndex") + //requestId + def requestId = execution.getVariable("DCVFM_requestId") + //serviceId + def serviceId = execution.getVariable("DCVFM_serviceId") + //serviceInstanceId + def serviceInstanceId = execution.getVariable("DCVFM_serviceInstanceId") + //flavorList + ArrayList flavorList = execution.getVariable("DCVFM_flavorList") + //backoutOnFailure + def backoutOnFailure = execution.getVariable("DCVFM_backoutOnFailure") + //volumeGroupId + def volumeGroupId = execution.getVariable("DCVFM_volumeGroupId") + // baseVfModuleId + def baseVfModuleId = execution.getVariable("DCVFM_baseVfModuleId") + // baseVfModuleStackId + def baseVfModuleStackId = execution.getVariable("DCVFM_baseVfModuleHeatStackId") + // asdcServiceModelVersion + def asdcServiceModelVersion = execution.getVariable("DCVFM_asdcServiceModelVersion") + //volumeGroupStackId + def volumeGroupStackId = execution.getVariable("DCVFM_volumeGroupStackId") + //modelCustomizationUuid + def modelCustomizationUuid = execution.getVariable("DCVFM_modelCustomizationUuid") + //environmentContext + String environmentContext = execution.getVariable("DCVFM_environmentContext") + //workloadContext + String workloadContext = execution.getVariable("DCVFM_workloadContext") + msoLogger.debug("workloadContext: " + workloadContext) + msoLogger.debug("environmentContext: " + environmentContext) + + def messageId = execution.getVariable('mso-request-id') + '-' + + System.currentTimeMillis() + + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) + def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) + + msoLogger.debug("notificationUrl: " + notificationUrl) + msoLogger.debug("QualifiedHostName: " + useQualifiedHostName) + + if ('true'.equals(useQualifiedHostName)) { + notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) + } + + Map vnfParamsMap = execution.getVariable("DCVFM_vnfParamsMap") + // Add flavorLabel List to vnfParamsMap + flavorList.each { cloudFlavor -> + vnfParamsMap.put("label_" + cloudFlavor.getFlavorLabel(), cloudFlavor.getFlavor()) + } + String vfModuleParams = "" + //Get SDNC Response Data for VF Module Topology + String vfModuleSdncGetResponse = execution.getVariable('DCVFM_getSDNCAdapterResponse') + msoLogger.debug("sdncGetResponse: " + vfModuleSdncGetResponse) + def sdncVersion = execution.getVariable("sdncVersion") + + if (!sdncVersion.equals("1707")) { + + vfModuleParams = buildVfModuleParams(vnfParamsMap, vfModuleSdncGetResponse, vnfId, vnfName, + vfModuleId, vfModuleName, vfModuleIndex, environmentContext, workloadContext) + } + else { + //Get SDNC Response Data for Vnf Topology + String vnfSdncGetResponse = execution.getVariable('DCVFM_getVnfSDNCAdapterResponse') + msoLogger.debug("vnfSdncGetResponse: " + vnfSdncGetResponse) + + vfModuleParams = buildVfModuleParamsFromCombinedTopologies(vnfParamsMap, vnfSdncGetResponse, vfModuleSdncGetResponse, vnfId, vnfName, + vfModuleId, vfModuleName, vfModuleIndex, environmentContext, workloadContext) + } + + def svcInstId = "" + if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { + svcInstId = serviceId + } + else { + svcInstId = serviceInstanceId + } + + def createVnfARequest = """ + + ${MsoUtils.xmlEscape(cloudSiteId)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vnfName)} + ${MsoUtils.xmlEscape(vfModuleName)} + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(vnfType)} + ${MsoUtils.xmlEscape(vfModuleModelName)} + ${MsoUtils.xmlEscape(asdcServiceModelVersion)} + ${MsoUtils.xmlEscape(modelCustomizationUuid)} + + ${MsoUtils.xmlEscape(volumeGroupId)} + ${MsoUtils.xmlEscape(volumeGroupStackId)} + ${MsoUtils.xmlEscape(baseVfModuleId)} + ${MsoUtils.xmlEscape(baseVfModuleStackId)} + true + ${MsoUtils.xmlEscape(backoutOnFailure)} + true + + ${vfModuleParams} + + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(svcInstId)} + + ${MsoUtils.xmlEscape(messageId)} + ${MsoUtils.xmlEscape(notificationUrl)} + """ + + msoLogger.debug("Create VfModule Request to VNF Adapter: " + createVnfARequest) + execution.setVariable("DCVFM_createVnfARequest", createVnfARequest) + } + + /** + * Validates the request, request id and service instance id. If a problem is found, + * a WorkflowException is generated and an MSOWorkflowException event is thrown. This + * method also sets up the log context for the workflow. + * @param execution the execution + * @return the validated request + */ + public String validateInfraRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.validateInfraRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + String processKey = getProcessKey(execution); + def prefix = execution.getVariable("prefix") + + if (prefix == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null") + } + + try { + def request = execution.getVariable(prefix + 'Request') + + if (request == null) { + request = execution.getVariable(processKey + 'Request') + + if (request == null) { + request = execution.getVariable('bpmnRequest') + } + + setVariable(execution, processKey + 'Request', null); + setVariable(execution, 'bpmnRequest', null); + setVariable(execution, prefix + 'Request', request); + } + + if (request == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null") + } + msoLogger.debug("DoCreateVfModule Request: " + request) + + /* + + def requestId = execution.getVariable("mso-request-id") + + if (requestId == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request has no mso-request-id") + } + + def serviceInstanceId = execution.getVariable("mso-service-instance-id") + + if (serviceInstanceId == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id") + } + + utils.logContext(requestId, serviceInstanceId) + */ + msoLogger.debug('Incoming message: ' + System.lineSeparator() + request) + msoLogger.trace('Exited ' + method) + return request + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") + } + } + + public boolean isVolumeGroupIdPresent(DelegateExecution execution) { + + def method = getClass().getSimpleName() + '.isVolumeGroupIdPresent(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + def request = execution.getVariable('DoCreateVfModuleRequest') + String volumeGroupId = utils.getNodeText(request, "volume-group-id") + if (volumeGroupId == null || volumeGroupId.isEmpty()) { + msoLogger.debug('No volume group id is present') + return false + } + else { + msoLogger.debug('Volume group id is present') + return true + } + + } + + public boolean isVolumeGroupNamePresent(DelegateExecution execution) { + + def method = getClass().getSimpleName() + '.isVolumeGroupNamePresent(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + def request = execution.getVariable('DoCreateVfModuleRequest') + String volumeGroupName = utils.getNodeText(request, "volume-group-name") + if (volumeGroupName == null || volumeGroupName.isEmpty()) { + msoLogger.debug('No volume group name is present') + return false + } + else { + msoLogger.debug('Volume group name is present') + return true + } + + } + + public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + def callbackURL = execution.getVariable("DCVFM_sdncCallbackUrl") + def requestId = execution.getVariable("DCVFM_requestId") + def serviceId = execution.getVariable("DCVFM_serviceId") + def vnfType = execution.getVariable("DCVFM_vnfType") + def vnfName = execution.getVariable("DCVFM_vnfName") + def tenantId = execution.getVariable("DCVFM_tenantId") + def source = execution.getVariable("DCVFM_source") + def backoutOnFailure = execution.getVariable("DCVFM_backoutOnFailure") + def vfModuleId = execution.getVariable("DCVFM_vfModuleId") + def vfModuleName = execution.getVariable("DCVFM_vfModuleName") + def vfModuleModelName = execution.getVariable("DCVFM_vfModuleModelName") + def vnfId = execution.getVariable("DCVFM_vnfId") + def cloudSiteId = execution.getVariable("DCVFM_cloudSiteId") + def sdncVersion = execution.getVariable("DCVFM_sdncVersion") + def serviceModelInfo = execution.getVariable("serviceModelInfo") + def vnfModelInfo = execution.getVariable("vnfModelInfo") + def vfModuleModelInfo = execution.getVariable("vfModuleModelInfo") + String serviceEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(serviceModelInfo) + String vnfEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(vnfModelInfo) + String vfModuleEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(vfModuleModelInfo) + def globalSubscriberId = execution.getVariable("DCVFM_globalSubscriberId") + boolean usePreload = execution.getVariable("DCVFM_usePreload") + String usePreloadToSDNC = usePreload ? "Y" : "N" + def modelCustomizationUuid = execution.getVariable("DCVFM_modelCustomizationUuid") + def modelCustomizationUuidString = "" + if (!usePreload) { + modelCustomizationUuidString = "" + modelCustomizationUuid + "" + } + + String sdncVNFParamsXml = "" + + if(execution.getVariable("DCVFM_vnfParamsExistFlag") == true){ + if (!sdncVersion.equals("1707")) { + sdncVNFParamsXml = buildSDNCParamsXml(execution) + } + else { + sdncVNFParamsXml = buildCompleteSDNCParamsXml(execution) + } + }else{ + sdncVNFParamsXml = "" + } + + String sdncRequest = "" + + if (!sdncVersion.equals("1707")) { + + sdncRequest = + """ + + ${MsoUtils.xmlEscape(uuid)} + ${MsoUtils.xmlEscape(svcInstId)} + ${MsoUtils.xmlEscape(action)} + vnf-topology-operation + ${MsoUtils.xmlEscape(callbackURL)} + + + + ${MsoUtils.xmlEscape(requestId)} + VNFActivateRequest + ${MsoUtils.xmlEscape(source)} + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(svcInstId)} + notsurewecare + + + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(vfModuleModelName)} + ${MsoUtils.xmlEscape(vfModuleName)} + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vnfName)} + ${MsoUtils.xmlEscape(vnfType)} + ${MsoUtils.xmlEscape(cloudSiteId)} + ${MsoUtils.xmlEscape(tenantId)} + ${modelCustomizationUuidString} + ${MsoUtils.xmlEscape(usePreloadToSDNC)} + ${sdncVNFParamsXml} + + + """ + + } + else { + + sdncRequest = + """ + + ${MsoUtils.xmlEscape(uuid)} + ${MsoUtils.xmlEscape(svcInstId)} + ${MsoUtils.xmlEscape(action)} + vf-module-topology-operation + ${MsoUtils.xmlEscape(callbackURL)} + generic-resource + + + + ${MsoUtils.xmlEscape(requestId)} + CreateVfModuleInstance + ${MsoUtils.xmlEscape(source)} + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(serviceId)} + ${serviceEcompModelInformation} + ${MsoUtils.xmlEscape(svcInstId)} + ${MsoUtils.xmlEscape(globalSubscriberId)} + + + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vnfType)} + ${vnfEcompModelInformation} + + + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(vfModuleModelName)} + ${vfModuleEcompModelInformation} + + + ${MsoUtils.xmlEscape(vfModuleName)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(cloudSiteId)} + ${sdncVNFParamsXml} + + + """ + + + /* + sdncRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(svcInstId)} + ${MsoUtils.xmlEscape(action)} + vnf-topology-operation + ${MsoUtils.xmlEscape(callbackURL)} + + + + ${MsoUtils.xmlEscape(requestId)} + CreateVfModuleInstance + ${MsoUtils.xmlEscape(source)} + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(serviceId)} + ${serviceEcompModelInformation} + ${MsoUtils.xmlEscape(svcInstId)} + ${MsoUtils.xmlEscape(globalSubscriberId)} + + + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vnfType)} + ${vnfEcompModelInformation} + + + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(vfModuleModelName)} + ${vfModuleEcompModelInformation} + + + ${MsoUtils.xmlEscape(vfModuleName)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(cloudSiteId)} + ${sdncVNFParamsXml} + + + """ + */ + + } + + msoLogger.debug("sdncRequest: " + sdncRequest) + return sdncRequest + + } + + public void preProcessSDNCActivateRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessSDNCActivateRequest Process") + try{ + String vnfId = execution.getVariable("DCVFM_vnfId") + String vfModuleId = execution.getVariable("DCVFM_vfModuleId") + String serviceInstanceId = execution.getVariable("DCVFM_serviceInstanceId") + + def svcInstId = "" + if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { + svcInstId = vfModuleId + } + else { + svcInstId = serviceInstanceId + } + String activateSDNCRequest = buildSDNCRequest(execution, svcInstId, "activate") + + execution.setVariable("DCVFM_activateSDNCRequest", activateSDNCRequest) + msoLogger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest) + + }catch(Exception e){ + msoLogger.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCActivateRequest Process") + } + + public void postProcessVNFAdapterRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix",Prefix) + try{ + msoLogger.debug("STARTED postProcessVNFAdapterRequest Process") + + String vnfResponse = execution.getVariable("DCVFM_createVnfAResponse") + msoLogger.debug("VNF Adapter Response is: " + vnfResponse) + + RollbackData rollbackData = execution.getVariable("rollbackData") + if(vnfResponse != null){ + + if(vnfResponse.contains("createVfModuleResponse")){ + msoLogger.debug("Received a Good Response from VNF Adapter for CREATE_VF_MODULE Call.") + execution.setVariable("DCVFM_vnfVfModuleCreateCompleted", true) + String heatStackId = utils.getNodeText(vnfResponse, "vfModuleStackId") + execution.setVariable("DCVFM_heatStackId", heatStackId) + msoLogger.debug("Received heat stack id from VNF Adapter: " + heatStackId) + rollbackData.put("VFMODULE", "heatstackid", heatStackId) + // Parse vnfOutputs for network_fqdn + if (vnfResponse.contains("vfModuleOutputs")) { + def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs") + InputSource source = new InputSource(new StringReader(vfModuleOutputsXml)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document outputsXml = docBuilder.parse(source) + + NodeList entries = outputsXml.getElementsByTagNameNS("*", "entry") + List contrailNetworkPolicyFqdnList = [] + for (int i = 0; i< entries.getLength(); i++) { + Node node = entries.item(i) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element element = (Element) node + String key = element.getElementsByTagNameNS("*", "key").item(0).getTextContent() + if (key.equals("contrail-service-instance-fqdn")) { + String contrailServiceInstanceFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() + msoLogger.debug("Obtained contrailServiceInstanceFqdn: " + contrailServiceInstanceFqdn) + execution.setVariable("DCVFM_contrailServiceInstanceFqdn", contrailServiceInstanceFqdn) + } + else if (key.endsWith("contrail_network_policy_fqdn")) { + String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() + msoLogger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn) + contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn) + } + else if (key.equals("oam_management_v4_address")) { + String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() + msoLogger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address) + execution.setVariable("DCVFM_oamManagementV4Address", oamManagementV4Address) + } + else if (key.equals("oam_management_v6_address")) { + String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() + msoLogger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address) + execution.setVariable("DCVFM_oamManagementV6Address", oamManagementV6Address) + } + + } + } + if (!contrailNetworkPolicyFqdnList.isEmpty()) { + execution.setVariable("DCVFM_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList) + } + } + }else{ + msoLogger.debug("Received a BAD Response from VNF Adapter for CREATE_VF_MODULE Call.") + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error") + } + }else{ + msoLogger.debug("Response from VNF Adapter is Null for CREATE_VF_MODULE Call.") + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter") + } + + rollbackData.put("VFMODULE", "rollbackVnfAdapterCreate", "true") + execution.setVariable("rollbackData", rollbackData) + + }catch(BpmnError b){ + throw b + }catch(Exception e){ + msoLogger.debug("Internal Error Occured in PostProcess Method") + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method") + } + msoLogger.trace("COMPLETED postProcessVnfAdapterResponse Process") + } + + + public void preProcessUpdateAAIVfModuleRequestOrch(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessUpdateAAIVfModuleRequestOrch(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessUpdateAAIVfModuleRequestOrch") + + try{ + + //Build UpdateAAIVfModule Request + boolean setContrailServiceInstanceFqdn = false + def contrailServiceInstanceFqdn = execution.getVariable("DCVFM_contrailServiceInstanceFqdn") + if (!contrailServiceInstanceFqdn.equals("")) { + setContrailServiceInstanceFqdn = true + } + + execution.setVariable("DCVFM_orchestrationStatus", "Created") + + String updateAAIVfModuleRequest = buildUpdateAAIVfModuleRequest(execution, false, true, true, setContrailServiceInstanceFqdn) + + updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest) + execution.setVariable("DCVFM_updateAAIVfModuleRequest", updateAAIVfModuleRequest) + msoLogger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessUpdateAAIVfModuleRequestOrch", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestOrch Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestOrch") + + } + + public void preProcessUpdateAAIVfModuleRequestStatus(DelegateExecution execution, String status) { + def method = getClass().getSimpleName() + '.preProcessUpdateAAIVfModuleStatus(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessUpdateAAIVfModuleStatus") + + try{ + + //Build UpdateAAIVfModule Request + execution.setVariable("DCVFM_orchestrationStatus", status) + + String updateAAIVfModuleRequest = buildUpdateAAIVfModuleRequest(execution, false, true, false, false) + + updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest) + execution.setVariable("DCVFM_updateAAIVfModuleRequest", updateAAIVfModuleRequest) + msoLogger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessUpdateAAIVfModuleStatus", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleStatus Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessUpdateAAIVfModuleStatus") + + } + + + public void preProcessUpdateAAIVfModuleRequestGroup(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessUpdateAAIVfModuleRequestGroup(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessUpdateAAIVfModuleRequestGroup") + + try{ + + //Build UpdateAAIVfModule Request + + String updateAAIVfModuleRequest = buildUpdateAAIVfModuleRequest(execution, true, false, false, false) + + updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest) + execution.setVariable("DCVFM_updateAAIVfModuleRequest", updateAAIVfModuleRequest) + msoLogger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessUpdateAAIVfModuleRequestGroup", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestGroup Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestGroup") + + } + + public void validateSDNCResponse(DelegateExecution execution, String response, String method){ + + execution.setVariable("prefix",Prefix) + msoLogger.debug("STARTED ValidateSDNCResponse Process") + + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + msoLogger.debug("workflowException: " + workflowException) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + String sdncResponse = response + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) + RollbackData rollbackData = execution.getVariable("rollbackData") + + if(method.equals("assign")){ + rollbackData.put("VFMODULE", "rollbackSDNCRequestAssign", "true") + execution.setVariable("CRTGVNF_sdncAssignCompleted", true) + } + else if (method.equals("activate")) { + rollbackData.put("VFMODULE", "rollbackSDNCRequestActivate", "true") + } + execution.setVariable("rollbackData", rollbackData) + }else{ + msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + throw new BpmnError("MSOWorkflowException") + } + msoLogger.trace("COMPLETED ValidateSDNCResponse Process") + } + + public void preProcessUpdateAfterCreateRequest(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessRequest Process") + try{ + String response = execution.getVariable("DCVFM_assignSDNCAdapterResponse") + msoLogger.debug("DCVFM_assignSDNCAdapterResponse: " + response) + + String data = utils.getNodeXml(response, "response-data") + String vnfId = utils.getNodeText(data, "vnf-id") + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + + String serviceOperation = "/VNF-API:vnfs/vnf-list/" + vnfId + def callbackUrl = execution.getVariable("DCVFM_sdncCallbackUrl") + msoLogger.debug("callbackUrl: " + callbackUrl) + + String SDNCGetRequest = + """ + + ${MsoUtils.xmlEscape(uuid)} + query + ${MsoUtils.xmlEscape(serviceOperation)} + ${MsoUtils.xmlEscape(callbackUrl)} + mobility + + + """ + + execution.setVariable("DCVFM_getSDNCRequest", SDNCGetRequest) + msoLogger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCGetRequest", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCGetRequest Process") + } + + public String buildUpdateAAIVfModuleRequest(DelegateExecution execution, boolean updateVolumeGroupId, + boolean updateOrchestrationStatus, boolean updateHeatStackId, boolean updateContrailFqdn){ + + def vnfId = execution.getVariable("DCVFM_vnfId") + def vfModuleId = execution.getVariable("DCVFM_vfModuleId") + def volumeGroupIdString = "" + if (updateVolumeGroupId) { + volumeGroupIdString = "" + execution.getVariable("DCVFM_volumeGroupId") + + "" + } + def orchestrationStatusString = "" + if (updateOrchestrationStatus) { + orchestrationStatusString = "" + execution.getVariable("DCVFM_orchestrationStatus") + "" + } + def heatStackIdString = "" + if (updateHeatStackId) { + heatStackIdString = "" + execution.getVariable("DCVFM_heatStackId") + "" + } + def contrailFqdnString = "" + if (updateContrailFqdn) { + contrailFqdnString = "" + execution.getVariable("DCVFM_contrailServiceInstanceFqdn") + + "" + } + + String updateAAIVfModuleRequest = + """ + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + ${heatStackIdString} + ${orchestrationStatusString} + ${volumeGroupIdString} + ${contrailFqdnString} + """ + + msoLogger.trace("updateAAIVfModule Request: " + updateAAIVfModuleRequest) + return updateAAIVfModuleRequest + + } + + public String buildSDNCParamsXml(DelegateExecution execution){ + + String params = "" + StringBuilder sb = new StringBuilder() + Map paramsMap = execution.getVariable("DCVFM_vnfParamsMap") + + for (Map.Entry entry : paramsMap.entrySet()) { + String paramsXml + String key = entry.getKey(); + if(key.endsWith("_network")){ + String requestKey = key.substring(0, key.indexOf("_network")) + String requestValue = entry.getValue() + paramsXml = +""" + { functx:substring-before-match(data($param/@name), '_network') } + { $param/text() } +""" + }else{ + paramsXml = "" + } + params = sb.append(paramsXml) + } + return params + } + + public String buildCompleteSDNCParamsXml(DelegateExecution execution){ + + String params = "" + StringBuilder sb = new StringBuilder() + Map paramsMap = execution.getVariable("DCVFM_vnfParamsMap") + + for (Map.Entry entry : paramsMap.entrySet()) { + String paramsXml + String key = entry.getKey(); + String value = entry.getValue() + paramsXml = """<${key}>$value""" + params = sb.append(paramsXml) + } + return params + } + + public void queryCloudRegion (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED queryCloudRegion") + + try { + String cloudRegion = execution.getVariable("DCVFM_cloudSiteId") + + // Prepare AA&I url + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUtil = new AaiUtil(this) + String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) + String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion + + execution.setVariable("DCVFM_queryCloudRegionRequest", queryCloudRegionRequest) + msoLogger.debug("DCVFM_queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest) + + cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) + + if ((cloudRegion != "ERROR")) { + if(execution.getVariable("DCVFM_queryCloudRegionReturnCode") == "404"){ + execution.setVariable("DCVFM_cloudRegionForVolume", "AAIAIC25") + }else{ + execution.setVariable("DCVFM_cloudRegionForVolume", cloudRegion) + } + execution.setVariable("DCVFM_isCloudRegionGood", true) + } else { + String errorMessage = "AAI Query Cloud Region Unsuccessful. AAI Response Code: " + execution.getVariable("DCVFM_queryCloudRegionReturnCode") + msoLogger.debug(errorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) + execution.setVariable("DCVFM_isCloudRegionGood", false) + } + msoLogger.debug(" is Cloud Region Good: " + execution.getVariable("DCVFM_isCloudRegionGood")) + + } catch(BpmnError b){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + b.getMessage()); + throw b + }catch (Exception ex) { + // try error + String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + ex.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "AAI Query Cloud Region Failed "+errorMessage, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during queryCloudRegion method") + } + } + + /** + * + *This method occurs when an MSOWorkflowException is caught. It logs the + *variables and ensures that the "WorkflowException" Variable is set. + * + */ + public void processBPMNException(DelegateExecution execution){ + + execution.setVariable("prefix",Prefix) + try{ + msoLogger.debug("Caught a BPMN Exception") + msoLogger.debug("Started processBPMNException Method") + msoLogger.debug("Variables List: " + execution.getVariables()) + if(execution.getVariable("WorkflowException") == null){ + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during DoCreateVfModule Sub Process") + } + + }catch(Exception e){ + msoLogger.debug("Caught Exception during processBPMNException Method: " + e) + } + msoLogger.debug("Completed processBPMNException Method") + } + + public void prepareCreateAAIVfModuleVolumeGroupRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepareCreateAAIVfModuleVolumeGroupRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED prepareCreateAAIVfModuleVolumeGroupRequest") + + try{ + + //Build CreateAAIVfModuleVolumeGroup Request + + def vnfId = execution.getVariable("DCVFM_vnfId") + def vfModuleId = execution.getVariable("DCVFM_vfModuleId") + def volumeGroupId = execution.getVariable("DCVFM_volumeGroupId") + //def aicCloudRegion = execution.getVariable("DCVFM_cloudSiteId") + def aicCloudRegion = execution.getVariable("DCVFM_cloudRegionForVolume") + String createAAIVfModuleVolumeGroupRequest = + """ + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(volumeGroupId)} + ${MsoUtils.xmlEscape(aicCloudRegion)} + """ + + createAAIVfModuleVolumeGroupRequest = utils.formatXml(createAAIVfModuleVolumeGroupRequest) + execution.setVariable("DCVFM_createAAIVfModuleVolumeGroupRequest", createAAIVfModuleVolumeGroupRequest) + msoLogger.debug("Outgoing CreateAAIVfModuleVolumeGroupRequest is: \n" + createAAIVfModuleVolumeGroupRequest) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Exception Occured Processing prepareCreateAAIVfModuleVolumeGroupRequest', "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareCreateAAIVfModuleVolumeGroupRequest Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED prepareCreateAAIVfModuleVolumeGroupRequest") + + } + + public void createNetworkPoliciesInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.createNetworkPoliciesInAAI(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED createNetworkPoliciesInAAI") + + try { + // get variables + List fqdnList = execution.getVariable("DCVFM_contrailNetworkPolicyFqdnList") + int fqdnCount = fqdnList.size() + def rollbackData = execution.getVariable("rollbackData") + + execution.setVariable("DCVFM_networkPolicyFqdnCount", fqdnCount) + msoLogger.debug("DCVFM_networkPolicyFqdnCount - " + fqdnCount) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) + + if (fqdnCount > 0) { + + // AII loop call over contrail network policy fqdn list + for (i in 0..fqdnCount-1) { + + int counting = i+1 + String fqdn = fqdnList[i] + + // Query AAI for this network policy FQDN + + String queryNetworkPolicyByFqdnAAIRequest = "${aai_endpoint}${aai_uri}?network-policy-fqdn=" + UriUtils.encode(fqdn, "UTF-8") + + def aaiRequestId = UUID.randomUUID().toString() + RESTConfig config = new RESTConfig(queryNetworkPolicyByFqdnAAIRequest); + RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId) + .addHeader("X-FromAppId", "MSO") + .addHeader("Content-Type", "application/xml") + .addHeader("Accept","application/xml"); + APIResponse response = client.get() + int returnCode = response.getStatusCode() + execution.setVariable("DCVFM_aaiQqueryNetworkPolicyByFqdnReturnCode", returnCode) + msoLogger.debug(" ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (isOneOf(returnCode, 200, 201)) { + msoLogger.debug("The return code is: " + returnCode) + // This network policy FQDN already exists in AAI + execution.setVariable("DCVFM_queryNetworkPolicyByFqdnAAIResponse", aaiResponseAsString) + msoLogger.debug(" QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString) + + } else { + if (returnCode == 404) { + // This network policy FQDN is not in AAI yet. Add it now + msoLogger.debug("The return code is: " + returnCode) + msoLogger.debug("This network policy FQDN is not in AAI yet: " + fqdn) + // Add the network policy with this FQDN to AAI + def networkPolicyId = UUID.randomUUID().toString() + msoLogger.debug("Adding network-policy with network-policy-id " + networkPolicyId) + + String aaiNamespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) + msoLogger.debug('AAI namespace is: ' + aaiNamespace) + String payload = """ + ${MsoUtils.xmlEscape(networkPolicyId)} + ${MsoUtils.xmlEscape(fqdn)} + ${MsoUtils.xmlEscape(execution.getVariable("DCVFM_heatStackId"))} + """ as String + + execution.setVariable("DCVFM_addNetworkPolicyAAIRequestBody", payload) + + String addNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(networkPolicyId, "UTF-8") + msoLogger.debug("AAI request endpoint: " + addNetworkPolicyAAIRequest) + + def aaiRequestIdPut = UUID.randomUUID().toString() + RESTConfig configPut = new RESTConfig(addNetworkPolicyAAIRequest); + RESTClient clientPut = new RESTClient(configPut).addHeader("X-TransactionId", aaiRequestIdPut) + .addHeader("X-FromAppId", "MSO") + .addHeader("Content-Type", "application/xml") + .addHeader("Accept","application/xml"); + msoLogger.debug("invoking PUT call to AAI with payload:"+System.lineSeparator()+payload) + APIResponse responsePut = clientPut.httpPut(payload) + int returnCodePut = responsePut.getStatusCode() + execution.setVariable("DCVFM_aaiAddNetworkPolicyReturnCode", returnCodePut) + msoLogger.debug(" ***** AAI add network policy Response Code, NetworkPolicy #" + counting + " : " + returnCodePut) + + String aaiResponseAsStringPut = responsePut.getResponseBodyAsString() + if (isOneOf(returnCodePut, 200, 201)) { + msoLogger.debug("The return code from adding network policy is: " + returnCodePut) + // This network policy was created in AAI successfully + execution.setVariable("DCVFM_addNetworkPolicyAAIResponse", aaiResponseAsStringPut) + msoLogger.debug(" AddAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsStringPut) + rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "true") + rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn" + i, fqdn) + execution.setVariable("rollbackData", rollbackData) + + } else { + // aai all errors + String putErrorMessage = "Unable to add network-policy to AAI createNetworkPoliciesInAAI - " + returnCodePut + msoLogger.debug(putErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, putErrorMessage) + } + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from createNetworkPoliciesInAAI - " + returnCode + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } // end loop + + + } else { + msoLogger.debug("No contrail network policies to query/create") + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateVfModule flow. createNetworkPoliciesInAAI() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + } + + /** + * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. + * + * @param execution The flow's execution instance. + */ + public void prepUpdateAAIGenericVnf(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def rollbackData = execution.getVariable("rollbackData") + def vnfId = execution.getVariable('DCVFM_vnfId') + def oamManagementV4Address = execution.getVariable("DCVFM_oamManagementV4Address") + def oamManagementV6Address = execution.getVariable("DCVFM_oamManagementV6Address") + def ipv4OamAddressElement = '' + def managementV6AddressElement = '' + + if (oamManagementV4Address != null && !oamManagementV4Address.isEmpty()) { + ipv4OamAddressElement = '' + oamManagementV4Address + '' + } + + if (oamManagementV6Address != null && !oamManagementV6Address.isEmpty()) { + managementV6AddressElement = '' + oamManagementV6Address + '' + } + + rollbackData.put("VFMODULE", "oamManagementV4Address", oamManagementV4Address) + + + String updateAAIGenericVnfRequest = """ + + ${MsoUtils.xmlEscape(vnfId)} + ${ipv4OamAddressElement} + ${managementV6AddressElement} + + """ + updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) + execution.setVariable('DCVM_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) + msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) + + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered in " + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) + } + } + + /** + * Post process a result from invoking the UpdateAAIGenericVnf subflow. + * + * @param execution The flow's execution instance. + */ + public void postProcessUpdateAAIGenericVnf(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.postProcessUpdateAAIGenericVnf(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def rollbackData = execution.getVariable("rollbackData") + + rollbackData.put("VFMODULE", "rollbackUpdateVnfAAI", "true") + + def vnfId = execution.getVariable('DCVFM_vnfId') + def oamManagementV4Address = execution.getVariable("DCVFM_oamManagementV4Address") + def oamManagementV6Address = execution.getVariable("DCVFM_oamManagementV6Address") + def ipv4OamAddressElement = '' + def managementV6AddressElement = '' + + if (oamManagementV4Address != null && !oamManagementV4Address.isEmpty()) { + rollbackData.put("VFMODULE", "oamManagementV4Address", oamManagementV4Address) + } + + if (oamManagementV6Address != null && !oamManagementV6Address.isEmpty()) { + rollbackData.put("VFMODULE", "oamManagementV6Address", oamManagementV6Address) + } + + execution.setVariable("rollbackData", rollbackData) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in postProcessUpdateAAIGenericVnf(): ' + e.getMessage()) + } + } + + public void queryCatalogDB (DelegateExecution execution) { + + String msg = "" + msoLogger.trace("queryCatalogDB ") + + try { + boolean twoPhaseDesign = false + // check for input + + String vfModuleModelName = execution.getVariable("DCVFM_vfModuleModelName") + msoLogger.debug("vfModuleModelName: " + vfModuleModelName) + def vnfModelInfo = execution.getVariable("vnfModelInfo") + def vnfModelCustomizationUuid = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationUuid") + + msoLogger.debug("vnfModelCustomizationUuid: " + vnfModelCustomizationUuid) + + JSONArray vnfs = catalog.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid, "v2") + + msoLogger.debug("Incoming Query Catalog DB for Vnf Response is: " + vnfModelCustomizationUuid) + // Only one match here + if (vnfs != null) { + JSONObject vnfObject = vnfs.get(0) + if (vnfObject != null) { + String vnfJson = vnfObject.toString() + // + ObjectMapper om = new ObjectMapper(); + VnfResource vnf = om.readValue(vnfJson, VnfResource.class); + + // Get multiStageDesign flag + + String multiStageDesignValue = vnf.getMultiStageDesign() + msoLogger.debug("multiStageDesign value from Catalog DB is: " + multiStageDesignValue) + if (multiStageDesignValue != null) { + if (multiStageDesignValue.equalsIgnoreCase("true")) { + twoPhaseDesign = true + } + } + } + } + + msoLogger.debug("setting twoPhaseDesign flag to: " + twoPhaseDesign) + + execution.setVariable("DCVFM_twoPhaseDesign", twoPhaseDesign) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in queryCatalogDB', "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryCatalogDB(): ' + e.getMessage()) + } + } + + + public void preProcessRollback (DelegateExecution execution) { + + msoLogger.trace("preProcessRollback") + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage()) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + msoLogger.debug("BPMN Error during preProcessRollback") + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + msoLogger.debug(msg) + } + msoLogger.trace("Exit preProcessRollback") + } + + public void postProcessRollback (DelegateExecution execution) { + + msoLogger.trace("postProcessRollback") + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + msoLogger.debug("Setting prevException to WorkflowException: ") + execution.setVariable("WorkflowException", workflowException); + } + execution.setVariable("rollbackData", null) + } catch (BpmnError b) { + msoLogger.debug("BPMN Error during postProcessRollback") + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + msoLogger.debug(msg) + } + msoLogger.trace("Exit postProcessRollback") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy new file mode 100644 index 0000000000..a0b7dabb32 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy @@ -0,0 +1,666 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils + + + +public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVfModuleRollback.class); + + def Prefix="DCVFMR_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + } + + // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids + // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest + public void preProcessRequest(DelegateExecution execution) { + + + initProcessVariables(execution) + + try { + + execution.setVariable("rolledBack", null) + execution.setVariable("rollbackError", null) + + def rollbackData = execution.getVariable("rollbackData") + msoLogger.debug("RollbackData:" + rollbackData) + + if (rollbackData != null) { + String vnfId = rollbackData.get("VFMODULE", "vnfid") + execution.setVariable("DCVFMR_vnfId", vnfId) + String vfModuleId = rollbackData.get("VFMODULE", "vfmoduleid") + execution.setVariable("DCVFMR_vfModuleId", vfModuleId) + String source = rollbackData.get("VFMODULE", "source") + execution.setVariable("DCVFMR_source", source) + String serviceInstanceId = rollbackData.get("VFMODULE", "serviceInstanceId") + execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId) + String serviceId = rollbackData.get("VFMODULE", "service-id") + execution.setVariable("DCVFMR_serviceId", serviceId) + String vnfType = rollbackData.get("VFMODULE", "vnftype") + execution.setVariable("DCVFMR_vnfType", vnfType) + String vnfName = rollbackData.get("VFMODULE", "vnfname") + execution.setVariable("DCVFMR_vnfName", vnfName) + String tenantId = rollbackData.get("VFMODULE", "tenantid") + execution.setVariable("DCVFMR_tenantId", tenantId) + String vfModuleName = rollbackData.get("VFMODULE", "vfmodulename") + execution.setVariable("DCVFMR_vfModuleName", vfModuleName) + String vfModuleModelName = rollbackData.get("VFMODULE", "vfmodulemodelname") + execution.setVariable("DCVFMR_vfModuleModelName", vfModuleModelName) + String cloudSiteId = rollbackData.get("VFMODULE", "aiccloudregion") + execution.setVariable("DCVFMR_cloudSiteId", cloudSiteId) + String heatStackId = rollbackData.get("VFMODULE", "heatstackid") + execution.setVariable("DCVFMR_heatStackId", heatStackId) + String requestId = rollbackData.get("VFMODULE", "msorequestid") + execution.setVariable("DCVFMR_requestId", requestId) + // Set mso-request-id to request-id for VNF Adapter interface + execution.setVariable("mso-request-id", requestId) + List createdNetworkPolicyFqdnList = [] + int i = 0 + while (i < 100) { + String fqdn = rollbackData.get("VFMODULE", "contrailNetworkPolicyFqdn" + i) + if (fqdn == null) { + break + } + createdNetworkPolicyFqdnList.add(fqdn) + msoLogger.debug("got fqdn # " + i + ": " + fqdn) + i = i + 1 + + } + + execution.setVariable("DCVFMR_createdNetworkPolicyFqdnList", createdNetworkPolicyFqdnList) + String oamManagementV4Address = rollbackData.get("VFMODULE", "oamManagementV4Address") + execution.setVariable("DCVFMR_oamManagementV4Address", oamManagementV4Address) + String oamManagementV6Address = rollbackData.get("VFMODULE", "oamManagementV6Address") + execution.setVariable("DCVFMR_oamManagementV6Address", oamManagementV6Address) + //String serviceInstanceId = rollbackData.get("VFMODULE", "msoserviceinstanceid") + //execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId) + execution.setVariable("DCVFMR_rollbackPrepareUpdateVfModule", rollbackData.get("VFMODULE", "rollbackPrepareUpdateVfModule")) + execution.setVariable("DCVFMR_rollbackUpdateAAIVfModule", rollbackData.get("VFMODULE", "rollbackUpdateAAIVfModule")) + execution.setVariable("DCVFMR_rollbackVnfAdapterCreate", rollbackData.get("VFMODULE", "rollbackVnfAdapterCreate")) + execution.setVariable("DCVFMR_rollbackSDNCRequestAssign", rollbackData.get("VFMODULE", "rollbackSDNCRequestAssign")) + execution.setVariable("DCVFMR_rollbackSDNCRequestActivate", rollbackData.get("VFMODULE", "rollbackSDNCRequestActivate")) + execution.setVariable("DCVFMR_rollbackCreateAAIVfModule", rollbackData.get("VFMODULE", "rollbackCreateAAIVfModule")) + execution.setVariable("DCVFMR_rollbackCreateNetworkPoliciesAAI", rollbackData.get("VFMODULE", "rollbackCreateNetworkPoliciesAAI")) + execution.setVariable("DCVFMR_rollbackUpdateVnfAAI", rollbackData.get("VFMODULE", "rollbackUpdateVnfAAI")) + + // formulate the request for PrepareUpdateAAIVfModule + String request = """ + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + pending-delete + """ as String + msoLogger.debug("PrepareUpdateAAIVfModuleRequest :" + request) + execution.setVariable("PrepareUpdateAAIVfModuleRequest", request) + } else { + execution.setVariable("skipRollback", true) + } + + if (execution.getVariable("disableRollback").equals("true" )) { + execution.setVariable("skipRollback", true) + } + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + def msg = "Exception in DoCreateVfModuleRollback preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + // build a SDNC vnf-topology-operation request for the specified action + // (note: the action passed is expected to be 'changedelete' or 'delete') + public void prepSDNCAdapterRequest(DelegateExecution execution) { + + String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId") + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("DCVFMR_requestId") + "-" + System.currentTimeMillis() + } + + def callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + + String source = execution.getVariable("DCVFMR_source") + String serviceId = execution.getVariable("DCVFMR_serviceId") + String vnfId = execution.getVariable("DCVFMR_vnfId") + String vnfType = execution.getVariable("DCVFMR_vnfType") + String vnfName = execution.getVariable("DCVFMR_vnfName") + String tenantId = execution.getVariable("DCVFMR_tenantId") + String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + String vfModuleName = execution.getVariable("DCVFMR_vfModuleName") + String vfModuleModelName = execution.getVariable("DCVFMR_vfModuleModelName") + String cloudSiteId = execution.getVariable("DCVFMR_cloudSiteId") + String requestId = execution.getVariable("DCVFMR_requestId") + + String serviceInstanceIdToSdnc = "" + if (srvInstId != null && !srvInstId.isEmpty()) { + serviceInstanceIdToSdnc = srvInstId + } else { + serviceInstanceIdToSdnc = vfModuleId + } + + def doSDNCActivateRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestActivate") + def doSDNCAssignRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestAssign") + + def action = "" + def requestAction = "" + + if (doSDNCActivateRollback.equals("true")) { + action = "delete" + requestAction = "DisconnectVNFRequest" + } + else if (doSDNCAssignRollback.equals("true")) { + action = "rollback" + requestAction = "VNFActivateRequest" + } + else + return + + + String request = """ + + ${MsoUtils.xmlEscape(uuid)} + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(action)} + vnf-topology-operation + ${MsoUtils.xmlEscape(callbackUrl)} + + + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(requestAction)} + ${MsoUtils.xmlEscape(source)} + + + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(serviceInstanceIdToSdnc)} + notsurewecare + + + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(vfModuleModelName)} + ${MsoUtils.xmlEscape(vfModuleName)} + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vnfName)} + ${MsoUtils.xmlEscape(vnfType)} + ${MsoUtils.xmlEscape(cloudSiteId)} + ${MsoUtils.xmlEscape(tenantId)} + + + """ + + msoLogger.debug("sdncAdapterWorkflowRequest: " + request) + execution.setVariable("sdncAdapterWorkflowRequest", request) + } + + public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessSDNCDeactivateRequest") + + def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId") + + try{ + //Build SDNC Request + + String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate") + + deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest) + execution.setVariable("DCVFMR_deactivateSDNCRequest", deactivateSDNCRequest) + msoLogger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCDeactivateRequest") + } + + public void preProcessSDNCUnassignRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessSDNCUnassignRequest Process") + try{ + String serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId") + + String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign") + + execution.setVariable("DCVFMR_unassignSDNCRequest", unassignSDNCRequest) + msoLogger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) + + }catch(Exception e){ + msoLogger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCUnassignRequest Process") + } + + public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("DCVFMR_requestId") + "-" + System.currentTimeMillis() + } + def callbackURL = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + def requestId = execution.getVariable("DCVFMR_requestId") + def serviceId = execution.getVariable("DCVFMR_serviceId") + def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId") + def vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + def source = execution.getVariable("DCVFMR_source") + def vnfId = execution.getVariable("DCVFMR_vnfId") + + def sdncVersion = execution.getVariable("sdncVersion") + + String sdncRequest = + """ + + ${MsoUtils.xmlEscape(uuid)} + ${MsoUtils.xmlEscape(svcInstId)} + ${MsoUtils.xmlEscape(action)} + vf-module-topology-operation + ${MsoUtils.xmlEscape(callbackURL)} + generic-resource + + + + ${MsoUtils.xmlEscape(requestId)} + DeleteVfModuleInstance + ${MsoUtils.xmlEscape(source)} + + + + + + + + ${MsoUtils.xmlEscape(serviceInstanceId)} + + + + ${MsoUtils.xmlEscape(vnfId)} + + + + ${MsoUtils.xmlEscape(vfModuleId)} + + + + """ + + msoLogger.debug("sdncRequest: " + sdncRequest) + return sdncRequest + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing VnfAdapterDeleteV1 request + public void prepVNFAdapterRequest(DelegateExecution execution) { + + String requestId = UUID.randomUUID().toString() + String origRequestId = execution.getVariable("DCVFMR_requestId") + String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId") + String aicCloudRegion = execution.getVariable("DCVFMR_cloudSiteId") + String vnfId = execution.getVariable("DCVFMR_vnfId") + String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + String vfModuleStackId = execution.getVariable("DCVFMR_heatStackId") + String tenantId = execution.getVariable("DCVFMR_tenantId") + def messageId = execution.getVariable('mso-request-id') + '-' + + System.currentTimeMillis() + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) + def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) + if ('true'.equals(useQualifiedHostName)) { + notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) + } + + String request = """ + + ${MsoUtils.xmlEscape(aicCloudRegion)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(vfModuleStackId)} + true + + ${MsoUtils.xmlEscape(origRequestId)} + ${MsoUtils.xmlEscape(srvInstId)} + + ${MsoUtils.xmlEscape(messageId)} + ${MsoUtils.xmlEscape(notificationUrl)} + + """ as String + + msoLogger.debug("vnfAdapterRestV1Request: " + request) + execution.setVariable("vnfAdapterRestV1Request", request) + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing UpdateAAIVfModuleRequest request + public void prepUpdateAAIVfModule(DelegateExecution execution) { + + String vnfId = execution.getVariable("DCVFMR_vnfId") + String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """ + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + DELETE + deleted + """ as String + msoLogger.debug("UpdateAAIVfModuleRequest :" + request) + execution.setVariable("UpdateAAIVfModuleRequest", request) + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing UpdateAAIVfModuleRequest request + public void prepUpdateAAIVfModuleToAssigned(DelegateExecution execution) { + + String vnfId = execution.getVariable("DCVFMR_vnfId") + String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """ + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + + Assigned + """ as String + msoLogger.debug("UpdateAAIVfModuleRequest :" + request) + execution.setVariable("UpdateAAIVfModuleRequest", request) + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing DeleteAAIVfModuleRequest request + public void prepDeleteAAIVfModule(DelegateExecution execution) { + + String vnfId = execution.getVariable("DCVFMR_vnfId") + String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """ + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + """ as String + msoLogger.debug("DeleteAAIVfModuleRequest :" + request) + execution.setVariable("DeleteAAIVfModuleRequest", request) + } + + // generates a WorkflowException if + // - + public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { + + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "AAI error occurred deleting the Generic Vnf"+ execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError); + String processKey = getProcessKey(execution); + exceptionUtil.buildWorkflowException(execution, 5000, "Failure in DoDeleteVfModule") + + } + + public void sdncValidateResponse(DelegateExecution execution, String response){ + + execution.setVariable("prefix",Prefix) + + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msoLogger.debug("Successfully Validated SDNC Response") + }else{ + throw new BpmnError("MSOWorkflowException") + } + } + + public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED deleteNetworkPoliciesFromAAI") + + try { + // get variables + List fqdnList = execution.getVariable(Prefix + "createdNetworkPolicyFqdnList") + if (fqdnList == null) { + msoLogger.debug("No network policies to delete") + return + } + int fqdnCount = fqdnList.size() + + execution.setVariable(Prefix + "networkPolicyFqdnCount", fqdnCount) + msoLogger.debug("networkPolicyFqdnCount - " + fqdnCount) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) + + if (fqdnCount > 0) { + // AII loop call over contrail network policy fqdn list + for (i in 0..fqdnCount-1) { + + int counting = i+1 + String fqdn = fqdnList[i] + + // Query AAI for this network policy FQDN + + String queryNetworkPolicyByFqdnAAIRequest = "${aai_endpoint}${aai_uri}?network-policy-fqdn=" + UriUtils.encode(fqdn, "UTF-8") + msoLogger.debug("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest) + + def aaiRequestId = UUID.randomUUID().toString() + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkPolicyByFqdnAAIRequest) + int returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiQueryNetworkPolicyByFqdnReturnCode", returnCode) + msoLogger.debug("AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (isOneOf(returnCode, 200, 201)) { + msoLogger.debug("The return code is: " + returnCode) + // This network policy FQDN exists in AAI - need to delete it now + execution.setVariable(Prefix + "queryNetworkPolicyByFqdnAAIResponse", aaiResponseAsString) + msoLogger.debug("QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString) + // Retrieve the network policy id for this FQDN + def networkPolicyId = utils.getNodeText(aaiResponseAsString, "network-policy-id") + msoLogger.debug("Deleting network-policy with network-policy-id " + networkPolicyId) + + // Retrieve the resource version for this network policy + def resourceVersion = utils.getNodeText(aaiResponseAsString, "resource-version") + msoLogger.debug("Deleting network-policy with resource-version " + resourceVersion) + + String delNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(networkPolicyId, "UTF-8") + + "?resource-version=" + UriUtils.encode(resourceVersion, "UTF-8") + + msoLogger.debug("AAI request endpoint: " + delNetworkPolicyAAIRequest) + + def aaiRequestIdDel = UUID.randomUUID().toString() + msoLogger.debug("Sending DELETE call to AAI with Endpoint /n" + delNetworkPolicyAAIRequest) + + APIResponse responseDel = aaiUriUtil.executeAAIDeleteCall(execution, delNetworkPolicyAAIRequest) + + int returnCodeDel = responseDel.getStatusCode() + execution.setVariable(Prefix + "aaiDeleteNetworkPolicyReturnCode", returnCodeDel) + msoLogger.debug("AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + returnCodeDel) + + if (isOneOf(returnCodeDel, 200, 201, 204)) { + msoLogger.debug("The return code from deleting network policy is: " + returnCodeDel) + // This network policy was deleted from AAI successfully + msoLogger.debug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ") + + } else { + // aai all errors + String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + returnCodeDel + msoLogger.debug(delErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage) + } + } else if (returnCode == 404) { + // This network policy FQDN is not in AAI. No need to delete. + msoLogger.debug("The return code is: " + returnCode) + msoLogger.debug("This network policy FQDN is not in AAI: " + fqdn) + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + returnCode + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + + + + } // end loop + + + } else { + msoLogger.debug("No contrail network policies to query/create") + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateVfModuleRollback flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + } + + + /** + * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. + * + * @param execution The flow's execution instance. + */ + public void preProcessUpdateAAIGenericVnf(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessUpdateAAIGenericVnf((' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('DCVFMR_vnfId') + def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address') + def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address') + def ipv4OamAddressElement = '' + def managementV6AddressElement = '' + + if (oamManagementV4Address != null) { + ipv4OamAddressElement = '' + 'DELETE' + '' + } + + if (oamManagementV6Address != null) { + managementV6AddressElement = '' + 'DELETE' + '' + } + + + String updateAAIGenericVnfRequest = """ + + ${MsoUtils.xmlEscape(vnfId)} + ${ipv4OamAddressElement} + ${managementV6AddressElement} + + """ + updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) + execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) + msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) + + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessUpdateAAIGenericVnf((): ' + e.getMessage()) + } + } + + public void setSuccessfulRollbackStatus (DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED setSuccessfulRollbackStatus") + + try{ + // Set rolledBack to true, rollbackError to null + execution.setVariable("rolledBack", true) + execution.setVariable("rollbackError", null) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED setSuccessfulRollbackStatus") + } + + public void setFailedRollbackStatus (DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED setFailedRollbackStatus") + + try{ + // Set rolledBack to false, rollbackError to actual value, rollbackData to null + execution.setVariable("rolledBack", false) + execution.setVariable("rollbackError", 'Caught exception in DoCreateVfModuleRollback') + execution.setVariable("rollbackData", null) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing setFailedRollbackStatus.", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED setFailedRollbackStatus") + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy new file mode 100644 index 0000000000..5995b6b099 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy @@ -0,0 +1,242 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts; + +import groovy.xml.XmlUtil + +import groovy.json.* + + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils +import org.onap.so.logger.MsoLogger +import org.onap.so.logger.MessageEnum + + +public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVfModuleVolumeRollback.class); + + String Prefix="DCVFMODVOLRBK_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + + def className = getClass().getSimpleName() + + /** + * This method is executed during the preProcessRequest task of the DoCreateVfModuleVolumeRollback.bpmn process. + * @param execution + */ + public InitializeProcessVariables(DelegateExecution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable(Prefix + "volumeGroupName", null) + execution.setVariable(Prefix + "lcpCloudRegionId", null) + execution.setVariable(Prefix + "rollbackVnfARequest", null) + + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the DoCreateVfModuleVolumeRollback.bpmn process. + * @param execution + */ + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + InitializeProcessVariables(execution) +// rollbackData.put("DCVFMODULEVOL", "aiccloudregion", cloudSiteId) + RollbackData rollbackData = execution.getVariable("rollbackData") + +// String vnfId = rollbackData.get("DCVFMODULEVOL", "vnfid") +// execution.setVariable("DCVFMODVOLRBK_vnfId", vnfId) +// String vfModuleId = rollbackData.get("DCVFMODULEVOL", "vfmoduleid") +// execution.setVariable("DCVFMODVOLRBK_vfModuleId", vfModuleId) +// String source = rollbackData.get("DCVFMODULEVOL", "source") +// execution.setVariable("DCVFMODVOLRBK_source", source) +// String serviceInstanceId = rollbackData.get("DCVFMODULEVOL", "serviceInstanceId") +// execution.setVariable("DCVFMODVOLRBK_serviceInstanceId", serviceInstanceId) +// String serviceId = rollbackData.get("DCVFMODULEVOL", "service-id") +// execution.setVariable("DCVFMODVOLRBK_serviceId", serviceId) +// String vnfType = rollbackData.get("DCVFMODULEVOL", "vnftype") +// execution.setVariable("DCVFMODVOLRBK_vnfType", vnfType) +// String vnfName = rollbackData.get("DCVFMODULEVOL", "vnfname") +// execution.setVariable("DCVFMODVOLRBK_vnfName", vnfName) +// String tenantId = rollbackData.get("DCVFMODULEVOL", "tenantid") +// execution.setVariable("DCVFMODVOLRBK_tenantId", tenantId) +// String vfModuleName = rollbackData.get("DCVFMODULEVOL", "vfmodulename") +// execution.setVariable("DCVFMODVOLRBK_vfModuleName", vfModuleName) +// String vfModuleModelName = rollbackData.get("DCVFMODULEVOL", "vfmodulemodelname") +// execution.setVariable("DCVFMODVOLRBK_vfModuleModelName", vfModuleModelName) +// String cloudSiteId = rollbackData.get("DCVFMODULEVOL", "aiccloudregion") +// execution.setVariable("DCVFMODVOLRBK_cloudSiteId", cloudSiteId) +// String heatStackId = rollbackData.get("DCVFMODULEVOL", "heatstackid") +// execution.setVariable("DCVFMODVOLRBK_heatStackId", heatStackId) +// String requestId = rollbackData.get("DCVFMODULEVOL", "msorequestid") +// execution.setVariable("DCVFMODVOLRBK_requestId", requestId) + + String volumeGroupName = rollbackData.get("DCVFMODULEVOL", "volumeGroupName") + execution.setVariable("DCVFMODVOLRBK_volumeGroupName", volumeGroupName) + + String lcpCloudRegionId = rollbackData.get("DCVFMODULEVOL", "aiccloudregion") + execution.setVariable("DCVFMODVOLRBK_lcpCloudRegionId", lcpCloudRegionId) + + execution.setVariable("DCVFMODVOLRBK_rollbackVnfARequest", rollbackData.get("DCVFMODULEVOL", "rollbackVnfARequest")) + execution.setVariable("DCVFMODVOLRBK_backoutOnFailure", rollbackData.get("DCVFMODULEVOL", "backoutOnFailure")) + execution.setVariable("DCVFMODVOLRBK_isCreateVnfRollbackNeeded", rollbackData.get("DCVFMODULEVOL", "isCreateVnfRollbackNeeded")) + execution.setVariable("DCVFMODVOLRBK_isAAIRollbackNeeded", rollbackData.get("DCVFMODULEVOL", "isAAIRollbackNeeded")) + + } + + /** + * Query AAI volume group by name + * @param execution + * @param isDebugEnabled + */ + public void callRESTQueryAAIVolGrpName(DelegateExecution execution, isDebugEnabled) { + + def volumeGroupName = execution.getVariable('DCVFMODVOLRBK_volumeGroupName') + def cloudRegion = execution.getVariable('DCVFMODVOLRBK_lcpCloudRegionId') + + // This is for stub testing + def testVolumeGroupName = execution.getVariable('test-volume-group-name') + if (testVolumeGroupName != null && testVolumeGroupName.length() > 0) { + volumeGroupName = testVolumeGroupName + } + + AaiUtil aaiUtil = new AaiUtil(this) + String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) + String queryAAIVolumeNameRequest = aaiEndpoint + '/' + cloudRegion + "/volume-groups" + "?volume-group-name=" + UriUtils.encode(volumeGroupName, 'UTF-8') + + msoLogger.debug('Query AAI volume group by name: ' + queryAAIVolumeNameRequest) + + APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIVolumeNameRequest) + + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msoLogger.debug("AAI query volume group by name return code: " + returnCode) + msoLogger.debug("AAI query volume group by name response: " + aaiResponseAsString) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + execution.setVariable(prefix+"queryAAIVolGrpNameResponse", aaiResponseAsString) + execution.setVariable(prefix+'AaiReturnCode', returnCode) + + if (returnCode=='200') { + // @TODO: verify error code + // @TODO: create class of literals representing error codes + execution.setVariable(prefix+'queryAAIVolGrpNameResponse', aaiResponseAsString) + msoLogger.debug("Volume Group Name $volumeGroupName exists in AAI.") + } else { + if (returnCode=='404') { + msoLogger.debug("Volume Group Name $volumeGroupName does not exist in AAI.") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume group $volumeGroupName not found in AAI. Response code: 404") + } else { + WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + throw new BpmnError("MSOWorkflowException") + } + } + } + + + + public void callRESTDeleteAAIVolumeGroup(DelegateExecution execution, isDebugEnabled) { + + callRESTQueryAAIVolGrpName(execution, isDebugEnabled) + + def queryAaiVolumeGroupResponse = execution.getVariable(prefix+'queryAAIVolGrpNameResponse') + + def volumeGroupId = utils.getNodeText(queryAaiVolumeGroupResponse, "volume-group-id") + def resourceVersion = utils.getNodeText(queryAaiVolumeGroupResponse, "resource-version") + + def cloudRegion = execution.getVariable("DCVFMODVOLRBK_lcpCloudRegionId") + + AaiUtil aaiUtil = new AaiUtil(this) + String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) + String deleteAAIVolumeGrpIdRequest = aaiEndpoint + '/' + cloudRegion + "/volume-groups/volume-group" + '/' + volumeGroupId + "?resource-version=" + UriUtils.encode(resourceVersion, "UTF-8") + + msoLogger.debug('Delete AAI volume group : ' + deleteAAIVolumeGrpIdRequest) + + APIResponse response = aaiUtil.executeAAIDeleteCall(execution, deleteAAIVolumeGrpIdRequest) + + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msoLogger.debug("AAI delete volume group return code: " + returnCode) + msoLogger.debug("AAI delete volume group response: " + aaiResponseAsString) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + def volumeGroupNameFound = prefix+'volumeGroupNameFound' + if (returnCode=='200' || returnCode=='204' ) { + msoLogger.debug("Volume group $volumeGroupId deleted.") + } else { + if (returnCode=='404') { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume group $volumeGroupId not found for delete in AAI Response code: 404") + } else { + WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + throw new BpmnError("MSOWorkflowException") + } + } + } + + // ******************************* + // Build Error Section + // ******************************* + + + + public void processJavaException(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + try{ + msoLogger.debug("Caught a Java Exception in " + Prefix) + msoLogger.debug("Started processJavaException Method") + msoLogger.debug("Variables List: " + execution.getVariables()) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + + }catch(Exception e){ + msoLogger.debug("Caught Exception during processJavaException Method: " + e) + execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) + } + msoLogger.debug("Completed processJavaException Method in " + Prefix) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy new file mode 100644 index 0000000000..f734ffb3ff --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy @@ -0,0 +1,616 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.NetworkUtils +import org.onap.so.bpmn.common.scripts.VfModuleBase; +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils + +class DoCreateVfModuleVolumeV2 extends VfModuleBase { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVfModuleVolumeV2.class); + String prefix='DCVFMODVOLV2_' + JsonUtils jsonUtil = new JsonUtils() + + + /** + * Perform initial processing, such as request validation, initialization of variables, etc. + * * @param execution + */ + public void preProcessRequest(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + preProcessRequest(execution, isDebugEnabled) + } + + public void preProcessRequest(DelegateExecution execution, isDebugLogEnabled) { + + execution.setVariable("prefix",prefix) + execution.setVariable(prefix+'SuccessIndicator', false) + execution.setVariable(prefix+'isPONR', false) + + displayInput(execution, isDebugLogEnabled) + setRollbackData(execution, isDebugLogEnabled) + setRollbackEnabled(execution, isDebugLogEnabled) + + + def tenantId = execution.getVariable("tenantId") + if (tenantId == null) { + String cloudConfiguration = execution.getVariable("cloudConfiguration") + tenantId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.tenantId") + execution.setVariable("tenantId", tenantId) + } + + def cloudSiteId = execution.getVariable("lcpCloudRegionId") + if (cloudSiteId == null) { + String cloudConfiguration = execution.getVariable("cloudConfiguration") + cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.lcpCloudRegionId") + execution.setVariable("lcpCloudRegionId", cloudSiteId) + } + + // Extract attributes from modelInfo + String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo") + + //modelCustomizationUuid + def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid") + execution.setVariable("modelCustomizationId", modelCustomizationUuid) + msoLogger.debug("modelCustomizationId: " + modelCustomizationUuid) + + //modelName + def modelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName") + execution.setVariable("modelName", modelName) + msoLogger.debug("modelName: " + modelName) + + // The following is used on the get Generic Service Instance call + execution.setVariable('GENGS_type', 'service-instance') + } + + + /** + * Display input variables + * @param execution + * @param isDebugLogEnabled + */ + public void displayInput(DelegateExecution execution, isDebugLogEnabled) { + def input = ['mso-request-id', 'msoRequestId', 'isDebugLogEnabled', 'disableRollback', 'failIfExists', 'serviceInstanceId', + 'vnfId', 'vnfName', 'tenantId', 'volumeGroupId', 'volumeGroupName', 'lcpCloudRegionId', 'vnfType', 'vfModuleModelInfo', 'asdcServiceModelVersion', + 'test-volume-group-name', 'test-volume-group-id', 'vfModuleInputParams'] + + msoLogger.debug('Begin input: ') + input.each { + msoLogger.debug(it + ': ' + execution.getVariable(it)) + } + msoLogger.debug('End input.') + } + + + /** + * Define and set rollbackdata object + * @param execution + * @param isDebugEnabled + */ + public void setRollbackData(DelegateExecution execution, isDebugEnabled) { + def rollbackData = execution.getVariable("rollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData() + } + def volumeGroupName = execution.getVariable('volumeGroupName') + rollbackData.put("DCVFMODULEVOL", "volumeGroupName", volumeGroupName) + execution.setVariable("rollbackData", rollbackData) + } + + + /** + * validate getServiceInstance response + * @param execution + * @param isDebugEnabled + */ + public void validateGetServiceInstanceCall(DelegateExecution execution, isDebugEnabled) { + def found = execution.getVariable('GENGS_FoundIndicator') + def success = execution.getVariable('GENGS_SuccessIndicator') + def serviceInstanceId = execution.getVariable('serviceInstanceId') + msoLogger.debug("getServiceInstance success: " + success) + msoLogger.debug("getServiceInstance found: " + found) + if(!found || !success) { + String errorMessage = "Service instance id not found in AAI: ${serviceInstanceId}." + msoLogger.debug(errorMessage) + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage) + } + + } + + /** + * Get cloud region + * @param execution + * @param isDebugEnabled + */ + public void callRESTQueryAAICloudRegion (DelegateExecution execution, isDebugEnabled) { + + def cloudRegion = execution.getVariable("lcpCloudRegionId") + msoLogger.debug('Request cloud region is: ' + cloudRegion) + + AaiUtil aaiUtil = new AaiUtil(this) + String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) + String queryCloudRegionRequest = aaiEndpoint + '/' + cloudRegion + + msoLogger.debug(queryCloudRegionRequest) + + cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) + + def aaiCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "AAI", cloudRegion) + if ((aaiCloudRegion != "ERROR")) { + execution.setVariable("lcpCloudRegionId", aaiCloudRegion) + msoLogger.debug("AIC Cloud Region for AAI: " + aaiCloudRegion) + } else { + String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode") + msoLogger.debug(errorMessage) + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage) + } + + def poCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) + if ((poCloudRegion != "ERROR")) { + execution.setVariable("poLcpCloudRegionId", poCloudRegion) + msoLogger.debug("AIC Cloud Region for PO: " + poCloudRegion) + } else { + String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode") + msoLogger.debug(errorMessage) + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage) + } + + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put("DCVFMODULEVOL", "aiccloudregion", cloudRegion) + } + + + /** + * Query AAI volume group by name + * @param execution + * @param isDebugEnabled + */ + public void callRESTQueryAAIVolGrpName(DelegateExecution execution, isDebugEnabled) { + + def volumeGroupName = execution.getVariable('volumeGroupName') + def cloudRegion = execution.getVariable('lcpCloudRegionId') + + // This is for stub testing + def testVolumeGroupName = execution.getVariable('test-volume-group-name') + if (testVolumeGroupName != null && testVolumeGroupName.length() > 0) { + volumeGroupName = testVolumeGroupName + } + + AaiUtil aaiUtil = new AaiUtil(this) + String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) + String queryAAIVolumeNameRequest = aaiEndpoint + '/' + cloudRegion + "/volume-groups" + "?volume-group-name=" + UriUtils.encode(volumeGroupName, 'UTF-8') + + msoLogger.debug('Query AAI volume group by name: ' + queryAAIVolumeNameRequest) + + APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIVolumeNameRequest) + + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msoLogger.debug("AAI query volume group by name return code: " + returnCode) + msoLogger.debug("AAI query volume group by name response: " + aaiResponseAsString) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + execution.setVariable(prefix+"queryAAIVolGrpNameResponse", aaiResponseAsString) + execution.setVariable(prefix+'AaiReturnCode', returnCode) + + if (returnCode=='200') { + execution.setVariable(prefix+'queryAAIVolGrpNameResponse', aaiResponseAsString) + msoLogger.debug("Volume Group Name $volumeGroupName exists in AAI.") + } else { + if (returnCode=='404') { + msoLogger.debug("Volume Group Name $volumeGroupName does not exist in AAI.") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume group $volumeGroupName not found in AAI. Response code: 404") + } else { + WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + throw new BpmnError("MSOWorkflowException") + } + } + } + + + /** + * Create a WorkflowException + * @param execution + * @param isDebugEnabled + */ + public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage, isDebugEnabled) { + msoLogger.debug(errorMessage) + (new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage) + } + + + /** + * Create a WorkflowException + * @param execution + * @param isDebugEnabled + */ + public void handleError(DelegateExecution execution, isDebugEnabled) { + WorkflowException we = execution.getVariable('WorkflowException') + if (we == null) { + (new ExceptionUtil()).buildWorkflowException(execution, 2500, "Enexpected error encountered!") + } + throw new BpmnError("MSOWorkflowException") + } + + + /** + * Create volume group in AAI + * @param execution + * @param isDebugEnabled + */ + public void callRESTCreateAAIVolGrpName(DelegateExecution execution, isDebugEnabled) { + + def vnfId = execution.getVariable('vnfId') + def volumeGroupId = execution.getVariable('volumeGroupId') + def volumeName = execution.getVariable("volumeGroupName") + def modelCustomizationId = execution.getVariable("modelCustomizationId") + def vnfType = execution.getVariable("vnfType") + def tenantId = execution.getVariable("tenantId") + def cloudRegion = execution.getVariable('lcpCloudRegionId') + + msoLogger.debug("volumeGroupId: " + volumeGroupId) + + def testGroupId = execution.getVariable('test-volume-group-id') + if (testGroupId != null && testGroupId.trim() != '') { + msoLogger.debug("test volumeGroupId is present: " + testGroupId) + volumeGroupId = testGroupId + execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0") + } + + msoLogger.debug("volumeGroupId to be used: " + volumeGroupId) + + AaiUtil aaiUtil = new AaiUtil(this) + String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) + String createAAIVolumeGrpNameUrlRequest = aaiEndpoint + '/' + cloudRegion + "/volume-groups/volume-group/" + UriUtils.encode(volumeGroupId, "UTF-8") + + String namespace = aaiUtil.getNamespaceFromUri(aaiUtil.getCloudInfrastructureCloudRegionUri(execution)) + msoLogger.debug("AAI namespace is: " + namespace) + + msoLogger.debug("Request URL for PUT: " + createAAIVolumeGrpNameUrlRequest) + + NetworkUtils networkUtils = new NetworkUtils() + String payload = networkUtils.createCloudRegionVolumeRequest(volumeGroupId, volumeName, vnfType, vnfId, tenantId, cloudRegion, namespace, modelCustomizationId) + String payloadXml = utils.formatXml(payload) + msoLogger.debug("Request payload for PUT: " + payloadXml) + + APIResponse response = aaiUtil.executeAAIPutCall(execution, createAAIVolumeGrpNameUrlRequest, payloadXml) + + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msoLogger.debug("AAI create volume group return code: " + returnCode) + msoLogger.debug("AAI create volume group response: " + aaiResponseAsString) + + execution.setVariable(prefix+"createAAIVolumeGrpNameReturnCode", returnCode) + execution.setVariable(prefix+"createAAIVolumeGrpNameResponse", aaiResponseAsString) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + if (returnCode =='201') { + RollbackData rollbackData = execution.getVariable("rollbackData") + rollbackData.put("DCVFMODULEVOL", "isAAIRollbackNeeded", "true") + } else { + execution.setVariable(prefix+"isErrorMessageException", true) + if (returnCode=='404') { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Unable to create volume group in AAI. Response code: 404") + } else { + WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + msoLogger.debug(" AAI Adapter Query Failed. WorkflowException - " + "\n" + aWorkflowException) + throw new BpmnError("MSOWorkflowException") + } + } + } + + + /** + * Prepare VNF adapter create request XML + * @param execution + */ + public void prepareVnfAdapterCreateRequest(DelegateExecution execution, isDebugEnabled) { + + def aaiGenericVnfResponse = execution.getVariable(prefix+'AAIQueryGenericVfnResponse') + def vnfId = utils.getNodeText(aaiGenericVnfResponse, 'vnf-id') + def vnfName = utils.getNodeText(aaiGenericVnfResponse, 'vnf-name') + def vnfType = utils.getNodeText(aaiGenericVnfResponse, "vnf-type") + + def requestId = execution.getVariable('msoRequestId') + def serviceId = execution.getVariable('serviceInstanceId') + def cloudSiteId = execution.getVariable('poLcpCloudRegionId') + def tenantId = execution.getVariable('tenantId') + def volumeGroupId = execution.getVariable('volumeGroupId') + def volumeGroupnName = execution.getVariable('volumeGroupName') + + def vnfVersion = execution.getVariable("asdcServiceModelVersion") + def vnfModuleType = execution.getVariable("modelName") + + def modelCustomizationId = execution.getVariable("modelCustomizationId") + + // for testing + msoLogger.debug("volumeGroupId: " + volumeGroupId) + def testGroupId = execution.getVariable('test-volume-group-id') + if (testGroupId != null && testGroupId.trim() != '') { + msoLogger.debug("test volumeGroupId is present: " + testGroupId) + volumeGroupId = testGroupId + execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0") + } + msoLogger.debug("volumeGroupId to be used: " + volumeGroupId) + + // volume group parameters + + String volumeGroupParams = '' + StringBuilder sbParams = new StringBuilder() + Map paramsMap = execution.getVariable("vfModuleInputParams") + for (Map.Entry entry : paramsMap.entrySet()) { + String paramsXml + String paramName = entry.getKey(); + String paramValue = entry.getValue() + paramsXml = + """ + ${MsoUtils.xmlEscape(paramName)} + ${MsoUtils.xmlEscape(paramValue)} + + """ + sbParams.append(paramsXml) + } + + volumeGroupParams = sbParams.toString() + msoLogger.debug("volumeGroupParams: "+ volumeGroupParams) + + def backoutOnFailure = execution.getVariable(prefix+"backoutOnFailure") + msoLogger.debug("backoutOnFailure: "+ backoutOnFailure) + + def failIfExists = execution.getVariable("failIfExists") + if(failIfExists == null) { + failIfExists = 'true' + } + + String messageId = UUID.randomUUID() + msoLogger.debug("messageId to be used is generated: " + messageId) + + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) + def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) + if ('true'.equals(useQualifiedHostName)) { + notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) + } + msoLogger.debug("CreateVfModuleVolume - notificationUrl: "+ notificationUrl) + + // build request + String vnfSubCreateWorkflowRequest = + """ + + ${MsoUtils.xmlEscape(cloudSiteId)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vnfName)} + ${MsoUtils.xmlEscape(volumeGroupId)} + ${MsoUtils.xmlEscape(volumeGroupnName)} + ${MsoUtils.xmlEscape(vnfType)} + ${MsoUtils.xmlEscape(vnfVersion)} + ${MsoUtils.xmlEscape(vnfModuleType)} + ${MsoUtils.xmlEscape(modelCustomizationId)} + + + vnf_id + ${MsoUtils.xmlEscape(vnfId)} + + + vnf_name + ${MsoUtils.xmlEscape(vnfName)} + + + vf_module_id + ${MsoUtils.xmlEscape(volumeGroupId)} + + + vf_module_name + ${MsoUtils.xmlEscape(volumeGroupnName)} + + ${volumeGroupParams} + + true + ${MsoUtils.xmlEscape(backoutOnFailure)} + ${MsoUtils.xmlEscape(failIfExists)} + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(serviceId)} + + ${MsoUtils.xmlEscape(messageId)} + ${MsoUtils.xmlEscape(notificationUrl)} + + """ + + String vnfSubCreateWorkflowRequestAsString = utils.formatXml(vnfSubCreateWorkflowRequest) + msoLogger.debug(vnfSubCreateWorkflowRequestAsString) + msoLogger.debug(vnfSubCreateWorkflowRequestAsString) + execution.setVariable(prefix+"createVnfARequest", vnfSubCreateWorkflowRequestAsString) + + // build rollback request for use later if needed + String vnfSubRollbackWorkflowRequest = buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) + + msoLogger.debug("Sub Vnf flow rollback request: vnfSubRollbackWorkflowRequest " + "\n" + vnfSubRollbackWorkflowRequest) + + String vnfSubRollbackWorkflowRequestAsString = utils.formatXml(vnfSubRollbackWorkflowRequest) + execution.setVariable(prefix+"rollbackVnfARequest", vnfSubRollbackWorkflowRequestAsString) + } + + public String buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) { + + def request = """ + + + ${MsoUtils.xmlEscape(volumeGroupId)} + {{VOLUMEGROUPSTACKID}} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(cloudSiteId)} + true + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(serviceId)} + + ${MsoUtils.xmlEscape(messageId)} + + true + ${MsoUtils.xmlEscape(notificationUrl)} + + """ + + return request + } + + public String updateRollbackVolumeGroupRequestXml(String rollabackRequest, String heatStackId) { + String newRequest = rollabackRequest.replace("{{VOLUMEGROUPSTACKID}}", heatStackId) + return newRequest + } + + /** + * Validate VNF adapter response + * @param execution + */ + public void validateVnfResponse(DelegateExecution execution, isDebugEnabled) { + def vnfSuccess = execution.getVariable('VNFREST_SuccessIndicator') + msoLogger.debug("vnfAdapterSuccessIndicator: "+ vnfSuccess) + if(vnfSuccess==true) { + String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse") + String heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId") + String vnfRollbackRequest = execution.getVariable(prefix+"rollbackVnfARequest") + String updatedVnfRollbackRequest = updateRollbackVolumeGroupRequestXml(vnfRollbackRequest, heatStackID) + msoLogger.debug("vnfAdapter rollback request: "+ updatedVnfRollbackRequest) + RollbackData rollbackData = execution.getVariable("rollbackData") + rollbackData.put("DCVFMODULEVOL", "rollbackVnfARequest", updatedVnfRollbackRequest) + rollbackData.put("DCVFMODULEVOL", "isCreateVnfRollbackNeeded", "true") + } + } + + + /** + * Update voulume group in AAI + * @TODO: Can we re-use the create method?? + * @param execution + * @param isDebugEnabled + */ + public void callRESTUpdateCreatedVolGrpName(DelegateExecution execution, isDebugEnabled) { + + String requeryAAIVolGrpNameResponse = execution.getVariable(prefix+"queryAAIVolGrpNameResponse") + String volumeGroupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id") + String modelCustomizationId = execution.getVariable("modelCustomizationId") + String cloudRegion = execution.getVariable("lcpCloudRegionId") + + AaiUtil aaiUtil = new AaiUtil(this) + String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) + String updateAAIVolumeGroupUrlRequest = aaiEndpoint + '/' + cloudRegion + "/volume-groups/volume-group/" + UriUtils.encode(volumeGroupId, 'UTF-8') + + String namespace = aaiUtil.getNamespaceFromUri(aaiUtil.getCloudInfrastructureCloudRegionUri(execution)) + + msoLogger.debug("updateAAIVolumeGroupUrlRequest - " + updateAAIVolumeGroupUrlRequest) + + String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse") + def heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId") + + execution.setVariable(prefix+"heatStackId", heatStackID) + + NetworkUtils networkUtils = new NetworkUtils() + String payload = networkUtils.updateCloudRegionVolumeRequest(requeryAAIVolGrpNameResponse, heatStackID, namespace, modelCustomizationId) + String payloadXml = utils.formatXml(payload) + + msoLogger.debug("Payload to Update Created VolumeGroupName - " + "\n" + payloadXml) + + APIResponse response = aaiUtil.executeAAIPutCall(execution, updateAAIVolumeGroupUrlRequest, payloadXml) + + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msoLogger.debug("AAI create volume group return code: " + returnCode) + msoLogger.debug("AAI create volume group response: " + aaiResponseAsString) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + if (returnCode =='200') { + execution.setVariable(prefix+"updateCreatedAAIVolumeGrpNameResponse", aaiResponseAsString) + execution.setVariable(prefix+"isPONR", true) + } else { + execution.setVariable(prefix+"isErrorMessageException", true) + if (returnCode=='404') { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Unable to update volume group in AAI. Response code: 404") + } else { + WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + msoLogger.debug(" AAI Adapter Query Failed. WorkflowException - " + "\n" + aWorkflowException) + throw new BpmnError("MSOWorkflowException") + } + } + } + + + /** + * Query AAI Generic VNF + * @param execution + * @param isDebugEnabled + */ + public void callRESTQueryAAIGenericVnf(DelegateExecution execution, isDebugEnabled) { + + def vnfId = execution.getVariable('vnfId') + + AaiUtil aaiUtil = new AaiUtil(this) + String aaiEndpoint = aaiUtil.getNetworkGenericVnfEndpoint(execution) + def String queryAAIRequest = aaiEndpoint + "/" + UriUtils.encode(vnfId, "UTF-8") + + msoLogger.debug("AAI query generic vnf request: " + queryAAIRequest) + + APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIRequest) + + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msoLogger.debug("AAI query generic vnf return code: " + returnCode) + msoLogger.debug("AAI query generic vnf response: " + aaiResponseAsString) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + if (returnCode=='200') { + msoLogger.debug('Generic vnf ' + vnfId + ' found in AAI.') + execution.setVariable(prefix+'AAIQueryGenericVfnResponse', aaiResponseAsString) + } else { + if (returnCode=='404') { + def message = 'Generic vnf ' + vnfId + ' was not found in AAI. Return code: 404.' + msoLogger.debug(message) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, message) + } else { + WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + throw new BpmnError("MSOWorkflowException") + } + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy new file mode 100644 index 0000000000..46a502e124 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -0,0 +1,618 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import static org.apache.commons.lang3.StringUtils.* + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +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.springframework.web.util.UriUtils + + +/** + * This class supports the DoCreateVnf building block subflow + * with the creation of a generic vnf for + * infrastructure. + * + */ +class DoCreateVnf extends AbstractServiceTaskProcessor { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVnf.class); + String Prefix="DoCVNF_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + + /** + * This method gets and validates the incoming + * request. + * + * @param - execution + * + */ + public void preProcessRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + msoLogger.debug("STARTED DoCreateVnf PreProcessRequest Process") + + // DISABLE SDNC INTERACTION FOR NOW + execution.setVariable("SDNCInteractionEnabled", false) + + + /*******************/ + try{ + // Get Variables + + def rollbackData = execution.getVariable("rollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData() + } + + String vnfModelInfo = execution.getVariable("vnfModelInfo") + String serviceModelInfo = execution.getVariable("serviceModelInfo") + + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("DoCVNF_requestId", requestId) + execution.setVariable("mso-request-id", requestId) + msoLogger.debug("Incoming Request Id is: " + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + execution.setVariable("DoCVNF_serviceInstanceId", serviceInstanceId) + rollbackData.put("VNF", "serviceInstanceId", serviceInstanceId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + + String vnfType = execution.getVariable("vnfType") + execution.setVariable("DoCVNF_vnfType", vnfType) + msoLogger.debug("Incoming Vnf Type is: " + vnfType) + + String vnfName = execution.getVariable("vnfName") + if (vnfName.equals("") || vnfName.equals("null")) { + vnfName = null + } + execution.setVariable("DoCVNF_vnfName", vnfName) + msoLogger.debug("Incoming Vnf Name is: " + vnfName) + + String serviceId = execution.getVariable("productFamilyId") + execution.setVariable("DoCVNF_serviceId", serviceId) + msoLogger.debug("Incoming Service Id is: " + serviceId) + + String source = "VID" + execution.setVariable("DoCVNF_source", source) + rollbackData.put("VNF", "source", source) + msoLogger.debug("Incoming Source is: " + source) + + String suppressRollback = execution.getVariable("disableRollback") + execution.setVariable("DoCVNF_suppressRollback", suppressRollback) + msoLogger.debug("Incoming Suppress Rollback is: " + suppressRollback) + + String modelInvariantId = jsonUtil.getJsonValue(vnfModelInfo, "modelInvariantUuid") + execution.setVariable("DoCVNF_modelInvariantId", modelInvariantId) + msoLogger.debug("Incoming Invariant Id is: " + modelInvariantId) + + String modelVersionId = jsonUtil.getJsonValue(vnfModelInfo, "modelUuid") + if (modelVersionId == null) { + modelVersionId = "" + } + execution.setVariable("DoCVNF_modelVersionId", modelVersionId) + msoLogger.debug("Incoming Version Id is: " + modelVersionId) + + String modelVersion = jsonUtil.getJsonValue(vnfModelInfo, "modelVersion") + execution.setVariable("DoCVNF_modelVersion", modelVersion) + msoLogger.debug("Incoming Model Version is: " + modelVersion) + + String modelName = jsonUtil.getJsonValue(vnfModelInfo, "modelName") + execution.setVariable("DoCVNF_modelName", modelName) + msoLogger.debug("Incoming Model Name is: " + modelName) + + String modelCustomizationId = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationUuid") + if (modelCustomizationId == null) { + modelCustomizationId = "" + } + execution.setVariable("DoCVNF_modelCustomizationId", modelCustomizationId) + msoLogger.debug("Incoming Model Customization Id is: " + modelCustomizationId) + + String cloudSiteId = execution.getVariable("lcpCloudRegionId") + execution.setVariable("DoCVNF_cloudSiteId", cloudSiteId) + rollbackData.put("VNF", "cloudSiteId", cloudSiteId) + msoLogger.debug("Incoming Cloud Site Id is: " + cloudSiteId) + + String tenantId = execution.getVariable("tenantId") + execution.setVariable("DoCVNF_tenantId", tenantId) + rollbackData.put("VNF", "tenantId", tenantId) + msoLogger.debug("Incoming Tenant Id is: " + tenantId) + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + if (globalSubscriberId == null) { + globalSubscriberId = "" + } + execution.setVariable("DoCVNF_globalSubscriberId", globalSubscriberId) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + + String sdncVersion = execution.getVariable("sdncVersion") + if (sdncVersion == null) { + sdncVersion = "1702" + } + execution.setVariable("DoCVNF_sdncVersion", sdncVersion) + msoLogger.debug("Incoming Sdnc Version is: " + sdncVersion) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + CREATE + ${MsoUtils.xmlEscape(source)} + """ + + execution.setVariable("DoCVNF_requestInfo", requestInfo) + //TODO: Orch Status - TBD, will come from SDN-C Response in 1702 + String orchStatus = "Created" + execution.setVariable("DoCVNF_orchStatus", orchStatus) + + //TODO: Equipment Role - Should come from SDN-C Response in 1702 + String equipmentRole = " " + execution.setVariable("DoCVNF_equipmentRole", equipmentRole) + String vnfId = execution.getVariable("testVnfId") // for junits + if(isBlank(vnfId)){ + vnfId = execution.getVariable("vnfId") + if (isBlank(vnfId)) { + vnfId = UUID.randomUUID().toString() + msoLogger.debug("Generated Vnf Id is: " + vnfId) + } + } + execution.setVariable("DoCVNF_vnfId", vnfId) + + // Setting for Sub Flow Calls + execution.setVariable("DoCVNF_type", "generic-vnf") + execution.setVariable("GENGS_type", "service-instance") + + String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { + def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + execution.setVariable("DoCVNF_sdncCallbackUrl", sdncCallbackUrl) + rollbackData.put("VNF", "sdncCallbackUrl", sdncCallbackUrl) + msoLogger.debug("SDNC Callback URL is: " + sdncCallbackUrl) + + VnfResource vnfResource = (VnfResource) execution.getVariable((String)"vnfResourceDecomposition") + String nfRole = vnfResource.getNfRole() + + execution.setVariable("DoCVNF_nfRole", nfRole) + msoLogger.debug("NF Role is: " + nfRole) + + String nfNamingCode = vnfResource.getNfNamingCode() + execution.setVariable("DoCVNF_nfNamingCode", nfNamingCode) + msoLogger.debug("NF Naming Code is: " + nfNamingCode) + + String nfType = vnfResource.getNfType() + execution.setVariable("DoCVNF_nfType", nfType) + msoLogger.debug("NF Type is: " + nfType) + + String nfFunction = vnfResource.getNfFunction() + execution.setVariable("DoCVNF_nfFunction", nfFunction) + msoLogger.debug("NF Function is: " + nfFunction) + + rollbackData.put("VNF", "rollbackSDNCAssign", "false") + rollbackData.put("VNF", "rollbackSDNCActivate", "false") + rollbackData.put("VNF", "rollbackVnfCreate", "false") + + execution.setVariable("rollbackData", rollbackData) + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug(" Error Occured in DoCreateVnf PreProcessRequest method!" + e.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest") + + } + msoLogger.trace("COMPLETED DoCreateVnf PreProcessRequest Process") + } + + private Object getVariableEnforced(DelegateExecution execution, String name){ + Object enforced = execution.getVariable(name) + if(!enforced){ + return ""; + } + return enforced; + } + + public void createGenericVnf (DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED DoCreateVnf CreateGenericVnf Process") + try { + //Get Vnf Info + String vnfId = getVariableEnforced(execution, "DoCVNF_vnfId") + String vnfName = getVariableEnforced(execution, "DoCVNF_vnfName") + if (vnfName == null) { + vnfName = "sdncGenerated" + msoLogger.debug("Sending a dummy VNF name to AAI - the name will be generated by SDNC: " + vnfName) + } + String vnfType = getVariableEnforced(execution, "DoCVNF_vnfType") + String serviceId = getVariableEnforced(execution, "DoCVNF_serviceId") + String orchStatus = getVariableEnforced(execution, "DoCVNF_orchStatus") + String modelInvariantId = getVariableEnforced(execution, "DoCVNF_modelInvariantId") + String modelVersionId = getVariableEnforced(execution, "DoCVNF_modelVersionId") + String modelCustomizationId = getVariableEnforced(execution, "DoCVNF_modelCustomizationId") + String equipmentRole = getVariableEnforced(execution, "DoCVNF_equipmentRole") + String nfType = getVariableEnforced(execution, "DoCVNF_nfType") + String nfRole = getVariableEnforced(execution, "DoCVNF_nfRole") + String nfFunction = getVariableEnforced(execution, "DoCVNF_nfFunction") + String nfNamingCode = getVariableEnforced(execution, "DoCVNF_nfNamingCode") + + //Get Service Instance Info + String serviceInstanceId = getVariableEnforced(execution, "DoCVNF_serviceInstanceId") + String siRelatedLink = getVariableEnforced(execution, "GENGS_siResourceLink") + + int custStart = siRelatedLink.indexOf("customer/") + int custEnd = siRelatedLink.indexOf("/service-subscriptions") + String globalCustId = siRelatedLink.substring(custStart + 9, custEnd) + int serviceStart = siRelatedLink.indexOf("service-subscription/") + int serviceEnd = siRelatedLink.indexOf("/service-instances/") + String serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd) + + Map payload = new LinkedHashMap<>(); + payload.put("vnf-id", vnfId); + payload.put("vnf-name", vnfName); + payload.put("service-id", serviceId); + payload.put("vnf-type", vnfType); + payload.put("prov-status", "PREPROV"); + payload.put("orchestration-status", orchStatus); + payload.put("model-invariant-id", modelInvariantId); + payload.put("model-version-id", modelVersionId); + payload.put("model-customization-id", modelCustomizationId); + payload.put("nf-type", nfType); + payload.put("nf-role", nfRole); + payload.put("nf-function", nfFunction); + payload.put("nf-naming-code", nfNamingCode); + + AAIResourcesClient resourceClient = new AAIResourcesClient(); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + resourceClient.create(uri, payload) + + AAIResourceUri siUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId) + resourceClient.connect(uri, siUri) + + }catch(Exception ex) { + msoLogger.debug("Error Occured in DoCreateVnf CreateGenericVnf Process " + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf CreateGenericVnf Process") + } + msoLogger.trace("COMPLETED DoCreateVnf CreateGenericVnf Process") + } + + public void postProcessCreateGenericVnf (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + msoLogger.trace("STARTED DoCreateVnf PostProcessCreateGenericVnf Process") + try { + //Get Vnf Info + String vnfId = execution.getVariable("DoCVNF_vnfId") + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put("VNF", "vnfId", vnfId) + rollbackData.put("VNF", "rollbackVnfCreate", "true") + execution.setVariable("rollbackData", rollbackData) + }catch(Exception ex) { + msoLogger.debug("Error Occured in DoCreateVnf PostProcessCreateGenericVnf Process " + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PostProcessCreateGenericVnf Process") + } + msoLogger.trace("COMPLETED DoCreateVnf PostProcessCreateGenericVnf Process") + } + + + public void preProcessSDNCAssignRequest(DelegateExecution execution){ + def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessSDNCAssignRequest") + def vnfId = execution.getVariable("DoCVNF_vnfId") + def serviceInstanceId = execution.getVariable("DoCVNF_serviceInstanceId") + msoLogger.debug("NEW VNF ID: " + vnfId) + + try{ + //Build SDNC Request + + String assignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "assign") + + assignSDNCRequest = utils.formatXml(assignSDNCRequest) + execution.setVariable("DoCVNF_assignSDNCRequest", assignSDNCRequest) + msoLogger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCAssignRequest" , "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCAssignRequest Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCAssignRequest") + } + + public void preProcessSDNCActivateRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessSDNCActivateRequest Process") + try{ + String vnfId = execution.getVariable("DoCVNF_vnfId") + String serviceInstanceId = execution.getVariable("DoCVNF_serviceInstanceId") + + String activateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "activate") + + execution.setVariable("DoCVNF_activateSDNCRequest", activateSDNCRequest) + msoLogger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest) + + }catch(Exception e){ + msoLogger.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCActivateRequest Process") + } + + public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("DoCVNF_requestId") + "-" + System.currentTimeMillis() + } + def callbackURL = execution.getVariable("DoCVNF_sdncCallbackUrl") + def requestId = execution.getVariable("DoCVNF_requestId") + def serviceId = execution.getVariable("DoCVNF_serviceId") + def vnfType = execution.getVariable("DoCVNF_vnfType") + def vnfName = execution.getVariable("DoCVNF_vnfName") + // Only send vnfName to SDNC if it is not null, otherwise it will get generated by SDNC on Assign + String vnfNameString = "" + if (vnfName != null) { + vnfNameString = """${MsoUtils.xmlEscape(vnfName)}""" + } + def tenantId = execution.getVariable("DoCVNF_tenantId") + def source = execution.getVariable("DoCVNF_source") + def vnfId = execution.getVariable("DoCVNF_vnfId") + def cloudSiteId = execution.getVariable("DoCVNF_cloudSiteId") + def modelCustomizationId = execution.getVariable("DoCVNF_modelCustomizationId") + def serviceModelInfo = execution.getVariable("serviceModelInfo") + def vnfModelInfo = execution.getVariable("vnfModelInfo") + String serviceEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(serviceModelInfo) + String vnfEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(vnfModelInfo) + def globalSubscriberId = execution.getVariable("DoCVNF_globalSubscriberId") + def sdncVersion = execution.getVariable("DoCVNF_sdncVersion") + + String sdncVNFParamsXml = "" + + if(execution.getVariable("DoCVNF_vnfParamsExistFlag") == true){ + sdncVNFParamsXml = buildSDNCParamsXml(execution) + }else{ + sdncVNFParamsXml = "" + } + + String sdncRequest = + """ + + ${MsoUtils.xmlEscape(uuid)} + ${MsoUtils.xmlEscape(svcInstId)} + ${MsoUtils.xmlEscape(action)} + vnf-topology-operation + ${MsoUtils.xmlEscape(callbackURL)} + generic-resource + + + + ${MsoUtils.xmlEscape(requestId)} + CreateVnfInstance + ${MsoUtils.xmlEscape(source)} + + + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(serviceId)} + ${serviceEcompModelInformation} + ${MsoUtils.xmlEscape(svcInstId)} + ${MsoUtils.xmlEscape(globalSubscriberId)} + + + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vnfType)} + ${vnfEcompModelInformation} + + + ${vnfNameString} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(cloudSiteId)} + ${sdncVNFParamsXml} + + + """ + + msoLogger.debug("sdncRequest: " + sdncRequest) + return sdncRequest + } + + public void validateSDNCResponse(DelegateExecution execution, String response, String method){ + def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + msoLogger.debug("STARTED ValidateSDNCResponse Process") + + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + msoLogger.debug("workflowException: " + workflowException) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + msoLogger.debug("SDNCResponse: " + response) + + String sdncResponse = response + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) + if(method.equals("get")){ + String topologyGetResponse = execution.getVariable("DoCVNF_getSDNCAdapterResponse") + String data = utils.getNodeXml(topologyGetResponse, "response-data") + msoLogger.debug("topologyGetResponseData: " + data) + String vnfName = utils.getNodeText(data, "vnf-name") + msoLogger.debug("vnfName received from SDNC: " + vnfName) + execution.setVariable("vnfName", vnfName) + execution.setVariable("DoCVNF_vnfName", vnfName) + } + def rollbackData = execution.getVariable("rollbackData") + if (method.equals("assign")) { + rollbackData.put("VNF", "rollbackSDNCAssign", "true") + } + else if (method.equals("activate")) { + rollbackData.put("VNF", "rollbackSDNCActivate", "true") + } + execution.setVariable("rollbackData", rollbackData) + + + }else{ + msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + throw new BpmnError("MSOWorkflowException") + } + msoLogger.debug("COMPLETED ValidateSDNCResponse Process") + } + + public void preProcessSDNCGetRequest(DelegateExecution execution){ + def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessSDNCGetRequest Process") + try{ + def serviceInstanceId = execution.getVariable('DoCVNF_serviceInstanceId') + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + + def callbackUrl = execution.getVariable("DoCVFM_sdncCallbackUrl") + msoLogger.debug("callbackUrl:" + callbackUrl) + + def vnfId = execution.getVariable('DCVFM_vnfId') + + def svcInstId = "" + if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { + svcInstId = vnfId + } + else { + svcInstId = serviceInstanceId + } + // serviceOperation will be retrieved from "object-path" element + // in SDNC Assign Response for VNF + String response = execution.getVariable("DoCVNF_assignSDNCAdapterResponse") + msoLogger.debug("DoCVNF_assignSDNCAdapterResponse is: \n" + response) + + String serviceOperation = "" + + String data = utils.getNodeXml(response, "response-data") + msoLogger.debug("responseData: " + data) + serviceOperation = utils.getNodeText(data, "object-path") + msoLogger.debug("VNF with sdncVersion of 1707 or later - service operation: " + serviceOperation) + + + //!!!! TEMPORARY WORKAROUND FOR SDNC REPLICATION ISSUE + sleep(5000) + + String SDNCGetRequest = + """ + + ${MsoUtils.xmlEscape(uuid)} + ${MsoUtils.xmlEscape(svcInstId)} + query + ${MsoUtils.xmlEscape(serviceOperation)} + ${MsoUtils.xmlEscape(callbackUrl)} + vfmodule + + + """ + + + execution.setVariable("DoCVNF_getSDNCRequest", SDNCGetRequest) + msoLogger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest. ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCGetRequest Process") + } + + /** + * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. + * + * @param execution The flow's execution instance. + */ + public void prepUpdateAAIGenericVnf(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('DoCVNF_vnfId') + msoLogger.debug("VNF ID: " + vnfId) + + String updateAAIGenericVnfRequest = """ + + ${MsoUtils.xmlEscape(vnfId)} + Active + + """ + updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) + execution.setVariable('DoCVNF_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) + msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) + + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) + } + } + + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy new file mode 100644 index 0000000000..d3dbd9107e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy @@ -0,0 +1,467 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import java.util.UUID; + +import java.util.List + +import org.json.JSONObject; +import org.json.JSONArray; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.CatalogDbUtils +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ModuleResource +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.DecomposeJsonUtil +import org.onap.so.bpmn.core.json.JsonUtils +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources; +import org.onap.so.logger.MsoLogger +import org.onap.so.logger.MessageEnum + +import static org.apache.commons.lang3.StringUtils.*; + + + +/** +* This class supports the macro VID Flow +* with the creation of a generic vnf and related VF modules. +*/ +class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVnfAndModules.class); + String Prefix="DCVAM_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + CatalogDbUtils cutils = new CatalogDbUtils() + + /** + * This method gets and validates the incoming + * request. + * + * @param - execution + */ + public void preProcessRequest(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED DoCreateVnfAndModules PreProcessRequest Process") + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + + setBasicDBAuthHeader(execution, isDebugLogEnabled) + try{ + // Get Variables + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + String vnfModelInfo = execution.getVariable("vnfModelInfo") + + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("requestId", requestId) + execution.setVariable("mso-request-id", requestId) + msoLogger.debug("Incoming Request Id is: " + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + + String vnfName = execution.getVariable("vnfName") + execution.setVariable("CREVI_vnfName", vnfName) + msoLogger.debug("Incoming Vnf Name is: " + vnfName) + + String productFamilyId = execution.getVariable("productFamilyId") + msoLogger.debug("Incoming Product Family Id is: " + productFamilyId) + + String source = "VID" + execution.setVariable("source", source) + msoLogger.debug("Incoming Source is: " + source) + + String lcpCloudRegionId = execution.getVariable("lcpCloudRegionId") + msoLogger.debug("Incoming LCP Cloud Region Id is: " + lcpCloudRegionId) + + String tenantId = execution.getVariable("tenantId") + msoLogger.debug("Incoming Tenant Id is: " + tenantId) + + String disableRollback = execution.getVariable("disableRollback") + msoLogger.debug("Incoming Disable Rollback is: " + disableRollback) + + String asdcServiceModelVersion = execution.getVariable("asdcServiceModelVersion") + msoLogger.debug("Incoming asdcServiceModelVersion: " + asdcServiceModelVersion) + + String vnfId = execution.getVariable("testVnfId") // for junits + if(isBlank(vnfId)){ + vnfId = execution.getVariable("vnfId") + if (isBlank(vnfId)) { + vnfId = UUID.randomUUID().toString() + msoLogger.debug("Generated Vnf Id is: " + vnfId) + } + } + execution.setVariable("vnfId", vnfId) + + // Set aLaCarte to false + execution.setVariable("aLaCarte", false) + + def rollbackData = execution.getVariable("rollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData() + } + + def isTest = execution.getVariable("isTest") + + if (isTest == null || isTest == false) { + execution.setVariable("isBaseVfModule", "true") + } + execution.setVariable("numOfCreatedAddOnModules", 0) + + rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0") + execution.setVariable("rollbackData", rollbackData) + + sleep (20000) + + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug(" Error Occured in DoCreateVnfAndModules PreProcessRequest method!" + e.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest") + + } + msoLogger.trace("COMPLETED DoCreateVnfAndModules PreProcessRequest Process") + } + + + public void queryCatalogDB (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("STARTED DoCreateVnfAndModules QueryCatalogDB Process") + try { + VnfResource vnf = null + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + // if serviceDecomposition is specified, get info from serviceDecomposition + if (serviceDecomposition != null) { + msoLogger.debug("Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString()) + List vnfs = serviceDecomposition.getVnfResources() + msoLogger.debug("Read vnfs") + if (vnfs == null) { + msoLogger.debug("Error - vnfs are empty in serviceDecomposition object") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf queryCatalogDB, vnfs are empty") + } + vnf = vnfs[0] + String serviceModelName = serviceDecomposition.getModelInfo().getModelName() + vnf.constructVnfType(serviceModelName) + String vnfType = vnf.getVnfType() + msoLogger.debug("Incoming Vnf Type is: " + vnfType) + execution.setVariable("vnfType", vnfType) + } + else { + //Get Vnf Info + String vnfModelInfo = execution.getVariable("vnfModelInfo") + msoLogger.debug("vnfModelInfo: " + vnfModelInfo) + String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationUuid") + if (vnfModelCustomizationUuid == null) { + vnfModelCustomizationUuid = "" + } + msoLogger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid) + + JSONArray vnfs = cutils.getAllVnfsByVnfModelCustomizationUuid(execution, + vnfModelCustomizationUuid) + msoLogger.debug("obtained VNF list") + // Only one match here + JSONObject vnfObject = vnfs[0] + vnf = DecomposeJsonUtil.jsonToVnfResource(vnfObject.toString()) + } + msoLogger.debug("Read vnfResource") + if (vnf == null) { + msoLogger.debug("Error - vnf is empty in serviceDecomposition object") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf queryCatalogDB, vnf is null") + } + execution.setVariable("vnfResourceDecomposition", vnf) + + List vfModules = vnf.getAllVfModuleObjects() + msoLogger.debug("Read vfModules") + if (vfModules == null) { + msoLogger.debug("Error - vfModules are empty in serviceDecomposition object") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf queryCatalogDB, vf modules are empty") + } + + ModuleResource baseVfModule = null + + for (int i = 0; i < vfModules.size; i++) { + msoLogger.debug("handling VF Module ") + ModuleResource vfModule = vfModules[i] + boolean isBase = vfModule.getIsBase() + if (isBase) { + ModelInfo baseVfModuleModelInfoObject = vfModule.getModelInfo() + String baseVfModuleModelInfoWithRoot = baseVfModuleModelInfoObject.toString() + String baseVfModuleModelInfo = jsonUtil.getJsonValue(baseVfModuleModelInfoWithRoot, "modelInfo") + execution.setVariable("baseVfModuleModelInfo", baseVfModuleModelInfo) + String baseVfModuleLabel = vfModule.getVfModuleLabel() + execution.setVariable("baseVfModuleLabel", baseVfModuleLabel) + String basePersonaModelId = baseVfModuleModelInfoObject.getModelInvariantUuid() + execution.setVariable("basePersonaModelId", basePersonaModelId) + baseVfModule = vfModule + break + } + + } + + ListaddOnModules = vfModules - baseVfModule + + int addOnModulesToDeploy = 0 + if (addOnModules != null) { + addOnModulesToDeploy = addOnModules.size + } + + + execution.setVariable("addOnModules", addOnModules) + execution.setVariable("addOnModulesToDeploy", addOnModulesToDeploy) + execution.setVariable("addOnModulesDeployed", 0) + + }catch(Exception ex) { + msoLogger.debug("Error Occured in DoCreateVnfAndModules QueryCatalogDB Process " + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnfAndModules QueryCatalogDB Process") + } + + // Generate vfModuleId for base VF Module + def baseVfModuleId = UUID.randomUUID().toString() + execution.setVariable("baseVfModuleId", baseVfModuleId) + // For JUnits + String requestId = execution.getVariable("requestId") + if (requestId.equals("testRequestId123")) { + execution.setVariable("vnfId", "skask") + } + + msoLogger.trace("COMPLETED DoCreateVnfAndModules QueryCatalogDB Process") + } + + public void preProcessAddOnModule(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.debug("STARTED preProcessAddOnModule") + + try { + ListaddOnModules = execution.getVariable("addOnModules") + int addOnIndex = (int) execution.getVariable("addOnModulesDeployed") + + ModuleResource addOnModule = addOnModules[addOnIndex] + + msoLogger.debug("Got addon module") + + def newVfModuleId = UUID.randomUUID().toString() + execution.setVariable("addOnVfModuleId", newVfModuleId) + execution.setVariable("isBaseVfModule", "false") + + execution.setVariable("instancesOfThisModuleDeployed", 0) + + ModelInfo addOnVfModuleModelInfoObject = addOnModule.getModelInfo() + String addOnVfModuleModelInfoWithRoot = addOnVfModuleModelInfoObject.toString() + String addOnVfModuleModelInfo = jsonUtil.getJsonValue(addOnVfModuleModelInfoWithRoot, "modelInfo") + execution.setVariable("addOnVfModuleModelInfo", addOnVfModuleModelInfo) + String addOnVfModuleLabel = addOnModule.getVfModuleLabel() + execution.setVariable("addOnVfModuleLabel", addOnVfModuleLabel) + String addOnPersonaModelId = addOnVfModuleModelInfoObject.getModelInvariantUuid() + execution.setVariable("addOnPersonaModelId", addOnPersonaModelId) + int addOnInitialCount = addOnModule.getInitialCount() + execution.setVariable("initialCount", addOnInitialCount) + + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessAddOnModule") + } + + public void postProcessAddOnModule(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED postProcessAddOnModule") + + try { + int addOnModulesDeployed = execution.getVariable("addOnModulesDeployed") + execution.setVariable("addOnModulesDeployed", addOnModulesDeployed + 1) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing postProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessAddOnModule Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED postProcessAddOnModule") + } + + public void validateBaseModule(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED validateBaseModule") + + try { + def baseRollbackData = execution.getVariable("DCVAM_baseRollbackData") + def rollbackData = execution.getVariable("rollbackData") + + def baseModuleMap = baseRollbackData.get("VFMODULE") + baseModuleMap.each{ k, v -> rollbackData.put("VFMODULE_BASE", "${k}","${v}") } + execution.setVariable("rollbackData", rollbackData) + msoLogger.debug("addOnModulesDeployed: " + execution.getVariable("addOnModulesDeployed")) + msoLogger.debug("addOnModulesToDeploy: " + execution.getVariable("addOnModulesToDeploy")) + if (execution.getVariable("addOnModulesDeployed") < execution.getVariable("addOnModulesToDeploy")) { + msoLogger.debug("More add on modules to deploy") + } + else { + msoLogger.debug("No more add on modules to deploy") + } + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing validateBaseModule ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during validateBaseModule Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED validateBaseModule") + } + + public void validateAddOnModule(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED validateAddOnModule") + + try { + int instancesOfThisModuleDeployed = execution.getVariable("instancesOfThisModuleDeployed") + int numOfCreatedAddOnModules = execution.getVariable("numOfCreatedAddOnModules") + def addOnRollbackData = execution.getVariable("DCVAM_addOnRollbackData") + def rollbackData = execution.getVariable("rollbackData") + + def addOnModuleMap = addOnRollbackData.get("VFMODULE") + numOfCreatedAddOnModules = numOfCreatedAddOnModules + 1 + addOnModuleMap.each{ k, v -> rollbackData.put("VFMODULE_ADDON_" + numOfCreatedAddOnModules, "${k}","${v}") } + + execution.setVariable("DCVAM_addOnRollbackData", null) + + execution.setVariable("instancesOfThisModuleDeployed", instancesOfThisModuleDeployed + 1) + + execution.setVariable("numOfCreatedAddOnModules", numOfCreatedAddOnModules) + rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "${numOfCreatedAddOnModules}") + execution.setVariable("rollbackData", rollbackData) + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED validateAddOnModule") + } + + public void preProcessRollback (DelegateExecution execution) { + + msoLogger.trace("preProcessRollback") + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage()) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + msoLogger.debug("BPMN Error during preProcessRollback") + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + msoLogger.debug(msg) + } + msoLogger.trace("Exit preProcessRollback") + } + + public void postProcessRollback (DelegateExecution execution) { + + msoLogger.trace("postProcessRollback") + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + msoLogger.debug("Setting prevException to WorkflowException: ") + execution.setVariable("WorkflowException", workflowException); + } + execution.setVariable("rollbackData", null) + } catch (BpmnError b) { + msoLogger.debug("BPMN Error during postProcessRollback") + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + msoLogger.debug(msg) + } + msoLogger.trace("Exit postProcessRollback") + } + + public void createPlatform (DelegateExecution execution) { + + msoLogger.trace("START createPlatform") + + String platformName = execution.getVariable("platformName") + String vnfId = execution.getVariable("vnfId") + + msoLogger.debug("Platform NAME: " + platformName) + msoLogger.debug("VnfID: " + vnfId) + + if(isBlank(platformName)){ + msoLogger.debug("platformName was not found. Continuing on with flow...") + }else{ + msoLogger.debug("platformName was found.") + try{ + AAICreateResources aaiCR = new AAICreateResources() + aaiCR.createAAIPlatform(platformName, vnfId) + }catch(Exception ex){ + String msg = "Exception in createPlatform. " + ex.getMessage(); + msoLogger.debug(msg) + } + } + msoLogger.trace("Exit createPlatform") + } + + public void createLineOfBusiness (DelegateExecution execution) { + + msoLogger.trace("START createLineOfBusiness") + + String lineOfBusiness = execution.getVariable("lineOfBusiness") + String vnfId = execution.getVariable("vnfId") + + msoLogger.debug("LineOfBusiness NAME: " + lineOfBusiness) + msoLogger.debug("VnfID: " + vnfId) + + if(isBlank(lineOfBusiness)){ + msoLogger.debug("LineOfBusiness was not found. Continuing on with flow...") + }else{ + msoLogger.debug("LineOfBusiness was found.") + try{ + AAICreateResources aaiCR = new AAICreateResources() + aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId) + }catch(Exception ex){ + String msg = "Exception in LineOfBusiness. " + ex.getMessage(); + msoLogger.debug(msg) + } + } + msoLogger.trace("Exit createLineOfBusiness") + } + + +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy new file mode 100644 index 0000000000..eafc39b1dd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy @@ -0,0 +1,360 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +/** + * This class supports the macro VID Flow + * with the rollback of a creation of a generic vnf and related VF modules. + */ +class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVnfAndModulesRollback.class); + String Prefix="DCVAMR_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + + /** + * This method gets and validates the incoming + * request. + * + * @param - execution + * + */ + public void preProcessRequest(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + msoLogger.debug("STARTED DoCreateVnfAndModulesRollback PreProcessRequest Process") + + try{ + // Get Rollback Variables + + def rollbackData = execution.getVariable("rollbackData") + msoLogger.debug("Incoming RollbackData is: " + rollbackData.toString()) + execution.setVariable("rolledBack", null) + execution.setVariable("rollbackError", null) + + if (execution.getVariable("disableRollback").equals("true" )) + { + execution.setVariable("skipRollback", true) + } + + String vnfId = rollbackData.get("VNF", "vnfId") + msoLogger.debug("Rollback vnfId is: " + vnfId) + execution.setVariable("DCVAMR_vnfId", vnfId) + + execution.setVariable("mso-request-id", execution.getVariable("msoRequestId")) + + execution.setVariable("DCVAMR_rollbackSDNCAssign", rollbackData.get("VNF", "rollbackSDNCAssign")) + execution.setVariable("DCVAMR_rollbackSDNCActivate", rollbackData.get("VNF", "rollbackSDNCActivate")) + execution.setVariable("DCVAMR_rollbackVnfCreate", rollbackData.get("VNF", "rollbackVnfCreate")) + + String sdncCallbackUrl = rollbackData.get("VNF", "sdncCallbackUrl") + msoLogger.debug("Rollback sdncCallbackUrl is: " + sdncCallbackUrl) + execution.setVariable("DCVAMR_sdncCallbackUrl", sdncCallbackUrl) + + String tenantId= rollbackData.get("VNF", "tenantId") + msoLogger.debug("Rollback tenantId is: " + tenantId) + execution.setVariable("DCVAMR_tenantId", tenantId) + + String source= rollbackData.get("VNF", "source") + msoLogger.debug("Rollback source is: " + source) + execution.setVariable("DCVAMR_source", source) + + String serviceInstanceId = rollbackData.get("VNF", "serviceInstanceId") + msoLogger.debug("Rollback serviceInstanceId is: " + serviceInstanceId) + execution.setVariable("DCVAMR_serviceInstanceId", serviceInstanceId) + + String cloudSiteId = rollbackData.get("VNF", "cloudSiteId") + msoLogger.debug("Rollback cloudSiteId is: " + cloudSiteId) + execution.setVariable("DCVAMR_cloudSiteId", cloudSiteId) + + def numOfAddOnModulesString = rollbackData.get("VNFANDMODULES", "numOfCreatedAddOnModules") + int numOfAddOnModules = 0 + if (numOfAddOnModulesString != null) { + numOfAddOnModules = Integer.parseInt(numOfAddOnModulesString) + } + execution.setVariable("DCVAMR_numOfAddOnModules", numOfAddOnModules) + + def baseVfModuleRollbackMap = rollbackData.get("VFMODULE_BASE") + if (baseVfModuleRollbackMap == null) { + // there are no VF Modules to delete + execution.setVariable("DCVAMR_numOfModulesToDelete", 0) + } + else { + execution.setVariable("DCVAMR_numOfModulesToDelete", numOfAddOnModules + 1) + } + + // Set aLaCarte to false + execution.setVariable("DCVAMR_aLaCarte", false) + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug(" Error Occured in DoCreateVnfAndModulesRollback PreProcessRequest method!" + e.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnfAndModulesRollback PreProcessRequest") + + } + msoLogger.trace("COMPLETED DoCreateVnfAndModulesRollback PreProcessRequest Process") + } + + + + public void preProcessCreateVfModuleRollback(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessCreateVfModuleRollback") + + try { + + def rollbackData = execution.getVariable("rollbackData") + + def vfModuleRollbackData = new RollbackData() + + def numOfModulesToDelete = execution.getVariable("DCVAMR_numOfModulesToDelete") + msoLogger.debug("numOfModulesToDelete: " + numOfModulesToDelete) + def moduleMap = null + + if (numOfModulesToDelete > 1) { + int addOnModuleIndex = numOfModulesToDelete - 1 + moduleMap = rollbackData.get("VFMODULE_ADDON_" + addOnModuleIndex) + msoLogger.debug("Removing ADDON VF module # " + addOnModuleIndex) + } + else { + moduleMap = rollbackData.get("VFMODULE_BASE") + msoLogger.debug("Removing BASE VF module") + } + moduleMap.each{ k, v -> vfModuleRollbackData.put("VFMODULE", "${k}","${v}") } + execution.setVariable("DCVAMR_RollbackData", vfModuleRollbackData) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessCreateVfModuleRollback ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessCreateVfModuleRollback Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessCreateVfModuleRollback") + } + + + public void postProcessCreateVfModuleRollback(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED postProcessCreateVfModuleRollback") + def rolledBack = false + + try { + rolledBack = execution.getVariable("DCVM_rolledBack") + def numOfModulesToDelete = execution.getVariable("DCVAMR_numOfModulesToDelete") + execution.setVariable("DCVAMR_numOfModulesToDelete", numOfModulesToDelete - 1) + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing postProcessCreateVfModuleRollback ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessCreateVfModuleRollback Method:\n" + e.getMessage()) + } + if (rolledBack == false) { + msoLogger.debug("Failure on DoCreateVfModuleRollback") + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Unsuccessful rollback of DoCreateVfModule ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during rollback of DoCreateVfModule") + } + msoLogger.trace("COMPLETED postProcessCreateVfModuleRollback") + } + + + public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessSDNCDeactivateRequest") + def vnfId = execution.getVariable("vnfId") + def serviceInstanceId = execution.getVariable("serviceInstanceId") + + try{ + //Build SDNC Request + + String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate") + + deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest) + execution.setVariable(Prefix + "deactivateSDNCRequest", deactivateSDNCRequest) + msoLogger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCDeactivateRequest ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCDeactivateRequest") + } + + public void preProcessSDNCUnassignRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessSDNCUnassignRequest Process") + try{ + String vnfId = execution.getVariable("vnfId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign") + + execution.setVariable(Prefix + "unassignSDNCRequest", unassignSDNCRequest) + msoLogger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) + + }catch(Exception e){ + msoLogger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCUnassignRequest Process") + } + + public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis() + } + def callbackURL = execution.getVariable(Prefix + "sdncCallbackUrl") + def requestId = execution.getVariable("msoRequestId") + def tenantId = execution.getVariable(Prefix + "tenantId") + def source = execution.getVariable(Prefix + "source") + def vnfId = execution.getVariable(Prefix + "vnfId") + def serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + def cloudSiteId = execution.getVariable(Prefix + "cloudSiteId") + + String sdncRequest = + """ + + ${MsoUtils.xmlEscape(uuid)} + ${MsoUtils.xmlEscape(svcInstId)} + ${MsoUtils.xmlEscape(action)} + vnf-topology-operation + ${MsoUtils.xmlEscape(callbackURL)} + generic-resource + + + + ${MsoUtils.xmlEscape(requestId)} + DeleteVnfInstance + ${MsoUtils.xmlEscape(source)} + + + + + + + + ${MsoUtils.xmlEscape(serviceInstanceId)} + + + + ${MsoUtils.xmlEscape(vnfId)} + + + + + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(cloudSiteId)} + + + """ + + msoLogger.debug("sdncRequest: " + sdncRequest) + return sdncRequest + } + + public void validateSDNCResponse(DelegateExecution execution, String response, String method){ + + execution.setVariable("prefix",Prefix) + msoLogger.debug("STARTED ValidateSDNCResponse Process") + + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + msoLogger.debug("workflowException: " + workflowException) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + String sdncResponse = response + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) + }else{ + msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + throw new BpmnError("MSOWorkflowException") + } + msoLogger.debug("COMPLETED ValidateSDNCResponse Process") + } + + public void setSuccessfulRollbackStatus (DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED setSuccessfulRollbackStatus") + + try{ + // Set rolledBack to true, rollbackError to null + execution.setVariable("rolledBack", true) + execution.setVariable("rollbackError", null) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing setSuccessfulRollbackStatus ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED setSuccessfulRollbackStatus") + } + + public void setFailedRollbackStatus (DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED setFailedRollbackStatus") + + try{ + // Set rolledBack to false, rollbackError to actual value, rollbackData to null + execution.setVariable("rolledBack", false) + def rollbackError = execution.getVariable("rollbackError") + if (rollbackError == null) { + execution.setVariable("rollbackError", 'Caught exception in DoCreateVnfAndModulesRollback') + } + execution.setVariable("rollbackData", null) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing setFailedRollbackStatus. ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED setFailedRollbackStatus") + } + + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy new file mode 100644 index 0000000000..238ac82c01 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy @@ -0,0 +1,640 @@ +/*- + * ============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.bpmn.infrastructure.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray; +import org.json.JSONObject; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.springframework.web.util.UriUtils; +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient + +import groovy.json.* + + + +/** + * This groovy class supports the DoDeleteE2EServiceInstance.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId - O + * @param - subscriptionServiceType - O + * @param - serviceInstanceId + * @param - serviceInstanceName - O + * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) + * @param - sdncVersion + * @param - failNotFound - TODO + * @param - serviceInputParams - TODO + * + * Outputs: + * @param - WorkflowException + * + * Rollback - Deferred + */ +public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCustomDeleteE2EServiceInstance.class); + + + String Prefix="DDELSI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + msoLogger.trace("preProcessRequest ") + String msg = "" + + try { + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("prefix",Prefix) + + //Inputs + //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology + String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + if (globalSubscriberId == null) + { + execution.setVariable("globalSubscriberId", "") + } + + //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology + String serviceType = execution.getVariable("serviceType") + if (serviceType == null) + { + execution.setVariable("serviceType", "") + } + + //Generated in parent for AAI PUT + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)){ + msg = "Input serviceInstanceId is null" + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String sdncCallbackUrl = UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution) + if (isBlank(sdncCallbackUrl)) { + msg = "URN_mso_workflow_sdncadapter_callback is null" + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + msoLogger.info("SDNC Callback URL: " + sdncCallbackUrl) + + StringBuilder sbParams = new StringBuilder() + Map paramsMap = execution.getVariable("serviceInputParams") + if (paramsMap != null) + { + sbParams.append("") + for (Map.Entry entry : paramsMap.entrySet()) { + String paramsXml + String paramName = entry.getKey() + String paramValue = entry.getValue() + paramsXml = + """ + ${MsoUtils.xmlEscape(paramName)} + ${MsoUtils.xmlEscape(paramValue)} + + """ + sbParams.append(paramsXml) + } + sbParams.append("") + } + String siParamsXml = sbParams.toString() + if (siParamsXml == null) + siParamsXml = "" + execution.setVariable("siParamsXml", siParamsXml) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest ") + } + + + public void preProcessVFCDelete (DelegateExecution execution) { + } + + public void postProcessVFCDelete(DelegateExecution execution, String response, String method) { + } + + public void preProcessSDNCDelete (DelegateExecution execution) { + msoLogger.trace("preProcessSDNCDelete ") + String msg = "" + + try { + def serviceInstanceId = execution.getVariable("serviceInstanceId") + def serviceInstanceName = execution.getVariable("serviceInstanceName") + def callbackURL = execution.getVariable("sdncCallbackUrl") + def requestId = execution.getVariable("msoRequestId") + def serviceId = execution.getVariable("productFamilyId") + def subscriptionServiceType = execution.getVariable("subscriptionServiceType") + def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + + String serviceModelInfo = execution.getVariable("serviceModelInfo") + def modelInvariantUuid = "" + def modelVersion = "" + def modelUuid = "" + def modelName = "" + if (!isBlank(serviceModelInfo)) + { + modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") + modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") + modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid") + modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") + + if (modelInvariantUuid == null) { + modelInvariantUuid = "" + } + if (modelVersion == null) { + modelVersion = "" + } + if (modelUuid == null) { + modelUuid = "" + } + if (modelName == null) { + modelName = "" + } + } + if (serviceInstanceName == null) { + serviceInstanceName = "" + } + if (serviceId == null) { + serviceId = "" + } + + def siParamsXml = execution.getVariable("siParamsXml") + def serviceType = execution.getVariable("serviceType") + if (serviceType == null) + { + serviceType = "" + } + + def sdncRequestId = UUID.randomUUID().toString() + + String sdncDelete = + """ + + ${MsoUtils.xmlEscape(sdncRequestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + delete + service-topology-operation + ${MsoUtils.xmlEscape(callbackURL)} + ${MsoUtils.xmlEscape(serviceType)} + + + + ${MsoUtils.xmlEscape(requestId)} + MSO + + + + DeleteServiceInstance + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(subscriptionServiceType)} + + ${MsoUtils.xmlEscape(modelInvariantUuid)} + ${MsoUtils.xmlEscape(modelUuid)} + ${MsoUtils.xmlEscape(modelVersion)} + ${MsoUtils.xmlEscape(modelName)} + + ${MsoUtils.xmlEscape(serviceInstanceId)} + + ${MsoUtils.xmlEscape(globalSubscriberId)} + + + ${MsoUtils.xmlEscape(serviceInstanceName)} + ${siParamsXml} + + + """ + + sdncDelete = utils.formatXml(sdncDelete) + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + execution.setVariable("sdncDelete", sdncDelete) + execution.setVariable("sdncDeactivate", sdncDeactivate) + msoLogger.info("sdncDeactivate:\n" + sdncDeactivate) + msoLogger.info("sdncDelete:\n" + sdncDelete) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage()) + } + msoLogger.info(" *****Exit preProcessSDNCDelete *****") + } + + public void postProcessSDNCDelete(DelegateExecution execution, String response, String method) { + + msoLogger.trace("postProcessSDNC " + method + " ") + String msg = "" + + /*try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + msoLogger.info("SDNCResponse: " + response) + msoLogger.info("workflowException: " + workflowException) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == "true"){ + msoLogger.info("Good response from SDNC Adapter for service-instance " + method + "response:\n" + response) + + }else{ + msg = "Bad Response from SDNC Adapter for service-instance " + method + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg) + } + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in postProcessSDNC " + method + " Exception:" + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + }*/ + msoLogger.trace("Exit postProcessSDNC " + method + " ") + } + + public void postProcessAAIGET(DelegateExecution execution) { + msoLogger.trace("postProcessAAIGET ") + String msg = "" + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + String serviceType = "" + + if(foundInAAI){ + msoLogger.info("Found Service-instance in AAI") + + String siData = execution.getVariable("GENGS_service") + msoLogger.info("SI Data") + if (isBlank(siData)) + { + msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + else + { + msoLogger.info("SI Data" + siData) + //Confirm there are no related service instances (vnf/network or volume) + if (utils.nodeExists(siData, "relationship-list")) { + msoLogger.info("SI Data relationship-list exists:") + InputSource source = new InputSource(new StringReader(siData)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document serviceXml = docBuilder.parse(source) + serviceXml.getDocumentElement().normalize() + //test(siData) + NodeList nodeList = serviceXml.getElementsByTagName("relationship") + JSONArray jArray = new JSONArray() + for (int x = 0; x < nodeList.getLength(); x++) { + Node node = nodeList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() //for ns + if(e.equals("service-instance")){ + def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent() + msoLogger.info("ServiceInstance Related NS :" + relatedObject) + NodeList dataList = node.getChildNodes() + if(null != dataList) { + JSONObject jObj = new JSONObject() + for (int i = 0; i < dataList.getLength(); i++) { + Node dNode = dataList.item(i) + if(dNode.getNodeName() == "relationship-data") { + Element rDataEle = (Element)dNode + def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent() + def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent() + if(eKey.equals("service-instance.service-instance-id")){ + jObj.put("resourceInstanceId", eValue) + } + } + else if(dNode.getNodeName() == "related-to-property"){ + Element rDataEle = (Element)dNode + def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent() + def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent() + if(eKey.equals("service-instance.service-instance-name")){ + jObj.put("resourceType", eValue) + } + } + } + msoLogger.info("Relationship related to Resource:" + jObj.toString()) + jArray.put(jObj) + } + //for overlay/underlay + }else if (e.equals("configuration")){ + def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent() + msoLogger.info("ServiceInstance Related Configuration :" + relatedObject) + NodeList dataList = node.getChildNodes() + if(null != dataList) { + JSONObject jObj = new JSONObject() + for (int i = 0; i < dataList.getLength(); i++) { + Node dNode = dataList.item(i) + if(dNode.getNodeName() == "relationship-data") { + Element rDataEle = (Element)dNode + def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent() + def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent() + if(eKey.equals("configuration.configuration-id")){ + jObj.put("resourceInstanceId", eValue) + } + } + else if(dNode.getNodeName() == "related-to-property"){ + Element rDataEle = (Element)dNode + def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent() + def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent() + if(eKey.equals("configuration.configuration-type")){ + jObj.put("resourceType", eValue) + } + } + } + msoLogger.info("Relationship related to Resource:" + jObj.toString()) + jArray.put(jObj) + } + } + } + } + execution.setVariable("serviceRelationShip", jArray.toString()) + } + } + }else{ + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(!succInAAI){ + msoLogger.info("Error getting Service-instance from AAI", + serviceInstanceId) + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + + msoLogger.info("Service-instance NOT found in AAI. Silent Success") + } + }catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit postProcessAAIGET ") + } + + /** + * Deletes the service instance in aai + */ + public void deleteServiceInstance(DelegateExecution execution) { + msoLogger.trace("Entered deleteServiceInstance") + try { + String globalCustId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + AAIResourcesClient resourceClient = new AAIResourcesClient(); + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId) + resourceClient.delete(serviceInstanceUri) + + msoLogger.trace("Exited deleteServiceInstance") + }catch(Exception e){ + msoLogger.debug("Error occured within deleteServiceInstance method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteServiceInstance from aai") + } + } + + public void preInitResourcesOperStatus(DelegateExecution execution){ + msoLogger.trace("STARTED preInitResourcesOperStatus Process ") + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = execution.getVariable("operationType") + String resourceTemplateUUIDs = "" + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service creation" + msoLogger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + // we use resource instance ids for delete flow as resourceTemplateUUIDs + /*[ + { + "resourceInstanceId":"1111", + "resourceType":"vIMS" + }, + { + "resourceInstanceId":"222", + "resourceType":"vEPC" + }, + { + "resourceInstanceId":"3333", + "resourceType":"overlay" + }, + { + "resourceInstanceId":"4444", + "resourceType":"underlay" + } + ]*/ + String serviceRelationShip = execution.getVariable("serviceRelationShip") + + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + List relationShipList = jsonSlurper.parseText(serviceRelationShip) + + if (relationShipList != null) { + relationShipList.each { + resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":" + } + } + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + String payload = + """ + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(operationId)} + ${MsoUtils.xmlEscape(operationType)} + ${MsoUtils.xmlEscape(resourceTemplateUUIDs)} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_initResOperStatusRequest", payload) + msoLogger.info("Outgoing initResourceOperationStatus: \n" + payload) + msoLogger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preInitResourcesOperStatus Process ") + } + + /** + * prepare delete parameters + */ + public void preResourceDelete(execution, resourceName){ + // we use resource instance ids for delete flow as resourceTemplateUUIDs + /*[ + { + "resourceInstanceId":"1111", + "resourceType":"vIMS" + }, + { + "resourceInstanceId":"222", + "resourceType":"vEPC" + }, + { + "resourceInstanceId":"3333", + "resourceType":"overlay" + }, + { + "resourceInstanceId":"4444", + "resourceType":"underlay" + } + ]*/ + msoLogger.trace("STARTED preResourceDelete Process ") + String serviceRelationShip = execution.getVariable("serviceRelationShip") + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + List relationShipList = jsonSlurper.parseText(serviceRelationShip) + + if (relationShipList != null) { + relationShipList.each { + if(StringUtils.containsIgnoreCase(it.resourceType, resourceName)) { + String resourceInstanceUUID = it.resourceInstanceId + String resourceTemplateUUID = it.resourceInstanceId + execution.setVariable("resourceTemplateId", resourceTemplateUUID) + execution.setVariable("resourceInstanceId", resourceInstanceUUID) + execution.setVariable("resourceType", resourceName) + msoLogger.info("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName) + } + } + } + msoLogger.trace("END preResourceDelete Process ") + } + + public void sequenceResource(execution){ + msoLogger.trace("STARTED sequenceResource Process ") + List nsResources = new ArrayList() + List wanResources = new ArrayList() + List resourceSequence = new ArrayList() + + String serviceRelationShip = execution.getVariable("serviceRelationShip") + + + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + List relationShipList = jsonSlurper.parseText(serviceRelationShip) + + if (relationShipList != null) { + relationShipList.each { + if(StringUtils.containsIgnoreCase(it.resourceType, "overlay") || StringUtils.containsIgnoreCase(it.resourceType, "underlay")){ + wanResources.add(it.resourceType) + }else{ + nsResources.add(it.resourceType) + } + } + } + resourceSequence.addAll(wanResources) + resourceSequence.addAll(nsResources) + String isContainsWanResource = wanResources.isEmpty() ? "false" : "true" + execution.setVariable("isContainsWanResource", isContainsWanResource) + execution.setVariable("currentResourceIndex", 0) + execution.setVariable("resourceSequence", resourceSequence) + msoLogger.info("resourceSequence: " + resourceSequence) + execution.setVariable("wanResources", wanResources) + msoLogger.trace("END sequenceResource Process ") + } + + public void getCurrentResource(execution){ + msoLogger.trace("Start getCurrentResoure Process ") + def currentIndex = execution.getVariable("currentResourceIndex") + List resourceSequence = execution.getVariable("resourceSequence") + List wanResources = execution.getVariable("wanResources") + String resourceName = resourceSequence.get(currentIndex) + execution.setVariable("resourceType",resourceName) + if(wanResources.contains(resourceName)){ + execution.setVariable("controllerInfo", "SDN-C") + }else{ + execution.setVariable("controllerInfo", "VF-C") + } + msoLogger.trace("COMPLETED getCurrentResoure Process ") + } + + public void parseNextResource(execution){ + msoLogger.trace("Start parseNextResource Process ") + def currentIndex = execution.getVariable("currentResourceIndex") + def nextIndex = currentIndex + 1 + execution.setVariable("currentResourceIndex", nextIndex) + List resourceSequence = execution.getVariable("resourceSequence") + if(nextIndex >= resourceSequence.size()){ + execution.setVariable("allResourceFinished", "true") + }else{ + execution.setVariable("allResourceFinished", "false") + } + msoLogger.trace("COMPLETED parseNextResource Process ") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy new file mode 100644 index 0000000000..20a7f43de7 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy @@ -0,0 +1,1132 @@ +/*- + * ============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.bpmn.infrastructure.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray; +import org.json.JSONObject; +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse; +import org.springframework.web.util.UriUtils; + +import groovy.json.* + + + +/** + * This groovy class supports the DoDeleteE2EServiceInstance.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId - O + * @param - subscriptionServiceType - O + * @param - serviceInstanceId + * @param - serviceInstanceName - O + * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) + * @param - sdncVersion + * @param - failNotFound - TODO + * @param - serviceInputParams - TODO + * + * Outputs: + * @param - WorkflowException + * + * Rollback - Deferred + */ +public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCustomDeleteE2EServiceInstanceV2.class); + + + String Prefix="DDELSI_" + private static final String DebugFlag = "isDebugEnabled" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + + def method = getClass().getSimpleName() + '.buildAPPCRequest(' +'execution=' + execution.getId() +')' + msoLogger.info("Entered " + method) + msoLogger.trace("preProcessRequest ") + String msg = "" + + try { + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("prefix",Prefix) + + //Inputs + //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology + String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + if (globalSubscriberId == null) + { + execution.setVariable("globalSubscriberId", "") + } + + //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology + String serviceType = execution.getVariable("serviceType") + if (serviceType == null) + { + execution.setVariable("serviceType", "") + } + + //Generated in parent for AAI PUT + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)){ + msg = "Input serviceInstanceId is null" + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') + if (isBlank(sdncCallbackUrl)) { + msg = "URN_mso_workflow_sdncadapter_callback is null" + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + msoLogger.info("SDNC Callback URL: " + sdncCallbackUrl) + + StringBuilder sbParams = new StringBuilder() + Map paramsMap = execution.getVariable("serviceInputParams") + if (paramsMap != null) + { + sbParams.append("") + for (Map.Entry entry : paramsMap.entrySet()) { + String paramsXml + String paramName = entry.getKey() + String paramValue = entry.getValue() + paramsXml = + """ + ${MsoUtils.xmlEscape(paramName)} + ${MsoUtils.xmlEscape(paramValue)} + + """ + sbParams.append(paramsXml) + } + sbParams.append("") + } + String siParamsXml = sbParams.toString() + if (siParamsXml == null) + siParamsXml = "" + execution.setVariable("siParamsXml", siParamsXml) + execution.setVariable("operationStatus", "Waiting delete resource...") + execution.setVariable("progress", "0") + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.info("Exited " + method) + } + + + + public void postProcessAAIGET(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.postProcessAAIGET(' +'execution=' + execution.getId() +')' + msoLogger.info("Entered " + method) + + String msg = "" + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + msoLogger.info("serviceInstanceId: "+serviceInstanceId) + + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + msoLogger.info("foundInAAI: "+foundInAAI) + + String serviceType = "" + + + if(foundInAAI){ + msoLogger.info("Found Service-instance in AAI") + + String siData = execution.getVariable("GENGS_service") + msoLogger.info("SI Data") + if (isBlank(siData)) + { + msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + }else{ + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(!succInAAI){ + msoLogger.info("Error getting Service-instance from AAI", + serviceInstanceId) + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + + msoLogger.info("Service-instance NOT found in AAI. Silent Success") + } + }catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Bpmn error encountered in " + method + "--" + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.info("Exited " + method) + } + + private void loadResourcesProperties(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.loadResourcesProperties(' +'execution=' + execution.getId() +')' + def isDebugEnabled = execution.getVariable("isDebugEnabled") + msoLogger.info("Entered " + method) + String loadFilePath = "/etc/mso/config.d/reources.json" + try{ + def jsonPayload = new File(loadFilePath).text + msoLogger.info("jsonPayload: " + jsonPayload) + + String resourcesProperties = jsonUtil.prettyJson(jsonPayload.toString()) + msoLogger.info("resourcesProperties: " + resourcesProperties) + + String createResourceSort = jsonUtil.getJsonValue(resourcesProperties, "CreateResourceSort") + msoLogger.info("createResourceSort: " + createResourceSort) + execution.setVariable("createResourceSort", createResourceSort) + + String deleteResourceSort = jsonUtil.getJsonValue(resourcesProperties, "DeleteResourceSort") + msoLogger.info("deleteResourceSort: " + deleteResourceSort) + execution.setVariable("deleteResourceSort", deleteResourceSort) + + + String resourceControllerType = jsonUtil.getJsonValue(resourcesProperties, "ResourceControllerType") + msoLogger.info("resourceControllerType: " + resourceControllerType) + execution.setVariable("resourceControllerType", resourceControllerType) + + + }catch(Exception ex){ + // try error in method block + String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + msoLogger.info("Exited " + method) + } + private void sortDeleteResource(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sortDeleteResource(' +'execution=' + execution.getId() +')' + def isDebugEnabled = execution.getVariable("isDebugEnabled") + msoLogger.info("Entered " + method) + String deleteResourceSortDef = """[ + { + "resourceType":"GRE_SAR" + }, + { + "resourceType":"VPN_SAR" + }, + { + "resourceType":"APN_AAR" + }, + { + "resourceType":"GRE_AAR" + }, + { + "resourceType":"Overlay" + }, + { + "resourceType":"Underlay" + }, + { + "resourceType":"vIMS" + }, + { + "resourceType":"vCPE" + }, + { + "resourceType":"vFW" + }, + { + "resourceType":"vEPC" + } + + + ]""".trim() + + try{ + loadResourcesProperties(execution) + String deleteResourceSort = execution.getVariable("deleteResourceSort") + if (isBlank(deleteResourceSort)) { + deleteResourceSort = deleteResourceSortDef; + } + + List sortResourceList = jsonUtil.StringArrayToList(execution, deleteResourceSort) + msoLogger.info("sortResourceList : " + sortResourceList) + + JSONArray newResourceList = new JSONArray() + int resSortCount = sortResourceList.size() + + for ( int currentResource = 0 ; currentResource < resSortCount ; currentResource++ ) { + String currentSortResource = sortResourceList[currentResource] + String sortResourceType = jsonUtil.getJsonValue(currentSortResource, "resourceType") + List resourceList = execution.getVariable(Prefix+"resourceList") + + for (String resource : resourceList) { + msoLogger.info("resource : " + resource) + String resourceType = jsonUtil.getJsonValue(resource, "resourceType") + + if (StringUtils.containsIgnoreCase(resourceType, sortResourceType)) { + JSONObject jsonObj = new JSONObject(resource) + newResourceList.put(jsonObj) + } + msoLogger.info("Get next sort type " ) + } + } + + String newResourceStr = newResourceList.toString() + List newResourceListStr = jsonUtil.StringArrayToList(execution, newResourceStr) + + execution.setVariable(Prefix+"resourceList", newResourceListStr) + msoLogger.info("newResourceList : " + newResourceListStr) + + }catch(Exception ex){ + // try error in method block + String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + msoLogger.info("Exited " + method) + + } + public void prepareServiceDeleteResource(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepareServiceDeleteResource(' +'execution=' + execution.getId() +')' + msoLogger.info("Entered " + method) + + try { + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + // confirm if ServiceInstance was found + if ( !execution.getVariable("GENGS_FoundIndicator") ) + { + String exceptionMessage = "Bpmn error encountered in DeleteMobileAPNCustService flow. Service Instance was not found in AAI by id: " + serviceInstanceId + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + execution.setVariable(Prefix+"resourceList", "") + execution.setVariable(Prefix+"resourceCount", 0) + execution.setVariable(Prefix+"nextResource", 0) + execution.setVariable(Prefix+"resourceFinish", true) + + // get SI extracted by GenericGetService + String serviceInstanceAaiRecord = execution.getVariable("GENGS_service"); + msoLogger.info("serviceInstanceAaiRecord: " +serviceInstanceAaiRecord) + + String aaiJsonRecord = jsonUtil.xml2json(serviceInstanceAaiRecord) + + msoLogger.info("aaiJsonRecord: " +aaiJsonRecord) + def serviceInstanceName = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.service-instance-name") + execution.setVariable("serviceInstanceName",serviceInstanceName) + + def serviceType = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.service-type") + execution.setVariable("serviceType",serviceType) + + + String relationshipList = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.relationship-list") + msoLogger.info("relationship-list:" + relationshipList) + if (! isBlank(relationshipList)){ + msoLogger.info("relationship-list exists" ) + String relationShip = jsonUtil.getJsonValue(relationshipList, "relationship") + msoLogger.info("relationship: " + relationShip) + JSONArray allResources = new JSONArray() + JSONArray serviceResources = new JSONArray() + JSONArray networkResources = new JSONArray() + JSONArray allottedResources = new JSONArray() + + + if (! isBlank(relationShip)){ + JSONArray jsonArray = new JSONArray(); + if (relationShip.startsWith("{") && relationShip.endsWith("}")) { + JSONObject jsonObject = new JSONObject(relationShip); + jsonArray.put(jsonObject); + } else if (relationShip.startsWith("[") && relationShip.endsWith("]")) { + jsonArray = new JSONArray(relationShip); + } else { + msoLogger.info("The relationShip fomart is error" ) + } + + List relationList = jsonUtil.StringArrayToList(execution, jsonArray.toString()) + + msoLogger.info("relationList: " + relationList) + + int relationNum =relationList.size() + msoLogger.info("**************relationList size: " + relationNum) + + for ( int currentRelation = 0 ; currentRelation < relationNum ; currentRelation++ ) { + msoLogger.info("current Relation num: " + currentRelation) + String relation = relationList[currentRelation] + msoLogger.info("relation: " + relation) + + String relatedTo = jsonUtil.getJsonValue(relation, "related-to") + msoLogger.info("relatedTo: " + relatedTo) + + String relatedLink = jsonUtil.getJsonValue(relation, "related-link") + msoLogger.info("relatedLink: " + relatedLink) + + if (StringUtils.equalsIgnoreCase(relatedTo, "allotted-resource")) { + msoLogger.info("allotted-resource exists ") + + String aaiArRsp = getAaiAr(execution, relatedLink) + msoLogger.info("aaiArRsp: " + aaiArRsp) + if (! isBlank(aaiArRsp)) { + def type = utils.getNodeText(aaiArRsp, "type") + def id = utils.getNodeText(aaiArRsp, "id") + def role = utils.getNodeText(aaiArRsp, "role") + def resourceVersion = utils.getNodeText(aaiArRsp, "resource-version") + + JSONObject jObject = new JSONObject() + jObject.put("resourceType", type) + jObject.put("resourceInstanceId", id) + jObject.put("resourceRole", role) + jObject.put("resourceVersion", resourceVersion) + + allResources.put(jObject) + msoLogger.info("allResources: " + allResources) + allottedResources.put(jObject) + msoLogger.info("allottedResources: " + allottedResources) + } + } + else if (StringUtils.equalsIgnoreCase(relatedTo, "service-instance")){ + msoLogger.info("service-instance exists ") + JSONObject jObject = new JSONObject() + + //relationship-data + String rsDataStr = jsonUtil.getJsonValue(relation, "relationship-data") + msoLogger.info("rsDataStr: " + rsDataStr) + List rsDataList = jsonUtil.StringArrayToList(execution, rsDataStr) + msoLogger.info("rsDataList: " + rsDataList) + for(String rsData : rsDataList){ + msoLogger.info("rsData: " + rsData) + def eKey = jsonUtil.getJsonValue(rsData, "relationship-key") + def eValue = jsonUtil.getJsonValue(rsData, "relationship-value") + if(eKey.equals("service-instance.service-instance-id")){ + jObject.put("resourceInstanceId", eValue) + } + if(eKey.equals("service-subscription.service-type")){ + jObject.put("resourceType", eValue) + } + } + + //related-to-property + String rPropertyStr = jsonUtil.getJsonValue(relation, "related-to-property") + msoLogger.info("related-to-property: " + rPropertyStr) + if (rPropertyStr instanceof JSONArray){ + List rPropertyList = jsonUtil.StringArrayToList(execution, rPropertyStr) + for (String rProperty : rPropertyList) { + msoLogger.info("rProperty: " + rProperty) + def eKey = jsonUtil.getJsonValue(rProperty, "property-key") + def eValue = jsonUtil.getJsonValue(rProperty, "property-value") + if(eKey.equals("service-instance.service-instance-name")){ + jObject.put("resourceName", eValue) + } + } + } + else { + String rProperty = rPropertyStr + msoLogger.info("rProperty: " + rProperty) + def eKey = jsonUtil.getJsonValue(rProperty, "property-key") + def eValue = jsonUtil.getJsonValue(rProperty, "property-value") + if (eKey.equals("service-instance.service-instance-name")) { + jObject.put("resourceName", eValue) + } + } + + allResources.put(jObject) + msoLogger.info("allResources: " + allResources) + + serviceResources.put(jObject) + msoLogger.info("serviceResources: " + serviceResources) + } + else if (StringUtils.equalsIgnoreCase(relatedTo, "configuration")) { + msoLogger.info("configuration ") + JSONObject jObject = new JSONObject() + + //relationship-data + String rsDataStr = jsonUtil.getJsonValue(relation, "relationship-data") + msoLogger.info("rsDataStr: " + rsDataStr) + List rsDataList = jsonUtil.StringArrayToList(execution, rsDataStr) + msoLogger.info("rsDataList: " + rsDataList) + for (String rsData : rsDataList) { + msoLogger.info("rsData: " + rsData) + def eKey = jsonUtil.getJsonValue(rsData, "relationship-key") + def eValue = jsonUtil.getJsonValue(rsData, "relationship-value") + if(eKey.equals("configuration.configuration-id")){ + jObject.put("resourceInstanceId", eValue) + } + } + + + //related-to-property + String rPropertyStr = jsonUtil.getJsonValue(relation, "related-to-property") + msoLogger.info("related-to-property: " + rPropertyStr) + if (rPropertyStr instanceof JSONArray){ + List rPropertyList = jsonUtil.StringArrayToList(execution, rPropertyStr) + for(String rProperty : rPropertyList){ + msoLogger.info("rProperty: " + rProperty) + def eKey = jsonUtil.getJsonValue(rProperty, "property-key") + def eValue = jsonUtil.getJsonValue(rProperty, "property-value") + if(eKey.equals("configuration.configuration-type")){ + jObject.put("resourceType", eValue) + } + } + } + else { + String rProperty = rPropertyStr + msoLogger.info("rProperty: " + rProperty) + def eKey = jsonUtil.getJsonValue(rProperty, "property-key") + def eValue = jsonUtil.getJsonValue(rProperty, "property-value") + if(eKey.equals("configuration.configuration-type")){ + jObject.put("resourceType", eValue) + } + } + allResources.put(jObject) + msoLogger.info("allResources: " + allResources) + + networkResources.put(jObject) + msoLogger.info("networkResources: " + networkResources) + } + msoLogger.info("Get Next releation resource " ) + + } + msoLogger.info("Get releation finished. " ) + } + + execution.setVariable("serviceRelationShip", allResources.toString()) + msoLogger.info("allResources: " + allResources.toString()) + String serviceRelationShip = execution.getVariable("serviceRelationShip") + msoLogger.info("serviceRelationShip: " + serviceRelationShip) + if ((! isBlank(serviceRelationShip)) && (! serviceRelationShip.isEmpty())) { + + List relationShipList = jsonUtil.StringArrayToList(execution, serviceRelationShip) + msoLogger.info("relationShipList: " + relationShipList) + execution.setVariable(Prefix+"resourceList", relationShipList) + + int resourceCount = relationShipList.size() + msoLogger.info("resourceCount: " + resourceCount) + execution.setVariable(Prefix+"resourceCount",resourceCount ) + + int resourceNum = 0 + execution.setVariable(Prefix+"nextResource", resourceNum) + msoLogger.info("start sort delete resource: ") + sortDeleteResource(execution) + + + if (resourceNum < resourceCount) { + execution.setVariable(Prefix+"resourceFinish", false) + } + else { + execution.setVariable(Prefix+"resourceFinish", true) + } + msoLogger.info("Resource list set end : " + resourceCount) + } + + execution.setVariable("serviceResources", serviceResources.toString()) + msoLogger.info("serviceResources: " + serviceResources) + String serviceResourcesShip = execution.getVariable("serviceResources") + msoLogger.info("serviceResourcesShip: " + serviceResourcesShip) + + if ((! isBlank(serviceResourcesShip)) && (! serviceResourcesShip.isEmpty())) { + List serviceResourcesList = jsonUtil.StringArrayToList(execution, serviceResourcesShip) + msoLogger.info("serviceResourcesList: " + serviceResourcesList) + execution.setVariable(Prefix+"serviceResourceList", serviceResourcesList) + execution.setVariable(Prefix+"serviceResourceCount", serviceResourcesList.size()) + execution.setVariable(Prefix+"nextServiceResource", 0) + msoLogger.info("Service Resource list set end : " + serviceResourcesList.size()) + + } + + execution.setVariable("allottedResources", allottedResources.toString()) + msoLogger.info("allottedResources: " + allottedResources) + String allottedResourcesShip = execution.getVariable("allottedResources") + msoLogger.info("allottedResourcesShip: " + allottedResourcesShip) + if ((! isBlank(allottedResourcesShip)) && (! allottedResourcesShip.isEmpty())) { + List allottedResourcesList = jsonUtil.StringArrayToList(execution, allottedResourcesShip) + msoLogger.info("allottedResourcesList: " + allottedResourcesList) + execution.setVariable(Prefix+"allottedResourcesList", allottedResourcesList) + execution.setVariable(Prefix+"allottedResourcesListCount", allottedResourcesList.size()) + execution.setVariable(Prefix+"nextAllottedResourcesList", 0) + msoLogger.info("Allotted Resource list set end : " + allottedResourcesList.size()) + + } + execution.setVariable("networkResources", networkResources.toString()) + msoLogger.info("networkResources: " + networkResources) + String networkResourcesShip = execution.getVariable("networkResources") + msoLogger.info("networkResourcesShip: " + networkResourcesShip) + if ((! isBlank(networkResourcesShip)) && (! networkResourcesShip.isEmpty())) { + List networkResourcesList = jsonUtil.StringArrayToList(execution, networkResourcesShip) + msoLogger.info("networkResourcesList: " + networkResourcesList) + execution.setVariable(Prefix+"networkResourcesList", networkResourcesList) + execution.setVariable(Prefix+"networkResourcesListCount", networkResourcesList.size()) + execution.setVariable(Prefix+"nextNetworkResourcesList", 0) + msoLogger.info("Network Resource list set end : " + networkResourcesList.size()) + + } + } + } catch (BpmnError e){ + throw e; + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DeleteMobileAPNCustService flow. prepareServiceDeleteResource() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + msoLogger.info("Exited " + method) + } + + private String getAaiAr(DelegateExecution execution, String relink) { + def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')' + msoLogger.info("Entered " + method) + AaiUtil aaiUtil = new AaiUtil(this) + String aaiEndpoint = execution.getVariable("URN_aai_endpoint") + relink + + msoLogger.debug("get AR info " + aaiEndpoint) + APIResponse response = aaiUtil.executeAAIGetCall(execution, aaiEndpoint) + + int responseCode = response.getStatusCode() + msoLogger.debug("get AR info responseCode:" + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + msoLogger.debug("get AR info " + aaiResponse) + + if(responseCode < 200 || responseCode >= 300 || isBlank(aaiResponse)) { + return null + } + + msoLogger.info("Exited " + method) + return aaiResponse + } + /** + * prepare Decompose next resource to create request + */ + public void preProcessDecomposeNextResource(DelegateExecution execution){ + def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')' + msoLogger.info("Entered " + method) + msoLogger.trace("STARTED preProcessDecomposeNextResource Process ") + try{ + int resourceNum = execution.getVariable(Prefix+"nextServiceResource") + List serviceResourceList = execution.getVariable(Prefix+"serviceResourceList") + msoLogger.info("Service Resource List : " + serviceResourceList) + + String serviceResource = serviceResourceList[resourceNum] + execution.setVariable(Prefix+"serviceResource", serviceResource) + msoLogger.info("Current Service Resource : " + serviceResource) + + String resourceType = jsonUtil.getJsonValue(serviceResource, "resourceType") + execution.setVariable("resourceType", resourceType) + msoLogger.info("resourceType : " + resourceType) + + String resourceInstanceId = jsonUtil.getJsonValue(serviceResource, "resourceInstanceId") + execution.setVariable("resourceInstanceId", resourceInstanceId) + msoLogger.info("resourceInstanceId : " + resourceInstanceId) + + String resourceRole = jsonUtil.getJsonValue(serviceResource, "resourceRole") + execution.setVariable("resourceRole", resourceRole) + msoLogger.info("resourceRole : " + resourceRole) + + String resourceVersion = jsonUtil.getJsonValue(serviceResource, "resourceVersion") + execution.setVariable("resourceVersion", resourceVersion) + msoLogger.info("resourceVersion : " + resourceVersion) + + String resourceName = jsonUtil.getJsonValue(serviceResource, "resourceName") + if (isBlank(resourceName)){ + resourceName = resourceInstanceId + } + execution.setVariable(Prefix+"resourceName", resourceName) + msoLogger.info("resource Name : " + resourceName) + + + execution.setVariable(Prefix+"nextServiceResource", resourceNum + 1) + + int serviceResourceCount = execution.getVariable(Prefix+"serviceResourceCount") + if (serviceResourceCount >0 ){ + int progress = (resourceNum*100) / serviceResourceCount + execution.setVariable("progress", progress.toString() ) + } + execution.setVariable("operationStatus", resourceName ) + + }catch(Exception e){ + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateMobileAPNCustService flow. Unexpected Error from method preProcessDecomposeNextResource() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + msoLogger.info("Exited " + method) + } + /** + * post Decompose next resource to create request + */ + public void postProcessDecomposeNextResource(DelegateExecution execution){ + def method = getClass().getSimpleName() + '.postProcessDecomposeNextResource(' +'execution=' + execution.getId() +')' + msoLogger.info("Entered " + method) + msoLogger.trace("STARTED postProcessDecomposeNextResource Process ") + try{ + String resourceName = execution.getVariable(Prefix+"resourceName") + int resourceNum = execution.getVariable(Prefix+"nextServiceResource") + msoLogger.debug("Current Resource count:"+ execution.getVariable(Prefix+"nextServiceResource")) + + int resourceCount = execution.getVariable(Prefix+"serviceResourceCount") + msoLogger.debug("Total Resource count:"+ execution.getVariable(Prefix+"serviceResourceCount")) + + if (resourceNum < resourceCount) { + execution.setVariable(Prefix+"resourceFinish", false) + } + else { + execution.setVariable(Prefix+"resourceFinish", true) + } + + msoLogger.debug("Resource Finished:"+ execution.getVariable(Prefix+"resourceFinish")) + + if (resourceCount >0 ){ + int progress = (resourceNum*100) / resourceCount + + execution.setVariable("progress", progress.toString() ) + msoLogger.trace(":"+ execution.getVariable("")) + } + execution.setVariable("operationStatus", resourceName ) + + + }catch(Exception e){ + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateMobileAPNCustService flow. Unexpected Error from method postProcessDecomposeNextResource() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + msoLogger.info("Exited " + method) + } + /** + * prepare post Unkown Resource Type + */ + public void postOtherControllerType(DelegateExecution execution){ + def method = getClass().getSimpleName() + '.postOtherControllerType(' +'execution=' + execution.getId() +')' + def isDebugEnabled = execution.getVariable("isDebugEnabled") + msoLogger.info("Entered " + method) + + try{ + + String resourceName = execution.getVariable(Prefix+"resourceName") + String resourceType = execution.getVariable(Prefix+"resourceType") + String controllerType = execution.getVariable("controllerType") + + String msg = "Resource name: "+ resourceName + " resource Type: " + resourceType+ " controller Type: " + controllerType + " can not be processed n the workflow" + msoLogger.debug(msg) + + }catch(Exception e){ + // try error in method block + String exceptionMessage = "Bpmn error encountered in DoCreateMobileAPNServiceInstance flow. Unexpected Error from method postOtherControllerType() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + msoLogger.info("Exited " + method) + } + + /** + * prepare delete parameters + */ + public void preSDNCResourceDelete(execution, resourceName){ + // we use resource instance ids for delete flow as resourceTemplateUUIDs + + def method = getClass().getSimpleName() + '.preSDNCResourceDelete(' +'execution=' + execution.getId() +')' + msoLogger.info("Entered " + method) + + msoLogger.trace("STARTED preSDNCResourceDelete Process ") + String networkResources = execution.getVariable("networkResources") + + + execution.setVariable("foundResource", false) + if (networkResources != null) { + def jsonSlurper = new JsonSlurper() + List relationShipList = jsonSlurper.parseText(networkResources) + relationShipList.each { + if(StringUtils.containsIgnoreCase(it.resourceType, resourceName)) { + String resourceInstanceUUID = it.resourceInstanceId + String resourceTemplateUUID = it.resourceInstanceId + execution.setVariable("resourceTemplateId", resourceTemplateUUID) + execution.setVariable("resourceInstanceId", resourceInstanceUUID) + execution.setVariable("resourceType", resourceName) + execution.setVariable("foundResource", true) + msoLogger.info("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName) + } + } + } + msoLogger.info("Exited " + method) + } + public void preProcessSDNCDelete (DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessSDNCDelete(' +'execution=' + execution.getId() +')' + msoLogger.info("Entered " + method) + msoLogger.trace("preProcessSDNCDelete ") + String msg = "" + + try { + def serviceInstanceId = execution.getVariable("serviceInstanceId") + def serviceInstanceName = execution.getVariable("serviceInstanceName") + def callbackURL = execution.getVariable("sdncCallbackUrl") + def requestId = execution.getVariable("msoRequestId") + def serviceId = execution.getVariable("productFamilyId") + def subscriptionServiceType = execution.getVariable("subscriptionServiceType") + def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + + String serviceModelInfo = execution.getVariable("serviceModelInfo") + def modelInvariantUuid = "" + def modelVersion = "" + def modelUuid = "" + def modelName = "" + if (!isBlank(serviceModelInfo)) + { + modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") + modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") + modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid") + modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") + + if (modelInvariantUuid == null) { + modelInvariantUuid = "" + } + if (modelVersion == null) { + modelVersion = "" + } + if (modelUuid == null) { + modelUuid = "" + } + if (modelName == null) { + modelName = "" + } + } + if (serviceInstanceName == null) { + serviceInstanceName = "" + } + if (serviceId == null) { + serviceId = "" + } + + def siParamsXml = execution.getVariable("siParamsXml") + def serviceType = execution.getVariable("serviceType") + if (serviceType == null) + { + serviceType = "" + } + + def sdncRequestId = UUID.randomUUID().toString() + + String sdncDelete = + """ + + ${MsoUtils.xmlEscape(sdncRequestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + delete + service-topology-operation + ${MsoUtils.xmlEscape(callbackURL)} + ${MsoUtils.xmlEscape(serviceType)} + + + + ${MsoUtils.xmlEscape(requestId)} + MSO + + + + DeleteServiceInstance + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(subscriptionServiceType)} + + ${MsoUtils.xmlEscape(modelInvariantUuid)} + ${MsoUtils.xmlEscape(modelUuid)} + ${MsoUtils.xmlEscape(modelVersion)} + ${MsoUtils.xmlEscape(modelName)} + + ${MsoUtils.xmlEscape(serviceInstanceId)} + + ${MsoUtils.xmlEscape(globalSubscriberId)} + + + ${MsoUtils.xmlEscape(serviceInstanceName)} + ${siParamsXml} + + + """ + + sdncDelete = utils.formatXml(sdncDelete) + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + execution.setVariable("sdncDelete", sdncDelete) + execution.setVariable("sdncDeactivate", sdncDeactivate) + msoLogger.info("sdncDeactivate:\n" + sdncDeactivate) + msoLogger.info("sdncDelete:\n" + sdncDelete) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage()) + } + msoLogger.info("Exited " + method) + } + + public void postProcessSDNCDelete(DelegateExecution execution, String response, String action) { + + def method = getClass().getSimpleName() + '.postProcessSDNCDelete(' +'execution=' + execution.getId() +')' + msoLogger.info("Entered " + method) + msoLogger.trace("postProcessSDNC " + action + " ") + String msg = "" + + /*try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + msoLogger.info("SDNCResponse: " + response) + msoLogger.info("workflowException: " + workflowException) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == "true"){ + msoLogger.info("Good response from SDNC Adapter for service-instance " + action + "response:\n" + response) + + }else{ + msg = "Bad Response from SDNC Adapter for service-instance " + action + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg) + } + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in postProcessSDNC " + action + " Exception:" + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + }*/ + msoLogger.info("Exited " + method) + } + + /** + * Init the service Operation Status + */ + public void preUpdateServiceOperationStatus(DelegateExecution execution){ + def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')' + msoLogger.info("Entered " + method) + + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String serviceName = execution.getVariable("serviceInstanceName") + String operationType = "DELETE" + String userId = "" + String result = "processing" + String progress = execution.getVariable("progress") + msoLogger.info("progress: " + progress ) + if ("100".equalsIgnoreCase(progress)) + { + result = "finished" + } + String reason = "" + String operationContent = "Prepare service delete: " + execution.getVariable("operationStatus") + msoLogger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) + + execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + String payload = + """ + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(operationId)} + ${MsoUtils.xmlEscape(serviceName)} + ${MsoUtils.xmlEscape(operationType)} + ${MsoUtils.xmlEscape(userId)} + ${MsoUtils.xmlEscape(result)} + ${MsoUtils.xmlEscape(operationContent)} + ${MsoUtils.xmlEscape(progress)} + ${MsoUtils.xmlEscape(reason)} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) + msoLogger.info("Outgoing preUpdateServiceOperationStatus: \n" + payload) + + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preUpdateServiceOperationStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preUpdateServiceOperationStatus Process ") + msoLogger.info("Exited " + method) + } + + public void preInitResourcesOperStatus(DelegateExecution execution){ + def method = getClass().getSimpleName() + '.preInitResourcesOperStatus(' +'execution=' + execution.getId() +')' + msoLogger.info("Entered " + method) + + msoLogger.trace("STARTED preInitResourcesOperStatus Process ") + String msg="" + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = "DELETE" + String resourceTemplateUUIDs = "" + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service delete" + msoLogger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + + String serviceRelationShip = execution.getVariable("serviceRelationShip") + msoLogger.info("serviceRelationShip: " + serviceRelationShip) + if (! isBlank(serviceRelationShip)) { + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + List relationShipList = jsonSlurper.parseText(serviceRelationShip) + + if (relationShipList != null) { + relationShipList.each { + resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":" + } + } + } + def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) + + String payload = + """ + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(operationId)} + ${MsoUtils.xmlEscape(operationType)} + ${MsoUtils.xmlEscape(resourceTemplateUUIDs)} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_initResOperStatusRequest", payload) + msoLogger.info("Outgoing initResourceOperationStatus: \n" + payload) + msoLogger.debug("DoCustomDeleteE2EServiceInstanceV2 Outgoing initResourceOperationStatus Request: " + payload) + + }catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoCustomDeleteE2EServiceInstanceV2.preInitResourcesOperStatus. " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.info("Exited " + method) + } + + + + /** + * prepare delete parameters + */ + public void preProcessVFCResourceDelete(execution){ + // we use resource instance ids for delete flow as resourceTemplateUUIDs + + def method = getClass().getSimpleName() + '.preProcessVFCResourceDelete(' +'execution=' + execution.getId() +')' + msoLogger.info("Entered " + method) + + msoLogger.trace("STARTED preProcessVFCResourceDelete Process ") + try{ + String serviceResource = execution.getVariable("serviceResource") + msoLogger.info("serviceResource : " + serviceResource) + + String resourceInstanceId = execution.getVariable("resourceInstanceId") + msoLogger.info("resourceInstanceId : " + resourceInstanceId) + + execution.setVariable("resourceTemplateId", resourceInstanceId) + msoLogger.info("resourceTemplateId : " + resourceInstanceId) + + String resourceType = execution.getVariable("resourceType") + msoLogger.info("resourceType : " + resourceType) + + + String resourceName = execution.getVariable(Prefix+"resourceName") + if (isBlank(resourceName)){ + resourceName = resourceInstanceId + } + execution.setVariable("resourceName", resourceName) + msoLogger.info("resource Name : " + resourceName) + + msoLogger.info("Delete Resource Info: resourceInstanceId :" + resourceInstanceId + " resourceTemplateId: " + resourceInstanceId + " resourceType: " + resourceType) + }catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoDeleteE2EServiceInstance.preProcessVFCResourceDelete. " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.info("Exited " + method) + } + + public void postProcessVFCDelete(DelegateExecution execution, String response, String action) { + def method = getClass().getSimpleName() + '.postProcessVFCDelete(' +'execution=' + execution.getId() +')' + msoLogger.info("Entered " + method) + + msoLogger.trace("STARTED postProcessVFCDelete Process ") + try{ + + }catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoDeleteE2EServiceInstance.postProcessVFCDelete. " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.info("Exited " + method) + } +} + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy new file mode 100644 index 0000000000..54dfae3760 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -0,0 +1,439 @@ +/*- + * ============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.bpmn.infrastructure.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray +import org.json.JSONObject; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.domain.ServiceDecomposition; +import org.onap.so.bpmn.core.json.JsonUtils +import org.springframework.web.util.UriUtils; +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource + +import groovy.json.* + +/** + * This groovy class supports the DoDeleteE2EServiceInstance.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId - O + * @param - subscriptionServiceType - O + * @param - serviceInstanceId + * @param - serviceInstanceName - O + * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) + * @param - sdncVersion + * @param - failNotFound - TODO + * @param - serviceInputParams - TODO + * + * @param - delResourceList + * @param - serviceRelationShip + * + * Outputs: + * @param - WorkflowException + * + * Rollback - Deferred + */ +public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { + + String Prefix="DDEESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled) + String msg = "" + + try { + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("prefix",Prefix) + + //Inputs + //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology + String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + if (globalSubscriberId == null) + { + execution.setVariable("globalSubscriberId", "") + } + + //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology + String serviceType = execution.getVariable("serviceType") + if (serviceType == null) + { + execution.setVariable("serviceType", "") + } + + //Generated in parent for AAI PUT + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)){ + msg = "Input serviceInstanceId is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') + if (isBlank(sdncCallbackUrl)) { + msg = "URN_mso_workflow_sdncadapter_callback is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) + + StringBuilder sbParams = new StringBuilder() + Map paramsMap = execution.getVariable("serviceInputParams") + if (paramsMap != null) + { + sbParams.append("") + for (Map.Entry entry : paramsMap.entrySet()) { + String paramsXml + String paramName = entry.getKey() + String paramValue = entry.getValue() + paramsXml = + """ + ${MsoUtils.xmlEscape(paramName)} + ${MsoUtils.xmlEscape(paramValue)} + + """ + sbParams.append(paramsXml) + } + sbParams.append("") + } + String siParamsXml = sbParams.toString() + if (siParamsXml == null) + siParamsXml = "" + execution.setVariable("siParamsXml", siParamsXml) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void postProcessAAIGET(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) + String msg = "" + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + String serviceType = "" + + if(foundInAAI){ + utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) + + String siData = execution.getVariable("GENGS_service") + utils.log("INFO", "SI Data", isDebugEnabled) + if (isBlank(siData)) + { + msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + else + { + InputSource source = new InputSource(new StringReader(siData)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document serviceXml = docBuilder.parse(source) + serviceXml.getDocumentElement().normalize() + // get model invariant id + // Get Template uuid and version + if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) { + utils.log("INFO", "SI Data model-invariant-id and model-version-id exist:", isDebugEnabled) + def modelInvariantId = serviceXml.getElementsByTagName("model-invariant-id").item(0).getTextContent() + def modelVersionId = serviceXml.getElementsByTagName("model-version-id").item(0).getTextContent() + + // Set Original Template info + execution.setVariable("model-invariant-id-original", modelInvariantId) + execution.setVariable("model-version-id-original", modelVersionId) + } + + utils.log("INFO", "SI Data" + siData, isDebugEnabled) + //Confirm there are no related service instances (vnf/network or volume) + if (utils.nodeExists(siData, "relationship-list")) { + utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled) + //test(siData) + NodeList nodeList = serviceXml.getElementsByTagName("relationship") + JSONArray jArray = new JSONArray() + for (int x = 0; x < nodeList.getLength(); x++) { + Node node = nodeList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() //for ns + if(e.equals("service-instance")){ + def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent() + utils.log("INFO", "ServiceInstance Related NS :" + relatedObject, isDebugEnabled) + NodeList dataList = node.getChildNodes() + if(null != dataList) { + JSONObject jObj = new JSONObject() + for (int i = 0; i < dataList.getLength(); i++) { + Node dNode = dataList.item(i) + if(dNode.getNodeName() == "relationship-data") { + Element rDataEle = (Element)dNode + def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent() + def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent() + if(eKey.equals("service-instance.service-instance-id")){ + jObj.put("resourceInstanceId", eValue) + } + + } + else if(dNode.getNodeName() == "related-to-property"){ + Element rDataEle = (Element)dNode + def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent() + def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent() + if(eKey.equals("service-instance.service-instance-name")){ + jObj.put("resourceType", eValue) + } + } + } + utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) + jArray.put(jObj) + } + //for overlay/underlay + }else if (e.equals("configuration")){ + def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent() + utils.log("INFO", "ServiceInstance Related Configuration :" + relatedObject, isDebugEnabled) + NodeList dataList = node.getChildNodes() + if(null != dataList) { + JSONObject jObj = new JSONObject() + for (int i = 0; i < dataList.getLength(); i++) { + Node dNode = dataList.item(i) + if(dNode.getNodeName() == "relationship-data") { + Element rDataEle = (Element)dNode + def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent() + def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent() + if(eKey.equals("configuration.configuration-id")){ + jObj.put("resourceInstanceId", eValue) + } + } + else if(dNode.getNodeName() == "related-to-property"){ + Element rDataEle = (Element)dNode + def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent() + def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent() + if(eKey.equals("configuration.configuration-type")){ + jObj.put("resourceType", eValue) + } + } + } + utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) + jArray.put(jObj) + } + } + } + } + execution.setVariable("serviceRelationShip", jArray.toString()) + } + } + }else{ + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(!succInAAI){ + utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + + utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) + } + }catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) + } + + public void getCurrentNS(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", "======== Start getCurrentNS Process ======== ", isDebugEnabled) + + def currentIndex = execution.getVariable("currentNSIndex") + List nsSequence = execution.getVariable("nsSequence") + String nsResourceType = nsSequence.get(currentIndex) + + // GET AAI by Name, not ID, for process convenient + execution.setVariable("GENGS_type", "service-instance") + execution.setVariable("GENGS_serviceInstanceId", "") + execution.setVariable("GENGS_serviceInstanceName", nsResourceType) + + utils.log("INFO", "======== COMPLETED getCurrentNS Process ======== ", isDebugEnabled) + } + + public void prepareDecomposeService(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled) + String modelInvariantUuid = execution.getVariable("model-invariant-id-original") + String modelVersionId = execution.getVariable("model-version-id-original") + + String serviceModelInfo = """{ + "modelInvariantUuid":"${modelInvariantUuid}", + "modelUuid":"${modelVersionId}", + "modelVersion":"" + }""" + execution.setVariable("serviceModelInfo", serviceModelInfo) + + utils.log("DEBUG", " ***** Completed prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void postDecomposeService(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + utils.log("DEBUG", " ***** Inside processDecomposition() of delete generic e2e service flow ***** ", isDebugEnabled) + try { + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + // service model info + execution.setVariable("serviceModelInfo", serviceDecomposition.getModelInfo()) + + List deleteResourceList = serviceDecomposition.getServiceResources() + String serviceRelationShip = execution.getVariable("serviceRelationShip") + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + List relationShipList = null + if (serviceRelationShip != null) { + relationShipList = jsonSlurper.parseText(serviceRelationShip) + } + + //Set the real resource instance id to the decomosed resource list + for (Resource resource: deleteResourceList) { + //reset the resource instance id , because in the decompose flow ,its a random one. + resource.setResourceId(""); + //match the resource-instance-name and the model name + if (relationShipList != null) { + relationShipList.each { + if (StringUtils.containsIgnoreCase(it.resourceType, resource.getModelInfo().getModelName())) { + resource.setResourceId(it.resourceInstanceId); + } + } + } + } + execution.setVariable("deleteResourceList", deleteResourceList) + utils.log("DEBUG", "delete resource list : " + deleteResourceList, isDebugEnabled) + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + utils.log("DEBUG", " ***** exit processDecomposition() of delete generic e2e service flow ***** ", isDebugEnabled) + } + + public void preInitResourcesOperStatus(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + + utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = execution.getVariable("operationType") + String resourceTemplateUUIDs = "" + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service creation" + utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + List deleteResourceList = execution.getVariable("deleteResourceList") + + String serviceRelationShip = execution.getVariable("serviceRelationShip") + for(Resource resource : deleteResourceList){ + resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" + } + + + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + String payload = + """ + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(operationId)} + ${MsoUtils.xmlEscape(operationType)} + ${MsoUtils.xmlEscape(resourceTemplateUUIDs)} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_initResOperStatusRequest", payload) + utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled) + utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) + } + utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + } + + /** + * post config request. + */ + public void postConfigRequest(execution){ + //to do + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy new file mode 100644 index 0000000000..3ee059cb02 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy @@ -0,0 +1,1077 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.NetworkUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +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.springframework.web.util.UriUtils + +import groovy.json.* + +public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteNetworkInstance.class); + + String Prefix= "DELNWKI_" + String groovyClassName = "DoDeleteNetworkInstance" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + NetworkUtils networkUtils = new NetworkUtils() + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + public InitializeProcessVariables(DelegateExecution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable(Prefix + "networkRequest", "") + execution.setVariable(Prefix + "isSilentSuccess", false) + execution.setVariable(Prefix + "Success", false) + + execution.setVariable(Prefix + "requestId", "") + execution.setVariable(Prefix + "source", "") + execution.setVariable(Prefix + "lcpCloudRegion", "") + execution.setVariable(Prefix + "networkInputs", "") + execution.setVariable(Prefix + "tenantId", "") + + execution.setVariable(Prefix + "queryAAIRequest","") + execution.setVariable(Prefix + "queryAAIResponse", "") + execution.setVariable(Prefix + "aaiReturnCode", "") + execution.setVariable(Prefix + "isAAIGood", false) + execution.setVariable(Prefix + "isVfRelationshipExist", false) + + // AAI query Cloud Region + execution.setVariable(Prefix + "queryCloudRegionRequest","") + execution.setVariable(Prefix + "queryCloudRegionReturnCode","") + execution.setVariable(Prefix + "queryCloudRegionResponse","") + execution.setVariable(Prefix + "cloudRegionPo","") + execution.setVariable(Prefix + "cloudRegionSdnc","") + + execution.setVariable(Prefix + "deleteNetworkRequest", "") + execution.setVariable(Prefix + "deleteNetworkResponse", "") + execution.setVariable(Prefix + "networkReturnCode", "") + execution.setVariable(Prefix + "rollbackNetworkRequest", "") + + execution.setVariable(Prefix + "deleteSDNCRequest", "") + execution.setVariable(Prefix + "deleteSDNCResponse", "") + execution.setVariable(Prefix + "sdncReturnCode", "") + execution.setVariable(Prefix + "sdncResponseSuccess", false) + + execution.setVariable(Prefix + "deactivateSDNCRequest", "") + execution.setVariable(Prefix + "deactivateSDNCResponse", "") + execution.setVariable(Prefix + "deactivateSdncReturnCode", "") + execution.setVariable(Prefix + "isSdncDeactivateRollbackNeeded", "") + + execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", "") + execution.setVariable(Prefix + "isException", false) + + + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + + public void preProcessRequest (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside preProcessRequest() of " + groovyClassName + " Request ") + + // initialize flow variables + InitializeProcessVariables(execution) + + try { + // get incoming message/input + execution.setVariable("action", "DELETE") + String deleteNetwork = execution.getVariable("bpmnRequest") + if (deleteNetwork != null) { + if (deleteNetwork.contains("requestDetails")) { + // JSON format request is sent, create xml + try { + def prettyJson = JsonOutput.prettyPrint(deleteNetwork.toString()) + msoLogger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson) + deleteNetwork = vidUtils.createXmlNetworkRequestInfra(execution, deleteNetwork) + + } catch (Exception ex) { + String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + } else { + // XML format request is sent + + } + } else { + // vIPR format request is sent, create xml from individual variables + deleteNetwork = vidUtils.createXmlNetworkRequestInstance(execution) + } + + deleteNetwork = utils.formatXml(deleteNetwork) + msoLogger.debug(deleteNetwork) + execution.setVariable(Prefix + "networkRequest", deleteNetwork) + msoLogger.debug(Prefix + "networkRequest - " + '\n' + deleteNetwork) + + // validate 'backout-on-failure' to override 'mso.rollback' + boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, deleteNetwork) + execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled) + msoLogger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled) + + String networkInputs = utils.getNodeXml(deleteNetwork, "network-inputs", false).replace("tag0:","").replace(":tag0","") + execution.setVariable(Prefix + "networkInputs", networkInputs) + + // prepare messageId + String messageId = execution.getVariable("testMessageId") // for testing + if (messageId == null || messageId == "") { + messageId = UUID.randomUUID() + msoLogger.debug(Prefix + "messageId, random generated: " + messageId) + } else { + msoLogger.debug(Prefix + "messageId, pre-assigned: " + messageId) + } + execution.setVariable(Prefix + "messageId", messageId) + + String source = utils.getNodeText(deleteNetwork, "source") + execution.setVariable(Prefix + "source", source) + msoLogger.debug(Prefix + "source - " + source) + + String networkId = "" + if (utils.nodeExists(networkInputs, "network-id")) { + networkId = utils.getNodeText(networkInputs, "network-id") + if (networkId == null || networkId == "" || networkId == 'null' ) { + sendSyncError(execution) + // missing value of network-id + String dataErrorMessage = "network-request has missing 'network-id' element/value." + msoLogger.debug(" Invalid Request - " + dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + } + + // lcpCloudRegion or tenantId not sent, will be extracted from query AA&I + def lcpCloudRegion = null + if (utils.nodeExists(networkInputs, "aic-cloud-region")) { + lcpCloudRegion = utils.getNodeText(networkInputs, "aic-cloud-region") + if (lcpCloudRegion == 'null') { + lcpCloudRegion = null + } + } + execution.setVariable(Prefix + "lcpCloudRegion", lcpCloudRegion) + msoLogger.debug("lcpCloudRegion : " + lcpCloudRegion) + + String tenantId = null + if (utils.nodeExists(networkInputs, "tenant-id")) { + tenantId = utils.getNodeText(networkInputs, "tenant-id") + if (tenantId == 'null') { + tenantId = null + } + + } + execution.setVariable(Prefix + "tenantId", tenantId) + msoLogger.debug("tenantId : " + tenantId) + + String sdncVersion = execution.getVariable("sdncVersion") + msoLogger.debug("sdncVersion? : " + sdncVersion) + + // PO Authorization Info / headers Authorization= + String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) + + try { + def encodedString = utils.getBasicAuth(basicAuthValuePO, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable("BasicAuthHeaderValuePO",encodedString) + execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) + + } catch (IOException ex) { + String dataErrorMessage = " Unable to encode PO/SDNC user/password string - " + ex.getMessage() + msoLogger.debug(dataErrorMessage ) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex){ + // caught exception + String exceptionMessage = "Exception Encountered in DoDeleteNetworkInstance, PreProcessRequest() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + public void callRESTQueryAAI (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.debug(" ***** Inside callRESTQueryAAI() of DoDoDeleteNetworkInstance ***** " ) + + // get variables + String networkInputs = execution.getVariable(Prefix + "networkInputs") + String networkId = utils.getNodeText(networkInputs, "network-id") + networkId = UriUtils.encode(networkId,"UTF-8") + + // Prepare AA&I url + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String queryAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" + msoLogger.debug(queryAAIRequest) + execution.setVariable(Prefix + "queryAAIRequest", queryAAIRequest) + msoLogger.debug(Prefix + "AAIRequest - " + "\n" + queryAAIRequest) + + RESTConfig config = new RESTConfig(queryAAIRequest); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + Boolean isVfRelationshipExist = false + try { + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryAAIRequest) + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiReturnCode", returnCode) + + msoLogger.debug(" ***** AAI Response Code : " + returnCode) + + String aaiResponseAsString = response.getResponseBodyAsString() + execution.setVariable(Prefix + "queryAAIResponse", aaiResponseAsString) + + if (returnCode=='200' || returnCode=='204') { + msoLogger.debug(aaiResponseAsString) + execution.setVariable(Prefix + "isAAIGood", true) + msoLogger.debug(" AAI Query Success REST Response - " + "\n" + aaiResponseAsString) + // verify if vf or vnf relationship exist + if (utils.nodeExists(aaiResponseAsString, "relationship")) { + NetworkUtils networkUtils = new NetworkUtils() + isVfRelationshipExist = networkUtils.isVfRelationshipExist(aaiResponseAsString) + execution.setVariable(Prefix + "isVfRelationshipExist", isVfRelationshipExist) + if (isVfRelationshipExist == true) { + String relationshipMessage = "AAI Query Success Response but 'vf-module' relationship exist, not allowed to delete: network Id: " + networkId + exceptionUtil.buildWorkflowException(execution, 2500, relationshipMessage) + + } else { + // verify if lcpCloudRegion was sent as input, if not get value from AAI Response + if (execution.getVariable(Prefix + "lcpCloudRegion") == null ) { + String lcpCloudRegion = networkUtils.getCloudRegion(aaiResponseAsString) + execution.setVariable(Prefix + "lcpCloudRegion", lcpCloudRegion) + msoLogger.debug(" Get AAI getCloudRegion() : " + lcpCloudRegion) + } + if (execution.getVariable(Prefix + "tenantId") == null ) { + String tenantId = networkUtils.getTenantId(aaiResponseAsString) + execution.setVariable(Prefix + "tenantId", tenantId) + msoLogger.debug(" Get AAI getTenantId() : " + tenantId) + } + + } + } + msoLogger.debug(Prefix + "isVfRelationshipExist - " + isVfRelationshipExist) + + } else { + execution.setVariable(Prefix + "isAAIGood", false) + if (returnCode=='404' || aaiResponseAsString == "" || aaiResponseAsString == null) { + // not found // empty aai response + execution.setVariable(Prefix + "isSilentSuccess", true) + msoLogger.debug(" AAI Query is Silent Success") + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Error Response from callRESTQueryAAI() - " + returnCode + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + msoLogger.debug(" AAI Query call, isAAIGood? : " + execution.getVariable(Prefix + "isAAIGood")) + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Exception Encountered in DoDeleteNetworkInstance, callRESTQueryAAI() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAICloudRegion (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.debug(" ***** Inside callRESTQueryAAICloudRegion of DoDeleteNetworkInstance ***** " ) + + try { + String networkInputs = execution.getVariable(Prefix + "networkInputs") + // String cloudRegion = utils.getNodeText(networkInputs, "aic-cloud-region") + String cloudRegion = execution.getVariable(Prefix + "lcpCloudRegion") + cloudRegion = UriUtils.encode(cloudRegion,"UTF-8") + // Prepare AA&I url + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUtil = new AaiUtil(this) + String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) + String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion + msoLogger.debug(queryCloudRegionRequest) + execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest) + msoLogger.debug(Prefix + "queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest) + + String cloudRegionPo = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) + String cloudRegionSdnc = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "SDNC", cloudRegion) + + if ((cloudRegionPo != "ERROR") && (cloudRegionSdnc != "ERROR")) { + execution.setVariable(Prefix + "cloudRegionPo", cloudRegionPo) + execution.setVariable(Prefix + "cloudRegionSdnc", cloudRegionSdnc) + + } else { + String dataErrorMessage = "QueryAAICloudRegion Unsuccessful. Return Code: " + execution.getVariable(Prefix + "queryCloudRegionReturnCode") + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, callRESTQueryAAICloudRegion(). Unexpected Response from AAI - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareNetworkRequest (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside prepareNetworkRequest of DoDeleteNetworkInstance ") + ExceptionUtil exceptionUtil = new ExceptionUtil() + try { + // get variables + String networkRequest = execution.getVariable(Prefix + "networkRequest") + String cloudSiteId = execution.getVariable(Prefix + "cloudRegionPo") + String tenantId = execution.getVariable(Prefix + "tenantId") + + String queryAAIResponse = execution.getVariable(Prefix + "queryAAIResponse") + String networkType = utils.getNodeText(queryAAIResponse, "network-type") + String networkId = utils.getNodeText(queryAAIResponse, "network-id") + String backoutOnFailure = execution.getVariable(Prefix + "rollbackEnabled") + + String networkStackId = "" + networkStackId = utils.getNodeText(queryAAIResponse, "heat-stack-id") + if (networkStackId == 'null' || networkStackId == "" || networkStackId == null) { + networkStackId = "force_delete" + } + + String requestId = execution.getVariable("msoRequestId") + if (requestId != null) { + execution.setVariable("mso-request-id", requestId) + } else { + requestId = execution.getVariable("mso-request-id") + } + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + // Added new Elements + String messageId = execution.getVariable(Prefix + "messageId") + String notificationUrl = "" //TODO - is this coming from URN? What variable/value to use? + //String notificationUrl = execution.getVariable("URN_?????") //TODO - is this coming from URN? What variable/value to use? + + String modelCustomizationUuid = "" + if (utils.nodeExists(networkRequest, "networkModelInfo")) { + String networkModelInfo = utils.getNodeXml(networkRequest, "networkModelInfo", false).replace("tag0:","").replace(":tag0","") + modelCustomizationUuid = utils.getNodeText(networkModelInfo, "modelCustomizationUuid") + } else { + modelCustomizationUuid = utils.getNodeText(networkRequest, "modelCustomizationId") + } + + String deleteNetworkRequest = """ + + ${MsoUtils.xmlEscape(cloudSiteId)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(networkId)} + ${MsoUtils.xmlEscape(networkStackId)} + ${MsoUtils.xmlEscape(networkType)} + ${MsoUtils.xmlEscape(modelCustomizationUuid)} + true + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + + ${MsoUtils.xmlEscape(messageId)} + ${MsoUtils.xmlEscape(notificationUrl)} + + """.trim() + + msoLogger.debug(Prefix + "deleteNetworkRequest - " + "\n" + deleteNetworkRequest) + // Format Response + String buildDeleteNetworkRequestAsString = utils.formatXml(deleteNetworkRequest) + msoLogger.debug(buildDeleteNetworkRequestAsString) + msoLogger.debug(Prefix + "deleteNetworkRequestAsString - " + "\n" + buildDeleteNetworkRequestAsString) + + String restURL = UrnPropertiesReader.getVariable("mso.adapters.network.rest.endpoint", execution) + execution.setVariable("mso.adapters.network.rest.endpoint", restURL + "/" + networkId) + msoLogger.debug("mso.adapters.network.rest.endpoint - " + "\n" + restURL + "/" + networkId) + + execution.setVariable(Prefix + "deleteNetworkRequest", buildDeleteNetworkRequestAsString) + msoLogger.debug(Prefix + "deleteNetworkRequest - " + "\n" + buildDeleteNetworkRequestAsString) + } + catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareNetworkRequest(). Unexpected Response from AAI - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + } + + /** + * This method is used instead of an HTTP Connector task because the + * connector does not allow DELETE with a body. + */ + public void sendRequestToVnfAdapter(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + + String vnfAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.network.rest.endpoint",execution) + String vnfAdapterRequest = execution.getVariable(Prefix + "deleteNetworkRequest") + + RESTConfig config = new RESTConfig(vnfAdapterUrl) + RESTClient client = new RESTClient(config). + addHeader("Content-Type", "application/xml"). + addAuthorizationHeader(execution.getVariable("BasicAuthHeaderValuePO")); + + APIResponse response; + + response = client.httpDelete(vnfAdapterRequest) + + execution.setVariable(Prefix + "networkReturnCode", response.getStatusCode()) + execution.setVariable(Prefix + "deleteNetworkResponse", response.getResponseBodyAsString()) + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, sendRequestToVnfAdapter() - " + ex.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, exceptionMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + } + + + public void prepareSDNCRequest (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside prepareSDNCRequest of DoDeleteNetworkInstance ") + + try { + // get variables + String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") + + String networkId = "" + if (utils.nodeExists(deleteNetworkInput, "network-id")) { + networkId = utils.getNodeText(deleteNetworkInput, "network-id") + } + if (networkId == 'null') {networkId = ""} + + String serviceInstanceId = utils.getNodeText(deleteNetworkInput, "service-instance-id") + + // get/set 'msoRequestId' and 'mso-request-id' + String requestId = execution.getVariable("msoRequestId") + if (requestId != null) { + execution.setVariable("mso-request-id", requestId) + } else { + requestId = execution.getVariable("mso-request-id") + } + execution.setVariable(Prefix + "requestId", requestId) + msoLogger.debug(Prefix + "requestId " + requestId) + String queryAAIResponse = execution.getVariable(Prefix + "queryAAIResponse") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + // 1. prepare delete topology via SDNC Adapter SUBFLOW call + String sndcTopologyDeleteRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "delete", "DisconnectNetworkRequest", cloudRegionId, networkId, queryAAIResponse, null) + String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) + msoLogger.debug(sndcTopologyDeleteRequesAsString) + execution.setVariable(Prefix + "deleteSDNCRequest", sndcTopologyDeleteRequesAsString) + msoLogger.debug(Prefix + "deleteSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString) + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, exceptionMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRpcSDNCRequest (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside prepareRpcSDNCRequest of DoDeleteNetworkInstance ") + + try { + // get variables + String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") + + String networkId = "" + if (utils.nodeExists(deleteNetworkInput, "network-id")) { + networkId = utils.getNodeText(deleteNetworkInput, "network-id") + } + if (networkId == 'null') {networkId = ""} + + String serviceInstanceId = utils.getNodeText(deleteNetworkInput, "service-instance-id") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + // 1. prepare delete topology via SDNC Adapter SUBFLOW call + String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "unassign", "DeleteNetworkInstance", cloudRegionId, networkId, null) + String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) + msoLogger.debug(sndcTopologyDeleteRequesAsString) + execution.setVariable(Prefix + "deleteSDNCRequest", sndcTopologyDeleteRequesAsString) + msoLogger.debug(Prefix + "deleteSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString) + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, exceptionMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + public void prepareRpcSDNCDeactivate(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareRpcSDNCDeactivate() of DoDeleteNetworkInstance ") + + try { + + // get variables + String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + String networkId = "" + if (utils.nodeExists(deleteNetworkInput, "network-id")) { + networkId = utils.getNodeText(deleteNetworkInput, "network-id") + } + if (networkId == 'null') {networkId = ""} + String serviceInstanceId = utils.getNodeText(deleteNetworkInput, "service-instance-id") + + String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "deactivate", "DeleteNetworkInstance", cloudRegionId, networkId, null) + String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) + execution.setVariable(Prefix + "deactivateSDNCRequest", sndcTopologyRollbackRpcRequestAsString) + msoLogger.debug(" Preparing request for RPC SDNC Topology deactivate - " + "\n" + sndcTopologyRollbackRpcRequestAsString) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRpcSDNCActivateRollback() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + // ************************************************** + // Post or Validate Response Section + // ************************************************** + + public void validateNetworkResponse (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside validateNetworkResponse of DoDeleteNetworkInstance ") + + try { + String returnCode = execution.getVariable(Prefix + "networkReturnCode") + String networkResponse = execution.getVariable(Prefix + "deleteNetworkResponse") + + msoLogger.debug(" Network Adapter responseCode: " + returnCode) + msoLogger.debug("Network Adapter Response - " + "\n" + networkResponse) + msoLogger.debug(networkResponse) + + String errorMessage = "" + if (returnCode == "200") { + msoLogger.debug(" Network Adapter Response is successful - " + "\n" + networkResponse) + + // prepare rollback data + String rollbackData = utils.getNodeXml(networkResponse, "rollback", false).replace("tag0:","").replace(":tag0","") + if ((rollbackData == null) || (rollbackData.isEmpty())) { + msoLogger.debug(" Network Adapter 'rollback' data is not Sent: " + "\n" + networkResponse) + execution.setVariable(Prefix + "rollbackNetworkRequest", "") + } else { + String rollbackNetwork = + """ + ${rollbackData} + """ + String rollbackNetworkXml = utils.formatXml(rollbackNetwork) + execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkXml) + msoLogger.debug(" Network Adapter rollback data - " + "\n" + rollbackNetworkXml) + } + + + } else { // network error + if (returnCode.toInteger() > 399 && returnCode.toInteger() < 600) { //4xx, 5xx + if (networkResponse.contains("deleteNetworkError") ) { + networkResponse = networkResponse.replace('', '') + errorMessage = utils.getNodeText(networkResponse, "message") + errorMessage = "Received error from Network Adapter: " + errorMessage + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) + + } else { // CatchAll exception + if (returnCode == "500") { + errorMessage = "JBWEB000065: HTTP Status 500." + } else { + errorMessage = "Return code is " + returnCode + } + errorMessage = "Received error from Network Adapter: " + errorMessage + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) + + } + + } else { // CatchAll exception + String dataErrorMessage = "Received error from Network Adapter. Return code is: " + returnCode + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, validateNetworkResponse() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void validateSDNCResponse (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside validateSDNCResponse of DoDeleteNetworkInstance ") + + String response = execution.getVariable(Prefix + "deleteSDNCResponse") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + WorkflowException workflowException = execution.getVariable("WorkflowException") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + // reset variable + String deleteSDNCResponseDecodeXml = execution.getVariable(Prefix + "deleteSDNCResponse") + deleteSDNCResponseDecodeXml = deleteSDNCResponseDecodeXml.replace('', "") + execution.setVariable(Prefix + "deleteSDNCResponse", deleteSDNCResponseDecodeXml) + + if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, prefix+'sdncResponseSuccess' + execution.setVariable(Prefix + "isSdncRollbackNeeded", true) // + execution.setVariable(Prefix + "isPONR", true) + msoLogger.debug("Successfully Validated SDNC Response") + } else { + msoLogger.debug("Did NOT Successfully Validated SDNC Response") + throw new BpmnError("MSOWorkflowException") + } + + } + + public void validateRpcSDNCDeactivateResponse (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside validateRpcSDNCDeactivateResponse() of DoDeleteNetworkInstance ") + + String response = execution.getVariable(Prefix + "deactivateSDNCResponse") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + WorkflowException workflowException = execution.getVariable("WorkflowException") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + // reset variable + String assignSDNCResponseDecodeXml = execution.getVariable(Prefix + "deactivateSDNCResponse") + assignSDNCResponseDecodeXml = assignSDNCResponseDecodeXml.replace('', "") + execution.setVariable(Prefix + "deactivateSDNCResponse", assignSDNCResponseDecodeXml) + + if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, Prefix+'sdncResponseSuccess' + execution.setVariable(Prefix + "isSdncDeactivateRollbackNeeded", true) + msoLogger.debug("Successfully Validated Rpc SDNC Activate Response") + + } else { + msoLogger.debug("Did NOT Successfully Validated Rpc SDNC Deactivate Response") + throw new BpmnError("MSOWorkflowException") + } + + } + + public void prepareRpcSDNCDeactivateRollback(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareRpcSDNCDeactivateRollback() of DoDeleteNetworkInstance ") + + try { + + // get variables + String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + String deactivateSDNCResponse = execution.getVariable(Prefix + "deactivateSDNCResponse") + String networkId = utils.getNodeText(deactivateSDNCResponse, "network-id") + if (networkId == 'null') {networkId = ""} + String serviceInstanceId = utils.getNodeText(deleteNetworkInput, "service-instance-id") + + // 2. prepare rollback topology via SDNC Adapter SUBFLOW call + String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "activate", "CreateNetworkInstance", cloudRegionId, networkId, null) + String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) + execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", sndcTopologyRollbackRpcRequestAsString) + msoLogger.debug(" Preparing request for RPC SDNC Topology 'activate-CreateNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRpcSDNCDeactivateRollback() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRollbackData(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareRollbackData() of DoDeleteNetworkInstance ") + + try { + + Map rollbackData = new HashMap(); + String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") + if (rollbackNetworkRequest != null) { + if (rollbackNetworkRequest != "") { + rollbackData.put("rollbackNetworkRequest", execution.getVariable(Prefix + "rollbackNetworkRequest")) + } + } + String rollbackDeactivateSDNCRequest = execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest") + if (rollbackDeactivateSDNCRequest != null) { + if (rollbackDeactivateSDNCRequest != "") { + rollbackData.put("rollbackDeactivateSDNCRequest", execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest")) + } + } + execution.setVariable("rollbackData", rollbackData) + msoLogger.debug("** rollbackData : " + rollbackData) + + execution.setVariable("WorkflowException", execution.getVariable("WorkflowException")) + msoLogger.debug("** WorkflowException : " + execution.getVariable("WorkflowException")) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRollbackData() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void postProcessResponse (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside postProcessResponse of DoDeleteNetworkInstance ") + + try { + + msoLogger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException")) + if (execution.getVariable(Prefix + "isException") == false) { + execution.setVariable(Prefix + "Success", true) + execution.setVariable("WorkflowException", null) + if (execution.getVariable(Prefix + "isSilentSuccess") == true) { + execution.setVariable("rolledBack", false) + } else { + execution.setVariable("rolledBack", true) + } + prepareSuccessRollbackData(execution) // populate rollbackData + + } else { + execution.setVariable(Prefix + "Success", false) + execution.setVariable("rollbackData", null) + String exceptionMessage = " Exception encountered in MSO Bpmn. " + if (execution.getVariable("workflowException") != null) { // Output of Rollback flow. + msoLogger.debug(" ***** workflowException: " + execution.getVariable("workflowException")) + WorkflowException wfex = execution.getVariable("workflowException") + exceptionMessage = wfex.getErrorMessage() + } else { + if (execution.getVariable(Prefix + "WorkflowException") != null) { + WorkflowException pwfex = execution.getVariable(Prefix + "WorkflowException") + exceptionMessage = pwfex.getErrorMessage() + } else { + if (execution.getVariable("WorkflowException") != null) { + WorkflowException pwfex = execution.getVariable("WorkflowException") + exceptionMessage = pwfex.getErrorMessage() + } + } + } + + // going to the Main flow: a-la-carte or macro + msoLogger.debug(" ***** postProcessResponse(), BAD !!!") + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + throw new BpmnError("MSOWorkflowException") + + } + + } catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, postProcessResponse() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + throw new BpmnError("MSOWorkflowException") + + } + + } + + public void prepareSuccessRollbackData(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareSuccessRollbackData() of DoDeleteNetworkInstance ") + + try { + + if (execution.getVariable("sdncVersion") != '1610') { + prepareRpcSDNCDeactivateRollback(execution) + prepareRpcSDNCUnassignRollback(execution) + } else { + prepareSDNCRollback(execution) + } + + Map rollbackData = new HashMap(); + String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") + if (rollbackSDNCRequest != null) { + if (rollbackSDNCRequest != "") { + rollbackData.put("rollbackSDNCRequest", execution.getVariable(Prefix + "rollbackSDNCRequest")) + } + } + String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") + if (rollbackNetworkRequest != null) { + if (rollbackNetworkRequest != "") { + rollbackData.put("rollbackNetworkRequest", execution.getVariable(Prefix + "rollbackNetworkRequest")) + } + } + String rollbackDeactivateSDNCRequest = execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest") + if (rollbackDeactivateSDNCRequest != null) { + if (rollbackDeactivateSDNCRequest != "") { + rollbackData.put("rollbackDeactivateSDNCRequest", execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest")) + } + } + execution.setVariable("rollbackData", rollbackData) + + msoLogger.debug("** rollbackData : " + rollbackData) + execution.setVariable("WorkflowException", null) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRpcSDNCUnassignRollback(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareRpcSDNCUnassignRollbac() of DoDeleteNetworkInstance ") + + try { + + // get variables + String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") + + String deleteSDNCResponse = execution.getVariable(Prefix + "deleteSDNCResponse") + String networkId = utils.getNodeText(deleteSDNCResponse, "network-id") + if (networkId == 'null') {networkId = ""} + String serviceInstanceId = utils.getNodeText(deleteNetworkInput, "service-instance-id") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + // 1. prepare delete topology via SDNC Adapter SUBFLOW call + String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "assign", "CreateNetworkInstance", cloudRegionId, networkId, null) + String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) + msoLogger.debug(sndcTopologyDeleteRequesAsString) + execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyDeleteRequesAsString) + msoLogger.debug(Prefix + "rollbackSDNCRequest" + "\n" + sndcTopologyDeleteRequesAsString) + msoLogger.debug(" Preparing request for RPC SDNC Topology 'assign-CreateNetworkInstance' rollback . . . - " + "\n" + sndcTopologyDeleteRequesAsString) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRpcSDNCUnassignRollback() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareSDNCRollback (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside prepareSDNCRollback of DoDeleteNetworkInstance ") + + try { + + // get variables + String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") + + String networkId = "" + if (utils.nodeExists(deleteNetworkInput, "network-id")) { + networkId = utils.getNodeText(deleteNetworkInput, "network-id") + } + if (networkId == 'null') {networkId = ""} + + String serviceInstanceId = utils.getNodeText(deleteNetworkInput, "service-instance-id") + + // get/set 'msoRequestId' and 'mso-request-id' + String requestId = execution.getVariable("msoRequestId") + if (requestId != null) { + execution.setVariable("mso-request-id", requestId) + } else { + requestId = execution.getVariable("mso-request-id") + } + execution.setVariable(Prefix + "requestId", requestId) + + String queryAAIResponse = execution.getVariable(Prefix + "queryAAIResponse") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + // 1. prepare delete topology via SDNC Adapter SUBFLOW call + String sndcTopologyDeleteRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "rollback", "DisconnectNetworkRequest", cloudRegionId, networkId, queryAAIResponse, null) + String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) + msoLogger.debug(sndcTopologyDeleteRequesAsString) + execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyDeleteRequesAsString) + msoLogger.debug(Prefix + "rollbackSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString) + msoLogger.debug(" Preparing request for RPC SDNC Topology 'rollback-DisconnectNetworkRequest' rollback . . . - " + "\n" + sndcTopologyDeleteRequesAsString) + + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRollback() - " + ex.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, exceptionMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void setExceptionFlag(DelegateExecution execution){ + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside setExceptionFlag() of DoDeleteNetworkInstance ") + + try { + + execution.setVariable(Prefix + "isException", true) + + if (execution.getVariable("SavedWorkflowException1") != null) { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) + } else { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) + } + msoLogger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException")) + + } catch(Exception ex){ + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance flow. setExceptionFlag(): " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + } + + } + + + // ******************************* + // Build Error Section + // ******************************* + + public void processJavaException(DelegateExecution execution){ + + execution.setVariable("prefix",Prefix) + try{ + msoLogger.debug("Caught a Java Exception") + msoLogger.debug("Started processJavaException Method") + msoLogger.debug("Variables List: " + execution.getVariables()) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + + }catch(Exception e){ + msoLogger.debug("Caught Exception during processJavaException Method: " + e) + execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method") + } + msoLogger.debug("Completed processJavaException Method of " + Prefix) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy new file mode 100644 index 0000000000..ca6e21eedc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy @@ -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.bpmn.infrastructure.scripts; + +import groovy.xml.XmlUtil +import groovy.json.* +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.NetworkUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.rest.APIResponse; +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils + +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +/** + * This groovy class supports the DoCreateNetworkInstanceRollback.bpmn process. + * + */ +public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteNetworkInstanceRollback.class); + + String Prefix="DELNWKIR_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + NetworkUtils networkUtils = new NetworkUtils() + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + def className = getClass().getSimpleName() + + /** + * This method is executed during the preProcessRequest task of the DoDeleteNetworkInstanceRollback.bpmn process. + * @param execution + */ + public InitializeProcessVariables(DelegateExecution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable(Prefix + "WorkflowException", null) + + execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", null) + execution.setVariable(Prefix + "rollbackDeactivateSDNCResponse", "") + execution.setVariable(Prefix + "rollbackDeactivateSDNCReturnCode", "") + + execution.setVariable(Prefix + "rollbackSDNCRequest", "") + execution.setVariable(Prefix + "rollbackSDNCResponse", "") + execution.setVariable(Prefix + "rollbackSDNCReturnCode", "") + + execution.setVariable(Prefix + "rollbackNetworkRequest", null) + execution.setVariable(Prefix + "rollbackNetworkResponse", "") + execution.setVariable(Prefix + "rollbackNetworkReturnCode", "") + + execution.setVariable(Prefix + "Success", false) + execution.setVariable(Prefix + "fullRollback", false) + + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the DoDeleteNetworkInstanceRollback.bpmn process. + * @param execution + */ + public void preProcessRequest (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside preProcessRequest() of " + className + ".groovy ") + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + // GET Incoming request/variables + String rollbackDeactivateSDNCRequest = null + String rollbackSDNCRequest = null + String rollbackNetworkRequest = null + + Map rollbackData = execution.getVariable("rollbackData") + if (rollbackData != null && rollbackData instanceof Map) { + + if(rollbackData.containsKey("rollbackDeactivateSDNCRequest")) { + rollbackDeactivateSDNCRequest = rollbackData["rollbackDeactivateSDNCRequest"] + } + + if(rollbackData.containsKey("rollbackSDNCRequest")) { + rollbackSDNCRequest = rollbackData["rollbackSDNCRequest"] + } + + if(rollbackData.containsKey("rollbackNetworkRequest")) { + rollbackNetworkRequest = rollbackData["rollbackNetworkRequest"] + } + } + + execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkRequest) + execution.setVariable(Prefix + "rollbackSDNCRequest", rollbackSDNCRequest) + execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", rollbackDeactivateSDNCRequest) + msoLogger.debug("'rollbackData': " + '\n' + execution.getVariable("rollbackData")) + + String sdncVersion = execution.getVariable("sdncVersion") + msoLogger.debug("sdncVersion? : " + sdncVersion) + + // PO Authorization Info / headers Authorization= + String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution) + try { + def encodedString = utils.getBasicAuth(basicAuthValuePO, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable("BasicAuthHeaderValuePO",encodedString) + execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) + + } catch (IOException ex) { + String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " + String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() + msoLogger.debug(dataErrorMessage ) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + if (execution.getVariable("SavedWorkflowException1") != null) { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) + } else { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) + } + msoLogger.debug("*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException")) + if(execution.getVariable(Prefix + "WorkflowException") != null) { + // called by: DoCreateNetworkInstance, partial rollback + execution.setVariable(Prefix + "fullRollback", false) + + } else { + // called by: Macro - Full Rollback, WorkflowException = null + execution.setVariable(Prefix + "fullRollback", true) + + } + + msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + sendSyncError(execution) + // caught exception + String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void validateRollbackResponses (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside validateRollbackResponses() of DoDeleteNetworkInstanceRollback ") + + try { + + // validate SDNC activate response + String rollbackDeactivateSDNCMessages = "" + String rollbackDeactivateSDNCReturnCode = "200" + if (execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest") != null) { + rollbackDeactivateSDNCReturnCode = execution.getVariable(Prefix + "rollbackDeactivateSDNCReturnCode") + String rollbackDeactivateSDNCResponse = execution.getVariable(Prefix + "rollbackDeactivateSDNCResponse") + String rollbackDeactivateSDNCReturnInnerCode = "" + rollbackDeactivateSDNCResponse = rollbackDeactivateSDNCResponse.replace('$', '').replace('', "") + if (rollbackDeactivateSDNCReturnCode == "200") { + if (utils.nodeExists(rollbackDeactivateSDNCResponse, "response-code")) { + rollbackDeactivateSDNCReturnInnerCode = utils.getNodeText(rollbackDeactivateSDNCResponse, "response-code") + if (rollbackDeactivateSDNCReturnInnerCode == "200" || rollbackDeactivateSDNCReturnInnerCode == "" || rollbackDeactivateSDNCReturnInnerCode == "0") { + rollbackDeactivateSDNCMessages = " + SNDC deactivate rollback completed." + } else { + rollbackDeactivateSDNCMessages = " + SDNC deactivate rollback failed. " + } + } else { + rollbackDeactivateSDNCMessages = " + SNDC deactivate rollback completed." + } + } else { + rollbackDeactivateSDNCMessages = " + SDNC deactivate rollback failed. " + } + msoLogger.debug(" SDNC deactivate rollback Code - " + rollbackDeactivateSDNCReturnCode) + msoLogger.debug(" SDNC deactivate rollback Response - " + rollbackDeactivateSDNCResponse) + } + + // validate SDNC rollback response + String rollbackSdncErrorMessages = "" + String rollbackSDNCReturnCode = "200" + if (execution.getVariable(Prefix + "rollbackSDNCRequest") != null) { + rollbackSDNCReturnCode = execution.getVariable(Prefix + "rollbackSDNCReturnCode") + String rollbackSDNCResponse = execution.getVariable(Prefix + "rollbackSDNCResponse") + String rollbackSDNCReturnInnerCode = "" + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + rollbackSDNCResponse = rollbackSDNCResponse.replace('$', '').replace('', "") + if (rollbackSDNCReturnCode == "200") { + if (utils.nodeExists(rollbackSDNCResponse, "response-code")) { + rollbackSDNCReturnInnerCode = utils.getNodeText(rollbackSDNCResponse, "response-code") + if (rollbackSDNCReturnInnerCode == "200" || rollbackSDNCReturnInnerCode == "" || rollbackSDNCReturnInnerCode == "0") { + rollbackSdncErrorMessages = " + SNDC unassign rollback completed." + } else { + rollbackSdncErrorMessages = " + SDNC unassign rollback failed. " + } + } else { + rollbackSdncErrorMessages = " + SNDC unassign rollback completed." + } + } else { + rollbackSdncErrorMessages = " + SDNC unassign rollback failed. " + } + msoLogger.debug(" SDNC assign rollback Code - " + rollbackSDNCReturnCode) + msoLogger.debug(" SDNC assign rollback Response - " + rollbackSDNCResponse) + } + + // validate PO network rollback response + String rollbackNetworkErrorMessages = "" + String rollbackNetworkReturnCode = "200" + if (execution.getVariable(Prefix + "rollbackNetworkRequest") != null) { + rollbackNetworkReturnCode = execution.getVariable(Prefix + "rollbackNetworkReturnCode") + String rollbackNetworkResponse = execution.getVariable(Prefix + "rollbackNetworkResponse") + if (rollbackNetworkReturnCode != "200") { + rollbackNetworkErrorMessages = " + PO Network rollback failed. " + } else { + rollbackNetworkErrorMessages = " + PO Network rollback completed." + } + + msoLogger.debug(" NetworkRollback Code - " + rollbackNetworkReturnCode) + msoLogger.debug(" NetworkRollback Response - " + rollbackNetworkResponse) + } + + String statusMessage = "" + int errorCode = 7000 + msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) + if (execution.getVariable(Prefix + "fullRollback") == false) { + WorkflowException wfe = execution.getVariable(Prefix + "WorkflowException") // original WorkflowException + if (wfe != null) { + statusMessage = wfe.getErrorMessage() + errorCode = wfe.getErrorCode() + } else { + statusMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." + errorCode = '7000' + } + + // set if all rolledbacks are successful + if (rollbackDeactivateSDNCReturnCode == "200" && rollbackNetworkReturnCode == "200" && rollbackSDNCReturnCode == "200") { + execution.setVariable("rolledBack", true) + execution.setVariable("wasDeleted", true) + + } else { + execution.setVariable("rolledBack", false) + execution.setVariable("wasDeleted", true) + } + + statusMessage = statusMessage + rollbackDeactivateSDNCMessages + rollbackNetworkErrorMessages + rollbackSdncErrorMessages + msoLogger.debug("Final DoDeleteNetworkInstanceRollback status message: " + statusMessage) + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, errorCode, statusMessage); + execution.setVariable("workflowException", exception); + + } else { + // rollback due to failures in Main flow (Macro or a-ala-carte) - Full rollback + if (rollbackDeactivateSDNCReturnCode == "200" && rollbackNetworkReturnCode == "200" && rollbackSDNCReturnCode == "200") { + execution.setVariable("rollbackSuccessful", true) + execution.setVariable("rollbackError", false) + } else { + String exceptionMessage = "Network Delete Rollback was not Successful. " + msoLogger.debug(exceptionMessage) + execution.setVariable("rollbackSuccessful", false) + execution.setVariable("rollbackError", true) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + throw new BpmnError("MSOWorkflowException") + } + } + + } catch (Exception ex) { + String errorMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." + String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstanceRollback flow. validateRollbackResponses() - " + errorMessage + ": " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + // ******************************* + // Build Error Section + // ******************************* + + + + public void processJavaException(DelegateExecution execution){ + + execution.setVariable("prefix",Prefix) + + try{ + msoLogger.debug("Caught a Java Exception in " + Prefix) + msoLogger.debug("Started processJavaException Method") + msoLogger.debug("Variables List: " + execution.getVariables()) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + + }catch(Exception e){ + msoLogger.debug("Caught Exception during processJavaException Method: " + e) + execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) + } + msoLogger.debug("Completed processJavaException Method in " + Prefix) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResources.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResources.groovy new file mode 100644 index 0000000000..f6dd0cad16 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResources.groovy @@ -0,0 +1,317 @@ +/*- + * ============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.bpmn.infrastructure.scripts + +import org.json.JSONArray; + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* + +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.domain.ServiceInstance +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.rest.APIResponse; +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig + +import java.util.List; +import java.util.UUID; +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.camunda.bpm.engine.runtime.Execution +import org.json.JSONObject; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource + +import com.fasterxml.jackson.jaxrs.json.annotation.JSONP.Def; +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +/** + * This groovy class supports the DoDeleteResources.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId - O + * @param - subscriptionServiceType - O + * @param - serviceInstanceId + * @param - serviceInstanceName - O + * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) + * @param - sdncVersion + * @param - failNotFound - TODO + * @param - serviceInputParams - TODO + * + * @param - delResourceList + * @param - serviceRelationShip + * + * Outputs: + * @param - WorkflowException + * + * Rollback - Deferred + */ +public class DoDeleteResources extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteResources.class); + + String Prefix="DDELR_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + msoLogger.trace("preProcessRequest ") + String msg = "" + + List realNSRessources = new ArrayList() + + // related ns from AAI + String serviceRelationShip = execution.getVariable("serviceRelationShip") + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + List nsSequence = new ArrayList() + List relationShipList = jsonSlurper.parseText(serviceRelationShip) + if (relationShipList != null) { + relationShipList.each { + String resourceType = it.resourceType + nsSequence.add(resourceType) + } + } + + execution.setVariable("currentNSIndex", 0) + execution.setVariable("nsSequence", nsSequence) + execution.setVariable("realNSRessources", realNSRessources) + msoLogger.info("nsSequence: " + nsSequence) + + msoLogger.trace("Exit preProcessRequest ") + } + + public void getCurrentNS(execution){ + msoLogger.trace("Start getCurrentNS Process ") + + def currentIndex = execution.getVariable("currentNSIndex") + List nsSequence = execution.getVariable("nsSequence") + String nsResourceType = nsSequence.get(currentIndex) + + // GET AAI by Name, not ID, for process convenient + execution.setVariable("GENGS_type", "service-instance") + execution.setVariable("GENGS_serviceInstanceId", "") + execution.setVariable("GENGS_serviceInstanceName", nsResourceType) + + msoLogger.trace("COMPLETED getCurrentNS Process ") + } + + public void postProcessAAIGET(DelegateExecution execution) { + msoLogger.trace("postProcessAAIGET2 ") + String msg = "" + + try { + String nsResourceName = execution.getVariable("GENGS_serviceInstanceName") + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(!succInAAI){ + msoLogger.info("Error getting Service-instance from AAI in postProcessAAIGET", + nsResourceName) + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + else + { + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + if(foundInAAI){ + String aaiService = execution.getVariable("GENGS_service") + if (!isBlank(aaiService)) { + String svcId = utils.getNodeText(aaiService, "service-instance-id") + //String mn = utils.getNodeText(aaiService, "model-name") + String mIuuid = utils.getNodeText(aaiService, "model-invariant-id") + String muuid = utils.getNodeText(aaiService, "model-version-id") + String mCuuid = utils.getNodeText(aaiService, "model-customization-uuid") + ServiceInstance rc = new ServiceInstance() + ModelInfo modelInfo = new ModelInfo() + //modelInfo.setModelName(mn) + modelInfo.setModelUuid(muuid) + modelInfo.setModelInvariantUuid(mIuuid) + modelInfo.getModelCustomizationUuid(mCuuid) + rc.setModelInfo(modelInfo) + rc.setInstanceId(svcId) + rc.setInstanceName(nsResourceName) + + List realNSRessources = execution.getVariable("realNSRessources") + realNSRessources.add(rc) + execution.setVariable("realNSRessources", realNSRessources) + + msoLogger.info("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName")) + } + } + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoDeleteResources.postProcessAAIGET " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit postProcessAAIGET ") + } + + public void parseNextNS(execution){ + msoLogger.trace("Start parseNextNS Process ") + def currentIndex = execution.getVariable("currentNSIndex") + def nextIndex = currentIndex + 1 + execution.setVariable("currentNSIndex", nextIndex) + List nsSequence = execution.getVariable("nsSequence") + if(nextIndex >= nsSequence.size()){ + execution.setVariable("allNsFinished", "true") + }else{ + execution.setVariable("allNsFinished", "false") + } + msoLogger.trace("COMPLETED parseNextNS Process ") + } + + + public void sequenceResource(execution){ + msoLogger.trace("STARTED sequenceResource Process ") + List nsResources = new ArrayList() + List wanResources = new ArrayList() + List resourceSequence = new ArrayList() + + // get delete resource list and order list + List delResourceList = execution.getVariable("delResourceList") + // existing resource list + List existResourceList = execution.getVariable("realNSRessources") + + for(ServiceInstance rc_e : existResourceList){ + + String muuid = rc_e.getModelInfo().getModelUuid() + String mIuuid = rc_e.getModelInfo().getModelInvariantUuid() + String mCuuid = rc_e.getModelInfo().getModelCustomizationUuid() + rcType = rc_e.getInstanceName() + + for(Resource rc_d : delResourceList){ + + if(rc_d.getModelInfo().getModelUuid() == muuid + && rc_d.getModelInfo().getModelInvariantUuid() == mIuuid + && rc_d.getModelInfo().getModelCustomizationUuid() == mCuuid) { + + if(StringUtils.containsIgnoreCase(rcType, "overlay") + || StringUtils.containsIgnoreCase(rcType, "underlay")){ + wanResources.add(rcType) + }else{ + nsResources.add(rcType) + } + + } + } + + } + + resourceSequence.addAll(wanResources) + resourceSequence.addAll(nsResources) + String isContainsWanResource = wanResources.isEmpty() ? "false" : "true" + execution.setVariable("isContainsWanResource", isContainsWanResource) + execution.setVariable("currentResourceIndex", 0) + execution.setVariable("resourceSequence", resourceSequence) + msoLogger.info("resourceSequence: " + resourceSequence) + execution.setVariable("wanResources", wanResources) + msoLogger.trace("END sequenceResource Process ") + } + + public void getCurrentResource(execution){ + msoLogger.trace("Start getCurrentResoure Process ") + def currentIndex = execution.getVariable("currentResourceIndex") + List resourceSequence = execution.getVariable("resourceSequence") + List wanResources = execution.getVariable("wanResources") + String resourceName = resourceSequence.get(currentIndex) + execution.setVariable("resourceType",resourceName) + if(wanResources.contains(resourceName)){ + execution.setVariable("controllerInfo", "SDN-C") + }else{ + execution.setVariable("controllerInfo", "VF-C") + } + msoLogger.trace("COMPLETED getCurrentResoure Process ") + } + + /** + * prepare delete parameters + */ + public void preResourceDelete(execution, resourceName){ + + msoLogger.trace("STARTED preResourceDelete Process ") + + List existResourceList = execution.getVariable("realNSRessources") + + for(ServiceInstance rc_e : existResourceList){ + + if(StringUtils.containsIgnoreCase(rc_e.getInstanceName(), resourceName)) { + + String resourceInstanceUUID = rc_e.getInstanceId() + String resourceTemplateUUID = rc_e.getModelInfo().getModelUuid() + execution.setVariable("resourceInstanceId", resourceInstanceUUID) + execution.setVariable("resourceTemplateId", resourceTemplateUUID) + execution.setVariable("resourceType", resourceName) + msoLogger.info("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName) + } + } + + msoLogger.trace("END preResourceDelete Process ") + } + + public void parseNextResource(execution){ + msoLogger.trace("Start parseNextResource Process ") + def currentIndex = execution.getVariable("currentResourceIndex") + def nextIndex = currentIndex + 1 + execution.setVariable("currentResourceIndex", nextIndex) + List resourceSequence = execution.getVariable("resourceSequence") + if(nextIndex >= resourceSequence.size()){ + execution.setVariable("allResourceFinished", "true") + }else{ + execution.setVariable("allResourceFinished", "false") + } + msoLogger.trace("COMPLETED parseNextResource Process ") + } + + /** + * post config request. + */ + public void postConfigRequest(execution){ + //to do + } + +} + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy new file mode 100644 index 0000000000..a5a96f3bd3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy @@ -0,0 +1,400 @@ + +/*- + * ============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.bpmn.infrastructure.scripts + +import static org.apache.commons.lang3.StringUtils.isBlank + +import org.apache.commons.lang3.StringUtils +import org.apache.http.HttpResponse +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject +import org.onap.so.bpmn.common.recipe.BpmnRestClient +import org.onap.so.bpmn.common.recipe.ResourceInput +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.CatalogDbUtils +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.domain.AllottedResource +import org.onap.so.bpmn.core.domain.NetworkResource +import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.infrastructure.properties.BPMNProperties +import org.onap.so.logger.MsoLogger + +/** + * input for script : + * msoRequestId + * isDebugLogEnabled + * globalSubscriberId + * serviceType + * serviceInstanceId + * URN_mso_workflow_sdncadapter_callback + * serviceInputParams + * deleteResourceList + * resourceInstanceIDs + * + * output from script: + * + */ + +public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteResourcesV1.class); + + String Prefix="DDR_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + CatalogDbUtils cutils = new CatalogDbUtils() + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled) + String msg = "" + + try { + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("prefix",Prefix) + + //Inputs + //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology + String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + if (globalSubscriberId == null) + { + execution.setVariable("globalSubscriberId", "") + } + + //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology + String serviceType = execution.getVariable("serviceType") + if (serviceType == null) + { + execution.setVariable("serviceType", "") + } + + //Generated in parent for AAI PUT + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)){ + msg = "Input serviceInstanceId is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') + if (isBlank(sdncCallbackUrl)) { + msg = "URN_mso_workflow_sdncadapter_callback is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) + + StringBuilder sbParams = new StringBuilder() + Map paramsMap = execution.getVariable("serviceInputParams") + if (paramsMap != null) + { + sbParams.append("") + for (Map.Entry entry : paramsMap.entrySet()) { + String paramsXml + String paramName = entry.getKey() + String paramValue = entry.getValue() + paramsXml = + """ + ${MsoUtils.xmlEscape(paramName)} + ${MsoUtils.xmlEscape(paramValue)} + + """ + sbParams.append(paramsXml) + } + sbParams.append("") + } + String siParamsXml = sbParams.toString() + if (siParamsXml == null) + siParamsXml = "" + execution.setVariable("siParamsXml", siParamsXml) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void sequenceResource(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + + utils.log("INFO", " ======== STARTED sequenceResource Process ======== ", isDebugEnabled) + List sequencedResourceList = new ArrayList() + List wanResources = new ArrayList() + + // get delete resource list and order list + List delResourceList = execution.getVariable("deleteResourceList") + + def resourceSequence = BPMNProperties.getResourceSequenceProp() + + if(resourceSequence != null) { + for (resourceType in resourceSequence.reverse()) { + for (resource in delResourceList) { + if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) { + sequencedResourceList.add(resource) + + if (resource instanceof NetworkResource) { + wanResources.add(resource) + } + } + } + } + }else { + //define sequenced resource list, we deploy vf first and then network and then ar + //this is defaule sequence + List vnfResourceList = new ArrayList() + List arResourceList = new ArrayList() + for (Resource rc : delResourceList) { + if (rc instanceof VnfResource) { + vnfResourceList.add(rc) + } else if (rc instanceof NetworkResource) { + wanResources.add(rc) + } else if (rc instanceof AllottedResource) { + arResourceList.add(rc) + } + } + + sequencedResourceList.addAll(arResourceList) + sequencedResourceList.addAll(wanResources) + sequencedResourceList.addAll(vnfResourceList) + } + + String isContainsWanResource = wanResources.isEmpty() ? "false" : "true" + execution.setVariable("isContainsWanResource", isContainsWanResource) + execution.setVariable("currentResourceIndex", 0) + execution.setVariable("sequencedResourceList", sequencedResourceList) + utils.log("INFO", "resourceSequence: " + resourceSequence, isDebugEnabled) + utils.log("INFO", " ======== END sequenceResource Process ======== ", isDebugEnabled) + } + + /** + * prepare delete parameters + */ + public void preResourceDelete(DelegateExecution execution){ + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + + utils.log("INFO", " ======== STARTED preResourceDelete Process ======== ", isDebugEnabled) + + List sequencedResourceList = execution.getVariable("sequencedResourceList") + + int currentIndex = execution.getVariable("currentResourceIndex") + Resource curResource = sequencedResourceList.get(currentIndex); + + String resourceInstanceUUID = curResource.getResourceId() + String resourceTemplateUUID = curResource.getModelInfo().getModelUuid() + execution.setVariable("resourceInstanceId", resourceInstanceUUID) + execution.setVariable("currentResource", curResource) + utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + + resourceInstanceUUID + " resourceModelName: " + curResource.getModelInfo().getModelName(), isDebugEnabled) + + utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled) + } + + + /** + * Execute delete workflow for resource + */ + public void executeResourceDelete(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", "======== Start executeResourceDelete Process ======== ", isDebugEnabled) + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceType = execution.getVariable("serviceType") + + String resourceInstanceId = execution.getVariable("resourceInstanceId") + + Resource currentResource = execution.getVariable("currentResource") + String action = "deleteInstance" + JSONObject resourceRecipe = cutils.getResourceRecipe(execution, currentResource.getModelInfo().getModelUuid(), action) + String recipeUri = resourceRecipe.getString("orchestrationUri") + int recipeTimeout = resourceRecipe.getInt("recipeTimeout") + String recipeParamXsd = resourceRecipe.get("paramXSD") + + + ResourceInput resourceInput = new ResourceInput(); + resourceInput.setServiceInstanceId(serviceInstanceId) + resourceInput.setResourceInstanceName(currentResource.getResourceInstanceName()) + resourceInput.setResourceInstancenUuid(currentResource.getResourceId()) + resourceInput.setOperationId(execution.getVariable("operationId")) + resourceInput.setOperationType(execution.getVariable("operationType")) + String globalSubscriberId = execution.getVariable("globalSubscriberId") + resourceInput.setGlobalSubscriberId(globalSubscriberId) + resourceInput.setResourceModelInfo(currentResource.getModelInfo()); + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); + resourceInput.setServiceType(serviceType) + + String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + recipeUri + + HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeout, action, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) + utils.log("INFO", " ======== END executeResourceDelete Process ======== ", isDebugEnabled) + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug("Error occured within DoDeleteResourcesV1 executeResourceDelete method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured during DoDeleteResourcesV1 executeResourceDelete Catalog") + } + } + + + public void parseNextResource(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled) + def currentIndex = execution.getVariable("currentResourceIndex") + def nextIndex = currentIndex + 1 + execution.setVariable("currentResourceIndex", nextIndex) + List sequencedResourceList = execution.getVariable("sequencedResourceList") + if(nextIndex >= sequencedResourceList.size()){ + execution.setVariable("allResourceFinished", "true") + }else{ + execution.setVariable("allResourceFinished", "false") + } + utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled) + } + + public void prepareFinishedProgressForResource(DelegateExecution execution) { + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceType = execution.getVariable("serviceType") + String resourceInstanceId = execution.getVariable("resourceInstanceId") + Resource currentResource = execution.getVariable("currentResource") + String resourceCustomizationUuid = currentResource.getModelInfo().getModelCustomizationUuid() + String resourceModelName = currentResource.getModelInfo().getModelName() + String operationType = execution.getVariable("operationType") + String progress = "100" + String status = "finished" + String statusDescription = "The resource instance does not exist for " + resourceModelName + String operationId = execution.getVariable("operationId") + + String body = """ + + + + + ${MsoUtils.xmlEscape(operationType)} + ${MsoUtils.xmlEscape(operationId)} + ${MsoUtils.xmlEscape(progress)} + ${MsoUtils.xmlEscape(resourceCustomizationUuid)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(status)} + ${MsoUtils.xmlEscape(statusDescription)} + + + """; + + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } + + public void prepareSDNCServiceDeactivateRequest (DelegateExecution execution) { + prepareSDNCServiceRequest (execution, "deactivate") + } + + public void prepareSDNCServiceDeleteRequest (DelegateExecution execution) { + prepareSDNCServiceRequest (execution, "delete") + } + + public void prepareSDNCServiceRequest (DelegateExecution execution, String svcAction) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareSDNCServiceRequest for " + svcAction + "*****", isDebugEnabled) + + try { + // get variables + String sdnc_svcAction = svcAction + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String hdrRequestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String source = execution.getVariable("source") + String sdnc_service_id = serviceInstanceId + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + String serviceType = execution.getVariable("serviceType") + String globalCustomerId = execution.getVariable("globalSubscriberId") + String serviceModelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid() + String serviceModelUuid = serviceDecomposition.getModelInfo().getModelUuid() + String serviceModelVersion = serviceDecomposition.getModelInfo().getModelVersion() + String serviceModelName = serviceDecomposition.getModelInfo().getModelName() + + // 1. prepare assign topology via SDNC Adapter SUBFLOW call + String sndcTopologyDeleteRequest = + """ + + ${MsoUtils.xmlEscape(hdrRequestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(sdnc_svcAction)} + service-topology-operation + sdncCallback + generic-resource + + + + ${MsoUtils.xmlEscape(hdrRequestId)} + DeleteServiceInstance + ${MsoUtils.xmlEscape(source)} + + + + + + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(serviceType)} + + ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} + ${MsoUtils.xmlEscape(serviceModelUuid)} + ${MsoUtils.xmlEscape(serviceModelVersion)} + ${MsoUtils.xmlEscape(serviceModelName)} + + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(globalCustomerId)} + + + + + """.trim() + + String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) + utils.logAudit(sndcTopologyDeleteRequesAsString) + execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) + utils.log("INFO","sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoDeleteResourcesV1 flow. prepareSDNCServiceRequest() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + utils.log("INFO","***** Exit prepareSDNCServiceRequest for " + svcAction + "*****", isDebugEnabled) + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy new file mode 100644 index 0000000000..198144ad34 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy @@ -0,0 +1,472 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.springframework.web.util.UriUtils; +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource + +import groovy.json.* + +/** + * This groovy class supports the DoDeleteServiceInstance.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId - O + * @param - subscriptionServiceType - O + * @param - serviceInstanceId + * @param - serviceInstanceName - O + * @param - serviceModelInfo - O + * @param - productFamilyId + * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) + * @param - sdncVersion + * @param - failNotFound - TODO + * @param - serviceInputParams - TODO + * + * Outputs: + * @param - WorkflowException + * + * Rollback - Deferred + */ +public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteServiceInstance.class); + + String Prefix="DDELSI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + + msoLogger.trace("preProcessRequest ") + String msg = "" + + try { + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("prefix",Prefix) + + //Inputs + //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology + String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + if (globalSubscriberId == null) + { + execution.setVariable("globalSubscriberId", "") + } + + //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + if (subscriptionServiceType == null) + { + execution.setVariable("subscriptionServiceType", "") + } + + //Generated in parent for AAI PUT + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)){ + msg = "Input serviceInstanceId is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String sdncCallbackUrl = UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution) + if (isBlank(sdncCallbackUrl)) { + msg = "mso.workflow.sdncadapter.callback is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + + StringBuilder sbParams = new StringBuilder() + Map paramsMap = execution.getVariable("serviceInputParams") + if (paramsMap != null) + { + sbParams.append("") + for (Map.Entry entry : paramsMap.entrySet()) { + String paramsXml + String paramName = entry.getKey() + String paramValue = entry.getValue() + paramsXml = + """ + ${MsoUtils.xmlEscape(paramName)} + ${MsoUtils.xmlEscape(paramValue)} + + """ + sbParams.append(paramsXml) + } + sbParams.append("") + } + String siParamsXml = sbParams.toString() + if (siParamsXml == null) + siParamsXml = "" + execution.setVariable("siParamsXml", siParamsXml) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest ") + } + + public void preProcessSDNCDelete (DelegateExecution execution) { + + msoLogger.trace("preProcessSDNCDelete ") + String msg = "" + + try { + def serviceInstanceId = execution.getVariable("serviceInstanceId") ?: "" + def serviceInstanceName = execution.getVariable("serviceInstanceName") ?: "" + def callbackURL = execution.getVariable("sdncCallbackUrl") ?: "" + def requestId = execution.getVariable("msoRequestId") ?: "" + def serviceId = execution.getVariable("productFamilyId") ?: "" + def subscriptionServiceType = execution.getVariable("subscriptionServiceType") ?: "" + def globalSubscriberId = execution.getVariable("globalSubscriberId") ?: "" //globalCustomerId + + String serviceModelInfo = execution.getVariable("serviceModelInfo") ?: "" + def modelInvariantUuid = "" + def modelVersion = "" + def modelUuid = "" + def modelName = "" + if (!isBlank(serviceModelInfo)) + { + modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") ?: "" + modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") ?: "" + modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid") ?: "" + modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") ?: "" + + } + + def siParamsXml = execution.getVariable("siParamsXml") ?: "" + def msoAction = "" + // special URL for SDNW, msoAction helps set diff url in SDNCA + if("TRANSPORT".equalsIgnoreCase(execution.getVariable("serviceType"))) + { + msoAction = "TRANSPORT" + } + + def sdncRequestId = UUID.randomUUID().toString() + + String sdncDelete = + """ + + ${MsoUtils.xmlEscape(sdncRequestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + delete + service-topology-operation + ${MsoUtils.xmlEscape(callbackURL)} + ${MsoUtils.xmlEscape(msoAction)} + + + + ${MsoUtils.xmlEscape(requestId)} + MSO + + + + DeleteServiceInstance + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(subscriptionServiceType)} + + ${MsoUtils.xmlEscape(modelInvariantUuid)} + ${MsoUtils.xmlEscape(modelUuid)} + ${MsoUtils.xmlEscape(modelVersion)} + ${MsoUtils.xmlEscape(modelName)} + + ${MsoUtils.xmlEscape(serviceInstanceId)} + + ${MsoUtils.xmlEscape(globalSubscriberId)} + + + ${MsoUtils.xmlEscape(serviceInstanceName)} + ${siParamsXml} + + + """ + + sdncDelete = utils.formatXml(sdncDelete) + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + execution.setVariable("sdncDelete", sdncDelete) + execution.setVariable("sdncDeactivate", sdncDeactivate) + msoLogger.debug("sdncDeactivate:\n" + sdncDeactivate) + msoLogger.debug("sdncDelete:\n" + sdncDelete) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage()) + } + msoLogger.debug(" *****Exit preProcessSDNCDelete *****") + } + + public void postProcessSDNCDelete(DelegateExecution execution, String response, String method) { + + + msoLogger.trace("postProcessSDNC " + method + " ") + String msg = "" + + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + msoLogger.debug("SDNCResponse: " + response) + msoLogger.debug("workflowException: " + workflowException) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msoLogger.debug("Good response from SDNC Adapter for service-instance " + method + "response:\n" + response) + + }else{ + msg = "Bad Response from SDNC Adapter for service-instance " + method + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg) + } + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in postProcessSDNC " + method + " Exception:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit postProcessSDNC " + method + " ") + } + + public void postProcessAAIGET(DelegateExecution execution) { + + msoLogger.trace("postProcessAAIGET ") + String msg = "" + + try { + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + String serviceType = "" + + if(foundInAAI == true){ + msoLogger.debug("Found Service-instance in AAI") + + //Extract GlobalSubscriberId + String siRelatedLink = execution.getVariable("GENGS_siResourceLink") + if (isBlank(siRelatedLink)) + { + msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + else + { + msoLogger.debug("Found Service-instance in AAI. link: " + siRelatedLink) + String globalSubscriberId = execution.getVariable("globalSubscriberId") + if(isBlank(globalSubscriberId)){ + int custStart = siRelatedLink.indexOf("customer/") + int custEnd = siRelatedLink.indexOf("/service-subscriptions") + globalSubscriberId = siRelatedLink.substring(custStart + 9, custEnd) + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //Extract Service Type if not provided on request + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + if(isBlank(subscriptionServiceType)){ + int serviceStart = siRelatedLink.indexOf("service-subscription/") + int serviceEnd = siRelatedLink.indexOf("/service-instances/") + String serviceTypeEncoded = siRelatedLink.substring(serviceStart + 21, serviceEnd) + subscriptionServiceType = UriUtils.decode(serviceTypeEncoded, "UTF-8") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } + + if (isBlank(globalSubscriberId) || isBlank(subscriptionServiceType)) + { + msg = "Could not retrive global-customer-id & subscription-service-type from AAI to delete id:" + serviceInstanceId + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + } + + String siData = execution.getVariable("GENGS_service") + msoLogger.debug("SI Data") + if (isBlank(siData)) + { + msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + else + { + msoLogger.debug("SI Data" + siData) + serviceType = utils.getNodeText(siData,"service-type") + execution.setVariable("serviceType", serviceType) + execution.setVariable("serviceRole", utils.getNodeText(siData,"service-role")) + String orchestrationStatus = utils.getNodeText(siData,"orchestration-status") + + //Confirm there are no related service instances (vnf/network or volume) + if (utils.nodeExists(siData, "relationship-list")) { + msoLogger.debug("SI Data relationship-list exists:") + InputSource source = new InputSource(new StringReader(siData)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document serviceXml = docBuilder.parse(source) + + NodeList nodeList = serviceXml.getElementsByTagName("relationship") + for (int x = 0; x < nodeList.getLength(); x++) { + Node node = nodeList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() + if(e.equals("generic-vnf") || e.equals("l3-network") || e.equals("allotted-resource") ){ + msoLogger.debug("ServiceInstance still has relationship(s) to generic-vnfs, l3-networks or allotted-resources") + execution.setVariable("siInUse", true) + //there are relationship dependencies to this Service Instance + msg = " Stopped deleting Service Instance, it has dependencies. Service instance id: " + serviceInstanceId + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + }else{ + msoLogger.debug("Relationship NOT related to OpenStack") + } + } + } + } + + if ("TRANSPORT".equalsIgnoreCase(serviceType)) + { + if ("PendingDelete".equals(orchestrationStatus)) + { + execution.setVariable("skipDeactivate", true) + } + else + { + msg = "ServiceInstance of type TRANSPORT must in PendingDelete status to allow Delete. Orchestration-status:" + orchestrationStatus + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + } + + //alacarte SIs are NOT sent to sdnc. exceptions are listed in config variable + String svcTypes = UrnPropertiesReader.getVariable("sdnc.si.svc.types",execution) ?: "" + msoLogger.debug("SDNC SI serviceTypes:" + svcTypes) + List svcList = Arrays.asList(svcTypes.split("\\s*,\\s*")); + boolean isSdncService= false + for (String listEntry : svcList){ + if (listEntry.equalsIgnoreCase(serviceType)){ + isSdncService = true + break; + } + } + + //All Macros are sent to SDNC, TRANSPORT(Macro) is sent to SDNW + //Alacartes are sent to SDNC if they are listed in config variable above + execution.setVariable("sendToSDNC", true) + if(execution.getVariable("sdncVersion").equals("1610")) //alacarte + { + if(!isSdncService){ + execution.setVariable("sendToSDNC", false) + } + } + + msoLogger.debug("isSdncService: " + isSdncService) + msoLogger.debug("Send To SDNC: " + execution.getVariable("sendToSDNC")) + msoLogger.debug("Service Type: " + execution.getVariable("serviceType")) + + } + }else{ + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(succInAAI != true){ + msoLogger.debug("Error getting Service-instance from AAI", + serviceInstanceId) + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + + msoLogger.debug("Service-instance NOT found in AAI. Silent Success") + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoDeleteServiceInstance.postProcessAAIGET. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit postProcessAAIGET ") + } + + /** + * Deletes the service instance in aai + */ + public void deleteServiceInstance(DelegateExecution execution) { + msoLogger.trace("Entered deleteServiceInstance") + try { + String globalCustId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("subscriptionServiceType") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + AAIResourcesClient resourceClient = new AAIResourcesClient(); + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId) + resourceClient.delete(serviceInstanceUri) + + msoLogger.trace("Exited deleteServiceInstance") + }catch(Exception e){ + msoLogger.debug("Error occured within deleteServiceInstance method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteServiceInstance from aai") + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy new file mode 100644 index 0000000000..0069bf4f0a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy @@ -0,0 +1,285 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - 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.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.* + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.json.JsonUtils +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 groovy.json.* + +/** + * This groovy class supports the DoDeleteVFCNetworkServiceInstance.bpmn process. + * flow for E2E ServiceInstance Delete + */ +public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVFCNetworkServiceInstance.class); + + + String vfcUrl = "/vfc/rest/v1/vfcadapter" + + String host = "http://mso.mso.testlab.openecomp.org:8080" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + */ + public void preProcessRequest (DelegateExecution execution) { + + String msg = "" + msoLogger.trace("preProcessRequest() ") + try { + //deal with operation key + String globalSubscriberId = execution.getVariable("globalSubscriberId") + msoLogger.info("globalSubscriberId:" + globalSubscriberId) + String serviceType = execution.getVariable("serviceType") + msoLogger.info("serviceType:" + serviceType) + String serviceId = execution.getVariable("serviceId") + msoLogger.info("serviceId:" + serviceId) + String operationId = execution.getVariable("operationId") + msoLogger.info("serviceType:" + serviceType) + String nodeTemplateUUID = execution.getVariable("resourceTemplateId") + msoLogger.info("nodeTemplateUUID:" + nodeTemplateUUID) + String nsInstanceId = execution.getVariable("resourceInstanceId") + msoLogger.info("nsInstanceId:" + nsInstanceId) + execution.setVariable("nsInstanceId",nsInstanceId) + String nsOperationKey = """{ + "globalSubscriberId":"${globalSubscriberId}", + "serviceType":"${serviceType}", + "serviceId":"${serviceId}", + "operationId":"${operationId}", + "nodeTemplateUUID":"${nodeTemplateUUID}" + }""" + execution.setVariable("nsOperationKey", nsOperationKey); + msoLogger.info("nsOperationKey:" + nsOperationKey) + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest ") + } + + /** + * unwind NS from AAI relationship + */ + public void deleteNSRelationship(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** deleteNSRelationship *****", isDebugEnabled) + String nsInstanceId = execution.getVariable("resourceInstanceId") + if(nsInstanceId == null || nsInstanceId == ""){ + utils.log("INFO"," Delete NS failed", isDebugEnabled) + return + } + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String serviceId = execution.getVariable("serviceId") + String deleteRelationPayload = """ + service-instance + /aai/v11/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${nsInstanceId} + + customer.global-customer-id + ${MsoUtils.xmlEscape(globalSubscriberId)} + + + service-subscription.service-type + ${MsoUtils.xmlEscape(serviceType)} + + + service-instance.service-instance-id + ${MsoUtils.xmlEscape(nsInstanceId)} + + """ + String endpoint = execution.getVariable("URN_aai_endpoint") + utils.log("INFO","Delete Relationship req:\n" + deleteRelationPayload, isDebugEnabled) + String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + serviceId + "/relationship-list/relationship" + + APIResponse aaiRsp = executeAAIDeleteCall(execution, url, deleteRelationPayload) + utils.log("INFO","aai response status code:" + aaiRsp.getStatusCode(), isDebugEnabled) + utils.log("INFO","aai response content:" + aaiRsp.getResponseBodyAsString(), isDebugEnabled) + utils.log("INFO"," *****Exit deleteNSRelationship *****", isDebugEnabled) + } + + public APIResponse executeAAIDeleteCall(DelegateExecution execution, String url, String payload){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled) + APIResponse apiResponse = null + try{ + String uuid = utils.getRequestID() + utils.log("INFO","Generated uuid is: " + uuid, isDebugEnabled) + utils.log("INFO","URL to be used is: " + url, isDebugEnabled) + String userName = execution.getVariable("URN_aai_auth") + String password = execution.getVariable("URN_mso_msoKey") + String basicAuthCred = utils.getBasicAuth(userName,password) + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml"); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.httpDelete(payload) + utils.log("INFO","======== Completed Execute AAI Delete Process ======== ", isDebugEnabled) + }catch(Exception e){ + utils.log("ERROR","Exception occured while executing AAI Put Call. Exception is: \n" + e, isDebugEnabled) + throw new BpmnError("MSOWorkflowException") + } + return apiResponse + } + + /** + * delete NS task + */ + public void deleteNetworkService(DelegateExecution execution) { + + msoLogger.trace("deleteNetworkService start ") + String nsOperationKey = execution.getVariable("nsOperationKey"); + String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId") + APIResponse apiResponse = deleteRequest(execution, url, nsOperationKey) + String returnCode = apiResponse.getStatusCode() + String apiResponseAsString = apiResponse.getResponseBodyAsString() + String operationStatus = "error"; + if(returnCode== "200" || returnCode== "202"){ + operationStatus = "finished" + } + execution.setVariable("operationStatus", operationStatus) + + msoLogger.trace("deleteNetworkService end ") + } + + /** + * instantiate NS task + */ + public void terminateNetworkService(DelegateExecution execution) { + + msoLogger.trace("terminateNetworkService start ") + String nsOperationKey = execution.getVariable("nsOperationKey") + String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId") + "/terminate" + APIResponse apiResponse = postRequest(execution, url, nsOperationKey) + String returnCode = apiResponse.getStatusCode() + String aaiResponseAsString = apiResponse.getResponseBodyAsString() + String jobId = ""; + if(returnCode== "200" || returnCode== "202"){ + jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") + } + execution.setVariable("jobId", jobId) + msoLogger.trace("terminateNetworkService end ") + } + + /** + * query NS task + */ + public void queryNSProgress(DelegateExecution execution) { + + msoLogger.trace("queryNSProgress start ") + String jobId = execution.getVariable("jobId") + String nsOperationKey = execution.getVariable("nsOperationKey"); + String url = host + vfcUrl + "/jobs/" + execution.getVariable("jobId") + APIResponse apiResponse = postRequest(execution, url, nsOperationKey) + String returnCode = apiResponse.getStatusCode() + String apiResponseAsString = apiResponse.getResponseBodyAsString() + String operationProgress = "100" + if(returnCode== "200"){ + operationProgress = jsonUtil.getJsonValue(apiResponseAsString, "responseDescriptor.progress") + } + execution.setVariable("operationProgress", operationProgress) + msoLogger.trace("queryNSProgress end ") + } + + /** + * delay 5 sec + */ + public void timeDelay(DelegateExecution execution) { + try { + Thread.sleep(5000); + } catch(InterruptedException e) { + msoLogger.info("Time Delay exception" + e) + } + } + + /** + * finish NS task + */ + public void finishNSDelete(DelegateExecution execution) { + //no need to do anything util now + } + + /** + * post request + * url: the url of the request + * requestBody: the body of the request + */ + private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ + + msoLogger.trace("Started Execute VFC adapter Post Process ") + msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody) + APIResponse apiResponse = null + try{ + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk");; + apiResponse = client.httpPost(requestBody) + msoLogger.info("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString()) + msoLogger.trace("Completed Execute VF-C adapter Post Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VF-C Post Call. Exception is: \n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + throw new BpmnError("MSOWorkflowException") + } + return apiResponse + } + /** + * delete request + * url: the url of the request + * requestBody: the body of the request + */ + private APIResponse deleteRequest(DelegateExecution execution, String url, String requestBody){ + + msoLogger.trace("Started Execute VFC adapter Delete Process ") + msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody) + APIResponse apiResponse = null + try{ + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); + apiResponse = client.httpDelete(requestBody) + msoLogger.info("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString()) + msoLogger.trace("Completed Execute VF-C adapter Delete Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VF-C Post Call. Exception is: \n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + throw new BpmnError("MSOWorkflowException") + } + return apiResponse + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy new file mode 100644 index 0000000000..b41b74e509 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy @@ -0,0 +1,711 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.VfModule +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +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.springframework.web.util.UriUtils +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource + +/* Subflow for Delete VF Module. When no DoDeleteVfModuleRequest is specified on input, + * functions as a building block subflow + +* Inputs for building block interface: +* @param - requestId +* @param - isDebugLogEnabled +* @param - vnfId +* @param - vfModuleId +* @param - serviceInstanceId +* @param - vfModuleName O +* @param - vfModuleModelInfo +* @param - cloudConfiguration* +* @param - sdncVersion ("1610") +* @param - retainResources +* @param - aLaCarte +* +* Outputs: +* @param - WorkflowException +* +*/ +public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVfModule.class); + + def Prefix="DoDVfMod_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", null) + execution.setVariable("DoDVfMod_oamManagementV4Address", null) + execution.setVariable("DoDVfMod_oamManagementV6Address", null) + + } + + // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids + // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest + public void preProcessRequest(DelegateExecution execution) { + + initProcessVariables(execution) + + try { + def xml = execution.getVariable("DoDeleteVfModuleRequest") + String vnfId = "" + String vfModuleId = "" + + if (xml == null || xml.isEmpty()) { + // Building Block-type request + + // Set mso-request-id to request-id for VNF Adapter interface + String requestId = execution.getVariable("requestId") + execution.setVariable("mso-request-id", requestId) + + String cloudConfiguration = execution.getVariable("cloudConfiguration") + String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo") + String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId") + execution.setVariable("tenantId", tenantId) + String cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId") + execution.setVariable("cloudSiteId", cloudSiteId) + // Source is HARDCODED + String source = "VID" + execution.setVariable("source", source) + // SrvInstId is hardcoded to empty + execution.setVariable("srvInstId", "") + // ServiceId is hardcoded to empty + execution.setVariable("serviceId", "") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + vnfId = execution.getVariable("vnfId") + vfModuleId = execution.getVariable("vfModuleId") + if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { + execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId) + } + else { + execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId) + } + //vfModuleModelName + def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName") + execution.setVariable("vfModuleModelName", vfModuleModelName) + // retainResources + def retainResources = execution.getVariable("retainResources") + if (retainResources == null) { + retainResources = false + } + execution.setVariable("retainResources", retainResources) + } + else { + + msoLogger.debug("DoDeleteVfModule Request: " + xml) + + msoLogger.debug("input request xml: " + xml) + + vnfId = utils.getNodeText(xml,"vnf-id") + execution.setVariable("vnfId", vnfId) + vfModuleId = utils.getNodeText(xml,"vf-module-id") + execution.setVariable("vfModuleId", vfModuleId) + def srvInstId = execution.getVariable("mso-service-instance-id") + execution.setVariable("srvInstId", srvInstId) + String requestId = "" + try { + requestId = execution.getVariable("mso-request-id") + } catch (Exception ex) { + requestId = utils.getNodeText(xml, "request-id") + } + execution.setVariable("requestId", requestId) + String source = utils.getNodeText(xml, "source") + execution.setVariable("source", source) + String serviceId = utils.getNodeText(xml, "service-id") + execution.setVariable("serviceId", serviceId) + String tenantId = utils.getNodeText(xml, "tenant-id") + execution.setVariable("tenantId", tenantId) + + String serviceInstanceIdToSdnc = "" + if (xml.contains("service-instance-id")) { + serviceInstanceIdToSdnc = utils.getNodeText(xml, "service-instance-id") + } else { + serviceInstanceIdToSdnc = vfModuleId + } + execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceIdToSdnc) + String vfModuleName = utils.getNodeText(xml, "vf-module-name") + execution.setVariable("vfModuleName", vfModuleName) + String vfModuleModelName = utils.getNodeText(xml, "vf-module-model-name") + execution.setVariable("vfModuleModelName", vfModuleModelName) + String cloudSiteId = utils.getNodeText(xml, "aic-cloud-region") + execution.setVariable("cloudSiteId", cloudSiteId) + } + + // formulate the request for PrepareUpdateAAIVfModule + String request = """ + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + pending-delete + """ as String + msoLogger.debug("PrepareUpdateAAIVfModuleRequest :" + request) + msoLogger.debug("UpdateAAIVfModule Request: " + request) + execution.setVariable("PrepareUpdateAAIVfModuleRequest", request) + execution.setVariable("vfModuleFromAAI", null) + }catch(BpmnError b){ + throw b + }catch(Exception e){ + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!") + } + } + + // build a SDNC vnf-topology-operation request for the specified action + // (note: the action passed is expected to be 'changedelete' or 'delete') + public void prepSDNCAdapterRequest(DelegateExecution execution, String action) { + + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("requestId") + "-" + System.currentTimeMillis() + } + + def srvInstId = execution.getVariable("srvInstId") + def callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + String requestId = execution.getVariable("requestId") + String source = execution.getVariable("source") + String serviceId = execution.getVariable("serviceId") + String vnfId = execution.getVariable("vnfId") + String tenantId = execution.getVariable("tenantId") + String vfModuleId = execution.getVariable("vfModuleId") + String serviceInstanceIdToSdnc = execution.getVariable(Prefix + "serviceInstanceIdToSdnc") + String vfModuleName = execution.getVariable("vfModuleName") + // Get vfModuleName from AAI response if it was not specified on the request + if (vfModuleName == null || vfModuleName.isEmpty()) { + if (execution.getVariable("vfModuleFromAAI") != null) { + VfModule vfModuleFromAAI = execution.getVariable("vfModuleFromAAI") + vfModuleName = vfModuleFromAAI.getElementText("vf-module-name") + } + } + String vfModuleModelName = execution.getVariable("vfModuleModelName") + String cloudSiteId = execution.getVariable("cloudSiteId") + boolean retainResources = execution.getVariable("retainResources") + String requestSubActionString = "" + if (retainResources) { + requestSubActionString = "RetainResource" + } + String request = """ + + ${MsoUtils.xmlEscape(uuid)} + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(action)} + vnf-topology-operation + ${MsoUtils.xmlEscape(callbackUrl)} + + + + ${MsoUtils.xmlEscape(requestId)} + DisconnectVNFRequest + ${requestSubActionString} + ${MsoUtils.xmlEscape(source)} + + + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(serviceInstanceIdToSdnc)} + notsurewecare + + + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(vfModuleModelName)} + ${MsoUtils.xmlEscape(vfModuleName)} + ${MsoUtils.xmlEscape(vnfId)} + + + ${MsoUtils.xmlEscape(cloudSiteId)} + ${MsoUtils.xmlEscape(tenantId)} + + + """ + + msoLogger.debug("sdncAdapterWorkflowRequest: " + request) + msoLogger.debug("DoDeleteVfModule - SDNCAdapterWorkflowRequest: " + request) + execution.setVariable("sdncAdapterWorkflowRequest", request) + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing VnfAdapterDeleteV1 request + public void prepVNFAdapterRequest(DelegateExecution execution) { + + def requestId = UUID.randomUUID().toString() + def origRequestId = execution.getVariable('requestId') + def srvInstId = execution.getVariable("serviceInstanceId") + def aicCloudRegion = execution.getVariable("cloudSiteId") + def vnfId = execution.getVariable("vnfId") + def vfModuleId = execution.getVariable("vfModuleId") + def vfModuleStackId = execution.getVariable('DoDVfMod_heatStackId') + def tenantId = execution.getVariable("tenantId") + def messageId = execution.getVariable('requestId') + '-' + + System.currentTimeMillis() + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) + def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) + if ('true'.equals(useQualifiedHostName)) { + notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) + } + + String request = """ + + ${MsoUtils.xmlEscape(aicCloudRegion)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(vfModuleStackId)} + true + + ${MsoUtils.xmlEscape(origRequestId)} + ${MsoUtils.xmlEscape(srvInstId)} + + ${MsoUtils.xmlEscape(messageId)} + ${MsoUtils.xmlEscape(notificationUrl)} + + """ as String + + msoLogger.debug("vnfAdapterRestV1Request: " + request) + msoLogger.debug("deleteVfModuleRequest: " + request) + execution.setVariable("vnfAdapterRestV1Request", request) + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing UpdateAAIVfModuleRequest request + public void prepUpdateAAIVfModule(DelegateExecution execution) { + + def vnfId = execution.getVariable("vnfId") + def vfModuleId = execution.getVariable("vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """ + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + DELETE + deleted + """ as String + msoLogger.debug("UpdateAAIVfModuleRequest :" + request) + msoLogger.debug("UpdateAAIVfModuleRequest: " + request) + execution.setVariable("UpdateAAIVfModuleRequest", request) + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing DeleteAAIVfModuleRequest request + public void prepDeleteAAIVfModule(DelegateExecution execution) { + + + def vnfId = execution.getVariable("vnfId") + def vfModuleId = execution.getVariable("vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """ + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + """ as String + msoLogger.debug("DeleteAAIVfModuleRequest :" + request) + msoLogger.debug("DeleteAAIVfModuleRequest: " + request) + execution.setVariable("DeleteAAIVfModuleRequest", request) + } + + // generates a WorkflowException if + // - + public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception"); + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, 5000, + execution.getVariable("DoDVfMod_deleteGenericVnfResponse")) + execution.setVariable("WorkflowException", exception) + } + + public void sdncValidateResponse(DelegateExecution execution, String response){ + + execution.setVariable("prefix",Prefix) + + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msoLogger.debug("Successfully Validated SDNC Response") + }else{ + throw new BpmnError("MSOWorkflowException") + } + } + + public void postProcessVNFAdapterRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix",Prefix) + try{ + msoLogger.trace("STARTED postProcessVNFAdapterRequest Process") + + String vnfResponse = execution.getVariable("DoDVfMod_doDeleteVfModuleResponse") + msoLogger.debug("VNF Adapter Response is: " + vnfResponse) + msoLogger.debug("deleteVnfAResponse is: \n" + vnfResponse) + + if(vnfResponse != null){ + + if(vnfResponse.contains("deleteVfModuleResponse")){ + msoLogger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.") + execution.setVariable("DoDVfMod_vnfVfModuleDeleteCompleted", true) + + // Parse vnfOutputs for contrail network polcy FQDNs + if (vnfResponse.contains("vfModuleOutputs")) { + def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs") + InputSource source = new InputSource(new StringReader(vfModuleOutputsXml)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document outputsXml = docBuilder.parse(source) + + NodeList entries = outputsXml.getElementsByTagNameNS("*", "entry") + List contrailNetworkPolicyFqdnList = [] + for (int i = 0; i< entries.getLength(); i++) { + Node node = entries.item(i) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element element = (Element) node + String key = element.getElementsByTagNameNS("*", "key").item(0).getTextContent() + if (key.endsWith("contrail_network_policy_fqdn")) { + String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() + msoLogger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn) + contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn) + } + else if (key.equals("oam_management_v4_address")) { + String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() + msoLogger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address) + execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address) + } + else if (key.equals("oam_management_v6_address")) { + String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() + msoLogger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address) + execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address) + } + + } + } + if (!contrailNetworkPolicyFqdnList.isEmpty()) { + msoLogger.debug("Setting the fqdn list") + execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList) + } + } + }else{ + msoLogger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.") + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error") + } + }else{ + msoLogger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.") + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter") + } + + }catch(BpmnError b){ + throw b + }catch(Exception e){ + msoLogger.debug("Internal Error Occured in PostProcess Method") + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method") + } + msoLogger.trace("COMPLETED postProcessVnfAdapterResponse Process") + } + + public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED deleteNetworkPoliciesFromAAI ") + + try { + // get variables + List fqdnList = execution.getVariable("DoDVfMod_contrailNetworkPolicyFqdnList") + if (fqdnList == null) { + msoLogger.debug("No network policies to delete") + return + } + int fqdnCount = fqdnList.size() + + execution.setVariable("DoDVfMod_networkPolicyFqdnCount", fqdnCount) + msoLogger.debug("DoDVfMod_networkPolicyFqdnCount - " + fqdnCount) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) + + if (fqdnCount > 0) { + // AII loop call over contrail network policy fqdn list + for (i in 0..fqdnCount-1) { + + int counting = i+1 + String fqdn = fqdnList[i] + + // Query AAI for this network policy FQDN + + String queryNetworkPolicyByFqdnAAIRequest = "${aai_endpoint}${aai_uri}?network-policy-fqdn=" + UriUtils.encode(fqdn, "UTF-8") + msoLogger.debug("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest) + msoLogger.debug("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkPolicyByFqdnAAIRequest) + int returnCode = response.getStatusCode() + execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", returnCode) + msoLogger.debug(" ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (isOneOf(returnCode, 200, 201)) { + msoLogger.debug("The return code is: " + returnCode) + // This network policy FQDN exists in AAI - need to delete it now + msoLogger.debug(aaiResponseAsString) + execution.setVariable("DoDVfMod_queryNetworkPolicyByFqdnAAIResponse", aaiResponseAsString) + msoLogger.debug("QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString) + // Retrieve the network policy id for this FQDN + def networkPolicyId = utils.getNodeText(aaiResponseAsString, "network-policy-id") + msoLogger.debug("Deleting network-policy with network-policy-id " + networkPolicyId) + + // Retrieve the resource version for this network policy + def resourceVersion = utils.getNodeText(aaiResponseAsString, "resource-version") + msoLogger.debug("Deleting network-policy with resource-version " + resourceVersion) + + String delNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(networkPolicyId, "UTF-8") + + "?resource-version=" + UriUtils.encode(resourceVersion, "UTF-8") + msoLogger.debug("AAI request endpoint: " + delNetworkPolicyAAIRequest) + msoLogger.debug("AAI request endpoint: " + delNetworkPolicyAAIRequest) + + msoLogger.debug("invoking DELETE call to AAI") + msoLogger.debug("Sending DELETE call to AAI with Endpoint /n" + delNetworkPolicyAAIRequest) + APIResponse responseDel = aaiUriUtil.executeAAIDeleteCall(execution, delNetworkPolicyAAIRequest) + int returnCodeDel = responseDel.getStatusCode() + execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", returnCodeDel) + msoLogger.debug(" ***** AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + returnCodeDel) + + if (isOneOf(returnCodeDel, 200, 201, 204)) { + msoLogger.debug("The return code from deleting network policy is: " + returnCodeDel) + // This network policy was deleted from AAI successfully + msoLogger.debug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ") + + } else { + // aai all errors + String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + returnCodeDel + msoLogger.debug(delErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage) + } + } else if (returnCode == 404) { + // This network policy FQDN is not in AAI. No need to delete. + msoLogger.debug("The return code is: " + returnCode) + msoLogger.debug("This network policy FQDN is not in AAI: " + fqdn) + msoLogger.debug("Network policy FQDN is not in AAI") + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + returnCode + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + + + + } // end loop + + + } else { + msoLogger.debug("No contrail network policies to query/create") + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + } + + /** + * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. + * + * @param execution The flow's execution instance. + */ + public void prepUpdateAAIGenericVnf(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('vnfId') + def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address') + def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address') + def ipv4OamAddressElement = '' + def managementV6AddressElement = '' + + if (oamManagementV4Address != null) { + ipv4OamAddressElement = '' + 'DELETE' + '' + } + + if (oamManagementV6Address != null) { + managementV6AddressElement = '' + 'DELETE' + '' + } + + + String updateAAIGenericVnfRequest = """ + + ${MsoUtils.xmlEscape(vnfId)} + ${ipv4OamAddressElement} + ${managementV6AddressElement} + + """ + updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) + execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) + msoLogger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) + msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) + + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) + } + } + + /** + * Using the vnfId and vfModuleId provided in the inputs, + * query AAI to get the corresponding VF Module info. + * A 200 response is expected with the VF Module info in the response body, + * Will determine VF Module's orchestration status if one exists + * + * @param execution The flow's execution instance. + */ + public void queryAAIVfModuleForStatus(DelegateExecution execution) { + + def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + execution.setVariable(Prefix + 'orchestrationStatus', '') + + try { + def vnfId = execution.getVariable('vnfId') + def vfModuleId = execution.getVariable('vfModuleId') + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint",execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + + "/vf-modules/vf-module/" + UriUtils.encode(vfModuleId, "UTF-8") + msoLogger.debug("AAI endPoint: " + endPoint) + + try { + RESTConfig config = new RESTConfig(endPoint); + def responseData = '' + def aaiRequestId = UUID.randomUUID().toString() + RESTClient client = new RESTClient(config). + addHeader('X-TransactionId', aaiRequestId). + addHeader('X-FromAppId', 'MSO'). + addHeader('Content-Type', 'application/xml'). + addHeader('Accept','application/xml'); + msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') + APIResponse response = client.httpGet() + msoLogger.debug("createVfModule - invoking httpGet() to AAI") + + responseData = response.getResponseBodyAsString() + if (responseData != null) { + msoLogger.debug("Received generic VNF data: " + responseData) + + } + + msoLogger.debug("deleteVfModule - queryAAIVfModule Response: " + responseData) + msoLogger.debug("deleteVfModule - queryAAIVfModule ResponseCode: " + response.getStatusCode()) + + execution.setVariable(Prefix + 'queryAAIVfModuleForStatusResponseCode', response.getStatusCode()) + execution.setVariable(Prefix + 'queryAAIVfModuleForStatusResponse', responseData) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + // Retrieve VF Module info and its orchestration status; if not found, do nothing + if (response.getStatusCode() == 200) { + // Parse the VNF record from A&AI to find base module info + msoLogger.debug('Parsing the VNF data to find orchestration status') + if (responseData != null) { + def vfModuleText = utils.getNodeXml(responseData, "vf-module") + //def xmlVfModule= new XmlSlurper().parseText(vfModuleText) + def orchestrationStatus = utils.getNodeText(vfModuleText, "orchestration-status") + execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus) + msoLogger.debug("Received orchestration status from A&AI: " + orchestrationStatus) + + } + } + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage()) + } + } + + + + + +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy new file mode 100644 index 0000000000..1024fc57da --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy @@ -0,0 +1,609 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import static org.apache.commons.lang3.StringUtils.* + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.VfModule +import org.onap.so.bpmn.common.scripts.VfModuleBase +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils + +public class DoDeleteVfModuleFromVnf extends VfModuleBase { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVfModuleFromVnf.class); + + def Prefix="DDVFMV_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", null) + } + + // parse the incoming request + public void preProcessRequest(DelegateExecution execution) { + + initProcessVariables(execution) + + try { + + // Building Block-type request + + // Set mso-request-id to request-id for VNF Adapter interface + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("mso-request-id", requestId) + execution.setVariable("requestId", requestId) + msoLogger.debug("msoRequestId: " + requestId) + String tenantId = execution.getVariable("tenantId") + msoLogger.debug("tenantId: " + tenantId) + String cloudSiteId = execution.getVariable("lcpCloudRegionId") + execution.setVariable("cloudSiteId", cloudSiteId) + msoLogger.debug("cloudSiteId: " + cloudSiteId) + // Source is HARDCODED + String source = "VID" + execution.setVariable("source", source) + // isVidRequest is hardcoded to "true" + execution.setVariable("isVidRequest", "true") + // SrvInstId is hardcoded to empty + execution.setVariable("srvInstId", "") + // ServiceId is hardcoded to empty + execution.setVariable("serviceId", "") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + msoLogger.debug("serviceInstanceId: " + serviceInstanceId) + String vnfId = execution.getVariable("vnfId") + msoLogger.debug("vnfId: " + vnfId) + String vfModuleId = execution.getVariable("vfModuleId") + msoLogger.debug("vfModuleId: " + vfModuleId) + if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { + execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId) + } + else { + execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId) + } + + String sdncVersion = execution.getVariable("sdncVersion") + if (sdncVersion == null) { + sdncVersion = "1707" + } + execution.setVariable(Prefix + "sdncVersion", sdncVersion) + msoLogger.debug("Incoming Sdnc Version is: " + sdncVersion) + + String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { + def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception"); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + msoLogger.debug("SDNC Callback URL is: " + sdncCallbackUrl) + + + + }catch(BpmnError b){ + throw b + }catch(Exception e){ + msoLogger.debug("Exception is: " + e.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!") + } + } + + public void queryAAIForVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.queryAAIForVfModule(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('vnfId') + + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" + + msoLogger.debug("DoDeleteVfModuleFromVnf: AAI endPoint : " + endPoint) + + try { + msoLogger.debug("DoDeleteVfModuleFromVnf: - invoking httpGet to AAI") + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint) + + def responseData = response.getResponseBodyAsString() + execution.setVariable('DDVMFV_getVnfResponseCode', response.getStatusCode()) + execution.setVariable('DDVMFV_getVnfResponse', responseData) + + msoLogger.debug("DoDeleteVfModuleFromVnf: AAI Response : " + responseData) + msoLogger.debug("DoDeleteVfModuleFromVnf: AAI ResponseCode : " + response.getStatusCode()) + + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + execution.setVariable('DDVMFV_getVnfResponseCode', 500) + execution.setVariable('DDVFMV_getVnfResponse', 'AAI GET Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage()) + } + } + + /** + * Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID + * exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module + * is the base VF Module and it's not the only VF Module for this Generic VNF, that we're not + * attempting to delete it. + * + * @param execution The flow's execution instance. + */ + public void validateVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.validateVfModule(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + msoLogger.trace('Entered ' + method) + + try { + def genericVnf = execution.getVariable('DDVMFV_getVnfResponse') + def vnfId = execution.getVariable('_vnfId') + def vfModuleId = execution.getVariable('vfModuleId') + def VfModule vfModule = findVfModule(genericVnf, vfModuleId) + if (vfModule == null) { + def String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\'' + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, msg) + } else { + + if (isDebugLogEnabled) { + msoLogger.debug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.isBaseVfModule() + ', isOnlyVfModule=' + vfModule.isOnlyVfModule()) + } + if (vfModule.isBaseVfModule() && !vfModule.isOnlyVfModule()) { + def String msg = 'Cannot delete VF Module \'' + vfModuleId + + '\'since it is the base VF Module and it\'s not the only VF Module in Generic VNF \'' + vnfId + '\'' + msoLogger.debug("Received a BAD Response from VNF Adapter for CREATE_VF_MODULE Call.") + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error") + } + + def heatStackId = vfModule.getElementText('heat-stack-id') + execution.setVariable('DDVMFV_heatStackId', heatStackId) + msoLogger.debug('VF Module heatStackId retrieved from AAI: ' + heatStackId) + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage()) + } + } + + + public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessSDNCDeactivateRequest ") + + def serviceInstanceId = execution.getVariable("serviceInstanceId") + + try{ + //Build SDNC Request + + String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate") + + deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest) + execution.setVariable("DDVMFV_deactivateSDNCRequest", deactivateSDNCRequest) + msoLogger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) + + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCDeactivateRequest ") + } + + public void preProcessSDNCUnassignRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessSDNCUnassignRequest Process ") + try{ + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign") + + execution.setVariable("DDVMFV_unassignSDNCRequest", unassignSDNCRequest) + msoLogger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) + + + }catch(Exception e){ + msoLogger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCUnassignRequest Process ") + } + + public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis() + } + def callbackURL = execution.getVariable("sdncCallbackUrl") + def requestId = execution.getVariable("msoRequestId") + def serviceId = execution.getVariable("serviceId") + def serviceInstanceId = execution.getVariable("serviceInstanceId") + def vfModuleId = execution.getVariable("vfModuleId") + def source = execution.getVariable("source") + def vnfId = execution.getVariable("vnfId") + + def sdncVersion = execution.getVariable(Prefix + "sdncVersion") + + String sdncRequest = + """ + + ${MsoUtils.xmlEscape(uuid)} + ${MsoUtils.xmlEscape(svcInstId)} + ${MsoUtils.xmlEscape(action)} + vf-module-topology-operation + ${MsoUtils.xmlEscape(callbackURL)} + generic-resource + + + + ${MsoUtils.xmlEscape(requestId)} + DeleteVfModuleInstance + ${MsoUtils.xmlEscape(source)} + + + + + + + + ${MsoUtils.xmlEscape(serviceInstanceId)} + + + + ${MsoUtils.xmlEscape(vnfId)} + + + + ${MsoUtils.xmlEscape(vfModuleId)} + + + + """ + + msoLogger.debug("sdncRequest: " + sdncRequest) + return sdncRequest + } + + public void validateSDNCResponse(DelegateExecution execution, String response, String method){ + + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED ValidateSDNCResponse Process") + + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + msoLogger.debug("workflowException: " + workflowException) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + msoLogger.debug("SDNCResponse: " + response) + + String sdncResponse = response + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) + }else{ + msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + throw new BpmnError("MSOWorkflowException") + } + msoLogger.trace("COMPLETED ValidateSDNCResponse Process") + } + + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing VnfAdapterDeleteV1 request + public void prepVNFAdapterRequest(DelegateExecution execution) { + + def requestId = UUID.randomUUID().toString() + def origRequestId = execution.getVariable('requestId') + def srvInstId = execution.getVariable("serviceInstanceId") + def aicCloudRegion = execution.getVariable("cloudSiteId") + def vnfId = execution.getVariable("vnfId") + def vfModuleId = execution.getVariable("vfModuleId") + def vfModuleStackId = execution.getVariable('DDVMFV_heatStackId') + def tenantId = execution.getVariable("tenantId") + def messageId = execution.getVariable('requestId') + '-' + + System.currentTimeMillis() + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) + def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) + if ('true'.equals(useQualifiedHostName)) { + notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) + } + + String request = """ + + ${MsoUtils.xmlEscape(aicCloudRegion)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(vfModuleStackId)} + true + + ${MsoUtils.xmlEscape(origRequestId)} + ${MsoUtils.xmlEscape(srvInstId)} + + ${MsoUtils.xmlEscape(messageId)} + ${MsoUtils.xmlEscape(notificationUrl)} + + """ as String + + msoLogger.debug("vnfAdapterRestV1Request: " + request) + msoLogger.debug("deleteVfModuleRequest: " + request) + execution.setVariable("vnfAdapterRestV1Request", request) + } + + + // generates a WorkflowException if + // - + public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception"); + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, 5000, + execution.getVariable("DDVFMV_deleteGenericVnfResponse")) + execution.setVariable("WorkflowException", exception) + } + + public void postProcessVNFAdapterRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix",Prefix) + try{ + msoLogger.trace("STARTED postProcessVNFAdapterRequest Process") + + String vnfResponse = execution.getVariable("DDVMFV_doDeleteVfModuleResponse") + msoLogger.debug("VNF Adapter Response is: " + vnfResponse) + msoLogger.debug("deleteVnfAResponse is: \n" + vnfResponse) + + if(vnfResponse != null){ + + if(vnfResponse.contains("deleteVfModuleResponse")){ + msoLogger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.") + execution.setVariable("DDVFMV_vnfVfModuleDeleteCompleted", true) + + // Parse vnfOutputs for contrail network polcy FQDNs + def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs") + if(!isBlank(vfModuleOutputsXml)) { + vfModuleOutputsXml = utils.removeXmlNamespaces(vfModuleOutputsXml) + List contrailNetworkPolicyFqdnList = [] + for(Node node: utils.getMultNodeObjects(vfModuleOutputsXml, "entry")) { + String key = utils.getChildNodeText(node, "key") + if(key == null) { + + } else if (key.endsWith("contrail_network_policy_fqdn")) { + String contrailNetworkPolicyFqdn = utils.getChildNodeText(node, "value") + msoLogger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn) + contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn) + } + else if (key.equals("oam_management_v4_address")) { + String oamManagementV4Address = utils.getChildNodeText(node, "value") + msoLogger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address) + execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address) + } + else if (key.equals("oam_management_v6_address")) { + String oamManagementV6Address = utils.getChildNodeText(node, "value") + msoLogger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address) + execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address) + } + } + if (!contrailNetworkPolicyFqdnList.isEmpty()) { + msoLogger.debug("Setting the fqdn list") + execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList) + } + } + }else{ + msoLogger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.") + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error") + } + }else{ + msoLogger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.") + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter") + } + + }catch(BpmnError b){ + throw b + }catch(Exception e){ + msoLogger.debug("Internal Error Occured in PostProcess Method") + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method") + } + msoLogger.trace("COMPLETED postProcessVnfAdapterResponse Process") + } + + public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED deleteNetworkPoliciesFromAAI ") + + try { + // get variables + List fqdnList = execution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList") + if (fqdnList == null) { + msoLogger.debug("No network policies to delete") + return + } + int fqdnCount = fqdnList.size() + + execution.setVariable("DDVFMV_networkPolicyFqdnCount", fqdnCount) + msoLogger.debug("DDVFMV_networkPolicyFqdnCount - " + fqdnCount) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) + + if (fqdnCount > 0) { + // AII loop call over contrail network policy fqdn list + for (i in 0..fqdnCount-1) { + + int counting = i+1 + String fqdn = fqdnList[i] + + // Query AAI for this network policy FQDN + + String queryNetworkPolicyByFqdnAAIRequest = "${aai_endpoint}${aai_uri}?network-policy-fqdn=" + UriUtils.encode(fqdn, "UTF-8") + msoLogger.debug("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest) + + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkPolicyByFqdnAAIRequest) + int returnCode = response.getStatusCode() + execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", returnCode) + msoLogger.debug(" ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (isOneOf(returnCode, 200, 201)) { + msoLogger.debug("The return code is: " + returnCode) + // This network policy FQDN exists in AAI - need to delete it now + msoLogger.debug(aaiResponseAsString) + execution.setVariable("DDVFMV_queryNetworkPolicyByFqdnAAIResponse", aaiResponseAsString) + msoLogger.debug("QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString) + // Retrieve the network policy id for this FQDN + def networkPolicyId = utils.getNodeText(aaiResponseAsString, "network-policy-id") + msoLogger.debug("Deleting network-policy with network-policy-id " + networkPolicyId) + + // Retrieve the resource version for this network policy + def resourceVersion = utils.getNodeText(aaiResponseAsString, "resource-version") + msoLogger.debug("Deleting network-policy with resource-version " + resourceVersion) + + String delNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(networkPolicyId, "UTF-8") + + "?resource-version=" + UriUtils.encode(resourceVersion, "UTF-8") + msoLogger.debug("AAI request endpoint: " + delNetworkPolicyAAIRequest) + + msoLogger.debug("invoking DELETE call to AAI") + msoLogger.debug("Sending DELETE call to AAI with Endpoint /n" + delNetworkPolicyAAIRequest) + APIResponse responseDel = aaiUriUtil.executeAAIDeleteCall(execution, delNetworkPolicyAAIRequest) + int returnCodeDel = responseDel.getStatusCode() + execution.setVariable("DDVFMV_aaiDeleteNetworkPolicyReturnCode", returnCodeDel) + msoLogger.debug(" ***** AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + returnCodeDel) + + if (isOneOf(returnCodeDel, 200, 201, 204)) { + msoLogger.debug("The return code from deleting network policy is: " + returnCodeDel) + // This network policy was deleted from AAI successfully + msoLogger.debug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ") + + } else { + // aai all errors + String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + returnCodeDel + msoLogger.debug(delErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage) + } + } else if (returnCode == 404) { + // This network policy FQDN is not in AAI. No need to delete. + msoLogger.debug("The return code is: " + returnCode) + msoLogger.debug("This network policy FQDN is not in AAI: " + fqdn) + msoLogger.debug("Network policy FQDN is not in AAI") + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + returnCode + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + + + + } // end loop + + + } else { + msoLogger.debug("No contrail network policies to query/create") + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + } + + // and formulate the outgoing DeleteAAIVfModuleRequest request + public void prepDeleteAAIVfModule(DelegateExecution execution) { + + + def vnfId = execution.getVariable("vnfId") + def vfModuleId = execution.getVariable("vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """ + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + """ as String + msoLogger.debug("DeleteAAIVfModuleRequest :" + request) + + execution.setVariable("DeleteAAIVfModuleRequest", request) + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy new file mode 100644 index 0000000000..b1cef477be --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy @@ -0,0 +1,355 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils + +class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVfModuleVolumeV2.class); + + String prefix="DDVMV_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + XmlParser xmlParser = new XmlParser() + JsonUtils jsonUtil = new JsonUtils() + + @Override + public void preProcessRequest(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + preProcessRequest(execution, isDebugEnabled) + } + + /** + * Set default variable values + * @param execution + * @param isDebugLogEnabled + */ + public void preProcessRequest (DelegateExecution execution, isDebugEnabled) { + + //Input: + // msoRequestId + // isDebugLogEnabled + // failIfNotFound (Optional) + // serviceInstanceId (Optional) + // vnfId (Optional) + // volumeGroupId + // vfModuleModelInfo (Optional) + // lcpCloudRegionId (Optional) @TODO: this is actually required + // tenantId (Optional) @TODO: this is actually required + // cloudConfiguration @TODO: temporary solution? this contains lcpCloudregion and tenantId + // + //Output: + // workflowException @TODO: actual variable name is WorkflowException + // rolledBack + // wasDeleted + + execution.setVariable('prefix', prefix) + execution.setVariable('wasDeleted', 'false') + + def tenantId = execution.getVariable("tenantId") + def cloudSiteId = execution.getVariable("lcpCloudRegionId") + + // if tenantId or lcpCloudregionId is not passed, get it from cloudRegionConfiguration variable + if(!tenantId || !cloudSiteId) { + def cloudConfiguration = execution.getVariable("cloudConfiguration") + msoLogger.debug("Using cloudConfiguration variable to get tenantId and lcpCloudRegionId - " + cloudConfiguration) + tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId") + execution.setVariable("tenantId", tenantId) + cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId") + execution.setVariable("lcpCloudRegionId", cloudSiteId) + } + } + + + /** + * Set out 'wasDeleted' variable to 'true' + * @param execution + * @param isDebugLogEnabled + */ + public void postProcess(DelegateExecution execution, isDebugLogEnabled) { + execution.setVariable('wasDeleted', 'true') + } + + + /** + * Query and set cloud region to use for AAI calls + * Output variables: prefix+'aicCloudRegion', prefix+'cloudRegion' + * @param execution + * @param isDebugEnabled + */ + public void callRESTQueryAAICloudRegion(DelegateExecution execution, isDebugEnabled) { + + String cloudRegion = execution.getVariable('lcpCloudRegionId') + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint",execution) + AaiUtil aaiUtil = new AaiUtil(this) + String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) + String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion + msoLogger.debug(queryCloudRegionRequest) + msoLogger.debug("AAI query cloud region URI - " + queryCloudRegionRequest) + + cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) + + if ((cloudRegion != "ERROR")) { + if(execution.getVariable(prefix+"queryCloudRegionReturnCode") == "404") { + execution.setVariable(prefix+"aicCloudRegion", "AAIAIC25") + } + else{ + execution.setVariable(prefix+"aicCloudRegion", cloudRegion) + } + } + else { + msoLogger.debug("AAI Query Cloud Region Unsuccessful.") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")) + } + } + + + /** + * Query AAI Volume Group + * Output variables: prefix+'queryAAIVolGrpResponse'; prefix+'volumeGroupHeatStackId' + * @param execution + * @param isDebugLogEnabled + */ + public void callRESTQueryAAIForVolumeGroup(DelegateExecution execution, isDebugLogEnabled) { + + def tenantId = execution.getVariable('tenantId') + def volumeGroupId = execution.getVariable('volumeGroupId') + if(volumeGroupId == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, 'volumeGroupId is not provided in the request') + throw new Exception('volume-group-id is not provided in the request') + } + String cloudRegion = execution.getVariable(prefix+'aicCloudRegion') + + AaiUtil aaiUtil = new AaiUtil(this) + String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) + String queryAAIVolumeGroupRequest = aaiEndpoint + '/' + URLEncoder.encode(cloudRegion, "UTF-8") + "/volume-groups/volume-group/" + UriUtils.encode(volumeGroupId, "UTF-8") + + msoLogger.debug('Query AAI volume group by ID: ' + queryAAIVolumeGroupRequest) + msoLogger.debug('Query AAI volume group by ID: ' + queryAAIVolumeGroupRequest) + + APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIVolumeGroupRequest) + + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msoLogger.debug("AAI query volume group by id return code: " + returnCode) + msoLogger.debug("AAI query volume group by id response: " + aaiResponseAsString) + msoLogger.debug('AAI query volume group by id return code: ' + returnCode) + msoLogger.debug('AAI query volume group by id response: ' + aaiResponseAsString) + + execution.setVariable(prefix+"queryAAIVolGrpResponse", aaiResponseAsString) + + if (returnCode=='200' || returnCode == '204') { + + def heatStackId = getNodeTextForce(aaiResponseAsString, 'heat-stack-id') + execution.setVariable(prefix+'volumeGroupHeatStackId', heatStackId) + + msoLogger.debug('Heat stack id from AAI response: ' + heatStackId) + + if(hasVfModuleRelationship(aaiResponseAsString)){ + msoLogger.debug('Volume Group ' + volumeGroupId + ' currently in use') + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} currently in use - found vf-module relationship.") + } + + def volumeGroupTenantId = getTenantIdFromVolumeGroup(aaiResponseAsString) + msoLogger.debug('Tenant ID from AAI response: ' + volumeGroupTenantId) + + if (volumeGroupTenantId == null) { + msoLogger.debug("Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}") + } + + if (volumeGroupTenantId != tenantId) { + def String errorMessage = 'TenantId ' + tenantId + ' in incoming request does not match Tenant Id ' + volumeGroupTenantId + ' retrieved from AAI for Volume Group Id ' + volumeGroupId + msoLogger.debug("Error in DeleteVfModuleVolume: " + errorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, errorMessage) + } + msoLogger.debug('Received Tenant Id ' + volumeGroupTenantId + ' from AAI for Volume Group with Volume Group Id ' + volumeGroupId ) + } + else { + if (returnCode=='404') { + msoLogger.debug("Volume Group ${volumeGroupId} not found in AAI") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} not found in AAI. Response code: 404") + } + else { + WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + throw new BpmnError("MSOWorkflowException") + } + } + } + + /** + * Format VNF Adapter subflow request XML + * Variables: prefix+'deleteVnfARequest' + * @param execution + * @param isDebugLogEnabled + */ + public void prepareVnfAdapterDeleteRequest(DelegateExecution execution, isDebugLogEnabled) { + def cloudRegion = execution.getVariable(prefix+'aicCloudRegion') + def tenantId = execution.getVariable('tenantId') // input parameter (optional) - see preProcessRequest + def volumeGroupId = execution.getVariable('volumeGroupId') // input parameter (required) + def volumeGroupHeatStackId = execution.getVariable(prefix+'volumeGroupHeatStackId') // from AAI query volume group + def requestId = execution.getVariable('msoRequestId') // input parameter (required) + def serviceId = execution.getVariable('serviceInstanceId') // imput parameter (optional) + + def messageId = UUID.randomUUID().toString() + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) + def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) + if ('true'.equals(useQualifiedHostName)) { + notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) + } + + String vnfAdapterRestRequest = """ + + ${MsoUtils.xmlEscape(cloudRegion)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(volumeGroupId)} + ${MsoUtils.xmlEscape(volumeGroupHeatStackId)} + true + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(serviceId)} + + ${MsoUtils.xmlEscape(messageId)} + ${MsoUtils.xmlEscape(notificationUrl)} + + """ + vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest) + execution.setVariable(prefix+'deleteVnfARequest', vnfAdapterRestRequest) + msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest) + } + + + /** + * Delete volume group in AAI + * @param execution + * @param isDebugEnabled + */ + public void callRESTDeleteAAIVolumeGroup(DelegateExecution execution, isDebugEnabled) { + + // get variables + String queryAAIVolGrpIdResponse = execution.getVariable(prefix+"queryAAIVolGrpResponse") + String groupId = utils.getNodeText(queryAAIVolGrpIdResponse, "volume-group-id") + String resourceVersion = utils.getNodeText(queryAAIVolGrpIdResponse, "resource-version") + + String messageId = UUID.randomUUID().toString() + String cloudRegion = execution.getVariable(prefix+'aicCloudRegion') + + AaiUtil aaiUtil = new AaiUtil(this) + String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) + String deleteAAIVolumeGrpIdRequest = aaiEndpoint + '/' + URLEncoder.encode(cloudRegion, "UTF-8") + "/volume-groups/volume-group/" + UriUtils.encode(groupId, "UTF-8") + + if(resourceVersion !=null){ + deleteAAIVolumeGrpIdRequest = deleteAAIVolumeGrpIdRequest +'?resource-version=' + UriUtils.encode(resourceVersion, 'UTF-8') + } + + msoLogger.debug('Delete AAI volume group : ' + deleteAAIVolumeGrpIdRequest) + msoLogger.debug("Delete AAI volume group : " + deleteAAIVolumeGrpIdRequest) + + APIResponse response = aaiUtil.executeAAIDeleteCall(execution, deleteAAIVolumeGrpIdRequest) + + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msoLogger.debug("AAI delete volume group return code: " + returnCode) + msoLogger.debug("AAI delete volume group response: " + aaiResponseAsString) + msoLogger.debug("AAI delete volume group return code: " + returnCode) + msoLogger.debug("AAI delete volume group response: " + aaiResponseAsString) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + if (returnCode=='200' || (returnCode == '204')) { + msoLogger.debug("Volume group $groupId deleted.") + } else { + if (returnCode=='404') { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume group $groupId not found for delete in AAI Response code: 404") + } else { + WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + throw new BpmnError("MSOWorkflowException") + } + } + } + + + /** + * Check if volume group has a relationship to vf-module + * @param volumeGroupXml + * @return + */ + private boolean hasVfModuleRelationship(String volumeGroupXml) { + def Node volumeGroupNode = xmlParser.parseText(volumeGroupXml) + def Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list') + if (relationshipList != null) { + def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') + for (Node relationship in relationships) { + def Node relatedTo = utils.getChildNode(relationship, 'related-to') + if ((relatedTo != null) && (relatedTo.text().equals('vf-module'))) { + def Node relatedLink = utils.getChildNode(relationship, 'related-link') + if (relatedLink !=null && relatedLink.text() != null){ + return true + } + } + } + } + return false + } + + + /** + * Extract the Tenant Id from the Volume Group information returned by AAI. + * @param volumeGroupXml Volume Group XML returned by AAI. + * @return the Tenant Id extracted from the Volume Group information. 'null' is returned if + * the Tenant Id is missing or could not otherwise be extracted. + */ + private String getTenantIdFromVolumeGroup(String volumeGroupXml) { + def Node volumeGroupNode = xmlParser.parseText(volumeGroupXml) + def Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list') + if (relationshipList != null) { + def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') + for (Node relationship in relationships) { + def Node relatedTo = utils.getChildNode(relationship, 'related-to') + if ((relatedTo != null) && (relatedTo.text().equals('tenant'))) { + def NodeList relationshipDataList = utils.getIdenticalChildren(relationship, 'relationship-data') + for (Node relationshipData in relationshipDataList) { + def Node relationshipKey = utils.getChildNode(relationshipData, 'relationship-key') + if ((relationshipKey != null) && (relationshipKey.text().equals('tenant.tenant-id'))) { + def Node relationshipValue = utils.getChildNode(relationshipData, 'relationship-value') + if (relationshipValue != null) { + return relationshipValue.text() + } + } + } + } + } + } + return null + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy new file mode 100644 index 0000000000..699e9bf40a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy @@ -0,0 +1,161 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + + +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource + +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +/** + * This class supports the DoDeleteVnf subFlow + * with the Deletion of a generic vnf for + * infrastructure. + * + */ +class DoDeleteVnf extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVnf.class); + + String Prefix="DoDVNF_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + + /** + * This method gets and validates the incoming + * request. + * + * @param - execution + * + */ + public void preProcessRequest(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED DoDeleteVnf PreProcessRequest Process") + + execution.setVariable("DoDVNF_SuccessIndicator", false) + execution.setVariable("DoDVNF_vnfInUse", false) + + try{ + // Get Variables + + String vnfId = execution.getVariable("vnfId") + execution.setVariable("DoDVNF_vnfId", vnfId) + msoLogger.debug("Incoming Vnf(Instance) Id is: " + vnfId) + + // Setting for sub flow calls + execution.setVariable("DoDVNF_type", "generic-vnf") + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug(" Error Occured in DoDeleteVnf PreProcessRequest method!" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoDeleteVnf PreProcessRequest") + + } + msoLogger.trace("COMPLETED DoDeleteVnf PreProcessRequest Process ") + } + + + public void processGetVnfResponse(DelegateExecution execution){ + + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED DoDeleteVnf processGetVnfResponse Process ") + try { + String vnf = execution.getVariable("DoDVNF_genericVnf") + String resourceVersion = utils.getNodeText(vnf, "resource-version") + execution.setVariable("DoDVNF_resourceVersion", resourceVersion) + + if(utils.nodeExists(vnf, "relationship")){ + InputSource source = new InputSource(new StringReader(vnf)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document vnfXml = docBuilder.parse(source) + + NodeList nodeList = vnfXml.getElementsByTagName("relationship") + for (int x = 0; x < nodeList.getLength(); x++) { + Node node = nodeList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() + if(e.equals("volume-group") || e.equals("l3-network")){ + msoLogger.debug("Generic Vnf still has relationship to OpenStack.") + execution.setVariable("DoDVNF_vnfInUse", true) + }else{ + msoLogger.debug("Relationship NOT related to OpenStack") + } + } + } + } + + if(utils.nodeExists(vnf, "vf-module")){ + execution.setVariable("DoDVNF_vnfInUse", true) + msoLogger.debug("Generic Vnf still has vf-modules.") + } + + + } catch (Exception ex) { + msoLogger.debug("Error Occured in DoDeleteVnf processGetVnfResponse Process " + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoDeleteVnf processGetVnfResponse Process") + + } + msoLogger.trace("COMPLETED DoDeleteVnf processGetVnfResponse Process ") + } + + /** + * Deletes the generic vnf from aai + */ + public void deleteVnf(DelegateExecution execution) { + msoLogger.trace("STARTED deleteVnf") + try { + String vnfId = execution.getVariable("DoDVNF_vnfId") + + AAIResourcesClient resourceClient = new AAIResourcesClient(); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + resourceClient.delete(uri) + + msoLogger.trace("COMPLETED deleteVnf") + } catch (Exception ex) { + msoLogger.debug("Error Occured in DoDeleteVnf deleteVnf Process " + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoDeleteVnf deleteVnf Process") + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy new file mode 100644 index 0000000000..d448dd3e79 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy @@ -0,0 +1,538 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.json.JSONArray; +import org.json.JSONObject; +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ModuleResource +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils; + +/** + * This class supports the macro VID Flow + * with the deletion of a generic vnf and related VF modules. + */ +class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVnfAndModules.class); + + String Prefix="DDVAM_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + + /** + * This method gets and validates the incoming + * request. + * + * @param - execution + * + */ + public void preProcessRequest(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED DoDeleteVnfAndModules PreProcessRequest Process") + + try{ + // Get Variables + + String cloudConfiguration = execution.getVariable("cloudConfiguration") + msoLogger.debug("Cloud Configuration: " + cloudConfiguration) + + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("requestId", requestId) + execution.setVariable("mso-request-id", requestId) + msoLogger.debug("Incoming Request Id is: " + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + + String vnfId = execution.getVariable("vnfId") + msoLogger.debug("Incoming Vnf Id is: " + vnfId) + + String source = "VID" + execution.setVariable("DDVAM_source", source) + msoLogger.debug("Incoming Source is: " + source) + + execution.setVariable("DDVAM_isVidRequest", "true") + + String sdncVersion = execution.getVariable("sdncVersion") + if (sdncVersion == null) { + sdncVersion = "1702" + } + execution.setVariable("DDVAM_sdncVersion", sdncVersion) + msoLogger.debug("Incoming Sdnc Version is: " + sdncVersion) + + // Set aLaCarte flag to false + execution.setVariable("aLaCarte", false) + + String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback", execution) + if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { + def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception"); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + msoLogger.debug("SDNC Callback URL is: " + sdncCallbackUrl) + + + if (!sdncVersion.equals("1702")) { + //String vnfModelInfo = execution.getVariable("vnfModelInfo") + //String serviceModelInfo = execution.getVariable("serviceModelInfo") + + String serviceId = execution.getVariable("productFamilyId") + execution.setVariable("DDVAM_serviceId", serviceId) + msoLogger.debug("Incoming Service Id is: " + serviceId) + + + //String modelInvariantId = jsonUtil.getJsonValue(vnfModelInfo, "modelInvariantId") + //execution.setVariable("DDVAM_modelInvariantId", modelInvariantId) + //msoLogger.debug("Incoming Invariant Id is: " + modelInvariantId) + + //String modelVersionId = jsonUtil.getJsonValue(vnfModelInfo, "modelVersionId") + //if (modelVersionId == null) { + // modelVersionId = "" + //} + //execution.setVariable("DDVAM_modelVersionId", modelVersionId) + //msoLogger.debug("Incoming Version Id is: " + modelVersionId) + + //String modelVersion = jsonUtil.getJsonValue(vnfModelInfo, "modelVersion") + //execution.setVariable("DDVAM_modelVersion", modelVersion) + //msoLogger.debug("Incoming Model Version is: " + modelVersion) + + //String modelName = jsonUtil.getJsonValue(vnfModelInfo, "modelName") + //execution.setVariable("DDVAM_modelName", modelName) + //msoLogger.debug("Incoming Model Name is: " + modelName) + + //String modelCustomizationId = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationId") + //if (modelCustomizationId == null) { + // modelCustomizationId = "" + //} + //execution.setVariable("DDVAM_modelCustomizationId", modelCustomizationId) + //msoLogger.debug("Incoming Model Customization Id is: " + modelCustomizationId) + + String cloudSiteId = execution.getVariable("lcpCloudRegionId") + execution.setVariable("DDVAM_cloudSiteId", cloudSiteId) + msoLogger.debug("Incoming Cloud Site Id is: " + cloudSiteId) + + String tenantId = execution.getVariable("tenantId") + execution.setVariable("DDVAM_tenantId", tenantId) + msoLogger.debug("Incoming Tenant Id is: " + tenantId) + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + if (globalSubscriberId == null) { + globalSubscriberId = "" + } + execution.setVariable("DDVAM_globalSubscriberId", globalSubscriberId) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + + } + execution.setVariable("DDVAM_vfModulesFromDecomposition", null) + // Retrieve serviceDecomposition if present + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + if (serviceDecomposition != null) { + msoLogger.debug("Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString()) + List vnfs = serviceDecomposition.getVnfResources() + msoLogger.debug("Read vnfs") + if (vnfs == null) { + msoLogger.debug("Error - vnfs are empty in serviceDecomposition object") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in preProcessRequest - vnfs are empty") + } + VnfResource vnf = vnfs[0] + + if (vnf == null) { + msoLogger.debug("Error - vnf is empty in serviceDecomposition object") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in preProcessRequest - vnf is empty") + } + + List vfModules = vnf.getAllVfModuleObjects() + + execution.setVariable("DDVAM_vfModulesFromDecomposition", vfModules) + } + + execution.setVariable("DDVAM_moduleCount", 0) + execution.setVariable("DDVAM_nextModule", 0) + + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug(" Error Occured in DoCreateVnfAndModules PreProcessRequest method!" + e.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest") + + } + msoLogger.trace("COMPLETED DoDeleteVnfAndModules PreProcessRequest Process ") + } + + + + public void preProcessAddOnModule(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessAddOnModule ") + + try { + JSONArray addOnModules = (JSONArray) execution.getVariable("addOnModules") + int addOnIndex = (int) execution.getVariable("addOnModulesDeployed") + + JSONObject addOnModule = addOnModules[addOnIndex] + + def newVfModuleId = UUID.randomUUID().toString() + execution.setVariable("addOnVfModuleId", newVfModuleId) + + execution.setVariable("instancesOfThisModelDeployed", 0) + + JSONObject addOnVfModuleModelInfoObject = jsonUtil.getJsonValueForKey(addOnModule, "modelInfo") + String addOnVfModuleModelInfo = addOnVfModuleModelInfoObject.toString() + execution.setVariable("addOnVfModuleModelInfo", addOnVfModuleModelInfo) + String addOnVfModuleLabel = jsonUtil.getJsonValueForKey(addOnModule, "vfModuleLabel") + execution.setVariable("addOnVfModuleLabel", addOnVfModuleLabel) + String addOnPersonaModelId = jsonUtil.getJsonValueForKey(addOnVfModuleModelInfoObject, "modelInvariantUuid") + execution.setVariable("addOnPersonaModelId", addOnPersonaModelId) + String addOnInitialCount = jsonUtil.getJsonValueForKey(addOnModule, "initialCount") + execution.setVariable("initialCount", addOnInitialCount) + + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCAssignRequest ") + } + + /** + * Using the received vnfId and vfModuleId, query AAI to get the corresponding VNF info. + * A 200 response is expected with the VNF info in the response body. Will find out the base module info. + * + * @param execution The flow's execution instance. + */ + public void queryAAIVfModule(DelegateExecution execution) { + + def method = getClass().getSimpleName() + '.queryAAIVfModule(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('vnfId') + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" + msoLogger.debug("AAI endPoint: " + endPoint) + + try { + msoLogger.debug("createVfModule - invoking httpGet() to AAI") + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint) + + def responseData = response.getResponseBodyAsString() + if (responseData != null) { + msoLogger.debug("Received generic VNF data: " + responseData) + + } + + msoLogger.debug("createVfModule - queryAAIVfModule Response: " + responseData) + msoLogger.debug("createVfModule - queryAAIVfModule ResponseCode: " + response.getStatusCode()) + + execution.setVariable('DCVFM_queryAAIVfModuleResponseCode', response.getStatusCode()) + execution.setVariable('DCVFM_queryAAIVfModuleResponse', responseData) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + //Map[] vfModules = new HashMap[] + List vfModulesFromDecomposition = execution.getVariable("DDVAM_vfModulesFromDecomposition") + def vfModulesList = new ArrayList>() + def vfModules = null + def vfModuleBaseEntry = null + if (response.getStatusCode() == 200) { + // Parse the VNF record from A&AI to find base module info + msoLogger.debug('Parsing the VNF data to find base module info') + if (responseData != null) { + def vfModulesText = utils.getNodeXml(responseData, "vf-modules") + msoLogger.debug("vModulesText: " + vfModulesText) + if (vfModulesText != null && !vfModulesText.trim().isEmpty()) { + def xmlVfModules= new XmlSlurper().parseText(vfModulesText) + vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} + execution.setVariable("DDVAM_moduleCount", vfModules.size()) + int vfModulesSize = 0 + ModelInfo vfModuleModelInfo = null + for (i in 0..vfModules.size()-1) { + def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i]) + + Map vfModuleEntry = new HashMap() + def vfModuleId = utils.getNodeText(vfModuleXml, "vf-module-id") + vfModuleEntry.put("vfModuleId", vfModuleId) + def vfModuleName = utils.getNodeText(vfModuleXml, "vf-module-name") + vfModuleEntry.put("vfModuleName", vfModuleName) + + // Find the model for this vf module in decomposition if specified + if (vfModulesFromDecomposition != null) { + msoLogger.debug("vfModulesFromDecomposition is not null") + def vfModuleUuid = utils.getNodeText(vfModuleXml, "model-version-id") + if (vfModuleUuid == null) { + vfModuleUuid = utils.getNodeText(vfModuleXml, "persona-model-version") + } + msoLogger.debug("vfModule UUID is: " + vfModuleUuid) + for (j in 0..vfModulesFromDecomposition.size()-1) { + ModuleResource mr = vfModulesFromDecomposition[j] + if (mr.getModelInfo().getModelUuid() == vfModuleUuid) { + msoLogger.debug("Found modelInfo") + vfModuleModelInfo = mr.getModelInfo() + break + } + + } + } + if (vfModuleModelInfo != null) { + String vfModuleModelInfoString = vfModuleModelInfo.toString() + def vfModuleModelInfoValue = jsonUtil.getJsonValue(vfModuleModelInfoString, "modelInfo") + vfModuleEntry.put("vfModuleModelInfo", vfModuleModelInfoValue) + } + else { + vfModuleEntry.put("vfModuleModelInfo", null) + } + + + def isBaseVfModule = utils.getNodeText(vfModuleXml, "is-base-vf-module") + // Save base vf module for last + if (isBaseVfModule == "true") { + vfModuleBaseEntry = vfModuleEntry + } + else { + vfModulesList.add(vfModuleEntry) + } + } + if (vfModuleBaseEntry != null) { + vfModulesList.add(vfModuleBaseEntry) + } + } + + } + } + execution.setVariable("DDVAM_vfModules", vfModulesList) + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) + } + } + + public void prepareNextModuleToDelete(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED prepareNextModuleToDelete ") + + try { + int i = execution.getVariable("DDVAM_nextModule") + def vfModules = execution.getVariable("DDVAM_vfModules") + def vfModule = vfModules[i] + + def vfModuleId = vfModule.get("vfModuleId") + execution.setVariable("DDVAM_vfModuleId", vfModuleId) + + def vfModuleName = vfModule.get("vfModuleName") + execution.setVariable("DDVAM_vfModuleName", vfModuleName) + + def vfModuleModelInfo = vfModule.get("vfModuleModelInfo") + msoLogger.debug("vfModuleModelInfo for module delete: " + vfModuleModelInfo) + execution.setVariable("DDVAM_vfModuleModelInfo", vfModuleModelInfo) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToDelete Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED prepareNextModuleToDelete ") + } + + public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessSDNCDeactivateRequest ") + def vnfId = execution.getVariable("vnfId") + def serviceInstanceId = execution.getVariable("serviceInstanceId") + + try{ + //Build SDNC Request + + String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate") + + deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest) + execution.setVariable("DDVAM_deactivateSDNCRequest", deactivateSDNCRequest) + msoLogger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) + msoLogger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCDeactivateRequest." + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCDeactivateRequest ") + } + + public void preProcessSDNCUnassignRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED preProcessSDNCUnassignRequest Process ") + try{ + String vnfId = execution.getVariable("vnfId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign") + + execution.setVariable("DDVAM_unassignSDNCRequest", unassignSDNCRequest) + msoLogger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) + msoLogger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) + + }catch(Exception e){ + msoLogger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preProcessSDNCUnassignRequest Process ") + } + + public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis() + } + def callbackURL = execution.getVariable("sdncCallbackUrl") + def requestId = execution.getVariable("msoRequestId") + def serviceId = execution.getVariable("DDVAM_serviceId") + def tenantId = execution.getVariable("DDVAM_tenantId") + def source = execution.getVariable("DDVAM_source") + def vnfId = execution.getVariable("vnfId") + def serviceInstanceId = execution.getVariable("serviceInstanceId") + def cloudSiteId = execution.getVariable("DDVAM_cloudSiteId") + def modelCustomizationId = execution.getVariable("DDVAM_modelCustomizationId") + //def serviceModelInfo = execution.getVariable("serviceModelInfo") + //def vnfModelInfo = execution.getVariable("vnfModelInfo") + //String serviceEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(serviceModelInfo) + //String vnfEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(vnfModelInfo) + def globalSubscriberId = execution.getVariable("DDVAM_globalSubscriberId") + def sdncVersion = execution.getVariable("DDVAM_sdncVersion") + + String sdncRequest = + """ + + ${MsoUtils.xmlEscape(uuid)} + ${MsoUtils.xmlEscape(svcInstId)} + ${MsoUtils.xmlEscape(action)} + vnf-topology-operation + ${MsoUtils.xmlEscape(callbackURL)} + generic-resource + + + + ${MsoUtils.xmlEscape(requestId)} + DeleteVnfInstance + ${MsoUtils.xmlEscape(source)} + + + + + + + + ${MsoUtils.xmlEscape(serviceInstanceId)} + + + + ${MsoUtils.xmlEscape(vnfId)} + + + + + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(cloudSiteId)} + + + """ + + msoLogger.debug("sdncRequest: " + sdncRequest) + return sdncRequest + } + + public void validateSDNCResponse(DelegateExecution execution, String response, String method){ + + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED ValidateSDNCResponse Process") + + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + msoLogger.debug("workflowException: " + workflowException) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + msoLogger.debug("SDNCResponse: " + response) + + String sdncResponse = response + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) + }else{ + msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + throw new BpmnError("MSOWorkflowException") + } + msoLogger.trace("COMPLETED ValidateSDNCResponse Process") + } + + + + + + + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy new file mode 100644 index 0000000000..41d9384f52 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy @@ -0,0 +1,142 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. * + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray; +import org.json.JSONObject; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.springframework.web.util.UriUtils; + + + +/** + * This groovy class supports the DoScaleServiceInstance.bpmn process. + * + */ +public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoScaleE2EServiceInstance.class); + + + String Prefix = "DCRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest(DelegateExecution execution) { + String msg = "" + msoLogger.trace("preProcessRequest ") + + try { + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("prefix", Prefix) + + //Inputs + String globalSubscriberId = execution.getVariable("globalSubscriberId") + + String serviceType = execution.getVariable("serviceType") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + execution.setVariable("serviceType", serviceType) + + String resourceTemplateUUIDs = "" + String scaleNsRequest = execution.getVariable("bpmnRequest") + JSONObject jsonObject = new JSONObject(scaleNsRequest).getJSONObject("service") + JSONArray jsonArray = jsonObject.getJSONArray("resources") + + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject reqBodyJsonObj = jsonArray.getJSONObject(i) + String nsInstanceId = reqBodyJsonObj.getString("resourceInstanceId") + resourceTemplateUUIDs = resourceTemplateUUIDs + nsInstanceId + ":" + } + + execution.setVariable("resourceTemplateUUIDs", resourceTemplateUUIDs) + + if (serviceInstanceName == null) { + execution.setVariable("serviceInstanceName", "") + } + if (isBlank(serviceInstanceId)) { + msg = "Input serviceInstanceId is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest ") + } + + + public void preInitResourcesOperStatus(DelegateExecution execution){ + msoLogger.trace("STARTED preInitResourcesOperStatus Process ") + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = "SCALE" + + // resourceTemplateUUIDs should be created ?? + String resourceTemplateUUIDs = execution.getVariable("resourceTemplateUUIDs") + msoLogger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + + execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + String payload = + """ + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(operationId)} + ${MsoUtils.xmlEscape(operationType)} + ${MsoUtils.xmlEscape(resourceTemplateUUIDs)} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_initResOperStatusRequest", payload) + msoLogger.info("Outgoing initResourceOperationStatus: \n" + payload) + msoLogger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED preInitResourcesOperStatus Process ") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy new file mode 100644 index 0000000000..e06e5238c6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy @@ -0,0 +1,332 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray +import org.json.JSONObject; + +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.json.JsonUtils + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import com.fasterxml.jackson.databind.ObjectMapper + +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.rest.APIResponse; + +import org.onap.so.bpmn.infrastructure.vfcmodel.ScaleResource +import org.onap.so.bpmn.infrastructure.vfcmodel.ScaleNsByStepsData +import org.onap.so.bpmn.infrastructure.vfcmodel.ScaleNsData + +import org.onap.so.bpmn.infrastructure.vfcmodel.NSResourceInputParameter +import org.onap.so.bpmn.infrastructure.vfcmodel.NsOperationKey +import org.onap.so.bpmn.infrastructure.vfcmodel.NsScaleParameters +import org.onap.so.bpmn.infrastructure.vfcmodel.NsParameters +import org.onap.so.bpmn.infrastructure.vfcmodel.LocationConstraint +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + + +/** + * This groovy class supports the DoScaleVFCNetworkServiceInstance.bpmn process. + * flow for VFC Network Service Scale + */ +public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoScaleVFCNetworkServiceInstance.class); + + + String host = "http://mso.mso.testlab.openecomp.org:8080" + + String scaleUrl = "/vfc/rest/v1/vfcadapter/ns/{nsInstanceId}/scale" + + String queryJobUrl = "/vfc/rest/v1/vfcadapter/jobs/{jobId}" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + public void preProcessRequest(DelegateExecution execution) { + msoLogger.trace("preProcessRequest() ") + + List nsRIPList = convertScaleNsReq2NSResInputParamList(execution) + String requestJsonStr = "" + int size = nsRIPList.size() + for (int i = 0; i < size; i++) { + NSResourceInputParameter nsRIP = nsRIPList.get(i) + + if (i == size - 1) { + requestJsonStr += objectToJsonStr(nsRIP) + } else { + requestJsonStr += objectToJsonStr(nsRIP) + "|" + } + } + + execution.setVariable("reqBody", requestJsonStr) + + msoLogger.trace("Exit preProcessRequest ") + } + + /** + * scale NS task + */ + public void scaleNetworkService(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + + String saleNsRequest = execution.getVariable("reqBody") + String[] nsReqStr = saleNsRequest.split("\\|") + + for (int i = 0; i < nsReqStr.length; i++) { + JSONObject reqBodyJsonObj = new JSONObject(nsReqStr[i]) + String nsInstanceId = reqBodyJsonObj.getJSONObject("nsScaleParameters").getString("nsInstanceId") + String nodeTemplateUUID = reqBodyJsonObj.getJSONObject("nsOperationKey").getString("nodeTemplateUUID") + reqBodyJsonObj.getJSONObject("nsScaleParameters").remove("nsInstanceId") + String reqBody = reqBodyJsonObj.toString() + + String url = host + scaleUrl.replaceAll("\\{nsInstanceId\\}", nsInstanceId) + + APIResponse apiResponse = postRequest(execution, url, reqBody) + + String returnCode = apiResponse.getStatusCode() + String aaiResponseAsString = apiResponse.getResponseBodyAsString() + String jobId = "" + if (returnCode == "200" || returnCode == "202") { + jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") + } + utils.log("INFO", "scaleNetworkService get a ns scale job Id:" + jobId, isDebugEnabled) + execution.setVariable("jobId", jobId) + execution.setVariable("nodeTemplateUUID", nodeTemplateUUID) + + String isScaleFinished = "" + + if(jobId =="" || jobId == null){ + continue + } + // query the requested network service scale status, if finished, then start the next one, otherwise, wait + while (isScaleFinished != "finished" && isScaleFinished != "error"){ + timeDelay() + queryNSProgress(execution) + isScaleFinished = execution.getVariable("operationStatus") + } + } + } + + /** + * query NS task + */ + private void queryNSProgress(DelegateExecution execution) { + String jobId = execution.getVariable("jobId") + String url = host + queryJobUrl.replaceAll("\\{jobId\\}", jobId) + + NsOperationKey nsOperationKey = new NsOperationKey() + // is this net work service ID or E2E service ID? + nsOperationKey.setServiceId(execution.getVariable("serviceId")) + nsOperationKey.setServiceType(execution.getVariable("serviceType")) + nsOperationKey.setGlobalSubscriberId(execution.getVariable("globalSubscriberId")) + nsOperationKey.setNodeTemplateUUID(execution.getVariable("nodeTemplateUUID")) + nsOperationKey.setOperationId(execution.getVariable("operationId")) + String queryReqBody = objectToJsonStr(nsOperationKey) + + APIResponse apiResponse = postRequest(execution,url, queryReqBody) + + String returnCode = apiResponse.getStatusCode() + String aaiResponseAsString = apiResponse.getResponseBodyAsString() + + String operationStatus = "error" + + if (returnCode == "200") { + operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status") + } + + execution.setVariable("operationStatus", operationStatus) + } + + /** + * delay 5 sec + * + */ + private void timeDelay() { + try { + Thread.sleep(5000) + } catch (InterruptedException e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Time Delay exception" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + } + } + + /** + * finish NS task + */ + public void finishNSScale(DelegateExecution execution) { + //no need to do anything util now + System.out.println("Scale finished.") + } + + /** + * post request + * url: the url of the request + * requestBody: the body of the request + */ + private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ + msoLogger.trace("Started Execute VFC adapter Post Process ") + msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody) + APIResponse apiResponse = null + try{ + RESTConfig config = new RESTConfig(url) + RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk") +// RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk") + apiResponse = client.httpPost(requestBody) + msoLogger.info("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString()) + msoLogger.trace("Completed Execute VF-C adapter Post Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VFC Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + throw new BpmnError("MSOWorkflowException") + } + return apiResponse + } + + /** + * create a Scale Resource object list from a NSScaleRequestJso nString + * This method is for the specific request from Scale Network Service BPMN workflow + * @param nsScaleRequestJsonString , a specific request Json string which conform to ?? class + * @return List < ScaleResource > + */ + private List jsonGetNsResourceList(String nsScaleRequestJsonString) { + List list = new ArrayList() + JSONObject jsonObject = new JSONObject(nsScaleRequestJsonString) + + JSONObject jsonResource = jsonObject.getJSONObject("service") + JSONArray arr = jsonResource.getJSONArray("resources") + + for (int i = 0; i < arr.length(); i++) { + JSONObject tempResource = arr.getJSONObject(i) + ScaleResource resource = new ScaleResource() + resource.setResourceInstanceId(tempResource.getString("resourceInstanceId")) + resource.setScaleType(tempResource.getString("scaleType")) + + JSONObject jsonScaleNsData = tempResource.getJSONObject("scaleNsData") + JSONObject jsonScaleNsByStepData = jsonScaleNsData.getJSONObject("scaleNsByStepsData") + + ScaleNsData scaleNsData = new ScaleNsData() + ScaleNsByStepsData stepsData = new ScaleNsByStepsData() + + stepsData.setAspectId(jsonScaleNsByStepData.getString("aspectId")) + stepsData.setScalingDirection(jsonScaleNsByStepData.getString("scalingDirection")) + stepsData.setNumberOfSteps(Integer.parseInt(jsonScaleNsByStepData.getString("numberOfSteps"))) + + scaleNsData.setScaleNsByStepsData(stepsData) + resource.setScaleNsData(scaleNsData) + list.add(resource) + } + + return list + } + + /** + * Convert a java class to JSON string + * @param obj + * @return + */ + private String objectToJsonStr(Object obj) { + ObjectMapper mapper = new ObjectMapper() + String jsonStr = null + try { + jsonStr = mapper.writeValueAsString(obj) + } catch (IOException ioe) { + System.out.println(ioe.getMessage()) + } + return jsonStr + + } + + /** + * create a NSResourceInputParameter list from a Scale Network request Json string + * @return + */ + private List convertScaleNsReq2NSResInputParamList(DelegateExecution execution) { + String saleNsRequest = execution.getVariable("bpmnRequest") + + //String requestId = execution.getVariable("msoRequestId") + //String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + //String nodeTemplateUUID = execution.getVariable("nodeTemplateUUID") + String serviceType = execution.getVariable("serviceType") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String operationId = execution.getVariable("operationId") + String serviceId = execution.getVariable("serviceId") + String nsServiceDescription = execution.getVariable("requestDescription") + + String resource = JsonUtils.getJsonValue(saleNsRequest, "service.resources") + + // set nsScaleParameters properties + List scaleResourcesList = jsonGetNsResourceList(saleNsRequest) + List nsResourceInputParameterList = new ArrayList() + + for (ScaleResource sr : scaleResourcesList) { + NSResourceInputParameter nsResourceInputParameter = new NSResourceInputParameter() + NsOperationKey nsOperationKey = new NsOperationKey() + NsParameters nsParameters = new NsParameters() + NsScaleParameters nsScaleParameters = new NsScaleParameters() + nsParameters.setLocationConstraints(new ArrayList()) + nsParameters.setAdditionalParamForNs(new HashMap()) + + // set NsOperationKey properties + nsOperationKey.setGlobalSubscriberId(globalSubscriberId) + nsOperationKey.setServiceId(serviceId) + nsOperationKey.setServiceType(serviceType) + // for ns scale the resourceInstanceId is the nodeTemplateUUID + nsOperationKey.setNodeTemplateUUID(sr.getResourceInstanceId()) + nsOperationKey.setOperationId(operationId) + + nsScaleParameters.setScaleType(sr.getScaleType()) + nsScaleParameters.setNsInstanceId(sr.getResourceInstanceId()) + + ScaleNsByStepsData scaleNsByStepsData = new ScaleNsByStepsData() + scaleNsByStepsData.setScalingDirection(sr.getScaleNsData().getScaleNsByStepsData().getScalingDirection()) + scaleNsByStepsData.setNumberOfSteps(sr.getScaleNsData().getScaleNsByStepsData().getNumberOfSteps()) + scaleNsByStepsData.setAspectId(sr.getScaleNsData().getScaleNsByStepsData().getAspectId()) + + List scaleNsByStepsDataList = new ArrayList() + scaleNsByStepsDataList.add(scaleNsByStepsData) + nsScaleParameters.setScaleNsByStepsData(scaleNsByStepsDataList) + + nsResourceInputParameter.setNsOperationKey(nsOperationKey) + nsResourceInputParameter.setNsServiceName(serviceInstanceName) + nsResourceInputParameter.setNsServiceDescription(nsServiceDescription) + nsResourceInputParameter.setNsParameters(nsParameters) + nsResourceInputParameter.setNsScaleParameters(nsScaleParameters) + + nsResourceInputParameterList.add(nsResourceInputParameter) + } + return nsResourceInputParameterList + } +} + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy new file mode 100644 index 0000000000..5fb6a9df9a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy @@ -0,0 +1,451 @@ +/*- + * ============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.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.json.JsonUtils +import org.springframework.web.util.UriUtils; + +import groovy.json.* + + +/** + * This groovy class supports the DoUpdateE2EServiceInstance.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId + * @param - serviceType + * @param - serviceInstanceId + * @param - serviceInstanceName + * @param - serviceModelInfo + * @param - productFamilyId + * @param - uuiRequest + * @param - serviceDecomposition_Target + * @param - serviceDecomposition_Original + * @param - addResourceList + * @param - delResourceList + * + * Outputs: + * @param - rollbackData (localRB->null) + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * @param - WorkflowException + */ +public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { + + String Prefix="DUPDSI_" + private static final String DebugFlag = "isDebugEnabled" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Enter DoUpdateE2EServiceInstance preProcessRequest *****", isDebugEnabled) + + String msg = "" + + try { + execution.setVariable("prefix", Prefix) + //Inputs + //for AAI GET & PUT & SDNC assignToplology + String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled) + + //for AAI PUT & SDNC assignTopology + String serviceType = execution.getVariable("serviceType") + utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled) + + //for SDNC assignTopology + String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId + + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + if (isBlank(serviceType)) { + msg = "Input serviceType is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + //Generated in parent for AAI + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)){ + msg = "Input serviceInstanceId is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String serviceInstanceName = execution.getVariable("serviceInstanceName") + + // user params + String uuiRequest = execution.getVariable("uuiRequest") + + // target model Invariant uuid + String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") + execution.setVariable("modelInvariantUuid", modelInvariantUuid) + utils.log("INFO", "modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled) + + // target model uuid + String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") + execution.setVariable("modelUuid", modelUuid) + + utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO", "======== COMPLETED preProcessRequest Process ======== ", isDebugEnabled) + } + + + public void preInitResourcesOperStatus(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + + utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = execution.getVariable("operationType") + String resourceTemplateUUIDs = "" + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service updating" + utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + + List resourceList = new ArrayList() + List addResourceList = execution.getVariable("addResourceList") + List delResourceList = execution.getVariable("delResourceList") + resourceList.addAll(addResourceList) + resourceList.addAll(delResourceList) + for(Resource resource : resourceList){ + resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" + } + + def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + + String payload = + """ + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(operationId)} + ${MsoUtils.xmlEscape(operationType)} + ${MsoUtils.xmlEscape(resourceTemplateUUIDs)} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_initResOperStatusRequest", payload) + utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled) + utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) + } + utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + } + + + public void preProcessForAddResource(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** preProcessForAddResource ***** ", isDebugEnabled) + + execution.setVariable("operationType", "create") + + execution.setVariable("hasResourcetoAdd", false) + List addResourceList = execution.getVariable("addResourceList") + if(addResourceList != null && !addResourceList.isEmpty()) { + execution.setVariable("hasResourcetoAdd", true) + } + + utils.log("INFO"," *** Exit preProcessForAddResource *** ", isDebugEnabled) + } + + public void postProcessForAddResource(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** postProcessForAddResource ***** ", isDebugEnabled) + + execution.setVariable("operationType", "update") + + utils.log("INFO"," *** Exit postProcessForAddResource *** ", isDebugEnabled) + } + + public void preProcessForDeleteResource(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** preProcessForDeleteResource ***** ", isDebugEnabled) + + execution.setVariable("operationType", "delete") + + def hasResourcetoDelete = false + List delResourceList = execution.getVariable("delResourceList") + if(delResourceList != null && !delResourceList.isEmpty()) { + hasResourcetoDelete = true + } + execution.setVariable("hasResourcetoDelete", hasResourcetoDelete) + + if(hasResourcetoDelete) { + def jsonSlurper = new JsonSlurper() + String serviceRelationShip = execution.getVariable("serviceRelationShip") + List relationShipList = jsonSlurper.parseText(serviceRelationShip) + + //Set the real resource instance id to the decomosed resource list + for(Resource resource: delResourceList){ + //reset the resource instance id , because in the decompose flow ,its a random one. + resource.setResourceId(""); + //match the resource-instance-name and the model name + if (relationShipList != null) { + relationShipList.each { + if(StringUtils.containsIgnoreCase(it.resourceType, resource.getModelInfo().getModelName())){ + resource.setResourceId(it.resourceInstanceId); + } + } + } + } + } + + execution.setVariable("deleteResourceList", delResourceList) + + utils.log("INFO"," *** Exit preProcessForDeleteResource *** ", isDebugEnabled) + } + + public void postProcessForDeleteResource(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** postProcessForDeleteResource ***** ", isDebugEnabled) + + execution.setVariable("operationType", "update") + + utils.log("INFO"," *** Exit postProcessForDeleteResource *** ", isDebugEnabled) + } + + public void preProcessAAIGET(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + } + + public void postProcessAAIGET(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) + String msg = "" + + try { + String serviceInstanceName = execution.getVariable("serviceInstanceName") + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(!succInAAI){ + utils.log("INFO","Error getting Service-instance from AAI in postProcessAAIGET", + serviceInstanceName, isDebugEnabled) + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + else + { + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + if(foundInAAI){ + String aaiService = execution.getVariable("GENGS_service") + if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "resource-version"))) { + execution.setVariable("serviceInstanceVersion", utils.getNodeText(aaiService, "resource-version")) + utils.log("INFO","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled) + } + } + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoUpdateE2EServiceInstance.postProcessAAIGET " + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) + } + + public void preProcessAAIPUT(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO","Entered " + method, isDebugEnabled) + String msg = "" + utils.log("INFO"," ***** preProcessAAIPUT *****", isDebugEnabled) + + + String serviceInstanceVersion = execution.getVariable("serviceInstanceVersion") + //execution.setVariable("GENPS_serviceResourceVersion", serviceInstanceVersion) + + //requestDetails.modelInfo.for AAI PUT servieInstanceData + //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + //aai serviceType and Role can be setted as fixed value now. + String aaiServiceType = "E2E Service" + String aaiServiceRole = "E2E Service" + String modelInvariantUuid = execution.getVariable("modelInvariantUuid") + String modelUuid = execution.getVariable("modelUuid") + + + AaiUtil aaiUriUtil = new AaiUtil(this) + utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled) + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled) + String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) + utils.log("INFO","namespace: " + namespace, isDebugEnabled) + + //update target model to aai + String serviceInstanceData = + """ + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(serviceInstanceName)} + ${MsoUtils.xmlEscape(aaiServiceType)} + ${MsoUtils.xmlEscape(aaiServiceRole)} + ${MsoUtils.xmlEscape(serviceInstanceVersion)} + ${MsoUtils.xmlEscape(modelInvariantUuid)} + ${MsoUtils.xmlEscape(modelUuid)} + """.trim() + + execution.setVariable("serviceInstanceData", serviceInstanceData) + utils.log("INFO","serviceInstanceData: " + serviceInstanceData, isDebugEnabled) + utils.logAudit(serviceInstanceData) + utils.log("INFO", " aai_uri " + aai_uri + " namespace:" + namespace, isDebugEnabled) + utils.log("INFO", " 'payload' to update Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled) + + utils.log("INFO", "Exited " + method, isDebugEnabled) + } + + public void postProcessAAIPUT(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** postProcessAAIPUT ***** ", isDebugEnabled) + String msg = "" + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator") + if(!succInAAI){ + utils.log("INFO","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled) + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + } + else + { + //start rollback set up + RollbackData rollbackData = new RollbackData() + def disableRollback = execution.getVariable("disableRollback") + rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) + rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") + rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId) + rollbackData.put("SERVICEINSTANCE", "serviceType", execution.getVariable("serviceType")) + rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) + execution.setVariable("rollbackData", rollbackData) + } + + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO"," *** Exit postProcessAAIPUT *** ", isDebugEnabled) + } + + public void preProcessRollback (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** preProcessRollback ***** ", isDebugEnabled) + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + utils.log("INFO", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + utils.log("INFO", "BPMN Error during preProcessRollback", isDebugEnabled) + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + } + utils.log("INFO"," *** Exit preProcessRollback *** ", isDebugEnabled) + } + + public void postProcessRollback (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** postProcessRollback ***** ", isDebugEnabled) + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + utils.log("INFO", "Setting prevException to WorkflowException: ", isDebugEnabled) + execution.setVariable("WorkflowException", workflowException); + } + execution.setVariable("rollbackData", null) + } catch (BpmnError b) { + utils.log("INFO", "BPMN Error during postProcessRollback", isDebugEnabled) + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + } + utils.log("INFO"," *** Exit postProcessRollback *** ", isDebugEnabled) + } + + + public void postConfigRequest(execution){ + //now do noting + } + + +} + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy new file mode 100644 index 0000000000..a2d94baaed --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy @@ -0,0 +1,345 @@ +/*- + * ============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.bpmn.infrastructure.scripts + + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.MsoLogger + +import groovy.json.* + + +/** + * This groovy class supports the DoUpdateE2EServiceInstanceRollback.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - rollbackData with + * globalCustomerId + * subscriptionServiceType + * serviceInstanceId + * disableRollback + * rollbackAAI + * rollbackAdded + * rollbackDeleted + * + * + * Outputs: + * @param - rollbackError + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * + */ +public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateE2EServiceInstanceRollback.class); + + + String Prefix="DUPDSIRB_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void preProcessRequest(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + String msg = "" + msoLogger.trace("preProcessRequest ") + execution.setVariable("rollbackAAI",false) + execution.setVariable("rollbackAdded",false) + execution.setVariable("rollbackDeleted",false) + + List addResourceList = execution.getVariable("addResourceList") + List delResourceList = execution.getVariable("delResourceList") + execution.setVariable("addResourceList_o", addResourceList) + execution.setVariable("delResourceList_o", delResourceList) + //exchange add and delete resource list + execution.setVariable("addResourceList", delResourceList) + execution.setVariable("delResourceList", addResourceList) + + try { + def rollbackData = execution.getVariable("rollbackData") + msoLogger.debug("RollbackData:" + rollbackData) + + if (rollbackData != null) { + if (rollbackData.hasType("SERVICEINSTANCE")) { + + def serviceInstanceId = rollbackData.get("SERVICEINSTANCE", "serviceInstanceId") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + def subscriptionServiceType = rollbackData.get("SERVICEINSTANCE", "subscriptionServiceType") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + + def globalSubscriberId = rollbackData.get("SERVICEINSTANCE", "globalSubscriberId") + execution.setVariable("globalSubscriberId", globalSubscriberId) + + def rollbackAAI = rollbackData.get("SERVICEINSTANCE", "rollbackAAI") + if ("true".equals(rollbackAAI)) + { + execution.setVariable("rollbackAAI",true) + } + + def rollbackAdded = rollbackData.get("SERVICEINSTANCE", "rollbackAdded") + if ("true".equals(rollbackAdded)) + { + execution.setVariable("rollbackAdded", true) + } + + def rollbackDeleted = rollbackData.get("SERVICEINSTANCE", "rollbackDeleted") + if ("true".equals(rollbackDeleted)) + { + execution.setVariable("rollbackDeleted", true) + } + + if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackAdded") != true + && execution.getVariable("rollbackDeleted") != true) + { + execution.setVariable("skipRollback", true) + } + + } + else { + execution.setVariable("skipRollback", true) + } + } + else { + execution.setVariable("skipRollback", true) + } + if (execution.getVariable("disableRollback").equals("true" )) + { + execution.setVariable("skipRollback", true) + } + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in Update ServiceInstance Rollback preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest ") + } + + public void postProcessRequest(DelegateExecution execution) { + msoLogger.trace("postProcessRequest ") + String msg = "" + try { + execution.setVariable("rollbackData", null) + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean rollbackAAI = execution.getVariable("rollbackAAI") + boolean rollbackAdded = execution.getVariable("rollbackAdded") + boolean rollbackDeleted = execution.getVariable("rollbackDeleted") + + List addResourceList = execution.getVariable("addResourceList_o") + List delResourceList = execution.getVariable("delResourceList_o") + execution.setVariable("addResourceList", addResourceList) + execution.setVariable("delResourceList", delResourceList) + + if (rollbackAAI || rollbackAdded || rollbackDeleted) + { + execution.setVariable("rolledBack", true) + } + if (rollbackAAI) + { + boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator") + if(!succInAAI){ + execution.setVariable("rolledBack", false) //both sdnc and aai must be successful to declare rollback Succesful + execution.setVariable("rollbackError", "Error deleting service-instance in AAI for rollback") + msoLogger.debug("Error deleting service-instance in AAI for rollback", + serviceInstanceId) + } + } + msoLogger.trace("Exit postProcessRequest ") + + } catch (BpmnError e) { + msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + e.getMessage() + msoLogger.debug(msg) + } catch (Exception ex) { + msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + ex.getMessage() + msoLogger.debug(msg) + } + } + + + public void preProcessForAddResource(DelegateExecution execution) { + } + + public void postProcessForAddResource(DelegateExecution execution) { + } + + public void preProcessForDeleteResource(DelegateExecution execution) { + } + + public void postProcessForDeleteResource(DelegateExecution execution) { + } + + public void preProcessAAIGET(DelegateExecution execution) { + } + + public void postProcessAAIGET(DelegateExecution execution) { + msoLogger.trace("postProcessAAIGET ") + String msg = "" + + try { + String serviceInstanceName = execution.getVariable("serviceInstanceName") + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(!succInAAI){ + msoLogger.info("Error getting Service-instance from AAI in postProcessAAIGET", + serviceInstanceName) + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + else + { + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + if(foundInAAI){ + String aaiService = execution.getVariable("GENGS_service") + if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "resource-version"))) { + execution.setVariable("serviceInstanceVersion_n", utils.getNodeText(aaiService, "resource-version")) + msoLogger.info("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName")) + } + } + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoCreateServiceInstance.postProcessAAIGET " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit postProcessAAIGET ") + } + + public void preProcessAAIPUT(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' + msoLogger.info("Entered " + method) + String msg = "" + msoLogger.trace("preProcessAAIPUT ") + + String serviceInstanceVersion = execution.getVariable("serviceInstanceVersion_n") +// execution.setVariable("GENPS_serviceResourceVersion", serviceInstanceVersion) + + //requestDetails.modelInfo.for AAI PUT servieInstanceData + //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + //aai serviceType and Role can be setted as fixed value now. + String aaiServiceType = "E2E Service" + String aaiServiceRole = "E2E Service" + String modelInvariantUuid = execution.getVariable("modelInvariantUuid") + String modelUuid = execution.getVariable("model-version-id-original") + + //AAI PUT + AaiUtil aaiUriUtil = new AaiUtil(this) + utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled) + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled) + String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) + utils.log("INFO","namespace: " + namespace, isDebugEnabled) + + String serviceInstanceData = + """ + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(serviceInstanceName)} + ${MsoUtils.xmlEscape(aaiServiceType)} + ${MsoUtils.xmlEscape(aaiServiceRole)} + ${MsoUtils.xmlEscape(serviceInstanceVersion)} + ${MsoUtils.xmlEscape(modelInvariantUuid)} + ${MsoUtils.xmlEscape(modelUuid)} + """.trim() + + execution.setVariable("serviceInstanceData", serviceInstanceData) + msoLogger.info("serviceInstanceData: " + serviceInstanceData) + msoLogger.debug(serviceInstanceData) + msoLogger.info(" aai_uri " + aai_uri + " namespace:" + namespace) + msoLogger.info(" 'payload' to update Service Instance in AAI - " + "\n" + serviceInstanceData) + + msoLogger.info("Exited " + method) + } + + public void postProcessAAIPUT(DelegateExecution execution) { + msoLogger.trace("postProcessAAIPUT ") + String msg = "" + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator") + if(!succInAAI){ + msoLogger.info("Error putting Service-instance in AAI", + serviceInstanceId) + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + } + else + { + + } + + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage() + msoLogger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit postProcessAAIPUT ") + } + + public void processRollbackException(DelegateExecution execution){ + msoLogger.trace("processRollbackException ") + try{ + msoLogger.debug("Caught an Exception in DoUpdateE2EServiceInstanceRollback") + execution.setVariable("rollbackData", null) + execution.setVariable("rollbackError", "Caught exception in ServiceInstance Update Rollback") + execution.setVariable("WorkflowException", null) + + }catch(BpmnError b){ + msoLogger.debug("BPMN Error during processRollbackExceptions Method: ") + }catch(Exception e){ + msoLogger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage()) + } + + msoLogger.debug(" Exit processRollbackException") + } + + public void processRollbackJavaException(DelegateExecution execution){ + msoLogger.trace("processRollbackJavaException ") + try{ + execution.setVariable("rollbackData", null) + execution.setVariable("rollbackError", "Caught Java exception in ServiceInstance Update Rollback") + msoLogger.debug("Caught Exception in processRollbackJavaException") + + }catch(Exception e){ + msoLogger.debug("Caught Exception in processRollbackJavaException " + e.getMessage()) + } + msoLogger.trace("Exit processRollbackJavaException ") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy new file mode 100644 index 0000000000..7272f421fc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy @@ -0,0 +1,1408 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.NetworkUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils + +import groovy.json.* +import groovy.xml.XmlUtil + +/** + * This groovy class supports the DoUpdateNetworkInstance.bpmn process. + * + */ +public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateNetworkInstance.class); + + String Prefix="UPDNETI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + NetworkUtils networkUtils = new NetworkUtils() + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + /** + * This method is executed during the preProcessRequest task of the DoUpdateNetworkInstance.bpmn process. + * @param execution + */ + public InitializeProcessVariables(DelegateExecution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable(Prefix + "messageId", "") + execution.setVariable("BasicAuthHeaderValuePO", "") + execution.setVariable("BasicAuthHeaderValueSDNC", "") + execution.setVariable(Prefix + "networkRequest", "") + execution.setVariable(Prefix + "networkInputs", "") + execution.setVariable(Prefix + "networkOutputs", "") + execution.setVariable(Prefix + "requestId", "") + execution.setVariable(Prefix + "source", "") + execution.setVariable(Prefix + "networkId", "") + + execution.setVariable(Prefix + "isPONR", false) // Point-of-no-return, means, rollback is not needed + + // AAI query Cloud Region + execution.setVariable(Prefix + "queryCloudRegionRequest","") + execution.setVariable(Prefix + "queryCloudRegionReturnCode","") + execution.setVariable(Prefix + "queryCloudRegionResponse","") + execution.setVariable(Prefix + "cloudRegionPo","") + execution.setVariable(Prefix + "cloudRegionSdnc","") + execution.setVariable(Prefix + "isCloudRegionGood", false) + + // AAI query Id + execution.setVariable(Prefix + "queryIdAAIRequest","") + execution.setVariable(Prefix + "queryIdAAIResponse", "") + execution.setVariable(Prefix + "aaiIdReturnCode", "") + + // AAI query vpn binding + execution.setVariable(Prefix + "queryVpnBindingAAIRequest","") + execution.setVariable(Prefix + "queryVpnBindingAAIResponse", "") + execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "") + execution.setVariable(Prefix + "vpnBindings", null) + execution.setVariable(Prefix + "vpnCount", 0) + execution.setVariable(Prefix + "routeCollection", "") + + // AAI query network policy + execution.setVariable(Prefix + "queryNetworkPolicyAAIRequest","") + execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", "") + execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "") + execution.setVariable(Prefix + "networkPolicyUriList", null) + execution.setVariable(Prefix + "networkPolicyCount", 0) + execution.setVariable(Prefix + "networkCollection", "") + + // AAI query route table reference + execution.setVariable(Prefix + "queryNetworkTableRefAAIRequest","") + execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", "") + execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "") + execution.setVariable(Prefix + "networkTableRefUriList", null) + execution.setVariable(Prefix + "networkTableRefCount", 0) + execution.setVariable(Prefix + "tableRefCollection", "") + + // AAI requery Id + execution.setVariable(Prefix + "requeryIdAAIRequest","") + execution.setVariable(Prefix + "requeryIdAAIResponse", "") + execution.setVariable(Prefix + "aaiRequeryIdReturnCode", "") + + // AAI update contrail + execution.setVariable(Prefix + "updateContrailAAIUrlRequest","") + execution.setVariable(Prefix + "updateContrailAAIPayloadRequest","") + execution.setVariable(Prefix + "updateContrailAAIResponse", "") + execution.setVariable(Prefix + "aaiUpdateContrailReturnCode", "") + + execution.setVariable(Prefix + "updateNetworkRequest", "") + execution.setVariable(Prefix + "updateNetworkResponse", "") + execution.setVariable(Prefix + "rollbackNetworkRequest", "") + execution.setVariable(Prefix + "networkReturnCode", "") + execution.setVariable(Prefix + "isNetworkRollbackNeeded", false) + + execution.setVariable(Prefix + "changeAssignSDNCRequest", "") + execution.setVariable(Prefix + "changeAssignSDNCResponse", "") + execution.setVariable(Prefix + "rollbackSDNCRequest", "") + execution.setVariable(Prefix + "sdncReturnCode", "") + execution.setVariable(Prefix + "isSdncRollbackNeeded", false) + execution.setVariable(Prefix + "sdncResponseSuccess", false) + + execution.setVariable(Prefix + "isVnfBindingPresent", false) + execution.setVariable(Prefix + "Success", false) + execution.setVariable(Prefix + "serviceInstanceId", "") + + execution.setVariable(Prefix + "isException", false) + + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the DoUpdateNetworkInstance.bpmn process. + * @param execution + */ + public void preProcessRequest (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside preProcessRequest DoUpdateNetworkInstance Request ") + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + // GET Incoming request & validate 3 kinds of format. + execution.setVariable("action", "UPDATE") + String networkRequest = execution.getVariable("bpmnRequest") + if (networkRequest != null) { + if (networkRequest.contains("requestDetails")) { + // JSON format request is sent, create xml + try { + def prettyJson = JsonOutput.prettyPrint(networkRequest.toString()) + msoLogger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson) + networkRequest = vidUtils.createXmlNetworkRequestInfra(execution, networkRequest) + + } catch (Exception ex) { + String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + } else { + // XML format request is sent + + } + } else { + // vIPR format request is sent, create xml from individual variables + networkRequest = vidUtils.createXmlNetworkRequestInstance(execution) + } + + networkRequest = utils.formatXml(networkRequest) + msoLogger.debug(networkRequest) + execution.setVariable(Prefix + "networkRequest", networkRequest) + msoLogger.debug(" network-request - " + '\n' + networkRequest) + + // validate 'disableRollback' (aka, 'suppressRollback') + boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, networkRequest) + execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled) + msoLogger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled) + + String networkInputs = utils.getNodeXml(networkRequest, "network-inputs", false).replace("tag0:","").replace(":tag0","") + execution.setVariable(Prefix + "networkInputs", networkInputs) + msoLogger.debug(Prefix + "networkInputs - " + '\n' + networkInputs) + + // prepare messageId + String messageId = execution.getVariable(Prefix + "messageId") // for testing + if (messageId == null || messageId == "") { + messageId = UUID.randomUUID() + msoLogger.debug(" UPDNETI_messageId, random generated: " + messageId) + } else { + msoLogger.debug(" UPDNETI_messageId, pre-assigned: " + messageId) + } + execution.setVariable(Prefix + "messageId", messageId) + + String source = utils.getNodeText(networkRequest, "source") + execution.setVariable(Prefix + "source", source) + msoLogger.debug(Prefix + "source - " + source) + + String networkId = "" + if (utils.nodeExists(networkRequest, "network-id")) { + networkId = utils.getNodeText(networkRequest, "network-id") + if (networkId == 'null' || networkId == "") { + sendSyncError(execution) + // missing value of networkId + String dataErrorMessage = "Variable 'network-id' value/element is missing." + msoLogger.debug(" Invalid Request - " + dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + + String lcpCloudRegion = "" + if (utils.nodeExists(networkRequest, "aic-cloud-region")) { + lcpCloudRegion = utils.getNodeText(networkRequest, "aic-cloud-region") + if ((lcpCloudRegion == 'null') || (lcpCloudRegion == "")) { + sendSyncError(execution) + String dataErrorMessage = "requestDetails has missing 'aic-cloud-region' value/element." + msoLogger.debug(" Invalid Request - " + dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + } + + String serviceInstanceId = "" + if (utils.nodeExists(networkRequest, "service-instance-id")) { + serviceInstanceId = utils.getNodeText(networkRequest, "service-instance-id") + if ((serviceInstanceId == 'null') || (lcpCloudRegion == "")) { + sendSyncError(execution) + String dataErrorMessage = "Variable 'serviceInstanceId' value/element is missing." + msoLogger.debug(" Invalid Request - " + dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + } + + // PO Authorization Info / headers Authorization= + String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution) + + + try { + def encodedString = utils.getBasicAuth(basicAuthValuePO, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable("BasicAuthHeaderValuePO",encodedString) + execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) + + } catch (IOException ex) { + String exceptionMessage = "Exception Encountered in DoUpdateNetworkInstance, PreProcessRequest() - " + String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + // Set variables for Generic Get Sub Flow use + execution.setVariable(Prefix + "serviceInstanceId", serviceInstanceId) + msoLogger.debug(Prefix + "serviceInstanceId - " + serviceInstanceId) + + execution.setVariable("GENGS_type", "service-instance") + msoLogger.debug("GENGS_type - " + "service-instance") + msoLogger.debug(" Url for SDNC adapter: " + UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint",execution)) + + String sdncVersion = execution.getVariable("sdncVersion") + msoLogger.debug("sdncVersion? : " + sdncVersion) + + // build 'networkOutputs' + networkId = utils.getNodeText(networkRequest, "network-id") + if ((networkId == null) || (networkId == "null")) { + networkId = "" + } + String networkName = utils.getNodeText(networkRequest, "network-name") + if ((networkName == null) || (networkName == "null")) { + networkName = "" + } + String networkOutputs = + """ + ${MsoUtils.xmlEscape(networkId)} + ${MsoUtils.xmlEscape(networkName)} + """ + execution.setVariable(Prefix + "networkOutputs", networkOutputs) + msoLogger.debug(Prefix + "networkOutputs - " + '\n' + networkOutputs) + execution.setVariable(Prefix + "networkId", networkId) + execution.setVariable(Prefix + "networkName", networkName) + + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex){ + sendSyncError(execution) + // caught exception + String exceptionMessage = "Exception Encountered in DoUpdateNetworkInstance, PreProcessRequest() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + } + + public void callRESTQueryAAICloudRegion (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.debug(" ***** Inside callRESTQueryAAICloudRegion of DoUpdateNetworkInstance ***** " ) + + try { + String networkInputs = execution.getVariable(Prefix + "networkInputs") + String cloudRegion = utils.getNodeText(networkInputs, "aic-cloud-region") + cloudRegion = UriUtils.encode(cloudRegion,"UTF-8") + + // Prepare AA&I url + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUtil = new AaiUtil(this) + String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) + String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion + msoLogger.debug(queryCloudRegionRequest) + execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest) + msoLogger.debug(" UPDNETI_queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest) + + String cloudRegionPo = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) + String cloudRegionSdnc = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "SDNC", cloudRegion) + + if ((cloudRegionPo != "ERROR") && (cloudRegionSdnc != "ERROR")) { + execution.setVariable(Prefix + "cloudRegionPo", cloudRegionPo) + execution.setVariable(Prefix + "cloudRegionSdnc", cloudRegionSdnc) + execution.setVariable(Prefix + "isCloudRegionGood", true) + + } else { + String dataErrorMessage = "QueryAAICloudRegion Unsuccessful. Return Code: " + execution.getVariable(Prefix + "queryCloudRegionReturnCode") + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + + msoLogger.debug(" is Cloud Region Good: " + execution.getVariable(Prefix + "isCloudRegionGood")) + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + // try error + String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow - callRESTQueryAAICloudRegion() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAINetworkId(DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.debug(" ***** Inside callRESTQueryAAINetworkId of DoUpdateNetworkInstance ***** " ) + + try { + // get variables + String networkRequest = execution.getVariable(Prefix + "networkRequest") + String networkId = utils.getNodeText(networkRequest, "network-id") + networkId = UriUtils.encode(networkId,"UTF-8") + execution.setVariable(Prefix + "networkId", networkId) + + // Prepare AA&I url + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String queryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" + msoLogger.debug(queryIdAAIRequest) + execution.setVariable(Prefix + "queryIdAAIRequest", queryIdAAIRequest) + msoLogger.debug(Prefix + "queryIdAAIRequest - " + "\n" + queryIdAAIRequest) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryIdAAIRequest) + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiIdReturnCode", returnCode) + msoLogger.debug(" ***** AAI Response Code : " + returnCode) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (returnCode=='200') { + msoLogger.debug(aaiResponseAsString) + execution.setVariable(Prefix + "queryIdAAIResponse", aaiResponseAsString) + msoLogger.debug(" QueryAAINetworkId Success REST Response - " + "\n" + aaiResponseAsString) + + } else { + if (returnCode=='404') { + String dataErrorMessage = "Response Error from QueryAAINetworkId is 404 (Not Found)." + msoLogger.debug(" AAI Query Failed. " + dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from QueryAAINetworkId - " + returnCode + msoLogger.debug("Unexpected Response from QueryAAINetworkId - " + dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkId() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTReQueryAAINetworkId(DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.debug(" ***** Inside callRESTReQueryAAINetworkId of DoUpdateNetworkInstance ***** " ) + + try { + // get variables + String networkRequest = execution.getVariable(Prefix + "networkRequest") + String networkId = utils.getNodeText(networkRequest, "network-id") + networkId = UriUtils.encode(networkId,"UTF-8") + + // Prepare AA&I url + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String requeryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" + msoLogger.debug(requeryIdAAIRequest) + execution.setVariable(Prefix + "requeryIdAAIRequest", requeryIdAAIRequest) + msoLogger.debug(" UPDNETI_requeryIdAAIRequest - " + "\n" + requeryIdAAIRequest) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, requeryIdAAIRequest) + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiRequeryIdReturnCode", returnCode) + msoLogger.debug(" ***** AAI ReQuery Response Code : " + returnCode) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (returnCode=='200') { + msoLogger.debug(aaiResponseAsString) + execution.setVariable(Prefix + "requeryIdAAIResponse", aaiResponseAsString) + msoLogger.debug(" ReQueryAAINetworkId Success REST Response - " + "\n" + aaiResponseAsString) + + String netId = utils.getNodeText(aaiResponseAsString, "network-id") + String netName = utils.getNodeText(aaiResponseAsString, "network-name") + String networkOutputs = + """ + ${MsoUtils.xmlEscape(netId)} + ${MsoUtils.xmlEscape(netName)} + """ + execution.setVariable(Prefix + "networkOutputs", networkOutputs) + msoLogger.debug(" networkOutputs - " + '\n' + networkOutputs) + + } else { + if (returnCode=='404') { + String dataErrorMessage = "Response Error from ReQueryAAINetworkId is 404 (Not Found)." + msoLogger.debug(" AAI ReQuery Failed. - " + dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from ReQueryAAINetworkId - " + returnCode + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTReQueryAAINetworkId() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAINetworkVpnBinding(DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.debug(" ***** Inside callRESTQueryAAINetworkVpnBinding of DoUpdateNetworkInstance ***** " ) + + try { + + // get variables + String queryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse").replace('', "") + String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") + msoLogger.debug(" relationship - " + relationship) + + // Check if Vnf Binding is present, then build a List of vnfBinding + List vpnBindingUri = networkUtils.getVnfBindingObject(relationship) + int vpnCount = vpnBindingUri.size() + execution.setVariable(Prefix + "vpnCount", vpnCount) + msoLogger.debug(" UPDNETI_vpnCount - " + vpnCount) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + + if (vpnCount > 0) { + execution.setVariable(Prefix + "vpnBindings", vpnBindingUri) + msoLogger.debug(" vpnBindingUri List - " + vpnBindingUri) + + String routeTargets = "" + // AII loop call using list vpnBindings + for (i in 0..vpnBindingUri.size()-1) { + + int counting = i+1 + + // prepare url using vpnBinding + String queryVpnBindingAAIRequest = "" + String aai_uri = aaiUriUtil.getNetworkVpnBindingUri(execution) + + // Note: By default, the vpnBinding url is found in 'related-link' of the response, + // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. + if (aai_uri == null || aai_uri == "") { + // using value of 'related-link' from response + if (vpnBindingUri[i].charAt(vpnBindingUri[i].length()-1) == '/') { + queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i].substring(0, vpnBindingUri[i].length()-1) + "?depth=all" + } else { + queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i] + "?depth=all" + } + + } else { + // using uri value in URN mapping + String vpnBindingId = vpnBindingUri[i].substring(vpnBindingUri[i].indexOf("/vpn-binding/")+13, vpnBindingUri[i].length()) + if (vpnBindingId.charAt(vpnBindingId.length()-1) == '/') { + vpnBindingId = vpnBindingId.substring(0, vpnBindingId.length()-1) + } + queryVpnBindingAAIRequest = "${aai_endpoint}${aai_uri}/" + vpnBindingId + "?depth=all" + } + + msoLogger.debug(queryVpnBindingAAIRequest) + execution.setVariable(Prefix + "queryVpnBindingAAIRequest", queryVpnBindingAAIRequest) + msoLogger.debug(" UPDNETI_queryVpnBindingAAIRequest, , vpnBinding #" + counting + " : " + "\n" + queryVpnBindingAAIRequest) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryVpnBindingAAIRequest) + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", returnCode) + msoLogger.debug(" ***** AAI query vpn binding Response Code, vpnBinding #" + counting + " : " + returnCode) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (returnCode=='200') { + msoLogger.debug(aaiResponseAsString) + execution.setVariable(Prefix + "queryVpnBindingAAIResponse", aaiResponseAsString) + msoLogger.debug(" AAI Query Vpn Binding Success REST Response, , vpnBinding #" + counting + " : " + "\n" + aaiResponseAsString) + + String routeTarget = "" + String routeRole = "" + if (utils.nodeExists(aaiResponseAsString, "route-targets")) { + String aaiRouteTargets = utils.getNodeXml(aaiResponseAsString, "route-targets", false) + def aaiRouteTargetsXml = new XmlSlurper().parseText(aaiRouteTargets) + def aaiRouteTarget = aaiRouteTargetsXml.'**'.findAll {it.name() == "route-target"} + for (j in 0..aaiRouteTarget.size()-1) { + routeTarget = utils.getNodeText(XmlUtil.serialize(aaiRouteTarget[j]), "global-route-target") + routeRole = utils.getNodeText(XmlUtil.serialize(aaiRouteTarget[j]), "route-target-role") + routeTargets += "" + '\n' + + " " + routeTarget + "" + '\n' + + " " + routeRole + "" + '\n' + + "" + '\n' + } + } + + } else { + if (returnCode=='404') { + String dataErrorMessage = "Response Error from AAINetworkVpnBinding is 404 (Not Found)." + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = " Unexpected Response from AAINetworkVpnBinding - " + returnCode + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } // end loop + + execution.setVariable(Prefix + "routeCollection", routeTargets) + msoLogger.debug(" UPDNETI_routeCollection - " + '\n' + routeTargets) + + } else { + // reset return code to success + execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) + String aaiStubResponse = + """ + + + + """ + String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) + execution.setVariable(Prefix + "queryVpnBindingAAIResponse", aaiStubResponseAsXml) + execution.setVariable(Prefix + "routeCollection", "") + msoLogger.debug(" No vpnBinding, using this stub as response - " + '\n' + aaiStubResponseAsXml) + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkVpnBinding() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAINetworkPolicy(DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.debug(" ***** Inside callRESTQueryAAINetworkPolicy of DoUpdateNetworkInstance ***** " ) + + try { + // get variables + String queryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse").replace('', "") + String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") + msoLogger.debug(" relationship - " + relationship) + + // Check if Network Policy is present, then build a List of network policy + List networkPolicyUriList = networkUtils.getNetworkPolicyObject(relationship) + int networkPolicyCount = networkPolicyUriList.size() + execution.setVariable(Prefix + "networkPolicyCount", networkPolicyCount) + msoLogger.debug(" UPDNETI_networkPolicyCount - " + networkPolicyCount) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + + if (networkPolicyCount > 0) { + execution.setVariable(Prefix + "networkPolicyUriList", networkPolicyUriList) + msoLogger.debug(" networkPolicyUri List - " + networkPolicyUriList) + + String networkPolicies = "" + // AII loop call using list vpnBindings + for (i in 0..networkPolicyUriList.size()-1) { + + int counting = i+1 + + // prepare url using vpnBinding + String queryNetworkPolicyAAIRequest = "" + + String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) + + // Note: By default, the network policy url is found in 'related-link' of the response, + // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. + if (aai_uri == null || aai_uri == "") { + // using value of 'related-link' from response + if (networkPolicyUriList[i].charAt(networkPolicyUriList[i].length()-1) == '/') { + queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i].substring(0, networkPolicyUriList[i].length()-1) + "?depth=all" + } else { + queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i] + "?depth=all" + } + } else { + // using uri value in URN mapping + String networkPolicyId = networkPolicyUriList[i].substring(networkPolicyUriList[i].indexOf("/network-policy/")+16, networkPolicyUriList[i].length()) + println " networkPolicyId - " + networkPolicyId + if (networkPolicyId.charAt(networkPolicyId.length()-1) == '/') { + networkPolicyId = networkPolicyId.substring(0, networkPolicyId.length()-1) + } + queryNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + networkPolicyId + "?depth=all" + + } + + + msoLogger.debug(queryNetworkPolicyAAIRequest) + execution.setVariable(Prefix + "queryNetworkPolicyAAIRequest", queryNetworkPolicyAAIRequest) + msoLogger.debug(" UPDNETI_queryNetworkPolicyAAIRequest, , NetworkPolicy #" + counting + " : " + "\n" + queryNetworkPolicyAAIRequest) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkPolicyAAIRequest) + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", returnCode) + msoLogger.debug(" ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (returnCode=='200') { + msoLogger.debug(aaiResponseAsString) + execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", aaiResponseAsString) + msoLogger.debug(" QueryAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString) + + String networkPolicy = "" + if (utils.nodeExists(aaiResponseAsString, "network-policy-fqdn")) { + networkPolicy = utils.getNodeText(aaiResponseAsString, "network-policy-fqdn") + networkPolicies += "" + networkPolicy + "" + '\n' + } + + } else { + if (returnCode=='404') { + String dataErrorMessage = "Response Error from QueryAAINetworkPolicy is 404 (Not Found)." + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from QueryAAINetworkPolicy - " + returnCode + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } // end loop + + execution.setVariable(Prefix + "networkCollection", networkPolicies) + msoLogger.debug(" UPDNETI_networkCollection - " + '\n' + networkPolicies) + + } else { + // reset return code to success + execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "200") + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) + String aaiStubResponse = + """ + + + + """ + String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) + execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", aaiStubResponseAsXml) + execution.setVariable(Prefix + "networkCollection", "") + msoLogger.debug(" No net policies, using this stub as response - " + '\n' + aaiStubResponseAsXml) + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkPolicy() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAINetworkTableRef(DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.debug(" ***** Inside callRESTQueryAAINetworkTableRef of DoUpdateNetworkInstance ***** " ) + + try { + // get variables + String queryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse").replace('', "") + String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") + msoLogger.debug(" relationship - " + relationship) + + // Check if Network TableREf is present, then build a List of network policy + List networkTableRefUriList = networkUtils.getNetworkTableRefObject(relationship) + int networkTableRefCount = networkTableRefUriList.size() + execution.setVariable(Prefix + "networkTableRefCount", networkTableRefCount) + msoLogger.debug(" UPDNETI_networkTableRefCount - " + networkTableRefCount) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + + if (networkTableRefCount > 0) { + execution.setVariable(Prefix + "networkTableRefUriList", networkTableRefUriList) + msoLogger.debug(" networkTableRefUri List - " + networkTableRefUriList) + + // AII loop call using list vpnBindings + String networkTableRefs = "" + for (i in 0..networkTableRefUriList.size()-1) { + + int counting = i+1 + + // prepare url using tableRef + String queryNetworkTableRefAAIRequest = "" + + String aai_uri = aaiUriUtil.getNetworkTableReferencesUri(execution) + + // Note: By default, the network policy url is found in 'related-link' of the response, + // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. + if (aai_uri == null || aai_uri == "") { + // using value of 'related-link' from response + if (networkTableRefUriList[i].charAt(networkTableRefUriList[i].length()-1) == '/') { + queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i].substring(0, networkTableRefUriList[i].length()-1) + "?depth=all" + } else { + queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i] + "?depth=all" + } + } else { + // using uri value in URN mapping + String networkTableRefId = networkTableRefUriList[i].substring(networkTableRefUriList[i].indexOf("/route-table-reference/")+23, networkTableRefUriList[i].length()) + + if (networkTableRefId.charAt(networkTableRefId.length()-1) == '/') { + networkTableRefId = networkTableRefId.substring(0, networkTableRefId.length()-1) + } + queryNetworkTableRefAAIRequest = "${aai_endpoint}${aai_uri}/" + networkTableRefId + "?depth=all" + + } + + + msoLogger.debug(queryNetworkTableRefAAIRequest) + execution.setVariable(Prefix + "queryNetworkTableRefAAIRequest", queryNetworkTableRefAAIRequest) + msoLogger.debug(" UPDNETI_queryNetworkTableRefAAIRequest, , NetworkTableRef #" + counting + " : " + "\n" + queryNetworkTableRefAAIRequest) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkTableRefAAIRequest) + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", returnCode) + msoLogger.debug(" ***** AAI query network Table Reference Response Code, NetworkTableRef #" + counting + " : " + returnCode) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (returnCode=='200') { + msoLogger.debug(aaiResponseAsString) + execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", aaiResponseAsString) + msoLogger.debug(" QueryAAINetworkTableRef Success REST Response, , NetworkTableRef #" + counting + " : " + "\n" + aaiResponseAsString) + + String networkTableRef = "" + if (utils.nodeExists(aaiResponseAsString, "route-table-reference-fqdn")) { + networkTableRef = utils.getNodeText(aaiResponseAsString, "route-table-reference-fqdn") + networkTableRefs += "" + networkTableRef + "" + '\n' + } + + } else { + if (returnCode=='404') { + String dataErrorMessage = "Response Error from QueryAAINetworkTableRef is 404 (Not Found)." + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from QueryAAINetworkTableRef - " + returnCode + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } // end loop + + execution.setVariable(Prefix + "tableRefCollection", networkTableRefs) + msoLogger.debug(" UPDNETI_tableRefCollection - " + '\n' + networkTableRefs) + + } else { + // reset return code to success + execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200") + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) + String aaiStubResponse = + """ + + + + """ + String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) + execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", aaiStubResponseAsXml) + execution.setVariable(Prefix + "tableRefCollection", "") + msoLogger.debug(" No net table references, using this stub as response - " + '\n' + aaiStubResponseAsXml) + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkTableRef() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTUpdateContrailAAINetwork(DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.debug(" ***** Inside callRESTUpdateContrailAAINetwork of DoUpdateNetworkInstance ***** " ) + + try { + // get variables + String networkRequest = execution.getVariable(Prefix + "networkRequest") + String networkId = utils.getNodeText(networkRequest, "network-id") + networkId = UriUtils.encode(networkId,"UTF-8") + String requeryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") + String updateNetworkResponse = execution.getVariable(Prefix + "updateNetworkResponse") + + // Prepare url + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String updateContrailAAIUrlRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" + + msoLogger.debug(updateContrailAAIUrlRequest) + execution.setVariable(Prefix + "updateContrailAAIUrlRequest", updateContrailAAIUrlRequest) + msoLogger.debug(" UPDNETI_updateContrailAAIUrlRequest - " + "\n" + updateContrailAAIUrlRequest) + + //Prepare payload (PUT) + String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) + String payload = networkUtils.ContrailNetworkCreatedUpdate(requeryIdAAIResponse, updateNetworkResponse, schemaVersion) + String payloadXml = utils.formatXml(payload) + msoLogger.debug(payloadXml) + execution.setVariable(Prefix + "updateContrailAAIPayloadRequest", payloadXml) + msoLogger.debug(" 'payload' to Update Contrail - " + "\n" + payloadXml) + + APIResponse response = aaiUriUtil.executeAAIPutCall(execution, updateContrailAAIUrlRequest, payload) + String returnCode = response.getStatusCode() + String aaiUpdateContrailResponseAsString = response.getResponseBodyAsString() + + execution.setVariable(Prefix + "aaiUpdateContrailReturnCode", returnCode) + msoLogger.debug(" ***** AAI Update Contrail Response Code : " + returnCode) + + + if (returnCode=='200') { + msoLogger.debug(aaiUpdateContrailResponseAsString) + execution.setVariable(Prefix + "updateContrailAAIResponse", aaiUpdateContrailResponseAsString) + msoLogger.debug(" AAI Update Contrail Success REST Response - " + "\n" + aaiUpdateContrailResponseAsString) + // Point-of-no-return is set to false, rollback not needed. + execution.setVariable(Prefix + "isPONR", true) + + } else { + if (returnCode=='404') { + String dataErrorMessage = " Response Error from UpdateContrailAAINetwork is 404 (Not Found)." + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiUpdateContrailResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiUpdateContrailResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String errorMessage = "Unexpected Response from UpdateContrailAAINetwork - " + returnCode + msoLogger.debug(errorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) + } + } + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTUpdateContrailAAINetwork() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareUpdateNetworkRequest (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside prepareUpdateNetworkRequest of DoUpdateNetworkInstance ") + + try { + + // get variables + String requestId = execution.getVariable(Prefix + "requestId") + String messageId = execution.getVariable(Prefix + "messageId") + String source = execution.getVariable(Prefix + "source") + + String requestInput = execution.getVariable(Prefix + "networkRequest") + String queryIdResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionPo") + String backoutOnFailure = execution.getVariable(Prefix + "rollbackEnabled") + + // Prepare Network request + String routeCollection = execution.getVariable(Prefix + "routeCollection") + String policyCollection = execution.getVariable(Prefix + "networkCollection") + String tableCollection = execution.getVariable(Prefix + "tableRefCollection") + String updateNetworkRequest = networkUtils.UpdateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyCollection, tableCollection, cloudRegionId, backoutOnFailure, source ) + // Format Response + String buildUpdateNetworkRequestAsString = utils.formatXml(updateNetworkRequest) + buildUpdateNetworkRequestAsString = buildUpdateNetworkRequestAsString.replace(":w1aac13n0", "").replace("w1aac13n0:", "") + msoLogger.debug(buildUpdateNetworkRequestAsString) + + execution.setVariable(Prefix + "updateNetworkRequest", buildUpdateNetworkRequestAsString) + msoLogger.debug(" UPDNETI_updateNetworkRequest - " + "\n" + buildUpdateNetworkRequestAsString) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareUpdateNetworkRequest() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareSDNCRequest (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside prepareSDNCRequest of DoUpdateNetworkInstance ") + + try { + // get variables + String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + String updateNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + + String networkId = "" + if (utils.nodeExists(updateNetworkInput, "network-id")) { + networkId = utils.getNodeText(updateNetworkInput, "network-id") + } + if (networkId == null) {networkId = ""} + + String serviceInstanceId = utils.getNodeText(updateNetworkInput, "service-instance-id") + + String queryAAIResponse = execution.getVariable(Prefix + "queryIdAAIResponse") + + // 1. prepare assign topology via SDNC Adapter SUBFLOW call + String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, updateNetworkInput, serviceInstanceId, sdncCallback, "changeassign", "NetworkActivateRequest", cloudRegionId, networkId, queryAAIResponse, null) + + String sndcTopologyUpdateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) + msoLogger.debug(sndcTopologyUpdateRequesAsString) + execution.setVariable(Prefix + "changeAssignSDNCRequest", sndcTopologyUpdateRequesAsString) + msoLogger.debug(" UPDNETI_changeAssignSDNCRequest - " + "\n" + sndcTopologyUpdateRequesAsString) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareSDNCRequest() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + + + // ************************************************** + // Post or Validate Response Section + // ************************************************** + + public void validateUpdateNetworkResponse (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside validateUpdateNetworkResponse of DoUpdateNetworkInstance ") + + try { + String returnCode = execution.getVariable(Prefix + "networkReturnCode") + String networkResponse = execution.getVariable(Prefix + "updateNetworkResponse") + if (networkResponse==null) { + networkResponse="" // reset + } + + msoLogger.debug(" Network Adapter update responseCode: " + returnCode) + + String errorMessage = "" + if (returnCode == "200") { + execution.setVariable(Prefix + "isNetworkRollbackNeeded", true) + msoLogger.debug(networkResponse) + execution.setVariable(Prefix + "updateNetworkResponse", networkResponse) + msoLogger.debug(" Network Adapter update Success Response - " + "\n" + networkResponse) + + // prepare rollback data + String rollbackData = utils.getNodeXml(networkResponse, "rollback", false).replace("tag0:","").replace(":tag0","") + rollbackData = rollbackData.replace("rollback>", "networkRollback>") + String rollbackNetwork = + """ + ${rollbackData} + """ + String rollbackNetworkXml = utils.formatXml(rollbackNetwork) + execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkXml) + msoLogger.debug(" Network Adapter rollback data - " + "\n" + rollbackNetworkXml) + + } else { // network error + if (returnCode.toInteger() > 399 && returnCode.toInteger() < 600) { //4xx, 5xx + if (networkResponse.contains("updateNetworkError")) { + networkResponse = networkResponse.replace('', '') + errorMessage = utils.getNodeText(networkResponse, "message") + errorMessage = "Received error from Network Adapter: " + errorMessage + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) + + } else { // CatchAll exception + if (returnCode == "500") { + errorMessage = "JBWEB000065: HTTP Status 500." + } else { + errorMessage = "Return code is " + returnCode + } + errorMessage = "Received error from Network Adapter: " + errorMessage + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) + + } + + } else { // CatchAll exception + String dataErrorMessage = "Received error from Network Adapter. Return code is: " + returnCode + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. validateUpdateNetworkResponse() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + + } + + public void validateSDNCResponse (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside validateSDNCResponse of DoUpdateNetworkInstance ") + + String response = execution.getVariable(Prefix + "changeAssignSDNCResponse") + WorkflowException workflowException = null + try { + workflowException = execution.getVariable(Prefix + "WorkflowException") + //execution.setVariable("WorkflowException", workflowException) + } catch (Exception ex) { + msoLogger.debug(" Sdnc 'WorkflowException' object is empty or null. ") + } + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + // reset variable + String changeAssignSDNCResponseDecodeXml = execution.getVariable(Prefix + "changeAssignSDNCResponse") + changeAssignSDNCResponseDecodeXml = changeAssignSDNCResponseDecodeXml.replace('', "") + execution.setVariable(Prefix + "changeAssignSDNCResponse", changeAssignSDNCResponseDecodeXml) + + if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, prefix+'sdncResponseSuccess' + execution.setVariable(Prefix + "isSdncRollbackNeeded", true) + msoLogger.debug("Successfully Validated SDNC Response") + + } else { + msoLogger.debug("Did NOT Successfully Validated SDNC Response") + throw new BpmnError("MSOWorkflowException") + } + + } + + + public void postProcessResponse (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside postProcessResponse of DoUpdateNetworkInstance ") + + try { + msoLogger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException")) + if (execution.getVariable(Prefix + "isException") == false) { + // set rollback data + execution.setVariable("orchestrationStatus", "") + execution.setVariable("networkId", execution.getVariable(Prefix + "networkId")) + execution.setVariable("networkName", execution.getVariable(Prefix + "networkName")) + prepareSuccessRollbackData(execution) // populate rollbackData + execution.setVariable("WorkflowException", null) + execution.setVariable(Prefix + "Success", true) + msoLogger.debug(" ***** postProcessResponse(), GOOD !!!") + } else { + execution.setVariable(Prefix + "Success", false) + execution.setVariable("rollbackData", null) + String exceptionMessage = " Exception encountered in MSO Bpmn. " + if (execution.getVariable("workflowException") != null) { // Output of Rollback flow. + msoLogger.debug(" ***** workflowException: " + execution.getVariable("workflowException")) + WorkflowException wfex = execution.getVariable("workflowException") + exceptionMessage = wfex.getErrorMessage() + } else { + if (execution.getVariable(Prefix + "WorkflowException") != null) { + WorkflowException pwfex = execution.getVariable(Prefix + "WorkflowException") + exceptionMessage = pwfex.getErrorMessage() + } + } + // going to the Main flow: a-la-carte or macro + msoLogger.debug(" ***** postProcessResponse(), BAD !!!") + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + throw new BpmnError("MSOWorkflowException") + } + + } catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + + } + + public void prepareSDNCRollbackRequest (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside prepareSDNCRollbackRequest of DoUpdateNetworkInstance ") + + try { + // for some reason the WorkflowException object is null after the sdnc rollback call task, need to save WorkflowException. + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) + // get variables + String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + String updateNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + String changeAssignSDNCResponse = execution.getVariable(Prefix + "changeAssignSDNCResponse") + String networkId = utils.getNodeText(changeAssignSDNCResponse, "network-id") + + String serviceInstanceId = utils.getNodeText(updateNetworkInput, "service-instance-id") + + // 2. prepare rollback topology via SDNC Adapter SUBFLOW call + String sndcTopologyRollbackRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, updateNetworkInput, serviceInstanceId, sdncCallback, "rollback", "NetworkActivateRequest", cloudRegionId, networkId, null, null) + String sndcTopologyRollbackRequestAsString = utils.formatXml(sndcTopologyRollbackRequest) + execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyRollbackRequestAsString) + msoLogger.debug(" Preparing request for SDNC Topology assign's rollback/compensation . . . - " + "\n" + sndcTopologyRollbackRequestAsString) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareSDNCRollbackRequest() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRollbackData(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareRollbackData() of DoUpdateNetworkInstance ") + + try { + + Map rollbackData = new HashMap(); + String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") + if (rollbackSDNCRequest != null) { + if (rollbackSDNCRequest != "") { + rollbackData.put("rollbackSDNCRequest", execution.getVariable(Prefix + "rollbackSDNCRequest")) + } + } + String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") + if (rollbackNetworkRequest != null) { + if (rollbackNetworkRequest != "") { + rollbackData.put("rollbackNetworkRequest", execution.getVariable(Prefix + "rollbackNetworkRequest")) + } + } + execution.setVariable("rollbackData", rollbackData) + msoLogger.debug("** rollbackData : " + rollbackData) + + execution.setVariable("WorkflowException", execution.getVariable(Prefix + "WorkflowException")) + msoLogger.debug("** WorkflowException : " + execution.getVariable("WorkflowException")) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareRollbackData() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareSuccessRollbackData(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareSuccessRollbackData() of DoUpdateNetworkInstance ") + + try { + + if (execution.getVariable("sdncVersion") != '1610') { + // skip: 1702 for 'changeassign' or equivalent not yet defined in SNDC, so no rollback. + } else { + prepareSDNCRollbackRequest(execution) + } + + Map rollbackData = new HashMap(); + String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") + if (rollbackSDNCRequest != null) { + if (rollbackSDNCRequest != "") { + rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) + } + } + String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") + if (rollbackNetworkRequest != null) { + if (rollbackNetworkRequest != "") { + rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) + } + } + execution.setVariable("rollbackData", rollbackData) + + msoLogger.debug("** 'rollbackData' for Full Rollback : " + rollbackData) + execution.setVariable("WorkflowException", null) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void setExceptionFlag(DelegateExecution execution){ + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside setExceptionFlag() of DoUpdateNetworkInstance ") + + try { + + execution.setVariable(Prefix + "isException", true) + + if (execution.getVariable("SavedWorkflowException1") != null) { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) + } else { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) + } + msoLogger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException")) + + } catch(Exception ex){ + String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. setExceptionFlag(): " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + } + + } + + + // ******************************* + // Build Error Section + // ******************************* + + public void processJavaException(DelegateExecution execution){ + + execution.setVariable("prefix",Prefix) + try{ + msoLogger.debug("Caught a Java Exception") + msoLogger.debug("Started processJavaException Method") + msoLogger.debug("Variables List: " + execution.getVariables()) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + + }catch(Exception e){ + msoLogger.debug("Caught Exception during processJavaException Method: " + e) + execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method") + } + msoLogger.debug("Completed processJavaException Method") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy new file mode 100644 index 0000000000..8a13b3c392 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy @@ -0,0 +1,310 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts; + +import groovy.xml.XmlUtil +import groovy.json.* + +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.NetworkUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.rest.APIResponse + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils + +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +/** + * This groovy class supports the DoCreateNetworkInstance.bpmn process. + * + */ +public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateNetworkInstanceRollback.class); + + String Prefix="UPDNETIR_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + NetworkUtils networkUtils = new NetworkUtils() + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + def className = getClass().getSimpleName() + + /** + * This method is executed during the preProcessRequest task of the DoUpdateNetworkInstanceRollback.bpmn process. + * @param execution + */ + public InitializeProcessVariables(DelegateExecution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable(Prefix + "rollbackNetworkRequest", null) + execution.setVariable(Prefix + "rollbackSDNCRequest", null) + execution.setVariable(Prefix + "WorkflowException", null) + + execution.setVariable(Prefix + "rollbackNetworkRequest", "") + execution.setVariable(Prefix + "rollbackNetworkResponse", "") + execution.setVariable(Prefix + "rollbackNetworkReturnCode", "") + + execution.setVariable(Prefix + "rollbackSDNCRequest", "") + execution.setVariable(Prefix + "rollbackSDNCResponse", "") + execution.setVariable(Prefix + "rollbackSDNCReturnCode", "") + + execution.setVariable(Prefix + "Success", false) + execution.setVariable(Prefix + "fullRollback", false) + + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the DoUpdateNetworkInstanceRollback.bpmn process. + * @param execution + */ + public void preProcessRequest (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside preProcessRequest() of " + className + ".groovy ") + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + // GET Incoming request/variables + String rollbackNetworkRequest = null + String rollbackSDNCRequest = null + + // Partial Rollback + Map rollbackData = execution.getVariable("rollbackData") + if (rollbackData != null && rollbackData instanceof Map) { + + if(rollbackData.containsKey("rollbackNetworkRequest")) { + rollbackNetworkRequest = rollbackData["rollbackNetworkRequest"] + } + + if(rollbackData.containsKey("rollbackSDNCRequest")) { + rollbackSDNCRequest = rollbackData["rollbackSDNCRequest"] + } + } + + execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkRequest) + execution.setVariable(Prefix + "rollbackSDNCRequest", rollbackSDNCRequest) + msoLogger.debug("'rollbackData': " + '\n' + execution.getVariable("rollbackData")) + + String sdncVersion = execution.getVariable("sdncVersion") + msoLogger.debug("sdncVersion? : " + sdncVersion) + + // PO Authorization Info / headers Authorization= + String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution) + + try { + def encodedString = utils.getBasicAuth(basicAuthValuePO, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable("BasicAuthHeaderValuePO",encodedString) + execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) + + } catch (IOException ex) { + String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " + String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() + msoLogger.debug(dataErrorMessage ) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + if (execution.getVariable("SavedWorkflowException1") != null) { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) + } else { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) + } + msoLogger.debug("*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException")) + if(execution.getVariable(Prefix + "WorkflowException") != null) { + // called by: DoCreateNetworkInstance, partial rollback + execution.setVariable(Prefix + "fullRollback", false) + + } else { + // called by: Macro - Full Rollback, WorkflowException = null + execution.setVariable(Prefix + "fullRollback", true) + + } + msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) + + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + sendSyncError(execution) + // caught exception + String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void validateRollbackResponses (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside validateRollbackResponses() of DoUpdateNetworkInstanceRollback ") + + try { + // validate PO network rollback response + String rollbackNetworkErrorMessages = "" + String rollbackNetworkReturnCode = "200" + if (execution.getVariable(Prefix + "rollbackNetworkRequest") != null) { + rollbackNetworkReturnCode = execution.getVariable(Prefix + "rollbackNetworkReturnCode") + String rollbackNetworkResponse = execution.getVariable(Prefix + "rollbackNetworkResponse") + msoLogger.debug(" NetworkRollback Code - " + rollbackNetworkReturnCode) + msoLogger.debug(" NetworkRollback Response - " + rollbackNetworkResponse) + if (rollbackNetworkReturnCode != "200") { + rollbackNetworkErrorMessages = " + PO Network rollback failed. " + } else { + rollbackNetworkErrorMessages = " + PO Network rollback completed." + } + } + + // validate SDNC rollback response + String rollbackSdncErrorMessages = "" + String rollbackSDNCReturnCode = "200" + if (execution.getVariable(Prefix + "rollbackSDNCRequest") != null) { + rollbackSDNCReturnCode = execution.getVariable(Prefix + "rollbackSDNCReturnCode") + String rollbackSDNCResponse = execution.getVariable(Prefix + "rollbackSDNCResponse") + String rollbackSDNCReturnInnerCode = "" + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + rollbackSDNCResponse = rollbackSDNCResponse.replace('$', '').replace('', "") + if (rollbackSDNCReturnCode == "200") { + if (utils.nodeExists(rollbackSDNCResponse, "response-code")) { + rollbackSDNCReturnInnerCode = utils.getNodeText(rollbackSDNCResponse, "response-code") + if (rollbackSDNCReturnInnerCode == "200" || rollbackSDNCReturnInnerCode == "" || rollbackSDNCReturnInnerCode == "0") { + rollbackSdncErrorMessages = " + SNDC changeassign rollback completed." + } else { + rollbackSdncErrorMessages = " + SDNC changeassign rollback failed. " + } + } else { + rollbackSdncErrorMessages = " + SNDC changeassign rollback completed." + } + } else { + rollbackSdncErrorMessages = " + SDNC changeassign rollback failed. " + } + msoLogger.debug(" SDNC changeassign rollback Code - " + rollbackSDNCReturnCode) + msoLogger.debug(" SDNC changeassign rollback Response - " + rollbackSDNCResponse) + } + + String statusMessage = "" + int errorCode = 7000 + msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) + if (execution.getVariable(Prefix + "fullRollback") == false) { + // original WorkflowException, + WorkflowException wfe = execution.getVariable(Prefix + "WorkflowException") + if (wfe != null) { + // rollback due to failure in DoCreate - Partial rollback + statusMessage = wfe.getErrorMessage() + errorCode = wfe.getErrorCode() + } else { + statusMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." + errorCode = '7000' + } + + // set if all rolledbacks are successful + if (rollbackNetworkReturnCode == "200" && rollbackSDNCReturnCode == "200") { + execution.setVariable("rolledBack", true) + + } else { + execution.setVariable("rolledBack", false) + + } + + statusMessage = statusMessage + rollbackNetworkErrorMessages + rollbackSdncErrorMessages + msoLogger.debug("Final DoUpdateNetworkInstanceRollback status message: " + statusMessage) + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, errorCode, statusMessage); + execution.setVariable("workflowException", exception); + + } else { + // rollback due to failures in Main flow (Macro) - Full rollback + // WorkflowException = null + if (rollbackNetworkReturnCode == "200" && rollbackSDNCReturnCode == "200") { + execution.setVariable("rollbackSuccessful", true) + execution.setVariable("rollbackError", false) + } else { + String exceptionMessage = "Network Update Rollback was not Successful. " + msoLogger.debug(exceptionMessage) + execution.setVariable("rollbackSuccessful", false) + execution.setVariable("rollbackError", true) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + throw new BpmnError("MSOWorkflowException") + } + + } + + + } catch (Exception ex) { + execution.setVariable("WorkflowException", null) + String errorMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." + String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstanceRollback flow. validateRollbackResponses() - " + errorMessage + ": " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + execution.setVariable("WorkflowException", execution.getVariable("WorkflowException")) + + } + + } + + // ******************************* + // Build Error Section + // ******************************* + + + + public void processJavaException(DelegateExecution execution){ + + execution.setVariable("prefix",Prefix) + + try{ + msoLogger.debug("Caught a Java Exception in " + Prefix) + msoLogger.debug("Started processJavaException Method") + msoLogger.debug("Variables List: " + execution.getVariables()) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + + }catch(Exception e){ + msoLogger.debug("Caught Exception during processJavaException Method: " + e) + execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) + } + msoLogger.trace("Completed processJavaException Method in " + Prefix) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy new file mode 100644 index 0000000000..451e0293ef --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy @@ -0,0 +1,1040 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.CatalogDbUtils +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.NetworkUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.VfModule +import org.onap.so.bpmn.common.scripts.VfModuleBase +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils; +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.AAIUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils + +public class DoUpdateVfModule extends VfModuleBase { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateVfModule.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + CatalogDbUtils catalog = new CatalogDbUtils() + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'DOUPVfMod_') + execution.setVariable('DOUPVfMod_requestInfo', null) + execution.setVariable('DOUPVfMod_serviceInstanceId', null) + execution.setVariable('DOUPVfMod_requestId', null) + execution.setVariable('DOUPVfMod_vnfInputs', null) + execution.setVariable('DOUPVfMod_vnfId', null) + execution.setVariable('DOUPVfMod_vnfName', null) + execution.setVariable('DOUPVfMod_vnfNameFromAAI', null) + execution.setVariable('DOUPVfMod_vfModuleName', null) + execution.setVariable('DOUPVfMod_vfModuleId', null) + execution.setVariable('DOUPVfMod_vnfType', null) + execution.setVariable('DOUPVfMod_asdcServiceModelVersion', null) + execution.setVariable('DOUPVfMod_vfModuleModelName', null) + execution.setVariable('DOUPVfMod_modelCustomizationUuid', null) + execution.setVariable("DOUPVfMod_isBaseVfModule", "false") + execution.setVariable('DOUPVfMod_serviceId', null) + execution.setVariable('DOUPVfMod_aicCloudRegion', null) + execution.setVariable('DOUPVfMod_tenantId', null) + execution.setVariable('DOUPVfMod_volumeGroupId', null) + execution.setVariable("DOUPVfMod_volumeGroupStackId", "") + execution.setVariable('DOUPVfMod_vfModule', null) + execution.setVariable('DOUPVfMod_vnfParams', null) + execution.setVariable("DOUPVfMod_baseVfModuleId", "") + execution.setVariable("DOUPVfMod_baseVfModuleHeatStackId", "") + execution.setVariable('DOUPVfMod_prepareUpdateAAIVfModuleRequest', null) + execution.setVariable('DOUPVfMod_sdncChangeAssignRequest', null) + execution.setVariable('DOUPVfMod_sdncChangeAssignResponse', null) + execution.setVariable('DOUPVfMod_sdncActivateRequest', null) + execution.setVariable('DOUPVfMod_sdncActivateResponse', null) + execution.setVariable('DOUPVfMod_sdncTopologyRequest', null) + execution.setVariable('DOUPVfMod_sdncTopologyResponse', null) + execution.setVariable('DOUPVfMod_vnfAdapterRestRequest', null) + execution.setVariable('DOUPVfMod_updateAAIGenericVnfRequest', null) + execution.setVariable('DOUPVfMod_updateAAIVfModuleRequest', null) + execution.setVariable('DOUPVfMod_skipUpdateGenericVnf', false) + execution.setVariable('DoUpdateVfModuleSuccessIndicator', false) + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + initProcessVariables(execution) + def xml = getVariable(execution, 'DoUpdateVfModuleRequest') + msoLogger.debug("DoUpdateVfModule request: " + xml) + msoLogger.debug('Received request xml:\n' + xml) + + if (xml == null || xml.isEmpty()) { + // Building Block-type request + + String cloudConfiguration = execution.getVariable("cloudConfiguration") + String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo") + + def serviceModelInfo = execution.getVariable("serviceModelInfo") + msoLogger.debug("serviceModelInfo: " + serviceModelInfo) + String modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") + msoLogger.debug("modelInvariantUuid: " + modelInvariantUuid) + def vnfModelInfo = execution.getVariable("vnfModelInfo") + + //tenantId + def tenantId = execution.getVariable("tenantId") + execution.setVariable("DOUPVfMod_tenantId", tenantId) + + //volumeGroupId + def volumeGroupId = execution.getVariable("volumeGroupId") + execution.setVariable("DOUPVfMod_volumeGroupId", volumeGroupId) + + //cloudSiteId + def cloudSiteId = execution.getVariable("lcpCloudRegionId") + execution.setVariable("DOUPVfMod_aicCloudRegion", cloudSiteId) + + msoLogger.debug("cloudSiteId: " + cloudSiteId) + //vnfType + def vnfType = execution.getVariable("vnfType") + execution.setVariable("DOUPVfMod_vnfType", vnfType) + + msoLogger.debug("vnfType: " + vnfType) + //vnfName + def vnfName = execution.getVariable("vnfName") + execution.setVariable("DOUPVfMod_vnfName", vnfName) + + msoLogger.debug("vnfName: " + vnfName) + //vnfId + def vnfId = execution.getVariable("vnfId") + execution.setVariable("DOUPVfMod_vnfId", vnfId) + + msoLogger.debug("vnfId: " + vnfId) + //vfModuleName + def vfModuleName = execution.getVariable("vfModuleName") + execution.setVariable("DOUPVfMod_vfModuleName", vfModuleName) + + msoLogger.debug("vfModuleName: " + vfModuleName) + //vfModuleModelName + def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName") + execution.setVariable("DOUPVfMod_vfModuleModelName", vfModuleModelName) + + msoLogger.debug("vfModuleModelName: " + vfModuleModelName) + //modelCustomizationUuid + def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid") + if (modelCustomizationUuid == null) { + modelCustomizationUuid = "" + } + execution.setVariable("DOUPVfMod_modelCustomizationUuid", modelCustomizationUuid) + + msoLogger.debug("modelCustomizationUuid: " + modelCustomizationUuid) + //vfModuleId + def vfModuleId = execution.getVariable("vfModuleId") + execution.setVariable("DOUPVfMod_vfModuleId", vfModuleId) + msoLogger.debug("vfModuleId: " + vfModuleId) + def requestId = execution.getVariable("msoRequestId") + execution.setVariable("DOUPVfMod_requestId", requestId) + msoLogger.debug("requestId: " + requestId) + // Set mso-request-id to request-id for VNF Adapter interface + execution.setVariable("mso-request-id", requestId) + //serviceId + def serviceId = execution.getVariable("serviceId") + execution.setVariable("DOUPVfMod_serviceId", serviceId) + msoLogger.debug("serviceId: " + serviceId) + //serviceInstanceId + def serviceInstanceId = execution.getVariable("serviceInstanceId") + execution.setVariable("DOUPVfMod_serviceInstanceId", serviceInstanceId) + + msoLogger.debug("serviceInstanceId: " + serviceInstanceId) + //source - HARDCODED + def source = "VID" + execution.setVariable("DOUPVfMod_source", source) + + msoLogger.debug("source: " + source) + //backoutOnFailure + def disableRollback = execution.getVariable("disableRollback") + def backoutOnFailure = true + if (disableRollback != null && disableRollback.equals("true")) { + backoutOnFailure = false + } + execution.setVariable("DOUPVfMod_backoutOnFailure", backoutOnFailure) + msoLogger.debug("backoutOnFailure: " + backoutOnFailure) + //isBaseVfModule + def isBaseVfModule = execution.getVariable("isBaseVfModule") + execution.setVariable("DOUPVfMod_isBaseVfModule", isBaseVfModule) + msoLogger.debug("isBaseVfModule: " + isBaseVfModule) + //asdcServiceModelVersion + def asdcServiceModelVersion = execution.getVariable("asdcServiceModelVersion") + execution.setVariable("DOUPVfMod_asdcServiceModelVersion", asdcServiceModelVersion) + msoLogger.debug("asdcServiceModelVersion: " + asdcServiceModelVersion) + //personaModelId + execution.setVariable("DOUPVfMod_personaModelId", jsonUtil.getJsonValue(vfModuleModelInfo, "modelInvariantUuid")) + //personaModelVersion + execution.setVariable("DOUPVfMod_personaModelVersion", jsonUtil.getJsonValue(vfModuleModelInfo, "modelVersion")) + //Get or Generate UUID + String uuid = execution.getVariable("DOUPVfMod_uuid") + if(uuid == null){ + uuid = UUID.randomUUID() + msoLogger.debug("Generated messageId (UUID) is: " + uuid) + }else{ + msoLogger.debug("Found messageId (UUID) is: " + uuid) + } + //isVidRequest + String isVidRequest = execution.getVariable("isVidRequest") + // default to true + if (isVidRequest == null || isVidRequest.isEmpty()) { + execution.setVariable("isVidRequest", "true") + } + //usePreload + def usePreload = execution.getVariable("usePreload") + execution.setVariable("DOUPVfMod_usePreload", usePreload) + msoLogger.debug("usePreload: " + usePreload) + //globalSubscriberId + String globalSubscriberId = execution.getVariable("globalSubscriberId") + execution.setVariable("DOUPVfMod_globalSubscriberId", globalSubscriberId) + msoLogger.debug("globalSubsrciberId: " + globalSubscriberId) + //vnfQueryPath + String vnfQueryPath = execution.getVariable("vnfQueryPath") + execution.setVariable("DOUPVfMod_vnfQueryPath", vnfQueryPath) + msoLogger.debug("vnfQueryPath: " + vnfQueryPath) + + Map vfModuleInputParams = execution.getVariable("vfModuleInputParams") + if (vfModuleInputParams != null) { + execution.setVariable("DOUPVfMod_vnfParamsMap", vfModuleInputParams) + } + //get workload and environment context from parent SI + String environmentContext = "" + String workloadContext ="" + String serviceType ="" + + try{ + String json = catalog.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) + serviceType = jsonUtil.getJsonValue(json, "serviceResources.serviceType") + }catch(BpmnError e){ + throw e + } catch (Exception ex){ + String msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + try{ + AAIUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId) + AAIResourcesClient aaiRC = new AAIResourcesClient() + AAIResultWrapper aaiRW = aaiRC.get(serviceInstanceURI) + Map aaiJson = aaiRW.asMap() + environmentContext = aaiJson.getOrDefault("environment-context","") + workloadContext = aaiJson.getOrDefault("workload-context","") + + }catch (Exception ex) { + msoLogger.debug("Error retreiving parent service instance information") + } + + execution.setVariable("DCVFM_environmentContext",environmentContext) + execution.setVariable("DCVFM_workloadContext",workloadContext) + } + else { + + def requestInfo = getRequiredNodeXml(execution, xml, 'request-info') + execution.setVariable('DOUPVfMod_requestInfo', requestInfo) + execution.setVariable('DOUPVfMod_requestId', getRequiredNodeText(execution, requestInfo, 'request-id')) + def serviceInstanceId = execution.getVariable('mso-service-instance-id') + if (serviceInstanceId == null) { + serviceInstanceId = '' + } + execution.setVariable('DOUPVfMod_serviceInstanceId', serviceInstanceId) + + def vnfInputs = getRequiredNodeXml(execution, xml, 'vnf-inputs') + execution.setVariable('DOUPVfMod_vnfInputs', vnfInputs) + execution.setVariable('DOUPVfMod_vnfId', getRequiredNodeText(execution, vnfInputs, 'vnf-id')) + execution.setVariable('DOUPVfMod_vfModuleId', getRequiredNodeText(execution, vnfInputs, 'vf-module-id')) + execution.setVariable('DOUPVfMod_vfModuleName', getNodeTextForce(vnfInputs, 'vf-module-name')) + execution.setVariable('DOUPVfMod_vnfType', getNodeTextForce(vnfInputs, 'vnf-type')) + execution.setVariable('DOUPVfMod_vnfName', getNodeTextForce(vnfInputs, 'vnf-name')) + execution.setVariable('DOUPVfMod_asdcServiceModelVersion', getNodeTextForce(vnfInputs, 'asdc-service-model-version')) + execution.setVariable('DOUPVfMod_vfModuleModelName', getRequiredNodeText(execution, vnfInputs, 'vf-module-model-name')) + execution.setVariable('DOUPVfMod_modelCustomizationUuid', getNodeTextForce(vnfInputs, 'model-customization-id')) + execution.setVariable('DOUPVfMod_serviceId', getRequiredNodeText(execution, vnfInputs, 'service-id')) + execution.setVariable('DOUPVfMod_aicCloudRegion', getRequiredNodeText(execution, vnfInputs, 'aic-cloud-region')) + execution.setVariable('DOUPVfMod_tenantId', getRequiredNodeText(execution, vnfInputs, 'tenant-id')) + //isBaseVfModule + def isBaseVfModule = "false" + if (utils.nodeExists(xml, "is-base-vf-module")) { + isBaseVfModule = utils.getNodeText(xml, "is-base-vf-module") + execution.setVariable("DOUPVfMod_isBaseVfModule", isBaseVfModule) + } + msoLogger.debug("isBaseVfModule: " + isBaseVfModule) + + NetworkUtils networkUtils = new NetworkUtils() + def backoutOnFailure = networkUtils.isRollbackEnabled(execution, xml) + execution.setVariable("DOUPVfMod_backoutOnFailure", backoutOnFailure) + + def String vgi = getNodeTextForce(vnfInputs, 'volume-group-id') + execution.setVariable('DOUPVfMod_volumeGroupId', vgi) + + execution.setVariable('DOUPVfMod_vnfParams', utils.getNodeXml(xml, 'vnf-params', false)) + } + + def sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { + def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) + } + } + + /** + * Prepare a Request for invoking the PrepareUpdateAAIVfModule subflow. This will + * set the orchestration-status to 'pending-update'. + * + * @param execution The flow's execution instance. + */ + public void prepPrepareUpdateAAIVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preparePrepareUpdateAAIVfModule(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('DOUPVfMod_vnfId') + def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId') + def orchestrationStatus = 'pending-update' + + String prepareUpdateAAIVfModuleRequest = """ + + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(orchestrationStatus)} + + """ + prepareUpdateAAIVfModuleRequest = utils.formatXml(prepareUpdateAAIVfModuleRequest) + execution.setVariable('DOUPVfMod_prepareUpdateAAIVfModuleRequest', prepareUpdateAAIVfModuleRequest) + msoLogger.debug("DoUpdateAAIVfModule request: " + prepareUpdateAAIVfModuleRequest) + msoLogger.debug('Request for PrepareUpdateAAIVfModule:\n' + prepareUpdateAAIVfModuleRequest) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preparePrepareUpdateAAIVfModule(): ' + e.getMessage()) + } + } + + /** + * Prepare a Request for invoking the ConfirmVolumeGroupTenant subflow. + * Determine cloud region id for the volume group. + * + * @param execution The flow's execution instance. + */ + public void prepConfirmVolumeGroupTenant(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepConfirmVolumeGroupTenant(' + + 'execution=' + execution.getId() + + ')' + + def prefix = execution.getVariable("prefix") + + msoLogger.trace('Entered ' + method) + + try { + String cloudRegion = execution.getVariable(prefix + "aicCloudRegion") + + // Prepare AA&I url + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUtil = new AaiUtil(this) + String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) + String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion + msoLogger.debug("CloudRegion Request: " + queryCloudRegionRequest) + + execution.setVariable(prefix + "queryCloudRegionRequest", queryCloudRegionRequest) + msoLogger.debug(prefix + "queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest) + + cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "AAI", cloudRegion) + + if ((cloudRegion != "ERROR")) { + if(execution.getVariable(prefix + "queryCloudRegionReturnCode") == "404"){ + execution.setVariable(prefix + "cloudRegionForVolume", "AAIAIC25") + }else{ + execution.setVariable(prefix + "cloudRegionForVolume", cloudRegion) + } + execution.setVariable(prefix + "isCloudRegionGood", true) + } else { + String errorMessage = "AAI Query Cloud Region Unsuccessful. AAI Response Code: " + execution.getVariable(prefix + "queryCloudRegionReturnCode") + msoLogger.debug(errorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) + execution.setVariable(prefix + "isCloudRegionGood", false) + } + msoLogger.debug(" is Cloud Region Good: " + execution.getVariable(prefix + "isCloudRegionGood")) + + } catch(BpmnError b){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + b); + throw b + }catch (Exception e) { + // try error + String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + e.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " AAI Query Cloud Region Failed. Exception - " + "\n" + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during prepConfirmVolumeGroupTenant(): " + e.getMessage()) + } + msoLogger.trace('Exited ' + method) + + } + + /** + * Prepare a Request for invoking the SDNC Adapter subflow to perform + * a VNF topology 'changeassign' operation. + * + * @param execution The flow's execution instance. + */ + public void prepSDNCTopologyChg(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepSDNCTopologyChg(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def requestId = execution.getVariable('DOUPVfMod_requestId') + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("DOUPVfMod_requestId") + "-" + System.currentTimeMillis() + } + def serviceInstanceId = execution.getVariable('DOUPVfMod_serviceInstanceId') + def callbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + def serviceId = execution.getVariable('DOUPVfMod_serviceId') + def vnfId = execution.getVariable('DOUPVfMod_vnfId') + def vnfType = execution.getVariable('DOUPVfMod_vnfType') + def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId') + def vfModuleModelName = execution.getVariable('DOUPVfMod_vfModuleModelName') + def VfModule vfModule = (VfModule) execution.getVariable('DOUPVfMod_vfModule') + def vfModuleName = vfModule.getElementText('vf-module-name') + def tenantId = execution.getVariable('DOUPVfMod_tenantId') + def aicCloudRegion = execution.getVariable('DOUPVfMod_aicCloudRegion') + boolean usePreload = execution.getVariable("DOUPVfMod_usePreload") + String usePreloadToSDNC = usePreload ? "Y" : "N" + def modelCustomizationUuid = execution.getVariable("DoUPVfMod_modelCustomizationUuid") + def modelCustomizationUuidString = "" + if (!usePreload) { + modelCustomizationUuidString = "" + modelCustomizationUuid + "" + } + + // Retrieve vnf name from AAI response + def vnfName = execution.getVariable('DOUPVfMod_vnfNameFromAAI') + execution.setVariable('DOUPVfMod_vnfName', vnfName) + + def vnfParamsXml = execution.getVariable('DOUPVfMod_vnfParams') + def vnfNetworks = transformNetworkParamsToVnfNetworks(vnfParamsXml) + + String sdncTopologyRequest = """ + + + ${MsoUtils.xmlEscape(uuid)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + changeassign + vnf-topology-operation + ${MsoUtils.xmlEscape(callbackUrl)} + + + + ${MsoUtils.xmlEscape(requestId)} + ChangeVNFActivateRequest + PORTAL + + + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(vnfId)} + dontcare + + + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(vfModuleModelName)} + ${MsoUtils.xmlEscape(vfModuleName)} + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vnfName)} + ${MsoUtils.xmlEscape(vnfType)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(aicCloudRegion)} + ${modelCustomizationUuidString} + ${MsoUtils.xmlEscape(usePreloadToSDNC)} + ${vnfNetworks} + + + + """ + sdncTopologyRequest = utils.formatXml(sdncTopologyRequest) + execution.setVariable('DOUPVfMod_sdncChangeAssignRequest', sdncTopologyRequest) + msoLogger.debug("sdncChangeAssignRequest : " + sdncTopologyRequest) + msoLogger.debug('Request for SDNCAdapter topology/changeassign:\n' + sdncTopologyRequest) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyChg(): ' + e.getMessage()) + } + } + + /** + * Prepare a Request for invoking the SDNC Adapter subflow to perform + * a VNF topology 'query' operation. + * + * @param execution The flow's execution instance. + */ + public void prepSDNCTopologyQuery(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepSDNCTopologyQuery(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("DOUPVfMod_requestId") + "-" + System.currentTimeMillis() + } + def requestId = execution.getVariable('DOUPVfMod_requestId') + def serviceInstanceId = execution.getVariable('DOUPVfMod_serviceInstanceId') + def callbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId') + + def svcInstId = "" + if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { + svcInstId = vfModuleId + } + else { + svcInstId = serviceInstanceId + } + + //!!!! TEMPORARY WORKAROUND FOR SDNC REPLICATION ISSUE + sleep(5000) + + String sdncTopologyRequest = """ + + + ${MsoUtils.xmlEscape(uuid)} + ${MsoUtils.xmlEscape(svcInstId)} + query + /VNF-API:vnfs/vnf-list/${vfModuleId} + ${MsoUtils.xmlEscape(callbackUrl)} + mobility + + + """ + sdncTopologyRequest = utils.formatXml(sdncTopologyRequest) + execution.setVariable('DOUPVfMod_sdncTopologyRequest', sdncTopologyRequest) + msoLogger.debug("sdncTopologyRequest : " + sdncTopologyRequest) + msoLogger.debug('Request for SDNCAdapter query:\n' + sdncTopologyRequest) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyQuery(): ' + e.getMessage()) + } + } + + /** + * Prepare a Request for invoking the VnfAdapterRest subflow. + * + * @param execution The flow's execution instance. + */ + public void prepVnfAdapterRest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepVnfAdapterRest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def requestId = execution.getVariable('DOUPVfMod_requestId') + def serviceInstanceId = execution.getVariable('DOUPVfMod_serviceInstanceId') + def vnfId = execution.getVariable('DOUPVfMod_vnfId') + def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId') + def vfModuleName = execution.getVariable('DOUPVfMod_vfModuleName') + def vnfInputs = execution.getVariable('DOUPVfMod_vnfInputs') + def tenantId = execution.getVariable('DOUPVfMod_tenantId') + def volumeGroupId = execution.getVariable('DOUPVfMod_volumeGroupId') + def volumeGroupStackId = execution.getVariable('DOUPVfMod_volumeGroupStackId') + def VfModule vfModule = (VfModule) execution.getVariable('DOUPVfMod_vfModule') + def heatStackId = vfModule.getElementText('heat-stack-id') + def cloudId = execution.getVariable('DOUPVfMod_aicCloudRegion') + def vnfType = execution.getVariable('DOUPVfMod_vnfType') + def vnfName = execution.getVariable('DOUPVfMod_vnfName') + def vfModuleModelName = execution.getVariable('DOUPVfMod_vfModuleModelName') + def baseVfModuleId = execution.getVariable("DOUPVfMod_baseVfModuleId") + def baseVfModuleStackId = execution.getVariable("DOUPVfMod_baseVfModuleHeatStackId") + def asdcServiceModelVersion = execution.getVariable('DOUPVfMod_asdcServiceModelVersion') + def modelCustomizationUuid = execution.getVariable('DOUPVfMod_modelCustomizationUuid') + def backoutOnFailure = execution.getVariable("DOUPVfMod_backoutOnFailure") + + def messageId = execution.getVariable('mso-request-id') + '-' + System.currentTimeMillis() + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) + def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) + if ('true'.equals(useQualifiedHostName)) { + notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) + } + + String environmentContext = execution.getVariable("DOUPVEnvironment_context") + String workloadContext = execution.getVariable("DOUPVWorkload_context") + msoLogger.debug("workloadContext: " + workloadContext) + msoLogger.debug("environmentContext: " + environmentContext) + + Map vnfParamsMap = execution.getVariable("DOUPVfMod_vnfParamsMap") + + String sdncGetResponse = execution.getVariable('DOUPVfMod_sdncTopologyResponse') + + String vfModuleParams = buildVfModuleParams(vnfParamsMap, sdncGetResponse, vnfId, vnfName, + vfModuleId, vfModuleName, null, environmentContext, workloadContext) + + + String vnfAdapterRestRequest = """ + + ${MsoUtils.xmlEscape(cloudId)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(heatStackId)} + ${MsoUtils.xmlEscape(vnfType)} + ${MsoUtils.xmlEscape(asdcServiceModelVersion)} + ${MsoUtils.xmlEscape(modelCustomizationUuid)} + ${MsoUtils.xmlEscape(vfModuleModelName)} + ${MsoUtils.xmlEscape(volumeGroupId)} + ${MsoUtils.xmlEscape(volumeGroupStackId)} + ${MsoUtils.xmlEscape(baseVfModuleId)} + ${MsoUtils.xmlEscape(baseVfModuleStackId)} + true + ${MsoUtils.xmlEscape(backoutOnFailure)} + false + + ${vfModuleParams} + + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + + ${MsoUtils.xmlEscape(messageId)} + ${MsoUtils.xmlEscape(notificationUrl)} + + """ + vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest) + execution.setVariable('DOUPVfMod_vnfAdapterRestRequest', vnfAdapterRestRequest) + msoLogger.debug("vnfAdapterRestRequest : " + vnfAdapterRestRequest) + msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage()) + } + } + + /** + * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. + * + * @param execution The flow's execution instance. + */ + public void prepUpdateAAIGenericVnf(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('DOUPVfMod_vnfId') + def vnfInputs = execution.getVariable('DOUPVfMod_vnfInputs') + + def personaModelId = utils.getNodeText(vnfInputs, 'vnf-persona-model-id') + def personaModelVersion = utils.getNodeText(vnfInputs, 'vnf-persona-model-version') + if ((personaModelId == null) || (personaModelVersion == null)) { + msoLogger.debug("Skipping update for Generic VNF ' + vnfId + ' because either \'vnf-persona-model-id\' or \'vnf-persona-model-version\' is absent") + execution.setVariable('DOUPVfMod_skipUpdateGenericVnf', true) + } else { + def personaModelIdElement = '' + personaModelId + '' + def personaModelVersionElement = '' + personaModelVersion + '' + + String updateAAIGenericVnfRequest = """ + + ${MsoUtils.xmlEscape(vnfId)} + ${personaModelIdElement} + ${personaModelVersionElement} + + """ + updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) + execution.setVariable('DOUPVfMod_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) + msoLogger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) + msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) + } + } + + /** + * Prepare a Request for invoking the UpdateAAIVfModule subflow. + * + * @param execution The flow's execution instance. + */ + public void prepUpdateAAIVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepUpdateAAIVfModule(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('DOUPVfMod_vnfId') + def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId') + def orchestrationStatus = 'updated' + def vnfInputs = execution.getVariable('DOUPVfMod_vnfInputs') + + def volumeGroupIdElement = '' + def volumeGroupId = execution.getVariable('DOUPVfMod_volumeGroupId') + if (volumeGroupId != null) { + volumeGroupIdElement = '' + volumeGroupId + '' + } + def personaModelIdElement = '' + def personaModelId = utils.getNodeText(vnfInputs, 'persona-model-id') + if (personaModelId != null) { + personaModelIdElement = '' + personaModelId + '' + } + def personaModelVersionElement = '' + def personaModelVersion = utils.getNodeText(vnfInputs, 'persona-model-version') + if (personaModelVersion != null) { + personaModelVersionElement = '' + personaModelVersion + '' + } + def contrailServiceInstanceFqdnElement = '' + def contrailServiceInstanceFqdn = utils.getNodeText(vnfInputs, 'contrail-service-instance-fqdn') + if (contrailServiceInstanceFqdn != null) { + contrailServiceInstanceFqdnElement = '' + contrailServiceInstanceFqdn + '' + } + def personaModelCustomizationIdElement = '' + def modelCustomizationId = execution.getVariable('DOUPVfMod_modelCustomizationUuid') + if (modelCustomizationId != null) { + personaModelCustomizationIdElement = '' + modelCustomizationId + '' + } + + String updateAAIVfModuleRequest = """ + + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(orchestrationStatus)} + ${volumeGroupIdElement} + ${personaModelIdElement} + ${personaModelVersionElement} + ${contrailServiceInstanceFqdnElement} + ${personaModelCustomizationIdElement} + + """ + + msoLogger.debug('Unformatted updateAAIVfModuleRequest: ' + updateAAIVfModuleRequest) + updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest) + execution.setVariable('DOUPVfMod_updateAAIVfModuleRequest', updateAAIVfModuleRequest) + msoLogger.debug("updateAAIVfModuleRequest : " + updateAAIVfModuleRequest) + msoLogger.debug('Request for UpdateAAIVfModule:\n' + updateAAIVfModuleRequest) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIVfModule(): ' + e.getMessage()) + } + } + + /** + * Prepare a Request for invoking the SDNC Adapter subflow to perform + * a VNF topology 'activate' operation. + * + * @param execution The flow's execution instance. + */ + public void prepSDNCTopologyAct(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepSDNCTopologyAct(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("DOUPVfMod_requestId") + "-" + System.currentTimeMillis() + } + def requestId = execution.getVariable('DOUPVfMod_requestId') + def serviceInstanceId = execution.getVariable('DOUPVfMod_serviceInstanceId') + def callbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + def serviceId = execution.getVariable('DOUPVfMod_serviceId') + def vnfId = execution.getVariable('DOUPVfMod_vnfId') + def vnfName = execution.getVariable('DOUPVfMod_vnfName') + def vnfType = execution.getVariable('DOUPVfMod_vnfType') + def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId') + def vfModuleModelName = execution.getVariable('DOUPVfMod_vfModuleModelName') + def VfModule vfModule = (VfModule) execution.getVariable('DOUPVfMod_vfModule') + def vfModuleName = vfModule.getElementText('vf-module-name') + def tenantId = execution.getVariable('DOUPVfMod_tenantId') + def aicCloudRegion = execution.getVariable('DOUPVfMod_aicCloudRegion') + + boolean usePreload = execution.getVariable("DOUPVfMod_usePreload") + String usePreloadToSDNC = usePreload ? "Y" : "N" + def modelCustomizationUuid = execution.getVariable("DoUPVfMod_modelCustomizationUuid") + def modelCustomizationUuidString = "" + if (!usePreload) { + modelCustomizationUuidString = "" + modelCustomizationUuid + "" + } + + def vnfParamsXml = execution.getVariable('DOUPVfMod_vnfParams') + def vnfNetworks = transformNetworkParamsToVnfNetworks(vnfParamsXml) + + String sdncTopologyRequest = """ + + + ${MsoUtils.xmlEscape(uuid)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + activate + vnf-topology-operation + ${MsoUtils.xmlEscape(callbackUrl)} + + + + ${MsoUtils.xmlEscape(requestId)} + ChangeVNFActivateRequest + PORTAL + + + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(vnfId)} + dontcare + + + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(vfModuleModelName)} + ${MsoUtils.xmlEscape(vfModuleName)} + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vnfName)} + ${MsoUtils.xmlEscape(vnfType)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(aicCloudRegion)} + ${modelCustomizationUuidString} + ${MsoUtils.xmlEscape(usePreloadToSDNC)} + + + + """ + sdncTopologyRequest = utils.formatXml(sdncTopologyRequest) + execution.setVariable('DOUPVfMod_sdncActivateRequest', sdncTopologyRequest) + msoLogger.debug("sdncActivateRequest : " + sdncTopologyRequest) + msoLogger.debug('Request for SDNCAdapter topology/activate:\n' + sdncTopologyRequest) + + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyAct(): ' + e.getMessage()) + } + } + + /** + * Log a WorkflowException that has been created. + * + * @param execution The flow's execution instance. + */ + public void handleWorkflowException(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.handleWorkflowException(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def WorkflowException workflowException = (WorkflowException) execution.getVariable('WorkflowException') + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, method + ' caught WorkflowException: ' + workflowException.getErrorMessage(), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildWorkflowException(execution, 1002, 'Error in handleWorkflowException(): ' + e.getMessage()) + } + } + + public void validateSDNCResponse(DelegateExecution execution, String response, String method){ + + def prefix = execution.getVariable("prefix") + + msoLogger.trace("STARTED ValidateSDNCResponse Process") + + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + msoLogger.debug("workflowException: " + workflowException) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + msoLogger.debug("SDNCResponse: " + response) + + String sdncResponse = response + if(execution.getVariable(prefix + 'sdncResponseSuccess') == true){ + msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) + }else{ + msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + throw new BpmnError("MSOWorkflowException") + } + msoLogger.trace("COMPLETED ValidateSDNCResponse Process") + } + + /** + * Using the received vnfId and vfModuleId, query AAI to get the corresponding VNF info. + * A 200 response is expected with the VNF info in the response body. Will find out the base module info. + * + * @param execution The flow's execution instance. + */ + public void queryAAIVfModule(DelegateExecution execution) { + + def method = getClass().getSimpleName() + '.getVfModule(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('DOUPVfMod_vnfId') + def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId') + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" + msoLogger.debug("AAI endPoint: " + endPoint) + + try { + def aaiRequestId = UUID.randomUUID().toString() + msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint) + msoLogger.debug("createVfModule - invoking httpGet() to AAI") + + def responseData = response.getResponseBodyAsString() + if (responseData != null) { + msoLogger.debug("Received generic VNF data: " + responseData) + + } + + msoLogger.debug("createVfModule - queryAAIVfModule Response: " + responseData) + msoLogger.debug("createVfModule - queryAAIVfModule ResponseCode: " + response.getStatusCode()) + + execution.setVariable('DOUPVfMod_queryAAIVfModuleResponseCode', response.getStatusCode()) + execution.setVariable('DOUPVfMod_queryAAIVfModuleResponse', responseData) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + if (response.getStatusCode() == 200) { + // Parse the VNF record from A&AI to find base module info + msoLogger.debug('Parsing the VNF data to find base module info') + if (responseData != null) { + def vfModulesText = utils.getNodeXml(responseData, "vf-modules") + def xmlVfModules= new XmlSlurper().parseText(vfModulesText) + def vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} + int vfModulesSize = 0 + for (i in 0..vfModules.size()-1) { + def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i]) + def isBaseVfModule = utils.getNodeText(vfModuleXml, "is-base-vf-module") + + if (isBaseVfModule == "true") { + String baseModuleId = utils.getNodeText(vfModuleXml, "vf-module-id") + execution.setVariable("DOUPVfMod_baseVfModuleId", baseModuleId) + msoLogger.debug('Received baseVfModuleId: ' + baseModuleId) + String baseModuleHeatStackId = utils.getNodeText(vfModuleXml, "heat-stack-id") + execution.setVariable("DOUPVfMod_baseVfModuleHeatStackId", baseModuleHeatStackId) + msoLogger.debug('Received baseVfModuleHeatStackId: ' + baseModuleHeatStackId) + } + } + } + } + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) + } + } + + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy new file mode 100644 index 0000000000..34a73bd35c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy @@ -0,0 +1,414 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ModuleResource +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.JsonUtils +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.springframework.web.util.UriUtils; + +/** + * This class supports the VID Flow + * with the update of a generic vnf and related VF modules. + */ +class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateVnfAndModules.class); + + String Prefix="DUVAM_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + /** + * This method gets and validates the incoming + * request. + * + * @param - execution + * + */ + public void preProcessRequest(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED DoUpdateVnfAndModules PreProcessRequest Process") + + try{ + // Get Variables + + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("requestId", requestId) + execution.setVariable("mso-request-id", requestId) + msoLogger.debug("Incoming Request Id is: " + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + + String vnfId = execution.getVariable("vnfId") + msoLogger.debug("Incoming Vnf Id is: " + vnfId) + + String source = "VID" + execution.setVariable("DUVAM_source", source) + msoLogger.debug("Incoming Source is: " + source) + + String sdncVersion = execution.getVariable("sdncVersion") + if (sdncVersion == null) { + sdncVersion = "1702" + } + execution.setVariable("DUVAM_sdncVersion", sdncVersion) + msoLogger.debug("Incoming Sdnc Version is: " + sdncVersion) + + VnfResource vnfResource = (VnfResource) execution.getVariable("vnfResourceDecomposition") + + String vnfModelInfo = execution.getVariable("vnfModelInfo") + String serviceModelInfo = execution.getVariable("serviceModelInfo") + + String serviceId = execution.getVariable("productFamilyId") + execution.setVariable("DUVAM_serviceId", serviceId) + msoLogger.debug("Incoming Service Id is: " + serviceId) + + String modelUuid = jsonUtil.getJsonValue(vnfModelInfo, "modelUuid") + execution.setVariable("DUVAM_modelUuid", modelUuid) + msoLogger.debug("Incoming modelUuid is: " + modelUuid) + + String modelCustomizationUuid = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationUuid") + execution.setVariable("DUVAM_modelCustomizationUuid", modelCustomizationUuid) + msoLogger.debug("Incoming Model Customization Uuid is: " + modelCustomizationUuid) + + String cloudSiteId = execution.getVariable("lcpCloudRegionId") + execution.setVariable("DUVAM_cloudSiteId", cloudSiteId) + msoLogger.debug("Incoming Cloud Site Id is: " + cloudSiteId) + + String tenantId = execution.getVariable("tenantId") + execution.setVariable("DUVAM_tenantId", tenantId) + msoLogger.debug("Incoming Tenant Id is: " + tenantId) + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + if (globalSubscriberId == null) { + globalSubscriberId = "" + } + execution.setVariable("DUVAM_globalSubscriberId", globalSubscriberId) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + + execution.setVariable("DUVAM_moduleCount", 0) + execution.setVariable("DUVAM_nextModule", 0) + + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug(" Error Occured in DoUpdateVnfAndModules PreProcessRequest method!" + e.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoUpdateVnfAndModules PreProcessRequest") + + } + msoLogger.trace("COMPLETED DoUpdateVnfAndModules PreProcessRequest Process ") + } + + /** + * Using the received vnfId and vfModuleId, query AAI to get the corresponding VNF info. + * A 200 response is expected with the VNF info in the response body. Will find out the base module info. + * + * @param execution The flow's execution instance. + */ + public void queryAAIVfModule(DelegateExecution execution) { + + def method = getClass().getSimpleName() + '.queryAAIVfModule(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('vnfId') + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" + msoLogger.debug("AAI endPoint: " + endPoint) + + try { + RESTConfig config = new RESTConfig(endPoint); + def responseData = '' + def aaiRequestId = UUID.randomUUID().toString() + RESTClient client = new RESTClient(config). + addHeader('X-TransactionId', aaiRequestId). + addHeader('X-FromAppId', 'MSO'). + addHeader('Content-Type', 'application/xml'). + addHeader('Accept','application/xml'); + msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') + APIResponse response = client.httpGet() + msoLogger.debug("createVfModule - invoking httpGet() to AAI") + + responseData = response.getResponseBodyAsString() + if (responseData != null) { + msoLogger.debug("Received generic VNF data: " + responseData) + + } + + msoLogger.debug("createVfModule - queryAAIVfModule Response: " + responseData) + msoLogger.debug("createVfModule - queryAAIVfModule ResponseCode: " + response.getStatusCode()) + + execution.setVariable('DUVAM_queryAAIVfModuleResponseCode', response.getStatusCode()) + execution.setVariable('DUVAM_queryAAIVfModuleResponse', responseData) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + //Map[] vfModules = new HashMap[] + def vfModulesList = new ArrayList>() + def vfModules = null + def vfModuleBaseEntry = null + if (response.getStatusCode() == 200) { + // Parse the VNF record from A&AI to find base module info + msoLogger.debug('Parsing the VNF data to find base module info') + if (responseData != null) { + def vfModulesText = utils.getNodeXml(responseData, "vf-modules") + msoLogger.debug("vModulesText: " + vfModulesText) + if (vfModulesText != null && !vfModulesText.trim().isEmpty()) { + def xmlVfModules= new XmlSlurper().parseText(vfModulesText) + vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} + execution.setVariable("DUVAM_moduleCount", vfModules.size()) + int vfModulesSize = 0 + for (i in 0..vfModules.size()-1) { + def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i]) + + Map vfModuleEntry = new HashMap() + def vfModuleId = utils.getNodeText(vfModuleXml, "vf-module-id") + vfModuleEntry.put("vfModuleId", vfModuleId) + def vfModuleName = utils.getNodeText(vfModuleXml, "vf-module-name") + vfModuleEntry.put("vfModuleName", vfModuleName) + def modelInvariantUuid = utils.getNodeText(vfModuleXml, "model-invariant-id") + vfModuleEntry.put("modelInvariantUuid", modelInvariantUuid) + def modelUuid = utils.getNodeText(vfModuleXml, "model-version-id") + vfModuleEntry.put("modelUuid", modelUuid) + def modelCustomizationUuid = utils.getNodeText(vfModuleXml, "model-customization-id") + vfModuleEntry.put("modelCustomizationUuid", modelCustomizationUuid) + + def isBaseVfModule = utils.getNodeText(vfModuleXml, "is-base-vf-module") + vfModuleEntry.put("isBaseVfModule", isBaseVfModule) + + String volumeGroupId = '' + + msoLogger.debug("Next module!") + def vfModuleRelationships = vfModules[i].'**'.findAll {it.name() == 'relationship-data'} + if (vfModuleRelationships.size() > 0) { + for (j in 0..vfModuleRelationships.size()-1) { + if (vfModuleRelationships[j] != null) { + + def relationshipKey = vfModuleRelationships[j].'**'.findAll {it.name() == 'relationship-key'} + + if (relationshipKey[0] == 'volume-group.volume-group-id') { + def relationshipValue = vfModuleRelationships[j].'**'.findAll {it.name() == 'relationship-value'} + volumeGroupId = relationshipValue[0] + break + } + } + } + } + + vfModuleEntry.put("volumeGroupId", volumeGroupId) + msoLogger.debug("volumeGroupId is: " + volumeGroupId) + + // Save base vf module to add it to the start of the list later + if (isBaseVfModule == "true") { + vfModuleBaseEntry = vfModuleEntry + } + else { + vfModulesList.add(vfModuleEntry) + } + } + // Start the list with the base module if any + if (vfModuleBaseEntry != null) { + vfModulesList.add(0, vfModuleBaseEntry) + } + } + + } + } + else { + msoLogger.debug('Response code from AAI GET is: ' + response.getStatusCode()) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Response code from AAI GET is: ' + response.getStatusCode()) + } + execution.setVariable("DUVAM_vfModules", vfModulesList) + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) + } + } + + public void prepareNextModuleToUpdate(DelegateExecution execution){ + + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED prepareNextModuleToUpdate ") + + try { + int i = execution.getVariable("DUVAM_nextModule") + def vfModules = execution.getVariable("DUVAM_vfModules") + def vfModule = vfModules[i] + + def vfModuleId = vfModule.get("vfModuleId") + execution.setVariable("DUVAM_vfModuleId", vfModuleId) + + def vfModuleName = vfModule.get("vfModuleName") + execution.setVariable("DUVAM_vfModuleName", vfModuleName) + + def isBaseVfModule = vfModule.get("isBaseVfModule") + execution.setVariable("DUVAM_isBaseVfModule", isBaseVfModule) + + String modelInvariantUuid = vfModule.get("modelInvariantUuid") + msoLogger.debug("ModelInvariantUuid: " + modelInvariantUuid) + + def volumeGroupId = vfModule.get("volumeGroupId") + execution.setVariable("DUVAM_volumeGroupId", volumeGroupId) + + execution.setVariable("DUVAM_volumeGroupName", "") + + VnfResource vnfResource = (VnfResource) execution.getVariable("vnfResourceDecomposition") + List moduleResources = vnfResource.getVfModules() + + for (j in 0..moduleResources.size()-1) { + ModelInfo modelInfo = moduleResources[j].getModelInfo() + String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid() + msoLogger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition) + + if (modelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { + String vfModuleModelInfo = modelInfo.toJsonString() + String vfModuleModelInfoValue = jsonUtil.getJsonValue(vfModuleModelInfo, "modelInfo") + execution.setVariable("DUVAM_vfModuleModelInfo", vfModuleModelInfoValue) + msoLogger.debug("vfModuleModelInfo: " + vfModuleModelInfoValue) + break + } + + } + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToUpdate Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED prepareNextModuleToUpdate ") + } + + + /** + * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. + * + * @param execution The flow's execution instance. + */ + public void prepUpdateAAIGenericVnf(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('vnfId') + VnfResource vnfResource = (VnfResource) execution.getVariable("vnfResourceDecomposition") + ModelInfo vnfDecompModelInfo = vnfResource.getModelInfo() + String vnfModelInfo = execution.getVariable("vnfModelInfo") + String modelUuid = execution.getVariable("DUVAM_modelUuid") + if (modelUuid == null || modelUuid.isEmpty()) { + modelUuid = vnfDecompModelInfo.getModelUuid() + } + String modelCustomizationUuid = execution.getVariable("DUVAM_modelCustomizationUuid") + if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { + modelCustomizationUuid = vnfDecompModelInfo.getModelCustomizationUuid() + } + String nfType = vnfResource.getNfType() + String nfTypeString = '' + if (nfType != null && !nfType.isEmpty()) { + nfTypeString = "" + nfType + "" + } + String nfRole = vnfResource.getNfRole() + String nfRoleString = '' + if (nfRole != null && !nfRole.isEmpty()) { + nfRoleString = "" + nfRole + "" + } + String nfFunction = vnfResource.getNfFunction() + String nfFunctionString = '' + if (nfFunction != null && !nfFunction.isEmpty()) { + nfFunctionString = "" + nfFunction + "" + } + String nfNamingCode = vnfResource.getNfNamingCode() + String nfNamingCodeString = '' + if (nfNamingCode != null && !nfNamingCode.isEmpty()) { + nfNamingCodeString = "" + nfNamingCode + "" + } + + String updateAAIGenericVnfRequest = """ + + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(modelUuid)} + ${MsoUtils.xmlEscape(modelCustomizationUuid)} + ${nfTypeString} + ${nfRoleString} + ${nfFunctionString} + ${nfNamingCodeString} + + """ + updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) + execution.setVariable('DUVAM_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) + msoLogger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) + msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) + + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) + } + } + + /** + * APP-C Call - placeholder. + * + * @param execution The flow's execution instance. + */ + public void callAppCf(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.callAppC(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy new file mode 100644 index 0000000000..4deb53f0ce --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy @@ -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.bpmn.infrastructure.scripts; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.apache.commons.lang3.* +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +public class HealthCheckActivate extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, HealthCheckActivate.class); + + + /** + * Validates the request message and sets up the workflow. + * @param execution the execution + */ + public void preProcessRequest(DelegateExecution execution) { + + } + + + /** + * Sends the synchronous response back to the API Handler. + * @param execution the execution + */ + public void sendResponse(DelegateExecution execution) { + def status = execution.getVariable("healthyStatus") + def healthcheckmessage = execution.getVariable("healthcheckmessage") + if (status == "true") { + sendWorkflowResponse(execution, 200, healthcheckmessage) + }else{ + sendWorkflowResponse(execution, 503, healthcheckmessage) + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy new file mode 100644 index 0000000000..8673ee7662 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy @@ -0,0 +1,611 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.Status +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.* +import org.onap.so.client.appc.ApplicationControllerOrchestrator +import org.onap.so.client.appc.ApplicationControllerSupport +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +import groovy.json.JsonOutput +import groovy.json.JsonSlurper + +public class ReplaceVnfInfra extends VnfCmBase { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ReplaceVnfInfra.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtils = new JsonUtils() + def prefix = "RPLVnfI_" + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'RPLVnfI_') + execution.setVariable('Request', null) + execution.setVariable('requestInfo', null) + execution.setVariable('source', null) + execution.setVariable('vnfInputs', null) + execution.setVariable('tenantId', null) + execution.setVariable('vnfParams', null) + execution.setVariable('controllerType', null) + execution.setVariable('cloudConfiguration', null) + execution.setVariable('ReplaceVnfSuccessIndicator', false) + execution.setVariable('serviceType', null) + execution.setVariable('nfRole', null) + execution.setVariable('currentActivity', 'RPLVnfI') + execution.setVariable('workStep', null) + execution.setVariable('failedActivity', null) + execution.setVariable('errorCode', "0") + execution.setVariable('errorText', null) + execution.setVariable('healthCheckIndex', 1) + execution.setVariable('retainResources', true) + execution.setVariable('productFamilyId', null) + execution.setVariable('healthCheckIndex0', 0) + execution.setVariable('healthCheckIndex1', 1) + execution.setVariable("rollbackSetClosedLoopDisabledFlag", false) + execution.setVariable("rollbackVnfStop", false) + execution.setVariable("rollbackVnfLock", false) + execution.setVariable("rollbackQuiesceTraffic", false) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", false) + execution.setVariable("platform", null) + execution.setVariable("lineOfBusiness", null) + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + initProcessVariables(execution) + + msoLogger.trace('Entered ' + method) + + initProcessVariables(execution) + + def incomingRequest = execution.getVariable('bpmnRequest') + + msoLogger.debug("Incoming Infra Request: " + incomingRequest) + try { + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + Map reqMap = jsonSlurper.parseText(incomingRequest) + msoLogger.debug(" Request is in JSON format.") + + def serviceInstanceId = execution.getVariable('serviceInstanceId') + def vnfId = execution.getVariable('vnfId') + + execution.setVariable('serviceInstanceId', serviceInstanceId) + execution.setVariable("isVidRequest", "true") + execution.setVariable('serviceType', 'Mobility') + execution.setVariable('retainResources', true) + execution.setVariable('disableRollback', true) + execution.setVariable('payload', "") + execution.setVariable('actionLock', Action.Lock) + execution.setVariable('actionUnlock', Action.Unlock) + execution.setVariable('actionHealthCheck', Action.HealthCheck) + execution.setVariable('actionStart', Action.Start) + execution.setVariable('actionStop', Action.Stop) + + def asdcServiceModelVersion = '' + def serviceModelInfo = null + + def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList + + if (relatedInstanceList != null) { + relatedInstanceList.each { + if (it.relatedInstance.modelInfo?.modelType == 'service') { + msoLogger.debug("PROCESSING SERVICE INFO") + asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion + serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) + msoLogger.debug("ServiceModelInfo: " + serviceModelInfo) + def modelInvariant = jsonUtils.getJsonValue(serviceModelInfo, "modelInvariantUuid") + msoLogger.debug("modelInvariant: " + modelInvariant) + } + + } + } + + execution.setVariable('asdcServiceModelVersion', asdcServiceModelVersion) + execution.setVariable('serviceModelInfo', serviceModelInfo) + def vnfModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo) + execution.setVariable('vnfModelInfo', vnfModelInfo) + def vnfModelInvariantUuid = jsonUtils.getJsonValue(vnfModelInfo, "modelInvariantUuid") + execution.setVariable('vnfModelInvariantUuid', vnfModelInvariantUuid) + msoLogger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid) + + def vnfType = execution.getVariable('vnfType') + execution.setVariable('vnfType', vnfType) + + + def controllerType = reqMap.requestDetails?.requestParameters?.controllerType + execution.setVariable('controllerType', controllerType) + + msoLogger.debug('Controller Type: ' + controllerType) + + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map userParamsMap = [:] + if (userParams != null) { + userParams.each { userParam -> + userParamsMap.put(userParam.name, userParam.value.toString()) + } + } + + msoLogger.debug('Processed user params: ' + userParamsMap) + + execution.setVariable('vfModuleInputParams', userParamsMap) + + def requestId = execution.getVariable("requestId") + execution.setVariable('msoRequestId', requestId) + msoLogger.debug("requestId is: " + requestId) + + def vnfName = reqMap.requestDetails?.requestInfo?.instanceName ?: null + execution.setVariable('vnfName', vnfName) + + def requestorId = reqMap.requestDetails?.requestInfo?.requestorId ?: null + execution.setVariable('requestorId', requestorId) + + def usePreload = reqMap.requestDetails?.requestParameters?.usePreload + execution.setVariable('usePreload', usePreload) + + def productFamilyId = reqMap.requestDetails?.requestInfo?.productFamilyId ?: null + execution.setVariable('productFamilyId', productFamilyId) + + def cloudConfiguration = jsonOutput.toJson(reqMap.requestDetails?.cloudConfiguration) + execution.setVariable('cloudConfiguration', cloudConfiguration) + def lcpCloudRegionId = jsonUtils.getJsonValue(cloudConfiguration, "lcpCloudRegionId") + execution.setVariable('lcpCloudRegionId', lcpCloudRegionId) + def tenantId = jsonUtils.getJsonValue(cloudConfiguration, "tenantId") + execution.setVariable('tenantId', tenantId) + + def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: '' + execution.setVariable('globalSubscriberId', globalSubscriberId) + + execution.setVariable('sdncVersion', '1702') + + execution.setVariable("ReplaceVnfInfraSuccessIndicator", false) + + + + def source = reqMap.requestDetails?.requestInfo?.source + execution.setVariable("source", source) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + REPLACE + ${MsoUtils.xmlEscape(source)} + """ + + execution.setVariable("requestInfo", requestInfo) + + msoLogger.debug('RequestInfo: ' + execution.getVariable("requestInfo")) + + msoLogger.trace('Exited ' + method) + + } + catch(groovy.json.JsonException je) { + msoLogger.debug(" Request is not in JSON format.") + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") + + } + catch(Exception e) { + String restFaultMessage = e.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) + } + } + + /** + * Prepare and send the sychronous response for this flow. + * + * @param execution The flow's execution instance. + */ + public void sendSynchResponse(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendSynchResponse(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + + try { + def requestInfo = execution.getVariable('requestInfo') + def requestId = execution.getVariable('requestId') + def source = execution.getVariable('source') + def progress = getNodeTextForce(requestInfo, 'progress') + if (progress.isEmpty()) { + progress = '0' + } + def startTime = getNodeTextForce(requestInfo, 'start-time') + if (startTime.isEmpty()) { + startTime = System.currentTimeMillis() + } + + // RESTResponse (for API Handler (APIH) Reply Task) + def vnfId = execution.getVariable("vnfId") + String synchResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() + + sendWorkflowResponse(execution, 200, synchResponse) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) + } + } + + + + /** + * Get VnfResource decomposition object for this VNF. + * + * + * @param execution The flow's execution instance. + */ + public void getVnfResourceDecomposition(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.getVnfResourceDecomposition(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid') + msoLogger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid) + List vnfResources = serviceDecomposition.getVnfResources() + + for (i in 0..vnfResources.size()-1) { + ModelInfo modelInfo = vnfResources[i].getModelInfo() + String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid() + msoLogger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition) + + if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { + VnfResource vnfResourceDecomposition = vnfResources[i] + execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition) + def nfRole = vnfResourceDecomposition.getNfRole() + execution.setVariable('nfRole', nfRole) + msoLogger.debug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString()) + break + } + else { + //exception! + } + + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage()) + } + } + + /** + * Check if this VNF is already in maintenance in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfVnfInMaintInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + execution.setVariable("workStep", "checkIfVnfInMaintInAAI") + execution.setVariable("failedActivity", "AAI") + msoLogger.trace('Entered ' + method) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIValidatorImpl aaiValidator = new AAIValidatorImpl() + aaiValidator.setClient(client) + def vnfId = execution.getVariable("vnfId") + boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid) + msoLogger.debug("isInMaint result: " + isInMaint) + execution.setVariable('isVnfInMaintenance', isInMaint) + + if (isInMaint) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "VNF is in maintenance in A&AI") + } + + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) + } + } + + + /** + * Check if this VNF's pservers are locked in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfPserversInMaintInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + execution.setVariable("workStep", "checkIfPserversInMaintInAAI") + execution.setVariable("failedActivity", "AAI") + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIValidatorImpl aaiValidator = new AAIValidatorImpl() + aaiValidator.setClient(client) + def vnfId = execution.getVariable("vnfId") + boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid) + msoLogger.debug("areLocked result: " + areLocked) + execution.setVariable('arePserversLocked', areLocked) + + if (areLocked) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "pServers are locked in A&AI") + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) + } + } + + /** + * Set inMaint flag for this VNF to the specified value in A&AI. + * + * + * @param execution The flow's execution instance. + * @param inMaint The boolean value of the flag to set + */ + public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) { + def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + if (inMaint) { + execution.setVariable("workStep", "setVnfInMaintFlagInAAI") + } + else { + execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI") + } + execution.setVariable("failedActivity", "AAI") + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIUpdatorImpl aaiUpdator = new AAIUpdatorImpl() + aaiUpdator.setClient(client) + def vnfId = execution.getVariable("vnfId") + if (inMaint) { + aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) + } + else { + aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid) + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage()) + } + } + + /** + * Call APP-C client to execute specified APP-C command for this VNF. + * + * + * @param execution The flow's execution instance. + * @param action The action to take in APP-C. + */ + public void runAppcCommand(DelegateExecution execution, Action action) { + def method = getClass().getSimpleName() + '.runAppcCommand(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + + try { + msoLogger.debug("Running APP-C action: " + action.toString()) + String vnfId = execution.getVariable('vnfId') + String msoRequestId = execution.getVariable('requestId') + execution.setVariable('msoRequestId', msoRequestId) + execution.setVariable("failedActivity", "APP-C") + execution.setVariable("workStep", action.toString() + "VNF") + + ApplicationControllerOrchestrator appcClient = new ApplicationControllerOrchestrator() + Status appcStatus = null + switch(action) { + case Action.Lock: + execution.setVariable('workStep', "LockVNF") + appcStatus = appcClient.runCommand(Action.Lock,msoRequestId,vnfId,null) + break + case Action.Unlock: + execution.setVariable('workStep', "UnlockVNF") + appcStatus = appcClient.runCommand(Action.Unlock,msoRequestId,vnfId,null) + break + case Action.HealthCheck: + def healthCheckIndex = execution.getVariable('healthCheckIndex') + execution.setVariable('workStep', "HealthCheckVNF" + healthCheckIndex) + execution.setVariable('healthCheckIndex', healthCheckIndex + 1) + appcStatus = appcClient.runCommand(Action.HealthCheck,msoRequestId,vnfId,null) + break + case Action.Start: + execution.setVariable('workStep', "StartVNF") + appcStatus = appcClient.runCommand(Action.Start,msoRequestId,vnfId,null) + break + case Action.Stop: + execution.setVariable('workStep', "StopVNF") + appcStatus = appcClient.runCommand(Action.Stop,msoRequestId,vnfId,null) + break + default: + break + } + msoLogger.debug("Completed AppC request") + int appcCode = appcStatus.getCode() + msoLogger.debug("AppC status code is: " + appcCode) + msoLogger.debug("AppC status message is: " + appcStatus.getMessage()) + if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) { + execution.setVariable("errorCode", Integer.toString(appcCode)) + execution.setVariable("errorText", appcStatus.getMessage()) + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + } catch (java.lang.NoSuchMethodError e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + } + } + + + + /** + * Prepare DoDeleteVnfAndModules call. + * + * + * @param execution The flow's execution instance. + */ + public void prepDoDeleteVnfAndModules(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepDoDeleteVnfAndModules(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + execution.setVariable("workStep", "doDeleteVnfAndModules") + execution.setVariable("failedActivity", "MSO Delete VNF") + msoLogger.trace('Exited ' + method) + + } + + /** + * Prepare DoCreateVnfAndModules call. + * + * + * @param execution The flow's execution instance. + */ + public void prepDoCreateVnfAndModules(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepDoReplaceVnfAndModules(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + execution.setVariable("workStep", "doCreateVnfAndModules") + execution.setVariable("failedActivity", "MSO Create VNF") + msoLogger.trace('Exited ' + method) + + } + + + /** + * Handle Abort disposition from RainyDayHandler + * + * @param execution The flow's execution instance. + */ + public void abortProcessing(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.abortProcessing(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + def errorText = execution.getVariable("errorText") + def errorCode = execution.getVariable("errorCode") + + exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText) + } + + /** + * Handle Manual disposition from RainyDayHandler + * + * @param execution The flow's execution instance. + */ + public void manualProcessing(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.manualProcessing(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + def taskId = execution.getVariable("taskId") + + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Processing halted - manual task created: " + taskId) + } + + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy new file mode 100644 index 0000000000..d729c770ca --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy @@ -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========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import groovy.json.JsonOutput + +import groovy.json.JsonSlurper +import groovy.util.Node +import groovy.util.XmlParser; +import groovy.xml.QName + +import java.io.Serializable; +import java.util.UUID; +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.rest.APIResponse +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.onap.so.bpmn.common.scripts.VidUtils; +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.client.aai.* + +import org.onap.so.client.appc.ApplicationControllerClient; +import org.onap.so.client.appc.ApplicationControllerSupport; +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.appc.client.lcm.model.Action; + +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +public class RollbackVnf extends VnfCmBase { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, RollbackVnf.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtils = new JsonUtils() + def prefix = "VnfIPU_" + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'RVnf_') + + execution.setVariable('rollbackSuccessful', false) + execution.setVariable('currentActivity', 'RVnf') + execution.setVariable('workStep', null) + execution.setVariable('failedActivity', null) + execution.setVariable('errorCode', "0") + execution.setVariable('actionUnlock', Action.Unlock) + execution.setVariable('actionStart', Action.Start) + execution.setVariable('actionResumeTraffic', Action.ResumeTraffic) + + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + initProcessVariables(execution) + + msoLogger.trace('Entered ' + method) + + initProcessVariables(execution) + + try { + + execution.setVariable("rollbackErrorCode", "0") + + if (execution.getVariable("rollbackSetClosedLoopDisabledFlag") == true) { + msoLogger.debug("Will call setClosedLoopDisabledFlag") + } + + + msoLogger.trace('Exited ' + method) + + } + catch(Exception e) { + String restFaultMessage = e.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("rollbackErrorCode", "1") + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) + } + } + + /** + * Determine success of rollback execution. + * + * @param execution The flow's execution instance. + */ + public void setRollbackResult(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.setRollbackResult(' + + 'execution=' + execution.getId() + + ')' + initProcessVariables(execution) + + msoLogger.trace('Entered ' + method) + + def rollbackErrorCode = execution.getVariable('rollbackErrorCode') + if (rollbackErrorCode == "0") { + execution.setVariable('rollbackSuccessful', true) + msoLogger.debug("rollback successful") + } + else { + execution.setVariable('rollbackSuccessful', false) + msoLogger.debug("rollback unsuccessful") + } + + msoLogger.trace('Exited ' + method) + + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy new file mode 100644 index 0000000000..3a309cf5a2 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy @@ -0,0 +1,296 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import static org.apache.commons.lang3.StringUtils.* + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.utils.UUIDChecker +import org.springframework.web.util.UriUtils + + +/** + * This groovy class supports the ScaleCustomE2EServiceInstance.bpmn process. + * + */ +public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ScaleCustomE2EServiceInstance.class); + + String Prefix = "CRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest(DelegateExecution execution) { + execution.setVariable("prefix", Prefix) + String msg = "" + msoLogger.trace("preProcessRequest() ") + + try { + + String siRequest = execution.getVariable("bpmnRequest") + msoLogger.debug(siRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + serviceInstanceId = "NULL".toString() + } + msoLogger.debug("Generated new Service Instance:" + serviceInstanceId) + serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + // service instance ID is also service ID + execution.setVariable("serviceId", serviceInstanceId) + // service instance name + String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "service.serviceInstanceName") + execution.setVariable("serviceInstanceName", serviceInstanceName) + + // service instance name + String serviceType = jsonUtil.getJsonValue(siRequest, "service.serviceType") + execution.setVariable("serviceType", serviceType) + + // operationa ID (key) + //String operationKey = UUIDChecker.generateUUID(msoLogger) + String operationId = jsonUtil.getJsonValue(siRequest, "operationId") + execution.setVariable("operationId", operationId) + msoLogger.debug("Input Request:" + siRequest + " operationId:" + operationId) + + + String resources = jsonUtil.getJsonValue(siRequest, "service.resources") + execution.setVariable("resources", resources) + + // node template UUID + String nodeTemplateUUID = UUIDChecker.generateUUID(msoLogger) + execution.setVariable("nodeTemplateUUID", nodeTemplateUUID) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "service.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + String requestDescription = "request description for test" + execution.setVariable("requestDescription", requestDescription) + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest ") + } + + public void sendSyncResponse(DelegateExecution execution) { + msoLogger.trace("sendSyncResponse ") + + try { + String operationId = execution.getVariable("operationId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + // RESTResponse for API Handler (APIH) Reply Task + String scaleServiceRestRequest = """{"operationId":"${operationId}"}""".trim() + msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + scaleServiceRestRequest) + sendWorkflowResponse(execution, 202, scaleServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit sendSyncResopnse ") + } + + + public void sendSyncError(DelegateExecution execution) { + msoLogger.trace("sendSyncError ") + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${MsoUtils.xmlEscape(errorMessage)} + 7000 + """ + + msoLogger.debug(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + + } + + public void prepareCompletionRequest(DelegateExecution execution) { + msoLogger.trace("prepareCompletion ") + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String source = execution.getVariable("source") + + String msoCompletionRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + SCALE + ${MsoUtils.xmlEscape(source)} + + Service Instance was scaled successfully. + ${MsoUtils.xmlEscape(serviceInstanceId)} + ScaleGenericALaCarteServiceInstance + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("CompleteMsoProcessRequest", xmlMsoCompletionRequest) + msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit prepareCompletionRequest ") + } + + public void prepareFalloutRequest(DelegateExecution execution) { + msoLogger.trace("prepareFalloutRequest ") + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + msoLogger.debug(" Input Workflow Exception: " + wfex.toString()) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + SCALE + ${MsoUtils.xmlEscape(source)} + """ + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) + String errorException = " Bpmn error encountered in ScaleGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + SCALE + UUI + + + ${MsoUtils.xmlEscape(errorException)} + 7000 + + """ + + execution.setVariable("falloutRequest", falloutRequest) + } + msoLogger.trace("Exit prepareFalloutRequest ") + } + + + /** + * Init the service Operation Status + */ + public void prepareInitServiceOperationStatus(DelegateExecution execution){ + msoLogger.trace("STARTED prepareInitServiceOperationStatus Process ") + try{ + String serviceId = execution.getVariable("serviceInstanceId") + //String serviceName = execution.getVariable("serviceInstanceName") + String operationId = execution.getVariable("operationId") + String operationType = "SCALE" + String userId = "" + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service scaling" + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) + + String payload = + """ + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(operationId)} + ${MsoUtils.xmlEscape(serviceName)} + ${MsoUtils.xmlEscape(operationType)} + ${MsoUtils.xmlEscape(userId)} + ${MsoUtils.xmlEscape(result)} + ${MsoUtils.xmlEscape(operationContent)} + ${MsoUtils.xmlEscape(progress)} + ${MsoUtils.xmlEscape(reason)} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) + msoLogger.info("Outgoing updateServiceOperStatusRequest: \n" + payload) + msoLogger.debug("Scale network service updateServiceOperStatusRequest Request: " + payload) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) + } + msoLogger.trace("COMPLETED prepareInitServiceOperationStatus Process ") + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy new file mode 100644 index 0000000000..538f882c2b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy @@ -0,0 +1,570 @@ +/*- + * ============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.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray +import org.json.JSONObject +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.json.JsonUtils +import org.springframework.web.util.UriUtils + +import groovy.json.* + +/** + * This groovy class supports the UpdateCustomE2EServiceInstance.bpmn process. + * AlaCarte flow for 1702 ServiceInstance Update + * + */ +public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor { + String Prefix="UPDSI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + utils.log("INFO", " *** preProcessRequest() *** ", isDebugEnabled) + + try { + + String siRequest = execution.getVariable("bpmnRequest") + utils.logAudit(siRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + utils.log("INFO", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + msg = "Input serviceInstanceId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + //subscriberInfo for aai + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestDetails + execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")) + execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")) + execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback")) + String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") + if (isBlank(productFamilyId)) + { + msg = "Input productFamilyId is null" + utils.log("INFO", msg, isDebugEnabled) + } else { + execution.setVariable("productFamilyId", productFamilyId) + } + + //user params + String userParams = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams") + utils.log("INFO", "userParams:" + userParams, isDebugEnabled) + List paramList = jsonUtil.StringArrayToList(execution, userParams) + String uuiRequest = jsonUtil.getJsonValue(paramList.get(0), "UUIRequest") + if (isBlank(uuiRequest)) { + msg = "Input uuiRequest is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else + { + execution.setVariable("uuiRequest", uuiRequest) + } + + utils.log("INFO", "uuiRequest:\n" + uuiRequest, isDebugEnabled) + + //serviceType for aai + String serviceType = jsonUtil.getJsonValue(uuiRequest, "service.serviceType") + if (isBlank(serviceType)) { + msg = "Input serviceType is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("serviceType", serviceType) + } + + // target model info + String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") + utils.log("INFO","modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled) + execution.setVariable("modelInvariantUuid", modelInvariantUuid) + execution.setVariable("model-invariant-id-target", modelInvariantUuid) + + String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") + utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled) + execution.setVariable("modelUuid", modelUuid) + execution.setVariable("model-version-id-target", modelUuid) + + String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName") + utils.log("INFO","serviceModelName: " + serviceModelName, isDebugEnabled) + if(serviceModelName == null) { + serviceModelName = "" + } + execution.setVariable("serviceModelName", serviceModelName) + + //operationId + String operationId = jsonUtil.getJsonValue(siRequest, "operationId") + if (isBlank(operationId)) { + operationId = UUID.randomUUID().toString() + } + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", "update") + execution.setVariable("hasResourcetoUpdate", false) + + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + + public void postProcessAAIGET(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) + String msg = "" + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + String serviceType = "" + + if(foundInAAI){ + utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) + + String siData = execution.getVariable("GENGS_service") + utils.log("INFO", "SI Data", isDebugEnabled) + if (isBlank(siData)) + { + msg = "Could not retrive ServiceInstance data from AAI, Id:" + serviceInstanceId + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + utils.log("INFO", "SI Data" + siData, isDebugEnabled) + + // serviceInstanceName + String serviceInstanceName = execution.getVariable("serviceInstanceName") + if(isBlank(serviceInstanceName) && utils.nodeExists(siData, "service-instance-name")) { + serviceInstanceName = utils.getNodeText(siData, "service-instance-name") + execution.setVariable("serviceInstanceName", serviceInstanceName) + } + + // Get Template uuid and version + if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) { + utils.log("INFO", "SI Data model-invariant-id and model-version-id exist:", isDebugEnabled) + + def modelInvariantId = utils.getNodeText(siData, "model-invariant-id") + def modelVersionId = utils.getNodeText(siData, "model-version-id") + + // Set Original Template info + execution.setVariable("model-invariant-id-original", modelInvariantId) + execution.setVariable("model-version-id-original", modelVersionId) + } + + //get related service instances (vnf/network or volume) for delete + if (utils.nodeExists(siData, "relationship-list")) { + utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled) + + JSONArray jArray = new JSONArray() + + XmlParser xmlParser = new XmlParser() + Node root = xmlParser.parseText(siData) + def relation_list = utils.getChildNode(root, 'relationship-list') + def relationships = utils.getIdenticalChildren(relation_list, 'relationship') + + for (def relation: relationships) { + def jObj = getRelationShipData(relation, isDebugEnabled) + jArray.put(jObj) + } + + execution.setVariable("serviceRelationShip", jArray.toString()) + } + }else{ + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(!succInAAI){ + utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + + utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) + } + }catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) + } + + private JSONObject getRelationShipData(node, isDebugEnabled){ + JSONObject jObj = new JSONObject() + + def relation = utils.nodeToString(node) + def rt = utils.getNodeText(relation, "related-to") + + def rl = utils.getNodeText(relation, "related-link") + utils.log("INFO", "ServiceInstance Related NS/Configuration :" + rl, isDebugEnabled) + + def rl_datas = utils.getIdenticalChildren(node, "relationship-data") + for(def rl_data : rl_datas) { + def eKey = utils.getChildNodeText(rl_data, "relationship-key") + def eValue = utils.getChildNodeText(rl_data, "relationship-value") + + if ((rt == "service-instance" && eKey.equals("service-instance.service-instance-id")) + //for overlay/underlay + || (rt == "configuration" && eKey.equals("configuration.configuration-id"))){ + jObj.put("resourceInstanceId", eValue) + } + } + + def rl_props = utils.getIdenticalChildren(node, "related-to-property") + for(def rl_prop : rl_props) { + def eKey = utils.getChildNodeText(rl_prop, "property-key") + def eValue = utils.getChildNodeText(rl_prop, "property-value") + if((rt == "service-instance" && eKey.equals("service-instance.service-instance-name")) + //for overlay/underlay + || (rt == "configuration" && eKey.equals("configuration.configuration-type"))){ + jObj.put("resourceType", eValue) + } + } + + utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) + + return jObj + } + + + public void preCompareModelVersions(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + } + + public void postCompareModelVersions(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ======== STARTED postCompareModelVersions Process ======== ", isDebugEnabled) + + def hasResourcetoUpdate = false + def hasResourcetoAdd = false + def hasResourcetoDelete = false + List addResourceList = execution.getVariable("addResourceList") + List delResourceList = execution.getVariable("delResourceList") + + if(addResourceList != null && !addResourceList.isEmpty()) { + hasResourcetoAdd = true + } + + if(delResourceList != null && !delResourceList.isEmpty()) { + hasResourcetoDelete = true + } + + hasResourcetoUpdate = hasResourcetoAdd || hasResourcetoDelete + execution.setVariable("hasResourcetoUpdate", hasResourcetoUpdate) + + utils.log("DEBUG", "======== COMPLETED postCompareModelVersions Process ======== ", isDebugEnabled) + } + + /** + * Init the service Operation Status + */ + public void prepareInitServiceOperationStatus(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = execution.getVariable("operationType") + String userId = "" + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service updating" + utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + + String payload = + """ + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(operationId)} + ${MsoUtils.xmlEscape(operationType)} + ${MsoUtils.xmlEscape(userId)} + ${MsoUtils.xmlEscape(result)} + ${MsoUtils.xmlEscape(operationContent)} + ${MsoUtils.xmlEscape(progress)} + ${MsoUtils.xmlEscape(reason)} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) + utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) + utils.logAudit("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) + } + utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + } + + /** + * Update the service Operation Status + */ + public void preUpdateServiceOperationStatus(DelegateExecution execution){ + def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')' + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO","Entered " + method, isDebugEnabled) + + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = execution.getVariable("operationType") + String serviceName = execution.getVariable("serviceInstanceName") + String result = execution.getVariable("operationResult") + String progress = execution.getVariable("progress") + String reason = execution.getVariable("operationReason") + String userId = "" + utils.log("INFO", "progress: " + progress , isDebugEnabled) + + String operationContent = "Prepare service : " + execution.getVariable("operationStatus") + + utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + + def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + + execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + String payload = + """ + + + + ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(operationId)} + ${MsoUtils.xmlEscape(operationType)} + ${MsoUtils.xmlEscape(userId)} + ${MsoUtils.xmlEscape(result)} + ${MsoUtils.xmlEscape(operationContent)} + ${MsoUtils.xmlEscape(progress)} + ${MsoUtils.xmlEscape(reason)} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) + utils.log("INFO", "Outgoing preUpdateServiceOperationStatus: \n" + payload, isDebugEnabled) + + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing preUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage()) + } + utils.log("INFO", "======== COMPLETED preUpdateServiceOperationStatus Process ======== ", isDebugEnabled) + utils.log("INFO", "Exited " + method, isDebugEnabled) + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + String operationId = execution.getVariable("operationId") + def hasResourcetoUpdate = execution.getVariable("hasResourcetoUpdate") + + String updateServiceResp = "" + if(hasResourcetoUpdate) { + // RESTResponse for API Handler (APIH) Reply Task + updateServiceResp = """{"operationId":"${operationId}"}""".trim() + } + else { + updateServiceResp = """{"OperationResult":"No Resource to Add or Delete or Service Instance not found in AAI."}""" + } + + utils.log("INFO", " sendSyncResponse to APIH:" + "\n" + updateServiceResp, isDebugEnabled) + sendWorkflowResponse(execution, 202, updateServiceResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + } + + public void sendSyncError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " *** sendSyncError *** ", isDebugEnabled) + + try { + String errorMessage = "" + int errorCode = 7000 + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + errorCode = wfe.getErrorCode() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${MsoUtils.xmlEscape(errorMessage)} + ${MsoUtils.xmlEscape(errorCode)} + """ + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + utils.log("INFO", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + + } + + public void prepareCompletionRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " *** prepareCompletion *** ", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String source = execution.getVariable("source") + + String msoCompletionRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + UPDATE + ${MsoUtils.xmlEscape(source)} + + Service Instance was updated successfully. + ${MsoUtils.xmlEscape(serviceInstanceId)} + UpdateCustomE2EServiceInstance + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("completionRequest", xmlMsoCompletionRequest) + utils.log("INFO", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO", "*** Exit prepareCompletionRequest ***", isDebugEnabled) + } + + public void prepareFalloutRequest(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " *** prepareFalloutRequest *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("INFO", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + UPDATE + ${MsoUtils.xmlEscape(source)} + """ + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + utils.log("INFO", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) + String errorException = " Bpmn error encountered in UpdateCustomE2EServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + UPDATE + UUI + + + ${MsoUtils.xmlEscape(errorException)} + 7000 + + """ + + execution.setVariable("falloutRequest", falloutRequest) + } + utils.log("INFO", "*** Exit prepareFalloutRequest ***", isDebugEnabled) + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy new file mode 100644 index 0000000000..329d58aa58 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy @@ -0,0 +1,403 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger + +import groovy.json.* + +/** + * This groovy class supports the UpdateNetworkInstance.bpmn process. + * + */ +public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateNetworkInstance.class); + + String Prefix="UPDNI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public InitializeProcessVariables(DelegateExecution execution){ + + execution.setVariable(Prefix + "source", "") + execution.setVariable(Prefix + "Success", false) + + execution.setVariable(Prefix + "CompleteMsoProcessRequest", "") + execution.setVariable(Prefix + "FalloutHandlerRequest", "") + + } + + + /** + * This method is executed during the preProcessRequest task of the UpdateNetworkInstance.bpmn process. + * @param execution + */ + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the UpdateNetworkInstance.bpmn process. + * @param execution + */ + public void preProcessRequest (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside preProcessRequest() of UpdateNetworkInstance Request") + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + String sdncVersion = execution.getVariable("sdncVersion") + if (sdncVersion == null || sdncVersion == "1610") { + // 'a-la-cart' default, sdncVersion = '1610' + execution.setVariable("sdncVersion", "1610") + String bpmnRequest = execution.getVariable("bpmnRequest") + if (bpmnRequest != null) { + String disableRollback = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.requestInfo.suppressRollback") + if (disableRollback != null) { + execution.setVariable("disableRollback", disableRollback) + msoLogger.debug("Received 'suppressRollback': " + disableRollback ) + } else { + execution.setVariable("disableRollback", false) + } + msoLogger.debug(" Set 'disableRollback' : " + execution.getVariable("disableRollback") ) + } else { + String dataErrorMessage = " Invalid 'bpmnRequest' request." + msoLogger.debug(dataErrorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + } else { + // 'macro' TEST ONLY, sdncVersion = '1702' + msoLogger.debug(" \'disableRollback\' : " + execution.getVariable("disableRollback") ) + } + + String requestId = execution.getVariable("msoRequestId") + if (requestId != null) { + execution.setVariable("mso-request-id", requestId) + } else { + requestId = execution.getVariable("mso-request-id") + } + execution.setVariable(Prefix + "requestId", requestId) + + // get/set 'requestId' + if (execution.getVariable("requestId") == null) { + execution.setVariable("requestId", requestId) + } + + //Place holder for additional code. + + // TODO ??? + // userParams??? 1) pre-loads indicator, 2) 'auto-activation' + // Tag/Value parameters + // + // Map: 'networkInputParams': 'auto-activation'' + // Sample format? + // "requestParameters": { + // "userParams": [ + // { + // "name": "someUserParam1", + // "value": "someValue1" + // } + // ] + // } + // + // String userParams = //use json util to extract "userParams"// + // execution.setVariable("networkInputParams", userParams) + // else: execution.setVariable("networkInputParams", null) + // + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex){ + sendSyncError(execution) + // caught exception + String exceptionMessage = "Exception Encountered in UpdateNetworkInstance, PreProcessRequest() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + } + + public void sendSyncResponse (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside sendSyncResponse() of UpdateNetworkInstance") + + try { + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + // RESTResponse (for API Handler (APIH) Reply Task) + String updateNetworkRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + + msoLogger.debug(" sendSyncResponse to APIH - " + "\n" + updateNetworkRestRequest) + sendWorkflowResponse(execution, 202, updateNetworkRestRequest) + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in UpdateNetworkInstance flow. sendSyncResponse() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + } + + + public void getNetworkModelInfo (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside getNetworkModelInfo() of UpdateNetworkInstance") + + try { + + // For Ala-Carte (sdnc = 1610): + // 1. the Network ModelInfo is expected to be sent + // via requestDetails.modelInfo (modelType = network), ex: modelCustomizationId + // 2. the Service ModelInfo is expected to be sent but will be IGNORE + // via requestDetails.relatedInstanceList.relatedInstance.modelInfo (modelType = service) + + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in UpdateNetworkInstance flow. getNetworkModelInfo() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + public void sendSyncError (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside sendSyncError() of UpdateNetworkInstance") + + try { + + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + // REST Error (for API Handler (APIH) Reply Task) + String syncError = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + + sendWorkflowResponse(execution, 500, syncError) + + } catch (Exception ex) { + msoLogger.debug(" Bpmn error encountered in UpdateNetworkInstance flow. sendSyncError() - " + ex.getMessage()) + } + + } + + public void prepareCompletion (DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside prepareCompletion() of UpdateNetworkInstance") + + try { + + String requestId = execution.getVariable("mso-request-id") + String source = execution.getVariable(Prefix + "source") + + String msoCompletionRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + UPDATE + VID + + Network has been updated successfully. + BPMN Network action: UPDATE + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + // normal path + execution.setVariable(Prefix + "Success", true) + execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) + msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in UpdateNetworkInstance flow. prepareCompletion() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + + } + + + + + // ************************************************** + // Post or Validate Response Section + // ************************************************** + + public void postProcessResponse (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside postProcessResponse() of UpdateNetworkInstance") + + try { + + if (execution.getVariable("CMSO_ResponseCode") == "200") { + execution.setVariable(Prefix + "Success", true) + msoLogger.trace("UpdateNetworkInstance Success ") + // Place holder for additional code. + + } else { + execution.setVariable(Prefix + "Success", false) + msoLogger.trace("UpdateNetworkInstance Failed in CompletionMsoProces flow!. ") + + } + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in UpdateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + // ******************************* + // Build Error Section + // ******************************* + + public void processRollbackData (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside processRollbackData() of UpdateNetworkInstance") + + try { + //execution.getVariable("orchestrationStatus") + //execution.getVariable("networkId") + //execution.getVariable("networkName") + //networkOutputParams + //rollbackData + //rolledBack + + } catch (Exception ex) { + msoLogger.debug(" Bpmn error encountered in UpdateNetworkInstance flow. callDBCatalog() - " + ex.getMessage()) + } + + } + + // Prepare for FalloutHandler + public void buildErrorResponse (DelegateExecution execution) { + + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler. ") + + String falloutHandlerRequest = "" + String requestId = execution.getVariable("mso-request-id") + + try { + + WorkflowException wfe = execution.getVariable("WorkflowException") + String errorCode = String.valueOf(wfe.getErrorCode()) + String errorMessage = wfe.getErrorMessage() + falloutHandlerRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + UPDATE + VID + + + ${MsoUtils.xmlEscape(errorMessage)} + ${MsoUtils.xmlEscape(errorCode)} + + """ + + msoLogger.debug(falloutHandlerRequest) + execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) + msoLogger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest) + + } catch (Exception ex) { + String errorException = " Bpmn error encountered in UpdateNetworkInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + msoLogger.debug("Exception error in UpdateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage()) + falloutHandlerRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + UPDATE + VID + + + ${MsoUtils.xmlEscape(errorException)} + 7000 + + """ + + execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) + msoLogger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest) + + } + + } + + public void processJavaException(DelegateExecution execution){ + + execution.setVariable("prefix",Prefix) + try{ + msoLogger.debug("Caught a Java Exception in " + Prefix) + msoLogger.debug("Started processJavaException Method") + msoLogger.debug("Variables List: " + execution.getVariables()) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + + }catch(Exception e){ + msoLogger.debug("Caught Exception during processJavaException Method: " + e) + execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) + } + msoLogger.debug("Completed processJavaException Method in " + Prefix) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy new file mode 100644 index 0000000000..b1aaf5ea5f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy @@ -0,0 +1,326 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + +public class UpdateVfModule extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModule.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'UPDVfMod_') + execution.setVariable('UPDVfMod_Request', null) + execution.setVariable('UPDVfMod_requestInfo', null) + execution.setVariable('UPDVfMod_requestId', null) + execution.setVariable('UPDVfMod_source', null) + execution.setVariable('UPDVfMod_vnfInputs', null) + execution.setVariable('UPDVfMod_vnfId', null) + execution.setVariable('UPDVfMod_vfModuleId', null) + execution.setVariable('UPDVfMod_tenantId', null) + execution.setVariable('UPDVfMod_volumeGroupId', null) + execution.setVariable('UPDVfMod_vnfParams', null) + execution.setVariable('UPDVfMod_updateInfraRequest', null) + execution.setVariable('UpdateVfModuleSuccessIndicator', false) + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + initProcessVariables(execution) + String request = validateRequest(execution) + + msoLogger.debug("UpdateVfModule request: " + request) + def requestInfo = getRequiredNodeXml(execution, request, 'request-info') + execution.setVariable('UPDVfMod_requestInfo', requestInfo) + execution.setVariable('UPDVfMod_requestId', getRequiredNodeText(execution, requestInfo, 'request-id')) + execution.setVariable('UPDVfMod_source', getNodeTextForce(requestInfo, 'source')) + + def vnfInputs = getRequiredNodeXml(execution, request, 'vnf-inputs') + execution.setVariable('UPDVfMod_vnfInputs', vnfInputs) + execution.setVariable('UPDVfMod_vnfId', getRequiredNodeText(execution, vnfInputs, 'vnf-id')) + execution.setVariable('UPDVfMod_vfModuleId', getRequiredNodeText(execution, vnfInputs, 'vf-module-id')) + execution.setVariable('UPDVfMod_tenantId', getRequiredNodeText(execution, vnfInputs, 'tenant-id')) + execution.setVariable('UPDVfMod_volumeGroupId', getNodeTextForce(vnfInputs, 'volume-group-id')) + + def vnfParams = utils.getNodeXml(request, 'vnf-params') + execution.setVariable('UPDVfMod_vnfParams', vnfParams) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) + } + } + + /** + * Prepare and send the synchronous response for this flow. + * + * @param execution The flow's execution instance. + */ + public void sendSynchResponse(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendSynchResponse(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def requestInfo = execution.getVariable('UPDVfMod_requestInfo') + def requestId = execution.getVariable('UPDVfMod_requestId') + def source = execution.getVariable('UPDVfMod_source') + def progress = getNodeTextForce(requestInfo, 'progress') + if (progress.isEmpty()) { + progress = '0' + } + def startTime = getNodeTextForce(requestInfo, 'start-time') + if (startTime.isEmpty()) { + startTime = System.currentTimeMillis() + } + def vnfInputs = execution.getVariable('UPDVfMod_vnfInputs') + + String synchResponse = """ + + + ${MsoUtils.xmlEscape(requestId)} + UPDATE_VF_MODULE + IN_PROGRESS + ${MsoUtils.xmlEscape(progress)} + ${MsoUtils.xmlEscape(startTime)} + ${MsoUtils.xmlEscape(source)} + + ${vnfInputs} + + """ + + synchResponse = utils.formatXml(synchResponse) + sendWorkflowResponse(execution, 200, synchResponse) + + msoLogger.debug("UpdateVfModule Synch Response: " + synchResponse) + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage()) + } + } + + /** + * Prepare the Request for invoking the DoUpdateVfModule subflow. + * + * NOTE: Currently, the method just logs passing through as the + * incoming Request to this main flow is used as the Request to + * the DoUpdateVfModule subflow. No preparation processing is + * necessary. + * + * @param execution The flow's execution instance. + */ + public void prepDoUpdateVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepDoUpdateVfModule(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage()) + } + } + + /** + * Prepare the Request for updating the DB for this Infra Request. + * + * @param execution The flow's execution instance. + */ + public void prepUpdateInfraRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepUpdateInfraRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def requestId = execution.getVariable('UPDVfMod_requestId') + def vnfId = execution.getVariable('UPDVfMod_vnfId') + def vfModuleId = execution.getVariable('UPDVfMod_vfModuleId') + def tenantId = execution.getVariable('UPDVfMod_tenantId') + def volumeGroupId = execution.getVariable('UPDVfMod_volumeGroupId') + + String updateInfraRequest = """ + + + + + ${MsoUtils.xmlEscape(requestId)} + BPEL + COMPLETE + 100 + + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(volumeGroupId)} + + + + + """ + + updateInfraRequest = utils.formatXml(updateInfraRequest) + execution.setVariable('UPDVfMod_updateInfraRequest', updateInfraRequest) + msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest) + + msoLogger.debug("UpdateVfModule Infra Request: " + updateInfraRequest) + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage()) + } + } + + /** + * Builds a "CompletionHandler" request and stores it in the specified execution variable. + * + * @param execution the execution + * @param resultVar the execution variable in which the result will be stored + */ + public void completionHandlerPrep(DelegateExecution execution, String resultVar) { + def method = getClass().getSimpleName() + '.completionHandlerPrep(' + + 'execution=' + execution.getId() + + ', resultVar=' + resultVar + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def requestInfo = getVariable(execution, 'UPDVfMod_requestInfo') + + String content = """ + + ${requestInfo} + MSO_ACTIVATE_BPEL + + """ + + content = utils.formatXml(content) + msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + execution.setVariable(resultVar, content) + + msoLogger.debug("UpdateVfModule CompletionHandler Request: " + content) + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') + } + } + + /** + * Builds a "FalloutHandler" request and stores it in the specified execution variable. + * + * @param execution the execution + * @param resultVar the execution variable in which the result will be stored + */ + public void falloutHandlerPrep(DelegateExecution execution, String resultVar) { + def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + + 'execution=' + execution.getId() + + ', resultVar=' + resultVar + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def prefix = execution.getVariable('prefix') + def request = getVariable(execution, prefix+'Request') + def requestInformation = utils.getNodeXml(request, 'request-information', false) + + def WorkflowException workflowException = execution.getVariable("WorkflowException") + def errorResponseCode = workflowException.getErrorCode() + def errorResponseMsg = workflowException.getErrorMessage() + def encErrorResponseMsg = "" + if (errorResponseMsg != null) { + encErrorResponseMsg = errorResponseMsg + } + + String content = """ + + ${requestInformation} + + ${MsoUtils.xmlEscape(encErrorResponseMsg)} + ${MsoUtils.xmlEscape(errorResponseCode)} + + + """ + content = utils.formatXml(content) + msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + execution.setVariable(resultVar, content) + + msoLogger.debug("UpdateVfModule fallOutHandler Request: " + content) + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy new file mode 100644 index 0000000000..416d0d6e60 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy @@ -0,0 +1,504 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +import groovy.json.JsonOutput +import groovy.json.JsonSlurper + +public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleInfra.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'UPDVfModI_') + execution.setVariable('UPDVfModI_Request', null) + execution.setVariable('UPDVfModI_requestInfo', null) + execution.setVariable('UPDVfModI_requestId', null) + execution.setVariable('UPDVfModI_source', null) + execution.setVariable('UPDVfModI_vnfInputs', null) + execution.setVariable('UPDVfModI_vnfId', null) + execution.setVariable('UPDVfModI_vfModuleId', null) + execution.setVariable('UPDVfModI_tenantId', null) + execution.setVariable('UPDVfModI_volumeGroupId', null) + execution.setVariable('UPDVfModI_vnfParams', null) + execution.setVariable('UPDVfModI_updateInfraRequest', null) + execution.setVariable('UpdateVfModuleSuccessIndicator', false) + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + initProcessVariables(execution) + + def prefix = "UPDVfModI_" + + def incomingRequest = execution.getVariable('bpmnRequest') + + msoLogger.debug("Incoming Infra Request: " + incomingRequest) + try { + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + Map reqMap = jsonSlurper.parseText(incomingRequest) + msoLogger.debug(" Request is in JSON format.") + + def serviceInstanceId = execution.getVariable('serviceInstanceId') + def vnfId = execution.getVariable('vnfId') + + execution.setVariable(prefix + 'serviceInstanceId', serviceInstanceId) + execution.setVariable(prefix+'vnfId', vnfId) + execution.setVariable("isVidRequest", "true") + + def vnfName = '' + def asdcServiceModelVersion = '' + def serviceModelInfo = null + def vnfModelInfo = null + + def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList + + if (relatedInstanceList != null) { + relatedInstanceList.each { + if (it.relatedInstance.modelInfo?.modelType == 'service') { + asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion + serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) + + } + if (it.relatedInstance.modelInfo.modelType == 'vnf') { + vnfName = it.relatedInstance.instanceName ?: '' + vnfModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) + } + } + } + + execution.setVariable(prefix + 'vnfName', vnfName) + execution.setVariable(prefix + 'asdcServiceModelVersion', asdcServiceModelVersion) + execution.setVariable(prefix + 'serviceModelInfo', serviceModelInfo) + execution.setVariable(prefix + 'vnfModelInfo', vnfModelInfo) + + def vnfType = execution.getVariable('vnfType') + execution.setVariable(prefix + 'vnfType', vnfType) + def vfModuleId = execution.getVariable('vfModuleId') + execution.setVariable(prefix + 'vfModuleId', vfModuleId) + def volumeGroupId = execution.getVariable('volumeGroupId') + execution.setVariable(prefix + 'volumeGroupId', volumeGroupId) + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map userParamsMap = [:] + if (userParams != null) { + userParams.each { userParam -> + userParamsMap.put(userParam.name, userParam.value.toString()) + } + } + + msoLogger.debug('Processed user params: ' + userParamsMap) + + execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap) + + def isBaseVfModule = "false" + if (execution.getVariable('isBaseVfModule') == true) { + isBaseVfModule = "true" + } + + execution.setVariable(prefix + 'isBaseVfModule', isBaseVfModule) + + def requestId = execution.getVariable("mso-request-id") + execution.setVariable(prefix + 'requestId', requestId) + + def vfModuleModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo) + execution.setVariable(prefix + 'vfModuleModelInfo', vfModuleModelInfo) + + def suppressRollback = reqMap.requestDetails?.requestInfo?.suppressRollback + + + def backoutOnFailure = "" + if(suppressRollback != null){ + if ( suppressRollback == true) { + backoutOnFailure = "false" + } else if ( suppressRollback == false) { + backoutOnFailure = "true" + } + } + + execution.setVariable('disableRollback', suppressRollback) + + def vfModuleName = reqMap.requestDetails?.requestInfo?.instanceName ?: null + execution.setVariable(prefix + 'vfModuleName', vfModuleName) + + def serviceId = reqMap.requestDetails?.requestParameters?.serviceId ?: '' + execution.setVariable(prefix + 'serviceId', serviceId) + + def usePreload = reqMap.requestDetails?.requestParameters?.usePreload + execution.setVariable(prefix + 'usePreload', usePreload) + + def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration + def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId + execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId) + def tenantId = cloudConfiguration.tenantId + execution.setVariable(prefix + 'tenantId', tenantId) + + def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: '' + execution.setVariable(prefix + 'globalSubscriberId', globalSubscriberId) + + execution.setVariable(prefix + 'sdncVersion', '1702') + + execution.setVariable("UpdateVfModuleInfraSuccessIndicator", false) + + + + + def source = reqMap.requestDetails?.requestInfo?.source + execution.setVariable(prefix + "source", source) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + UPDATE + ${MsoUtils.xmlEscape(source)} + """ + + execution.setVariable(prefix + "requestInfo", requestInfo) + + //backoutOnFailure + + msoLogger.debug('RequestInfo: ' + execution.getVariable(prefix + "requestInfo")) + + msoLogger.trace('Exited ' + method) + + } + catch(groovy.json.JsonException je) { + msoLogger.debug(" Request is not in JSON format.") + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") + + } + catch(Exception e) { + String restFaultMessage = e.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) + } + } + + /** + * Prepare and send the sychronous response for this flow. + * + * @param execution The flow's execution instance. + */ + public void sendSynchResponse(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendSynchResponse(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + + try { + def requestInfo = execution.getVariable('UPDVfModI_requestInfo') + def requestId = execution.getVariable('UPDVfModI_requestId') + def source = execution.getVariable('UPDVfModI_source') + def progress = getNodeTextForce(requestInfo, 'progress') + if (progress.isEmpty()) { + progress = '0' + } + def startTime = getNodeTextForce(requestInfo, 'start-time') + if (startTime.isEmpty()) { + startTime = System.currentTimeMillis() + } + + // RESTResponse (for API Handler (APIH) Reply Task) + def vfModuleId = execution.getVariable("vfModuleId") + String synchResponse = """{"requestReferences":{"instanceId":"${vfModuleId}","requestId":"${requestId}"}}""".trim() + + sendWorkflowResponse(execution, 200, synchResponse) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) + } + } + + /** + * Prepare the Request for invoking the DoUpdateVfModule subflow. + * + * NOTE: Currently, the method just logs passing through as the + * incoming Request to this main flow is used as the Request to + * the DoUpdateVfModule subflow. No preparation processing is + * necessary. + * + * @param execution The flow's execution instance. + */ + public void prepDoUpdateVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepDoUpdateVfModule(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage()) + } + } + + /** + * Prepare the Request for updating the DB for this Infra Request. + * + * @param execution The flow's execution instance. + */ + public void prepUpdateInfraRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepUpdateInfraRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def requestId = execution.getVariable('UPDVfModI_requestId') + def vnfId = execution.getVariable('UPDVfModI_vnfId') + def vfModuleId = execution.getVariable('UPDVfModI_vfModuleId') + def tenantId = execution.getVariable('UPDVfModI_tenantId') + def volumeGroupId = execution.getVariable('UPDVfModI_volumeGroupId') + + String updateInfraRequest = """ + + + + + ${MsoUtils.xmlEscape(requestId)} + BPEL + COMPLETE + 100 + + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vfModuleId)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(volumeGroupId)} + + + + + """ + + updateInfraRequest = utils.formatXml(updateInfraRequest) + execution.setVariable('UPDVfModI_updateInfraRequest', updateInfraRequest) + msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage()) + } + } + + /** + * Builds a "CompletionHandler" request and stores it in the specified execution variable. + * + * @param execution the execution + * @param resultVar the execution variable in which the result will be stored + */ + public void completionHandlerPrep(DelegateExecution execution, String resultVar) { + def method = getClass().getSimpleName() + '.completionHandlerPrep(' + + 'execution=' + execution.getId() + + ', resultVar=' + resultVar + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def requestInfo = getVariable(execution, 'UPDVfModI_requestInfo') + + String content = """ + + ${requestInfo} + MSO_ACTIVATE_BPEL + + """ + + content = utils.formatXml(content) + msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + execution.setVariable(resultVar, content) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') + } + } + + /** + * Builds a "FalloutHandler" request and stores it in the specified execution variable. + * + * @param execution the execution + * @param resultVar the execution variable in which the result will be stored + */ + public void falloutHandlerPrep(DelegateExecution execution, String resultVar) { + def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + + 'execution=' + execution.getId() + + ', resultVar=' + resultVar + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def prefix = execution.getVariable('prefix') + def request = getVariable(execution, prefix+'Request') + def requestInformation = execution.getVariable(prefix + "requestInfo") + + def WorkflowException workflowException = execution.getVariable("WorkflowException") + def errorResponseCode = workflowException.getErrorCode() + def errorResponseMsg = workflowException.getErrorMessage() + def encErrorResponseMsg = "" + if (errorResponseMsg != null) { + encErrorResponseMsg = errorResponseMsg + } + + String content = """ + + ${requestInformation} + + ${MsoUtils.xmlEscape(encErrorResponseMsg)} + ${MsoUtils.xmlEscape(errorResponseCode)} + + + """ + content = utils.formatXml(content) + msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + execution.setVariable(resultVar, content) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') + } + } + + /** + * Validates the request, request id and service instance id. If a problem is found, + * a WorkflowException is generated and an MSOWorkflowException event is thrown. This + * method also sets up the log context for the workflow. + * @param execution the execution + * @return the validated request + */ + public String validateInfraRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.validateInfraRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + String processKey = getProcessKey(execution); + def prefix = execution.getVariable("prefix") + + if (prefix == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null") + } + + try { + def request = execution.getVariable(prefix + 'Request') + + if (request == null) { + request = execution.getVariable(processKey + 'Request') + + if (request == null) { + request = execution.getVariable('bpmnRequest') + } + + setVariable(execution, processKey + 'Request', null); + setVariable(execution, 'bpmnRequest', null); + setVariable(execution, prefix + 'Request', request); + } + + if (request == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null") + } + + /* + + def requestId = execution.getVariable("mso-request-id") + + if (requestId == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request has no mso-request-id") + } + + setVariable(execution, prefix + 'requestId', requestId) + + def serviceInstanceId = execution.getVariable("mso-service-instance-id") + + if (serviceInstanceId == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id") + } + + utils.logContext(requestId, serviceInstanceId) + */ + msoLogger.debug('Incoming message: ' + System.lineSeparator() + request) + msoLogger.trace('Exited ' + method) + return request + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy new file mode 100644 index 0000000000..a926030924 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy @@ -0,0 +1,468 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.client.aai.AAIValidatorImpl +import org.onap.so.client.appc.ApplicationControllerClient +import org.onap.so.logger.MsoLogger + +import groovy.json.JsonOutput +import groovy.json.JsonSlurper + +public class UpdateVfModuleInfraV2 { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleInfraV2.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + boolean preProcessRequestCheck = true; + boolean sendSynchResponseCheck = true; + boolean checkPserverFlagCheck = true; + boolean vfFlagCheckSetCheck = true; + boolean lockAppCCheck = true; + boolean healthDiagnosticSDNOCheck = true; + boolean healthCheckAppCCheck = true; + boolean stopVfModuleControllerCheck = true; + boolean healthCheckControllerCheck = true; + boolean doUpdateVfModulePrepCheck = true; + boolean completionHandlerPrepCheck = true; + boolean startVfModuleControllerCheck = true; + boolean vFFlagUnsetCheck = true; + boolean unlockAppCCheck = true; + boolean postUpgradeHealthCheckControllerCheck = true; + + + + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'UPDVfModI_') + execution.setVariable('UPDVfModI_Request', null) + execution.setVariable('UPDVfModI_requestInfo', null) + execution.setVariable('UPDVfModI_requestId', null) + execution.setVariable('UPDVfModI_source', null) + execution.setVariable('UPDVfModI_vnfInputs', null) + execution.setVariable('UPDVfModI_vnfId', null) + execution.setVariable('UPDVFModI_moduleUuid', null) + execution.setVariable('UPDVfModI_vfModuleId', null) + execution.setVariable('UPDVfModI_tenantId', null) + execution.setVariable('UPDVfModI_volumeGroupId', null) + execution.setVariable('UPDVfModI_vnfParams', null) + execution.setVariable('UPDVfModI_updateInfraRequest', null) + execution.setVariable('UpdateVfModuleSuccessIndicator', false) + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + System.out.print("*****************************PreProcessRequest**************************") + + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + + //msoLogger.trace('Entered ' + method) + + initProcessVariables(execution) + + def prefix = "UPDVfModI_" + + def incomingRequest = execution.getVariable('bpmnRequest') + + //msoLogger.debug("Incoming Infra Request: " + incomingRequest) + try { + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + Map reqMap = jsonSlurper.parseText(incomingRequest) + //msoLogger.debug(" Request is in JSON format.") + + def serviceInstanceId = execution.getVariable('serviceInstanceId') + def vnfId = execution.getVariable('vnfId') + def moduleUuid = execution.getVariable('moduleUuid') + execution.setVariable(prefix + 'moduleUuid',moduleUuid) + execution.setVariable(prefix + 'serviceInstanceId', serviceInstanceId) + execution.setVariable(prefix+'vnfId', vnfId) + execution.setVariable("isVidRequest", "true") + + def vnfName = '' + def asdcServiceModelVersion = '' + def serviceModelInfo = null + def vnfModelInfo = null + + def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList + + if (relatedInstanceList != null) { + relatedInstanceList.each { + if (it.relatedInstance.modelInfo?.modelType == 'service') { + asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion + serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) + } + if (it.relatedInstance.modelInfo.modelType == 'vnf') { + vnfName = it.relatedInstance.instanceName ?: '' + vnfModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) + } + } + } + + execution.setVariable(prefix + 'vnfName', vnfName) + execution.setVariable(prefix + 'asdcServiceModelVersion', asdcServiceModelVersion) + execution.setVariable(prefix + 'serviceModelInfo', serviceModelInfo) + execution.setVariable(prefix + 'vnfModelInfo', vnfModelInfo) + + def vnfType = execution.getVariable('vnfType') + execution.setVariable(prefix + 'vnfType', vnfType) + def vfModuleId = execution.getVariable('vfModuleId') + execution.setVariable(prefix + 'vfModuleId', vfModuleId) + def volumeGroupId = execution.getVariable('volumeGroupId') + execution.setVariable(prefix + 'volumeGroupId', volumeGroupId) + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map userParamsMap = [:] + if (userParams != null) { + userParams.each { userParam -> + userParamsMap.put(userParam.name, userParam.value.toString()) + } + } + + //msoLogger.debug('Processed user params: ' + userParamsMap) + + execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap) + + def isBaseVfModule = "false" + if (execution.getVariable('isBaseVfModule') == true) { + isBaseVfModule = "true" + } + + execution.setVariable(prefix + 'isBaseVfModule', isBaseVfModule) + + def requestId = execution.getVariable("mso-request-id") + execution.setVariable(prefix + 'requestId', requestId) + + def vfModuleModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo) + execution.setVariable(prefix + 'vfModuleModelInfo', vfModuleModelInfo) + + def suppressRollback = reqMap.requestDetails?.requestInfo?.suppressRollback + + + def backoutOnFailure = "" + if(suppressRollback != null){ + if ( suppressRollback == true) { + backoutOnFailure = "false" + } else if ( suppressRollback == false) { + backoutOnFailure = "true" + } + } + + execution.setVariable('disableRollback', suppressRollback) + + def vfModuleName = reqMap.requestDetails?.requestInfo?.instanceName ?: null + execution.setVariable(prefix + 'vfModuleName', vfModuleName) + + def serviceId = reqMap.requestDetails?.requestParameters?.serviceId ?: '' + execution.setVariable(prefix + 'serviceId', serviceId) + + def usePreload = reqMap.requestDetails?.requestParameters?.usePreload + execution.setVariable(prefix + 'usePreload', usePreload) + + def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration + def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId + execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId) + def tenantId = cloudConfiguration.tenantId + execution.setVariable(prefix + 'tenantId', tenantId) + + def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: '' + execution.setVariable(prefix + 'globalSubscriberId', globalSubscriberId) + + execution.setVariable(prefix + 'sdncVersion', '1702') + + execution.setVariable("UpdateVfModuleInfraSuccessIndicator", false) + + + + + def source = reqMap.requestDetails?.requestInfo?.source + execution.setVariable(prefix + "source", source) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + UPDATE + ${MsoUtils.xmlEscape(source)} + """ + + execution.setVariable(prefix + "requestInfo", requestInfo) + + //backoutOnFailure + + //msoLogger.debug('RequestInfo: ' + execution.getVariable(prefix + "requestInfo")) + + //msoLogger.trace('Exited ' + method) + + } + catch(groovy.json.JsonException je) { + //msoLogger.debug(" Request is not in JSON format.") + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") + } + catch(Exception e) { + String restFaultMessage = e.getMessage() + //msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) + } + } + + /** + * Prepare and send the synchronous response for this flow. + * + * @param execution The flow's execution instance. + */ + public void sendSynchResponse(DelegateExecution execution) { + System.out.print("*****************************SendSynchResponse**************************") + + def method = getClass().getSimpleName() + '.sendSynchResponse(' + + 'execution=' + execution.getId() + + ')' + + //msoLogger.trace('Entered ' + method) + + + try { + def requestInfo = execution.getVariable('UPDVfModI_requestInfo') + def requestId = execution.getVariable('UPDVfModI_requestId') + def source = execution.getVariable('UPDVfModI_source') + + def progress = getNodeTextForce(requestInfo, 'progress') + if (progress.isEmpty()) { + progress = '0' + } + def startTime = getNodeTextForce(requestInfo, 'start-time') + if (startTime.isEmpty()) { + startTime = System.currentTimeMillis() + } + // RESTResponse (for API Handler (APIH) Reply Task) + def vfModuleId = execution.getVariable("vfModuleId") + String synchResponse = """{"requestReferences":{"instanceId":"${vfModuleId}","requestId":"${requestId}"}}""".trim() + sendWorkflowResponse(execution, 200, synchResponse) + //msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + //msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) + } + } + + //check to see if the Pserver Flag is locked + public void checkPserverFlag(DelegateExecution execution) { + + System.out.println("*****************************CheckingPserverFlag*************************") + String vnfId = (String)execution.getVariable('vnfId') + String uuid = (String)execution.getVariable('moduleUuid') + AAIValidatorImpl aaiVI = new AAIValidatorImpl() + boolean flag = aaiVI.isPhysicalServerLocked(vnfId, uuid) + } + + //check to see if the VFFlag is locked + public void vfFlagCheck(DelegateExecution execution) { + + System.out.print("*****************************VfFlagCheck*************************") + String vnfId = (String)execution.getVariable('vnfId') + String uuid = (String)execution.getVariable('moduleUuid') + AAIValidatorImpl aaiVI = new AAIValidatorImpl() + boolean flag = aaiVI.isVNFLocked(vnfId, uuid) + + } + //lock the VF Flag + public void vfFlagSet(DelegateExecution execution) { + + System.out.print("*****************************VfFlagSet*************************") + String vnfId = (String)execution.getVariable('vnfId') + String uuid = (String)execution.getVariable('moduleUuid') + AAIValidatorImpl aaiVI = new AAIValidatorImpl() + aaiVI.updateVnfToLocked(vnfId,uuid); + + } + + //Lock AppC + public void lockAppC(DelegateExecution execution) { + + System.out.print("*****************************lockAppC*************************") + def vfModuleId = "" + ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties()) + def status = aCC.runCommand("Lock",vfModuleId) + + + } + //run health check + public void healthCheckAppC(DelegateExecution execution) { + + System.out.print("*****************************healthCheckAppC*************************") + def vfModuleId = "" + ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties()) + def status = aCC.runCommand("HealthCheck",vfModuleId) + + } + //SDNO health diagnostic + public void healthDiagnosticSDNO(DelegateExecution execution) { + + System.out.print("*****************************healthDiagnosticSDNO is currently ignored*************************") + //SDNOValidatorImpl.healthDiagnostic("",""); + + } + //stop VF module controller + public void stopVfModuleController(DelegateExecution execution) { + + System.out.print("*****************************stopVfModuleController*************************") + def vfModuleId = "" + ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties()) + def status = aCC.runCommand("Stop",vfModuleId) + + + } + + public void doUpdateVfModulePrep(DelegateExecution execution) { + + System.out.print("*****************************doUpdateVfModulePrep*************************") + def method = getClass().getSimpleName() + '.prepDoUpdateVfModule(' + + 'execution=' + execution.getId() + + ')' + + //msoLogger.trace('Entered ' + method) + + try { + + //msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + //msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage()) + + } + + } + + public void completionHandlerPrep(DelegateExecution execution,String resultVar) { + + System.out.print("*****************************completionHandlerPrep*************************") + def method = getClass().getSimpleName() + '.completionHandlerPrep(' + + 'execution=' + execution.getId() + + ', resultVar=' + resultVar + + ')' + + //msoLogger.trace('Entered ' + method) + + try { + def requestInfo = getVariable(execution, 'UPDVfModI_requestInfo') + + String content = """ + + ${requestInfo} + MSO_ACTIVATE_BPEL + + """ + + content = utils.formatXml(content) + //msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + execution.setVariable(resultVar, content) + + //msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + //msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') + + } + + } + + public void healthCheckController(DelegateExecution execution) { + + System.out.print("*****************************healthCheckController*************************") + def vfModuleId = "" + ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties()) + def status = aCC.runCommand("HealthCheck",vfModuleId) + + } + + public void startVfModuleController(DelegateExecution execution) { + + System.out.print("*****************************startVfModuleController*************************") + def vfModuleId = "" + ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties()) + def status = aCC.runCommand("Start",vfModuleId) + + } + + public void vFFlagUnset(DelegateExecution execution) { + + System.out.print("*****************************vFFlagUnset*************************") + String vnfId = (String)execution.getVariable('vnfId') + String uuid = (String)execution.getVariable('moduleUuid') + AAIValidatorImpl aaiVI = new AAIValidatorImpl() + aaiVI.updateVnfToUnLocked(vnfId,uuid); + + + } + + public void unlockAppC(DelegateExecution execution) { + + System.out.print("*****************************unlockAppC*************************") + def vfModuleId = "" + ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties()) + def status = aCC.runCommand("Unlock",vfModuleId) + + } + + public void postUpgradeHealthCheckController(DelegateExecution execution) { + + System.out.print("*****************************postUpgradeHealthCheckController*************************") + def vfModuleId = "" + ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties()) + def status = aCC.runCommand("HealthCheck",vfModuleId) + + } + + Properties getLCMProperties() { + Properties properties = new Properties() + + properties.put("topic.read", UrnPropertiesReader.getVariable("appc.client.topic.read.name")) + properties.put("topic.read.timeout", UrnPropertiesReader.getVariable("appc.client.topic.read.timeout")) + properties.put("client.response.timeout", UrnPropertiesReader.getVariable("appc.client.response.timeout")) + properties.put("topic.write", UrnPropertiesReader.getVariable("appc.client.topic.write")) + properties.put("poolMembers", UrnPropertiesReader.getVariable("appc.client.poolMembers")) + properties.put("client.key", UrnPropertiesReader.getVariable("appc.client.key")) + properties.put("client.secret", UrnPropertiesReader.getVariable("appc.client.secret")) + properties.put("client.name", "MSO") + properties.put("service", UrnPropertiesReader.getVariable("appc.client.service")) + return properties + } + +} + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy new file mode 100644 index 0000000000..b7f31d7823 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy @@ -0,0 +1,445 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.VfModuleBase +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils + +class UpdateVfModuleVolume extends VfModuleBase { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleVolume.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + private void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'UPDVfModVol_') + execution.setVariable('UPDVfModVol_Request', null) + execution.setVariable('UPDVfModVol_requestInfo', null) + execution.setVariable('UPDVfModVol_requestId', null) + execution.setVariable('UPDVfModVol_source', null) + execution.setVariable('UPDVfModVol_volumeInputs', null) + execution.setVariable('UPDVfModVol_volumeGroupId', null) + execution.setVariable('UPDVfModVol_vnfType', null) + execution.setVariable('UPDVfModVol_serviceId', null) + execution.setVariable('UPDVfModVol_aicCloudRegion', null) + execution.setVariable('UPDVfModVol_tenantId', null) + execution.setVariable('UPDVfModVol_volumeParams', null) + execution.setVariable('UPDVfModVol_volumeGroupHeatStackId', null) + execution.setVariable('UPDVfModVol_volumeGroupTenantId', null) + execution.setVariable('UpdateVfModuleVolumeSuccessIndicator', false) + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + @Override + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + initProcessVariables(execution) + String request = validateRequest(execution) + + def requestInfo = getRequiredNodeXml(execution, request, 'request-info') + execution.setVariable('UPDVfModVol_requestInfo', requestInfo) + execution.setVariable('UPDVfModVol_requestId', getRequiredNodeText(execution, requestInfo, 'request-id')) + execution.setVariable('UPDVfModVol_source', getNodeTextForce(requestInfo, 'source')) + + def volumeInputs = getRequiredNodeXml(execution, request, 'volume-inputs') + execution.setVariable('UPDVfModVol_volumeInputs', volumeInputs) + execution.setVariable('UPDVfModVol_volumeGroupId', getRequiredNodeText(execution, volumeInputs, 'volume-group-id')) + execution.setVariable('UPDVfModVol_vnfType', getRequiredNodeText(execution, volumeInputs, 'vnf-type')) + execution.setVariable('UPDVfModVol_serviceId', getRequiredNodeText(execution, volumeInputs, 'service-id')) + execution.setVariable('UPDVfModVol_aicCloudRegion', getRequiredNodeText(execution, volumeInputs, 'aic-cloud-region')) + execution.setVariable('UPDVfModVol_tenantId', getRequiredNodeText(execution, volumeInputs, 'tenant-id')) + + def volumeParams = utils.getNodeXml(request, 'volume-params') + execution.setVariable('UPDVfModVol_volumeParams', volumeParams) + + msoLogger.trace('Exited ' + method) + msoLogger.debug("UpdateVfModuleVolume request: " + request) + } catch (BpmnError bpmnError) { + throw bpmnError + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) + } + } + + /** + * Prepare and send the synchronous response. + * + * @param execution The flow's execution instance. + */ + public void sendSynchResponse(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendSynchResponse(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def requestInfo = execution.getVariable('UPDVfModVol_requestInfo') + def requestId = execution.getVariable('UPDVfModVol_requestId') + def source = execution.getVariable('UPDVfModVol_source') + def progress = getNodeTextForce(requestInfo, 'progress') + if (progress.isEmpty()) { + progress = '0' + } + def startTime = getNodeTextForce(requestInfo, 'start-time') + if (startTime.isEmpty()) { + startTime = System.currentTimeMillis() + } + def volumeInputs = execution.getVariable('UPDVfModVol_volumeInputs') + + String synchResponse = """ + + + ${MsoUtils.xmlEscape(requestId)} + UPDATE_VF_MODULE_VOL + IN_PROGRESS + ${MsoUtils.xmlEscape(progress)} + ${MsoUtils.xmlEscape(startTime)} + ${MsoUtils.xmlEscape(source)} + + ${volumeInputs} + + """ + + synchResponse = utils.formatXml(synchResponse) + sendWorkflowResponse(execution, 200, synchResponse) + msoLogger.debug("UpdateVfModuleVolume Synch Response: " + synchResponse) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage()) + } + } + + /** + * Prepare a Request for querying AAI for Volume Group information using the + * Volume Group Id and Aic Cloud Region. + * + * @param execution The flow's execution instance. + */ + public void queryAAIForVolumeGroup(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.queryAAIForVolumeGroup(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') + def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') + def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + + '/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/' + UriUtils.encode(aicCloudRegion, "UTF-8") + + '/volume-groups/volume-group/' + UriUtils.encode(volumeGroupId, "UTF-8") + + msoLogger.debug('Sending GET to AAI endpoint \'' + endPoint + '\'') + msoLogger.debug("UpdateVfModuleVolume sending GET for quering AAI endpoint: " + endPoint) + + AaiUtil aaiUtil = new AaiUtil(this) + APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) + def int statusCode = response.getStatusCode() + def responseData = response.getResponseBodyAsString() + msoLogger.debug('Response code:' + statusCode) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + msoLogger.debug("UpdateVfModuleVolume response data: " + responseData) + + def volumeGroup = responseData + def heatStackId = getNodeTextForce(volumeGroup, 'heat-stack-id') + execution.setVariable('UPDVfModVol_volumeGroupHeatStackId', heatStackId) + if ((statusCode == 200) || (statusCode == 204)) { + def volumeGroupTenantId = getTenantIdFromVolumeGroup(volumeGroup) + if (volumeGroupTenantId == null) { + throw new Exception('Could not find Tenant Id element in Volume Group with Volume Group Id \'' + volumeGroupId + '\'' + + '\', AIC Cloud Region \'' + aicCloudRegion + '\'') + } + execution.setVariable('UPDVfModVol_volumeGroupTenantId', volumeGroupTenantId) + msoLogger.debug('Received Tenant Id \'' + volumeGroupTenantId + '\' from AAI for Volume Group with Volume Group Id \'' + volumeGroupId + '\'' + + '\', AIC Cloud Region \'' + aicCloudRegion + '\'') + } else if (statusCode == 404) { + throw new Exception('Volume Group \'' + volumeGroupId + '\' not found at AAI') + } else { + throw new Exception('Bad status code ' + statusCode + ' received from AAI; Response data: ' + responseData) + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVolumeGroup(): ' + e.getMessage()) + } + } + + /** + * Prepare a Request for invoking the VnfAdapterRest subflow to do + * a Volume Group update. + * + * @param execution The flow's execution instance. + */ + public void prepVnfAdapterRest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepVnfAdapterRest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') + def tenantId = execution.getVariable('UPDVfModVol_tenantId') + def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') + def volumeGroupHeatStackId = execution.getVariable('UPDVfModVol_volumeGroupHeatStackId') + def vnfType = execution.getVariable('UPDVfModVol_vnfType') + + def volumeParamsXml = execution.getVariable('UPDVfModVol_volumeParams') + def volumeGroupParams = transformParamsToEntries(volumeParamsXml) + + def requestId = execution.getVariable('UPDVfModVol_requestId') + def serviceId = execution.getVariable('UPDVfModVol_serviceId') + + def messageId = execution.getVariable('mso-request-id') + '-' + System.currentTimeMillis() + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) + def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) + if ('true'.equals(useQualifiedHostName)) { + notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) + } + + String vnfAdapterRestRequest = """ + + ${MsoUtils.xmlEscape(aicCloudRegion)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(volumeGroupId)} + ${MsoUtils.xmlEscape(volumeGroupHeatStackId)} + ${MsoUtils.xmlEscape(vnfType)} + + + + ${volumeGroupParams} + + true + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(serviceId)} + + ${MsoUtils.xmlEscape(messageId)} + ${MsoUtils.xmlEscape(notificationUrl)} + + """ + vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest) + execution.setVariable('UPDVfModVol_vnfAdapterRestRequest', vnfAdapterRestRequest) + msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest) + + msoLogger.debug("UpdateVfModuleVolume Request for VNFAdapter Rest: " + vnfAdapterRestRequest) + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage()) + } + } + + /** + * Prepare a Request for updating the DB for this Infra request. + * + * @param execution The flow's execution instance. + */ + public void prepDbInfraDbRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepDbInfraDbRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def requestId = execution.getVariable('UPDVfMod_requestId') + + String updateInfraRequest = """ + + + + + ${MsoUtils.xmlEscape(requestId)} + BPEL + COMPLETE + 100 + + + + """ + + updateInfraRequest = utils.formatXml(updateInfraRequest) + execution.setVariable('UPDVfModVol_updateInfraRequest', updateInfraRequest) + msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest) + + msoLogger.debug("UpdateVfModuleVolume Request for Updating DB for Infra: " + updateInfraRequest) + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildWorkflowException(execution, 1002, 'Error in prepDbInfraDbRequest(): ' + e.getMessage()) + } + } + + /** + * Build a "CompletionHandler" request. + * + * @param execution The flow's execution instance. + */ + public void prepCompletionHandlerRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepCompletionHandlerRequest(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def requestInfo = execution.getVariable('UPDVfModVol_requestInfo') + + String content = """ + + ${requestInfo} + MSO_ACTIVATE_BPEL + + """ + + content = utils.formatXml(content) + msoLogger.debug('Request for Completion Handler:\n' + content) + msoLogger.debug("UpdateVfModuleVolume Completion Handler request: " + content) + execution.setVariable('UPDVfModVol_CompletionHandlerRequest', content) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepCompletionHandlerRequest(): ' + e.getMessage()) + } + } + + /** + * Build a "FalloutHandler" request. + * + * @param execution The flow's execution instance. + */ + public void prepFalloutHandler(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepFalloutHandler(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def requestInfo = execution.getVariable('UPDVfModVol_requestInfo') + + def WorkflowException workflowException = execution.getVariable("WorkflowException") + def errorResponseCode = workflowException.getErrorCode() + def errorResponseMsg = workflowException.getErrorMessage() + def encErrorResponseMsg = "" + if (errorResponseMsg != null) { + encErrorResponseMsg = errorResponseMsg + } + + String content = """ + + ${requestInfo} + + ${MsoUtils.xmlEscape(encErrorResponseMsg)} + ${MsoUtils.xmlEscape(errorResponseCode)} + + + """ + content = utils.formatXml(content) + msoLogger.debug('Request for Fallout Handler:\n' + content) + msoLogger.debug("UpdateVfModuleVolume Fallout request: " + content) + execution.setVariable('UPDVfModVol_FalloutHandlerRequest', content) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildWorkflowException(execution, 1002, 'Error in prepFalloutHandler(): ' + e.getMessage()) + } + } + + /** + * Create a WorkflowException for the error case where the Tenant Id from + * AAI did not match the Tenant Id in the incoming request. + * + * @param execution The flow's execution instance. + */ + public void handleTenantIdMismatch(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.handleTenantIdMismatch(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + String processKey = getProcessKey(execution); + def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') + def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') + def tenantId = execution.getVariable('UPDVfModVol_tenantId') + def volumeGroupTenantId = execution.getVariable('UPDVfModVol_volumeGroupTenantId') + + def String errorMessage = 'TenantId \'' + tenantId + '\' in incoming request does not match Tenant Id \'' + volumeGroupTenantId + + '\' retrieved from AAI for Volume Group Id \'' + volumeGroupId + '\', AIC Cloud Region \'' + aicCloudRegion + '\'' + + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception"); + + WorkflowException exception = new WorkflowException(processKey, 5000, errorMessage); + execution.setVariable("WorkflowException", exception); + + msoLogger.trace('Exited ' + method) + msoLogger.debug("UpdateVfModuleVolume workflowException in Tenant Mismatch: " + errorMessage) + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy new file mode 100644 index 0000000000..7b2d1b78e4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy @@ -0,0 +1,561 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AaiUtil; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.VfModuleBase; +import org.onap.so.bpmn.common.scripts.VidUtils; +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils + +import groovy.json.JsonSlurper + +class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleVolumeInfraV1.class); + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + private void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'UPDVfModVol_') + execution.setVariable('UPDVfModVol_Request', null) + execution.setVariable('UPDVfModVol_requestInfo', null) + execution.setVariable('UPDVfModVol_requestId', null) + execution.setVariable('UPDVfModVol_source', null) + execution.setVariable('UPDVfModVol_volumeInputs', null) + execution.setVariable('UPDVfModVol_volumeGroupId', null) + execution.setVariable('UPDVfModVol_vnfType', null) + execution.setVariable('UPDVfModVol_serviceId', null) + execution.setVariable('UPDVfModVol_aicCloudRegion', null) + execution.setVariable('UPDVfModVol_tenantId', null) + execution.setVariable('UPDVfModVol_volumeParams', null) + execution.setVariable('UPDVfModVol_volumeGroupHeatStackId', null) + execution.setVariable('UPDVfModVol_volumeGroupTenantId', null) + execution.setVariable('UpdateVfModuleVolumeSuccessIndicator', false) + } + + + /** + * Perform initial processing, such as request validation, initialization of variables, etc. + * * @param execution + */ + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + preProcessRequest(execution, isDebugEnabled) + } + + public void preProcessRequest(DelegateExecution execution, isDebugLogEnabled) { + + initProcessVariables(execution) + String jsonRequest = validateRequest(execution) + + def request = "" + + try { + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(jsonRequest) + + def serviceInstanceId = execution.getVariable('serviceInstanceId') + def volumeGroupId = execution.getVariable('volumeGroupId') + //def vnfId = execution.getVariable('vnfId') + + def vidUtils = new VidUtils(this) + request = vidUtils.createXmlVolumeRequest(reqMap, 'UPDATE_VF_MODULE_VOL', serviceInstanceId, volumeGroupId) + + execution.setVariable('UPDVfModVol_Request', request) + execution.setVariable("UPDVfModVol_isVidRequest", true) + + //need to get persona-model-id aka model-invariantId to use later to validate vf-module relation in AAI + + def modelInvariantId = reqMap.requestDetails.modelInfo.modelInvariantUuid ?: '' + execution.setVariable('UPDVfModVol_modelInvariantId', modelInvariantId) + + msoLogger.debug("modelInvariantId from request: " + modelInvariantId) + msoLogger.debug("XML request:\n" + request) + } + catch(groovy.json.JsonException je) { + msoLogger.debug(" Request is in XML format.") + // assume request is in XML format - proceed as usual to process XML request + } + + def requestId = execution.getVariable('mso-request-id') + + def requestInfo = getRequiredNodeXml(execution, request, 'request-info') + execution.setVariable('UPDVfModVol_requestInfo', requestInfo) + execution.setVariable('UPDVfModVol_requestId', requestId) + //execution.setVariable('UPDVfModVol_requestId', getRequiredNodeText(execution, requestInfo, 'request-id')) + execution.setVariable('UPDVfModVol_source', getNodeTextForce(requestInfo, 'source')) + + def volumeInputs = getRequiredNodeXml(execution, request, 'volume-inputs') + execution.setVariable('UPDVfModVol_volumeInputs', volumeInputs) + execution.setVariable('UPDVfModVol_volumeGroupId', getRequiredNodeText(execution, volumeInputs, 'volume-group-id')) + execution.setVariable('UPDVfModVol_vnfType', getRequiredNodeText(execution, volumeInputs, 'vnf-type')) + execution.setVariable('UPDVfModVol_vnfVersion', getRequiredNodeText(execution, volumeInputs, 'asdc-service-model-version')) + execution.setVariable('UPDVfModVol_serviceId', utils.getNodeText(volumeInputs, 'service-id')) + execution.setVariable('UPDVfModVol_aicCloudRegion', getRequiredNodeText(execution, volumeInputs, 'aic-cloud-region')) + execution.setVariable('UPDVfModVol_tenantId', getRequiredNodeText(execution, volumeInputs, 'tenant-id')) + //execution.setVariable('UPDVfModVol_modelCustomizationId', getRequiredNodeText(execution, volumeInputs, 'model-customization-id')) + + setBasicDBAuthHeader(execution, isDebugLogEnabled) + + def volumeParams = utils.getNodeXml(request, 'volume-params') + execution.setVariable('UPDVfModVol_volumeParams', volumeParams) + } + + /** + * Prepare and send the synchronous response. + * + * @param execution The flow's execution instance. + */ + public void sendSynchResponse(DelegateExecution execution, isDebugLogEnabled) { + + def requestInfo = execution.getVariable('UPDVfModVol_requestInfo') + def requestId = execution.getVariable('UPDVfModVol_requestId') + def source = execution.getVariable('UPDVfModVol_source') + def progress = getNodeTextForce(requestInfo, 'progress') + if (progress.isEmpty()) { + progress = '0' + } + def startTime = getNodeTextForce(requestInfo, 'start-time') + if (startTime.isEmpty()) { + startTime = System.currentTimeMillis() + } + def volumeInputs = execution.getVariable('UPDVfModVol_volumeInputs') + + String xmlSyncResponse = """ + + + ${MsoUtils.xmlEscape(requestId)} + UPDATE_VF_MODULE_VOL + IN_PROGRESS + ${MsoUtils.xmlEscape(progress)} + ${MsoUtils.xmlEscape(startTime)} + ${MsoUtils.xmlEscape(source)} + + ${volumeInputs} + + """ + + def syncResponse = '' + def isVidRequest = execution.getVariable('UPDVfModVol_isVidRequest') + + if(isVidRequest) { + def volumeGroupId = execution.getVariable('volumeGroupId') + syncResponse = """{"requestReferences":{"instanceId":"${volumeGroupId}","requestId":"${requestId}"}}""".trim() + } + else { + syncResponse = utils.formatXml(xmlSyncResponse) + } + + msoLogger.debug('Sync response: ' + syncResponse) + execution.setVariable('UPDVfModVol_syncResponseSent', true) + sendWorkflowResponse(execution, 200, syncResponse) + } + + /** + * Prepare a Request for querying AAI for Volume Group information using the + * Volume Group Id and Aic Cloud Region. + * @param execution The flow's execution instance. + */ + public void queryAAIForVolumeGroup(DelegateExecution execution, isDebugLogEnabled) { + + def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') + def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') + + AaiUtil aaiUtil = new AaiUtil(this) + String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution) + String queryAAIVolumeGroupRequest = aaiEndpoint + '/' + URLEncoder.encode(aicCloudRegion, "UTF-8") + "/volume-groups/volume-group/" + UriUtils.encode(volumeGroupId, "UTF-8") + + msoLogger.debug('Query AAI volume group by ID: ' + queryAAIVolumeGroupRequest) + msoLogger.debug('Query AAI volume group by ID: ' + queryAAIVolumeGroupRequest) + + APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIVolumeGroupRequest) + + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msoLogger.debug("AAI query volume group by id return code: " + returnCode) + msoLogger.debug("AAI query volume group by id response: " + aaiResponseAsString) + + msoLogger.debug("AAI Volume Group return code: " + returnCode) + msoLogger.debug("AAI Volume Group response: " + aaiResponseAsString) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + if ((returnCode == '200') || (returnCode == '204')) { + + execution.setVariable('UPDVfModVol_aaiVolumeGroupResponse', aaiResponseAsString) + //def heatStackId = getNodeTextForce(aaiResponseAsString, 'heat-stack-id') + //execution.setVariable('UPDVfModVol_volumeGroupHeatStackId', heatStackId) + + def volumeGroupTenantId = getTenantIdFromVolumeGroup(aaiResponseAsString) + if (volumeGroupTenantId == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id " + volumeGroupId + + ", AIC Cloud Region " + aicCloudRegion) + } + execution.setVariable('UPDVfModVol_volumeGroupTenantId', volumeGroupTenantId) + msoLogger.debug("Received Tenant Id " + volumeGroupTenantId + " from AAI for Volume Group with Volume Group Id " + volumeGroupId + ", AIC Cloud Region " + aicCloudRegion) + + def relatedVfModuleLink = getRelatedVfModuleRelatedLink(aaiResponseAsString) + msoLogger.debug("Related VF Module link: " + relatedVfModuleLink) + execution.setVariable('UPDVfModVol_relatedVfModuleLink', relatedVfModuleLink) + + } + else if (returnCode == '404') { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group " + volumeGroupId + " not found at AAI") + } + else { + WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + throw new BpmnError("MSOWorkflowException") + } + } + + /** + * Query AAI service instance + * @param execution + * @param isDebugEnabled + */ + public void queryAAIForGenericVnf(DelegateExecution execution, isDebugEnabled) { + + def vnfId = execution.getVariable('vnfId') + + AaiUtil aaiUtil = new AaiUtil(this) + String aaiEndpoint = aaiUtil.getNetworkGenericVnfEndpoint(execution) + def String queryAAIRequest = aaiEndpoint + "/" + UriUtils.encode(vnfId, "UTF-8") + + msoLogger.debug("AAI query generic vnf request: " + queryAAIRequest) + + APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIRequest) + + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msoLogger.debug("AAI query generic vnf return code: " + returnCode) + msoLogger.debug("AAI query generic vnf response: " + aaiResponseAsString) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + if (returnCode=='200') { + msoLogger.debug('Generic vnf ' + vnfId + ' found in AAI.') + execution.setVariable('UPDVfModVol_AAIQueryGenericVfnResponse', aaiResponseAsString) + } else { + if (returnCode=='404') { + def message = 'Generic vnf ' + vnfId + ' was not found in AAI. Return code: 404.' + msoLogger.debug(message) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, message) + } else { + WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + throw new BpmnError("MSOWorkflowException") + } + } + } + + /** + * Query AAI for VF Module using vf-module-id + * @param execution + * @param isDebugLogEnabled + */ + public void queryAAIForVfModule(DelegateExecution execution, isDebugLogEnabled) { + + AaiUtil aaiUtil = new AaiUtil(this) + String queryAAIVfModuleRequest = execution.getVariable('UPDVfModVol_relatedVfModuleLink') + execution.setVariable('UPDVfModVol_personaModelId', '') + + msoLogger.debug('Query AAI VF Module: ' + queryAAIVfModuleRequest) + msoLogger.debug('Query AAI VF Module: ' + queryAAIVfModuleRequest) + + def aaiUrl = UrnPropertiesReader.getVariable("aai.endpoint", execution) + msoLogger.debug('A&AI URL: ' + aaiUrl) + + def requestEndpoint = aaiUrl + queryAAIVfModuleRequest + msoLogger.debug('A&AI request endpoint: ' + requestEndpoint) + + APIResponse response = aaiUtil.executeAAIGetCall(execution, requestEndpoint) + + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msoLogger.debug("AAI query vf-module: " + returnCode) + msoLogger.debug("AAI query vf-module response: " + aaiResponseAsString) + + msoLogger.debug("AAI query vf-module:: " + returnCode) + msoLogger.debug("AAI query vf-module response: " + aaiResponseAsString) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + if ((returnCode == '200') || (returnCode == '204')) { + def personaModelId = utils.getNodeText(aaiResponseAsString, 'model-invariant-id') + if(personaModelId == null) { + //check old attribute name + personaModelId = utils.getNodeText(aaiResponseAsString, 'persona-model-id') + } + msoLogger.debug("vfModule personaModelId: " + personaModelId) + execution.setVariable('UPDVfModVol_personaModelId', personaModelId) + } + else if (returnCode == '404') { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "VF Module not found at AAI") + } + else { + WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + throw new BpmnError("MSOWorkflowException") + } + } + /** + * + */ + public String getRelatedVfModuleRelatedLink(xml) { + def list = new XmlSlurper().parseText(xml) + def vfModuleRelationship = list.'**'.find { node -> node.'related-to'.text() == 'vf-module' } + return vfModuleRelationship?.'related-link'?.text() ?: '' + } + + /** + * Prepare a Request for invoking the VnfAdapterRest subflow to do + * a Volume Group update. + * + * @param execution The flow's execution instance. + */ + public void prepVnfAdapterRest(DelegateExecution execution, isDebugLogEnabled) { + + def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') + def tenantId = execution.getVariable('UPDVfModVol_tenantId') + def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') + + def aaiVolumeGroupResponse = execution.getVariable('UPDVfModVol_aaiVolumeGroupResponse') + def volumeGroupHeatStackId = getNodeTextForce(aaiVolumeGroupResponse, 'heat-stack-id') + def volumeGroupName = getNodeTextForce(aaiVolumeGroupResponse, 'volume-group-name') + def modelCustomizationId = getNodeTextForce(aaiVolumeGroupResponse, 'vf-module-model-customization-id') + if(modelCustomizationId == null) { + // Check old attribute name + modelCustomizationId = getNodeTextForce(aaiVolumeGroupResponse, 'vf-module-persona-model-customization-id') + } + + def vnfType = execution.getVariable('UPDVfModVol_vnfType') + def vnfVersion = execution.getVariable('UPDVfModVol_vnfVersion') + + def aaiGenericVnfResponse = execution.getVariable('UPDVfModVol_AAIQueryGenericVfnResponse') + def vnfId = utils.getNodeText(aaiGenericVnfResponse, 'vnf-id') + def vnfName = utils.getNodeText(aaiGenericVnfResponse, 'vnf-name') + + + def volumeParamsXml = execution.getVariable('UPDVfModVol_volumeParams') + def volumeGroupParams = transformVolumeParamsToEntries(volumeParamsXml) + + def requestId = execution.getVariable('UPDVfModVol_requestId') + def serviceId = execution.getVariable('UPDVfModVol_serviceId') + + def messageId = execution.getVariable('mso-request-id') + '-' + System.currentTimeMillis() + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) + def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) + if ('true'.equals(useQualifiedHostName)) { + notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) + } + + String vnfAdapterRestRequest = """ + + ${MsoUtils.xmlEscape(aicCloudRegion)} + ${MsoUtils.xmlEscape(tenantId)} + ${MsoUtils.xmlEscape(vnfId)} + ${MsoUtils.xmlEscape(vnfName)} + ${MsoUtils.xmlEscape(volumeGroupId)} + ${MsoUtils.xmlEscape(volumeGroupName)} + ${MsoUtils.xmlEscape(volumeGroupHeatStackId)} + ${MsoUtils.xmlEscape(vnfType)} + ${MsoUtils.xmlEscape(vnfVersion)} + + ${MsoUtils.xmlEscape(modelCustomizationId)} + + + vnf_id + ${MsoUtils.xmlEscape(vnfId)} + + + vnf_name + ${MsoUtils.xmlEscape(vnfName)} + + + vf_module_id + ${MsoUtils.xmlEscape(volumeGroupId)} + + + vf_module_name + ${MsoUtils.xmlEscape(volumeGroupName)} + + ${volumeGroupParams} + + true + + ${MsoUtils.xmlEscape(requestId)} + ${MsoUtils.xmlEscape(serviceId)} + + ${MsoUtils.xmlEscape(messageId)} + ${MsoUtils.xmlEscape(notificationUrl)} + + """ + vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest) + execution.setVariable('UPDVfModVol_vnfAdapterRestRequest', vnfAdapterRestRequest) + msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest) + } + + /** + * Prepare a Request for updating the DB for this Infra request. + * + * @param execution The flow's execution instance. + */ + public void prepDbInfraDbRequest(DelegateExecution execution, isDebugLogEnabled) { + + def requestId = execution.getVariable('UPDVfModVol_requestId') + ExceptionUtil exceptionUtil = new ExceptionUtil(); + + String updateInfraRequest = """ + + + + + ${MsoUtils.xmlEscape(requestId)} + BPEL + COMPLETE + 100 + + + + """ + + updateInfraRequest = utils.formatXml(updateInfraRequest) + execution.setVariable('UPDVfModVol_updateInfraRequest', updateInfraRequest) + msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest) + } + + /** + * Build a "CompletionHandler" request. + * @param execution The flow's execution instance. + */ + public void prepCompletionHandlerRequest(DelegateExecution execution, requestId, action, source, isDebugLogEnabled) { + + String content = """ + + + ${MsoUtils.xmlEscape(requestId)} + UPDATE + ${MsoUtils.xmlEscape(source)} + + BPMN VF Module Volume action: UPDATE + + """ + + content = utils.formatXml(content) + msoLogger.debug('Request for Completion Handler:\n' + content) + execution.setVariable('UPDVfModVol_CompletionHandlerRequest', content) + } + + + /** + * Build a "FalloutHandler" request. + * @param execution The flow's execution instance. + */ + public void prepFalloutHandler(DelegateExecution execution, isDebugLogEnabled) { + def requestId = execution.getVariable('UPDVfModVol_requestId') + def source = execution.getVariable('UPDVfModVol_source') + + String requestInfo = """ + + ${MsoUtils.xmlEscape(requestId)} + UPDATE + ${MsoUtils.xmlEscape(source)} + """ + + def WorkflowException workflowException = execution.getVariable("WorkflowException") + def errorResponseCode = workflowException.getErrorCode() + def errorResponseMsg = workflowException.getErrorMessage() + def encErrorResponseMsg = "" + if (errorResponseMsg != null) { + encErrorResponseMsg = errorResponseMsg + } + + String content = """ + + ${requestInfo} + + ${MsoUtils.xmlEscape(encErrorResponseMsg)} + ${MsoUtils.xmlEscape(errorResponseCode)} + + + """ + content = utils.formatXml(content) + msoLogger.debug('Request for Fallout Handler:\n' + content) + execution.setVariable('UPDVfModVol_FalloutHandlerRequest', content) + } + + /** + * Create a WorkflowException for the error case where the Tenant Id from + * AAI did not match the Tenant Id in the incoming request. + * @param execution The flow's execution instance. + */ + public void handleTenantIdMismatch(DelegateExecution execution, isDebugLogEnabled) { + + def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') + def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') + def tenantId = execution.getVariable('UPDVfModVol_tenantId') + def volumeGroupTenantId = execution.getVariable('UPDVfModVol_volumeGroupTenantId') + + def String errorMessage = "TenantId " + tenantId + " in incoming request does not match Tenant Id " + volumeGroupTenantId + + " retrieved from AAI for Volume Group Id " + volumeGroupId + ", AIC Cloud Region " + aicCloudRegion + + ExceptionUtil exceptionUtil = new ExceptionUtil() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception"); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) + } + + /** + * Create a WorkflowException for the error case where the Personal Model Id from + * AAI did not match the model invariant ID in the incoming request. + * @param execution The flow's execution instance. + */ + public void handlePersonaModelIdMismatch(DelegateExecution execution, isDebugLogEnabled) { + + def modelInvariantId = execution.getVariable('UPDVfModVol_modelInvariantId') + def personaModelId = execution.getVariable('UPDVfModVol_personaModelId') + + def String errorMessage = "Model Invariant ID " + modelInvariantId + " in incoming request does not match persona model ID " + personaModelId + + " retrieved from AAI for Volume Group Id " + + ExceptionUtil exceptionUtil = new ExceptionUtil() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception"); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy new file mode 100644 index 0000000000..f251dc46f8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy @@ -0,0 +1,481 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.appc.client.lcm.model.Action; +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.* +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +import groovy.json.JsonOutput +import groovy.json.JsonSlurper + +public class UpdateVnfInfra extends VnfCmBase { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVnfInfra.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtils = new JsonUtils() + def prefix = "UPDVnfI_" + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'UPDVnfI_') + execution.setVariable('Request', null) + execution.setVariable('source', null) + execution.setVariable('vnfInputs', null) + execution.setVariable('tenantId', null) + execution.setVariable('vnfParams', null) + execution.setVariable('controllerType', null) + execution.setVariable('UpdateVnfSuccessIndicator', false) + execution.setVariable('serviceType', null) + execution.setVariable('nfRole', null) + execution.setVariable('currentActivity', 'UPDVnfI') + execution.setVariable('workStep', null) + execution.setVariable('failedActivity', null) + execution.setVariable('errorCode', "0") + execution.setVariable('errorText', null) + execution.setVariable('healthCheckIndex0', 0) + execution.setVariable('healthCheckIndex1', 1) + execution.setVariable("rollbackSetClosedLoopDisabledFlag", false) + execution.setVariable("rollbackVnfStop", false) + execution.setVariable("rollbackVnfLock", false) + execution.setVariable("rollbackQuiesceTraffic", false) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", false) + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + initProcessVariables(execution) + + msoLogger.trace('Entered ' + method) + + initProcessVariables(execution) + + def incomingRequest = execution.getVariable('bpmnRequest') + + msoLogger.debug("Incoming Infra Request: " + incomingRequest) + try { + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + Map reqMap = jsonSlurper.parseText(incomingRequest) + msoLogger.debug(" Request is in JSON format.") + + execution.setVariable("isVidRequest", "true") + execution.setVariable('serviceType', 'Mobility') + execution.setVariable('actionLock', Action.Lock) + execution.setVariable('actionUnlock', Action.Unlock) + execution.setVariable('actionHealthCheck', Action.HealthCheck) + execution.setVariable('actionStart', Action.Start) + execution.setVariable('actionStop', Action.Stop) + + def asdcServiceModelVersion = '' + def serviceModelInfo = null + + def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList + + if (relatedInstanceList != null) { + relatedInstanceList.each { + if (it.relatedInstance.modelInfo?.modelType == 'service') { + msoLogger.debug("PROCESSING SERVICE INFO") + asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion + serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) + msoLogger.debug("ServiceModelInfo: " + serviceModelInfo) + def modelInvariant = jsonUtils.getJsonValue(serviceModelInfo, "modelInvariantUuid") + msoLogger.debug("modelInvariant: " + modelInvariant) + } + + } + } + + execution.setVariable('asdcServiceModelVersion', asdcServiceModelVersion) + execution.setVariable('serviceModelInfo', serviceModelInfo) + def vnfModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo) + execution.setVariable('vnfModelInfo', vnfModelInfo) + def vnfModelInvariantUuid = jsonUtils.getJsonValue(vnfModelInfo, "modelInvariantUuid") + execution.setVariable('vnfModelInvariantUuid', vnfModelInvariantUuid) + msoLogger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid) + + def vnfType = execution.getVariable('vnfType') + execution.setVariable('vnfType', vnfType) + + + def controllerType = reqMap.requestDetails?.requestParameters?.controllerType + execution.setVariable('controllerType', controllerType) + + msoLogger.debug('Controller Type: ' + controllerType) + + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map userParamsMap = [:] + if (userParams != null) { + userParams.each { userParam -> + userParamsMap.put(userParam.name, userParam.value.toString()) + } + } + + msoLogger.debug('Processed user params: ' + userParamsMap) + + execution.setVariable('vfModuleInputParams', userParamsMap) + + def requestId = execution.getVariable("mso-request-id") + execution.setVariable('requestId', requestId) + execution.setVariable('msoRequestId', requestId) + + + def vnfName = reqMap.requestDetails?.requestInfo?.instanceName ?: null + execution.setVariable('vnfName', vnfName) + + def requestorId = reqMap.requestDetails?.requestInfo?.requestorId ?: null + execution.setVariable('requestorId', requestorId) + + def usePreload = reqMap.requestDetails?.requestParameters?.usePreload + execution.setVariable('usePreload', usePreload) + + def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration + def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId + execution.setVariable('lcpCloudRegionId', lcpCloudRegionId) + def tenantId = cloudConfiguration.tenantId + execution.setVariable('tenantId', tenantId) + + def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: '' + execution.setVariable('globalSubscriberId', globalSubscriberId) + + execution.setVariable('sdncVersion', '1702') + + execution.setVariable("UpdateVnfInfraSuccessIndicator", false) + + + + def source = reqMap.requestDetails?.requestInfo?.source + execution.setVariable("source", source) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + UPDATE + ${MsoUtils.xmlEscape(source)} + """ + + execution.setVariable("requestInfo", requestInfo) + + msoLogger.debug('RequestInfo: ' + execution.getVariable("requestInfo")) + + msoLogger.trace('Exited ' + method) + + } + catch(groovy.json.JsonException je) { + msoLogger.debug(" Request is not in JSON format.") + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") + + } + catch(Exception e) { + String restFaultMessage = e.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) + } + } + + /** + * Prepare and send the sychronous response for this flow. + * + * @param execution The flow's execution instance. + */ + public void sendSynchResponse(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendSynchResponse(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + + try { + def requestInfo = execution.getVariable('requestInfo') + def requestId = execution.getVariable('requestId') + def source = execution.getVariable('source') + def progress = getNodeTextForce(requestInfo, 'progress') + if (progress.isEmpty()) { + progress = '0' + } + def startTime = getNodeTextForce(requestInfo, 'start-time') + if (startTime.isEmpty()) { + startTime = System.currentTimeMillis() + } + + // RESTResponse (for API Handler (APIH) Reply Task) + def vnfId = execution.getVariable("vnfId") + String synchResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() + + sendWorkflowResponse(execution, 200, synchResponse) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) + } + } + + + + /** + * Get VnfResource decomposition object for this VNF. + * + * + * @param execution The flow's execution instance. + */ + public void getVnfResourceDecomposition(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.getVnfResourceDecomposition(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid') + msoLogger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid) + List vnfResources = serviceDecomposition.getVnfResources() + + for (i in 0..vnfResources.size()-1) { + ModelInfo modelInfo = vnfResources[i].getModelInfo() + String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid() + msoLogger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition) + + if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { + VnfResource vnfResourceDecomposition = vnfResources[i] + execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition) + def nfRole = vnfResourceDecomposition.getNfRole() + execution.setVariable('nfRole', nfRole) + msoLogger.debug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString()) + break + } + else { + //exception! + } + + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage()) + } + } + + /** + * Check if this VNF is already in maintenance in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfVnfInMaintInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + execution.setVariable("workStep", "checkIfVnfInMaintInAAI") + execution.setVariable("failedActivity", "AAI") + msoLogger.trace('Entered ' + method) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIValidatorImpl aaiValidator = new AAIValidatorImpl() + aaiValidator.setClient(client) + def vnfId = execution.getVariable("vnfId") + boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid) + msoLogger.debug("isInMaint result: " + isInMaint) + execution.setVariable('isVnfInMaintenance', isInMaint) + + if (isInMaint) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "VNF is in maintenance in A&AI") + } + + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) + } + } + + + /** + * Check if this VNF's pservers are locked in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfPserversInMaintInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + execution.setVariable("workStep", "checkIfPserversInMaintInAAI") + execution.setVariable("failedActivity", "AAI") + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIValidatorImpl aaiValidator = new AAIValidatorImpl() + aaiValidator.setClient(client) + def vnfId = execution.getVariable("vnfId") + boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid) + msoLogger.debug("areLocked result: " + areLocked) + execution.setVariable('arePserversLocked', areLocked) + + if (areLocked) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "pServers are locked in A&AI") + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) + } + } + + /** + * Set inMaint flag for this VNF to the specified value in A&AI. + * + * + * @param execution The flow's execution instance. + * @param inMaint The boolean value of the flag to set + */ + public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) { + def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + if (inMaint) { + execution.setVariable("workStep", "setVnfInMaintFlagInAAI") + } + else { + execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI") + } + execution.setVariable("failedActivity", "AAI") + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIUpdatorImpl aaiUpdator = new AAIUpdatorImpl() + aaiUpdator.setClient(client) + def vnfId = execution.getVariable("vnfId") + if (inMaint) { + aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) + } + else { + aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid) + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage()) + } + } + + + + /** + * Prepare DoUpdateVnfAndModules call. + * + * + * @param execution The flow's execution instance. + */ + public void prepDoUpdateVnfAndModules(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepDoUpdateVnfAndModules(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + execution.setVariable("workStep", "doUpdateVnfAndModules") + execution.setVariable("failedActivity", "MSO Update VNF") + msoLogger.trace('Exited ' + method) + + } + + + /** + * Handle Abort disposition from RainyDayHandler + * + * @param execution The flow's execution instance. + */ + public void abortProcessing(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.abortProcessing(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + def errorText = execution.getVariable("errorText") + def errorCode = execution.getVariable("errorCode") + + exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText) + } + + + + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy new file mode 100644 index 0000000000..fd9d9cc8a3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy @@ -0,0 +1,835 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray +import org.json.JSONObject +import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.ActionIdentifiers +import org.onap.appc.client.lcm.model.Flags +import org.onap.appc.client.lcm.model.Status +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.* +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.Relationships +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.client.appc.ApplicationControllerClient; +import org.onap.so.client.appc.ApplicationControllerSupport; +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +import groovy.json.JsonSlurper + +public abstract class VnfCmBase extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfCmBase.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtils = new JsonUtils() + def prefix = "VnfIPU_" + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + + /** + * Prepare and send the sychronous response for this flow. + * + * @param execution The flow's execution instance. + */ + public void sendSynchResponse(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendSynchResponse(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + + try { + def requestInfo = execution.getVariable('requestInfo') + def requestId = execution.getVariable('requestId') + def source = execution.getVariable('source') + def progress = getNodeTextForce(requestInfo, 'progress') + if (progress.isEmpty()) { + progress = '0' + } + def startTime = getNodeTextForce(requestInfo, 'start-time') + if (startTime.isEmpty()) { + startTime = System.currentTimeMillis() + } + + // RESTResponse (for API Handler (APIH) Reply Task) + def vnfId = execution.getVariable("vnfId") + String synchResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() + + sendWorkflowResponse(execution, 200, synchResponse) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) + } + } + + + + /** + * Get VnfResource decomposition object for this VNF. + * + * + * @param execution The flow's execution instance. + */ + public void getVnfResourceDecomposition(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.getVnfResourceDecomposition(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid') + msoLogger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid) + List vnfResources = serviceDecomposition.getVnfResources() + + for (i in 0..vnfResources.size()-1) { + ModelInfo modelInfo = vnfResources[i].getModelInfo() + String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid() + msoLogger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition) + + if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { + VnfResource vnfResourceDecomposition = vnfResources[i] + execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition) + def nfRole = vnfResourceDecomposition.getNfRole() + execution.setVariable('nfRole', nfRole) + msoLogger.debug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString()) + break + } + else { + //exception! + } + + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage()) + } + } + + /** + * Check if this VNF is already in maintenance in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfVnfInMaintInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + execution.setVariable("workStep", "checkIfVnfInMaintInAAI") + execution.setVariable("failedActivity", "AAI") + msoLogger.trace('Entered ' + method) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIValidatorImpl aaiValidator = new AAIValidatorImpl() + aaiValidator.setClient(client) + def vnfId = execution.getVariable("vnfId") + boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid) + msoLogger.debug("isInMaint result: " + isInMaint) + execution.setVariable('isVnfInMaintenance', isInMaint) + + if (isInMaint) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "VNF is in maintenance in A&AI") + } + + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) + } + } + + /** + * Get VNF info from A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void queryAAIForVnf(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.queryAAIForVnf(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + def vnfId = execution.getVariable("vnfId") + msoLogger.debug("vnfId is: " + vnfId) + def cloudRegionId = execution.getVariable("lcpCloudRegionId") + msoLogger.debug("cloudRegionId is: " + cloudRegionId) + + AAIResourcesClient client = new AAIResourcesClient() + AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + // Check if this VNF exists + if (!client.exists(genericVnfUri)) { + msoLogger.debug("VNF with vnfId " + vnfId + " does not exist in A&AI") + exceptionUtil.buildAndThrowWorkflowException(execution, 404, "VNF with vnfId " + vnfId + " does not exist in A&AI") + } + + AAIResultWrapper aaiRW = client.get(genericVnfUri) + + Map result = aaiRW.asMap() + + String vnfName = result.get("vnf-name") + msoLogger.debug("vnfName from A&AI is: " + vnfName) + execution.setVariable("vnfName", vnfName) + String nfRole = result.get("nf-role") + msoLogger.debug("nfRole from A&AI is: " + nfRole) + execution.setVariable("nfRole", nfRole) + String vnfHostIpAddress = result.get("ipv4-oam-address") + msoLogger.debug("vnfHostIpAddress from A&AI is: " + vnfHostIpAddress) + execution.setVariable("vnfHostIpAddress", vnfHostIpAddress) + execution.setVariable("vmIdList", null) + if (aaiRW.getRelationships() != null) { + Relationships relationships = aaiRW.getRelationships().get() + if (relationships != null) { + + List vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER) + JSONArray vserverIds = new JSONArray() + JSONArray vserverSelfLinks = new JSONArray() + + for (AAIResourceUri j in vserverUris) { + + String vserverId = j.getURIKeys().get('vserver-id') + String vserverJson = client.get(j).getJson() + msoLogger.debug("Retrieved vserverJson from AAI: " + vserverJson) + String vserverSelfLink = jsonUtils.getJsonValue(vserverJson, "vserver-selflink") + + vserverIds.put(vserverId) + vserverSelfLinks.put(vserverSelfLink) + } + + JSONObject vmidsArray = new JSONObject() + JSONObject vserveridsArray = new JSONObject() + vmidsArray.put("vmIds", vserverSelfLinks.toString()) + vserveridsArray.put("vserverIds", vserverIds.toString()) + + msoLogger.debug("vmidsArray is: " + vmidsArray.toString()) + msoLogger.debug("vserveridsArray is: " + vserveridsArray.toString()) + + execution.setVariable("vmIdList", vmidsArray.toString()) + execution.setVariable("vserverIdList", vserveridsArray.toString()) + } + } + + if (cloudRegionId != null) { + AAIUri cloudRegionUri = AAIUriFactory.createResourceUri(AAIObjectType.DEFAULT_CLOUD_REGION, cloudRegionId) + // Check if this client region exists + if (!client.exists(cloudRegionUri)) { + msoLogger.debug("Cloud Region with cloudRegionId " + cloudRegionId + " does not exist in A&AI") + exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Cloud Region with cloudRegionId " + cloudRegionId + " does not exist in A&AI") + } + + AAIResultWrapper aaiRWCloud = client.get(cloudRegionUri) + + Map resultCloud = aaiRWCloud.asMap() + + String aicIdentity = resultCloud.get("identity-url") + msoLogger.debug("aicIdentity from A&AI is: " + aicIdentity) + execution.setVariable("aicIdentity", aicIdentity) + } + // preserve relationships if exist + Optional relationships = aaiRW.getRelationships() + + if(relationships.isPresent()) { + msoLogger.debug("relationships are present") + String rs = relationships.get().getJson() + def jsonSlurper = new JsonSlurper() + def map = jsonSlurper.parseText(rs) + if (map instanceof Map) { + List> relationshipsList = (List>)map.get("relationship"); + for (Map relationship : relationshipsList) { + final String relatedTo = (String)relationship.get("related-to"); + if (relatedTo.equals("platform")) { + List> relationshipDataList = (List>)relationship.get("relationship-data") + msoLogger.debug("Found platform entry") + for (Map relationshipData : relationshipDataList) { + String relationshipKey = (String)relationshipData.get("relationship-key"); + if (relationshipKey.equals("platform.platform-name")) { + String platformName = (String) relationshipData.get("relationship-value") + msoLogger.debug("platform from A&AI is: " + platformName) + execution.setVariable("platform", platformName) + break + } + } + } + if (relatedTo.equals("line-of-business")) { + List> relationshipDataList = (List>)relationship.get("relationship-data") + msoLogger.debug("Found line-of-business entry") + for (Map relationshipData : relationshipDataList) { + String relationshipKey = (String)relationshipData.get("relationship-key"); + if (relationshipKey.equals("line-of-business.line-of-business-name")) { + String lineOfBusinessName = (String) relationshipData.get("relationship-value") + msoLogger.debug("lineOfBusiness from A&AI is: " + lineOfBusinessName) + execution.setVariable("lineOfBusiness", lineOfBusinessName) + break + } + } + } + } + + } + + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVnf(): ' + e.getMessage()) + } + } + + + + /** + * Check if this VNF's pservers are locked in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfPserversInMaintInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + execution.setVariable("workStep", "checkIfPserversInMaintInAAI") + execution.setVariable("failedActivity", "AAI") + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIValidatorImpl aaiValidator = new AAIValidatorImpl() + aaiValidator.setClient(client) + def vnfId = execution.getVariable("vnfId") + boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid) + msoLogger.debug("areLocked result: " + areLocked) + execution.setVariable('arePserversLocked', areLocked) + + if (areLocked) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "pServers are locked in A&AI") + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) + } + } + + /** + * Set inMaint flag for this VNF to the specified value in A&AI. + * + * + * @param execution The flow's execution instance. + * @param inMaint The boolean value of the flag to set + */ + public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) { + def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + if (inMaint) { + execution.setVariable("workStep", "setVnfInMaintFlagInAAI") + } + else { + execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI") + } + execution.setVariable("failedActivity", "AAI") + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIUpdatorImpl aaiUpdator = new AAIUpdatorImpl() + aaiUpdator.setClient(client) + def vnfId = execution.getVariable("vnfId") + if (inMaint) { + aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) + } + else { + aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid) + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage()) + } + } + + /** + * Check if VF Closed Loop Disabled in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfClosedLoopDisabledInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfClosedLoopDisabledInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + execution.setVariable("workStep", "checkClosedLoopDisabledFlagInAAI") + execution.setVariable("failedActivity", "AAI") + msoLogger.trace('Entered ' + method) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + def vnfId = execution.getVariable("vnfId") + msoLogger.debug("vnfId is: " + vnfId) + AAIResourcesClient client = new AAIResourcesClient() + AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResultWrapper aaiRW = client.get(genericVnfUri) + Map result = aaiRW.asMap() + boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false) + + msoLogger.debug("isClosedLoopDisabled result: " + isClosedLoopDisabled) + execution.setVariable('isClosedLoopDisabled', isClosedLoopDisabled) + + if (isClosedLoopDisabled) { + execution.setVariable("errorCode", "1004") + execution.setVariable("errorText", "closedLoop is disabled in A&AI") + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + } + } + + /** + * Set VF Closed Loop Disabled Flag in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void setClosedLoopDisabledInAAI(DelegateExecution execution, boolean setDisabled) { + def method = getClass().getSimpleName() + '.setClosedLoopDisabledInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + if (setDisabled) { + execution.setVariable("workStep", "setClosedLoopDisabledFlagInAAI") + execution.setVariable("rollbackSetClosedLoopDisabledFlag", true) + } + else { + execution.setVariable("workStep", "unsetClosedLoopDisabledFlagInAAI") + execution.setVariable("rollbackSetClosedLoopDisabledFlag", false) + } + + execution.setVariable("failedActivity", "AAI") + msoLogger.trace('Entered ' + method) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + def vnfId = execution.getVariable("vnfId") + AAIResourcesClient client = new AAIResourcesClient() + AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + + Map request = new HashMap<>() + request.put("is-closed-loop-disabled", setDisabled) + client.update(genericVnfUri, request) + msoLogger.debug("set isClosedLoop to: " + setDisabled) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + } + } + + + + + /** + * Call APP-C client to execute specified APP-C command for this VNF. + * + * + * @param execution The flow's execution instance. + * @param action The action to take in APP-C. + */ + public void runAppcCommand(DelegateExecution execution, Action action) { + def method = getClass().getSimpleName() + '.runAppcCommand(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + + ApplicationControllerClient appcClient = null + + try { + msoLogger.debug("Running APP-C action: " + action.toString()) + String vnfId = execution.getVariable('vnfId') + String msoRequestId = execution.getVariable('requestId') + execution.setVariable('msoRequestId', msoRequestId) + execution.setVariable("failedActivity", "APP-C") + + appcClient = new ApplicationControllerClient() + ApplicationControllerSupport support = new ApplicationControllerSupport() + appcClient.appCSupport=support + org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage", "org.onap.appc.client.lcm.model"); + Flags flags = new Flags(); + ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); + actionIdentifiers.setVnfId(vnfId); + Status appcStatus + switch(action) { + case Action.Lock: + execution.setVariable('workStep', "LockVNF") + appcStatus = appcClient.runCommand(Action.Lock,actionIdentifiers,null,msoRequestId) + break + case Action.Unlock: + execution.setVariable('workStep', "UnlockVNF") + appcStatus = appcClient.runCommand(Action.Unlock,actionIdentifiers,null,msoRequestId) + break + case Action.HealthCheck: + def healthCheckIndex = execution.getVariable('healthCheckIndex') + execution.setVariable('workStep', "HealthCheckVNF" + healthCheckIndex) + execution.setVariable('healthCheckIndex', healthCheckIndex + 1) + appcStatus = appcClient.runCommand(Action.HealthCheck,actionIdentifiers,null,msoRequestId) + break + case Action.Start: + execution.setVariable('workStep', "StartVNF") + appcStatus = appcClient.runCommand(Action.Start,actionIdentifiers,null,msoRequestId) + break + case Action.Stop: + execution.setVariable('workStep', "StopVNF") + appcStatus = appcClient.runCommand(Action.Stop,actionIdentifiers,null,msoRequestId) + break + default: + break + } + msoLogger.debug("Completed AppC request") + int appcCode = appcStatus.getCode() + msoLogger.debug("AppC status code is: " + appcCode) + msoLogger.debug("AppC status message is: " + appcStatus.getMessage()) + if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) { + execution.setVariable("errorCode", Integer.toString(appcCode)) + execution.setVariable("errorText", appcStatus.getMessage()) + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + + } catch (java.lang.NoSuchMethodError e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + + } + } + + /** + * Placeholder for a call to APP-C client to execute specified APP-C command for this VNF. + * + * + * @param execution The flow's execution instance. + * @param action The action to take in APP-C. + */ + public void runAppcCommandPlaceholder(DelegateExecution execution, String action) { + def method = getClass().getSimpleName() + '.runAppcCommandPlaceholder(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + execution.setVariable("failedActivity", "APP-C") + execution.setVariable("workStep", action) + } + + + + + + + + /** + * Builds a "CompletionHandler" request and stores it in the specified execution variable. + * + * @param execution the execution + * @param resultVar the execution variable in which the result will be stored + */ + public void completionHandlerPrep(DelegateExecution execution, String resultVar) { + def method = getClass().getSimpleName() + '.completionHandlerPrep(' + + 'execution=' + execution.getId() + + ', resultVar=' + resultVar + + ')' + + msoLogger.trace('Entered ' + method) + + try { + + def requestInfo = execution.getVariable('requestInfo') + + String content = """ + + ${requestInfo} + Vnf has been updated successfully. + MSO_ACTIVATE_BPEL + + """ + + content = utils.formatXml(content) + msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + execution.setVariable(resultVar, content) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') + } + } + + /** + * Prepare DoUpdateVnfAndModules call. + * + * + * @param execution The flow's execution instance. + */ + public void prepDoUpdateVnfAndModules(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepDoUpdateVnfAndModules(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + execution.setVariable("workStep", "doUpdateVnfAndModules") + execution.setVariable("failedActivity", "MSO Update VNF") + msoLogger.trace('Exited ' + method) + + } + + /** + * Builds a "FalloutHandler" request and stores it in the specified execution variable. + * + * @param execution the execution + * @param resultVar the execution variable in which the result will be stored + */ + public void falloutHandlerPrep(DelegateExecution execution, String resultVar) { + def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + + 'execution=' + execution.getId() + + ', resultVar=' + resultVar + + ')' + + msoLogger.trace('Entered ' + method) + + try { + def prefix = execution.getVariable('prefix') + def requestInformation = execution.getVariable("requestInfo") + + def WorkflowException workflowException = execution.getVariable("WorkflowException") + def errorResponseCode = workflowException.getErrorCode() + def errorResponseMsg = workflowException.getErrorMessage() + def encErrorResponseMsg = "" + if (errorResponseMsg != null) { + encErrorResponseMsg = errorResponseMsg + } + + String content = """ + + ${requestInformation} + + ${MsoUtils.xmlEscape(encErrorResponseMsg)} + ${MsoUtils.xmlEscape(errorResponseCode)} + + + """ + content = utils.formatXml(content) + msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + execution.setVariable(resultVar, content) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') + } + } + + /** + * Handle Abort disposition from RainyDayHandler + * + * @param execution The flow's execution instance. + */ + public void abortProcessing(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.abortProcessing(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + def errorText = execution.getVariable("errorText") + def errorCode = execution.getVariable("errorCode") + + exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText) + } + + /** + * Increment Retry Count for Current Work Step + * + * @param execution The flow's execution instance. + */ + public void incrementRetryCount(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.incrementRetryCount(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + String retryCountVariableName = execution.getVariable("workStep") + "RetryCount" + execution.setVariable("retryCountVariableName", retryCountVariableName) + + def retryCountVariable = execution.getVariable(retryCountVariableName) + int retryCount = 0 + + if (retryCountVariable != null) { + retryCount = (int) retryCountVariable + } + + retryCount += 1 + + execution.setVariable(retryCountVariableName, retryCount) + + msoLogger.debug("value of " + retryCountVariableName + " is " + retryCount) + msoLogger.trace('Exited ' + method) + + + } + + + public void preProcessRollback (DelegateExecution execution) { + msoLogger.trace("preProcessRollback ") + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage()) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + msoLogger.debug("BPMN Error during preProcessRollback") + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + msoLogger.debug(msg) + } + msoLogger.trace("Exit preProcessRollback ") + } + + public void postProcessRollback (DelegateExecution execution) { + msoLogger.trace("postProcessRollback ") + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + msoLogger.debug("Setting prevException to WorkflowException: ") + execution.setVariable("WorkflowException", workflowException); + } + + } catch (BpmnError b) { + msoLogger.debug("BPMN Error during postProcessRollback") + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + msoLogger.debug(msg) + } + msoLogger.trace("Exit postProcessRollback ") + } + + + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy new file mode 100644 index 0000000000..8ca2871916 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy @@ -0,0 +1,483 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.appc.client.lcm.model.Action; +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.* +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +import groovy.json.JsonOutput +import groovy.json.JsonSlurper + +public class VnfConfigUpdate extends VnfCmBase { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfConfigUpdate.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtils = new JsonUtils() + def prefix = "VnfIPU_" + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'VnfCU_') + execution.setVariable('Request', null) + execution.setVariable('source', null) + execution.setVariable('controllerType', null) + execution.setVariable('UpdateVnfSuccessIndicator', false) + execution.setVariable('serviceType', null) + execution.setVariable('nfRole', null) + execution.setVariable('currentActivity', 'VnfCU') + execution.setVariable('workStep', null) + execution.setVariable('failedActivity', null) + execution.setVariable('errorCode', "0") + execution.setVariable('errorText', null) + execution.setVariable('healthCheckIndex0', 0) + execution.setVariable('healthCheckIndex1', 1) + execution.setVariable('maxRetryCount', 3) + execution.setVariable('retryCount', 0) + execution.setVariable("lcpCloudRegionId", null) + execution.setVariable("rollbackSetClosedLoopDisabledFlag", false) + execution.setVariable("rollbackVnfStop", false) + execution.setVariable("rollbackVnfLock", false) + execution.setVariable("rollbackQuiesceTraffic", false) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", false) + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + initProcessVariables(execution) + + msoLogger.trace('Entered ' + method) + + initProcessVariables(execution) + + def incomingRequest = execution.getVariable('bpmnRequest') + + msoLogger.debug("Incoming Infra Request: " + incomingRequest) + try { + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + Map reqMap = jsonSlurper.parseText(incomingRequest) + msoLogger.debug(" Request is in JSON format.") + + def serviceInstanceId = execution.getVariable('serviceInstanceId') + def vnfId = execution.getVariable('vnfId') + + execution.setVariable('serviceInstanceId', serviceInstanceId) + execution.setVariable('vnfId', vnfId) + execution.setVariable('serviceType', 'Mobility') + execution.setVariable('payload', "") + execution.setVariable('actionHealthCheck', Action.HealthCheck) + execution.setVariable('actionConfigModify', Action.ConfigModify) + + + def controllerType = reqMap.requestDetails?.requestParameters?.controllerType + execution.setVariable('controllerType', controllerType) + + msoLogger.debug('Controller Type: ' + controllerType) + + def payload = reqMap.requestDetails?.requestParameters?.payload + execution.setVariable('payload', payload) + + msoLogger.debug('Processed payload: ' + payload) + + def requestId = execution.getVariable("mso-request-id") + execution.setVariable('requestId', requestId) + execution.setVariable('msoRequestId', requestId) + + def requestorId = reqMap.requestDetails?.requestInfo?.requestorId ?: null + execution.setVariable('requestorId', requestorId) + + execution.setVariable('sdncVersion', '1702') + + execution.setVariable("UpdateVnfInfraSuccessIndicator", false) + + + + def source = reqMap.requestDetails?.requestInfo?.source + execution.setVariable("source", source) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + UPDATE + ${MsoUtils.xmlEscape(source)} + """ + + execution.setVariable("requestInfo", requestInfo) + + msoLogger.debug('RequestInfo: ' + execution.getVariable("requestInfo")) + + msoLogger.trace('Exited ' + method) + + } + catch(groovy.json.JsonException je) { + msoLogger.debug(" Request is not in JSON format.") + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") + + } + catch(Exception e) { + String restFaultMessage = e.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) + } + } + + /** + * Prepare and send the sychronous response for this flow. + * + * @param execution The flow's execution instance. + */ + public void sendSynchResponse(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendSynchResponse(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + + try { + def requestInfo = execution.getVariable('requestInfo') + def requestId = execution.getVariable('requestId') + def source = execution.getVariable('source') + def progress = getNodeTextForce(requestInfo, 'progress') + if (progress.isEmpty()) { + progress = '0' + } + def startTime = getNodeTextForce(requestInfo, 'start-time') + if (startTime.isEmpty()) { + startTime = System.currentTimeMillis() + } + + // RESTResponse (for API Handler (APIH) Reply Task) + def vnfId = execution.getVariable("vnfId") + String synchResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() + + sendWorkflowResponse(execution, 200, synchResponse) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) + } + } + + + /** + * Check if this VNF is already in maintenance in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfVnfInMaintInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + execution.setVariable("workStep", "checkIfVnfInMaintInAAI") + execution.setVariable("failedActivity", "AAI") + msoLogger.trace('Entered ' + method) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIValidatorImpl aaiValidator = new AAIValidatorImpl() + aaiValidator.setClient(client) + def vnfId = execution.getVariable("vnfId") + boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid) + msoLogger.debug("isInMaint result: " + isInMaint) + execution.setVariable('isVnfInMaintenance', isInMaint) + + if (isInMaint) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "VNF is in maintenance in A&AI") + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) + } + } + + + /** + * Check if this VNF's pservers are locked in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfPserversInMaintInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + execution.setVariable("workStep", "checkIfPserversInMaintInAAI") + execution.setVariable("failedActivity", "AAI") + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIValidatorImpl aaiValidator = new AAIValidatorImpl() + aaiValidator.setClient(client) + def vnfId = execution.getVariable("vnfId") + boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid) + msoLogger.debug("areLocked result: " + areLocked) + execution.setVariable('arePserversLocked', areLocked) + + if (areLocked) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "pServers are locked in A&AI") + } + + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) + } + } + + /** + * Set inMaint flag for this VNF to the specified value in A&AI. + * + * + * @param execution The flow's execution instance. + * @param inMaint The boolean value of the flag to set + */ + public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) { + def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + if (inMaint) { + execution.setVariable("workStep", "setVnfInMaintFlagInAAI") + execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) + } + else { + execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI") + } + execution.setVariable("failedActivity", "AAI") + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIUpdatorImpl aaiUpdator = new AAIUpdatorImpl() + aaiUpdator.setClient(client) + def vnfId = execution.getVariable("vnfId") + if (inMaint) { + aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) + } + else { + aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid) + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage()) + } + } + + /** + * Check if VF Closed Loop Disabled in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfClosedLoopDisabledInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfClosedLoopDisabledInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + execution.setVariable("workStep", "checkClosedLoopDisabledFlagInAAI") + execution.setVariable("failedActivity", "AAI") + msoLogger.trace('Entered ' + method) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + def vnfId = execution.getVariable("vnfId") + msoLogger.debug("vnfId is: " + vnfId) + AAIResourcesClient client = new AAIResourcesClient() + AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResultWrapper aaiRW = client.get(genericVnfUri) + Map result = aaiRW.asMap() + boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false) + + msoLogger.debug("isClosedLoopDisabled result: " + isClosedLoopDisabled) + execution.setVariable('isClosedLoopDisabled', isClosedLoopDisabled) + + if (isClosedLoopDisabled) { + execution.setVariable("errorCode", "1004") + execution.setVariable("errorText", "closedLoop is disabled in A&AI") + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) + } + } + + /** + * Set VF Closed Loop Disabled Flag in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void setClosedLoopDisabledInAAI(DelegateExecution execution, boolean setDisabled) { + def method = getClass().getSimpleName() + '.setClosedLoopDisabledInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + if (setDisabled) { + execution.setVariable("workStep", "setClosedLoopDisabledFlagInAAI") + execution.setVariable("rollbackSetClosedLoopDisabledFlag", true) + } + else { + execution.setVariable("workStep", "unsetClosedLoopDisabledFlagInAAI") + } + + execution.setVariable("failedActivity", "AAI") + msoLogger.trace('Entered ' + method) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + def vnfId = execution.getVariable("vnfId") + AAIResourcesClient client = new AAIResourcesClient() + AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + + Map request = new HashMap<>() + request.put("is-closed-loop-disabled", setDisabled) + client.update(genericVnfUri, request) + msoLogger.debug("set isClosedLoop to: " + setDisabled) + + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) + } + } + + + /** + * Handle Abort disposition from RainyDayHandler + * + * @param execution The flow's execution instance. + */ + public void abortProcessing(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.abortProcessing(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + def errorText = execution.getVariable("errorText") + def errorCode = execution.getVariable("errorCode") + + exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText) + } + + /** + * Increment Retry Count for Current Work Step + * + * @param execution The flow's execution instance. + */ + public void incrementRetryCount(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.incrementRetryCount(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + String retryCountVariableName = execution.getVariable("workStep") + "RetryCount" + execution.setVariable("retryCountVariableName", retryCountVariableName) + + def retryCountVariable = execution.getVariable(retryCountVariableName) + int retryCount = 0 + + if (retryCountVariable != null) { + retryCount = (int) retryCountVariable + } + + retryCount += 1 + + execution.setVariable(retryCountVariableName, retryCount) + + msoLogger.debug("value of " + retryCountVariableName + " is " + retryCount) + msoLogger.trace('Exited ' + method) + + + } + + + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy new file mode 100644 index 0000000000..68d5c19b80 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy @@ -0,0 +1,599 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.appc.client.lcm.model.Action +import org.onap.appc.client.lcm.model.ActionIdentifiers +import org.onap.appc.client.lcm.model.Flags +import org.onap.appc.client.lcm.model.Status +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.* +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.client.appc.ApplicationControllerClient; +import org.onap.so.client.appc.ApplicationControllerSupport; +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +import groovy.json.JsonOutput +import groovy.json.JsonSlurper + +public class VnfInPlaceUpdate extends VnfCmBase { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfInPlaceUpdate.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtils = new JsonUtils() + def prefix = "VnfIPU_" + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'VnfIPU_') + execution.setVariable('Request', null) + execution.setVariable('requestInfo', null) + execution.setVariable('source', null) + execution.setVariable('vnfInputs', null) + execution.setVariable('tenantId', null) + execution.setVariable('vnfParams', null) + execution.setVariable('controllerType', null) + execution.setVariable('UpdateVnfSuccessIndicator', false) + execution.setVariable('serviceType', null) + execution.setVariable('nfRole', null) + execution.setVariable('currentActivity', 'VnfIPU') + execution.setVariable('workStep', null) + execution.setVariable('failedActivity', null) + execution.setVariable('errorCode', "0") + execution.setVariable('errorText', null) + execution.setVariable('healthCheckIndex0', 0) + execution.setVariable('healthCheckIndex1', 1) + execution.setVariable('maxRetryCount', 3) + execution.setVariable("rollbackSetClosedLoopDisabledFlag", false) + execution.setVariable("rollbackVnfStop", false) + execution.setVariable("rollbackVnfLock", false) + execution.setVariable("rollbackQuiesceTraffic", false) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", false) + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + initProcessVariables(execution) + + msoLogger.trace('Entered ' + method) + + initProcessVariables(execution) + + def incomingRequest = execution.getVariable('bpmnRequest') + + msoLogger.debug("Incoming Infra Request: " + incomingRequest) + try { + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + Map reqMap = jsonSlurper.parseText(incomingRequest) + msoLogger.debug(" Request is in JSON format.") + + def serviceInstanceId = execution.getVariable('serviceInstanceId') + def vnfId = execution.getVariable('vnfId') + + execution.setVariable('serviceInstanceId', serviceInstanceId) + execution.setVariable('vnfId', vnfId) + execution.setVariable("isVidRequest", "true") + execution.setVariable('serviceType', 'Mobility') + execution.setVariable('payload', "") + execution.setVariable('actionSnapshot', Action.Snapshot) + execution.setVariable('actionLock', Action.Lock) + execution.setVariable('actionUnlock', Action.Unlock) + execution.setVariable('actionUpgradePreCheck', Action.UpgradePreCheck) + execution.setVariable('actionUpgradePostCheck', Action.UpgradePostCheck) + execution.setVariable('actionQuiesceTraffic', Action.QuiesceTraffic) + execution.setVariable('actionUpgradeBackup', Action.UpgradeBackup) + execution.setVariable('actionUpgradeSoftware', Action.UpgradeSoftware) + execution.setVariable('actionResumeTraffic', Action.ResumeTraffic) + + + def controllerType = reqMap.requestDetails?.requestParameters?.controllerType + execution.setVariable('controllerType', controllerType) + + msoLogger.debug('Controller Type: ' + controllerType) + + def payload = reqMap.requestDetails?.requestParameters?.payload + execution.setVariable('payload', payload) + + msoLogger.debug('Processed payload: ' + payload) + + + def requestId = execution.getVariable("mso-request-id") + execution.setVariable('requestId', requestId) + execution.setVariable('msoRequestId', requestId) + + def requestorId = reqMap.requestDetails?.requestInfo?.requestorId ?: null + execution.setVariable('requestorId', requestorId) + + def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration + def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId + execution.setVariable('lcpCloudRegionId', lcpCloudRegionId) + def tenantId = cloudConfiguration.tenantId + execution.setVariable('tenantId', tenantId) + + execution.setVariable("UpdateVnfInfraSuccessIndicator", false) + + + + def source = reqMap.requestDetails?.requestInfo?.source + execution.setVariable("source", source) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + UPDATE + ${MsoUtils.xmlEscape(source)} + """ + + execution.setVariable("requestInfo", requestInfo) + + msoLogger.debug('RequestInfo: ' + execution.getVariable("requestInfo")) + + msoLogger.trace('Exited ' + method) + + } + catch(groovy.json.JsonException je) { + msoLogger.debug(" Request is not in JSON format.") + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") + } + catch(Exception e) { + String restFaultMessage = e.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) + } + } + + /** + * Prepare and send the sychronous response for this flow. + * + * @param execution The flow's execution instance. + */ + public void sendSynchResponse(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendSynchResponse(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + + try { + def requestInfo = execution.getVariable('requestInfo') + def requestId = execution.getVariable('requestId') + def source = execution.getVariable('source') + def progress = getNodeTextForce(requestInfo, 'progress') + if (progress.isEmpty()) { + progress = '0' + } + def startTime = getNodeTextForce(requestInfo, 'start-time') + if (startTime.isEmpty()) { + startTime = System.currentTimeMillis() + } + + // RESTResponse (for API Handler (APIH) Reply Task) + def vnfId = execution.getVariable("vnfId") + String synchResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() + + sendWorkflowResponse(execution, 200, synchResponse) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) + } + } + + + /** + * Check if this VNF is already in maintenance in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfVnfInMaintInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + execution.setVariable("workStep", "checkIfVnfInMaintInAAI") + execution.setVariable("failedActivity", "AAI") + msoLogger.trace('Entered ' + method) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIValidatorImpl aaiValidator = new AAIValidatorImpl() + aaiValidator.setClient(client) + def vnfId = execution.getVariable("vnfId") + boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid) + msoLogger.debug("isInMaint result: " + isInMaint) + execution.setVariable('isVnfInMaintenance', isInMaint) + + if (isInMaint) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "VNF is in maintenance in A&AI") + } + + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) + } + } + + + /** + * Check if this VNF's pservers are locked in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfPserversInMaintInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + execution.setVariable("workStep", "checkIfPserversInMaintInAAI") + execution.setVariable("failedActivity", "AAI") + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIValidatorImpl aaiValidator = new AAIValidatorImpl() + aaiValidator.setClient(client) + def vnfId = execution.getVariable("vnfId") + boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid) + msoLogger.debug("areLocked result: " + areLocked) + execution.setVariable('arePserversLocked', areLocked) + + if (areLocked) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "pServers are locked in A&AI") + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) + } + } + + /** + * Set inMaint flag for this VNF to the specified value in A&AI. + * + * + * @param execution The flow's execution instance. + * @param inMaint The boolean value of the flag to set + */ + public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) { + def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + if (inMaint) { + execution.setVariable("workStep", "setVnfInMaintFlagInAAI") + } + else { + execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI") + } + execution.setVariable("failedActivity", "AAI") + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIUpdatorImpl aaiUpdator = new AAIUpdatorImpl() + aaiUpdator.setClient(client) + def vnfId = execution.getVariable("vnfId") + if (inMaint) { + aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) + } + else { + aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid) + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage()) + } + } + + /** + * Check if VF Closed Loop Disabled in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfClosedLoopDisabledInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfClosedLoopDisabledInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + execution.setVariable("workStep", "checkClosedLoopDisabledFlagInAAI") + execution.setVariable("failedActivity", "AAI") + msoLogger.trace('Entered ' + method) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + def vnfId = execution.getVariable("vnfId") + msoLogger.debug("vnfId is: " + vnfId) + AAIResourcesClient client = new AAIResourcesClient() + AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResultWrapper aaiRW = client.get(genericVnfUri) + Map result = aaiRW.asMap() + boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false) + + msoLogger.debug("isClosedLoopDisabled result: " + isClosedLoopDisabled) + execution.setVariable('isClosedLoopDisabled', isClosedLoopDisabled) + + if (isClosedLoopDisabled) { + execution.setVariable("errorCode", "1004") + execution.setVariable("errorText", "closedLoop is disabled in A&AI") + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + } + } + + /** + * Set VF Closed Loop Disabled Flag in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void setClosedLoopDisabledInAAI(DelegateExecution execution, boolean setDisabled) { + def method = getClass().getSimpleName() + '.setClosedLoopDisabledInAAI(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + if (setDisabled) { + execution.setVariable("workStep", "setClosedLoopDisabledFlagInAAI") + execution.setVariable("rollbackSetClosedLoopDisabledFlag", true) + } + else { + execution.setVariable("workStep", "unsetClosedLoopDisabledFlagInAAI") + } + + execution.setVariable("failedActivity", "AAI") + msoLogger.trace('Entered ' + method) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + def vnfId = execution.getVariable("vnfId") + AAIResourcesClient client = new AAIResourcesClient() + AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + + Map request = new HashMap<>() + request.put("is-closed-loop-disabled", setDisabled) + client.update(genericVnfUri, request) + msoLogger.debug("set isClosedLoop to: " + setDisabled) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + } + } + + + + + /** + * Call APP-C client to execute specified APP-C command for this VNF. + * + * + * @param execution The flow's execution instance. + * @param action The action to take in APP-C. + */ + public void runAppcCommand(DelegateExecution execution, Action action) { + def method = getClass().getSimpleName() + '.runAppcCommand(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + + ApplicationControllerClient appcClient = null + + try { + msoLogger.debug("Running APP-C action: " + action.toString()) + String vnfId = execution.getVariable('vnfId') + String msoRequestId = execution.getVariable('requestId') + execution.setVariable('msoRequestId', msoRequestId) + execution.setVariable("failedActivity", "APP-C") + + appcClient = new ApplicationControllerClient() + ApplicationControllerSupport support = new ApplicationControllerSupport() + appcClient.appCSupport=support + org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage", "org.onap.appc.client.lcm.model"); + Flags flags = new Flags(); + ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); + actionIdentifiers.setVnfId(vnfId); + Status appcStatus + switch(action) { + case Action.Lock: + execution.setVariable('workStep', "LockVNF") + appcStatus = appcClient.runCommand(Action.Lock,actionIdentifiers,null,msoRequestId) + break + case Action.Unlock: + execution.setVariable('workStep', "UnlockVNF") + appcStatus = appcClient.runCommand(Action.Unlock,actionIdentifiers,null,msoRequestId) + break + case Action.HealthCheck: + def healthCheckIndex = execution.getVariable('healthCheckIndex') + execution.setVariable('workStep', "HealthCheckVNF" + healthCheckIndex) + execution.setVariable('healthCheckIndex', healthCheckIndex + 1) + appcStatus = appcClient.runCommand(Action.HealthCheck,actionIdentifiers,null,msoRequestId) + break + case Action.Start: + execution.setVariable('workStep', "StartVNF") + appcStatus = appcClient.runCommand(Action.Start,actionIdentifiers,null,msoRequestId) + break + case Action.Stop: + execution.setVariable('workStep', "StopVNF") + appcStatus = appcClient.runCommand(Action.Stop,actionIdentifiers,null,msoRequestId) + break + default: + break + } + msoLogger.debug("Completed AppC request") + int appcCode = appcStatus.getCode() + msoLogger.debug("AppC status code is: " + appcCode) + msoLogger.debug("AppC status message is: " + appcStatus.getMessage()) + if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) { + execution.setVariable("errorCode", Integer.toString(appcCode)) + execution.setVariable("errorText", appcStatus.getMessage()) + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + } catch (java.lang.NoSuchMethodError e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + } + } + + /** + * Placeholder for a call to APP-C client to execute specified APP-C command for this VNF. + * + * + * @param execution The flow's execution instance. + * @param action The action to take in APP-C. + */ + public void runAppcCommandPlaceholder(DelegateExecution execution, String action) { + def method = getClass().getSimpleName() + '.runAppcCommandPlaceholder(' + + 'execution=' + execution.getId() + + ')' + + execution.setVariable('errorCode', "0") + msoLogger.trace('Entered ' + method) + execution.setVariable("failedActivity", "APP-C") + execution.setVariable("workStep", action) + } + + + + /** + * Handle Abort disposition from RainyDayHandler + * + * @param execution The flow's execution instance. + */ + public void abortProcessing(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.abortProcessing(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + def errorText = execution.getVariable("errorText") + def errorCode = execution.getVariable("errorCode") + + exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText) + } + + /** + * Increment Retry Count for Current Work Step + * + * @param execution The flow's execution instance. + */ + public void incrementRetryCount(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.incrementRetryCount(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + String retryCountVariableName = execution.getVariable("workStep") + "RetryCount" + execution.setVariable("retryCountVariableName", retryCountVariableName) + + def retryCountVariable = execution.getVariable(retryCountVariableName) + int retryCount = 0 + + if (retryCountVariable != null) { + retryCount = (int) retryCountVariable + } + + retryCount += 1 + + execution.setVariable(retryCountVariableName, retryCount) + + msoLogger.debug("value of " + retryCountVariableName + " is " + retryCount) + msoLogger.trace('Exited ' + method) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy new file mode 100644 index 0000000000..86c5f65e8c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -0,0 +1,814 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.vcpe.scripts; + +import static org.apache.commons.lang3.StringUtils.* + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.CatalogDbUtils +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.* +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.springframework.web.util.UriUtils; + +import groovy.json.* + + + +/** + * This groovy class supports the CreateVcpeResCustService.bpmn process. + * + * @author ek1439 + * + */ +public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVcpeResCustService.class); + + private static final String DebugFlag = "isDebugLogEnabled" + + String Prefix = "CVRCS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + CatalogDbUtils catalogDbUtils = new CatalogDbUtils() + + /** + * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. + * @param execution + */ + public InitializeProcessVariables(DelegateExecution execution) { + /* Initialize all the process variables in this block */ + + execution.setVariable("createVcpeServiceRequest", "") + execution.setVariable("globalSubscriberId", "") + execution.setVariable("serviceInstanceName", "") + execution.setVariable("msoRequestId", "") + execution.setVariable(Prefix + "VnfsCreatedCount", 0) + execution.setVariable("productFamilyId", "") + execution.setVariable("brgWanMacAddress", "") + execution.setVariable("customerLocation", "") + execution.setVariable("homingService", "") + execution.setVariable("cloudOwner", "") + execution.setVariable("cloudRegionId", "") + execution.setVariable("homingModelIds", "") + + //TODO + execution.setVariable("sdncVersion", "1707") + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. + * @param execution + */ + public void preProcessRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside preProcessRequest CreateVcpeResCustService Request ") + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + //Config Inputs + String aaiDistDelay = execution.getVariable('URN_mso_workflow_aai_distribution_delay') + if (isBlank(aaiDistDelay)) { + msg = "URN_mso_workflow_aai_distribution_delay is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("aaiDistDelay", aaiDistDelay) + msoLogger.debug("AAI distribution delay: " + aaiDistDelay) + + // check for incoming json message/input + String createVcpeServiceRequest = execution.getVariable("bpmnRequest") + msoLogger.debug(createVcpeServiceRequest) + execution.setVariable("createVcpeServiceRequest", createVcpeServiceRequest); + println 'createVcpeServiceRequest - ' + createVcpeServiceRequest + + // extract requestId + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) { + serviceInstanceId = UUID.randomUUID().toString() + msoLogger.debug(" Generated new Service Instance: " + serviceInstanceId) + } else { + msoLogger.debug("Using provided Service Instance ID: " + serviceInstanceId) + } + + serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + utils.log("DEBUG", "Incoming serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + + String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.instanceName") + execution.setVariable("serviceInstanceName", serviceInstanceName) + utils.log("DEBUG", "Incoming serviceInstanceName is: " + serviceInstanceName, isDebugEnabled) + + String requestAction = execution.getVariable("requestAction") + execution.setVariable("requestAction", requestAction) + + setBasicDBAuthHeader(execution, isDebugEnabled) + + String source = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.source") + if ((source == null) || (source.isEmpty())) { + source = "VID" + } + execution.setVariable("source", source) + + // extract globalSubscriberId + String globalSubscriberId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId") + + // verify element global-customer-id is sent from JSON input, throw exception if missing + if ((globalSubscriberId == null) || (globalSubscriberId.isEmpty())) { + String dataErrorMessage = " Element 'globalSubscriberId' is missing. " + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + execution.setVariable("globalCustomerId", globalSubscriberId) + } + + // extract subscriptionServiceType + String subscriptionServiceType = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters.subscriptionServiceType") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + msoLogger.debug("Incoming subscriptionServiceType is: " + subscriptionServiceType) + + String suppressRollback = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.suppressRollback") + execution.setVariable("disableRollback", suppressRollback) + msoLogger.debug("Incoming Suppress/Disable Rollback is: " + suppressRollback) + + String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + msoLogger.debug("Incoming productFamilyId is: " + productFamilyId) + + String subscriberInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo") + execution.setVariable("subscriberInfo", subscriberInfo) + msoLogger.debug("Incoming subscriberInfo is: " + subscriberInfo) + + // extract cloud configuration, split vid_ID into cloudOwner and cloudRegionId + String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.cloudConfiguration.lcpCloudRegionId") + def cloudRegion = vimId.split("_") + def cloudOwner = cloudRegion[0].toString() + def cloudRegionId = cloudRegion[1].toString() + execution.setVariable("cloudOwner", cloudOwner) + utils.log("DEBUG","cloudOwner: " + cloudOwner, isDebugEnabled) + execution.setVariable("cloudRegionId", cloudRegionId) + utils.log("DEBUG","cloudRegionId: " + cloudRegionId, isDebugEnabled) + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(createVcpeServiceRequest) + + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map inputMap = [:] + if (userParams) { + userParams.each { + userParam -> + if ("Customer_Location".equals(userParam?.name)) { + execution.setVariable("customerLocation", userParam.value) + userParam.value.each { + param -> + inputMap.put(param.key, param.value) + } + } + if ("Homing_Model_Ids".equals(userParam?.name)) { + utils.log("DEBUG", "Homing_Model_Ids: " + userParam.value.toString() + " ---- Type is:" + + userParam.value.getClass() , isDebugEnabled) + def modelIdLst = [] + userParam.value.each { + param -> + def valueMap = [:] + param.each { + entry -> + valueMap.put(entry.key, entry.value) + } + modelIdLst.add(valueMap) + utils.log("DEBUG", "Param: " + param.toString() + " ---- Type is:" + + param.getClass() , isDebugEnabled) + } + execution.setVariable("homingModelIds", modelIdLst) + } + if ("BRG_WAN_MAC_Address".equals(userParam?.name)) { + execution.setVariable("brgWanMacAddress", userParam.value) + inputMap.put("BRG_WAN_MAC_Address", userParam.value) + } + if ("Homing_Solution".equals(userParam?.name)) { + execution.setVariable("homingService", userParam.value) + inputMap.put("Homing_Solution", userParam.value) + } + } + } + + if (execution.getVariable("homingService") == "") { + // Set Default Homing to OOF if not set + execution.setVariable("homingService", "oof") + } + + msoLogger.debug("User Input Parameters map: " + userParams.toString()) + execution.setVariable("serviceInputParams", inputMap) + + msoLogger.debug("Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress')) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + CREATE + ${MsoUtils.xmlEscape(source)} + """ + + execution.setVariable(Prefix + "requestInfo", requestInfo) + + msoLogger.trace("Completed preProcessRequest CreateVcpeResCustService Request ") + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void sendSyncResponse(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + msoLogger.trace("Inside sendSyncResponse of CreateVcpeResCustService ") + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String requestId = execution.getVariable("mso-request-id") + + // RESTResponse (for API Handler (APIH) Reply Task) + String syncResponse = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${ + requestId + }"}}""".trim() + + msoLogger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method sendSyncResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // + // ******************************* + public void prepareDecomposeService(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + try { + msoLogger.trace("Inside prepareDecomposeService of CreateVcpeResCustService ") + + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + + //serviceModelInfo JSON string will be used as-is for DoCreateServiceInstance BB + String serviceModelInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.modelInfo") + execution.setVariable("serviceModelInfo", serviceModelInfo) + + msoLogger.trace("Completed prepareDecomposeService of CreateVcpeResCustService ") + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // + // ******************************* + public void prepareCreateServiceInstance(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + try { + msoLogger.trace("Inside prepareCreateServiceInstance of CreateVcpeResCustService ") + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") +// String serviceInputParams = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters") +// execution.setVariable("serviceInputParams", serviceInputParams) + + + String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.instanceName") + execution.setVariable("serviceInstanceName", serviceInstanceName) + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonStringNoRootName()) + + msoLogger.trace("Completed prepareCreateServiceInstance of CreateVcpeResCustService ") + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void postProcessServiceInstanceCreate(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' + 'execution=' + execution.getId() + ')' + def isDebugLogEnabled = execution.getVariable(DebugFlag) + msoLogger.trace('Entered ' + method) + + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + + try { + + String payload = """ + + + + + ${MsoUtils.xmlEscape(requestId)} + BPEL + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(serviceInstanceName)} + + + + """ + execution.setVariable(Prefix + "setUpdateDbInstancePayload", payload) + msoLogger.debug(Prefix + "setUpdateDbInstancePayload: " + payload) + msoLogger.trace('Exited ' + method) + + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + } + } + + + public void processDecomposition(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + msoLogger.trace("Inside processDecomposition() of CreateVcpeResCustService ") + + try { + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + // VNFs + List vnfList = serviceDecomposition.getVnfResources() + filterVnfs(vnfList) + serviceDecomposition.setVnfResources(vnfList) + + execution.setVariable("vnfList", vnfList) + execution.setVariable("vnfListString", vnfList.toString()) + + String vnfModelInfoString = "" + if (vnfList != null && vnfList.size() > 0) { + execution.setVariable(Prefix + "VNFsCount", vnfList.size()) + msoLogger.debug("vnfs to create: " + vnfList.size()) + ModelInfo vnfModelInfo = vnfList[0].getModelInfo() + + vnfModelInfoString = vnfModelInfo.toString() + String vnfModelInfoWithRoot = vnfModelInfo.toString() + vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo") + } else { + execution.setVariable(Prefix + "VNFsCount", 0) + msoLogger.debug("no vnfs to create based upon serviceDecomposition content") + } + + execution.setVariable("vnfModelInfo", vnfModelInfoString) + execution.setVariable("vnfModelInfoString", vnfModelInfoString) + msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString) + + msoLogger.trace("Completed processDecomposition() of CreateVcpeResCustService ") + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. processDecomposition() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + private void filterVnfs(List vnfList) { + if (vnfList == null) { + return + } + + // remove BRG & TXC from VNF list + + Iterator it = vnfList.iterator() + while (it.hasNext()) { + VnfResource vr = it.next() + + String role = vr.getNfRole() + if (role == "BRG" || role == "TunnelXConn" || role == "Tunnel XConn") { + it.remove() + } + } + } + + + public void prepareCreateAllottedResourceTXC(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + try { + msoLogger.trace("Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ") + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + //allottedResourceModelInfo + //allottedResourceRole + //The model Info parameters are a JSON structure as defined in the Service Instantiation API. + //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB. + List allottedResources = serviceDecomposition.getAllottedResources() + if (allottedResources != null) { + Iterator iter = allottedResources.iterator(); + while (iter.hasNext()) { + AllottedResource allottedResource = (AllottedResource) iter.next(); + + msoLogger.debug(" getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName()) + msoLogger.debug(" allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType()) + if ("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType()) || "Tunnel XConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())) { + //set create flag to true + execution.setVariable("createTXCAR", true) + ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() + execution.setVariable("allottedResourceModelInfoTXC", allottedResourceModelInfo.toJsonStringNoRootName()) + execution.setVariable("allottedResourceRoleTXC", allottedResource.getAllottedResourceRole()) + execution.setVariable("allottedResourceTypeTXC", allottedResource.getAllottedResourceType()) + //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the TXC, + //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in TXC Allotted Resource structure) (which the Homing BB would have populated). + execution.setVariable("parentServiceInstanceIdTXC", allottedResource.getHomingSolution().getServiceInstanceId()) + } + } + } + + //unit test only + String allottedResourceId = execution.getVariable("allottedResourceId") + execution.setVariable("allottedResourceIdTXC", allottedResourceId) + msoLogger.debug("setting allottedResourceId CreateVcpeResCustService " + allottedResourceId) + + msoLogger.trace("Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ") + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceTXC flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void prepareCreateAllottedResourceBRG(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + try { + msoLogger.trace("Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ") + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + //allottedResourceModelInfo + //allottedResourceRole + //The model Info parameters are a JSON structure as defined in the Service Instantiation API. + //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB. + List allottedResources = serviceDecomposition.getAllottedResources() + if (allottedResources != null) { + Iterator iter = allottedResources.iterator(); + while (iter.hasNext()) { + AllottedResource allottedResource = (AllottedResource) iter.next(); + + msoLogger.debug(" getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName()) + msoLogger.debug(" allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType()) + if ("BRG".equalsIgnoreCase(allottedResource.getAllottedResourceType())) { + //set create flag to true + execution.setVariable("createBRGAR", true) + ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() + execution.setVariable("allottedResourceModelInfoBRG", allottedResourceModelInfo.toJsonStringNoRootName()) + execution.setVariable("allottedResourceRoleBRG", allottedResource.getAllottedResourceRole()) + execution.setVariable("allottedResourceTypeBRG", allottedResource.getAllottedResourceType()) + //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the BRG, + //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in BRG Allotted Resource structure) (which the Homing BB would have populated). + execution.setVariable("parentServiceInstanceIdBRG", allottedResource.getHomingSolution().getServiceInstanceId()) + } + } + } + + //unit test only + String allottedResourceId = execution.getVariable("allottedResourceId") + execution.setVariable("allottedResourceIdBRG", allottedResourceId) + msoLogger.debug("setting allottedResourceId CreateVcpeResCustService " + allottedResourceId) + + msoLogger.trace("Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ") + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceBRG flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Generate Network request Section + // ******************************* + public void prepareVnfAndModulesCreate(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + try { + msoLogger.trace("Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ") + + // String disableRollback = execution.getVariable("disableRollback") + // def backoutOnFailure = "" + // if(disableRollback != null){ + // if ( disableRollback == true) { + // backoutOnFailure = "false" + // } else if ( disableRollback == false) { + // backoutOnFailure = "true" + // } + // } + //failIfExists - optional + + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + msoLogger.debug("productFamilyId: " + productFamilyId) + + List vnfList = execution.getVariable("vnfList") + + Integer vnfsCreatedCount = execution.getVariable(Prefix + "VnfsCreatedCount") + String vnfModelInfoString = null; + + if (vnfList != null && vnfList.size() > 0) { + msoLogger.debug("getting model info for vnf # " + vnfsCreatedCount) + ModelInfo vnfModelInfo1 = vnfList[0].getModelInfo() + msoLogger.debug("got 0 ") + ModelInfo vnfModelInfo = vnfList[vnfsCreatedCount.intValue()].getModelInfo() + vnfModelInfoString = vnfModelInfo.toString() + } else { + //TODO: vnfList does not contain data. Need to investigate why ... . Fro VCPE use model stored + vnfModelInfoString = execution.getVariable("vnfModelInfo") + } + + msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString) + + // extract cloud configuration + String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.cloudConfiguration.lcpCloudRegionId") + def cloudRegion = vimId.split("_") + execution.setVariable("cloudOwner", cloudRegion[0]) + msoLogger.debug("cloudOwner: "+ cloudRegion[0]) + execution.setVariable("cloudRegionId", cloudRegion[1]) + msoLogger.debug("cloudRegionId: "+ cloudRegion[1]) + execution.setVariable("lcpCloudRegionId", cloudRegion[1]) + msoLogger.debug("lcpCloudRegionId: "+ cloudRegion[1]) + String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.cloudConfiguration.tenantId") + execution.setVariable("tenantId", tenantId) + msoLogger.debug("tenantId: " + tenantId) + + String sdncVersion = execution.getVariable("sdncVersion") + msoLogger.debug("sdncVersion: " + sdncVersion) + + msoLogger.trace("Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ") + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Validate Vnf request Section -> increment count + // ******************************* + public void validateVnfCreate(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + try { + msoLogger.trace("Inside validateVnfCreate of CreateVcpeResCustService ") + + Integer vnfsCreatedCount = execution.getVariable(Prefix + "VnfsCreatedCount") + vnfsCreatedCount++ + + execution.setVariable(Prefix + "VnfsCreatedCount", vnfsCreatedCount) + + msoLogger.debug(" ***** Completed validateVnfCreate of CreateVcpeResCustService ***** " + " vnf # " + vnfsCreatedCount) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ***************************************** + // Prepare Completion request Section + // ***************************************** + public void postProcessResponse(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + msoLogger.trace("Inside postProcessResponse of CreateVcpeResCustService ") + + try { + String source = execution.getVariable("source") + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + String msoCompletionRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + CREATE + ${MsoUtils.xmlEscape(source)} + + Service Instance has been created successfully via macro orchestration + ${MsoUtils.xmlEscape(serviceInstanceId)} + BPMN macro create + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + msoLogger.debug(xmlMsoCompletionRequest) + execution.setVariable(Prefix + "Success", true) + execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) + msoLogger.debug(" SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void preProcessRollback(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + msoLogger.trace("preProcessRollback of CreateVcpeResCustService ") + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage()) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + msoLogger.debug("BPMN Error during preProcessRollback") + } catch (Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + msoLogger.debug(msg) + } + msoLogger.trace("Exit preProcessRollback of CreateVcpeResCustService ") + } + + public void postProcessRollback(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + msoLogger.trace("postProcessRollback of CreateVcpeResCustService ") + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + msoLogger.debug("Setting prevException to WorkflowException: ") + execution.setVariable("WorkflowException", workflowException); + } + } catch (BpmnError b) { + msoLogger.debug("BPMN Error during postProcessRollback") + throw b; + } catch (Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + msoLogger.debug(msg) + } + msoLogger.trace("Exit postProcessRollback of CreateVcpeResCustService ") + } + + public void prepareFalloutRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + msoLogger.trace("STARTED CreateVcpeResCustService prepareFalloutRequest Process ") + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + msoLogger.debug(" Incoming Workflow Exception: " + wfex.toString()) + String requestInfo = execution.getVariable(Prefix + "requestInfo") + msoLogger.debug(" Incoming Request Info: " + requestInfo) + + //TODO. hmmm. there is no way to UPDATE error message. +// String errorMessage = wfex.getErrorMessage() +// boolean successIndicator = execution.getVariable("DCRESI_rolledBack") +// if (successIndicator){ +// errorMessage = errorMessage + ". Rollback successful." +// } else { +// errorMessage = errorMessage + ". Rollback not completed." +// } + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + + execution.setVariable(Prefix + "falloutRequest", falloutRequest) + + } catch (Exception ex) { + msoLogger.debug("Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVcpeResCustService prepareFalloutRequest Process") + } + msoLogger.trace("COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ") + } + + + public void sendSyncError(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + execution.setVariable("prefix", Prefix) + + msoLogger.trace("Inside sendSyncError() of CreateVcpeResCustService ") + + try { + String errorMessage = "" + def wfe = execution.getVariable("WorkflowException") + if (wfe instanceof WorkflowException) { + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${MsoUtils.xmlEscape(errorMessage)} + 7000 + """ + + msoLogger.debug(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + } catch (Exception ex) { + msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + } + + public void processJavaException(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + execution.setVariable("prefix", Prefix) + try { + msoLogger.debug("Caught a Java Exception") + msoLogger.debug("Started processJavaException Method") + msoLogger.debug("Variables List: " + execution.getVariables()) + execution.setVariable(Prefix + "unexpectedError", "Caught a Java Lang Exception") + // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") + } catch (BpmnError b) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + throw b + } catch (Exception e) { + msoLogger.debug("Caught Exception during processJavaException Method: " + e) + execution.setVariable(Prefix + "unexpectedError", "Exception in processJavaException method") + // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") + } + msoLogger.debug("Completed processJavaException Method") + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy new file mode 100644 index 0000000000..eaf3631441 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy @@ -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.bpmn.vcpe.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.CatalogDbUtils +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.NetworkUtils +import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse + +import static org.apache.commons.lang3.StringUtils.isBlank + + +/** + * This groovy class supports the DeleteVcpeResCustService.bpmn process. + * + * @author dm4252 + * + */ +public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteVcpeResCustService.class); + + private static final String DebugFlag = "isDebugLogEnabled" + + String Prefix = "DVRCS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + CatalogDbUtils catalogDbUtils = new CatalogDbUtils() + NetworkUtils networkUtils = new NetworkUtils() + + /** + * This method is executed during the preProcessRequest task of the DeleteVcpeResCustService.bpmn process. + * @param execution + */ + public InitializeProcessVariables(DelegateExecution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable("DeleteVcpeResCustServiceRequest", "") + execution.setVariable("msoRequestId", "") + execution.setVariable(Prefix+"vnfsDeletedCount", 0) + execution.setVariable(Prefix+"vnfsCount", 0) + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. + * @param execution + */ + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + execution.setVariable("prefix",Prefix) + + msoLogger.trace("Inside preProcessRequest DeleteVcpeResCustService Request ") + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + // check for incoming json message/input + String DeleteVcpeResCustServiceRequest = execution.getVariable("bpmnRequest") + msoLogger.debug(DeleteVcpeResCustServiceRequest) + execution.setVariable("DeleteVcpeResCustServiceRequest", DeleteVcpeResCustServiceRequest); + println 'DeleteVcpeResCustServiceRequest - ' + DeleteVcpeResCustServiceRequest + + // extract requestId + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) { + String dataErrorMessage = " Element 'serviceInstanceId' is missing. " + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + String requestAction = execution.getVariable("requestAction") + execution.setVariable("requestAction", requestAction) + + String source = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.source") + if ((source == null) || (source.isEmpty())) { + source = "VID" + } + execution.setVariable("source", source) + + // extract globalSubscriberId + String globalSubscriberId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId") + + // global-customer-id is optional on Delete + + execution.setVariable("globalSubscriberId", globalSubscriberId) + execution.setVariable("globalCustomerId", globalSubscriberId) + + String suppressRollback = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.suppressRollback") + execution.setVariable("disableRollback", suppressRollback) + msoLogger.debug("Incoming Suppress/Disable Rollback is: " + suppressRollback) + + String productFamilyId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + msoLogger.debug("Incoming productFamilyId is: " + productFamilyId) + + // extract subscriptionServiceType + String subscriptionServiceType = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestParameters.subscriptionServiceType") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + msoLogger.debug("Incoming subscriptionServiceType is: " + subscriptionServiceType) + + // extract cloud configuration + String cloudConfiguration = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.cloudConfiguration") + execution.setVariable("cloudConfiguration", cloudConfiguration) + msoLogger.debug("cloudConfiguration: "+ cloudConfiguration) + String lcpCloudRegionId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId") + execution.setVariable("lcpCloudRegionId", lcpCloudRegionId) + msoLogger.debug("lcpCloudRegionId: "+ lcpCloudRegionId) + String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId") + execution.setVariable("tenantId", tenantId) + msoLogger.debug("tenantId: "+ tenantId) + + String sdncVersion = "1707" + execution.setVariable("sdncVersion", sdncVersion) + msoLogger.debug("sdncVersion: "+ sdncVersion) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + DELETE + ${MsoUtils.xmlEscape(source)} + """ + + execution.setVariable(Prefix+"requestInfo", requestInfo) + + //Setting for Generic Sub Flows + execution.setVariable("GENGS_type", "service-instance") + + msoLogger.trace("Completed preProcessRequest DeleteVcpeResCustServiceRequest Request ") + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void sendSyncResponse(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + msoLogger.trace("Inside sendSyncResponse of DeleteVcpeResCustService ") + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String requestId = execution.getVariable("mso-request-id") + + // RESTResponse (for API Handler (APIH) Reply Task) + String syncResponse ="""{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + + msoLogger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) + sendWorkflowResponse(execution, 202, syncResponse) + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void prepareServiceDelete(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + msoLogger.trace("Inside prepareServiceDelete() of DeleteVcpeResCustService ") + + try { + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + // confirm if ServiceInstance was found + if ( !execution.getVariable("GENGS_FoundIndicator") ) + { + String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Service Instance was not found in AAI by id: " + serviceInstanceId + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + // get variable within incoming json + String DeleteVcpeResCustServiceRequest = execution.getVariable("DeleteVcpeResCustServiceRequest"); + + // get SI extracted by GenericGetService + String serviceInstanceAaiRecord = execution.getVariable("GENGS_service"); + + msoLogger.debug("serviceInstanceAaiRecord: "+serviceInstanceAaiRecord) + serviceInstanceAaiRecord = utils.removeXmlNamespaces(serviceInstanceAaiRecord) + + def (TXC_found, TXC_id) = new Tuple(false, null) + def (BRG_found, BRG_id) = new Tuple(false, null) + List relatedVnfIdList = [] + + for(Node rel: utils.getMultNodeObjects(serviceInstanceAaiRecord, "relationship")) { + def relto = utils.getChildNodeText(rel, "related-to") + def relink = utils.getChildNodeText(rel, "related-link") + msoLogger.debug("check: "+relto+" link: "+relink) + + if(isBlank(relto) || isBlank(relink)) { + + } else if(relto == "generic-vnf") { + def id = relink.substring(relink.indexOf("/generic-vnf/")+13) + if(id.endsWith("/")) { + id = id.substring(0, id.length()-1) + } + + relatedVnfIdList.add(id) + + } else if(relto == "allotted-resource") { + def (type, id) = getAaiAr(execution, relink) + + if(isBlank(type) || isBlank(id)) { + + } else if(type == "TunnelXConn" || type == "Tunnel XConn") { + msoLogger.debug("TunnelXConn AR found") + TXC_found = true + TXC_id = id + + } else if(type == "BRG") { + msoLogger.debug("BRG AR found") + BRG_found = true + BRG_id = id + } + } + } + + execution.setVariable(Prefix+"TunnelXConn", TXC_found) + execution.setVariable("TXC_allottedResourceId", TXC_id) + msoLogger.debug("TXC_allottedResourceId: " + TXC_id) + + execution.setVariable(Prefix+"BRG", BRG_found) + execution.setVariable("BRG_allottedResourceId", BRG_id) + msoLogger.debug("BRG_allottedResourceId: " + BRG_id) + + int vnfsCount = relatedVnfIdList.size() + execution.setVariable(Prefix+"vnfsCount", vnfsCount) + msoLogger.debug(" "+Prefix+"vnfsCount : " + vnfsCount) + if(vnfsCount > 0) { + execution.setVariable(Prefix+"relatedVnfIdList", relatedVnfIdList) + } + + msoLogger.trace("Completed prepareServiceDelete() of DeleteVcpeResCustService ") + } catch (BpmnError e){ + throw e; + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. prepareServiceDelete() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + private getAaiAr(DelegateExecution execution, String relink) { + def isDebugEnabled = execution.getVariable(DebugFlag) + AaiUtil aaiUtil = new AaiUtil(this) + String aaiEndpoint = UrnPropertiesReader.getVariable("aai.endpoint",execution) + relink + + msoLogger.debug("get AR info " + aaiEndpoint) + APIResponse response = aaiUtil.executeAAIGetCall(execution, aaiEndpoint) + + int responseCode = response.getStatusCode() + msoLogger.debug("get AR info responseCode:" + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + msoLogger.debug("get AR info " + aaiResponse) + + if(responseCode < 200 || responseCode >= 300 || isBlank(aaiResponse)) { + return new Tuple2(null, null) + } + + def type = utils.getNodeText(aaiResponse, "type") + def id = utils.getNodeText(aaiResponse, "id") + + return new Tuple2(type, id) + } + + + // ******************************* + // + // ******************************* + public void prepareVnfAndModulesDelete (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + msoLogger.trace("Inside prepareVnfAndModulesDelete of DeleteVcpeResCustService ") + + try { + List vnfList = execution.getVariable(Prefix+"relatedVnfIdList") + int vnfsDeletedCount = execution.getVariable(Prefix+"vnfsDeletedCount") + String vnfModelInfoString = "" + String vnfId = "" + if (vnfList.size() > 0 ) { + vnfId = vnfList.get(vnfsDeletedCount.intValue()) + } + + execution.setVariable("vnfId", vnfId) + msoLogger.debug("need to delete vnfId:" + vnfId) + + msoLogger.trace("Completed prepareVnfAndModulesDelete of DeleteVcpeResCustService ") + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesDelete() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Validate Vnf request Section -> increment count + // ******************************* + public void validateVnfDelete (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + msoLogger.trace("Inside validateVnfDelete of DeleteVcpeResCustService ") + + try { + int vnfsDeletedCount = execution.getVariable(Prefix+"vnfsDeletedCount") + vnfsDeletedCount++ + + execution.setVariable(Prefix+"vnfsDeletedCount", vnfsDeletedCount) + + msoLogger.debug(" ***** Completed validateVnfDelete of DeleteVcpeResCustService ***** "+" vnf # "+vnfsDeletedCount) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected Error from method validateVnfDelete() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + + // ***************************************** + // Prepare Completion request Section + // ***************************************** + public void postProcessResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + msoLogger.trace("Inside postProcessResponse of DeleteVcpeResCustService ") + + try { + String source = execution.getVariable("source") + String requestId = execution.getVariable("msoRequestId") + + String msoCompletionRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + DELETE + ${MsoUtils.xmlEscape(source)} + + vCPE Res Cust Service Instance has been deleted successfully. + BPMN Service Instance macro action: DELETE + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + msoLogger.debug(xmlMsoCompletionRequest) + execution.setVariable(Prefix+"Success", true) + execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest) + msoLogger.debug(" SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteServiceInstance flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void prepareFalloutRequest(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable(DebugFlag) + msoLogger.trace("STARTED DeleteVcpeResCustService prepareFalloutRequest Process ") + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + msoLogger.debug(" Incoming Workflow Exception: " + wfex.toString()) + String requestInfo = execution.getVariable(Prefix+"requestInfo") + msoLogger.debug(" Incoming Request Info: " + requestInfo) + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + + execution.setVariable(Prefix+"falloutRequest", falloutRequest) + } catch (Exception ex) { + msoLogger.debug("Error Occured in DeleteVcpeResCustService prepareFalloutRequest Process " + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVcpeResCustService prepareFalloutRequest Process") + } + msoLogger.trace("COMPLETED DeleteVcpeResCustService prepareFalloutRequest Process ") + } + + + public void sendSyncError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + msoLogger.trace("Inside sendSyncError() of DeleteVcpeResCustService ") + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${MsoUtils.xmlEscape(errorMessage)} + 7000 + """ + + msoLogger.debug(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + } catch (Exception ex) { + msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + } + + public void processJavaException(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable(DebugFlag) + execution.setVariable("prefix",Prefix) + try{ + msoLogger.debug("Caught a Java Exception") + msoLogger.debug("Started processJavaException Method") + msoLogger.debug("Variables List: " + execution.getVariables()) + execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") + }catch(BpmnError b){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + throw b + }catch(Exception e){ + msoLogger.debug("Caught Exception during processJavaException Method: " + e) + execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") + } + msoLogger.debug("Completed processJavaException Method") + } + + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy new file mode 100644 index 0000000000..8a8aa2b2ad --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy @@ -0,0 +1,678 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe.scripts; + +import org.onap.so.bpmn.common.scripts.*; +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.rest.APIResponse + +import java.util.UUID; +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.springframework.web.util.UriUtils; +import static org.apache.commons.lang3.StringUtils.* + +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +/** + * This groovy class supports the DoCreateAllottedResourceBRG.bpmn process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDEbugLogEnabled + * @param - disableRollback + * @param - failExists - O + * @param - serviceInstanceId + * @param - globalCustomerId - O + * @param - subscriptionServiceType - O + * @param - parentServiceInstanceId + * @param - allottedReourceId - O + * @param - allottedResourceModelInfo + * @param - allottedResourceRole + * @param - allottedResourceType + * @param - brgWanMacAddress + * @param - vni + * @param - vgmuxBearerIP + * + * Outputs: + * @param - rollbackData (localRB->null) + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * @param - WorkflowException - O + * @param - allottedResourceId + * @param - allottedResourceName + * + */ +public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceBRG.class); + + String Prefix="DCARBRG_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + + + String msg = "" + msoLogger.trace("start preProcessRequest") + + try { + execution.setVariable("prefix", Prefix) + + //Config Inputs + String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + if (isBlank(sdncCallbackUrl)) { + msg = "mso.workflow.sdncadapter.callback is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + + String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution) + if (isBlank(sdncReplDelay)) { + msg = "mso.workflow.sdnc.replication.delay is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncReplDelay", sdncReplDelay) + msoLogger.debug("SDNC replication delay: " + sdncReplDelay) + + //Request Inputs + if (isBlank(execution.getVariable("serviceInstanceId"))){ + msg = "Input serviceInstanceId is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("parentServiceInstanceId"))) { + msg = "Input parentServiceInstanceId is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("allottedResourceModelInfo"))) { + msg = "Input allottedResourceModelInfo is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("vni"))) { + msg = "Input vni is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("vgmuxBearerIP"))) { + msg = "Input vgmuxBearerIP is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("brgWanMacAddress"))) { + msg = "Input brgWanMacAddress is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("allottedResourceRole"))) { + msg = "Input allottedResourceRole is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("allottedResourceType"))) { + msg = "Input allottedResourceType is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessRequest") + } + + public void getAaiAR (DelegateExecution execution) { + + + msoLogger.trace("start getAaiAR") + + String arType = execution.getVariable("allottedResourceType") + String arRole = execution.getVariable("allottedResourceRole") + + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String orchStatus = arUtils.getAROrchStatus(execution) + + String errorMsg = "" + + if (orchStatus != null) // AR was found + { + if ("true".equals(execution.getVariable("failExists"))) + { + errorMsg = "Allotted resource " + arType + " with Role " + arRole + " already exists" + } + else + { + if ("Active".equals(orchStatus)) + { + execution.setVariable("foundActiveAR", true) + } + else // blanks included + { + errorMsg = "Allotted Resource " + arType + " with Role " + arRole + " already exists in an incomplete state -" + orchStatus + } + } + } + if (!isBlank(errorMsg)) { + msoLogger.debug(errorMsg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) + } + msoLogger.trace("end getAaiAR") + } + + public void createAaiAR(DelegateExecution execution) { + + + msoLogger.trace("start createAaiAR") + String msg = "" + + String allottedResourceId = execution.getVariable("allottedResourceId") + if (isBlank(allottedResourceId)) + { + allottedResourceId = UUID.randomUUID().toString() + execution.setVariable("allottedResourceId", allottedResourceId) + } + String arUrl = "" + try { + + //AAI PUT + AaiUtil aaiUriUtil = new AaiUtil(this) + String aaiEndpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + String siResourceLink= execution.getVariable("PSI_resourceLink") + + String siUri = "" + msoLogger.debug("PSI_resourceLink:" + siResourceLink) + + if(!isBlank(siResourceLink)) { + msoLogger.debug("Incoming PSI Resource Link is: " + siResourceLink) + String[] split = siResourceLink.split("/aai/") + siUri = "/aai/" + split[1] + } + else + { + msg = "Parent Service Link in AAI is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + arUrl = "${aaiEndpoint}${siUri}" + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + execution.setVariable("aaiARPath", arUrl) + msoLogger.debug("GET AllottedResource AAI URL is:\n" + arUrl) + + String namespace = aaiUriUtil.getNamespaceFromUri(execution, arUrl) + + String arType = execution.getVariable("allottedResourceType") + String arRole = execution.getVariable("allottedResourceRole") + String CSI_resourceLink = execution.getVariable("CSI_resourceLink") + String arModelInfo = execution.getVariable("allottedResourceModelInfo") + String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid") + String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid") + String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid") + + if (modelInvariantId == null) { + modelInvariantId = "" + } + if (modelVersionId == null) { + modelVersionId = "" + } + if (modelCustomizationId == null) { + modelCustomizationId = "" + } + + String payload = + """ + ${MsoUtils.xmlEscape(allottedResourceId)} + + ${MsoUtils.xmlEscape(arType)} + ${MsoUtils.xmlEscape(arRole)} + + ${MsoUtils.xmlEscape(modelInvariantId)} + ${MsoUtils.xmlEscape(modelVersionId)} + ${MsoUtils.xmlEscape(modelCustomizationId)} + PendingCreate + + + + service-instance + ${MsoUtils.xmlEscape(CSI_resourceLink)} + + + """.trim() + + execution.setVariable("AaiARPayload", payload) + msoLogger.debug(" payload to create AllottedResource in AAI:" + "\n" + payload) + + APIResponse response = aaiUriUtil.executeAAIPutCall(execution, arUrl, payload) + int responseCode = response.getStatusCode() + msoLogger.debug("AllottedResource AAI PUT responseCode:" + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + msoLogger.debug("AllottedResource AAI PUT responseStr:" + aaiResponse) + + //200 OK 201 CREATED 202 ACCEPTED + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + { + msoLogger.debug("AAI PUT AllottedResource received a Good Response") + } + else{ + msoLogger.debug("AAI Put AllottedResouce received a Bad Response Code: " + responseCode) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + } catch (Exception ex) { + msg = "Exception in createAaiAR " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + //start rollback set up + RollbackData rollbackData = new RollbackData() + def disableRollback = execution.getVariable("disableRollback") + rollbackData.put(Prefix, "disableRollback", disableRollback.toString()) + rollbackData.put(Prefix, "rollbackAAI", "true") + rollbackData.put(Prefix, "allottedResourceId", allottedResourceId) + rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId")) + rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId")) + rollbackData.put(Prefix, "aaiARPath", arUrl) + execution.setVariable("rollbackData", rollbackData) + msoLogger.trace("end createAaiAR") + } + + public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { + + + String msg = "" + msoLogger.trace("start buildSDNCRequest") + String sdncReq = null + + try { + + String allottedResourceId = execution.getVariable("allottedResourceId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String globalCustomerId = execution.getVariable("globalCustomerId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") + String callbackUrl = execution.getVariable("sdncCallbackUrl") + String requestId = execution.getVariable("msoRequestId") + + String brgWanMacAddress = execution.getVariable("brgWanMacAddress") + String vni = execution.getVariable("vni") + String vgmuxBearerIP = execution.getVariable("vgmuxBearerIP") + + String arModelInfo = execution.getVariable("allottedResourceModelInfo") + String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid") + String modelVersion = jsonUtil.getJsonValue(arModelInfo, "modelVersion") + String modelUUId = jsonUtil.getJsonValue(arModelInfo, "modelUuid") + String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid") + String modelName = jsonUtil.getJsonValue(arModelInfo, "modelName") + + if (modelInvariantId == null) { + modelInvariantId = "" + } + if (modelVersion == null) { + modelVersion = "" + } + if (modelUUId == null) { + modelUUId = "" + } + if (modelName == null) { + modelName = "" + } + if (modelCustomizationId == null) { + modelCustomizationId = "" + } + + sdncReq = + """ + + ${MsoUtils.xmlEscape(sdncRequestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(action)} + brg-topology-operation + ${MsoUtils.xmlEscape(callbackUrl)} + + + + ${MsoUtils.xmlEscape(requestId)} + CreateBRGInstance + MSO + + + + + + + ${MsoUtils.xmlEscape(subscriptionServiceType)} + + ${MsoUtils.xmlEscape(serviceInstanceId)} + + ${MsoUtils.xmlEscape(globalCustomerId)} + + + ${MsoUtils.xmlEscape(allottedResourceId)} + brg + ${MsoUtils.xmlEscape(parentServiceInstanceId)} + + ${MsoUtils.xmlEscape(modelInvariantId)} + ${MsoUtils.xmlEscape(modelUUId)} + ${MsoUtils.xmlEscape(modelCustomizationId)} + ${MsoUtils.xmlEscape(modelVersion)} + ${MsoUtils.xmlEscape(modelName)} + + + + ${MsoUtils.xmlEscape(brgWanMacAddress)} + ${MsoUtils.xmlEscape(vni)} + ${MsoUtils.xmlEscape(vgmuxBearerIP)} + + + """ + + msoLogger.debug("sdncRequest:\n" + sdncReq) + sdncReq = utils.formatXml(sdncReq) + + } catch(Exception ex) { + msg = "Exception in buildSDNCRequest. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end buildSDNCRequest") + return sdncReq + } + + public void preProcessSDNCAssign(DelegateExecution execution) { + + + String msg = "" + msoLogger.trace("start preProcessSDNCAssign") + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId) + execution.setVariable("sdncAssignRequest", sdncAssignReq) + msoLogger.debug("sdncAssignRequest: " + sdncAssignReq) + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq) + execution.setVariable("rollbackData", rollbackData) + + msoLogger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq) + msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCAssign. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessSDNCAssign") + } + + public void preProcessSDNCCreate(DelegateExecution execution) { + + + String msg = "" + msoLogger.trace("start preProcessSDNCCreate") + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId) + execution.setVariable("sdncCreateRequest", sdncCreateReq) + msoLogger.debug("sdncCreateReq: " + sdncCreateReq) + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq) + execution.setVariable("rollbackData", rollbackData) + + msoLogger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq) + msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCCreate. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessSDNCCreate") + } + + public void preProcessSDNCActivate(DelegateExecution execution) { + + + String msg = "" + msoLogger.trace("start preProcessSDNCActivate") + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId) + execution.setVariable("sdncActivateRequest", sdncActivateReq) + msoLogger.debug("sdncActivateReq: " + sdncActivateReq) + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq) + execution.setVariable("rollbackData", rollbackData) + + msoLogger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq) + msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCActivate. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessSDNCActivate") + } + + public void validateSDNCResp(DelegateExecution execution, String response, String method){ + + + msoLogger.trace("ValidateSDNCResponse Process") + String msg = "" + + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + msoLogger.debug("SDNCResponse: " + response) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) + + if (!"get".equals(method)) + { + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put(Prefix, "rollback" + "SDNC" + method, "true") + execution.setVariable("rollbackData", rollbackData) + } + + }else{ + msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + throw new BpmnError("MSOWorkflowException") + } + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in validateSDNCResp. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("End ValidateSDNCResp Process") + } + + public void preProcessSDNCGet(DelegateExecution execution){ + + msoLogger.trace("start preProcessSDNCGet") + try{ + + def callbackUrl = execution.getVariable("sdncCallbackUrl") + // serviceOperation (URI for topology GET) will be retrieved from "selflink" from AAI if active AR exists in AAI + // or from "object-path" in SDNC response for assign when AR does not exist in AA + + String serviceOperation = "" + + if (execution.getVariable("foundActiveAR")) { + def aaiQueryResponse = execution.getVariable("aaiARGetResponse") + serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink") + msoLogger.debug("AR service operation/aaiARSelfLink: " + serviceOperation) + } + else + { + String response = execution.getVariable("sdncAssignResponse") + String data = utils.getNodeXml(response, "response-data") + msoLogger.debug("Assign responseData: " + data) + serviceOperation = utils.getNodeText(data, "object-path") + msoLogger.debug("AR service operation:" + serviceOperation) + } + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String sdncRequestId = UUID.randomUUID().toString() + + //neeed the same url as used by vfmodules + String SDNCGetRequest = + """ + + ${MsoUtils.xmlEscape(sdncRequestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + query + ${MsoUtils.xmlEscape(serviceOperation)} + ${MsoUtils.xmlEscape(callbackUrl)} + vfmodule + + + """ + + execution.setVariable("sdncGetRequest", SDNCGetRequest) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage()) + } + msoLogger.trace("end preProcessSDNCGet") + } + + public void updateAaiAROrchStatus(DelegateExecution execution, String status){ + + msoLogger.trace("start updateAaiAROrchStatus") + String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) + msoLogger.trace("end updateAaiAROrchStatus") + } + + public void generateOutputs(DelegateExecution execution) + { + + msoLogger.trace("start generateOutputs") + try { + String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped + msoLogger.debug("resp:" + sdncGetResponse) + String arData = utils.getNodeXml(sdncGetResponse, "brg-topology") + arData = utils.removeXmlNamespaces(arData) + + String brga = utils.getNodeXml(arData, "brg-assignments") + String ari = utils.getNodeXml(arData, "allotted-resource-identifiers") + execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name")) + } catch (BpmnError e) { + msoLogger.debug("BPMN Error in generateOutputs ") + } catch(Exception ex) { + String msg = "Exception in generateOutputs " + ex.getMessage() + msoLogger.debug(msg) + } + msoLogger.trace("end generateOutputs") + + } + + public void preProcessRollback (DelegateExecution execution) { + + msoLogger.trace("start preProcessRollback") + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage()) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + msoLogger.debug("BPMN Error during preProcessRollback") + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + msoLogger.debug(msg) + } + msoLogger.trace("end preProcessRollback") + } + + public void postProcessRollback (DelegateExecution execution) { + + msoLogger.trace("start postProcessRollback") + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + msoLogger.debug("Setting prevException to WorkflowException: ") + execution.setVariable("WorkflowException", workflowException); + } + execution.setVariable("rollbackData", null) + } catch (BpmnError b) { + msoLogger.debug("BPMN Error during postProcessRollback") + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + msoLogger.debug(msg) + } + msoLogger.trace("end postProcessRollback") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy new file mode 100644 index 0000000000..4d4f11c3e5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy @@ -0,0 +1,279 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe.scripts; + +import org.onap.so.bpmn.common.scripts.*; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.rest.APIResponse + +import java.util.UUID; +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.springframework.web.util.UriUtils; +import static org.apache.commons.lang3.StringUtils.* + +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +/** + * This groovy class supports the CreateAllottedResourceBRGRollback.bpmn process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDebugLogEnabled + * @param - disableRollback - O + * @param - rollbackData + * + * Outputs: + * @param - rollbackError + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * + */ +public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceBRGRollback.class); + + String Prefix="DCARBRGRB_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void preProcessRequest (DelegateExecution execution) { + + + String msg = "" + msoLogger.trace("start preProcessRequest") + execution.setVariable("prefix", Prefix) + String rbType = "DCARBRG_" + try { + + def rollbackData = execution.getVariable("rollbackData") + msoLogger.debug("RollbackData:" + rollbackData) + + if (rollbackData != null) { + if (rollbackData.hasType(rbType)) { + + execution.setVariable("serviceInstanceId", rollbackData.get(rbType, "serviceInstanceId")) + execution.setVariable("parentServiceInstanceId", rollbackData.get(rbType, "parentServiceInstanceId")) + execution.setVariable("allottedResourceId", rollbackData.get("SERVICEINSTANCE", "allottedResourceId")) + + + def rollbackAAI = rollbackData.get(rbType, "rollbackAAI") + if ("true".equals(rollbackAAI)) + { + execution.setVariable("rollbackAAI",true) + execution.setVariable("aaiARPath", rollbackData.get(rbType, "aaiARPath")) + + } + def rollbackSDNC = rollbackData.get(rbType, "rollbackSDNCassign") + if ("true".equals(rollbackSDNC)) + { + execution.setVariable("rollbackSDNC", true) + execution.setVariable("deactivateSdnc", rollbackData.get(rbType, "rollbackSDNCactivate")) + execution.setVariable("deleteSdnc", rollbackData.get(rbType, "rollbackSDNCcreate")) + execution.setVariable("unassignSdnc", rollbackData.get(rbType, "rollbackSDNCassign")) + + msoLogger.debug("sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") ) + msoLogger.debug("sdncDelete:\n" + execution.getVariable("deleteSdnc")) + msoLogger.debug("sdncUnassign:\n" + execution.getVariable("unassignSdnc")) + + execution.setVariable("sdncDeactivateRequest", rollbackData.get(rbType, "sdncActivateRollbackReq")) + execution.setVariable("sdncDeleteRequest", rollbackData.get(rbType, "sdncCreateRollbackReq")) + execution.setVariable("sdncUnassignRequest", rollbackData.get(rbType, "sdncAssignRollbackReq")) + } + + if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackSDNC") != true) + { + execution.setVariable("skipRollback", true) + } + } + else { + execution.setVariable("skipRollback", true) + } + } + else { + execution.setVariable("skipRollback", true) + } + if (execution.getVariable("disableRollback").equals("true" )) + { + execution.setVariable("skipRollback", true) + } + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessRequest") + } + + // aaiARPath set during query (existing AR) + public void updateAaiAROrchStatus(DelegateExecution execution, String status){ + + String msg = null; + msoLogger.trace("start updateAaiAROrchStatus") + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String aaiARPath = execution.getVariable("aaiARPath") + msoLogger.debug(" aaiARPath:" + aaiARPath) + String ar = null; //need this for getting resourceVersion for delete + if (!isBlank(aaiARPath)) + { + ar = arUtils.getARbyLink(execution, aaiARPath, "") + } + if (isBlank(ar)) + { + msg = "AR not found in AAI at:" + aaiARPath + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) + msoLogger.trace("end updateAaiAROrchStatus") + } + + public void validateSDNCResp(DelegateExecution execution, String response, String method){ + + + msoLogger.trace("start ValidateSDNCResponse Process") + String msg = "" + + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + msoLogger.debug("SDNCResponse: " + response) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) + + }else{ + + msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + throw new BpmnError("MSOWorkflowException") + } + } catch (BpmnError e) { + if ("404".contentEquals(e.getErrorCode())) + { + msg = "SDNC rollback " + method + " returned a 404. Proceding with rollback" + msoLogger.debug(msg) + } + else { + throw e; + } + } catch(Exception ex) { + msg = "Exception in validateSDNCResp. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end ValidateSDNCResp Process") + } + + public void deleteAaiAR(DelegateExecution execution){ + + try{ + msoLogger.trace("start deleteAaiAR") + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String ar = null //need to get resource-version + String arLink = execution.getVariable("aaiARPath") + if (!isBlank(arLink)) + { + ar = arUtils.getARbyLink(execution, arLink, "") + } + arUtils.deleteAR(execution, arLink + '?resource-version=' + UriUtils.encode(execution.getVariable("aaiARResourceVersion"),"UTF-8")) + } catch (BpmnError e) { + throw e; + }catch(Exception ex){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) + } + msoLogger.trace("end deleteAaiAR") + } + + public void postProcessRequest(DelegateExecution execution) { + + msoLogger.trace("start postProcessRequest") + String msg = "" + try { + execution.setVariable("rollbackData", null) + boolean skipRollback = execution.getVariable("skipRollback") + if (skipRollback != true) + { + execution.setVariable("rolledBack", true) + msoLogger.debug("rolledBack") + } + msoLogger.trace("end postProcessRequest") + + } catch (BpmnError e) { + msg = "Bpmn Exception in postProcessRequest. " + msoLogger.debug(msg) + } catch (Exception ex) { + msg = "Exception in postProcessRequest. " + ex.getMessage() + msoLogger.debug(msg) + } + + } + + public void processRollbackException(DelegateExecution execution){ + + msoLogger.trace("start processRollbackException") + try{ + msoLogger.debug("Caught an Exception in DoCreateAllottedResourceRollback") + execution.setVariable("rollbackData", null) + execution.setVariable("rolledBack", false) + execution.setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback") + execution.setVariable("WorkflowException", null) + + }catch(BpmnError b){ + msoLogger.debug("BPMN Error during processRollbackExceptions Method: ") + }catch(Exception e){ + msoLogger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage()) + } + + msoLogger.trace("end processRollbackException") + } + + public void processRollbackJavaException(DelegateExecution execution){ + + msoLogger.trace("start processRollbackJavaException") + try{ + execution.setVariable("rollbackData", null) + execution.setVariable("rolledBack", false) + execution.setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback") + msoLogger.debug("Caught Exception in processRollbackJavaException") + + }catch(Exception e){ + msoLogger.debug("Caught Exception in processRollbackJavaException " + e.getMessage()) + } + msoLogger.trace("end processRollbackJavaException") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy new file mode 100644 index 0000000000..5f9b4b8ecd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy @@ -0,0 +1,674 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe.scripts; + +import org.onap.so.bpmn.common.scripts.*; +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.rest.APIResponse + +import java.util.UUID; +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.springframework.web.util.UriUtils; +import static org.apache.commons.lang3.StringUtils.* + +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +/** + * This groovy class supports the DoCreateAllottedResourceTXC.bpmn process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDEbugLogEnabled + * @param - disableRollback + * @param - failExists - O + * @param - serviceInstanceId + * @param - globalCustomerId - O + * @param - subscriptionServiceType - O + * @param - parentServiceInstanceId + * @param - allottedReourceId - O + * @param - allottedResourceModelInfo + * @param - allottedResourceRole + * @param - allottedResourceType + * @param - brgWanMacAddress + * + * Outputs: + * @param - rollbackData (localRB->null) + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * @param - WorkflowException - O + * @param - allottedResourceId + * @param - allottedResourceName + * @param - vni + * @param - vgmuxBearerIP + * @param - vgmuxLanIP + * + */ +public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceTXC.class); + + String Prefix="DCARTXC_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + + + String msg = "" + msoLogger.trace("start preProcessRequest") + + try { + String msoRequestId = execution.getVariable("msoRequestId") + msoLogger.debug(" msoRequestId = " + msoRequestId) + + execution.setVariable("prefix", Prefix) + + //Config Inputs + String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + if (isBlank(sdncCallbackUrl)) { + msg = "mso.workflow.sdncadapter.callback is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + + String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution) + if (isBlank(sdncReplDelay)) { + msg = "mso.workflow.sdnc.replication.delay is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncReplDelay", sdncReplDelay) + msoLogger.debug("SDNC replication delay: " + sdncReplDelay) + + //Request Inputs + if (isBlank(execution.getVariable("serviceInstanceId"))){ + msg = "Input serviceInstanceId is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("parentServiceInstanceId"))) { + msg = "Input parentServiceInstanceId is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("allottedResourceModelInfo"))) { + msg = "Input allottedResourceModelInfo is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("brgWanMacAddress"))) { + msg = "Input brgWanMacAddress is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("allottedResourceRole"))) { + msg = "Input allottedResourceRole is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("allottedResourceType"))) { + msg = "Input allottedResourceType is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessRequest") + } + + public void getAaiAR (DelegateExecution execution) { + + + msoLogger.trace("start getAaiAR") + + String arType = execution.getVariable("allottedResourceType") + String arRole = execution.getVariable("allottedResourceRole") + + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String orchStatus = arUtils.getAROrchStatus(execution) + + String errorMsg = "" + + if (orchStatus != null) // AR was found + { + if ("true".equals(execution.getVariable("failExists"))) + { + errorMsg = "Allotted resource " + arType + " with Role " + arRole + " already exists" + } + else + { + if ("Active".equals(orchStatus)) + { + execution.setVariable("foundActiveAR", true) + } + else // blanks included + { + errorMsg = "Allotted Resource " + arType + " with Role " + arRole + " already exists in an incomplete state -" + orchStatus + } + } + } + if (!isBlank(errorMsg)) { + msoLogger.debug(errorMsg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) + } + msoLogger.trace("end getAaiAR") + } + + public void createAaiAR(DelegateExecution execution) { + + + msoLogger.trace("start createAaiAR") + String msg = "" + + String allottedResourceId = execution.getVariable("allottedResourceId") + if (isBlank(allottedResourceId)) + { + allottedResourceId = UUID.randomUUID().toString() + execution.setVariable("allottedResourceId", allottedResourceId) + } + String arUrl = "" + try { + + //AAI PUT + AaiUtil aaiUriUtil = new AaiUtil(this) + String aaiEndpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + String siResourceLink= execution.getVariable("PSI_resourceLink") + + String siUri = "" + msoLogger.debug("PSI_resourceLink:" + siResourceLink) + + if(!isBlank(siResourceLink)) { + msoLogger.debug("Incoming PSI Resource Link is: " + siResourceLink) + String[] split = siResourceLink.split("/aai/") + siUri = "/aai/" + split[1] + } + else + { + msg = "Parent Service Link in AAI is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + arUrl = "${aaiEndpoint}${siUri}" + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + execution.setVariable("aaiARPath", arUrl) + msoLogger.debug("GET AllottedResource AAI URL is:\n" + arUrl) + + String namespace = aaiUriUtil.getNamespaceFromUri(execution, arUrl) + + String arType = execution.getVariable("allottedResourceType") + String arRole = execution.getVariable("allottedResourceRole") + String CSI_resourceLink = execution.getVariable("CSI_resourceLink") + String arModelInfo = execution.getVariable("allottedResourceModelInfo") + msoLogger.debug("arModelInfo is:\n" + arModelInfo) + String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid") + String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid") + String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid") + + if (modelInvariantId == null) { + modelInvariantId = "" + } + if (modelVersionId == null) { + modelVersionId = "" + } + if (modelCustomizationId == null) { + modelCustomizationId = "" + } + + String payload = + """ + ${MsoUtils.xmlEscape(allottedResourceId)} + + ${MsoUtils.xmlEscape(arType)} + ${MsoUtils.xmlEscape(arRole)} + + ${MsoUtils.xmlEscape(modelInvariantId)} + ${MsoUtils.xmlEscape(modelVersionId)} + ${MsoUtils.xmlEscape(modelCustomizationId)} + PendingCreate + + + + service-instance + ${MsoUtils.xmlEscape(CSI_resourceLink)} + + + """.trim() + + execution.setVariable("AaiARPayload", payload) + msoLogger.debug(" payload to create AllottedResource in AAI:" + "\n" + payload) + + APIResponse response = aaiUriUtil.executeAAIPutCall(execution, arUrl, payload) + int responseCode = response.getStatusCode() + msoLogger.debug("AllottedResource AAI PUT responseCode:" + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + msoLogger.debug("AllottedResource AAI PUT responseStr:" + aaiResponse) + + //200 OK 201 CREATED 202 ACCEPTED + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + { + msoLogger.debug("AAI PUT AllottedResource received a Good Response") + } + else{ + msoLogger.debug("AAI Put AllottedResouce received a Bad Response Code: " + responseCode) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + } catch (Exception ex) { + msg = "Exception in createAaiAR " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + //start rollback set up + RollbackData rollbackData = new RollbackData() + def disableRollback = execution.getVariable("disableRollback") + rollbackData.put(Prefix, "disableRollback", disableRollback.toString()) + rollbackData.put(Prefix, "rollbackAAI", "true") + rollbackData.put(Prefix, "allottedResourceId", allottedResourceId) + rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId")) + rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId")) + rollbackData.put(Prefix, "aaiARPath", arUrl) + execution.setVariable("rollbackData", rollbackData) + msoLogger.trace("end createAaiAR") + } + + public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { + + + String msg = "" + msoLogger.trace("start buildSDNCRequest") + String sdncReq = null + + try { + + String allottedResourceId = execution.getVariable("allottedResourceId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String globalCustomerId = execution.getVariable("globalCustomerId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") + String serviceChainServiceInstanceId = execution.getVariable("serviceChainServiceInstanceId") + String callbackUrl = execution.getVariable("sdncCallbackUrl") + String requestId = execution.getVariable("msoRequestId") + + String brgWanMacAddress = execution.getVariable("brgWanMacAddress") + + String arModelInfo = execution.getVariable("allottedResourceModelInfo") + String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid") + String modelVersion = jsonUtil.getJsonValue(arModelInfo, "modelVersion") + String modelUUId = jsonUtil.getJsonValue(arModelInfo, "modelUuid") + String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid") + String modelName = jsonUtil.getJsonValue(arModelInfo, "modelName") + + if (modelInvariantId == null) { + modelInvariantId = "" + } + if (modelVersion == null) { + modelVersion = "" + } + if (modelUUId == null) { + modelUUId = "" + } + if (modelName == null) { + modelName = "" + } + if (modelCustomizationId == null) { + modelCustomizationId = "" + } + + sdncReq = + """ + + ${MsoUtils.xmlEscape(sdncRequestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(action)} + tunnelxconn-topology-operation + ${MsoUtils.xmlEscape(callbackUrl)} + + + + ${MsoUtils.xmlEscape(requestId)} + CreateTunnelXConnInstance + MSO + + + + + + + ${MsoUtils.xmlEscape(subscriptionServiceType)} + + ${MsoUtils.xmlEscape(serviceInstanceId)} + + ${MsoUtils.xmlEscape(globalCustomerId)} + + + ${MsoUtils.xmlEscape(allottedResourceId)} + tunnelxconn + ${MsoUtils.xmlEscape(parentServiceInstanceId)} + + ${MsoUtils.xmlEscape(modelInvariantId)} + ${MsoUtils.xmlEscape(modelUUId)} + ${MsoUtils.xmlEscape(modelCustomizationId)} + ${MsoUtils.xmlEscape(modelVersion)} + ${MsoUtils.xmlEscape(modelName)} + + + + ${MsoUtils.xmlEscape(brgWanMacAddress)} + + + """ + + msoLogger.debug("sdncRequest:\n" + sdncReq) + sdncReq = utils.formatXml(sdncReq) + + } catch(Exception ex) { + msg = "Exception in buildSDNCRequest. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end buildSDNCRequest") + return sdncReq + } + + public void preProcessSDNCAssign(DelegateExecution execution) { + + + String msg = "" + msoLogger.trace("start preProcessSDNCAssign") + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId) + execution.setVariable("sdncAssignRequest", sdncAssignReq) + msoLogger.debug("sdncAssignRequest: " + sdncAssignReq) + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq) + execution.setVariable("rollbackData", rollbackData) + + msoLogger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq) + msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCAssign. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.debug("end preProcessSDNCAssign") + } + + public void preProcessSDNCCreate(DelegateExecution execution) { + + + String msg = "" + msoLogger.trace("start preProcessSDNCCreate") + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId) + execution.setVariable("sdncCreateRequest", sdncCreateReq) + msoLogger.debug("sdncCreateReq: " + sdncCreateReq) + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq) + execution.setVariable("rollbackData", rollbackData) + + msoLogger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq) + msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCCreate. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessSDNCCreate") + } + + public void preProcessSDNCActivate(DelegateExecution execution) { + + + String msg = "" + msoLogger.trace("start preProcessSDNCActivate") + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId) + execution.setVariable("sdncActivateRequest", sdncActivateReq) + msoLogger.debug("sdncActivateReq: " + sdncActivateReq) + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq) + execution.setVariable("rollbackData", rollbackData) + + msoLogger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq) + msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCActivate. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessSDNCActivate") + } + + public void validateSDNCResp(DelegateExecution execution, String response, String method){ + + + msoLogger.trace("start ValidateSDNCResponse Process") + String msg = "" + + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + msoLogger.debug("SDNCResponse: " + response) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) + + if (!"get".equals(method)) + { + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put(Prefix, "rollback" + "SDNC" + method, "true") + execution.setVariable("rollbackData", rollbackData) + } + + }else{ + msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + throw new BpmnError("MSOWorkflowException") + } + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in validateSDNCResp. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end ValidateSDNCResp Process") + } + + public void preProcessSDNCGet(DelegateExecution execution){ + + msoLogger.trace("start preProcessSDNCGet") + try{ + + def callbackUrl = execution.getVariable("sdncCallbackUrl") + // serviceOperation (URI for topology GET) will be retrieved from "selflink" from AAI if active AR exists in AAI + // or from "object-path" in SDNC response for assign when AR does not exist in AA + + String serviceOperation = "" + + if (execution.getVariable("foundActiveAR")) { + def aaiQueryResponse = execution.getVariable("aaiARGetResponse") + serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink") + msoLogger.debug("AR service operation/aaiARSelfLink: " + serviceOperation) + } + else + { + String response = execution.getVariable("sdncAssignResponse") + String data = utils.getNodeXml(response, "response-data") + msoLogger.debug("Assign responseData: " + data) + serviceOperation = utils.getNodeText(data, "object-path") + msoLogger.debug("AR service operation:" + serviceOperation) + } + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String sdncRequestId = UUID.randomUUID().toString() + + //neeed the same url as used by vfmodules + String SDNCGetRequest = + """ + + ${MsoUtils.xmlEscape(sdncRequestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + query + ${MsoUtils.xmlEscape(serviceOperation)} + ${MsoUtils.xmlEscape(callbackUrl)} + vfmodule + + + """ + + execution.setVariable("sdncGetRequest", SDNCGetRequest) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage()) + } + msoLogger.trace("end preProcessSDNCGet") + } + + public void updateAaiAROrchStatus(DelegateExecution execution, String status){ + + msoLogger.trace("start updateAaiAROrchStatus") + String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) + msoLogger.trace("end updateAaiAROrchStatus") + } + + public void generateOutputs(DelegateExecution execution) + { + + msoLogger.trace("start generateOutputs") + try { + String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped + msoLogger.debug("resp:" + sdncGetResponse) + String arData = utils.getNodeXml(sdncGetResponse, "tunnelxconn-topology") + arData = utils.removeXmlNamespaces(arData) + + String txca = utils.getNodeXml(arData, "tunnelxconn-assignments") + execution.setVariable("vni", utils.getNodeText(txca, "vni")) + execution.setVariable("vgmuxBearerIP", utils.getNodeText(txca, "vgmux-bearer-ip")) + execution.setVariable("vgmuxLanIP", utils.getNodeText(txca, "vgmux-lan-ip")) + + String ari = utils.getNodeXml(arData, "allotted-resource-identifiers") + execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name")) + } catch (BpmnError e) { + msoLogger.debug("BPMN Error in generateOutputs ") + } catch(Exception ex) { + String msg = "Exception in generateOutputs " + ex.getMessage() + msoLogger.debug(msg) + } + msoLogger.trace("end generateOutputs") + + } + + public void preProcessRollback (DelegateExecution execution) { + + msoLogger.trace("start preProcessRollback") + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage()) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + msoLogger.debug("BPMN Error during preProcessRollback") + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + msoLogger.debug(msg) + } + msoLogger.trace("end preProcessRollback") + } + + public void postProcessRollback (DelegateExecution execution) { + + msoLogger.trace("start postProcessRollback") + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + msoLogger.debug("Setting prevException to WorkflowException: ") + execution.setVariable("WorkflowException", workflowException); + } + execution.setVariable("rollbackData", null) + } catch (BpmnError b) { + msoLogger.debug("BPMN Error during postProcessRollback") + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + msoLogger.debug(msg) + } + msoLogger.trace("end postProcessRollback") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy new file mode 100644 index 0000000000..24b919524f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy @@ -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.bpmn.vcpe.scripts; + +import org.onap.so.bpmn.common.scripts.*; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.rest.APIResponse + +import java.util.UUID; +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.springframework.web.util.UriUtils; +import static org.apache.commons.lang3.StringUtils.* + +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +/** + * This groovy class supports the CreateAllottedResourceTXCRollback.bpmn process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDebugLogEnabled + * @param - disableRollback - O + * @param - rollbackData + * + * Outputs: + * @param - rollbackError + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * + */ +public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceTXCRollback.class); + + String Prefix="DCARTXCRB_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void preProcessRequest (DelegateExecution execution) { + + + String msg = "" + msoLogger.trace("start preProcessRequest") + execution.setVariable("prefix", Prefix) + String rbType = "DCARTXC_" + try { + + def rollbackData = execution.getVariable("rollbackData") + msoLogger.debug("RollbackData:" + rollbackData) + + if (rollbackData != null) { + if (rollbackData.hasType(rbType)) { + + execution.setVariable("serviceInstanceId", rollbackData.get(rbType, "serviceInstanceId")) + execution.setVariable("parentServiceInstanceId", rollbackData.get(rbType, "parentServiceInstanceId")) + execution.setVariable("allottedResourceId", rollbackData.get("SERVICEINSTANCE", "allottedResourceId")) + + + def rollbackAAI = rollbackData.get(rbType, "rollbackAAI") + if ("true".equals(rollbackAAI)) + { + execution.setVariable("rollbackAAI",true) + execution.setVariable("aaiARPath", rollbackData.get(rbType, "aaiARPath")) + + } + def rollbackSDNC = rollbackData.get(rbType, "rollbackSDNCassign") + if ("true".equals(rollbackSDNC)) + { + execution.setVariable("rollbackSDNC", true) + execution.setVariable("deactivateSdnc", rollbackData.get(rbType, "rollbackSDNCactivate")) + execution.setVariable("deleteSdnc", rollbackData.get(rbType, "rollbackSDNCcreate")) + execution.setVariable("unassignSdnc", rollbackData.get(rbType, "rollbackSDNCassign")) + + msoLogger.debug("sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") ) + msoLogger.debug("sdncDelete:\n" + execution.getVariable("deleteSdnc")) + msoLogger.debug("sdncUnassign:\n" + execution.getVariable("unassignSdnc")) + + execution.setVariable("sdncDeactivateRequest", rollbackData.get(rbType, "sdncActivateRollbackReq")) + execution.setVariable("sdncDeleteRequest", rollbackData.get(rbType, "sdncCreateRollbackReq")) + execution.setVariable("sdncUnassignRequest", rollbackData.get(rbType, "sdncAssignRollbackReq")) + } + + if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackSDNC") != true) + { + execution.setVariable("skipRollback", true) + } + } + else { + execution.setVariable("skipRollback", true) + } + } + else { + execution.setVariable("skipRollback", true) + } + if (execution.getVariable("disableRollback").equals("true" )) + { + execution.setVariable("skipRollback", true) + } + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessRequest") + } + + // aaiARPath set during query (existing AR) + public void updateAaiAROrchStatus(DelegateExecution execution, String status){ + + String msg = null; + msoLogger.trace("start updateAaiAROrchStatus") + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String aaiARPath = execution.getVariable("aaiARPath") + msoLogger.debug(" aaiARPath:" + aaiARPath) + String ar = null; //need this for getting resourceVersion for delete + if (!isBlank(aaiARPath)) + { + ar = arUtils.getARbyLink(execution, aaiARPath, "") + } + if (isBlank(ar)) + { + msg = "AR not found in AAI at:" + aaiARPath + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) + msoLogger.trace("end updateAaiAROrchStatus") + } + + public void validateSDNCResp(DelegateExecution execution, String response, String method){ + + + msoLogger.trace("start ValidateSDNCResponse Process") + String msg = "" + + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + msoLogger.debug("SDNCResponse: " + response) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) + + }else{ + + msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + throw new BpmnError("MSOWorkflowException") + } + } catch (BpmnError e) { + if ("404".contentEquals(e.getErrorCode())) + { + msg = "SDNC rollback " + method + " returned a 404. Proceding with rollback" + msoLogger.debug(msg) + } + else { + throw e; + } + } catch(Exception ex) { + msg = "Exception in validateSDNCResp. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit ValidateSDNCResp Process") + } + + public void deleteAaiAR(DelegateExecution execution){ + + try{ + msoLogger.trace("start deleteAaiAR") + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String ar = null //need to get resource-version + String arLink = execution.getVariable("aaiARPath") + if (!isBlank(arLink)) + { + ar = arUtils.getARbyLink(execution, arLink, "") + } + arUtils.deleteAR(execution, arLink + '?resource-version=' + UriUtils.encode(execution.getVariable("aaiARResourceVersion"),"UTF-8")) + } catch (BpmnError e) { + throw e; + }catch(Exception ex){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) + } + msoLogger.trace("end deleteAaiAR") + } + + public void postProcessRequest(DelegateExecution execution) { + + msoLogger.trace("start postProcessRequest") + String msg = "" + try { + execution.setVariable("rollbackData", null) + boolean skipRollback = execution.getVariable("skipRollback") + if (skipRollback != true) + { + execution.setVariable("rolledBack", true) + msoLogger.debug("rolledBack") + } + msoLogger.trace("end postProcessRequest") + + } catch (BpmnError e) { + msoLogger.debug(msg) + } catch (Exception ex) { + msg = "Exception in postProcessRequest. " + ex.getMessage() + msoLogger.debug(msg) + } + + } + + public void processRollbackException(DelegateExecution execution){ + + msoLogger.trace("start processRollbackException") + try{ + msoLogger.debug("Caught an Exception in DoCreateAllottedResourceRollback") + execution.setVariable("rollbackData", null) + execution.setVariable("rolledBack", false) + execution.setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback") + execution.setVariable("WorkflowException", null) + + }catch(BpmnError b){ + msoLogger.debug("BPMN Error during processRollbackExceptions Method: ") + }catch(Exception e){ + msoLogger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage()) + } + + msoLogger.trace("end processRollbackException") + } + + public void processRollbackJavaException(DelegateExecution execution){ + + msoLogger.trace("start processRollbackJavaException") + try{ + execution.setVariable("rollbackData", null) + execution.setVariable("rolledBack", false) + execution.setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback") + msoLogger.debug("Caught Exception in processRollbackJavaException") + + }catch(Exception e){ + msoLogger.debug("Caught Exception in processRollbackJavaException " + e.getMessage()) + } + msoLogger.trace("end processRollbackJavaException") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy new file mode 100644 index 0000000000..a5125fea73 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy @@ -0,0 +1,368 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe.scripts; + +import org.onap.so.bpmn.common.scripts.*; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.rest.APIResponse + +import java.util.UUID; +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.springframework.web.util.UriUtils; +import static org.apache.commons.lang3.StringUtils.* +import org.onap.so.bpmn.core.UrnPropertiesReader; + +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +/** + * This groovy class supports the DoDeleteAllottedResourceBRG.bpmn process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDebugLogEnabled + * @param - disableRollback - O ignored + * @param - failNotfound - O + * @param - serviceInstanceId + * @param - globalCustomerId - O + * @param - subscriptionServiceType - O + * @param - parentServiceInstanceId + * @param - allottedResourceId + * + * Outputs: + * @param - rollbackData - N/A + * @param - rolledBack - true if no deletions performed + * @param - WorkflowException - O + * @param - wasDeleted - O (ie not silentSuccess) + * + */ +public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteAllottedResourceBRG.class); + + String Prefix="DDARBRG_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void preProcessRequest (DelegateExecution execution) { + + String msg = "" + msoLogger.trace("start preProcessRequest") + + try { + execution.setVariable("prefix", Prefix) + + //Config Inputs + String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + if (isBlank(sdncCallbackUrl)) { + msg = "mso.workflow.sdncadapter.callback is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + + //Request Inputs + if (isBlank(execution.getVariable("serviceInstanceId"))){ + msg = "Input serviceInstanceId is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("allottedResourceId"))){ + msg = "Input allottedResourceId is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessRequest") + } + + public void getAaiAR (DelegateExecution execution) { + + msoLogger.trace("start getAaiAR end") + + String allottedResourceId = execution.getVariable("allottedResourceId") + + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String ar = arUtils.getARbyId(execution, allottedResourceId) + + String errorMsg = "" + if (isBlank(ar)) // AR was !found + { + errorMsg = "Allotted resource not found in AAI with AllottedResourceId:" + allottedResourceId + } + else + { + String aaiARPath = execution.getVariable("aaiARPath") + String parentServiceInstanceId = arUtils.getPSIFmARLink(execution, aaiARPath) + execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) + } + if (!isBlank(errorMsg)) { + msoLogger.debug(errorMsg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) + } + msoLogger.trace("end getAaiAR") + + } + + // aaiARPath set during query (existing AR) + public void updateAaiAROrchStatus(DelegateExecution execution, String status){ + msoLogger.trace("start updateAaiAROrchStatus") + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) + String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) + msoLogger.trace("end updateAaiAROrchStatus") + } + + public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { + + String msg = "" + msoLogger.trace("start buildSDNCRequest") + String sdncReq = null + + try { + + String allottedResourceId = execution.getVariable("allottedResourceId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") + String globalCustomerId = execution.getVariable("globalCustomerId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + String callbackUrl = execution.getVariable("sdncCallbackUrl") + String requestId = execution.getVariable("msoRequestId") + + String serviceChainServiceInstanceId = "" + String sourceNetworkId = "" + String sourceNetworkRole = "" + String allottedResourceRole = "" + + String arModelInfo = "" + String modelInvariantId = "" + String modelVersion = "" + String modelUUId = "" + String modelCustomizationId = "" + String modelName = "" + + + sdncReq = + """ + + ${MsoUtils.xmlEscape(sdncRequestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(action)} + brg-topology-operation + ${MsoUtils.xmlEscape(callbackUrl)} + + + + ${MsoUtils.xmlEscape(requestId)} + DeleteBRGInstance + MSO + + + + + + + ${MsoUtils.xmlEscape(subscriptionServiceType)} + + ${MsoUtils.xmlEscape(serviceInstanceId)} + + ${MsoUtils.xmlEscape(globalCustomerId)} + + + ${MsoUtils.xmlEscape(allottedResourceId)} + brg + ${MsoUtils.xmlEscape(parentServiceInstanceId)} + + ${MsoUtils.xmlEscape(modelInvariantId)} + ${MsoUtils.xmlEscape(modelUUId)} + ${MsoUtils.xmlEscape(modelCustomizationId)} + ${MsoUtils.xmlEscape(modelVersion)} + ${MsoUtils.xmlEscape(modelName)} + + + + + + """ + + msoLogger.debug("sdncRequest:\n" + sdncReq) + sdncReq = utils.formatXml(sdncReq) + + } catch(Exception ex) { + msg = "Exception in buildSDNCRequest. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end buildSDNCRequest") + return sdncReq + } + + public void preProcessSDNCUnassign(DelegateExecution execution) { + + String msg = "" + msoLogger.trace("start preProcessSDNCUnassign") + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncUnassignReq = buildSDNCRequest(execution, "unassign", sdncRequestId) + execution.setVariable("sdncUnassignRequest", sdncUnassignReq) + msoLogger.debug("sdncUnassignRequest: " + sdncUnassignReq) + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCUnassign. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessSDNCUnassign") + } + + public void preProcessSDNCDelete(DelegateExecution execution) { + + String msg = "" + msoLogger.trace("start preProcessSDNCDelete") + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncDeleteReq = buildSDNCRequest(execution, "delete", sdncRequestId) + execution.setVariable("sdncDeleteRequest", sdncDeleteReq) + msoLogger.debug("sdncDeleteReq: " + sdncDeleteReq) + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessSDNCDelete") + } + + public void preProcessSDNCDeactivate(DelegateExecution execution) { + + String msg = "" + msoLogger.trace("start preProcessSDNCDeactivate") + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncDeactivateReq = buildSDNCRequest(execution, "deactivate", sdncRequestId) + execution.setVariable("sdncDeactivateRequest", sdncDeactivateReq) + msoLogger.debug("sdncDeactivateReq: " + sdncDeactivateReq) + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCDeactivate. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessSDNCDeactivate") + } + + public void validateSDNCResp(DelegateExecution execution, String response, String method){ + + msoLogger.trace("start ValidateSDNCResponse Process") + String msg = "" + + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + msoLogger.debug("SDNCResponse: " + response) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) + + }else{ + String sdncRespCode = execution.getVariable(Prefix + 'sdncRequestDataResponseCode') + msoLogger.debug(method + " AllottedResource received error response from SDNC. ResponseCode:" + sdncRespCode) + if (sdncRespCode.equals("404") && "deactivate".equals(method)) + { + execution.setVariable("ARNotFoundInSDNC", true) + if ("true".equals(execution.getVariable("failNotFound"))) + { + msg = "Allotted Resource Not found in SDNC" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + else + { + execution.setVariable("wasDeleted", false) + } + } + else + { + throw new BpmnError("MSOWorkflowException") + } + } + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in validateSDNCResp. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end ValidateSDNCResp Process") + } + + public void deleteAaiAR(DelegateExecution execution){ + msoLogger.trace("start deleteAaiAR") + + try{ + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String ar = null //need to get resource-version again + String arLink = execution.getVariable("aaiARPath") + if (!isBlank(arLink)) + { + ar = arUtils.getARbyLink(execution, arLink, "") + } + arUtils.deleteAR(execution, arLink + '?resource-version=' + UriUtils.encode(execution.getVariable("aaiARResourceVersion"),"UTF-8")) + } catch (BpmnError e) { + throw e; + }catch(Exception ex){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest." + ex, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:" + ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) + } + msoLogger.trace("end deleteAaiAR") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy new file mode 100644 index 0000000000..7ce606e685 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy @@ -0,0 +1,369 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe.scripts; + +import org.onap.so.bpmn.common.scripts.*; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.rest.APIResponse + +import java.util.UUID; +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.springframework.web.util.UriUtils; +import static org.apache.commons.lang3.StringUtils.* +import org.onap.so.bpmn.core.UrnPropertiesReader; + +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +/** + * This groovy class supports the DoDeleteAllottedResourceTXC.bpmn process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDebugLogEnabled + * @param - disableRollback - O ignored + * @param - failNotfound - O + * @param - serviceInstanceId + * @param - globalCustomerId - O + * @param - subscriptionServiceType - O + * @param - parentServiceInstanceId + * @param - allottedResourceId + * + * Outputs: + * @param - rollbackData - N/A + * @param - rolledBack - true if no deletions performed + * @param - WorkflowException - O + * @param - wasDeleted - O (ie not silentSuccess) + * + */ +public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteAllottedResourceTXC.class); + + String Prefix="DDARTXC_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void preProcessRequest (DelegateExecution execution) { + + String msg = "" + msoLogger.trace("start preProcessRequest") + + try { + execution.setVariable("prefix", Prefix) + + //Config Inputs + String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) + if (isBlank(sdncCallbackUrl)) { + msg = "mso.workflow.sdncadapter.callback is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + + //Request Inputs + if (isBlank(execution.getVariable("serviceInstanceId"))){ + msg = "Input serviceInstanceId is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("allottedResourceId"))){ + msg = "Input allottedResourceId is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessRequest") + } + + public void getAaiAR (DelegateExecution execution) { + + msoLogger.trace("start getAaiAR") + + String allottedResourceId = execution.getVariable("allottedResourceId") + + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String ar = arUtils.getARbyId(execution, allottedResourceId) + + String errorMsg = "" + if (isBlank(ar)) // AR was !found + { + errorMsg = "Allotted resource not found in AAI with AllottedResourceId:" + allottedResourceId + } + else + { + String aaiARPath = execution.getVariable("aaiARPath") + String parentServiceInstanceId = arUtils.getPSIFmARLink(execution, aaiARPath) + execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) + } + if (!isBlank(errorMsg)) { + msoLogger.debug(errorMsg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) + } + msoLogger.trace("end getAaiAR") + + } + + // aaiARPath set during query (existing AR) + public void updateAaiAROrchStatus(DelegateExecution execution, String status){ + msoLogger.trace("start updateAaiAROrchStatus") + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) + String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) + msoLogger.trace("end updateAaiAROrchStatus") + } + + public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { + + String msg = "" + msoLogger.trace("start buildSDNCRequest") + String sdncReq = null + + try { + + String allottedResourceId = execution.getVariable("allottedResourceId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") + String globalCustomerId = execution.getVariable("globalCustomerId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + String callbackUrl = execution.getVariable("sdncCallbackUrl") + String requestId = execution.getVariable("msoRequestId") + + String serviceChainServiceInstanceId = "" + String sourceNetworkId = "" + String sourceNetworkRole = "" + String allottedResourceRole = "" + + String arModelInfo = "" + String modelInvariantId = "" + String modelVersion = "" + String modelUUId = "" + String modelCustomizationId = "" + String modelName = "" + + + sdncReq = + """ + + ${MsoUtils.xmlEscape(sdncRequestId)} + ${MsoUtils.xmlEscape(serviceInstanceId)} + ${MsoUtils.xmlEscape(action)} + tunnelxconn-topology-operation + ${MsoUtils.xmlEscape(callbackUrl)} + + + + ${MsoUtils.xmlEscape(requestId)} + DeleteTunnelXConnInstance + MSO + + + + + + + ${MsoUtils.xmlEscape(subscriptionServiceType)} + + ${MsoUtils.xmlEscape(serviceInstanceId)} + + ${MsoUtils.xmlEscape(globalCustomerId)} + + + ${MsoUtils.xmlEscape(allottedResourceId)} + tunnelxconn + ${MsoUtils.xmlEscape(parentServiceInstanceId)} + + ${MsoUtils.xmlEscape(modelInvariantId)} + ${MsoUtils.xmlEscape(modelUUId)} + ${MsoUtils.xmlEscape(modelCustomizationId)} + ${MsoUtils.xmlEscape(modelVersion)} + ${MsoUtils.xmlEscape(modelName)} + + + + + + """ + + msoLogger.debug("sdncRequest:\n" + sdncReq) + sdncReq = utils.formatXml(sdncReq) + + } catch(Exception ex) { + msg = "Exception in buildSDNCRequest. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end buildSDNCRequest") + return sdncReq + } + + public void preProcessSDNCUnassign(DelegateExecution execution) { + + String msg = "" + msoLogger.trace("start preProcessSDNCUnassign") + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncUnassignReq = buildSDNCRequest(execution, "unassign", sdncRequestId) + execution.setVariable("sdncUnassignRequest", sdncUnassignReq) + msoLogger.debug("sdncUnassignRequest: " + sdncUnassignReq) + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCUnassign. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessSDNCUnassign") + } + + public void preProcessSDNCDelete(DelegateExecution execution) { + + String msg = "" + msoLogger.trace("start preProcessSDNCDelete") + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncDeleteReq = buildSDNCRequest(execution, "delete", sdncRequestId) + execution.setVariable("sdncDeleteRequest", sdncDeleteReq) + msoLogger.debug("sdncDeleteReq: " + sdncDeleteReq) + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessSDNCDelete") + } + + public void preProcessSDNCDeactivate(DelegateExecution execution) { + + String msg = "" + msoLogger.trace("start preProcessSDNCDeactivate") + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncDeactivateReq = buildSDNCRequest(execution, "deactivate", sdncRequestId) + execution.setVariable("sdncDeactivateRequest", sdncDeactivateReq) + msoLogger.debug("sdncDeactivateReq: " + sdncDeactivateReq) + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCDeactivate. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end preProcessSDNCDeactivate") + } + + public void validateSDNCResp(DelegateExecution execution, String response, String method){ + + msoLogger.trace("start ValidateSDNCResponse Process") + String msg = "" + + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + msoLogger.debug("workflowException: " + workflowException) + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + msoLogger.debug("SDNCResponse: " + response) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) + + }else{ + String sdncRespCode = execution.getVariable(Prefix + 'sdncRequestDataResponseCode') + msoLogger.debug(method + " AllottedResource received error response from SDNC. ResponseCode:" + sdncRespCode) + if (sdncRespCode.equals("404") && "deactivate".equals(method)) + { + execution.setVariable("ARNotFoundInSDNC", true) + if ("true".equals(execution.getVariable("failNotFound"))) + { + msg = "Allotted Resource Not found in SDNC" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + else + { + execution.setVariable("wasDeleted", false) + } + } + else + { + throw new BpmnError("MSOWorkflowException") + } + } + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in validateSDNCResp. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("end Exit ValidateSDNCResp Process") + } + + public void deleteAaiAR(DelegateExecution execution){ + msoLogger.trace("start deleteAaiAR") + + try{ + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String ar = null //need to get resource-version again + String arLink = execution.getVariable("aaiARPath") + if (!isBlank(arLink)) + { + ar = arUtils.getARbyLink(execution, arLink, "") + } + arUtils.deleteAR(execution, arLink + '?resource-version=' + UriUtils.encode(execution.getVariable("aaiARResourceVersion"),"UTF-8")) + } catch (BpmnError e) { + throw e; + }catch(Exception ex){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) + } + msoLogger.trace("end deleteAaiAR") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/META-INF/processes.xml b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/META-INF/processes.xml new file mode 100644 index 0000000000..13a24c8b8b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/META-INF/processes.xml @@ -0,0 +1,37 @@ + + + + + + + + + false + true + + 06:00 + 09:00 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CompareModelofE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CompareModelofE2EServiceInstance.bpmn new file mode 100644 index 0000000000..086171ec98 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CompareModelofE2EServiceInstance.bpmn @@ -0,0 +1,335 @@ + + + + + SequenceFlow_0s2spoq + + + + SequenceFlow_1dsbjjb + SequenceFlow_1yay321 + + + + SequenceFlow_1dsbjjb + + + + SequenceFlow_1yay321 + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0tm7z1o + SequenceFlow_0klbpxx + + + SequenceFlow_0yayvrf + + + SequenceFlow_0s2spoq + SequenceFlow_0tm7z1o + + + + + SequenceFlow_0e1r62n + + + + SequenceFlow_1ysapam + + + SequenceFlow_0n9pexp + SequenceFlow_01umodj + + + + + + + + + + + + SequenceFlow_01umodj + SequenceFlow_1ysapam + + + SequenceFlow_0e1r62n + SequenceFlow_0n9pexp + + + + + + + + + SequenceFlow_0klbpxx + SequenceFlow_12jdmq5 + + + + SequenceFlow_12jdmq5 + SequenceFlow_1fueo69 + SequenceFlow_0y8s0kd + + + SequenceFlow_1fueo69 + + + + + + + + + + + + + + + + + + SequenceFlow_0a01ez6 + SequenceFlow_0yayvrf + + + + + SequenceFlow_0y8s0kd + SequenceFlow_0a01ez6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn new file mode 100644 index 0000000000..8f2bf67b71 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn @@ -0,0 +1,325 @@ + + + + + + + + + + + + + + + + + + #{!aaiContainsInfoAboutPnf} + + + + + + + + + #{!aaiContainsInfoAboutIp} + + + #{aaiContainsInfoAboutPnf} + + + #{aaiContainsInfoAboutIp} + + + SequenceFlow_0p09qgm + + + SequenceFlow_1miyzfe + + + + SequenceFlow_1h6yz62 + + + SequenceFlow_0j5ksz1 + + + + SequenceFlow_0967g8p + SequenceFlow_1j4r3zt + + + SequenceFlow_1j4r3zt + SequenceFlow_1l1t6ak + SequenceFlow_0v5ffpe + + + SequenceFlow_0v5ffpe + SequenceFlow_1qr6cmf + + + SequenceFlow_1l1t6ak + SequenceFlow_1h6yz62 + SequenceFlow_1ls8pua + + + SequenceFlow_1qr6cmf + SequenceFlow_1ls8pua + SequenceFlow_17s9025 + + + SequenceFlow_17s9025 + SequenceFlow_1o8od8e + + + SequenceFlow_1o8od8e + SequenceFlow_0p09qgm + + + SequenceFlow_1kc34bc + + #{timeoutForPnfEntryNotification} + + + + SequenceFlow_1kc34bc + SequenceFlow_1miyzfe + + + SequenceFlow_0j5ksz1 + SequenceFlow_0967g8p + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn new file mode 100644 index 0000000000..6f73b46e2e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn @@ -0,0 +1,391 @@ + + + + + SequenceFlow_0s2spoq + + + + SequenceFlow_1dsbjjb + SequenceFlow_1yay321 + + + + SequenceFlow_1dsbjjb + + + + SequenceFlow_1yay321 + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_19eilro + SequenceFlow_0klbpxx + + + SequenceFlow_0yayvrf + + + SequenceFlow_0s2spoq + SequenceFlow_0z4faf9 + + + + SequenceFlow_14zu6wr + SequenceFlow_0je30si + + + + + + + + + + + + SequenceFlow_0je30si + SequenceFlow_0yayvrf + + + + SequenceFlow_0e1r62n + + + + SequenceFlow_1ysapam + + + SequenceFlow_0n9pexp + SequenceFlow_01umodj + + + + + + + + + + + + SequenceFlow_01umodj + SequenceFlow_1ysapam + + + SequenceFlow_0e1r62n + SequenceFlow_0n9pexp + + + + + + + + + SequenceFlow_081z8l2 + SequenceFlow_19eilro + + + + SequenceFlow_0klbpxx + SequenceFlow_14zu6wr + SequenceFlow_1fueo69 + + + SequenceFlow_1fueo69 + + + + + + + + + + + + + + + + + SequenceFlow_0z4faf9 + SequenceFlow_1euqjsp + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1euqjsp + SequenceFlow_081z8l2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn new file mode 100644 index 0000000000..3d08fdb1d4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn @@ -0,0 +1,452 @@ + + + + + SequenceFlow_0lp2z7l + + + + SequenceFlow_10 + SequenceFlow_14 + + + + + SequenceFlow_10 + + + + + SequenceFlow_14 + + + + + + + + + + + + + + + + + + + + SequenceFlow_1hjh5zy + SequenceFlow_1lj31zp + + + SequenceFlow_095crcd + + + + SequenceFlow_0lp2z7l + SequenceFlow_0ktadna + + + + + SequenceFlow_1o4wwba + SequenceFlow_0xxvjxq + + + + + + + + + + + + SequenceFlow_0xxvjxq + SequenceFlow_095crcd + + + + + SequenceFlow_0n4umjf + + + + SequenceFlow_1ghqolv + + + SequenceFlow_14eadeb + SequenceFlow_1reso2f + + + + + + + + + + + + SequenceFlow_1reso2f + SequenceFlow_1ghqolv + + + + + + SequenceFlow_0n4umjf + SequenceFlow_14eadeb + + + + + + + SequenceFlow_0ktadna + SequenceFlow_16vhtu8 + + + + + SequenceFlow_1lj31zp + SequenceFlow_1o4wwba + SequenceFlow_1mdnv3l + + + SequenceFlow_1mdnv3l + + + + + + + + + + SequenceFlow_16vhtu8 + + + + + SequenceFlow_1tfe975 + + + + SequenceFlow_1hjh5zy + + + + SequenceFlow_14ajbme + + + + SequenceFlow_1tfe975 + SequenceFlow_0xhu1k3 + + + + + + + + + + + + SequenceFlow_0xhu1k3 + SequenceFlow_1o3ihrh + + + SequenceFlow_1o3ihrh + SequenceFlow_14ajbme + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateNetworkInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateNetworkInstance.bpmn new file mode 100644 index 0000000000..9b21b9309f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateNetworkInstance.bpmn @@ -0,0 +1,340 @@ + + + + + SequenceFlow_0lp2z7l + + + + SequenceFlow_10 + SequenceFlow_14 + + + + + SequenceFlow_10 + + + + + SequenceFlow_14 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0eto8sn + SequenceFlow_1lj31zp + + + SequenceFlow_0x3znm5 + + + SequenceFlow_095crcd + SequenceFlow_0x3znm5 + + + + + + SequenceFlow_0lp2z7l + SequenceFlow_1ablr60 + + + + + + SequenceFlow_1lj31zp + SequenceFlow_0xxvjxq + + + + + + + + + + + + SequenceFlow_0xxvjxq + SequenceFlow_095crcd + + + + + SequenceFlow_0n4umjf + + + + SequenceFlow_1ghqolv + + + SequenceFlow_0n4umjf + SequenceFlow_1s5niqb + + + + SequenceFlow_1s5niqb + SequenceFlow_1reso2f + + + + + + + + + + + + SequenceFlow_1reso2f + SequenceFlow_1ghqolv + + + + + + + + + + + SequenceFlow_1ablr60 + SequenceFlow_0rt8wax + + + + SequenceFlow_0rt8wax + SequenceFlow_0eto8sn + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn new file mode 100644 index 0000000000..29207131b6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn @@ -0,0 +1,287 @@ + + + + + SequenceFlow_1qo2pln + + + + + SequenceFlow_18l3crb + SequenceFlow_0khtova + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateSDNCNetworkResource() +dcsi.prepareSDNCRequest(execution) + + + SequenceFlow_0auvfvm + + + + + + + + + + + + + SequenceFlow_15mvedq + SequenceFlow_1ex9ov6 + + + SequenceFlow_1ex9ov6 + SequenceFlow_1kzj1j5 + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateSDNCNetworkResource() +dcsi.postCreateSDNCCall(execution) + + + + + SequenceFlow_1qo2pln + SequenceFlow_0w2es8j + String recipeParamXsdDemo="""{"operationType":"GRE"}""" +String recipeParamXsd="" +execution.setVariable("recipeParamXsd", recipeParamXsd) + + + SequenceFlow_0w2es8j + SequenceFlow_18l3crb + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateSDNCNetworkResource() +dcsi.preProcessRequest(execution) + + + + + SequenceFlow_0khtova + SequenceFlow_1mz0vdx + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateSDNCNetworkResource() +dcsi.prepareUpdateBeforeCreateSDNCResource(execution) + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1mz0vdx + SequenceFlow_15mvedq + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1kzj1j5 + SequenceFlow_0o7h0ag + + + SequenceFlow_1cd8ujq + SequenceFlow_0auvfvm + import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new CreateSDNCNetworkResource() +csi.sendSyncResponse(execution) + + + SequenceFlow_0o7h0ag + SequenceFlow_1dww8ye + SequenceFlow_05m2j56 + + + #{(execution.getVariable("isActivateRequired") == "true")} + + + + + + SequenceFlow_05m2j56 + SequenceFlow_05niqbf + SequenceFlow_1cd8ujq + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateSDNCNetworkResource() +dcsi.prepareUpdateAfterCreateSDNCResource(execution) + + + + + + + SequenceFlow_1dww8ye + SequenceFlow_05niqbf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVFCNSResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVFCNSResource.bpmn new file mode 100644 index 0000000000..9724a9313d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVFCNSResource.bpmn @@ -0,0 +1,277 @@ + + + + + SequenceFlow_1qo2pln + + + + + + SequenceFlow_0khtova + SequenceFlow_1uiz85h + + + + SequenceFlow_1qo2pln + SequenceFlow_0khtova + + + + createNSSuccess_SequenceFlow + SequenceFlow_1ywe21t + + + + SequenceFlow_1uiz85h + createNSSuccess_SequenceFlow + createNSFailed_SequenceFlow + + + + + + + + + SequenceFlow_1ywe21t + instantiateFailed_SequenceFlow + instantiateSuccess_SequenceFlow + + + + + + + + + + SequenceFlow_0xqo13p + operationFinished_SequenceFlow + operationProcessing_SequenceFlow + + + + + + + + + + createNSFailed_SequenceFlow + + + instantiateFailed_SequenceFlow + + + SequenceFlow_1lwqmo9 + + + instantiateSuccess_SequenceFlow + SequenceFlow_1gsbpxj + SequenceFlow_0xqo13p + + + + operationFinished_SequenceFlow + SequenceFlow_0cq2q6g + + + + + operationProcessing_SequenceFlow + SequenceFlow_1gsbpxj + + + + + SequenceFlow_0cq2q6g + SequenceFlow_1lwqmo9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService.bpmn new file mode 100644 index 0000000000..9ea6a9b5c4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService.bpmn @@ -0,0 +1,1539 @@ + + + + + SequenceFlow_7 + SequenceFlow_3 + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_7 + + + + + SequenceFlow_1eu60rt + + + + SequenceFlow_0afe2pg + SequenceFlow_29 + + + + + + + + + + + + + + + SequenceFlow_29 + SequenceFlow_8 + + + + SequenceFlow_8 + SequenceFlow_6 + + + + + SequenceFlow_6 + + + + + SequenceFlow_2 + + + + SequenceFlow_5 + + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + SequenceFlow_12ilko1 + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0j6sjye + SequenceFlow_1ky2sv9 + + + SequenceFlow_3 + + + + + SequenceFlow_0zq7i3q + SequenceFlow_0zpbskl + SequenceFlow_0dhf2js + + + SequenceFlow_0zq7i3q + + + + SequenceFlow_0zpbskl + SequenceFlow_1sx5llu + SequenceFlow_02o4yqx + + + SequenceFlow_0t3mtod + SequenceFlow_19mxskt + SequenceFlow_1sl79hn + + + + + + + + + + + SequenceFlow_0807ukc + SequenceFlow_19yywk8 + + + SequenceFlow_19yywk8 + + + SequenceFlow_0jg47xm + SequenceFlow_0807ukc + + + + + + + + + + + + + + + + + + + + SequenceFlow_1a7e8l1 + SequenceFlow_1f1hd3l + + + SequenceFlow_1sx5llu + SequenceFlow_0dhf2js + SequenceFlow_1rabks0 + SequenceFlow_0jg47xm + + + + + + + SequenceFlow_19mxskt + SequenceFlow_17cz98f + SequenceFlow_0sezboq + SequenceFlow_1a7e8l1 + + + + + SequenceFlow_1f1hd3l + SequenceFlow_0sezboq + SequenceFlow_1mbymcu + SequenceFlow_00by7l7 + SequenceFlow_1lv5ld6 + + + SequenceFlow_02o4yqx + SequenceFlow_0ftzjjm + + + + SequenceFlow_0dvsqpp + SequenceFlow_1rabks0 + + + + + SequenceFlow_12dakwh + SequenceFlow_0orpdrl + SequenceFlow_0ya1cr3 + + + + + + + + + + SequenceFlow_0orpdrl + SequenceFlow_1t3cnnx + + + SequenceFlow_0ya1cr3 + SequenceFlow_1sim44y + SequenceFlow_027lz43 + + + + + + + + SequenceFlow_027lz43 + SequenceFlow_1kpdu1j + SequenceFlow_007p8k3 + + + SequenceFlow_1kpdu1j + SequenceFlow_1quvahv + SequenceFlow_0t3mtod + + + + SequenceFlow_1t3cnnx + SequenceFlow_1sim44y + SequenceFlow_0dr2fem + + + + + + + SequenceFlow_1mpsdaj + SequenceFlow_1quvahv + SequenceFlow_1mbymcu + + + + + + + SequenceFlow_0ftzjjm + SequenceFlow_12dakwh + SequenceFlow_09nn9a9 + + + + + SequenceFlow_1lv5ld6 + SequenceFlow_09nn9a9 + SequenceFlow_0dr2fem + SequenceFlow_0dvsqpp + + + + + + + + + + + + + + + + + SequenceFlow_1sl79hn + SequenceFlow_0ne9n0g + + + + + + SequenceFlow_0ne9n0g + SequenceFlow_00by7l7 + SequenceFlow_17cz98f + + + + + + + + + + + + + + + + + + SequenceFlow_007p8k3 + SequenceFlow_1mpsdaj + + + + + + + + SequenceFlow_15odbkz + SequenceFlow_0j6sjye + + + + SequenceFlow_12ilko1 + SequenceFlow_0afe2pg + + + + + + SequenceFlow_1jbuf1t + + + + + + + + + + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + POST + + soap-http-connector + + + SequenceFlow_0vj46ej + SequenceFlow_0sjpja4 + + + SequenceFlow_1ky2sv9 + SequenceFlow_0vj46ej + + + + + + + + + + + + + + SequenceFlow_00h6hmd + SequenceFlow_17g05fd + + + SequenceFlow_1eu60rt + SequenceFlow_00h6hmd + + + + + + SequenceFlow_0x9pjgm + SequenceFlow_1kgaq0j + + + + SequenceFlow_0x9pjgm + + + + + SequenceFlow_1kgaq0j + SequenceFlow_0ofjahh + SequenceFlow_16qob4p + + + SequenceFlow_0ofjahh + SequenceFlow_1cgpklo + SequenceFlow_0o6tf9p + + + + + + + + SequenceFlow_15odbkz + + + + SequenceFlow_1db0ri1 + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_11efpvh + SequenceFlow_1jbuf1t + + + + + SequenceFlow_15vce9o + + + + SequenceFlow_0hwsm6n + + + + SequenceFlow_0yecpl2 + SequenceFlow_0loks1u + SequenceFlow_0b5ztoe + + + SequenceFlow_0loks1u + SequenceFlow_0e9e6fo + SequenceFlow_0hwsm6n + + + + + + + + SequenceFlow_15vce9o + SequenceFlow_0yecpl2 + + + + + + SequenceFlow_0o6tf9p + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0ws7fjn + SequenceFlow_1mkdhw9 + + + SequenceFlow_0p75l97 + SequenceFlow_0ws7fjn + + + + SequenceFlow_1ufio7c + + + + SequenceFlow_0aza7xq + + + + SequenceFlow_0aza7xq + SequenceFlow_0p75l97 + SequenceFlow_13iuk3s + + + SequenceFlow_13iuk3s + SequenceFlow_0k5vcuu + SequenceFlow_1ufio7c + + + + in 1702 scope only one VNF will be created + + + 0}]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_16qob4p + SequenceFlow_1cgpklo + + + + SequenceFlow_17g05fd + SequenceFlow_11efpvh + + + + + SequenceFlow_1mkdhw9 + SequenceFlow_0k5vcuu + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0b5ztoe + SequenceFlow_0e9e6fo + + + + SequenceFlow_0sjpja4 + SequenceFlow_1db0ri1 + + ${aaiDistDelay} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn new file mode 100644 index 0000000000..06c517c12d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn @@ -0,0 +1,1443 @@ + + + + + SequenceFlow_7 + SequenceFlow_3 + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_7 + + + + + SequenceFlow_1eu60rt + + + + SequenceFlow_0afe2pg + SequenceFlow_29 + + + + + + + + + + + + + + + SequenceFlow_29 + SequenceFlow_8 + + + + SequenceFlow_8 + SequenceFlow_6 + + + + + SequenceFlow_6 + + + + + SequenceFlow_2 + + + + SequenceFlow_5 + + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + SequenceFlow_12ilko1 + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0j6sjye + SequenceFlow_1ky2sv9 + + + SequenceFlow_3 + + + + + SequenceFlow_0zq7i3q + SequenceFlow_0zpbskl + SequenceFlow_0dhf2js + + + SequenceFlow_0zq7i3q + + + + SequenceFlow_0zpbskl + SequenceFlow_1sx5llu + SequenceFlow_02o4yqx + + + SequenceFlow_0t3mtod + SequenceFlow_19mxskt + SequenceFlow_1sl79hn + + + + + + + + + + + SequenceFlow_0807ukc + SequenceFlow_19yywk8 + + + SequenceFlow_19yywk8 + + + SequenceFlow_0jg47xm + SequenceFlow_0807ukc + + + + + + + + + + + + + + + + + + + + SequenceFlow_1a7e8l1 + SequenceFlow_1f1hd3l + + + SequenceFlow_1sx5llu + SequenceFlow_0dhf2js + SequenceFlow_1rabks0 + SequenceFlow_0jg47xm + + + + + + + SequenceFlow_19mxskt + SequenceFlow_17cz98f + SequenceFlow_0sezboq + SequenceFlow_1a7e8l1 + + + + + SequenceFlow_1f1hd3l + SequenceFlow_0sezboq + SequenceFlow_1mbymcu + SequenceFlow_00by7l7 + SequenceFlow_1lv5ld6 + + + SequenceFlow_02o4yqx + SequenceFlow_0ftzjjm + + + + SequenceFlow_0dvsqpp + SequenceFlow_1rabks0 + + + + + SequenceFlow_12dakwh + SequenceFlow_0orpdrl + SequenceFlow_0ya1cr3 + + + + + + + + + + SequenceFlow_0orpdrl + SequenceFlow_1t3cnnx + + + SequenceFlow_0ya1cr3 + SequenceFlow_1sim44y + SequenceFlow_027lz43 + + + + + + + + SequenceFlow_027lz43 + SequenceFlow_1kpdu1j + SequenceFlow_007p8k3 + + + SequenceFlow_1kpdu1j + SequenceFlow_1quvahv + SequenceFlow_0t3mtod + + + + SequenceFlow_1t3cnnx + SequenceFlow_1sim44y + SequenceFlow_0dr2fem + + + + + + + SequenceFlow_1mpsdaj + SequenceFlow_1quvahv + SequenceFlow_1mbymcu + + + + + + + SequenceFlow_0ftzjjm + SequenceFlow_12dakwh + SequenceFlow_09nn9a9 + + + + + SequenceFlow_1lv5ld6 + SequenceFlow_09nn9a9 + SequenceFlow_0dr2fem + SequenceFlow_0dvsqpp + + + + + + + + + + + + + + + + + SequenceFlow_1sl79hn + SequenceFlow_0ne9n0g + + + + + + SequenceFlow_0ne9n0g + SequenceFlow_00by7l7 + SequenceFlow_17cz98f + + + + + + + + + + + + + + + + + + SequenceFlow_007p8k3 + SequenceFlow_1mpsdaj + + + + + + + + SequenceFlow_15odbkz + SequenceFlow_0j6sjye + + + + SequenceFlow_12ilko1 + SequenceFlow_0afe2pg + + + + + + SequenceFlow_1jbuf1t + + + + + + + + ${URN_mso_adapters_db_endpoint} + + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + POST + + soap-http-connector + + + SequenceFlow_0vj46ej + SequenceFlow_0sjpja4 + + + SequenceFlow_1ky2sv9 + SequenceFlow_0vj46ej + + + + + + + + + + + + + + SequenceFlow_00h6hmd + SequenceFlow_17g05fd + + + SequenceFlow_1eu60rt + SequenceFlow_00h6hmd + + + + + + SequenceFlow_0x9pjgm + SequenceFlow_1kgaq0j + + + + SequenceFlow_0x9pjgm + + + + + SequenceFlow_1kgaq0j + SequenceFlow_0ofjahh + SequenceFlow_16qob4p + + + SequenceFlow_0ofjahh + SequenceFlow_1cgpklo + SequenceFlow_0o6tf9p + + + + + + + + SequenceFlow_15odbkz + + + + SequenceFlow_1db0ri1 + + + + + + + + + + + + + + + + + + SequenceFlow_11efpvh + SequenceFlow_1jbuf1t + + + + + SequenceFlow_0gj4vud + + + + SequenceFlow_0clhseq + + + + SequenceFlow_0o6tf9p + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0ws7fjn + SequenceFlow_1mkdhw9 + + + SequenceFlow_0p75l97 + SequenceFlow_0ws7fjn + + + + SequenceFlow_1ufio7c + + + + SequenceFlow_0aza7xq + + + + SequenceFlow_0aza7xq + SequenceFlow_0p75l97 + SequenceFlow_13iuk3s + + + SequenceFlow_13iuk3s + SequenceFlow_0k5vcuu + SequenceFlow_1ufio7c + + + + in 1702 scope only one VNF will be created + + + 0}]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_16qob4p + SequenceFlow_1cgpklo + + + + SequenceFlow_17g05fd + SequenceFlow_11efpvh + + + + + SequenceFlow_1mkdhw9 + SequenceFlow_0k5vcuu + + + + + SequenceFlow_0sjpja4 + SequenceFlow_1db0ri1 + + ${aaiDistDelay} + + + + + + + + + + + + + SequenceFlow_0gj4vud + SequenceFlow_0clhseq + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVfModuleInfra.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVfModuleInfra.bpmn new file mode 100644 index 0000000000..eefc2ca12c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVfModuleInfra.bpmn @@ -0,0 +1,700 @@ + + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1y7d5qk + SequenceFlow_1vx081s + SequenceFlow_4 + + + SequenceFlow_3 + SequenceFlow_1efipx3 + + + + SequenceFlow_4 + + + + + SequenceFlow_5 + + + + + SequenceFlow_5 + SequenceFlow_6 + + + + + + + + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + ${CVFMI_updateInfraRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_6 + SequenceFlow_1crl7uf + + + + SequenceFlow_0td7d9m + SequenceFlow_0u8zesf + SequenceFlow_12 + + + + + + + + + + + + + SequenceFlow_12 + SequenceFlow_14 + + + SequenceFlow_1crl7uf + updateInfraRequestResponseBad + updateInfraRequestResponseGood + + + + + + + updateInfraRequestResponseBad + + + + + SequenceFlow_0wsgnab + + + + + + + + + + SequenceFlow_10 + SequenceFlow_11 + + + + SequenceFlow_11 + + + + SequenceFlow_018p5wf + SequenceFlow_10 + + + + + + + SequenceFlow_0wsgnab + SequenceFlow_018p5wf + + + + + SequenceFlow_14 + SequenceFlow_16 + + + + SequenceFlow_16 + + + + + + SequenceFlow_15 + + + + + SequenceFlow_15 + + + + SequenceFlow_1 + SequenceFlow_3 + + + + + + SequenceFlow_1qvgrvq + SequenceFlow_1jqizzo + + + + SequenceFlow_1jqizzo + + + SequenceFlow_1qvgrvq + + + + + + + + + + + + + + + + + + + + SequenceFlow_1xggje5 + SequenceFlow_07llpjo + + + SequenceFlow_07llpjo + SequenceFlow_1vx081s + SequenceFlow_0nszq2o + + + + + SequenceFlow_0nszq2o + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_09i6f7t + SequenceFlow_1tk5ru7 + + + + SequenceFlow_1tk5ru7 + SequenceFlow_0td7d9m + SequenceFlow_0h5cld9 + + + + + SequenceFlow_0h5cld9 + + + + + + + SequenceFlow_1hk35nm + SequenceFlow_1xggje5 + SequenceFlow_1y7d5qk + + + + + + + updateInfraRequestResponseGood + SequenceFlow_020dbkp + SequenceFlow_0u8zesf + + + + + + + SequenceFlow_1efipx3 + SequenceFlow_1hk35nm + + + + + SequenceFlow_020dbkp + SequenceFlow_09i6f7t + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVfModuleVolumeInfraV1.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVfModuleVolumeInfraV1.bpmn new file mode 100644 index 0000000000..dcdcdc9d26 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVfModuleVolumeInfraV1.bpmn @@ -0,0 +1,514 @@ + + + + + SequenceFlow_1 + + + + + SequenceFlow_1tfi3sp + + + + SequenceFlow_1tfi3sp + SequenceFlow_0x34g02 + SequenceFlow_1q9kksk + + + SequenceFlow_0x34g02 + SequenceFlow_22 + + + + + SequenceFlow_1v1jx7y + SequenceFlow_18 + + + + + + + + + + + + + + SequenceFlow_18 + SequenceFlow_19 + + + + SequenceFlow_19 + + + + SequenceFlow_1q9kksk + SequenceFlow_1cu5t8k + SequenceFlow_1tfh1vm + + + SequenceFlow_1tfh1vm + SequenceFlow_0b1nrfk + + + + + + + + + + + + + + SequenceFlow_0b1nrfk + SequenceFlow_08vm13o + + + SequenceFlow_08vm13o + SequenceFlow_097zy8w + + + + SequenceFlow_22 + SequenceFlow_1cu5t8k + SequenceFlow_097zy8w + SequenceFlow_1v1jx7y + + + + + + + + + + + + + + + + + SequenceFlow_1 + SequenceFlow_4 + + + + + SequenceFlow_4 + SequenceFlow_3 + + + + + SequenceFlow_3 + SequenceFlow_volGrpNamePresent + SequenceFlow_volGrpNameMissing + + + + + + + SequenceFlow_volGrpNameMissing + SequenceFlow_7 + + + + + SequenceFlow_7 + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_volGrpNamePresent + SequenceFlow_0djjra2 + + + SequenceFlow_12 + SequenceFlow_13 + + + + + + + + + + + + + SequenceFlow_11 + SequenceFlow_12 + + + + SequenceFlow_8 + SequenceFlow_11 + + + + + + + + + ${CVMVINFRAV1_createDBRequest} + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + POST + ${response} + ${statusCode} + + http-connector + + + SequenceFlow_6 + SequenceFlow_8 + + + + SequenceFlow_13 + + + + SequenceFlow_0djjra2 + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVnfInfra.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVnfInfra.bpmn new file mode 100644 index 0000000000..6af8c2248e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVnfInfra.bpmn @@ -0,0 +1,340 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0ed0uiq + SequenceFlow_0w0m5fr + + + + SequenceFlow_8 + SequenceFlow_9 + + + + + SequenceFlow_9 + + + SequenceFlow_8 + + + + + + + + + + + + SequenceFlow_13 + SequenceFlow_14 + + + + SequenceFlow_15 + SequenceFlow_13 + + + + + SequenceFlow_14 + + + + SequenceFlow_12 + SequenceFlow_15 + + + + + SequenceFlow_12 + + + + + + SequenceFlow_01mjjk3 + SequenceFlow_16 + + + + + SequenceFlow_17 + + + + + + + + + + SequenceFlow_16 + SequenceFlow_17 + + + + + SequenceFlow_3 + SequenceFlow_0ed0uiq + + + + + + + SequenceFlow_0w0m5fr + SequenceFlow_0s4i7px + + + + SequenceFlow_0s4i7px + SequenceFlow_01mjjk3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn new file mode 100644 index 0000000000..2d68d650c5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn @@ -0,0 +1,381 @@ + + + + + SequenceFlow_1wxumid + + + + SequenceFlow_0guajy5 + SequenceFlow_0dbt753 + + + + SequenceFlow_0guajy5 + + + + SequenceFlow_0dbt753 + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0zf2qyk + SequenceFlow_07hrbs0 + + + SequenceFlow_1ab5l2q + + + SequenceFlow_1wxumid + SequenceFlow_0yowshs + + + + SequenceFlow_04urx2e + SequenceFlow_1ii935p + + + + + + + + + + + + SequenceFlow_1ii935p + SequenceFlow_1ab5l2q + + + + SequenceFlow_0for83z + + + + SequenceFlow_0hrazlh + + + SequenceFlow_1s1cbgf + SequenceFlow_1py6yqz + + + + + + + + + + + + SequenceFlow_1py6yqz + SequenceFlow_0hrazlh + + + SequenceFlow_0for83z + SequenceFlow_1s1cbgf + + + + + + + + + SequenceFlow_1dkcu9o + SequenceFlow_0zf2qyk + + + + SequenceFlow_07hrbs0 + SequenceFlow_04urx2e + SequenceFlow_1t6ekab + + + SequenceFlow_1t6ekab + + + + + + + + + + + + + + + SequenceFlow_0yowshs + SequenceFlow_0c4t26p + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_0c4t26p + SequenceFlow_1dkcu9o + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteGenericALaCarteServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteGenericALaCarteServiceInstance.bpmn new file mode 100644 index 0000000000..5c9a80072a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteGenericALaCarteServiceInstance.bpmn @@ -0,0 +1,331 @@ + + + + + SequenceFlow_0lp2z7l + + + + SequenceFlow_10 + SequenceFlow_14 + + + + + SequenceFlow_10 + + + + + SequenceFlow_14 + + + + + + + + + + + + + + + + + + SequenceFlow_0eto8sn + SequenceFlow_1lj31zp + + + SequenceFlow_095crcd + + + + SequenceFlow_0lp2z7l + SequenceFlow_0ktadna + + + + + SequenceFlow_1qjygj5 + SequenceFlow_0xxvjxq + + + + + + + + + + + + SequenceFlow_0xxvjxq + SequenceFlow_095crcd + + + + + SequenceFlow_0n4umjf + + + + SequenceFlow_1ghqolv + + + SequenceFlow_14eadeb + SequenceFlow_1reso2f + + + + + + + + + + + + SequenceFlow_1reso2f + SequenceFlow_1ghqolv + + + + + + SequenceFlow_0n4umjf + SequenceFlow_14eadeb + + + + + + + + SequenceFlow_0ktadna + SequenceFlow_0eto8sn + + + + + SequenceFlow_1lj31zp + SequenceFlow_1qjygj5 + SequenceFlow_0hgiouk + + + + + + SequenceFlow_0hgiouk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteNetworkInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteNetworkInstance.bpmn new file mode 100644 index 0000000000..a62e16525d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteNetworkInstance.bpmn @@ -0,0 +1,372 @@ + + + + + SequenceFlow_0lp2z7l + + + + SequenceFlow_10 + SequenceFlow_14 + + + + + SequenceFlow_10 + + + + + SequenceFlow_14 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0eto8sn + SequenceFlow_1lj31zp + + + SequenceFlow_0x3znm5 + + + SequenceFlow_095crcd + SequenceFlow_0x3znm5 + + + + + + SequenceFlow_0lp2z7l + SequenceFlow_1ablr60 + + + + + + SequenceFlow_1lj31zp + SequenceFlow_0xxvjxq + + + + + + + + + + + + SequenceFlow_0xxvjxq + SequenceFlow_095crcd + + + + + SequenceFlow_0n4umjf + + + + SequenceFlow_1ghqolv + + + SequenceFlow_0n4umjf + SequenceFlow_1s5niqb + + + + + + + + ${DELNI_deleteDBRequest} + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + POST + ${response} + ${statusCode} + + http-connector + + + SequenceFlow_1s5niqb + SequenceFlow_06s5eu4 + + + SequenceFlow_06s5eu4 + SequenceFlow_1reso2f + + + + + + + + + + + + SequenceFlow_1reso2f + SequenceFlow_1ghqolv + + + + + + + + + + + + SequenceFlow_1ablr60 + SequenceFlow_0rt8wax + + + + SequenceFlow_0rt8wax + SequenceFlow_0eto8sn + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn new file mode 100644 index 0000000000..a1c75a8740 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn @@ -0,0 +1,258 @@ + + + + + SequenceFlow_1qo2pln + + + + + SequenceFlow_18l3crb + SequenceFlow_0khtova + + + + SequenceFlow_15wux6a + + + + + + + + + + + + + SequenceFlow_15mvedq + SequenceFlow_1xk5xed + + + + + SequenceFlow_1vnx1pp + SequenceFlow_0ow44q0 + + + + + + SequenceFlow_1qo2pln + SequenceFlow_0w2es8j + + + + SequenceFlow_0w2es8j + SequenceFlow_18l3crb + + + + + + SequenceFlow_0khtova + SequenceFlow_1mz0vdx + + + + SequenceFlow_1xk5xed + SequenceFlow_1jr6zi0 + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1mz0vdx + SequenceFlow_15mvedq + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1jr6zi0 + SequenceFlow_1vnx1pp + + + + + SequenceFlow_0ow44q0 + SequenceFlow_15wux6a + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVFCNSResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVFCNSResource.bpmn new file mode 100644 index 0000000000..bbc7ead144 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVFCNSResource.bpmn @@ -0,0 +1,166 @@ + + + + + SequenceFlow_0x2e9we + + + + + + SequenceFlow_0jvtdhv + + + + SequenceFlow_0x2e9we + SequenceFlow_00vpfm3 + + + + SequenceFlow_1s4cyms + SequenceFlow_152xb4z + + + + + + + + + + + + + + + + SequenceFlow_00vpfm3 + SequenceFlow_1s4cyms + + + + SequenceFlow_0yro7o2 + + + + SequenceFlow_0p0ayci + + + SequenceFlow_0yro7o2 + SequenceFlow_0p0ayci + + + + + + + SequenceFlow_152xb4z + SequenceFlow_0jvtdhv + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVcpeResCustService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVcpeResCustService.bpmn new file mode 100644 index 0000000000..a835946d1d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVcpeResCustService.bpmn @@ -0,0 +1,812 @@ + + + + + SequenceFlow_7 + SequenceFlow_3 + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_7 + + + + + SequenceFlow_10o22u2 + + + + SequenceFlow_12ilko1 + SequenceFlow_29 + + + + + + + + + + + + + + + SequenceFlow_29 + SequenceFlow_8 + + + + SequenceFlow_8 + SequenceFlow_6 + + + + + SequenceFlow_6 + + + + + SequenceFlow_2 + + + + SequenceFlow_5 + + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + SequenceFlow_12ilko1 + + + + + + + + + + + + + + + SequenceFlow_10o22u2 + SequenceFlow_04ao07f + + + SequenceFlow_3 + + + + + SequenceFlow_06llof4 + + + + + + + + + + + + SequenceFlow_0807ukc + SequenceFlow_19yywk8 + + + SequenceFlow_19yywk8 + + + SequenceFlow_06llof4 + SequenceFlow_0807ukc + + + + + + + + + + SequenceFlow_04ao07f + + + + + + + + + + + + + + SequenceFlow_0jek18q + SequenceFlow_1ttswdr + + + SequenceFlow_1ttswdr + SequenceFlow_18103ca + + + + SequenceFlow_0jek18q + + + + SequenceFlow_18103ca + + + + + + + + + + + + + + + + + + + + SequenceFlow_05cjs89 + SequenceFlow_0snq0kw + + + SequenceFlow_0zaircn + + + + SequenceFlow_09i2jj0 + + + + SequenceFlow_09i2jj0 + SequenceFlow_05cjs89 + SequenceFlow_03n4wb1 + + + SequenceFlow_0snq0kw + SequenceFlow_03n4wb1 + SequenceFlow_1jjh8rv + + + SequenceFlow_0xgpd0u + SequenceFlow_0nk8vsb + SequenceFlow_0npvfo3 + + + SequenceFlow_0nk8vsb + SequenceFlow_0et9p0i + SequenceFlow_0zaircn + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0npvfo3 + SequenceFlow_0et9p0i + + + + + + + + + + + + + + + + + + SequenceFlow_128485i + SequenceFlow_04fys47 + + + SequenceFlow_1yamcyn + SequenceFlow_19cxgtm + SequenceFlow_128485i + + + + SequenceFlow_1lfph6u + + + + SequenceFlow_1ofw0fi + + + + SequenceFlow_1ofw0fi + SequenceFlow_1yamcyn + SequenceFlow_0vq7f6b + + + SequenceFlow_0vq7f6b + SequenceFlow_10scc5r + SequenceFlow_1lfph6u + + + SequenceFlow_04fys47 + SequenceFlow_1o5cutr + + + + SequenceFlow_1o5cutr + SequenceFlow_19cxgtm + SequenceFlow_10scc5r + + + + + 0}]]> + + + + + + + + + + + SequenceFlow_1jjh8rv + + + + SequenceFlow_0xgpd0u + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleInfra.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleInfra.bpmn new file mode 100644 index 0000000000..bfe5e02b49 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleInfra.bpmn @@ -0,0 +1,331 @@ + + + + + SequenceFlow_5 + SequenceFlow_2 + + + + + SequenceFlow_4 + SequenceFlow_5 + + + + + SequenceFlow_2 + SequenceFlow_9 + + + + + + + + + + + + + + + + + + SequenceFlow_9 + SequenceFlow_8 + + + + + + + + + + SequenceFlow_17 + SequenceFlow_14 + + + + SequenceFlow_6 + + + + SequenceFlow_14 + SequenceFlow_6 + + + + + SequenceFlow_13 + SequenceFlow_17 + + + + + + + + + + POST + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + ${DELVfModI_updateInfraRequest} + ${response} + ${statusCode} + + soap-http-connector + + + SequenceFlow_10 + SequenceFlow_13 + + + + SequenceFlow_8 + SequenceFlow_10 + + + + + + SequenceFlow_1 + + + + + SequenceFlow_1 + SequenceFlow_7 + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_19 + + + SequenceFlow_19 + + + + + + SequenceFlow_12 + + + + SequenceFlow_12 + + + + + SequenceFlow_4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn new file mode 100644 index 0000000000..b7ce608090 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn @@ -0,0 +1,568 @@ + + + + + SequenceFlow_1 + SequenceFlow_7 + + + + + SequenceFlow_1 + + + + SequenceFlow_7 + SequenceFlow_12 + + + + + SequenceFlow_12 + SequenceFlow_6 + + + + SequenceFlow_15 + SequenceFlow_2 + + + + + SequenceFlow_22 + + + + SequenceFlow_13 + SequenceFlow_15 + SequenceFlow_21 + + + + + + + + + + + + + + + + SequenceFlow_2 + SequenceFlow_5 + + + + SequenceFlow_8 + SequenceFlow_13 + + + + + SequenceFlow_21 + SequenceFlow_22 + + + + + + SequenceFlow_6 + SequenceFlow_4 + SequenceFlow_8 + + + + + + + SequenceFlow_4 + + + + + SequenceFlow_23 + + + + + SequenceFlow_23 + SequenceFlow_responseNotSent + SequenceFlow_responseSent + + + SequenceFlow_responseNotSent + SequenceFlow_14 + + + + + #{DELVfModVol_syncResponseSent == true} + + + SequenceFlow_responseSent + SequenceFlow_14 + SequenceFlow_25 + + + + + + + + + + + + + + + SequenceFlow_25 + SequenceFlow_19 + + + + SequenceFlow_19 + + + + + + SequenceFlow_35 + SequenceFlow_37 + + + + + SequenceFlow_27 + SequenceFlow_29 + + + + + SequenceFlow_10 + SequenceFlow_24 + + + + + + + + + + + + + + + SequenceFlow_29 + SequenceFlow_10 + + + + SequenceFlow_24 + + + + + + + + ${DELVfModVol_updateInfraRequest} + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + POST + ${response} + ${statusCode} + + http-connector + + + SequenceFlow_37 + SequenceFlow_27 + + + + SequenceFlow_vnfAdapterCallOK + SequenceFlow_35 + + + + + SequenceFlow_5 + SequenceFlow_vnfAdapterCallOK + SequenceFlow_vnfAdapterCallNotOK + + + #{VNFREST_SuccessIndicator == true} + + + SequenceFlow_vnfAdapterCallNotOK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVnfInfra.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVnfInfra.bpmn new file mode 100644 index 0000000000..6092de6c79 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVnfInfra.bpmn @@ -0,0 +1,353 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_2 + SequenceFlow_16ikne0 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + + SequenceFlow_15 + SequenceFlow_16 + + + + + + + + + + SequenceFlow_16 + SequenceFlow_17 + + + + SequenceFlow_17 + + + + SequenceFlow_14 + + + + + SequenceFlow_14 + SequenceFlow_15 + + + + + + + SequenceFlow_19 + + + SequenceFlow_18 + + + + + SequenceFlow_18 + SequenceFlow_19 + + + + + + SequenceFlow_0slfgmy + SequenceFlow_6 + + + + + + + + + + + SequenceFlow_6 + SequenceFlow_7 + + + + SequenceFlow_7 + + + + + + + + + SequenceFlow_00bhxtl + SequenceFlow_1f56g06 + + + SequenceFlow_16ikne0 + SequenceFlow_00o02cv + SequenceFlow_00bhxtl + + + + SequenceFlow_1f56g06 + SequenceFlow_0dy2xw0 + SequenceFlow_0slfgmy + + + + + + + + + + + + + + + SequenceFlow_00o02cv + SequenceFlow_0dy2xw0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ReplaceVnfInfra.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ReplaceVnfInfra.bpmn new file mode 100644 index 0000000000..6a157eb7c0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ReplaceVnfInfra.bpmn @@ -0,0 +1,1815 @@ + + + + + SequenceFlow_5 + SequenceFlow_0y0jt4l + + + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + + + + + SequenceFlow_17 + SequenceFlow_14 + + + + SequenceFlow_6 + + + + SequenceFlow_14 + SequenceFlow_6 + + + + + SequenceFlow_3 + SequenceFlow_19rrss6 + SequenceFlow_17 + + + + + + SequenceFlow_1 + + + + + SequenceFlow_0ph6862 + SequenceFlow_7 + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_19 + + + SequenceFlow_19 + + + + + + + + SequenceFlow_1 + SequenceFlow_0msgw6c + + + + SequenceFlow_0uhssvq + SequenceFlow_0ph6862 + + + + + + + + + + + + + + + + + SequenceFlow_0msgw6c + SequenceFlow_0uhssvq + + + + SequenceFlow_12 + + + + SequenceFlow_12 + + + + + SequenceFlow_4 + + + + + + + + + + + + + + + SequenceFlow_19ba94v + SequenceFlow_0gzzeru + + + + + + + + + + + + + SequenceFlow_0y0jt4l + SequenceFlow_1w35ov3 + + + + SequenceFlow_1w35ov3 + SequenceFlow_053qjfy + + + + + SequenceFlow_16mo99z + SequenceFlow_0jph3mt + SequenceFlow_2 + + + + + + + SequenceFlow_0baosqi + SequenceFlow_1nodcf9 + SequenceFlow_0k3fx7p + + + + SequenceFlow_19lg15d + SequenceFlow_0usoiza + SequenceFlow_12mfil6 + + + + SequenceFlow_14yy8v4 + SequenceFlow_0usxnlk + + + + + + + + + + SequenceFlow_0usxnlk + SequenceFlow_16mo99z + SequenceFlow_12hm1ks + + + + SequenceFlow_2 + SequenceFlow_0baosqi + SequenceFlow_0etr76r + + + + + + + + + + + + + + + + + + + + SequenceFlow_1cezgw4 + SequenceFlow_0v0u7mf + + + + SequenceFlow_1qr8msw + + + + + + + + + SequenceFlow_0k3fx7p + SequenceFlow_1bkhs8m + SequenceFlow_11b00u2 + + + + SequenceFlow_0xx8y1s + SequenceFlow_0qy68ib + SequenceFlow_1ck3v34 + + + + SequenceFlow_0a6pdza + SequenceFlow_0q0qan8 + SequenceFlow_079nix0 + + + + SequenceFlow_13h26h9 + SequenceFlow_1c0vdki + SequenceFlow_032i8t0 + + + + SequenceFlow_0gzzeru + SequenceFlow_0bxgny0 + SequenceFlow_1f0c5lj + + + + SequenceFlow_1uno5rs + SequenceFlow_162mm0m + SequenceFlow_17vwb2h + + + + SequenceFlow_1c79909 + SequenceFlow_197t3qk + SequenceFlow_0ba08lt + + + + SequenceFlow_1xfbwpi + SequenceFlow_19lg15d + SequenceFlow_1akvi72 + + + + SequenceFlow_12mfil6 + SequenceFlow_3 + SequenceFlow_1sdol24 + + + + SequenceFlow_0vpd06n + SequenceFlow_051zp79 + + + + SequenceFlow_0v0u7mf + SequenceFlow_0vpd06n + SequenceFlow_1qr8msw + SequenceFlow_05gpym3 + + + SequenceFlow_05gpym3 + SequenceFlow_051zp79 + SequenceFlow_1ei7at5 + SequenceFlow_0kg02xg + SequenceFlow_1i6p53b + SequenceFlow_1yy7o24 + SequenceFlow_0sqmtpl + SequenceFlow_1shdmrj + SequenceFlow_1v1i5w4 + SequenceFlow_1h8rscx + SequenceFlow_1xzq6jb + SequenceFlow_165q14c + SequenceFlow_0wp1a6g + SequenceFlow_0vymfh9 + + + + + + + SequenceFlow_1c0vdki + SequenceFlow_0aldwvz + SequenceFlow_19ba94v + + + + SequenceFlow_0bxgny0 + SequenceFlow_111z6w4 + SequenceFlow_1qm0ygo + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1qm0ygo + SequenceFlow_0he2w4b + + + SequenceFlow_0he2w4b + SequenceFlow_04zwhw4 + SequenceFlow_0pfvulx + + + + + + + + + + + + + + + + + + + SequenceFlow_1bkhs8m + SequenceFlow_1qfjlt7 + SequenceFlow_0xx8y1s + + + + + + + + + + + + + + + + + + SequenceFlow_0qy68ib + SequenceFlow_0x7iupc + SequenceFlow_0a6pdza + + + + + + + + + + + + + + + + SequenceFlow_0q0qan8 + SequenceFlow_0hp0w6k + SequenceFlow_13h26h9 + + + + + + + + + + + + + + + + SequenceFlow_04zwhw4 + SequenceFlow_1lrbndo + SequenceFlow_1uno5rs + + + + + + + + + + + + + + + + + + SequenceFlow_162mm0m + SequenceFlow_14mblvp + SequenceFlow_1c79909 + + + SequenceFlow_12hm1ks + + + + SequenceFlow_0jph3mt + + + + SequenceFlow_0etr76r + + + + SequenceFlow_1nodcf9 + + + + SequenceFlow_11b00u2 + + + + + + + + + + + + + + + SequenceFlow_1qfjlt7 + + + + SequenceFlow_1ck3v34 + + + + SequenceFlow_0x7iupc + + + + SequenceFlow_079nix0 + + + + SequenceFlow_0hp0w6k + + + + SequenceFlow_032i8t0 + + + + + + + + + + + + + + + + SequenceFlow_0aldwvz + + + + SequenceFlow_1f0c5lj + + + + SequenceFlow_111z6w4 + + + + SequenceFlow_0pfvulx + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_197t3qk + SequenceFlow_18e0jz0 + SequenceFlow_1xfbwpi + + + SequenceFlow_1lrbndo + + + + SequenceFlow_17vwb2h + + + + SequenceFlow_14mblvp + + + + SequenceFlow_0ba08lt + + + + SequenceFlow_18e0jz0 + + + + SequenceFlow_1akvi72 + + + + SequenceFlow_0usoiza + + + + SequenceFlow_1sdol24 + + + + + + + + + + + + + + + + + + + + SequenceFlow_19rrss6 + + + + + SequenceFlow_1cezgw4 + + + + + SequenceFlow_1ei7at5 + + + + SequenceFlow_0kg02xg + + + + SequenceFlow_1i6p53b + + + + SequenceFlow_1yy7o24 + + + + SequenceFlow_0sqmtpl + + + + SequenceFlow_1shdmrj + + + + SequenceFlow_1v1i5w4 + + + + SequenceFlow_1h8rscx + + + + SequenceFlow_1xzq6jb + + + + SequenceFlow_165q14c + + + + SequenceFlow_0wp1a6g + + + + SequenceFlow_0vymfh9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_053qjfy + SequenceFlow_14yy8v4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn new file mode 100644 index 0000000000..5b9cceabff --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn @@ -0,0 +1,379 @@ + + + + + SequenceFlow_0c2denm + + + SequenceFlow_0c2denm + SequenceFlow_1ntnafv + + + + SequenceFlow_14zd9we + SequenceFlow_0er6ddi + + + + SequenceFlow_1fis1j1 + SequenceFlow_06f0dx5 + SequenceFlow_19b0pmt + + + SequenceFlow_06f0dx5 + SequenceFlow_1q6spfu + + + + + + + + + + + + SequenceFlow_1q6spfu + SequenceFlow_0mm4eqd + + + SequenceFlow_0mm4eqd + + + + + + + + + + + + + SequenceFlow_19b0pmt + + + + + SequenceFlow_04f826i + + + + SequenceFlow_1t2ijcu + + + SequenceFlow_09z92mf + SequenceFlow_1sooz22 + + + + SequenceFlow_04f826i + SequenceFlow_09z92mf + + + + + + + + + + + + + + + + SequenceFlow_1sooz22 + SequenceFlow_1t2ijcu + + + + + SequenceFlow_0gna7ys + SequenceFlow_0re5dm7 + + + + SequenceFlow_0gna7ys + + + + SequenceFlow_0re5dm7 + + + + + + + + + + + + + + + + + + + + SequenceFlow_0er6ddi + SequenceFlow_1fis1j1 + + + + + + SequenceFlow_1ntnafv + SequenceFlow_030pfun + + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_030pfun + SequenceFlow_14zd9we + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn new file mode 100644 index 0000000000..28bd3f76ea --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn @@ -0,0 +1,693 @@ + + + + + SequenceFlow_0s2spoq + + + + SequenceFlow_1dsbjjb + SequenceFlow_1yay321 + + + + SequenceFlow_1dsbjjb + + + + SequenceFlow_1yay321 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_04qwbbf + SequenceFlow_0klbpxx + + + SequenceFlow_0yayvrf + + + SequenceFlow_0s2spoq + SequenceFlow_0az1n4y + + + + SequenceFlow_14zu6wr + SequenceFlow_0je30si + + + + + + + + + + + + SequenceFlow_0je30si + SequenceFlow_0yayvrf + + + + SequenceFlow_0e1r62n + + + + SequenceFlow_1ysapam + + + SequenceFlow_0n9pexp + SequenceFlow_01umodj + + + + + + + + + + + + SequenceFlow_01umodj + SequenceFlow_1ysapam + + + SequenceFlow_06o383f + SequenceFlow_0n9pexp + + + + + + + + SequenceFlow_0e1r62n + SequenceFlow_0t4nds2 + + + + + + + + ${URN_mso_openecomp_adapters_db_endpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_0t4nds2 + SequenceFlow_06o383f + + + + + SequenceFlow_12dou7o + SequenceFlow_0secadm + + + + SequenceFlow_0klbpxx + SequenceFlow_14zu6wr + SequenceFlow_1fueo69 + + + SequenceFlow_1fueo69 + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0az1n4y + SequenceFlow_1bd4711 + + + SequenceFlow_1bd4711 + SequenceFlow_03i6zhx + + + + + SequenceFlow_0xhbobd + SequenceFlow_0t7zinj + + + + SequenceFlow_03i6zhx + SequenceFlow_1pdv4qj + + + + + + + + + + + + + + + + SequenceFlow_1pdv4qj + SequenceFlow_0xhbobd + + + + + + SequenceFlow_0secadm + SequenceFlow_0zmd4rt + SequenceFlow_1n8h3zt + + + + SequenceFlow_04qwbbf + + + + + + SequenceFlow_0kvl23y + + + SequenceFlow_1bddzne + SequenceFlow_1e3vtyq + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1e3vtyq + SequenceFlow_12dou7o + + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1wzk6tu + SequenceFlow_0kvl23y + + + SequenceFlow_0t7zinj + + + + + SequenceFlow_1bddzne + + + + + SequenceFlow_1n8h3zt + SequenceFlow_1wzk6tu + + + + + SequenceFlow_0zmd4rt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateNetworkInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateNetworkInstance.bpmn new file mode 100644 index 0000000000..e5236f92bf --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateNetworkInstance.bpmn @@ -0,0 +1,322 @@ + + + + + SequenceFlow_0lp2z7l + + + + SequenceFlow_10 + SequenceFlow_14 + import org.onap.so.bpmn.infrastructure.scripts.* +def networkMod = new UpdateNetworkInstance() +networkMod.processJavaException(execution) + + + + SequenceFlow_10 + + + + + SequenceFlow_14 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0eto8sn + SequenceFlow_1lj31zp + + + SequenceFlow_0x3znm5 + + + SequenceFlow_095crcd + SequenceFlow_0x3znm5 + import org.onap.so.bpmn.infrastructure.scripts.* +def UpdateNetworkInstance = new UpdateNetworkInstance() +UpdateNetworkInstance.postProcessResponse(execution) + + + + + + SequenceFlow_0lp2z7l + SequenceFlow_1ablr60 + import org.onap.so.bpmn.infrastructure.scripts.* +def preProcess = new UpdateNetworkInstance() +preProcess.preProcessRequest(execution) + + + + + SequenceFlow_1lj31zp + SequenceFlow_0xxvjxq + import org.onap.so.bpmn.infrastructure.scripts.* +def UpdateNetworkInstance = new UpdateNetworkInstance() +UpdateNetworkInstance.prepareCompletion(execution) + + + + + + + + + + + SequenceFlow_0xxvjxq + SequenceFlow_095crcd + + + + + SequenceFlow_0n4umjf + + + + SequenceFlow_1ghqolv + + + SequenceFlow_0n4umjf + SequenceFlow_1reso2f + import org.onap.so.bpmn.infrastructure.scripts.* +def UpdateNetworkInstance = new UpdateNetworkInstance() +UpdateNetworkInstance.buildErrorResponse(execution) + + + + + + + + + + + SequenceFlow_1reso2f + SequenceFlow_1ghqolv + + + + + + + + + + SequenceFlow_1ablr60 + SequenceFlow_0rt8wax + import org.onap.so.bpmn.infrastructure.scripts.* +def UpdateNetworkInstance = new UpdateNetworkInstance() +UpdateNetworkInstance.getNetworkModelInfo(execution) + + + SequenceFlow_0rt8wax + SequenceFlow_0eto8sn + import org.onap.so.bpmn.infrastructure.scripts.* +def UpdateNetworkInstance = new UpdateNetworkInstance() +UpdateNetworkInstance.sendSyncResponse(execution) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleInfra.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleInfra.bpmn new file mode 100644 index 0000000000..c35e7ece96 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleInfra.bpmn @@ -0,0 +1,297 @@ + + + + + SequenceFlow_5 + SequenceFlow_2 + + + + + SequenceFlow_4 + SequenceFlow_5 + + + + + SequenceFlow_2 + SequenceFlow_9 + + + + + + + + + + + SequenceFlow_17 + SequenceFlow_14 + + + + SequenceFlow_6 + + + + SequenceFlow_14 + SequenceFlow_6 + + + + + SequenceFlow_3 + SequenceFlow_17 + + + + + + SequenceFlow_1 + + + + + SequenceFlow_1 + SequenceFlow_7 + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_19 + + + SequenceFlow_19 + + + + + + SequenceFlow_12 + + + + SequenceFlow_12 + + + + + SequenceFlow_4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_9 + SequenceFlow_3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleInfraV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleInfraV2.bpmn new file mode 100644 index 0000000000..1efb127e33 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleInfraV2.bpmn @@ -0,0 +1,412 @@ + + + + + SequenceFlow_07r1tup + + + + SequenceFlow_09izs9b + SequenceFlow_0gyzpu9 + + + + SequenceFlow_07r1tup + SequenceFlow_04cyigk + + + + SequenceFlow_04cyigk + SequenceFlow_09izs9b + + + + SequenceFlow_0gyzpu9 + SequenceFlow_16xzdgi + + + + SequenceFlow_1oa0jsk + SequenceFlow_1ozbxok + + + + SequenceFlow_1ozbxok + SequenceFlow_17c5hhe + + + + SequenceFlow_17c5hhe + SequenceFlow_1pqikpt + + + + SequenceFlow_1pqikpt + SequenceFlow_0m6q3pf + + + + SequenceFlow_0vj0wfl + SequenceFlow_0cskhwy + + + + SequenceFlow_0cskhwy + SequenceFlow_067f4jv + + + + SequenceFlow_067f4jv + SequenceFlow_1trqy93 + + + + SequenceFlow_1trqy93 + SequenceFlow_0fc550l + + + + SequenceFlow_0fc550l + SequenceFlow_1uquo5r + + + + + + + + + + + + + SequenceFlow_0m6q3pf + SequenceFlow_1ykv4yr + + + + SequenceFlow_1x3xeba + SequenceFlow_01yr04k + + + + SequenceFlow_1rfmnuo + SequenceFlow_0vj0wfl + + + + + + + + SequenceFlow_1uquo5r + + + + + + SequenceFlow_16xzdgi + SequenceFlow_1oa0jsk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1ykv4yr + SequenceFlow_1x3xeba + + + + + + + + + + + SequenceFlow_01yr04k + SequenceFlow_1rfmnuo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn new file mode 100644 index 0000000000..078d72a1d8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn @@ -0,0 +1,517 @@ + + + + + SequenceFlow_1 + + + + + + + + + + + SequenceFlow_13 + SequenceFlow_14 + + + + + + + + ${UPDVfModVol_updateInfraRequest} + + + aapplication/soap+xml + #{BasicAuthHeaderValueDB} + + + POST + ${response} + ${statusCode} + + http-connector + + + SequenceFlow_11 + SequenceFlow_12 + + + + SequenceFlow_22 + SequenceFlow_21 + + + + + SequenceFlow_12 + SequenceFlow_13 + + + + + + + + + + + + + SequenceFlow_21 + SequenceFlow_19 + + + + SequenceFlow_19 + SequenceFlow_11 + + + + + SequenceFlow_14 + SequenceFlow_1 + + + + + SequenceFlow_noVfModuleRelation + SequenceFlow_personaModelIdMatchYes + SequenceFlow_22 + + + + SequenceFlow_7 + + + + SequenceFlow_6 + + + + + SequenceFlow_7 + SequenceFlow_4 + + + + + + + + + + + + + + SequenceFlow_4 + SequenceFlow_6 + + + + + + SequenceFlow_8 + SequenceFlow_personaModelIdMatchYes + SequenceFlow_personaModelidMatchNo + + + #{UPDVfModVol_modelInvariantId == UPDVfModVol_personaModelId} + + + + SequenceFlow_YesVfModuleRelation + SequenceFlow_8 + + + + + SequenceFlow_personaModelidMatchNo + SequenceFlow_18 + + + + + SequenceFlow_18 + + + + SequenceFlow_3 + SequenceFlow_2 + + + + + SequenceFlow_3 + + + + SequenceFlow_2 + SequenceFlow_20 + + + + + SequenceFlow_tenantIsMatch + SequenceFlow_YesVfModuleRelation + SequenceFlow_noVfModuleRelation + + + + + + + SequenceFlow_15 + SequenceFlow_NoTenantMatch + SequenceFlow_tenantIsMatch + + + + #{UPDVfModVol_tenantId == UPDVfModVol_volumeGroupTenantId} + + + SequenceFlow_NoTenantMatch + SequenceFlow_17 + + + + + SequenceFlow_17 + + + + SequenceFlow_5 + SequenceFlow_15 + + + + + SequenceFlow_20 + SequenceFlow_5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVnfInfra.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVnfInfra.bpmn new file mode 100644 index 0000000000..e50eb7f805 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVnfInfra.bpmn @@ -0,0 +1,1685 @@ + + + + + SequenceFlow_5 + SequenceFlow_0y0jt4l + + + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + + + + + SequenceFlow_17 + SequenceFlow_14 + + + + SequenceFlow_6 + + + + SequenceFlow_14 + SequenceFlow_6 + + + + + SequenceFlow_3 + SequenceFlow_1dqbqqx + SequenceFlow_17 + + + + + + SequenceFlow_1 + + + + + SequenceFlow_0slcwxc + SequenceFlow_7 + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_19 + + + SequenceFlow_19 + + + + + + + + SequenceFlow_1 + SequenceFlow_0a0lfh8 + + + + SequenceFlow_0r0o5yt + SequenceFlow_0slcwxc + + + + + + + + + + + + + + + + + SequenceFlow_0a0lfh8 + SequenceFlow_0r0o5yt + + + + SequenceFlow_12 + + + + SequenceFlow_12 + + + + + SequenceFlow_4 + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_19ba94v + SequenceFlow_0gzzeru + + + + + + + + + + + + + SequenceFlow_0y0jt4l + SequenceFlow_1w35ov3 + + + + SequenceFlow_1w35ov3 + SequenceFlow_053qjfy + + + + + SequenceFlow_16mo99z + SequenceFlow_1pj72fw + SequenceFlow_2 + + + + + + + SequenceFlow_0baosqi + SequenceFlow_1lmijmb + SequenceFlow_0k3fx7p + + + + SequenceFlow_19lg15d + SequenceFlow_11p8elx + SequenceFlow_12mfil6 + + + + SequenceFlow_178fxkj + SequenceFlow_0usxnlk + + + + + + + + + + SequenceFlow_0usxnlk + SequenceFlow_16mo99z + SequenceFlow_1esmtgy + + + + SequenceFlow_2 + SequenceFlow_0baosqi + SequenceFlow_1jmzl1j + + + + + + + + + + + + + + + + + + + + SequenceFlow_1nplvhi + SequenceFlow_0v0u7mf + + + + SequenceFlow_1qr8msw + + + + + + + + + SequenceFlow_0k3fx7p + SequenceFlow_1bkhs8m + SequenceFlow_010ynjs + + + + SequenceFlow_0xx8y1s + SequenceFlow_0qy68ib + SequenceFlow_1qsxbp4 + + + + SequenceFlow_0a6pdza + SequenceFlow_0q0qan8 + SequenceFlow_15bl7wd + + + + SequenceFlow_13h26h9 + SequenceFlow_1c0vdki + SequenceFlow_1m84lq5 + + + + SequenceFlow_0gzzeru + SequenceFlow_04zwhw4 + SequenceFlow_0fog99f + + + + SequenceFlow_1uno5rs + SequenceFlow_162mm0m + SequenceFlow_12g63pl + + + + SequenceFlow_1c79909 + SequenceFlow_197t3qk + SequenceFlow_0l83v2k + + + + SequenceFlow_1xfbwpi + SequenceFlow_19lg15d + SequenceFlow_07fhkt4 + + + + SequenceFlow_12mfil6 + SequenceFlow_3 + SequenceFlow_0p94lgv + + + + SequenceFlow_0vpd06n + SequenceFlow_1c022sy + + + + SequenceFlow_0v0u7mf + SequenceFlow_0vpd06n + SequenceFlow_1qr8msw + SequenceFlow_05gpym3 + + + SequenceFlow_05gpym3 + SequenceFlow_1c022sy + SequenceFlow_0tqrgop + SequenceFlow_126nlmw + SequenceFlow_0mw3mwl + SequenceFlow_13md9cw + SequenceFlow_0xylem3 + SequenceFlow_1c5mxd5 + SequenceFlow_0u8hiu2 + SequenceFlow_0fs7ay9 + SequenceFlow_00qwx4v + SequenceFlow_14s8ji9 + SequenceFlow_0kricor + + + + + + + SequenceFlow_1c0vdki + SequenceFlow_1hldqvv + SequenceFlow_19ba94v + + + + + + + + + + + + + + + + + SequenceFlow_1bkhs8m + SequenceFlow_0qmpjgv + SequenceFlow_0xx8y1s + + + + + + + + + + + + + + + + + + SequenceFlow_0qy68ib + SequenceFlow_0tld38t + SequenceFlow_0a6pdza + + + + + + + + + + + + + + + + SequenceFlow_0q0qan8 + SequenceFlow_08dyt3l + SequenceFlow_13h26h9 + + + + + + + + + + + + + + + + SequenceFlow_04zwhw4 + SequenceFlow_0ye8oij + SequenceFlow_1uno5rs + + + + + + + + + + + + + + + + + + SequenceFlow_162mm0m + SequenceFlow_08kn9ok + SequenceFlow_1c79909 + + + + + + + + + + + + + + + SequenceFlow_197t3qk + SequenceFlow_02uiht9 + SequenceFlow_1xfbwpi + + + SequenceFlow_1esmtgy + + + + SequenceFlow_1jmzl1j + + + + + + + + + + SequenceFlow_1pj72fw + + + + + SequenceFlow_1lmijmb + + + + + SequenceFlow_010ynjs + + + + + + + SequenceFlow_0qmpjgv + + + + SequenceFlow_1qsxbp4 + + + + SequenceFlow_15bl7wd + + + + SequenceFlow_1m84lq5 + + + + SequenceFlow_0tld38t + + + + SequenceFlow_08dyt3l + + + + + + + + + + + + + + + + SequenceFlow_1hldqvv + + + + SequenceFlow_0fog99f + + + + SequenceFlow_0ye8oij + + + + SequenceFlow_12g63pl + + + + + + + + + + + + SequenceFlow_08kn9ok + + + + SequenceFlow_0l83v2k + + + + SequenceFlow_02uiht9 + + + + SequenceFlow_07fhkt4 + + + + SequenceFlow_11p8elx + + + + SequenceFlow_0p94lgv + + + + + + + + + + + + + + + + + SequenceFlow_1dqbqqx + + + + SequenceFlow_1nplvhi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0tqrgop + + + + SequenceFlow_126nlmw + + + + SequenceFlow_0mw3mwl + + + + SequenceFlow_13md9cw + + + + SequenceFlow_0xylem3 + + + + SequenceFlow_1c5mxd5 + + + + SequenceFlow_0u8hiu2 + + + + SequenceFlow_0fs7ay9 + + + + SequenceFlow_00qwx4v + + + + SequenceFlow_14s8ji9 + + + + SequenceFlow_0kricor + + + + + SequenceFlow_053qjfy + SequenceFlow_178fxkj + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/VnfConfigUpdate.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/VnfConfigUpdate.bpmn new file mode 100644 index 0000000000..e296aef863 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/VnfConfigUpdate.bpmn @@ -0,0 +1,1636 @@ + + + + + SequenceFlow_5 + SequenceFlow_0y0jt4l + + + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + + + + + SequenceFlow_17 + SequenceFlow_14 + + + + SequenceFlow_6 + + + + SequenceFlow_14 + SequenceFlow_6 + + + + + SequenceFlow_3 + SequenceFlow_07uuj2d + SequenceFlow_17 + + + + + + SequenceFlow_1 + + + + + SequenceFlow_0xt2xvx + SequenceFlow_7 + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_19 + + + SequenceFlow_19 + + + + + + + + SequenceFlow_1 + SequenceFlow_1vxpbd0 + + + + SequenceFlow_03ayqeh + SequenceFlow_0xt2xvx + + + + + + + + + + + + + + + + + SequenceFlow_1vxpbd0 + SequenceFlow_03ayqeh + + + + SequenceFlow_12 + + + + SequenceFlow_12 + + + + + SequenceFlow_4 + + + + + + SequenceFlow_0y0jt4l + SequenceFlow_053qjfy + + + + + SequenceFlow_16mo99z + SequenceFlow_09lrk4q + SequenceFlow_2 + + + + + SequenceFlow_0baosqi + SequenceFlow_1eezqx8 + SequenceFlow_0k3fx7p + + + + SequenceFlow_16ff86u + SequenceFlow_08m0j98 + SequenceFlow_12mfil6 + + + + SequenceFlow_053qjfy + SequenceFlow_179tyul + SequenceFlow_0usxnlk + + + + SequenceFlow_0usxnlk + SequenceFlow_16mo99z + SequenceFlow_06ev8or + + + + SequenceFlow_2 + SequenceFlow_0baosqi + SequenceFlow_1cdfjed + + + + + + + + + + + + + + + + + + + + SequenceFlow_0nob5cp + SequenceFlow_0v0u7mf + + + + + + + + + + SequenceFlow_0k3fx7p + SequenceFlow_17g62fl + SequenceFlow_06ajc11 + + + + SequenceFlow_1c79909 + SequenceFlow_1urpp94 + SequenceFlow_08m0j98 + + + SequenceFlow_12mfil6 + SequenceFlow_0u6ho2p + SequenceFlow_0k3zxpd + + + + SequenceFlow_0vpd06n + SequenceFlow_1c022sy + SequenceFlow_05omwbu + SequenceFlow_18lemf9 + + + + SequenceFlow_0v0u7mf + SequenceFlow_1qr8msw + SequenceFlow_05gpym3 + SequenceFlow_0vpd06n + SequenceFlow_0rlmex7 + + + SequenceFlow_05gpym3 + SequenceFlow_19myx3o + SequenceFlow_1c022sy + SequenceFlow_0ueoglv + SequenceFlow_15fqlwe + SequenceFlow_0yuj0l5 + SequenceFlow_1abb030 + SequenceFlow_0ls3ej5 + SequenceFlow_1ar6ikk + SequenceFlow_0t53vux + SequenceFlow_11ck4qe + SequenceFlow_16d2ln4 + SequenceFlow_1quapjx + SequenceFlow_101n488 + + + + + + + + + + SequenceFlow_06ev8or + + + + + + SequenceFlow_0zzwdwf + SequenceFlow_06ajc11 + SequenceFlow_076leae + + + + SequenceFlow_076leae + SequenceFlow_0du9273 + SequenceFlow_0zh8r6j + + + + SequenceFlow_0nob5cp + + + + SequenceFlow_1cdfjed + + + + + + + SequenceFlow_17g62fl + + + + + + + SequenceFlow_0zh8r6j + + + + + + + SequenceFlow_09lrk4q + + + + + + SequenceFlow_1eezqx8 + + + + SequenceFlow_0zzwdwf + + + + + + + SequenceFlow_0du9273 + SequenceFlow_032tm9y + SequenceFlow_179z9vl + + + + + SequenceFlow_032tm9y + + + + SequenceFlow_179z9vl + SequenceFlow_1cjiv6i + SequenceFlow_1q3oxtf + + + + SequenceFlow_1q3oxtf + + + + + + + SequenceFlow_1wqinjh + + + + + + + SequenceFlow_1urpp94 + + + + SequenceFlow_1colra4 + + + + SequenceFlow_1tzax6l + SequenceFlow_3 + SequenceFlow_0w8mkkn + + + + SequenceFlow_0u6ho2p + SequenceFlow_09xxorv + SequenceFlow_1tzax6l + + + + + SequenceFlow_16ff86u + + + + + + + + SequenceFlow_0k3zxpd + + + + SequenceFlow_09xxorv + + + + + + + + SequenceFlow_0w8mkkn + + + + SequenceFlow_07uuj2d + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0ueoglv + + + + SequenceFlow_15fqlwe + + + + SequenceFlow_0yuj0l5 + + + + SequenceFlow_1abb030 + + + + SequenceFlow_0ls3ej5 + + + + SequenceFlow_1quapjx + + + + + + + SequenceFlow_1ar6ikk + + + + SequenceFlow_0t53vux + + + + SequenceFlow_11ck4qe + + + + SequenceFlow_16d2ln4 + + + + SequenceFlow_179tyul + + + + + + + + SequenceFlow_101n488 + + + + + SequenceFlow_16igl7b + + + + + + SequenceFlow_0wfzjs1 + SequenceFlow_188a7lk + SequenceFlow_12konw1 + + + SequenceFlow_0lpreg4 + SequenceFlow_0q1skau + SequenceFlow_1s3pbww + + + + + + + + + SequenceFlow_12konw1 + + + + + + + SequenceFlow_1s3pbww + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1cjiv6i + SequenceFlow_1colra4 + SequenceFlow_0wfzjs1 + + + + + + + + + + + + + + + + + + SequenceFlow_16igl7b + SequenceFlow_0q1skau + SequenceFlow_1c79909 + + + + + + + + + + + + + + + SequenceFlow_188a7lk + SequenceFlow_1wqinjh + SequenceFlow_0lpreg4 + + + + + + SequenceFlow_0rlmex7 + SequenceFlow_1xwgemy + + + + SequenceFlow_1nm4wr1 + SequenceFlow_19myx3o + SequenceFlow_05omwbu + + + + + + + SequenceFlow_1xwgemy + SequenceFlow_1nm4wr1 + + PT1M + + + + + + + + + + + + + + + + + + SequenceFlow_1qr8msw + SequenceFlow_18lemf9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/VnfInPlaceUpdate.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/VnfInPlaceUpdate.bpmn new file mode 100644 index 0000000000..3c42320302 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/VnfInPlaceUpdate.bpmn @@ -0,0 +1,2302 @@ + + + + + SequenceFlow_5 + SequenceFlow_0y0jt4l + + + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + + + + + SequenceFlow_17 + SequenceFlow_14 + + + + SequenceFlow_6 + + + + SequenceFlow_14 + SequenceFlow_6 + + + + + SequenceFlow_3 + SequenceFlow_07uuj2d + SequenceFlow_17 + + + + + + SequenceFlow_1 + + + + + SequenceFlow_0ib8gb8 + SequenceFlow_7 + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_19 + + + SequenceFlow_19 + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0hvg70o + SequenceFlow_1qnzi6i + + + + SequenceFlow_1 + SequenceFlow_0hvg70o + + + + + SequenceFlow_1qnzi6i + SequenceFlow_0ib8gb8 + + + + + SequenceFlow_12 + + + + SequenceFlow_12 + + + + + SequenceFlow_4 + + + + + + SequenceFlow_0y0jt4l + SequenceFlow_053qjfy + + + + + SequenceFlow_16mo99z + SequenceFlow_09lrk4q + SequenceFlow_2 + + + + + SequenceFlow_0baosqi + SequenceFlow_1eezqx8 + SequenceFlow_0k3fx7p + + + + SequenceFlow_1nr9o85 + SequenceFlow_16ff86u + SequenceFlow_12mfil6 + + + + SequenceFlow_053qjfy + SequenceFlow_179tyul + SequenceFlow_0usxnlk + + + + + + + + + + SequenceFlow_0usxnlk + SequenceFlow_16mo99z + SequenceFlow_06ev8or + + + + SequenceFlow_2 + SequenceFlow_0baosqi + SequenceFlow_1cdfjed + + + + + + + + + + + + + + + + + + + + SequenceFlow_0nob5cp + SequenceFlow_0v0u7mf + + + + + + + + + + SequenceFlow_0k3fx7p + SequenceFlow_17g62fl + SequenceFlow_06ajc11 + + + + + SequenceFlow_0a6pdza + SequenceFlow_0q0qan8 + SequenceFlow_02mk8vs + + + + SequenceFlow_13h26h9 + SequenceFlow_1c0vdki + SequenceFlow_11o5j55 + + + + SequenceFlow_1uno5rs + SequenceFlow_162mm0m + SequenceFlow_1gagrha + + + + SequenceFlow_1c79909 + SequenceFlow_1urpp94 + SequenceFlow_1c2xyhk + + + SequenceFlow_12mfil6 + SequenceFlow_0u6ho2p + SequenceFlow_0k3zxpd + + + + SequenceFlow_0vpd06n + SequenceFlow_1c022sy + SequenceFlow_0h64c4o + SequenceFlow_0syfgbo + + + + SequenceFlow_0v0u7mf + SequenceFlow_1qr8msw + SequenceFlow_05gpym3 + SequenceFlow_0vpd06n + SequenceFlow_1ijc733 + + + SequenceFlow_05gpym3 + SequenceFlow_1kntfys + SequenceFlow_1nlqlwn + SequenceFlow_1c022sy + SequenceFlow_0ueoglv + SequenceFlow_15fqlwe + SequenceFlow_0yuj0l5 + SequenceFlow_1abb030 + SequenceFlow_0ls3ej5 + SequenceFlow_1ar6ikk + SequenceFlow_171iq7e + SequenceFlow_1553o9f + SequenceFlow_0dmxwel + SequenceFlow_1id2p8y + SequenceFlow_0t53vux + SequenceFlow_11ck4qe + SequenceFlow_16d2ln4 + SequenceFlow_1quapjx + SequenceFlow_101n488 + SequenceFlow_021ah63 + + + + + + + + + + + + + + SequenceFlow_06ev8or + + + + + + SequenceFlow_0zzwdwf + SequenceFlow_06ajc11 + SequenceFlow_076leae + + + + SequenceFlow_076leae + SequenceFlow_0du9273 + SequenceFlow_0zh8r6j + + + + SequenceFlow_0nob5cp + + + + SequenceFlow_1cdfjed + + + + + + + SequenceFlow_17g62fl + + + + + + + SequenceFlow_0zh8r6j + + + + + + + SequenceFlow_09lrk4q + + + + + + SequenceFlow_1eezqx8 + + + + SequenceFlow_0zzwdwf + + + + + + + SequenceFlow_0du9273 + SequenceFlow_032tm9y + SequenceFlow_179z9vl + + + + + SequenceFlow_032tm9y + + + + SequenceFlow_179z9vl + SequenceFlow_1cjiv6i + SequenceFlow_1q3oxtf + + + + SequenceFlow_1q3oxtf + + + + + + + SequenceFlow_1j81s6b + + + + + + + SequenceFlow_16t9vai + + + + + SequenceFlow_02mk8vs + + + + + + + SequenceFlow_1urt6le + + + + + SequenceFlow_11o5j55 + + + + + + + SequenceFlow_19ba94v + SequenceFlow_1fuaq5k + SequenceFlow_04gth9f + + + + SequenceFlow_0if6xj4 + + + + + + + + SequenceFlow_04gth9f + + + + + SequenceFlow_1v59be9 + + + + SequenceFlow_04rprct + SequenceFlow_1uceq96 + SequenceFlow_0txgesu + + + + SequenceFlow_1uceq96 + + + + + + + + + SequenceFlow_0trguug + SequenceFlow_1q3bwlt + SequenceFlow_1xg6pwh + + + + SequenceFlow_1xfbwpi + SequenceFlow_1nr9o85 + SequenceFlow_0ttowkv + + + + SequenceFlow_1gagrha + + + + + + + + SequenceFlow_16igl7b + + + + + + + SequenceFlow_1urpp94 + + + + + SequenceFlow_0yja56j + + + + + + + + SequenceFlow_1xg6pwh + + + + SequenceFlow_1hwtq9x + + + + + + + + SequenceFlow_0ttowkv + + + + SequenceFlow_1colra4 + + + + + SequenceFlow_1tzax6l + SequenceFlow_3 + SequenceFlow_0w8mkkn + + + + SequenceFlow_0u6ho2p + SequenceFlow_09xxorv + SequenceFlow_1tzax6l + + + + + SequenceFlow_16ff86u + + + + + + + + SequenceFlow_0k3zxpd + + + + SequenceFlow_09xxorv + + + + + + + + SequenceFlow_0w8mkkn + + + + SequenceFlow_07uuj2d + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0ueoglv + + + + SequenceFlow_15fqlwe + + + + SequenceFlow_0yuj0l5 + + + + SequenceFlow_1abb030 + + + + SequenceFlow_0ls3ej5 + + + + SequenceFlow_1quapjx + + + + + + + SequenceFlow_1ar6ikk + + + + SequenceFlow_1nlqlwn + + + + SequenceFlow_171iq7e + + + + SequenceFlow_1553o9f + + + + SequenceFlow_0dmxwel + + + + SequenceFlow_1id2p8y + + + + SequenceFlow_0t53vux + + + + SequenceFlow_11ck4qe + + + + SequenceFlow_16d2ln4 + + + + SequenceFlow_179tyul + + + + + + + + SequenceFlow_101n488 + + + + SequenceFlow_1ood2pr + + + + + + + + + + + + + + + + + + + + SequenceFlow_1c0vdki + SequenceFlow_0if6xj4 + SequenceFlow_19ba94v + + + + + + + + + + + + + + + SequenceFlow_1cjiv6i + SequenceFlow_1ood2pr + SequenceFlow_0xx8y1s + + + + + + + + + + + + + + + SequenceFlow_1q3bwlt + SequenceFlow_1hwtq9x + SequenceFlow_1xfbwpi + + + + + + + + + + + + + + + + SequenceFlow_0qy68ib + SequenceFlow_16t9vai + SequenceFlow_0a6pdza + + + + + + + + + + + + + + + + SequenceFlow_162mm0m + SequenceFlow_16igl7b + SequenceFlow_1c79909 + + + SequenceFlow_021ah63 + + + + + + + SequenceFlow_1ijc733 + SequenceFlow_0ai205d + + + + SequenceFlow_0a2cv6d + SequenceFlow_1kntfys + SequenceFlow_0h64c4o + + + SequenceFlow_0ai205d + SequenceFlow_0a2cv6d + + PT1M + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1qr8msw + SequenceFlow_0syfgbo + + + + + + + + + + + + + + + + + + SequenceFlow_0q0qan8 + SequenceFlow_1urt6le + SequenceFlow_13h26h9 + + + + + + + + + + + + + + + + SequenceFlow_1fuaq5k + SequenceFlow_1v59be9 + SequenceFlow_04rprct + + + + + + + + + + + + + + + + SequenceFlow_0txgesu + SequenceFlow_1colra4 + SequenceFlow_1uno5rs + + + + + + + + + + + + + + + + + SequenceFlow_1c2xyhk + SequenceFlow_0yja56j + SequenceFlow_0trguug + + + SequenceFlow_0xx8y1s + SequenceFlow_1j81s6b + SequenceFlow_0qy68ib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCompareModelVersions.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCompareModelVersions.bpmn new file mode 100644 index 0000000000..f7023c33fc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCompareModelVersions.bpmn @@ -0,0 +1,330 @@ + + + + + SequenceFlow_1rebkae + SequenceFlow_1lkpfe2 + + + + + SequenceFlow_1rebkae + + + + SequenceFlow_1lkpfe2 + + + + + SequenceFlow_19sogyb + + + + SequenceFlow_17mr4jl + + + SequenceFlow_19sogyb + SequenceFlow_17mr4jl + + + + + + + SequenceFlow_0enm2cg + + + + SequenceFlow_1pe6r93 + SequenceFlow_0enm2cg + + + + + + + + + + + + SequenceFlow_1lta49u + SequenceFlow_1pe6r93 + + + SequenceFlow_0frea3k + SequenceFlow_1lta49u + + + + SequenceFlow_0frea3k + + + + + + + + SequenceFlow_08zjjzw + + + + SequenceFlow_1wudpuj + SequenceFlow_08zjjzw + + + + + + + + + + + + SequenceFlow_04ciw70 + SequenceFlow_1wudpuj + + + SequenceFlow_1fgkvpr + SequenceFlow_04ciw70 + + + + SequenceFlow_1fgkvpr + + + + + + + + SequenceFlow_1chfao3 + + + SequenceFlow_1chfao3 + SequenceFlow_164yb3r + + + + SequenceFlow_164yb3r + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn new file mode 100644 index 0000000000..c04c2d97ea --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn @@ -0,0 +1,227 @@ + + + + + + SequenceFlow_1rebkae + + + + SequenceFlow_1lkpfe2 + + + + + SequenceFlow_19sogyb + + + + SequenceFlow_17mr4jl + + + SequenceFlow_19sogyb + SequenceFlow_17mr4jl + + + + + + + SequenceFlow_1chfao3 + + + SequenceFlow_1cpg3ku + + + + + + + + + + + + + + + + + + + SequenceFlow_1rebkae + SequenceFlow_1pe6r93 + + + SequenceFlow_1pe6r93 + SequenceFlow_1lkpfe2 + + + + + SequenceFlow_1chfao3 + SequenceFlow_1xzphe4 + + + + + + + + + + + + + + + SequenceFlow_1xzphe4 + SequenceFlow_0b6eqin + + + SequenceFlow_0b6eqin + SequenceFlow_1cpg3ku + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn new file mode 100644 index 0000000000..d7bd54cc4e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn @@ -0,0 +1,755 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + notFound + SequenceFlow_6 + + + + + + + + + + + + + + + SequenceFlow_2 + SequenceFlow_4 + + + + SequenceFlow_4 + notFound + found + + + + found + SequenceFlow_0gbsa12 + + + + SequenceFlow_6 + + + + SequenceFlow_17p4ohs + SequenceFlow_11 + + + + + SequenceFlow_09xwplc + + + + + + + + + + SequenceFlow_0gd64w9 + SequenceFlow_1q6udwm + + + + + + + + + + + + SequenceFlow_1q6udwm + SequenceFlow_15knw0q + + + SequenceFlow_15knw0q + SequenceFlow_0c5h00o + + + + SequenceFlow_0c5h00o + SequenceFlow_1lalmvp + + + + + + + + + + + + SequenceFlow_1lalmvp + SequenceFlow_0eb41vb + + + SequenceFlow_0eb41vb + SequenceFlow_15z3gpq + + + + SequenceFlow_04t1zc2 + SequenceFlow_06w33tk + + + + + + + + + + + + SequenceFlow_06w33tk + SequenceFlow_1s7yieq + + + SequenceFlow_1s7yieq + SequenceFlow_00i7x43 + + + + + + + + + + + + + + + + + SequenceFlow_030mhcm + SequenceFlow_0q1hz2p + + + + + + + + + + + + + + + SequenceFlow_1m8u8dl + SequenceFlow_1vg5rfa + + + + SequenceFlow_1vg5rfa + SequenceFlow_17p4ohs + SequenceFlow_0f7u5pu + + + + + + SequenceFlow_0f7u5pu + SequenceFlow_16o7col + + + + SequenceFlow_16o7col + + + + + + + SequenceFlow_1h61pqs + + + + SequenceFlow_0t4ut76 + + + SequenceFlow_1h61pqs + SequenceFlow_1kbzr5v + + + + SequenceFlow_1cxj4yz + SequenceFlow_0t4ut76 + + + + + + + + + + + + + + SequenceFlow_1kbzr5v + SequenceFlow_1cxj4yz + + + + + SequenceFlow_00i7x43 + SequenceFlow_1dgzhsm + + + + SequenceFlow_15z3gpq + SequenceFlow_04t1zc2 + + + + SequenceFlow_0z8luou + SequenceFlow_0ec9eiq + SequenceFlow_030mhcm + + + + SequenceFlow_0q1hz2p + SequenceFlow_1iy3cqb + + + + + + SequenceFlow_0gbsa12 + SequenceFlow_1m8u8dl + SequenceFlow_0z8luou + + + + + + + SequenceFlow_0gd64w9 + + + + + SequenceFlow_11 + + + + + + + + SequenceFlow_1iy3cqb + SequenceFlow_09xwplc + + + + + SequenceFlow_1dgzhsm + SequenceFlow_0ec9eiq + + ${sdncReplDelay} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceBRGRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceBRGRollback.bpmn new file mode 100644 index 0000000000..f369504856 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceBRGRollback.bpmn @@ -0,0 +1,575 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_0bfuk6l + + + + SequenceFlow_0ymy62j + + + + + + + + + + + + + + + SequenceFlow_1fvfplx + SequenceFlow_15knw0q + + + SequenceFlow_15knw0q + SequenceFlow_0c5h00o + + + + + + + + + + + + SequenceFlow_0m483rd + SequenceFlow_0eb41vb + + + SequenceFlow_0eb41vb + SequenceFlow_0sh1u69 + + + + + + + + + + + + SequenceFlow_04hdt5s + SequenceFlow_1s7yieq + + + SequenceFlow_1s7yieq + SequenceFlow_00i7x43 + + + + + + + SequenceFlow_1h61pqs + + + + SequenceFlow_1kbzr5v + + + SequenceFlow_1h61pqs + SequenceFlow_1kbzr5v + + + + + + + SequenceFlow_00i7x43 + SequenceFlow_13mhe5h + SequenceFlow_0m483td + SequenceFlow_03bkrg4 + + + + SequenceFlow_0c5h00o + SequenceFlow_0dzz8fp + SequenceFlow_0m483rd + SequenceFlow_0m483st + + + SequenceFlow_0gd64w9 + + + + + SequenceFlow_144pxkp + SequenceFlow_0g4cl5f + + + + SequenceFlow_0g4cl5f + + + + + + + + + + + + + SequenceFlow_0ebobc7 + + + + SequenceFlow_0ebobc7 + SequenceFlow_1ugqw84 + + + + SequenceFlow_1ugqw84 + + + + + + + SequenceFlow_03bkrg4 + SequenceFlow_0oe57h4 + SequenceFlow_0ymy62j + + + + SequenceFlow_0sh1u69 + SequenceFlow_0m483st + SequenceFlow_04hdt5s + SequenceFlow_0m483td + + + + + + + + SequenceFlow_1c07scr + SequenceFlow_0xm9g9s + SequenceFlow_144pxkp + + + + + + SequenceFlow_0xm9g9s + + + + + SequenceFlow_13mhe5h + + + + + SequenceFlow_0bfuk6l + SequenceFlow_1c07scr + SequenceFlow_0oe57h4 + + + + + + + SequenceFlow_0gd64w9 + SequenceFlow_1fvfplx + SequenceFlow_0dzz8fp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn new file mode 100644 index 0000000000..f26bae0b39 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn @@ -0,0 +1,755 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + notFound + SequenceFlow_6 + + + + + + + + + + + + + + + SequenceFlow_2 + SequenceFlow_4 + + + + SequenceFlow_4 + notFound + found + + + + found + SequenceFlow_0gbsa12 + + + + SequenceFlow_6 + + + + SequenceFlow_17p4ohs + SequenceFlow_11 + + + + + SequenceFlow_09xwplc + + + + + + + + + + SequenceFlow_0gd64w9 + SequenceFlow_1q6udwm + + + + + + + + + + + + SequenceFlow_1q6udwm + SequenceFlow_15knw0q + + + SequenceFlow_15knw0q + SequenceFlow_0c5h00o + + + + SequenceFlow_0c5h00o + SequenceFlow_1lalmvp + + + + + + + + + + + + SequenceFlow_1lalmvp + SequenceFlow_0eb41vb + + + SequenceFlow_0eb41vb + SequenceFlow_15z3gpq + + + + SequenceFlow_04t1zc2 + SequenceFlow_06w33tk + + + + + + + + + + + + SequenceFlow_06w33tk + SequenceFlow_1s7yieq + + + SequenceFlow_1s7yieq + SequenceFlow_00i7x43 + + + + + + + + + + + + + + + + + SequenceFlow_030mhcm + SequenceFlow_0q1hz2p + + + + + + + + + + + + + + SequenceFlow_1m8u8dl + SequenceFlow_1vg5rfa + + + + SequenceFlow_1vg5rfa + SequenceFlow_17p4ohs + SequenceFlow_0f7u5pu + + + + + + SequenceFlow_0f7u5pu + SequenceFlow_16o7col + + + + SequenceFlow_16o7col + + + + + + + SequenceFlow_1h61pqs + + + + SequenceFlow_0t4ut76 + + + SequenceFlow_1h61pqs + SequenceFlow_1kbzr5v + + + + SequenceFlow_1cxj4yz + SequenceFlow_0t4ut76 + + + + + + + + + + + + + + SequenceFlow_1kbzr5v + SequenceFlow_1cxj4yz + + + + + SequenceFlow_00i7x43 + SequenceFlow_07kxd8t + + + + SequenceFlow_15z3gpq + SequenceFlow_04t1zc2 + + + + SequenceFlow_0z8luou + SequenceFlow_08hhqb2 + SequenceFlow_030mhcm + + + + SequenceFlow_0q1hz2p + SequenceFlow_1iy3cqb + + + + + + SequenceFlow_0gbsa12 + SequenceFlow_1m8u8dl + SequenceFlow_0z8luou + + + + + + + SequenceFlow_0gd64w9 + + + + + SequenceFlow_11 + + + + + + + + SequenceFlow_1iy3cqb + SequenceFlow_09xwplc + + + + + + SequenceFlow_07kxd8t + SequenceFlow_08hhqb2 + + ${sdncReplDelay} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceTXCRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceTXCRollback.bpmn new file mode 100644 index 0000000000..490f2b637a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceTXCRollback.bpmn @@ -0,0 +1,575 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_0bfuk6l + + + + SequenceFlow_0ymy62j + + + + + + + + + + + + + + + SequenceFlow_1fvfplx + SequenceFlow_15knw0q + + + SequenceFlow_15knw0q + SequenceFlow_0c5h00o + + + + + + + + + + + + SequenceFlow_0m483rd + SequenceFlow_0eb41vb + + + SequenceFlow_0eb41vb + SequenceFlow_0sh1u69 + + + + + + + + + + + + SequenceFlow_04hdt5s + SequenceFlow_1s7yieq + + + SequenceFlow_1s7yieq + SequenceFlow_00i7x43 + + + + + + + SequenceFlow_1h61pqs + + + + SequenceFlow_1kbzr5v + + + SequenceFlow_1h61pqs + SequenceFlow_1kbzr5v + + + + + + + SequenceFlow_00i7x43 + SequenceFlow_13mhe5h + SequenceFlow_0m483td + SequenceFlow_03bkrg4 + + + + SequenceFlow_0c5h00o + SequenceFlow_0dzz8fp + SequenceFlow_0m483rd + SequenceFlow_0m483st + + + SequenceFlow_0gd64w9 + + + + + SequenceFlow_144pxkp + SequenceFlow_0g4cl5f + + + + SequenceFlow_0g4cl5f + + + + + + + + + + + + + SequenceFlow_0ebobc7 + + + + SequenceFlow_0ebobc7 + SequenceFlow_1ugqw84 + + + + SequenceFlow_1ugqw84 + + + + + + + SequenceFlow_03bkrg4 + SequenceFlow_0oe57h4 + SequenceFlow_0ymy62j + + + + SequenceFlow_0sh1u69 + SequenceFlow_0m483st + SequenceFlow_04hdt5s + SequenceFlow_0m483td + + + + + + + + SequenceFlow_1c07scr + SequenceFlow_0xm9g9s + SequenceFlow_144pxkp + + + + + + SequenceFlow_0xm9g9s + + + + + SequenceFlow_13mhe5h + + + + + SequenceFlow_0bfuk6l + SequenceFlow_1c07scr + SequenceFlow_0oe57h4 + + + + + + + SequenceFlow_0gd64w9 + SequenceFlow_1fvfplx + SequenceFlow_0dzz8fp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2ENetworkInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2ENetworkInstance.bpmn new file mode 100644 index 0000000000..07de3fc0b1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2ENetworkInstance.bpmn @@ -0,0 +1,136 @@ + + + + + SequenceFlow_1gomb9n + + + SequenceFlow_1gomb9n + SequenceFlow_0s7w7gp + + + + SequenceFlow_1wtx8gj + SequenceFlow_0k06cqp + + + + + + + + + + + + SequenceFlow_0s7w7gp + SequenceFlow_1wtx8gj + + + SequenceFlow_0o6bjmn + + + + + + + + + + + + + SequenceFlow_0k06cqp + SequenceFlow_1oql7zl + + + SequenceFlow_1oql7zl + SequenceFlow_0o6bjmn + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn new file mode 100644 index 0000000000..a5fadcf14b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -0,0 +1,544 @@ + + + + + SequenceFlow_1qiiycn + + + SequenceFlow_1qiiycn + SequenceFlow_0w9t6tc + + + + + + + + + + + + + + + SequenceFlow_1i7t9hq + SequenceFlow_4 + + + + + + + + + + + + + SequenceFlow_1w01tqs + SequenceFlow_129ih1g + + + + + SequenceFlow_0tgrn11 + + + + SequenceFlow_1xzgv5k + + + + + + + + + + SequenceFlow_1lqktwf + SequenceFlow_0eumzpf + + + + + SequenceFlow_0tgrn11 + SequenceFlow_1lqktwf + + + + + SequenceFlow_0eumzpf + SequenceFlow_1xzgv5k + + + + + + SequenceFlow_4 + SequenceFlow_1w01tqs + + + + + SequenceFlow_129ih1g + SequenceFlow_1tkgqu3 + + + + + SequenceFlow_03ebqhf + SequenceFlow_1qctzm0 + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_initResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1qctzm0 + SequenceFlow_13xfsff + + + SequenceFlow_0w9t6tc + + + + SequenceFlow_012h7yx + + + + SequenceFlow_0xjwb45 + SequenceFlow_012h7yx + + + + + + + + + + + + SequenceFlow_0qxzgvq + SequenceFlow_0xjwb45 + + + SequenceFlow_166w91p + SequenceFlow_0qxzgvq + + + + SequenceFlow_166w91p + + + + + + + + SequenceFlow_1tkgqu3 + + + + + + SequenceFlow_1i7t9hq + + + + + SequenceFlow_1hbesp9 + + + + + SequenceFlow_01s0ef2 + SequenceFlow_03ebqhf + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0bf6bzp + SequenceFlow_0d0c20n + + + SequenceFlow_13xfsff + SequenceFlow_0bf6bzp + + + + SequenceFlow_0d0c20n + SequenceFlow_0a6vgsu + + + + + + + SequenceFlow_0a6vgsu + + + + + + + SequenceFlow_1hbesp9 + SequenceFlow_01s0ef2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceRollback.bpmn new file mode 100644 index 0000000000..c26ad9ae59 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceRollback.bpmn @@ -0,0 +1,373 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + SequenceFlow_01l4ssl + + + + SequenceFlow_8 + + + + SequenceFlow_7 + + + + SequenceFlow_8 + SequenceFlow_7 + + + + + + + SequenceFlow_06aasqh + SequenceFlow_11fnnkb + SequenceFlow_1uw2p9a + + + + + + + rollback AAI + SequenceFlow_1uw2p9a + SequenceFlow_1njogr1 + SequenceFlow_1n7wade + SequenceFlow_1x9eh33 + + + + + + + + + + + + + + + + + SequenceFlow_11fnnkb + SequenceFlow_0k28xib + + + SequenceFlow_0k28xib + SequenceFlow_0khjo7l + + + + + SequenceFlow_2 + SequenceFlow_06aasqh + SequenceFlow_1rzlaoy + + + SequenceFlow_05wu9i7 + SequenceFlow_1n7wade + SequenceFlow_1rzlaoy + SequenceFlow_01l4ssl + + + + + + + + + + SequenceFlow_1ch4xrf + + + + SequenceFlow_1ch4xrf + SequenceFlow_1pjk2ff + + + + SequenceFlow_1pjk2ff + + + + + + + SequenceFlow_006g9e8 + SequenceFlow_1njogr1 + + + + + + + + + + + + SequenceFlow_0khjo7l + SequenceFlow_006g9e8 + + + + + SequenceFlow_1x9eh33 + SequenceFlow_05wu9i7 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn new file mode 100644 index 0000000000..4c107c7cb4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn @@ -0,0 +1,1051 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + + + + + + + + + + + SequenceFlow_2 + SequenceFlow_4 + + + + + + + + + + + + + SequenceFlow_0zmz5am + SequenceFlow_129ih1g + + + + + SequenceFlow_0tgrn11 + + + + SequenceFlow_1xzgv5k + + + + + + + + + + SequenceFlow_1lqktwf + SequenceFlow_0eumzpf + + + + + SequenceFlow_0tgrn11 + SequenceFlow_1lqktwf + + + + + SequenceFlow_0eumzpf + SequenceFlow_1xzgv5k + + + + + + SequenceFlow_4 + SequenceFlow_10aubhh + + + + SequenceFlow_129ih1g + SequenceFlow_03fabby + + + + + + SequenceFlow_13l7ffp + SequenceFlow_0gorww6 + + + + SequenceFlow_1wf52w6 + SequenceFlow_1t9tmp4 + SequenceFlow_14ef6wp + SequenceFlow_163tmnq + + + + + + + SequenceFlow_1t9tmp4 + SequenceFlow_1t4cc7w + + + + + + + + + + + + + + + + + SequenceFlow_1a1du22 + SequenceFlow_1p99k36 + + + + SequenceFlow_0cyffv0 + SequenceFlow_07q8ra0 + + + + SequenceFlow_06byir6 + SequenceFlow_0ylmq2b + + + + SequenceFlow_0vey6x4 + SequenceFlow_0br9juy + + + + SequenceFlow_0ylmq2b + SequenceFlow_07q8ra0 + SequenceFlow_0gxsqsa + SequenceFlow_1yhd9dp + + + + + SequenceFlow_1rhn48b + SequenceFlow_1mbrbsc + SequenceFlow_13l7ffp + SequenceFlow_1fq4qzy + + + + SequenceFlow_1r1hl23 + SequenceFlow_1ct6u3o + + + + SequenceFlow_1vio1tn + SequenceFlow_07pkpa0 + + + SequenceFlow_0br9juy + SequenceFlow_06byir6 + + + SequenceFlow_0cnuo36 + SequenceFlow_1lkpfe2 + + + + SequenceFlow_1t4cc7w + SequenceFlow_1a1du22 + SequenceFlow_14jy44g + + + + SequenceFlow_1p99k36 + SequenceFlow_14jy44g + SequenceFlow_0cyffv0 + + + + + + + + + + SequenceFlow_14ef6wp + SequenceFlow_0gxsqsa + + + + + + SequenceFlow_10aubhh + + + + SequenceFlow_0zmz5am + + + + + + SequenceFlow_1rhn48b + + + + + SequenceFlow_1ct6u3o + + + + + SequenceFlow_1rebkae + + + + SequenceFlow_1lkpfe2 + + + + + + + SequenceFlow_1fq4qzy + + + + SequenceFlow_10jgs3j + SequenceFlow_1wf52w6 + + + + + SequenceFlow_1yhd9dp + SequenceFlow_0uj9myy + + + + + + SequenceFlow_03fabby + + + + SequenceFlow_0e8oxe4 + + + + + SequenceFlow_07pkpa0 + SequenceFlow_01zluif + SequenceFlow_0vey6x4 + + + + + + + + SequenceFlow_163tmnq + SequenceFlow_01zluif + SequenceFlow_1vio1tn + + + + + + + SequenceFlow_0e8oxe4 + SequenceFlow_1sata7n + + + + + + + ${URN_mso_openecomp_adapters_db_endpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1sata7n + SequenceFlow_0x0jvs1 + + + + + SequenceFlow_1rebkae + SequenceFlow_0gr3l25 + + + + + + + ${URN_mso_openecomp_adapters_db_endpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_0gr3l25 + SequenceFlow_0cnuo36 + + + + + SequenceFlow_0uj9myy + SequenceFlow_037rvnb + + + + + + + + ${URN_mso_openecomp_adapters_db_endpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_037rvnb + SequenceFlow_1mbrbsc + + + + SequenceFlow_0x0jvs1 + SequenceFlow_0aylb6e + + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_initResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_0aylb6e + SequenceFlow_1r1hl23 + + + + + + + ${URN_mso_openecomp_adapters_db_endpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_01oo8ar + SequenceFlow_10jgs3j + + + + SequenceFlow_0gorww6 + SequenceFlow_01oo8ar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn new file mode 100644 index 0000000000..12dbfe6dde --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn @@ -0,0 +1,1363 @@ + + + + + SequenceFlow_1n61wit + + + isReturnCode404_No_SequenceFlow + + + + isNetworkActiveNo_SequenceFlow + isReturnCode404_Yes_SequenceFlow + SequenceFlow_21 + + + + SequenceFlow_21 + isNameSentNo_SequenceFlow + SequenceFlow_32 + + + + + isSdncRpc1No_SequenceFlow1 + SequenceFlow_11 + + + + + SequenceFlow_12 + SequenceFlow_0d93bqw + SequenceFlow_5 + + + + SequenceFlow_5 + sdncTopoNo_SequenceFlow + sdncTopoYes_SequenceFlow + + + + + + + + SequenceFlow_34 + + + + + sdncTopoNo_SequenceFlow + SequenceFlow_34 + + + + sdncTopoYes_SequenceFlow + SequenceFlow_16 + + + + + + + + + + + + + + SequenceFlow_11 + SequenceFlow_12 + + + + SequenceFlow_59 + SequenceFlow_13 + + + + isAAIQueryNameYes_SequenceFlow + isNetworkActiveYes_SequenceFlow + isNetworkActiveNo_SequenceFlow + + + + + + + SequenceFlow_6 + isAAIQueryNameNo_SequenceFlow + isAAIQueryNameYes_SequenceFlow + + + + + + + isAAIQueryNameNo_SequenceFlow + isReturnCode404_No_SequenceFlow + isReturnCode404_Yes_SequenceFlow + + + + + + + + SequenceFlow_23 + + + + + isRollbackOn_SequenceFlow_Yes + isPONR_Yes_SequenceFlow + isPONR_No_SequenceFlow + + + + + + + SequenceFlow_0k7y7b5 + sdncOk_Yeso_ExclusiveGateway + sdncOk_No_ExclusiveGateway + + + + + + + isSdncRpc4No_SequenceFlow4 + SequenceFlow_0lndbvr + + + + isPONR_No_SequenceFlow + SequenceFlow_0cly7z2 + SequenceFlow_12tlymf + + + + + + + sdncOk_Yeso_ExclusiveGateway + isSdncRpc4Yes_SequenceFlow4 + isSdncRpc4No_SequenceFlow4 + + + + + + + isSdncRpc4Yes_SequenceFlow4 + SequenceFlow_0bwpkkb + + + + SequenceFlow_1qwubew + + + SequenceFlow_15sffxc + SequenceFlow_096tad6 + + + + + SequenceFlow_0cly7z2 + SequenceFlow_0b8j5rw + + + + + + + + + + + + + + + + + + SequenceFlow_096tad6 + SequenceFlow_0vzsyrd + + + + + + + SequenceFlow_0vzsyrd + SequenceFlow_17nx822 + SequenceFlow_1qwubew + + + + + SequenceFlow_10ttvwn + isRollbackOn_SequenceFlow_Yes + isRollbackOn_SequenceFlow_No + + + + + + + SequenceFlow_0lndbvr + sdncOk_No_ExclusiveGateway + SequenceFlow_0bwpkkb + SequenceFlow_15sffxc + + + + SequenceFlow_0b8j5rw + SequenceFlow_12tlymf + SequenceFlow_0k7y7b5 + + + + isPONR_Yes_SequenceFlow + isRollbackOn_SequenceFlow_No + SequenceFlow_17nx822 + + + + SequenceFlow_23 + SequenceFlow_10ttvwn + + + + + + + PO Network Rollback is created in validation. + + + + + + + + ${CRENWKI_createNetworkRequest} + + + + #{BasicAuthHeaderValuePO} + application/xml + + + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_61 + SequenceFlow_59 + + + + + SequenceFlow_13 + SequenceFlow_35 + + + + + SequenceFlow_35 + SequenceFlow_1ipz2ze + + + + + SequenceFlow_10 + SequenceFlow_14 + + + + + SequenceFlow_10 + + + + + SequenceFlow_14 + + + + + + + + + + + + + SequenceFlow_0ftylq3 + SequenceFlow_3 + + + isNameSentYes_SequenceFlow + SequenceFlow_6 + + + + + + SequenceFlow_3 + siFoundYes + siFoundNo + + + + + + + siFoundNo + + + + SequenceFlow_16 + SequenceFlow_15 + + + + + SequenceFlow_15 + SequenceFlow_38 + + + + + SequenceFlow_20 + SequenceFlow_61 + + + + + SequenceFlow_38 + SequenceFlow_20 + + + + + + SequenceFlow_1n61wit + SequenceFlow_0ftylq3 + + + + + siFoundYes + isNameSentYes_SequenceFlow + isNameSentNo_SequenceFlow + + + + + + + + + + + + + + + + SequenceFlow_13deudk + SequenceFlow_08qibb9 + + + isSdncRpc2Yes_SequenceFlow2 + SequenceFlow_13deudk + + + + SequenceFlow_1t03rs2 + SequenceFlow_1jia57e + SequenceFlow_18ybfu5 + + + + + + + + + + SequenceFlow_08qibb9 + SequenceFlow_1t03rs2 + + + + SequenceFlow_0s51ns0 + + + + + SequenceFlow_18ybfu5 + SequenceFlow_0s51ns0 + + + + SequenceFlow_32 + isSdncRpc1No_SequenceFlow1 + isSdncRpc1Yes_SequenceFlow1 + + + + + + + + + + + + + + + + SequenceFlow_0j8bxnb + SequenceFlow_0d93bqw + + + + + SequenceFlow_1ipz2ze + isSdncRpc2Yes_SequenceFlow2 + isSdncRpc2No_SequenceFlow2 + + + + + + + isSdncRpc1Yes_SequenceFlow1 + SequenceFlow_0j8bxnb + + + + SequenceFlow_1s8b1m1 + + + SequenceFlow_18ylufb + + + + SequenceFlow_1jia57e + isSdncRpc2No_SequenceFlow2 + SequenceFlow_1s8b1m1 + + + + + isNetworkActiveYes_SequenceFlow + SequenceFlow_18ylufb + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstanceRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstanceRollback.bpmn new file mode 100644 index 0000000000..6a4861b9a4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstanceRollback.bpmn @@ -0,0 +1,517 @@ + + + + + SequenceFlow_1krl2dg + + + SequenceFlow_1krl2dg + SequenceFlow_0u41iz2 + + + + + + + + + + + + + + + SequenceFlow_1mxbdps + SequenceFlow_07s5r14 + + + + + + + + + + + + SequenceFlow_0mw0dgd + SequenceFlow_1rrutp3 + + + SequenceFlow_0u41iz2 + SequenceFlow_1bb7zpp + SequenceFlow_1mxbdps + + + SequenceFlow_1bb7zpp + SequenceFlow_07s5r14 + SequenceFlow_0e1uixp + SequenceFlow_1lteduj + + + + + + + + + + + + SequenceFlow_101y57s + SequenceFlow_0790olb + + + SequenceFlow_0virkpu + SequenceFlow_101y57s + SequenceFlow_0mw0dgd + + + SequenceFlow_0qc4v9t + SequenceFlow_0el8yzs + SequenceFlow_0yto4gz + + + + SequenceFlow_1lteduj + SequenceFlow_17o4w67 + SequenceFlow_0virkpu + SequenceFlow_0qc4v9t + + + + + + + + + + + + + + + + + + + + SequenceFlow_0yto4gz + + + + + + + SequenceFlow_0xktw7v + SequenceFlow_0soe5t3 + + + + SequenceFlow_0xktw7v + + + + SequenceFlow_0soe5t3 + + + + + + SequenceFlow_1rrutp3 + SequenceFlow_0790olb + SequenceFlow_0el8yzs + + + + + + SequenceFlow_0lomcvn + + + SequenceFlow_0q0te67 + SequenceFlow_0lomcvn + + + + + + SequenceFlow_0q0te67 + + + + + SequenceFlow_0ctlrql + + + + + SequenceFlow_0ctlrql + + + + SequenceFlow_1j55a94 + + + + SequenceFlow_1yn24xq + + + + SequenceFlow_1j55a94 + SequenceFlow_1yn24xq + + + + + + SequenceFlow_0e1uixp + SequenceFlow_17o4w67 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn new file mode 100644 index 0000000000..dc2cf9b676 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn @@ -0,0 +1,370 @@ + + + + + SequenceFlow_1qiiycn + + + SequenceFlow_1qiiycn + SequenceFlow_0w9t6tc + + + + SequenceFlow_16nxl6h + SequenceFlow_0epxs3b + + + + SequenceFlow_0k0f7lm + SequenceFlow_11f2zuu + + + + SequenceFlow_1hbesp9 + SequenceFlow_13d9g1n + + + + + SequenceFlow_1jenxlp + SequenceFlow_0q6uy30 + SequenceFlow_16nxl6h + + + + SequenceFlow_13c7bhn + SequenceFlow_1jenxlp + + + + + SequenceFlow_0q6uy30 + SequenceFlow_1qozd66 + SequenceFlow_0uiygod + + + + SequenceFlow_13d9g1n + SequenceFlow_18wj44x + SequenceFlow_1vprtt9 + + + + SequenceFlow_0uiygod + SequenceFlow_1u9k0dm + + + + SequenceFlow_1u9k0dm + SequenceFlow_13c7bhn + + + + SequenceFlow_0w9t6tc + + + + + + SequenceFlow_18wj44x + SequenceFlow_11f2zuu + + + + + + + SequenceFlow_1hbesp9 + + + + + SequenceFlow_1qozd66 + + + + + + + + + + + SequenceFlow_0epxs3b + + + + + SequenceFlow_0gr9xqj + + + + SequenceFlow_0a6l29p + + + SequenceFlow_0gr9xqj + SequenceFlow_0a6l29p + + + + + + + SequenceFlow_1vprtt9 + SequenceFlow_0k0f7lm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstance.bpmn new file mode 100644 index 0000000000..29116a67fc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstance.bpmn @@ -0,0 +1,515 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_2 + SequenceFlow_3 + + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + SequenceFlow_156ih25 + SequenceFlow_14 + + + + SequenceFlow_9 + SequenceFlow_10 + + + + + + + + + + + + SequenceFlow_14 + SequenceFlow_9 + + + SequenceFlow_01q6pl4 + + + + + + + + + + + + + + + SequenceFlow_11fnnkb + SequenceFlow_4 + + + + + + + + + + + + + SequenceFlow_1uw2p9a + SequenceFlow_1w01tqs + SequenceFlow_1jhzmzn + + + SequenceFlow_3 + SequenceFlow_11fnnkb + SequenceFlow_1uw2p9a + + + + + + + + SequenceFlow_0tgrn11 + + + + SequenceFlow_1xzgv5k + + + + + + + + + + SequenceFlow_1lqktwf + SequenceFlow_0eumzpf + + + + + SequenceFlow_0tgrn11 + SequenceFlow_1lqktwf + + + + + SequenceFlow_0eumzpf + SequenceFlow_1xzgv5k + + + + + + SequenceFlow_0w5i6vf + SequenceFlow_156ih25 + SequenceFlow_00v4npo + + + + SequenceFlow_00v4npo + + + + + + SequenceFlow_4 + SequenceFlow_1w01tqs + + + + + + + + + + + + + + + SequenceFlow_10 + SequenceFlow_0tx5frq + + + + + SequenceFlow_0tx5frq + SequenceFlow_01q6pl4 + + + + SequenceFlow_1jhzmzn + SequenceFlow_16sdyz9 + + + + + SequenceFlow_16sdyz9 + SequenceFlow_0k0wn03 + + + + SequenceFlow_0k0wn03 + SequenceFlow_0w5i6vf + + + + + + + + SequenceFlow_0x48any + SequenceFlow_052o4xc + + + + SequenceFlow_0x48any + + + + SequenceFlow_052o4xc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceRollback.bpmn new file mode 100644 index 0000000000..eb3e35f6fe --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceRollback.bpmn @@ -0,0 +1,373 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + SequenceFlow_01l4ssl + + + + SequenceFlow_8 + + + + SequenceFlow_7 + + + + SequenceFlow_8 + SequenceFlow_7 + + + + + + + SequenceFlow_06aasqh + SequenceFlow_11fnnkb + SequenceFlow_1uw2p9a + + + + + + + rollback AAI + SequenceFlow_1uw2p9a + SequenceFlow_1njogr1 + SequenceFlow_1n7wade + SequenceFlow_1x9eh33 + + + + + + + + + + + + + SequenceFlow_11fnnkb + SequenceFlow_0k28xib + + + SequenceFlow_0k28xib + SequenceFlow_0khjo7l + + + + + SequenceFlow_2 + SequenceFlow_06aasqh + SequenceFlow_1rzlaoy + + + SequenceFlow_1n7wade + SequenceFlow_1rzlaoy + SequenceFlow_0h3wkj4 + SequenceFlow_01l4ssl + + + + + + + + + + SequenceFlow_1ch4xrf + + + + SequenceFlow_1ch4xrf + SequenceFlow_1pjk2ff + + + + SequenceFlow_1pjk2ff + + + + + + + SequenceFlow_006g9e8 + SequenceFlow_1njogr1 + + + + + + + + + + + + SequenceFlow_0khjo7l + SequenceFlow_006g9e8 + + + + + SequenceFlow_1x9eh33 + SequenceFlow_0h3wkj4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceRollbackV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceRollbackV2.bpmn new file mode 100644 index 0000000000..88a99c2938 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceRollbackV2.bpmn @@ -0,0 +1,103 @@ + + + + + SequenceFlow_0r35zfs + + + + SequenceFlow_1f949uf + + + + SequenceFlow_0r35zfs + SequenceFlow_1f949uf + + + + + SequenceFlow_1tnfu1n + + + + + SequenceFlow_0hi9120 + + + + SequenceFlow_1tnfu1n + SequenceFlow_0hi9120 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceV2.bpmn new file mode 100644 index 0000000000..e8dbc8c7f6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceV2.bpmn @@ -0,0 +1,197 @@ + + + + + SequenceFlow_0g8qp84 + + + + + SequenceFlow_0ekno6w + SequenceFlow_1t50vt9 + SequenceFlow_0xhy3o1 + + + + + + + SequenceFlow_0xhy3o1 + + + + SequenceFlow_0eryvle + + + + SequenceFlow_0g8qp84 + SequenceFlow_0651nnp + + + + SequenceFlow_0651nnp + SequenceFlow_0u0ptz7 + + + + SequenceFlow_0u0ptz7 + SequenceFlow_0ekno6w + + + + SequenceFlow_1t50vt9 + SequenceFlow_0eryvle + + + + + SequenceFlow_0mk8fd7 + + + + SequenceFlow_14mdxgk + + + + + + + + + + SequenceFlow_0mk8fd7 + SequenceFlow_14mdxgk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVFCNetworkServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVFCNetworkServiceInstance.bpmn new file mode 100644 index 0000000000..c151370698 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVFCNetworkServiceInstance.bpmn @@ -0,0 +1,261 @@ + + + + + SequenceFlow_1qo2pln + + + + + + SequenceFlow_0khtova + SequenceFlow_1uiz85h + + + + SequenceFlow_1qo2pln + SequenceFlow_0khtova + + + + createNSSuccess_SequenceFlow + SequenceFlow_1ywe21t + + + + SequenceFlow_1uiz85h + createNSSuccess_SequenceFlow + createNSFailed_SequenceFlow + + + + + + + + + SequenceFlow_1ywe21t + instantiateFailed_SequenceFlow + instantiateSuccess_SequenceFlow + + + + + + + + + + SequenceFlow_0xqo13p + operationFinished_SequenceFlow + operationProcessing_SequenceFlow + + + + + + + + + + createNSFailed_SequenceFlow + + + instantiateFailed_SequenceFlow + + + SequenceFlow_0cq2q6g + + + instantiateSuccess_SequenceFlow + SequenceFlow_1gsbpxj + SequenceFlow_0xqo13p + + + + operationFinished_SequenceFlow + SequenceFlow_0cq2q6g + + + + + operationProcessing_SequenceFlow + SequenceFlow_1gsbpxj + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn new file mode 100644 index 0000000000..820d1174be --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn @@ -0,0 +1,1701 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_15 + + + + + SequenceFlow_15 + SequenceFlow_11 + SequenceFlow_40 + + + + + + + + + + + + + + SequenceFlow_43 + SequenceFlow_17 + + + + SequenceFlow_17 + SequenceFlow_19 + SequenceFlow_21 + + + + + + + + + + + + + + + SequenceFlow_19 + SequenceFlow_35 + + + + SequenceFlow_11 + SequenceFlow_21 + SequenceFlow_35 + SequenceFlow_6 + + + + + + + + + + + + + SequenceFlow_18 + SequenceFlow_20 + + + SequenceFlow_20 + SequenceFlow_1nh92s8 + + + + SequenceFlow_8 + SequenceFlow_18 + + + + + + SequenceFlow_0p61zug + SequenceFlow_0aegg0r + SequenceFlow_23 + + + + + + + + + + + + + SequenceFlow_23 + SequenceFlow_24 + + + + + SequenceFlow_24 + SequenceFlow_31 + + + + + + + + + + SequenceFlow_5 + SequenceFlow_10 + + + SequenceFlow_1avfxsz + SequenceFlow_5 + + + + SequenceFlow_10 + SequenceFlow_12 + + + + + + + + + + + + + SequenceFlow_12 + SequenceFlow_13 + + + SequenceFlow_13 + SequenceFlow_14 + + + + SequenceFlow_14 + SequenceFlow_30 + SequenceFlow_28 + + + + + + + + + SequenceFlow_0363dz7 + + + + SequenceFlow_8 + + + + + SequenceFlow_28 + SequenceFlow_3 + + + + + + + + + + SequenceFlow_3 + SequenceFlow_29 + + + + + SequenceFlow_30 + SequenceFlow_29 + SequenceFlow_16 + + + + SequenceFlow_31 + SequenceFlow_32 + + + + + + + + + + + + SequenceFlow_32 + SequenceFlow_33 + + + SequenceFlow_33 + SequenceFlow_1ushk1d + + + + SequenceFlow_0xfanpi + SequenceFlow_0abffyj + + + + + + + SequenceFlow_0zcfn2x + SequenceFlow_170kw7h + + + + SequenceFlow_39 + SequenceFlow_37 + SequenceFlow_0zcfn2x + SequenceFlow_0m382su + + + SequenceFlow_25 + SequenceFlow_27 + + + + + SequenceFlow_27 + SequenceFlow_36 + SequenceFlow_39 + + + + + + + SequenceFlow_36 + SequenceFlow_37 + + + + + SequenceFlow_16 + SequenceFlow_7 + + + + + SequenceFlow_7 + + + + SequenceFlow_40 + SequenceFlow_43 + + + + + + + + SequenceFlow_1 + SequenceFlow_4 + + + + + SequenceFlow_1f53tby + SequenceFlow_0270n5c + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + SequenceFlow_25 + + + + SequenceFlow_1ushk1d + SequenceFlow_0ery1pk + SequenceFlow_0xfanpi + + + + + + + + + SequenceFlow_0ery1pk + SequenceFlow_0abffyj + + + + SequenceFlow_0363dz7 + SequenceFlow_0bi38s7 + SequenceFlow_1k5uku2 + + + SequenceFlow_112los9 + SequenceFlow_1k5uku2 + SequenceFlow_1avfxsz + + + + + + + + + + + SequenceFlow_0bi38s7 + SequenceFlow_1qm81ym + + + + + + + + + + + SequenceFlow_1qm81ym + SequenceFlow_112los9 + + + + + + + + + SequenceFlow_0d00zqi + SequenceFlow_0g270u0 + + + + + + + + + + + + + SequenceFlow_0g270u0 + SequenceFlow_1yrlvgb + + + SequenceFlow_1yrlvgb + SequenceFlow_170kw7h + + + + + + + + + + + + + SequenceFlow_0m382su + SequenceFlow_0d00zqi + + + + SequenceFlow_1y1ttqe + SequenceFlow_0lilmm3 + SequenceFlow_0270n5c + SequenceFlow_05og7iw + + + + + + + + + + + + + + + + SequenceFlow_05og7iw + SequenceFlow_1f53tby + + + + SequenceFlow_02lc25j + + + + SequenceFlow_0z2rczk + SequenceFlow_1pgo10r + + + + + + + + + + + + + SequenceFlow_1i1q78e + SequenceFlow_0112l2c + + + SequenceFlow_04bd5in + SequenceFlow_1i1q78e + + + + SequenceFlow_0112l2c + SequenceFlow_0z2rczk + + + + + + + + SequenceFlow_02lc25j + SequenceFlow_04bd5in + SequenceFlow_1nh7m8d + + + + + + + SequenceFlow_1nh7m8d + SequenceFlow_1pgo10r + + + + + + SequenceFlow_0cc17yk + SequenceFlow_17cp3tn + SequenceFlow_006rnym + + + + + + SequenceFlow_4 + SequenceFlow_1y1ttqe + SequenceFlow_1y8q87e + + + + SequenceFlow_1sf1091 + SequenceFlow_0lilmm3 + SequenceFlow_15i583d + + + + + + + + + + + SequenceFlow_00bh7m7 + + + + + + + SequenceFlow_1nh92s8 + SequenceFlow_16mgvsd + SequenceFlow_1iyt5i4 + + + + + + + + + + + + + + + + + + + SequenceFlow_0ynd0iy + SequenceFlow_1mnipp8 + + + SequenceFlow_17cp3tn + SequenceFlow_0ynd0iy + + + + SequenceFlow_16mgvsd + SequenceFlow_0cc17yk + + + + SequenceFlow_1y8q87e + SequenceFlow_1sf1091 + + + + SequenceFlow_1mnipp8 + SequenceFlow_00bh7m7 + + + + SequenceFlow_15i583d + SequenceFlow_0tfrcnc + SequenceFlow_0oadvvx + + + + + + + SequenceFlow_0tfrcnc + SequenceFlow_0c6p4aa + SequenceFlow_1qzw172 + + + + + + SequenceFlow_1qzw172 + SequenceFlow_0xed5sn + SequenceFlow_0p3cspl + + + + + + + SequenceFlow_0xed5sn + SequenceFlow_1k7xbcu + SequenceFlow_0p61zug + + + + + SequenceFlow_0oadvvx + SequenceFlow_03batve + + + + + + + + + + + + + + SequenceFlow_03batve + SequenceFlow_0c6p4aa + + + SequenceFlow_0p3cspl + SequenceFlow_1k7xbcu + + + + SequenceFlow_006rnym + SequenceFlow_1iyt5i4 + SequenceFlow_0thm33s + + + + + + + + + + SequenceFlow_0thm33s + SequenceFlow_0aegg0r + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn new file mode 100644 index 0000000000..2508b31f01 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn @@ -0,0 +1,978 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_11er1t8 + SequenceFlow_6 + SequenceFlow_9 + + + + + + + + + SequenceFlow_6 + SequenceFlow_8 + + + + + + + + SequenceFlow_8 + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_15 + + + SequenceFlow_1p0v6yk + SequenceFlow_16 + + + + + + + + + + + + + SequenceFlow_16 + SequenceFlow_08aruzz + + + + + + + SequenceFlow_13 + SequenceFlow_14 + + + + + + + + + + SequenceFlow_14 + SequenceFlow_18 + + + + SequenceFlow_1gcfdej + SequenceFlow_13 + SequenceFlow_17 + + + + + + + SequenceFlow_17 + SequenceFlow_18 + SequenceFlow_19 + SequenceFlow_20 + + + + + + + SequenceFlow_1rpg6ac + SequenceFlow_32 + + + + + + + + + + + + + + SequenceFlow_32 + SequenceFlow_2 + + + SequenceFlow_20 + SequenceFlow_4 + SequenceFlow_12otwa4 + SequenceFlow_21 + SequenceFlow_24 + + + + + + + + + + + + + SequenceFlow_34 + SequenceFlow_35 + + + + SequenceFlow_0ggp8wz + SequenceFlow_1h8ve60 + + + SequenceFlow_24 + SequenceFlow_34 + + + + + + SequenceFlow_2 + SequenceFlow_4 + + + + + + SequenceFlow_12 + + + + SequenceFlow_22 + + + + + SequenceFlow_02fx6z6 + SequenceFlow_22 + + + + + SequenceFlow_12 + SequenceFlow_02fx6z6 + + + + + SequenceFlow_23 + + + + SequenceFlow_23 + + + + SequenceFlow_1 + SequenceFlow_5 + + + + + SequenceFlow_0djpj3r + SequenceFlow_0n58kg1 + SequenceFlow_185bo77 + SequenceFlow_111l1he + + + SequenceFlow_0unumxv + SequenceFlow_0djpj3r + + + + SequenceFlow_111l1he + SequenceFlow_0ca4brn + + + + + + + + + + + SequenceFlow_0ca4brn + SequenceFlow_19r2uus + + + + SequenceFlow_185bo77 + SequenceFlow_19r2uus + SequenceFlow_1p0v6yk + SequenceFlow_03i4czf + + + + + + + + + + + + + SequenceFlow_5 + SequenceFlow_11er1t8 + SequenceFlow_0ggp8wz + + + + + + + SequenceFlow_06rm0hg + SequenceFlow_15 + SequenceFlow_0n58kg1 + SequenceFlow_0unumxv + + + SequenceFlow_10 + SequenceFlow_0ugalf8 + + + + + + + + + + + + + SequenceFlow_0ugalf8 + SequenceFlow_0n78x37 + + + SequenceFlow_0n78x37 + SequenceFlow_06rm0hg + + + + + + + + + + + + + SequenceFlow_16ghmax + SequenceFlow_1iufuuu + + + + + + + + + + + + + SequenceFlow_1iufuuu + SequenceFlow_1l4n37b + + + SequenceFlow_1l4n37b + SequenceFlow_12otwa4 + + + + SequenceFlow_19 + SequenceFlow_1rpg6ac + SequenceFlow_16ghmax + + + + + + + + + SequenceFlow_21 + SequenceFlow_35 + SequenceFlow_17it51d + SequenceFlow_1h8ve60 + + + + SequenceFlow_03i4czf + SequenceFlow_08aruzz + SequenceFlow_1gcfdej + SequenceFlow_17ne2iz + + + + + + + + + + + + + + SequenceFlow_0fvuowt + SequenceFlow_17it51d + + + SequenceFlow_17ne2iz + SequenceFlow_0fvuowt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn new file mode 100644 index 0000000000..a762b7ecd7 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn @@ -0,0 +1,247 @@ + + + + + + SequenceFlow_0xktw7v + SequenceFlow_0soe5t3 + + + + SequenceFlow_0xktw7v + + + + SequenceFlow_0soe5t3 + + + + + + SequenceFlow_0qreiaa + + + + SequenceFlow_1xah9es + SequenceFlow_11y7faf + SequenceFlow_1wberw3 + + + SequenceFlow_11y7faf + SequenceFlow_0h7k68j + SequenceFlow_10dawse + + + + + + + + + + SequenceFlow_0h7k68j + SequenceFlow_0bv04qn + + + + + + SequenceFlow_0bv04qn + SequenceFlow_17k6oyz + SequenceFlow_13nb3n0 + + + + + + + SequenceFlow_10dawse + SequenceFlow_17k6oyz + SequenceFlow_1do0853 + + + + + + + SequenceFlow_1do0853 + SequenceFlow_1wberw3 + + + SequenceFlow_13nb3n0 + + + + + + SequenceFlow_0qreiaa + SequenceFlow_1xah9es + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn new file mode 100644 index 0000000000..ac48776c95 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn @@ -0,0 +1,362 @@ + + + + + SequenceFlow_1 + SequenceFlow_1wi1cf9 + + + + SequenceFlow_1dpt7ul + SequenceFlow_23 + + + + + SequenceFlow_volGrpName404No + SequenceFlow_7 + + + + + SequenceFlow_19 + SequenceFlow_6 + SequenceFlow_volGrpName404Yes + SequenceFlow_volGrpName404No + + + + + + + SequenceFlow_23 + SequenceFlow_14 + + + + + SequenceFlow_19 + + + + + SequenceFlow_14 + SequenceFlow_6 + + + + + SequenceFlow_volGrpName404Yes + SequenceFlow_9 + + + + + + + + + + + + + + + SequenceFlow_10 + SequenceFlow_1qwurc5 + + + SequenceFlow_1gbt2n5 + SequenceFlow_28 + + + + + SequenceFlow_5 + SequenceFlow_8 + + + + + SequenceFlow_28 + SequenceFlow_5 + + + + + SequenceFlow_8 + + + SequenceFlow_9 + SequenceFlow_10 + + + + + SequenceFlow_1 + + + + SequenceFlow_7 + + + SequenceFlow_1qwurc5 + SequenceFlow_1gbt2n5 + + + + + + + + + + + + + SequenceFlow_1wi1cf9 + SequenceFlow_1vmbvy8 + + + SequenceFlow_1vmbvy8 + SequenceFlow_1dpt7ul + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn new file mode 100644 index 0000000000..dacce53963 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn @@ -0,0 +1,635 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + notFound + SequenceFlow_6 + + + + + + + + + + + + + + + + SequenceFlow_2 + SequenceFlow_4 + + + + SequenceFlow_4 + notFound + found + + + + + + + SequenceFlow_7 + vnfExistYes + vnfExistNo + + + + + + + + + + + + + + + + VnfNameSpecified1 + SequenceFlow_7 + + + + vnfExistYes + SequenceFlow_10 + + + + + SequenceFlow_6 + + + + SequenceFlow_10 + + + + vnfExistNo + VnfNameNotSpecified1 + SequenceFlow_11 + + + + + + SequenceFlow_8 + SequenceFlow_9 + + + + + SequenceFlow_9 + + + SequenceFlow_8 + + + + + + SdncInteractionNotEnabled + SequenceFlow_0bj7c4s + + + + + + + + + SdncInteractionEnabled + SequenceFlow_1q6udwm + + + + + + + + + + + + + SequenceFlow_1q6udwm + SequenceFlow_15knw0q + + + SequenceFlow_15knw0q + SequenceFlow_0lnh79j + + + + SequenceFlow_1q1poly + VnfNameSpecified2 + SequenceFlow_1lalmvp + + + + + + + + + + + + + SequenceFlow_1lalmvp + SequenceFlow_0eb41vb + + + SequenceFlow_0eb41vb + SequenceFlow_15z3gpq + + + + SequenceFlow_1gc18ih + SdncInteractionEnabled + SdncInteractionNotEnabled + + + + + + + + SequenceFlow_11 + SequenceFlow_1gc18ih + + + + found + VnfNameNotSpecified1 + VnfNameSpecified1 + + + + + + + + + + SequenceFlow_0lnh79j + VnfNameNotSpecified2 + VnfNameSpecified2 + + + + + + + + VnfNameNotSpecified2 + SequenceFlow_1h9jdgr + + + + + + + + + + + + + SequenceFlow_1h9jdgr + SequenceFlow_14xac2y + + + SequenceFlow_14xac2y + SequenceFlow_1q1poly + + + + + + + + + + + + SequenceFlow_0nhsdmj + SequenceFlow_0bj7c4s + + + + SequenceFlow_15z3gpq + SequenceFlow_0nhsdmj + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn new file mode 100644 index 0000000000..d817f5703b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn @@ -0,0 +1,527 @@ + + + + + SequenceFlow_0o4vuzt + + + SequenceFlow_0o4vuzt + SequenceFlow_1xd3ri5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1hf7k7q + SequenceFlow_1ixcnb6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1lh21yl + SequenceFlow_1llbx0k + + + SequenceFlow_1llbx0k + SequenceFlow_1mguf2m + + + + SequenceFlow_132bohl + + + + + + + + + + SequenceFlow_1a6wyuu + SequenceFlow_0j52dxv + SequenceFlow_132bohl + SequenceFlow_0jz6bqn + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_19ohb1a + SequenceFlow_07u8e3l + + + SequenceFlow_0jz6bqn + SequenceFlow_12x4dvf + + + + SequenceFlow_1xd3ri5 + SequenceFlow_19ohb1a + + + + SequenceFlow_1mguf2m + SequenceFlow_12x4dvf + SequenceFlow_0kld3qt + SequenceFlow_1vrogpr + + + + + + + + + + + + + + + + + + + + + SequenceFlow_07u8e3l + SequenceFlow_1hf7k7q + + + + + + + + + + + + SequenceFlow_0kld3qt + SequenceFlow_1lh21yl + + + + + + + SequenceFlow_1ixcnb6 + SequenceFlow_1a6wyuu + + + + + SequenceFlow_1h74w1v + + + + + + + + + + + SequenceFlow_03v8mmc + SequenceFlow_0yu0im2 + + + SequenceFlow_1l0rxnh + SequenceFlow_03v8mmc + + + + SequenceFlow_0yu0im2 + SequenceFlow_1h74w1v + + + + + + + + SequenceFlow_1l0rxnh + + + + + + + + SequenceFlow_1vrogpr + SequenceFlow_0j52dxv + + + + + + SequenceFlow_07u8e3l + SequenceFlow_1t407j7 + + + + SequenceFlow_1t407j7 + SequenceFlow_0baw1tl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModulesRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModulesRollback.bpmn new file mode 100644 index 0000000000..a900a4e241 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModulesRollback.bpmn @@ -0,0 +1,541 @@ + + + + + + SequenceFlow_12 + + + + SequenceFlow_22 + + + + SequenceFlow_1wch84s + SequenceFlow_22 + + + + + + SequenceFlow_12 + SequenceFlow_1wch84s + + + + + SequenceFlow_23 + + + + SequenceFlow_23 + + + + SequenceFlow_1537b7m + + + SequenceFlow_1srw52v + SequenceFlow_0zjzorm + SequenceFlow_19xaddm + SequenceFlow_1r6wyy6 + SequenceFlow_0v85t87 + + + SequenceFlow_1g6psjt + SequenceFlow_152tazp + SequenceFlow_1kr0r4a + SequenceFlow_1yas9ol + + + SequenceFlow_0mk9lrj + SequenceFlow_03cc9y6 + + + + SequenceFlow_1537b7m + SequenceFlow_0bmsi5h + + + + + + SequenceFlow_0v85t87 + SequenceFlow_1ycq005 + + + + + + + + + + + + + + + + SequenceFlow_1ycq005 + SequenceFlow_181hb2a + + + + 0}]]> + + + + + + + + + + + + + SequenceFlow_1kr0r4a + SequenceFlow_04yd2yr + + + + SequenceFlow_181hb2a + SequenceFlow_1srw52v + + + + + SDNCDeactivateYes + SequenceFlow_0nysmc9 + + + + SequenceFlow_1hc04x2 + SequenceFlow_19xaddm + + + + + + + + + + + + + SequenceFlow_0nysmc9 + SequenceFlow_1hc04x2 + + + + + SequenceFlow_1rezswi + SequenceFlow_0zjzorm + SDNCDeactivateYes + + + + + + + + SequenceFlow_1r6wyy6 + SequenceFlow_1g6psjt + SequenceFlow_01am36p + + + + SequenceFlow_01am36p + SequenceFlow_0a5ecvu + + + + + + + + + + + + + SequenceFlow_0a5ecvu + SequenceFlow_1ilok6u + + + SequenceFlow_1ilok6u + SequenceFlow_152tazp + + + + + + + + + + SequenceFlow_0bmsi5h + SequenceFlow_1rezswi + SequenceFlow_0mk9lrj + + + + + + + + SequenceFlow_1yas9ol + SequenceFlow_04yd2yr + SequenceFlow_03cc9y6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn new file mode 100644 index 0000000000..73c21090ea --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn @@ -0,0 +1,470 @@ + + + + + SequenceFlow_0vz7cd9 + + + SequenceFlow_0vz7cd9 + SequenceFlow_11e6bfy + + + + SequenceFlow_0e7inkl + + + SequenceFlow_188ejvu + SequenceFlow_0vi0sv6 + + + + SequenceFlow_0oj2anh + SequenceFlow_1ev7z6q + SequenceFlow_0e7inkl + + + + + SequenceFlow_1921mo3 + + + + SequenceFlow_18vlzfo + + + SequenceFlow_1921mo3 + SequenceFlow_18vlzfo + + + + + + + + + + + SequenceFlow_1ubor5z + SequenceFlow_1dza4q4 + + + + + + SequenceFlow_1x3lehs + SequenceFlow_1wnkgpx + + + + + + + + + + + + + + SequenceFlow_1wnkgpx + SequenceFlow_0phwem2 + + + SequenceFlow_1dza4q4 + SequenceFlow_1lxqjmp + + + SequenceFlow_1icwpye + SequenceFlow_1ev7z6q + + + SequenceFlow_0vi0sv6 + SequenceFlow_1ym9otf + + + + + + + ${URN_mso_adapters_openecomp_db_endpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_initResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1ym9otf + SequenceFlow_1j08ko3 + + + + + + + + + + + + + + + SequenceFlow_11e6bfy + SequenceFlow_188ejvu + + + + SequenceFlow_1j08ko3 + SequenceFlow_03c0zlq + + + + + SequenceFlow_1htjmkv + SequenceFlow_1ubor5z + SequenceFlow_1x3lehs + + + SequenceFlow_03c0zlq + SequenceFlow_0s1lswk + SequenceFlow_1htjmkv + + + + + + + + + + + + SequenceFlow_1lxqjmp + SequenceFlow_0phwem2 + SequenceFlow_0l5r96s + + + + + + SequenceFlow_0l5r96s + SequenceFlow_0talboa + SequenceFlow_0s1lswk + + + + SequenceFlow_0talboa + SequenceFlow_1icwpye + SequenceFlow_0oj2anh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn new file mode 100644 index 0000000000..3e76f61224 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn @@ -0,0 +1,928 @@ + + + + + SequenceFlow_0vz7cd9 + + + SequenceFlow_0vz7cd9 + SequenceFlow_11e6bfy + + + + SequenceFlow_06tonva + + + SequenceFlow_188ejvu + SequenceFlow_00a3ijv + + + + SequenceFlow_0t5f2dt + SequenceFlow_0e7inkl + + + + + SequenceFlow_1921mo3 + + + + SequenceFlow_18vlzfo + + + SequenceFlow_1921mo3 + SequenceFlow_18vlzfo + + + + + + + + + + SequenceFlow_1931m8u + SequenceFlow_17b01zs + + + + SequenceFlow_1w2n8dn + SequenceFlow_09z6zl7 + + + + SequenceFlow_1jfyo1x + SequenceFlow_1t1mg6y + + + + + + + SequenceFlow_1bx4es4 + SequenceFlow_1wnkgpx + + + + + + + + + + + + + + SequenceFlow_1wnkgpx + SequenceFlow_1931m8u + + + SequenceFlow_0a1q5fw + SequenceFlow_0rpu756 + + + + + SequenceFlow_1lv9vmb + SequenceFlow_16r9z75 + + + + SequenceFlow_0m7ks9t + SequenceFlow_1g4djgh + + + SequenceFlow_0akcnw7 + SequenceFlow_0uc2beq + + + + + + + + + + + + + + SequenceFlow_11e6bfy + SequenceFlow_188ejvu + + + + SequenceFlow_1qzxy2i + + + + SequenceFlow_1jfyo1x + + + + + + SequenceFlow_09z6zl7 + + + + + SequenceFlow_0homduu + + + + + SequenceFlow_0t5f2dt + + + + + SequenceFlow_0homduu + SequenceFlow_0eoibq3 + SequenceFlow_0n7qeqt + SequenceFlow_13c2v9z + + + + SequenceFlow_0n7qeqt + SequenceFlow_1a5ki3p + + + + + SequenceFlow_17b01zs + SequenceFlow_0gxv0wp + + + + + SequenceFlow_13c2v9z + + + + + + + SequenceFlow_1t1mg6y + SequenceFlow_0a1q5fw + SequenceFlow_1fac57w + + + + + + + SequenceFlow_0rpu756 + SequenceFlow_1fac57w + SequenceFlow_1lv9vmb + + + + + SequenceFlow_16r9z75 + SequenceFlow_0m7ks9t + SequenceFlow_00knko8 + + + + + + + SequenceFlow_1g4djgh + SequenceFlow_00knko8 + SequenceFlow_0akcnw7 + SequenceFlow_15pzf5n + + + + + + + SequenceFlow_033eqeg + + + + + SequenceFlow_00a3ijv + + + + + SequenceFlow_18wibmi + SequenceFlow_11405m9 + + + + + SequenceFlow_033eqeg + SequenceFlow_1sm5x5e + + + + + + + ${URN_mso_openecomp_adapters_db_endpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1sm5x5e + SequenceFlow_18wibmi + + + + + SequenceFlow_0e7inkl + SequenceFlow_0l4qcge + + + + + + + ${URN_mso_openecomp_adapters_db_endpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_0l4qcge + SequenceFlow_06tonva + + + + + SequenceFlow_0gxv0wp + SequenceFlow_1i96ytk + + + + + + + + ${URN_mso_openecomp_adapters_db_endpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1i96ytk + SequenceFlow_0eoibq3 + + + + SequenceFlow_1a5ki3p + SequenceFlow_1oo4g4h + + + + + SequenceFlow_0uc2beq + SequenceFlow_15pzf5n + SequenceFlow_1w2n8dn + + + + + + + + ${URN_mso_openecomp_adapters_db_endpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1oo4g4h + SequenceFlow_1bx4es4 + + + + SequenceFlow_11405m9 + SequenceFlow_15d5odq + + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_initResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_15d5odq + SequenceFlow_1qzxy2i + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteAllottedResourceBRG.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteAllottedResourceBRG.bpmn new file mode 100644 index 0000000000..b10d6b1b18 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteAllottedResourceBRG.bpmn @@ -0,0 +1,422 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_0bfuk6l + + + + SequenceFlow_0bfuk6l + SequenceFlow_0xm9g9s + + + + SequenceFlow_0ymy62j + + + + + + + + + + SequenceFlow_0gd64w9 + SequenceFlow_1q6udwm + + + + + + + + + + + + SequenceFlow_1q6udwm + SequenceFlow_15knw0q + + + SequenceFlow_15knw0q + SequenceFlow_0c5h00o + + + + foundInSDNC + SequenceFlow_1lalmvp + + + + + + + + + + + + SequenceFlow_1lalmvp + SequenceFlow_0eb41vb + + + SequenceFlow_0eb41vb + SequenceFlow_15z3gpq + + + + SequenceFlow_15z3gpq + SequenceFlow_06w33tk + + + + + + + + + + + + SequenceFlow_06w33tk + SequenceFlow_1s7yieq + + + SequenceFlow_1s7yieq + SequenceFlow_00i7x43 + + + + + + + + SequenceFlow_1h61pqs + + + + SequenceFlow_1kbzr5v + + + SequenceFlow_1h61pqs + SequenceFlow_1kbzr5v + + + + + + + SequenceFlow_00i7x43 + notFoundInSDNC + SequenceFlow_0ymy62j + + + + SequenceFlow_0c5h00o + foundInSDNC + notFoundInSDNC + + + SequenceFlow_0gd64w9 + + + + + SequenceFlow_0xm9g9s + SequenceFlow_0g4cl5f + + + + SequenceFlow_0g4cl5f + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteAllottedResourceTXC.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteAllottedResourceTXC.bpmn new file mode 100644 index 0000000000..84895e225d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteAllottedResourceTXC.bpmn @@ -0,0 +1,422 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_0bfuk6l + + + + SequenceFlow_0bfuk6l + SequenceFlow_0xm9g9s + + + + SequenceFlow_0ymy62j + + + + + + + + + + SequenceFlow_0gd64w9 + SequenceFlow_1q6udwm + + + + + + + + + + + + SequenceFlow_1q6udwm + SequenceFlow_15knw0q + + + SequenceFlow_15knw0q + SequenceFlow_0c5h00o + + + + foundInSDNC + SequenceFlow_1lalmvp + + + + + + + + + + + + SequenceFlow_1lalmvp + SequenceFlow_0eb41vb + + + SequenceFlow_0eb41vb + SequenceFlow_15z3gpq + + + + SequenceFlow_15z3gpq + SequenceFlow_06w33tk + + + + + + + + + + + + SequenceFlow_06w33tk + SequenceFlow_1s7yieq + + + SequenceFlow_1s7yieq + SequenceFlow_00i7x43 + + + + + + + + SequenceFlow_1h61pqs + + + + SequenceFlow_1kbzr5v + + + SequenceFlow_1h61pqs + SequenceFlow_1kbzr5v + + + + + + + SequenceFlow_00i7x43 + notFoundInSDNC + SequenceFlow_0ymy62j + + + + SequenceFlow_0c5h00o + foundInSDNC + notFoundInSDNC + + + SequenceFlow_0gd64w9 + + + + + SequenceFlow_0xm9g9s + SequenceFlow_0g4cl5f + + + + SequenceFlow_0g4cl5f + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn new file mode 100644 index 0000000000..a975ebdee0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn @@ -0,0 +1,378 @@ + + + + + SequenceFlow_0vz7cd9 + + + SequenceFlow_0vz7cd9 + SequenceFlow_11e6bfy + + + + SequenceFlow_0e7inkl + + + SequenceFlow_188ejvu + SequenceFlow_0vi0sv6 + + + + SequenceFlow_1cevtpy + SequenceFlow_0e7inkl + + + + + SequenceFlow_1921mo3 + + + + SequenceFlow_18vlzfo + + + SequenceFlow_1921mo3 + SequenceFlow_18vlzfo + + + + + + + + + + SequenceFlow_1961633 + SequenceFlow_1ym9otf + + + + + + + ${URN_mso_adapters_openecomp_db_endpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_initResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1ym9otf + SequenceFlow_1j08ko3 + + + + + + + + + + + + + + + SequenceFlow_11e6bfy + SequenceFlow_188ejvu + + + + + + + + SequenceFlow_0ha8ix9 + + + + SequenceFlow_1961633 + + + + + SequenceFlow_1q2mqnm + SequenceFlow_0fo5vw5 + + + + + + + + + + + + + + + SequenceFlow_0fo5vw5 + SequenceFlow_0orw2f8 + + + SequenceFlow_0orw2f8 + SequenceFlow_0ha8ix9 + + + + + + + + + + + + + + + + + + SequenceFlow_1j08ko3 + SequenceFlow_1cevtpy + + + + SequenceFlow_1q2mqnm + + + + + SequenceFlow_0vi0sv6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteNetworkInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteNetworkInstance.bpmn new file mode 100644 index 0000000000..d6069d714e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteNetworkInstance.bpmn @@ -0,0 +1,933 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_0msqfwu + SequenceFlow_6 + + + + + + + + + + + + + + SequenceFlow_1pdp4d2 + SequenceFlow_12 + + + + SequenceFlow_12 + SequenceFlow_1jnva78 + SequenceFlow_5 + + + + + SequenceFlow_8 + + + + + SequenceFlow_5 + sdncTopoDeleteNo_SequenceFlow + sdncTopoDeleteYes_SequenceFlow + + + SequenceFlow_8 + sdncTopoDeleteNo_SequenceFlow + + + + + + + + + SequenceFlow_1a51h25 + + + + SequenceFlow_1yvnovn + + + SequenceFlow_1nl99y6 + SequenceFlow_1yvnovn + + + + + + SequenceFlow_1wif0e5 + + + + SequenceFlow_021b0sz + SequenceFlow_0tiz0kk + SequenceFlow_1suj1nc + + + + + + + + + + + + + + + + + + + + + SequenceFlow_147vc14 + + + SequenceFlow_0tiz0kk + SequenceFlow_0jb7rws + SequenceFlow_1raa09h + + + + + + SequenceFlow_1suj1nc + SequenceFlow_1raa09h + SequenceFlow_0jb7rws + SequenceFlow_1nl99y6 + + + + + SequenceFlow_1wif0e5 + SequenceFlow_147vc14 + + + + + + + SequenceFlow_1a51h25 + SequenceFlow_021b0sz + + + Rollback Not Needed for Delete. + + + + + isRelationshipExistNo_SequenceFlow + querySuccessYes_SequenceFlow + querySuccessNo_SequenceFlow + + + + + + + querySuccessNo_SequenceFlow + isReturnCode404_No_SequenceFlow + isReturnCode404_Yes_SequenceFlow + + + + + + + isReturnCode404_No_SequenceFlow + + + + querySuccessYes_SequenceFlow + isResponseEmptyNo_SequenceFlow + isResponseEmptyYes_SequenceFlow + + + + + + + isReturnCode404_Yes_SequenceFlow + isResponseEmptyYes_SequenceFlow + silentSuccess_SequenceFlow + + + + SequenceFlow_0f25bme + + + isResponseEmptyNo_SequenceFlow + SequenceFlow_30 + + + + + SequenceFlow_6 + isRelationshipExistNo_SequenceFlow + isRelationshipExistYes_SequenceFlow + + + + + + + isRelationshipExistYes_SequenceFlow + + + + SequenceFlow_1pbgnr2 + + + SequenceFlow_0r3pvf8 + SequenceFlow_1pdp4d2 + + + + SequenceFlow_2 + SequenceFlow_20 + + + + + SequenceFlow_30 + SequenceFlow_15 + + + + + SequenceFlow_15 + SequenceFlow_2 + + + + + + SequenceFlow_13 + + + + SequenceFlow_17 + + + SequenceFlow_13 + SequenceFlow_17 + + + + + + + sdncTopoDeleteYes_SequenceFlow + SequenceFlow_1pbgnr2 + + + + + + SequenceFlow_20 + SequenceFlow_0r3pvf8 + SequenceFlow_0kqnddy + + + + SequenceFlow_0f13b17 + SequenceFlow_0zlbzad + + + + + + + + + + + + + SequenceFlow_0zlbzad + SequenceFlow_1jnva78 + + + + + + + + SequenceFlow_1 + SequenceFlow_0msqfwu + + + + + silentSuccess_SequenceFlow + SequenceFlow_0f25bme + + + + + + + + + + + + + + SequenceFlow_1o088sy + SequenceFlow_1i3193l + + + SequenceFlow_0kqnddy + SequenceFlow_1o088sy + + + + + SequenceFlow_0n8sf23 + SequenceFlow_1qyo7ot + SequenceFlow_0f13b17 + + + SequenceFlow_1i3193l + SequenceFlow_0n8sf23 + + + + SequenceFlow_08hus4u + + + + + + + + + + + SequenceFlow_08hus4u + SequenceFlow_1qyo7ot + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteNetworkInstanceRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteNetworkInstanceRollback.bpmn new file mode 100644 index 0000000000..7ec02addfa --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteNetworkInstanceRollback.bpmn @@ -0,0 +1,547 @@ + + + + + SequenceFlow_1krl2dg + + + SequenceFlow_1krl2dg + SequenceFlow_0u41iz2 + + + + + + + + + + + + + + + SequenceFlow_1mxbdps + SequenceFlow_07s5r14 + + + SequenceFlow_0u41iz2 + SequenceFlow_1bb7zpp + SequenceFlow_1mxbdps + + + SequenceFlow_1xokvq6 + SequenceFlow_1xs882r + SequenceFlow_1ucaagl + + + + + + + + + SequenceFlow_1ucaagl + + + + + SequenceFlow_0xktw7v + SequenceFlow_0soe5t3 + + + + SequenceFlow_0xktw7v + + + + SequenceFlow_0soe5t3 + + + + + + SequenceFlow_1hcmrh9 + SequenceFlow_1pi168e + SequenceFlow_1xs882r + + + + SequenceFlow_1bb7zpp + SequenceFlow_07s5r14 + SequenceFlow_1yj3542 + SequenceFlow_18e00sw + + + + + + + ${DELNWKIR_rollbackNetworkRequest} + + + + #{BasicAuthHeaderValuePO} + application/xml + + + POST + ${response} + ${statusCode} + + http-connector + + + SequenceFlow_18e00sw + SequenceFlow_1eyt8z2 + + + + + + SequenceFlow_1yj3542 + SequenceFlow_1eyt8z2 + SequenceFlow_1xokvq6 + SequenceFlow_172safw + + + SequenceFlow_172safw + SequenceFlow_1wy1aba + SequenceFlow_1yltkyg + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1yltkyg + SequenceFlow_1hcmrh9 + + + + + + + + + + + + SequenceFlow_1wy1aba + SequenceFlow_1pi168e + + + + + SequenceFlow_1s5yjuu + + + SequenceFlow_01hh1wq + SequenceFlow_1s5yjuu + + + + SequenceFlow_01hh1wq + + + + + + + SequenceFlow_0b0m3o7 + + + + SequenceFlow_141226w + + + + + + SequenceFlow_141226w + SequenceFlow_0b0m3o7 + + + + SequenceFlow_1lr1613 + + + + SequenceFlow_0np0b8p + + + + SequenceFlow_1lr1613 + SequenceFlow_0np0b8p + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteResources.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteResources.bpmn new file mode 100644 index 0000000000..7fbfe46cdb --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteResources.bpmn @@ -0,0 +1,486 @@ + + + + + SequenceFlow_0vz7cd9 + + + SequenceFlow_1r5306k + + + + SequenceFlow_1921mo3 + + + + SequenceFlow_18vlzfo + + + SequenceFlow_1921mo3 + SequenceFlow_18vlzfo + + + + + + + + SequenceFlow_1ubor5z + SequenceFlow_1dza4q4 + + + + + + SequenceFlow_1x3lehs + SequenceFlow_1wnkgpx + + + + + + + + + + + + + + SequenceFlow_1wnkgpx + SequenceFlow_0phwem2 + + + SequenceFlow_1dza4q4 + SequenceFlow_1lxqjmp + + + SequenceFlow_1icwpye + SequenceFlow_1yujjwx + + + SequenceFlow_0xqdf1z + SequenceFlow_03c0zlq + + + + SequenceFlow_1htjmkv + SequenceFlow_1ubor5z + SequenceFlow_1x3lehs + + + SequenceFlow_03c0zlq + SequenceFlow_0s1lswk + SequenceFlow_1htjmkv + + + + + + + + + + SequenceFlow_1lxqjmp + SequenceFlow_0phwem2 + SequenceFlow_0l5r96s + + + + + + SequenceFlow_0l5r96s + SequenceFlow_0talboa + SequenceFlow_0s1lswk + + + + SequenceFlow_0talboa + SequenceFlow_1icwpye + SequenceFlow_12avhgx + + + + + + + + + + + SequenceFlow_1yujjwx + SequenceFlow_12avhgx + SequenceFlow_1r5306k + + + + + SequenceFlow_042d7oc + SequenceFlow_1t2hfv0 + SequenceFlow_1t8hf8m + + + + + + + + + + + + + + + SequenceFlow_1t8hf8m + SequenceFlow_0p5gr4z + + + SequenceFlow_0p5gr4z + SequenceFlow_131imj8 + + + + + + + + + + + + SequenceFlow_1n85wxv + SequenceFlow_0xqdf1z + SequenceFlow_042d7oc + + + + + + + SequenceFlow_0vz7cd9 + SequenceFlow_1t2hfv0 + + + + + SequenceFlow_131imj8 + SequenceFlow_1n85wxv + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn new file mode 100644 index 0000000000..fe5e93cbec --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn @@ -0,0 +1,455 @@ + + + + + SequenceFlow_0stqur4 + + + SequenceFlow_1oil1t3 + SequenceFlow_13nyd1j + SequenceFlow_1qm7owo + + + + SequenceFlow_098gain + SequenceFlow_1ly5jrs + + + + SequenceFlow_1ly5jrs + SequenceFlow_0djplpd + SequenceFlow_0i1gez5 + + + + SequenceFlow_0i1gez5 + SequenceFlow_1oil1t3 + SequenceFlow_1d5mzit + + + + + + + + + + + SequenceFlow_0rkycoj + + + + SequenceFlow_117fiux + + + SequenceFlow_0rkycoj + SequenceFlow_117fiux + + + + + + + SequenceFlow_1yrkxjm + SequenceFlow_1s1nnmj + SequenceFlow_0lk19rm + + + + SequenceFlow_0o21fg8 + + + + + + + + + + SequenceFlow_1d5mzit + + + + SequenceFlow_1yrkxjm + + + + SequenceFlow_0lk19rm + SequenceFlow_14fx6hv + SequenceFlow_0o21fg8 + + + + SequenceFlow_14dezx8 + SequenceFlow_13nyd1j + + + + + + SequenceFlow_0stqur4 + SequenceFlow_14dezx8 + + + + SequenceFlow_1qm7owo + SequenceFlow_098gain + SequenceFlow_19ccmqv + + + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_11bgbsh + SequenceFlow_0djplpd + + + SequenceFlow_19ccmqv + SequenceFlow_11bgbsh + + + + + + + + SequenceFlow_1s1nnmj + SequenceFlow_11h5pba + + + + + + + + + + + + + SequenceFlow_11h5pba + SequenceFlow_0gqlayv + + + + + + + + + + + + + SequenceFlow_0etaubw + SequenceFlow_14fx6hv + + + + SequenceFlow_0gqlayv + SequenceFlow_0etaubw + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn new file mode 100644 index 0000000000..fae66a7381 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn @@ -0,0 +1,373 @@ + + + + + SequenceFlow_0jfgn05 + + + SequenceFlow_0jfgn05 + SequenceFlow_1jqc16k + + + + SequenceFlow_1wyvxwi + + + + + + + + + + + + SequenceFlow_0yohjl7 + SequenceFlow_0k28xib + + + SequenceFlow_0k28xib + SequenceFlow_1w8ao21 + + + + + SequenceFlow_1dwch0k + SequenceFlow_1ju26o1 + + + + SequenceFlow_1up0j5r + SequenceFlow_1hcfvcj + SequenceFlow_05jfuko + + + + + + SequenceFlow_05jfuko + + + + + SequenceFlow_1hcfvcj + SequenceFlow_0riudmc + SequenceFlow_1dwch0k + + + + + + + + + + + + + + + + SequenceFlow_1jqc16k + SequenceFlow_1grea1r + + + + SequenceFlow_1grea1r + SequenceFlow_1up0j5r + + + + + + SequenceFlow_0riudmc + SequenceFlow_0znbzxu + SequenceFlow_1wyvxwi + + + + + + SequenceFlow_0u33vy6 + + + + SequenceFlow_0hevfee + + + SequenceFlow_0u33vy6 + SequenceFlow_0hevfee + + + + + + + + + + + + + + + SequenceFlow_1w8ao21 + SequenceFlow_1swzrij + SequenceFlow_14x55db + + + SequenceFlow_14x55db + SequenceFlow_0znbzxu + + + + + + SequenceFlow_1ju26o1 + SequenceFlow_0yohjl7 + SequenceFlow_1swzrij + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVFCNetworkServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVFCNetworkServiceInstance.bpmn new file mode 100644 index 0000000000..e6ad16b4d1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVFCNetworkServiceInstance.bpmn @@ -0,0 +1,275 @@ + + + + + SequenceFlow_1qo2pln + + + + terminateFinished_SequenceFlow + SequenceFlow_1sjop71 + + + + SequenceFlow_1qo2pln + SequenceFlow_150q0fo + + + + SequenceFlow_1h1c24p + SequenceFlow_1ywe21t + + + + SequenceFlow_1sjop71 + deleteNSFailed_SequenceFlow + deleteNSSuccess_SequenceFlow + + + + + + SequenceFlow_1ywe21t + terminateFailed_SequenceFlow + terminateSuccess_SequenceFlow + + + + + + + + + + SequenceFlow_0xqo13p + terminateFinished_SequenceFlow + terminateProcessing_SequenceFlow + + + + + + + + + + deleteNSFailed_SequenceFlow + + + terminateFailed_SequenceFlow + + + SequenceFlow_0cq2q6g + + + terminateSuccess_SequenceFlow + SequenceFlow_1gsbpxj + SequenceFlow_0xqo13p + + + + deleteNSSuccess_SequenceFlow + SequenceFlow_0cq2q6g + + + + + terminateProcessing_SequenceFlow + SequenceFlow_1gsbpxj + + + + + + + + + + + SequenceFlow_150q0fo + SequenceFlow_1h1c24p + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn new file mode 100644 index 0000000000..848796c0b6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn @@ -0,0 +1,433 @@ + + + + + SequenceFlow_0fp1wqz + SequenceFlow_28 + + + + + + + + + + SequenceFlow_28 + SequenceFlow_31 + + + + + + + + + + + SequenceFlow_029ioyr + SequenceFlow_14xn858 + + + + + + + + + + + + + SequenceFlow_32 + SequenceFlow_33 + + + + SequenceFlow_14xn858 + SequenceFlow_4 + + + + SequenceFlow_31 + SequenceFlow_32 + + + + + + + + + + + + + SequenceFlow_4 + SequenceFlow_1xruki1 + + + SequenceFlow_35 + + + + + + + + + SequenceFlow_34 + SequenceFlow_35 + + + + SequenceFlow_2 + SequenceFlow_34 + + + + + SequenceFlow_33 + SequenceFlow_2 + + + + + SequenceFlow_1 + SequenceFlow_12 + + + + + SequenceFlow_12 + SequenceFlow_42 + + + + + SequenceFlow_1 + + + + + SequenceFlow_0coa90m + SequenceFlow_08g02ch + + + + SequenceFlow_1xruki1 + SequenceFlow_0coa90m + + + + + SequenceFlow_08g02ch + SequenceFlow_1yehsyc + SequenceFlow_0ep3hjm + + + + + + + + SequenceFlow_0ep3hjm + SequenceFlow_14l7olw + SequenceFlow_0fp1wqz + + + + + + SequenceFlow_1yehsyc + SequenceFlow_1a7lzhz + + + + + + + + + + + SequenceFlow_1a7lzhz + SequenceFlow_14l7olw + + + + SequenceFlow_42 + SequenceFlow_029ioyr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn new file mode 100644 index 0000000000..b7a1373fe9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn @@ -0,0 +1,396 @@ + + + + + + + + + + + + + + + SequenceFlow_32 + SequenceFlow_33 + + + + SequenceFlow_0kx9e3s + SequenceFlow_4 + + + + SequenceFlow_0ltm4jt + SequenceFlow_32 + + + + + + + + + + + + + SequenceFlow_4 + SequenceFlow_0hia88a + + + SequenceFlow_1eemrjp + + + SequenceFlow_33 + SequenceFlow_2 + + + + + SequenceFlow_1 + SequenceFlow_0qbjihn + + + + + SequenceFlow_0coa90m + SequenceFlow_0ltm4jt + + + + SequenceFlow_0hia88a + SequenceFlow_0coa90m + + + + + SequenceFlow_1 + + + + + + + + SequenceFlow_1igsfgk + SequenceFlow_0y4td40 + + + + + + + + + + + + + SequenceFlow_0y4td40 + SequenceFlow_12q2r4i + + + SequenceFlow_12q2r4i + SequenceFlow_0kx9e3s + + + + + + SequenceFlow_0qbjihn + SequenceFlow_1c2lvlc + + + + + SequenceFlow_1c2lvlc + SequenceFlow_1igsfgk + + + + + SequenceFlow_095634c + + + + SequenceFlow_0yvjvhu + + + SequenceFlow_095634c + SequenceFlow_0yvjvhu + + + + + + + + + + + + + SequenceFlow_092kvy3 + SequenceFlow_1eemrjp + + + SequenceFlow_2 + SequenceFlow_092kvy3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn new file mode 100644 index 0000000000..4409f2a0dc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn @@ -0,0 +1,208 @@ + + + + + SequenceFlow_1gvfdp4 + + + SequenceFlow_1vy2ojp + SequenceFlow_1dlcqmc + + + + SequenceFlow_1dlcqmc + SequenceFlow_1kjccf1 + + + + SequenceFlow_1kjccf1 + SequenceFlow_1tgngf7 + + + + + + + + + + + + + SequenceFlow_1tgngf7 + SequenceFlow_1x3luyj + + + SequenceFlow_0cy0y9t + SequenceFlow_13c3cv2 + + + + SequenceFlow_1sgtwr2 + + + + + + SequenceFlow_1gvfdp4 + SequenceFlow_1vy2ojp + + + + + + SequenceFlow_1x3luyj + SequenceFlow_0cy0y9t + SequenceFlow_1rgd8dg + + + + #{VNFREST_SuccessIndicator == true} + + + SequenceFlow_1rgd8dg + + + + + SequenceFlow_13c3cv2 + SequenceFlow_1sgtwr2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVnf.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVnf.bpmn new file mode 100644 index 0000000000..d9596f0d14 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVnf.bpmn @@ -0,0 +1,303 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + + + + + + + + + + SequenceFlow_2 + SequenceFlow_5 + + + + SequenceFlow_5 + vnfFound + notFound + + + + + + + vnfFound + SequenceFlow_4 + + + + + notFound + + + + SequenceFlow_4 + inUse + notInUse + + + + + + + inUse + SequenceFlow_8 + + + + + SequenceFlow_8 + + + + + + SequenceFlow_19 + + + SequenceFlow_18 + + + + + SequenceFlow_18 + SequenceFlow_19 + + + + + + SequenceFlow_9 + SequenceFlow_12 + SequenceFlow_10 + + + + SequenceFlow_12 + + + + + SequenceFlow_10 + + + + notInUse + SequenceFlow_9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVnfAndModules.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVnfAndModules.bpmn new file mode 100644 index 0000000000..4d6d0006e3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVnfAndModules.bpmn @@ -0,0 +1,490 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_08nd69s + + + + + SequenceFlow_19 + + + SequenceFlow_18 + + + + + SequenceFlow_18 + SequenceFlow_19 + + + + + + SequenceFlow_1uqlr6b + + + + SequenceFlow_0t4yszi + SequenceFlow_1tt31qu + SequenceFlow_1fccvli + SequenceFlow_1qrkdn3 + SequenceFlow_1936oc0 + + + + + + + + SequenceFlow_05ujwz8 + SequenceFlow_1x25m7t + SequenceFlow_1uqlr6b + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1xujrk5 + SequenceFlow_1p4ycii + + + SequenceFlow_1936oc0 + SequenceFlow_05ujwz8 + SDNCInteractionEnabled2 + + + + + + + + SequenceFlow_08nd69s + SequenceFlow_0lu7b1v + + + + SequenceFlow_1qrkdn3 + SequenceFlow_1qoor0l + + + + + + SequenceFlow_1p4ycii + SequenceFlow_0xl033m + SequenceFlow_0t4yszi + + + + SequenceFlow_0lu7b1v + SequenceFlow_1tt31qu + SDNCInteractionEnabled1 + + + + + + + + + + SDNCInteractionEnabled1 + SequenceFlow_0fhhsyo + + + + SequenceFlow_0qdn8k4 + SequenceFlow_1fccvli + + + + + + + + + + + + + SequenceFlow_0fhhsyo + SequenceFlow_0qdn8k4 + + + + + + + + + SDNCInteractionEnabled2 + SequenceFlow_001uxa1 + + + + + + + + + + + + + SequenceFlow_001uxa1 + SequenceFlow_1x29mht + + + SequenceFlow_1x29mht + SequenceFlow_1x25m7t + + + + SequenceFlow_1qoor0l + SequenceFlow_1xujrk5 + SequenceFlow_1laeenc + + + + + + + + + + + + + + SequenceFlow_1laeenc + SequenceFlow_0xl033m + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn new file mode 100644 index 0000000000..fa8a2213b0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn @@ -0,0 +1,187 @@ + + + + + SequenceFlow_1fhno84 + + + SequenceFlow_1fhno84 + SequenceFlow_194bhkx + + + + SequenceFlow_1yee730 + + + SequenceFlow_194bhkx + SequenceFlow_0b5p6gy + + + + + + + ${URN_mso_openecomp_adapters_db_endpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_initResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_0b5p6gy + SequenceFlow_0nqrq1k + + + + + + + + + + + + + + + + + + + + SequenceFlow_0nqrq1k + SequenceFlow_1yee730 + + + + + + + + + SequenceFlow_0yyws1p + + + + SequenceFlow_0i814ke + + + SequenceFlow_0yyws1p + SequenceFlow_0i814ke + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn new file mode 100644 index 0000000000..f8b1ba5bee --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn @@ -0,0 +1,89 @@ + + + + + SequenceFlow_00w1ntj + + + SequenceFlow_00w1ntj + SequenceFlow_0izumqq + + + + SequenceFlow_0izumqq + SequenceFlow_0hzy01n + + + + + + SequenceFlow_18hdal9 + + + + SequenceFlow_0hzy01n + SequenceFlow_18hdal9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUnderlayVpnOperation.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUnderlayVpnOperation.bpmn new file mode 100644 index 0000000000..ad79d471af --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUnderlayVpnOperation.bpmn @@ -0,0 +1,293 @@ + + + + + SequenceFlow_0trm4dk + + + SequenceFlow_1vncx6p + SequenceFlow_1amfirn + SequenceFlow_083crve + + + SequenceFlow_10j9lbs + + + SequenceFlow_083crve + SequenceFlow_0al8gdl + + + + + + + + + SequenceFlow_0h35z1p + SequenceFlow_07bp14s + + + SequenceFlow_0trm4dk + SequenceFlow_199ig0b + + + SequenceFlow_199ig0b + SequenceFlow_1rj6k5t + SequenceFlow_0h35z1p + + + + SequenceFlow_1rj6k5t + SequenceFlow_1vncx6p + + + + + + + + SequenceFlow_1amfirn + SequenceFlow_0bsmh51 + + + + SequenceFlow_0bsmh51 + SequenceFlow_10j9lbs + SequenceFlow_0al8gdl + + + + + + SequenceFlow_07bp14s + SequenceFlow_1oz5grh + SequenceFlow_19glon5 + + + SequenceFlow_1oz5grh + SequenceFlow_06e7qr6 + + + SequenceFlow_06e7qr6 + SequenceFlow_0koi1ia + SequenceFlow_1q83qn9 + + + SequenceFlow_0koi1ia + + + SequenceFlow_19glon5 + SequenceFlow_1q83qn9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn new file mode 100644 index 0000000000..a46d8d4de2 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn @@ -0,0 +1,648 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_04xlw7s + + + + SequenceFlow_115mdln + SequenceFlow_0yztz2p + + + + SequenceFlow_1wwjugw + SequenceFlow_177wo8z + + + + SequenceFlow_115mdln + + + + + + SequenceFlow_1qn0865 + SequenceFlow_1s799cp + + + + SequenceFlow_0w4t4ao + SequenceFlow_1uu6uiu + + + + SequenceFlow_1qn0865 + + + + + SequenceFlow_04xlw7s + SequenceFlow_0r6c0ci + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_initResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_0r6c0ci + SequenceFlow_1muxopq + + + + + SequenceFlow_177wo8z + + + + + + + + + + + + + + + SequenceFlow_1kx5ke9 + SequenceFlow_0f76thv + + + SequenceFlow_0f76thv + SequenceFlow_0x0mhlj + + + + SequenceFlow_1demy08 + + + + + + SequenceFlow_0ku36oy + SequenceFlow_07aa121 + + + + SequenceFlow_0ku36oy + + + + SequenceFlow_07aa121 + + + + + SequenceFlow_1uu6uiu + + + + SequenceFlow_0x0mhlj + + + + + SequenceFlow_1muxopq + + + + + + SequenceFlow_05j3sat + + + + SequenceFlow_02znk15 + + + SequenceFlow_05j3sat + SequenceFlow_19ly8h7 + + + + SequenceFlow_19ly8h7 + SequenceFlow_02znk15 + + + + + + + + SequenceFlow_1demy08 + SequenceFlow_1cy5gq2 + + + + + + + + + + + + + + + + SequenceFlow_1cy5gq2 + SequenceFlow_1vy856f + + + SequenceFlow_1vy856f + SequenceFlow_14ggluy + + + + + + SequenceFlow_14ggluy + SequenceFlow_1kx5ke9 + + + + + + SequenceFlow_0yztz2p + SequenceFlow_0ttlte0 + SequenceFlow_01po987 + + + + + + SequenceFlow_01po987 + + + + + SequenceFlow_070o30v + + + + + + + + + + + + + + + + + SequenceFlow_0ur34hv + SequenceFlow_0w4t4ao + + + + + + + + + + + + + + + + + SequenceFlow_0ttlte0 + SequenceFlow_1wwjugw + + + + SequenceFlow_1s799cp + SequenceFlow_0ur34hv + SequenceFlow_070o30v + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstanceRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstanceRollback.bpmn new file mode 100644 index 0000000000..1589633e59 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstanceRollback.bpmn @@ -0,0 +1,799 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + SequenceFlow_01l4ssl + + + + SequenceFlow_8 + + + + SequenceFlow_7 + + + + SequenceFlow_8 + SequenceFlow_7 + + + + + + + SequenceFlow_1rzlaoy + SequenceFlow_0a83f6m + SequenceFlow_01l4ssl + + + + + + SequenceFlow_1ch4xrf + + + + SequenceFlow_1ch4xrf + SequenceFlow_1pjk2ff + + + + SequenceFlow_1pjk2ff + + + + + + + SequenceFlow_2 + SequenceFlow_1rzlaoy + SequenceFlow_06aasqh + + + + + + rollback Deleted Resources + SequenceFlow_1uw2p9a + SequenceFlow_0drjj7b + SequenceFlow_055b52t + + + SequenceFlow_06aasqh + SequenceFlow_1uw2p9a + SequenceFlow_11fnnkb + + + + + + + + + + + + + + + + + + + + SequenceFlow_1fih4h0 + SequenceFlow_0pwixhh + + + + SequenceFlow_06xv7b2 + SequenceFlow_0b73i9r + + + + SequenceFlow_0pwixhh + SequenceFlow_08p4pkv + + + + SequenceFlow_1g4qm2l + SequenceFlow_1fih4h0 + + + + + + + + + + + + + + + + SequenceFlow_0b73i9r + SequenceFlow_0q9ws1s + + + SequenceFlow_0q9ws1s + SequenceFlow_1bp5oce + + + + rollback AAI + SequenceFlow_055b52t + SequenceFlow_0a83f6m + SequenceFlow_0zijz16 + + + + + + SequenceFlow_06xv7b2 + + + + SequenceFlow_1g4qm2l + + + + SequenceFlow_11fnnkb + + + + SequenceFlow_0drjj7b + + + + + + + + + + SequenceFlow_1a65s3k + + + + SequenceFlow_1ixphei + SequenceFlow_1lppnhy + + + + + + + + + + + + + + + SequenceFlow_1lppnhy + SequenceFlow_0kbisn8 + + + SequenceFlow_0kbisn8 + SequenceFlow_1azhgda + + + + + + + rollback AAI + SequenceFlow_08p4pkv + SequenceFlow_0cbnwwi + SequenceFlow_161uzhj + + + + SequenceFlow_0cbnwwi + + + + + + + SequenceFlow_161uzhj + SequenceFlow_13r4lij + + + + + SequenceFlow_13r4lij + + + + rollback AAI + SequenceFlow_1bp5oce + SequenceFlow_0bkvqao + SequenceFlow_1isdxh1 + + + SequenceFlow_0bkvqao + + + + SequenceFlow_1isdxh1 + SequenceFlow_0a9xori + + + + SequenceFlow_0a9xori + + + + + + + + SequenceFlow_0zijz16 + + + + + + + + SequenceFlow_1azhgda + SequenceFlow_1n6foyw + + + + SequenceFlow_1n6foyw + + + + + + SequenceFlow_1a65s3k + SequenceFlow_0870pzc + + + + + + + + + + + + + + + SequenceFlow_0870pzc + SequenceFlow_1f31l5s + + + + SequenceFlow_1f31l5s + SequenceFlow_1ixphei + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateNetworkInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateNetworkInstance.bpmn new file mode 100644 index 0000000000..306b05cea1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateNetworkInstance.bpmn @@ -0,0 +1,829 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_32 + SequenceFlow_11 + + + + + SequenceFlow_12 + SequenceFlow_5 + + + + SequenceFlow_5 + sdncTopoNo_SequenceFlow + sdncTopoYes_SequenceFlow + + + + + + + + SequenceFlow_34 + + + + + sdncTopoNo_SequenceFlow + SequenceFlow_34 + + + + + + + + + + + + + + SequenceFlow_11 + SequenceFlow_12 + + + + SequenceFlow_46 + SequenceFlow_29 + + + + + + SequenceFlow_053re4q + isRollbackOn_YesNetwork_SequenceFlow + isRollbackOn_NoNetwork_SequenceFlow + + + + + + + SequenceFlow_23 + + + + + isRollbackOn_YesNetwork_SequenceFlow + isPONR_Yes_SequenceFlow + isPONR_No_SequenceFlow + + + + + + + SequenceFlow_0nrc66n + sdncOk_Yeso_ExclusiveGateway + sdncOk_No_ExclusiveGateway + + + + + + + sdncOk_Yeso_ExclusiveGateway + SequenceFlow_53 + + + + + SequenceFlow_04rdjfi + + + SequenceFlow_53 + sdncOk_No_ExclusiveGateway + SequenceFlow_0srdlf3 + SequenceFlow_47 + + + + SequenceFlow_47 + SequenceFlow_0qr4es6 + + + + + + + + + + + + + + + + + + + SequenceFlow_0qr4es6 + + + SequenceFlow_0ze5k6c + SequenceFlow_04rdjfi + + + + + + SequenceFlow_0nrc66n + SequenceFlow_0srdlf3 + + + + + + + SequenceFlow_23 + SequenceFlow_053re4q + + + + + isPONR_Yes_SequenceFlow + isRollbackOn_NoNetwork_SequenceFlow + isPONR_No_SequenceFlow + SequenceFlow_0ze5k6c + + + Note: Rollback is not needed for UpdateNetwork, + + + + + SequenceFlow_13 + SequenceFlow_35 + + + + + SequenceFlow_35 + SequenceFlow_46 + + + + + SequenceFlow_29 + + + + SequenceFlow_10 + SequenceFlow_14 + + + + + SequenceFlow_10 + + + + + SequenceFlow_14 + + + + SequenceFlow_1 + SequenceFlow_7 + + + + + SequenceFlow_24 + SequenceFlow_32 + + + + + siFoundYes + SequenceFlow_24 + + + + + siFoundNo + + + + SequenceFlow_3 + siFoundYes + siFoundNo + + + + + + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_3 + + + + SequenceFlow_59 + SequenceFlow_13 + + + + + + + + ${UPDNETI_updateNetworkRequest} + + + + #{BasicAuthHeaderValuePO} + application/xml + + + PUT + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_61 + SequenceFlow_59 + + + + SequenceFlow_2 + SequenceFlow_61 + + + + + SequenceFlow_38 + SequenceFlow_2 + + + + + sdncTopoYes_SequenceFlow + SequenceFlow_6 + + + + + SequenceFlow_6 + SequenceFlow_15 + + + + + SequenceFlow_15 + SequenceFlow_38 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateNetworkInstanceRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateNetworkInstanceRollback.bpmn new file mode 100644 index 0000000000..9d37d8084e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateNetworkInstanceRollback.bpmn @@ -0,0 +1,374 @@ + + + + + SequenceFlow_1krl2dg + + + SequenceFlow_1krl2dg + SequenceFlow_0u41iz2 + + + + + + + + + ${UPDNETIR_rollbackNetworkRequest} + + + + #{BasicAuthHeaderValuePO} + application/xml + + + PUT + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_0e1uixp + SequenceFlow_17o4w67 + + + SequenceFlow_0u41iz2 + SequenceFlow_0e1uixp + SequenceFlow_1lteduj + + + + + + + + + + + + SequenceFlow_101y57s + SequenceFlow_0790olb + + + SequenceFlow_0virkpu + SequenceFlow_101y57s + SequenceFlow_0mw0dgd + + + SequenceFlow_0qc4v9t + SequenceFlow_0el8yzs + SequenceFlow_0yto4gz + + + + SequenceFlow_1lteduj + SequenceFlow_17o4w67 + SequenceFlow_0virkpu + SequenceFlow_0qc4v9t + + + + + + + + + + + + + + + SequenceFlow_0yto4gz + + + + + + SequenceFlow_0xktw7v + SequenceFlow_0soe5t3 + + + + SequenceFlow_0xktw7v + + + + SequenceFlow_0soe5t3 + + + + + + SequenceFlow_0790olb + SequenceFlow_0mw0dgd + SequenceFlow_0el8yzs + + + + + + SequenceFlow_07kf49j + SequenceFlow_01syg1x + + + + SequenceFlow_07kf49j + + + + SequenceFlow_01syg1x + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn new file mode 100644 index 0000000000..46e7ddcbe6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn @@ -0,0 +1,671 @@ + + + + + + SequenceFlow_38 + SequenceFlow_2 + + + + + + + + + + + + + + SequenceFlow_2 + SequenceFlow_15 + + + SequenceFlow_1 + SequenceFlow_38 + + + + + + SequenceFlow_6 + SequenceFlow_35 + + + + SequenceFlow_35 + + + + + SequenceFlow_6 + + + + + + SequenceFlow_36 + + + + SequenceFlow_36 + + + + + SequenceFlow_9 + SequenceFlow_18 + SequenceFlow_25 + + + + + + + + + + + + SequenceFlow_25 + SequenceFlow_26 + + + + SequenceFlow_26 + SequenceFlow_27 + + + + + + + + + + + + + + SequenceFlow_27 + SequenceFlow_7 + + + SequenceFlow_24 + SequenceFlow_13 + + + + + + + + + + + + SequenceFlow_14 + SequenceFlow_9 + + + + SequenceFlow_13 + SequenceFlow_14 + SequenceFlow_18 + + + + + + + SequenceFlow_1 + + + + SequenceFlow_16 + SequenceFlow_17 + SequenceFlow_12 + + + + + + + + + + + + + + SequenceFlow_12 + SequenceFlow_3 + + + + + + + + + + + SequenceFlow_21 + SequenceFlow_24 + + + + SequenceFlow_23 + SequenceFlow_21 + + + + + SequenceFlow_22 + SequenceFlow_23 + + + + + + + + + + + + + SequenceFlow_19 + SequenceFlow_22 + + + SequenceFlow_3 + SequenceFlow_5 + + + + + + SequenceFlow_5 + SequenceFlow_19 + + + + + + + SequenceFlow_15 + SequenceFlow_28 + SequenceFlow_30 + + + + + + + + + + + + + + SequenceFlow_11 + SequenceFlow_17 + + + + SequenceFlow_10 + SequenceFlow_11 + + + + + SequenceFlow_29 + SequenceFlow_10 + SequenceFlow_16 + + + + + + + + + + SequenceFlow_30 + SequenceFlow_34 + + + + + + SequenceFlow_28 + SequenceFlow_34 + SequenceFlow_29 + + + + + SequenceFlow_7 + SequenceFlow_20 + + + + SequenceFlow_20 + SequenceFlow_4 + + + + + SequenceFlow_4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVnfAndModules.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVnfAndModules.bpmn new file mode 100644 index 0000000000..ae77461070 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVnfAndModules.bpmn @@ -0,0 +1,275 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_08nd69s + + + + + SequenceFlow_19 + + + SequenceFlow_18 + + + + + SequenceFlow_18 + SequenceFlow_19 + + + + + + SequenceFlow_0of4kmm + + + + SequenceFlow_0t4yszi + SequenceFlow_1f4mbkc + SequenceFlow_1qrkdn3 + SequenceFlow_19c7hcw + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_04o61yk + SequenceFlow_1p4ycii + + + + + SequenceFlow_08nd69s + SequenceFlow_1f4mbkc + + + + SequenceFlow_1qrkdn3 + SequenceFlow_04o61yk + + + + SequenceFlow_1p4ycii + SequenceFlow_0t4yszi + + + + + + + + + + + + + + + SequenceFlow_1ltycz6 + SequenceFlow_0of4kmm + + + SequenceFlow_19c7hcw + SequenceFlow_1ltycz6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/RollbackVnf.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/RollbackVnf.bpmn new file mode 100644 index 0000000000..e1300c978f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/RollbackVnf.bpmn @@ -0,0 +1,346 @@ + + + + + SequenceFlow_0bie3cu + + + SequenceFlow_0mpoa26 + SequenceFlow_1pirwg0 + SequenceFlow_1lne8je + SequenceFlow_0tj5bkd + + + SequenceFlow_0tj5bkd + SequenceFlow_1ney8l6 + SequenceFlow_0gsro0z + SequenceFlow_0b2y2dw + + + SequenceFlow_0b2y2dw + SequenceFlow_11556y3 + SequenceFlow_0skjb2u + SequenceFlow_0c5ovtd + + + SequenceFlow_0g18wrd + SequenceFlow_0c5ovtd + SequenceFlow_12bz15k + SequenceFlow_03qkk4e + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0bie3cu + SequenceFlow_1ix4dpf + + + + + + + + + + + + + SequenceFlow_1lne8je + SequenceFlow_1ney8l6 + + + + + + + + + + + SequenceFlow_0gsro0z + SequenceFlow_11556y3 + + + SequenceFlow_0skjb2u + SequenceFlow_0g18wrd + + + + SequenceFlow_12bz15k + SequenceFlow_0tkvd6f + + + + SequenceFlow_1p3pyal + + + + + SequenceFlow_03qkk4e + SequenceFlow_0tkvd6f + SequenceFlow_1p3pyal + + + + + SequenceFlow_1ix4dpf + SequenceFlow_0mpoa26 + SequenceFlow_05ihl7f + + + + + + + + + + + + + + + + + + SequenceFlow_05ihl7f + SequenceFlow_1pirwg0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/SetRefactorServiceDecomp.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/SetRefactorServiceDecomp.bpmn new file mode 100644 index 0000000000..7afac44ff6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/SetRefactorServiceDecomp.bpmn @@ -0,0 +1,68 @@ + + + + + SequenceFlow_1aizx5q + + + + SequenceFlow_1fypndb + + + + SequenceFlow_1aizx5q + SequenceFlow_1ipdcwj + + + + + + SequenceFlow_1ipdcwj + SequenceFlow_1fypndb + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstanceTest.groovy new file mode 100644 index 0000000000..ae40e9d7c6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstanceTest.groovy @@ -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.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner + +import static org.junit.Assert.assertNotNull +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +class CreateCustomE2EServiceInstanceTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090); + + @Before + public void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + public void testPrepareInitServiceOperationStatus (){ + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("mso.adapters.openecomp.db.endpoint")).thenReturn("http://localhost:28090/dbadapters/RequestsDbAdapter") + CreateCustomE2EServiceInstance obj = new CreateCustomE2EServiceInstance(); + obj.prepareInitServiceOperationStatus(mockExecution) + Mockito.verify(mockExecution, times(5)).setVariable(captor.capture(), captor.capture()) + def updateVolumeGroupRequest = captor.getValue() + assertNotNull(updateVolumeGroupRequest); + } + + private ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("CreateCustomE2EServiceInstance") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("CreateCustomE2EServiceInstance") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("CreateCustomE2EServiceInstance") + when(mockExecution.getProcessInstanceId()).thenReturn("CreateCustomE2EServiceInstance") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + return mockExecution + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericAlaCarteServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericAlaCarteServiceInstanceTest.groovy new file mode 100644 index 0000000000..da0990910a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericAlaCarteServiceInstanceTest.groovy @@ -0,0 +1,235 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.mockito.MockitoAnnotations +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.VidUtils + +import static org.junit.Assert.*; +import static org.mockito.Mockito.* + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +class CreateGenericAlaCarteServiceInstanceTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + String Prefix="CRESI_" + def utils = new MsoUtils() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + + String createDBRequestError = +""" + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + BPMN + Received error from SDN-C: No availability zone available + + FAILED + <network-id></network-id><network-name></network-names> + + + """ + + String falloutHandlerRequest = + """ + + b69c9054-da09-4a2c-adf5-51042b62bfac + CREATE + VID + + + Received error from SDN-C: No availability zone available. + 5300 + + """ + + String completeMsoProcessRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + CREATE + VID + + Network has been created successfully. + BPMN Network action: CREATE +""" + + String jsonIncomingRequest = + """{ + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": "1de901ed-17af-4b03-bc1f-41659cfa27cb", + "modelVersionId": "ace39141-09ec-4068-b06d-ac6b23bdc6e0", + "modelName": "demoVLB", + "modelVersion": "1.0" + }, + "cloudConfiguration" : { + "lcpCloudRegionId": "RegionOne", + "tenantId": "onap" + }, + "subscriberInfo": { + "globalSubscriberId": "Demonstration", + "subscriberName": "Demonstration" + }, + "requestInfo": { + "instanceName": "sample-instance-2", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "requestorId":"1234", + "suppressRollback": "false" + }, + "requestParameters": { + "subscriptionServiceType": "vLB" + } + } + }""" + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + + } + + public void initializeVariables(DelegateExecution mockExecution) { + + //verify(mockExecution).setVariable(Prefix + "Success", false) + + //verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", "") + //verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", "") + //verify(mockExecution).setVariable(Prefix + "isSilentSuccess", false) + + } + + @Test + //@Ignore + public void preProcessRequest() { + + println "************ preProcessRequest() ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) + try{ + + // preProcessRequest(DelegateExecution execution) + CreateGenericALaCarteServiceInstance createGenericALaCarteServiceInstance = new CreateGenericALaCarteServiceInstance() + createGenericALaCarteServiceInstance.preProcessRequest(mockExecution) + + //verify(mockExecution).getVariable("isDebugLogEnabled") + //verify(mockExecution).setVariable("prefix", Prefix) + + initializeVariables(mockExecution) + //verify(mockExecution).setVariable(Prefix + "Success", false) + }catch(Exception e){ + //ignore + } + } + + @Test + //@Ignore + public void sendSyncResponse() { + + println "************ sendSyncResponse ************* " + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) + when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + try{ + // preProcessRequest(DelegateExecution execution) + CreateGenericALaCarteServiceInstance createGenericALaCarteServiceInstance = new CreateGenericALaCarteServiceInstance() + createGenericALaCarteServiceInstance.sendSyncResponse(mockExecution) + + //verify(mockExecution).setVariable("prefix", Prefix) + //verify(mockExecution).setVariable("createServiceRestRequest", "202") + }catch(Exception e){ + //ignore + } + } + + @Test + //@Ignore + public void sendSyncError() { + + println "************ sendSyncError ************* " + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) + when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + try{ + CreateGenericALaCarteServiceInstance createGenericALaCarteServiceInstance = new CreateGenericALaCarteServiceInstance() + createGenericALaCarteServiceInstance.sendSyncError(mockExecution) + + //verify(mockExecution).setVariable("prefix", Prefix) + //verify(mockExecution).setVariable("createServiceRestRequest", "500") + }catch(Exception e){ + //ignore + } + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("CreateGenericALaCarteSeviceInstance") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("CreateGenericALaCarteSeviceInstance") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("CreateGenericALaCarteSeviceInstance") + when(mockExecution.getProcessInstanceId()).thenReturn("CreateGenericALaCarteSeviceInstance") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy new file mode 100644 index 0000000000..4d5f506599 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy @@ -0,0 +1,379 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.mockito.MockitoAnnotations +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException + +import static org.junit.Assert.*; +import static org.mockito.Mockito.* + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +class CreateNetworkInstanceTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + String Prefix="CRENI_" + def utils = new MsoUtils() + + String createDBRequestError = +""" + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + BPMN + Received error from SDN-C: No availability zone available + + FAILED + <network-id></network-id><network-name></network-names> + + + """ + + String falloutHandlerRequest = + """ + + b69c9054-da09-4a2c-adf5-51042b62bfac + CREATE + VID + + + Received error from SDN-C: No availability zone available. + 5300 + + """ + + String completeMsoProcessRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + CREATE + VID + + Network has been created successfully. + BPMN Network action: CREATE +""" + + +String jsonIncomingRequest = +"""{ "requestDetails": { + "modelInfo": { + "modelType": "networkTyp", + "modelId": "modelId", + "modelNameVersionId": "modelNameVersionId", + "modelName": "CONTRAIL_EXTERNAL", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "RDM2WAGPLCP", + "tenantId": "7dd5365547234ee8937416c65507d266" + }, + "requestInfo": { + "instanceName": "MNS-25180-L-01-dmz_direct_net_1", + "source": "VID", + "callbackUrl": "", + "suppressRollback": true, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", + "modelInfo": { + "modelType": "serviceT", + "modelId": "modelI", + "modelNameVersionId": "modelNameVersionI", + "modelName": "modleNam", + "modelVersion": "1" + } + } + } + ], + "requestParameters": { + "userParams": [ + { + "name": "someUserParam1", + "value": "someValue1" + } + ] + } + }}""" + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + public void initializeVariables(DelegateExecution mockExecution) { + + verify(mockExecution).setVariable(Prefix + "Success", false) + + verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", "") + verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", "") + verify(mockExecution).setVariable(Prefix + "isSilentSuccess", false) + + } + + @Test + //@Ignore + public void preProcessRequest() { + + println "************ preProcessRequest() ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) + + + // preProcessRequest(DelegateExecution execution) + CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() + CreateNetworkInstance.preProcessRequest(mockExecution) + + //verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + initializeVariables(mockExecution) + //verify(mockExecution).setVariable(Prefix + "Success", false) + + } + + + @Test + //@Ignore + public void getNetworkModelInfo() { + + println "************ getNetworkModelInfo() ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + // preProcessRequest(DelegateExecution execution) + CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() + CreateNetworkInstance.getNetworkModelInfo(mockExecution) + + //verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + } + + @Test + //@Ignore + public void sendSyncResponse() { + + println "************ sendSyncResponse ************* " + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) + when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + + // preProcessRequest(DelegateExecution execution) + CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() + CreateNetworkInstance.sendSyncResponse(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable("CreateNetworkInstanceResponseCode", "202") + + } + + @Test + //@Ignore + public void sendSyncError() { + + println "************ sendSyncError ************* " + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) + when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + + CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() + CreateNetworkInstance.sendSyncError(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable("CreateNetworkInstanceResponseCode", "500") + + } + + @Test + //@Ignore + public void prepareDBRequestError() { + + println "************ prepareDBRequestError ************* " + + WorkflowException sndcWorkflowException = new WorkflowException("CreateNetworkInstance", 500, "Received error from SDN-C: No availability zone available") + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowException) + //when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("networkId")).thenReturn("") + when(mockExecution.getVariable("networkName")).thenReturn("") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + // preProcessRequest(DelegateExecution execution) + CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() + CreateNetworkInstance.prepareDBRequestError(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "createDBRequest", createDBRequestError) + + } + + + @Test + //@Ignore + public void prepareCompletion() { + + println "************ postProcessResponse ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable(Prefix + "dbReturnCode")).thenReturn("200") + + // postProcessResponse(DelegateExecution execution) + CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() + CreateNetworkInstance.prepareCompletion(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "Success", true) + verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", completeMsoProcessRequest) + + } + + @Test + //@Ignore + public void buildErrorResponse() { + + println "************ buildErrorResponse ************* " + + + WorkflowException sndcWorkflowException = new WorkflowException("CreateNetworkInstance", 5300, "Received error from SDN-C: No availability zone available.") + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso-request-id")).thenReturn("b69c9054-da09-4a2c-adf5-51042b62bfac") + //when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowException) + when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowException) + + // buildErrorResponse(DelegateExecution execution) + CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() + CreateNetworkInstance.buildErrorResponse(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", "CRENI_") + verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) + + //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + } + + @Test + //@Ignore + public void postProcessResponse() { + + println "************ postProcessResponse() ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("CMSO_ResponseCode")).thenReturn("200") + + // postProcessResponse(DelegateExecution execution) + CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() + CreateNetworkInstance.postProcessResponse(mockExecution) + + //verify(mockExecution).getVariable("isDebugLogEnabled") + //verify(mockExecution).setVariable("prefix", Prefix) + + verify(mockExecution).setVariable(Prefix + "Success", true) + + } + + @Test + //@Ignore + public void processRollbackData() { + + println "************ callDBCatalog() ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + // preProcessRequest(DelegateExecution execution) + CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance() + CreateNetworkInstance.processRollbackData(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("CreateNetworkInstance") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("CreateNetworkInstance") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("CreateNetworkInstance") + when(mockExecution.getProcessInstanceId()).thenReturn("CreateNetworkInstance") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfraTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfraTest.groovy new file mode 100644 index 0000000000..77220da94f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfraTest.groovy @@ -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.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner + +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.when + +@RunWith(MockitoJUnitRunner.class) +class CreateVfModuleInfraTest { + + def prefix = "CVFMI_" + def requestInfo = "12345" + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + void testPrepareUpdateInfraRequest() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "requestInfo")).thenReturn(requestInfo) + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "vfModuleName")).thenReturn("12345") + when(mockExecution.getVariable("mso.adapters.openecomp.db.endpoint")).thenReturn("http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + CreateVfModuleInfra obj = new CreateVfModuleInfra() + obj.prepareUpdateInfraRequest(mockExecution) + Mockito.verify(mockExecution).setVariable(prefix + "dbAdapterEndpoint", "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + } + + + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("CreateVfModuleInfra") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("CreateVfModuleInfra") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("CreateVfModuleInfra") + when(mockExecution.getProcessInstanceId()).thenReturn("CreateVfModuleInfra") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy new file mode 100644 index 0000000000..2b437d875e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy @@ -0,0 +1,208 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Ignore +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.MsoGroovyTest + +import static org.junit.Assert.assertEquals +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +class CreateVfModuleVolumeInfraV1Test extends MsoGroovyTest { + + def jsonRequest = """ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1", + "modelInstanceName": "vSAMP12" + } + } + } + ], + "requestParameters": { + "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "userParams": [ + {"name": "vnfName", "value": "STMTN5MMSC20" }, + {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, + {"name": "vnfNmInformation", "value": "" }, + {"name": "vnfType", "value": "pcrf-capacity" }, + {"name": "vnfId", "value": "skask" }, + {"name": "vnfStackId", "value": "slowburn" }, + {"name": "vnfStatus", "value": "created" }, + {"name": "aicCloudRegion", "value": "MDTWNJ21" }, + {"name": "availabilityZone", "value": "slcp3-esx-az01" }, + {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, + {"name": "vmName", "value": "slcp34246vbc246ceb" }, + {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, + {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" } + ] + } + } +} +""" + + def volumeRequestXml = """ + + CREATE_VF_MODULE_VOL + VID + + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + true + + + + STMTN5MMSC20 + US1117MTSNJVBR0246 + + pcrf-capacity + skask + slowburn + created + MDTWNJ21 + slcp3-esx-az01 + VLAN-OAM-1323 + slcp34246vbc246ceb + 970cd2b9-7f09-4a12-af47-182ea38ba1f0 + 545cc2c3-1930-4100-b534-5d82d0e12bb6 + +""" + + def completeMsoRequestXml = """ + + 1234 + CREATE + VID + + Volume Group has been created successfully. + BPMN VF Module Volume action: CREATE +""" + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + + @Test + @Ignore + public void testPreProcessRequest() { + + ExecutionEntity mockExecution = setupMock('CreateVfModuleVolumeInfraV1') + + when(mockExecution.getVariable("prefix")).thenReturn('CVMVINFRAV1_') + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonRequest) + when(mockExecution.getVariable("serviceInstanceId")).thenReturn('') + when(mockExecution.getVariable("vnfId")).thenReturn('test-vnf-id') + when(mockExecution.getVariable("mso-request-id")).thenReturn('1234') + when(mockExecution.getVariable("mso.rollback")).thenReturn('true') + + CreateVfModuleVolumeInfraV1 createVfModuleVolumeInfraV1 = new CreateVfModuleVolumeInfraV1() + createVfModuleVolumeInfraV1.preProcessRequest(mockExecution, 'true') + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(15)).setVariable(captor1.capture(), captor2.capture()) + + List arg2List = captor2.getAllValues() + String volumeRequestActual = arg2List.get(6) + String isVidRequestActual = arg2List.get(8) + + assertEquals(volumeRequestXml, volumeRequestActual.trim()) + assertEquals('true', isVidRequestActual) + } + + @Test + public void testPostProcessResponse() { + + ExecutionEntity mockExecution = setupMock('CreateVfModuleVolumeInfraV1') + when(mockExecution.getVariable("dbReturnCode")).thenReturn('000') + when(mockExecution.getVariable("CVMVINFRAV1_createDBResponse")).thenReturn('') + when(mockExecution.getVariable("mso-request-id")).thenReturn('1234') + when(mockExecution.getVariable("CVMVINFRAV1_source")).thenReturn('VID') + + CreateVfModuleVolumeInfraV1 createVfModuleVolumeInfraV1 = new CreateVfModuleVolumeInfraV1() + createVfModuleVolumeInfraV1.postProcessResponse(mockExecution, 'true') + + verify(mockExecution).setVariable('CVMVINFRAV1_Success', true) + verify(mockExecution).setVariable('CVMVINFRAV1_CompleteMsoProcessRequest', completeMsoRequestXml) + } + + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstanceTest.groovy new file mode 100644 index 0000000000..95259e9ec0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstanceTest.groovy @@ -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========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Rule +import org.junit.Test +import org.mockito.MockitoAnnotations +import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.bpmn.vcpe.scripts.GroovyTestBase + +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.when + +class DeleteCustomE2EServiceInstanceTest extends GroovyTestBase { + + private static String request + + @Rule + public WireMockRule wireMockRule = new WireMockRule(GroovyTestBase.PORT) + + String Prefix = "CVRCS_" + String RbType = "DCRENI_" + + @BeforeClass + public static void setUpBeforeClass() { + request = FileUtil.readResourceFile("__files/InfrastructureFlows/DeleteCustomE2EService.json") + } + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + public DeleteCustomE2EServiceInstanceTest(){ + super("DeleteCustomE2EServiceInstance") + } + @Test + public void preProcessRequestTest () { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() + mex.setVariable("isDebugLogEnabled","true") + instance.preProcessRequest(mex); + + verify(mex).getVariable(GroovyTestBase.DBGFLAG) + + Map userParams = new HashMap<>() + userParams.put("someUserParam","someValue") + + verify(mex).setVariable("prefix", "DELSI_") + verify(mex).setVariable("msoRequestId", "mri") + verify(mex).setVariable("source", "CCD") + verify(mex).setVariable("operationType", "DELETE") + verify(mex).setVariable("globalSubscriberId", "38829939920000") + verify(mex).setVariable("serviceInputParams",userParams) + } + + @Test + public void sendSyncResponseTest() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() + instance.sendSyncResponse(mex) + verify(mex).setVariable("DeleteCustomE2EServiceInstanceWorkflowResponseSent", "true") + } + + @Test + public void prepareCompletionRequestTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() + instance.prepareCompletionRequest(mex) + String msoComplitionRequest = FileUtil.readResourceFile("__files/GenericFlows/MsoCompletionRequest.xml") + //verify(mex).setVariable("completionRequest", msoComplitionRequest) + } + + @Test + public void sendSyncErrorTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() + instance.sendSyncError(mex) + + } + + @Test + public void prepareFalloutRequest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() + instance.prepareFalloutRequest(mex) + String requestInfo = + """ + null + DELETE + null + """ + //verify(mex).setVariable("falloutRequest", requestInfo) + } + + @Test + public void processJavaExceptionTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() + instance.processJavaException() + } + + + private void initPreProcess(ExecutionEntity mex) { + when(mex.getVariable(GroovyTestBase.DBGFLAG)).thenReturn("true") + when(mex.getVariable("bpmnRequest")).thenReturn(request) + when(mex.getVariable("mso-request-id")).thenReturn("mri") + when(mex.getVariable("serviceType")).thenReturn("VoLTE") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("requestAction")).thenReturn("ra") + when(mex.getVariable("operationId")).thenReturn("59960003992") + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericAlaCarteServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericAlaCarteServiceInstanceTest.groovy new file mode 100644 index 0000000000..b459710479 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericAlaCarteServiceInstanceTest.groovy @@ -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.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.mockito.MockitoAnnotations +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.VidUtils + +import static org.junit.Assert.*; +import static org.mockito.Mockito.* + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +class DeleteGenericAlaCarteServiceInstanceTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + String Prefix="DELSI_" + def utils = new MsoUtils() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + + String jsonIncomingRequest = + """{ + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": "1de901ed-17af-4b03-bc1f-41659cfa27cb", + "modelVersionId": "ace39141-09ec-4068-b06d-ac6b23bdc6e0", + "modelName": "demoVLB", + "modelVersion": "1.0" + }, + "cloudConfiguration" : { + "lcpCloudRegionId": "RegionOne", + "tenantId": "onap" + }, + "subscriberInfo": { + "globalSubscriberId": "Demonstration", + "subscriberName": "Demonstration" + }, + "requestInfo": { + "instanceName": "sample-instance-2", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "requestorId":"1234", + "suppressRollback": "false" + }, + "requestParameters": { + "subscriptionServiceType": "vLB" + } + } + }""" + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + + } + + public void initializeVariables(DelegateExecution mockExecution) { + + verify(mockExecution).setVariable(Prefix + "Success", false) + + verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", "") + verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", "") + verify(mockExecution).setVariable(Prefix + "isSilentSuccess", false) + + } + + @Test + //@Ignore + public void preProcessRequest() { + + println "************ preProcessRequest() ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) + + try { + // preProcessRequest(DelegateExecution execution) + DeleteGenericALaCarteServiceInstance deleteGenericALaCarteServiceInstance = new DeleteGenericALaCarteServiceInstance() + deleteGenericALaCarteServiceInstance.preProcessRequest(mockExecution) + + verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + initializeVariables(mockExecution) + //verify(mockExecution).setVariable(Prefix + "Success", false) + }catch(Exception e){ + //ignore + } + + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstanceTest.groovy new file mode 100644 index 0000000000..9b7d7ee21f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstanceTest.groovy @@ -0,0 +1,418 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + + +import static org.mockito.Mockito.* + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException + +import com.github.tomakehurst.wiremock.junit.WireMockRule + + +@RunWith(MockitoJUnitRunner.class) +class DeleteNetworkInstanceTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + String Prefix="DELNI_" + def utils = new MsoUtils() + + String falloutHandlerRequest = + """ + + b69c9054-da09-4a2c-adf5-51042b62bfac + DELETE + PORTAL + + + Received error from SDN-C: No availability zone available + 5300 + 200 + + """ + + String falloutHandlerRequestObj = + """ + + b69c9054-da09-4a2c-adf5-51042b62bfac + DELETE + PORTAL + + + Received error from SDN-C: No availability zone available + 7000 + + """ + + String completeMsoProcessRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + DELETE + VID + + Network has been deleted successfully. + BPMN Network action: DELETE +""" + +String deleteDBRequest = +""" + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + BPMN + Network successfully deleted. + + COMPLETED + 100 + <network-outputs xmlns="http://org.onap/so/infra/vnf-request/v1" xmlns:aetgt="http://org.onap/so/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"/> + + +""" + +String deleteDBRequestErrorObj = +""" + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + BPMN + Received error from SDN-C: No availability zone available + + FAILED + + <network-outputs xmlns="http://org.onap/so/infra/vnf-request/v1" xmlns:aetgt="http://org.onap/so/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"/> + + + """ + +String deleteDBRequestErrorString = +""" + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + BPMN + Received error from SDN-C: No availability zone available + + FAILED + + <network-outputs xmlns="http://org.onap/so/infra/vnf-request/v1" xmlns:aetgt="http://org.onap/so/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"/> + + + """ + + String jsonIncomingRequest = + """{ "requestDetails": { + "modelInfo": { + "modelType": "networkTyp", + "modelId": "modelId", + "modelNameVersionId": "modelNameVersionId", + "modelName": "CONTRAIL_EXTERNAL", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "RDM2WAGPLCP", + "tenantId": "7dd5365547234ee8937416c65507d266" + }, + "requestInfo": { + "instanceName": "MNS-25180-L-01-dmz_direct_net_1", + "source": "VID", + "callbackUrl": "", + "suppressRollback": true, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", + "modelInfo": { + "modelType": "serviceT", + "modelId": "modelI", + "modelNameVersionId": "modelNameVersionI", + "modelName": "modleNam", + "modelVersion": "1" + } + } + } + ], + "requestParameters": { + "userParams": [ + { + "name": "someUserParam1", + "value": "someValue1" + } + ] + } + }}""" + +// - - - - - - - - + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + //@Ignore + public void preProcessRequest() { + + println "************ preProcessRequest_Payload ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) + + DeleteNetworkInstance DeleteNetworkInstance = new DeleteNetworkInstance() + DeleteNetworkInstance.preProcessRequest(mockExecution) + + verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + //verify variable initialization + initializeVariables(mockExecution) + + + } + + public void initializeVariables (DelegateExecution mockExecution) { + + + verify(mockExecution).setVariable(Prefix + "Success", false) + + verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", "") + verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", "") + verify(mockExecution).setVariable(Prefix + "isSilentSuccess", false) + + } + + + @Test + //@Ignore + public void getNetworkModelInfo() { + + println "************ getNetworkModelInfo() ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + // preProcessRequest(DelegateExecution execution) + DeleteNetworkInstance DeleteNetworkInstance = new DeleteNetworkInstance() + DeleteNetworkInstance.getNetworkModelInfo(mockExecution) + + verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + } + + @Test + //@Ignore + public void sendSyncResponse() { + + println "************ sendSyncResponse ************* " + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) + when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + + // preProcessRequest(DelegateExecution execution) + DeleteNetworkInstance DeleteNetworkInstance = new DeleteNetworkInstance() + DeleteNetworkInstance.sendSyncResponse(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable("DeleteNetworkInstanceResponseCode", "202") + + } + + + @Test + //@Ignore + public void sendSyncError() { + + println "************ sendSyncError ************* " + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) + when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + + DeleteNetworkInstance DeleteNetworkInstance = new DeleteNetworkInstance() + DeleteNetworkInstance.sendSyncError(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable("DeleteNetworkInstanceResponseCode", "500") + + } + + + @Test + //@Ignore + public void prepareCompletion() { + + println "************ postProcessResponse ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "source")).thenReturn("PORTAL") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + + // postProcessResponse(DelegateExecution execution) + DeleteNetworkInstance DeleteNetworkInstance = new DeleteNetworkInstance() + DeleteNetworkInstance.prepareCompletion(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", completeMsoProcessRequest) + + } + + + @Test + //@Ignore + public void prepareDBRequestError() { + + println "************ prepareDBRequestError ************* " + + WorkflowException sndcWorkflowExceptionObj = new WorkflowException("CreateNetworkV2", 500, "Received error from SDN-C: No availability zone available") + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowExceptionObj) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + // preProcessRequest(DelegateExecution execution) + DeleteNetworkInstance DeleteNetworkInstance = new DeleteNetworkInstance() + DeleteNetworkInstance.prepareDBRequestError(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "deleteDBRequest", deleteDBRequestErrorObj) + + } + + + @Test + //@Ignore + public void postProcessResponse() { + + println "************ postProcessResponse ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("CMSO_ResponseCode")).thenReturn("200") + + // postProcessResponse(DelegateExecution execution) + DeleteNetworkInstance DeleteNetworkInstance = new DeleteNetworkInstance() + DeleteNetworkInstance.postProcessResponse(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "Success", true) + + + } + + + @Test + //@Ignore + public void buildErrorResponse_FalloutHandlerRequest() { + + println "************ buildErrorResponse ************* " + + WorkflowException sndcWorkflowExceptionObj = new WorkflowException("DeleteNetworkInstance", 7000, "Received error from SDN-C: No availability zone available") + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso-request-id")).thenReturn("b69c9054-da09-4a2c-adf5-51042b62bfac") + when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowExceptionObj) + when(mockExecution.getVariable(Prefix + "source")).thenReturn("PORTAL") + + // buildErrorResponse(DelegateExecution execution) + DeleteNetworkInstance DeleteNetworkInstance = new DeleteNetworkInstance() + DeleteNetworkInstance.buildErrorResponse(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "Success", false) + verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequestObj) + + } + + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DeleteNetworkInstance") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DeleteNetworkInstance") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DeleteNetworkInstance") + when(mockExecution.getProcessInstanceId()).thenReturn("DeleteNetworkInstance") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy new file mode 100644 index 0000000000..0bce32716f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy @@ -0,0 +1,167 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.core.WorkflowException + +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.when + +@RunWith(MockitoJUnitRunner.class) +class DeleteVfModuleVolumeInfraV1Test extends MsoGroovyTest { + + def deleteVnfAdapterRequestXml = """ + RDM2WAGPLCP + fba1bd1e195a404cacb9ce17a9b2b421 + 78987 + + true + + TEST-REQUEST-ID-0123 + 1234 + + ebb9ef7b-a6a5-40e6-953e-f868f1767677 + http://localhost:28080/mso/WorkflowMessage/VNFAResponse/ebb9ef7b-a6a5-40e6-953e-f868f1767677 +""" + + def dbRequestXml = """ + + + + TEST-REQUEST-ID-0123 + BPMN + VolumeGroup successfully deleted + COMPLETE + 100 + + + +""" + + def completionRequestXml = """ + + TEST-REQUEST-ID-0123 + DELETE + VID + + Volume Group has been deleted successfully. + BPMN VF Module Volume action: DELETE +""" + + def falloutHandlerRequestXml = """ + + TEST-REQUEST-ID-0123 + DELETE + VID + + + Unexpected Error + 5000 + +""" + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + + @Test + public void testPrepareVnfAdapterDeleteRequest() { + + ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') + when(mockExecution.getVariable("DELVfModVol_cloudRegion")).thenReturn('RDM2WAGPLCP') + when(mockExecution.getVariable("DELVfModVol_tenantId")).thenReturn('fba1bd1e195a404cacb9ce17a9b2b421') + when(mockExecution.getVariable("DELVfModVol_volumeGroupId")).thenReturn('78987') + when(mockExecution.getVariable("DELVfModVol_volumeGroupHeatStackId")).thenReturn('') + when(mockExecution.getVariable("DELVfModVol_requestId")).thenReturn('TEST-REQUEST-ID-0123') + when(mockExecution.getVariable("DELVfModVol_serviceId")).thenReturn('1234') + when(mockExecution.getVariable("DELVfModVol_messageId")).thenReturn('ebb9ef7b-a6a5-40e6-953e-f868f1767677') + when(mockExecution.getVariable("mso.workflow.message.endpoint")).thenReturn('http://localhost:28080/mso/WorkflowMessage') + when(mockExecution.getVariable("mso.use.qualified.host")).thenReturn('') + + DeleteVfModuleVolumeInfraV1 myproc = new DeleteVfModuleVolumeInfraV1() + myproc.prepareVnfAdapterDeleteRequest(mockExecution, 'true') + + verify(mockExecution).setVariable("DELVfModVol_deleteVnfARequest", deleteVnfAdapterRequestXml) + + } + + @Test + //@Ignore + public void testPrepareDbRequest() { + + ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') + when(mockExecution.getVariable("DELVfModVol_requestId")).thenReturn('TEST-REQUEST-ID-0123') + when(mockExecution.getVariable("DELVfModVol_volumeOutputs")).thenReturn('') + when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + DeleteVfModuleVolumeInfraV1 myproc = new DeleteVfModuleVolumeInfraV1() + myproc.prepareDBRequest(mockExecution, 'true') + + verify(mockExecution).setVariable("DELVfModVol_updateInfraRequest", dbRequestXml) + } + + @Test + public void testPrepareCompletionHandlerRequest() { + + ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') + when(mockExecution.getVariable("mso-request-id")).thenReturn('TEST-REQUEST-ID-0123') + when(mockExecution.getVariable("DELVfModVol_source")).thenReturn('VID') + + DeleteVfModuleVolumeInfraV1 myproc = new DeleteVfModuleVolumeInfraV1() + myproc.prepareCompletionHandlerRequest(mockExecution, 'true') + + verify(mockExecution).setVariable("DELVfModVol_CompleteMsoProcessRequest", completionRequestXml) + } + + @Test + public void testPrepareFalloutHandler() { + + WorkflowException workflowException = new WorkflowException('DeleteVfModuleVolumeInfraV1', 5000, 'Unexpected Error') + + ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') + + when(mockExecution.getVariable("DELVfModVol_requestId")).thenReturn('TEST-REQUEST-ID-0123') + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + when(mockExecution.getVariable("DELVfModVol_source")).thenReturn('VID') + + DeleteVfModuleVolumeInfraV1 myproc = new DeleteVfModuleVolumeInfraV1() + myproc.prepareFalloutHandler(mockExecution, 'true') + + verify(mockExecution).setVariable("DELVfModVol_Success", false) + verify(mockExecution).setVariable("DELVfModVol_FalloutHandlerRequest", falloutHandlerRequestXml) + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceTest.groovy new file mode 100644 index 0000000000..72f79c80d9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceTest.groovy @@ -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.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.utils.XmlComparator + +import static org.mockito.Mockito.* +/** + * @author sushilma + * @since January 10, 2018 + */ +@RunWith(MockitoJUnitRunner.class) +class DoCreateE2EServiceInstanceTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090); + + @Before + public void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + String expectedServiceInstanceData = """ + 1234 + volte-service + voLTE type + voLTE role + Created + c1d4305f-cdbd-4bbe-9069-a2f4978fd89e + d4df5c27-98a1-4812-a8aa-c17f055b7a3f + """ + @Test + public void testPreProcessRequest(){ + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("12345") + when(mockExecution.getVariable("serviceType")).thenReturn("TRANSPORT") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("1234") + when(mockExecution.getVariable("serviceInstanceName")).thenReturn("volte-service") + when(mockExecution.getVariable("uuiRequest")).thenReturn("""{"service":{"serviceDefId":"c1d4305f-cdbd-4bbe-9069-a2f4978fd89e" , "templateId" : "d4df5c27-98a1-4812-a8aa-c17f055b7a3f"}}""") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("/mso/sdncadapter/") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.default.aai.customer.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.customer.uri")).thenReturn('/aai/v8/business/customers/customer') + DoCreateE2EServiceInstance obj = new DoCreateE2EServiceInstance() + obj.preProcessRequest(mockExecution) + Mockito.verify(mockExecution, times(7)).setVariable(captor.capture(), captor.capture()) + XmlComparator.assertXMLEquals(expectedServiceInstanceData, captor.getValue()) + } + + private ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoCreateE2EServiceInstance") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateE2EServiceInstance") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateE2EServiceInstance") + when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateE2EServiceInstance") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + return mockExecution + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy new file mode 100644 index 0000000000..5ee10bc931 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy @@ -0,0 +1,369 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.junit.Before +import org.junit.Rule; +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith + +import static org.onap.so.bpmn.mock.StubResponseNetworkAdapter.MockNetworkAdapterRestRollbackDelete; +import static org.junit.Assert.*; + +import com.github.tomakehurst.wiremock.client.WireMock; +import com.github.tomakehurst.wiremock.junit.WireMockRule; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.apache.commons.lang3.* + + +@RunWith(MockitoJUnitRunner.class) +class DoCreateNetworkInstanceRollbackTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090); + + def utils = new MsoUtils() + String Prefix="CRENWKIR_" + + + String rollbackNetworkRequest = + """ + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + CONTRAIL_EXTERNAL + true + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + +""" + + String rollbackActivateSDNCRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + rollback + network-topology-operation + sdncCallback + generic-resource + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + CreateNetworkInstance + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + MSO_1610_dev + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + + invariant-uuid + customization-uuid + uuid + version + CONTRAIL_EXTERNAL + + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + + String rollbackSDNCRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + rollback + network-topology-operation + sdncCallback + generic-resource + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + CreateNetworkInstance + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + MSO_1610_dev + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + + invariant-uuid + customization-uuid + uuid + version + CONTRAIL_EXTERNAL + + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + +// - - - - - - - - + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + + } + + public void initializeVariables (DelegateExecution mockExecution) { + + verify(mockExecution).setVariable(Prefix + "WorkflowException", null) + + verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", null) + verify(mockExecution).setVariable(Prefix + "rollbackNetworkResponse", "") + verify(mockExecution).setVariable(Prefix + "rollbackNetworkReturnCode", "") + + verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", null) + verify(mockExecution).setVariable(Prefix + "rollbackSDNCResponse", "") + verify(mockExecution).setVariable(Prefix + "rollbackSDNCReturnCode", "") + + verify(mockExecution).setVariable(Prefix + "rollbackActivateSDNCRequest", null) + verify(mockExecution).setVariable(Prefix + "rollbackActivateSDNCResponse", "") + verify(mockExecution).setVariable(Prefix + "rollbackActivateSDNCReturnCode", "") + + verify(mockExecution).setVariable(Prefix + "Success", false) + verify(mockExecution).setVariable(Prefix + "fullRollback", false) + verify(mockExecution).setVariable(Prefix + "networkId", "") + verify(mockExecution).setVariable(Prefix + "urlRollbackPoNetwork", "") + + } + + @Test + //@Ignore + public void preProcessRequest() { + + println "************ preProcessRequest ************* " + + WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") + Map rollbackData = new HashMap(); + rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) + rollbackData.put("rollbackActivateSDNCRequest", rollbackActivateSDNCRequest) + rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + when(mockExecution.getVariable("rollbackData")).thenReturn(rollbackData) + when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") + + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.sdnc.endpoint")).thenReturn("http://localhost:28090/SDNCAdapter") + when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")).thenReturn("http://localhost:28090/networks/NetworkAdapter") + when(mockExecution.getVariable("mso.adapters.sdnc.resource.endpoint")).thenReturn("http://localhost:28090/SDNCAdapterRpc") + + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstanceRollback DoCreateNetworkInstanceRollback = new DoCreateNetworkInstanceRollback() + DoCreateNetworkInstanceRollback.preProcessRequest(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + //verify variable initialization + initializeVariables(mockExecution) + + } + + @Test + //@Ignore + public void callPONetworkAdapter() { + + MockNetworkAdapterRestRollbackDelete("deleteNetworkResponse_Success.xml","8abc633a-810b-4ca5-8b3a-09511d13a2ce"); + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn( rollbackNetworkRequest) + when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn(rollbackSDNCRequest) + when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")).thenReturn("http://localhost:28090/networks/NetworkAdapter") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstanceRollback DoCreateNetworkInstanceRollback = new DoCreateNetworkInstanceRollback() + DoCreateNetworkInstanceRollback.callPONetworkAdapter(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable(Prefix + "urlRollbackPoNetwork", "http://localhost:28090/networks/NetworkAdapter/8abc633a-810b-4ca5-8b3a-09511d13a2ce/rollback") + + } + + @Test + //@Ignore + public void validateRollbackResponses_Good() { + + WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstanceRollback", 2500, "AAI Update Contrail Failed. Error 404.") + WorkflowException expectedWorkflowException = new WorkflowException("DoCreateNetworkInstanceRollback", 2500, "AAI Update Contrail Failed. Error 404. + SNDC activate rollback completed. + PO Network rollback completed. + SNDC assign rollback completed.") + + println "************ validateRollbackResponses_Good() ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn("Good") + when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn("Good") + when(mockExecution.getVariable(Prefix + "rollbackActivateSDNCRequest")).thenReturn("Good") + when(mockExecution.getVariable(Prefix + "rollbackNetworkReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "rollbackNetworkResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable(Prefix + "rollbackSDNCReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "rollbackSDNCResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable(Prefix + "rollbackActivateSDNCReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "rollbackActivateSDNCResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable(Prefix + "WorkflowException")).thenReturn(workflowException) + when(mockExecution.getVariable(Prefix + "fullRollback")).thenReturn(false) + + DoCreateNetworkInstanceRollback DoCreateNetworkInstanceRollback = new DoCreateNetworkInstanceRollback() + DoCreateNetworkInstanceRollback.validateRollbackResponses(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution, atLeast(1)).setVariable("rolledBack", true) + verify(mockExecution, atLeast(1)).setVariable("wasDeleted", true) + verify(mockExecution).setVariable("WorkflowException", refEq(expectedWorkflowException, any(WorkflowException.class))) + //verify(mockExecution).setVariable("WorkflowException", expectedWorkflowException) + } + + @Test + //@Ignore + public void validateRollbackResponses_FullRollback() { + + Map rollbackData = new HashMap(); + rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) + rollbackData.put("rollbackActivateSDNCRequest", rollbackActivateSDNCRequest) + rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) + + println "************ validateRollbackResponses_FullRollback() ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn("Good") + when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn("Good") + when(mockExecution.getVariable(Prefix + "rollbackActivateSDNCRequest")).thenReturn("Good") + when(mockExecution.getVariable(Prefix + "rollbackNetworkReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "rollbackNetworkResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable(Prefix + "rollbackSDNCReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "rollbackSDNCResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable(Prefix + "rollbackActivateSDNCReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "rollbackActivateSDNCResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable(Prefix + "workflowException")).thenReturn(null) + when(mockExecution.getVariable(Prefix + "fullRollback")).thenReturn(true) + when(mockExecution.getVariable("rollbackData")).thenReturn(rollbackData) + + DoCreateNetworkInstanceRollback DoCreateNetworkInstanceRollback = new DoCreateNetworkInstanceRollback() + DoCreateNetworkInstanceRollback.validateRollbackResponses(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution, atLeast(1)).setVariable("rollbackSuccessful", true) + verify(mockExecution, atLeast(1)).setVariable("rollbackError", false) + + } + + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoCreateNetworkInstanceRollback") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateNetworkInstanceRollback") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateNetworkInstanceRollback") + when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateNetworkInstanceRollback") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy new file mode 100644 index 0000000000..0a1f8f2859 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy @@ -0,0 +1,4324 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + + +import static org.mockito.Mockito.* +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkByName; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkByName_404; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkByIdWithDepth; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion_404; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutNetworkIdWithDepth; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkPolicy; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkTableReference; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkVpnBinding; +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException + +import com.github.tomakehurst.wiremock.client.WireMock +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.apache.commons.lang3.* + +@RunWith(MockitoJUnitRunner.class) +class DoCreateNetworkInstanceTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + def utils = new MsoUtils() + String Prefix="CRENWKI_" + +// ---- Start XML Zone ---- + String xmlIncomingRequest = + """ + + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + CREATE + PORTAL + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + dvs-slcp3-01 + 3008 + MNS-25180-L-01-dmz_direct_net_1 + true + + + 1 + 0 + + + """ + + String expectedXMLNetworkRequest = +""" + + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + CREATE + PORTAL + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + dvs-slcp3-01 + 3008 + MNS-25180-L-01-dmz_direct_net_1 + true + + + 1 + 0 + + +""" + + String expectedXMLNetworkInputs = +""" + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + dvs-slcp3-01 + 3008 + MNS-25180-L-01-dmz_direct_net_1 + true +""" + + String networkXMLOutputs = +"""""" + +// ---- End XML Zone ---- + +// ---- Start JSON Zone ---- + // JSON format Input + String jsonIncomingRequest = + """{ "requestDetails": { + "modelInfo": { + "modelType": "network", + "modelCustomizationId": "f21df226-8093-48c3-be7e-0408fcda0422", + "modelName": "CONTRAIL_EXTERNAL", + "modelVersion": "1.0" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "RDM2WAGPLCP", + "tenantId": "7dd5365547234ee8937416c65507d266" + }, + "requestInfo": { + "instanceName": "MNS-25180-L-01-dmz_direct_net_1", + "source": "VID", + "callbackUrl": "", + "suppressRollback": true, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", + "modelInfo": { + "modelType": "serviceT", + "modelId": "modelI", + "modelNameVersionId": "modelNameVersionI", + "modelName": "modleNam", + "modelVersion": "1" + } + } + } + ], + "requestParameters": { + "userParams": [ + { + "name": "someUserParam1", + "value": "someValue1" + } + ] + } + }}""" + + String expectedJSONNetworkRequest = + """ + + null + CREATE + VID + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + + networkId + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + f21df226-8093-48c3-be7e-0408fcda0422 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + 1610 + + + someValue1 + +""" + + String expectedJSONNetworkInputs = +""" + networkId + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + f21df226-8093-48c3-be7e-0408fcda0422 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + 1610 +""" + + String networkJSONOutputs = +""" + networkId + MNS-25180-L-01-dmz_direct_net_1 + """ + +// ---- End JSON Zone ---- + +// ---- Start vPIR Zone ---- + // expectedNetworkRequest + String expectedvIPRNetworkRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + CREATE + VID + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + + networkId + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + MSO-dev-service-type + globalId_45678905678 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + false + + CONTRAIL_EXTERNAL + sn5256d1-5a33-55df-13ab-12abad84e111 + sn5256d1-5a33-55df-13ab-12abad84e764 + 1 + sn5256d1-5a33-55df-13ab-12abad84e222 + + + HNGW Protected OAM + 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 + fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 + 1.0 + + + 1702 + + +""" + + String expectedvIPRNetworkInputs = +""" + networkId + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + MSO-dev-service-type + globalId_45678905678 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + false + + CONTRAIL_EXTERNAL + sn5256d1-5a33-55df-13ab-12abad84e111 + sn5256d1-5a33-55df-13ab-12abad84e764 + 1 + sn5256d1-5a33-55df-13ab-12abad84e222 + + + HNGW Protected OAM + 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 + fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 + 1.0 + + + 1702 +""" + + String networkvIPROutputs = +""" + networkId + MNS-25180-L-01-dmz_direct_net_1 + """ + +// ---- End vPIR Zone ---- + + String vnfRequestFakeRegion = + """ + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + CREATE + PORTAL + + + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + MSO-dev-service-type + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MDTWNJ21 + 7dd5365547234ee8937416c65507d266 + + + 1 + 0 + +""" + + // expectedNetworkRequest + String expectedNetworkRequest_Outputs = + """ + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + CREATE + PORTAL + + + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + MSO-dev-service-type + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + + + MNS-25180-L-01-dmz_direct_net_1 + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + + + 1 + 0 + +""" + + + // expectedNetworkRequest + String networkInputs_404 = + """ + myOwn_Network + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + e81d842d3e8b45c5a59f57cd76af3aaf + """ + + String networkInputs = + """ + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + e81d842d3e8b45c5a59f57cd76af3aaf +""" + + + + String queryAAIResponse = + """ + + + + + + + + + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + + +""" + + String queryIdAIIResponse = + """ + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + Contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + l3-version + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + ECOMP + true + + + string + 192.10.16.0/24 + 192.10.16.100/24 + ip-address + 1505857301954 + + + string + 192.110.17.0/24 + 192.110.17.110/24 + ip-address + 1505857301954 + + + + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + true + + + string + 192.10.16.0/24 + 192.10.16.100/24 + ip-address + 1505857301954 + + + + + + + 414 + 4132176 + + + 415 + 4132176 + + + + inner + ctag-version + + + tenant + https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ + + vpn-binding.vpn-id + a290b841-f672-44dd-b9cd-6f8c20d7d8c8 + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest2 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ + + vpn-binding.vpn-id + 24a4b507-853a-4a38-99aa-05fcc54be24d + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest1 + + + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + + +""" + +String queryIdAIIResponse_AlaCarte = +""" + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + Contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + l3-version + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + + 414 + 4132176 + + + 415 + 4132176 + + + + inner + ctag-version + + + tenant + https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ + + vpn-binding.vpn-id + a290b841-f672-44dd-b9cd-6f8c20d7d8c8 + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest2 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ + + vpn-binding.vpn-id + 24a4b507-853a-4a38-99aa-05fcc54be24d + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest1 + + + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + + +""" + +String queryIdAIIResponse_segmentation = +""" + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + Contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + l3-version + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + + + 1 + 1498507569188 + + + + + inner + ctag-version + + + tenant + https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ + + vpn-binding.vpn-id + a290b841-f672-44dd-b9cd-6f8c20d7d8c8 + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest2 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ + + vpn-binding.vpn-id + 24a4b507-853a-4a38-99aa-05fcc54be24d + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest1 + + + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + + +""" + +String queryIdAIIResponse_Ipv4 = +""" + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + Contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + l3-version + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + ipv4 + pending-create + true + subnetName + + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + ipv4 + pending-create + true + subnetName + + + + + 414 + 4132176 + + + 415 + 4132176 + + + + inner + ctag-version + + + tenant + https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ + + vpn-binding.vpn-id + a290b841-f672-44dd-b9cd-6f8c20d7d8c8 + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest2 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ + + vpn-binding.vpn-id + 24a4b507-853a-4a38-99aa-05fcc54be24d + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest1 + + + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + + +""" + +String queryIdAIIResponse_SRIOV = +""" + + 6cb1ae5a-d2db-4eb6-97bf-d52a506a53d8 + MSO_TEST_1702_A_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_17 + SR_IOV_Provider2_1 + HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1 + AIC_SR_IOV + false + + 1487336177672 + PendingCreate + f70d7a32-0ac8-4bd5-a0fb-3c9336540d78 + 1.0 + Physnet21 + true + false + false + + + 10437 + MSO_TEST_1702_A_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_17_S0 + 192.168.6.1 + 192.168.6.0 + 26 + 4 + PendingCreate + true + 192.168.6.3 + 192.168.6.62 + 1487336177359 + + + + + tenant + https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn16/tenants/tenant/6accefef3cb442ff9e644d589fb04107 + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn16 + + + tenant.tenant-id + 6accefef3cb442ff9e644d589fb04107 + + + tenant.tenant-name + MSO_TEST_1702_A + + + + cloud-region + https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn16 + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn16 + + + cloud-region.owner-defined-type + lcp + + + + service-instance + https://aai-ext1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/51d8336b-a993-4afe-a5fc-10b3afbd6560 + + customer.global-customer-id + MSO_1610_ST + + + service-subscription.service-type + MSO-dev-service-type + + + service-instance.service-instance-id + 51d8336b-a993-4afe-a5fc-10b3afbd6560 + + + service-instance.service-instance-name + HnportalProviderNetwork_17 + + + +""" + + String queryIdAIIResponseTestScenario01 = + """ + + 4da55fe4-7a9e-478c-a434-8a98d62265ab + GN_EVPN_direct_net_0_ST1 + CONTRAIL30_BASIC + GN_EVPN_direct + contrail + false + 9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + 1465398611 + pending-create + networkName + false + true + false + + + cb1a7b47-5428-44c9-89c2-8b17541c3228 + 108.239.40.1 + 108.239.40.0 + 28 + 4 + pending-create + true + 108.239.40.0 + 108.239.40.0 + 1465398611 + subnetName + + + + e2cc7c14-90f0-4205-840d-b4e07f04e621 + 2606:ae00:2e01:604::1 + 2606:ae00:2e01:604:: + 64 + 6 + pending-create + true + 2606:ae00:2e01:604:: + 2606:ae00:2e01:604:: + 1465398611 + subnetName + + + + + + 416 + 4132176 + + + + cloud-region + https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/ + + + cloud-region.cloud-region-id + AAIAIC25 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.owner-defined-type + + + + + tenant + https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/4ae1d3446a4c48b2bec44b6cfba06d68/ + + tenant.tenant-id + 4ae1d3446a4c48b2bec44b6cfba06d68 + + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + AAIAIC25 + + + tenant.tenant-name + Ruchira Contrail 3.0 test + + + + vpn-binding + https://localhost:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 9a7b327d9-287aa00-82c4b0-100001 + + + vpn-binding.vpn-name + GN_EVPN_direct_net_0_ST1 + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + +""" + + String queryIdAIIResponseVpnNotPresent = + """ + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + + + +""" + + String queryNameAIIResponse = + """ + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + + + """ + + String queryNameAIIResponseVpnNotPresent = + """ + + + + + + + + + + + + + + +""" + + String queryVpnBindingAAIResponse = + """ + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 13979:105757 + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ + + l3-network.network-id + 689ec39e-c5fc-4462-8db2-4f760763ad28 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ + + l3-network.network-id + 1a49396b-19b3-40a4-8792-aa2fbd0f0704 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ + + l3-network.network-id + 774f3329-3c83-4771-86c7-9e6207cd50fd + + + + + +""" + + String createDBRequestError01 = + """ + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + BPMN + Received error unexpectedly from SDN-C. + + FAILED + <network-id></network-id><network-name></network-names> + + + """ + + String createDBRequest_Outputs = + """ + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + BPMN + Network successfully created. + + COMPLETED + 100 + <network-id>networkId</network-id><network-name>MNS-25180-L-01-dmz_direct_net_1</network-names> + networkId + + +""" + + String createNetworkRequest = + """ + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + sn5256d1-5a33-55df-13ab-12abad84e222 + CONTRAIL + + networkName + 414,415 + + + true + false + 13979:105757 + 13979:105757 + GN_EVPN_Test + refFQDN1 + refFQDN2 + + + + + + + 107.239.52.0/24 + true + 107.239.52.1 + 4 + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + subnetName + true + + 192.10.16.0/24 + 192.10.16.100/24 + + + 192.110.17.0/24 + 192.110.17.110/24 + + + + + + + + 107.239.52.0/24 + true + 107.239.52.1 + 4 + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + subnetName + true + + 192.10.16.0/24 + 192.10.16.100/24 + + + true + true + false + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + messageId_generated + +""" + +String createNetworkRequest_Ipv4 = +""" + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + sn5256d1-5a33-55df-13ab-12abad84e222 + CONTRAIL + + networkName + 414,415 + + + true + false + 13979:105757 + 13979:105757 + GN_EVPN_Test + refFQDN1 + refFQDN2 + + + + + + + 107.239.52.0/24 + true + 107.239.52.1 + 4 + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + subnetName + + + + + + + 107.239.52.0/24 + true + 107.239.52.1 + 4 + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + subnetName + + true + true + false + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + messageId_generated + +""" + +String createNetworkRequestAlaCarte = +""" + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + f21df226-8093-48c3-be7e-0408fcda0422 + CONTRAIL + + networkName + 414,415 + + + true + false + 13979:105757 + 13979:105757 + GN_EVPN_Test + refFQDN1 + refFQDN2 + + + + + + + 107.239.52.0/24 + true + 107.239.52.1 + 4 + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + subnetName + + + + + + + 107.239.52.0/24 + true + 107.239.52.1 + 4 + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + subnetName + + true + true + false + + someValue1 + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + messageId_generated + +""" + +String createNetworkRequest_SRIOV = +""" + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + 6cb1ae5a-d2db-4eb6-97bf-d52a506a53d8 + MSO_TEST_1702_A_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_17 + CONTRAIL_EXTERNAL + sn5256d1-5a33-55df-13ab-12abad84e222 + AIC_SR_IOV + + Physnet21 + + + + + 192.168.6.3 + 192.168.6.62 + + 192.168.6.0/26 + true + 192.168.6.1 + 4 + 10437 + MSO_TEST_1702_A_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_17_S0 + + true + true + false + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + messageId_generated + +""" + + String createNetworkRequest_noPhysicalName = + """ + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + CONTRAIL + + networkName + 414,415 + + + true + false + 13979:105757 + 13979:105757 + GN_EVPN_Test + + + + + + + 107.239.52.0/24 + true + 107.239.52.1 + 4 + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + subnetName + + + + + + + 107.239.52.0/24 + true + 107.239.52.1 + 4 + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + subnetName + + true + true + false + + true + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + true + true + 10.10.125.1 + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + null + + messageId_generated + +""" + + String createNetworkResponseREST = + """ + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 + + true + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + + + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + CONTRAIL_EXTERNAL + true + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + + messageId_generated +""" + + String createRollbackNetworkRequest = + """ + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + CONTRAIL_EXTERNAL + true + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + +""" + + String createNetworkResponse = + """ + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + + + + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + true + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + CONTRAIL_EXTERNAL + false + c4f4e878-cde0-4b15-ae9a-bda857759cea + 7dd5365547234ee8937416c65507d266 + +""" + + String updateContrailAAIPayloadRequest = + """ + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + Contrail + c4f4e878-cde0-4b15-ae9a-bda857759cea + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + l3-version + Created + default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + 107.239.52.1 + 107.239.52.0 + 24 + 4 + Created + true + ECOMP + 1505857301954 + subnetName + true + + + string + 192.10.16.0/24 + 192.10.16.100/24 + ip-address + 1505857301954 + + + string + 192.110.17.0/24 + 192.110.17.110/24 + ip-address + 1505857301954 + + + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + 107.239.52.1 + 107.239.52.0 + 24 + 4 + Created + true + 1505857301954 + subnetName + true + + + string + 192.10.16.0/24 + 192.10.16.100/24 + ip-address + 1505857301954 + + + + + + 414 + 4132176 + + + 415 + 4132176 + + + + inner + ctag-version + + + tenant + https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ + + vpn-binding.vpn-id + a290b841-f672-44dd-b9cd-6f8c20d7d8c8 + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest2 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ + + vpn-binding.vpn-id + 24a4b507-853a-4a38-99aa-05fcc54be24d + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest1 + + + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + +""" + +String updateContrailAAIPayloadRequest_segmentation = +""" + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + Contrail + c4f4e878-cde0-4b15-ae9a-bda857759cea + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + l3-version + Created + default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + 107.239.52.1 + 107.239.52.0 + 24 + 4 + Created + true + subnetName + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + 107.239.52.1 + 107.239.52.0 + 24 + 4 + Created + true + subnetName + + + + + 1 + 1498507569188 + + + + + inner + ctag-version + + + tenant + https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ + + vpn-binding.vpn-id + a290b841-f672-44dd-b9cd-6f8c20d7d8c8 + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest2 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ + + vpn-binding.vpn-id + 24a4b507-853a-4a38-99aa-05fcc54be24d + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest1 + + + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + +""" + + String updateContrailAAIResponse = + """ + + + + + + + + +""" + + String createNetworkErrorResponse = + """ + 680bd458-5ec1-4a16-b77c-509022e53450INTERNAL + 400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data + true + """ + + + String networkException500 = + """soap:VersionMismatch"http://org.onap.so/network", the namespace on the "createNetworkContrail" element, is not a valid SOAP version.""" + + String aaiResponse = + """ + + + + + + + + + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_BASIC + HSL_direct + contrail + 8bbd3edf-b835-4610-96a2-a5cafa029042 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + active + HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 + + + ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a + 5a77fdc2-7789-4649-a1b9-6eaf1db1813a + 172.16.34.1 + 172.16.34.0 + 28 + 4 + active + true + + + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v3/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ + + tenant.tenant-id + e81d842d3e8b45c5a59f57cd76af3aaf + + + + + + """ + + String assignSDNCRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + assign + network-topology-operation + sdncCallback + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + NetworkActivateRequest + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + MSO_1610_dev + + + networkId + CONTRAIL_EXTERNAL + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + +String assignSDNCRequest_decodeUrlLink = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + assign + network-topology-operation + sdncCallback + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + NetworkActivateRequest + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + VIRTUAL USP + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + MSO_1610_dev + + + networkId + CONTRAIL_EXTERNAL + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + +String assignRpcSDNCRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + assign + network-topology-operation + sdncCallback + generic-resource + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + CreateNetworkInstance + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + + fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 + 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 + 1.0 + HNGW Protected OAM + + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + globalId_45678905678 + MSO_1610_dev + + + networkId + CONTRAIL_EXTERNAL + + sn5256d1-5a33-55df-13ab-12abad84e764 + sn5256d1-5a33-55df-13ab-12abad84e222 + sn5256d1-5a33-55df-13ab-12abad84e111 + 1 + CONTRAIL_EXTERNAL + + + + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + + + +""" + +String activateSDNCRequest = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + activate + network-topology-operation + sdncCallback + generic-resource + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + CreateNetworkInstance + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + + fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 + 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 + 1.0 + HNGW Protected OAM + + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + globalId_45678905678 + MSO_1610_dev + + + networkId + CONTRAIL_EXTERNAL + + sn5256d1-5a33-55df-13ab-12abad84e764 + sn5256d1-5a33-55df-13ab-12abad84e222 + sn5256d1-5a33-55df-13ab-12abad84e111 + 1 + CONTRAIL_EXTERNAL + + + + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + + + +""" + +String assignResponse = +""" 006927ca-f5a3-47fd-880c-dfcbcd81a093 200 OK 200006927ca-f5a3-47fd-880c-dfcbcd81a093Ynotsurewecarea9a77d5a-123e-4ca2-9eb9-0b015d2ee0fbGN_EVPN_direct_net_0_ST_noGW8abc633a-810b-4ca5-8b3a-09511d13a2ce """ + + String sdncRollbackRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + rollback + network-topology-operation + sdncCallback + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + NetworkActivateRequest + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + MSO_1610_dev + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + +String sdncRpcRollbackRequest = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + unassign + network-topology-operation + sdncCallback + generic-resource + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + DeleteNetworkInstance + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + + fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 + 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 + 1.0 + HNGW Protected OAM + + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + globalId_45678905678 + MSO_1610_dev + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + + sn5256d1-5a33-55df-13ab-12abad84e764 + sn5256d1-5a33-55df-13ab-12abad84e222 + sn5256d1-5a33-55df-13ab-12abad84e111 + 1 + CONTRAIL_EXTERNAL + + + + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + + + +""" + +String sdncActivateRollbackRequest = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + deactivate + network-topology-operation + sdncCallback + generic-resource + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + DeleteNetworkInstance + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + + fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 + 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 + 1.0 + HNGW Protected OAM + + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + globalId_45678905678 + MSO_1610_dev + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + + sn5256d1-5a33-55df-13ab-12abad84e764 + sn5256d1-5a33-55df-13ab-12abad84e222 + sn5256d1-5a33-55df-13ab-12abad84e111 + 1 + CONTRAIL_EXTERNAL + + + + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + + + +""" + + String sdncAdapterWorkflowResponse = + """ + + + 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 + 200 + OK + + <output xmlns="com:att:sdnctl:vnf"><svc-request-id>00703dc8-71ff-442d-a4a8-3adc5beef6a9</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>MNS-25180-L-01-dmz_direct_net_1</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + +""" + + + String sdncAdapterWorkflowResponse_Error = + """ + + + + 400 + Error writing to l3-netework + Y + c79240d8-34b5-4853-af69-2021928dba00 + + + +""" + + String expected_sdncAdapterWorkflowResponse_Error = + """ + + + + 400 + Error writing to l3-netework + Y + c79240d8-34b5-4853-af69-2021928dba00 + + + +""" + + String sdncAdapterWorkflowFormattedResponse = + """ + + + 00703dc8-71ff-442d-a4a8-3adc5beef6a9 + 200 + Y + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + notsurewecare + + + +""" + +String sdncAdapterWorkflowAssignResponse = +""" + + + 79ec9006-3695-4fcc-93a8-be6f9e248beb + 200 + OK + + + + + 79ec9006-3695-4fcc-93a8-be6f9e248beb + + f805ec2b-b4d8-473e-8325-67f110139e5d + + 200 + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + restconf/config/GENERIC-RESOURCE-API:services/service/f805ec2b-b4d8-473e-8325-67f110139e5d/service-data/networks/network/f7e4db56-aab5-4065-8e65-cec1cd1de24f + + Y + + + +""" + + String rollbackNetworkRequest = +""" + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + CONTRAIL_EXTERNAL + true + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + +""" + + String rollbackActivateSDNCRequest = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + rollback + network-topology-operation + sdncCallback + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + CreateNetworkInstance + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + MSO_1610_dev + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + + invariant-uuid + customization-uuid + uuid + version + CONTRAIL_EXTERNAL + + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + + String rollbackSDNCRequest = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + rollback + network-topology-operation + sdncCallback + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + CreateNetworkInstance + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + MSO_1610_dev + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + + invariant-uuid + customization-uuid + uuid + version + CONTRAIL_EXTERNAL + + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + +// - - - - - - - - + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + public void initializeVariables (DelegateExecution mockExecution) { + + verify(mockExecution).setVariable(Prefix + "networkRequest", "") + verify(mockExecution).setVariable(Prefix + "rollbackEnabled", null) + verify(mockExecution).setVariable(Prefix + "networkInputs", "") + //verify(mockExecution).setVariable(Prefix + "requestId", "") + verify(mockExecution).setVariable(Prefix + "messageId", "") + verify(mockExecution).setVariable(Prefix + "source", "") + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "") + verify(mockExecution).setVariable(Prefix + "serviceInstanceId","") + verify(mockExecution).setVariable("GENGS_type","") + verify(mockExecution).setVariable(Prefix + "rsrc_endpoint", null) + verify(mockExecution).setVariable(Prefix + "networkOutputs", "") + verify(mockExecution).setVariable(Prefix + "networkId","") + verify(mockExecution).setVariable(Prefix + "networkName","") + + // AAI query Name + verify(mockExecution).setVariable(Prefix + "queryNameAAIRequest","") + verify(mockExecution).setVariable(Prefix + "queryNameAAIResponse", "") + verify(mockExecution).setVariable(Prefix + "aaiNameReturnCode", "") + verify(mockExecution).setVariable(Prefix + "isAAIqueryNameGood", false) + + // AAI query Cloud Region + verify(mockExecution).setVariable(Prefix + "queryCloudRegionRequest","") + verify(mockExecution).setVariable(Prefix + "queryCloudRegionReturnCode","") + verify(mockExecution).setVariable(Prefix + "queryCloudRegionResponse","") + verify(mockExecution).setVariable(Prefix + "cloudRegionPo","") + verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc","") + verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", false) + + // AAI query Id + verify(mockExecution).setVariable(Prefix + "queryIdAAIRequest","") + verify(mockExecution).setVariable(Prefix + "queryIdAAIResponse", "") + verify(mockExecution).setVariable(Prefix + "aaiIdReturnCode", "") + + // AAI query vpn binding + verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest","") + verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIResponse", "") + verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "") + verify(mockExecution).setVariable(Prefix + "vpnBindings", null) + verify(mockExecution).setVariable(Prefix + "vpnCount", 0) + verify(mockExecution).setVariable(Prefix + "routeCollection", "") + + // AAI query network policy + verify(mockExecution).setVariable(Prefix + "queryNetworkPolicyAAIRequest","") + verify(mockExecution).setVariable(Prefix + "queryNetworkPolicyAAIResponse", "") + verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "") + verify(mockExecution).setVariable(Prefix + "networkPolicyUriList", null) + verify(mockExecution).setVariable(Prefix + "networkPolicyCount", 0) + verify(mockExecution).setVariable(Prefix + "networkCollection", "") + + // AAI query route table reference + verify(mockExecution).setVariable(Prefix + "queryNetworkTableRefAAIRequest","") + verify(mockExecution).setVariable(Prefix + "queryNetworkTableRefAAIResponse", "") + verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "") + verify(mockExecution).setVariable(Prefix + "networkTableRefUriList", null) + verify(mockExecution).setVariable(Prefix + "networkTableRefCount", 0) + verify(mockExecution).setVariable(Prefix + "tableRefCollection", "") + + // AAI requery Id + verify(mockExecution).setVariable(Prefix + "requeryIdAAIRequest","") + verify(mockExecution).setVariable(Prefix + "requeryIdAAIResponse", "") + verify(mockExecution).setVariable(Prefix + "aaiRequeryIdReturnCode", "") + + // AAI update contrail + verify(mockExecution).setVariable(Prefix + "updateContrailAAIUrlRequest","") + verify(mockExecution).setVariable(Prefix + "updateContrailAAIPayloadRequest","") + verify(mockExecution).setVariable(Prefix + "updateContrailAAIResponse", "") + verify(mockExecution).setVariable(Prefix + "aaiUpdateContrailReturnCode", "") + + verify(mockExecution).setVariable(Prefix + "createNetworkRequest", "") + verify(mockExecution).setVariable(Prefix + "createNetworkResponse", "") + verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", "") + //verify(mockExecution).setVariable(Prefix + "rollbackNetworkResponse", "") + verify(mockExecution).setVariable(Prefix + "networkReturnCode", "") + //verify(mockExecution).setVariable(Prefix + "rollbackNetworkReturnCode", "") + verify(mockExecution).setVariable(Prefix + "isNetworkRollbackNeeded", false) + + verify(mockExecution).setVariable(Prefix + "assignSDNCRequest", "") + verify(mockExecution).setVariable(Prefix + "assignSDNCResponse", "") + verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", "") + //verify(mockExecution).setVariable(Prefix + "rollbackSDNCResponse", "") + verify(mockExecution).setVariable(Prefix + "sdncReturnCode", "") + //verify(mockExecution).setVariable(Prefix + "rollbackSDNCReturnCode", "") + verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", false) + verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false) + + verify(mockExecution).setVariable(Prefix + "activateSDNCRequest", "") + verify(mockExecution).setVariable(Prefix + "activateSDNCResponse", "") + verify(mockExecution).setVariable(Prefix + "rollbackActivateSDNCRequest", "") + //verify(mockExecution).setVariable(Prefix + "rollbackActivateSDNCResponse", "") + verify(mockExecution).setVariable(Prefix + "sdncActivateReturnCode", "") + //verify(mockExecution).setVariable(Prefix + "rollbackActivateSDNCReturnCode", "") + verify(mockExecution).setVariable(Prefix + "isSdncActivateRollbackNeeded", false) + verify(mockExecution).setVariable(Prefix + "sdncActivateResponseSuccess", false) + + verify(mockExecution).setVariable(Prefix + "orchestrationStatus", "") + verify(mockExecution).setVariable(Prefix + "isVnfBindingPresent", false) + verify(mockExecution).setVariable(Prefix + "Success", false) + + verify(mockExecution).setVariable(Prefix + "isException", false) + + } + + @Test + //@Ignore + public void preProcessRequest_vIPR_NetworkRequest() { + + println "************ preProcessRequest_Payload ************* " + + def networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111", + "modelName": "CONTRAIL_EXTERNAL", + "modelType": "CONTRAIL_EXTERNAL", + "modelVersion": "1", + "modelCustomizationUuid": "sn5256d1-5a33-55df-13ab-12abad84e222", + "modelInvariantUuid": "sn5256d1-5a33-55df-13ab-12abad84e764" + }""".trim() + + def serviceModelInfo = """{"modelUuid": "36a3a8ea-49a6-4ac8-b06c-89a54544b9b6", + "modelName": "HNGW Protected OAM", + "modelType": "service", + "modelVersion": "1.0", + "modelInvariantUuid": "fcc85cb0-ad74-45d7-a5a1-17c8744fdb71" + }""".trim() + + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + + // Pre-defined value, testing Only + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + // Inputs: + when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("disableRollback")).thenReturn("true") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("networkId")).thenReturn("networkId") // optional + when(mockExecution.getVariable("networkName")).thenReturn("MNS-25180-L-01-dmz_direct_net_1") // optional + when(mockExecution.getVariable("productFamilyId")).thenReturn("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + when(mockExecution.getVariable("networkModelInfo")).thenReturn("CONTRAIL_EXTERNAL") + when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable("tenantId")).thenReturn("7dd5365547234ee8937416c65507d266") + when(mockExecution.getVariable("failIfExists")).thenReturn("false") + when(mockExecution.getVariable("networkModelInfo")).thenReturn(networkModelInfo) + when(mockExecution.getVariable("serviceModelInfo")).thenReturn(serviceModelInfo) + when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") + when(mockExecution.getVariable("action")).thenReturn("CREATE") + when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("MSO-dev-service-type") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("globalId_45678905678") + + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + when(mockExecution.getVariable("mso.adapters.sdnc.endpoint")).thenReturn("http://localhost:8090/SDNCAdapter") + when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter") + when(mockExecution.getVariable("mso.adapters.sdnc.resource.endpoint")).thenReturn("http://localhost:8090/SDNCAdapterRpc") + + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.preProcessRequest(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + //verify variable initialization + initializeVariables(mockExecution) + + verify(mockExecution).setVariable("action", "CREATE") + verify(mockExecution).setVariable(Prefix + "networkId","") + verify(mockExecution).setVariable(Prefix + "networkRequest", expectedvIPRNetworkRequest) + verify(mockExecution, atLeast(1)).setVariable(Prefix + "rollbackEnabled", false) + verify(mockExecution).setVariable(Prefix + "networkInputs", expectedvIPRNetworkInputs) + //verify(mockExecution).setVariable(Prefix + "requestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //verify(mockExecution).setVariable("mso-service-instance-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution).setVariable(Prefix + "messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution).setVariable(Prefix + "source", "VID") + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable(Prefix + "serviceInstanceId","f70e927b-6087-4974-9ef8-c5e4d5847ca4") + verify(mockExecution, atLeast(1)).setVariable("GENGS_type", "service-instance") + //verify(mockExecution, atLeast(1)).setVariable("mso-request-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //verify(mockExecution, atLeast(1)).setVariable("msoRequestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //verify(mockExecution).setVariable("mso-service-instance-id","88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution).setVariable(Prefix + "networkId","") + verify(mockExecution).setVariable(Prefix + "networkOutputs", networkvIPROutputs) + verify(mockExecution).setVariable(Prefix + "networkName","") + + } + + @Test + //@Ignore + public void preProcessRequest_JSON_NetworkRequest() { + + println "************ preProcessRequest_Payload ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + + // Pre-defined value, testing Only + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + // Inputs: + // when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("requestAction")).thenReturn("CREATE") + when(mockExecution.getVariable("networkId")).thenReturn("networkId") // optional + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) // JSON format + when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") // 1610 default + when(mockExecution.getVariable("disableRollback")).thenReturn(true) + + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + when(mockExecution.getVariable("mso.adapters.sdnc.endpoint")).thenReturn("http://localhost:8090/SDNCAdapter") + when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter") + when(mockExecution.getVariable("mso.adapters.sdnc.resource.endpoint")).thenReturn("http://localhost:8090/SDNCAdapterRpc") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.preProcessRequest(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + //verify variable initialization + initializeVariables(mockExecution) + + verify(mockExecution).setVariable("action", "CREATE") + verify(mockExecution).setVariable(Prefix + "networkRequest", expectedJSONNetworkRequest) + verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) + verify(mockExecution).setVariable(Prefix + "networkInputs", expectedJSONNetworkInputs) + //verify(mockExecution).setVariable(Prefix + "requestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //verify(mockExecution).setVariable(Prefix + "messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution).setVariable(Prefix + "source", "VID") + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable(Prefix + "serviceInstanceId","f70e927b-6087-4974-9ef8-c5e4d5847ca4") + verify(mockExecution, atLeast(1)).setVariable("GENGS_type", "service-instance") + //verify(mockExecution, atLeast(1)).setVariable("msoRequestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //verify(mockExecution).setVariable("mso-service-instance-id","88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution).setVariable(Prefix + "networkId","") + verify(mockExecution).setVariable(Prefix + "networkOutputs", networkJSONOutputs) + verify(mockExecution).setVariable(Prefix + "networkName","") + + + } + + @Test + //@Ignore + public void preProcessRequest_XML_NetworkRequest() { + + println "************ preProcessRequest_Payload ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + + // Pre-defined value, testing Only + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + // Inputs: + // when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(xmlIncomingRequest) // XML format + + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + when(mockExecution.getVariable("mso.adapters.sdnc.endpoint")).thenReturn("http://localhost:8090/SDNCAdapter") + when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter") + when(mockExecution.getVariable("mso.adapters.sdnc.resource.endpoint")).thenReturn("http://localhost:8090/SDNCAdapterRpc") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.preProcessRequest(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + //verify variable initialization + initializeVariables(mockExecution) + + verify(mockExecution).setVariable("action", "CREATE") + verify(mockExecution).setVariable(Prefix + "networkRequest", expectedXMLNetworkRequest) + verify(mockExecution).setVariable(Prefix + "rollbackEnabled", true) + verify(mockExecution).setVariable(Prefix + "networkInputs", expectedXMLNetworkInputs) + //verify(mockExecution).setVariable(Prefix + "requestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution).setVariable(Prefix + "messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution).setVariable(Prefix + "source", "PORTAL") + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable(Prefix + "serviceInstanceId","MNS-25180-L-01-dmz_direct_net_1") + verify(mockExecution, atLeast(1)).setVariable("GENGS_type", "service-instance") + //verify(mockExecution).setVariable("mso-service-instance-id","88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution, atLeast(1)).setVariable(Prefix + "networkId","") + verify(mockExecution).setVariable(Prefix + "networkOutputs", networkXMLOutputs) + verify(mockExecution).setVariable(Prefix + "networkName","") + + } + + + + @Test + //@Ignore + public void prepareCreateNetworkRequest() { + + println "************ prepareNetworkRequest ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) + when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") + when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") + //when(mockExecution.getVariable(Prefix + "queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) + when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("13979:10575713979:105757") + when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("GN_EVPN_Test") + when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("refFQDN1refFQDN2") + when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.prepareCreateNetworkRequest(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix) + + verify(mockExecution).setVariable(Prefix + "createNetworkRequest", createNetworkRequest) + + } + + + @Test + //@Ignore + public void prepareCreateNetworkRequest_Ipv4() { + + println "************ prepareNetworkRequest ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) + when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse_Ipv4) + when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") + when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") + //when(mockExecution.getVariable(Prefix + "queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) + when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("13979:10575713979:105757") + when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("GN_EVPN_Test") + when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("refFQDN1refFQDN2") + when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.prepareCreateNetworkRequest(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix) + + verify(mockExecution).setVariable(Prefix + "createNetworkRequest", createNetworkRequest_Ipv4) + + } + + @Test + //@Ignore + public void prepareCreateNetworkRequest_AlaCarte() { + + println "************ prepareNetworkRequest ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedJSONNetworkRequest) + when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse_AlaCarte) + when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") + when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") + //when(mockExecution.getVariable(Prefix + "queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) + when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("13979:10575713979:105757") + when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("GN_EVPN_Test") + when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("refFQDN1refFQDN2") + when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.prepareCreateNetworkRequest(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix) + + verify(mockExecution).setVariable(Prefix + "createNetworkRequest", createNetworkRequestAlaCarte) + + } + + @Test + //@Ignore + public void prepareCreateNetworkRequest_SRIOV() { + + println "************ prepareNetworkRequest ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) + when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse_SRIOV) + when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") + when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") + //when(mockExecution.getVariable(Prefix + "queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) + when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("13979:10575713979:105757") + when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("GN_EVPN_Test") + when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("refFQDN1refFQDN2") + when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.prepareCreateNetworkRequest(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix) + + verify(mockExecution).setVariable(Prefix + "createNetworkRequest", createNetworkRequest_SRIOV) + + } + + + @Test + //@Ignore + public void prepareSDNCRequest() { + + println "************ prepareSDNCRequest ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) + when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("networkId") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") + + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.prepareSDNCRequest(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "assignSDNCRequest", assignSDNCRequest) + + } + + @Test + //@Ignore + public void prepareSDNCRequest_decodeUrlLink() { + + println "************ prepareSDNCRequest ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) + when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("networkId") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/VIRTUAL%20USP/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") + + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.prepareSDNCRequest(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "assignSDNCRequest", assignSDNCRequest_decodeUrlLink) + + } + + @Test + //@Ignore + public void prepareRpcSDNCRequest() { + + println "************ prepareRpcSDNCRequest ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) + when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") // test ONLY + when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("networkId") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.prepareRpcSDNCRequest(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "assignSDNCRequest", assignRpcSDNCRequest) + + } + + @Test + //@Ignore + public void prepareSDNCRollbackRequest() { + + println "************ prepareSDNCRollbackRequest ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) + when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable(Prefix + "assignSDNCResponse")).thenReturn(assignResponse) + when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("8abc633a-810b-4ca5-8b3a-09511d13a2ce") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.prepareSDNCRollbackRequest(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", sdncRollbackRequest) + + } + + @Test + //@Ignore + public void prepareRpcSDNCActivateRequest() { + + println "************ prepareRpcSDNCActivateRequest ************* " + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) + when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("networkId") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") // test ONLY + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.prepareRpcSDNCActivateRequest(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "activateSDNCRequest", activateSDNCRequest) + + } + + + @Test + //@Ignore + public void prepareRpcSDNCRollbackRequest() { + + println "************ prepareRpcSDNCRollbackRequest ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) + when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable(Prefix + "assignSDNCResponse")).thenReturn(assignResponse) + when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("8abc633a-810b-4ca5-8b3a-09511d13a2ce") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") // test ONLY + when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.prepareRpcSDNCRollbackRequest(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", sdncRpcRollbackRequest) + + } + + @Test + //@Ignore + public void prepareRpcSDNCActivateRollback() { + + println "************ prepareRpcSDNCActivateRollback ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedvIPRNetworkRequest) + when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable(Prefix + "activateSDNCResponse")).thenReturn(assignResponse) + when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("8abc633a-810b-4ca5-8b3a-09511d13a2ce") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") // test ONLY + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.prepareRpcSDNCActivateRollback(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix) + //verify(mockExecution).setVariable("mso-request-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //verify(mockExecution).setVariable(Prefix + "requestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //verify(mockExecution).setVariable("mso-service-instance-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution).setVariable(Prefix + "rollbackActivateSDNCRequest", sdncActivateRollbackRequest) + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkName_200() { + + println "************ callRESTQueryAAINetworkName ************* " + + WireMock.reset(); + MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(networkInputs) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + // old: when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.network.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.callRESTQueryAAINetworkName(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "queryNameAAIRequest", "http://localhost:8090/aai/v8/network/l3-networks/l3-network?network-name=MNS-25180-L-01-dmz_direct_net_1") + + verify(mockExecution).setVariable(Prefix + "aaiNameReturnCode", "200") + verify(mockExecution).setVariable(Prefix + "orchestrationStatus", "PENDING-CREATE") + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkName_404() { + + println "************ callRESTQueryAAINetworkName ************* " + + WireMock.reset(); + MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(networkInputs_404) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + // old: when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.network.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.callRESTQueryAAINetworkName(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "queryNameAAIRequest", "http://localhost:8090/aai/v8/network/l3-networks/l3-network?network-name=myOwn_Network") + verify(mockExecution).setVariable(Prefix + "aaiNameReturnCode", "404") + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkId_200() { + + println "************ callRESTQueryAAINetworkId ************* " + + WireMock.reset(); + MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "assignSDNCResponse")).thenReturn(sdncAdapterWorkflowAssignResponse) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + // old: when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.network.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.callRESTQueryAAINetworkId(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "queryIdAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") + verify(mockExecution).setVariable(Prefix + "aaiIdReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAICloudRegion30_200() { + + println "************ callRESTQueryAAICloudRegion30_200 ************* " + + WireMock.reset(); + MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix) + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedvIPRNetworkRequest) + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + // + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200") + verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) + + } + + @Test + //@Ignore + public void callRESTQueryAAICloudRegion25_200() { + + println "************ callRESTQueryAAICloudRegion25_200 ************* " + + WireMock.reset(); + MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix) + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedvIPRNetworkRequest) + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + // + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200") + verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) + + } + + @Test + //@Ignore + public void callRESTQueryAAICloudRegion_NotFound() { + + println "************ callRESTQueryAAICloudRegionFake ************* " + + WireMock.reset(); + MockGetNetworkCloudRegion_404("MDTWNJ21") + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix) + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestFakeRegion) + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + //old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + // + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution, atLeast(1)).setVariable(Prefix + "queryCloudRegionReturnCode", "404") + verify(mockExecution).setVariable(Prefix + "cloudRegionPo", "MDTWNJ21") + verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc", "AAIAIC25") + verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkVpnBinding_200() { + + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + + WireMock.reset(); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse) // v6 + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.network.vpn-binding.uri")).thenReturn("") + // old: when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.network.vpn-binding.uri")).thenReturn("") + when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "vpnCount", 2) + verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") + verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkVpnBindingList_200() { + + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + + WireMock.reset(); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBindingList_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBindingList_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse) // v6 + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "vpnCount", 2) + verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") + verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkVpnBinding_TestScenario01_200() { + + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + + WireMock.reset(); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponseTestScenario01) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.network.vpn-binding.uri")).thenReturn("") + // old: when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.network.vpn-binding.uri")).thenReturn("") + when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "vpnCount", 1) + verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") + verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkVpnBinding_200_URN_Uri() { + + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + + WireMock.reset(); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + //when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.network.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") + //when(mockExecution.getVariable("mso.workflow.default.aai.network.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "vpnCount", 2) + verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") + verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkVpnBinding_NotPresent() { + + println "************ callRESTQueryAAINetworkVpnBinding_NotPresent ************* " + + WireMock.reset(); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + + when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponseVpnNotPresent) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + //when(mockExecution.getVariable("mso.workflow.default.aai.network.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + verify(mockExecution).setVariable(Prefix + "vpnCount", 0) + verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIResponse", aaiVpnResponseStub) + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkPolicy_200() { + + println "************ callRESTQueryAAINetworkPolicy_200 ************* " + + WireMock.reset(); + MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + //when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.network-policy.uri")).thenReturn("") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.network-policy.uri")).thenReturn("/aai/v8/network/network-policies/network-policy") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.network-policy.uri")).thenReturn("/aai/v8/network/network-policies/network-policy") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.callRESTQueryAAINetworkPolicy(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "networkPolicyCount", 1) + verify(mockExecution).setVariable(Prefix + "networkPolicyUriList", ['/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable(Prefix + "queryNetworkPolicyAAIRequest", "http://localhost:8090/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg?depth=all") + verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkTableRef_200() { + + println "************ callRESTQueryAAINetworkTableRef_200 ************* " + + WireMock.reset(); + MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); + MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.default.aai.network-table-reference.uri")).thenReturn("") + // old: when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.network-table-reference.uri")).thenReturn("") + when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.route-table-reference.uri")).thenReturn("/aai/v8/network/route-table-references/route-table-reference") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.callRESTQueryAAINetworkTableRef(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "networkTableRefCount", 2) + verify(mockExecution).setVariable(Prefix + "networkTableRefUriList", ['/aai/v8/network/route-table-references/route-table-reference/refFQDN1','/aai/v8/network/route-table-references/route-table-reference/refFQDN2']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable(Prefix + "queryNetworkTableRefAAIRequest", "http://localhost:8090/aai/v8/network/route-table-references/route-table-reference/refFQDN1?depth=all") + verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTReQueryAAINetworkId_200() { + + println "************ callRESTReQueryAAINetworkId ************* " + + WireMock.reset(); + MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + //when(mockExecution.getVariable("mso.workflow.default.aai.l3-network.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") + //old: when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.network.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.callRESTReQueryAAINetworkId(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "requeryIdAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") + verify(mockExecution).setVariable(Prefix + "aaiRequeryIdReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTUpdateContrailAAINetworkREST_200() { + + println "************ callRESTUpdateContrailAAINetwork ************* " + + WireMock.reset(); + MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable(Prefix + "createNetworkResponse")).thenReturn(createNetworkResponseREST) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + // old: when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.network.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("false") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.callRESTUpdateContrailAAINetwork(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "updateContrailAAIUrlRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") + verify(mockExecution).setVariable(Prefix + "updateContrailAAIPayloadRequest", updateContrailAAIPayloadRequest) + verify(mockExecution).setVariable(Prefix + "aaiUpdateContrailReturnCode", "200") + //verify(mockExecution).setVariable(Prefix + "updateContrailAAIResponse", updateContrailAAIResponse) + verify(mockExecution).setVariable(Prefix + "isPONR", true) + + } + + @Test + //@Ignore + public void callRESTUpdateContrailAAINetworkREST_200_segmentation() { + + println "************ callRESTUpdateContrailAAINetwork ************* " + + WireMock.reset(); + MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse_segmentation) + when(mockExecution.getVariable(Prefix + "createNetworkResponse")).thenReturn(createNetworkResponseREST) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + // old: when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.network.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("false") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.callRESTUpdateContrailAAINetwork(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "updateContrailAAIUrlRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") + verify(mockExecution).setVariable(Prefix + "updateContrailAAIPayloadRequest", updateContrailAAIPayloadRequest_segmentation) + verify(mockExecution).setVariable(Prefix + "aaiUpdateContrailReturnCode", "200") + //verify(mockExecution).setVariable(Prefix + "updateContrailAAIResponse", updateContrailAAIResponse) + verify(mockExecution).setVariable(Prefix + "isPONR", true) + + } + + + + @Test + //@Ignore + public void validateCreateNetworkResponseREST() { + + println "************ validateNetworkResponse ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "createNetworkResponse")).thenReturn(createNetworkResponseREST) + when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('200') + + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.validateCreateNetworkResponse(mockExecution) + + //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "createNetworkResponse", createNetworkResponseREST) + verify(mockExecution).setVariable(Prefix + "isNetworkRollbackNeeded", true) + verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", createRollbackNetworkRequest) + + } + + @Test + //@Ignore + public void validateCreateNetworkResponseREST_Error() { + + println "************ validateNetworkResponse ************* " + + WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "createNetworkResponse")).thenReturn(networkException500) + when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('500') + + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + try { + DoCreateNetworkInstance.validateCreateNetworkResponse(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution, atLeast(1)).setVariable("WorkflowException", refEq(workflowException, any(WorkflowException.class))) + + } + + @Test + //@Ignore + public void validateSDNCResponse() { + + println "************ validateSDNCResponse ************* " + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "assignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse) + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) + when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "isResponseGood")).thenReturn(true) + + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + try { + DoCreateNetworkInstance.validateSDNCResponse(mockExecution) + verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) + + } catch (Exception ex) { + println " Graceful Exit - " + ex.getMessage() + } + //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + //verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) + + } + + @Test + //@Ignore + public void validateSDNCResponse_Error() { + + println "************ validateSDNCResponse ************* " + + WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstance", 2500, "Received error from SNDC Adapter: HTTP Status 500.") + + //ExecutionEntity mockExecution = mock(ExecutionEntity.class) + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "assignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse_Error) + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(false) + when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + + + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + try { + DoCreateNetworkInstance.validateSDNCResponse(mockExecution) + } catch (Exception ex) { + println " Graceful Exit! - " + ex.getMessage() + } + //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + // verify set prefix = Prefix + "" + //verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false) + + } + + @Test + //@Ignore + public void validateRpcSDNCActivateResponse() { + + println "************ validateRpcSDNCActivateResponse ************* " + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "activateSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse) + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) + when(mockExecution.getVariable(Prefix + "sdncActivateReturnCode")).thenReturn("200") + + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + try { + DoCreateNetworkInstance.validateRpcSDNCActivateResponse(mockExecution) + verify(mockExecution).setVariable(Prefix + "isSdncActivateRollbackNeeded", true) + + } catch (Exception ex) { + println " Graceful Exit - " + ex.getMessage() + } + //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + //verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) + + } + + @Test + //@Ignore + public void prepareRollbackData() { + + println "************ prepareRollbackData() ************* " + + + + WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn(rollbackSDNCRequest) + when(mockExecution.getVariable(Prefix + "rollbackActivateSDNCRequest")).thenReturn(rollbackActivateSDNCRequest) + when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(rollbackNetworkRequest) + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.prepareRollbackData(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + } + + @Test + public void postProcessResponse() { + + println "************ postProcessResponse() ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("testProcessKey")).thenReturn("DoCreateNetworkInstanceTest") + when(mockExecution.getVariable(Prefix + "isException")).thenReturn(false) + when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") + when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn(sdncRpcRollbackRequest) + when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(rollbackSDNCRequest) + when(mockExecution.getVariable(Prefix + "rollbackActivateSDNCRequest")).thenReturn(sdncActivateRollbackRequest) + + + // preProcessRequest(DelegateExecution execution) + DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() + DoCreateNetworkInstance.postProcessResponse(mockExecution) + +// verify(mockExecution,atLeastOnce()).getVariable("isDebugLogEnabled") + verify(mockExecution,atLeastOnce()).setVariable("prefix", Prefix) + verify(mockExecution,atLeastOnce()).setVariable(Prefix + "Success", true) + + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoCreateNetworkInstance") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateNetworkInstance") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateNetworkInstance") + when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateNetworkInstance") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy new file mode 100644 index 0000000000..cc6f89865f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy @@ -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.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInstance +import org.onap.so.bpmn.mock.StubResponseAAI + +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +class DoCreateServiceInstanceTest { + def prefix = "DCRESI_" + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + void testPreProcessRequest() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("msoRequestId")).thenReturn("12345") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("MIS/1604/0026/SW_INTERNET") + when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("MDTWNJ21") + when(mockExecution.getVariable("mso-request-id")).thenReturn("testRequestId-1503410089303") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:28080/mso/SDNCAdapterCallbackService") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("MSO_dev") + when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("MSO-dev-service-type") + when(mockExecution.getVariable("productFamilyId")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable("sdnc.si.svc.types")).thenReturn("PORT-MIRROR,PPROBES") + + ServiceDecomposition decomposition = new ServiceDecomposition() + ModelInfo modelInfo = new ModelInfo() + ServiceInstance instance = new ServiceInstance() + instance.instanceId = "12345" + decomposition.modelInfo = modelInfo + decomposition.serviceInstance = instance + + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(decomposition) + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.default.aai.customer.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.customer.uri")).thenReturn('/aai/v8/business/customers/customer') + + + DoCreateServiceInstance obj = new DoCreateServiceInstance() + obj.preProcessRequest(mockExecution) + + verify(mockExecution).setVariable("prefix", prefix) + verify(mockExecution).setVariable("sdncCallbackUrl", "http://localhost:28080/mso/SDNCAdapterCallbackService") + } + + + + @Test + void testGetAAICustomerById() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("12345") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.customer.uri")).thenReturn("/aai/v9/business/customers/customer") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.DoCreateServiceInstance.aai.version")).thenReturn('8') + StubResponseAAI.MockGetCustomer("12345", "") + DoCreateServiceInstance obj = new DoCreateServiceInstance() + obj.getAAICustomerById(mockExecution) + + verify(mockExecution, times(1)).getVariable("aai.endpoint") + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoCreateServiceInstance") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateServiceInstance") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateServiceInstance") + when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateServiceInstance") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy new file mode 100644 index 0000000000..6d9d5e5356 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy @@ -0,0 +1,106 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse +import static com.github.tomakehurst.wiremock.client.WireMock.put +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.times +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.when + +/** + * @author sushilma + * @since January 10, 2018 + */ +@RunWith(MockitoJUnitRunner.class) +class DoCreateVFCNetworkServiceInstanceTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + @Before + public void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + public void testAddNSRelationship(){ + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("nsInstanceId")).thenReturn("NS12345") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("MSO_dev") + when(mockExecution.getVariable("serviceType")).thenReturn("MSO-dev-service-type") + when(mockExecution.getVariable("serviceId")).thenReturn("SER12345") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + MockPutServiceInstance("MSO_dev", "MSO-dev-service-type", "SER12345"); + DoCreateVFCNetworkServiceInstance DoCreateVFCNetworkServiceInstance = new DoCreateVFCNetworkServiceInstance() + DoCreateVFCNetworkServiceInstance.addNSRelationship(mockExecution); + verify(mockExecution, times(1)).getVariable("aai.endpoint") + verify(mockExecution, times(1)).getVariable("mso.msoKey") + verify(mockExecution, times(1)).getVariable("aai.auth") + } + + private ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoCreateVFCNetworkServiceInstance") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateVFCNetworkServiceInstance") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateVFCNetworkServiceInstance") + when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateVFCNetworkServiceInstance") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + return mockExecution + } + + public static void MockPutServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId+"/relationship-list/relationship")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml").withBody("") + )); + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy new file mode 100644 index 0000000000..c5c6187648 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy @@ -0,0 +1,202 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.utils.XmlComparator +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +class DoCreateVfModuleRollbackTest { + + def prefix = "DCVFMR_" + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + void testPrepSDNCAdapterRequest() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("testReqId")).thenReturn("testReqId") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:28080/mso/SDNCAdapterCallbackService") + when(mockExecution.getVariable(prefix + "source")).thenReturn("VID") + when(mockExecution.getVariable(prefix + "tenantId")).thenReturn("fba1bd1e195a404cacb9ce17a9b2b421") + when(mockExecution.getVariable(prefix + "vnfType")).thenReturn("vRRaas") + when(mockExecution.getVariable(prefix + "vnfName")).thenReturn("skask-test") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") + when(mockExecution.getVariable(prefix + "vfModuleModelName")).thenReturn("PCRF::module-0-2") + when(mockExecution.getVariable(prefix + "requestId")).thenReturn("testRequestId") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("cb510af0-5b21-4bc7-86d9-323cb396ce32") + when(mockExecution.getVariable(prefix + "vfModuleName")).thenReturn("PCRF::module-0-2") + when(mockExecution.getVariable(prefix + "serviceId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "cloudSiteId")).thenReturn("RDM2WAGPLCP") + + when(mockExecution.getVariable(prefix + "rollbackSDNCRequestActivate")).thenReturn("true") + + + DoCreateVfModuleRollback obj = new DoCreateVfModuleRollback() + obj.prepSDNCAdapterRequest(mockExecution) + + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + String expectedValue = FileUtil.readResourceFile("__files/DoCreateVfModuleRollback/sdncAdapterWorkflowRequest.xml") + XmlComparator.assertXMLEquals(expectedValue, captor.getValue()) + } + + + + @Test + void testBuildSDNCRequest() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("testReqId")).thenReturn("testReqId") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:28080/mso/SDNCAdapterCallbackService") + when(mockExecution.getVariable(prefix + "source")).thenReturn("VID") + when(mockExecution.getVariable(prefix + "vnfType")).thenReturn("vRRaas") + when(mockExecution.getVariable(prefix + "vnfName")).thenReturn("skask-test") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") + when(mockExecution.getVariable(prefix + "requestId")).thenReturn("testRequestId") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("cb510af0-5b21-4bc7-86d9-323cb396ce32") + when(mockExecution.getVariable(prefix + "vfModuleName")).thenReturn("PCRF::module-0-2") + when(mockExecution.getVariable(prefix + "serviceId")).thenReturn("12345") + + when(mockExecution.getVariable(prefix + "rollbackSDNCRequestActivate")).thenReturn("true") + + + DoCreateVfModuleRollback obj = new DoCreateVfModuleRollback() + String sdncRequest = obj.buildSDNCRequest(mockExecution, "svcInstId_test", "deactivate") + String expectedValue = FileUtil.readResourceFile("__files/DoCreateVfModuleRollback/deactivateSDNCRequest.xml") + XmlComparator.assertXMLEquals(expectedValue, sdncRequest) + } + + + + @Test + void testPrepVNFAdapterRequest() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("testReqId")).thenReturn("testReqId") + when(mockExecution.getVariable("mso.use.qualified.host")).thenReturn("true") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") + when(mockExecution.getVariable(prefix + "requestId")).thenReturn("testRequestId") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("cb510af0-5b21-4bc7-86d9-323cb396ce32") + when(mockExecution.getVariable(prefix + "mso-request-id")).thenReturn("12345") + when(mockExecution.getVariable("mso.workflow.message.endpoint")).thenReturn('http://localhost:18080/mso/WorkflowMessage/') + + + DoCreateVfModuleRollback obj = new DoCreateVfModuleRollback() + String sdncRequest = obj.prepVNFAdapterRequest(mockExecution) + + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + String expectedValue = FileUtil.readResourceFile("__files/DoCreateVfModuleRollback/vnfAdapterRestV1Request.xml") + XmlComparator.assertXMLEquals(expectedValue, captor.getValue(), "messageId", "notificationUrl") + } + + @Test + void testDeleteNetworkPoliciesFromAAI() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("DCVFM_cloudSiteId")).thenReturn("12345") + when(mockExecution.getVariable("mso.workflow.DoCreateVfModuleRollback.aai.network-policy.uri")).thenReturn("/aai/v8/network/network-policies/network-policy") + when(mockExecution.getVariable("mso.workflow.custom.DoCreateVfModuleRollback.aai.version")).thenReturn("8") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("rollbackData")).thenReturn(new RollbackData()) + List fqdnList = new ArrayList() + fqdnList.add("test") + when(mockExecution.getVariable(prefix + "createdNetworkPolicyFqdnList")).thenReturn(fqdnList) + mockData() + DoCreateVfModuleRollback obj = new DoCreateVfModuleRollback() + obj.deleteNetworkPoliciesFromAAI(mockExecution) + + Mockito.verify(mockExecution).setVariable("prefix", prefix) + Mockito.verify(mockExecution).setVariable(prefix + "networkPolicyFqdnCount", 1) + Mockito.verify(mockExecution).setVariable(prefix + "aaiQueryNetworkPolicyByFqdnReturnCode", 200) + } + + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoCreateVfModuleRollback") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateVfModuleRollback") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateVfModuleRollback") + when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateVfModuleRollback") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + + private static void mockData() { + stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml"))) + stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*")) + .willReturn(aResponse() + .withStatus(200))); + + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy new file mode 100644 index 0000000000..30e3779b53 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy @@ -0,0 +1,229 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.utils.XmlComparator +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +class DoCreateVfModuleTest { + def prefix = "DCVFM_" + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + void testQueryAAIVfModule() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("DCVFM_vnfId")).thenReturn("12345") + when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + DoCreateVfModule obj = new DoCreateVfModule() + obj.queryAAIVfModule(mockExecution) + Mockito.verify(mockExecution).setVariable("DCVFM_queryAAIVfModuleResponseCode", 200) + } + + + @Test + void testQueryAAIVfModuleForStatus() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("DCVFM_vnfId")).thenReturn("12345") + when(mockExecution.getVariable("DCVFM_vfModuleName")).thenReturn("module-0") + when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + DoCreateVfModule obj = new DoCreateVfModule() + obj.queryAAIVfModuleForStatus(mockExecution) + Mockito.verify(mockExecution).setVariable("DCVFM_orchestrationStatus", '') + Mockito.verify(mockExecution).setVariable("DCVFM_queryAAIVfModuleForStatusResponseCode", 200) + } + + + + @Test + void testPreProcessVNFAdapterRequest() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable(prefix + "cloudSiteId")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("cb510af0-5b21-4bc7-86d9-323cb396ce32") + when(mockExecution.getVariable("volumeGroupStackId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "vfModuleName")).thenReturn("PCRF::module-0-2") + when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("MDTWNJ21") + when(mockExecution.getVariable(prefix + "tenantId")).thenReturn("fba1bd1e195a404cacb9ce17a9b2b421") + when(mockExecution.getVariable(prefix + "vnfType")).thenReturn("vRRaas") + when(mockExecution.getVariable(prefix + "vnfName")).thenReturn("skask-test") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") + when(mockExecution.getVariable(prefix + "vfModuleModelName")).thenReturn("PCRF::module-0-2") + when(mockExecution.getVariable(prefix + "vfModuleIndex")).thenReturn("index") + when(mockExecution.getVariable(prefix + "requestId")).thenReturn("testRequestId") + when(mockExecution.getVariable(prefix + "serviceId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "serviceInstanceId")).thenReturn("MIS/1604/0026/SW_INTERNET") + when(mockExecution.getVariable(prefix + "backoutOnFailure")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "volumeGroupId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "asdcServiceModelVersion")).thenReturn("1.0") + when(mockExecution.getVariable(prefix + "modelCustomizationUuid")).thenReturn("cb510af0-5b21-4bc7-86d9-323cb396ced3") + when(mockExecution.getVariable("baseVfModuleId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "baseVfModuleHeatStackId")).thenReturn("12345") + String sdncGetResponse = FileUtil.readResourceFile("__files/DoCreateVfModule/sdncGetResponse.xml"); + when(mockExecution.getVariable(prefix + "getSDNCAdapterResponse")).thenReturn(sdncGetResponse) + Map map = new HashMap(); + map.put("vrr_image_name", "MDT17"); + map.put("availability_zone_0", "nova"); + map.put("vrr_flavor_name", "ns.c16r32d128.v1"); + when(mockExecution.getVariable("vnfParamsMap")).thenReturn(map) + when(mockExecution.getVariable("mso-request-id")).thenReturn("testRequestId-1503410089303") + when(mockExecution.getVariable("mso.use.qualified.host")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.message.endpoint")).thenReturn("http://localhost:28080/mso/WorkflowMesssage") + + mockData() + DoCreateVfModule obj = new DoCreateVfModule() + obj.preProcessVNFAdapterRequest(mockExecution) + + String createVnfARequest = FileUtil.readResourceFile("__files/DoCreateVfModule/createVnfARequest.xml") + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + XmlComparator.assertXMLEquals(createVnfARequest, captor.getValue(), "messageId", "notificationUrl") + } + + @Test + void testQueryCloudRegion() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("DCVFM_cloudSiteId")).thenReturn("12345") + when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + DoCreateVfModule obj = new DoCreateVfModule() + obj.queryCloudRegion(mockExecution) + + Mockito.verify(mockExecution).setVariable("prefix", prefix) + Mockito.verify(mockExecution).setVariable(prefix + "queryCloudRegionRequest", "http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/12345") + Mockito.verify(mockExecution).setVariable(prefix + "queryCloudRegionReturnCode", "200") + } + + + + @Test + void testCreateNetworkPoliciesInAAI() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("DCVFM_cloudSiteId")).thenReturn("12345") + when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.network-policy.uri")).thenReturn("/aai/v8/network/network-policies/network-policy") + when(mockExecution.getVariable("mso.workflow.custom.DoCreateVfModule.aai.version")).thenReturn("8") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("rollbackData")).thenReturn(new RollbackData()) + List fqdnList = new ArrayList() + fqdnList.add("test") + when(mockExecution.getVariable("DCVFM_contrailNetworkPolicyFqdnList")).thenReturn(fqdnList) + + mockData() + DoCreateVfModule obj = new DoCreateVfModule() + obj.createNetworkPoliciesInAAI(mockExecution) + + Mockito.verify(mockExecution).setVariable("prefix", prefix) + Mockito.verify(mockExecution).setVariable(prefix + "networkPolicyFqdnCount", 1) + Mockito.verify(mockExecution).setVariable(prefix + "aaiQqueryNetworkPolicyByFqdnReturnCode", 200) + } + + + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoCreateVfModule") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateVfModule") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateVfModule") + when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateVfModule") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + + private static void mockData() { + stubFor(get(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf/12345[?]depth=1")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModule/getGenericVnfResponse.xml"))) + stubFor(get(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf/12345/vf-modules/vf-module[?]vf-module-name=module-0")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModule/getGenericVnfResponse.xml"))) + stubFor(get(urlMatching(".*/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/12345")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModule/cloudRegion_AAIResponse_Success.xml"))) + stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml"))) + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy new file mode 100644 index 0000000000..91e7086bd3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy @@ -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.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.MsoGroovyTest + +import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertNotNull +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when + + +@RunWith(MockitoJUnitRunner.class) +class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest { + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + def String volumeRollbackRequest = """ + + + 171907d6-cdf0-4e08-953d-81ee104005a7 + {{VOLUMEGROUPSTACKID}} + c2141e3fcae940fcb4797ec9115e5a7a + mtwnj1a + true + + 230fd6ac-2a39-4be4-9b1e-7b7e1cc039b5 + 88c871d6-be09-4982-8490-96b1d243fb34 + + 9a5a91e8-3b79-463c-81c3-874a78f5b567 + + true + http://localhost:8080/mso/WorkflowMessage/VNFAResponse/9a5a91e8-3b79-463c-81c3-874a78f5b567 + + """ + + def String volumeRollbackRequestWithStackId = """ + + + 171907d6-cdf0-4e08-953d-81ee104005a7 + mdt22avrr_volume01/0f1aaae8-efe3-45ce-83e1-bfad01db58d8 + c2141e3fcae940fcb4797ec9115e5a7a + mtwnj1a + true + + 230fd6ac-2a39-4be4-9b1e-7b7e1cc039b5 + 88c871d6-be09-4982-8490-96b1d243fb34 + + 9a5a91e8-3b79-463c-81c3-874a78f5b567 + + true + http://localhost:8080/mso/WorkflowMessage/VNFAResponse/9a5a91e8-3b79-463c-81c3-874a78f5b567 + + """ + + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + public void testBuildRollbackVolumeGroupRequestXml() { + DoCreateVfModuleVolumeV2 process = new DoCreateVfModuleVolumeV2() + String xml = process.buildRollbackVolumeGroupRequestXml( + "171907d6-cdf0-4e08-953d-81ee104005a7", // volumeGroupId + "mtwnj1a", // cloudSiteId + "c2141e3fcae940fcb4797ec9115e5a7a", // tenantId + "230fd6ac-2a39-4be4-9b1e-7b7e1cc039b5", // requestId + "88c871d6-be09-4982-8490-96b1d243fb34", // serviceInstanceId + "9a5a91e8-3b79-463c-81c3-874a78f5b567", // messageId + "http://localhost:8080/mso/WorkflowMessage/VNFAResponse/9a5a91e8-3b79-463c-81c3-874a78f5b567") // notificationUrl + + assertEquals(volumeRollbackRequest.replaceAll("\\s", ""), xml.replaceAll("\\s", "")) + } + + + @Test + public void testUpdateRollbackVolumeGroupRequestXml() { + DoCreateVfModuleVolumeV2 process = new DoCreateVfModuleVolumeV2() + String updatedXml = process.updateRollbackVolumeGroupRequestXml(volumeRollbackRequest, "mdt22avrr_volume01/0f1aaae8-efe3-45ce-83e1-bfad01db58d8") + assertEquals(volumeRollbackRequestWithStackId.replaceAll("\\s", ""), updatedXml.replaceAll("\\s", "")) + } + + @Test + public void testPrepareVnfAdapterCreateRequest (){ + ExecutionEntity mockExecution = setupMock('DoCreateVfModuleVolumeV2') + + when(mockExecution.getVariable("prefix")).thenReturn('DCVFMODVOLV2_') + when(mockExecution.getVariable("serviceInstanceId")).thenReturn('') + when(mockExecution.getVariable("vnfId")).thenReturn('test-vnf-id') + when(mockExecution.getVariable("mso-request-id")).thenReturn('1234') + when(mockExecution.getVariable("volumeGroupId")).thenReturn('1234') + when(mockExecution.getVariable("mso.use.qualified.host")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.message.endpoint")).thenReturn("http://localhost:28080/mso/WorkflowMesssage") + Map vfModuleInputParams = new HashMap() + vfModuleInputParams.put("param1","value1") + when(mockExecution.getVariable("vfModuleInputParams")).thenReturn(vfModuleInputParams) + DoCreateVfModuleVolumeV2 process = new DoCreateVfModuleVolumeV2() + process.prepareVnfAdapterCreateRequest(mockExecution,"true"); + Mockito.verify(mockExecution,times(2)).setVariable(captor.capture(), captor.capture()) + String DCVFMODVOLV2_createVnfARequest = captor.getValue(); + assertNotNull(DCVFMODVOLV2_createVnfARequest) + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfTest.groovy new file mode 100644 index 0000000000..9b421d8b63 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfTest.groovy @@ -0,0 +1,106 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.VnfResource + +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +class DoCreateVnfTest { + def prefix = "DoCVNF_" + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + void testPreProcessRequest() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("msoRequestId")).thenReturn("12345") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("MIS/1604/0026/SW_INTERNET") + when(mockExecution.getVariable("vnfType")).thenReturn("vRRaas") + when(mockExecution.getVariable("vnfName")).thenReturn("skask-test") + + when(mockExecution.getVariable("productFamilyId")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("MDTWNJ21") + + when(mockExecution.getVariable("vnfResourceDecomposition")).thenReturn(new VnfResource()) + when(mockExecution.getVariable("mso-request-id")).thenReturn("testRequestId-1503410089303") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:28080/mso/SDNCAdapterCallbackService") + + + + DoCreateVnf obj = new DoCreateVnf() + obj.preProcessRequest(mockExecution) + + Mockito.verify(mockExecution, times(31)).setVariable(captor.capture(), captor.capture()) + List list = captor.getAllValues() + String str = list.get(51) + Assert.assertEquals("http://localhost:28080/mso/SDNCAdapterCallbackService", str) + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoCreateVnf") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateVnf") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateVnf") + when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateVnf") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy new file mode 100644 index 0000000000..bbbb82b5aa --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy @@ -0,0 +1,169 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.mockito.MockitoAnnotations +import org.onap.so.bpmn.infrastructure.scripts.DoCustomDeleteE2EServiceInstance +import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.bpmn.vcpe.scripts.GroovyTestBase + +import static org.assertj.core.api.Assertions.assertThatThrownBy +import static org.mockito.Matchers.anyString +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.when +import static org.mockito.Mockito.eq + +class DoCustomDeleteE2EServiceInstanceTest extends GroovyTestBase { + + private static String request + + @Rule + public WireMockRule wireMockRule = new WireMockRule(GroovyTestBase.PORT) + + String Prefix = "CVRCS_" + String RbType = "DCRENI_" + + @BeforeClass + public static void setUpBeforeClass() { + request = FileUtil.readResourceFile("__files/InfrastructureFlows/DeleteCustomE2EService.json") + } + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + public DoCustomDeleteE2EServiceInstanceTest(){ + super("DoCustomDeleteE2EServiceInstance") + } + + @Test + public void preProcessRequestTest(){ + + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + + DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() + instance.preProcessRequest(mex) + verify(mex).setVariable("sdncCallbackUrl", "/mso/sdncadapter/") + verify(mex).setVariable("siParamsXml", "") + } + + @Test + public void postProcessAAIGETSuccessTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + when(mex.getVariable("GENGS_SuccessIndicator")).thenReturn(true) + + String aaiGetResponse = FileUtil.readResourceFile("__files/GenericFlows/aaiGetResponse.xml") + when(mex.getVariable("GENGS_service")).thenReturn(aaiGetResponse) + DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() + instance.postProcessAAIGET(mex) + + verify(mex).setVariable(eq("serviceRelationShip"), anyString()) + } + + @Test + public void postProcessAAIGETFailureTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + when(mex.getVariable("GENGS_FoundIndicator")).thenReturn(false) + when(mex.getVariable("GENGS_SuccessIndicator")).thenReturn(false) + + DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() + assertThatThrownBy { instance.postProcessAAIGET(mex) } isInstanceOf BpmnError.class + } + + @Test + public void preInitResourcesOperStatusTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + when(mex.getVariable("serviceRelationShip")).thenReturn("[{\"resourceInstanceId\":\"3333\",\"resourceType\":\"overlay\"},{\"resourceInstanceId\":\"4444\",\"resourceType\":\"underlay\"},{\"resourceInstanceId\":\"1111\",\"resourceType\":\"vIMS\"},{\"resourceInstanceId\":\"222\",\"resourceType\":\"vEPC\"}]") + DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() + instance.preInitResourcesOperStatus(mex) + + verify(mex).setVariable(eq("CVFMI_initResOperStatusRequest"), anyString()) + } + + @Test + public void preResourceDeleteTest() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + when(mex.getVariable("serviceRelationShip")).thenReturn("[{\"resourceInstanceId\":\"3333\",\"resourceType\":\"overlay\"},{\"resourceInstanceId\":\"4444\",\"resourceType\":\"underlay\"},{\"resourceInstanceId\":\"1111\",\"resourceType\":\"vIMS\"},{\"resourceInstanceId\":\"222\",\"resourceType\":\"vEPC\"}]") + DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() + instance.preResourceDelete(mex,"overlay") + verify(mex).setVariable("resourceType", "overlay") + } + + @Test + public void postProcessSDNCDeleteTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn("true") + when(mex.getVariable("DDELSI_sdncResponseSuccess")).thenReturn("true") + when(mex.getVariable("prefix")).thenReturn("DDELSI_") + DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() + String response = FileUtil.readResourceFile("__files/GenericFlows/SDNCDeleteResponse.xml") + String method = "deleteE2E"; + instance.postProcessSDNCDelete(mex, response, method) + // following method doesn't do anything currently -> nothing to check + } + + @Test + public void postProcessAAIDELTest() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + when(mex.getVariable("GENDS_SuccessIndicator")).thenReturn("true") + DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() + instance.postProcessAAIDEL(mex) + } + + private void initPreProcess(ExecutionEntity mex) { + when(mex.getVariable(GroovyTestBase.DBGFLAG)).thenReturn("true") + when(mex.getVariable("bpmnRequest")).thenReturn(request) + when(mex.getVariable("mso-request-id")).thenReturn("mri") + when(mex.getVariable("serviceType")).thenReturn("VoLTE") + when(mex.getVariable("serviceInstanceId")).thenReturn("e151059a-d924-4629-845f-264db19e50b4") + when(mex.getVariable("requestAction")).thenReturn("ra") + when(mex.getVariable("operationId")).thenReturn("59960003992") + when(mex.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("/mso/sdncadapter/") + when(mex.getVariable("GENGS_FoundIndicator")).thenReturn("true") + when(mex.getVariable("GENGS_siResourceLink")).thenReturn("/service-subscription/e2eserviceInstance/delete/service-instances/") + when(mex.getVariable("globalSubscriberId")).thenReturn("4993921112123") + when(mex.getVariable("GENGS_service")).thenReturn("test3434") + when(mex.getVariable("mso.adapters.openecomp.db.endpoint")).thenReturn("http://localhost:8080/mso") + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollbackTest.groovy new file mode 100644 index 0000000000..5e264c0af4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollbackTest.groovy @@ -0,0 +1,343 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + + +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.junit.Before +import org.junit.Rule; +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith + +import static org.junit.Assert.*; + +import com.github.tomakehurst.wiremock.client.WireMock; +import com.github.tomakehurst.wiremock.junit.WireMockRule; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.apache.commons.lang3.* + + +@RunWith(MockitoJUnitRunner.class) +class DoDeleteNetworkInstanceRollbackTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + def utils = new MsoUtils() + String Prefix="DELNWKIR_" + + + String rollbackNetworkRequest = + """ + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + CONTRAIL_EXTERNAL + true + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + +""" + + String rollbackDeActivateSDNCRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + activate + network-topology-operation + sdncCallback + generic-resource + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + CreateNetworkInstance + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + MSO_1610_dev + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + + invariant-uuid + customization-uuid + uuid + version + CONTRAIL_EXTERNAL + + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + + String rollbackSDNCRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + rollback + network-topology-operation + sdncCallback + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + CreateNetworkInstance + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + MSO_1610_dev + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + + invariant-uuid + customization-uuid + uuid + version + CONTRAIL_EXTERNAL + + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + +// - - - - - - - - + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + public void initializeVariables (DelegateExecution mockExecution) { + + verify(mockExecution).setVariable(Prefix + "WorkflowException", null) + + verify(mockExecution).setVariable(Prefix + "rollbackDeactivateSDNCRequest", null) + verify(mockExecution).setVariable(Prefix + "rollbackDeactivateSDNCResponse", "") + verify(mockExecution).setVariable(Prefix + "rollbackDeactivateSDNCReturnCode", "") + + verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", null) + verify(mockExecution).setVariable(Prefix + "rollbackNetworkResponse", "") + verify(mockExecution).setVariable(Prefix + "rollbackNetworkReturnCode", "") + + verify(mockExecution).setVariable(Prefix + "Success", false) + verify(mockExecution).setVariable(Prefix + "fullRollback", false) + + } + + @Test + //@Ignore + public void preProcessRequest() { + + println "************ preProcessRequest ************* " + + WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") + Map rollbackData = new HashMap(); + rollbackData.put("rollbackDeactivateSDNCRequest", rollbackDeActivateSDNCRequest) + rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) + rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + when(mockExecution.getVariable("rollbackData")).thenReturn(rollbackData) + when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") + + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.sdnc.endpoint")).thenReturn("http://localhost:8090/SDNCAdapter") + when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter") + when(mockExecution.getVariable("mso.adapters.sdnc.resource.endpoint")).thenReturn("http://localhost:8090/SDNCAdapterRpc") + + + // preProcessRequest(DelegateExecution execution) + DoDeleteNetworkInstanceRollback DoDeleteNetworkInstanceRollback = new DoDeleteNetworkInstanceRollback() + DoDeleteNetworkInstanceRollback.preProcessRequest(mockExecution) + + //verify variable initialization + initializeVariables(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + } + + + @Test + //@Ignore + public void validateRollbackResponses_Good() { + + WorkflowException workflowException = new WorkflowException("DoDeleteNetworkInstanceRollback", 2500, "AAI Update Contrail Failed. Error 404.") + WorkflowException expectedWorkflowException = new WorkflowException("DoDeleteNetworkInstanceRollback", 2500, "AAI Update Contrail Failed. Error 404. + SNDC deactivate rollback completed. + PO Network rollback completed. + SNDC unassign rollback completed.") + + println "************ validateRollbackResponses_Good() ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + + when(mockExecution.getVariable(Prefix + "rollbackDeactivateSDNCRequest")).thenReturn("Good") + when(mockExecution.getVariable(Prefix + "rollbackDeactivateSDNCReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "rollbackDeactivateSDNCResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn("Good") + when(mockExecution.getVariable(Prefix + "rollbackNetworkReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "rollbackNetworkResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn("Good") + when(mockExecution.getVariable(Prefix + "rollbackSDNCReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "rollbackSDNCResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable(Prefix + "WorkflowException")).thenReturn(workflowException) + when(mockExecution.getVariable(Prefix + "fullRollback")).thenReturn(false) + + DoDeleteNetworkInstanceRollback DoDeleteNetworkInstanceRollback = new DoDeleteNetworkInstanceRollback() + DoDeleteNetworkInstanceRollback.validateRollbackResponses(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution, atLeast(1)).setVariable("rolledBack", true) + verify(mockExecution, atLeast(1)).setVariable("wasDeleted", true) + verify(mockExecution).setVariable("WorkflowException", refEq(expectedWorkflowException, any(WorkflowException.class))) + //verify(mockExecution).setVariable("WorkflowException", expectedWorkflowException) + } + + @Test + //@Ignore + public void validateRollbackResponses_FullRollback() { + + Map rollbackData = new HashMap(); + rollbackData.put("rollbackDeactivateSDNCRequest", rollbackDeActivateSDNCRequest) + rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) + rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) + + println "************ validateRollbackResponses_FullRollback() ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + + when(mockExecution.getVariable(Prefix + "rollbackDeactivateSDNCRequest")).thenReturn("Good") + when(mockExecution.getVariable(Prefix + "rollbackDeactivateSDNCReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "rollbackDeactivateSDNCResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn("Good") + when(mockExecution.getVariable(Prefix + "rollbackNetworkReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "rollbackNetworkResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn("Good") + when(mockExecution.getVariable(Prefix + "rollbackSDNCReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "rollbackSDNCResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable(Prefix + "WorkflowException")).thenReturn(null) + when(mockExecution.getVariable(Prefix + "fullRollback")).thenReturn(true) + when(mockExecution.getVariable("rollbackData")).thenReturn(rollbackData) + + DoDeleteNetworkInstanceRollback DoDeleteNetworkInstanceRollback = new DoDeleteNetworkInstanceRollback() + DoDeleteNetworkInstanceRollback.validateRollbackResponses(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution, atLeast(1)).setVariable("rollbackSuccessful", true) + verify(mockExecution, atLeast(1)).setVariable("rollbackError", false) + + } + + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoDeleteNetworkInstanceRollback") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoDeleteNetworkInstanceRollback") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoDeleteNetworkInstanceRollback") + when(mockExecution.getProcessInstanceId()).thenReturn("DoDeleteNetworkInstanceRollback") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy new file mode 100644 index 0000000000..1a2d16d9d0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy @@ -0,0 +1,1948 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + + +import static org.mockito.Mockito.* + +import static org.onap.so.bpmn.mock.StubResponseNetworkAdapter.MockNetworkAdapter; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkByIdWithDepth; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion_404; +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException + +import com.github.tomakehurst.wiremock.client.WireMock +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.apache.commons.lang3.* + + +@RunWith(MockitoJUnitRunner.class) +class DoDeleteNetworkInstanceTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + def utils = new MsoUtils() + String Prefix="DELNWKI_" + + String incomingJsonRequest = + """{ "requestDetails": { + "modelInfo": { + "modelType": "network", + "modelCustomizationId": "f21df226-8093-48c3-be7e-0408fcda0422", + "modelName": "CONTRAIL_EXTERNAL", + "modelVersion": "1.0" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "RDM2WAGPLCP", + "tenantId": "7dd5365547234ee8937416c65507d266" + }, + "requestInfo": { + "instanceName": "HSL_direct_net_2", + "source": "VID", + "callbackUrl": "", + "suppressRollback": true, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", + "modelInfo": { + "modelType": "serviceT", + "modelId": "modelI", + "modelNameVersionId": "modelNameVersionI", + "modelName": "modleNam", + "modelVersion": "1" + } + } + } + ], + "requestParameters": { + "userParams": [] + } + }""" + + String expectedDoDeleteNetworkInstanceRequest = + """{ "requestDetails": { + "modelInfo": { + "modelType": "networkTyp", + "modelId": "modelId", + "modelNameVersionId": "modelNameVersionId", + "modelName": "CONTRAIL_EXTERNAL", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "RDM2WAGPLCP", + "tenantId": "7dd5365547234ee8937416c65507d266" + }, + "requestInfo": { + "instanceName": "HSL_direct_net_2", + "source": "VID", + "callbackUrl": "", + "suppressRollback": true, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", + "modelInfo": { + "modelType": "serviceT", + "modelId": "modelI", + "modelNameVersionId": "modelNameVersionI", + "modelName": "modleNam", + "modelVersion": "1" + } + } + } + ], + "requestParameters": { + "userParams": [] + } + }""" + + // expectedVnfRequest + String expectedNetworkRequest = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + DELETE + VID + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_EXTERNAL + f21df226-8093-48c3-be7e-0408fcda0422 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + 1610 + + +""" + + String expectedVperNetworkRequest = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + DELETE + VID + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + MSO-dev-service-type + globalId_45678905678 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + false + + CONTRAIL_EXTERNAL + sn5256d1-5a33-55df-13ab-12abad84e111 + sn5256d1-5a33-55df-13ab-12abad84e764 + 1 + sn5256d1-5a33-55df-13ab-12abad84e222 + + + + + + + + + 1702 + + +""" + + String expected_networkInput = + """ + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_EXTERNAL + f21df226-8093-48c3-be7e-0408fcda0422 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + 1610 +""" + + String expectedVper_networkInput = +""" + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + MSO-dev-service-type + globalId_45678905678 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + false + + CONTRAIL_EXTERNAL + sn5256d1-5a33-55df-13ab-12abad84e111 + sn5256d1-5a33-55df-13ab-12abad84e764 + 1 + sn5256d1-5a33-55df-13ab-12abad84e222 + + + + + + + + + 1702 +""" + +// emptyRegionVnfRequest +String emptyRegionVnfRequest = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + DELETE + PORTAL + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_BASIC + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + e81d842d3e8b45c5a59f57cd76af3aaf + + + 0 + +""" + +String vnfRequestCloudRegionNotFound = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + DELETE + PORTAL + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_BASIC + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MDTWNJ21 + e81d842d3e8b45c5a59f57cd76af3aaf + + + 0 + +""" + + String vnfPayload = + """ + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + DELETE + PORTAL + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_BASIC + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + e81d842d3e8b45c5a59f57cd76af3aaf + + + 0 + + +""" + + String vnfPayload_MissingId = +""" + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + DELETE + PORTAL + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + + CONTRAIL_BASIC + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + e81d842d3e8b45c5a59f57cd76af3aaf + + + 0 + + +""" + + String vnfRequestRESTPayload = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + DELETE + PORTAL + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_BASIC + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + e81d842d3e8b45c5a59f57cd76af3aaf + + + id + name + + + 0 + + """ + + +String incomingRequestMissingCloudRegion = +"""{ "requestDetails": { + "modelInfo": { + "modelType": "network", + "modelCustomizationId": "f21df226-8093-48c3-be7e-0408fcda0422", + "modelName": "CONTRAIL_EXTERNAL", + "modelVersion": "1.0" + }, + "cloudConfiguration": { + "tenantId": "7dd5365547234ee8937416c65507d266" + }, + "requestInfo": { + "instanceName": "HSL_direct_net_2", + "source": "VID", + "callbackUrl": "", + "suppressRollback": true, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", + "modelInfo": { + "modelType": "serviceT", + "modelId": "modelI", + "modelNameVersionId": "modelNameVersionI", + "modelName": "modleNam", + "modelVersion": "1" + } + } + } + ], + "requestParameters": { + "userParams": [] + } + }""" + + String expectedNetworkRequestMissingId = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + DELETE + VID + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + + + HSL_direct_net_2 + CONTRAIL_EXTERNAL + f21df226-8093-48c3-be7e-0408fcda0422 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + 1610 + + +""" + +String expectedNetworkRequestMissingCloudRegion = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + DELETE + VID + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_EXTERNAL + f21df226-8093-48c3-be7e-0408fcda0422 + null + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + 1610 + + +""" + + // vnfRESTRequest + String vnfRESTRequest = +""" + + + + DELETE + VID + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_EXTERNAL + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + true + + + + + + +""" + + String networkInputs = + """ + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_BASIC + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + e81d842d3e8b45c5a59f57cd76af3aaf +""" + +String networkInputsNoType = +""" + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + e81d842d3e8b45c5a59f57cd76af3aaf +""" + + String networkInputsMissingId = + """ + + HSL_direct_net_2 + CONTRAIL_EXTERNAL + f21df226-8093-48c3-be7e-0408fcda0422 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + 1610 +""" + +String networkInputsMissingCloudRegion = +""" + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_EXTERNAL + f21df226-8093-48c3-be7e-0408fcda0422 + null + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + 1610 +""" + + String MissingIdFault = "Invalid value or missing network-id element" + String MissingRegionFault = "Invalid value or missing 'aic-cloud-region' element" + + String invalidWorkflowException = """ + Invalid value of network-id element + 2500 + """ + + + String queryAAIResponse = + """ + + + + + + + + + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_BASIC + HSL_direct + contrail + 8bbd3edf-b835-4610-96a2-a5cafa029042 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + active + HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 + + + ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a + 5a77fdc2-7789-4649-a1b9-6eaf1db1813a + 172.16.34.1 + 172.16.34.0 + 28 + 4 + active + true + + + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v3/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ + + tenant.tenant-id + e81d842d3e8b45c5a59f57cd76af3aaf + + + + + +""" + + String deleteNetworkRequest = + """ + + + + RDM2WAGPLCP + e81d842d3e8b45c5a59f57cd76af3aaf + CONTRAIL_BASIC + HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + 0 + + + +""" + +String deleteNetworkRESTRequest = +""" + RDM2WAGPLCP + e81d842d3e8b45c5a59f57cd76af3aaf + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 + CONTRAIL_BASIC + sn5256d1-5a33-55df-13ab-12abad84e222 + true + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + messageId_value + +""" + +String deleteNetworkRESTRequestAlaCarte = +""" + RDM2WAGPLCP + e81d842d3e8b45c5a59f57cd76af3aaf + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 + CONTRAIL_BASIC + f21df226-8093-48c3-be7e-0408fcda0422 + true + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + messageId_value + +""" + + String deleteNetworkResponse_noRollback = +""" + true + +""" + + String deleteNetworkResponse = + """ + true + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + CONTRAIL_EXTERNAL + true + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + + """ + + String deleteRollbackNetworkRequest = + """ + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + CONTRAIL_EXTERNAL + true + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + +""" + + String deleteNetworkResponseFalseCompletion = + """ + false + """ + + String deleteNetworkErrorResponse = + """ + +680bd458-5ec1-4a16-b77c-509022e53450INTERNAL +400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data +true + +""" + + String deleteNetworkWorkflowException = + """ + Received error from Network Adapter: 400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data + 7020 + """ + +String aaiWorkflowException = +""" + Bpmn error encountered in DoDeleteNetworkInstance flow. Unexpected Response from AAI Adapter - org.apache.http.conn.HttpHostConnectException: Connect to localhost:8090 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect + 2500 + """ + + String aaiResponse = + """ + + + + + + + + + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_BASIC + HSL_direct + contrail + 8bbd3edf-b835-4610-96a2-a5cafa029042 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + active + HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 + + + ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a + 5a77fdc2-7789-4649-a1b9-6eaf1db1813a + 172.16.34.1 + 172.16.34.0 + 28 + 4 + active + true + + + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ + + tenant.tenant-id + e81d842d3e8b45c5a59f57cd76af3aaf + + + + cloud-region + cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP/ + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + RDM2WAGPLCP + + + + + +""" + +String aaiResponseWithRelationship = +""" + + + + + + + + + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_BASIC + HSL_direct + contrail + 8bbd3edf-b835-4610-96a2-a5cafa029042 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + active + HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 + + + ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a + 5a77fdc2-7789-4649-a1b9-6eaf1db1813a + 172.16.34.1 + 172.16.34.0 + 28 + 4 + active + true + + + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ + + tenant.tenant-id + e81d842d3e8b45c5a59f57cd76af3aaf + + + + vf-module + https://aai-app-e2e.ecomp.cci.com:8443/aai/v8/network/generic-vnfs/generic-vnf/105df7e5-0b3b-49f7-a837-4864b62827c4/vf-modules/vf-module/d9217058-95a0-49ee-b9a9-949259e89349/ + + generic-vnf.vnf-id + 105df7e5-0b3b-49f7-a837-4864b62827c4 + + + vf-module.vf-module-id + d9217058-95a0-49ee-b9a9-949259e89349 + + + + generic-vnf + https://aai-app-e2e.test.com:8443/aai/v8/network/generic-vnfs/generic-vnf/45f822d9-73ca-4255-9844-7cef401bbf47/ + + generic-vnf.vnf-id + 45f822d9-73ca-4255-9844-7cef401bbf47 + + + generic-vnf.vnf-name + zrdm1scpx05 + + + + + +""" + + String deleteSDNCRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + delete + network-topology-operation + sdncCallback + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + DisconnectNetworkRequest + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + CONTRAIL_BASIC + HSL_direct_net_2 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + + String deleteRpcSDNCRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + unassign + network-topology-operation + sdncCallback + generic-resource + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + DeleteNetworkInstance + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + + fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 + 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 + 1.0 + HNGW Protected OAM + + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + globalId_45678905678 + + + + networkId + CONTRAIL_EXTERNAL + + sn5256d1-5a33-55df-13ab-12abad84e764 + sn5256d1-5a33-55df-13ab-12abad84e222 + sn5256d1-5a33-55df-13ab-12abad84e111 + 1 + CONTRAIL_EXTERNAL + + + + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + + + +""" + + String sdncAdapaterDeactivateRollback = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + activate + network-topology-operation + sdncCallback + generic-resource + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + CreateNetworkInstance + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + + fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 + 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 + 1.0 + HNGW Protected OAM + + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + globalId_45678905678 + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + CONTRAIL_EXTERNAL + + sn5256d1-5a33-55df-13ab-12abad84e764 + sn5256d1-5a33-55df-13ab-12abad84e222 + sn5256d1-5a33-55df-13ab-12abad84e111 + 1 + CONTRAIL_EXTERNAL + + + + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + + + +""" + String sdncAdapterWorkflowResponse = + """ + + + 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + """ + + String sdncAdapterWorkflowResponse_404 = + """ + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>00703dc8-71ff-442d-a4a8-3adc5beef6a9</svc-request-id><response-code>404</response-code><response-message>Service instance not found in config tree</response-message><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>MNS-25180-L-01-dmz_direct_net_1</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> +""" + + String expected_sdncAdapterWorkflowFormattedResponse_404 = +""" + + + 00703dc8-71ff-442d-a4a8-3adc5beef6a9 + 404 + Service instance not found in config tree + Y + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MNS-25180-L-01-dmz_direct_net_1 + notsurewecare + + + +""" + + String sdncAdapterWorkflowFormattedResponse = + """ + + + 19174929-3809-49ca-89eb-17f84a035389 + 200 + Y + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + HSL_direct_net_2 + notsurewecare + + + +""" + +String sdncAdapterWorkflowFormattedResponse_404 = +""" + + + 00703dc8-71ff-442d-a4a8-3adc5beef6a9 + 404 + Service instance not found in config tree + Y + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MNS-25180-L-01-dmz_direct_net_1 + notsurewecare + + + +""" + + String invalidRequest = "Invalid value of network-id element" + + + + String sndcWorkflowException = + """ + Received error from SDN-C: No availability zone available + 5300 + 200 +""" + + String sndcWorkflowErrorResponse = + """ + Received error from SDN-C: + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>00703dc8-71ff-442d-a4a8-3adc5beef6a9</svc-request-id><response-code>404</response-code><response-message>Service instance not found in config tree</response-message><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>MNS-25180-L-01-dmz_direct_net_1</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + 5300 + """ + + String unexpectedErrorEncountered = + """ + bpel error deleting network + 5300 + """ + + + // expectedVnfRequest + String inputViprSDC_NetworkRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + DELETE + VID + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + + networkId + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + MSO-dev-service-type + globalId_45678905678 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + false + + CONTRAIL_EXTERNAL + sn5256d1-5a33-55df-13ab-12abad84e111 + sn5256d1-5a33-55df-13ab-12abad84e764 + 1 + sn5256d1-5a33-55df-13ab-12abad84e222 + CONTRAIL_EXTERNAL + + + HNGW Protected OAM + 36a3a8ea-49a6-4ac8-b06c-89a54544b9b6 + fcc85cb0-ad74-45d7-a5a1-17c8744fdb71 + 1.0 + + service + + 1702 + + +""" +// - - - - - - - - + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + //@Ignore + public void preProcessRequest_Json() { + + println "************ preProcessRequest_Payload ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) + when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) + when(mockExecution.getVariable("requestAction")).thenReturn("DELETE") + when(mockExecution.getVariable("networkId")).thenReturn("bdc5efe8-404a-409b-85f6-0dcc9eebae30") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("vnfId")).thenReturn("") + when(mockExecution.getVariable("volumeGroupId")).thenReturn("") + //when(mockExecution.getVariable("networkId")).thenReturn("") + when(mockExecution.getVariable("serviceType")).thenReturn("MOG") + when(mockExecution.getVariable("networkType")).thenReturn("modelName") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(incomingJsonRequest) + when(mockExecution.getVariable("disableRollback")).thenReturn(true) + when(mockExecution.getVariable("testMessageId")).thenReturn("7df689f9-7b93-430b-9b9e-28140d70cc7ad") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso-service-instance-id")).thenReturn("FH/VLXM/003717//SW_INTERNET") + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") + + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.preProcessRequest(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + //verify variable initialization + initializeVariables(mockExecution) + + verify(mockExecution).setVariable("action", "DELETE") + verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequest) + + verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) + + verify(mockExecution).setVariable(Prefix + "networkInputs", expected_networkInput) + verify(mockExecution).setVariable(Prefix + "messageId", "7df689f9-7b93-430b-9b9e-28140d70cc7ad") + verify(mockExecution).setVariable(Prefix + "source", "VID") + + // Authentications + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") + + + } + + @Test + //@Ignore + public void preProcessRequest_vPER() { + + def networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111", + "modelName": "CONTRAIL_EXTERNAL", + "modelType": "CONTRAIL_EXTERNAL", + "modelVersion": "1", + "modelCustomizationUuid": "sn5256d1-5a33-55df-13ab-12abad84e222", + "modelInvariantUuid": "sn5256d1-5a33-55df-13ab-12abad84e764" + }""".trim() + + println "************ preProcessRequest_Payload ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + // Inputs: + when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("disableRollback")).thenReturn("true") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("networkId")).thenReturn("bdc5efe8-404a-409b-85f6-0dcc9eebae30") // optional + when(mockExecution.getVariable("networkName")).thenReturn("MNS-25180-L-01-dmz_direct_net_1") // optional + when(mockExecution.getVariable("productFamilyId")).thenReturn("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + when(mockExecution.getVariable("networkModelInfo")).thenReturn("CONTRAIL_EXTERNAL") + when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable("tenantId")).thenReturn("7dd5365547234ee8937416c65507d266") + when(mockExecution.getVariable("failIfExists")).thenReturn("false") + when(mockExecution.getVariable("networkModelInfo")).thenReturn(networkModelInfo) + when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") + when(mockExecution.getVariable("action")).thenReturn("DELETE") + when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("MSO-dev-service-type") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("globalId_45678905678") + when(mockExecution.getVariable("testMessageId")).thenReturn("7df689f9-7b93-430b-9b9e-28140d70cc7ad") + + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.preProcessRequest(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + //verify variable initialization + initializeVariables(mockExecution) + + verify(mockExecution).setVariable("action", "DELETE") + verify(mockExecution).setVariable(Prefix + "networkRequest", expectedVperNetworkRequest) + + verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) + + verify(mockExecution).setVariable(Prefix + "networkInputs", expectedVper_networkInput) + verify(mockExecution).setVariable(Prefix + "messageId", "7df689f9-7b93-430b-9b9e-28140d70cc7ad") + verify(mockExecution).setVariable(Prefix + "source", "VID") + + // Authentications + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") + + + } + + public void initializeVariables (DelegateExecution mockExecution) { + + verify(mockExecution).setVariable(Prefix + "networkRequest", "") + verify(mockExecution).setVariable(Prefix + "isSilentSuccess", false) + verify(mockExecution).setVariable(Prefix + "Success", false) + + verify(mockExecution).setVariable(Prefix + "requestId", "") + verify(mockExecution).setVariable(Prefix + "source", "") + verify(mockExecution).setVariable(Prefix + "lcpCloudRegion", "") + verify(mockExecution).setVariable(Prefix + "networkInputs", "") + verify(mockExecution).setVariable(Prefix + "tenantId", "") + + verify(mockExecution).setVariable(Prefix + "queryAAIRequest","") + verify(mockExecution).setVariable(Prefix + "queryAAIResponse", "") + verify(mockExecution).setVariable(Prefix + "aaiReturnCode", "") + verify(mockExecution).setVariable(Prefix + "isAAIGood", false) + verify(mockExecution).setVariable(Prefix + "isVfRelationshipExist", false) + + // AAI query Cloud Region + verify(mockExecution).setVariable(Prefix + "queryCloudRegionRequest","") + verify(mockExecution).setVariable(Prefix + "queryCloudRegionReturnCode","") + verify(mockExecution).setVariable(Prefix + "queryCloudRegionResponse","") + verify(mockExecution).setVariable(Prefix + "cloudRegionPo","") + verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc","") + + verify(mockExecution).setVariable(Prefix + "deleteNetworkRequest", "") + verify(mockExecution).setVariable(Prefix + "deleteNetworkResponse", "") + verify(mockExecution).setVariable(Prefix + "networkReturnCode", "") + verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", "") + + verify(mockExecution).setVariable(Prefix + "deleteSDNCRequest", "") + verify(mockExecution).setVariable(Prefix + "deleteSDNCResponse", "") + verify(mockExecution).setVariable(Prefix + "sdncReturnCode", "") + verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false) + + verify(mockExecution).setVariable(Prefix + "deactivateSDNCRequest", "") + verify(mockExecution).setVariable(Prefix + "deactivateSDNCResponse", "") + verify(mockExecution).setVariable(Prefix + "deactivateSdncReturnCode", "") + verify(mockExecution).setVariable(Prefix + "isSdncDeactivateRollbackNeeded", "") + + verify(mockExecution).setVariable(Prefix + "rollbackDeactivateSDNCRequest", "") + verify(mockExecution).setVariable(Prefix + "isException", false) + + } + + @Test + //@Ignore + public void preProcessRequest_Json_MissingId() { + + println "************ preProcessRequest_MissingId() ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) + when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) + when(mockExecution.getVariable("requestAction")).thenReturn("DELETE") + //when(mockExecution.getVariable("networkId")).thenReturn("") // missing Id + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("vnfId")).thenReturn("") + when(mockExecution.getVariable("volumeGroupId")).thenReturn("") + //when(mockExecution.getVariable("networkId")).thenReturn("") + when(mockExecution.getVariable("serviceType")).thenReturn("MOG") + when(mockExecution.getVariable("networkType")).thenReturn("modelName") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(incomingJsonRequest) + when(mockExecution.getVariable("disableRollback")).thenReturn(true) + + when(mockExecution.getVariable("testMessageId")).thenReturn("7df689f9-7b93-430b-9b9e-28140d70cc7ad") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso-service-instance-id")).thenReturn("FH/VLXM/003717//SW_INTERNET") + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") + + // preProcessRequest(DelegateExecution execution) + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + try { + DoDeleteNetworkInstance.preProcessRequest(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + //verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + //verify variable initialization + initializeVariables(mockExecution) + + verify(mockExecution).setVariable("action", "DELETE") + verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequestMissingId) + verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) + + verify(mockExecution).setVariable(Prefix + "networkInputs", networkInputsMissingId) + verify(mockExecution).setVariable(Prefix + "messageId", "7df689f9-7b93-430b-9b9e-28140d70cc7ad") + verify(mockExecution).setVariable(Prefix + "source", "VID") + + } + + @Test + //@Ignore + public void preProcessRequest_Json_MissingCloudRegion() { + + def networkModelInfo = """{"modelVersionId": "sn5256d1-5a33-55df-13ab-12abad84e111", + "modelName": "CONTRAIL_EXTERNAL", + "modelType": "CONTRAIL_EXTERNAL", + "modelVersion": "1", + "modelCustomizationId": "sn5256d1-5a33-55df-13ab-12abad84e222", + "modelInvariantId": "sn5256d1-5a33-55df-13ab-12abad84e764" + }""".trim() + + println "************ preProcessRequest_MissingCloudRegion() ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("networkModelInfo")).thenReturn(networkModelInfo) + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) + when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) + when(mockExecution.getVariable("requestAction")).thenReturn("DELETE") + when(mockExecution.getVariable("networkId")).thenReturn("bdc5efe8-404a-409b-85f6-0dcc9eebae30") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("vnfId")).thenReturn("") + when(mockExecution.getVariable("volumeGroupId")).thenReturn("") + //when(mockExecution.getVariable("networkId")).thenReturn("") + when(mockExecution.getVariable("serviceType")).thenReturn("MOG") + when(mockExecution.getVariable("networkType")).thenReturn("modelName") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(incomingRequestMissingCloudRegion) + when(mockExecution.getVariable("disableRollback")).thenReturn(true) + + when(mockExecution.getVariable("testMessageId")).thenReturn("7df689f9-7b93-430b-9b9e-28140d70cc7ad") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso-service-instance-id")).thenReturn("FH/VLXM/003717//SW_INTERNET") + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") + + // preProcessRequest(DelegateExecution execution) + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.preProcessRequest(mockExecution) + + //verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + //verify variable initialization + initializeVariables(mockExecution) + + verify(mockExecution).setVariable("action", "DELETE") + verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequestMissingCloudRegion) + verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) + + verify(mockExecution).setVariable(Prefix + "networkInputs", networkInputsMissingCloudRegion) + verify(mockExecution).setVariable(Prefix + "messageId", "7df689f9-7b93-430b-9b9e-28140d70cc7ad") + verify(mockExecution).setVariable(Prefix + "lcpCloudRegion", null) + + verify(mockExecution).setVariable("BasicAuthHeaderValuePO","Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") + + } + + + + @Test + //@Ignore + public void prepareNetworkRequest() { + + println "************ prepareNetworkRequest ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedVperNetworkRequest) + when(mockExecution.getVariable(Prefix + "queryAAIResponse")).thenReturn(queryAAIResponse) + when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "tenantId")).thenReturn("e81d842d3e8b45c5a59f57cd76af3aaf") + + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter") + when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_value") + //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? + when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.prepareNetworkRequest(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable("mso.adapters.network.rest.endpoint", "http://localhost:8090/networks/NetworkAdapter/bdc5efe8-404a-409b-85f6-0dcc9eebae30") + //verify(mockExecution).setVariable(Prefix + "deleteNetworkRequest", deleteNetworkRequest) + verify(mockExecution).setVariable(Prefix + "deleteNetworkRequest", deleteNetworkRESTRequest) + + } + + @Test + //@Ignore + public void prepareNetworkRequest_AlaCarte() { + + println "************ prepareNetworkRequest ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable(Prefix + "queryAAIResponse")).thenReturn(queryAAIResponse) + when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "tenantId")).thenReturn("e81d842d3e8b45c5a59f57cd76af3aaf") + + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter") + when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_value") + //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? + when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.prepareNetworkRequest(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable("mso.adapters.network.rest.endpoint", "http://localhost:8090/networks/NetworkAdapter/bdc5efe8-404a-409b-85f6-0dcc9eebae30") + //verify(mockExecution).setVariable(Prefix + "deleteNetworkRequest", deleteNetworkRequest) + verify(mockExecution).setVariable("mso-request-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution).setVariable(Prefix + "deleteNetworkRequest", deleteNetworkRESTRequestAlaCarte) + + } + + @Test + //@Ignore + public void sendRequestToVnfAdapter() { + + println "************ sendRequestToVnfAdapter ************* " + + WireMock.reset(); + MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "deleteNetworkRequest")).thenReturn(deleteNetworkRESTRequest) + when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter/bdc5efe8-404a-409b-85f6-0dcc9eebae30") + when(mockExecution.getVariable("BasicAuthHeaderValuePO")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.sendRequestToVnfAdapter(mockExecution) + + verify(mockExecution).setVariable(Prefix + "networkReturnCode", 200) + //verify(mockExecution).setVariable(Prefix + "deleteNetworkResponse", deleteNetworkResponse_noRollback) + + } + + + @Test + //@Ignore + public void prepareSDNCRequest() { + + println "************ prepareSDNCRequest ************* " + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "queryAAIResponse")).thenReturn(aaiResponse) + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.prepareSDNCRequest(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "deleteSDNCRequest", deleteSDNCRequest) + + } + + @Test + //@Ignore + public void prepareRpcSDNCRequest() { + + println "************ prepareRpcSDNCRequest ************* " + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(inputViprSDC_NetworkRequest) + when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") // test ONLY + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.prepareRpcSDNCRequest(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "deleteSDNCRequest", deleteRpcSDNCRequest) + + } + + @Test + //@Ignore + public void prepareRpcSDNCActivateRollback() { + + println "************ prepareRpcSDNCActivateRollback ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(inputViprSDC_NetworkRequest) + when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("8abc633a-810b-4ca5-8b3a-09511d13a2ce") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") // test ONLY + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn(null) + when(mockExecution.getVariable(Prefix + "deactivateSDNCResponse")).thenReturn(sdncAdapterWorkflowFormattedResponse) + + // preProcessRequest(DelegateExecution execution) + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.prepareRpcSDNCDeactivateRollback(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix) + //verify(mockExecution).setVariable("mso-request-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //verify(mockExecution).setVariable(Prefix + "requestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //verify(mockExecution).setVariable("mso-service-instance-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution).setVariable(Prefix + "rollbackDeactivateSDNCRequest", sdncAdapaterDeactivateRollback) + + } + + + @Test + //@Ignore + public void callRESTQueryAAI_200() { + + println "************ callRESTQueryAAI ************* " + + WireMock.reset(); + MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "all"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.default.aai.network.l3-network.uri")).thenReturn("") + // old: when(mockExecution.getVariable("mso.workflow.DoDeleteNetworkInstance.aai.network.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("mso.workflow.DoDeleteNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.callRESTQueryAAI(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "queryAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/bdc5efe8-404a-409b-85f6-0dcc9eebae30"+"?depth=all") + + verify(mockExecution).setVariable(Prefix + "aaiReturnCode", "200") + //verify(mockExecution).setVariable(Prefix + "queryAAIResponse", aaiResponse) + verify(mockExecution).setVariable(Prefix + "isAAIGood", true) + verify(mockExecution).setVariable(Prefix + "isVfRelationshipExist", false) + + } + + @Test + //@Ignore + public void callRESTQueryAAI_withRelationship_200() { + + println "************ callRESTQueryAAI ************* " + + WireMock.reset(); + MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml", "all"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.default.aai.network.l3-network.uri")).thenReturn("") + // old: when(mockExecution.getVariable("mso.workflow.DoDeleteNetworkInstance.aai.network.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("mso.workflow.DoDeleteNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.callRESTQueryAAI(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "queryAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/bdc5efe8-404a-409b-85f6-0dcc9eebae30"+"?depth=all") + + verify(mockExecution).setVariable(Prefix + "aaiReturnCode", "200") + //verify(mockExecution).setVariable(Prefix + "queryAAIResponse", aaiResponseWithRelationship) + verify(mockExecution).setVariable(Prefix + "isAAIGood", true) + verify(mockExecution).setVariable(Prefix + "isVfRelationshipExist", true) + + } + + @Test + //@Ignore + public void callRESTQueryAAI_200_DefaultUri() { + + println "************ callRESTQueryAAI ************* " + + WireMock.reset(); + MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "all"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.network.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.callRESTQueryAAI(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "queryAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/bdc5efe8-404a-409b-85f6-0dcc9eebae30"+ "?depth=all") + + verify(mockExecution).setVariable(Prefix + "aaiReturnCode", "200") + //verify(mockExecution).setVariable(Prefix + "queryAAIResponse", aaiResponse) + verify(mockExecution).setVariable(Prefix + "isAAIGood", true) + + } + + @Test + //@Ignore + public void callRESTQueryAAICloudRegion30_200() { + + println "************ callRESTQueryAAICloudRegion30_200 ************* " + + WireMock.reset(); + MockGetNetworkCloudRegion("DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml", "RDM2WAGPLCP"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix) + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAICloudRegion_NotFound() { + + println "************ callRESTQueryAAICloudRegion_NotFound ************* " + + WireMock.reset(); + MockGetNetworkCloudRegion_404("MDTWNJ21"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix) + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestCloudRegionNotFound) + when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn("MDTWNJ21") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "cloudRegionPo", "MDTWNJ21") + verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc", "AAIAIC25") + + } + + @Test + //@Ignore + public void callRESTQueryAAICloudRegion25_200() { + + println "************ callRESTQueryAAICloudRegion25_200 ************* " + + WireMock.reset(); + MockGetNetworkCloudRegion("DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix) + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + // + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200") + + } + + + @Test + //@Ignore + public void validateNetworkResponse() { + + println "************ validateNetworkResponse ************* " + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "deleteNetworkResponse")).thenReturn(deleteNetworkResponse) + when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('200') + + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.validateNetworkResponse(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + //verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", null) + + } + + + @Test + //@Ignore + public void validateSDNCResponse_200() { + + println "************ validateSDNCResponse ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") + when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) + + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + try { + DoDeleteNetworkInstance.validateSDNCResponse(mockExecution, sdncAdapterWorkflowResponse) + } catch (Exception ex) { + println " Graceful Exit - " + ex.getMessage() + } + + } + + @Test + //@Ignore + public void validateSDNCResponse_404() { + + println "************ validateSDNCResponse ************* " + + WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstance", 2500, "Received error from SNDC Adapter: HTTP Status 404.") + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("404") + when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(false) + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + try { + DoDeleteNetworkInstance.validateSDNCResponse(mockExecution) + } catch (Exception ex) { + println " Graceful Exit - " + ex.getMessage() + } + + } + + @Test + //@Ignore + public void validateRpcSDNCDeactivateResponse() { + + println "************ validateRpcSDNCDeactivateResponse ************* " + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "deactivateSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse) + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) + when(mockExecution.getVariable(Prefix + "deactivateSDNCReturnCode")).thenReturn("200") + + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + try { + DoDeleteNetworkInstance.validateRpcSDNCDeactivateResponse(mockExecution) + verify(mockExecution).setVariable(Prefix + "isSdncDeactivateRollbackNeeded", true) + + } catch (Exception ex) { + println " Graceful Exit - " + ex.getMessage() + } + //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + //verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) + + } + + @Test + @Ignore + public void postProcessResponse() { + + println "************ postProcessResponse ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "source")).thenReturn("PORTAL") + when(mockExecution.getVariable(Prefix + "isException")).thenReturn(false) + + // postProcessResponse(DelegateExecution execution) + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.postProcessResponse(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "Success", true) + + } + + @Test + //@Ignore + public void prepareRollbackData() { + + println "************ prepareRollbackData() ************* " + + + + WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(deleteRollbackNetworkRequest) + //when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(null) + //when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn("") + when(mockExecution.getVariable(Prefix + "rollbackDeactivateSDNCRequest")).thenReturn(sdncAdapaterDeactivateRollback) + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + + // preProcessRequest(DelegateExecution execution) + DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance() + DoDeleteNetworkInstance.prepareRollbackData(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + } + + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoDeleteNetworkInstance") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoDeleteNetworkInstance") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoDeleteNetworkInstance") + when(mockExecution.getProcessInstanceId()).thenReturn("DoDeleteNetworkInstance") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstanceTest.groovy new file mode 100644 index 0000000000..a8bdfb0633 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstanceTest.groovy @@ -0,0 +1,127 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.bpmn.vcpe.scripts.GroovyTestBase + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +class DoDeleteServiceInstanceTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + public void preProcessRequestTest() { + + ExecutionEntity mex = setupMock() + when(mex.getVariable(GroovyTestBase.DBGFLAG)).thenReturn("true") + when(mex.getVariable("serviceInstanceId")).thenReturn("e151059a-d924-4629-845f-264db19e50b4") + when(mex.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("/mso/sdncadapter/") + when(mex.getVariable("globalSubscriberId")).thenReturn("4993921112123") + + DoDeleteServiceInstance instance = new DoDeleteServiceInstance() + instance.preProcessRequest(mex) + + Mockito.verify(mex).setVariable("sdncCallbackUrl", "/mso/sdncadapter/") + Mockito.verify(mex).setVariable("siParamsXml", "") + } + + + @Test + public void testPostProcessAAIGET() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("aai.endpoint")).thenReturn('http://localhost:8090') + when(mockExecution.getVariable("GENGS_FoundIndicator")).thenReturn(true) + when(mockExecution.getVariable("sdnc.si.svc.types")).thenReturn("") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("globalSubscriberId_test") + when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("subscriptionServiceType_test") + + String aaiGetResponse = FileUtil.readResourceFile("__files/GenericFlows/aaiGetResponse.xml") + when(mockExecution.getVariable("GENGS_service")).thenReturn(aaiGetResponse) + when(mockExecution.getVariable("GENGS_siResourceLink")).thenReturn("/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + mockData() + DoDeleteServiceInstance instance = new DoDeleteServiceInstance() + instance.postProcessAAIGET(mockExecution) + + Mockito.verify(mockExecution).setVariable("sendToSDNC", true) + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoDeleteServiceInstance") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoDeleteServiceInstance") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoDeleteServiceInstance") + when(mockExecution.getProcessInstanceId()).thenReturn("DoDeleteServiceInstance") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + + private void mockData() { + stubFor(get(urlMatching(".*/aai/v[0-9]+/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/.*")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile(""))) + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy new file mode 100644 index 0000000000..fcb0fb0940 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy @@ -0,0 +1,172 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +class DoDeleteVfModuleFromVnfTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090); + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + public void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testPreProcessRequest() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("msoRequestId")).thenReturn("12345") + when(mockExecution.getVariable("source")).thenReturn("VID") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("vnfId")).thenReturn("12345") + when(mockExecution.getVariable("tenantId")).thenReturn("19123c2924c648eb8e42a3c1f14b7682") + when(mockExecution.getVariable("vfModuleId")).thenReturn("12345") + when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("12345") + when(mockExecution.getVariable("sdncVersion")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + + DoDeleteVfModuleFromVnf obj = new DoDeleteVfModuleFromVnf() + obj.preProcessRequest(mockExecution) + + Mockito.verify(mockExecution).setVariable("prefix", "DDVFMV_") + Mockito.verify(mockExecution).setVariable("DDVFMV_contrailNetworkPolicyFqdnList", null) + Mockito.verify(mockExecution).setVariable("mso-request-id", "12345") + Mockito.verify(mockExecution).setVariable("requestId", "12345") + Mockito.verify(mockExecution).setVariable("cloudSiteId", "12345") + Mockito.verify(mockExecution).setVariable("source", "VID") + Mockito.verify(mockExecution).setVariable("isVidRequest", "true") + Mockito.verify(mockExecution).setVariable("srvInstId", "") + Mockito.verify(mockExecution).setVariable("DDVFMV_serviceInstanceIdToSdnc", "12345") + Mockito.verify(mockExecution).setVariable("DDVFMV_sdncVersion", "8") + Mockito.verify(mockExecution).setVariable("sdncCallbackUrl", "http://localhost:8090/SDNCAdapterCallback") + } + + + + @Test + void testDeleteNetworkPoliciesFromAAI() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.DoDeleteVfModuleFromVnf.aai.network-policy.uri")).thenReturn("/aai/v8/network/network-policies/network-policy") + when(mockExecution.getVariable("mso.workflow.custom.DoDeleteVfModuleFromVnf.aai.version")).thenReturn("8") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + List fqdnList = new ArrayList() + fqdnList.add("test") + when(mockExecution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList")).thenReturn(fqdnList) + mockData() + DoDeleteVfModuleFromVnf obj = new DoDeleteVfModuleFromVnf() + obj.deleteNetworkPoliciesFromAAI(mockExecution) + + Mockito.verify(mockExecution).setVariable("prefix", 'DDVFMV_') + Mockito.verify(mockExecution).setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 200) + } + + + @Test + void testQueryAAIForVfModule() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("vnfId")).thenReturn("12345") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("mso.workflow.global.default.aai.namespace") + when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + mockData() + DoDeleteVfModuleFromVnf obj = new DoDeleteVfModuleFromVnf() + obj.queryAAIForVfModule(mockExecution) + + Mockito.verify(mockExecution, atLeastOnce()).setVariable("DDVMFV_getVnfResponseCode", 200) + } + + + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoDeleteVfModuleFromVnf") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoDeleteVfModuleFromVnf") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoDeleteVfModuleFromVnf") + when(mockExecution.getProcessInstanceId()).thenReturn("DoDeleteVfModuleFromVnf") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + + } + + private static void mockData() { + stubFor(get(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf/12345[?]depth=1")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/GenerateVfModuleName_AAIResponse_Success.xml"))) + + stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml"))) + + stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*")) + .willReturn(aResponse() + .withStatus(200))); + + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy new file mode 100644 index 0000000000..3390b1a6f0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy @@ -0,0 +1,163 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.utils.XmlComparator +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +class DoDeleteVfModuleTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090); + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + public void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testPrepSDNCAdapterRequest() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("testReqId")).thenReturn("testReqId") + when(mockExecution.getVariable("requestId")).thenReturn("12345") + when(mockExecution.getVariable("source")).thenReturn("VID") + when(mockExecution.getVariable("serviceId")).thenReturn("12345") + when(mockExecution.getVariable("vnfId")).thenReturn("12345") + when(mockExecution.getVariable("tenantId")).thenReturn("19123c2924c648eb8e42a3c1f14b7682") + when(mockExecution.getVariable("vfModuleId")).thenReturn("12345") + when(mockExecution.getVariable("DoDVfMod_serviceInstanceIdToSdnc")).thenReturn("123456789") + when(mockExecution.getVariable("vfModuleName")).thenReturn("vfModuleName_test") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + + DoDeleteVfModule obj = new DoDeleteVfModule() + obj.prepSDNCAdapterRequest(mockExecution, 'release') + + String expectedValue = FileUtil.readResourceFile("__files/DoDeleteVfModule/sdncAdapterWorkflowRequest.xml") + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + XmlComparator.assertXMLEquals(expectedValue, captor.getValue()) + } + + + @Test + void testDeleteNetworkPoliciesFromAAI() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.DoDeleteVfModule.aai.network-policy.uri")).thenReturn("/aai/v8/network/network-policies/network-policy") + when(mockExecution.getVariable("mso.workflow.custom.DoDeleteVfModule.aai.version")).thenReturn("8") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + List fqdnList = new ArrayList() + fqdnList.add("test") + when(mockExecution.getVariable("DoDVfMod_contrailNetworkPolicyFqdnList")).thenReturn(fqdnList) + mockData() + DoDeleteVfModule obj = new DoDeleteVfModule() + obj.deleteNetworkPoliciesFromAAI(mockExecution) + + Mockito.verify(mockExecution).setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 200) + } + + + @Test + void testQueryAAIVfModuleForStatus() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("DCVFM_vnfId")).thenReturn("12345") + when(mockExecution.getVariable("DCVFM_vfModuleName")).thenReturn("module-0") + when(mockExecution.getVariable("mso.workflow.DoDeleteVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + DoCreateVfModule obj = new DoCreateVfModule() + obj.queryAAIVfModuleForStatus(mockExecution) + + Mockito.verify(mockExecution).setVariable("DCVFM_queryAAIVfModuleForStatusResponseCode", 200) + } + + + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoDeleteVfModule") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoDeleteVfModule") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoDeleteVfModule") + when(mockExecution.getProcessInstanceId()).thenReturn("DoDeleteVfModule") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + + } + + private static void mockData() { + stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml"))) + + stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*")) + .willReturn(aResponse() + .withStatus(200))) + + stubFor(get(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf/12345/vf-modules/vf-module[?]vf-module-name=module-0")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile("DoDeleteVfModule/getGenericVnfResponse.xml"))) + + } +} + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy new file mode 100644 index 0000000000..730be14df0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy @@ -0,0 +1,152 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.utils.XmlComparator +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +class DoDeleteVfModuleVolumeV2Test { + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090); + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + public void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testCallRESTQueryAAICloudRegion() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn("DDVMV_") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("12345") + when(mockExecution.getVariable("mso.workflow.DoDeleteVfModuleVolumeV2.aai.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + DoDeleteVfModuleVolumeV2 obj = new DoDeleteVfModuleVolumeV2() + obj.callRESTQueryAAICloudRegion(mockExecution, "true") + Mockito.verify(mockExecution).setVariable("DDVMV_queryCloudRegionReturnCode", "200") + Mockito.verify(mockExecution).setVariable("DDVMV_aicCloudRegion", "RDM2WAGPLCP") + } + + @Test + public void testCallRESTQueryAAICloudRegionAAiEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn("DDVMV_") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("12345") + when(mockExecution.getVariable("mso.workflow.DoDeleteVfModuleVolumeV2.aai.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + try { + DoDeleteVfModuleVolumeV2 obj = new DoDeleteVfModuleVolumeV2() + obj.callRESTQueryAAICloudRegion(mockExecution, "true") + + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + Mockito.verify(mockExecution,atLeastOnce()).setVariable(captor.capture(),captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(9999, workflowException.getErrorCode()) + } + + @Test + public void testPrepareVnfAdapterDeleteRequest() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn("DDVMV_") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("aicCloudRegion")).thenReturn("RegionOne") + when(mockExecution.getVariable("tenantId")).thenReturn("12345") + when(mockExecution.getVariable("volumeGroupId")).thenReturn("12345") + when(mockExecution.getVariable("volumeGroupHeatStackId")).thenReturn("12345") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("msoRequestId")).thenReturn("12345") + when(mockExecution.getVariable("mso.use.qualified.host")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.message.endpoint")).thenReturn("http://localhost:18080/mso/WorkflowMessage") + + DoDeleteVfModuleVolumeV2 obj = new DoDeleteVfModuleVolumeV2() + obj.prepareVnfAdapterDeleteRequest(mockExecution, "true") + + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + String str = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml") + XmlComparator.assertXMLEquals(str, captor.getValue(),"messageId","notificationUrl") + } + + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoDeleteVfModuleVolumeV2") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoDeleteVfModuleVolumeV2") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoDeleteVfModuleVolumeV2") + when(mockExecution.getProcessInstanceId()).thenReturn("DoDeleteVfModuleVolumeV2") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + + } + + private void mockData() { + stubFor(get(urlMatching(".*/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/12345")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml"))) + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy new file mode 100644 index 0000000000..0b95ffc053 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy @@ -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.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +public class DoDeleteVnfAndModulesTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090); + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + String cloudConfiguration = "{ " + + "\"lcpCloudRegionId\": \"mdt1\"," + + "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}"; + + @Before + public void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testPreProcessRequestTest() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("cloudConfiguration")).thenReturn(cloudConfiguration) + when(mockExecution.getVariable("msoRequestId")).thenReturn("12345") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("serviceInstanceId") + when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") + when(mockExecution.getVariable("productFamilyId")).thenReturn("productFamilyId") + when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("mdt1") + when(mockExecution.getVariable("tenantId")).thenReturn("19123c2924c648eb8e42a3c1f14b7682") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("MSO_test") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + + DoDeleteVnfAndModules obj = new DoDeleteVnfAndModules() + obj.preProcessRequest(mockExecution) + + Mockito.verify(mockExecution).setVariable("prefix", "DDVAM_") + Mockito.verify(mockExecution).setVariable("requestId", "12345") + Mockito.verify(mockExecution).setVariable("mso-request-id", "12345") + Mockito.verify(mockExecution).setVariable("DDVAM_source", "VID") + Mockito.verify(mockExecution).setVariable("DDVAM_isVidRequest", "true") + Mockito.verify(mockExecution).setVariable("DDVAM_sdncVersion", "1702") + Mockito.verify(mockExecution).setVariable("DDVAM_isVidRequest", "true") + Mockito.verify(mockExecution).setVariable("sdncCallbackUrl", "http://localhost:8090/SDNCAdapterCallback") + } + + + + @Test + public void testQueryAAIVfModuleNullEndPoint() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("vnfId")).thenReturn("12345") + when(mockExecution.getVariable("mso.workflow.DoDeleteVnfAndModules.aai.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + try { + DoDeleteVnfAndModules obj = new DoDeleteVnfAndModules() + obj.queryAAIVfModule(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution,atLeastOnce()).setVariable(captor.capture(),captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals("AAI GET Failed:null", workflowException.getErrorMessage()) + Assert.assertEquals(1002, workflowException.getErrorCode()) + } + + @Test + public void testQueryAAIVfModule() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("vnfId")).thenReturn("12345") + when(mockExecution.getVariable("mso.workflow.DoDeleteVnfAndModules.aai.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + DoDeleteVnfAndModules obj = new DoDeleteVnfAndModules() + obj.queryAAIVfModule(mockExecution) + + Mockito.verify(mockExecution).setVariable("DCVFM_queryAAIVfModuleResponseCode", 200) + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoDeleteVnfAndModules") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoDeleteVnfAndModules") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoDeleteVnfAndModules") + when(mockExecution.getProcessInstanceId()).thenReturn("DoDeleteVnfAndModules") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + + } + + private void mockData() { + + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/12345[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml"))); + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy new file mode 100644 index 0000000000..4e993525f9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy @@ -0,0 +1,110 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. * + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Rule +import org.junit.Test +import org.mockito.MockitoAnnotations +import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.bpmn.vcpe.scripts.GroovyTestBase + +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.when + +class DoScaleE2EServiceInstanceTest extends GroovyTestBase { + + private static String request + + @Rule + public WireMockRule wireMockRule = new WireMockRule(GroovyTestBase.PORT) + + String Prefix = "CVRCS_" + + @BeforeClass + public static void setUpBeforeClass() { + request = FileUtil.readResourceFile("__files/InfrastructureFlows/DoScaleE2EServiceInstance.json") + } + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + public DoScaleE2EServiceInstanceTest(){ + super("DoScaleE2EServiceInstance") + } + + @Test + public void preProcessRequestTest(){ + + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + + DoScaleE2EServiceInstance instance = new DoScaleE2EServiceInstance() + instance.preProcessRequest(mex) + verify(mex).setVariable("resourceTemplateUUIDs", "ns111:ns333:") + } + + @Test + public void preInitResourcesOperStatusTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + DoScaleE2EServiceInstance instance = new DoScaleE2EServiceInstance() + instance.preInitResourcesOperStatus(mex) + + verify(mex).setVariable("serviceInstanceId","e151059a-d924-4629-845f-264db19e50b4") + verify(mex).setVariable("operationId", "59960003992") + verify(mex).setVariable("operationType", "SCALE") + verify(mex).setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + String payload = + """ + + + + e151059a-d924-4629-845f-264db19e50b4 + 59960003992 + SCALE + ns111:ns333: + + +""" + verify(mex).setVariable("CVFMI_initResOperStatusRequest", payload) + } + + private void initPreProcess(ExecutionEntity mex) { + when(mex.getVariable(GroovyTestBase.DBGFLAG)).thenReturn("true") + when(mex.getVariable("bpmnRequest")).thenReturn(request) + when(mex.getVariable("msoRequestId")).thenReturn("mri") + when(mex.getVariable("serviceType")).thenReturn("VoLTE") + when(mex.getVariable("serviceInstanceId")).thenReturn("e151059a-d924-4629-845f-264db19e50b4") + when(mex.getVariable("serviceInstanceName")).thenReturn("ra") + when(mex.getVariable("operationId")).thenReturn("59960003992") + when(mex.getVariable("globalSubscriberId")).thenReturn("4993921112123") + when(mex.getVariable("resourceTemplateUUIDs")).thenReturn("ns111:ns333:") + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy new file mode 100644 index 0000000000..0189d065df --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy @@ -0,0 +1,332 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.junit.Before +import org.junit.Rule; +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith + +import static org.junit.Assert.*; + +import com.github.tomakehurst.wiremock.client.WireMock; +import com.github.tomakehurst.wiremock.junit.WireMockRule; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.apache.commons.lang3.* + + +@RunWith(MockitoJUnitRunner.class) +class DoUpdateNetworkInstanceRollbackTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090); + + def utils = new MsoUtils() + String Prefix="UPDNETIR_" + + + String rollbackNetworkRequest = + """ + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + CONTRAIL_EXTERNAL + true + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + +""" + + String rollbackActivateSDNCRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + rollback + network-topology-operation + sdncCallback + generic-resource + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + CreateNetworkInstance + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + MSO_1610_dev + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + + invariant-uuid + customization-uuid + uuid + version + CONTRAIL_EXTERNAL + + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + + String rollbackSDNCRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + rollback + network-topology-operation + sdncCallback + generic-resource + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + CreateNetworkInstance + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + MSO_1610_dev + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + + invariant-uuid + customization-uuid + uuid + version + CONTRAIL_EXTERNAL + + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + +// - - - - - - - - + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + public void initializeVariables (DelegateExecution mockExecution) { + + verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", null) + verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", null) + verify(mockExecution).setVariable(Prefix + "WorkflowException", null) + + verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", "") + verify(mockExecution).setVariable(Prefix + "rollbackNetworkResponse", "") + verify(mockExecution).setVariable(Prefix + "rollbackNetworkReturnCode", "") + + verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", "") + verify(mockExecution).setVariable(Prefix + "rollbackSDNCResponse", "") + verify(mockExecution).setVariable(Prefix + "rollbackSDNCReturnCode", "") + + verify(mockExecution).setVariable(Prefix + "Success", false) + verify(mockExecution).setVariable(Prefix + "fullRollback", false) + + + } + + @Test + //@Ignore + public void preProcessRequest() { + + println "************ preProcessRequest ************* " + + WorkflowException workflowException = new WorkflowException("DoUpdateNetworkInstanceRollback", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") + Map rollbackData = new HashMap(); + rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) + rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + when(mockExecution.getVariable("rollbackData")).thenReturn(rollbackData) + when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.sdnc.endpoint")).thenReturn("http://localhost:28090/SDNCAdapter") + when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")).thenReturn("http://localhost:28090/networks/NetworkAdapter") + when(mockExecution.getVariable("mso.adapters.sdnc.resource.endpoint")).thenReturn("http://localhost:28090/SDNCAdapterRpc") + + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstanceRollback DoUpdateNetworkInstanceRollback = new DoUpdateNetworkInstanceRollback() + DoUpdateNetworkInstanceRollback.preProcessRequest(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + //verify variable initialization + initializeVariables(mockExecution) + + } + + + @Test + @Ignore + public void validateRollbackResponses_Good() { + + WorkflowException workflowException = new WorkflowException("DoUpdateNetworkInstanceRollback", 2500, "AAI Update Contrail Failed. Error 404.") + WorkflowException expectedWorkflowException = new WorkflowException("DoUpdateNetworkInstanceRollback", 2500, "AAI Update Contrail Failed. Error 404. + SNDC activate rollback completed. + PO Network rollback completed. + SNDC assign rollback completed.") + + println "************ validateRollbackResponses_Good() ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn("Good") + when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn("Good") + when(mockExecution.getVariable(Prefix + "rollbackNetworkReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "rollbackNetworkResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable(Prefix + "rollbackSDNCReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "rollbackSDNCResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable(Prefix + "WorkflowException")).thenReturn(workflowException) + when(mockExecution.getVariable(Prefix + "fullRollback")).thenReturn(false) + + DoUpdateNetworkInstanceRollback DoUpdateNetworkInstanceRollback = new DoUpdateNetworkInstanceRollback() + DoUpdateNetworkInstanceRollback.validateRollbackResponses(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution, atLeast(1)).setVariable("rolledBack", true) + verify(mockExecution, atLeast(1)).setVariable("wasDeleted", true) + verify(mockExecution).setVariable("WorkflowException", refEq(expectedWorkflowException, any(WorkflowException.class))) + //verify(mockExecution).setVariable("WorkflowException", expectedWorkflowException) + } + + @Test + //@Ignore + public void validateRollbackResponses_FullRollback() { + + Map rollbackData = new HashMap(); + rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) + rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) + + println "************ validateRollbackResponses_FullRollback() ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("prefix")).thenReturn(Prefix) + when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn("Good") + when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn("Good") + when(mockExecution.getVariable(Prefix + "rollbackNetworkReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "rollbackNetworkResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable(Prefix + "rollbackSDNCReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "rollbackSDNCResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable(Prefix + "WorkflowException")).thenReturn(null) + when(mockExecution.getVariable(Prefix + "fullRollback")).thenReturn(true) + when(mockExecution.getVariable("rollbackData")).thenReturn(rollbackData) + + DoUpdateNetworkInstanceRollback DoUpdateNetworkInstanceRollback = new DoUpdateNetworkInstanceRollback() + DoUpdateNetworkInstanceRollback.validateRollbackResponses(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution, atLeast(1)).setVariable("rollbackSuccessful", true) + verify(mockExecution, atLeast(1)).setVariable("rollbackError", false) + + } + + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoUpdateNetworkInstanceRollback") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoUpdateNetworkInstanceRollback") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoUpdateNetworkInstanceRollback") + when(mockExecution.getProcessInstanceId()).thenReturn("DoUpdateNetworkInstanceRollback") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy new file mode 100644 index 0000000000..de3db5b5a8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy @@ -0,0 +1,2762 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + + +import static org.mockito.Mockito.* +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkByIdWithDepth; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion_404; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkVpnBinding; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkTableReference; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkPolicy; +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutNetworkIdWithDepth; +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException + +import com.github.tomakehurst.wiremock.client.WireMock +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.apache.commons.lang3.* + + +@RunWith(MockitoJUnitRunner.class) +class DoUpdateNetworkInstanceTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + def utils = new MsoUtils() + String Prefix="UPDNETI_" + + String jsonIncomingRequest = + """{ "requestDetails": { + "modelInfo": { + "modelType": "network", + "modelCustomizationId": "f21df226-8093-48c3-be7e-0408fcda0422", + "modelName": "CONTRAIL_EXTERNAL", + "modelVersion": "1.0" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "RDM2WAGPLCP", + "tenantId": "7dd5365547234ee8937416c65507d266" + }, + "requestInfo": { + "instanceName": "MNS-25180-L-01-dmz_direct_net_1", + "source": "VID", + "callbackUrl": "", + "suppressRollback": true, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", + "modelInfo": { + "modelType": "serviceT", + "modelId": "modelI", + "modelNameVersionId": "modelNameVersionI", + "modelName": "modleNam", + "modelVersion": "1" + } + } + } + ], + "requestParameters": { + "userParams": [ + { + "name": "someUserParam1", + "value": "someValue1" + } + ] + } + }}""" + + + String jsonIncomingRequest_MissingCloudRegion = + """{ "requestDetails": { + "modelInfo": { + "modelType": "network", + "modelCustomizationId": "f21df226-8093-48c3-be7e-0408fcda0422", + "modelName": "CONTRAIL_EXTERNAL", + "modelVersion": "1.0" + }, + "cloudConfiguration": { + "tenantId": "7dd5365547234ee8937416c65507d266" + }, + "requestInfo": { + "instanceName": "MNS-25180-L-01-dmz_direct_net_1", + "source": "VID", + "callbackUrl": "", + "suppressRollback": true, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", + "modelInfo": { + "modelType": "serviceT", + "modelId": "modelI", + "modelNameVersionId": "modelNameVersionI", + "modelName": "modleNam", + "modelVersion": "1" + } + } + } + ], + "requestParameters": { + "userParams": [] + } + }}""" + + + + String expectedNetworkRequestMissingNetworkId = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + UPDATE + VID + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + + + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + f21df226-8093-48c3-be7e-0408fcda0422 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + 1610 + + + someValue1 + +""" + + +String expectedNetworkRequestMissingCloudRegion = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + UPDATE + VID + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + + networkId + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + f21df226-8093-48c3-be7e-0408fcda0422 + null + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + null + + +""" + +String expectedNetworkInputMissingCloudRegion = +""" + networkId + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + f21df226-8093-48c3-be7e-0408fcda0422 + null + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + null +""" + + String networkInputsMissingName = + """ + + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + e81d842d3e8b45c5a59f57cd76af3aaf + """ + +String networkInputsMissingCloudRegion = +""" + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + e81d842d3e8b45c5a59f57cd76af3aaf +""" + + // expectedNetworkRequest + String expectedNetworkRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + UPDATE + VID + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + f21df226-8093-48c3-be7e-0408fcda0422 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + 1610 + + + someValue1 + +""" + +String expectedNetworkInputs = +""" + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + f21df226-8093-48c3-be7e-0408fcda0422 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + 1610 +""" + +String expectedVperNetworkRequest = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + UPDATE + VID + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + MSO-dev-service-type + globalId_45678905678 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + false + + CONTRAIL_EXTERNAL + sn5256d1-5a33-55df-13ab-12abad84e111 + sn5256d1-5a33-55df-13ab-12abad84e764 + 1 + sn5256d1-5a33-55df-13ab-12abad84e222 + + + + + + + + + 1702 + + +""" + +String expectedVperNetworkInputs = +""" + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + MSO-dev-service-type + globalId_45678905678 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + false + + CONTRAIL_EXTERNAL + sn5256d1-5a33-55df-13ab-12abad84e111 + sn5256d1-5a33-55df-13ab-12abad84e764 + 1 + sn5256d1-5a33-55df-13ab-12abad84e222 + + + + + + + + + 1702 +""" + +String expectedNetworkInputsMissingNetworkId = +""" + + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + f21df226-8093-48c3-be7e-0408fcda0422 + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + false + 1610 +""" + + + String NetworkRequest_noPhysicalName = + """ + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + UPDATE + PORTAL + + + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + 3008 + + + + true + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + true + true + 10.10.125.1 + + +""" + + String vnfRequestFakeRegion = + """ + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + UPDATE + PORTAL + + + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MDTWNJ21 + 7dd5365547234ee8937416c65507d266 + + + 1 + 0 + +""" + + // expectedNetworkRequest + String expectedNetworkRequest_Outputs = + """ + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + UPDATE + PORTAL + + + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + + + MNS-25180-L-01-dmz_direct_net_1 + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + + + 1 + 0 + +""" + + + String networkInputs = + """ + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + e81d842d3e8b45c5a59f57cd76af3aaf +""" + + String networkOutputs = + """ + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + """ + + String queryAAIResponse = + """ + + + + + + + + + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-delete + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-delete + true + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + + +""" + + String queryIdAIIResponse = + """ + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + l3-version + pending-delete + ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326 + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-update + true + subnetName + ECOMP + true + + + 400d286b-7e44-4514-b9b3-f70f7360ff32 + 172.20.1.0/24 + 10.102.200.1 + ip-address + 1505857300987 + + + 6f038013-8b15-4eb8-914b-507489fbc8ee + 10.102.0.0/16 + 10.102.200.1 + ip-address + 1505857301151 + + + 8811c5f8-f1ed-4fa0-a505-e1be60396e28 + 192.168.2.0/25 + 10.102.200.1 + 1505857301954 + + + + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-delete + true + subnetName + true + + + 400d286b-7e44-4514-b9b3-f70f7360ff32 + 172.20.1.0/24 + 10.102.200.1 + 1505857300987 + + + + + + + 414 + 4132176 + + + 415 + 4132176 + + + + inner + ctag-version + + + tenant + https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ + + vpn-binding.vpn-id + a290b841-f672-44dd-b9cd-6f8c20d7d8c8 + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest2 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ + + vpn-binding.vpn-id + 24a4b507-853a-4a38-99aa-05fcc54be24d + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest1 + + + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + + +""" + + String queryIdAIIResponseTestScenario01 = + """ + + 4da55fe4-7a9e-478c-a434-8a98d62265ab + GN_EVPN_direct_net_0_ST1 + CONTRAIL30_BASIC + GN_EVPN_direct + contrail + false + 9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + 1465398611 + pending-delete + networkName + false + true + false + + + cb1a7b47-5428-44c9-89c2-8b17541c3228 + 108.239.40.1 + 108.239.40.0 + 28 + 4 + pending-delete + true + 108.239.40.0 + 108.239.40.0 + 1465398611 + subnetName + + + + e2cc7c14-90f0-4205-840d-b4e07f04e621 + 2606:ae00:2e01:604::1 + 2606:ae00:2e01:604:: + 64 + 6 + pending-delete + true + 2606:ae00:2e01:604:: + 2606:ae00:2e01:604:: + 1465398611 + subnetName + + + + + + 416 + 4132176 + + + + cloud-region + https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/ + + + cloud-region.cloud-region-id + AAIAIC25 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.owner-defined-type + + + + + tenant + https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/4ae1d3446a4c48b2bec44b6cfba06d68/ + + tenant.tenant-id + 4ae1d3446a4c48b2bec44b6cfba06d68 + + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + AAIAIC25 + + + tenant.tenant-name + Ruchira Contrail 3.0 test + + + + vpn-binding + https://localhost:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 9a7b327d9-287aa00-82c4b0-100001 + + + vpn-binding.vpn-name + GN_EVPN_direct_net_0_ST1 + + + + route-table-reference + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + +""" + + String queryIdAIIResponseVpnNotPresent = + """ + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-delete + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-delete + true + subnetName + + + + + + +""" + + String queryNameAIIResponse = + """ + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-delete + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-delete + true + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + + + """ + + String queryNameAIIResponseVpnNotPresent = + """ + + + + + + + + + + + + + + +""" + + String queryVpnBindingAAIResponse = + """ + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 13979:105757 + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ + + l3-network.network-id + 689ec39e-c5fc-4462-8db2-4f760763ad28 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ + + l3-network.network-id + 1a49396b-19b3-40a4-8792-aa2fbd0f0704 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ + + l3-network.network-id + 774f3329-3c83-4771-86c7-9e6207cd50fd + + + + + +""" + + + String updateNetworkRequest = + """ + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + sn5256d1-5a33-55df-13ab-12abad84e222 + + CONTRAIL + + networkName + 414,415 + + + true + false + 13979:105757 + 13979:105757 + GN_EVPN_Test + refFQDN1 + refFQDN2 + + + + + + + 107.239.52.0/24 + true + 107.239.52.1 + 4 + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + subnetName + true + + 172.20.1.0/24 + 10.102.200.1 + + + 10.102.0.0/16 + 10.102.200.1 + + + 192.168.2.0/25 + 10.102.200.1 + + + true + true + false + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + messageId_generated + +""" + +String updateNetworkRequest_noPhysicalName = +""" + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + + + CONTRAIL + + networkName + 414,415 + + + true + false + 13979:105757 + 13979:105757 + GN_EVPN_Test + + + + + + + 107.239.52.0/24 + true + 107.239.52.1 + 4 + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + subnetName + true + + 172.20.1.0/24 + 10.102.200.1 + + + 10.102.0.0/16 + 10.102.200.1 + + + 192.168.2.0/25 + 10.102.200.1 + + + true + true + false + + true + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + true + true + 10.10.125.1 + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + null + + messageId_generated + +""" + + String updateNetworkResponseREST = + """ + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 + + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + + + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + CONTRAIL_EXTERNAL + true + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + + messageId_generated +""" + + String updateRollbackNetworkRequest = + """ + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + CONTRAIL_EXTERNAL + true + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + +""" + + String updateNetworkResponse = + """ + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + + + + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + true + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + CONTRAIL_EXTERNAL + false + c4f4e878-cde0-4b15-ae9a-bda857759cea + 7dd5365547234ee8937416c65507d266 + +""" + + String updateContrailAAIPayloadRequest = + """ + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + c4f4e878-cde0-4b15-ae9a-bda857759cea + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + l3-version + Active + ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326 + default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + 107.239.52.1 + 107.239.52.0 + 24 + 4 + Active + true + ECOMP + 1505857300987 + subnetName + true + + + 400d286b-7e44-4514-b9b3-f70f7360ff32 + 172.20.1.0/24 + 10.102.200.1 + ip-address + 1505857300987 + + + 6f038013-8b15-4eb8-914b-507489fbc8ee + 10.102.0.0/16 + 10.102.200.1 + ip-address + 1505857301151 + + + 8811c5f8-f1ed-4fa0-a505-e1be60396e28 + 192.168.2.0/25 + 10.102.200.1 + + 1505857301954 + + + + + + 414 + 4132176 + + + 415 + 4132176 + + + + inner + ctag-version + + + tenant + https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ + + vpn-binding.vpn-id + a290b841-f672-44dd-b9cd-6f8c20d7d8c8 + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest2 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ + + vpn-binding.vpn-id + 24a4b507-853a-4a38-99aa-05fcc54be24d + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest1 + + + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + +""" + + + String updateContrailAAIResponse = + """ + + + + + + + + +""" + + String updateNetworkErrorResponse = + """ + 680bd458-5ec1-4a16-b77c-509022e53450INTERNAL + 400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data + true + """ + + + String networkException500 = + """soap:VersionMismatch"http://org.onap.so/network", the namespace on the "updateNetworkContrail" element, is not a valid SOAP version.""" + + String aaiResponse = + """ + + + + + + + + + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + HSL_direct + contrail + 8bbd3edf-b835-4610-96a2-a5cafa029042 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + active + MNS-25180-L-01-dmz_direct_net_1/57594a56-1c92-4a38-9caa-641c1fa3d4b6 + + + ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a + 5a77fdc2-7789-4649-a1b9-6eaf1db1813a + 172.16.34.1 + 172.16.34.0 + 28 + 4 + active + true + + + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v3/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ + + tenant.tenant-id + e81d842d3e8b45c5a59f57cd76af3aaf + + + + + + """ + + String changeAssignSDNCRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + changeassign + network-topology-operation + sdncCallback + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + NetworkActivateRequest + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + MSO_1610_dev + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + CONTRAIL_EXTERNAL + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + +String assignResponse = +""" 006927ca-f5a3-47fd-880c-dfcbcd81a093 200 OK 200006927ca-f5a3-47fd-880c-dfcbcd81a093Ynotsurewecarea9a77d5a-123e-4ca2-9eb9-0b015d2ee0fbGN_EVPN_direct_net_0_ST_noGW8abc633a-810b-4ca5-8b3a-09511d13a2ce """ + + String sdncRollbackRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + rollback + network-topology-operation + sdncCallback + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + NetworkActivateRequest + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + MSO_1610_dev + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + + String sdncAdapterWorkflowResponse = + """ + + + 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 + 200 + OK + + <output xmlns="com:att:sdnctl:vnf"><svc-request-id>00703dc8-71ff-442d-a4a8-3adc5beef6a9</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>MNS-25180-L-01-dmz_direct_net_1</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + +""" + + + String sdncAdapterWorkflowResponse_Error = + """ + + + + 400 + Error writing to l3-netework + Y + c79240d8-34b5-4853-af69-2021928dba00 + + + +""" + + String expected_sdncAdapterWorkflowResponse_Error = + """ + + + + 400 + Error writing to l3-netework + Y + c79240d8-34b5-4853-af69-2021928dba00 + + + +""" + + String sdncAdapterWorkflowFormattedResponse = + """ + + + 00703dc8-71ff-442d-a4a8-3adc5beef6a9 + 200 + Y + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + notsurewecare + + + +""" + +String rollbackSDNCRequest = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + rollback + network-topology-operation + sdncCallback + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + CreateNetworkInstance + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + MSO_1610_dev + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + + invariant-uuid + customization-uuid + uuid + version + CONTRAIL_EXTERNAL + + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + +String rollbackNetworkRequest = +""" + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + CONTRAIL_EXTERNAL + true + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + +""" + +// - - - - - - - - + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + public void initializeVariables (DelegateExecution mockExecution) { + + verify(mockExecution).setVariable(Prefix + "messageId", "") + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "") + verify(mockExecution).setVariable(Prefix + "networkRequest", "") + verify(mockExecution).setVariable(Prefix + "networkInputs", "") + verify(mockExecution).setVariable(Prefix + "networkOutputs", "") + verify(mockExecution).setVariable(Prefix + "requestId", "") + verify(mockExecution).setVariable(Prefix + "source", "") + verify(mockExecution).setVariable(Prefix + "networkId", "") + + verify(mockExecution).setVariable(Prefix + "isPONR", false) + + // AAI query Cloud Region + verify(mockExecution).setVariable(Prefix + "queryCloudRegionRequest","") + verify(mockExecution).setVariable(Prefix + "queryCloudRegionReturnCode","") + verify(mockExecution).setVariable(Prefix + "queryCloudRegionResponse","") + verify(mockExecution).setVariable(Prefix + "cloudRegionPo","") + verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc","") + verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", false) + + // AAI query Id + verify(mockExecution).setVariable(Prefix + "queryIdAAIRequest","") + verify(mockExecution).setVariable(Prefix + "queryIdAAIResponse", "") + verify(mockExecution).setVariable(Prefix + "aaiIdReturnCode", "") + + // AAI query vpn binding + verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest","") + verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIResponse", "") + verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "") + verify(mockExecution).setVariable(Prefix + "vpnBindings", null) + verify(mockExecution).setVariable(Prefix + "vpnCount", 0) + verify(mockExecution).setVariable(Prefix + "routeCollection", "") + + // AAI query network policy + verify(mockExecution).setVariable(Prefix + "queryNetworkPolicyAAIRequest","") + verify(mockExecution).setVariable(Prefix + "queryNetworkPolicyAAIResponse", "") + verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "") + verify(mockExecution).setVariable(Prefix + "networkPolicyUriList", null) + verify(mockExecution).setVariable(Prefix + "networkPolicyCount", 0) + verify(mockExecution).setVariable(Prefix + "networkCollection", "") + + // AAI query route table reference + verify(mockExecution).setVariable(Prefix + "queryNetworkTableRefAAIRequest","") + verify(mockExecution).setVariable(Prefix + "queryNetworkTableRefAAIResponse", "") + verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "") + verify(mockExecution).setVariable(Prefix + "networkTableRefUriList", null) + verify(mockExecution).setVariable(Prefix + "networkTableRefCount", 0) + verify(mockExecution).setVariable(Prefix + "tableRefCollection", "") + + + // AAI requery Id + verify(mockExecution).setVariable(Prefix + "requeryIdAAIRequest","") + verify(mockExecution).setVariable(Prefix + "requeryIdAAIResponse", "") + verify(mockExecution).setVariable(Prefix + "aaiRequeryIdReturnCode", "") + + // AAI update contrail + verify(mockExecution).setVariable(Prefix + "updateContrailAAIUrlRequest","") + verify(mockExecution).setVariable(Prefix + "updateContrailAAIPayloadRequest","") + verify(mockExecution).setVariable(Prefix + "updateContrailAAIResponse", "") + verify(mockExecution).setVariable(Prefix + "aaiUpdateContrailReturnCode", "") + + verify(mockExecution).setVariable(Prefix + "updateNetworkRequest", "") + verify(mockExecution).setVariable(Prefix + "updateNetworkResponse", "") + verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", "") + //verify(mockExecution).setVariable(Prefix + "rollbackNetworkResponse", "") + verify(mockExecution).setVariable(Prefix + "networkReturnCode", "") + //verify(mockExecution).setVariable(Prefix + "rollbackNetworkReturnCode", "") + verify(mockExecution).setVariable(Prefix + "isNetworkRollbackNeeded", false) + + verify(mockExecution).setVariable(Prefix + "changeAssignSDNCRequest", "") + verify(mockExecution).setVariable(Prefix + "changeAssignSDNCResponse", "") + verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", "") + //verify(mockExecution).setVariable(Prefix + "rollbackSDNCResponse", "") + verify(mockExecution).setVariable(Prefix + "sdncReturnCode", "") + //verify(mockExecution).setVariable(Prefix + "rollbackSDNCReturnCode", "") + verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", false) + verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false) + + verify(mockExecution).setVariable(Prefix + "isVnfBindingPresent", false) + verify(mockExecution).setVariable(Prefix + "Success", false) + verify(mockExecution).setVariable(Prefix + "serviceInstanceId", "") + + verify(mockExecution).setVariable(Prefix + "isException", false) + + } + + @Test + //@Ignore + public void preProcessRequest_NetworkRequest() { + + println "************ preProcessRequest_Payload ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) + when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) + when(mockExecution.getVariable("requestAction")).thenReturn("UPDATE") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("vnfId")).thenReturn("") + when(mockExecution.getVariable("volumeGroupId")).thenReturn("") + when(mockExecution.getVariable("networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") + when(mockExecution.getVariable("serviceType")).thenReturn("MOG") + when(mockExecution.getVariable("networkType")).thenReturn("modelName") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) + when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + when(mockExecution.getVariable("disableRollback")).thenReturn("true") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.preProcessRequest(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix + "") + + //verify variable initialization + initializeVariables(mockExecution) + + // Authentications + verify(mockExecution).setVariable("action", "UPDATE") + verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequest) + verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) + verify(mockExecution).setVariable(Prefix + "networkInputs", expectedNetworkInputs) + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable(Prefix + "networkOutputs", "") + + } + + @Test + //@Ignore + public void preProcessRequest_vPERNetworkRequest() { + + def networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111", + "modelName": "CONTRAIL_EXTERNAL", + "modelType": "CONTRAIL_EXTERNAL", + "modelVersion": "1", + "modelCustomizationUuid": "sn5256d1-5a33-55df-13ab-12abad84e222", + "modelInvariantUuid": "sn5256d1-5a33-55df-13ab-12abad84e764" + }""".trim() + + println "************ preProcessRequest_Payload ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("disableRollback")).thenReturn("true") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") // optional + when(mockExecution.getVariable("networkName")).thenReturn("MNS-25180-L-01-dmz_direct_net_1") // optional + when(mockExecution.getVariable("productFamilyId")).thenReturn("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + when(mockExecution.getVariable("networkModelInfo")).thenReturn("CONTRAIL_EXTERNAL") + when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable("tenantId")).thenReturn("7dd5365547234ee8937416c65507d266") + when(mockExecution.getVariable("failIfExists")).thenReturn("false") + when(mockExecution.getVariable("networkModelInfo")).thenReturn(networkModelInfo) + when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") + when(mockExecution.getVariable("action")).thenReturn("UPDATE") + when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("MSO-dev-service-type") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("globalId_45678905678") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + when(mockExecution.getVariable("mso.adapters.sdnc.endpoint")).thenReturn("http://localhost:8090/SDNCAdapter") + when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter") + when(mockExecution.getVariable("mso.adapters.sdnc.resource.endpoint")).thenReturn("http://localhost:8090/SDNCAdapterRpc") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.preProcessRequest(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix + "") + + //verify variable initialization + initializeVariables(mockExecution) + + // Authentications + verify(mockExecution).setVariable("action", "UPDATE") + verify(mockExecution).setVariable(Prefix + "networkRequest", expectedVperNetworkRequest) + verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) + verify(mockExecution).setVariable(Prefix + "networkInputs", expectedVperNetworkInputs) + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable(Prefix + "networkOutputs", "") + + } + + @Test + //@Ignore + public void preProcessRequest_MissingNetworkId() { + + println "************ preProcessRequest_MissingName() ************* " + + WorkflowException missingNameWorkflowException = new WorkflowException("DoUpdateNetworkInstance", 2500, "Variable 'network-id' value/element is missing.") + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) + when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) + when(mockExecution.getVariable("requestAction")).thenReturn("UPDATE") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("vnfId")).thenReturn("") + when(mockExecution.getVariable("volumeGroupId")).thenReturn("") + //when(mockExecution.getVariable("networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") + when(mockExecution.getVariable("serviceType")).thenReturn("MOG") + when(mockExecution.getVariable("networkType")).thenReturn("modelName") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) + when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") + + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + when(mockExecution.getVariable("disableRollback")).thenReturn("true") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + try { + DoUpdateNetworkInstance.preProcessRequest(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") + + //verify variable initialization + initializeVariables(mockExecution) + + verify(mockExecution).setVariable("action", "UPDATE") + verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequestMissingNetworkId) + verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) + verify(mockExecution).setVariable(Prefix + "networkInputs", expectedNetworkInputsMissingNetworkId) + verify(mockExecution).setVariable(Prefix + "messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution).setVariable(Prefix + "source", "VID") + verify(mockExecution).setVariable(Prefix + "networkOutputs", "") + + verify(mockExecution).setVariable(eq("WorkflowException"), refEq(missingNameWorkflowException)) + + } + + @Test + //@Ignore + public void preProcessRequest_MissingCloudRegion() { + + println "************ preProcessRequest_MissingCloudRegion() ************* " + + WorkflowException missingCloudRegionWorkflowException = new WorkflowException("DoUpdateNetworkInstance", 2500, "requestDetails has missing 'aic-cloud-region' value/element.") + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) + when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) + when(mockExecution.getVariable("requestAction")).thenReturn("UPDATE") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("vnfId")).thenReturn("") + when(mockExecution.getVariable("volumeGroupId")).thenReturn("") + when(mockExecution.getVariable("networkId")).thenReturn("networkId") + when(mockExecution.getVariable("serviceType")).thenReturn("MOG") + when(mockExecution.getVariable("networkType")).thenReturn("modelName") + + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest_MissingCloudRegion) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + when(mockExecution.getVariable("disableRollback")).thenReturn("true") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + try { + DoUpdateNetworkInstance.preProcessRequest(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") + + //verify variable initialization + initializeVariables(mockExecution) + + verify(mockExecution).setVariable("action", "UPDATE") + verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequestMissingCloudRegion) + verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) + verify(mockExecution).setVariable(Prefix + "networkInputs", expectedNetworkInputMissingCloudRegion) + verify(mockExecution).setVariable(Prefix + "messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution).setVariable(Prefix + "source", "VID") + + verify(mockExecution).setVariable(eq("WorkflowException"), refEq(missingCloudRegionWorkflowException)) + + } + + @Test + //@Ignore + public void prepareUpdateNetworkRequest() { + + println "************ prepareNetworkRequest ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedVperNetworkRequest) + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") + when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") + //when(mockExecution.getVariable(Prefix + "queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) + when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("13979:10575713979:105757") + when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("GN_EVPN_Test") + when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("refFQDN1refFQDN2") + when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.prepareUpdateNetworkRequest(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix + "") + + verify(mockExecution).setVariable(Prefix + "updateNetworkRequest", updateNetworkRequest) + + } + + + @Test + //@Ignore + public void prepareUpdateNetworkRequest_NoPhysicalname() { + + println "************ prepareNetworkRequest ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(NetworkRequest_noPhysicalName) + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") + when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") + //when(mockExecution.getVariable(Prefix + "queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) + when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("13979:10575713979:105757") + when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("GN_EVPN_Test") + when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("") + when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.prepareUpdateNetworkRequest(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix + "") + + verify(mockExecution).setVariable(Prefix + "updateNetworkRequest", updateNetworkRequest_noPhysicalName) + + } + + @Test + //@Ignore + public void prepareSDNCRequest() { + + println "************ prepareSDNCRequest ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(aaiResponse) + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") + + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.prepareSDNCRequest(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "changeAssignSDNCRequest", changeAssignSDNCRequest) + + } + + @Test + //@Ignore + public void prepareSDNCRollbackRequest() { + + println "************ prepareSDNCRollbackRequest ************* " + + + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(assignResponse) + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.prepareSDNCRollbackRequest(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "WorkflowException", null) + verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", sdncRollbackRequest) + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkId_200() { + + println "************ callRESTQueryAAINetworkId ************* " + + WireMock.reset(); + MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.DoUpdateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkId(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "queryIdAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") + verify(mockExecution).setVariable(Prefix + "aaiIdReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAICloudRegion30_200() { + + println "************ callRESTQueryAAICloudRegion30_200 ************* " + + WireMock.reset(); + MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml", "RDM2WAGPLCP"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") + verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200") + verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) + + } + + @Test + public void callRESTQueryAAICloudRegion25_200() { + + println "************ callRESTQueryAAICloudRegion25_200 ************* " + + WireMock.reset(); + MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) + + } + + @Test + //@Ignore + public void callRESTQueryAAICloudRegion_NotFound() { + + println "************ callRESTQueryAAICloudRegionFake ************* " + + WireMock.reset(); + MockGetNetworkCloudRegion_404("MDTWNJ21"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestFakeRegion) + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") + verify(mockExecution, atLeast(1)).setVariable(Prefix + "queryCloudRegionReturnCode", "404") + verify(mockExecution).setVariable(Prefix + "cloudRegionPo", "MDTWNJ21") + verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc", "AAIAIC25") + verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkVpnBinding_200() { + + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + + WireMock.reset(); + MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) // v6 + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "vpnCount", 2) + verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") + verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkVpnBindingList_200() { + + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + + WireMock.reset(); + MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) // v6 + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "vpnCount", 2) + verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") + verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + + } + + + @Test + //@Ignore + public void callRESTQueryAAINetworkVpnBinding_TestScenario01_200() { + + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + + WireMock.reset(); + MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponseTestScenario01) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "vpnCount", 1) + verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") + verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkVpnBinding_200_URN_Uri() { + + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + + WireMock.reset(); + MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "vpnCount", 2) + verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") + verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkVpnBinding_NotPresent() { + + println "************ callRESTQueryAAINetworkVpnBinding_NotPresent ************* " + + WireMock.reset(); + MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponseVpnNotPresent) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + verify(mockExecution).setVariable(Prefix + "vpnCount", 0) + verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIResponse", aaiVpnResponseStub) + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkTableRef_200() { + + println "************ callRESTQueryAAINetworkTableRef_200 ************* " + + WireMock.reset(); + MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); + MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.default.aai.network-table-reference.uri")).thenReturn("") + when(mockExecution.getVariable("mso.workflow.DoUpdateNetworkInstance.aai.route-table-reference.uri")).thenReturn("/aai/v8/network/route-table-references/route-table-reference") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkTableRef(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "networkTableRefCount", 2) + verify(mockExecution).setVariable(Prefix + "networkTableRefUriList", ['/aai/v8/network/route-table-references/route-table-reference/refFQDN1','/aai/v8/network/route-table-references/route-table-reference/refFQDN2']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable(Prefix + "queryNetworkTableRefAAIRequest", "http://localhost:8090/aai/v8/network/route-table-references/route-table-reference/refFQDN1?depth=all") + verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkPolicy_200() { + + println "************ callRESTQueryAAINetworkPolicy_200 ************* " + + WireMock.reset(); + MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.network-policy.uri")).thenReturn("/aai/v8/network/network-policies/network-policy") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkPolicy(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "networkPolicyCount", 1) + verify(mockExecution).setVariable(Prefix + "networkPolicyUriList", ['/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable(Prefix + "queryNetworkPolicyAAIRequest", "http://localhost:8090/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg?depth=all") + verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "200") + + } + + + @Test + //@Ignore + public void callRESTReQueryAAINetworkId_200() { + + println "************ callRESTReQueryAAINetworkId ************* " + + WireMock.reset(); + MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowFormattedResponse) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.DoUpdateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTReQueryAAINetworkId(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "requeryIdAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") + verify(mockExecution).setVariable(Prefix + "aaiRequeryIdReturnCode", "200") + + } + + + @Test + //@Ignore + public void callRESTUpdateContrailAAINetworkREST_200() { + + println "************ callRESTUpdateContrailAAINetwork ************* " + + WireMock.reset(); + MockPutNetworkIdWithDepth("UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowFormattedResponse) + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(updateNetworkResponseREST) + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.DoUpdateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTUpdateContrailAAINetwork(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "updateContrailAAIUrlRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") + verify(mockExecution).setVariable(Prefix + "updateContrailAAIPayloadRequest", updateContrailAAIPayloadRequest) + verify(mockExecution).setVariable(Prefix + "aaiUpdateContrailReturnCode", "200") + //verify(mockExecution).setVariable(Prefix + "updateContrailAAIResponse", updateContrailAAIResponse) + verify(mockExecution).setVariable(Prefix + "isPONR", true) + + } + + + + @Test + //@Ignore + public void validateUpdateNetworkResponseREST() { + + println "************ validateNetworkResponse ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(updateNetworkResponseREST) + when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('200') + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.validateUpdateNetworkResponse(mockExecution) + + //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "updateNetworkResponse", updateNetworkResponseREST) + verify(mockExecution).setVariable(Prefix + "isNetworkRollbackNeeded", true) + verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", updateRollbackNetworkRequest) + + } + + @Test + //@Ignore + public void validateUpdateNetworkResponseREST_Error() { + + println "************ validateNetworkResponse ************* " + + WorkflowException workflowException = new WorkflowException("DoUpdateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(networkException500) + when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('500') + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + try { + DoUpdateNetworkInstance.validateUpdateNetworkResponse(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution, atLeast(1)).setVariable("WorkflowException", refEq(workflowException, any(WorkflowException.class))) + + } + + @Test + //@Ignore + public void validateSDNCResponse() { + + println "************ validateSDNCResponse ************* " + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse) + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) + when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "isResponseGood")).thenReturn(true) + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + try { + DoUpdateNetworkInstance.validateSDNCResponse(mockExecution) + verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) + verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", "") + + } catch (Exception ex) { + println " Graceful Exit - " + ex.getMessage() + } + //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + //verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) + + } + + @Test + //@Ignore + public void validateSDNCResponse_Error() { + + println "************ validateSDNCResponse ************* " + //ExecutionEntity mockExecution = mock(ExecutionEntity.class) + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse_Error) + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(false) + when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "isResponseGood")).thenReturn(true) + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + try { + DoUpdateNetworkInstance.validateSDNCResponse(mockExecution) + } catch (Exception ex) { + println " Graceful Exit! - " + ex.getMessage() + } + //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + // verify set prefix = Prefix + "" + //verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false) + + } + + @Test + //@Ignore + public void prepareRollbackData() { + + println "************ prepareRollbackData() ************* " + + + + WorkflowException workflowException = new WorkflowException("DoUpdateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn(rollbackSDNCRequest) + when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(rollbackNetworkRequest) + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.prepareRollbackData(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + } + + @Test + //@Ignore + public void postProcessResponse() { + + println "************ postProcessResponse() ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "isException")).thenReturn(false) + when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") + when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn(rollbackSDNCRequest) + when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(rollbackSDNCRequest) + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable("mso-request-id")).thenReturn("requestId") + + // preProcessRequest(DelegateExecution execution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.postProcessResponse(mockExecution) + +// verify(mockExecution, atLeast(3)).getVariable("isDebugLogEnabled") + verify(mockExecution, atLeast(3)).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "Success", true) + + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoUpdateNetworkInstance") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoUpdateNetworkInstance") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoUpdateNetworkInstance") + when(mockExecution.getProcessInstanceId()).thenReturn("DoUpdateNetworkInstance") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy new file mode 100644 index 0000000000..beaebceaf7 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy @@ -0,0 +1,309 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.VfModule +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* +import org.onap.so.bpmn.common.scripts.utils.XmlComparator + +@RunWith(MockitoJUnitRunner.class) +class DoUpdateVfModuleTest { + + def prefix = "DOUPVfMod_" + String doUpdateVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/DoUpdateVfModuleRequest.xml"); + String sdncChangeAssignRequest = FileUtil.readResourceFile("__files/DoUpdateVfModule/sdncChangeAssignRequest.xml") + String sdncTopologyRequest = FileUtil.readResourceFile("__files/DoUpdateVfModule/sdncTopologyRequest.xml") + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090); + + @Before + public void init() { + MockitoAnnotations.initMocks(this) + } + + @Test + void testPreProcessRequest() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("DoUpdateVfModuleRequest")).thenReturn(doUpdateVfModuleRequest) + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:28080/mso/SDNCAdapterCallbackService") + + DoUpdateVfModule obj = new DoUpdateVfModule() + obj.preProcessRequest(mockExecution) + + Mockito.verify(mockExecution, atLeastOnce()).getVariable("mso.workflow.sdncadapter.callback") + } + + + + @Test + void testPrepConfirmVolumeGroupTenant() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region") + when(mockExecution.getVariable("mso.workflow.default.aai.cloud-region.version")).thenReturn("8") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + DoUpdateVfModule obj = new DoUpdateVfModule() + obj.prepConfirmVolumeGroupTenant(mockExecution) + + Mockito.verify(mockExecution).setVariable(prefix + "queryCloudRegionRequest", "http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + Mockito.verify(mockExecution).setVariable(prefix + "queryCloudRegionReturnCode", "200") + Mockito.verify(mockExecution).setVariable(prefix + "cloudRegionForVolume", "AAIAIC25") + Mockito.verify(mockExecution).setVariable(prefix + "isCloudRegionGood", true) + } + + + @Test + void testPrepSDNCTopologyChg() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable(prefix + "requestId")).thenReturn("12345") + when(mockExecution.getVariable("testReqId")).thenReturn("testReqId") + + + when(mockExecution.getVariable(prefix + "cloudSiteId")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("cb510af0-5b21-4bc7-86d9-323cb396ce32") + when(mockExecution.getVariable("volumeGroupStackId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "vfModuleName")).thenReturn("PCRF::module-0-2") + when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("MDTWNJ21") + when(mockExecution.getVariable(prefix + "usePreload")).thenReturn("Y") + when(mockExecution.getVariable(prefix + "vnfNameFromAAI")).thenReturn("skask-test") + + def node = new Node(null, 'vfModule') + new Node(node, 'vf-module-name', "abc") + VfModule vfModule = new VfModule(node, true); + when(mockExecution.getVariable(prefix + "vfModule")).thenReturn(vfModule) + + when(mockExecution.getVariable(prefix + "tenantId")).thenReturn("fba1bd1e195a404cacb9ce17a9b2b421") + when(mockExecution.getVariable(prefix + "vnfType")).thenReturn("vRRaas") + when(mockExecution.getVariable(prefix + "vnfName")).thenReturn("skask-test") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") + when(mockExecution.getVariable(prefix + "vfModuleModelName")).thenReturn("PCRF::module-0-2") + when(mockExecution.getVariable(prefix + "requestId")).thenReturn("testRequestId") + when(mockExecution.getVariable(prefix + "serviceId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "serviceInstanceId")).thenReturn("MIS/1604/0026/SW_INTERNET") + Map map = new HashMap(); + map.put("vrr_image_name", "MDT17"); + map.put("availability_zone_0", "nova"); + map.put("vrr_flavor_name", "ns.c16r32d128.v1"); + when(mockExecution.getVariable("vnfParamsMap")).thenReturn(map) + when(mockExecution.getVariable("mso-request-id")).thenReturn("testRequestId-1503410089303") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapter") + + mockData() + DoUpdateVfModule obj = new DoUpdateVfModule() + obj.prepSDNCTopologyChg(mockExecution) + + Mockito.verify(mockExecution).setVariable(prefix + "vnfName", "skask-test") + + Mockito.verify(mockExecution, times(2)).setVariable(captor.capture(), captor.capture()) + XmlComparator.assertXMLEquals(sdncChangeAssignRequest, captor.getValue()) + } + + + + @Test + void testPrepSDNCTopologyQuery() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("testReqId")).thenReturn("testReqId") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "serviceId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "serviceInstanceId")).thenReturn("MIS/1604/0026/SW_INTERNET") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapter") + + mockData() + DoUpdateVfModule obj = new DoUpdateVfModule() + obj.prepSDNCTopologyQuery(mockExecution) + + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + XmlComparator.assertXMLEquals(sdncTopologyRequest, captor.getValue()) + } + + + + @Test + void testPrepVnfAdapterRest() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("cb510af0-5b21-4bc7-86d9-323cb396ce32") + when(mockExecution.getVariable(prefix + "volumeGroupStackId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "vfModuleName")).thenReturn("PCRF::module-0-2") + when(mockExecution.getVariable(prefix + "tenantId")).thenReturn("fba1bd1e195a404cacb9ce17a9b2b421") + when(mockExecution.getVariable(prefix + "vnfType")).thenReturn("vRRaas") + when(mockExecution.getVariable(prefix + "vnfName")).thenReturn("skask-test") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") + when(mockExecution.getVariable(prefix + "vfModuleModelName")).thenReturn("PCRF::module-0-2") + when(mockExecution.getVariable(prefix + "vfModuleIndex")).thenReturn("index") + when(mockExecution.getVariable(prefix + "requestId")).thenReturn("testRequestId") + when(mockExecution.getVariable(prefix + "serviceId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "serviceInstanceId")).thenReturn("MIS/1604/0026/SW_INTERNET") + when(mockExecution.getVariable(prefix + "backoutOnFailure")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "volumeGroupId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "asdcServiceModelVersion")).thenReturn("1.0") + when(mockExecution.getVariable(prefix + "modelCustomizationUuid")).thenReturn("cb510af0-5b21-4bc7-86d9-323cb396ced3") + when(mockExecution.getVariable(prefix + "baseVfModuleId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "baseVfModuleHeatStackId")).thenReturn("12345") + + def node = new Node(null, 'vfModule') + new Node(node, 'heat-stack-id', "abc") + VfModule vfModule = new VfModule(node, true); + when(mockExecution.getVariable(prefix + "vfModule")).thenReturn(vfModule) + + String sdncGetResponse = FileUtil.readResourceFile("__files/DoUpdateVfModule/sdncGetResponse.xml"); + when(mockExecution.getVariable(prefix + "sdncTopologyResponse")).thenReturn(sdncGetResponse) + Map map = new HashMap(); + map.put("vrr_image_name", "MDT17"); + map.put("availability_zone_0", "nova"); + map.put("vrr_flavor_name", "ns.c16r32d128.v1"); + when(mockExecution.getVariable(prefix + "vnfParamsMap")).thenReturn(map) + when(mockExecution.getVariable("mso-request-id")).thenReturn("testRequestId-1503410089303") + when(mockExecution.getVariable("mso.use.qualified.host")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.message.endpoint")).thenReturn("http://localhost:28080/mso/WorkflowMesssage") + + mockData() + DoUpdateVfModule obj = new DoUpdateVfModule() + obj.prepVnfAdapterRest(mockExecution) + + String createVnfARequest = FileUtil.readResourceFile("__files/DoUpdateVfModule/vnfAdapterRestRequest.xml") + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + XmlComparator.assertXMLEquals(createVnfARequest, captor.getValue(), "messageId", "notificationUrl") + } + + + + @Test + void testPrepSDNCTopologyAct() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable("testReqId")).thenReturn("testReqId") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("cb510af0-5b21-4bc7-86d9-323cb396ce32") + when(mockExecution.getVariable(prefix + "tenantId")).thenReturn("fba1bd1e195a404cacb9ce17a9b2b421") + when(mockExecution.getVariable(prefix + "vnfType")).thenReturn("vRRaas") + when(mockExecution.getVariable(prefix + "vnfName")).thenReturn("skask-test") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") + when(mockExecution.getVariable(prefix + "vfModuleModelName")).thenReturn("PCRF::module-0-2") + when(mockExecution.getVariable(prefix + "requestId")).thenReturn("testRequestId") + when(mockExecution.getVariable(prefix + "serviceId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "serviceInstanceId")).thenReturn("MIS/1604/0026/SW_INTERNET") + when(mockExecution.getVariable(prefix + "usePreload")).thenReturn("Y") + when(mockExecution.getVariable(prefix + "modelCustomizationUuid")).thenReturn("cb510af0-5b21-4bc7-86d9-323cb396ced3") + + def node = new Node(null, 'vfModule') + new Node(node, 'vf-module-name', "abc") + VfModule vfModule = new VfModule(node, true); + when(mockExecution.getVariable(prefix + "vfModule")).thenReturn(vfModule) + + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapter") + + mockData() + DoUpdateVfModule obj = new DoUpdateVfModule() + obj.prepSDNCTopologyAct(mockExecution) + + String createVnfARequest = FileUtil.readResourceFile("__files/DoUpdateVfModule/sdncActivateRequest.xml") + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + XmlComparator.assertXMLEquals(createVnfARequest, captor.getValue()) + } + + @Test + void testQueryAAIVfModule() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("12345") + when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + DoUpdateVfModule obj = new DoUpdateVfModule() + obj.queryAAIVfModule(mockExecution) + Mockito.verify(mockExecution).setVariable(prefix + "queryAAIVfModuleResponseCode", 200) + } + + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoUpdateVfModule") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoUpdateVfModule") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoUpdateVfModule") + when(mockExecution.getProcessInstanceId()).thenReturn("DoUpdateVfModule") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + + private static void mockData() { + stubFor(get(urlMatching(".*/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile("DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml"))) + + stubFor(get(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf/12345[?]depth=1")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile("DoUpdateVfModule/getGenericVnfResponse.xml"))) + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy new file mode 100644 index 0000000000..ba54787dc1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy @@ -0,0 +1,126 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +class DoUpdateVnfAndModulesTest { + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090); + + @Before + public void init() { + MockitoAnnotations.initMocks(this) + } + + @Test + void testQueryAAIVfModule() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("vnfId")).thenReturn("12345") + when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + DoUpdateVnfAndModules obj = new DoUpdateVnfAndModules() + obj.queryAAIVfModule(mockExecution) + Mockito.verify(mockExecution).setVariable("DUVAM_queryAAIVfModuleResponseCode", 200) + } + + @Test + @Ignore + void testQueryAAIVfModuleEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("vnfId")).thenReturn("12345") + when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + try { + DoUpdateVnfAndModules obj = new DoUpdateVnfAndModules() + obj.queryAAIVfModule(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + Mockito.verify(mockExecution, atLeastOnce()).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(1002, workflowException.getErrorCode()) + Assert.assertEquals("AAI GET Failed:org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoUpdateVfModule") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoUpdateVfModule") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoUpdateVfModule") + when(mockExecution.getProcessInstanceId()).thenReturn("DoUpdateVfModule") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + + private static void mockData() { + stubFor(get(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf/12345[?]depth=1")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile("DoUpdateVfModule/getGenericVnfResponse.xml"))) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy new file mode 100644 index 0000000000..e196a62e1f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy @@ -0,0 +1,195 @@ +/*- + * ============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.bpmn.infrastructure.scripts + +import static org.mockito.Mockito.* + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.runtime.Execution +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.common.scripts.ExceptionUtil + + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +@RunWith(MockitoJUnitRunner.class) +class SacleCustomE2EServiceInstanceTest{ + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + String Prefix="CRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + String globalSubscriberId="test_custormer" + String requestDescription = "request description for test" + def utils = new MsoUtils() + + String jsonIncomingRequest = """{"service":{ + "serviceType":"example-service-type", + "globalSubscriberId":"test_custormer", + "resources":[ + { + "resourceInstanceId":"ns111", + "scaleType":"SCALE_NS", + "scaleNsData":{ + "scaleNsByStepsData":{ + "numberOfSteps":"4", + "aspectId":"TIC_EDGE_HW", + "scalingDirection":"UP" + } + } + }, + { + "resourceInstanceId":"ns333", + "scaleType":"SCALE_NS", + "scaleNsData":{ + "scaleNsByStepsData":{ + "numberOfSteps":"4", + "aspectId":"TIC_EDGE_HW", + "scalingDirection":"UP" + } + } + }], + "serviceInstanceName":"XXXX" + }, + "operationId":"0a5b1651-c56e-4263-8c26-c8f8a6ef72d8" + }""" + + String xmlMsoCompletionRequest = """ + + 56c881ad-6c9d-4b79-aacc-401e5640b47f + SCALE + null + + Service Instance was scaled successfully. + 56c881ad-6c9d-4b79-aacc-401e5640b47f + ScaleGenericALaCarteServiceInstance +""" + + String requestInfo = """ + 56c881ad-6c9d-4b79-aacc-401e5640b47f + SCALE + null + """ + + String payload =""" + + + + 56c881ad-6c9d-4b79-aacc-401e5640b47f + 0a5b1651-c56e-4263-8c26-c8f8a6ef72d8 + SCALE + + processing + Prepare service scaling + 0 + + + + """ + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + public void preProcessRequestTest() { + println "************ preProcessRequest_Payload ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) + + when(mockExecution.getVariable("mso-request-id")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + + ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() + scaleCustomE2EServiceInstance.preProcessRequest(mockExecution) + + verify(mockExecution).setVariable("globalSubscriberId", globalSubscriberId) + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable("requestDescription", requestDescription) + } + + @Test + public void sendSyncResponseTest() { + println "************ sendSyncResponse ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("operationId")).thenReturn("3338b250-e995-4782-8936-081b66ba4dbf") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + + ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() + scaleCustomE2EServiceInstance.sendSyncResponse(mockExecution) + + verify(mockExecution).setVariable("sentSyncResponse", true) + } + + @Test + public void prepareCompletionRequestTest() { + println "************ prepareCompletionRequest ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("msoRequestId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + + ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() + scaleCustomE2EServiceInstance.prepareCompletionRequest(mockExecution) + + verify(mockExecution).setVariable("CompleteMsoProcessRequest", xmlMsoCompletionRequest) + + } + + @Test + public void prepareInitServiceOperationStatusTest() { + println "************ prepareInitServiceOperationStatus ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + //when(mockExecution.getVariable("serviceInstanceName")).thenReturn("XXXX") + when(mockExecution.getVariable("operationId")).thenReturn("0a5b1651-c56e-4263-8c26-c8f8a6ef72d8") + + ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() + scaleCustomE2EServiceInstance.prepareInitServiceOperationStatus(mockExecution) + + payload = utils.formatXml(payload) + verify(mockExecution).setVariable("CVFMI_updateServiceOperStatusRequest", payload) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstanceTest.groovy new file mode 100644 index 0000000000..fd3c1e352f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstanceTest.groovy @@ -0,0 +1,358 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + + +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.WorkflowException + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.apache.commons.lang3.* + + +@RunWith(MockitoJUnitRunner.class) +class UpdateNetworkInstanceTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + String Prefix="UPDNI_" + def utils = new MsoUtils() + + String createDBRequestError = +""" + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + BPMN + Received error from SDN-C: No availability zone available + + FAILED + <network-id></network-id><network-name></network-names> + + + """ + + String falloutHandlerRequest = + """ + + b69c9054-da09-4a2c-adf5-51042b62bfac + UPDATE + VID + + + Received error from SDN-C: No availability zone available. + 5300 + + """ + + String completeMsoProcessRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + UPDATE + VID + + Network has been updated successfully. + BPMN Network action: UPDATE +""" + + +String jsonIncomingRequest = +"""{ "requestDetails": { + "modelInfo": { + "modelType": "networkTyp", + "modelId": "modelId", + "modelNameVersionId": "modelNameVersionId", + "modelName": "CONTRAIL_EXTERNAL", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "RDM2WAGPLCP", + "tenantId": "7dd5365547234ee8937416c65507d266" + }, + "requestInfo": { + "instanceName": "MNS-25180-L-01-dmz_direct_net_1", + "source": "VID", + "callbackUrl": "", + "suppressRollback": true, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", + "modelInfo": { + "modelType": "serviceT", + "modelId": "modelI", + "modelNameVersionId": "modelNameVersionI", + "modelName": "modleNam", + "modelVersion": "1" + } + } + } + ], + "requestParameters": { + "userParams": [ + { + "name": "someUserParam1", + "value": "someValue1" + } + ] + } + }}""" + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + public void initializeVariables(DelegateExecution mockExecution) { + + verify(mockExecution).setVariable(Prefix + "source", "") + verify(mockExecution).setVariable(Prefix + "Success", false) + + verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", "") + verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", "") + + } + + @Test + //@Ignore + public void preProcessRequest() { + + println "************ preProcessRequest() ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) + + when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + // preProcessRequest(DelegateExecution execution) + UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() + UpdateNetworkInstance.preProcessRequest(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + initializeVariables(mockExecution) + //verify(mockExecution).setVariable(Prefix + "Success", false) + + } + + + @Test + //@Ignore + public void getNetworkModelInfo() { + + println "************ getNetworkModelInfo() ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + // preProcessRequest(DelegateExecution execution) + UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() + UpdateNetworkInstance.getNetworkModelInfo(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + } + + @Test + //@Ignore + public void sendSyncResponse() { + + println "************ sendSyncResponse ************* " + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) + when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + + // preProcessRequest(DelegateExecution execution) + UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() + UpdateNetworkInstance.sendSyncResponse(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable("UpdateNetworkInstanceResponseCode", "202") + + } + + @Test + //@Ignore + public void sendSyncError() { + + println "************ sendSyncError ************* " + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) + when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + + UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() + UpdateNetworkInstance.sendSyncError(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable("UpdateNetworkInstanceResponseCode", "500") + + } + + @Test + //@Ignore + public void prepareCompletion() { + + println "************ postProcessResponse ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable(Prefix + "dbReturnCode")).thenReturn("200") + + // postProcessResponse(DelegateExecution execution) + UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() + UpdateNetworkInstance.prepareCompletion(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "Success", true) + verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", completeMsoProcessRequest) + + } + + @Test + //@Ignore + public void buildErrorResponse() { + + println "************ buildErrorResponse ************* " + + + WorkflowException sndcWorkflowException = new WorkflowException("UpdateNetworkInstance", 5300, "Received error from SDN-C: No availability zone available.") + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso-request-id")).thenReturn("b69c9054-da09-4a2c-adf5-51042b62bfac") + //when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowException) + when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowException) + + // buildErrorResponse(DelegateExecution execution) + UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() + UpdateNetworkInstance.buildErrorResponse(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) + + //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + } + + @Test + //@Ignore + public void postProcessResponse() { + + println "************ postProcessResponse() ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("CMSO_ResponseCode")).thenReturn("200") + + // postProcessResponse(DelegateExecution execution) + UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() + UpdateNetworkInstance.postProcessResponse(mockExecution) + + //verify(mockExecution).getVariable("isDebugLogEnabled") + //verify(mockExecution).setVariable("prefix", Prefix) + + verify(mockExecution).setVariable(Prefix + "Success", true) + + } + + @Test + //@Ignore + public void processRollbackData() { + + println "************ callDBCatalog() ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + // preProcessRequest(DelegateExecution execution) + UpdateNetworkInstance UpdateNetworkInstance = new UpdateNetworkInstance() + UpdateNetworkInstance.processRollbackData(mockExecution) + +// verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", Prefix) + + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("UpdateNetworkInstance") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("UpdateNetworkInstance") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("UpdateNetworkInstance") + when(mockExecution.getProcessInstanceId()).thenReturn("UpdateNetworkInstance") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy new file mode 100644 index 0000000000..620b0b787d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy @@ -0,0 +1,134 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.utils.XmlComparator +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +class UpdateVfModuleVolumeInfraV1Test { + + def prefix = "UPDVfModVol_" + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090); + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + void testQueryAAIForVfModule() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UPDVfModVol_relatedVfModuleLink")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf/12345/vf-modules/vf-module/12345") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + mockData() + UpdateVfModuleVolumeInfraV1 obj = new UpdateVfModuleVolumeInfraV1() + obj.queryAAIForVfModule(mockExecution, "true") + + Mockito.verify(mockExecution, atLeastOnce()).setVariable("UPDVfModVol_personaModelId", "ff5256d2-5a33-55df-13ab-12abad84e7ff") + } + + @Test + void testPrepVnfAdapterRest() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(prefix + "tenantId")).thenReturn("") + when(mockExecution.getVariable(prefix + "aaiVolumeGroupResponse")).thenReturn(FileUtil.readResourceFile("__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml")) + when(mockExecution.getVariable(prefix + "vnfType")).thenReturn("vnf1") + when(mockExecution.getVariable(prefix + "vnfVersion")).thenReturn("1") + when(mockExecution.getVariable(prefix + "AAIQueryGenericVfnResponse")).thenReturn(FileUtil.readResourceFile("__files/GenericFlows/getGenericVnfByNameResponse.xml")) + when(mockExecution.getVariable(prefix + "requestId")).thenReturn("12345") + when(mockExecution.getVariable(prefix + "serviceId")).thenReturn("12345") + when(mockExecution.getVariable("mso-request-id")).thenReturn("12345") + when(mockExecution.getVariable("mso.workflow.message.endpoint")).thenReturn('http://localhost:28080/mso/WorkflowMessage') + when(mockExecution.getVariable("mso.use.qualified.host")).thenReturn("true") + + mockData() + UpdateVfModuleVolumeInfraV1 obj = new UpdateVfModuleVolumeInfraV1() + obj.prepVnfAdapterRest(mockExecution, "true") + + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + def updateVolumeGroupRequest = captor.getValue() + String expectedValue = FileUtil.readResourceFile("__files/UpdateVfModuleVolumeInfraV1/updateVolumeGroupRequest.xml") + XmlComparator.assertXMLEquals(expectedValue, updateVolumeGroupRequest, "messageId", "notificationUrl") + } + + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("UpdateVfModuleVolumeInfraV1") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("UpdateVfModuleVolumeInfraV1") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("UpdateVfModuleVolumeInfraV1") + when(mockExecution.getProcessInstanceId()).thenReturn("UpdateVfModuleVolumeInfraV1") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + + private static void mockData() { + stubFor(get(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf/12345/vf-modules/vf-module/.*")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile("UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml"))) + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy new file mode 100644 index 0000000000..523c791efc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy @@ -0,0 +1,1269 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.vcpe.scripts + + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Rule +import org.junit.Test +import org.junit.Ignore +import org.mockito.MockitoAnnotations +import org.camunda.bpm.engine.delegate.BpmnError +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.HomingSolution +import org.onap.so.bpmn.mock.FileUtil + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse +import static com.github.tomakehurst.wiremock.client.WireMock.get +import static com.github.tomakehurst.wiremock.client.WireMock.patch +import static com.github.tomakehurst.wiremock.client.WireMock.put +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching +import static org.junit.Assert.*; +import static org.mockito.Mockito.* +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.domain.AllottedResource +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.HomingSolution +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.vcpe.scripts.MapGetter +import org.onap.so.bpmn.vcpe.scripts.MapSetter + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +class CreateVcpeResCustServiceTest extends GroovyTestBase { + + private static String request + + @Rule + public WireMockRule wireMockRule = new WireMockRule(PORT) + + String Prefix = "CVRCS_" + String RbType = "DCRENI_" + + @BeforeClass + public static void setUpBeforeClass() { + request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/request.json") + } + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + public CreateVcpeResCustServiceTest() { + super("CreateVcpeResCustService") + } + + + // ***** preProcessRequest ***** + + @Test + @Ignore // 1802 merge + public void preProcessRequest() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.preProcessRequest(mex) + + verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("prefix", Prefix) + verify(mex).setVariable("aaiDistDelay", "aaidelay") + verify(mex).setVariable("createVcpeServiceRequest", request) + verify(mex).setVariable("msoRequestId", "mri") + assertEquals("sii", map.get("serviceInstanceId")) + verify(mex).setVariable("requestAction", "ra") + verify(mex).setVariable("source", "VID") + verify(mex).setVariable("globalSubscriberId", CUST) + verify(mex).setVariable("globalCustomerId", CUST) + verify(mex).setVariable("subscriptionServiceType", SVC) + verify(mex).setVariable("disableRollback", "false") + verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + assertTrue(map.containsKey("subscriberInfo")) + + verify(mex).setVariable("brgWanMacAddress", "brgmac") + verify(mex).setVariable("customerLocation", ["customerLatitude":"32.897480", "customerLongitude":"-97.040443", "customerName":"some_company"]) + verify(mex).setVariable("homingService", "sniro") + assertTrue(map.containsKey("serviceInputParams")) + assertTrue(map.containsKey(Prefix+"requestInfo")) + + def reqinfo = map.get(Prefix+"requestInfo") + assertTrue(reqinfo.indexOf("mri= 0) + assertTrue(reqinfo.indexOf("VID= 0) + } + + @Test + // @Ignore + public void preProcessRequest_MissingAaiDistDelay() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + + when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn(null) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) })) + } + + @Test + @Ignore // 1802 merge + public void preProcessRequest_EmptyParts() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + + def req = request + .replace('"source"', '"sourceXXX"') + .replace('"BRG_WAN_MAC_Address"', '"BRG_WAN_MAC_AddressXXX"') + .replace('"Customer_Location"', '"Customer_LocationXXX"') + + when(mex.getVariable("bpmnRequest")).thenReturn(req) + when(mex.getVariable("serviceInstanceId")).thenReturn(null) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.preProcessRequest(mex) + + verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("prefix", Prefix) + verify(mex).setVariable("createVcpeServiceRequest", req) + verify(mex).setVariable("msoRequestId", "mri") + assertNotNull(map.get("serviceInstanceId")) + assertFalse(map.get("serviceInstanceId").isEmpty()) + verify(mex).setVariable("requestAction", "ra") + verify(mex).setVariable("source", "VID") + verify(mex).setVariable("globalSubscriberId", CUST) + verify(mex).setVariable("globalCustomerId", CUST) + verify(mex).setVariable("subscriptionServiceType", SVC) + verify(mex).setVariable("disableRollback", "false") + verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + assertTrue(map.containsKey("subscriberInfo")) + + assertEquals("", map.get("brgWanMacAddress")) + assertEquals("", map.get("customerLocation")) + assertEquals("oof", map.get("homingService")) + assertTrue(map.containsKey("serviceInputParams")) + assertTrue(map.containsKey(Prefix+"requestInfo")) + + def reqinfo = map.get(Prefix+"requestInfo") + println reqinfo + assertTrue(reqinfo.indexOf("mri= 0) + assertTrue(reqinfo.indexOf("VID= 0) + } + + @Test + // @Ignore + public void preProcessRequest_MissingSubscriberId() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + + def req = request + .replace('"globalSubscriberId"', '"globalSubscriberIdXXX"') + + when(mex.getVariable("bpmnRequest")).thenReturn(req) + when(mex.getVariable("serviceInstanceId")).thenReturn(null) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) })) + } + + @Test + // @Ignore + public void preProcessRequest_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("bpmnRequest")).thenThrow(new BpmnError("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) })) + } + + @Test + // @Ignore + public void preProcessRequest_Ex() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("bpmnRequest")).thenThrow(new RuntimeException("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) })) + } + + // ***** sendSyncResponse ***** + + @Test + // @Ignore + public void sendSyncResponse() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initSendSyncResponse(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.sendSyncResponse(mex) + + verify(mex, times(2)).getVariable(DBGFLAG) + + verify(mex).setVariable(processName+"WorkflowResponseSent", "true") + + assertEquals("202", map.get(processName+"ResponseCode")) + assertEquals("Success", map.get(processName+"Status")) + + def resp = map.get(processName+"Response") + + assertTrue(resp.indexOf('"instanceId":"sii"') >= 0) + assertTrue(resp.indexOf('"requestId":"mri"') >= 0) + } + + @Test + // @Ignore + public void sendSyncResponse_Ex() { + ExecutionEntity mex = setupMock() + initSendSyncResponse(mex) + + when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.sendSyncResponse(mex) })) + } + + + // ***** prepareDecomposeService ***** + + @Test + // @Ignore + public void prepareDecomposeService() { + ExecutionEntity mex = setupMock() + initPrepareDecomposeService(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.prepareDecomposeService(mex) + + verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("serviceModelInfo", "mi") + } + + @Test + // @Ignore + public void prepareDecomposeService_Ex() { + ExecutionEntity mex = setupMock() + initPrepareDecomposeService(mex) + + when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareDecomposeService(mex) })) + } + + + // ***** prepareCreateServiceInstance ***** + + @Test + // @Ignore + public void prepareCreateServiceInstance() { + ExecutionEntity mex = setupMock() + initPrepareCreateServiceInstance(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.prepareCreateServiceInstance(mex) + + verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("serviceInstanceName", "VCPE1") + verify(mex).setVariable("serviceDecompositionString", "mydecomp") + } + + @Test + // @Ignore + public void prepareCreateServiceInstance_Ex() { + ExecutionEntity mex = setupMock() + initPrepareCreateServiceInstance(mex) + + when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareCreateServiceInstance(mex) })) + } + + + // ***** postProcessServiceInstanceCreate ***** + + @Test + // @Ignore + public void postProcessServiceInstanceCreate() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPostProcessServiceInstanceCreate(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.postProcessServiceInstanceCreate(mex) + + verify(mex).getVariable(DBGFLAG) + + def reqinfo = map.get(Prefix+"setUpdateDbInstancePayload") + + assertTrue(reqinfo.indexOf("mri= 0) + assertTrue(reqinfo.indexOf("sii= 0) + assertTrue(reqinfo.indexOf("sin= 0) + } + + @Test + // @Ignore + public void postProcessServiceInstanceCreate_BpmnError() { + ExecutionEntity mex = setupMock() + initPostProcessServiceInstanceCreate(mex) + + doThrow(new BpmnError("expected exception")).when(mex).setVariable(endsWith("setUpdateDbInstancePayload"), any()) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessServiceInstanceCreate(mex) })) + } + + @Test + // @Ignore + public void postProcessServiceInstanceCreate_Ex() { + ExecutionEntity mex = setupMock() + initPostProcessServiceInstanceCreate(mex) + + doThrow(new RuntimeException("expected exception")).when(mex).setVariable(endsWith("setUpdateDbInstancePayload"), any()) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessServiceInstanceCreate(mex) })) + } + + + // ***** processDecomposition ***** + + @Test + // @Ignore + public void processDecomposition() { + ExecutionEntity mex = setupMock() + def svcdecomp = initProcessDecomposition(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.processDecomposition(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex).setVariable("vnfList", svcdecomp.getVnfResources()) + verify(mex).setVariable("vnfListString", '[myvnf]') + verify(mex).setVariable(Prefix+"VNFsCount", 1) + + verify(mex).setVariable("vnfModelInfo", "mymodel") + verify(mex).setVariable("vnfModelInfoString", "mymodel") + } + + @Test + // @Ignore + public void processDecomposition_EmptyNet_EmptyVnf() { + ExecutionEntity mex = setupMock() + def svcdecomp = initProcessDecomposition(mex) + + when(svcdecomp.getVnfResources()).thenReturn(new LinkedList()) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.processDecomposition(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex).setVariable("vnfList", svcdecomp.getVnfResources()) + verify(mex).setVariable("vnfListString", '[]') + verify(mex).setVariable(Prefix+"VNFsCount", 0) + + verify(mex).setVariable("vnfModelInfo", "") + verify(mex).setVariable("vnfModelInfoString", "") + } + + @Test + // @Ignore + public void processDecomposition_Ex() { + ExecutionEntity mex = setupMock() + def svcdecomp = initProcessDecomposition(mex) + + when(svcdecomp.getVnfResources()).thenThrow(new RuntimeException("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.processDecomposition(mex) })) + } + + + // ***** filterVnfs ***** + + @Test + // @Ignore + public void filterVnfs() { + ExecutionEntity mex = setupMock() + def svcdecomp = initFilterVnfs(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.processDecomposition(mex) + + verify(mex).setVariable("vnfListString", '[myvnf3, myvnf5]') + } + + @Test + // @Ignore + public void filterVnfs_Null() { + ExecutionEntity mex = setupMock() + def svcdecomp = initFilterVnfs(mex) + + when(svcdecomp.getVnfResources()).thenReturn(null) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.processDecomposition(mex) + + // nothing more to check, as long as it didn't throw an exception + } + + + // ***** prepareCreateAllottedResourceTXC ***** + + @Test + // @Ignore + public void prepareCreateAllottedResourceTXC() { + ExecutionEntity mex = setupMock() + initPrepareCreateAllottedResourceTXC(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.prepareCreateAllottedResourceTXC(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex).setVariable("createTXCAR", true) + verify(mex).setVariable("allottedResourceModelInfoTXC", "modelB") + verify(mex).setVariable("allottedResourceRoleTXC", "TXCr") + verify(mex).setVariable("allottedResourceTypeTXC", "Tunnel XConn") + verify(mex).setVariable("parentServiceInstanceIdTXC", "homeB") + } + + @Test + // @Ignore + public void prepareCreateAllottedResourceTXC_NullArList() { + ExecutionEntity mex = setupMock() + def svcdecomp = initPrepareCreateAllottedResourceTXC(mex) + + when(svcdecomp.getAllottedResources()).thenReturn(null) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.prepareCreateAllottedResourceTXC(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex, never()).setVariable("createTXCAR", true) + verify(mex, never()).setVariable("allottedResourceModelInfoTXC", "modelB") + verify(mex, never()).setVariable("allottedResourceRoleTXC", "TXCr") + verify(mex, never()).setVariable("allottedResourceTypeTXC", "Tunnel XConn") + verify(mex, never()).setVariable("parentServiceInstanceIdTXC", "homeB") + } + + @Test + // @Ignore + public void prepareCreateAllottedResourceTXC_Ex() { + ExecutionEntity mex = setupMock() + initPrepareCreateAllottedResourceTXC(mex) + + when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareCreateAllottedResourceTXC(mex) })) + } + + + // ***** prepareCreateAllottedResourceBRG ***** + + @Test + // @Ignore + public void prepareCreateAllottedResourceBRG() { + ExecutionEntity mex = setupMock() + initPrepareCreateAllottedResourceBRG(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.prepareCreateAllottedResourceBRG(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex).setVariable("createBRGAR", true) + verify(mex).setVariable("allottedResourceModelInfoBRG", "modelB") + verify(mex).setVariable("allottedResourceRoleBRG", "BRGr") + verify(mex).setVariable("allottedResourceTypeBRG", "BRG") + verify(mex).setVariable("parentServiceInstanceIdBRG", "homeB") + } + + @Test + // @Ignore + public void prepareCreateAllottedResourceBRG_NullArList() { + ExecutionEntity mex = setupMock() + def svcdecomp = initPrepareCreateAllottedResourceBRG(mex) + + when(svcdecomp.getAllottedResources()).thenReturn(null) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.prepareCreateAllottedResourceBRG(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex, never()).setVariable("createBRGAR", true) + verify(mex, never()).setVariable("allottedResourceModelInfoBRG", "modelB") + verify(mex, never()).setVariable("allottedResourceRoleBRG", "BRGr") + verify(mex, never()).setVariable("allottedResourceTypeBRG", "BRG") + verify(mex, never()).setVariable("parentServiceInstanceIdBRG", "homeB") + } + + @Test + // @Ignore + public void prepareCreateAllottedResourceBRG_Ex() { + ExecutionEntity mex = setupMock() + initPrepareCreateAllottedResourceBRG(mex) + + when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareCreateAllottedResourceBRG(mex) })) + } + + + // ***** prepareVnfAndModulesCreate ***** + + @Test + // @Ignore + public void prepareVnfAndModulesCreate() { + ExecutionEntity mex = setupMock() + initPrepareVnfAndModulesCreate(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.prepareVnfAndModulesCreate(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + verify(mex).setVariable("lcpCloudRegionId", "mdt1") + verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba") + } + + @Test + // @Ignore + public void prepareVnfAndModulesCreate_EmptyList() { + ExecutionEntity mex = setupMock() + initPrepareVnfAndModulesCreate(mex) + + when(mex.getVariable("vnfList")).thenReturn(new LinkedList()) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.prepareVnfAndModulesCreate(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + verify(mex).setVariable("lcpCloudRegionId", "mdt1") + verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba") + } + + @Test + // @Ignore + public void prepareVnfAndModulesCreate_NullList() { + ExecutionEntity mex = setupMock() + initPrepareVnfAndModulesCreate(mex) + + when(mex.getVariable("vnfList")).thenReturn(null) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.prepareVnfAndModulesCreate(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + verify(mex).setVariable("lcpCloudRegionId", "mdt1") + verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba") + } + + @Test + // @Ignore + public void prepareVnfAndModulesCreate_Ex() { + ExecutionEntity mex = setupMock() + initPrepareVnfAndModulesCreate(mex) + + when(mex.getVariable("vnfList")).thenThrow(new RuntimeException("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareVnfAndModulesCreate(mex) })) + } + + + // ***** validateVnfCreate ***** + + @Test + // @Ignore + public void validateVnfCreate() { + ExecutionEntity mex = setupMock() + initValidateVnfCreate(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.validateVnfCreate(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex).setVariable(Prefix+"VnfsCreatedCount", 3) + } + + @Test + // @Ignore + public void validateVnfCreate_Ex() { + ExecutionEntity mex = setupMock() + initValidateVnfCreate(mex) + + when(mex.getVariable(Prefix+"VnfsCreatedCount")).thenThrow(new RuntimeException("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.validateVnfCreate(mex) })) + } + + + // ***** postProcessResponse ***** + + @Test + // @Ignore + public void postProcessResponse() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPostProcessResponse(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.postProcessResponse(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex).setVariable(Prefix+"Success", true) + + def reqinfo = map.get(Prefix+"CompleteMsoProcessRequest") + + assertTrue(reqinfo.indexOf("request-id>mri= 0) + assertTrue(reqinfo.indexOf("source>mysrc= 0) + assertTrue(reqinfo.indexOf("serviceInstanceId>sii= 0) + } + + @Test + // @Ignore + public void postProcessResponse_BpmnError() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPostProcessResponse(mex) + + when(mex.getVariable("source")).thenThrow(new BpmnError("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessResponse(mex) })) + } + + @Test + // @Ignore + public void postProcessResponse_Ex() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPostProcessResponse(mex) + + when(mex.getVariable("source")).thenThrow(new RuntimeException("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessResponse(mex) })) + } + + + // ***** preProcessRollback ***** + + @Test + // @Ignore + public void preProcessRollback() { + ExecutionEntity mex = setupMock() + def wfe = initPreProcessRollback(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.preProcessRollback(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex).setVariable("prevWorkflowException", wfe) + } + + @Test + // @Ignore + public void preProcessRollback_NullWfe() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + def wfe = initPreProcessRollback(mex) + + when(mex.getVariable("WorkflowException")).thenReturn(null) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.preProcessRollback(mex) + + verify(mex).getVariable(DBGFLAG) + + assertFalse(map.containsKey("prevWorkflowException")) + } + + @Test + // @Ignore + public void preProcessRollback_BpmnError() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + def wfe = initPreProcessRollback(mex) + + when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.preProcessRollback(mex) + + verify(mex).getVariable(DBGFLAG) + + assertFalse(map.containsKey("prevWorkflowException")) + } + + @Test + // @Ignore + public void preProcessRollback_Ex() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + def wfe = initPreProcessRollback(mex) + + when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.preProcessRollback(mex) + + verify(mex).getVariable(DBGFLAG) + + assertFalse(map.containsKey("prevWorkflowException")) + } + + + // ***** postProcessRollback ***** + + @Test + // @Ignore + public void postProcessRollback() { + ExecutionEntity mex = setupMock() + def wfe = initPostProcessRollback(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.postProcessRollback(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex).setVariable("WorkflowException", wfe) + } + + @Test + // @Ignore + public void postProcessRollback_NullWfe() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + def wfe = initPostProcessRollback(mex) + + when(mex.getVariable("prevWorkflowException")).thenReturn(null) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.postProcessRollback(mex) + + verify(mex).getVariable(DBGFLAG) + + assertFalse(map.containsKey("WorkflowException")) + } + + @Test + // @Ignore + public void postProcessRollback_BpmnError() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + def wfe = initPostProcessRollback(mex) + + when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessRollback(mex) })) + } + + @Test + // @Ignore + public void postProcessRollback_Ex() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + def wfe = initPostProcessRollback(mex) + + when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.postProcessRollback(mex) + + verify(mex).getVariable(DBGFLAG) + + assertFalse(map.containsKey("WorkflowException")) + } + + + // ***** prepareFalloutRequest ***** + + @Test + // @Ignore + public void prepareFalloutRequest() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPrepareFalloutRequest(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.prepareFalloutRequest(mex) + + verify(mex, times(2)).getVariable(DBGFLAG) + + def fo = map.get(Prefix+"falloutRequest") + + assertTrue(fo.indexOf("world= 0) + assertTrue(fo.indexOf("ErrorMessage>mymsg= 0) + assertTrue(fo.indexOf("ErrorCode>999= 0) + } + + @Test + // @Ignore + public void prepareFalloutRequest_Ex() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPrepareFalloutRequest(mex) + + when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareFalloutRequest(mex) })) + } + + // ***** sendSyncError ***** + + @Test + // @Ignore + public void sendSyncError() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initSendSyncError(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.sendSyncError(mex) + + verify(mex, times(2)).getVariable(DBGFLAG) + + verify(mex).setVariable(processName+"WorkflowResponseSent", "true") + + assertEquals("500", map.get(processName+"ResponseCode")) + assertEquals("Fail", map.get(processName+"Status")) + + def resp = map.get(processName+"Response") + + assertTrue(resp.indexOf("ErrorMessage>mymsg= 0) + + verify(mex).setVariable("WorkflowResponse", resp) + } + + @Test + // @Ignore + public void sendSyncError_NotWfe() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initSendSyncError(mex) + + when(mex.getVariable("WorkflowException")).thenReturn("not a WFE") + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.sendSyncError(mex) + + verify(mex, times(2)).getVariable(DBGFLAG) + + verify(mex).setVariable(processName+"WorkflowResponseSent", "true") + + assertEquals("500", map.get(processName+"ResponseCode")) + assertEquals("Fail", map.get(processName+"Status")) + + def resp = map.get(processName+"Response") + + assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.= 0) + + verify(mex).setVariable("WorkflowResponse", resp) + } + + @Test + // @Ignore + public void sendSyncError_NullWfe() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initSendSyncError(mex) + + when(mex.getVariable("WorkflowException")).thenReturn(null) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.sendSyncError(mex) + + verify(mex, times(2)).getVariable(DBGFLAG) + + verify(mex).setVariable(processName+"WorkflowResponseSent", "true") + + assertEquals("500", map.get(processName+"ResponseCode")) + assertEquals("Fail", map.get(processName+"Status")) + + def resp = map.get(processName+"Response") + + assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.= 0) + + verify(mex).setVariable("WorkflowResponse", resp) + } + + @Test + // @Ignore + public void sendSyncError_Ex() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initSendSyncError(mex) + + when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + CreateVcpeResCustService.sendSyncError(mex) + + assertFalse(map.containsKey(processName+"ResponseCode")) + } + + + // ***** processJavaException ***** + + @Test + // @Ignore + public void processJavaException() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initProcessJavaException(mex) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.processJavaException(mex) })) + + verify(mex, times(2)).getVariable(DBGFLAG) + + verify(mex).setVariable("prefix", Prefix) + + def wfe = map.get("WorkflowException") + + assertEquals("Caught a Java Lang Exception", wfe.getErrorMessage()) + } + + @Test + // @Ignore + public void processJavaException_BpmnError() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initProcessJavaException(mex) + + when(mex.getVariables()).thenThrow(new BpmnError("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.processJavaException(mex) })) + + assertFalse(map.containsKey("WorkflowException")) + } + + @Test + // @Ignore + public void processJavaException_Ex() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initProcessJavaException(mex) + + when(mex.getVariables()).thenThrow(new RuntimeException("expected exception")) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.processJavaException(mex) })) + + def wfe = map.get("WorkflowException") + + assertEquals("Exception in processJavaException method", wfe.getErrorMessage()) + } + + + private void initPreProcess(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("bpmnRequest")).thenReturn(request) + when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("aaidelay") + when(mex.getVariable("mso-request-id")).thenReturn("mri") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("requestAction")).thenReturn("ra") + } + + private initSendSyncResponse(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("mso-request-id")).thenReturn("mri") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + } + + private void initPrepareDecomposeService(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("createVcpeServiceRequest")).thenReturn('{"requestDetails":{"modelInfo":"mi"}}') + } + + private void initPrepareCreateServiceInstance(ExecutionEntity mex) { + ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class) + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request) + when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp) + + when(svcdecomp.toJsonStringNoRootName()).thenReturn("mydecomp") + } + + private void initPostProcessServiceInstanceCreate(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("mso-request-id")).thenReturn("mri") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("serviceInstanceName")).thenReturn("sin") + } + + private ServiceDecomposition initProcessDecomposition(ExecutionEntity mex) { + List vnflst = new LinkedList<>() + vnflst.add(makeVnf("", "")) + vnflst.add(makeVnf("2", "BRG")) + vnflst.add(makeVnf("3", "BRG")) + + ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class) + when(svcdecomp.getVnfResources()).thenReturn(vnflst) + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp) + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("serviceInstanceName")).thenReturn("sin") + + return svcdecomp + } + + private ServiceDecomposition initFilterVnfs(ExecutionEntity mex) { + List vnflst = new LinkedList<>() + vnflst.add(makeVnf("", "BRG")) + vnflst.add(makeVnf("2", "Tunnel XConn")) + vnflst.add(makeVnf("3", "")) + vnflst.add(makeVnf("4", "BRG")) + vnflst.add(makeVnf("5", "other")) + + ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class) + when(svcdecomp.getVnfResources()).thenReturn(vnflst) + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp) + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("serviceInstanceName")).thenReturn("sin") + + return svcdecomp + } + + private initAwaitAaiDistribution(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + } + + private ServiceDecomposition initPrepareCreateAllottedResourceTXC(ExecutionEntity mex) { + ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class) + List arlst = new LinkedList<>() + + arlst.add(makeArBRG("A")) + arlst.add(makeArTXC("B")) + arlst.add(makeArBRG("C")) + + when(svcdecomp.getAllottedResources()).thenReturn(arlst) + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request) + when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp) + when(mex.getVariable("allottedResourceId")).thenReturn(ARID) + + return svcdecomp + } + + private ServiceDecomposition initPrepareCreateAllottedResourceBRG(ExecutionEntity mex) { + ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class) + List arlst = new LinkedList<>() + + arlst.add(makeArTXC("A")) + arlst.add(makeArBRG("B")) + arlst.add(makeArTXC("C")) + + when(svcdecomp.getAllottedResources()).thenReturn(arlst) + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request) + when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp) + when(mex.getVariable("allottedResourceId")).thenReturn(ARID) + + return svcdecomp + } + + private AllottedResource makeArTXC(String id) { + AllottedResource ar = mock(AllottedResource.class) + ModelInfo mod = mock(ModelInfo.class) + HomingSolution home = mock(HomingSolution.class) + + when(ar.toJsonStringNoRootName()).thenReturn("json"+id) + when(ar.getAllottedResourceType()).thenReturn("Tunnel XConn") + when(ar.getModelInfo()).thenReturn(mod) + when(ar.getAllottedResourceRole()).thenReturn("TXCr") + when(ar.getHomingSolution()).thenReturn(home) + + when(mod.toJsonStringNoRootName()).thenReturn("model"+id) + + when(home.getServiceInstanceId()).thenReturn("home"+id) + + return ar + } + + private AllottedResource makeArBRG(String id) { + AllottedResource ar = mock(AllottedResource.class) + ModelInfo mod = mock(ModelInfo.class) + HomingSolution home = mock(HomingSolution.class) + + when(ar.toJsonStringNoRootName()).thenReturn("json"+id) + when(ar.getAllottedResourceType()).thenReturn("BRG") + when(ar.getModelInfo()).thenReturn(mod) + when(ar.getAllottedResourceRole()).thenReturn("BRGr") + when(ar.getHomingSolution()).thenReturn(home) + + when(mod.toJsonStringNoRootName()).thenReturn("model"+id) + + when(home.getServiceInstanceId()).thenReturn("home"+id) + + return ar + } + + private initPrepareVnfAndModulesCreate(ExecutionEntity mex) { + + List vnflst = new LinkedList<>() + + vnflst.add(makeVnf("A", "BRG")) + vnflst.add(makeVnf("B", "")) + vnflst.add(makeVnf("C", "")) + vnflst.add(makeVnf("D", "Tunnel XConn")) + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request) + when(mex.getVariable("vnfList")).thenReturn(vnflst) + when(mex.getVariable(Prefix+"VnfsCreatedCount")).thenReturn(2) + when(mex.getVariable("vnfModelInfo")).thenReturn("nomodel") + when(mex.getVariable("sdncVersion")).thenReturn("myvers") + } + + private VnfResource makeVnf(String id, String role) { + ModelInfo mod = mock(ModelInfo.class) + VnfResource vnf = mock(VnfResource.class) + + when(mod.toString()).thenReturn('{"modelInfo":"mymodel'+id+'"}') + + when(vnf.toString()).thenReturn("myvnf"+id) + when(vnf.getModelInfo()).thenReturn(mod) + when(vnf.getNfRole()).thenReturn(role) + + return vnf + } + + private initValidateVnfCreate(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable(Prefix+"VnfsCreatedCount")).thenReturn(2) + } + + private initPostProcessResponse(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("source")).thenReturn("mysrc") + when(mex.getVariable("mso-request-id")).thenReturn("mri") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + } + + private WorkflowException initPreProcessRollback(ExecutionEntity mex) { + WorkflowException wfe = mock(WorkflowException.class) + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("WorkflowException")).thenReturn(wfe) + + return wfe + } + + private WorkflowException initPostProcessRollback(ExecutionEntity mex) { + WorkflowException wfe = mock(WorkflowException.class) + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("prevWorkflowException")).thenReturn(wfe) + + return wfe + } + + private initPrepareFalloutRequest(ExecutionEntity mex) { + WorkflowException wfe = mock(WorkflowException.class) + + when(wfe.getErrorMessage()).thenReturn("mymsg") + when(wfe.getErrorCode()).thenReturn(999) + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("WorkflowException")).thenReturn(wfe) + when(mex.getVariable(Prefix+"requestInfo")).thenReturn("world") + + return wfe + } + + private initSendSyncError(ExecutionEntity mex) { + WorkflowException wfe = mock(WorkflowException.class) + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("mso-request-id")).thenReturn("mri") + when(mex.getVariable("WorkflowException")).thenReturn(wfe) + + when(wfe.getErrorMessage()).thenReturn("mymsg") + } + + private initProcessJavaException(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy new file mode 100644 index 0000000000..b7c754938a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy @@ -0,0 +1,773 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.vcpe.scripts + + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Rule +import org.junit.Test +import org.junit.Ignore +import org.mockito.MockitoAnnotations +import org.camunda.bpm.engine.delegate.BpmnError +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse +import static com.github.tomakehurst.wiremock.client.WireMock.get +import static com.github.tomakehurst.wiremock.client.WireMock.patch +import static com.github.tomakehurst.wiremock.client.WireMock.put +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching +import static org.junit.Assert.*; +import static org.mockito.Mockito.* +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.domain.AllottedResource +import org.onap.so.bpmn.core.domain.ModelInfo + +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.vcpe.scripts.MapGetter +import org.onap.so.bpmn.vcpe.scripts.MapSetter + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +class DeleteVcpeResCustServiceTest extends GroovyTestBase { + + private static String request + + @Rule + public WireMockRule wireMockRule = new WireMockRule(PORT) + + String Prefix = "DVRCS_" + String RbType = "DCRENI_" + + @BeforeClass + public static void setUpBeforeClass() { + request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json") + } + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + public DeleteVcpeResCustServiceTest() { + super("DeleteVcpeResCustService") + } + + + // ***** preProcessRequest ***** + + @Test +// @Ignore + public void preProcessRequest() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + DeleteVcpeResCustService.preProcessRequest(mex) + + verify(mex).getVariable(DBGFLAG) + + assertEquals(Prefix, map.get("prefix")) + assertEquals(request, map.get("DeleteVcpeResCustServiceRequest")) + assertEquals("mri", map.get("msoRequestId")) + assertEquals("ra", map.get("requestAction")) + assertEquals("VID", map.get("source")) + assertEquals(CUST, map.get("globalSubscriberId")) + assertEquals(CUST, map.get("globalCustomerId")) + assertEquals("false", map.get("disableRollback")) + assertEquals("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", map.get("productFamilyId")) + assertEquals(SVC, map.get("subscriptionServiceType")) + + assertEquals("mdt1", map.get("lcpCloudRegionId")) + assertEquals("8b1df54faa3b49078e3416e21370a3ba", map.get("tenantId")) + assertEquals("1707", map.get("sdncVersion")) + assertEquals("service-instance", map.get("GENGS_type")) + assertEquals("""{"tenantId":"8b1df54faa3b49078e3416e21370a3ba","lcpCloudRegionId":"mdt1"}""", map.get("cloudConfiguration")) + assertTrue(map.containsKey(Prefix+"requestInfo")) + + def reqinfo = map.get(Prefix+"requestInfo") + assertTrue(reqinfo.indexOf("mri= 0) + assertTrue(reqinfo.indexOf("VID= 0) + } + + @Test +// @Ignore + public void preProcessRequest_EmptyParts() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + + def req = request + .replace('"source"', '"sourceXXX"') + + when(mex.getVariable("bpmnRequest")).thenReturn(req) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + DeleteVcpeResCustService.preProcessRequest(mex) + + verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("prefix", Prefix) + verify(mex).setVariable("DeleteVcpeResCustServiceRequest", req) + verify(mex).setVariable("msoRequestId", "mri") + verify(mex).setVariable("requestAction", "ra") + verify(mex).setVariable("source", "VID") + verify(mex).setVariable("globalSubscriberId", CUST) + verify(mex).setVariable("globalCustomerId", CUST) + verify(mex).setVariable("disableRollback", "false") + verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + verify(mex).setVariable("subscriptionServiceType", SVC) + + verify(mex).setVariable("lcpCloudRegionId", "mdt1") + verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba") + assertEquals("""{"tenantId":"8b1df54faa3b49078e3416e21370a3ba","lcpCloudRegionId":"mdt1"}""", map.get("cloudConfiguration")) + verify(mex).setVariable("sdncVersion", "1707") + verify(mex).setVariable("GENGS_type", "service-instance") + assertTrue(map.containsKey(Prefix+"requestInfo")) + + def reqinfo = map.get(Prefix+"requestInfo") + println reqinfo + assertTrue(reqinfo.indexOf("mri= 0) + assertTrue(reqinfo.indexOf("VID= 0) + } + + @Test +// @Ignore + public void preProcessRequest_MissingServiceInstanceId() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("serviceInstanceId")).thenReturn(null) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + + assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.preProcessRequest(mex) })) + } + + @Test +// @Ignore + public void preProcessRequest_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("bpmnRequest")).thenThrow(new BpmnError("expected exception")) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + + assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.preProcessRequest(mex) })) + } + + @Test +// @Ignore + public void preProcessRequest_Ex() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("bpmnRequest")).thenThrow(new RuntimeException("expected exception")) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + + assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.preProcessRequest(mex) })) + } + + private void initPreProcess(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("bpmnRequest")).thenReturn(request) + when(mex.getVariable("mso-request-id")).thenReturn("mri") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("requestAction")).thenReturn("ra") + } + + // ***** sendSyncResponse ***** + + @Test +// @Ignore + public void sendSyncResponse() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initSendSyncResponse(mex) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + DeleteVcpeResCustService.sendSyncResponse(mex) + + verify(mex, times(2)).getVariable(DBGFLAG) + + verify(mex).setVariable(processName+"WorkflowResponseSent", "true") + + assertEquals("202", map.get(processName+"ResponseCode")) + assertEquals("Success", map.get(processName+"Status")) + + def resp = map.get(processName+"Response") + + assertTrue(resp.indexOf('"instanceId":"sii"') >= 0) + assertTrue(resp.indexOf('"requestId":"mri"') >= 0) + } + + @Test +// @Ignore + public void sendSyncResponse_Ex() { + ExecutionEntity mex = setupMock() + initSendSyncResponse(mex) + + when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception")) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + + assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.sendSyncResponse(mex) })) + } + + private initSendSyncResponse(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("mso-request-id")).thenReturn("mri") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + } + + // ***** prepareServiceDelete ***** + + @Test +// @Ignore + public void prepareServiceDelete() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPrepareServiceDelete(mex) + + myMockGetAr("/aai/v11/anytxc", 200, "arGetTXCById.xml"); + myMockGetAr("/aai/v11/anybrg", 200, "arGetBRGById.xml"); + myMockGetAr("/aai/v11/other", 200, "arGetOtherById.xml"); + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + DeleteVcpeResCustService.prepareServiceDelete(mex) + + verify(mex).setVariable(Prefix+"TunnelXConn", true) + assertEquals("ar-txcA", map.get("TXC_allottedResourceId")) + + verify(mex).setVariable(Prefix+"BRG", true) + assertEquals("ar-brgB", map.get("BRG_allottedResourceId")) + + verify(mex).setVariable(Prefix+"vnfsCount", 2) + assertNotNull(map.get(Prefix+"relatedVnfIdList")) + assertEquals("[vnfX, vnfY]", map.get(Prefix+"relatedVnfIdList").toString()) + + verify(mex, never()).setVariable(processName+"WorkflowResponseSent", "true") + } + + @Test +// @Ignore + public void prepareServiceDelete_NotFound() { + ExecutionEntity mex = setupMock() + initPrepareServiceDelete(mex) + + when(mex.getVariable("GENGS_FoundIndicator")).thenReturn(false) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + + assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareServiceDelete(mex) })) + + verify(mex, never()).setVariable(processName+"WorkflowResponseSent", "true") + } + + @Test +// @Ignore + public void prepareServiceDelete_Empty() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPrepareServiceDelete(mex) + + when(mex.getVariable("GENGS_service")).thenReturn("") + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + DeleteVcpeResCustService.prepareServiceDelete(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex).setVariable(Prefix+"TunnelXConn", false) + assertNull(map.get("TXC_allottedResourceId")) + + verify(mex).setVariable(Prefix+"BRG", false) + assertNull(map.get("BRG_allottedResourceId")) + + assertEquals(0, map.get(Prefix+"vnfsCount")) + assertFalse(map.containsKey(Prefix+"relatedVnfIdList")) + + verify(mex, never()).setVariable(processName+"WorkflowResponseSent", "true") + } + + @Test +// @Ignore + public void prepareServiceDelete_BpmnError() { + ExecutionEntity mex = setupMock() + initPrepareServiceDelete(mex) + + when(mex.getVariable("GENGS_FoundIndicator")).thenThrow(new BpmnError("expected exception")) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + + assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareServiceDelete(mex) })) + + verify(mex, never()).setVariable(processName+"WorkflowResponseSent", "true") + } + + @Test +// @Ignore + public void prepareServiceDelete_Ex() { + ExecutionEntity mex = setupMock() + initPrepareServiceDelete(mex) + + when(mex.getVariable("GENGS_FoundIndicator")).thenThrow(new RuntimeException("expected exception")) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + + assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareServiceDelete(mex) })) + + verify(mex).setVariable(processName+"WorkflowResponseSent", "true") + } + + private initPrepareServiceDelete(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("GENGS_FoundIndicator")).thenReturn(true) + when(mex.getVariable("mso-request-id")).thenReturn("mri") + when(mex.getVariable("DeleteVcpeResCustServiceRequest")).thenReturn(request) + when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) + when(mex.getVariable("GENGS_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml")) + } + + // ***** getAaiAr ***** + + @Test +// @Ignore + public void getAaiAr() { + myMockGetAr("/myurl/ar1", 200, "arGetBRGById.xml"); + + ExecutionEntity mex = setupMock() + initGetAaiAr(mex) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + def (type, id) = DeleteVcpeResCustService.getAaiAr(mex, "/myurl/ar1") + + assertEquals("BRG", type) + assertEquals("ar-brgB", id) + } + + @Test +// @Ignore + public void getAaiAr_401() { + myMockGetAr("/myurl/ar1", 401, "arGetBRGById.xml"); + + ExecutionEntity mex = setupMock() + initGetAaiAr(mex) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + def (type, id) = DeleteVcpeResCustService.getAaiAr(mex, "/myurl/ar1") + + assertEquals(null, type) + assertEquals(null, id) + } + + @Test +// @Ignore + public void getAaiAr_EmptyResponse() { + myMockGetAr("/myurl/ar1", 200, "empty.txt"); + + ExecutionEntity mex = setupMock() + initGetAaiAr(mex) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + def (type, id) = DeleteVcpeResCustService.getAaiAr(mex, "/myurl/ar1") + + assertEquals(null, type) + assertEquals(null, id) + } + + private void initGetAaiAr(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) + } + + // ***** prepareVnfAndModulesDelete ***** + + @Test +// @Ignore + public void prepareVnfAndModulesDelete() { + ExecutionEntity mex = setupMock() + initPrepareVnfAndModulesDelete(mex) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + DeleteVcpeResCustService.prepareVnfAndModulesDelete(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex).setVariable("vnfId", "vnfB") + } + + @Test +// @Ignore + public void prepareVnfAndModulesDelete_Empty() { + ExecutionEntity mex = setupMock() + initPrepareVnfAndModulesDelete(mex) + + when(mex.getVariable(Prefix+"relatedVnfIdList")).thenReturn(new LinkedList()) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + DeleteVcpeResCustService.prepareVnfAndModulesDelete(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex).setVariable("vnfId", "") + } + + @Test +// @Ignore + public void prepareVnfAndModulesDelete_Ex() { + ExecutionEntity mex = setupMock() + initPrepareVnfAndModulesDelete(mex) + + when(mex.getVariable(Prefix+"relatedVnfIdList")).thenThrow(new RuntimeException("expected exception")) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + + assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareVnfAndModulesDelete(mex) })) + } + + private initPrepareVnfAndModulesDelete(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable(Prefix+"relatedVnfIdList")).thenReturn(Arrays.asList("vnfA", "vnfB", "vnfC")) + when(mex.getVariable(Prefix+"vnfsDeletedCount")).thenReturn(1) + } + + // ***** validateVnfDelete ***** + + @Test +// @Ignore + public void validateVnfDelete() { + ExecutionEntity mex = setupMock() + initValidateVnfDelete(mex) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + DeleteVcpeResCustService.validateVnfDelete(mex) + + verify(mex).getVariable(DBGFLAG) + + verify(mex).setVariable(Prefix+"vnfsDeletedCount", 3) + } + + @Test +// @Ignore + public void validateVnfDelete_Ex() { + ExecutionEntity mex = setupMock() + initValidateVnfDelete(mex) + + when(mex.getVariable(Prefix+"vnfsDeletedCount")).thenThrow(new RuntimeException("expected exception")) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + + assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.validateVnfDelete(mex) })) + } + + private initValidateVnfDelete(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable(Prefix+"vnfsDeletedCount")).thenReturn(2) + } + + // ***** postProcessResponse ***** + + @Test +// @Ignore + public void postProcessResponse() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPostProcessResponse(mex) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + DeleteVcpeResCustService.postProcessResponse(mex) + + verify(mex).getVariable(DBGFLAG) + + assertEquals(true, map.get(Prefix+"Success")) + + def req = map.get(Prefix+"CompleteMsoProcessRequest") + + assertTrue(req.indexOf("mri= 0) + assertTrue(req.indexOf("mysrc= 0) + } + + @Test +// @Ignore + public void postProcessResponse_BpmnError() { + ExecutionEntity mex = setupMock() + initPostProcessResponse(mex) + + when(mex.getVariable("source")).thenThrow(new BpmnError("expected exception")) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + + assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.postProcessResponse(mex) })) + } + + @Test +// @Ignore + public void postProcessResponse_Ex() { + ExecutionEntity mex = setupMock() + initPostProcessResponse(mex) + + when(mex.getVariable("source")).thenThrow(new RuntimeException("expected exception")) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + + assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.postProcessResponse(mex) })) + } + + private initPostProcessResponse(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("source")).thenReturn("mysrc") + when(mex.getVariable("msoRequestId")).thenReturn("mri") + } + + + // ***** prepareFalloutRequest ***** + + @Test +// @Ignore + public void prepareFalloutRequest() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPrepareFalloutRequest(mex) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + DeleteVcpeResCustService.prepareFalloutRequest(mex) + + verify(mex, times(2)).getVariable(DBGFLAG) + + def fo = map.get(Prefix+"falloutRequest") + + assertTrue(fo.indexOf("world= 0) + assertTrue(fo.indexOf("ErrorMessage>mymsg= 0) + assertTrue(fo.indexOf("ErrorCode>999= 0) + } + + @Test +// @Ignore + public void prepareFalloutRequest_Ex() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPrepareFalloutRequest(mex) + + when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + + assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.prepareFalloutRequest(mex) })) + } + + private initPrepareFalloutRequest(ExecutionEntity mex) { + WorkflowException wfe = mock(WorkflowException.class) + + when(wfe.getErrorMessage()).thenReturn("mymsg") + when(wfe.getErrorCode()).thenReturn(999) + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("WorkflowException")).thenReturn(wfe) + when(mex.getVariable(Prefix+"requestInfo")).thenReturn("world") + + return wfe + } + + // ***** sendSyncError ***** + + @Test +// @Ignore + public void sendSyncError() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initSendSyncError(mex) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + DeleteVcpeResCustService.sendSyncError(mex) + + verify(mex, times(2)).getVariable(DBGFLAG) + + verify(mex).setVariable(processName+"WorkflowResponseSent", "true") + + assertEquals("500", map.get(processName+"ResponseCode")) + assertEquals("Fail", map.get(processName+"Status")) + + def resp = map.get(processName+"Response") + + assertTrue(resp.indexOf("ErrorMessage>mymsg= 0) + + verify(mex).setVariable("WorkflowResponse", resp) + } + + @Test +// @Ignore + public void sendSyncError_NotWfe() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initSendSyncError(mex) + + when(mex.getVariable("WorkflowException")).thenReturn("not a WFE") + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + DeleteVcpeResCustService.sendSyncError(mex) + + verify(mex, times(2)).getVariable(DBGFLAG) + + verify(mex).setVariable(processName+"WorkflowResponseSent", "true") + + assertEquals("500", map.get(processName+"ResponseCode")) + assertEquals("Fail", map.get(processName+"Status")) + + def resp = map.get(processName+"Response") + + assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.= 0) + + verify(mex).setVariable("WorkflowResponse", resp) + } + + @Test +// @Ignore + public void sendSyncError_NullWfe() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initSendSyncError(mex) + + when(mex.getVariable("WorkflowException")).thenReturn(null) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + DeleteVcpeResCustService.sendSyncError(mex) + + verify(mex, times(2)).getVariable(DBGFLAG) + + verify(mex).setVariable(processName+"WorkflowResponseSent", "true") + + assertEquals("500", map.get(processName+"ResponseCode")) + assertEquals("Fail", map.get(processName+"Status")) + + def resp = map.get(processName+"Response") + + assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.= 0) + + verify(mex).setVariable("WorkflowResponse", resp) + } + + @Test +// @Ignore + public void sendSyncError_Ex() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initSendSyncError(mex) + + when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + + DeleteVcpeResCustService.sendSyncError(mex) + + assertFalse(map.containsKey(processName+"ResponseCode")) + } + + private initSendSyncError(ExecutionEntity mex) { + WorkflowException wfe = mock(WorkflowException.class) + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("mso-request-id")).thenReturn("mri") + when(mex.getVariable("WorkflowException")).thenReturn(wfe) + + when(wfe.getErrorMessage()).thenReturn("mymsg") + } + + + // ***** processJavaException ***** + + @Test +// @Ignore + public void processJavaException() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initProcessJavaException(mex) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + + assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.processJavaException(mex) })) + + verify(mex, times(2)).getVariable(DBGFLAG) + + verify(mex).setVariable("prefix", Prefix) + + def wfe = map.get("WorkflowException") + + assertEquals("Caught a Java Lang Exception", wfe.getErrorMessage()) + } + + @Test +// @Ignore + public void processJavaException_BpmnError() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initProcessJavaException(mex) + + when(mex.getVariables()).thenThrow(new BpmnError("expected exception")) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + + assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.processJavaException(mex) })) + + assertFalse(map.containsKey("WorkflowException")) + } + + @Test +// @Ignore + public void processJavaException_Ex() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initProcessJavaException(mex) + + when(mex.getVariables()).thenThrow(new RuntimeException("expected exception")) + + DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService() + + assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.processJavaException(mex) })) + + def wfe = map.get("WorkflowException") + + assertEquals("Exception in processJavaException method", wfe.getErrorMessage()) + } + + private initProcessJavaException(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + } + + private void myMockGetAr(String url, int status, String fileResp) { + stubFor(get(urlMatching(url)) + .willReturn(aResponse() + .withStatus(status) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VCPE/DeleteVcpeResCustService/" + fileResp))); + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy new file mode 100644 index 0000000000..1e8842e68f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy @@ -0,0 +1,654 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe.scripts + + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Rule +import org.junit.Test +import org.junit.Ignore +import org.mockito.MockitoAnnotations +import org.camunda.bpm.engine.delegate.BpmnError +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse +import static com.github.tomakehurst.wiremock.client.WireMock.get +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching +import static org.junit.Assert.*; +import static org.mockito.Mockito.* +import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource + +import org.onap.so.bpmn.core.RollbackData + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(PORT) + + String Prefix = "DCARBRGRB_" + String RbType = "DCARBRG_" + + @BeforeClass + public static void setUpBeforeClass() { + super.setUpBeforeClass() + } + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + public DoCreateAllottedResourceBRGRollbackTest() { + super("DoCreateAllottedResourceBRGRollback") + } + + + // ***** preProcessRequest ***** + + @Test +// @Ignore + public void preProcessRequest() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) + + ////verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("prefix", Prefix) + verify(mex).setVariable("serviceInstanceId", "sii") + verify(mex).setVariable("parentServiceInstanceId", "psii") + verify(mex).setVariable("allottedResourceId", "myid") + verify(mex).setVariable("rollbackAAI", true) + verify(mex).setVariable("aaiARPath", "mypath") + verify(mex).setVariable("rollbackSDNC", true) + verify(mex).setVariable("deactivateSdnc", "myactivate") + verify(mex).setVariable("deleteSdnc", "mycreate") + verify(mex).setVariable("unassignSdnc", "true") + verify(mex).setVariable("sdncDeactivateRequest", "activatereq") + verify(mex).setVariable("sdncDeleteRequest", "createreq") + verify(mex).setVariable("sdncUnassignRequest", "assignreq") + + verify(mex, never()).setVariable("skipRollback", true) + } + + @Test +// @Ignore + public void preProcessRequest_RollbackDisabled() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("disableRollback")).thenReturn("true") + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) + + ////verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("prefix", Prefix) + verify(mex).setVariable("serviceInstanceId", "sii") + verify(mex).setVariable("parentServiceInstanceId", "psii") + verify(mex).setVariable("allottedResourceId", "myid") + verify(mex).setVariable("rollbackAAI", true) + verify(mex).setVariable("aaiARPath", "mypath") + verify(mex).setVariable("rollbackSDNC", true) + verify(mex).setVariable("deactivateSdnc", "myactivate") + verify(mex).setVariable("deleteSdnc", "mycreate") + verify(mex).setVariable("unassignSdnc", "true") + verify(mex).setVariable("sdncDeactivateRequest", "activatereq") + verify(mex).setVariable("sdncDeleteRequest", "createreq") + verify(mex).setVariable("sdncUnassignRequest", "assignreq") + + verify(mex).setVariable("skipRollback", true) + } + + @Test +// @Ignore + public void preProcessRequest_NoAAI() { + ExecutionEntity mex = setupMock() + def data = initPreProcess(mex) + + when(mex.getVariable("rollbackAAI")).thenReturn(false) + data.put(RbType, "rollbackAAI", "false") + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("prefix", Prefix) + verify(mex).setVariable("serviceInstanceId", "sii") + verify(mex).setVariable("parentServiceInstanceId", "psii") + verify(mex).setVariable("allottedResourceId", "myid") + verify(mex, never()).setVariable("rollbackAAI", true) + verify(mex, never()).setVariable("aaiARPath", "mypath") + verify(mex).setVariable("rollbackSDNC", true) + verify(mex).setVariable("deactivateSdnc", "myactivate") + verify(mex).setVariable("deleteSdnc", "mycreate") + verify(mex).setVariable("unassignSdnc", "true") + verify(mex).setVariable("sdncDeactivateRequest", "activatereq") + verify(mex).setVariable("sdncDeleteRequest", "createreq") + verify(mex).setVariable("sdncUnassignRequest", "assignreq") + + verify(mex, never()).setVariable("skipRollback", true) + } + + @Test +// @Ignore + public void preProcessRequest_NoAssign() { + ExecutionEntity mex = setupMock() + def data = initPreProcess(mex) + + when(mex.getVariable("rollbackSDNC")).thenReturn(false) + data.put(RbType, "rollbackSDNCassign", "false") + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("prefix", Prefix) + verify(mex).setVariable("serviceInstanceId", "sii") + verify(mex).setVariable("parentServiceInstanceId", "psii") + verify(mex).setVariable("allottedResourceId", "myid") + verify(mex).setVariable("rollbackAAI", true) + verify(mex).setVariable("aaiARPath", "mypath") + verify(mex, never()).setVariable("rollbackSDNC", true) + verify(mex, never()).setVariable("deactivateSdnc", "myactivate") + verify(mex, never()).setVariable("deleteSdnc", "mycreate") + verify(mex, never()).setVariable("unassignSdnc", "true") + verify(mex, never()).setVariable("sdncDeactivateRequest", "activatereq") + verify(mex, never()).setVariable("sdncDeleteRequest", "createreq") + verify(mex, never()).setVariable("sdncUnassignRequest", "assignreq") + + verify(mex, never()).setVariable("skipRollback", true) + } + + @Test +// @Ignore + public void preProcessRequest_NoAAI_NoAssign() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("rollbackAAI")).thenReturn(false) + when(mex.getVariable("rollbackSDNC")).thenReturn(false) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) + + verify(mex).setVariable("skipRollback", true) + } + + @Test +// @Ignore + public void preProcessRequest_NoRbStructure() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("rollbackData")).thenReturn(new RollbackData()) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) + + verify(mex).setVariable("skipRollback", true) + } + + @Test +// @Ignore + public void preProcessRequest_NullRb() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("rollbackData")).thenReturn(null) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) + + verify(mex).setVariable("skipRollback", true) + } + + @Test +// @Ignore + public void preProcessRequest_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) })) + } + + @Test +// @Ignore + public void preProcessRequest_Ex() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) })) + } + + @Test + @Ignore + public void updateAaiAROrchStatus() { + ExecutionEntity mex = setupMock() + initUpdateAaiAROrchStatus(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockPatchAllottedResource(CUST, SVC, INST, ARID) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success") + } + + @Test +// @Ignore + public void updateAaiAROrchStatus_EmptyResponse() { + ExecutionEntity mex = setupMock() + initUpdateAaiAROrchStatus(mex) + + wireMockRule + .stubFor(get(urlMatching("/aai/v[0-9]+/.*")) + .willReturn(aResponse() + .withStatus(200))) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success") })) + } + + @Test +// @Ignore + public void updateAaiAROrchStatus_NoArPath() { + ExecutionEntity mex = setupMock() + initUpdateAaiAROrchStatus(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockPatchAllottedResource(CUST, SVC, INST, ARID) + + when(mex.getVariable("aaiARPath")).thenReturn(null) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success") })) + } + + + // ***** validateSDNCResp ***** + + @Test +// @Ignore + public void validateSDNCResp() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + + DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") + + verify(mex).getVariable("WorkflowException") + verify(mex).getVariable("SDNCA_SuccessIndicator") + } + + @Test +// @Ignore + public void validateSDNCResp_Unsuccessful() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") })) + } + + @Test +// @Ignore + public void validateSDNCResp_BpmnError404() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) + + when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("404", "expected exception")) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + + DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") + } + + @Test +// @Ignore + public void validateSDNCResp_BpmnError() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) + + when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") })) + } + + @Test +// @Ignore + public void validateSDNCResp_Ex() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) + + when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") })) + } + + @Test + @Ignore + public void deleteAaiAR() { + ExecutionEntity mex = setupMock() + initDeleteAaiAR(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) + } + + @Test +// @Ignore + public void deleteAaiAR_NoArPath() { + ExecutionEntity mex = setupMock() + initDeleteAaiAR(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + + when(mex.getVariable("aaiARPath")).thenReturn("") + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) })) + } + + @Test +// @Ignore + public void deleteAaiAR_BpmnError() { + ExecutionEntity mex = setupMock() + initDeleteAaiAR(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + + when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) })) + } + + @Test +// @Ignore + public void deleteAaiAR_Ex() { + ExecutionEntity mex = setupMock() + initDeleteAaiAR(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + + when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) })) + } + + @Test +// @Ignore + public void postProcessRequest() { + ExecutionEntity mex = setupMock() + initPostProcessRequest(mex) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.postProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("rollbackData", null) + verify(mex).setVariable("rolledBack", true) + } + + @Test +// @Ignore + public void postProcessRequest_RolledBack() { + ExecutionEntity mex = setupMock() + initPostProcessRequest(mex) + + when(mex.getVariable("skipRollback")).thenReturn(true) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.postProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("rollbackData", null) + verify(mex, never()).setVariable("rolledBack", true) + } + + @Test +// @Ignore + public void postProcessRequest_BpmnError() { + ExecutionEntity mex = setupMock() + initPostProcessRequest(mex) + + when(mex.getVariable("skipRollback")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.postProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("rollbackData", null) + verify(mex, never()).setVariable("rolledBack", true) + } + + @Test +// @Ignore + public void postProcessRequest_Ex() { + ExecutionEntity mex = setupMock() + initPostProcessRequest(mex) + + when(mex.getVariable("skipRollback")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.postProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("rollbackData", null) + verify(mex, never()).setVariable("rolledBack", true) + } + + @Test +// @Ignore + public void processRollbackException() { + ExecutionEntity mex = setupMock() + initProcessRollbackException(mex) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.processRollbackException(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("rollbackData", null) + verify(mex).setVariable("rolledBack", false) + verify(mex).setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback") + verify(mex).setVariable("WorkflowException", null) + } + + @Test +// @Ignore + public void processRollbackException_BpmnError() { + ExecutionEntity mex = setupMock() + initProcessRollbackException(mex) + + doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.processRollbackException(mex) + } + + @Test +// @Ignore + public void processRollbackException_Ex() { + ExecutionEntity mex = setupMock() + initProcessRollbackException(mex) + + doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.processRollbackException(mex) + } + + @Test +// @Ignore + public void processRollbackJavaException() { + ExecutionEntity mex = setupMock() + initProcessRollbackException(mex) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.processRollbackJavaException(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("rollbackData", null) + verify(mex).setVariable("rolledBack", false) + verify(mex).setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback") + verify(mex, never()).setVariable("WorkflowException", null) + } + + @Test +// @Ignore + public void processRollbackJavaException_BpmnError() { + ExecutionEntity mex = setupMock() + initProcessRollbackException(mex) + + doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.processRollbackJavaException(mex) + } + + @Test +// @Ignore + public void processRollbackJavaException_Ex() { + ExecutionEntity mex = setupMock() + initProcessRollbackException(mex) + + doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null) + + DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() + DoCreateAllottedResourceBRGRollback.processRollbackJavaException(mex) + } + + private RollbackData initPreProcess(ExecutionEntity mex) { + def data = new RollbackData() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("rollbackData")).thenReturn(data) + when(mex.getVariable("rollbackAAI")).thenReturn(true) + when(mex.getVariable("rollbackSDNC")).thenReturn(true) + when(mex.getVariable("disableRollback")).thenReturn("false") + + data.put("SERVICEINSTANCE", "allottedResourceId", "myid") + + data.put(RbType, "serviceInstanceId", "sii") + data.put(RbType, "parentServiceInstanceId", "psii") + + data.put(RbType, "rollbackAAI", "true") + data.put(RbType, "aaiARPath", "mypath") + + data.put(RbType, "rollbackSDNCassign", "true") + data.put(RbType, "rollbackSDNCactivate", "myactivate") + data.put(RbType, "rollbackSDNCcreate", "mycreate") + data.put(RbType, "sdncActivateRollbackReq", "activatereq") + data.put(RbType, "sdncCreateRollbackReq", "createreq") + data.put(RbType, "sdncAssignRollbackReq", "assignreq") + + return data + } + + private initUpdateAaiAROrchStatus(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) + when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx) + } + + private initValidateSDNCResp(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("prefix")).thenReturn(Prefix) + when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) + } + + private String initValidateSDNCResp_Resp() { + return "<response-code>200</response-code>" + } + + private initDeleteAaiAR(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("aaiARResourceVersion")).thenReturn(VERS) + when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) + when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx) + } + + private initPostProcessRequest(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("skipRollback")).thenReturn(false) + } + + private initProcessRollbackException(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + } + + private initProcessRollbackJavaException(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy new file mode 100644 index 0000000000..543bb1db05 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy @@ -0,0 +1,999 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe.scripts + + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Rule +import org.junit.Test +import org.junit.Ignore +import org.mockito.MockitoAnnotations +import org.camunda.bpm.engine.delegate.BpmnError +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse +import static com.github.tomakehurst.wiremock.client.WireMock.put +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching +import static org.junit.Assert.*; +import static org.mockito.Mockito.* +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource_500 + +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.vcpe.scripts.MapSetter + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +class DoCreateAllottedResourceBRGTest extends GroovyTestBase { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(PORT) + + String Prefix = "DCARBRG_" + + @BeforeClass + public static void setUpBeforeClass() { + super.setUpBeforeClass() + } + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + public DoCreateAllottedResourceBRGTest() { + super("DoCreateAllottedResourceBRG") + } + + + // ***** preProcessRequest ***** + + @Test +// @Ignore + public void preProcessRequest() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.preProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("prefix", Prefix) + + assertTrue(checkMissingPreProcessRequest("mso.workflow.sdncadapter.callback")) + assertTrue(checkMissingPreProcessRequest("mso.workflow.sdnc.replication.delay")) + assertTrue(checkMissingPreProcessRequest("serviceInstanceId")) + assertTrue(checkMissingPreProcessRequest("parentServiceInstanceId")) + assertTrue(checkMissingPreProcessRequest("allottedResourceModelInfo")) + assertTrue(checkMissingPreProcessRequest("vni")) + assertTrue(checkMissingPreProcessRequest("vgmuxBearerIP")) + assertTrue(checkMissingPreProcessRequest("brgWanMacAddress")) + assertTrue(checkMissingPreProcessRequest("allottedResourceRole")) + assertTrue(checkMissingPreProcessRequest("allottedResourceType")) + } + + + // ***** getAaiAR ***** + + @Test + @Ignore + public void getAaiAR() { + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") + + ExecutionEntity mex = setupMock() + initGetAaiAR(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.getAaiAR(mex) + + verify(mex).setVariable("foundActiveAR", true) + } + + @Test +// @Ignore + public void getAaiAR_Duplicate() { + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") + + ExecutionEntity mex = setupMock() + initGetAaiAR(mex) + + // fail if duplicate + when(mex.getVariable("failExists")).thenReturn("true") + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRG.getAaiAR(mex) })) + } + + @Test +// @Ignore + public void getAaiAR_NotActive() { + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") + + ExecutionEntity mex = setupMock() + initGetAaiAR(mex) + + // not active + when(mex.getVariable("aaiAROrchStatus")).thenReturn("not-active") + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRG.getAaiAR(mex) })) + } + + @Test + @Ignore + public void getAaiAR_NoStatus() { + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") + + ExecutionEntity mex = setupMock() + initGetAaiAR(mex) + + when(mex.getVariable("aaiAROrchStatus")).thenReturn(null) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.getAaiAR(mex) + + verify(mex, never()).setVariable("foundActiveAR", true) + } + + + // ***** createAaiAR ***** + + @Test + @Ignore + public void createAaiAR() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initCreateAaiAr(mex) + + MockPutAllottedResource(CUST, SVC, INST, ARID) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.createAaiAR(mex) + + def data = map.get("rollbackData") + assertNotNull(data) + assertTrue(data instanceof RollbackData) + + assertEquals("45", data.get(Prefix, "disableRollback")) + assertEquals("true", data.get(Prefix, "rollbackAAI")) + assertEquals(ARID, data.get(Prefix, "allottedResourceId")) + assertEquals("sii", data.get(Prefix, "serviceInstanceId")) + assertEquals("psii", data.get(Prefix, "parentServiceInstanceId")) + assertEquals(mex.getVariable("PSI_resourceLink")+"/allotted-resources/allotted-resource/"+ARID, data.get(Prefix, "aaiARPath")) + } + + @Test + @Ignore + public void createAaiAR_NoArid_NoModelUuids() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initCreateAaiAr(mex) + + // no allottedResourceId - will be generated + + when(mex.getVariable("allottedResourceId")).thenReturn(null) + + wireMockRule + .stubFor(put(urlMatching("/aai/.*/allotted-resource/.*")) + .willReturn(aResponse() + .withStatus(200))) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.createAaiAR(mex) + + def arid = map.get("allottedResourceId") + assertNotNull(arid) + assertFalse(arid.isEmpty()) + + def data = map.get("rollbackData") + assertNotNull(data) + assertTrue(data instanceof RollbackData) + + assertEquals(arid, data.get(Prefix, "allottedResourceId")) + } + + @Test +// @Ignore + public void createAaiAR_MissingPsiLink() { + ExecutionEntity mex = setupMock() + initCreateAaiAr(mex) + + when(mex.getVariable("PSI_resourceLink")).thenReturn(null) + + MockPutAllottedResource(CUST, SVC, INST, ARID) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) })) + } + + @Test +// @Ignore + public void createAaiAR_HttpFailed() { + ExecutionEntity mex = setupMock() + initCreateAaiAr(mex) + + MockPutAllottedResource_500(CUST, SVC, INST, ARID) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) })) + } + + @Test +// @Ignore + public void createAaiAR_BpmnError() { + ExecutionEntity mex = setupMock() + initCreateAaiAr(mex) + + when(mex.getVariable("aai.endpoint")).thenThrow(new BpmnError("expected exception")) + + MockPutAllottedResource(CUST, SVC, INST, ARID) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) })) + } + + @Test +// @Ignore + public void createAaiAR_Ex() { + ExecutionEntity mex = setupMock() + initCreateAaiAr(mex) + + when(mex.getVariable("aai.endpoint")).thenThrow(new RuntimeException("expected exception")) + + MockPutAllottedResource(CUST, SVC, INST, ARID) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) })) + } + + + // ***** buildSDNCRequest ***** + + @Test +// @Ignore + public void buildSDNCRequest() { + ExecutionEntity mex = setupMock() + initBuildSDNCRequest(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + String result = DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") + + assertTrue(result.indexOf("myreq= 0) + assertTrue(result.indexOf("myact= 0) + assertTrue(result.indexOf("ari= 0) + assertTrue(result.indexOf("sii= 0) + assertTrue(result.indexOf("sii= 0) + assertTrue(result.indexOf("psii= 0) + assertTrue(result.indexOf("sst= 0) + assertTrue(result.indexOf("gci= 0) + assertTrue(result.indexOf("scu= 0) + assertTrue(result.indexOf("mri= 0) + assertTrue(result.indexOf("bwma= 0) + assertTrue(result.indexOf("myvni= 0) + assertTrue(result.indexOf("vbi= 0) + assertTrue(result.indexOf("miu= 0) + assertTrue(result.indexOf("mu= 0) + assertTrue(result.indexOf("mcu= 0) + assertTrue(result.indexOf("mv= 0) + assertTrue(result.indexOf("mn= 0) + } + + @Test +// @Ignore + public void buildSDNCRequest_EmptyModelInfo() { + ExecutionEntity mex = setupMock() + initBuildSDNCRequest(mex) + + when(mex.getVariable("allottedResourceModelInfo")).thenReturn("{}") + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + String result = DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") + + assertTrue(result.indexOf("myreq= 0) + assertTrue(result.indexOf("myact= 0) + assertTrue(result.indexOf("ari= 0) + assertTrue(result.indexOf("sii= 0) + assertTrue(result.indexOf("sii= 0) + assertTrue(result.indexOf("psii= 0) + assertTrue(result.indexOf("sst= 0) + assertTrue(result.indexOf("gci= 0) + assertTrue(result.indexOf("scu= 0) + assertTrue(result.indexOf("mri= 0) + assertTrue(result.indexOf("bwma= 0) + assertTrue(result.indexOf("myvni= 0) + assertTrue(result.indexOf("vbi= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + } + + @Test +// @Ignore + public void buildSDNCRequest_Ex() { + ExecutionEntity mex = setupMock() + initBuildSDNCRequest(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") })) + } + + + // ***** preProcessSDNCAssign ***** + + @Test +// @Ignore + public void preProcessSDNCAssign() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + def data = initPreProcessSDNC(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) + + def req = map.get("sdncAssignRequest") + assertNotNull(req) + + assertEquals(data, map.get("rollbackData")) + + def rbreq = data.get(Prefix, "sdncAssignRollbackReq") + + assertTrue(req.indexOf("assign= 0) + assertTrue(req.indexOf("CreateBRGInstance= 0) + assertTrue(req.indexOf("") >= 0) + + assertTrue(rbreq.indexOf("unassign= 0) + assertTrue(rbreq.indexOf("DeleteBRGInstance= 0) + assertTrue(rbreq.indexOf("") >= 0) + } + + @Test +// @Ignore + public void preProcessSDNCAssign_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) })) + } + + @Test +// @Ignore + public void preProcessSDNCAssign_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) })) + } + + + // ***** preProcessSDNCCreate ***** + + @Test +// @Ignore + public void preProcessSDNCCreate() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + def data = initPreProcessSDNC(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) + + def req = map.get("sdncCreateRequest") + assertNotNull(req) + + assertEquals(data, map.get("rollbackData")) + + def rbreq = data.get(Prefix, "sdncCreateRollbackReq") + + assertTrue(req.indexOf("create= 0) + assertTrue(req.indexOf("CreateBRGInstance= 0) + assertTrue(req.indexOf("") >= 0) + + assertTrue(rbreq.indexOf("delete= 0) + assertTrue(rbreq.indexOf("DeleteBRGInstance= 0) + assertTrue(rbreq.indexOf("") >= 0) + + } + + @Test +// @Ignore + public void preProcessSDNCCreate_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) })) + } + + @Test +// @Ignore + public void preProcessSDNCCreate_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) })) + } + + + // ***** preProcessSDNCActivate ***** + + @Test +// @Ignore + public void preProcessSDNCActivate() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + def data = initPreProcessSDNC(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) + + def req = map.get("sdncActivateRequest") + assertNotNull(req) + + assertEquals(data, map.get("rollbackData")) + + def rbreq = data.get(Prefix, "sdncActivateRollbackReq") + + assertTrue(req.indexOf("activate= 0) + assertTrue(req.indexOf("CreateBRGInstance= 0) + assertTrue(req.indexOf("") >= 0) + + assertTrue(rbreq.indexOf("deactivate= 0) + assertTrue(rbreq.indexOf("DeleteBRGInstance= 0) + assertTrue(rbreq.indexOf("") >= 0) + + } + + @Test +// @Ignore + public void preProcessSDNCActivate_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) })) + } + + @Test +// @Ignore + public void preProcessSDNCActivate_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) })) + } + + + // ***** validateSDNCResp ***** + + @Test +// @Ignore + public void validateSDNCResp() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + def data = initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") + + verify(mex).getVariable("WorkflowException") + verify(mex).getVariable("SDNCA_SuccessIndicator") + verify(mex).getVariable("rollbackData") + + assertEquals(data, map.get("rollbackData")) + + assertEquals("true", data.get(Prefix, "rollback" + "SDNCcreate")) + + } + + @Test +// @Ignore + public void validateSDNCResp_Get() { + ExecutionEntity mex = setupMock() + def data = initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "get") + + verify(mex).getVariable("WorkflowException") + verify(mex).getVariable("SDNCA_SuccessIndicator") + + verify(mex, never()).getVariable("rollbackData") + } + + @Test +// @Ignore + public void validateSDNCResp_Unsuccessful() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + // unsuccessful + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") })) + } + + @Test +// @Ignore + public void validateSDNCResp_BpmnError() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") })) + } + + @Test +// @Ignore + public void validateSDNCResp_Ex() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") })) + } + + + // ***** preProcessSDNCGet ***** + + @Test +// @Ignore + public void preProcessSDNCGet_FoundAR() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcessSDNCGet(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.preProcessSDNCGet(mex) + + String req = map.get("sdncGetRequest") + + assertTrue(req.indexOf("") >= 0) + assertTrue(req.indexOf("sii= 0) + assertTrue(req.indexOf("arlink= 0) + assertTrue(req.indexOf("myurl= 0) + + } + + @Test +// @Ignore + public void preProcessSDNCGet_NotFoundAR() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcessSDNCGet(mex) + + when(mex.getVariable("foundActiveAR")).thenReturn(false) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.preProcessSDNCGet(mex) + + String req = map.get("sdncGetRequest") + + assertTrue(req.indexOf("") >= 0) + assertTrue(req.indexOf("sii= 0) + assertTrue(req.indexOf("assignlink= 0) + assertTrue(req.indexOf("myurl= 0) + + } + + @Test +// @Ignore + public void preProcessSDNCGet_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNCGet(mex) + + when(mex.getVariable("foundActiveAR")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCGet(mex) })) + } + + + // ***** updateAaiAROrchStatus ***** + + @Test + @Ignore + public void updateAaiAROrchStatus() { + MockPatchAllottedResource(CUST, SVC, INST, ARID) + + ExecutionEntity mex = setupMock() + initUpdateAaiAROrchStatus(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.updateAaiAROrchStatus(mex, "success") + } + + + // ***** generateOutputs ***** + + @Test +// @Ignore + public void generateOutputs() { + ExecutionEntity mex = setupMock() + def brgtop = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml") + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("enhancedCallbackRequestData")).thenReturn(brgtop) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.generateOutputs(mex) + + verify(mex).setVariable("allotedResourceName", "namefromrequest") + + } + + @Test +// @Ignore + public void generateOutputs_BadXml() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("enhancedCallbackRequestData")).thenReturn("invalid xml") + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.generateOutputs(mex) + + verify(mex, never()).setVariable(anyString(), anyString()) + + } + + @Test +// @Ignore + public void generateOutputs_BpmnError() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + DoCreateAllottedResourceBRG.generateOutputs(mex) + verify(mex, never()).setVariable(anyString(), anyString()) + + } + + @Test +// @Ignore + public void generateOutputs_Ex() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + DoCreateAllottedResourceBRG.generateOutputs(mex) + verify(mex, never()).setVariable(anyString(), anyString()) + + } + + + // ***** preProcessRollback ***** + + @Test +// @Ignore + public void preProcessRollback() { + ExecutionEntity mex = setupMock() + WorkflowException wfe = mock(WorkflowException.class) + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("WorkflowException")).thenReturn(wfe) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.preProcessRollback(mex) + + verify(mex).setVariable("prevWorkflowException", wfe) + + } + + @Test +// @Ignore + public void preProcessRollback_NotWFE() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("WorkflowException")).thenReturn("I'm not a WFE") + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.preProcessRollback(mex) + +// verify(mex, never()).setVariable("prevWorkflowException", any()) + + } + + @Test +// @Ignore + public void preProcessRollback_BpmnError() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + DoCreateAllottedResourceBRG.preProcessRollback(mex) + + } + + @Test +// @Ignore + public void preProcessRollback_Ex() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + DoCreateAllottedResourceBRG.preProcessRollback(mex) + + } + + + // ***** postProcessRollback ***** + + @Test +// @Ignore + public void postProcessRollback() { + ExecutionEntity mex = setupMock() + WorkflowException wfe = mock(WorkflowException.class) + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("prevWorkflowException")).thenReturn(wfe) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.postProcessRollback(mex) + + verify(mex).setVariable("WorkflowException", wfe) + verify(mex).setVariable("rollbackData", null) + + } + + @Test +// @Ignore + public void postProcessRollback_NotWFE() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("prevWorkflowException")).thenReturn("I'm not a WFE") + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.postProcessRollback(mex) + +// verify(mex, never()).setVariable("WorkflowException", any()) + verify(mex).setVariable("rollbackData", null) + + } + + @Test +// @Ignore + public void postProcessRollback_BpmnError() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.postProcessRollback(mex) })) + verify(mex, never()).setVariable("rollbackData", null) + + } + + @Test +// @Ignore + public void postProcessRollback_Ex() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + DoCreateAllottedResourceBRG.postProcessRollback(mex) + verify(mex, never()).setVariable("rollbackData", null) + + } + + private boolean checkMissingPreProcessRequest(String fieldnm) { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + when(mex.getVariable(fieldnm)).thenReturn("") + + return doBpmnError( { _ -> DoCreateAllottedResourceBRG.preProcessRequest(mex) }) + } + + private void initPreProcess(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("sdncurn") + when(mex.getVariable("mso.workflow.sdnc.replication.delay")).thenReturn("sdncdelay") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") + when(mex.getVariable("allottedResourceModelInfo")).thenReturn("armi") + when(mex.getVariable("vni")).thenReturn("myvni") + when(mex.getVariable("vgmuxBearerIP")).thenReturn("vbi") + when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma") + when(mex.getVariable("allottedResourceRole")).thenReturn("arr") + when(mex.getVariable("allottedResourceType")).thenReturn("art") + } + + private void initGetAaiAR(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("allottedResourceType")).thenReturn("BRGt") + when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr") + when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml")) + when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx) + when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active") + } + + private initCreateAaiAr(ExecutionEntity mex) { + when(mex.getVariable("disableRollback")).thenReturn(45) + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("allottedResourceId")).thenReturn(ARID) + when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx) + when(mex.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.namespace")) + when(mex.getVariable("PSI_resourceLink")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST) + when(mex.getVariable("allottedResourceType")).thenReturn("BRGt") + when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr") + when(mex.getVariable("CSI_resourceLink")).thenReturn(aaiUriPfx+"/aai/v9/mycsi") + when(mex.getVariable("allottedResourceModelInfo")).thenReturn(""" + { + "modelInvariantUuid":"modelinvuuid", + "modelUuid":"modeluuid", + "modelCustomizationUuid":"modelcustuuid" + } + """) + } + + private initBuildSDNCRequest(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("allottedResourceId")).thenReturn("ari") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") + when(mex.getVariable("subscriptionServiceType")).thenReturn("sst") + when(mex.getVariable("globalCustomerId")).thenReturn("gci") + when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu") + when(mex.getVariable("msoRequestId")).thenReturn("mri") + when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma") + when(mex.getVariable("vni")).thenReturn("myvni") + when(mex.getVariable("vgmuxBearerIP")).thenReturn("vbi") + when(mex.getVariable("allottedResourceModelInfo")).thenReturn(""" + { + "modelInvariantUuid":"miu", + "modelUuid":"mu", + "modelCustomizationUuid":"mcu", + "modelVersion":"mv", + "modelName":"mn" + } + """) + } + + private RollbackData initPreProcessSDNC(ExecutionEntity mex) { + def data = new RollbackData() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("rollbackData")).thenReturn(data) + + return data + } + + private initPreProcessSDNCGet(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl") + when(mex.getVariable("foundActiveAR")).thenReturn(true) + when(mex.getVariable("aaiARGetResponse")).thenReturn("arlink") + when(mex.getVariable("sdncAssignResponse")).thenReturn("<object-path>assignlink</object-path>") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl") + } + + private RollbackData initValidateSDNCResp(ExecutionEntity mex) { + def data = new RollbackData() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("prefix")).thenReturn(Prefix) + when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) + when(mex.getVariable("rollbackData")).thenReturn(data) + + return data + } + + private String initValidateSDNCResp_Resp() { + return "<response-code>200</response-code>" + } + + private initUpdateAaiAROrchStatus(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy new file mode 100644 index 0000000000..66cfdb635d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy @@ -0,0 +1,654 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe.scripts + + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Rule +import org.junit.Test +import org.junit.Ignore +import org.mockito.MockitoAnnotations +import org.camunda.bpm.engine.delegate.BpmnError +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse +import static com.github.tomakehurst.wiremock.client.WireMock.get +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching +import static org.junit.Assert.*; +import static org.mockito.Mockito.* +import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource + +import org.onap.so.bpmn.core.RollbackData + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(PORT) + + String Prefix = "DCARTXCRB_" + String RbType = "DCARTXC_" + + @BeforeClass + public static void setUpBeforeClass() { + super.setUpBeforeClass() + } + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + public DoCreateAllottedResourceTXCRollbackTest() { + super("DoCreateAllottedResourceTXCRollback") + } + + + // ***** preProcessRequest ***** + + @Test +// @Ignore + public void preProcessRequest() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("prefix", Prefix) + verify(mex).setVariable("serviceInstanceId", "sii") + verify(mex).setVariable("parentServiceInstanceId", "psii") + verify(mex).setVariable("allottedResourceId", "myid") + verify(mex).setVariable("rollbackAAI", true) + verify(mex).setVariable("aaiARPath", "mypath") + verify(mex).setVariable("rollbackSDNC", true) + verify(mex).setVariable("deactivateSdnc", "myactivate") + verify(mex).setVariable("deleteSdnc", "mycreate") + verify(mex).setVariable("unassignSdnc", "true") + verify(mex).setVariable("sdncDeactivateRequest", "activatereq") + verify(mex).setVariable("sdncDeleteRequest", "createreq") + verify(mex).setVariable("sdncUnassignRequest", "assignreq") + + verify(mex, never()).setVariable("skipRollback", true) + } + + @Test +// @Ignore + public void preProcessRequest_RollbackDisabled() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("disableRollback")).thenReturn("true") + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("prefix", Prefix) + verify(mex).setVariable("serviceInstanceId", "sii") + verify(mex).setVariable("parentServiceInstanceId", "psii") + verify(mex).setVariable("allottedResourceId", "myid") + verify(mex).setVariable("rollbackAAI", true) + verify(mex).setVariable("aaiARPath", "mypath") + verify(mex).setVariable("rollbackSDNC", true) + verify(mex).setVariable("deactivateSdnc", "myactivate") + verify(mex).setVariable("deleteSdnc", "mycreate") + verify(mex).setVariable("unassignSdnc", "true") + verify(mex).setVariable("sdncDeactivateRequest", "activatereq") + verify(mex).setVariable("sdncDeleteRequest", "createreq") + verify(mex).setVariable("sdncUnassignRequest", "assignreq") + + verify(mex).setVariable("skipRollback", true) + } + + @Test +// @Ignore + public void preProcessRequest_NoAAI() { + ExecutionEntity mex = setupMock() + def data = initPreProcess(mex) + + when(mex.getVariable("rollbackAAI")).thenReturn(false) + data.put(RbType, "rollbackAAI", "false") + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("prefix", Prefix) + verify(mex).setVariable("serviceInstanceId", "sii") + verify(mex).setVariable("parentServiceInstanceId", "psii") + verify(mex).setVariable("allottedResourceId", "myid") + verify(mex, never()).setVariable("rollbackAAI", true) + verify(mex, never()).setVariable("aaiARPath", "mypath") + verify(mex).setVariable("rollbackSDNC", true) + verify(mex).setVariable("deactivateSdnc", "myactivate") + verify(mex).setVariable("deleteSdnc", "mycreate") + verify(mex).setVariable("unassignSdnc", "true") + verify(mex).setVariable("sdncDeactivateRequest", "activatereq") + verify(mex).setVariable("sdncDeleteRequest", "createreq") + verify(mex).setVariable("sdncUnassignRequest", "assignreq") + + verify(mex, never()).setVariable("skipRollback", true) + } + + @Test +// @Ignore + public void preProcessRequest_NoAssign() { + ExecutionEntity mex = setupMock() + def data = initPreProcess(mex) + + when(mex.getVariable("rollbackSDNC")).thenReturn(false) + data.put(RbType, "rollbackSDNCassign", "false") + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("prefix", Prefix) + verify(mex).setVariable("serviceInstanceId", "sii") + verify(mex).setVariable("parentServiceInstanceId", "psii") + verify(mex).setVariable("allottedResourceId", "myid") + verify(mex).setVariable("rollbackAAI", true) + verify(mex).setVariable("aaiARPath", "mypath") + verify(mex, never()).setVariable("rollbackSDNC", true) + verify(mex, never()).setVariable("deactivateSdnc", "myactivate") + verify(mex, never()).setVariable("deleteSdnc", "mycreate") + verify(mex, never()).setVariable("unassignSdnc", "true") + verify(mex, never()).setVariable("sdncDeactivateRequest", "activatereq") + verify(mex, never()).setVariable("sdncDeleteRequest", "createreq") + verify(mex, never()).setVariable("sdncUnassignRequest", "assignreq") + + verify(mex, never()).setVariable("skipRollback", true) + } + + @Test +// @Ignore + public void preProcessRequest_NoAAI_NoAssign() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("rollbackAAI")).thenReturn(false) + when(mex.getVariable("rollbackSDNC")).thenReturn(false) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) + + verify(mex).setVariable("skipRollback", true) + } + + @Test +// @Ignore + public void preProcessRequest_NoRbStructure() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("rollbackData")).thenReturn(new RollbackData()) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) + + verify(mex).setVariable("skipRollback", true) + } + + @Test +// @Ignore + public void preProcessRequest_NullRb() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("rollbackData")).thenReturn(null) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) + + verify(mex).setVariable("skipRollback", true) + } + + @Test +// @Ignore + public void preProcessRequest_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) })) + } + + @Test +// @Ignore + public void preProcessRequest_Ex() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) })) + } + + @Test + @Ignore + public void updateAaiAROrchStatus() { + ExecutionEntity mex = setupMock() + initUpdateAaiAROrchStatus(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockPatchAllottedResource(CUST, SVC, INST, ARID) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success") + } + + @Test +// @Ignore + public void updateAaiAROrchStatus_EmptyResponse() { + ExecutionEntity mex = setupMock() + initUpdateAaiAROrchStatus(mex) + + wireMockRule + .stubFor(get(urlMatching("/aai/v[0-9]+/.*")) + .willReturn(aResponse() + .withStatus(200))) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success") })) + } + + @Test +// @Ignore + public void updateAaiAROrchStatus_NoArPath() { + ExecutionEntity mex = setupMock() + initUpdateAaiAROrchStatus(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockPatchAllottedResource(CUST, SVC, INST, ARID) + + when(mex.getVariable("aaiARPath")).thenReturn(null) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success") })) + } + + + // ***** validateSDNCResp ***** + + @Test +// @Ignore + public void validateSDNCResp() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + + DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") + + verify(mex).getVariable("WorkflowException") + verify(mex).getVariable("SDNCA_SuccessIndicator") + } + + @Test +// @Ignore + public void validateSDNCResp_Unsuccessful() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") })) + } + + @Test +// @Ignore + public void validateSDNCResp_BpmnError404() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) + + when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("404", "expected exception")) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + + DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") + } + + @Test +// @Ignore + public void validateSDNCResp_BpmnError() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) + + when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") })) + } + + @Test +// @Ignore + public void validateSDNCResp_Ex() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) + + when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") })) + } + + @Test + @Ignore + public void deleteAaiAR() { + ExecutionEntity mex = setupMock() + initDeleteAaiAR(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) + } + + @Test +// @Ignore + public void deleteAaiAR_NoArPath() { + ExecutionEntity mex = setupMock() + initDeleteAaiAR(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + + when(mex.getVariable("aaiARPath")).thenReturn("") + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) })) + } + + @Test +// @Ignore + public void deleteAaiAR_BpmnError() { + ExecutionEntity mex = setupMock() + initDeleteAaiAR(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + + when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) })) + } + + @Test +// @Ignore + public void deleteAaiAR_Ex() { + ExecutionEntity mex = setupMock() + initDeleteAaiAR(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + + when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) })) + } + + @Test +// @Ignore + public void postProcessRequest() { + ExecutionEntity mex = setupMock() + initPostProcessRequest(mex) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.postProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("rollbackData", null) + verify(mex).setVariable("rolledBack", true) + } + + @Test +// @Ignore + public void postProcessRequest_RolledBack() { + ExecutionEntity mex = setupMock() + initPostProcessRequest(mex) + + when(mex.getVariable("skipRollback")).thenReturn(true) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.postProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("rollbackData", null) + verify(mex, never()).setVariable("rolledBack", true) + } + + @Test +// @Ignore + public void postProcessRequest_BpmnError() { + ExecutionEntity mex = setupMock() + initPostProcessRequest(mex) + + when(mex.getVariable("skipRollback")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.postProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("rollbackData", null) + verify(mex, never()).setVariable("rolledBack", true) + } + + @Test +// @Ignore + public void postProcessRequest_Ex() { + ExecutionEntity mex = setupMock() + initPostProcessRequest(mex) + + when(mex.getVariable("skipRollback")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.postProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("rollbackData", null) + verify(mex, never()).setVariable("rolledBack", true) + } + + @Test +// @Ignore + public void processRollbackException() { + ExecutionEntity mex = setupMock() + initProcessRollbackException(mex) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.processRollbackException(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("rollbackData", null) + verify(mex).setVariable("rolledBack", false) + verify(mex).setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback") + verify(mex).setVariable("WorkflowException", null) + } + + @Test +// @Ignore + public void processRollbackException_BpmnError() { + ExecutionEntity mex = setupMock() + initProcessRollbackException(mex) + + doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.processRollbackException(mex) + } + + @Test +// @Ignore + public void processRollbackException_Ex() { + ExecutionEntity mex = setupMock() + initProcessRollbackException(mex) + + doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.processRollbackException(mex) + } + + @Test +// @Ignore + public void processRollbackJavaException() { + ExecutionEntity mex = setupMock() + initProcessRollbackException(mex) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.processRollbackJavaException(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("rollbackData", null) + verify(mex).setVariable("rolledBack", false) + verify(mex).setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback") + verify(mex, never()).setVariable("WorkflowException", null) + } + + @Test +// @Ignore + public void processRollbackJavaException_BpmnError() { + ExecutionEntity mex = setupMock() + initProcessRollbackException(mex) + + doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.processRollbackJavaException(mex) + } + + @Test +// @Ignore + public void processRollbackJavaException_Ex() { + ExecutionEntity mex = setupMock() + initProcessRollbackException(mex) + + doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null) + + DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() + DoCreateAllottedResourceTXCRollback.processRollbackJavaException(mex) + } + + private RollbackData initPreProcess(ExecutionEntity mex) { + def data = new RollbackData() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("rollbackData")).thenReturn(data) + when(mex.getVariable("rollbackAAI")).thenReturn(true) + when(mex.getVariable("rollbackSDNC")).thenReturn(true) + when(mex.getVariable("disableRollback")).thenReturn("false") + + data.put("SERVICEINSTANCE", "allottedResourceId", "myid") + + data.put(RbType, "serviceInstanceId", "sii") + data.put(RbType, "parentServiceInstanceId", "psii") + + data.put(RbType, "rollbackAAI", "true") + data.put(RbType, "aaiARPath", "mypath") + + data.put(RbType, "rollbackSDNCassign", "true") + data.put(RbType, "rollbackSDNCactivate", "myactivate") + data.put(RbType, "rollbackSDNCcreate", "mycreate") + data.put(RbType, "sdncActivateRollbackReq", "activatereq") + data.put(RbType, "sdncCreateRollbackReq", "createreq") + data.put(RbType, "sdncAssignRollbackReq", "assignreq") + + return data + } + + private initUpdateAaiAROrchStatus(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) + when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx) + } + + private initValidateSDNCResp(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("prefix")).thenReturn(Prefix) + when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) + } + + private String initValidateSDNCResp_Resp() { + return "<response-code>200</response-code>" + } + + private initDeleteAaiAR(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("aaiARResourceVersion")).thenReturn(VERS) + when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) + when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx) + } + + private initPostProcessRequest(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("skipRollback")).thenReturn(false) + } + + private initProcessRollbackException(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + } + + private initProcessRollbackJavaException(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy new file mode 100644 index 0000000000..fa40c17e63 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy @@ -0,0 +1,957 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe.scripts + + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Rule +import org.junit.Test +import org.junit.Ignore +import org.mockito.MockitoAnnotations +import org.camunda.bpm.engine.delegate.BpmnError +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil +import org.springframework.beans.factory.config.YamlPropertiesFactoryBean +import org.springframework.core.io.ClassPathResource +import org.springframework.core.io.FileSystemResource +import org.springframework.core.io.Resource + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse +import static com.github.tomakehurst.wiremock.client.WireMock.put +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching +import static org.junit.Assert.*; +import static org.mockito.Mockito.* +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource_500 + +import java.util.Map + +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.vcpe.scripts.MapSetter + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +class DoCreateAllottedResourceTXCTest extends GroovyTestBase { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(PORT) + + String Prefix = "DCARTXC_" + + @BeforeClass + public static void setUpBeforeClass() { + aaiUriPfx = UrnPropertiesReader.getVariable("aai.endpoint") + } + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + public DoCreateAllottedResourceTXCTest() { + super("DoCreateAllottedResourceTXC") + } + + + // ***** preProcessRequest ***** + + @Test + // @Ignore + public void preProcessRequest() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.preProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("prefix", Prefix) + + assertTrue(checkMissingPreProcessRequest("mso.workflow.sdncadapter.callback")) + assertTrue(checkMissingPreProcessRequest("mso.workflow.sdnc.replication.delay")) + assertTrue(checkMissingPreProcessRequest("serviceInstanceId")) + assertTrue(checkMissingPreProcessRequest("parentServiceInstanceId")) + assertTrue(checkMissingPreProcessRequest("allottedResourceModelInfo")) + assertTrue(checkMissingPreProcessRequest("brgWanMacAddress")) + assertTrue(checkMissingPreProcessRequest("allottedResourceRole")) + assertTrue(checkMissingPreProcessRequest("allottedResourceType")) + } + + + // ***** getAaiAR ***** + + @Test + @Ignore + public void getAaiAR() { + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") + + ExecutionEntity mex = setupMock() + initGetAaiAR(mex) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.getAaiAR(mex) + + verify(mex).setVariable("foundActiveAR", true) + } + + @Test + // @Ignore + public void getAaiAR_Duplicate() { + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") + + ExecutionEntity mex = setupMock() + initGetAaiAR(mex) + + // fail if duplicate + when(mex.getVariable("failExists")).thenReturn("true") + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXC.getAaiAR(mex) })) + } + + @Test + // @Ignore + public void getAaiAR_NotActive() { + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") + + ExecutionEntity mex = setupMock() + initGetAaiAR(mex) + + // not active + when(mex.getVariable("aaiAROrchStatus")).thenReturn("not-active") + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXC.getAaiAR(mex) })) + } + + @Test + @Ignore + public void getAaiAR_NoStatus() { + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") + + ExecutionEntity mex = setupMock() + initGetAaiAR(mex) + + when(mex.getVariable("aaiAROrchStatus")).thenReturn(null) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.getAaiAR(mex) + + verify(mex, never()).setVariable("foundActiveAR", true) + } + + + // ***** createAaiAR ***** + + @Test + @Ignore + public void createAaiAR() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initCreateAaiAr(mex) + + MockPutAllottedResource(CUST, SVC, INST, ARID) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.createAaiAR(mex) + + def data = map.get("rollbackData") + assertNotNull(data) + assertTrue(data instanceof RollbackData) + + assertEquals("45", data.get(Prefix, "disableRollback")) + assertEquals("true", data.get(Prefix, "rollbackAAI")) + assertEquals(ARID, data.get(Prefix, "allottedResourceId")) + assertEquals("sii", data.get(Prefix, "serviceInstanceId")) + assertEquals("psii", data.get(Prefix, "parentServiceInstanceId")) + assertEquals(mex.getVariable("PSI_resourceLink")+"/allotted-resources/allotted-resource/"+ARID, data.get(Prefix, "aaiARPath")) + } + + @Test + @Ignore + public void createAaiAR_NoArid_NoModelUuids() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initCreateAaiAr(mex) + + // no allottedResourceId - will be generated + + when(mex.getVariable("allottedResourceId")).thenReturn(null) + + wireMockRule + .stubFor(put(urlMatching("/aai/.*/allotted-resource/.*")) + .willReturn(aResponse() + .withStatus(200))) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.createAaiAR(mex) + + def arid = map.get("allottedResourceId") + assertNotNull(arid) + assertFalse(arid.isEmpty()) + + def data = map.get("rollbackData") + assertNotNull(data) + assertTrue(data instanceof RollbackData) + + assertEquals(arid, data.get(Prefix, "allottedResourceId")) + } + + @Test + // @Ignore + public void createAaiAR_MissingPsiLink() { + ExecutionEntity mex = setupMock() + initCreateAaiAr(mex) + + when(mex.getVariable("PSI_resourceLink")).thenReturn(null) + + MockPutAllottedResource(CUST, SVC, INST, ARID) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) })) + } + + @Test + // @Ignore + public void createAaiAR_HttpFailed() { + ExecutionEntity mex = setupMock() + initCreateAaiAr(mex) + + MockPutAllottedResource_500(CUST, SVC, INST, ARID) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) })) + } + + @Test + // @Ignore + public void createAaiAR_BpmnError() { + ExecutionEntity mex = setupMock() + initCreateAaiAr(mex) + + when(mex.getVariable("aai.endpoint")).thenThrow(new BpmnError("expected exception")) + + MockPutAllottedResource(CUST, SVC, INST, ARID) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) })) + } + + @Test + // @Ignore + public void createAaiAR_Ex() { + ExecutionEntity mex = setupMock() + initCreateAaiAr(mex) + + when(mex.getVariable("aai.endpoint")).thenThrow(new RuntimeException("expected exception")) + + MockPutAllottedResource(CUST, SVC, INST, ARID) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) })) + } + + + // ***** buildSDNCRequest ***** + + @Test + // @Ignore + public void buildSDNCRequest() { + ExecutionEntity mex = setupMock() + initBuildSDNCRequest(mex) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + String result = DoCreateAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq") + + assertTrue(result.indexOf("myreq= 0) + assertTrue(result.indexOf("myact= 0) + assertTrue(result.indexOf("ari= 0) + assertTrue(result.indexOf("sii= 0) + assertTrue(result.indexOf("sii= 0) + assertTrue(result.indexOf("psii= 0) + assertTrue(result.indexOf("sst= 0) + assertTrue(result.indexOf("gci= 0) + assertTrue(result.indexOf("scu= 0) + assertTrue(result.indexOf("mri= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + } + + @Test + // @Ignore + public void buildSDNCRequest_Ex() { + ExecutionEntity mex = setupMock() + initBuildSDNCRequest(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq") })) + } + + + // ***** preProcessSDNCAssign ***** + + @Test + // @Ignore + public void preProcessSDNCAssign() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + def data = initPreProcessSDNC(mex) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.preProcessSDNCAssign(mex) + + def req = map.get("sdncAssignRequest") + assertNotNull(req) + + assertEquals(data, map.get("rollbackData")) + + def rbreq = data.get(Prefix, "sdncAssignRollbackReq") + + assertTrue(req.indexOf("assign= 0) + assertTrue(req.indexOf("CreateTunnelXConnInstance= 0) + assertTrue(req.indexOf("") >= 0) + + assertTrue(rbreq.indexOf("unassign= 0) + assertTrue(rbreq.indexOf("DeleteTunnelXConnInstance= 0) + assertTrue(rbreq.indexOf("") >= 0) + } + + @Test + // @Ignore + public void preProcessSDNCAssign_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCAssign(mex) })) + } + + @Test + // @Ignore + public void preProcessSDNCAssign_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCAssign(mex) })) + } + + + // ***** preProcessSDNCCreate ***** + + @Test + // @Ignore + public void preProcessSDNCCreate() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + def data = initPreProcessSDNC(mex) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.preProcessSDNCCreate(mex) + + def req = map.get("sdncCreateRequest") + assertNotNull(req) + + assertEquals(data, map.get("rollbackData")) + + def rbreq = data.get(Prefix, "sdncCreateRollbackReq") + + assertTrue(req.indexOf("create= 0) + assertTrue(req.indexOf("CreateTunnelXConnInstance= 0) + assertTrue(req.indexOf("") >= 0) + + assertTrue(rbreq.indexOf("delete= 0) + assertTrue(rbreq.indexOf("DeleteTunnelXConnInstance= 0) + assertTrue(rbreq.indexOf("") >= 0) + + } + + @Test + // @Ignore + public void preProcessSDNCCreate_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCCreate(mex) })) + } + + @Test + // @Ignore + public void preProcessSDNCCreate_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCCreate(mex) })) + } + + + // ***** preProcessSDNCActivate ***** + + @Test + // @Ignore + public void preProcessSDNCActivate() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + def data = initPreProcessSDNC(mex) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.preProcessSDNCActivate(mex) + + def req = map.get("sdncActivateRequest") + assertNotNull(req) + + assertEquals(data, map.get("rollbackData")) + + def rbreq = data.get(Prefix, "sdncActivateRollbackReq") + + assertTrue(req.indexOf("activate= 0) + assertTrue(req.indexOf("CreateTunnelXConnInstance= 0) + assertTrue(req.indexOf("") >= 0) + + assertTrue(rbreq.indexOf("deactivate= 0) + assertTrue(rbreq.indexOf("DeleteTunnelXConnInstance= 0) + assertTrue(rbreq.indexOf("") >= 0) + + } + + @Test + // @Ignore + public void preProcessSDNCActivate_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCActivate(mex) })) + } + + @Test + // @Ignore + public void preProcessSDNCActivate_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCActivate(mex) })) + } + + + // ***** validateSDNCResp ***** + + @Test + // @Ignore + public void validateSDNCResp() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + def data = initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") + + verify(mex).getVariable("WorkflowException") + verify(mex).getVariable("SDNCA_SuccessIndicator") + verify(mex).getVariable("rollbackData") + + assertEquals(data, map.get("rollbackData")) + + assertEquals("true", data.get(Prefix, "rollback" + "SDNCcreate")) + + } + + @Test + // @Ignore + public void validateSDNCResp_Get() { + ExecutionEntity mex = setupMock() + def data = initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "get") + + verify(mex).getVariable("WorkflowException") + verify(mex).getVariable("SDNCA_SuccessIndicator") + + verify(mex, never()).getVariable("rollbackData") + } + + @Test + // @Ignore + public void validateSDNCResp_Unsuccessful() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + // unsuccessful + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") })) + } + + @Test + // @Ignore + public void validateSDNCResp_BpmnError() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") })) + } + + @Test + // @Ignore + public void validateSDNCResp_Ex() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") })) + } + + + // ***** preProcessSDNCGet ***** + + @Test + // @Ignore + public void preProcessSDNCGet_FoundAR() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcessSDNCGet(mex) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.preProcessSDNCGet(mex) + + String req = map.get("sdncGetRequest") + + assertTrue(req.indexOf("") >= 0) + assertTrue(req.indexOf("sii= 0) + assertTrue(req.indexOf("arlink= 0) + assertTrue(req.indexOf("myurl= 0) + + } + + @Test + // @Ignore + public void preProcessSDNCGet_NotFoundAR() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcessSDNCGet(mex) + + when(mex.getVariable("foundActiveAR")).thenReturn(false) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.preProcessSDNCGet(mex) + + String req = map.get("sdncGetRequest") + + assertTrue(req.indexOf("") >= 0) + assertTrue(req.indexOf("sii= 0) + assertTrue(req.indexOf("assignlink= 0) + assertTrue(req.indexOf("myurl= 0) + + } + + @Test + // @Ignore + public void preProcessSDNCGet_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNCGet(mex) + + when(mex.getVariable("foundActiveAR")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCGet(mex) })) + } + + + // ***** updateAaiAROrchStatus ***** + + @Test + @Ignore + public void updateAaiAROrchStatus() { + MockPatchAllottedResource(CUST, SVC, INST, ARID) + + ExecutionEntity mex = setupMock() + initUpdateAaiAROrchStatus(mex) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.updateAaiAROrchStatus(mex, "success") + } + + + // ***** generateOutputs ***** + + @Test + // @Ignore + public void generateOutputs() { + ExecutionEntity mex = setupMock() + def txctop = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml") + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("enhancedCallbackRequestData")).thenReturn(txctop) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.generateOutputs(mex) + + verify(mex).setVariable("allotedResourceName", "namefromrequest") + verify(mex).setVariable("vni", "my-vni") + verify(mex).setVariable("vgmuxBearerIP", "my-bearer-ip") + verify(mex).setVariable("vgmuxLanIP", "my-lan-ip") + + } + + @Test + // @Ignore + public void generateOutputs_BadXml() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("enhancedCallbackRequestData")).thenReturn("invalid xml") + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.generateOutputs(mex) + + verify(mex, never()).setVariable(anyString(), anyString()) + + } + + @Test + // @Ignore + public void generateOutputs_BpmnError() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + DoCreateAllottedResourceTXC.generateOutputs(mex) + verify(mex, never()).setVariable(anyString(), anyString()) + + } + + @Test + // @Ignore + public void generateOutputs_Ex() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + DoCreateAllottedResourceTXC.generateOutputs(mex) + verify(mex, never()).setVariable(anyString(), anyString()) + + } + + + // ***** preProcessRollback ***** + + @Test + // @Ignore + public void preProcessRollback() { + ExecutionEntity mex = setupMock() + WorkflowException wfe = mock(WorkflowException.class) + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("WorkflowException")).thenReturn(wfe) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.preProcessRollback(mex) + + verify(mex).setVariable("prevWorkflowException", wfe) + + } + + @Test + // @Ignore + public void preProcessRollback_NotWFE() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("WorkflowException")).thenReturn("I'm not a WFE") + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.preProcessRollback(mex) + +// verify(mex, never()).setVariable("prevWorkflowException", any()) + + } + + @Test + // @Ignore + public void preProcessRollback_BpmnError() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + DoCreateAllottedResourceTXC.preProcessRollback(mex) + + } + + @Test + // @Ignore + public void preProcessRollback_Ex() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + DoCreateAllottedResourceTXC.preProcessRollback(mex) + + } + + + // ***** postProcessRollback ***** + + @Test + // @Ignore + public void postProcessRollback() { + ExecutionEntity mex = setupMock() + WorkflowException wfe = mock(WorkflowException.class) + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("prevWorkflowException")).thenReturn(wfe) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.postProcessRollback(mex) + + verify(mex).setVariable("WorkflowException", wfe) + verify(mex).setVariable("rollbackData", null) + + } + + @Test + // @Ignore + public void postProcessRollback_NotWFE() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("prevWorkflowException")).thenReturn("I'm not a WFE") + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + DoCreateAllottedResourceTXC.postProcessRollback(mex) + +// verify(mex, never()).setVariable("WorkflowException", any()) + verify(mex).setVariable("rollbackData", null) + + } + + @Test + // @Ignore + public void postProcessRollback_BpmnError() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.postProcessRollback(mex) })) + verify(mex, never()).setVariable("rollbackData", null) + + } + + @Test + // @Ignore + public void postProcessRollback_Ex() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + DoCreateAllottedResourceTXC.postProcessRollback(mex) + verify(mex, never()).setVariable("rollbackData", null) + + } + + private boolean checkMissingPreProcessRequest(String fieldnm) { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() + + when(mex.getVariable(fieldnm)).thenReturn("") + + return doBpmnError( { _ -> DoCreateAllottedResourceTXC.preProcessRequest(mex) }) + } + + private void initPreProcess(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("sdncurn") + when(mex.getVariable("mso.workflow.sdnc.replication.delay")).thenReturn("sdncdelay") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") + when(mex.getVariable("allottedResourceModelInfo")).thenReturn("armi") + when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma") + when(mex.getVariable("allottedResourceRole")).thenReturn("arr") + when(mex.getVariable("allottedResourceType")).thenReturn("art") + } + + private void initGetAaiAR(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("allottedResourceType")).thenReturn("TXCt") + when(mex.getVariable("allottedResourceRole")).thenReturn("TXCr") + when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml")) + when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx) + when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active") + } + + private initCreateAaiAr(ExecutionEntity mex) { + when(mex.getVariable("disableRollback")).thenReturn(45) + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("allottedResourceId")).thenReturn(ARID) + when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx) + when(mex.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.namespace")) + when(mex.getVariable("PSI_resourceLink")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST) + when(mex.getVariable("allottedResourceType")).thenReturn("TXCt") + when(mex.getVariable("allottedResourceRole")).thenReturn("TXCr") + when(mex.getVariable("CSI_resourceLink")).thenReturn(aaiUriPfx+"/aai/v9/mycsi") + when(mex.getVariable("allottedResourceModelInfo")).thenReturn(""" + { + "modelInvariantUuid":"modelinvuuid", + "modelUuid":"modeluuid", + "modelCustomizationUuid":"modelcustuuid" + } + """) + } + + private initBuildSDNCRequest(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("allottedResourceId")).thenReturn("ari") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") + when(mex.getVariable("subscriptionServiceType")).thenReturn("sst") + when(mex.getVariable("globalCustomerId")).thenReturn("gci") + when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu") + when(mex.getVariable("msoRequestId")).thenReturn("mri") + } + + private RollbackData initPreProcessSDNC(ExecutionEntity mex) { + def data = new RollbackData() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("rollbackData")).thenReturn(data) + + return data + } + + private initPreProcessSDNCGet(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl") + when(mex.getVariable("foundActiveAR")).thenReturn(true) + when(mex.getVariable("aaiARGetResponse")).thenReturn("arlink") + when(mex.getVariable("sdncAssignResponse")).thenReturn("<object-path>assignlink</object-path>") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl") + } + + private RollbackData initValidateSDNCResp(ExecutionEntity mex) { + def data = new RollbackData() + + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("prefix")).thenReturn(Prefix) + when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) + when(mex.getVariable("rollbackData")).thenReturn(data) + + return data + } + + private String initValidateSDNCResp_Resp() { + return "<response-code>200</response-code>" + } + + private initUpdateAaiAROrchStatus(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy new file mode 100644 index 0000000000..e8004d3d2b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy @@ -0,0 +1,606 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe.scripts + + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Rule +import org.junit.Test +import org.junit.Ignore +import org.mockito.MockitoAnnotations +import org.camunda.bpm.engine.delegate.BpmnError +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse +import static com.github.tomakehurst.wiremock.client.WireMock.delete +import static com.github.tomakehurst.wiremock.client.WireMock.get +import static com.github.tomakehurst.wiremock.client.WireMock.patch +import static com.github.tomakehurst.wiremock.client.WireMock.put +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching +import static org.junit.Assert.*; +import static org.mockito.Mockito.* +import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource +import static org.onap.so.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById + +import java.util.Map + +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.vcpe.scripts.MapSetter + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +class DoDeleteAllottedResourceBRGTest extends GroovyTestBase { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(PORT) + + String Prefix = "DDARBRG_" + + @BeforeClass + public static void setUpBeforeClass() { + super.setUpBeforeClass() + } + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + public DoDeleteAllottedResourceBRGTest() { + super("DoDeleteAllottedResourceBRG") + } + + + // ***** preProcessRequest ***** + + @Test +// @Ignore + public void preProcessRequest() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + DoDeleteAllottedResourceBRG.preProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("prefix", Prefix) + verify(mex).setVariable("sdncCallbackUrl", "sdncurn") + + assertTrue(checkMissingPreProcessRequest("mso.workflow.sdncadapter.callback")) + assertTrue(checkMissingPreProcessRequest("serviceInstanceId")) + assertTrue(checkMissingPreProcessRequest("allottedResourceId")) + } + + @Test +// @Ignore + public void preProcessRequest_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("serviceInstanceId")).thenThrow(new BpmnError("expected exception")) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.preProcessRequest(mex) })) + } + + @Test +// @Ignore + public void preProcessRequest_Ex() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception")) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.preProcessRequest(mex) })) + } + + + // ***** getAaiAR ***** + + @Test + @Ignore + public void getAaiAR() { + MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml") + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") + + ExecutionEntity mex = setupMock() + initGetAaiAR(mex) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + DoDeleteAllottedResourceBRG.getAaiAR(mex) + + verify(mex).setVariable("parentServiceInstanceId", INST) + } + + @Test +// @Ignore + public void getAaiAR_EmptyResponse() { + + // note: empty result-link + wireMockRule + .stubFor(get(urlMatching("/aai/.*/search/.*")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(""))) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") + + ExecutionEntity mex = setupMock() + initGetAaiAR(mex) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.getAaiAR(mex) })) + } + + + // ***** updateAaiAROrchStatus ***** + + @Test + @Ignore + public void updateAaiAROrchStatus() { + ExecutionEntity mex = setupMock() + initUpdateAaiAROrchStatus(mex) + + MockPatchAllottedResource(CUST, SVC, INST, ARID) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + DoDeleteAllottedResourceBRG.updateAaiAROrchStatus(mex, "success") + } + + + // ***** buildSDNCRequest ***** + + @Test +// @Ignore + public void buildSDNCRequest() { + ExecutionEntity mex = setupMock() + initBuildSDNCRequest(mex) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + String result = DoDeleteAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") + + assertTrue(result.indexOf("myreq= 0) + assertTrue(result.indexOf("myact= 0) + assertTrue(result.indexOf("ari= 0) + assertTrue(result.indexOf("sii= 0) + assertTrue(result.indexOf("sii= 0) + assertTrue(result.indexOf("psii= 0) + assertTrue(result.indexOf("sst= 0) + assertTrue(result.indexOf("gci= 0) + assertTrue(result.indexOf("scu= 0) + assertTrue(result.indexOf("mri= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + } + + @Test +// @Ignore + public void buildSDNCRequest_Ex() { + ExecutionEntity mex = setupMock() + initBuildSDNCRequest(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") })) + } + + + // ***** preProcessSDNCUnassign ***** + + @Test +// @Ignore + public void preProcessSDNCUnassign() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcessSDNC(mex) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + DoDeleteAllottedResourceBRG.preProcessSDNCUnassign(mex) + + def req = map.get("sdncUnassignRequest") + + assertTrue(req.indexOf("unassign= 0) + assertTrue(req.indexOf("DeleteBRGInstance= 0) + assertTrue(req.indexOf("") >= 0) + } + + @Test +// @Ignore + public void preProcessSDNCUnassign_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception")) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCUnassign(mex) })) + } + + @Test +// @Ignore + public void preProcessSDNCUnassign_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCUnassign(mex) })) + } + + + // ***** preProcessSDNCDelete ***** + + @Test +// @Ignore + public void preProcessSDNCDelete() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcessSDNC(mex) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + DoDeleteAllottedResourceBRG.preProcessSDNCDelete(mex) + + def req = map.get("sdncDeleteRequest") + + assertTrue(req.indexOf("delete= 0) + assertTrue(req.indexOf("DeleteBRGInstance= 0) + assertTrue(req.indexOf("") >= 0) + } + + @Test +// @Ignore + public void preProcessSDNCDelete_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception")) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDelete(mex) })) + } + + @Test +// @Ignore + public void preProcessSDNCDelete_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDelete(mex) })) + } + + + // ***** preProcessSDNCDeactivate ***** + + @Test +// @Ignore + public void preProcessSDNCDeactivate() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcessSDNC(mex) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + DoDeleteAllottedResourceBRG.preProcessSDNCDeactivate(mex) + + def req = map.get("sdncDeactivateRequest") + + assertTrue(req.indexOf("deactivate= 0) + assertTrue(req.indexOf("DeleteBRGInstance= 0) + assertTrue(req.indexOf("") >= 0) + } + + @Test +// @Ignore + public void preProcessSDNCDeactivate_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception")) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDeactivate(mex) })) + } + + @Test +// @Ignore + public void preProcessSDNCDeactivate_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDeactivate(mex) })) + } + + + // ***** validateSDNCResp ***** + + @Test +// @Ignore + public void validateSDNCResp() { + ExecutionEntity mex = setupMock() + def data = initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp(200) + + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create") + + verify(mex).getVariable("WorkflowException") + verify(mex).getVariable("SDNCA_SuccessIndicator") + verify(mex).getVariable(Prefix+"sdncResponseSuccess") + + verify(mex, never()).getVariable(Prefix + "sdncRequestDataResponseCode") + verify(mex, never()).setVariable("wasDeleted", false) + } + + @Test +// @Ignore + public void validateSDNCResp_Fail404_Deactivate_FailNotFound() { + ExecutionEntity mex = setupMock() + def data = initValidateSDNCResp(mex) + + def resp = initValidateSDNCResp_Resp(404) + when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404") + when(mex.getVariable("failNotFound")).thenReturn("true") + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "deactivate")})) + } + + @Test +// @Ignore + public void validateSDNCResp_Fail404_Deactivate() { + ExecutionEntity mex = setupMock() + def data = initValidateSDNCResp(mex) + + def resp = initValidateSDNCResp_Resp(404) + when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404") + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "deactivate") + + verify(mex).setVariable("ARNotFoundInSDNC", true) + verify(mex).setVariable("wasDeleted", false) + } + + @Test +// @Ignore + public void validateSDNCResp_Fail404() { + ExecutionEntity mex = setupMock() + def data = initValidateSDNCResp(mex) + + def resp = initValidateSDNCResp_Resp(404) + when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404") + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create")})) + } + + @Test +// @Ignore + public void validateSDNCResp_Deactivate() { + ExecutionEntity mex = setupMock() + def data = initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp(200) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "deactivate")})) + } + + @Test +// @Ignore + public void validateSDNCResp_BpmnError() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp(200) + + when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create") })) + } + + @Test +// @Ignore + public void validateSDNCResp_Ex() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp(200) + + when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create") })) + } + + @Test + @Ignore + public void deleteAaiAR() { + ExecutionEntity mex = setupMock() + initDeleteAaiAR(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") + MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + DoDeleteAllottedResourceBRG.deleteAaiAR(mex) + } + + @Test +// @Ignore + public void deleteAaiAR_NoArPath() { + ExecutionEntity mex = setupMock() + initDeleteAaiAR(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") + MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + + when(mex.getVariable("aaiARPath")).thenReturn("") + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.deleteAaiAR(mex) })) + } + + @Test +// @Ignore + public void deleteAaiAR_BpmnError() { + ExecutionEntity mex = setupMock() + initDeleteAaiAR(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") + MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + + when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception")) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.deleteAaiAR(mex) })) + } + + @Test +// @Ignore + public void deleteAaiAR_Ex() { + ExecutionEntity mex = setupMock() + initDeleteAaiAR(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") + MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + + when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception")) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.deleteAaiAR(mex) })) + } + + private boolean checkMissingPreProcessRequest(String fieldnm) { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() + + when(mex.getVariable(fieldnm)).thenReturn("") + + return doBpmnError( { _ -> DoDeleteAllottedResourceBRG.preProcessRequest(mex) }) + } + + private void initPreProcess(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("sdncurn") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("allottedResourceId")).thenReturn("ari") + } + + private void initGetAaiAR(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("allottedResourceType")).thenReturn("BRG") + when(mex.getVariable("allottedResourceRole")).thenReturn("BRG") + when(mex.getVariable("allottedResourceId")).thenReturn(ARID) + when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoDeleteAllottedResourceBRG/getAR.xml")) + when(mex.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.namespace")) + when(mex.getVariable("mso.workflow.global.default.aai.version")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.version")) + when(mex.getVariable("mso.workflow.default.aai.v8.nodes.query.uri")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")) + when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx) + when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) + when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active") + } + + private initUpdateAaiAROrchStatus(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) + } + + private initBuildSDNCRequest(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("allottedResourceId")).thenReturn("ari") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") + when(mex.getVariable("subscriptionServiceType")).thenReturn("sst") + when(mex.getVariable("globalCustomerId")).thenReturn("gci") + when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu") + when(mex.getVariable("msoRequestId")).thenReturn("mri") + } + + private initPreProcessSDNC(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + } + + private initValidateSDNCResp(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("prefix")).thenReturn(Prefix) + when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) + } + + private String initValidateSDNCResp_Resp(int code) { + return "<response-code>${code}</response-code>" + } + + private initDeleteAaiAR(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) + when(mex.getVariable("aaiARResourceVersion")).thenReturn("myvers") + when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy new file mode 100644 index 0000000000..6719be17a1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy @@ -0,0 +1,607 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe.scripts + + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Rule +import org.junit.Test +import org.junit.Ignore +import org.mockito.MockitoAnnotations +import org.camunda.bpm.engine.delegate.BpmnError +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse +import static com.github.tomakehurst.wiremock.client.WireMock.delete +import static com.github.tomakehurst.wiremock.client.WireMock.get +import static com.github.tomakehurst.wiremock.client.WireMock.patch +import static com.github.tomakehurst.wiremock.client.WireMock.put +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching +import static org.junit.Assert.*; +import static org.mockito.Mockito.* +import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource +import static org.onap.so.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById + + +import java.util.Map + +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.vcpe.scripts.MapSetter + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +class DoDeleteAllottedResourceTXCTest extends GroovyTestBase { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(PORT) + + String Prefix = "DDARTXC_" + + @BeforeClass + public static void setUpBeforeClass() { + super.setUpBeforeClass() + } + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + public DoDeleteAllottedResourceTXCTest() { + super("DoDeleteAllottedResourceTXC") + } + + + // ***** preProcessRequest ***** + + @Test +// @Ignore + public void preProcessRequest() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + DoDeleteAllottedResourceTXC.preProcessRequest(mex) + + //verify(mex).getVariable(DBGFLAG) + verify(mex).setVariable("prefix", Prefix) + verify(mex).setVariable("sdncCallbackUrl", "sdncurn") + + assertTrue(checkMissingPreProcessRequest("mso.workflow.sdncadapter.callback")) + assertTrue(checkMissingPreProcessRequest("serviceInstanceId")) + assertTrue(checkMissingPreProcessRequest("allottedResourceId")) + } + + @Test +// @Ignore + public void preProcessRequest_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("serviceInstanceId")).thenThrow(new BpmnError("expected exception")) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) })) + } + + @Test +// @Ignore + public void preProcessRequest_Ex() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception")) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) })) + } + + + // ***** getAaiAR ***** + + @Test + @Ignore + public void getAaiAR() { + MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml") + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") + + ExecutionEntity mex = setupMock() + initGetAaiAR(mex) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + DoDeleteAllottedResourceTXC.getAaiAR(mex) + + verify(mex).setVariable("parentServiceInstanceId", INST) + } + + @Test +// @Ignore + public void getAaiAR_EmptyResponse() { + + // note: empty result-link + wireMockRule + .stubFor(get(urlMatching("/aai/.*/search/.*")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(""))) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") + + ExecutionEntity mex = setupMock() + initGetAaiAR(mex) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.getAaiAR(mex) })) + } + + + // ***** updateAaiAROrchStatus ***** + + @Test + @Ignore + public void updateAaiAROrchStatus() { + ExecutionEntity mex = setupMock() + initUpdateAaiAROrchStatus(mex) + + MockPatchAllottedResource(CUST, SVC, INST, ARID) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + DoDeleteAllottedResourceTXC.updateAaiAROrchStatus(mex, "success") + } + + + // ***** buildSDNCRequest ***** + + @Test +// @Ignore + public void buildSDNCRequest() { + ExecutionEntity mex = setupMock() + initBuildSDNCRequest(mex) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + String result = DoDeleteAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq") + + assertTrue(result.indexOf("myreq= 0) + assertTrue(result.indexOf("myact= 0) + assertTrue(result.indexOf("ari= 0) + assertTrue(result.indexOf("sii= 0) + assertTrue(result.indexOf("sii= 0) + assertTrue(result.indexOf("psii= 0) + assertTrue(result.indexOf("sst= 0) + assertTrue(result.indexOf("gci= 0) + assertTrue(result.indexOf("scu= 0) + assertTrue(result.indexOf("mri= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + } + + @Test +// @Ignore + public void buildSDNCRequest_Ex() { + ExecutionEntity mex = setupMock() + initBuildSDNCRequest(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq") })) + } + + + // ***** preProcessSDNCUnassign ***** + + @Test +// @Ignore + public void preProcessSDNCUnassign() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcessSDNC(mex) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex) + + def req = map.get("sdncUnassignRequest") + + assertTrue(req.indexOf("unassign= 0) + assertTrue(req.indexOf("DeleteTunnelXConnInstance= 0) + assertTrue(req.indexOf("") >= 0) + } + + @Test +// @Ignore + public void preProcessSDNCUnassign_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception")) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex) })) + } + + @Test +// @Ignore + public void preProcessSDNCUnassign_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex) })) + } + + + // ***** preProcessSDNCDelete ***** + + @Test +// @Ignore + public void preProcessSDNCDelete() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcessSDNC(mex) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex) + + def req = map.get("sdncDeleteRequest") + + assertTrue(req.indexOf("delete= 0) + assertTrue(req.indexOf("DeleteTunnelXConnInstance= 0) + assertTrue(req.indexOf("") >= 0) + } + + @Test +// @Ignore + public void preProcessSDNCDelete_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception")) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex) })) + } + + @Test +// @Ignore + public void preProcessSDNCDelete_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex) })) + } + + + // ***** preProcessSDNCDeactivate ***** + + @Test +// @Ignore + public void preProcessSDNCDeactivate() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcessSDNC(mex) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex) + + def req = map.get("sdncDeactivateRequest") + + assertTrue(req.indexOf("deactivate= 0) + assertTrue(req.indexOf("DeleteTunnelXConnInstance= 0) + assertTrue(req.indexOf("") >= 0) + } + + @Test +// @Ignore + public void preProcessSDNCDeactivate_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception")) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex) })) + } + + @Test +// @Ignore + public void preProcessSDNCDeactivate_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex) })) + } + + + // ***** validateSDNCResp ***** + + @Test +// @Ignore + public void validateSDNCResp() { + ExecutionEntity mex = setupMock() + def data = initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp(200) + + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create") + + verify(mex).getVariable("WorkflowException") + verify(mex).getVariable("SDNCA_SuccessIndicator") + verify(mex).getVariable(Prefix+"sdncResponseSuccess") + + verify(mex, never()).getVariable(Prefix + "sdncRequestDataResponseCode") + verify(mex, never()).setVariable("wasDeleted", false) + } + + @Test +// @Ignore + public void validateSDNCResp_Fail404_Deactivate_FailNotFound() { + ExecutionEntity mex = setupMock() + def data = initValidateSDNCResp(mex) + + def resp = initValidateSDNCResp_Resp(404) + when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404") + when(mex.getVariable("failNotFound")).thenReturn("true") + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate")})) + } + + @Test +// @Ignore + public void validateSDNCResp_Fail404_Deactivate() { + ExecutionEntity mex = setupMock() + def data = initValidateSDNCResp(mex) + + def resp = initValidateSDNCResp_Resp(404) + when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404") + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate") + + verify(mex).setVariable("ARNotFoundInSDNC", true) + verify(mex).setVariable("wasDeleted", false) + } + + @Test +// @Ignore + public void validateSDNCResp_Fail404() { + ExecutionEntity mex = setupMock() + def data = initValidateSDNCResp(mex) + + def resp = initValidateSDNCResp_Resp(404) + when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404") + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create")})) + } + + @Test +// @Ignore + public void validateSDNCResp_Deactivate() { + ExecutionEntity mex = setupMock() + def data = initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp(200) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate")})) + } + + @Test +// @Ignore + public void validateSDNCResp_BpmnError() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp(200) + + when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create") })) + } + + @Test +// @Ignore + public void validateSDNCResp_Ex() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp(200) + + when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create") })) + } + + @Test + @Ignore + public void deleteAaiAR() { + ExecutionEntity mex = setupMock() + initDeleteAaiAR(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") + MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + DoDeleteAllottedResourceTXC.deleteAaiAR(mex) + } + + @Test +// @Ignore + public void deleteAaiAR_NoArPath() { + ExecutionEntity mex = setupMock() + initDeleteAaiAR(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") + MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + + when(mex.getVariable("aaiARPath")).thenReturn("") + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) })) + } + + @Test +// @Ignore + public void deleteAaiAR_BpmnError() { + ExecutionEntity mex = setupMock() + initDeleteAaiAR(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") + MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + + when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception")) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) })) + } + + @Test +// @Ignore + public void deleteAaiAR_Ex() { + ExecutionEntity mex = setupMock() + initDeleteAaiAR(mex) + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") + MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + + when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception")) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) })) + } + + private boolean checkMissingPreProcessRequest(String fieldnm) { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() + + when(mex.getVariable(fieldnm)).thenReturn("") + + return doBpmnError( { _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) }) + } + + private void initPreProcess(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("sdncurn") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("allottedResourceId")).thenReturn("ari") + } + + private void initGetAaiAR(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("allottedResourceType")).thenReturn("TXC") + when(mex.getVariable("allottedResourceRole")).thenReturn("TXC") + when(mex.getVariable("allottedResourceId")).thenReturn(ARID) + when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoDeleteAllottedResourceTXC/getAR.xml")) + when(mex.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.namespace")) + when(mex.getVariable("mso.workflow.global.default.aai.version")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.version")) + when(mex.getVariable("mso.workflow.default.aai.v8.nodes.query.uri")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")) + when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx) + when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) + when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active") + } + + private initUpdateAaiAROrchStatus(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) + } + + private initBuildSDNCRequest(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("allottedResourceId")).thenReturn("ari") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") + when(mex.getVariable("subscriptionServiceType")).thenReturn("sst") + when(mex.getVariable("globalCustomerId")).thenReturn("gci") + when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu") + when(mex.getVariable("msoRequestId")).thenReturn("mri") + } + + private initPreProcessSDNC(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + } + + private initValidateSDNCResp(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("prefix")).thenReturn(Prefix) + when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) + } + + private String initValidateSDNCResp_Resp(int code) { + return "<response-code>${code}</response-code>" + } + + private initDeleteAaiAR(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID) + when(mex.getVariable("aaiARResourceVersion")).thenReturn("myvers") + when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx) + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy new file mode 100644 index 0000000000..764e6244d4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy @@ -0,0 +1,124 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.vcpe.scripts + + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Rule +import org.junit.Test +import org.junit.Ignore +import org.mockito.MockitoAnnotations +import org.camunda.bpm.engine.delegate.BpmnError +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil +import org.springframework.beans.factory.config.YamlPropertiesFactoryBean +import org.springframework.core.io.ClassPathResource +import org.springframework.core.io.Resource + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse +import static com.github.tomakehurst.wiremock.client.WireMock.get +import static com.github.tomakehurst.wiremock.client.WireMock.patch +import static com.github.tomakehurst.wiremock.client.WireMock.put +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching +import static org.junit.Assert.*; +import static org.mockito.Mockito.* +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.vcpe.scripts.MapSetter + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +class GroovyTestBase { + + static final int PORT = 28090 + static final String LOCAL_URI = "http://localhost:" + PORT + + static final String CUST = "SDN-ETHERNET-INTERNET" + static final String SVC = "123456789" + static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET" + static final String ARID = "arId-1" + static final String VERS = "myvers" + + static final String DBGFLAG = "isDebugLogEnabled" + + static String aaiUriPfx + + String processName + + public static void setUpBeforeClass() { + aaiUriPfx = UrnPropertiesReader.getVariable("aai.endpoint") + } + + public GroovyTestBase(String processName) { + this.processName = processName + } + + public boolean doBpmnError(def func) { + + try { + func() + return false; + + } catch(BpmnError e) { + return true; + } + } + + public ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn(processName) + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(processName) + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mex = mock(ExecutionEntity.class) + + when(mex.getId()).thenReturn("100") + when(mex.getProcessDefinitionId()).thenReturn(processName) + when(mex.getProcessInstanceId()).thenReturn(processName) + when(mex.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mex.getProcessEngineServices().getRepositoryService().getProcessDefinition(mex.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + when(mex.getVariable("isAsyncProcess")).thenReturn("true") + when(mex.getVariable(processName+"WorkflowResponseSent")).thenReturn("false") + + return mex + } + + public Map setupMap(ExecutionEntity mex) { + MapSetter mapset = new MapSetter(); + doAnswer(mapset).when(mex).setVariable(any(), any()) + return mapset.getMap(); + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapGetter.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapGetter.groovy new file mode 100644 index 0000000000..fa5dcec4bc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapGetter.groovy @@ -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.bpmn.vcpe.scripts; + +import java.util.HashMap; +import java.util.Map; + +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +class MapGetter implements Answer { + final Map map; + + public MapGetter() { + map = new HashMap<>(); + } + + public MapGetter(Map map) { + this.map = map; + } + + public Map getMap() { + return map; + } + + @Override + public Object answer(InvocationOnMock invocation) throws Throwable { + return map.get(invocation.getArgumentAt(0, String.class)); + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapSetter.groovy b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapSetter.groovy new file mode 100644 index 0000000000..7b50c616ea --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapSetter.groovy @@ -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.bpmn.vcpe.scripts; + +import java.util.HashMap; +import java.util.Map; + +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +class MapSetter implements Answer { + final Map map; + + public MapSetter() { + map = new HashMap<>(); + } + + public MapSetter(Map map) { + this.map = map; + } + + public Map getMap() { + return map; + } + + @Override + public Void answer(InvocationOnMock invocation) throws Throwable { + map.put(invocation.getArgumentAt(0, String.class), invocation.getArgumentAt(1, Object.class)); + return null; + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/CreateSiSample.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/CreateSiSample.json new file mode 100644 index 0000000000..c824213423 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/CreateSiSample.json @@ -0,0 +1,72 @@ +{ + "variables": { + "bpmnRequest": { + "value": "{\n \"requestDetails\": {\n \"cloudConfiguration\": {\n \"lcpCloudRegionId\": \"mtn6\", \n \"tenantId\": \"0422ffb57ba042c0800a29dc85ca70f8\"\n }, \n \"modelInfo\": {\n \"modelInvariantUuid\": \"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f\", \n \"modelName\": \"MSO Test Network\", \n \"modelType\": \"service\", \n \"modelUuid\": \"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e\", \n \"modelVersion\": \"1.0\"\n }, \n \"owningEntity\": {\n \"owningEntityId\": \"123459af-0427-42c2-9d15-971b99b12345\", \n \"owningEntityName\": \"vSAMP10a Entity-200\"\n }, \n \"project\": {\n \"projectName\": \"vSAMP10a Project-3\"\n }, \n \"requestInfo\": {\n \"instanceName\": \"MSO-DEV-SI-1802-v6-2-19-10\", \n \"requestorId\": \"xxxxxx\", \n \"source\": \"VID\", \n \"suppressRollback\": false\n }, \n \"requestParameters\": {\n \"aLaCarte\": true, \n \"subscriptionServiceType\": \"MSO-dev-service-type\", \n \"userParams\": [\n {\n \"name\": \"someUserParam\", \n \"value\": \"someValue\"\n }\n ]\n }, \n \"subscriberInfo\": {\n \"globalSubscriberId\": \"MSO_1610_dev\", \n \"subscriberName\": \"MSO_1610_dev\"\n }\n }\n}\n", + "type": "String" + }, + "requestId": { + "value": "6dd20050-76ee-418f-a153-50720a8f3286", + "type": "String" + }, + "mso-request-id": { + "value": "6dd20050-76ee-418f-a153-50720a8f3286", + "type": "String" + }, + "isBaseVfModule": { + "value": false, + "type": "Boolean" + }, + "recipeTimeout": { + "value": 180, + "type": "Integer" + }, + "requestAction": { + "value": "createInstance", + "type": "String" + }, + "serviceInstanceId": { + "value": "", + "type": "String" + }, + "vnfId": { + "value": "", + "type": "String" + }, + "vfModuleId": { + "value": "", + "type": "String" + }, + "volumeGroupId": { + "value": "", + "type": "String" + }, + "networkId": { + "value": "", + "type": "String" + }, + "configurationId": { + "value": "", + "type": "String" + }, + "serviceType": { + "value": "", + "type": "String" + }, + "vnfType": { + "value": "", + "type": "String" + }, + "vfModuleType": { + "value": "", + "type": "String" + }, + "networkType": { + "value": "", + "type": "String" + }, + "host": { + "value": "localhost", + "type": "String" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn new file mode 100644 index 0000000000..b33aad7443 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn @@ -0,0 +1,54 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_1v2f9n5 + + + + SequenceFlow_1v2f9n5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn new file mode 100644 index 0000000000..807efae1af --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn @@ -0,0 +1,55 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1epm19d + + + SequenceFlow_1 + SequenceFlow_1epm19d + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn new file mode 100644 index 0000000000..b2f280d7e9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn @@ -0,0 +1,38 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn new file mode 100644 index 0000000000..532ca867bb --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn @@ -0,0 +1,53 @@ + + + + + SequenceFlow_1ipu8um + + + SequenceFlow_1l4c4k0 + + + SequenceFlow_1ipu8um + SequenceFlow_1l4c4k0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn new file mode 100644 index 0000000000..5e4400e9bd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn @@ -0,0 +1,53 @@ + + + + + SequenceFlow_11sp3s9 + + + + SequenceFlow_11sp3s9 + SequenceFlow_0q1lfmf + + + + + SequenceFlow_0q1lfmf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn new file mode 100644 index 0000000000..2867a671b6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn @@ -0,0 +1,53 @@ + + + + + SequenceFlow_1537b7m + + + SequenceFlow_1mz2mgf + + + + SequenceFlow_1537b7m + SequenceFlow_1mz2mgf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn new file mode 100644 index 0000000000..517df36c74 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn @@ -0,0 +1,37 @@ + + + + + SequenceFlow_0qi7pl3 + + + + SequenceFlow_0qi7pl3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/Homing.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/Homing.bpmn new file mode 100644 index 0000000000..ad4c3c816d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/VCPE/stubprocess/Homing.bpmn @@ -0,0 +1,35 @@ + + + + + SequenceFlow_0tyavm9 + + + SequenceFlow_0tyavm9 + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json new file mode 100644 index 0000000000..a4190a76ee --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json @@ -0,0 +1,12 @@ +{ + "cloud-owner": "att-aic", + "cloud-region-id": "mdt1", + "cloud-type": "openstack", + "owner-defined-type": "lcp", + "cloud-region-version": "aic3.0", + "identity-url": "https://localhost:5000/v2.0", + "cloud-zone": "z1", + "complex-name": "c1", + "sriov-automation": false, + "resource-version": "1503072127235" +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_genericVnfGet.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_genericVnfGet.json new file mode 100644 index 0000000000..921918f267 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_genericVnfGet.json @@ -0,0 +1,9 @@ +{ + "vnf-id": "msoVnf123", + "vnf-name": "MSO-Test-VNF-123", + "vnf-type": "vnf-type", + "orchestration-status": "active", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1525360206136" +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json new file mode 100644 index 0000000000..f0936d6648 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json @@ -0,0 +1,434 @@ +{ + "vnf-id": "example-vnf-id-val-90603", + "vnf-name": "example-vnf-name-val-56838", + "vnf-name2": "example-vnf-name2-val-56319", + "vnf-type": "example-vnf-type-val-30533", + "service-id": "example-service-id-val-28290", + "regional-resource-zone": "example-regional-resource-zone-val-11059", + "prov-status": "example-prov-status-val-59777", + "operational-status": "example-operational-status-val-22513", + "in-maint": true, + + "equipment-role": "example-equipment-role-val-23396", + "orchestration-status": "example-orchestration-status-val-59435", + "heat-stack-id": "example-heat-stack-id-val-96869", + "mso-catalog-key": "example-mso-catalog-key-val-30721", + "management-option": "example-management-option-val-61927", + "ipv4-oam-address": "192.168.10.14", + "ipv4-loopback0-address": "example-ipv4-loopback0-address-val-87072", + "nm-lan-v6-address": "example-nm-lan-v6-address-val-91063", + "management-v6-address": "example-management-v6-address-val-80466", + "vcpu": 45837298, + "vcpu-units": "example-vcpu-units-val-86249", + "vmemory": 57288956, + "vmemory-units": "example-vmemory-units-val-13291", + "vdisk": 16937143, + "vdisk-units": "example-vdisk-units-val-73197", + + "is-closed-loop-disabled": true, + "summary-status": "example-summary-status-val-86438", + "encrypted-access-flag": true, + + + + + "model-invariant-id": "example-model-invariant-id-val-14704", + "model-version-id": "example-model-version-id-val-47847", + "model-customization-id": "example-model-customization-id-val-52688", + "widget-model-id": "example-widget-model-id-val-20939", + "widget-model-version": "example-widget-model-version-val-72210", + "as-number": "example-as-number-val-68358", + "regional-resource-subzone": "example-regional-resource-subzone-val-34391", + "nf-type": "example-nf-type-val-54866", + "nf-function": "example-nf-function-val-24790", + "nf-role": "example-nf-role-val-4780", + "nf-naming-code": "example-nf-naming-code-val-25118", + "selflink": "example-selflink-val-68404", + + "relationship-list": {"relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v12/business/customers/customer/e433710f-9217-458d-a79d-1c7aff376d89/service-subscriptions/service-subscription/VIRTUAL%20USP/service-instances/service-instance/2c323333-af4f-4849-af03-c862c0e93e3b", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "e433710f-9217-458d-a79d-1c7aff376d89" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "VIRTUAL USP" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "2c323333-af4f-4849-af03-c862c0e93e3b" + } + ], + "related-to-property": [ { + "property-key": "service-instance.service-instance-name", + "property-value": "kjhgfd1" + }] + }, + { + "related-to": "vserver", + "relationship-label": "tosca.relationships.HostedOn", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn23a" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "e6beab145f6b49098277ac163ac1b4f3" + }, + { + "relationship-key": "vserver.vserver-id", + "relationship-value": "1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5" + } + ], + "related-to-property": [ { + "property-key": "vserver.vserver-name", + "property-value": "comx5000vm003" + }] + }, + { + "related-to": "vserver", + "relationship-label": "tosca.relationships.HostedOn", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/14551849-1e70-45cd-bc5d-a256d49548a2", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn23a" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "e6beab145f6b49098277ac163ac1b4f3" + }, + { + "relationship-key": "vserver.vserver-id", + "relationship-value": "14551849-1e70-45cd-bc5d-a256d49548a2" + } + ], + "related-to-property": [ { + "property-key": "vserver.vserver-name", + "property-value": "comx5000vm002" + }] + }, + { + "related-to": "vserver", + "relationship-label": "tosca.relationships.HostedOn", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/48bd7f11-408f-417c-b834-b41c1b98f7d7", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn23a" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "e6beab145f6b49098277ac163ac1b4f3" + }, + { + "relationship-key": "vserver.vserver-id", + "relationship-value": "48bd7f11-408f-417c-b834-b41c1b98f7d7" + } + ], + "related-to-property": [ { + "property-key": "vserver.vserver-name", + "property-value": "comx5000vm001" + }] + } + ]}, + + + "l-interfaces": { + "l-interface": [ + { + "interface-name": "example-interface-name-val-50593", + "interface-role": "example-interface-role-val-23375", + "v6-wan-link-ip": "example-v6-wan-link-ip-val-5921", + "selflink": "example-selflink-val-75663", + "interface-id": "example-interface-id-val-37465", + "macaddr": "example-macaddr-val-62657", + "network-name": "example-network-name-val-7252", + "management-option": "example-management-option-val-32963", + "interface-description": "example-interface-description-val-89453", + "is-port-mirrored": true, + "vlans": { + "vlan": [ + { + "vlan-interface": "example-vlan-interface-val-16684", + "vlan-id-inner": 8602916, + "vlan-id-outer": 97348542, + "speed-value": "example-speed-value-val-90330", + "speed-units": "example-speed-units-val-15849", + "vlan-description": "example-vlan-description-val-46942", + "backdoor-connection": "example-backdoor-connection-val-78445", + + "orchestration-status": "example-orchestration-status-val-44994", + + + + "l3-interface-ipv4-address-list": [ + { + "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-90277", + "l3-interface-ipv4-prefix-length": 3364150, + "vlan-id-inner": 44021171, + "vlan-id-outer": 55708677, + "is-floating": true, + "neutron-network-id": "example-neutron-network-id-val-43267", + "neutron-subnet-id": "example-neutron-subnet-id-val-62870" + } + ], + "l3-interface-ipv6-address-list": [ + { + "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-45323", + "l3-interface-ipv6-prefix-length": 56688923, + "vlan-id-inner": 5703071, + "vlan-id-outer": 86682265, + "is-floating": true, + "neutron-network-id": "example-neutron-network-id-val-28366", + "neutron-subnet-id": "example-neutron-subnet-id-val-53034" + } + ] + } + ] + }, + "sriov-vfs": { + "sriov-vf": [ + { + "pci-id": "example-pci-id-val-4720", + "vf-vlan-filter": "example-vf-vlan-filter-val-42594", + "vf-mac-filter": "example-vf-mac-filter-val-13375", + "vf-vlan-strip": true, + "vf-vlan-anti-spoof-check": true, + "vf-mac-anti-spoof-check": true, + "vf-mirrors": "example-vf-mirrors-val-6057", + "vf-broadcast-allow": true, + "vf-unknown-multicast-allow": true, + "vf-unknown-unicast-allow": true, + "vf-insert-stag": true, + "vf-link-status": "example-vf-link-status-val-81448", + "neutron-network-id": "example-neutron-network-id-val-9504" + } + ] + }, + "l-interfaces": { + "l-interface": [ + { + "interface-name": "example-interface-name-val-16738", + "interface-role": "example-interface-role-val-13943", + "v6-wan-link-ip": "example-v6-wan-link-ip-val-63173", + "selflink": "example-selflink-val-43085", + "interface-id": "example-interface-id-val-51379", + "macaddr": "example-macaddr-val-16195", + "network-name": "example-network-name-val-45683", + "management-option": "example-management-option-val-78983", + "interface-description": "example-interface-description-val-34414", + "is-port-mirrored": true + } + ] + }, + "l3-interface-ipv4-address-list": [ + { + "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-99078", + "l3-interface-ipv4-prefix-length": 55755841, + "vlan-id-inner": 81525473, + "vlan-id-outer": 90908072, + "is-floating": true, + "neutron-network-id": "example-neutron-network-id-val-47919", + "neutron-subnet-id": "example-neutron-subnet-id-val-84236" + } + ], + "l3-interface-ipv6-address-list": [ + { + "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-21939", + "l3-interface-ipv6-prefix-length": 50057584, + "vlan-id-inner": 75774660, + "vlan-id-outer": 4421090, + "is-floating": true, + "neutron-network-id": "example-neutron-network-id-val-46377", + "neutron-subnet-id": "example-neutron-subnet-id-val-16585" + } + ] + } + ] + }, + "lag-interfaces": { + "lag-interface": [ + { + "interface-name": "example-interface-name-val-39234", + "interface-description": "example-interface-description-val-1037", + "speed-value": "example-speed-value-val-1929", + "speed-units": "example-speed-units-val-74937", + "interface-id": "example-interface-id-val-91265", + "interface-role": "example-interface-role-val-19613", + + + "l-interfaces": { + "l-interface": [ + { + "interface-name": "example-interface-name-val-10722", + "interface-role": "example-interface-role-val-95194", + "v6-wan-link-ip": "example-v6-wan-link-ip-val-24328", + "selflink": "example-selflink-val-24987", + "interface-id": "example-interface-id-val-75726", + "macaddr": "example-macaddr-val-36940", + "network-name": "example-network-name-val-65359", + "management-option": "example-management-option-val-49521", + "interface-description": "example-interface-description-val-70528", + "is-port-mirrored": true, + "vlans": { + "vlan": [ + { + "vlan-interface": "example-vlan-interface-val-70827", + "vlan-id-inner": 55659612, + "vlan-id-outer": 90335612, + "speed-value": "example-speed-value-val-54761", + "speed-units": "example-speed-units-val-91398", + "vlan-description": "example-vlan-description-val-17018", + "backdoor-connection": "example-backdoor-connection-val-4021", + + "orchestration-status": "example-orchestration-status-val-18315", + + + "l3-interface-ipv4-address-list": [ + { + "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-59336", + "l3-interface-ipv4-prefix-length": 57636053, + "vlan-id-inner": 34068397, + "vlan-id-outer": 48570286, + "is-floating": true, + "neutron-network-id": "example-neutron-network-id-val-69862", + "neutron-subnet-id": "example-neutron-subnet-id-val-75795" + } + ], + "l3-interface-ipv6-address-list": [ + { + "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-15038", + "l3-interface-ipv6-prefix-length": 42694503, + "vlan-id-inner": 15929806, + "vlan-id-outer": 87413856, + "is-floating": true, + "neutron-network-id": "example-neutron-network-id-val-52519", + "neutron-subnet-id": "example-neutron-subnet-id-val-24471" + } + ] + } + ] + }, + "sriov-vfs": { + "sriov-vf": [ + { + "pci-id": "example-pci-id-val-44669", + "vf-vlan-filter": "example-vf-vlan-filter-val-53436", + "vf-mac-filter": "example-vf-mac-filter-val-71902", + "vf-vlan-strip": true, + "vf-vlan-anti-spoof-check": true, + "vf-mac-anti-spoof-check": true, + "vf-mirrors": "example-vf-mirrors-val-54963", + "vf-broadcast-allow": true, + "vf-unknown-multicast-allow": true, + "vf-unknown-unicast-allow": true, + "vf-insert-stag": true, + "vf-link-status": "example-vf-link-status-val-1546", + "neutron-network-id": "example-neutron-network-id-val-92159" + } + ] + }, + "l-interfaces": { + "l-interface": [ + { + "interface-name": "example-interface-name-val-9327", + "interface-role": "example-interface-role-val-21859", + "v6-wan-link-ip": "example-v6-wan-link-ip-val-21445", + "selflink": "example-selflink-val-6085", + "interface-id": "example-interface-id-val-39854", + "macaddr": "example-macaddr-val-14433", + "network-name": "example-network-name-val-3722", + "management-option": "example-management-option-val-64739", + "interface-description": "example-interface-description-val-5814", + "is-port-mirrored": true + + + + } + ] + }, + "l3-interface-ipv4-address-list": [ + { + "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-64531", + "l3-interface-ipv4-prefix-length": 66545882, + "vlan-id-inner": 12194134, + "vlan-id-outer": 29589286, + "is-floating": true, + "neutron-network-id": "example-neutron-network-id-val-91108", + "neutron-subnet-id": "example-neutron-subnet-id-val-56984" + } + ], + "l3-interface-ipv6-address-list": [ + { + "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-37408", + "l3-interface-ipv6-prefix-length": 5116459, + "vlan-id-inner": 39229896, + "vlan-id-outer": 15091934, + "is-floating": true, + "neutron-network-id": "example-neutron-network-id-val-87700", + "neutron-subnet-id": "example-neutron-subnet-id-val-37352" + } + ] + } + ] + } + } + ] + }, + "vf-modules": { + "vf-module": [ + { + "vf-module-id": "example-vf-module-id-val-56249", + "vf-module-name": "example-vf-module-name-val-18987", + "heat-stack-id": "example-heat-stack-id-val-80110", + "orchestration-status": "example-orchestration-status-val-8226", + "is-base-vf-module": true, + "model-invariant-id": "example-model-invariant-id-val-5071", + "model-version-id": "example-model-version-id-val-80793", + "model-customization-id": "example-model-customization-id-val-83277", + "widget-model-id": "example-widget-model-id-val-99814", + "widget-model-version": "example-widget-model-version-val-22799", + "contrail-service-instance-fqdn": "example-contrail-service-instance-fqdn-val-52133", + "module-index": 1933, + "selflink": "example-selflink-val-69992" + } + ] + }, + "licenses": { + "license": [ + { + "group-uuid": "example-group-uuid-val-73012", + "resource-uuid": "example-resource-uuid-val-80045" + } + ] + }, + "entitlements": { + "entitlement": [ + { + "group-uuid": "example-group-uuid-val-14874", + "resource-uuid": "example-resource-uuid-val-49146" + } + ] + } + +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_pserverByVnfId.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_pserverByVnfId.json new file mode 100644 index 0000000000..4b1f69aacf --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_pserverByVnfId.json @@ -0,0 +1,72 @@ + { + + "result": [{ + + "hostname": "8862-PserverHOSTNAME-LB1113", + "equipType": "JUNIPER UCPE", + "equipVendor": "JUNIPER", + "equipModel": "QFX51010-PNF", + "ipv4OamAddress": "192.168.5.199", + "serialNumber": "VX986001PNF", + "pserverId": "5715CE4F-8600-58E103FE60C79", + "internetTopology": "WAN", + "inMaint": false, + "resourceVersion": "1500495668780", + "pserverName2": "test81600", + "relationshipList": { + "relationship": [ + { + "relatedTo": "vserver", + "relatedLink": "/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/8862-tenantl-LB1113/vservers/vserver/8862-Lvserver-LB1113", + "relationshipData": [ + { + "relationshipKey": "cloud-region.cloud-owner", + "relationshipValue": "att-aic" + }, + { + "relationshipKey": "cloud-region.cloud-region-id", + "relationshipValue": "AAIAIC25" + }, + { + "relationshipKey": "tenant.tenant-id", + "relationshipValue": "8862-tenantl-LB1113" + }, + { + "relationshipKey": "vserver.vserver-id", + "relationshipValue": "8862-Lvserver-LB1113" + } + ], + "relatedToProperty": [ + { + "propertyKey": "vserver.vserver-name", + "propertyValue": "hjZAYKyl5LO" + } + ] + } + ] + }, + "pinterfaces": { + "pinterface": [ + { + "interfaceName": "ge-0/5/8", + "speedValue": "1", + "speedUnits": "GBPS", + "resourceVersion": "1500495668784", + "inMaint": false + }, + { + "interfaceName": "ge-1/5/8", + "speedValue": "1", + "speedUnits": "GBPS", + "resourceVersion": "1500495668788", + "inMaint": false + } + ] + } + } + + + + ] +} + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_vfModuleByVfModuleId.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_vfModuleByVfModuleId.json new file mode 100644 index 0000000000..d79137b0cd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_vfModuleByVfModuleId.json @@ -0,0 +1,27 @@ +{ + "vf-module-id": "example-vnf-id-val-90603", + "vf-module-name": "example-vnf-name-val-56838", + "vnf-name2": "example-vnf-name2-val-56319", + "vnf-type": "example-vnf-type-val-30533", + "service-id": "example-service-id-val-28290", + "regional-resource-zone": "example-regional-resource-zone-val-11059", + "prov-status": "example-prov-status-val-59777", + "operational-status": "example-operational-status-val-22513", + "in-maint": true, + + "equipment-role": "example-equipment-role-val-23396", + "orchestration-status": "example-orchestration-status-val-59435", + "heat-stack-id": "example-heat-stack-id-val-96869", + "mso-catalog-key": "example-mso-catalog-key-val-30721", + "management-option": "example-management-option-val-61927", + "ipv4-oam-address": "192.168.10.14", + "ipv4-loopback0-address": "example-ipv4-loopback0-address-val-87072", + "nm-lan-v6-address": "example-nm-lan-v6-address-val-91063", + "management-v6-address": "example-management-v6-address-val-80466", + "vcpu": 45837298, + "vcpu-units": "example-vcpu-units-val-86249", + "vmemory": 57288956, + "vmemory-units": "example-vmemory-units-val-13291", + "vdisk": 16937143, + "vdisk-units": "example-vdisk-units-val-73197" +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/mockObject.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/mockObject.json new file mode 100644 index 0000000000..2f97b47dd3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/mockObject.json @@ -0,0 +1,10 @@ +{ + "id" : "something", + "resource-version" : "1234", + "plural" : { + "singular" : [{ + "id" : "something2", + "resource-version" : "5678" + }] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/APPC/appc_error.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/APPC/appc_error.json new file mode 100644 index 0000000000..e28878d1aa --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/APPC/appc_error.json @@ -0,0 +1,21 @@ +{ + "output": { + "status": { + "code": 200, + "message": "RESULT_MESSAGE" + }, + "common-header": { + "api-ver": "API_VERSION", + "request-id": "ECOMP_REQUEST_ID", + "originator-id": "ECOMP_SYSTEM_ID", + "sub-request-id": "ECOMP_SUBREQUEST_ID", + "timestamp": "2016-08-08T23:09:00.11Z", + "flags": { + "ttl": 1000, + "force": "TRUE", + "mode": "EXCLUSIVE" + } + }, + "locked": "TRUE" + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml new file mode 100644 index 0000000000..34079bd23f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml @@ -0,0 +1,75 @@ + + mtn6 + 0422ffb57ba042c0800a29dc85ca70f8 + 8d35a433-c1db-4d54-a611-6de10aeb76f9 + Dev_Bindings_1802_1311 + CONTRAIL30_BASIC + f1fc12e8-afe4-4716-954d-ed4d21a480ad + CONTRAIL + + tbd + + + + true + false + + 2001:051111 + EXPORT + + + 1000:051113 + IMPORT + + + 1000:051112 + BOTH + + + 1000:051115 + EXPORT + + + 1000:051114 + IMPORT + + default-domain:ECOMP_MSO_DND:MSOPolicyD + default-domain:ECOMP_MSO_DND:MSOPolicyC + + + + + 107.118.41.3 + 107.118.41.45 + + 107.118.41.0/24 + true + 107.118.41.1 + 4 + 9dbb9e7e-fe18-421f-bad6-2305bd282471 + + true + + + + 107.118.42.3 + 107.118.42.45 + + 107.118.42.0/24 + true + 107.118.42.1 + 4 + 1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab + + true + + true + true + false + + 3d35ca0c-2da5-4f60-84d9-3e005de335c0 + f1d1c7da-fc42-4c31-866e-cfe963e55723 + + d4515ea9-2852-4d3a-b424-9d7b6cf69d8e + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml new file mode 100644 index 0000000000..607dd5af92 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml @@ -0,0 +1,31 @@ + + d4515ea9-2852-4d3a-b424-9d7b6cf69d8e + true + default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_1311 + 8d35a433-c1db-4d54-a611-6de10aeb76f9 + Dev_Bindings_1802_1311/ecf7e197-72db-452e-9eda-253cb642c9b7 + b6a7820c-4734-4ef2-8a73-a22c824423fa + + mtn6 + f1fc12e8-afe4-4716-954d-ed4d21a480ad + + 3d35ca0c-2da5-4f60-84d9-3e005de335c0 + f1d1c7da-fc42-4c31-866e-cfe963e55723 + + true + Dev_Bindings_1802_1311/ecf7e197-72db-452e-9eda-253cb642c9b7 + CONTRAIL30_BASIC + b6a7820c-4734-4ef2-8a73-a22c824423fa + 0422ffb57ba042c0800a29dc85ca70f8 + + + + 9dbb9e7e-fe18-421f-bad6-2305bd282471 + 27d414c7-1076-4595-aa45-4717ee992cef + + + 1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab + db64710c-fbbc-4dc9-8109-3925b87268fa + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json new file mode 100644 index 0000000000..dda149a560 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json @@ -0,0 +1,10 @@ +{ + "networkTechnology": "NEUTRON", + "failIfExists": false, + "backout": true, + "networkParams": [], + "msoRequest": {}, + "contrailRequest": false, + "skipAAI": false, + "synchronous": true +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json new file mode 100644 index 0000000000..d5d234cbf6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json @@ -0,0 +1,226 @@ +{ + "sharedNetwork": false, + "boundToVpn": false, + "externalNetwork": false, + "providerNetwork": false, + "network-id": "TEST_NETWORK_ID", + "cascaded": false, + "cloud-params": null, + "network-name": "TEST_NETWORK_NAME", + "is-bound-to-vpn": false, + "service-id": null, + "network-role-instance": null, + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "widget-model-id": null, + "widget-model-version": null, + "physical-network-name": null, + "is-provider-network": false, + "is-shared-network": false, + "is-external-network": false, + "self-link": null, + "operational-status": null, + "subnets": { + "subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497", + "host-routes": { + "host-route": [ + { + "host-route-id": "400d286b-7e44-4514-b9b3-f70f7360ff32", + "route-prefix": "172.20.1.0/24", + "next-hop": "10.102.200.1", + "next-hop-type": "ip-address", + "resource-version": "1505857300987" + }, + { + "host-route-id": "6f038013-8b15-4eb8-914b-507489fbc8ee", + "route-prefix": "10.102.0.0/16", + "next-hop": "10.102.200.1", + "next-hop-type": "ip-address", + "resource-version": "1505857301151" + }, + { + "host-route-id": "8811c5f8-f1ed-4fa0-a505-e1be60396e28", + "route-prefix": "192.168.2.0/25", + "next-hop": "10.102.200.1", + "resource-version": "1505857301954" + } + ] + } + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + } + ] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + } + ] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + } + ] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ + { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + } + ], + "related-to-property": [ + { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + } + ] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ + { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + } + ], + "related-to-property": [ + { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + } + ] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ + { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + } + ], + "related-to-property": [ + { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + } + ] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ + { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + } + ], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + { + "property-key": "vpn-binding.vpn-type" + } + ] + } + ] + }, + "ctag-assignments": [ + ], + "segmentation-assignments": [ + ], + "model-info-network": null +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json new file mode 100644 index 0000000000..aa6320801e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json @@ -0,0 +1,216 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": { + "subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497", + "host-routes": { + "host-route": [ + { + "host-route-id": "400d286b-7e44-4514-b9b3-f70f7360ff32", + "route-prefix": "172.20.1.0/24", + "next-hop": "10.102.200.1", + "next-hop-type": "ip-address", + "resource-version": "1505857300987" + }, + { + "host-route-id": "6f038013-8b15-4eb8-914b-507489fbc8ee", + "route-prefix": "10.102.0.0/16", + "next-hop": "10.102.200.1", + "next-hop-type": "ip-address", + "resource-version": "1505857301151" + }, + { + "host-route-id": "8811c5f8-f1ed-4fa0-a505-e1be60396e28", + "route-prefix": "192.168.2.0/25", + "next-hop": "10.102.200.1", + "resource-version": "1505857301954" + } + ] + } + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + } + ] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + } + ] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + } + ] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ + { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + } + ], + "related-to-property": [ + { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + } + ] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ + { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + } + ], + "related-to-property": [ + { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + } + ] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ + { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + } + ], + "related-to-property": [ + { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + } + ] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ + { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + } + ], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + { + "property-key": "vpn-binding.vpn-type" + } + ] + } + ] + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json new file mode 100644 index 0000000000..5addff2d70 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json @@ -0,0 +1,596 @@ +{ + "cloud-owner": "att-aic", + "cloud-region-id": "mtn6", + "cloud-type": "openstack", + "owner-defined-type": "LCP", + "cloud-region-version": "3.0", + "cloud-zone": "AUS1", + "complex-name": "mtn6", + "resource-version": "1485202577", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-125" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2002" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-126" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0509A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0511C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_1Bindings_324_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-155" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "ST-MTN6-NoBinding-1707-18-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1710-4001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-119" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "aaaa-bbbb-cccc-dddd-eeee" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "direct_dhcp_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512B" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-1Binding-1710-0814-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-MTN6-NoBinding-1707-20-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1111-2222-3333-4444-5555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "dev_Bindings_full_1710_0907A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "wwww-xxxx-yyyy-zzzz" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-1002" + }] + }, + { + "related-to": "complex", + "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR", + "relationship-data": [ { + "relationship-key": "complex.physical-location-id", + "relationship-value": "AUSTTXGR" + }] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json new file mode 100644 index 0000000000..fadbf9c244 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json @@ -0,0 +1,596 @@ +{ + "cloud-owner": "att-aic", + "cloud-region-id": "mtn6", + "cloud-type": "openstack", + "owner-defined-type": "LCP", + "cloud-region-version": "2.5", + "cloud-zone": "AUS1", + "complex-name": "mtn6", + "resource-version": "1485202577", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-125" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2002" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-126" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0509A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0511C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_1Bindings_324_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-155" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "ST-MTN6-NoBinding-1707-18-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1710-4001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-119" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "aaaa-bbbb-cccc-dddd-eeee" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "direct_dhcp_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512B" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-1Binding-1710-0814-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-MTN6-NoBinding-1707-20-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1111-2222-3333-4444-5555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "dev_Bindings_full_1710_0907A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "wwww-xxxx-yyyy-zzzz" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-1002" + }] + }, + { + "related-to": "complex", + "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR", + "relationship-data": [ { + "relationship-key": "complex.physical-location-id", + "relationship-value": "AUSTTXGR" + }] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json new file mode 100644 index 0000000000..97611c1d62 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json @@ -0,0 +1,596 @@ +{ + "cloud-owner": "att-aic", + "cloud-region-id": "ERROR", + "cloud-type": "openstack", + "owner-defined-type": "LCP", + "cloud-region-version": "3.0", + "cloud-zone": "AUS1", + "complex-name": "mtn6", + "resource-version": "1485202577", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-125" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2002" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-126" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0509A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0511C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_1Bindings_324_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-155" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "ST-MTN6-NoBinding-1707-18-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1710-4001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-119" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "aaaa-bbbb-cccc-dddd-eeee" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "direct_dhcp_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512B" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-1Binding-1710-0814-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-MTN6-NoBinding-1707-20-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1111-2222-3333-4444-5555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "dev_Bindings_full_1710_0907A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "wwww-xxxx-yyyy-zzzz" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-1002" + }] + }, + { + "related-to": "complex", + "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR", + "relationship-data": [ { + "relationship-key": "complex.physical-location-id", + "relationship-value": "AUSTTXGR" + }] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json new file mode 100644 index 0000000000..181494dff2 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json @@ -0,0 +1,141 @@ +{ + "network-id": "467e3349-bec1-4922-bcb1-d0bb041bce30", + "network-name": "vprobes_pktinternal_net_4_1806", + "network-type": "CONTRAIL30_BASIC", + "network-role": "NetworkPktinternalInt2.pktinternal_int", + "network-technology": "", + "is-bound-to-vpn": false, + "service-id": "eb68dedb-840d-4bd4-a745-d9fcd8fc8468", + "network-role-instance": 0, + "resource-version": "1527285069624", + "orchestration-status": "Assigned", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": false, + "is-external-network": false, + "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/eb68dedb-840d-4bd4-a745-d9fcd8fc8468/service-data/networks/network/467e3349-bec1-4922-bcb1-d0bb041bce30/network-data/network-topology/", + "subnets": { + "subnet": [ + { + "subnet-id": "46aee427-3aa0-4c1f-beb6-edf6caae2dc1", + "subnet-name": "vprobes_pktinternal_net_4_1806_subnet_1", + "gateway-address": "192.168.224.1", + "network-start-address": "192.168.224.0", + "cidr-mask": "21", + "ip-version": "4", + "orchestration-status": "PendingCreate", + "dhcp-enabled": false, + "dhcp-start": "192.168.224.3", + "dhcp-end": "192.168.224.5", + "subnet-role": "DHCP", + "ip-assignment-direction": "true", + "resource-version": "1527285068387", + "host-routes": { + "host-route": [ + { + "host-route-id": "1de02743-580a-4f99-8285-3ba6eadb0892", + "route-prefix": "", + "next-hop": "", + "resource-version": "1527285059650" + } + ] + } + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Mobility/service-instances/service-instance/eb68dedb-840d-4bd4-a745-d9fcd8fc8468", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "Mobility" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "eb68dedb-840d-4bd4-a745-d9fcd8fc8468" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "eb68dedb-840d-4bd4-a745-d9fcd8fc8468" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "DYH1A" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type", + "property-value": "lcp" + } + ] + }, + { + "related-to": "tenant", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A/tenants/tenant/2871503957144f72b3cf481b379828ec", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "DYH1A" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "2871503957144f72b3cf481b379828ec" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "APP-C-24595-T-IST-04A" + } + ] + }, + { + "related-to": "vpn-binding", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/vpn-bindings/vpn-binding/13e94b71-3ce1-4988-ab0e-61208fc91f1c", + "relationship-data": [ + { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "13e94b71-3ce1-4988-ab0e-61208fc91f1c" + } + ], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "vMDNS" + }, + { + "property-key": "vpn-binding.vpn-type" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json new file mode 100644 index 0000000000..b22f389c40 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json @@ -0,0 +1,166 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": {"subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497" + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ]}, + "relationship-list": {"relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + }] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + }] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8" + } + ], + "related-to-property": [ { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + }] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + }], + "related-to-property": [ { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + }] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + }], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + {"property-key": "vpn-binding.vpn-type"} + ] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json new file mode 100644 index 0000000000..c581e54ef0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json @@ -0,0 +1,53 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": {"subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497" + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ]}, + "relationship-list": {"relationship": [] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json new file mode 100644 index 0000000000..5d9231d4c6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json @@ -0,0 +1,891 @@ +{ + "vpn-id": "13e94b71-3ce1-4988-ab0e-61208fc91f1c", + "vpn-name": "vMDNS", + "resource-version": "1510956324462", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/b3376949-5487-4a74-9029-332c07720c07", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b3376949-5487-4a74-9029-332c07720c07" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_hsl_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/d0b8ecd3-aee4-48ba-8bc5-222d3fb08162", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d0b8ecd3-aee4-48ba-8bc5-222d3fb08162" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/34305bd0-ad54-4349-8567-6f65ea09e750", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "34305bd0-ad54-4349-8567-6f65ea09e750" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vEPDG-FN_swu_direct_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/dfa4972a-ed82-43cd-98be-ed73bb3406a9", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "dfa4972a-ed82-43cd-98be-ed73bb3406a9" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_EXN_INTERNET_NET_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/93556256-aa23-449d-a2fd-3a9c034f232a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "93556256-aa23-449d-a2fd-3a9c034f232a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_CORE-NSD-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/7ce01c3a-5998-4908-85f6-ab29bc507a92", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7ce01c3a-5998-4908-85f6-ab29bc507a92" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKEN_CORE-NSD-TOAM0_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/016d3722-999b-4133-b4e6-8a1088bab664", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "016d3722-999b-4133-b4e6-8a1088bab664" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND-vepdg-FN-Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/80038196-9eae-452c-ad06-1f3fef1bef9f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "80038196-9eae-452c-ad06-1f3fef1bef9f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VPMS-FN-26071-T-BE-01_cdr_direct_net420" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f5f38447-dc62-4969-90a3-c60474f9c0ac", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f5f38447-dc62-4969-90a3-c60474f9c0ac" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_3" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/58b374aa-01ca-4a39-99b9-889c2f7ae908", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "58b374aa-01ca-4a39-99b9-889c2f7ae908" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_OAM_MGMT_NET_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/efe0dfca-18e7-4992-a63a-041b9f8271e0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "efe0dfca-18e7-4992-a63a-041b9f8271e0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_APN-dns_int_apn_dns_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/dab7e704-6a6e-4c53-9a80-fb5857a43b6f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "dab7e704-6a6e-4c53-9a80-fb5857a43b6f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKEN_CORE-NSD-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/634653b3-9084-41d9-ad6a-40863a3d666f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "634653b3-9084-41d9-ad6a-40863a3d666f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-01A_int_fw_dns_trusted_net_5" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6117b35e-c029-4308-85e6-007c24014484", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6117b35e-c029-4308-85e6-007c24014484" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-D-T001_vprobes_int_mgmt_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/eb1ce51b-d10f-4b08-9166-345335b9f73b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "eb1ce51b-d10f-4b08-9166-345335b9f73b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_OAMP_NSD_ISBC0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/468f83be-4abb-4901-950b-e399b77a09a0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "468f83be-4abb-4901-950b-e399b77a09a0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_IRPR-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/103d17dc-6575-427c-a2c1-301493e08ec0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "103d17dc-6575-427c-a2c1-301493e08ec0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_segw_hsl_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/305214f8-64be-4209-8a0d-10b6dfb77dd1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "305214f8-64be-4209-8a0d-10b6dfb77dd1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vMDS_FN_int_fw_dns_trusted_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/7989a6d2-ba10-4a5d-8f15-4520bc833090", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7989a6d2-ba10-4a5d-8f15-4520bc833090" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02AShared_cor_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f040ebf4-76ad-4b05-a766-1deec26549ae", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f040ebf4-76ad-4b05-a766-1deec26549ae" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_gn_untrusted_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/26d6038b-4b9e-4fe5-bcff-9af7586651cc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "26d6038b-4b9e-4fe5-bcff-9af7586651cc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-D-T001_vprobes_pktinternal_net_10" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/9e78d3f4-85b5-40b8-803e-c3a0ab6d6165", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9e78d3f4-85b5-40b8-803e-c3a0ab6d6165" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_MNS_Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/a2de22f9-eb91-452e-aff5-e81a1a679ef6", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "a2de22f9-eb91-452e-aff5-e81a1a679ef6" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_GN_DIRECT_NET_01" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6d6b7254-72d2-4731-80d6-8e8375d959e9", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6d6b7254-72d2-4731-80d6-8e8375d959e9" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_VDBE-PED-DMZ0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/21819ac4-95c4-490f-ba7c-0ad92920f805", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "21819ac4-95c4-490f-ba7c-0ad92920f805" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_FN_int_pktinternal_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/98ff6827-320a-4b71-bd2b-df2bd20b6855", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "98ff6827-320a-4b71-bd2b-df2bd20b6855" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_oam_protected_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/e229ab86-279c-4505-a08a-91e373293e20", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e229ab86-279c-4505-a08a-91e373293e20" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_OAM_DIRECT_NET_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/bb722f93-2d1a-42a5-bd11-57ad30ff1085", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "bb722f93-2d1a-42a5-bd11-57ad30ff1085" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_segw_hsl_direct_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0399443d-1fc6-42a6-934c-77030d751916", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0399443d-1fc6-42a6-934c-77030d751916" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VDBE-PED-DMZ0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/d259ec74-304d-4bd2-bbd6-93c201acba42", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d259ec74-304d-4bd2-bbd6-93c201acba42" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A__vprobes_int_mgmt_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f69fb458-e2bd-4d0f-9a47-430d18cbebfd", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f69fb458-e2bd-4d0f-9a47-430d18cbebfd" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VPMS-FN-26071-T-BE-01_cdr_direct_net4" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0f18b91f-ee79-403b-a081-8c0a89650641", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0f18b91f-ee79-403b-a081-8c0a89650641" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VPMS-FN_int_pktinternal_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/90fdbbbb-42bb-41ff-9356-db245466a4fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "90fdbbbb-42bb-41ff-9356-db245466a4fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_oam_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0e66adce-d5dd-4968-bcb2-83f0281424db", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0e66adce-d5dd-4968-bcb2-83f0281424db" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKEN_VDBF-MIS-UDAT0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/db572383-dbd7-4d5e-93cb-8c7c1d209a90", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "db572383-dbd7-4d5e-93cb-8c7c1d209a90" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_TRST_VIF_ISBC0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/478b7f86-8544-48e5-95f1-568dfd18730d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "478b7f86-8544-48e5-95f1-568dfd18730d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_GN_DIRECT_NET_01" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0f725895-5224-4016-b49a-d9d016eaafff", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0f725895-5224-4016-b49a-d9d016eaafff" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/9cd47b0c-ee58-46f0-9ec5-b4db504dd59b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9cd47b0c-ee58-46f0-9ec5-b4db504dd59b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-FN-25180-T-01Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f95259c9-f5c6-4861-a9f4-b6eec199b33f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f95259c9-f5c6-4861-a9f4-b6eec199b33f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/caf98ee4-2496-4c92-a41c-b6a50efcc29f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "caf98ee4-2496-4c92-a41c-b6a50efcc29f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_MGM-CORE-NSD-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/754739cb-5371-4d5b-a02a-489587d17443", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "754739cb-5371-4d5b-a02a-489587d17443" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_4" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8cd7add8-0cfc-4f65-bbf8-d0f25a0dbc70", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8cd7add8-0cfc-4f65-bbf8-d0f25a0dbc70" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VDBE-MIS-UDAT0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/7093921f-bed8-4866-bb3c-a2b8c376ca69", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7093921f-bed8-4866-bb3c-a2b8c376ca69" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_VIRPR-TDAT0_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/691da8b2-805e-4dd1-aaf5-b0e37414c662", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "691da8b2-805e-4dd1-aaf5-b0e37414c662" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_int_pktmirror_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/00eaa0b3-90df-4b43-a850-9d30abb7fded", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "00eaa0b3-90df-4b43-a850-9d30abb7fded" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-01AShared_oam_protected_net_5" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6ba57200-c61a-46be-821b-88b3fa169b66", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ba57200-c61a-46be-821b-88b3fa169b66" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_3" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8e32ec2c-47a1-4514-b21a-2806e23f0437", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8e32ec2c-47a1-4514-b21a-2806e23f0437" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKENb_VDBF-PSD-DMZ0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/a755ddd0-512a-444d-9f38-97b3eff70f85", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "a755ddd0-512a-444d-9f38-97b3eff70f85" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_UNTR_VSE_ISBC0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c7bde85d-1c12-467c-ae6f-57bdf5c1d380", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7bde85d-1c12-467c-ae6f-57bdf5c1d380" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKENb_VDBF-PSD-DMZ0_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0933fcec-9e78-4045-a21a-8258e18cb78e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0933fcec-9e78-4045-a21a-8258e18cb78e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vdbe_oam_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6a26a729-d9ce-4619-a20e-38597205ba7d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6a26a729-d9ce-4619-a20e-38597205ba7d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_swu_direct_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c1a06665-518b-408b-bfe0-8f393204baf6", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1a06665-518b-408b-bfe0-8f393204baf6" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/fb51398b-7622-4570-9bd6-e29c82621d44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb51398b-7622-4570-9bd6-e29c82621d44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_4" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/92072731-1c40-45c2-a218-5e75b713b312", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92072731-1c40-45c2-a218-5e75b713b312" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_TRST_VIF_ISBC0_net_0001" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c6d94632-fd6b-4bfe-993e-377b0368476b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c6d94632-fd6b-4bfe-993e-377b0368476b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-01AShared_int_ha_net_5" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/84516ef3-e371-4039-908e-83cd2b55a4a1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "84516ef3-e371-4039-908e-83cd2b55a4a1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "VPMS-FN-26071-T-BE-01_vprobes_int_mgmt_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/2c4f3adc-1a45-4484-8fb6-9eeac99eb922", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "2c4f3adc-1a45-4484-8fb6-9eeac99eb922" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_VDBE-MIS-UDAT0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/1fea0624-dac2-4997-904d-34ca1bc12fa9", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1fea0624-dac2-4997-904d-34ca1bc12fa9" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02AShared_cps_internal_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8ab98982-05b7-45b2-828d-648da3d6cc0f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8ab98982-05b7-45b2-828d-648da3d6cc0f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_swu_direct_fn_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c8934d59-24a8-41cc-af9d-2026ef261843", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c8934d59-24a8-41cc-af9d-2026ef261843" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_oam_protected_net_vrar_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c741fe5b-bf27-4ad9-b30d-20518e115495", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c741fe5b-bf27-4ad9-b30d-20518e115495" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_int_apn_dns_fn_net_PB_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8285fbae-ec25-44f7-ac52-89a968d45a2b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8285fbae-ec25-44f7-ac52-89a968d45a2b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-T2B_vEPDG-FN_swu_direct_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/65e6d4b0-0c96-4bfa-bdd6-2baa16df322a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65e6d4b0-0c96-4bfa-bdd6-2baa16df322a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vEPDG-FN_gn_untrusted_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/38e51c7b-adc2-491a-a036-3189645b007c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "38e51c7b-adc2-491a-a036-3189645b007c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vprobes_pktinternal_net_2_1806" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/4d210b09-b6ce-41b3-95a6-5e4dffea9ca2", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4d210b09-b6ce-41b3-95a6-5e4dffea9ca2" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vprobes_pktinternal_net_3_1806" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c5df1c57-3c85-4abc-973f-a1ffb13e391a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c5df1c57-3c85-4abc-973f-a1ffb13e391a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/467e3349-bec1-4922-bcb1-d0bb041bce30", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "467e3349-bec1-4922-bcb1-d0bb041bce30" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vprobes_pktinternal_net_4_1806" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/1596f4d2-66b5-4627-96f2-c26794154530", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1596f4d2-66b5-4627-96f2-c26794154530" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_2" + }] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml new file mode 100644 index 0000000000..6dd91c64c9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml @@ -0,0 +1,145 @@ + + 8d35a433-c1db-4d54-a611-6de10aeb76f9 + Dev_Bindings_1802_1311 + CONTRAIL30_BASIC + GN_EVPN_direct + contrail + true + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + 1517430804756 + pending-create + tbd + true + true + false + + + 9dbb9e7e-fe18-421f-bad6-2305bd282471 + + 107.118.41.1 + 107.118.41.0 + 24 + 4 + pending-create + true + 107.118.41.3 + 107.118.41.45 + + true + 1517430804770 + + + 1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab + + 107.118.42.1 + 107.118.42.0 + 24 + 4 + pending-create + true + 107.118.42.3 + 107.118.42.45 + + true + 1517430804782 + + + + + service-instance + /aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/f1d1c7da-fc42-4c31-866e-cfe963e55723 + + customer.global-customer-id + MSO_1610_dev + + + service-subscription.service-type + MSO-dev-service-type + + + service-instance.service-instance-id + f1d1c7da-fc42-4c31-866e-cfe963e55723 + + + service-instance.service-instance-name + MSO-DEV-SI-1802-v6-1-31-nwk1 + + + + cloud-region + /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6 + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + cloud-region.owner-defined-type + LCP + + + + tenant + /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8 + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + tenant.tenant-id + 0422ffb57ba042c0800a29dc85ca70f8 + + + tenant.tenant-name + ECOMP_MSO_DND + + + + network-policy + /aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc + + network-policy.network-policy-id + 0219d83f-7c4a-48e2-b8fc-9b20459356bc + + + network-policy.network-policy-fqdn + default-domain:ECOMP_MSO_DND:MSOPolicyD + + + + network-policy + /aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64 + + network-policy.network-policy-id + e7a3560c-8b29-4611-a404-83af0b31ce64 + + + network-policy.network-policy-fqdn + default-domain:ECOMP_MSO_DND:MSOPolicyC + + + + vpn-binding + /aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001 + + vpn-binding.vpn-id + 9a7b327d9-287aa00-82c4b0-100001 + + + vpn-binding.vpn-name + MSO_VPN_TEST + + + vpn-binding.vpn-type + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json new file mode 100644 index 0000000000..f076c9044c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json @@ -0,0 +1,162 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": {"subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497" + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ]}, + "relationship-list": {"relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + }] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + }] + }, + { + "related-to": "vf-module", + "related-link": "aai/v11/network/generic-vnfs/generic-vnf/105df7e5-0b3b-49f7-a837-4864b62827c4/vf-modules/vf-module/d9217058-95a0-49ee-b9a9-949259e89349", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "105df7e5-0b3b-49f7-a837-4864b62827c4" + }, + { + "relationship-key": "vf-module.vf-module-id", + "relationship-value": "d9217058-95a0-49ee-b9a9-949259e89349" + } + ], + "related-to-property": [ { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + }] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + }], + "related-to-property": [ { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + }] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + }], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + {"property-key": "vpn-binding.vpn-type"} + ] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml new file mode 100644 index 0000000000..92fec2dc64 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml @@ -0,0 +1,149 @@ + + 8d35a433-c1db-4d54-a611-6de10aeb76f9 + Dev_Bindings_1802_1311 + CONTRAIL30_BASIC + GN_EVPN_direct + contrail + b6a7820c-4734-4ef2-8a73-a22c824423fa + true + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + 1517430804756 + Created + Dev_Bindings_1802_1311/ecf7e197-72db-452e-9eda-253cb642c9b7 + default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_1311 + tbd + true + true + false + + + 9dbb9e7e-fe18-421f-bad6-2305bd282471 + 27d414c7-1076-4595-aa45-4717ee992cef + 107.118.41.1 + 107.118.41.0 + 24 + 4 + Created + true + 107.118.41.3 + 107.118.41.45 + 1517430804770 + + true + + + 1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab + db64710c-fbbc-4dc9-8109-3925b87268fa + 107.118.42.1 + 107.118.42.0 + 24 + 4 + Created + true + 107.118.42.3 + 107.118.42.45 + 1517430804782 + + true + + + + + service-instance + /aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/f1d1c7da-fc42-4c31-866e-cfe963e55723 + + customer.global-customer-id + MSO_1610_dev + + + service-subscription.service-type + MSO-dev-service-type + + + service-instance.service-instance-id + f1d1c7da-fc42-4c31-866e-cfe963e55723 + + + service-instance.service-instance-name + MSO-DEV-SI-1802-v6-1-31-nwk1 + + + + cloud-region + /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6 + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + cloud-region.owner-defined-type + LCP + + + + tenant + /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8 + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + tenant.tenant-id + 0422ffb57ba042c0800a29dc85ca70f8 + + + tenant.tenant-name + ECOMP_MSO_DND + + + + network-policy + /aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc + + network-policy.network-policy-id + 0219d83f-7c4a-48e2-b8fc-9b20459356bc + + + network-policy.network-policy-fqdn + default-domain:ECOMP_MSO_DND:MSOPolicyD + + + + network-policy + /aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64 + + network-policy.network-policy-id + e7a3560c-8b29-4611-a404-83af0b31ce64 + + + network-policy.network-policy-fqdn + default-domain:ECOMP_MSO_DND:MSOPolicyC + + + + vpn-binding + /aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001 + + vpn-binding.vpn-id + 9a7b327d9-287aa00-82c4b0-100001 + + + vpn-binding.vpn-name + MSO_VPN_TEST + + + vpn-binding.vpn-type + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf new file mode 100644 index 0000000000..09634c199b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf @@ -0,0 +1,107 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "complete", + "statusMessage": "", + "solutionInfo": { + "licenseInfo": [ + { + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_primary_1", + "serviceResourceId": "testResourceIdAR" + }, + { + "entitlementPoolList": [ + "91d563e8-e714-4393-8f99-cc480144a05e", + "21d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "31d563e8-e714-4393-8f99-cc480144a05e", + "71d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_secondary_1", + "serviceResourceId": "testResourceIdVNF" + } + ], + "placementInfo": [ + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "MDTNJ01" + }, + { + "variableName": "aicClli", + "variableValue": "KDTNJ01" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "dfwtx", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID1", + "serviceResourceId": "testResourceIdAR" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "testVnfHostname2" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli2" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId2", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID2", + "serviceResourceId": "testResourceIdAR2" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli3" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId3", + "inventoryType": "cloud", + "resourceModuleName": "VNF", + "serviceInstanceId": "", + "serviceResourceId": "testResourceIdVNF" + } + ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net new file mode 100644 index 0000000000..ac9b466ab7 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net @@ -0,0 +1,165 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "complete", + "statusMessage": "", + "solutionInfo": { + "licenseInfo": [ + { + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_primary_1", + "serviceResourceId": "testResourceIdAR" + }, + { + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05n", + "j1d563e8-e714-4393-8f99-cc480144a05n" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05n", + "b1d563e8-e714-4393-8f99-cc480144a05n" + ], + "resourceModuleName": "net", + "serviceResourceId": "testResourceIdNet2" + }, + { + "entitlementPoolList": [ + "91d563e8-e714-4393-8f99-cc480144a05e", + "21d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "31d563e8-e714-4393-8f99-cc480144a05e", + "71d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_secondary_1", + "serviceResourceId": "testResourceIdVNF" + } + ], + "placementInfo": [ + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "MDTNJ01" + }, + { + "variableName": "aicClli", + "variableValue": "KDTNJ01" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "dfwtx", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID1", + "serviceResourceId": "testResourceIdAR" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "testVnfHostname2" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli2" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId2", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID2", + "serviceResourceId": "testResourceIdAR2" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "testVnfHostNameNet" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClliNet" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionIdNet", + "inventoryType": "service", + "resourceModuleName": "NETWORK", + "serviceInstanceId": "testServiceInstanceIdNet", + "serviceResourceId": "testResourceIdNet" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClliNet2" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionIdNet2", + "inventoryType": "cloud", + "resourceModuleName": "NETWORK", + "serviceInstanceId": "", + "serviceResourceId": "testResourceIdNet2" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli3" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId3", + "inventoryType": "cloud", + "resourceModuleName": "VNF", + "serviceInstanceId": "", + "serviceResourceId": "testResourceIdVNF" + } + ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound new file mode 100644 index 0000000000..2150a053fb --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound @@ -0,0 +1,15 @@ +{ + "requestState": "", + "responseTime": "", + "solutionInfo": { + "placementInfo": [], + "licenseInfo": { + "featureGroupId": "" + } + }, + "percentProgress": "", + "requestId": "02c2e322-5839-4c97-9d46-0a5fa6bb642e", + "startTime": "", + "statusMessage": "No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8", + "requestType": "" +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException new file mode 100644 index 0000000000..b82688428e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException @@ -0,0 +1,9 @@ +{ + "requestError": { + "policyException": { + "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", + "text": "Message content size exceeds the allowable limit", + "messageId": "SVC0001" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException new file mode 100644 index 0000000000..6cc78a7cdb --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException @@ -0,0 +1,12 @@ +{ + "requestError": { + "serviceException": { + "variables": [ + "severity", 400 + ], + "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", + "text": "SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8", + "messageId": "SVC0001" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml new file mode 100644 index 0000000000..90c668c576 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 2.5 + RDM2WAGPLCP + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml new file mode 100644 index 0000000000..9b651f25e3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 3.0 + RDM2WAGPLCP + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_400.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_400.xml new file mode 100644 index 0000000000..a5640b2b26 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_400.xml @@ -0,0 +1,6 @@ + + +680bd458-5ec1-4a16-b77c-509022e53450INTERNAL +400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data +true + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_500.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_500.xml new file mode 100644 index 0000000000..02996a13ea --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_500.xml @@ -0,0 +1,80 @@ + + + JBoss Web/7.2.2.Final-redhat-1 - JBWEB000064: Error report + + + + +

JBWEB000065: HTTP Status 500 - java.lang.NullPointerException

+
+

+ JBWEB000309: type + JBWEB000066: Exception report +

+

+ JBWEB000068: message + java.lang.NullPointerException +

+

+ JBWEB000069: description + JBWEB000145: The server encountered an internal error that + prevented it from fulfilling this request. + +

+

+ JBWEB000070: exception +

org.jboss.resteasy.spi.UnhandledException:
+				java.lang.NullPointerException
+				org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365)
+				org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233)
+				org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209)
+				org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557)
+				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
+				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
+				org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
+				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
+				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
+				javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
+				org.onap.so.logger.LogFilter.doFilter(LogFilter.java:35)
+			
+

+

+ JBWEB000071: root cause +

java.lang.NullPointerException
+				org.onap.so.adapters.network.NetworkAdapterRest$CreateNetworkVolumesTask.run(NetworkAdapterRest.java:128)
+				org.onap.so.adapters.network.NetworkAdapterRest.createNetwork(NetworkAdapterRest.java:64)
+				sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+				sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+				sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+				java.lang.reflect.Method.invoke(Method.java:606)
+				org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
+				org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
+				org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
+				org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
+				org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
+				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
+				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
+				org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
+				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
+				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
+				javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
+				org.onap.so.logger.LogFilter.doFilter(LogFilter.java:35)
+			
+

+

+ JBWEB000072: note + JBWEB000073: The full stack trace of the root cause is available + in the JBoss Web/7.2.2.Final-redhat-1 logs. + +

+
+

JBoss Web/7.2.2.Final-redhat-1

+ + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_Success.xml new file mode 100644 index 0000000000..90177f1c6d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_Success.xml @@ -0,0 +1,24 @@ + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + + + + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + true + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + CONTRAIL_EXTERNAL + false + c4f4e878-cde0-4b15-ae9a-bda857759cea + 7dd5365547234ee8937416c65507d266 + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryInstance_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryInstance_Success.xml new file mode 100644 index 0000000000..ca5145c226 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryInstance_Success.xml @@ -0,0 +1,4 @@ + + service-instance + https://aai-conexus-e2e.test.com:8443/aai/v8/business/customers/customer/8310000058863/service-subscriptions/service-subscription/vMOG/service-instances/service-instance/f70e927b-6087-4974-9ef8-c5e4d5847ca4 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName2_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName2_AAIResponse_Success.xml new file mode 100644 index 0000000000..d6f7737a2a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName2_AAIResponse_Success.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4_3 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNameActive_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNameActive_AAIResponse_Success.xml new file mode 100644 index 0000000000..03b37814b1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNameActive_AAIResponse_Success.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_2 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + active + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + active + true + subnetName + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + route-table-reference + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_404.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_404.xml new file mode 100644 index 0000000000..5cda12da2f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_404.xml @@ -0,0 +1,19 @@ + + 404 + HTTP method: GET Not Found + <Fault> + <requestError> + <serviceException> + <messageId>SVC3001</messageId> + <text>Resource not found for %1 using id %2 (msg=%3) (ec=%4)</text> + <variables> + <variable>GETl3Networks</variable> + <variable xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/> + <variable>Node Not Found:No Node of type l3Network found for properties: (network-id = null)</variable> + <variable>ERR.5.4.6114</variable> + </variables> + </serviceException> + </requestError> +</Fault> + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml new file mode 100644 index 0000000000..4eadb1061e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_404.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_404.xml new file mode 100644 index 0000000000..5cda12da2f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_404.xml @@ -0,0 +1,19 @@ + + 404 + HTTP method: GET Not Found + <Fault> + <requestError> + <serviceException> + <messageId>SVC3001</messageId> + <text>Resource not found for %1 using id %2 (msg=%3) (ec=%4)</text> + <variables> + <variable>GETl3Networks</variable> + <variable xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/> + <variable>Node Not Found:No Node of type l3Network found for properties: (network-id = null)</variable> + <variable>ERR.5.4.6114</variable> + </variables> + </serviceException> + </requestError> +</Fault> + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml new file mode 100644 index 0000000000..e06d27ea88 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml @@ -0,0 +1,73 @@ + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml new file mode 100644 index 0000000000..6e319c4c73 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + true + + + string + 192.10.16.0/24 + 192.10.16.100/24 + ip-address + + + string + 192.110.17.0/24 + 192.110.17.110/24 + ip-address + + + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..79cc14ada3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 13979:105757 + 13979:105757 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml new file mode 100644 index 0000000000..db134a1127 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + 5938baec-03ca-2bd5-a3f1-d54x123e253a + refFQDN1 + 12345 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml new file mode 100644 index 0000000000..34b4a036c4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + 5938baec-03ca-2bd5-a3f1-d54x123e253a + refFQDN2 + 12345 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBindingList_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBindingList_AAIResponse_Success.xml new file mode 100644 index 0000000000..c01d0a4f61 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBindingList_AAIResponse_Success.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + + + 13979:105708 + EXPORT + 1504025599510 + + + 13979:105707 + IMPORT + 1504025599519 + + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ + + l3-network.network-id + 689ec39e-c5fc-4462-8db2-4f760763ad28 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ + + l3-network.network-id + 1a49396b-19b3-40a4-8792-aa2fbd0f0704 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ + + l3-network.network-id + 774f3329-3c83-4771-86c7-9e6207cd50fd + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml new file mode 100644 index 0000000000..5f1c2cafa5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 13979:105757 + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ + + l3-network.network-id + 689ec39e-c5fc-4462-8db2-4f760763ad28 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ + + l3-network.network-id + 1a49396b-19b3-40a4-8792-aa2fbd0f0704 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ + + l3-network.network-id + 774f3329-3c83-4771-86c7-9e6207cd50fd + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml new file mode 100644 index 0000000000..eedbda9343 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml new file mode 100644 index 0000000000..4f87e1a1da --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml @@ -0,0 +1,15 @@ + + + + + + + 79ec9006-3695-4fcc-93a8-be6f9e248beb + 200 + OK + + <output xmlns="org:onap:sdnc:northbound:generic-resource"><response-message></response-message><svc-request-id>79ec9006-3695-4fcc-93a8-be6f9e248beb</svc-request-id><service-response-information><instance-id>f805ec2b-b4d8-473e-8325-67f110139e5d</instance-id></service-response-information><response-code>200</response-code><network-response-information><instance-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</instance-id><object-path>restconf/config/GENERIC-RESOURCE-API:services/service/f805ec2b-b4d8-473e-8325-67f110139e5d/service-data/networks/network/f7e4db56-aab5-4065-8e65-cec1cd1de24f</object-path></network-response-information><ack-final-indicator>Y</ack-final-indicator></output> + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml new file mode 100644 index 0000000000..836b3c8055 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml @@ -0,0 +1,17 @@ + + + + + + + testRequestId + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/DoCreateServiceInstanceInput.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/DoCreateServiceInstanceInput.json new file mode 100644 index 0000000000..45b09a1f59 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/DoCreateServiceInstanceInput.json @@ -0,0 +1,42 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "service", +"modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", +"modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", +"modelName": "Test", +"modelVersion": "1.0" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "mdt1", +"tenantId": "88a6ca3ee0394ade9403f075db23167e" +}, +"owningEntity": { +"owningEntityId": "a", +"owningEntityName": "a" +}, +"project": { +"projectName": "temp project" +}, +"subscriberInfo": { +"globalSubscriberId": "some subscriber id", +"subscriberName": "some subscriber name" +}, +"requestInfo": { +"productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", +"source": "VID", +"suppressRollback": true, +"requestorId": "xxxxxx" +}, +"requestParameters": { +"subscriptionServiceType": "MOG", +"aLaCarte": false, +"userParams": [ +{ +"name": "someUserParam", +"value": "someValue" +} +] +} +} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/SetupServiceDecompJson.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/SetupServiceDecompJson.json new file mode 100644 index 0000000000..e7960b7273 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/SetupServiceDecompJson.json @@ -0,0 +1,36 @@ +{ + "requestDetails": { + "serviceInstance": { + "serviceInstanceId": "MSORefactorTest3", + "serviceInstanceName": "bensServiceInstance3", + "serviceType": "MSO-dev-service-type", + "serviceRole": "abc", + "modelInvariantUuid": "d214abcc-2083-11e7-93ae-92361f002671", + "modelUuid": "c4503baa-2083-11e7-93ae-92361f002671", + "modelVersion": "1.0", + "modelName": "MSOTADevInfra_vSAMP12_Service", + "environmentContext": "Luna", + "workloadContext": "Oxygen", + "orchestrationStatus": "ACTIVE" + }, + "project": { + "projectName": "vSAMP12 Project" + }, + "owningEntity": { + "owningEntityId": "MSO-Test-OE", + "owningEntityName": "MSO-Test123" + }, + "customer": { + "subscriptionServiceType": "MSO-dev-service-type", + "globalSubscriberId": "MSO_1610_dev" + }, + "request": { + "sdncRequestId": "736c7370-640b-4f7a-975d-320f73340dd3", + "callbackURL": "abc", + "requestId": "223c2e74-a23a-4ab8-bddb-2c2431dcb67f", + "productFamilyId": "abc", + "callbackUrl": "http://localhost:8080/adapters/rest/SDNCNotify", + "serviceId": "123" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/createServiceInstance_createServiceInstance_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/createServiceInstance_createServiceInstance_AAIResponse_Success.xml new file mode 100644 index 0000000000..eedbda9343 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/createServiceInstance_createServiceInstance_AAIResponse_Success.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml new file mode 100644 index 0000000000..be820b83b1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + 8310000058863 + Mobility + INFRA + 1452288058 + + + vMOG + 1452288058 + + + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + gg0e927b-6087-5574-9ef8-c5e4d5847db5 + V1.0 + vMOG-AKRON-1234 + 1462561835 + + + + + + + tenant + https://aai-conexus-e2e.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/396d61752cf04c3b8ca2afcb4ee049e9/ + + tenant.tenant-id + 396d61752cf04c3b8ca2afcb4ee049e9 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + AAIAIC25 + + + tenant.tenant-name + vMOG-AKRON-PROD + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml new file mode 100644 index 0000000000..1ede44427a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml @@ -0,0 +1,7 @@ + + + {{MESSAGE-ID}} + INTERNAL + Exception during create VF Create VF Module: Unable to determine specific VF Module Type: Nimbus_LU2_PXMC_Svc/PXMC_09_20_2016_v2 3::Pxmc09202016V2..pxmc_base.yaml..module-2 with version = 3.0 + true + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..a421355aba --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,53 @@ + + + {{MESSAGE-ID}} + true + d485ecee-957c-4a0a-8b95-27a22b90103f + + + mmsc_vol_1 + a73e0fe9-1ce8-49c2-8fef-e2788605be29 + + + mmsc_vol_2 + 37b6455a-5ea8-463a-89e3-0efeaf7b7c6d + + + nemsfe_vol_1 + b7ff1c21-d138-49a3-bf13-4cfd91efaf48 + + + nemsbe_vol_1 + a5988471-cd42-44d8-b078-64f2f13d3d4c + + + mmsc_vol_5 + f7b91c1e-ab8c-413a-a850-ba80a246c7e0 + + + nemsfe_vol_2 + 957ea3f3-2d4a-4707-bfd2-ba66f42037c2 + + + mmsc_vol_3 + de6fccfe-d61a-48b0-b03b-87bf1bf749b3 + + + mmsc_vol_4 + 76162310-2c38-4c32-981c-5c2880190077 + + + + RDM2WAGPLCP + e585e4f4-9452-437a-b294-45a2d6d3b7a3 + + c30b9453-4b68-4c2e-aacf-58a5ba648bf5 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + 1bbab536a19b4756926e7d0ec1eb543c + true + 78987 + ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef + + ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeRequest.xml new file mode 100644 index 0000000000..34604f1edd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeRequest.xml @@ -0,0 +1,24 @@ + + + 123abc + d8d4fcfa-fd7e-4413-b19d-c95aa67291b8 + CREATE_VF_MODULE_VOL + SoapUI-bns-create-base-vol-1001-1 + + + Test/vSAMP12 + vSAMP12::base::module-0 + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MDTWNJ21 + 897deadc2b954a6bac6d3c197fb3525e + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + + + + value1" + value2" + value3" + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/GenericVnf.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/GenericVnf.xml new file mode 100644 index 0000000000..aea1a46017 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/GenericVnf.xml @@ -0,0 +1,38 @@ + + TEST-VNF-ID-0123 + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + pending-create + false + false + introvert + 2.0 + 0000020 + + + lukewarm + PCRF::module-0-0 + introvert + 2.0 + true + fastburn + pending-create + 0000074 + + + supercool + PCRF::module-1-0 + extrovert + 2.0 + false + slowburn + pending-create + 0000075 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..6ab9416617 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,5 @@ + + + {{MESSAGE-ID}} + true + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json new file mode 100644 index 0000000000..6853daa4b1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json @@ -0,0 +1,71 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1", + "modelCustomizationUuid": "ee6478e5-ea33-3346-ac12-ab121484a3fe" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1", + "modelInstanceName": "vSAMP12" + } + } + } + ], + "requestParameters": { + "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "userParams": [ + {"name": "vnfName", "value": "STMTN5MMSC20" }, + {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, + {"name": "vnfNmInformation", "value": "" }, + {"name": "vnfType", "value": "pcrf-capacity" }, + {"name": "vnfId", "value": "skask" }, + {"name": "vnfStackId", "value": "slowburn" }, + {"name": "vnfStatus", "value": "created" }, + {"name": "aicCloudRegion", "value": "MDTWNJ21" }, + {"name": "availabilityZone", "value": "slcp3-esx-az01" }, + {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, + {"name": "vmName", "value": "slcp34246vbc246ceb" }, + {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, + {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" }, + {"name": "vlc_sctp_b_route_prefixes", + "value": [ + { "interface_route_table_routes_route_prefix": "107.239.41.163/32" }, + { "interface_route_table_routes_route_prefix": "107.239.41.164/32" }, + { "interface_route_table_routes_route_prefix": "107.239.41.165/32" } + ]} + ] + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json new file mode 100644 index 0000000000..de99a6da56 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json @@ -0,0 +1,45 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "{parent service model name}", + "modelVersion": "1" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test/vSAMP12", + "modelVersion": "1" + } + } + } + ] + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..02b43ff186 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + simpleCinderVolume_201604071 + simpleCinderVolume_201604071 + simpleCinderVolume_201604071 + simple_cinder_master + Pending + 1460134360 + + + tenant + https://aai-ext1.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..1574310474 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml new file mode 100644 index 0000000000..96e906f9bf --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml @@ -0,0 +1,31 @@ + + + 94f0f72f-4be1-49ed-8410-702396797163 + MSOTESTVOL103H-vSAMP12_base_vol_module-0 + + Test/vSAMP12 + Pending + 1469203133 + + + tenant + https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/e444c311b27a45dc9522f2370d70f90f/ + + tenant.tenant-id + e444c311b27a45dc9522f2370d70f90f + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + tenant.tenant-name + MSOCustomer1 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..7aa9c3e8ac --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + 8424bb3c-c3e7-4553-9662-469649ed9379 + MSOTESTVOL103W-vSAMP12_base_vol_module-0 + + simple_cinder_master + Pending + ee6478e5-ea33-3346-ac12-ab121484a3fe + 1460134360 + + + tenant + https://aai-ext1.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..1574310474 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/getSIUrlById.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/getSIUrlById.xml new file mode 100644 index 0000000000..416689e10c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/getSIUrlById.xml @@ -0,0 +1,6 @@ + + + service-instance + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml new file mode 100644 index 0000000000..7e2a676283 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml @@ -0,0 +1,62 @@ + + 78987 + MSOTESTVOL102a-vSAMP12_base_vol_module-0 + + Test/vSAMP12 + Pending + 0000020 + + + generic-vnf + https://localhost:8443/aai/v8/network/generic-vnfs/generic-vnf/9e48f6ea-f786-46de-800a-d480e5ccc846/ + + generic-vnf.vnf-id + 9e48f6ea-f786-46de-800a-d480e5ccc846 + + + generic-vnf.vnf-name + MSOSTSAMP12-10601 + + + + tenant + https://localhost:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ + + tenant.tenant-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mdt1 + + + tenant.tenant-name + ECOMP_MDT1 + + + + vf-module + https://localhost:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ + + vf-module.vf-module-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mdt1 + + + vf-module.vf-module-name + ECOMP_MDT1 + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModule_VID_request.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModule_VID_request.json new file mode 100644 index 0000000000..808e371191 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModule_VID_request.json @@ -0,0 +1,77 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "STMTN5MMSC21-MMSC::model-1-0", + "modelVersion": "1", + "modelCustomizationUuid": "ee6478e5-ea33-3346-ac12-ab121484a3fe" + }, + "subscriberInfo": { + "globalSubscriberId": "MSO_1610_dev_id", + "subscriberName": "MSO_1610_dev_name" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "MDTWNJ21", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "PCRF::module-0-2", + "source": "VID", + "suppressRollback": true + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", + "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12..base..module-0", + "modelVersion": "1" + } + } + }, + { + "relatedInstance": { + "instanceId": "123456", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "SERVICE_MODEL_NAME", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "skask", + "instanceName": "skask-test", + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "skask", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelInstanceName": "vSAMP12 1" + } + } + } + ], + "requestParameters": { + "usePreload": true, + "aLaCarte": false, + "userParams": [{ + "name": "vlc_sctp_b_route_prefixes", + "value": [ + { "interface_route_table_routes_route_prefix": "107.239.41.163/32" }, + { "interface_route_table_routes_route_prefix": "107.239.41.164/32" }, + { "interface_route_table_routes_route_prefix": "107.239.41.165/32" } + ]}] + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModule_VID_request_noPreloads.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModule_VID_request_noPreloads.json new file mode 100644 index 0000000000..b51741f879 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModule_VID_request_noPreloads.json @@ -0,0 +1,79 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "STMTN5MMSC21-MMSC::model-1-0", + "modelVersion": "1", + "modelCustomizationUuid": "ee6478e5-ea33-3346-ac12-ab121484a3fe" + }, + "subscriberInfo": { + "globalSubscriberId": "MSO_1610_dev_id", + "subscriberName": "MSO_1610_dev_name" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "MDTWNJ21", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "PCRF::module-0-2", + "source": "VID", + "suppressRollback": true + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", + "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12..base..module-0", + "modelVersion": "1" + } + } + }, + { + "relatedInstance": { + "instanceId": "123456", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "SERVICE_MODEL_NAME", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "skask", + "instanceName": "skask-test", + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "skask", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelInstanceName": "vSAMP12 1" + } + } + } + ], + "requestParameters": { + "usePreload": false, + "userParams": [ + { + "name": "someUserParam", + "value": "someValue" + }, + { + "name": "sgi_protected_subnet_id", + "value": "thisissomefakevalue" + } + ] + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModule_VID_request_userParam.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModule_VID_request_userParam.json new file mode 100644 index 0000000000..68de099c16 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModule_VID_request_userParam.json @@ -0,0 +1,77 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "STMTN5MMSC21-MMSC::model-1-0", + "modelVersion": "1", + "modelCustomizationUuid": "ee6478e5-ea33-3346-ac12-ab121484a3fe" + }, + "subscriberInfo": { + "globalSubscriberId": "MSO_1610_dev_id", + "subscriberName": "MSO_1610_dev_name" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "MDTWNJ21", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "PCRF::module-0-2", + "source": "VID", + "suppressRollback": true + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", + "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12..base..module-0", + "modelVersion": "1" + } + } + }, + { + "relatedInstance": { + "instanceId": "123456", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "SERVICE_MODEL_NAME", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "skask", + "instanceName": "skask-test", + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "skask", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelInstanceName": "vSAMP12 1" + } + } + } + ], + "requestParameters": { + "usePreload": true, + "aLaCarte": false, + "userParams": [{ + "name": "vlc_sctp_b_route_prefixes", + "value": [ + { "interface_route_table_routes_route_prefix": "107.239.41.163/32" }, + { "interface_route_table_routes_route_prefix": "107.239.41.164/32" }, + { "interface_route_table_routes_route_prefix": "107.239.41.165/32" } + ]} + ]} + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DBUpdateResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DBUpdateResponse.xml new file mode 100644 index 0000000000..0942e09e31 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DBUpdateResponse.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Database/DBAdapter.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Database/DBAdapter.xml new file mode 100644 index 0000000000..5a36d741d0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Database/DBAdapter.xml @@ -0,0 +1 @@ +Notified \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Database/DBUpdateResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Database/DBUpdateResponse.xml new file mode 100644 index 0000000000..0ae5b79484 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Database/DBUpdateResponse.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml new file mode 100644 index 0000000000..ca195324d3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml @@ -0,0 +1,7 @@ + + + + <output xmlns="org:onap:sdnctl:vnf"><svc-request-id>1660b8da-0a94-442d-8ed5-ea079e3c67c8</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><vnf-information><vnf-id>8925b50d-de67-44c1-b984-e7ce7b0f4dae</vnf-id></vnf-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>8925b50d-de67-44c1-b984-e7ce7b0f4dae</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml new file mode 100644 index 0000000000..90c668c576 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 2.5 + RDM2WAGPLCP + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml new file mode 100644 index 0000000000..9b651f25e3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 3.0 + RDM2WAGPLCP + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/deleteAAIResponse_Failure500_RESTFault.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/deleteAAIResponse_Failure500_RESTFault.xml new file mode 100644 index 0000000000..4ce7048950 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/deleteAAIResponse_Failure500_RESTFault.xml @@ -0,0 +1,19 @@ + + 500 + HTTP method: GET Internal Server Error + <Fault> + <requestError> + <serviceException> + <messageId>SVC3002</messageId> + <text>Error writing output performing %1 on %2 (msg=%3) (ec=%4)</text> + <variables> + <variable>PUT customer</variable> + <variable>SubName32</variable> + <variable>Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [12312442454112] violates a uniqueness constraint [service-instance-id]</variable> + <variable>ERR.5.4.5105</variable> + </variables> + </serviceException> + </requestError> +</Fault> + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml new file mode 100644 index 0000000000..c12bcd49c9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_BASIC + HSL_direct + contrail + 8bbd3edf-b835-4610-96a2-a5cafa029042 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + active + HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 + + + ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a + 5a77fdc2-7789-4649-a1b9-6eaf1db1813a + 172.16.34.1 + 172.16.34.0 + 28 + 4 + active + true + + + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ + + tenant.tenant-id + e81d842d3e8b45c5a59f57cd76af3aaf + + + + cloud-region + cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP/ + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + RDM2WAGPLCP + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml new file mode 100644 index 0000000000..b108fb25ab --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_BASIC + HSL_direct + contrail + 8bbd3edf-b835-4610-96a2-a5cafa029042 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + active + HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 + + + ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a + 5a77fdc2-7789-4649-a1b9-6eaf1db1813a + 172.16.34.1 + 172.16.34.0 + 28 + 4 + active + true + + + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ + + tenant.tenant-id + e81d842d3e8b45c5a59f57cd76af3aaf + + + + vf-module + https://aai-app-e2e.ecomp.cci.com:8443/aai/v8/network/generic-vnfs/generic-vnf/105df7e5-0b3b-49f7-a837-4864b62827c4/vf-modules/vf-module/d9217058-95a0-49ee-b9a9-949259e89349/ + + generic-vnf.vnf-id + 105df7e5-0b3b-49f7-a837-4864b62827c4 + + + vf-module.vf-module-id + d9217058-95a0-49ee-b9a9-949259e89349 + + + + generic-vnf + https://aai-app-e2e.test.com:8443/aai/v8/network/generic-vnfs/generic-vnf/45f822d9-73ca-4255-9844-7cef401bbf47/ + + generic-vnf.vnf-id + 45f822d9-73ca-4255-9844-7cef401bbf47 + + + generic-vnf.vnf-name + zrdm1scpx05 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml new file mode 100644 index 0000000000..1d198caf5d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml @@ -0,0 +1,17 @@ + + + + + + + 19174929-3809-49ca-89eb-17f84a035389 + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse_noExtraTag.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse_noExtraTag.xml new file mode 100644 index 0000000000..bc0eab88a7 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse_noExtraTag.xml @@ -0,0 +1,17 @@ + + + + + + + 19174929-3809-49ca-89eb-17f84a035389 + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleCallbackResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleCallbackResponse.xml new file mode 100644 index 0000000000..74a3beb221 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleCallbackResponse.xml @@ -0,0 +1,21 @@ + + + 86651f79-057e-4245-8f5f-174db3cef553-1502888133261 + true + 20928949-5230-495d-86a6-f3690b9b5d60 + + + shared_private_network_id + bcd04543-b3d7-4c64-a910-1735b875ebb2 + + + server1_port + d1605e82-50ba-4544-9f8d-a8a37b678046 + + + vnf_id + 7da56895-6be1-4bec-856b-525e0e573199 + + + 7da56895-6be1-4bec-856b-525e0e573199 + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..25aa45afd9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,5 @@ + + + {{MESSAGE-ID}} + true + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json new file mode 100644 index 0000000000..c6cc1ca428 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json @@ -0,0 +1,17 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantUuid": "0b01b8c2-8416-11e6-ae22-56b6b6499611", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1.0" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "MDTWNJ21", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "source": "VID" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml new file mode 100644 index 0000000000..fd10548cef --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml @@ -0,0 +1,42 @@ + + 78987 + MSOTESTVOL102a-vSAMP12_base_vol_module-0 + + Test/vSAMP12 + Pending + 0000020 + + + generic-vnf + https://aai-ext1.test.com:8443/aai/v8/network/generic-vnfs/generic-vnf/9e48f6ea-f786-46de-800a-d480e5ccc846/ + + generic-vnf.vnf-id + 9e48f6ea-f786-46de-800a-d480e5ccc846 + + + generic-vnf.vnf-name + MSOSTSAMP12-10601 + + + + tenant + https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ + + tenant.tenant-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mdt1 + + + tenant.tenant-name + ECOMP_MDT1 + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModule_VID_request.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModule_VID_request.json new file mode 100644 index 0000000000..c75c32d498 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModule_VID_request.json @@ -0,0 +1,50 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantId": "973ed047-d251-4fb9-bf1a-65b8949e0a73", +"modelNameVersionId": "973ed047-d251-4fb9-bf1a-65b8949e0a73", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceId": "973ed047-d251-4fb9-bf1a-65b8949e0a73", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "00000000-0000-0000-0000-000000000000", +"modelInfo": { +"modelType": "service", +"modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", +"modelName": "SERVICE_MODEL_NAME", +"modelVersion": "1.0" +} +} +}, +{ +"relatedInstance": { +"instanceId": "a27ce5a9-29c4-4c22-a017-6615ac73c721", +"modelInfo": { +"modelType": "vnf", +"modelInvariantId": "skask", +"modelNameVersionId": "a27ce5a9-29c4-4c22-a017-6615ac73c721", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationName": "vSAMP12 1" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/DoCreateVfModuleRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/DoCreateVfModuleRequest.xml new file mode 100644 index 0000000000..4aaa56f79a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/DoCreateVfModuleRequest.xml @@ -0,0 +1,31 @@ + + + test-VF-0011 + CREATE_VF_MODULE + VID + MIS/1604/0026/SW_INTERNET + + + skask + STMTN5MMSC20 + myvnftype + PCRF::module-0-2 + STMTN5MMSC21-MMSC::model-1-0 + 00000000-0000-0000-0000-000000000000 + 1.0 + 00000000-0000-0000-0000-000000000000 + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + 78987 + + + STMTN5MMSC20 + vpe-tenant-123 + MDTWNJ21 + false + asn-1234 + release-for-aero-something + MTJWNJA4LCP + svc-provide-number-1234 + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml new file mode 100644 index 0000000000..90c668c576 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 2.5 + RDM2WAGPLCP + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml new file mode 100644 index 0000000000..f78d38f802 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml @@ -0,0 +1,169 @@ + + RDM2WAGPLCP + fba1bd1e195a404cacb9ce17a9b2b421 + skask + skask-test + PCRF::module-0-2 + cb510af0-5b21-4bc7-86d9-323cb396ce32 + vRRaas + PCRF::module-0-2 + 1.0 + cb510af0-5b21-4bc7-86d9-323cb396ced3 + + 12345 + null + null + 12345 + true + 12345 + true + + + vf_module_id + cb510af0-5b21-4bc7-86d9-323cb396ce32 + + + vrra_Internal-Network1_ips + null + + + ADIG_SRIOV_2_subnet_id + + + + vrra_ADIGOam.OAM_v6_ips + null + + + vnf_name + skask-test + + + ADIGOam.OAM_v6_subnet_id + + + + workload_context + null + + + vf_module_name + PCRF::module-0-2 + + + vnf_id + skask + + + ADIG_SRIOV_2_v6_subnet_id + + + + vrra_ADIG_SRIOV_1_ips + null + + + ADIG_SRIOV_1_v6_subnet_id + + + + ADIG_SRIOV_1_subnet_id + + + + ADIG_SRIOV_2_net_name + ADIG_SRIOV_2 + + + ADIGOam.OAM_subnet_id + + + + ADIGOam.OAM_net_id + 491c7cef-a3f4-4990-883e-b0af397466d0 + + + environment_context + null + + + ADIG_SRIOV_1_net_fqdn + + + + ADIGOam.OAM_net_name + ADIGOAM.OAM + + + vrra_name_0 + frkdevRvrra24 + + + vrra_ADIG_SRIOV_2_ips + null + + + ADIG_SRIOV_2_net_fqdn + + + + vrra_Internal-Network2_ips + null + + + ADIG_SRIOV_1_net_name + ADIG_SRIOV_1 + + + vrra_ADIG_SRIOV_1_v6_ips + null + + + vrra_ADIGOam.OAM_ips + null + + + vrra_Internal-Network1_v6_ips + null + + + ADIGOam.OAM_net_fqdn + + + + vrra_names + frkdevRvrra24 + + + ADIG_SRIOV_1_net_id + 491c7cef-a3f4-4990-883e-b0af397466d0 + + + vrra_Internal-Network2_v6_ips + null + + + vrra_ADIG_SRIOV_2_v6_ips + null + + + ADIG_SRIOV_2_net_id + 491c7cef-a3f4-4990-883e-b0af397466d0 + + + vf_module_index + index + + + availability_zone_0 + frkde-esx-az01 + + + + + testRequestId + MIS/1604/0026/SW_INTERNET + + testRequestId-1503410089303-1513204371234 + http://localhost:28080/mso/WorkflowMesssage/VNFAResponse/testRequestId-1503410089303-1513204371234 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/getGenericVnfResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/getGenericVnfResponse.xml new file mode 100644 index 0000000000..be5130ead8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/getGenericVnfResponse.xml @@ -0,0 +1,28 @@ + + 6d2e2469-8708-47c3-a0d4-73fa28a8a50b + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + created + false + false + introvert + 2.0 + 0000020 + + + baseVfModuleId + PCRF::module-0-0 + introvert + 2.0 + false + baseVfModuleHeatStackId + Created + 0000074 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml new file mode 100644 index 0000000000..20b5462729 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml @@ -0,0 +1,195 @@ + + + 2681784d-118e-4485-929f-2ae3212f5c07-1507707098467 + 200 + OK + + + + vnfID-1712_26 + + 200 + synccomplete + 2017-09-19T143942.327Z + Y + activate-vnf-request + + + + vRRaaS + vnfID-1712_26 + + + ae322537-d081-4a01-95a5-c1448116d0c5 + + + + + + frkde-esx-az01 + + + vrra + 1 + + ADIGOam.OAM + ADIGOAM.OAM + + NMLAN + 10.66.132.113 + 10.66.132.115 + 32 + EIPAM + + VPEADIG1d77c-1086-41ec-b7f3-94bb30936807 + + + ADIG_SRIOV_1 + ADIG_SRIOV_1 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936808 + [,] + + + ADIG_SRIOV_2 + ADIG_SRIOV_2 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936809 + [,] + + + Internal-Network1 + + INTERNAL + 24 + OTHER + 128.0.0.1 + 128.0.0.0 + + VRR-STMTN5MMSC20-INT1 + 12 + VMX-INT1 + + + Internal-Network2 + + INTERNAL + 24 + OTHER + 128.0.0.1 + 128.0.0.0 + + VRR-STMTN5MMSC20-INT2 + 12 + VMX-INT2 + + + frkdevRvrra24 + b05a42c3-28ea-4d18-8653-6515125acc1a + + + Activated + + ADIGOam.OAM + ADIGOAM.OAM + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936807 + + + ADIG_SRIOV_2 + ADIG_SRIOV_2 + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936809 + + + ADIG_SRIOV_1 + ADIG_SRIOV_1 + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936808 + + + + + FRN1 + 4027 + att-aic + + b73c6911-be64-448a-bb4b-7b7a7006507a + 5.0 + MOW AVPN vMX AV vPE Service + d48764b1-043d-4783-89e3-8817602dc833 + + 65001 + wl3900-1712-46db-99be-de9eb963a6cf26 + DE + vnfID-1712_26 + 26VRR_mtrnj151rv2 + + + 778c2ed5-77a8-426e-94fe-51a4d40199c4 + + + + cb510af0-5b21-4bc7-86d9-323cb396ced4 + + + c91330e5-8e1a-459b-95ee-d682046cbeca + 3 + MowAvpnVmxAvVpe..base_vRE_AV..module-0 + f9f41064-cbe7-4e94-ac4c-93d9c54af317 + + Activated + RR + FRNKGEFF + PROV + + NMLAN + 10.66.132.113 + 10.66.132.115 + 32 + EIPAM + + + 07bc0630-11d2-4c08-9c8f-75b036db1f4d + 3.0 + MOW AVPN vMX AV vPE + 31d077f6-356f-436e-b447-1997faff4c68 + + 31d077f6-356f-436e-b447-1997faff4c68 + + + ADIGOam.OAM + ADIGOAM.OAM + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936807 + + + ADIG_SRIOV_2 + ADIG_SRIOV_2 + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936809 + + + ADIG_SRIOV_1 + ADIG_SRIOV_1 + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936808 + + 1710vPEPROJECTS297135PROJECT + 26VRR_mtrnj151rv2-affinity + + + Completed + + + VNN1CA52LCP + skask + afd0f02a-1ddb-43bb-aded-5113e46e82ae + ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 + ZVNN1MOGX01 + 33d209df14ac4c08ad60747185d2f3e0 + bd1b3789-6474-4935-94b2-90b656e035d0 + ZVNN1MOGX01 - VF AUG 1module-0 + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnf.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnf.xml new file mode 100644 index 0000000000..50e4347e5f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnf.xml @@ -0,0 +1,26 @@ + + a27ce5a9-29c4-4c22-a017-6615ac73c721 + STMTN5MMSC21 + mmsc-capacity + SDN-MOBILITY + vMMSC + pending-create + false + false + 1508691 + + + 973ed047-d251-4fb9-bf1a-65b8949e0a73 + STMTN5MMSC21-MMSC::module-0-0 + 973ed047-d251-4fb9-bf1a-65b8949e0a73 + 1.0 + true + FILLED-IN-BY-MSO + pending-create + 1508692 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnfVfModule.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnfVfModule.xml new file mode 100644 index 0000000000..f60260d85b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnfVfModule.xml @@ -0,0 +1,26 @@ + + a27ce5a9-29c4-4c22-a017-6615ac73c721 + STMTN5MMSC21 + mmsc-capacity + SDN-MOBILITY + vMMSC + pending-create + false + false + 0000021 + + + 973ed047-d251-4fb9-bf1a-65b8949e0a73 + STMTN5MMSC21-MMSC::module-0-0 + 973ed047-d251-4fb9-bf1a-65b8949e0a73 + 1.0 + true + FILLED-IN-BY-MSO + pending-create + 0000073 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/deactivateSDNCRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/deactivateSDNCRequest.xml new file mode 100644 index 0000000000..69884c5534 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/deactivateSDNCRequest.xml @@ -0,0 +1,36 @@ + + + testReqId + svcInstId_test + deactivate + vf-module-topology-operation + http://localhost:28080/mso/SDNCAdapterCallbackService + generic-resource + + + + testRequestId + DeleteVfModuleInstance + VID + + + + + + + + 12345 + + + + skask + + + + cb510af0-5b21-4bc7-86d9-323cb396ce32 + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/sdncAdapterWorkflowRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/sdncAdapterWorkflowRequest.xml new file mode 100644 index 0000000000..a03c28c91e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/sdncAdapterWorkflowRequest.xml @@ -0,0 +1,37 @@ + + + testReqId + cb510af0-5b21-4bc7-86d9-323cb396ce32 + delete + vnf-topology-operation + http://localhost:28080/mso/SDNCAdapterCallbackService + + + + testRequestId + DisconnectVNFRequest + VID + + + + + + 12345 + 12345 + 12345 + notsurewecare + + + cb510af0-5b21-4bc7-86d9-323cb396ce32 + PCRF::module-0-2 + PCRF::module-0-2 + skask + skask-test + vRRaas + RDM2WAGPLCP + fba1bd1e195a404cacb9ce17a9b2b421 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/vnfAdapterRestV1Request.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/vnfAdapterRestV1Request.xml new file mode 100644 index 0000000000..abb30b3c2c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleRollback/vnfAdapterRestV1Request.xml @@ -0,0 +1,14 @@ + + null + null + skask + cb510af0-5b21-4bc7-86d9-323cb396ce32 + null + true + + testRequestId + 12345 + + 12345-1513795852327 + http://localhost:18080/mso/WorkflowMessage/VNFAResponse/null-1513795852327 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..a421355aba --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,53 @@ + + + {{MESSAGE-ID}} + true + d485ecee-957c-4a0a-8b95-27a22b90103f + + + mmsc_vol_1 + a73e0fe9-1ce8-49c2-8fef-e2788605be29 + + + mmsc_vol_2 + 37b6455a-5ea8-463a-89e3-0efeaf7b7c6d + + + nemsfe_vol_1 + b7ff1c21-d138-49a3-bf13-4cfd91efaf48 + + + nemsbe_vol_1 + a5988471-cd42-44d8-b078-64f2f13d3d4c + + + mmsc_vol_5 + f7b91c1e-ab8c-413a-a850-ba80a246c7e0 + + + nemsfe_vol_2 + 957ea3f3-2d4a-4707-bfd2-ba66f42037c2 + + + mmsc_vol_3 + de6fccfe-d61a-48b0-b03b-87bf1bf749b3 + + + mmsc_vol_4 + 76162310-2c38-4c32-981c-5c2880190077 + + + + RDM2WAGPLCP + e585e4f4-9452-437a-b294-45a2d6d3b7a3 + + c30b9453-4b68-4c2e-aacf-58a5ba648bf5 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + 1bbab536a19b4756926e7d0ec1eb543c + true + 78987 + ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef + + ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml new file mode 100644 index 0000000000..38e8662787 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml @@ -0,0 +1,24 @@ + + + 123abc + d8d4fcfa-fd7e-4413-b19d-c95aa67291b8 + CREATE_VF_MODULE_VOL + SoapUI-bns-create-base-vol-1001-1 + + + Test/vSAMP12 + vSAMP12::base::module-0 + false + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MDTWNJ21 + 897deadc2b954a6bac6d3c197fb3525e + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + + + + value1" + value2" + value3" + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml new file mode 100644 index 0000000000..62d1aba771 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml @@ -0,0 +1,24 @@ + + + 123abc + d8d4fcfa-fd7e-4413-b19d-c95aa67291b8 + CREATE_VF_MODULE_VOL + SoapUI-bns-create-base-vol-1001-1 + + + Test/vSAMP12 + vSAMP12::base::module-0 + true + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MDTWNJ21 + 897deadc2b954a6bac6d3c197fb3525e + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + + + + value1" + value2" + value3" + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/GenericVnf.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/GenericVnf.xml new file mode 100644 index 0000000000..aea1a46017 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/GenericVnf.xml @@ -0,0 +1,38 @@ + + TEST-VNF-ID-0123 + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + pending-create + false + false + introvert + 2.0 + 0000020 + + + lukewarm + PCRF::module-0-0 + introvert + 2.0 + true + fastburn + pending-create + 0000074 + + + supercool + PCRF::module-1-0 + extrovert + 2.0 + false + slowburn + pending-create + 0000075 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..6ab9416617 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,5 @@ + + + {{MESSAGE-ID}} + true + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_VID_request.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_VID_request.json new file mode 100644 index 0000000000..6cc84c79b6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_VID_request.json @@ -0,0 +1,104 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL103W-vSAMP12_base_vol_module-0", + "source": "VID", + "callbackUrl": "{do we support this???}" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "{parent service model name}", + "modelVersion": "1" + } + } + }, + { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test/vSAMP12", + "modelVersion": "1" + } + } + } + ], + "requestParameters": { + "backoutOnFailure": true, + "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "userParams": [ + { + "name": "vnfName", + "value": "STMTN5MMSC20" + }, + { + "name": "vnfName2", + "value": "US1117MTSNJVBR0246" + }, + { + "name": "vnfNmInformation", + "value": "" + }, + { + "name": "vnfType", + "value": "pcrf-capacity" + }, + { + "name": "vnfId", + "value": "skask" + }, + { + "name": "vnfStackId", + "value": "slowburn" + }, + { + "name": "vnfStatus", + "value": "created" + }, + { + "name": "aicCloudRegion", + "value": "MDTWNJ21" + }, + { + "name": "availabilityZone", + "value": "slcp3-esx-az01" + }, + { + "name": "oamNetworkName", + "value": "VLAN-OAM-1323" + }, + { + "name": "vmName", + "value": "slcp34246vbc246ceb" + }, + { + "name": "ipagNetworkId", + "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" + }, + { + "name": "vpeNetworkId", + "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" + } + ] + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..02b43ff186 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + simpleCinderVolume_201604071 + simpleCinderVolume_201604071 + simpleCinderVolume_201604071 + simple_cinder_master + Pending + 1460134360 + + + tenant + https://aai-ext1.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..1574310474 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..5e8913f335 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + 8424bb3c-c3e7-4553-9662-469649ed9379 + MSOTESTVOL103W-vSAMP12_base_vol_module-0 + + simple_cinder_master + Pending + 1460134360 + + + tenant + https://aai-ext1.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..1574310474 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml new file mode 100644 index 0000000000..90c668c576 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 2.5 + RDM2WAGPLCP + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml new file mode 100644 index 0000000000..fd6c228cba --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml @@ -0,0 +1,13 @@ + + null + 12345 + 12345 + null + true + + 12345 + 12345 + + 580b5601-9260-4d19-abed-e671ac42c429 + http://localhost:18080/mso/WorkflowMessage/VNFAResponse/580b5601-9260-4d19-abed-e671ac42c429 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule_getVnfResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule_getVnfResponse.xml new file mode 100644 index 0000000000..b8c2cfdad0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule_getVnfResponse.xml @@ -0,0 +1,26 @@ + + a27ce5a9-29c4-4c22-a017-6615ac73c721 + STMTN5MMSC21 + mmsc-capacity + SDN-MOBILITY + vMMSC + pending-create + false + false + 1508691 + + + 973ed047-d251-4fb9-bf1a-65b8949e0a73 + STMTN5MMSC21-MMSC::module-0-0 + 973ed047-d251-4fb9-bf1a-65b8949e0a73 + 1.0 + true + FILLED-IN-BY-MSO + pending-create + 1508692 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoDeleteVfModule/getGenericVnfResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoDeleteVfModule/getGenericVnfResponse.xml new file mode 100644 index 0000000000..be5130ead8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoDeleteVfModule/getGenericVnfResponse.xml @@ -0,0 +1,28 @@ + + 6d2e2469-8708-47c3-a0d4-73fa28a8a50b + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + created + false + false + introvert + 2.0 + 0000020 + + + baseVfModuleId + PCRF::module-0-0 + introvert + 2.0 + false + baseVfModuleHeatStackId + Created + 0000074 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoDeleteVfModule/sdncAdapterWorkflowRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoDeleteVfModule/sdncAdapterWorkflowRequest.xml new file mode 100644 index 0000000000..9829fd2dbf --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoDeleteVfModule/sdncAdapterWorkflowRequest.xml @@ -0,0 +1,36 @@ + + + + testReqId + 12345 + release + vnf-topology-operation + http://localhost:8090/SDNCAdapterCallback + + + + 12345 + DisconnectVNFRequest + VID + + + + + + 12345 + 12345 + 123456789 + notsurewecare + + + 12345 + null + vfModuleName_test + 12345 + + + null + 19123c2924c648eb8e42a3c1f14b7682 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml new file mode 100644 index 0000000000..90c668c576 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 2.5 + RDM2WAGPLCP + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/getGenericVnfResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/getGenericVnfResponse.xml new file mode 100644 index 0000000000..be5130ead8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/getGenericVnfResponse.xml @@ -0,0 +1,28 @@ + + 6d2e2469-8708-47c3-a0d4-73fa28a8a50b + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + created + false + false + introvert + 2.0 + 0000020 + + + baseVfModuleId + PCRF::module-0-0 + introvert + 2.0 + false + baseVfModuleHeatStackId + Created + 0000074 + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncActivateRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncActivateRequest.xml new file mode 100644 index 0000000000..6fa8bfedc9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncActivateRequest.xml @@ -0,0 +1,36 @@ + + + testReqId + MIS/1604/0026/SW_INTERNET + activate + vnf-topology-operation + http://localhost:8090/SDNCAdapter + + + + testRequestId + ChangeVNFActivateRequest + PORTAL + + + + + + 12345 + skask + dontcare + + + cb510af0-5b21-4bc7-86d9-323cb396ce32 + PCRF::module-0-2 + abc + skask + skask-test + vRRaas + fba1bd1e195a404cacb9ce17a9b2b421 + RDM2WAGPLCP + Y + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncChangeAssignRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncChangeAssignRequest.xml new file mode 100644 index 0000000000..c57dec4d86 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncChangeAssignRequest.xml @@ -0,0 +1,36 @@ + + + testReqId + MIS/1604/0026/SW_INTERNET + changeassign + vnf-topology-operation + http://localhost:8090/SDNCAdapter + + + + testRequestId + ChangeVNFActivateRequest + PORTAL + + + + + + 12345 + skask + dontcare + + + cb510af0-5b21-4bc7-86d9-323cb396ce32 + PCRF::module-0-2 + abc + skask + skask-test + vRRaas + fba1bd1e195a404cacb9ce17a9b2b421 + MDTWNJ21 + Y + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml new file mode 100644 index 0000000000..20b5462729 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml @@ -0,0 +1,195 @@ + + + 2681784d-118e-4485-929f-2ae3212f5c07-1507707098467 + 200 + OK + + + + vnfID-1712_26 + + 200 + synccomplete + 2017-09-19T143942.327Z + Y + activate-vnf-request + + + + vRRaaS + vnfID-1712_26 + + + ae322537-d081-4a01-95a5-c1448116d0c5 + + + + + + frkde-esx-az01 + + + vrra + 1 + + ADIGOam.OAM + ADIGOAM.OAM + + NMLAN + 10.66.132.113 + 10.66.132.115 + 32 + EIPAM + + VPEADIG1d77c-1086-41ec-b7f3-94bb30936807 + + + ADIG_SRIOV_1 + ADIG_SRIOV_1 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936808 + [,] + + + ADIG_SRIOV_2 + ADIG_SRIOV_2 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936809 + [,] + + + Internal-Network1 + + INTERNAL + 24 + OTHER + 128.0.0.1 + 128.0.0.0 + + VRR-STMTN5MMSC20-INT1 + 12 + VMX-INT1 + + + Internal-Network2 + + INTERNAL + 24 + OTHER + 128.0.0.1 + 128.0.0.0 + + VRR-STMTN5MMSC20-INT2 + 12 + VMX-INT2 + + + frkdevRvrra24 + b05a42c3-28ea-4d18-8653-6515125acc1a + + + Activated + + ADIGOam.OAM + ADIGOAM.OAM + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936807 + + + ADIG_SRIOV_2 + ADIG_SRIOV_2 + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936809 + + + ADIG_SRIOV_1 + ADIG_SRIOV_1 + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936808 + + + + + FRN1 + 4027 + att-aic + + b73c6911-be64-448a-bb4b-7b7a7006507a + 5.0 + MOW AVPN vMX AV vPE Service + d48764b1-043d-4783-89e3-8817602dc833 + + 65001 + wl3900-1712-46db-99be-de9eb963a6cf26 + DE + vnfID-1712_26 + 26VRR_mtrnj151rv2 + + + 778c2ed5-77a8-426e-94fe-51a4d40199c4 + + + + cb510af0-5b21-4bc7-86d9-323cb396ced4 + + + c91330e5-8e1a-459b-95ee-d682046cbeca + 3 + MowAvpnVmxAvVpe..base_vRE_AV..module-0 + f9f41064-cbe7-4e94-ac4c-93d9c54af317 + + Activated + RR + FRNKGEFF + PROV + + NMLAN + 10.66.132.113 + 10.66.132.115 + 32 + EIPAM + + + 07bc0630-11d2-4c08-9c8f-75b036db1f4d + 3.0 + MOW AVPN vMX AV vPE + 31d077f6-356f-436e-b447-1997faff4c68 + + 31d077f6-356f-436e-b447-1997faff4c68 + + + ADIGOam.OAM + ADIGOAM.OAM + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936807 + + + ADIG_SRIOV_2 + ADIG_SRIOV_2 + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936809 + + + ADIG_SRIOV_1 + ADIG_SRIOV_1 + 491c7cef-a3f4-4990-883e-b0af397466d0 + VPEADIG1d77c-1086-41ec-b7f3-94bb30936808 + + 1710vPEPROJECTS297135PROJECT + 26VRR_mtrnj151rv2-affinity + + + Completed + + + VNN1CA52LCP + skask + afd0f02a-1ddb-43bb-aded-5113e46e82ae + ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 + ZVNN1MOGX01 + 33d209df14ac4c08ad60747185d2f3e0 + bd1b3789-6474-4935-94b2-90b656e035d0 + ZVNN1MOGX01 - VF AUG 1module-0 + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncTopologyRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncTopologyRequest.xml new file mode 100644 index 0000000000..79ab33d45c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncTopologyRequest.xml @@ -0,0 +1,11 @@ + + + testReqId + MIS/1604/0026/SW_INTERNET + query + /VNF-API:vnfs/vnf-list/12345 + http://localhost:8090/SDNCAdapter + mobility + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/vnfAdapterRestRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/vnfAdapterRestRequest.xml new file mode 100644 index 0000000000..d9268872b3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/vnfAdapterRestRequest.xml @@ -0,0 +1,170 @@ + + RDM2WAGPLCP + fba1bd1e195a404cacb9ce17a9b2b421 + skask + cb510af0-5b21-4bc7-86d9-323cb396ce32 + abc + vRRaas + 1.0 + cb510af0-5b21-4bc7-86d9-323cb396ced3 + PCRF::module-0-2 + 12345 + 12345 + 12345 + 12345 + true + 12345 + false + + + vf_module_id + cb510af0-5b21-4bc7-86d9-323cb396ce32 + + + vrra_Internal-Network1_ips + null + + + ADIG_SRIOV_2_subnet_id + + + + vrra_ADIGOam.OAM_v6_ips + null + + + vnf_name + skask-test + + + ADIGOam.OAM_v6_subnet_id + + + + workload_context + null + + + vf_module_name + PCRF::module-0-2 + + + vnf_id + skask + + + ADIG_SRIOV_2_v6_subnet_id + + + + vrra_ADIG_SRIOV_1_ips + null + + + ADIG_SRIOV_1_v6_subnet_id + + + + ADIG_SRIOV_1_subnet_id + + + + vrr_flavor_name + ns.c16r32d128.v1 + + + ADIG_SRIOV_2_net_name + ADIG_SRIOV_2 + + + ADIGOam.OAM_subnet_id + + + + ADIGOam.OAM_net_id + 491c7cef-a3f4-4990-883e-b0af397466d0 + + + environment_context + null + + + ADIG_SRIOV_1_net_fqdn + + + + ADIGOam.OAM_net_name + ADIGOAM.OAM + + + vrra_name_0 + frkdevRvrra24 + + + vrra_ADIG_SRIOV_2_ips + null + + + ADIG_SRIOV_2_net_fqdn + + + + vrra_Internal-Network2_ips + null + + + ADIG_SRIOV_1_net_name + ADIG_SRIOV_1 + + + vrra_ADIG_SRIOV_1_v6_ips + null + + + vrra_ADIGOam.OAM_ips + null + + + vrra_Internal-Network1_v6_ips + null + + + vrr_image_name + MDT17 + + + ADIGOam.OAM_net_fqdn + + + + vrra_names + frkdevRvrra24 + + + ADIG_SRIOV_1_net_id + 491c7cef-a3f4-4990-883e-b0af397466d0 + + + vrra_Internal-Network2_v6_ips + null + + + vrra_ADIG_SRIOV_2_v6_ips + null + + + ADIG_SRIOV_2_net_id + 491c7cef-a3f4-4990-883e-b0af397466d0 + + + availability_zone_0 + nova + + + + testRequestId + MIS/1604/0026/SW_INTERNET + + testRequestId-1503410089303-1513287018300 + http://localhost:28080/mso/WorkflowMesssage/VNFAResponse/testRequestId-1503410089303-1513287018300 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/MsoCompletionRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/MsoCompletionRequest.xml new file mode 100644 index 0000000000..d5175f4dc9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/MsoCompletionRequest.xml @@ -0,0 +1,11 @@ + + + null + DELETE + null + + E2E Service Instance was deleted successfully. + DeleteCustomE2EServiceInstance + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/SDNCDeleteResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/SDNCDeleteResponse.xml new file mode 100644 index 0000000000..e380ce7ed2 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/SDNCDeleteResponse.xml @@ -0,0 +1,212 @@ + + + + + + Y + SK-2016-10-22-001 + + + SUCCESS + ERROR + + + 15001417 + + ALPRTR2 + 1.1.1.2 + + 1255.ae81 + VDBE + VIRTUAL + + ALPVDBE1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + ALPASBG1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + ALPBGF2 + 3.1.2.0/22 + + 3:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + ALPBGF1 + 3.1.2.0/22 + + 3:1:2::0/22 + + 2 + + + ALPRTR1 + 1.1.1.1 + + 1255.ae81 + VDBE + VIRTUAL + + ALPVDBE1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + ALPASBG1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + ALPBGF2 + 3.1.2.0/22 + + 3:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + ALPBGF1 + 3.1.2.0/22 + + 3:1:2::0/22 + + 1 + + + + 15001418 + + SANRTR1 + 2.1.1.1 + + 1255.ae81 + VDBE + VIRTUAL + + SANVDBE1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + SANASBG1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + SANBGF2 + 4.1.2.0/22 + + 4:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + SANBGF1 + 4.1.2.0/22 + + 4:1:2::0/22 + + 1 + + + SANRTR2 + 2.1.1.2 + + 1255.ae81 + VDBE + VIRTUAL + + SANVDBE1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + SANASBG1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + SANBGF2 + 4.1.2.0/22 + + 4:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + SANBGF1 + 4.1.2.0/22 + + 4:1:2::0/22 + + 2 + + + COLLABORATE + DISABLE + custid-888 + SII-2016-10-22-001 + CUSTOMER + 100668 + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/aaiGetResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/aaiGetResponse.xml new file mode 100644 index 0000000000..c367b5c959 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/aaiGetResponse.xml @@ -0,0 +1,33 @@ + + 1234 + volte-service + testservicetype + testservicerole + volte service + c1d4305f-cdbd-4bbe-9069-a2f4978fd89e + d4df5c27-98a1-4812-a8aa-c17f055b7a3f + 1508838121849 + create + + + service-instance + /aai/v11/business/customers/customer/test_customer/service-subscription/example-service-type/service-instance/1234_1 + + customer.global-customer-id + test_customer + + + service-subscription.service-type + test_customer + + + service-instance.service-instance-id + 1234_1 + + + service-instance.service-instance-name + volte-service_vEPC + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getARUrlById.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getARUrlById.xml new file mode 100644 index 0000000000..e178583a34 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getARUrlById.xml @@ -0,0 +1,6 @@ + + + allotted-resource + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml new file mode 100644 index 0000000000..a472996121 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml @@ -0,0 +1,23 @@ + + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + testReVer123 + + + nothing + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml new file mode 100644 index 0000000000..8ba178cc1c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml @@ -0,0 +1,90 @@ + + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + + 802767b3-18a6-4432-96db-25522786aee0 + ZRDM1MMSC03 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml new file mode 100644 index 0000000000..8ba178cc1c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml @@ -0,0 +1,90 @@ + + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + + 802767b3-18a6-4432-96db-25522786aee0 + ZRDM1MMSC03 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getNotFound.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getNotFound.xml new file mode 100644 index 0000000000..f66c9c4fb8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getNotFound.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getParentSIUrlById.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getParentSIUrlById.xml new file mode 100644 index 0000000000..c29133e539 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getParentSIUrlById.xml @@ -0,0 +1,6 @@ + + + service-instance + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0027%252FSW_INTERNET + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getParentServiceInstance.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getParentServiceInstance.xml new file mode 100644 index 0000000000..bc810c6014 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getParentServiceInstance.xml @@ -0,0 +1,30 @@ + + MIS/1604/0027/SW_INTERNET + 123456789 + + + cvlan-tag + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getSINoRelations.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getSINoRelations.xml new file mode 100644 index 0000000000..e52b26ac00 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getSINoRelations.xml @@ -0,0 +1,6 @@ + + MIS/1604/0026/SW_INTERNET + 123456789 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getSIUrlById.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getSIUrlById.xml new file mode 100644 index 0000000000..416689e10c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getSIUrlById.xml @@ -0,0 +1,6 @@ + + + service-instance + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getSIUrlByIdVipr.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getSIUrlByIdVipr.xml new file mode 100644 index 0000000000..28c739a0af --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getSIUrlByIdVipr.xml @@ -0,0 +1,7 @@ + + + + service-instance + https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/aa8428ac-7dd2-441f-aa3e-e175802574fb + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getServiceInstance.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getServiceInstance.xml new file mode 100644 index 0000000000..e377c70474 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/GenericFlows/getServiceInstance.xml @@ -0,0 +1,30 @@ + + MIS/1604/0026/SW_INTERNET + 123456789 + + + cvlan-tag + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/ConfigVnf_VID_request.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/ConfigVnf_VID_request.json new file mode 100644 index 0000000000..04040028c3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/ConfigVnf_VID_request.json @@ -0,0 +1,39 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vnf", +"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationUuid": "MODEL-ID-1234" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "mdt1", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "STMTN", +"instanceId": "skask", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "MIS%2F1604%2F0026%2FSW_INTERNET", +"modelInfo": { +"modelType": "service", +"modelInvariantUuid": "995256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "ab6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "ServicevSAMP12", +"modelVersion": "1.0" +} +} +} +], +"requestParameters": { +"payload": "{\"request-parameters\":{\"host-ip-address\":\"10.10.10.10\"},\"configuration- parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}" +} +} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/CreateVnfInfraRequest.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/CreateVnfInfraRequest.json new file mode 100644 index 0000000000..c1491d128b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/CreateVnfInfraRequest.json @@ -0,0 +1,46 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelInstanceName": "vSAMP12 1", + "modelCustomizationUuid": "customizationId123" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "testVnfName123", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{serviceInstanceId}", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "{parent service model name}", + "modelVersion": "1.0" + } + } + } + ], + "requestParameters": { + }, + "platform": { + "platformName": "platform name" + }, + "lineOfBusiness": { + "lineOfBusinessName": "line of business names" + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/DeleteCustomE2EService.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/DeleteCustomE2EService.json new file mode 100644 index 0000000000..661a89ec99 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/DeleteCustomE2EService.json @@ -0,0 +1,21 @@ +{ + "requestDetails": { + "requestInfo": { + "callbackUrl": "http://localhost:28080/simulada/CCD/AsyncRequestStatus", + "source": "CCD", + "instanceName": "USOSTCDALTX0101VFHN31" + }, + "subscriberInfo": { + "globalSubscriberId": "38829939920000", + "subscriberName": "Fern Hill Real Estate LLC 31" + }, + "requestParameters": { + "userParams": [ + { + "name": "someUserParam", + "value": "someValue" + } + ] + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json new file mode 100644 index 0000000000..e8d9fc29b1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json @@ -0,0 +1,39 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelInstanceName": "vSAMP12 1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "testVnfName123", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{serviceInstanceId}", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "{parent service model name}", + "modelVersion": "1.0" + } + } + } + ], + "requestParameters": { + "cascadeDelete": true + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/DoCreateServiceInstance_request.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/DoCreateServiceInstance_request.json new file mode 100644 index 0000000000..640e16b634 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/DoCreateServiceInstance_request.json @@ -0,0 +1,186 @@ +{ "serviceResources" : { + "modelInfo" : { + "modelName" : "MSOTADevInfra_vSAMP10a_Service", + "modelUuid" : "5df8b6de-2083-11e7-93ae-92361f002671", + "modelInvariantUuid" : "9647dfc4-2083-11e7-93ae-92361f002671", + "modelVersion" : "1.0" + }, + "serviceType" : "PortMirroring", + "serviceRole" : "InfraRole", + "environmentContext" : "Luna", + "workloadContext" : "Oxygen", + "serviceVnfs": [ + + { "modelInfo" : { + "modelName" : "vSAMP10a", + "modelUuid" : "ff2ae348-214a-11e7-93ae-92361f002671", + "modelInvariantUuid" : "2fff5b20-214b-11e7-93ae-92361f002671", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "68dc9a92-214c-11e7-93ae-92361f002671", + "modelInstanceName" : "vSAMP10a 1" + }, + "toscaNodeType" : "VF", + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null, + "multiStageDesign" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "NetworkFqdnTest4", + "modelUuid" : "025606c1-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba01a", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba01a" + }, "isBase" : true, + "vfModuleLabel" : "label", + "initialCount" : 0, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "NetworkFqdnTest3", + "modelUuid" : "02560575-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba0bb", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba0bb" + }, "isBase" : true, + "vfModuleLabel" : "label", + "initialCount" : 0, + "hasVolumeGroup" : false + }, + { + "modelInfo" : { + "modelName" : "NetworkFqdnTest5", + "modelUuid" : "025607e4-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : "06bd0a18-65c0-4418-83c7-5b0d14cba01a", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "06bd0a18-65c0-4418-83c7-5b0d14cba01a" + }, "isBase" : false, + "vfModuleLabel" : "label", + "initialCount" : 0, + "hasVolumeGroup" : false + }, + { + "modelInfo" : { + "modelName" : "vSAMP10aDEV::PCM::module-2", + "modelUuid" : "7774b4e4-7d37-11e7-bb31-be2e44b06b34", + "modelInvariantUuid" : "93e9c1d2-7d37-11e7-bb31-be2e44b06b34", + "modelVersion" : "2", + "modelCustomizationUuid" : "6728bee8-7d3a-11e7-bb31-be2e44b06b34" + }, "isBase" : false, + "vfModuleLabel" : "PCM", + "initialCount" : 0, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "vSAMP10aDEV::PCM::module-1", + "modelUuid" : "066de97e-253e-11e7-93ae-92361f002671", + "modelInvariantUuid" : "64efd51a-2544-11e7-93ae-92361f002671", + "modelVersion" : "2", + "modelCustomizationUuid" : "b4ea86b4-253f-11e7-93ae-92361f002671" + }, "isBase" : false, + "vfModuleLabel" : "PCM", + "initialCount" : 0, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "vSAMP10aDEV::base::module-0", + "modelUuid" : "20c4431c-246d-11e7-93ae-92361f002671", + "modelInvariantUuid" : "78ca26d0-246d-11e7-93ae-92361f002671", + "modelVersion" : "2", + "modelCustomizationUuid" : "cb82ffd8-252a-11e7-93ae-92361f002671" + }, "isBase" : true, + "vfModuleLabel" : "base", + "initialCount" : 1, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "vSAMP10a::base::module-0", + "modelUuid" : "02560de2-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : null, + "modelVersion" : "2", + "modelCustomizationUuid" : "MIGRATED_36e76920-ef30-4793-9979-cbd7d4b2bfc4" + }, "isBase" : true, + "vfModuleLabel" : "base", + "initialCount" : 1, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "base::module-0", + "modelUuid" : "02561381-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : null, + "modelVersion" : "1", + "modelCustomizationUuid" : "MIGRATED_51baae4c-b7c7-4f57-b77e-6e01acca89e5" + }, "isBase" : true, + "vfModuleLabel" : "module-0", + "initialCount" : 1, + "hasVolumeGroup" : false + }, + { + "modelInfo" : { + "modelName" : "vSAMP10a::PCM::module-1", + "modelUuid" : "02560f1b-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : null, + "modelVersion" : "1", + "modelCustomizationUuid" : "MIGRATED_e9be2ed7-45b6-479c-b06e-9093899f8ce8" + }, "isBase" : true, + "vfModuleLabel" : "PCM", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ], + "serviceNetworks": [], + "serviceAllottedResources": [ + { + "modelInfo" : { + "modelName" : "Tunnel_Xconn", + "modelUuid" : "f6b7d4c6-e8a4-46e2-81bc-31cad5072842", + "modelInvariantUuid" : "b7a1b78e-6b6b-4b36-9698-8c9530da14af", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "5b9bee43-f537-4fb3-9e8b-4de9f714d28a", + "modelInstanceName" : "Pri_Tunnel_Xconn 9" + }, + "toscaNodeType" : null, + "allottedResourceType" : null, + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + } + ], + "serviceConfigs": [ + { + "modelInfo" : { + "modelName" : "Mulder", + "modelUuid" : "025606c1-4fff-11e7-9252-005056850d2e", + "modelInvariantUuid" : "025606c1-4eee-11e7-9252-005056850d2e", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "025606c1-4ddd-11e7-9252-005056850d2e", + "modelInstanceName" : "X_FILES_001" + }, + "toscaNodeType" : "Scully" + }, + { + "modelInfo" : { + "modelName" : "Krychuk", + "modelUuid" : "025606c1-5fff-11e7-9252-005056850d2e", + "modelInvariantUuid" : "025606c1-5eee-11e7-9252-005056850d2e", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "025606c1-5ddd-11e7-9252-005056850d2e", + "modelInstanceName" : "X_FILES_002" + }, + "toscaNodeType" : "Skinner" + } + ] + }} + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json new file mode 100644 index 0000000000..dd3ff6841e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json @@ -0,0 +1,38 @@ +{ + "service": + { + "serviceType":"example-service-type", + "globalSubscriberId":"test_custormer", + "resources": + [ + { + "resourceInstanceId":"ns111", + "scaleType":"SCALE_NS", + "scaleNsData": + { + "scaleNsByStepsData": + { + "numberOfSteps":"4", + "aspectId":"TIC_EDGE_HW", + "scalingDirection":"UP" + } + } + }, + { + "resourceInstanceId":"ns333", + "scaleType":"SCALE_NS", + "scaleNsData": + { + "scaleNsByStepsData": + { + "numberOfSteps":"4", + "aspectId":"TIC_EDGE_HW", + "scalingDirection":"UP" + } + } + } + ], + "serviceInstanceName":"service1" + }, + "operationId":"15c01683-4f15-45e7-b213-dcbfe6f42a1b" + } \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/ReplaceVnf_VID_request.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/ReplaceVnf_VID_request.json new file mode 100644 index 0000000000..7c9717244b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/ReplaceVnf_VID_request.json @@ -0,0 +1,49 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vnf", +"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationUuid": "MODEL-ID-1234" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "mdt1", +"tenantId": "88a6ca3ee0394ade9403f075db23167e" +}, +"requestInfo": { +"instanceName": "STMTN", +"instanceId": "a27ce5a9-29c4-4c22-a017-6615ac73c721", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "MIS%2F1604%2F0026%2FSW_INTERNET", +"modelInfo": { +"modelType": "service", +"modelInvariantUuid": "995256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "ab6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "ServicevSAMP12", +"modelVersion": "1.0" +} +} +} +], +"requestParameters": { +"usePreload": false, +"userParams" : [ + { + "name" : "someUserParam", + "value" : "someValue" + }, + { + "name": "sgi_protected_subnet_id", + "value": "thisissomefakevalue" + } +] +} +} +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/UpdateVfModule_VID_request.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/UpdateVfModule_VID_request.json new file mode 100644 index 0000000000..9564f705ae --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/UpdateVfModule_VID_request.json @@ -0,0 +1,62 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelInvariantUuid": "introvert", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "STMTN5MMSC21-MMSC::model-1-0", + "modelVersion": "1", + "modelCustomizationUuid": "MODEL12345" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "MDTWNJ21", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "PCRF::module-0", + "instanceId": "supercool", + "source": "VID", + "suppressRollback": true + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "123456", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "SERVICE_MODEL_NAME", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "skask", + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "skask", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelInstanceName": "vSAMP12 1" + } + } + } + ], + "requestParameters": { + "usePreload": false, + "userParams": [ + { + "name": "someUserParam", + "value": "someValue" + }, + { + "name": "sgi_protected_subnet_id", + "value": "thisissomefakevalue" + } + ] + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/UpdateVnf_VID_request.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/UpdateVnf_VID_request.json new file mode 100644 index 0000000000..5ce8546a41 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/UpdateVnf_VID_request.json @@ -0,0 +1,56 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vnf", +"modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationUuid": "MODEL-ID-1234" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "mdt1", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "STMTN", +"instanceId": "skask", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "MIS%2F1604%2F0026%2FSW_INTERNET", +"modelInfo": { +"modelType": "service", +"modelInvariantUuid": "995256d2-5a33-55df-13ab-12abad84e7ff", +"modelUuid": "ab6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "ServicevSAMP12", +"modelVersion": "1.0" +} +} +} +], +"requestParameters": { +"usePreload": false, +"userParams" : [ + { + "name" : "someUserParam", + "value" : "someValue" + }, + { + "name": "sgi_protected_subnet_id", + "value": "thisissomefakevalue" + }, + { + "name": "vlc_sctp_b_route_prefixes", + "value": [ + { "interface_route_table_routes_route_prefix": "107.239.41.163/32" }, + { "interface_route_table_routes_route_prefix": "107.239.41.164/32" }, + { "interface_route_table_routes_route_prefix": "107.239.41.165/32" } + ]} +] +} +} +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json new file mode 100644 index 0000000000..eb2d9faa2a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json @@ -0,0 +1,16 @@ +{ +"requestDetails": { +"cloudConfiguration": { +"lcpCloudRegionId": "mdt1", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"source": "VID", +"requestorId": "xxxxxx" +}, +"requestParameters": { +"payload": +"{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" +} +} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/CreateNetworkCollection.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/CreateNetworkCollection.json new file mode 100644 index 0000000000..7b369ab97e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/CreateNetworkCollection.json @@ -0,0 +1,70 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersion": "10" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "project": { + "projectName": "{some project name}" + }, + "subscriberInfo": { + "globalSubscriberId": "{some subscriber id}" + }, + "requestInfo": { + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": true, + "requestorId": "xxxxxx" + }, + "requestParameters": { + "subscriptionServiceType": "VMX", + "aLaCarte": false, + "userParams": [ + { + "service": { + "modelInfo": { + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceParams": [], + "resources": { + "networks": [ + { + "modelInfo": { + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf970" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + } + }, + { + "modelInfo": { + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf970" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + } + } + ] + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/ServiceMacroAssign.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/ServiceMacroAssign.json new file mode 100644 index 0000000000..51caddd48a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/ServiceMacroAssign.json @@ -0,0 +1,125 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersion": "10.0" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "project": { + "projectName": "{some project name}" + }, + "subscriberInfo": { + "globalSubscriberId": "{some subscriber id}" + }, + "requestInfo": { + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": true, + "requestorId": "xxxxxx" + }, + "requestParameters": { + "subscriptionServiceType": "VMX", + "aLaCarte": false, + "userParams": [ + { + "service": { + "modelInfo": { + "modelType": "service", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceParams": [], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelType": "vnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceParams": [], + "vfModules": [ + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", + "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79", + "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f" + }, + "instanceParams": [ + { + "vmx_int_net_len": "24" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "100" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "50" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-2", + "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969" + }, + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vmx_vpfe_int_ip_0": "192.168.0.16" + } + ] + } + ] + } + ] + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Policy/policyAbortResponse.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Policy/policyAbortResponse.json new file mode 100644 index 0000000000..c315b1ed1d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Policy/policyAbortResponse.json @@ -0,0 +1 @@ +{"decision":"PERMIT","details":"Abort"} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Policy/policySkipResponse.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Policy/policySkipResponse.json new file mode 100644 index 0000000000..7cbdebb6b3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Policy/policySkipResponse.json @@ -0,0 +1 @@ +{"decision":"PERMIT","details":"Skip"} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Schemas/ActivateServiceInstance.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Schemas/ActivateServiceInstance.json new file mode 100644 index 0000000000..5a6460b62d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Schemas/ActivateServiceInstance.json @@ -0,0 +1,7 @@ +{ + "ActivateServiceInstance": { + "serviceInstance": { + "@class": "inventory.aai.onap.org.v12.ServiceInstance" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Schemas/ActivateVnfSchema.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Schemas/ActivateVnfSchema.json new file mode 100644 index 0000000000..57ab9c2799 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Schemas/ActivateVnfSchema.json @@ -0,0 +1,13 @@ +{ + "ActivateVnf": { + "serviceInstance": { + "@class": "inventory.aai.onap.org.v12.ServiceInstance" + }, + "customer": { + "@class": "inventory.aai.onap.org.v12.Customer" + }, + "genericVnf": { + "@class": "inventory.aai.onap.org.v12.GenericVnf" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Schemas/AssignServiceInstanceSchema.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Schemas/AssignServiceInstanceSchema.json new file mode 100644 index 0000000000..7c35761461 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Schemas/AssignServiceInstanceSchema.json @@ -0,0 +1,16 @@ +{ + "AssignServiceInstance": { + "serviceInstance": { + "@class": "inventory.aai.onap.org.v12.ServiceInstance" + }, + "project": { + "@class": "inventory.aai.onap.org.v12.Project" + }, + "owningEntity": { + "@class": "inventory.aai.onap.org.v12.OwningEntity" + }, + "customer": { + "@class": "inventory.aai.onap.org.v12.Customer" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Schemas/AssignVnfSchema.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Schemas/AssignVnfSchema.json new file mode 100644 index 0000000000..7fff5ca3ce --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Schemas/AssignVnfSchema.json @@ -0,0 +1,13 @@ +{ + "AssignVnf": { + "serviceInstance": { + "@class": "inventory.aai.onap.org.v12.ServiceInstance" + }, + "customer": { + "@class": "inventory.aai.onap.org.v12.Customer" + }, + "genericVnf": { + "@class": "inventory.aai.onap.org.v12.GenericVnf" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/sdncUpdateNetworkTopologySimResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/sdncUpdateNetworkTopologySimResponse.xml new file mode 100644 index 0000000000..836b3c8055 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/sdncUpdateNetworkTopologySimResponse.xml @@ -0,0 +1,17 @@ + + + + + + + testRequestId + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml new file mode 100644 index 0000000000..a5640b2b26 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml @@ -0,0 +1,6 @@ + + +680bd458-5ec1-4a16-b77c-509022e53450INTERNAL +400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data +true + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml new file mode 100644 index 0000000000..02996a13ea --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml @@ -0,0 +1,80 @@ + + + JBoss Web/7.2.2.Final-redhat-1 - JBWEB000064: Error report + + + + +

JBWEB000065: HTTP Status 500 - java.lang.NullPointerException

+
+

+ JBWEB000309: type + JBWEB000066: Exception report +

+

+ JBWEB000068: message + java.lang.NullPointerException +

+

+ JBWEB000069: description + JBWEB000145: The server encountered an internal error that + prevented it from fulfilling this request. + +

+

+ JBWEB000070: exception +

org.jboss.resteasy.spi.UnhandledException:
+				java.lang.NullPointerException
+				org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365)
+				org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233)
+				org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209)
+				org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557)
+				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
+				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
+				org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
+				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
+				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
+				javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
+				org.onap.so.logger.LogFilter.doFilter(LogFilter.java:35)
+			
+

+

+ JBWEB000071: root cause +

java.lang.NullPointerException
+				org.onap.so.adapters.network.NetworkAdapterRest$CreateNetworkVolumesTask.run(NetworkAdapterRest.java:128)
+				org.onap.so.adapters.network.NetworkAdapterRest.createNetwork(NetworkAdapterRest.java:64)
+				sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+				sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+				sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+				java.lang.reflect.Method.invoke(Method.java:606)
+				org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
+				org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
+				org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
+				org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
+				org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
+				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
+				org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
+				org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
+				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
+				org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
+				javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
+				org.onap.so.logger.LogFilter.doFilter(LogFilter.java:35)
+			
+

+

+ JBWEB000072: note + JBWEB000073: The full stack trace of the root cause is available + in the JBoss Web/7.2.2.Final-redhat-1 logs. + +

+
+

JBoss Web/7.2.2.Final-redhat-1

+ + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml new file mode 100644 index 0000000000..0faec794b0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml @@ -0,0 +1,24 @@ + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + + + + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + true + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + CONTRAIL_EXTERNAL + false + c4f4e878-cde0-4b15-ae9a-bda857759cea + 7dd5365547234ee8937416c65507d266 + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml new file mode 100644 index 0000000000..ca5145c226 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml @@ -0,0 +1,4 @@ + + service-instance + https://aai-conexus-e2e.test.com:8443/aai/v8/business/customers/customer/8310000058863/service-subscriptions/service-subscription/vMOG/service-instances/service-instance/f70e927b-6087-4974-9ef8-c5e4d5847ca4 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml new file mode 100644 index 0000000000..e06d27ea88 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml @@ -0,0 +1,73 @@ + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml new file mode 100644 index 0000000000..24ee1df9c8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..79cc14ada3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 13979:105757 + 13979:105757 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml new file mode 100644 index 0000000000..db134a1127 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + 5938baec-03ca-2bd5-a3f1-d54x123e253a + refFQDN1 + 12345 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml new file mode 100644 index 0000000000..34b4a036c4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + 5938baec-03ca-2bd5-a3f1-d54x123e253a + refFQDN2 + 12345 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml new file mode 100644 index 0000000000..c01d0a4f61 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + + + 13979:105708 + EXPORT + 1504025599510 + + + 13979:105707 + IMPORT + 1504025599519 + + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ + + l3-network.network-id + 689ec39e-c5fc-4462-8db2-4f760763ad28 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ + + l3-network.network-id + 1a49396b-19b3-40a4-8792-aa2fbd0f0704 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ + + l3-network.network-id + 774f3329-3c83-4771-86c7-9e6207cd50fd + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml new file mode 100644 index 0000000000..5f1c2cafa5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 13979:105757 + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ + + l3-network.network-id + 689ec39e-c5fc-4462-8db2-4f760763ad28 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ + + l3-network.network-id + 1a49396b-19b3-40a4-8792-aa2fbd0f0704 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ + + l3-network.network-id + 774f3329-3c83-4771-86c7-9e6207cd50fd + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml new file mode 100644 index 0000000000..eedbda9343 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml new file mode 100644 index 0000000000..03d63f9f05 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml @@ -0,0 +1,44 @@ + + + 78987 + MSOTESTVOL102a-vSAMP12_base_vol_module-0 + + Test/vSAMP12 + Pending + 0000020 + + + tenant + /aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ + + tenant.tenant-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mdt1 + + + tenant.tenant-name + ECOMP_MDT1 + + + + vf-module + /aai/v8/network/generic-vnfs/generic-vnf/9e48f6ea-f786-46de-800a-d480e5ccc846/vf-modules/vf-module/6a1dc898-b590-47b9-bbf0-34424a7a2ec3/ + + generic-vnf.vnf-id + 9e48f6ea-f786-46de-800a-d480e5ccc846 + + + vf-module.vf-module-id + 6a1dc898-b590-47b9-bbf0-34424a7a2ec3 + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json new file mode 100644 index 0000000000..603c1f452f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json @@ -0,0 +1,64 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test/vSAMP12", + "modelVersion": "1", + "modelInstanceName": "vSAMP12" + } + } + } + ], + "requestParameters": { + "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "userParams": [ + {"name": "vnfName", "value": "STMTN5MMSC20" }, + {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, + {"name": "vnfNmInformation", "value": "" }, + {"name": "vnfType", "value": "pcrf-capacity" }, + {"name": "vnfId", "value": "skask" }, + {"name": "vnfStackId", "value": "slowburn" }, + {"name": "vnfStatus", "value": "created" }, + {"name": "aicCloudRegion", "value": "MDTWNJ21" }, + {"name": "availabilityZone", "value": "slcp3-esx-az01" }, + {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, + {"name": "vmName", "value": "slcp34246vbc246ceb" }, + {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, + {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" } + ] + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json new file mode 100644 index 0000000000..f32ba2994b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json @@ -0,0 +1,64 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantUuid": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "ff3514e3-5a33-55df-13ab-12abad84e7ff-x", + "modelUuid": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelInvariantUuid": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelUuid": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test/vSAMP12", + "modelVersion": "1", + "modelInstanceName": "vSAMP12" + } + } + } + ], + "requestParameters": { + "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "userParams": [ + {"name": "vnfName", "value": "STMTN5MMSC20" }, + {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, + {"name": "vnfNmInformation", "value": "" }, + {"name": "vnfType", "value": "pcrf-capacity" }, + {"name": "vnfId", "value": "skask" }, + {"name": "vnfStackId", "value": "slowburn" }, + {"name": "vnfStatus", "value": "created" }, + {"name": "aicCloudRegion", "value": "MDTWNJ21" }, + {"name": "availabilityZone", "value": "slcp3-esx-az01" }, + {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, + {"name": "vmName", "value": "slcp34246vbc246ceb" }, + {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, + {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" } + ] + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVolumeGroupRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVolumeGroupRequest.xml new file mode 100644 index 0000000000..8f8d150970 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVolumeGroupRequest.xml @@ -0,0 +1,38 @@ + + RDM2WAGPLCP + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + null + MSOTESTVOL102a-vSAMP12_base_vol_module-0 + + vnf1 + 1 + + + + + vnf_id + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + + + vnf_name + testVnfName123 + + + vf_module_id + null + + + vf_module_name + MSOTESTVOL102a-vSAMP12_base_vol_module-0 + + + true + + 12345 + 12345 + + 12345-1513275871414 + http://localhost:28080/mso/WorkflowMessage/VNFAResponse/12345-1513275871414 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml new file mode 100644 index 0000000000..4087ab8f5f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml @@ -0,0 +1,29 @@ + + 6a1dc898-b590-47b9-bbf0-34424a7a2ec3 + MSOST10606-vSAMP12_MTN6_base_module-0 + MSOST10606-vSAMP12_MTN6_base_module-0/81b01583-690c-4ec3-9c58-0eafa7a90be7 + active + true + 1475077639 + ff5256d2-5a33-55df-13ab-12abad84e7ff + 1.0 + + + volume-group + https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/volume-groups/volume-group/064bd1c6-e377-4009-a744-e958eec6e727/ + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + volume-group.volume-group-id + 064bd1c6-e377-4009-a744-e958eec6e727 + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml new file mode 100644 index 0000000000..2be546162f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml @@ -0,0 +1,37 @@ + + + + 36e20198-c67a-464b-96d0-aaa99eb2639e + 5b9b15d0-5dd7-47dc-95b9-0440c340a3ba + 1.0 + BRGmodelname + 013bd784-9bca-4919-ae2f-ae57af27bad9 + + + parent-service-instance-id + consuming-service-instance-id + namefromrequest + brg + allottedresourceidfromrequest + + + fq-name + + d1 + drole + + vlan-tag + + s2 + srole + + txc-id + + 1 + 123 + a.b.c.d + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml new file mode 100644 index 0000000000..c2d197a2d8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml @@ -0,0 +1,24 @@ + + + + 36e20198-c67a-464b-96d0-aaa99eb2639e + 5b9b15d0-5dd7-47dc-95b9-0440c340a3ba + 1.0 + TXCmodelname + 013bd784-9bca-4919-ae2f-ae57af27bad9 + + + parent-service-instance-id + consuming-service-instance-id + namefromrequest + tunnelxconn + allottedresourceidfromrequest + + + my-vni + my-bearer-ip + my-lan-ip + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml new file mode 100644 index 0000000000..bb7f4c20fd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + TunnelXConn + TunnelXConn + TunnelXConn + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json new file mode 100644 index 0000000000..81fdcc76d0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json @@ -0,0 +1,127 @@ +{ "serviceResources" : { + "modelInfo" : { + "modelName" : "MSO Test Network", + "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", + "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", + "modelVersion" : null + }, + "serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vHNF for DHV Test", + "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", + "modelInvariantUuid" : "6ea0b528-e303-4686-aa77-aa2fcbdccb96", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5", + "modelInstanceName" : "vHNF for DHV Test 17" + }, + "toscaNodeType" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "f5696ec0-ec71-4916-bf3b-93a654efcba4", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ], + "serviceNetworks": [ + { + "modelInfo" : { + "modelName" : "CONTRAIL_BASIC", + "modelUuid" : "fe5be3a6-dbe0-46d6-bcac-44dc841a7edc", + "modelInvariantUuid" : "ab07fbd8-185a-45ac-be45-db3eb02e98d5", + "modelVersion" : null, + "modelCustomizationUuid" : "0cb9b26a-9820-48a7-86e5-16c510e993d9", + "modelInstanceName" : "CONTRAIL_BASIC 5" + }, + "toscaNodeType" : null, + "networkType" : null, + "networkTechnology" : null, + "networkRole" : null, + "networkScope" : null + } + ], + "serviceAllottedResources": [ + { + "modelInfo" : { + "modelName" : "IP_MUX_Demux", + "modelUuid" : "64a1a718-556b-48ce-b3b7-ed3237ccc94f", + "modelInvariantUuid" : "f110ef53-a0a6-4d72-ab91-fd88a835e8c4", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "4bab0880-2f06-4aeb-87cb-3734c8e8bf93", + "modelInstanceName" : "Pri_IP_MUX_Demux 1" + }, + "toscaNodeType" : null, + "allottedResourceType" : "TunnelXConn", + "allottedResourceRole" : "TunnelXConn", + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null, + "homingSolution": { + "inventoryType": "service", + "serviceInstanceId": "MIS%252F1604%252F0027%252FSW_INTERNET", + "vnfHostname": "MDTNJ01", + "cloudOwner": "aic", + "cloudRegionId": "dfwtx", + "aicClli": "KDTNJ01", + "aicVersion": "3.0", + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ] + } + }, + { + "modelInfo" : { + "modelName" : "Service_Admin", + "modelUuid" : "73501e03-ee76-4509-a8ce-96d2a9f33ee9", + "modelInvariantUuid" : "462edf71-1a3c-487b-bf55-497460ab7de3", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "a896ffad-c8f9-404e-a527-7a8d0cc99ce6", + "modelInstanceName" : "Pri_Service_Admin 5" + }, + "toscaNodeType" : null, + "allottedResourceType" : "BRG", + "allottedResourceRole" : "BRG", + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null, + "homingSolution": { + "inventoryType": "service", + "serviceInstanceId": "MIS%252F1604%252F0027%252FSW_INTERNET", + "vnfHostname": "MDTNJ01", + "cloudOwner": "aic", + "cloudRegionId": "dfwtx", + "aicClli": "KDTNJ01", + "aicVersion": "3.0", + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ] + } + } + ] + }} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json new file mode 100644 index 0000000000..80692b27f5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json @@ -0,0 +1,11 @@ +{ "serviceResources" : { + "modelInfo" : { + "modelName" : "MSO Test Network", + "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", + "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", + "modelVersion" : null + }, + "serviceVnfs": [], + "serviceNetworks": [], + "serviceAllottedResources": [] + }} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml new file mode 100644 index 0000000000..b9d88d15db --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml @@ -0,0 +1,7 @@ + + SDN-ETHERNET-INTERNET + SDN-ETHERNET-INTERNET + 1490627351232 + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json new file mode 100644 index 0000000000..dc4669e8d9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json @@ -0,0 +1,40 @@ +{ + "requestDetails": + { + "modelInfo": + { + "modelType":"service", + "modelInvariantUuid":"uuid-miu-svc-011-abcdef", + "modelVersionId":"ASDC_TOSCA_UUID", + "modelName":"SIModelName1", + "modelVersion":"2" + }, + "subscriberInfo": + { + "globalSubscriberId":"SDN-ETHERNET-INTERNET", + "subscriberName":"Kaneohe" + }, + "requestInfo": + { + "instanceName":"VCPE1", + "source":"VID", + "suppressRollback":"false", + "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "cloudConfiguration": + { + "lcpCloudRegionId":"mdt1", + "tenantId":"8b1df54faa3b49078e3416e21370a3ba" + }, + "requestParameters": + { + "subscriptionServiceType":"123456789", + "aLaCarte":"false", + "userParams": + { + "BRG_WAN_MAC_Address" : "brgmac" + } + } + + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json new file mode 100644 index 0000000000..dc9ac49a4e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json @@ -0,0 +1,39 @@ +{ + "requestDetails": + { + "modelInfo": + { + "modelType":"service", + "modelInvariantUuid":"uuid-miu-svc-011-abcdef", + "modelVersionId":"ASDC_TOSCA_UUID", + "modelName":"SIModelName1", + "modelVersion":"2" + }, + "subscriberInfo": + { + "globalSubscriberId":"SDN-ETHERNET-INTERNET", + "subscriberName":"Kaneohe" + }, + "requestInfo": + { + "source":"VID", + "suppressRollback":"false", + "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "cloudConfiguration": + { + "lcpCloudRegionId":"mdt1", + "tenantId":"8b1df54faa3b49078e3416e21370a3ba" + }, + "requestParameters": + { + "subscriptionServiceType":"123456789", + "aLaCarte":"false", + "userParams": + { + "BRG_WAN_MAC_Address" : "brgmac" + } + } + + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json new file mode 100644 index 0000000000..d5b0713d9f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json @@ -0,0 +1,39 @@ +{ + "requestDetails": + { + "modelInfo": + { + "modelType":"service", + "modelInvariantUuid":"uuid-miu-svc-011-abcdef", + "modelVersionId":"ASDC_TOSCA_UUID", + "modelName":"SIModelName1", + "modelVersion":"2" + }, + "subscriberInfo": + { + "globalSubscriberId":"SDN-ETHERNET-INTERNET", + "subscriberName":"Kaneohe" + }, + "requestInfo": + { + "source":"VID", + "suppressRollback":"true", + "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "cloudConfiguration": + { + "lcpCloudRegionId":"mdt1", + "tenantId":"8b1df54faa3b49078e3416e21370a3ba" + }, + "requestParameters": + { + "subscriptionServiceType":"123456789", + "aLaCarte":"false", + "userParams": + { + "BRG_WAN_MAC_Address" : "brgmac" + } + } + + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml new file mode 100644 index 0000000000..3cb31464d5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml @@ -0,0 +1,31 @@ + + ar-brgB + Active + BRG + BRG + BRG + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml new file mode 100644 index 0000000000..65cee9f662 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml @@ -0,0 +1,31 @@ + + ar-txcA + Active + TunnelXConn + TunnelXConn + TunnelXConn + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml new file mode 100644 index 0000000000..932dbfb2ca --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml @@ -0,0 +1,6 @@ + + + allotted-resource + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/ar-brgB + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml new file mode 100644 index 0000000000..e0511873b6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml @@ -0,0 +1,35 @@ + + + MIS/1604/0026/SW_INTERNET + 123456789 + + + generic-vnf + /aai/v7/generic-vnf/vnfX + + + l3-network + /aai/v7/l3-network/netA + + + generic-vnf + /aai/v7/generic-vnf/vnfY + + + l3-network + /aai/v7/l3-network/netB + + + l3-network + /aai/v7/l3-network/netC + + + allotted-resource + /aai/v11/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/ar-txcA + + + allotted-resource + /aai/v11/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/ar-brgB + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml new file mode 100644 index 0000000000..feb535c238 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml @@ -0,0 +1,8 @@ + + MIS/1604/0026/SW_INTERNET + SDN-MOBILITY + 123456789 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml new file mode 100644 index 0000000000..1c4f13d642 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml @@ -0,0 +1,6 @@ + + + allotted-resource + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/ar-txcA + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json new file mode 100644 index 0000000000..dc4669e8d9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json @@ -0,0 +1,40 @@ +{ + "requestDetails": + { + "modelInfo": + { + "modelType":"service", + "modelInvariantUuid":"uuid-miu-svc-011-abcdef", + "modelVersionId":"ASDC_TOSCA_UUID", + "modelName":"SIModelName1", + "modelVersion":"2" + }, + "subscriberInfo": + { + "globalSubscriberId":"SDN-ETHERNET-INTERNET", + "subscriberName":"Kaneohe" + }, + "requestInfo": + { + "instanceName":"VCPE1", + "source":"VID", + "suppressRollback":"false", + "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "cloudConfiguration": + { + "lcpCloudRegionId":"mdt1", + "tenantId":"8b1df54faa3b49078e3416e21370a3ba" + }, + "requestParameters": + { + "subscriptionServiceType":"123456789", + "aLaCarte":"false", + "userParams": + { + "BRG_WAN_MAC_Address" : "brgmac" + } + } + + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml new file mode 100644 index 0000000000..8b8863e29c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml @@ -0,0 +1,36 @@ + + + + generic-vnf + /aai/v7/generic-vnf/vnfX + + + l3-network + /aai/v7/l3-network/netA + + + generic-vnf + /aai/v7/generic-vnf/vnfY/ + + + l3-network + /aai/v7/l3-network/netB + + + l3-network + /aai/v7/l3-network/netC + + + allotted-resource + /aai/v11/anytxc + + + allotted-resource + /aai/v11/anybrg + + + allotted-resource + /aai/v11/other + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml new file mode 100644 index 0000000000..2be546162f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml @@ -0,0 +1,37 @@ + + + + 36e20198-c67a-464b-96d0-aaa99eb2639e + 5b9b15d0-5dd7-47dc-95b9-0440c340a3ba + 1.0 + BRGmodelname + 013bd784-9bca-4919-ae2f-ae57af27bad9 + + + parent-service-instance-id + consuming-service-instance-id + namefromrequest + brg + allottedresourceidfromrequest + + + fq-name + + d1 + drole + + vlan-tag + + s2 + srole + + txc-id + + 1 + 123 + a.b.c.d + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml new file mode 100644 index 0000000000..e352ff8f1f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml @@ -0,0 +1,8 @@ + + + + allotted-resource + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml new file mode 100644 index 0000000000..8c3976b828 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + BRGr + BRGt + BRG + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml new file mode 100644 index 0000000000..650d608fb0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + txc + BRG + BRG + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml new file mode 100644 index 0000000000..14c7410995 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml @@ -0,0 +1,38 @@ + + MIS/1604/0026/SW_INTERNET + 123456789 + + Active + + + + allotted-resource + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + + + cvlan-tag + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml new file mode 100644 index 0000000000..8ed991608a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + BRG + BRG + BRG + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml new file mode 100644 index 0000000000..713c5e7ad5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d1 + MIS%252F1604%252F0026%252FSW_INTERNET + deactvate + brg-topology-operation + http://localhost:28090/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteBRGInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + brg + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml new file mode 100644 index 0000000000..df61910355 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d3 + MIS%252F1604%252F0026%252FSW_INTERNET + unassign + brg-topology-operation + http://localhost:28090/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteBRGInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + brg + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml new file mode 100644 index 0000000000..35c783539c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d2 + MIS%252F1604%252F0026%252FSW_INTERNET + delete + brg-topology-operation + http://localhost:28090/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteBRGInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + brg + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml new file mode 100644 index 0000000000..c2d197a2d8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml @@ -0,0 +1,24 @@ + + + + 36e20198-c67a-464b-96d0-aaa99eb2639e + 5b9b15d0-5dd7-47dc-95b9-0440c340a3ba + 1.0 + TXCmodelname + 013bd784-9bca-4919-ae2f-ae57af27bad9 + + + parent-service-instance-id + consuming-service-instance-id + namefromrequest + tunnelxconn + allottedresourceidfromrequest + + + my-vni + my-bearer-ip + my-lan-ip + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml new file mode 100644 index 0000000000..e352ff8f1f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml @@ -0,0 +1,8 @@ + + + + allotted-resource + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml new file mode 100644 index 0000000000..dfb7d46a68 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + TXCr + TXCt + TXC + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml new file mode 100644 index 0000000000..59c503036a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + brg + TXC + TXC + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml new file mode 100644 index 0000000000..14c7410995 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml @@ -0,0 +1,38 @@ + + MIS/1604/0026/SW_INTERNET + 123456789 + + Active + + + + allotted-resource + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + + + cvlan-tag + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml new file mode 100644 index 0000000000..bb7f4c20fd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + TunnelXConn + TunnelXConn + TunnelXConn + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml new file mode 100644 index 0000000000..35630b79a8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d1 + MIS%252F1604%252F0026%252FSW_INTERNET + deactvate + tunnelxconn-topology-operation + http://localhost:8080/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteTunnelXConnInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + tunnelxconn + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml new file mode 100644 index 0000000000..f6c9cc4626 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d3 + MIS%252F1604%252F0026%252FSW_INTERNET + unassign + tunnelxconn-topology-operation + http://localhost:8080/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteTunnelXConnInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + tunnelxconn + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml new file mode 100644 index 0000000000..2a5597ca77 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d2 + MIS%252F1604%252F0026%252FSW_INTERNET + delete + tunnelxconn-topology-operation + http://localhost:8080/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteTunnelXConnInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + tunnelxconn + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml new file mode 100644 index 0000000000..8ed991608a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + BRG + BRG + BRG + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml new file mode 100644 index 0000000000..bb7f4c20fd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + TunnelXConn + TunnelXConn + TunnelXConn + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + SDN-ETHERNET-INTERNET + + + service-subscription.service-type + 123456789 + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogServiceResourcesData.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogServiceResourcesData.json new file mode 100644 index 0000000000..d05fccf98a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogServiceResourcesData.json @@ -0,0 +1,94 @@ +{ "serviceResources" : { + "modelInfo" : { + "modelName" : "MSO Test Network", + "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", + "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", + "modelVersion" : null + }, + "serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vHNF for DHV Test", + "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", + "modelInvariantUuid" : "6ea0b528-e303-4686-aa77-aa2fcbdccb96", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5", + "modelInstanceName" : "vHNF for DHV Test 17" + }, + "toscaNodeType" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null, + "multiStageDesign" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "f5696ec0-ec71-4916-bf3b-93a654efcba4", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ], + "serviceNetworks": [ + { + "modelInfo" : { + "modelName" : "CONTRAIL_BASIC", + "modelUuid" : "fe5be3a6-dbe0-46d6-bcac-44dc841a7edc", + "modelInvariantUuid" : "ab07fbd8-185a-45ac-be45-db3eb02e98d5", + "modelVersion" : null, + "modelCustomizationUuid" : "0cb9b26a-9820-48a7-86e5-16c510e993d9", + "modelInstanceName" : "CONTRAIL_BASIC 5" + }, + "toscaNodeType" : null, + "networkType" : null, + "networkTechnology" : null, + "networkRole" : null, + "networkScope" : null + } + ], + "serviceAllottedResources": [ + { + "modelInfo" : { + "modelName" : "IP_MUX_Demux", + "modelUuid" : "64a1a718-556b-48ce-b3b7-ed3237ccc94f", + "modelInvariantUuid" : "f110ef53-a0a6-4d72-ab91-fd88a835e8c4", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "4bab0880-2f06-4aeb-87cb-3734c8e8bf93", + "modelInstanceName" : "Pri_IP_MUX_Demux 1" + }, + "toscaNodeType" : null, + "allottedResourceType" : "ContrailRoute", + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + }, + { + "modelInfo" : { + "modelName" : "Service_Admin", + "modelUuid" : "73501e03-ee76-4509-a8ce-96d2a9f33ee9", + "modelInvariantUuid" : "462edf71-1a3c-487b-bf55-497460ab7de3", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "a896ffad-c8f9-404e-a527-7a8d0cc99ce6", + "modelInstanceName" : "Pri_Service_Admin 5" + }, + "toscaNodeType" : null, + "allottedResourceType" : "SecurityZone", + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + } + ] + }} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json new file mode 100644 index 0000000000..b6e8a94888 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json @@ -0,0 +1,98 @@ +{ "serviceResources" : { + "serviceType" : "PortMirroring", + "serviceRole" : "InfraRole", + "environmentContext" : "Luna", + "workloadContext" : "Oxygen", + "modelInfo" : { + "modelName" : "MSO Test Network", + "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", + "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", + "modelVersion" : null + }, + "serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vHNF for DHV Test", + "modelUuid" : "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelInvariantUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "MODEL-ID-1234", + "modelInstanceName" : "vHNF for DHV Test 17" + }, + "toscaNodeType" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : "vSCP", + "nfNamingCode" : null, + "multiStageDesign" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "introvert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ], + "serviceNetworks": [ + { + "modelInfo" : { + "modelName" : "CONTRAIL_BASIC", + "modelUuid" : "fe5be3a6-dbe0-46d6-bcac-44dc841a7edc", + "modelInvariantUuid" : "ab07fbd8-185a-45ac-be45-db3eb02e98d5", + "modelVersion" : null, + "modelCustomizationUuid" : "0cb9b26a-9820-48a7-86e5-16c510e993d9", + "modelInstanceName" : "CONTRAIL_BASIC 5" + }, + "toscaNodeType" : null, + "networkType" : null, + "networkTechnology" : null, + "networkRole" : null, + "networkScope" : null + } + ], + "serviceAllottedResources": [ + { + "modelInfo" : { + "modelName" : "IP_MUX_Demux", + "modelUuid" : "64a1a718-556b-48ce-b3b7-ed3237ccc94f", + "modelInvariantUuid" : "f110ef53-a0a6-4d72-ab91-fd88a835e8c4", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "4bab0880-2f06-4aeb-87cb-3734c8e8bf93", + "modelInstanceName" : "Pri_IP_MUX_Demux 1" + }, + "toscaNodeType" : null, + "allottedResourceType" : "ContrailRoute", + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + }, + { + "modelInfo" : { + "modelName" : "Service_Admin", + "modelUuid" : "73501e03-ee76-4509-a8ce-96d2a9f33ee9", + "modelInvariantUuid" : "462edf71-1a3c-487b-bf55-497460ab7de3", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "a896ffad-c8f9-404e-a527-7a8d0cc99ce6", + "modelInstanceName" : "Pri_Service_Admin 5" + }, + "toscaNodeType" : null, + "allottedResourceType" : "SecurityZone", + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + } + ] + }} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json new file mode 100644 index 0000000000..e1d3118537 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json @@ -0,0 +1,110 @@ +{ "serviceResources" : { + "serviceType" : "PortMirroring", + "serviceRole" : "InfraRole", + "environmentContext" : "Luna", + "workloadContext" : "Oxygen", + "modelInfo" : { + "modelName" : "MSO Test Network", + "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", + "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", + "modelVersion" : null + }, + "serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vHNF for DHV Test", + "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", + "modelInvariantUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5", + "modelInstanceName" : "vHNF for DHV Test 17" + }, + "toscaNodeType" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : "vSCP", + "nfNamingCode" : null, + "multiStageDesign" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "introvert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-1", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0b", + "modelInvariantUuid" : "extrovert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a788" + }, "isBase" : false, + "vfModuleLabel" : "addon_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ], + "serviceNetworks": [ + { + "modelInfo" : { + "modelName" : "CONTRAIL_BASIC", + "modelUuid" : "fe5be3a6-dbe0-46d6-bcac-44dc841a7edc", + "modelInvariantUuid" : "ab07fbd8-185a-45ac-be45-db3eb02e98d5", + "modelVersion" : null, + "modelCustomizationUuid" : "0cb9b26a-9820-48a7-86e5-16c510e993d9", + "modelInstanceName" : "CONTRAIL_BASIC 5" + }, + "toscaNodeType" : null, + "networkType" : null, + "networkTechnology" : null, + "networkRole" : null, + "networkScope" : null + } + ], + "serviceAllottedResources": [ + { + "modelInfo" : { + "modelName" : "IP_MUX_Demux", + "modelUuid" : "64a1a718-556b-48ce-b3b7-ed3237ccc94f", + "modelInvariantUuid" : "f110ef53-a0a6-4d72-ab91-fd88a835e8c4", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "4bab0880-2f06-4aeb-87cb-3734c8e8bf93", + "modelInstanceName" : "Pri_IP_MUX_Demux 1" + }, + "toscaNodeType" : null, + "allottedResourceType" : "ContrailRoute", + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + }, + { + "modelInfo" : { + "modelName" : "Service_Admin", + "modelUuid" : "73501e03-ee76-4509-a8ce-96d2a9f33ee9", + "modelInvariantUuid" : "462edf71-1a3c-487b-bf55-497460ab7de3", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "a896ffad-c8f9-404e-a527-7a8d0cc99ce6", + "modelInstanceName" : "Pri_Service_Admin 5" + }, + "toscaNodeType" : null, + "allottedResourceType" : "SecurityZone", + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + } + ] + }} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogVnfData.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogVnfData.json new file mode 100644 index 0000000000..c7938d1af6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogVnfData.json @@ -0,0 +1,44 @@ +{"serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vHNF for DHV Test", + "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", + "modelInvariantUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5", + "modelInstanceName" : "vHNF for DHV Test 17" + }, + "toscaNodeType" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : "vSCP", + "nfNamingCode" : null, + "multiStageDesign" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "introvert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-1", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0b", + "modelInvariantUuid" : "extrovert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a788" + }, "isBase" : false, + "vfModuleLabel" : "addon_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ] +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogVnfNoTwoPhasedForVfModule.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogVnfNoTwoPhasedForVfModule.json new file mode 100644 index 0000000000..3067d124c3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogVnfNoTwoPhasedForVfModule.json @@ -0,0 +1,44 @@ +{"serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vSAMP12", + "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", + "modelInvariantUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "MODEL-123", + "modelInstanceName" : "VNF for VF Module Create Test Two Phased" + }, + "toscaNodeType" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : "vSCP", + "nfNamingCode" : null, + "multiStageDesign" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "STMTN5MMSC21-MMSC::model-1-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "introvert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-1", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0b", + "modelInvariantUuid" : "extrovert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a788" + }, "isBase" : false, + "vfModuleLabel" : "addon_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ] +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogVnfYesTwoPhasedForVfModule.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogVnfYesTwoPhasedForVfModule.json new file mode 100644 index 0000000000..a9b3226483 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/getCatalogVnfYesTwoPhasedForVfModule.json @@ -0,0 +1,44 @@ +{"serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vSAMP12", + "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", + "modelInvariantUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "MODEL-123", + "modelInstanceName" : "VNF for VF Module Create Test Two Phased" + }, + "toscaNodeType" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : "vSCP", + "nfNamingCode" : null, + "multiStageDesign" : "true", + "vfModules": [ + { + "modelInfo" : { + "modelName" : "STMTN5MMSC21-MMSC::model-1-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "introvert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-1", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0b", + "modelInvariantUuid" : "extrovert", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a788" + }, "isBase" : false, + "vfModuleLabel" : "addon_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ] +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/serviceDecompositionATMFW.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/serviceDecompositionATMFW.json new file mode 100644 index 0000000000..bc54c557e1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VIPR/serviceDecompositionATMFW.json @@ -0,0 +1,110 @@ +{ +"serviceResources" : { + "modelInfo" : { + "modelName" : "CMW_Service", + "modelUuid" : "", + "modelInvariantId" : "cmw-123-456-789", + "modelVersion" : "", + "modelCustomizationUuid" : "", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "Cmw_123", + "modelType" : "" + }, + "serviceInstanceData" : { + "instanceId" : "ff5256d2-5a33-55df-13ab-12abad84e7ff" + }, + "serviceNetworks" : [ { + "modelInfo" : { + "modelName" : "CONTRAIL30_BASIC", + "modelUuid" : "", + "modelInvariantId" : "not yet implemented", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "z_network_123", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "mod-inst-uuid-123", + "modelType" : "network" + }, + "instanceData" : { }, + "networkType" : "CONTRAIL30_BASIC" + } ], + "serviceVnfs" : [ { + "modelInfo" : { + "modelName" : "vSAMP12", + "modelUuid" : "", + "modelInvariantId" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelType" : "vnf" + }, + "instanceData" : { }, + "vfModules" : [ { + "modelInfo" : { + "modelName" : "vSAMP12::base::module-0", + "modelUuid" : "", + "modelInvariantId" : "miu-1001", + "modelVersion" : "1", + "modelCustomizationUuid" : "1001", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "", + "modelType" : "vfModule" + }, + "instanceData" : { }, + "hasVolumeGroup" : false, + "isBase" : true, + "initialCount" : 1 + }, { + "modelInfo" : { + "modelName" : "base::module-0", + "modelUuid" : "", + "modelInvariantId" : "miu-1002", + "modelVersion" : "1", + "modelCustomizationUuid" : "1002", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "", + "modelType" : "vfModule" + }, + "instanceData" : { }, + "hasVolumeGroup" : false, + "isBase" : true, + "initialCount" : 1 + }, { + "modelInfo" : { + "modelName" : "vSAMP12DEV::base::module-0", + "modelUuid" : "", + "modelInvariantId" : "miu-1003", + "modelVersion" : "1", + "modelCustomizationUuid" : "f86e8800-7629-427f-b284-3dbfd04db01f", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "", + "modelType" : "vfModule" + }, + "instanceData" : { }, + "hasVolumeGroup" : false, + "isBase" : true, + "initialCount" : 0 + } ] + } ], + "serviceAllottedResources" : [ { + "modelInfo" : { + "modelName" : "Bruce Wayne", + "modelUuid" : "", + "modelInvariantId" : "not yet implemented", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "ar-mod-custid-456-456", + "modelInstanceName" : "Clark Kent", + "modelCustomizationName" : "", + "modelVersionId" : "123-123", + "modelType" : "allottedResource" + }, + "instanceData" : { } + } ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..0688ea51e4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + fqdn123 + slowburn + 145878989 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..a421355aba --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,53 @@ + + + {{MESSAGE-ID}} + true + d485ecee-957c-4a0a-8b95-27a22b90103f + + + mmsc_vol_1 + a73e0fe9-1ce8-49c2-8fef-e2788605be29 + + + mmsc_vol_2 + 37b6455a-5ea8-463a-89e3-0efeaf7b7c6d + + + nemsfe_vol_1 + b7ff1c21-d138-49a3-bf13-4cfd91efaf48 + + + nemsbe_vol_1 + a5988471-cd42-44d8-b078-64f2f13d3d4c + + + mmsc_vol_5 + f7b91c1e-ab8c-413a-a850-ba80a246c7e0 + + + nemsfe_vol_2 + 957ea3f3-2d4a-4707-bfd2-ba66f42037c2 + + + mmsc_vol_3 + de6fccfe-d61a-48b0-b03b-87bf1bf749b3 + + + mmsc_vol_4 + 76162310-2c38-4c32-981c-5c2880190077 + + + + RDM2WAGPLCP + e585e4f4-9452-437a-b294-45a2d6d3b7a3 + + c30b9453-4b68-4c2e-aacf-58a5ba648bf5 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + 1bbab536a19b4756926e7d0ec1eb543c + true + 78987 + ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef + + ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/DBUpdateResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/DBUpdateResponse.xml new file mode 100644 index 0000000000..0ae5b79484 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/DBUpdateResponse.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml new file mode 100644 index 0000000000..5232e530e9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml @@ -0,0 +1,29 @@ + + + DEV-VF-0011 + UPDATE_VF_MODULE + PORTAL + + + skask + supercool + pcrf-capacity + PCRF::module-0 + + serviceIdUUID + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + 78987 + introvert + 3.14 + myhost.appl.edu + introvert + 3.14 + + + VLAN-OAM-1323 + slcp34246vbc246ceb + 970cd2b9-7f09-4a12-af47-182ea38ba1f0 + 545cc2c3-1930-4100-b534-5d82d0e12bb6 + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/GenerateVfModuleName_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/GenerateVfModuleName_AAIResponse_Success.xml new file mode 100644 index 0000000000..1c736453bc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/GenerateVfModuleName_AAIResponse_Success.xml @@ -0,0 +1,51 @@ + + 12345678-f41f-4822-9323-b75962763d74 + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + pending-create + false + false + introvert + 2.0 + 0000020 + + + lukewarm + PCRF::module-0-0 + extrovert + 2.0 + true + fastburn + 2 + pending-create + 0000074 + + + supercool + PCRF::module-1-0 + extrovert + 2.0 + false + slowburn + 0 + pending-create + 0000075 + + + supercool + PCRF::module-1-0 + introvert + 2.0 + false + slowburn + 1 + pending-create + 0000075 + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/GenericVnf.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/GenericVnf.xml new file mode 100644 index 0000000000..ed96028908 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/GenericVnf.xml @@ -0,0 +1,38 @@ + + skask + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + pending-create + false + false + introvert + 2.0 + 0000020 + + + lukewarm + PCRF::module-0-0 + introvert + 2.0 + true + fastburn + pending-create + 0000074 + + + supercool + PCRF::module-1-0 + extrovert + 2.0 + false + slowburn + pending-create + 0000075 + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..f3009e0f4c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 195159195 + 14567890 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCSITopologyAssignCallback.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCSITopologyAssignCallback.xml new file mode 100644 index 0000000000..d476b728bd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCSITopologyAssignCallback.xml @@ -0,0 +1,11 @@ + + 094d311c-40bc-4ff1-9617-37c4226efcc3 + 200 + + Y + + 8462db9b-3e91-4e90-a2c8-6471313f87bf + restconf/config/GENERIC-RESOURCE-API:services/service/8462db9b-3e91-4e90-a2c8-6471313f87bf/service-data/service-topology/ + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml new file mode 100644 index 0000000000..4cab6c6615 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml @@ -0,0 +1,13 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml new file mode 100644 index 0000000000..7512435415 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml @@ -0,0 +1,16 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + + restconf/SDNCObjectPath + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml new file mode 100644 index 0000000000..7d3d0e54d1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml @@ -0,0 +1,13 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml new file mode 100644 index 0000000000..c1a03539cc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml @@ -0,0 +1,16 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + + restconf/SDNCObjectPath + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml new file mode 100644 index 0000000000..e43a1319ca --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml @@ -0,0 +1,13 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml new file mode 100644 index 0000000000..d061cda9e0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml @@ -0,0 +1,8 @@ + + + skask + + 404 + {{REQUEST-ID}} + Y + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml new file mode 100644 index 0000000000..c1a03539cc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml @@ -0,0 +1,16 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + + restconf/SDNCObjectPath + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml new file mode 100644 index 0000000000..0ee3f2827d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml @@ -0,0 +1,315 @@ + + + bd1b3789-6474-4935-94b2-90b656e035d0 + + bd1b3789-6474-4935-94b2-90b656e035d0 + + 9ddf628a-9eca-430e-8974-22d520a31be1 + assign + https://localhost:8443/adapters/rest/SDNCNotify + + + notsurewecare + bd1b3789-6474-4935-94b2-90b656e035d0 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + + PendingCreate + + + VNN1CA52LCP + skask + afd0f02a-1ddb-43bb-aded-5113e46e82ae + ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 + ZVNN1MOGX01 + 33d209df14ac4c08ad60747185d2f3e0 + bd1b3789-6474-4935-94b2-90b656e035d0 + ZVNN1MOGX01 - VF AUG 1::module-0 + + + + + mog_exn + 03dbd833-785c-40c0-bf32-37594b5334bc + MNS-25180-P-VNNYCA01_exn_protected_net_1 + + + 6f82d234-41a4-48e9-a9e8-415667a72929 + + filter1 + + + filter2 + + + + mog_oam + 3f181cde-9380-4c20-9d3a-e1a4ee74f994 + MNS-25180-P-VNNYCA01_oam_protected_net_1 + + + 713b6770-13fa-4949-8dbb-a1288c5e5932 + + + mog_cor_B + 821a550a-3f50-4725-995b-f212d5caec7c + MNS-25180-P-VNNYCA01_cor_direct_net_1 + + + 18926e56-12b6-4a4d-98b6-37e0c05626ee + + + mog_cor_A + 3dabf5c0-cffb-420c-8960-8499c74eb25f + MNS-25180-P-VNNYCA01_cor_direct_net_2 + + + 35530b29-a4de-48ff-a014-111110ccc652 + + + mog_gn + 3ce97321-6e7f-49af-bd12-f833e377c310 + MNS-25180-P-VNNYCA01_gn_direct_net_1 + + + 32bfdd2c-28e1-4895-87a6-373bf12c3129 + + + mog_dmz + d43ca910-02a5-47dc-8510-100a68a3c9e0 + MNS-25180-P-VNNYCA01_dmz_protected_net_1 + + + cb9500fb-943f-412e-aea6-458711564a75 + + + nova + + + ps + + ZVNN1MOGX01MPS001 + + + ZVNN1MOGX01MPS002 + + + ZVNN1MOGX01MPS003 + + + ZVNN1MOGX01MPS004 + + 4 + + mog_cor_B + + 107.224.36.251 + + + 107.224.36.252 + + + 107.224.36.253 + + + 107.224.36.254 + + N + + + + cm + + ZVNN1MOGX01MCM001 + + + ZVNN1MOGX01OAM002 + + 1 + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + N + + + mog_oam + + 107.239.167.250 + + + 107.239.167.251 + + N + + + + oam + + ZVNN1MOGX01OAM001 + + + ZVNN1MOGX01OAM002 + + 2 + + mog_oam + + 107.239.167.252 + + + 107.239.167.251 + + N + + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + N + + + + pd + + ZVNN1MOGX01MPD001 + + + ZVNN1MOGX01MPD002 + + 2 + + mog_dmz + + 107.225.25.253 + + + 107.225.25.254 + + N + 107.225.254.253 + + + mog_oam + + 107.239.167.254 + + + 107.239.167.253 + + N + 107.239.167.249 + + + mog_exn + + 107.224.46.253 + + + 107.224.46.254 + + N + 107.224.46.252 + + + mog_cor_B + + 107.224.36.247 + + + 107.224.36.248 + + N + 107.224.41.252 + + + mog_gn + + 107.224.41.253 + + + 107.224.41.254 + + N + 107.224.41.252 + + + mog_cor_A + + 107.224.38.253 + + + 107.224.38.254 + + N + + + + sm + + ZVNN1MOGX01MSM001 + + + ZVNN1MOGX01MSM002 + + + ZVNN1MOGX01MSM003 + + + ZVNN1MOGX01MSM004 + + 4 + + mog_cor_B + + 107.224.36.243 + + + 107.224.36.244 + + + 107.224.36.245 + + + 107.224.36.246 + + N + + + + + ZVNNMOGX01_base + SDN-MOBILITY + ZVNN1MOGX01 - VF AUG 1::module-0 + ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 + ZVNN1MOGX01 + + + + 9ddf628a-9eca-430e-8974-22d520a31be1 + + PORTAL + VNFActivateRequest + + + + 200 + Y + synccomplete + 2016-08-05T16:15:19.398Z + vnf-topology-operation + VNFActivateRequest + assign + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml new file mode 100644 index 0000000000..677ecb7444 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml @@ -0,0 +1,141 @@ + + + 28455973-1ee5-4ad1-8d35-c4732679743a + + 200 + Y + synccomplete + 2016-06-08T19:44:59.138Z + vnf-topology-operation + VNFActivateRequest + assign + + + 28455973-1ee5-4ad1-8d35-c4732679743 + + notsurewecare + 28455973-1ee5-4ad1-8d35-c4732679743a + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + + 5e168556-a5c6-4813-bff3-cc03007afbbc + http://localhost:8080/adapters/rest/SDNCNotify + assign + + + AAIAIC25 + MSOTEST06-vSAMP3::base::module-0 + 91ad7ab0-9ffd-471d-971c-3eb913a2cc75 + Test/vSAMP3 1 + MSOTEST06 + 4ae1d3446a4c48b2bec44b6cfba06d68 + 28455973-1ee5-4ad1-8d35-c4732679743a + vSAMP3::base::module-0 + + + PendingCreate + + + + image + Ubuntu_Perf + + + flavor + m1.small + + + + int_imbl + 680b7453-0ec4-4d96-b355-280d981d418f + Nimbus-25193-T-Willows2_int_imbl_net_1 + default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_int_imbl_net_1 + + 775607fb-e16a-45ef-94a7-82fba0d16eec + 640d07fb-e16a-45ef-94a7-82fba0d169bf + + filter1 + + + filter2 + + + + sgi_protected + f9039ce9-e3cf-4716-b2d1-ec7912178ea4 + Nimbus-25193-T-Willows2_sgi_protected_net_1 + default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_sgi_protected_net_1 + b9999ce9-e3cf-4716-b2d1-ec791217678c + + bf11bba8-b971-4ab5-8281-215b3fedcd3c + + + cm + + ZVNN1MOGX01MCM001 + + + ZVNN1MOGX01OAM002 + + 1 + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + + 2606:ae00:2e01:800::67 + + N + 107.224.41.252 + 2001:1890:1001:2B32::29:C + + + mog_oam + + 107.239.167.250 + + + 107.239.167.251 + + + aa::aa::aa::aa::aa::aa + + + bb::bb::bb::bb::bb::bb + + + 1.2.3.4/26 + + + 2002::/64 + + N + 1111:1890:1001:2B32::29:D + + + + nova + + + + MSOTEST06-vSAMP3::base::module-0 + SDN-MOBILITY + vSAMP3::base::module-0 + Test/vSAMP3 1 + MSOTEST06 + + + + 5e168556-a5c6-4813-bff3-cc03007afbbc + + SoapUI-bns-vf-base-vSAMP3-9001 + VNFActivateRequest + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml new file mode 100644 index 0000000000..c50c25671b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml @@ -0,0 +1,81 @@ + + + + 0725b072-b854-4705-bf8e-c1a1eb08651e + vSAMP10aDEV::base::module-0 + zmtn6nf-code-111_base_0 + + + vSAMP10aDEV::base::module-0 + 819ef122-ca19-4141-a61e-62922f8fc279 + ff2ae348-214a-11e7-93ae-92361f002673 + 3a97db99-c4bb-498a-a13a-38f65f1ced3d + ff2ae348-214a-11e7-93ae-92361f002673 + + 19123c2924c648eb8e42a3c1f14b7682 + mtn6 + AUSTTXGR + + + image + Ubuntu_Perf + + + flavor + m1.small + + + + + + cm + + ZVNN1MOGX01MCM001 + + + ZVNN1MOGX01OAM002 + + 1 + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + + 2606:ae00:2e01:800::67 + + N + 107.224.41.252 + 2001:1890:1001:2B32::29:C + + + mog_oam + + 107.239.167.250 + + + 107.239.167.251 + + + aa::aa::aa::aa::aa::aa + + + bb::bb::bb::bb::bb::bb + + + 1.2.3.4/26 + + + 2002::/64 + + N + 1111:1890:1001:2B32::29:D + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml new file mode 100644 index 0000000000..ba98ef8838 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml @@ -0,0 +1,82 @@ + + + + nf-type-1 + zmtn6nf-code-111 + nf-role-1 + nf-function-1 + nf-code-1 + eac30f85-f61f-4c5f-862e-2c62f9e135de + null + + + vSAMP10a_macro + 819ef122-ca19-4141-a61e-62922f8fc279 + 1.0 + ef176121-f02c-4dd3-927c-22131d48446b + ff2ae348-214a-11e7-93ae-92361f002672 + + + + mog_exn + 03dbd833-785c-40c0-bf32-37594b5334bc + MNS-25180-P-VNNYCA01_exn_protected_net_1 + + + 6f82d234-41a4-48e9-a9e8-415667a72929 + + filter1 + + + filter2 + + + + mog_oam + 3f181cde-9380-4c20-9d3a-e1a4ee74f994 + MNS-25180-P-VNNYCA01_oam_protected_net_1 + + + 713b6770-13fa-4949-8dbb-a1288c5e5932 + + + mog_cor_B + 821a550a-3f50-4725-995b-f212d5caec7c + MNS-25180-P-VNNYCA01_cor_direct_net_1 + + + 18926e56-12b6-4a4d-98b6-37e0c05626ee + + + mog_cor_A + 3dabf5c0-cffb-420c-8960-8499c74eb25f + MNS-25180-P-VNNYCA01_cor_direct_net_2 + + + 35530b29-a4de-48ff-a014-111110ccc652 + + + mog_gn + 3ce97321-6e7f-49af-bd12-f833e377c310 + MNS-25180-P-VNNYCA01_gn_direct_net_1 + + + 32bfdd2c-28e1-4895-87a6-373bf12c3129 + + + mog_dmz + d43ca910-02a5-47dc-8510-100a68a3c9e0 + MNS-25180-P-VNNYCA01_dmz_protected_net_1 + + + cb9500fb-943f-412e-aea6-458711564a75 + + + nova + + + 19123c2924c648eb8e42a3c1f14b7682 + mtn6 + AUSTTXGR + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml new file mode 100644 index 0000000000..c1a03539cc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml @@ -0,0 +1,16 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + + restconf/SDNCObjectPath + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml new file mode 100644 index 0000000000..77528ccf61 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml new file mode 100644 index 0000000000..49ecd0bf3f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml @@ -0,0 +1,55 @@ + + skask + supercool + slowburn + true + + + key1 + value1 + + + key2 + value2 + + +server1_private_ip +192.168.28.3 + + +contrail-service-instance-fqdn +default-domain:MSOTest:MsoNW-RA + + +policyKey1_contrail_network_policy_fqdn +MSOTest:DefaultPolicyFQDN1 + + +policyKey2_contrail_network_policy_fqdn +MSOTest:DefaultPolicyFQDN2 + + +oam_management_v6_address +2000:abc:bce:1111 + + +oam_management_v4_address +127.0.0.1 + + + + skask + supercool + slowburn + true + tenantId + cloudSiteId + + requestId + serviceInstanceId + + {{MESSAGE-ID}} + + {{MESSAGE-ID}} + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteRequest.xml new file mode 100644 index 0000000000..61aeaa7d66 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteRequest.xml @@ -0,0 +1,15 @@ + + testMessageId + true + testNotificationUrl + testAicCloudRegion} + testTenantId + testVnfId + testVfModuleId + testVfModuleStackId + + testRequestId + testServiceInstanceId + false + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteResponse.xml new file mode 100644 index 0000000000..b5b61192f7 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteResponse.xml @@ -0,0 +1,56 @@ + + testMessageId + true + testVfModuleId + + + key1 + value1 + + + key2 + value2 + + + server1_private_ip + 192.168.28.3 + + + contrail-service-instance-fqdn + default-domain:MSOTest:MsoNW-RA + + + policyKey1_contrail_network_policy_fqdn + MSOTest:DefaultPolicyFQDN1 + + + policyKey2_contrail_network_policy_fqdn + MSOTest:DefaultPolicyFQDN2 + + + oam_management_v6_address + 2000:abc:bce:1111 + + + oam_management_v4_address + 127.0.0.1 + + + internal_security_group + test_internal_security_group + + + int_internal_net_id + test_int_internal_net_id + + + dsx_server_group_id + test_dsx_server_group_id + + + mcas_host_key + test_mcas_host_key + + + testVnfId + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml new file mode 100644 index 0000000000..c602dd9667 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml @@ -0,0 +1,16 @@ + + skask + supercool + slowburn + + + key1 + value1 + + + key2 + value2 + + + {{MESSAGE-ID}} + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml new file mode 100644 index 0000000000..830d2e2237 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml @@ -0,0 +1,15 @@ + + 78987 + slowburn + + + key1 + value1 + + + key2 + value2 + + + {{MESSAGE-ID}} + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml new file mode 100644 index 0000000000..ba0b4e4609 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml @@ -0,0 +1,10 @@ + + lukewarm + PCRF::module-1 + slowburn + pending-create + true + 330-90 + introvert + 2.0 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-new-PendingActivation.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-new-PendingActivation.xml new file mode 100644 index 0000000000..2ccba7d056 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-new-PendingActivation.xml @@ -0,0 +1,9 @@ + + b37d96db-7d2c-47ce-bf61-a6c7b82fe161 + PCRF::module-0-2 + 00000000-0000-0000-0000-000000000000 + 1.0 + false + PendingActivation + 330-90 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-new.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-new.xml new file mode 100644 index 0000000000..481410c3f6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-new.xml @@ -0,0 +1,9 @@ + + b37d96db-7d2c-47ce-bf61-a6c7b82fe161 + PCRF::module-0-2 + 00000000-0000-0000-0000-000000000000 + 1.0 + false + pending-create + 330-90 + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-supercool.xml new file mode 100644 index 0000000000..49513f1eac --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-supercool.xml @@ -0,0 +1,27 @@ + + supercool + PCRF::module-2 + fastburn + pending-create + false + 330-89 + introvert + 2.0 + + + volume-group + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + pdk1 + + + volume-group.volume-group-id + 78987 + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VolumeGroup.xml new file mode 100644 index 0000000000..df84706ec5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VolumeGroup.xml @@ -0,0 +1,25 @@ + + 78987 + Volume_2 + slowburn + pcrf-capacity + Active + 0000020 + + + tenant + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + MDTWNJ21 + + + tenant.tenant-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/deleteNetworkResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/deleteNetworkResponse_Success.xml new file mode 100644 index 0000000000..b8b8a4ff20 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/deleteNetworkResponse_Success.xml @@ -0,0 +1,3 @@ + + true + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/requestDetails.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/requestDetails.json new file mode 100644 index 0000000000..76616e14a5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/requestDetails.json @@ -0,0 +1,37 @@ +{ + "requestDetails": { + "project": { + "projectName": "vSAMP12 Project" + }, + "owningEntity": { + "owningEntityId": "MSO-Test-OE", + "owningEntityName": "MSO-Test123" + }, + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "d214abcc-2083-11e7-93ae-92361f002671", + "modelUuid": "c4503baa-2083-11e7-93ae-92361f002671", + "modelName": "MSOTADevInfra_vSAMP12_Service", + "modelVersion": "1.0" + }, + "subscriberInfo": { + "globalSubscriberId": "MSO_1610_dev", + "subscriberName": "MSO_1610_dev" + }, + "requestInfo": { + "instanceName": "bensServiceInstance3", + "source": "VID", + "suppressRollback": "true", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "8b1df54faa3b49078e3416e21370a3ba" + }, + "requestParameters": { + "subscriptionServiceType": "MSO-dev-service-type", + "aLaCarte": "false", + "userParams": [] + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/schema.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/schema.json new file mode 100644 index 0000000000..36b51e9575 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/schema.json @@ -0,0 +1,16 @@ +{ + "CreateServiceInstanceV3": { + "serviceInstance": { + "@class": "inventory.aai.onap.org.v12.ServiceInstance" + }, + "project": { + "@class": "inventory.aai.onap.org.v12.Project" + }, + "owningEntity": { + "@class": "inventory.aai.onap.org.v12.OwningEntity" + }, + "customer": { + "@class": "inventory.aai.onap.org.v12.Customer" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yml new file mode 100644 index 0000000000..007615e569 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yml @@ -0,0 +1,340 @@ +aai: + auth: 757A94191D685FD2092AC1490730A4FC + dme2: + timeout: '30000' + endpoint: https://localhost:8443 +camunda: + bpm: + admin-user: + id: admin + password: admin + database: + type: h2 + history-level: FULL + metrics: + enabled: false + db-reporter-activate: false +canopi: + auth: 757A94191D685FD2092AC1490730A4FC +csi: + aots: + addincidentmanagement: + endpoint: http://localhost:28090/AddIncidentManagementTicketRequest + networkstatus: + endpoint: http://localhost:28090/SendManagedNetworkStatusNotification +entitymanager: + packagesToScan: com + +mso: + correlation: + timeout: PT60S + logPath: logs + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + adapters: + completemsoprocess: + endpoint: http://localhost:30253/CompleteMsoProcess + db: + auth: 757A94191D685FD2092AC1490730A4FC + password: wLg4sjrAFUS8rfVfdvTXeQ== + endpoint: http://localhost:28090 + spring: + endpoint: http://localhost:28090 + network: + endpoint: http://localhost:30253/services/NetworkAdapter + rest: + endpoint: http://localhost:30253/services/rest/v1/networks + openecomp: + db: + endpoint: http://localhost:30257/services/RequestsDbAdapter + po: + auth: 757A94191D685FD2092AC1490730A4FC + password: 3141634BF7E070AA289CF2892C986C0B + sdnc: + endpoint: http://localhost:30254/adapters/SDNCAdapter + rest: + endpoint: http://localhost:30254/adapters/rest/v1/sdnc + timeout: PT60S + tenant: + endpoint: http://localhost:30253/services/TenantAdapter + vnf: + endpoint: http://localhost:30253/services/VnfAdapter + rest: + endpoint: http://localhost:30253/services/rest/v1/vnfs + volume-groups: + rest: + endpoint: http://localhost:30253/services/rest/v1/volume-groups + vnf-async: + endpoint: http://localhost:30253/services/VnfAdapterAsync + adiod: + vce: + service: + model: + invariant: + uuid: 1cc4e2e4-eb6e-404d-a66f-c8733cedcce8 + version: '5.0' + bpmn: + process: + historyTimeToLive: '30' + callbackRetryAttempts: '5' + catalog: + db: + endpoint: http://localhost:30258/ecomp/mso/catalog + spring: + endpoint: http://localhost:30258 + csi: + pwd: 4EA237303511EFBBC37F17A351562131 + sendmanagednetworkstatusnotification: + applicationname: NetworkManagementEthernetOverFiber + version: '212' + usrname: mso + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + default: + adapter: + namespace: http://com.att.mso + gateway: + service: + model: + name: HNGWaaS for DHV Test + healthcheck: + log: + debug: 'false' + infra: + customer: + id: testCustIdInfra + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + oam: + network: + role: + gateway: HngwOamNetVto.OAM + portal: HnportalOamNetVto.OAM + po: + timeout: PT60S + portal: + service: + model: + name: HNPortalaaS for DHV Test + request: + db: + endpoint: http://localhost:28090/ + rollback: 'true' + sdnc: + firewall: + yang: + model: + version: '2015-05-15' + password: 3141634BF7E070AA289CF2892C986C0B + timeout: + firewall: + minutes: '20' + ucpe: + async: + hours: '120' + minutes: '5' + service: + agnostic: + sniro: + endpoint: /sniro/api/v2/placement + host: http://localhost:30253 + site-name: CamundaEngine + sniro: + auth: test:testpwd + callback: http://localhost:28090/adapters/rest/SDNCNotify + endpoint: http://localhost:28090/optimizationInstance/V1/create + policies: + dhv: + 2vvig: SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1 + 4vvig: SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.VNFPolicy_vvigprimary2_v1,SNIRO.VNFPolicy_vvigsecondary2_v1,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1 + timeout: PT30M + sriov: + network: + role: + gateway1: HngwSriovProviderNet.SR_IOV_Provider2_1 + gateway2: HngwSriovProviderNet.SR_IOV_Provider2_2 + portal1: HnportalSriovProviderNet3.SR_IOV_Provider2_1 + portal2: HnportalSriovProviderNet3.SR_IOV_Provider2_2 + workflow: + aai: + distribution: + delay: PT5S + CreateGenericVNFV1: + aai: + volume-group: + uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group + DHVCreateService: + aai: + customer: + uri: /aai/v9/business/customers/customer + createvce: + delay: + seconds: '1' + default: + aai: + version: '8' + cloud-region: + version: '9' + generic-vnf: + version: '9' + v11: + customer: + uri: /aai/v11/business/customers/customer + generic-query: + uri: /aai/v11/search/generic-query + generic-vnf: + uri: /aai/v11/network/generic-vnfs/generic-vnf + l3-network: + uri: /aai/v11/network/l3-networks/l3-network + network-policy: + uri: /aai/v11/network/network-policies/network-policy + nodes-query: + uri: /aai/v11/search/nodes-query + route-table-reference: + uri: /aai/v11/network/route-table-references/route-table-reference + tenant: + uri: /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + vce: + uri: /aai/v11/network/vces/vce + vpn-binding: + uri: /aai/v11/network/vpn-bindings/vpn-binding + v8: + configuration: + uri: /aai/v11/network/configurations/configuration + customer: + uri: /aai/v8/business/customers/customer + generic-query: + uri: /aai/v8/search/generic-query + l3-network: + uri: /aai/v8/network/l3-networks/l3-network + network-policy: + uri: /aai/v8/network/network-policies/network-policy + nodes-query: + uri: /aai/v8/search/nodes-query + route-table-reference: + uri: /aai/v8/network/route-table-references/route-table-reference + tenant: + uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + vce: + uri: /aai/v8/network/vces/vce + vpn-binding: + uri: /aai/v8/network/vpn-bindings/vpn-binding + v9: + cloud-region: + uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic + generic-vnf: + uri: /aai/v9/network/generic-vnfs/generic-vnf + retry: + attempts: '1' + deleteCinderVolumeV1: + aai: + volume-group: + uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group + global: + default: + aai: + namespace: http://org.openecomp.aai.inventory/ + l3ToHigherLayerAddBonding: + model: + invariantid: 50359538-066f-4a8d-807f-f2bc8eaa79dc + name: WAN Bonding v0.1 + version: '0.1' + versionid: 52dbec20-47aa-42e4-936c-331d8e350d44 + message: + endpoint: http://localhost:30252/mso/WorkflowMessage + notification: + name: GenericNotificationServiceATT + sdncadapter: + callback: http://localhost:30254/mso/SDNCAdapterCallbackService + vnfadapter: + create: + callback: http://localhost:30253/mso/vnfAdapterNotify + delete: + callback: http://localhost:30253/mso/vnfAdapterNotify + query: + callback: http://localhost:30253/mso/vnfAdapterNotify + rollback: + callback: http://localhost:30253/mso/vnfAdapterNotify +policy: + auth: Basic dGVzdHBkcDphbHBoYTEyMw== + client: + auth: Basic bTAzNzQzOnBvbGljeVIwY2sk + endpoint: https://localhost:8081/pdp/api/ + environment: TEST +sdnc: + auth: Basic YWRtaW46YWRtaW4= + host: https://localhost:8443 + path: /restconf/operations/GENERIC-RESOURCE-API +sdno: + health-check: + dmaap: + password: eHQ1cUJrOUc + publisher: + topic: com.att.sdno.test-health-diagnostic-v02 + subscriber: + topic: com.att.sdno.test-health-diagnostic-v02 + username: testuser +sniro: + conductor: + host: http://localhost:30253 + uri: /release + manager: + host: http://localhost:30253 + uri: /sniro/api/placement/v2 + headers.auth: Basic dGVzdDp0ZXN0cHdk + headers.patchVersion: 1 + headers.minorVersion: 1 + headers.latestVersion: 2 +server: + port: 8080 + tomcat: + max-threads: 50 + # ssl: + # key-store: /app/msoClientKeyStore.jks + # key-store-password: mso4you + # key-store-type: JKS + # trust-store: /app/msoTrustStore.jks + # trust-store-password: mso_Domain2.0_4you +spring: + h2: + console: + enabled: true + path: /h2 + datasource: + url: jdbc:h2:mem:AZ;;DB_CLOSE_ON_EXIT=FALSE + username: sa + password: sa + driverClassName: org.h2.Driver + security: + usercredentials: + - + username: test + password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu' + role: BPMN-Client +# Hibernate +hibernate: + dialect: org.hibernate.dialect.MySQL5Dialect + show_sql: false + +management: + security: + enabled: false + +security: + basic: + enabled: false + +appc: + client: + topic: + read: + name: APPC-TEST-AMDOCS2 + timeout: 360000 + write: APPC-TEST-AMDOCS1-IST + response: + timeout: 360000 + key: LSl8QKolmKcC0yJR + secret: lgjXraD1HutKxv8jEN6tVouu + service: ueb + poolMembers: localhost:3904,localhost:3904,localhost:3904 \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/applicationContext_forPnfTesting.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/applicationContext_forPnfTesting.xml new file mode 100644 index 0000000000..ebefee7b08 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/applicationContext_forPnfTesting.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/catalogDBClientProps.properties b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/catalogDBClientProps.properties new file mode 100644 index 0000000000..bca529f960 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/catalogDBClientProps.properties @@ -0,0 +1 @@ +catalog.db.endpoint= http://localhost: \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/logback-test.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..38a2ef6ef5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/logback-test.xml @@ -0,0 +1,44 @@ + + + + + + + %d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level + %logger{1024} - %msg%n + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/requestsDBClientProps.properties b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/requestsDBClientProps.properties new file mode 100644 index 0000000000..758a6edd97 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/requestsDBClientProps.properties @@ -0,0 +1 @@ +requests.db.endpoint= http://localhost: \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/stubprocess/GenericStub.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/stubprocess/GenericStub.bpmn new file mode 100644 index 0000000000..66f458425e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/stubprocess/GenericStub.bpmn @@ -0,0 +1,35 @@ + + + + + SequenceFlow_0tyavm9 + + + SequenceFlow_0tyavm9 + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml new file mode 100644 index 0000000000..380c552a3f --- /dev/null +++ b/bpmn/so-bpmn-tasks/pom.xml @@ -0,0 +1,49 @@ + + + org.onap.so + bpmn + 1.3.0-SNAPSHOT + + 4.0.0 + so-bpmn-tasks + jar + + UTF-8 + UTF-8 + 1.8 + 1.8 + + + + + org.onap.so + MSOCommonBPMN + ${project.version} + + + org.onap.so + so-bpmn-infrastructure-common + ${project.version} + + + + org.onap.sdnc.apps + client + + 1.1.0-SNAPSHOT + + + ch.vorburger.mariaDB4j + mariaDB4j + 2.2.3 + test + + + + org.apache.commons + commons-lang3 + 3.4 + + + diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java new file mode 100644 index 0000000000..b7f45c05b5 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java @@ -0,0 +1,563 @@ +/*- + * ============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.bpmn.buildingblock; + +import static org.apache.commons.lang3.StringUtils.*; + +import java.time.Duration; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.apache.commons.lang.SerializationUtils; +import org.camunda.bpm.engine.delegate.BpmnError; +import org.json.JSONArray; +import org.json.JSONObject; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.generalobjects.License; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.bpmn.servicedecomposition.homingobjects.Candidate; +import org.onap.so.bpmn.servicedecomposition.homingobjects.CandidateType; +import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionCandidates; +import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionInfo; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoMetadata; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.ExceptionBuilder; + +import org.onap.so.client.sniro.SniroClient; +import static org.onap.so.client.sniro.SniroValidator.*; + +import org.onap.so.client.sniro.beans.SniroManagerRequest; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; +import org.springframework.web.util.UriUtils; + + +/** + * The sniro homing building block obtains licensing and homing solutions for a given + * resource or set of resources. + * + * @author cb645j + * + */ +@Component("SniroHoming") +public class SniroHomingV2 { + private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroHomingV2.class); + private JsonUtils jsonUtils = new JsonUtils(); + @Autowired + private Environment env; + @Autowired + private SniroClient client; + @Autowired + private ExceptionBuilder exceptionUtil; + private static final String MODEL_NAME = "modelName"; + private static final String MODEL_INVARIANT_ID = "modelInvariantId"; + private static final String MODEL_VERSION_ID = "modelVersionId"; + private static final String MODEL_VERSION = "modelVersion"; + private static final String SERVICE_RESOURCE_ID = "serviceResourceId"; + private static final String RESOURCE_MODULE_NAME = "resourceModuleName"; + private static final String RESOURCE_MODEL_INFO = "resourceModelInfo"; + private static final String IDENTIFIER_TYPE = "identifierType"; + private static final String INVENTORY_TYPE = "inventoryType"; + private static final String SOLUTIONS = "solutions"; + private static final String RESOURCE_MISSING_DATA = "Resource does not contain: "; + private static final String SERVICE_MISSING_DATA = "Service Instance does not contain: "; + private static final String UNPROCESSABLE = "422"; + private static final int INTERNAL = 500; + + /** + * Generates the request payload then sends to sniro manager to perform homing and + * licensing for the provided demands + * + * @param execution + */ + public void callSniro(BuildingBlockExecution execution){ + log.trace("Started Sniro Homing Call Sniro"); + try{ + GeneralBuildingBlock bb = execution.getGeneralBuildingBlock(); + + RequestContext requestContext = bb.getRequestContext(); + RequestParameters requestParams = requestContext.getRequestParameters(); + String requestId = requestContext.getMsoRequestId(); + + ServiceInstance serviceInstance = bb.getCustomer().getServiceSubscription().getServiceInstances().get(0); + Customer customer = bb.getCustomer(); + + String timeout = execution.getVariable("timeout"); + if(isBlank(timeout)){ + timeout = env.getProperty("sniro.manager.timeout", "PT30M"); + } + + SniroManagerRequest request = new SniroManagerRequest(); //TODO Add additional pojos for each section + + JSONObject requestInfo = buildRequestInfo(requestId, timeout); + request.setRequestInformation(requestInfo.toString()); + + JSONObject serviceInfo = buildServiceInfo(serviceInstance); + request.setServiceInformation(serviceInfo.toString()); + + JSONObject placementInfo = buildPlacementInfo(customer, requestParams); + + JSONArray placementDemands = buildPlacementDemands(serviceInstance); + placementInfo.put("placementDemands", placementDemands); + request.setPlacementInformation(placementInfo.toString()); + + JSONArray licenseDemands = buildLicenseDemands(serviceInstance); + request.setLicenseInformation(licenseDemands.toString()); + + if(placementDemands.length() > 0 || licenseDemands.length() > 0){ + client.postDemands(request); + }else{ + log.debug(SERVICE_MISSING_DATA + "resources eligible for homing or licensing"); + throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "resources eligible for homing or licensing"); + } + + //Variables for ReceiveWorkflowMessage subflow + execution.setVariable("asyncCorrelator", requestId); + execution.setVariable("asyncMessageType", "SNIROResponse"); + execution.setVariable("asyncTimeout", timeout); + + log.trace("Completed Sniro Homing Call Sniro"); + }catch(BpmnError e){ + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage()); + }catch(BadResponseException e){ + exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage()); + }catch(Exception e){ + exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while preparing sniro request: " + e.getMessage()); + } + } + + /** + * Validates, processes, and sets the homing and licensing solutions that are returned by + * sniro manager + * + * @param execution + * @param asyncResponse + */ + public void processSolution(BuildingBlockExecution execution, String asyncResponse){ + log.trace("Started Sniro Homing Process Solution"); + try{ + //TODO improve handling multiple solutions but is dependent on sniro enhancing api + work with sniro conductor to improve "inventoryType" representation + validateSolution(asyncResponse); + ServiceInstance serviceInstance = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0); + + log.debug("Processing sniro manager asyncronous response"); + JSONObject response = new JSONObject(asyncResponse); + if(response.has(SOLUTIONS)){ + JSONObject allSolutions = response.getJSONObject(SOLUTIONS); + if(allSolutions.has("placementSolutions")){ + JSONArray placementSolutions = allSolutions.getJSONArray("placementSolutions"); + for(int i = 0; i < placementSolutions.length(); i++){ + JSONArray placements = placementSolutions.getJSONArray(i); + processPlacementSolution(serviceInstance, placements, i); + } + } + if(allSolutions.has("licenseSolutions")){ + JSONArray licenseSolutions = allSolutions.getJSONArray("licenseSolutions"); + if(licenseSolutions.length() > 0){ + processLicenseSolution(serviceInstance, licenseSolutions); + } + } + }else{ + throw new BpmnError(UNPROCESSABLE, "Sniro Managers response does not contain: " + SOLUTIONS); + } + + execution.setVariable("generalBuildingBlock", execution.getGeneralBuildingBlock()); + + log.trace("Completed Sniro Homing Process Solution"); + }catch(BpmnError e){ + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage()); + }catch(BadResponseException e){ + exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage()); + }catch(Exception e){ + exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage()); + } + } + + /** + * Builds the request information section for the homing/licensing request + * + * @throws Exception + */ + private JSONObject buildRequestInfo(String requestId, String timeout) throws Exception{ + log.trace("Building request information"); + JSONObject requestInfo = new JSONObject(); + if(requestId != null){ + String host = env.getProperty("mso.workflow.message.endpoint"); + String callbackUrl = host + "/" + UriUtils.encodePathSegment("SNIROResponse", "UTF-8") + "/" + UriUtils.encodePathSegment(requestId, "UTF-8"); + + Duration d = Duration.parse(timeout); + long timeoutSeconds = d.getSeconds(); + + requestInfo.put("transactionId", requestId).put("requestId", requestId).put("callbackUrl", callbackUrl).put("sourceId", "mso").put("requestType", "create") + .put("timeout", timeoutSeconds); + } else{ + throw new BpmnError(UNPROCESSABLE, "Request Context does not contain: requestId"); + } + return requestInfo; + } + + /** + * Builds the request information section for the homing/licensing request + * + */ + private JSONObject buildServiceInfo(ServiceInstance serviceInstance){ + log.trace("Building service information"); + JSONObject info = new JSONObject(); + ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance(); + if(isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())){ + info.put("serviceInstanceId", serviceInstance.getServiceInstanceId()); + if(modelInfo.getServiceType() != null){ //temp solution + info.put("serviceName", serviceInstance.getModelInfoServiceInstance().getServiceType()); + } + info.put("modelInfo", buildModelInfo(serviceInstance.getModelInfoServiceInstance())); + }else{ + throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + MODEL_VERSION_ID + ", " + MODEL_INVARIANT_ID); + } + return info; + } + + /** + * Builds initial section of placement info for the homing/licensing request + * + */ + private JSONObject buildPlacementInfo(Customer customer, RequestParameters requestParams){ + JSONObject placementInfo = new JSONObject(); + if(customer != null){ + log.debug("Adding subscriber to placement information"); + placementInfo.put("subscriberInfo", new JSONObject().put("globalSubscriberId", customer.getGlobalCustomerId()).put("subscriberName", customer.getSubscriberName()).put("subscriberCommonSiteId", customer.getSubscriberCommonSiteId())); + if(requestParams != null){ + log.debug("Adding request parameters to placement information"); + placementInfo.put("requestParameters", new JSONObject(requestParams.toJsonString())); + } + }else{ + throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "customer"); + } + return placementInfo; + + } + + /** + * Builds the placement demand list for the homing/licensing request + * + */ + private JSONArray buildPlacementDemands(ServiceInstance serviceInstance){ + log.trace("Building placement information demands"); + JSONArray placementDemands = new JSONArray(); + + List allottedResourceList = serviceInstance.getAllottedResources(); + if(!allottedResourceList.isEmpty()){ + log.debug("Adding allotted resources to placement demands list"); + for(AllottedResource ar : allottedResourceList){ + if(isBlank(ar.getId())){ + ar.setId(UUID.randomUUID().toString()); + } + JSONObject demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource()); + addCandidates(ar, demand); + placementDemands.put(demand); + } + } + List vpnBondingLinkList = serviceInstance.getVpnBondingLinks(); + if(!vpnBondingLinkList.isEmpty()){ + log.debug("Adding vpn bonding links to placement demands list"); + for(VpnBondingLink vbl:vpnBondingLinkList){ + List serviceProxyList = vbl.getServiceProxies(); + for(ServiceProxy sp : serviceProxyList){ + if(isBlank(sp.getId())){ + sp.setId(UUID.randomUUID().toString()); + } + JSONObject demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy()); + addCandidates(sp, demand); + placementDemands.put(demand); + } + } + } + return placementDemands; + } + + /** + * Builds the license demand list for the homing/licensing request + * + */ + private JSONArray buildLicenseDemands(ServiceInstance serviceInstance){ + log.trace("Building license information"); + JSONArray licenseDemands = new JSONArray(); + List vnfList = serviceInstance.getVnfs(); + if(!vnfList.isEmpty()){ + log.debug("Adding vnfs to license demands list"); + for(GenericVnf vnf : vnfList){ + JSONObject demand = buildDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf()); + licenseDemands.put(demand); + } + } + return licenseDemands; + } + + /** + * Builds a single demand object + * + */ + private JSONObject buildDemand(String id, ModelInfoMetadata metadata){ + log.debug("Building demand for service or resource: " + id); + JSONObject demand = new JSONObject(); + if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){ + demand.put(SERVICE_RESOURCE_ID, id); + demand.put(RESOURCE_MODULE_NAME, metadata.getModelInstanceName()); + demand.put(RESOURCE_MODEL_INFO, buildModelInfo(metadata)); + }else{ + throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName"); + } + return demand; + } + + /** + * Builds the resource model info section + * + */ + private JSONObject buildModelInfo(ModelInfoMetadata metadata){ + JSONObject object = new JSONObject(); + String invariantUuid = metadata.getModelInvariantUuid(); + String modelUuid = metadata.getModelUuid(); + if(isNotBlank(invariantUuid) && isNotBlank(modelUuid)){ + object.put(MODEL_INVARIANT_ID, invariantUuid).put(MODEL_VERSION_ID, modelUuid).put(MODEL_NAME, metadata.getModelName()).put(MODEL_VERSION, metadata.getModelVersion()); + }else if(isNotBlank(invariantUuid)){ + throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_VERSION_ID); + }else{ + throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_INVARIANT_ID); + } + return object; + } + + /** + * Adds required, excluded, and existing candidates to a demand + * + */ + private void addCandidates(SolutionCandidates candidates, JSONObject demand){ + List required = candidates.getRequiredCandidates(); + List excluded = candidates.getExcludedCandidates(); + if(!required.isEmpty()){ + demand.put("requiredCandidates", required); + } + if(!excluded.isEmpty()){ + demand.put("excludedCandidates", excluded); + } + //TODO support existing candidates + } + + /** + * Processes the license solutions and sets to the corresponding generic vnf + * + */ + private void processLicenseSolution(ServiceInstance serviceInstance, JSONArray licenseSolutions){ + List vnfs = serviceInstance.getVnfs(); + + log.debug("Processing the license solution"); + for(int i = 0; i < licenseSolutions.length(); i++){ + JSONObject licenseSolution = licenseSolutions.getJSONObject(i); + for(GenericVnf vnf:vnfs){ + if(licenseSolution.getString(SERVICE_RESOURCE_ID).equals(vnf.getVnfId())){ + License license = new License(); + JSONArray entitlementPools = licenseSolution.getJSONArray("entitlementPoolUUID"); + List entitlementPoolsList = jsonUtils.StringArrayToList(entitlementPools); + license.setEntitlementPoolUuids(entitlementPoolsList); + JSONArray licenseKeys = licenseSolution.getJSONArray("licenseKeyGroupUUID"); + List licenseKeysList = jsonUtils.StringArrayToList(licenseKeys); + license.setLicenseKeyGroupUuids(licenseKeysList); + + vnf.setLicense(license); + } + } + } + } + + /** + * Processes a placement solution list then correlates and sets each placement solution + * to its corresponding resource + * + */ + private void processPlacementSolution(ServiceInstance serviceInstance, JSONArray placements, int i){ + List links = serviceInstance.getVpnBondingLinks(); + List allottes = serviceInstance.getAllottedResources(); + List vnfs = serviceInstance.getVnfs(); + + log.debug("Processing placement solution " + i+1); + for(int p = 0; p < placements.length(); p++){ + JSONObject placement = placements.getJSONObject(p); + SolutionInfo solutionInfo = new SolutionInfo(); + solutionInfo.setSolutionId(i + 1); + search: { + for(VpnBondingLink vbl:links){ + List proxies = vbl.getServiceProxies(); + for(ServiceProxy sp:proxies){ + if(placement.getString(SERVICE_RESOURCE_ID).equals(sp.getId())){ + if(i > 0){ + if(p % 2 == 0){ + VpnBondingLink vblNew = (VpnBondingLink) SerializationUtils.clone(vbl); + vblNew.setVpnBondingLinkId(UUID.randomUUID().toString()); + links.add(vblNew); + } + links.get(links.size() - 1).getServiceProxy(sp.getId()).setServiceInstance(setSolution(solutionInfo, placement)); + }else{ + sp.setServiceInstance(setSolution(solutionInfo, placement)); + } + break search; + } + } + } + for(AllottedResource ar:allottes){ + if(placement.getString(SERVICE_RESOURCE_ID).equals(ar.getId())){ + ar.setParentServiceInstance(setSolution(solutionInfo, placement)); + break search; + } + } + for(GenericVnf vnf:vnfs){ + if(placement.getString(SERVICE_RESOURCE_ID).equals(vnf.getVnfId())){ + ServiceInstance si = setSolution(solutionInfo, placement); + serviceInstance.setSolutionInfo(si.getSolutionInfo()); + serviceInstance.getVnfs().add(si.getVnfs().get(0)); + break search; + } + } + } + } + } + + + /** + * Creates and sets necessary pojos with placement solution data for a given demand + * + */ + private ServiceInstance setSolution(SolutionInfo solutionInfo, JSONObject placement){ + log.debug("Mapping placement solution"); + String invalidMessage = "Sniro Managers Response contains invalid: "; + + JSONObject solution = placement.getJSONObject("solution"); + String identifierType = solution.getString(IDENTIFIER_TYPE); + List identifiersList = jsonUtils.StringArrayToList(solution.getJSONArray("identifiers").toString()); + String identifierValue = identifiersList.get(0); + + JSONArray assignments = placement.getJSONArray("assignmentInfo"); + Map assignmentsMap = jsonUtils.entryArrayToMap(assignments.toString(), "key", "value"); + solutionInfo.setRehome(Boolean.parseBoolean(assignmentsMap.get("isRehome"))); + String type = placement.getString(INVENTORY_TYPE); + + ServiceInstance si = new ServiceInstance(); + CloudRegion cloud = setCloud(assignmentsMap); + if(type.equals("service")){ + if(identifierType.equals(CandidateType.SERVICE_INSTANCE_ID.toString())){ + solutionInfo.setHomed(true); + si.setServiceInstanceId(identifierValue); + si.setOrchestrationStatus(OrchestrationStatus.CREATED); + cloud.setLcpCloudRegionId(assignmentsMap.get("cloudRegionId")); + if(assignmentsMap.containsKey("vnfHostName")){ + log.debug("Resources has been homed to a vnf"); + GenericVnf vnf = setVnf(assignmentsMap); + vnf.setCloudRegion(cloud); + si.getVnfs().add(vnf); + + }else if(assignmentsMap.containsKey("primaryPnfName")){ + log.debug("Resources has been homed to a pnf"); + Pnf priPnf = setPnf(assignmentsMap, "primary"); + priPnf.setCloudRegion(cloud); + si.getPnfs().add(priPnf); + if(assignmentsMap.containsKey("secondaryPnfName")){ + Pnf secPnf = setPnf(assignmentsMap, "secondary"); + secPnf.setCloudRegion(cloud); + si.getPnfs().add(secPnf); + } + } + }else{ + log.debug(invalidMessage + IDENTIFIER_TYPE); + throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE); + } + }else if(type.equals("cloud")){ + if(identifierType.equals(CandidateType.CLOUD_REGION_ID.toString())){ + log.debug("Resources has been homed to a cloud region"); + cloud.setLcpCloudRegionId(identifierValue); + solutionInfo.setHomed(false); + solutionInfo.setTargetedCloudRegion(cloud); + si.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + }else{ + log.debug(invalidMessage + IDENTIFIER_TYPE); + throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE); + } + }else{ + log.debug(invalidMessage + INVENTORY_TYPE); + throw new BpmnError(UNPROCESSABLE, invalidMessage + INVENTORY_TYPE); + } + si.setSolutionInfo(solutionInfo); + return si; + } + + /** + * Sets the cloud data to a cloud region object + * + */ + private CloudRegion setCloud(Map assignmentsMap){ + CloudRegion cloud = new CloudRegion(); + cloud.setCloudOwner(assignmentsMap.get("cloudOwner")); + cloud.setCloudRegionVersion(assignmentsMap.get("aicVersion")); + cloud.setComplex(assignmentsMap.get("aicClli")); + return cloud; + } + + /** + * Sets the vnf data to a generic vnf object + * + */ + private GenericVnf setVnf(Map assignmentsMap){ + GenericVnf vnf = new GenericVnf(); + vnf.setOrchestrationStatus(OrchestrationStatus.CREATED); + vnf.setVnfName(assignmentsMap.get("vnfHostName")); + vnf.setVnfId(assignmentsMap.get("vnfId")); + return vnf; + } + + /** + * Sets the pnf data to a pnf object + * + */ + private Pnf setPnf(Map assignmentsMap, String role){ + Pnf pnf = new Pnf(); + pnf.setRole(role); + pnf.setOrchestrationStatus(OrchestrationStatus.CREATED); + pnf.setPnfName(assignmentsMap.get(role + "PnfName")); + return pnf; + } + + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java new file mode 100644 index 0000000000..6571971347 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.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.bpmn.infrastructure.aai.tasks; + +import java.util.Optional; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AAICommonTasks { + + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + + public Optional getServiceType(BuildingBlockExecution execution) { + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + + ModelInfoServiceInstance model = serviceInstance.getModelInfoServiceInstance(); + if (model != null) { + return Optional.of(model.getServiceType()); + } + } catch(Exception e) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e); + } + return Optional.empty(); + } + +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java new file mode 100644 index 0000000000..79613047e5 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -0,0 +1,379 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.aai.tasks; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAINetworkResources; +import org.onap.so.client.orchestration.AAIServiceInstanceResources; +import org.onap.so.client.orchestration.AAIVfModuleResources; +import org.onap.so.client.orchestration.AAIVnfResources; +import org.onap.so.client.orchestration.AAIVolumeGroupResources; +import org.onap.so.client.orchestration.AAIVpnBindingResources; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AAICreateTasks { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAICreateTasks.class); + private static final String networkTypeProvider = "PROVIDER"; + private static String NETWORK_COLLECTION_NAME = "networkCollectionName"; + @Autowired + private AAIServiceInstanceResources aaiSIResources; + @Autowired + private AAIVnfResources aaiVnfResources; + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private AAIVolumeGroupResources aaiVolumeGroupResources; + @Autowired + private AAIVfModuleResources aaiVfModuleResources; + @Autowired + private AAINetworkResources aaiNetworkResources; + @Autowired + private AAIVpnBindingResources aaiVpnBindingResources; + + public void createServiceInstance(BuildingBlockExecution execution) { + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + Customer customer = execution.getGeneralBuildingBlock().getCustomer(); + aaiSIResources.createServiceInstance(serviceInstance, customer); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void createServiceSubscription(BuildingBlockExecution execution){ + try{ + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, + ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + Customer customer = execution.getGeneralBuildingBlock().getCustomer(); + if (null == customer) { + String errorMessage = "Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: " + + serviceInstance.getServiceInstanceId(); + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, errorMessage, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, errorMessage); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage); + } + aaiSIResources.createServiceSubscription(customer); + } catch (BpmnError ex) { + throw ex; + } + catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void createProject(BuildingBlockExecution execution) { + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + Project project = serviceInstance.getProject(); + if(project != null) { + if (project.getProjectName() == null || "".equals(project.getProjectName())) { + msoLogger.info("ProjectName is null in input. Skipping create project..."); + } else { + aaiSIResources.createProjectandConnectServiceInstance(project, serviceInstance); + } + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void createOwningEntity(BuildingBlockExecution execution) { + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + OwningEntity owningEntity = serviceInstance.getOwningEntity(); + String owningEntityId = owningEntity.getOwningEntityId(); + String owningEntityName = owningEntity.getOwningEntityName(); + if (owningEntityId == null || "".equals(owningEntityId)) { + String msg = "Exception in AAICreateOwningEntity. OwningEntityId is null."; + execution.setVariable("ErrorCreateOEAAI", msg); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } else { + if (aaiSIResources.existsOwningEntity(owningEntity)) { + aaiSIResources.connectOwningEntityandServiceInstance(owningEntity, serviceInstance); + } else { + if (owningEntityName == null || "".equals(owningEntityName)) { + String msg = "Exception in AAICreateOwningEntity. Can't create an owningEntity with no owningEntityName."; + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } else { + if(aaiSIResources.existsOwningEntityName(owningEntityName)){ + String msg = "Exception in AAICreateOwningEntity. Can't create OwningEntity as name already exists in AAI associated with a different owning-entity-id (name must be unique)"; + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + }else{ + aaiSIResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance); + } + } + } + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void createVnf(BuildingBlockExecution execution) { + try { + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + execution.setVariable("callHoming", vnf.isCallHoming()); + aaiVnfResources.createVnfandConnectServiceInstance(vnf, serviceInstance); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void createPlatform(BuildingBlockExecution execution) { + try { + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + Platform platform = vnf.getPlatform(); + if(platform != null) { + if (platform.getPlatformName() == null || "".equals(platform.getPlatformName())) { + msoLogger.debug("PlatformName is null in input. Skipping create platform..."); + } else { + aaiVnfResources.createPlatformandConnectVnf(platform,vnf); + } + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + + } + + public void createLineOfBusiness(BuildingBlockExecution execution) { + try { + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + LineOfBusiness lineOfBusiness = vnf.getLineOfBusiness(); + if(lineOfBusiness != null) { + if (lineOfBusiness.getLineOfBusinessName() == null || "".equals(lineOfBusiness.getLineOfBusinessName())) { + msoLogger.info("lineOfBusiness is null in input. Skipping create lineOfBusiness..."); + } else { + aaiVnfResources.createLineOfBusinessandConnectVnf(lineOfBusiness,vnf); + } + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void createVolumeGroup(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + aaiVolumeGroupResources.createVolumeGroup(volumeGroup, cloudRegion); + aaiVolumeGroupResources.connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion); + aaiVolumeGroupResources.connectVolumeGroupToTenant(volumeGroup,cloudRegion); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void createVfModule(BuildingBlockExecution execution) { + try { + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + aaiVfModuleResources.createVfModule(vfModule, vnf); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to establish relationships in AAI + * @param execution + * @throws Exception + */ + public void connectVfModuleToVolumeGroup(BuildingBlockExecution execution) { + try { + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + VolumeGroup volumeGroup = null; + try{ + volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + } catch (BBObjectNotFoundException e){ + msoLogger.info("VolumeGroup not found. Skipping Connect between VfModule and VolumeGroup"); + } + if (volumeGroup != null) { + aaiVfModuleResources.connectVfModuleToVolumeGroup(vnf, vfModule, volumeGroup, execution.getGeneralBuildingBlock().getCloudRegion()); + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to execute Create L3Network operation (PUT )in AAI + * @param execution + * @throws Exception + */ + public void createNetwork(BuildingBlockExecution execution) { + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + //set default to false. ToBe updated by SDNC + l3network.setIsBoundToVpn(false); + //define is bound to vpn flag as true if NEUTRON_NETWORK_TYPE is PROVIDER + if (l3network.getModelInfoNetwork().getNeutronNetworkType().equalsIgnoreCase(networkTypeProvider)) + l3network.setIsBoundToVpn(true); + //put network shell in AAI + aaiNetworkResources.createNetworkConnectToServiceInstance(l3network, serviceInstance); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + public void createCustomer(BuildingBlockExecution execution) throws Exception { + try { + Customer customer = execution.getGeneralBuildingBlock().getCustomer(); + + aaiVpnBindingResources.createCustomer(customer); + } catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to execute NetworkCollection operation (PUT) in AAI + * @param execution + * @throws Exception + */ + public void createNetworkCollection(BuildingBlockExecution execution) { + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + Collection networkCollection = serviceInstance.getCollection(); + //pass name generated for NetworkCollection/NetworkCollectionInstanceGroup in previous step of the BB flow + //put shell in AAI + networkCollection.setName(execution.getVariable(NETWORK_COLLECTION_NAME)); + aaiNetworkResources.createNetworkCollection(networkCollection); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to execute NetworkCollectionInstanceGroup operation (PUT) in AAI + * @param execution + * @throws Exception + */ + public void createNetworkCollectionInstanceGroup(BuildingBlockExecution execution) { + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + InstanceGroup instanceGroup = serviceInstance.getCollection().getInstanceGroup(); + //set name generated for NetworkCollection/NetworkCollectionInstanceGroup in previous step of the BB flow + instanceGroup.setInstanceGroupName(execution.getVariable(NETWORK_COLLECTION_NAME)); + //put shell in AAI + aaiNetworkResources.createNetworkInstanceGroup(instanceGroup); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + + /** + * BPMN access method to establish relationships in AAI + * @param execution + * @throws Exception + */ + public void connectNetworkToTenant(BuildingBlockExecution execution) { + try { + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + aaiNetworkResources.connectNetworkToTenant(l3network, execution.getGeneralBuildingBlock().getCloudRegion()); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to establish relationships in AAI + * @param execution + * @throws Exception + */ + public void connectNetworkToCloudRegion(BuildingBlockExecution execution) { + try { + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + aaiNetworkResources.connectNetworkToCloudRegion(l3network, execution.getGeneralBuildingBlock().getCloudRegion()); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to establish relationships in AAI + * @param execution + * @throws Exception + */ + public void connectNetworkToNetworkCollectionServiceInstance(BuildingBlockExecution execution) { + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + aaiNetworkResources.connectNetworkToNetworkCollectionServiceInstance(l3network, serviceInstance); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to establish relationships in AAI + * @param execution + * @throws Exception + */ + public void connectNetworkToNetworkCollectionInstanceGroup(BuildingBlockExecution execution) { + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + //connect network only if Instance Group / Collection objects exist + if (serviceInstance.getCollection() != null && serviceInstance.getCollection().getInstanceGroup() != null) + aaiNetworkResources.connectNetworkToNetworkCollectionInstanceGroup(l3network, serviceInstance.getCollection().getInstanceGroup()); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java new file mode 100644 index 0000000000..cb265b6e41 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java @@ -0,0 +1,136 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.aai.tasks; + + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAINetworkResources; +import org.onap.so.client.orchestration.AAIServiceInstanceResources; +import org.onap.so.client.orchestration.AAIVfModuleResources; +import org.onap.so.client.orchestration.AAIVnfResources; +import org.onap.so.client.orchestration.AAIVolumeGroupResources; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AAIDeleteTasks { + + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private AAIServiceInstanceResources aaiSIResources; + @Autowired + private AAIVnfResources aaiVnfResources; + @Autowired + private AAIVfModuleResources aaiVfModuleResources; + @Autowired + private AAINetworkResources aaiNetworkResources; + @Autowired + private AAIVolumeGroupResources aaiVolumeGroupResources; + + public void deleteVfModule(BuildingBlockExecution execution) throws Exception { + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + + execution.setVariable("aaiVfModuleRollback", false); + try { + aaiVfModuleResources.deleteVfModule(vfModule, genericVnf); + execution.setVariable("aaiVfModuleRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void deleteVnf(BuildingBlockExecution execution) throws Exception { + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + + execution.setVariable("aaiVnfRollback", false); + try { + aaiVnfResources.deleteVnf(genericVnf); + execution.setVariable("aaiVnfRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void deleteServiceInstance(BuildingBlockExecution execution) throws Exception { + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + aaiSIResources.deleteServiceInstance(serviceInstance); + } + catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + + } + + public void deleteNetwork(BuildingBlockExecution execution) throws Exception { + try { + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + aaiNetworkResources.deleteNetwork(l3network); + execution.setVariable("isRollbackNeeded", true); + } + catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void deleteCollection(BuildingBlockExecution execution) throws Exception { + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + aaiNetworkResources.deleteCollection(serviceInstance.getCollection()); + } + catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void deleteInstanceGroup(BuildingBlockExecution execution) throws Exception { + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + aaiNetworkResources.deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup()); + } + catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void deleteVolumeGroup(BuildingBlockExecution execution) { + try { + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion(); + aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java new file mode 100644 index 0000000000..53d0e0a45c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.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.bpmn.infrastructure.aai.tasks; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIVfModuleResources; +import org.onap.so.client.orchestration.AAIVnfResources; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AAIFlagTasks { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIFlagTasks.class); + + @Autowired + private AAIVnfResources aaiVnfResources; + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + + public void checkVnfInMaintFlag(BuildingBlockExecution execution) { + boolean inMaint = false; + try { + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + String vnfId = vnf.getVnfId(); + inMaint = aaiVnfResources.checkInMaintFlag(vnfId); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + if (inMaint) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VNF is in maintenance in A&AI"); + } + } + + public void modifyVnfInMaintFlag(BuildingBlockExecution execution, boolean inMaint) { + try { + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + + GenericVnf copiedGenericVnf = genericVnf.shallowCopyId(); + + copiedGenericVnf.setInMaint(inMaint); + genericVnf.setInMaint(inMaint); + + aaiVnfResources.updateObjectVnf(copiedGenericVnf); + } catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java new file mode 100644 index 0000000000..beffa25249 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java @@ -0,0 +1,241 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.aai.tasks; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.modelmapper.ModelMapper; +import org.modelmapper.PropertyMap; +import org.onap.aai.domain.yang.NetworkPolicy; +import org.onap.aai.domain.yang.RouteTableReference; +import org.onap.aai.domain.yang.RouteTargets; +import org.onap.aai.domain.yang.VpnBinding; +import org.onap.so.adapters.nwrest.CreateNetworkRequest; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.Relationships; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAINetworkResources; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AAIQueryTasks { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIQueryTasks.class); + private static final String NETWORK_RESULT_WRAPPER_KEY = "l3NetworkAAIResultWrapper"; + private static final String ERROR_MSG = "No relationships were returned from AAIResultWrapper.getRelationships()"; + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private AAINetworkResources aaiNetworkResources; + private static final ModelMapper modelMapper = new ModelMapper(); + + /** + * BPMN access method to query L3Network object in AAI by it's Id + * + * @param execution + * @throws Exception + */ + public void getNetworkWrapperById(BuildingBlockExecution execution) { + try { + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, + execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network); + execution.setVariable(NETWORK_RESULT_WRAPPER_KEY, aaiResultWrapper); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to query data for VPN bindings from the AAI result wrapper. + * The resulting VPN bindings are mapped to the corresponding bbobject and placed in the customer bbobject + * + * @param execution + */ + + public void queryNetworkVpnBinding(BuildingBlockExecution execution) { + try { + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + + AAIResultWrapper aaiResultWrapper = execution.getVariable(NETWORK_RESULT_WRAPPER_KEY); + Optional networkRelationships = aaiResultWrapper.getRelationships(); + if (!networkRelationships.isPresent()) { + throw (new Exception(ERROR_MSG)); + } + List netBindingsUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING); + + List mappedVpnBindings = new ArrayList<>(); + if(netBindingsUriList != null && !netBindingsUriList.isEmpty()) { + for(AAIResourceUri netBindingUri : netBindingsUriList) { + Optional oVpnBinding = aaiNetworkResources.getVpnBinding(netBindingUri); + if(oVpnBinding.isPresent()) { + org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding mappedVpnBinding = + modelMapper.map(oVpnBinding.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding.class); + if (oVpnBinding.get().getRouteTargets() != null){ + mappedVpnBinding.getRouteTargets().addAll(mapRouteTargets(oVpnBinding.get().getRouteTargets().getRouteTarget())); + mappedVpnBindings.add(mappedVpnBinding); + } + } + } + } + execution.getGeneralBuildingBlock().getCustomer().getVpnBindings().addAll(mappedVpnBindings); + } catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to extract VPN Binding data from AAI result and populate proper fields into CreateNetworkRequest + */ + public void getNetworkVpnBinding(BuildingBlockExecution execution) { + + try { + AAIResultWrapper aaiResultWrapper = execution.getVariable(NETWORK_RESULT_WRAPPER_KEY); + CreateNetworkRequest createNetworkRequest = execution.getVariable("createNetworkRequest"); + + Optional networkRelationships = aaiResultWrapper.getRelationships(); + if (!networkRelationships.isPresent()) { + throw (new Exception(ERROR_MSG)); + } + List netBindingsUriList = networkRelationships.get() + .getRelatedAAIUris(AAIObjectType.VPN_BINDING); + List routeTargets = new ArrayList<>(); + for (AAIResourceUri netBindingUri : netBindingsUriList) { + msoLogger.info("Get Route Targests"); + Optional oVpnBinding = aaiNetworkResources.getVpnBinding(netBindingUri); + if (oVpnBinding.isPresent()) { + VpnBinding vpnBinding = oVpnBinding.get(); + RouteTargets rts = vpnBinding.getRouteTargets(); + if (rts != null) { + List rtList = rts.getRouteTarget(); + if (!rtList.isEmpty()) { + PropertyMap personMap = new PropertyMap() { + @Override + protected void configure() { + map().setRouteTarget(source.getGlobalRouteTarget()); + map(source.getRouteTargetRole(), destination.getRouteTargetRole()); + } + }; + modelMapper.addMappings(personMap); + for (org.onap.aai.domain.yang.RouteTarget rt : rtList) { + org.onap.so.openstack.beans.RouteTarget openstackRtBean = modelMapper.map(rt, + org.onap.so.openstack.beans.RouteTarget.class); + routeTargets.add(openstackRtBean); + } + } + } + } + } + // store route targets data in execution - to be used as part of + // Network adapter input + createNetworkRequest.getContrailNetwork().setRouteTargets(routeTargets); + execution.setVariable("createNetworkRequest", createNetworkRequest); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to query data for network policies from the AAI result wrapper + * From the resulting network policy, the network policy fqdn parameter is added to + * the network bbobject contrail network policy fqdns list + * + * @param execution + */ + public void queryNetworkPolicy(BuildingBlockExecution execution) { + try { + L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + + AAIResultWrapper aaiResultWrapper = execution.getVariable(NETWORK_RESULT_WRAPPER_KEY); + Optional networkRelationships = aaiResultWrapper.getRelationships(); + if (!networkRelationships.isPresent()) { + throw (new Exception(ERROR_MSG)); + } + List netPoliciesUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.NETWORK_POLICY); + + if(!netPoliciesUriList.isEmpty()) { + for(AAIResourceUri netPolicyUri : netPoliciesUriList) { + Optional oNetPolicy = aaiNetworkResources.getNetworkPolicy(netPolicyUri); + if(oNetPolicy.isPresent()) { + l3Network.getNetworkPolicies().add(modelMapper.map(oNetPolicy.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy.class)); + } + } + } + } catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to query data for network table ref from the AAI result wrapper + * The resulting route table reference is mapped to the corresponding bbobject and added + * to the network bbobject contrail network route table references list + * + * @param execution + */ + public void queryNetworkTableRef(BuildingBlockExecution execution) { + try { + L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + + AAIResultWrapper aaiResultWrapper = execution.getVariable(NETWORK_RESULT_WRAPPER_KEY); + Optional networkRelationships = aaiResultWrapper.getRelationships(); + if (!networkRelationships.isPresent()) { + throw (new Exception(ERROR_MSG)); + } + List routeTableUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.ROUTE_TABLE_REFERENCE); + + if(!routeTableUriList.isEmpty()) { + for(AAIResourceUri routeTableUri : routeTableUriList) { + Optional oRouteTableReference = aaiNetworkResources.getRouteTable(routeTableUri); + if(oRouteTableReference.isPresent()) { + org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference mappedRouteTableReference = modelMapper.map(oRouteTableReference.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference.class); + l3Network.getContrailNetworkRouteTableReferences().add(mappedRouteTableReference); + } + } + } + } catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + private List mapRouteTargets(List routeTargets) { + List mappedRouteTargets = new ArrayList<>(); + if(!routeTargets.isEmpty()) { + for(org.onap.aai.domain.yang.RouteTarget routeTarget : routeTargets) { + org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget mappedRouteTarget = modelMapper.map(routeTarget, org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget.class); + mappedRouteTargets.add(mappedRouteTarget); + } + } + return mappedRouteTargets; + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java new file mode 100644 index 0000000000..074652e221 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -0,0 +1,370 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.aai.tasks; + +import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAICollectionResources; +import org.onap.so.client.orchestration.AAINetworkResources; +import org.onap.so.client.orchestration.AAIServiceInstanceResources; +import org.onap.so.client.orchestration.AAIVfModuleResources; +import org.onap.so.client.orchestration.AAIVnfResources; +import org.onap.so.client.orchestration.AAIVolumeGroupResources; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AAIUpdateTasks { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIUpdateTasks.class); + @Autowired + private AAIServiceInstanceResources aaiServiceInstanceResources; + @Autowired + private AAIVnfResources aaiVnfResources; + @Autowired + private AAIVfModuleResources aaiVfModuleResources; + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private AAIVolumeGroupResources aaiVolumeGroupResources; + @Autowired + private AAINetworkResources aaiNetworkResources; + @Autowired + private AAICollectionResources aaiCollectionResources; + + public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) { + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED); + execution.setVariable("aaiServiceInstanceRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateOrchestrationStatusActiveService(BuildingBlockExecution execution) { + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateOrchestrationStatusAssignedVnf(BuildingBlockExecution execution) { + try { + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + aaiVnfResources.updateOrchestrationStatusVnf(vnf,OrchestrationStatus.ASSIGNED); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateOrchestrationStatusActiveVnf(BuildingBlockExecution execution) { + try { + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + aaiVnfResources.updateOrchestrationStatusVnf(vnf,OrchestrationStatus.ACTIVE); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateOrchestrationStatusAssignedVolumeGroup(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + volumeGroup.setHeatStackId(""); + aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateOrchestrationStatusActiveVolumeGroup(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + + aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateOrchestrationStatusCreatedVolumeGroup(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + + aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) { + try { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + vfModule.setHeatStackId(""); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.ASSIGNED); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateOrchestrationStatusPendingActivationVfModule(BuildingBlockExecution execution) { + try { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.PENDING_ACTIVATION); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) { + try { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.CREATED); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) { + execution.setVariable("aaiDeactivateVfModuleRollback", false); + try { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.CREATED); + execution.setVariable("aaiDeactivateVfModuleRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to update status of L3Network to Assigned in AAI + * @param execution + * @throws BBObjectNotFoundException + */ + public void updateOrchestrationStatusAssignedNetwork(BuildingBlockExecution execution) { + execution.setVariable("aaiNetworkAssignRollback", false); + try { + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network copiedl3network = l3network.shallowCopyId(); + + + l3network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + l3network.setHeatStackId(""); + + copiedl3network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + copiedl3network.setHeatStackId(""); + aaiNetworkResources.updateNetwork(copiedl3network); + execution.setVariable("aaiNetworkAssignRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to update status of L3Network to Active in AAI + * @param execution + * @throws BBObjectNotFoundException + */ + public void updateOrchestrationStatusActiveNetwork(BuildingBlockExecution execution) { + execution.setVariable("aaiNetworkActivateRollback", false); + try { + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network copiedl3network = l3network.shallowCopyId(); + + copiedl3network.setOrchestrationStatus(OrchestrationStatus.ACTIVE); + l3network.setOrchestrationStatus(OrchestrationStatus.ACTIVE); + aaiNetworkResources.updateNetwork(copiedl3network); + execution.setVariable("aaiNetworkActivateRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to update status of L3Network to Created in AAI + * @param execution + * @throws BBObjectNotFoundException + */ + public void updateOrchestrationStatusCreatedNetwork(BuildingBlockExecution execution) { + execution.setVariable("aaiNetworkActivateRollback", false); + try { + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network copiedl3network = l3network.shallowCopyId(); + + copiedl3network.setOrchestrationStatus(OrchestrationStatus.CREATED); + l3network.setOrchestrationStatus(OrchestrationStatus.CREATED); + aaiNetworkResources.updateNetwork(copiedl3network); + execution.setVariable("aaiNetworkActivateRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to update status of L3Network Collection to Active in AAI + * @param execution + * @throws BBObjectNotFoundException + */ + public void updateOrchestrationStatusActiveNetworkCollection(BuildingBlockExecution execution) { + execution.setVariable("aaiNetworkCollectionActivateRollback", false); + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + Collection networkCollection = serviceInstance.getCollection(); + Collection copiedNetworkCollection = networkCollection.shallowCopyId(); + + networkCollection.setOrchestrationStatus(OrchestrationStatus.ACTIVE); + copiedNetworkCollection.setOrchestrationStatus(OrchestrationStatus.ACTIVE); + aaiCollectionResources.updateCollection(copiedNetworkCollection); + execution.setVariable("aaiNetworkCollectionActivateRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) { + execution.setVariable("aaiActivateVfModuleRollback", false); + try { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE); + execution.setVariable("aaiActivateVfModuleRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to update L3Network after it was created in AIC + * @param execution + * @throws Exception + */ + public void updateNetworkCreated(BuildingBlockExecution execution) throws Exception { + execution.setVariable("aaiNetworkActivateRollback", false); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network copiedl3network = l3network.shallowCopyId(); + CreateNetworkResponse response = execution.getVariable("createNetworkResponse"); + try { + if(response.getNetworkFqdn()!=null){ + l3network.setContrailNetworkFqdn(response.getNetworkFqdn()); + } + l3network.setOrchestrationStatus(OrchestrationStatus.CREATED); + l3network.setHeatStackId(response.getNetworkStackId()); + l3network.setNeutronNetworkId(response.getNeutronNetworkId()); + + copiedl3network.setContrailNetworkFqdn(response.getNetworkFqdn()); + copiedl3network.setOrchestrationStatus(OrchestrationStatus.CREATED); + copiedl3network.setHeatStackId(response.getNetworkStackId()); + copiedl3network.setNeutronNetworkId(response.getNeutronNetworkId()); + + aaiNetworkResources.updateNetwork(copiedl3network); + execution.setVariable("aaiNetworkActivateRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateObjectNetwork(BuildingBlockExecution execution) { + try { + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + aaiNetworkResources.updateNetwork(l3network); + } catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to update ServiceInstance + * @param execution + */ + public void updateServiceInstance(BuildingBlockExecution execution) { + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + aaiServiceInstanceResources.updateServiceInstance(serviceInstance); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateObjectVnf(BuildingBlockExecution execution) { + try { + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + aaiVnfResources.updateObjectVnf(genericVnf); + } catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateOrchestrationStatusDeleteVfModule(BuildingBlockExecution execution) { + execution.setVariable("aaiDeleteVfModuleRollback", false); + try { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + vfModule.setHeatStackId(""); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + + VfModule copiedVfModule = vfModule.shallowCopyId(); + copiedVfModule.setHeatStackId(""); + aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.ASSIGNED); + execution.setVariable("aaiDeleteVfModuleRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateModelVfModule(BuildingBlockExecution execution) { + try { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + aaiVfModuleResources.changeAssignVfModule(vfModule, vnf); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java new file mode 100644 index 0000000000..bc3845d760 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.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.bpmn.infrastructure.adapter.network.tasks; + +import java.util.Map; +import java.util.Optional; + +import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.NetworkAdapterResources; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class NetworkAdapterCreateTasks { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkAdapterCreateTasks.class); + + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private NetworkAdapterResources networkAdapterResources; + @Autowired + private ExceptionBuilder exceptionUtil; + + + + public void createNetwork(BuildingBlockExecution execution) { + execution.setVariable("networkAdapterCreateRollback", false); + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + + Map userInput = gBBInput.getUserInput(); + String cloudRegionPo = execution.getVariable("cloudRegionPo"); + Optional oCreateNetworkResponse = networkAdapterResources.createNetwork(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, userInput, cloudRegionPo, gBBInput.getCustomer()); + + if (oCreateNetworkResponse.isPresent()){ + CreateNetworkResponse createNetworkResponse = oCreateNetworkResponse.get(); + l3Network.setHeatStackId(createNetworkResponse.getNetworkStackId()); + if (createNetworkResponse.getNetworkCreated()){ + //setting rollback TRUE only if network was actually created (not a silent success OP) + execution.setVariable("createNetworkResponse", createNetworkResponse); + execution.setVariable("networkAdapterCreateRollback", true); + } + } + + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void rollbackCreateNetwork(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + CreateNetworkResponse createNetworkResponse = execution.getVariable("createNetworkResponse"); + + Map userInput = gBBInput.getUserInput(); + String cloudRegionPo = execution.getVariable("cloudRegionPo"); + networkAdapterResources.rollbackCreateNetwork(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse); + + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java new file mode 100644 index 0000000000..0f0f73ddf1 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.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.bpmn.infrastructure.adapter.network.tasks; + +import java.util.Optional; + +import org.onap.so.adapters.nwrest.DeleteNetworkResponse; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.NetworkAdapterResources; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class NetworkAdapterDeleteTasks { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkAdapterDeleteTasks.class); + + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private NetworkAdapterResources networkAdapterResources; + @Autowired + private ExceptionBuilder exceptionUtil; + + public void deleteNetwork(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + + L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + + Optional oDeleteNetworkResponse = networkAdapterResources.deleteNetwork(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, l3Network); + + if (oDeleteNetworkResponse.isPresent()){ + DeleteNetworkResponse deleteNetworkResponse = oDeleteNetworkResponse.get(); + if (deleteNetworkResponse.getNetworkDeleted()) { + execution.setVariable("deleteNetworkResponse", deleteNetworkResponse); + } + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java new file mode 100644 index 0000000000..ef2cf86f01 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java @@ -0,0 +1,64 @@ +/*- + * ============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.bpmn.infrastructure.adapter.network.tasks; + +import java.util.Optional; + +import org.onap.so.adapters.nwrest.UpdateNetworkResponse; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.NetworkAdapterResources; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class NetworkAdapterUpdateTasks { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkAdapterUpdateTasks.class); + + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private NetworkAdapterResources networkAdapterResources; + @Autowired + private ExceptionBuilder exceptionUtil; + + public void updateNetwork(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + Optional oUpdateNetworkResponse = networkAdapterResources.updateNetwork(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, gBBInput.getUserInput(), gBBInput.getCustomer()); + + if(oUpdateNetworkResponse.isPresent()) { + UpdateNetworkResponse updateNetworkResponse = oUpdateNetworkResponse.get(); + execution.setVariable("NetworkAdapterUpdateNetworkResponse", updateNetworkResponse); + } + } catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java new file mode 100644 index 0000000000..69fc633bbd --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.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.bpmn.infrastructure.adapter.vnf.tasks; + +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.VnfAdapterVfModuleResources; +import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class VnfAdapterCreateTasks { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterCreateTasks.class); + private static final String VNFREST_REQUEST = "VNFREST_Request"; + + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources; + @Autowired + private VnfAdapterVfModuleResources vnfAdapterVfModuleResources; + @Autowired + private ExceptionBuilder exceptionUtil; + + public void createVolumeGroupRequest(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + + ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0); + + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + VfModule vfModule; + String sdncVfModuleQueryResponse = null; + try { + vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + if(vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { + sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()); + } + else { + throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value"); + } + } catch(BBObjectNotFoundException bbException) { + // If there is not a vf module in the general building block (in aLaCarte case), we will not retrieve the SDNCQueryResponse and proceed as normal without throwing an error + } + + CreateVolumeGroupRequest createVolumeGroupRequest = vnfAdapterVolumeGroupResources.createVolumeGroupRequest(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse); + execution.setVariable(VNFREST_REQUEST, createVolumeGroupRequest.toXmlString()); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + + public void createVfModule(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + + ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + RequestContext requestContext = gBBInput.getRequestContext(); + OrchestrationContext orchestrationContext = gBBInput.getOrchContext(); + String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()); + String sdncVnfQueryResponse = execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId()); + + CreateVfModuleRequest createVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + execution.setVariable(VNFREST_REQUEST, createVfModuleRequest.toXmlString()); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java new file mode 100644 index 0000000000..6ec9007cd0 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.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.bpmn.infrastructure.adapter.vnf.tasks; + +import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.VnfAdapterVfModuleResources; +import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class VnfAdapterDeleteTasks { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterDeleteTasks.class); + private static final String VNFREST_REQUEST = "VNFREST_Request"; + + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources; + @Autowired + private VnfAdapterVfModuleResources vnfAdapterVfModuleResources; + @Autowired + private ExceptionBuilder exceptionUtil; + + public void deleteVolumeGroup(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + + vnfAdapterVolumeGroupResources.deleteVolumeGroup(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, volumeGroup); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void deleteVfModule(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + + DeleteVfModuleRequest deleteVfModuleRequest = vnfAdapterVfModuleResources.deleteVfModuleRequest( gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, genericVnf, vfModule); + execution.setVariable(VNFREST_REQUEST, deleteVfModuleRequest.toXmlString()); + execution.setVariable("deleteVfModuleRequest", "true"); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java new file mode 100644 index 0000000000..aa865f0340 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java @@ -0,0 +1,126 @@ +/*- + * ============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.bpmn.infrastructure.adapter.vnf.tasks; + +import org.apache.commons.lang3.StringUtils; +import org.onap.so.adapters.vnfrest.CreateVfModuleResponse; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.exceptions.MarshallerException; +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 org.xml.sax.InputSource; +import org.xml.sax.XMLReader; + +import javax.xml.XMLConstants; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Unmarshaller; +import javax.xml.parsers.SAXParserFactory; +import javax.xml.transform.sax.SAXSource; +import java.io.StringReader; + +@Component +public class VnfAdapterImpl { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterCreateTasks.class); + + @Autowired + private ExtractPojosForBB extractPojosForBB; + + @Autowired + private ExceptionBuilder exceptionUtil; + + public void preProcessVnfAdapter(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + + execution.setVariable("isDebugLogEnabled", "true"); + execution.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId()); + execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId()); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void postProcessVnfAdapter(BuildingBlockExecution execution) { + try { + String vnfAdapterResponse = execution.getVariable("vnfAdapterRestV1Response"); + if (!StringUtils.isEmpty( vnfAdapterResponse)) { + Object vnfRestResponse = unMarshal(vnfAdapterResponse); + if(vnfRestResponse instanceof CreateVfModuleResponse) { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + String heatStackId = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleStackId(); + if(!StringUtils.isEmpty(heatStackId)) { + vfModule.setHeatStackId(heatStackId); + } + } else if(vnfRestResponse instanceof DeleteVfModuleResponse) { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + Boolean vfModuleDelete = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleDeleted(); + if(null!= vfModuleDelete && vfModuleDelete) { + vfModule.setHeatStackId(null); + } + } else if(vnfRestResponse instanceof CreateVolumeGroupResponse) { + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + String heatStackId = ((CreateVolumeGroupResponse) vnfRestResponse).getVolumeGroupStackId(); + if(!StringUtils.isEmpty(heatStackId)) { + volumeGroup.setHeatStackId(heatStackId); + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "HeatStackId is missing from create VolumeGroup Vnf Adapter response."); + } + } + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + private Object unMarshal(String input) throws MarshallerException { + try { + SAXParserFactory spf = SAXParserFactory.newInstance(); + spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + spf.setFeature("http://xml.org/sax/features/external-general-entities", false); + spf.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + spf.setNamespaceAware(true); + XMLReader xmlReader = spf.newSAXParser().getXMLReader(); + + JAXBContext jaxbContext = JAXBContext.newInstance(CreateVfModuleResponse.class, + CreateVolumeGroupResponse.class,DeleteVfModuleResponse.class); + Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); + + InputSource inputSource = new InputSource(new StringReader(input)); + SAXSource source = new SAXSource(xmlReader, inputSource); + return jaxbUnmarshaller.unmarshal(source); + } catch (Exception e) { + msoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "", "", MsoLogger.ErrorCode.SchemaError, e.getMessage(), e); + throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(), MsoLogger.ErrorCode.SchemaError.getValue(), e); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java new file mode 100644 index 0000000000..06c65020f5 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.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.bpmn.infrastructure.flowspecific.tasks; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AssignNetwork { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, + AssignNetwork.class); + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + + /** + * Check if there are collection(s) + * @param execution + * @return boolean + */ + public boolean hasCollection(BuildingBlockExecution execution) { + boolean hasCollection = false; + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, + execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + if (serviceInstance.getCollection() != null){ + hasCollection = true; + msoLogger.debug("there are collections to create"); + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + return hasCollection; + } + + /** + * Check if network was found by name + * @param execution + * @return + */ + public boolean networkFoundByName(BuildingBlockExecution execution) { + boolean networkFound = false; + try { + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, + execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + + if (!OrchestrationStatus.PRECREATED.equals(l3network.getOrchestrationStatus())){ + networkFound = true; + msoLogger.debug("network found in NOT PRECREATED status"); + } + } catch (Exception ex) { + // return false if no network present + } + return networkFound; + } + + /** + * BPMN access method. Return flag if BPMN flow should skip AAI interaction + * @param execution + * @return TRUE if network collection was NOT present OR network WAS found by name + */ + public boolean skipNetworkCreationInAAI(BuildingBlockExecution execution) { + + return !hasCollection(execution) || networkFoundByName(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java new file mode 100644 index 0000000000..6217f87420 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java @@ -0,0 +1,99 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.flowspecific.tasks; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAINetworkResources; +import org.onap.so.client.orchestration.SDNCNetworkResources; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AssignNetworkBBUtils { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, + AssignNetworkBBUtils.class); + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private AAINetworkResources aaiNetworkResources; + @Autowired + private SDNCNetworkResources sdncNetworkResources; + @Autowired + private ExtractPojosForBB extractPojosForBB; + + /** + * BPMN access method. Verify if network name was provided as input to BB + * @param execution + * @return + */ + public boolean networkFoundByName(BuildingBlockExecution execution) throws Exception { + boolean found = false; + //TODO - populate logic after iTrack MSO-2143 implemented + return found; + } + + /** + * BPMN access method to extract Cloud Region data + * @param execution + * @throws Exception + */ + public void getCloudRegion(BuildingBlockExecution execution) { + try{ + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + String cloudRegionSdnc; + String cloudRegionPo = cloudRegion.getLcpCloudRegionId(); + if (cloudRegion.getCloudRegionVersion().equalsIgnoreCase("2.5")){ + cloudRegionSdnc = "AAIAIC25"; + } else { + cloudRegionSdnc = cloudRegionPo; + } + execution.setVariable("cloudRegionPo", cloudRegionPo); + execution.setVariable("cloudRegionSdnc", cloudRegionSdnc); + }catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method. Process silent success scenario + * @param execution + */ + public void processSilentSuccess(BuildingBlockExecution execution) { + String msg = "Silent success processing network assign"; + msoLogger.info(msg); + } + + /** + * BPMN access method. Process silent success scenario + * @param execution + */ + public void failOrchestrationStatus(BuildingBlockExecution execution) { + BpmnError error = new BpmnError("Failed orchestration status verificaiton"); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, error); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java new file mode 100644 index 0000000000..bf429ee4fc --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java @@ -0,0 +1,70 @@ +/*- + * ============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.bpmn.infrastructure.flowspecific.tasks; + +import java.util.List; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.infrastructure.common.name.generation.AAIObjectInstanceNameGenerator; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIInstanceGroupResources; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AssignVnf { + + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private AAIInstanceGroupResources aaiInstanceGroupResources; + @Autowired + private AAIObjectInstanceNameGenerator aaiObjectInstanceNameGenerator; + + + public void createInstanceGroups(BuildingBlockExecution execution) { + try { + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + List instanceGroups = vnf.getInstanceGroups(); + for(InstanceGroup instanceGroup : instanceGroups) { + if(ModelInfoInstanceGroup.TYPE_VNFC.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) { + instanceGroup.setInstanceGroupName(aaiObjectInstanceNameGenerator.generateInstanceGroupName(instanceGroup, vnf)); + aaiInstanceGroupResources.createInstanceGroup(instanceGroup); + aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf); + } + else if(ModelInfoInstanceGroup.TYPE_NETWORK_INSTANCE_GROUP.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) { + aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf); + } + } + } + catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java new file mode 100644 index 0000000000..08d5afcc44 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.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.bpmn.infrastructure.flowspecific.tasks; + +import java.util.Map; + +import org.onap.so.adapters.nwrest.CreateNetworkRequest; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class CreateNetwork { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateNetwork.class); + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private NetworkAdapterObjectMapper networkAdapterObjectMapper; + + /** + * BPMN access method to build CreateNetworkRequest object + * + */ + public void buildCreateNetworkRequest(BuildingBlockExecution execution) throws Exception { + try{ + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + Map userInput = gBBInput.getUserInput(); + String cloudRegionPo = execution.getVariable("cloudRegionPo"); + + CreateNetworkRequest createNetworkRequest = networkAdapterObjectMapper.createNetworkRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, userInput, cloudRegionPo, gBBInput.getCustomer()); + + //set CreateNetowrkRequest object on execution to be re-used within current BB + execution.setVariable("createNetworkRequest", createNetworkRequest); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java new file mode 100644 index 0000000000..222a5482c5 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java @@ -0,0 +1,109 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.flowspecific.tasks; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAINetworkResources; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class CreateNetworkCollection { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateNetworkCollection.class); + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private AAINetworkResources aaiNetworkResources; + + private static final String UNDERSCORE = "_"; + private static final String NETWORK_COLLECTION_NAME = "networkCollectionName"; + + /** + * BPMN access method to build Network Collection Name + * @param execution + * @throws Exception + */ + public void buildNetworkCollectionName(BuildingBlockExecution execution) throws Exception { + try{ + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + InstanceGroup instanceGroup = serviceInstance.getCollection().getInstanceGroup(); + if(instanceGroup.getModelInfoInstanceGroup() != null) { + //Build collection name assembling SI name and IG function + if(serviceInstance.getServiceInstanceName() != null + && instanceGroup.getModelInfoInstanceGroup().getFunction() != null) { + String networkCollectionName = serviceInstance.getServiceInstanceName().concat(UNDERSCORE).concat(instanceGroup.getModelInfoInstanceGroup().getFunction()); + //set networkCollectionName object on execution to be re-used within current BB + execution.setVariable(NETWORK_COLLECTION_NAME, networkCollectionName); + } else { + throw new IllegalArgumentException("Cannot generate collection name because either one or both fields are null: " + + " Service Instance Name: " + serviceInstance.getServiceInstanceName() + + ", Instance Group Function: " + instanceGroup.getModelInfoInstanceGroup().getFunction()); + } + } else { + throw new IllegalArgumentException("Instance group model info is null"); + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to connect Network Collection + * @param execution + * @throws Exception + */ + public void connectCollectionToInstanceGroup(BuildingBlockExecution execution) throws Exception { + execution.setVariable("connectCollectionToInstanceGroupRollback", false); + try{ + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + Collection networkCollection = serviceInstance.getCollection(); + aaiNetworkResources.connectNetworkCollectionInstanceGroupToNetworkCollection(networkCollection.getInstanceGroup(), networkCollection); + execution.setVariable("connectCollectionToInstanceGroupRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to connect Network Collection + * @param execution + * @throws Exception + */ + public void connectCollectionToServiceInstance(BuildingBlockExecution execution) throws Exception { + execution.setVariable("connectCollectionToServiceInstanceRollback", false); + try{ + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + Collection networkCollection = serviceInstance.getCollection(); + aaiNetworkResources.connectNetworkCollectionToServiceInstance(networkCollection, serviceInstance); + execution.setVariable("connectCollectionToServiceInstanceRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java new file mode 100644 index 0000000000..7051da150f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java @@ -0,0 +1,77 @@ +/*- + * ============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.bpmn.infrastructure.flowspecific.tasks; + +import java.util.List; +import java.util.Optional; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.logger.MsoLogger; +import org.springframework.stereotype.Component; + +@Component +public class NetworkBBUtils { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkBBUtils.class); + + private static final String CLOUD_REGION_VER25 = "2.5"; + private static final String CLOUD_REGION_AAIAIC25 = "AAIAIC25"; + + /** + * BPMN access method to check if Relationship's Related-To value exists. + * + * @param l3Network - L3Network object + * @param relatedToValue - String, ex: 'vf-module' + * @return boolean + */ + public boolean isRelationshipRelatedToExists(Optional l3network, String relatedToValue) { + boolean isRelatedToExists = false; + if (l3network.isPresent()) { + List relationshipList = l3network.get().getRelationshipList().getRelationship(); + for (org.onap.aai.domain.yang.Relationship relationship : relationshipList) { + if (relationship.getRelatedTo().equals(relatedToValue)) { + isRelatedToExists = true; + break; + } + } + } + return isRelatedToExists; + } + + /** + * BPMN access method to extract Cloud Region data + * @param execution + * @param motsValue (ex: SourceSystem.SDNC or SourceSystem.PO) + */ + public String getCloudRegion(BuildingBlockExecution execution, SourceSystem sourceValue) { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + String cloudRegionId = cloudRegion.getLcpCloudRegionId(); + if (sourceValue.equals(SourceSystem.SDNC) && CLOUD_REGION_VER25.equalsIgnoreCase(cloudRegion.getCloudRegionVersion())) { + cloudRegionId = CLOUD_REGION_AAIAIC25; + } + return cloudRegionId; + } + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SourceSystem.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SourceSystem.java new file mode 100644 index 0000000000..596b280916 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SourceSystem.java @@ -0,0 +1,26 @@ +/*- + * ============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.bpmn.infrastructure.flowspecific.tasks; + +public enum SourceSystem { + PO, + SDNC +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java new file mode 100644 index 0000000000..f94b967643 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java @@ -0,0 +1,104 @@ +/*- + * ============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.bpmn.infrastructure.flowspecific.tasks; + +import java.util.Optional; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class UnassignNetworkBB { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UnassignNetworkBB.class); + + private static String MESSAGE_CANNOT_PERFORM_UNASSIGN = "Cannot perform Unassign Network. Network is still related to "; + private static String MESSAGE_ERROR_ROLLBACK = " Rollback is not possible. Please restore data manually."; + + @Autowired + private ExceptionBuilder exceptionUtil; + + @Autowired + private NetworkBBUtils networkBBUtils; + + /** + * BPMN access method to prepare overall error messages. + * + * @param execution - BuildingBlockExecution + * @param relatedToValue - String, ex: vf-module + * @return void - nothing + * @throws Exception + */ + + public void checkRelationshipRelatedTo(BuildingBlockExecution execution, String relatedToValue) throws Exception { + try { + AAIResultWrapper aaiResultWrapper = execution.getVariable("l3NetworkAAIResultWrapper"); + Optional l3network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class); + if (networkBBUtils.isRelationshipRelatedToExists(l3network, relatedToValue)) { + String msg = MESSAGE_CANNOT_PERFORM_UNASSIGN + relatedToValue; + execution.setVariable("ErrorUnassignNetworkBB", msg); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to getCloudRegionId + * + * @param execution - BuildingBlockExecution + * @return void - nothing + * @throws Exception + */ + + public void getCloudSdncRegion(BuildingBlockExecution execution) throws Exception { + try { + String cloudRegionSdnc = networkBBUtils.getCloudRegion(execution, SourceSystem.SDNC); + execution.setVariable("cloudRegionSdnc", cloudRegionSdnc); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to prepare overall error messages. + * + * @param execution - BuildingBlockExecution + * @return void - nothing + */ + public void errorEncountered(BuildingBlockExecution execution) { + String msg; + boolean isRollbackNeeded = execution.getVariable("isRollbackNeeded") != null ? execution.getVariable("isRollbackNeeded") : false; + if (isRollbackNeeded == true) { + msg = execution.getVariable("ErrorUnassignNetworkBB") + MESSAGE_ERROR_ROLLBACK; + } else { + msg = execution.getVariable("ErrorUnassignNetworkBB"); + } + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java new file mode 100644 index 0000000000..b9360b3d81 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java @@ -0,0 +1,63 @@ +/*- + * ============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.bpmn.infrastructure.flowspecific.tasks; + +import java.util.List; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.infrastructure.common.name.generation.AAIObjectInstanceNameGenerator; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIInstanceGroupResources; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + + +@Component() +public class UnassignVnf { + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private AAIInstanceGroupResources aaiInstanceGroupResources; + @Autowired + private AAIObjectInstanceNameGenerator aaiObjectInstanceNameGenerator; + + public void deleteInstanceGroups(BuildingBlockExecution execution) { + try { + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + List instanceGroups = vnf.getInstanceGroups(); + for(InstanceGroup instanceGroup : instanceGroups) { + if(ModelInfoInstanceGroup.TYPE_VNFC.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) { + aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup); + } + } + } + catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java new file mode 100644 index 0000000000..e587e80251 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java @@ -0,0 +1,121 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.sdnc.tasks; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.SDNCNetworkResources; +import org.onap.so.client.orchestration.SDNCVfModuleResources; +import org.onap.so.client.orchestration.SDNCVnfResources; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class SDNCActivateTasks { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCActivateTasks.class); + @Autowired + private SDNCVnfResources sdncVnfResources; + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private SDNCNetworkResources sdncNetworkResources; + @Autowired + private SDNCVfModuleResources sdncVfModuleResources; + + + public void activateVnf(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + RequestContext requestContext = gBBInput.getRequestContext(); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + Customer customer = gBBInput.getCustomer(); + String response = sdncVnfResources.activateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext); + execution.setVariable("SDNCResponse", response); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to perform Assign action on SDNC for L3Network + * @param execution + * @throws BBObjectNotFoundException + */ + public void activateNetwork(BuildingBlockExecution execution) throws BBObjectNotFoundException { + execution.setVariable("sdncNetworkActivateRollback", false); + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + + Customer customer = gBBInput.getCustomer(); + RequestContext requestContext = gBBInput.getRequestContext(); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + try { + sdncNetworkResources.activateNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion); + execution.setVariable("sdncNetworkActivateRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void activateVfModule(BuildingBlockExecution execution) { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + RequestContext requestContext = gBBInput.getRequestContext(); + ServiceInstance serviceInstance = null; + GenericVnf vnf = null; + VfModule vfModule = null; + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, + execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, + execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, + execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + Customer customer = gBBInput.getCustomer(); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + execution.setVariable("sdncActivateVfModuleRollback", false); + + String response = sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer, + cloudRegion, requestContext); + execution.setVariable("SDNCActivateVfModuleResponse", response); + execution.setVariable("sdncActivateVfModuleRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java new file mode 100644 index 0000000000..95d52d6f2a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java @@ -0,0 +1,133 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.sdnc.tasks; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.SDNCNetworkResources; +import org.onap.so.client.orchestration.SDNCServiceInstanceResources; +import org.onap.so.client.orchestration.SDNCVfModuleResources; +import org.onap.so.client.orchestration.SDNCVnfResources; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class SDNCAssignTasks { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAssignTasks.class); + @Autowired + private SDNCServiceInstanceResources sdncSIResources; + @Autowired + private SDNCVnfResources sdncVnfResources; + @Autowired + private SDNCVfModuleResources sdncVfModuleResources; + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private SDNCNetworkResources sdncNetworkResources; + + public void assignServiceInstance(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + RequestContext requestContext = gBBInput.getRequestContext(); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + Customer customer = gBBInput.getCustomer(); + String response = sdncSIResources.assignServiceInstance(serviceInstance, customer, requestContext); + execution.setVariable("SDNCResponse", response); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void assignVnf(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + RequestContext requestContext = gBBInput.getRequestContext(); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + Customer customer = gBBInput.getCustomer(); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + String response = sdncVnfResources.assignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext, vnf.isCallHoming()); + execution.setVariable("SDNCResponse", response); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void assignVfModule(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + RequestContext requestContext = gBBInput.getRequestContext(); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + VolumeGroup volumeGroup = null; + try{ + volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + } catch (BBObjectNotFoundException e){ + msoLogger.info("No volume group was found."); + } + Customer customer = gBBInput.getCustomer(); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + + String response = sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext); + execution.setVariable("SDNCAssignResponse_"+ vfModule.getVfModuleId(), response); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to perform Assign action on SDNC for L3Network + * @param execution + * @throws Exception + */ + public void assignNetwork(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + + Customer customer = gBBInput.getCustomer(); + RequestContext requestContext = gBBInput.getRequestContext(); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + + sdncNetworkResources.assignNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java new file mode 100644 index 0000000000..cae4dc26de --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java @@ -0,0 +1,110 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.sdnc.tasks; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.SDNCNetworkResources; +import org.onap.so.client.orchestration.SDNCServiceInstanceResources; +import org.onap.so.client.orchestration.SDNCVfModuleResources; +import org.onap.so.client.orchestration.SDNCVnfResources; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class SDNCChangeAssignTasks { + @Autowired + private SDNCNetworkResources sdncNetworkResources; + @Autowired + private SDNCServiceInstanceResources sdncServiceInstanceResources; + @Autowired + private SDNCVnfResources sdncVnfResources; + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private SDNCVfModuleResources sdncVfModuleResources; + + public void changeModelServiceInstance(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + + String response = sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext()); + execution.setVariable("SDNCChangeAssignTasks.changeModelServiceInstance.response", response); + } catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void changeModelVnf(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + + String response = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, gBBInput.getCustomer(), gBBInput.getCloudRegion(), gBBInput.getRequestContext()); + execution.setVariable("SDNCChangeModelVnfResponse", response); + } catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void changeAssignNetwork(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + + String sdncResponse = sdncNetworkResources.changeAssignNetwork(network, serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext(), gBBInput.getCloudRegion()); + execution.setVariable("SDNCChangeAssignNetworkResponse", sdncResponse); + } catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void changeAssignModelVfModule(BuildingBlockExecution execution) throws Exception { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + RequestContext requestContext = gBBInput.getRequestContext(); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + Customer customer = gBBInput.getCustomer(); + String response = sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); + execution.setVariable("SDNCChangeAssignVfModuleResponse", response); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java new file mode 100644 index 0000000000..1f6ec72f34 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java @@ -0,0 +1,154 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.sdnc.tasks; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.SDNCNetworkResources; +import org.onap.so.client.orchestration.SDNCServiceInstanceResources; +import org.onap.so.client.orchestration.SDNCVfModuleResources; +import org.onap.so.client.orchestration.SDNCVnfResources; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class SDNCDeactivateTasks { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, + SDNCDeactivateTasks.class); + @Autowired + private SDNCNetworkResources sdncNetworkResources; + @Autowired + private SDNCVfModuleResources sdncVfModuleResources; + @Autowired + private SDNCServiceInstanceResources sdncSIResources; + @Autowired + private SDNCVnfResources sdncVnfResources; + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + + public void deactivateVfModule(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + RequestContext requestContext = gBBInput.getRequestContext(); + + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, + execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, + execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, + execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + + Customer customer = gBBInput.getCustomer(); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + execution.setVariable("sdncDeactivateVfModuleRollback", false); + + String response = sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer, + cloudRegion, requestContext); + execution.setVariable("SDNCDeactivateVfModuleResponse", response); + execution.setVariable("sdncDeactivateVfModuleRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to perform Service Topology Deactivate action on SDNC for Vnf + * @param execution + * @throws Exception + */ + public void deactivateVnf(BuildingBlockExecution execution) throws Exception { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + RequestContext requestContext = gBBInput.getRequestContext(); + ServiceInstance serviceInstance = null; + GenericVnf vnf = null; + + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, + execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, + execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + Customer customer = gBBInput.getCustomer(); + String response = sdncVnfResources.deactivateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext); + execution.setVariable("SDNCDeactivateVnfResponse", response); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /* + * BPMN access method to perform Service Topology Deactivate action on SDNC for Service Instance + * @param execution + * @throws Exception + */ + public void deactivateServiceInstance(BuildingBlockExecution execution) throws Exception { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + RequestContext requestContext = gBBInput.getRequestContext(); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, + execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + Customer customer = gBBInput.getCustomer(); + execution.setVariable("sdncServiceInstanceRollback", false); + String response = sdncSIResources.deactivateServiceInstance(serviceInstance, customer, requestContext); + execution.setVariable("deactivateServiceInstanceSDNCResponse", response); + execution.setVariable("sdncServiceInstanceRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * BPMN access method to invoke deactivate on a L3Network object + * + * @param execution + */ + public void deactivateNetwork(BuildingBlockExecution execution) { + execution.setVariable("SDNCDeactivateTasks.deactivateNetwork.rollback", false); + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + Customer customer = gBBInput.getCustomer(); + RequestContext requestContext = gBBInput.getRequestContext(); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + + String response = sdncNetworkResources.deactivateNetwork(l3Network, serviceInstance, customer, + requestContext, cloudRegion); + execution.setVariable("SDNCDeactivateTasks.deactivateNetwork.response", response); + execution.setVariable("SDNCDeactivateTasks.deactivateNetwork.rollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeleteTasks.java new file mode 100644 index 0000000000..6d81cba41d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeleteTasks.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.bpmn.infrastructure.sdnc.tasks; + +import org.springframework.stereotype.Component; + +@Component +public class SDNCDeleteTasks { + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java new file mode 100644 index 0000000000..1fe3143c4a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.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.bpmn.infrastructure.sdnc.tasks; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.SDNCVnfResources; +import org.onap.so.client.orchestration.SDNCVfModuleResources; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class SDNCQueryTasks { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCQueryTasks.class); + @Autowired + private SDNCVnfResources sdncVnfResources; + @Autowired + private SDNCVfModuleResources sdncVfModuleResources; + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + + public void queryVnf(BuildingBlockExecution execution) throws Exception { + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + + try { + String response = sdncVnfResources.queryVnf(genericVnf); + execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), response); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + + public void queryVfModule(BuildingBlockExecution execution) throws Exception { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + + try { + if(vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { + String response = sdncVfModuleResources.queryVfModule(vfModule); + execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response); + } + else { + throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value"); + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void queryVfModuleForVolumeGroup(BuildingBlockExecution execution) { + try { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + if(vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { + String response = sdncVfModuleResources.queryVfModule(vfModule); + execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response); + } + else { + throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value"); + } + } catch(BBObjectNotFoundException bbException) { + // If there is not a vf module in the general building block, we will not call SDNC and proceed as normal without throwing an error + // If we see a bb object not found exception for something that is not a vf module id, then we should throw the error as normal + if(!ResourceKey.VF_MODULE_ID.equals(bbException.getResourceKey())) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException); + } + } catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java new file mode 100644 index 0000000000..13639daa44 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java @@ -0,0 +1,143 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.sdnc.tasks; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.SDNCServiceInstanceResources; +import org.onap.so.client.orchestration.SDNCVfModuleResources; +import org.onap.so.client.orchestration.SDNCVnfResources; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.client.orchestration.SDNCNetworkResources; + +@Component +public class SDNCUnassignTasks { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCUnassignTasks.class); + @Autowired + private SDNCServiceInstanceResources sdncSIResources; + @Autowired + private SDNCVfModuleResources sdncVfModuleResources; + @Autowired + private SDNCVnfResources sdncVnfResources; + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private SDNCNetworkResources sdncNetworkResources; + + public void unassignServiceInstance(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + + if (serviceInstance.getOrchestrationStatus() == OrchestrationStatus.INVENTORIED) { + return; // If INVENTORIED then SDNC unassign is not necessary + } + + RequestContext requestContext = gBBInput.getRequestContext(); + Customer customer = gBBInput.getCustomer(); + String sdncUnassignResponse = sdncSIResources.unassignServiceInstance(serviceInstance, customer, requestContext); + execution.setVariable("sdncUnassignResponse", sdncUnassignResponse); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void unassignVfModule(BuildingBlockExecution execution) { + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + + if (OrchestrationStatus.INVENTORIED == vfModule.getOrchestrationStatus() || OrchestrationStatus.PENDING_CREATE == vfModule.getOrchestrationStatus()) { + return; // If INVENTORIED or PENDING_CREATE then SDNC unassign is not necessary + } + + execution.setVariable("sdncVfModuleRollback", false); + + String response = sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance); + execution.setVariable("SDNCResponse", response); + execution.setVariable("sdncVfModuleRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void unassignVnf(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + + if (OrchestrationStatus.INVENTORIED == vnf.getOrchestrationStatus() || OrchestrationStatus.CREATED == vnf.getOrchestrationStatus()) { + return; // If INVENTORIED or CREATED then SDNC unassign is not necessary + } + + RequestContext requestContext = gBBInput.getRequestContext(); + Customer customer = gBBInput.getCustomer(); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + execution.setVariable("sdncVnfRollback", false); + String response = sdncVnfResources.unassignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext); + execution.setVariable("sdncUnassignVnfResponse", response); + execution.setVariable("sdncVnfRollback", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void unassignNetwork(BuildingBlockExecution execution) throws Exception { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + + if (OrchestrationStatus.INVENTORIED == network.getOrchestrationStatus()) { + return; // If INVENTORIED then SDNC unassign is not necessary + } + + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + Customer customer = gBBInput.getCustomer(); + RequestContext requestContext = gBBInput.getRequestContext(); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + String cloudRegionSdnc = execution.getVariable("cloudRegionSdnc"); + cloudRegion.setLcpCloudRegionId(cloudRegionSdnc); + try { + String response = sdncNetworkResources.unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + execution.setVariable("SDNCUnAssignNetworkResponse", response); + execution.setVariable("isRollbackNeeded", true); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java new file mode 100644 index 0000000000..55ebad68aa --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java @@ -0,0 +1,117 @@ +/*- + * ============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.bpmn.infrastructure.workflow.tasks; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.exception.OrchestrationStatusValidationException; +import org.onap.so.db.catalog.beans.BuildingBlockDetail; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective; +import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class OrchestrationStatusValidator { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OrchestrationStatusValidator.class); + + private static final String BUILDING_BLOCK_DETAIL_NOT_FOUND = "Building Block (%s) not set up in Orchestration_Status_Validation table in CatalogDB."; + private static final String UNKNOWN_RESOURCE_TYPE = "Building Block (%s) not set up correctly in Orchestration_Status_Validation table in CatalogDB. ResourceType=(%s), TargetAction=(%s)"; + private static final String ORCHESTRATION_VALIDATION_FAIL = "Orchestration Status Validation failed. ResourceType=(%s), TargetAction=(%s), OrchestrationStatus=(%s)"; + private static final String ORCHESTRATION_STATUS_VALIDATION_RESULT = "orchestrationStatusValidationResult"; + + + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private ExceptionBuilder exceptionBuilder; + @Autowired + private CatalogDbClient catalogDbClient; + + public void validateOrchestrationStatus(BuildingBlockExecution execution) { + try { + execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, null); + + String buildingBlockFlowName = (String) execution.getVariable("flowToBeCalled"); + + BuildingBlockDetail buildingBlockDetail = catalogDbClient.getBuildingBlockDetail(buildingBlockFlowName); + + if (buildingBlockDetail == null) { + throw new OrchestrationStatusValidationException(String.format(BUILDING_BLOCK_DETAIL_NOT_FOUND, buildingBlockFlowName)); + } + + OrchestrationStatus orchestrationStatus = null; + + switch(buildingBlockDetail.getResourceType()) { + case SERVICE: + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + orchestrationStatus = serviceInstance.getOrchestrationStatus(); + break; + case VNF: + org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + orchestrationStatus = genericVnf.getOrchestrationStatus(); + break; + case VF_MODULE: + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + orchestrationStatus = vfModule.getOrchestrationStatus(); + break; + case VOLUME_GROUP: + org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + orchestrationStatus = volumeGroup.getOrchestrationStatus(); + break; + case NETWORK: + org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + orchestrationStatus = network.getOrchestrationStatus(); + break; + case NETWORK_COLLECTION: + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInst = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + org.onap.so.bpmn.servicedecomposition.bbobjects.Collection networkCollection = serviceInst.getCollection(); + orchestrationStatus = networkCollection.getOrchestrationStatus(); + break; + case CONFIGURATION: + org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID)); + orchestrationStatus = configuration.getOrchestrationStatus(); + break; + default: + // can't currently get here, so not tested. Added in case enum is expanded without a change to this code + throw new OrchestrationStatusValidationException(String.format(UNKNOWN_RESOURCE_TYPE, buildingBlockFlowName, buildingBlockDetail.getResourceType(), buildingBlockDetail.getTargetAction())); + } + + if(orchestrationStatus==null){ + throw new OrchestrationStatusValidationException("The resource's orchstration status is null. Cannot perform task on a null orchestration status"); + } + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = catalogDbClient.getOrchestrationStatusStateTransitionDirective(buildingBlockDetail.getResourceType(), orchestrationStatus, buildingBlockDetail.getTargetAction()); + + if (orchestrationStatusStateTransitionDirective.getFlowDirective() == OrchestrationStatusValidationDirective.FAIL) { + throw new OrchestrationStatusValidationException(String.format(ORCHESTRATION_VALIDATION_FAIL, buildingBlockDetail.getResourceType(), buildingBlockDetail.getTargetAction(), orchestrationStatus)); + } + + execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, orchestrationStatusStateTransitionDirective.getFlowDirective()); + } catch (Exception e) { + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java new file mode 100644 index 0000000000..fd5f00ed6f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java @@ -0,0 +1,60 @@ +/*- + * ============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.bpmn.infrastructure.workflow.tasks; + +public class Resource { + + private String resourceId; + private WorkflowType resourceType; + private boolean generated; + private boolean baseVfModule; + + public Resource(WorkflowType resourceType, String resourceId, boolean generated){ + this.resourceId = resourceId; + this.resourceType = resourceType; + this.generated = generated; + } + + public String getResourceId() { + return resourceId; + } + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + public WorkflowType getResourceType() { + return resourceType; + } + public void setResourceType(WorkflowType resourceType) { + this.resourceType = resourceType; + } + public boolean isGenerated() { + return generated; + } + public void setGenerated(boolean generated) { + this.generated = generated; + } + public boolean isBaseVfModule() { + return baseVfModule; + } + public void setBaseVfModule(boolean baseVfModule) { + this.baseVfModule = baseVfModule; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java new file mode 100644 index 0000000000..0f02928d16 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -0,0 +1,864 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.tasks; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.javatuples.Pair; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.InstanceGroup; +import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; +import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.onap.so.serviceinstancebeans.ModelInfo; +import org.onap.so.serviceinstancebeans.ModelType; +import org.onap.so.serviceinstancebeans.Networks; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.onap.so.serviceinstancebeans.Service; +import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; +import org.onap.so.serviceinstancebeans.VfModules; +import org.onap.so.serviceinstancebeans.Vnfs; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@Component +public class WorkflowAction { + + private static final String G_ORCHESTRATION_FLOW = "gOrchestrationFlow"; + private static final String G_ACTION = "requestAction"; + private static final String G_CURRENT_SEQUENCE = "gCurrentSequence"; + private static final String G_REQUEST_ID = "mso-request-id"; + private static final String G_BPMN_REQUEST = "bpmnRequest"; + private static final String G_ALACARTE = "aLaCarte"; + private static final String G_APIVERSION = "apiVersion"; + private static final String G_URI = "requestUri"; + private static final String G_ISTOPLEVELFLOW = "isTopLevelFlow"; + private static final String VNF_TYPE = "vnfType"; + private static final String SERVICE = "Service"; + private static final String VNF = "Vnf"; + private static final String VFMODULE = "VfModule"; + private static final String VOLUMEGROUP = "VolumeGroup"; + private static final String NETWORK = "Network"; + private static final String NETWORKCOLLECTION = "NetworkCollection"; + private static final String ASSIGNINSTANCE = "assignInstance"; + private static final String CREATEINSTANCE = "createInstance"; + private static final String USERPARAMSERVICE = "service"; + private static final String supportedTypes = "vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances"; + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowAction.class); + + @Autowired + protected BBInputSetup bbInputSetup; + @Autowired + protected BBInputSetupUtils bbInputSetupUtils; + @Autowired + private ExceptionBuilder exceptionBuilder; + @Autowired + private CatalogDbClient catalogDbClient; + + public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) { + this.bbInputSetupUtils = bbInputSetupUtils; + } + + public void setBbInputSetup(BBInputSetup bbInputSetup) { + this.bbInputSetup = bbInputSetup; + } + + public void selectExecutionList(DelegateExecution execution) throws Exception { + final String requestAction = (String) execution.getVariable(G_ACTION); + final String requestId = (String) execution.getVariable(G_REQUEST_ID); + final String bpmnRequest = (String) execution.getVariable(G_BPMN_REQUEST); + final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); + final String apiVersion = (String) execution.getVariable(G_APIVERSION); + final String uri = (String) execution.getVariable(G_URI); + final String vnfType = (String) execution.getVariable(VNF_TYPE); + List orchFlows = (List) execution.getVariable(G_ORCHESTRATION_FLOW); + List flowsToExecute = new ArrayList<>(); + WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution); + List> aaiResourceIds = new ArrayList<>(); + List resourceCounter = new ArrayList<>(); + + execution.setVariable("sentSyncResponse", false); + execution.setVariable("homing", false); + execution.setVariable("calledHoming", false); + + try { + ObjectMapper mapper = new ObjectMapper(); + execution.setVariable(G_ISTOPLEVELFLOW, true); + ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class); + RequestDetails requestDetails = sIRequest.getRequestDetails(); + Resource resource = extractResourceIdAndTypeFromUri(uri); + WorkflowType resourceType = resource.getResourceType(); + String resourceId = ""; + if (resource.isGenerated()) { + resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType, + sIRequest.getRequestDetails().getRequestInfo().getInstanceName(), sIRequest.getRequestDetails(), + workflowResourceIds); + } else { + resourceId = resource.getResourceId(); + } + execution.setVariable("resourceId", resourceId); + execution.setVariable("resourceType", resourceType); + + if (aLaCarte) { + if (orchFlows == null || orchFlows.isEmpty()) { + orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte); + } + String key = ""; + ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo(); + if(modelInfo.getModelType().equals(ModelType.service)) { + key = modelInfo.getModelVersionId(); + } else { + key = modelInfo.getModelCustomizationId(); + } + for (OrchestrationFlow orchFlow : orchFlows) { + ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, key, apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false); + flowsToExecute.add(ebb); + } + } else { + boolean foundRelated = false; + boolean containsService = false; + if (resourceType == WorkflowType.SERVICE && requestAction.equalsIgnoreCase(ASSIGNINSTANCE)) { + // SERVICE-MACRO-ASSIGN will always get user params with a + // service. + if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { + List> userParams = sIRequest.getRequestDetails().getRequestParameters() + .getUserParams(); + for (Map params : userParams) { + if (params.containsKey(USERPARAMSERVICE)) { + containsService = true; + } + } + if (containsService) { + traverseUserParamsService(execution, resourceCounter, sIRequest, requestAction); + } + } else { + buildAndThrowException(execution, + "Service-Macro-Assign request details must contain user params with a service"); + } + } else if (resourceType == WorkflowType.SERVICE + && requestAction.equalsIgnoreCase(CREATEINSTANCE)) { + // SERVICE-MACRO-CREATE will get user params with a service, + // a service with a network, a service with a + // networkcollection, OR an empty service. + // If user params is just a service or null and macro + // queries the SI and finds a VNF, macro fails. + + if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { + List> userParams = sIRequest.getRequestDetails().getRequestParameters() + .getUserParams(); + for (Map params : userParams) { + if (params.containsKey(USERPARAMSERVICE)) { + containsService = true; + } + } + } + if (containsService) { + foundRelated = traverseUserParamsService(execution, resourceCounter, sIRequest, requestAction); + } + if (!foundRelated) { + traverseCatalogDbService(execution, sIRequest, resourceCounter); + } + } else if (resourceType == WorkflowType.SERVICE + && (requestAction.equalsIgnoreCase("activateInstance") + || requestAction.equalsIgnoreCase("unassignInstance") + || requestAction.equalsIgnoreCase("deleteInstance"))) { + // SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and + // SERVICE-MACRO-DELETE + // Will never get user params with service, macro will have + // to query the SI in AAI to find related instances. + traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds); + } else if (resourceType == WorkflowType.SERVICE + && requestAction.equalsIgnoreCase("deactivateInstance")) { + resourceCounter.add(new Resource(WorkflowType.SERVICE,"",false)); + } else { + buildAndThrowException(execution, "Current Macro Request is not supported"); + } + + String foundObjects = ""; + for(WorkflowType type : WorkflowType.values()){ + foundObjects = foundObjects + type + " - " + resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size() + " "; + } + msoLogger.info("Found " + foundObjects); + + if (orchFlows == null || orchFlows.isEmpty()) { + orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte); + } + flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceCounter, requestId, apiVersion, resourceId, + resourceType, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails); + if (!resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).isEmpty()) { + msoLogger.info("Sorting for Vlan Tagging"); + flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction); + } + if (resourceType == WorkflowType.SERVICE + && (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE)) + && !resourceCounter.stream().filter(x -> VNF.equals(x.getResourceType())).collect(Collectors.toList()).isEmpty()) { + execution.setVariable("homing", true); + execution.setVariable("calledHoming", false); + } + if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase(ASSIGNINSTANCE) || requestAction.equalsIgnoreCase(CREATEINSTANCE))){ + generateResourceIds(flowsToExecute, resourceCounter); + }else{ + updateResourceIdsFromAAITraversal(flowsToExecute, resourceCounter, aaiResourceIds); + } + } + + if (flowsToExecute.isEmpty()) { + throw new IllegalStateException("Macro did not come up with a valid execution path."); + } + + msoLogger.info("List of BuildingBlocks to execute:"); + for (ExecuteBuildingBlock ebb : flowsToExecute) { + msoLogger.info(ebb.getBuildingBlock().getBpmnFlowName()); + } + + execution.setVariable(G_CURRENT_SEQUENCE, 0); + execution.setVariable("retryCount", 0); + execution.setVariable("flowsToExecute", flowsToExecute); + + } catch (Exception ex) { + buildAndThrowException(execution, "Exception in create execution list " + ex.getMessage(), ex); + } + } + + protected List sortVfModulesByBaseFirst(List vfModuleResources) { + int count = 0; + for(Resource resource : vfModuleResources){ + if(resource.isBaseVfModule()){ + Collections.swap(vfModuleResources, 0, count); + break; + } + count++; + } + return vfModuleResources; + } + + private void updateResourceIdsFromAAITraversal(List flowsToExecute, + List resourceCounter, List> aaiResourceIds) { + for(Pair pair : aaiResourceIds){ + msoLogger.debug(pair.getValue0() + ", " + pair.getValue1()); + } + + Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> { + List resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()); + for(int i = 0; i < resources.size(); i++){ + updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type)); + } + }); + } + + private String retrieveAAIResourceId(List> aaiResourceIds, WorkflowType resource){ + String id = null; + for(int i = 0; i flowsToExecute, List resourceCounter) { + Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> { + List resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()); + for(int i = 0; i < resources.size(); i++){ + updateWorkflowResourceIds(flowsToExecute, type, resourceCounter.stream().filter(x -> type.equals(x.getResourceType())) + .collect(Collectors.toList()).get(i).getResourceId(), null); } + }); + } + + protected void updateWorkflowResourceIds(List flowsToExecute, WorkflowType resource, String key, String id){ + String resourceId = id; + if(resourceId==null){ + resourceId = UUID.randomUUID().toString(); + } + for(ExecuteBuildingBlock ebb : flowsToExecute){ + if(key != null && key.equalsIgnoreCase(ebb.getBuildingBlock().getKey()) && ebb.getBuildingBlock().getBpmnFlowName().contains(resource.toString())){ + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + if(resource == WorkflowType.VNF){ + workflowResourceIds.setVnfId(resourceId); + }else if(resource == WorkflowType.VFMODULE){ + workflowResourceIds.setVfModuleId(resourceId); + }else if(resource == WorkflowType.VOLUMEGROUP){ + workflowResourceIds.setVolumeGroupId(resourceId); + }else if(resource == WorkflowType.NETWORK){ + workflowResourceIds.setNetworkId(resourceId); + }else if(resource == WorkflowType.NETWORKCOLLECTION){ + workflowResourceIds.setNetworkCollectionId(resourceId); + } + ebb.setWorkflowResourceIds(workflowResourceIds); + } + } + } + + protected CollectionResourceCustomization findCatalogNetworkCollection(DelegateExecution execution, org.onap.so.db.catalog.beans.Service service) { + CollectionResourceCustomization networkCollection = null; + int count = 0; + for(CollectionResourceCustomization collectionCust : service.getCollectionResourceCustomizations()){ + if(catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCust.getModelCustomizationUUID()) + instanceof NetworkCollectionResourceCustomization) { + networkCollection = collectionCust; + count++; + } + } + if(count == 0){ + return null; + }else if(count > 1) { + buildAndThrowException(execution, "Found multiple Network Collections in the Service model, only one per Service is supported."); + } + return networkCollection; + } + + protected void traverseCatalogDbService(DelegateExecution execution, ServiceInstancesRequest sIRequest, + List resourceCounter) { + String modelUUID = sIRequest.getRequestDetails().getModelInfo().getModelVersionId(); + org.onap.so.db.catalog.beans.Service service = catalogDbClient.getServiceByID(modelUUID); + if (service == null) { + buildAndThrowException(execution, "Could not find the service model in catalog db."); + } else { + resourceCounter.add(new Resource(WorkflowType.SERVICE,service.getModelUUID(),false)); + if (service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty()) { + List customizations = service.getCollectionResourceCustomizations(); + if(customizations.isEmpty()) { + msoLogger.debug("No Collections found. CollectionResourceCustomization list is empty."); + }else{ + CollectionResourceCustomization collectionResourceCustomization = findCatalogNetworkCollection(execution, service); + if(collectionResourceCustomization!=null){ + resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,collectionResourceCustomization.getModelCustomizationUUID(),false)); + msoLogger.debug("Found a network collection"); + if(collectionResourceCustomization.getCollectionResource()!=null){ + if(collectionResourceCustomization.getCollectionResource().getInstanceGroup() != null){ + String toscaNodeType = collectionResourceCustomization.getCollectionResource().getInstanceGroup().getToscaNodeType(); + if (toscaNodeType != null && toscaNodeType.contains("NetworkCollection")) { + int minNetworks = 0; + InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup(); + CollectionResourceInstanceGroupCustomization collectionInstCust = null; + if(!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) { + collectionInstCust = instanceGroup.getCollectionInstanceGroupCustomizations().get(0); + if(collectionInstCust.getSubInterfaceNetworkQuantity() != null) { + minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity(); + } + } + msoLogger.debug("minNetworks: " + minNetworks); + for (int i = 0; i < minNetworks; i++) { + if(collectionInstCust != null) { + + resourceCounter.add( + new Resource(WorkflowType.VIRTUAL_LINK,instanceGroup.getCollectionNetworkResourceCustomizations() + .get(0).getModelCustomizationUUID(),false)); + } + } + } else { + msoLogger.debug("Instance Group tosca node type does not contain NetworkCollection: " + toscaNodeType); + } + }else{ + msoLogger.debug("No Instance Group found for network collection."); + } + }else{ + msoLogger.debug("No Network Collection found. collectionResource is null"); + } + } else { + msoLogger.debug("No Network Collection Customization found"); + } + } + if (resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).isEmpty()) { + if (service.getNetworkCustomizations() == null) { + msoLogger.debug("No networks were found on this service model"); + } else { + for (int i = 0; i < service.getNetworkCustomizations().size(); i++) { + resourceCounter.add(new Resource(WorkflowType.NETWORK,service.getNetworkCustomizations().get(i).getModelCustomizationUUID(),false)); + } + } + } + } else { + buildAndThrowException(execution, + "Cannot orchestrate Service-Macro-Create without user params with a vnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows"); + } + } + } + + protected void traverseAAIService(DelegateExecution execution, List resourceCounter, String resourceId, List> aaiResourceIds) { + try { + ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(resourceId); + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = bbInputSetup + .getExistingServiceInstance(serviceInstanceAAI); + resourceCounter.add(new Resource(WorkflowType.SERVICE,serviceInstanceMSO.getServiceInstanceId(),false)); + if (serviceInstanceMSO.getVnfs() != null) { + for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO + .getVnfs()) { + aaiResourceIds.add(new Pair(WorkflowType.VNF, vnf.getVnfId())); + resourceCounter.add(new Resource(WorkflowType.VNF,vnf.getVnfId(),false)); + if (vnf.getVfModules() != null) { + for (VfModule vfModule : vnf.getVfModules()) { + aaiResourceIds.add(new Pair(WorkflowType.VFMODULE, vfModule.getVfModuleId())); + resourceCounter.add(new Resource(WorkflowType.VFMODULE,vfModule.getVfModuleId(),false)); + } + } + if (vnf.getVolumeGroups() != null) { + for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf + .getVolumeGroups()) { + aaiResourceIds.add(new Pair(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId())); + resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,volumeGroup.getVolumeGroupId(),false)); + } + } + } + } + if (serviceInstanceMSO.getNetworks() != null) { + for (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network : serviceInstanceMSO + .getNetworks()) { + aaiResourceIds.add(new Pair(WorkflowType.NETWORK, network.getNetworkId())); + resourceCounter.add(new Resource(WorkflowType.NETWORK,network.getNetworkId(),false)); + } + } + if (serviceInstanceMSO.getCollection() != null) { + msoLogger.debug("found networkcollection"); + aaiResourceIds.add(new Pair(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId())); + resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,serviceInstanceMSO.getCollection().getId(),false)); + } + } catch (Exception ex) { + buildAndThrowException(execution, + "Could not find existing Service Instance or related Instances to execute the request on."); + } + } + + protected boolean traverseUserParamsService(DelegateExecution execution, List resourceCounter, + ServiceInstancesRequest sIRequest, String requestAction) + throws IOException { + boolean foundRelated = false; + boolean foundVfModuleOrVG = false; + if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { + List> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams(); + for (Map params : userParams) { + if (params.containsKey(USERPARAMSERVICE)) { + ObjectMapper obj = new ObjectMapper(); + String input = obj.writeValueAsString(params.get(USERPARAMSERVICE)); + Service validate = obj.readValue(input, Service.class); + resourceCounter.add(new Resource(WorkflowType.SERVICE,validate.getModelInfo().getModelVersionId(),false)); + if (validate.getResources().getVnfs() != null) { + for (Vnfs vnf : validate.getResources().getVnfs()) { + resourceCounter.add(new Resource(WorkflowType.VNF,vnf.getModelInfo().getModelCustomizationId(),false)); + foundRelated = true; + if (vnf.getVfModules() != null) { + for (VfModules vfModule : vnf.getVfModules()) { + VfModuleCustomization vfModuleCustomization = catalogDbClient + .getVfModuleCustomizationByModelCuztomizationUUID( + vfModule.getModelInfo().getModelCustomizationUuid()); + if (vfModuleCustomization != null) { + if(vfModuleCustomization.getVfModule()!=null && vfModuleCustomization.getVfModule().getVolumeHeatTemplate()!=null &&vfModuleCustomization.getVolumeHeatEnv() != null) { + resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,vfModuleCustomization.getModelCustomizationUUID(),false)); + foundRelated = true; + foundVfModuleOrVG = true; + } + if(vfModuleCustomization.getVfModule()!=null && vfModuleCustomization.getVfModule().getModuleHeatTemplate()!=null && vfModuleCustomization.getHeatEnvironment()!=null){ + foundRelated = true; + foundVfModuleOrVG = true; + Resource resource = new Resource(WorkflowType.VFMODULE,vfModuleCustomization.getModelCustomizationUUID(),false); + if(vfModuleCustomization.getVfModule().getIsBase()!=null && vfModuleCustomization.getVfModule().getIsBase()){ + resource.setBaseVfModule(true); + }else{ + resource.setBaseVfModule(false); + } + resourceCounter.add(resource); + } + if(!foundVfModuleOrVG){ + buildAndThrowException(execution, "Could not determine if vfModule was a vfModule or volume group. Heat template and Heat env are null"); + } + } + } + } + } + } + if (validate.getResources().getNetworks() != null) { + for (Networks network : validate.getResources().getNetworks()) { + resourceCounter.add(new Resource(WorkflowType.NETWORK,network.getModelInfo().getModelCustomizationId(),false)); + foundRelated = true; + } + if (requestAction.equals(CREATEINSTANCE)) { + String networkColCustId = queryCatalogDBforNetworkCollection(execution, sIRequest); + if (networkColCustId != null) { + resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,networkColCustId,false)); + foundRelated = true; + } + } + } + break; + } + } + } + return foundRelated; + } + + protected String queryCatalogDBforNetworkCollection(DelegateExecution execution, ServiceInstancesRequest sIRequest) { + org.onap.so.db.catalog.beans.Service service = catalogDbClient + .getServiceByID(sIRequest.getRequestDetails().getModelInfo().getModelVersionId()); + if (service != null) { + CollectionResourceCustomization networkCollection = this.findCatalogNetworkCollection(execution, service); + if(networkCollection != null) { + return networkCollection.getModelCustomizationUUID(); + } + } + return null; + } + + protected WorkflowResourceIds populateResourceIdsFromApiHandler(DelegateExecution execution) { + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId((String) execution.getVariable("serviceInstanceId")); + workflowResourceIds.setNetworkId((String) execution.getVariable("networkId")); + workflowResourceIds.setVfModuleId((String) execution.getVariable("vfModuleId")); + workflowResourceIds.setVnfId((String) execution.getVariable("vnfId")); + workflowResourceIds.setVolumeGroupId((String) execution.getVariable("volumeGroupId")); + return workflowResourceIds; + } + + protected Resource extractResourceIdAndTypeFromUri(String uri) { + Pattern patt = Pattern.compile( + "[vV]\\d+.*?(?:(?:/(?" + supportedTypes + ")(?:/(?[^/]+))?)(?:/(?[^/]+))?)?$"); + Matcher m = patt.matcher(uri); + Boolean generated = false; + + if (m.find()) { + msoLogger.debug("found match on " + uri + ": " + m); + String type = m.group("type"); + String id = m.group("id"); + String action = m.group("action"); + if (type == null) { + throw new IllegalArgumentException("Uri could not be parsed. No type found. " + uri); + } + if (action == null) { + if (type.equals("serviceInstances") && (id == null || id.equals("assign"))) { + id = UUID.randomUUID().toString(); + generated = true; + } + } else { + if (action.matches(supportedTypes)) { + id = UUID.randomUUID().toString(); + generated = true; + type = action; + } + } + return new Resource(WorkflowType.fromString(convertTypeFromPlural(type)), id, generated); + } else { + throw new IllegalArgumentException("Uri could not be parsed: " + uri); + } + } + + protected String validateResourceIdInAAI(String generatedResourceId, WorkflowType type, String instanceName, + RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws Exception { + try { + if ("SERVICE".equalsIgnoreCase(type.toString())) { + String globalCustomerId = reqDetails.getSubscriberInfo().getGlobalSubscriberId(); + String serviceType = reqDetails.getRequestParameters().getSubscriptionServiceType(); + if (instanceName != null) { + Optional serviceInstanceAAI = bbInputSetupUtils + .getAAIServiceInstanceByName(globalCustomerId, serviceType, instanceName); + if (serviceInstanceAAI.isPresent()) { + return serviceInstanceAAI.get().getServiceInstanceId(); + } + } + } else if ("NETWORK".equalsIgnoreCase(type.toString())) { + Optional network = bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance( + workflowResourceIds.getServiceInstanceId(), instanceName); + if (network.isPresent()) { + return network.get().getNetworkId(); + } + } else if ("VNF".equalsIgnoreCase(type.toString())) { + Optional vnf = bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance( + workflowResourceIds.getServiceInstanceId(), instanceName); + if (vnf.isPresent()) { + return vnf.get().getVnfId(); + } + } else if ("VFMODULE".equalsIgnoreCase(type.toString())) { + GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(workflowResourceIds.getVnfId()); + if (vnf != null && vnf.getVfModules() != null) { + for (org.onap.aai.domain.yang.VfModule vfModule : vnf.getVfModules().getVfModule()) { + if (vfModule.getVfModuleName().equalsIgnoreCase(instanceName)) { + return vfModule.getVfModuleId(); + } + } + } + } else if ("VOLUMEGROUP".equalsIgnoreCase(type.toString())) { + Optional volumeGroup = bbInputSetupUtils + .getRelatedVolumeGroupByNameFromVnf(workflowResourceIds.getVnfId(), instanceName); + if (volumeGroup.isPresent()) { + return volumeGroup.get().getVolumeGroupId(); + } + GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(workflowResourceIds.getVnfId()); + if (vnf != null && vnf.getVfModules() != null) { + for (org.onap.aai.domain.yang.VfModule vfModule : vnf.getVfModules().getVfModule()) { + Optional volumeGroupFromVfModule = bbInputSetupUtils + .getRelatedVolumeGroupByNameFromVfModule(vfModule.getVfModuleId(), instanceName); + if (volumeGroupFromVfModule.isPresent()) { + return volumeGroupFromVfModule.get().getVolumeGroupId(); + } + } + } + } + return generatedResourceId; + } catch (Exception ex) { + throw new IllegalStateException( + "WorkflowAction was unable to verify if the instance name already exist in AAI."); + } + } + + protected String convertTypeFromPlural(String type) { + if (!type.matches(supportedTypes)) { + return type; + } else { + if (type.equals("serviceInstances")) { + return SERVICE; + } else { + return type.substring(0, 1).toUpperCase() + type.substring(1, type.length() - 1); + } + } + } + + protected List sortExecutionPathByObjectForVlanTagging(List orchFlows, + String requestAction) { + List sortedOrchFlows = new ArrayList<>(); + if (requestAction.equals(CREATEINSTANCE)) { + for (ExecuteBuildingBlock ebb : orchFlows) { + if (ebb.getBuildingBlock().getBpmnFlowName().equals("AssignNetworkBB")) { + String key = ebb.getBuildingBlock().getKey(); + sortedOrchFlows.add(ebb); + for (ExecuteBuildingBlock ebb2 : orchFlows) { + if (ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB") + && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) { + sortedOrchFlows.add(ebb2); + break; + } + } + for (ExecuteBuildingBlock ebb2 : orchFlows) { + if (ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB") + && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) { + sortedOrchFlows.add(ebb2); + break; + } + } + } else if (ebb.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB") + || ebb.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")) { + continue; + } else if (!ebb.getBuildingBlock().getBpmnFlowName().equals("")) { + sortedOrchFlows.add(ebb); + } + } + } else if (requestAction.equals("deleteInstance")) { + for (ExecuteBuildingBlock ebb : orchFlows) { + if (ebb.getBuildingBlock().getBpmnFlowName().equals("DeactivateNetworkBB")) { + sortedOrchFlows.add(ebb); + String key = ebb.getBuildingBlock().getKey(); + for (ExecuteBuildingBlock ebb2 : orchFlows) { + if (ebb2.getBuildingBlock().getBpmnFlowName().equals("DeleteNetworkBB") + && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) { + sortedOrchFlows.add(ebb2); + break; + } + } + for (ExecuteBuildingBlock ebb2 : orchFlows) { + if (ebb2.getBuildingBlock().getBpmnFlowName().equals("UnassignNetworkBB") + && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) { + sortedOrchFlows.add(ebb2); + break; + } + } + } else if (ebb.getBuildingBlock().getBpmnFlowName().equals("DeleteNetworkBB") + || ebb.getBuildingBlock().getBpmnFlowName().equals("UnassignNetworkBB")) { + continue; + } else if (!ebb.getBuildingBlock().getBpmnFlowName().equals("")) { + sortedOrchFlows.add(ebb); + } + } + } + return sortedOrchFlows; + } + + protected List buildExecuteBuildingBlockList(List orchFlows, + List resourceCounter, String requestId, String apiVersion, String resourceId, WorkflowType resourceType, + String requestAction, boolean aLaCarte, String vnfType, + WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails) { + List flowsToExecute = new ArrayList<>(); + for (OrchestrationFlow orchFlow : orchFlows) { + if (orchFlow.getFlowName().contains(SERVICE)) { + for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType()).collect(Collectors.toList()).size(); i++) { + workflowResourceIds.setServiceInstanceId(resourceId); + flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType()) + .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + } + } else if (orchFlow.getFlowName().contains(VNF)) { + for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VNF == x.getResourceType()).collect(Collectors.toList()).size(); i++) { + flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VNF == x.getResourceType()) + .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + } + } else if (orchFlow.getFlowName().contains(NETWORK) + && !orchFlow.getFlowName().contains(NETWORKCOLLECTION)) { + for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.NETWORK == x.getResourceType()).collect(Collectors.toList()).size(); i++) { + flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.NETWORK == x.getResourceType()) + .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + } + for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()).collect(Collectors.toList()).size(); i++) { + flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()) + .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true)); + } + } else if (orchFlow.getFlowName().contains(VFMODULE)) { + List vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType()) + .collect(Collectors.toList())); + for (int i = 0; i < vfModuleResourcesSorted.size(); i++) { + flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i).getResourceId(), apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + } + } else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) { + for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VOLUMEGROUP == x.getResourceType()).collect(Collectors.toList()).size(); i++) { + flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VOLUMEGROUP == x.getResourceType()) + .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + } + } else if (orchFlow.getFlowName().contains(NETWORKCOLLECTION)) { + for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).size(); i++) { + flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()) + .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + } + } else { + flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, "", apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + } + } + return flowsToExecute; + } + + protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, String key, + String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType, + WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink) { + ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock(); + BuildingBlock buildingBlock = new BuildingBlock(); + buildingBlock.setBpmnFlowName(orchFlow.getFlowName()); + buildingBlock.setMsoId(UUID.randomUUID().toString()); + buildingBlock.setKey(key); + buildingBlock.setIsVirtualLink(isVirtualLink); + executeBuildingBlock.setApiVersion(apiVersion); + executeBuildingBlock.setaLaCarte(aLaCarte); + executeBuildingBlock.setRequestAction(requestAction); + executeBuildingBlock.setResourceId(resourceId); + executeBuildingBlock.setVnfType(vnfType); + executeBuildingBlock.setWorkflowResourceIds(workflowResourceIds); + executeBuildingBlock.setRequestId(requestId); + executeBuildingBlock.setBuildingBlock(buildingBlock); + executeBuildingBlock.setRequestDetails(requestDetails); + return executeBuildingBlock; + } + + protected List queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction, + WorkflowType resourceName, boolean aLaCarte) { + List listToExecute = new ArrayList<>(); + NorthBoundRequest northBoundRequest = catalogDbClient + .getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(requestAction, resourceName.toString(), aLaCarte); + if(northBoundRequest == null){ + if(aLaCarte){ + buildAndThrowException(execution,"The request: ALaCarte " + resourceName + " " + requestAction + " is not supported by GR_API."); + }else{ + buildAndThrowException(execution,"The request: Macro " + resourceName + " " + requestAction + " is not supported by GR_API."); + } + } else { + if(northBoundRequest.getIsToplevelflow()!=null){ + execution.setVariable(G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow()); + } + List flows = northBoundRequest.getOrchestrationFlowList(); + if (flows == null) + flows = new ArrayList<>(); + for (OrchestrationFlow flow : flows) { + if (!flow.getFlowName().contains("BB")) { + List macroQueryFlows = catalogDbClient + .getOrchestrationFlowByAction(flow.getFlowName()); + for (OrchestrationFlow macroFlow : macroQueryFlows) { + listToExecute.add(macroFlow); + } + } else { + listToExecute.add(flow); + } + } + } + return listToExecute; + } + + protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg, ex); + execution.setVariable("WorkflowActionErrorMessage", msg); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); + } + + protected void buildAndThrowException(DelegateExecution execution, String msg) { + msoLogger.error(msg); + execution.setVariable("WorkflowActionErrorMessage", msg); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); + } + + public void handleRuntimeException (DelegateExecution execution){ + StringBuffer wfeExpMsg = new StringBuffer("Runtime error "); + String runtimeErrorMessage = null; + try{ + String javaExpMsg = (String) execution.getVariable("BPMN_javaExpMsg"); + if (javaExpMsg != null && !javaExpMsg.isEmpty()) { + wfeExpMsg = wfeExpMsg.append(": ").append(javaExpMsg); + } + runtimeErrorMessage = wfeExpMsg.toString(); + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, runtimeErrorMessage, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, runtimeErrorMessage); + execution.setVariable("WorkflowActionErrorMessage", runtimeErrorMessage); + } catch (Exception e){ + //if runtime message was mulformed + runtimeErrorMessage = "Runtime error"; + } + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, runtimeErrorMessage); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java new file mode 100644 index 0000000000..ee6af61d0f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -0,0 +1,261 @@ +/*- + * ============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.bpmn.infrastructure.workflow.tasks; + +import java.util.ArrayList; +import java.util.List; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse; +import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.client.db.request.RequestsDbClient; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.logger.MsoLogger; +import org.onap.so.serviceinstancebeans.RequestReferences; +import org.onap.so.serviceinstancebeans.ServiceInstancesResponse; +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 WorkflowActionBBTasks { + + private static final String G_CURRENT_SEQUENCE = "gCurrentSequence"; + private static final String G_REQUEST_ID = "mso-request-id"; + private static final String G_ALACARTE = "aLaCarte"; + private static final String G_ACTION = "requestAction"; + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowActionBBTasks.class); + + @Autowired + private RequestsDbClient requestDbclient; + @Autowired + private WorkflowAction workflowAction; + + public void selectBB(DelegateExecution execution) { + List flowsToExecute = (List) execution + .getVariable("flowsToExecute"); + execution.setVariable("MacroRollback", false); + int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); + ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence); + boolean homing = (boolean) execution.getVariable("homing"); + boolean calledHoming = (boolean) execution.getVariable("calledHoming"); + if (homing && !calledHoming) { + if (ebb.getBuildingBlock().getBpmnFlowName().equals("AssignVnfBB")) { + ebb.setHoming(true); + execution.setVariable("calledHoming", true); + } + } else { + ebb.setHoming(false); + } + execution.setVariable("buildingBlock", ebb); + currentSequence++; + if (currentSequence >= flowsToExecute.size()) { + execution.setVariable("completed", true); + } else { + execution.setVariable("completed", false); + execution.setVariable(G_CURRENT_SEQUENCE, currentSequence); + } + } + + public void sendSyncAck(DelegateExecution execution) { + final String requestId = (String) execution.getVariable(G_REQUEST_ID); + final String resourceId = (String) execution.getVariable("resourceId"); + ServiceInstancesResponse serviceInstancesResponse = new ServiceInstancesResponse(); + RequestReferences requestRef = new RequestReferences(); + requestRef.setInstanceId(resourceId); + requestRef.setRequestId(requestId); + serviceInstancesResponse.setRequestReferences(requestRef); + ObjectMapper mapper = new ObjectMapper(); + String jsonRequest = ""; + try { + jsonRequest = mapper.writeValueAsString(serviceInstancesResponse); + } catch (JsonProcessingException e) { + workflowAction.buildAndThrowException(execution, + "Could not marshall ServiceInstancesRequest to Json string to respond to API Handler.", e); + } + WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse(); + callbackResponse.setStatusCode(200); + callbackResponse.setMessage("Success"); + callbackResponse.setResponse(jsonRequest); + String processKey = execution.getProcessEngineServices().getRepositoryService() + .getProcessDefinition(execution.getProcessDefinitionId()).getKey(); + WorkflowContextHolder.getInstance().processCallback(processKey, execution.getProcessInstanceId(), requestId, + callbackResponse); + msoLogger.info("Successfully sent sync ack."); + } + + public void sendErrorSyncAck(DelegateExecution execution) { + final String requestId = (String) execution.getVariable(G_REQUEST_ID); + try { + ExceptionBuilder exceptionBuilder = new ExceptionBuilder(); + String errorMsg = (String) execution.getVariable("WorkflowActionErrorMessage"); + if (errorMsg == null) { + errorMsg = "WorkflowAction failed unexpectedly."; + } + String processKey = exceptionBuilder.getProcessKey(execution); + String buildworkflowException = "" + + errorMsg + + "7000"; + WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse(); + callbackResponse.setStatusCode(500); + callbackResponse.setMessage("Fail"); + callbackResponse.setResponse(buildworkflowException); + WorkflowContextHolder.getInstance().processCallback(processKey, execution.getProcessInstanceId(), requestId, + callbackResponse); + execution.setVariable("sentSyncResponse", true); + } catch (Exception ex) { + msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()); + } + } + + public void setupCompleteMsoProcess(DelegateExecution execution) { + final String requestId = (String) execution.getVariable(G_REQUEST_ID); + final String action = (String) execution.getVariable(G_ACTION); + final String resourceId = (String) execution.getVariable("resourceId"); + final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); + final String resourceName = (String) execution.getVariable("resourceName"); + final String source = (String) execution.getVariable("source"); + String macroAction = ""; + if (aLaCarte) { + macroAction = "ALaCarte-" + resourceName + "-" + action; + } else { + macroAction = "Macro-" + resourceName + "-" + action; + } + String msoCompletionRequest = "" + + requestId + "" + action + "" + source + + "" + macroAction + + " request was executed correctly." + resourceId + + "WorkflowActionBB"; + execution.setVariable("CompleteMsoProcessRequest", msoCompletionRequest); + execution.setVariable("mso-request-id", requestId); + execution.setVariable("mso-service-instance-id", resourceId); + } + + public void setupFalloutHandler(DelegateExecution execution) { + final String requestId = (String) execution.getVariable(G_REQUEST_ID); + final String action = (String) execution.getVariable(G_ACTION); + final String resourceId = (String) execution.getVariable("resourceId"); + String exceptionMsg = ""; + if (execution.getVariable("WorkflowActionErrorMessage") != null) { + exceptionMsg = (String) execution.getVariable("WorkflowActionErrorMessage"); + } else { + exceptionMsg = "Error in WorkflowAction"; + } + execution.setVariable("mso-service-instance-id", resourceId); + execution.setVariable("mso-request-id", requestId); + String falloutRequest = "" + + requestId + "" + action + + "VID" + + exceptionMsg + + "7000"; + execution.setVariable("falloutRequest", falloutRequest); + } + + public void checkRetryStatus(DelegateExecution execution) { + if (execution.getVariable("handlingCode") == "Retry") { + int currSequence = (int) execution.getVariable("gCurrentSequence"); + currSequence--; + execution.setVariable("gCurrentSequence", currSequence); + int currRetryCount = (int) execution.getVariable("retryCount"); + currRetryCount++; + execution.setVariable("retryCount", currRetryCount); + } + } + + /** + * Rollback will only handle Create/Activate/Assign Macro flows. Execute + * layer will rollback the flow its currently working on. + */ + public void rollbackExecutionPath(DelegateExecution execution) { + List flowsToExecute = (List) execution + .getVariable("flowsToExecute"); + List rollbackFlows = new ArrayList(); + int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE) - 1; + for (int i = flowsToExecute.size() - 1; i >= 0; i--) { + if (i >= currentSequence) { + flowsToExecute.remove(i); + } else { + ExecuteBuildingBlock ebb = flowsToExecute.get(i); + BuildingBlock bb = flowsToExecute.get(i).getBuildingBlock(); + String flowName = flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName(); + if (flowName.contains("Assign")) { + flowName = "Unassign" + flowName.substring(7, flowName.length()); + } else if (flowName.contains("Create")) { + flowName = "Delete" + flowName.substring(6, flowName.length()); + } else if (flowName.contains("Activate")) { + flowName = "Deactivate" + flowName.substring(8, flowName.length()); + } + flowsToExecute.get(i).getBuildingBlock().setBpmnFlowName(flowName); + rollbackFlows.add(flowsToExecute.get(i)); + } + } + if (rollbackFlows.isEmpty()) + execution.setVariable("isRollbackNeeded", false); + else + execution.setVariable("isRollbackNeeded", true); + + execution.setVariable("flowsToExecute", rollbackFlows); + execution.setVariable("handlingCode", "PreformingRollback"); + } + + public void abortCallErrorHandling(DelegateExecution execution) { + String msg = "Flow has failed. Rainy day handler has decided to abort the process."; + Exception exception = new Exception(msg); + msoLogger.error(exception); + throw new BpmnError(msg); + } + + public void updateRequestStatusToFailed(DelegateExecution execution) { + try { + String requestId = (String) execution.getVariable(G_REQUEST_ID); + InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); + String errorMsg = null; + try { + WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException"); + request.setStatusMessage(exception.getErrorMessage()); + } catch (Exception ex) { + //log error and attempt to extact WorkflowExceptionMessage + msoLogger.error(ex); + } + if (errorMsg == null){ + try { + errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage"); + request.setStatusMessage(errorMsg); + } catch (Exception ex) { + msoLogger.error(ex); + request.setStatusMessage("Unexpected Error in BPMN"); + } + } + request.setRequestStatus("FAILED"); + request.setLastModifiedBy("CamundaBPMN"); + requestDbclient.updateInfraActiveRequests(request); + } catch (Exception e) { + workflowAction.buildAndThrowException(execution, "Error Updating Request Database", e); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java new file mode 100644 index 0000000000..ff5ba152b9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java @@ -0,0 +1,53 @@ +/*- + * ============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.bpmn.infrastructure.workflow.tasks; + +public enum WorkflowType { + + SERVICE("Service"), + VNF("Vnf"), + VFMODULE("VfModule"), + VOLUMEGROUP("VolumeGroup"), + NETWORK("Network"), + VIRTUAL_LINK("VirtualLink"), + NETWORKCOLLECTION("NetworkCollection"), + CONFIGURATION("Configuration"); + + private final String type; + + private WorkflowType (String type){ + this.type = type; + } + + @Override + public String toString() { + return this.type; + } + + public static WorkflowType fromString (String text){ + for (WorkflowType x : WorkflowType.values()) { + if (x.type.equalsIgnoreCase(text)) { + return x; + } + } + return null; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java new file mode 100644 index 0000000000..9075fcc3cf --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.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.bpmn.sdno.tasks; + +import java.util.Map; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.SDNOHealthCheckResources; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class SDNOHealthCheckTasks { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNOHealthCheckTasks.class); + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private SDNOHealthCheckResources sdnoHealthCheckResources; + + public void sdnoHealthCheck(BuildingBlockExecution execution) { + boolean response = false; + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + RequestContext requestContext = gBBInput.getRequestContext(); + + GenericVnf vnf = null; + Map lookupMap = execution.getLookupMap(); + for (Map.Entry entry : lookupMap.entrySet()) { + if (entry.getKey().equals(ResourceKey.GENERIC_VNF_ID)) { + vnf = extractPojosForBB.extractByKey(execution, entry.getKey(), entry.getValue()); + } + } + + response = sdnoHealthCheckResources.healthCheck(vnf, requestContext); + } + catch (Exception ex) { + msoLogger.error(ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex.getMessage()); + } + + if (!response) { + msoLogger.error("SDNO Health Check failed"); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SDNO Health Check failed"); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java new file mode 100644 index 0000000000..373ed63fda --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.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.client.aai.mapper; + +import org.modelmapper.ModelMapper; +import org.modelmapper.PropertyMap; +import org.onap.aai.domain.yang.RouteTargets; +import org.onap.so.bpmn.servicedecomposition.bbobjects.*; +import org.springframework.stereotype.Component; + +import java.util.List; +import org.modelmapper.Converter; +import org.modelmapper.spi.MappingContext; +import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute; +import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; + +@Component +public class AAIObjectMapper { + private static final ModelMapper modelMapper = new ModelMapper(); + + public org.onap.aai.domain.yang.ServiceInstance mapServiceInstance (ServiceInstance serviceInstance){ + if (modelMapper.getTypeMap(ServiceInstance.class, org.onap.aai.domain.yang.ServiceInstance.class) == null) { + modelMapper.addMappings(new PropertyMap(){ + @Override + protected void configure() { + map().setServiceType(source.getModelInfoServiceInstance().getServiceType()); + map().setServiceRole(source.getModelInfoServiceInstance().getServiceRole()); + map().setModelInvariantId(source.getModelInfoServiceInstance().getModelInvariantUuid()); + map().setModelVersionId(source.getModelInfoServiceInstance().getModelUuid()); + map().setEnvironmentContext(source.getModelInfoServiceInstance().getEnvironmentContext()); + map().setWorkloadContext(source.getModelInfoServiceInstance().getWorkloadContext()); + } + }); + } + + return modelMapper.map(serviceInstance,org.onap.aai.domain.yang.ServiceInstance.class); + } + + public org.onap.aai.domain.yang.Project mapProject (Project project){ + return modelMapper.map(project,org.onap.aai.domain.yang.Project.class); + } + + public org.onap.aai.domain.yang.ServiceSubscription mapServiceSubscription(ServiceSubscription serviceSubscription){ + return modelMapper.map(serviceSubscription,org.onap.aai.domain.yang.ServiceSubscription.class); + } + + public org.onap.aai.domain.yang.OwningEntity mapOwningEntity (OwningEntity owningEntity){ + return modelMapper.map(owningEntity,org.onap.aai.domain.yang.OwningEntity.class); + } + + public org.onap.aai.domain.yang.GenericVnf mapVnf (GenericVnf vnf){ + if (modelMapper.getTypeMap(GenericVnf.class, org.onap.aai.domain.yang.GenericVnf.class) == null) { + modelMapper.addMappings(new PropertyMap(){ + @Override + protected void configure() { + map().setModelCustomizationId(source.getModelInfoGenericVnf().getModelCustomizationUuid()); + map().setModelInvariantId(source.getModelInfoGenericVnf().getModelInvariantUuid()); + map().setModelVersionId(source.getModelInfoGenericVnf().getModelUuid()); + map().setNfRole(source.getModelInfoGenericVnf().getNfRole()); + map().setNfType(source.getModelInfoGenericVnf().getNfType()); + map().setNfFunction(source.getModelInfoGenericVnf().getNfFunction()); + map().setNfNamingCode(source.getModelInfoGenericVnf().getNfNamingCode()); + } + }); + } + + return modelMapper.map(vnf, org.onap.aai.domain.yang.GenericVnf.class); + } + + public org.onap.aai.domain.yang.VfModule mapVfModule (VfModule vfModule){ + if (modelMapper.getTypeMap(VfModule.class, org.onap.aai.domain.yang.VfModule.class) == null) { + modelMapper.addMappings(new PropertyMap(){ + @Override + protected void configure() { + map().setModelCustomizationId(source.getModelInfoVfModule().getModelCustomizationUUID()); + map().setModelInvariantId(source.getModelInfoVfModule().getModelInvariantUUID()); + map().setModelVersionId(source.getModelInfoVfModule().getModelUUID()); + map().setPersonaModelVersion(source.getModelInfoVfModule().getModelInvariantUUID()); + + } + }); + } + + return modelMapper.map(vfModule, org.onap.aai.domain.yang.VfModule.class); + } + + public org.onap.aai.domain.yang.VolumeGroup mapVolumeGroup(VolumeGroup volumeGroup) { + if (modelMapper.getTypeMap(VolumeGroup.class, org.onap.aai.domain.yang.VolumeGroup.class) == null) { + modelMapper.addMappings(new PropertyMap(){ + @Override + protected void configure() { + map().setModelCustomizationId(source.getModelInfoVfModule().getModelCustomizationUUID()); + map().setVfModuleModelCustomizationId(source.getModelInfoVfModule().getModelCustomizationUUID()); + } + }); + } + return modelMapper.map(volumeGroup, org.onap.aai.domain.yang.VolumeGroup.class); + } + + public org.onap.aai.domain.yang.L3Network mapNetwork (L3Network l3Network){ + if (modelMapper.getTypeMap(L3Network.class, org.onap.aai.domain.yang.L3Network.class) == null) { + modelMapper.addMappings(new PropertyMap(){ + @Override + protected void configure() { + map().setModelCustomizationId(source.getModelInfoNetwork().getModelCustomizationUUID()); + map().setModelInvariantId(source.getModelInfoNetwork().getModelInvariantUUID()); + map().setModelVersionId(source.getModelInfoNetwork().getModelUUID()); + map().setNetworkType(source.getModelInfoNetwork().getNetworkType()); + map().setNetworkRole(source.getModelInfoNetwork().getNetworkRole()); + map().setNetworkTechnology(source.getModelInfoNetwork().getNetworkTechnology()); + modelMapper.addConverter(convertSubnets); + modelMapper.addConverter(convertCtagAssignments); + modelMapper.addConverter(convertSegmentationAssignments); + } + }); + } + return modelMapper.map(l3Network, org.onap.aai.domain.yang.L3Network.class); + } + + public org.onap.aai.domain.yang.InstanceGroup mapInstanceGroup(InstanceGroup instanceGroup) { + if (modelMapper.getTypeMap(InstanceGroup.class, org.onap.aai.domain.yang.InstanceGroup.class) == null) { + modelMapper.addMappings(new PropertyMap(){ + @Override + protected void configure() { + map().setInstanceGroupRole(source.getModelInfoInstanceGroup().getInstanceGroupRole()); + map().setModelInvariantId(source.getModelInfoInstanceGroup().getModelInvariantUUID()); + map().setModelVersionId(source.getModelInfoInstanceGroup().getModelUUID()); + map().setInstanceGroupType(source.getModelInfoInstanceGroup().getType()); + map().setDescription(source.getModelInfoInstanceGroup().getDescription()); + map().setInstanceGroupFunction(source.getModelInfoInstanceGroup().getFunction()); + } + }); + } + return modelMapper.map(instanceGroup, org.onap.aai.domain.yang.InstanceGroup.class); + } + + public org.onap.aai.domain.yang.Customer mapCustomer(Customer customer) { + return modelMapper.map(customer, org.onap.aai.domain.yang.Customer.class); + } + + public Converter, org.onap.aai.domain.yang.Subnets> convertSubnets = new Converter, org.onap.aai.domain.yang.Subnets>() { + public org.onap.aai.domain.yang.Subnets convert(MappingContext, org.onap.aai.domain.yang.Subnets> context) { + return mapToAAISubNets(context.getSource()); + } + }; + + public Converter, org.onap.aai.domain.yang.CtagAssignments> convertCtagAssignments = new Converter, org.onap.aai.domain.yang.CtagAssignments>() { + public org.onap.aai.domain.yang.CtagAssignments convert(MappingContext, org.onap.aai.domain.yang.CtagAssignments> context) { + return mapToAAICtagAssignmentList(context.getSource()); + } + }; + + public Converter, org.onap.aai.domain.yang.SegmentationAssignments> convertSegmentationAssignments = new Converter, org.onap.aai.domain.yang.SegmentationAssignments>() { + public org.onap.aai.domain.yang.SegmentationAssignments convert(MappingContext, org.onap.aai.domain.yang.SegmentationAssignments> context) { + return mapToAAISegmentationAssignmentList(context.getSource()); + } + }; + + public org.onap.aai.domain.yang.Subnets mapToAAISubNets(List subnetList) { + org.onap.aai.domain.yang.Subnets subnets = null; + + if (!subnetList.isEmpty()) { + subnets = new org.onap.aai.domain.yang.Subnets(); + org.onap.aai.domain.yang.Subnet subnet = null; + for (Subnet subnetSource : subnetList) { + subnet = new org.onap.aai.domain.yang.Subnet(); + subnet.setSubnetId(subnetSource.getSubnetId()); + subnet.setSubnetName(subnetSource.getSubnetName()); + subnet.setNeutronSubnetId(subnetSource.getNeutronSubnetId()); + subnet.setGatewayAddress(subnetSource.getGatewayAddress()); + subnet.setCidrMask(subnetSource.getCidrMask()); + subnet.setIpVersion(subnetSource.getIpVersion()); + subnet.setOrchestrationStatus(subnetSource.getOrchestrationStatus().toString()); + subnet.setCidrMask(subnetSource.getCidrMask()); + subnet.setDhcpEnabled(subnetSource.isDhcpEnabled()); + subnet.setDhcpStart(subnetSource.getDhcpStart()); + subnet.setDhcpEnd(subnetSource.getDhcpEnd()); + subnet.setSubnetRole(subnetSource.getSubnetRole()); + subnet.setIpAssignmentDirection(subnetSource.getIpAssignmentDirection()); + subnet.setSubnetSequence(subnetSource.getSubnetSequence()); + + org.onap.aai.domain.yang.HostRoutes hostRoutes = new org.onap.aai.domain.yang.HostRoutes(); + org.onap.aai.domain.yang.HostRoute hostRoute = null; + for (HostRoute hostRouteSource : subnetSource.getHostRoutes()) { + hostRoute = new org.onap.aai.domain.yang.HostRoute(); + hostRoute.setHostRouteId(hostRouteSource.getHostRouteId()); + hostRoute.setRoutePrefix(hostRouteSource.getRoutePrefix()); + hostRoute.setNextHop(hostRouteSource.getNextHop()); + hostRoute.setNextHopType(hostRouteSource.getNextHopType()); + hostRoutes.getHostRoute().add(hostRoute); + } + subnet.setHostRoutes(hostRoutes); + subnets.getSubnet().add(subnet); + } + } + return subnets; + } + + public org.onap.aai.domain.yang.CtagAssignments mapToAAICtagAssignmentList(List ctagAssignmentsList) { + org.onap.aai.domain.yang.CtagAssignments ctagAssignments = null; + if (!ctagAssignmentsList.isEmpty()) { + ctagAssignments = new org.onap.aai.domain.yang.CtagAssignments(); + + org.onap.aai.domain.yang.CtagAssignment ctagAssignment = null; + for (CtagAssignment ctagAssignmentSource : ctagAssignmentsList) { + ctagAssignment = new org.onap.aai.domain.yang.CtagAssignment(); + ctagAssignment.setVlanIdInner(ctagAssignmentSource.getVlanIdInner()); + ctagAssignments.getCtagAssignment().add(ctagAssignment); + } + } + return ctagAssignments; + } + + public org.onap.aai.domain.yang.SegmentationAssignments mapToAAISegmentationAssignmentList(List segmentationAssignmentList) { + org.onap.aai.domain.yang.SegmentationAssignments segmentationAssignments = null; + if (!segmentationAssignmentList.isEmpty()) { + segmentationAssignments = new org.onap.aai.domain.yang.SegmentationAssignments(); + org.onap.aai.domain.yang.SegmentationAssignment segmentationAssignment = null; + for (SegmentationAssignment segmentationAssignmentSource : segmentationAssignmentList) { + segmentationAssignment = new org.onap.aai.domain.yang.SegmentationAssignment(); + segmentationAssignment.setSegmentationId(segmentationAssignmentSource.getSegmentationId()); + segmentationAssignments.getSegmentationAssignment().add(segmentationAssignment); + } + } + return segmentationAssignments; + } + + public org.onap.aai.domain.yang.Configuration mapConfiguration(Configuration configuration) { + if (null == modelMapper.getTypeMap(Configuration.class, org.onap.aai.domain.yang.Configuration.class)) { + modelMapper.addMappings(new PropertyMap(){ + @Override + protected void configure() { + map().setModelCustomizationId(source.getModelInfoConfiguration().getModelCustomizationId()); + map().setModelVersionId(source.getModelInfoConfiguration().getModelVersionId()); + map().setModelInvariantId(source.getModelInfoConfiguration().getModelInvariantId()); + } + }); + } + return modelMapper.map(configuration, org.onap.aai.domain.yang.Configuration.class); + } + + public org.onap.aai.domain.yang.Collection mapCollection (Collection networkCollection){ + if (modelMapper.getTypeMap(Collection.class, org.onap.aai.domain.yang.Collection.class) == null) { + modelMapper.addMappings(new PropertyMap(){ + @Override + protected void configure() { + map().setModelInvariantId(source.getModelInfoCollection().getModelInvariantUUID()); + map().setModelVersionId(source.getModelInfoCollection().getModelVersionId()); + map().setCollectionName(source.getName()); + } + }); + } + return modelMapper.map(networkCollection, org.onap.aai.domain.yang.Collection.class); + } + + + public org.onap.aai.domain.yang.VpnBinding mapVpnBinding(VpnBinding vpnBinding) { + org.onap.aai.domain.yang.VpnBinding aaiVpnBinding = modelMapper.map(vpnBinding, org.onap.aai.domain.yang.VpnBinding.class); + mapRouteTargetToVpnBinding(aaiVpnBinding,vpnBinding); + return aaiVpnBinding; + } + + public org.onap.aai.domain.yang.RouteTarget mapRouteTarget(RouteTarget routeTarget) { + return modelMapper.map(routeTarget, org.onap.aai.domain.yang.RouteTarget.class); + } + + private void mapRouteTargetToVpnBinding(org.onap.aai.domain.yang.VpnBinding aaiVpnBinding, VpnBinding vpnBinding) { + if(vpnBinding.getRouteTargets() != null && !vpnBinding.getRouteTargets().isEmpty()) { + RouteTargets routeTargets = new RouteTargets(); + for (RouteTarget routeTarget : vpnBinding.getRouteTargets()) { + routeTargets.getRouteTarget().add(mapRouteTarget(routeTarget)); + } + aaiVpnBinding.setRouteTargets(routeTargets); + } + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java new file mode 100644 index 0000000000..45f28df756 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.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.client.adapter.network; + +import org.onap.so.adapters.nwrest.CreateNetworkRequest; +import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.adapters.nwrest.DeleteNetworkRequest; +import org.onap.so.adapters.nwrest.DeleteNetworkResponse; +import org.onap.so.adapters.nwrest.QueryNetworkResponse; +import org.onap.so.adapters.nwrest.RollbackNetworkRequest; +import org.onap.so.adapters.nwrest.RollbackNetworkResponse; +import org.onap.so.adapters.nwrest.UpdateNetworkRequest; +import org.onap.so.adapters.nwrest.UpdateNetworkResponse; + +public interface NetworkAdapterClient { + CreateNetworkResponse createNetwork(CreateNetworkRequest req) throws NetworkAdapterClientException; + + DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req) + throws NetworkAdapterClientException; + + RollbackNetworkResponse rollbackNetwork(String aaiNetworkId, RollbackNetworkRequest req) + throws NetworkAdapterClientException; + + QueryNetworkResponse queryNetwork(String aaiNetworkId, String cloudSiteId, String tenantId, String networkStackId, + boolean skipAAI, String requestId, String serviceInstanceId) throws NetworkAdapterClientException; + + UpdateNetworkResponse updateNetwork(String aaiNetworkId, UpdateNetworkRequest req) + throws NetworkAdapterClientException; +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientException.java new file mode 100644 index 0000000000..0492477cf6 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientException.java @@ -0,0 +1,35 @@ +/*- + * ============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.client.adapter.network; + +public class NetworkAdapterClientException extends Exception { + + + /** + * + */ + private static final long serialVersionUID = 8040736661096488110L; + + public NetworkAdapterClientException(String message) { + super(message); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java new file mode 100644 index 0000000000..9b052b4484 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java @@ -0,0 +1,122 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.adapter.network; + +import javax.ws.rs.InternalServerErrorException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.adapters.nwrest.CreateNetworkRequest; +import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.adapters.nwrest.DeleteNetworkRequest; +import org.onap.so.adapters.nwrest.DeleteNetworkResponse; +import org.onap.so.adapters.nwrest.QueryNetworkResponse; +import org.onap.so.adapters.nwrest.RollbackNetworkRequest; +import org.onap.so.adapters.nwrest.RollbackNetworkResponse; +import org.onap.so.adapters.nwrest.UpdateNetworkRequest; +import org.onap.so.adapters.nwrest.UpdateNetworkResponse; +import org.onap.so.client.adapter.rest.AdapterRestClient; +import org.springframework.stereotype.Component; + +@Component +public class NetworkAdapterClientImpl implements NetworkAdapterClient { + + private final NetworkAdapterRestProperties props; + + public NetworkAdapterClientImpl() { + this.props = new NetworkAdapterRestProperties(); + } + + @Override + public CreateNetworkResponse createNetwork(CreateNetworkRequest req) throws NetworkAdapterClientException{ + try { + return new AdapterRestClient(this.props, this.getUri("").build()).post(req, + CreateNetworkResponse.class); + } catch (InternalServerErrorException e) { + throw new NetworkAdapterClientException(e.getMessage()); + } + } + + @Override + public DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req) throws NetworkAdapterClientException { + try { + return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req, + DeleteNetworkResponse.class); + } catch (InternalServerErrorException e) { + throw new NetworkAdapterClientException(e.getMessage()); + } + } + + @Override + public RollbackNetworkResponse rollbackNetwork(String aaiNetworkId, RollbackNetworkRequest req) throws NetworkAdapterClientException { + try { + return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req, + RollbackNetworkResponse.class); + } catch (InternalServerErrorException e) { + throw new NetworkAdapterClientException(e.getMessage()); + } + } + + @Override + public QueryNetworkResponse queryNetwork(String aaiNetworkId, String cloudSiteId, String tenantId, + String networkStackId, boolean skipAAI, String requestId, String serviceInstanceId) throws NetworkAdapterClientException { + UriBuilder builder = this.getUri("/" + aaiNetworkId); + if (cloudSiteId != null) { + builder.queryParam("cloudSiteId", cloudSiteId); + } + if (tenantId != null) { + builder.queryParam("tenantId", tenantId); + } + if (networkStackId != null) { + builder.queryParam("networkStackId", networkStackId); + } + + builder.queryParam("skipAAI", skipAAI); + + if (requestId != null) { + builder.queryParam("msoRequest.requestId", requestId); + } + if (serviceInstanceId != null) { + builder.queryParam("msoRequest.serviceInstanceId", serviceInstanceId); + } + try { + return new AdapterRestClient(this.props, builder.build(), MediaType.APPLICATION_XML, MediaType.APPLICATION_XML) + .get(QueryNetworkResponse.class).get(); + } catch (InternalServerErrorException e) { + throw new NetworkAdapterClientException(e.getMessage()); + } + } + + @Override + public UpdateNetworkResponse updateNetwork(String aaiNetworkId, UpdateNetworkRequest req) throws NetworkAdapterClientException { + try { + return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).put(req, + UpdateNetworkResponse.class); + } catch (InternalServerErrorException e) { + throw new NetworkAdapterClientException(e.getMessage()); + } + } + + protected UriBuilder getUri(String path) { + return UriBuilder.fromPath(path); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterRestProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterRestProperties.java new file mode 100644 index 0000000000..9888dd3be2 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterRestProperties.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.client.adapter.network; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.adapter.rest.AdapterRestProperties; + + +public class NetworkAdapterRestProperties implements AdapterRestProperties { + + public NetworkAdapterRestProperties() { + } + + @Override + public String getAuth() { + return UrnPropertiesReader.getVariable("mso.adapters.po.auth"); + } + @Override + public String getKey() { + return UrnPropertiesReader.getVariable("mso.msoKey"); + } + @Override + public URL getEndpoint() throws MalformedURLException { + return new URL(UrnPropertiesReader.getVariable("mso.adapters.network.rest.endpoint")); + } + + @Override + public String getSystemName() { + return "MSO"; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java new file mode 100644 index 0000000000..a1501da0e2 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java @@ -0,0 +1,341 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.adapter.network.mapper; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.modelmapper.ModelMapper; +import org.modelmapper.PropertyMap; +import org.onap.so.adapters.nwrest.ContrailNetwork; +import org.onap.so.adapters.nwrest.CreateNetworkRequest; +import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.adapters.nwrest.DeleteNetworkRequest; +import org.onap.so.adapters.nwrest.ProviderVlanNetwork; +import org.onap.so.adapters.nwrest.RollbackNetworkRequest; +import org.onap.so.adapters.nwrest.UpdateNetworkRequest; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.servicedecomposition.bbobjects.*; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.beans.NetworkRollback; +import org.onap.so.openstack.beans.RouteTarget; +import org.onap.so.openstack.beans.Subnet; +import org.springframework.stereotype.Component; +import org.springframework.web.util.UriUtils; + +@Component +public class NetworkAdapterObjectMapper { + private static final ModelMapper modelMapper = new ModelMapper(); + private static String FORWARD_SLASH = "/"; + + public CreateNetworkRequest createNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map userInput, String cloudRegionPo, Customer customer) throws UnsupportedEncodingException { + CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest(); + + //set cloudSiteId as determined for cloud region PO instead of cloudRegion.getLcpCloudRegionId() + createNetworkRequest.setCloudSiteId(cloudRegionPo); + createNetworkRequest.setTenantId(cloudRegion.getTenantId()); + createNetworkRequest.setNetworkId(l3Network.getNetworkId()); + createNetworkRequest.setNetworkName(l3Network.getNetworkName()); + //TODO fields not available + createNetworkRequest.setNetworkType(l3Network.getNetworkType()); + //createNetworkRequest.setNetworkTypeVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion()); + ModelInfoNetwork modelInfoNetwork = l3Network.getModelInfoNetwork(); + if (modelInfoNetwork != null){ + createNetworkRequest.setModelCustomizationUuid(modelInfoNetwork.getModelCustomizationUUID()); + } + + //build and set Subnet list + createNetworkRequest.setSubnets(buildOpenstackSubnetList(l3Network)); + + //build and set provider Vlan Network + ProviderVlanNetwork providerVlanNetwork = buildProviderVlanNetwork(l3Network); + createNetworkRequest.setProviderVlanNetwork(providerVlanNetwork); + + //build and set Contrail Network + ContrailNetwork contrailNetwork = buildContrailNetwork(l3Network, customer); + createNetworkRequest.setContrailNetwork(contrailNetwork); + + //set Network Parameters from VID request + createNetworkRequest.setNetworkParams(userInput); + + createNetworkRequest = setFlowFlags(createNetworkRequest, orchestrationContext); + + createNetworkRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance)); + + String messageId = getRandomUuid(); + createNetworkRequest.setMessageId(messageId); + //TODO clarify callback URL build process + //createNetworkRequest.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId)); + + return createNetworkRequest; + } + + public DeleteNetworkRequest deleteNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, L3Network l3Network) throws UnsupportedEncodingException { + DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest(); + + deleteNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + + String messageId = getRandomUuid(); + deleteNetworkRequest.setMessageId(messageId); + + ModelInfoNetwork modelInfoNetwork = l3Network.getModelInfoNetwork(); + if (modelInfoNetwork != null){ + deleteNetworkRequest.setModelCustomizationUuid(modelInfoNetwork.getModelCustomizationUUID()); + } + + deleteNetworkRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance)); + deleteNetworkRequest.setNetworkId(l3Network.getNetworkId()); + deleteNetworkRequest.setNetworkStackId(l3Network.getHeatStackId()); + deleteNetworkRequest.setNetworkType(l3Network.getNetworkType()); + deleteNetworkRequest.setSkipAAI(true); + deleteNetworkRequest.setTenantId(cloudRegion.getTenantId()); + + return deleteNetworkRequest; + } + + /** + * Access method to build Rollback Network Request + * @return + * @throws UnsupportedEncodingException + */ + public RollbackNetworkRequest createNetworkRollbackRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map userInput, String cloudRegionPo, CreateNetworkResponse createNetworkResponse) throws UnsupportedEncodingException { + RollbackNetworkRequest rollbackNetworkRequest = new RollbackNetworkRequest(); + + rollbackNetworkRequest = setCommonRollbackRequestFields(rollbackNetworkRequest, requestContext); + + NetworkRollback networkRollback = buildNetworkRollback(l3Network, cloudRegion, cloudRegionPo, createNetworkResponse); + rollbackNetworkRequest.setNetworkRollback(networkRollback); + + return rollbackNetworkRequest; + } + + public UpdateNetworkRequest createNetworkUpdateRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map userInput, Customer customer) throws UnsupportedEncodingException { + UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest(); + + updateNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + updateNetworkRequest.setTenantId(cloudRegion.getTenantId()); + updateNetworkRequest.setNetworkId(l3Network.getNetworkId()); + updateNetworkRequest.setNetworkStackId(l3Network.getHeatStackId()); + updateNetworkRequest.setNetworkName(l3Network.getNetworkName()); + updateNetworkRequest.setNetworkType(l3Network.getModelInfoNetwork().getNetworkType()); + updateNetworkRequest.setNetworkTypeVersion(l3Network.getModelInfoNetwork().getModelVersion()); + updateNetworkRequest.setModelCustomizationUuid(l3Network.getModelInfoNetwork().getModelCustomizationUUID()); + updateNetworkRequest.setSubnets(buildOpenstackSubnetList(l3Network)); + updateNetworkRequest.setProviderVlanNetwork(buildProviderVlanNetwork(l3Network)); + updateNetworkRequest.setContrailNetwork(buildContrailNetwork(l3Network, customer)); + updateNetworkRequest.setNetworkParams(userInput); + updateNetworkRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance)); + + setFlowFlags(updateNetworkRequest, orchestrationContext); + + String messageId = getRandomUuid(); + updateNetworkRequest.setMessageId(messageId); + updateNetworkRequest.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId)); + + return updateNetworkRequest; + } + + private RollbackNetworkRequest setCommonRollbackRequestFields(RollbackNetworkRequest request,RequestContext requestContext){ + //TODO confirm flag value + request.setSkipAAI(true); + request.setMessageId(requestContext.getMsoRequestId()); + //TODO clarify callback URL build process. This will also set SYNC flag + //request.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId)); + return request; + } + + private NetworkRollback buildNetworkRollback(L3Network l3Network, CloudRegion cloudRegion, String cloudRegionPo, CreateNetworkResponse createNetworkResponse){ + NetworkRollback networkRollback = new NetworkRollback(); + networkRollback.setNetworkId(l3Network.getNetworkId()); + networkRollback.setNeutronNetworkId(createNetworkResponse.getMessageId()); + networkRollback.setNetworkStackId(createNetworkResponse.getNetworkStackId()); + networkRollback.setTenantId(cloudRegion.getTenantId()); + networkRollback.setCloudId(cloudRegionPo); + networkRollback.setNetworkType(l3Network.getNetworkType()); + ModelInfoNetwork modelInfoNetwork = l3Network.getModelInfoNetwork(); + if (modelInfoNetwork != null){ + networkRollback.setModelCustomizationUuid(modelInfoNetwork.getModelCustomizationUUID()); + } + //rollback will only be called when network was actually created + networkRollback.setNetworkCreated(createNetworkResponse.getNetworkCreated()); + //TODO confirm below not required for create rollback + //NetworkName + //PhysicalNetwork + //Vlans + //msoRequest + return networkRollback; + } + + public MsoRequest createMsoRequest(RequestContext requestContext, ServiceInstance serviceInstance) { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestContext.getMsoRequestId()); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + return msoRequest; + } + + protected String getRandomUuid() { + return UUID.randomUUID().toString(); + } + + protected String createCallbackUrl(String messageType, String correlator) throws UnsupportedEncodingException { + String endpoint = this.getEndpoint(); + + while (endpoint.endsWith("/")) { + endpoint = endpoint.substring(0, endpoint.length()-1); + } + return endpoint + "/" + UriUtils.encodePathSegment(messageType, "UTF-8") + "/" + UriUtils.encodePathSegment(correlator, "UTF-8"); + } + + protected String getEndpoint() { + return UrnPropertiesReader.getVariable("mso.workflow.message.endpoint"); + } + /** + * Use BB L3Network object to build subnets list of type org.onap.so.openstack.beans.Subnet + * @param L3Network + * @return List + */ + private List buildOpenstackSubnetList(L3Network l3Network){ + + List subnets = l3Network.getSubnets(); + List subnetList = new ArrayList(); + //create mapper from onap Subnet to openstack bean Subnet + if(modelMapper.getTypeMap(org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet.class, org.onap.so.openstack.beans.Subnet.class) == null) { + PropertyMap personMap = new PropertyMap() { + protected void configure() { + map().setSubnetName(source.getSubnetName()); + map(source.getSubnetId(), destination.getSubnetId()); + map(source.getNeutronSubnetId(), destination.getNeutronId()); + map(source.getGatewayAddress(), destination.getGatewayIp()); + map(source.getIpVersion(), destination.getIpVersion()); + map(source.isDhcpEnabled(), destination.getEnableDHCP()); + } + }; + modelMapper.addMappings(personMap); + } + + for (org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet subnet : subnets) { + org.onap.so.openstack.beans.Subnet openstackSubnet = modelMapper.map(subnet, org.onap.so.openstack.beans.Subnet.class); + //update cidr value + if (subnet.getNetworkStartAddress() != null & subnet.getCidrMask() != null) + openstackSubnet.setCidr(subnet.getNetworkStartAddress().concat(FORWARD_SLASH).concat(subnet.getCidrMask())); + List hostRouteList = subnet.getHostRoutes(); + List openstackHostRouteList = new ArrayList<>(); + org.onap.so.openstack.beans.HostRoute openstackHostRoute = new org.onap.so.openstack.beans.HostRoute(); + //TODO only 2 fields available on openstack object. Confirm it is sufficient or add as needed + for (org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute hostRoute : hostRouteList) { + openstackHostRoute.setNextHop(hostRoute.getNextHop()); + openstackHostRoute.setPrefix(hostRoute.getRoutePrefix()); + //add host route to the list + openstackHostRouteList.add(openstackHostRoute); + } + openstackSubnet.setHostRoutes(openstackHostRouteList); + //add subnet to the list + subnetList.add(openstackSubnet); + } + return subnetList; + } + + private ProviderVlanNetwork buildProviderVlanNetwork(L3Network l3Network){ + ProviderVlanNetwork providerVlanNetwork = new ProviderVlanNetwork(); + providerVlanNetwork.setPhysicalNetworkName(l3Network.getPhysicalNetworkName()); + List vlans = new ArrayList(); + List segmentationAssignments = l3Network.getSegmentationAssignments(); + for (org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment assignment : segmentationAssignments) { + vlans.add(Integer.valueOf(assignment.getSegmentationId())); + } + providerVlanNetwork.setVlans(vlans); + return providerVlanNetwork; + } + + private ContrailNetwork buildContrailNetwork(L3Network l3Network, Customer customer){ + ContrailNetwork contrailNetwork = new ContrailNetwork(); + contrailNetwork.setExternal(Boolean.toString(l3Network.isExternalNetwork())); + contrailNetwork.setShared(Boolean.toString(l3Network.isSharedNetwork())); + contrailNetwork.setPolicyFqdns(buildPolicyFqdns(l3Network.getNetworkPolicies())); + contrailNetwork.setRouteTableFqdns(buildRouteTableFqdns(l3Network.getContrailNetworkRouteTableReferences())); + if(customer!= null) + contrailNetwork.setRouteTargets(buildRouteTargets(customer.getVpnBindings())); + //PolicyFqdns(policyFqdns); --- is set in getAAINetworkPolicy + //RouteTableFqdns(routeTableFqdns); --- is set in getAAINetworkTableRef + //RouteTargets(routeTargets); --- is set in getAAINetworkVpnBinding + return contrailNetwork; + } + + private List buildPolicyFqdns(List networkPolicies) { + List policyFqdns = new ArrayList<>(); + for(NetworkPolicy networkPolicy : networkPolicies) { + policyFqdns.add(networkPolicy.getNetworkPolicyFqdn()); + } + return policyFqdns; + } + + private List buildRouteTableFqdns(List contrailNetworkRouteTableReferences) { + List routeTableFqdns = new ArrayList<>(); + for(RouteTableReference routeTableReference : contrailNetworkRouteTableReferences) { + routeTableFqdns.add(routeTableReference.getRouteTableReferenceFqdn()); + } + return routeTableFqdns; + } + + private List buildRouteTargets(List vpnBindings) { + if(modelMapper.getTypeMap(org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget.class, RouteTarget.class) == null) { + modelMapper.addMappings(new PropertyMap() { + @Override + protected void configure() { + map().setRouteTarget(source.getGlobalRouteTarget()); + map().setRouteTargetRole(source.getRouteTargetRole()); + } + }); + } + + List routeTargets = new ArrayList<>(); + for(VpnBinding vpnBinding : vpnBindings) { + for(org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget routeTarget : vpnBinding.getRouteTargets()) { + routeTargets.add(modelMapper.map(routeTarget, RouteTarget.class)); + } + } + return routeTargets; + } + + private CreateNetworkRequest setFlowFlags(CreateNetworkRequest createNetworkRequest, OrchestrationContext orchestrationContext){ + //TODO confirm flag value + createNetworkRequest.setSkipAAI(true); + //revert suppressRollabck=TRUE into backout=FALSE and vice versa + createNetworkRequest.setBackout(orchestrationContext.getIsRollbackEnabled()); + //TODO confirm value - false by default + createNetworkRequest.setFailIfExists(true); + //NetworkTechnology(NetworkTechnology.NEUTRON); NOOP - default + return createNetworkRequest; + } + + private void setFlowFlags(UpdateNetworkRequest updateNetworkRequest, OrchestrationContext orchestrationContext){ + updateNetworkRequest.setSkipAAI(true); + //revert suppressRollabck=TRUE into backout=FALSE and vice versa + updateNetworkRequest.setBackout(!Boolean.valueOf(orchestrationContext.getIsRollbackEnabled())); + //NetworkTechnology(NetworkTechnology.NEUTRON); NOOP - default + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClient.java new file mode 100644 index 0000000000..13739faec2 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClient.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.client.adapter.vnf; + +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; +import org.onap.so.adapters.vnfrest.CreateVfModuleResponse; +import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse; +import org.onap.so.adapters.vnfrest.QueryVfModuleResponse; +import org.onap.so.adapters.vnfrest.RollbackVfModuleRequest; +import org.onap.so.adapters.vnfrest.RollbackVfModuleResponse; +import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest; +import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse; + +public interface VnfAdapterClient { + + CreateVfModuleResponse createVfModule(String aaiVnfId, CreateVfModuleRequest req) throws VnfAdapterClientException; + + RollbackVfModuleResponse rollbackVfModule(String aaiVnfId, String aaiVfModuleId, RollbackVfModuleRequest req) + throws VnfAdapterClientException; + + DeleteVfModuleResponse deleteVfModule(String aaiVnfId, String aaiVfModuleId, DeleteVfModuleRequest req) + throws VnfAdapterClientException; + + UpdateVfModuleResponse updateVfModule(String aaiVnfId, String aaiVfModuleId, UpdateVfModuleRequest req) + throws VnfAdapterClientException; + + QueryVfModuleResponse queryVfModule(String aaiVnfId, String aaiVfModuleId, String cloudSiteId, String tenantId, + String vfModuleName, boolean skipAAI, String requestId, String serviceInstanceId) + throws VnfAdapterClientException; +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientException.java new file mode 100644 index 0000000000..b4ad9ef055 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientException.java @@ -0,0 +1,34 @@ +/*- + * ============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.client.adapter.vnf; + +public class VnfAdapterClientException extends Exception { + + /** + * + */ + private static final long serialVersionUID = -7154784472485852602L; + + public VnfAdapterClientException(String message) { + super(message); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java new file mode 100644 index 0000000000..7b9a8c5312 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java @@ -0,0 +1,134 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.adapter.vnf; + +import javax.ws.rs.InternalServerErrorException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; +import org.onap.so.adapters.vnfrest.CreateVfModuleResponse; +import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse; +import org.onap.so.adapters.vnfrest.QueryVfModuleResponse; +import org.onap.so.adapters.vnfrest.RollbackVfModuleRequest; +import org.onap.so.adapters.vnfrest.RollbackVfModuleResponse; +import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest; +import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse; +import org.onap.so.client.adapter.rest.AdapterRestClient; +import org.springframework.stereotype.Component; + +@Component +public class VnfAdapterClientImpl implements VnfAdapterClient { + + private static final String VF_MODULES = "/vf-modules/"; + + private VnfAdapterRestProperties props; + + public VnfAdapterClientImpl() { + this.props = new VnfAdapterRestProperties(); + } + + public VnfAdapterClientImpl(VnfAdapterRestProperties props) { + this.props = props; + } + + @Override + public CreateVfModuleResponse createVfModule(String aaiVnfId, CreateVfModuleRequest req) + throws VnfAdapterClientException { + try { + return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + "/vf-modules").build()).post(req, + CreateVfModuleResponse.class); + } catch (InternalServerErrorException e) { + throw new VnfAdapterClientException(e.getMessage()); + } + } + + @Override + public RollbackVfModuleResponse rollbackVfModule(String aaiVnfId, String aaiVfModuleId, RollbackVfModuleRequest req) + throws VnfAdapterClientException { + try { + return new AdapterRestClient(this.props, + this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId + "/rollback").build()).delete(req, + RollbackVfModuleResponse.class); + } catch (InternalServerErrorException e) { + throw new VnfAdapterClientException(e.getMessage()); + } + } + + @Override + public DeleteVfModuleResponse deleteVfModule(String aaiVnfId, String aaiVfModuleId, DeleteVfModuleRequest req) + throws VnfAdapterClientException { + try { + return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build()) + .delete(req, DeleteVfModuleResponse.class); + } catch (InternalServerErrorException e) { + throw new VnfAdapterClientException(e.getMessage()); + } + } + + @Override + public UpdateVfModuleResponse updateVfModule(String aaiVnfId, String aaiVfModuleId, UpdateVfModuleRequest req) + throws VnfAdapterClientException { + try { + return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build()) + .put(req, UpdateVfModuleResponse.class); + } catch (InternalServerErrorException e) { + throw new VnfAdapterClientException(e.getMessage()); + } + } + + @Override + public QueryVfModuleResponse queryVfModule(String aaiVnfId, String aaiVfModuleId, String cloudSiteId, + String tenantId, String vfModuleName, boolean skipAAI, String requestId, String serviceInstanceId) + throws VnfAdapterClientException { + UriBuilder builder = this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId); + if (cloudSiteId != null) { + builder.queryParam("cloudSiteId", cloudSiteId); + } + if (tenantId != null) { + builder.queryParam("tenantId", tenantId); + } + if (vfModuleName != null) { + builder.queryParam("vfModuleName", vfModuleName); + } + + builder.queryParam("skipAAI", skipAAI); + + if (requestId != null) { + builder.queryParam("msoRequest.requestId", requestId); + } + if (serviceInstanceId != null) { + builder.queryParam("msoRequest.serviceInstanceId", serviceInstanceId); + } + try { + return new AdapterRestClient(this.props, builder.build(), MediaType.APPLICATION_JSON, + MediaType.APPLICATION_JSON).get(QueryVfModuleResponse.class).get(); + } catch (InternalServerErrorException e) { + throw new VnfAdapterClientException(e.getMessage()); + } + } + + public UriBuilder getUri(String path) { + return UriBuilder.fromPath(path); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterRestProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterRestProperties.java new file mode 100644 index 0000000000..8302375c7e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterRestProperties.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.adapter.vnf; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.adapter.rest.AdapterRestProperties; + + +public class VnfAdapterRestProperties implements AdapterRestProperties { + + + public VnfAdapterRestProperties() { + } + + @Override + public String getAuth() { + return UrnPropertiesReader.getVariable("mso.adapters.po.auth"); + } + @Override + public String getKey() { + return UrnPropertiesReader.getVariable("mso.msoKey"); + } + @Override + public URL getEndpoint() throws MalformedURLException { + return new URL(UrnPropertiesReader.getVariable("mso.adapters.vnf.rest.endpoint")); + } + + @Override + public String getSystemName() { + return "MSO"; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClient.java new file mode 100644 index 0000000000..0626efbd03 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClient.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.adapter.vnf; + +import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.QueryVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse; + +public interface VnfVolumeAdapterClient { + CreateVolumeGroupResponse createVNFVolumes(CreateVolumeGroupRequest req) throws VnfAdapterClientException; + + DeleteVolumeGroupResponse deleteVNFVolumes(String aaiVolumeGroupId, DeleteVolumeGroupRequest req) + throws VnfAdapterClientException; + + RollbackVolumeGroupResponse rollbackVNFVolumes(String aaiVolumeGroupId, RollbackVolumeGroupRequest req) + throws VnfAdapterClientException; + + UpdateVolumeGroupResponse updateVNFVolumes(String aaiVolumeGroupId, UpdateVolumeGroupRequest req) + throws VnfAdapterClientException; + + QueryVolumeGroupResponse queryVNFVolumes(String aaiVolumeGroupId, String cloudSiteId, String tenantId, + String volumeGroupStackId, Boolean skipAAI, String requestId, String serviceInstanceId) + throws VnfAdapterClientException; +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java new file mode 100644 index 0000000000..0e0fd3bb5d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.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.client.adapter.vnf; + +import javax.ws.rs.InternalServerErrorException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.QueryVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse; +import org.onap.so.client.RestClient; +import org.onap.so.client.adapter.rest.AdapterRestClient; +import org.springframework.stereotype.Component; + +@Component +public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient { + + private final VnfVolumeAdapterRestProperties props; + + public VnfVolumeAdapterClientImpl() { + this.props = new VnfVolumeAdapterRestProperties(); + } + + @Override + public CreateVolumeGroupResponse createVNFVolumes(CreateVolumeGroupRequest req) throws VnfAdapterClientException { + try { + return this.getAdapterRestClient("").post(req, CreateVolumeGroupResponse.class); + } catch (InternalServerErrorException e) { + throw new VnfAdapterClientException(e.getMessage()); + } + } + + @Override + public DeleteVolumeGroupResponse deleteVNFVolumes(String aaiVolumeGroupId, DeleteVolumeGroupRequest req) + throws VnfAdapterClientException { + try { + return this.getAdapterRestClient("/" + aaiVolumeGroupId).delete(req, DeleteVolumeGroupResponse.class); + } catch (InternalServerErrorException e) { + throw new VnfAdapterClientException(e.getMessage()); + } + } + + @Override + public RollbackVolumeGroupResponse rollbackVNFVolumes(String aaiVolumeGroupId, RollbackVolumeGroupRequest req) + throws VnfAdapterClientException { + try { + return this.getAdapterRestClient("/" + aaiVolumeGroupId + "/rollback").delete(req, + RollbackVolumeGroupResponse.class); + } catch (InternalServerErrorException e) { + throw new VnfAdapterClientException(e.getMessage()); + } + } + + @Override + public UpdateVolumeGroupResponse updateVNFVolumes(String aaiVolumeGroupId, UpdateVolumeGroupRequest req) + throws VnfAdapterClientException { + try { + return this.getAdapterRestClient("/" + aaiVolumeGroupId).put(req, UpdateVolumeGroupResponse.class); + } catch (InternalServerErrorException e) { + throw new VnfAdapterClientException(e.getMessage()); + } + } + + @Override + public QueryVolumeGroupResponse queryVNFVolumes(String aaiVolumeGroupId, String cloudSiteId, String tenantId, + String volumeGroupStackId, Boolean skipAAI, String requestId, String serviceInstanceId) + throws VnfAdapterClientException { + try { + String path = buildQueryPath(aaiVolumeGroupId, cloudSiteId, tenantId, volumeGroupStackId, skipAAI, + requestId, serviceInstanceId); + return this.getAdapterRestClient(path).get(QueryVolumeGroupResponse.class).get(); + } catch (InternalServerErrorException e) { + throw new VnfAdapterClientException(e.getMessage()); + } + } + + protected String buildQueryPath(String aaiVolumeGroupId, String cloudSiteId, String tenantId, + String volumeGroupStackId, Boolean skipAAI, String requestId, String serviceInstanceId) { + javax.ws.rs.core.UriBuilder builder = this.getUri("/" + aaiVolumeGroupId); + builder.queryParam("cloudSiteId", cloudSiteId).queryParam("tenantId", tenantId) + .queryParam("volumeGroupStackId", volumeGroupStackId).queryParam("skipAAI", skipAAI) + .queryParam("msoRequest.requestId", requestId) + .queryParam("msoRequest.serviceInstanceId", serviceInstanceId); + return builder.build().toString(); + } + + protected UriBuilder getUri(String path) { + return UriBuilder.fromPath(path); + } + + protected RestClient getAdapterRestClient(String path) { + return new AdapterRestClient(props, this.getUri(path).build(), MediaType.APPLICATION_JSON, + MediaType.APPLICATION_JSON); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestProperties.java new file mode 100644 index 0000000000..80d064249b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestProperties.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.adapter.vnf; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.adapter.rest.AdapterRestProperties; + + +public class VnfVolumeAdapterRestProperties implements AdapterRestProperties { + + protected static final String authProp = "mso.adapters.po.auth"; + protected static final String keyProp = "mso.msoKey"; + protected static final String endpointProp = "mso.adapters.volume-groups.rest.endpoint"; + + public VnfVolumeAdapterRestProperties() { + } + + @Override + public String getAuth() { + return UrnPropertiesReader.getVariable(authProp); + } + @Override + public String getKey() { + return UrnPropertiesReader.getVariable(keyProp); + } + @Override + public URL getEndpoint() throws MalformedURLException { + return new URL(UrnPropertiesReader.getVariable(endpointProp)); + } + + @Override + public String getSystemName() { + return "MSO"; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java new file mode 100644 index 0000000000..7e08d8c799 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java @@ -0,0 +1,167 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.adapter.vnf.mapper; + + +import org.onap.sdnc.apps.client.model.GenericResourceApiParamParam; +import org.onap.sdnc.apps.client.model.GenericResourceApiVfmoduletopologyVfModuleTopology; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.onap.sdnc.apps.client.model.GenericResourceApiParam; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.entity.MsoRequest; +import org.springframework.stereotype.Component; +import org.springframework.web.util.UriUtils; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +@Component +public class VnfAdapterObjectMapper { + private ObjectMapper mapper = new ObjectMapper(); + + public CreateVolumeGroupRequest createVolumeGroupRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException { + CreateVolumeGroupRequest createVolumeGroupRequest = new CreateVolumeGroupRequest(); + + createVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + createVolumeGroupRequest.setTenantId(cloudRegion.getTenantId()); + createVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId()); + createVolumeGroupRequest.setVolumeGroupName(volumeGroup.getVolumeGroupName()); + createVolumeGroupRequest.setVnfType(genericVnf.getVnfType()); + createVolumeGroupRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion()); + createVolumeGroupRequest.setVfModuleType(volumeGroup.getModelInfoVfModule().getModelName()); + createVolumeGroupRequest.setModelCustomizationUuid(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID()); + createVolumeGroupRequest.setVolumeGroupParams(createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse)); + + createVolumeGroupRequest.setSkipAAI(true); + createVolumeGroupRequest.setSuppressBackout(orchestrationContext.getIsRollbackEnabled()); + createVolumeGroupRequest.setFailIfExists(true); + + createVolumeGroupRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance)); + + String messageId = getRandomUuid(); + createVolumeGroupRequest.setMessageId(messageId); + createVolumeGroupRequest.setNotificationUrl(createCallbackUrl("VNFAResponse", messageId)); + + return createVolumeGroupRequest; + } + + public DeleteVolumeGroupRequest deleteVolumeGroupRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws IOException { + DeleteVolumeGroupRequest deleteVolumeGroupRequest = new DeleteVolumeGroupRequest(); + + deleteVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + deleteVolumeGroupRequest.setTenantId(cloudRegion.getTenantId()); + deleteVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId()); + deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId()); + + deleteVolumeGroupRequest.setSkipAAI(true); + deleteVolumeGroupRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance)); + + String messageId = getRandomUuid(); + deleteVolumeGroupRequest.setMessageId(messageId); + deleteVolumeGroupRequest.setNotificationUrl(createCallbackUrl("VNFAResponse", messageId)); + + return deleteVolumeGroupRequest; + } + + public Map createVolumeGroupParams(RequestContext requestContext,GenericVnf genericVnf, VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException { + Map volumeGroupParams = new HashMap<>(); + final String USER_PARAM_NAME_KEY = "name"; + final String USER_PARAM_VALUE_KEY = "value"; + // sdncVfModuleQueryResponse will not be available in aLaCarte case + if (sdncVfModuleQueryResponse != null) { + GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfmoduletopologyVfModuleTopology.class); + buildParamsMapFromSdncParams(volumeGroupParams, vfModuleTopology.getVfModuleParameters()); + } + + if(null != requestContext.getRequestParameters() && null != requestContext.getRequestParameters().getUserParams()) { + List> userParams = requestContext.getRequestParameters().getUserParams(); + for (Map userParamsMap : userParams) { + if ( userParamsMap.containsKey(USER_PARAM_NAME_KEY) && (userParamsMap.get(USER_PARAM_NAME_KEY) instanceof String) + && userParamsMap.containsKey(USER_PARAM_VALUE_KEY) && (userParamsMap.get(USER_PARAM_VALUE_KEY) instanceof String)) { + volumeGroupParams.put((String) userParamsMap.get(USER_PARAM_NAME_KEY), (String) userParamsMap.get(USER_PARAM_VALUE_KEY)); + } + } + } + volumeGroupParams.put("vnf_id", genericVnf.getVnfId()); + volumeGroupParams.put("vnf_name", genericVnf.getVnfName()); + volumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId()); + volumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName()); + + return volumeGroupParams; + } + + public MsoRequest createMsoRequest(RequestContext requestContext, ServiceInstance serviceInstance) { + MsoRequest msoRequest = new MsoRequest(); + + msoRequest.setRequestId(requestContext.getMsoRequestId()); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + + return msoRequest; + } + + private void buildParamsMapFromSdncParams(Map volumeGroupParams, GenericResourceApiParam sdncParameters) { + if (sdncParameters != null) { + List sdncParametersList = sdncParameters.getParam(); + if (sdncParametersList != null) { + for (int i = 0; i < sdncParametersList.size(); i++) { + GenericResourceApiParamParam param = sdncParametersList.get(i); + String parameterName = param.getName(); + String parameterValue = param.getValue(); + volumeGroupParams.put(parameterName, parameterValue); + } + } + } + } + + protected String getRandomUuid() { + return UUID.randomUUID().toString(); + } + + protected String createCallbackUrl(String messageType, String correlator) throws UnsupportedEncodingException { + String endpoint = getProperty("mso.workflow.message.endpoint"); + + while (endpoint.endsWith("/")) { + endpoint = endpoint.substring(0, endpoint.length()-1); + } + + return endpoint + "/" + UriUtils.encodePathSegment(messageType, "UTF-8") + "/" + UriUtils.encodePathSegment(correlator, "UTF-8"); + } + + protected String getProperty(String key) { + return UrnPropertiesReader.getVariable(key); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperUtils.java new file mode 100644 index 0000000000..6b2d64f170 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperUtils.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.adapter.vnf.mapper; + +import java.io.UnsupportedEncodingException; +import java.util.UUID; + +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.springframework.stereotype.Component; +import org.springframework.web.util.UriUtils; + +@Component("VnfAdapterObjectMapperUtils") +public class VnfAdapterObjectMapperUtils { + + public String getRandomUuid() { + return UUID.randomUUID().toString(); + } + + public String createCallbackUrl(String messageType, String correlator) throws UnsupportedEncodingException { + String endpoint = getProperty("mso.workflow.message.endpoint"); + if (endpoint != null) { + while (endpoint.endsWith("/")) { + endpoint = endpoint.substring(0, endpoint.length() - 1); + } + } + + return endpoint + "/" + UriUtils.encodePathSegment(messageType, "UTF-8") + "/" + + UriUtils.encodePathSegment(correlator, "UTF-8"); + } + + protected String getProperty(String key) { + + return UrnPropertiesReader.getVariable(key); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java new file mode 100644 index 0000000000..88bc08826f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java @@ -0,0 +1,730 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.adapter.vnf.mapper; + +import static java.util.Arrays.asList; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; +import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.entity.MsoRequest; +import org.onap.so.jsonpath.JsonPathUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import org.onap.sdnc.apps.client.model.GenericResourceApiParam; +import org.onap.sdnc.apps.client.model.GenericResourceApiParamParam; +import org.onap.sdnc.apps.client.model.GenericResourceApiSubInterfaceNetworkData; +import org.onap.sdnc.apps.client.model.GenericResourceApiSubinterfacenetworkdataSubInterfaceNetworkData; +import org.onap.sdnc.apps.client.model.GenericResourceApiVfmoduleassignmentsVfModuleAssignments; +import org.onap.sdnc.apps.client.model.GenericResourceApiVfmoduleassignmentsVfmoduleassignmentsVms; +import org.onap.sdnc.apps.client.model.GenericResourceApiVfmoduletopologyVfModuleTopology; +import org.onap.sdnc.apps.client.model.GenericResourceApiVmNetworkData; +import org.onap.sdnc.apps.client.model.GenericResourceApiVmTopologyData; +import org.onap.sdnc.apps.client.model.GenericResourceApiVmnetworkdataFloatingIps; +import org.onap.sdnc.apps.client.model.GenericResourceApiVmnetworkdataInterfaceRoutePrefixes; +import org.onap.sdnc.apps.client.model.GenericResourceApiVmnetworkdataNetworkInformationItems; +import org.onap.sdnc.apps.client.model.GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkInformationItem; +import org.onap.sdnc.apps.client.model.GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkinformationitemNetworkIps; +import org.onap.sdnc.apps.client.model.GenericResourceApiVmnetworkdataSriovParameters; +import org.onap.sdnc.apps.client.model.GenericResourceApiVmnetworkdataSriovparametersHeatVlanFilters; +import org.onap.sdnc.apps.client.model.GenericResourceApiVmtopologydataVmNames; +import org.onap.sdnc.apps.client.model.GenericResourceApiVmtopologydataVmNetworks; +import org.onap.sdnc.apps.client.model.GenericResourceApiVmtopologydataVmnamesVnfcNames; +import org.onap.sdnc.apps.client.model.GenericResourceApiVnfNetworkData; +import org.onap.sdnc.apps.client.model.*; + +import org.onap.sdnc.apps.client.model.GenericResourceApiVnfresourceassignmentsVnfResourceAssignments; +import org.onap.sdnc.apps.client.model.GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsAvailabilityZones; +import org.onap.sdnc.apps.client.model.GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks; +import org.onap.sdnc.apps.client.model.GenericResourceApiVnftopologyVnfTopology; +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 jersey.repackaged.com.google.common.base.Joiner; + +@Component +public class VnfAdapterVfModuleObjectMapper { + @Autowired + protected VnfAdapterObjectMapperUtils vnfAdapterObjectMapperUtils; + private static List sdncResponseParamsToSkip = asList("vnf_id", "vf_module_id", "vnf_name", "vf_module_name"); + + private ObjectMapper mapper = new ObjectMapper(); + private static final JsonPathUtil jsonPath = JsonPathUtil.getInstance(); + private static final String SUB_INT = "subint"; + private static final String SUBNET_ID = "_subnet_id"; + private static final String V6_SUBNET_ID = "_v6_subnet_id"; + private static final String PORT = "port"; + private static final String SUB_INT_COUNT = "_subintcount"; + private static final String VLAN_IDS = "_vlan_ids"; + private static final String NET_NAMES = "_net_names"; + private static final String NET_IDS = "_net_ids"; + private static final String IP = "_ip"; + private static final String V6_IP = "_v6_ip"; + private static final String FLOATING_IP = "_floating_ip"; + private static final String FLOATING_V6_IP = "_floating_v6_ip"; + private static final String UNDERSCORE = "_"; + + public CreateVfModuleRequest createVfModuleRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, + VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException { + CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest(); + + createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + createVfModuleRequest.setTenantId(cloudRegion.getTenantId()); + createVfModuleRequest.setVfModuleId(vfModule.getVfModuleId()); + createVfModuleRequest.setVfModuleName(vfModule.getVfModuleName()); + createVfModuleRequest.setVnfType(genericVnf.getVnfType()); + createVfModuleRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion()); + createVfModuleRequest.setVfModuleType(vfModule.getModelInfoVfModule().getModelName()); + createVfModuleRequest.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID()); + + createVfModuleRequest.setVfModuleParams(buildVfModuleParamsMap(requestContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse)); + + createVfModuleRequest.setSkipAAI(true); + createVfModuleRequest.setBackout(orchestrationContext.getIsRollbackEnabled()); + createVfModuleRequest.setFailIfExists(true); + + MsoRequest msoRequest = buildMsoRequest(requestContext, serviceInstance); + createVfModuleRequest.setMsoRequest(msoRequest); + + String messageId = vnfAdapterObjectMapperUtils.getRandomUuid(); + createVfModuleRequest.setMessageId(messageId); + createVfModuleRequest.setNotificationUrl(vnfAdapterObjectMapperUtils.createCallbackUrl("VNFAResponse", messageId)); + + return createVfModuleRequest; + } + + private MsoRequest buildMsoRequest(RequestContext requestContext,ServiceInstance serviceInstance) { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestContext.getMsoRequestId()); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + return msoRequest; + } + + private Map buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance, GenericVnf genericVnf, + VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException { + GenericResourceApiVnftopologyVnfTopology vnfTopology = mapper.readValue(sdncVnfQueryResponse, GenericResourceApiVnftopologyVnfTopology.class); + GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfmoduletopologyVfModuleTopology.class); + Map paramsMap = new HashMap<>(); + + if(vnfTopology.getSdncGeneratedCloudResources() && vfModuleTopology.getSdncGeneratedCloudResources()) { + buildParamsMapFromVfModuleSdncResponse(paramsMap, vfModuleTopology, true); + buildParamsMapFromVnfSdncResponse(paramsMap, vnfTopology, null, true); + } + else { + Map networkRoleMap = buildNetworkRoleMap(vfModuleTopology); + buildParamsMapFromVfModuleSdncResponse(paramsMap, vfModuleTopology, false); + buildParamsMapFromVnfSdncResponse(paramsMap, vnfTopology, networkRoleMap, false); + } + + buildMandatoryParamsMap(paramsMap, serviceInstance, genericVnf, vfModule); + + // Parameters received from the request should overwrite any parameters received from SDNC + paramsMap.putAll(requestContext.getUserParams()); + return paramsMap; + } + + private void buildMandatoryParamsMap(Map paramsMap, ServiceInstance serviceInstance, GenericVnf genericVnf, VfModule vfModule) { + paramsMap.put("vnf_id", genericVnf.getVnfId()); + paramsMap.put("vnf_name", genericVnf.getVnfName()); + paramsMap.put("vf_module_id", vfModule.getVfModuleId()); + paramsMap.put("vf_module_name", vfModule.getVfModuleName()); + paramsMap.put("environment_context",serviceInstance.getModelInfoServiceInstance().getEnvironmentContext()); + paramsMap.put("workload_context", serviceInstance.getModelInfoServiceInstance().getWorkloadContext()); + Integer vfModuleIndex = vfModule.getModuleIndex(); + if (vfModuleIndex != null) { + paramsMap.put("vf_module_index", vfModuleIndex.toString()); + } + } + + private void buildParamsMapFromVnfSdncResponse(Map paramsMap, GenericResourceApiVnftopologyVnfTopology vnfTopology, Map networkRoleMap, boolean skipVnfResourceAssignments) throws JsonParseException, JsonMappingException, IOException { + // Get VNF parameters from SDNC response + GenericResourceApiParam vnfParametersData = vnfTopology.getVnfParametersData(); + buildParamsMapFromSdncParams(paramsMap, vnfParametersData); + + if(!skipVnfResourceAssignments) { + GenericResourceApiVnfresourceassignmentsVnfResourceAssignments vnfResourceAssignments = vnfTopology.getVnfResourceAssignments(); + if (vnfResourceAssignments != null) { + // Availability Zones + buildAvailabilityZones(paramsMap, vnfResourceAssignments); + // VNF Networks + buildVnfNetworks(paramsMap, vnfResourceAssignments, networkRoleMap); + } + } + } + + private void buildAvailabilityZones (Map paramsMap, GenericResourceApiVnfresourceassignmentsVnfResourceAssignments vnfResourceAssignments) { + GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsAvailabilityZones availabilityZones = vnfResourceAssignments.getAvailabilityZones(); + if (availabilityZones != null) { + List availabilityZonesList = availabilityZones.getAvailabilityZone(); + if (availabilityZonesList != null) { + for(int i = 0; i < availabilityZonesList.size(); i++) { + paramsMap.put("availability_zone_" + i, availabilityZonesList.get(i)); + } + } + } + } + + private void buildVnfNetworks (Map paramsMap, GenericResourceApiVnfresourceassignmentsVnfResourceAssignments vnfResourceAssignments, Map networkRoleMap) { + GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks vnfNetworks = vnfResourceAssignments.getVnfNetworks(); + if (vnfNetworks != null) { + List vnfNetworksList = vnfNetworks.getVnfNetwork(); + if (vnfNetworksList != null) { + for (int i = 0; i < vnfNetworksList.size(); i++) { + GenericResourceApiVnfNetworkData vnfNetwork = vnfNetworksList.get(i); + String networkRole = vnfNetwork.getNetworkRole(); + String vnfNetworkKey = networkRoleMap.get(networkRole); + if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRole; + } + + String vnfNetworkNeutronIdValue = vnfNetwork.getNeutronId(); + paramsMap.put(vnfNetworkKey + "_net_id", vnfNetworkNeutronIdValue); + String vnfNetworkNetNameValue = vnfNetwork.getNetworkName(); + paramsMap.put(vnfNetworkKey + "_net_name", vnfNetworkNetNameValue); + String vnfNetworkNetFqdnValue = vnfNetwork.getContrailNetworkFqdn(); + paramsMap.put(vnfNetworkKey + "_net_fqdn", vnfNetworkNetFqdnValue); + + buildVnfNetworkSubnets(paramsMap, vnfNetwork, vnfNetworkKey); + + } + } + } + } + + private void buildVnfNetworkSubnets(Map paramsMap, GenericResourceApiVnfNetworkData vnfNetwork, String vnfNetworkKey) { + String vnfNetworkString = convertToString(vnfNetwork); + Optional ipv4Ips = jsonPath.locateResult(vnfNetworkString, "$.subnets-data.subnet-data[*].[?(@.ip-version == 'ipv4' && @.dhcp-enabled == 'Y')].subnet-id"); + if(ipv4Ips.isPresent()) + addPairToMap(paramsMap, vnfNetworkKey, SUBNET_ID, ipv4Ips.get()); + + Optional ipv6Ips = jsonPath.locateResult(vnfNetworkString, "$.subnets-data.subnet-data[*].[?(@.ip-version == 'ipv6' && @.dhcp-enabled == 'Y')].subnet-id"); + if(ipv6Ips.isPresent()) + addPairToMap(paramsMap, vnfNetworkKey, V6_SUBNET_ID, ipv6Ips.get()); + } + + private void buildParamsMapFromVfModuleSdncResponse(Map paramsMap, GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology, boolean skipVfModuleAssignments) throws JsonParseException, JsonMappingException, IOException { + // Get VF Module parameters from SDNC response + GenericResourceApiParam vfModuleParametersData = vfModuleTopology.getVfModuleParameters(); + buildParamsMapFromSdncParams(paramsMap, vfModuleParametersData); + + if(!skipVfModuleAssignments) { + GenericResourceApiVfmoduleassignmentsVfModuleAssignments vfModuleAssignments = vfModuleTopology.getVfModuleAssignments(); + if (vfModuleAssignments != null) { + // VNF-VMS + GenericResourceApiVfmoduleassignmentsVfmoduleassignmentsVms vms = vfModuleAssignments.getVms(); + if (vms != null) { + List vmsList = vms.getVm(); + if (vmsList != null) { + for (GenericResourceApiVmTopologyData vm : vmsList){ + String key = vm.getVmType(); + buildVfModuleVmNames(paramsMap, vm, key); + GenericResourceApiVmtopologydataVmNetworks vmNetworks = vm.getVmNetworks(); + if (vmNetworks != null) { + List vmNetworksList = vmNetworks.getVmNetwork(); + if (vmNetworksList != null) { + for(int n = 0; n < vmNetworksList.size(); n++){ + GenericResourceApiVmNetworkData network = vmNetworksList.get(n); + network.getNetworkRoleTag(); + String networkKey = network.getNetworkRole(); + // Floating IPs + buildVfModuleFloatingIps(paramsMap, network, key, networkKey); + // Interface Route Prefixes + buildVfModuleInterfaceRoutePrefixes(paramsMap, network, key, networkKey); + // SRIOV Parameters + buildVfModuleSriovParameters(paramsMap, network, networkKey); + // IPV4 and IPV6 Addresses + buildVfModuleNetworkInformation(paramsMap, network, key, networkKey); + } + } + } + + buildParamsMapFromVfModuleForHeatTemplate(paramsMap, vm); + } + } + } + } + } + } + + private void buildVfModuleVmNames(Map paramsMap, GenericResourceApiVmTopologyData vm, String key) { + String values = ""; + GenericResourceApiVmtopologydataVmNames vmNames = vm.getVmNames(); + if (vmNames != null) { + List valueList = vmNames.getVmName(); + if (valueList != null) { + for(int i = 0; i < valueList.size(); i++){ + String value = valueList.get(i); + if (i != valueList.size() - 1) { + values += value + ","; + } + else { + values += value; + } + paramsMap.put(key + "_name_" + i, value); + } + paramsMap.put(key + "_names", values); + } + } + } + + private void buildVfModuleFloatingIps(Map paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) { + GenericResourceApiVmnetworkdataFloatingIps floatingIps = network.getFloatingIps(); + if (floatingIps != null) { + List floatingIpV4List = floatingIps.getFloatingIpV4(); + if (floatingIpV4List != null) { + // add only one ipv4 floating ip for now + String floatingIPKey = key + UNDERSCORE + networkKey + FLOATING_IP; + String floatingIPKeyValue = floatingIpV4List.get(0); + if (floatingIPKeyValue != null && !floatingIPKeyValue.isEmpty()) { + paramsMap.put(floatingIPKey, floatingIPKeyValue); + } + } + // add only one ipv6 floating ip for now + List floatingIpV6List = floatingIps.getFloatingIpV6(); + if (floatingIpV6List != null) { + String floatingIPV6Key = key + UNDERSCORE + networkKey + FLOATING_V6_IP; + String floatingIPV6KeyValue = floatingIpV6List.get(0); + if (floatingIPV6KeyValue != null && !floatingIPV6KeyValue.isEmpty()) { + paramsMap.put(floatingIPV6Key, floatingIPV6KeyValue); + } + } + } + } + + private void buildVfModuleInterfaceRoutePrefixes(Map paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) { + GenericResourceApiVmnetworkdataInterfaceRoutePrefixes interfaceRoutePrefixes = network.getInterfaceRoutePrefixes(); + if (interfaceRoutePrefixes != null) { + List interfaceRoutePrefixesList = interfaceRoutePrefixes.getInterfaceRoutePrefix(); + StringBuilder sbInterfaceRoutePrefixes = new StringBuilder(); + sbInterfaceRoutePrefixes.append("["); + if (interfaceRoutePrefixesList != null) { + for(int a = 0; a < interfaceRoutePrefixesList.size(); a++){ + String interfaceRoutePrefixValue = interfaceRoutePrefixesList.get(a); + if (a != interfaceRoutePrefixesList.size() - 1) { + sbInterfaceRoutePrefixes.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ","); + } + else { + sbInterfaceRoutePrefixes.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}"); + } + } + sbInterfaceRoutePrefixes.append("]"); + if (interfaceRoutePrefixesList.size() > 0) { + paramsMap.put(key + UNDERSCORE + networkKey + "_route_prefixes", sbInterfaceRoutePrefixes.toString()); + } + } + } + } + + private void buildVfModuleSriovParameters(Map paramsMap, GenericResourceApiVmNetworkData network, String networkKey) { + // SRIOV Parameters + GenericResourceApiVmnetworkdataSriovParameters sriovParameters = network.getSriovParameters(); + if (sriovParameters != null) { + GenericResourceApiVmnetworkdataSriovparametersHeatVlanFilters heatVlanFilters = sriovParameters.getHeatVlanFilters(); + if (heatVlanFilters != null) { + List heatVlanFiltersList = heatVlanFilters.getHeatVlanFilter(); + StringBuilder sriovFilterBuf = new StringBuilder(); + if (heatVlanFiltersList != null) { + for(int a = 0; a < heatVlanFiltersList.size(); a++){ + String heatVlanFilterValue = heatVlanFiltersList.get(a); + if (a != heatVlanFiltersList.size() - 1) { + sriovFilterBuf.append(heatVlanFilterValue).append(","); + } + else { + sriovFilterBuf.append(heatVlanFilterValue); + } + } + if (heatVlanFiltersList.size() > 0) { + paramsMap.put(networkKey + "_ATT_VF_VLAN_FILTER", sriovFilterBuf.toString()); + } + } + } + } + } + + private void buildVfModuleNetworkInformation(Map paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) { + + GenericResourceApiVmnetworkdataNetworkInformationItems networkInformationItems = network.getNetworkInformationItems(); + StringBuilder sbIpv4Ips = new StringBuilder(); + StringBuilder sbIpv6Ips = new StringBuilder(); + + if (networkInformationItems != null) { + List networkInformationItemList = networkInformationItems.getNetworkInformationItem(); + if (networkInformationItemList != null) { + for(int a = 0; a < networkInformationItemList.size(); a++){ + GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkInformationItem ipAddress = networkInformationItemList.get(a); + if (ipAddress != null) { + GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkinformationitemNetworkIps ips = ipAddress.getNetworkIps(); + if (ips != null) { + List ipsList = ips.getNetworkIp(); + if (ipsList != null) { + String ipVersion = ipAddress.getIpVersion(); + for (int b = 0; b < ipsList.size(); b++) { + String ipAddressValue = ipsList.get(b); + if (ipVersion.equals("ipv4")) { + if (b != ipsList.size() - 1) { + sbIpv4Ips.append(ipAddressValue + ","); + } + else { + sbIpv4Ips.append(ipAddressValue); + } + paramsMap.put(key + UNDERSCORE + networkKey + IP + UNDERSCORE + b, ipAddressValue); + } + else if (ipVersion.equals("ipv6")) { + if (b != ipsList.size() - 1) { + sbIpv6Ips.append(ipAddressValue + ","); + } + else { + sbIpv6Ips.append(ipAddressValue); + } + paramsMap.put(key + UNDERSCORE + networkKey + V6_IP + UNDERSCORE + b, ipAddressValue); + } + } + paramsMap.put(key + UNDERSCORE + networkKey + "_ips", sbIpv4Ips.toString()); + paramsMap.put(key + UNDERSCORE + networkKey + "_v6_ips", sbIpv6Ips.toString()); + } + } + } + } + } + } + } + + /* + * Build Mapping from GenericResourceApi SDNC for Heat Template so that AIC - PO gets accurate requests for vf module assignments. + * Build Count of SubInterfaces, VLAN Tag, network_name, network_id, + * ip_address (V4 and V6) and Floating IPs Addresses (V4 and V6) for Heat Template + */ + private void buildParamsMapFromVfModuleForHeatTemplate(Map paramsMap, GenericResourceApiVmTopologyData vm) { + GenericResourceApiVmtopologydataVmNames vmNames = vm.getVmNames(); + + if (vmNames != null) { + + List vnfcNamesList = vmNames.getVnfcNames(); + if (vnfcNamesList != null) { + + for(int i = 0; i < vnfcNamesList.size(); i++){ + + GenericResourceApiVmtopologydataVmnamesVnfcNames vnfcNames = vnfcNamesList.get(i); + parseVnfcNamesData(paramsMap, vnfcNames); + } + } + } + } + + /* + * Parse vnfcNames data to build Mapping from GenericResourceApi SDNC for Heat Template. + */ + private void parseVnfcNamesData(Map paramsMap, GenericResourceApiVmtopologydataVmnamesVnfcNames vnfcNames) { + + if (vnfcNames != null) { + GenericResourceApiVnfcNetworkData vnfcNetworks = vnfcNames.getVnfcNetworks(); + if (vnfcNetworks != null) { + List vnfcNetworkdataList = vnfcNetworks.getVnfcNetworkData(); + + if (vnfcNetworkdataList != null) { + + for(int networkDataIdx = 0; networkDataIdx < vnfcNetworkdataList.size(); networkDataIdx++){ + + GenericResourceApiVnfcnetworkdataVnfcNetworkData vnfcNetworkdata = vnfcNetworkdataList.get(networkDataIdx); + parseVnfcNetworkData(paramsMap, vnfcNetworkdata, networkDataIdx); + } + } + } + } + } + + /* + * Parse VnfcNetworkData to build Mapping from GenericResourceApi SDNC for Heat Template. + * Build Count of SubInterfaces, VLAN Tag, network_name, network_id, + * ip_address (V4 and V6) and Floating IPs Addresses (V4 and V6) for Heat Template + */ + private void parseVnfcNetworkData(Map paramsMap, GenericResourceApiVnfcnetworkdataVnfcNetworkData vnfcNetworkdata, int networkDataIdx) { + + String vmTypeKey = vnfcNetworkdata.getVnfcType(); + GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcPorts vnfcPorts = vnfcNetworkdata.getVnfcPorts(); + List vnfcPortList = vnfcPorts.getVnfcPort(); + if (vnfcPortList != null) { + for(int portIdx = 0; portIdx < vnfcPortList.size(); portIdx++){ + + GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcportsVnfcPort vnfcPort = vnfcPortList.get(portIdx); + GenericResourceApiSubInterfaceNetworkData vnicSubInterfaces = vnfcPort.getVnicSubInterfaces(); + + String vnicSubInterfacesString = convertToString(vnicSubInterfaces); + String networkRoleKey = vnfcPort.getCommonSubInterfaceRole(); + String subInterfaceKey = createVnfcSubInterfaceKey(vmTypeKey, networkDataIdx, networkRoleKey, portIdx); + String globalSubInterfaceKey = createGlobalVnfcSubInterfaceKey(vmTypeKey, networkRoleKey, portIdx); + + buildVfModuleSubInterfacesCount(paramsMap, globalSubInterfaceKey, vnicSubInterfaces); + + buildVfModuleVlanTag(paramsMap, subInterfaceKey, vnicSubInterfacesString); + + buildVfModuleNetworkName(paramsMap, subInterfaceKey, vnicSubInterfacesString); + + buildVfModuleNetworkId(paramsMap, subInterfaceKey, vnicSubInterfacesString); + + buildVfModuleIpV4AddressHeatTemplate(paramsMap, subInterfaceKey, vnicSubInterfacesString); + + buildVfModuleIpV6AddressHeatTemplate(paramsMap, subInterfaceKey, vnicSubInterfacesString); + + buildVfModuleFloatingIpV4HeatTemplate(paramsMap, globalSubInterfaceKey, vnicSubInterfacesString); + + buildVfModuleFloatingIpV6HeatTemplate(paramsMap, globalSubInterfaceKey, vnicSubInterfacesString); + } + } + } + + /* + * Build "count" (calculating the total number of sub-interfaces) for Heat Template + * Building Criteria : {vm-type}_subint_{network-role}_port_{index}_subintcount + * vmTypeKey = vm-type, networkRoleKey = common-sub-interface-role + * Example: fw_subint_ctrl_port_0_subintcount + * + */ + private void buildVfModuleSubInterfacesCount(Map paramsMap, String keyPrefix, GenericResourceApiSubInterfaceNetworkData vnicSubInterfaces) { + + List subInterfaceNetworkDataList = vnicSubInterfaces.getSubInterfaceNetworkData(); + + if ( (subInterfaceNetworkDataList != null) && !subInterfaceNetworkDataList.isEmpty() ) { + addPairToMap(paramsMap, keyPrefix, SUB_INT_COUNT, String.valueOf(subInterfaceNetworkDataList.size())); + } + } + + protected String createVnfcSubInterfaceKey(String vmTypeKey, int networkDataIdx, String networkRoleKey, int portIdx) { + + return Joiner.on(UNDERSCORE).join(Arrays.asList(vmTypeKey, networkDataIdx, SUB_INT, networkRoleKey, PORT, portIdx)); + } + + protected String createGlobalVnfcSubInterfaceKey(String vmTypeKey,String networkRoleKey, int portIdx) { + + return Joiner.on(UNDERSCORE).join(Arrays.asList(vmTypeKey, SUB_INT, networkRoleKey, PORT, portIdx)); + } + + /* + * Build VLAN Tag for Heat Template + * Building Criteria : {vm-type}_{index}_subint_{network-role}_port_{index}_vlan_ids + * vmTypeKey = vm-type, networkRoleKey = common-sub-interface-role + * Example: fw_0_subint_ctrl_port_0_vlan_ids + * + */ + protected void buildVfModuleVlanTag(Map paramsMap, String keyPrefix, String vnicSubInterfaces) { + + List vlanTagIds = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].vlan-tag-id"); + + addPairToMap(paramsMap, keyPrefix, VLAN_IDS, vlanTagIds); + } + /* + * Build "network_name" for Heat Template + * Building Criteria : {vm-type}_{index}_subint_{network-role}_port_{index}_net_names + * vmTypeKey = vm-type, networkRoleKey = common-sub-interface-role + * Example: fw_0_subint_ctrl_port_0_net_names + * + */ + protected void buildVfModuleNetworkName(Map paramsMap, String keyPrefix, String vnicSubInterfaces) { + + List neworkNames = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].network-name"); + + addPairToMap(paramsMap, keyPrefix, NET_NAMES, neworkNames); + } + + /* + * Build "network_id" for Heat Template + * Building Criteria : {vm-type}_{index}_subint_{network-role}_port_{index}_net_ids + * vmTypeKey = vm-type, networkRoleKey = common-sub-interface-role + * Example: fw_0_subint_ctrl_port_0_net_ids + * + */ + protected void buildVfModuleNetworkId(Map paramsMap, String keyPrefix, String vnicSubInterfaces) { + + List neworkIds = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].network-id"); + + addPairToMap(paramsMap, keyPrefix, NET_IDS, neworkIds); + } + + /* + * Build ip_address for V4 for Heat Template + * Building Criteria : + * {vm-type}_{index}_subint_{network-role}_port_{index}_ip_{index} -- for ipV4 + * key = vm-type, networkRoleKey = NetWork-Role + */ + protected void buildVfModuleIpV4AddressHeatTemplate(Map paramsMap, String keyPrefix, String vnicSubInterfaces) { + + List ipv4Ips = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].network-information-items.network-information-item[?(@.ip-version == 'ipv4')].network-ips.network-ip[*]"); + + addPairToMap(paramsMap, keyPrefix, IP, ipv4Ips); + + for (int i = 0; i < ipv4Ips.size(); i++) { + addPairToMap(paramsMap, keyPrefix, IP + UNDERSCORE + i, ipv4Ips.get(i)); + } + + } + + /* + * Build ip_address for Heat Template + * Building Criteria : + * {vm-type}_{index}_subint_{network-role}_port_{index}_v6_ip_{index} -- for ipV6 + * key = vm-type, networkRoleKey = NetWork-Role + */ + protected void buildVfModuleIpV6AddressHeatTemplate(Map paramsMap, String keyPrefix, String vnicSubInterfaces) { + + List ipv6Ips = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].network-information-items.network-information-item[?(@.ip-version == 'ipv6')].network-ips.network-ip[*]"); + + addPairToMap(paramsMap, keyPrefix, V6_IP, ipv6Ips); + + for (int i = 0; i < ipv6Ips.size(); i++) { + addPairToMap(paramsMap, keyPrefix, V6_IP + UNDERSCORE + i, ipv6Ips.get(i)); + } + } + + /* + * Build floatingip_address for Heat Template + * Building Criteria : + * {vm-type}_subint_{network-role}_port_{index}_floating_ip -- for ipV4 + */ + protected void buildVfModuleFloatingIpV4HeatTemplate(Map paramsMap, String keyPrefix, String vnicSubInterfaces) { + + List floatingV4 = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].floating-ips.floating-ip-v4[*]"); + + if (!floatingV4.isEmpty()) { + floatingV4 = Collections.singletonList(floatingV4.get(0)); + } + addPairToMap(paramsMap, keyPrefix, FLOATING_IP, floatingV4); + + } + + /* + * Build floatingip_address for Heat Template + * Building Criteria : + * {vm-type}_subint_{network-role}_port_{index}_floating_v6_ip -- for ipV6 + */ + protected void buildVfModuleFloatingIpV6HeatTemplate(Map paramsMap, String keyPrefix, String vnicSubInterfaces) { + + List floatingV6 = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].floating-ips.floating-ip-v6[*]"); + + if (!floatingV6.isEmpty()) { + floatingV6 = Collections.singletonList(floatingV6.get(0)); + } + addPairToMap(paramsMap, keyPrefix, FLOATING_V6_IP, floatingV6); + } + + protected void addPairToMap(Map paramsMap, String keyPrefix, String key, String value) { + + addPairToMap(paramsMap, keyPrefix, key, Collections.singletonList(value)); + } + + protected void addPairToMap(Map paramsMap, String keyPrefix, String key, List value) { + + if (!value.isEmpty()) { + paramsMap.put(keyPrefix + key, Joiner.on(",").join(value)); + } + } + + private void buildParamsMapFromSdncParams(Map paramsMap, GenericResourceApiParam parametersData) { + if (parametersData != null) { + List paramsList = parametersData.getParam(); + if (paramsList != null) { + for (int i = 0; i < paramsList.size(); i++) { + GenericResourceApiParamParam param = paramsList.get(i); + String parameterName = param.getName(); + if (!sdncResponseParamsToSkip.contains(parameterName)) { + String parameterValue = param.getValue(); + paramsMap.put(parameterName, parameterValue); + } + } + } + } + } + + private Map buildNetworkRoleMap(GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology) throws JsonParseException, JsonMappingException, IOException { + Map networkRoleMap = new HashMap<>(); + GenericResourceApiVfmoduleassignmentsVfModuleAssignments vfModuleAssignments = vfModuleTopology.getVfModuleAssignments(); + if (vfModuleAssignments != null) { + GenericResourceApiVfmoduleassignmentsVfmoduleassignmentsVms vms = vfModuleAssignments.getVms(); + if (vms != null) { + List vmsList = vms.getVm(); + if (vmsList != null) { + for (GenericResourceApiVmTopologyData vm : vmsList){ + GenericResourceApiVmtopologydataVmNetworks vmNetworks = vm.getVmNetworks(); + if (vmNetworks != null) { + List vmNetworksList = vmNetworks.getVmNetwork(); + if (vmNetworksList != null) { + for(int n = 0; n < vmNetworksList.size(); n++){ + GenericResourceApiVmNetworkData network = vmNetworksList.get(n); + String networkRole = network.getNetworkRole(); + String networkRoleValue = network.getNetworkRoleTag(); + if (networkRoleValue == null || networkRoleValue.isEmpty()) { + networkRoleValue = networkRole; + } + networkRoleMap.put(networkRole, networkRoleValue); + } + } + } + } + } + } + } + return networkRoleMap; + } + + public DeleteVfModuleRequest deleteVfModuleRequestMapper(RequestContext requestContext,CloudRegion cloudRegion, + ServiceInstance serviceInstance, GenericVnf genericVnf, + VfModule vfModule) throws IOException { + DeleteVfModuleRequest deleteVfModuleRequest = new DeleteVfModuleRequest(); + deleteVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + deleteVfModuleRequest.setTenantId(cloudRegion.getTenantId()); + deleteVfModuleRequest.setVnfId(genericVnf.getVnfId()); + deleteVfModuleRequest.setVfModuleId(vfModule.getVfModuleId()); + deleteVfModuleRequest.setVfModuleStackId(vfModule.getHeatStackId());//DoDVfMod_heatStackId + deleteVfModuleRequest.setSkipAAI(true); + String messageId = vnfAdapterObjectMapperUtils.getRandomUuid(); + deleteVfModuleRequest.setMessageId(messageId); + deleteVfModuleRequest.setNotificationUrl(vnfAdapterObjectMapperUtils.createCallbackUrl("VNFAResponse", messageId)); + MsoRequest msoRequest = buildMsoRequest(requestContext, serviceInstance); + deleteVfModuleRequest.setMsoRequest(msoRequest); + return deleteVfModuleRequest; + } + + private String convertToString(Object obj) { + String json; + try { + json = mapper.writeValueAsString(obj); + } catch (JsonProcessingException e) { + json = "{}"; + } + + return json; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java new file mode 100644 index 0000000000..4a9f01fa53 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.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.client.orchestration; + +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AAICollectionResources { + @Autowired + private InjectionHelper injectionHelper; + + @Autowired + private AAIObjectMapper aaiObjectMapper; + + public void createCollection(Collection collection) { + AAIResourceUri networkCollectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId()); + collection.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(collection); + injectionHelper.getAaiClient().create(networkCollectionURI, aaiCollection); + } + + public void updateCollection(Collection collection) { + AAIResourceUri networkCollectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId()); + org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(collection); + injectionHelper.getAaiClient().update(networkCollectionURI, aaiCollection); + } + + public void deleteCollection(Collection collection) { + AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId()); + injectionHelper.getAaiClient().delete(instanceGroupUri); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java new file mode 100644 index 0000000000..b84f8b6459 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java @@ -0,0 +1,170 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import java.util.Optional; + +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AAIConfigurationResources { + @Autowired + private InjectionHelper injectionHelper; + + @Autowired + private AAIObjectMapper aaiObjectMapper; + + /** + * A&AI call to create configuration + * + * @param configuration + */ + public void createConfiguration(Configuration configuration) { + AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); + injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration); + } + + /** + * method to get Configuration details from A&AI + * + * @param configurationId + * @return + */ + public Optional getConfiguration(String configurationId) { + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri); + } + + /** + * A&AI call to update configuration + * + * @param configuration + */ + public void updateConfiguration(Configuration configuration) { + AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); + injectionHelper.getAaiClient().update(configurationURI, aaiConfiguration); + } + /** + * A&AI call to disconnect configuration relation with service instance + * @param configurationId + * @param serviceInstanceId + */ + + public void disconnectConfigurationToServiceInstance(String configurationId, String serviceInstanceId){ + AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + serviceInstanceId); + injectionHelper.getAaiClient().disconnect(configurationURI,serviceInstanceURI); + } + + /** + * A&AI call to add vrf configuration relationship with Vnr Configuration + * + * @param vrfConfigurationId + * @param vnrConfigurationId + */ + public void connectVrfConfigurationToVnrConfiguration(String vrfConfigurationId, String vnrConfigurationId) { + AAIResourceUri vnrConfigurationUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vnrConfigurationId); + AAIResourceUri vrfConfigurationUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vrfConfigurationId); + injectionHelper.getAaiClient().connect(vrfConfigurationUri, vnrConfigurationUri); + } + + /** + * A&AI call to add configuration relationship with PnfObject + * + * @param pnfId + * @param configurationId + */ + public void connectConfigurationToPnfObject(String pnfId, String configurationId) { + AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId); + AAIResourceUri configurationUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + injectionHelper.getAaiClient().connect(configurationUri, pnfUri); + } + + /** + * A&AI call to add configuration relationship with service instance + * + * @param configurationId + * @param serviceInstanceId + */ + public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId) { + AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + serviceInstanceId); + injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI); + } + + /** + * A&AI call to add configuration relationship with generic-vnf + * + * @param configurationId + * @param genericVnfId + */ + public void connectConfigurationToGenericVnf(String configurationId, String genericVnfId) { + AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnfId); + injectionHelper.getAaiClient().connect(configurationURI, genericVnfURI); + } + + /** + * A&AI call to add configuration relationship with vpn-binding + * + * @param configurationId + * @param vpnId + */ + public void connectConfigurationToVpnBinding(String configurationId, String vpnId) { + AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId); + injectionHelper.getAaiClient().connect(configurationURI, vpnBindingURI); + } + /** + * method to delete Configuration details in A&AI + * + * @param configurationId + */ + public void deleteConfiguration(String configurationId) { + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + injectionHelper.getAaiClient().delete(aaiResourceUri); + } + + /** + * Get Configuration from AAI using related Link + * @param relatedLink related link - URI + * @return AAI Configuration object + */ + public Optional getConfigurationFromRelatedLink(String relatedLink){ + return injectionHelper.getAaiClient() + .get(org.onap.aai.domain.yang.Configuration.class, AAIUriFactory.createResourceFromExistingURI(AAIObjectType.CONFIGURATION, UriBuilder.fromPath(relatedLink).build())); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java new file mode 100644 index 0000000000..4c4edb7fe9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import java.util.Optional; + +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AAIInstanceGroupResources { + @Autowired + private InjectionHelper injectionHelper; + + @Autowired + private AAIObjectMapper aaiObjectMapper; + + public void createInstanceGroup(InstanceGroup instanceGroup) { + AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup); + injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup)); + } + + public void deleteInstanceGroup(InstanceGroup instanceGroup) { + AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + injectionHelper.getAaiClient().delete(instanceGroupUri); + } + + public void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf) { + AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + injectionHelper.getAaiClient().connect(instanceGroupUri, vnfURI); + } + + public boolean exists(InstanceGroup instanceGroup) { + AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + return injectionHelper.getAaiClient().exists(instanceGroupUri); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java new file mode 100644 index 0000000000..e4984c921d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java @@ -0,0 +1,157 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import java.util.Optional; + +import org.onap.aai.domain.yang.NetworkPolicy; +import org.onap.aai.domain.yang.RouteTableReference; +import org.onap.aai.domain.yang.VpnBinding; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.client.aai.AAIObjectType; +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.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AAINetworkResources { + @Autowired + private InjectionHelper injectionHelper; + + @Autowired + private AAIObjectMapper aaiObjectMapper; + + public void updateNetwork(L3Network network) { + AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(network); + injectionHelper.getAaiClient().update(networkURI, aaiL3Network); + } + + public void createNetworkConnectToServiceInstance(L3Network network, ServiceInstance serviceInstance) { + AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + serviceInstance.getServiceInstanceId()); + org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(network); + injectionHelper.getAaiClient().createIfNotExists(networkURI, Optional.of(aaiL3Network)).connect(networkURI, serviceInstanceURI); + } + + public void deleteNetwork(L3Network network) { + AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + injectionHelper.getAaiClient().delete(networkURI); + } + + public Optional getVpnBinding(AAIResourceUri netBindingUri) { + return injectionHelper.getAaiClient().get(netBindingUri).asBean(VpnBinding.class); + } + + public Optional getNetworkPolicy(AAIResourceUri netPolicyUri) { + return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.class); + } + + public Optional getRouteTable(AAIResourceUri rTableUri) { + return injectionHelper.getAaiClient().get(rTableUri).asBean(RouteTableReference.class); + } + + public Optional queryNetworkById(L3Network l3network) { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK,l3network.getNetworkId()).depth(Depth.ALL); + AAIResultWrapper aaiWrapper = injectionHelper.getAaiClient().get(uri); + return aaiWrapper.asBean(org.onap.aai.domain.yang.L3Network.class); + } + + public AAIResultWrapper queryNetworkWrapperById(L3Network l3network) { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK,l3network.getNetworkId()).depth(Depth.ALL); + return injectionHelper.getAaiClient().get(uri); + } + + public void createNetworkInstanceGroup(InstanceGroup instanceGroup) { + AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup); + injectionHelper.getAaiClient().create(instanceGroupURI, aaiInstanceGroup); + } + + public void createNetworkCollection(Collection networkCollection) { + AAIResourceUri networkCollectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId()); + networkCollection.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(networkCollection); + injectionHelper.getAaiClient().create(networkCollectionURI, aaiCollection); + } + + public void connectNetworkToTenant(L3Network l3network, CloudRegion cloudRegion) { + AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, + cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId()); + AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()); + injectionHelper.getAaiClient().connect(tenantURI, networkURI); + } + + public void connectNetworkToCloudRegion(L3Network l3network, CloudRegion cloudRegion) { + AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, + cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()); + AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()); + injectionHelper.getAaiClient().connect(cloudRegionURI, networkURI); + } + + public void connectNetworkToNetworkCollectionInstanceGroup(L3Network l3network, InstanceGroup instanceGroup) { + AAIResourceUri netwrokCollectionInstanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()); + injectionHelper.getAaiClient().connect(netwrokCollectionInstanceGroupURI, networkURI); + } + + public void connectNetworkToNetworkCollectionServiceInstance(L3Network l3network, ServiceInstance networkCollectionServiceInstance) { + AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId()); + AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()); + injectionHelper.getAaiClient().connect(networkCollectionServiceInstanceUri, networkURI); + } + + public void connectNetworkCollectionInstanceGroupToNetworkCollection(InstanceGroup instanceGroup, Collection networkCollection) { + AAIResourceUri networkCollectionUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId()); + AAIResourceUri netwrokCollectionInstanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + injectionHelper.getAaiClient().connect(networkCollectionUri, netwrokCollectionInstanceGroupURI); + } + + public void connectNetworkCollectionToServiceInstance(Collection networkCollection, ServiceInstance networkCollectionServiceInstance) { + AAIResourceUri networkCollectionUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId()); + AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId()); + injectionHelper.getAaiClient().connect(networkCollectionUri, networkCollectionServiceInstanceUri); + } + + public void deleteCollection(Collection collection) { + AAIResourceUri collectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId()); + injectionHelper.getAaiClient().delete(collectionURI); + } + + public void deleteNetworkInstanceGroup(InstanceGroup instanceGroup) { + AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + injectionHelper.getAaiClient().delete(instanceGroupURI); + } + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java new file mode 100644 index 0000000000..b5738dcb40 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.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========================================================= + */ + +package org.onap.so.client.orchestration; + +import java.util.Optional; + +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.client.aai.AAIObjectPlurals; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AAIServiceInstanceResources { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIServiceInstanceResources.class); + + @Autowired + private InjectionHelper injectionHelper; + + @Autowired + private AAIObjectMapper aaiObjectMapper; + + public boolean existsServiceInstance(ServiceInstance serviceInstance) { + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + serviceInstance.getServiceInstanceId()); + return injectionHelper.getAaiClient().exists(serviceInstanceURI); + } + + public void createServiceInstance(ServiceInstance serviceInstance, Customer customer) { + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + customer.getGlobalCustomerId(), customer.getServiceSubscription().getServiceType(), serviceInstance.getServiceInstanceId()); + serviceInstance.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + org.onap.aai.domain.yang.ServiceInstance AAIServiceInstance = aaiObjectMapper.mapServiceInstance(serviceInstance); + injectionHelper.getAaiClient().createIfNotExists(serviceInstanceURI, Optional.of(AAIServiceInstance)); + } + + /** + * Create ServiceSubscription in A&AI + * @param customer + */ + public void createServiceSubscription(Customer customer) { + AAIResourceUri serviceSubscriptionURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, + customer.getGlobalCustomerId(),customer.getServiceSubscription().getServiceType()); + org.onap.aai.domain.yang.ServiceSubscription serviceSubscription = aaiObjectMapper.mapServiceSubscription(customer.getServiceSubscription()); + injectionHelper.getAaiClient().createIfNotExists(serviceSubscriptionURI , Optional.of(serviceSubscription)); + } + + public void deleteServiceInstance(ServiceInstance serviceInstance) { + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + serviceInstance.getServiceInstanceId()); + injectionHelper.getAaiClient().delete(serviceInstanceURI); + } + + public void createProject(Project project) { + AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName()); + org.onap.aai.domain.yang.Project AAIProject = aaiObjectMapper.mapProject(project); + injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(AAIProject)); + } + + public void createProjectandConnectServiceInstance(Project project, ServiceInstance serviceInstance) { + AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName()); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + serviceInstance.getServiceInstanceId()); + org.onap.aai.domain.yang.Project AAIProject = aaiObjectMapper.mapProject(project); + injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(AAIProject)).connect(projectURI, serviceInstanceURI); + } + + public void createOwningEntity(OwningEntity owningEntity) { + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, + owningEntity.getOwningEntityId()); + org.onap.aai.domain.yang.OwningEntity AAIOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity); + injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(AAIOwningEntity)); + } + + public boolean existsOwningEntity(OwningEntity owningEntity) { + AAIResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, + owningEntity.getOwningEntityId()); + return injectionHelper.getAaiClient().exists(owningEntityUri); + } + + public boolean existsOwningEntityName(String owningEntityName) { + AAIResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITIES).queryParam("owning-entity-name", owningEntityName); + AAIResourcesClient aaiRC = injectionHelper.getAaiClient(); + return aaiRC.exists(owningEntityUri); + } + + public void connectOwningEntityandServiceInstance(OwningEntity owningEntity, ServiceInstance serviceInstance) { + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, + owningEntity.getOwningEntityId()); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + serviceInstance.getServiceInstanceId()); + injectionHelper.getAaiClient().connect(owningEntityURI, serviceInstanceURI); + } + + public void createOwningEntityandConnectServiceInstance(OwningEntity owningEntity, + ServiceInstance serviceInstance) { + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, + owningEntity.getOwningEntityId()); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + serviceInstance.getServiceInstanceId()); + org.onap.aai.domain.yang.OwningEntity AAIOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity); + injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(AAIOwningEntity)).connect(owningEntityURI, + serviceInstanceURI); + } + + public void updateOrchestrationStatusServiceInstance(ServiceInstance serviceInstance, OrchestrationStatus orchestrationStatus){ + ServiceInstance copiedServiceInstance = serviceInstance.shallowCopyId(); + + copiedServiceInstance.setOrchestrationStatus(orchestrationStatus); + copiedServiceInstance.setServiceInstanceName(serviceInstance.getServiceInstanceName()); + serviceInstance.setOrchestrationStatus(orchestrationStatus); + updateServiceInstance(copiedServiceInstance); + } + + public void updateServiceInstance(ServiceInstance serviceInstance) { + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); + org.onap.aai.domain.yang.ServiceInstance AAIServiceInstance = aaiObjectMapper.mapServiceInstance(serviceInstance); + injectionHelper.getAaiClient().update(serviceInstanceURI, AAIServiceInstance); + } + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java new file mode 100644 index 0000000000..7fef56d965 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.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.client.orchestration; + +import java.util.Optional; + +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AAIVfModuleResources { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIVfModuleResources.class); + + @Autowired + private InjectionHelper injectionHelper; + + @Autowired + private AAIObjectMapper aaiObjectMapper; + + public void createVfModule(VfModule vfModule, GenericVnf vnf) { + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + vfModule.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + injectionHelper.getAaiClient().createIfNotExists(vfModuleURI, Optional.of(aaiObjectMapper.mapVfModule(vfModule))); + } + + public void deleteVfModule(VfModule vfModule, GenericVnf vnf) { + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + injectionHelper.getAaiClient().delete(vfModuleURI); + } + + public void updateOrchestrationStatusVfModule(VfModule vfModule, GenericVnf vnf, OrchestrationStatus orchestrationStatus) { + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + VfModule copiedVfModule = vfModule.shallowCopyId(); + + vfModule.setOrchestrationStatus(orchestrationStatus); + copiedVfModule.setOrchestrationStatus(orchestrationStatus); + org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule); + injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule); + } + + public void changeAssignVfModule(VfModule vfModule, GenericVnf vnf) { + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule); + injectionHelper.getAaiClient().update(vfModuleURI, AAIVfModule); + } + + public void connectVfModuleToVolumeGroup(GenericVnf vnf, VfModule vfModule, VolumeGroup volumeGroup, CloudRegion cloudRegion) { + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + AAIResourceUri volumeGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + injectionHelper.getAaiClient().connect(vfModuleURI, volumeGroupURI); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java new file mode 100644 index 0000000000..19025b4b9f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java @@ -0,0 +1,113 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import java.util.Optional; + +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AAIVnfResources { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIVnfResources.class); + + @Autowired + private InjectionHelper injectionHelper; + + @Autowired + private AAIObjectMapper aaiObjectMapper; + + public void createVnfandConnectServiceInstance(GenericVnf vnf, ServiceInstance serviceInstance) { + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + vnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + serviceInstance.getServiceInstanceId()); + injectionHelper.getAaiClient().createIfNotExists(vnfURI, Optional.of(aaiObjectMapper.mapVnf(vnf))).connect(vnfURI, serviceInstanceURI); + } + + public void createPlatformandConnectVnf(Platform platform, GenericVnf vnf) { + AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platform.getPlatformName()); + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + injectionHelper.getAaiClient().createIfNotExists(platformURI, Optional.of(platform)).connect(vnfURI, platformURI); + } + + public void createLineOfBusinessandConnectVnf(LineOfBusiness lineOfBusiness, GenericVnf vnf) { + AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness.getLineOfBusinessName()); + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + injectionHelper.getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.of(lineOfBusiness)).connect(vnfURI, lineOfBusinessURI); + } + + public void deleteVnf(GenericVnf vnf) { + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + injectionHelper.getAaiClient().delete(vnfURI); + } + + public void updateOrchestrationStatusVnf(GenericVnf vnf, OrchestrationStatus orchestrationStatus) { + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + + GenericVnf copiedVnf = vnf.shallowCopyId(); + + vnf.setOrchestrationStatus(orchestrationStatus); + copiedVnf.setOrchestrationStatus(orchestrationStatus); + injectionHelper.getAaiClient().update(vnfURI, aaiObjectMapper.mapVnf(copiedVnf)); + } + + public void updateObjectVnf(GenericVnf vnf) { + AAIResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + injectionHelper.getAaiClient().update(vnfUri, aaiObjectMapper.mapVnf(vnf)); + } + + /** + * Retrieve Generic VNF from AAI using vnf Id + * @param vnfId - vnf-id required vnf + * @return AAI Generic Vnf + */ + public Optional getGenericVnf( String vnfId) { + return injectionHelper.getAaiClient() + .get(org.onap.aai.domain.yang.GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)); + } + + /** + * Check inMaint flag value of Generic VNF from AAI using vnf Id + * @param vnfId - vnf-id required vnf + * @return inMaint flag value + */ + public boolean checkInMaintFlag(String vnfId) { + org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient() + .get(org.onap.aai.domain.yang.GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)) + .orElse(new org.onap.aai.domain.yang.GenericVnf()); + return vnf.isInMaint(); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java new file mode 100644 index 0000000000..70c6724921 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.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.client.orchestration; + +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AAIVolumeGroupResources { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIVolumeGroupResources.class); + + @Autowired + private InjectionHelper injectionHelper; + + @Autowired + private AAIObjectMapper aaiObjectMapper; + + public void createVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) { + AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + injectionHelper.getAaiClient().create(uriVolumeGroup, aaiObjectMapper.mapVolumeGroup(volumeGroup)); + } + + public void updateOrchestrationStatusVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion, OrchestrationStatus orchestrationStatus) { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId(); + + volumeGroup.setOrchestrationStatus(orchestrationStatus); + copiedVolumeGroup.setOrchestrationStatus(orchestrationStatus); + injectionHelper.getAaiClient().update(uri, aaiObjectMapper.mapVolumeGroup(copiedVolumeGroup)); + } + + public void connectVolumeGroupToVnf(GenericVnf genericVnf, VolumeGroup volumeGroup, CloudRegion cloudRegion) { + AAIResourceUri uriGenericVnf = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId()); + AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + injectionHelper.getAaiClient().connect(uriGenericVnf, uriVolumeGroup); + } + + public void connectVolumeGroupToTenant(VolumeGroup volumeGroup , CloudRegion cloudRegion) { + AAIResourceUri uriTenant = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(),cloudRegion.getTenantId()); + AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + injectionHelper.getAaiClient().connect(uriTenant, uriVolumeGroup); + } + + public void deleteVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + injectionHelper.getAaiClient().delete(uri); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java new file mode 100644 index 0000000000..8bd55f0f90 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java @@ -0,0 +1,101 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import java.util.Optional; + +import javax.ws.rs.NotFoundException; + +import org.onap.aai.domain.yang.VpnBindings; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AAIVpnBindingResources { + @Autowired + private InjectionHelper injectionHelper; + + @Autowired + private AAIObjectMapper aaiObjectMapper; + + /** + * @param customer + */ + public boolean existsCustomer(Customer customer) { + AAIResourceUri uriCustomer = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, customer.getGlobalCustomerId()); + return injectionHelper.getAaiClient().exists(uriCustomer); + } + + /** + * @param customerVpnId + * @return + */ + public Optional getVpnBindingByCustomerVpnId (String customerVpnId) { + AAIResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDINGS) + .queryParam("customer-vpn-id",customerVpnId); + return injectionHelper.getAaiClient().get(VpnBindings.class,aaiVpnBindingsResourceUri); + + } + + /** + * @param vpnBinding + */ + public void createVpnBinding(VpnBinding vpnBinding) { + AAIResourceUri aaiVpnBindingResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING,vpnBinding.getVpnId()); + injectionHelper.getAaiClient().create(aaiVpnBindingResourceUri, aaiObjectMapper.mapVpnBinding(vpnBinding)); + } + + /** + * @param customer + */ + public void createCustomer(Customer customer) { + AAIResourceUri uriCustomer = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, customer.getGlobalCustomerId()); + injectionHelper.getAaiClient().create(uriCustomer, aaiObjectMapper.mapCustomer(customer)); + } + + /** + * Retrieve VPN Binding from AAI using vpn-id + * @param vpnId - vpn-id required VPN Binding + * @return AAI VPN Binding + */ + public Optional getVpnBinding(String vpnId){ + return injectionHelper.getAaiClient() + .get(org.onap.aai.domain.yang.VpnBinding.class, AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId)); + } + + + /** + * @param globalSubscriberId + * @param vpnId + */ + public void connectCustomerToVpnBinding(String globalSubscriberId, String vpnId) { + AAIResourceUri customerURI = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId); + AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING,vpnId); + injectionHelper.getAaiClient().connect(customerURI, vpnBindingURI); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java new file mode 100644 index 0000000000..3e2b66befa --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.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.client.orchestration; + +import java.io.UnsupportedEncodingException; +import java.util.Map; +import java.util.Optional; + +import org.onap.so.adapters.nwrest.CreateNetworkRequest; +import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.adapters.nwrest.DeleteNetworkRequest; +import org.onap.so.adapters.nwrest.DeleteNetworkResponse; +import org.onap.so.adapters.nwrest.RollbackNetworkRequest; +import org.onap.so.adapters.nwrest.RollbackNetworkResponse; +import org.onap.so.adapters.nwrest.UpdateNetworkRequest; +import org.onap.so.adapters.nwrest.UpdateNetworkResponse; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.adapter.network.NetworkAdapterClientException; +import org.onap.so.client.adapter.network.NetworkAdapterClientImpl; +import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class NetworkAdapterResources { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkAdapterResources.class); + + @Autowired + private NetworkAdapterClientImpl networkAdapterClient; + + @Autowired + private NetworkAdapterObjectMapper networkAdapterObjectMapper; + + public Optional createNetwork(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map userInput, String cloudRegionPo, Customer customer) throws UnsupportedEncodingException, NetworkAdapterClientException { + + CreateNetworkRequest createNetworkRequest = networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer); + return Optional.of(networkAdapterClient.createNetwork(createNetworkRequest)); + } + + public Optional rollbackCreateNetwork(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map userInput, String cloudRegionPo, CreateNetworkResponse createNetworkResponse) throws UnsupportedEncodingException, NetworkAdapterClientException { + + RollbackNetworkRequest rollbackNetworkRequest = null; + rollbackNetworkRequest = networkAdapterObjectMapper.createNetworkRollbackRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse); + + return Optional.of(networkAdapterClient.rollbackNetwork(l3Network.getNetworkId(), rollbackNetworkRequest)); + } + + public Optional updateNetwork(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map userInput, Customer customer) throws UnsupportedEncodingException, NetworkAdapterClientException { + UpdateNetworkRequest updateNetworkRequest = networkAdapterObjectMapper.createNetworkUpdateRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer); + + return Optional.of(networkAdapterClient.updateNetwork(l3Network.getNetworkId(), updateNetworkRequest)); + } + + public Optional deleteNetwork(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, L3Network l3Network) throws UnsupportedEncodingException, NetworkAdapterClientException { + + DeleteNetworkRequest deleteNetworkRequest = networkAdapterObjectMapper.deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network); + return Optional.of(networkAdapterClient.deleteNetwork(l3Network.getNetworkId(), deleteNetworkRequest)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java new file mode 100644 index 0000000000..66256ca72e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java @@ -0,0 +1,130 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + + +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import org.onap.sdnc.apps.client.model.GenericResourceApiGcTopologyOperationInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; + +@Component +public class SDNCConfigurationResources { + @Autowired + private GCTopologyOperationRequestMapper sdncRM; + + @Autowired + private SDNCClient sdncClient; + + /** + * SDN-C call to assign configuration after it was created in A&AI + * + * @param serviceInstance + * @param requestContext + * @param vnrConfiguration + * @param voiceVnf + * @return + * @throws MapperException + * @throws BadResponseException + */ + public String assignVnrConfiguration(ServiceInstance serviceInstance, + RequestContext requestContext, + Customer customer, + Configuration vnrConfiguration, + GenericVnf voiceVnf) + throws MapperException, BadResponseException { + GenericResourceApiGcTopologyOperationInformation sdncReq = sdncRM.assignOrActivateVnrReqMapper( + SDNCSvcAction.ASSIGN, + GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE , + serviceInstance , requestContext, customer, vnrConfiguration,voiceVnf); + return sdncClient.post(sdncReq, SDNCTopology.CONFIGURATION); + } + + /** + * SDNC Call to Activate VNR Configuration + * + * @param serviceInstance + * @param requestContext + * @param vnrConfiguration + * @param voiceVnf + * @return + * @throws MapperException + * @throws BadResponseException + */ + public String activateVnrConfiguration(ServiceInstance serviceInstance, + RequestContext requestContext, + Customer customer, + Configuration vnrConfiguration, + GenericVnf voiceVnf) + throws MapperException, BadResponseException { + + GenericResourceApiGcTopologyOperationInformation sdncReq = sdncRM.assignOrActivateVnrReqMapper( + SDNCSvcAction.ACTIVATE, + GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE , + serviceInstance , requestContext, customer, vnrConfiguration, voiceVnf); + return sdncClient.post(sdncReq, SDNCTopology.CONFIGURATION); + } + + /** + * method to unAssign Vnr Configuration in SDNC + * + * @param serviceInstance + * @param requestContext + * @param vnrConfiguration + * @return + * @throws BadResponseException + * @throws MapperException + */ + public String unAssignVnrConfiguration(ServiceInstance serviceInstance, RequestContext requestContext, + Configuration vnrConfiguration) throws BadResponseException, MapperException { + + GenericResourceApiGcTopologyOperationInformation sdncReq = sdncRM.deactivateOrUnassignVnrReqMapper + (SDNCSvcAction.UNASSIGN,serviceInstance, requestContext, vnrConfiguration); + return sdncClient.post(sdncReq, SDNCTopology.CONFIGURATION); + } + + /*** + * Deactivate VNR SDNC Call + * @param serviceInstance + * @param requestContext + * @param vnrConfiguration + * @throws BadResponseException + * @throws MapperException + */ + public String deactivateVnrConfiguration(ServiceInstance serviceInstance, RequestContext requestContext, Configuration vnrConfiguration) throws BadResponseException, MapperException { + GenericResourceApiGcTopologyOperationInformation sdncReq = sdncRM.deactivateOrUnassignVnrReqMapper( + SDNCSvcAction.DEACTIVATE, + serviceInstance , requestContext, vnrConfiguration); + return sdncClient.post(sdncReq, SDNCTopology.CONFIGURATION); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java new file mode 100644 index 0000000000..02dd1e418d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.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.client.orchestration; + +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import org.onap.sdnc.apps.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; + +@Component +public class SDNCNetworkResources { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCNetworkResources.class); + + @Autowired + private NetworkTopologyOperationRequestMapper sdncRM; + + @Autowired + private SDNCClient sdncClient; + + public String assignNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer, + RequestContext requestContext, CloudRegion cloudRegion) + throws MapperException, BadResponseException { + + GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, + SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); + return sdncClient.post(sdncReq, SDNCTopology.NETWORK); + } + + public String rollbackAssignNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer, + RequestContext requestContext, CloudRegion cloudRegion) + throws MapperException, BadResponseException { + + GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, + SDNCSvcAction.UNASSIGN, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); + return sdncClient.post(sdncReq, SDNCTopology.NETWORK); + } + + public String activateNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer, + RequestContext requestContext, CloudRegion cloudRegion) + throws MapperException, BadResponseException { + + GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, + SDNCSvcAction.ACTIVATE, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); + return sdncClient.post(sdncReq, SDNCTopology.NETWORK); + } + + public String deactivateNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer, RequestContext requestContext, CloudRegion cloudRegion) throws MapperException, BadResponseException { + GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, + SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); + return sdncClient.post(sdncReq, SDNCTopology.NETWORK); + } + + public String deleteNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer, + RequestContext requestContext, CloudRegion cloudRegion) + throws MapperException, BadResponseException { + + GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, + SDNCSvcAction.DELETE, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); + return sdncClient.post(sdncReq, SDNCTopology.NETWORK); + } + + public String changeAssignNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer, + RequestContext requestContext, CloudRegion cloudRegion) + throws MapperException, BadResponseException { + + GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); + return sdncClient.post(sdncReq, SDNCTopology.NETWORK); + } + + public String unassignNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer, + RequestContext requestContext, CloudRegion cloudRegion) + throws MapperException, BadResponseException { + + GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, + SDNCSvcAction.UNASSIGN, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); + return sdncClient.post(sdncReq, SDNCTopology.NETWORK); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java new file mode 100644 index 0000000000..1357d40604 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java @@ -0,0 +1,124 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.client.sdnc.mapper.ServiceTopologyOperationMapper; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiServiceOperationInformation; + +@Component +public class SDNCServiceInstanceResources { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, + SDNCServiceInstanceResources.class); + + @Autowired + private ServiceTopologyOperationMapper sdncRM; + + @Autowired + private SDNCClient sdncClient; + + /** + * SDNC call to perform Service Topology Assign for ServiceInsatnce + * @param serviceInstance + * @param customer + * @param requestContext + * @throws MapperException + * @throws BadResponseException + * @return the response as a String + */ + public String assignServiceInstance(ServiceInstance serviceInstance, Customer customer, + RequestContext requestContext) throws MapperException, BadResponseException { + GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper( + SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, + requestContext); + return sdncClient.post(sdncReq, SDNCTopology.SERVICE); + } + + /** + * SDNC call to perform Service Topology Delete for ServiceInsatnce + * @param serviceInstance + * @param customer + * @param requestContext + * @throws MapperException + * @throws BadResponseException + * @return the response as a String + */ + public String deleteServiceInstance(ServiceInstance serviceInstance, Customer customer, + RequestContext requestContext) throws MapperException, BadResponseException { + GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper( + SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE, GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer, + requestContext); + return sdncClient.post(sdncReq, SDNCTopology.SERVICE); + } + + public String unassignServiceInstance(ServiceInstance serviceInstance, Customer customer, + RequestContext requestContext) throws MapperException, BadResponseException { + GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper( + SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE, GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer, + requestContext); + return sdncClient.post(sdncReq, SDNCTopology.SERVICE); + } + + /** + * SDNC call to perform Service Topology Deactivate for ServiceInstance + * @param serviceInstance + * @param customer + * @param requestContext + * @throws MapperException + * @throws BadResponseException + * @return the response as a String + */ + public String deactivateServiceInstance(ServiceInstance serviceInstance, Customer customer, + RequestContext requestContext) throws MapperException, BadResponseException { + GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper( + SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer, + requestContext); + return sdncClient.post(sdncReq, SDNCTopology.SERVICE); + } + + /** + * SDNC call to perform Service Topology Change Assign for the ServiceInstance + * @param serviceInstance + * @param customer + * @param requestContext + * @throws MapperException + * @throws BadResponseException + * @return the response as a String + */ + public String changeModelServiceInstance(ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) throws MapperException, BadResponseException { + GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, requestContext); + return sdncClient.post(sdncReq, SDNCTopology.SERVICE); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java new file mode 100644 index 0000000000..e2146dda99 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java @@ -0,0 +1,99 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import org.onap.sdnc.apps.client.model.GenericResourceApiVfModuleOperationInformation; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class SDNCVfModuleResources { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCVfModuleResources.class); + + @Autowired + private VfModuleTopologyOperationRequestMapper sdncRM; + + @Autowired + private SDNCClient sdncClient; + + public String assignVfModule(VfModule vfModule, VolumeGroup volumeGroup,GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, + CloudRegion cloudRegion, RequestContext requestContext) + throws MapperException, BadResponseException { + + GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, + SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null); + return sdncClient.post(sdncReq, SDNCTopology.VFMODULE); + } + + public String unassignVfModule(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance) + throws MapperException, BadResponseException { + + GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, + SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, null, null); + return sdncClient.post(sdncReq, SDNCTopology.VFMODULE); + } + + public String deactivateVfModule(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, + Customer customer, CloudRegion cloudRegion, RequestContext requestContext) + throws MapperException, BadResponseException { + + GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper( + SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null, vnf, serviceInstance, + customer, cloudRegion, requestContext, null); + return sdncClient.post(sdncReq, SDNCTopology.VFMODULE); + } + + public String queryVfModule(VfModule vfModule) + throws MapperException, BadResponseException { + + String objectPath = vfModule.getSelflink(); + return sdncClient.get(objectPath); + } + + public String activateVfModule(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, + CloudRegion cloudRegion, RequestContext requestContext) + throws MapperException, BadResponseException { + + GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, + SDNCSvcAction.ACTIVATE, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext, null); + return sdncClient.post(sdncReq, SDNCTopology.VFMODULE); + } + + public String changeAssignVfModule(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext) throws MapperException, BadResponseException { + GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext, null); + return sdncClient.post(sdncReq, SDNCTopology.VFMODULE); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java new file mode 100644 index 0000000000..c43deb13d2 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java @@ -0,0 +1,105 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiVnfOperationInformation; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class SDNCVnfResources { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCVnfResources.class); + + @Autowired + private VnfTopologyOperationRequestMapper sdncRM; + + @Autowired + private SDNCClient sdncClient; + + public String assignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, + CloudRegion cloudRegion, RequestContext requestContext, boolean homing) + throws MapperException, BadResponseException { + GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, + SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, homing); + return sdncClient.post(sdncReq, SDNCTopology.VNF); + } + + public String activateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, + CloudRegion cloudRegion, RequestContext requestContext) + throws MapperException, BadResponseException { + GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, + SDNCSvcAction.ACTIVATE,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,cloudRegion, requestContext, false); + return sdncClient.post(sdncReq, SDNCTopology.VNF); + } + + + public String deactivateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, + CloudRegion cloudRegion, RequestContext requestContext) + throws MapperException, BadResponseException { + GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, + SDNCSvcAction.DEACTIVATE,GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,cloudRegion, requestContext, false); + return sdncClient.post(sdncReq, SDNCTopology.VNF); + } + + + public String unassignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, + CloudRegion cloudRegion, RequestContext requestContext) + throws MapperException, BadResponseException { + GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, + SDNCSvcAction.UNASSIGN,GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, false); + return sdncClient.post(sdncReq, SDNCTopology.VNF); + } + + public String deleteVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, + CloudRegion cloudRegion, RequestContext requestContext) + throws MapperException, BadResponseException { + GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, + SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE,vnf, serviceInstance, customer, cloudRegion, requestContext, false); + return sdncClient.post(sdncReq, SDNCTopology.VNF); + } + + public String changeModelVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, + CloudRegion cloudRegion, RequestContext requestContext) + throws MapperException, BadResponseException { + GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, + SDNCSvcAction.CHANGE_ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, false); + return sdncClient.post(sdncReq, SDNCTopology.VNF); + } + + public String queryVnf(GenericVnf vnf) throws MapperException, BadResponseException { + String queryPath = vnf.getSelflink(); + return sdncClient.get(queryPath); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNOHealthCheckResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNOHealthCheckResources.java new file mode 100644 index 0000000000..dac89a495d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNOHealthCheckResources.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.client.orchestration; + +import java.util.UUID; + +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class SDNOHealthCheckResources { + @Autowired + private InjectionHelper injectionHelper; + + /** + * SDNO Call to Check Health Status + * + * @param vnf + * @param requestContext * + * @return healthCheckResult + * @throws + * @throws Exception + */ + public boolean healthCheck(GenericVnf vnf, RequestContext requestContext) throws Exception { + String requestId = requestContext.getMsoRequestId(); + String requestorId = requestContext.getRequestorId(); + String vnfId = vnf.getVnfId(); + UUID uuid = UUID.fromString(requestId); + + return injectionHelper.getSdnoValidator().healthDiagnostic(vnfId, uuid, requestorId); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java new file mode 100644 index 0000000000..e52616677d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.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.client.orchestration; + +import java.io.IOException; + +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; +import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class VnfAdapterVfModuleResources { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterVfModuleResources.class); + + @Autowired + private VnfAdapterVfModuleObjectMapper vnfAdapterVfModuleObjectMapper; + + public CreateVfModuleRequest createVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, + VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws IOException { + return vnfAdapterVfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + } + + public DeleteVfModuleRequest deleteVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion, + ServiceInstance serviceInstance, GenericVnf genericVnf, + VfModule vfModule) throws IOException { + return vnfAdapterVfModuleObjectMapper.deleteVfModuleRequestMapper(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java new file mode 100644 index 0000000000..8655104830 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.adapter.vnf.VnfVolumeAdapterClientImpl; +import org.onap.so.client.adapter.vnf.mapper.VnfAdapterObjectMapper; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class VnfAdapterVolumeGroupResources { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterVolumeGroupResources.class); + + @Autowired + private VnfAdapterObjectMapper vnfAdapterObjectMapper; + + @Autowired + private VnfVolumeAdapterClientImpl vnfVolumeAdapterClient; + + public CreateVolumeGroupRequest createVolumeGroupRequest(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws Exception { + return vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse); + } + + public DeleteVolumeGroupResponse deleteVolumeGroup(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws Exception { + DeleteVolumeGroupRequest deleteVolumeGroupRequest = vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup); + msoLogger.debug(deleteVolumeGroupRequest.toString()); + return vnfVolumeAdapterClient.deleteVNFVolumes(volumeGroup.getVolumeGroupId(), deleteVolumeGroupRequest); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java new file mode 100644 index 0000000000..1ce7a92eb5 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.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.client.sdnc; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.util.Collections; + +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.http.client.BufferingClientHttpRequestFactory; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; + +//TODO move to common location +public class BaseClient { + + private HttpHeaders httpHeader; + private String targetUrl; + + public HttpHeaders getHttpHeader() { + return httpHeader; + } + + public void setHttpHeader(HttpHeaders httpHeader) { + this.httpHeader = httpHeader; + } + + public String getTargetUrl() { + return targetUrl; + } + + public void setTargetUrl(String targetUrl) { + this.targetUrl = targetUrl; + } + + public O get(I data, Object... uriVariables) throws RestClientException { + return run(data, HttpMethod.GET, uriVariables); + } + + public O post(I data, Object... uriVariables) throws RestClientException { + return run(data, HttpMethod.POST, uriVariables); + } + + public O run(I data, HttpMethod method, Object... uriVariables) throws RestClientException { + HttpEntity requestEntity = new HttpEntity(data, getHttpHeader()); + RestTemplate restTemplate = new RestTemplate(); + ObjectMapper mapper = new ObjectMapper(); + MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); + converter.setObjectMapper(mapper); + mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + restTemplate.getMessageConverters().add(0, converter); + restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory())); + ParameterizedTypeReference output = new ParameterizedTypeReference() {}; + ResponseEntity responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, output, + uriVariables); + return responseEntity.getBody(); + } + +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java new file mode 100644 index 0000000000..1f0d654a85 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java @@ -0,0 +1,92 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.sdnc; + +import java.util.LinkedHashMap; +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.beans.SDNCProperties; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +import org.springframework.stereotype.Component; + +@Component +public class SDNCClient { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCClient.class); + private BaseClient> STOClient = new BaseClient<>(); + + @Autowired + private SDNCProperties properties; + @Autowired + private SdnCommonTasks sdnCommonTasks; + /** + * + * @param request + * - takes in a generated object from sdnc client + * - creates a json request string and sends it to sdnc + * - receives and validates the linkedhashmap sent back from sdnc + * @throws MapperException + * @throws BadResponseException + */ + public String post(Object request, SDNCTopology topology) throws MapperException, BadResponseException { + String jsonRequest = sdnCommonTasks.buildJsonRequest(request); + String targetUrl = properties.getHost() + properties.getPath() + ":" + topology.toString() + "/"; + STOClient.setTargetUrl(targetUrl); + HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth()); + STOClient.setHttpHeader(httpHeader); + msoLogger.info("Running SDNC CLIENT for TargetUrl: " + targetUrl); + LinkedHashMap output = STOClient.post(jsonRequest); + msoLogger.info("Validating output..."); + return sdnCommonTasks.validateSDNResponse(output); + } + + + /** + * + * @param queryLink + * - takes in a link to topology that needs to be queried + * - creates a json request string and sends it to sdnc + * - receives and validates the linkedhashmap sent back from sdnc + * * + * @throws MapperException + * @throws BadResponseException + */ + public String get(String queryLink) throws MapperException, BadResponseException { + + String request = ""; + String jsonRequest = sdnCommonTasks.buildJsonRequest(request); + String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString(); + STOClient.setTargetUrl(targetUrl); + msoLogger.info("TargetUrl: " + targetUrl); + HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth()); + STOClient.setHttpHeader(httpHeader); + msoLogger.info("Running SDNC CLIENT..."); + LinkedHashMap output = STOClient.get(jsonRequest); + msoLogger.info("Validating output..."); + return sdnCommonTasks.validateSDNGetResponse(output); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java new file mode 100644 index 0000000000..d35296af9b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java @@ -0,0 +1,138 @@ +/*- + * ============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.client.sdnc; + +import java.util.LinkedHashMap; + +import org.apache.commons.lang.StringUtils; +import org.apache.http.HttpStatus; +import org.json.JSONObject; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Component +public class SdnCommonTasks { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCClient.class); + private static final String RESPONSE_CODE = "response-code"; + private static final String RESPONSE_MESSAGE = "response-message"; + private static final String NO_RESPONSE_FROM_SDNC = "Error did not receive a response from SDNC."; + private static final String BAD_RESPONSE_FROM_SDNC = "Error received a bad response from SDNC."; + private static final String SDNC_CODE_NOT_0_OR_IN_200_299 = "Error from SDNC: %s"; + private static final String COULD_NOT_CONVERT_SDNC_POJO_TO_JSON = "ERROR: Could not convert SDNC pojo to json string."; + + /*** + * + * @param request + * @return + * @throws MapperException + */ + public String buildJsonRequest(Object request) throws MapperException { + String jsonRequest; + ObjectMapper objMapper = new ObjectMapper(); + objMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + try { + jsonRequest = objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(request); + } catch (JsonProcessingException e) { + msoLogger.error(MessageEnum.JAXB_EXCEPTION, COULD_NOT_CONVERT_SDNC_POJO_TO_JSON, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, e.getMessage()); + throw new MapperException(COULD_NOT_CONVERT_SDNC_POJO_TO_JSON); + } + jsonRequest = "{\"input\":" + jsonRequest + "}"; + msoLogger.info(jsonRequest); + return jsonRequest; + } + + /*** + * + * @param auth + * @return + */ + public HttpHeaders getHttpHeaders(String auth) { + HttpHeaders httpHeader = new HttpHeaders(); + httpHeader.set("Authorization", auth); + httpHeader.setContentType(MediaType.APPLICATION_JSON); + return httpHeader; + } + + /*** + * + * @param output + * @return + * @throws BadResponseException + */ + public String validateSDNResponse(LinkedHashMap output) throws BadResponseException { + if (CollectionUtils.isEmpty(output)) { + msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, NO_RESPONSE_FROM_SDNC, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_SDNC); + throw new BadResponseException(NO_RESPONSE_FROM_SDNC); + } + String responseCode = (String) output.get(RESPONSE_CODE); + String responseMessage = (String) output.get(RESPONSE_MESSAGE); + msoLogger.info("ResponseCode: " + responseCode + " ResponseMessage: " + responseMessage); + int code = StringUtils.isNotEmpty(responseCode) ? Integer.parseInt(responseCode) : 0; + if (isHttpCodeSuccess(code)) { + msoLogger.info("Successful Response from SDNC"); + return responseMessage; + } else { + String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage); + msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, errorMessage); + throw new BadResponseException(errorMessage); + } + } + + /*** + * + * @param output + * @return + * @throws BadResponseException + */ + public String validateSDNGetResponse(LinkedHashMap output) throws BadResponseException { + if (CollectionUtils.isEmpty(output)) { + msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, NO_RESPONSE_FROM_SDNC, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_SDNC); + throw new BadResponseException(NO_RESPONSE_FROM_SDNC); + } + ObjectMapper objMapper = new ObjectMapper(); + msoLogger.debug("Using object mapper"); + String stringOutput = ""; + try { + stringOutput = objMapper.writeValueAsString(output); + } + catch (Exception e) { + msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, BAD_RESPONSE_FROM_SDNC, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, BAD_RESPONSE_FROM_SDNC); + throw new BadResponseException(BAD_RESPONSE_FROM_SDNC); + } + msoLogger.debug("Received from GET request: " + stringOutput); + return stringOutput; + } + + private boolean isHttpCodeSuccess(int code) { + return code >= HttpStatus.SC_OK && code < HttpStatus.SC_MULTIPLE_CHOICES || code == 0; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java new file mode 100644 index 0000000000..08be73e3fd --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.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.client.sdnc.beans; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ConfigurationProperties(prefix="sdnc") +public class SDNCProperties { + + private String host; + private String path; + private String auth; + + public String getHost() { + return host; + } + public void setHost(String host) { + this.host = host; + } + public String getPath() { + return path; + } + public void setPath(String path) { + this.path = path; + } + public String getAuth() { + return auth; + } + public void setAuth(String auth) { + this.auth = auth; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java new file mode 100644 index 0000000000..5f7ebdd867 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.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.client.sdnc.beans; + +import org.onap.sdnc.apps.client.model.GenericResourceApiSvcActionEnumeration; + +public enum SDNCSvcAction { + ACTIVATE("activate",GenericResourceApiSvcActionEnumeration.ACTIVATE), + DELETE("delete",GenericResourceApiSvcActionEnumeration.DELETE), + ASSIGN("assign",GenericResourceApiSvcActionEnumeration.ASSIGN), + ROLLBACK("rollback",GenericResourceApiSvcActionEnumeration.ROLLBACK), + UNASSIGN("unassign",GenericResourceApiSvcActionEnumeration.UNASSIGN), + DEACTIVATE("deactivate",GenericResourceApiSvcActionEnumeration.DEACTIVATE), + CHANGE_DELETE("changedelete",GenericResourceApiSvcActionEnumeration.CHANGEDELETE), + CHANGE_ASSIGN("changeassign",GenericResourceApiSvcActionEnumeration.CHANGEASSIGN), + CREATE("create",GenericResourceApiSvcActionEnumeration.CREATE), + ENABLE("enable",GenericResourceApiSvcActionEnumeration.ENABLE), + DISABLE("disable",GenericResourceApiSvcActionEnumeration.DISABLE); + + private final String name; + + private GenericResourceApiSvcActionEnumeration sdncApiAction ; + + private SDNCSvcAction(String name , GenericResourceApiSvcActionEnumeration sdncApiAction) { + this.name = name; + this.sdncApiAction = sdncApiAction; + } + + public GenericResourceApiSvcActionEnumeration getSdncApiAction(){ + return this.sdncApiAction; + } + + @Override + public String toString() { + return name; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java new file mode 100644 index 0000000000..ba9fedccac --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.sdnc.beans; + +public enum SDNCSvcOperation { + + VF_MODULE_TOPOLOGY_OPERATION("vf-module-topology-operation"), + NETWORK_TOPOLOGY_OPERATION("network-topology-operation"), + VNF_TOPOLOGY_OPERATION("vnf-topology-operation"), + CONTRAIL_ROUTE_TOPOLOGY_OPERATION("contrail-route-topology-operation"), + SECURITY_ZONE_TOPOLOGY_OPERATION("security-zone-topology-operation"), + PORT_MIRROR_TOPOLOGY_OPERATION("port-mirror-topology-operation"), + SERVICE_TOPOLOGY_OPERATION("service-topology-operation"), + GENERIC_CONFIGURATION_TOPOLOGY_OPERATION("generic-configuration-topology-operation"); + + private final String name; + + private SDNCSvcOperation(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java new file mode 100644 index 0000000000..a709e80220 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.sdnc.endpoint; + +public enum SDNCTopology { + + SERVICE("service-topology-operation"), + VNF("vnf-topology-operation"), + VFMODULE("vf-module-topology-operation"), + CONTRAILROUTE("contrail-route-topology-operation"), + PORTMIRROR("port-mirror-topology-operation"), + NETWORK("network-topology-operation"), + SECURITYZONE("security-zone-topology-operation"), + CONFIGURATION("generic-configuration-topology-operation"); + + private final String topology; + + private SDNCTopology(String topology) { + this.topology = topology; + } + + @Override + public String toString(){ + return this.topology; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java new file mode 100644 index 0000000000..8d71cdd923 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java @@ -0,0 +1,86 @@ +/*- + * ============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.client.sdnc.mapper; + +import org.onap.sdnc.apps.client.model.*; +import org.onap.so.bpmn.servicedecomposition.bbobjects.*; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.springframework.stereotype.Component; + +@Component(value = "sdncGCTopologyOperationRequestMapper") +public class GCTopologyOperationRequestMapper { + + private static final GeneralTopologyObjectMapper generalTopologyObjectMapper = new GeneralTopologyObjectMapper(); + + public GenericResourceApiGcTopologyOperationInformation assignOrActivateVnrReqMapper(SDNCSvcAction svcAction, + GenericResourceApiRequestActionEnumeration reqAction, + ServiceInstance serviceInstance, + RequestContext requestContext, + Customer customer, + Configuration vnrConfiguration, + GenericVnf voiceVnf) { + + GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation(); + String sdncReqId = requestContext.getMsoRequestId(); + GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);// TODO Set URL + GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, reqAction); + GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, false); + GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = generalTopologyObjectMapper.buildConfigurationInformation(vnrConfiguration,true); + GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = generalTopologyObjectMapper.buildGcRequestInformation(voiceVnf,null); + req.setRequestInformation(requestInformation); + req.setSdncRequestHeader(sdncRequestHeader); + req.setServiceInformation(serviceInformation); + req.setConfigurationInformation(configurationInformation); + req.setGcRequestInput(gcRequestInput); + + return req; + + } + + + public GenericResourceApiGcTopologyOperationInformation deactivateOrUnassignVnrReqMapper(SDNCSvcAction svcAction, + ServiceInstance serviceInstance, + RequestContext requestContext, + Configuration vnrConfiguration) { + + GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation(); + String sdncReqId = requestContext.getMsoRequestId(); + GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = + generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);// TODO Set URL + GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper + .buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, + GenericResourceApiRequestActionEnumeration.DELETEGENERICCONFIGURATIONINSTANCE); + GenericResourceApiServiceinformationServiceInformation serviceInformation = new GenericResourceApiServiceinformationServiceInformation(); + serviceInformation.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = + new GenericResourceApiConfigurationinformationConfigurationInformation(); + configurationInformation.setConfigurationId(vnrConfiguration.getConfigurationId()); + req.setRequestInformation(requestInformation); + req.setSdncRequestHeader(sdncRequestHeader); + req.setServiceInformation(serviceInformation); + req.setConfigurationInformation(configurationInformation); + return req; + + } + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java new file mode 100644 index 0000000000..a62168e9a2 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java @@ -0,0 +1,172 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.sdnc.mapper; + +import org.onap.sdnc.apps.client.model.*; +import org.onap.so.bpmn.servicedecomposition.bbobjects.*; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.springframework.stereotype.Component; + +@Component +public class GeneralTopologyObjectMapper { + + /* + * Build GenericResourceApiRequestinformationRequestInformation + */ + public GenericResourceApiRequestinformationRequestInformation buildGenericResourceApiRequestinformationRequestInformation(String sdncReqId, GenericResourceApiRequestActionEnumeration requestAction){ + + GenericResourceApiRequestinformationRequestInformation requestInformation = new GenericResourceApiRequestinformationRequestInformation(); + requestInformation.setRequestId(sdncReqId); + requestInformation.setRequestAction(requestAction); + requestInformation.setSource("MSO"); + return requestInformation; + } + /* + * Build GenericResourceApiServiceinformationServiceInformation + */ + public GenericResourceApiServiceinformationServiceInformation buildServiceInformation(ServiceInstance serviceInstance, RequestContext requestContext, Customer customer, boolean includeModelInformation){ + GenericResourceApiServiceinformationServiceInformation serviceInformation = new GenericResourceApiServiceinformationServiceInformation(); + serviceInformation.serviceId(serviceInstance.getServiceInstanceId()); + if (requestContext != null) { + serviceInformation.setSubscriptionServiceType(requestContext.getProductFamilyId()); + } + if (includeModelInformation) { + GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation(); + onapModelInformation.setModelInvariantUuid(serviceInstance.getModelInfoServiceInstance().getModelInvariantUuid()); + onapModelInformation.setModelVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion()); + onapModelInformation.setModelName(serviceInstance.getModelInfoServiceInstance().getModelName()); + onapModelInformation.setModelUuid(serviceInstance.getModelInfoServiceInstance().getModelUuid()); + serviceInformation.setOnapModelInformation(onapModelInformation ); + } + serviceInformation.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + + if (customer != null) { + serviceInformation.setGlobalCustomerId(customer.getGlobalCustomerId()); + if(customer.getServiceSubscription() != null){ + serviceInformation.setSubscriptionServiceType(customer.getServiceSubscription().getServiceType()); + } + + } + return serviceInformation; + } + /* + * Build GenericResourceApiNetworkinformationNetworkInformation + */ + public GenericResourceApiNetworkinformationNetworkInformation buildNetworkInformation(L3Network network){ + GenericResourceApiNetworkinformationNetworkInformation networkInformation = new GenericResourceApiNetworkinformationNetworkInformation(); + GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation(); + if (network.getModelInfoNetwork() != null) { + onapModelInformation.setModelInvariantUuid(network.getModelInfoNetwork().getModelInvariantUUID()); + onapModelInformation.setModelName(network.getModelInfoNetwork().getModelName()); + onapModelInformation.setModelVersion(network.getModelInfoNetwork().getModelVersion()); + onapModelInformation.setModelUuid(network.getModelInfoNetwork().getModelUUID()); + onapModelInformation.setModelCustomizationUuid(network.getModelInfoNetwork().getModelCustomizationUUID()); + networkInformation.setOnapModelInformation(onapModelInformation); + } + networkInformation.setNetworkId(network.getNetworkId()); + //TODO fix this after network type filed included in L3Network object type + //networkInformation.setNetworkType(network.getNetwork); + return networkInformation; + } + /* + * Build GenericResourceApiVnfinformationVnfInformation + */ + public GenericResourceApiVnfinformationVnfInformation buildVnfInformation(GenericVnf vnf, ServiceInstance serviceInstance, boolean includeModelInformation){ + GenericResourceApiVnfinformationVnfInformation vnfInformation = new GenericResourceApiVnfinformationVnfInformation(); + if (includeModelInformation && vnf.getModelInfoGenericVnf() != null) { + GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation(); + onapModelInformation.setModelInvariantUuid(vnf.getModelInfoGenericVnf().getModelInvariantUuid()); + onapModelInformation.setModelName(vnf.getModelInfoGenericVnf().getModelName()); + onapModelInformation.setModelVersion(vnf.getModelInfoGenericVnf().getModelVersion()); + onapModelInformation.setModelUuid(vnf.getModelInfoGenericVnf().getModelUuid()); + onapModelInformation.setModelCustomizationUuid(vnf.getModelInfoGenericVnf().getModelCustomizationUuid()); + vnfInformation.setOnapModelInformation(onapModelInformation); + } + vnfInformation.setVnfId(vnf.getVnfId()); + vnfInformation.setVnfType(vnf.getVnfType()); + vnfInformation.setVnfName(vnf.getVnfName()); + return vnfInformation; + } + /* + * Build GenericResourceApiVfModuleinformationVfModuleInformation + */ + public GenericResourceApiVfmoduleinformationVfModuleInformation buildVfModuleInformation(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, boolean includeModelInformation){ + GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = new GenericResourceApiVfmoduleinformationVfModuleInformation(); + if (includeModelInformation) { + GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation(); + onapModelInformation.setModelInvariantUuid(vfModule.getModelInfoVfModule().getModelInvariantUUID()); + onapModelInformation.setModelName(vfModule.getModelInfoVfModule().getModelName()); + onapModelInformation.setModelVersion(vfModule.getModelInfoVfModule().getModelVersion()); + onapModelInformation.setModelUuid(vfModule.getModelInfoVfModule().getModelUUID()); + onapModelInformation.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID()); + vfModuleInformation.setOnapModelInformation(onapModelInformation); + } + if (vfModule.getModelInfoVfModule() != null) { + vfModuleInformation.setVfModuleType(vfModule.getModelInfoVfModule().getModelName()); + } + vfModuleInformation.setVfModuleId(vfModule.getVfModuleId()); + return vfModuleInformation; + } + public GenericResourceApiSdncrequestheaderSdncRequestHeader buildSdncRequestHeader(SDNCSvcAction svcAction, String sdncReqId){ + GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = new GenericResourceApiSdncrequestheaderSdncRequestHeader(); + sdncRequestHeader.setSvcAction(svcAction.getSdncApiAction()); + sdncRequestHeader.setSvcRequestId(sdncReqId); + return sdncRequestHeader; + } + + /** + * Build ConfigurationInformation + * @param configuration + * @param includeModelInformation + * @return + */ + public GenericResourceApiConfigurationinformationConfigurationInformation buildConfigurationInformation(Configuration configuration, boolean includeModelInformation) { + GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = new GenericResourceApiConfigurationinformationConfigurationInformation(); + configurationInformation.setConfigurationId(configuration.getConfigurationId()); + configurationInformation.setConfigurationName(configuration.getConfigurationName()); + configurationInformation.setConfigurationType(configuration.getConfigurationType()); + if(includeModelInformation) { + GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation(); + onapModelInformation.setModelInvariantUuid(configuration.getModelInfoConfiguration().getModelInvariantId()); + onapModelInformation.setModelUuid(configuration.getModelInfoConfiguration().getModelVersionId()); + onapModelInformation.setModelCustomizationUuid(configuration.getModelInfoConfiguration().getModelCustomizationId()); + configurationInformation.setOnapModelInformation(onapModelInformation); + } + return configurationInformation; + } + + + /** + * Build GcRequestInformation + * @param vnf + * @param genericResourceApiParam + * @return + */ + public GenericResourceApiGcrequestinputGcRequestInput buildGcRequestInformation(GenericVnf vnf,GenericResourceApiParam genericResourceApiParam) { + GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = new GenericResourceApiGcrequestinputGcRequestInput(); + gcRequestInput.setVnfId(vnf.getVnfId()); + if(genericResourceApiParam != null) { + gcRequestInput.setInputParameters(genericResourceApiParam); + } + return gcRequestInput; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java new file mode 100644 index 0000000000..c55954093b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java @@ -0,0 +1,100 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.sdnc.mapper; + +import java.util.Map; +import java.util.UUID; + +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.springframework.stereotype.Component; + +import org.onap.sdnc.apps.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiNetworkinformationNetworkInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiNetworkrequestinputNetworkRequestInput; +import org.onap.sdnc.apps.client.model.GenericResourceApiParam; +import org.onap.sdnc.apps.client.model.GenericResourceApiParamParam; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestinformationRequestInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; +import org.onap.sdnc.apps.client.model.GenericResourceApiServiceinformationServiceInformation; + +/** + * Mapper creating SDNC request + * + */ +@Component +public class NetworkTopologyOperationRequestMapper { + + static GeneralTopologyObjectMapper generalTopologyObjectMapper = new GeneralTopologyObjectMapper(); + + public GenericResourceApiNetworkOperationInformation reqMapper(SDNCSvcOperation svcOperation, + SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration reqAction, L3Network network, ServiceInstance serviceInstance, + Customer customer, RequestContext requestContext, CloudRegion cloudRegion) { + GenericResourceApiNetworkOperationInformation req = new GenericResourceApiNetworkOperationInformation(); + String sdncReqId = UUID.randomUUID().toString(); + GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId); + GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, reqAction); + GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true); + GenericResourceApiNetworkinformationNetworkInformation networkInformation = generalTopologyObjectMapper.buildNetworkInformation(network); + GenericResourceApiNetworkrequestinputNetworkRequestInput networkRequestInput = buildNetworkRequestInput(network, serviceInstance, cloudRegion); + + req.setRequestInformation(requestInformation); + req.setSdncRequestHeader(sdncRequestHeader); + req.setServiceInformation(serviceInformation); + req.setNetworkInformation(networkInformation); + + if (requestContext.getUserParams() != null) { + for (Map.Entry entry : requestContext.getUserParams().entrySet()) { + GenericResourceApiParam networkInputParameters = new GenericResourceApiParam(); + GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); + paramItem.setName(entry.getKey()); + paramItem.setValue(entry.getValue()); + networkInputParameters.addParamItem(paramItem); + networkRequestInput.setNetworkInputParameters(networkInputParameters); + } + } + + req.setNetworkRequestInput(networkRequestInput); + return req; + } + /* + * Private helper to build GenericResourceApiNetworkrequestinputNetworkRequestInput + */ + private GenericResourceApiNetworkrequestinputNetworkRequestInput buildNetworkRequestInput(L3Network network, ServiceInstance serviceInstance, CloudRegion cloudRegion){ + GenericResourceApiNetworkrequestinputNetworkRequestInput networkRequestInput = new GenericResourceApiNetworkrequestinputNetworkRequestInput(); + networkRequestInput.setTenant(cloudRegion.getTenantId()); + networkRequestInput.setAicCloudRegion(cloudRegion.getLcpCloudRegionId()); + if (network.getNetworkName() != null && !network.getNetworkName().equals("")) { + networkRequestInput.setNetworkName(network.getNetworkName()); + } + if (serviceInstance.getCollection() != null && serviceInstance.getCollection().getInstanceGroup() != null){ + //set only for network created as part of the collection/instance since 1806 + networkRequestInput.setNetworkInstanceGroupId(serviceInstance.getCollection().getInstanceGroup().getId()); + } + return networkRequestInput; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java new file mode 100644 index 0000000000..9e29c66029 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.sdnc.mapper; + +import java.util.Map; +import java.util.UUID; + +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.springframework.stereotype.Component; + +import org.onap.sdnc.apps.client.model.GenericResourceApiParam; +import org.onap.sdnc.apps.client.model.GenericResourceApiParamParam; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestinformationRequestInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; +import org.onap.sdnc.apps.client.model.GenericResourceApiServiceOperationInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiServiceinformationServiceInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiServicerequestinputServiceRequestInput; + +@Component +public class ServiceTopologyOperationMapper{ + + static GeneralTopologyObjectMapper generalTopologyObjectMapper = new GeneralTopologyObjectMapper(); + + public GenericResourceApiServiceOperationInformation reqMapper (SDNCSvcOperation svcOperation, + SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration resourceAction,ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) { + + String sdncReqId = UUID.randomUUID().toString(); + GenericResourceApiServiceOperationInformation servOpInput = new GenericResourceApiServiceOperationInformation(); + GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId); + GenericResourceApiRequestinformationRequestInformation reqInfo = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, resourceAction); + GenericResourceApiServiceinformationServiceInformation servInfo = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true); + GenericResourceApiServicerequestinputServiceRequestInput servReqInfo = new GenericResourceApiServicerequestinputServiceRequestInput(); + + servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceId()); + + servOpInput.setSdncRequestHeader(sdncRequestHeader); + servOpInput.setRequestInformation(reqInfo); + servOpInput.setServiceInformation(servInfo); + servOpInput.setServiceRequestInput(servReqInfo); + + if(requestContext.getUserParams()!=null){ + for (Map.Entry entry : requestContext.getUserParams().entrySet()) { + GenericResourceApiServicerequestinputServiceRequestInput serviceRequestInput = new GenericResourceApiServicerequestinputServiceRequestInput(); + serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceId()); + GenericResourceApiParam serviceInputParameters = new GenericResourceApiParam(); + GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); + paramItem.setName(entry.getKey()); + paramItem.setValue(entry.getValue()); + serviceInputParameters.addParamItem(paramItem ); + serviceRequestInput.serviceInputParameters(serviceInputParameters); + servOpInput.setServiceRequestInput(serviceRequestInput ); + } + } + return servOpInput; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java new file mode 100644 index 0000000000..30daca14f5 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java @@ -0,0 +1,164 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.sdnc.mapper; + +import java.util.Map; +import java.util.UUID; + +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.stereotype.Component; + +import org.onap.sdnc.apps.client.model.GenericResourceApiParam; +import org.onap.sdnc.apps.client.model.GenericResourceApiParamParam; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestinformationRequestInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; +import org.onap.sdnc.apps.client.model.GenericResourceApiServiceinformationServiceInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiSvcActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiVfModuleOperationInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiVnfinformationVnfInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiVfmodulerequestinputVfModuleRequestInput; +import org.onap.sdnc.apps.client.model.GenericResourceApiVfModuleResponseInformation; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@Component +public class VfModuleTopologyOperationRequestMapper { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VfModuleTopologyOperationRequestMapper.class); + static GeneralTopologyObjectMapper generalTopologyObjectMapper = new GeneralTopologyObjectMapper(); + + public GenericResourceApiVfModuleOperationInformation reqMapper(SDNCSvcOperation svcOperation, + SDNCSvcAction svcAction, VfModule vfModule, VolumeGroup volumeGroup, GenericVnf vnf, ServiceInstance serviceInstance, + Customer customer, CloudRegion cloudRegion, RequestContext requestContext, String sdncAssignResponse) { + GenericResourceApiVfModuleOperationInformation req = new GenericResourceApiVfModuleOperationInformation(); + + boolean includeModelInformation = false; + + GenericResourceApiRequestActionEnumeration requestAction = GenericResourceApiRequestActionEnumeration.CREATEVFMODULEINSTANCE; + GenericResourceApiSvcActionEnumeration genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.ASSIGN; + + if (svcAction.equals(SDNCSvcAction.ACTIVATE)) { + genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.ACTIVATE; + requestAction = GenericResourceApiRequestActionEnumeration.CREATEVFMODULEINSTANCE; + includeModelInformation = true; + } else if (svcAction.equals(SDNCSvcAction.ASSIGN)) { + genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.ASSIGN; + requestAction = GenericResourceApiRequestActionEnumeration.CREATEVFMODULEINSTANCE; + includeModelInformation = true; + } else if (svcAction.equals(SDNCSvcAction.DEACTIVATE)) { + genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.DEACTIVATE; + requestAction = GenericResourceApiRequestActionEnumeration.DELETEVFMODULEINSTANCE; + includeModelInformation = false; + } else if (svcAction.equals(SDNCSvcAction.DELETE)) { + genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.DELETE; + requestAction = GenericResourceApiRequestActionEnumeration.DELETEVFMODULEINSTANCE; + includeModelInformation = false; + } else if (svcAction.equals(SDNCSvcAction.UNASSIGN)) { + genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.UNASSIGN; + requestAction = GenericResourceApiRequestActionEnumeration.DELETEVFMODULEINSTANCE; + includeModelInformation = false; + } + + String sdncReqId = UUID.randomUUID().toString(); + + GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, + requestAction); + GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, includeModelInformation); + GenericResourceApiVnfinformationVnfInformation vnfInformation = generalTopologyObjectMapper.buildVnfInformation(vnf, serviceInstance, includeModelInformation); + GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = generalTopologyObjectMapper.buildVfModuleInformation(vfModule, vnf, serviceInstance, includeModelInformation); + GenericResourceApiVfmodulerequestinputVfModuleRequestInput vfModuleRequestInput = buildVfModuleRequestInput(vfModule, volumeGroup, cloudRegion, requestContext); + GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = buildVfModuleSdncRequestHeader(sdncReqId, genericResourceApiSvcAction); + + req.setRequestInformation(requestInformation); + req.setSdncRequestHeader(sdncRequestHeader); + req.setServiceInformation(serviceInformation); + req.setVnfInformation(vnfInformation); + req.setVfModuleInformation(vfModuleInformation); + req.setVfModuleRequestInput(vfModuleRequestInput); + + return req; + } + + private GenericResourceApiVfmodulerequestinputVfModuleRequestInput buildVfModuleRequestInput(VfModule vfModule, VolumeGroup volumeGroup, CloudRegion cloudRegion, RequestContext requestContext) { + GenericResourceApiVfmodulerequestinputVfModuleRequestInput vfModuleRequestInput = new GenericResourceApiVfmodulerequestinputVfModuleRequestInput(); + if (cloudRegion != null) { + vfModuleRequestInput.setTenant(cloudRegion.getTenantId()); + vfModuleRequestInput.setAicCloudRegion(cloudRegion.getLcpCloudRegionId()); + } + if (vfModule.getVfModuleName() != null && !vfModule.getVfModuleName().equals("")) { + vfModuleRequestInput.setVfModuleName(vfModule.getVfModuleName()); + } + GenericResourceApiParam vfModuleInputParameters = new GenericResourceApiParam(); + + if (requestContext != null && requestContext.getUserParams() != null) { + for (Map.Entry entry : requestContext.getUserParams().entrySet()) { + GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); + paramItem.setName(entry.getKey()); + paramItem.setValue(entry.getValue()); + vfModuleInputParameters.addParamItem(paramItem); + } + } + + if (volumeGroup != null) { + GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); + paramItem.setName("volume-group-id"); + paramItem.setValue(volumeGroup.getVolumeGroupId()); + vfModuleInputParameters.addParamItem(paramItem); + } + vfModuleRequestInput.setVfModuleInputParameters(vfModuleInputParameters); + + return vfModuleRequestInput; + } + + private GenericResourceApiSdncrequestheaderSdncRequestHeader buildVfModuleSdncRequestHeader(String sdncReqId, GenericResourceApiSvcActionEnumeration svcAction) { + GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = new GenericResourceApiSdncrequestheaderSdncRequestHeader(); + + sdncRequestHeader.setSvcRequestId(sdncReqId); + sdncRequestHeader.setSvcAction(svcAction); + + return sdncRequestHeader; + } + + public String buildObjectPath(String sdncAssignResponse) { + String objectPath = null; + if (sdncAssignResponse != null) { + ObjectMapper mapper = new ObjectMapper(); + try { + GenericResourceApiVfModuleResponseInformation assignResponseInfo = mapper.readValue(sdncAssignResponse, GenericResourceApiVfModuleResponseInformation.class); + objectPath = assignResponseInfo.getVfModuleResponseInformation().getObjectPath(); + } catch (Exception e) { + msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, e.getMessage(), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage()); + } + } + return objectPath; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java new file mode 100644 index 0000000000..f9a85abc36 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java @@ -0,0 +1,138 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.sdnc.mapper; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.apache.commons.lang.StringUtils; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.License; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.springframework.stereotype.Component; + +import org.onap.sdnc.apps.client.model.GenericResourceApiParam; +import org.onap.sdnc.apps.client.model.GenericResourceApiParamParam; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestinformationRequestInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; +import org.onap.sdnc.apps.client.model.GenericResourceApiServiceinformationServiceInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiVnfOperationInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiVnfinformationVnfInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiVnfrequestinputVnfRequestInput; +import org.onap.sdnc.apps.client.model.GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds; + +@Component +public class VnfTopologyOperationRequestMapper { + + static GeneralTopologyObjectMapper generalTopologyObjectMapper = new GeneralTopologyObjectMapper(); + + public GenericResourceApiVnfOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction, + GenericResourceApiRequestActionEnumeration requestAction, GenericVnf vnf, ServiceInstance serviceInstance, + Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing) { + String sdncReqId = UUID.randomUUID().toString(); + GenericResourceApiVnfOperationInformation req = new GenericResourceApiVnfOperationInformation(); + GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper + .buildSdncRequestHeader(svcAction, sdncReqId); + GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper + .buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, requestAction); + GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper + .buildServiceInformation(serviceInstance, requestContext, customer, true); + GenericResourceApiVnfinformationVnfInformation vnfInformation = generalTopologyObjectMapper + .buildVnfInformation(vnf, serviceInstance, true); + GenericResourceApiVnfrequestinputVnfRequestInput vnfRequestInput = new GenericResourceApiVnfrequestinputVnfRequestInput(); + + vnfRequestInput.setTenant(cloudRegion.getTenantId()); + vnfRequestInput.setAicCloudRegion(cloudRegion.getLcpCloudRegionId()); + + if (StringUtils.isNotBlank(vnf.getVnfName())) { + vnfRequestInput.setVnfName(vnf.getVnfName()); + } + + req.setRequestInformation(requestInformation); + req.setSdncRequestHeader(sdncRequestHeader); + req.setServiceInformation(serviceInformation); + req.setVnfInformation(vnfInformation); + + GenericResourceApiParam vnfInputParameters = new GenericResourceApiParam(); + if (requestContext.getUserParams() != null) { + for (Map.Entry entry : requestContext.getUserParams().entrySet()) { + GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); + paramItem.setName(entry.getKey()); + paramItem.setValue(entry.getValue()); + vnfInputParameters.addParamItem(paramItem); + vnfRequestInput.setVnfInputParameters(vnfInputParameters); + } + } + if (vnf.getCloudParams() != null) { + for (Map.Entry entry : vnf.getCloudParams().entrySet()) { + GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); + paramItem.setName(entry.getKey()); + paramItem.setValue(entry.getValue()); + vnfInputParameters.addParamItem(paramItem); + } + } + if (homing) { + License license = vnf.getLicense(); + if (license != null) { + if(license.getEntitlementPoolUuids() != null && !license.getEntitlementPoolUuids().isEmpty()) { + String entitlementPoolUuid = license.getEntitlementPoolUuids().get(0); + GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); + paramItem.setName("entitlement_assignment_group_uuid"); + paramItem.setValue(entitlementPoolUuid); + vnfInputParameters.addParamItem(paramItem); + } + if (license.getLicenseKeyGroupUuids() != null && !license.getLicenseKeyGroupUuids().isEmpty()) { + String licenseKeyGroupUuid = license.getLicenseKeyGroupUuids().get(0); + GenericResourceApiParamParam paramItem2 = new GenericResourceApiParamParam(); + paramItem2.setName("license_assignment_group_uuid"); + paramItem2.setValue(licenseKeyGroupUuid); + vnfInputParameters.addParamItem(paramItem2); + } + } + } + List instanceGroups = vnf.getInstanceGroups(); + List networkInstanceGroupIdList = new ArrayList(); + + for (InstanceGroup instanceGroup : instanceGroups) { + if (ModelInfoInstanceGroup.TYPE_NETWORK_INSTANCE_GROUP + .equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) { + GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds instanceGroupId = new GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds(); + instanceGroupId.setVnfNetworkInstanceGroupId(instanceGroup.getId()); + networkInstanceGroupIdList.add(instanceGroupId); + } + } + + vnfRequestInput.setVnfNetworkInstanceGroupIds(networkInstanceGroupIdList); + vnfRequestInput.setVnfInputParameters(vnfInputParameters); + req.setVnfRequestInput(vnfRequestInput); + return req; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java new file mode 100644 index 0000000000..979b9e5e80 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java @@ -0,0 +1,115 @@ +/*- + * ============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.client.sniro; + +import java.util.LinkedHashMap; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.sdnc.BaseClient; +import org.onap.so.client.sniro.beans.ManagerProperties; +import org.onap.so.client.sniro.beans.SniroConductorRequest; +import org.onap.so.client.sniro.beans.SniroManagerRequest; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.core.JsonProcessingException; + + +@Component +public class SniroClient { + + private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroClient.class); + + @Autowired + private ManagerProperties managerProperties; + + @Autowired + private SniroValidator validator; + + + /** + * Makes a rest call to sniro manager to perform homing and licensing for a + * list of demands + * + * @param homingRequest + * @return + * @throws JsonProcessingException + * @throws BpmnError + */ + public void postDemands(SniroManagerRequest homingRequest) throws BadResponseException, JsonProcessingException{ + log.trace("Started Sniro Client Post Demands"); + String url = managerProperties.getHost() + managerProperties.getUri().get("v2"); + log.debug("Post demands url: " + url); + log.debug("Post demands payload: " + homingRequest.toJsonString()); + + HttpHeaders header = new HttpHeaders(); + header.setContentType(MediaType.APPLICATION_JSON); + header.set("Authorization", managerProperties.getHeaders().get("auth")); + header.set("X-patchVersion", managerProperties.getHeaders().get("patchVersion")); + header.set("X-minorVersion", managerProperties.getHeaders().get("minorVersion")); + header.set("X-latestVersion", managerProperties.getHeaders().get("latestVersion")); + BaseClient> baseClient = new BaseClient<>(); + + baseClient.setTargetUrl(url); + baseClient.setHttpHeader(header); + + LinkedHashMap response = baseClient.post(homingRequest.toJsonString()); + validator.validateDemandsResponse(response); + log.trace("Completed Sniro Client Post Demands"); + } + + /** + * Makes a rest call to sniro conductor to notify them of successful or unsuccessful vnf + * creation for previously homed resources + * + * TODO Temporarily being used in groovy therefore can not utilize autowire. Once java "release" + * subflow is developed it will be refactored to use autowire. + * + * @param releaseRequest + * @return + * @throws BadResponseException + */ + public void postRelease(SniroConductorRequest releaseRequest) throws BadResponseException { + log.trace("Started Sniro Client Post Release"); + String url = UrnPropertiesReader.getVariable("sniro.conductor.host") + UrnPropertiesReader.getVariable("sniro.conductor.uri"); + log.debug("Post release url: " + url); + log.debug("Post release payload: " + releaseRequest.toJsonString()); + + HttpHeaders header = new HttpHeaders(); + header.setContentType(MediaType.APPLICATION_JSON); + header.set("Authorization", UrnPropertiesReader.getVariable("sniro.conductor.headers.auth")); + BaseClient> baseClient = new BaseClient<>(); + + baseClient.setTargetUrl(url); + baseClient.setHttpHeader(header); + + LinkedHashMap response = baseClient.post(releaseRequest.toJsonString()); + SniroValidator v = new SniroValidator(); + v.validateReleaseResponse(response); + log.trace("Completed Sniro Client Post Release"); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java new file mode 100644 index 0000000000..bad45c87f2 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java @@ -0,0 +1,138 @@ +/*- + * ============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.client.sniro; + + +import static org.apache.commons.lang.StringUtils.*; + +import java.util.LinkedHashMap; + +import org.json.JSONObject; +import org.onap.so.client.exception.BadResponseException; + +import org.onap.so.logger.MsoLogger; +import org.springframework.stereotype.Component; + + + +@Component +public class SniroValidator { + + private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroValidator.class); + + /** + * Validates the synchronous homing response from sniro manager + * + * @throws BadResponseException + */ + public void validateDemandsResponse(LinkedHashMap response) throws BadResponseException { + log.debug("Validating Sniro Managers synchronous response"); + if(!response.isEmpty()){ + JSONObject jsonResponse = new JSONObject(response); + if(jsonResponse.has("requestStatus")){ + String status = jsonResponse.getString("requestStatus"); + if(status.equals("accepted")){ + log.debug("Sniro Managers synchronous response indicates accepted"); + }else{ + String message = jsonResponse.getString("statusMessage"); + if(isNotBlank(message)){ + log.debug("Sniro Managers response indicates failed: " + message); + }else{ + log.debug("Sniro Managers response indicates failed: no status message provided"); + message = "error message not provided"; + } + throw new BadResponseException("Sniro Managers synchronous response indicates failed: " + message); + } + }else{ + log.debug("Sniro Managers synchronous response does not contain: request status"); + throw new BadResponseException("Sniro Managers synchronous response does not contain: request status"); + } + }else{ + log.debug("Sniro Managers synchronous response is empty"); + throw new BadResponseException("Sniro Managers synchronous response i is empty"); + } + } + + /** + * Validates the asynchronous/callback response from sniro manager which + * contains the homing and licensing solutions + * + * @throws BadResponseException + */ + public static void validateSolution(String response) throws BadResponseException{ + log.debug("Validating Sniro Managers asynchronous callback response"); + if(isNotBlank(response)) { + JSONObject jsonResponse = new JSONObject(response); + if(!jsonResponse.has("serviceException")){ + log.debug("Sniro Managers asynchronous response is valid"); + }else{ + String message = jsonResponse.getJSONObject("serviceException").getString("text"); + if(isNotBlank(message)){ + log.debug("Sniro Managers response contains a service exception: " + message); + }else{ + log.debug("Sniro Managers response contains a service exception: no service exception text provided"); + message = "error message not provided"; + } + throw new BadResponseException("Sniro Managers asynchronous response contains a service exception: " + message); + } + }else{ + log.debug("Sniro Managers asynchronous response is empty"); + throw new BadResponseException("Sniro Managers asynchronous response is empty"); + } + } + + + /** + * Validates the release response from sniro conductor + * + * @throws BadResponseException + */ + public void validateReleaseResponse(LinkedHashMap response) throws BadResponseException { + log.debug("Validating Sniro Conductors response"); + if(!response.isEmpty()){ + String status = (String) response.get("status"); + if(isNotBlank(status)){ + if(status.equals("success")){ + log.debug("Sniro Conductors synchronous response indicates success"); + }else{ + String message = (String) response.get("message"); + if(isNotBlank(message)){ + log.debug("Sniro Conductors response indicates failed: " + message); + }else{ + log.debug("Sniro Conductors response indicates failed: error message not provided"); + message = "error message not provided"; + } + throw new BadResponseException("Sniro Conductors synchronous response indicates failed: " + message); + } + }else{ + log.debug("Sniro Managers Conductors response does not contain: status"); + throw new BadResponseException("Sniro Conductors synchronous response does not contain: status"); + } + }else{ + log.debug("Sniro Conductors response is empty"); + throw new BadResponseException("Sniro Conductors response is empty"); + } + + } + + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java new file mode 100644 index 0000000000..6e60bfa293 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java @@ -0,0 +1,62 @@ +/*- + * ============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.client.sniro.beans; + +import java.util.Map; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ConfigurationProperties(prefix = "sniro.conductor") +public class ConductorProperties { + + private String host; + private String uri; + + private Map headers; + + + public String getHost() { + return host; + } + public void setHost(String host) { + this.host = host; + } + public String getUri() { + return uri; + } + public void setUri(String uri) { + this.uri = uri; + } + public Map getHeaders() { + return headers; + } + public void setHeaders(Map headers) { + this.headers = headers; + } + + + + + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java new file mode 100644 index 0000000000..0070f2fe04 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java @@ -0,0 +1,59 @@ +/*- + * ============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.client.sniro.beans; + +import java.util.Map; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ConfigurationProperties(prefix = "sniro.manager") +public class ManagerProperties { + + private String host; + private Map uri; + private Map headers; + + + public String getHost() { + return host; + } + public void setHost(String host) { + this.host = host; + } + public Map getUri() { + return uri; + } + public void setUri(Map uri) { + this.uri = uri; + } + public Map getHeaders() { + return headers; + } + public void setHeaders(Map headers) { + this.headers = headers; + } + + + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java new file mode 100644 index 0000000000..0d7e44224e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.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.client.sniro.beans; + +import java.io.Serializable; + + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + + +@JsonRootName("requestInfo") +public class RequestInfo implements Serializable{ + + private static final long serialVersionUID = -759180997599143791L; + + @JsonProperty("transactionId") + String transactionId; + @JsonProperty("requestId") + String requestId; + + public String getTransactionId(){ + return transactionId; + } + + public void setTransactionId(String transactionId){ + this.transactionId = transactionId; + } + + public String getRequestId(){ + return requestId; + } + + public void setRequestId(String requestId){ + this.requestId = requestId; + } + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java new file mode 100644 index 0000000000..8441a01072 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java @@ -0,0 +1,55 @@ +/*- + * ============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.client.sniro.beans; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Resource implements Serializable{ + + private static final long serialVersionUID = 5949861520571440421L; + + @JsonProperty("service-resource-id") + private String serviceResourceId; + @JsonProperty("status") + private String status; + + + public String getServiceResourceId(){ + return serviceResourceId; + } + + public void setServiceResourceId(String serviceResourceId){ + this.serviceResourceId = serviceResourceId; + } + + public String getStatus(){ + return status; + } + + public void setStatus(String status){ + this.status = status; + } + + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java new file mode 100644 index 0000000000..bc8e27ce86 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java @@ -0,0 +1,65 @@ +/*- + * ============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.client.sniro.beans; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; + + +public class SniroConductorRequest implements Serializable{ + + private static final long serialVersionUID = 1906052095861777655L; + private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroConductorRequest.class); + + @JsonProperty("release-locks") + private List resources = new ArrayList(); + + + public List getResources(){ + return resources; + } + + @JsonInclude(Include.NON_NULL) + public String toJsonString(){ + String json = ""; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter(); + try{ + json = ow.writeValueAsString(this); + }catch (Exception e){ + log.error("Unable to convert SniroConductorRequest to string", e); + } + return json; + } + + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java new file mode 100644 index 0000000000..19b752ffd1 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java @@ -0,0 +1,95 @@ +/*- + * ============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.client.sniro.beans; + +import java.io.Serializable; + +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRawValue; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; + + +public class SniroManagerRequest implements Serializable{ + + private static final long serialVersionUID = -1541132882892163132L; + private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroManagerRequest.class); + + @JsonRawValue + @JsonProperty("requestInfo") + private String requestInformation; + @JsonRawValue + @JsonProperty("serviceInfo") + private String serviceInformation; + @JsonRawValue + @JsonProperty("placementInfo") + private String placementInformation; + @JsonRawValue + @JsonProperty("licenseInfo") + private String licenseInformation; + + + public String getRequestInformation() { + return requestInformation; + } + public void setRequestInformation(String requestInformation) { + this.requestInformation = requestInformation; + } + public String getServiceInformation() { + return serviceInformation; + } + public void setServiceInformation(String serviceInformation) { + this.serviceInformation = serviceInformation; + } + public String getPlacementInformation() { + return placementInformation; + } + public void setPlacementInformation(String placementInformation) { + this.placementInformation = placementInformation; + } + public String getLicenseInformation() { + return licenseInformation; + } + public void setLicenseInformation(String licenseInformation) { + this.licenseInformation = licenseInformation; + } + + + @JsonInclude(Include.NON_NULL) + public String toJsonString(){ + String json = ""; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter(); + try{ + json = ow.writeValueAsString(this); + }catch (Exception e){ + log.error("Unable to convert SniroManagerRequest to string", e); + } + return json.replaceAll("\\\\", ""); + } + + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseTest.java new file mode 100644 index 0000000000..e527b587b7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseTest.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so; + +import org.junit.runner.RunWith; +import org.onap.so.bpmn.buildingblock.SniroHomingV2; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.client.orchestration.SDNOHealthCheckResources; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.boot.test.mock.mockito.SpyBean; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +@ContextConfiguration +public abstract class BaseTest extends TestDataSetup { + + @SpyBean + protected SDNOHealthCheckResources MOCK_sdnoHealthCheckResources; + + @MockBean + protected SniroHomingV2 sniroHoming; +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java new file mode 100644 index 0000000000..a29df9cbcf --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java @@ -0,0 +1,64 @@ +/*- + * ============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; +import ch.vorburger.exec.ManagedProcessException; +import ch.vorburger.mariadb4j.DBConfigurationBuilder; +import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import javax.sql.DataSource; + +@Configuration +@Profile({"test"}) +public class EmbeddedMariaDbConfig { + + @Bean + MariaDB4jSpringService mariaDB4jSpringService() { + MariaDB4jSpringService service = new MariaDB4jSpringService(); + + + service.getConfiguration().addArg("--lower_case_table_names=1"); + return service; + } + + @Bean + DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService, + @Value("${mariaDB4j.databaseName}") String databaseName, + @Value("${spring.datasource.username}") String datasourceUsername, + @Value("${spring.datasource.password}") String datasourcePassword, + @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException { + //Create our database with default root user and no password + mariaDB4jSpringService.getDB().createDB(databaseName); + + DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration(); + + return DataSourceBuilder + .create() + .username(datasourceUsername) + .password(datasourcePassword) + .url(config.getURL(databaseName)) + .driverClassName(datasourceDriver) + .build(); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/FileUtil.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/FileUtil.java new file mode 100644 index 0000000000..e35fe0db9f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/FileUtil.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; + +import java.io.IOException; +import java.io.InputStream; +import org.onap.so.logger.MsoLogger; + +/** + * + * File utility class.
+ *

+ *

+ * + * @author + * @version ONAP Sep 15, 2017 + */ +public class FileUtil { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, FileUtil.class); + + /** + * Read the specified resource file and return the contents as a String. + * + * @param fileName Name of the resource file + * @return the contents of the resource file as a String + * @throws IOException if there is a problem reading the file + */ + public static String readResourceFile(String fileName) { + InputStream stream; + try { + stream = getResourceAsStream(fileName); + byte[] bytes; + bytes = new byte[stream.available()]; + if(stream.read(bytes) > 0) { + stream.close(); + return new String(bytes); + } else { + stream.close(); + return ""; + } + } catch (IOException e) { + LOGGER.debug("Exception:", e); + return ""; + } + } + + /** + * Get an InputStream for the resource specified. + * + * @param resourceName Name of resource for which to get InputStream. + * @return an InputStream for the resource specified. + * @throws IOException If we can't get the InputStream for whatever reason. + */ + private static InputStream getResourceAsStream(String resourceName) throws IOException { + InputStream stream = + FileUtil.class.getClassLoader().getResourceAsStream(resourceName); + if (stream == null) { + throw new IOException("Can't access resource '" + resourceName + "'"); + } + return stream; + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java new file mode 100644 index 0000000000..6401d5516d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java @@ -0,0 +1,54 @@ +package org.onap.so; +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + + + +import java.io.IOException; + +import javax.annotation.PreDestroy; + +import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; +import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; +import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; +import org.onap.so.requestsdb.RequestsDBHelper; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.ComponentScan.Filter; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.Profile; + +@SpringBootApplication +@Profile("test") +@EnableProcessApplication("MSO CommonBPMN Test Application") +@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) +public class TestApplication { + public static void main(String... args) { + SpringApplication.run(TestApplication.class, args); + System.getProperties().setProperty("mso.db", "MARIADB"); + System.getProperties().setProperty("server.name", "Springboot"); + + + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java new file mode 100644 index 0000000000..501e64f4d4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.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.bpmn; + +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.onap.so.TestApplication; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; +import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; +import org.onap.so.client.orchestration.AAICollectionResources; +import org.onap.so.client.orchestration.AAIInstanceGroupResources; +import org.onap.so.client.orchestration.AAINetworkResources; +import org.onap.so.client.orchestration.AAIServiceInstanceResources; +import org.onap.so.client.orchestration.AAIVfModuleResources; +import org.onap.so.client.orchestration.AAIVnfResources; +import org.onap.so.client.orchestration.AAIVolumeGroupResources; +import org.onap.so.client.orchestration.AAIVpnBindingResources; +import org.onap.so.client.orchestration.NetworkAdapterResources; +import org.onap.so.client.orchestration.SDNCNetworkResources; +import org.onap.so.client.orchestration.SDNCServiceInstanceResources; +import org.onap.so.client.orchestration.SDNCVfModuleResources; +import org.onap.so.client.orchestration.SDNCVnfResources; +import org.onap.so.client.orchestration.VnfAdapterVfModuleResources; +import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.boot.test.mock.mockito.SpyBean; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public abstract class BaseTaskTest extends TestDataSetup { + @MockBean + protected AAIVolumeGroupResources aaiVolumeGroupResources; + + @MockBean + protected AAIServiceInstanceResources aaiServiceInstanceResources; + + @MockBean + protected AAIVnfResources aaiVnfResources; + + @MockBean + protected AAIVfModuleResources aaiVfModuleResources; + + @MockBean + protected AAIVpnBindingResources aaiVpnBindingResources; + + @MockBean + protected AAINetworkResources aaiNetworkResources; + + @MockBean + protected AAICollectionResources aaiCollectionResources; + + @MockBean + protected NetworkAdapterResources networkAdapterResources; + + @MockBean + protected VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources; + + @MockBean + protected VnfAdapterVfModuleResources vnfAdapterVfModuleResources; + + @MockBean + protected SDNCVnfResources sdncVnfResources; + + @MockBean + protected SDNCNetworkResources sdncNetworkResources; + + @MockBean + protected SDNCVfModuleResources sdncVfModuleResources; + + @MockBean + protected SDNCServiceInstanceResources sdncServiceInstanceResources; + + @MockBean + protected AssignNetworkBBUtils assignNetworkBBUtils; + + @MockBean + protected NetworkAdapterObjectMapper networkAdapterObjectMapper; + + @MockBean + protected AAIInstanceGroupResources aaiInstanceGroupResources; + + @MockBean + protected CatalogDbClient catalogDbClient; + + @Mock + protected BBInputSetupUtils bbSetupUtils; + + @Mock + protected BBInputSetup bbInputSetup; + + @SpyBean + protected SDNCClient SPY_sdncClient; +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java new file mode 100644 index 0000000000..946c5dfe80 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.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.bpmn.common.aai.tasks; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.infrastructure.aai.tasks.AAIFlagTasks; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIVnfResources; +import org.springframework.beans.factory.annotation.Autowired; + +@RunWith(MockitoJUnitRunner.class) +public class AAIFlagTasksTest extends TestDataSetup { + + @InjectMocks + private AAIFlagTasks aaiFlagTasks = new AAIFlagTasks(); + + @Mock + private AAIVnfResources aaiVnfResources; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + + @Mock + private ExtractPojosForBB extractPojosForBB; + + @Mock + private ExceptionBuilder exceptionUtil; + + private GenericVnf genericVnf; + + @Before + public void before() throws BBObjectNotFoundException { + genericVnf = setGenericVnf(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + when(extractPojosForBB.extractByKey(any(),any(), any())).thenReturn(genericVnf); + } + + @Test + public void checkVnfInMaintTestTrue() throws Exception { + doThrow(new BpmnError("VNF is in maintenance in A&AI")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); + doReturn(false).when(aaiVnfResources).checkInMaintFlag(isA(String.class)); + doReturn(true).when(aaiVnfResources).checkInMaintFlag(isA(String.class)); + try { + aaiFlagTasks.checkVnfInMaintFlag(execution); + } catch (Exception e) { + verify(aaiVnfResources, times(1)).checkInMaintFlag(any(String.class)); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), eq("VNF is in maintenance in A&AI")); + } + } + + @Test + public void checkVnfInMaintTestFalse() throws Exception { + doReturn(false).when(aaiVnfResources).checkInMaintFlag(isA(String.class)); + aaiFlagTasks.checkVnfInMaintFlag(execution); + verify(exceptionUtil, times(0)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), any(int.class), any(String.class)); + } + + @Test + public void checkVnfInMaintFlagExceptionTest() { + + doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); + doThrow(Exception.class).when(aaiVnfResources).checkInMaintFlag(isA(String.class)); + try { + aaiFlagTasks.checkVnfInMaintFlag(execution); + } catch (Exception e) { + verify(aaiVnfResources, times(1)).checkInMaintFlag(any(String.class)); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); + } + + } + + @Test + public void modifyVnfInMaintFlagTest() throws Exception { + doNothing().when(aaiVnfResources).updateObjectVnf(isA(GenericVnf.class)); + aaiFlagTasks.modifyVnfInMaintFlag(execution, true); + verify(aaiVnfResources, times(1)).updateObjectVnf(genericVnf); + } + + @Test + public void modifyVnfInMaintFlagExceptionTest() { + + doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); + doThrow(Exception.class).when(aaiVnfResources).updateObjectVnf(isA(GenericVnf.class)); + try { + aaiFlagTasks.modifyVnfInMaintFlag(execution, true); + } catch (Exception e) { + verify(aaiVnfResources, times(1)).checkInMaintFlag(any(String.class)); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java new file mode 100644 index 0000000000..a20b68b147 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java @@ -0,0 +1,665 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.common.data; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.assertj.core.util.Arrays; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; +import org.junit.Before; +import org.junit.Rule; +import org.junit.rules.ExpectedException; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoAllottedResource; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; + +public class TestDataSetup{ + private int collectionCounter; + private int configurationCounter; + private int customerCounter; + private int genericVnfCounter; + private int instanceGroupCounter; + private int l3NetworkCounter; + private int owningEntityCounter; + private int pnfCounter; + private int projectCounter; + private int serviceInstanceCounter; + private int serviceProxyCounter; + private int serviceSubscriptionCounter; + private int vfModuleCounter; + private int volumeGroupCounter; + private int vpnBindingCounter; + private int vpnBondingLinkCounter; + + protected BuildingBlockExecution execution; + + protected GeneralBuildingBlock gBBInput; + + protected HashMap lookupKeyMap; + + protected ExtractPojosForBB extractPojosForBB = new ExtractPojosForBB(); + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + protected DelegateExecution delegateExecution; + + @Before + public void buildingBlockTestDataSetupBefore() { + collectionCounter = 0; + configurationCounter = 0; + customerCounter = 0; + genericVnfCounter = 0; + instanceGroupCounter = 0; + l3NetworkCounter = 0; + owningEntityCounter = 0; + pnfCounter = 0; + projectCounter = 0; + serviceInstanceCounter = 0; + serviceProxyCounter = 0; + serviceSubscriptionCounter = 0; + vfModuleCounter = 0; + volumeGroupCounter = 0; + vpnBindingCounter = 0; + vpnBondingLinkCounter = 0; + + execution = new DelegateExecutionImpl(new ExecutionImpl()); + execution.setVariable("testProcessKey", "testProcessKeyValue"); + + gBBInput = new GeneralBuildingBlock(); + execution.setVariable("gBBInput", gBBInput); + + lookupKeyMap = new HashMap(); + execution.setVariable("lookupKeyMap", lookupKeyMap); + + ExecutionImpl mockExecutionImpl = mock(ExecutionImpl.class); + doReturn("test").when(mockExecutionImpl).getProcessInstanceId(); + + ExecutionImpl executionImpl = new ExecutionImpl(); + executionImpl.setProcessInstance(mockExecutionImpl); + + delegateExecution = (DelegateExecution) executionImpl; + delegateExecution.setVariable("testProcessKey", "testProcessKeyValue"); + } + + public Map buildUserInput() { + Map userInput = new HashMap<>(); + userInput.put("testUserInputKey", "testUserInputValue"); + + return userInput; + } + + public Map setUserInput() { + Map userInput = buildUserInput(); + + gBBInput.setUserInput(userInput); + + return userInput; + } + + public RequestContext buildRequestContext() { + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId(UUID.randomUUID().toString()); + requestContext.setProductFamilyId("testProductFamilyId"); + requestContext.setRequestorId("testRequestorId"); + + requestContext.setUserParams(new HashMap<>()); + + Map dataMap = new HashMap<>(); + dataMap.put("vpnId","testVpnId"); + dataMap.put("vpnRegion","testVpnRegion"); + dataMap.put("vpnRt","testVpnRt"); + dataMap.put("vpnName","vpnName"); + dataMap.put("vpnRegion", Arrays.asList(new String[] {"USA", "EMEA", "APAC"})); + + HashMap userParams = new HashMap<>(); + userParams.put("vpnData",dataMap); + + List> userParamsList = new ArrayList<>(); + userParamsList.add(userParams); + + RequestParameters requestParameters = new RequestParameters(); + requestParameters.setUserParams(userParamsList); + requestContext.setRequestParameters(requestParameters); + + return requestContext; + } + + public RequestContext setRequestContext() { + RequestContext requestContext = buildRequestContext(); + + gBBInput.setRequestContext(requestContext); + + return requestContext; + } + + public CloudRegion buildCloudRegion() { + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("testLcpCloudRegionId"); + cloudRegion.setTenantId("testTenantId"); + cloudRegion.setCloudOwner("testCloudOwner"); + + return cloudRegion; + } + + public CloudRegion setCloudRegion() { + CloudRegion cloudRegion = buildCloudRegion(); + + gBBInput.setCloudRegion(cloudRegion); + + return cloudRegion; + } + + public OrchestrationContext buildOrchestrationContext() { + OrchestrationContext orchestrationContext = new OrchestrationContext(); + + return orchestrationContext; + } + + public OrchestrationContext setOrchestrationContext() { + OrchestrationContext orchestrationContext = buildOrchestrationContext(); + + gBBInput.setOrchContext(orchestrationContext); + + return orchestrationContext; + } + + public Collection buildCollection() { + collectionCounter++; + + Collection collection = new Collection(); + collection.setId("testId" + collectionCounter); + collection.setInstanceGroup(buildInstanceGroup()); + + return collection; + } + + public Configuration buildConfiguration() { + configurationCounter++; + + Configuration configuration = new Configuration(); + configuration.setConfigurationId("testConfigurationId" + configurationCounter); + configuration.setConfigurationName("testConfigurationName" + configurationCounter); + + ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); + modelInfoConfiguration.setModelVersionId("testModelVersionId" + configurationCounter); + modelInfoConfiguration.setModelInvariantId("testModelInvariantId" + configurationCounter); + modelInfoConfiguration.setModelCustomizationId("testModelCustomizationId" + configurationCounter); + + configuration.setModelInfoConfiguration(modelInfoConfiguration); + + return configuration; + } + + public OwningEntity buildOwningEntity() { + owningEntityCounter++; + + OwningEntity owningEntity = new OwningEntity(); + owningEntity.setOwningEntityId("testOwningEntityId" + owningEntityCounter); + owningEntity.setOwningEntityName("testOwningEntityName" + owningEntityCounter); + + return owningEntity; + } + + public Project buildProject() { + projectCounter++; + + Project project = new Project(); + project.setProjectName("testProjectName" + projectCounter); + + return project; + } + + public ServiceSubscription buildServiceSubscription() { + serviceSubscriptionCounter++; + + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setTempUbSubAccountId("testTempUbSubAccountId" + serviceSubscriptionCounter); + serviceSubscription.setServiceType("testServiceType" + serviceSubscriptionCounter); + + return serviceSubscription; + } + + public Customer buildCustomer() { + customerCounter++; + + Customer customer = new Customer(); + customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter); + customer.setSubscriberType("testSubscriberType" + customerCounter); + + customer.setServiceSubscription(buildServiceSubscription()); + + return customer; + } + + public ServiceInstance buildServiceInstance() { + serviceInstanceCounter++; + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("testServiceInstanceId" + serviceInstanceCounter); + serviceInstance.setServiceInstanceName("testServiceInstanceName" + serviceInstanceCounter); + + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("testModelInvariantUUID" + serviceInstanceCounter); + modelInfoServiceInstance.setModelUuid("testModelUUID" + serviceInstanceCounter); + modelInfoServiceInstance.setModelVersion("testModelVersion" + serviceInstanceCounter); + modelInfoServiceInstance.setModelName("testModelName" + serviceInstanceCounter); + modelInfoServiceInstance.setServiceType("testServiceType" + serviceInstanceCounter); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + serviceInstance.setProject(buildProject()); + + serviceInstance.setOwningEntity(buildOwningEntity()); + + serviceInstance.setCollection(buildCollection()); + + serviceInstance.getConfigurations().add(buildConfiguration()); + + return serviceInstance; + } + + public ServiceInstance setServiceInstance() { + ServiceInstance serviceInstance = buildServiceInstance(); + + if(gBBInput.getCustomer() == null) { + gBBInput.setCustomer(buildCustomer()); + } + gBBInput.getCustomer().getServiceSubscription().getServiceInstances().add(serviceInstance); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId()); + + return serviceInstance; + } + + public Customer setCustomer() { + if(gBBInput.getCustomer() != null) return gBBInput.getCustomer(); + Customer customer = new Customer(); + customer.setGlobalCustomerId("testGlobalCustomerId"); + customer.setSubscriberType("testSubscriberType"); + + customer.setServiceSubscription(buildServiceSubscription()); + + gBBInput.setCustomer(customer); + + return customer; + } + + public Collection setCollection() { + Collection collection = new Collection(); + collection.setId("testId"); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.setCollection(collection); + + return collection; + } + + public InstanceGroup setInstanceGroup() { + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId("testId"); + instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction"); + + Collection collection = null; + + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + collection = serviceInstance.getCollection(); + + if (collection == null) { + collection = setCollection(); + } + } catch(BBObjectNotFoundException e) { + collection = setCollection(); + } + + collection.setInstanceGroup(instanceGroup); + + return instanceGroup; + } + + public VpnBinding buildVpnBinding() { + vpnBindingCounter++; + + VpnBinding vpnBinding = new VpnBinding(); + vpnBinding.setVpnId("testVpnId" + vpnBindingCounter); + vpnBinding.setVpnName("testVpnName" + vpnBindingCounter); + vpnBinding.setCustomerVpnId("testCustomerVpnId" + vpnBindingCounter); + + return vpnBinding; + } + + public VpnBinding setVpnBinding() { + VpnBinding vpnBinding = buildVpnBinding(); + + Customer customer = gBBInput.getCustomer(); + + if(customer == null){ + customer = buildCustomer(); + } + + customer.getVpnBindings().add(vpnBinding); + lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId()); + + return vpnBinding; + } + + public InstanceGroup buildInstanceGroup() { + instanceGroupCounter++; + + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId("testId" + instanceGroupCounter); + instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter); + + return instanceGroup; + } + + public L3Network buildL3Network() { + l3NetworkCounter++; + + L3Network network = new L3Network(); + network.setNetworkId("testNetworkId" + l3NetworkCounter); + network.setNetworkName("testNetworkName" + l3NetworkCounter); + network.setNetworkType("testNetworkType" + l3NetworkCounter); + + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + modelInfoNetwork.setModelInvariantUUID("testModelInvariantUUID" + l3NetworkCounter); + modelInfoNetwork.setModelName("testModelName" + l3NetworkCounter); + modelInfoNetwork.setModelVersion("testModelVersion" + l3NetworkCounter); + modelInfoNetwork.setModelUUID("testModelUUID" + l3NetworkCounter); + network.setModelInfoNetwork(modelInfoNetwork); + + return network; + } + + public L3Network setL3Network() { + L3Network network = buildL3Network(); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.getNetworks().add(network); + lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId()); + + return network; + } + + public GenericVnf buildGenericVnf() { + genericVnfCounter++; + + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId("testVnfId" + genericVnfCounter); + genericVnf.setVnfName("testVnfName" + genericVnfCounter); + genericVnf.setVnfType("testVnfType" + genericVnfCounter); + + Platform platform = new Platform(); + platform.setPlatformName("testPlatformName"); + genericVnf.setPlatform(platform); + + LineOfBusiness lob = new LineOfBusiness(); + lob.setLineOfBusinessName("testLineOfBusinessName"); + genericVnf.setLineOfBusiness(lob); + + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelName("testModelName" + genericVnfCounter); + modelInfoGenericVnf.setModelCustomizationUuid("testModelCustomizationUUID" + genericVnfCounter); + modelInfoGenericVnf.setModelInvariantUuid("testModelInvariantUUID" + genericVnfCounter); + modelInfoGenericVnf.setModelVersion("testModelVersion" + genericVnfCounter); + modelInfoGenericVnf.setModelUuid("testModelUUID" + genericVnfCounter); + genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + return genericVnf; + } + + public GenericVnf setGenericVnf() { + GenericVnf genericVnf = buildGenericVnf(); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.getVnfs().add(genericVnf); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId()); + + return genericVnf; + } + + public VfModule buildVfModule() { + vfModuleCounter++; + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter); + vfModule.setVfModuleName("testVfModuleName" + vfModuleCounter); + + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID" + vfModuleCounter); + modelInfoVfModule.setModelVersion("testModelVersion" + vfModuleCounter); + modelInfoVfModule.setModelUUID("testModelUUID" + vfModuleCounter); + modelInfoVfModule.setModelName("testModelName" + vfModuleCounter); + modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID" + vfModuleCounter); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + return vfModule; + } + + public VfModule setVfModule() { + VfModule vfModule = buildVfModule(); + + GenericVnf genericVnf = null; + + try { + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + } catch(BBObjectNotFoundException e) { + genericVnf = setGenericVnf(); + } + + genericVnf.getVfModules().add(vfModule); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId()); + + return vfModule; + } + + public VolumeGroup buildVolumeGroup() { + volumeGroupCounter++; + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("testVolumeGroupId" + volumeGroupCounter); + volumeGroup.setVolumeGroupName("testVolumeGroupName" + volumeGroupCounter); + volumeGroup.setHeatStackId("testHeatStackId" + volumeGroupCounter); + + return volumeGroup; + } + + public VolumeGroup setVolumeGroup() { + VolumeGroup volumeGroup = buildVolumeGroup(); + + GenericVnf genericVnf = null; + + try { + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + } catch(BBObjectNotFoundException e) { + genericVnf = setGenericVnf(); + } + + genericVnf.getVolumeGroups().add(volumeGroup); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); + + return volumeGroup; + } + + public Pnf buildPnf() { + pnfCounter++; + + Pnf pnf = new Pnf(); + pnf.setPnfId("testPnfId" + pnfCounter); + pnf.setPnfName("testPnfName" + pnfCounter); + + return pnf; + } + + public ServiceProxy buildServiceProxy() { + serviceProxyCounter++; + + ServiceProxy serviceProxy = new ServiceProxy(); + serviceProxy.setServiceInstance(buildServiceInstance()); + serviceProxy.getServiceInstance().getVnfs().add(buildGenericVnf()); + + Pnf primaryPnf = buildPnf(); + primaryPnf.setRole("Primary"); + serviceProxy.getServiceInstance().getPnfs().add(primaryPnf); + + Pnf secondaryPnf = buildPnf(); + secondaryPnf.setRole("Secondary"); + serviceProxy.getServiceInstance().getPnfs().add(secondaryPnf); + + return serviceProxy; + } + + public VpnBondingLink buildVpnBondingLink() { + vpnBondingLinkCounter++; + + VpnBondingLink vpnBondingLink = new VpnBondingLink(); + vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter); + + Configuration vnrConfiguration = buildConfiguration(); + vnrConfiguration.setNetwork(buildL3Network()); + vpnBondingLink.setVnrConfiguration(vnrConfiguration); + + vpnBondingLink.setVrfConfiguration(buildConfiguration()); + + vpnBondingLink.setInfrastructureServiceProxy(buildServiceProxy()); + + vpnBondingLink.setTransportServiceProxy(buildServiceProxy()); + + return vpnBondingLink; + } + + public VpnBondingLink setVpnBondingLink() { + VpnBondingLink vpnBondingLink = buildVpnBondingLink(); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.getVpnBondingLinks().add(vpnBondingLink); + lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId()); + + + return vpnBondingLink; + } + + public Customer setAvpnCustomer() { + Customer customer = buildCustomer(); + + gBBInput.setCustomer(customer); + + return customer; + } + + public ServiceProxy setServiceProxy(String uniqueIdentifier, String type) { + ServiceProxy serviceProxy = new ServiceProxy(); + serviceProxy.setId("testProxyId" + uniqueIdentifier); + serviceProxy.setType(type); + + ModelInfoServiceProxy modelInfo = new ModelInfoServiceProxy(); + modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier); + modelInfo.setModelName("testProxyModelName" + uniqueIdentifier); + modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier); + modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier); + + serviceProxy.setModelInfoServiceProxy(modelInfo); + + return serviceProxy; + } + + public AllottedResource setAllottedResource(String uniqueIdentifier) { + AllottedResource ar = new AllottedResource(); + ar.setId("testAllottedResourceId" + uniqueIdentifier); + + ModelInfoAllottedResource modelInfo = new ModelInfoAllottedResource(); + modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier); + modelInfo.setModelName("testProxyModelName" + uniqueIdentifier); + modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier); + modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier); + + ar.setModelInfoAllottedResource(modelInfo); + + return ar; + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java new file mode 100644 index 0000000000..51a7f1ab04 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java @@ -0,0 +1,387 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.aai.tasks; + +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.springframework.beans.factory.annotation.Autowired; + +public class AAICreateTasksTest extends BaseTaskTest{ + @Autowired + private AAICreateTasks aaiCreateTasks; + + private ServiceInstance serviceInstance; + private L3Network network; + private GenericVnf genericVnf; + private VolumeGroup volumeGroup; + private CloudRegion cloudRegion; + private VfModule vfModule; + private Customer customer; + + @Rule + public final ExpectedException exception = ExpectedException.none(); + + @Before + public void before() { + customer = setCustomer(); + serviceInstance = setServiceInstance(); + network = setL3Network(); + genericVnf = setGenericVnf(); + volumeGroup = setVolumeGroup(); + cloudRegion = setCloudRegion(); + vfModule = setVfModule(); + + } + + @Test + public void createServiceInstanceTest() throws Exception { + doNothing().when(aaiServiceInstanceResources).createServiceInstance(serviceInstance, customer); + aaiCreateTasks.createServiceInstance(execution); + verify(aaiServiceInstanceResources, times(1)).createServiceInstance(serviceInstance, customer); + } + + @Test + public void createServiceInstanceExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "notfound"); + doThrow(Exception.class).when(aaiServiceInstanceResources).createServiceInstance(serviceInstance, customer); + aaiCreateTasks.createServiceInstance(execution); + } + + @Test + public void createVolumeGroupTest() throws Exception { + volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + doNothing().when(aaiVolumeGroupResources).createVolumeGroup(volumeGroup, cloudRegion); + doNothing().when(aaiVolumeGroupResources).connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion); + + aaiCreateTasks.createVolumeGroup(execution); + + verify(aaiVolumeGroupResources, times(1)).createVolumeGroup(volumeGroup, cloudRegion); + verify(aaiVolumeGroupResources, times(1)).connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion); + verify(aaiVolumeGroupResources, times(1)).connectVolumeGroupToTenant(volumeGroup, cloudRegion); + } + + @Test + public void createVolumeGroupExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + doThrow(Exception.class).when(aaiVolumeGroupResources).createVolumeGroup(volumeGroup, cloudRegion); + + aaiCreateTasks.createVolumeGroup(execution); + } + + @Test + public void createProjectTest() throws Exception { + doNothing().when(aaiServiceInstanceResources).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance); + aaiCreateTasks.createProject(execution); + verify(aaiServiceInstanceResources, times(1)).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance); + } + + @Test + public void createPlatformTest() throws Exception { + doNothing().when(aaiVnfResources).createPlatformandConnectVnf(genericVnf.getPlatform(), genericVnf); + aaiCreateTasks.createPlatform(execution); + verify(aaiVnfResources, times(1)).createPlatformandConnectVnf(genericVnf.getPlatform(), genericVnf); + } + + @Test + public void createLineOfBusinessTest() throws Exception { + doNothing().when(aaiVnfResources).createLineOfBusinessandConnectVnf(genericVnf.getLineOfBusiness(), genericVnf); + aaiCreateTasks.createLineOfBusiness(execution); + verify(aaiVnfResources, times(1)).createLineOfBusinessandConnectVnf(genericVnf.getLineOfBusiness(), genericVnf); + } + + @Test + public void createProjectExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "notfound"); + doThrow(Exception.class).when(aaiServiceInstanceResources).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance); + aaiCreateTasks.createProject(execution); + } + + @Test + public void createProjectNullProjectNameTest() throws Exception { + serviceInstance.getProject().setProjectName(null); + doNothing().when(aaiServiceInstanceResources).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance); + aaiCreateTasks.createProject(execution); + verify(aaiServiceInstanceResources, times(0)).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance); + } + + @Test + public void createProjectEmptyProjectNameTest() throws Exception { + serviceInstance.getProject().setProjectName(""); + doNothing().when(aaiServiceInstanceResources).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance); + aaiCreateTasks.createProject(execution); + verify(aaiServiceInstanceResources, times(0)).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance); + } + + @Test + public void createOwningEntityTest() throws Exception { + doReturn(true).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity()); + doNothing().when(aaiServiceInstanceResources).connectOwningEntityandServiceInstance(serviceInstance.getOwningEntity(),serviceInstance); + aaiCreateTasks.createOwningEntity(execution); + verify(aaiServiceInstanceResources, times(1)).existsOwningEntity(serviceInstance.getOwningEntity()); + verify(aaiServiceInstanceResources, times(1)).connectOwningEntityandServiceInstance(serviceInstance.getOwningEntity(), serviceInstance); + } + + @Test + public void createOwningEntityNotExistsOwningEntityTest() throws Exception { + doReturn(false).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity()); + doNothing().when(aaiServiceInstanceResources).createOwningEntityandConnectServiceInstance(serviceInstance.getOwningEntity(),serviceInstance); + aaiCreateTasks.createOwningEntity(execution); + verify(aaiServiceInstanceResources, times(1)).existsOwningEntity(serviceInstance.getOwningEntity()); + verify(aaiServiceInstanceResources, times(1)).createOwningEntityandConnectServiceInstance(serviceInstance.getOwningEntity(), serviceInstance); + } + + @Test + public void createOwningEntityNullOwningEntityIdTest() throws Exception { + expectedException.expect(BpmnError.class); + + serviceInstance.getOwningEntity().setOwningEntityId(null); + + aaiCreateTasks.createOwningEntity(execution); + } + + @Test + public void createOwningEntityEmptyOwningEntityIdTest() throws Exception { + expectedException.expect(BpmnError.class); + + serviceInstance.getOwningEntity().setOwningEntityId(""); + + aaiCreateTasks.createOwningEntity(execution); + } + + @Test + public void createOwningEntityNullOwningEntityNameTest() throws Exception { + expectedException.expect(BpmnError.class); + + serviceInstance.getOwningEntity().setOwningEntityName(null); + + doReturn(false).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity()); + + aaiCreateTasks.createOwningEntity(execution); + } + + @Test + public void createOwningEntityEmptyOwningEntityNameTest() throws Exception { + expectedException.expect(BpmnError.class); + + serviceInstance.getOwningEntity().setOwningEntityName(""); + + doReturn(false).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity()); + + aaiCreateTasks.createOwningEntity(execution); + } + + @Test + public void createOwningEntityExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doReturn(true).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity()); + + doThrow(Exception.class).when(aaiServiceInstanceResources).connectOwningEntityandServiceInstance(serviceInstance.getOwningEntity(), serviceInstance); + + aaiCreateTasks.createOwningEntity(execution); + } + + @Test + public void createVnfTest() throws Exception { + doNothing().when(aaiVnfResources).createVnfandConnectServiceInstance(genericVnf, serviceInstance); + aaiCreateTasks.createVnf(execution); + verify(aaiVnfResources, times(1)).createVnfandConnectServiceInstance(genericVnf, serviceInstance); + } + + @Test + public void createVnfExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "notfound"); + doNothing().when(aaiVnfResources).createVnfandConnectServiceInstance(genericVnf, serviceInstance); + aaiCreateTasks.createVnf(execution); + verify(aaiVnfResources, times(1)).createVnfandConnectServiceInstance(genericVnf, serviceInstance); + } + + + @Test + public void createVfModuleTest() throws Exception { + doNothing().when(aaiVfModuleResources).createVfModule(vfModule, genericVnf); + aaiCreateTasks.createVfModule(execution); + verify(aaiVfModuleResources, times(1)).createVfModule(vfModule, genericVnf); + } + + @Test + public void createServiceSubscriptionTest(){ + doNothing().when(aaiServiceInstanceResources).createServiceSubscription(customer); + aaiCreateTasks.createServiceSubscription(execution); + verify(aaiServiceInstanceResources, times(1)).createServiceSubscription(customer); + } + + @Test + public void createServiceSubscriptionTestExceptionHandling(){ + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiServiceInstanceResources).createServiceSubscription(customer); + aaiCreateTasks.createServiceSubscription(execution); + } + + @Test + public void createServiceSubscriptionTestCustomerIsNull(){ + expectedException.expect(BpmnError.class); + gBBInput.setCustomer(null); + aaiCreateTasks.createServiceSubscription(execution); + } + + @Test + public void createVfModuleExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiVfModuleResources).createVfModule(vfModule, genericVnf); + aaiCreateTasks.createVfModule(execution); + } + + @Test + public void connectVfModuleToVolumeGroupTest() throws Exception { + doNothing().when(aaiVfModuleResources).connectVfModuleToVolumeGroup(genericVnf, vfModule, volumeGroup, cloudRegion); + aaiCreateTasks.connectVfModuleToVolumeGroup(execution); + verify(aaiVfModuleResources, times(1)).connectVfModuleToVolumeGroup(genericVnf, vfModule, volumeGroup, cloudRegion); + } + + @Test + public void createNetworkTest() throws Exception { + network.getModelInfoNetwork().setNeutronNetworkType("PROVIDER"); + + doNothing().when(aaiNetworkResources).createNetworkConnectToServiceInstance(network,serviceInstance); + aaiCreateTasks.createNetwork(execution); + verify(aaiNetworkResources, times(1)).createNetworkConnectToServiceInstance(network, serviceInstance); + } + + @Test + public void createNetworkExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + lookupKeyMap.put(ResourceKey.NETWORK_ID, "notfound"); + doThrow(Exception.class).when(aaiNetworkResources).createNetworkConnectToServiceInstance(network,serviceInstance); + aaiCreateTasks.createNetwork(execution); + } + + @Test + public void createCustomerTest() throws Exception { + doNothing().when(aaiVpnBindingResources).createCustomer(customer); + + aaiCreateTasks.createCustomer(execution); + + verify(aaiVpnBindingResources, times(1)).createCustomer(customer); + } + + @Test + public void createCustomerExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiVpnBindingResources).createCustomer(customer); + + aaiCreateTasks.createCustomer(execution); + } + + @Test + public void createNetworkCollectionTest() throws Exception { + doNothing().when(aaiNetworkResources).createNetworkCollection(serviceInstance.getCollection()); + execution.setVariable("networkCollectionName", "testNetworkCollectionName"); + aaiCreateTasks.createNetworkCollection(execution); + verify(aaiNetworkResources, times(1)).createNetworkCollection(serviceInstance.getCollection()); + } + + @Test + public void createNetworkCollectionInstanceGroupTest() throws Exception { + doNothing().when(aaiNetworkResources).createNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup()); + aaiCreateTasks.createNetworkCollectionInstanceGroup(execution); + verify(aaiNetworkResources, times(1)).createNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup()); + } + + @Test + public void connectNetworkToNetworkCollectionServiceInstanceTest() throws Exception { + doNothing().when(aaiNetworkResources).connectNetworkToNetworkCollectionServiceInstance(network, serviceInstance); + aaiCreateTasks.connectNetworkToNetworkCollectionServiceInstance(execution); + verify(aaiNetworkResources, times(1)).connectNetworkToNetworkCollectionServiceInstance(network, serviceInstance); + } + + @Test + public void connectNetworkToNetworkCollectionInstanceGroupTest() throws Exception { + doNothing().when(aaiNetworkResources).connectNetworkToNetworkCollectionInstanceGroup(network, serviceInstance.getCollection().getInstanceGroup()); + aaiCreateTasks.connectNetworkToNetworkCollectionInstanceGroup(execution); + verify(aaiNetworkResources, times(1)).connectNetworkToNetworkCollectionInstanceGroup(network, serviceInstance.getCollection().getInstanceGroup()); + } + + @Test + public void connectNetworkToNullNetworkCollectionInstanceGroupTest() throws Exception { + //reset test data to have no network collection instance group + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("testServiceInstanceId"); + L3Network network = new L3Network(); + network.setNetworkId("testNetworkId"); + serviceInstance.getNetworks().add(network); + lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId()); + gBBInput.setServiceInstance(serviceInstance); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId()); + //verify connection call was not executednetwork + exception.expect(BpmnError.class); + aaiCreateTasks.connectNetworkToNetworkCollectionInstanceGroup(execution); + verify(aaiNetworkResources, never()).connectNetworkToNetworkCollectionInstanceGroup(network, null); + } + + @Test + public void connectNetworkToCloudRegionTest() throws Exception { + gBBInput = execution.getGeneralBuildingBlock(); + doNothing().when(aaiNetworkResources).connectNetworkToCloudRegion(network, gBBInput.getCloudRegion()); + aaiCreateTasks.connectNetworkToCloudRegion(execution); + verify(aaiNetworkResources, times(1)).connectNetworkToCloudRegion(network, gBBInput.getCloudRegion()); + } + + @Test + public void connectNetworkToTenantTest() throws Exception { + gBBInput = execution.getGeneralBuildingBlock(); + doNothing().when(aaiNetworkResources).connectNetworkToTenant(network, gBBInput.getCloudRegion()); + aaiCreateTasks.connectNetworkToTenant(execution); + verify(aaiNetworkResources, times(1)).connectNetworkToTenant(network, gBBInput.getCloudRegion()); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java new file mode 100644 index 0000000000..6ad263a935 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -0,0 +1,427 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.aai.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.springframework.beans.factory.annotation.Autowired; + +public class AAIUpdateTasksTest extends BaseTaskTest{ + @Autowired + private AAIUpdateTasks aaiUpdateTasks; + + private L3Network network; + private ServiceInstance serviceInstance; + private VfModule vfModule; + private GenericVnf genericVnf; + private VolumeGroup volumeGroup; + private CloudRegion cloudRegion; + + @Before + public void before() { + serviceInstance = setServiceInstance(); + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + volumeGroup = setVolumeGroup(); + cloudRegion = setCloudRegion(); + network = setL3Network(); + } + + @Test + public void updateOrchestrationStatusAssignedServiceTest() throws Exception { + doNothing().when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusAssignedService(execution); + + verify(aaiServiceInstanceResources, times(1)).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED); + } + + @Test + public void updateOrchestrationStatusAssignedServiceExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusAssignedService(execution); + } + + @Test + public void updateOrchestrationStatusActiveServiceTest() throws Exception { + doNothing().when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE); + + aaiUpdateTasks.updateOrchestrationStatusActiveService(execution); + + verify(aaiServiceInstanceResources, times(1)).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE); + } + + @Test + public void updateOrchestrationStatusActiveServiceExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE); + + aaiUpdateTasks.updateOrchestrationStatusActiveService(execution); + } + + @Test + public void updateOrchestrationStatusAssignedVnfTest() throws Exception { + doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusAssignedVnf(execution); + + verify(aaiVnfResources, times(1)).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED); + } + + @Test + public void updateOrchestrationStatusAssignedVnfExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusAssignedVnf(execution); + } + + @Test + public void updateOrchestrationStatusActiveVnfTest() throws Exception { + doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE); + + aaiUpdateTasks.updateOrchestrationStatusActiveVnf(execution); + + verify(aaiVnfResources, times(1)).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE); + } + + @Test + public void updateOrchestrationStatusActiveVnfExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE); + + aaiUpdateTasks.updateOrchestrationStatusActiveVnf(execution); + } + + @Test + public void updateOrchestrationStatusAssignVfModuleTest() throws Exception { + doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); + aaiUpdateTasks.updateOrchestrationStatusAssignedVfModule(execution); + verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); + assertEquals("", vfModule.getHeatStackId()); + } + + @Test + public void updateOrchestrationStatusAssignVfModuleExceptionTest() throws Exception { + doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); + + expectedException.expect(BpmnError.class); + + aaiUpdateTasks.updateOrchestrationStatusAssignedVfModule(execution); + } + + @Test + public void updateOrchestrationStatusCreatedVfModuleTest() throws Exception { + doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); + aaiUpdateTasks.updateOrchestrationStatusCreatedVfModule(execution); + verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); + } + + @Test + public void updateOrchestrationStatusCreatedVfModuleExceptionTest() throws Exception { + doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); + + expectedException.expect(BpmnError.class); + + aaiUpdateTasks.updateOrchestrationStatusCreatedVfModule(execution); + } + + @Test + public void updateOrchestrationStatusPendingActivatefModuleTest() throws Exception { + doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION); + + aaiUpdateTasks.updateOrchestrationStatusPendingActivationVfModule(execution); + + verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION); + } + + @Test + public void updateOrchestrationStatusPendingActivatefModuleExceptionTest() throws Exception { + doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION); + + expectedException.expect(BpmnError.class); + + aaiUpdateTasks.updateOrchestrationStatusPendingActivationVfModule(execution); + } + + @Test + public void updateOrchestrationStatusDectivateVfModuleTest() throws Exception { + doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); + + aaiUpdateTasks.updateOrchestrationStatusDeactivateVfModule(execution); + + verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); + } + + @Test + public void updateOrchestrationStatusDectivateVfModuleExceptionTest() throws Exception { + doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); + + expectedException.expect(BpmnError.class); + + aaiUpdateTasks.updateOrchestrationStatusDeactivateVfModule(execution); + } + + @Test + public void updateOrchestrationStatusActiveVolumeGroupTest() throws Exception { + doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); + + aaiUpdateTasks.updateOrchestrationStatusActiveVolumeGroup(execution); + + verify(aaiVolumeGroupResources, times(1)).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); + } + + @Test + public void updateOrchestrationStatusActiveVolumeGroupExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); + aaiUpdateTasks.updateOrchestrationStatusActiveVolumeGroup(execution); + } + + @Test + public void updateOrchestrationStatusCreatedVolumeGroupTest() throws Exception { + doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED); + + aaiUpdateTasks.updateOrchestrationStatusCreatedVolumeGroup(execution); + + verify(aaiVolumeGroupResources, times(1)).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED); + } + + @Test + public void updateOrchestrationStatusCreatedVolumeGroupExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED); + aaiUpdateTasks.updateOrchestrationStatusCreatedVolumeGroup(execution); + } + + @Test + public void test_updateOrchestrationStatusAssignedVolumeGroup() throws Exception { + doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(execution); + + verify(aaiVolumeGroupResources, times(1)).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED); + assertEquals("", volumeGroup.getHeatStackId()); + } + + @Test + public void test_updateOrchestrationStatusAssignedVolumeGroup_exception() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED); + aaiUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(execution); + } + @Test + public void updateOstatusAssignedNetworkTest() throws Exception { + doNothing().when(aaiNetworkResources).updateNetwork(network); + + aaiUpdateTasks.updateOrchestrationStatusAssignedNetwork(execution); + + verify(aaiNetworkResources, times(1)).updateNetwork(network); + assertEquals("", network.getHeatStackId()); + } + + @Test + public void updateOstatusAssignedNetworkExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network); + + aaiUpdateTasks.updateOrchestrationStatusAssignedNetwork(execution); + } + + @Test + public void updateOstatusActivedNetworkTest() throws Exception { + doNothing().when(aaiNetworkResources).updateNetwork(network); + + aaiUpdateTasks.updateOrchestrationStatusActiveNetwork(execution); + + verify(aaiNetworkResources, times(1)).updateNetwork(network); + } + + @Test + public void updateOstatusCreatedNetworkTest() throws Exception { + doNothing().when(aaiNetworkResources).updateNetwork(network); + + aaiUpdateTasks.updateOrchestrationStatusActiveNetwork(execution); + + verify(aaiNetworkResources, times(1)).updateNetwork(network); + } + + @Test + public void updateOstatusActiveNetworkExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network); + + aaiUpdateTasks.updateOrchestrationStatusActiveNetwork(execution); + } + + @Test + public void updateOstatusActivedNetworkCollectionTest() throws Exception { + doNothing().when(aaiCollectionResources).updateCollection(serviceInstance.getCollection()); + aaiUpdateTasks.updateOrchestrationStatusActiveNetworkCollection(execution); + verify(aaiCollectionResources, times(1)).updateCollection(serviceInstance.getCollection()); + } + + @Test + public void updateOstatusActiveNetworkColectionExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiCollectionResources).updateCollection(serviceInstance.getCollection()); + aaiUpdateTasks.updateOrchestrationStatusActiveNetworkCollection(execution); + } + + @Test + public void updateOrchestrationStatusActivateVfModuleTest() throws Exception { + doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ACTIVE); + + aaiUpdateTasks.updateOrchestrationStatusActivateVfModule(execution); + + verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ACTIVE); + } + + @Test + public void updateOrchestrationStatusActivateVfModuleExceptionTest() throws Exception { + doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ACTIVE); + + expectedException.expect(BpmnError.class); + + aaiUpdateTasks.updateOrchestrationStatusActivateVfModule(execution); + } + + @Test + public void updateNetworkCreatedTest() throws Exception { + CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse(); + createNetworkResponse.setNetworkFqdn("testNetworkFqdn"); + createNetworkResponse.setNetworkStackId("testNetworkStackId"); + + execution.setVariable("createNetworkResponse", createNetworkResponse); + + doNothing().when(aaiNetworkResources).updateNetwork(network); + aaiUpdateTasks.updateNetworkCreated(execution); + verify(aaiNetworkResources, times(1)).updateNetwork(network); + + assertEquals(createNetworkResponse.getNetworkFqdn(), network.getContrailNetworkFqdn()); + assertEquals(OrchestrationStatus.CREATED, network.getOrchestrationStatus()); + assertEquals(createNetworkResponse.getNetworkStackId(), network.getHeatStackId()); + assertEquals(createNetworkResponse.getNeutronNetworkId(), network.getNeutronNetworkId()); + } + + @Test + public void updateNetworkCreatedkExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network); + aaiUpdateTasks.updateNetworkCreated(execution); + } + + @Test + public void updateObjectNetworkTest() { + doNothing().when(aaiNetworkResources).updateNetwork(network); + + aaiUpdateTasks.updateObjectNetwork(execution); + + verify(aaiNetworkResources, times(1)).updateNetwork(network); + } + + @Test + public void updateObjectNetworkExceptionText() { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network); + + aaiUpdateTasks.updateObjectNetwork(execution); + } + + @Test + public void test_updateServiceInstance() { + doNothing().when(aaiServiceInstanceResources).updateServiceInstance(serviceInstance); + aaiUpdateTasks.updateServiceInstance(execution); + verify(aaiServiceInstanceResources, times(1)).updateServiceInstance(serviceInstance); + } + + @Test + public void test_updateServiceInstance_exception() { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiServiceInstanceResources).updateServiceInstance(serviceInstance); + aaiUpdateTasks.updateServiceInstance(execution); + } + + @Test + public void updateObjectVnfTest() { + doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf); + + aaiUpdateTasks.updateObjectVnf(execution); + + verify(aaiVnfResources, times(1)).updateObjectVnf(genericVnf); + } + + @Test + public void updateObjectVnfExceptionTest() { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiVnfResources).updateObjectVnf(genericVnf); + aaiUpdateTasks.updateObjectVnf(execution); + } + + @Test + public void updateOrchestrationStatusDeleteVfModuleTest() throws Exception { + doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusDeleteVfModule(execution); + + verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); + assertEquals("", vfModule.getHeatStackId()); + } + + @Test + public void updateModelVfModuleTest() { + doNothing().when(aaiVfModuleResources).changeAssignVfModule(vfModule, genericVnf); + aaiUpdateTasks.updateModelVfModule(execution); + verify(aaiVfModuleResources, times(1)).changeAssignVfModule(vfModule, genericVnf); + } + + @Test + public void updateModelVfModuleExceptionTest() { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiVfModuleResources).changeAssignVfModule(vfModule, genericVnf); + aaiUpdateTasks.updateModelVfModule(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java new file mode 100644 index 0000000000..64760c03a0 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.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.bpmn.infrastructure.adapter.network.tasks; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Map; +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + +public class NetworkAdapterCreateTasksTest extends BaseTaskTest{ + @Autowired + private NetworkAdapterCreateTasks networkAdapterCreateTasks; + + private ServiceInstance serviceInstance; + private RequestContext requestContext; + private CloudRegion cloudRegion; + private OrchestrationContext orchestrationContext; + private L3Network l3Network; + private Map userInput; + private Customer customer; + + @Before + public void before() { + customer = setCustomer(); + serviceInstance = setServiceInstance(); + l3Network = setL3Network(); + userInput = setUserInput(); + userInput.put("userInputKey1", "userInputValue1"); + requestContext = setRequestContext(); + cloudRegion = setCloudRegion(); + orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + } + + @Test + public void createNetworkTest() throws Exception { + CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse(); + createNetworkResponse.setNetworkStackId("networkStackId"); + createNetworkResponse.setNetworkCreated(true); + Optional oCreateNetworkResponse = Optional.of(createNetworkResponse); + + String cloudRegionPo = "cloudRegionPo"; + execution.setVariable("cloudRegionPo", cloudRegionPo); + + doReturn(oCreateNetworkResponse).when(networkAdapterResources).createNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo,customer); + networkAdapterCreateTasks.createNetwork(execution); + verify(networkAdapterResources, times(1)).createNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo,customer); + } + + @Test + public void rollbackCreateNetworkTest() throws Exception { + CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse(); + createNetworkResponse.setNetworkStackId("networkStackId"); + createNetworkResponse.setNetworkCreated(true); + execution.setVariable("createNetworkResponse", createNetworkResponse); + Optional oCreateNetworkResponse = Optional.of(createNetworkResponse); + + String cloudRegionPo = "cloudRegionPo"; + execution.setVariable("cloudRegionPo", cloudRegionPo); + + doReturn(oCreateNetworkResponse).when(networkAdapterResources).rollbackCreateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse); + networkAdapterCreateTasks.rollbackCreateNetwork(execution); + verify(networkAdapterResources, times(1)).rollbackCreateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java new file mode 100644 index 0000000000..88b654fd45 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.adapter.network.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.io.UnsupportedEncodingException; +import java.util.Optional; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.adapters.nwrest.DeleteNetworkResponse; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.client.adapter.network.NetworkAdapterClientException; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + +public class NetworkAdapterDeleteTasksTest extends BaseTaskTest{ + @Autowired + private NetworkAdapterDeleteTasks networkAdapterDeleteTasks; + + private ServiceInstance serviceInstance; + private L3Network l3Network; + private RequestContext requestContext; + private CloudRegion cloudRegion; + private String cloudRegionPo; + + @Before + public void before() { + serviceInstance = setServiceInstance(); + l3Network = setL3Network(); + requestContext = setRequestContext(); + cloudRegion = setCloudRegion(); + } + + @Test + public void test_deleteNetwork() throws UnsupportedEncodingException, NetworkAdapterClientException { + + DeleteNetworkResponse deleteNetworkResponse = new DeleteNetworkResponse(); + deleteNetworkResponse.setNetworkDeleted(true); + deleteNetworkResponse.setNetworkId(l3Network.getNetworkId()); + Optional oDeleteNetworkResponse = Optional.of(deleteNetworkResponse); + doReturn(oDeleteNetworkResponse).when(networkAdapterResources).deleteNetwork(requestContext, cloudRegion, serviceInstance, l3Network); + + networkAdapterDeleteTasks.deleteNetwork(execution); + + verify(networkAdapterResources, times(1)).deleteNetwork(requestContext, cloudRegion, serviceInstance, l3Network); + assertEquals(deleteNetworkResponse, execution.getVariable("deleteNetworkResponse")); + } + + @Test + public void test_deleteNetwork_exception() { + expectedException.expect(BpmnError.class); + + networkAdapterDeleteTasks.deleteNetwork(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java new file mode 100644 index 0000000000..6489c9b149 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java @@ -0,0 +1,101 @@ +/*- + * ============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.bpmn.infrastructure.adapter.network.tasks; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Map; +import java.util.Optional; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.adapters.nwrest.UpdateNetworkResponse; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + +public class NetworkAdapterUpdateTasksTest extends BaseTaskTest{ + @Autowired + private NetworkAdapterUpdateTasks networkAdapterUpdateTasks; + + private ServiceInstance serviceInstance; + private L3Network network; + private RequestContext requestContext; + private CloudRegion cloudRegion; + private OrchestrationContext orchestrationContext; + private Map userInput; + private Customer customer; + + @Before + public void before() { + customer = setCustomer(); + serviceInstance = setServiceInstance(); + network = setL3Network(); + requestContext = setRequestContext(); + cloudRegion = setCloudRegion(); + orchestrationContext = setOrchestrationContext(); + userInput = setUserInput(); + userInput.put("userInputKey1", "userInputValue1"); + + } + + @Test + public void updateNetworkTest() throws Exception { + UpdateNetworkResponse updateNetworkResponse = new UpdateNetworkResponse(); + updateNetworkResponse.setMessageId("messageId"); + updateNetworkResponse.setNetworkId("networkId"); + Optional oUpdateNetworkResponse = Optional.of(updateNetworkResponse); + + doReturn(oUpdateNetworkResponse).when(networkAdapterResources).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer); + + networkAdapterUpdateTasks.updateNetwork(execution); + + verify(networkAdapterResources, times(1)).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer); + assertEquals(updateNetworkResponse, execution.getVariable("NetworkAdapterUpdateNetworkResponse")); + } + + @Test + public void updateNetworkNoResponseTest() throws Exception { + doReturn(Optional.empty()).when(networkAdapterResources).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer); + + networkAdapterUpdateTasks.updateNetwork(execution); + + verify(networkAdapterResources, times(1)).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer); + assertNull(execution.getVariable("NetworkAdapterUpdateNetworkResponse")); + } + + @Test + public void updateNetworkExceptionTest() { + expectedException.expect(BpmnError.class); + + networkAdapterUpdateTasks.updateNetwork(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java new file mode 100644 index 0000000000..f54e3faf1d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java @@ -0,0 +1,157 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.adapter.vnf.tasks; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Test; +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.springframework.beans.factory.annotation.Autowired; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +public class VnfAdapterCreateTasksTest extends BaseTaskTest{ + @Autowired + private VnfAdapterCreateTasks vnfAdapterCreateTasks; + + @Test + public void test_createVolumeGroupRequest() throws Exception { + RequestContext requestContext = setRequestContext(); + + ServiceInstance serviceInstance = setServiceInstance(); + + GenericVnf genericVnf = setGenericVnf(); + + VfModule vfModule = setVfModule(); + vfModule.setSelflink("vfModuleSelfLink"); + VolumeGroup volumeGroup = setVolumeGroup(); + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + CloudRegion cloudRegion = setCloudRegion(); + + OrchestrationContext orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + String sdncVnfQueryResponse = "SDNCVnfQueryResponse"; + execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncVnfQueryResponse); + + CreateVolumeGroupRequest request = new CreateVolumeGroupRequest(); + request.setVolumeGroupId("volumeGroupStackId"); + + doReturn(request).when(vnfAdapterVolumeGroupResources).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVnfQueryResponse); + + vnfAdapterCreateTasks.createVolumeGroupRequest(execution); + + verify(vnfAdapterVolumeGroupResources, times(1)).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVnfQueryResponse); + + assertEquals(request.toXmlString(), execution.getVariable("VNFREST_Request")); + } + + @Test + public void test_createVolumeGroupRequest_for_alaCarte_flow() throws Exception { + RequestContext requestContext = setRequestContext(); + ServiceInstance serviceInstance = setServiceInstance(); + GenericVnf genericVnf = setGenericVnf(); + VolumeGroup volumeGroup = setVolumeGroup(); + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + CloudRegion cloudRegion = setCloudRegion(); + + OrchestrationContext orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + CreateVolumeGroupRequest request = new CreateVolumeGroupRequest(); + request.setVolumeGroupId("volumeGroupStackId"); + + doReturn(request).when(vnfAdapterVolumeGroupResources).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, null); + + vnfAdapterCreateTasks.createVolumeGroupRequest(execution); + + verify(vnfAdapterVolumeGroupResources, times(1)).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, null); + + assertEquals(request.toXmlString(), execution.getVariable("VNFREST_Request")); + } + + @Test + public void test_createVolumeGroupRequest_exception() throws Exception { + // run with no data setup, and it will throw a BBObjectNotFoundException + expectedException.expect(BpmnError.class); + + vnfAdapterCreateTasks.createVolumeGroupRequest(execution); + } + + @Test + public void test_createVfModule() throws Exception { + RequestContext requestContext = setRequestContext(); + + ServiceInstance serviceInstance = setServiceInstance(); + + GenericVnf genericVnf = setGenericVnf(); + + VfModule vfModule = setVfModule(); + + CloudRegion cloudRegion = setCloudRegion(); + + OrchestrationContext orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + CreateVfModuleRequest modRequest = new CreateVfModuleRequest(); + modRequest.setVfModuleId(vfModule.getVfModuleId()); + modRequest.setBaseVfModuleStackId("baseVfModuleStackId"); + modRequest.setVfModuleName(vfModule.getVfModuleName()); + CreateVfModuleRequest createVfModuleRequest = modRequest; + + String sdncVfModuleQueryResponse = "{someJson}"; + execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncVfModuleQueryResponse); + + String sdncVnfQueryResponse = "{someJson}"; + execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), sdncVnfQueryResponse); + + doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + vnfAdapterCreateTasks.createVfModule(execution); + + verify(vnfAdapterVfModuleResources, times(1)).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + assertEquals(execution.getVariable("VNFREST_Request"), createVfModuleRequest.toXmlString()); + } + + @Test + public void createVfModuleExceptionTest() throws Exception { + // run with no data setup, and it will throw a BBObjectNotFoundException + expectedException.expect(BpmnError.class); + vnfAdapterCreateTasks.createVolumeGroupRequest(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java new file mode 100644 index 0000000000..4ea11c235b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.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.bpmn.infrastructure.adapter.vnf.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + +public class VnfAdapterDeleteTasksTest extends BaseTaskTest{ + @Autowired + private VnfAdapterDeleteTasks vnfAdapterDeleteTasks; + + private VolumeGroup volumeGroup; + private VfModule vfModule; + private GenericVnf genericVnf; + private RequestContext requestContext; + private CloudRegion cloudRegion; + private ServiceInstance serviceInstance; + private OrchestrationContext orchestrationContext; + + @Before + public void before() throws Exception { + requestContext = setRequestContext(); + + serviceInstance = setServiceInstance(); + + cloudRegion = setCloudRegion(); + + genericVnf = setGenericVnf(); + + vfModule = setVfModule(); + + volumeGroup = setVolumeGroup(); + + orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + } + + @Test + public void test_deleteVfModule() throws Exception { + DeleteVfModuleRequest deleteVfModuleRequest = new DeleteVfModuleRequest(); + deleteVfModuleRequest.setVfModuleId("vfModuleId"); + + doReturn(deleteVfModuleRequest).when(vnfAdapterVfModuleResources).deleteVfModuleRequest(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule); + + vnfAdapterDeleteTasks.deleteVfModule(execution); + + verify(vnfAdapterVfModuleResources, times(1)).deleteVfModuleRequest(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule); + assertEquals(execution.getVariable("VNFREST_Request"), deleteVfModuleRequest.toXmlString()); + } + + @Test + public void deleteVfModuleExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(vnfAdapterVfModuleResources).deleteVfModuleRequest(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule); + + vnfAdapterDeleteTasks.deleteVfModule(execution); + } + + @Test + public void test_deleteVolumeGroup() throws Exception { + DeleteVolumeGroupResponse deleteVolumeGroupResponse = new DeleteVolumeGroupResponse(); + + doReturn(deleteVolumeGroupResponse).when(vnfAdapterVolumeGroupResources).deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup); + + vnfAdapterDeleteTasks.deleteVolumeGroup(execution); + + verify(vnfAdapterVolumeGroupResources, times(1)).deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup); + } + + @Test + public void deleteVolumeGroupExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(vnfAdapterVolumeGroupResources).deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup); + + vnfAdapterDeleteTasks.deleteVolumeGroup(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java new file mode 100644 index 0000000000..24a99c97f4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java @@ -0,0 +1,169 @@ +/*- + * ============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.bpmn.infrastructure.adapter.vnf.tasks; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.FileUtil; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + +public class VnfAdapterImplTest extends BaseTaskTest { + @Autowired + private VnfAdapterImpl vnfAdapterImpl; + + private RequestContext requestContext; + private ServiceInstance serviceInstance; + private VfModule vfModule; + private VolumeGroup volumeGroup; + + private static final String VNF_ADAPTER_REST_DELETE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/VNFAdapterRestDeleteResponse.xml"); + private static final String VNF_ADAPTER_REST_CREATE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/VNFAdapterRestCreateCallback.xml"); + private static final String VNF_ADAPTER_VOLUME_CREATE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml"); + private static final String TEST_VFMODULE_HEATSTACK_ID = "slowburn"; + private static final String TEST_VOLUME_HEATSTACK_ID = "testHeatStackId1"; + + @Before + public void before() { + requestContext = setRequestContext(); + serviceInstance = setServiceInstance(); + vfModule = setVfModule(); + volumeGroup = setVolumeGroup(); + vfModule.setHeatStackId(null); + } + + @Test + public void preProcessVnfAdapterTest() { + vnfAdapterImpl.preProcessVnfAdapter(execution); + + assertEquals("true", execution.getVariable("isDebugLogEnabled")); + assertEquals(requestContext.getMsoRequestId(), execution.getVariable("mso-request-id")); + assertEquals(serviceInstance.getServiceInstanceId(), execution.getVariable("mso-service-instance-id")); + } + + @Test + public void postProcessVnfAdapter_CreateResponseTest() { + execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId()); + } + + + @Test + public void postProcessVnfAdapter_CreateResponseTest_EmptyCreateVfModuleResponseTag() { + expectedException.expect(BpmnError.class); + execution.setVariable("vnfAdapterRestV1Response", ""); + vnfAdapterImpl.postProcessVnfAdapter(execution); + } + + @Test + public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleStackIdTag() { + execution.setVariable("vnfAdapterRestV1Response", ""); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(vfModule.getHeatStackId()); + } + + @Test + public void postProcessVnfAdapter_CreateResponseTest_EmptyHeatStackId() { + execution.setVariable("vnfAdapterRestV1Response", ""); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(vfModule.getHeatStackId()); + } + + @Test + public void postProcessVnfAdapter_DeleteResponseTest() { + execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_DELETE_RESPONSE); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(vfModule.getHeatStackId()); + } + + @Test + public void postProcessVnfAdapter_ResponseNullTest() { + execution.setVariable("vnfAdapterRestV1Response", null); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(vfModule.getHeatStackId()); + } + + @Test + public void postProcessVnfAdapter_ResponseEmptyTest() { + execution.setVariable("vnfAdapterRestV1Response", ""); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(vfModule.getHeatStackId()); + } + + @Test + public void postProcessVnfAdapter_DeleteResponseTest_VfModuleDeletedFalse() { + execution.setVariable("vnfAdapterRestV1Response", "false"); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(vfModule.getHeatStackId()); + } + + @Test + public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVfModuleResponseTag() { + expectedException.expect(BpmnError.class); + execution.setVariable("vnfAdapterRestV1Response", ""); + vnfAdapterImpl.postProcessVnfAdapter(execution); + } + + @Test + public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleDeletedTag() { + execution.setVariable("vnfAdapterRestV1Response", ""); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(vfModule.getHeatStackId()); + } + + @Test + public void preProcessVnfAdapterExceptionTest() { + expectedException.expect(BpmnError.class); + lookupKeyMap.clear(); + vnfAdapterImpl.preProcessVnfAdapter(execution); + } + + @Test + public void postProcessVnfAdapter_CreateVolumeResponseTest() { + execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_CREATE_RESPONSE); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId()); + } + + @Test + public void postProcessVnfAdapter_CreateVolumeEmptyResponseTest() { + expectedException.expect(BpmnError.class); + execution.setVariable("vnfAdapterRestV1Response", ""); + vnfAdapterImpl.postProcessVnfAdapter(execution); + } + + @Test + public void postProcessVnfAdapterExceptionTest() { + execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE); + expectedException.expect(BpmnError.class); + lookupKeyMap.clear(); + vnfAdapterImpl.postProcessVnfAdapter(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtilsTest.java new file mode 100644 index 0000000000..dff953802e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtilsTest.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.bpmn.infrastructure.flowspecific.tasks; + +import static org.junit.Assert.assertEquals; + +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; + +public class AssignNetworkBBUtilsTest extends BaseTaskTest { + //Necessary because AssignNetworkBBUtils is already mocked using MockBean in the base class for use in other tests + private AssignNetworkBBUtils nonMockAssignNetworkBBUtils = new AssignNetworkBBUtils(); + + private CloudRegion cloudRegion; + + @Before + public void before() { + cloudRegion = setCloudRegion(); + } + + @Test + public void getCloudRegionTest25() throws Exception { + cloudRegion.setCloudRegionVersion("2.5"); + + nonMockAssignNetworkBBUtils.getCloudRegion(execution); + + assertEquals(cloudRegion.getLcpCloudRegionId(), execution.getVariable("cloudRegionPo")); + assertEquals("AAIAIC25", execution.getVariable("cloudRegionSdnc")); + } + + @Test + public void getCloudRegionTest30() throws Exception { + cloudRegion.setCloudRegionVersion("3.0"); + + nonMockAssignNetworkBBUtils.getCloudRegion(execution); + + assertEquals(cloudRegion.getLcpCloudRegionId(), execution.getVariable("cloudRegionPo")); + assertEquals(cloudRegion.getLcpCloudRegionId(), execution.getVariable("cloudRegionSdnc")); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java new file mode 100644 index 0000000000..a206140014 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.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.bpmn.infrastructure.flowspecific.tasks; + +import static org.junit.Assert.assertEquals; + +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.springframework.beans.factory.annotation.Autowired; + +public class AssignNetworkTest extends BaseTaskTest { + + @Autowired + private AssignNetwork assignNetwork; + + private ServiceInstance serviceInstance; + private L3Network network; + + @Before + public void before() { + serviceInstance = setServiceInstance(); + network = setL3Network(); + } + + @Test + public void hasCollectionTest() throws Exception { + setServiceInstance(); + //collection present by default base test setup + boolean hasCollection = assignNetwork.hasCollection(execution); + assertEquals(true, hasCollection); + + boolean skip = assignNetwork.skipNetworkCreationInAAI(execution); + assertEquals(false, skip); + } + + @Test + public void hasNoCollectionTest() throws Exception { + //clear collection + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + serviceInstance.setCollection(null); + boolean hasCollection = assignNetwork.hasCollection(execution); + assertEquals(false, hasCollection); + + boolean skip = assignNetwork.skipNetworkCreationInAAI(execution); + assertEquals(true, skip); + } + + @Test + public void hasNoCollectionNoNetworkTest() throws Exception { + //clear collection and updated network status to PRECREATED - when it was NOT found by name + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + serviceInstance.setCollection(null); + network.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + boolean hasCollection = assignNetwork.hasCollection(execution); + boolean networkFound = assignNetwork.networkFoundByName(execution); + assertEquals(false, hasCollection); + assertEquals(false, networkFound); + + boolean skip = assignNetwork.skipNetworkCreationInAAI(execution); + assertEquals(true, skip); + } + + @Test + public void hasNetworkNoCollectionTest() throws Exception { + //clear collection and updated network status to INVENTORIED - when it was found by name + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + serviceInstance.setCollection(null); + network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + boolean hasCollection = assignNetwork.hasCollection(execution); + boolean networkFound = assignNetwork.networkFoundByName(execution); + assertEquals(false, hasCollection); + assertEquals(true, networkFound); + + boolean skip = assignNetwork.skipNetworkCreationInAAI(execution); + assertEquals(true, skip); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java new file mode 100644 index 0000000000..e1b652a140 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java @@ -0,0 +1,110 @@ +/*- + * ============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.bpmn.infrastructure.flowspecific.tasks; + +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.List; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.springframework.beans.factory.annotation.Autowired; + +public class AssignVnfTest extends BaseTaskTest { + @Autowired + private AssignVnf assignVnf; + + private InstanceGroup instanceGroup1; + private InstanceGroup instanceGroup2; + private InstanceGroup instanceGroup3; + private InstanceGroup instanceGroup4; + private GenericVnf genericVnf; + + @Before + public void before() { + ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup(); + modelVnfc.setType("VNFC"); + modelVnfc.setFunction("function"); + + ModelInfoInstanceGroup modelNetworkInstanceGroup = new ModelInfoInstanceGroup(); + modelNetworkInstanceGroup.setType("networkInstanceGroup"); + modelNetworkInstanceGroup.setFunction("function"); + + instanceGroup1 = new InstanceGroup(); + instanceGroup1.setId("test-001"); + instanceGroup1.setModelInfoInstanceGroup(modelVnfc); + + instanceGroup2 = new InstanceGroup(); + instanceGroup2.setId("test-002"); + instanceGroup2.setModelInfoInstanceGroup(modelVnfc); + + instanceGroup3 = new InstanceGroup(); + instanceGroup3.setId("test-003"); + instanceGroup3.setModelInfoInstanceGroup(modelNetworkInstanceGroup); + + instanceGroup4 = new InstanceGroup(); + instanceGroup4.setId("test-004"); + instanceGroup4.setModelInfoInstanceGroup(modelNetworkInstanceGroup); + + genericVnf = setGenericVnf(); + genericVnf.setVnfName("vnfName"); + } + + @Test + public void createInstanceGroupsSunnyDayTest() throws Exception { + + List instanceGroupList = genericVnf.getInstanceGroups(); + instanceGroupList.add(instanceGroup1); + instanceGroupList.add(instanceGroup2); + instanceGroupList.add(instanceGroup3); + instanceGroupList.add(instanceGroup4); + + assignVnf.createInstanceGroups(execution); + verify(aaiInstanceGroupResources, times(1)).createInstanceGroup(instanceGroup1); + verify(aaiInstanceGroupResources, times(1)).createInstanceGroup(instanceGroup2); + verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup1, genericVnf); + verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup2, genericVnf); + verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup3, genericVnf); + verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup4, genericVnf); + } + + @Test + public void createVnfcInstanceGroupNoneTest() throws Exception { + assignVnf.createInstanceGroups(execution); + verify(aaiInstanceGroupResources, times(0)).createInstanceGroup(any(InstanceGroup.class)); + verify(aaiInstanceGroupResources, times(0)).connectInstanceGroupToVnf(any(InstanceGroup.class), any(GenericVnf.class)); + } + + @Test + public void createVnfcInstanceGroupExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + genericVnf.setVnfId("test-999"); + assignVnf.createInstanceGroups(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java new file mode 100644 index 0000000000..cde7797ed0 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.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.bpmn.infrastructure.flowspecific.tasks; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.ArrayList; +import java.util.List; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.springframework.beans.factory.annotation.Autowired; + +public class CreateNetworkCollectionTest extends BaseTaskTest{ + @Autowired + private CreateNetworkCollection createNetworkCollection; + + private L3Network network; + private ServiceInstance serviceInstance; + private OrchestrationContext orchestrationContext; + + @Before + public void before() { + serviceInstance = setServiceInstance(); + network = setL3Network(); + + List l3NetworkList = new ArrayList(); + l3NetworkList.add(network); + ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup(); + modelInfoInstanceGroup.setFunction("function"); + serviceInstance.getCollection().getInstanceGroup().setModelInfoInstanceGroup(modelInfoInstanceGroup); + + orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + } + + @Test + public void buildCreateNetworkRequestTest() throws Exception { + createNetworkCollection.buildNetworkCollectionName(execution); + + assertEquals(serviceInstance.getServiceInstanceName() + "_" + serviceInstance.getCollection().getInstanceGroup().getModelInfoInstanceGroup().getFunction(), execution.getVariable("networkCollectionName")); + } + + @Test(expected = BpmnError.class) + public void buildCreateNetworkRequestInstanceGroupModelInfoFunctionNullExceptionTest() throws Exception { + ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup(); + serviceInstance.getCollection().getInstanceGroup().setModelInfoInstanceGroup(modelInfoInstanceGroup); + createNetworkCollection.buildNetworkCollectionName(execution); + } + + @Test(expected = BpmnError.class) + public void buildCreateNetworkRequestInstanceGroupModelInfoNullTest() throws Exception { + serviceInstance.getCollection().getInstanceGroup().setModelInfoInstanceGroup(null); + createNetworkCollection.buildNetworkCollectionName(execution); + } + + @Test + public void connectCollectionToInstanceGroupTest() throws Exception { + doNothing().when(aaiNetworkResources).connectNetworkCollectionInstanceGroupToNetworkCollection(serviceInstance.getCollection().getInstanceGroup(), serviceInstance.getCollection()); + createNetworkCollection.connectCollectionToInstanceGroup(execution); + verify(aaiNetworkResources, times(1)).connectNetworkCollectionInstanceGroupToNetworkCollection(serviceInstance.getCollection().getInstanceGroup(), serviceInstance.getCollection()); + } + + @Test + public void connectCollectionToServiceInstanceTest() throws Exception { + doNothing().when(aaiNetworkResources).connectNetworkCollectionToServiceInstance(serviceInstance.getCollection(), serviceInstance); + createNetworkCollection.connectCollectionToServiceInstance(execution); + verify(aaiNetworkResources, times(1)).connectNetworkCollectionToServiceInstance(serviceInstance.getCollection(), serviceInstance); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java new file mode 100644 index 0000000000..f23df3312f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.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.bpmn.infrastructure.flowspecific.tasks; + +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.onap.so.adapters.nwrest.CreateNetworkRequest; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.springframework.beans.factory.annotation.Autowired; + +public class CreateNetworkTest extends BaseTaskTest{ + @Autowired + private CreateNetwork createNetwork; + + private L3Network network; + private ServiceInstance serviceInstance; + private CloudRegion cloudRegion; + private OrchestrationContext orchestrationContext; + private Map userInput; + private RequestContext requestContext; + private String cloudRegionPo = "testCloudRegionPo"; + private Customer customer; + + @Before + public void before() { + customer = setCustomer(); + serviceInstance = setServiceInstance(); + network = setL3Network(); + cloudRegion = setCloudRegion(); + orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + requestContext = setRequestContext(); + userInput = setUserInput(); + + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + } + + @Test + public void buildCreateNetworkRequestTest() throws Exception { + execution.setVariable("cloudRegionPo", cloudRegionPo); + + CreateNetworkRequest expectedCreateNetworkRequest = new CreateNetworkRequest(); + + doReturn(expectedCreateNetworkRequest).when(networkAdapterObjectMapper).createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, cloudRegionPo, customer); + + createNetwork.buildCreateNetworkRequest(execution); + + verify(networkAdapterObjectMapper, times(1)).createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, cloudRegionPo, customer); + + assertThat(expectedCreateNetworkRequest, sameBeanAs(execution.getVariable("createNetworkRequest"))); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtilsTest.java new file mode 100644 index 0000000000..4966a8b42d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtilsTest.java @@ -0,0 +1,118 @@ +/*- + * ============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.bpmn.infrastructure.flowspecific.tasks; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.onap.aai.domain.yang.L3Network; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.springframework.beans.factory.annotation.Autowired; + +public class NetworkBBUtilsTest extends BaseTaskTest{ + @Autowired + private NetworkBBUtils networkBBUtils; + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/Network/"; + + private CloudRegion cloudRegion; + + @Before + public void before() { + cloudRegion = setCloudRegion(); + } + + @Test + public void isRelationshipRelatedToExistsTrueTest() throws Exception { + final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "unassignNetworkBB_queryAAIResponse_.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse); + Optional l3network = aaiResultWrapper.asBean(L3Network.class); + + boolean isVfModule = networkBBUtils.isRelationshipRelatedToExists(l3network, "vf-module"); + assertTrue(isVfModule); + + } + + @Test + public void isRelationshipRelatedToExistsFalseTest() throws Exception { + final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAAIResponse.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse); + Optional l3network = aaiResultWrapper.asBean(L3Network.class); + + boolean isVfModule = networkBBUtils.isRelationshipRelatedToExists(l3network, "vf-module"); + assertFalse(isVfModule); + + } + + @Test + public void getCloudRegionSDNC25Test() throws Exception { + cloudRegion.setCloudRegionVersion("2.5"); + + NetworkBBUtils spyAssign = Mockito.spy(NetworkBBUtils.class); + String cloudRegionId = spyAssign.getCloudRegion(execution, SourceSystem.SDNC); + Mockito.verify(spyAssign).getCloudRegion(execution, SourceSystem.SDNC); + + assertEquals("AAIAIC25", cloudRegionId); + } + + @Test + public void getCloudRegionSDNC30Test() throws Exception { + cloudRegion.setCloudRegionVersion("3.0"); + + NetworkBBUtils spyAssign = Mockito.spy(NetworkBBUtils.class); + String cloudRegionId = spyAssign.getCloudRegion(execution, SourceSystem.SDNC); + Mockito.verify(spyAssign).getCloudRegion(execution, SourceSystem.SDNC); + + assertEquals(cloudRegion.getLcpCloudRegionId(), cloudRegionId); + } + + @Test + public void getCloudRegionPO25Test() throws Exception { + cloudRegion.setCloudRegionVersion("2.5"); + + NetworkBBUtils spyAssign = Mockito.spy(NetworkBBUtils.class); + String cloudRegionId = spyAssign.getCloudRegion(execution, SourceSystem.PO); + Mockito.verify(spyAssign).getCloudRegion(execution, SourceSystem.PO); + + assertEquals(cloudRegion.getLcpCloudRegionId(), cloudRegionId); + } + + @Test + public void getCloudRegionPO30Test() throws Exception { + cloudRegion.setCloudRegionVersion("3.0"); + + NetworkBBUtils spyAssignPO = Mockito.spy(NetworkBBUtils.class); + String cloudRegionIdPO = spyAssignPO.getCloudRegion(execution, SourceSystem.PO); + Mockito.verify(spyAssignPO).getCloudRegion(execution, SourceSystem.PO); + + assertEquals(cloudRegion.getLcpCloudRegionId(), cloudRegionIdPO); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java new file mode 100644 index 0000000000..6a117902ea --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java @@ -0,0 +1,92 @@ +/*- + * ============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.bpmn.infrastructure.flowspecific.tasks; + +import static org.junit.Assert.assertEquals; + +import java.nio.file.Files; +import java.nio.file.Paths; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.springframework.beans.factory.annotation.Autowired; + +public class UnassignNetworkBBTest extends BaseTaskTest { + @Autowired + private UnassignNetworkBB unassignNetworkBB; + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/Network/"; + + @Test + public void checkRelationshipRelatedToTrueTest() throws Exception { + expectedException.expect(BpmnError.class); + final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "unassignNetworkBB_queryAAIResponse_.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse); + execution.setVariable("l3NetworkAAIResultWrapper", aaiResultWrapper); + + unassignNetworkBB.checkRelationshipRelatedTo(execution, "vf-module"); + } + + @Test + public void checkRelationshipRelatedToFalseTest() throws Exception { + final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "unassignNetworkBB_queryAAIResponse_.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse); + execution.setVariable("l3NetworkAAIResultWrapper", aaiResultWrapper); + + unassignNetworkBB.checkRelationshipRelatedTo(execution, "kfc-module"); + //expected result is no exception + } + + @Test + public void getCloudSdncRegion25Test() throws Exception { + CloudRegion cloudRegion = setCloudRegion(); + cloudRegion.setCloudRegionVersion("2.5"); + unassignNetworkBB.getCloudSdncRegion(execution); + assertEquals("AAIAIC25", execution.getVariable("cloudRegionSdnc")); + } + + @Test + public void getCloudSdncRegion30Test() throws Exception { + CloudRegion cloudRegion = setCloudRegion(); + cloudRegion.setCloudRegionVersion("3.0"); + gBBInput.setCloudRegion(cloudRegion); + unassignNetworkBB.getCloudSdncRegion(execution); + assertEquals(cloudRegion.getLcpCloudRegionId(), execution.getVariable("cloudRegionSdnc")); + } + + @Test + public void errorEncounteredTest_rollback() throws Exception { + expectedException.expect(BpmnError.class); + execution.setVariable("ErrorUnassignNetworkBB", "Relationship's RelatedTo still exists in AAI, remove the relationship vf-module first."); + execution.setVariable("isRollbackNeeded", true); + unassignNetworkBB.errorEncountered(execution); + } + + @Test + public void errorEncounteredTest_noRollback() throws Exception { + expectedException.expect(BpmnError.class); + execution.setVariable("ErrorUnassignNetworkBB", "Relationship's RelatedTo still exists in AAI, remove the relationship vf-module first."); + unassignNetworkBB.errorEncountered(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java new file mode 100644 index 0000000000..98c1f185fe --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java @@ -0,0 +1,67 @@ +/*- + * ============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.bpmn.infrastructure.flowspecific.tasks; + +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.springframework.beans.factory.annotation.Autowired; + +public class UnassignVnfTest extends BaseTaskTest{ + @Autowired + private UnassignVnf unassignVnf; + + @Test + public void deleteInstanceGroupsSunnyDayTest() throws Exception { + GenericVnf genericVnf = setGenericVnf(); + + ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup(); + modelVnfc.setType("VNFC"); + + InstanceGroup instanceGroup1 = new InstanceGroup(); + instanceGroup1.setId("test-001"); + instanceGroup1.setModelInfoInstanceGroup(modelVnfc); + genericVnf.getInstanceGroups().add(instanceGroup1); + + InstanceGroup instanceGroup2 = new InstanceGroup(); + instanceGroup2.setId("test-002"); + instanceGroup2.setModelInfoInstanceGroup(modelVnfc); + genericVnf.getInstanceGroups().add(instanceGroup2); + + unassignVnf.deleteInstanceGroups(execution); + verify(aaiInstanceGroupResources, times(1)).deleteInstanceGroup(eq(instanceGroup1)); + verify(aaiInstanceGroupResources, times(1)).deleteInstanceGroup(eq(instanceGroup2)); + } + + @Test + public void deletecreateVnfcInstanceGroupExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + unassignVnf.deleteInstanceGroups(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java new file mode 100644 index 0000000000..d3b421eedb --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.sdnc.tasks; + +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + + +public class SDNCActivateTaskTest extends BaseTaskTest{ + @Autowired + private SDNCActivateTasks sdncActivateTasks; + + private L3Network network; + private ServiceInstance serviceInstance; + private RequestContext requestContext; + private CloudRegion cloudRegion; + private GenericVnf genericVnf; + private VfModule vfModule; + private Customer customer; + + @Before + public void before() { + serviceInstance = setServiceInstance(); + network = setL3Network(); + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + cloudRegion = setCloudRegion(); + requestContext = setRequestContext(); + customer = setCustomer(); + + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + + } + + @Test + public void activateVnfTest() throws Exception { + doReturn("success").when(sdncVnfResources).activateVnf(genericVnf,serviceInstance, customer, cloudRegion,requestContext); + sdncActivateTasks.activateVnf(execution); + verify(sdncVnfResources, times(1)).activateVnf(genericVnf,serviceInstance, customer,cloudRegion,requestContext); + } + + @Test + public void activateVnfTestException() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncVnfResources).activateVnf(genericVnf,serviceInstance, customer,cloudRegion,requestContext); + sdncActivateTasks.activateVnf(execution); + } + + @Test + public void activateNetworkTest() throws Exception { + doReturn("response").when(sdncNetworkResources).activateNetwork(isA(L3Network.class), isA(ServiceInstance.class), isA(Customer.class), isA(RequestContext.class), isA(CloudRegion.class)); + sdncActivateTasks.activateNetwork(execution); + verify(sdncNetworkResources, times(1)).activateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + } + + @Test + public void activateNetworkExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncNetworkResources).activateNetwork(isA(L3Network.class), isA(ServiceInstance.class), isA(Customer.class), isA(RequestContext.class), isA(CloudRegion.class)); + sdncActivateTasks.activateNetwork(execution); + } + + @Test + public void activateVfModuleTest() throws Exception { + doReturn("success").when(sdncVfModuleResources).activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + sdncActivateTasks.activateVfModule(execution); + + verify(sdncVfModuleResources, times(1)).activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + } + + @Test + public void activateVfModuleTestException() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncVfModuleResources).activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + sdncActivateTasks.activateVfModule(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java new file mode 100644 index 0000000000..6a40db3eaa --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java @@ -0,0 +1,144 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.sdnc.tasks; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + + +public class SDNCAssignTasksTest extends BaseTaskTest{ + @Autowired + private SDNCAssignTasks sdncAssignTasks; + + private L3Network network; + private ServiceInstance serviceInstance; + private RequestContext requestContext; + private CloudRegion cloudRegion; + private GenericVnf genericVnf; + private VfModule vfModule; + private VolumeGroup volumeGroup; + private Customer customer; + + @Before + public void before() { + customer = setCustomer(); + serviceInstance = setServiceInstance(); + network = setL3Network(); + cloudRegion = setCloudRegion(); + requestContext = setRequestContext(); + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + volumeGroup = setVolumeGroup(); + + } + + @Test + public void assignServiceInstanceTest() throws Exception { + doReturn("response").when(sdncServiceInstanceResources).assignServiceInstance(serviceInstance, customer, requestContext); + + sdncAssignTasks.assignServiceInstance(execution); + + verify(sdncServiceInstanceResources, times(1)).assignServiceInstance(serviceInstance, customer, requestContext); + assertTrue(execution.getVariable("SDNCResponse").equals("response")); + } + + @Test + public void assignServiceInstanceExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncServiceInstanceResources).assignServiceInstance(serviceInstance, customer, requestContext); + + sdncAssignTasks.assignServiceInstance(execution); + } + + @Test + public void assignVnfTest() throws Exception { + doReturn("response").when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); + + sdncAssignTasks.assignVnf(execution); + + verify(sdncVnfResources, times(1)).assignVnf(genericVnf, serviceInstance,customer, cloudRegion, requestContext, false); + assertTrue(execution.getVariable("SDNCResponse").equals("response")); + } + + @Test + public void assignVnfExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); + + sdncAssignTasks.assignVnf(execution); + } + + @Test + public void assignVfModuleTest() throws Exception { + doReturn("response").when(sdncVfModuleResources).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + sdncAssignTasks.assignVfModule(execution); + + verify(sdncVfModuleResources, times(1)).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + assertTrue(execution.getVariable("SDNCAssignResponse_" + vfModule.getVfModuleId()).equals("response")); + } + + @Test + public void assignVfModuleExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncVfModuleResources).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + sdncAssignTasks.assignVfModule(execution); + } + + @Test + public void assignNetworkTest() throws Exception { + doReturn("response").when(sdncNetworkResources).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + sdncAssignTasks.assignNetwork(execution); + + verify(sdncNetworkResources, times(1)).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + } + + @Test + public void assignNetworkExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncNetworkResources).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + sdncAssignTasks.assignNetwork(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java new file mode 100644 index 0000000000..fc2d182b52 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java @@ -0,0 +1,100 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.sdnc.tasks; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + +public class SDNCChangeAssignTasksTest extends BaseTaskTest{ + @Autowired + private SDNCChangeAssignTasks sdncChangeAssignTasks; + + private ServiceInstance serviceInstance; + private RequestContext requestContext; + private CloudRegion cloudRegion; + private VfModule vfModule; + private GenericVnf genericVnf; + private Customer customer; + + @Before + public void before() { + customer = setCustomer(); + serviceInstance = setServiceInstance(); + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + cloudRegion = setCloudRegion(); + requestContext = setRequestContext(); + + } + + @Test + public void changeModelVnfTest() throws Exception { + String response = "sdncChangeModelServiceInstance"; + + doReturn(response).when(sdncServiceInstanceResources).changeModelServiceInstance(serviceInstance, customer, requestContext); + + sdncChangeAssignTasks.changeModelServiceInstance(execution); + + verify(sdncServiceInstanceResources, times(1)).changeModelServiceInstance(serviceInstance, customer, requestContext); + + assertEquals(response, execution.getVariable("SDNCChangeAssignTasks.changeModelServiceInstance.response")); + } + + @Test + public void changeModelVnfExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(sdncVnfResources).changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + sdncChangeAssignTasks.changeModelVnf(execution); + } + + @Test + public void changeAssignModelVfModuleTest() throws Exception { + String response = "response"; + doReturn(response).when(sdncVfModuleResources).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + sdncChangeAssignTasks.changeAssignModelVfModule(execution); + + verify(sdncVfModuleResources, times(1)).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + assertTrue(execution.getVariable("SDNCChangeAssignVfModuleResponse").equals(response)); + } + + @Test + public void changeAssignModelVfModuleExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(sdncVfModuleResources).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + sdncChangeAssignTasks.changeAssignModelVfModule(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java new file mode 100644 index 0000000000..ed281ce317 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java @@ -0,0 +1,154 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.sdnc.tasks; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + +public class SDNCDeactivateTaskTest extends BaseTaskTest { + @Autowired + private SDNCDeactivateTasks sdncDeactivateTasks; + + private ServiceInstance serviceInstance; + private CloudRegion cloudRegion; + private RequestContext requestContext; + private GenericVnf genericVnf; + private VfModule vfModule; + private L3Network network; + private Customer customer; + + @Before + public void before() { + customer = setCustomer(); + serviceInstance = setServiceInstance(); + cloudRegion = setCloudRegion(); + requestContext = setRequestContext(); + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + network = setL3Network(); + + } + + @Test + public void deactivateVfModuleTest() throws Exception { + doReturn("success").when(sdncVfModuleResources).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + sdncDeactivateTasks.deactivateVfModule(execution); + + verify(sdncVfModuleResources, times(1)).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + } + + @Test + public void deactivateVfModuleExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncVfModuleResources).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + sdncDeactivateTasks.deactivateVfModule(execution); + } + + @Test + public void deactivateVnfTest() throws Exception { + doReturn("success").when(sdncVnfResources).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + sdncDeactivateTasks.deactivateVnf(execution); + + verify(sdncVnfResources, times(1)).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + } + + @Test + public void deactivateVnfExceptionTest() throws Exception { + doThrow(Exception.class).when(sdncVnfResources).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + expectedException.expect(BpmnError.class); + sdncDeactivateTasks.deactivateVnf(execution); + } + + @Test + public void deactivateServiceInstanceTest() throws Exception { + doReturn("response").when(sdncServiceInstanceResources).deactivateServiceInstance(serviceInstance, customer, requestContext); + + sdncDeactivateTasks.deactivateServiceInstance(execution); + + verify(sdncServiceInstanceResources, times(1)).deactivateServiceInstance(serviceInstance, customer, requestContext); + assertEquals("response", execution.getVariable("deactivateServiceInstanceSDNCResponse")); + assertTrue(execution.getVariable("sdncServiceInstanceRollback")); + } + + @Test + public void deactivateServiceInstanceExceptionTest() throws Exception { + doThrow(Exception.class).when(sdncServiceInstanceResources).deactivateServiceInstance(serviceInstance, customer, requestContext); + expectedException.expect(BpmnError.class); + sdncDeactivateTasks.deactivateServiceInstance(execution); + } + + @Test + public void test_deactivateNetwork() throws Exception { + String expectedResponse = "return"; + + doReturn(expectedResponse).when(sdncNetworkResources).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + sdncDeactivateTasks.deactivateNetwork(execution); + + verify(sdncNetworkResources, times(1)).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + assertEquals(expectedResponse, execution.getVariable("SDNCDeactivateTasks.deactivateNetwork.response")); + + assertTrue(execution.getVariable("SDNCDeactivateTasks.deactivateNetwork.rollback")); + } + + @Test + public void test_deactivateNetwork_exception() throws Exception { + expectedException.expect(BpmnError.class); + + try { + lookupKeyMap.remove(ResourceKey.NETWORK_ID); + + sdncDeactivateTasks.deactivateNetwork(execution); + } finally { + verify(sdncNetworkResources, times(0)).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + assertNull(execution.getVariable("SDNCDeactivateTasks.deactivateNetwork.response")); + + assertFalse(execution.getVariable("SDNCDeactivateTasks.deactivateNetwork.rollback")); + } + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java new file mode 100644 index 0000000000..b98ab71d1d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java @@ -0,0 +1,121 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.sdnc.tasks; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.springframework.beans.factory.annotation.Autowired; + +public class SDNCQueryTasksTest extends BaseTaskTest{ + @Autowired + private SDNCQueryTasks sdncQueryTasks; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + private GenericVnf genericVnf; + private VfModule vfModule; + + @Before + public void before() { + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + } + + @Test + public void queryVfModuleTest() throws Exception { + String sdncQueryResponse = "response"; + vfModule.setSelflink("vfModuleSelfLink"); + + doReturn(sdncQueryResponse).when(sdncVfModuleResources).queryVfModule(vfModule); + + assertNotEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId())); + sdncQueryTasks.queryVfModule(execution); + assertEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId())); + + verify(sdncVfModuleResources, times(1)).queryVfModule(vfModule); + } + + @Test + public void queryVnfTest() throws Exception { + String sdncQueryResponse = "response"; + + doReturn(sdncQueryResponse).when(sdncVnfResources).queryVnf(genericVnf); + + assertNotEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId())); + sdncQueryTasks.queryVnf(execution); + assertEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId())); + + verify(sdncVnfResources, times(1)).queryVnf(genericVnf); + } + + @Test + public void queryVfModuleForVolumeGroupTest() throws Exception { + String sdncQueryResponse = "response"; + vfModule.setSelflink("vfModuleSelfLink"); + + doReturn(sdncQueryResponse).when(sdncVfModuleResources).queryVfModule(vfModule); + + assertNotEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId())); + sdncQueryTasks.queryVfModuleForVolumeGroup(execution); + assertEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId())); + + verify(sdncVfModuleResources, times(1)).queryVfModule(vfModule); + } + + @Test + public void queryVfModuleForVolumeGroupNoSelfLinkExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + vfModule.setSelflink(""); + + sdncQueryTasks.queryVfModuleForVolumeGroup(execution); + } + + @Test + public void queryVfModuleForVolumeGroupVfObjectExceptionTest() throws Exception { + gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs().get(0).getVfModules().clear(); + + sdncQueryTasks.queryVfModuleForVolumeGroup(execution); + + verify(sdncVfModuleResources, times(0)).queryVfModule(any(VfModule.class)); + } + + @Test + public void queryVfModuleForVolumeGroupNonVfObjectExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + sdncQueryTasks.queryVfModuleForVolumeGroup(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java new file mode 100644 index 0000000000..14243c5909 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java @@ -0,0 +1,202 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.sdnc.tasks; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.springframework.beans.factory.annotation.Autowired; + +public class SDNCUnassignTasksTest extends BaseTaskTest{ + @Autowired + private SDNCUnassignTasks sdncUnassignTasks; + + private ServiceInstance serviceInstance; + private RequestContext requestContext; + private GenericVnf genericVnf; + private VfModule vfModule; + private CloudRegion cloudRegion; + private L3Network network; + private Customer customer; + + @Before + public void before() { + customer = setCustomer(); + serviceInstance = setServiceInstance(); + requestContext = setRequestContext(); + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + cloudRegion = setCloudRegion(); + network = setL3Network(); + + } + + @Test + public void unassignServiceInstanceTest() throws Exception { + doReturn("test").when(sdncServiceInstanceResources).unassignServiceInstance(serviceInstance, customer, requestContext); + + sdncUnassignTasks.unassignServiceInstance(execution); + + verify(sdncServiceInstanceResources, times(1)).unassignServiceInstance(serviceInstance, customer, requestContext); + } + + @Test + public void unassignServiceInstanceTest_inventoried() throws Exception { + doReturn("test").when(sdncServiceInstanceResources).unassignServiceInstance(serviceInstance, customer, requestContext); + + serviceInstance.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + + sdncUnassignTasks.unassignServiceInstance(execution); + + verify(sdncServiceInstanceResources, times(0)).unassignServiceInstance(serviceInstance, customer, requestContext); + } + + @Test + public void unassignServiceInstanceExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncServiceInstanceResources).unassignServiceInstance(serviceInstance, customer, requestContext); + + sdncUnassignTasks.unassignServiceInstance(execution); + } + + @Test + public void unassignVfModuleTest() throws Exception { + doReturn("response").when(sdncVfModuleResources).unassignVfModule(vfModule, genericVnf, serviceInstance); + + sdncUnassignTasks.unassignVfModule(execution); + + verify(sdncVfModuleResources, times(1)).unassignVfModule(vfModule, genericVnf, serviceInstance); + assertEquals("response", execution.getVariable("SDNCResponse")); + } + + @Test + public void unassignVfModuleTest_inventoried() throws Exception { + vfModule.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + + sdncUnassignTasks.unassignVfModule(execution); + + verify(sdncVfModuleResources, times(0)).unassignVfModule(vfModule, genericVnf, serviceInstance); + assertNull(execution.getVariable("SDNCResponse")); + } + + @Test + public void unassignVfModuleTest_pendingCreate() throws Exception { + vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_CREATE); + + sdncUnassignTasks.unassignVfModule(execution); + + verify(sdncVfModuleResources, times(0)).unassignVfModule(vfModule, genericVnf, serviceInstance); + assertNull(execution.getVariable("SDNCResponse")); + } + + @Test + public void unassignVfModuleExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncVfModuleResources).unassignVfModule(vfModule, genericVnf, serviceInstance); + + sdncUnassignTasks.unassignVfModule(execution); + } + + @Test + public void unassignVnfTest() throws Exception { + doReturn("response").when(sdncVnfResources).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + sdncUnassignTasks.unassignVnf(execution); + + verify(sdncVnfResources, times(1)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + assertTrue(execution.getVariable("sdncUnassignVnfResponse").equals("response")); + } + + @Test + public void unassignVnfTest_inventoried() throws Exception { + genericVnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + + sdncUnassignTasks.unassignVnf(execution); + + verify(sdncVnfResources, times(0)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + assertNull(execution.getVariable("sdncUnassignVnfResponse")); + } + + @Test + public void unassignVnfTest_created() throws Exception { + genericVnf.setOrchestrationStatus(OrchestrationStatus.CREATED); + + sdncUnassignTasks.unassignVnf(execution); + + verify(sdncVnfResources, times(0)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + assertNull(execution.getVariable("sdncUnassignVnfResponse")); + } + + @Test + public void unassignVnfExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(sdncVnfResources).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + sdncUnassignTasks.unassignVnf(execution); + } + + @Test + public void unassignNetworkTest() throws Exception { + String cloudRegionSdnc = "AAIAIC25"; + + cloudRegion.setCloudRegionVersion("2.5"); + + execution.setVariable("cloudRegionSdnc", cloudRegionSdnc); + + doReturn("response").when(sdncNetworkResources).unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + assertNotEquals(cloudRegionSdnc, cloudRegion.getLcpCloudRegionId()); + sdncUnassignTasks.unassignNetwork(execution); + + verify(sdncNetworkResources, times(1)).unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + assertEquals("response", execution.getVariable("SDNCUnAssignNetworkResponse")); + assertEquals(cloudRegionSdnc, cloudRegion.getLcpCloudRegionId()); + } + + @Test + public void unassignNetworkTest_inventoried() throws Exception { + network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + + sdncUnassignTasks.unassignNetwork(execution); + + verify(sdncNetworkResources, times(0)).unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + assertNull(execution.getVariable("SDNCUnAssignNetworkResponse")); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java new file mode 100644 index 0000000000..b0b07d8cd7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java @@ -0,0 +1,182 @@ +/*- + * ============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.bpmn.infrastructure.workflow.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; + +import java.util.ArrayList; +import java.util.List; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.db.catalog.beans.BuildingBlockDetail; +import org.onap.so.db.catalog.beans.OrchestrationAction; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective; +import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective; +import org.onap.so.db.catalog.beans.ResourceType; +import org.springframework.beans.factory.annotation.Autowired; + +public class OrchestrationStatusValidatorTest extends BaseTaskTest { + @Autowired + protected OrchestrationStatusValidator orchestrationStatusValidator; + + @Test + public void test_validateOrchestrationStatus() throws Exception { + String flowToBeCalled = "AssignServiceInstanceBB"; + setServiceInstance().setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + execution.setVariable("flowToBeCalled", flowToBeCalled); + + BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail(); + buildingBlockDetail.setBuildingBlockName("AssignServiceInstanceBB"); + buildingBlockDetail.setId(1); + buildingBlockDetail.setResourceType(ResourceType.SERVICE); + buildingBlockDetail.setTargetAction(OrchestrationAction.ASSIGN); + + doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective(); + orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE); + orchestrationStatusStateTransitionDirective.setId(1); + orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.SERVICE); + orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ASSIGN); + + doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.SERVICE, OrchestrationStatus.PRECREATED, OrchestrationAction.ASSIGN); + + orchestrationStatusValidator.validateOrchestrationStatus(execution); + + assertEquals(OrchestrationStatusValidationDirective.CONTINUE, execution.getVariable("orchestrationStatusValidationResult")); + } + + @Test + public void test_validateOrchestrationStatusConfiguration() throws Exception { + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId"); + String flowToBeCalled = "UnassignFabricConfigurationBB"; + ServiceInstance si = setServiceInstance(); + List configurations = new ArrayList<>(); + Configuration config = new Configuration(); + + si.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + config.setConfigurationId("configurationId"); + config.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + configurations.add(config); + si.setConfigurations(configurations); + + execution.setVariable("flowToBeCalled", flowToBeCalled); + + BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail(); + buildingBlockDetail.setBuildingBlockName("UnassignFabricConfigurationBB"); + buildingBlockDetail.setId(1); + buildingBlockDetail.setResourceType(ResourceType.CONFIGURATION); + buildingBlockDetail.setTargetAction(OrchestrationAction.UNASSIGN); + + doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective(); + orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS); + orchestrationStatusStateTransitionDirective.setId(1); + orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.CONFIGURATION); + orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.UNASSIGN); + + doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.CONFIGURATION, OrchestrationStatus.PRECREATED, OrchestrationAction.UNASSIGN); + + orchestrationStatusValidator.validateOrchestrationStatus(execution); + + assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, execution.getVariable("orchestrationStatusValidationResult")); + } + + @Test + public void test_validateOrchestrationStatus_buildingBlockDetailNotFound() throws Exception { + expectedException.expect(BpmnError.class); + + String flowToBeCalled = "AssignServiceInstanceBB"; + + execution.setVariable("flowToBeCalled", flowToBeCalled); + + doReturn(null).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + + orchestrationStatusValidator.validateOrchestrationStatus(execution); + } + + @Test + public void test_validateOrchestrationStatus_orchestrationValidationFail() throws Exception { + expectedException.expect(BpmnError.class); + + String flowToBeCalled = "AssignServiceInstanceBB"; + + execution.setVariable("flowToBeCalled", flowToBeCalled); + + BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail(); + buildingBlockDetail.setBuildingBlockName("AssignServiceInstanceBB"); + buildingBlockDetail.setId(1); + buildingBlockDetail.setResourceType(ResourceType.SERVICE); + buildingBlockDetail.setTargetAction(OrchestrationAction.ASSIGN); + + doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective(); + orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL); + orchestrationStatusStateTransitionDirective.setId(1); + orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.SERVICE); + orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ASSIGN); + + doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.SERVICE, OrchestrationStatus.PRECREATED, OrchestrationAction.ASSIGN); + + orchestrationStatusValidator.validateOrchestrationStatus(execution); + } + + @Test + public void test_validateOrchestrationStatus_orchestrationValidationNotFound() throws Exception { + expectedException.expect(BpmnError.class); + + String flowToBeCalled = "AssignServiceInstanceBB"; + + execution.setVariable("flowToBeCalled", flowToBeCalled); + + BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail(); + buildingBlockDetail.setBuildingBlockName("AssignServiceInstanceBB"); + buildingBlockDetail.setId(1); + buildingBlockDetail.setResourceType(ResourceType.SERVICE); + buildingBlockDetail.setTargetAction(OrchestrationAction.ASSIGN); + + doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective(); + orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL); + orchestrationStatusStateTransitionDirective.setId(1); + orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.SERVICE); + orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ASSIGN); + + doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.NETWORK, OrchestrationStatus.PRECREATED, OrchestrationAction.ASSIGN); + + orchestrationStatusValidator.validateOrchestrationStatus(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java new file mode 100644 index 0000000000..d856b5e184 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java @@ -0,0 +1,188 @@ +/*- + * ============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.bpmn.infrastructure.workflow.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.springframework.beans.factory.annotation.Autowired; + +public class WorkflowActionBBTasksTest extends BaseTaskTest { + + @Autowired + protected WorkflowAction workflowAction; + + @Autowired + protected WorkflowActionBBTasks workflowActionBBTasks; + + private DelegateExecution execution; + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Before + public void before() throws Exception { + execution = new DelegateExecutionFake(); + org.onap.aai.domain.yang.ServiceInstance servInstance = new org.onap.aai.domain.yang.ServiceInstance(); + servInstance.setServiceInstanceId("TEST"); + when(bbSetupUtils.getAAIServiceInstanceByName(anyString(), anyObject())).thenReturn(servInstance); + workflowAction.setBbInputSetupUtils(bbSetupUtils); + workflowAction.setBbInputSetup(bbInputSetup); + } + + @Test + public void selectBBTest() throws Exception{ + String gAction = "Delete-Network-Collection"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + execution.setVariable("gCurrentSequence", 0); + execution.setVariable("homing", false); + execution.setVariable("calledHoming", false); + List flowsToExecute = new ArrayList(); + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); + flowsToExecute.add(ebb); + execution.setVariable("flowsToExecute", flowsToExecute); + workflowActionBBTasks.selectBB(execution); + boolean success = (boolean) execution.getVariable("completed"); + assertEquals(true,success); + } + + @Test + public void select2BBTest() throws Exception{ + String gAction = "Delete-Network-Collection"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + execution.setVariable("gCurrentSequence", 0); + execution.setVariable("homing", false); + execution.setVariable("calledHoming", false); + List flowsToExecute = new ArrayList(); + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); + flowsToExecute.add(ebb); + flowsToExecute.add(ebb2); + execution.setVariable("flowsToExecute", flowsToExecute); + workflowActionBBTasks.selectBB(execution); + boolean success = (boolean) execution.getVariable("completed"); + assertEquals(false,success); + } + + @Test + public void msoCompleteProcessTest() throws Exception{ + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", "createInstance"); + execution.setVariable("resourceId", "123"); + execution.setVariable("source","MSO"); + execution.setVariable("resourceName", "Service"); + execution.setVariable("aLaCarte", true); + workflowActionBBTasks.setupCompleteMsoProcess(execution); + String response = (String) execution.getVariable("CompleteMsoProcessRequest"); + assertEquals(response,"00f704ca-c5e5-4f95-a72c-6889db7b0688createInstanceMSOALaCarte-Service-createInstance request was executed correctly.123WorkflowActionBB"); + } + + @Test + public void setupFalloutHandlerTest(){ + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("serviceInstanceId", "123"); + execution.setVariable("WorkflowActionErrorMessage", "Error in WorkFlowAction"); + execution.setVariable("requestAction", "createInstance"); + workflowActionBBTasks.setupFalloutHandler(execution); + assertEquals(execution.getVariable("falloutRequest"),"00f704ca-c5e5-4f95-a72c-6889db7b0688createInstanceVIDError in WorkFlowAction7000"); + } + + @Test + public void rollbackExecutionPathTest(){ + List flowsToExecute = new ArrayList(); + ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock(); + BuildingBlock bb1 = new BuildingBlock(); + bb1.setBpmnFlowName("CreateNetworkBB"); + flowsToExecute.add(ebb1); + ebb1.setBuildingBlock(bb1); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); + BuildingBlock bb2 = new BuildingBlock(); + bb2.setBpmnFlowName("ActivateNetworkBB"); + flowsToExecute.add(ebb2); + ebb2.setBuildingBlock(bb2); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); + BuildingBlock bb3 = new BuildingBlock(); + bb3.setBpmnFlowName("CreateVolumeGroupBB"); + flowsToExecute.add(ebb3); + ebb3.setBuildingBlock(bb3); + ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock(); + BuildingBlock bb4 = new BuildingBlock(); + bb4.setBpmnFlowName("ActivateVolumeGroupBB"); + flowsToExecute.add(ebb4); + ebb4.setBuildingBlock(bb4); + ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock(); + BuildingBlock bb5 = new BuildingBlock(); + bb5.setBpmnFlowName("CreateVfModuleBB"); + flowsToExecute.add(ebb5); + ebb5.setBuildingBlock(bb5); + ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock(); + BuildingBlock bb6 = new BuildingBlock(); + bb6.setBpmnFlowName("ActivateVfModuleBB"); + flowsToExecute.add(ebb6); + ebb6.setBuildingBlock(bb6); + ExecuteBuildingBlock ebb7 = new ExecuteBuildingBlock(); + BuildingBlock bb7 = new BuildingBlock(); + bb7.setBpmnFlowName("ActivateVnfBB"); + ebb7.setBuildingBlock(bb7); + flowsToExecute.add(ebb7); + ExecuteBuildingBlock ebb8 = new ExecuteBuildingBlock(); + BuildingBlock bb8 = new BuildingBlock(); + bb8.setBpmnFlowName("ActivateServiceInstance"); + ebb8.setBuildingBlock(bb8); + flowsToExecute.add(ebb8); + + execution.setVariable("flowsToExecute", flowsToExecute); + execution.setVariable("gCurrentSequence", 6); + + workflowActionBBTasks.rollbackExecutionPath(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeleteVfModuleBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeactivateVolumeGroupBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"DeleteVolumeGroupBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + } + + @Test + public void checkRetryStatusTest(){ + execution.setVariable("handlingCode","Retry"); + execution.setVariable("retryCount", 1); + execution.setVariable("gCurrentSequence",1); + workflowActionBBTasks.checkRetryStatus(execution); + assertEquals(0,execution.getVariable("gCurrentSequence")); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java new file mode 100644 index 0000000000..c910ad19fa --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -0,0 +1,1494 @@ +/*- + * ============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.bpmn.infrastructure.workflow.tasks; + +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.VfModule; +import org.onap.aai.domain.yang.VfModules; +import org.onap.aai.domain.yang.VolumeGroup; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResource; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.HeatEnvironment; +import org.onap.so.db.catalog.beans.HeatTemplate; +import org.onap.so.db.catalog.beans.InstanceGroup; +import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; +import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; +import org.onap.so.serviceinstancebeans.ModelInfo; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.onap.so.serviceinstancebeans.RequestParameters; +import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; +import org.onap.so.serviceinstancebeans.SubscriberInfo; +import org.springframework.beans.factory.annotation.Autowired; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class WorkflowActionTest extends BaseTaskTest { + @Autowired + protected WorkflowAction workflowAction; + + private DelegateExecution execution; + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Before + public void before() throws Exception { + execution = new DelegateExecutionFake(); + org.onap.aai.domain.yang.ServiceInstance servInstance = new org.onap.aai.domain.yang.ServiceInstance(); + servInstance.setServiceInstanceId("TEST"); + when(bbSetupUtils.getAAIServiceInstanceByName(anyString(), anyObject())).thenReturn(servInstance); + workflowAction.setBbInputSetupUtils(bbSetupUtils); + workflowAction.setBbInputSetup(bbInputSetup); + } + /** + * ALACARTE TESTS + */ + @Test + public void selectExecutionListALaCarteNetworkCreateTest() throws Exception{ + String gAction = "createInstance"; + String resource = "Network"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", true); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/networks/123"); + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("AssignNetwork1802BB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("CreateNetworkBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("ActivateNetworkBB"); + orchFlows.add(orch3); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,true)).thenReturn(northBoundRequest); + + + workflowAction.selectExecutionList(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignNetwork1802BB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + } + + @Test + public void selectExecutionListALaCarteNetworkDeleteTest() throws Exception{ + String gAction = "deleteInstance"; + String resource = "Network"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", true); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/networks/123"); + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("DeactivateNetworkBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("DeleteNetworkBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("UnassignNetwork1802BB"); + orchFlows.add(orch3); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,true)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignNetwork1802BB"); + } + + @Test + public void selectExecutionListALaCarteServiceCreateTest() throws Exception{ + String gAction = "createInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", true); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("AssignServiceInstanceBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("ActivateServiceInstanceBB"); + orchFlows.add(orch2); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,true)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB"); + } + + /** + * SERVICE MACRO TESTS + */ + @Test + public void selectExecutionListServiceMacroAssignTest() throws Exception{ + String gAction = "assignInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("AssignServiceInstanceBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("AssignNetworkBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("AssignVnfBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("AssignVolumeGroupBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("AssignVfModuleBB"); + orchFlows.add(orch5); + + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + HeatEnvironment volumeHeatEnv = new HeatEnvironment(); + vfModuleCustomization.setVolumeHeatEnv(volumeHeatEnv); + org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule(); + HeatTemplate volumeHeatTemplate = new HeatTemplate(); + vfModule.setVolumeHeatTemplate(volumeHeatTemplate); + vfModuleCustomization.setVfModule(vfModule); + + VfModuleCustomization vfModuleCustomization2 = new VfModuleCustomization(); + vfModuleCustomization2.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + HeatEnvironment heatEnvironment = new HeatEnvironment(); + vfModuleCustomization2.setHeatEnvironment(heatEnvironment); + org.onap.so.db.catalog.beans.VfModule vfModule2 = new org.onap.so.db.catalog.beans.VfModule(); + HeatTemplate moduleHeatTemplate = new HeatTemplate(); + vfModule2.setModuleHeatTemplate(moduleHeatTemplate); + vfModuleCustomization2.setVfModule(vfModule2); + + VfModuleCustomization vfModuleCustomization3 = vfModuleCustomization2; + vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f")).thenReturn(vfModuleCustomization); + when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8")).thenReturn(vfModuleCustomization2); + when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969")).thenReturn(vfModuleCustomization3); + workflowAction.selectExecutionList(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"AssignVnfBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"AssignVolumeGroupBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB"); + assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB"); + } + + @Test + public void selectExecutionListServiceMacroActivateTest() throws Exception{ + String gAction = "activateInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/si0"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("CreateNetworkBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("ActivateNetworkBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("CreateVolumeGroupBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("ActivateVolumeGroupBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("CreateVfModuleBB"); + orchFlows.add(orch5); + OrchestrationFlow orch6 = new OrchestrationFlow(); + orch6.setFlowName("ActivateVfModuleBB"); + orchFlows.add(orch6); + OrchestrationFlow orch7 = new OrchestrationFlow(); + orch7.setFlowName("ActivateVnfBB"); + orchFlows.add(orch7); + OrchestrationFlow orch8 = new OrchestrationFlow(); + orch8.setFlowName("ActivateServiceInstanceBB"); + orchFlows.add(orch8); + + ServiceInstance serviceInstanceAAI = new ServiceInstance(); + serviceInstanceAAI.setServiceInstanceId("si0"); + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance(); + org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf(); + vnf.setVnfId("vnf0"); + + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule.setVfModuleId("vfModule0"); + vnf.getVfModules().add(vfModule); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule2.setVfModuleId("vfModule1"); + vnf.getVfModules().add(vfModule2); + + org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = new org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroup0"); + vnf.getVolumeGroups().add(volumeGroup); + + serviceInstanceMSO.getVnfs().add(vnf); + + doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("si0"); + doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals("CreateVolumeGroupBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName()); + assertEquals("volumeGroup0", ebbs.get(0).getWorkflowResourceIds().getVolumeGroupId()); + assertEquals("ActivateVolumeGroupBB", ebbs.get(1).getBuildingBlock().getBpmnFlowName()); + assertEquals("volumeGroup0", ebbs.get(1).getWorkflowResourceIds().getVolumeGroupId()); + assertEquals("CreateVfModuleBB", ebbs.get(2).getBuildingBlock().getBpmnFlowName()); + assertEquals("vfModule0", ebbs.get(2).getWorkflowResourceIds().getVfModuleId()); + assertEquals("CreateVfModuleBB", ebbs.get(3).getBuildingBlock().getBpmnFlowName()); + assertEquals("vfModule1", ebbs.get(3).getWorkflowResourceIds().getVfModuleId()); + assertEquals("ActivateVfModuleBB", ebbs.get(4).getBuildingBlock().getBpmnFlowName()); + assertEquals("vfModule0", ebbs.get(4).getWorkflowResourceIds().getVfModuleId()); + assertEquals("ActivateVfModuleBB", ebbs.get(5).getBuildingBlock().getBpmnFlowName()); + assertEquals("vfModule1", ebbs.get(5).getWorkflowResourceIds().getVfModuleId()); + assertEquals("ActivateVnfBB", ebbs.get(6).getBuildingBlock().getBpmnFlowName()); + assertEquals("vnf0", ebbs.get(6).getWorkflowResourceIds().getVnfId()); + assertEquals("ActivateServiceInstanceBB", ebbs.get(7).getBuildingBlock().getBpmnFlowName()); + assertEquals("si0", ebbs.get(7).getWorkflowResourceIds().getServiceInstanceId()); + + } + + @Test + public void selectExecutionListServiceMacroDeactivateTest() throws Exception{ + String gAction = "deactivateInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch = new OrchestrationFlow(); + orch.setFlowName("DeactivateServiceInstanceBB"); + orchFlows.add(orch); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateServiceInstanceBB"); + } + + @Test + public void selectExecutionListServiceMacroEmptyServiceTest() throws Exception{ + String gAction = "createInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + northBoundRequest.setIsToplevelflow(true); + List orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("AssignServiceInstanceBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("CreateNetworkCollectionBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("AssignNetworkBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("AssignVnfBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("AssignVolumeGroupBB"); + orchFlows.add(orch5); + OrchestrationFlow orch6 = new OrchestrationFlow(); + orch6.setFlowName("AssignVfModuleBB"); + orchFlows.add(orch6); + OrchestrationFlow orch7 = new OrchestrationFlow(); + orch7.setFlowName("CreateNetworkBB"); + orchFlows.add(orch7); + OrchestrationFlow orch8 = new OrchestrationFlow(); + orch8.setFlowName("ActivateNetworkBB"); + orchFlows.add(orch8); + OrchestrationFlow orch9 = new OrchestrationFlow(); + orch9.setFlowName("CreateVolumeGroupBB"); + orchFlows.add(orch9); + OrchestrationFlow orch10 = new OrchestrationFlow(); + orch10.setFlowName("ActivateVolumeGroupBB"); + orchFlows.add(orch10); + OrchestrationFlow orch11 = new OrchestrationFlow(); + orch11.setFlowName("CreateVfModuleBB"); + orchFlows.add(orch11); + OrchestrationFlow orch12 = new OrchestrationFlow(); + orch12.setFlowName("ActivateVfModuleBB"); + orchFlows.add(orch12); + OrchestrationFlow orch13 = new OrchestrationFlow(); + orch13.setFlowName("ActivateVnfBB"); + orchFlows.add(orch13); + OrchestrationFlow orch14 = new OrchestrationFlow(); + orch14.setFlowName("ActivateNetworkCollectionBB"); + orchFlows.add(orch14); + OrchestrationFlow orch15 = new OrchestrationFlow(); + orch15.setFlowName("ActivateServiceInstanceBB"); + orchFlows.add(orch15); + + Service service = new Service(); + doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a"); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB"); + } + + @Test + public void selectExecutionListServiceMacroCreateJustNetworkTest() throws Exception{ + String gAction = "createInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + northBoundRequest.setIsToplevelflow(true); + List orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("AssignServiceInstanceBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("CreateNetworkCollectionBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("AssignNetworkBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("AssignVnfBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("AssignVolumeGroupBB"); + orchFlows.add(orch5); + OrchestrationFlow orch6 = new OrchestrationFlow(); + orch6.setFlowName("AssignVfModuleBB"); + orchFlows.add(orch6); + OrchestrationFlow orch7 = new OrchestrationFlow(); + orch7.setFlowName("CreateNetworkBB"); + orchFlows.add(orch7); + OrchestrationFlow orch8 = new OrchestrationFlow(); + orch8.setFlowName("ActivateNetworkBB"); + orchFlows.add(orch8); + OrchestrationFlow orch9 = new OrchestrationFlow(); + orch9.setFlowName("CreateVolumeGroupBB"); + orchFlows.add(orch9); + OrchestrationFlow orch10 = new OrchestrationFlow(); + orch10.setFlowName("ActivateVolumeGroupBB"); + orchFlows.add(orch10); + OrchestrationFlow orch11 = new OrchestrationFlow(); + orch11.setFlowName("CreateVfModuleBB"); + orchFlows.add(orch11); + OrchestrationFlow orch12 = new OrchestrationFlow(); + orch12.setFlowName("ActivateVfModuleBB"); + orchFlows.add(orch12); + OrchestrationFlow orch13 = new OrchestrationFlow(); + orch13.setFlowName("ActivateVnfBB"); + orchFlows.add(orch13); + OrchestrationFlow orch14 = new OrchestrationFlow(); + orch14.setFlowName("ActivateNetworkCollectionBB"); + orchFlows.add(orch14); + OrchestrationFlow orch15 = new OrchestrationFlow(); + orch15.setFlowName("ActivateServiceInstanceBB"); + orchFlows.add(orch15); + + Service service = new Service(); + NetworkResourceCustomization networkCustomization = new NetworkResourceCustomization(); + networkCustomization.setModelCustomizationUUID("1234"); + service.getNetworkCustomizations().add(networkCustomization); + doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a"); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB"); + } + + @Test + public void selectExecutionListServiceMacroCreateWithNetworkCollectionTest() throws Exception{ + String gAction = "createInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + northBoundRequest.setIsToplevelflow(true); + List orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("AssignServiceInstanceBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("CreateNetworkCollectionBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("AssignNetworkBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("AssignVnfBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("AssignVolumeGroupBB"); + orchFlows.add(orch5); + OrchestrationFlow orch6 = new OrchestrationFlow(); + orch6.setFlowName("AssignVfModuleBB"); + orchFlows.add(orch6); + OrchestrationFlow orch7 = new OrchestrationFlow(); + orch7.setFlowName("CreateNetworkBB"); + orchFlows.add(orch7); + OrchestrationFlow orch8 = new OrchestrationFlow(); + orch8.setFlowName("ActivateNetworkBB"); + orchFlows.add(orch8); + OrchestrationFlow orch9 = new OrchestrationFlow(); + orch9.setFlowName("CreateVolumeGroupBB"); + orchFlows.add(orch9); + OrchestrationFlow orch10 = new OrchestrationFlow(); + orch10.setFlowName("ActivateVolumeGroupBB"); + orchFlows.add(orch10); + OrchestrationFlow orch11 = new OrchestrationFlow(); + orch11.setFlowName("CreateVfModuleBB"); + orchFlows.add(orch11); + OrchestrationFlow orch12 = new OrchestrationFlow(); + orch12.setFlowName("ActivateVfModuleBB"); + orchFlows.add(orch12); + OrchestrationFlow orch13 = new OrchestrationFlow(); + orch13.setFlowName("ActivateVnfBB"); + orchFlows.add(orch13); + OrchestrationFlow orch14 = new OrchestrationFlow(); + orch14.setFlowName("ActivateNetworkCollectionBB"); + orchFlows.add(orch14); + OrchestrationFlow orch15 = new OrchestrationFlow(); + orch15.setFlowName("ActivateServiceInstanceBB"); + orchFlows.add(orch15); + + Service service = new Service(); + List networkCustomizations = new ArrayList<>(); + NetworkResourceCustomization networkCust = new NetworkResourceCustomization(); + networkCust.setModelCustomizationUUID("123"); + networkCustomizations.add(networkCust); + service.setNetworkCustomizations(networkCustomizations); + NetworkCollectionResourceCustomization collectionResourceCustomization = new NetworkCollectionResourceCustomization(); + collectionResourceCustomization.setModelCustomizationUUID("123"); + + CollectionResource collectionResource = new CollectionResource(); + collectionResource.setToscaNodeType("NetworkCollection"); + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setToscaNodeType("NetworkCollectionResource"); + instanceGroup.setCollectionNetworkResourceCustomizations(new ArrayList<>()); + CollectionNetworkResourceCustomization collectionNetworkResourceCust = new CollectionNetworkResourceCustomization(); + collectionNetworkResourceCust.setModelCustomizationUUID("123"); + instanceGroup.getCollectionNetworkResourceCustomizations().add(collectionNetworkResourceCust ); + List collectionInstanceGroupCustomizations = new ArrayList<>(); + CollectionResourceInstanceGroupCustomization collectionInstanceGroupCustomization = new CollectionResourceInstanceGroupCustomization(); + collectionInstanceGroupCustomization.setSubInterfaceNetworkQuantity(3); + collectionInstanceGroupCustomizations.add(collectionInstanceGroupCustomization); + collectionInstanceGroupCustomization.setInstanceGroup(instanceGroup); + instanceGroup.setCollectionInstanceGroupCustomizations(collectionInstanceGroupCustomizations); + collectionResource.setInstanceGroup(instanceGroup); + collectionResourceCustomization.setCollectionResource(collectionResource);; + service.getCollectionResourceCustomizations().add(collectionResourceCustomization); + doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a"); + doReturn(collectionResourceCustomization).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("123"); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"CreateNetworkCollectionBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals(ebbs.get(8).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals(ebbs.get(9).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(ebbs.get(10).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals(ebbs.get(11).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkCollectionBB"); + assertEquals(ebbs.get(12).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB"); + } + + @Test + public void selectExecutionListServiceMacroCreateWithUserParams() throws Exception{ + String gAction = "createInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("AssignServiceInstanceBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("CreateNetworkCollectionBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("AssignNetworkBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("AssignVnfBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("AssignVolumeGroupBB"); + orchFlows.add(orch5); + OrchestrationFlow orch6 = new OrchestrationFlow(); + orch6.setFlowName("AssignVfModuleBB"); + orchFlows.add(orch6); + OrchestrationFlow orch7 = new OrchestrationFlow(); + orch7.setFlowName("CreateNetworkBB"); + orchFlows.add(orch7); + OrchestrationFlow orch8 = new OrchestrationFlow(); + orch8.setFlowName("ActivateNetworkBB"); + orchFlows.add(orch8); + OrchestrationFlow orch9 = new OrchestrationFlow(); + orch9.setFlowName("CreateVolumeGroupBB"); + orchFlows.add(orch9); + OrchestrationFlow orch10 = new OrchestrationFlow(); + orch10.setFlowName("ActivateVolumeGroupBB"); + orchFlows.add(orch10); + OrchestrationFlow orch11 = new OrchestrationFlow(); + orch11.setFlowName("CreateVfModuleBB"); + orchFlows.add(orch11); + OrchestrationFlow orch12 = new OrchestrationFlow(); + orch12.setFlowName("ActivateVfModuleBB"); + orchFlows.add(orch12); + OrchestrationFlow orch13 = new OrchestrationFlow(); + orch13.setFlowName("ActivateVnfBB"); + orchFlows.add(orch13); + OrchestrationFlow orch14 = new OrchestrationFlow(); + orch14.setFlowName("ActivateNetworkCollectionBB"); + orchFlows.add(orch14); + OrchestrationFlow orch15 = new OrchestrationFlow(); + orch15.setFlowName("ActivateServiceInstanceBB"); + orchFlows.add(orch15); + + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + HeatEnvironment volumeHeatEnv = new HeatEnvironment(); + vfModuleCustomization.setVolumeHeatEnv(volumeHeatEnv); + org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule(); + HeatTemplate volumeHeatTemplate = new HeatTemplate(); + vfModule.setVolumeHeatTemplate(volumeHeatTemplate); + vfModuleCustomization.setVfModule(vfModule); + + VfModuleCustomization vfModuleCustomization2 = new VfModuleCustomization(); + vfModuleCustomization2.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + HeatEnvironment heatEnvironment = new HeatEnvironment(); + vfModuleCustomization2.setHeatEnvironment(heatEnvironment); + org.onap.so.db.catalog.beans.VfModule vfModule2 = new org.onap.so.db.catalog.beans.VfModule(); + HeatTemplate moduleHeatTemplate = new HeatTemplate(); + vfModule2.setModuleHeatTemplate(moduleHeatTemplate); + vfModuleCustomization2.setVfModule(vfModule2); + + VfModuleCustomization vfModuleCustomization3 = vfModuleCustomization2; + vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f")).thenReturn(vfModuleCustomization); + when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8")).thenReturn(vfModuleCustomization2); + when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969")).thenReturn(vfModuleCustomization3); + workflowAction.selectExecutionList(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB"); + assertEquals(3,ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length()); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"AssignVnfBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(1).getWorkflowResourceIds().getVnfId().length()); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"AssignVolumeGroupBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(2).getWorkflowResourceIds().getVolumeGroupId().length()); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(3).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(4).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(5).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"CreateVolumeGroupBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(6).getWorkflowResourceIds().getVolumeGroupId().length()); + assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"ActivateVolumeGroupBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(7).getWorkflowResourceIds().getVolumeGroupId().length()); + assertEquals(ebbs.get(8).getBuildingBlock().getBpmnFlowName(),"CreateVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(8).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(9).getBuildingBlock().getBpmnFlowName(),"CreateVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(9).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(10).getBuildingBlock().getBpmnFlowName(),"CreateVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(10).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(11).getBuildingBlock().getBpmnFlowName(),"ActivateVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(11).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(12).getBuildingBlock().getBpmnFlowName(),"ActivateVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(12).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(13).getBuildingBlock().getBpmnFlowName(),"ActivateVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(13).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(14).getBuildingBlock().getBpmnFlowName(),"ActivateVnfBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(14).getWorkflowResourceIds().getVnfId().length()); + assertEquals(ebbs.get(15).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB"); + assertEquals(3,ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length()); + + } + + @Test + public void selectExecutionListServiceMacroDeleteTest() throws Exception{ + String gAction = "deleteInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("DeactivateVfModuleBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("DeleteVfModuleBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("DeactivateVolumeGroupBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("DeleteVolumeGroupBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("DeactivateVnfBB"); + orchFlows.add(orch5); + OrchestrationFlow orch6 = new OrchestrationFlow(); + orch6.setFlowName("DeactivateNetworkBB"); + orchFlows.add(orch6); + OrchestrationFlow orch7 = new OrchestrationFlow(); + orch7.setFlowName("DeleteNetworkBB"); + orchFlows.add(orch7); + OrchestrationFlow orch8 = new OrchestrationFlow(); + orch8.setFlowName("DeleteNetworkCollectionBB"); + orchFlows.add(orch8); + OrchestrationFlow orch9 = new OrchestrationFlow(); + orch9.setFlowName("DeactivateServiceInstanceBB"); + orchFlows.add(orch9); + OrchestrationFlow orch10 = new OrchestrationFlow(); + orch10.setFlowName("UnassignVfModuleBB"); + orchFlows.add(orch10); + OrchestrationFlow orch11 = new OrchestrationFlow(); + orch11.setFlowName("UnassignVolumeGroupBB"); + orchFlows.add(orch11); + OrchestrationFlow orch12 = new OrchestrationFlow(); + orch12.setFlowName("UnassignVnfBB"); + orchFlows.add(orch12); + OrchestrationFlow orch13 = new OrchestrationFlow(); + orch13.setFlowName("UnassignNetworkBB"); + orchFlows.add(orch13); + OrchestrationFlow orch14 = new OrchestrationFlow(); + orch14.setFlowName("UnassignServiceInstanceBB"); + orchFlows.add(orch14); + + ServiceInstance serviceInstanceAAI = new ServiceInstance(); + serviceInstanceAAI.setServiceInstanceId("aaisi123"); + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance(); + org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf(); + vnf.setVnfId("vnfId123"); + + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule.setVfModuleId("vfModule1"); + vnf.getVfModules().add(vfModule); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule2.setVfModuleId("vfModule2"); + vnf.getVfModules().add(vfModule2); + + org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = new org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup(); + volumeGroup.setVolumeGroupId("vg123"); + vnf.getVolumeGroups().add(volumeGroup); + + serviceInstanceMSO.getVnfs().add(vnf); + + doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123"); + doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateVfModuleBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeactivateVfModuleBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"DeleteVfModuleBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"DeleteVfModuleBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"DeactivateVolumeGroupBB"); + assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"DeleteVolumeGroupBB"); + assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"DeactivateVnfBB"); + assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"DeactivateServiceInstanceBB"); + assertEquals(ebbs.get(8).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB"); + assertEquals(ebbs.get(9).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB"); + assertEquals(ebbs.get(10).getBuildingBlock().getBpmnFlowName(),"UnassignVolumeGroupBB"); + assertEquals(ebbs.get(11).getBuildingBlock().getBpmnFlowName(),"UnassignVnfBB"); + assertEquals(ebbs.get(12).getBuildingBlock().getBpmnFlowName(),"UnassignServiceInstanceBB"); + } + + @Test + public void selectExecutionListServiceMacroUnassignTest() throws Exception{ + String gAction = "unassignInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("UnassignVfModuleBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("UnassignVolumeGroupBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("UnassignVnfBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("UnassignNetworkBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("UnassignServiceInstanceBB"); + orchFlows.add(orch5); + + ServiceInstance serviceInstanceAAI = new ServiceInstance(); + serviceInstanceAAI.setServiceInstanceId("aaisi123"); + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance(); + org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf(); + vnf.setVnfId("vnfId123"); + + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule.setVfModuleId("vfModule1"); + vnf.getVfModules().add(vfModule); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule2.setVfModuleId("vfModule2"); + vnf.getVfModules().add(vfModule2); + + org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = new org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup(); + volumeGroup.setVolumeGroupId("vg123"); + vnf.getVolumeGroups().add(volumeGroup); + + serviceInstanceMSO.getVnfs().add(vnf); + + doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123"); + doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignVolumeGroupBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"UnassignVnfBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"UnassignServiceInstanceBB"); + } + + @Test + public void selectExecutionListServiceMacroDeleteNetworkCollectionTest() throws Exception{ + String gAction = "deleteInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("DeactivateVfModuleBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("DeleteVfModuleBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("DeactivateVolumeGroupBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("DeleteVolumeGroupBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("DeactivateVnfBB"); + orchFlows.add(orch5); + OrchestrationFlow orch6 = new OrchestrationFlow(); + orch6.setFlowName("DeactivateNetworkBB"); + orchFlows.add(orch6); + OrchestrationFlow orch7 = new OrchestrationFlow(); + orch7.setFlowName("DeleteNetworkBB"); + orchFlows.add(orch7); + OrchestrationFlow orch8 = new OrchestrationFlow(); + orch8.setFlowName("DeleteNetworkCollectionBB"); + orchFlows.add(orch8); + OrchestrationFlow orch9 = new OrchestrationFlow(); + orch9.setFlowName("DeactivateServiceInstanceBB"); + orchFlows.add(orch9); + OrchestrationFlow orch10 = new OrchestrationFlow(); + orch10.setFlowName("UnassignVfModuleBB"); + orchFlows.add(orch10); + OrchestrationFlow orch11 = new OrchestrationFlow(); + orch11.setFlowName("UnassignVolumeGroupBB"); + orchFlows.add(orch11); + OrchestrationFlow orch12 = new OrchestrationFlow(); + orch12.setFlowName("UnassignVnfBB"); + orchFlows.add(orch12); + OrchestrationFlow orch13 = new OrchestrationFlow(); + orch13.setFlowName("UnassignNetworkBB"); + orchFlows.add(orch13); + OrchestrationFlow orch14 = new OrchestrationFlow(); + orch14.setFlowName("UnassignServiceInstanceBB"); + orchFlows.add(orch14); + + ServiceInstance serviceInstanceAAI = new ServiceInstance(); + serviceInstanceAAI.setServiceInstanceId("aaisi123"); + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance(); + + org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network = new org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network(); + network.setNetworkId("123"); + serviceInstanceMSO.getNetworks().add(network); + org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network2 = new org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network(); + network2.setNetworkId("321"); + serviceInstanceMSO.getNetworks().add(network2); + + Collection collection = new Collection(); + serviceInstanceMSO.setCollection(collection); + + doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123"); + doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB"); + assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkCollectionBB"); + assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"DeactivateServiceInstanceBB"); + assertEquals(ebbs.get(8).getBuildingBlock().getBpmnFlowName(),"UnassignServiceInstanceBB"); + } + + @Ignore + @Test + public void selectExecutionListNetworkCollectionMacroCreate() throws Exception{ + String gAction = "createInstance"; + String resource = "NetworkCollection"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/CreateNetworkCollection.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123/networkCollections/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("CreateNetworkCollectionBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("AssignNetworkBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("CreateNetworkBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("ActivateNetworkBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("ActivateNetworkCollectionBB"); + orchFlows.add(orch5); + + Service service = new Service(); + CollectionResourceCustomization collectionResourceCustomization = new CollectionResourceCustomization(); + CollectionResource collectionResource = new CollectionResource(); + collectionResource.setToscaNodeType("Data NetworkCollection Data"); + collectionResourceCustomization.setCollectionResource(collectionResource); + service.getCollectionResourceCustomizations().add(collectionResourceCustomization); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service); + workflowAction.selectExecutionList(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"CreateNetworkCollectionBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkCollectionBB"); + } + + @Ignore + @Test + public void selectExecutionListNetworkCollectionMacroDelete() throws Exception{ + String gAction = "deleteInstance"; + String resource = "NetworkCollection"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/CreateNetworkCollection.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123/networkCollections/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("DeactivateNetworkBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("DeleteNetworkBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("UnassignNetworkBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("DeactivateNetworkCollectionBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("DeleteNetworkCollectionBB"); + orchFlows.add(orch5); + + Service service = new Service(); + CollectionResourceCustomization collectionResourceCustomization = new CollectionResourceCustomization(); + CollectionResource collectionResource = new CollectionResource(); + collectionResource.setToscaNodeType("Data NetworkCollection Data"); + collectionResourceCustomization.setCollectionResource(collectionResource); + service.getCollectionResourceCustomizations().add(collectionResourceCustomization); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service); + workflowAction.selectExecutionList(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB"); + assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkCollectionBB"); + assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkCollectionBB"); + } + + /** + * WorkflowActionBB Tests + */ + + @Test + public void pluralTest() { + List items = Arrays.asList( + "serviceInstances, Service", + "vnfs, Vnf", + "vfModules, VfModule", + "networks, Network", + "invalidNames, invalidNames"); + items.forEach(item -> { + String[] split = item.split(","); + String type = split[0].trim(); + String expected = split[1].trim(); + assertThat(workflowAction.convertTypeFromPlural(type), equalTo(expected)); + }); + } + + @Test + public void sortExecutionPathByObjectForVlanTaggingCreateTest() throws Exception{ + List executeFlows = new ArrayList<>(); + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); + BuildingBlock bb = new BuildingBlock(); + bb.setBpmnFlowName("AssignNetworkBB"); + bb.setKey("0"); + ebb.setBuildingBlock(bb); + executeFlows.add(ebb); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); + BuildingBlock bb2 = new BuildingBlock(); + bb2.setBpmnFlowName("AssignNetworkBB"); + bb2.setKey("1"); + ebb2.setBuildingBlock(bb2); + executeFlows.add(ebb2); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); + BuildingBlock bb3 = new BuildingBlock(); + bb3.setBpmnFlowName("CreateNetworkBB"); + bb3.setKey("0"); + ebb3.setBuildingBlock(bb3); + executeFlows.add(ebb3); + ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock(); + BuildingBlock bb4 = new BuildingBlock(); + bb4.setBpmnFlowName("CreateNetworkBB"); + bb4.setKey("1"); + ebb4.setBuildingBlock(bb4); + executeFlows.add(ebb4); + ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock(); + BuildingBlock bb5 = new BuildingBlock(); + bb5.setBpmnFlowName("ActivateNetworkBB"); + bb5.setKey("0"); + ebb5.setBuildingBlock(bb5); + executeFlows.add(ebb5); + ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock(); + BuildingBlock bb6 = new BuildingBlock(); + bb6.setBpmnFlowName("ActivateNetworkBB"); + bb6.setKey("1"); + ebb6.setBuildingBlock(bb6); + executeFlows.add(ebb6); + + List sorted = workflowAction.sortExecutionPathByObjectForVlanTagging(executeFlows,"createInstance"); + assertEquals(sorted.get(0).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals(sorted.get(1).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(sorted.get(2).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals(sorted.get(3).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals(sorted.get(4).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(sorted.get(5).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + } + + @Test + public void sortExecutionPathByObjectForVlanTaggingDeleteTest() throws Exception{ + List executeFlows = new ArrayList<>(); + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); + BuildingBlock bb = new BuildingBlock(); + bb.setBpmnFlowName("DeactivateNetworkBB"); + bb.setKey("0"); + ebb.setBuildingBlock(bb); + executeFlows.add(ebb); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); + BuildingBlock bb2 = new BuildingBlock(); + bb2.setBpmnFlowName("DeactivateNetworkBB"); + bb2.setKey("1"); + ebb2.setBuildingBlock(bb2); + executeFlows.add(ebb2); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); + BuildingBlock bb3 = new BuildingBlock(); + bb3.setBpmnFlowName("DeleteNetworkBB"); + bb3.setKey("0"); + ebb3.setBuildingBlock(bb3); + executeFlows.add(ebb3); + ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock(); + BuildingBlock bb4 = new BuildingBlock(); + bb4.setBpmnFlowName("DeleteNetworkBB"); + bb4.setKey("1"); + ebb4.setBuildingBlock(bb4); + executeFlows.add(ebb4); + ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock(); + BuildingBlock bb5 = new BuildingBlock(); + bb5.setBpmnFlowName("UnassignNetworkBB"); + bb5.setKey("0"); + ebb5.setBuildingBlock(bb5); + executeFlows.add(ebb5); + ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock(); + BuildingBlock bb6 = new BuildingBlock(); + bb6.setBpmnFlowName("UnassignNetworkBB"); + bb6.setKey("1"); + ebb6.setBuildingBlock(bb6); + executeFlows.add(ebb6); + + List sorted = workflowAction.sortExecutionPathByObjectForVlanTagging(executeFlows,"deleteInstance"); + assertEquals(sorted.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); + assertEquals(sorted.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + assertEquals(sorted.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB"); + assertEquals(sorted.get(3).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); + assertEquals(sorted.get(4).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + assertEquals(sorted.get(5).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB"); + } + @Test + public void queryNorthBoundRequestCatalogDbNestedTest() throws MalformedURLException { + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List orchFlows = new LinkedList<>(); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("AAICheckVnfInMaintBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("AAISetVnfInMaintBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("VNF-Macro-Replace"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("SDNOVnfHealthCheckBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("AAIUnsetVnfInMaintBB"); + orchFlows.add(orch5); + northBoundRequest.setOrchestrationFlowList(orchFlows); + + List macroFlows = new LinkedList<>(); + OrchestrationFlow o1 = new OrchestrationFlow(); + o1.setFlowName("DeactivateVfModuleBB"); + macroFlows.add(o1); + OrchestrationFlow o2 = new OrchestrationFlow(); + o2.setFlowName("DeleteVfModuleBB"); + macroFlows.add(o2); + OrchestrationFlow o3 = new OrchestrationFlow(); + o3.setFlowName("DeactivateVnfBB"); + macroFlows.add(o3); + OrchestrationFlow o4 = new OrchestrationFlow(); + o4.setFlowName("CreateVfModuleBB"); + macroFlows.add(o4); + OrchestrationFlow o5 = new OrchestrationFlow(); + o5.setFlowName("ActivateVfModuleBB"); + macroFlows.add(o5); + OrchestrationFlow o6 = new OrchestrationFlow(); + o6.setFlowName("ActivateVnfBB"); + macroFlows.add(o6); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope("replaceInstance","Vnf",false)).thenReturn(northBoundRequest); + when(catalogDbClient.getOrchestrationFlowByAction("VNF-Macro-Replace")).thenReturn(macroFlows); + List flows = workflowAction.queryNorthBoundRequestCatalogDb(execution, "replaceInstance", WorkflowType.VNF, false); + assertEquals(flows.get(0).getFlowName(),"AAICheckVnfInMaintBB"); + assertEquals(flows.get(1).getFlowName(),"AAISetVnfInMaintBB"); + assertEquals(flows.get(2).getFlowName(),"DeactivateVfModuleBB"); + assertEquals(flows.get(3).getFlowName(),"DeleteVfModuleBB"); + assertEquals(flows.get(4).getFlowName(),"DeactivateVnfBB"); + assertEquals(flows.get(5).getFlowName(),"CreateVfModuleBB"); + assertEquals(flows.get(6).getFlowName(),"ActivateVfModuleBB"); + assertEquals(flows.get(7).getFlowName(),"ActivateVnfBB"); + assertEquals(flows.get(8).getFlowName(),"SDNOVnfHealthCheckBB"); + assertEquals(flows.get(9).getFlowName(),"AAIUnsetVnfInMaintBB"); + } + + @Test + public void extractResourceIdAndTypeFromUriTest(){ + String uri = "/v6/serviceInstances/123"; + String uri2 = "/v6/serviceInstances/123/vnfs/1234"; + String uri3 = "/v6/serviceInstances"; + String uri4 = "/v6/serviceInstances/assign"; + String uri5 = "'/v6/serviceInstances/123/vnfs"; + String uri6 = "/v6/serviceInstances/123/vnfs/1234/someAction"; + String uri7 = "/v6/serviceInstances/123/vnfs/1234/vfModules/5678/replace"; + + Resource expected1 = new Resource(WorkflowType.SERVICE, "123", true); + Resource expected2 = new Resource(WorkflowType.VNF, "1234", false); + Resource expected3 = new Resource(WorkflowType.VNF, "1234", false); + Resource expected4 = new Resource(WorkflowType.VFMODULE, "5678", false); + Resource result = workflowAction.extractResourceIdAndTypeFromUri(uri); + assertEquals(expected1.getResourceId(),result.getResourceId()); + assertEquals(expected1.getResourceType(),result.getResourceType()); + result = workflowAction.extractResourceIdAndTypeFromUri(uri2); + assertEquals(expected2.getResourceId(),result.getResourceId()); + assertEquals(expected2.getResourceType(),result.getResourceType()); + result = workflowAction.extractResourceIdAndTypeFromUri(uri3); + assertEquals("Service", result.getResourceType().toString()); + assertEquals(UUID.randomUUID().toString().length(),result.getResourceId().length()); + result = workflowAction.extractResourceIdAndTypeFromUri(uri4); + assertEquals("Service", result.getResourceType().toString()); + assertEquals(UUID.randomUUID().toString().length(),result.getResourceId().length()); + result = workflowAction.extractResourceIdAndTypeFromUri(uri5); + assertEquals("Vnf", result.getResourceType().toString()); + assertEquals(UUID.randomUUID().toString().length(),result.getResourceId().length()); + result = workflowAction.extractResourceIdAndTypeFromUri(uri6); + assertEquals(expected3.getResourceId(),result.getResourceId()); + assertEquals(expected3.getResourceType(),result.getResourceType()); + result = workflowAction.extractResourceIdAndTypeFromUri(uri7); + assertEquals(expected4.getResourceId(),result.getResourceId()); + assertEquals(expected4.getResourceType(),result.getResourceType()); + } + + @Test + public void extractResourceIdAndTypeFromUriInvalidTypeTest() { + this.expectedException.expect(IllegalArgumentException.class); + this.expectedException.expectMessage(containsString("Uri could not be parsed. No type found.")); + workflowAction.extractResourceIdAndTypeFromUri("/v6/serviceInstances/123/vnfs/1234/vfmodules/5678/replace"); + } + + @Test + public void extractResourceIdAndTypeFromUriInvalidUriTest() { + this.expectedException.expect(IllegalArgumentException.class); + this.expectedException.expectMessage(containsString("Uri could not be parsed:")); + workflowAction.extractResourceIdAndTypeFromUri("something that doesn't match anything"); + } + + @Test + public void populateResourceIdsFromApiHandlerTest(){ + execution.setVariable("serviceInstanceId", "123"); + execution.setVariable("vnfId", "888"); + WorkflowResourceIds x = workflowAction.populateResourceIdsFromApiHandler(execution); + assertEquals("123",x.getServiceInstanceId()); + assertEquals("888",x.getVnfId()); + assertNull(x.getVolumeGroupId()); + } + + @Test + public void validateResourceIdInAAITest() throws Exception{ + //SI + RequestDetails reqDetails = new RequestDetails(); + SubscriberInfo subInfo = new SubscriberInfo(); + subInfo.setGlobalSubscriberId("id123"); + reqDetails.setSubscriberInfo(subInfo); + RequestParameters reqParams = new RequestParameters(); + reqParams.setSubscriptionServiceType("subServiceType123"); + reqDetails.setRequestParameters(reqParams ); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + ServiceInstance si = new ServiceInstance(); + si.setServiceInstanceId("siId123"); + Optional siOp = Optional.of(si); + when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siName123")).thenReturn(siOp); + when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "111111")).thenReturn(Optional.empty()); + String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", reqDetails, workflowResourceIds); + assertEquals("siId123",id); + String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "111111", reqDetails, workflowResourceIds); + assertEquals("generatedId123",id2); + + //Network + L3Network network = new L3Network(); + network.setNetworkId("id123"); + network.setNetworkName("name123"); + workflowResourceIds.setServiceInstanceId("siId123"); + Optional opNetwork = Optional.of(network); + when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123","name123")).thenReturn(opNetwork); + when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123","111111")).thenReturn(Optional.empty()); + id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "name123", reqDetails, workflowResourceIds); + assertEquals("id123",id); + id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "111111", reqDetails, workflowResourceIds); + assertEquals("generatedId123",id2); + + //Vnf + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("id123"); + vnf.setVnfName("vnfName123"); + Optional opVnf = Optional.of(vnf); + when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123","name123")).thenReturn(opVnf); + when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123","111111")).thenReturn(Optional.empty()); + id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "name123", reqDetails, workflowResourceIds); + assertEquals("id123",id); + id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "111111", reqDetails, workflowResourceIds); + assertEquals("generatedId123",id2); + + //VfModule + VfModules vfModules = new VfModules(); + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("id123"); + vfModule.setVfModuleName("name123"); + vfModules.getVfModule().add(vfModule); + vnf.setVfModules(vfModules); + workflowResourceIds.setVnfId("id123"); + when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(vnf); + id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "name123", reqDetails, workflowResourceIds); + assertEquals("id123",id); + + GenericVnf vnf2 = new GenericVnf(); + VfModules vfModules2 = new VfModules(); + VfModule vfModule2 = new VfModule(); + vfModule2.setVfModuleId("id123"); + vfModule2.setVfModuleName("name123"); + vfModules2.getVfModule().add(vfModule2); + vnf2.setVfModules(vfModules2); + workflowResourceIds.setVnfId("id111"); + when(bbSetupUtils.getAAIGenericVnf("id111")).thenReturn(vnf2); + id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "111111", reqDetails, workflowResourceIds); + assertEquals("generatedId123",id2); + + //VolumeGroup + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("id123"); + volumeGroup.setVolumeGroupName("name123"); + workflowResourceIds.setVnfId("id123"); + Optional opVolumeGroup = Optional.of(volumeGroup); + when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123","name123")).thenReturn(opVolumeGroup); + id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", reqDetails, workflowResourceIds); + assertEquals("id123",id); + + workflowResourceIds.setVnfId("id444"); + when(bbSetupUtils.getAAIGenericVnf("id444")).thenReturn(vnf); + when(bbSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123","111111")).thenReturn(opVolumeGroup); + when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id444","111111")).thenReturn(Optional.empty()); + id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "111111", reqDetails, workflowResourceIds); + assertEquals("id123",id2); + } + + @Test + public void handleRuntimeExceptionTest(){ + execution.setVariable("BPMN_javaExpMsg", "test runtime error message"); + execution.setVariable("testProcessKey", "testProcessKeyValue"); + try{ + workflowAction.handleRuntimeException(execution); + } catch (BpmnError wfe) { + assertEquals("MSOWorkflowException",wfe.getErrorCode()); + } + } + + @Test + public void traverseCatalogDbServiceMultipleNetworkTest() throws IOException{ + execution.setVariable("testProcessKey", "testProcessKeyValue"); + Service service = new Service(); + List networkCustomizations = new ArrayList<>(); + NetworkResourceCustomization networkCust = new NetworkResourceCustomization(); + networkCust.setModelCustomizationUUID("123"); + networkCustomizations.add(networkCust); + service.setNetworkCustomizations(networkCustomizations); + NetworkCollectionResourceCustomization collectionResourceCustomization = new NetworkCollectionResourceCustomization(); + collectionResourceCustomization.setModelCustomizationUUID("123"); + CollectionResource collectionResource = new CollectionResource(); + collectionResource.setToscaNodeType("NetworkCollection"); + InstanceGroup instanceGroup = new InstanceGroup(); + List collectionInstanceGroupCustomizations = new ArrayList<>(); + CollectionResourceInstanceGroupCustomization collectionInstanceGroupCustomization = new CollectionResourceInstanceGroupCustomization(); + collectionInstanceGroupCustomization.setSubInterfaceNetworkQuantity(3); + collectionInstanceGroupCustomizations.add(collectionInstanceGroupCustomization); + instanceGroup.setCollectionInstanceGroupCustomizations(collectionInstanceGroupCustomizations); + collectionResource.setInstanceGroup(instanceGroup); + collectionResourceCustomization.setCollectionResource(collectionResource);; + service.setModelUUID("abc"); + service.getCollectionResourceCustomizations().add(collectionResourceCustomization); + service.getCollectionResourceCustomizations().add(collectionResourceCustomization); + doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a"); + doReturn(collectionResourceCustomization).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("123"); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + ObjectMapper mapper = new ObjectMapper(); + ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class); + List resourceCounter = new ArrayList<>(); + thrown.expect(BpmnError.class); + workflowAction.traverseCatalogDbService(execution, sIRequest, resourceCounter); + } + + @Test + public void sortVfModulesByBaseFirstTest(){ + List resources = new ArrayList<>(); + Resource resource1 = new Resource(WorkflowType.VFMODULE,"111",false); + resource1.setBaseVfModule(false); + resources.add(resource1); + Resource resource2 = new Resource(WorkflowType.VFMODULE,"222",false); + resource2.setBaseVfModule(false); + resources.add(resource2); + Resource resource3 = new Resource(WorkflowType.VFMODULE,"333",false); + resource3.setBaseVfModule(true); + resources.add(resource3); + List result = workflowAction.sortVfModulesByBaseFirst(resources); + assertEquals("333",result.get(0).getResourceId()); + assertEquals("222",result.get(1).getResourceId()); + assertEquals("111",result.get(2).getResourceId()); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java new file mode 100644 index 0000000000..10599bdab4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java @@ -0,0 +1,108 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.sdno.tasks; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.SDNOHealthCheckResources; + + +@RunWith(MockitoJUnitRunner.class) +public class SDNOHealthCheckTasksTest extends TestDataSetup { + + @InjectMocks + protected SDNOHealthCheckTasks sdnoHealthCheckTasks = new SDNOHealthCheckTasks(); + + @Mock + SDNOHealthCheckResources MOCK_sdnoHealthCheckResources; + + + @Mock + private ExceptionBuilder exceptionUtil; + + @Mock + private ExtractPojosForBB extractPojosForBB; + + + private RequestContext requestContext; + private GenericVnf genericVnf; + + @Before + public void before() throws BBObjectNotFoundException { + genericVnf = setGenericVnf(); + requestContext = setRequestContext(); + when(extractPojosForBB.extractByKey(any(),any(), any())).thenReturn(genericVnf); + + } + + @Test + public void sdnoHealthCheckTest() throws Exception { + doReturn(true).when(MOCK_sdnoHealthCheckResources).healthCheck(genericVnf, requestContext); + sdnoHealthCheckTasks.sdnoHealthCheck(execution); + verify(MOCK_sdnoHealthCheckResources, times(1)).healthCheck(genericVnf, requestContext); + } + + @Test + public void sdnoHealthCheckNoResponseTest() throws Exception { + + doReturn(false).when(MOCK_sdnoHealthCheckResources).healthCheck(genericVnf, requestContext); + try { + sdnoHealthCheckTasks.sdnoHealthCheck(execution); + } catch (Exception e) { + verify(MOCK_sdnoHealthCheckResources, times(1)).healthCheck(genericVnf, requestContext); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); + } + + } + + @Test + public void sdnoHealthCheckExceptionTest() throws Exception { + doThrow(new Exception("Unknown Error")).when(MOCK_sdnoHealthCheckResources).healthCheck(genericVnf, requestContext); + doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); + try { + sdnoHealthCheckTasks.sdnoHealthCheck(execution); + } catch (Exception e) { + verify(MOCK_sdnoHealthCheckResources, times(1)).healthCheck(genericVnf, requestContext); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); + } + + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java new file mode 100644 index 0000000000..88f8526f31 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java @@ -0,0 +1,623 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.aai.mapper; + +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; +import org.onap.aai.domain.yang.RouteTargets; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget; +import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; + +public class AAIObjectMapperTest{ + private AAIObjectMapper aaiObjectMapper = new AAIObjectMapper(); + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; + + + @Test + public void mapConfigurationTest() { + Configuration configuration = new Configuration(); + configuration.setConfigurationId("configId"); + configuration.setConfigurationName("VNR"); + configuration.setConfigurationType("VNR-TYPE"); + configuration.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + configuration.setManagementOption("managementOption"); + ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); + modelInfoConfiguration.setModelCustomizationId("modelCustId"); + modelInfoConfiguration.setModelInvariantId("modelInvariantId"); + modelInfoConfiguration.setModelVersionId("modelVersionId"); + configuration.setModelInfoConfiguration(modelInfoConfiguration); + + org.onap.aai.domain.yang.Configuration expectedConfiguration = new org.onap.aai.domain.yang.Configuration(); + expectedConfiguration.setConfigurationId(configuration.getConfigurationId()); + expectedConfiguration.setConfigurationName(configuration.getConfigurationName()); + expectedConfiguration.setConfigurationType(configuration.getConfigurationType()); + expectedConfiguration.setOrchestrationStatus(configuration.getOrchestrationStatus().toString()); + expectedConfiguration.setManagementOption(configuration.getManagementOption()); + expectedConfiguration.setModelInvariantId(configuration.getModelInfoConfiguration().getModelInvariantId()); + expectedConfiguration.setModelVersionId(configuration.getModelInfoConfiguration().getModelVersionId()); + expectedConfiguration.setModelCustomizationId(configuration.getModelInfoConfiguration().getModelCustomizationId()); + + org.onap.aai.domain.yang.Configuration actualConfiguration = aaiObjectMapper.mapConfiguration(configuration); + + assertThat(actualConfiguration, sameBeanAs(expectedConfiguration)); + } + + @Test + public void mapVolumeGroupTest() throws Exception { + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setHeatStackId("heatStackId"); + volumeGroup.setModelInfoVfModule(new ModelInfoVfModule()); + volumeGroup.getModelInfoVfModule().setModelCustomizationUUID("modelCustomizationId"); + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ACTIVE); + volumeGroup.setVnfType("vnfType"); + volumeGroup.setVolumeGroupId("volumeGroupId"); + volumeGroup.setVolumeGroupName("volumeGroupName"); + + org.onap.aai.domain.yang.VolumeGroup expectedVolumeGroup = new org.onap.aai.domain.yang.VolumeGroup(); + expectedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId()); + expectedVolumeGroup.setModelCustomizationId(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID()); + expectedVolumeGroup.setOrchestrationStatus(volumeGroup.getOrchestrationStatus().toString()); + expectedVolumeGroup.setVfModuleModelCustomizationId(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID()); + expectedVolumeGroup.setVnfType(volumeGroup.getVnfType()); + expectedVolumeGroup.setVolumeGroupId(volumeGroup.getVolumeGroupId()); + expectedVolumeGroup.setVolumeGroupName(volumeGroup.getVolumeGroupName()); + + org.onap.aai.domain.yang.VolumeGroup actualVolumeGroup = aaiObjectMapper.mapVolumeGroup(volumeGroup); + + assertThat(actualVolumeGroup, sameBeanAs(expectedVolumeGroup)); + } + + @Test + public void serviceInstanceMap() { + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("SIID"); + serviceInstance.setServiceInstanceName("SINAME"); + serviceInstance.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setServiceType("SITYPE"); + modelInfoServiceInstance.setServiceRole("SIROLE"); + modelInfoServiceInstance.setModelInvariantUuid("MIUUID"); + modelInfoServiceInstance.setModelUuid("MUUID"); + modelInfoServiceInstance.setEnvironmentContext("EC"); + modelInfoServiceInstance.setWorkloadContext("WC"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + org.onap.aai.domain.yang.ServiceInstance AAIServiceInstance = aaiObjectMapper.mapServiceInstance(serviceInstance); + + assertEquals(AAIServiceInstance.getServiceInstanceId(),serviceInstance.getServiceInstanceId()); + assertEquals(AAIServiceInstance.getServiceInstanceName(),serviceInstance.getServiceInstanceName()); + assertEquals(AAIServiceInstance.getOrchestrationStatus().toString(),serviceInstance.getOrchestrationStatus().toString()); + assertEquals(AAIServiceInstance.getServiceType(),serviceInstance.getModelInfoServiceInstance().getServiceType()); + assertEquals(AAIServiceInstance.getServiceRole(),serviceInstance.getModelInfoServiceInstance().getServiceRole()); + assertEquals(AAIServiceInstance.getModelInvariantId(),serviceInstance.getModelInfoServiceInstance().getModelInvariantUuid()); + assertEquals(AAIServiceInstance.getModelVersionId(),serviceInstance.getModelInfoServiceInstance().getModelUuid()); + assertEquals(AAIServiceInstance.getEnvironmentContext(),serviceInstance.getModelInfoServiceInstance().getEnvironmentContext()); + assertEquals(AAIServiceInstance.getWorkloadContext(),serviceInstance.getModelInfoServiceInstance().getWorkloadContext()); + } + + @Test + public void projectMap(){ + Project project = new Project(); + project.setProjectName("abc"); + + org.onap.aai.domain.yang.Project AAIProject = aaiObjectMapper.mapProject(project); + + assertEquals(AAIProject.getProjectName(),project.getProjectName()); + } + + @Test + public void serviceSubscriptionMap(){ + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("IP-FLEX"); + serviceSubscription.setTempUbSubAccountId("Account-ID"); + org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionMapped = aaiObjectMapper.mapServiceSubscription(serviceSubscription); + assertNotNull(serviceSubscriptionMapped); + assertEquals(serviceSubscription.getTempUbSubAccountId(),serviceSubscriptionMapped.getTempUbSubAccountId()); + assertEquals(serviceSubscription.getServiceType(),serviceSubscriptionMapped.getServiceType()); + } + + @Test + public void owningEntityMap(){ + OwningEntity oe = new OwningEntity(); + oe.setOwningEntityId("abc"); + oe.setOwningEntityName("bbb"); + + org.onap.aai.domain.yang.OwningEntity AAIOwningEntity = aaiObjectMapper.mapOwningEntity(oe); + + assertEquals(AAIOwningEntity.getOwningEntityId(),oe.getOwningEntityId()); + assertEquals(AAIOwningEntity.getOwningEntityName(),oe.getOwningEntityName()); + + } + + @Test + public void vnfMap(){ + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("a"); + vnf.setVnfName("b"); + vnf.setServiceId("c"); + vnf.setVnfType("d"); + vnf.setProvStatus("e"); + vnf.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelCustomizationUuid("f"); + modelInfoGenericVnf.setModelInvariantUuid("g"); + modelInfoGenericVnf.setModelUuid("h"); + modelInfoGenericVnf.setNfRole("i"); + modelInfoGenericVnf.setNfType("j"); + modelInfoGenericVnf.setNfFunction("k"); + modelInfoGenericVnf.setNfNamingCode("l"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + org.onap.aai.domain.yang.GenericVnf AAIVnf = aaiObjectMapper.mapVnf(vnf); + + assertEquals(AAIVnf.getVnfId(),vnf.getVnfId()); + assertEquals(AAIVnf.getVnfName(),vnf.getVnfName()); + assertEquals(AAIVnf.getServiceId(),vnf.getServiceId()); + assertEquals(AAIVnf.getVnfType(),vnf.getVnfType()); + assertEquals(AAIVnf.getProvStatus(),vnf.getProvStatus()); + assertEquals(AAIVnf.getOrchestrationStatus().toString(),vnf.getOrchestrationStatus().toString()); + assertEquals(AAIVnf.getModelCustomizationId(),vnf.getModelInfoGenericVnf().getModelCustomizationUuid()); + assertEquals(AAIVnf.getModelInvariantId(),vnf.getModelInfoGenericVnf().getModelInvariantUuid()); + assertEquals(AAIVnf.getModelVersionId(),vnf.getModelInfoGenericVnf().getModelUuid()); + assertEquals(AAIVnf.getModelVersionId(),vnf.getModelInfoGenericVnf().getModelUuid()); + assertEquals(AAIVnf.getNfType(),vnf.getModelInfoGenericVnf().getNfType()); + assertEquals(AAIVnf.getNfFunction(),vnf.getModelInfoGenericVnf().getNfFunction()); + assertEquals(AAIVnf.getNfNamingCode(),vnf.getModelInfoGenericVnf().getNfNamingCode()); + } + + @Test + public void vfModuleMap() throws Exception { + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("a"); + vfModule.setVfModuleName("b"); + vfModule.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelCustomizationUUID("f"); + modelInfoVfModule.setModelInvariantUUID("g"); + modelInfoVfModule.setModelUUID("h"); + modelInfoVfModule.setIsBaseBoolean(false); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule); + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVfModuleMap.json"))); + + ObjectMapper omapper = new ObjectMapper(); + org.onap.aai.domain.yang.VfModule reqMapper1 = omapper.readValue( + jsonToCompare, + org.onap.aai.domain.yang.VfModule.class); + + assertThat(reqMapper1, sameBeanAs(AAIVfModule)); + + } + + @Test + public void testMapInstanceGroup() { + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId("test-id"); + instanceGroup.setDescription("test-description"); + instanceGroup.setInstanceGroupName("test-instanceGroupName"); + instanceGroup.setResourceVersion("test-resourceVersion"); + + + ModelInfoInstanceGroup model = new ModelInfoInstanceGroup(); + model.setFunction("test-function"); + model.setInstanceGroupRole("SUB-INTERFACE"); + model.setType("VNFC"); + model.setModelInvariantUUID("modelInvariantUUID-000"); + model.setModelUUID("modelUUID-000"); + model.setDescription("test-description"); + + instanceGroup.setModelInfoInstanceGroup(model); + + + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup); + + try { + com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper(); + String json = mapper.writeValueAsString(aaiInstanceGroup); + System.out.println("GGG - json:\n" + json); + + } + catch(Exception e) { + e.printStackTrace(); + } + + assertEquals(aaiInstanceGroup.getId(), instanceGroup.getId()); + assertEquals(aaiInstanceGroup.getDescription(), instanceGroup.getDescription()); + assertEquals(aaiInstanceGroup.getInstanceGroupRole(), instanceGroup.getModelInfoInstanceGroup().getInstanceGroupRole()); + assertEquals(aaiInstanceGroup.getModelInvariantId(), instanceGroup.getModelInfoInstanceGroup().getModelInvariantUUID()); + assertEquals(aaiInstanceGroup.getModelVersionId(), instanceGroup.getModelInfoInstanceGroup().getModelUUID()); + assertEquals(aaiInstanceGroup.getResourceVersion(), instanceGroup.getResourceVersion()); + assertEquals(aaiInstanceGroup.getInstanceGroupType(), instanceGroup.getModelInfoInstanceGroup().getType()); + } + + @Test + public void mapCustomerTest() { + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setSubscriberName("subscriberName"); + customer.setSubscriberType("subscriberType"); + + org.onap.aai.domain.yang.Customer expectedCustomer = new org.onap.aai.domain.yang.Customer(); + expectedCustomer.setGlobalCustomerId("globalCustomerId"); + expectedCustomer.setSubscriberName("subscriberName"); + expectedCustomer.setSubscriberType("subscriberType"); + + org.onap.aai.domain.yang.Customer actualCustomer = aaiObjectMapper.mapCustomer(customer); + + assertThat(actualCustomer, sameBeanAs(expectedCustomer)); + } + + @Test + public void networkMap() throws Exception { + L3Network l3Network = new L3Network(); + l3Network.setNetworkId("networkId"); + l3Network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + l3Network.setNetworkName("networkName"); + l3Network.setNetworkRole("networkRole"); + l3Network.setNetworkTechnology("networkTechnology"); + l3Network.setNeutronNetworkId("neutronNetworkId"); + l3Network.setNetworkRoleInstance(0L); + l3Network.setContrailNetworkFqdn("contrailNetworkFqdn"); + l3Network.setIsBoundToVpn(false); + l3Network.setIsCascaded(false); + l3Network.setIsExternalNetwork(false); + l3Network.setHeatStackId("heatStackId"); + l3Network.setOperationalStatus("operationalStatus"); + l3Network.setPhysicalNetworkName("physicalNetworkName"); + l3Network.setIsProviderNetwork(false); + l3Network.setSelflink("selflink"); + l3Network.setServiceId("serviceId"); + + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUUID"); + modelInfoNetwork.setModelInvariantUUID("modelInvariantUUID"); + modelInfoNetwork.setModelUUID("modelUUID"); + + l3Network.setModelInfoNetwork(modelInfoNetwork); + + org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(l3Network); + + ObjectMapper omapper = new ObjectMapper(); + org.onap.aai.domain.yang.L3Network network = omapper.readValue( + getJson("aaiL3NetworkMapped.json"), + org.onap.aai.domain.yang.L3Network.class); + + com.shazam.shazamcrest.MatcherAssert.assertThat(aaiL3Network, sameBeanAs(network)); + + } + + @Test + public void mapCollectionTest() { + Collection networkCollection = new Collection(); + networkCollection.setId("networkCollectionId"); + ModelInfoCollection modelInfoCollection = new ModelInfoCollection(); + modelInfoCollection.setCollectionFunction("networkCollectionFunction"); + modelInfoCollection.setCollectionRole("networkCollectionRole"); + networkCollection.setModelInfoCollection(modelInfoCollection); + networkCollection.setName("networkCollectionName"); + + org.onap.aai.domain.yang.Collection expectedCollection = new org.onap.aai.domain.yang.Collection(); + expectedCollection.setCollectionId("networkCollectionId"); + expectedCollection.setCollectionFunction("networkCollectionFunction"); + expectedCollection.setCollectionRole("networkCollectionRole"); + expectedCollection.setCollectionName("networkCollectionName"); + + org.onap.aai.domain.yang.Collection actualCollection = aaiObjectMapper.mapCollection(networkCollection); + + assertThat(actualCollection, sameBeanAs(expectedCollection)); + } + + /* + * Helper method to load JSON data + */ + private String getJson(String filename) throws IOException { + return new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + filename))); + } + + @Test + public void mapNetworkTest() throws Exception { + L3Network l3Network = new L3Network(); + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + modelInfoNetwork.setModelCustomizationUUID("modelCustomization_id"); + modelInfoNetwork.setModelInvariantUUID("modelInvariant_id"); + modelInfoNetwork.setModelUUID("modelCustomization_id"); + modelInfoNetwork.setNetworkType("CONTRAIL_EXTERNAL"); + modelInfoNetwork.setNetworkRole("dmz_direct"); + modelInfoNetwork.setNetworkTechnology("contrail"); + l3Network.setModelInfoNetwork(modelInfoNetwork); + l3Network.setNetworkId("TESTING_ID"); + l3Network.setNetworkName("TESTING_NAME"); + l3Network.setIsBoundToVpn(true); + l3Network.setServiceId("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + l3Network.setNetworkRoleInstance(1L); + l3Network.setOrchestrationStatus(OrchestrationStatus.CREATED); + l3Network.setHeatStackId("heatStack_id"); + l3Network.setContrailNetworkFqdn("contrailNetwork_fqdn"); + l3Network.setWidgetModelId("widgetModel_id"); + l3Network.setWidgetModelVersion("widgetModel_version"); + l3Network.setPhysicalNetworkName("physicalNetwork_name"); + l3Network.setIsProviderNetwork(true); + l3Network.setIsSharedNetwork(false); + l3Network.setIsExternalNetwork(false); + l3Network.setSelflink("self_link"); + l3Network.setOperationalStatus("operationalStatus"); + + List subnets = new ArrayList(); + Subnet subnet1 = new Subnet(); + subnet1.setSubnetId("57e9a1ff-d14f-4071-a828-b19ae98eb2fc"); + subnet1.setSubnetName("subnetName"); + subnet1.setGatewayAddress("192.168.52.1"); + subnet1.setNetworkStartAddress("192.168.52.0"); + subnet1.setCidrMask("24"); + subnet1.setIpVersion("4"); + subnet1.setOrchestrationStatus(OrchestrationStatus.CREATED); + subnet1.setIpAssignmentDirection("true"); + subnet1.setDhcpEnabled(true); + subnet1.setDhcpStart("dhcpStart"); + subnet1.setDhcpEnd("dhcpEnd"); + subnet1.setSubnetRole("subnetRole"); + subnet1.setIpAssignmentDirection("true"); + subnet1.setSubnetSequence(new Integer(3)); + + List hostRoutes = new ArrayList(); + HostRoute hostRoute1 = new HostRoute(); + hostRoute1.setHostRouteId("string"); + hostRoute1.setRoutePrefix("192.10.16.0/24"); + hostRoute1.setNextHop("192.10.16.100/24"); + hostRoute1.setNextHopType("ip-address"); + HostRoute hostRoute2 = new HostRoute(); + hostRoute2.setHostRouteId("string"); + hostRoute2.setRoutePrefix("192.110.17.0/24"); + hostRoute2.setNextHop("192.110.17.110/24"); + hostRoute2.setNextHopType("ip-address"); + hostRoutes.add(hostRoute1); + hostRoutes.add(hostRoute2); + subnet1.getHostRoutes().addAll(hostRoutes); + + subnets.add(subnet1); + subnets.add(subnet1); + l3Network.getSubnets().addAll(subnets); + + List ctagAssignments = new ArrayList(); + CtagAssignment ctagAssignment1 = new CtagAssignment(); + ctagAssignment1.setVlanIdInner(1L); + ctagAssignments.add(ctagAssignment1); + l3Network.getCtagAssignments().addAll(ctagAssignments); + + List segmentationAssignments = new ArrayList(); + SegmentationAssignment segmentationAssignment1 = new SegmentationAssignment(); + segmentationAssignment1.setSegmentationId("segmentationId1"); + SegmentationAssignment segmentationAssignment2 = new SegmentationAssignment(); + segmentationAssignment2.setSegmentationId("segmentationId2"); + segmentationAssignments.add(segmentationAssignment1); + segmentationAssignments.add(segmentationAssignment2); + l3Network.getSegmentationAssignments().addAll(segmentationAssignments); + + AAIObjectMapper l3NetworkMapper = new AAIObjectMapper(); + org.onap.aai.domain.yang.L3Network v12L3Network = l3NetworkMapper.mapNetwork(l3Network); + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiL3NetworkMapped_to_aai.json"))); + ObjectMapper omapper = new ObjectMapper(); + org.onap.aai.domain.yang.L3Network network = omapper.readValue(jsonToCompare, + org.onap.aai.domain.yang.L3Network.class); + + ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); + String jsonGenerated = ow.writeValueAsString(v12L3Network); + String jsonExpected = ow.writeValueAsString(network); + assertEquals(jsonExpected, jsonGenerated); + + } + + @Test + public void mapToAAISubNetsTest() throws Exception { + List subnets = new ArrayList(); + Subnet subnet1 = new Subnet(); + subnet1.setSubnetId("57e9a1ff-d14f-4071-a828-b19ae98eb2fc"); + subnet1.setSubnetName("subnetName"); + subnet1.setGatewayAddress("192.168.52.1"); + subnet1.setNetworkStartAddress("192.168.52.0"); + subnet1.setCidrMask("24"); + subnet1.setIpVersion("4"); + subnet1.setOrchestrationStatus(OrchestrationStatus.CREATED); + subnet1.setIpAssignmentDirection("true"); + subnet1.setDhcpEnabled(true); + subnet1.setDhcpStart("dhcpStart"); + subnet1.setDhcpEnd("dhcpEnd"); + subnet1.setSubnetRole("subnetRole"); + subnet1.setIpAssignmentDirection("true"); + subnet1.setSubnetSequence(new Integer(3)); + + List hostRoutes = new ArrayList(); + HostRoute hostRoute1 = new HostRoute(); + hostRoute1.setHostRouteId("string"); + hostRoute1.setRoutePrefix("192.10.16.0/24"); + hostRoute1.setNextHop("192.10.16.100/24"); + hostRoute1.setNextHopType("ip-address"); + HostRoute hostRoute2 = new HostRoute(); + hostRoute2.setHostRouteId("string"); + hostRoute2.setRoutePrefix("192.110.17.0/24"); + hostRoute2.setNextHop("192.110.17.110/24"); + hostRoute2.setNextHopType("ip-address"); + hostRoutes.add(hostRoute1); + hostRoutes.add(hostRoute2); + subnet1.getHostRoutes().addAll(hostRoutes); + + subnets.add(subnet1); + subnets.add(subnet1); + + AAIObjectMapper aaiObjectMapper = new AAIObjectMapper(); + org.onap.aai.domain.yang.Subnets v12Subnets = aaiObjectMapper.mapToAAISubNets(subnets); + + assertEquals(subnets.get(0).getDhcpEnd(), v12Subnets.getSubnet().get(0).getDhcpEnd()); + assertEquals(subnets.get(0).getCidrMask(), v12Subnets.getSubnet().get(0).getCidrMask()); + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiSubnetsMapped_to_aai.json"))); + ObjectMapper omapper = new ObjectMapper(); + org.onap.aai.domain.yang.Subnets subnet = omapper.readValue(jsonToCompare, + org.onap.aai.domain.yang.Subnets.class); + ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); + String jsonGenerated = ow.writeValueAsString(v12Subnets); + String jsonExpected = ow.writeValueAsString(subnet); + assertEquals(jsonExpected, jsonGenerated); + } + + @Test + public void mapToAAICtagAssignmentListTest() throws Exception { + List ctagAssignments = new ArrayList(); + CtagAssignment ctagAssignment1 = new CtagAssignment(); + ctagAssignment1.setVlanIdInner(1L); + ctagAssignments.add(ctagAssignment1); + + AAIObjectMapper aaiObjectMapper = new AAIObjectMapper(); + org.onap.aai.domain.yang.CtagAssignments v12CtagAssingments = aaiObjectMapper.mapToAAICtagAssignmentList(ctagAssignments); + + assertEquals(ctagAssignments.get(0).getVlanIdInner(), v12CtagAssingments.getCtagAssignment().get(0).getVlanIdInner()); + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiCtagAssingmentsMapped_to_aai.json"))); + ObjectMapper omapper = new ObjectMapper(); + org.onap.aai.domain.yang.CtagAssignments ctagAssignment = omapper.readValue(jsonToCompare, + org.onap.aai.domain.yang.CtagAssignments.class); + ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); + String jsonGenerated = ow.writeValueAsString(v12CtagAssingments); + String jsonExpected = ow.writeValueAsString(ctagAssignment); + assertEquals(jsonExpected, jsonGenerated); + } + + @Test + public void mapToAAISegmentationAssignmentListTest() throws Exception { + List segmentationAssignments = new ArrayList(); + SegmentationAssignment segmentationAssignment1 = new SegmentationAssignment(); + segmentationAssignment1.setSegmentationId("segmentationId1"); + SegmentationAssignment segmentationAssignment2 = new SegmentationAssignment(); + segmentationAssignment2.setSegmentationId("segmentationId2"); + segmentationAssignments.add(segmentationAssignment1); + segmentationAssignments.add(segmentationAssignment2); + + AAIObjectMapper aaiObjectMapper = new AAIObjectMapper(); + org.onap.aai.domain.yang.SegmentationAssignments v12SegmentationAssignments = aaiObjectMapper.mapToAAISegmentationAssignmentList(segmentationAssignments); + + assertEquals(segmentationAssignments.get(0).getSegmentationId(), v12SegmentationAssignments.getSegmentationAssignment().get(0).getSegmentationId()); + assertEquals(segmentationAssignments.get(1).getSegmentationId(), v12SegmentationAssignments.getSegmentationAssignment().get(1).getSegmentationId()); + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiSegmentationAssignmentsMapped_to_aai.json"))); + ObjectMapper omapper = new ObjectMapper(); + org.onap.aai.domain.yang.SegmentationAssignments segmentationAssignment = omapper.readValue(jsonToCompare, + org.onap.aai.domain.yang.SegmentationAssignments.class); + ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); + String jsonGenerated = ow.writeValueAsString(v12SegmentationAssignments); + String jsonExpected = ow.writeValueAsString(segmentationAssignment); + assertEquals(jsonExpected, jsonGenerated); + + } + + @Test + public void mapVpnBindingTest() { + VpnBinding vpnBinding = new VpnBinding(); + vpnBinding.setVpnId("testVpnId"); + vpnBinding.setVpnName("testVpn"); + vpnBinding.setVpnPlatform("AVPN"); + vpnBinding.setCustomerVpnId("testCustomerVpnId"); + vpnBinding.setVpnType("testVpnType"); + vpnBinding.setVpnRegion("testVpnRegion"); + vpnBinding.setRouteDistinguisher("testRD"); + RouteTarget routeTarget = new RouteTarget(); + routeTarget.setRouteTargetRole("testRtRole"); + routeTarget.setGlobalRouteTarget("testGrt"); + vpnBinding.getRouteTargets().add(routeTarget); + + + org.onap.aai.domain.yang.VpnBinding expectedVpnBinding = new org.onap.aai.domain.yang.VpnBinding(); + expectedVpnBinding.setVpnId("testVpnId"); + expectedVpnBinding.setVpnName("testVpn"); + expectedVpnBinding.setVpnPlatform("AVPN"); + expectedVpnBinding.setCustomerVpnId("testCustomerVpnId"); + expectedVpnBinding.setVpnType("testVpnType"); + expectedVpnBinding.setVpnRegion("testVpnRegion"); + expectedVpnBinding.setRouteDistinguisher("testRD"); + + org.onap.aai.domain.yang.RouteTarget expectedRouteTarget = new org.onap.aai.domain.yang.RouteTarget(); + expectedRouteTarget.setRouteTargetRole("testRtRole"); + expectedRouteTarget.setGlobalRouteTarget("testGrt"); + + RouteTargets expectedRouteTargets = new RouteTargets(); + expectedRouteTargets.getRouteTarget().add(expectedRouteTarget); + + expectedVpnBinding.setRouteTargets(expectedRouteTargets); + + org.onap.aai.domain.yang.VpnBinding actualVpnBinding = aaiObjectMapper.mapVpnBinding(vpnBinding); + + assertThat(actualVpnBinding, sameBeanAs(expectedVpnBinding)); + } + + @Test + public void mapRouteTargetTest() { + RouteTarget routeTarget = new RouteTarget(); + routeTarget.setRouteTargetRole("testRtRole"); + routeTarget.setGlobalRouteTarget("testGrt"); + + org.onap.aai.domain.yang.RouteTarget expectedRouteTarget = new org.onap.aai.domain.yang.RouteTarget(); + expectedRouteTarget.setRouteTargetRole("testRtRole"); + expectedRouteTarget.setGlobalRouteTarget("testGrt"); + + org.onap.aai.domain.yang.RouteTarget actualRouteTarget = aaiObjectMapper.mapRouteTarget(routeTarget); + + assertThat(actualRouteTarget, sameBeanAs(expectedRouteTarget)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java new file mode 100644 index 0000000000..207b9f3f98 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.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.client.adapter.network; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.junit.Assert.assertEquals; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.adapters.nwrest.CreateNetworkError; +import org.onap.so.adapters.nwrest.CreateNetworkRequest; +import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.adapters.nwrest.DeleteNetworkError; +import org.onap.so.adapters.nwrest.DeleteNetworkRequest; +import org.onap.so.adapters.nwrest.DeleteNetworkResponse; +import org.onap.so.adapters.nwrest.QueryNetworkError; +import org.onap.so.adapters.nwrest.QueryNetworkResponse; +import org.onap.so.adapters.nwrest.RollbackNetworkError; +import org.onap.so.adapters.nwrest.RollbackNetworkRequest; +import org.onap.so.adapters.nwrest.RollbackNetworkResponse; +import org.onap.so.adapters.nwrest.UpdateNetworkError; +import org.onap.so.adapters.nwrest.UpdateNetworkRequest; +import org.onap.so.adapters.nwrest.UpdateNetworkResponse; +import org.onap.so.openstack.beans.NetworkRollback; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import static com.github.tomakehurst.wiremock.client.WireMock.*; + +public class NetworkAdapterClientIT extends BaseTest{ + + private static final String TESTING_ID = "___TESTING___"; + private static final String AAI_NETWORK_ID = "test"; + private static final String REST_ENDPOINT = "/networks/rest/v1/networks"; + + private NetworkAdapterClientImpl client = new NetworkAdapterClientImpl(); + private ObjectMapper mapper = new ObjectMapper(); + + @BeforeClass + public static void setUp() { + System.setProperty("mso.config.path", "src/test/resources"); + } + + @Test + public void createNetworkTest() throws NetworkAdapterClientException, JsonProcessingException { + CreateNetworkRequest request = new CreateNetworkRequest(); + request.setCloudSiteId(TESTING_ID); + + CreateNetworkResponse mockResponse = new CreateNetworkResponse(); + mockResponse.setNetworkCreated(true); + stubFor(post(urlPathEqualTo(REST_ENDPOINT)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + CreateNetworkResponse response = client.createNetwork(request); + assertEquals("Testing CreateVfModule response", true, response.getNetworkCreated()); + } + + @Test(expected = NetworkAdapterClientException.class) + public void createNetworkTestThrowException() throws NetworkAdapterClientException, JsonProcessingException { + CreateNetworkRequest request = new CreateNetworkRequest(); + request.setCloudSiteId(TESTING_ID); + + CreateNetworkError mockResponse = new CreateNetworkError(); + mockResponse.setMessage("Error in create network"); + stubFor(post(urlPathEqualTo(REST_ENDPOINT)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.createNetwork(request); + } + + @Test + public void deleteNetworkTest() throws NetworkAdapterClientException, JsonProcessingException { + DeleteNetworkRequest request = new DeleteNetworkRequest(); + request.setCloudSiteId(TESTING_ID); + + DeleteNetworkResponse mockResponse = new DeleteNetworkResponse(); + mockResponse.setNetworkDeleted(true); + + stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + DeleteNetworkResponse response = client.deleteNetwork(AAI_NETWORK_ID, request); + assertEquals("Testing DeleteVfModule response", true, response.getNetworkDeleted()); + } + + @Test(expected = NetworkAdapterClientException.class) + public void deleteNetworkTestThrowException() throws NetworkAdapterClientException, JsonProcessingException { + DeleteNetworkRequest request = new DeleteNetworkRequest(); + request.setCloudSiteId(TESTING_ID); + + DeleteNetworkError mockResponse = new DeleteNetworkError(); + mockResponse.setMessage("Error in delete network"); + stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.deleteNetwork(AAI_NETWORK_ID, request); + } + + @Test + public void rollbackNetworkTest() throws NetworkAdapterClientException, JsonProcessingException { + RollbackNetworkRequest request = new RollbackNetworkRequest(); + NetworkRollback rollback = new NetworkRollback(); + rollback.setCloudId(TESTING_ID); + request.setNetworkRollback(rollback); + + RollbackNetworkResponse mockResponse = new RollbackNetworkResponse(); + mockResponse.setNetworkRolledBack(true); + + stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + RollbackNetworkResponse response = client.rollbackNetwork(AAI_NETWORK_ID, request); + assertEquals("Testing DeleteVfModule response", true, response.getNetworkRolledBack()); + } + + @Test(expected = NetworkAdapterClientException.class) + public void rollbackNetworkTestThrowException() throws NetworkAdapterClientException, JsonProcessingException { + RollbackNetworkRequest request = new RollbackNetworkRequest(); + NetworkRollback rollback = new NetworkRollback(); + rollback.setCloudId(TESTING_ID); + request.setNetworkRollback(rollback); + + RollbackNetworkError mockResponse = new RollbackNetworkError(); + mockResponse.setMessage("Error in rollback network"); + + stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.rollbackNetwork(AAI_NETWORK_ID, request); + } + + @Test + public void queryNetworkTest() throws NetworkAdapterClientException, JsonProcessingException { + QueryNetworkResponse mockResponse = new QueryNetworkResponse(); + mockResponse.setNetworkExists(true); + + stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).withQueryParam("cloudSiteId", equalTo(TESTING_ID)) + .withQueryParam("tenantId", equalTo(TESTING_ID)) + .withQueryParam("networkStackId", equalTo("networkStackId")).withQueryParam("skipAAI", equalTo("true")) + .withQueryParam("msoRequest.requestId", equalTo("testRequestId")) + .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + QueryNetworkResponse response = client.queryNetwork(AAI_NETWORK_ID, TESTING_ID, TESTING_ID, "networkStackId", + true, "testRequestId", "serviceInstanceId"); + assertEquals("Testing QueryVfModule response", true, response.getNetworkExists()); + } + + @Test(expected = NetworkAdapterClientException.class) + public void queryNetworkTestThrowException() throws NetworkAdapterClientException, JsonProcessingException { + QueryNetworkError mockResponse = new QueryNetworkError(); + mockResponse.setMessage("Error in query network"); + + stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).withQueryParam("cloudSiteId", equalTo(TESTING_ID)) + .withQueryParam("tenantId", equalTo(TESTING_ID)) + .withQueryParam("networkStackId", equalTo("networkStackId")).withQueryParam("skipAAI", equalTo("true")) + .withQueryParam("msoRequest.requestId", equalTo("testRequestId")) + .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.queryNetwork(AAI_NETWORK_ID, TESTING_ID, TESTING_ID, "networkStackId", + true, "testRequestId", "serviceInstanceId"); + } + + @Test + public void updateNetworkTest() throws NetworkAdapterClientException, JsonProcessingException { + UpdateNetworkRequest request = new UpdateNetworkRequest(); + request.setCloudSiteId(TESTING_ID); + request.setNetworkId("test1"); + + UpdateNetworkResponse mockResponse = new UpdateNetworkResponse(); + mockResponse.setNetworkId("test1"); + stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + UpdateNetworkResponse response = client.updateNetwork(AAI_NETWORK_ID, request); + assertEquals("Testing UpdateVfModule response", "test1", response.getNetworkId()); + } + + @Test(expected = NetworkAdapterClientException.class) + public void updateNetworkTestThrowException() throws NetworkAdapterClientException, JsonProcessingException { + UpdateNetworkRequest request = new UpdateNetworkRequest(); + request.setCloudSiteId(TESTING_ID); + request.setNetworkId("test1"); + + UpdateNetworkError mockResponse = new UpdateNetworkError(); + mockResponse.setMessage("Error in update network"); + stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.updateNetwork(AAI_NETWORK_ID, request); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java new file mode 100644 index 0000000000..96fbe7ffb7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java @@ -0,0 +1,301 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.client.adapter.network.mapper; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.mockito.Mockito.doReturn; + +import java.io.UnsupportedEncodingException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.onap.so.adapters.nwrest.ContrailNetwork; +import org.onap.so.adapters.nwrest.CreateNetworkRequest; +import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.adapters.nwrest.DeleteNetworkRequest; +import org.onap.so.adapters.nwrest.ProviderVlanNetwork; +import org.onap.so.adapters.nwrest.RollbackNetworkRequest; +import org.onap.so.adapters.nwrest.UpdateNetworkRequest; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.beans.NetworkRollback; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class NetworkAdapterObjectMapperTest extends TestDataSetup{ + + private NetworkAdapterObjectMapper SPY_networkAdapterObjectMapper = Mockito.spy(NetworkAdapterObjectMapper.class); + + private L3Network l3Network; + private RequestContext requestContext; + private ServiceInstance serviceInstance; + private CloudRegion cloudRegion; + private OrchestrationContext orchestrationContext; + private Customer customer; + Map userInput; + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/NetworkMapper/"; + + @Before + public void before() { + requestContext = setRequestContext(); + + customer = buildCustomer(); + + serviceInstance = setServiceInstance(); + + cloudRegion = setCloudRegion(); + + orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + userInput = setUserInput(); + + l3Network = setL3Network(); + + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + } + + @Test + public void buildCreateNetworkRequestFromBbobjectTest() throws Exception { + + String cloudRegionPo = "cloudRegionPo"; + CreateNetworkRequest expectedCreateNetworkRequest = new CreateNetworkRequest(); + + expectedCreateNetworkRequest.setCloudSiteId(cloudRegionPo); + expectedCreateNetworkRequest.setTenantId(cloudRegion.getTenantId()); + expectedCreateNetworkRequest.setNetworkId(l3Network.getNetworkId()); + expectedCreateNetworkRequest.setNetworkName(l3Network.getNetworkName()); + expectedCreateNetworkRequest.setNetworkType(l3Network.getNetworkType()); + expectedCreateNetworkRequest.setBackout(false); + expectedCreateNetworkRequest.setFailIfExists(true); + + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestContext.getMsoRequestId()); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + expectedCreateNetworkRequest.setMsoRequest(msoRequest); + expectedCreateNetworkRequest.setSkipAAI(true); + + Subnet openstackSubnet = new Subnet(); + HostRoute hostRoute = new HostRoute(); + hostRoute.setHostRouteId("hostRouteId"); + hostRoute.setNextHop("nextHop"); + hostRoute.setRoutePrefix("routePrefix"); + openstackSubnet.getHostRoutes().add(hostRoute); + List subnetList = new ArrayList(); + subnetList.add(openstackSubnet); + l3Network.getSubnets().add(openstackSubnet); + + CreateNetworkRequest createNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer); + + assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("contrailNetwork").ignoring("providerVlanNetwork").ignoring("subnets").ignoring("networkParams").ignoring("messageId")); + } + + @Test + public void createNetworkRollbackRequestMapperTest() throws Exception { + + String cloudRegionPo = "cloudRegionPo"; + RollbackNetworkRequest expectedRollbackNetworkRequest = new RollbackNetworkRequest(); + + expectedRollbackNetworkRequest.setMessageId(requestContext.getMsoRequestId()); + NetworkRollback networkRollback = new NetworkRollback(); + networkRollback.setCloudId(cloudRegionPo); + networkRollback.setNetworkCreated(true); + networkRollback.setNetworkId(l3Network.getNetworkId()); + networkRollback.setNetworkType(l3Network.getNetworkType()); + networkRollback.setTenantId(cloudRegion.getTenantId()); + expectedRollbackNetworkRequest.setNetworkRollback(networkRollback); + expectedRollbackNetworkRequest.setSkipAAI(true); + + CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse(); + createNetworkResponse.setNetworkCreated(true); + + RollbackNetworkRequest rollbackNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRollbackRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse); + + assertThat(rollbackNetworkRequest, sameBeanAs(expectedRollbackNetworkRequest).ignoring("contrailNetwork").ignoring("providerVlanNetwork").ignoring("subnets").ignoring("networkParams").ignoring("messageId")); + } + + @Test + public void updateNetworkRequestMapperTest() throws UnsupportedEncodingException { + org.onap.so.openstack.beans.Subnet subnet = new org.onap.so.openstack.beans.Subnet(); + subnet.setSubnetId("subnetId"); + subnet.setHostRoutes(new ArrayList()); + + List subnets = new ArrayList<>(); + subnets.add(subnet); + + ProviderVlanNetwork providerVlanNetwork = new ProviderVlanNetwork("physicalNetworkName", new ArrayList()); + + List policyFqdns = Arrays.asList("networkPolicyFqdn"); + + org.onap.so.openstack.beans.RouteTarget expectedRouteTarget = new org.onap.so.openstack.beans.RouteTarget(); + expectedRouteTarget.setRouteTarget("globalRouteTarget"); + + ContrailNetwork contrailNetwork = new ContrailNetwork(); + contrailNetwork.setPolicyFqdns(policyFqdns); + contrailNetwork.setRouteTableFqdns(new ArrayList()); + contrailNetwork.setRouteTargets(new ArrayList()); + contrailNetwork.getRouteTargets().add(expectedRouteTarget); + contrailNetwork.getRouteTableFqdns().add("routeTableReferenceFqdn"); + + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setServiceInstanceId("testServiceInstanceId1"); + + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + modelInfoNetwork.setNetworkType("networkType"); + modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUuid"); + modelInfoNetwork.setModelVersion("modelVersion"); + + Subnet actualSubnet = new Subnet(); + actualSubnet.setSubnetId("subnetId"); + actualSubnet.setIpVersion("4"); + + RouteTarget routeTarget = new RouteTarget(); + routeTarget.setGlobalRouteTarget("globalRouteTarget"); + + VpnBinding vpnBinding = new VpnBinding(); + vpnBinding.setVpnId("vpnId"); + vpnBinding.getRouteTargets().add(routeTarget); + + Customer customer = new Customer(); + customer.getVpnBindings().add(vpnBinding); + ServiceSubscription serviceSubscription = new ServiceSubscription(); + customer.setServiceSubscription(serviceSubscription); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + NetworkPolicy networkPolicy = new NetworkPolicy(); + networkPolicy.setNetworkPolicyId("networkPolicyId"); + networkPolicy.setNetworkPolicyFqdn("networkPolicyFqdn"); + + RouteTableReference routeTableReference = new RouteTableReference(); + routeTableReference.setRouteTableReferenceFqdn("routeTableReferenceFqdn"); + + l3Network.setModelInfoNetwork(modelInfoNetwork); + l3Network.setPhysicalNetworkName("physicalNetworkName"); + l3Network.getSubnets().add(actualSubnet); + l3Network.getNetworkPolicies().add(networkPolicy); + l3Network.getContrailNetworkRouteTableReferences().add(routeTableReference); + + UpdateNetworkRequest expectedUpdateNetworkRequest = new UpdateNetworkRequest(); + expectedUpdateNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + expectedUpdateNetworkRequest.setTenantId(cloudRegion.getTenantId()); + expectedUpdateNetworkRequest.setNetworkId(l3Network.getNetworkId()); + expectedUpdateNetworkRequest.setNetworkStackId(l3Network.getHeatStackId()); + expectedUpdateNetworkRequest.setNetworkName(l3Network.getNetworkName()); + expectedUpdateNetworkRequest.setNetworkType(l3Network.getModelInfoNetwork().getNetworkType()); + expectedUpdateNetworkRequest.setNetworkTypeVersion(l3Network.getModelInfoNetwork().getModelVersion()); + expectedUpdateNetworkRequest.setModelCustomizationUuid(l3Network.getModelInfoNetwork().getModelCustomizationUUID()); + expectedUpdateNetworkRequest.setSubnets(subnets); + expectedUpdateNetworkRequest.setProviderVlanNetwork(providerVlanNetwork); + expectedUpdateNetworkRequest.setContrailNetwork(contrailNetwork); + expectedUpdateNetworkRequest.setNetworkParams(userInput); + expectedUpdateNetworkRequest.setMsoRequest(msoRequest); + expectedUpdateNetworkRequest.setSkipAAI(true); + expectedUpdateNetworkRequest.setBackout(!Boolean.valueOf(orchestrationContext.getIsRollbackEnabled())); + expectedUpdateNetworkRequest.setMessageId("messageId"); + expectedUpdateNetworkRequest.setNotificationUrl("http://localhost:28080/mso/WorkflowMesssage/NetworkAResponse/messageId"); + + doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid(); + doReturn("http://localhost:28080/mso/WorkflowMesssage").when(SPY_networkAdapterObjectMapper).getEndpoint(); + UpdateNetworkRequest actualUpdateNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkUpdateRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer); + + assertThat(actualUpdateNetworkRequest, sameBeanAs(expectedUpdateNetworkRequest).ignoring("msoRequest.requestId")); + } + + @Test + public void deleteNetworkRequestMapperTest() throws Exception { + DeleteNetworkRequest expectedDeleteNetworkRequest = new DeleteNetworkRequest(); + + String messageId = "messageId"; + expectedDeleteNetworkRequest.setMessageId(messageId); + doReturn(messageId).when(SPY_networkAdapterObjectMapper).getRandomUuid(); + + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + l3Network.setModelInfoNetwork(modelInfoNetwork); + modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUuid"); + expectedDeleteNetworkRequest.setModelCustomizationUuid(modelInfoNetwork.getModelCustomizationUUID()); + + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestContext.getMsoRequestId()); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + expectedDeleteNetworkRequest.setMsoRequest(msoRequest); + + expectedDeleteNetworkRequest.setNetworkId(l3Network.getNetworkId()); + + l3Network.setHeatStackId("heatStackId"); + expectedDeleteNetworkRequest.setNetworkStackId(l3Network.getHeatStackId()); + + expectedDeleteNetworkRequest.setNetworkType(l3Network.getNetworkType()); + + expectedDeleteNetworkRequest.setSkipAAI(true); + + expectedDeleteNetworkRequest.setTenantId(cloudRegion.getTenantId()); + + expectedDeleteNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + + DeleteNetworkRequest deleteNetworkRequest = SPY_networkAdapterObjectMapper.deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network); + + assertThat(expectedDeleteNetworkRequest, sameBeanAs(deleteNetworkRequest)); + } + + @Test + public void buildOpenstackSubnetListTest() throws Exception { + + ObjectMapper omapper = new ObjectMapper(); + String bbJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "generalBB.json"))); + org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock gbb = omapper.readValue( + bbJson, + org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock.class); + L3Network myNetwork = gbb.getServiceInstance().getNetworks().get(0); + + String expectedCreateNetworkRequestJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "createNetworkRequest.json"))); + org.onap.so.adapters.nwrest.CreateNetworkRequest expectedCreateNetworkRequest = omapper.readValue( + expectedCreateNetworkRequestJson, + org.onap.so.adapters.nwrest.CreateNetworkRequest.class); + + String cloudRegionPo = "cloudRegionPo"; + CreateNetworkRequest createNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, myNetwork, userInput, cloudRegionPo, customer); + //ignoring dynamic fields and networkParams that throws parsing exception on json file load + assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("messageId").ignoring("msoRequest.requestId").ignoring("networkParams")); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java new file mode 100644 index 0000000000..85f787faa7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java @@ -0,0 +1,224 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.adapter.vnf; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.junit.Assert.assertEquals; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; +import org.onap.so.adapters.vnfrest.CreateVfModuleResponse; +import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse; +import org.onap.so.adapters.vnfrest.QueryVfModuleResponse; +import org.onap.so.adapters.vnfrest.RollbackVfModuleRequest; +import org.onap.so.adapters.vnfrest.RollbackVfModuleResponse; +import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest; +import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse; +import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse; +import org.onap.so.adapters.vnfrest.VfModuleRollback; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class VnfAdapterClientIT extends BaseTest{ + + private static final String TESTING_ID = "___TESTING___"; + private static final String AAI_VNF_ID = "test"; + private static final String AAI_VF_MODULE_ID = "test"; + private static final String REST_ENDPOINT = "/services/rest/v1/vnfs"; + + private VnfAdapterClientImpl client = new VnfAdapterClientImpl(); + private ObjectMapper mapper = new ObjectMapper(); + + @BeforeClass + public static void setUp() { + System.setProperty("mso.config.path", "src/test/resources"); + } + + @Test + public void createVfModuleTest() throws JsonProcessingException, VnfAdapterClientException { + CreateVfModuleRequest request = new CreateVfModuleRequest(); + request.setCloudSiteId(TESTING_ID); + + CreateVfModuleResponse mockResponse = new CreateVfModuleResponse(); + mockResponse.setVfModuleCreated(true); + stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + CreateVfModuleResponse response = client.createVfModule(AAI_VNF_ID, request); + assertEquals("Testing CreateVfModule response", true, response.getVfModuleCreated()); + } + + @Test(expected = VnfAdapterClientException.class) + public void createVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException { + CreateVfModuleRequest request = new CreateVfModuleRequest(); + request.setCloudSiteId(TESTING_ID); + + VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse(); + mockResponse.setMessage("Error in create Vf module"); + stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.createVfModule(AAI_VNF_ID, request); + } + + @Test + public void rollbackVfModuleTest() throws JsonProcessingException, VnfAdapterClientException { + RollbackVfModuleRequest request = new RollbackVfModuleRequest(); + VfModuleRollback rollback = new VfModuleRollback(); + rollback.setCloudSiteId(TESTING_ID); + request.setVfModuleRollback(rollback); + + RollbackVfModuleResponse mockResponse = new RollbackVfModuleResponse(); + mockResponse.setVfModuleRolledback(true); + stubFor( + post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + RollbackVfModuleResponse response = client.rollbackVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request); + assertEquals("Testing RollbackVfModule response", true, response.getVfModuleRolledback()); + } + + @Test(expected = VnfAdapterClientException.class) + public void rollbackVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException { + RollbackVfModuleRequest request = new RollbackVfModuleRequest(); + VfModuleRollback rollback = new VfModuleRollback(); + rollback.setCloudSiteId(TESTING_ID); + request.setVfModuleRollback(rollback); + + VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse(); + mockResponse.setMessage("Error in rollback Vf module"); + stubFor( + post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.rollbackVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request); + } + + @Test + public void deleteVfModuleTest() throws JsonProcessingException, VnfAdapterClientException { + DeleteVfModuleRequest request = new DeleteVfModuleRequest(); + request.setCloudSiteId(TESTING_ID); + + DeleteVfModuleResponse mockResponse = new DeleteVfModuleResponse(); + mockResponse.setVfModuleDeleted(true); + stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + DeleteVfModuleResponse response = client.deleteVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request); + assertEquals("Testing DeleteVfModule response", true, response.getVfModuleDeleted()); + } + + @Test(expected = VnfAdapterClientException.class) + public void deleteVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException { + DeleteVfModuleRequest request = new DeleteVfModuleRequest(); + request.setCloudSiteId(TESTING_ID); + + VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse(); + mockResponse.setMessage("Error in delete Vf module"); + stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.deleteVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request); + } + + @Test + public void updateVfModuleTest() throws JsonProcessingException, VnfAdapterClientException { + UpdateVfModuleRequest request = new UpdateVfModuleRequest(); + request.setCloudSiteId(TESTING_ID); + request.setVfModuleId("test1"); + + UpdateVfModuleResponse mockResponse = new UpdateVfModuleResponse(); + mockResponse.setVfModuleId("test1"); + stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + UpdateVfModuleResponse response = client.updateVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request); + assertEquals("Testing UpdateVfModule response", "test1", response.getVfModuleId()); + } + + @Test(expected = VnfAdapterClientException.class) + public void updateVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException { + UpdateVfModuleRequest request = new UpdateVfModuleRequest(); + request.setCloudSiteId(TESTING_ID); + request.setVfModuleId("test1"); + + VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse(); + mockResponse.setMessage("Error in update Vf module"); + stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.updateVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request); + } + + @Test + public void queryVfModuleTest() throws JsonProcessingException, VnfAdapterClientException { + QueryVfModuleResponse mockResponse = new QueryVfModuleResponse(); + mockResponse.setVnfId(AAI_VNF_ID); + mockResponse.setVfModuleId(AAI_VF_MODULE_ID); + stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + .withQueryParam("cloudSiteId", equalTo(TESTING_ID)) + .withQueryParam("tenantId", equalTo(TESTING_ID)) + .withQueryParam("vfModuleName", equalTo("someName")) + .withQueryParam("skipAAI", equalTo("true")) + .withQueryParam("msoRequest.requestId", equalTo("testRequestId")) + .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + QueryVfModuleResponse response = client.queryVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, TESTING_ID, TESTING_ID, + "someName", true, "testRequestId", "serviceInstanceId"); + assertEquals("Testing QueryVfModule response", AAI_VF_MODULE_ID, response.getVfModuleId()); + } + + @Test(expected = VnfAdapterClientException.class) + public void queryVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException { + VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse(); + mockResponse.setMessage("Error in update Vf module"); + stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + .withQueryParam("cloudSiteId", equalTo(TESTING_ID)) + .withQueryParam("tenantId", equalTo(TESTING_ID)) + .withQueryParam("vfModuleName", equalTo("someName")) + .withQueryParam("skipAAI", equalTo("true")) + .withQueryParam("msoRequest.requestId", equalTo("testRequestId")) + .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + client.queryVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, TESTING_ID, TESTING_ID, + "someName", true, "testRequestId", "serviceInstanceId"); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java new file mode 100644 index 0000000000..b356b21de4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java @@ -0,0 +1,214 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.adapter.vnf; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import javax.ws.rs.InternalServerErrorException; +import javax.ws.rs.core.UriBuilder; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.MockitoAnnotations; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.BaseTest; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse; +import org.onap.so.client.adapter.rest.AdapterRestClient; + + +@RunWith(MockitoJUnitRunner.class) +public class VnfVolumeAdapterClientIT extends BaseTest{ + + private static final String TESTING_ID = "___TESTING___"; + private static final String AAI_VOLUME_GROUP_ID = "test"; + private static final String CLOUD_SITE_ID = "test"; + private static final String TENANT_ID = "test"; + private static final String VOLUME_GROUP_STACK_ID = "test"; + private static final boolean SKIP_AAI = true; + private static final String REQUEST_ID = "test"; + private static final String SERVICE_INSTANCE_ID = "test"; + + @Test + public void createVolumeGroupTest() throws VnfAdapterClientException { + CreateVolumeGroupRequest request = new CreateVolumeGroupRequest(); + request.setCloudSiteId(TESTING_ID); + + CreateVolumeGroupResponse mockResponse = new CreateVolumeGroupResponse(); + mockResponse.setVolumeGroupCreated(true); + + VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class); + AdapterRestClient mockClient = mock(AdapterRestClient.class); + + doReturn(mockClient).when(client).getAdapterRestClient(""); + when(mockClient.post(request, CreateVolumeGroupResponse.class)).thenReturn(mockResponse); + + CreateVolumeGroupResponse response = client.createVNFVolumes(request); + assertEquals("Testing CreateVolumeGroup response", mockResponse.getVolumeGroupCreated(), + response.getVolumeGroupCreated()); + } + + @Test(expected = VnfAdapterClientException.class) + public void createVolumeGroupTestThrowException() throws VnfAdapterClientException { + CreateVolumeGroupRequest request = new CreateVolumeGroupRequest(); + request.setCloudSiteId(TESTING_ID); + + CreateVolumeGroupResponse mockResponse = new CreateVolumeGroupResponse(); + mockResponse.setVolumeGroupCreated(true); + + VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class); + AdapterRestClient mockClient = mock(AdapterRestClient.class); + + doReturn(mockClient).when(client).getAdapterRestClient(""); + when(mockClient.post(request, CreateVolumeGroupResponse.class)).thenThrow(new InternalServerErrorException("Error in create volume group")); + + client.createVNFVolumes(request); + } + + @Test + public void deleteVolumeGroupTest() throws VnfAdapterClientException { + DeleteVolumeGroupRequest request = new DeleteVolumeGroupRequest(); + request.setCloudSiteId(TESTING_ID); + + DeleteVolumeGroupResponse mockResponse = new DeleteVolumeGroupResponse(); + mockResponse.setVolumeGroupDeleted(true); + + VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class); + AdapterRestClient mockClient = mock(AdapterRestClient.class); + doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID); + when(mockClient.delete(request, DeleteVolumeGroupResponse.class)).thenReturn(mockResponse); + MockitoAnnotations.initMocks(this); + + DeleteVolumeGroupResponse response = client.deleteVNFVolumes(AAI_VOLUME_GROUP_ID, request); + assertEquals("Testing DeleteVolumeGroup response", mockResponse.getVolumeGroupDeleted(), + response.getVolumeGroupDeleted()); + } + + @Test(expected = VnfAdapterClientException.class) + public void deleteVolumeGroupTestThrowException() throws VnfAdapterClientException { + DeleteVolumeGroupRequest request = new DeleteVolumeGroupRequest(); + request.setCloudSiteId(TESTING_ID); + + DeleteVolumeGroupResponse mockResponse = new DeleteVolumeGroupResponse(); + mockResponse.setVolumeGroupDeleted(true); + + VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class); + AdapterRestClient mockClient = mock(AdapterRestClient.class); + doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID); + when(mockClient.delete(request, DeleteVolumeGroupResponse.class)) + .thenThrow(new InternalServerErrorException("Error in delete volume group")); + MockitoAnnotations.initMocks(this); + + client.deleteVNFVolumes(AAI_VOLUME_GROUP_ID, request); + } + + @Test + public void rollbackVolumeGroupTest() throws VnfAdapterClientException { + RollbackVolumeGroupRequest request = new RollbackVolumeGroupRequest(); + + RollbackVolumeGroupResponse mockResponse = new RollbackVolumeGroupResponse(); + mockResponse.setVolumeGroupRolledBack(true); + + VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class); + AdapterRestClient mockClient = mock(AdapterRestClient.class); + doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID + "/rollback"); + when(mockClient.delete(request, RollbackVolumeGroupResponse.class)).thenReturn(mockResponse); + MockitoAnnotations.initMocks(this); + + RollbackVolumeGroupResponse response = client.rollbackVNFVolumes(AAI_VOLUME_GROUP_ID, request); + assertEquals("Testing RollbackVolumeGroup response", mockResponse.getVolumeGroupRolledBack(), + response.getVolumeGroupRolledBack()); + } + + @Test(expected = VnfAdapterClientException.class) + public void rollbackVolumeGroupTestThrowException() throws VnfAdapterClientException { + RollbackVolumeGroupRequest request = new RollbackVolumeGroupRequest(); + + RollbackVolumeGroupResponse mockResponse = new RollbackVolumeGroupResponse(); + mockResponse.setVolumeGroupRolledBack(true); + + VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class); + AdapterRestClient mockClient = mock(AdapterRestClient.class); + doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID + "/rollback"); + when(mockClient.delete(request, RollbackVolumeGroupResponse.class)) + .thenThrow(new InternalServerErrorException("Error in rollback volume group")); + MockitoAnnotations.initMocks(this); + + client.rollbackVNFVolumes(AAI_VOLUME_GROUP_ID, request); + } + + @Test + public void updateVolumeGroupTest() throws VnfAdapterClientException { + UpdateVolumeGroupRequest request = new UpdateVolumeGroupRequest(); + + UpdateVolumeGroupResponse mockResponse = new UpdateVolumeGroupResponse(); + mockResponse.setVolumeGroupId(AAI_VOLUME_GROUP_ID); + + VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class); + AdapterRestClient mockClient = mock(AdapterRestClient.class); + doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID); + when(mockClient.put(request, UpdateVolumeGroupResponse.class)).thenReturn(mockResponse); + MockitoAnnotations.initMocks(this); + + UpdateVolumeGroupResponse response = client.updateVNFVolumes(AAI_VOLUME_GROUP_ID, request); + assertEquals("Testing DeleteVfModule response", mockResponse.getVolumeGroupId(), response.getVolumeGroupId()); + } + + @Test(expected = VnfAdapterClientException.class) + public void updateVolumeGroupTestThrowException() throws VnfAdapterClientException { + UpdateVolumeGroupRequest request = new UpdateVolumeGroupRequest(); + + UpdateVolumeGroupResponse mockResponse = new UpdateVolumeGroupResponse(); + mockResponse.setVolumeGroupId(AAI_VOLUME_GROUP_ID); + + VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class); + AdapterRestClient mockClient = mock(AdapterRestClient.class); + doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID); + when(mockClient.put(request, UpdateVolumeGroupResponse.class)) + .thenThrow(new InternalServerErrorException("Error in update volume group")); + MockitoAnnotations.initMocks(this); + + client.updateVNFVolumes(AAI_VOLUME_GROUP_ID, request); + } + + public void buildQueryPathTest() { + String expectedOutput = "/" + AAI_VOLUME_GROUP_ID + "?cloudSiteId=" + CLOUD_SITE_ID + "&tenantId=" + TENANT_ID + + "&volumeGroupStackId=" + VOLUME_GROUP_STACK_ID + "&skipAAI=" + SKIP_AAI + "&msoRequest.requestId=" + + REQUEST_ID + "&msoRequest.serviceInstanceId=" + SERVICE_INSTANCE_ID; + VnfVolumeAdapterClientImpl client = new VnfVolumeAdapterClientImpl(); + assertEquals("Test build query path", expectedOutput, client.buildQueryPath(AAI_VOLUME_GROUP_ID, CLOUD_SITE_ID, + TENANT_ID, VOLUME_GROUP_STACK_ID, SKIP_AAI, REQUEST_ID, SERVICE_INSTANCE_ID)); + } + + protected UriBuilder getUri(String path) { + return UriBuilder.fromPath(path); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestPropertiesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestPropertiesTest.java new file mode 100644 index 0000000000..df48596893 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestPropertiesTest.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.client.adapter.vnf; + +import static org.junit.Assert.assertEquals; + +import java.net.MalformedURLException; + +import org.junit.Test; + +public class VnfVolumeAdapterRestPropertiesTest{ + private VnfVolumeAdapterRestProperties props = new VnfVolumeAdapterRestProperties(); + + @Test + public void testGetAuth(){ + assertEquals("mso.adapters.po.auth", VnfVolumeAdapterRestProperties.authProp); + } + + @Test + public void testGetKey(){ + assertEquals("mso.msoKey", VnfVolumeAdapterRestProperties.keyProp); + } + + @Test + public void testGetUrl() throws MalformedURLException{ + assertEquals("mso.adapters.volume-groups.rest.endpoint", VnfVolumeAdapterRestProperties.endpointProp); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java new file mode 100644 index 0000000000..25149aea13 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java @@ -0,0 +1,372 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.adapter.vnf.mapper; + +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.reset; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.MockitoAnnotations; +import org.mockito.Spy; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.entity.MsoRequest; + +public class VnfAdapterObjectMapperTest { + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; + + @Spy + private VnfAdapterObjectMapper vnfAdapterObjectMapper = new VnfAdapterObjectMapper(); + + @Before + public void before() { + MockitoAnnotations.initMocks(this); + + } + + @After + public void after() { + reset(vnfAdapterObjectMapper); + } + + @Test + public void test_createVolumeGroupRequestMapper() throws Exception { + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId("msoRequestId"); + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelVersion("modelVersion"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId("vnfId"); + genericVnf.setVnfName("vnfName"); + genericVnf.setVnfType("vnfType"); + serviceInstance.getVnfs().add(genericVnf); + + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelName("modelName"); + modelInfoVfModule.setModelCustomizationUUID("modelCustomizationUUID"); + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + volumeGroup.setVolumeGroupName("volumeGroupName"); + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + volumeGroup.setModelInfoVfModule(modelInfoVfModule); + + serviceInstance.getVnfs().get(0).getVolumeGroups().add(volumeGroup); + + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("lcpCloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + CreateVolumeGroupRequest expectedCreateVolumeGroupRequest = new CreateVolumeGroupRequest(); + + expectedCreateVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + expectedCreateVolumeGroupRequest.setTenantId(cloudRegion.getTenantId()); + expectedCreateVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId()); + expectedCreateVolumeGroupRequest.setVolumeGroupName(volumeGroup.getVolumeGroupName()); + expectedCreateVolumeGroupRequest.setVnfType(genericVnf.getVnfType()); + expectedCreateVolumeGroupRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion()); + expectedCreateVolumeGroupRequest.setVfModuleType(volumeGroup.getModelInfoVfModule().getModelName()); + expectedCreateVolumeGroupRequest.setModelCustomizationUuid(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID()); + + Map volumeGroupParams = new HashMap<>(); + volumeGroupParams.put("vnf_id", genericVnf.getVnfId()); + volumeGroupParams.put("vnf_name", genericVnf.getVnfName()); + volumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId()); + volumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName()); + volumeGroupParams.put("paramOne", "paramOneValue"); + volumeGroupParams.put("paramTwo", "paramTwoValue"); + volumeGroupParams.put("paramThree", "paramThreeValue"); + expectedCreateVolumeGroupRequest.setVolumeGroupParams(volumeGroupParams); + + expectedCreateVolumeGroupRequest.setSkipAAI(true); + expectedCreateVolumeGroupRequest.setSuppressBackout(orchestrationContext.getIsRollbackEnabled()); + expectedCreateVolumeGroupRequest.setFailIfExists(true); + + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestContext.getMsoRequestId()); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + expectedCreateVolumeGroupRequest.setMsoRequest(msoRequest); + + expectedCreateVolumeGroupRequest.setMessageId("messageId"); + expectedCreateVolumeGroupRequest.setNotificationUrl("endpoint/VNFAResponse/messageId"); + + doReturn("endpoint/").when(vnfAdapterObjectMapper).getProperty(isA(String.class)); + doReturn("messageId").when(vnfAdapterObjectMapper).getRandomUuid(); + + CreateVolumeGroupRequest actualCreateVolumeGroupRequest = vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse); + + assertThat(actualCreateVolumeGroupRequest, sameBeanAs(expectedCreateVolumeGroupRequest)); + } + + @Test + public void test_createVolumeGroupRequestMapper_for_alaCarte_flow() throws Exception { + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId("msoRequestId"); + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelVersion("modelVersion"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId("vnfId"); + genericVnf.setVnfName("vnfName"); + genericVnf.setVnfType("vnfType"); + serviceInstance.getVnfs().add(genericVnf); + + + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelName("modelName"); + modelInfoVfModule.setModelCustomizationUUID("modelCustomizationUUID"); + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + volumeGroup.setVolumeGroupName("volumeGroupName"); + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + volumeGroup.setModelInfoVfModule(modelInfoVfModule); + serviceInstance.getVnfs().get(0).getVolumeGroups().add(volumeGroup); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("lcpCloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + CreateVolumeGroupRequest expectedCreateVolumeGroupRequest = new CreateVolumeGroupRequest(); + + expectedCreateVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + expectedCreateVolumeGroupRequest.setTenantId(cloudRegion.getTenantId()); + expectedCreateVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId()); + expectedCreateVolumeGroupRequest.setVolumeGroupName(volumeGroup.getVolumeGroupName()); + expectedCreateVolumeGroupRequest.setVnfType(genericVnf.getVnfType()); + expectedCreateVolumeGroupRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion()); + expectedCreateVolumeGroupRequest.setVfModuleType(volumeGroup.getModelInfoVfModule().getModelName()); + expectedCreateVolumeGroupRequest.setModelCustomizationUuid(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID()); + + Map volumeGroupParams = new HashMap<>(); + volumeGroupParams.put("vnf_id", genericVnf.getVnfId()); + volumeGroupParams.put("vnf_name", genericVnf.getVnfName()); + volumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId()); + volumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName()); + + expectedCreateVolumeGroupRequest.setVolumeGroupParams(volumeGroupParams); + + expectedCreateVolumeGroupRequest.setSkipAAI(true); + expectedCreateVolumeGroupRequest.setSuppressBackout(orchestrationContext.getIsRollbackEnabled()); + expectedCreateVolumeGroupRequest.setFailIfExists(true); + + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestContext.getMsoRequestId()); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + expectedCreateVolumeGroupRequest.setMsoRequest(msoRequest); + + expectedCreateVolumeGroupRequest.setMessageId("messageId"); + expectedCreateVolumeGroupRequest.setNotificationUrl("endpoint/VNFAResponse/messageId"); + + doReturn("endpoint/").when(vnfAdapterObjectMapper).getProperty(isA(String.class)); + doReturn("messageId").when(vnfAdapterObjectMapper).getRandomUuid(); + + CreateVolumeGroupRequest actualCreateVolumeGroupRequest = vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, null); + + assertThat(actualCreateVolumeGroupRequest, sameBeanAs(expectedCreateVolumeGroupRequest)); + } + + @Test + public void test_deleteVolumeGroupRequestMapper() throws Exception { + DeleteVolumeGroupRequest expectedDeleteVolumeGroupRequest = new DeleteVolumeGroupRequest(); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("lcpCloudRegionId"); + expectedDeleteVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + + cloudRegion.setTenantId("tenantId"); + expectedDeleteVolumeGroupRequest.setTenantId(cloudRegion.getTenantId()); + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + expectedDeleteVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId()); + + volumeGroup.setHeatStackId("heatStackId"); + expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId()); + + expectedDeleteVolumeGroupRequest.setSkipAAI(true); + + MsoRequest msoRequest = new MsoRequest(); + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId("msoRequestId"); + msoRequest.setRequestId(requestContext.getMsoRequestId()); + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + expectedDeleteVolumeGroupRequest.setMsoRequest(msoRequest); + + String messageId = "messageId"; + String endpoint = "endpoint"; + doReturn(messageId).when(vnfAdapterObjectMapper).getRandomUuid(); + doReturn(endpoint).when(vnfAdapterObjectMapper).getProperty(isA(String.class)); + expectedDeleteVolumeGroupRequest.setMessageId(messageId); + expectedDeleteVolumeGroupRequest.setNotificationUrl(endpoint + "/VNFAResponse/" + messageId); + + DeleteVolumeGroupRequest actualDeleteVolumeGroupRequest = vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup); + + assertThat(actualDeleteVolumeGroupRequest, sameBeanAs(expectedDeleteVolumeGroupRequest)); + } + + @Test + public void test_createVolumeGroupParams() throws Exception { + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId("vnfId"); + genericVnf.setVnfName("vnfName"); + + RequestContext requestContext = new RequestContext(); + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + volumeGroup.setVolumeGroupName("volumeGroupName"); + + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + Map expectedVolumeGroupParams = new HashMap<>(); + expectedVolumeGroupParams.put("vnf_id", genericVnf.getVnfId()); + expectedVolumeGroupParams.put("vnf_name", genericVnf.getVnfName()); + expectedVolumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId()); + expectedVolumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName()); + expectedVolumeGroupParams.put("paramOne", "paramOneValue"); + expectedVolumeGroupParams.put("paramTwo", "paramTwoValue"); + expectedVolumeGroupParams.put("paramThree", "paramThreeValue"); + + Map actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse); + + assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams); + } + + @Test + public void test_createVolumeGroupParams_without_sdncResponse() throws Exception { + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId("vnfId"); + genericVnf.setVnfName("vnfName"); + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + volumeGroup.setVolumeGroupName("volumeGroupName"); + + Map expectedVolumeGroupParams = new HashMap<>(); + expectedVolumeGroupParams.put("vnf_id", genericVnf.getVnfId()); + expectedVolumeGroupParams.put("vnf_name", genericVnf.getVnfName()); + expectedVolumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId()); + expectedVolumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName()); + RequestContext requestContext = new RequestContext(); + Map actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, null); + + assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams); + } + + @Test + public void test_createVolumeGroupParams_with_user_params() throws Exception { + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId("vnfId"); + genericVnf.setVnfName("vnfName"); + + RequestContext requestContext = new RequestContext(); + Map userParamsMap = new HashMap<>(); + userParamsMap.put("name", "userParamKey"); + userParamsMap.put("value", "userParamValue"); + List> userParams = new ArrayList<>(); + userParams.add(userParamsMap); + RequestParameters requestParameters = new RequestParameters(); + requestParameters.setUserParams(userParams); + requestContext.setRequestParameters(requestParameters); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + volumeGroup.setVolumeGroupName("volumeGroupName"); + + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + Map expectedVolumeGroupParams = new HashMap<>(); + expectedVolumeGroupParams.put("vnf_id", genericVnf.getVnfId()); + expectedVolumeGroupParams.put("vnf_name", genericVnf.getVnfName()); + expectedVolumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId()); + expectedVolumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName()); + expectedVolumeGroupParams.put("paramOne", "paramOneValue"); + expectedVolumeGroupParams.put("paramTwo", "paramTwoValue"); + expectedVolumeGroupParams.put("paramThree", "paramThreeValue"); + expectedVolumeGroupParams.put("userParamKey", "userParamValue"); + + Map actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse); + + assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams); + } + + @Test + public void test_createMsoRequest() { + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId("msoRequestId"); + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + + MsoRequest expectedMsoRequest = new MsoRequest(); + expectedMsoRequest.setRequestId(requestContext.getMsoRequestId()); + expectedMsoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + + MsoRequest actualMsoRequest = vnfAdapterObjectMapper.createMsoRequest(requestContext, serviceInstance); + + assertThat(expectedMsoRequest, sameBeanAs(actualMsoRequest)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java new file mode 100644 index 0000000000..bbc5e56141 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java @@ -0,0 +1,449 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.adapter.vnf.mapper; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; + +import org.junit.Test; +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; +import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class VnfAdapterVfModuleObjectMapperIntegrationTest { + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; + + @Test + public void createVfModuleRequestMapperTest() throws Exception { + + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + modelInfoServiceInstance.setEnvironmentContext("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + // + RequestContext requestContext = new RequestContext(); + HashMap userParams = new HashMap(); + userParams.put("key1", "value1"); + requestContext.setMsoRequestId("requestId"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.setVnfName("vnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + Integer vfModuleIndex = 1; + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + vfModule.setModuleIndex(vfModuleIndex); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopology.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); + mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequest.json"))); + + ObjectMapper omapper = new ObjectMapper(); + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleRequestMapperWithCloudResourcesTest() throws Exception { + + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + modelInfoServiceInstance.setEnvironmentContext("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + // + RequestContext requestContext = new RequestContext(); + HashMap userParams = new HashMap(); + userParams.put("key1", "value1"); + requestContext.setMsoRequestId("requestId"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.setVnfName("vnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + Integer vfModuleIndex = 1; + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + vfModule.setModuleIndex(vfModuleIndex); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json"))); + + VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); + mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestWithCloudResources.json"))); + + ObjectMapper omapper = new ObjectMapper(); + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleRequestMapperDhcpDisabledTest() throws Exception { + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + modelInfoServiceInstance.setEnvironmentContext("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + + RequestContext requestContext = new RequestContext(); + HashMap userParams = new HashMap(); + userParams.put("key1", "value1"); + requestContext.setMsoRequestId("requestId"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.setVnfName("vnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + Integer vfModuleIndex = 1; + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + vfModule.setModuleIndex(vfModuleIndex); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); + mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestDhcpDisabled.json"))); + + ObjectMapper omapper = new ObjectMapper(); + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleRequestMapperMultipleDhcpTest() throws Exception { + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + modelInfoServiceInstance.setEnvironmentContext("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + RequestContext requestContext = new RequestContext(); + HashMap userParams = new HashMap(); + userParams.put("key1", "value1"); + requestContext.setMsoRequestId("requestId"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.setVnfName("vnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + Integer vfModuleIndex = 1; + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + vfModule.setModuleIndex(vfModuleIndex); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); + mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestMultipleDhcp.json"))); + + ObjectMapper omapper = new ObjectMapper(); + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void DeleteVfModuleRequestMapperTest() throws Exception { + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + modelInfoServiceInstance.setEnvironmentContext("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + // + RequestContext requestContext = new RequestContext(); + HashMap userParams = new HashMap(); + userParams.put("key1", "value1"); + requestContext.setMsoRequestId("requestId"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.setVnfName("vnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); + mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); + + DeleteVfModuleRequest vfModuleVNFAdapterRequest = mapper.deleteVfModuleRequestMapper( + requestContext, cloudRegion, serviceInstance, + vnf, vfModule); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterDeleteVfModuleRequest.json"))); + + ObjectMapper omapper = new ObjectMapper(); + DeleteVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + DeleteVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java new file mode 100644 index 0000000000..c8f4a222f3 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java @@ -0,0 +1,67 @@ +/*- + * ============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.client.adapter.vnf.mapper; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +public class VnfAdapterVfModuleObjectMapperTest{ + + private VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); + + @Test + public void createVnfcSubInterfaceKeyTest() { + + assertEquals("type_0_subint_role_port_0", mapper.createVnfcSubInterfaceKey("type", 0, "role", 0)); + } + + @Test + public void createGlobalVnfcSubInterfaceKeyTest() { + + assertEquals("type_subint_role_port_0", mapper.createGlobalVnfcSubInterfaceKey("type", "role", 0)); + } + + @Test + public void addPairToMapTest() { + Map map = new HashMap<>(); + + mapper.addPairToMap(map, "test", "_key", Arrays.asList("a", "b")); + + assertEquals("a,b", map.get("test_key")); + + mapper.addPairToMap(map, "test", "_key2", Arrays.asList()); + + assertThat(map.containsKey("test_key2"), equalTo(false)); + + mapper.addPairToMap(map, "test", "_key3", "myVal"); + + assertEquals("myVal", map.get("test_key3")); + + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java new file mode 100644 index 0000000000..fff4fc72fb --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +@RunWith(MockitoJUnitRunner.class) +public class AAICollectionResourcesTest extends TestDataSetup{ + + @InjectMocks + private AAICollectionResources aaiCollectionResources = new AAICollectionResources(); + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + private Collection networkCollection; + + @Before + public void before() { + networkCollection = buildCollection(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + @Test + public void createCollectionTest() throws Exception { + networkCollection.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + doReturn(new org.onap.aai.domain.yang.Collection()).when(MOCK_aaiObjectMapper).mapCollection(networkCollection); + + aaiCollectionResources.createCollection(networkCollection); + + assertEquals(OrchestrationStatus.INVENTORIED, networkCollection.getOrchestrationStatus()); + verify(MOCK_aaiResourcesClient, times(1)).create(eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())), isA(org.onap.aai.domain.yang.Collection.class)); + } + + @Test + public void updateCollectionTest() throws Exception { + doReturn(new org.onap.aai.domain.yang.Collection()).when(MOCK_aaiObjectMapper).mapCollection(networkCollection); + aaiCollectionResources.updateCollection(networkCollection); + verify(MOCK_aaiResourcesClient, times(1)).update(eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())), isA(org.onap.aai.domain.yang.Collection.class)); + } + + @Test + public void deleteCollectionTest() throws Exception { + aaiCollectionResources.deleteCollection(networkCollection); + verify(MOCK_aaiResourcesClient, times(1)).delete(eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId()))); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java new file mode 100644 index 0000000000..cc48c46508 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java @@ -0,0 +1,180 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.bpmn.common.data.TestDataSetup; + + +@RunWith(MockitoJUnitRunner.class) +public class AAIConfigurationResourcesTest extends TestDataSetup{ + + + + private Configuration configuration; + private ServiceProxy serviceProxy; + private ServiceInstance serviceInstance; + private GenericVnf genericVnf; + private VpnBinding vpnBinding; + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @InjectMocks + private AAIConfigurationResources aaiConfigurationResources = new AAIConfigurationResources(); + + @Before + public void before() { + configuration = buildConfiguration(); + serviceProxy = buildServiceProxy(); + serviceInstance = buildServiceInstance(); + genericVnf = buildGenericVnf(); + vpnBinding = buildVpnBinding(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + @Test + public void createConfigurationTest() { + doReturn(new org.onap.aai.domain.yang.Configuration()).when(MOCK_aaiObjectMapper).mapConfiguration(configuration); + doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class)); + + aaiConfigurationResources.createConfiguration(configuration); + + assertEquals(OrchestrationStatus.INVENTORIED, configuration.getOrchestrationStatus()); + verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class)); + } + + @Test + public void updateConfigurationTest() { + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class)); + configuration.setConfigurationType("VNR"); + configuration.setOrchestrationStatus(OrchestrationStatus.ACTIVE); + aaiConfigurationResources.updateConfiguration(configuration); + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Configuration.class)); + } + + @Test + public void connectConfigurationToServiceInstanceTest() { + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + aaiConfigurationResources.connectConfigurationToServiceInstance(configuration.getConfigurationId(), serviceInstance.getServiceInstanceId()); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void disconnectConfigurationToServiceInstanceTest(){ + doNothing().when(MOCK_aaiResourcesClient).disconnect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + aaiConfigurationResources.disconnectConfigurationToServiceInstance("TEST_CONFIGURATION_ID", "TEST_SERVICE_INSTANCE_ID"); + verify(MOCK_aaiResourcesClient, times(1)).disconnect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void connectConfigurationToGenericVnfTest() { + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + aaiConfigurationResources.connectConfigurationToGenericVnf(configuration.getConfigurationId(), genericVnf.getVnfId()); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void connectConfigurationToVpnBindingTest() { + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + aaiConfigurationResources.connectConfigurationToVpnBinding(configuration.getConfigurationId(), vpnBinding.getVpnId()); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void getConfigurationFromRelatedLinkTest () { + Optional configuration = Optional.of(new org.onap.aai.domain.yang.Configuration()); + configuration.get().setConfigurationId("config1"); + doReturn(configuration).when(MOCK_aaiResourcesClient).get(eq(org.onap.aai.domain.yang.Configuration.class),isA(AAIResourceUri.class)); + aaiConfigurationResources.getConfigurationFromRelatedLink("http://localhost:8090/aai/v12/network/configurations/configuration/config1"); + verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.Configuration.class),isA(AAIResourceUri.class)); + } + + @Test + public void connectVrfConfigurationToVnrConfigurationTest() throws Exception { + Configuration vrfConfiguration = buildConfiguration(); + Configuration vnrConfiguration = buildConfiguration(); + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + aaiConfigurationResources.connectVrfConfigurationToVnrConfiguration(vrfConfiguration.getConfigurationId(),vnrConfiguration.getConfigurationId()); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void connectConfigurationToPnfObjectTest() throws Exception { + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + + Pnf primaryPnf = serviceProxy.getServiceInstance().getPnfs().stream().filter(o -> o.getRole().equals("Primary")).findFirst().get(); + + aaiConfigurationResources.connectConfigurationToPnfObject(primaryPnf.getPnfId(), configuration.getConfigurationId()); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void getConfigurationTest() { + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId"); + doReturn(Optional.of(new org.onap.aai.domain.yang.Configuration())).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri); + aaiConfigurationResources.getConfiguration("configurationId"); + verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri); + } + + @Test + public void deleteConfigurationTest() { + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId"); + doNothing().when(MOCK_aaiResourcesClient).delete(aaiResourceUri); + aaiConfigurationResources.deleteConfiguration("configurationId"); + verify(MOCK_aaiResourcesClient, times(1)).delete(aaiResourceUri); + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java new file mode 100644 index 0000000000..aef25e5ded --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.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.client.orchestration; + +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +@RunWith(MockitoJUnitRunner.class) +public class AAIInstanceGroupResourcesTest extends TestDataSetup{ + + @InjectMocks + private AAIInstanceGroupResources aaiInstanceGroupResources = new AAIInstanceGroupResources(); + + private InstanceGroup instanceGroup; + private GenericVnf vnf; + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @Before + public void before() { + instanceGroup = buildInstanceGroup(); + vnf = buildGenericVnf(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + @Test + public void createInstanceGroupTest() throws Exception { + doReturn(new org.onap.aai.domain.yang.InstanceGroup()).when(MOCK_aaiObjectMapper).mapInstanceGroup(instanceGroup); + aaiInstanceGroupResources.createInstanceGroup(instanceGroup); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())), isA(Optional.class)); + } + + @Test + public void deleteInstanceGroupTest() throws Exception { + aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup); + verify(MOCK_aaiResourcesClient, times(1)).delete(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()))); + } + + @Test + public void connectInstanceGroupTest() throws Exception { + aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf); + verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())), eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()))); + } + + @Test + public void existsTest() throws Exception { + aaiInstanceGroupResources.exists(instanceGroup); + verify(MOCK_aaiResourcesClient, times(1)).exists(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()))); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java new file mode 100644 index 0000000000..fa3324840c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java @@ -0,0 +1,317 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.aai.domain.yang.NetworkPolicy; +import org.onap.aai.domain.yang.RouteTableReference; +import org.onap.aai.domain.yang.VpnBinding; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +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.Relationships; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +@RunWith(MockitoJUnitRunner.class) +public class AAINetworkResourcesTest extends TestDataSetup{ + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; + + private L3Network network; + private Collection collection; + private InstanceGroup instanceGroup; + private ServiceInstance serviceInstance; + private CloudRegion cloudRegion; + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @InjectMocks + private AAINetworkResources aaiNetworkResources = new AAINetworkResources(); + + @Before + public void before() { + network = buildL3Network(); + + collection = buildCollection(); + + List l3NetworkList = new ArrayList(); + l3NetworkList.add(network); + + instanceGroup = buildInstanceGroup(); + + serviceInstance = buildServiceInstance(); + + cloudRegion = buildCloudRegion(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + + @Test + public void updateNetworkTest() throws Exception { + + network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doReturn(new org.onap.aai.domain.yang.L3Network()).when(MOCK_aaiObjectMapper).mapNetwork(network); + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.L3Network.class)); + + aaiNetworkResources.updateNetwork(network); + + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.L3Network.class)); + assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus()); + } + + @Test + public void createNetworkConnectToServiceInstanceTest() throws Exception { + + network.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + doReturn(new org.onap.aai.domain.yang.L3Network()).when(MOCK_aaiObjectMapper).mapNetwork(network); + doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), any(AAIResourceUri.class)); + + aaiNetworkResources.createNetworkConnectToServiceInstance(network, serviceInstance); + + assertEquals(OrchestrationStatus.INVENTORIED, network.getOrchestrationStatus()); + + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void deleteNetworkTest() throws Exception { + + network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + + doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class)); + + aaiNetworkResources.deleteNetwork(network); + + verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); + } + + @Test + public void getVpnBindingTest() throws Exception { + final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiVpnBinding.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); + Optional oVpnBinding = Optional.empty(); + AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, "ModelInvariantUUID", "serviceModelVersionId"); + + doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); + oVpnBinding = aaiNetworkResources.getVpnBinding(aaiUri); + verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class)); + + if (oVpnBinding.isPresent()) { + VpnBinding vpnBinding = oVpnBinding.get(); + assertThat(aaiResultWrapper.asBean(VpnBinding.class).get(), sameBeanAs(vpnBinding)); + } + } + + @Test + public void getNetworkPolicyTest() throws Exception { + final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPolicy.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); + Optional oNetPolicy = Optional.empty(); + AAIResourceUri netPolicyUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "ModelInvariantUUID", "serviceModelVersionId"); + + doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); + oNetPolicy = aaiNetworkResources.getNetworkPolicy(netPolicyUri); + verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class)); + + if (oNetPolicy.isPresent()) { + NetworkPolicy networkPolicy = oNetPolicy.get(); + assertThat(aaiResultWrapper.asBean(NetworkPolicy.class).get(), sameBeanAs(networkPolicy)); + } + } + + @Test + public void getRouteTableTest() throws Exception { + final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkTableRefs.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); + Optional oRtref = Optional.empty(); + AAIResourceUri rTRefUri = AAIUriFactory.createResourceUri(AAIObjectType.ROUTE_TABLE_REFERENCE, "ModelInvariantUUID", "serviceModelVersionId"); + + doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); + oRtref = aaiNetworkResources.getRouteTable(rTRefUri); + verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class)); + + if (oRtref.isPresent()) { + RouteTableReference rTref = oRtref.get(); + assertThat(aaiResultWrapper.asBean(RouteTableReference.class).get(), sameBeanAs(rTref)); + } + } + + @Test + public void queryNetworkByIdTest() throws Exception { + final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiQueryAAIResponse-Wrapper.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); + L3Network network = new L3Network(); + network.setNetworkId("0384d743-f69b-4cc8-9aa8-c3ae66662c44"); + network.setNetworkName("Dev_Bindings_1802_020118"); + network.setOrchestrationStatus(OrchestrationStatus.CREATED); + + doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); + Optional l3NetworkOpt = aaiNetworkResources.queryNetworkById(network); + org.onap.aai.domain.yang.L3Network l3Network = l3NetworkOpt.isPresent() ? l3NetworkOpt.get() : null; + + verify(MOCK_aaiResourcesClient, times(1)).get(isA(AAIResourceUri.class)); + assertNotNull(l3Network); + assertEquals("0384d743-f69b-4cc8-9aa8-c3ae66662c44", l3Network.getNetworkId()); + assertEquals("Dev_Bindings_1802_020118", l3Network.getNetworkName()); + } + + @Test + public void queryNetworkWrapperByIdTest() throws Exception { + final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiQueryAAIResponse-Wrapper.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); + L3Network network = new L3Network(); + network.setNetworkId("0384d743-f69b-4cc8-9aa8-c3ae66662c44"); + network.setNetworkName("Dev_Bindings_1802_020118"); + network.setOrchestrationStatus(OrchestrationStatus.CREATED); + + doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); + AAIResultWrapper result = aaiNetworkResources.queryNetworkWrapperById(network); + + verify(MOCK_aaiResourcesClient, times(1)).get(isA(AAIResourceUri.class)); + assertEquals(aaiResultWrapper.getJson(), result.getJson()); + assertNotNull(result); + Optional resultNetworkRelationships = result.getRelationships(); + assertTrue(resultNetworkRelationships.isPresent()); + Optional aaiL3Network = result.asBean(org.onap.aai.domain.yang.L3Network.class); + assertEquals(network.getNetworkId(),aaiL3Network.get().getNetworkId()); + assertEquals(network.getNetworkName(),aaiL3Network.get().getNetworkName()); + + + } + + @Test + public void createNetworkCollectionTest() throws Exception { + + doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Collection.class)); + doReturn(new org.onap.aai.domain.yang.Collection()).when(MOCK_aaiObjectMapper).mapCollection(collection); + collection.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + aaiNetworkResources.createNetworkCollection(collection); + assertEquals(OrchestrationStatus.INVENTORIED, collection.getOrchestrationStatus()); + verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Collection.class)); + } + + @Test + public void createNetworkInstanceGroupTest() throws Exception { + doReturn(new org.onap.aai.domain.yang.InstanceGroup()).when(MOCK_aaiObjectMapper).mapInstanceGroup(instanceGroup); + doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.InstanceGroup.class)); + aaiNetworkResources.createNetworkInstanceGroup(instanceGroup); + verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.InstanceGroup.class)); + } + + @Test + public void connectNetworkToNetworkCollectionInstanceGroupTest() throws Exception { + aaiNetworkResources.connectNetworkToNetworkCollectionInstanceGroup(network, instanceGroup); + verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())), eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()))); + } + + @Test + public void connectNetworkToNetworkCollectionServiceInstanceTest() throws Exception { + aaiNetworkResources.connectNetworkToNetworkCollectionServiceInstance(network, serviceInstance); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()))); + } + + @Test + public void connectNetworkToCloudRegionTest() throws Exception { + aaiNetworkResources.connectNetworkToCloudRegion(network, cloudRegion); + verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, + cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())), eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()))); + } + + @Test + public void connectNetworkToTenantTest() throws Exception { + aaiNetworkResources.connectNetworkToTenant(network, cloudRegion); + verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.TENANT, + cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId())), + eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()))); + } + + @Test + public void connectNetworkCollectionInstanceGroupToNetworkCollectionTest() throws Exception { + aaiNetworkResources.connectNetworkCollectionInstanceGroupToNetworkCollection(instanceGroup, collection); + verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId())), eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()))); + } + + @Test + public void connectNetworkCollectionToServiceInstanceTest() throws Exception { + aaiNetworkResources.connectNetworkCollectionToServiceInstance(collection, serviceInstance); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void deleteCollectionTest() throws Exception { + doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class)); + aaiNetworkResources.deleteCollection(collection); + verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); + } + + @Test + public void deleteInstanceGroupTest() throws Exception { + doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class)); + aaiNetworkResources.deleteNetworkInstanceGroup(instanceGroup); + verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java new file mode 100644 index 0000000000..46d4135b6d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java @@ -0,0 +1,181 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +@RunWith(MockitoJUnitRunner.class) +public class AAIServiceInstanceResourcesTest extends TestDataSetup{ + + @InjectMocks + private AAIServiceInstanceResources aaiServiceInstanceResources = new AAIServiceInstanceResources(); + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + private ServiceInstance serviceInstance; + private ServiceSubscription serviceSubscription; + private Customer customer; + private Project project; + private OwningEntity owningEntity; + + @Before + public void before() { + serviceInstance = buildServiceInstance(); + serviceSubscription = buildServiceSubscription(); + customer = buildCustomer(); + project = buildProject(); + owningEntity = buildOwningEntity(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + @Test + public void deleteServiceInstanceSuccessTest() throws Exception { + aaiServiceInstanceResources.deleteServiceInstance(serviceInstance); + verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); + } + + @Test + public void deleteServiceInstanceExceptionTest() throws Exception { + expectedException.expect(Exception.class); + doThrow(Exception.class).when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class)); + aaiServiceInstanceResources.deleteServiceInstance(serviceInstance); + } + + @Test + public void existsServiceInstanceTest() { + aaiServiceInstanceResources.existsServiceInstance(serviceInstance); + verify(MOCK_aaiResourcesClient, times(1)).exists(any(AAIResourceUri.class)); + } + + @Test + public void createServiceSubscriptionTest() { + serviceSubscription.setServiceType("IP-FLEX"); + customer.setServiceSubscription(serviceSubscription); + doReturn(new org.onap.aai.domain.yang.ServiceSubscription()).when(MOCK_aaiObjectMapper).mapServiceSubscription(customer.getServiceSubscription()); + aaiServiceInstanceResources.createServiceSubscription(customer); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + } + + @Test + public void createServiceInstanceTest() { + serviceSubscription.setServiceType("testSubscriberType"); + customer.setServiceSubscription(serviceSubscription); + doReturn(new org.onap.aai.domain.yang.ServiceInstance()).when(MOCK_aaiObjectMapper).mapServiceInstance(serviceInstance); + serviceInstance.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + aaiServiceInstanceResources.createServiceInstance(serviceInstance, customer); + + assertEquals(OrchestrationStatus.INVENTORIED, serviceInstance.getOrchestrationStatus()); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + } + + @Test + public void createProjectTest() { + doReturn(new org.onap.aai.domain.yang.Project()).when(MOCK_aaiObjectMapper).mapProject(project); + aaiServiceInstanceResources.createProject(project); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + } + + @Test + public void createProjectandConnectServiceInstanceTest() { + doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + doNothing().when(MOCK_aaiResourcesClient).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + doReturn(new org.onap.aai.domain.yang.Project()).when(MOCK_aaiObjectMapper).mapProject(project); + aaiServiceInstanceResources.createProjectandConnectServiceInstance(project, serviceInstance); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void createOwningEntityTest() { + doReturn(new org.onap.aai.domain.yang.OwningEntity()).when(MOCK_aaiObjectMapper).mapOwningEntity(owningEntity); + aaiServiceInstanceResources.createOwningEntity(owningEntity); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + } + + @Test + public void existsOwningEntityTest() { + aaiServiceInstanceResources.existsOwningEntity(owningEntity); + verify(MOCK_aaiResourcesClient, times(1)).exists(any(AAIResourceUri.class)); + } + + @Test + public void connectOwningEntityandServiceInstanceTest() { + aaiServiceInstanceResources.connectOwningEntityandServiceInstance(owningEntity, serviceInstance); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void createOwningEntityandConnectServiceInstanceTest() { + doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + doNothing().when(MOCK_aaiResourcesClient).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + doReturn(new org.onap.aai.domain.yang.OwningEntity()).when(MOCK_aaiObjectMapper).mapOwningEntity(owningEntity); + aaiServiceInstanceResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void updateOrchestrationStatusServiceInstanceTest() { + aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE); + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.ServiceInstance.class)); + } + + @Test + public void test_updateServiceInstance() { + aaiServiceInstanceResources.updateServiceInstance(serviceInstance); + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.ServiceInstance.class)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java new file mode 100644 index 0000000000..0c4c8fc443 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java @@ -0,0 +1,127 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +@RunWith(MockitoJUnitRunner.class) +public class AAIVfModuleResourcesTest extends TestDataSetup{ + @InjectMocks + private AAIVfModuleResources aaiVfModuleResources = new AAIVfModuleResources(); + + private VfModule vfModule; + private GenericVnf vnf; + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @Before + public void before() { + vfModule = buildVfModule(); + vnf = buildGenericVnf(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + @Test + public void updateOrchestrationStatusVfModuleTest() throws Exception { + vfModule.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VfModule.class)); + + aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE); + + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.VfModule.class)); + + assertEquals(OrchestrationStatus.ACTIVE, vfModule.getOrchestrationStatus()); + } + + @Test + public void createVfModuleTest() throws Exception { + vfModule.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + doReturn(new org.onap.aai.domain.yang.VfModule()).when(MOCK_aaiObjectMapper).mapVfModule(vfModule); + doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class)); + aaiVfModuleResources.createVfModule(vfModule, vnf); + + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + assertEquals(OrchestrationStatus.INVENTORIED, vfModule.getOrchestrationStatus()); + } + + @Test + public void deleteVfModuleTest() throws Exception { + doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class)); + + aaiVfModuleResources.deleteVfModule(vfModule, vnf); + + verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); + } + + @Test + public void changeAssignVfModuleTest() throws Exception { + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VfModule.class)); + + aaiVfModuleResources.changeAssignVfModule(vfModule, vnf); + + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.VfModule.class)); + } + + @Test + public void connectVfModuleToVolumeGroupTest() throws Exception { + VolumeGroup volumeGroup = buildVolumeGroup(); + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + CloudRegion cloudRegion = buildCloudRegion(); + + aaiVfModuleResources.connectVfModuleToVolumeGroup(vnf, vfModule, volumeGroup, cloudRegion); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java new file mode 100644 index 0000000000..db719d3151 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java @@ -0,0 +1,161 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +@RunWith(MockitoJUnitRunner.class) +public class AAIVnfResourcesTest extends TestDataSetup { + + private GenericVnf genericVnf; + + private ServiceInstance serviceInstance; + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @InjectMocks + AAIVnfResources aaiVnfResources = new AAIVnfResources(); + + @Before + public void before() { + serviceInstance = buildServiceInstance(); + genericVnf = buildGenericVnf(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + @Test + public void createVnfandConnectServiceInstanceTest() { + doReturn(new org.onap.aai.domain.yang.GenericVnf()).when(MOCK_aaiObjectMapper).mapVnf(genericVnf); + doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class)); + doNothing().when(MOCK_aaiResourcesClient).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + genericVnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + aaiVnfResources.createVnfandConnectServiceInstance(genericVnf, serviceInstance); + + assertEquals(OrchestrationStatus.INVENTORIED, genericVnf.getOrchestrationStatus()); + verify(MOCK_aaiObjectMapper, times(1)).mapVnf(genericVnf); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void createPlatformandConnectVnfTest() { + Platform platform = new Platform(); + platform.setPlatformName("a123"); + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class),isA(AAIResourceUri.class)); + doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class)); + aaiVnfResources.createPlatformandConnectVnf(platform, genericVnf); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class),isA(AAIResourceUri.class)); + } + + @Test + public void createLineOfBusinessandConnectVnfTest() { + LineOfBusiness lob = new LineOfBusiness(); + lob.setLineOfBusinessName("a123"); + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class),isA(AAIResourceUri.class)); + doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class)); + aaiVnfResources.createLineOfBusinessandConnectVnf(lob, genericVnf); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class),isA(AAIResourceUri.class)); + } + + @Test + public void deleteVnfTest() { + doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class)); + + aaiVnfResources.deleteVnf(genericVnf); + + verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); + } + + @Test + public void updateOrchestrationStatusVnfTest() { + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Vnf.class)); + + aaiVnfResources.updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE); + + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Vnf.class)); + + assertEquals(OrchestrationStatus.ACTIVE, genericVnf.getOrchestrationStatus()); + } + + @Test + public void updateObjectVnfTest() { + doReturn(new org.onap.aai.domain.yang.GenericVnf()).when(MOCK_aaiObjectMapper).mapVnf(genericVnf); + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.GenericVnf.class)); + + aaiVnfResources.updateObjectVnf(genericVnf); + + verify(MOCK_aaiObjectMapper, times(1)).mapVnf(genericVnf); + verify(MOCK_aaiResourcesClient, times(1)).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.GenericVnf.class)); + } + + @Test + public void getGenericVnfTest () { + Optional vnf = Optional.of(new org.onap.aai.domain.yang.GenericVnf()); + vnf.get().setVnfId("vnfId"); + doReturn(vnf).when(MOCK_aaiResourcesClient).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class)); + aaiVnfResources.getGenericVnf("vnfId"); + verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class)); + } + + @Test + public void checkInMaintFlagTest () { + Optional vnf = Optional.of(new org.onap.aai.domain.yang.GenericVnf()); + vnf.get().setVnfId("vnfId"); + vnf.get().setInMaint(true); + doReturn(vnf).when(MOCK_aaiResourcesClient).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class)); + boolean inMaintFlag = aaiVnfResources.checkInMaintFlag("vnfId"); + verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class)); + assertEquals(inMaintFlag, true); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java new file mode 100644 index 0000000000..de15e0a550 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java @@ -0,0 +1,132 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +@RunWith(MockitoJUnitRunner.class) +public class AAIVolumeGroupResourcesTest extends TestDataSetup{ + @InjectMocks + private AAIVolumeGroupResources aaiVolumeGroupResources = new AAIVolumeGroupResources(); + + private CloudRegion cloudRegion; + private VolumeGroup volumeGroup; + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @Before + public void before() { + cloudRegion = buildCloudRegion(); + volumeGroup = buildVolumeGroup(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + + + @Test + public void updateOrchestrationStatusVolumeGroupTest() throws Exception { + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VolumeGroup.class)); + + aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); + + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.VolumeGroup.class)); + + assertEquals(OrchestrationStatus.ACTIVE, volumeGroup.getOrchestrationStatus()); + } + + @Test + public void createVolumeGroupTest() throws Exception { + volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VolumeGroup.class)); + + aaiVolumeGroupResources.createVolumeGroup(volumeGroup, cloudRegion); + + verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.VolumeGroup.class)); + + assertEquals(OrchestrationStatus.ASSIGNED, volumeGroup.getOrchestrationStatus()); + } + + @Test + public void connectVolumeGroupToVnfTest() throws Exception { + + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + + aaiVolumeGroupResources.connectVolumeGroupToTenant(volumeGroup, cloudRegion); + + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void connectVolumeGroupToTenantTest() throws Exception { + GenericVnf genericVnf = buildGenericVnf(); + + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + + aaiVolumeGroupResources.connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion); + + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void deleteVolumeGroupTest() { + doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class)); + + aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion); + + verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java new file mode 100644 index 0000000000..7c31040f1d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java @@ -0,0 +1,132 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.aai.domain.yang.VpnBindings; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.mapper.AAIObjectMapper; + +@RunWith(MockitoJUnitRunner.class) +public class AAIVpnBindingResourcesTest extends TestDataSetup{ + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @InjectMocks + private AAIVpnBindingResources aaiVpnBindingResources = new AAIVpnBindingResources(); + + private Customer customer; + + @Before + public void before() { + customer = buildCustomer(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + @Test + public void createCustomerTest() { + org.onap.aai.domain.yang.Customer mappedCustomer = new org.onap.aai.domain.yang.Customer(); + mappedCustomer.setGlobalCustomerId(customer.getGlobalCustomerId()); + + doReturn(mappedCustomer).when(MOCK_aaiObjectMapper).mapCustomer(customer); + doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Customer.class)); + + aaiVpnBindingResources.createCustomer(customer); + + verify(MOCK_aaiResourcesClient, times(1)).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Customer.class)); + verify(MOCK_aaiObjectMapper, times(1)).mapCustomer(customer); + } + + @Test + public void getVpnBindingTest () { + org.onap.aai.domain.yang.VpnBinding vpnBinding = new org.onap.aai.domain.yang.VpnBinding(); + vpnBinding.setVpnId("vnfId"); + when(MOCK_aaiResourcesClient.get(eq(org.onap.aai.domain.yang.VpnBinding.class),isA(AAIResourceUri.class))).thenReturn(Optional.of(vpnBinding)); + aaiVpnBindingResources.getVpnBinding("vpnId"); + verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.VpnBinding.class),isA(AAIResourceUri.class)); + } + + @Test + public void existsCustomerTest() { + when(MOCK_aaiResourcesClient.exists(isA(AAIResourceUri.class))).thenReturn(true); + boolean isCustomerExist = aaiVpnBindingResources.existsCustomer(customer); + verify(MOCK_aaiResourcesClient, times(1)).exists(isA(AAIResourceUri.class)); + assertEquals(true,isCustomerExist); + } + + @Test + public void getVpnBindingByCustomerVpnIdTest() { + when(MOCK_aaiResourcesClient.get(eq(VpnBindings.class),isA(AAIResourceUri.class))).thenReturn(Optional.of(new VpnBindings())); + Optional vpnBindings = aaiVpnBindingResources.getVpnBindingByCustomerVpnId("testCustomerVpnId"); + assertNotNull(vpnBindings.get()); + verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.VpnBindings.class),isA(AAIResourceUri.class)); + } + + @Test + public void createVpnBindingTest() { + doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VpnBinding.class)); + org.onap.aai.domain.yang.VpnBinding mappedVpnBinding = new org.onap.aai.domain.yang.VpnBinding(); + mappedVpnBinding.setVpnName("test"); + + doReturn(mappedVpnBinding).when(MOCK_aaiObjectMapper).mapVpnBinding(isA(VpnBinding.class)); + VpnBinding vpnBinding = buildVpnBinding(); + aaiVpnBindingResources.createVpnBinding(vpnBinding); + + verify(MOCK_aaiResourcesClient, times(1)).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VpnBinding.class)); + verify(MOCK_aaiObjectMapper, times(1)).mapVpnBinding(isA(VpnBinding.class)); + } + + @Test + public void connectCustomerToVpnBinding() { + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + aaiVpnBindingResources.connectCustomerToVpnBinding("testCustId","testVpnId"); + verify(MOCK_aaiResourcesClient,times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NetworkAdapterResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NetworkAdapterResourcesTest.java new file mode 100644 index 0000000000..0669b84fd6 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NetworkAdapterResourcesTest.java @@ -0,0 +1,219 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.adapters.nwrest.CreateNetworkRequest; +import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.adapters.nwrest.DeleteNetworkRequest; +import org.onap.so.adapters.nwrest.DeleteNetworkResponse; +import org.onap.so.adapters.nwrest.RollbackNetworkRequest; +import org.onap.so.adapters.nwrest.RollbackNetworkResponse; +import org.onap.so.adapters.nwrest.UpdateNetworkRequest; +import org.onap.so.adapters.nwrest.UpdateNetworkResponse; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.adapter.network.NetworkAdapterClientException; +import org.onap.so.client.adapter.network.NetworkAdapterClientImpl; +import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.entity.MsoRequest; + +import com.shazam.shazamcrest.matcher.Matchers; + + +@RunWith(MockitoJUnitRunner.class) +public class NetworkAdapterResourcesTest extends TestDataSetup{ + + @InjectMocks + private NetworkAdapterResources networkAdapterResources = new NetworkAdapterResources(); + + @Mock + protected NetworkAdapterClientImpl MOCK_networkAdapterClient; + + @Mock + protected NetworkAdapterObjectMapper MOCK_networkAdapterObjectMapper; + + private L3Network l3Network; + private RequestContext requestContext; + private ServiceInstance serviceInstance; + private CloudRegion cloudRegion; + private OrchestrationContext orchestrationContext; + private Customer customer; + Map userInput; + + @Before + public void before() { + requestContext = buildRequestContext(); + + customer = buildCustomer(); + + serviceInstance = buildServiceInstance(); + + cloudRegion = buildCloudRegion(); + + orchestrationContext = buildOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + userInput = buildUserInput(); + + l3Network = buildL3Network(); + } + + @Test + public void createNetworTest() throws Exception { + String cloudRegionPo = "cloudRegionPo"; + CreateNetworkRequest expectedCreateNetworkRequest = new CreateNetworkRequest(); + + expectedCreateNetworkRequest.setCloudSiteId(cloudRegionPo); + expectedCreateNetworkRequest.setTenantId(cloudRegion.getTenantId()); + expectedCreateNetworkRequest.setNetworkId(l3Network.getNetworkId()); + expectedCreateNetworkRequest.setNetworkName(l3Network.getNetworkName()); + expectedCreateNetworkRequest.setBackout(false); + expectedCreateNetworkRequest.setFailIfExists(true); + + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestContext.getMsoRequestId()); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + expectedCreateNetworkRequest.setMsoRequest(msoRequest); + expectedCreateNetworkRequest.setSkipAAI(true); + + Subnet openstackSubnet = new Subnet(); + HostRoute hostRoute = new HostRoute(); + hostRoute.setHostRouteId("hostRouteId"); + hostRoute.setNextHop("nextHop"); + hostRoute.setRoutePrefix("routePrefix"); + openstackSubnet.getHostRoutes().add(hostRoute); + List subnetList = new ArrayList(); + subnetList.add(openstackSubnet); + l3Network.getSubnets().add(openstackSubnet); + + l3Network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest(); + createNetworkRequest.setCloudSiteId("cloudSiteId"); + + CreateNetworkResponse expectedCreateNetworkResponse = new CreateNetworkResponse(); + expectedCreateNetworkResponse.setNetworkStackId("networkStackId"); + expectedCreateNetworkResponse.setNetworkCreated(true); + + + doReturn(expectedCreateNetworkResponse).when(MOCK_networkAdapterClient).createNetwork(isA(CreateNetworkRequest.class)); + + doReturn(createNetworkRequest).when(MOCK_networkAdapterObjectMapper).createNetworkRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(String.class), isA(Customer.class)); + + CreateNetworkResponse actualCreateNetwrokResponse = (networkAdapterResources.createNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer)).get(); + + verify(MOCK_networkAdapterClient, times(1)).createNetwork(createNetworkRequest); + + verify(MOCK_networkAdapterObjectMapper, times(1)).createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer); + + assertThat(expectedCreateNetworkResponse, Matchers.sameBeanAs(actualCreateNetwrokResponse)); + } + + @Test + public void rollbackCreateNetworkTest() throws Exception { + String cloudRegionPo = "cloudRegionPo"; + RollbackNetworkResponse expectedRollbackNetworkResponse = new RollbackNetworkResponse(); + expectedRollbackNetworkResponse.setMessageId("messageId"); + expectedRollbackNetworkResponse.setNetworkRolledBack(true); + + RollbackNetworkRequest rollbackNetworkRequest = new RollbackNetworkRequest(); + rollbackNetworkRequest.setMessageId("messageId"); + + RollbackNetworkResponse rollbackNetworkResponse = new RollbackNetworkResponse(); + rollbackNetworkResponse.setMessageId("messageId"); + rollbackNetworkResponse.setNetworkRolledBack(true); + + CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse(); + createNetworkResponse.setMessageId("messageId"); + + doReturn(rollbackNetworkResponse).when(MOCK_networkAdapterClient).rollbackNetwork(isA(String.class), isA(RollbackNetworkRequest.class)); + + doReturn(rollbackNetworkRequest).when(MOCK_networkAdapterObjectMapper).createNetworkRollbackRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(String.class), isA(CreateNetworkResponse.class)); + + RollbackNetworkResponse actualRollbackCreateNetwrokResponse = (networkAdapterResources.rollbackCreateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse)).get(); + + verify(MOCK_networkAdapterClient, times(1)).rollbackNetwork(l3Network.getNetworkId(), rollbackNetworkRequest); + + verify(MOCK_networkAdapterObjectMapper, times(1)).createNetworkRollbackRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse); + + assertThat(expectedRollbackNetworkResponse, Matchers.sameBeanAs(actualRollbackCreateNetwrokResponse)); + } + + @Test + public void updateNetworkTest() throws UnsupportedEncodingException, NetworkAdapterClientException { + + doReturn(new UpdateNetworkRequest()).when(MOCK_networkAdapterObjectMapper).createNetworkUpdateRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(Customer.class)); + + doReturn(new UpdateNetworkResponse()).when(MOCK_networkAdapterClient).updateNetwork(isA(String.class), isA(UpdateNetworkRequest.class)); + + Optional actualUpdateNetworkResponse = networkAdapterResources.updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer); + + + verify(MOCK_networkAdapterObjectMapper, times(1)).createNetworkUpdateRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer); + verify(MOCK_networkAdapterClient, times(1)).updateNetwork(isA(String.class), isA(UpdateNetworkRequest.class)); + assertNotNull(actualUpdateNetworkResponse); + } + + @Test + public void deleteNetwork_DeleteAction_Test() throws UnsupportedEncodingException, NetworkAdapterClientException { + + DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest(); + doReturn(deleteNetworkRequest).when(MOCK_networkAdapterObjectMapper).deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network); + + DeleteNetworkResponse expectedDeleteNetworkResponse = new DeleteNetworkResponse(); + + doReturn(expectedDeleteNetworkResponse).when(MOCK_networkAdapterClient).deleteNetwork(l3Network.getNetworkId(), deleteNetworkRequest); + + Optional actualODeleteNetworkResponse = networkAdapterResources.deleteNetwork(requestContext, cloudRegion, serviceInstance, l3Network); + DeleteNetworkResponse actualDeleteNetworkResponse = actualODeleteNetworkResponse.get(); + + verify(MOCK_networkAdapterObjectMapper, times(1)).deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network); + verify(MOCK_networkAdapterClient, times(1)).deleteNetwork(l3Network.getNetworkId(), deleteNetworkRequest); + assertThat(expectedDeleteNetworkResponse, Matchers.sameBeanAs(actualDeleteNetworkResponse)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java new file mode 100644 index 0000000000..7de5faac0c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import static org.junit.Assert.assertNotNull; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper; + +import org.onap.sdnc.apps.client.model.GenericResourceApiGcTopologyOperationInformation; + +@RunWith(MockitoJUnitRunner.class) +public class SDNCConfigurationResourcesTest extends TestDataSetup{ + + @InjectMocks + private SDNCConfigurationResources sdncConfigurationResources = new SDNCConfigurationResources(); + + @Spy + GCTopologyOperationRequestMapper MOCK_gcTopologyMapper ; + + @Mock + protected SDNCClient MOCK_sdncClient; + + private RequestContext requestContext; + private ServiceInstance serviceInstance; + private VpnBondingLink vpnBondingLink; + private GenericVnf vnf; + private Customer customer; + + @Before + public void setUp(){ + + customer = buildCustomer(); + + requestContext = buildRequestContext(); + + serviceInstance = buildServiceInstance(); + + vpnBondingLink = buildVpnBondingLink(); + + vnf = vpnBondingLink.getInfrastructureServiceProxy().getServiceInstance().getVnfs().get(0); + } + + @Test + public void activateVnrConfigurationTest() throws BadResponseException, MapperException { + + doReturn("success").when(MOCK_sdncClient).post(isA(GenericResourceApiGcTopologyOperationInformation.class), isA(SDNCTopology.class)); + String response = sdncConfigurationResources.activateVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiGcTopologyOperationInformation.class), any(SDNCTopology.class)); + assertNotNull(response); + } + + @Test + public void assignVnrConfigurationTest() throws BadResponseException, MapperException { + + doReturn("success").when(MOCK_sdncClient).post(isA(GenericResourceApiGcTopologyOperationInformation.class), isA(SDNCTopology.class)); + String response = sdncConfigurationResources.assignVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiGcTopologyOperationInformation.class), any(SDNCTopology.class)); + assertNotNull(response); + } + + @Test + public void unAssignVnrConfigurationTest() throws BadResponseException, MapperException { + doReturn("success").when(MOCK_sdncClient).post(isA(GenericResourceApiGcTopologyOperationInformation.class), isA(SDNCTopology.class)); + String response = sdncConfigurationResources.unAssignVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration()); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiGcTopologyOperationInformation.class), any(SDNCTopology.class)); + assertNotNull(response); + } + + @Test + public void deactivateVnrConfigurationTest() throws BadResponseException, MapperException { + doReturn("success").when(MOCK_sdncClient).post(isA(GenericResourceApiGcTopologyOperationInformation.class), isA(SDNCTopology.class)); + String response = sdncConfigurationResources.deactivateVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration()); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiGcTopologyOperationInformation.class), any(SDNCTopology.class)); + assertNotNull(response); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java new file mode 100644 index 0000000000..b91d935c8e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java @@ -0,0 +1,204 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import org.onap.sdnc.apps.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; + +@RunWith(MockitoJUnitRunner.class) +public class SDNCNetworkResourcesTest extends TestDataSetup{ + + @InjectMocks + private SDNCNetworkResources sdncNetworkResources; + + @Mock + protected SDNCClient MOCK_sdncClient; + + @Mock + protected NetworkTopologyOperationRequestMapper MOCK_networkTopologyOperationRequestMapper; + + private L3Network network; + private ServiceInstance serviceInstance; + private Customer customer; + private RequestContext requestContext; + private CloudRegion cloudRegion; + + @Before + public void before() { + network = buildL3Network(); + + customer = buildCustomer(); + + serviceInstance = buildServiceInstance(); + + requestContext = buildRequestContext(); + + cloudRegion = new CloudRegion(); + } + + @Test + public void assignNetworkTest() throws Exception { + network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + sdncNetworkResources.assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus()); + } + + @Test + public void rollbackAssignNetworkTest() throws Exception { + network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + sdncNetworkResources.rollbackAssignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus()); + } + + @Test + public void activateNetworkTest() throws Exception { + network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + sdncNetworkResources.activateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus()); + } + + @Test + public void deleteNetworkTest() throws Exception { + network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + sdncNetworkResources.deleteNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus()); + } + + @Test + public void test_deactivateNetwork() throws MapperException, BadResponseException { + serviceInstance.getNetworks().add(network); + + Customer customer = new Customer(); + customer.setGlobalCustomerId("gcustId"); + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + GenericResourceApiNetworkOperationInformation expectedGenericResourceApiNetworkOperationInformation = new GenericResourceApiNetworkOperationInformation(); + + String expectedResponse = "response"; + + doReturn(expectedResponse).when(MOCK_sdncClient).post(expectedGenericResourceApiNetworkOperationInformation, SDNCTopology.NETWORK); + + doReturn(expectedGenericResourceApiNetworkOperationInformation).when(MOCK_networkTopologyOperationRequestMapper).reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); + + String actualResponse = sdncNetworkResources.deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); + + verify(MOCK_sdncClient).post(expectedGenericResourceApiNetworkOperationInformation, SDNCTopology.NETWORK); + + assertEquals(expectedResponse, actualResponse); + } + + @Test + public void changeAssignNetworkTest() throws MapperException, BadResponseException { + String expectedSdncResponse = "SDNCChangeAssignNetworkResponse"; + + serviceInstance.getNetworks().add(network); + + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + GenericResourceApiNetworkOperationInformation sdncReq = new GenericResourceApiNetworkOperationInformation(); + + doReturn(sdncReq).when(MOCK_networkTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(L3Network.class), isA(ServiceInstance.class), isA(Customer.class), isA(RequestContext.class), isA(CloudRegion.class)); + + doReturn(expectedSdncResponse).when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), isA(SDNCTopology.class)); + + String actualSdncResponse = sdncNetworkResources.changeAssignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); + verify(MOCK_sdncClient, times(1)).post(sdncReq, SDNCTopology.NETWORK); + assertEquals(actualSdncResponse, expectedSdncResponse); + } + + @Test + public void unassignNetwork_Test() throws Exception { + network.setOrchestrationStatus(OrchestrationStatus.CREATED); + + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + sdncNetworkResources.unassignNetwork(network, serviceInstance, customer, + requestContext, cloudRegion); + + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + assertEquals(OrchestrationStatus.CREATED, network.getOrchestrationStatus()); + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java new file mode 100644 index 0000000000..79419c342e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java @@ -0,0 +1,149 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.client.sdnc.mapper.ServiceTopologyOperationMapper; + +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiServiceOperationInformation; + +@RunWith(MockitoJUnitRunner.class) +public class SDNCServiceInstanceResourcesTest extends TestDataSetup{ + @InjectMocks + private SDNCServiceInstanceResources sdncServiceInstanceResources; + + + @Mock + protected ServiceTopologyOperationMapper MOCK_serviceTopologyOperationMapper; + + private RequestContext requestContext; + private ServiceInstance serviceInstance; + private Customer customer; + + @Mock + protected SDNCClient MOCK_sdncClient; + + @Before + public void before() { + requestContext = buildRequestContext(); + + serviceInstance = buildServiceInstance(); + + customer = buildCustomer(); + + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + } + + @Test + public void assignServiceInstanceSuccessTest() throws Exception { + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.assignServiceInstance(serviceInstance, customer, requestContext); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + } + + @Test + public void assignServiceInstanceExceptionTest() throws Exception { + expectedException.expect(Exception.class); + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.assignServiceInstance(serviceInstance, customer, requestContext); + } + + @Test + public void deleteServiceInstanceSuccessTest() throws Exception { + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.deleteServiceInstance(serviceInstance, customer, requestContext); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + } + + @Test + public void deleteServiceInstanceExceptionTest() throws Exception { + expectedException.expect(Exception.class); + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.deleteServiceInstance(serviceInstance, customer, requestContext); + } + + @Test + public void unassignServiceInstanceSuccessTest() throws Exception { + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.unassignServiceInstance(serviceInstance, customer, requestContext); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + } + + @Test + public void unassignServiceInstanceExceptionTest() throws Exception { + expectedException.expect(Exception.class); + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.unassignServiceInstance(serviceInstance,customer, requestContext); + } + + @Test + public void deactivateServiceInstanceSuccessTest() throws Exception { + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.deactivateServiceInstance(serviceInstance, customer, requestContext); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + } + + @Test + public void deactivateServiceInstanceExceptionTest() throws Exception { + expectedException.expect(Exception.class); + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.deactivateServiceInstance(serviceInstance, customer, requestContext); + } + + @Test + public void test_changeModelServiceInstance() throws MapperException, BadResponseException { + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.CHANGE_ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, customer, requestContext); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java new file mode 100644 index 0000000000..c7ab47ba5a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java @@ -0,0 +1,126 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper; + +import org.onap.sdnc.apps.client.model.GenericResourceApiVfModuleOperationInformation;; + +@RunWith(MockitoJUnitRunner.class) +public class SDNCVfModuleResourcesTest extends TestDataSetup{ + @InjectMocks + private SDNCVfModuleResources sdncVfModuleResources = new SDNCVfModuleResources(); + + private VfModule vfModule; + private GenericVnf vnf; + private ServiceInstance serviceInstance; + private VolumeGroup volumeGroup; + private Customer customer; + private CloudRegion cloudRegion; + private RequestContext requestContext; + + @Mock + protected SDNCClient MOCK_sdncClient; + + @Spy + protected VfModuleTopologyOperationRequestMapper vfModuleTopologyMapper; + + @Before + public void before() { + vfModule = buildVfModule(); + vnf = buildGenericVnf(); + serviceInstance = buildServiceInstance(); + volumeGroup = buildVolumeGroup(); + customer = buildCustomer(); + cloudRegion = buildCloudRegion(); + requestContext = buildRequestContext(); + } + + @Test + public void assignVfModuleTest() throws MapperException, BadResponseException { + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), isA(SDNCTopology.class)); + + sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext); + + verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + } + + @Test + public void unassignVfModuleTest() throws MapperException, BadResponseException { + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + + sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance); + + verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + } + + @Test + public void activateVfModuleTest() throws MapperException, BadResponseException { + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), isA(SDNCTopology.class)); + + sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); + + verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + } + + @Test + public void deactivateVfModuleTest() throws MapperException, BadResponseException { + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), isA(SDNCTopology.class)); + + sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); + + verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + } + + @Test + public void changeAssignVfModuleTest() throws MapperException, BadResponseException { + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), isA(SDNCTopology.class)); + + sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); + + verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java new file mode 100644 index 0000000000..46764c221c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java @@ -0,0 +1,185 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyBoolean; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiVnfOperationInformation; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper; + +@RunWith(MockitoJUnitRunner.class) +public class SDNCVnfResourcesTest extends TestDataSetup{ + @InjectMocks + private SDNCVnfResources sdncVnfResources; + + @Mock + protected VnfTopologyOperationRequestMapper MOCK_vnfTopologyOperationRequestMapper; + + @Mock + protected SDNCClient MOCK_sdncClient; + + private GenericVnf genericVnf; + private ServiceInstance serviceInstance; + private Customer customer; + private CloudRegion cloudRegion; + private RequestContext requestContext; + private GenericResourceApiVnfOperationInformation sdncReq; + + @Before + public void before() { + serviceInstance = buildServiceInstance(); + + genericVnf = buildGenericVnf(); + + customer = buildCustomer(); + + cloudRegion = buildCloudRegion(); + + requestContext = buildRequestContext(); + + sdncReq = new GenericResourceApiVnfOperationInformation(); + } + + @Test + public void assignVnfTest() throws MapperException, BadResponseException { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + + sdncVnfResources.assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); + + verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + } + + @Test + public void activateVnfTest() throws MapperException, BadResponseException { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + + sdncVnfResources.activateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + } + + @Test + public void deleteVnfTest() throws MapperException, BadResponseException { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + + sdncVnfResources.deleteVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + } + + @Test + public void queryVnfTest() throws MapperException, BadResponseException { + doReturn("test").when(MOCK_sdncClient).get(isA(String.class)); + + genericVnf.setSelflink("testSelflink"); + + sdncVnfResources.queryVnf(genericVnf); + + verify(MOCK_sdncClient, times(1)).get(isA(String.class)); + } + + @Test + public void queryVnfWithResourcePrefixTest() throws MapperException, BadResponseException { + doReturn("test").when(MOCK_sdncClient).get(isA(String.class)); + + genericVnf.setSelflink("restconf/test:testSelflink"); + + sdncVnfResources.queryVnf(genericVnf); + + verify(MOCK_sdncClient, times(1)).get(isA(String.class)); + } + + @Test + public void changeModelVnfTest() throws MapperException, BadResponseException { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); + doReturn("SDNCChangeModelVnfResponse").when(MOCK_sdncClient).post(isA(GenericResourceApiVnfOperationInformation.class), isA(SDNCTopology.class)); + + String actualResponse = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); + verify(MOCK_sdncClient, times(1)).post(sdncReq, SDNCTopology.VNF); + assertEquals("SDNCChangeModelVnfResponse", actualResponse); + } + + @Test + public void deactivateVnfSuccessTest() throws Exception { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean()); + doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + + } + + @Test(expected = Exception.class) + public void deactivateVnfExceptionTest() throws Exception { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean()); + doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + } + + @Test + public void unassignVnfSuccessTest() throws Exception { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean()); + doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + } + + @Test(expected = Exception.class) + public void unassignVnfExceptionTest() throws Exception { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean()); + doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + //verify(client, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.VNF)); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNOHealthCheckResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNOHealthCheckResourcesTest.java new file mode 100644 index 0000000000..38113b8078 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNOHealthCheckResourcesTest.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; + +import java.util.UUID; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.sdno.SDNOValidator; + +@RunWith(MockitoJUnitRunner.class) +public class SDNOHealthCheckResourcesTest extends TestDataSetup{ + @InjectMocks + private SDNOHealthCheckResources sdnoHealthCheckResources = new SDNOHealthCheckResources(); + + private GenericVnf genericVnf; + private RequestContext requestContext; + + @Mock + protected SDNOValidator MOCK_sdnoValidator; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @Before + public void before() { + genericVnf = buildGenericVnf(); + requestContext = buildRequestContext(); + doReturn(MOCK_sdnoValidator).when(MOCK_injectionHelper).getSdnoValidator(); + } + + @Test + public void healthCheckTest() throws Exception { + doReturn(true).when(MOCK_sdnoValidator).healthDiagnostic(isA(String.class), isA(UUID.class), isA(String.class)); + assertTrue(sdnoHealthCheckResources.healthCheck(genericVnf, requestContext)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java new file mode 100644 index 0000000000..dfed3c8929 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java @@ -0,0 +1,122 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; +import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper; + +@RunWith(MockitoJUnitRunner.class) +public class VnfAdapterVfModuleResourcesTest extends TestDataSetup{ + @InjectMocks + private VnfAdapterVfModuleResources vnfAdapterVfModuleResources = new VnfAdapterVfModuleResources(); + + @Mock + protected VnfAdapterVfModuleObjectMapper MOCK_vnfAdapterVfModuleObjectMapper; + + private RequestContext requestContext; + private ServiceInstance serviceInstance; + private ModelInfoServiceInstance modelInfoServiceInstance; + private GenericVnf genericVnf; + private VfModule vfModule; + private ModelInfoVfModule modelInfoVfModule; + private CloudRegion cloudRegion; + private OrchestrationContext orchestrationContext; + private CreateVfModuleRequest createVfModuleRequest; + private String sdncVnfQueryResponse; + private String sdncVfModuleQueryResponse; + private DeleteVfModuleRequest deleteVfModuleRequest; + + @Before + public void before() { + requestContext = buildRequestContext(); + + serviceInstance = buildServiceInstance(); + + genericVnf = buildGenericVnf(); + + vfModule = buildVfModule(); + + cloudRegion = buildCloudRegion(); + + orchestrationContext = buildOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + sdncVnfQueryResponse = new String(); + sdncVfModuleQueryResponse = new String(); + + createVfModuleRequest = new CreateVfModuleRequest(); + createVfModuleRequest.setCloudSiteId("cloudSiteId"); + + deleteVfModuleRequest = new DeleteVfModuleRequest(); + deleteVfModuleRequest.setCloudSiteId("cloudSiteId"); + } + + @Test + public void test_createVfModule() throws Exception { + doReturn(createVfModuleRequest).when(MOCK_vnfAdapterVfModuleObjectMapper).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + CreateVfModuleRequest actualCreateVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + verify(MOCK_vnfAdapterVfModuleObjectMapper, times(1)).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + assertNotNull(createVfModuleRequest); + assertNotNull(actualCreateVfModuleRequest); + assertEquals(createVfModuleRequest, actualCreateVfModuleRequest); + } + + @Test + public void test_deleteVfModule() throws Exception { + doReturn(deleteVfModuleRequest).when(MOCK_vnfAdapterVfModuleObjectMapper).deleteVfModuleRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(ServiceInstance.class), + isA(GenericVnf.class), isA(VfModule.class)); + + DeleteVfModuleRequest actualDeleteVfModuleRequest = vnfAdapterVfModuleResources.deleteVfModuleRequest(requestContext, cloudRegion, serviceInstance, + genericVnf, vfModule); + + verify(MOCK_vnfAdapterVfModuleObjectMapper, times(1)).deleteVfModuleRequestMapper(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule); + assertEquals(deleteVfModuleRequest, actualDeleteVfModuleRequest); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java new file mode 100644 index 0000000000..ee0e60c38a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java @@ -0,0 +1,122 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.orchestration; + +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.adapter.vnf.VnfVolumeAdapterClientImpl; +import org.onap.so.client.adapter.vnf.mapper.VnfAdapterObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.shazam.shazamcrest.matcher.Matchers; + +@RunWith(MockitoJUnitRunner.class) +public class VnfAdapterVolumeGroupResourcesTest extends TestDataSetup { + @InjectMocks + private VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources; + + @Mock + protected VnfAdapterObjectMapper MOCK_vnfAdapterObjectMapper; + + @Mock + protected VnfVolumeAdapterClientImpl MOCK_vnfVolumeAdapterClient; + + private RequestContext requestContext; + private ServiceInstance serviceInstance; + private GenericVnf genericVnf; + private VfModule vfModule; + private VolumeGroup volumeGroup; + private CloudRegion cloudRegion; + private OrchestrationContext orchestrationContext; + + @Before + public void before() { + requestContext = buildRequestContext(); + serviceInstance = buildServiceInstance(); + genericVnf = buildGenericVnf(); + serviceInstance.getVnfs().add(genericVnf); + vfModule = buildVfModule(); + genericVnf.getVfModules().add(vfModule); + volumeGroup = buildVolumeGroup(); + serviceInstance.getVnfs().get(0).getVolumeGroups().add(volumeGroup); + cloudRegion = buildCloudRegion(); + orchestrationContext = buildOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + } + + @Test + public void test_createVolumeGroup() throws Exception { + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + CreateVolumeGroupRequest createVolumeGroupRequest = new CreateVolumeGroupRequest(); + createVolumeGroupRequest.setCloudSiteId("cloudSiteId"); + + CreateVolumeGroupResponse expectedCreateVolumeGroupResponse = new CreateVolumeGroupResponse(); + expectedCreateVolumeGroupResponse.setVolumeGroupStackId("volumeGroupStackId"); + expectedCreateVolumeGroupResponse.setVolumeGroupCreated(true); + + String sdncVfModuleQueryResponse = "sdncVfModuleQueryResponse"; + + doReturn(createVolumeGroupRequest).when(MOCK_vnfAdapterObjectMapper).createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse); + + CreateVolumeGroupRequest actualCreateVolumeGroupResponse = vnfAdapterVolumeGroupResources.createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse); + + verify(MOCK_vnfAdapterObjectMapper, times(1)).createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse); + + assertThat(createVolumeGroupRequest, Matchers.sameBeanAs(actualCreateVolumeGroupResponse)); + } + + @Test + public void test_deleteVolumeGroup() throws Exception { + DeleteVolumeGroupRequest deleteVolumeGroupRequest = new DeleteVolumeGroupRequest(); + doReturn(deleteVolumeGroupRequest).when(MOCK_vnfAdapterObjectMapper).deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup); + + DeleteVolumeGroupResponse expectedDeleteVolumeGroupResponse = new DeleteVolumeGroupResponse(); + doReturn(expectedDeleteVolumeGroupResponse).when(MOCK_vnfVolumeAdapterClient).deleteVNFVolumes(volumeGroup.getVolumeGroupId(), deleteVolumeGroupRequest); + + DeleteVolumeGroupResponse actualDeleteVolumeGroupResponse = vnfAdapterVolumeGroupResources.deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup); + + verify(MOCK_vnfVolumeAdapterClient, times(1)).deleteVNFVolumes(volumeGroup.getVolumeGroupId(), deleteVolumeGroupRequest); + verify(MOCK_vnfAdapterObjectMapper, times(1)).deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup); + assertThat(expectedDeleteVolumeGroupResponse, Matchers.sameBeanAs(actualDeleteVolumeGroupResponse)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/policy/CommonObjectMapperProviderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/policy/CommonObjectMapperProviderTest.java new file mode 100644 index 0000000000..e3f6a1829e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/policy/CommonObjectMapperProviderTest.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.client.policy; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +public class CommonObjectMapperProviderTest { + + @Test + public void shouldSetCorrectMapperProperties() throws Exception { + // given + CommonObjectMapperProvider provider = new CommonObjectMapperProvider(); + // when + ObjectMapper context = provider.getMapper(); + // then + assertTrue(context.isEnabled(MapperFeature.USE_ANNOTATIONS)); + assertFalse(context.isEnabled(SerializationFeature.WRAP_ROOT_VALUE)); + assertFalse(context.isEnabled(DeserializationFeature.UNWRAP_ROOT_VALUE)); + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java new file mode 100644 index 0000000000..eb17ad0ff9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java @@ -0,0 +1,83 @@ +/*- + * ============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.client.sdn.common; + +import java.util.LinkedHashMap; + +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SdnCommonTasks; + + +public class SdnCommonTasksTest{ + + + SdnCommonTasks sdnCommonTasks = new SdnCommonTasks(); + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Test + public void buildJsonRequestTest() throws MapperException { + String jsonStr = sdnCommonTasks.buildJsonRequest(""); + Assert.assertNotNull(jsonStr); + } + + @Test + public void buildJsonRequestTestException() throws MapperException { + expectedException.expect(MapperException.class); + sdnCommonTasks.buildJsonRequest(new Object()); + } + + @Test + public void getHttpHeadersTest() { + Assert.assertNotNull(sdnCommonTasks.getHttpHeaders("")); + } + + @Test + public void validateSDNResponseTest() throws BadResponseException { + LinkedHashMap responseMap = new LinkedHashMap(); + responseMap.put("response-code", "0"); + responseMap.put("response-message", "success"); + Assert.assertNotNull(sdnCommonTasks.validateSDNResponse(responseMap)); + } + + @Test + public void validateSDNResponseTestException() throws BadResponseException { + expectedException.expect(BadResponseException.class); + LinkedHashMap responseMap = new LinkedHashMap(); + Assert.assertNotNull(sdnCommonTasks.validateSDNResponse(responseMap)); + } + + @Test + public void validateSDNResponseTestRespCodeNot200() throws BadResponseException { + expectedException.expect(BadResponseException.class); + LinkedHashMap responseMap = new LinkedHashMap(); + responseMap.put("response-code", "300"); + responseMap.put("response-message", "Failed"); + Assert.assertNotNull(sdnCommonTasks.validateSDNResponse(responseMap)); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java new file mode 100644 index 0000000000..2492638520 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java @@ -0,0 +1,58 @@ +/*- + * ============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.client.sdnc; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + +import org.junit.Rule; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.skyscreamer.jsonassert.JSONAssert; + +import com.github.tomakehurst.wiremock.junit.WireMockRule; + +public class SDNCClientTest extends BaseTaskTest { + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/"; + + @Rule + public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8446)); + + @Test + public void getTest() throws BadResponseException, MapperException, IOException { + String responseJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientGetResponse.json"))); + String queryLink = "/topologyQuery"; + + wireMockRule.stubFor(get(urlEqualTo(queryLink)) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json").withBody(responseJson))); + String response = SPY_sdncClient.get(queryLink); + JSONAssert.assertEquals(responseJson, response, false); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java new file mode 100644 index 0000000000..d0d2510b73 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java @@ -0,0 +1,138 @@ +/*- + * ============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.client.sdnc.mapper; + +import java.util.HashMap; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; + +import org.onap.sdnc.apps.client.model.GenericResourceApiGcTopologyOperationInformation; + + +public class GCTopologyOperationRequestMapperTest extends TestDataSetup{ + + private GCTopologyOperationRequestMapper genObjMapper = new GCTopologyOperationRequestMapper(); + + @Test + public void deactivateOrUnassignVnrReqMapperTest() { + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId("MsoRequestId"); + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("ServiceInstanceId"); + Configuration Configuration = new Configuration(); + Configuration.setConfigurationId("ConfigurationId"); + GenericResourceApiGcTopologyOperationInformation genericInfo = genObjMapper.deactivateOrUnassignVnrReqMapper + (SDNCSvcAction.UNASSIGN, serviceInstance, requestContext, Configuration); + + Assert.assertNotNull(genericInfo); + Assert.assertNotNull(genericInfo.getSdncRequestHeader().getSvcRequestId()); + } + + + + private VpnBondingLink getVpnBondingLink() { + VpnBondingLink vpnBondingLink = new VpnBondingLink(); + Configuration vrfConfiguration = getVRFConfiguration(); + vpnBondingLink.setVrfConfiguration(vrfConfiguration); + Configuration vnrConfiguration = getVNRConfiguration(); + vpnBondingLink.setVnrConfiguration(vnrConfiguration); + vpnBondingLink.setTransportServiceProxy(buildServiceProxy(buildServiceInstance(buildGenericVnf()))); + return vpnBondingLink; + } + + private RequestContext getRequestContext() { + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId("MsoRequestId"); + HashMap userParams = getUserParams(); + requestContext.setUserParams(userParams); + return requestContext; + } + + private HashMap getUserParams() { + HashMap userParams = new HashMap<>(); + userParams.put("lppCustomerId","lppCustomerId"); + return userParams; + } + + private ServiceProxy buildServiceProxy(ServiceInstance serviceInstance) { + ServiceProxy serviceProxy = new ServiceProxy(); + serviceProxy.setServiceInstance(serviceInstance); + return serviceProxy; + } + + private Configuration getVRFConfiguration() { + Configuration vrfConfiguration = new Configuration(); + vrfConfiguration.setConfigurationId("ConfigurationId"); + vrfConfiguration.setConfigurationName("ConfigurationName"); + vrfConfiguration.setConfigurationSubType("ConfigurationSubType"); + vrfConfiguration.setConfigurationType("VRF-ENTRY"); + return vrfConfiguration; + } + + public Configuration getVNRConfiguration() { + Configuration vnrConfiguration = new Configuration(); + vnrConfiguration.setConfigurationId("ConfigurationId"); + vnrConfiguration.setConfigurationName("ConfigurationName"); + vnrConfiguration.setConfigurationSubType("ConfigurationSubType"); + vnrConfiguration.setConfigurationType("VNRConfiguration"); + L3Network l3Network = getL3Network(); + vnrConfiguration.setNetwork(l3Network); + return vnrConfiguration; + } + + public L3Network getL3Network() { + L3Network l3Network = new L3Network(); + l3Network.setNetworkId("l3NetworkId"); + Subnet ipv4subnet = getSubnet("ipv4CidrMask", "ipv4NetworkStartAddress", "IPV4"); + Subnet ipv6subnet = getSubnet("ipv6CidrMask", "ipv6NetworkStartAddress", "IPV6"); + l3Network.getSubnets().add(ipv4subnet); + l3Network.getSubnets().add(ipv6subnet); + return l3Network; + } + + private Subnet getSubnet(String ipv4CidrMask, String ipv4NetworkStartAddress, String ipv4) { + Subnet ipv4subnet = new Subnet(); + ipv4subnet.setCidrMask(ipv4CidrMask); + ipv4subnet.setNetworkStartAddress(ipv4NetworkStartAddress); + ipv4subnet.setIpVersion(ipv4); + return ipv4subnet; + } + + private ServiceInstance buildServiceInstance(GenericVnf vnf) { + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("ServiceInstanceId"); + List vnfs = serviceInstance.getVnfs(); + vnfs.add(vnf); + return serviceInstance; + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java new file mode 100644 index 0000000000..6f3d137541 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java @@ -0,0 +1,225 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.sdnc.mapper; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.HashMap; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.InjectMocks; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; + +import org.onap.sdnc.apps.client.model.GenericResourceApiConfigurationinformationConfigurationInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiGcrequestinputGcRequestInput; +import org.onap.sdnc.apps.client.model.GenericResourceApiParam; +import org.onap.sdnc.apps.client.model.GenericResourceApiParamParam; +import org.onap.sdnc.apps.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; +import org.onap.sdnc.apps.client.model.GenericResourceApiServiceinformationServiceInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiSvcActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiVnfinformationVnfInformation; + + +public class GeneralTopologyObjectMapperTest extends TestDataSetup{ + @InjectMocks + private GeneralTopologyObjectMapper genObjMapper = new GeneralTopologyObjectMapper(); + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Before + public void before() { + + } + + @After + public void after() { + + } + + @Test + public void testBuildServiceInformation() { + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("productFamilyId"); + customer.setServiceSubscription(serviceSubscription); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + // + RequestContext requestContext = new RequestContext(); + HashMap userParams = new HashMap(); + userParams.put("key1", "value1"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericResourceApiServiceinformationServiceInformation serviceInfo = genObjMapper.buildServiceInformation(serviceInstance, requestContext, customer, true); + + assertEquals("serviceModelInvariantUuid", serviceInfo.getOnapModelInformation().getModelInvariantUuid()); + assertEquals("serviceModelName", serviceInfo.getOnapModelInformation().getModelName()); + assertEquals("serviceModelUuid", serviceInfo.getOnapModelInformation().getModelUuid()); + assertEquals("serviceModelVersion", serviceInfo.getOnapModelInformation().getModelVersion()); + assertNull(serviceInfo.getOnapModelInformation().getModelCustomizationUuid()); + assertEquals("serviceInstanceId", serviceInfo.getServiceInstanceId()); + assertEquals("serviceInstanceId", serviceInfo.getServiceId()); + assertEquals("globalCustomerId", serviceInfo.getGlobalCustomerId()); + assertEquals("productFamilyId", serviceInfo.getSubscriptionServiceType()); + } + + @Test + public void buildSdncRequestHeaderActivateTest() { + GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.ACTIVATE, "sdncReqId"); + + assertEquals(GenericResourceApiSvcActionEnumeration.ACTIVATE, requestHeader.getSvcAction()); + assertEquals("sdncReqId", requestHeader.getSvcRequestId()); + } + + @Test + public void buildSdncRequestHeaderAssignTest() { + GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.ASSIGN, "sdncReqId"); + + assertEquals(GenericResourceApiSvcActionEnumeration.ASSIGN, requestHeader.getSvcAction()); + assertEquals("sdncReqId", requestHeader.getSvcRequestId()); + } + + @Test + public void buildSdncRequestHeaderDeactivateTest() { + GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.DEACTIVATE, "sdncReqId"); + + assertEquals(GenericResourceApiSvcActionEnumeration.DEACTIVATE, requestHeader.getSvcAction()); + assertEquals("sdncReqId", requestHeader.getSvcRequestId()); + } + + @Test + public void buildSdncRequestHeaderDeleteTest() { + GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.DELETE, "sdncReqId"); + + assertEquals(GenericResourceApiSvcActionEnumeration.DELETE, requestHeader.getSvcAction()); + assertEquals("sdncReqId", requestHeader.getSvcRequestId()); + } + + @Test + public void buildSdncRequestHeaderChangeAssignTest() { + GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.CHANGE_ASSIGN, "sdncReqId"); + + assertEquals(GenericResourceApiSvcActionEnumeration.CHANGEASSIGN, requestHeader.getSvcAction()); + assertEquals("sdncReqId", requestHeader.getSvcRequestId()); + } + + @Test + public void buildConfigurationInformationTest_excludesOnapModelInfo() { + Configuration configuration = new Configuration(); + configuration.setConfigurationId("testConfigurationId"); + configuration.setConfigurationType("VNR"); + configuration.setConfigurationName("VNRCONF"); + GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation =genObjMapper.buildConfigurationInformation(configuration,false); + assertEquals(configuration.getConfigurationId(),configurationInformation.getConfigurationId()); + assertEquals(configuration.getConfigurationType(),configurationInformation.getConfigurationType()); + assertEquals(configuration.getConfigurationName(),configurationInformation.getConfigurationName()); + assertNull(configurationInformation.getOnapModelInformation()); + } + + @Test + public void buildConfigurationInformationTest_includesOnapModelInfo() { + Configuration configuration = new Configuration(); + configuration.setConfigurationId("testConfigurationId"); + configuration.setConfigurationType("VNR"); + configuration.setConfigurationName("VNRCONF"); + ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); + modelInfoConfiguration.setModelVersionId("modelVersionId"); + modelInfoConfiguration.setModelInvariantId("modelInvariantId"); + modelInfoConfiguration.setModelCustomizationId("modelCustomizationId"); + configuration.setModelInfoConfiguration(modelInfoConfiguration); + + GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = genObjMapper.buildConfigurationInformation(configuration,true); + + assertEquals(configuration.getConfigurationId(),configurationInformation.getConfigurationId()); + assertEquals(configuration.getConfigurationType(),configurationInformation.getConfigurationType()); + assertEquals(configuration.getConfigurationName(),configurationInformation.getConfigurationName()); + assertNotNull(configurationInformation.getOnapModelInformation()); + assertEquals(configuration.getModelInfoConfiguration().getModelVersionId(),configurationInformation.getOnapModelInformation().getModelUuid()); + assertEquals(configuration.getModelInfoConfiguration().getModelInvariantId(),configurationInformation.getOnapModelInformation().getModelInvariantUuid()); + assertEquals(configuration.getModelInfoConfiguration().getModelCustomizationId(),configurationInformation.getOnapModelInformation().getModelCustomizationUuid()); + + } + + @Test + public void buildGcRequestInformationTest() { + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("TestVnfId"); + GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = genObjMapper.buildGcRequestInformation(vnf,null); + assertNotNull(gcRequestInput); + assertEquals(vnf.getVnfId(),gcRequestInput.getVnfId()); + assertNull(gcRequestInput.getInputParameters()); + } + + @Test + public void buildGcRequestInformationTest_withInputParams() { + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("TestVnfId"); + GenericResourceApiParam genericResourceApiParam =new GenericResourceApiParam(); + genericResourceApiParam.addParamItem(new GenericResourceApiParamParam()); + GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = genObjMapper.buildGcRequestInformation(vnf,genericResourceApiParam); + assertNotNull(gcRequestInput); + assertEquals(vnf.getVnfId(),gcRequestInput.getVnfId()); + assertNotNull(gcRequestInput.getInputParameters()); + } + + @Test + public void buildVnfInformationTest_withNullData() { + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("TestVnfId"); + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + GenericResourceApiVnfinformationVnfInformation gcRequestInput = genObjMapper.buildVnfInformation(vnf,serviceInstance,true); + assertNotNull(gcRequestInput); + assertNull(vnf.getModelInfoGenericVnf()); + assertNull(gcRequestInput.getOnapModelInformation()); + assertEquals(vnf.getVnfId(),gcRequestInput.getVnfId()); + assertNotNull(gcRequestInput.getVnfId()); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java new file mode 100644 index 0000000000..615f8a5710 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java @@ -0,0 +1,198 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.sdnc.mapper; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; + +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; + +import org.onap.sdnc.apps.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class NetworkTopologyOperationRequestMapperTest { + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; + + private ServiceInstance serviceInstance; + private ServiceInstance serviceInstanceNoCollection; + private Customer customer; + private RequestContext requestContext; + private L3Network network; + private CloudRegion cloudRegion; + + @Before + public void before() { + // prepare and set service instance + serviceInstance = new ServiceInstance(); + serviceInstanceNoCollection = new ServiceInstance(); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("modelInvariantUuid"); + modelInfoServiceInstance.setModelName("modelName"); + modelInfoServiceInstance.setModelUuid("modelUuid"); + modelInfoServiceInstance.setModelVersion("modelVersion"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + serviceInstanceNoCollection.setModelInfoServiceInstance(modelInfoServiceInstance); + // prepare Customer object + customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + //serviceInstance.setCustomer(customer); + // set Customer on service instance + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("productFamilyId"); + customer.setServiceSubscription(serviceSubscription); + + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + customer.getServiceSubscription().getServiceInstances().add(serviceInstanceNoCollection); + // + InstanceGroup networkInstanceGroup = new InstanceGroup(); + networkInstanceGroup.setId("networkInstanceGroupId"); + networkInstanceGroup.setInstanceGroupFunction("instanceGroupFunction"); + Collection networkCollection = new Collection(); + networkCollection.setInstanceGroup(networkInstanceGroup); + serviceInstance.setCollection(networkCollection); + // + requestContext = new RequestContext(); + HashMap userParams = new HashMap(); + userParams.put("key1", "value1"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + network = new L3Network(); + network.setNetworkId("TEST_NETWORK_ID"); + network.setNetworkName("TEST_NETWORK_NAME"); + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + modelInfoNetwork.setModelInvariantUUID("modelInvariantUuid"); + modelInfoNetwork.setModelName("modelName"); + modelInfoNetwork.setModelVersion("modelVersion"); + modelInfoNetwork.setModelUUID("modelUuid"); + modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUUID"); + network.setModelInfoNetwork(modelInfoNetwork); + + cloudRegion = new CloudRegion(); + } + + @Test + public void createGenericResourceApiNetworkOperationInformationTest() throws Exception { + + NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper(); + GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); + + ObjectMapper omapper = new ObjectMapper(); + GenericResourceApiNetworkOperationInformation reqMapper1 = omapper.readValue( + getJson("genericResourceApiNetworkOperationInformation.json"), + GenericResourceApiNetworkOperationInformation.class); + + assertThat(networkSDNCrequest, sameBeanAs(reqMapper1).ignoring("sdncRequestHeader.svcRequestId") + .ignoring("requestInformation.requestId")); + } + + @Test + public void reqMapperTest() throws Exception { + + NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper(); + GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); + + assertNull(networkSDNCrequest.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid()); + assertEquals("modelCustomizationUUID", networkSDNCrequest.getNetworkInformation().getOnapModelInformation().getModelCustomizationUuid()); + } + + @Test + public void reqMapperNoCollectionTest() throws Exception { + NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper(); + GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstanceNoCollection, customer, + requestContext, cloudRegion); + + assertNull(networkSDNCrequest.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid()); + assertEquals("modelCustomizationUUID", networkSDNCrequest.getNetworkInformation().getOnapModelInformation().getModelCustomizationUuid()); + } + @Test + public void createGenericResourceApiNetworkOperationInformation_UnassignTest() throws Exception { + + NetworkTopologyOperationRequestMapper mapperUnassign = new NetworkTopologyOperationRequestMapper(); + GenericResourceApiNetworkOperationInformation networkSDNCrequestUnassign = mapperUnassign.reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); + + ObjectMapper omapperUnassign = new ObjectMapper(); + GenericResourceApiNetworkOperationInformation reqMapperUnassign = omapperUnassign.readValue( + getJson("genericResourceApiNetworkOperationInformationUnAssign.json"), + GenericResourceApiNetworkOperationInformation.class); + + assertThat(reqMapperUnassign, sameBeanAs(networkSDNCrequestUnassign).ignoring("sdncRequestHeader.svcRequestId") + .ignoring("requestInformation.requestId")); + + } + + @Test + public void createGenericResourceApiNetworkOperationInformationNoNetworkNameTest() throws Exception { + + NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper(); + //set network name NULL + network.setNetworkName(null); + GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); + + ObjectMapper omapper = new ObjectMapper(); + GenericResourceApiNetworkOperationInformation reqMapper1 = omapper.readValue( + getJson("genericResourceApiNetworkOperationInformationNoNetworkName.json"), + GenericResourceApiNetworkOperationInformation.class); + + assertThat(reqMapper1, sameBeanAs(networkSDNCrequest).ignoring("sdncRequestHeader.svcRequestId") + .ignoring("requestInformation.requestId")); + } + + /* + * Helper method to load JSON data + */ + private String getJson(String filename) throws IOException { + return new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + filename))); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java new file mode 100644 index 0000000000..727a088d80 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.sdnc.mapper; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; + +import org.junit.Test; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; + +import org.onap.sdnc.apps.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiServiceOperationInformation; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class ServiceTopologyOperationMapperTest { + + @Test + public void reqMapperTest() throws Exception { + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("modelInvariantUuid"); + modelInfoServiceInstance.setModelName("modelName"); + modelInfoServiceInstance.setModelUuid("modelUuid"); + modelInfoServiceInstance.setModelVersion("modelVersion"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + //prepare RequestContext + RequestContext requestContext = new RequestContext(); + HashMap userParams = new HashMap(); + userParams.put("key1", "value1"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + ServiceTopologyOperationMapper mapper = new ServiceTopologyOperationMapper(); + GenericResourceApiServiceOperationInformation serviceOpInformation = mapper.reqMapper( + SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, + requestContext); + + String jsonToCompare = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json"))); + + ObjectMapper omapper = new ObjectMapper(); + GenericResourceApiOnapmodelinformationOnapModelInformation reqMapper1 = omapper.readValue(jsonToCompare, + GenericResourceApiOnapmodelinformationOnapModelInformation.class); + + assertThat(reqMapper1, sameBeanAs(serviceOpInformation.getServiceInformation().getOnapModelInformation())); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java new file mode 100644 index 0000000000..2ebe6d4f0f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.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.client.sdnc.mapper; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; + +import org.junit.Test; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; + +import org.onap.sdnc.apps.client.model.GenericResourceApiVfModuleOperationInformation; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class VfModuleTopologyOperationRequestMapperTest { + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; + + @Test + public void assignGenericResourceApiVfModuleInformationTest() throws Exception { + + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("productFamilyId"); + customer.setServiceSubscription(serviceSubscription); + + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + // + RequestContext requestContext = new RequestContext(); + HashMap userParams = new HashMap(); + userParams.put("key1", "value1"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("testVnfId"); + vnf.setVnfType("testVnfType"); + vnf.setVnfName("testVnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("testVfModuleId"); + vfModule.setVfModuleName("testVfModuleName"); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + volumeGroup.setVolumeGroupName("volumeGroupName"); + + CloudRegion cloudRegion = new CloudRegion(); + + VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper(); + GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, serviceInstance, customer, + cloudRegion, requestContext, null); + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleOperationInformationAssign.json"))); + + ObjectMapper omapper = new ObjectMapper(); + GenericResourceApiVfModuleOperationInformation reqMapper1 = omapper.readValue( + jsonToCompare, + GenericResourceApiVfModuleOperationInformation.class); + + assertThat(reqMapper1, sameBeanAs(vfModuleSDNCrequest).ignoring("sdncRequestHeader.svcRequestId") + .ignoring("requestInformation.requestId")); + } + + @Test + public void unassignGenericResourceApiVfModuleInformationTest() throws Exception { + + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + + // prepare and set vnf instance + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("testVnfId"); + vnf.setVnfType("testVnfType"); + + // prepare and set vf module instance + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("testVfModuleId"); + vfModule.setVfModuleName("testVfModuleName"); + + VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper(); + GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, + null, null, null); + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleOperationInformationUnassign.json"))); + + ObjectMapper omapper = new ObjectMapper(); + GenericResourceApiVfModuleOperationInformation reqMapper1 = omapper.readValue( + jsonToCompare, + GenericResourceApiVfModuleOperationInformation.class); + + assertThat(reqMapper1, sameBeanAs(vfModuleSDNCrequest).ignoring("sdncRequestHeader.svcRequestId") + .ignoring("requestInformation.requestId")); + } + + @Test + public void reqMapperTest() throws Exception { + + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + // + RequestContext requestContext = new RequestContext(); + HashMap userParams = new HashMap(); + userParams.put("key1", "value1"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("testVnfId"); + vnf.setVnfType("testVnfType"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("testVfModuleId"); + vfModule.setVfModuleName("testVfModuleName"); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + CloudRegion cloudRegion = new CloudRegion(); + + VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper(); + GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, null, vnf, serviceInstance, customer, + cloudRegion, requestContext, null); + + assertNull(vfModuleSDNCrequest.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid()); + assertEquals("vnfModelCustomizationUuid", vfModuleSDNCrequest.getVnfInformation().getOnapModelInformation().getModelCustomizationUuid()); + assertEquals("vfModuleModelCustomizationUuid", vfModuleSDNCrequest.getVfModuleInformation().getOnapModelInformation().getModelCustomizationUuid()); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java new file mode 100644 index 0000000000..ed61486ff3 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java @@ -0,0 +1,129 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.sdnc.mapper; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.junit.Test; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.generalobjects.License; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; + +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiVnfOperationInformation; + +public class VnfTopologyOperationRequestMapperTest { + + @Test + public void reqMapperTest() throws Exception { + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("modelInvariantUuid"); + modelInfoServiceInstance.setModelName("modelName"); + modelInfoServiceInstance.setModelUuid("modelUuid"); + modelInfoServiceInstance.setModelVersion("modelVersion"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + //prepare VNF + ModelInfoGenericVnf genericVnf = new ModelInfoGenericVnf(); + genericVnf.setModelInvariantUuid("vnfModelInvariantUUID"); + genericVnf.setModelVersion("vnfModelVersion"); + genericVnf.setModelName("vnfModelName"); + genericVnf.setModelUuid("vnfModelUUID"); + genericVnf.setModelCustomizationUuid("vnfModelCustomizationUUID"); + + ModelInfoInstanceGroup modelL3Network = new ModelInfoInstanceGroup(); + modelL3Network.setType("networkInstanceGroup"); + + InstanceGroup instanceGroup1 = new InstanceGroup(); + instanceGroup1.setId("l3-network-ig-111"); + instanceGroup1.setModelInfoInstanceGroup(modelL3Network); + + InstanceGroup instanceGroup2 = new InstanceGroup(); + instanceGroup2.setId("l3-network-ig-222"); + instanceGroup2.setModelInfoInstanceGroup(modelL3Network); + + GenericVnf vnf = new GenericVnf(); + vnf.setModelInfoGenericVnf(genericVnf); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.getInstanceGroups().add(instanceGroup1); + vnf.getInstanceGroups().add(instanceGroup2); + License license = new License(); + List entitlementPoolUuids = new ArrayList<>(); + entitlementPoolUuids.add("entitlementPoolUuid"); + List licenseKeyGroupUuids = new ArrayList<>(); + licenseKeyGroupUuids.add("licenseKeyGroupUuid"); + license.setEntitlementPoolUuids(entitlementPoolUuids); + license.setLicenseKeyGroupUuids(licenseKeyGroupUuids); + vnf.setLicense(license); + + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("productFamilyId"); + customer.setServiceSubscription(serviceSubscription); + + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + + //prepare RequestContext + RequestContext requestContext = new RequestContext(); + HashMap userParams = new HashMap(); + userParams.put("key1", "value1"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + CloudRegion cloudRegion = new CloudRegion(); + + VnfTopologyOperationRequestMapper mapper = new VnfTopologyOperationRequestMapper(); + GenericResourceApiVnfOperationInformation vnfOpInformation = mapper.reqMapper( + SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, + cloudRegion, requestContext,true); + + assertNull(vnfOpInformation.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid()); + assertEquals("vnfModelCustomizationUUID", vnfOpInformation.getVnfInformation().getOnapModelInformation().getModelCustomizationUuid()); + assertEquals(2, vnfOpInformation.getVnfRequestInput().getVnfNetworkInstanceGroupIds().size()); + assertEquals("l3-network-ig-111", vnfOpInformation.getVnfRequestInput().getVnfNetworkInstanceGroupIds().get(0).getVnfNetworkInstanceGroupId()); + assertEquals("l3-network-ig-222", vnfOpInformation.getVnfRequestInput().getVnfNetworkInstanceGroupIds().get(1).getVnfNetworkInstanceGroupId()); + assertEquals("entitlementPoolUuid", vnfOpInformation.getVnfRequestInput().getVnfInputParameters().getParam().get(1).getValue()); + assertEquals("licenseKeyGroupUuid", vnfOpInformation.getVnfRequestInput().getVnfInputParameters().getParam().get(2).getValue()); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java new file mode 100644 index 0000000000..e5eb6bce54 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java @@ -0,0 +1,175 @@ +/*- + * ============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.client.sniro; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import org.junit.Test; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.sniro.beans.SniroConductorRequest; +import org.onap.so.client.sniro.beans.SniroManagerRequest; +import org.springframework.beans.factory.annotation.Autowired; + +import com.fasterxml.jackson.core.JsonProcessingException; +import static com.github.tomakehurst.wiremock.client.WireMock.*; + + +public class SniroClientTestIT{ + + @Autowired + private SniroClient client; + + + @Test(expected = Test.None.class) + public void testPostDemands_success() throws BadResponseException, JsonProcessingException { + String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"corys cool\", \"requestStatus\": \"accepted\"}"; + + stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + client.postDemands(new SniroManagerRequest()); + + } + + @Test(expected = BadResponseException.class) + public void testPostDemands_error_failed() throws JsonProcessingException, BadResponseException { + String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": \"failed\"}"; + + stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + + client.postDemands(new SniroManagerRequest()); + + //TODO assertEquals("missing data", ); + + } + + @Test(expected = BadResponseException.class) + public void testPostDemands_error_noMessage() throws JsonProcessingException, BadResponseException { + String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"\", \"requestStatus\": \"failed\"}"; + + stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + + client.postDemands(new SniroManagerRequest()); + + } + + @Test(expected = BadResponseException.class) + public void testPostDemands_error_noStatus() throws JsonProcessingException, BadResponseException { + String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": null}"; + + stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + + client.postDemands(new SniroManagerRequest()); + + } + + @Test(expected = BadResponseException.class) + public void testPostDemands_error_empty() throws JsonProcessingException, BadResponseException { + String mockResponse = "{ }"; + + stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + + client.postDemands(new SniroManagerRequest()); + } + + @Test(expected = Test.None.class) + public void testPostRelease_success() throws BadResponseException, JsonProcessingException { + String mockResponse = "{\"status\": \"success\", \"message\": \"corys cool\"}"; + + stubFor(post(urlEqualTo("/v1/release-orders")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + client.postRelease(new SniroConductorRequest()); + } + + @Test(expected = BadResponseException.class) + public void testPostRelease_error_failed() throws BadResponseException, JsonProcessingException { + String mockResponse = "{\"status\": \"failure\", \"message\": \"corys cool\"}"; + + stubFor(post(urlEqualTo("/v1/release-orders")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + client.postRelease(new SniroConductorRequest()); + } + + @Test(expected = BadResponseException.class) + public void testPostRelease_error_noStatus() throws BadResponseException, JsonProcessingException { + String mockResponse = "{\"status\": \"\", \"message\": \"corys cool\"}"; + + stubFor(post(urlEqualTo("/v1/release-orders")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + client.postRelease(new SniroConductorRequest()); + + } + + @Test(expected = BadResponseException.class) + public void testPostRelease_error_noMessage() throws BadResponseException, JsonProcessingException { + String mockResponse = "{\"status\": \"failure\", \"message\": null}"; + + stubFor(post(urlEqualTo("/v1/release-orders")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + client.postRelease(new SniroConductorRequest()); + + } + + @Test(expected = BadResponseException.class) + public void testPostRelease_error_empty() throws BadResponseException, JsonProcessingException { + String mockResponse = "{ }"; + + stubFor(post(urlEqualTo("/v1/release-orders")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + client.postRelease(new SniroConductorRequest()); + + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml new file mode 100644 index 0000000000..34079bd23f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml @@ -0,0 +1,75 @@ + + mtn6 + 0422ffb57ba042c0800a29dc85ca70f8 + 8d35a433-c1db-4d54-a611-6de10aeb76f9 + Dev_Bindings_1802_1311 + CONTRAIL30_BASIC + f1fc12e8-afe4-4716-954d-ed4d21a480ad + CONTRAIL + + tbd + + + + true + false + + 2001:051111 + EXPORT + + + 1000:051113 + IMPORT + + + 1000:051112 + BOTH + + + 1000:051115 + EXPORT + + + 1000:051114 + IMPORT + + default-domain:ECOMP_MSO_DND:MSOPolicyD + default-domain:ECOMP_MSO_DND:MSOPolicyC + + + + + 107.118.41.3 + 107.118.41.45 + + 107.118.41.0/24 + true + 107.118.41.1 + 4 + 9dbb9e7e-fe18-421f-bad6-2305bd282471 + + true + + + + 107.118.42.3 + 107.118.42.45 + + 107.118.42.0/24 + true + 107.118.42.1 + 4 + 1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab + + true + + true + true + false + + 3d35ca0c-2da5-4f60-84d9-3e005de335c0 + f1d1c7da-fc42-4c31-866e-cfe963e55723 + + d4515ea9-2852-4d3a-b424-9d7b6cf69d8e + + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml new file mode 100644 index 0000000000..607dd5af92 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml @@ -0,0 +1,31 @@ + + d4515ea9-2852-4d3a-b424-9d7b6cf69d8e + true + default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_1311 + 8d35a433-c1db-4d54-a611-6de10aeb76f9 + Dev_Bindings_1802_1311/ecf7e197-72db-452e-9eda-253cb642c9b7 + b6a7820c-4734-4ef2-8a73-a22c824423fa + + mtn6 + f1fc12e8-afe4-4716-954d-ed4d21a480ad + + 3d35ca0c-2da5-4f60-84d9-3e005de335c0 + f1d1c7da-fc42-4c31-866e-cfe963e55723 + + true + Dev_Bindings_1802_1311/ecf7e197-72db-452e-9eda-253cb642c9b7 + CONTRAIL30_BASIC + b6a7820c-4734-4ef2-8a73-a22c824423fa + 0422ffb57ba042c0800a29dc85ca70f8 + + + + 9dbb9e7e-fe18-421f-bad6-2305bd282471 + 27d414c7-1076-4595-aa45-4717ee992cef + + + 1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab + db64710c-fbbc-4dc9-8109-3925b87268fa + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json new file mode 100644 index 0000000000..dda149a560 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json @@ -0,0 +1,10 @@ +{ + "networkTechnology": "NEUTRON", + "failIfExists": false, + "backout": true, + "networkParams": [], + "msoRequest": {}, + "contrailRequest": false, + "skipAAI": false, + "synchronous": true +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json new file mode 100644 index 0000000000..d5d234cbf6 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json @@ -0,0 +1,226 @@ +{ + "sharedNetwork": false, + "boundToVpn": false, + "externalNetwork": false, + "providerNetwork": false, + "network-id": "TEST_NETWORK_ID", + "cascaded": false, + "cloud-params": null, + "network-name": "TEST_NETWORK_NAME", + "is-bound-to-vpn": false, + "service-id": null, + "network-role-instance": null, + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "widget-model-id": null, + "widget-model-version": null, + "physical-network-name": null, + "is-provider-network": false, + "is-shared-network": false, + "is-external-network": false, + "self-link": null, + "operational-status": null, + "subnets": { + "subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497", + "host-routes": { + "host-route": [ + { + "host-route-id": "400d286b-7e44-4514-b9b3-f70f7360ff32", + "route-prefix": "172.20.1.0/24", + "next-hop": "10.102.200.1", + "next-hop-type": "ip-address", + "resource-version": "1505857300987" + }, + { + "host-route-id": "6f038013-8b15-4eb8-914b-507489fbc8ee", + "route-prefix": "10.102.0.0/16", + "next-hop": "10.102.200.1", + "next-hop-type": "ip-address", + "resource-version": "1505857301151" + }, + { + "host-route-id": "8811c5f8-f1ed-4fa0-a505-e1be60396e28", + "route-prefix": "192.168.2.0/25", + "next-hop": "10.102.200.1", + "resource-version": "1505857301954" + } + ] + } + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + } + ] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + } + ] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + } + ] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ + { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + } + ], + "related-to-property": [ + { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + } + ] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ + { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + } + ], + "related-to-property": [ + { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + } + ] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ + { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + } + ], + "related-to-property": [ + { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + } + ] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ + { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + } + ], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + { + "property-key": "vpn-binding.vpn-type" + } + ] + } + ] + }, + "ctag-assignments": [ + ], + "segmentation-assignments": [ + ], + "model-info-network": null +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json new file mode 100644 index 0000000000..aa6320801e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json @@ -0,0 +1,216 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": { + "subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497", + "host-routes": { + "host-route": [ + { + "host-route-id": "400d286b-7e44-4514-b9b3-f70f7360ff32", + "route-prefix": "172.20.1.0/24", + "next-hop": "10.102.200.1", + "next-hop-type": "ip-address", + "resource-version": "1505857300987" + }, + { + "host-route-id": "6f038013-8b15-4eb8-914b-507489fbc8ee", + "route-prefix": "10.102.0.0/16", + "next-hop": "10.102.200.1", + "next-hop-type": "ip-address", + "resource-version": "1505857301151" + }, + { + "host-route-id": "8811c5f8-f1ed-4fa0-a505-e1be60396e28", + "route-prefix": "192.168.2.0/25", + "next-hop": "10.102.200.1", + "resource-version": "1505857301954" + } + ] + } + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + } + ] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + } + ] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + } + ] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ + { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + } + ], + "related-to-property": [ + { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + } + ] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ + { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + } + ], + "related-to-property": [ + { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + } + ] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ + { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + } + ], + "related-to-property": [ + { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + } + ] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ + { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + } + ], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + { + "property-key": "vpn-binding.vpn-type" + } + ] + } + ] + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json new file mode 100644 index 0000000000..5addff2d70 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json @@ -0,0 +1,596 @@ +{ + "cloud-owner": "att-aic", + "cloud-region-id": "mtn6", + "cloud-type": "openstack", + "owner-defined-type": "LCP", + "cloud-region-version": "3.0", + "cloud-zone": "AUS1", + "complex-name": "mtn6", + "resource-version": "1485202577", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-125" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2002" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-126" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0509A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0511C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_1Bindings_324_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-155" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "ST-MTN6-NoBinding-1707-18-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1710-4001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-119" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "aaaa-bbbb-cccc-dddd-eeee" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "direct_dhcp_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512B" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-1Binding-1710-0814-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-MTN6-NoBinding-1707-20-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1111-2222-3333-4444-5555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "dev_Bindings_full_1710_0907A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "wwww-xxxx-yyyy-zzzz" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-1002" + }] + }, + { + "related-to": "complex", + "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR", + "relationship-data": [ { + "relationship-key": "complex.physical-location-id", + "relationship-value": "AUSTTXGR" + }] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json new file mode 100644 index 0000000000..fadbf9c244 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json @@ -0,0 +1,596 @@ +{ + "cloud-owner": "att-aic", + "cloud-region-id": "mtn6", + "cloud-type": "openstack", + "owner-defined-type": "LCP", + "cloud-region-version": "2.5", + "cloud-zone": "AUS1", + "complex-name": "mtn6", + "resource-version": "1485202577", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-125" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2002" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-126" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0509A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0511C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_1Bindings_324_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-155" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "ST-MTN6-NoBinding-1707-18-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1710-4001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-119" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "aaaa-bbbb-cccc-dddd-eeee" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "direct_dhcp_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512B" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-1Binding-1710-0814-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-MTN6-NoBinding-1707-20-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1111-2222-3333-4444-5555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "dev_Bindings_full_1710_0907A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "wwww-xxxx-yyyy-zzzz" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-1002" + }] + }, + { + "related-to": "complex", + "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR", + "relationship-data": [ { + "relationship-key": "complex.physical-location-id", + "relationship-value": "AUSTTXGR" + }] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json new file mode 100644 index 0000000000..97611c1d62 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json @@ -0,0 +1,596 @@ +{ + "cloud-owner": "att-aic", + "cloud-region-id": "ERROR", + "cloud-type": "openstack", + "owner-defined-type": "LCP", + "cloud-region-version": "3.0", + "cloud-zone": "AUS1", + "complex-name": "mtn6", + "resource-version": "1485202577", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-125" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2002" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-126" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0509A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0511C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_1Bindings_324_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-155" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "ST-MTN6-NoBinding-1707-18-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1710-4001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-119" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "aaaa-bbbb-cccc-dddd-eeee" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "direct_dhcp_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512B" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-1Binding-1710-0814-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-MTN6-NoBinding-1707-20-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1111-2222-3333-4444-5555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "dev_Bindings_full_1710_0907A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "wwww-xxxx-yyyy-zzzz" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-1002" + }] + }, + { + "related-to": "complex", + "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR", + "relationship-data": [ { + "relationship-key": "complex.physical-location-id", + "relationship-value": "AUSTTXGR" + }] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json new file mode 100644 index 0000000000..181494dff2 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json @@ -0,0 +1,141 @@ +{ + "network-id": "467e3349-bec1-4922-bcb1-d0bb041bce30", + "network-name": "vprobes_pktinternal_net_4_1806", + "network-type": "CONTRAIL30_BASIC", + "network-role": "NetworkPktinternalInt2.pktinternal_int", + "network-technology": "", + "is-bound-to-vpn": false, + "service-id": "eb68dedb-840d-4bd4-a745-d9fcd8fc8468", + "network-role-instance": 0, + "resource-version": "1527285069624", + "orchestration-status": "Assigned", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": false, + "is-external-network": false, + "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/eb68dedb-840d-4bd4-a745-d9fcd8fc8468/service-data/networks/network/467e3349-bec1-4922-bcb1-d0bb041bce30/network-data/network-topology/", + "subnets": { + "subnet": [ + { + "subnet-id": "46aee427-3aa0-4c1f-beb6-edf6caae2dc1", + "subnet-name": "vprobes_pktinternal_net_4_1806_subnet_1", + "gateway-address": "192.168.224.1", + "network-start-address": "192.168.224.0", + "cidr-mask": "21", + "ip-version": "4", + "orchestration-status": "PendingCreate", + "dhcp-enabled": false, + "dhcp-start": "192.168.224.3", + "dhcp-end": "192.168.224.5", + "subnet-role": "DHCP", + "ip-assignment-direction": "true", + "resource-version": "1527285068387", + "host-routes": { + "host-route": [ + { + "host-route-id": "1de02743-580a-4f99-8285-3ba6eadb0892", + "route-prefix": "", + "next-hop": "", + "resource-version": "1527285059650" + } + ] + } + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Mobility/service-instances/service-instance/eb68dedb-840d-4bd4-a745-d9fcd8fc8468", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "Mobility" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "eb68dedb-840d-4bd4-a745-d9fcd8fc8468" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "eb68dedb-840d-4bd4-a745-d9fcd8fc8468" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "DYH1A" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type", + "property-value": "lcp" + } + ] + }, + { + "related-to": "tenant", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A/tenants/tenant/2871503957144f72b3cf481b379828ec", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "DYH1A" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "2871503957144f72b3cf481b379828ec" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "APP-C-24595-T-IST-04A" + } + ] + }, + { + "related-to": "vpn-binding", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/vpn-bindings/vpn-binding/13e94b71-3ce1-4988-ab0e-61208fc91f1c", + "relationship-data": [ + { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "13e94b71-3ce1-4988-ab0e-61208fc91f1c" + } + ], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "vMDNS" + }, + { + "property-key": "vpn-binding.vpn-type" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json new file mode 100644 index 0000000000..b22f389c40 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json @@ -0,0 +1,166 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": {"subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497" + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ]}, + "relationship-list": {"relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + }] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + }] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8" + } + ], + "related-to-property": [ { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + }] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + }], + "related-to-property": [ { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + }] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + }], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + {"property-key": "vpn-binding.vpn-type"} + ] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json new file mode 100644 index 0000000000..c581e54ef0 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json @@ -0,0 +1,53 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": {"subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497" + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ]}, + "relationship-list": {"relationship": [] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json new file mode 100644 index 0000000000..5d9231d4c6 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json @@ -0,0 +1,891 @@ +{ + "vpn-id": "13e94b71-3ce1-4988-ab0e-61208fc91f1c", + "vpn-name": "vMDNS", + "resource-version": "1510956324462", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/b3376949-5487-4a74-9029-332c07720c07", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b3376949-5487-4a74-9029-332c07720c07" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_hsl_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/d0b8ecd3-aee4-48ba-8bc5-222d3fb08162", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d0b8ecd3-aee4-48ba-8bc5-222d3fb08162" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/34305bd0-ad54-4349-8567-6f65ea09e750", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "34305bd0-ad54-4349-8567-6f65ea09e750" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vEPDG-FN_swu_direct_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/dfa4972a-ed82-43cd-98be-ed73bb3406a9", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "dfa4972a-ed82-43cd-98be-ed73bb3406a9" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_EXN_INTERNET_NET_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/93556256-aa23-449d-a2fd-3a9c034f232a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "93556256-aa23-449d-a2fd-3a9c034f232a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_CORE-NSD-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/7ce01c3a-5998-4908-85f6-ab29bc507a92", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7ce01c3a-5998-4908-85f6-ab29bc507a92" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKEN_CORE-NSD-TOAM0_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/016d3722-999b-4133-b4e6-8a1088bab664", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "016d3722-999b-4133-b4e6-8a1088bab664" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND-vepdg-FN-Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/80038196-9eae-452c-ad06-1f3fef1bef9f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "80038196-9eae-452c-ad06-1f3fef1bef9f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VPMS-FN-26071-T-BE-01_cdr_direct_net420" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f5f38447-dc62-4969-90a3-c60474f9c0ac", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f5f38447-dc62-4969-90a3-c60474f9c0ac" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_3" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/58b374aa-01ca-4a39-99b9-889c2f7ae908", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "58b374aa-01ca-4a39-99b9-889c2f7ae908" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_OAM_MGMT_NET_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/efe0dfca-18e7-4992-a63a-041b9f8271e0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "efe0dfca-18e7-4992-a63a-041b9f8271e0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_APN-dns_int_apn_dns_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/dab7e704-6a6e-4c53-9a80-fb5857a43b6f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "dab7e704-6a6e-4c53-9a80-fb5857a43b6f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKEN_CORE-NSD-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/634653b3-9084-41d9-ad6a-40863a3d666f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "634653b3-9084-41d9-ad6a-40863a3d666f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-01A_int_fw_dns_trusted_net_5" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6117b35e-c029-4308-85e6-007c24014484", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6117b35e-c029-4308-85e6-007c24014484" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-D-T001_vprobes_int_mgmt_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/eb1ce51b-d10f-4b08-9166-345335b9f73b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "eb1ce51b-d10f-4b08-9166-345335b9f73b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_OAMP_NSD_ISBC0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/468f83be-4abb-4901-950b-e399b77a09a0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "468f83be-4abb-4901-950b-e399b77a09a0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_IRPR-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/103d17dc-6575-427c-a2c1-301493e08ec0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "103d17dc-6575-427c-a2c1-301493e08ec0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_segw_hsl_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/305214f8-64be-4209-8a0d-10b6dfb77dd1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "305214f8-64be-4209-8a0d-10b6dfb77dd1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vMDS_FN_int_fw_dns_trusted_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/7989a6d2-ba10-4a5d-8f15-4520bc833090", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7989a6d2-ba10-4a5d-8f15-4520bc833090" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02AShared_cor_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f040ebf4-76ad-4b05-a766-1deec26549ae", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f040ebf4-76ad-4b05-a766-1deec26549ae" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_gn_untrusted_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/26d6038b-4b9e-4fe5-bcff-9af7586651cc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "26d6038b-4b9e-4fe5-bcff-9af7586651cc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-D-T001_vprobes_pktinternal_net_10" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/9e78d3f4-85b5-40b8-803e-c3a0ab6d6165", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9e78d3f4-85b5-40b8-803e-c3a0ab6d6165" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_MNS_Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/a2de22f9-eb91-452e-aff5-e81a1a679ef6", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "a2de22f9-eb91-452e-aff5-e81a1a679ef6" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_GN_DIRECT_NET_01" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6d6b7254-72d2-4731-80d6-8e8375d959e9", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6d6b7254-72d2-4731-80d6-8e8375d959e9" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_VDBE-PED-DMZ0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/21819ac4-95c4-490f-ba7c-0ad92920f805", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "21819ac4-95c4-490f-ba7c-0ad92920f805" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_FN_int_pktinternal_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/98ff6827-320a-4b71-bd2b-df2bd20b6855", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "98ff6827-320a-4b71-bd2b-df2bd20b6855" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_oam_protected_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/e229ab86-279c-4505-a08a-91e373293e20", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e229ab86-279c-4505-a08a-91e373293e20" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_OAM_DIRECT_NET_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/bb722f93-2d1a-42a5-bd11-57ad30ff1085", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "bb722f93-2d1a-42a5-bd11-57ad30ff1085" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_segw_hsl_direct_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0399443d-1fc6-42a6-934c-77030d751916", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0399443d-1fc6-42a6-934c-77030d751916" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VDBE-PED-DMZ0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/d259ec74-304d-4bd2-bbd6-93c201acba42", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d259ec74-304d-4bd2-bbd6-93c201acba42" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A__vprobes_int_mgmt_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f69fb458-e2bd-4d0f-9a47-430d18cbebfd", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f69fb458-e2bd-4d0f-9a47-430d18cbebfd" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VPMS-FN-26071-T-BE-01_cdr_direct_net4" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0f18b91f-ee79-403b-a081-8c0a89650641", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0f18b91f-ee79-403b-a081-8c0a89650641" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VPMS-FN_int_pktinternal_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/90fdbbbb-42bb-41ff-9356-db245466a4fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "90fdbbbb-42bb-41ff-9356-db245466a4fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_oam_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0e66adce-d5dd-4968-bcb2-83f0281424db", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0e66adce-d5dd-4968-bcb2-83f0281424db" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKEN_VDBF-MIS-UDAT0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/db572383-dbd7-4d5e-93cb-8c7c1d209a90", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "db572383-dbd7-4d5e-93cb-8c7c1d209a90" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_TRST_VIF_ISBC0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/478b7f86-8544-48e5-95f1-568dfd18730d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "478b7f86-8544-48e5-95f1-568dfd18730d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_GN_DIRECT_NET_01" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0f725895-5224-4016-b49a-d9d016eaafff", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0f725895-5224-4016-b49a-d9d016eaafff" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/9cd47b0c-ee58-46f0-9ec5-b4db504dd59b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9cd47b0c-ee58-46f0-9ec5-b4db504dd59b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-FN-25180-T-01Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f95259c9-f5c6-4861-a9f4-b6eec199b33f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f95259c9-f5c6-4861-a9f4-b6eec199b33f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/caf98ee4-2496-4c92-a41c-b6a50efcc29f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "caf98ee4-2496-4c92-a41c-b6a50efcc29f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_MGM-CORE-NSD-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/754739cb-5371-4d5b-a02a-489587d17443", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "754739cb-5371-4d5b-a02a-489587d17443" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_4" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8cd7add8-0cfc-4f65-bbf8-d0f25a0dbc70", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8cd7add8-0cfc-4f65-bbf8-d0f25a0dbc70" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VDBE-MIS-UDAT0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/7093921f-bed8-4866-bb3c-a2b8c376ca69", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7093921f-bed8-4866-bb3c-a2b8c376ca69" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_VIRPR-TDAT0_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/691da8b2-805e-4dd1-aaf5-b0e37414c662", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "691da8b2-805e-4dd1-aaf5-b0e37414c662" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_int_pktmirror_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/00eaa0b3-90df-4b43-a850-9d30abb7fded", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "00eaa0b3-90df-4b43-a850-9d30abb7fded" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-01AShared_oam_protected_net_5" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6ba57200-c61a-46be-821b-88b3fa169b66", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ba57200-c61a-46be-821b-88b3fa169b66" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_3" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8e32ec2c-47a1-4514-b21a-2806e23f0437", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8e32ec2c-47a1-4514-b21a-2806e23f0437" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKENb_VDBF-PSD-DMZ0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/a755ddd0-512a-444d-9f38-97b3eff70f85", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "a755ddd0-512a-444d-9f38-97b3eff70f85" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_UNTR_VSE_ISBC0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c7bde85d-1c12-467c-ae6f-57bdf5c1d380", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7bde85d-1c12-467c-ae6f-57bdf5c1d380" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKENb_VDBF-PSD-DMZ0_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0933fcec-9e78-4045-a21a-8258e18cb78e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0933fcec-9e78-4045-a21a-8258e18cb78e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vdbe_oam_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6a26a729-d9ce-4619-a20e-38597205ba7d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6a26a729-d9ce-4619-a20e-38597205ba7d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_swu_direct_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c1a06665-518b-408b-bfe0-8f393204baf6", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1a06665-518b-408b-bfe0-8f393204baf6" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/fb51398b-7622-4570-9bd6-e29c82621d44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb51398b-7622-4570-9bd6-e29c82621d44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_4" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/92072731-1c40-45c2-a218-5e75b713b312", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92072731-1c40-45c2-a218-5e75b713b312" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_TRST_VIF_ISBC0_net_0001" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c6d94632-fd6b-4bfe-993e-377b0368476b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c6d94632-fd6b-4bfe-993e-377b0368476b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-01AShared_int_ha_net_5" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/84516ef3-e371-4039-908e-83cd2b55a4a1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "84516ef3-e371-4039-908e-83cd2b55a4a1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "VPMS-FN-26071-T-BE-01_vprobes_int_mgmt_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/2c4f3adc-1a45-4484-8fb6-9eeac99eb922", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "2c4f3adc-1a45-4484-8fb6-9eeac99eb922" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_VDBE-MIS-UDAT0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/1fea0624-dac2-4997-904d-34ca1bc12fa9", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1fea0624-dac2-4997-904d-34ca1bc12fa9" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02AShared_cps_internal_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8ab98982-05b7-45b2-828d-648da3d6cc0f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8ab98982-05b7-45b2-828d-648da3d6cc0f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_swu_direct_fn_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c8934d59-24a8-41cc-af9d-2026ef261843", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c8934d59-24a8-41cc-af9d-2026ef261843" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_oam_protected_net_vrar_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c741fe5b-bf27-4ad9-b30d-20518e115495", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c741fe5b-bf27-4ad9-b30d-20518e115495" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_int_apn_dns_fn_net_PB_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8285fbae-ec25-44f7-ac52-89a968d45a2b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8285fbae-ec25-44f7-ac52-89a968d45a2b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-T2B_vEPDG-FN_swu_direct_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/65e6d4b0-0c96-4bfa-bdd6-2baa16df322a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65e6d4b0-0c96-4bfa-bdd6-2baa16df322a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vEPDG-FN_gn_untrusted_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/38e51c7b-adc2-491a-a036-3189645b007c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "38e51c7b-adc2-491a-a036-3189645b007c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vprobes_pktinternal_net_2_1806" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/4d210b09-b6ce-41b3-95a6-5e4dffea9ca2", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4d210b09-b6ce-41b3-95a6-5e4dffea9ca2" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vprobes_pktinternal_net_3_1806" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c5df1c57-3c85-4abc-973f-a1ffb13e391a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c5df1c57-3c85-4abc-973f-a1ffb13e391a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/467e3349-bec1-4922-bcb1-d0bb041bce30", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "467e3349-bec1-4922-bcb1-d0bb041bce30" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vprobes_pktinternal_net_4_1806" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/1596f4d2-66b5-4627-96f2-c26794154530", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1596f4d2-66b5-4627-96f2-c26794154530" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_2" + }] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml new file mode 100644 index 0000000000..6dd91c64c9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml @@ -0,0 +1,145 @@ + + 8d35a433-c1db-4d54-a611-6de10aeb76f9 + Dev_Bindings_1802_1311 + CONTRAIL30_BASIC + GN_EVPN_direct + contrail + true + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + 1517430804756 + pending-create + tbd + true + true + false + + + 9dbb9e7e-fe18-421f-bad6-2305bd282471 + + 107.118.41.1 + 107.118.41.0 + 24 + 4 + pending-create + true + 107.118.41.3 + 107.118.41.45 + + true + 1517430804770 + + + 1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab + + 107.118.42.1 + 107.118.42.0 + 24 + 4 + pending-create + true + 107.118.42.3 + 107.118.42.45 + + true + 1517430804782 + + + + + service-instance + /aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/f1d1c7da-fc42-4c31-866e-cfe963e55723 + + customer.global-customer-id + MSO_1610_dev + + + service-subscription.service-type + MSO-dev-service-type + + + service-instance.service-instance-id + f1d1c7da-fc42-4c31-866e-cfe963e55723 + + + service-instance.service-instance-name + MSO-DEV-SI-1802-v6-1-31-nwk1 + + + + cloud-region + /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6 + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + cloud-region.owner-defined-type + LCP + + + + tenant + /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8 + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + tenant.tenant-id + 0422ffb57ba042c0800a29dc85ca70f8 + + + tenant.tenant-name + ECOMP_MSO_DND + + + + network-policy + /aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc + + network-policy.network-policy-id + 0219d83f-7c4a-48e2-b8fc-9b20459356bc + + + network-policy.network-policy-fqdn + default-domain:ECOMP_MSO_DND:MSOPolicyD + + + + network-policy + /aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64 + + network-policy.network-policy-id + e7a3560c-8b29-4611-a404-83af0b31ce64 + + + network-policy.network-policy-fqdn + default-domain:ECOMP_MSO_DND:MSOPolicyC + + + + vpn-binding + /aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001 + + vpn-binding.vpn-id + 9a7b327d9-287aa00-82c4b0-100001 + + + vpn-binding.vpn-name + MSO_VPN_TEST + + + vpn-binding.vpn-type + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json new file mode 100644 index 0000000000..f076c9044c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json @@ -0,0 +1,162 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": {"subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497" + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ]}, + "relationship-list": {"relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + }] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + }] + }, + { + "related-to": "vf-module", + "related-link": "aai/v11/network/generic-vnfs/generic-vnf/105df7e5-0b3b-49f7-a837-4864b62827c4/vf-modules/vf-module/d9217058-95a0-49ee-b9a9-949259e89349", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "105df7e5-0b3b-49f7-a837-4864b62827c4" + }, + { + "relationship-key": "vf-module.vf-module-id", + "relationship-value": "d9217058-95a0-49ee-b9a9-949259e89349" + } + ], + "related-to-property": [ { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + }] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + }], + "related-to-property": [ { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + }] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + }], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + {"property-key": "vpn-binding.vpn-type"} + ] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml new file mode 100644 index 0000000000..92fec2dc64 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml @@ -0,0 +1,149 @@ + + 8d35a433-c1db-4d54-a611-6de10aeb76f9 + Dev_Bindings_1802_1311 + CONTRAIL30_BASIC + GN_EVPN_direct + contrail + b6a7820c-4734-4ef2-8a73-a22c824423fa + true + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + 1517430804756 + Created + Dev_Bindings_1802_1311/ecf7e197-72db-452e-9eda-253cb642c9b7 + default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_1311 + tbd + true + true + false + + + 9dbb9e7e-fe18-421f-bad6-2305bd282471 + 27d414c7-1076-4595-aa45-4717ee992cef + 107.118.41.1 + 107.118.41.0 + 24 + 4 + Created + true + 107.118.41.3 + 107.118.41.45 + 1517430804770 + + true + + + 1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab + db64710c-fbbc-4dc9-8109-3925b87268fa + 107.118.42.1 + 107.118.42.0 + 24 + 4 + Created + true + 107.118.42.3 + 107.118.42.45 + 1517430804782 + + true + + + + + service-instance + /aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/f1d1c7da-fc42-4c31-866e-cfe963e55723 + + customer.global-customer-id + MSO_1610_dev + + + service-subscription.service-type + MSO-dev-service-type + + + service-instance.service-instance-id + f1d1c7da-fc42-4c31-866e-cfe963e55723 + + + service-instance.service-instance-name + MSO-DEV-SI-1802-v6-1-31-nwk1 + + + + cloud-region + /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6 + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + cloud-region.owner-defined-type + LCP + + + + tenant + /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8 + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + tenant.tenant-id + 0422ffb57ba042c0800a29dc85ca70f8 + + + tenant.tenant-name + ECOMP_MSO_DND + + + + network-policy + /aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc + + network-policy.network-policy-id + 0219d83f-7c4a-48e2-b8fc-9b20459356bc + + + network-policy.network-policy-fqdn + default-domain:ECOMP_MSO_DND:MSOPolicyD + + + + network-policy + /aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64 + + network-policy.network-policy-id + e7a3560c-8b29-4611-a404-83af0b31ce64 + + + network-policy.network-policy-fqdn + default-domain:ECOMP_MSO_DND:MSOPolicyC + + + + vpn-binding + /aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001 + + vpn-binding.vpn-id + 9a7b327d9-287aa00-82c4b0-100001 + + + vpn-binding.vpn-name + MSO_VPN_TEST + + + vpn-binding.vpn-type + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/bbNetwork.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/bbNetwork.json new file mode 100644 index 0000000000..75ecffb85f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/bbNetwork.json @@ -0,0 +1,87 @@ +{ + "externalNetwork": false, + "sharedNetwork": false, + "providerNetwork": false, + "boundToVpn": false, + "network-id": "e87e6df5-6f9b-4aa1-a832-68a42c4277eb", + "cascaded": false, + "cloud-params": { + + }, + "network-name": "APP-C-24595-T-IST-04AShared_data_vDB_net_1", + "neutron-network-id": null, + "network-type": "CONTRAIL30_BASIC", + "network-technology": "contrail", + "network-role": "DataEvaletNetwork.data", + "is-bound-to-vpn": false, + "service-id": "94508dbd-fe6e-496b-95ef-dd5612b56767", + "network-role-instance": 0, + "orchestration-status": "ASSIGNED", + "heat-stack-id": null, + "contrail-network-fqdn": null, + "network-policies": [], + "contrail-network-route-table-references": [], + "widget-model-id": null, + "widget-model-version": null, + "physical-network-name": "FALSE", + "is-provider-network": false, + "is-shared-network": false, + "is-external-network": false, + "self-link": "restconf/config/GENERIC-RESOURCE-API:services/service/94508dbd-fe6e-496b-95ef-dd5612b56767/service-data/networks/network/e87e6df5-6f9b-4aa1-a832-68a42c4277eb/network-data/network-topology/", + "operational-status": null, + "subnets": [ + { + "subnet-id": "95069612-23af-4181-bf99-8b2bd6096712", + "subnet-name": "APP-C-24595-T-IST-04AShared_data_vDB_net_1_subnet_1", + "neutron-subnet-id": null, + "gateway-address": "107.244.64.1", + "network-start-address": "107.244.64.2", + "cidr-mask": "20", + "ip-version": "4", + "orchestration-status": null, + "dhcp-enabled": false, + "dhcp-start": "", + "dhcp-end": "", + "subnet-role": "", + "ip-assignment-direction": "true", + "subnet-sequence": null, + "host-routes": [] + } + ], + "ctag-assignments": [], + "segmentation-assignments": [], + "model-info-network": { + "created": 1509357220000, + "modelInstanceName": "CONTRAIL30_BASIC", + "networkType": "BASIC", + "modelCustomizationUUID": "8edf06ef-fd40-42cf-a054-0fc09108d3f0", + "modelUUID": "2920cd06-f585-436b-a002-c3081f6a91b3", + "modelName": "CONTRAIL30_BASIC", + "modelVersion": "3.0", + "modelInvariantUUID": "56f4e746-c58e-4b76-93d4-6717b8f59205", + "networkRole": "DataEvaletNetwork.data", + "neutronNetworkType": "BASIC", + "toscaNodeType": "org.openecomp.resource.vl.CONTRAIL30_BASIC1", + "description": "Basic contrail 3.0.x L3 network for AIC 3.x sites. Keeping for existing mobility networks. ", + "orchestrationMode": "HEAT", + "aicVersionMin": "3.0", + "aicVersionMax": null, + "networkScope": "Service", + "networkTechnology": "contrail", + "model-customization-uuid": "8edf06ef-fd40-42cf-a054-0fc09108d3f0", + "model-instance-name": "CONTRAIL30_BASIC", + "network-technology": "contrail", + "network-type": "BASIC", + "network-scope": "Service", + "network-role": "DataEvaletNetwork.data", + "model-version": "3.0", + "model-invariant-uuid": "56f4e746-c58e-4b76-93d4-6717b8f59205", + "model-name": "CONTRAIL30_BASIC", + "model-uuid": "2920cd06-f585-436b-a002-c3081f6a91b3", + "neutron-network-type": "BASIC", + "aic-version-min": "3.0", + "aic-version-max": null, + "orchestration-mode": "HEAT", + "tosca-node-type": "org.openecomp.resource.vl.CONTRAIL30_BASIC1" + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json new file mode 100644 index 0000000000..087f8a3971 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json @@ -0,0 +1,42 @@ +{ + "cloudSiteId": "cloudRegionPo", + "tenantId": "testTenantId", + "networkId": "e87e6df5-6f9b-4aa1-a832-68a42c4277eb", + "networkName": "APP-C-24595-T-IST-04AShared_data_vDB_net_1", + "networkType": "CONTRAIL30_BASIC", + "modelCustomizationUuid": "8edf06ef-fd40-42cf-a054-0fc09108d3f0", + "networkTechnology": "NEUTRON", + "subnets": [ + { + "subnetName": "APP-C-24595-T-IST-04AShared_data_vDB_net_1_subnet_1", + "subnetId": "95069612-23af-4181-bf99-8b2bd6096712", + "cidr": "107.244.64.2/20", + "gatewayIp": "107.244.64.1", + "ipVersion": "4", + "enableDHCP": false, + "addrFromStart": true, + "hostRoutes": [] + } + ], + "providerVlanNetwork": { + "physicalNetworkName": "FALSE", + "vlans": [] + }, + "contrailNetwork": { + "shared": "false", + "external": "false", + "routeTargets": [], + "policyFqdns": [], + "routeTableFqdns": [] + }, + "failIfExists": true, + "backout": false, + "msoRequest": { + "requestId": "6cfde724-76c7-4747-bcb3-67a59a46ca95", + "serviceInstanceId": "testServiceInstanceId1" + }, + "contrailRequest": false, + "skipAAI": true, + "messageId": "175264dc-fb6b-4aae-ba42-8c77a63fec12", + "synchronous": true +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json new file mode 100644 index 0000000000..4817dfb74d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json @@ -0,0 +1,153 @@ +{ + "requestContext" : { + "product-family-id" : "e433710f-9217-458d-a79d-1c7aff376d89", + "source" : "VID", + "requestor-id" : "rk627c", + "subscription-service-type" : null, + "user-params" : null, + "action" : "createInstance", + "callback-url" : null, + "service-uri" : null, + "mso-request-id" : "91135621-cadd-4195-a11b-c9db9eb1629e", + "requestParameters" : { } + }, + "orchContext" : { + "is-rollback-enabled" : false + }, + "userInput" : null, + "serviceInstance" : { + "service-instance-id" : "94508dbd-fe6e-496b-95ef-dd5612b56767", + "service-instance-name" : "data_eValet_network_rk_01", + "orchestration-status" : "ACTIVE", + "owning-entity" : { + "owning-entity-id" : "e4257a94-21cc-40c5-adc9-e6f4ff868e31", + "owning-entity-name" : "MOBILITY-CORE" + }, + "project" : { + "project-name" : "USP" + }, + "collection" : null, + "vnfs" : [ ], + "pnfs" : [ ], + "allotted-resources" : [ ], + "networks" : [ { + "network-id" : "e87e6df5-6f9b-4aa1-a832-68a42c4277eb", + "cascaded" : false, + "cloud-params" : { }, + "network-name" : "APP-C-24595-T-IST-04AShared_data_vDB_net_1", + "neutron-network-id" : null, + "network-type" : "CONTRAIL30_BASIC", + "network-technology" : "contrail", + "network-role" : "DataEvaletNetwork.data", + "is-bound-to-vpn" : false, + "service-id" : "94508dbd-fe6e-496b-95ef-dd5612b56767", + "network-role-instance" : 0, + "orchestration-status" : "ASSIGNED", + "heat-stack-id" : null, + "contrail-network-fqdn" : null, + "network-policies" : [ ], + "contrail-network-route-table-references" : [ ], + "widget-model-id" : null, + "widget-model-version" : null, + "physical-network-name" : "FALSE", + "is-provider-network" : false, + "is-shared-network" : false, + "is-external-network" : false, + "self-link" : "restconf/config/GENERIC-RESOURCE-API:services/service/94508dbd-fe6e-496b-95ef-dd5612b56767/service-data/networks/network/e87e6df5-6f9b-4aa1-a832-68a42c4277eb/network-data/network-topology/", + "operational-status" : null, + "subnets" : [ { + "subnet-id" : "95069612-23af-4181-bf99-8b2bd6096712", + "subnet-name" : "APP-C-24595-T-IST-04AShared_data_vDB_net_1_subnet_1", + "neutron-subnet-id" : null, + "gateway-address" : "107.244.64.1", + "network-start-address" : "107.244.64.2", + "cidr-mask" : "20", + "ip-version" : "4", + "orchestration-status" : null, + "dhcp-enabled" : false, + "dhcp-start" : "", + "dhcp-end" : "", + "subnet-role" : "", + "ip-assignment-direction" : "true", + "subnet-sequence" : null, + "host-routes" : [ ] + } ], + "ctag-assignments" : [ ], + "segmentation-assignments" : [ ], + "model-info-network" : { + "created" : 1509357220000, + "modelInstanceName" : "CONTRAIL30_BASIC", + "networkType" : "BASIC", + "modelCustomizationUUID" : "8edf06ef-fd40-42cf-a054-0fc09108d3f0", + "modelUUID" : "2920cd06-f585-436b-a002-c3081f6a91b3", + "modelName" : "CONTRAIL30_BASIC", + "modelVersion" : "3.0", + "modelInvariantUUID" : "56f4e746-c58e-4b76-93d4-6717b8f59205", + "networkRole" : "DataEvaletNetwork.data", + "neutronNetworkType" : "BASIC", + "toscaNodeType" : "org.openecomp.resource.vl.CONTRAIL30_BASIC1", + "description" : "Basic contrail 3.0.x L3 network for AIC 3.x sites. Keeping for existing mobility networks. ", + "orchestrationMode" : "HEAT", + "aicVersionMin" : "3.0", + "aicVersionMax" : null, + "networkScope" : "Service", + "networkTechnology" : "contrail", + "model-customization-uuid" : "8edf06ef-fd40-42cf-a054-0fc09108d3f0", + "model-instance-name" : "CONTRAIL30_BASIC", + "network-technology" : "contrail", + "network-type" : "BASIC", + "network-scope" : "Service", + "network-role" : "DataEvaletNetwork.data", + "model-version" : "3.0", + "model-invariant-uuid" : "56f4e746-c58e-4b76-93d4-6717b8f59205", + "model-name" : "CONTRAIL30_BASIC", + "model-uuid" : "2920cd06-f585-436b-a002-c3081f6a91b3", + "neutron-network-type" : "BASIC", + "aic-version-min" : "3.0", + "aic-version-max" : null, + "orchestration-mode" : "HEAT", + "tosca-node-type" : "org.openecomp.resource.vl.CONTRAIL30_BASIC1" + } + } ], + "vpn-bonding-links" : [ ], + "vhn-portal-url" : null, + "service-instance-location-id" : null, + "selflink" : "restconf/config/GENERIC-RESOURCE-API:services/service/94508dbd-fe6e-496b-95ef-dd5612b56767/service-data/service-topology/", + "metadata" : null, + "configurations" : null, + "solution-info" : null, + "model-info-service-instance" : { + "model-customization-uuid" : null, + "model-invariant-uuid" : "97386301-3685-46b5-8a5a-bf113eb9a006", + "model-uuid" : "4d6f5876-7f3d-458e-9722-33af804ee717", + "model-version" : "1.0", + "model-instance-name" : null, + "model-name" : "data_eValet_network", + "description" : "data model", + "created" : "Thu Jul 05 19:48:51 GMT 2018", + "service-type" : "vUSP", + "service-role" : "data", + "environment-context" : "General_Revenue-Bearing", + "workload-context" : "Production" + } + }, + "cloudRegion" : { + "lcp-cloud-region-id" : "DYH1A", + "cloud-owner" : "att-aic", + "tenant-id" : "7f3db563322146a688601ade1294a749", + "complex" : "c1", + "cloud-region-version" : "aic3.0" + }, + "customer" : { + "global-customer-id" : "e433710f-9217-458d-a79d-1c7aff376d89", + "subscriber-name" : "USP VOICE", + "subscriber-type" : "INFRA", + "subscriber-common-site-id" : null, + "service-subscription" : { + "service-type" : "VIRTUAL USP", + "temp-ub-sub-account-id" : null, + "service-instances" : [ ] + }, + "vpn-bindings" : [ ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/queryAAINetwork.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/queryAAINetwork.json new file mode 100644 index 0000000000..36bc04b6c6 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/queryAAINetwork.json @@ -0,0 +1,141 @@ +{ + "network-id": "e87e6df5-6f9b-4aa1-a832-68a42c4277eb", + "network-name": "APP-C-24595-T-IST-04AShared_data_vDB_net_1", + "network-type": "CONTRAIL30_BASIC", + "network-role": "DataEvaletNetwork.data", + "network-technology": "contrail", + "is-bound-to-vpn": false, + "service-id": "94508dbd-fe6e-496b-95ef-dd5612b56767", + "network-role-instance": 0, + "resource-version": "1531421309278", + "orchestration-status": "Assigned", + "physical-network-name": "FALSE", + "is-provider-network": false, + "is-shared-network": false, + "is-external-network": false, + "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/94508dbd-fe6e-496b-95ef-dd5612b56767/service-data/networks/network/e87e6df5-6f9b-4aa1-a832-68a42c4277eb/network-data/network-topology/", + "subnets": { + "subnet": [ + { + "subnet-id": "95069612-23af-4181-bf99-8b2bd6096712", + "subnet-name": "APP-C-24595-T-IST-04AShared_data_vDB_net_1_subnet_1", + "gateway-address": "107.244.64.1", + "network-start-address": "107.244.64.2", + "cidr-mask": "20", + "ip-version": "4", + "orchestration-status": "PendingCreate", + "dhcp-enabled": false, + "dhcp-start": "", + "dhcp-end": "", + "subnet-role": "", + "ip-assignment-direction": "true", + "resource-version": "1531421308312", + "host-routes": { + "host-route": [ + { + "host-route-id": "1047bf36-ca6c-49de-8b7a-8aa7b766a96d", + "route-prefix": "", + "next-hop": "", + "resource-version": "1531421301537" + } + ] + } + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v13/business/customers/customer/e433710f-9217-458d-a79d-1c7aff376d89/service-subscriptions/service-subscription/VIRTUAL%20USP/service-instances/service-instance/94508dbd-fe6e-496b-95ef-dd5612b56767", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "e433710f-9217-458d-a79d-1c7aff376d89" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "VIRTUAL USP" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "94508dbd-fe6e-496b-95ef-dd5612b56767" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "data_eValet_network_rk_01" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "DYH1A" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type", + "property-value": "lcp" + } + ] + }, + { + "related-to": "tenant", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A/tenants/tenant/7f3db563322146a688601ade1294a749", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "DYH1A" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "7f3db563322146a688601ade1294a749" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "APP-C-24595-T-IST-04B" + } + ] + }, + { + "related-to": "vpn-binding", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/network/vpn-bindings/vpn-binding/13e94b71-3ce1-4988-ab0e-61208fc91f1c", + "relationship-data": [ + { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "13e94b71-3ce1-4988-ab0e-61208fc91f1c" + } + ], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "vMDNS" + }, + { + "property-key": "vpn-binding.vpn-type" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json new file mode 100644 index 0000000000..ba7ab9e3b8 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json @@ -0,0 +1,6 @@ +{ + "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, + "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, + "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, + "licenseInfo" : [] +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json new file mode 100644 index 0000000000..c5d0ffe38d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json @@ -0,0 +1,6 @@ +{ + "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, + "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, + "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"},{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"},{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, + "licenseInfo" : [] +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiCtagAssingmentsMapped_to_aai.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiCtagAssingmentsMapped_to_aai.json new file mode 100644 index 0000000000..7d26ab975b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiCtagAssingmentsMapped_to_aai.json @@ -0,0 +1,7 @@ +{ + "ctagAssignment" : [ { + "vlanIdInner" : 1, + "resourceVersion" : null, + "relationshipList" : null + } ] +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped.json new file mode 100644 index 0000000000..81362e3dca --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped.json @@ -0,0 +1,20 @@ +{ + "networkId": "networkId", + "networkName": "networkName", + "neutronNetworkId": "neutronNetworkId", + "isBoundToVpn": false, + "serviceId": "serviceId", + "networkRoleInstance": 0, + "orchestrationStatus": "Assigned", + "heatStackId": "heatStackId", + "contrailNetworkFqdn": "contrailNetworkFqdn", + "modelInvariantId": "modelInvariantUUID", + "modelVersionId": "modelUUID", + "modelCustomizationId": "modelCustomizationUUID", + "physicalNetworkName": "physicalNetworkName", + "isProviderNetwork": false, + "isSharedNetwork": false, + "isExternalNetwork": false, + "selflink": "selflink", + "operationalStatus": "operationalStatus" +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped_to_aai.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped_to_aai.json new file mode 100644 index 0000000000..7a30ade095 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped_to_aai.json @@ -0,0 +1,118 @@ +{ + "networkId" : "TESTING_ID", + "networkName" : "TESTING_NAME", + "networkType" : "CONTRAIL_EXTERNAL", + "networkRole" : "dmz_direct", + "networkTechnology" : "contrail", + "neutronNetworkId" : null, + "isBoundToVpn" : false, + "serviceId" : "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "networkRoleInstance" : 1, + "resourceVersion" : null, + "orchestrationStatus" : "Created", + "heatStackId" : "heatStack_id", + "msoCatalogKey" : null, + "contrailNetworkFqdn" : "contrailNetwork_fqdn", + "modelInvariantId" : "modelInvariant_id", + "modelVersionId" : "modelCustomization_id", + "personaModelVersion" : null, + "modelCustomizationId" : "modelCustomization_id", + "widgetModelId" : "widgetModel_id", + "widgetModelVersion" : "widgetModel_version", + "physicalNetworkName" : "physicalNetwork_name", + "isProviderNetwork" : false, + "isSharedNetwork" : false, + "isExternalNetwork" : false, + "selflink" : "self_link", + "operationalStatus" : "operationalStatus", + "subnets" : { + "subnet" : [ { + "subnetId" : "57e9a1ff-d14f-4071-a828-b19ae98eb2fc", + "subnetName" : "subnetName", + "neutronSubnetId" : null, + "gatewayAddress" : "192.168.52.1", + "networkStartAddress" : null, + "cidrMask" : "24", + "ipVersion" : "4", + "orchestrationStatus" : "Created", + "dhcpEnabled" : true, + "dhcpStart" : "dhcpStart", + "dhcpEnd" : "dhcpEnd", + "subnetRole" : "subnetRole", + "ipAssignmentDirection" : "true", + "resourceVersion" : null, + "subnetSequence" : 3, + "hostRoutes" : { + "hostRoute" : [ { + "hostRouteId" : "string", + "routePrefix" : "192.10.16.0/24", + "nextHop" : "192.10.16.100/24", + "nextHopType" : "ip-address", + "resourceVersion" : null, + "relationshipList" : null + }, { + "hostRouteId" : "string", + "routePrefix" : "192.110.17.0/24", + "nextHop" : "192.110.17.110/24", + "nextHopType" : "ip-address", + "resourceVersion" : null, + "relationshipList" : null + } ] + }, + "relationshipList" : null + }, { + "subnetId" : "57e9a1ff-d14f-4071-a828-b19ae98eb2fc", + "subnetName" : "subnetName", + "neutronSubnetId" : null, + "gatewayAddress" : "192.168.52.1", + "networkStartAddress" : null, + "cidrMask" : "24", + "ipVersion" : "4", + "orchestrationStatus" : "Created", + "dhcpEnabled" : true, + "dhcpStart" : "dhcpStart", + "dhcpEnd" : "dhcpEnd", + "subnetRole" : "subnetRole", + "ipAssignmentDirection" : "true", + "resourceVersion" : null, + "subnetSequence" : 3, + "hostRoutes" : { + "hostRoute" : [ { + "hostRouteId" : "string", + "routePrefix" : "192.10.16.0/24", + "nextHop" : "192.10.16.100/24", + "nextHopType" : "ip-address", + "resourceVersion" : null, + "relationshipList" : null + }, { + "hostRouteId" : "string", + "routePrefix" : "192.110.17.0/24", + "nextHop" : "192.110.17.110/24", + "nextHopType" : "ip-address", + "resourceVersion" : null, + "relationshipList" : null + } ] + }, + "relationshipList" : null + } ] + }, + "ctagAssignments" : { + "ctagAssignment" : [ { + "vlanIdInner" : 1, + "resourceVersion" : null, + "relationshipList" : null + } ] + }, + "segmentationAssignments" : { + "segmentationAssignment" : [ { + "segmentationId" : "segmentationId1", + "resourceVersion" : null, + "relationshipList" : null + }, { + "segmentationId" : "segmentationId2", + "resourceVersion" : null, + "relationshipList" : null + } ] + }, + "relationshipList" : null +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiQueryAAIResponse-Wrapper.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiQueryAAIResponse-Wrapper.json new file mode 100644 index 0000000000..b22f389c40 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiQueryAAIResponse-Wrapper.json @@ -0,0 +1,166 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": {"subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497" + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ]}, + "relationship-list": {"relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + }] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + }] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8" + } + ], + "related-to-property": [ { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + }] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + }], + "related-to-property": [ { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + }] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + }], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + {"property-key": "vpn-binding.vpn-type"} + ] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSegmentationAssignmentsMapped_to_aai.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSegmentationAssignmentsMapped_to_aai.json new file mode 100644 index 0000000000..9da44edd74 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSegmentationAssignmentsMapped_to_aai.json @@ -0,0 +1,11 @@ +{ + "segmentationAssignment" : [ { + "segmentationId" : "segmentationId1", + "resourceVersion" : null, + "relationshipList" : null + }, { + "segmentationId" : "segmentationId2", + "resourceVersion" : null, + "relationshipList" : null + } ] +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSubnetsMapped_to_aai.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSubnetsMapped_to_aai.json new file mode 100644 index 0000000000..4046348673 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSubnetsMapped_to_aai.json @@ -0,0 +1,71 @@ +{ + "subnet" : [ { + "subnetId" : "57e9a1ff-d14f-4071-a828-b19ae98eb2fc", + "subnetName" : "subnetName", + "neutronSubnetId" : null, + "gatewayAddress" : "192.168.52.1", + "networkStartAddress" : null, + "cidrMask" : "24", + "ipVersion" : "4", + "orchestrationStatus" : "Created", + "dhcpEnabled" : true, + "dhcpStart" : "dhcpStart", + "dhcpEnd" : "dhcpEnd", + "subnetRole" : "subnetRole", + "ipAssignmentDirection" : "true", + "resourceVersion" : null, + "subnetSequence" : 3, + "hostRoutes" : { + "hostRoute" : [ { + "hostRouteId" : "string", + "routePrefix" : "192.10.16.0/24", + "nextHop" : "192.10.16.100/24", + "nextHopType" : "ip-address", + "resourceVersion" : null, + "relationshipList" : null + }, { + "hostRouteId" : "string", + "routePrefix" : "192.110.17.0/24", + "nextHop" : "192.110.17.110/24", + "nextHopType" : "ip-address", + "resourceVersion" : null, + "relationshipList" : null + } ] + }, + "relationshipList" : null + }, { + "subnetId" : "57e9a1ff-d14f-4071-a828-b19ae98eb2fc", + "subnetName" : "subnetName", + "neutronSubnetId" : null, + "gatewayAddress" : "192.168.52.1", + "networkStartAddress" : null, + "cidrMask" : "24", + "ipVersion" : "4", + "orchestrationStatus" : "Created", + "dhcpEnabled" : true, + "dhcpStart" : "dhcpStart", + "dhcpEnd" : "dhcpEnd", + "subnetRole" : "subnetRole", + "ipAssignmentDirection" : "true", + "resourceVersion" : null, + "subnetSequence" : 3, + "hostRoutes" : { + "hostRoute" : [ { + "hostRouteId" : "string", + "routePrefix" : "192.10.16.0/24", + "nextHop" : "192.10.16.100/24", + "nextHopType" : "ip-address", + "resourceVersion" : null, + "relationshipList" : null + }, { + "hostRouteId" : "string", + "routePrefix" : "192.110.17.0/24", + "nextHop" : "192.110.17.110/24", + "nextHopType" : "ip-address", + "resourceVersion" : null, + "relationshipList" : null + } ] + }, + "relationshipList" : null + } ] +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleMap.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleMap.json new file mode 100644 index 0000000000..09ec71f0aa --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleMap.json @@ -0,0 +1,12 @@ +{ + + "modelCustomizationId" : "f", + "vfModuleId" : "a", + "vfModuleName" : "b", + "modelInvariantId" : "g", + "modelVersionId" : "h", + "orchestrationStatus" : "Assigned", + "personaModelVersion" : "g", + "isBaseVfModule" : false + +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/catalogResp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/catalogResp.json new file mode 100644 index 0000000000..09026d1d8c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/catalogResp.json @@ -0,0 +1,47 @@ +{ + "serviceResources": { + "serviceType": null, + "serviceAllottedResources": [], + "modelInfo": { + "modelInvariantUuid": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", + "modelName": "ADIOD vRouter vCE 011017 Service", + "modelVersion": "5.0", + "modelUuid": "2f7f309d-c842-4644-a2e4-34167be5eeb4" + }, + "serviceRole": null, + "serviceVnfs": [ + { + "toscaNodeType": "org.openecomp.resource.vf.AdiodVce", + "vfModules": [ + { + "initialCount": null, + "vfModuleLabel": null, + "modelInfo": { + "modelInvariantUuid": "7fb428e1-8000-4800-a71a-f21b946973c5", + "modelName": "AdiodVce..base_vCE..module-0", + "modelVersion": "2", + "modelCustomizationUuid": "1126e7e2-b377-4fd2-ad48-660a20caa829", + "modelUuid": "435d57e1-93a2-4d58-aa5d-f2df2d126276" + }, + "hasVolumeGroup": true, + "isBase": true + } + ], + "modelInfo": { + "modelInvariantUuid": "fc72435b-4366-4257-a2f7-c70a3a998a7b", + "modelName": "ADIoD vCE", + "modelVersion": "2.0", + "modelCustomizationUuid": "bdaeed40-c964-4966-bdb8-51320dcaf587", + "modelInstanceName": "ADIoD vCE 0", + "modelUuid": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1" + }, + "nfRole": "", + "nfType": "", + "nfFunction": "", + "nfNamingCode": "", + "multiStageDesign": "N" + } + ], + "serviceNetworks": [] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json new file mode 100644 index 0000000000..9c50c2f11b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json @@ -0,0 +1,7 @@ +{ + "model-name" : "modelName", + "model-version" : "modelVersion", + "model-customization-uuid" : null, + "model-uuid" : "modelUuid", + "model-invariant-uuid" : "modelInvariantUuid" +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json new file mode 100644 index 0000000000..cc32040f38 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json @@ -0,0 +1,53 @@ +{ + "service-information" : { + "onap-model-information" : { + "model-name" : "modelName", + "model-version" : "modelVersion", + "model-customization-uuid" : null, + "model-uuid" : "modelUuid", + "model-invariant-uuid" : "modelInvariantUuid" + }, + "subscriber-name" : null, + "subscription-service-type" : "productFamilyId", + "service-id" : null, + "global-customer-id" : "globalCustomerId", + "service-instance-id" : null + }, + "network-request-input" : { + "aic-clli" : null, + "aic-cloud-region" : null, + "tenant" : null, + "network-input-parameters" : { + "param" : [ { + "name" : "key1", + "value" : "value1" + } ] + }, + "network-name" : "TEST_NETWORK_NAME", + "network-instance-group-id" : "networkInstanceGroupId" + }, + "request-information" : { + "notification-url" : null, + "order-version" : null, + "request-action" : "CreateNetworkInstance", + "source" : "MSO", + "request-id" : "sdncReqId", + "order-number" : null + }, + "sdnc-request-header" : { + "svc-request-id" : "svcRequestId", + "svc-notification-url" : null, + "svc-action" : "assign" + }, + "network-information" : { + "onap-model-information" : { + "model-name" : "modelName", + "model-version" : "modelVersion", + "model-customization-uuid" : "modelCustomizationUUID", + "model-uuid" : "modelUuid", + "model-invariant-uuid" : "modelInvariantUuid" + }, + "network-id" : "TEST_NETWORK_ID", + "network-type" : null + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json new file mode 100644 index 0000000000..40946725d9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json @@ -0,0 +1,52 @@ +{ + "service-information" : { + "onap-model-information" : { + "model-name" : "modelName", + "model-version" : "modelVersion", + "model-customization-uuid" : null, + "model-uuid" : "modelUuid", + "model-invariant-uuid" : "modelInvariantUuid" + }, + "subscriber-name" : null, + "subscription-service-type" : "productFamilyId", + "service-id" : null, + "global-customer-id" : "globalCustomerId", + "service-instance-id" : null + }, + "network-request-input" : { + "aic-clli" : null, + "aic-cloud-region" : null, + "tenant" : null, + "network-input-parameters" : { + "param" : [ { + "name" : "key1", + "value" : "value1" + } ] + }, + "network-instance-group-id" : "networkInstanceGroupId" + }, + "request-information" : { + "notification-url" : null, + "order-version" : null, + "request-action" : "CreateNetworkInstance", + "source" : "MSO", + "request-id" : "sdncReqId", + "order-number" : null + }, + "sdnc-request-header" : { + "svc-request-id" : "svcRequestId", + "svc-notification-url" : null, + "svc-action" : "assign" + }, + "network-information" : { + "onap-model-information" : { + "model-name" : "modelName", + "model-version" : "modelVersion", + "model-customization-uuid" : "modelCustomizationUUID", + "model-uuid" : "modelUuid", + "model-invariant-uuid" : "modelInvariantUuid" + }, + "network-id" : "TEST_NETWORK_ID", + "network-type" : null + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json new file mode 100644 index 0000000000..7ca8153def --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json @@ -0,0 +1,53 @@ +{ + "service-information" : { + "onap-model-information" : { + "model-name" : "modelName", + "model-version" : "modelVersion", + "model-customization-uuid" : null, + "model-uuid" : "modelUuid", + "model-invariant-uuid" : "modelInvariantUuid" + }, + "subscriber-name" : null, + "subscription-service-type" : "productFamilyId", + "service-id" : null, + "global-customer-id" : "globalCustomerId", + "service-instance-id" : null + }, + "network-request-input" : { + "aic-clli" : null, + "aic-cloud-region" : null, + "tenant" : null, + "network-input-parameters" : { + "param" : [ { + "name" : "key1", + "value" : "value1" + } ] + }, + "network-name" : "TEST_NETWORK_NAME", + "network-instance-group-id" : "networkInstanceGroupId" + }, + "request-information" : { + "notification-url" : null, + "order-version" : null, + "request-action" : "DeleteNetworkInstance", + "source" : "MSO", + "request-id" : "sdncReqId", + "order-number" : null + }, + "sdnc-request-header" : { + "svc-request-id" : "svcRequestId", + "svc-notification-url" : null, + "svc-action" : "unassign" + }, + "network-information" : { + "onap-model-information" : { + "model-name" : "modelName", + "model-version" : "modelVersion", + "model-customization-uuid" : "modelCustomizationUUID", + "model-uuid" : "modelUuid", + "model-invariant-uuid" : "modelInvariantUuid" + }, + "network-id" : "TEST_NETWORK_ID", + "network-type" : null + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json new file mode 100644 index 0000000000..4231152d86 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json @@ -0,0 +1,69 @@ +{ + "service-information" : { + "onap-model-information" : { + "model-name" : "serviceModelName", + "model-version" : "serviceModelVersion", + "model-customization-uuid" : null, + "model-uuid" : "serviceModelUuid", + "model-invariant-uuid" : "serviceModelInvariantUuid" + }, + "subscriber-name" : null, + "subscription-service-type" : "productFamilyId", + "service-id" : "serviceInstanceId", + "global-customer-id" : "globalCustomerId", + "service-instance-id" : "serviceInstanceId" + }, + "vf-module-request-input" : { + "aic-clli" : null, + "aic-cloud-region" : null, + "tenant" : null, + "vf-module-input-parameters" : { + "param" : [ { + "name" : "key1", + "value" : "value1" + }, + { + "name" : "volume-group-id", + "value" : "volumeGroupId" + } ] + }, + "vf-module-name" : "testVfModuleName" + }, + "request-information" : { + "request-action" : "CreateVfModuleInstance", + "source" : "MSO", + "request-id" : "sdncReqId", + "order-number" : null, + "order-version" : null, + "notification-url" : null + }, + "sdnc-request-header" : { + "svc-request-id" : "svcRequestId", + "svc-notification-url" : null, + "svc-action" : "assign" + }, + "vf-module-information" : { + "onap-model-information" : { + "model-name" : "vfModuleModelName", + "model-version" : "vfModuleModelVersion", + "model-customization-uuid" : "vfModuleModelCustomizationUuid", + "model-uuid" : "vfModuleModelUuid", + "model-invariant-uuid" : "vfModuleModelInvariantUuid" + }, + "vf-module-id" : "testVfModuleId", + "vf-module-type": "vfModuleModelName" + + }, + "vnf-information" : { + "onap-model-information" : { + "model-name" : "vnfModelName", + "model-version" : "vnfModelVersion", + "model-customization-uuid" : "vnfModelCustomizationUuid", + "model-uuid" : "vnfModelUuid", + "model-invariant-uuid" : "vnfModelInvariantUuid" + }, + "vnf-id" : "testVnfId", + "vnf-type" : "testVnfType", + "vnf-name" : "testVnfName" + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json new file mode 100644 index 0000000000..64192ff8d0 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json @@ -0,0 +1,30 @@ +{ + "service-information" : { + "service-instance-id" : "serviceInstanceId", + "service-id" : "serviceInstanceId" + }, + "vf-module-request-input" : { + "vf-module-name" : "testVfModuleName", + "vf-module-input-parameters" : {} + }, + "request-information" : { + "request-action" : "DeleteVfModuleInstance", + "source" : "MSO", + "request-id" : "sdncReqId", + "order-number" : null, + "order-version" : null, + "notification-url" : null + }, + "sdnc-request-header" : { + "svc-request-id" : "svcRequestId", + "svc-notification-url" : null, + "svc-action" : "unassign" + }, + "vf-module-information" : { + "vf-module-id" : "testVfModuleId" + }, + "vnf-information" : { + "vnf-id" : "testVnfId", + "vnf-type" : "testVnfType" + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json new file mode 100644 index 0000000000..1497286a1b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json @@ -0,0 +1,241 @@ +{ + "vf-module-assignments": + { + "vms": + { + "vm": + [ + { + "vm-type": "vmType0", + "vm-names": + { + "vm-name": + [ + "vmName0", + "vmName1" + ], + + "vnfc-names": + [ + { + "vnfc-name": "vnfcName0", + "vnfc-networks": + { + "vnfc-network-data": + [ + { + "vnfc-network-role": "vnfcNetworkRole0", + "vnfc-type": "fw", + "vnfc-ports": + { + "vnfc-port": + [ + { + "vnfc-port-id": "01", + "common-sub-interface-role": "ctrl", + "vnic-sub-interfaces": + { + "sub-interface-network-data": + [ + { + "network-id": "networkId0", + "network-name": 1, + "vlan-tag-id": 1, + "network-information-items": + { + "network-information-item": + [ + { + "ip-version": "ipv4", + "network-ips": + { + "network-ip": + [ + "ip0", + "ip1" + ] + } + }, + + { + "ip-version": "ipv6", + "network-ips": + { + "network-ip": + [ + "ip0", + "ip1" + ] + } + } + ] + }, + + "floating-ips": + { + "floating-ip-v4": + [ + "floatingIpV40", + "floatingIpV41" + ], + + "floating-ip-v6": + [ + "floatingIpV60", + "floatingIpV61" + ] + } + } + ] + } + } + ] + } + } + ] + } + } + ] + }, + + "vm-networks": + { + "vm-network": + [ + { + "network-role": "vmNetworkRole0", + "floating-ips": + { + "floating-ip-v4": + [ + "floatingIpV40", + "floatingIpV41" + ], + + "floating-ip-v6": + [ + "floatingIpV60", + "floatingIpV61" + ] + }, + + "interface-route-prefixes": + { + "interface-route-prefix": + [ + "interfaceRoutePrefix0", + "interfaceRoutePrefix1" + ] + }, + + "sriov-parameters": + { + "heat-vlan-filters": + { + "heat-vlan-filter": + [ + "heatVlanFilter0", + "heatVlanFilter1" + ] + } + }, + + "network-information-items": + { + "network-information-item": + [ + { + "network-ips": + { + "network-ip": + [ + "ip0", + "ip1" + ] + }, + + "ip-version": "ipv4" + }, + + { + "network-ips": + { + "network-ip": + [ + "ip2", + "ip3" + ] + }, + + "ip-version": "ipv6" + } + ] + } + } + ] + } + } + ] + } + }, + + "vf-module-parameters": + { + "param": + [ + { + "name": "paramOne", + "value": "paramOneValue", + "resource-resolution-data": + { + "resource-key": + [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + + "status": "status", + "capability-name": "capabilityName" + } + }, + + { + "name": "paramTwo", + "value": "paramTwoValue", + "resource-resolution-data": + { + "resource-key": + [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + + "status": "status", + "capability-name": "capabilityName" + } + }, + + { + "name": "paramThree", + "value": "paramThreeValue", + "resource-resolution-data": + { + "resource-key": + [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + + "status": "status", + "capability-name": "capabilityName" + } + } + ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json new file mode 100644 index 0000000000..2a8acb927e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json @@ -0,0 +1,243 @@ +{ + "vf-module-assignments": + { + "vms": + { + "vm": + [ + { + "vm-type": "vmType0", + "vm-names": + { + "vm-name": + [ + "vmName0", + "vmName1" + ], + + "vnfc-names": + [ + { + "vnfc-name": "vnfcName0", + "vnfc-networks": + { + "vnfc-network-data": + [ + { + "vnfc-network-role": "vnfcNetworkRole0", + "vnfc-type": "fw", + "vnfc-ports": + { + "vnfc-port": + [ + { + "vnfc-port-id": "01", + "common-sub-interface-role": "ctrl", + "vnic-sub-interfaces": + { + "sub-interface-network-data": + [ + { + "network-id": "networkId0", + "network-name": 1, + "vlan-tag-id": 1, + "network-information-items": + { + "network-information-item": + [ + { + "ip-version": "ipv4", + "network-ips": + { + "network-ip": + [ + "ip0", + "ip1" + ] + } + }, + + { + "ip-version": "ipv6", + "network-ips": + { + "network-ip": + [ + "ip0", + "ip1" + ] + } + } + ] + }, + + "floating-ips": + { + "floating-ip-v4": + [ + "floatingIpV40", + "floatingIpV41" + ], + + "floating-ip-v6": + [ + "floatingIpV60", + "floatingIpV61" + ] + } + } + ] + } + } + ] + } + } + ] + } + } + ] + }, + + "vm-networks": + { + "vm-network": + [ + { + "network-role": "vmNetworkRole0", + "floating-ips": + { + "floating-ip-v4": + [ + "floatingIpV40", + "floatingIpV41" + ], + + "floating-ip-v6": + [ + "floatingIpV60", + "floatingIpV61" + ] + }, + + "interface-route-prefixes": + { + "interface-route-prefix": + [ + "interfaceRoutePrefix0", + "interfaceRoutePrefix1" + ] + }, + + "sriov-parameters": + { + "heat-vlan-filters": + { + "heat-vlan-filter": + [ + "heatVlanFilter0", + "heatVlanFilter1" + ] + } + }, + + "network-information-items": + { + "network-information-item": + [ + { + "network-ips": + { + "network-ip": + [ + "ip0", + "ip1" + ] + }, + + "ip-version": "ipv4" + }, + + { + "network-ips": + { + "network-ip": + [ + "ip2", + "ip3" + ] + }, + + "ip-version": "ipv6" + } + ] + } + } + ] + } + } + ] + } + }, + + "vf-module-parameters": + { + "param": + [ + { + "name": "paramOne", + "value": "paramOneValue", + "resource-resolution-data": + { + "resource-key": + [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + + "status": "status", + "capability-name": "capabilityName" + } + }, + + { + "name": "paramTwo", + "value": "paramTwoValue", + "resource-resolution-data": + { + "resource-key": + [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + + "status": "status", + "capability-name": "capabilityName" + } + }, + + { + "name": "paramThree", + "value": "paramThreeValue", + "resource-resolution-data": + { + "resource-key": + [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + + "status": "status", + "capability-name": "capabilityName" + } + } + ] + }, + + "sdnc-generated-cloud-resources": "true" +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json new file mode 100644 index 0000000000..2c7728397f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json @@ -0,0 +1,68 @@ +{ + "vnf-resource-assignments": + { + "availability-zones": + { + "availability-zone": + [ + "zone0", + "zone1", + "zone2" + ] + }, + + "vnf-networks": + { + "vnf-network": + [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": + { + "subnet-data": + [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0", + "dhcp-enabled" : "Y" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId1", + "dhcp-enabled" : "Y" + } + ] + } + } + ] + } + }, + + "vnf-parameters-data": + { + "param": + [ + { + "name": "key1", + "value": "value1" + } + ] + }, + + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": + { + + }, + + "onap-model-information": + { + + }, + + "aic-cloud-region": "" +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json new file mode 100644 index 0000000000..a302777810 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json @@ -0,0 +1,68 @@ +{ + "vnf-resource-assignments": + { + "availability-zones": + { + "availability-zone": + [ + "zone0", + "zone1", + "zone2" + ] + }, + + "vnf-networks": + { + "vnf-network": + [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": + { + "subnet-data": + [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0", + "dhcp-enabled" : "N" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId1", + "dhcp-enabled" : "N" + } + ] + } + } + ] + } + }, + + "vnf-parameters-data": + { + "param": + [ + { + "name": "key1", + "value": "value1" + } + ] + }, + + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": + { + + }, + + "onap-model-information": + { + + }, + + "aic-cloud-region": "" +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json new file mode 100644 index 0000000000..67c095a217 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json @@ -0,0 +1,88 @@ +{ + "vnf-resource-assignments": + { + "availability-zones": + { + "availability-zone": + [ + "zone0", + "zone1", + "zone2" + ] + }, + + "vnf-networks": + { + "vnf-network": + [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": + { + "subnet-data": + [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0", + "dhcp-enabled" : "Y" + }, + { + "ip-version": "ipv4", + "subnet-id": "subnetId1", + "dhcp-enabled" : "Y" + }, + { + "ip-version": "ipv4", + "subnet-id": "subnetId2", + "dhcp-enabled" : "Y" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId3", + "dhcp-enabled" : "N" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId4", + "dhcp-enabled" : "Y" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId5", + "dhcp-enabled" : "Y" + } + ] + } + } + ] + } + }, + + "vnf-parameters-data": + { + "param": + [ + { + "name": "key1", + "value": "value1" + } + ] + }, + + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": + { + + }, + + "onap-model-information": + { + + }, + + "aic-cloud-region": "" +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json new file mode 100644 index 0000000000..0047764713 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json @@ -0,0 +1,69 @@ +{ + "vnf-resource-assignments": + { + "availability-zones": + { + "availability-zone": + [ + "zone0", + "zone1", + "zone2" + ] + }, + + "vnf-networks": + { + "vnf-network": + [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": + { + "subnet-data": + [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0" + }, + + { + "ip-version": "ipv6", + "subnet-id": "subnetId1" + } + ] + } + } + ] + } + }, + + "vnf-parameters-data": + { + "param": + [ + { + "name": "key1", + "value": "value1" + } + ] + }, + + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": + { + + }, + + "onap-model-information": + { + + }, + + "aic-cloud-region": "", + + "sdnc-generated-cloud-resources": "true" +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf.json new file mode 100644 index 0000000000..53cd70c514 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf.json @@ -0,0 +1,113 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "complete", + "statusMessage": "success", + "solutions": { + "licenseSolutions": [ + { + "entitlementPoolUUID": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupUUID": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_primary_1", + "serviceResourceId": "testResourceIdAR" + }, + { + "entitlementPoolUUID": [ + "91d563e8-e714-4393-8f99-cc480144a05e", + "21d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupUUID": [ + "31d563e8-e714-4393-8f99-cc480144a05e", + "71d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_secondary_1", + "serviceResourceId": "testResourceIdVNF" + } + ], + "placementSolutions": [ + [ + { + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID1", + "serviceResourceId": "testResourceIdAR", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["testSIID1"] + }, + "assignmentInfo": [ + { + "key": "cloudOwner", + "value": "aic" + }, + { + "key": "vnfHostName", + "value": "MDTNJ01" + }, + { + "key": "isRehome", + "value": "False" + }, + { + "key": "locationId", + "value": "dfwtx" + } + ] + }, + { "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceResourceId": "testResourceIdAR2", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["testSIID2"] + }, + "assignmentInfo": [ + { + "key": "cloudOwner", + "value": "aic" + }, + { + "key": "vnfHostName", + "value": "testVnfHostname2" + }, + { + "key": "isRehome", + "value": "False" + }, + { + "key": "locationId", + "value": "testCloudRegionId2" + } + ] + }, + { + "resourceModuleName": "VNF", + "serviceResourceId": "testResourceIdVNF", + "solution": { + "identifierType": "cloudRegionId", + "cloudOwner": "aic", + "identifiers": [ + "testCloudRegionId3" + ] + }, + "assignmentInfo": [ + { + "key": "cloudOwner", + "value": "aic" + }, + { + "key": "locationId", + "value": "testCloudRegionId3" + }, + { "key":"flavors", + "value":{"flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}} + ] + } + ] + ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net.json new file mode 100644 index 0000000000..609d8924f7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net.json @@ -0,0 +1,119 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "completed", + "statusMessage": "success", + "solutions": { + "licenseSolutions": [ + { + "resourceModuleName": "vHNPortalaaS_primary_1", + "serviceResourceId": "testResourceIdAR", + "entitlementPoolUUID": ["f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e"], + "licenseKeyGroupUUID": ["s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e"], + "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] + }, + { + "resourceModuleName": "net", + "serviceResourceId": "testResourceIdNet2", + "entitlementPoolUUID": ["f1d563e8-e714-4393-8f99-cc480144a05n", + "j1d563e8-e714-4393-8f99-cc480144a05n"], + "licenseKeyGroupUUID": ["s1d563e8-e714-4393-8f99-cc480144a05n", + "b1d563e8-e714-4393-8f99-cc480144a05n"], + "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] + }, + { + "resourceModuleName": "vHNPortalaaS_secondary_1", + "serviceResourceId": "testResourceIdVNF", + "entitlementPoolUUID": ["91d563e8-e714-4393-8f99-cc480144a05e", + "21d563e8-e714-4393-8f99-cc480144a05e"], + "licenseKeyGroupUUID": [ "31d563e8-e714-4393-8f99-cc480144a05e", + "71d563e8-e714-4393-8f99-cc480144a05e"], + "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] + } + ], + "placementSolutions": [ + [ + { + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceResourceId": "testResourceIdAR", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["testSIID1"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "aic" }, + { "key": "vnfHostName", "value": "MDTNJ01" }, + { "key": "isRehome", "value": "False" }, + { "key": "locationId", "value": "dfwtx" } + ] + }, + { + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceResourceId": "testResourceIdAR2", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["testSIID2"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "aic" }, + { "key": "vnfHostName", "value": "testVnfHostname2" }, + { "key": "isRehome", "value": "False" }, + { "key": "locationId", "value": "testCloudRegionId2" } + ] + }, + { + "resourceModuleName": "NETWORK", + "serviceResourceId": "testResourceIdNet", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["testServiceInstanceIdNet"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "aic" }, + { "key": "vnfHostName", "value": "testVnfHostNameNet" }, + { "key": "isRehome", "value": "False" }, + { "key": "locationId", "value": "testCloudRegionIdNet" } + ] + }, + { + "resourceModuleName": "NETWORK", + "serviceResourceId": "testResourceIdNet2", + "solution": { + "identifierType": "cloudRegionId", + "cloudOwner": "aic", + "identifiers": ["testCloudRegionIdNet2"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "aic" }, + { "key": "locationId", "value": "testCloudRegionIdNet2" } + ] + }, + { + "resourceModuleName": "VNF", + "serviceResourceId": "testResourceIdVNF", + "solution": { + "identifierType": "cloudRegionId", + "cloudOwner": "aic", + "identifiers": ["testCloudRegionId3"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "aic" }, + { "key": "locationId", "value": "testCloudRegionId3" }, + { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}} + ] + } + ] + ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf.json new file mode 100644 index 0000000000..15e601bae8 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf.json @@ -0,0 +1,50 @@ +{ + "transactionId": "xxx-xxx-xxxx", + "requestId": "yyy-yyy-yyyy", + "requestStatus": "completed", + "statusMessage": "success", + "solutions": { + "placementSolutions": [ + [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "some_resource_id", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["gjhd-098-fhd-987"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "amazon" }, + { "key": "vnfHostName", "value": "ahr344gh" }, + { "key": "isRehome", "value": "False" }, + { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" } + ] + }, + { + "resourceModuleName": "vG", + "serviceResourceId": "some_resource_id", + "solution": { + "identifierType": "cloudRegionId", + "cloudOwner": "amazon", + "identifiers": ["gjhd-098-fhd-987"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "amazon" }, + { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" }, + { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}} + ] + } + ] + ], + "licenseSolutions": [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "some_resource_id", + "entitlementPoolUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] + } + ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound.json new file mode 100644 index 0000000000..2024df401b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound.json @@ -0,0 +1,18 @@ +{ + "plans":[ + { + "name":"356fdb73-cef2-4dda-8865-31fd6733d6e4", + "message":"Unable to find any candidate for demand vGW", + "links":[ + [ + { + "rel":"self", + "href":"http://172.17.0.6:8091/v1/plans/1c15e194-6df5-43fe-a5ff-42e6093b8ddd" + } + ] + ], + "id":"1c15e194-6df5-43fe-a5ff-42e6093b8ddd", + "status":"error" + } + ] +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException.json new file mode 100644 index 0000000000..b82688428e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException.json @@ -0,0 +1,9 @@ +{ + "requestError": { + "policyException": { + "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", + "text": "Message content size exceeds the allowable limit", + "messageId": "SVC0001" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException.json new file mode 100644 index 0000000000..338b689d2e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException.json @@ -0,0 +1,12 @@ +{ + "requestError": { + "serviceException": { + "variables": [ + "severity", 400 + ], + "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", + "text": "OOF PlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://192.168.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8", + "messageId": "SVC0001" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json new file mode 100644 index 0000000000..889431663d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json @@ -0,0 +1,47 @@ +{ + "serviceResources": { + "serviceType": null, + "serviceAllottedResources": [], + "modelInfo": { + "modelInvariantUuid": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", + "modelName": "ADIOD vRouter vCE 011017 Service", + "modelVersion": "5.0", + "modelUuid": "2f7f309d-c842-4644-a2e4-34167be5eeb4" + }, + "serviceRole": null, + "serviceVnfs": [ + { + "toscaNodeType": "org.openecomp.resource.vf.AdiodVce", + "vfModules": [ + { + "initialCount": null, + "vfModuleLabel": null, + "modelInfo": { + "modelInvariantUuid": "7fb428e1-8000-4800-a71a-f21b946973c5", + "modelName": "AdiodVce..base_vCE..module-0", + "modelVersion": "2", + "modelCustomizationUuid": "1126e7e2-b377-4fd2-ad48-660a20caa829", + "modelUuid": "435d57e1-93a2-4d58-aa5d-f2df2d126276" + }, + "hasVolumeGroup": true, + "isBase": true + } + ], + "modelInfo": { + "modelInvariantUuid": "fc72435b-4366-4257-a2f7-c70a3a998a7b", + "modelName": "ADIoD vCE", + "modelVersion": "2.0", + "modelCustomizationUuid": "bdaeed40-c964-4966-bdb8-51320dcaf587", + "modelInstanceName": "ADIoD vCE 0", + "modelUuid": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1" + }, + "nfRole": "", + "nfType": "", + "nfFunction": "ADIoDvCE", + "nfNamingCode": "", + "multiStageDesign": "N" + } + ], + "serviceNetworks": [] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest new file mode 100644 index 0000000000..42b2a0f24a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest @@ -0,0 +1,99 @@ +{ + "requestInfo": { + "transactionId": "testRequestId-xxx-xxx", + "requestId": "testRequestId-yyy-yyy", + "callbackUrl": "http://localhost:28090/workflows/messages/message/oofResponse/testRequestId", + "sourceId": "so", + "requestType": "create", + "numSolutions": 1, + "optimizers": ["placement"], + "timeout": 600 + }, + "placementInfo": { + "requestParameters": { "customerLatitude": 32.89748, "customerLongitude": -97.040443, "customerName": "xyz" }, + "placementDemands": [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "vGMuxInfra-xx", + "tenantId": "vGMuxInfra-tenant", + "resourceModelInfo": { + "modelInvariantId": "vGMuxInfra-modelInvariantId", + "modelVersionId": "vGMuxInfra-versionId", + "modelName": "vGMuxInfra-model", + "modelType": "resource", + "modelVersion": "1.0", + "modelCustomizationName": "vGMuxInfra-customeModelName" + } + }, + { + "resourceModuleName": "vG", + "serviceResourceId": "71d563e8-e714-4393-8f99-cc480144a05e", + "tenantId": "vG-tenant", + "resourceModelInfo": { + "modelInvariantId": "vG-modelInvariantId", + "modelVersionId": "vG-versionId", + "modelName": "vG-model", + "modelType": "resource", + "modelVersion": "1.0", + "modelCustomizationName": "vG-customeModelName" + }, + "existingCandidates": [ + { + "identifierType": "service_instance_id", + "cloudOwner": "", + "identifiers": ["gjhd-098-fhd-987"] + } + ], + "excludedCandidates": [ + { + "identifierType": "service_instance_id", + "cloudOwner": "", + "identifiers": ["gjhd-098-fhd-987"] + }, + { + "identifierType": "vimId", + "cloudOwner": "vmware", + "identifiers": ["NYMDT67"] + } + ], + "requiredCandidates": [ + { + "identifierType": "vimId", + "cloudOwner": "amazon", + "identifiers": ["TXAUS219"] + } + ] + } + ] + }, + "serviceInfo": { + "serviceInstanceId": "d61b2543-5914-4b8f-8e81-81e38575b8ec", + "serviceName": "vCPE", + "modelInfo": { + "modelInvariantId": "vCPE-invariantId", + "modelVersionId": "vCPE-versionId", + "modelName": "vCPE-model", + "modelType": "service", + "modelVersion": "1.0", + "modelCustomizationName": "" + } + }, + "licenseDemands": [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "vGMuxInfra-xx", + "resourceModelInfo": { + "modelInvariantId": "vGMuxInfra-modelInvariantId", + "modelVersionId": "vGMuxInfra-versionId", + "modelName": "vGMuxInfra-model", + "modelType": "resource", + "modelVersion": "1.0", + "modelCustomizationName": "" + }, + "existingLicenses": { + "entitlementPoolUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"], + "licenseKeyGroupUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"] + } + } + ] +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf new file mode 100644 index 0000000000..67c9fbedc9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf @@ -0,0 +1,56 @@ +{ + "requestInfo": { + "transactionId": "testRequestId", + "requestId": "testRequestId", + "callbackUrl": "http://localhost:28090/workflows/messages/message/oofResponse/testRequestId", + "sourceId": "so", + "requestType": "create", + "numSolutions": 1, + "optimizers": ["placement"], + "timeout": 600 }, + "placementInfo": { + "requestParameters": { + "customerLatitude": "32.89748", + "customerLongitude": "-97.040443", + "customerName": "xyz" }, + "subscriberInfo": { "globalSubscriberId": "SUB12_0322_DS_1201", + "subscriberName": "SUB_12_0322_DS_1201", + "subscriberCommonSiteId": "" }, + "placementDemands": [ + {"resourceModuleName": "VNF","serviceResourceId": "test-resource-id-000","tenantId": "null","resourceModelInfo": { + "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", + "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", + "modelName": "ADIoD vCE", + "modelType": "", + "modelVersion": "2.0", + "modelCustomizationName": "" }} + ] + }, + "serviceInfo": { + "serviceInstanceId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "serviceName": "null", + "modelInfo": { + "modelType": "", + "modelInvariantId": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", + "modelVersionId": "2f7f309d-c842-4644-a2e4-34167be5eeb4", + "modelName": "ADIOD vRouter vCE 011017 Service", + "modelVersion": "5.0", + "modelCustomizationName": "" + } + }, + "licenseInfo": { + "licenseDemands": [ + { +"resourceModuleName": "VNF", +"serviceResourceId": "test-resource-id-000", +"resourceInstanceType": "VNF", +"resourceModelInfo": { + "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", + "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", + "modelName": "ADIoD vCE", + "modelType": "", + "modelVersion": "2.0", + "modelCustomizationName": "" + } + }] + }} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAAICloudRegion.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAAICloudRegion.json new file mode 100644 index 0000000000..5addff2d70 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAAICloudRegion.json @@ -0,0 +1,596 @@ +{ + "cloud-owner": "att-aic", + "cloud-region-id": "mtn6", + "cloud-type": "openstack", + "owner-defined-type": "LCP", + "cloud-region-version": "3.0", + "cloud-zone": "AUS1", + "complex-name": "mtn6", + "resource-version": "1485202577", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-125" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2002" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-126" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0509A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0511C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_1Bindings_324_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-155" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "ST-MTN6-NoBinding-1707-18-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1710-4001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-119" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "aaaa-bbbb-cccc-dddd-eeee" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "direct_dhcp_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512B" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-1Binding-1710-0814-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-MTN6-NoBinding-1707-20-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1111-2222-3333-4444-5555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "dev_Bindings_full_1710_0907A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "wwww-xxxx-yyyy-zzzz" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-1002" + }] + }, + { + "related-to": "complex", + "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR", + "relationship-data": [ { + "relationship-key": "complex.physical-location-id", + "relationship-value": "AUSTTXGR" + }] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPolicy.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPolicy.json new file mode 100644 index 0000000000..b0fcb786c2 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPolicy.json @@ -0,0 +1,67 @@ +{ + "network-policy-id": "e7a3560c-8b29-4611-a404-83af0b31ce64", + "network-policy-fqdn": "default-domain:ECOMP_MSO_DND:MSOPolicyC", + "resource-version": "1517429966296", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da89d739-be28-4061-bf62-4a1a9171cbfb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da89d739-be28-4061-bf62-4a1a9171cbfb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1806_BB_it2_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1635f3ea-5821-4e1c-acad-a87a36b160b1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1635f3ea-5821-4e1c-acad-a87a36b160b1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1806_BB_it2_2" + }] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkTableRefs.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkTableRefs.json new file mode 100644 index 0000000000..8034614626 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkTableRefs.json @@ -0,0 +1,55 @@ +{ + "route-table-reference-id": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "route-table-reference-fqdn": "default-domain:ECOMP_MSO_DND:RTA", + "resource-version": "1517437770161", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da89d739-be28-4061-bf62-4a1a9171cbfb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da89d739-be28-4061-bf62-4a1a9171cbfb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1806_BB_it2_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1635f3ea-5821-4e1c-acad-a87a36b160b1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1635f3ea-5821-4e1c-acad-a87a36b160b1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1806_BB_it2_2" + }] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiVpnBinding.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiVpnBinding.json new file mode 100644 index 0000000000..86c5d8ea98 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiVpnBinding.json @@ -0,0 +1,106 @@ +{ + "vpn-id": "9a7b327d9-287aa00-82c4b0-100001", + "vpn-name": "MSO_VPN_TEST", + "resource-version": "1515683690339", + "route-targets": {"route-target": [ + { + "global-route-target": "2001:051111", + "route-target-role": "EXPORT", + "resource-version": "1515683690360" + }, + { + "global-route-target": "1000:051113", + "route-target-role": "IMPORT", + "resource-version": "1515683690372" + }, + { + "global-route-target": "1000:051112", + "route-target-role": "BOTH", + "resource-version": "1515683690384" + }, + { + "global-route-target": "1000:051115", + "route-target-role": "EXPORT", + "resource-version": "1515683690408" + }, + { + "global-route-target": "1000:051114", + "route-target-role": "IMPORT", + "resource-version": "1515683690396" + } + ]}, + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-1Binding-1710-0814-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da89d739-be28-4061-bf62-4a1a9171cbfb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da89d739-be28-4061-bf62-4a1a9171cbfb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1806_BB_it2_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1635f3ea-5821-4e1c-acad-a87a36b160b1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1635f3ea-5821-4e1c-acad-a87a36b160b1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1806_BB_it2_2" + }] + } + ]} +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf new file mode 100644 index 0000000000..09634c199b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf @@ -0,0 +1,107 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "complete", + "statusMessage": "", + "solutionInfo": { + "licenseInfo": [ + { + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_primary_1", + "serviceResourceId": "testResourceIdAR" + }, + { + "entitlementPoolList": [ + "91d563e8-e714-4393-8f99-cc480144a05e", + "21d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "31d563e8-e714-4393-8f99-cc480144a05e", + "71d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_secondary_1", + "serviceResourceId": "testResourceIdVNF" + } + ], + "placementInfo": [ + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "MDTNJ01" + }, + { + "variableName": "aicClli", + "variableValue": "KDTNJ01" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "dfwtx", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID1", + "serviceResourceId": "testResourceIdAR" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "testVnfHostname2" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli2" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId2", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID2", + "serviceResourceId": "testResourceIdAR2" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli3" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId3", + "inventoryType": "cloud", + "resourceModuleName": "VNF", + "serviceInstanceId": "", + "serviceResourceId": "testResourceIdVNF" + } + ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net new file mode 100644 index 0000000000..ac9b466ab7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net @@ -0,0 +1,165 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "complete", + "statusMessage": "", + "solutionInfo": { + "licenseInfo": [ + { + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_primary_1", + "serviceResourceId": "testResourceIdAR" + }, + { + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05n", + "j1d563e8-e714-4393-8f99-cc480144a05n" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05n", + "b1d563e8-e714-4393-8f99-cc480144a05n" + ], + "resourceModuleName": "net", + "serviceResourceId": "testResourceIdNet2" + }, + { + "entitlementPoolList": [ + "91d563e8-e714-4393-8f99-cc480144a05e", + "21d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "31d563e8-e714-4393-8f99-cc480144a05e", + "71d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_secondary_1", + "serviceResourceId": "testResourceIdVNF" + } + ], + "placementInfo": [ + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "MDTNJ01" + }, + { + "variableName": "aicClli", + "variableValue": "KDTNJ01" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "dfwtx", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID1", + "serviceResourceId": "testResourceIdAR" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "testVnfHostname2" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli2" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId2", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID2", + "serviceResourceId": "testResourceIdAR2" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "testVnfHostNameNet" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClliNet" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionIdNet", + "inventoryType": "service", + "resourceModuleName": "NETWORK", + "serviceInstanceId": "testServiceInstanceIdNet", + "serviceResourceId": "testResourceIdNet" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClliNet2" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionIdNet2", + "inventoryType": "cloud", + "resourceModuleName": "NETWORK", + "serviceInstanceId": "", + "serviceResourceId": "testResourceIdNet2" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli3" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId3", + "inventoryType": "cloud", + "resourceModuleName": "VNF", + "serviceInstanceId": "", + "serviceResourceId": "testResourceIdVNF" + } + ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf new file mode 100644 index 0000000000..9159d80c43 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf @@ -0,0 +1,50 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "complete", + "statusMessage": "", + "solutionInfo": { + "placementInfo": [ + { + "serviceResourceId": "test-resource-id-000", + "resourceModuleName": "ADIOD vRouter vCE", + "inventoryType": "service", + "serviceInstanceId": "service-instance-01234", + "cloudRegionId": "mtmnj1a", + "isRehome": "False", + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "att-aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "MDTNJ01" + }, + { + "variableName": "aicClli", + "variableValue": "KDTNJ01" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ] + } + ], + "licenseInfo": [ + { + "serviceResourceId": "test-resource-id-000", + "resourceModuleName": "ADIOD vRouter vCE", + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ] + } + ] + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound new file mode 100644 index 0000000000..2150a053fb --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound @@ -0,0 +1,15 @@ +{ + "requestState": "", + "responseTime": "", + "solutionInfo": { + "placementInfo": [], + "licenseInfo": { + "featureGroupId": "" + } + }, + "percentProgress": "", + "requestId": "02c2e322-5839-4c97-9d46-0a5fa6bb642e", + "startTime": "", + "statusMessage": "No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8", + "requestType": "" +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException new file mode 100644 index 0000000000..b82688428e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException @@ -0,0 +1,9 @@ +{ + "requestError": { + "policyException": { + "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", + "text": "Message content size exceeds the allowable limit", + "messageId": "SVC0001" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException new file mode 100644 index 0000000000..6cc78a7cdb --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException @@ -0,0 +1,12 @@ +{ + "requestError": { + "serviceException": { + "variables": [ + "severity", 400 + ], + "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", + "text": "SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8", + "messageId": "SVC0001" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf new file mode 100644 index 0000000000..2af6bf3423 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf @@ -0,0 +1,65 @@ +{ + "requestInfo": { + "transactionId": "testRequestId", + "requestId": "testRequestId", + "callbackUrl": "http://localhost:8090/workflows/messages/message/SNIROResponse/testRequestId", + "sourceId": "mso", + "optimizer": [ + "placement", + "license" + ], + "numSolutions": 1, + "timeout": 600 + }, + "placementInfo": { + "serviceModelInfo": { + "modelType": "", + "modelInvariantId": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", + "modelVersionId": "2f7f309d-c842-4644-a2e4-34167be5eeb4", + "modelName": "ADIOD vRouter vCE 011017 Service", + "modelVersion": "5.0" + }, + "subscriberInfo": { + "globalSubscriberId": "SUB12_0322_DS_1201", + "subscriberName": "SUB_12_0322_DS_1201", + "subscriberCommonSiteId": "" + }, + "demandInfo": { + "placementDemand": [ + { + "resourceInstanceType": "VNF", + "serviceResourceId": "test-resource-id-000", + "resourceModuleName": "ADIoD vCE 0", + "resourceModelInfo": { + "modelCustomizationId": "bdaeed40-c964-4966-bdb8-51320dcaf587", + "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", + "modelName": "ADIoD vCE", + "modelVersion": "2.0", + "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", + "modelType": "" + }, + "tenantId": "", + "tenantName": "" + } + ], + "licenseDemand": [ + { + "resourceInstanceType": "VNF", + "serviceResourceId": "test-resource-id-000", + "resourceModuleName": "ADIoD vCE 0", + "resourceModelInfo": { + "modelCustomizationId": "bdaeed40-c964-4966-bdb8-51320dcaf587", + "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", + "modelName": "ADIoD vCE", + "modelVersion": "2.0", + "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", + "modelType": "" + } + } + ] + }, + "policyId": [], + "serviceInstanceId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "orderInfo": "{\"requestParameters\": null}" + } + } \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequest.json new file mode 100644 index 0000000000..a30ee59d5c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequest.json @@ -0,0 +1,66 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "skipAAI": true, + "backout": false, + "failIfExists": true, + "msoRequest": + { + "requestId": "requestId", + "serviceInstanceId": "serviceInstanceId" + }, + + "vfModuleParams": + { + "vnf_id": "vnfId", + "vnf_name": "vnfName", + "vf_module_id": "vfModuleId", + "vf_module_index": "1", + "vf_module_name": "vfModuleName", + "environment_context": "environmentContext", + "fw_0_subint_ctrl_port_0_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_net_ids": "networkId0", + "fw_0_subint_ctrl_port_0_net_names": "1", + "fw_subint_ctrl_port_0_subintcount": "1", + "fw_0_subint_ctrl_port_0_v6_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_v6_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_v6_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_vlan_ids": "1", + "fw_subint_ctrl_port_0_floating_ip": "floatingIpV40", + "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60", + "workload_context": "workloadContext", + "key1": "value1", + "availability_zone_0": "zone0", + "availability_zone_1": "zone1", + "availability_zone_2": "zone2", + "vnfNetworkRole0_net_fqdn": "netFqdnValue0", + "vnfNetworkRole0_net_id": "neutronId0", + "vnfNetworkRole0_net_name": "netName0", + "vnfNetworkRole0_subnet_id": "subnetId0", + "vnfNetworkRole0_v6_subnet_id": "subnetId1", + "vmType0_name_0": "vmName0", + "vmType0_name_1": "vmName1", + "vmType0_names": "vmName0,vmName1", + "vmType0_vmNetworkRole0_floating_ip": "floatingIpV40", + "vmType0_vmNetworkRole0_floating_v6_ip": "floatingIpV60", + "vmType0_vmNetworkRole0_route_prefixes": "[{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix0\"},{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix1\"}]", + "vmNetworkRole0_ATT_VF_VLAN_FILTER": "heatVlanFilter0,heatVlanFilter1", + "vmType0_vmNetworkRole0_ip_0": "ip0", + "vmType0_vmNetworkRole0_ip_1": "ip1", + "vmType0_vmNetworkRole0_ips": "ip0,ip1", + "vmType0_vmNetworkRole0_v6_ip_0": "ip2", + "vmType0_vmNetworkRole0_v6_ip_1": "ip3", + "vmType0_vmNetworkRole0_v6_ips": "ip2,ip3", + "paramOne": "paramOneValue", + "paramTwo": "paramTwoValue", + "paramThree": "paramThreeValue" + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestDhcpDisabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestDhcpDisabled.json new file mode 100644 index 0000000000..49a68b909a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestDhcpDisabled.json @@ -0,0 +1,64 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "skipAAI": true, + "backout": false, + "failIfExists": true, + "msoRequest": + { + "requestId": "requestId", + "serviceInstanceId": "serviceInstanceId" + }, + + "vfModuleParams": + { + "vnf_id": "vnfId", + "vnf_name": "vnfName", + "vf_module_id": "vfModuleId", + "vf_module_index": "1", + "vf_module_name": "vfModuleName", + "environment_context": "environmentContext", + "fw_0_subint_ctrl_port_0_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_net_ids": "networkId0", + "fw_0_subint_ctrl_port_0_net_names": "1", + "fw_subint_ctrl_port_0_subintcount": "1", + "fw_0_subint_ctrl_port_0_v6_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_v6_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_v6_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_vlan_ids": "1", + "fw_subint_ctrl_port_0_floating_ip": "floatingIpV40", + "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60", + "workload_context": "workloadContext", + "key1": "value1", + "availability_zone_0": "zone0", + "availability_zone_1": "zone1", + "availability_zone_2": "zone2", + "vnfNetworkRole0_net_fqdn": "netFqdnValue0", + "vnfNetworkRole0_net_id": "neutronId0", + "vnfNetworkRole0_net_name": "netName0", + "vmType0_name_0": "vmName0", + "vmType0_name_1": "vmName1", + "vmType0_names": "vmName0,vmName1", + "vmType0_vmNetworkRole0_floating_ip": "floatingIpV40", + "vmType0_vmNetworkRole0_floating_v6_ip": "floatingIpV60", + "vmType0_vmNetworkRole0_route_prefixes": "[{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix0\"},{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix1\"}]", + "vmNetworkRole0_ATT_VF_VLAN_FILTER": "heatVlanFilter0,heatVlanFilter1", + "vmType0_vmNetworkRole0_ip_0": "ip0", + "vmType0_vmNetworkRole0_ip_1": "ip1", + "vmType0_vmNetworkRole0_ips": "ip0,ip1", + "vmType0_vmNetworkRole0_v6_ip_0": "ip2", + "vmType0_vmNetworkRole0_v6_ip_1": "ip3", + "vmType0_vmNetworkRole0_v6_ips": "ip2,ip3", + "paramOne": "paramOneValue", + "paramTwo": "paramTwoValue", + "paramThree": "paramThreeValue" + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestMultipleDhcp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestMultipleDhcp.json new file mode 100644 index 0000000000..a862051582 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestMultipleDhcp.json @@ -0,0 +1,66 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "skipAAI": true, + "backout": false, + "failIfExists": true, + "msoRequest": + { + "requestId": "requestId", + "serviceInstanceId": "serviceInstanceId" + }, + + "vfModuleParams": + { + "vnf_id": "vnfId", + "vnf_name": "vnfName", + "vf_module_id": "vfModuleId", + "vf_module_index": "1", + "vf_module_name": "vfModuleName", + "environment_context": "environmentContext", + "fw_0_subint_ctrl_port_0_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_net_ids": "networkId0", + "fw_0_subint_ctrl_port_0_net_names": "1", + "fw_subint_ctrl_port_0_subintcount": "1", + "fw_0_subint_ctrl_port_0_v6_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_v6_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_v6_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_vlan_ids": "1", + "fw_subint_ctrl_port_0_floating_ip": "floatingIpV40", + "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60", + "workload_context": "workloadContext", + "key1": "value1", + "availability_zone_0": "zone0", + "availability_zone_1": "zone1", + "availability_zone_2": "zone2", + "vnfNetworkRole0_net_fqdn": "netFqdnValue0", + "vnfNetworkRole0_net_id": "neutronId0", + "vnfNetworkRole0_net_name": "netName0", + "vnfNetworkRole0_subnet_id": "subnetId0", + "vnfNetworkRole0_v6_subnet_id": "subnetId4", + "vmType0_name_0": "vmName0", + "vmType0_name_1": "vmName1", + "vmType0_names": "vmName0,vmName1", + "vmType0_vmNetworkRole0_floating_ip": "floatingIpV40", + "vmType0_vmNetworkRole0_floating_v6_ip": "floatingIpV60", + "vmType0_vmNetworkRole0_route_prefixes": "[{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix0\"},{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix1\"}]", + "vmNetworkRole0_ATT_VF_VLAN_FILTER": "heatVlanFilter0,heatVlanFilter1", + "vmType0_vmNetworkRole0_ip_0": "ip0", + "vmType0_vmNetworkRole0_ip_1": "ip1", + "vmType0_vmNetworkRole0_ips": "ip0,ip1", + "vmType0_vmNetworkRole0_v6_ip_0": "ip2", + "vmType0_vmNetworkRole0_v6_ip_1": "ip3", + "vmType0_vmNetworkRole0_v6_ips": "ip2,ip3", + "paramOne": "paramOneValue", + "paramTwo": "paramTwoValue", + "paramThree": "paramThreeValue" + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestWithCloudResources.json new file mode 100644 index 0000000000..9c77f14f4b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestWithCloudResources.json @@ -0,0 +1,33 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "skipAAI": true, + "backout": false, + "failIfExists": true, + "msoRequest": + { + "requestId": "requestId", + "serviceInstanceId": "serviceInstanceId" + }, + + "vfModuleParams": + { + "environment_context": "environmentContext", + "key1": "value1", + "paramOne": "paramOneValue", + "paramThree": "paramThreeValue", + "paramTwo": "paramTwoValue", + "vf_module_id": "vfModuleId", + "vf_module_index": "1", + "vf_module_name": "vfModuleName", + "vnf_id": "vnfId", + "vnf_name": "vnfName", + "workload_context": "workloadContext" + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterDeleteVfModuleRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterDeleteVfModuleRequest.json new file mode 100644 index 0000000000..21e5bde3ec --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterDeleteVfModuleRequest.json @@ -0,0 +1,11 @@ +{ + "cloudSiteId" : "cloudRegionId", + "tenantId" : "tenantId", + "vnfId" : "vnfId", + "vfModuleId" : "vfModuleId", + "skipAAI" : true, + "msoRequest" : { + "requestId" : "requestId", + "serviceInstanceId" : "serviceInstanceId" + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json new file mode 100644 index 0000000000..7b369ab97e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json @@ -0,0 +1,70 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersion": "10" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "project": { + "projectName": "{some project name}" + }, + "subscriberInfo": { + "globalSubscriberId": "{some subscriber id}" + }, + "requestInfo": { + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": true, + "requestorId": "xxxxxx" + }, + "requestParameters": { + "subscriptionServiceType": "VMX", + "aLaCarte": false, + "userParams": [ + { + "service": { + "modelInfo": { + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceParams": [], + "resources": { + "networks": [ + { + "modelInfo": { + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf970" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + } + }, + { + "modelInfo": { + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf970" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + } + } + ] + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json new file mode 100644 index 0000000000..771283c603 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json @@ -0,0 +1,38 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersion": "10.0" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "project": { + "projectName": "{some project name}" + }, + "subscriberInfo": { + "globalSubscriberId": "{some subscriber id}" + }, + "requestInfo": { + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": true, + "requestorId": "az2016" + }, + "requestParameters": { + "subscriptionServiceType": "VMX", + "aLaCarte": false, + "userParams": [ + { + "name": "someUserParam", + "value": "someValue" + } + ] + + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json new file mode 100644 index 0000000000..51caddd48a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json @@ -0,0 +1,125 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersion": "10.0" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "project": { + "projectName": "{some project name}" + }, + "subscriberInfo": { + "globalSubscriberId": "{some subscriber id}" + }, + "requestInfo": { + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": true, + "requestorId": "xxxxxx" + }, + "requestParameters": { + "subscriptionServiceType": "VMX", + "aLaCarte": false, + "userParams": [ + { + "service": { + "modelInfo": { + "modelType": "service", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceParams": [], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelType": "vnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceParams": [], + "vfModules": [ + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", + "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79", + "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f" + }, + "instanceParams": [ + { + "vmx_int_net_len": "24" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "100" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "50" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-2", + "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969" + }, + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vmx_vpfe_int_ip_0": "192.168.0.16" + } + ] + } + ] + } + ] + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientGetResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientGetResponse.json new file mode 100644 index 0000000000..a18b6aa54e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientGetResponse.json @@ -0,0 +1,27 @@ +{ + "vnf-topology": { + "tenant": "0422ffb57ba042c0800a29dc85ca70f8", + "vnf-topology-identifier-structure": { + "vnf-id": "66dac89b-2a5b-4cb9-b22e-a7e4488fb3db", + "vnf-type": "InfraMSO_vSAMP10a_Service/InfraMSO_vSAMP10a-2 0", + "vnf-name": "MSO-DEV-VNF-1806HF1-InfraMSO_vSAMP10a-1XXX-GR_21" + }, + "aic-clli": "AUSTTXGR", + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": [ + "AZ-MN02" + ], + "max-count": 1 + } + }, + "aic-cloud-region": "mtn6", + "onap-model-information": { + "model-customization-uuid": "034226ae-879a-46b5-855c-d02babcb6cb6", + "model-uuid": "cb79c25f-b30d-4d95-afb5-97be4021f3db", + "model-invariant-uuid": "e93d3a7a-446d-486b-ae48-d474a9156064", + "model-name": "InfraMSO_vSAMP10a-2", + "model-version": "1.0" + } + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..15e2ffce1c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + fqdn123 + slowburn + 145878989 + F + + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml new file mode 100644 index 0000000000..2126ae7464 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml @@ -0,0 +1,6 @@ + + skask + lukewarm + pdk1 + 78987 + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml new file mode 100644 index 0000000000..5232e530e9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml @@ -0,0 +1,29 @@ + + + DEV-VF-0011 + UPDATE_VF_MODULE + PORTAL + + + skask + supercool + pcrf-capacity + PCRF::module-0 + + serviceIdUUID + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + 78987 + introvert + 3.14 + myhost.appl.edu + introvert + 3.14 + + + VLAN-OAM-1323 + slcp34246vbc246ceb + 970cd2b9-7f09-4a12-af47-182ea38ba1f0 + 545cc2c3-1930-4100-b534-5d82d0e12bb6 + + diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/GenericVnf.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/GenericVnf.xml new file mode 100644 index 0000000000..c86a4aaa73 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/GenericVnf.xml @@ -0,0 +1,38 @@ + + skask + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + pending-create + false + false + introvert + 2.0 + 0000020 + + + lukewarm + PCRF::module-0-0 + introvert + 2.0 + true + fastburn + pending-create + 0000074 + + + supercool + PCRF::module-1-0 + extrovert + 2.0 + false + slowburn + pending-create + 0000075 + + + + + + diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml new file mode 100644 index 0000000000..65f235cf4b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml @@ -0,0 +1,5 @@ + + skask + supercool + pending-delete + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..f40b6bc991 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 195159195 + 14567890 + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml new file mode 100644 index 0000000000..4cab6c6615 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml @@ -0,0 +1,13 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml new file mode 100644 index 0000000000..7d3d0e54d1 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml @@ -0,0 +1,13 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml new file mode 100644 index 0000000000..7d3d0e54d1 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml @@ -0,0 +1,13 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml new file mode 100644 index 0000000000..dbd55b0cf4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml @@ -0,0 +1,315 @@ + + + bd1b3789-6474-4935-94b2-90b656e035d0 + + bd1b3789-6474-4935-94b2-90b656e035d0 + + 9ddf628a-9eca-430e-8974-22d520a31be1 + assign + https://localhost:8443/adapters/rest/SDNCNotify + + + notsurewecare + bd1b3789-6474-4935-94b2-90b656e035d0 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + + PendingCreate + + + VNN1CA52LCP + ZVNNMOGX01_base + afd0f02a-1ddb-43bb-aded-5113e46e82ae + ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 + ZVNN1MOGX01 + 33d209df14ac4c08ad60747185d2f3e0 + bd1b3789-6474-4935-94b2-90b656e035d0 + ZVNN1MOGX01 - VF AUG 1::module-0 + + + + + mog_exn + 03dbd833-785c-40c0-bf32-37594b5334bc + MNS-25180-P-VNNYCA01_exn_protected_net_1 + + + 6f82d234-41a4-48e9-a9e8-415667a72929 + + filter1 + + + filter2 + + + + mog_oam + 3f181cde-9380-4c20-9d3a-e1a4ee74f994 + MNS-25180-P-VNNYCA01_oam_protected_net_1 + + + 713b6770-13fa-4949-8dbb-a1288c5e5932 + + + mog_cor_B + 821a550a-3f50-4725-995b-f212d5caec7c + MNS-25180-P-VNNYCA01_cor_direct_net_1 + + + 18926e56-12b6-4a4d-98b6-37e0c05626ee + + + mog_cor_A + 3dabf5c0-cffb-420c-8960-8499c74eb25f + MNS-25180-P-VNNYCA01_cor_direct_net_2 + + + 35530b29-a4de-48ff-a014-111110ccc652 + + + mog_gn + 3ce97321-6e7f-49af-bd12-f833e377c310 + MNS-25180-P-VNNYCA01_gn_direct_net_1 + + + 32bfdd2c-28e1-4895-87a6-373bf12c3129 + + + mog_dmz + d43ca910-02a5-47dc-8510-100a68a3c9e0 + MNS-25180-P-VNNYCA01_dmz_protected_net_1 + + + cb9500fb-943f-412e-aea6-458711564a75 + + + nova + + + ps + + ZVNN1MOGX01MPS001 + + + ZVNN1MOGX01MPS002 + + + ZVNN1MOGX01MPS003 + + + ZVNN1MOGX01MPS004 + + 4 + + mog_cor_B + + 107.224.36.251 + + + 107.224.36.252 + + + 107.224.36.253 + + + 107.224.36.254 + + N + + + + cm + + ZVNN1MOGX01MCM001 + + + ZVNN1MOGX01OAM002 + + 1 + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + N + + + mog_oam + + 107.239.167.250 + + + 107.239.167.251 + + N + + + + oam + + ZVNN1MOGX01OAM001 + + + ZVNN1MOGX01OAM002 + + 2 + + mog_oam + + 107.239.167.252 + + + 107.239.167.251 + + N + + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + N + + + + pd + + ZVNN1MOGX01MPD001 + + + ZVNN1MOGX01MPD002 + + 2 + + mog_dmz + + 107.225.25.253 + + + 107.225.25.254 + + N + 107.225.254.253 + + + mog_oam + + 107.239.167.254 + + + 107.239.167.253 + + N + 107.239.167.249 + + + mog_exn + + 107.224.46.253 + + + 107.224.46.254 + + N + 107.224.46.252 + + + mog_cor_B + + 107.224.36.247 + + + 107.224.36.248 + + N + 107.224.41.252 + + + mog_gn + + 107.224.41.253 + + + 107.224.41.254 + + N + 107.224.41.252 + + + mog_cor_A + + 107.224.38.253 + + + 107.224.38.254 + + N + + + + sm + + ZVNN1MOGX01MSM001 + + + ZVNN1MOGX01MSM002 + + + ZVNN1MOGX01MSM003 + + + ZVNN1MOGX01MSM004 + + 4 + + mog_cor_B + + 107.224.36.243 + + + 107.224.36.244 + + + 107.224.36.245 + + + 107.224.36.246 + + N + + + + + ZVNNMOGX01_base + SDN-MOBILITY + ZVNN1MOGX01 - VF AUG 1::module-0 + ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 + ZVNN1MOGX01 + + + + 9ddf628a-9eca-430e-8974-22d520a31be1 + + PORTAL + VNFActivateRequest + + + + 200 + Y + synccomplete + 2016-08-05T16:15:19.398Z + vnf-topology-operation + VNFActivateRequest + assign + + + + diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml new file mode 100644 index 0000000000..e8a69da0f8 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml @@ -0,0 +1,141 @@ + + + 28455973-1ee5-4ad1-8d35-c4732679743a + + 200 + Y + synccomplete + 2016-06-08T19:44:59.138Z + vnf-topology-operation + VNFActivateRequest + assign + + + 28455973-1ee5-4ad1-8d35-c4732679743 + + notsurewecare + 28455973-1ee5-4ad1-8d35-c4732679743a + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + + 5e168556-a5c6-4813-bff3-cc03007afbbc + http://localhost:28080/adapters/rest/SDNCNotify + assign + + + AAIAIC25 + MSOTEST06-vSAMP3::base::module-0 + 91ad7ab0-9ffd-471d-971c-3eb913a2cc75 + Test/vSAMP3 1 + MSOTEST06 + 4ae1d3446a4c48b2bec44b6cfba06d68 + 28455973-1ee5-4ad1-8d35-c4732679743a + vSAMP3::base::module-0 + + + PendingCreate + + + + image + Ubuntu_Perf + + + flavor + m1.small + + + + int_imbl + 680b7453-0ec4-4d96-b355-280d981d418f + Nimbus-25193-T-Willows2_int_imbl_net_1 + default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_int_imbl_net_1 + + 775607fb-e16a-45ef-94a7-82fba0d16eec + 640d07fb-e16a-45ef-94a7-82fba0d169bf + + filter1 + + + filter2 + + + + sgi_protected + f9039ce9-e3cf-4716-b2d1-ec7912178ea4 + Nimbus-25193-T-Willows2_sgi_protected_net_1 + default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_sgi_protected_net_1 + b9999ce9-e3cf-4716-b2d1-ec791217678c + + bf11bba8-b971-4ab5-8281-215b3fedcd3c + + + cm + + ZVNN1MOGX01MCM001 + + + ZVNN1MOGX01OAM002 + + 1 + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + + 2606:ae00:2e01:800::67 + + N + 107.224.41.252 + 2001:1890:1001:2B32::29:C + + + mog_oam + + 107.239.167.250 + + + 107.239.167.251 + + + aa::aa::aa::aa::aa::aa + + + bb::bb::bb::bb::bb::bb + + + 1.2.3.4/26 + + + 2002::/64 + + N + 1111:1890:1001:2B32::29:D + + + + nova + + + + MSOTEST06-vSAMP3::base::module-0 + SDN-MOBILITY + vSAMP3::base::module-0 + Test/vSAMP3 1 + MSOTEST06 + + + + 5e168556-a5c6-4813-bff3-cc03007afbbc + + SoapUI-bns-vf-base-vSAMP3-9001 + VNFActivateRequest + + + + diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml new file mode 100644 index 0000000000..77528ccf61 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml new file mode 100644 index 0000000000..3e7c6503f4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml @@ -0,0 +1,5 @@ + + skask + introvert + 3.14 + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml new file mode 100644 index 0000000000..8a690403c4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml @@ -0,0 +1,10 @@ + + skask + supercool + slowburn + complete + 78987 + introvert + 3.14 + myhost.appl.com + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml new file mode 100644 index 0000000000..0dc1b1d410 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml @@ -0,0 +1,35 @@ + + + DEV-VF-0011 + UPDATE_VF_MODULE + PORTAL + + + skask + supercool + pcrf-capacity + PCRF::module-0 + + serviceIdUUID + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + 78987 + introvert + 3.14 + myhost.appl.edu + introvert + 3.14 + + + VLAN-OAM-1323 + slcp34246vbc246ceb + 970cd2b9-7f09-4a12-af47-182ea38ba1f0 + 545cc2c3-1930-4100-b534-5d82d0e12bb6 + + diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml new file mode 100644 index 0000000000..49ecd0bf3f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml @@ -0,0 +1,55 @@ + + skask + supercool + slowburn + true + + + key1 + value1 + + + key2 + value2 + + +server1_private_ip +192.168.28.3 + + +contrail-service-instance-fqdn +default-domain:MSOTest:MsoNW-RA + + +policyKey1_contrail_network_policy_fqdn +MSOTest:DefaultPolicyFQDN1 + + +policyKey2_contrail_network_policy_fqdn +MSOTest:DefaultPolicyFQDN2 + + +oam_management_v6_address +2000:abc:bce:1111 + + +oam_management_v4_address +127.0.0.1 + + + + skask + supercool + slowburn + true + tenantId + cloudSiteId + + requestId + serviceInstanceId + + {{MESSAGE-ID}} + + {{MESSAGE-ID}} + + diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml new file mode 100644 index 0000000000..c602dd9667 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml @@ -0,0 +1,16 @@ + + skask + supercool + slowburn + + + key1 + value1 + + + key2 + value2 + + + {{MESSAGE-ID}} + diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml new file mode 100644 index 0000000000..830d2e2237 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml @@ -0,0 +1,15 @@ + + 78987 + slowburn + + + key1 + value1 + + + key2 + value2 + + + {{MESSAGE-ID}} + diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml new file mode 100644 index 0000000000..b882c4c6f4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml @@ -0,0 +1,10 @@ + + lukewarm + PCRF::module-1 + slowburn + pending-create + true + 330-90 + introvert + 2.0 + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-new.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-new.xml new file mode 100644 index 0000000000..3b8bea4e4e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-new.xml @@ -0,0 +1,9 @@ + + b37d96db-7d2c-47ce-bf61-a6c7b82fe161 + PCRF::module-0-2 + 00000000-0000-0000-0000-000000000000 + 1.0 + false + pending-create + 330-90 + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-supercool.xml new file mode 100644 index 0000000000..5a2b7300b1 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-supercool.xml @@ -0,0 +1,27 @@ + + supercool + PCRF::module-2 + fastburn + pending-create + false + 330-89 + introvert + 2.0 + + + volume-group + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + pdk1 + + + volume-group.volume-group-id + 78987 + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VolumeGroup.xml new file mode 100644 index 0000000000..7e913dd418 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VolumeGroup.xml @@ -0,0 +1,25 @@ + + 78987 + Volume_2 + slowburn + pcrf-capacity + Active + 0000020 + + + tenant + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + MDTWNJ21 + + + tenant.tenant-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml new file mode 100644 index 0000000000..ac8446cbb9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml @@ -0,0 +1,214 @@ +aai: + auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764 + endpoint: http://localhost:${wiremock.server.port} +appc: + client: + key: iaEMAfjsVsZnraBP + response: + timeout: '120000' + secret: wcivUjsjXzmGFBfxMmyJu9dz + poolMembers: localhost:3904 + service: ueb + topic: + read: + name: APPC-TEST-AMDOCS2 + timeout: '120000' + write: APPC-TEST-AMDOCS1-DEV3 + sdnc: + read: SDNC-LCM-READ + write: SDNC-LCM-WRITE +log: + debug: + CompleteMsoProcess: 'true' + CreateNetworkInstanceInfra: 'true' + CreateServiceInstanceInfra: 'true' + DeleteNetworkInstanceInfra: 'true' + FalloutHandler: 'true' + UpdateNetworkInstanceInfra: 'true' + VnfAdapterRestV1: 'true' + sdncAdapter: 'true' + vnfAdapterCreateV1: 'true' + vnfAdapterRestV1: 'true' +mso: + adapters: + completemsoprocess: + endpoint: http://localhost:${wiremock.server.port}/CompleteMsoProcess + db: + auth: 757A94191D685FD2092AC1490730A4FC + endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter + spring: + endpoint: http://localhost:${wiremock.server.port} + network: + endpoint: http://localhost:${wiremock.server.port}/networks/NetworkAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/networks/rest/v1/networks + openecomp: + db: + endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter + po: + auth: 757A94191D685FD2092AC1490730A4FC + password: 3141634BF7E070AA289CF2892C986C0B + sdnc: + endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter/v1/sdnc + timeout: PT60S + tenant: + endpoint: http://localhost:${wiremock.server.port}/tenantAdapterMock + vnf: + endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/vnfs + volume-groups: + rest: + endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/volume-groups + vnf-async: + endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapterAsync + workflow: + message: + endpoint: http://localhost:${wiremock.server.port}/workflows/messages/message + + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + + bpmn: + optimisticlockingexception: + retrycount: '3' + callbackRetryAttempts: '5' + catalog: + db: + endpoint: http://localhost:${wiremock.server.port}/ + spring: + endpoint: http://localhost:${wiremock.server.port} + correlation: + timeout: 60 + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + default: + adapter: + namespace: http://org.onap.so + healthcheck: + log: + debug: 'false' + infra: + customer: + id: testCustIdInfra + logPath: logs + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + po: + timeout: PT60S + request: + db: + endpoint: http://localhost:${wiremock.server.port}/ + rollback: 'true' + site-name: localDevEnv + workflow: + default: + aai: + cloud-region: + version: '9' + generic-vnf: + version: '9' + v8: + customer: + uri: /aai/v8/business/customers/customer + generic-query: + uri: /aai/v8/search/generic-query + l3-network: + uri: /aai/v8/network/l3-networks/l3-network + network-policy: + uri: /aai/v8/network/network-policies/network-policy + nodes-query: + uri: /aai/v8/search/nodes-query + route-table-reference: + uri: /aai/v8/network/route-table-references/route-table-reference + tenant: + uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + vce: + uri: /aai/v8/network/vces/vce + vpn-binding: + uri: /aai/v8/network/vpn-bindings/vpn-binding + v9: + cloud-region: + uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic + generic-vnf: + uri: /aai/v9/network/generic-vnfs/generic-vnf + global: + default: + aai: + namespace: http://org.openecomp.aai.inventory/ + version: '8' + message: + endpoint: http://localhost:${wiremock.server.port}/mso/WorkflowMesssage + notification: + name: GenericNotificationService + sdncadapter: + callback: http://localhost:${wiremock.server.port}/mso/SDNCAdapterCallbackService + vnfadapter: + create: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + delete: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + query: + callback: http://localhost:${wiremock.server.port}/mso/services/VNFAdapterQuerCallbackV1 + rollback: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + global: + dmaap: + username: dmaapUsername + password: dmaapPassword + host: http://localhost:28090 + publisher: + topic: com.att.mso.asyncStatusUpdate +policy: + auth: Basic dGVzdHBkcDphbHBoYTEyMw== + client: + auth: Basic bTAzNzQzOnBvbGljeVIwY2sk + endpoint: https://localhost:8081/pdp/api/ + environment: TEST +sdnc: + auth: Basic YWRtaW46YWRtaW4= + host: http://localhost:8446 + path: /restconf/operations/GENERIC-RESOURCE-API +sniro: + conductor: + enabled: true + host: http://localhost:${wiremock.server.port} + uri: /v1/release-orders + headers.auth: Basic dGVzdDp0ZXN0cHdk + manager: + timeout: PT30M + host: http://localhost:${wiremock.server.port} + uri.v1: /sniro/api/v2/placement + uri.v2: /sniro/api/placement/v2 + headers.auth: Basic dGVzdDp0ZXN0cHdk + headers.patchVersion: 1 + headers.minorVersion: 1 + headers.latestVersion: 2 +spring: + datasource: + url: jdbc:mariadb://localhost:3307/camundabpmn + username: root + password: password + driver-class-name: org.mariadb.jdbc.Driver + initialize: true + jpa: + generate-ddl: false + show-sql: false + hibernate: + ddl-auto: none + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + +mariaDB4j: + dataDir: + port: 3307 + databaseName: camundabpmn +camunda: + bpm: + metrics: + enabled: false + db-reporter-activate: false \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/schema.sql b/bpmn/so-bpmn-tasks/src/test/resources/schema.sql new file mode 100644 index 0000000000..7a15e84662 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/schema.sql @@ -0,0 +1,1188 @@ + +USE `camundabpmn`; + + +create table ACT_GE_PROPERTY ( + NAME_ varchar(64), + VALUE_ varchar(300), + REV_ integer, + primary key (NAME_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + + +create table ACT_GE_BYTEARRAY ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + BYTES_ LONGBLOB, + GENERATED_ TINYINT, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RE_DEPLOYMENT ( + ID_ varchar(64), + NAME_ varchar(255), + DEPLOY_TIME_ timestamp(3), + SOURCE_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EXECUTION ( + ID_ varchar(64), + REV_ integer, + PROC_INST_ID_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + SUPER_EXEC_ varchar(64), + SUPER_CASE_EXEC_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + IS_ACTIVE_ TINYINT, + IS_CONCURRENT_ TINYINT, + IS_SCOPE_ TINYINT, + IS_EVENT_SCOPE_ TINYINT, + SUSPENSION_STATE_ integer, + CACHED_ENT_STATE_ integer, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_JOB ( + ID_ varchar(64) NOT NULL, + REV_ integer, + TYPE_ varchar(255) NOT NULL, + LOCK_EXP_TIME_ timestamp(3) NULL, + LOCK_OWNER_ varchar(255), + EXCLUSIVE_ boolean, + EXECUTION_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROCESS_DEF_ID_ varchar(64), + PROCESS_DEF_KEY_ varchar(255), + RETRIES_ integer, + EXCEPTION_STACK_ID_ varchar(64), + EXCEPTION_MSG_ varchar(4000), + DUEDATE_ timestamp(3) NULL, + REPEAT_ varchar(255), + HANDLER_TYPE_ varchar(255), + HANDLER_CFG_ varchar(4000), + DEPLOYMENT_ID_ varchar(64), + SUSPENSION_STATE_ integer NOT NULL DEFAULT 1, + JOB_DEF_ID_ varchar(64), + PRIORITY_ bigint NOT NULL DEFAULT 0, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_JOBDEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + JOB_TYPE_ varchar(255) NOT NULL, + JOB_CONFIGURATION_ varchar(255), + SUSPENSION_STATE_ integer, + JOB_PRIORITY_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RE_PROCDEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + HAS_START_FORM_KEY_ TINYINT, + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(64), + VERSION_TAG_ varchar(64), + HISTORY_TTL_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_TASK ( + ID_ varchar(64), + REV_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + TASK_DEF_KEY_ varchar(255), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + DELEGATION_ varchar(64), + PRIORITY_ integer, + CREATE_TIME_ timestamp(3), + DUE_DATE_ datetime(3), + FOLLOW_UP_DATE_ datetime(3), + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_IDENTITYLINK ( + ID_ varchar(64), + REV_ integer, + GROUP_ID_ varchar(255), + TYPE_ varchar(255), + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_VARIABLE ( + ID_ varchar(64) not null, + REV_ integer, + TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + TASK_ID_ varchar(64), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + VAR_SCOPE_ varchar(64) not null, + SEQUENCE_COUNTER_ bigint, + IS_CONCURRENT_LOCAL_ TINYINT, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EVENT_SUBSCR ( + ID_ varchar(64) not null, + REV_ integer, + EVENT_TYPE_ varchar(255) not null, + EVENT_NAME_ varchar(255), + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTIVITY_ID_ varchar(255), + CONFIGURATION_ varchar(255), + CREATED_ timestamp(3) not null, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_INCIDENT ( + ID_ varchar(64) not null, + REV_ integer not null, + INCIDENT_TIMESTAMP_ timestamp(3) not null, + INCIDENT_MSG_ varchar(4000), + INCIDENT_TYPE_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + ACTIVITY_ID_ varchar(255), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CAUSE_INCIDENT_ID_ varchar(64), + ROOT_CAUSE_INCIDENT_ID_ varchar(64), + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_AUTHORIZATION ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ integer not null, + GROUP_ID_ varchar(255), + USER_ID_ varchar(255), + RESOURCE_TYPE_ integer not null, + RESOURCE_ID_ varchar(255), + PERMS_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_FILTER ( + ID_ varchar(64) not null, + REV_ integer not null, + RESOURCE_TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + OWNER_ varchar(255), + QUERY_ LONGTEXT not null, + PROPERTIES_ LONGTEXT, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_METER_LOG ( + ID_ varchar(64) not null, + NAME_ varchar(64) not null, + REPORTER_ varchar(255), + VALUE_ bigint, + TIMESTAMP_ timestamp(3), + MILLISECONDS_ bigint DEFAULT 0, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EXT_TASK ( + ID_ varchar(64) not null, + REV_ integer not null, + WORKER_ID_ varchar(255), + TOPIC_NAME_ varchar(255), + RETRIES_ integer, + ERROR_MSG_ varchar(4000), + ERROR_DETAILS_ID_ varchar(64), + LOCK_EXP_TIME_ timestamp(3) NULL, + SUSPENSION_STATE_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + TENANT_ID_ varchar(64), + PRIORITY_ bigint NOT NULL DEFAULT 0, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_BATCH ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_CREATED_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + SUSPENSION_STATE_ integer, + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_); +create index ACT_IDX_EXEC_TENANT_ID on ACT_RU_EXECUTION(TENANT_ID_); +create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_); +create index ACT_IDX_TASK_ASSIGNEE on ACT_RU_TASK(ASSIGNEE_); +create index ACT_IDX_TASK_TENANT_ID on ACT_RU_TASK(TENANT_ID_); +create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_); +create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_); +create index ACT_IDX_EVENT_SUBSCR_TENANT_ID on ACT_RU_EVENT_SUBSCR(TENANT_ID_); +create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_); +create index ACT_IDX_VARIABLE_TENANT_ID on ACT_RU_VARIABLE(TENANT_ID_); +create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); +create index ACT_IDX_INC_CONFIGURATION on ACT_RU_INCIDENT(CONFIGURATION_); +create index ACT_IDX_INC_TENANT_ID on ACT_RU_INCIDENT(TENANT_ID_); +-- CAM-5914 +create index ACT_IDX_JOB_EXECUTION_ID on ACT_RU_JOB(EXECUTION_ID_); +-- this index needs to be limited in mariadb see CAM-6938 +create index ACT_IDX_JOB_HANDLER on ACT_RU_JOB(HANDLER_TYPE_(100),HANDLER_CFG_(155)); +create index ACT_IDX_JOB_PROCINST on ACT_RU_JOB(PROCESS_INSTANCE_ID_); +create index ACT_IDX_JOB_TENANT_ID on ACT_RU_JOB(TENANT_ID_); +create index ACT_IDX_JOBDEF_TENANT_ID on ACT_RU_JOBDEF(TENANT_ID_); + +-- new metric milliseconds column +CREATE INDEX ACT_IDX_METER_LOG_MS ON ACT_RU_METER_LOG(MILLISECONDS_); +CREATE INDEX ACT_IDX_METER_LOG_NAME_MS ON ACT_RU_METER_LOG(NAME_, MILLISECONDS_); +CREATE INDEX ACT_IDX_METER_LOG_REPORT ON ACT_RU_METER_LOG(NAME_, REPORTER_, MILLISECONDS_); + +-- old metric timestamp column +CREATE INDEX ACT_IDX_METER_LOG_TIME ON ACT_RU_METER_LOG(TIMESTAMP_); +CREATE INDEX ACT_IDX_METER_LOG ON ACT_RU_METER_LOG(NAME_, TIMESTAMP_); + +create index ACT_IDX_EXT_TASK_TOPIC on ACT_RU_EXT_TASK(TOPIC_NAME_); +create index ACT_IDX_EXT_TASK_TENANT_ID on ACT_RU_EXT_TASK(TENANT_ID_); +create index ACT_IDX_EXT_TASK_PRIORITY ON ACT_RU_EXT_TASK(PRIORITY_); +create index ACT_IDX_EXT_TASK_ERR_DETAILS ON ACT_RU_EXT_TASK(ERROR_DETAILS_ID_); +create index ACT_IDX_AUTH_GROUP_ID ON ACT_RU_AUTHORIZATION(GROUP_ID_); +create index ACT_IDX_JOB_JOB_DEF_ID on ACT_RU_JOB(JOB_DEF_ID_); + +alter table ACT_GE_BYTEARRAY + add constraint ACT_FK_BYTEARR_DEPL + foreign key (DEPLOYMENT_ID_) + references ACT_RE_DEPLOYMENT (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade; + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PARENT + foreign key (PARENT_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_SUPER + foreign key (SUPER_EXEC_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_IDENTITYLINK + add constraint ACT_FK_TSKASS_TASK + foreign key (TASK_ID_) + references ACT_RU_TASK (ID_); + +alter table ACT_RU_IDENTITYLINK + add constraint ACT_FK_ATHRZ_PROCEDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF(ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION(ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_BYTEARRAY + foreign key (BYTEARRAY_ID_) + references ACT_GE_BYTEARRAY (ID_); + +alter table ACT_RU_JOB + add constraint ACT_FK_JOB_EXCEPTION + foreign key (EXCEPTION_STACK_ID_) + references ACT_GE_BYTEARRAY (ID_); + +alter table ACT_RU_EVENT_SUBSCR + add constraint ACT_FK_EVENT_EXEC + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION(ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_CAUSE + foreign key (CAUSE_INCIDENT_ID_) + references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_RCAUSE + foreign key (ROOT_CAUSE_INCIDENT_ID_) + references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_ERROR_DETAILS + foreign key (ERROR_DETAILS_ID_) + references ACT_GE_BYTEARRAY (ID_); + +create index ACT_IDX_INC_JOB_DEF on ACT_RU_INCIDENT(JOB_DEF_ID_); +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_JOB_DEF + foreign key (JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +alter table ACT_RU_AUTHORIZATION + add constraint ACT_UNIQ_AUTH_USER + unique (USER_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); + +alter table ACT_RU_AUTHORIZATION + add constraint ACT_UNIQ_AUTH_GROUP + unique (GROUP_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_UNIQ_VARIABLE + unique (VAR_SCOPE_, NAME_); + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_BATCH_SEED_JOB_DEF ON ACT_RU_BATCH(SEED_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_SEED_JOB_DEF + foreign key (SEED_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_MONITOR_JOB_DEF ON ACT_RU_BATCH(MONITOR_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_MONITOR_JOB_DEF + foreign key (MONITOR_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_JOB_DEF ON ACT_RU_BATCH(BATCH_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_JOB_DEF + foreign key (BATCH_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +-- indexes for deadlock problems - https://app.camunda.com/jira/browse/CAM-2567 -- +create index ACT_IDX_INC_CAUSEINCID on ACT_RU_INCIDENT(CAUSE_INCIDENT_ID_); +create index ACT_IDX_INC_EXID on ACT_RU_INCIDENT(EXECUTION_ID_); +create index ACT_IDX_INC_PROCDEFID on ACT_RU_INCIDENT(PROC_DEF_ID_); +create index ACT_IDX_INC_PROCINSTID on ACT_RU_INCIDENT(PROC_INST_ID_); +create index ACT_IDX_INC_ROOTCAUSEINCID on ACT_RU_INCIDENT(ROOT_CAUSE_INCIDENT_ID_); +-- index for deadlock problem - https://app.camunda.com/jira/browse/CAM-4440 -- +create index ACT_IDX_AUTH_RESOURCE_ID on ACT_RU_AUTHORIZATION(RESOURCE_ID_); +-- index to prevent deadlock on fk constraint - https://app.camunda.com/jira/browse/CAM-5440 -- +create index ACT_IDX_EXT_TASK_EXEC on ACT_RU_EXT_TASK(EXECUTION_ID_); + +-- indexes to improve deployment +create index ACT_IDX_BYTEARRAY_NAME on ACT_GE_BYTEARRAY(NAME_); +create index ACT_IDX_DEPLOYMENT_NAME on ACT_RE_DEPLOYMENT(NAME_); +create index ACT_IDX_DEPLOYMENT_TENANT_ID on ACT_RE_DEPLOYMENT(TENANT_ID_); +create index ACT_IDX_JOBDEF_PROC_DEF_ID ON ACT_RU_JOBDEF(PROC_DEF_ID_); +create index ACT_IDX_JOB_HANDLER_TYPE ON ACT_RU_JOB(HANDLER_TYPE_); +create index ACT_IDX_EVENT_SUBSCR_EVT_NAME ON ACT_RU_EVENT_SUBSCR(EVENT_NAME_); +create index ACT_IDX_PROCDEF_DEPLOYMENT_ID ON ACT_RE_PROCDEF(DEPLOYMENT_ID_); +create index ACT_IDX_PROCDEF_TENANT_ID ON ACT_RE_PROCDEF(TENANT_ID_); +create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); +-- create case definition table -- +create table ACT_RE_CASE_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + HISTORY_TTL_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create case execution table -- +create table ACT_RU_CASE_EXECUTION ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CASE_INST_ID_ varchar(64), + SUPER_CASE_EXEC_ varchar(64), + SUPER_EXEC_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + ACT_ID_ varchar(255), + PREV_STATE_ integer, + CURRENT_STATE_ integer, + REQUIRED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create case sentry part table -- + +create table ACT_RU_CASE_SENTRY_PART ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CASE_INST_ID_ varchar(64), + CASE_EXEC_ID_ varchar(64), + SENTRY_ID_ varchar(255), + TYPE_ varchar(255), + SOURCE_CASE_EXEC_ID_ varchar(64), + STANDARD_EVENT_ varchar(255), + SOURCE_ varchar(255), + VARIABLE_EVENT_ varchar(255), + VARIABLE_NAME_ varchar(255), + SATISFIED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create index on business key -- +create index ACT_IDX_CASE_EXEC_BUSKEY on ACT_RU_CASE_EXECUTION(BUSINESS_KEY_); + +-- create foreign key constraints on ACT_RU_CASE_EXECUTION -- +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_) on delete cascade on update cascade; + +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_PARENT + foreign key (PARENT_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_CASE_DEF + foreign key (CASE_DEF_ID_) + references ACT_RE_CASE_DEF(ID_); + +-- create foreign key constraints on ACT_RU_VARIABLE -- +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_CASE_EXE + foreign key (CASE_EXECUTION_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +-- create foreign key constraints on ACT_RU_TASK -- +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_CASE_EXE + foreign key (CASE_EXECUTION_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_CASE_DEF + foreign key (CASE_DEF_ID_) + references ACT_RE_CASE_DEF(ID_); + +-- create foreign key constraints on ACT_RU_CASE_SENTRY_PART -- +alter table ACT_RU_CASE_SENTRY_PART + add constraint ACT_FK_CASE_SENTRY_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_CASE_SENTRY_PART + add constraint ACT_FK_CASE_SENTRY_CASE_EXEC + foreign key (CASE_EXEC_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_); +create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_); +-- create decision definition table -- +create table ACT_RE_DECISION_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + DEC_REQ_ID_ varchar(64), + DEC_REQ_KEY_ varchar(255), + TENANT_ID_ varchar(64), + HISTORY_TTL_ integer, + VERSION_TAG_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create decision requirements definition table -- +create table ACT_RE_DECISION_REQ_DEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) NOT NULL, + VERSION_ integer NOT NULL, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_RE_DECISION_DEF + add constraint ACT_FK_DEC_REQ + foreign key (DEC_REQ_ID_) + references ACT_RE_DECISION_REQ_DEF(ID_); + +create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_); +create index ACT_IDX_DEC_DEF_REQ_ID on ACT_RE_DECISION_DEF(DEC_REQ_ID_); +create index ACT_IDX_DEC_REQ_DEF_TENANT_ID on ACT_RE_DECISION_REQ_DEF(TENANT_ID_); +create table ACT_HI_PROCINST ( + ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + START_USER_ID_ varchar(255), + START_ACT_ID_ varchar(255), + END_ACT_ID_ varchar(255), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + SUPER_CASE_INSTANCE_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + DELETE_REASON_ varchar(4000), + TENANT_ID_ varchar(64), + STATE_ varchar(255), + primary key (ID_), + unique (PROC_INST_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_ACTINST ( + ID_ varchar(64) not null, + PARENT_ACT_INST_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + EXECUTION_ID_ varchar(64) not null, + ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + CALL_CASE_INST_ID_ varchar(64), + ACT_NAME_ varchar(255), + ACT_TYPE_ varchar(255) not null, + ASSIGNEE_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + ACT_INST_STATE_ integer, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_TASKINST ( + ID_ varchar(64) not null, + TASK_DEF_KEY_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + DELETE_REASON_ varchar(4000), + PRIORITY_ integer, + DUE_DATE_ datetime(3), + FOLLOW_UP_DATE_ datetime(3), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_VARINST ( + ID_ varchar(64) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(100), + REV_ integer, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + TENANT_ID_ varchar(64), + STATE_ varchar(20), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_DETAIL ( + ID_ varchar(64) not null, + TYPE_ varchar(255) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + VAR_INST_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(255), + REV_ integer, + TIME_ datetime(3) not null, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + OPERATION_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_IDENTITYLINK ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + TYPE_ varchar(255), + USER_ID_ varchar(255), + GROUP_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + OPERATION_TYPE_ varchar(64), + ASSIGNER_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_COMMENT ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TIME_ datetime(3) not null, + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTION_ varchar(255), + MESSAGE_ varchar(4000), + FULL_MSG_ LONGBLOB, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_ATTACHMENT ( + ID_ varchar(64) not null, + REV_ integer, + USER_ID_ varchar(255), + NAME_ varchar(255), + DESCRIPTION_ varchar(4000), + TYPE_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + URL_ varchar(4000), + CONTENT_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_OP_LOG ( + ID_ varchar(64) not null, + DEPLOYMENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + JOB_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + BATCH_ID_ varchar(64), + USER_ID_ varchar(255), + TIMESTAMP_ timestamp(3) not null, + OPERATION_TYPE_ varchar(64), + OPERATION_ID_ varchar(64), + ENTITY_TYPE_ varchar(30), + PROPERTY_ varchar(64), + ORG_VALUE_ varchar(4000), + NEW_VALUE_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_INCIDENT ( + ID_ varchar(64) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CREATE_TIME_ timestamp(3) not null, + END_TIME_ timestamp(3) null, + INCIDENT_MSG_ varchar(4000), + INCIDENT_TYPE_ varchar(255) not null, + ACTIVITY_ID_ varchar(255), + CAUSE_INCIDENT_ID_ varchar(64), + ROOT_CAUSE_INCIDENT_ID_ varchar(64), + CONFIGURATION_ varchar(255), + INCIDENT_STATE_ integer, + TENANT_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_JOB_LOG ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + JOB_ID_ varchar(64) not null, + JOB_DUEDATE_ timestamp(3) NULL, + JOB_RETRIES_ integer, + JOB_PRIORITY_ bigint NOT NULL DEFAULT 0, + JOB_EXCEPTION_MSG_ varchar(4000), + JOB_EXCEPTION_STACK_ID_ varchar(64), + JOB_STATE_ integer, + JOB_DEF_ID_ varchar(64), + JOB_DEF_TYPE_ varchar(255), + JOB_DEF_CONFIGURATION_ varchar(255), + ACT_ID_ varchar(255), + EXECUTION_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROCESS_DEF_ID_ varchar(64), + PROCESS_DEF_KEY_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_BATCH ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_EXT_TASK_LOG ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + EXT_TASK_ID_ varchar(64) not null, + RETRIES_ integer, + TOPIC_NAME_ varchar(255), + WORKER_ID_ varchar(255), + PRIORITY_ bigint NOT NULL DEFAULT 0, + ERROR_MSG_ varchar(4000), + ERROR_DETAILS_ID_ varchar(64), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + TENANT_ID_ varchar(64), + STATE_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_); +create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_); +create index ACT_IDX_HI_PRO_INST_TENANT_ID on ACT_HI_PROCINST(TENANT_ID_); +create index ACT_IDX_HI_PRO_INST_PROC_DEF_KEY on ACT_HI_PROCINST(PROC_DEF_KEY_); + +create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_); +create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_); +create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_); +create index ACT_IDX_HI_ACT_INST_COMP on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_, END_TIME_, ID_); +create index ACT_IDX_HI_ACT_INST_STATS on ACT_HI_ACTINST(PROC_DEF_ID_, ACT_ID_, END_TIME_, ACT_INST_STATE_); +create index ACT_IDX_HI_ACT_INST_TENANT_ID on ACT_HI_ACTINST(TENANT_ID_); +create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_); + +create index ACT_IDX_HI_TASK_INST_TENANT_ID on ACT_HI_TASKINST(TENANT_ID_); +create index ACT_IDX_HI_TASK_INST_PROC_DEF_KEY on ACT_HI_TASKINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_TASKINST_PROCINST on ACT_HI_TASKINST(PROC_INST_ID_); +create index ACT_IDX_HI_TASKINSTID_PROCINST on ACT_HI_TASKINST(ID_,PROC_INST_ID_); + +create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_); +create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_); +create index ACT_IDX_HI_DETAIL_CASE_INST on ACT_HI_DETAIL(CASE_INST_ID_); +create index ACT_IDX_HI_DETAIL_CASE_EXEC on ACT_HI_DETAIL(CASE_EXECUTION_ID_); +create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_); +create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_); +create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_); +create index ACT_IDX_HI_DETAIL_TENANT_ID on ACT_HI_DETAIL(TENANT_ID_); +create index ACT_IDX_HI_DETAIL_PROC_DEF_KEY on ACT_HI_DETAIL(PROC_DEF_KEY_); +create index ACT_IDX_HI_DETAIL_BYTEAR on ACT_HI_DETAIL(BYTEARRAY_ID_); + +create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); +create index ACT_IDX_HI_IDENT_LNK_GROUP on ACT_HI_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_HI_IDENT_LNK_TENANT_ID on ACT_HI_IDENTITYLINK(TENANT_ID_); +create index ACT_IDX_HI_IDENT_LNK_PROC_DEF_KEY on ACT_HI_IDENTITYLINK(PROC_DEF_KEY_); +create index ACT_IDX_HI_IDENT_LINK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_); + +create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_); +create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_); +create index ACT_IDX_HI_CASEVAR_CASE_INST on ACT_HI_VARINST(CASE_INST_ID_); +create index ACT_IDX_HI_VAR_INST_TENANT_ID on ACT_HI_VARINST(TENANT_ID_); +create index ACT_IDX_HI_VAR_INST_PROC_DEF_KEY on ACT_HI_VARINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_VARINST_BYTEAR on ACT_HI_VARINST(BYTEARRAY_ID_); + +create index ACT_IDX_HI_INCIDENT_TENANT_ID on ACT_HI_INCIDENT(TENANT_ID_); +create index ACT_IDX_HI_INCIDENT_PROC_DEF_KEY on ACT_HI_INCIDENT(PROC_DEF_KEY_); +create index ACT_IDX_HI_INCIDENT_PROCINST on ACT_HI_INCIDENT(PROC_INST_ID_); + +create index ACT_IDX_HI_JOB_LOG_PROCINST on ACT_HI_JOB_LOG(PROCESS_INSTANCE_ID_); +create index ACT_IDX_HI_JOB_LOG_PROCDEF on ACT_HI_JOB_LOG(PROCESS_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_TENANT_ID on ACT_HI_JOB_LOG(TENANT_ID_); +create index ACT_IDX_HI_JOB_LOG_JOB_DEF_ID on ACT_HI_JOB_LOG(JOB_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_PROC_DEF_KEY on ACT_HI_JOB_LOG(PROCESS_DEF_KEY_); +create index ACT_IDX_HI_JOB_LOG_EX_STACK on ACT_HI_JOB_LOG(JOB_EXCEPTION_STACK_ID_); + +create index ACT_HI_EXT_TASK_LOG_PROCINST on ACT_HI_EXT_TASK_LOG(PROC_INST_ID_); +create index ACT_HI_EXT_TASK_LOG_PROCDEF on ACT_HI_EXT_TASK_LOG(PROC_DEF_ID_); +create index ACT_HI_EXT_TASK_LOG_PROC_DEF_KEY on ACT_HI_EXT_TASK_LOG(PROC_DEF_KEY_); +create index ACT_HI_EXT_TASK_LOG_TENANT_ID on ACT_HI_EXT_TASK_LOG(TENANT_ID_); +create index ACT_IDX_HI_EXTTASKLOG_ERRORDET on ACT_HI_EXT_TASK_LOG(ERROR_DETAILS_ID_); + +create index ACT_IDX_HI_OP_LOG_PROCINST on ACT_HI_OP_LOG(PROC_INST_ID_); +create index ACT_IDX_HI_OP_LOG_PROCDEF on ACT_HI_OP_LOG(PROC_DEF_ID_); + +create index ACT_IDX_HI_COMMENT_TASK on ACT_HI_COMMENT(TASK_ID_); +create index ACT_IDX_HI_COMMENT_PROCINST on ACT_HI_COMMENT(PROC_INST_ID_); + +create index ACT_IDX_HI_ATTACHMENT_CONTENT on ACT_HI_ATTACHMENT(CONTENT_ID_); +create index ACT_IDX_HI_ATTACHMENT_PROCINST on ACT_HI_ATTACHMENT(PROC_INST_ID_); +create index ACT_IDX_HI_ATTACHMENT_TASK on ACT_HI_ATTACHMENT(TASK_ID_); +create table ACT_HI_CASEINST ( + ID_ varchar(64) not null, + CASE_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64) not null, + CREATE_TIME_ datetime(3) not null, + CLOSE_TIME_ datetime(3), + DURATION_ bigint, + STATE_ integer, + CREATE_USER_ID_ varchar(255), + SUPER_CASE_INSTANCE_ID_ varchar(64), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_), + unique (CASE_INST_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_CASEACTINST ( + ID_ varchar(64) not null, + PARENT_ACT_INST_ID_ varchar(64), + CASE_DEF_ID_ varchar(64) not null, + CASE_INST_ID_ varchar(64) not null, + CASE_ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + CALL_CASE_INST_ID_ varchar(64), + CASE_ACT_NAME_ varchar(255), + CASE_ACT_TYPE_ varchar(255), + CREATE_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + STATE_ integer, + REQUIRED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_CAS_I_CLOSE on ACT_HI_CASEINST(CLOSE_TIME_); +create index ACT_IDX_HI_CAS_I_BUSKEY on ACT_HI_CASEINST(BUSINESS_KEY_); +create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_); +create index ACT_IDX_HI_CAS_A_I_CREATE on ACT_HI_CASEACTINST(CREATE_TIME_); +create index ACT_IDX_HI_CAS_A_I_END on ACT_HI_CASEACTINST(END_TIME_); +create index ACT_IDX_HI_CAS_A_I_COMP on ACT_HI_CASEACTINST(CASE_ACT_ID_, END_TIME_, ID_); +create index ACT_IDX_HI_CAS_A_I_CASEINST on ACT_HI_CASEACTINST(CASE_INST_ID_, CASE_ACT_ID_); +create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_); +-- create history decision instance table -- +create table ACT_HI_DECINST ( + ID_ varchar(64) NOT NULL, + DEC_DEF_ID_ varchar(64) NOT NULL, + DEC_DEF_KEY_ varchar(255) NOT NULL, + DEC_DEF_NAME_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + EVAL_TIME_ datetime(3) not null, + COLLECT_VALUE_ double, + USER_ID_ varchar(255), + ROOT_DEC_INST_ID_ varchar(64), + DEC_REQ_ID_ varchar(64), + DEC_REQ_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision input table -- +create table ACT_HI_DEC_IN ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64), + CLAUSE_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision output table -- +create table ACT_HI_DEC_OUT ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64), + CLAUSE_NAME_ varchar(255), + RULE_ID_ varchar(64), + RULE_ORDER_ integer, + VAR_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + + +create index ACT_IDX_HI_DEC_INST_ID on ACT_HI_DECINST(DEC_DEF_ID_); +create index ACT_IDX_HI_DEC_INST_KEY on ACT_HI_DECINST(DEC_DEF_KEY_); +create index ACT_IDX_HI_DEC_INST_PI on ACT_HI_DECINST(PROC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_CI on ACT_HI_DECINST(CASE_INST_ID_); +create index ACT_IDX_HI_DEC_INST_ACT on ACT_HI_DECINST(ACT_ID_); +create index ACT_IDX_HI_DEC_INST_ACT_INST on ACT_HI_DECINST(ACT_INST_ID_); +create index ACT_IDX_HI_DEC_INST_TIME on ACT_HI_DECINST(EVAL_TIME_); +create index ACT_IDX_HI_DEC_INST_TENANT_ID on ACT_HI_DECINST(TENANT_ID_); +create index ACT_IDX_HI_DEC_INST_ROOT_ID on ACT_HI_DECINST(ROOT_DEC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_REQ_ID on ACT_HI_DECINST(DEC_REQ_ID_); +create index ACT_IDX_HI_DEC_INST_REQ_KEY on ACT_HI_DECINST(DEC_REQ_KEY_); + + +create index ACT_IDX_HI_DEC_IN_INST on ACT_HI_DEC_IN(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_IN_CLAUSE on ACT_HI_DEC_IN(DEC_INST_ID_, CLAUSE_ID_); + +create index ACT_IDX_HI_DEC_OUT_INST on ACT_HI_DEC_OUT(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_OUT_RULE on ACT_HI_DEC_OUT(RULE_ORDER_, CLAUSE_ID_); + +-- mariadb_identity_7.8.0-ee + +create table ACT_ID_GROUP ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + TYPE_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_MEMBERSHIP ( + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (USER_ID_, GROUP_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_USER ( + ID_ varchar(64), + REV_ integer, + FIRST_ varchar(255), + LAST_ varchar(255), + EMAIL_ varchar(255), + PWD_ varchar(255), + SALT_ varchar(255), + PICTURE_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_INFO ( + ID_ varchar(64), + REV_ integer, + USER_ID_ varchar(64), + TYPE_ varchar(64), + KEY_ varchar(255), + VALUE_ varchar(255), + PASSWORD_ LONGBLOB, + PARENT_ID_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT_MEMBER ( + ID_ varchar(64) not null, + TENANT_ID_ varchar(64) not null, + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_ID_MEMBERSHIP + add constraint ACT_FK_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + +alter table ACT_ID_MEMBERSHIP + add constraint ACT_FK_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_USER + unique (TENANT_ID_, USER_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_GROUP + unique (TENANT_ID_, GROUP_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB + foreign key (TENANT_ID_) + references ACT_ID_TENANT (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + + -- cgit 1.2.3-korg